[llvm-branch-commits] [lld] [ELF] Orphan placement: remove hasInputSections condition (PR #93761)

2024-06-06 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/93761

>From 316e0a1effb50b15fa1df54a43d02704f735309d Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Wed, 29 May 2024 20:14:18 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.5-bogner
---
 lld/ELF/Writer.cpp| 18 ++
 .../linkerscript/memory-nonalloc-no-warn.test | 19 +--
 lld/test/ELF/linkerscript/nobits-offset.s |  2 +-
 lld/test/ELF/linkerscript/orphan-live-only.s  |  6 +++---
 .../ELF/linkerscript/symbol-only-align.test   | 11 ++-
 lld/test/ELF/linkerscript/tls-nobits-offset.s |  2 +-
 6 files changed, 26 insertions(+), 32 deletions(-)

diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index c498153f3348b..4add995c93458 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -890,9 +890,7 @@ template  void 
Writer::setReservedSymbolSections() {
 // countLeadingZeros.
 static int getRankProximity(OutputSection *a, SectionCommand *b) {
   auto *osd = dyn_cast(b);
-  return (osd && osd->osec.hasInputSections)
- ? llvm::countl_zero(a->sortRank ^ osd->osec.sortRank)
- : -1;
+  return osd ? llvm::countl_zero(a->sortRank ^ osd->osec.sortRank) : -1;
 }
 
 // When placing orphan sections, we want to place them after symbol assignments
@@ -958,20 +956,16 @@ findOrphanPos(SmallVectorImpl::iterator 
b,
 sortRank = std::max(sortRank, foundSec->sortRank);
   for (; i != e; ++i) {
 auto *curSecDesc = dyn_cast(*i);
-if (!curSecDesc || !curSecDesc->osec.hasInputSections)
+if (!curSecDesc)
   continue;
 if (getRankProximity(sec, curSecDesc) != proximity ||
 sortRank < curSecDesc->osec.sortRank)
   break;
   }
 
-  auto isOutputSecWithInputSections = [](SectionCommand *cmd) {
-auto *osd = dyn_cast(cmd);
-return osd && osd->osec.hasInputSections;
-  };
-  auto j =
-  std::find_if(std::make_reverse_iterator(i), 
std::make_reverse_iterator(b),
-   isOutputSecWithInputSections);
+  auto isOutputSec = [](SectionCommand *cmd) { return isa(cmd); };
+  auto j = std::find_if(std::make_reverse_iterator(i),
+std::make_reverse_iterator(b), isOutputSec);
   i = j.base();
 
   // As a special case, if the orphan section is the last section, put
@@ -979,7 +973,7 @@ findOrphanPos(SmallVectorImpl::iterator b,
   // This matches bfd's behavior and is convenient when the linker script fully
   // specifies the start of the file, but doesn't care about the end (the non
   // alloc sections for example).
-  auto nextSec = std::find_if(i, e, isOutputSecWithInputSections);
+  auto nextSec = std::find_if(i, e, isOutputSec);
   if (nextSec == e)
 return e;
 
diff --git a/lld/test/ELF/linkerscript/memory-nonalloc-no-warn.test 
b/lld/test/ELF/linkerscript/memory-nonalloc-no-warn.test
index 2dcd0f8d6ce2f..9c6111008c818 100644
--- a/lld/test/ELF/linkerscript/memory-nonalloc-no-warn.test
+++ b/lld/test/ELF/linkerscript/memory-nonalloc-no-warn.test
@@ -16,22 +16,21 @@
 ## The output file must include all sections.
 # RUN: llvm-readelf -S %t/a.elf | FileCheck %s
 
-# CHECK:  There are 12 section headers, starting at offset 0x2140:
+# CHECK:  There are 12 section headers, starting at offset 0x2138:
 # CHECK:  [Nr] Name Type  Address  OffSize   ES 
Flg Lk Inf Al
 # CHECK-NEXT: [ 0]  NULL   00 00 00
 0  0   0
 # CHECK-NEXT: [ 1] .nonallocPROGBITS   001064 001000 00 W  
 0  0   1
-# CHECK-NEXT: [ 2] .comment PROGBITS   {{.*}} {{.*}} 01 MS 
 0  0   1
-# CHECK-NEXT: [ 3] .symtab  SYMTAB {{.*}} {{.*}} 18
 5  1   8
-# CHECK-NEXT: [ 4] .shstrtabSTRTAB {{.*}} {{.*}} 00
 0  0   1
-# CHECK-NEXT: [ 5] .strtab  STRTAB {{.*}} {{.*}} 00
 0  0   1
-# CHECK-NEXT: [ 6] .dat PROGBITS   002137 04 00 W  
 0  0   1
-# CHECK-NEXT: [ 7] .intvec0_out PROGBITS   00213b 00 00 W  
 0  0   1
-# CHECK-NEXT: [ 8] .intvec1_out PROGBITS   00213b 00 00 W  
 0  0   1
-# CHECK-NEXT: [ 9] .intvec2_out PROGBITS   00213b 00 00 W  
 0  0   1
+# CHECK-NEXT: [ 2] .dat PROGBITS   002064 04 00 W  
 0  0   1
+# CHECK-NEXT: [ 3] .intvec0_out PROGBITS   002068 00 00 W  
 0  0   1
+# CHECK-NEXT: [ 4] .intvec1_out PROGBITS   002068 00 00 W  
 0  0   1
+# CHECK-NEXT: [ 5] .intvec2_out PROGBITS   002068 00 00 W  
 0  0   1
+# CHECK-NEXT: [ 6] .comment PROGBITS   {{.*}} {{.*}} 01 MS 
 0  0   1
+# CHECK-NEXT: [ 7] .symtab  SYMTAB {{.*}} {{.*}} 18   

[llvm-branch-commits] [lld] [ELF] Orphan placement: remove hasInputSections condition (PR #93761)

2024-06-06 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/93761

>From 316e0a1effb50b15fa1df54a43d02704f735309d Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Wed, 29 May 2024 20:14:18 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.5-bogner
---
 lld/ELF/Writer.cpp| 18 ++
 .../linkerscript/memory-nonalloc-no-warn.test | 19 +--
 lld/test/ELF/linkerscript/nobits-offset.s |  2 +-
 lld/test/ELF/linkerscript/orphan-live-only.s  |  6 +++---
 .../ELF/linkerscript/symbol-only-align.test   | 11 ++-
 lld/test/ELF/linkerscript/tls-nobits-offset.s |  2 +-
 6 files changed, 26 insertions(+), 32 deletions(-)

diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index c498153f3348b..4add995c93458 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -890,9 +890,7 @@ template  void 
Writer::setReservedSymbolSections() {
 // countLeadingZeros.
 static int getRankProximity(OutputSection *a, SectionCommand *b) {
   auto *osd = dyn_cast(b);
-  return (osd && osd->osec.hasInputSections)
- ? llvm::countl_zero(a->sortRank ^ osd->osec.sortRank)
- : -1;
+  return osd ? llvm::countl_zero(a->sortRank ^ osd->osec.sortRank) : -1;
 }
 
 // When placing orphan sections, we want to place them after symbol assignments
@@ -958,20 +956,16 @@ findOrphanPos(SmallVectorImpl::iterator 
b,
 sortRank = std::max(sortRank, foundSec->sortRank);
   for (; i != e; ++i) {
 auto *curSecDesc = dyn_cast(*i);
-if (!curSecDesc || !curSecDesc->osec.hasInputSections)
+if (!curSecDesc)
   continue;
 if (getRankProximity(sec, curSecDesc) != proximity ||
 sortRank < curSecDesc->osec.sortRank)
   break;
   }
 
-  auto isOutputSecWithInputSections = [](SectionCommand *cmd) {
-auto *osd = dyn_cast(cmd);
-return osd && osd->osec.hasInputSections;
-  };
-  auto j =
-  std::find_if(std::make_reverse_iterator(i), 
std::make_reverse_iterator(b),
-   isOutputSecWithInputSections);
+  auto isOutputSec = [](SectionCommand *cmd) { return isa(cmd); };
+  auto j = std::find_if(std::make_reverse_iterator(i),
+std::make_reverse_iterator(b), isOutputSec);
   i = j.base();
 
   // As a special case, if the orphan section is the last section, put
@@ -979,7 +973,7 @@ findOrphanPos(SmallVectorImpl::iterator b,
   // This matches bfd's behavior and is convenient when the linker script fully
   // specifies the start of the file, but doesn't care about the end (the non
   // alloc sections for example).
-  auto nextSec = std::find_if(i, e, isOutputSecWithInputSections);
+  auto nextSec = std::find_if(i, e, isOutputSec);
   if (nextSec == e)
 return e;
 
diff --git a/lld/test/ELF/linkerscript/memory-nonalloc-no-warn.test 
b/lld/test/ELF/linkerscript/memory-nonalloc-no-warn.test
index 2dcd0f8d6ce2f..9c6111008c818 100644
--- a/lld/test/ELF/linkerscript/memory-nonalloc-no-warn.test
+++ b/lld/test/ELF/linkerscript/memory-nonalloc-no-warn.test
@@ -16,22 +16,21 @@
 ## The output file must include all sections.
 # RUN: llvm-readelf -S %t/a.elf | FileCheck %s
 
-# CHECK:  There are 12 section headers, starting at offset 0x2140:
+# CHECK:  There are 12 section headers, starting at offset 0x2138:
 # CHECK:  [Nr] Name Type  Address  OffSize   ES 
Flg Lk Inf Al
 # CHECK-NEXT: [ 0]  NULL   00 00 00
 0  0   0
 # CHECK-NEXT: [ 1] .nonallocPROGBITS   001064 001000 00 W  
 0  0   1
-# CHECK-NEXT: [ 2] .comment PROGBITS   {{.*}} {{.*}} 01 MS 
 0  0   1
-# CHECK-NEXT: [ 3] .symtab  SYMTAB {{.*}} {{.*}} 18
 5  1   8
-# CHECK-NEXT: [ 4] .shstrtabSTRTAB {{.*}} {{.*}} 00
 0  0   1
-# CHECK-NEXT: [ 5] .strtab  STRTAB {{.*}} {{.*}} 00
 0  0   1
-# CHECK-NEXT: [ 6] .dat PROGBITS   002137 04 00 W  
 0  0   1
-# CHECK-NEXT: [ 7] .intvec0_out PROGBITS   00213b 00 00 W  
 0  0   1
-# CHECK-NEXT: [ 8] .intvec1_out PROGBITS   00213b 00 00 W  
 0  0   1
-# CHECK-NEXT: [ 9] .intvec2_out PROGBITS   00213b 00 00 W  
 0  0   1
+# CHECK-NEXT: [ 2] .dat PROGBITS   002064 04 00 W  
 0  0   1
+# CHECK-NEXT: [ 3] .intvec0_out PROGBITS   002068 00 00 W  
 0  0   1
+# CHECK-NEXT: [ 4] .intvec1_out PROGBITS   002068 00 00 W  
 0  0   1
+# CHECK-NEXT: [ 5] .intvec2_out PROGBITS   002068 00 00 W  
 0  0   1
+# CHECK-NEXT: [ 6] .comment PROGBITS   {{.*}} {{.*}} 01 MS 
 0  0   1
+# CHECK-NEXT: [ 7] .symtab  SYMTAB {{.*}} {{.*}} 18   

[llvm-branch-commits] [lld] [ELF] Orphan placement: remove hasInputSections condition (PR #93761)

2024-06-05 Thread Fangrui Song via llvm-branch-commits


@@ -16,22 +16,21 @@
 ## The output file must include all sections.
 # RUN: llvm-readelf -S %t/a.elf | FileCheck %s
 
-# CHECK:  There are 12 section headers, starting at offset 0x2140:
+# CHECK:  There are 12 section headers, starting at offset 0x2138:
 # CHECK:  [Nr] Name Type  Address  OffSize   ES 
Flg Lk Inf Al
 # CHECK-NEXT: [ 0]  NULL   00 00 00
 0  0   0
 # CHECK-NEXT: [ 1] .nonallocPROGBITS   001064 001000 00 W  
 0  0   1

MaskRay wrote:

With #93761 , this patch will not need to modify this test file, but GitHub PR 
doesn't seem to make it clear.

https://github.com/llvm/llvm-project/pull/93761
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [ELF] Orphan placement: remove hasInputSections condition (PR #93761)

2024-06-05 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay edited 
https://github.com/llvm/llvm-project/pull/93761
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [ELF] Orphan placement: remove hasInputSections condition (PR #93761)

2024-06-05 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay edited 
https://github.com/llvm/llvm-project/pull/93761
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [ELF] Orphan placement: remove hasInputSections condition (PR #93761)

2024-06-05 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/93761

>From 316e0a1effb50b15fa1df54a43d02704f735309d Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Wed, 29 May 2024 20:14:18 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.5-bogner
---
 lld/ELF/Writer.cpp| 18 ++
 .../linkerscript/memory-nonalloc-no-warn.test | 19 +--
 lld/test/ELF/linkerscript/nobits-offset.s |  2 +-
 lld/test/ELF/linkerscript/orphan-live-only.s  |  6 +++---
 .../ELF/linkerscript/symbol-only-align.test   | 11 ++-
 lld/test/ELF/linkerscript/tls-nobits-offset.s |  2 +-
 6 files changed, 26 insertions(+), 32 deletions(-)

diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index c498153f3348b..4add995c93458 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -890,9 +890,7 @@ template  void 
Writer::setReservedSymbolSections() {
 // countLeadingZeros.
 static int getRankProximity(OutputSection *a, SectionCommand *b) {
   auto *osd = dyn_cast(b);
-  return (osd && osd->osec.hasInputSections)
- ? llvm::countl_zero(a->sortRank ^ osd->osec.sortRank)
- : -1;
+  return osd ? llvm::countl_zero(a->sortRank ^ osd->osec.sortRank) : -1;
 }
 
 // When placing orphan sections, we want to place them after symbol assignments
@@ -958,20 +956,16 @@ findOrphanPos(SmallVectorImpl::iterator 
b,
 sortRank = std::max(sortRank, foundSec->sortRank);
   for (; i != e; ++i) {
 auto *curSecDesc = dyn_cast(*i);
-if (!curSecDesc || !curSecDesc->osec.hasInputSections)
+if (!curSecDesc)
   continue;
 if (getRankProximity(sec, curSecDesc) != proximity ||
 sortRank < curSecDesc->osec.sortRank)
   break;
   }
 
-  auto isOutputSecWithInputSections = [](SectionCommand *cmd) {
-auto *osd = dyn_cast(cmd);
-return osd && osd->osec.hasInputSections;
-  };
-  auto j =
-  std::find_if(std::make_reverse_iterator(i), 
std::make_reverse_iterator(b),
-   isOutputSecWithInputSections);
+  auto isOutputSec = [](SectionCommand *cmd) { return isa(cmd); };
+  auto j = std::find_if(std::make_reverse_iterator(i),
+std::make_reverse_iterator(b), isOutputSec);
   i = j.base();
 
   // As a special case, if the orphan section is the last section, put
@@ -979,7 +973,7 @@ findOrphanPos(SmallVectorImpl::iterator b,
   // This matches bfd's behavior and is convenient when the linker script fully
   // specifies the start of the file, but doesn't care about the end (the non
   // alloc sections for example).
-  auto nextSec = std::find_if(i, e, isOutputSecWithInputSections);
+  auto nextSec = std::find_if(i, e, isOutputSec);
   if (nextSec == e)
 return e;
 
diff --git a/lld/test/ELF/linkerscript/memory-nonalloc-no-warn.test 
b/lld/test/ELF/linkerscript/memory-nonalloc-no-warn.test
index 2dcd0f8d6ce2f..9c6111008c818 100644
--- a/lld/test/ELF/linkerscript/memory-nonalloc-no-warn.test
+++ b/lld/test/ELF/linkerscript/memory-nonalloc-no-warn.test
@@ -16,22 +16,21 @@
 ## The output file must include all sections.
 # RUN: llvm-readelf -S %t/a.elf | FileCheck %s
 
-# CHECK:  There are 12 section headers, starting at offset 0x2140:
+# CHECK:  There are 12 section headers, starting at offset 0x2138:
 # CHECK:  [Nr] Name Type  Address  OffSize   ES 
Flg Lk Inf Al
 # CHECK-NEXT: [ 0]  NULL   00 00 00
 0  0   0
 # CHECK-NEXT: [ 1] .nonallocPROGBITS   001064 001000 00 W  
 0  0   1
-# CHECK-NEXT: [ 2] .comment PROGBITS   {{.*}} {{.*}} 01 MS 
 0  0   1
-# CHECK-NEXT: [ 3] .symtab  SYMTAB {{.*}} {{.*}} 18
 5  1   8
-# CHECK-NEXT: [ 4] .shstrtabSTRTAB {{.*}} {{.*}} 00
 0  0   1
-# CHECK-NEXT: [ 5] .strtab  STRTAB {{.*}} {{.*}} 00
 0  0   1
-# CHECK-NEXT: [ 6] .dat PROGBITS   002137 04 00 W  
 0  0   1
-# CHECK-NEXT: [ 7] .intvec0_out PROGBITS   00213b 00 00 W  
 0  0   1
-# CHECK-NEXT: [ 8] .intvec1_out PROGBITS   00213b 00 00 W  
 0  0   1
-# CHECK-NEXT: [ 9] .intvec2_out PROGBITS   00213b 00 00 W  
 0  0   1
+# CHECK-NEXT: [ 2] .dat PROGBITS   002064 04 00 W  
 0  0   1
+# CHECK-NEXT: [ 3] .intvec0_out PROGBITS   002068 00 00 W  
 0  0   1
+# CHECK-NEXT: [ 4] .intvec1_out PROGBITS   002068 00 00 W  
 0  0   1
+# CHECK-NEXT: [ 5] .intvec2_out PROGBITS   002068 00 00 W  
 0  0   1
+# CHECK-NEXT: [ 6] .comment PROGBITS   {{.*}} {{.*}} 01 MS 
 0  0   1
+# CHECK-NEXT: [ 7] .symtab  SYMTAB {{.*}} {{.*}} 18   

[llvm-branch-commits] [lld] [lld] Discard SHT_LLVM_LTO sections in relocatable links (PR #92825)

2024-05-21 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/92825
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] Discard SHT_LLVM_LTO sections in relocatable links (PR #92825)

2024-05-20 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay edited 
https://github.com/llvm/llvm-project/pull/92825
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] Discard SHT_LLVM_LTO sections in relocatable links (PR #92825)

2024-05-20 Thread Fangrui Song via llvm-branch-commits


@@ -832,6 +832,15 @@ void ObjFile::initializeSections(bool ignoreComdats,
   this->sections[i] =
   createInputSection(i, sec, check(obj.getSectionName(sec, shstrtab)));
   break;
+case SHT_LLVM_LTO:
+  // When doing a relocatable link with FatLTO objects, if we're not using

MaskRay wrote:

// Discard .llvm.lto in a relocatable link that does not use the bitcode. The 
concatenated output does not reflect the semantics. In addition, since we do 
not use the bitcode wrapper format, the concatenated raw bitcode would be 
invalid.

https://github.com/llvm/llvm-project/pull/92825
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] Discard SHT_LLVM_LTO sections in relocatable links (PR #92825)

2024-05-20 Thread Fangrui Song via llvm-branch-commits


@@ -832,6 +832,15 @@ void ObjFile::initializeSections(bool ignoreComdats,
   this->sections[i] =
   createInputSection(i, sec, check(obj.getSectionName(sec, shstrtab)));
   break;
+case SHT_LLVM_LTO:
+  // When doing a relocatable link with FatLTO objects, if we're not using
+  // the bitcode, discard it, since it will be concatenated together when
+  // handling orphan sections, and which will be an invalid bitcode object.
+  if (config->relocatable && !config->fatLTOObjects) {
+sections[i] = ::discarded;
+break;
+  }
+  LLVM_FALLTHROUGH;

MaskRay wrote:

`[[fallthrough]]` since C++17

https://github.com/llvm/llvm-project/pull/92825
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] Discard SHT_LLVM_LTO sections in relocatable links (PR #92825)

2024-05-20 Thread Fangrui Song via llvm-branch-commits

MaskRay wrote:

There is a bitcode wrapper (see discussions at 
https://reviews.llvm.org/D86847), but I agree that discarding `.llvm.lto` is 
better since concatenated `.llvm.lto` does not reflect the `ld.lld -r 
` semantics.

https://github.com/llvm/llvm-project/pull/92825
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [llvm] release/18.x: [llvm][lld] Pre-commit tests for RISCV TLSDESC symbols (PR #91632)

2024-05-10 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/91632
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [llvm] release/18.x: [RISCV][lld] Set the type of TLSDESC relocation's referenced local symbol to STT_NOTYPE (PR #91678)

2024-05-10 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/91678
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [llvm] release/18.x: [RISCV][lld] Set the type of TLSDESC relocation's referenced local symbol to STT_NOTYPE (PR #91678)

2024-05-09 Thread Fangrui Song via llvm-branch-commits

MaskRay wrote:

LGTM

https://github.com/llvm/llvm-project/pull/91678
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [llvm] release/18.x: [llvm][lld] Pre-commit tests for RISCV TLSDESC symbols (PR #91632)

2024-05-09 Thread Fangrui Song via llvm-branch-commits

MaskRay wrote:

LGTM

https://github.com/llvm/llvm-project/pull/91632
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [LoongArch][Codegen] Add support for TLSDESC (PR #90159)

2024-04-29 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/90159
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [LoongArch][Codegen] Add support for TLSDESC (PR #90159)

2024-04-29 Thread Fangrui Song via llvm-branch-commits

MaskRay wrote:

Add a test to clang/test/Driver/tls-dialect.c

https://github.com/llvm/llvm-project/pull/90159
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [llvm] release/18.x: [LoongArch] Use R_LARCH_ALIGN with section symbol (#84741) (PR #88891)

2024-04-19 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay requested changes to this pull request.

Sorry, NAK.

I objected to https://sourceware.org/pipermail/binutils/2024-April/133725.html 
as well. This requires more discussion.

https://github.com/llvm/llvm-project/pull/88891
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [llvm] release/18.x: [LoongArch] Use R_LARCH_ALIGN with section symbol (#84741) (PR #88891)

2024-04-18 Thread Fangrui Song via llvm-branch-commits

MaskRay wrote:

LGTM for GCC/binutils compatibility

https://github.com/llvm/llvm-project/pull/88891
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] ReleaseNote: Mention SpecialCaseList change (PR #89141)

2024-04-18 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/89141

>From a562fa55380991c37b0ec3ace83a98715795517a Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Wed, 17 Apr 2024 13:51:25 -0700
Subject: [PATCH 1/3] ReleaseNote: Mention SpecialCaseList change

---
 llvm/docs/ReleaseNotes.rst | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index ecfcd2c983ce5e..453abc63397764 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -435,6 +435,12 @@ Changes to Sanitizers
 -
 * HWASan now defaults to detecting use-after-scope bugs.
 
+* ``SpecialCaseList`` used by sanitizer ignore lists (e.g. ``*_ignorelist.txt``
+  in the Clang resource directory) now uses glob patterns instead of a variant
+  of POSIX Extended Regular Expression (where ``*`` is translated to ``.*``) by
+  default. Search for ``|`` to find patterns that may have different meanings
+  now.
+
 Changes to the Profile Runtime
 --
 

>From ac705f3426a08296b3125beb68ac941d1d7266fd Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Wed, 17 Apr 2024 23:37:28 -0700
Subject: [PATCH 2/3] Add a link

---
 llvm/docs/ReleaseNotes.rst | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 453abc63397764..7c08935af385d2 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -435,11 +435,11 @@ Changes to Sanitizers
 -
 * HWASan now defaults to detecting use-after-scope bugs.
 
-* ``SpecialCaseList`` used by sanitizer ignore lists (e.g. ``*_ignorelist.txt``
-  in the Clang resource directory) now uses glob patterns instead of a variant
-  of POSIX Extended Regular Expression (where ``*`` is translated to ``.*``) by
-  default. Search for ``|`` to find patterns that may have different meanings
-  now.
+* `SpecialCaseList 
`_
+  used by sanitizer ignore lists (e.g. ``*_ignorelist.txt`` in the Clang
+  resource directory) now uses glob patterns instead of a variant of POSIX
+  Extended Regular Expression (where ``*`` is translated to ``.*``) by default.
+  Search for ``|`` to find patterns that may have different meanings now.
 
 Changes to the Profile Runtime
 --

>From e27af1095a716e09e1f005808e2d279867689306 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Thu, 18 Apr 2024 10:27:09 -0700
Subject: [PATCH 3/3] Update llvm/docs/ReleaseNotes.rst

Co-authored-by: Paul T Robinson 
---
 llvm/docs/ReleaseNotes.rst | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 7c08935af385d2..ff929b0bc5e15b 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -439,7 +439,8 @@ Changes to Sanitizers
   used by sanitizer ignore lists (e.g. ``*_ignorelist.txt`` in the Clang
   resource directory) now uses glob patterns instead of a variant of POSIX
   Extended Regular Expression (where ``*`` is translated to ``.*``) by default.
-  Search for ``|`` to find patterns that may have different meanings now.
+  Search for ``|`` to find patterns that may have different meanings now, and
+  replace ``a|b`` with ``{a,b}``.
 
 Changes to the Profile Runtime
 --

___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] ReleaseNote: Mention SpecialCaseList change (PR #89141)

2024-04-18 Thread Fangrui Song via llvm-branch-commits

MaskRay wrote:

> Should we add a link to the docs?
> 
> [clang.llvm.org/docs/SanitizerSpecialCaseList.html#format](https://clang.llvm.org/docs/SanitizerSpecialCaseList.html#format)

Thanks for the suggestion. Added

https://github.com/llvm/llvm-project/pull/89141
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] ReleaseNote: Mention SpecialCaseList change (PR #89141)

2024-04-18 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/89141

>From a562fa55380991c37b0ec3ace83a98715795517a Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Wed, 17 Apr 2024 13:51:25 -0700
Subject: [PATCH 1/2] ReleaseNote: Mention SpecialCaseList change

---
 llvm/docs/ReleaseNotes.rst | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index ecfcd2c983ce5e..453abc63397764 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -435,6 +435,12 @@ Changes to Sanitizers
 -
 * HWASan now defaults to detecting use-after-scope bugs.
 
+* ``SpecialCaseList`` used by sanitizer ignore lists (e.g. ``*_ignorelist.txt``
+  in the Clang resource directory) now uses glob patterns instead of a variant
+  of POSIX Extended Regular Expression (where ``*`` is translated to ``.*``) by
+  default. Search for ``|`` to find patterns that may have different meanings
+  now.
+
 Changes to the Profile Runtime
 --
 

>From ac705f3426a08296b3125beb68ac941d1d7266fd Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Wed, 17 Apr 2024 23:37:28 -0700
Subject: [PATCH 2/2] Add a link

---
 llvm/docs/ReleaseNotes.rst | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 453abc63397764..7c08935af385d2 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -435,11 +435,11 @@ Changes to Sanitizers
 -
 * HWASan now defaults to detecting use-after-scope bugs.
 
-* ``SpecialCaseList`` used by sanitizer ignore lists (e.g. ``*_ignorelist.txt``
-  in the Clang resource directory) now uses glob patterns instead of a variant
-  of POSIX Extended Regular Expression (where ``*`` is translated to ``.*``) by
-  default. Search for ``|`` to find patterns that may have different meanings
-  now.
+* `SpecialCaseList 
`_
+  used by sanitizer ignore lists (e.g. ``*_ignorelist.txt`` in the Clang
+  resource directory) now uses glob patterns instead of a variant of POSIX
+  Extended Regular Expression (where ``*`` is translated to ``.*``) by default.
+  Search for ``|`` to find patterns that may have different meanings now.
 
 Changes to the Profile Runtime
 --

___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR] Add options to emit ClangIR and enable the ClangIR pipeline (PR #89030)

2024-04-17 Thread Fangrui Song via llvm-branch-commits


@@ -2876,6 +2876,15 @@ def flax_vector_conversions : Flag<["-"], 
"flax-vector-conversions">, Group, Group,
   HelpText<"Force linking the clang builtins runtime library">;
+
+/// ClangIR-specific options - BEGIN
+def fclangir_enable : Flag<["-"], "fclangir-enable">, Visibility<[ClangOption, 
CC1Option]>,

MaskRay wrote:

+1 to -fclangir and -fno-clangir.

You can use `BoolFOption` to define two options at one time. Ensure that only 
the positive form gets a `CC1Option` (so that `clang -cc1 -fno-clangir` is 
invalid`)

https://github.com/llvm/llvm-project/pull/89030
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] release/18.x: [X86] Always use 64-bit relocations in no-PIC large code model (#89101) (PR #89124)

2024-04-17 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/89124
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] ReleaseNote: Mention SpecialCaseList change (PR #89141)

2024-04-17 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/89141

>From a562fa55380991c37b0ec3ace83a98715795517a Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Wed, 17 Apr 2024 13:51:25 -0700
Subject: [PATCH] ReleaseNote: Mention SpecialCaseList change

---
 llvm/docs/ReleaseNotes.rst | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index ecfcd2c983ce5e..453abc63397764 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -435,6 +435,12 @@ Changes to Sanitizers
 -
 * HWASan now defaults to detecting use-after-scope bugs.
 
+* ``SpecialCaseList`` used by sanitizer ignore lists (e.g. ``*_ignorelist.txt``
+  in the Clang resource directory) now uses glob patterns instead of a variant
+  of POSIX Extended Regular Expression (where ``*`` is translated to ``.*``) by
+  default. Search for ``|`` to find patterns that may have different meanings
+  now.
+
 Changes to the Profile Runtime
 --
 

___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] ReleaseNote: Mention SpecialCaseList change (PR #89141)

2024-04-17 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay milestoned 
https://github.com/llvm/llvm-project/pull/89141
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] ReleaseNote: Mention SpecialCaseList change (PR #89141)

2024-04-17 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay created 
https://github.com/llvm/llvm-project/pull/89141

None

>From 34afd4aa3c44d65f66edfc9e568890fd16d81a59 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Wed, 17 Apr 2024 13:51:25 -0700
Subject: [PATCH] ReleaseNote: Mention SpecialCaseList change

---
 llvm/docs/ReleaseNotes.rst | 5 +
 1 file changed, 5 insertions(+)

diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index ecfcd2c983ce5e..e049689adc703c 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -435,6 +435,11 @@ Changes to Sanitizers
 -
 * HWASan now defaults to detecting use-after-scope bugs.
 
+* ``SpecialCaseList`` used by sanitizer ignore lists now uses glob patterns
+  instead of a variant of POSIX Extended Regular Expression (where ``*`` is
+  translated to ``.*``) by default. Search for ``|`` to find patterns that may
+  have different meanings now.
+
 Changes to the Profile Runtime
 --
 

___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] release/18.x: [lld/ELF][X86] Respect outSecOff when checking if GOTPCREL can be relaxed (#86334) (PR #86688)

2024-03-26 Thread Fangrui Song via llvm-branch-commits

MaskRay wrote:

The patch in question fixed a regression (assert in certain cases) introduced 
by https://reviews.llvm.org/D157020

https://github.com/llvm/llvm-project/pull/86688
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] release/18.x: [lld/ELF][X86] Respect outSecOff when checking if GOTPCREL can be relaxed (#86334) (PR #86688)

2024-03-26 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/86688
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [lld] Fix handling of RISCV TLSDESC relocations (PR #85817)

2024-03-21 Thread Fangrui Song via llvm-branch-commits

MaskRay wrote:

The title is not descriptive. This is primarily a RISC-V side MC issue. Perhaps

`[RISCV,lld] Set the type of TLSDESC relocations referenced local symbol to 
STT_NOTYPE`

https://github.com/llvm/llvm-project/pull/85817
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [lld] Fix handling of RISCV TLSDESC relocations (PR #85817)

2024-03-21 Thread Fangrui Song via llvm-branch-commits


@@ -1480,7 +1480,13 @@ template  void 
RelocationScanner::scanOne(RelTy *) {
 
   // Process TLS relocations, including TLS optimizations. Note that
   // R_TPREL and R_TPREL_NEG relocations are resolved in processAux.
-  if (sym.isTls()) {
+  if (sym.isTls() ||

MaskRay wrote:

Attach this diff
```
-  if (sym.isTls() ||
-  // These RISCV TLSDESC relocations reference a local symbol that won't be
-  // a TLS symbol, but we need to process them in handleTlsRelocation the
-  // same as other TLS relocations.
-  (config->emachine == EM_RISCV &&
-   (type == R_RISCV_TLSDESC_CALL || type == R_RISCV_TLSDESC_LOAD_LO12 ||
-type == R_RISCV_TLSDESC_ADD_LO12))) {
+  //
+  // Some RISCV TLSDESC relocations reference a local NOTYPE symbol, but we
+  // need to process them in handleTlsRelocation.
+  if (sym.isTls() || oneof(expr)) {
```

https://github.com/llvm/llvm-project/pull/85817
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [lld] Fix handling of RISCV TLSDESC relocations (PR #85817)

2024-03-21 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/85817
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [lld] Fix handling of RISCV TLSDESC relocations (PR #85817)

2024-03-21 Thread Fangrui Song via llvm-branch-commits


@@ -136,28 +140,30 @@
 
 # IE32:   .got 0008 00012248
 
-# IE32-LABEL: <.text>:
+# IE32-LABEL: <.Ltlsdesc_hi0>:
 ## st_value(a) = 8
 # IE32-NEXT: addizero, zero, 0x0
 # IE32-NEXT: addizero, zero, 0x0
 # IE32-NEXT: addizero, zero, 0x0
 # IE32-NEXT: addia0, zero, 0x8
 # IE32-NEXT: add a0, a0, tp
 ## st_value(b) = 2047
+# IE32-LABEL: <.Ltlsdesc_hi1>:
 # IE32-NEXT: addizero, zero, 0x0
 # IE32-NEXT: addizero, zero, 0x0
 # IE32-NEXT: addizero, zero, 0x0
 # IE32-NEXT: addia0, zero, 0x7ff
 # IE32-NEXT: add a0, a0, tp
 ## &.got[c]-. = 0x12248+4 - 0x111cc = 0x1080
+# IE32-LABEL: <.Ltlsdesc_hi2>:
 # IE32-NEXT: addizero, zero, 0x0
 # IE32-NEXT: addizero, zero, 0x0
 # IE32-NEXT:  111cc: auipc   a0, 0x1
 # IE32-NEXT: lw  a0, 0x80(a0)
 # IE32-NEXT: add a0, a0, tp
 
-## FIXME This should not pass, but the code MC layer needs a fix to prevent 
this.
-# BADTLSLABEL: error: d.{{.*}}.o has an STT_TLS symbol but doesn't have an 
SHF_TLS section
+# At one point the local TLSDESC labels would be marked STT_TLS, so make sure 
we don't regress
+# BADTLSLABEL-NOT: error: d.{{.*}}.o has an STT_TLS symbol but doesn't have an 
SHF_TLS section

MaskRay wrote:

Delete the NOT pattern. If the diagnostic changes, the NOT pattern may likely 
not get updated.

`# ` => `## Before #85817`

https://github.com/llvm/llvm-project/pull/85817
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [lld] Fix handling of RISCV TLSDESC relocations (PR #85817)

2024-03-21 Thread Fangrui Song via llvm-branch-commits


@@ -30,10 +30,10 @@
 # RUN: llvm-objdump --no-show-raw-insn -M no-aliases -h -d a.32.ie | FileCheck 
%s --check-prefix=IE32
 
 # RUN: llvm-mc -triple=riscv64 -filetype=obj d.s -o d.64.o
-# RUN: not ld.lld -shared -soname=d.64.so -o d.64.so d.64.o 2>&1 | FileCheck 
%s --check-prefix=BADTLSLABEL
+# RUN: ld.lld -shared -soname=d.64.so -o d.64.so d.64.o 2>&1 | FileCheck %s 
--check-prefix=BADTLSLABEL --allow-empty

MaskRay wrote:

--allow-empty is an anti-pattern. Avoid.

Replace `2>&1 | ...` with --fatal-warnings

https://github.com/llvm/llvm-project/pull/85817
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] release/18.x: [ELF] Eliminate symbols demoted due to /DISCARD/ discarded sections (#85167) (PR #85266)

2024-03-14 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/85266
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm-objcopy] Add --compress-sections (PR #85036)

2024-03-13 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/85036


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm-objcopy] Add --compress-sections (PR #85036)

2024-03-13 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/85036


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] [libcxxabi] [libunwind] release/18.x: [runtimes] Prefer -fvisibility-global-new-delete=force-hidden (#84917) (PR #85126)

2024-03-13 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/85126
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang][ubsan] Switch UBSAN optimization to `llvm.experimental.hot` (PR #84858)

2024-03-12 Thread Fangrui Song via llvm-branch-commits


@@ -100,9 +100,9 @@ using namespace llvm;
 namespace llvm {
 extern cl::opt PrintPipelinePasses;
 
-cl::opt ClRemoveTraps("clang-remove-traps", cl::Optional,
-cl::desc("Insert remove-traps pass."),
-cl::init(false));
+static cl::opt ClRemoveTraps("clang-remove-traps", cl::Optional,
+   cl::desc("Insert remove-traps pass."),
+   cl::init(false));

MaskRay wrote:

We usually omit `cl::init(false)`

https://github.com/llvm/llvm-project/pull/84858
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm-objcopy] --[de]compress-debug-sections: don't compress SHF_ALLOC sections, only decompress .debug sections (PR #84885)

2024-03-12 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/84885


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm-objcopy] --[de]compress-debug-sections: don't compress SHF_ALLOC sections, only decompress .debug sections (PR #84885)

2024-03-12 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay edited 
https://github.com/llvm/llvm-project/pull/84885
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm-objcopy] --[de]compress-debug-sections: don't compress SHF_ALLOC sections, only decompress .debug sections (PR #84885)

2024-03-12 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/84885


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm-objcopy] Simplify --[de]compress-debug-sections and don't compress SHF_ALLOC sections (PR #84885)

2024-03-12 Thread Fangrui Song via llvm-branch-commits


@@ -214,33 +214,34 @@ static Error dumpSectionToFile(StringRef SecName, 
StringRef Filename,
SecName.str().c_str());
 }
 
-static bool isCompressable(const SectionBase ) {
-  return !(Sec.Flags & ELF::SHF_COMPRESSED) &&
- StringRef(Sec.Name).starts_with(".debug");
-}
-
-static Error replaceDebugSections(
-Object , function_ref ShouldReplace,
-function_ref(const SectionBase *)> AddSection) {
+Error Object::compressOrDecompressSections(const CommonConfig ) {
   // Build a list of the debug sections we are going to replace.
   // We can't call `AddSection` while iterating over sections,
   // because it would mutate the sections array.
-  SmallVector ToReplace;
-  for (auto  : Obj.sections())
-if (ShouldReplace(Sec))
-  ToReplace.push_back();
-
-  // Build a mapping from original section to a new one.
-  DenseMap FromTo;
-  for (SectionBase *S : ToReplace) {
-Expected NewSection = AddSection(S);
-if (!NewSection)
-  return NewSection.takeError();
-
-FromTo[S] = *NewSection;
+  SmallVector>, 0>

MaskRay wrote:

The default is a smart value to keep `sizeof(SmallVector)` around 64 bytes. 
Someone might send a RFC to change the default to 0 and have another mechanism 
to use the default. I believe `, 0` is used much more than the smart default, 
since in many cases people don't care about extra heap allocations at runtime, 
but I care about code size and the smaller structure of `SmallVector`.

https://github.com/llvm/llvm-project/pull/84885
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [llvm][lld][RISCV] Support x3_reg_usage (PR #84598)

2024-03-12 Thread Fangrui Song via llvm-branch-commits


@@ -1135,11 +1135,34 @@ static void mergeAtomic(DenseMap::iterator it,
   };
 }
 
+static void mergeX3RegUse(DenseMap::iterator it,
+  const InputSectionBase *oldSection,
+  const InputSectionBase *newSection,
+  unsigned int oldTag, unsigned int newTag) {
+  // X3/GP register usage ar incompatible and cannot be merged, with the
+  // exception of the UNKNOWN or 0 value
+  using RISCVAttrs::RISCVX3RegUse::X3RegUsage;
+  if (newTag == X3RegUsage::UNKNOWN)
+return;
+  if (oldTag == X3RegUsage::UNKNOWN) {
+it->getSecond() = newTag;
+return;
+  }
+  if (oldTag != newTag) {
+errorOrWarn(toString(oldSection) + " has x3_reg_usage=" + Twine(oldTag) +

MaskRay wrote:

We seem to use errors for parsing errors. This is probably a warning.

https://github.com/llvm/llvm-project/pull/84598
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [llvm][lld][RISCV] Support x3_reg_usage (PR #84598)

2024-03-12 Thread Fangrui Song via llvm-branch-commits


@@ -412,6 +429,36 @@
 # A6S_A7:   }
 # A6S_A7: }
 
+#--- x3_reg_usage_unknown.s
+.attribute x3_reg_usage, 0
+
+#--- x3_reg_usage_gp.s
+.attribute x3_reg_usage, 1
+
+#--- x3_reg_usage_scs.s
+.attribute x3_reg_usage, 2
+
+#--- x3_reg_usage_tmp.s
+.attribute x3_reg_usage, 3
+
+# X3_REG_SCS_UKNOWN: BuildAttributes {
+# X3_REG_SCS_UKNOWN:   FormatVersion: 0x41

MaskRay wrote:

Add `-NEXT:` whenever appropriate

https://github.com/llvm/llvm-project/pull/84598
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [llvm][lld][RISCV] Support x3_reg_usage (PR #84598)

2024-03-12 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay edited 
https://github.com/llvm/llvm-project/pull/84598
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] [llvm][lld][RISCV] Support x3_reg_usage (PR #84598)

2024-03-12 Thread Fangrui Song via llvm-branch-commits


@@ -50,6 +54,13 @@ Error RISCVAttributeParser::atomicAbi(unsigned Tag) {
   return Error::success();
 }
 
+Error RISCVAttributeParser::x3RegUsage(unsigned Tag) {
+  uint64_t Value = de.getULEB128(cursor);
+  std::string Description = "X3 reg usage is " + utostr(Value);

MaskRay wrote:

`printAttribute(..., "..." + Twine(Value)`.str())`

https://github.com/llvm/llvm-project/pull/84598
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm-objcopy] Simplify --[de]compress-debug-sections and don't compress SHF_ALLOC sections (PR #84885)

2024-03-12 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay created 
https://github.com/llvm/llvm-project/pull/84885

Make it easier to add custom section [de]compression. In GNU ld,
--compress-debug-sections doesn't compress SHF_ALLOC sections. Match its
behavior.



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] ReleaseNotes for LLVM binary utilities (PR #83751)

2024-03-07 Thread Fangrui Song via llvm-branch-commits

MaskRay wrote:

@tstellar ready for merge!

https://github.com/llvm/llvm-project/pull/83751
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] ReleaseNotes for LLVM binary utilities (PR #83751)

2024-03-04 Thread Fangrui Song via llvm-branch-commits


@@ -344,21 +344,26 @@ Changes to the LLVM tools
 * Fixed big-endian support in llvm-symbolizer's DWARF location parser.
 * llvm-readelf now supports ``--extra-sym-info`` (``-X``) to display extra
   information (section name) when showing symbols.
-
-* ``llvm-nm`` now supports the ``--line-numbers`` (``-l``) option to use
-  debugging information to print symbols' filenames and line numbers.
+* ``llvm-readobj``/``llvm-readelf`` now supports ``--decompress``/``-z`` with

MaskRay wrote:

[added more 
backticks](https://github.com/llvm/llvm-project/pull/83751/commits/8ba9bed8210bf7bce320f589b1243f19cd7e9c6c)

https://github.com/llvm/llvm-project/pull/83751
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] ReleaseNotes for LLVM binary utilities (PR #83751)

2024-03-04 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/83751

>From 5a9f6cf96b1fb4c9f16f59e6c4847b61da46c6b7 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Sun, 3 Mar 2024 17:03:04 -0800
Subject: [PATCH 1/2] ReleaseNotes for LLVM binary utilities

---
 llvm/docs/ReleaseNotes.rst | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 5b3210138f2f89..b845b57b4e4af6 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -344,21 +344,26 @@ Changes to the LLVM tools
 * Fixed big-endian support in llvm-symbolizer's DWARF location parser.
 * llvm-readelf now supports ``--extra-sym-info`` (``-X``) to display extra
   information (section name) when showing symbols.
-
-* ``llvm-nm`` now supports the ``--line-numbers`` (``-l``) option to use
-  debugging information to print symbols' filenames and line numbers.
+* ``llvm-readobj``/``llvm-readelf`` now supports ``--decompress``/``-z`` with
+  string and hex dump for ELF object files.
 
 * llvm-symbolizer and llvm-addr2line now support addresses specified as symbol 
names.
 
 * llvm-objcopy now supports ``--gap-fill`` and ``--pad-to`` options, for
   ELF input and binary output files only.
+* ``llvm-objcopy`` now supports ``-O elf64-s390`` for SystemZ.
 
 * Supported parsing XCOFF auxiliary symbols in obj2yaml.
 
 * ``llvm-ranlib`` now supports ``-X`` on AIX to specify the type of object file
   ranlib should examine.
 
+* ``llvm-cxxfilt`` now supports ``--no-params``/``-p`` to skip function
+  parameters.
+
 * ``llvm-nm`` now supports ``--export-symbol`` to ignore the import symbol 
file.
+* ``llvm-nm`` now supports the ``--line-numbers`` (``-l``) option to use
+  debugging information to print symbols' filenames and line numbers.
 
 * llvm-rc and llvm-windres now accept file path references in ``.rc`` files
   concatenated from multiple string literals.

>From 8ba9bed8210bf7bce320f589b1243f19cd7e9c6c Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Mon, 4 Mar 2024 00:36:53 -0800
Subject: [PATCH 2/2] add more backticks

---
 llvm/docs/ReleaseNotes.rst | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index b845b57b4e4af6..bfa8e93da05cb8 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -339,21 +339,21 @@ Changes to the Debug Info
 Changes to the LLVM tools
 -
 
-* llvm-symbolizer now treats invalid input as an address for which source
+* ``llvm-symbolizer`` now treats invalid input as an address for which source
   information is not found.
-* Fixed big-endian support in llvm-symbolizer's DWARF location parser.
-* llvm-readelf now supports ``--extra-sym-info`` (``-X``) to display extra
+* Fixed big-endian support in ``llvm-symbolizer``'s DWARF location parser.
+* ``llvm-readelf`` now supports ``--extra-sym-info`` (``-X``) to display extra
   information (section name) when showing symbols.
 * ``llvm-readobj``/``llvm-readelf`` now supports ``--decompress``/``-z`` with
   string and hex dump for ELF object files.
 
-* llvm-symbolizer and llvm-addr2line now support addresses specified as symbol 
names.
+* ``llvm-symbolizer`` and ``llvm-addr2line`` now support addresses specified 
as symbol names.
 
-* llvm-objcopy now supports ``--gap-fill`` and ``--pad-to`` options, for
+* ``llvm-objcopy`` now supports ``--gap-fill`` and ``--pad-to`` options, for
   ELF input and binary output files only.
 * ``llvm-objcopy`` now supports ``-O elf64-s390`` for SystemZ.
 
-* Supported parsing XCOFF auxiliary symbols in obj2yaml.
+* Supported parsing XCOFF auxiliary symbols in ``obj2yaml``.
 
 * ``llvm-ranlib`` now supports ``-X`` on AIX to specify the type of object file
   ranlib should examine.
@@ -365,15 +365,15 @@ Changes to the LLVM tools
 * ``llvm-nm`` now supports the ``--line-numbers`` (``-l``) option to use
   debugging information to print symbols' filenames and line numbers.
 
-* llvm-rc and llvm-windres now accept file path references in ``.rc`` files
+* ``llvm-rc`` and ``llvm-windres`` now accept file path references in ``.rc`` 
files
   concatenated from multiple string literals.
 
-* The llvm-windres option ``--preprocessor`` now resolves its argument
-  in the PATH environment variable as expected, and options passed with
+* The ``llvm-windres`` option ``--preprocessor`` now resolves its argument
+  in the ``PATH`` environment variable as expected, and options passed with
   ``--preprocessor-arg`` are placed before the input file as they should
   be.
 
-* The llvm-windres option ``--preprocessor`` has been updated with the
+* The ``llvm-windres`` option ``--preprocessor`` has been updated with the
   breaking behaviour change from GNU windres from binutils 2.36, where
   the whole argument is considered as one path, not considered as a
   sequence of tool name and parameters.


[llvm-branch-commits] [llvm] ReleaseNotes for LLVM binary utilities (PR #83751)

2024-03-03 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay created 
https://github.com/llvm/llvm-project/pull/83751

None

>From 5a9f6cf96b1fb4c9f16f59e6c4847b61da46c6b7 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Sun, 3 Mar 2024 17:03:04 -0800
Subject: [PATCH] ReleaseNotes for LLVM binary utilities

---
 llvm/docs/ReleaseNotes.rst | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 5b3210138f2f89..b845b57b4e4af6 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -344,21 +344,26 @@ Changes to the LLVM tools
 * Fixed big-endian support in llvm-symbolizer's DWARF location parser.
 * llvm-readelf now supports ``--extra-sym-info`` (``-X``) to display extra
   information (section name) when showing symbols.
-
-* ``llvm-nm`` now supports the ``--line-numbers`` (``-l``) option to use
-  debugging information to print symbols' filenames and line numbers.
+* ``llvm-readobj``/``llvm-readelf`` now supports ``--decompress``/``-z`` with
+  string and hex dump for ELF object files.
 
 * llvm-symbolizer and llvm-addr2line now support addresses specified as symbol 
names.
 
 * llvm-objcopy now supports ``--gap-fill`` and ``--pad-to`` options, for
   ELF input and binary output files only.
+* ``llvm-objcopy`` now supports ``-O elf64-s390`` for SystemZ.
 
 * Supported parsing XCOFF auxiliary symbols in obj2yaml.
 
 * ``llvm-ranlib`` now supports ``-X`` on AIX to specify the type of object file
   ranlib should examine.
 
+* ``llvm-cxxfilt`` now supports ``--no-params``/``-p`` to skip function
+  parameters.
+
 * ``llvm-nm`` now supports ``--export-symbol`` to ignore the import symbol 
file.
+* ``llvm-nm`` now supports the ``--line-numbers`` (``-l``) option to use
+  debugging information to print symbols' filenames and line numbers.
 
 * llvm-rc and llvm-windres now accept file path references in ``.rc`` files
   concatenated from multiple string literals.

___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] ReleaseNotes for LLVM binary utilities (PR #83751)

2024-03-03 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay milestoned 
https://github.com/llvm/llvm-project/pull/83751
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] release/18.x: Allow .alt_entry symbols to pass the .cfi nesting check (#82268) (PR #83336)

2024-02-28 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/83336
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] release/18.x: MIPS: fix emitDirectiveCpsetup on N32 (#80534) (PR #83198)

2024-02-27 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/83198
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] Allow running tests without installing first (PR #83088)

2024-02-27 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay edited 
https://github.com/llvm/llvm-project/pull/83088
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] Allow running tests without installing first (PR #83088)

2024-02-27 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay edited 
https://github.com/llvm/llvm-project/pull/83088
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] Allow running tests without installing first (PR #83088)

2024-02-27 Thread Fangrui Song via llvm-branch-commits


@@ -168,10 +168,43 @@ def push_dynamic_library_lookup_path(config, new_path):
 r"/i386(?=-[^/]+$)", "/x86_64", config.compiler_rt_libdir
 )
 
+
+# Check if the test compiler resource dir matches the local build directory
+# (which happens with -DLLVM_ENABLE_PROJECTS=clang;compiler-rt) or if we are
+# using an installed clang to test compiler-rt standalone. In the latter case
+# we may need to override the resource dir to match the path of the just-built
+# compiler-rt libraries.
+test_cc_resource_dir, _ = get_path_from_clang(
+shlex.split(config.target_cflags) + ["-print-resource-dir"], 
allow_failure=True
+)
+# Normalize the path for comparison
+if test_cc_resource_dir is not None:
+test_cc_resource_dir = os.path.realpath(test_cc_resource_dir)
+if lit_config.debug:
+lit_config.note(f"Resource dir for {config.clang} is 
{test_cc_resource_dir}")
+local_build_resource_dir = os.path.realpath(config.compiler_rt_output_dir)
+if test_cc_resource_dir != local_build_resource_dir:
+if config.test_standalone_build_libs and config.compiler_id == "Clang":
+if lit_config.debug:
+lit_config.note(f'Overriding test compiler resource dir to use '
+f'libraries in "{config.compiler_rt_libdir}"')
+# Ensure that we use the just-built static libraries when linking by
+# overriding the Clang resource directory. Additionally, we want to use
+# the builtin headers shipped with clang (e.g. stdint.h), so we
+# explicitly add this as an include path (since the headers are not
+# going to be in the current compiler-rt build directory).
+# We also tell the linker to add an RPATH entry for the local library
+# directory so that the just-built shared libraries are used.
+config.target_cflags += f" -nobuiltininc"

MaskRay wrote:

Can `target_cflags` be made to a `list` instead of space-separate `str`?

https://github.com/llvm/llvm-project/pull/83088
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] Allow running tests without installing first (PR #83088)

2024-02-27 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.

I have a regular clang build at /tmp/Rel. If I create a standalone compiler-rt 
build at /tmp/out/crt, I see that with this PR, clang invoked by llvm-lit will 
get `-resource-dir=/tmp/out/crt -Wl,-rpath,/tmp/out/crt/lib/linux`, which 
utilizes `include/sanitizer/*_interface.h` (used by certain asan tests) and 
runtime libraries.

```
#include 
#include "sanitizer/asan_interface.h"
```

https://github.com/llvm/llvm-project/pull/83088
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] Allow running tests without installing first (PR #83088)

2024-02-27 Thread Fangrui Song via llvm-branch-commits

MaskRay wrote:

> wants to merge 2 commits into 
> [users/arichardson/spr/main.compiler-rt-allow-running-tests-without-installing-first](https://github.com/llvm/llvm-project/tree/users/arichardson/spr/main.compiler-rt-allow-running-tests-without-installing-first)

Note: since the base branch is not `main`, "Squash and merge" will not merge 
the patch to "main", but you can manually push it to `main` after approved. You 
can still click "Squash and merge" so that the PR shows "merged".

https://github.com/llvm/llvm-project/pull/83088
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [llvm] release/18.x: MIPS: Fix asm constraints "f" and "r" for softfloat (#79116) (PR #83105)

2024-02-26 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/83105
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [openmp] release/18.x: Fix build on musl by including stdint.h (#81434) (PR #82897)

2024-02-24 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/82897
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] ReleaseNotes: mention -mtls-dialect=desc (PR #82731)

2024-02-22 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay created 
https://github.com/llvm/llvm-project/pull/82731

None

>From 9e42ddc522436a1129ba5a5e014035ca00262cc0 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Thu, 22 Feb 2024 19:57:15 -0800
Subject: [PATCH] ReleaseNotes: mention -mtls-dialect=desc

---
 clang/docs/ReleaseNotes.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 93a67e7a895592..6121ef7fa98c04 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -1286,6 +1286,7 @@ RISC-V Support
   for RV64.
 
 - ``__attribute__((rvv_vector_bits(N)))`` is now supported for RVV vbool*_t 
types.
+- ``-mtls-dialect=desc`` is now supported to enable TLS descriptors (TLSDESC).
 
 CUDA/HIP Language Changes
 ^

___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] ReleaseNotes: mention -mtls-dialect=desc (PR #82731)

2024-02-22 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay milestoned 
https://github.com/llvm/llvm-project/pull/82731
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] release/18.x: [llvm-readobj, ELF] Support --decompress/-z (#82594) (PR #82718)

2024-02-22 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.

LGTM since this helps at least FreeBSD. Does OpenBSD want to try llvm binary 
utilities?

https://github.com/llvm/llvm-project/pull/82718
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [llvm-readobj, ELF] Support --decompress/-z (#82594) (PR #82713)

2024-02-22 Thread Fangrui Song via llvm-branch-commits

MaskRay wrote:

Does `/cherry-pick $commit_id` work? I think it's the preferred way to backport 
a commit.

https://github.com/llvm/llvm-project/pull/82713
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] release/18.x: Extend GCC workaround to GCC < 8.4 for llvm::iterator_range ctor (#82643) (PR #82688)

2024-02-22 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/82688
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ARM, MC] Support FDPIC relocations (PR #82187)

2024-02-21 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay closed 
https://github.com/llvm/llvm-project/pull/82187
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ARM, MC] Support FDPIC relocations (PR #82187)

2024-02-21 Thread Fangrui Song via llvm-branch-commits

MaskRay wrote:

> Thanks for the update, I'm happy with the changes. I would like to see more 
> options for position independent code in embedded systems.
> 
> The other related embedded position independent option for microcontrollers 
> that I'm aware of is `-fropi` and `-frwpi` which is already implemented in 
> clang. This is relocation free with just one static data area accessed as an 
> offset from r9. It works quite well for C code, but doesn't support C++ 
> (vtables and RTTI need relocations) and some forms of static initialisation.

Thanks for the comment. 
[ROPI/RWPI](https://lists.llvm.org/pipermail/llvm-dev/2015-December/093022.html)
 seems similar to -mno-pic-data-is-text-relative.

In 2013, -mno-pic-data-is-text-relative, generalized from the ARM [VxWorks 
RTP](https://gcc.gnu.org/pipermail/gcc-patches/2007-May/217111.html) port, was 
[added](https://inbox.sourceware.org/gcc-patches/01cedf74$bd1bf710$3753e530$@arm.com/)
 to assume that text and data segments don't have a fixed displacement. On 
non-VxWorks-RTP targets, -mno-pic-data-is-text-relative implies 
[-msingle-pic-base](https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html#index-msingle-pic-base):

Treat the register used for PIC addressing as read-only, rather than loading it 
in the prologue for each function. The runtime system is responsible for 
initializing this register with an appropriate value before execution begins.

r9 is used as the static base (`arm_pic_register) in the position-independent 
data model to access the data segment. Since r9 is not changed, dynamic linking 
seems unsupported as a DSO needs a different data segment.

https://github.com/llvm/llvm-project/pull/82187
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [RISCV] Support llvm.readsteadycounter intrinsic (PR #82322)

2024-02-20 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/82322
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [RISCV] Support llvm.readsteadycounter intrinsic (PR #82322)

2024-02-20 Thread Fangrui Song via llvm-branch-commits


@@ -126,9 +126,9 @@ enum NodeType : unsigned {
   // Floating point fmax and fmin matching the RISC-V instruction semantics.
   FMAX, FMIN,
 
-  // READ_CYCLE_WIDE - A read of the 64-bit cycle CSR on a 32-bit target
+  // READ_COUNTER_WIDE - A read of the 64-bit counter CSR on a 32-bit target

MaskRay wrote:

For new code, we don't replicate the variable/function name.

https://github.com/llvm/llvm-project/pull/82322
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] release/18.x: [llvm-objcopy] Add SystemZ support (#81841) (PR #82324)

2024-02-20 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/82324
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] release/18.x: [llvm-objcopy] Add SystemZ support (#81841) (PR #82324)

2024-02-20 Thread Fangrui Song via llvm-branch-commits

MaskRay wrote:

This is fairly safe to cherry pick and it will help ClangBuiltLinux. I'm in 
favor of merging it if there is still time.

https://github.com/llvm/llvm-project/pull/82324
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ELF] Support placing .lbss/.lrodata/.ldata after .bss (PR #81224)

2024-02-20 Thread Fangrui Song via llvm-branch-commits

MaskRay wrote:

```
Merged
merged 5 commits into 
[users/MaskRay/spr/main.elf-place-lbsslrodataldata-after-bss](https://github.com/llvm/llvm-project/tree/users/MaskRay/spr/main.elf-place-lbsslrodataldata-after-bss)
 from 
[users/MaskRay/spr/elf-place-lbsslrodataldata-after-bss](https://github.com/llvm/llvm-project/tree/users/MaskRay/spr/elf-place-lbsslrodataldata-after-bss)
```

Since the base branch is not main, it seems that "merge" in the web UI merges 
this to the `/users/MaskRay/spr/...` branch instead of `main`. I guess I need 
to push this squashed commit to `main` manually.

https://github.com/llvm/llvm-project/pull/81224
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ELF] Support placing .lbss/.lrodata/.ldata after .bss (PR #81224)

2024-02-20 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay closed 
https://github.com/llvm/llvm-project/pull/81224
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ELF] Support placing .lbss/.lrodata/.ldata after .bss (PR #81224)

2024-02-20 Thread Fangrui Song via llvm-branch-commits


@@ -1436,6 +1436,8 @@ static void readConfigs(opt::InputArgList ) {
   config->zInterpose = hasZOption(args, "interpose");
   config->zKeepTextSectionPrefix = getZFlag(
   args, "keep-text-section-prefix", "nokeep-text-section-prefix", false);
+  config->zLrodataAfterBss =
+  getZFlag(args, "lrodata-after-bss", "nolrodata-after-bss", false);

MaskRay wrote:

Thanks for understanding. I think I am fairly strong in keeping the stance that 
layout decisions should not magically change due to -no-pie/-pie. If we ever 
decide to deviate from the policy, we can re-consider. But having `-z 
lrodata-after-bss` should make these possible.

https://github.com/llvm/llvm-project/pull/81224
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ARM, MC] Support FDPIC relocations (PR #82187)

2024-02-20 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/82187


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ARM, MC] Support FDPIC relocations (PR #82187)

2024-02-20 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/82187


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ARM, MC] Support FDPIC relocations (PR #82187)

2024-02-20 Thread Fangrui Song via llvm-branch-commits

MaskRay wrote:

> I've checked over the implementation with binutils. Out of interest are you 
> planning on implementing all of fdpic or just enough to get assembler/linker 
> support working?

Yes, I plan to implement the codegen part to help me understand FDPIC better 
and the codegen part of LLVM...
(I need to study PPC ELFv1 function descriptors.)

> If you are there are some other GNU options that may be useful to look at as 
> possible intermediate steps. In particular -mno-pic-data-is-text-relative 
> [gcc.gnu.org/onlinedocs/gcc/ARM-Options.html#index-mpic-data-is-text-relative](https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html#index-mpic-data-is-text-relative)
>  this uses a single static base for the GOT which is sufficient for position 
> independent executables but no shared library support.

Thanks for the pointers. Yes, it looks like ARM added 
`-mpic-data-is-text-relative` first then s390x ported it.
The option is similar to `-msep-data` (m68k/bfin) and probably used for 
MMU-less systems without dynamic linking support. I have work-in-progress notes 
at https://maskray.me/blog/2024-02-20-mmu-less-systems-and-fdpic

https://github.com/llvm/llvm-project/pull/82187
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ARM, MC] Support FDPIC relocations (PR #82187)

2024-02-20 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay edited 
https://github.com/llvm/llvm-project/pull/82187
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ARM, MC] Support FDPIC relocations (PR #82187)

2024-02-20 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay edited 
https://github.com/llvm/llvm-project/pull/82187
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ARM, MC] Support FDPIC relocations (PR #82187)

2024-02-20 Thread Fangrui Song via llvm-branch-commits


@@ -11358,6 +11361,37 @@ bool ARMAsmParser::parseDirectiveARM(SMLoc L) {
   return false;
 }
 
+MCSymbolRefExpr::VariantKind
+ARMAsmParser::getVariantKindForName(StringRef Name) const {

MaskRay wrote:

> Ideally we could refactor so that MCSymbolRefExpr::getVariantKindForName 
> contains only generic and no target specific variant kinds.

I agree with this. I believe that binutils doesn't have a generic operand 
modifier, so ideally `MCSymbolRefExpr::getVariantKindForName` should be a pure 
virtual function. Unfortunately, many architectures add arch-specific modifiers 
in this list. We should eventually move them to respective lib/Target/XXX files.

In this patch I am only focusing on the ARM specific operand modifiers.

https://github.com/llvm/llvm-project/pull/82187
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ARM, MC] Support FDPIC relocations (PR #82187)

2024-02-20 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay edited 
https://github.com/llvm/llvm-project/pull/82187
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ARM, MC] Support FDPIC relocations (PR #82187)

2024-02-20 Thread Fangrui Song via llvm-branch-commits


@@ -11358,6 +11361,37 @@ bool ARMAsmParser::parseDirectiveARM(SMLoc L) {
   return false;
 }
 
+MCSymbolRefExpr::VariantKind
+ARMAsmParser::getVariantKindForName(StringRef Name) const {
+  return StringSwitch(Name.lower())
+  .Case("funcdesc", MCSymbolRefExpr::VK_FUNCDESC)
+  .Case("got", MCSymbolRefExpr::VK_GOT)
+  .Case("got_prel", MCSymbolRefExpr::VK_ARM_GOT_PREL)
+  .Case("gotfuncdesc", MCSymbolRefExpr::VK_GOTFUNCDESC)
+  .Case("gotoff", MCSymbolRefExpr::VK_GOTOFF)
+  .Case("gotofffuncdesc", MCSymbolRefExpr::VK_GOTOFFFUNCDESC)
+  .Case("gottpoff", MCSymbolRefExpr::VK_GOTTPOFF)
+  .Case("gottpoff_fdpic", MCSymbolRefExpr::VK_GOTTPOFF_FDPIC)
+  .Case("imgrel", MCSymbolRefExpr::VK_COFF_IMGREL32)
+  .Case("none", MCSymbolRefExpr::VK_ARM_NONE)
+  .Case("plt", MCSymbolRefExpr::VK_PLT)
+  .Case("prel31", MCSymbolRefExpr::VK_ARM_PREL31)
+  .Case("sbrel", MCSymbolRefExpr::VK_ARM_SBREL)
+  .Case("secrel32", MCSymbolRefExpr::VK_SECREL)
+  .Case("target1", MCSymbolRefExpr::VK_ARM_TARGET1)
+  .Case("target2", MCSymbolRefExpr::VK_ARM_TARGET2)
+  .Case("tlscall", MCSymbolRefExpr::VK_TLSCALL)
+  .Case("tlsdesc", MCSymbolRefExpr::VK_TLSDESC)
+  .Case("tlsgd", MCSymbolRefExpr::VK_TLSGD)
+  .Case("tlsgd_fdpic", MCSymbolRefExpr::VK_TLSGD_FDPIC)
+  .Case("tlsld", MCSymbolRefExpr::VK_TLSLD)
+  .Case("tlsldm", MCSymbolRefExpr::VK_TLSLDM)
+  .Case("tlsldm_fdpic", MCSymbolRefExpr::VK_TLSLDM_FDPIC)
+  .Case("tlsldo", MCSymbolRefExpr::VK_ARM_TLSLDO)
+  .Case("tpoff", MCSymbolRefExpr::VK_TPOFF)
+  .Default(MCSymbolRefExpr::VK_Invalid);

MaskRay wrote:

Yes, the binutils contains `tlsdescseq`, but there is no `(tlsdescseq)` 
occurrence. GCC doesn't emit `(tlsdescseq)`, either.
I suspect that the entry in binutils is not used.

There is a directive named `.tlsdescseq`  
(https://www.fsfla.org/~lxoliva/writeups/TLS/RFC-TLSDESC-ARM.txt), which is for 
TLS optimization. But GCC doesn't emit this directive.

Clang doesn't support `-mtls-dialect=gnu2` for ARM.

https://github.com/llvm/llvm-project/pull/82187
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ARM, MC] Support FDPIC relocations (PR #82187)

2024-02-19 Thread Fangrui Song via llvm-branch-commits


@@ -143,3 +143,10 @@ ELF_RELOC(R_ARM_THM_BF16,   0x88)
 ELF_RELOC(R_ARM_THM_BF12,   0x89)
 ELF_RELOC(R_ARM_THM_BF18,   0x8a)
 ELF_RELOC(R_ARM_IRELATIVE,  0xa0)
+ELF_RELOC(R_ARM_GOTFUNCDESC,0xa1)
+ELF_RELOC(R_ARM_GOTOFFFUNCDESC, 0xa2)
+ELF_RELOC(R_ARM_FUNCDESC,   0xa3)
+ELF_RELOC(R_ARM_FUNCDESC_VALUE, 0xa4)
+ELF_RELOC(R_ARM_TLS_GD32_FDPIC, 0xa5)
+ELF_RELOC(R_ARM_TLS_LDM32_FDPIC,0xa6)
+ELF_RELOC(R_ARM_TLS_IE32_FDPIC, 0xa7)

MaskRay wrote:

Thanks for checking. https://github.com/mickael-guene/fdpic_doc doesn't define 
these values, but binutils-gdb defines the values (also referenced by projects 
like https://github.com/cutty/uld-fdpic/blob/master/include/elf.h). I've 
checked that `llvm-readelf -r` output matches `readelf -r`.

https://github.com/llvm/llvm-project/pull/82187
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ARM, MC] Support FDPIC relocations (PR #82187)

2024-02-18 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay created 
https://github.com/llvm/llvm-project/pull/82187

Linux kernel fs/binfmt_elf_fdpic.c supports FDPIC for MMU-less systems.
GCC/binutils/qemu support FDPIC ABI for ARM
(https://github.com/mickael-guene/fdpic_doc).
_ARM FDPIC Toolchain and ABI_ provides a summary.

This patch implements FDPIC relocations to the integrated assembler.
There are 6 static relocations and 2 dynamic relocations, with
R_ARM_FUNCDESC as both static and dynamic.

gas requires `--fdpic` to assemble data relocations like `.word f(FUNCDESC)`.
This patch adds `MCTargetOptions::FDPIC` and reports an error if FDPIC
is not set.



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [Driver] Support -Wa, --fdpic for ARM FDPIC ABI (PR #82188)

2024-02-18 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay created 
https://github.com/llvm/llvm-project/pull/82188

`arm-linux-gnueabihf-gcc -c -fpic -mfdpic -Wa,--fdpic a.c` compiles
a.c with FDPIC codegen and assembles the assembly file with `--fdpic`.
This patch implements -Wa,--fdpic for the driver when using the
integrated assembler.



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ELF] Support placing .lbss/.lrodata/.ldata after .bss (PR #81224)

2024-02-16 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay edited 
https://github.com/llvm/llvm-project/pull/81224
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ELF] Support placing .lbss/.lrodata/.ldata after .bss (PR #81224)

2024-02-16 Thread Fangrui Song via llvm-branch-commits


@@ -1436,6 +1436,8 @@ static void readConfigs(opt::InputArgList ) {
   config->zInterpose = hasZOption(args, "interpose");
   config->zKeepTextSectionPrefix = getZFlag(
   args, "keep-text-section-prefix", "nokeep-text-section-prefix", false);
+  config->zLrodataAfterBss =
+  getZFlag(args, "lrodata-after-bss", "nolrodata-after-bss", false);

MaskRay wrote:

I think using "everybody" is not accurate. I've mentioned that `-fpie -no-pie` 
does not need this. And this `-fno-pie -no-pie` use has been a tiny portion of 
the user community. We are, after all, dealing with a problem that very few 
users run into in the first place. I think it matters to optimize for the 
prevailing configurations (-fpie/-fpic with -pie).

We also need evidence that "I have heard that x86-64 -fno-pic is measurably 
slower than -fpie in large workloads"

https://github.com/llvm/llvm-project/pull/81224
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] release/18.x: [lld/ELF] Avoid unnecessary TPOFF relocations in GOT for -pie (#81739) (PR #81990)

2024-02-16 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/81990
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] release/18.x: [lld] Fix test failures when running as root user (#81339) (PR #81988)

2024-02-16 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/81988
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ELF] Support placing .lbss/.lrodata/.ldata after .bss (PR #81224)

2024-02-15 Thread Fangrui Song via llvm-branch-commits


@@ -1436,6 +1436,8 @@ static void readConfigs(opt::InputArgList ) {
   config->zInterpose = hasZOption(args, "interpose");
   config->zKeepTextSectionPrefix = getZFlag(
   args, "keep-text-section-prefix", "nokeep-text-section-prefix", false);
+  config->zLrodataAfterBss =
+  getZFlag(args, "lrodata-after-bss", "nolrodata-after-bss", false);

MaskRay wrote:

I have explained. The layout should not magically change if the user switches 
between -no-pie and -pie/-shared. There are a few options to change the layout 
(-z keep-text-section-prefix, -z separate-code, --no-rosegment, etc), but none 
does a "smart" choice. 

With -z separate-code and a large max-page-size, one extra PT_LOAD can have a 
significant waste. I was actually struggling with the default but now I feel 
that the current layout makes more sense as the default.

https://github.com/llvm/llvm-project/pull/81224
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ELF] Support placing .lbss/.lrodata/.ldata after .bss (PR #81224)

2024-02-15 Thread Fangrui Song via llvm-branch-commits


@@ -1436,6 +1436,8 @@ static void readConfigs(opt::InputArgList ) {
   config->zInterpose = hasZOption(args, "interpose");
   config->zKeepTextSectionPrefix = getZFlag(
   args, "keep-text-section-prefix", "nokeep-text-section-prefix", false);
+  config->zLrodataAfterBss =
+  getZFlag(args, "lrodata-after-bss", "nolrodata-after-bss", false);

MaskRay wrote:

Sorry, but no. I don't think the x86-64 -fno-pic case justifies changing the 
tradition that -no-pie/-pie does not change the layout (internal linker 
script). `-z lrodata-after-bss` is a common ground that we both can accept and 
it has its own merit to test two layouts for file-backed transparent huge pages.

https://github.com/llvm/llvm-project/pull/81224
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [asan] isInterestingAlloca: remove the isAllocaPromotable condition (PR #77221)

2024-02-15 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay closed 
https://github.com/llvm/llvm-project/pull/77221
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [asan] isInterestingAlloca: remove the isAllocaPromotable condition (PR #77221)

2024-02-15 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/77221

>From 46d21cd0327e352491be77bb86740167984c0209 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Wed, 14 Feb 2024 23:26:34 -0800
Subject: [PATCH 1/2] fix cl::desc

Created using spr 1.3.4
---
 llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp 
b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 2e8d9bd748df82..029c07636d1784 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -347,7 +347,7 @@ static cl::opt
 
 static cl::opt ClInstrumentUninterestingAllocas(
 "asan-instrument-uninteresting-allocas",
-cl::desc("Do not instrument uninteresting allocas"), cl::Hidden);
+cl::desc("Instrument uninteresting allocas"), cl::Hidden);
 
 static cl::opt ClConstructorKind(
 "asan-constructor-kind",

>From c2eaeada2ce0d4d59810c497eda8e9c0d8a417c7 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Thu, 15 Feb 2024 00:25:03 -0800
Subject: [PATCH 2/2] revert an undeeded  clang-format after restoring the
 original version of the patch

Created using spr 1.3.4
---
 llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp 
b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index a115a8967dcb7d..4c29e02ea0df38 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -346,7 +346,8 @@ static cl::opt
cl::Hidden, cl::init(true));
 
 static cl::opt ClConstructorKind(
-"asan-constructor-kind", cl::desc("Sets the ASan constructor kind"),
+"asan-constructor-kind",
+cl::desc("Sets the ASan constructor kind"),
 cl::values(clEnumValN(AsanCtorKind::None, "none", "No constructors"),
clEnumValN(AsanCtorKind::Global, "global",
   "Use global constructors")),

___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [asan] isInterestingAlloca: remove the isAllocaPromotable condition (PR #77221)

2024-02-15 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/77221

>From 46d21cd0327e352491be77bb86740167984c0209 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Wed, 14 Feb 2024 23:26:34 -0800
Subject: [PATCH] fix cl::desc

Created using spr 1.3.4
---
 llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp 
b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 2e8d9bd748df82..029c07636d1784 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -347,7 +347,7 @@ static cl::opt
 
 static cl::opt ClInstrumentUninterestingAllocas(
 "asan-instrument-uninteresting-allocas",
-cl::desc("Do not instrument uninteresting allocas"), cl::Hidden);
+cl::desc("Instrument uninteresting allocas"), cl::Hidden);
 
 static cl::opt ClConstructorKind(
 "asan-constructor-kind",

___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [asan] isInterestingAlloca: remove the isAllocaPromotable condition (PR #77221)

2024-02-15 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay edited 
https://github.com/llvm/llvm-project/pull/77221
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [asan] isInterestingAlloca: remove the isAllocaPromotable condition (PR #77221)

2024-02-15 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/77221

>From 46d21cd0327e352491be77bb86740167984c0209 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Wed, 14 Feb 2024 23:26:34 -0800
Subject: [PATCH] fix cl::desc

Created using spr 1.3.4
---
 llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp 
b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 2e8d9bd748df82..029c07636d1784 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -347,7 +347,7 @@ static cl::opt
 
 static cl::opt ClInstrumentUninterestingAllocas(
 "asan-instrument-uninteresting-allocas",
-cl::desc("Do not instrument uninteresting allocas"), cl::Hidden);
+cl::desc("Instrument uninteresting allocas"), cl::Hidden);
 
 static cl::opt ClConstructorKind(
 "asan-constructor-kind",

___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [asan] isInterestingAlloca: remove the isAllocaPromotable condition (PR #77221)

2024-02-15 Thread Fangrui Song via llvm-branch-commits

https://github.com/MaskRay edited 
https://github.com/llvm/llvm-project/pull/77221
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [asan] isInterestingAlloca: remove the isAllocaPromotable condition (PR #77221)

2024-02-15 Thread Fangrui Song via llvm-branch-commits


@@ -1279,9 +1278,6 @@ bool AddressSanitizer::isInterestingAlloca(const 
AllocaInst ) {
   (AI.getAllocatedType()->isSized() &&

MaskRay wrote:

In `ClInstrumentUninterestingAllocas=0 mode`, `!(SSGI && SSGI->isSafe(AI))` can 
ignore some `AllocaInst`s that `SSGI->stackAccessIsSafe(*Inst)` will return 
false.

My original thought is that `ClInstrumentUninterestingAllocas` isn't useful and 
we should just remove it.

If you think `ClInstrumentUninterestingAllocas` is unnecessary, I will remove 
it.

https://github.com/llvm/llvm-project/pull/77221
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


  1   2   3   4   5   >