Common sections

Ian Lance Taylor
Mon Jun 7 15:00:00 GMT 2010

fearyourself <> writes:

> Basically, I have a segment called bss_big which is the big memory
> segment. If I compile two .c files such as :
> fct1.c:
> long target;
> long targeta;
> fct2.c:
> long target2;
> long target2a;
> then I get the same address for target and target2. And the same
> address for targeta and target2a.

That sounds like a rather serious bug.  What object file format are
you using?  What target?

> Were I to put this section as SEC_IS_COMMON, it works well and
> actually puts the addresses right but then it fails on the archives
> problem where if I do :

That is the opposite of what I would expect.  If the section is not
SEC_IS_COMMON, I don't see how the linker could cause it to overlap
like that.  It seems more possible of the section is SEC_IS_COMMON,
although even then I don't see how it could happen.

If you search for SHN_X86_64_LCOMMON in bfd/elf64-x86-64.c you will
see one way of handling large common symbols.


More information about the Binutils mailing list