The command language includes a number of built-in functions for use in link script expressions.
ABSOLUTE(exp)
ADDR(section)
symbol_1 and symbol_2 are assigned identical
values:
SECTIONS{ ...
.output1 :
{
start_of_output_1 = ABSOLUTE(.);
...
}
.output :
{
symbol_1 = ADDR(.output1);
symbol_2 = start_of_output_1;
}
... }
LOADADDR(section)
ADDR, but it may be different if the
AT keyword is used in the section definition (see section Optional Section Attributes).
ALIGN(exp)
.) 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. As an example, to align the output .data
section to the next 0x2000 byte boundary after the preceding
section and to set 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 start attribute of a
section definition (see section Optional Section Attributes). The second use simply
defines the value of a variable.
The built-in NEXT is closely related to ALIGN.
DEFINED(symbol)
begin to the first location in the
.text section--but if a symbol called begin already
existed, its value is preserved:
SECTIONS{ ...
.text : {
begin = DEFINED(begin) ? begin : . ;
...
}
... }
NEXT(exp)
ALIGN(exp); unless you
use the MEMORY command to define discontinuous memory for the
output file, the two functions are equivalent.
SIZEOF(section)
symbol_1 and
symbol_2 are assigned identical values:
SECTIONS{ ...
.output {
.start = . ;
...
.end = . ;
}
symbol_1 = .end - .start ;
symbol_2 = SIZEOF(.output);
... }
SIZEOF_HEADERS
sizeof_headers
MAX(exp1, exp2)
MIN(exp1, exp2)
Go to the first, previous, next, last section, table of contents.