better performance compilation options for afl++ and targets

This commit is contained in:
van Hauser
2020-05-26 13:19:57 +02:00
parent 0994972c07
commit 996e1515b3
9 changed files with 46 additions and 41 deletions

View File

@ -160,9 +160,9 @@ endif
# 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"
CFLAGS_OPT = -march=native
endif
#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
#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"
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
CFLAGS ?= -O3 -funroll-loops
# -D_FORTIFY_SOURCE=2
CFLAGS ?= -O3 -funroll-loops -D_FORTIFY_SOURCE=2
override CFLAGS += -Wall \
-g -Wno-pointer-sign -I ../include/ \
-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 )
endif
CXXFLAGS ?= -O3 -funroll-loops
# -D_FORTIFY_SOURCE=2
CXXFLAGS ?= -O3 -funroll-loops -D_FORTIFY_SOURCE=2
override CXXFLAGS += -Wall -g -I ../include/ \
-DVERSION=\"$(VERSION)\" -Wno-variadic-macros

View File

@ -1,2 +1,2 @@
all:
@echo please use GNU make, thanks!
@gmake all || echo please install GNUmake

View File

@ -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"
// 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++] = "-O3";
cc_params[cc_par_cnt++] = "-funroll-loops";
if (strlen(march_opt) > 1 && march_opt[0] == '-')
cc_params[cc_par_cnt++] = march_opt;
//if (strlen(march_opt) > 1 && march_opt[0] == '-')
// cc_params[cc_par_cnt++] = march_opt;
}

View File

@ -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) {
u32 inst_ratio = 100;
u8 *x;
char *x;
if (start == stop || *start) return;
x = getenv("AFL_INST_RATIO");
if (x) inst_ratio = atoi(x);
if (x) inst_ratio = (u32)atoi(x);
if (!inst_ratio || inst_ratio > 100) {