File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed
Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -1165,6 +1165,20 @@ if test "x$enable_fuzz" = "xyes"; then
11651165 use_bench=no
11661166 use_upnp=no
11671167 use_zmq=no
1168+
1169+ AC_MSG_CHECKING ( [ whether main function is needed] )
1170+ AX_CHECK_LINK_FLAG (
1171+ [ [ -fsanitize=$use_sanitizers] ] ,
1172+ [ AC_MSG_RESULT ( [ no] ) ] ,
1173+ [ AC_MSG_RESULT ( [ yes] )
1174+ CPPFLAGS="$CPPFLAGS -DPROVIDE_MAIN_FUNCTION"] ,
1175+ [ ] ,
1176+ [ AC_LANG_PROGRAM ( [ [
1177+ #include <cstdint>
1178+ #include <cstddef>
1179+ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { return 0; }
1180+ /* unterminated comment to remove the main function ...
1181+ ] ] ,[ [ ] ] ) ] )
11681182else
11691183 BITCOIN_QT_INIT
11701184
Original file line number Diff line number Diff line change 1212
1313const std::function<void (const std::string&)> G_TEST_LOG_FUN{};
1414
15- // Decide if main(...) should be provided:
16- // * AFL needs main(...) regardless of platform.
17- // * macOS handles __attribute__((weak)) main(...) poorly when linking
18- // against libFuzzer. See https://github.com/bitcoin/bitcoin/pull/18008
19- // for details.
20- #if defined(__AFL_COMPILER) || !defined(MAC_OSX)
21- #define PROVIDE_MAIN_FUNCTION
22- #endif
23-
2415#if defined(PROVIDE_MAIN_FUNCTION)
2516static bool read_stdin (std::vector<uint8_t >& data)
2617{
You can’t perform that action at this time.
0 commit comments