compile persistent mode without afl
MODIFY
examples/persistent_demo/persistent_demo_new.c
examples/persistent_demo/persistent_demo_new.c
#include <signal.h>
#include <string.h>
+/* this lets the source compile without afl-clang-fast/lto */
+#ifndef __AFL_FUZZ_TESTCASE_LEN
+ ssize_t fuzz_len;
+ #define __AFL_FUZZ_TESTCASE_LEN fuzz_len
+ unsigned char fuzz_buf[1024000];
+ #define __AFL_FUZZ_TESTCASE_BUF fuzz_buf
+ #define __AFL_FUZZ_INIT() void sync(void);
+ #define __AFL_LOOP(x) ((fuzz_len = read(0, fuzz_buf, sizeof(fuzz_buf))) > 0 ?
+ #define __AFL_INIT() sync()
+#endif
+
__AFL_FUZZ_INIT();
/* Main entry point. */

MODIFY
llvm_mode/README.persistent_mode.md
llvm_mode/README.persistent_mode.md
@@ -52,6 +52,21 @@ afl-clang-fast -o fuzz_target fuzz_target.c -lwhat_you_need_for_your_target
And that is it!
The speed increase is usually x10 to x20.
+If you want to be able to compile the target without afl-clang-fast/lto then
+add this just after the includes:
+
+```
+#ifndef __AFL_FUZZ_TESTCASE_LEN
+ ssize_t fuzz_len;
+ #define __AFL_FUZZ_TESTCASE_LEN fuzz_len
+ unsigned char fuzz_buf[1024000];
+ #define __AFL_FUZZ_TESTCASE_BUF fuzz_buf
+ #define __AFL_FUZZ_INIT() void sync(void);
+ #define __AFL_LOOP(x) ((fuzz_len = read(0, fuzz_buf, sizeof(fuzz_buf))) > 0 ?
+ #define __AFL_INIT() sync()
+#endif
+```
+
## 3) deferred initialization
AFL tries to optimize performance by executing the targeted binary just once,

compile persistent mode without afl