Skip to content

Commit 670c11d

Browse files
committed
Move around some paragraphs to introduce some topics before they
are used.
1 parent 090f892 commit 670c11d

File tree

1 file changed

+29
-24
lines changed

1 file changed

+29
-24
lines changed

sysvabi64/sysvabi64.rst

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,7 +2055,7 @@ applied to both static and dynamic TLS. There are four defined models
20552055
of accessing TLS that trade off generality for performance. In order
20562056
of 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:
21302130
which 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+
21332148
Code 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+
21622187
General Dynamic
21632188
^^^^^^^^^^^^^^^
21642189

@@ -2284,7 +2309,7 @@ constants. The code sequences are the same for all code models.
22842309

22852310
The instruction sequences below are not required by the ABI but using
22862311
the 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
22882313
executables 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-
23152331
The Relaxations described below can be automatically applied to code
23162332
sequences in the executable. Relaxing from general dynamic will
23172333
prevent 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

24222427
When resolving the ``R_AARCH64_TLSDESC`` relocation, the dynamic
24232428
loader places the address of the chosen resolver function in the first

0 commit comments

Comments
 (0)