Skip to content

Commit 05949b0

Browse files
committed
Explain why local-exec is used by CloudABI.
1 parent 4fe167a commit 05949b0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/librustc_back/target/cloudabi_base.rs

+11
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ pub fn opts() -> TargetOptions {
2727
linker_is_gnu: true,
2828
pre_link_args: args,
2929
position_independent_executables: true,
30+
// As CloudABI only supports static linkage, there is no need
31+
// for dynamic TLS. The C library therefore does not provide
32+
// __tls_get_addr(), which is normally used to perform dynamic
33+
// TLS lookups by programs that make use of dlopen(). Only the
34+
// "local-exec" and "initial-exec" TLS models can be used.
35+
//
36+
// "local-exec" is more efficient than "initial-exec", as the
37+
// latter has one more level of indirection: it accesses the GOT
38+
// (Global Offset Table) to obtain the effective address of a
39+
// thread-local variable. Using a GOT is useful only when doing
40+
// dynamic linking.
3041
tls_model: "local-exec".to_string(),
3142
relro_level: RelroLevel::Full,
3243
exe_allocation_crate: super::maybe_jemalloc(),

0 commit comments

Comments
 (0)