aboutsummaryrefslogtreecommitdiff
path: root/src/zig_llvm.cpp
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2025-07-06 22:19:08 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2025-07-07 07:23:24 +0200
commitb5cc658ab4113b4db4f709dbec258910696990bd (patch)
tree7864e25eda40d6850582da4109e988b72df5bd2d /src/zig_llvm.cpp
parentc96c913bab00bcae42991244381ddcc8b2377552 (diff)
downloadzig-b5cc658ab4113b4db4f709dbec258910696990bd.tar.gz
zig-b5cc658ab4113b4db4f709dbec258910696990bd.zip
llvm: Use emulated TLS when appropriate for the target
Closes #24236.
Diffstat (limited to 'src/zig_llvm.cpp')
-rw-r--r--src/zig_llvm.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp
index fe4e421dc3..c9a30bb167 100644
--- a/src/zig_llvm.cpp
+++ b/src/zig_llvm.cpp
@@ -83,7 +83,7 @@ static const bool assertions_on = false;
LLVMTargetMachineRef ZigLLVMCreateTargetMachine(LLVMTargetRef T, const char *Triple,
const char *CPU, const char *Features, LLVMCodeGenOptLevel Level, LLVMRelocMode Reloc,
LLVMCodeModel CodeModel, bool function_sections, bool data_sections, ZigLLVMFloatABI float_abi,
- const char *abi_name)
+ const char *abi_name, bool emulated_tls)
{
std::optional<Reloc::Model> RM;
switch (Reloc){
@@ -149,6 +149,10 @@ LLVMTargetMachineRef ZigLLVMCreateTargetMachine(LLVMTargetRef T, const char *Tri
opt.MCOptions.ABIName = abi_name;
}
+ if (emulated_tls) {
+ opt.EmulatedTLS = true;
+ }
+
TargetMachine *TM = reinterpret_cast<Target*>(T)->createTargetMachine(Triple, CPU, Features, opt, RM, CM,
OL, JIT);
return reinterpret_cast<LLVMTargetMachineRef>(TM);