Gaps between BSS Variables; How are they Placed?

Ralph Corderoy ralph@inputplus.co.uk
Thu Feb 4 10:53:45 GMT 2021


Hi,

I was directed to this list by ##binutils on freenode.

When building an ELF executable using the BFD linker from a C file
through gcc(1) on amd64/x86_64, what area of code takes care of ordering
the common symbols in the .bss section?  I'd like to understand its
algorithm as I'm surprised by the results.  Before I complain, I thought
reading the code might tell me why I'm wrong.  :-)

‘objdump -t’ on foo.o shows me the size and alignment I expect, and the
same command on foo shows the address and size.  I think a different
ordering would still meet the alignment constraints but give a smaller
.bss.

-- 
Cheers, Ralph.


More information about the Binutils mailing list