[lld] [ELF] Keep non-alloc orphan sections at the end (PR #94519)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 03:48:05 PDT 2024


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

LGTM thanks, may be worth waiting to see if any of the other reviewers have any concerns.

I agree that the difference from GNU ld is cosmetic. As while it may be at the expected section index, its address and file offset are if it was placed at the end.

Output for reference from GNU ld output for `sections-nonalloc.s.tmpb`
```
Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        00000000000000b0 0000b0 000001 00  AX  0   0  4
  [ 2] .bss              NOBITS          00000000000000b1 0000b1 000001 00  WA  0   0  1
  [ 3] data1             PROGBITS        00000000000000b2 0000b2 000001 00  WA  0   0  1
  [ 4] other1            PROGBITS        00000000000000b4 0000b8 000001 00      0   0  4
  [ 5] other2            PROGBITS        00000000000000b8 0000c0 000001 00      0   0  8
  [ 6] other3            PROGBITS        0000000000000000 0000d0 000001 00      0   0 16
  [ 7] data2             PROGBITS        00000000000000b3 0000b3 000001 00  WA  0   0  1
  [ 8] data3             PROGBITS        00000000000000b4 0000b4 000001 00  WA  0   0  1
  [ 9] .symtab           SYMTAB          0000000000000000 0000d8 000030 18     10   1  8
  [10] .strtab           STRTAB          0000000000000000 000108 000008 00      0   0  1
  [11] .shstrtab         STRTAB          0000000000000000 000110 00004d 00      0   0  1
```

https://github.com/llvm/llvm-project/pull/94519


More information about the llvm-commits mailing list