add klee OBS-URL: https://build.opensuse.org/request/show/456778 OBS-URL: https://build.opensuse.org/package/show/devel:tools:statica/klee?expand=0&rev=1
124 lines
4.0 KiB
Diff
124 lines
4.0 KiB
Diff
From: Marek Chalupa <mchqwerty@gmail.com>
|
|
Date: Wed, 24 Aug 2016 16:07:55 +0200
|
|
Subject: fix compilation on LLVM 3.8 after rebase to master
|
|
Patch-mainline: no
|
|
|
|
I rebased the work of rtrembecky on master and these new
|
|
changes were needed to make it compile again. Mostly
|
|
just playing with conditional includes and LLVM API
|
|
changes. All make check tests are passing :)
|
|
|
|
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
|
|
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
|
|
---
|
|
lib/Core/Executor.cpp | 18 ++++++++++++++++++
|
|
lib/Support/CompressionStream.cpp | 19 +++++++++++++++----
|
|
2 files changed, 33 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
|
|
index 93e1ff75493b..b4d46b6823cd 100644
|
|
--- a/lib/Core/Executor.cpp
|
|
+++ b/lib/Core/Executor.cpp
|
|
@@ -82,6 +82,7 @@
|
|
#include "llvm/Support/ErrorHandling.h"
|
|
#include "llvm/Support/Process.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
+#include "llvm/Support/FileSystem.h"
|
|
|
|
#if LLVM_VERSION_CODE < LLVM_VERSION(3, 5)
|
|
#include "llvm/Support/CallSite.h"
|
|
@@ -93,6 +94,10 @@
|
|
#include "klee/Internal/Support/CompressionStream.h"
|
|
#endif
|
|
|
|
+#if LLVM_VERSION_CODE > LLVM_VERSION(3, 5)
|
|
+#include <system_error>
|
|
+#endif
|
|
+
|
|
#include <cassert>
|
|
#include <algorithm>
|
|
#include <iomanip>
|
|
@@ -369,13 +374,21 @@ Executor::Executor(const InterpreterOptions &opts, InterpreterHandler *ih)
|
|
optionIsSet(DebugPrintInstructions, FILE_SRC)) {
|
|
std::string debug_file_name =
|
|
interpreterHandler->getOutputFilename("instructions.txt");
|
|
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
|
|
+ std::error_code EC;
|
|
+#endif
|
|
std::string ErrorInfo;
|
|
+
|
|
#ifdef HAVE_ZLIB_H
|
|
if (!DebugCompressInstructions) {
|
|
#endif
|
|
|
|
#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
|
|
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
|
|
+ debugInstFile = new llvm::raw_fd_ostream(debug_file_name.c_str(), EC,
|
|
+#else
|
|
debugInstFile = new llvm::raw_fd_ostream(debug_file_name.c_str(), ErrorInfo,
|
|
+#endif
|
|
llvm::sys::fs::OpenFlags::F_Text);
|
|
#else
|
|
debugInstFile =
|
|
@@ -387,7 +400,12 @@ Executor::Executor(const InterpreterOptions &opts, InterpreterHandler *ih)
|
|
(debug_file_name + ".gz").c_str(), ErrorInfo);
|
|
}
|
|
#endif
|
|
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
|
|
+ if (EC) {
|
|
+ ErrorInfo = EC.message();
|
|
+#else
|
|
if (ErrorInfo != "") {
|
|
+#endif
|
|
klee_error("Could not open file %s : %s", debug_file_name.c_str(),
|
|
ErrorInfo.c_str());
|
|
}
|
|
diff --git a/lib/Support/CompressionStream.cpp b/lib/Support/CompressionStream.cpp
|
|
index eb208edfa395..a3d3b44cebf9 100644
|
|
--- a/lib/Support/CompressionStream.cpp
|
|
+++ b/lib/Support/CompressionStream.cpp
|
|
@@ -10,9 +10,11 @@
|
|
#include "klee/Config/Version.h"
|
|
#ifdef HAVE_ZLIB_H
|
|
#include "klee/Internal/Support/CompressionStream.h"
|
|
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
|
|
+#if (LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)\
|
|
+ && LLVM_VERSION_CODE <= LLVM_VERSION(3, 4))
|
|
#include "llvm/Support/system_error.h"
|
|
#else
|
|
+#include "llvm/Support/FileSystem.h"
|
|
#include <fcntl.h>
|
|
#include <errno.h>
|
|
#include <sys/types.h>
|
|
@@ -25,10 +27,19 @@ compressed_fd_ostream::compressed_fd_ostream(const char *Filename,
|
|
std::string &ErrorInfo)
|
|
: llvm::raw_ostream(), pos(0) {
|
|
ErrorInfo = "";
|
|
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
|
|
// Open file in binary mode
|
|
+#if LLVM_VERSION_CODE == LLVM_VERSION(3, 4)
|
|
llvm::error_code EC =
|
|
- llvm::sys::fs::openFileForWrite(Filename, FD, llvm::sys::fs::F_Binary);
|
|
+#else
|
|
+ std::error_code EC =
|
|
+#endif
|
|
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
|
|
+ llvm::sys::fs::openFileForWrite(Filename, FD,
|
|
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
|
|
+ llvm::sys::fs::F_None);
|
|
+#else
|
|
+ llvm::sys::fs::F_Binary);
|
|
+#endif
|
|
|
|
if (EC) {
|
|
ErrorInfo = EC.message();
|
|
@@ -116,4 +127,4 @@ void compressed_fd_ostream::write_file(const char *Ptr, size_t Size) {
|
|
} while (Size > 0);
|
|
}
|
|
}
|
|
-#endif
|
|
+#endif // HAVE_ZLIB_H
|
|
--
|
|
2.11.1
|
|
|