OBS-URL: https://build.opensuse.org/package/show/devel:tools:statica/klee?expand=0&rev=54
64 lines
2.1 KiB
Diff
64 lines
2.1 KiB
Diff
From: Jiri Slaby <jirislaby@gmail.com>
|
|
Date: Mon, 15 Jan 2018 10:42:53 +0100
|
|
Subject: llvm50: handle new file_magic's location
|
|
Patch-mainline: no
|
|
|
|
llvm 5, moved file_magic to BinaryFormat in commit
|
|
19ca2b0f9daed883c21730285d7f04424e5f5f88, so adapt to that.
|
|
|
|
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
---
|
|
lib/Module/ModuleUtil.cpp | 15 ++++++++++++++-
|
|
1 file changed, 14 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp
|
|
index 7f4bdb49380a..f1dbdb13bcff 100644
|
|
--- a/lib/Module/ModuleUtil.cpp
|
|
+++ b/lib/Module/ModuleUtil.cpp
|
|
@@ -14,6 +14,9 @@
|
|
#include "klee/Internal/Support/ErrorHandling.h"
|
|
#include "../Core/SpecialFunctionHandler.h"
|
|
|
|
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
|
|
+#include "llvm/BinaryFormat/Magic.h"
|
|
+#endif
|
|
#include "llvm/IR/Function.h"
|
|
#include "llvm/IR/Instructions.h"
|
|
#include "llvm/IR/IntrinsicInst.h"
|
|
@@ -380,13 +383,19 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context,
|
|
MemoryBuffer *Buffer = bufferErr->get();
|
|
#endif
|
|
|
|
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
|
|
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
|
|
+ file_magic magic = identify_magic(Buffer.getBuffer());
|
|
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
|
|
sys::fs::file_magic magic = sys::fs::identify_magic(Buffer.getBuffer());
|
|
#else
|
|
sys::fs::file_magic magic = sys::fs::identify_magic(Buffer->getBuffer());
|
|
#endif
|
|
|
|
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
|
|
+ if (magic == file_magic::bitcode) {
|
|
+#else
|
|
if (magic == sys::fs::file_magic::bitcode) {
|
|
+#endif
|
|
SMDiagnostic Err;
|
|
#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
|
|
std::unique_ptr<llvm::Module> module(parseIR(Buffer, Err, context));
|
|
@@ -403,7 +412,11 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context,
|
|
return true;
|
|
}
|
|
|
|
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
|
|
+ if (magic == file_magic::archive) {
|
|
+#else
|
|
if (magic == sys::fs::file_magic::archive) {
|
|
+#endif
|
|
#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
|
|
Expected<std::unique_ptr<object::Binary> > archOwner =
|
|
object::createBinary(Buffer, &context);
|
|
--
|
|
2.18.0
|
|
|