Expressions
Expressions in the COFF link editor command language
may contain global symbols, constants, and most of
the basic C language operators.
(See
``Syntax diagram for input directives''.)
Constants are the same as in C, with a number recognized as
hexadecimal if it starts with '0x',
as octal if it starts with '0',
and as decimal otherwise.
All numbers are treated as long integers.
Symbol names may contain uppercase or lowercase letters, digits,
and the underscore character (_).
Symbols within an expression have the value of the address
of the symbol only.
ld
does not do symbol table lookup to find the
contents of a symbol, the dimensionality of an array,
structure elements declared in a C program, and so on.
Certain names are reserved and hence unavailable as symbol or section names. This impacts your C source program. A common error is to use ifiles when your C program contains any of the reserved names (for example, length). The reserved names include:
ADDR BLOCK GROUP NEXT RANGE SPARE ALIGN COMMON INFO NOLOAD REGIONS PHY ASSIGN COPY LENGTH ORIGIN SECTIONS TV BIND DSECT MEMORY OVERLAY SIZEOF addr block length origin sizeof align group next phy spare assign l o range bind len org s
The supported operators are shown in the following table, in order of precedence from highest to lowest:
Table 4-1 Operator Symbols
---------------------- | symbol | |---------------------| | !The operators have the same meaning as in the C language. Operators on the same line in the table have the same precedence.∼ - (UNARY Minus) | |∗ / % | | + - (BINARY Minus) | | >> << | | == != > < <= >=| | & | | | | | && | | || | | = += -=∗ = /= | |---------------------|