You copied the Doc URL to your clipboard.

Section alignment with the linker

The linker ensures each input section starts at an address that is a multiple of the input section alignment.

When input sections have been ordered and before the base addresses are 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.

armlink supports strict conformance with the ELF specification with the default option --no_legacyalign. The linker faults the base address of a region if it is not aligned so padding might be inserted to ensure compliance. With --no_legacyalign, the region alignment is the maximum alignment of any input section contained by the region.

If you use the option --legacyalign, the 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 are using scatter-loading, you can increase the alignment of a load region or execution region with the ALIGN attribute. For example, you can change an execution region that is normally four-byte aligned to be eight-byte aligned. However, you cannot reduce the natural alignment. For example, you cannot force two-byte alignment on a region that is normally four-byte aligned.

Was this page helpful? Yes No