COMMON vs bss/sbss sections
Ian Lance Taylor
ian@zembu.com
Thu Apr 6 14:15:00 GMT 2000
Date: Thu, 06 Apr 2000 12:29:38 -0700
From: Peter Popov <ppopov@redcreek.com>
What's the difference between the COMMON and bss/sbss sections? Both
refer to uninitialized data which must be zeroed out, so why have a
COMMON section -- shouldn't those variables be part of the bss section?
This is a powerpc-eabi, linux hosted cross compiler I'm using
(gcc-2.95.2, binutils 2.9.1).
The difference is that the COMMON section is a dummy section used to
hold common variables in input files, whereas the bss/sbss sections
hold uninitialized variables.
It is legal to have an definition for a common variable in another
object file (see the documentation for the --warn-common option in the
GNU linker). If you have a definition for a bss/sbss variable in
another object file, the linker will report a multiple definition
error.
If there is no definition for a common variable, then it should
normally be put in the bss/sbss section of the output file. You can
not have a common variable in an output file.
Ian
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
More information about the crossgcc
mailing list