Skip to content

Commit c578f43

Browse files
committed
Auto merge of #117873 - quininer:android-emutls, r=Amanieu
Add emulated TLS support This is a reopen of rust-lang/rust#96317 . many android devices still only use 128 pthread keys, so using emutls can be helpful. Currently LLVM uses emutls by default for some targets (such as android, openbsd), but rust does not use it, because `has_thread_local` is false. This commit has some changes to allow users to enable emutls: 1. add `-Zhas-thread-local` flag to specify that std uses `#[thread_local]` instead of pthread key. 2. when using emutls, decorate symbol names to find thread local symbol correctly. 3. change `-Zforce-emulated-tls` to `-Ztls-model=emulated` to explicitly specify whether to generate emutls. r? `@Amanieu`
2 parents 17f0dd5 + 2baa073 commit c578f43

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/context.rs

+1
Original file line numberDiff line numberDiff line change
@@ -569,5 +569,6 @@ fn to_gcc_tls_mode(tls_model: TlsModel) -> gccjit::TlsModel {
569569
TlsModel::LocalDynamic => gccjit::TlsModel::LocalDynamic,
570570
TlsModel::InitialExec => gccjit::TlsModel::InitialExec,
571571
TlsModel::LocalExec => gccjit::TlsModel::LocalExec,
572+
TlsModel::Emulated => gccjit::TlsModel::GlobalDynamic,
572573
}
573574
}

0 commit comments

Comments
 (0)