This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: COMMON symbols...

Hi Dave,

  So I think that ld isn't zero-filling the space it allocates to the common
symbols, but just letting them take whatever values happen to be in the host
memory space that has been allocated by the linker to build up the output

  Is there any way to work around this?  I couldn't get useful results with
the FILL expressions, which I suppose makes sense because the space is used.
And I couldn't get the FORCE_COMMON_ALLOCATION directive or -d switch to
help me out either.

Does anyone know of a way to get the result I want from the linker?

I strongly suspect that this is a linker "feature" in that it has never had to zero-fill the file space that is going to be used for common symbols because it assumes that they are always going to be going into a section with the SHT_NOBITS flag set. ie this is a bug and the linker ought to check for this and zero the memory it writes out if necessary.

Anyway the only way that I can think of to fix this in a linker script is to use overlays. This *might* work, but I have not tried it.

  (And before you ask, I can't just give gcc -fno-common, even though that
would move the common symbols into bss for me and hence get them
zero-filled, because the option's  a bit b0rked somewhere in my toolchain

Incidentally if you fix -fno-common you could then add the -ffno-zero-initialized-in-bss switch and then not have to modify your linker script at all....


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]