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
1165
1165
use_bench=no
1166
1166
use_upnp=no
1167
1167
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
+ ] ] ,[ [ ] ] ) ] )
1168
1182
else
1169
1183
BITCOIN_QT_INIT
1170
1184
Original file line number Diff line number Diff line change 12
12
13
13
const std::function<void (const std::string&)> G_TEST_LOG_FUN{};
14
14
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
-
24
15
#if defined(PROVIDE_MAIN_FUNCTION)
25
16
static bool read_stdin (std::vector<uint8_t >& data)
26
17
{
You can’t perform that action at this time.
0 commit comments