Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The GNU linker. - <b>section definitions</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Section Definitions
-------------------

   The most frequently used statement in the `SECTIONS' command is the
"section definition", which specifies the properties of an output
section: its location, alignment, contents, fill pattern, and target
memory region.  Most of these specifications are optional; the simplest
form of a section definition is
     SECTIONS { ...
       SECNAME : {
         CONTENTS
       }
     ... }

SECNAME is the name of the output section, and CONTENTS a specification
of what goes there--for example, a list of input files or sections of
input files (Section Placement:.).  As you might assume, the   
whitespace shown is optional.  You do need the colon `:' and the braces
`{}', however.

   SECNAME must meet the constraints of your output format.  In formats
which only support a limited number of sections, such as `a.out', the
name must be one of the names supported by the format (`a.out', for
example, allows only `.text', `.data' or `.bss'). If the output format
supports any number of sections, but with numbers and not names (as is
the case for Oasys), the name should be supplied as a quoted numeric
string.  A section name may consist of any sequence of characters, but
any name which does not conform to the standard `ld' symbol name syntax
must be quoted.  Symbol Names: Symbols    

   The special SECNAME `/DISCARD/' may be used to discard input
sections.  Any sections which are assigned to an output section named
`/DISCARD/' are not included in the final link output.

   The linker will not create output sections which do not have any
contents.  This is for convenience when referring to input sections that
may or may not exist.  For example,
     .foo { *(.foo) }
   will only create a `.foo' section in the output file if there is a
`.foo' section in at least one input file.


See Also: Section Placement Symbols

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson