as: Nios II Relocations

 
 9.30.3 Nios II Machine Relocations
 ----------------------------------
 
 '%hiadj(EXPRESSION)'
      Extract the upper 16 bits of EXPRESSION and add one if the 15th bit
      is set.
 
      The value of '%hiadj(EXPRESSION)' is:
           ((EXPRESSION >> 16) & 0xffff) + ((EXPRESSION >> 15) & 0x01)
 
      The '%hiadj' relocation is intended to be used with the 'addi',
      'ld' or 'st' instructions along with a '%lo', in order to load a
      32-bit constant.
 
           movhi r2, %hiadj(symbol)
           addi r2, r2, %lo(symbol)
 
 '%hi(EXPRESSION)'
      Extract the upper 16 bits of EXPRESSION.
 
 '%lo(EXPRESSION)'
      Extract the lower 16 bits of EXPRESSION.
 
 '%gprel(EXPRESSION)'
      Subtract the value of the symbol '_gp' from EXPRESSION.
 
      The intention of the '%gprel' relocation is to have a fast small
      area of memory which only takes a 16-bit immediate to access.
 
           	.section .sdata
           fastint:
           	.int 123
           	.section .text
           	ldw r4, %gprel(fastint)(gp)
 
 '%call(EXPRESSION)'
 '%call_lo(EXPRESSION)'
 '%call_hiadj(EXPRESSION)'
 '%got(EXPRESSION)'
 '%got_lo(EXPRESSION)'
 '%got_hiadj(EXPRESSION)'
 '%gotoff(EXPRESSION)'
 '%gotoff_lo(EXPRESSION)'
 '%gotoff_hiadj(EXPRESSION)'
 '%tls_gd(EXPRESSION)'
 '%tls_ie(EXPRESSION)'
 '%tls_le(EXPRESSION)'
 '%tls_ldm(EXPRESSION)'
 '%tls_ldo(EXPRESSION)'
 
      These relocations support the ABI for Linux Systems documented in
      the 'Nios II Processor Reference Handbook'.