From 047ed32148a39bc38ad18363ded9ab845dd313ee Mon Sep 17 00:00:00 2001 From: Tim Neumann Date: Mon, 24 Apr 2023 08:30:05 +0000 Subject: [PATCH] [LLVM17] Adapt to `ExplicitEmulatedTLS` removal. --- compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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.