From 611b54d7539ec402a23c13e7051fd90752e56f51bb98b3878b7f3554ff9fed1f Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Fri, 21 Sep 2018 11:28:25 +0000 Subject: [PATCH] up to 1.4.0+20180920 OBS-URL: https://build.opensuse.org/package/show/devel:tools:statica/klee?expand=0&rev=56 --- ...m-make-KLEE-compile-against-LLVM-3.9.patch | 295 ------------------ 0001-llvm5-avoid-on-function-arg_begin.patch | 36 +++ ...m-fix-libraries-with-llvm-config-3.9.patch | 38 --- ...erPartWidth-is-from-llvm-APFloatBase.patch | 4 +- ...EE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch | 33 -- ...andle-getOrInsertFunction-terminator.patch | 22 +- ...llvm40-handle-different-header-names.patch | 88 ------ ...t-case-functions-now-return-pointers.patch | 6 +- ...at-members-are-functions-in-LLVM-4.0.patch | 39 --- ...vm5-handle-new-file_magic-s-location.patch | 10 +- 0006-llvm40-errorOr-and-similar.patch | 53 ---- ...eArrayRef-for-APFloat-convertToInteg.patch | 12 +- ...lvm-use-chrono-helpers-from-LLVM-4.0.patch | 199 ------------ ...insic-objectsize-has-three-arguments.patch | 10 +- ...Type-is-not-SequentialType-in-LLVM-4.patch | 71 ----- ...=> 0008-llvm5-test-change-objectsize.patch | 4 +- ...40-gep_type_iterator-has-no-operator.patch | 32 -- ...m5-test-add-disable-O0-optnone-to-O0.patch | 70 ++--- ...lSite.paramHasAttr-is-indexed-from-0.patch | 6 +- 0010-llvm50-avoid-on-function-arg_begin.patch | 50 --- ...sionPrinter-now-passes-down-a-stream.patch | 2 +- ...> 0012-llvm6-handle-headers-renaming.patch | 2 +- ...lvm50-AllocaInst-takes-address-space.patch | 39 --- _servicedata | 2 +- klee-1.4.0+20180829.tar.xz | 3 - klee-1.4.0+20180920.tar.xz | 3 + klee.changes | 69 ++++ klee.spec | 38 +-- 28 files changed, 189 insertions(+), 1047 deletions(-) delete mode 100644 0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch create mode 100644 0001-llvm5-avoid-on-function-arg_begin.patch delete mode 100644 0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch rename 0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch => 0002-llvm5-integerPartWidth-is-from-llvm-APFloatBase.patch (93%) delete mode 100644 0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch rename 0012-llvm50-handle-getOrInsertFunction-terminator.patch => 0003-llvm5-handle-getOrInsertFunction-terminator.patch (75%) delete mode 100644 0004-llvm40-handle-different-header-names.patch rename 0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch => 0004-llvm5-SwitchInst-case-functions-now-return-pointers.patch (92%) delete mode 100644 0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch rename 0014-llvm50-handle-new-file_magic-s-location.patch => 0005-llvm5-handle-new-file_magic-s-location.patch (89%) delete mode 100644 0006-llvm40-errorOr-and-similar.patch rename 0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch => 0006-llvm5-use-MutableArrayRef-for-APFloat-convertToInteg.patch (82%) delete mode 100644 0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch rename 0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch => 0007-llvm5-Intrinsic-objectsize-has-three-arguments.patch (89%) delete mode 100644 0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch rename 0018-llvm50-test-change-objectsize.patch => 0008-llvm5-test-change-objectsize.patch (98%) delete mode 100644 0009-llvm40-gep_type_iterator-has-no-operator.patch rename 0019-llvm50-test-add-disable-O0-optnone-to-O0.patch => 0009-llvm5-test-add-disable-O0-optnone-to-O0.patch (98%) rename 0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch => 0010-llvm5-CallSite.paramHasAttr-is-indexed-from-0.patch (93%) delete mode 100644 0010-llvm50-avoid-on-function-arg_begin.patch rename 0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch => 0011-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch (99%) rename 0022-llvm6-handle-headers-renaming.patch => 0012-llvm6-handle-headers-renaming.patch (99%) delete mode 100644 0016-llvm50-AllocaInst-takes-address-space.patch delete mode 100644 klee-1.4.0+20180829.tar.xz create mode 100644 klee-1.4.0+20180920.tar.xz diff --git a/0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch b/0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch deleted file mode 100644 index be7d5e9..0000000 --- a/0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch +++ /dev/null @@ -1,295 +0,0 @@ -From: Jiri Slaby -Date: Wed, 22 Feb 2017 15:57:55 +0100 -Subject: llvm: make KLEE compile against LLVM 3.9 -Patch-mainline: no - -Signed-off-by: Jiri Slaby ---- - lib/Core/Executor.cpp | 16 ++++++++++++++++ - lib/Core/MemoryManager.cpp | 5 ++++- - lib/Module/ModuleUtil.cpp | 33 ++++++++++++++++++++++++++++++--- - lib/Module/Optimize.cpp | 34 ++++++++++++++++++++++++++++++++++ - lib/Module/RaiseAsm.cpp | 10 +++++++++- - tools/kleaver/main.cpp | 4 ++++ - tools/klee/main.cpp | 4 ++++ - 7 files changed, 101 insertions(+), 5 deletions(-) - -diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index b053d4882431..7f69a618b8ec 100644 ---- a/lib/Core/Executor.cpp -+++ b/lib/Core/Executor.cpp -@@ -1338,10 +1338,18 @@ void Executor::executeCall(ExecutionState &state, - // - // Alignment requirements for scalar types is the same as their size - if (argWidth > Expr::Int64) { -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ size = llvm::alignTo(size, 16); -+#else - size = llvm::RoundUpToAlignment(size, 16); -+#endif - requires16ByteAlignment = true; - } -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ size += llvm::alignTo(argWidth, WordSize) / 8; -+#else - size += llvm::RoundUpToAlignment(argWidth, WordSize) / 8; -+#endif - } - } - -@@ -1374,10 +1382,18 @@ void Executor::executeCall(ExecutionState &state, - - Expr::Width argWidth = arguments[i]->getWidth(); - if (argWidth > Expr::Int64) { -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ offset = llvm::alignTo(offset, 16); -+#else - offset = llvm::RoundUpToAlignment(offset, 16); -+#endif - } - os->write(offset, arguments[i]); -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ offset += llvm::alignTo(argWidth, WordSize) / 8; -+#else - offset += llvm::RoundUpToAlignment(argWidth, WordSize) / 8; -+#endif - } - } - } -diff --git a/lib/Core/MemoryManager.cpp b/lib/Core/MemoryManager.cpp -index 24e2ed97581f..f40e8bc9deb8 100644 ---- a/lib/Core/MemoryManager.cpp -+++ b/lib/Core/MemoryManager.cpp -@@ -111,9 +111,12 @@ MemoryObject *MemoryManager::allocate(uint64_t size, bool isLocal, - - uint64_t address = 0; - if (DeterministicAllocation) { -- -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ address = llvm::alignTo((uint64_t)nextFreeSlot + alignment - 1, alignment); -+#else - address = llvm::RoundUpToAlignment((uint64_t)nextFreeSlot + alignment - 1, - alignment); -+#endif - - // Handle the case of 0-sized allocations as 1-byte allocations. - // This way, we make sure we have this allocation between its own red zones -diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index 5ca0a55b12d2..0e87b5a6deca 100644 ---- a/lib/Module/ModuleUtil.cpp -+++ b/lib/Module/ModuleUtil.cpp -@@ -284,7 +284,11 @@ Function *klee::getDirectCallTarget(CallSite cs, bool moduleIsFullyLinked) { - if (Function *f = dyn_cast(v)) { - return f; - } else if (llvm::GlobalAlias *ga = dyn_cast(v)) { -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ if (moduleIsFullyLinked || !(ga->isInterposable())) { -+#else - if (moduleIsFullyLinked || !(ga->mayBeOverridden())) { -+#endif - v = ga->getAliasee(); - } else { - v = NULL; -@@ -393,7 +397,13 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, - } - - if (magic == sys::fs::file_magic::archive) { --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ Expected > archOwner = -+ object::createBinary(Buffer, &context); -+ if (!archOwner) -+ ec = errorToErrorCode(archOwner.takeError()); -+ llvm::object::Binary *arch = archOwner.get().get(); -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) - ErrorOr> archOwner = - object::createBinary(Buffer, &context); - ec = archOwner.getError(); -@@ -414,7 +424,12 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, - - if (auto archive = dyn_cast(arch)) { - // Load all bitcode files into memory --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ Error Err; -+ for (object::Archive::child_iterator AI = archive->child_begin(Err), -+ AE = archive->child_end(); -+ AI != AE; ++AI) -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) - for (object::Archive::child_iterator AI = archive->child_begin(), - AE = archive->child_end(); - AI != AE; ++AI) -@@ -455,7 +470,12 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, - return false; - } - --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ Expected > child = -+ childOrErr->getAsBinary(); -+ if (!child) -+ ec = errorToErrorCode(child.takeError()); -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) - ErrorOr> child = - childOrErr->getAsBinary(); - ec = child.getError(); -@@ -519,7 +539,14 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, - return false; - } - } -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ if (Err) { -+ errorMsg = "Cannot iterate over archive"; -+ return false; -+ } -+#endif - } -+ - return true; - } - if (magic.is_object()) { -diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp -index c788ee36cadb..34af46262080 100644 ---- a/lib/Module/Optimize.cpp -+++ b/lib/Module/Optimize.cpp -@@ -39,6 +39,11 @@ - #include "llvm/Analysis/GlobalsModRef.h" - #endif - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+#include "llvm/Transforms/IPO/FunctionAttrs.h" -+#include "llvm/Transforms/Scalar/GVN.h" -+#endif -+ - using namespace llvm; - - // Don't verify at the end -@@ -107,7 +112,11 @@ static void AddStandardCompilePasses(klee::LegacyLLVMPassManagerTy &PM) { - - addPass(PM, createPruneEHPass()); // Remove dead EH info - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ addPass(PM, createPostOrderFunctionAttrsLegacyPass()); -+#else - addPass(PM, createPostOrderFunctionAttrsPass()); -+#endif - addPass(PM, createReversePostOrderFunctionAttrsPass()); // Deduce function attrs - #else - addPass(PM, createFunctionAttrsPass()); // Deduce function attrs -@@ -120,7 +129,11 @@ static void AddStandardCompilePasses(klee::LegacyLLVMPassManagerTy &PM) { - addPass(PM, createInstructionCombiningPass()); // Cleanup for scalarrepl. - addPass(PM, createJumpThreadingPass()); // Thread jumps. - addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ addPass(PM, createSROAPass()); // Break up aggregate allocas -+#else - addPass(PM, createScalarReplAggregatesPass()); // Break up aggregate allocas -+#endif - addPass(PM, createInstructionCombiningPass()); // Combine silly seq's - - addPass(PM, createTailCallEliminationPass()); // Eliminate tail calls -@@ -183,7 +196,20 @@ void Optimize(Module *M, llvm::ArrayRef preservedFunctions) { - // for a main function. If main is defined, mark all other functions - // internal. - if (!DisableInternalize) { -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ auto PreserveFunctions = [=](const GlobalValue &GV) { -+ StringRef GVName = GV.getName(); -+ -+ for (const char *fun: preservedFunctions) -+ if (GVName.equals(fun)) -+ return true; -+ -+ return false; -+ }; -+ ModulePass *pass = createInternalizePass(PreserveFunctions); -+#else - ModulePass *pass = createInternalizePass(preservedFunctions); -+#endif - addPass(Passes, pass); - } - -@@ -222,11 +248,19 @@ void Optimize(Module *M, llvm::ArrayRef preservedFunctions) { - // The IPO passes may leave cruft around. Clean up after them. - addPass(Passes, createInstructionCombiningPass()); - addPass(Passes, createJumpThreadingPass()); // Thread jumps. -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ addPass(Passes, createSROAPass()); // Break up allocas -+#else - addPass(Passes, createScalarReplAggregatesPass()); // Break up allocas -+#endif - - // Run a few AA driven optimizations here and now, to cleanup the code. - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ addPass(Passes, createPostOrderFunctionAttrsLegacyPass()); -+#else - addPass(Passes, createPostOrderFunctionAttrsPass()); -+#endif - addPass(Passes, createReversePostOrderFunctionAttrsPass()); // Add nocapture - addPass(Passes, createGlobalsAAWrapperPass()); // IP alias analysis - #else -diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp -index c597fa2a7b82..4967a2fa8578 100644 ---- a/lib/Module/RaiseAsm.cpp -+++ b/lib/Module/RaiseAsm.cpp -@@ -60,7 +60,11 @@ bool RaiseAsmPass::runOnInstruction(Module &M, Instruction *I) { - - if (ia->getAsmString() == "" && ia->hasSideEffects()) { - IRBuilder<> Builder(I); -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ Builder.CreateFence(llvm::AtomicOrdering::SequentiallyConsistent); -+#else - Builder.CreateFence(llvm::SequentiallyConsistent); -+#endif - I->eraseFromParent(); - return true; - } -@@ -81,7 +85,11 @@ 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, 7) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ TM = NativeTarget->createTargetMachine(HostTriple, "", "", TargetOptions(), -+ None); -+ TLI = TM->getSubtargetImpl(*(M.begin()))->getTargetLowering(); -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) - TM = NativeTarget->createTargetMachine(HostTriple, "", "", TargetOptions()); - TLI = TM->getSubtargetImpl(*(M.begin()))->getTargetLowering(); - #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) -diff --git a/tools/kleaver/main.cpp b/tools/kleaver/main.cpp -index b8b32e31264a..800cece95e9c 100644 ---- a/tools/kleaver/main.cpp -+++ b/tools/kleaver/main.cpp -@@ -400,7 +400,11 @@ static bool printInputAsSMTLIBv2(const char *Filename, - int main(int argc, char **argv) { - bool success = true; - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ llvm::sys::PrintStackTraceOnErrorSignal(argv[0]); -+#else - llvm::sys::PrintStackTraceOnErrorSignal(); -+#endif - llvm::cl::SetVersionPrinter(klee::printVersion); - llvm::cl::ParseCommandLineOptions(argc, argv); - -diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index c655aa560f62..7be5f07cdc0e 100644 ---- a/tools/klee/main.cpp -+++ b/tools/klee/main.cpp -@@ -1092,7 +1092,11 @@ int main(int argc, char **argv, char **envp) { - llvm::InitializeNativeTarget(); - - parseArguments(argc, argv); -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ sys::PrintStackTraceOnErrorSignal(argv[0]); -+#else - sys::PrintStackTraceOnErrorSignal(); -+#endif - - if (Watchdog) { - if (MaxTime==0) { --- -2.18.0 - diff --git a/0001-llvm5-avoid-on-function-arg_begin.patch b/0001-llvm5-avoid-on-function-arg_begin.patch new file mode 100644 index 0000000..43f1e4b --- /dev/null +++ b/0001-llvm5-avoid-on-function-arg_begin.patch @@ -0,0 +1,36 @@ +From: Jiri Slaby +Date: Mon, 15 Jan 2018 10:35:19 +0100 +Subject: llvm5: avoid ++ on function->arg_begin() +Patch-mainline: no + +Starting with llvm 5, arguments of a function are not an iterator, but +an array. So they cannot be incremented in-place. Add a local auto +variable and increment that. + +Otherwise we see: +../tools/klee/main.cpp:661:23: error: expression is not assignable + Value *oldArgv = &*(++mainFn->arg_begin()); + ^ ~~~~~~~~~~~~~~~~~~~ + +Signed-off-by: Jiri Slaby +--- + tools/klee/main.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp +index 1de5fbeb7e0e..3be619138bd6 100644 +--- a/tools/klee/main.cpp ++++ b/tools/klee/main.cpp +@@ -1036,7 +1036,8 @@ createLibCWrapper(std::vector> &modules, + args.push_back( + llvm::ConstantExpr::getBitCast(inModuleRefernce, ft->getParamType(0))); + args.push_back(&*(stub->arg_begin())); // argc +- args.push_back(&*(++stub->arg_begin())); // argv ++ auto arg_it = stub->arg_begin(); ++ args.push_back(&*(++arg_it)); // argv + args.push_back(Constant::getNullValue(ft->getParamType(3))); // app_init + args.push_back(Constant::getNullValue(ft->getParamType(4))); // app_fini + args.push_back(Constant::getNullValue(ft->getParamType(5))); // rtld_fini +-- +2.19.0 + diff --git a/0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch b/0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch deleted file mode 100644 index b603cd0..0000000 --- a/0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch +++ /dev/null @@ -1,38 +0,0 @@ -From: Jiri Slaby -Date: Fri, 25 May 2018 15:17:03 +0200 -Subject: cmake: find_llvm, fix libraries with llvm-config 3.9 -Patch-mainline: no - -llvm-config from llvm 3.9 was broken. Fix handling of improperly -returned libraries. -From: -liblibLLVM-3.9.so.so -To: -libLLVM-3.9.so - -Fixes #895. - -Signed-off-by: Jiri Slaby ---- - cmake/find_llvm.cmake | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/cmake/find_llvm.cmake b/cmake/find_llvm.cmake -index adf68c4fc82a..8ceed19f7b9e 100644 ---- a/cmake/find_llvm.cmake -+++ b/cmake/find_llvm.cmake -@@ -172,7 +172,11 @@ else() - set(targets_to_return "") - set(created_targets "") - foreach (llvm_lib ${_llvm_libs_list}) -+ # a bug in llvm-config from LLVM 3.9 -+ string(REGEX REPLACE "lib(libLLVM[-.a-zA-Z0-9]+\\.so)\\.so$" "\\1" llvm_lib "${llvm_lib}") -+ - get_filename_component(llvm_lib_file_name "${llvm_lib}" NAME) -+ - string(REGEX REPLACE "^(lib)?(LLVM[-.a-zA-Z0-9]+)\\..+$" "\\2" target_name "${llvm_lib_file_name}") - list(APPEND targets_to_return "${target_name}") - if (NOT TARGET "${target_name}") --- -2.18.0 - diff --git a/0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch b/0002-llvm5-integerPartWidth-is-from-llvm-APFloatBase.patch similarity index 93% rename from 0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch rename to 0002-llvm5-integerPartWidth-is-from-llvm-APFloatBase.patch index 2469674..686676c 100644 --- a/0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch +++ b/0002-llvm5-integerPartWidth-is-from-llvm-APFloatBase.patch @@ -1,6 +1,6 @@ From: Jiri Slaby Date: Mon, 15 Jan 2018 10:09:20 +0100 -Subject: llvm50: integerPartWidth is from llvm::APFloatBase +Subject: llvm5: integerPartWidth is from llvm::APFloatBase Patch-mainline: no Otherwise we see: @@ -28,5 +28,5 @@ index a5c7f652e976..65e858c3336d 100644 } } -- -2.18.0 +2.19.0 diff --git a/0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch b/0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch deleted file mode 100644 index c95cca2..0000000 --- a/0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch +++ /dev/null @@ -1,33 +0,0 @@ -From: Jiri Slaby -Date: Fri, 20 Jul 2018 09:34:51 +0200 -Subject: llvm39: switch KLEE_RUNTIME_BUILD_TYPE to Debug+Asserts -Patch-mainline: no - -So that we do not optimize the library during build. It should be -optimized only on runtime, depending on the -optimize parameter. - -It could cause various failures like: -inlinable function call in a function with debug info must have a !dbg location - call void @klee_overshift_check(i64 64, i64 %int_cast_to_i64) - -Signed-off-by: Jiri Slaby ---- - CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c34b8786f313..961ab19d75df 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -520,7 +520,7 @@ set(available_klee_runtime_build_types - if (NOT KLEE_RUNTIME_BUILD_TYPE) - message(STATUS "KLEE_RUNTIME_BUILD_TYPE is not set. Setting default") - message(STATUS "The available runtime build types are: ${available_klee_runtime_build_types}") -- set(KLEE_RUNTIME_BUILD_TYPE "Release+Debug+Asserts" CACHE String -+ set(KLEE_RUNTIME_BUILD_TYPE "Debug+Asserts" CACHE String - "Options are ${available_klee_runtime_build_types}" - FORCE) - endif() --- -2.18.0 - diff --git a/0012-llvm50-handle-getOrInsertFunction-terminator.patch b/0003-llvm5-handle-getOrInsertFunction-terminator.patch similarity index 75% rename from 0012-llvm50-handle-getOrInsertFunction-terminator.patch rename to 0003-llvm5-handle-getOrInsertFunction-terminator.patch index d1b5ddd..0b31945 100644 --- a/0012-llvm50-handle-getOrInsertFunction-terminator.patch +++ b/0003-llvm5-handle-getOrInsertFunction-terminator.patch @@ -1,6 +1,6 @@ From: Jiri Slaby Date: Mon, 15 Jan 2018 10:27:54 +0100 -Subject: llvm50: handle getOrInsertFunction terminator +Subject: llvm5: handle getOrInsertFunction terminator Patch-mainline: no llvm 5 does not terminate getOrInsertFunction parameters with NULL, take @@ -13,8 +13,7 @@ Signed-off-by: Jiri Slaby include/klee/Config/Version.h | 6 ++++++ lib/Module/Checks.cpp | 8 ++++---- lib/Module/IntrinsicCleaner.cpp | 3 ++- - tools/klee/main.cpp | 4 ++-- - 4 files changed, 14 insertions(+), 7 deletions(-) + 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/klee/Config/Version.h b/include/klee/Config/Version.h index 532051602fe3..a02ce28baaae 100644 @@ -71,21 +70,6 @@ index c48952c28004..ab16a2654492 100644 F->setDoesNotReturn(); F->setDoesNotThrow(); -diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index 883be83a4130..c0805f457717 100644 ---- a/tools/klee/main.cpp -+++ b/tools/klee/main.cpp -@@ -675,8 +675,8 @@ static void initEnv(Module *mainModule) { - cast(mainModule->getOrInsertFunction("klee_init_env", - Type::getVoidTy(ctx), - argcPtr->getType(), -- argvPtr->getType(), -- NULL)); -+ argvPtr->getType() -+ KLEE_LLVM_GOIF_TERMINATOR)); - assert(initEnvFn); - std::vector args; - args.push_back(argcPtr); -- -2.18.0 +2.19.0 diff --git a/0004-llvm40-handle-different-header-names.patch b/0004-llvm40-handle-different-header-names.patch deleted file mode 100644 index 75265ad..0000000 --- a/0004-llvm40-handle-different-header-names.patch +++ /dev/null @@ -1,88 +0,0 @@ -From: Jiri Slaby -Date: Wed, 7 Jun 2017 14:57:45 +0200 -Subject: llvm40: handle different header names -Patch-mainline: no - -LLVM 4.0 renamed and split some headers. Take this into account in -includes. - -Signed-off-by: Jiri Slaby ---- - lib/Module/KModule.cpp | 4 ++++ - lib/Module/ModuleUtil.cpp | 9 ++++++++- - tools/klee/main.cpp | 7 ++++++- - 3 files changed, 18 insertions(+), 2 deletions(-) - -diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp -index 74d91a8f0122..c041be10313c 100644 ---- a/lib/Module/KModule.cpp -+++ b/lib/Module/KModule.cpp -@@ -21,7 +21,11 @@ - #include "klee/Internal/Support/Debug.h" - #include "klee/Internal/Support/ModuleUtil.h" - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+#include "llvm/Bitcode/BitcodeWriter.h" -+#else - #include "llvm/Bitcode/ReaderWriter.h" -+#endif - #include "llvm/IR/DataLayout.h" - #include "llvm/IR/IRBuilder.h" - #include "llvm/IR/Instructions.h" -diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index 0e87b5a6deca..c2792454d904 100644 ---- a/lib/Module/ModuleUtil.cpp -+++ b/lib/Module/ModuleUtil.cpp -@@ -24,7 +24,9 @@ - #include "llvm/Object/Archive.h" - #include "llvm/Object/Error.h" - #include "llvm/Object/ObjectFile.h" -+#if LLVM_VERSION_CODE < LLVM_VERSION(4, 0) - #include "llvm/Support/DataStream.h" -+#endif - #include "llvm/Support/FileSystem.h" - #include "llvm/Support/SourceMgr.h" - -@@ -43,8 +45,13 @@ - #include "llvm/IR/DiagnosticPrinter.h" - #endif - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+#include -+#else -+#include -+#endif -+ - #include "llvm/Analysis/ValueTracking.h" --#include "llvm/Bitcode/ReaderWriter.h" - #include "llvm/Support/MemoryBuffer.h" - #include "llvm/Support/raw_ostream.h" - #include "llvm/Support/Path.h" -diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index 7be5f07cdc0e..c7dc517a8eee 100644 ---- a/tools/klee/main.cpp -+++ b/tools/klee/main.cpp -@@ -23,7 +23,6 @@ - #include "klee/Interpreter.h" - #include "klee/Statistics.h" - --#include "llvm/Bitcode/ReaderWriter.h" - #include "llvm/IR/Constants.h" - #include "llvm/IR/IRBuilder.h" - #include "llvm/IR/InstrTypes.h" -@@ -46,6 +45,12 @@ - #include "llvm/Support/system_error.h" - #endif - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+#include -+#else -+#include -+#endif -+ - #include - #include - #include --- -2.18.0 - diff --git a/0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch b/0004-llvm5-SwitchInst-case-functions-now-return-pointers.patch similarity index 92% rename from 0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch rename to 0004-llvm5-SwitchInst-case-functions-now-return-pointers.patch index d8dfb78..3a485c8 100644 --- a/0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch +++ b/0004-llvm5-SwitchInst-case-functions-now-return-pointers.patch @@ -1,6 +1,6 @@ From: Jiri Slaby Date: Mon, 15 Jan 2018 10:38:35 +0100 -Subject: llvm50: SwitchInst case functions now return pointers +Subject: llvm5: SwitchInst case functions now return pointers Patch-mainline: no Starting llvm 5, SwitchInst->findCaseValue() now has to be dereferenced @@ -15,7 +15,7 @@ Signed-off-by: Jiri Slaby 1 file changed, 4 insertions(+) diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index 51d36b352e5c..75af0fd09bd8 100644 +index 04fd6941d34a..64d0f66e4073 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -1673,7 +1673,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { @@ -31,5 +31,5 @@ index 51d36b352e5c..75af0fd09bd8 100644 } else { // Handle possible different branch targets -- -2.18.0 +2.19.0 diff --git a/0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch b/0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch deleted file mode 100644 index bf1ce84..0000000 --- a/0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch +++ /dev/null @@ -1,39 +0,0 @@ -From: Jiri Slaby -Date: Wed, 7 Jun 2017 14:54:32 +0200 -Subject: llvm: APFloat members are functions in LLVM 4.0 -Patch-mainline: no - -Signed-off-by: Jiri Slaby ---- - lib/Core/Executor.cpp | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index 7f69a618b8ec..1a5b7b9df527 100644 ---- a/lib/Core/Executor.cpp -+++ b/lib/Core/Executor.cpp -@@ -1480,12 +1480,21 @@ static bool isDebugIntrinsic(const Function *f, KModule *KM) { - - static inline const llvm::fltSemantics * fpWidthToSemantics(unsigned width) { - switch(width) { -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ case Expr::Int32: -+ return &llvm::APFloat::IEEEsingle(); -+ case Expr::Int64: -+ return &llvm::APFloat::IEEEdouble(); -+ case Expr::Fl80: -+ return &llvm::APFloat::x87DoubleExtended(); -+#else - case Expr::Int32: - return &llvm::APFloat::IEEEsingle; - case Expr::Int64: - return &llvm::APFloat::IEEEdouble; - case Expr::Fl80: - return &llvm::APFloat::x87DoubleExtended; -+#endif - default: - return 0; - } --- -2.18.0 - diff --git a/0014-llvm50-handle-new-file_magic-s-location.patch b/0005-llvm5-handle-new-file_magic-s-location.patch similarity index 89% rename from 0014-llvm50-handle-new-file_magic-s-location.patch rename to 0005-llvm5-handle-new-file_magic-s-location.patch index ac521e2..92051f8 100644 --- a/0014-llvm50-handle-new-file_magic-s-location.patch +++ b/0005-llvm5-handle-new-file_magic-s-location.patch @@ -1,6 +1,6 @@ From: Jiri Slaby Date: Mon, 15 Jan 2018 10:42:53 +0100 -Subject: llvm50: handle new file_magic's location +Subject: llvm5: handle new file_magic's location Patch-mainline: no llvm 5, moved file_magic to BinaryFormat in commit @@ -12,7 +12,7 @@ Signed-off-by: Jiri Slaby 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index 7f4bdb49380a..f1dbdb13bcff 100644 +index bfec9e7dc7ff..ecc114460a3f 100644 --- a/lib/Module/ModuleUtil.cpp +++ b/lib/Module/ModuleUtil.cpp @@ -14,6 +14,9 @@ @@ -25,7 +25,7 @@ index 7f4bdb49380a..f1dbdb13bcff 100644 #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, +@@ -381,13 +384,19 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, MemoryBuffer *Buffer = bufferErr->get(); #endif @@ -46,7 +46,7 @@ index 7f4bdb49380a..f1dbdb13bcff 100644 SMDiagnostic Err; #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) std::unique_ptr module(parseIR(Buffer, Err, context)); -@@ -403,7 +412,11 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, +@@ -404,7 +413,11 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, return true; } @@ -59,5 +59,5 @@ index 7f4bdb49380a..f1dbdb13bcff 100644 Expected > archOwner = object::createBinary(Buffer, &context); -- -2.18.0 +2.19.0 diff --git a/0006-llvm40-errorOr-and-similar.patch b/0006-llvm40-errorOr-and-similar.patch deleted file mode 100644 index 6ec7328..0000000 --- a/0006-llvm40-errorOr-and-similar.patch +++ /dev/null @@ -1,53 +0,0 @@ -From: Jiri Slaby -Date: Wed, 7 Jun 2017 14:58:29 +0200 -Subject: llvm40: errorOr and similar -Patch-mainline: no - -Signed-off-by: Jiri Slaby ---- - lib/Module/ModuleUtil.cpp | 13 +++++++++++-- - 1 file changed, 11 insertions(+), 2 deletions(-) - -diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index c2792454d904..7f4bdb49380a 100644 ---- a/lib/Module/ModuleUtil.cpp -+++ b/lib/Module/ModuleUtil.cpp -@@ -432,7 +432,7 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, - if (auto archive = dyn_cast(arch)) { - // Load all bitcode files into memory - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -- Error Err; -+ Error Err = Error::success(); - for (object::Archive::child_iterator AI = archive->child_begin(Err), - AE = archive->child_end(); - AI != AE; ++AI) -@@ -460,8 +460,14 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, - #else - object::Archive::child_iterator childOrErr = AI; - #endif -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ Expected memberNameErr = childOrErr->getName(); -+ ec = memberNameErr ? std::error_code() : -+ errorToErrorCode(memberNameErr.takeError()); -+#else - ErrorOr memberNameErr = childOrErr->getName(); - ec = memberNameErr.getError(); -+#endif - if (!ec) { - memberName = memberNameErr.get(); - #else -@@ -492,7 +498,10 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, - #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) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ Expected buff = childOrErr->getMemoryBufferRef(); -+ ec = buff ? std::error_code() : errorToErrorCode(buff.takeError()); -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) - ErrorOr buff = childOrErr->getMemoryBufferRef(); - ec = buff.getError(); - #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) --- -2.18.0 - diff --git a/0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch b/0006-llvm5-use-MutableArrayRef-for-APFloat-convertToInteg.patch similarity index 82% rename from 0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch rename to 0006-llvm5-use-MutableArrayRef-for-APFloat-convertToInteg.patch index e049913..639c0c5 100644 --- a/0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch +++ b/0006-llvm5-use-MutableArrayRef-for-APFloat-convertToInteg.patch @@ -1,9 +1,9 @@ From: Jiri Slaby Date: Mon, 15 Jan 2018 11:07:47 +0100 -Subject: llvm50: use MutableArrayRef for APFloat::convertToInteger +Subject: llvm5: use MutableArrayRef for APFloat::convertToInteger Patch-mainline: no -in llvm 5, since commit 957caa243d9270df37a566aedae3f1244e7b62ef, the +In llvm 5, since commit 957caa243d9270df37a566aedae3f1244e7b62ef, the first parameter to APFloat::convertToInteger is MutableArrayRef. So handle that. @@ -13,7 +13,7 @@ Signed-off-by: Jiri Slaby 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index 75af0fd09bd8..46fd2be42351 100644 +index 64d0f66e4073..b5d7e6ce8f6c 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -2326,7 +2326,12 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { @@ -22,7 +22,7 @@ index 75af0fd09bd8..46fd2be42351 100644 bool isExact = true; - Arg.convertToInteger(&value, resultType, false, +#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) -+ MutableArrayRef valueRef = makeMutableArrayRef(value); ++ auto valueRef = makeMutableArrayRef(value); +#else + uint64_t *valueRef = &value; +#endif @@ -36,7 +36,7 @@ index 75af0fd09bd8..46fd2be42351 100644 bool isExact = true; - Arg.convertToInteger(&value, resultType, true, +#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) -+ MutableArrayRef valueRef = makeMutableArrayRef(value); ++ auto valueRef = makeMutableArrayRef(value); +#else + uint64_t *valueRef = &value; +#endif @@ -45,5 +45,5 @@ index 75af0fd09bd8..46fd2be42351 100644 bindLocal(ki, state, ConstantExpr::alloc(value, resultType)); break; -- -2.18.0 +2.19.0 diff --git a/0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch b/0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch deleted file mode 100644 index 4556bdd..0000000 --- a/0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch +++ /dev/null @@ -1,199 +0,0 @@ -From: Jiri Slaby -Date: Wed, 7 Jun 2017 13:36:28 +0200 -Subject: llvm: use chrono helpers from LLVM 4.0 -Patch-mainline: no - -LLVM 4.0 removes the old time interface and starts using the C++11's -chrono. So switch to that in klee for LLVM 4.0 too. - -Signed-off-by: Jiri Slaby ---- - include/klee/Internal/Support/Timer.h | 8 +++++++ - include/klee/Internal/System/Time.h | 11 +++++++++ - lib/Core/StatsTracker.cpp | 24 ++++++++++++++++++++ - lib/Support/Time.cpp | 32 +++++++++++++++++++++++++++ - lib/Support/Timer.cpp | 16 ++++++++++++++ - 5 files changed, 91 insertions(+) - -diff --git a/include/klee/Internal/Support/Timer.h b/include/klee/Internal/Support/Timer.h -index a422abd027f3..d80ccb31f647 100644 ---- a/include/klee/Internal/Support/Timer.h -+++ b/include/klee/Internal/Support/Timer.h -@@ -12,9 +12,17 @@ - - #include - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+#include -+#endif -+ - namespace klee { - class WallTimer { -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ llvm::sys::TimePoint<> start; -+#else - uint64_t startMicroseconds; -+#endif - - public: - WallTimer(); -diff --git a/include/klee/Internal/System/Time.h b/include/klee/Internal/System/Time.h -index 220e260c975e..12522c866439 100644 ---- a/include/klee/Internal/System/Time.h -+++ b/include/klee/Internal/System/Time.h -@@ -10,7 +10,13 @@ - #ifndef KLEE_UTIL_TIME_H - #define KLEE_UTIL_TIME_H - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+#include -+ -+#include "llvm/Support/Chrono.h" -+#else - #include "llvm/Support/TimeValue.h" -+#endif - - namespace klee { - namespace util { -@@ -22,7 +28,12 @@ namespace klee { - double getWallTime(); - - /// Wall time as TimeValue object. -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ double durationToDouble(std::chrono::nanoseconds dur); -+ llvm::sys::TimePoint<> getWallTimeVal(); -+#else - llvm::sys::TimeValue getWallTimeVal(); -+#endif - } - } - -diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp -index 97e7fccb5e3c..ecf90bd0126a 100644 ---- a/lib/Core/StatsTracker.cpp -+++ b/lib/Core/StatsTracker.cpp -@@ -285,6 +285,29 @@ void StatsTracker::done() { - void StatsTracker::stepInstruction(ExecutionState &es) { - if (OutputIStats) { - if (TrackInstructionTime) { -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ static sys::TimePoint<> lastNowTime; -+ static std::chrono::nanoseconds lastUserTime(0); -+ -+ if (lastUserTime.count() == 0) { -+ std::chrono::nanoseconds sys; -+ sys::Process::GetTimeUsage(lastNowTime, lastUserTime, sys); -+ } else { -+ sys::TimePoint<> now; -+ std::chrono::nanoseconds user, sys; -+ -+ sys::Process::GetTimeUsage(now, user, sys); -+ -+ std::chrono::microseconds delta = -+ std::chrono::duration_cast(user - lastUserTime); -+ std::chrono::microseconds deltaNow = -+ std::chrono::duration_cast(now - lastNowTime); -+ stats::instructionTime += delta.count(); -+ stats::instructionRealTime += deltaNow.count(); -+ lastUserTime = user; -+ lastNowTime = now; -+ } -+#else - static sys::TimeValue lastNowTime(0,0),lastUserTime(0,0); - - if (lastUserTime.seconds()==0 && lastUserTime.nanoseconds()==0) { -@@ -300,6 +323,7 @@ void StatsTracker::stepInstruction(ExecutionState &es) { - lastUserTime = user; - lastNowTime = now; - } -+#endif - } - - Instruction *inst = es.pc->inst; -diff --git a/lib/Support/Time.cpp b/lib/Support/Time.cpp -index be5eaf186958..f508e6fa1bcb 100644 ---- a/lib/Support/Time.cpp -+++ b/lib/Support/Time.cpp -@@ -10,12 +10,43 @@ - #include "klee/Config/Version.h" - #include "klee/Internal/System/Time.h" - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+#include -+ -+#include -+#else - #include "llvm/Support/TimeValue.h" -+#endif -+ - #include "llvm/Support/Process.h" - - using namespace llvm; - using namespace klee; - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+double util::durationToDouble(std::chrono::nanoseconds dur) -+{ -+ return dur.count() / 1e9; -+} -+ -+double util::getUserTime() { -+ sys::TimePoint<> now; -+ std::chrono::nanoseconds user, sys; -+ -+ sys::Process::GetTimeUsage(now, user, sys); -+ -+ return durationToDouble(user); -+} -+ -+double util::getWallTime() { -+ return durationToDouble(getWallTimeVal().time_since_epoch()); -+} -+ -+sys::TimePoint<> util::getWallTimeVal() { -+ return std::chrono::system_clock::now(); -+} -+ -+#else - double util::getUserTime() { - sys::TimeValue now(0,0),user(0,0),sys(0,0); - sys::Process::GetTimeUsage(now,user,sys); -@@ -30,3 +61,4 @@ double util::getWallTime() { - sys::TimeValue util::getWallTimeVal() { - return sys::TimeValue::now(); - } -+#endif -diff --git a/lib/Support/Timer.cpp b/lib/Support/Timer.cpp -index da96981079ae..a223b39ada57 100644 ---- a/lib/Support/Timer.cpp -+++ b/lib/Support/Timer.cpp -@@ -15,6 +15,20 @@ - using namespace klee; - using namespace llvm; - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ -+WallTimer::WallTimer() { -+ start = util::getWallTimeVal(); -+} -+ -+uint64_t WallTimer::check() { -+ sys::TimePoint<> now = util::getWallTimeVal(); -+ return std::chrono::duration_cast(now - -+ start).count(); -+} -+ -+#else -+ - WallTimer::WallTimer() { - startMicroseconds = util::getWallTimeVal().usec(); - } -@@ -22,3 +36,5 @@ WallTimer::WallTimer() { - uint64_t WallTimer::check() { - return util::getWallTimeVal().usec() - startMicroseconds; - } -+ -+#endif --- -2.18.0 - diff --git a/0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch b/0007-llvm5-Intrinsic-objectsize-has-three-arguments.patch similarity index 89% rename from 0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch rename to 0007-llvm5-Intrinsic-objectsize-has-three-arguments.patch index 88e909a..d83c820 100644 --- a/0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch +++ b/0007-llvm5-Intrinsic-objectsize-has-three-arguments.patch @@ -1,6 +1,6 @@ From: Jiri Slaby Date: Wed, 23 May 2018 15:01:34 +0200 -Subject: llvm50: Intrinsic::objectsize has three arguments +Subject: llvm5: Intrinsic::objectsize has three arguments Patch-mainline: no Modify the IntrinsicCleaner accordingly. @@ -14,7 +14,7 @@ Signed-off-by: Jiri Slaby 1 file changed, 16 insertions(+) diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp -index ab16a2654492..19807ce08583 100644 +index ab16a2654492..ee65be69e543 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp @@ -227,13 +227,29 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { @@ -35,9 +35,9 @@ index ab16a2654492..19807ce08583 100644 "Second argument is not an i1"); + +#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) -+ Value *nullArg = ii->getArgOperand(2); ++ auto nullArg = ii->getArgOperand(2); + assert(nullArg && "Failed to get second argument"); -+ ConstantInt *nullArgAsInt = dyn_cast(nullArg); ++ auto nullArgAsInt = dyn_cast(nullArg); + assert(nullArgAsInt && "Third arg is not a ConstantInt"); + assert(nullArgAsInt->getBitWidth() == 1 && + "Third argument is not an i1"); @@ -48,5 +48,5 @@ index ab16a2654492..19807ce08583 100644 IntegerType *intType = dyn_cast(ii->getType()); assert(intType && "intrinsic does not have integer return type"); -- -2.18.0 +2.19.0 diff --git a/0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch b/0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch deleted file mode 100644 index 26e49a2..0000000 --- a/0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch +++ /dev/null @@ -1,71 +0,0 @@ -From: Jiri Slaby -Date: Thu, 8 Jun 2017 13:25:56 +0200 -Subject: llvm: PointerType is not SequentialType in LLVM 4 -Patch-mainline: no - -So handle the type specially whenever needed. - -Signed-off-by: Jiri Slaby ---- - include/klee/util/GetElementPtrTypeIterator.h | 4 ++++ - lib/Core/Executor.cpp | 22 ++++++++++++++++--- - 2 files changed, 23 insertions(+), 3 deletions(-) - -diff --git a/include/klee/util/GetElementPtrTypeIterator.h b/include/klee/util/GetElementPtrTypeIterator.h -index 5fb9f4ec5c2f..bf7cb6ff0bea 100644 ---- a/include/klee/util/GetElementPtrTypeIterator.h -+++ b/include/klee/util/GetElementPtrTypeIterator.h -@@ -78,6 +78,10 @@ class generic_gep_type_iterator - generic_gep_type_iterator& operator++() { // Preincrement - if (llvm::CompositeType *CT = dyn_cast(CurTy)) { - CurTy = CT->getTypeAtIndex(getOperand()); -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ } else if (llvm::PointerType *ptr = dyn_cast(CurTy)) { -+ CurTy = ptr->getElementType(); -+#endif - } else { - CurTy = 0; - } -diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index 1a5b7b9df527..51d36b352e5c 100644 ---- a/lib/Core/Executor.cpp -+++ b/lib/Core/Executor.cpp -@@ -2621,8 +2621,7 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) { - uint64_t addend = sl->getElementOffset((unsigned) ci->getZExtValue()); - constantOffset = constantOffset->Add(ConstantExpr::alloc(addend, - Context::get().getPointerWidth())); -- } else { -- const SequentialType *set = cast(*ii); -+ } else if (const SequentialType *set = dyn_cast(*ii)) { - uint64_t elementSize = - kmodule->targetData->getTypeStoreSize(set->getElementType()); - Value *operand = ii.getOperand(); -@@ -2636,7 +2635,24 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) { - } else { - kgepi->indices.push_back(std::make_pair(index, elementSize)); - } -- } -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ } else if (const PointerType *ptr = dyn_cast(*ii)) { -+ uint64_t elementSize = -+ kmodule->targetData->getTypeStoreSize(ptr->getElementType()); -+ Value *operand = ii.getOperand(); -+ if (Constant *c = dyn_cast(operand)) { -+ ref index = -+ evalConstant(c)->SExt(Context::get().getPointerWidth()); -+ ref addend = -+ index->Mul(ConstantExpr::alloc(elementSize, -+ Context::get().getPointerWidth())); -+ constantOffset = constantOffset->Add(addend); -+ } else { -+ kgepi->indices.push_back(std::make_pair(index, elementSize)); -+ } -+#endif -+ } else -+ assert("invalid type" && 0); - index++; - } - kgepi->offset = constantOffset->getZExtValue(); --- -2.18.0 - diff --git a/0018-llvm50-test-change-objectsize.patch b/0008-llvm5-test-change-objectsize.patch similarity index 98% rename from 0018-llvm50-test-change-objectsize.patch rename to 0008-llvm5-test-change-objectsize.patch index a9ffc80..09d22a1 100644 --- a/0018-llvm50-test-change-objectsize.patch +++ b/0008-llvm5-test-change-objectsize.patch @@ -1,6 +1,6 @@ From: Jiri Slaby Date: Wed, 23 May 2018 14:54:48 +0200 -Subject: llvm50: test, change objectsize +Subject: llvm5: test, change objectsize Patch-mainline: no @llvm.objectsize has now three aguments, so fix the tests accordingly. @@ -95,5 +95,5 @@ index 3a111f99c619..95070e66e45c 100644 declare void @abort() noreturn nounwind -- -2.18.0 +2.19.0 diff --git a/0009-llvm40-gep_type_iterator-has-no-operator.patch b/0009-llvm40-gep_type_iterator-has-no-operator.patch deleted file mode 100644 index 3fd8a5b..0000000 --- a/0009-llvm40-gep_type_iterator-has-no-operator.patch +++ /dev/null @@ -1,32 +0,0 @@ -From: Jiri Slaby -Date: Fri, 17 Nov 2017 17:56:18 +0100 -Subject: llvm40: gep_type_iterator has no operator* -Patch-mainline: no - -Starting with LLVM 4.0, we have getStructTypeOrNull(), so use it. -operator* in post-4 will have a different semantics. - -Signed-off-by: Jiri Slaby ---- - lib/Core/ExecutorUtil.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/lib/Core/ExecutorUtil.cpp b/lib/Core/ExecutorUtil.cpp -index a352db3339c4..7718ae9d0ccb 100644 ---- a/lib/Core/ExecutorUtil.cpp -+++ b/lib/Core/ExecutorUtil.cpp -@@ -213,7 +213,11 @@ namespace klee { - continue; - - // Handle a struct index, which adds its field offset to the pointer. -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ if (StructType *STy = ii.getStructTypeOrNull()) { -+#else - if (StructType *STy = dyn_cast(*ii)) { -+#endif - unsigned ElementIdx = indexOp->getZExtValue(); - const StructLayout *SL = kmodule->targetData->getStructLayout(STy); - base = base->Add( --- -2.18.0 - diff --git a/0019-llvm50-test-add-disable-O0-optnone-to-O0.patch b/0009-llvm5-test-add-disable-O0-optnone-to-O0.patch similarity index 98% rename from 0019-llvm50-test-add-disable-O0-optnone-to-O0.patch rename to 0009-llvm5-test-add-disable-O0-optnone-to-O0.patch index 7183730..3c2b302 100644 --- a/0019-llvm50-test-add-disable-O0-optnone-to-O0.patch +++ b/0009-llvm5-test-add-disable-O0-optnone-to-O0.patch @@ -1,6 +1,6 @@ From: Jiri Slaby Date: Sun, 27 May 2018 10:26:43 +0200 -Subject: llvm50: test, add -disable-O0-optnone to -O0 +Subject: llvm5: test, add -disable-O0-optnone to -O0 Patch-mainline: no Otherwise optimizations done in klee won't have any effect. @@ -213,7 +213,7 @@ index b2db980dc7b7..7d0faa0842fc 100644 // RUN: %klee --output-dir=%t.klee-out --no-output --exit-on-error --no-externals %t1.bc diff --git a/test/CXX/StaticConstructor.cpp b/test/CXX/StaticConstructor.cpp -index 56fcb97be385..5332dc0b7846 100644 +index c184526e3601..3c61aec45acb 100644 --- a/test/CXX/StaticConstructor.cpp +++ b/test/CXX/StaticConstructor.cpp @@ -1,4 +1,4 @@ @@ -223,7 +223,7 @@ index 56fcb97be385..5332dc0b7846 100644 // RUN: %klee --output-dir=%t.klee-out --libc=klee --no-output --exit-on-error %t1.bc diff --git a/test/CXX/StaticDestructor.cpp b/test/CXX/StaticDestructor.cpp -index adc449a5c1f7..608525083bbb 100644 +index 2cf01e3b6d33..15520fc48504 100644 --- a/test/CXX/StaticDestructor.cpp +++ b/test/CXX/StaticDestructor.cpp @@ -1,6 +1,6 @@ @@ -233,7 +233,7 @@ index adc449a5c1f7..608525083bbb 100644 +// RUN: %llvmgxx %s -emit-llvm -g %O0opt -c -o %t1.bc // RUN: rm -rf %t.klee-out // RUN: %klee --output-dir=%t.klee-out --optimize=false --libc=klee --no-output %t1.bc 2> %t1.log - // RUN: grep ":17: memory error" %t1.log + // RUN: FileCheck --input-file %t1.log %s diff --git a/test/CXX/Trivial.cpp b/test/CXX/Trivial.cpp index 2b8ceed36cb9..18845820c067 100644 --- a/test/CXX/Trivial.cpp @@ -375,7 +375,7 @@ index be0879358028..e6e695ca2cb7 100644 // RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc diff --git a/test/Feature/InAndOutOfBounds.c b/test/Feature/InAndOutOfBounds.c -index 6eb8784a7353..5f10835f4a6d 100644 +index 9b913609c046..3c6fe37ec8aa 100644 --- a/test/Feature/InAndOutOfBounds.c +++ b/test/Feature/InAndOutOfBounds.c @@ -1,4 +1,4 @@ @@ -395,7 +395,7 @@ index 02aa23320075..8e39b99ff894 100644 // RUN: %klee --output-dir=%t.klee-out %t1.bc diff --git a/test/Feature/KleeReportError.c b/test/Feature/KleeReportError.c -index 4e21df1870f7..665d194607bd 100644 +index 96879a5571f9..b83472549a7b 100644 --- a/test/Feature/KleeReportError.c +++ b/test/Feature/KleeReportError.c @@ -1,4 +1,4 @@ @@ -450,7 +450,7 @@ index 4ea9daee629f..acde2d8ee5bf 100644 // RUN: %klee --output-dir=%t.klee-out --optimize=0 --exit-on-error %t1.bc > %t2.out diff --git a/test/Feature/MultipleFreeResolution.c b/test/Feature/MultipleFreeResolution.c -index 704057f93891..63b7c1ab3645 100644 +index 5c7dfdd8c941..540324a596a8 100644 --- a/test/Feature/MultipleFreeResolution.c +++ b/test/Feature/MultipleFreeResolution.c @@ -1,4 +1,4 @@ @@ -496,7 +496,7 @@ index 5f9068360df5..22dd973047cc 100644 // RUN: %klee --output-dir=%t.klee-out %t1.bc > %t1.log // RUN: diff %t1.res %t1.log diff --git a/test/Feature/OneFreeError.c b/test/Feature/OneFreeError.c -index 4f5a8c8c0153..76e85d6b3516 100644 +index 64a0425dc11d..e68f333f7232 100644 --- a/test/Feature/OneFreeError.c +++ b/test/Feature/OneFreeError.c @@ -1,4 +1,4 @@ @@ -506,7 +506,7 @@ index 4f5a8c8c0153..76e85d6b3516 100644 // RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s // RUN: test -f %t.klee-out/test000001.ptr.err diff --git a/test/Feature/OneOutOfBounds.c b/test/Feature/OneOutOfBounds.c -index 85fb2a79599e..444820c9b878 100644 +index 88a2ae435418..01fa0f922f68 100644 --- a/test/Feature/OneOutOfBounds.c +++ b/test/Feature/OneOutOfBounds.c @@ -1,4 +1,4 @@ @@ -536,7 +536,7 @@ index a1b31f57cbc1..d02d2229dc3a 100644 // RUN: %klee --output-dir=%t.klee-out %t1.bc // RUN: ls %t.klee-out/ | grep .ktest | wc -l | grep 4 diff --git a/test/Feature/OvershiftCheck.c b/test/Feature/OvershiftCheck.c -index 09cbf8ba0f6b..00e5530ad8d5 100644 +index ace54cee98f4..0a5cfc3b9704 100644 --- a/test/Feature/OvershiftCheck.c +++ b/test/Feature/OvershiftCheck.c @@ -1,4 +1,4 @@ @@ -544,7 +544,7 @@ index 09cbf8ba0f6b..00e5530ad8d5 100644 +// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc // RUN: rm -rf %t.klee-out // RUN: %klee --output-dir=%t.klee-out -check-overshift %t.bc 2> %t.log - // RUN: grep -c "overshift error" %t.log + // RUN: FileCheck --input-file %t.log %s diff --git a/test/Feature/PreferCex.c b/test/Feature/PreferCex.c index a765eea8b4af..8d88a3ce79bc 100644 --- a/test/Feature/PreferCex.c @@ -621,7 +621,7 @@ index aa86a856d299..a2faf08a81ee 100644 // RUN: %klee --output-dir=%t.klee-out --max-solver-time=1 %t1.bc // FIXME: This test occasionally fails when using Z3 4.4.1 but diff --git a/test/Feature/SourceMapping.c b/test/Feature/SourceMapping.c -index 9835d7018b97..1927d2d6b8da 100644 +index bc13652d91e4..aa849c5f88c4 100644 --- a/test/Feature/SourceMapping.c +++ b/test/Feature/SourceMapping.c @@ -1,7 +1,7 @@ @@ -644,16 +644,15 @@ index ae5531319d45..63ba85c8a337 100644 // RUN: %klee --output-dir=%t.klee-out %t.bc | FileCheck %s diff --git a/test/Feature/Vararg.c b/test/Feature/Vararg.c -index a78b784e3f62..11416c3730aa 100644 +index 9f4e9dabb00e..239ec9a35bde 100644 --- a/test/Feature/Vararg.c +++ b/test/Feature/Vararg.c -@@ -1,5 +1,5 @@ - // REQUIRES: not-darwin --// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -+// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc +@@ -1,4 +1,4 @@ +-// RUN: %llvmgcc %s -emit-llvm -O0 -c -g -o %t1.bc ++// RUN: %llvmgcc %s -emit-llvm %O0opt -c -g -o %t1.bc // RUN: rm -rf %t.klee-out - // RUN: %klee --output-dir=%t.klee-out %t1.bc > %t2.out - // RUN: grep "types: (52, 37, 2.00, (9,12,15))" %t2.out + // This test needs deterministic allocation with enough spacing between the allocations. + // Otherwise, if by coincidence the allocated vararg memory object is directly before another valid memory object, diff --git a/test/Feature/WithLibc.c b/test/Feature/WithLibc.c index 0eca8213f384..8c07041d89f6 100644 --- a/test/Feature/WithLibc.c @@ -675,7 +674,7 @@ index 6a9bbc2113ac..4a0bc36f1989 100644 // RUN: %klee --output-dir=%t.klee-out -use-cex-cache=1 -check-overshift=0 %t.bc // RUN: not grep "ASSERTION FAIL" %t.klee-out/messages.txt diff --git a/test/Feature/consecutive_divide_by_zero.c b/test/Feature/consecutive_divide_by_zero.c -index 31124ea4611c..157f5e1cf604 100644 +index ebe0dcb54307..b44572aa7187 100644 --- a/test/Feature/consecutive_divide_by_zero.c +++ b/test/Feature/consecutive_divide_by_zero.c @@ -1,4 +1,4 @@ @@ -683,7 +682,7 @@ index 31124ea4611c..157f5e1cf604 100644 +// RUN: %llvmgcc -emit-llvm -c -g %O0opt %s -o %t.bc // RUN: rm -rf %t.klee-out // RUN: %klee --output-dir=%t.klee-out -check-div-zero -emit-all-errors=0 %t.bc 2> %t.log - // RUN: grep "completed paths = 3" %t.log + // RUN: FileCheck --input-file=%t.log %s diff --git a/test/Feature/const_array_opt1.c b/test/Feature/const_array_opt1.c index ac43bdf7fd4b..b466e56ce784 100644 --- a/test/Feature/const_array_opt1.c @@ -725,7 +724,7 @@ index f4fa8aa5c4b7..4c331dd0e76b 100644 // RUN: %klee --output-dir=%t.klee-out -use-cex-cache=1 %t.bc // RUN: grep "KLEE: done: explored paths = 5" %t.klee-out/info diff --git a/test/Feature/ubsan_signed_overflow.c b/test/Feature/ubsan_signed_overflow.c -index c89065ebf957..03073ae7f39e 100644 +index 8d01f7d36045..f4636c335f90 100644 --- a/test/Feature/ubsan_signed_overflow.c +++ b/test/Feature/ubsan_signed_overflow.c @@ -1,4 +1,4 @@ @@ -735,7 +734,7 @@ index c89065ebf957..03073ae7f39e 100644 // RUN: %klee --output-dir=%t.klee-out %t.bc 2>&1 | FileCheck %s diff --git a/test/Feature/ubsan_unsigned_overflow.c b/test/Feature/ubsan_unsigned_overflow.c -index 1300ffcc195c..c96909bb3a66 100644 +index e2d9592c37f2..4c783b4c32e7 100644 --- a/test/Feature/ubsan_unsigned_overflow.c +++ b/test/Feature/ubsan_unsigned_overflow.c @@ -1,4 +1,4 @@ @@ -873,7 +872,7 @@ index 8faa9778ca41..43216d5470b5 100644 // RUN: %gentmp %t.klee-out-tmp // RUN: %klee --output-dir=%t.klee-out --run-in=%t.klee-out-tmp --search=random-state --libc=uclibc --posix-runtime --exit-on-error %t.bc --sym-files 1 1 > %t2.log diff --git a/test/Runtime/POSIX/DirSeek.c b/test/Runtime/POSIX/DirSeek.c -index 4c68a30c546c..4cb91b7016e0 100644 +index 821ff8f58a89..449714b95b9f 100644 --- a/test/Runtime/POSIX/DirSeek.c +++ b/test/Runtime/POSIX/DirSeek.c @@ -1,4 +1,4 @@ @@ -893,15 +892,15 @@ index c012174cdc1f..dc5e17344ed4 100644 // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-files 1 10 diff --git a/test/Runtime/POSIX/FD_Fail.c b/test/Runtime/POSIX/FD_Fail.c -index 2ee1a1a260d6..9a73e60f202e 100644 +index 018f43f8a552..74f94bf6e754 100644 --- a/test/Runtime/POSIX/FD_Fail.c +++ b/test/Runtime/POSIX/FD_Fail.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t1.bc // RUN: rm -rf %t.klee-out - // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime %t1.bc --sym-files 0 0 --max-fail 1 > %t.log - // RUN: grep -q "fread(): ok" %t.log + // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime %t1.bc --max-fail 1 | FileCheck %s + diff --git a/test/Runtime/POSIX/FD_Fail2.c b/test/Runtime/POSIX/FD_Fail2.c index c1c2cc5fd9de..8fef1eda6df1 100644 --- a/test/Runtime/POSIX/FD_Fail2.c @@ -944,7 +943,7 @@ index 489c09ed9ff2..34fd346865fb 100644 // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime %t1.bc --sym-files 1 1 diff --git a/test/Runtime/POSIX/FreeArgv.c b/test/Runtime/POSIX/FreeArgv.c -index 8f812b5d946f..ff07024358d5 100644 +index 7a5445a3a206..fff1b2c46280 100644 --- a/test/Runtime/POSIX/FreeArgv.c +++ b/test/Runtime/POSIX/FreeArgv.c @@ -1,4 +1,4 @@ @@ -974,17 +973,17 @@ index eb3a611a2be5..7b890b6729b9 100644 // RUN: %klee --output-dir=%t.klee-out --libc=klee --posix-runtime --exit-on-error %t2.bc --sym-files 1 10 diff --git a/test/Runtime/POSIX/Ioctl.c b/test/Runtime/POSIX/Ioctl.c -index f1caaf77dea2..8ab5d49ac8fc 100644 +index c8937a371fd0..61af8662132a 100644 --- a/test/Runtime/POSIX/Ioctl.c +++ b/test/Runtime/POSIX/Ioctl.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -c -o %t.bc // RUN: rm -rf %t.klee-out - // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t.bc --sym-files 0 4 + // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t.bc --sym-stdin 4 diff --git a/test/Runtime/POSIX/Isatty.c b/test/Runtime/POSIX/Isatty.c -index fdfc6ceb0301..7fe44dcf031a 100644 +index b9232e01eb7f..6501a4a39252 100644 --- a/test/Runtime/POSIX/Isatty.c +++ b/test/Runtime/POSIX/Isatty.c @@ -1,4 +1,4 @@ @@ -1384,7 +1383,7 @@ index 322e5bb8746d..cc73f0b35583 100644 // RUN: %klee --output-dir=%t.klee-out %t1.bc diff --git a/test/regression/2014-07-04-unflushed-error-report.c b/test/regression/2014-07-04-unflushed-error-report.c -index 0518fb4d4566..f9547c176df9 100644 +index 0b98944ac78f..a0404db68c0a 100644 --- a/test/regression/2014-07-04-unflushed-error-report.c +++ b/test/regression/2014-07-04-unflushed-error-report.c @@ -1,4 +1,4 @@ @@ -1499,10 +1498,11 @@ index 4cd8ff8d2a0d..195806015a59 100644 // RUN: %klee --output-dir=%t.klee-out --entry-point=entry %t.bc diff --git a/test/regression/2016-08-12-empty-file.c b/test/regression/2016-08-12-empty-file.c -index b965027837f8..a4f1b19cb15d 100644 +index 56695fe1200c..8165f9242223 100644 --- a/test/regression/2016-08-12-empty-file.c +++ b/test/regression/2016-08-12-empty-file.c -@@ -1,4 +1,4 @@ +@@ -1,5 +1,5 @@ + // REQUIRES: posix-runtime -// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc +// RUN: %llvmgcc %s -emit-llvm -g %O0opt -c -o %t.bc // RUN: rm -rf %t.klee-out @@ -1560,5 +1560,5 @@ index 5f2af61e0d89..8d183b77a010 100644 // RUN: %klee -stop-after-n-instructions=1 --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s -- -2.18.0 +2.19.0 diff --git a/0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch b/0010-llvm5-CallSite.paramHasAttr-is-indexed-from-0.patch similarity index 93% rename from 0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch rename to 0010-llvm5-CallSite.paramHasAttr-is-indexed-from-0.patch index b5c9b0e..635f256 100644 --- a/0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch +++ b/0010-llvm5-CallSite.paramHasAttr-is-indexed-from-0.patch @@ -1,6 +1,6 @@ From: Jiri Slaby Date: Fri, 20 Jul 2018 10:06:29 +0200 -Subject: llvm50: CallSite.paramHasAttr is indexed from 0 +Subject: llvm5: CallSite.paramHasAttr is indexed from 0 Patch-mainline: no Since LLVM 5 commit 1f8f0490690b, CallSite.paramHasAttr is indexed from @@ -13,7 +13,7 @@ Signed-off-by: Jiri Slaby 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index 46fd2be42351..f05561e7fe82 100644 +index b5d7e6ce8f6c..96285f74a462 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -1543,7 +1543,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { @@ -42,5 +42,5 @@ index 46fd2be42351..f05561e7fe82 100644 arguments[i] = SExtExpr::create(arguments[i], to); } else { -- -2.18.0 +2.19.0 diff --git a/0010-llvm50-avoid-on-function-arg_begin.patch b/0010-llvm50-avoid-on-function-arg_begin.patch deleted file mode 100644 index ce17eeb..0000000 --- a/0010-llvm50-avoid-on-function-arg_begin.patch +++ /dev/null @@ -1,50 +0,0 @@ -From: Jiri Slaby -Date: Mon, 15 Jan 2018 10:35:19 +0100 -Subject: llvm50: avoid ++ on function->arg_begin() -Patch-mainline: no - -Starting with llvm 5, arguments of a function are not an iterator, but -an array. So they cannot be incremented in-place. Use +1 to construct a -new one instead. - -Otherwise we see: -../tools/klee/main.cpp:661:23: error: expression is not assignable - Value *oldArgv = &*(++mainFn->arg_begin()); - ^ ~~~~~~~~~~~~~~~~~~~ - -Signed-off-by: Jiri Slaby ---- - tools/klee/main.cpp | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index c7dc517a8eee..883be83a4130 100644 ---- a/tools/klee/main.cpp -+++ b/tools/klee/main.cpp -@@ -655,7 +655,11 @@ static void initEnv(Module *mainModule) { - Instruction *firstInst = &*(mainFn->begin()->begin()); - - Value *oldArgc = &*(mainFn->arg_begin()); -+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) -+ Value *oldArgv = &*(mainFn->arg_begin() + 1); -+#else - Value *oldArgv = &*(++mainFn->arg_begin()); -+#endif - - AllocaInst* argcPtr = - new AllocaInst(oldArgc->getType(), "argcPtr", firstInst); -@@ -1057,7 +1061,11 @@ createLibCWrapper(std::vector> &modules, - args.push_back( - llvm::ConstantExpr::getBitCast(inModuleRefernce, ft->getParamType(0))); - args.push_back(&*(stub->arg_begin())); // argc -+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) -+ args.push_back(&*(stub->arg_begin() + 1)); // argv -+#else - args.push_back(&*(++stub->arg_begin())); // argv -+#endif - args.push_back(Constant::getNullValue(ft->getParamType(3))); // app_init - args.push_back(Constant::getNullValue(ft->getParamType(4))); // app_fini - args.push_back(Constant::getNullValue(ft->getParamType(5))); // rtld_fini --- -2.18.0 - diff --git a/0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch b/0011-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch similarity index 99% rename from 0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch rename to 0011-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch index 5c1fc61..dfb0edd 100644 --- a/0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch +++ b/0011-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch @@ -81,5 +81,5 @@ index d39249df023f..b7f2b6ff347a 100644 llvm::cl::PrintVersionMessage(); } -- -2.18.0 +2.19.0 diff --git a/0022-llvm6-handle-headers-renaming.patch b/0012-llvm6-handle-headers-renaming.patch similarity index 99% rename from 0022-llvm6-handle-headers-renaming.patch rename to 0012-llvm6-handle-headers-renaming.patch index 0955b18..fabc9ed 100644 --- a/0022-llvm6-handle-headers-renaming.patch +++ b/0012-llvm6-handle-headers-renaming.patch @@ -33,5 +33,5 @@ index 4967a2fa8578..eef22fb81553 100644 using namespace llvm; -- -2.18.0 +2.19.0 diff --git a/0016-llvm50-AllocaInst-takes-address-space.patch b/0016-llvm50-AllocaInst-takes-address-space.patch deleted file mode 100644 index b0cbeaf..0000000 --- a/0016-llvm50-AllocaInst-takes-address-space.patch +++ /dev/null @@ -1,39 +0,0 @@ -From: Jiri Slaby -Date: Mon, 15 Jan 2018 11:10:39 +0100 -Subject: llvm50: AllocaInst takes address space -Patch-mainline: no - -Add address space second parameter to new AllocaInst which is required -since llvm 5's commit e0b3c335a27ae50c4f339ffb81c18662bc983e52. - -Signed-off-by: Jiri Slaby ---- - tools/klee/main.cpp | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index c0805f457717..d45a92160e59 100644 ---- a/tools/klee/main.cpp -+++ b/tools/klee/main.cpp -@@ -661,10 +661,18 @@ static void initEnv(Module *mainModule) { - Value *oldArgv = &*(++mainFn->arg_begin()); - #endif - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) -+ const DataLayout &DL = mainFn->getParent()->getDataLayout(); -+ AllocaInst* argcPtr = -+ new AllocaInst(oldArgc->getType(), DL.getAllocaAddrSpace(), "argcPtr", firstInst); -+ AllocaInst* argvPtr = -+ new AllocaInst(oldArgv->getType(), DL.getAllocaAddrSpace(), "argvPtr", firstInst); -+#else - AllocaInst* argcPtr = - new AllocaInst(oldArgc->getType(), "argcPtr", firstInst); - AllocaInst* argvPtr = - new AllocaInst(oldArgv->getType(), "argvPtr", firstInst); -+#endif - - /* Insert void klee_init_env(int* argc, char*** argv) */ - std::vector params; --- -2.18.0 - diff --git a/_servicedata b/_servicedata index e67b0c5..a26a473 100644 --- a/_servicedata +++ b/_servicedata @@ -1,4 +1,4 @@ git://github.com/klee/klee.git - b893d2158ce001da97f2c741ac8320b4c3b9ed53 \ No newline at end of file + 4efd7f6b443f187f5a844227339383ce5593e865 \ No newline at end of file diff --git a/klee-1.4.0+20180829.tar.xz b/klee-1.4.0+20180829.tar.xz deleted file mode 100644 index 742e514..0000000 --- a/klee-1.4.0+20180829.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7f46c097ddadb8c4b6a3ec70294b7a8d2c8d6451a67913d698813832695a046c -size 597812 diff --git a/klee-1.4.0+20180920.tar.xz b/klee-1.4.0+20180920.tar.xz new file mode 100644 index 0000000..866f1fc --- /dev/null +++ b/klee-1.4.0+20180920.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5bb676ee734644ba8e5b3cd125f30b92586db69d1ed1ca18976cc49160be5b31 +size 601236 diff --git a/klee.changes b/klee.changes index cf58307..020ae39 100644 --- a/klee.changes +++ b/klee.changes @@ -1,3 +1,72 @@ +------------------------------------------------------------------- +Fri Sep 21 11:24:38 UTC 2018 - jslaby@suse.com + +- Update to version 1.4.0+20180920: + * Removed unused file + * Removed unused --sym-files 0 0 argument from FD_Fail test and rewrote the test to use FileCheck instead of grep + * Updated IoCtl test to use --sym-stdin instead of --sym-files 0 x to make stdin symbolic and removed unused arguments to main. + * Updated DirSeek test to use --sym-stdin instead of --sym-files 0 x to make stdin symbolic. + * Silence an uninitialized variable compiler warning (and a tiny formatting change) + * travis: enable LLVM 4 testing + * llvm4: gep_type_iterator has no operator* + * llvm4: PointerType is not SequentialType + * llvm4: use chrono helpers from LLVM + * llvm4: errorOr and similar + * llvm4: APFloat members are functions + * llvm4: handle different header names + * travis CI: add LLVM 3.9 build tests + * llvm39: switch KLEE_RUNTIME_BUILD_TYPE to Debug+Asserts + * cmake: find_llvm, fix libraries with llvm-config 3.9 + * llvm: make KLEE compile against LLVM 3.9 + * Add testcase to run POSIX environment and main without arguments + * Add POSIX runtime as dependency for the test case + * Unify the error message if that function has not been found. + * Fix generation of global constructors and destructors + * POSIX: Add invocation of klee_init_env into wrapper before calling main + * Fix missing includes and declarations + * Use FileCheck and LINE instead of grep if possible + * llvm36.patch: fix build for newer glibc/gcc versions + * runtime: fix memory error in canonicalize_file_name + * Build on trusty without sudo - uses faster Docker infrastructure from TravisCI + * Avoid Vararg non-deterministic allocation +- removed (in upstream): + * 0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch + * 0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch + * 0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch + * 0004-llvm40-handle-different-header-names.patch + * 0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch + * 0006-llvm40-errorOr-and-similar.patch + * 0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch + * 0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch + * 0009-llvm40-gep_type_iterator-has-no-operator.patch +- removed (not needed): + * 0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch +- renamed: + * 0010-llvm50-avoid-on-function-arg_begin.patch + -> 0001-llvm5-avoid-on-function-arg_begin.patch + * 0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch + -> 0002-llvm5-integerPartWidth-is-from-llvm-APFloatBase.patch + * 0012-llvm50-handle-getOrInsertFunction-terminator.patch + -> 0003-llvm5-handle-getOrInsertFunction-terminator.patch + * 0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch + -> 0004-llvm5-SwitchInst-case-functions-now-return-pointers.patch + * 0014-llvm50-handle-new-file_magic-s-location.patch + -> 0005-llvm5-handle-new-file_magic-s-location.patch + * 0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch + -> 0006-llvm5-use-MutableArrayRef-for-APFloat-convertToInteg.patch + * 0016-llvm50-AllocaInst-takes-address-space.patch + -> 0007-llvm5-Intrinsic-objectsize-has-three-arguments.patch + * 0018-llvm50-test-change-objectsize.patch + -> 0008-llvm5-test-change-objectsize.patch + * 0019-llvm50-test-add-disable-O0-optnone-to-O0.patch + -> 0009-llvm5-test-add-disable-O0-optnone-to-O0.patch + * 0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch + -> 0010-llvm5-CallSite.paramHasAttr-is-indexed-from-0.patch + * 0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch + -> 0011-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch + * 0022-llvm6-handle-headers-renaming.patch + -> 0012-llvm6-handle-headers-renaming.patch + ------------------------------------------------------------------- Sun Sep 02 08:39:37 UTC 2018 - opensuse-packaging@opensuse.org diff --git a/klee.spec b/klee.spec index bb098dc..28cdfc3 100644 --- a/klee.spec +++ b/klee.spec @@ -19,7 +19,7 @@ %define llvm_version_minor 0 %define llvm_version %{llvm_version_major} -%define version_unconverted 1.4.0+20180829 +%define version_unconverted 1.4.0+20180920 %ifarch %{ix86} x86_64 %define with_uclibc 1 @@ -31,7 +31,7 @@ Name: klee Summary: LLVM Execution Engine License: NCSA Group: Development/Languages/Other -Version: 1.4.0+20180829 +Version: 1.4.0+20180920 Release: 0 Url: http://klee.github.io/ Source0: %{name}-%{version}.tar.xz @@ -39,28 +39,18 @@ Source1: %{name}-rpmlintrc Source2: https://raw.githubusercontent.com/llvm-mirror/llvm/release_%{llvm_version_major}%{llvm_version_minor}/utils/not/not.cpp Source3: https://raw.githubusercontent.com/llvm-mirror/llvm/release_%{llvm_version_major}%{llvm_version_minor}/utils/FileCheck/FileCheck.cpp -Patch201: 0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch -Patch202: 0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch -Patch203: 0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch -Patch204: 0004-llvm40-handle-different-header-names.patch -Patch205: 0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch -Patch206: 0006-llvm40-errorOr-and-similar.patch -Patch207: 0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch -Patch208: 0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch -Patch209: 0009-llvm40-gep_type_iterator-has-no-operator.patch -Patch210: 0010-llvm50-avoid-on-function-arg_begin.patch -Patch211: 0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch -Patch212: 0012-llvm50-handle-getOrInsertFunction-terminator.patch -Patch213: 0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch -Patch214: 0014-llvm50-handle-new-file_magic-s-location.patch -Patch215: 0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch -Patch216: 0016-llvm50-AllocaInst-takes-address-space.patch -Patch217: 0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch -Patch218: 0018-llvm50-test-change-objectsize.patch -Patch219: 0019-llvm50-test-add-disable-O0-optnone-to-O0.patch -Patch220: 0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch -Patch221: 0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch -Patch222: 0022-llvm6-handle-headers-renaming.patch +Patch201: 0001-llvm5-avoid-on-function-arg_begin.patch +Patch202: 0002-llvm5-integerPartWidth-is-from-llvm-APFloatBase.patch +Patch203: 0003-llvm5-handle-getOrInsertFunction-terminator.patch +Patch204: 0004-llvm5-SwitchInst-case-functions-now-return-pointers.patch +Patch205: 0005-llvm5-handle-new-file_magic-s-location.patch +Patch206: 0006-llvm5-use-MutableArrayRef-for-APFloat-convertToInteg.patch +Patch207: 0007-llvm5-Intrinsic-objectsize-has-three-arguments.patch +Patch208: 0008-llvm5-test-change-objectsize.patch +Patch209: 0009-llvm5-test-add-disable-O0-optnone-to-O0.patch +Patch210: 0010-llvm5-CallSite.paramHasAttr-is-indexed-from-0.patch +Patch211: 0011-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch +Patch212: 0012-llvm6-handle-headers-renaming.patch BuildRequires: clang%{llvm_version} BuildRequires: cmake