GNU Info

Info Node: (ld.info)Output Section Address

(ld.info)Output Section Address


Next: Input Section Prev: Output Section Name Up: SECTIONS
Enter node , (file) or (file)node

Output section address
----------------------

   The ADDRESS is an expression for the VMA (the virtual memory
address) of the output section.  If you do not provide ADDRESS, the
linker will set it based on REGION if present, or otherwise based on
the current value of the location counter.

   If you provide ADDRESS, the address of the output section will be
set to precisely that.  If you provide neither ADDRESS nor REGION, then
the address of the output section will be set to the current value of
the location counter aligned to the alignment requirements of the
output section.  The alignment requirement of the output section is the
strictest alignment of any input section contained within the output
section.

   For example,
     .text . : { *(.text) }

and
     .text : { *(.text) }

are subtly different.  The first will set the address of the `.text'
output section to the current value of the location counter.  The
second will set it to the current value of the location counter aligned
to the strictest alignment of a `.text' input section.

   The ADDRESS may be an arbitrary expression; Note: Expressions.
For example, if you want to align the section on a 0x10 byte boundary,
so that the lowest four bits of the section address are zero, you could
do something like this:
     .text ALIGN(0x10) : { *(.text) }

This works because `ALIGN' returns the current location counter aligned
upward to the specified value.

   Specifying ADDRESS for a section will change the value of the
location counter.


automatically generated by info2www version 1.2.2.9