sections, overview of their meaning?

Nick Clifton nickc@redhat.com
Sun May 7 23:05:00 GMT 2006


Hi Torsten,

> there are lots of different sections in linker scripts, i know
> some of them but there are quite many that i don't know.
> 
> Is there somewhere an overview on the sections and what is meant
> to go into them?

Sorry no.  Sections can have arbitrary names and arbitrary contents, and 
there is no one single place where these names and contents are specified.

Some section names are commonly known and have a reasonably well defined 
purpose.  You probably know these names already.  eg: .text for code, 
.data for initialised, modifiable data, .bss for zero-initialised or 
uninitialised data, .rdata for non-modifiable data.

Other sections are often documented in the EABI for each particular 
processor.  So for example the ARM EABI describes sections called 
.ARM.exidx and .ARM.attributes.  (I tried to find a V850 based example, 
but I cannot find the ABI for this processor).

Otherwise the best guess is the name of the section itself.  Sometimes 
there will be comments in the linker script explaining what the section 
is for, but this is not always done.  For example the .zdata data 
section used by the V850 linker scripts is there for data that is 
accessed relative to r0 register, as hinted at by the "z" in the name, 
and the .rosdata section is for read-only data that is accessed via the 
global pointer register (r4), as hinted at by the definition of the __gp 
symbol in the .sdata section.

For sections that still mystify you please feel free to ask on this 
list, or search for references to them in the code for gas and gcc.

Cheers
   Nick




More information about the Binutils mailing list