[lld] [ELF] Orphan placement: remove hasInputSections condition (PR #93761)
Igor Kudrin via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 9 18:09:55 PDT 2024
igorkudrin wrote:
> I think the new behavior is expected. Use the example at [#93761 (comment)](https://github.com/llvm/llvm-project/pull/93761#issuecomment-2141073582). Given
No other linkers put `.dynsym` and friends into an executable segment. Why do you find this acceptable?
Moreover, if we change the linker script, following the idea of `lld` to put read-only sections before executable ones:
```
PHDRS { rodata PT_LOAD; text PT_LOAD;}
SECTIONS {
.rodata : { *(.rodata) } : rodata
.text1 : { *(.text1) } : text
.other : { LONG(0); *(.other) }
.text2 : { *(.text2) }
}
```
the result will be
```
[ 0] NULL 0000000000000000 000000 000000 00 0 0 0
[ 1] .rodata PROGBITS 0000000000000000 001000 000004 00 A 0 0 1
[ 2] .dynsym DYNSYM 0000000000000008 001008 000018 18 A 5 1 8
[ 3] .gnu.hash GNU_HASH 0000000000000020 001020 00001c 00 A 2 0 8
[ 4] .hash HASH 000000000000003c 00103c 000010 04 A 2 0 4
[ 5] .dynstr STRTAB 000000000000004c 00104c 000001 00 A 0 0 1
[ 6] .text1 PROGBITS 000000000000004d 00104d 000001 00 AX 0 0 1
[ 7] .other PROGBITS 000000000000004e 00104e 000004 00 A 0 0 1
[ 8] .orphan PROGBITS 0000000000000052 001052 000004 00 A 0 0 1
[ 9] .text2 PROGBITS 0000000000000056 001056 000001 00 AX 0 0 1
[10] .text PROGBITS 0000000000000058 001058 000000 00 AX 0 0 4
[11] .dynamic DYNAMIC 0000000000000058 001058 000070 10 WA 5 0 8
[12] .comment PROGBITS 0000000000000000 0010c8 000013 01 MS 0 0 1
[13] .symtab SYMTAB 0000000000000000 0010e0 000030 18 15 2 8
[14] .shstrtab STRTAB 0000000000000000 001110 000078 00 0 0 1
[15] .strtab STRTAB 0000000000000000 001188 00000a 00 0 0 1
```
As you can see, the problem here is exactly the same.
https://github.com/llvm/llvm-project/pull/93761
More information about the llvm-commits
mailing list