aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-07-22 15:16:04 +0200
committervanhauser-thc <vh@thc.org>2021-07-22 15:16:19 +0200
commit183d9a3f07acf0ab9bb28359c2c0852eab8e7c10 (patch)
tree2457e065de0842e771206d02937b4d78bd5aa656
parent44ffcf7ede7f25aec354709fef0ce2a7e3212a37 (diff)
downloadafl++-183d9a3f07acf0ab9bb28359c2c0852eab8e7c10.tar.gz
MacOS nits
-rw-r--r--GNUmakefile14
-rw-r--r--GNUmakefile.llvm4
-rw-r--r--docs/INSTALL.md7
-rw-r--r--utils/optimin/src/OptiMin.cpp4
4 files changed, 23 insertions, 6 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 7a1ba88a..e4f486fe 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -315,7 +315,9 @@ llvm:
.PHONY: gcc_plugin
gcc_plugin:
+ifneq "$(SYS)" "Darwin"
-$(MAKE) -f GNUmakefile.gcc_plugin
+endif
.PHONY: man
man: $(MANPAGES)
@@ -561,7 +563,7 @@ all_done: test_build
.PHONY: clean
clean:
- rm -f $(PROGS) libradamsa.so afl-fuzz-document afl-as as afl-g++ afl-clang afl-clang++ *.o src/*.o *~ a.out core core.[1-9][0-9]* *.stackdump .test .test1 .test2 test-instr .test-instr0 .test-instr1 afl-qemu-trace afl-gcc-fast afl-gcc-pass.so afl-g++-fast ld *.so *.8 test/unittests/*.o test/unittests/unit_maybe_alloc test/unittests/preallocable .afl-* afl-gcc afl-g++ afl-clang afl-clang++ test/unittests/unit_hash test/unittests/unit_rand
+ rm -rf $(PROGS) libradamsa.so afl-fuzz-document afl-as as afl-g++ afl-clang afl-clang++ *.o src/*.o *~ a.out core core.[1-9][0-9]* *.stackdump .test .test1 .test2 test-instr .test-instr0 .test-instr1 afl-qemu-trace afl-gcc-fast afl-gcc-pass.so afl-g++-fast ld *.so *.8 test/unittests/*.o test/unittests/unit_maybe_alloc test/unittests/preallocable .afl-* afl-gcc afl-g++ afl-clang afl-clang++ test/unittests/unit_hash test/unittests/unit_rand *.dSYM
-$(MAKE) -f GNUmakefile.llvm clean
-$(MAKE) -f GNUmakefile.gcc_plugin clean
$(MAKE) -C utils/libdislocator clean
@@ -595,15 +597,19 @@ endif
.PHONY: distrib
distrib: all
-$(MAKE) -j -f GNUmakefile.llvm
+ifneq "$(SYS)" "Darwin"
-$(MAKE) -f GNUmakefile.gcc_plugin
+endif
$(MAKE) -C utils/libdislocator
$(MAKE) -C utils/libtokencap
$(MAKE) -C utils/afl_network_proxy
$(MAKE) -C utils/socket_fuzzing
$(MAKE) -C utils/argv_fuzzing
-$(MAKE) -C frida_mode
+ifneq "$(SYS)" "Darwin"
-cd qemu_mode && sh ./build_qemu_support.sh
-cd unicorn_mode && unset CFLAGS && sh ./build_unicorn_support.sh
+endif
.PHONY: binary-only
binary-only: test_shm test_python ready $(PROGS)
@@ -613,13 +619,17 @@ binary-only: test_shm test_python ready $(PROGS)
$(MAKE) -C utils/socket_fuzzing
$(MAKE) -C utils/argv_fuzzing
-$(MAKE) -C frida_mode
+ifneq "$(SYS)" "Darwin"
-cd qemu_mode && sh ./build_qemu_support.sh
-cd unicorn_mode && unset CFLAGS && sh ./build_unicorn_support.sh
+endif
.PHONY: source-only
source-only: all
-$(MAKE) -j -f GNUmakefile.llvm
+ifneq "$(SYS)" "Darwin"
-$(MAKE) -f GNUmakefile.gcc_plugin
+endif
$(MAKE) -C utils/libdislocator
$(MAKE) -C utils/libtokencap
@@ -662,7 +672,9 @@ install: all $(MANPAGES)
@if [ -f utils/aflpp_driver/libAFLDriver.a ]; then set -e; install -m 644 utils/aflpp_driver/libAFLDriver.a $${DESTDIR}$(HELPER_PATH); fi
@if [ -f utils/aflpp_driver/libAFLQemuDriver.a ]; then set -e; install -m 644 utils/aflpp_driver/libAFLQemuDriver.a $${DESTDIR}$(HELPER_PATH); fi
-$(MAKE) -f GNUmakefile.llvm install
+ifneq "$(SYS)" "Darwin"
-$(MAKE) -f GNUmakefile.gcc_plugin install
+endif
ln -sf afl-cc $${DESTDIR}$(BIN_PATH)/afl-gcc
ln -sf afl-cc $${DESTDIR}$(BIN_PATH)/afl-g++
ln -sf afl-cc $${DESTDIR}$(BIN_PATH)/afl-clang
diff --git a/GNUmakefile.llvm b/GNUmakefile.llvm
index 83eb91a9..a6f646f3 100644
--- a/GNUmakefile.llvm
+++ b/GNUmakefile.llvm
@@ -53,7 +53,7 @@ LLVM_HAVE_LTO = $(shell $(LLVM_CONFIG) --version 2>/dev/null | egrep -q '^1[1-9]
LLVM_BINDIR = $(shell $(LLVM_CONFIG) --bindir 2>/dev/null)
LLVM_LIBDIR = $(shell $(LLVM_CONFIG) --libdir 2>/dev/null)
LLVM_STDCXX = gnu++11
-LLVM_APPLE_XCODE = $(shell clang -v 2>&1 | grep -q Apple && echo 1 || echo 0)
+LLVM_APPLE_XCODE = $(shell $(CC) -v 2>&1 | grep -q Apple && echo 1 || echo 0)
LLVM_LTO = 0
ifeq "$(LLVMVER)" ""
@@ -279,6 +279,8 @@ CLANG_LFL = `$(LLVM_CONFIG) --ldflags` $(LDFLAGS)
# User teor2345 reports that this is required to make things work on MacOS X.
ifeq "$(SYS)" "Darwin"
CLANG_LFL += -Wl,-flat_namespace -Wl,-undefined,suppress
+ override LLVM_HAVE_LTO := 0
+ override LLVM_LTO := 0
else
CLANG_CPPFL += -Wl,-znodelete
endif
diff --git a/docs/INSTALL.md b/docs/INSTALL.md
index f6c126a1..b3f9fb96 100644
--- a/docs/INSTALL.md
+++ b/docs/INSTALL.md
@@ -74,12 +74,15 @@ and depend mostly on user feedback.
To build AFL, install llvm (and perhaps gcc) from brew and follow the general
instructions for Linux. If possible avoid Xcode at all cost.
-`brew install wget git make llvm`
+`brew install wget git make cmake llvm`
-Be sure to setup PATH to point to the correct clang binaries and use gmake, e.g.:
+Be sure to setup PATH to point to the correct clang binaries and use the
+freshly installed clang, clang++ and gmake, e.g.:
```
export PATH="/usr/local/Cellar/llvm/12.0.1/bin/:$PATH"
+export CC=clang
+export CXX=clang++
gmake
cd frida_mode
gmake
diff --git a/utils/optimin/src/OptiMin.cpp b/utils/optimin/src/OptiMin.cpp
index 4fbf3416..b82acbb6 100644
--- a/utils/optimin/src/OptiMin.cpp
+++ b/utils/optimin/src/OptiMin.cpp
@@ -134,8 +134,8 @@ static cl::opt<std::string> MemLimit(
"m", cl::desc("Memory limit for child process (default=none)"),
cl::value_desc("megs"), cl::init("none"));
static cl::opt<std::string> Timeout(
- "t", cl::desc("Run time limit for child process (default=none)"),
- cl::value_desc("msec"), cl::init("none"));
+ "t", cl::desc("Run time limit for child process (default=5000)"),
+ cl::value_desc("msec"), cl::init("4000"));
static cl::opt<bool> CrashMode(
"C", cl::desc("Keep crashing inputs, reject everything else"));
static cl::opt<bool> QemuMode("Q", cl::desc("Use binary-only instrumentation"));