Hello community,
here is the log from the commit of package klee for openSUSE:Factory checked in at 2018-09-03 10:36:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/klee (Old)
and /work/SRC/openSUSE:Factory/.klee.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "klee"
Mon Sep 3 10:36:19 2018 rev:11 rq:632727 version:1.4.0+20180829
Changes:
--------
--- /work/SRC/openSUSE:Factory/klee/klee.changes 2018-06-19 12:03:35.502191929 +0200
+++ /work/SRC/openSUSE:Factory/.klee.new/klee.changes 2018-09-03 10:36:21.780864785 +0200
@@ -1,0 +2,106 @@
+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
+
+-------------------------------------------------------------------
@@ -9,0 +116,56 @@
+- switch to llvm 6
+- removed patches:
+ * 0001-llvm-make-KLEE-compile-against-LLVM-3.8.patch
+ (it was split into multiple commits below)
+ * klee-skip-some-tests.patch
+ (tests should be working perfectly now)
+- added patches:
+ * 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
+ * 0011-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch
+ * 0027-llvm50-test-add-disable-O0-optnone-to-O0.patch
+- renamed patches:
+ * 0002-llvm38-test-change-some-tests.patch
+ -> 0009-llvm38-test-change-some-tests.patch
+ * 0003-llvm-make-KLEE-compile-against-LLVM-3.9.patch
+ -> 0010-llvm-make-KLEE-compile-against-LLVM-3.9.patch
+ * 0004-llvm40-handle-different-header-names.patch
+ -> 0012-llvm40-handle-different-header-names.patch
+ * 0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch
+ -> 0013-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch
+ * 0006-llvm40-errorOr-and-similar.patch
+ -> 0014-llvm40-errorOr-and-similar.patch
+ * 0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch
+ -> 0015-llvm-use-chrono-helpers-from-LLVM-4.0.patch
+ * 0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch
+ -> 0016-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch
+ * 0009-llvm40-gep_type_iterator-has-no-operator.patch
+ -> 0017-llvm40-gep_type_iterator-has-no-operator.patch
+ * 0010-llvm50-avoid-on-function-arg_begin.patch
+ -> 0018-llvm50-avoid-on-function-arg_begin.patch
+ * 0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch
+ -> 0019-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch
+ * 0012-llvm50-handle-getOrInsertFunction-terminator.patch
+ -> 0020-llvm50-handle-getOrInsertFunction-terminator.patch
+ * 0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch
+ -> 0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch
+ * 0014-llvm50-handle-new-file_magic-s-location.patch
+ -> 0022-llvm50-handle-new-file_magic-s-location.patch
+ * 0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch
+ -> 0023-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch
+ * 0016-llvm50-AllocaInst-takes-address-space.patch
+ -> 0024-llvm50-AllocaInst-takes-address-space.patch
+ * 0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch
+ -> 0025-llvm50-Intrinsic-objectsize-has-three-arguments.patch
+ * 0018-llvm50-test-change-objectsize.patch
+ -> 0026-llvm50-test-change-objectsize.patch
+ * 0019-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch
+ -> 0028-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch
+ * 0020-llvm60-handle-headers-renaming.patch
+ -> 0029-llvm60-handle-headers-renaming.patch
Old:
----
0001-llvm-make-KLEE-compile-against-LLVM-3.8.patch
0002-llvm38-test-change-some-tests.patch
0003-llvm-make-KLEE-compile-against-LLVM-3.9.patch
0019-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch
0020-llvm60-handle-headers-renaming.patch
klee-1.4.0+20180614.tar.xz
klee-skip-some-tests.patch
New:
----
0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch
0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch
0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch
0019-llvm50-test-add-disable-O0-optnone-to-O0.patch
0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch
0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch
0022-llvm6-handle-headers-renaming.patch
klee-1.4.0+20180829.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ klee.spec ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:22.324866192 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:22.324866192 +0200
@@ -15,11 +15,11 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
-%define llvm_version_major 4
+%define llvm_version_major 6
%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 @@
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,9 +39,9 @@
Source2: https://raw.githubusercontent.com/llvm-mirror/llvm/release_%{llvm_version_major}%{llvm_version_minor}/utils/not/not.cpp
Source3: https://raw.githubusercontent.com/llvm-mirror/llvm/release_%{llvm_version_major}%{llvm_version_minor}/utils/FileCheck/FileCheck.cpp
-Patch201: 0001-llvm-make-KLEE-compile-against-LLVM-3.8.patch
-Patch202: 0002-llvm38-test-change-some-tests.patch
-Patch203: 0003-llvm-make-KLEE-compile-against-LLVM-3.9.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
@@ -57,10 +57,10 @@
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-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch
-Patch220: 0020-llvm60-handle-headers-renaming.patch
-
-Patch300: klee-skip-some-tests.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
@@ -87,29 +87,7 @@
%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
-
-#%%patch300 -p1
+%autopatch -p1
mkdir -p build/test/
cp %{SOURCE2} build/test/
@@ -167,8 +145,9 @@
%{_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
++++++ 0001-llvm-make-KLEE-compile-against-LLVM-3.8.patch -> 0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch ++++++
--- /work/SRC/openSUSE:Factory/klee/0001-llvm-make-KLEE-compile-against-LLVM-3.8.patch 2018-05-30 12:29:50.564843026 +0200
+++ /work/SRC/openSUSE:Factory/.klee.new/0001-llvm-make-KLEE-compile-against-LLVM-3.9.patch 2018-09-03 10:36:21.416863844 +0200
@@ -1,270 +1,295 @@
-From: =?UTF-8?q?Richard=20Trembeck=C3=BD?=
-Date: Wed, 4 May 2016 15:21:45 +0200
-Subject: llvm: make KLEE compile against LLVM 3.8
+From: Jiri Slaby
+Date: Wed, 22 Feb 2017 15:57:55 +0100
+Subject: llvm: make KLEE compile against LLVM 3.9
Patch-mainline: no
Signed-off-by: Jiri Slaby
---
- lib/Core/Executor.cpp | 5 +++++
- lib/Core/StatsTracker.cpp | 4 ++++
- lib/Module/IntrinsicCleaner.cpp | 10 ++++++++-
- lib/Module/LowerSwitch.cpp | 8 +++++++
- lib/Module/ModuleUtil.cpp | 39 ++++++++++++++++++++++++++++-----
- lib/Module/Optimize.cpp | 13 ++++++++++-
- tools/klee/main.cpp | 7 +++++-
- 7 files changed, 77 insertions(+), 9 deletions(-)
+ lib/Core/Executor.cpp | 16 ++++++++++++++++
+ lib/Core/MemoryManager.cpp | 5 ++++-
+ lib/Module/ModuleUtil.cpp | 33 ++++++++++++++++++++++++++++++---
+ lib/Module/Optimize.cpp | 34 ++++++++++++++++++++++++++++++++++
+ lib/Module/RaiseAsm.cpp | 10 +++++++++-
+ tools/kleaver/main.cpp | 4 ++++
+ tools/klee/main.cpp | 4 ++++
+ 7 files changed, 101 insertions(+), 5 deletions(-)
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
-index f0781e5b882a..2c7e8d4d52a6 100644
+index b053d4882431..7f69a618b8ec 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()));
+@@ -1338,10 +1338,18 @@ void Executor::executeCall(ExecutionState &state,
+ //
+ // Alignment requirements for scalar types is the same as their size
+ if (argWidth > Expr::Int64) {
++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
++ size = llvm::alignTo(size, 16);
+#else
- Res.mod(APFloat(*fpWidthToSemantics(right->getWidth()),right->getAPValue()),
- APFloat::rmNearestTiesToEven);
+ size = llvm::RoundUpToAlignment(size, 16);
+#endif
- bindLocal(ki, state, ConstantExpr::alloc(Res.bitcastToAPInt()));
- break;
- }
-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())));
+ requires16ByteAlignment = true;
+ }
++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
++ size += llvm::alignTo(argWidth, WordSize) / 8;
+#else
- res.push_back(&*(++BasicBlock::iterator(i)));
+ size += llvm::RoundUpToAlignment(argWidth, WordSize) / 8;
+#endif
- }
+ }
+ }
+
+@@ -1374,10 +1382,18 @@ void Executor::executeCall(ExecutionState &state,
- return res;
-diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp
-index 3729ff82cd9d..e10e886e8915 100644
---- a/lib/Module/IntrinsicCleaner.cpp
-+++ b/lib/Module/IntrinsicCleaner.cpp
-@@ -50,6 +50,10 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) {
- unsigned WordSize = DataLayout.getPointerSizeInBits() / 8;
- for (BasicBlock::iterator i = b.begin(), ie = b.end(); i != ie;) {
- IntrinsicInst *ii = dyn_cast<IntrinsicInst>(&*i);
-+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8)
-+ // create a copy of iterator to pass to IRBuilder ctor later
-+ BasicBlock::iterator i_ = i;
-+#endif
- // increment now since deletion of instructions makes iterator invalid.
- ++i;
- if (ii) {
-@@ -110,8 +114,12 @@ 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)
-+ // ctor needs the iterator, but we already increased ours
-+ IRBuilder<> builder(ii->getParent(), i_);
+ Expr::Width argWidth = arguments[i]->getWidth();
+ if (argWidth > Expr::Int64) {
++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
++ offset = llvm::alignTo(offset, 16);
+#else
- IRBuilder<> builder(ii->getParent(), ii);
--
+ offset = llvm::RoundUpToAlignment(offset, 16);
+#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");
+ }
+ os->write(offset, arguments[i]);
++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
++ offset += llvm::alignTo(argWidth, WordSize) / 8;
++#else
+ offset += llvm::RoundUpToAlignment(argWidth, WordSize) / 8;
++#endif
+ }
+ }
+ }
+diff --git a/lib/Core/MemoryManager.cpp b/lib/Core/MemoryManager.cpp
+index 24e2ed97581f..f40e8bc9deb8 100644
+--- a/lib/Core/MemoryManager.cpp
++++ b/lib/Core/MemoryManager.cpp
+@@ -111,9 +111,12 @@ MemoryObject *MemoryManager::allocate(uint64_t size, bool isLocal,
-+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8)
-+ F->getBasicBlockList().insert(defaultBlock->getIterator(), newDefault);
+ uint64_t address = 0;
+ if (DeterministicAllocation) {
+-
++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
++ address = llvm::alignTo((uint64_t)nextFreeSlot + alignment - 1, alignment);
+#else
- F->getBasicBlockList().insert(defaultBlock, newDefault);
+ address = llvm::RoundUpToAlignment((uint64_t)nextFreeSlot + alignment - 1,
+ alignment);
+#endif
- BranchInst::Create(defaultBlock, newDefault);
- // If there is an entry in any PHI nodes for the default edge, make sure
+ // 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 b07d3d2fe348..e6d592b135b6 100644
+index 5ca0a55b12d2..0e87b5a6deca 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<StringRef> memberNameErr = AI->getName();
-- std::error_code ec = memberNameErr.getError();
-+ std::error_code ec;
-+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8)
-+ ErrorOrobject::Archive::Child childErr = *AI;
-+ ec = childErr.getError();
-+ if (ec) {
-+ errorMessage = ec.message();
-+ return false;
-+ }
-+#else
-+ object::Archive::child_iterator childErr = AI;
-+#endif
-+ ErrorOr<StringRef> 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)
-- ErrorOrllvm::object::Binary > child = AI->getAsBinary();
-+ ErrorOrllvm::object::Binary > child =
-+ childErr->getAsBinary();
- ec = child.getError();
- #else
- OwningPtrobject::Binary 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<MemoryBufferRef> buff = AI->getMemoryBufferRef();
-+ ErrorOr<MemoryBufferRef> buff = childErr->getMemoryBufferRef();
- ec = buff.getError();
- #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
- ErrorOr buffErr = AI->getMemoryBuffer();
-@@ -343,7 +355,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");
+@@ -284,7 +284,11 @@ Function *klee::getDirectCallTarget(CallSite cs, bool moduleIsFullyLinked) {
+ if (Function *f = dyn_cast<Function>(v)) {
+ return f;
+ } else if (llvm::GlobalAlias *ga = dyn_cast<GlobalAlias>(v)) {
++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
++ if (moduleIsFullyLinked || !(ga->isInterposable())) {
++#else
+ if (moduleIsFullyLinked || !(ga->mayBeOverridden())) {
++#endif
+ v = ga->getAliasee();
+ } else {
+ v = NULL;
+@@ -393,7 +397,13 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context,
+ }
+ if (magic == sys::fs::file_magic::archive) {
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
-+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8)
-+ if (Linker::linkModules(*composite, std::unique_ptr<Module>(M)))
++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
++ Expectedobject::Binary > 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)
- if (Linker::LinkModules(composite, M))
- #else
- if (Linker::LinkModules(composite, M, Linker::DestroySource, &errorMessage))
-@@ -360,8 +374,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 +443,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 +463,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 +478,7 @@ Module *klee::linkWithLibrary(Module *module,
- ErrorMessage = "linking error";
- #else
- if (Linker::LinkModules(module, Result, Linker::DestroySource, &ErrorMessage)) {
+ ErrorOrobject::Binary> 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_castobject::Archive(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)
++ Expectedllvm::object::Binary > child =
++ childOrErr->getAsBinary();
++ if (!child)
++ ec = errorToErrorCode(child.takeError());
++#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
+ ErrorOrllvm::object::Binary> 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
- #endif
- klee_error("Link with library %s failed: %s", libraryName.c_str(),
- ErrorMessage.c_str());
-@@ -639,7 +662,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;
+ }
++
+ return true;
}
+ if (magic.is_object()) {
diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp
-index 64e4863f70b3..944f51ef336d 100644
+index c788ee36cadb..34af46262080 100644
--- a/lib/Module/Optimize.cpp
+++ b/lib/Module/Optimize.cpp
-@@ -102,7 +102,12 @@ static void AddStandardCompilePasses(klee::LegacyLLVMPassManagerTy &PM) {
- addPass(PM, createCFGSimplificationPass()); // Clean up after IPCP & DAE
+@@ -39,6 +39,11 @@
+ #include "llvm/Analysis/GlobalsModRef.h"
+ #endif
+
++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
++#include "llvm/Transforms/IPO/FunctionAttrs.h"
++#include "llvm/Transforms/Scalar/GVN.h"
++#endif
++
+ using namespace llvm;
+
+ // Don't verify at the end
+@@ -107,7 +112,11 @@ static void AddStandardCompilePasses(klee::LegacyLLVMPassManagerTy &PM) {
addPass(PM, createPruneEHPass()); // Remove dead EH info
-- addPass(PM, createFunctionAttrsPass()); // Deduce function attrs
-+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8)
-+ addPass(PM, createPostOrderFunctionAttrsPass());
-+ addPass(PM, createReversePostOrderFunctionAttrsPass());
+ #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8)
++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
++ addPass(PM, createPostOrderFunctionAttrsLegacyPass());
+#else
-+ addPass(PM, createFunctionAttrsPass()); // Deduce function attrs
+ addPass(PM, createPostOrderFunctionAttrsPass());
+#endif
+ addPass(PM, createReversePostOrderFunctionAttrsPass()); // Deduce function attrs
+ #else
+ addPass(PM, createFunctionAttrsPass()); // Deduce function attrs
+@@ -120,7 +129,11 @@ static void AddStandardCompilePasses(klee::LegacyLLVMPassManagerTy &PM) {
+ addPass(PM, createInstructionCombiningPass()); // Cleanup for scalarrepl.
+ addPass(PM, createJumpThreadingPass()); // Thread jumps.
+ addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs
++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
++ addPass(PM, createSROAPass()); // Break up aggregate allocas
++#else
+ addPass(PM, createScalarReplAggregatesPass()); // Break up aggregate allocas
++#endif
+ addPass(PM, createInstructionCombiningPass()); // Combine silly seq's
+
+ addPass(PM, createTailCallEliminationPass()); // Eliminate tail calls
+@@ -183,7 +196,20 @@ void Optimize(Module *M, llvm::ArrayRef preservedFunctions) {
+ // for a main function. If main is defined, mark all other functions
+ // internal.
+ if (!DisableInternalize) {
++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
++ auto PreserveFunctions = [=](const GlobalValue &GV) {
++ StringRef GVName = GV.getName();
++
++ for (const char *fun: preservedFunctions)
++ if (GVName.equals(fun))
++ return true;
++
++ return false;
++ };
++ ModulePass *pass = createInternalizePass(PreserveFunctions);
++#else
+ ModulePass *pass = createInternalizePass(preservedFunctions);
++#endif
+ addPass(Passes, pass);
+ }
- if (!DisableInline)
- addPass(PM, createFunctionInliningPass()); // Inline small functions
-@@ -217,8 +222,14 @@ 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.
++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
++ addPass(Passes, createSROAPass()); // Break up allocas
++#else
addPass(Passes, createScalarReplAggregatesPass()); // Break up allocas
++#endif
// Run a few AA driven optimizations here and now, to cleanup the code.
-+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8)
-+ addPass(Passes, createPostOrderFunctionAttrsPass());
-+ addPass(Passes, createReversePostOrderFunctionAttrsPass());
-+ // addPass(Passes, createGlobalsAAWrapperPass());
+ #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8)
++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
++ addPass(Passes, createPostOrderFunctionAttrsLegacyPass());
++#else
+ addPass(Passes, createPostOrderFunctionAttrsPass());
++#endif
+ addPass(Passes, createReversePostOrderFunctionAttrsPass()); // Add nocapture
+ addPass(Passes, createGlobalsAAWrapperPass()); // IP alias analysis
+ #else
+diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp
+index c597fa2a7b82..4967a2fa8578 100644
+--- a/lib/Module/RaiseAsm.cpp
++++ b/lib/Module/RaiseAsm.cpp
+@@ -60,7 +60,11 @@ bool RaiseAsmPass::runOnInstruction(Module &M, Instruction *I) {
+
+ if (ia->getAsmString() == "" && ia->hasSideEffects()) {
+ IRBuilder<> Builder(I);
++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
++ Builder.CreateFence(llvm::AtomicOrdering::SequentiallyConsistent);
++#else
+ Builder.CreateFence(llvm::SequentiallyConsistent);
++#endif
+ I->eraseFromParent();
+ return true;
+ }
+@@ -81,7 +85,11 @@ bool RaiseAsmPass::runOnModule(Module &M) {
+ klee_warning("Warning: unable to select native target: %s", Err.c_str());
+ TLI = 0;
+ } else {
+-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7)
++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
++ TM = NativeTarget->createTargetMachine(HostTriple, "", "", TargetOptions(),
++ None);
++ TLI = TM->getSubtargetImpl(*(M.begin()))->getTargetLowering();
++#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 7)
+ TM = NativeTarget->createTargetMachine(HostTriple, "", "", TargetOptions());
+ TLI = TM->getSubtargetImpl(*(M.begin()))->getTargetLowering();
+ #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+diff --git a/tools/kleaver/main.cpp b/tools/kleaver/main.cpp
+index b8b32e31264a..800cece95e9c 100644
+--- a/tools/kleaver/main.cpp
++++ b/tools/kleaver/main.cpp
+@@ -400,7 +400,11 @@ static bool printInputAsSMTLIBv2(const char *Filename,
+ int main(int argc, char **argv) {
+ bool success = true;
+
++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
++ llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
+#else
- addPass(Passes, createFunctionAttrsPass()); // Add nocapture
- addPass(Passes, createGlobalsModRefPass()); // IP alias analysis
+ llvm::sys::PrintStackTraceOnErrorSignal();
+#endif
+ llvm::cl::SetVersionPrinter(klee::printVersion);
+ llvm::cl::ParseCommandLineOptions(argc, argv);
- addPass(Passes, createLICMPass()); // Hoist loop invariants
- addPass(Passes, createGVNPass()); // Remove redundancies
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
-index ab9dfe286ffb..3d73ae07fcb5 100644
+index c655aa560f62..7be5f07cdc0e 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();
+@@ -1092,7 +1092,11 @@ int main(int argc, char **argv, char **envp) {
+ llvm::InitializeNativeTarget();
+
+ parseArguments(argc, argv);
++#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 9)
++ sys::PrintStackTraceOnErrorSignal(argv[0]);
++#else
+ sys::PrintStackTraceOnErrorSignal();
+#endif
- // create directory and try to link klee-last
- if (mkdir(d.c_str(), 0775) == 0) {
+ if (Watchdog) {
+ if (MaxTime==0) {
--
-2.17.0
+2.18.0
++++++ 0002-cmake-find_llvm-fix-libraries-with-llvm-config-3.9.patch ++++++
From: Jiri Slaby
Date: Fri, 25 May 2018 15:17:03 +0200
Subject: cmake: find_llvm, fix libraries with llvm-config 3.9
Patch-mainline: no
llvm-config from llvm 3.9 was broken. Fix handling of improperly
returned libraries.
From:
liblibLLVM-3.9.so.so
To:
libLLVM-3.9.so
Fixes #895.
Signed-off-by: Jiri Slaby
---
cmake/find_llvm.cmake | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/cmake/find_llvm.cmake b/cmake/find_llvm.cmake
index adf68c4fc82a..8ceed19f7b9e 100644
--- a/cmake/find_llvm.cmake
+++ b/cmake/find_llvm.cmake
@@ -172,7 +172,11 @@ else()
set(targets_to_return "")
set(created_targets "")
foreach (llvm_lib ${_llvm_libs_list})
+ # a bug in llvm-config from LLVM 3.9
+ string(REGEX REPLACE "lib(libLLVM[-.a-zA-Z0-9]+\\.so)\\.so$" "\\1" llvm_lib "${llvm_lib}")
+
get_filename_component(llvm_lib_file_name "${llvm_lib}" NAME)
+
string(REGEX REPLACE "^(lib)?(LLVM[-.a-zA-Z0-9]+)\\..+$" "\\2" target_name "${llvm_lib_file_name}")
list(APPEND targets_to_return "${target_name}")
if (NOT TARGET "${target_name}")
--
2.18.0
++++++ 0003-llvm39-switch-KLEE_RUNTIME_BUILD_TYPE-to-Debug-Asser.patch ++++++
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
++++++ 0004-llvm40-handle-different-header-names.patch ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:22.368866306 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:22.368866306 +0200
@@ -14,7 +14,7 @@
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 @@
+#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 @@
#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 @@
#include
#include
--
-2.17.0
+2.18.0
++++++ 0005-llvm-APFloat-members-are-functions-in-LLVM-4.0.patch ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:22.380866337 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:22.380866337 +0200
@@ -9,10 +9,10 @@
1 file changed, 9 insertions(+)
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
-index b2178cccefd2..75132e0db71b 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 @@
return 0;
}
--
-2.17.0
+2.18.0
++++++ 0006-llvm40-errorOr-and-similar.patch ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:22.392866368 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:22.392866368 +0200
@@ -5,124 +5,49 @@
Signed-off-by: Jiri Slaby
---
- lib/Module/ModuleUtil.cpp | 50 ++++++++++++++++++++++++++++++++-------
- 1 file changed, 41 insertions(+), 9 deletions(-)
+ 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 8aa070743048..ad847de0b368 100644
+index c2792454d904..7f4bdb49380a 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
+@@ -432,7 +432,7 @@ bool klee::loadFile(const std::string &fileName, LLVMContext &context,
+ if (auto archive = dyn_castobject::Archive(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)
- #elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 5)
-@@ -229,8 +229,14 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er
+- 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 childErr = AI;
+ object::Archive::child_iterator childOrErr = AI;
#endif
+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0)
-+ Expected<StringRef> memberNameErr = childErr->getName();
-+ ec = memberNameErr ? std::error_code() :
-+ errorToErrorCode(memberNameErr.takeError());
++ Expected<StringRef> memberNameErr = childOrErr->getName();
++ ec = memberNameErr ? std::error_code() :
++ errorToErrorCode(memberNameErr.takeError());
+#else
- ErrorOr<StringRef> memberNameErr = childErr->getName();
- ec = memberNameErr.getError();
+ ErrorOr<StringRef> memberNameErr = childOrErr->getName();
+ ec = memberNameErr.getError();
+#endif
- if (!ec) {
- memberName = memberNameErr.get();
+ if (!ec) {
+ memberName = memberNameErr.get();
#else
-@@ -267,7 +273,10 @@ static bool linkBCA(object::Archive* archive, Module* composite, std::string& er
+@@ -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 (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<MemoryBufferRef> buff = childErr->getMemoryBufferRef();
-+ ec = buff ? std::error_code() : errorToErrorCode(buff.takeError());
++ Expected<MemoryBufferRef> buff = childOrErr->getMemoryBufferRef();
++ ec = buff ? std::error_code() : errorToErrorCode(buff.takeError());
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
- ErrorOr<MemoryBufferRef> buff = childErr->getMemoryBufferRef();
- ec = buff.getError();
+ ErrorOr<MemoryBufferRef> buff = childOrErr->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.0
+2.18.0
++++++ 0007-llvm-use-chrono-helpers-from-LLVM-4.0.patch ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:22.400866389 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:22.404866399 +0200
@@ -69,10 +69,10 @@
}
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 @@
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 @@
+
+#endif
--
-2.17.0
+2.18.0
++++++ 0008-llvm-PointerType-is-not-SequentialType-in-LLVM-4.patch ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:22.412866420 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:22.416866430 +0200
@@ -27,10 +27,10 @@
CurTy = 0;
}
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
-index 75132e0db71b..1c08870b7a20 100644
+index 1a5b7b9df527..51d36b352e5c 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
-@@ -2598,8 +2598,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 @@
uint64_t elementSize =
kmodule->targetData->getTypeStoreSize(set->getElementType());
Value *operand = ii.getOperand();
-@@ -2613,7 +2612,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 @@
}
kgepi->offset = constantOffset->getZExtValue();
--
-2.17.0
+2.18.0
++++++ 0009-llvm40-gep_type_iterator-has-no-operator.patch ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:22.420866441 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:22.424866451 +0200
@@ -28,5 +28,5 @@
const StructLayout *SL = kmodule->targetData->getStructLayout(STy);
base = base->Add(
--
-2.17.0
+2.18.0
++++++ 0010-llvm50-avoid-on-function-arg_begin.patch ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:22.432866472 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:22.436866482 +0200
@@ -18,10 +18,10 @@
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 @@
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::vectorllvm::Module> &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 @@
args.push_back(Constant::getNullValue(ft->getParamType(4))); // app_fini
args.push_back(Constant::getNullValue(ft->getParamType(5))); // rtld_fini
--
-2.17.0
+2.18.0
++++++ 0011-llvm50-integerPartWidth-is-from-llvm-APFloatBase.patch ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:22.448866513 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:22.448866513 +0200
@@ -12,10 +12,10 @@
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<Expr> ConstantExpr::fromMemory(void *address, Width width) {
+@@ -333,7 +333,11 @@ ref<Expr> ConstantExpr::fromMemory(void *address, Width width) {
// FIXME: what about machines without x87 support?
default:
return ConstantExpr::alloc(llvm::APInt(width,
@@ -28,5 +28,5 @@
}
}
--
-2.17.0
+2.18.0
++++++ 0012-llvm50-handle-getOrInsertFunction-terminator.patch ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:22.456866534 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:22.460866544 +0200
@@ -10,11 +10,11 @@
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 @@
}
diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp
-index e10e886e8915..d4f93bdc591e 100644
+index c48952c28004..ab16a2654492 100644
--- a/lib/Module/IntrinsicCleaner.cpp
+++ b/lib/Module/IntrinsicCleaner.cpp
-@@ -214,7 +214,8 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) {
- // Intrisic instruction "llvm.trap" found. Directly lower it to
+@@ -210,7 +210,8 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) {
+ // Intrinsic instruction "llvm.trap" found. Directly lower it to
// a call of the abort() function.
Function *F = cast<Function>(
- M.getOrInsertFunction("abort", Type::getVoidTy(ctx), NULL));
@@ -72,10 +72,10 @@
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<Function>(mainModule->getOrInsertFunction("klee_init_env",
Type::getVoidTy(ctx),
argcPtr->getType(),
@@ -86,35 +86,6 @@
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.0
+2.18.0
++++++ 0013-llvm50-SwitchInst-case-functions-now-return-pointers.patch ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:22.468866565 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:22.468866565 +0200
@@ -15,10 +15,10 @@
1 file changed, 4 insertions(+)
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
-index 1c08870b7a20..ee6821b6dc18 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<IntegerType>(si->getCondition()->getType());
ConstantInt *ci = ConstantInt::get(Ty, CE->getZExtValue());
@@ -31,5 +31,5 @@
} else {
// Handle possible different branch targets
--
-2.17.0
+2.18.0
++++++ 0014-llvm50-handle-new-file_magic-s-location.patch ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:22.480866596 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:22.480866596 +0200
@@ -7,16 +7,12 @@
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 @@
+#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 @@
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_ptrllvm::Module 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)
- Expectedobject::Binary > arch =
- object::createBinary(Buffer, &Context);
+ Expectedobject::Binary > archOwner =
+ object::createBinary(Buffer, &context);
--
-2.17.0
+2.18.0
++++++ 0015-llvm50-use-MutableArrayRef-for-APFloat-convertToInte.patch ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:22.488866616 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:22.488866616 +0200
@@ -13,10 +13,10 @@
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
-index ee6821b6dc18..9004b46e8f15 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 @@
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 @@
bindLocal(ki, state, ConstantExpr::alloc(value, resultType));
break;
--
-2.17.0
+2.18.0
++++++ 0016-llvm50-AllocaInst-takes-address-space.patch ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:22.500866647 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:22.504866658 +0200
@@ -12,10 +12,10 @@
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 @@
/* Insert void klee_init_env(int* argc, char*** argv) */
std::vector params;
--
-2.17.0
+2.18.0
++++++ 0017-llvm50-Intrinsic-objectsize-has-three-arguments.patch ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:22.512866679 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:22.512866679 +0200
@@ -14,10 +14,10 @@
1 file changed, 16 insertions(+)
diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp
-index d4f93bdc591e..e8c63cd334d0 100644
+index ab16a2654492..19807ce08583 100644
--- a/lib/Module/IntrinsicCleaner.cpp
+++ b/lib/Module/IntrinsicCleaner.cpp
-@@ -230,13 +230,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 @@
IntegerType *intType = dyn_cast<IntegerType>(ii->getType());
assert(intType && "intrinsic does not have integer return type");
--
-2.17.0
+2.18.0
++++++ 0018-llvm50-test-change-objectsize.patch ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:22.520866699 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:22.520866699 +0200
@@ -95,5 +95,5 @@
declare void @abort() noreturn nounwind
--
-2.17.0
+2.18.0
++++++ 0019-llvm50-test-add-disable-O0-optnone-to-O0.patch ++++++
++++ 1564 lines (skipped)
++++++ 0020-llvm50-CallSite.paramHasAttr-is-indexed-from-0.patch ++++++
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<CallInst>(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
++++++ 0019-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch -> 0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch ++++++
--- /work/SRC/openSUSE:Factory/klee/0019-llvm60-SetVersionPrinter-now-passes-down-a-stream.patch 2018-05-30 12:29:50.796834527 +0200
+++ /work/SRC/openSUSE:Factory/.klee.new/0021-llvm6-SetVersionPrinter-now-passes-down-a-stream.patch 2018-09-03 10:36:21.688864547 +0200
@@ -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 @@
llvm::cl::PrintVersionMessage();
}
--
-2.17.0
+2.18.0
++++++ 0020-llvm60-handle-headers-renaming.patch -> 0022-llvm6-handle-headers-renaming.patch ++++++
--- /work/SRC/openSUSE:Factory/klee/0020-llvm60-handle-headers-renaming.patch 2018-05-30 12:29:50.808834087 +0200
+++ /work/SRC/openSUSE:Factory/.klee.new/0022-llvm6-handle-headers-renaming.patch 2018-09-03 10:36:21.696864568 +0200
@@ -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 @@
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 @@
using namespace llvm;
--
-2.17.0
+2.18.0
++++++ FileCheck.cpp ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:22.560866803 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:22.564866813 +0200
@@ -10,7 +10,7 @@
// FileCheck does a line-by line check of a file that validates whether it
// contains the expected content. This is useful for regression tests etc.
//
-// This program exits with an error status of 2 on error, exit status of 0 if
+// This program exits with an exit status of 2 on error, exit status of 0 if
// the file matched the expected contents, and exit status of 1 if it did not
// contain the expected contents.
//
@@ -62,6 +62,10 @@
"this pattern occur which are not matched by a positive pattern"),
cl::value_desc("pattern"));
+static cl::liststd::string GlobalDefines("D", cl::Prefix,
+ cl::desc("Define a variable to be used in capture patterns."),
+ cl::value_desc("VAR=VALUE"));
+
static cl::opt<bool> AllowEmptyInput(
"allow-empty", cl::init(false),
cl::desc("Allow the input file to be empty. This is useful when making\n"
@@ -73,6 +77,12 @@
"Allows leading and trailing whitespace if --strict-whitespace\n"
"is not also passed."));
+static cl::opt<bool> EnableVarScope(
+ "enable-var-scope", cl::init(false),
+ cl::desc("Enables scope for regex variables. Variables with names that\n"
+ "do not start with '$' will be reset at the beginning of\n"
+ "each CHECK-LABEL block."));
+
typedef cl::liststd::string::const_iterator prefix_iterator;
//===----------------------------------------------------------------------===//
@@ -263,15 +273,19 @@
// is relaxed, more strict check is performed in \c EvaluateExpression.
bool IsExpression = false;
for (unsigned i = 0, e = Name.size(); i != e; ++i) {
- if (i == 0 && Name[i] == '@') {
- if (NameEnd != StringRef::npos) {
- SM.PrintMessage(SMLoc::getFromPointer(Name.data()),
- SourceMgr::DK_Error,
- "invalid name in named regex definition");
- return true;
+ if (i == 0) {
+ if (Name[i] == '$') // Global vars start with '$'
+ continue;
+ if (Name[i] == '@') {
+ if (NameEnd != StringRef::npos) {
+ SM.PrintMessage(SMLoc::getFromPointer(Name.data()),
+ SourceMgr::DK_Error,
+ "invalid name in named regex definition");
+ return true;
+ }
+ IsExpression = true;
+ continue;
}
- IsExpression = true;
- continue;
}
if (Name[i] != '_' && !isalnum(Name[i]) &&
(!IsExpression || (Name[i] != '+' && Name[i] != '-'))) {
@@ -1193,7 +1207,7 @@
// If there's CHECK-NOTs between two CHECK-DAGs or from CHECK to
// CHECK-DAG, verify that there's no 'not' strings occurred in that
// region.
- StringRef SkippedRegion = Buffer.substr(LastPos, MatchPos);
+ StringRef SkippedRegion = Buffer.slice(LastPos, MatchPos);
if (CheckNot(SM, SkippedRegion, NotStrings, VariableTable))
return StringRef::npos;
// Clear "not strings".
@@ -1262,6 +1276,18 @@
errs() << "\n";
}
+// Remove local variables from \p VariableTable. Global variables
+// (start with '$') are preserved.
+static void ClearLocalVars(StringMap<StringRef> &VariableTable) {
+ SmallVector LocalVars;
+ for (const auto &Var : VariableTable)
+ if (Var.first()[0] != '$')
+ LocalVars.push_back(Var.first());
+
+ for (const auto &Var : LocalVars)
+ VariableTable.erase(Var);
+}
+
/// Check the input to FileCheck provided in the \p Buffer against the \p
/// CheckStrings read from the check file.
///
@@ -1273,6 +1299,9 @@
/// VariableTable - This holds all the current filecheck variables.
StringMap<StringRef> VariableTable;
+ for (const auto& Def : GlobalDefines)
+ VariableTable.insert(StringRef(Def).split('='));
+
unsigned i = 0, j = 0, e = CheckStrings.size();
while (true) {
StringRef CheckRegion;
@@ -1298,6 +1327,9 @@
++j;
}
+ if (EnableVarScope)
+ ClearLocalVars(VariableTable);
+
for (; i != j; ++i) {
const CheckString &CheckStr = CheckStrings[i];
++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:22.588866875 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:22.588866875 +0200
@@ -1,4 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">git://github.com/klee/klee.git</param>
- <param name="changesrevision">d2fbdf74493d69e73fbfaedc0d59e593dfd7c69d</param></service></servicedata>
\ No newline at end of file
+ <param name="changesrevision">b893d2158ce001da97f2c741ac8320b4c3b9ed53</param></service></servicedata>
\ No newline at end of file
++++++ klee-1.4.0+20180614.tar.xz -> klee-1.4.0+20180829.tar.xz ++++++
++++ 6463 lines of diff (skipped)
++++++ not.cpp ++++++
--- /var/tmp/diff_new_pack.o7Dvao/_old 2018-09-03 10:36:23.100868199 +0200
+++ /var/tmp/diff_new_pack.o7Dvao/_new 2018-09-03 10:36:23.100868199 +0200
@@ -39,8 +39,7 @@
}
std::string ErrMsg;
- int Result = sys::ExecuteAndWait(*Program, argv, nullptr, nullptr, 0, 0,
- &ErrMsg);
+ int Result = sys::ExecuteAndWait(*Program, argv, nullptr, {}, 0, 0, &ErrMsg);
#ifdef _WIN32
// Handle abort() in msvcrt -- It has exit code as 3. abort(), aka
// unreachable, should be recognized as a crash. However, some binaries use