[PATCH] D43632: [ELF] - Add testcase documenting flags assigned when empty synthetic section is removed.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 23 01:23:19 PST 2018
>LGTM
>It is not immediately clear what is the best behavior, but having a test
>for it is a good thing.
>
>BTW, what does ld.bfd outputs?
>
>Cheers,
>Rafael
bfd 2.30.51.20180214 marks .bar as writable. But that is because
of BYTE command which seems turns on "W" flag.
In all cases below .bar is writable (.got.plt is absent):
1) SECTIONS { .bar : { BYTE(0x11) }} and there is no any sections in .o (empty file).
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .bar PROGBITS 0000000000000000 00200000
0000000000000001 0000000000000000 WA 0 0 1
[ 2] .symtab SYMTAB 0000000000000000 00200008
0000000000000030 0000000000000018 3 2 8
2) SECTIONS { .foo : { *(.foo) } .bar : { BYTE(0x11) }} and there is .foo in .o.
3) SECTIONS { .foo : { *(.foo) } .bar : { *(.got.plt) BYTE(0x11) }} and there is .foo in .o.
Output for 2, 3:
[ 1] .foo PROGBITS 0000000000000000 00200000
0000000000000008 0000000000000000 AX 0 0 1
[ 2] .bar PROGBITS 0000000000000008 00200008
0000000000000001 0000000000000000 WA 0 0 8
And gold just makes .foo section to be allocatable:
[ 1] .foo PROGBITS 0000000000000000 00001000
0000000000000008 0000000000000000 AX 0 0 1
[ 2] .text PROGBITS 0000000000000008 00001008
0000000000000000 0000000000000000 AX 0 0 1
[ 3] .data PROGBITS 0000000000000008 00001008
0000000000000000 0000000000000000 WA 0 0 1
[ 4] .bar PROGBITS 0000000000000024 00001024
0000000000000001 0000000000000000 A 0 0 0
[ 5] .bss NOBITS 0000000000000025 00001025
0000000000000000 0000000000000000 WA 0 0 1
At least given the different behaviors we are more consistent with ourselves now, what is probably good.
George.
More information about the llvm-commits
mailing list