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.obj (.text)

. = ALIGN (0x10);

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

file.obj (.text)

ALIGNALL (0x10);  #everything past this point aligned

                  # on 16 byte boundary

file.obj (.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. In general, the instructions for data alignment should be just before the end of the section.

For more information on alignment , refer to the topics ALIGN and ALIGNALL of this manual.