Arithmetic Functions
ALIGN(exp)
ALIGN
The built-in
NEXT(exp)
SIZEOF_HEADERS
Return the absolute (non-relocatable, as opposed to non-negative) value of the
expression exp. Primarily useful to assign an absolute value to a symbol within a section
definition, where symbol values are normally section-relative.
Return the absolute address of the named section. Your script must previously have defined the location of that section. In
the following example, symbol_1 and symbol_2 are assigned identical values.
.output1 :
{
start_of_output_1 = ABSOLUTE(.);
...
}
.output :
{
symbol_1 = ADDR(.output1);
symbol_2 = start_of_output_1;
}
... }
.data ALIGN(0x2000): {
*(.data)
variable = ALIGN(0x8000);
}
... }
Return 1 if symbol is in the linker global symbol table and is defined, otherwise return 0. You
can use this function to provide default values for symbols. For example, the
following command-file fragment shows how to set a global symbol begin to the first location in the .text section—but if a symbol called begin already existed, its value is preserved.
.text :
{ begin = DEFINED(begin) ? begin : . ;
...
}
... }
Return the size in bytes of the named section, if that section has been allocated. In the following example, symbol_1 and symbol_2 are assigned identical values.
.output {
.start = . ;
...
.end = . ;
}
symbol_1 = .end - .start ;
symbol_2 = SIZEOF(.output);
... }
sizeof_headers