Next: Input Section, Previous: Output Section Name, Up: SECTIONS

#### 3.6.3 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; 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.