about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-03-07 21:57:52 -0500
committerGitHub <noreply@github.com>2025-03-07 21:57:52 -0500
commitb16047780df7664898636dfd31eb71f625570680 (patch)
tree26582318587449666446a212b3080f035af0d512 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parenta29e3af87d987000b9d8b9c72750aeca0df352c7 (diff)
parent8814679a5410b8d9ce8385094ec8ec888395b1a5 (diff)
downloadrust-b16047780df7664898636dfd31eb71f625570680.tar.gz
rust-b16047780df7664898636dfd31eb71f625570680.zip
Rollup merge of #138137 - ZequanWu:fix-triple, r=cuviper
setTargetTriple now accepts Triple rather than string

https://github.com/llvm/llvm-project/pull/129868 updated `setTargetTriple`
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) {