mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-17 12:18:08 +00:00
Adapt to my MacOS
This commit is contained in:
10
GNUmakefile
10
GNUmakefile
@ -97,6 +97,12 @@ ifneq "$(SYS)" "Darwin"
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq "$(SYS)" "Darwin"
|
||||||
|
# On some odd MacOS system configurations, the Xcode sdk path is not set correctly
|
||||||
|
SDK_LD = -L$(shell xcrun --show-sdk-path)/usr/lib
|
||||||
|
LDFLAGS += $(SDK_LD)
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq "$(SYS)" "SunOS"
|
ifeq "$(SYS)" "SunOS"
|
||||||
CFLAGS_OPT += -Wno-format-truncation
|
CFLAGS_OPT += -Wno-format-truncation
|
||||||
LDFLAGS = -lkstat -lrt
|
LDFLAGS = -lkstat -lrt
|
||||||
@ -384,7 +390,7 @@ test_x86:
|
|||||||
@echo "[*] Testing the PATH environment variable..."
|
@echo "[*] Testing the PATH environment variable..."
|
||||||
@test "$${PATH}" != "$${PATH#.:}" && { echo "Please remove current directory '.' from PATH to avoid recursion of 'as', thanks!"; echo; exit 1; } || :
|
@test "$${PATH}" != "$${PATH#.:}" && { echo "Please remove current directory '.' from PATH to avoid recursion of 'as', thanks!"; echo; exit 1; } || :
|
||||||
@echo "[*] Checking for the ability to compile x86 code..."
|
@echo "[*] Checking for the ability to compile x86 code..."
|
||||||
@echo 'main() { __asm__("xorb %al, %al"); }' | $(CC) $(CFLAGS) -w -x c - -o .test1 || ( echo; echo "Oops, looks like your compiler can't generate x86 code."; echo; echo "Don't panic! You can use the LLVM or QEMU mode, but see docs/INSTALL first."; echo "(To ignore this error, set AFL_NO_X86=1 and try again.)"; echo; exit 1 )
|
@echo 'main() { __asm__("xorb %al, %al"); }' | $(CC) $(CFLAGS) $(LDFLAGS) -w -x c - -o .test1 || ( echo; echo "Oops, looks like your compiler can't generate x86 code."; echo; echo "Don't panic! You can use the LLVM or QEMU mode, but see docs/INSTALL first."; echo "(To ignore this error, set AFL_NO_X86=1 and try again.)"; echo; exit 1 )
|
||||||
@rm -f .test1
|
@rm -f .test1
|
||||||
else
|
else
|
||||||
test_x86:
|
test_x86:
|
||||||
@ -528,7 +534,7 @@ code-format:
|
|||||||
ifndef AFL_NO_X86
|
ifndef AFL_NO_X86
|
||||||
test_build: afl-cc afl-gcc afl-as afl-showmap
|
test_build: afl-cc afl-gcc afl-as afl-showmap
|
||||||
@echo "[*] Testing the CC wrapper afl-cc and its instrumentation output..."
|
@echo "[*] Testing the CC wrapper afl-cc and its instrumentation output..."
|
||||||
@unset AFL_MAP_SIZE AFL_USE_UBSAN AFL_USE_CFISAN AFL_USE_LSAN AFL_USE_ASAN AFL_USE_MSAN; ASAN_OPTIONS=detect_leaks=0 AFL_INST_RATIO=100 AFL_PATH=. ./afl-cc test-instr.c -o test-instr 2>&1 || (echo "Oops, afl-cc failed"; exit 1 )
|
@unset AFL_MAP_SIZE AFL_USE_UBSAN AFL_USE_CFISAN AFL_USE_LSAN AFL_USE_ASAN AFL_USE_MSAN; ASAN_OPTIONS=detect_leaks=0 AFL_INST_RATIO=100 AFL_PATH=. ./afl-cc test-instr.c $(LDFLAGS) -o test-instr 2>&1 || (echo "Oops, afl-cc failed"; exit 1 )
|
||||||
ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null
|
ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null
|
||||||
echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr
|
echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr
|
||||||
@rm -f test-instr
|
@rm -f test-instr
|
||||||
|
@ -931,7 +931,7 @@ static void edit_params(u32 argc, char **argv, char **envp) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USEMMAP) && !defined(__HAIKU__)
|
#if defined(USEMMAP) && !defined(__HAIKU__) && !__APPLE__
|
||||||
if (!have_c) cc_params[cc_par_cnt++] = "-lrt";
|
if (!have_c) cc_params[cc_par_cnt++] = "-lrt";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1136,7 +1136,7 @@ static void edit_params(u32 argc, char **argv, char **envp) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USEMMAP) && !defined(__HAIKU__)
|
#if defined(USEMMAP) && !defined(__HAIKU__) && !__APPLE__
|
||||||
cc_params[cc_par_cnt++] = "-lrt";
|
cc_params[cc_par_cnt++] = "-lrt";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2,6 +2,12 @@ ifeq "" "$(LLVM_CONFIG)"
|
|||||||
LLVM_CONFIG=llvm-config
|
LLVM_CONFIG=llvm-config
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq "$(shell uname -s)" "Darwin"
|
||||||
|
# On some odd MacOS system configurations, the Xcode sdk path is not set correctly
|
||||||
|
SDK_LD = -L$(shell xcrun --show-sdk-path)/usr/lib
|
||||||
|
LDFLAGS += $(SDK_LD)
|
||||||
|
endif
|
||||||
|
|
||||||
LLVM_BINDIR = $(shell $(LLVM_CONFIG) --bindir 2>/dev/null)
|
LLVM_BINDIR = $(shell $(LLVM_CONFIG) --bindir 2>/dev/null)
|
||||||
ifneq "" "$(LLVM_BINDIR)"
|
ifneq "" "$(LLVM_BINDIR)"
|
||||||
LLVM_BINDIR := $(LLVM_BINDIR)/
|
LLVM_BINDIR := $(LLVM_BINDIR)/
|
||||||
@ -33,7 +39,7 @@ libAFLQemuDriver.a: aflpp_qemu_driver.o
|
|||||||
@-cp -vf libAFLQemuDriver.a ../../
|
@-cp -vf libAFLQemuDriver.a ../../
|
||||||
|
|
||||||
aflpp_qemu_driver_hook.so: aflpp_qemu_driver_hook.o
|
aflpp_qemu_driver_hook.so: aflpp_qemu_driver_hook.o
|
||||||
@-test -e aflpp_qemu_driver_hook.o && $(LLVM_BINDIR)clang -shared aflpp_qemu_driver_hook.o -o aflpp_qemu_driver_hook.so || echo "Note: Optional aflpp_qemu_driver_hook.so not built."
|
@-test -e aflpp_qemu_driver_hook.o && $(LLVM_BINDIR)clang $(LDFLAGS) -shared aflpp_qemu_driver_hook.o -o aflpp_qemu_driver_hook.so || echo "Note: Optional aflpp_qemu_driver_hook.so not built."
|
||||||
|
|
||||||
aflpp_qemu_driver_hook.o: aflpp_qemu_driver_hook.c
|
aflpp_qemu_driver_hook.o: aflpp_qemu_driver_hook.c
|
||||||
@-test -e ../../qemu_mode/qemuafl/qemuafl/api.h && $(LLVM_BINDIR)clang $(CFLAGS) -funroll-loops -c aflpp_qemu_driver_hook.c || echo "Note: Optional aflpp_qemu_driver_hook.o not built."
|
@-test -e ../../qemu_mode/qemuafl/qemuafl/api.h && $(LLVM_BINDIR)clang $(CFLAGS) -funroll-loops -c aflpp_qemu_driver_hook.c || echo "Note: Optional aflpp_qemu_driver_hook.o not built."
|
||||||
|
Reference in New Issue
Block a user