From c7c749d0de5023cf7c7fc77741506c6933a74884 Mon Sep 17 00:00:00 2001
From: jirislaby <>
Date: Mar 22 2023 21:43:42 +0000
Subject: Update klee to version 2.3+20230320 / rev 34 via SR 1073721
https://build.opensuse.org/request/show/1073721
by user jirislaby + dimstar_suse
- Update to version 2.3+20230320:
* ConstantArrayExprVisitor: Fix detection of multiple array indices
* ConstantArrayExprVisitor: Deduplicate `visitConcat` and `visitRead`
* llvm14 support
* Update KDAlloc unittests
* Don't fail `KleeStats.c` test if it takes 1s or longer
* Disable `const_array_opt1` for ubsan as well
* Fix uninitialised memory access while reading last path entry
* Fix building of runtime library and klee-replay
* Add support to disable memsan instrumentation; update UB/Asan suppression
* [MemSan] Mark memory objects modified by syscalls as initialised
* Fix compiler warning with newer compilers
* Use bitcode library paths via config generation instead of `-D` flags
* [cmake] Use LLVM's CMake functionality only
* Fixed a bug in KLEE libc's imple
---
diff --git a/packages/k/klee/.files b/packages/k/klee/.files
index d33754b..d5b619d 100644
Binary files a/packages/k/klee/.files and b/packages/k/klee/.files differ
diff --git a/packages/k/klee/.rev b/packages/k/klee/.rev
index b993781..900ec56 100644
--- a/packages/k/klee/.rev
+++ b/packages/k/klee/.rev
@@ -1277,4 +1277,41 @@ build with uclibc
- update FileCheck.cpp to llvm 14's
1031045
+
+ 01b34637115291a52a75f1449d76771a
+ 2.3+20230320
+
+ dimstar_suse
+ - Update to version 2.3+20230320:
+ * ConstantArrayExprVisitor: Fix detection of multiple array indices
+ * ConstantArrayExprVisitor: Deduplicate `visitConcat` and `visitRead`
+ * llvm14 support
+ * Update KDAlloc unittests
+ * Don't fail `KleeStats.c` test if it takes 1s or longer
+ * Disable `const_array_opt1` for ubsan as well
+ * Fix uninitialised memory access while reading last path entry
+ * Fix building of runtime library and klee-replay
+ * Add support to disable memsan instrumentation; update UB/Asan suppression
+ * [MemSan] Mark memory objects modified by syscalls as initialised
+ * Fix compiler warning with newer compilers
+ * Use bitcode library paths via config generation instead of `-D` flags
+ * [cmake] Use LLVM's CMake functionality only
+ * Fixed a bug in KLEE libc's implementation of strcmp: according to the C standard, characters should be compared as unsigned chars.
+ * Add some system tests for KDAlloc
+ * Integrate KDAlloc into KLEE
+ * Have the STP coverage build also provide Z3, so that the crosscheck solver can also be tested
+ * Add a few simple solver tests
+ * create klee-last as a relative link
+ * Fix integer overflow
+ * Add an extra check to test/Runtime/FreeStanding/memcpy_chk_err.c ensuring that a call to __memcpy_chk is emitted
+ * fix output check in test const_arr_opt1
+ * add missing FileCheck command to test
+ * Fixed some leaks in klee-replay
+ * fix FileCheck cmd of VarArgByVal test
+- remove (upstream):
+ * 0001-Module-InstructionOperandTypeCheckPass-Fix-Wbitwise-.patch
+ * 0001-llvm14-Add-LLVM-14-to-lit.cfg.patch
+ * 0002-llvm14-TargetRegistry.h-was-moved-from-Support-to-MC.patch
+ 1073721
+
diff --git a/packages/k/klee/.servicemark b/packages/k/klee/.servicemark
deleted file mode 100644
index 6ae27ac..0000000
--- a/packages/k/klee/.servicemark
+++ /dev/null
@@ -1 +0,0 @@
-c3d8e5111daa803a49329c79230069b4
diff --git a/packages/k/klee/0001-Module-InstructionOperandTypeCheckPass-Fix-Wbitwise-.patch b/packages/k/klee/0001-Module-InstructionOperandTypeCheckPass-Fix-Wbitwise-.patch
deleted file mode 100644
index d8c76a6..0000000
--- a/packages/k/klee/0001-Module-InstructionOperandTypeCheckPass-Fix-Wbitwise-.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?=
-Date: Sat, 5 Mar 2022 13:48:35 +0100
-Subject: Module/InstructionOperandTypeCheckPass: Fix
- -Wbitwise-instead-of-logical warning
-Git-repo: https://github.com/lzaoral/klee#llvm14
-Git-commit: fc8c581aac41a1b8df23a5f47d70ac2296be7ffc
-Patch-mainline: no
-References: llvm 14
-
-This warning was introduced in Clang 14.
-
-Signed-off-by: Jiri Slaby
----
- lib/Module/InstructionOperandTypeCheckPass.cpp | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/lib/Module/InstructionOperandTypeCheckPass.cpp b/lib/Module/InstructionOperandTypeCheckPass.cpp
-index 5f428471..e67f051c 100644
---- a/lib/Module/InstructionOperandTypeCheckPass.cpp
-+++ b/lib/Module/InstructionOperandTypeCheckPass.cpp
-@@ -94,7 +94,7 @@ bool checkInstruction(const Instruction *i) {
- // scalarizer pass might not remove these. This could be selecting which
- // vector operand to feed to another instruction. The Executor can handle
- // this so case so this is not a problem
-- return checkOperandTypeIsScalarInt(i, 0) &
-+ return checkOperandTypeIsScalarInt(i, 0) &&
- checkOperandsHaveSameType(i, 1, 2);
- }
- // Integer arithmetic, logical and shifting
-@@ -111,12 +111,12 @@ bool checkInstruction(const Instruction *i) {
- case Instruction::Shl:
- case Instruction::LShr:
- case Instruction::AShr: {
-- return checkOperandTypeIsScalarInt(i, 0) &
-+ return checkOperandTypeIsScalarInt(i, 0) &&
- checkOperandTypeIsScalarInt(i, 1);
- }
- // Integer comparison
- case Instruction::ICmp: {
-- return checkOperandTypeIsScalarIntOrPointer(i, 0) &
-+ return checkOperandTypeIsScalarIntOrPointer(i, 0) &&
- checkOperandTypeIsScalarIntOrPointer(i, 1);
- }
- // Integer Conversion
-@@ -136,7 +136,7 @@ bool checkInstruction(const Instruction *i) {
- case Instruction::FMul:
- case Instruction::FDiv:
- case Instruction::FRem: {
-- return checkOperandTypeIsScalarFloat(i, 0) &
-+ return checkOperandTypeIsScalarFloat(i, 0) &&
- checkOperandTypeIsScalarFloat(i, 1);
- }
- // Floating point conversion
-@@ -152,7 +152,7 @@ bool checkInstruction(const Instruction *i) {
- }
- // Floating point comparison
- case Instruction::FCmp: {
-- return checkOperandTypeIsScalarFloat(i, 0) &
-+ return checkOperandTypeIsScalarFloat(i, 0) &&
- checkOperandTypeIsScalarFloat(i, 1);
- }
- default:
---
-2.35.3
-
diff --git a/packages/k/klee/0001-cmake-implement-USE_MAP-to-support-single-LLVM-libra.patch b/packages/k/klee/0001-cmake-implement-USE_MAP-to-support-single-LLVM-libra.patch
new file mode 100644
index 0000000..5544457
--- /dev/null
+++ b/packages/k/klee/0001-cmake-implement-USE_MAP-to-support-single-LLVM-libra.patch
@@ -0,0 +1,243 @@
+From: Jiri Slaby
+Date: Wed, 22 Mar 2023 09:36:46 +0100
+Subject: [cmake] implement USE_MAP to support single LLVM library
+Patch-mainline: no
+References: https://github.com/klee/klee/pull/1585
+
+Otherwise we see:
+: && /var/lib/build/ccache/bin/clang++ -O2 -Wall ... test-randgen.cpp.o -o bin/ktest-randgen lib/libkleeBasic.a -lLLVMSupport && :
+ /usr/bin/ld: cannot find -lLLVMSupport: No such file or directory
+
+Fixes #1581.
+
+Signed-off-by: Jiri Slaby (SUSE)
+---
+ CMakeLists.txt | 8 ++++++++
+ lib/Basic/CMakeLists.txt | 7 ++++++-
+ lib/Core/CMakeLists.txt | 7 ++++++-
+ lib/Expr/CMakeLists.txt | 7 ++++++-
+ lib/Module/CMakeLists.txt | 34 +++++++++++++++++++---------------
+ lib/Solver/CMakeLists.txt | 7 ++++++-
+ lib/Support/CMakeLists.txt | 6 +++++-
+ test/CMakeLists.txt | 12 ++++++++++--
+ tools/kleaver/CMakeLists.txt | 6 +++++-
+ unittests/CMakeLists.txt | 6 +++++-
+ 10 files changed, 76 insertions(+), 24 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index cf01df24e9df..43f7144b4562 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -727,3 +727,11 @@ add_custom_target(uninstall
+ COMMENT "Uninstalling..."
+ VERBATIM
+ )
++
++set(USE_MAP FALSE)
++if (TARGET LLVMSupport)
++ get_target_property(LLVMSupport_TYPE LLVMSupport TYPE)
++ if (LLVMSupport STREQUAL SHARED_LIBRARY)
++ set(USE_MAP TRUE)
++ endif()
++endif()
+diff --git a/lib/Basic/CMakeLists.txt b/lib/Basic/CMakeLists.txt
+index 5671c1445948..d489ba9c47f6 100644
+--- a/lib/Basic/CMakeLists.txt
++++ b/lib/Basic/CMakeLists.txt
+@@ -11,7 +11,12 @@ add_library(kleeBasic
+ Statistics.cpp
+ )
+
+-llvm_map_components_to_libnames(llvm_libs support)
++if (USE_MAP)
++ llvm_map_components_to_libnames(llvm_libs support)
++else()
++ set(llvm_libs LLVM)
++endif()
++
+ target_link_libraries(kleeBasic PRIVATE ${llvm_libs})
+ target_compile_options(kleeBasic PRIVATE ${KLEE_COMPONENT_CXX_FLAGS})
+ target_compile_definitions(kleeBasic PRIVATE ${KLEE_COMPONENT_CXX_DEFINES})
+diff --git a/lib/Core/CMakeLists.txt b/lib/Core/CMakeLists.txt
+index 0905a7f03e98..5467f240aed1 100644
+--- a/lib/Core/CMakeLists.txt
++++ b/lib/Core/CMakeLists.txt
+@@ -36,7 +36,12 @@ target_link_libraries(kleeCore PRIVATE
+ kleeSupport
+ )
+
+-llvm_map_components_to_libnames(llvm_libs core executionengine mcjit native support)
++if (USE_MAP)
++ llvm_map_components_to_libnames(llvm_libs core executionengine mcjit native support)
++else()
++ set(llvm_libs LLVM)
++endif()
++
+ target_link_libraries(kleeCore PRIVATE ${llvm_libs} ${SQLITE3_LIBRARIES})
+ target_include_directories(kleeCore PRIVATE ${KLEE_INCLUDE_DIRS} ${LLVM_INCLUDE_DIRS} ${SQLITE3_INCLUDE_DIRS})
+ target_compile_options(kleeCore PRIVATE ${KLEE_COMPONENT_CXX_FLAGS})
+diff --git a/lib/Expr/CMakeLists.txt b/lib/Expr/CMakeLists.txt
+index 6b8a873bb8ed..eed9e9b354c1 100644
+--- a/lib/Expr/CMakeLists.txt
++++ b/lib/Expr/CMakeLists.txt
+@@ -26,7 +26,12 @@ add_library(kleaverExpr
+ Updates.cpp
+ )
+
+-llvm_map_components_to_libnames(llvm_libs support)
++if (USE_MAP)
++ llvm_map_components_to_libnames(llvm_libs support)
++else()
++ set(llvm_libs LLVM)
++endif()
++
+ target_link_libraries(kleaverExpr PRIVATE ${llvm_libs})
+ target_include_directories(kleaverExpr PRIVATE ${KLEE_INCLUDE_DIRS} ${LLVM_INCLUDE_DIRS})
+ target_compile_options(kleaverExpr PRIVATE ${KLEE_COMPONENT_CXX_FLAGS})
+diff --git a/lib/Module/CMakeLists.txt b/lib/Module/CMakeLists.txt
+index c81d395e2cb8..49b51a9936c6 100644
+--- a/lib/Module/CMakeLists.txt
++++ b/lib/Module/CMakeLists.txt
+@@ -26,21 +26,25 @@ add_library(kleeModule
+ ${KLEE_MODULE_COMPONENT_SRCS}
+ )
+
+-llvm_map_components_to_libnames(llvm_libs bitreader
+- bitwriter
+- codegen
+- ipo
+- irreader
+- linker
+- support
+- scalaropts
+- instcombine
+- transformutils
+- analysis
+- object
+- mc
+- binaryformat
+- )
++if (USE_MAP)
++ llvm_map_components_to_libnames(llvm_libs bitreader
++ bitwriter
++ codegen
++ ipo
++ irreader
++ linker
++ support
++ scalaropts
++ instcombine
++ transformutils
++ analysis
++ object
++ mc
++ binaryformat
++ )
++else()
++ set(llvm_libs LLVM)
++endif()
+
+ target_link_libraries(kleeModule PRIVATE ${llvm_libs})
+
+diff --git a/lib/Solver/CMakeLists.txt b/lib/Solver/CMakeLists.txt
+index 81a64882672c..bef0391325e5 100644
+--- a/lib/Solver/CMakeLists.txt
++++ b/lib/Solver/CMakeLists.txt
+@@ -32,7 +32,12 @@ add_library(kleaverSolver
+ Z3Solver.cpp
+ )
+
+-llvm_map_components_to_libnames(llvm_libs support)
++if (USE_MAP)
++ llvm_map_components_to_libnames(llvm_libs support)
++else()
++ set(llvm_libs LLVM)
++endif()
++
+ target_link_libraries(kleaverSolver PRIVATE
+ kleeBasic
+ kleaverExpr
+diff --git a/lib/Support/CMakeLists.txt b/lib/Support/CMakeLists.txt
+index 7ff4daa34e85..8e6e876dc415 100644
+--- a/lib/Support/CMakeLists.txt
++++ b/lib/Support/CMakeLists.txt
+@@ -18,7 +18,11 @@ add_library(kleeSupport
+ TreeStream.cpp
+ )
+
+-llvm_map_components_to_libnames(llvm_libs support)
++if (USE_MAP)
++ llvm_map_components_to_libnames(llvm_libs support)
++else()
++ set(llvm_libs LLVM)
++endif()
+
+ target_link_libraries(kleeSupport PRIVATE ${llvm_libs} ${ZLIB_LIBRARIES} ${TCMALLOC_LIBRARIES})
+ target_include_directories(kleeSupport PRIVATE ${KLEE_INCLUDE_DIRS} ${LLVM_INCLUDE_DIRS} ${TCMALLOC_INCLUDE_DIR})
+diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
+index 226eb08a3d1f..4c6bdfd172b9 100644
+--- a/test/CMakeLists.txt
++++ b/test/CMakeLists.txt
+@@ -96,7 +96,11 @@ if (DOWNLOAD_FILECHECK_SOURCE)
+ add_executable(FileCheck
+ ${FILECHECK_SRC_FILE}
+ )
+- llvm_map_components_to_libnames(FILECHECK_NEEDED_LIBS support)
++ if (USE_MAP)
++ llvm_map_components_to_libnames(FILECHECK_NEEDED_LIBS support)
++ else()
++ set(FILECHECK_NEEDED_LIBS LLVM)
++ endif()
+ target_include_directories(FileCheck PRIVATE ${LLVM_INCLUDE_DIRS})
+ target_link_libraries(FileCheck PRIVATE ${FILECHECK_NEEDED_LIBS})
+ endif()
+@@ -117,7 +121,11 @@ if (DOWNLOAD_NOT_SOURCE)
+ add_executable("not"
+ ${NOT_SRC_FILE}
+ )
+- llvm_map_components_to_libnames(NOT_NEEDED_LIBS support)
++ if (USE_MAP)
++ llvm_map_components_to_libnames(NOT_NEEDED_LIBS support)
++ else()
++ set(NOT_NEEDED_LIBS LLVM)
++ endif()
+ target_include_directories("not" PRIVATE ${LLVM_INCLUDE_DIRS})
+ target_link_libraries("not" PRIVATE ${NOT_NEEDED_LIBS})
+ endif()
+diff --git a/tools/kleaver/CMakeLists.txt b/tools/kleaver/CMakeLists.txt
+index acc681e506c3..414c4d53ad10 100644
+--- a/tools/kleaver/CMakeLists.txt
++++ b/tools/kleaver/CMakeLists.txt
+@@ -10,7 +10,11 @@ add_executable(kleaver
+ main.cpp
+ )
+
+-llvm_map_components_to_libnames(llvm_libs core support)
++if (USE_MAP)
++ llvm_map_components_to_libnames(llvm_libs core support)
++else()
++ set(llvm_libs LLVM)
++endif()
+
+ target_link_libraries(kleaver kleaverSolver ${llvm_libs})
+ target_include_directories(kleaver PRIVATE ${KLEE_INCLUDE_DIRS} ${LLVM_INCLUDE_DIRS})
+diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt
+index 9e30a9b76613..e852558d930a 100644
+--- a/unittests/CMakeLists.txt
++++ b/unittests/CMakeLists.txt
+@@ -201,7 +201,11 @@ endif()
+
+ add_library(unittest_main)
+ target_sources(unittest_main PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/TestMain.cpp")
+-llvm_map_components_to_libnames(UNITTEST_MAIN_LIBS support)
++if (USE_MAP)
++ llvm_map_components_to_libnames(UNITTEST_MAIN_LIBS support)
++else()
++ set(UNITTEST_MAIN_LIBS LLVM)
++endif()
+
+ target_link_libraries(unittest_main
+ PUBLIC
+--
+2.40.0
+
diff --git a/packages/k/klee/0001-gcc13-include-cstint-for-int-_t.patch b/packages/k/klee/0001-gcc13-include-cstint-for-int-_t.patch
new file mode 100644
index 0000000..23f97ad
--- /dev/null
+++ b/packages/k/klee/0001-gcc13-include-cstint-for-int-_t.patch
@@ -0,0 +1,39 @@
+From a5b33410851e89eff9b0baee52bc68c0d209aaeb Mon Sep 17 00:00:00 2001
+From: Jiri Slaby
+Date: Wed, 22 Mar 2023 09:48:50 +0100
+Subject: [PATCH] [gcc13] include cstint for *int*_t
+
+Otherwise we see errors like this with gcc13:
+include/klee/Statistics/Statistic.h:31:10: error: no type named 'uint32_t' in namespace 'std'
+---
+ include/klee/Core/Interpreter.h | 1 +
+ include/klee/Statistics/Statistic.h | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/include/klee/Core/Interpreter.h b/include/klee/Core/Interpreter.h
+index f14e3d88..04fdef88 100644
+--- a/include/klee/Core/Interpreter.h
++++ b/include/klee/Core/Interpreter.h
+@@ -9,6 +9,7 @@
+ #ifndef KLEE_INTERPRETER_H
+ #define KLEE_INTERPRETER_H
+
++#include
+ #include