diff options
| author | van Hauser <vh@thc.org> | 2020-01-15 10:23:28 +0100 |
|---|---|---|
| committer | van Hauser <vh@thc.org> | 2020-01-15 10:23:28 +0100 |
| commit | e673dc6dbebedc1374cd4fb9201cf784408c00f3 (patch) | |
| tree | b936331b103667bbbc3ecd06c78ccdba69bde47d /Makefile | |
| parent | d1d5e7c02a4b17f42b6334f258899d6543c9142c (diff) | |
| download | afl++-e673dc6dbebedc1374cd4fb9201cf784408c00f3.tar.gz | |
stronger afl-fuzz performance compilation
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/Makefile b/Makefile index 0c0b73c5..57d4c8c7 100644 --- a/Makefile +++ b/Makefile @@ -32,9 +32,25 @@ PROGS = afl-gcc afl-fuzz afl-showmap afl-tmin afl-gotcpu afl-analyze SH_PROGS = afl-plot afl-cmin afl-whatsup afl-system-config MANPAGES=$(foreach p, $(PROGS) $(SH_PROGS), $(p).8) -CFLAGS ?= -O3 -funroll-loops -CFLAGS += -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -I include/ \ - -DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \ +ifeq "$(shell echo 'int main() {return 0; }' | $(CC) -x c - -march=native -o .test 2>/dev/null && echo 1 || echo 0 ; rm -f .test )" "1" + CFLAGS_PERFORMANCE += -march=native +endif + +ifeq "$(shell echo 'int main() {return 0; }' | $(CC) -x c - -flto=full -o .test 2>/dev/null && echo 1 || echo 0 ; rm -f .test )" "1" + CFLAGS_PERFORMANCE += -flto=full +else + ifeq "$(shell echo 'int main() {return 0; }' | $(CC) -x c - -flto=thin -o .test 2>/dev/null && echo 1 || echo 0 ; rm -f .test )" "1" + CFLAGS_PERFORMANCE += -flto=thin + else + ifeq "$(shell echo 'int main() {return 0; }' | $(CC) -x c - -flto -o .test 2>/dev/null && echo 1 || echo 0 ; rm -f .test )" "1" + CFLAGS_PERFORMANCE += -flto + endif + endif +endif + +CFLAGS ?= -funroll-loops -Ofast $(CFLAGS_PERFORMANCE) +CFLAGS += -Wall -g -Wno-pointer-sign -I include/ \ + -DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \ -DDOC_PATH=\"$(DOC_PATH)\" -Wno-unused-function AFL_FUZZ_FILES = $(wildcard src/afl-fuzz*.c) |
