From 51b6157cc67e7855e042feedf1ef79b2fdba2ca4636979b73666990bc29ef091 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Sun, 2 Sep 2018 08:58:44 +0000 Subject: [PATCH] up to 1.4.0+20180829 OBS-URL: https://build.opensuse.org/package/show/devel:tools:statica/klee?expand=0&rev=54 --- ...m-make-KLEE-compile-against-LLVM-3.9.patch | 165 ++++---- 0001-test-remove-undefined-behaviour.patch | 71 ---- ...m-fix-libraries-with-llvm-config-3.9.patch | 2 +- 0002-llvm38-no-rounding-in-APFloat.patch | 34 -- ...8-handle-optimization-passes-changes.patch | 62 --- ...EE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch | 33 ++ ...m38-SmallString-is-always-up-to-date.patch | 33 -- ...llvm40-handle-different-header-names.patch | 42 +- ...at-members-are-functions-in-LLVM-4.0.patch | 6 +- ...aterializeAllPermanently-was-renamed.patch | 31 -- ...vm38-adapt-to-new-Linker-linkModules.patch | 72 ---- 0006-llvm40-errorOr-and-similar.patch | 53 +++ ...lvm-use-chrono-helpers-from-LLVM-4.0.patch | 8 +- ...lvm38-archive-child-iterator-changes.patch | 61 --- ...Type-is-not-SequentialType-in-LLVM-4.patch | 8 +- 0008-llvm38-no-more-implicit-iterators.patch | 78 ---- 0009-llvm38-test-change-some-tests.patch | 155 -------- ...40-gep_type_iterator-has-no-operator.patch | 2 +- ...0-llvm50-avoid-on-function-arg_begin.patch | 12 +- ...erPartWidth-is-from-llvm-APFloatBase.patch | 6 +- ...andle-getOrInsertFunction-terminator.patch | 49 +-- ...t-case-functions-now-return-pointers.patch | 6 +- 0014-llvm40-errorOr-and-similar.patch | 128 ------ ...m50-handle-new-file_magic-s-location.patch | 36 +- ...leArrayRef-for-APFloat-convertToInte.patch | 8 +- ...lvm50-AllocaInst-takes-address-space.patch | 6 +- ...insic-objectsize-has-three-arguments.patch | 6 +- ...> 0018-llvm50-test-change-objectsize.patch | 2 +- ...50-test-add-disable-O0-optnone-to-O0.patch | 365 ++++++++++-------- ...lSite.paramHasAttr-is-indexed-from-0.patch | 46 +++ ...sionPrinter-now-passes-down-a-stream.patch | 4 +- ...> 0022-llvm6-handle-headers-renaming.patch | 6 +- _servicedata | 2 +- klee-1.4.0+20180614.tar.xz | 3 - klee-1.4.0+20180829.tar.xz | 3 + klee.changes | 106 +++++ klee.spec | 91 ++--- 37 files changed, 639 insertions(+), 1162 deletions(-) rename 0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch => 0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch (73%) delete mode 100644 0001-test-remove-undefined-behaviour.patch rename 0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch => 0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch (99%) delete mode 100644 0002-llvm38-no-rounding-in-APFloat.patch delete mode 100644 0003-llvm38-handle-optimization-passes-changes.patch create mode 100644 0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch delete mode 100644 0004-llvm38-SmallString-is-always-up-to-date.patch rename 0012-llvm40-handle-different-header-names.patch => 0004-llvm40-handle-different-header-names.patch (76%) rename 0013-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch => 0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch (89%) delete mode 100644 0005-llvm38-materializeAllPermanently-was-renamed.patch delete mode 100644 0006-llvm38-adapt-to-new-Linker-linkModules.patch create mode 100644 0006-llvm40-errorOr-and-similar.patch rename 0015-llvm-use-chrono-helpers-from-LLVM-4.0.patch => 0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch (97%) delete mode 100644 0007-llvm38-archive-child-iterator-changes.patch rename 0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch => 0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch (94%) delete mode 100644 0008-llvm38-no-more-implicit-iterators.patch delete mode 100644 0009-llvm38-test-change-some-tests.patch rename 0017-llvm40-gep_type_iterator-has-no-operator.patch => 0009-llvm40-gep_type_iterator-has-no-operator.patch (99%) rename 0018-llvm50-avoid-on-function-arg_begin.patch => 0010-llvm50-avoid-on-function-arg_begin.patch (81%) rename 0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch => 0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch (89%) rename 0020-llvm50-handle-getOrInsertFunction-terminator.patch => 0012-llvm50-handle-getOrInsertFunction-terminator.patch (61%) rename 0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch => 0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch (92%) delete mode 100644 0014-llvm40-errorOr-and-similar.patch rename 0022-llvm50-handle-new-file_magic-s-location.patch => 0014-llvm50-handle-new-file_magic-s-location.patch (67%) rename 0023-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch => 0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch (90%) rename 0024-llvm50-AllocaInst-takes-address-space.patch => 0016-llvm50-AllocaInst-takes-address-space.patch (91%) rename 0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch => 0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch (94%) rename 0026-llvm50-test-change-objectsize.patch => 0018-llvm50-test-change-objectsize.patch (99%) rename 0027-llvm50-test-add-disable-O0-optnone-to-O0.patch => 0019-llvm50-test-add-disable-O0-optnone-to-O0.patch (85%) create mode 100644 0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch rename 0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch => 0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch (97%) rename 0029-llvm60-handle-headers-renaming.patch => 0022-llvm6-handle-headers-renaming.patch (92%) delete mode 100644 klee-1.4.0+20180614.tar.xz create mode 100644 klee-1.4.0+20180829.tar.xz diff --git a/0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch b/0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch similarity index 73% rename from 0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch rename to 0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch index f3db496..be7d5e9 100644 --- a/0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch +++ b/0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch @@ -7,18 +7,18 @@ Signed-off-by: Jiri Slaby --- lib/Core/Executor.cpp | 16 ++++++++++++++++ lib/Core/MemoryManager.cpp | 5 ++++- - lib/Module/ModuleUtil.cpp | 36 +++++++++++++++++++++++++++++++++--- - lib/Module/Optimize.cpp | 28 ++++++++++++++++++++++++++++ + 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, 98 insertions(+), 5 deletions(-) + 7 files changed, 101 insertions(+), 5 deletions(-) diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index b846947e5455..385920627641 100644 +index b053d4882431..7f69a618b8ec 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp -@@ -1305,10 +1305,18 @@ void Executor::executeCall(ExecutionState &state, +@@ -1338,10 +1338,18 @@ void Executor::executeCall(ExecutionState &state, // // Alignment requirements for scalar types is the same as their size if (argWidth > Expr::Int64) { @@ -37,7 +37,7 @@ index b846947e5455..385920627641 100644 } } -@@ -1341,10 +1349,18 @@ void Executor::executeCall(ExecutionState &state, +@@ -1374,10 +1382,18 @@ void Executor::executeCall(ExecutionState &state, Expr::Width argWidth = arguments[i]->getWidth(); if (argWidth > Expr::Int64) { @@ -75,70 +75,10 @@ index 24e2ed97581f..f40e8bc9deb8 100644 // 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 e6d592b135b6..ee4af254dae2 100644 +index 5ca0a55b12d2..0e87b5a6deca 100644 --- a/lib/Module/ModuleUtil.cpp +++ b/lib/Module/ModuleUtil.cpp -@@ -196,7 +196,11 @@ 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) -+#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) - #else -@@ -236,7 +240,17 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - return false; - } - --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ Expected > child = -+ childErr->getAsBinary(); -+ if (!child) { -+ // I don't know why, but -+ // ec = errorToErrorCode(child.takeError()) -+ // does not work here, so: -+ consumeError(child.takeError()); -+ ec = std::make_error_code(std::errc::io_error); -+ } -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) - ErrorOr > child = - childErr->getAsBinary(); - ec = child.getError(); -@@ -319,6 +333,13 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - } - - } -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ if (Err) { -+ SS << "Cannot iterate over archive"; -+ SS.flush(); -+ return false; -+ } -+#endif - - KLEE_DEBUG_WITH_TYPE("klee_linker", dbgs() << "Loaded " << archiveModules.size() << " modules\n"); - -@@ -490,7 +511,12 @@ Module *klee::linkWithLibrary(Module *module, - #endif - - } else if (magic == sys::fs::file_magic::archive) { --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) -+ Expected > arch = -+ object::createBinary(Buffer, &Context); -+ if (!arch) -+ ec = errorToErrorCode(arch.takeError()); -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) - ErrorOr > arch = - object::createBinary(Buffer, &Context); - ec = arch.getError(); -@@ -548,7 +574,11 @@ Function *klee::getDirectCallTarget(CallSite cs, bool moduleIsFullyLinked) { +@@ -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)) { @@ -150,8 +90,66 @@ index e6d592b135b6..ee4af254dae2 100644 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 df7b147d0abe..8239c3a24c12 100644 +index c788ee36cadb..34af46262080 100644 --- a/lib/Module/Optimize.cpp +++ b/lib/Module/Optimize.cpp @@ -39,6 +39,11 @@ @@ -190,23 +188,28 @@ index df7b147d0abe..8239c3a24c12 100644 addPass(PM, createInstructionCombiningPass()); // Combine silly seq's addPass(PM, createTailCallEliminationPass()); // Eliminate tail calls -@@ -183,8 +196,15 @@ void Optimize(Module *M, const std::string &EntryPoint) { +@@ -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 PreserveEP = [=](const GlobalValue &GV) { -+ return GV.getName().equals(EntryPoint); ++ 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(PreserveEP); ++ ModulePass *pass = createInternalizePass(PreserveFunctions); +#else - ModulePass *pass = createInternalizePass( - std::vector(1, EntryPoint.c_str())); + ModulePass *pass = createInternalizePass(preservedFunctions); +#endif addPass(Passes, pass); } -@@ -223,11 +243,19 @@ void Optimize(Module *M, const std::string &EntryPoint) { +@@ -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. @@ -227,7 +230,7 @@ index df7b147d0abe..8239c3a24c12 100644 addPass(Passes, createGlobalsAAWrapperPass()); // IP alias analysis #else diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp -index c597fa2a7b82..d9b3e40154ba 100644 +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) { @@ -249,7 +252,7 @@ index c597fa2a7b82..d9b3e40154ba 100644 -#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) +#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) + TM = NativeTarget->createTargetMachine(HostTriple, "", "", TargetOptions(), -+ None); ++ None); + TLI = TM->getSubtargetImpl(*(M.begin()))->getTargetLowering(); +#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) TM = NativeTarget->createTargetMachine(HostTriple, "", "", TargetOptions()); @@ -272,10 +275,10 @@ index b8b32e31264a..800cece95e9c 100644 llvm::cl::ParseCommandLineOptions(argc, argv); diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index 3d73ae07fcb5..c0ea4fa54551 100644 +index c655aa560f62..7be5f07cdc0e 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp -@@ -1132,7 +1132,11 @@ int main(int argc, char **argv, char **envp) { +@@ -1092,7 +1092,11 @@ int main(int argc, char **argv, char **envp) { llvm::InitializeNativeTarget(); parseArguments(argc, argv); @@ -288,5 +291,5 @@ index 3d73ae07fcb5..c0ea4fa54551 100644 if (Watchdog) { if (MaxTime==0) { -- -2.17.1 +2.18.0 diff --git a/0001-test-remove-undefined-behaviour.patch b/0001-test-remove-undefined-behaviour.patch deleted file mode 100644 index a9287f0..0000000 --- a/0001-test-remove-undefined-behaviour.patch +++ /dev/null @@ -1,71 +0,0 @@ -From: Jiri Slaby -Date: Fri, 15 Jun 2018 10:32:26 +0200 -Subject: test: remove undefined behaviour -Patch-mainline: no - -Shifting negative values is implementation-defined. - -Shifting by equal number of the bits as is the size of the type is -undefined. - -So fix both of these. - -This fixes #911. - -Signed-off-by: Jiri Slaby ---- - .../Feature/arithmetic-right-overshift-sym-conc.c | 15 +++++++++------ - 1 file changed, 9 insertions(+), 6 deletions(-) - -diff --git a/test/Feature/arithmetic-right-overshift-sym-conc.c b/test/Feature/arithmetic-right-overshift-sym-conc.c -index 7af6f9d7f08f..63b93db32ed9 100644 ---- a/test/Feature/arithmetic-right-overshift-sym-conc.c -+++ b/test/Feature/arithmetic-right-overshift-sym-conc.c -@@ -13,14 +13,17 @@ typedef enum - UNKNOWN - } overshift_t; - -+#define INT_31_BITS (0xffffffff >> 1) -+ - // We're using signed ints so should be doing - // arithmetic right shift. - // lhs should be a constant --int overshift(signed int lhs, volatile unsigned int y, const char * type) -+unsigned int overshift(unsigned int lhs, volatile unsigned int y, -+ const char *type) - { - overshift_t ret; -- volatile signed int x = lhs; -- unsigned int limit = sizeof(x)*8; -+ volatile unsigned int x = lhs; -+ unsigned int limit = sizeof(x)*8 - 1; - assert(!klee_is_symbolic(x)); - - volatile signed int result; -@@ -47,12 +50,12 @@ int overshift(signed int lhs, volatile unsigned int y, const char * type) - - int main(int argc, char** argv) - { -- volatile unsigned int y = sizeof(unsigned int)*8; -+ volatile unsigned int y = sizeof(unsigned int)*8 - 1; - // Try with +ve lhs - overshift_t conc = overshift(15, y, "Concrete"); - assert(conc == TO_ZERO); - // Try with -ve lhs -- conc = overshift(-1, y, "Concrete"); -+ conc = overshift(INT_31_BITS, y, "Concrete"); - assert(conc == TO_ZERO); - - // Symbolic overshift -@@ -65,7 +68,7 @@ int main(int argc, char** argv) - overshift_t sym = overshift(15, y2, "Symbolic"); - assert(sym == TO_ZERO); - // Try with -ve lhs -- sym = overshift(-1, y2, "Symbolic"); -+ sym = overshift(INT_31_BITS, y2, "Symbolic"); - assert(sym == TO_ZERO); - - // Concrete and symbolic behaviour should be the same --- -2.17.1 - diff --git a/0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch b/0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch similarity index 99% rename from 0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch rename to 0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch index 86d8f6e..b603cd0 100644 --- a/0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch +++ b/0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch @@ -34,5 +34,5 @@ index adf68c4fc82a..8ceed19f7b9e 100644 list(APPEND targets_to_return "${target_name}") if (NOT TARGET "${target_name}") -- -2.17.1 +2.18.0 diff --git a/0002-llvm38-no-rounding-in-APFloat.patch b/0002-llvm38-no-rounding-in-APFloat.patch deleted file mode 100644 index cd135be..0000000 --- a/0002-llvm38-no-rounding-in-APFloat.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Jiri Slaby -Date: Fri, 15 Jun 2018 07:51:10 +0200 -Subject: llvm38: no rounding in APFloat -Patch-mainline: no - -The rounding was removed because it was never needed: -llvm-mirror/llvm@ff278be - -Signed-off-by: Jiri Slaby ---- - lib/Core/Executor.cpp | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index 24fcea8811c4..b846947e5455 100644 ---- a/lib/Core/Executor.cpp -+++ b/lib/Core/Executor.cpp -@@ -2210,8 +2210,13 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { - !fpWidthToSemantics(right->getWidth())) - return terminateStateOnExecError(state, "Unsupported FRem operation"); - llvm::APFloat Res(*fpWidthToSemantics(left->getWidth()), left->getAPValue()); -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ Res.mod( -+ APFloat(*fpWidthToSemantics(right->getWidth()), right->getAPValue())); -+#else - Res.mod(APFloat(*fpWidthToSemantics(right->getWidth()),right->getAPValue()), - APFloat::rmNearestTiesToEven); -+#endif - bindLocal(ki, state, ConstantExpr::alloc(Res.bitcastToAPInt())); - break; - } --- -2.17.1 - diff --git a/0003-llvm38-handle-optimization-passes-changes.patch b/0003-llvm38-handle-optimization-passes-changes.patch deleted file mode 100644 index ffd2b0f..0000000 --- a/0003-llvm38-handle-optimization-passes-changes.patch +++ /dev/null @@ -1,62 +0,0 @@ -From: Jiri Slaby -Date: Fri, 15 Jun 2018 07:57:23 +0200 -Subject: llvm38: handle optimization passes changes -Patch-mainline: no - -createFunctionAttrsPass was split to createPostOrderFunctionAttrsPass -and createReversePostOrderFunctionAttrsPass in LLVM commit e96fb9ab15d4. - -createGlobalsModRefPass was changed to createGlobalsAAWrapperPass in -LLVM commit 9146833fa313. - -Signed-off-by: Jiri Slaby ---- - lib/Module/Optimize.cpp | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp -index 64e4863f70b3..df7b147d0abe 100644 ---- a/lib/Module/Optimize.cpp -+++ b/lib/Module/Optimize.cpp -@@ -35,6 +35,10 @@ - #include "llvm/Analysis/Verifier.h" - #endif - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+#include "llvm/Analysis/GlobalsModRef.h" -+#endif -+ - using namespace llvm; - - // Don't verify at the end -@@ -102,7 +106,12 @@ static void AddStandardCompilePasses(klee::LegacyLLVMPassManagerTy &PM) { - addPass(PM, createCFGSimplificationPass()); // Clean up after IPCP & DAE - - addPass(PM, createPruneEHPass()); // Remove dead EH info -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ addPass(PM, createPostOrderFunctionAttrsPass()); -+ addPass(PM, createReversePostOrderFunctionAttrsPass()); // Deduce function attrs -+#else - addPass(PM, createFunctionAttrsPass()); // Deduce function attrs -+#endif - - if (!DisableInline) - addPass(PM, createFunctionInliningPass()); // Inline small functions -@@ -217,8 +226,14 @@ void Optimize(Module *M, const std::string &EntryPoint) { - addPass(Passes, createScalarReplAggregatesPass()); // Break up allocas - - // Run a few AA driven optimizations here and now, to cleanup the code. -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ addPass(Passes, createPostOrderFunctionAttrsPass()); -+ addPass(Passes, createReversePostOrderFunctionAttrsPass()); // Add nocapture -+ addPass(Passes, createGlobalsAAWrapperPass()); // IP alias analysis -+#else - addPass(Passes, createFunctionAttrsPass()); // Add nocapture - addPass(Passes, createGlobalsModRefPass()); // IP alias analysis -+#endif - - addPass(Passes, createLICMPass()); // Hoist loop invariants - addPass(Passes, createGVNPass()); // Remove redundancies --- -2.17.1 - 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 new file mode 100644 index 0000000..c95cca2 --- /dev/null +++ b/0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch @@ -0,0 +1,33 @@ +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/0004-llvm38-SmallString-is-always-up-to-date.patch b/0004-llvm38-SmallString-is-always-up-to-date.patch deleted file mode 100644 index e2a506e..0000000 --- a/0004-llvm38-SmallString-is-always-up-to-date.patch +++ /dev/null @@ -1,33 +0,0 @@ -From: Jiri Slaby -Date: Fri, 15 Jun 2018 08:14:39 +0200 -Subject: llvm38: SmallString is always up-to-date -Patch-mainline: no - -No need to flush it, see llvm-mirror/llvm@d4177b2 - -Signed-off-by: Jiri Slaby ---- - tools/klee/main.cpp | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index ab9dfe286ffb..3d73ae07fcb5 100644 ---- a/tools/klee/main.cpp -+++ b/tools/klee/main.cpp -@@ -291,7 +291,12 @@ KleeHandler::KleeHandler(int argc, char **argv) - for (; i <= INT_MAX; ++i) { - SmallString<128> d(directory); - llvm::sys::path::append(d, "klee-out-"); -- raw_svector_ostream ds(d); ds << i; ds.flush(); -+ raw_svector_ostream ds(d); -+ ds << i; -+// SmallString is always up-to-date, no need to flush. See Support/raw_ostream.h -+#if LLVM_VERSION_CODE < LLVM_VERSION(3, 8) -+ ds.flush(); -+#endif - - // create directory and try to link klee-last - if (mkdir(d.c_str(), 0775) == 0) { --- -2.17.1 - diff --git a/0012-llvm40-handle-different-header-names.patch b/0004-llvm40-handle-different-header-names.patch similarity index 76% rename from 0012-llvm40-handle-different-header-names.patch rename to 0004-llvm40-handle-different-header-names.patch index 9e73e5b..75265ad 100644 --- a/0012-llvm40-handle-different-header-names.patch +++ b/0004-llvm40-handle-different-header-names.patch @@ -14,7 +14,7 @@ Signed-off-by: Jiri Slaby 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp -index 75e71c0a557f..232cd88fd621 100644 +index 74d91a8f0122..c041be10313c 100644 --- a/lib/Module/KModule.cpp +++ b/lib/Module/KModule.cpp @@ -21,7 +21,11 @@ @@ -26,25 +26,25 @@ index 75e71c0a557f..232cd88fd621 100644 +#else #include "llvm/Bitcode/ReaderWriter.h" +#endif + #include "llvm/IR/DataLayout.h" + #include "llvm/IR/IRBuilder.h" #include "llvm/IR/Instructions.h" - #include "llvm/IR/LLVMContext.h" - #include "llvm/IR/Module.h" diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index ee4af254dae2..8aa070743048 100644 +index 0e87b5a6deca..c2792454d904 100644 --- a/lib/Module/ModuleUtil.cpp +++ b/lib/Module/ModuleUtil.cpp -@@ -26,7 +26,9 @@ +@@ -24,7 +24,9 @@ + #include "llvm/Object/Archive.h" #include "llvm/Object/Error.h" - #include "llvm/Support/FileSystem.h" - #include "llvm/Support/SourceMgr.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" - #if LLVM_VERSION_CODE < LLVM_VERSION(3, 5) - #include "llvm/Linker.h" -@@ -36,8 +38,13 @@ - #include "llvm/IR/AssemblyAnnotationWriter.h" +@@ -43,8 +45,13 @@ + #include "llvm/IR/DiagnosticPrinter.h" #endif +#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) @@ -59,18 +59,18 @@ index ee4af254dae2..8aa070743048 100644 #include "llvm/Support/raw_ostream.h" #include "llvm/Support/Path.h" diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index c0ea4fa54551..154a76feb361 100644 +index 7be5f07cdc0e..c7dc517a8eee 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp -@@ -31,7 +31,6 @@ - #include "llvm/IR/LLVMContext.h" - #include "llvm/Support/Errno.h" - #include "llvm/Support/FileSystem.h" +@@ -23,7 +23,6 @@ + #include "klee/Interpreter.h" + #include "klee/Statistics.h" + -#include "llvm/Bitcode/ReaderWriter.h" - #include "llvm/Support/CommandLine.h" - #include "llvm/Support/ManagedStatic.h" - #include "llvm/Support/MemoryBuffer.h" -@@ -45,6 +44,12 @@ + #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 @@ -84,5 +84,5 @@ index c0ea4fa54551..154a76feb361 100644 #include #include -- -2.17.1 +2.18.0 diff --git a/0013-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch b/0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch similarity index 89% rename from 0013-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch rename to 0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch index b5277fb..bf1ce84 100644 --- a/0013-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch +++ b/0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch @@ -9,10 +9,10 @@ Signed-off-by: Jiri Slaby 1 file changed, 9 insertions(+) diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index 385920627641..61a54d72f48b 100644 +index 7f69a618b8ec..1a5b7b9df527 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp -@@ -1448,12 +1448,21 @@ static bool isDebugIntrinsic(const Function *f, KModule *KM) { +@@ -1480,12 +1480,21 @@ static bool isDebugIntrinsic(const Function *f, KModule *KM) { static inline const llvm::fltSemantics * fpWidthToSemantics(unsigned width) { switch(width) { @@ -35,5 +35,5 @@ index 385920627641..61a54d72f48b 100644 return 0; } -- -2.17.1 +2.18.0 diff --git a/0005-llvm38-materializeAllPermanently-was-renamed.patch b/0005-llvm38-materializeAllPermanently-was-renamed.patch deleted file mode 100644 index 82c4653..0000000 --- a/0005-llvm38-materializeAllPermanently-was-renamed.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: Jiri Slaby -Date: Fri, 15 Jun 2018 08:19:39 +0200 -Subject: llvm38: materializeAllPermanently was renamed -Patch-mainline: no - -To materializeAll. Happened in LLVM commit 838f8a4b1db2. - -Signed-off-by: Jiri Slaby ---- - lib/Module/ModuleUtil.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index b07d3d2fe348..ce52819d2579 100644 ---- a/lib/Module/ModuleUtil.cpp -+++ b/lib/Module/ModuleUtil.cpp -@@ -639,7 +639,11 @@ Module *klee::loadModule(LLVMContext &ctx, const std::string &path, std::string - auto module = *errorOrModule; - #endif - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ if (auto ec = module->materializeAll()) { -+#else - if (auto ec = module->materializeAllPermanently()) { -+#endif - errorMsg = ec.message(); - return nullptr; - } --- -2.17.1 - diff --git a/0006-llvm38-adapt-to-new-Linker-linkModules.patch b/0006-llvm38-adapt-to-new-Linker-linkModules.patch deleted file mode 100644 index 5967cce..0000000 --- a/0006-llvm38-adapt-to-new-Linker-linkModules.patch +++ /dev/null @@ -1,72 +0,0 @@ -From: Jiri Slaby -Date: Fri, 15 Jun 2018 08:21:39 +0200 -Subject: llvm38: adapt to new Linker::linkModules -Patch-mainline: no - -LLVM commit d912be98f8eb changed the prototype of linkModules to accept -std::unique_ptr. Adapt to that. - -Signed-off-by: Jiri Slaby ---- - lib/Module/ModuleUtil.cpp | 15 +++++++++++++-- - 1 file changed, 13 insertions(+), 2 deletions(-) - -diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index ce52819d2579..025b7374fcf9 100644 ---- a/lib/Module/ModuleUtil.cpp -+++ b/lib/Module/ModuleUtil.cpp -@@ -343,7 +343,9 @@ 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 LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ if (Linker::linkModules(*composite, std::unique_ptr(M))) -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) - if (Linker::LinkModules(composite, M)) - #else - if (Linker::LinkModules(composite, M, Linker::DestroySource, &errorMessage)) -@@ -360,8 +362,10 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - // Link succeed, now clean up - modulesLoadedOnPass++; - KLEE_DEBUG_WITH_TYPE("klee_linker", dbgs() << "Linking succeeded.\n"); -- -+// M was owned by linkModules function -+#if LLVM_VERSION_CODE < LLVM_VERSION(3, 8) - delete M; -+#endif - archiveModules[i] = 0; - - // We need to recompute the undefined symbols in the composite module -@@ -427,7 +431,9 @@ Module *klee::linkWithLibrary(Module *module, - std::string ErrorMessage; - - if (magic == sys::fs::file_magic::bitcode) { -+#if LLVM_VERSION_CODE < LLVM_VERSION(3, 8) - Module *Result = 0; -+#endif - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) - ErrorOr > ResultErr = -@@ -445,6 +451,10 @@ Module *klee::linkWithLibrary(Module *module, - ErrorMessage.c_str()); - } - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ if (Linker::linkModules(*module, std::move(ResultErr.get()))) { -+ ErrorMessage = "linking error"; -+#else - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) - Result = ResultErr->release(); - #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -@@ -456,6 +466,7 @@ Module *klee::linkWithLibrary(Module *module, - ErrorMessage = "linking error"; - #else - if (Linker::LinkModules(module, Result, Linker::DestroySource, &ErrorMessage)) { -+#endif - #endif - klee_error("Link with library %s failed: %s", libraryName.c_str(), - ErrorMessage.c_str()); --- -2.17.1 - diff --git a/0006-llvm40-errorOr-and-similar.patch b/0006-llvm40-errorOr-and-similar.patch new file mode 100644 index 0000000..6ec7328 --- /dev/null +++ b/0006-llvm40-errorOr-and-similar.patch @@ -0,0 +1,53 @@ +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-llvm-use-chrono-helpers-from-LLVM-4.0.patch b/0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch similarity index 97% rename from 0015-llvm-use-chrono-helpers-from-LLVM-4.0.patch rename to 0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch index da58b96..4556bdd 100644 --- a/0015-llvm-use-chrono-helpers-from-LLVM-4.0.patch +++ b/0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch @@ -69,10 +69,10 @@ index 220e260c975e..12522c866439 100644 } diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp -index 7881f0e84be5..0be727fbc346 100644 +index 97e7fccb5e3c..ecf90bd0126a 100644 --- a/lib/Core/StatsTracker.cpp +++ b/lib/Core/StatsTracker.cpp -@@ -286,6 +286,29 @@ void StatsTracker::done() { +@@ -285,6 +285,29 @@ void StatsTracker::done() { void StatsTracker::stepInstruction(ExecutionState &es) { if (OutputIStats) { if (TrackInstructionTime) { @@ -102,7 +102,7 @@ index 7881f0e84be5..0be727fbc346 100644 static sys::TimeValue lastNowTime(0,0),lastUserTime(0,0); if (lastUserTime.seconds()==0 && lastUserTime.nanoseconds()==0) { -@@ -301,6 +324,7 @@ void StatsTracker::stepInstruction(ExecutionState &es) { +@@ -300,6 +323,7 @@ void StatsTracker::stepInstruction(ExecutionState &es) { lastUserTime = user; lastNowTime = now; } @@ -195,5 +195,5 @@ index da96981079ae..a223b39ada57 100644 + +#endif -- -2.17.1 +2.18.0 diff --git a/0007-llvm38-archive-child-iterator-changes.patch b/0007-llvm38-archive-child-iterator-changes.patch deleted file mode 100644 index 269877e..0000000 --- a/0007-llvm38-archive-child-iterator-changes.patch +++ /dev/null @@ -1,61 +0,0 @@ -From: Jiri Slaby -Date: Fri, 15 Jun 2018 08:28:22 +0200 -Subject: llvm38: archive child iterator changes -Patch-mainline: no - -After LLVM commit 25569fdcdab0, archive iterator returns -object::Archive::Child instead of child_iterator, adapt to that. - -Signed-off-by: Jiri Slaby ---- - lib/Module/ModuleUtil.cpp | 20 ++++++++++++++++---- - 1 file changed, 16 insertions(+), 4 deletions(-) - -diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index 025b7374fcf9..e6d592b135b6 100644 ---- a/lib/Module/ModuleUtil.cpp -+++ b/lib/Module/ModuleUtil.cpp -@@ -207,8 +207,19 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - - StringRef memberName; - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -- ErrorOr memberNameErr = AI->getName(); -- std::error_code ec = memberNameErr.getError(); -+ std::error_code ec; -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ ErrorOr childErr = *AI; -+ ec = childErr.getError(); -+ if (ec) { -+ errorMessage = ec.message(); -+ return false; -+ } -+#else -+ object::Archive::child_iterator childErr = AI; -+#endif -+ ErrorOr memberNameErr = childErr->getName(); -+ ec = memberNameErr.getError(); - if (!ec) { - memberName = memberNameErr.get(); - #else -@@ -226,7 +237,8 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - } - - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -- ErrorOr > child = AI->getAsBinary(); -+ ErrorOr > child = -+ childErr->getAsBinary(); - ec = child.getError(); - #else - OwningPtr child; -@@ -235,7 +247,7 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - 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 buff = AI->getMemoryBufferRef(); -+ ErrorOr buff = childErr->getMemoryBufferRef(); - ec = buff.getError(); - #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) - ErrorOr > buffErr = AI->getMemoryBuffer(); --- -2.17.1 - diff --git a/0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch b/0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch similarity index 94% rename from 0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch rename to 0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch index 8f01086..26e49a2 100644 --- a/0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch +++ b/0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch @@ -27,10 +27,10 @@ index 5fb9f4ec5c2f..bf7cb6ff0bea 100644 CurTy = 0; } diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index 61a54d72f48b..f994a82e2df7 100644 +index 1a5b7b9df527..51d36b352e5c 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp -@@ -2589,8 +2589,7 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) { +@@ -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())); @@ -40,7 +40,7 @@ index 61a54d72f48b..f994a82e2df7 100644 uint64_t elementSize = kmodule->targetData->getTypeStoreSize(set->getElementType()); Value *operand = ii.getOperand(); -@@ -2604,7 +2603,24 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) { +@@ -2636,7 +2635,24 @@ void Executor::computeOffsets(KGEPInstruction *kgepi, TypeIt ib, TypeIt ie) { } else { kgepi->indices.push_back(std::make_pair(index, elementSize)); } @@ -67,5 +67,5 @@ index 61a54d72f48b..f994a82e2df7 100644 } kgepi->offset = constantOffset->getZExtValue(); -- -2.17.1 +2.18.0 diff --git a/0008-llvm38-no-more-implicit-iterators.patch b/0008-llvm38-no-more-implicit-iterators.patch deleted file mode 100644 index 965a9a7..0000000 --- a/0008-llvm38-no-more-implicit-iterators.patch +++ /dev/null @@ -1,78 +0,0 @@ -From: =?UTF-8?q?Richard=20Trembeck=C3=BD?= -Date: Wed, 4 May 2016 15:21:45 +0200 -Subject: llvm38: no more implicit iterators -Patch-mainline: no - -LLVM commit eac309550f25 removed implicit iterator conversions. So we -have to get the iterators explicitly now. - -Signed-off-by: Jiri Slaby ---- - lib/Core/StatsTracker.cpp | 4 ++++ - lib/Module/IntrinsicCleaner.cpp | 4 ++++ - lib/Module/LowerSwitch.cpp | 8 ++++++++ - 3 files changed, 16 insertions(+) - -diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp -index f2a989e28439..7881f0e84be5 100644 ---- a/lib/Core/StatsTracker.cpp -+++ b/lib/Core/StatsTracker.cpp -@@ -637,7 +637,11 @@ static std::vector getSuccs(Instruction *i) { - for (succ_iterator it = succ_begin(bb), ie = succ_end(bb); it != ie; ++it) - res.push_back(&*(it->begin())); - } else { -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ res.push_back(&*(++(i->getIterator()))); -+#else - res.push_back(&*(++BasicBlock::iterator(i))); -+#endif - } - - return res; -diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp -index 3729ff82cd9d..0f7eb223a2d3 100644 ---- a/lib/Module/IntrinsicCleaner.cpp -+++ b/lib/Module/IntrinsicCleaner.cpp -@@ -110,7 +110,11 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { - case Intrinsic::uadd_with_overflow: - case Intrinsic::usub_with_overflow: - case Intrinsic::umul_with_overflow: { -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ IRBuilder<> builder(ii->getParent(), ii->getIterator()); -+#else - IRBuilder<> builder(ii->getParent(), ii); -+#endif - - Value *op1 = ii->getArgOperand(0); - Value *op2 = ii->getArgOperand(1); -diff --git a/lib/Module/LowerSwitch.cpp b/lib/Module/LowerSwitch.cpp -index 0f4e8b1eb72b..056885219e85 100644 ---- a/lib/Module/LowerSwitch.cpp -+++ b/lib/Module/LowerSwitch.cpp -@@ -64,7 +64,11 @@ void LowerSwitchPass::switchConvert(CaseItr begin, CaseItr end, - // iterate through all the cases, creating a new BasicBlock for each - for (CaseItr it = begin; it < end; ++it) { - BasicBlock *newBlock = BasicBlock::Create(F->getContext(), "NodeBlock"); -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ Function::iterator FI = origBlock->getIterator(); -+#else - Function::iterator FI = origBlock; -+#endif - F->getBasicBlockList().insert(++FI, newBlock); - - ICmpInst *cmpInst = -@@ -101,7 +105,11 @@ void LowerSwitchPass::processSwitchInst(SwitchInst *SI) { - // if-then statements go to this and the PHI nodes are happy. - BasicBlock* newDefault = BasicBlock::Create(F->getContext(), "newDefault"); - -+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+ F->getBasicBlockList().insert(defaultBlock->getIterator(), newDefault); -+#else - F->getBasicBlockList().insert(defaultBlock, newDefault); -+#endif - BranchInst::Create(defaultBlock, newDefault); - - // If there is an entry in any PHI nodes for the default edge, make sure --- -2.17.1 - diff --git a/0009-llvm38-test-change-some-tests.patch b/0009-llvm38-test-change-some-tests.patch deleted file mode 100644 index 2db27ca..0000000 --- a/0009-llvm38-test-change-some-tests.patch +++ /dev/null @@ -1,155 +0,0 @@ -From: Jiri Slaby -Date: Wed, 1 Nov 2017 09:25:47 +0100 -Subject: llvm38: test, change some tests -Patch-mainline: no - -alias in LLVM 3.8 has a new format, it adds an AliaseeTy parameter. So -handle this in the tests. - -[v2] add comments about what was changed and why - -Signed-off-by: Jiri Slaby ---- - test/Feature/BitcastAlias.leq37.ll | 38 ++++++++++++++++++++++++++ - test/Feature/BitcastAlias.ll | 5 ++-- - test/Feature/BitcastAliasMD2U.leq37.ll | 38 ++++++++++++++++++++++++++ - test/Feature/BitcastAliasMD2U.ll | 5 ++-- - 4 files changed, 82 insertions(+), 4 deletions(-) - create mode 100644 test/Feature/BitcastAlias.leq37.ll - create mode 100644 test/Feature/BitcastAliasMD2U.leq37.ll - -diff --git a/test/Feature/BitcastAlias.leq37.ll b/test/Feature/BitcastAlias.leq37.ll -new file mode 100644 -index 000000000000..e860acb24594 ---- /dev/null -+++ b/test/Feature/BitcastAlias.leq37.ll -@@ -0,0 +1,38 @@ -+; LLVM 3.7 requires a type as the first argument to 'getelementptr' -+; LLVM 3.7 no longer accepts '*' with a 'call' -+; REQUIRES: geq-llvm-3.7 -+; 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 -+; RUN: grep PASS %t2 -+ -+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" -+target triple = "x86_64-unknown-linux-gnu" -+ -+@foo = alias i32 (i32)* @__foo -+ -+define i32 @__foo(i32 %i) nounwind { -+entry: -+ ret i32 %i -+} -+ -+declare i32 @puts(i8*) -+ -+@.passstr = private constant [5 x i8] c"PASS\00", align 1 -+@.failstr = private constant [5 x i8] c"FAIL\00", align 1 -+ -+define i32 @main(i32 %argc, i8** nocapture %argv) nounwind readnone { -+entry: -+ %call = call i32 (i64) bitcast (i32 (i32)* @foo to i32 (i64)*)(i64 52) -+ %r = icmp eq i32 %call, 52 -+ br i1 %r, label %bbtrue, label %bbfalse -+ -+bbtrue: -+ %0 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.passstr, i64 0, i64 0)) nounwind -+ ret i32 0 -+ -+bbfalse: -+ %1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.failstr, i64 0, i64 0)) nounwind -+ ret i32 0 -+} -diff --git a/test/Feature/BitcastAlias.ll b/test/Feature/BitcastAlias.ll -index 5bd301936e13..5111f18e53aa 100644 ---- a/test/Feature/BitcastAlias.ll -+++ b/test/Feature/BitcastAlias.ll -@@ -1,6 +1,7 @@ -+; LLVM 3.8 requires a type as the first argument to 'alias' - ; LLVM 3.7 requires a type as the first argument to 'getelementptr' - ; LLVM 3.7 no longer accepts '*' with a 'call' --; REQUIRES: geq-llvm-3.7 -+; 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 -@@ -9,7 +10,7 @@ - target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" - target triple = "x86_64-unknown-linux-gnu" - --@foo = alias i32 (i32)* @__foo -+@foo = alias i32 (i32), i32 (i32)* @__foo - - define i32 @__foo(i32 %i) nounwind { - entry: -diff --git a/test/Feature/BitcastAliasMD2U.leq37.ll b/test/Feature/BitcastAliasMD2U.leq37.ll -new file mode 100644 -index 000000000000..c29ec8a62243 ---- /dev/null -+++ b/test/Feature/BitcastAliasMD2U.leq37.ll -@@ -0,0 +1,38 @@ -+; LLVM 3.7 requires a type as the first argument to 'getelementptr' -+; LLVM 3.7 no longer accepts '*' with a 'call' -+; REQUIRES: geq-llvm-3.7 -+; 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 -+; RUN: grep PASS %t2 -+ -+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" -+target triple = "x86_64-unknown-linux-gnu" -+ -+@foo = alias i32 (i32)* @__foo -+ -+define i32 @__foo(i32 %i) nounwind { -+entry: -+ ret i32 %i -+} -+ -+declare i32 @puts(i8*) -+ -+@.passstr = private constant [5 x i8] c"PASS\00", align 1 -+@.failstr = private constant [5 x i8] c"FAIL\00", align 1 -+ -+define i32 @main(i32 %argc, i8** nocapture %argv) nounwind readnone { -+entry: -+ %call = call i32 (i64) bitcast (i32 (i32)* @foo to i32 (i64)*)(i64 52) -+ %r = icmp eq i32 %call, 52 -+ br i1 %r, label %bbtrue, label %bbfalse -+ -+bbtrue: -+ %0 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.passstr, i64 0, i64 0)) nounwind -+ ret i32 0 -+ -+bbfalse: -+ %1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.failstr, i64 0, i64 0)) nounwind -+ ret i32 0 -+} -diff --git a/test/Feature/BitcastAliasMD2U.ll b/test/Feature/BitcastAliasMD2U.ll -index 7eddd3d6a01c..7ef74a8da43c 100644 ---- a/test/Feature/BitcastAliasMD2U.ll -+++ b/test/Feature/BitcastAliasMD2U.ll -@@ -1,6 +1,7 @@ -+; LLVM 3.8 requires a type as the first argument to 'alias' - ; LLVM 3.7 requires a type as the first argument to 'getelementptr' - ; LLVM 3.7 no longer accepts '*' with a 'call' --; REQUIRES: geq-llvm-3.7 -+; 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 -@@ -9,7 +10,7 @@ - target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" - target triple = "x86_64-unknown-linux-gnu" - --@foo = alias i32 (i32)* @__foo -+@foo = alias i32 (i32), i32 (i32)* @__foo - - define i32 @__foo(i32 %i) nounwind { - entry: --- -2.17.1 - diff --git a/0017-llvm40-gep_type_iterator-has-no-operator.patch b/0009-llvm40-gep_type_iterator-has-no-operator.patch similarity index 99% rename from 0017-llvm40-gep_type_iterator-has-no-operator.patch rename to 0009-llvm40-gep_type_iterator-has-no-operator.patch index e78279c..3fd8a5b 100644 --- a/0017-llvm40-gep_type_iterator-has-no-operator.patch +++ b/0009-llvm40-gep_type_iterator-has-no-operator.patch @@ -28,5 +28,5 @@ index a352db3339c4..7718ae9d0ccb 100644 const StructLayout *SL = kmodule->targetData->getStructLayout(STy); base = base->Add( -- -2.17.1 +2.18.0 diff --git a/0018-llvm50-avoid-on-function-arg_begin.patch b/0010-llvm50-avoid-on-function-arg_begin.patch similarity index 81% rename from 0018-llvm50-avoid-on-function-arg_begin.patch rename to 0010-llvm50-avoid-on-function-arg_begin.patch index ba6053a..ce17eeb 100644 --- a/0018-llvm50-avoid-on-function-arg_begin.patch +++ b/0010-llvm50-avoid-on-function-arg_begin.patch @@ -18,10 +18,10 @@ Signed-off-by: Jiri Slaby 1 file changed, 8 insertions(+) diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index 154a76feb361..def83b584167 100644 +index c7dc517a8eee..883be83a4130 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp -@@ -658,7 +658,11 @@ static int initEnv(Module *mainModule) { +@@ -655,7 +655,11 @@ static void initEnv(Module *mainModule) { Instruction *firstInst = &*(mainFn->begin()->begin()); Value *oldArgc = &*(mainFn->arg_begin()); @@ -33,9 +33,9 @@ index 154a76feb361..def83b584167 100644 AllocaInst* argcPtr = new AllocaInst(oldArgc->getType(), "argcPtr", firstInst); -@@ -1117,7 +1121,11 @@ static llvm::Module *linkWithUclibc(llvm::Module *mainModule, StringRef libDir) - args.push_back(llvm::ConstantExpr::getBitCast(userMainFn, - ft->getParamType(0))); +@@ -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 @@ -46,5 +46,5 @@ index 154a76feb361..def83b584167 100644 args.push_back(Constant::getNullValue(ft->getParamType(4))); // app_fini args.push_back(Constant::getNullValue(ft->getParamType(5))); // rtld_fini -- -2.17.1 +2.18.0 diff --git a/0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch b/0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch similarity index 89% rename from 0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch rename to 0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch index 3be6409..2469674 100644 --- a/0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch +++ b/0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch @@ -12,10 +12,10 @@ Signed-off-by: Jiri Slaby 1 file changed, 4 insertions(+) diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp -index f73d1614c250..5433d9211ead 100644 +index a5c7f652e976..65e858c3336d 100644 --- a/lib/Expr/Expr.cpp +++ b/lib/Expr/Expr.cpp -@@ -328,7 +328,11 @@ ref ConstantExpr::fromMemory(void *address, Width width) { +@@ -333,7 +333,11 @@ ref ConstantExpr::fromMemory(void *address, Width width) { // FIXME: what about machines without x87 support? default: return ConstantExpr::alloc(llvm::APInt(width, @@ -28,5 +28,5 @@ index f73d1614c250..5433d9211ead 100644 } } -- -2.17.1 +2.18.0 diff --git a/0020-llvm50-handle-getOrInsertFunction-terminator.patch b/0012-llvm50-handle-getOrInsertFunction-terminator.patch similarity index 61% rename from 0020-llvm50-handle-getOrInsertFunction-terminator.patch rename to 0012-llvm50-handle-getOrInsertFunction-terminator.patch index f209c3d..d1b5ddd 100644 --- a/0020-llvm50-handle-getOrInsertFunction-terminator.patch +++ b/0012-llvm50-handle-getOrInsertFunction-terminator.patch @@ -10,11 +10,11 @@ Since commit 9d54400bba7eb04bca80fce97fa170452d19eaf1. 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 | 20 ++++++++++---------- - 4 files changed, 22 insertions(+), 15 deletions(-) + 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(-) diff --git a/include/klee/Config/Version.h b/include/klee/Config/Version.h index 532051602fe3..a02ce28baaae 100644 @@ -58,11 +58,11 @@ index aac63e1d9854..406b3045e527 100644 } diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp -index 0f7eb223a2d3..4d323b8e8344 100644 +index c48952c28004..ab16a2654492 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp @@ -210,7 +210,8 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { - // Intrisic instruction "llvm.trap" found. Directly lower it to + // Intrinsic instruction "llvm.trap" found. Directly lower it to // a call of the abort() function. Function *F = cast( - M.getOrInsertFunction("abort", Type::getVoidTy(ctx), NULL)); @@ -72,10 +72,10 @@ index 0f7eb223a2d3..4d323b8e8344 100644 F->setDoesNotThrow(); diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index def83b584167..ff87d210b863 100644 +index 883be83a4130..c0805f457717 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp -@@ -678,8 +678,8 @@ static int initEnv(Module *mainModule) { +@@ -675,8 +675,8 @@ static void initEnv(Module *mainModule) { cast(mainModule->getOrInsertFunction("klee_init_env", Type::getVoidTy(ctx), argcPtr->getType(), @@ -86,35 +86,6 @@ index def83b584167..ff87d210b863 100644 assert(initEnvFn); std::vector args; args.push_back(argcPtr); -@@ -1038,20 +1038,20 @@ static llvm::Module *linkWithUclibc(llvm::Module *mainModule, StringRef libDir) - mainModule->getOrInsertFunction("realpath", - PointerType::getUnqual(i8Ty), - PointerType::getUnqual(i8Ty), -- PointerType::getUnqual(i8Ty), -- NULL); -+ PointerType::getUnqual(i8Ty) -+ KLEE_LLVM_GOIF_TERMINATOR); - mainModule->getOrInsertFunction("getutent", -- PointerType::getUnqual(i8Ty), -- NULL); -+ PointerType::getUnqual(i8Ty) -+ KLEE_LLVM_GOIF_TERMINATOR); - mainModule->getOrInsertFunction("__fgetc_unlocked", - Type::getInt32Ty(ctx), -- PointerType::getUnqual(i8Ty), -- NULL); -+ PointerType::getUnqual(i8Ty) -+ KLEE_LLVM_GOIF_TERMINATOR); - mainModule->getOrInsertFunction("__fputc_unlocked", - Type::getInt32Ty(ctx), - Type::getInt32Ty(ctx), -- PointerType::getUnqual(i8Ty), -- NULL); -+ PointerType::getUnqual(i8Ty) -+ KLEE_LLVM_GOIF_TERMINATOR); - } - - f = mainModule->getFunction("__ctype_get_mb_cur_max"); -- -2.17.1 +2.18.0 diff --git a/0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch b/0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch similarity index 92% rename from 0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch rename to 0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch index cfed880..d8dfb78 100644 --- a/0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch +++ b/0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch @@ -15,10 +15,10 @@ Signed-off-by: Jiri Slaby 1 file changed, 4 insertions(+) diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp -index f994a82e2df7..bca2eb6e06a7 100644 +index 51d36b352e5c..75af0fd09bd8 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp -@@ -1641,7 +1641,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { +@@ -1673,7 +1673,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { // switch to an internal rep. llvm::IntegerType *Ty = cast(si->getCondition()->getType()); ConstantInt *ci = ConstantInt::get(Ty, CE->getZExtValue()); @@ -31,5 +31,5 @@ index f994a82e2df7..bca2eb6e06a7 100644 } else { // Handle possible different branch targets -- -2.17.1 +2.18.0 diff --git a/0014-llvm40-errorOr-and-similar.patch b/0014-llvm40-errorOr-and-similar.patch deleted file mode 100644 index 776e435..0000000 --- a/0014-llvm40-errorOr-and-similar.patch +++ /dev/null @@ -1,128 +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 | 50 ++++++++++++++++++++++++++++++++------- - 1 file changed, 41 insertions(+), 9 deletions(-) - -diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index 8aa070743048..ad847de0b368 100644 ---- a/lib/Module/ModuleUtil.cpp -+++ b/lib/Module/ModuleUtil.cpp -@@ -204,7 +204,7 @@ 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, 9) -- Error Err; -+ Error Err = Error::success(); - 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) -@@ -229,8 +229,14 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - #else - object::Archive::child_iterator childErr = AI; - #endif -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ Expected memberNameErr = childErr->getName(); -+ ec = memberNameErr ? std::error_code() : -+ errorToErrorCode(memberNameErr.takeError()); -+#else - ErrorOr memberNameErr = childErr->getName(); - ec = memberNameErr.getError(); -+#endif - if (!ec) { - memberName = memberNameErr.get(); - #else -@@ -267,7 +273,10 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - #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 = childErr->getMemoryBufferRef(); -+ ec = buff ? std::error_code() : errorToErrorCode(buff.takeError()); -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) - ErrorOr buff = childErr->getMemoryBufferRef(); - ec = buff.getError(); - #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -@@ -291,13 +300,20 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er - 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) --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ Expected > resultErr = -+ parseBitcodeFile(buff.get(), composite->getContext()); -+ ec = resultErr ? std::error_code() : -+ errorToErrorCode(resultErr.takeError()); -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) - ErrorOr > resultErr = -+ parseBitcodeFile(buff.get(), composite->getContext()); -+ ec = resultErr.getError(); - #else - ErrorOr resultErr = --#endif - parseBitcodeFile(buff.get(), composite->getContext()); - ec = resultErr.getError(); -+#endif - if (ec) - errorMessage = ec.message(); - else -@@ -474,7 +490,12 @@ Module *klee::linkWithLibrary(Module *module, - #if LLVM_VERSION_CODE < LLVM_VERSION(3, 8) - Module *Result = 0; - #endif --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ Expected > ResultErr = -+ parseBitcodeFile(Buffer, Context); -+ if (!ResultErr) { -+ ErrorMessage = errorToErrorCode(ResultErr.takeError()).message(); -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) - #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) - ErrorOr > ResultErr = - #else -@@ -680,14 +701,22 @@ Module *klee::loadModule(LLVMContext &ctx, const std::string &path, std::string - return nullptr; - } - --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) -+ std::error_code ec; -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ Expected> errorOrModule = -+ getOwningLazyBitcodeModule(std::move(buffer.get()), ctx); -+ ec = errorOrModule ? std::error_code() : -+ errorToErrorCode(errorOrModule.takeError()); -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) - auto errorOrModule = getLazyBitcodeModule(std::move(buffer.get()), ctx); -+ ec = errorOrModule.getError(); - #else - auto errorOrModule = getLazyBitcodeModule(buffer->get(), ctx); -+ ec = errorOrModule.getError(); - #endif - -- if (!errorOrModule) { -- errorMsg = errorOrModule.getError().message().c_str(); -+ if (ec) { -+ errorMsg = ec.message(); - return nullptr; - } - // The module has taken ownership of the MemoryBuffer so release it -@@ -699,7 +728,10 @@ Module *klee::loadModule(LLVMContext &ctx, const std::string &path, std::string - auto module = *errorOrModule; - #endif - --#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) -+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) -+ if (llvm::Error err = module->materializeAll()) { -+ std::error_code ec = errorToErrorCode(std::move(err)); -+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) - if (auto ec = module->materializeAll()) { - #else - if (auto ec = module->materializeAllPermanently()) { --- -2.17.1 - diff --git a/0022-llvm50-handle-new-file_magic-s-location.patch b/0014-llvm50-handle-new-file_magic-s-location.patch similarity index 67% rename from 0022-llvm50-handle-new-file_magic-s-location.patch rename to 0014-llvm50-handle-new-file_magic-s-location.patch index c1b8857..ac521e2 100644 --- a/0022-llvm50-handle-new-file_magic-s-location.patch +++ b/0014-llvm50-handle-new-file_magic-s-location.patch @@ -6,17 +6,13 @@ Patch-mainline: no llvm 5, moved file_magic to BinaryFormat in commit 19ca2b0f9daed883c21730285d7f04424e5f5f88, so adapt to that. -Signed-off-by: Jiri Slaby - -` - Signed-off-by: Jiri Slaby --- lib/Module/ModuleUtil.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp -index ad847de0b368..5f967410568c 100644 +index 7f4bdb49380a..f1dbdb13bcff 100644 --- a/lib/Module/ModuleUtil.cpp +++ b/lib/Module/ModuleUtil.cpp @@ -14,6 +14,9 @@ @@ -26,10 +22,10 @@ index ad847de0b368..5f967410568c 100644 +#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) +#include "llvm/BinaryFormat/Magic.h" +#endif - #include "llvm/IRReader/IRReader.h" #include "llvm/IR/Function.h" #include "llvm/IR/Instructions.h" -@@ -477,7 +480,9 @@ Module *klee::linkWithLibrary(Module *module, + #include "llvm/IR/IntrinsicInst.h" +@@ -380,13 +383,19 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context, MemoryBuffer *Buffer = bufferErr->get(); #endif @@ -40,30 +36,28 @@ index ad847de0b368..5f967410568c 100644 sys::fs::file_magic magic = sys::fs::identify_magic(Buffer.getBuffer()); #else sys::fs::file_magic magic = sys::fs::identify_magic(Buffer->getBuffer()); -@@ -486,7 +491,11 @@ Module *klee::linkWithLibrary(Module *module, - LLVMContext &Context = module->getContext(); - std::string ErrorMessage; + #endif +#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) + if (magic == file_magic::bitcode) { +#else if (magic == sys::fs::file_magic::bitcode) { +#endif - #if LLVM_VERSION_CODE < LLVM_VERSION(3, 8) - Module *Result = 0; - #endif -@@ -538,7 +547,11 @@ Module *klee::linkWithLibrary(Module *module, - delete Result; - #endif + 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, + return true; + } +#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) -+ } else if (magic == file_magic::archive) { ++ if (magic == file_magic::archive) { +#else - } else if (magic == sys::fs::file_magic::archive) { + if (magic == sys::fs::file_magic::archive) { +#endif #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9) - Expected > arch = - object::createBinary(Buffer, &Context); + Expected > archOwner = + object::createBinary(Buffer, &context); -- -2.17.1 +2.18.0 diff --git a/0023-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch b/0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch similarity index 90% rename from 0023-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch rename to 0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch index f0406dd..e049913 100644 --- a/0023-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch +++ b/0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch @@ -13,10 +13,10 @@ 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 bca2eb6e06a7..70337c000cd2 100644 +index 75af0fd09bd8..46fd2be42351 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp -@@ -2294,7 +2294,12 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { +@@ -2326,7 +2326,12 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { llvm::APFloat Arg(*fpWidthToSemantics(arg->getWidth()), arg->getAPValue()); uint64_t value = 0; bool isExact = true; @@ -30,7 +30,7 @@ index bca2eb6e06a7..70337c000cd2 100644 llvm::APFloat::rmTowardZero, &isExact); bindLocal(ki, state, ConstantExpr::alloc(value, resultType)); break; -@@ -2311,7 +2316,12 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { +@@ -2343,7 +2348,12 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { uint64_t value = 0; bool isExact = true; @@ -45,5 +45,5 @@ index bca2eb6e06a7..70337c000cd2 100644 bindLocal(ki, state, ConstantExpr::alloc(value, resultType)); break; -- -2.17.1 +2.18.0 diff --git a/0024-llvm50-AllocaInst-takes-address-space.patch b/0016-llvm50-AllocaInst-takes-address-space.patch similarity index 91% rename from 0024-llvm50-AllocaInst-takes-address-space.patch rename to 0016-llvm50-AllocaInst-takes-address-space.patch index 320a873..b0cbeaf 100644 --- a/0024-llvm50-AllocaInst-takes-address-space.patch +++ b/0016-llvm50-AllocaInst-takes-address-space.patch @@ -12,10 +12,10 @@ Signed-off-by: Jiri Slaby 1 file changed, 8 insertions(+) diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp -index ff87d210b863..c85fee861f03 100644 +index c0805f457717..d45a92160e59 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp -@@ -664,10 +664,18 @@ static int initEnv(Module *mainModule) { +@@ -661,10 +661,18 @@ static void initEnv(Module *mainModule) { Value *oldArgv = &*(++mainFn->arg_begin()); #endif @@ -35,5 +35,5 @@ index ff87d210b863..c85fee861f03 100644 /* Insert void klee_init_env(int* argc, char*** argv) */ std::vector params; -- -2.17.1 +2.18.0 diff --git a/0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch b/0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch similarity index 94% rename from 0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch rename to 0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch index cb1d2c8..88e909a 100644 --- a/0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch +++ b/0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch @@ -14,10 +14,10 @@ Signed-off-by: Jiri Slaby 1 file changed, 16 insertions(+) diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp -index 4d323b8e8344..e32eeb5880e6 100644 +index ab16a2654492..19807ce08583 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp -@@ -226,13 +226,29 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { +@@ -227,13 +227,29 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { case Intrinsic::objectsize: { // We don't know the size of an object in general so we replace // with 0 or -1 depending on the second argument to the intrinsic. @@ -48,5 +48,5 @@ index 4d323b8e8344..e32eeb5880e6 100644 IntegerType *intType = dyn_cast(ii->getType()); assert(intType && "intrinsic does not have integer return type"); -- -2.17.1 +2.18.0 diff --git a/0026-llvm50-test-change-objectsize.patch b/0018-llvm50-test-change-objectsize.patch similarity index 99% rename from 0026-llvm50-test-change-objectsize.patch rename to 0018-llvm50-test-change-objectsize.patch index 900d2f3..a9ffc80 100644 --- a/0026-llvm50-test-change-objectsize.patch +++ b/0018-llvm50-test-change-objectsize.patch @@ -95,5 +95,5 @@ index 3a111f99c619..95070e66e45c 100644 declare void @abort() noreturn nounwind -- -2.17.1 +2.18.0 diff --git a/0027-llvm50-test-add-disable-O0-optnone-to-O0.patch b/0019-llvm50-test-add-disable-O0-optnone-to-O0.patch similarity index 85% rename from 0027-llvm50-test-add-disable-O0-optnone-to-O0.patch rename to 0019-llvm50-test-add-disable-O0-optnone-to-O0.patch index 3c25384..7183730 100644 --- a/0027-llvm50-test-add-disable-O0-optnone-to-O0.patch +++ b/0019-llvm50-test-add-disable-O0-optnone-to-O0.patch @@ -7,141 +7,181 @@ Otherwise optimizations done in klee won't have any effect. Signed-off-by: Jiri Slaby --- - test/CXX/ArrayNew.cpp | 2 +- - test/CXX/New.cpp | 2 +- - test/CXX/SimpleVirtual.cpp | 2 +- - test/CXX/StaticConstructor.cpp | 2 +- - test/CXX/StaticDestructor.cpp | 2 +- - test/CXX/Trivial.cpp | 2 +- - test/Coverage/ReadArgs.c | 2 +- - test/Coverage/ReplayOutDir.c | 2 +- - test/Feature/AliasFunction.c | 2 +- - test/Feature/AliasFunctionExit.c | 2 +- - test/Feature/ByteSwap.c | 2 +- - test/Feature/CheckForImpliedValue.c.failing | 2 +- - test/Feature/CompressedExprLogging.c | 2 +- - test/Feature/DanglingConcreteReadExpr.c | 2 +- - test/Feature/DoubleFree.c | 2 +- - test/Feature/DumpStatesOnHalt.c | 2 +- - test/Feature/ExitOnErrorType.c | 2 +- - test/Feature/ExprLogging.c | 2 +- - test/Feature/FloatingPt.c | 2 +- - test/Feature/InAndOutOfBounds.c | 2 +- - test/Feature/IsSymbolic.c | 2 +- - test/Feature/KleeReportError.c | 2 +- - test/Feature/LargeReturnTypes.cpp | 2 +- - test/Feature/LinkLLVMLib.c | 4 ++-- - test/Feature/LongDouble.c | 2 +- - test/Feature/LongDoubleSupport.c | 2 +- - test/Feature/MultipleFreeResolution.c | 2 +- - test/Feature/MultipleReadResolution.c | 2 +- - test/Feature/MultipleReallocResolution.c | 2 +- - test/Feature/MultipleWriteResolution.c | 2 +- - test/Feature/OneFreeError.c | 2 +- - test/Feature/OneOutOfBounds.c | 2 +- - test/Feature/Optimize.c | 2 +- - test/Feature/OverlappedError.c | 2 +- - test/Feature/OvershiftCheck.c | 2 +- - test/Feature/PreferCex.c | 2 +- - test/Feature/RaiseAsm.c | 2 +- - test/Feature/Realloc.c | 2 +- - test/Feature/ReplayPath.c | 4 ++-- - test/Feature/RewriteEqualities.c | 2 +- - test/Feature/Searchers.c | 2 +- - test/Feature/SolverTimeout.c | 2 +- - test/Feature/SourceMapping.c | 2 +- - test/Feature/VarArgLongDouble.c | 2 +- - test/Feature/Vararg.c | 2 +- - test/Feature/WithLibc.c | 2 +- - test/Feature/arithmetic-right-overshift-sym-conc.c | 2 +- - test/Feature/consecutive_divide_by_zero.c | 2 +- - test/Feature/const_array_opt1.c | 2 +- - test/Feature/left-overshift-sym-conc.c | 2 +- - test/Feature/logical-right-overshift-sym-conc.c | 2 +- - test/Feature/srem.c | 2 +- - test/Feature/ubsan_signed_overflow.c | 2 +- - test/Feature/ubsan_unsigned_overflow.c | 2 +- - test/Programs/pcregrep.c | 2 +- - test/Replay/libkleeruntest/replay_invalid_klee_assume.c | 2 +- - test/Replay/libkleeruntest/replay_invalid_klee_choose.c | 2 +- - test/Replay/libkleeruntest/replay_invalid_klee_range.c | 2 +- - test/Replay/libkleeruntest/replay_invalid_num_objects.c | 2 +- - test/Replay/libkleeruntest/replay_invalid_object_names.c | 2 +- - test/Replay/libkleeruntest/replay_invalid_object_size.c | 2 +- - test/Replay/libkleeruntest/replay_klee_prefer_cex.c | 2 +- - test/Replay/libkleeruntest/replay_posix_runtime.c | 2 +- - test/Replay/libkleeruntest/replay_simple.c | 2 +- - test/Replay/libkleeruntest/replay_two_objects.c | 2 +- - test/Runtime/POSIX/DirConsistency.c | 4 ++-- - test/Runtime/POSIX/DirSeek.c | 2 +- - test/Runtime/POSIX/FDNumbers.c | 2 +- - test/Runtime/POSIX/FD_Fail.c | 2 +- - test/Runtime/POSIX/FD_Fail2.c | 2 +- - test/Runtime/POSIX/Fcntl.c | 2 +- - test/Runtime/POSIX/FilePerm.c | 2 +- - test/Runtime/POSIX/FileTime.c | 2 +- - test/Runtime/POSIX/FreeArgv.c | 2 +- - test/Runtime/POSIX/Futimesat.c | 2 +- - test/Runtime/POSIX/Getenv.c | 2 +- - test/Runtime/POSIX/Ioctl.c | 2 +- - test/Runtime/POSIX/Isatty.c | 2 +- - test/Runtime/POSIX/MixedConcreteSymbolic.c | 2 +- - test/Runtime/POSIX/Openat.c | 2 +- - test/Runtime/POSIX/PrgName.c | 2 +- - test/Runtime/POSIX/Read1.c | 2 +- - test/Runtime/POSIX/Replay.c | 2 +- - test/Runtime/POSIX/SELinux/SELinux.c | 2 +- - test/Runtime/POSIX/SeedAndFail.c | 2 +- - test/Runtime/POSIX/Stdin.c | 2 +- - test/Runtime/POSIX/Write1.c | 2 +- - test/Runtime/POSIX/Write2.c | 2 +- - .../2007-10-08-optimization-calls-wrong-libc-functions.c | 2 +- - test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c | 2 +- - test/Solver/Z3ConstantArray.c | 2 +- - test/VectorInstructions/extract_element.c | 2 +- - test/VectorInstructions/extract_element_symbolic.c | 2 +- - test/VectorInstructions/floating_point_ops_constant.c | 2 +- - test/VectorInstructions/insert_element.c | 2 +- - test/VectorInstructions/insert_element_symbolic.c | 2 +- - test/VectorInstructions/integer_ops_constant.c | 2 +- - test/VectorInstructions/integer_ops_signed_symbolic.c | 2 +- - test/VectorInstructions/integer_ops_unsigned_symbolic.c | 2 +- - test/VectorInstructions/shuffle_element.c | 2 +- - test/lit.cfg | 2 +- - test/lit.site.cfg.in | 4 ++++ - .../2007-07-25-invalid-stp-array-binding-to-objectstate.c | 2 +- - test/regression/2007-07-30-unflushed-byte.c | 2 +- - .../2007-08-01-cache-unclear-on-overwrite-flushed.c | 2 +- - test/regression/2007-08-06-64bit-shift.c | 2 +- - test/regression/2007-08-06-access-after-free.c | 2 +- - test/regression/2007-08-08-free-zero.c | 2 +- - test/regression/2007-08-16-valid-write-to-freed-object.c | 2 +- - test/regression/2007-10-11-free-of-alloca.c | 2 +- - test/regression/2007-10-12-failed-make-symbolic-after-copy.c | 2 +- - test/regression/2008-03-04-free-of-global.c | 2 +- - test/regression/2008-03-11-free-of-malloc-zero.c | 2 +- - test/regression/2008-04-10-bad-alloca-free.c | 2 +- - test/regression/2008-05-23-gep-with-global-const.c | 2 +- - test/regression/2012-05-13-asm-causes-aborts.c | 2 +- - test/regression/2014-07-04-unflushed-error-report.c | 2 +- - test/regression/2014-09-13-debug-info.c | 2 +- - test/regression/2014-12-08-ashr.c | 2 +- - test/regression/2015-06-22-struct-write.c | 2 +- - test/regression/2015-08-05-invalid-fork.c | 2 +- - test/regression/2015-08-30-empty-constraints.c | 2 +- - test/regression/2015-08-30-sdiv-1.c | 2 +- - test/regression/2016-04-14-sdiv-2.c | 2 +- - test/regression/2016-06-28-div-zero-bug.c | 2 +- - test/regression/2016-08-06-klee-get-obj-size.c | 2 +- - test/regression/2016-08-11-entry-point-internalize-pass.c | 2 +- - test/regression/2016-08-12-empty-file.c | 2 +- - test/regression/2016-11-24-bitcast-weak-alias.c | 2 +- - test/regression/2016-12-14-alloc-alignment.c | 2 +- - test/regression/2017-02-21-pathOS-id.c | 2 +- - test/regression/2017-03-23-early-exit-log-stats.c | 2 +- - .../regression/2018-05-05-number-instructions-dumped-states.c | 2 +- - 133 files changed, 139 insertions(+), 135 deletions(-) + runtime/CMakeLists.txt | 8 +++++++- + runtime/Makefile.cmake.bitcode.rules | 2 +- + test/CXX/ArrayNew.cpp | 2 +- + test/CXX/New.cpp | 2 +- + test/CXX/SimpleVirtual.cpp | 2 +- + test/CXX/StaticConstructor.cpp | 2 +- + test/CXX/StaticDestructor.cpp | 2 +- + test/CXX/Trivial.cpp | 2 +- + test/Coverage/ReadArgs.c | 2 +- + test/Coverage/ReplayOutDir.c | 2 +- + test/Feature/AliasFunction.c | 2 +- + test/Feature/AliasFunctionExit.c | 2 +- + test/Feature/ByteSwap.c | 2 +- + test/Feature/CheckForImpliedValue.c.failing | 2 +- + test/Feature/CompressedExprLogging.c | 2 +- + test/Feature/DanglingConcreteReadExpr.c | 2 +- + test/Feature/DoubleFree.c | 2 +- + test/Feature/DumpStatesOnHalt.c | 2 +- + test/Feature/ExitOnErrorType.c | 2 +- + test/Feature/ExprLogging.c | 2 +- + test/Feature/FloatingPt.c | 2 +- + test/Feature/InAndOutOfBounds.c | 2 +- + test/Feature/IsSymbolic.c | 2 +- + test/Feature/KleeReportError.c | 2 +- + test/Feature/LargeReturnTypes.cpp | 2 +- + test/Feature/LinkLLVMLib.c | 4 ++-- + test/Feature/LongDouble.c | 2 +- + test/Feature/LongDoubleSupport.c | 2 +- + test/Feature/MultipleFreeResolution.c | 2 +- + test/Feature/MultipleReadResolution.c | 2 +- + test/Feature/MultipleReallocResolution.c | 2 +- + test/Feature/MultipleWriteResolution.c | 2 +- + test/Feature/OneFreeError.c | 2 +- + test/Feature/OneOutOfBounds.c | 2 +- + test/Feature/Optimize.c | 2 +- + test/Feature/OverlappedError.c | 2 +- + test/Feature/OvershiftCheck.c | 2 +- + test/Feature/PreferCex.c | 2 +- + test/Feature/RaiseAsm.c | 2 +- + test/Feature/Realloc.c | 2 +- + test/Feature/ReplayPath.c | 4 ++-- + test/Feature/RewriteEqualities.c | 2 +- + test/Feature/Searchers.c | 2 +- + test/Feature/SolverTimeout.c | 2 +- + test/Feature/SourceMapping.c | 2 +- + test/Feature/VarArgLongDouble.c | 2 +- + test/Feature/Vararg.c | 2 +- + test/Feature/WithLibc.c | 2 +- + test/Feature/arithmetic-right-overshift-sym-conc.c | 2 +- + test/Feature/consecutive_divide_by_zero.c | 2 +- + test/Feature/const_array_opt1.c | 2 +- + test/Feature/left-overshift-sym-conc.c | 2 +- + test/Feature/logical-right-overshift-sym-conc.c | 2 +- + test/Feature/srem.c | 2 +- + test/Feature/ubsan_signed_overflow.c | 2 +- + test/Feature/ubsan_unsigned_overflow.c | 2 +- + test/Programs/pcregrep.c | 2 +- + test/Replay/libkleeruntest/replay_invalid_klee_assume.c | 2 +- + test/Replay/libkleeruntest/replay_invalid_klee_choose.c | 2 +- + test/Replay/libkleeruntest/replay_invalid_klee_range.c | 2 +- + test/Replay/libkleeruntest/replay_invalid_num_objects.c | 2 +- + test/Replay/libkleeruntest/replay_invalid_object_names.c | 2 +- + test/Replay/libkleeruntest/replay_invalid_object_size.c | 2 +- + test/Replay/libkleeruntest/replay_klee_prefer_cex.c | 2 +- + test/Replay/libkleeruntest/replay_posix_runtime.c | 2 +- + test/Replay/libkleeruntest/replay_simple.c | 2 +- + test/Replay/libkleeruntest/replay_two_objects.c | 2 +- + test/Runtime/POSIX/DirConsistency.c | 4 ++-- + test/Runtime/POSIX/DirSeek.c | 2 +- + test/Runtime/POSIX/FDNumbers.c | 2 +- + test/Runtime/POSIX/FD_Fail.c | 2 +- + test/Runtime/POSIX/FD_Fail2.c | 2 +- + test/Runtime/POSIX/Fcntl.c | 2 +- + test/Runtime/POSIX/FilePerm.c | 2 +- + test/Runtime/POSIX/FileTime.c | 2 +- + test/Runtime/POSIX/FreeArgv.c | 2 +- + test/Runtime/POSIX/Futimesat.c | 2 +- + test/Runtime/POSIX/Getenv.c | 2 +- + test/Runtime/POSIX/Ioctl.c | 2 +- + test/Runtime/POSIX/Isatty.c | 2 +- + test/Runtime/POSIX/MixedConcreteSymbolic.c | 2 +- + test/Runtime/POSIX/Openat.c | 2 +- + test/Runtime/POSIX/PrgName.c | 2 +- + test/Runtime/POSIX/Read1.c | 2 +- + test/Runtime/POSIX/Replay.c | 2 +- + test/Runtime/POSIX/SELinux/SELinux.c | 2 +- + test/Runtime/POSIX/SeedAndFail.c | 2 +- + test/Runtime/POSIX/Stdin.c | 2 +- + test/Runtime/POSIX/Write1.c | 2 +- + test/Runtime/POSIX/Write2.c | 2 +- + .../2007-10-08-optimization-calls-wrong-libc-functions.c | 2 +- + .../Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c | 2 +- + test/Solver/Z3ConstantArray.c | 2 +- + test/VectorInstructions/extract_element.c | 2 +- + test/VectorInstructions/extract_element_symbolic.c | 2 +- + test/VectorInstructions/floating_point_ops_constant.c | 2 +- + test/VectorInstructions/insert_element.c | 2 +- + test/VectorInstructions/insert_element_symbolic.c | 2 +- + test/VectorInstructions/integer_ops_constant.c | 2 +- + test/VectorInstructions/integer_ops_signed_symbolic.c | 2 +- + test/VectorInstructions/integer_ops_unsigned_symbolic.c | 2 +- + test/VectorInstructions/shuffle_element.c | 2 +- + test/lit.cfg | 2 +- + test/lit.site.cfg.in | 4 ++++ + .../2007-07-25-invalid-stp-array-binding-to-objectstate.c | 2 +- + test/regression/2007-07-30-unflushed-byte.c | 2 +- + .../2007-08-01-cache-unclear-on-overwrite-flushed.c | 2 +- + test/regression/2007-08-06-64bit-shift.c | 2 +- + test/regression/2007-08-06-access-after-free.c | 2 +- + test/regression/2007-08-08-free-zero.c | 2 +- + test/regression/2007-08-16-valid-write-to-freed-object.c | 2 +- + test/regression/2007-10-11-free-of-alloca.c | 2 +- + .../2007-10-12-failed-make-symbolic-after-copy.c | 2 +- + test/regression/2008-03-04-free-of-global.c | 2 +- + test/regression/2008-03-11-free-of-malloc-zero.c | 2 +- + test/regression/2008-04-10-bad-alloca-free.c | 2 +- + test/regression/2008-05-23-gep-with-global-const.c | 2 +- + test/regression/2012-05-13-asm-causes-aborts.c | 2 +- + test/regression/2014-07-04-unflushed-error-report.c | 2 +- + test/regression/2014-09-13-debug-info.c | 2 +- + test/regression/2014-12-08-ashr.c | 2 +- + test/regression/2015-06-22-struct-write.c | 2 +- + test/regression/2015-08-05-invalid-fork.c | 2 +- + test/regression/2015-08-30-empty-constraints.c | 2 +- + test/regression/2015-08-30-sdiv-1.c | 2 +- + test/regression/2016-04-14-sdiv-2.c | 2 +- + test/regression/2016-06-28-div-zero-bug.c | 2 +- + test/regression/2016-08-06-klee-get-obj-size.c | 2 +- + test/regression/2016-08-11-entry-point-internalize-pass.c | 2 +- + test/regression/2016-08-12-empty-file.c | 2 +- + test/regression/2016-11-24-bitcast-weak-alias.c | 2 +- + test/regression/2016-12-14-alloc-alignment.c | 2 +- + test/regression/2017-02-21-pathOS-id.c | 2 +- + test/regression/2017-03-23-early-exit-log-stats.c | 2 +- + .../2018-05-05-number-instructions-dumped-states.c | 2 +- + 135 files changed, 147 insertions(+), 137 deletions(-) +diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt +index 61693afc2cab..e3619f3d4609 100644 +--- a/runtime/CMakeLists.txt ++++ b/runtime/CMakeLists.txt +@@ -91,13 +91,19 @@ ExternalProject_Add(BuildKLEERuntimes + INSTALL_COMMAND "${CMAKE_COMMAND}" -E echo "" # Dummy command + ) + ++set(O0OPT "-O0") ++if (${LLVM_VERSION_MAJOR} GREATER 4) ++ set(O0OPT "${O0OPT} -Xclang -disable-O0-optnone") ++endif() ++ ++ + # Use `ExternalProject_Add_Step` with `ALWAYS` argument instead of directly + # building in `ExternalProject_Add` with `BUILD_ALWAYS` argument due to lack of + # support for the `BUILD_ALWAYS` argument in CMake < 3.1. + ExternalProject_Add_Step(BuildKLEERuntimes RuntimeBuild + # `env` is used here to make sure `MAKEFLAGS` of KLEE's build + # is not propagated into the bitcode build system. +- COMMAND ${ENV_BINARY} MAKEFLAGS="" ${MAKE_BINARY} -f Makefile.cmake.bitcode all ++ COMMAND ${ENV_BINARY} MAKEFLAGS="" O0OPT=${O0OPT} ${MAKE_BINARY} -f Makefile.cmake.bitcode all + ALWAYS ${EXTERNAL_PROJECT_BUILD_ALWAYS_ARG} + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + ${EXTERNAL_PROJECT_ADD_STEP_USES_TERMINAL_ARG} +diff --git a/runtime/Makefile.cmake.bitcode.rules b/runtime/Makefile.cmake.bitcode.rules +index 41b2814e1241..db731ac5df3a 100644 +--- a/runtime/Makefile.cmake.bitcode.rules ++++ b/runtime/Makefile.cmake.bitcode.rules +@@ -40,7 +40,7 @@ endif + ifeq ($(IS_RELEASE),1) + LLVMCC.Flags += -O2 + else +-LLVMCC.Flags += -O0 ++LLVMCC.Flags += $(O0OPT) + endif + + # Handle assertion flags diff --git a/test/CXX/ArrayNew.cpp b/test/CXX/ArrayNew.cpp index 6a54083aafac..baad95fe4473 100644 --- a/test/CXX/ArrayNew.cpp @@ -625,7 +665,7 @@ index 0eca8213f384..8c07041d89f6 100644 // RUN: %klee --output-dir=%t.klee-out --libc=klee %t2.bc > %t3.log // RUN: echo "good" > %t3.good diff --git a/test/Feature/arithmetic-right-overshift-sym-conc.c b/test/Feature/arithmetic-right-overshift-sym-conc.c -index 63b93db32ed9..2fff2a3a2724 100644 +index 6a9bbc2113ac..4a0bc36f1989 100644 --- a/test/Feature/arithmetic-right-overshift-sym-conc.c +++ b/test/Feature/arithmetic-right-overshift-sym-conc.c @@ -1,4 +1,4 @@ @@ -808,7 +848,7 @@ index 77e2f5d2567f..8155060d4266 100644 // RUN: %klee --output-dir=%t.klee-out --search=dfs %t.bc // RUN: test -f %t.klee-out/test000001.ktest diff --git a/test/Replay/libkleeruntest/replay_two_objects.c b/test/Replay/libkleeruntest/replay_two_objects.c -index 779e1b656eb6..692797e1fdc0 100644 +index 7cbfe3063910..a8f1b87b8bd7 100644 --- a/test/Replay/libkleeruntest/replay_two_objects.c +++ b/test/Replay/libkleeruntest/replay_two_objects.c @@ -1,4 +1,4 @@ @@ -994,7 +1034,7 @@ index 2b8cfa9d3858..00deab5f08e2 100644 // RUN: %klee --output-dir=%t.klee-out --exit-on-error --posix-runtime %t.bc --sym-files 1 8 >%t.log diff --git a/test/Runtime/POSIX/Replay.c b/test/Runtime/POSIX/Replay.c -index ba11f05f169b..eba6bbaf04d4 100644 +index 2b166e1f84c0..f98028377d51 100644 --- a/test/Runtime/POSIX/Replay.c +++ b/test/Runtime/POSIX/Replay.c @@ -1,4 +1,4 @@ @@ -1086,106 +1126,97 @@ index 482679e923ef..041e675dc4f1 100644 // RUN: %klee --output-dir=%t.klee-out -solver-backend=z3 -write-cvcs -write-smt2s -debug-z3-dump-queries=%t.smt2 %t1.bc // RUN: cat %t.klee-out/test000001.smt2 | FileCheck --check-prefix=TEST-CASE %s diff --git a/test/VectorInstructions/extract_element.c b/test/VectorInstructions/extract_element.c -index 008691e39a6d..0a5f155a1538 100644 +index 5507d1d9ac5e..76034f183cfb 100644 --- a/test/VectorInstructions/extract_element.c +++ b/test/VectorInstructions/extract_element.c -@@ -1,5 +1,5 @@ - // REQUIRES: geq-llvm-3.4 +@@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc // RUN: rm -rf %t.klee-out // NOTE: Have to pass `--optimize=false` to avoid vector operations being // constant folded away. diff --git a/test/VectorInstructions/extract_element_symbolic.c b/test/VectorInstructions/extract_element_symbolic.c -index f75bad623a5e..c20536d457c2 100644 +index 268a63f6ab4e..1833eb34edcb 100644 --- a/test/VectorInstructions/extract_element_symbolic.c +++ b/test/VectorInstructions/extract_element_symbolic.c -@@ -1,5 +1,5 @@ - // REQUIRES: geq-llvm-3.4 +@@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc // RUN: rm -rf %t.klee-out // RUN: not %klee --output-dir=%t.klee-out --exit-on-error %t1.bc > %t.log 2>&1 // RUN: FileCheck -input-file=%t.log %s diff --git a/test/VectorInstructions/floating_point_ops_constant.c b/test/VectorInstructions/floating_point_ops_constant.c -index 4e567a309580..ddb4af43e4c1 100644 +index c9777fa9c8fa..3d9fd098408e 100644 --- a/test/VectorInstructions/floating_point_ops_constant.c +++ b/test/VectorInstructions/floating_point_ops_constant.c -@@ -1,5 +1,5 @@ - // REQUIRES: geq-llvm-3.4 +@@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc // RUN: rm -rf %t.klee-out // NOTE: Have to pass `--optimize=false` to avoid vector operations being // constant folded away. diff --git a/test/VectorInstructions/insert_element.c b/test/VectorInstructions/insert_element.c -index 8397dcebbcf0..6b77ab13d203 100644 +index 7e79250d5ecc..772da9874987 100644 --- a/test/VectorInstructions/insert_element.c +++ b/test/VectorInstructions/insert_element.c -@@ -1,5 +1,5 @@ - // REQUIRES: geq-llvm-3.4 +@@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc // RUN: rm -rf %t.klee-out // NOTE: Have to pass `--optimize=false` to avoid vector operations being // constant folded away. diff --git a/test/VectorInstructions/insert_element_symbolic.c b/test/VectorInstructions/insert_element_symbolic.c -index 76df899c95fa..1080f367efd0 100644 +index 66666a71cd07..f75d3a09b0ac 100644 --- a/test/VectorInstructions/insert_element_symbolic.c +++ b/test/VectorInstructions/insert_element_symbolic.c -@@ -1,5 +1,5 @@ - // REQUIRES: geq-llvm-3.4 +@@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc // RUN: rm -rf %t.klee-out // RUN: not %klee --output-dir=%t.klee-out --exit-on-error %t1.bc > %t.log 2>&1 // RUN: FileCheck -input-file=%t.log %s diff --git a/test/VectorInstructions/integer_ops_constant.c b/test/VectorInstructions/integer_ops_constant.c -index 189ad4eeed54..355075e6375b 100644 +index 8993ff2e9486..920465ff2e06 100644 --- a/test/VectorInstructions/integer_ops_constant.c +++ b/test/VectorInstructions/integer_ops_constant.c -@@ -1,5 +1,5 @@ - // REQUIRES: geq-llvm-3.4 +@@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc // RUN: rm -rf %t.klee-out // NOTE: Have to pass `--optimize=false` to avoid vector operations being // constant folded away. diff --git a/test/VectorInstructions/integer_ops_signed_symbolic.c b/test/VectorInstructions/integer_ops_signed_symbolic.c -index 80f4e420561b..7d9944222eff 100644 +index c2f6b5f9af31..10ede925ce68 100644 --- a/test/VectorInstructions/integer_ops_signed_symbolic.c +++ b/test/VectorInstructions/integer_ops_signed_symbolic.c -@@ -1,5 +1,5 @@ - // REQUIRES: geq-llvm-3.4 +@@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc // RUN: rm -rf %t.klee-out // NOTE: Have to pass `--optimize=false` to avoid vector operations being // optimized away. diff --git a/test/VectorInstructions/integer_ops_unsigned_symbolic.c b/test/VectorInstructions/integer_ops_unsigned_symbolic.c -index 56b1739809d6..794716761a87 100644 +index 8a7330c0d02b..aadeb585990d 100644 --- a/test/VectorInstructions/integer_ops_unsigned_symbolic.c +++ b/test/VectorInstructions/integer_ops_unsigned_symbolic.c -@@ -1,5 +1,5 @@ - // REQUIRES: geq-llvm-3.4 +@@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc // RUN: rm -rf %t.klee-out // NOTE: Have to pass `--optimize=false` to avoid vector operations being // optimized away. diff --git a/test/VectorInstructions/shuffle_element.c b/test/VectorInstructions/shuffle_element.c -index cf991b036983..55955fd347e9 100644 +index 32653490934b..bf1f83f646d8 100644 --- a/test/VectorInstructions/shuffle_element.c +++ b/test/VectorInstructions/shuffle_element.c -@@ -1,5 +1,5 @@ - // REQUIRES: geq-llvm-3.4 +@@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t1.bc +// RUN: %llvmgcc %s -emit-llvm %O0opt -g -c -o %t1.bc // RUN: rm -rf %t.klee-out // NOTE: Have to pass `--optimize=false` to avoid vector operations being // constant folded away. diff --git a/test/lit.cfg b/test/lit.cfg -index e570f9b227e3..a26f9c0381d3 100644 +index 780973d79086..11f3992c5eec 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -84,7 +84,7 @@ if config.test_exec_root is None: @@ -1198,7 +1229,7 @@ index e570f9b227e3..a26f9c0381d3 100644 value = getattr(config, name, None) if value == None: diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in -index 300c70c53c2d..1f4b8c72d1b5 100644 +index 6a90bb4cacbc..dbc292fb68a0 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -21,6 +21,10 @@ config.llvmgxx = "@LLVMCXX@" @@ -1529,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.17.1 +2.18.0 diff --git a/0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch b/0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch new file mode 100644 index 0000000..b5c9b0e --- /dev/null +++ b/0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch @@ -0,0 +1,46 @@ +From: Jiri Slaby +Date: Fri, 20 Jul 2018 10:06:29 +0200 +Subject: llvm50: CallSite.paramHasAttr is indexed from 0 +Patch-mainline: no + +Since LLVM 5 commit 1f8f0490690b, CallSite.paramHasAttr is indexed from +0, so make sure we use correct indexing in klee. And use +CallSite.hasRetAttr for return attributes. + +Signed-off-by: Jiri Slaby +--- + lib/Core/Executor.cpp | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp +index 46fd2be42351..f05561e7fe82 100644 +--- a/lib/Core/Executor.cpp ++++ b/lib/Core/Executor.cpp +@@ -1543,7 +1543,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { + CallSite(cast(caller))); + + // XXX need to check other param attrs ? +- bool isSExt = cs.paramHasAttr(0, llvm::Attribute::SExt); ++#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) ++ bool isSExt = cs.hasRetAttr(llvm::Attribute::SExt); ++#else ++ bool isSExt = cs.paramHasAttr(0, llvm::Attribute::SExt); ++#endif + if (isSExt) { + result = SExtExpr::create(result, to); + } else { +@@ -1837,7 +1841,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { + + if (from != to) { + // XXX need to check other param attrs ? ++#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) ++ bool isSExt = cs.paramHasAttr(i, llvm::Attribute::SExt); ++#else + bool isSExt = cs.paramHasAttr(i+1, llvm::Attribute::SExt); ++#endif + if (isSExt) { + arguments[i] = SExtExpr::create(arguments[i], to); + } else { +-- +2.18.0 + diff --git a/0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch b/0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch similarity index 97% rename from 0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch rename to 0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch index 03eac0b..5c1fc61 100644 --- a/0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch +++ b/0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch @@ -1,6 +1,6 @@ From: Jiri Slaby Date: Mon, 21 May 2018 15:12:44 +0200 -Subject: llvm60: SetVersionPrinter now passes down a stream +Subject: llvm6: SetVersionPrinter now passes down a stream Patch-mainline: no I.e. klee::printVersion should now have a parameter -- the output @@ -81,5 +81,5 @@ index d39249df023f..b7f2b6ff347a 100644 llvm::cl::PrintVersionMessage(); } -- -2.17.1 +2.18.0 diff --git a/0029-llvm60-handle-headers-renaming.patch b/0022-llvm6-handle-headers-renaming.patch similarity index 92% rename from 0029-llvm60-handle-headers-renaming.patch rename to 0022-llvm6-handle-headers-renaming.patch index 5806af9..0955b18 100644 --- a/0029-llvm60-handle-headers-renaming.patch +++ b/0022-llvm6-handle-headers-renaming.patch @@ -1,6 +1,6 @@ From: Jiri Slaby Date: Mon, 21 May 2018 15:14:41 +0200 -Subject: llvm60: handle headers renaming +Subject: llvm6: handle headers renaming Patch-mainline: no Some headers were moved from llvm/Target/ to llvm/CodeGen/. Handle that. @@ -11,7 +11,7 @@ Signed-off-by: Jiri Slaby 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp -index d9b3e40154ba..d478ff828796 100644 +index 4967a2fa8578..eef22fb81553 100644 --- a/lib/Module/RaiseAsm.cpp +++ b/lib/Module/RaiseAsm.cpp @@ -18,10 +18,16 @@ @@ -33,5 +33,5 @@ index d9b3e40154ba..d478ff828796 100644 using namespace llvm; -- -2.17.1 +2.18.0 diff --git a/_servicedata b/_servicedata index 10253e0..e67b0c5 100644 --- a/_servicedata +++ b/_servicedata @@ -1,4 +1,4 @@ git://github.com/klee/klee.git - d2fbdf74493d69e73fbfaedc0d59e593dfd7c69d \ No newline at end of file + b893d2158ce001da97f2c741ac8320b4c3b9ed53 \ No newline at end of file diff --git a/klee-1.4.0+20180614.tar.xz b/klee-1.4.0+20180614.tar.xz deleted file mode 100644 index 82c7925..0000000 --- a/klee-1.4.0+20180614.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d03fcc9a6ed53e1e2e7784813b5a3f612b09cc33fda8db68e7aade78ec839bb5 -size 592052 diff --git a/klee-1.4.0+20180829.tar.xz b/klee-1.4.0+20180829.tar.xz new file mode 100644 index 0000000..742e514 --- /dev/null +++ b/klee-1.4.0+20180829.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7f46c097ddadb8c4b6a3ec70294b7a8d2c8d6451a67913d698813832695a046c +size 597812 diff --git a/klee.changes b/klee.changes index a92c0ed..cf58307 100644 --- a/klee.changes +++ b/klee.changes @@ -1,3 +1,109 @@ +------------------------------------------------------------------- +Sun Sep 02 08:39:37 UTC 2018 - opensuse-packaging@opensuse.org + +- Update to version 1.4.0+20180829: + * klee-stats: add TResolve(%) to --print-all + * llvm.sh: fix patch source paths + * Disabled unit testing in default build + * Fixed runtest library to handle the case of a NULL "name" argument in klee_make_symbolic. Changed a test case to check this feature. + * Replace remaining *Inst::Create() calls with llvm::Builder + * [clang-format]Allow longer codelines in test/ + * test: remove geq-llvm-3.4 + * remove last comma from -debug-print-escaping-functions + * test/Feature/EscapingFunctionsAlias.c: clarify alias(ee) casting + * add declarations to escapingFunctions + * ModuleUtil: improve and test valueIsOnlyCalled + * fix: LLVM 3.5, begin_user() instead of begin_use() + * ExternalDispatcher: setErrorStr for EngineBuilder + * travis CI: add LLVM 3.8 build tests + * llvm38: test, change some tests + * llvm38: no more implicit iterators + * llvm38: archive child iterator changes + * llvm38: adapt to new Linker::linkModules + * llvm38: SmallString is always up-to-date + * llvm38: handle optimization passes changes + * llvm38: no rounding in APFloat + * Fix uploading of coverage information from inside of docker + * Add missing curl + * Fix slow Mac Travis build: wildcard is not expanded with quotes + * Added "override" in Executor.h to silence compiler warnings (and ran clang-format on patch) + * Removed support for klee_make_symbolic with 2 arguments. This has been deprecated for many years now and causes problems during replay. Changed and simplified affected test case. + * test: remove undefined behaviour + * Enabled tcmalloc by default + * Link dynamic libraries with specific paths instead of resolving them during runtime + * Fix incorrect invocation of klee + * Fix uninitialized memory: enums have to be initialized + * Add missing out-of-tree include files directory for TCMalloc + * Fix compiler warnings if assertions are disabled + * Support sanitizer suppression files with lit-based testing + * Extensive updates to the build script for dependencies and docker + * runtime: remove obsolete code for building modules instead of archives + * Reorder linking and optimizations + * Reorganise runtime libraries provided by KLEE + * Removed obsolete script + * test/lit.cfg: remove obsolete hack from (LLVM < 3.0 is no longer supported) + * CMake: use cmake_{push,pop}_check_state + * CMake: check for ctype and mallinfo functions with CXX instead of C compiler + * fix out of range access in KleeHandler::getKTestFilesInDir + * Explicitly initialize value to squelch a potentially uninitialized value warning + * Fix the final -Wimplicit-fallthrough warning + * Make ConstantExpr hashing function faster and modify affected test +- added patches: + * 0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch + * 0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch + * 0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch +- removed patches (in upstream now): + * 0001-test-remove-undefined-behaviour.patch + * 0002-llvm38-no-rounding-in-APFloat.patch + * 0003-llvm38-handle-optimization-passes-changes.patch + * 0004-llvm38-SmallString-is-always-up-to-date.patch + * 0005-llvm38-materializeAllPermanently-was-renamed.patch + * 0006-llvm38-adapt-to-new-Linker-linkModules.patch + * 0007-llvm38-archive-child-iterator-changes.patch + * 0008-llvm38-no-more-implicit-iterators.patch + * 0009-llvm38-test-change-some-tests.patch +- renamed patches: + * 0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch + -> 0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch + * 0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch + -> 0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch + * 0012-llvm40-handle-different-header-names.patch + -> 0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch + * 0013-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch + -> 0004-llvm40-handle-different-header-names.patch + * 0014-llvm40-errorOr-and-similar.patch + -> 0006-llvm40-errorOr-and-similar.patch + * 0015-llvm-use-chrono-helpers-from-LLVM-4.0.patch + -> 0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch + * 0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch + -> 0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch + * 0017-llvm40-gep_type_iterator-has-no-operator.patch + -> 0009-llvm40-gep_type_iterator-has-no-operator.patch + * 0018-llvm50-avoid-on-function-arg_begin.patch + -> 0010-llvm50-avoid-on-function-arg_begin.patch + * 0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch + -> 0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch + * 0020-llvm50-handle-getOrInsertFunction-terminator.patch + -> 0012-llvm50-handle-getOrInsertFunction-terminator.patch + * 0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch + -> 0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch + * 0022-llvm50-handle-new-file_magic-s-location.patch + -> 0014-llvm50-handle-new-file_magic-s-location.patch + * 0023-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch + -> 0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch + * 0024-llvm50-AllocaInst-takes-address-space.patch + -> 0016-llvm50-AllocaInst-takes-address-space.patch + * 0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch + -> 0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch + * 0026-llvm50-test-change-objectsize.patch + -> 0018-llvm50-test-change-objectsize.patch + * 0027-llvm50-test-add-disable-O0-optnone-to-O0.patch + -> 0019-llvm50-test-add-disable-O0-optnone-to-O0.patch + * 0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch + -> 0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch + * 0029-llvm60-handle-headers-renaming.patch + -> 0022-llvm6-handle-headers-renaming.patch + ------------------------------------------------------------------- Sat Jun 16 09:09:56 UTC 2018 - opensuse-packaging@opensuse.org diff --git a/klee.spec b/klee.spec index 2215608..bb098dc 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+20180614 +%define version_unconverted 1.4.0+20180829 %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+20180614 +Version: 1.4.0+20180829 Release: 0 Url: http://klee.github.io/ Source0: %{name}-%{version}.tar.xz @@ -39,35 +39,28 @@ 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-test-remove-undefined-behaviour.patch -Patch202: 0002-llvm38-no-rounding-in-APFloat.patch -Patch203: 0003-llvm38-handle-optimization-passes-changes.patch -Patch204: 0004-llvm38-SmallString-is-always-up-to-date.patch -Patch205: 0005-llvm38-materializeAllPermanently-was-renamed.patch -Patch206: 0006-llvm38-adapt-to-new-Linker-linkModules.patch -Patch207: 0007-llvm38-archive-child-iterator-changes.patch -Patch208: 0008-llvm38-no-more-implicit-iterators.patch -Patch209: 0009-llvm38-test-change-some-tests.patch -Patch210: 0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch -Patch211: 0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch -Patch212: 0012-llvm40-handle-different-header-names.patch -Patch213: 0013-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch -Patch214: 0014-llvm40-errorOr-and-similar.patch -Patch215: 0015-llvm-use-chrono-helpers-from-LLVM-4.0.patch -Patch216: 0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch -Patch217: 0017-llvm40-gep_type_iterator-has-no-operator.patch -Patch218: 0018-llvm50-avoid-on-function-arg_begin.patch -Patch219: 0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch -Patch220: 0020-llvm50-handle-getOrInsertFunction-terminator.patch -Patch221: 0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch -Patch222: 0022-llvm50-handle-new-file_magic-s-location.patch -Patch223: 0023-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch -Patch224: 0024-llvm50-AllocaInst-takes-address-space.patch -Patch225: 0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch -Patch226: 0026-llvm50-test-change-objectsize.patch -Patch227: 0027-llvm50-test-add-disable-O0-optnone-to-O0.patch -Patch228: 0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch -Patch229: 0029-llvm60-handle-headers-renaming.patch +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 BuildRequires: clang%{llvm_version} BuildRequires: cmake @@ -94,36 +87,7 @@ information on what KLEE is and what it can do, see the OSDI 2008 paper. %prep %setup -q - -%patch201 -p1 -%patch202 -p1 -%patch203 -p1 -%patch204 -p1 -%patch205 -p1 -%patch206 -p1 -%patch207 -p1 -%patch208 -p1 -%patch209 -p1 -%patch210 -p1 -%patch211 -p1 -%patch212 -p1 -%patch213 -p1 -%patch214 -p1 -%patch215 -p1 -%patch216 -p1 -%patch217 -p1 -%patch218 -p1 -%patch219 -p1 -%patch220 -p1 -%patch221 -p1 -%patch222 -p1 -%patch223 -p1 -%patch224 -p1 -%patch225 -p1 -%patch226 -p1 -%patch227 -p1 -%patch228 -p1 -%patch229 -p1 +%autopatch -p1 mkdir -p build/test/ cp %{SOURCE2} build/test/ @@ -181,8 +145,9 @@ ninja check %{_libdir}/libkleeRuntest.so* %dir %{_libdir}/klee/ %dir %{_libdir}/klee/runtime/ -%{_libdir}/klee/runtime/klee-libc.bc -%{_libdir}/klee/runtime/kleeRuntimeIntrinsic.bc +%{_libdir}/klee/runtime/libklee-libc.bca +%{_libdir}/klee/runtime/libkleeRuntimeFreeStanding.bca +%{_libdir}/klee/runtime/libkleeRuntimeIntrinsic.bca %if %{with_uclibc} %{_libdir}/klee/runtime/klee-uclibc.bca %{_libdir}/klee/runtime/libkleeRuntimePOSIX.bca