Next: , Previous: LM32-Regs, Up: LM32 Syntax


9.20.2.2 Relocatable Expression Modifiers

The assembler supports several modifiers when using relocatable addresses in LM32 instruction operands. The general syntax is the following:

     modifier(relocatable-expression)
lo
This modifier allows you to use bits 0 through 15 of an address expression as 16 bit relocatable expression.
hi
This modifier allows you to use bits 16 through 23 of an address expression as 16 bit relocatable expression.

For example

          ori  r4, r4, lo(sym+10)
          orhi r4, r4, hi(sym+10)
     

gp
This modified creates a 16-bit relocatable expression that is the offset of the symbol from the global pointer.
          mva r4, gp(sym)
     

got
This modifier places a symbol in the GOT and creates a 16-bit relocatable expression that is the offset into the GOT of this symbol.
          lw r4, (gp+got(sym))
     

gotofflo16
This modifier allows you to use the bits 0 through 15 of an address which is an offset from the GOT.
gotoffhi16
This modifier allows you to use the bits 16 through 31 of an address which is an offset from the GOT.
          orhi r4, r4, gotoffhi16(lsym)
          addi r4, r4, gotofflo16(lsym)