Relocating section at virtual address 0

Ian Lance Taylor ian@airs.com
Tue Jul 26 18:28:00 GMT 2005


Daniël Mantione <daniel@deadlock.et.tudelft.nl> writes:

> The problem was that the compiler was
> declaring variables with .comm, and variables declared with .comm always
> get into the .bss section, even if declared into another section.

That's because common symbols don't actually have a section.  A common
symbol is an undefined reference to another symbol, with the special
property that if no definition is found the linker will automatically
create one.  The linker will by default create that definition in
.bss, although you can change that in the linker script.  There is no
way to say "this is an undefined reference, but if no definition is
found please create a symbol in section S."

If you don't want common symbols in gcc output, use -fno-common, q.v.

Ian



More information about the Binutils mailing list