Assignment: Defining Symbols
Assignment statements may appear:
The first two cases are equivalent in effect—both define a symbol with an
absolute address. The last case defines a symbol whose address is relative to a
particular section (see
When a linker expression is evaluated and assigned to a variable, it is given
either an absolute or a relocatable type.
An absolute expression type is one in which the symbol contains the value that
it will have in the output file; a relocatable expression type is one in which
the value is expressed as a fixed offset from the base of a section.
The type of the expression is controlled by its position in the script file.
A symbol assigned within a section definition is created relative to the base
of the section; a symbol assigned in any other place is created as an absolute
symbol.
Since a symbol created within a section definition is relative to the base of
the section, it will remain relocatable if relocatable output is requested.
A symbol may be created with an absolute value even when assigned to within a
section definition by using the absolute assignment function
For example, to create an absolute symbol whose address is the last byte of an
output section named
SECTIONS { ...
symbol&= expression;
symbol+= expression;
symbol-= expression;
symbol*= expression;
symbol/= expression;
Assignment may only be used at the root of an expression; ‘
You must place a trailing semicolon (
as commands in their own right in an
as independent statements within a
as part of the contents of a section definition in a
.data :
{
*(.data)
_edata = ABSOLUTE(.) ;
}
... }
Non constant expression for initial address
text 9+this_isnt_constant :
{ ...
}
... }