Crossware

Table of Contents        Previous topic       Next topic       

LINKER->Linker Scripts->Linker Script Language->Expressions

Expressions are used in the following places:

The expression syntax is similar to that for the C language and is described below.

Numbers

Numbers are hexadecimal if the begin with 0X or 0x otherwise they are decimal.

Identifiers

Identifiers must begin with one of A-Z a-z . _

Subsequent characters may be A-Z a-z . _ $ @ ~

The special identifier . refers to the current run-time location.

Expression Operators

The expression operator

()

has the highest priority.

The unary operators have the next highest priority:

+    -    !    ~    ALIGN    ADDR    sizeof

The binary operators have the next highest priority with priority decreasing as indicated:

*    /    %
<<    >>
<    >    <=    >=
==    !=
&
^
|
&&
||

Special Unary Operators

ALIGN(expression)

Evaluates to the current run-time location aligned upwards to the nearest multiple of the value of expression.

ADDR(input section name)

Evaluates to the run-time start address of the input section.

input section name without the ADDR operator also evaluates to the run-time start address of the input section

ADDR(output section name)

Evaluates to the run-time start address of the output section.

output section name without the ADDR operator also evaluates to the run-time start address of the output section

ADDR(named memory region)

Evaluates to the start address of the named memory region.

named memory region without the ADDR operator also evaluates to the start address of the output section

sizeof(input section name)

Evaluates to the size of the named input section.

sizeof(output section name)

Evaluates to the size of the named output section.

sizeof(named memory region)

Evaluates to the size of the named memory region.