OBS-URL: https://build.opensuse.org/package/show/devel:tools:statica/klee?expand=0&rev=51
70 lines
2.2 KiB
Diff
70 lines
2.2 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>
|
|
|
|
`
|
|
|
|
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 ad847de0b368..5f967410568c 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/IRReader/IRReader.h"
|
|
#include "llvm/IR/Function.h"
|
|
#include "llvm/IR/Instructions.h"
|
|
@@ -477,7 +480,9 @@ Module *klee::linkWithLibrary(Module *module,
|
|
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());
|
|
@@ -486,7 +491,11 @@ Module *klee::linkWithLibrary(Module *module,
|
|
LLVMContext &Context = module->getContext();
|
|
std::string ErrorMessage;
|
|
|
|
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
|
|
+ if (magic == file_magic::bitcode) {
|
|
+#else
|
|
if (magic == sys::fs::file_magic::bitcode) {
|
|
+#endif
|
|
#if LLVM_VERSION_CODE < LLVM_VERSION(3, 8)
|
|
Module *Result = 0;
|
|
#endif
|
|
@@ -538,7 +547,11 @@ Module *klee::linkWithLibrary(Module *module,
|
|
delete Result;
|
|
#endif
|
|
|
|
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
|
|
+ } else if (magic == file_magic::archive) {
|
|
+#else
|
|
} else if (magic == sys::fs::file_magic::archive) {
|
|
+#endif
|
|
#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
|
|
Expected<std::unique_ptr<object::Binary> > arch =
|
|
object::createBinary(Buffer, &Context);
|
|
--
|
|
2.17.1
|
|
|