For TLS instructions:
mov foo@gottpoff(%rip), %reg
add foo@gottpoff(%rip), %reg
add
#define R_X86_64_CODE_4_GOTTPOFF 44
if the instruction starts at 4 bytes before the relocation offset. This
should be used if reg is one of the additional general-purpose registers,
r16-r31, in Intel APX. It is similar to R_X86_64_GOTTPOFF and linker
optimization must take the different instruction encoding into account.
---
x86-64-ABI/object-files.tex | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/x86-64-ABI/object-files.tex b/x86-64-ABI/object-files.tex
index 2a2e315..9c4b9aa 100644
--- a/x86-64-ABI/object-files.tex
+++ b/x86-64-ABI/object-files.tex
@@ -487,6 +487,7 @@ or \texttt{Elf32_Rel} relocation entries.
\texttt{R_X86_64_GOTPCRELX} & 41 & \textit{word32} & \texttt{G + GOT + A - P} \\
\texttt{R_X86_64_REX_GOTPCRELX} & 42 & \textit{word32} & \texttt{G + GOT + A - P} \\
\texttt{R_X86_64_CODE_4_GOTPCRELX} & 43 & \textit{word32} & \texttt{G + GOT + A - P} \\
+ \texttt{R_X86_64_CODE_4_GOTTPOFF} & 44 & \textit{word32} & \\
\cline{1-4}
\multicolumn{4}{l}{\small $^\dagger$ This relocation is used only for LP64.}\\
\multicolumn{4}{l}{\small $^{\dagger\dagger}$ This relocation only
@@ -572,7 +573,11 @@ of the Thread-Local Storage ABI extensions and are documented in the
document called ``ELF Handling for Thread-Local
Storage''\footnote{This document is currently available via
\raggedright\url{
http://www.akkadia.org/drepper/tls.pdf}}\index{Thread-Local
- Storage}. The relocations \texttt{R_X86_64_GOTPC32_TLSDESC},
+ Storage}. \texttt{R_X86_64_CODE_4_GOTTPOFF} should be generated,
+instead of \texttt{R_X86_64_GOTTPOFF}, if the instruction starts at 4
+bytes before the relocation offset and linker optimization must take the
+different instruction encoding into account. The relocations
+\texttt{R_X86_64_GOTPC32_TLSDESC},
\texttt{R_X86_64_TLSDESC_CALL} and \texttt{R_X86_64_TLSDESC} are also
used for Thread-Local Storage, but are not documented there as of this
writing. A description can be found in the document ``Thread-Local
--
2.41.0