Skip to content

Commit 45dc435

Browse files
committed
unstable-book: Document -Z tls-model
1 parent feeb75e commit 45dc435

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# `tls_model`
2+
3+
The tracking issue for this feature is: None.
4+
5+
------------------------
6+
7+
Option `-Z tls-model` controls [TLS model](https://www.akkadia.org/drepper/tls.pdf) used to
8+
generate code for accessing `#[thread_local]` `static` items.
9+
10+
Supported values for this option are:
11+
12+
- `global-dynamic` - General Dynamic TLS Model (alternatively called Global Dynamic) is the most
13+
general option usable in all circumstances, even if the TLS data is defined in a shared library
14+
loaded at runtime and is accessed from code outside of that library.
15+
This is the default for most targets.
16+
- `local-dynamic` - model usable if the TLS data is only accessed from the shared library or
17+
executable it is defined in. The TLS data may be in a library loaded after startup (via `dlopen`).
18+
- `initial-exec` - model usable if the TLS data is defined in the executable or in a shared library
19+
loaded at program startup.
20+
The TLS data must not be in a library loaded after startup (via `dlopen`).
21+
- `local-exec` - model usable only if the TLS data is defined directly in the executable,
22+
but not in a shared library, and is accessed only from that executable.
23+
24+
`rustc` and LLVM may use a more optimized model than specified if they know that we are producing
25+
and executable rather than a library, or that the `static` item is private enough.

0 commit comments

Comments
 (0)