ld: Input Section Common

1 
1 3.6.4.3 Input Section for Common Symbols
1 ........................................
1 
1 A special notation is needed for common symbols, because in many object
1 file formats common symbols do not have a particular input section.  The
1 linker treats common symbols as though they are in an input section
1 named 'COMMON'.
1 
1    You may use file names with the 'COMMON' section just as with any
1 other input sections.  You can use this to place common symbols from a
1 particular input file in one section while common symbols from other
1 input files are placed in another section.
1 
1    In most cases, common symbols in input files will be placed in the
1 '.bss' section in the output file.  For example:
1      .bss { *(.bss) *(COMMON) }
1 
1    Some object file formats have more than one type of common symbol.
1 For example, the MIPS ELF object file format distinguishes standard
1 common symbols and small common symbols.  In this case, the linker will
1 use a different special section name for other types of common symbols.
1 In the case of MIPS ELF, the linker uses 'COMMON' for standard common
1 symbols and '.scommon' for small common symbols.  This permits you to
1 map the different types of common symbols into memory at different
1 locations.
1 
1    You will sometimes see '[COMMON]' in old linker scripts.  This
1 notation is now considered obsolete.  It is equivalent to '*(COMMON)'.
1