Add emulated TLS support
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.
This commit is contained in:
@@ -120,6 +120,7 @@ fn to_llvm_tls_model(tls_model: TlsModel) -> llvm::ThreadLocalMode {
|
||||
TlsModel::LocalDynamic => llvm::ThreadLocalMode::LocalDynamic,
|
||||
TlsModel::InitialExec => llvm::ThreadLocalMode::InitialExec,
|
||||
TlsModel::LocalExec => llvm::ThreadLocalMode::LocalExec,
|
||||
TlsModel::Emulated => llvm::ThreadLocalMode::GeneralDynamic,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user