add -lrt with afl-gcc/clang automatically in mmap mode
MODIFY
Makefile
Makefile
@@ -176,10 +176,10 @@ endif
all_done: test_build
@if [ ! "`which clang 2>/dev/null`" = "" ]; then echo "[+] LLVM users: see llvm_mode/README.llvm for a faster alternative to afl-gcc."; fi
@echo "[+] All done! Be sure to review the README - it's pretty short and useful."
-ifeq "$(SHMAT_OK)" "0"
- @echo "[!] shmat isn't working on your platform - compile every target with -lrt:"
- @echo "[!] CFLAGS=-lrt LDFLAGS=-lrt CC=afl-gcc CXX=afl-g++ ./configure"
-endif
+#ifeq "$(SHMAT_OK)" "0"
+# @echo "[!] shmat isn't working on your platform - compile every target with -lrt:"
+# @echo "[!] CFLAGS=-lrt LDFLAGS=-lrt CC=afl-gcc CXX=afl-g++ ./configure"
+#endif
@if [ "`uname`" = "Darwin" ]; then printf "\nWARNING: Fuzzing on MacOS X is slow because of the unusually high overhead of\nfork() on this OS. Consider using Linux or *BSD. You can also use VirtualBox\n(virtualbox.org) to put AFL inside a Linux or *BSD VM.\n\n"; fi
@! tty <&1 >/dev/null || printf "\033[0;30mNOTE: If you can read this, your terminal probably uses white background.\nThis will make the UI hard to read. See docs/status_screen.txt for advice.\033[0m\n" 2>/dev/null

MODIFY
afl-gcc.c
afl-gcc.c
@@ -252,6 +252,10 @@ static void edit_params(u32 argc, char** argv) {
}
+#ifdef USEMMAP
+ cc_params[cc_par_cnt++] = "-lrt";
+#endif
+
if (!getenv("AFL_DONT_OPTIMIZE")) {
#if defined(__FreeBSD__) && defined(__x86_64__)

MODIFY
llvm_mode/Makefile
llvm_mode/Makefile
@@ -154,10 +154,10 @@ test_build: $(PROGS)
all_done: test_build
@echo "[+] All done! You can now use '../afl-clang-fast' to compile programs."
-ifeq "$(SHMAT_OK)" "0"
- @echo "[!] shmat isn't working on your platform - compile every target with -lrt:"
- @echo "[!] CFLAGS=-lrt LDFLAGS=-lrt CC=afl-clang-fast CXX=afl-clang-fast++ ./configure"
-endif
+#ifeq "$(SHMAT_OK)" "0"
+# @echo "[!] shmat isn't working on your platform - compile every target with -lrt:"
+# @echo "[!] CFLAGS=-lrt LDFLAGS=-lrt CC=afl-clang-fast CXX=afl-clang-fast++ ./configure"
+#endif
.NOTPARALLEL: clean

MODIFY
llvm_mode/afl-clang-fast.c
llvm_mode/afl-clang-fast.c
@@ -246,6 +246,10 @@ static void edit_params(u32 argc, char** argv) {
}
+#ifdef USEMMAP
+ cc_params[cc_par_cnt++] = "-lrt";
+#endif
+
cc_params[cc_par_cnt++] = "-D__AFL_HAVE_MANUAL_CONTROL=1";
cc_params[cc_par_cnt++] = "-D__AFL_COMPILER=1";
cc_params[cc_par_cnt++] = "-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1";

add -lrt with afl-gcc/clang automatically in mmap mode