10.6.7.3 ALIGN(exp)
exp) Return the location counter (.) aligned
to the next exp boundary. exp must be an
expression whose value is a power of two. This is equivalent to:
(. + exp - 1) & ~(exp - 1)
ALIGN doesn’t change the value of the location counter; it just does arithmetic on it. Here is an example which aligns the output .data section to the next 0x2000 byte boundary after the preceding section and sets a variable within the section to the next 0x8000 boundary after the input sections:
SECTIONS { ...
.data ALIGN(0x2000): {
*(.data)
variable = ALIGN(0x8000);
}
...
}
The first use of ALIGN in this example
specifies the location of a section because it is used as the optional address attribute of a
section definition, see SECTIONS Command The second use of ALIGN is used to define the value of a symbol.
The built-in function NEXT is closely related to ALIGN.
