[lld] [ELF] Orphan placement: remove hasInputSections condition (PR #93761)
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 5 08:23:49 PDT 2024
================
@@ -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 Off Size ES Flg Lk Inf Al
# CHECK-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
# CHECK-NEXT: [ 1] .nonalloc PROGBITS 0000000000000000 001064 001000 00 W 0 0 1
-# CHECK-NEXT: [ 2] .comment PROGBITS 0000000000000000 {{.*}} {{.*}} 01 MS 0 0 1
-# CHECK-NEXT: [ 3] .symtab SYMTAB 0000000000000000 {{.*}} {{.*}} 18 5 1 8
-# CHECK-NEXT: [ 4] .shstrtab STRTAB 0000000000000000 {{.*}} {{.*}} 00 0 0 1
-# CHECK-NEXT: [ 5] .strtab STRTAB 0000000000000000 {{.*}} {{.*}} 00 0 0 1
-# CHECK-NEXT: [ 6] .dat PROGBITS 0000000000000000 002137 000004 00 W 0 0 1
-# CHECK-NEXT: [ 7] .intvec0_out PROGBITS 0000000000000000 00213b 000000 00 W 0 0 1
-# CHECK-NEXT: [ 8] .intvec1_out PROGBITS 0000000000000000 00213b 000000 00 W 0 0 1
-# CHECK-NEXT: [ 9] .intvec2_out PROGBITS 0000000000000000 00213b 000000 00 W 0 0 1
+# CHECK-NEXT: [ 2] .dat PROGBITS 0000000000000000 002064 000004 00 W 0 0 1
+# CHECK-NEXT: [ 3] .intvec0_out PROGBITS 0000000000000000 002068 000000 00 W 0 0 1
+# CHECK-NEXT: [ 4] .intvec1_out PROGBITS 0000000000000000 002068 000000 00 W 0 0 1
+# CHECK-NEXT: [ 5] .intvec2_out PROGBITS 0000000000000000 002068 000000 00 W 0 0 1
+# CHECK-NEXT: [ 6] .comment PROGBITS 0000000000000000 {{.*}} {{.*}} 01 MS 0 0 1
----------------
smithp35 wrote:
This makes me think we haven't got the rank order quite right, or we need a special case for non-alloc (possibly even synthetic non-alloc) sections so that these go at the end.
For example GNU ld (which removes `intvec0_out` to `intvec2_out`) gives:
```
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00 0 0 0
[ 1] .nonalloc PROGBITS 0000000000000000 001064 001000 00 W 0 0 1
[ 2] .dat PROGBITS 0000000010000000 001000 000004 00 A 0 0 1
[ 3] .intvec3_out PROGBITS 00000000803fe060 001060 000004 00 AX 0 0 1
[ 4] .symtab SYMTAB 0000000000000000 002068 000048 18 5 1 8
[ 5] .strtab STRTAB 0000000000000000 0020b0 000012 00 0 0 1
[ 6] .shstrtab STRTAB 0000000000000000 0020c2 000037 00 0 0 1
```
I think it is better than it was before though.
https://github.com/llvm/llvm-project/pull/93761
More information about the llvm-commits
mailing list