about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2020-01-17 16:39:53 +0100
committerAndrea Fioraldi <andreafioraldi@gmail.com>2020-01-17 16:39:53 +0100
commitf24135f1ed86443ead13c3b580a5d831d69662d3 (patch)
tree1068677530f616d5871c708d9983d16f7df14825
parent55e9297202d646cfe7da8d6c5eb6937952812569 (diff)
parent800d43b84666461cb682be20fdc5df48c13c252b (diff)
downloadafl++-f24135f1ed86443ead13c3b580a5d831d69662d3.tar.gz
Merge branch 'master' of github.com:vanhauser-thc/AFLplusplus
-rw-r--r--Makefile8
-rw-r--r--docs/ChangeLog1
-rw-r--r--include/config.h13
-rwxr-xr-xtest/test.sh2
4 files changed, 16 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 56b77999..703ed673 100644
--- a/Makefile
+++ b/Makefile
@@ -44,7 +44,11 @@ else
  endif
 endif
 
-CFLAGS     ?= -O3 -funroll-loops -march=native
+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
+
+CFLAGS     ?= -O3 -funroll-loops $(CFLAGS_OPT)
 CFLAGS     += -Wall -g -Wno-pointer-sign -I include/ \
               -DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
               -DDOC_PATH=\"$(DOC_PATH)\" -Wno-unused-function
@@ -253,7 +257,7 @@ radamsa: src/third_party/libradamsa/libradamsa.so
 	cp src/third_party/libradamsa/libradamsa.so .
 
 src/third_party/libradamsa/libradamsa.so: src/third_party/libradamsa/libradamsa.c src/third_party/libradamsa/radamsa.h
-	$(MAKE) -C src/third_party/libradamsa/
+	$(MAKE) -C src/third_party/libradamsa/ CFLAGS="$(CFLAGS)"
 
 afl-fuzz: include/afl-fuzz.h $(AFL_FUZZ_FILES) src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o $(COMM_HDR) | test_x86
 	$(CC) $(CFLAGS) $(CFLAGS_FLTO) $(AFL_FUZZ_FILES) src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o -o $@ $(PYFLAGS) $(LDFLAGS)
diff --git a/docs/ChangeLog b/docs/ChangeLog
index 594f75e9..5347d244 100644
--- a/docs/ChangeLog
+++ b/docs/ChangeLog
@@ -17,6 +17,7 @@ sending a mail to <afl-users+subscribe@googlegroups.com>.
 Version ++2.60d (develop):
 --------------------------
 
+  - use -march=native if available
   - afl-fuzz:
      - now prints the real python version support compiled in
      - set stronger performance compile options and little tweaks
diff --git a/include/config.h b/include/config.h
index 2c6ee707..429c57d2 100644
--- a/include/config.h
+++ b/include/config.h
@@ -61,12 +61,15 @@
 
 /* Default memory limit for child process (MB): */
 
-#ifndef WORD_SIZE_64
-#define MEM_LIMIT 25
+#ifndef __NetBSD__
+# ifndef WORD_SIZE_64
+#  define MEM_LIMIT 25
+# else
+#  define MEM_LIMIT 50
+# endif                                                    /* ^!WORD_SIZE_64 */
 #else
-#define MEM_LIMIT 50
-#endif                                                    /* ^!WORD_SIZE_64 */
-
+# define MEM_LIMIT 200
+#endif
 /* Default memory limit when running in QEMU mode (MB): */
 
 #define MEM_LIMIT_QEMU 200
diff --git a/test/test.sh b/test/test.sh
index c763e91f..8f40773c 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -158,7 +158,7 @@ test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" && {
        CODE=1
        ;;
     esac
-    ../afl-tmin -m200 -i in/in2 -o in2/in2 -- ./test-instr.plain > /dev/null 2>&1
+    ../afl-tmin -i in/in2 -o in2/in2 -- ./test-instr.plain > /dev/null 2>&1
     SIZE=`ls -l in2/in2 2> /dev/null | awk '{print$5}'`
     test "$SIZE" = 1 && $ECHO "$GREEN[+] afl-tmin correctly minimized the testcase"
     test "$SIZE" = 1 || {