mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-08 16:21:32 +00:00
better performance compilation options for afl++ and targets
This commit is contained in:
parent
0994972c07
commit
996e1515b3
@ -51,11 +51,11 @@ endif
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq "$(shell uname)" "Darwin"
|
ifneq "$(shell uname)" "Darwin"
|
||||||
ifeq "$(shell echo 'int main() {return 0; }' | $(CC) $(CFLAGS) -Werror -x c - -march=native -o .test 2>/dev/null && echo 1 || echo 0 ; rm -f .test )" "1"
|
#ifeq "$(shell echo 'int main() {return 0; }' | $(CC) $(CFLAGS) -Werror -x c - -march=native -o .test 2>/dev/null && echo 1 || echo 0 ; rm -f .test )" "1"
|
||||||
CFLAGS_OPT += -march=native
|
# CFLAGS_OPT += -march=native
|
||||||
endif
|
#endif
|
||||||
# OS X does not like _FORTIFY_SOURCE=2
|
# OS X does not like _FORTIFY_SOURCE=2
|
||||||
# CFLAGS_OPT += -D_FORTIFY_SOURCE=2
|
CFLAGS_OPT += -D_FORTIFY_SOURCE=2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef STATIC
|
ifdef STATIC
|
||||||
|
1
TODO.md
1
TODO.md
@ -9,6 +9,7 @@
|
|||||||
- learn from honggfuzz
|
- learn from honggfuzz
|
||||||
- for persistent mode, have a functionality that transports the test case
|
- for persistent mode, have a functionality that transports the test case
|
||||||
via shared memory (and the int write to the FD from afl-fuzz is the size)
|
via shared memory (and the int write to the FD from afl-fuzz is the size)
|
||||||
|
- CPU affinity for many cores?
|
||||||
|
|
||||||
## Further down the road
|
## Further down the road
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ sending a mail to <afl-users+subscribe@googlegroups.com>.
|
|||||||
- fixed crash in compare-transform-pass when strcasecmp/strncasecmp was
|
- fixed crash in compare-transform-pass when strcasecmp/strncasecmp was
|
||||||
tried to be instrumented with LTO
|
tried to be instrumented with LTO
|
||||||
- fixed crash in cmplog with LTO
|
- fixed crash in cmplog with LTO
|
||||||
|
- slightly better performance compilation options for afl++ and targets
|
||||||
- fixed afl-gcc/afl-as that could break on fast systems reusing pids in
|
- fixed afl-gcc/afl-as that could break on fast systems reusing pids in
|
||||||
the same second
|
the same second
|
||||||
- added lots of dictionaries from oss-fuzz, go-fuzz and Jakub Wilk
|
- added lots of dictionaries from oss-fuzz, go-fuzz and Jakub Wilk
|
||||||
|
27
examples/aflpp_driver/GNUmakefile
Normal file
27
examples/aflpp_driver/GNUmakefile
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
ifeq "" "$(LLVM_CONFIG)"
|
||||||
|
LLVM_CONFIG=llvm-config
|
||||||
|
endif
|
||||||
|
|
||||||
|
LLVM_BINDIR = $(shell $(LLVM_CONFIG) --bindir 2>/dev/null)
|
||||||
|
ifneq "" "$(LLVM_BINDIR)"
|
||||||
|
LLVM_BINDIR := $(LLVM_BINDIR)/
|
||||||
|
endif
|
||||||
|
|
||||||
|
FLAGS=-O3 -funroll-loops
|
||||||
|
|
||||||
|
all: libAFLDriver.a libAFLDriver2.a
|
||||||
|
|
||||||
|
aflpp_driver.o: aflpp_driver.cpp
|
||||||
|
$(LLVM_BINDIR)clang++ $(FLAGS) -stdlib=libc++ -funroll-loops -std=c++11 -c aflpp_driver.cpp
|
||||||
|
|
||||||
|
afl-llvm-rt.o: ../../llvm_mode/afl-llvm-rt.o.c
|
||||||
|
$(LLVM_BINDIR)clang $(FLAGS) -I../../include -c -o afl-llvm-rt.o ../../llvm_mode/afl-llvm-rt.o.c
|
||||||
|
|
||||||
|
libAFLDriver.a: aflpp_driver.o
|
||||||
|
ar ru libAFLDriver.a aflpp_driver.o
|
||||||
|
|
||||||
|
libAFLDriver2.a: aflpp_driver.o afl-llvm-rt.o
|
||||||
|
ar ru libAFLDriver2.a aflpp_driver.o afl-llvm-rt.o
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libAFLDriver*.a *~ core
|
@ -1,24 +1,2 @@
|
|||||||
ifeq "" "$(LLVM_CONFIG)"
|
all:
|
||||||
LLVM_CONFIG=llvm-config
|
@gmake all || echo please install GNUmake
|
||||||
endif
|
|
||||||
|
|
||||||
LLVM_BINDIR = $(shell $(LLVM_CONFIG) --bindir 2>/dev/null)
|
|
||||||
ifneq "" "$(LLVM_BINDIR)"
|
|
||||||
LLVM_BINDIR := $(LLVM_BINDIR)/
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
all: libAFLDriver.a
|
|
||||||
|
|
||||||
aflpp_driver.o: aflpp_driver.cpp
|
|
||||||
$(LLVM_BINDIR)clang++ -O3 -march=native -stdlib=libc++ -funroll-loops -std=c++11 -c aflpp_driver.cpp
|
|
||||||
|
|
||||||
afl-llvm-rt.o: ../../llvm_mode/afl-llvm-rt.o.c
|
|
||||||
$(LLVM_BINDIR)clang++ -O3 -march=native -funroll-loops -stdlib=libc++ -std=c++11 -c aflpp_driver.cpp
|
|
||||||
|
|
||||||
libAFLDriver.a: aflpp_driver.o afl-llvm-rt.o
|
|
||||||
ar ru libAFLDriver.a aflpp_driver.o
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.o libAFLDriver.a *~ core
|
|
||||||
|
@ -160,9 +160,9 @@ endif
|
|||||||
|
|
||||||
# After we set CC/CXX we can start makefile magic tests
|
# After we set CC/CXX we can start makefile magic tests
|
||||||
|
|
||||||
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"
|
#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_OPT = -march=native
|
# CFLAGS_OPT = -march=native
|
||||||
endif
|
#endif
|
||||||
|
|
||||||
ifeq "$(shell echo 'int main() {return 0; }' | $(CLANG_BIN) -x c - -flto=full -o .test 2>/dev/null && echo 1 || echo 0 ; rm -f .test )" "1"
|
ifeq "$(shell echo 'int main() {return 0; }' | $(CLANG_BIN) -x c - -flto=full -o .test 2>/dev/null && echo 1 || echo 0 ; rm -f .test )" "1"
|
||||||
AFL_CLANG_FLTO ?= -flto=full
|
AFL_CLANG_FLTO ?= -flto=full
|
||||||
@ -196,8 +196,7 @@ ifeq "$(shell echo 'int main() {return 0; }' | $(CLANG_BIN) -x c - -fuse-ld=`com
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS ?= -O3 -funroll-loops
|
CFLAGS ?= -O3 -funroll-loops -D_FORTIFY_SOURCE=2
|
||||||
# -D_FORTIFY_SOURCE=2
|
|
||||||
override CFLAGS += -Wall \
|
override CFLAGS += -Wall \
|
||||||
-g -Wno-pointer-sign -I ../include/ \
|
-g -Wno-pointer-sign -I ../include/ \
|
||||||
-DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
|
-DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
|
||||||
@ -210,8 +209,7 @@ ifdef AFL_TRACE_PC
|
|||||||
$(info Compile option AFL_TRACE_PC is deprecated, just set AFL_LLVM_INSTRUMENT=PCGUARD to activate when compiling targets )
|
$(info Compile option AFL_TRACE_PC is deprecated, just set AFL_LLVM_INSTRUMENT=PCGUARD to activate when compiling targets )
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CXXFLAGS ?= -O3 -funroll-loops
|
CXXFLAGS ?= -O3 -funroll-loops -D_FORTIFY_SOURCE=2
|
||||||
# -D_FORTIFY_SOURCE=2
|
|
||||||
override CXXFLAGS += -Wall -g -I ../include/ \
|
override CXXFLAGS += -Wall -g -I ../include/ \
|
||||||
-DVERSION=\"$(VERSION)\" -Wno-variadic-macros
|
-DVERSION=\"$(VERSION)\" -Wno-variadic-macros
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
all:
|
all:
|
||||||
@echo please use GNU make, thanks!
|
@gmake all || echo please install GNUmake
|
||||||
|
@ -335,7 +335,7 @@ static void edit_params(u32 argc, char **argv, char **envp) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_params[cc_par_cnt++] = "-Qunused-arguments";
|
//cc_params[cc_par_cnt++] = "-Qunused-arguments";
|
||||||
|
|
||||||
// in case LLVM is installed not via a package manager or "make install"
|
// in case LLVM is installed not via a package manager or "make install"
|
||||||
// e.g. compiled download or compiled from github then it's ./lib directory
|
// e.g. compiled download or compiled from github then it's ./lib directory
|
||||||
@ -440,8 +440,8 @@ static void edit_params(u32 argc, char **argv, char **envp) {
|
|||||||
cc_params[cc_par_cnt++] = "-g";
|
cc_params[cc_par_cnt++] = "-g";
|
||||||
cc_params[cc_par_cnt++] = "-O3";
|
cc_params[cc_par_cnt++] = "-O3";
|
||||||
cc_params[cc_par_cnt++] = "-funroll-loops";
|
cc_params[cc_par_cnt++] = "-funroll-loops";
|
||||||
if (strlen(march_opt) > 1 && march_opt[0] == '-')
|
//if (strlen(march_opt) > 1 && march_opt[0] == '-')
|
||||||
cc_params[cc_par_cnt++] = march_opt;
|
// cc_params[cc_par_cnt++] = march_opt;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -789,12 +789,12 @@ void __sanitizer_cov_trace_pc_guard(uint32_t *guard) {
|
|||||||
void __sanitizer_cov_trace_pc_guard_init(uint32_t *start, uint32_t *stop) {
|
void __sanitizer_cov_trace_pc_guard_init(uint32_t *start, uint32_t *stop) {
|
||||||
|
|
||||||
u32 inst_ratio = 100;
|
u32 inst_ratio = 100;
|
||||||
u8 *x;
|
char *x;
|
||||||
|
|
||||||
if (start == stop || *start) return;
|
if (start == stop || *start) return;
|
||||||
|
|
||||||
x = getenv("AFL_INST_RATIO");
|
x = getenv("AFL_INST_RATIO");
|
||||||
if (x) inst_ratio = atoi(x);
|
if (x) inst_ratio = (u32)atoi(x);
|
||||||
|
|
||||||
if (!inst_ratio || inst_ratio > 100) {
|
if (!inst_ratio || inst_ratio > 100) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user