Alignment

To align data on a specific byte boundary, use the ALIGN keyword or the ALIGNALL command. Listing: ALIGN Keyword Example and Listing: ALIGNALL Command Example are examples for bumping the location counter to the next 16-byte boundary.

Listing: ALIGN Keyword Example
file.c (.text)
. = ALIGN (0x10);

file.c (.data)    # aligned on 16-byte boundary.
Listing: ALIGNALL Command Example

file.c (.text)
ALIGNALL (0x10);  #everything past this point aligned

                  # on 16 byte boundary

file.c (.data)
Note: If one segment entry imposes an alignment requirement, that segment's starting address must conform to that requirement. Otherwise, there could be conflicting section alignment in the code the linker produces.

For more alignment information, refer to the topics ALIGN and ALIGNALL.