about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
diff options
context:
space:
mode:
authorTim Neumann <timnn@google.com>2023-04-24 08:30:05 +0000
committerTim Neumann <timnn@google.com>2023-04-24 08:45:15 +0000
commit047ed32148a39bc38ad18363ded9ab845dd313ee (patch)
tree35ac61b3e74dea28077572d71d9a3a8086c4d184 /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
parentf65615f02d22b85e9205f2716ab36182d34bab2b (diff)
downloadrust-047ed32148a39bc38ad18363ded9ab845dd313ee.tar.gz
rust-047ed32148a39bc38ad18363ded9ab845dd313ee.zip
[LLVM17] Adapt to `ExplicitEmulatedTLS` removal.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
index 90cce9a8650..1acdc95ca8d 100644
--- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
@@ -410,10 +410,15 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
   }
   Options.RelaxELFRelocations = RelaxELFRelocations;
   Options.UseInitArray = UseInitArray;
+
+#if LLVM_VERSION_LT(17, 0)
   if (ForceEmulatedTls) {
     Options.ExplicitEmulatedTLS = true;
     Options.EmulatedTLS = true;
   }
+#else
+  Options.EmulatedTLS = ForceEmulatedTls || Trip.hasDefaultEmulatedTLS();
+#endif
 
   if (TrapUnreachable) {
     // Tell LLVM to codegen `unreachable` into an explicit trap instruction.