The package rpms/klee.git has added or updated architecture specific content in its
spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/klee.git/commit/?id=3f766ec0b20d1....
Change:
-%ifarch x86_64
Thanks.
Full change:
============
commit f7b91c172afa538c72b0247c0df4c0931b60268d
Author: Lukas Zaoral <lzaoral(a)redhat.com>
Date: Wed Aug 18 18:10:28 2021 +0200
Add gating.yaml
diff --git a/gating.yaml b/gating.yaml
new file mode 100644
index 0000000..0943152
--- /dev/null
+++ b/gating.yaml
@@ -0,0 +1,19 @@
+--- !Policy
+product_versions:
+ - fedora-*
+decision_context: [bodhi_update_push_testing]
+subject_type: koji_build
+rules:
+ - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.rpmdeplint.functional}
+ - !PassingTestCaseRule {test_case_name:
fedora-ci.koji-build.rpminspect.static-analysis}
+ - !PassingTestCaseRule {test_case_name:
fedora-ci.koji-build.installability.functional}
+
+--- !Policy
+product_versions:
+ - fedora-*
+decision_context: [bodhi_update_push_stable]
+subject_type: koji_build
+rules:
+ - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.rpmdeplint.functional}
+ - !PassingTestCaseRule {test_case_name:
fedora-ci.koji-build.rpminspect.static-analysis}
+ - !PassingTestCaseRule {test_case_name:
fedora-ci.koji-build.installability.functional}
commit 3f766ec0b20d1ad2303612c34db6b69bab6e7936
Author: Lukas Zaoral <lzaoral(a)redhat.com>
Date: Wed Oct 13 13:48:18 2021 +0200
- Fix compilation with LLVM 13
- Enable uClibc and POSIX runtime support
- Enable SELinux support
diff --git a/.gitignore b/.gitignore
index 8015da7..3701e18 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
/klee-2.2.tar.gz
+/klee_uclibc_v1.2.tar.gz
+/uClibc-locale-030818.tgz
diff --git a/fix-libs-install.patch b/fix-libs-install.patch
new file mode 100644
index 0000000..d06cf45
--- /dev/null
+++ b/fix-libs-install.patch
@@ -0,0 +1,81 @@
+From d777e82c12c95282f9d2e2af3b57a587470cb846 Mon Sep 17 00:00:00 2001
+From: Lukas Zaoral <lzaoral(a)redhat.com>
+Date: Wed, 13 Oct 2021 15:51:03 +0200
+Subject: [PATCH] cmake: create hard links to klee-uclibc and klee-libcxx
+
+Before this change, we created a symlink to the given library in their expected
+location and then installed the original library. This was problematic as the
+install directives are performed the order they are encountered during the
+configure step and the installation of directory containing the symlink was
+processed after the installation of the original library. Therefore, the
+original libraries were installed but were subsequently overwritten by the
+symlinks.
+
+This commit changes the behaviour so that we create hard links in the expected
+location and install them together with the rest of the KLEE runtime as was
+originally intended.
+---
+ CMakeLists.txt | 27 +++++----------------------
+ 1 file changed, 5 insertions(+), 22 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1d00d7f9..04ede0b3 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -539,23 +539,14 @@ if (ENABLE_KLEE_UCLIBC)
+ endif()
+ message(STATUS "Found klee-uclibc library:
\"${KLEE_UCLIBC_C_BCA}\"")
+
+- # Make a symlink to KLEE_UCLIBC_C_BCA so KLEE can find it where it
+- # is expected.
+- execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
++ # Make a link to KLEE_UCLIBC_C_BCA so KLEE can find it where it is expected.
++ execute_process(COMMAND ${CMAKE_COMMAND} -E create_hardlink
+ "${KLEE_UCLIBC_C_BCA}"
+ "${KLEE_RUNTIME_DIRECTORY}/${KLEE_UCLIBC_BCA_NAME}"
+ )
+ list(APPEND KLEE_COMPONENT_CXX_DEFINES
+ -DKLEE_UCLIBC_BCA_NAME=\"${KLEE_UCLIBC_BCA_NAME}\")
+
+- # Add klee-uclibc to the install target. We install the original
+- # file rather than the symlink because CMake would just copy the symlink
+- # rather than the file.
+- install(FILES "${KLEE_UCLIBC_C_BCA}"
+- DESTINATION "${KLEE_INSTALL_RUNTIME_DIR}"
+- RENAME "${KLEE_UCLIBC_BCA_NAME}"
+- )
+-
+ else()
+ message(STATUS "klee-uclibc support disabled")
+ set(SUPPORT_KLEE_UCLIBC 0) # For config.h
+@@ -605,24 +596,16 @@ if (ENABLE_KLEE_LIBCXX)
+ endif()
+ message(STATUS "Found libc++ library:
\"${KLEE_LIBCXX_BC_PATH}\"")
+
+- # Make a symlink to KLEE_LIBCXX_BC_PATH so KLEE can find it where it
+- # is expected.
++ # Make a link to KLEE_LIBCXX_BC_PATH so KLEE can find it where it is
++ # expected.
+ file(MAKE_DIRECTORY "${KLEE_RUNTIME_DIRECTORY}")
+- execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
++ execute_process(COMMAND ${CMAKE_COMMAND} -E create_hardlink
+ "${KLEE_LIBCXX_BC_PATH}"
+ "${KLEE_RUNTIME_DIRECTORY}/${KLEE_LIBCXX_BC_NAME}"
+ )
+ list(APPEND KLEE_COMPONENT_CXX_DEFINES
+ -DKLEE_LIBCXX_BC_NAME=\"${KLEE_LIBCXX_BC_NAME}\")
+
+- # Add libc++ to the install target. We install the original
+- # file rather than the symlink because CMake would just copy the symlink
+- # rather than the file.
+- install(FILES "${KLEE_LIBCXX_BC_PATH}"
+- DESTINATION "${KLEE_INSTALL_RUNTIME_DIR}"
+- RENAME "${KLEE_LIBCXX_BC_NAME}"
+- )
+-
+ else()
+ message(STATUS "libc++ support disabled")
+ set(SUPPORT_KLEE_LIBCXX 0) # For config.h
+--
+2.31.1
+
diff --git a/fix-llvm13.patch b/fix-llvm13.patch
new file mode 100644
index 0000000..dc149a0
--- /dev/null
+++ b/fix-llvm13.patch
@@ -0,0 +1,324 @@
+From c3e0f2480dcd5be544dea42ad1f383ca80b833d3 Mon Sep 17 00:00:00 2001
+From: Lukas Zaoral <lzaoral(a)redhat.com>
+Date: Tue, 24 Aug 2021 13:59:21 +0200
+Subject: [PATCH 1/6] Support/FileHandling.cpp: rewrite to C++14
+
+---
+ klee/lib/Support/FileHandling.cpp | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/lib/Support/FileHandling.cpp b/klee/lib/Support/FileHandling.cpp
+index af532a0..5318270 100644
+--- a/lib/Support/FileHandling.cpp
++++ b/lib/Support/FileHandling.cpp
+@@ -22,10 +22,9 @@ namespace klee {
+
+ std::unique_ptr<llvm::raw_fd_ostream>
+ klee_open_output_file(const std::string &path, std::string &error) {
+- error = "";
+- std::unique_ptr<llvm::raw_fd_ostream> f;
++ error.clear();
+ std::error_code ec;
+- f = std::unique_ptr<llvm::raw_fd_ostream>(new llvm::raw_fd_ostream(path.c_str(),
ec, llvm::sys::fs::F_None)); // FIXME C++14
++ auto f = std::make_unique<llvm::raw_fd_ostream>(path.c_str(), ec,
llvm::sys::fs::F_None);
+ if (ec)
+ error = ec.message();
+ if (!error.empty()) {
+@@ -37,8 +36,8 @@ klee_open_output_file(const std::string &path, std::string
&error) {
+ #ifdef HAVE_ZLIB_H
+ std::unique_ptr<llvm::raw_ostream>
+ klee_open_compressed_output_file(const std::string &path, std::string &error) {
+- error = "";
+- std::unique_ptr<llvm::raw_ostream> f(new compressed_fd_ostream(path, error));
++ error.clear();
++ auto f = std::make_unique<compressed_fd_ostream>(path, error);
+ if (!error.empty()) {
+ f.reset(nullptr);
+ }
+--
+2.31.1
+
+
+From e50fcad5b1323d5af460c9d55db59065d9e2ac16 Mon Sep 17 00:00:00 2001
+From: Lukas Zaoral <lzaoral(a)redhat.com>
+Date: Tue, 24 Aug 2021 13:59:28 +0200
+Subject: [PATCH 2/6] llvm13: llvm::fs::F_None has been removed
+
+... and should be replaced with llvm::fs::OF_None since LLVM 7.
+
+See:
https://reviews.llvm.org/D101506
+
https://github.com/llvm/llvm-project/commit/1f67a3cba9b09636c56e2109d8a35...
+---
+ klee/lib/Support/FileHandling.cpp | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/lib/Support/FileHandling.cpp b/klee/lib/Support/FileHandling.cpp
+index 5318270..3a75684 100644
+--- a/lib/Support/FileHandling.cpp
++++ b/lib/Support/FileHandling.cpp
+@@ -24,7 +24,12 @@ std::unique_ptr<llvm::raw_fd_ostream>
+ klee_open_output_file(const std::string &path, std::string &error) {
+ error.clear();
+ std::error_code ec;
++
++#if LLVM_VERSION_CODE >= LLVM_VERSION(7, 0)
++ auto f = std::make_unique<llvm::raw_fd_ostream>(path.c_str(), ec,
llvm::sys::fs::OF_None);
++#else
+ auto f = std::make_unique<llvm::raw_fd_ostream>(path.c_str(), ec,
llvm::sys::fs::F_None);
++#endif
+ if (ec)
+ error = ec.message();
+ if (!error.empty()) {
+--
+2.31.1
+
+
+From 9ee0e3ca9eab65b6f898eb234f48b8c4faabd544 Mon Sep 17 00:00:00 2001
+From: Lukas Zaoral <lzaoral(a)redhat.com>
+Date: Tue, 24 Aug 2021 13:59:29 +0200
+Subject: [PATCH 3/6] llvm13: llvm::cl::GeneralCategory is no longer a global
+
+Therefore, llvm::cl::getGlobalCategoiry() should be used instead.
+
+See:
https://reviews.llvm.org/D105959
+---
+ klee/tools/kleaver/main.cpp | 5 ++++-
+ klee/tools/main.cpp | 4 ++++
+ 2 files changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/tools/kleaver/main.cpp b/klee/tools/kleaver/main.cpp
+index 57d384a..3af7b22 100644
+--- a/tools/kleaver/main.cpp
++++ b/tools/kleaver/main.cpp
+@@ -388,8 +388,11 @@ static bool printInputAsSMTklee/libv2(const char *Filename,
+ }
+
+ int main(int argc, char **argv) {
+-
++#if LLVM_VERSION_CODE >= LLVM_VERSION(13, 0)
++ KCommandLine::HideOptions(llvm::cl::getGeneralCategory());
++#else
+ KCommandLine::HideOptions(llvm::cl::GeneralCategory);
++#endif
+
+ bool success = true;
+
+diff --git a/tools/klee/main.cpp b/klee/tools/klee/main.cpp
+index 7e9b837..72e476b 100644
+--- a/tools/klee/main.cpp
++++ b/tools/klee/main.cpp
+@@ -1533,7 +1533,11 @@ loadBitcode(const std::string& inputFile,
+ int main(int argc, char **argv, char **envp) {
+ atexit(llvm_shutdown); // Call llvm_shutdown() on exit.
+
++#if LLVM_VERSION_CODE >= LLVM_VERSION(13, 0)
++ KCommandLine::HideOptions(llvm::cl::getGeneralCategory());
++#else
+ KCommandLine::HideOptions(llvm::cl::GeneralCategory);
++#endif
+
+ llvm::InitializeNativeTarget();
+
+--
+2.31.1
+
+
+From d275546e491b6dd1a032ad773a8343ac983ff0f3 Mon Sep 17 00:00:00 2001
+From: Lukas Zaoral <lzaoral(a)redhat.com>
+Date: Tue, 24 Aug 2021 13:59:31 +0200
+Subject: [PATCH 4/6] llvm13: CreateLoad API with implicit types has been
+ deprecated
+
+See:
https://github.com/llvm/llvm-project/commit/6312c53870897435b38881795460a...
+---
+ klee/lib/Core/ExternalDispatcher.cpp | 4 ++--
+ klee/lib/Module/IntrinsicCleaner.cpp | 11 +++++++----
+ 2 files changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/lib/Core/ExternalDispatcher.cpp b/klee/lib/Core/ExternalDispatcher.cpp
+index dc1fb0a..34e83b1 100644
+--- a/lib/Core/ExternalDispatcher.cpp
++++ b/lib/Core/ExternalDispatcher.cpp
+@@ -277,7 +277,7 @@ Function *ExternalDispatcherImpl::createDispatcher(Function *target,
+ ConstantInt::get(Type::getInt64Ty(ctx), (uintptr_t)(void *)&gTheArgsP),
+ PointerType::getUnqual(PointerType::getUnqual(Type::getInt64Ty(ctx))),
+ "argsp");
+- auto argI64s = Builder.CreateLoad(argI64sp, "args");
++ auto argI64s = Builder.CreateLoad(argI64sp->getType()->getPointerElementType(),
argI64sp, "args");
+
+ // Get the target function type.
+ FunctionType *FTy = cast<FunctionType>(
+@@ -296,7 +296,7 @@ Function *ExternalDispatcherImpl::createDispatcher(Function *target,
+ ConstantInt::get(Type::getInt32Ty(ctx), idx));
+
+ auto argp = Builder.CreateBitCast(argI64p, PointerType::getUnqual(argTy));
+- args[i] = Builder.CreateLoad(argp);
++ args[i] = Builder.CreateLoad(argp->getType()->getPointerElementType(), argp,
"");
+
+ unsigned argSize = argTy->getPrimitiveSizeInBits();
+ idx += ((!!argSize ? argSize : 64) + 63) / 64;
+diff --git a/lib/Module/IntrinsicCleaner.cpp b/klee/lib/Module/IntrinsicCleaner.cpp
+index 7fe3359..b91d277 100644
+--- a/lib/Module/IntrinsicCleaner.cpp
++++ b/lib/Module/IntrinsicCleaner.cpp
+@@ -82,24 +82,27 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module
&M) {
+ Builder.CreatePointerCast(dst, i8pp, "vacopy.cast.dst");
+ auto castedSrc =
+ Builder.CreatePointerCast(src, i8pp, "vacopy.cast.src");
+- auto load = Builder.CreateLoad(castedSrc, "vacopy.read");
++ auto load =
Builder.CreateLoad(castedSrc->getType()->getPointerElementType(), castedSrc,
"vacopy.read");
+ Builder.CreateStore(load, castedDst, false /* isVolatile */);
+ } else {
+ assert(WordSize == 8 && "Invalid word size!");
+ Type *i64p = PointerType::getUnqual(Type::getInt64Ty(ctx));
+ auto pDst = Builder.CreatePointerCast(dst, i64p,
"vacopy.cast.dst");
+ auto pSrc = Builder.CreatePointerCast(src, i64p,
"vacopy.cast.src");
+- auto val = Builder.CreateLoad(pSrc, std::string());
++
++ auto pType = pSrc->getType()->getPointerElementType();
++
++ auto val = Builder.CreateLoad(pType, pSrc, "");
+ Builder.CreateStore(val, pDst, ii);
+
+ auto off = ConstantInt::get(Type::getInt64Ty(ctx), 1);
+ pDst = Builder.CreateGEP(nullptr, pDst, off, std::string());
+ pSrc = Builder.CreateGEP(nullptr, pSrc, off, std::string());
+- val = Builder.CreateLoad(pSrc, std::string());
++ val = Builder.CreateLoad(pType, pSrc, "");
+ Builder.CreateStore(val, pDst);
+ pDst = Builder.CreateGEP(nullptr, pDst, off, std::string());
+ pSrc = Builder.CreateGEP(nullptr, pSrc, off, std::string());
+- val = Builder.CreateLoad(pSrc, std::string());
++ val = Builder.CreateLoad(pType, pSrc, "");
+ Builder.CreateStore(val, pDst);
+ }
+ ii->eraseFromParent();
+--
+2.31.1
+
+
+From cf6de8387db20ec030297a9448d00d6115cc36b7 Mon Sep 17 00:00:00 2001
+From: Lukas Zaoral <lzaoral(a)redhat.com>
+Date: Tue, 24 Aug 2021 13:59:32 +0200
+Subject: [PATCH 5/6] llvm13: CreateGEP no longer accepts nullptr
+
+See:
https://reviews.llvm.org/D105653
+---
+ klee/lib/Core/ExternalDispatcher.cpp | 2 +-
+ klee/lib/Module/IntrinsicCleaner.cpp | 17 +++++++++--------
+ 2 files changed, 10 insertions(+), 9 deletions(-)
+
+diff --git a/lib/Core/ExternalDispatcher.cpp b/klee/lib/Core/ExternalDispatcher.cpp
+index 34e83b1..ae5f268 100644
+--- a/lib/Core/ExternalDispatcher.cpp
++++ b/lib/Core/ExternalDispatcher.cpp
+@@ -292,7 +292,7 @@ Function *ExternalDispatcherImpl::createDispatcher(Function *target,
+ auto argTy =
+ (i < FTy->getNumParams() ? FTy->getParamType(i) :
(*ai)->getType());
+ auto argI64p =
+- Builder.CreateGEP(nullptr, argI64s,
++ Builder.CreateGEP(argI64s->getType()->getPointerElementType(), argI64s,
+ ConstantInt::get(Type::getInt32Ty(ctx), idx));
+
+ auto argp = Builder.CreateBitCast(argI64p, PointerType::getUnqual(argTy));
+diff --git a/lib/Module/IntrinsicCleaner.cpp b/klee/lib/Module/IntrinsicCleaner.cpp
+index b91d277..47827a7 100644
+--- a/lib/Module/IntrinsicCleaner.cpp
++++ b/lib/Module/IntrinsicCleaner.cpp
+@@ -90,19 +90,20 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module
&M) {
+ auto pDst = Builder.CreatePointerCast(dst, i64p,
"vacopy.cast.dst");
+ auto pSrc = Builder.CreatePointerCast(src, i64p,
"vacopy.cast.src");
+
+- auto pType = pSrc->getType()->getPointerElementType();
++ auto pSrcType = pSrc->getType()->getPointerElementType();
++ auto pDstType = pDst->getType()->getPointerElementType();
+
+- auto val = Builder.CreateLoad(pType, pSrc, "");
++ auto val = Builder.CreateLoad(pSrcType, pSrc);
+ Builder.CreateStore(val, pDst, ii);
+
+ auto off = ConstantInt::get(Type::getInt64Ty(ctx), 1);
+- pDst = Builder.CreateGEP(nullptr, pDst, off, std::string());
+- pSrc = Builder.CreateGEP(nullptr, pSrc, off, std::string());
+- val = Builder.CreateLoad(pType, pSrc, "");
++ pDst = Builder.CreateGEP(pDstType, pDst, off);
++ pSrc = Builder.CreateGEP(pSrcType, pSrc, off);
++ val = Builder.CreateLoad(pSrcType, pSrc);
+ Builder.CreateStore(val, pDst);
+- pDst = Builder.CreateGEP(nullptr, pDst, off, std::string());
+- pSrc = Builder.CreateGEP(nullptr, pSrc, off, std::string());
+- val = Builder.CreateLoad(pType, pSrc, "");
++ pDst = Builder.CreateGEP(pDstType, pDst, off);
++ pSrc = Builder.CreateGEP(pSrcType, pSrc, off);
++ val = Builder.CreateLoad(pSrcType, pSrc);
+ Builder.CreateStore(val, pDst);
+ }
+ ii->eraseFromParent();
+--
+2.31.1
+
+
+From 634db97407a7ef8841e84d2b94a55b208d3c12af Mon Sep 17 00:00:00 2001
+From: Lukas Zaoral <lzaoral(a)redhat.com>
+Date: Tue, 24 Aug 2021 13:59:33 +0200
+Subject: [PATCH 6/6] llvm13: std::string llvm::APInt::toString has been moved
+ to StringExtras.h
+
+See:
https://reviews.llvm.org/D103888
+---
+ klee/lib/Expr/Expr.cpp | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/lib/Expr/Expr.cpp b/klee/lib/Expr/Expr.cpp
+index 9aad63d..5b1bb68 100644
+--- a/lib/Expr/Expr.cpp
++++ b/lib/Expr/Expr.cpp
+@@ -17,6 +17,9 @@
+ #include "klee/Support/IntEvaluation.h"
+
+ #include "llvm/ADT/Hashing.h"
++#if LLVM_VERSION_CODE >= LLVM_VERSION(13, 0)
++#include "llvm/ADT/StringExtras.h"
++#endif
+ #include "llvm/Support/CommandLine.h"
+ #include "llvm/Support/raw_ostream.h"
+
+@@ -366,7 +369,11 @@ void ConstantExpr::toMemory(void *address) {
+ }
+
+ void ConstantExpr::toString(std::string &Res, unsigned radix) const {
++#if LLVM_VERSION_CODE >= LLVM_VERSION(13, 0)
++ Res = llvm::toString(value, radix, false);
++#else
+ Res = value.toString(radix, false);
++#endif
+ }
+
+ ref<ConstantExpr> ConstantExpr::Concat(const ref<ConstantExpr> &RHS) {
+--
+2.31.1
+
+From 5e8193b4ea8362d9ad3985031ceb39a2a4078d32 Mon Sep 17 00:00:00 2001
+From: Lukas Zaoral <lzaoral(a)redhat.com>
+Date: Wed, 13 Oct 2021 13:02:46 +0200
+Subject: [PATCH] llvm13: Add LLVM 13 to lit.cfg
+
+---
+ test/lit.cfg | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/lit.cfg b/test/lit.cfg
+index bf20c15e..60bcb781 100644
+--- a/test/lit.cfg
++++ b/test/lit.cfg
+@@ -158,7 +158,7 @@ config.substitutions.append(
+ # Add feature for the LLVM version in use, so it can be tested in REQUIRES and
+ # XFAIL checks. We also add "not-XXX" variants, for the same reason.
+ known_llvm_versions = { "3.8", "3.9", "4.0",
"5.0", "6.0", "7.0", "7.1", "8.0",
+- "9.0", "10.0", "11.0",
"11.1", "12.0" }
++ "9.0", "10.0", "11.0",
"11.1", "12.0", "13.0" }
+ current_llvm_version_tuple = (int(config.llvm_version_major),
int(config.llvm_version_minor))
+ current_llvm_version = "%s.%s" % current_llvm_version_tuple
+
+--
+2.31.1
diff --git a/fix-test-Feature-FunctionAlias.patch b/fix-test-Feature-FunctionAlias.patch
new file mode 100644
index 0000000..c3a68fa
--- /dev/null
+++ b/fix-test-Feature-FunctionAlias.patch
@@ -0,0 +1,29 @@
+From 00d84bd0038717c73d0c07fb6e62660da433615b Mon Sep 17 00:00:00 2001
+From: Lukas Zaoral <lzaoral(a)redhat.com>
+Date: Wed, 13 Oct 2021 13:23:04 +0200
+Subject: [PATCH] test/Feature/FunctionAlias.c: Add missing CHECK-UNKNOWN
+ prefix
+
+This test started to fail on LLVM 13 because FileCheck switched the
+default setting regarding the allowance of unused prefixes. This is now
+considered to be a fatal error.
+---
+ test/Feature/FunctionAlias.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/test/Feature/FunctionAlias.c b/test/Feature/FunctionAlias.c
+index e1d11d8c..c48b20f2 100644
+--- a/test/Feature/FunctionAlias.c
++++ b/test/Feature/FunctionAlias.c
+@@ -38,6 +38,8 @@
+
+ // CHECK-TYPE-MISMATCH: KLEE: WARNING: function-alias: @{{[a-z0-9]+}} could not be
replaced with @{{[a-z0-9]+}}
+
++// CHECK-UNKNOWN: KLEE: ERROR: function-alias: replacement function @unknownfunction
could not be found
++
+ // CHECK-SUCCESS: KLEE: function-alias: replaced @twoints with @twointsmul
+
+ // CHECK-REGEX-NO-MATCH: KLEE: ERROR: function-alias: no (replacable) match for
'xxx.*' found
+--
+2.31.1
+
diff --git a/fix-test-Runtime-POSIX-Futimesat.patch
b/fix-test-Runtime-POSIX-Futimesat.patch
new file mode 100644
index 0000000..c4ec6cf
--- /dev/null
+++ b/fix-test-Runtime-POSIX-Futimesat.patch
@@ -0,0 +1,28 @@
+From 741a5a21c69cb3d93e04965add157fe94c2b28c4 Mon Sep 17 00:00:00 2001
+From: Lukas Zaoral <lzaoral(a)redhat.com>
+Date: Tue, 21 Sep 2021 09:37:33 +0200
+Subject: [PATCH] test/Runtime/POSIX/Futimesat: Compile with -std=c99 so that
+ 'linux' is not a defined macro
+
+Fixes #1424
+---
+ test/Runtime/POSIX/Futimesat.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/Runtime/POSIX/Futimesat.c b/test/Runtime/POSIX/Futimesat.c
+index 11ecf341..61af2805 100644
+--- a/test/Runtime/POSIX/Futimesat.c
++++ b/test/Runtime/POSIX/Futimesat.c
+@@ -1,6 +1,8 @@
+-// RUN: %clang %s -emit-llvm %O0opt -g -c -DTDIR=%T -o %t2.bc
++// RUN: %clang %s -std=c99 -emit-llvm %O0opt -g -c -DTDIR=%T -o %t2.bc
+ // RUN: touch %T/futimesat-dummy
+ // RUN: rm -rf %t.klee-out
+ // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc
--sym-files 1 10
++
++#define _POSIX_C_SOURCE 200809L
+
+ #include <assert.h>
+--
+2.31.1
+
diff --git a/klee.spec b/klee.spec
index 4c9b3ee..8592703 100644
--- a/klee.spec
+++ b/klee.spec
@@ -1,36 +1,59 @@
Name: klee
Version: 2.2
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Symbolic Execution Engine
+%define uclibc_version 1.2
+%define uclibc_dir %{name}-uclibc-%{name}_uclibc_v%{uclibc_version}
+
# Licenses
#
-# * Most files are under NCSA.
-# * cmake/GetGitRevisionDescription.cmake* are under Boost.
-# * cmake/modules/FindSQLite3.cmake is under MIT.
-# * lib/Support/RNG.cpp and runtime/klee-libc/stpcpy.c are under BSD.
-# * runtime/Freestanding/memcmp.c and runtime/klee-libc/{atoi.c,memchr.c,
-# strcat.c,strncmp.c,strncpy.c,strtol.c,strtoul.c} are under BSD with
-# advertising.
-
-License: NCSA and Boost and MIT and BSD and BSD with advertising
+# * KLEE:
+# * Most files are under NCSA.
+# * cmake/GetGitRevisionDescription.cmake* are under Boost.
+# * cmake/modules/FindSQLite3.cmake is under MIT.
+# * lib/Support/RNG.cpp and runtime/klee-libc/stpcpy.c are under BSD.
+# * runtime/Freestanding/memcmp.c and runtime/klee-libc/{atoi.c,memchr.c,
+# strcat.c,strncmp.c,strncpy.c,strtol.c,strtoul.c} are under BSD with
+# advertising.
+# * KLEE uClibc is under LGPLv2.
+
+License: NCSA and Boost and MIT and BSD and BSD with advertising and LGPLv2
URL: https://%{name}.github.io
+
+# KLEE
Source0:
https://github.com/%{name}/%{name}/archive/v%{version}/%{name}-%{version}...
-# KLEE does not compile on 32 bit architectures.
-Excludearch: %{ix86} %{arm}
+# KLEE uClibc
+Source1:
https://github.com/%{name}/%{name}-uclibc/archive/refs/tags/%{name}_uclib...
+Source2:
https://www.uclibc.org/downloads/uClibc-locale-030818.tgz
+
+# KLEE officially supports x86_64 only.
+ExclusiveArch: x86_64
#
https://github.com/klee/klee/pull/1403
Patch0: use-python3.patch
#
https://github.com/klee/klee/pull/1389
Patch1: fix-llvm12.patch
-Patch2: use-system-gtest.patch
+Patch2: fix-llvm13.patch
+Patch3: use-system-gtest.patch
+#
https://github.com/klee/klee/pull/1385
+Patch4: posix-runtime.patch
+#
https://github.com/klee/klee/pull/1426
+Patch5: fix-test-Runtime-POSIX-Futimesat.patch
+#
https://github.com/klee/klee/pull/1429
+Patch6: fix-test-Feature-FunctionAlias.patch
+#
https://github.com/klee/klee/pull/1430
+Patch7: fix-libs-install.patch
+#
https://github.com/klee/klee-uclibc/pull/39
+Patch8: uclibc-python3.patch
BuildRequires: clang
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: gperftools-devel
+BuildRequires: libselinux-devel
BuildRequires: llvm-devel
BuildRequires: make
BuildRequires: ninja-build
@@ -38,10 +61,6 @@ BuildRequires: sqlite-devel
BuildRequires: stp-devel
BuildRequires: zlib-devel
-# FIXME: Remove when rhbz#1981466 is resolved.
-BuildRequires: cryptominisat-devel
-BuildRequires: minisat2-devel
-
# Needed for tests.
BuildRequires: gtest-devel
BuildRequires: python3-lit
@@ -51,14 +70,43 @@ BuildRequires: python3-tabulate
Symbolic virtual machine built on top of the LLVM compiler infrastructure.
%prep
-%autosetup -p1
+# Prepare KLEE
+%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+
+# Prepare KLEE uClibc
+%setup -q -T -D -a 1
+cd %{uclibc_dir}
+cp %{SOURCE2} extra/locale/
+%patch8 -p1
%build
-%cmake -GNinja \
- -DENABLE_DOXYGEN:BOOL=OFF \
- -DENABLE_SOLVER_STP:BOOL=ON \
- -DENABLE_SOLVER_Z3:BOOL=OFF \
- -DENABLE_SOLVER_METASMT:BOOL=OFF \
+# Build KLEE uClibc
+BUILD_DIR="$PWD"
+cd %{uclibc_dir}
+
+# We do not want to use Fedora's default compiler flags as this library is a
+# build dependency for KLEE only!
+./configure --make-llvm-lib # custom, not autotools
+%make_build
+
+# KLEE
+cd "$BUILD_DIR"
+%cmake -GNinja \
+ -DENABLE_DOXYGEN:BOOL=OFF \
+ -DENABLE_POSIX_RUNTIME:BOOL=ON \
+ -DENABLE_KLEE_UCLIBC:BOOL=ON \
+ -DKLEE_UCLIBC_PATH=%{uclibc_dir} \
+ -DENABLE_SOLVER_METASMT:BOOL=OFF \
+ -DENABLE_SOLVER_STP:BOOL=ON \
+ -DENABLE_SOLVER_Z3:BOOL=OFF \
-DENABLE_UNIT_TESTS:BOOL=ON
%cmake_build
@@ -66,8 +114,6 @@ Symbolic virtual machine built on top of the LLVM compiler
infrastructure.
%cmake_install
%check
-# Tests expect x86_64.
-%ifarch x86_64
%cmake_build --target systemtests
# FIXME: Workaround as lit is currently incompatible with upstream gtest.
@@ -75,7 +121,6 @@ Symbolic virtual machine built on top of the LLVM compiler
infrastructure.
for test in ./%{__cmake_builddir}/unittests/*Test; do
./"$test"
done
-%endif
%files
%doc NEWS README.md
@@ -106,5 +151,11 @@ done
%{_libdir}/libkleeRuntest.so.1.0
%changelog
+* Wed Oct 13 2021 Lukas Zaoral <lzaoral(a)redhat.com> - 2.2-2
+- Fix compilation with LLVM 13
+- Enable uClibc and POSIX runtime support as requested by upstream.
+- Due to uClibc, package is now buildable only on x86_64.
+- Enable SELinux support
+
* Thu Jul 15 2021 Lukas Zaoral <lzaoral(a)redhat.com> - 2.2-1
- First release
diff --git a/posix-runtime.patch b/posix-runtime.patch
new file mode 100644
index 0000000..595d1c3
--- /dev/null
+++ b/posix-runtime.patch
@@ -0,0 +1,46 @@
+From 148a68df793fca84a36fefd8824ea54fdf6583f4 Mon Sep 17 00:00:00 2001
+From: Jiri Slaby <jirislaby(a)gmail.com>
+Date: Fri, 19 Feb 2021 08:02:45 +0100
+Subject: [PATCH] runtime/POSIX: fix failures with glibc-2.33
+
+commit 8ed005daf0ab of glibc-2.33 (Remove stat wrapper functions, move
+them to exported symbols) removed renames of `__fxstat`, `__xstat`, and
+`__lxstat` to `__fxstat64`, `__xstat64`, and `__lxstat64`, respectively.
+
+But we relied on the renames to build `fd_64.c` properly. With glibc
+2.33, we now see link failures of the POSIX runtime:
+error: Linking globals named '__xstat': symbol multiply defined!
+
+Rename the functions using `__REDIRECT_NTH` in the code as
+`__USE_FILE_OFFSET64` case (which we define at the top of the file by
+`#define _FILE_OFFSET_BITS 64`) did exactly that.
+
+Fixes #1384.
+---
+ runtime/POSIX/fd_64.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/runtime/POSIX/fd_64.c b/runtime/POSIX/fd_64.c
+index eec41f11..aea9ebac 100644
+--- a/runtime/POSIX/fd_64.c
++++ b/runtime/POSIX/fd_64.c
+@@ -73,6 +73,16 @@ int openat(int fd, const char *pathname, int flags, ...) {
+ return __fd_openat(fd, pathname, flags, mode);
+ }
+
++/* removed in glibc 2.33 */
++#ifdef __REDIRECT_NTH
++extern int __REDIRECT_NTH(__fxstat, (int __ver, int __fildes,
++ struct stat *__stat_buf), __fxstat64);
++extern int __REDIRECT_NTH(__xstat, (int __ver, const char *__filename,
++ struct stat *__stat_buf), __xstat64);
++extern int __REDIRECT_NTH(__lxstat, (int __ver, const char *__filename,
++ struct stat *__stat_buf), __lxstat64);
++#endif
++
+ off64_t lseek(int fd, off64_t offset, int whence) {
+ return __fd_lseek(fd, offset, whence);
+ }
+--
+2.31.1
+
diff --git a/sources b/sources
index 14b46e9..85f9b06 100644
--- a/sources
+++ b/sources
@@ -1 +1,3 @@
SHA512 (klee-2.2.tar.gz) =
ed4ab4f26082700affa44efff071547c6868b43c5cc2491d180ab939ec8e8c8f7926c2a58102057a5c0a9a49d349c6786b737d6a8b8ad0dbd0539cac95fbc983
+SHA512 (klee_uclibc_v1.2.tar.gz) =
845eb2a68960c98da8a28c595b666d3642e24d34a4723f262164184168e8e8be638abbae2615ece38305570f335b9e7016eaaecaa9cb178ec5406b90b39ac945
+SHA512 (uClibc-locale-030818.tgz) =
9d2d083f70ad01b14e6db6a5dac3c5089f69167b83c83ecd1ccf407436b4f545609087fe1802c24187651644f4e43d2f611f2283b0a6130374be31d8f52b70d6
diff --git a/uclibc-python3.patch b/uclibc-python3.patch
new file mode 100644
index 0000000..9f6166f
--- /dev/null
+++ b/uclibc-python3.patch
@@ -0,0 +1,23 @@
+From b00dc26caf49381e64512e9106c572ce2ff70b59 Mon Sep 17 00:00:00 2001
+From: Lukas Zaoral <lzaoral(a)redhat.com>
+Date: Mon, 23 Aug 2021 10:55:30 +0200
+Subject: [PATCH] configure: use Python 3 explicitly
+
+Fedora does not ship unversioned Python binary by default.
+---
+ configure | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure b/configure
+index 688449f..c075118 100755
+--- a/configure
++++ b/configure
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ """
+ Configure the build of klee-uclibc. It can be built
+ as a native library or as an LLVM bitcode archive.
+--
+2.31.1
+