Intel NIOS II Owner Reference Manual page 163

Table of Contents

Advertisement

7. Application Binary Interface
NII-PRG | 2018.04.18
Example 16. Small GOT Model Entry for Global Symbols
addi
GOT[n]
Example 17. Large GOT Model Entry for Global Symbols
movhi r3,
addi
r3, r3, %got_lo(x)
add
r3, r3, r22
GOT[n]
For local symbols, the symbolic reference to x is replaced by a relative relocation
against symbol zero, with the link time address of x as an addend, as shown in the
example below.
Example 18. Local Symbols for small GOT Model
addi
GOT[n]
Example 19. Local Symbols for large GOT Model
movhi r3,
addi
r3, r3, %got_lo(x)
add
r3, r3, r22
GOT[n]
The
call
Instead, all calls are made through the GOT. Function addresses may be loaded with
, which allows lazy binding. To initialize a function pointer, load the address of
%call
the function with
its GOT entry is placed in the PLT GOT for lazy binding, as shown in the example
below.
For information about the PLT, refer to the "Procedure Linkage Table" section.
Example 20. Small GOT Model entry in PLT GOT
ldw
callr
PLTGOT[n]
Example 21. Large GOT Model entry in PLT GOT
movhi r3,
addi
r3, r3, %call_lo(x)
add
r3, r3, r22
ldw
r3, 0(r3)
r3, r22, %got(x)
%got_hiadj(x)
r3, r22, %got(x)
%got_hiadj(x)
and
instructions are not available in position-independent code.
jmpi
instead. If no input object requires the address of the function
%got
r3, %call(fun)(r22)
r3
%call_hiadj(x)
# R_NIOS2_GOT16
R_NIOS2_GLOB_DAT x
# R_NIOS2_GOT_HA
# R_NIOS2_GOT_LO
R_NIOS2_GLOB_DAT x
# R_NIOS2_GOT16
R_NIOS2_RELATIVE +x
# R_NIOS2_GOT_HA
# R_NIOS2_GOT_LO
R_NIOS2_RELATIVE +x
# R_NIOS2_CALL16 fun
R_NIOS_JUMP_SLOT fun
# R_NIOS2_CALL_HA
# R_NIOS2_CALL_LO
Nios II Processor Reference Guide
163

Advertisement

Table of Contents
loading

Table of Contents