as: Nios II Relocations

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