diff --git a/build-aux/m4/bitcoin_runtime_lib.m4 b/build-aux/m4/bitcoin_runtime_lib.m4 deleted file mode 100644 index 1a6922deca485..0000000000000 --- 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 d6efa491df2d3..2b84eb19235d9 100644 --- a/configure.ac +++ b/configure.ac @@ -1387,8 +1387,6 @@ if test x$enable_fuzz_binary = xyes; then ]],[[ */ int not_main() { ]])]) - - CHECK_RUNTIME_LIB fi if test x$enable_wallet != xno; then diff --git a/doc/dependencies.md b/doc/dependencies.md index 43aeede6b89a7..19d81449b299a 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 | diff --git a/src/Makefile.test.include b/src/Makefile.test.include index 00e0429688fd7..705db24bd7890 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -243,7 +243,7 @@ if ENABLE_FUZZ_BINARY test_fuzz_fuzz_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) test_fuzz_fuzz_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) test_fuzz_fuzz_LDADD = $(FUZZ_SUITE_LD_COMMON) -test_fuzz_fuzz_LDFLAGS = $(FUZZ_SUITE_LDFLAGS_COMMON) $(RUNTIME_LDFLAGS) +test_fuzz_fuzz_LDFLAGS = $(FUZZ_SUITE_LDFLAGS_COMMON) test_fuzz_fuzz_SOURCES = \ test/fuzz/addition_overflow.cpp \ test/fuzz/addrman.cpp \ diff --git a/src/test/fuzz/addition_overflow.cpp b/src/test/fuzz/addition_overflow.cpp index 372c1a370e852..edc89a0e18462 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 c7251650c2580..3a6127f31f8e7 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 @@ -21,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