4.10 Alignment

Data and code must be aligned to appropriate boundaries.

For example, The T32 pseudo-instruction ADR can only load addresses that are word aligned, but a label within T32 code might not be word aligned. You must use an alignment directive to ensure four-byte alignment of an address within T32 code.
An alignment directive aligns the current location to a specified boundary by padding with zeros or NOP instructions.

ARM syntax

ARM® syntax assembly provides the ALIGN n directive, where n specifies the alignment boundary in bytes. For example, the directive ALIGN 128 aligns addresses to 128-byte boundaries.
ARM syntax assembly also provides the PRESERVE8 directive. The PRESERVE8 directive specifies that the current file preserves eight-byte alignment of the stack.

GNU syntax

GNU syntax assembly provides the .balign n directive, which uses the same format as ALIGN.
Convert all instances of ALIGN n to .balign n.


GNU syntax assembly also provides the .align n directive. However, the format of n varies from system to system. The .balign directive provides the same alignment functionality as .align with a consistent behavior across all architectures.
Convert all instances of PRESERVE8 to .eabi_attribute 25, 1.
Related information
GNU Binutils - Using as: ARM Machine Directives
GNU Binutils - Using as: .align
GNU Binutils - Using as: .balign
armasm User Guide: REQUIRE8 and PRESERVE8
armasm User Guide: ALIGN
Non-ConfidentialPDF file icon PDF versionARM DUI0742F
Copyright © 2014-2016 ARM. All rights reserved.