From dc2c46e23c067eaeadc042fe84c603a496e90cf6 Mon Sep 17 00:00:00 2001 From: hexcoder- Date: Wed, 7 Aug 2019 20:22:47 +0200 Subject: change instrumentation test to trigger different bitmap entries with clang 9.0 --- llvm_mode/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm_mode/Makefile') diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile index 2b685ddc..80ffb38a 100644 --- a/llvm_mode/Makefile +++ b/llvm_mode/Makefile @@ -174,7 +174,7 @@ endif test_build: $(PROGS) @echo "[*] Testing the CC wrapper and instrumentation output..." unset AFL_USE_ASAN AFL_USE_MSAN AFL_INST_RATIO; AFL_QUIET=1 AFL_PATH=. AFL_CC=$(CC) AFL_LLVM_LAF_SPLIT_SWITCHES=1 AFL_LLVM_LAF_TRANSFORM_COMPARES=1 AFL_LLVM_LAF_SPLIT_COMPARES=1 ../afl-clang-fast $(CFLAGS) ../test-instr.c -o test-instr $(LDFLAGS) - echo 0 | ../afl-showmap -m none -q -o .test-instr0 ./test-instr + echo -n| ../afl-showmap -m none -q -o .test-instr0 ./test-instr echo 1 | ../afl-showmap -m none -q -o .test-instr1 ./test-instr @rm -f test-instr @cmp -s .test-instr0 .test-instr1; DR="$$?"; rm -f .test-instr0 .test-instr1; if [ "$$DR" = "0" ]; then echo; echo "Oops, the instrumentation does not seem to be behaving correctly!"; echo; echo "Please ping to troubleshoot the issue."; echo; exit 1; fi -- cgit 1.4.1 From 07df1e303419a642b96750411af99b586d0ea5a0 Mon Sep 17 00:00:00 2001 From: hexcoder- Date: Wed, 7 Aug 2019 20:34:57 +0200 Subject: bugfix 'echo -n' is not POSIX, use input redirection from /dev/null --- Makefile | 2 +- llvm_mode/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm_mode/Makefile') diff --git a/Makefile b/Makefile index 47b06785..9e92de81 100644 --- a/Makefile +++ b/Makefile @@ -158,7 +158,7 @@ ifndef AFL_NO_X86 test_build: afl-gcc afl-as afl-showmap @echo "[*] Testing the CC wrapper and instrumentation output..." unset AFL_USE_ASAN AFL_USE_MSAN AFL_CC; AFL_QUIET=1 AFL_INST_RATIO=100 AFL_PATH=. ./$(TEST_CC) $(CFLAGS) test-instr.c -o test-instr $(LDFLAGS) - echo -n| ./afl-showmap -m none -q -o .test-instr0 ./test-instr + ./afl-showmap -m none -q -o .test-instr0 ./test-instr to troubleshoot the issue."; echo; exit 1; fi diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile index 80ffb38a..d01fbbdf 100644 --- a/llvm_mode/Makefile +++ b/llvm_mode/Makefile @@ -174,7 +174,7 @@ endif test_build: $(PROGS) @echo "[*] Testing the CC wrapper and instrumentation output..." unset AFL_USE_ASAN AFL_USE_MSAN AFL_INST_RATIO; AFL_QUIET=1 AFL_PATH=. AFL_CC=$(CC) AFL_LLVM_LAF_SPLIT_SWITCHES=1 AFL_LLVM_LAF_TRANSFORM_COMPARES=1 AFL_LLVM_LAF_SPLIT_COMPARES=1 ../afl-clang-fast $(CFLAGS) ../test-instr.c -o test-instr $(LDFLAGS) - echo -n| ../afl-showmap -m none -q -o .test-instr0 ./test-instr + ../afl-showmap -m none -q -o .test-instr0 ./test-instr to troubleshoot the issue."; echo; exit 1; fi -- cgit 1.4.1 From e1183be22ec38e180ec86737e204c5effbc1648b Mon Sep 17 00:00:00 2001 From: van Hauser Date: Thu, 8 Aug 2019 10:43:27 +0200 Subject: documentation update --- Makefile | 2 +- README.md | 7 ++++--- llvm_mode/Makefile | 6 +++--- llvm_mode/README.llvm | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) (limited to 'llvm_mode/Makefile') diff --git a/Makefile b/Makefile index 9e92de81..5c5d7fb2 100644 --- a/Makefile +++ b/Makefile @@ -158,7 +158,7 @@ ifndef AFL_NO_X86 test_build: afl-gcc afl-as afl-showmap @echo "[*] Testing the CC wrapper and instrumentation output..." unset AFL_USE_ASAN AFL_USE_MSAN AFL_CC; AFL_QUIET=1 AFL_INST_RATIO=100 AFL_PATH=. ./$(TEST_CC) $(CFLAGS) test-instr.c -o test-instr $(LDFLAGS) - ./afl-showmap -m none -q -o .test-instr0 ./test-instr to troubleshoot the issue."; echo; exit 1; fi diff --git a/README.md b/README.md index 2124b862..dff6463b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # american fuzzy lop plus plus (afl++) Release Version: 2.53c + Github Version: 2.53d @@ -17,7 +18,7 @@ get any improvements since November 2017. Among others afl++ has, e.g. more performant llvm_mode, supporting - llvm up to version 8, Qemu 3.1, more speed and crashfixes for Qemu, + llvm up to version 9, Qemu 3.1, more speed and crashfixes for Qemu, laf-intel feature for Qemu (with libcompcov) and more. Additionally the following patches have been integrated: @@ -120,7 +121,7 @@ superior to blind fuzzing or coverage-only tools. PLEASE NOTE: llvm_mode compilation with afl-clang-fast/afl-clang-fast++ instead of afl-gcc/afl-g++ is much faster and has a few cool features. See llvm_mode/ - however few code does not compile with llvm. -We support llvm versions 4.0 to 8. +We support llvm versions 3.8.0 to 9. When source code is available, instrumentation can be injected by a companion tool that works as a drop-in replacement for gcc or clang in any standard build @@ -143,7 +144,7 @@ For C++ programs, you'd would also want to set `CXX=/path/to/afl/afl-g++`. The clang wrappers (afl-clang and afl-clang++) can be used in the same way; clang users may also opt to leverage a higher-performance instrumentation mode, as described in [llvm_mode/README.llvm](llvm_mode/README.llvm). -Clang/LLVM has a much better performance and works with LLVM version 4.0 to 8. +Clang/LLVM has a much better performance and works with LLVM version 3.8.0 to 9. Using the LAF Intel performance enhancements are also recommended, see [llvm_mode/README.laf-intel](llvm_mode/README.laf-intel) diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile index d01fbbdf..1c661525 100644 --- a/llvm_mode/Makefile +++ b/llvm_mode/Makefile @@ -27,11 +27,11 @@ VERSION = $(shell grep '^\#define VERSION ' ../config.h | cut -d '"' -f2) LLVM_CONFIG ?= llvm-config LLVMVER = $(shell $(LLVM_CONFIG) --version) -LLVM_UNSUPPORTED = $(shell $(LLVM_CONFIG) --version | egrep -q '^9|3.0' && echo 1 || echo 0 ) +LLVM_UNSUPPORTED = $(shell $(LLVM_CONFIG) --version | egrep -q '^[12]|^3\.0|^1[0-9]' && echo 1 || echo 0 ) LLVM_MAJOR = ($shell $(LLVM_CONFIG) --version | sed 's/\..*//') ifeq "$(LLVM_UNSUPPORTED)" "1" - $(warn llvm_mode only supports versions 3.8.0 up to 8.x ) + $(warn llvm_mode only supports versions 3.8.0 up to 9 ) endif # this is not visible yet: @@ -174,7 +174,7 @@ endif test_build: $(PROGS) @echo "[*] Testing the CC wrapper and instrumentation output..." unset AFL_USE_ASAN AFL_USE_MSAN AFL_INST_RATIO; AFL_QUIET=1 AFL_PATH=. AFL_CC=$(CC) AFL_LLVM_LAF_SPLIT_SWITCHES=1 AFL_LLVM_LAF_TRANSFORM_COMPARES=1 AFL_LLVM_LAF_SPLIT_COMPARES=1 ../afl-clang-fast $(CFLAGS) ../test-instr.c -o test-instr $(LDFLAGS) - ../afl-showmap -m none -q -o .test-instr0 ./test-instr to troubleshoot the issue."; echo; exit 1; fi diff --git a/llvm_mode/README.llvm b/llvm_mode/README.llvm index f324b8c0..9bb091ac 100644 --- a/llvm_mode/README.llvm +++ b/llvm_mode/README.llvm @@ -8,7 +8,7 @@ Fast LLVM-based instrumentation for afl-fuzz 1) Introduction --------------- -! llvm_mode works with llvm versions 3.8.1 up to 9 ! +! llvm_mode works with llvm versions 3.8.0 up to 9 ! The code in this directory allows you to instrument programs for AFL using true compiler-level instrumentation, instead of the more crude -- cgit 1.4.1 From 73d02f3a808903f02dd0b547e7db9ff00efdf6c5 Mon Sep 17 00:00:00 2001 From: hexcoder- Date: Thu, 8 Aug 2019 23:09:58 +0200 Subject: fix some compiler warnings --- llvm_mode/Makefile | 2 +- llvm_mode/MarkNodes.cc | 2 +- llvm_mode/split-compares-pass.so.cc | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'llvm_mode/Makefile') diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile index 1c661525..8331b662 100644 --- a/llvm_mode/Makefile +++ b/llvm_mode/Makefile @@ -48,7 +48,7 @@ ifdef AFL_TRACE_PC endif CXXFLAGS ?= -O3 -funroll-loops -CXXFLAGS += -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign \ +CXXFLAGS += -Wall -D_FORTIFY_SOURCE=2 -g \ -DVERSION=\"$(VERSION)\" -Wno-variadic-macros CLANG_CFL = `$(LLVM_CONFIG) --cxxflags` -Wl,-znodelete -fno-rtti -fpic $(CXXFLAGS) diff --git a/llvm_mode/MarkNodes.cc b/llvm_mode/MarkNodes.cc index a156fccb..348dc264 100644 --- a/llvm_mode/MarkNodes.cc +++ b/llvm_mode/MarkNodes.cc @@ -193,7 +193,7 @@ namespace DominatorTree{ idom[now] = idom[idom[now]]; } } -}; // End of DominatorTree +} // End of DominatorTree std::vector Visited, InStack; std::vector TopoOrder, InDeg; diff --git a/llvm_mode/split-compares-pass.so.cc b/llvm_mode/split-compares-pass.so.cc index c025628f..a74b60fa 100644 --- a/llvm_mode/split-compares-pass.so.cc +++ b/llvm_mode/split-compares-pass.so.cc @@ -495,14 +495,12 @@ bool SplitComparesTransform::runOnModule(Module &M) { errs() << "Running split-compare-pass " << 64 << "\n"; splitCompares(M, 64); - [[clang::fallthrough]]; - /* fallthrough */ + [[clang::fallthrough]]; /*FALLTHRU*/ /* FALLTHROUGH */ case 32: errs() << "Running split-compare-pass " << 32 << "\n"; splitCompares(M, 32); - [[clang::fallthrough]]; - /* fallthrough */ + [[clang::fallthrough]]; /*FALLTHRU*/ /* FALLTHROUGH */ case 16: errs() << "Running split-compare-pass " << 16 << "\n"; splitCompares(M, 16); -- cgit 1.4.1 From 41d2e7d6b6ac1bab20f73e1e023c8450bbfc657e Mon Sep 17 00:00:00 2001 From: van Hauser Date: Fri, 9 Aug 2019 00:34:26 +0200 Subject: minor corrections --- Makefile | 2 +- afl-common.h | 1 + llvm_mode/Makefile | 2 +- test-instr.c | 7 +++++-- 4 files changed, 8 insertions(+), 4 deletions(-) (limited to 'llvm_mode/Makefile') diff --git a/Makefile b/Makefile index 5c5d7fb2..e6e3af85 100644 --- a/Makefile +++ b/Makefile @@ -161,7 +161,7 @@ test_build: afl-gcc afl-as afl-showmap ./afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null echo 1 | ./afl-showmap -m none -q -o .test-instr1 ./test-instr @rm -f test-instr - @cmp -s .test-instr0 .test-instr1; DR="$$?"; rm -f .test-instr0 .test-instr1; if [ "$$DR" = "0" ]; then echo; echo "Oops, the instrumentation does not seem to be behaving correctly!"; echo; echo "Please ping to troubleshoot the issue."; echo; exit 1; fi + @cmp -s .test-instr0 .test-instr1; DR="$$?"; rm -f .test-instr0 .test-instr1; if [ "$$DR" = "0" ]; then echo; echo "Oops, the instrumentation does not seem to be behaving correctly!"; echo; echo "Please post to https://github.com/vanhauser-thc/AFLplusplus/issues to troubleshoot the issue."; echo; exit 1; fi @echo "[+] All right, the instrumentation seems to be working!" else diff --git a/afl-common.h b/afl-common.h index 07afb75d..161caa39 100644 --- a/afl-common.h +++ b/afl-common.h @@ -1,5 +1,6 @@ #ifndef __AFLCOMMON_H #define __AFLCOMMON_H +#include "types.h" void detect_file_args(char **argv, u8 *prog_in); #endif diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile index 8331b662..3923f8e3 100644 --- a/llvm_mode/Makefile +++ b/llvm_mode/Makefile @@ -177,7 +177,7 @@ test_build: $(PROGS) ../afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null echo 1 | ../afl-showmap -m none -q -o .test-instr1 ./test-instr @rm -f test-instr - @cmp -s .test-instr0 .test-instr1; DR="$$?"; rm -f .test-instr0 .test-instr1; if [ "$$DR" = "0" ]; then echo; echo "Oops, the instrumentation does not seem to be behaving correctly!"; echo; echo "Please ping to troubleshoot the issue."; echo; exit 1; fi + @cmp -s .test-instr0 .test-instr1; DR="$$?"; rm -f .test-instr0 .test-instr1; if [ "$$DR" = "0" ]; then echo; echo "Oops, the instrumentation does not seem to be behaving correctly!"; echo; echo "Please post to https://github.com/vanhauser-thc/AFLplusplus/issues to troubleshoot the issue."; echo; exit 1; fi @echo "[+] All right, the instrumentation seems to be working!" all_done: test_build diff --git a/test-instr.c b/test-instr.c index 1b978c55..9107f15e 100644 --- a/test-instr.c +++ b/test-instr.c @@ -20,9 +20,12 @@ int main(int argc, char** argv) { - char buf[8]; + char buff[8]; + char *buf = buff; - if (read(0, buf, sizeof(buf)) < 1) { + if (argc > 1) + buf = argv[1]; + else if (read(0, buf, sizeof(buf)) < 1) { printf("Hum?\n"); exit(1); } -- cgit 1.4.1 From ed603dcba2984b717bcdf9b06f0e8ec7554e0523 Mon Sep 17 00:00:00 2001 From: Zhu Xing Date: Sat, 10 Aug 2019 08:19:21 +0000 Subject: llvm-mode: Get the clang version correctly When using clang-8.0, The previous command in the Makefile will get two 8.0.0, thus a warning message print. --- llvm_mode/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm_mode/Makefile') diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile index 3923f8e3..66490184 100644 --- a/llvm_mode/Makefile +++ b/llvm_mode/Makefile @@ -75,7 +75,7 @@ endif # sanity check. # Are versions of clang --version and llvm-config --version equal? -CLANGVER = $(shell $(CC) --version | sed -E -ne '/^.*([0-9]\.[0-9]\.[0-9]).*/s//\1/p') +CLANGVER = $(shell $(CC) --version | sed -ne "1,2p" | sed -E -ne '/^.*([0-9]\.[0-9]\.[0-9]).*/s//\1/p') ifeq "$(shell echo '\#include @\#include @int main() { int _id = shmget(IPC_PRIVATE, 65536, IPC_CREAT | IPC_EXCL | 0600); shmctl(_id, IPC_RMID, 0); return 0;}' | tr @ '\n' | $(CC) -x c - -o .test2 2>/dev/null && echo 1 || echo 0 )" "1" -- cgit 1.4.1 From 0612aa2b65a6995c8cd372385a0d096efef7ba93 Mon Sep 17 00:00:00 2001 From: hexcoder- Date: Sat, 10 Aug 2019 17:10:18 +0200 Subject: optimized version extraction for clang (restricted to first line) --- llvm_mode/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm_mode/Makefile') diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile index 66490184..fc7a6fd9 100644 --- a/llvm_mode/Makefile +++ b/llvm_mode/Makefile @@ -75,7 +75,7 @@ endif # sanity check. # Are versions of clang --version and llvm-config --version equal? -CLANGVER = $(shell $(CC) --version | sed -ne "1,2p" | sed -E -ne '/^.*([0-9]\.[0-9]\.[0-9]).*/s//\1/p') +CLANGVER = $(shell $(CC) --version | sed -E -ne '1{/^.*([0-9]\.[0-9]\.[0-9]).*/s//\1/p}') ifeq "$(shell echo '\#include @\#include @int main() { int _id = shmget(IPC_PRIVATE, 65536, IPC_CREAT | IPC_EXCL | 0600); shmctl(_id, IPC_RMID, 0); return 0;}' | tr @ '\n' | $(CC) -x c - -o .test2 2>/dev/null && echo 1 || echo 0 )" "1" -- cgit 1.4.1 From 96c76a8333d39b06096e4cbb668a52ffa5575e9a Mon Sep 17 00:00:00 2001 From: hexcoder- Date: Wed, 14 Aug 2019 22:41:39 +0200 Subject: more sed compatibility for Freebsd, avoid grouping --- llvm_mode/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm_mode/Makefile') diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile index fc7a6fd9..160a8fe6 100644 --- a/llvm_mode/Makefile +++ b/llvm_mode/Makefile @@ -75,7 +75,7 @@ endif # sanity check. # Are versions of clang --version and llvm-config --version equal? -CLANGVER = $(shell $(CC) --version | sed -E -ne '1{/^.*([0-9]\.[0-9]\.[0-9]).*/s//\1/p}') +CLANGVER = $(shell $(CC) --version | sed -E -ne '/^.*version\ ([0-9]\.[0-9]\.[0-9]).*/s//\1/p') ifeq "$(shell echo '\#include @\#include @int main() { int _id = shmget(IPC_PRIVATE, 65536, IPC_CREAT | IPC_EXCL | 0600); shmctl(_id, IPC_RMID, 0); return 0;}' | tr @ '\n' | $(CC) -x c - -o .test2 2>/dev/null && echo 1 || echo 0 )" "1" -- cgit 1.4.1 From 7cb0658b0091ecae9458c250505a05d1402a4fc8 Mon Sep 17 00:00:00 2001 From: hexcoder- Date: Wed, 14 Aug 2019 22:41:39 +0200 Subject: more sed compatibility for Freebsd, avoid grouping --- llvm_mode/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm_mode/Makefile') diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile index fc7a6fd9..160a8fe6 100644 --- a/llvm_mode/Makefile +++ b/llvm_mode/Makefile @@ -75,7 +75,7 @@ endif # sanity check. # Are versions of clang --version and llvm-config --version equal? -CLANGVER = $(shell $(CC) --version | sed -E -ne '1{/^.*([0-9]\.[0-9]\.[0-9]).*/s//\1/p}') +CLANGVER = $(shell $(CC) --version | sed -E -ne '/^.*version\ ([0-9]\.[0-9]\.[0-9]).*/s//\1/p') ifeq "$(shell echo '\#include @\#include @int main() { int _id = shmget(IPC_PRIVATE, 65536, IPC_CREAT | IPC_EXCL | 0600); shmctl(_id, IPC_RMID, 0); return 0;}' | tr @ '\n' | $(CC) -x c - -o .test2 2>/dev/null && echo 1 || echo 0 )" "1" -- cgit 1.4.1 From bae398a9a4d14ccddde48591ba94d5c03970d741 Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Tue, 27 Aug 2019 19:22:53 +0200 Subject: -I include in makefiles --- debug.h | 1 - libdislocator/Makefile | 2 +- libdislocator/libdislocator.so.c | 4 ++-- libtokencap/Makefile | 2 +- llvm_mode/LLVMInsTrim.so.cc | 4 ++-- llvm_mode/Makefile | 4 ++-- llvm_mode/afl-clang-fast.c | 8 ++++---- llvm_mode/afl-llvm-pass.so.cc | 4 ++-- llvm_mode/afl-llvm-rt.o.c | 4 ++-- qemu_mode/libcompcov/Makefile | 2 +- qemu_mode/libcompcov/libcompcov.so.c | 4 ++-- 11 files changed, 19 insertions(+), 20 deletions(-) delete mode 120000 debug.h (limited to 'llvm_mode/Makefile') diff --git a/debug.h b/debug.h deleted file mode 120000 index a00dd92f..00000000 --- a/debug.h +++ /dev/null @@ -1 +0,0 @@ -include/debug.h \ No newline at end of file diff --git a/libdislocator/Makefile b/libdislocator/Makefile index a4116780..236667ec 100644 --- a/libdislocator/Makefile +++ b/libdislocator/Makefile @@ -18,7 +18,7 @@ HELPER_PATH = $(PREFIX)/lib/afl VERSION = $(shell grep '^\#define VERSION ' ../config.h | cut -d '"' -f2) -CFLAGS ?= -O3 -funroll-loops +CFLAGS ?= -O3 -funroll-loops -I ../include/ CFLAGS += -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign all: libdislocator.so diff --git a/libdislocator/libdislocator.so.c b/libdislocator/libdislocator.so.c index 043480a6..71620b17 100644 --- a/libdislocator/libdislocator.so.c +++ b/libdislocator/libdislocator.so.c @@ -25,8 +25,8 @@ #include #include -#include "../config.h" -#include "../types.h" +#include "config.h" +#include "types.h" #ifndef PAGE_SIZE # define PAGE_SIZE 4096 diff --git a/libtokencap/Makefile b/libtokencap/Makefile index a464f76d..ec4c8f95 100644 --- a/libtokencap/Makefile +++ b/libtokencap/Makefile @@ -18,7 +18,7 @@ HELPER_PATH = $(PREFIX)/lib/afl VERSION = $(shell grep '^\#define VERSION ' ../config.h | cut -d '"' -f2) -CFLAGS ?= -O3 -funroll-loops +CFLAGS ?= -O3 -funroll-loops -I ../include/ CFLAGS += -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign all: libtokencap.so diff --git a/llvm_mode/LLVMInsTrim.so.cc b/llvm_mode/LLVMInsTrim.so.cc index 0a15680d..95b52d48 100644 --- a/llvm_mode/LLVMInsTrim.so.cc +++ b/llvm_mode/LLVMInsTrim.so.cc @@ -24,8 +24,8 @@ #include #include -#include "../config.h" -#include "../debug.h" +#include "config.h" +#include "debug.h" #include "MarkNodes.h" diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile index 160a8fe6..e51803c8 100644 --- a/llvm_mode/Makefile +++ b/llvm_mode/Makefile @@ -40,7 +40,7 @@ ifeq "$(LLVM_MAJOR)" "9" endif CFLAGS ?= -O3 -funroll-loops -CFLAGS += -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign \ +CFLAGS += -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -I ../include/ \ -DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \ -DVERSION=\"$(VERSION)\" ifdef AFL_TRACE_PC @@ -48,7 +48,7 @@ ifdef AFL_TRACE_PC endif CXXFLAGS ?= -O3 -funroll-loops -CXXFLAGS += -Wall -D_FORTIFY_SOURCE=2 -g \ +CXXFLAGS += -Wall -D_FORTIFY_SOURCE=2 -g -I ../include/ \ -DVERSION=\"$(VERSION)\" -Wno-variadic-macros CLANG_CFL = `$(LLVM_CONFIG) --cxxflags` -Wl,-znodelete -fno-rtti -fpic $(CXXFLAGS) diff --git a/llvm_mode/afl-clang-fast.c b/llvm_mode/afl-clang-fast.c index 28a9a853..1b810edf 100644 --- a/llvm_mode/afl-clang-fast.c +++ b/llvm_mode/afl-clang-fast.c @@ -23,10 +23,10 @@ #define AFL_MAIN -#include "../config.h" -#include "../types.h" -#include "../debug.h" -#include "../include/alloc-inl.h" +#include "config.h" +#include "types.h" +#include "debug.h" +#include "alloc-inl.h" #include #include diff --git a/llvm_mode/afl-llvm-pass.so.cc b/llvm_mode/afl-llvm-pass.so.cc index cfeff968..3fe7f83e 100644 --- a/llvm_mode/afl-llvm-pass.so.cc +++ b/llvm_mode/afl-llvm-pass.so.cc @@ -24,8 +24,8 @@ #define AFL_LLVM_PASS -#include "../config.h" -#include "../debug.h" +#include "config.h" +#include "debug.h" #include #include diff --git a/llvm_mode/afl-llvm-rt.o.c b/llvm_mode/afl-llvm-rt.o.c index debde204..1564ae9d 100644 --- a/llvm_mode/afl-llvm-rt.o.c +++ b/llvm_mode/afl-llvm-rt.o.c @@ -19,8 +19,8 @@ */ -#include "../config.h" -#include "../types.h" +#include "config.h" +#include "types.h" #include #include diff --git a/qemu_mode/libcompcov/Makefile b/qemu_mode/libcompcov/Makefile index c984588b..a1f4e31f 100644 --- a/qemu_mode/libcompcov/Makefile +++ b/qemu_mode/libcompcov/Makefile @@ -18,7 +18,7 @@ HELPER_PATH = $(PREFIX)/lib/afl VERSION = $(shell grep '^\#define VERSION ' ../config.h | cut -d '"' -f2) -CFLAGS ?= -O3 -funroll-loops +CFLAGS ?= -O3 -funroll-loops -I ../../include/ CFLAGS += -Wall -Wno-unused-result -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign LDFLAGS += -ldl diff --git a/qemu_mode/libcompcov/libcompcov.so.c b/qemu_mode/libcompcov/libcompcov.so.c index 582230db..44045d39 100644 --- a/qemu_mode/libcompcov/libcompcov.so.c +++ b/qemu_mode/libcompcov/libcompcov.so.c @@ -27,8 +27,8 @@ #include #include -#include "../../types.h" -#include "../../config.h" +#include "types.h" +#include "config.h" #include "pmparser.h" -- cgit 1.4.1 From 3bfd88aabbf3fdf70cb053aa25944f32d2113d8f Mon Sep 17 00:00:00 2001 From: hexcoder- Date: Tue, 3 Sep 2019 04:28:24 +0200 Subject: better support for OpenBSD thanks to CaBeckmann (issue #9). On OpenBSD there is a restricted system LLVM, but a full LLVM package can be installed (typically in /usr/local/bin). Added a check if the full package is installed. If so, use it, otherwise bail out early with a hint to install it. --- llvm_mode/Makefile | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'llvm_mode/Makefile') diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile index 160a8fe6..7f0c8c5d 100644 --- a/llvm_mode/Makefile +++ b/llvm_mode/Makefile @@ -25,13 +25,22 @@ BIN_PATH = $(PREFIX)/bin VERSION = $(shell grep '^\#define VERSION ' ../config.h | cut -d '"' -f2) -LLVM_CONFIG ?= llvm-config +ifeq "$(shell uname)" "OpenBSD" + LLVM_CONFIG ?= $(BIN_PATH)/llvm-config + HAS_OPT = $(shell test -x $(BIN_PATH)/opt && echo 0 || echo 1) + ifeq "$(HAS_OPT)" "1" + $(error llvm_mode needs a complete llvm installation (versions 3.8.0 up to 9) -> e.g. "pkg_add llvm-7.0.1p9") + endif +else + LLVM_CONFIG ?= llvm-config +endif + LLVMVER = $(shell $(LLVM_CONFIG) --version) LLVM_UNSUPPORTED = $(shell $(LLVM_CONFIG) --version | egrep -q '^[12]|^3\.0|^1[0-9]' && echo 1 || echo 0 ) LLVM_MAJOR = ($shell $(LLVM_CONFIG) --version | sed 's/\..*//') ifeq "$(LLVM_UNSUPPORTED)" "1" - $(warn llvm_mode only supports versions 3.8.0 up to 9 ) + $(error llvm_mode only supports versions 3.8.0 up to 9) endif # this is not visible yet: @@ -61,7 +70,7 @@ ifeq "$(shell uname)" "Darwin" endif ifeq "$(shell uname)" "OpenBSD" - CLANG_LFL += `$(LLVM_CONFIG) --libdir`/libLLVM.so.0.0 + CLANG_LFL += `$(LLVM_CONFIG) --libdir`/libLLVM.so endif # We were using llvm-config --bindir to get the location of clang, but @@ -69,8 +78,13 @@ endif # probably better. ifeq "$(origin CC)" "default" - CC = clang - CXX = clang++ + ifeq "$(shell uname)" "OpenBSD" + CC = $(BIN_PATH)/clang + CXX = $(BIN_PATH)/clang++ + else + CC = clang + CXX = clang++ + endif endif # sanity check. -- cgit 1.4.1 From 45f00e45be3eeb1109aaa7b7756d15b795f2acde Mon Sep 17 00:00:00 2001 From: van Hauser Date: Tue, 3 Sep 2019 11:38:44 +0200 Subject: error to warn change --- llvm_mode/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm_mode/Makefile') diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile index 88e9d579..6332b01a 100644 --- a/llvm_mode/Makefile +++ b/llvm_mode/Makefile @@ -40,7 +40,7 @@ LLVM_UNSUPPORTED = $(shell $(LLVM_CONFIG) --version | egrep -q '^[12]|^3\.0|^1[0 LLVM_MAJOR = ($shell $(LLVM_CONFIG) --version | sed 's/\..*//') ifeq "$(LLVM_UNSUPPORTED)" "1" - $(error llvm_mode only supports versions 3.8.0 up to 9) + $(warn llvm_mode only supports versions 3.8.0 up to 9) endif # this is not visible yet: -- cgit 1.4.1