up to 1.3.0+20170602

OBS-URL: https://build.opensuse.org/package/show/devel:tools:statica/klee?expand=0&rev=23
This commit is contained in:
2017-06-05 07:56:22 +00:00
committed by Git OBS Bridge
parent 4091f8aa43
commit a8b3a83553
10 changed files with 121 additions and 723 deletions

View File

@@ -1,638 +0,0 @@
From: =?UTF-8?q?Richard=20Trembeck=C3=BD?= <richardt@centrum.sk>
Date: Sun, 1 May 2016 16:38:21 +0200
Subject: llvm: make KLEE compile against LLVM 3.5 and 3.6
Patch-mainline: no
Based on work by @ccadeptic23 and @delcypher.
Formatting fixed by @snf.
Fix compiler warning by @martijnthe.
Further fixes by @mchalupa.
Refactored, so that changes can be reviewed -- no massive changes in
whitespace and in the surrounding code.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
lib/Core/Executor.cpp | 25 +++++++-
lib/Core/ExternalDispatcher.cpp | 18 ++++++
lib/Core/ExternalDispatcher.h | 6 ++
lib/Core/StatsTracker.cpp | 11 ++--
lib/Module/KModule.cpp | 13 ++++-
lib/Module/ModuleUtil.cpp | 117 +++++++++++++++++++++++++++++++++-----
lib/Module/Optimize.cpp | 14 +++--
lib/Module/RaiseAsm.cpp | 13 ++++-
lib/Solver/QueryLoggingSolver.cpp | 8 ++-
lib/Support/CompressionStream.cpp | 10 +++-
test/lit.cfg | 2 +-
tools/klee/Makefile | 10 +++-
tools/klee/main.cpp | 16 +++++-
13 files changed, 227 insertions(+), 36 deletions(-)
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index 95812dd72587..4148ca22caf3 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -81,6 +81,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/raw_ostream.h"
@@ -383,7 +384,13 @@ Executor::Executor(LLVMContext &ctx, const InterpreterOptions &opts,
if (!DebugCompressInstructions) {
#endif
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ std::error_code ec;
+ debugInstFile = new llvm::raw_fd_ostream(debug_file_name.c_str(), ec,
+ llvm::sys::fs::OpenFlags::F_Text);
+ if (ec)
+ ErrorInfo = ec.message();
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
debugInstFile = new llvm::raw_fd_ostream(debug_file_name.c_str(), ErrorInfo,
llvm::sys::fs::OpenFlags::F_Text);
#else
@@ -1479,9 +1486,13 @@ Function* Executor::getTargetFunction(Value *calledVal, ExecutionState &state) {
while (true) {
if (GlobalValue *gv = dyn_cast<GlobalValue>(c)) {
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ if (!Visited.insert(gv).second)
+ return 0;
+#else
if (!Visited.insert(gv))
return 0;
-
+#endif
std::string alias = state.getFnAlias(gv->getName());
if (alias != "") {
llvm::Module* currModule = kmodule->module;
@@ -3080,8 +3091,16 @@ void Executor::callExternalFunction(ExecutionState &state,
else
klee_warning_once(function, "%s", os.str().c_str());
}
-
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ // MCJIT needs unique module, so we create quick external dispatcher for call.
+ // reference:
+ // http://blog.llvm.org/2013/07/using-mcjit-with-kaleidoscope-tutorial.html
+ ExternalDispatcher *e = new ExternalDispatcher(function->getContext());
+ bool success = e->executeCall(function, target->inst, args);
+ delete e;
+#else
bool success = externalDispatcher->executeCall(function, target->inst, args);
+#endif
if (!success) {
terminateStateOnError(state, "failed external call: " + function->getName(),
External);
diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp
index 984e3ab2e4a4..9701d35add85 100644
--- a/lib/Core/ExternalDispatcher.cpp
+++ b/lib/Core/ExternalDispatcher.cpp
@@ -23,7 +23,12 @@
#include "llvm/Instructions.h"
#include "llvm/LLVMContext.h"
#endif
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+#include "llvm/ExecutionEngine/MCJIT.h"
+#else
#include "llvm/ExecutionEngine/JIT.h"
+#endif
+
#include "llvm/ExecutionEngine/GenericValue.h"
#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Support/raw_ostream.h"
@@ -89,7 +94,12 @@ ExternalDispatcher::ExternalDispatcher(LLVMContext &ctx) {
dispatchModule = new Module("ExternalDispatcher", ctx);
std::string error;
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ dispatchModule_uniptr.reset(dispatchModule);
+ executionEngine = EngineBuilder(std::move(dispatchModule_uniptr)).create();
+#else
executionEngine = ExecutionEngine::createJIT(dispatchModule, &error);
+#endif
if (!executionEngine) {
llvm::errs() << "unable to make jit: " << error << "\n";
abort();
@@ -98,6 +108,10 @@ ExternalDispatcher::ExternalDispatcher(LLVMContext &ctx) {
// If we have a native target, initialize it to ensure it is linked in and
// usable by the JIT.
llvm::InitializeNativeTarget();
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ llvm::InitializeNativeTargetAsmParser();
+ llvm::InitializeNativeTargetAsmPrinter();
+#endif
// from ExecutionEngine::create
if (executionEngine) {
@@ -146,7 +160,11 @@ bool ExternalDispatcher::executeCall(Function *f, Instruction *i, uint64_t *args
// ensures that any errors or assertions in the compilation process will
// trigger crashes instead of being caught as aborts in the external
// function.
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ executionEngine->finalizeObject();
+#else
executionEngine->recompileAndRelinkFunction(dispatcher);
+#endif
}
} else {
dispatcher = it->second;
diff --git a/lib/Core/ExternalDispatcher.h b/lib/Core/ExternalDispatcher.h
index 94363bab5ffc..d869eb6fe0ca 100644
--- a/lib/Core/ExternalDispatcher.h
+++ b/lib/Core/ExternalDispatcher.h
@@ -10,7 +10,10 @@
#ifndef KLEE_EXTERNALDISPATCHER_H
#define KLEE_EXTERNALDISPATCHER_H
+#include "klee/Config/Version.h"
+
#include <map>
+#include <memory>
#include <string>
#include <stdint.h>
@@ -28,6 +31,9 @@ namespace klee {
private:
typedef std::map<const llvm::Instruction*,llvm::Function*> dispatchers_ty;
dispatchers_ty dispatchers;
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ std::unique_ptr<llvm::Module> dispatchModule_uniptr;
+#endif
llvm::Module *dispatchModule;
llvm::ExecutionEngine *executionEngine;
std::map<std::string, void*> preboundFunctions;
diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp
index e8192a8ed754..b93796ecdff7 100644
--- a/lib/Core/StatsTracker.cpp
+++ b/lib/Core/StatsTracker.cpp
@@ -206,13 +206,16 @@ StatsTracker::StatsTracker(Executor &_executor, std::string _objectFilename,
if (!sys::path::is_absolute(objectFilename)) {
SmallString<128> current(objectFilename);
if(sys::fs::make_absolute(current)) {
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ Twine current_twine(current.str()); // requires a twine for this
+ if (!sys::fs::exists(current_twine)) {
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+ bool exists = false;
+ if (!sys::fs::exists(current.str(), exists)) {
+#else
bool exists = false;
-
-#if LLVM_VERSION_CODE < LLVM_VERSION(3, 5)
error_code ec = sys::fs::exists(current.str(), exists);
if (ec == errc::success && exists) {
-#else
- if (!sys::fs::exists(current.str(), exists)) {
#endif
objectFilename = current.c_str();
}
diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp
index 08ec28efc1f6..45dc34bfec46 100644
--- a/lib/Module/KModule.cpp
+++ b/lib/Module/KModule.cpp
@@ -158,8 +158,14 @@ static Function *getStubFunctionForCtorList(Module *m,
if (arr) {
for (unsigned i=0; i<arr->getNumOperands(); i++) {
ConstantStruct *cs = cast<ConstantStruct>(arr->getOperand(i));
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+ // There is a third *optional* element in global_ctor elements (``i8
+ // @data``).
+ assert((cs->getNumOperands() == 2 || cs->getNumOperands() == 3) &&
+ "unexpected element in ctor initializer list");
+#else
assert(cs->getNumOperands()==2 && "unexpected element in ctor initializer list");
-
+#endif
Constant *fp = cs->getOperand(1);
if (!fp->isNullValue()) {
if (llvm::ConstantExpr *ce = dyn_cast<llvm::ConstantExpr>(fp))
@@ -513,8 +519,13 @@ static int getOperandNum(Value *v,
return registerMap[inst];
} else if (Argument *a = dyn_cast<Argument>(v)) {
return a->getArgNo();
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ // Metadata is no longer a Value
+ } else if (isa<BasicBlock>(v) || isa<InlineAsm>(v)) {
+#else
} else if (isa<BasicBlock>(v) || isa<InlineAsm>(v) ||
isa<MDNode>(v)) {
+#endif
return -1;
} else {
assert(isa<Constant>(v));
diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp
index 83dc5045e711..c7f1c6d9d4a7 100644
--- a/lib/Module/ModuleUtil.cpp
+++ b/lib/Module/ModuleUtil.cpp
@@ -212,15 +212,27 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er
KLEE_DEBUG_WITH_TYPE("klee_linker", dbgs() << "Loading modules\n");
// Load all bitcode files in to memory so we can examine their symbols
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+ for (object::Archive::child_iterator AI = archive->child_begin(),
+ AE = archive->child_end(); AI != AE; ++AI)
+#else
for (object::Archive::child_iterator AI = archive->begin_children(),
AE = archive->end_children(); AI != AE; ++AI)
+#endif
{
StringRef memberName;
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+ ErrorOr<StringRef> memberNameErr = AI->getName();
+ std::error_code ec = memberNameErr.getError();
+ if (!ec) {
+ memberName = memberNameErr.get();
+#else
error_code ec = AI->getName(memberName);
if ( ec == errc::success )
{
+#endif
KLEE_DEBUG_WITH_TYPE("klee_linker", dbgs() << "Loading archive member " << memberName << "\n");
}
else
@@ -229,17 +241,29 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er
return false;
}
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+ ErrorOr<std::unique_ptr<llvm::object::Binary> > child = AI->getAsBinary();
+ ec = child.getError();
+#else
OwningPtr<object::Binary> child;
ec = AI->getAsBinary(child);
- if (ec != object::object_error::success)
- {
+#endif
+ if (ec) {
// If we can't open as a binary object file its hopefully a bitcode file
-
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ ErrorOr<MemoryBufferRef> buff = AI->getMemoryBufferRef();
+ ec = buff.getError();
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+ ErrorOr<std::unique_ptr<MemoryBuffer> > buffErr = AI->getMemoryBuffer();
+ std::unique_ptr<MemoryBuffer> buff = nullptr;
+ ec = buffErr.getError();
+ if (!ec)
+ buff = std::move(buffErr.get());
+#else
OwningPtr<MemoryBuffer> buff; // Once this is destroyed will Module still be valid??
- Module *Result = 0;
-
- if (error_code ec = AI->getMemoryBuffer(buff))
- {
+ ec = AI->getMemoryBuffer(buff);
+#endif
+ if (ec) {
SS << "Failed to get MemoryBuffer: " <<ec.message();
SS.flush();
return false;
@@ -247,10 +271,20 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er
if (buff)
{
+ Module *Result = 0;
// FIXME: Maybe load bitcode file lazily? Then if we need to link, materialise the module
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+ ErrorOr<Module *> resultErr = parseBitcodeFile(buff.get(),
+ composite->getContext());
+ ec = resultErr.getError();
+ if (ec)
+ errorMessage = ec.message();
+ else
+ Result = resultErr.get();
+#else
Result = ParseBitcodeFile(buff.get(), composite->getContext(),
&errorMessage);
-
+#endif
if(!Result)
{
SS << "Loading module failed : " << errorMessage << "\n";
@@ -317,8 +351,11 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er
KLEE_DEBUG_WITH_TYPE("klee_linker", dbgs() << "Found " << GV->getName() <<
" in " << M->getModuleIdentifier() << "\n");
-
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ if (Linker::LinkModules(composite, M))
+#else
if (Linker::LinkModules(composite, M, Linker::DestroySource, &errorMessage))
+#endif
{
// Linking failed
SS << "Linking archive module with composite failed:" << errorMessage;
@@ -371,36 +408,86 @@ Module *klee::linkWithLibrary(Module *module,
libraryName.c_str());
}
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+ ErrorOr<std::unique_ptr<MemoryBuffer> > bufferErr =
+ MemoryBuffer::getFile(libraryName);
+ std::error_code ec = bufferErr.getError();
+#else
OwningPtr<MemoryBuffer> Buffer;
- if (error_code ec = MemoryBuffer::getFile(libraryName,Buffer)) {
+ error_code ec = MemoryBuffer::getFile(libraryName,Buffer);
+#endif
+ if (ec) {
klee_error("Link with library %s failed: %s", libraryName.c_str(),
ec.message().c_str());
}
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ MemoryBufferRef Buffer = bufferErr.get()->getMemBufferRef();
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+ MemoryBuffer *Buffer = bufferErr->get();
+#endif
+
+#if 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
LLVMContext &Context = module->getContext();
std::string ErrorMessage;
if (magic == sys::fs::file_magic::bitcode) {
Module *Result = 0;
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+ ErrorOr<Module *> ResultErr = parseBitcodeFile(Buffer, Context);
+ if ((ec = ResultErr.getError())) {
+ ErrorMessage = ec.message();
+#else
Result = ParseBitcodeFile(Buffer.get(), Context, &ErrorMessage);
+ if (!Result) {
+#endif
+ klee_error("Link with library %s failed: %s", libraryName.c_str(),
+ ErrorMessage.c_str());
+ }
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+ Result = ResultErr.get();
+#endif
- if (!Result || Linker::LinkModules(module, Result, Linker::DestroySource,
- &ErrorMessage))
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ if (Linker::LinkModules(module, Result)) {
+ ErrorMessage = "linking error";
+#else
+ if (Linker::LinkModules(module, Result, Linker::DestroySource, &ErrorMessage)) {
+#endif
klee_error("Link with library %s failed: %s", libraryName.c_str(),
ErrorMessage.c_str());
+ }
delete Result;
} else if (magic == sys::fs::file_magic::archive) {
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ ErrorOr<std::unique_ptr<object::Binary> > arch =
+ object::createBinary(Buffer, &Context);
+ ec = arch.getError();
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+ ErrorOr<object::Binary *> arch =
+ object::createBinary(std::move(bufferErr.get()), &Context);
+ ec = arch.getError();
+#else
OwningPtr<object::Binary> arch;
- if (error_code ec = object::createBinary(Buffer.take(), arch))
+ ec = object::createBinary(Buffer.take(), arch);
+#endif
+ if (ec)
klee_error("Link with library %s failed: %s", libraryName.c_str(),
ec.message().c_str());
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ if (object::Archive *a = dyn_cast<object::Archive>(arch->get())) {
+#else
if (object::Archive *a = dyn_cast<object::Archive>(arch.get())) {
+#endif
// Handle in helper
if (!linkBCA(a, module, ErrorMessage))
klee_error("Link with library %s failed: %s", libraryName.c_str(),
@@ -411,7 +498,11 @@ Module *klee::linkWithLibrary(Module *module,
}
} else if (magic.is_object()) {
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+ std::unique_ptr<object::Binary> obj;
+#else
OwningPtr<object::Binary> obj;
+#endif
if (obj.get()->isObject()) {
klee_warning("Link with library: Object file %s in archive %s found. "
"Currently not supported.",
diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp
index 3d9c8cc17bf3..c0f3f34ca8e8 100644
--- a/lib/Module/Optimize.cpp
+++ b/lib/Module/Optimize.cpp
@@ -172,15 +172,17 @@ void Optimize(Module *M, const std::string &EntryPoint) {
if (VerifyEach)
Passes.add(createVerifierPass());
-#if LLVM_VERSION_CODE <= LLVM_VERSION(3, 1)
- // Add an appropriate TargetData instance for this module...
- addPass(Passes, new TargetData(M));
-#elif LLVM_VERSION_CODE < LLVM_VERSION(3, 5)
// Add an appropriate DataLayout instance for this module...
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ DataLayoutPass *dlpass = new DataLayoutPass();
+ dlpass->doInitialization(*M);
+ addPass(Passes, dlpass);
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+ addPass(Passes, new DataLayoutPass(M));
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 2)
addPass(Passes, new DataLayout(M));
#else
- // Add an appropriate DataLayout instance for this module...
- addPass(Passes, new DataLayoutPass(M));
+ addPass(Passes, new TargetData(M));
#endif
// DWD - Run the opt standard pass list as well.
diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp
index af92b74b41b0..5fc54ef17743 100644
--- a/lib/Module/RaiseAsm.cpp
+++ b/lib/Module/RaiseAsm.cpp
@@ -24,6 +24,10 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Host.h"
#include "llvm/Target/TargetLowering.h"
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetSubtargetInfo.h"
+#endif
#if LLVM_VERSION_CODE < LLVM_VERSION(3, 0)
#include "llvm/Target/TargetRegistry.h"
#else
@@ -99,15 +103,20 @@ bool RaiseAsmPass::runOnModule(Module &M) {
klee_warning("Warning: unable to select native target: %s", Err.c_str());
TLI = 0;
} else {
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 1)
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ TM = NativeTarget->createTargetMachine(HostTriple, "", "", TargetOptions());
+ TLI = TM->getSubtargetImpl()->getTargetLowering();
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 1)
TM = NativeTarget->createTargetMachine(HostTriple, "", "",
TargetOptions());
+ TLI = TM->getTargetLowering();
#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 0)
TM = NativeTarget->createTargetMachine(HostTriple, "", "");
+ TLI = TM->getTargetLowering();
#else
TM = NativeTarget->createTargetMachine(HostTriple, "");
-#endif
TLI = TM->getTargetLowering();
+#endif
triple = llvm::Triple(HostTriple);
}
diff --git a/lib/Solver/QueryLoggingSolver.cpp b/lib/Solver/QueryLoggingSolver.cpp
index a858a7d7ed87..cf4966cd4861 100644
--- a/lib/Solver/QueryLoggingSolver.cpp
+++ b/lib/Solver/QueryLoggingSolver.cpp
@@ -42,7 +42,13 @@ QueryLoggingSolver::QueryLoggingSolver(Solver *_solver, std::string path,
#ifdef HAVE_ZLIB_H
if (!CreateCompressedQueryLog) {
#endif
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ std::error_code ec;
+ os = new llvm::raw_fd_ostream(path.c_str(), ec,
+ llvm::sys::fs::OpenFlags::F_Text);
+ if (ec)
+ ErrorInfo = ec.message();
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
os = new llvm::raw_fd_ostream(path.c_str(), ErrorInfo,
llvm::sys::fs::OpenFlags::F_Text);
#else
diff --git a/lib/Support/CompressionStream.cpp b/lib/Support/CompressionStream.cpp
index eb208edfa395..363038786f6b 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>
@@ -27,9 +29,13 @@ compressed_fd_ostream::compressed_fd_ostream(const char *Filename,
ErrorInfo = "";
#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
// Open file in binary mode
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+ std::error_code EC =
+ llvm::sys::fs::openFileForWrite(Filename, FD, llvm::sys::fs::F_None);
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
llvm::error_code EC =
llvm::sys::fs::openFileForWrite(Filename, FD, llvm::sys::fs::F_Binary);
-
+#endif
if (EC) {
ErrorInfo = EC.message();
FD = -1;
diff --git a/test/lit.cfg b/test/lit.cfg
index 31552882c55e..6ce6dc955847 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -130,7 +130,7 @@ if int(config.llvm_version_major) == 2:
# Add feature for the LLVM version in use, so it can be tested in REQUIRES and
# XFAIL checks. We also add "not-XXX" variants, for the same reason.
-known_llvm_versions = set(["2.9", "3.4", "3.5"])
+known_llvm_versions = set(["2.9", "3.4", "3.5", "3.6"])
current_llvm_version = "%s.%s" % (config.llvm_version_major,
config.llvm_version_minor)
config.available_features.add("llvm-" + current_llvm_version)
diff --git a/tools/klee/Makefile b/tools/klee/Makefile
index 8d50403fc1da..2930427c7bde 100644
--- a/tools/klee/Makefile
+++ b/tools/klee/Makefile
@@ -13,7 +13,13 @@ TOOLNAME = klee
include $(LEVEL)/Makefile.config
USEDLIBS = kleeCore.a kleeBasic.a kleeModule.a kleaverSolver.a kleaverExpr.a kleeSupport.a
-LINK_COMPONENTS = jit bitreader bitwriter ipo linker engine
+LINK_COMPONENTS = bitreader bitwriter ipo linker engine
+
+ifeq ($(shell python -c "print($(LLVM_VERSION_MAJOR).$(LLVM_VERSION_MINOR) >= 3.6)"), True)
+LINK_COMPONENTS += mcjit
+else
+LINK_COMPONENTS += jit
+endif
ifeq ($(shell python -c "print($(LLVM_VERSION_MAJOR).$(LLVM_VERSION_MINOR) >= 3.3)"), True)
LINK_COMPONENTS += irreader
@@ -36,4 +42,4 @@ endif
ifeq ($(HAVE_ZLIB),1)
LIBS += -lz
-endif
\ No newline at end of file
+endif
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index c65953d1399e..90d54e064dd3 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -385,7 +385,12 @@ llvm::raw_fd_ostream *KleeHandler::openOutputFile(const std::string &filename) {
llvm::raw_fd_ostream *f;
std::string Error;
std::string path = getOutputFilename(filename);
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3,5)
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ std::error_code ec;
+ f = new llvm::raw_fd_ostream(path.c_str(), ec, llvm::sys::fs::F_None);
+ if (ec)
+ Error = ec.message();
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
f = new llvm::raw_fd_ostream(path.c_str(), Error, llvm::sys::fs::F_None);
#elif LLVM_VERSION_CODE >= LLVM_VERSION(3,4)
f = new llvm::raw_fd_ostream(path.c_str(), Error, llvm::sys::fs::F_Binary);
@@ -1038,9 +1043,14 @@ static llvm::Module *linkWithUclibc(llvm::Module *mainModule, StringRef libDir)
SmallString<128> uclibcBCA(libDir);
llvm::sys::path::append(uclibcBCA, KLEE_UCLIBC_BCA_NAME);
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ Twine uclibcBCA_twine(uclibcBCA.c_str());
+ if (!llvm::sys::fs::exists(uclibcBCA_twine))
+#else
bool uclibcExists=false;
llvm::sys::fs::exists(uclibcBCA.c_str(), uclibcExists);
if (!uclibcExists)
+#endif
klee_error("Cannot find klee-uclibc : %s", uclibcBCA.c_str());
Function *f;
@@ -1265,7 +1275,11 @@ int main(int argc, char **argv, char **envp) {
klee_error("error loading program '%s': %s", InputFile.c_str(),
Buffer.getError().message().c_str());
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+ auto mainModuleOrError = getLazyBitcodeModule(std::move(Buffer.get()), ctx);
+#else
auto mainModuleOrError = getLazyBitcodeModule(Buffer->get(), ctx);
+#endif
if (!mainModuleOrError) {
klee_error("error loading program '%s': %s", InputFile.c_str(),
--
2.12.0

View File

@@ -7,10 +7,21 @@ They fail for some reason I cannot debug ATM, I will fix it later.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
test/Feature/LongDouble.cpp | 1 +
test/Runtime/POSIX/DirSeek.c | 1 +
test/Runtime/POSIX/Ioctl.c | 1 +
2 files changed, 2 insertions(+)
3 files changed, 3 insertions(+)
--- a/test/Feature/LongDouble.cpp
+++ b/test/Feature/LongDouble.cpp
@@ -7,6 +7,7 @@
// RUN: grep -q 1/0=inf %t.log
// RUN: grep -q 1/-1=-1\\.0\\+ %t.log
// RUN: grep -q 1/-2=-0\\.50\\+ %t.log
+// REQUIRES: lt-gcc-7
#include <cstdio>
#include <cstdlib>
--- a/test/Runtime/POSIX/DirSeek.c
+++ b/test/Runtime/POSIX/DirSeek.c
@@ -8,6 +8,7 @@

View File

@@ -56,21 +56,21 @@ Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
create mode 100644 test/regression/2007-08-16-invalid-constant-value.llvm38.c
diff --git a/test/Concrete/BoolReadWrite.ll b/test/Concrete/BoolReadWrite.ll
index f818ecafacd5..eb618d2726b7 100644
index f818ecafacd5..f2d76227c545 100644
--- a/test/Concrete/BoolReadWrite.ll
+++ b/test/Concrete/BoolReadWrite.ll
@@ -1,3 +1,4 @@
+; REQUIRES: not-llvm-3.8
+; REQUIRES: lt-llvm-3.8
; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s
declare void @print_i1(i1)
diff --git a/test/Concrete/BoolReadWrite.llvm38.ll b/test/Concrete/BoolReadWrite.llvm38.ll
new file mode 100644
index 000000000000..c68696d1a4c1
index 000000000000..d2c6c88aff32
--- /dev/null
+++ b/test/Concrete/BoolReadWrite.llvm38.ll
@@ -0,0 +1,16 @@
+; REQUIRES: llvm-3.8
+; REQUIRES: geq-llvm-3.8
+; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s
+
+declare void @print_i1(i1)
@@ -87,21 +87,21 @@ index 000000000000..c68696d1a4c1
+ ret i32 0
+}
diff --git a/test/Concrete/ConstantExpr.ll b/test/Concrete/ConstantExpr.ll
index d00c59a637e9..d5a97919634b 100644
index d00c59a637e9..84cf1ad0f517 100644
--- a/test/Concrete/ConstantExpr.ll
+++ b/test/Concrete/ConstantExpr.ll
@@ -1,3 +1,4 @@
+; REQUIRES: not-llvm-3.8
+; REQUIRES: lt-llvm-3.8
; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s
; Most of the test below use the *address* of gInt as part of their computation,
diff --git a/test/Concrete/ConstantExpr.llvm38.ll b/test/Concrete/ConstantExpr.llvm38.ll
new file mode 100644
index 000000000000..f02e59ffe49a
index 000000000000..dc9dce931ba8
--- /dev/null
+++ b/test/Concrete/ConstantExpr.llvm38.ll
@@ -0,0 +1,165 @@
+; REQUIRES: llvm-3.8
+; REQUIRES: geq-llvm-3.8
+; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s
+
+; Most of the test below use the *address* of gInt as part of their computation,
@@ -267,21 +267,21 @@ index 000000000000..f02e59ffe49a
+declare void @print_i32(i32)
+declare void @print_i64(i64)
diff --git a/test/Concrete/FloatingPointOps.ll b/test/Concrete/FloatingPointOps.ll
index 5dd6d2feb41e..20c99db798b1 100644
index 5dd6d2feb41e..12d8cd241d2f 100644
--- a/test/Concrete/FloatingPointOps.ll
+++ b/test/Concrete/FloatingPointOps.ll
@@ -1,3 +1,4 @@
+; REQUIRES: not-llvm-3.8
+; REQUIRES: lt-llvm-3.8
; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s
; casting error messages
diff --git a/test/Concrete/FloatingPointOps.llvm38.ll b/test/Concrete/FloatingPointOps.llvm38.ll
new file mode 100644
index 000000000000..44fa9f2a9ac1
index 000000000000..3dbbb49aef4b
--- /dev/null
+++ b/test/Concrete/FloatingPointOps.llvm38.ll
@@ -0,0 +1,680 @@
+; REQUIRES: llvm-3.8
+; REQUIRES: geq-llvm-3.8
+; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s
+
+; casting error messages
@@ -962,21 +962,21 @@ index 000000000000..44fa9f2a9ac1
+ ret i32 0
+}
diff --git a/test/Concrete/GlobalInitializers.ll b/test/Concrete/GlobalInitializers.ll
index e3657dad19e5..4399da750475 100755
index e3657dad19e5..b883ad40d940 100755
--- a/test/Concrete/GlobalInitializers.ll
+++ b/test/Concrete/GlobalInitializers.ll
@@ -1,3 +1,4 @@
+; REQUIRES: not-llvm-3.8
+; REQUIRES: lt-llvm-3.8
; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s
declare void @print_i32(i32)
diff --git a/test/Concrete/GlobalInitializers.llvm38.ll b/test/Concrete/GlobalInitializers.llvm38.ll
new file mode 100755
index 000000000000..604e999183f3
index 000000000000..98f5b6787f80
--- /dev/null
+++ b/test/Concrete/GlobalInitializers.llvm38.ll
@@ -0,0 +1,48 @@
+; REQUIRES: llvm-3.8
+; REQUIRES: geq-llvm-3.8
+; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s
+
+declare void @print_i32(i32)
@@ -1025,21 +1025,21 @@ index 000000000000..604e999183f3
+ ret i32 0
+}
diff --git a/test/Concrete/SimpleStoreAndLoad.ll b/test/Concrete/SimpleStoreAndLoad.ll
index 1edad0386916..1046c5d81bd3 100644
index 1edad0386916..6e8542f8f5fd 100644
--- a/test/Concrete/SimpleStoreAndLoad.ll
+++ b/test/Concrete/SimpleStoreAndLoad.ll
@@ -1,3 +1,4 @@
+; REQUIRES: not-llvm-3.8
+; REQUIRES: lt-llvm-3.8
; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s
declare void @print_i32(i32)
diff --git a/test/Concrete/SimpleStoreAndLoad.llvm38.ll b/test/Concrete/SimpleStoreAndLoad.llvm38.ll
new file mode 100644
index 000000000000..b8944ee9b939
index 000000000000..1a36c674c36d
--- /dev/null
+++ b/test/Concrete/SimpleStoreAndLoad.llvm38.ll
@@ -0,0 +1,20 @@
+; REQUIRES: llvm-3.8
+; REQUIRES: geq-llvm-3.8
+; RUN: %S/ConcreteTest.py --klee='%klee' --lli=%lli %s
+
+declare void @print_i32(i32)
@@ -1060,21 +1060,21 @@ index 000000000000..b8944ee9b939
+ ret i32 0
+}
diff --git a/test/Feature/BitcastAlias.ll b/test/Feature/BitcastAlias.ll
index e0e3653feebc..0232903eb74a 100644
index e0e3653feebc..f29e739c9e75 100644
--- a/test/Feature/BitcastAlias.ll
+++ b/test/Feature/BitcastAlias.ll
@@ -1,3 +1,4 @@
+; REQUIRES: not-llvm-3.8
+; REQUIRES: lt-llvm-3.8
; RUN: llvm-as %s -f -o %t1.bc
; RUN: rm -rf %t.klee-out
; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2
diff --git a/test/Feature/BitcastAlias.llvm38.ll b/test/Feature/BitcastAlias.llvm38.ll
new file mode 100644
index 000000000000..cecf68cc1f39
index 000000000000..ff7009b7711b
--- /dev/null
+++ b/test/Feature/BitcastAlias.llvm38.ll
@@ -0,0 +1,35 @@
+; REQUIRES: llvm-3.8
+; REQUIRES: geq-llvm-3.8
+; RUN: llvm-as %s -f -o %t1.bc
+; RUN: rm -rf %t.klee-out
+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2
@@ -1110,21 +1110,21 @@ index 000000000000..cecf68cc1f39
+ ret i32 0
+}
diff --git a/test/Feature/BitcastAliasMD2U.ll b/test/Feature/BitcastAliasMD2U.ll
index 24eabaa57c8c..ade6ba8a65db 100644
index 24eabaa57c8c..322012882f01 100644
--- a/test/Feature/BitcastAliasMD2U.ll
+++ b/test/Feature/BitcastAliasMD2U.ll
@@ -1,3 +1,4 @@
+; REQUIRES: not-llvm-3.8
+; REQUIRES: lt-llvm-3.8
; RUN: llvm-as %s -f -o %t1.bc
; RUN: rm -rf %t.klee-out
; RUN: %klee --output-dir=%t.klee-out -disable-opt -search=nurs:md2u %t1.bc > %t2
diff --git a/test/Feature/BitcastAliasMD2U.llvm38.ll b/test/Feature/BitcastAliasMD2U.llvm38.ll
new file mode 100644
index 000000000000..aa7c5dec500f
index 000000000000..f4e41293c347
--- /dev/null
+++ b/test/Feature/BitcastAliasMD2U.llvm38.ll
@@ -0,0 +1,35 @@
+; REQUIRES: llvm-3.8
+; REQUIRES: geq-llvm-3.8
+; RUN: llvm-as %s -f -o %t1.bc
+; RUN: rm -rf %t.klee-out
+; RUN: %klee --output-dir=%t.klee-out -disable-opt -search=nurs:md2u %t1.bc > %t2
@@ -1160,21 +1160,21 @@ index 000000000000..aa7c5dec500f
+ ret i32 0
+}
diff --git a/test/Feature/ConstantStruct.ll b/test/Feature/ConstantStruct.ll
index 4fe6b5d0e041..dfb304185d88 100644
index 4fe6b5d0e041..cb7ce2541bad 100644
--- a/test/Feature/ConstantStruct.ll
+++ b/test/Feature/ConstantStruct.ll
@@ -1,3 +1,4 @@
+; REQUIRES: not-llvm-3.8
+; REQUIRES: lt-llvm-3.8
; RUN: llvm-as %s -f -o %t1.bc
; RUN: rm -rf %t.klee-out
; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2
diff --git a/test/Feature/ConstantStruct.llvm38.ll b/test/Feature/ConstantStruct.llvm38.ll
new file mode 100644
index 000000000000..2d468c13fae2
index 000000000000..b0e6ea835e1e
--- /dev/null
+++ b/test/Feature/ConstantStruct.llvm38.ll
@@ -0,0 +1,34 @@
+; REQUIRES: llvm-3.8
+; REQUIRES: geq-llvm-3.8
+; RUN: llvm-as %s -f -o %t1.bc
+; RUN: rm -rf %t.klee-out
+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2
@@ -1209,21 +1209,21 @@ index 000000000000..2d468c13fae2
+ ret i32 0
+}
diff --git a/test/Feature/GetElementPtr.ll b/test/Feature/GetElementPtr.ll
index da94441c685e..7a3b4cd53b7c 100644
index da94441c685e..cf3cc20d6dc2 100644
--- a/test/Feature/GetElementPtr.ll
+++ b/test/Feature/GetElementPtr.ll
@@ -1,3 +1,4 @@
+; REQUIRES: not-llvm-3.8
+; REQUIRES: lt-llvm-3.8
; RUN: llvm-as %s -f -o %t1.bc
; RUN: rm -rf %t.klee-out
; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2
diff --git a/test/Feature/GetElementPtr.llvm38.ll b/test/Feature/GetElementPtr.llvm38.ll
new file mode 100644
index 000000000000..e063247918f3
index 000000000000..72c71f2b14d0
--- /dev/null
+++ b/test/Feature/GetElementPtr.llvm38.ll
@@ -0,0 +1,30 @@
+; REQUIRES: llvm-3.8
+; REQUIRES: geq-llvm-3.8
+; RUN: llvm-as %s -f -o %t1.bc
+; RUN: rm -rf %t.klee-out
+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2
@@ -1254,21 +1254,21 @@ index 000000000000..e063247918f3
+ ret i32 0
+}
diff --git a/test/Feature/InsertExtractValue.ll b/test/Feature/InsertExtractValue.ll
index 83e8f851ccea..55839bb18d28 100644
index 83e8f851ccea..a52222e2232a 100644
--- a/test/Feature/InsertExtractValue.ll
+++ b/test/Feature/InsertExtractValue.ll
@@ -1,3 +1,4 @@
+; REQUIRES: not-llvm-3.8
+; REQUIRES: lt-llvm-3.8
; RUN: llvm-as %s -f -o %t1.bc
; RUN: rm -rf %t.klee-out
; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2
diff --git a/test/Feature/InsertExtractValue.llvm38.ll b/test/Feature/InsertExtractValue.llvm38.ll
new file mode 100644
index 000000000000..ca04c46745ae
index 000000000000..2b80b9385cb5
--- /dev/null
+++ b/test/Feature/InsertExtractValue.llvm38.ll
@@ -0,0 +1,34 @@
+; REQUIRES: llvm-3.8
+; REQUIRES: geq-llvm-3.8
+; RUN: llvm-as %s -f -o %t1.bc
+; RUN: rm -rf %t.klee-out
+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2
@@ -1303,21 +1303,21 @@ index 000000000000..ca04c46745ae
+ ret i32 0
+}
diff --git a/test/Feature/Overflow.ll b/test/Feature/Overflow.ll
index 35dfbd10fe02..9632e1e02d1c 100644
index 35dfbd10fe02..08ece1189a54 100644
--- a/test/Feature/Overflow.ll
+++ b/test/Feature/Overflow.ll
@@ -1,3 +1,4 @@
+; REQUIRES: not-llvm-3.8
+; REQUIRES: lt-llvm-3.8
; RUN: llvm-as %s -f -o %t1.bc
; RUN: rm -rf %t.klee-out
; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2
diff --git a/test/Feature/Overflow.llvm38.ll b/test/Feature/Overflow.llvm38.ll
new file mode 100644
index 000000000000..f7fcf71b7f11
index 000000000000..c84aeb26bc23
--- /dev/null
+++ b/test/Feature/Overflow.llvm38.ll
@@ -0,0 +1,45 @@
+; REQUIRES: llvm-3.8
+; REQUIRES: geq-llvm-3.8
+; RUN: llvm-as %s -f -o %t1.bc
+; RUN: rm -rf %t.klee-out
+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2
@@ -1363,21 +1363,21 @@ index 000000000000..f7fcf71b7f11
+ ret i32 0
+}
diff --git a/test/Feature/OverflowMul.ll b/test/Feature/OverflowMul.ll
index 7026aa74bfbe..513cefd68277 100644
index 7026aa74bfbe..422672e37f51 100644
--- a/test/Feature/OverflowMul.ll
+++ b/test/Feature/OverflowMul.ll
@@ -1,3 +1,4 @@
+; REQUIRES: not-llvm-3.8
+; REQUIRES: lt-llvm-3.8
; RUN: llvm-as %s -f -o %t1.bc
; RUN: rm -rf %t.klee-out
; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2
diff --git a/test/Feature/OverflowMul.llvm38.ll b/test/Feature/OverflowMul.llvm38.ll
new file mode 100644
index 000000000000..8ad119bd6893
index 000000000000..84f5242e9e92
--- /dev/null
+++ b/test/Feature/OverflowMul.llvm38.ll
@@ -0,0 +1,45 @@
+; REQUIRES: llvm-3.8
+; REQUIRES: geq-llvm-3.8
+; RUN: llvm-as %s -f -o %t1.bc
+; RUN: rm -rf %t.klee-out
+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2
@@ -1500,7 +1500,7 @@ index 000000000000..7114daabb6c2
+ ret i32 %res
+}
diff --git a/test/Intrinsics/objectsize.ll b/test/Intrinsics/objectsize.ll
index 8b75ce8feda5..255c7156017d 100644
index 8b75ce8feda5..08dd81460a6e 100644
--- a/test/Intrinsics/objectsize.ll
+++ b/test/Intrinsics/objectsize.ll
@@ -1,7 +1,7 @@
@@ -1508,20 +1508,20 @@ index 8b75ce8feda5..255c7156017d 100644
; so this LLVM IR fails to verify for that version.
;
-; REQUIRES: not-llvm-2.9
+; REQUIRES: not-llvm-2.9, not-llvm-3.8
+; REQUIRES: not-llvm-2.9, lt-llvm-3.8
; RUN: %llvmas %s -o=%t.bc
; RUN: rm -rf %t.klee-out
; RUN: %klee -exit-on-error --output-dir=%t.klee-out -disable-opt %t.bc
diff --git a/test/Intrinsics/objectsize.llvm38.ll b/test/Intrinsics/objectsize.llvm38.ll
new file mode 100644
index 000000000000..af193daf0fd1
index 000000000000..d3f733ef6758
--- /dev/null
+++ b/test/Intrinsics/objectsize.llvm38.ll
@@ -0,0 +1,36 @@
+; Unfortunately LLVM 2.9 has a different suffix for the ``llvm.objectsize`` instrinsic
+; so this LLVM IR fails to verify for that version.
+;
+; REQUIRES: llvm-3.8
+; REQUIRES: geq-llvm-3.8
+; RUN: %llvmas %s -o=%t.bc
+; RUN: rm -rf %t.klee-out
+; RUN: %klee -exit-on-error --output-dir=%t.klee-out -disable-opt %t.bc
@@ -1555,10 +1555,10 @@ index 000000000000..af193daf0fd1
+
+declare void @abort() noreturn nounwind
diff --git a/test/lit.cfg b/test/lit.cfg
index 6ce6dc955847..90cd4aceb6f9 100644
index 9c557a78cc8f..6922cbce3313 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -130,7 +130,7 @@ if int(config.llvm_version_major) == 2:
@@ -158,7 +158,7 @@ if int(config.llvm_version_major) == 2:
# Add feature for the LLVM version in use, so it can be tested in REQUIRES and
# XFAIL checks. We also add "not-XXX" variants, for the same reason.
@@ -1568,21 +1568,21 @@ index 6ce6dc955847..90cd4aceb6f9 100644
config.llvm_version_minor)
config.available_features.add("llvm-" + current_llvm_version)
diff --git a/test/regression/2007-08-16-invalid-constant-value.c b/test/regression/2007-08-16-invalid-constant-value.c
index e0b304f40b01..d65be6af4929 100644
index e0b304f40b01..2b428f643ec5 100644
--- a/test/regression/2007-08-16-invalid-constant-value.c
+++ b/test/regression/2007-08-16-invalid-constant-value.c
@@ -1,3 +1,4 @@
+// REQUIRES: not-llvm-3.8
+// REQUIRES: lt-llvm-3.8
// RUN: rm -f %t4.out %t4.err %t4.log
// RUN: %llvmgcc %s -emit-llvm -O2 -c -o %t1.bc
// RUN: llvm-as -f %p/../Feature/_utils._ll -o %t2.bc
diff --git a/test/regression/2007-08-16-invalid-constant-value.llvm38.c b/test/regression/2007-08-16-invalid-constant-value.llvm38.c
new file mode 100644
index 000000000000..907749e3cf83
index 000000000000..71daeac5b523
--- /dev/null
+++ b/test/regression/2007-08-16-invalid-constant-value.llvm38.c
@@ -0,0 +1,33 @@
+// REQUIRES: llvm-3.8
+// REQUIRES: geq-llvm-3.8
+// RUN: rm -f %t4.out %t4.err %t4.log
+// RUN: %llvmgcc %s -emit-llvm -O2 -c -o %t1.bc
+// RUN: llvm-as -f %p/../Feature/_utils.llvm38._ll -o %t2.bc
@@ -1616,5 +1616,5 @@ index 000000000000..907749e3cf83
+ return 0;
+}
--
2.12.0
2.13.0

View File

@@ -6,7 +6,7 @@ Patch-mainline: no
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
include/klee/Internal/Support/FloatEvaluation.h | 7 +++++++
lib/Core/ExternalDispatcher.cpp | 4 ++++
lib/Core/ExternalDispatcher.cpp | 3 +++
lib/Module/InstructionInfoTable.cpp | 8 +++++++-
lib/Module/IntrinsicCleaner.cpp | 14 ++++++++++++++
lib/Module/KModule.cpp | 13 ++++++++++++-
@@ -14,7 +14,7 @@ Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
lib/Module/Optimize.cpp | 21 +++++++++++++++++++--
lib/Module/RaiseAsm.cpp | 5 ++++-
tools/klee/main.cpp | 6 +++++-
9 files changed, 91 insertions(+), 9 deletions(-)
9 files changed, 90 insertions(+), 9 deletions(-)
diff --git a/include/klee/Internal/Support/FloatEvaluation.h b/include/klee/Internal/Support/FloatEvaluation.h
index 6d9092f2ea37..436e0dc8152f 100644
@@ -37,21 +37,19 @@ index 6d9092f2ea37..436e0dc8152f 100644
}
}
diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp
index 9701d35add85..d49373f84e64 100644
index df0dd9a9a12f..380c97e62db8 100644
--- a/lib/Core/ExternalDispatcher.cpp
+++ b/lib/Core/ExternalDispatcher.cpp
@@ -257,7 +257,11 @@ Function *ExternalDispatcher::createDispatcher(Function *target, Instruction *in
LLVM_TYPE_Q Type *argTy = (i < FTy->getNumParams() ? FTy->getParamType(i) :
(*ai)->getType());
Instruction *argI64p =
@@ -331,6 +331,9 @@ Function *ExternalDispatcherImpl::createDispatcher(Function *target,
LLVM_TYPE_Q Type *argTy =
(i < FTy->getNumParams() ? FTy->getParamType(i) : (*ai)->getType());
Instruction *argI64p = GetElementPtrInst::Create(
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7)
+ GetElementPtrInst::Create(nullptr, argI64s,
+#else
GetElementPtrInst::Create(argI64s,
+ nullptr,
+#endif
ConstantInt::get(Type::getInt32Ty(ctx), idx),
"", dBB);
argI64s, ConstantInt::get(Type::getInt32Ty(ctx), idx), "", dBB);
Instruction *argp =
diff --git a/lib/Module/InstructionInfoTable.cpp b/lib/Module/InstructionInfoTable.cpp
index adf054423f13..625c4a297ead 100644
--- a/lib/Module/InstructionInfoTable.cpp
@@ -285,7 +283,7 @@ index 5fc54ef17743..29576ad10e9e 100644
TLI = TM->getSubtargetImpl()->getTargetLowering();
#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 1)
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 90d54e064dd3..20b1e33a6617 100644
index a91c9fd1e55e..28df3341a7a7 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -46,6 +46,7 @@
@@ -310,5 +308,5 @@ index 90d54e064dd3..20b1e33a6617 100644
klee_error("error loading program '%s': %s", InputFile.c_str(),
ec.message().c_str());
--
2.12.0
2.13.0

View File

@@ -15,7 +15,7 @@ Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
7 files changed, 78 insertions(+), 11 deletions(-)
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index 4148ca22caf3..794346e0950d 100644
index d71d767d7e04..56b9f92d71e4 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -2301,8 +2301,13 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
@@ -235,7 +235,7 @@ index 68acd2b17dda..46ab7d028224 100644
addPass(Passes, createLICMPass()); // Hoist loop invariants
addPass(Passes, createGVNPass()); // Remove redundancies
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 20b1e33a6617..4acefbf8c4de 100644
index 28df3341a7a7..bbbb4342f89e 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -310,7 +310,12 @@ KleeHandler::KleeHandler(int argc, char **argv)
@@ -265,5 +265,5 @@ index 20b1e33a6617..4acefbf8c4de 100644
ec.message().c_str());
}
--
2.12.0
2.13.0

View File

@@ -1,4 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">git://github.com/klee/klee.git</param>
<param name="changesrevision">28872c1a0cb8a8f6b835af67719b9cd9aba66d3f</param></service></servicedata>
<param name="changesrevision">e3b88631ef58ad406ac069bd3a4ba16fb4aa07cc</param></service></servicedata>

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3742053b828c281cddc02058e5f5e346d6fe5c990a9602e5a0ad8679c17010d9
size 648972

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7a8aef8f02ad1ef590b6de83e1c53d67855ffabea70c49ab2d8590c882826905
size 652400

View File

@@ -1,3 +1,32 @@
-------------------------------------------------------------------
Mon Jun 05 07:45:51 UTC 2017 - jslaby@suse.com
- Update to version 1.3.0+20170602:
* use METASMT_REQUIRE_RTTI flag to decide whether we need RTTI
* [travis] add environment variable METASMT_BOOST_VERSION to control the boost version used by metaSMT and test it with the combination LLVM-2.9 + metaSMT
* [CMake] change WARNING to FATAL_ERROR when building with a non-RTTI LLVM version and a metaSMT version that requires RTTI
* [TravisCI] Try to unbreak the build against upstream STP.
* Remove redundant KLEE prefix while logging
* llvm: make KLEE compile against LLVM 3.5 and 3.6
* travis CI: add LLVM 3.5 and 3.6 tests
* Rearchitect ExternalDispatcher
* gitignore build
* [Z3] Support another solver failure reason that Z3 might give. I'm going to guess it means timeout but I'm not 100% sure about this.
* [Z3] Add assertions in Z3 builder to catch underflow with bad widths.
* [Z3] Move the `dump()` methods of the Z3NodeHandle<> specializations into `Z3Builder.cpp` so they can be called from in gdb.
* Refactor file opening code out of `main.cpp` and into `klee_open_output_file()` function so that it can be used by the Z3Solver.
* [Z3] Add the `-debug-z3-dump-queries=<path>` command line option. This is useful for getting access to the constraints being stored in the Z3 solver in the SMT-LIBv2.5 format.
* [Z3] Add option to manually validate Z3 models.
* [Z3] Implement API logging.
* [Z3] In `getConstraintLog()` use a separate builder from that of the solver. This is to avoid tampering with the cache of the builder the solver is using.
* [Z3] Switch from `Z3_mk_simple_solver()` to `Z3_mk_solver()`.
* [Z3] Add `-debug-z3-verbosity=<N>` option which behaves like Z3's `-v:<N>` option. This lets us see what Z3 is doing execution (e.g. which tactic is being applied) which is very useful for debugging.
* [Z3] Remove unused include.
* replace handleMetaSMT() with klee::createMetaSMTSolver() and move it into MetaSMTSolver.cpp so that the backend headers only need to be included once there
* hide backend solver declarations from public include
- remove 0001-Make-KLEE-compile-against-LLVM-3.5-and-3.6.patch
It is upstream already.
-------------------------------------------------------------------
Wed Apr 26 09:18:55 UTC 2017 - jslaby@suse.com

View File

@@ -19,7 +19,7 @@
%define llvm_version_minor 8
%define llvm_version %{llvm_version_major}_%{llvm_version_minor}
%define version_unconverted 1.3.0+20170409
%define version_unconverted 1.3.0+20170602
%ifarch %{ix86} x86_64
%define with_uclibc 1
@@ -31,13 +31,12 @@ Name: klee
Summary: LLVM Execution Engine
License: NCSA
Group: Development/Languages/Other
Version: 1.3.0+20170409
Version: 1.3.0+20170602
Release: 0
Url: http://klee.github.io/
Source0: %{name}-%{version}.tar.xz
Source1: %{name}-rpmlintrc
Source2: https://raw.githubusercontent.com/llvm-mirror/llvm/release_%{llvm_version_major}%{llvm_version_minor}/utils/not/not.cpp
Patch0: 0001-Make-KLEE-compile-against-LLVM-3.5-and-3.6.patch
Patch1: 0002-Make-KLEE-compile-against-LLVM-3.7.patch
Patch2: 0003-Make-KLEE-compile-against-LLVM-3.8.patch
Patch3: 0001-test-add-versions-of-some-tests-for-LLVM-3.8.patch
@@ -67,7 +66,6 @@ information on what KLEE is and what it can do, see the OSDI 2008 paper.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1