Intel NIOS II Owner Reference Manual page 159

Table of Contents

Advertisement

7. Application Binary Interface
NII-PRG | 2018.04.18
7.9.1.2. Jump Slot Relocation
Jump slot relocations are used for the PLT.
For information about the PLT, refer to "Procedure Linkage Table" section.
Related Information
Procedure Linkage Table
Procedure Linkage Table
7.9.1.3. Thread-Local Storage
The Nios II processor uses the Variant I model for thread-local storage.
The end of the thread control block (TCB) is located 0x7000 bytes before the thread
pointer. The TCB is eight bytes long. The first word is the dynamic thread pointer
(DTV) pointer and the second word is reserved. Each module's dynamic thread pointer
is biased by 0x8000 (when retrieved using
store additional private information before the TCB.
In the GNU Linux toolchain, the GOT pointer (
thread pointer is always kept in
In the following examples, any registers can be used, except that the argument to
__tls_get_addr
. Calls to
r2
calling convention in PIC code; these sequences are for example only, and the
compiler might generate different sequences. No linker relaxations are defined.
Example 7. General Dynamic Model
addi r4, r22, %tls_gd(x)
call __tls_get_addr
# Address of x in r2
In the general dynamic model, a two-word GOT slot is allocated for x, as shown in
"GOT Slot for General Dynamic Model" example.
Example 8. GOT Slot for General Dynamic Model
GOT[n]
GOT[n+1]
Example 9.
Local Dynamic Model
addi r4, r22, %tls_ldm(x)
call __tls_get_addr
addi r5, r2, %tls_ldo(x)
# Address of x in r5
ldw r6, %tls_ldo(x2)(r2)
# Value of x2 in r6
One 2-word GOT slot is allocated for all R_NIOS2_TLS_LDM16 operations in the linked
object. Any thread-local symbol in this object can be used, as shown in "GOT Slot with
Thread-Local Storage" example.
on page 165
on page 165
r23
is always passed in
must use the normal position-independent code (PIC)
__tls_get_addr
R_NIOS2_TLS_DTPMOD x
R_NIOS2_TLS_DTPREL x
__tls_get_addr
) is always kept in
_gp_got
.
and its return value is always returned in
r4
# R_NIOS2_TLS_GD16 x
# R_NIOS2_CALL26 __tls_get_addr
# R_NIOS2_TLS_LDM16 x
# R_NIOS2_CALL26 __tls_get_addr
# R_NIOS2_TLS_LDO16 x
# R_NIOS2_TLS_LDO16 x2
). The thread library can
, and the
r22
Nios II Processor Reference Guide
159

Advertisement

Table of Contents
loading

Table of Contents