[RFC] Make __bss_start point at actual start of .bss
Andreas Krebbel
krebbel@linux.ibm.com
Fri Jun 23 06:37:33 GMT 2023
Hi,
the way __bss_start is defined in our default linker script right now makes it point after the .data
section instead of the actual start of .bss. The symbol is defined outside of the section definition
and therefore is not moved together with the .bss section if ld applies any alignment to it.
This not only is very counterintuitive but also triggers a problem on zSystems. All our symbols need
to be 2 byte aligned. If .data has an odd size this symbol is misaligned and thereby not ABI conform
anymore. While we could add platform-dependent alignment for the symbol here I'm wondering whether
we perhaps should rather move __bss_start into the .bss section definition in order to have it point
at the actual start of the section. I've checked that even if there is no input .bss ld will create
an empty .bss output section if the symbol is referenced.
I've also checked with mold and lld. Both linkers put __bss_start at the actual beginning of .bss as
one would expect. Does anything speak against doing the same with ld?
Andreas
More information about the Binutils
mailing list