Keil™, An ARM® Company

RealView Linker and Utilities Guide

Aligning sections

3.2.3. Aligning sections

When input sections have been ordered and before the base address is fixed, armlink inserts padding, if required, to force each input section to start at an address that is a multiple of the input section alignment.

The ARM linker permits ELF program headers and output sections to be aligned on a four‑byte boundary regardless of the maximum alignment of the input sections. This enables armlink to minimize the amount of padding that it inserts into the image.

If you require strict conformance with the ELF specification then use the ‑‑no_legacyalign option. Padding might be inserted to ensure compliance and the linker faults base addresses that are not 0 mod Max(input section alignment).

It is possible to use ALIGN to expand the alignment of a region, for example, changing something that is normally four-byte aligned to be eight-byte aligned. You cannot reduce the natural alignment, for example, forcing two-byte alignment on something that is normally four-byte aligned. See Creating regions on page boundaries for more information.

You can also increase the alignment of an input section. See the description of ALIGN in the directives reference in the Assembler Guide.

Copyright © 2007 ARM Limited. All rights reserved.ARM DUI 0377A