Skip to content

Commit 72223e2

Browse files
committed
Fix building on LLVM 17
1 parent 58e5514 commit 72223e2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// * https://github.com/llvm/llvm-project/blob/ef6d1ec07c693352c4a60dd58db08d2d8558f6ea/llvm/include/llvm/Object/ArchiveWriter.h
88
// * https://github.com/llvm/llvm-project/blob/ef6d1ec07c693352c4a60dd58db08d2d8558f6ea/llvm/lib/Object/ArchiveWriter.cpp
99

10+
#include "LLVMWrapper.h"
1011
#include "SuppressLLVMWarnings.h"
1112
#include "llvm/ADT/SmallString.h"
1213
#include "llvm/IR/LLVMContext.h"
@@ -148,9 +149,11 @@ extern "C" bool LLVMRustIsECObject(char *BufPtr, size_t BufLen) {
148149
return cast<llvm::object::COFFObjectFile>(&*Obj)->getMachine() !=
149150
COFF::IMAGE_FILE_MACHINE_ARM64;
150151

152+
#if LLVM_VERSION_GE(18, 0)
151153
if (Obj->isCOFFImportFile())
152154
return cast<llvm::object::COFFImportFile>(&*Obj)->getMachine() !=
153155
COFF::IMAGE_FILE_MACHINE_ARM64;
156+
#endif
154157

155158
if (Obj->isIR()) {
156159
Expected<std::string> TripleStr =

0 commit comments

Comments
 (0)