@@ -2053,7 +2053,7 @@ applied to both static and dynamic TLS. There are four defined models
20532053of accessing TLS that trade off generality for performance. In order
20542054of descending generality:
20552055
2056- 1. General Dynamic, can be used anywhere.
2056+ 1. General Dynamic, also known as Global Dynamic, can be used anywhere.
20572057
20582058 2. Local Dynamic, can be used anywhere where the definition of the
20592059 TLS variable and the access are from the same module.
@@ -2128,6 +2128,21 @@ we get:
21282128which is equivalent to
21292129``PADsize:sub:m = (PT_TLS.p_vaddr - TCBsize):sub:m ``.
21302130
2131+ TLS Descriptors
2132+ ---------------
2133+
2134+ AArch64 uses the TLS Descriptor dialect for the general dynamic model.
2135+ The TLS Descriptor dialect permits a dynamic linker to use the
2136+ location and properties of the TLS symbol to select an optimal
2137+ resolver function.
2138+
2139+ The static relocations with a prefix of ``R_AARCH64_TLSDESC_ ``
2140+ targeting TLS symbol ``var ``, instruct the static linker to create a
2141+ TLS Descriptor for ``var ``. The TLS Descriptor for a variable is
2142+ stored in a pair of consecutive GOT entries, N and N + 1. The GOT
2143+ entry for N has a dynamic ``R_AARCH64_TLSDESC `` relocation targeting
2144+ the TLS symbol for ``var ``.
2145+
21312146Code sequences for accessing TLS variables
21322147------------------------------------------
21332148
@@ -2157,6 +2172,16 @@ In the code-sequences below:
21572172* ``.tlsdescadd `` is an assembler directive that adds a
21582173 ``R_AARCH64_TLSDESC_ADD `` relocation to the next instruction.
21592174
2175+ Relaxation is a term used by the TLS literature such as ELFTLS _ to
2176+ represent an optimization. AAELF64 _ has used optimization for similar
2177+ link-time instruction sequence optimizations. This document will use
2178+ relaxation to be consistent with existing references.
2179+
2180+ The static linker can relax a more general TLS model to a more
2181+ constrained TLS model when the TLS variables meet the requirements for
2182+ using the constrained model. The section `Static link time TLS
2183+ Relaxations `_ describes the details of the permitted relaxations.
2184+
21602185General Dynamic
21612186^^^^^^^^^^^^^^^
21622187
@@ -2282,7 +2307,7 @@ constants. The code sequences are the same for all code models.
22822307
22832308The instruction sequences below are not required by the ABI but using
22842309the instructions and relocations below increases the chances of static
2285- linkers applying the relaxations in (AAELF64 _) when the size of the
2310+ linkers applying the optimizations in (AAELF64 _) when the size of the
22862311executables TLS block is smaller than 16 KiB.
22872312
22882313.. code-block :: asm
@@ -2301,15 +2326,6 @@ Optimization to load a 64-bit var directly into a core register.
23012326 Static link time TLS Relaxations
23022327--------------------------------
23032328
2304- Relaxation is a term used by the TLS literature such as ELFTLS _ to
2305- represent an optimization. AAELF64 _ has used optimization for similar
2306- link-time instruction sequence optimizations. This document will use
2307- relaxation to be consistent with existing references.
2308-
2309- The static linker can relax a more general TLS model to a more
2310- constrained TLS model when the TLS variables meet the requirements for
2311- using the constrained model.
2312-
23132329The Relaxations described below can be automatically applied to code
23142330sequences in the executable. Relaxing from general dynamic will
23152331prevent a shared library from being opened at runtime via dlopen so
@@ -2403,19 +2419,8 @@ destination register must be preserved.
24032419 movz xn, :tprel_g1:var // R_AARCH64_TLSLE_MOVW_TPREL_G1 var
24042420 movk xn, :tprel_g0:var // R_AARCH64_TLSLE_MOVW_TPREL_G0_NC var
24052421
2406- TLS Descriptors
2407- ---------------
2408-
2409- The TLS Descriptor dialect permits a dynamic linker to use the
2410- location and properties of the TLS symbol to select an optimal
2411- resolver function.
2412-
2413- The static relocations with a prefix of ``R_AARCH64_TLSDESC_ ``
2414- targeting TLS symbol ``var ``, instruct the static linker to create a
2415- TLS Descriptor for ``var ``. The TLS Descriptor for a variable is
2416- stored in a pair of consecutive GOT entries, N and N + 1. The GOT
2417- entry for N has a dynamic ``R_AARCH64_TLSDESC `` relocation targeting
2418- the TLS symbol for ``var ``.
2422+ TLS Descriptor resolver functions
2423+ ---------------------------------
24192424
24202425When resolving the ``R_AARCH64_TLSDESC `` relocation, the dynamic
24212426loader places the address of the chosen resolver function in the first
0 commit comments