Using as: RX-Modifiers

Next: RX-Directives, Previous: RX-Opts, Up: RX-Dependent [Contents][Index]

#### 9.37.2 Symbolic Operand Modifiers

The assembler supports one modifier when using symbol addresses in RX instruction operands. The general syntax is the following:

    %gp(symbol)

The modifier returns the offset from the __gp symbol to the specified symbol as a 16-bit value. The intent is that this offset should be used in a register+offset move instruction when generating references to small data. Ie, like this:

      mov.W	 %gp(_foo)[%gpreg], r1

The assembler also supports two meta register names which can be used to refer to registers whose values may not be known to the programmer. These meta register names are:

`%gpreg`

  The small data address register.

`%pidreg`

  The PID base address register.

Both registers normally have the value r13, but this can change if some registers have been reserved for use by interrupt handlers or if both the small data limit and position independent data features are being used at the same time.