about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-03-14 16:08:03 +0800
committerGitHub <noreply@github.com>2025-03-14 16:08:03 +0800
commit3d9bf08289176c2185aee3a7a864e165f1717af4 (patch)
tree478858b36091b857f8213f72f15ae300e41d963d /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parenta863f2c6b22a6bc7b9a85d7e7ff0534ab0e10a05 (diff)
parent7bde17630561c8df94676cb6950b27c648de0e54 (diff)
downloadrust-3d9bf08289176c2185aee3a7a864e165f1717af4.tar.gz
rust-3d9bf08289176c2185aee3a7a864e165f1717af4.zip
Merge pull request #2283 from jieyouxu/sync
Rustc pull
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index aea2a8dd097..53df59930f4 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -152,8 +152,12 @@ extern "C" LLVMContextRef LLVMRustContextCreate(bool shouldDiscardNames) {
 }
 
 extern "C" void LLVMRustSetNormalizedTarget(LLVMModuleRef M,
-                                            const char *Triple) {
-  unwrap(M)->setTargetTriple(Triple::normalize(Triple));
+                                            const char *Target) {
+#if LLVM_VERSION_GE(21, 0)
+  unwrap(M)->setTargetTriple(Triple(Triple::normalize(Target)));
+#else
+  unwrap(M)->setTargetTriple(Triple::normalize(Target));
+#endif
 }
 
 extern "C" void LLVMRustPrintPassTimings(RustStringRef OutBuf) {