From 33d0f7013a110d32c6cd2d5f6e51de515b30fefb Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 7 Jul 2024 17:00:04 +0000 Subject: [PATCH] Fix building on LLVM 17 --- compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp index d13dcb137a1c8..acd767f287b20 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(&*Obj)->getMachine() != COFF::IMAGE_FILE_MACHINE_ARM64; +#if LLVM_VERSION_GE(18,0) if (Obj->isCOFFImportFile()) return cast(&*Obj)->getMachine() != COFF::IMAGE_FILE_MACHINE_ARM64; +#endif if (Obj->isIR()) { Expected TripleStr =