From fa7c751bd923cd9fb4790fe7fb51fafa2faa1db6 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 9 Jan 2024 13:49:45 +0100 Subject: build: Bump clang minimum supported version to 14 --- ci/test/00_setup_env_i686_multiprocess.sh | 2 +- ci/test/00_setup_env_native_nowallet_libbitcoinkernel.sh | 8 ++++---- doc/dependencies.md | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ci/test/00_setup_env_i686_multiprocess.sh b/ci/test/00_setup_env_i686_multiprocess.sh index 7b46835b57..b9025afac3 100755 --- a/ci/test/00_setup_env_i686_multiprocess.sh +++ b/ci/test/00_setup_env_i686_multiprocess.sh @@ -13,5 +13,5 @@ export PACKAGES="cmake llvm clang g++-multilib" export DEP_OPTS="DEBUG=1 MULTIPROCESS=1" export GOAL="install" export BITCOIN_CONFIG="--enable-debug CC='clang -m32' CXX='clang++ -m32' \ -LDFLAGS='--rtlib=compiler-rt -lgcc_s' CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE'" +CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE'" export BITCOIND=bitcoin-node # Used in functional tests diff --git a/ci/test/00_setup_env_native_nowallet_libbitcoinkernel.sh b/ci/test/00_setup_env_native_nowallet_libbitcoinkernel.sh index 20044d7e1c..6f0b9cc285 100755 --- a/ci/test/00_setup_env_native_nowallet_libbitcoinkernel.sh +++ b/ci/test/00_setup_env_native_nowallet_libbitcoinkernel.sh @@ -7,9 +7,9 @@ export LC_ALL=C.UTF-8 export CONTAINER_NAME=ci_native_nowallet_libbitcoinkernel -export CI_IMAGE_NAME_TAG="docker.io/debian:bullseye" -# Use minimum supported python3.9 and clang-13, see doc/dependencies.md -export PACKAGES="python3-zmq clang-13 llvm-13 libc++abi-13-dev libc++-13-dev" -export DEP_OPTS="NO_WALLET=1 CC=clang-13 CXX='clang++-13 -stdlib=libc++'" +export CI_IMAGE_NAME_TAG="docker.io/ubuntu:22.04" +# Use minimum supported python3.9 (or best-effort 3.10) and clang-14, see doc/dependencies.md +export PACKAGES="python3-zmq clang-14 llvm-14 libc++abi-14-dev libc++-14-dev" +export DEP_OPTS="NO_WALLET=1 CC=clang-14 CXX='clang++-14 -stdlib=libc++'" export GOAL="install" export BITCOIN_CONFIG="--enable-reduce-exports --enable-experimental-util-chainstate --with-experimental-kernel-lib --enable-shared" diff --git a/doc/dependencies.md b/doc/dependencies.md index ba8643be79..e992b50b06 100644 --- a/doc/dependencies.md +++ b/doc/dependencies.md @@ -8,7 +8,7 @@ You can find installation instructions in the `build-*.md` file for your platfor | --- | --- | | [Autoconf](https://www.gnu.org/software/autoconf/) | [2.69](https://github.com/bitcoin/bitcoin/pull/17769) | | [Automake](https://www.gnu.org/software/automake/) | [1.13](https://github.com/bitcoin/bitcoin/pull/18290) | -| [Clang](https://clang.llvm.org) | [13.0](https://github.com/bitcoin/bitcoin/pull/28210) | +| [Clang](https://clang.llvm.org) | [14.0](https://github.com/bitcoin/bitcoin/pull/29208) | | [GCC](https://gcc.gnu.org) | [10.1](https://github.com/bitcoin/bitcoin/pull/28348) | | [Python](https://www.python.org) (scripts, tests) | [3.9](https://github.com/bitcoin/bitcoin/pull/28211) | | [systemtap](https://sourceware.org/systemtap/) ([tracing](tracing.md))| N/A | -- cgit v1.2.3 From fa223ba5eb764fe822229a58d4d44d3ea83d0793 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 9 Jan 2024 14:11:41 +0100 Subject: Revert "build: Fix undefined reference to __mulodi4" This reverts commit e4c8bb62e4a6873c45f42d0d2a24927cb241a0ea. --- build-aux/m4/bitcoin_runtime_lib.m4 | 42 ------------------------------- configure.ac | 2 -- src/Makefile.test.include | 2 +- src/test/fuzz/multiplication_overflow.cpp | 12 ++++++--- 4 files changed, 9 insertions(+), 49 deletions(-) delete mode 100644 build-aux/m4/bitcoin_runtime_lib.m4 diff --git a/build-aux/m4/bitcoin_runtime_lib.m4 b/build-aux/m4/bitcoin_runtime_lib.m4 deleted file mode 100644 index 1a6922deca..0000000000 --- a/build-aux/m4/bitcoin_runtime_lib.m4 +++ /dev/null @@ -1,42 +0,0 @@ -# On some platforms clang builtin implementations -# require compiler-rt as a runtime library to use. -# -# See: -# - https://bugs.llvm.org/show_bug.cgi?id=28629 - -m4_define([_CHECK_RUNTIME_testbody], [[ - bool f(long long x, long long y, long long* p) - { - return __builtin_mul_overflow(x, y, p); - } - int main() { return 0; } -]]) - -AC_DEFUN([CHECK_RUNTIME_LIB], [ - - AC_LANG_PUSH([C++]) - - AC_MSG_CHECKING([for __builtin_mul_overflow]) - AC_LINK_IFELSE( - [AC_LANG_SOURCE([_CHECK_RUNTIME_testbody])], - [ - AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_BUILTIN_MUL_OVERFLOW], [1], [Define if you have a working __builtin_mul_overflow]) - ], - [ - ax_check_save_flags="$LDFLAGS" - LDFLAGS="$LDFLAGS --rtlib=compiler-rt -lgcc_s" - AC_LINK_IFELSE( - [AC_LANG_SOURCE([_CHECK_RUNTIME_testbody])], - [ - AC_MSG_RESULT([yes, with additional linker flags]) - RUNTIME_LDFLAGS="--rtlib=compiler-rt -lgcc_s" - AC_DEFINE([HAVE_BUILTIN_MUL_OVERFLOW], [1], [Define if you have a working __builtin_mul_overflow]) - ], - [AC_MSG_RESULT([no])]) - LDFLAGS="$ax_check_save_flags" - ]) - - AC_LANG_POP - AC_SUBST([RUNTIME_LDFLAGS]) -]) diff --git a/configure.ac b/configure.ac index bcff6c79f8..1de0aba747 100644 --- a/configure.ac +++ b/configure.ac @@ -1338,8 +1338,6 @@ if test "$enable_fuzz_binary" = "yes"; then ]],[[ */ int not_main() { ]])]) - - CHECK_RUNTIME_LIB fi if test "$enable_wallet" != "no"; then diff --git a/src/Makefile.test.include b/src/Makefile.test.include index 416a11b0c0..870e49bd75 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -240,7 +240,7 @@ if ENABLE_FUZZ_BINARY test_fuzz_fuzz_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) test_fuzz_fuzz_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) test_fuzz_fuzz_LDADD = $(FUZZ_SUITE_LD_COMMON) -test_fuzz_fuzz_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) $(RUNTIME_LDFLAGS) +test_fuzz_fuzz_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) test_fuzz_fuzz_SOURCES = \ $(FUZZ_WALLET_SRC) \ test/fuzz/addition_overflow.cpp \ diff --git a/src/test/fuzz/multiplication_overflow.cpp b/src/test/fuzz/multiplication_overflow.cpp index fbe4d061bf..e45ed503f0 100644 --- a/src/test/fuzz/multiplication_overflow.cpp +++ b/src/test/fuzz/multiplication_overflow.cpp @@ -2,10 +2,6 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif - #include #include #include @@ -14,6 +10,14 @@ #include #include +#if defined(__has_builtin) +#if __has_builtin(__builtin_mul_overflow) +#define HAVE_BUILTIN_MUL_OVERFLOW +#endif +#elif defined(__GNUC__) +#define HAVE_BUILTIN_MUL_OVERFLOW +#endif + namespace { template void TestMultiplicationOverflow(FuzzedDataProvider& fuzzed_data_provider) -- cgit v1.2.3 From aaaace2fd1299939c755c281b787df0bbf1747a0 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 9 Jan 2024 16:47:36 +0100 Subject: fuzz: Assume presence of __builtin_*_overflow, without checks --- src/test/fuzz/addition_overflow.cpp | 10 ---------- src/test/fuzz/multiplication_overflow.cpp | 14 -------------- 2 files changed, 24 deletions(-) diff --git a/src/test/fuzz/addition_overflow.cpp b/src/test/fuzz/addition_overflow.cpp index 7b84bfda20..5100b6f438 100644 --- a/src/test/fuzz/addition_overflow.cpp +++ b/src/test/fuzz/addition_overflow.cpp @@ -11,14 +11,6 @@ #include #include -#if defined(__has_builtin) -#if __has_builtin(__builtin_add_overflow) -#define HAVE_BUILTIN_ADD_OVERFLOW -#endif -#elif defined(__GNUC__) -#define HAVE_BUILTIN_ADD_OVERFLOW -#endif - namespace { template void TestAdditionOverflow(FuzzedDataProvider& fuzzed_data_provider) @@ -32,14 +24,12 @@ void TestAdditionOverflow(FuzzedDataProvider& fuzzed_data_provider) assert(is_addition_overflow_custom == AdditionOverflow(j, i)); assert(maybe_add == CheckedAdd(j, i)); assert(sat_add == SaturatingAdd(j, i)); -#if defined(HAVE_BUILTIN_ADD_OVERFLOW) T result_builtin; const bool is_addition_overflow_builtin = __builtin_add_overflow(i, j, &result_builtin); assert(is_addition_overflow_custom == is_addition_overflow_builtin); if (!is_addition_overflow_custom) { assert(i + j == result_builtin); } -#endif if (is_addition_overflow_custom) { assert(sat_add == std::numeric_limits::min() || sat_add == std::numeric_limits::max()); } else { diff --git a/src/test/fuzz/multiplication_overflow.cpp b/src/test/fuzz/multiplication_overflow.cpp index e45ed503f0..aeef4f24b7 100644 --- a/src/test/fuzz/multiplication_overflow.cpp +++ b/src/test/fuzz/multiplication_overflow.cpp @@ -10,14 +10,6 @@ #include #include -#if defined(__has_builtin) -#if __has_builtin(__builtin_mul_overflow) -#define HAVE_BUILTIN_MUL_OVERFLOW -#endif -#elif defined(__GNUC__) -#define HAVE_BUILTIN_MUL_OVERFLOW -#endif - namespace { template void TestMultiplicationOverflow(FuzzedDataProvider& fuzzed_data_provider) @@ -25,18 +17,12 @@ void TestMultiplicationOverflow(FuzzedDataProvider& fuzzed_data_provider) const T i = fuzzed_data_provider.ConsumeIntegral(); const T j = fuzzed_data_provider.ConsumeIntegral(); const bool is_multiplication_overflow_custom = MultiplicationOverflow(i, j); -#if defined(HAVE_BUILTIN_MUL_OVERFLOW) T result_builtin; const bool is_multiplication_overflow_builtin = __builtin_mul_overflow(i, j, &result_builtin); assert(is_multiplication_overflow_custom == is_multiplication_overflow_builtin); if (!is_multiplication_overflow_custom) { assert(i * j == result_builtin); } -#else - if (!is_multiplication_overflow_custom) { - (void)(i * j); - } -#endif } } // namespace -- cgit v1.2.3