LOCdirective sets the current location to the value of the operand field, which may include changing sections. If the operand is a constant, the section is set to either
.dataif the value is
0x2000000000000000or larger, else it is set to
.text. Within a section, the current location may only be changed to monotonically higher addresses. A LOC expression must be a previously defined symbol or a “pure” constant.
An example, which sets the label prev to the current location, and updates the current location to eight bytes forward:
prev LOC @+8
When a LOC has a constant as its operand, a symbol
is defined depending on the address as mentioned above. Each such symbol is interpreted as special by the linker, locating the section at that address. Note that if multiple files are linked, the first object file with that section will be mapped to that address (not necessarily the file with the LOC definition).
LOCAL external_symbol LOCAL 42 .local asymbol
This directive-operation generates a link-time assertion that the operand does not correspond to a global register. The operand is an expression that at link-time resolves to a register symbol or a number. A number is treated as the register having that number. There is one restriction on the use of this directive: the pseudo-directive must be placed in a section with contents, code or data.
asymbol IS an_expression
sets the symbol ‘ asymbol ’ to ‘ an_expression ’. A symbol may not be set more than once using this directive. Local labels may be set using this directive, for example:
5H IS @+4
areg GREG breg GREG data_value GREG data_buffer .greg creg, another_data_value
The symbolic register name can be used in place of a (non-special) register. If a value isn't provided, it defaults to zero. Unless the option ‘
’ is specified, non-zero registers allocated with this directive may be eliminated by
; another register with the same value used in its place. Any of the instructions ‘
’, can have a value nearby
an initial value in place of its second and third operands. Here, “nearby” is defined as within the range 0...
255 from the initial value of such an allocated register.
buffer1 BYTE 0,0,0,0,0 buffer2 BYTE 0,0,0,0,0 ... GREG buffer1 LDOU $42,buffer2
In the example above, the ‘
’ field of the
instruction (LDOU with a constant Z) will be replaced with the global register allocated for ‘
’, and the ‘
’ field will have the value 5, the offset from ‘
’ to ‘
’. The result is equivalent to this code:
buffer1 BYTE 0,0,0,0,0 buffer2 BYTE 0,0,0,0,0 ... tmpreg GREG buffer1 LDOU $42,tmpreg,(buffer2-buffer1)
Global registers allocated with this directive are allocated in order higher-to-lower within a file. Other than that, the exact order of register allocation and elimination is undefined. For example, the order is undefined when more than one file with such directives are linked together. With the options ‘
’ and ‘
’ directives for two-operand cases like the one mentioned above can be omitted. Sufficient global registers will then be allocated by the linker.
PREFIX a PREFIX b c IS 0
defines a symbol ‘
’ with the value 0.
BSPEC 42 TETRA 1,2,3 ESPEC
The single operand to ‘ BSPEC ’ must be number in the range 0... 255. The ‘ BSPEC ’ number 80 is used by the GNU binutils implementation.