diff --git a/Makefile.am b/Makefile.am index 2a7a494c..4833ba66 100644 --- a/Makefile.am +++ b/Makefile.am @@ -366,6 +366,7 @@ EXTRA_DIST = \ test/asan/Makefile \ test/afl/compile/afl-compile-code-coverage.sh \ test/afl/compile/afl-compile.sh \ + test/afl/compile/fcns \ test/afl/doc/AFL_status_screen.png \ test/afl/README.md \ test/afl/fuzzing-wrappers/client-rc.sh \ diff --git a/test/afl/compile/afl-asan-compile.sh b/test/afl/compile/afl-asan-compile.sh index bac8971e..0122d0db 100755 --- a/test/afl/compile/afl-asan-compile.sh +++ b/test/afl/compile/afl-asan-compile.sh @@ -1,8 +1,13 @@ #!/bin/sh -x +. ./compile/fcns + +### set either afl-gcc or afl-clang (defaults to afl-gcc) +set_afl_cc + cd ../../ -AFL_USE_ASAN=1 CC=afl-gcc ./extras/apparmor/configure_args.sh --enable-afl-fuzzing --without-gpgme --enable-32bit-mode --enable-asan-support $@ +AFL_USE_ASAN=1 CC=$AFL_CC ./extras/apparmor/configure_args.sh --enable-afl-fuzzing --without-gpgme --enable-32bit-mode --enable-asan-support $@ if [ $? -ne 0 ] then diff --git a/test/afl/compile/afl-compile.sh b/test/afl/compile/afl-compile.sh index 990563a6..a31935b6 100755 --- a/test/afl/compile/afl-compile.sh +++ b/test/afl/compile/afl-compile.sh @@ -1,8 +1,13 @@ #!/bin/sh -x +. ./compile/fcns + +### set either afl-gcc or afl-clang (defaults to afl-gcc) +set_afl_cc + cd ../../ -CC=afl-gcc ./extras/apparmor/configure_args.sh --enable-afl-fuzzing $@ +CC=$AFL_CC ./extras/apparmor/configure_args.sh --enable-afl-fuzzing $@ if [ $? -ne 0 ] then diff --git a/test/afl/compile/fcns b/test/afl/compile/fcns new file mode 100644 index 00000000..ab8e112c --- /dev/null +++ b/test/afl/compile/fcns @@ -0,0 +1,11 @@ + +AFL_CC=afl-gcc + +set_afl_cc() { + $AFL_CC /dev/null 2>&1 | grep -q -i "On Apple systems.*wrapper for clang" + if [ $? -eq 0 ] + then + ### Need to switch to afl-clang + AFL_CC=afl-clang + fi +}