IPR-NIOS Altera, IPR-NIOS Datasheet - Page 184

no-image

IPR-NIOS

Manufacturer Part Number
IPR-NIOS
Description
IP NIOS II MEGACORE RENEW
Manufacturer
Altera
Type
MegaCorer
Datasheet

Specifications of IPR-NIOS

License
Renewal License
Lead Free Status / RoHS Status
Not applicable / Not applicable
7–20
Nios II Processor Reference Handbook
The dynamic linker initializes GOT[1] to a unique identifier for each library and
GOT[2] to the address of the runtime resolver routine. In order for the two loads in
.PLTresolve to share the same %hiadj, _GLOBAL_OFFSET_TABLE_ must be aligned to a
16-byte boundary.
The runtime resolver receives the original function arguments in r4 through r7, the
shared library identifier from GOT[1] in r14, and the relocation index times four in
r15. The resolver updates the corresponding PLT GOT entry so that the PLT entry
transfers control directly to the target in the future, and then transfers control to the
target.
In shared objects, the call and jmpi instructions can not be used because the library
load address is not known at link time. Calls to functions outside the current shared
object must pass through the GOT. The program loads function addresses using
%call, and the link editor may arrange for such entries to be lazily bound. Because
PLT entries are only used for lazy binding, shared object PLTs are smaller, as shown in
Example
Example 7–21. Shared Object PLT
.PLTn:
Example 7–22
Example 7–22. Initial PLT Entry
.PLTresolve:
If the intial PLT entry is out of range, the resolver can be inline, because it is only one
instruction longer than a long branch, as shown in
Example 7–23. Initial PLT Entry Out of Range
.PLTn:
Linux Program Interpreter
The program interpreter is /lib/ld.so.1.
orhi
addi
br
nextpc r14
orhi
add
ldw
ldw
jmp
orhi
addi
nextpc r14
orhi
add
ldw
ldw
jmp
7–21.
r15, r0, %hiadj(index * 4)
r15, r15, %lo(index * 4)
.PLTresolve
r13, r0, %hiadj(_GLOBAL_OFFSET_TABLE_)
r13, r13, r14
r14, %lo(_GLOBAL_OFFSET_TABLE_+4)(r13)
r13, %lo(_GLOBAL_OFFSET_TABLE_+8)(r13)
r13
r15, r0, %hiadj(index * 4)
r15, r15, %lo(index * 4)
r13, r0, %hiadj(_GLOBAL_OFFSET_TABLE_)
r13, r13, r14
r14, %lo(_GLOBAL_OFFSET_TABLE_+4)(r13)
r13, %lo(_GLOBAL_OFFSET_TABLE_+8)(r13)
r13
shows the initial PLT entry.
Example
Chapter 7: Application Binary Interface
December 2010 Altera Corporation
7–23.
ABI for Linux Systems

Related parts for IPR-NIOS