A global offset table (GOT) entry referenced using R_NIOS2_GOT16,
R_NIOS2_GOT_LO and/or R_NIOS2_GOT_HA must be resolved at load time. A GOT
entry referenced only using R_NIOS2_CALL16, R_NIOS2_CALL_LO and/or
R_NIOS2_CALL_HA can initially refer to a procedure linkage table (PLT) entry and then
be resolved lazily.
Because the TP-relative relocations are 16-bit relocations, no dynamic object using
local dynamic or local executable thread-local storage (TLS) can have more than
64 KB of TLS data. New relocations might be added to support this in the future.
Several new assembler operators are defined to generate the Linux-specific
relocations, as listed in the table below.
Table 87.
Relocation and Operator
Relocation
Operator
R_NIOS2_GOT16
%got
R_NIOS2_CALL16
%call
R_NIOS2_GOTOFF_LO
%gotoff_hiadj
R_NIOS2_GOTOFF_HA
%gotoff_lo
R_NIOS2_PCREL_LO
%hiadj
R_NIOS2_PCREL_HA
%lo
R_NIOS2_TLS_GD16
%tls_gd
R_NIOS2_TLS_LDM16
%tls_ldm
R_NIOS2_TLS_LDO16
%tls_ldo
R_NIOS2_TLS_IE16
%tls_ie
R_NIOS2_TLS_LE16
%tls_le
R_NIOS2_TLS_DTPREL
%tls_ldo
R_NIOS2_GOTOFF
%gotoff
R_NIOS2_GOT_LO
%got_lo
R_NIOS2_GOT_HA
%got_hiadj
R_NIOS2_CALL_LO
%call_lo
R_NIOS2_CALL_HA
%call_hiadj
The %
hiadj
and %
lo
operators generate PC-relative or non-PC-relative relocations,
depending whether the expression being relocated is PC-relative. For
instance, %
hiadj(_gp_got - .)
generates R_NIOS2_PCREL_HA. %
tls_ldo
generates R_NIOS2_TLS_LDO16 when used as an immediate operand, and
R_NIOS2_TLS_DTPREL when used with the
.word
directive.
7.9.1.1. Copy Relocation
The R_NIOS2_COPY relocation is used to mark variables allocated in the executable
that are defined in a shared library. The variable’s initial value is copied from the
shared library to the relocated location.
7. Application Binary Interface
NII-PRG | 2018.04.18
Nios II Processor Reference Guide
158