mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
Merge bitcoin/bitcoin#24337: build: Do not define PROVIDE_FUZZ_MAIN_FUNCTION
macro unconditionally
c9c4e6cadd
build: Do not define `PROVIDE_FUZZ_MAIN_FUNCTION` macro unconditionally (Hennadii Stepanov) Pull request description: No need to define the `PROVIDE_FUZZ_MAIN_FUNCTION` macro when the build system has been configured with the `--disable-fuzz-binary` option. See https://github.com/bitcoin/bitcoin/pull/24336#pullrequestreview-881368272. ACKs for top commit: MarcoFalke: Approach ACKc9c4e6cadd
did not review or test 🐤 fanquake: ACKc9c4e6cadd
Checked that `PROVIDE_FUZZ_MAIN_FUNCTION` isn't defined when configuring with `--disable-fuzz-binary`. Tree-SHA512: 54fbf02ba9f5ecc61b176b8ea7d05e308788d4de3f97ed40913e731300d9dc0edfdfcbf8e0a6e74cf1b2e2ae63f6208a34e03b9c8d203d070c457c4a7d9b5f2c
This commit is contained in:
commit
7626e547b8
1 changed files with 18 additions and 20 deletions
38
configure.ac
38
configure.ac
|
@ -1300,21 +1300,6 @@ if test "$enable_fuzz" = "yes"; then
|
|||
enable_fuzz_binary=yes
|
||||
|
||||
AX_CHECK_PREPROC_FLAG([-DABORT_ON_FAILED_ASSUME], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DABORT_ON_FAILED_ASSUME"], [], [$CXXFLAG_WERROR])
|
||||
|
||||
AC_MSG_CHECKING([whether main function is needed for fuzz binary])
|
||||
AX_CHECK_LINK_FLAG(
|
||||
[-fsanitize=$use_sanitizers],
|
||||
[AC_MSG_RESULT([no])],
|
||||
[AC_MSG_RESULT([yes]); CORE_CPPFLAGS="$CORE_CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"],
|
||||
[],
|
||||
[AC_LANG_PROGRAM([[
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { return 0; }
|
||||
/* comment to remove the main function ...
|
||||
]],[[
|
||||
*/ int not_main() {
|
||||
]])])
|
||||
else
|
||||
BITCOIN_QT_INIT
|
||||
|
||||
|
@ -1328,8 +1313,25 @@ else
|
|||
QT_DBUS_INCLUDES=SUPPRESS_WARNINGS($QT_DBUS_INCLUDES)
|
||||
QT_TEST_INCLUDES=SUPPRESS_WARNINGS($QT_TEST_INCLUDES)
|
||||
fi
|
||||
fi
|
||||
|
||||
CORE_CPPFLAGS="$CORE_CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"
|
||||
if test "$enable_fuzz_binary" = "yes"; then
|
||||
AC_MSG_CHECKING([whether main function is needed for fuzz binary])
|
||||
AX_CHECK_LINK_FLAG(
|
||||
[],
|
||||
[AC_MSG_RESULT([no])],
|
||||
[AC_MSG_RESULT([yes]); CORE_CPPFLAGS="$CORE_CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"],
|
||||
[$SANITIZER_LDFLAGS],
|
||||
[AC_LANG_PROGRAM([[
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return 0; }
|
||||
/* comment to remove the main function ...
|
||||
]],[[
|
||||
*/ int not_main() {
|
||||
]])])
|
||||
|
||||
CHECK_RUNTIME_LIB
|
||||
fi
|
||||
|
||||
if test "$enable_wallet" != "no"; then
|
||||
|
@ -1819,10 +1821,6 @@ if test "$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoin_
|
|||
AC_MSG_ERROR([No targets! Please specify at least one of: --with-utils --with-libs --with-daemon --with-gui --enable-bench or --enable-tests])
|
||||
fi
|
||||
|
||||
if test "$enable_fuzz_binary" = "yes"; then
|
||||
CHECK_RUNTIME_LIB
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([TARGET_DARWIN], [test "$TARGET_OS" = "darwin"])
|
||||
AM_CONDITIONAL([BUILD_DARWIN], [test "$BUILD_OS" = "darwin"])
|
||||
AM_CONDITIONAL([TARGET_LINUX], [test "$TARGET_OS" = "linux"])
|
||||
|
|
Loading…
Add table
Reference in a new issue