define image symbol directive
Syntax
define image symbolname=expr;
Parameters
| The name of the symbol. |
| An expression. These operators are available for use in the expression, where
|
Description
The define image symbol directive defines a symbol with the value of a specified expression. Image symbols can refer to unknown symbols. Specifying an unknown symbol in an image symbol expression is equivalent to specifying the symbol in a ‑‑keep option. Image symbols will always be output, even if the symbol is not referred to by the application.
Image symbols are evaluated after content has been placed. Because of this, they:
have access to all public labels
cannot be used for placement purposes
cannot be referred to by the other symbol types.
An image symbol can refer to other public symbols—including another image symbol, but the references cannot be circular—and constants. All linker expressions are available, see Expressions in linker configuration files.Expressions in linker configuration files
Warning
This directive should be used with care. It interacts with the internal state of the linker at link-time, which might have unforeseen consequences. In particular, this applies to 64-bit mode.
Examples
define image symbol myBlockSize = SomeBlock$$Limit - OtherBlock$$Base; define image symbol myArrayPlace = myArray + 200; define image symbol start_of_code_block = ADDR(CODE_BLOCK);
The first line defines the symbol myBlockSize. Its value will be the difference between the end of the block (or section) SomeBlock and the start of the block/section OtherBlock. If SomeBlock ends on 0x34560 and OtherBlock starts on 0x12000, myBlockSize will have the value 0x22560.
The second line defines the symbol myArrayPlace. Its value will be the address of myArray + 200. If myArray has the address 0x1380, myArrayPlace will have the value 0x1448.
The third line defines the symbol start_of_code_block . Its value will be CODE_BLOCK$$Base, the special symbol for the first address in the block CODE_BLOCK.
define image symbol init_start = ADDR(MYSECTION); define image symbol inited_start = LOADADDR(MYSECTION); define image symbol init_size = SIZE(MYSECTION);
If you are using manual initialization with load address support, this example sets up initialization using image symbols and the operators ADDR, LOADADDR, and SIZE.
See also
define symbol directive and Symbols in linker configuration files.