about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper
diff options
context:
space:
mode:
authorZequan Wu <zequanwu@google.com>2025-03-06 16:24:40 -0800
committerZequan Wu <zequanwu@google.com>2025-03-06 16:37:57 -0800
commit4e4bed8684a7144c82ea95aa013e7911dd9fe20d (patch)
tree51e13ffd7d27d1852fba4aaed9516cf30f66928d /compiler/rustc_llvm/llvm-wrapper
parentb74da9613a8cb5ba67a985f71325be0b7b16c0dd (diff)
downloadrust-4e4bed8684a7144c82ea95aa013e7911dd9fe20d.tar.gz
rust-4e4bed8684a7144c82ea95aa013e7911dd9fe20d.zip
setTargetTriple now accepts Triple rather than string
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index aea2a8dd097..6d01095ccca 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -153,7 +153,11 @@ extern "C" LLVMContextRef LLVMRustContextCreate(bool shouldDiscardNames) {
 
 extern "C" void LLVMRustSetNormalizedTarget(LLVMModuleRef M,
                                             const char *Triple) {
+#if LLVM_VERSION_GE(21, 0)
+  unwrap(M)->setTargetTriple(llvm::Triple(Triple::normalize(Triple)));
+#else
   unwrap(M)->setTargetTriple(Triple::normalize(Triple));
+#endif
 }
 
 extern "C" void LLVMRustPrintPassTimings(RustStringRef OutBuf) {