@@ -2055,7 +2055,7 @@ applied to both static and dynamic TLS. There are four defined models
20552055of accessing TLS that trade off generality for performance. In order
20562056of descending generality:
20572057
2058- 1. General Dynamic, can be used anywhere.
2058+ 1. General Dynamic, also known as Global Dynamic, can be used anywhere.
20592059
20602060 2. Local Dynamic, can be used anywhere where the definition of the
20612061 TLS variable and the access are from the same module.
@@ -2130,6 +2130,21 @@ we get:
21302130which is equivalent to
21312131``PADsize:sub:m = (PT_TLS.p_vaddr - TCBsize):sub:m ``.
21322132
2133+ TLS Descriptors
2134+ ---------------
2135+
2136+ AArch64 uses the TLS Descriptor dialect for the general dynamic model.
2137+ The TLS Descriptor dialect permits a dynamic linker to use the
2138+ location and properties of the TLS symbol to select an optimal
2139+ resolver function.
2140+
2141+ The static relocations with a prefix of ``R_AARCH64_TLSDESC_ ``
2142+ targeting TLS symbol ``var ``, instruct the static linker to create a
2143+ TLS Descriptor for ``var ``. The TLS Descriptor for a variable is
2144+ stored in a pair of consecutive GOT entries, N and N + 1. The GOT
2145+ entry for N has a dynamic ``R_AARCH64_TLSDESC `` relocation targeting
2146+ the TLS symbol for ``var ``.
2147+
21332148Code sequences for accessing TLS variables
21342149------------------------------------------
21352150
@@ -2159,6 +2174,16 @@ In the code-sequences below:
21592174* ``.tlsdescadd `` is an assembler directive that adds a
21602175 ``R_AARCH64_TLSDESC_ADD `` relocation to the next instruction.
21612176
2177+ Relaxation is a term used by the TLS literature such as ELFTLS _ to
2178+ represent an optimization. AAELF64 _ has used optimization for similar
2179+ link-time instruction sequence optimizations. This document will use
2180+ relaxation to be consistent with existing references.
2181+
2182+ The static linker can relax a more general TLS model to a more
2183+ constrained TLS model when the TLS variables meet the requirements for
2184+ using the constrained model. The section `Static link time TLS
2185+ Relaxations `_ describes the details of the permitted relaxations.
2186+
21622187General Dynamic
21632188^^^^^^^^^^^^^^^
21642189
@@ -2284,7 +2309,7 @@ constants. The code sequences are the same for all code models.
22842309
22852310The instruction sequences below are not required by the ABI but using
22862311the instructions and relocations below increases the chances of static
2287- linkers applying the relaxations in (AAELF64 _) when the size of the
2312+ linkers applying the optimizations in (AAELF64 _) when the size of the
22882313executables TLS block is smaller than 16 KiB.
22892314
22902315.. code-block :: asm
@@ -2303,15 +2328,6 @@ Optimization to load a 64-bit var directly into a core register.
23032328 Static link time TLS Relaxations
23042329--------------------------------
23052330
2306- Relaxation is a term used by the TLS literature such as ELFTLS _ to
2307- represent an optimization. AAELF64 _ has used optimization for similar
2308- link-time instruction sequence optimizations. This document will use
2309- relaxation to be consistent with existing references.
2310-
2311- The static linker can relax a more general TLS model to a more
2312- constrained TLS model when the TLS variables meet the requirements for
2313- using the constrained model.
2314-
23152331The Relaxations described below can be automatically applied to code
23162332sequences in the executable. Relaxing from general dynamic will
23172333prevent a shared library from being opened at runtime via dlopen so
@@ -2405,19 +2421,8 @@ destination register must be preserved.
24052421 movz xn, :tprel_g1:var // R_AARCH64_TLSLE_MOVW_TPREL_G1 var
24062422 movk xn, :tprel_g0:var // R_AARCH64_TLSLE_MOVW_TPREL_G0_NC var
24072423
2408- TLS Descriptors
2409- ---------------
2410-
2411- The TLS Descriptor dialect permits a dynamic linker to use the
2412- location and properties of the TLS symbol to select an optimal
2413- resolver function.
2414-
2415- The static relocations with a prefix of ``R_AARCH64_TLSDESC_ ``
2416- targeting TLS symbol ``var ``, instruct the static linker to create a
2417- TLS Descriptor for ``var ``. The TLS Descriptor for a variable is
2418- stored in a pair of consecutive GOT entries, N and N + 1. The GOT
2419- entry for N has a dynamic ``R_AARCH64_TLSDESC `` relocation targeting
2420- the TLS symbol for ``var ``.
2424+ TLS Descriptor resolver functions
2425+ ---------------------------------
24212426
24222427When resolving the ``R_AARCH64_TLSDESC `` relocation, the dynamic
24232428loader places the address of the chosen resolver function in the first
0 commit comments