Specifications
Ltable:
.word %gotoff(Label1)
.word %gotoff(Label2)
.word %gotoff(Label3)
Related Information
Procedure Linkage Table on page 7-20
Linux Program Loading and Dynamic Linking
Global Offset Table
Because shared libraries are position-independent, they can not contain absolute addresses for symbols.
Instead, addresses are loaded from the GOT.
The first word of the GOT is filled in by the link editor with the unrelocated address of the _DYNAMIC,
which is at the start of the dynamic section. The second and third words are reserved for the dynamic
linker.
For information about the dynamic linker, refer to the "Procedure Linkage Tableā section.
The linker-defined symbol _GLOBAL_OFFSET_TABLE_ points to the reserved entries at the beginning of the
GOT. The linker-defined symbol _gp_got points to the base address used for GOT-relative relocations.
The value of _gp_got might vary between object files if the linker creates multiple GOT sections.
Related Information
Procedure Linkage Table on page 7-20
Function Addresses
Function addresses use the same SHN_UNDEF and st_value convention for PLT entries as in other
architectures, such as x86_64.
Procedure Linkage Table
Function calls in a position-dependent executable may use the call and jmpi instructions, which address
the contents of a 256-MB segment. They may also use the %lo, %hi, and %hiadj operators to take the
address of a function. If the function is in another shared object, the link editor creates a callable stub in
the executable called a PLT entry. The PLT entry loads the address of the called function from the PLT
GOT (a region at the start of the GOT) and transfers control to it.
The PLT GOT entry needs a relocation referring to the final symbol, of type R_NIOS2_JUMP_SLOT. The
dynamic linker may immediately resolve it, or may leave it unmodified for lazy binding. The link editor
fills in an initial value pointing to the lazy binding stubs at the start of the PLT section.
Each PLT entry appears as shown in the example below.
Example 7-21: PLT Entry
.PLTn:
orhi r15, r0, %hiadj(plt_got_slot_address)
ldw r15, %lo(plt_got_slot_address)(r15)
jmp r15
7-20
Linux Program Loading and Dynamic Linking
NII51016
2015.04.02
Altera Corporation
Application Binary Interface
Send Feedback