MacOS nits

This commit is contained in:
vanhauser-thc
2021-07-22 15:16:04 +02:00
parent 44ffcf7ede
commit 183d9a3f07
4 changed files with 23 additions and 6 deletions

View File

@ -315,7 +315,9 @@ llvm:
.PHONY: gcc_plugin .PHONY: gcc_plugin
gcc_plugin: gcc_plugin:
ifneq "$(SYS)" "Darwin"
-$(MAKE) -f GNUmakefile.gcc_plugin -$(MAKE) -f GNUmakefile.gcc_plugin
endif
.PHONY: man .PHONY: man
man: $(MANPAGES) man: $(MANPAGES)
@ -561,7 +563,7 @@ all_done: test_build
.PHONY: clean .PHONY: clean
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.llvm clean
-$(MAKE) -f GNUmakefile.gcc_plugin clean -$(MAKE) -f GNUmakefile.gcc_plugin clean
$(MAKE) -C utils/libdislocator clean $(MAKE) -C utils/libdislocator clean
@ -595,15 +597,19 @@ endif
.PHONY: distrib .PHONY: distrib
distrib: all distrib: all
-$(MAKE) -j -f GNUmakefile.llvm -$(MAKE) -j -f GNUmakefile.llvm
ifneq "$(SYS)" "Darwin"
-$(MAKE) -f GNUmakefile.gcc_plugin -$(MAKE) -f GNUmakefile.gcc_plugin
endif
$(MAKE) -C utils/libdislocator $(MAKE) -C utils/libdislocator
$(MAKE) -C utils/libtokencap $(MAKE) -C utils/libtokencap
$(MAKE) -C utils/afl_network_proxy $(MAKE) -C utils/afl_network_proxy
$(MAKE) -C utils/socket_fuzzing $(MAKE) -C utils/socket_fuzzing
$(MAKE) -C utils/argv_fuzzing $(MAKE) -C utils/argv_fuzzing
-$(MAKE) -C frida_mode -$(MAKE) -C frida_mode
ifneq "$(SYS)" "Darwin"
-cd qemu_mode && sh ./build_qemu_support.sh -cd qemu_mode && sh ./build_qemu_support.sh
-cd unicorn_mode && unset CFLAGS && sh ./build_unicorn_support.sh -cd unicorn_mode && unset CFLAGS && sh ./build_unicorn_support.sh
endif
.PHONY: binary-only .PHONY: binary-only
binary-only: test_shm test_python ready $(PROGS) 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/socket_fuzzing
$(MAKE) -C utils/argv_fuzzing $(MAKE) -C utils/argv_fuzzing
-$(MAKE) -C frida_mode -$(MAKE) -C frida_mode
ifneq "$(SYS)" "Darwin"
-cd qemu_mode && sh ./build_qemu_support.sh -cd qemu_mode && sh ./build_qemu_support.sh
-cd unicorn_mode && unset CFLAGS && sh ./build_unicorn_support.sh -cd unicorn_mode && unset CFLAGS && sh ./build_unicorn_support.sh
endif
.PHONY: source-only .PHONY: source-only
source-only: all source-only: all
-$(MAKE) -j -f GNUmakefile.llvm -$(MAKE) -j -f GNUmakefile.llvm
ifneq "$(SYS)" "Darwin"
-$(MAKE) -f GNUmakefile.gcc_plugin -$(MAKE) -f GNUmakefile.gcc_plugin
endif
$(MAKE) -C utils/libdislocator $(MAKE) -C utils/libdislocator
$(MAKE) -C utils/libtokencap $(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/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 @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 -$(MAKE) -f GNUmakefile.llvm install
ifneq "$(SYS)" "Darwin"
-$(MAKE) -f GNUmakefile.gcc_plugin install -$(MAKE) -f GNUmakefile.gcc_plugin install
endif
ln -sf afl-cc $${DESTDIR}$(BIN_PATH)/afl-gcc 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-g++
ln -sf afl-cc $${DESTDIR}$(BIN_PATH)/afl-clang ln -sf afl-cc $${DESTDIR}$(BIN_PATH)/afl-clang

View File

@ -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_BINDIR = $(shell $(LLVM_CONFIG) --bindir 2>/dev/null)
LLVM_LIBDIR = $(shell $(LLVM_CONFIG) --libdir 2>/dev/null) LLVM_LIBDIR = $(shell $(LLVM_CONFIG) --libdir 2>/dev/null)
LLVM_STDCXX = gnu++11 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 LLVM_LTO = 0
ifeq "$(LLVMVER)" "" 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. # User teor2345 reports that this is required to make things work on MacOS X.
ifeq "$(SYS)" "Darwin" ifeq "$(SYS)" "Darwin"
CLANG_LFL += -Wl,-flat_namespace -Wl,-undefined,suppress CLANG_LFL += -Wl,-flat_namespace -Wl,-undefined,suppress
override LLVM_HAVE_LTO := 0
override LLVM_LTO := 0
else else
CLANG_CPPFL += -Wl,-znodelete CLANG_CPPFL += -Wl,-znodelete
endif endif

View File

@ -74,12 +74,15 @@ and depend mostly on user feedback.
To build AFL, install llvm (and perhaps gcc) from brew and follow the general To build AFL, install llvm (and perhaps gcc) from brew and follow the general
instructions for Linux. If possible avoid Xcode at all cost. 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 PATH="/usr/local/Cellar/llvm/12.0.1/bin/:$PATH"
export CC=clang
export CXX=clang++
gmake gmake
cd frida_mode cd frida_mode
gmake gmake

View File

@ -134,8 +134,8 @@ static cl::opt<std::string> MemLimit(
"m", cl::desc("Memory limit for child process (default=none)"), "m", cl::desc("Memory limit for child process (default=none)"),
cl::value_desc("megs"), cl::init("none")); cl::value_desc("megs"), cl::init("none"));
static cl::opt<std::string> Timeout( static cl::opt<std::string> Timeout(
"t", cl::desc("Run time limit for child process (default=none)"), "t", cl::desc("Run time limit for child process (default=5000)"),
cl::value_desc("msec"), cl::init("none")); cl::value_desc("msec"), cl::init("4000"));
static cl::opt<bool> CrashMode( static cl::opt<bool> CrashMode(
"C", cl::desc("Keep crashing inputs, reject everything else")); "C", cl::desc("Keep crashing inputs, reject everything else"));
static cl::opt<bool> QemuMode("Q", cl::desc("Use binary-only instrumentation")); static cl::opt<bool> QemuMode("Q", cl::desc("Use binary-only instrumentation"));