about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-07-07 17:00:04 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-07-07 17:08:42 +0000
commit72223e205d91e4d689718a9f61b3f6c0346d19e8 (patch)
treed86b2e815f62da8c16a6b8d72fc34f80822bafac
parent58e551433d692579faf4ad59fb7f192aa9001677 (diff)
downloadrust-72223e205d91e4d689718a9f61b3f6c0346d19e8.tar.gz
rust-72223e205d91e4d689718a9f61b3f6c0346d19e8.zip
Fix building on LLVM 17
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp
index d13dcb137a1..37e9e41a874 100644
--- a/compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp
@@ -7,6 +7,7 @@
 // * https://github.com/llvm/llvm-project/blob/ef6d1ec07c693352c4a60dd58db08d2d8558f6ea/llvm/include/llvm/Object/ArchiveWriter.h
 // * https://github.com/llvm/llvm-project/blob/ef6d1ec07c693352c4a60dd58db08d2d8558f6ea/llvm/lib/Object/ArchiveWriter.cpp
 
+#include "LLVMWrapper.h"
 #include "SuppressLLVMWarnings.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/IR/LLVMContext.h"
@@ -148,9 +149,11 @@ extern "C" bool LLVMRustIsECObject(char *BufPtr, size_t BufLen) {
     return cast<llvm::object::COFFObjectFile>(&*Obj)->getMachine() !=
            COFF::IMAGE_FILE_MACHINE_ARM64;
 
+#if LLVM_VERSION_GE(18, 0)
   if (Obj->isCOFFImportFile())
     return cast<llvm::object::COFFImportFile>(&*Obj)->getMachine() !=
            COFF::IMAGE_FILE_MACHINE_ARM64;
+#endif
 
   if (Obj->isIR()) {
     Expected<std::string> TripleStr =