[AFL] Improve builds of AFL package. (#1386)

Improve builds of AFL package.

Silence trivial known compile warning when building afl-llvm-rt.o.c
Also, don't build afl-fuzz using CFLAGS and CXXFLAGS since we don't
actually want to sanitize it.

This should cause AFL to be built with -O3 -funroll-loops (the defaults) instead of -fsanitize=... -O1 and -ginline-tables-only.
This commit is contained in:
jonathanmetzman 2018-04-30 13:17:13 -07:00 committed by GitHub
parent 93e8f3561e
commit 3971aef60d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 2 deletions

View File

@ -22,15 +22,26 @@ export COVERAGE_FLAGS="-fsanitize-coverage=trace-pc-guard"
mkdir -p $WORK/afl
pushd $WORK/afl > /dev/null
$CC $CFLAGS -c $SRC/afl/llvm_mode/afl-llvm-rt.o.c
# Add -Wno-pointer-sign to silence warning (AFL is compiled this way).
$CC $CFLAGS -Wno-pointer-sign -c $SRC/afl/llvm_mode/afl-llvm-rt.o.c
$CXX $CXXFLAGS -std=c++11 -O2 -c $SRC/libfuzzer/afl/*.cpp -I$SRC/libfuzzer
ar r $LIB_FUZZING_ENGINE $WORK/afl/*.o
popd > /dev/null
rm -rf $WORK/afl
# Copy afl tools necessary for fuzzing.
# Build and copy afl tools necessary for fuzzing.
pushd $SRC/afl > /dev/null
# Unset CFLAGS and CXXFLAGS while building AFL since we don't want to slow it
# down with sanitizers.
INITIAL_CXXFLAGS=$CXXFLAGS
INITIAL_CFLAGS=$CFLAGS
unset CXXFLAGS
unset CFLAGS
make clean && make
CFLAGS=$INITIAL_CFLAGS
CXXFLAGS=$INITIAL_CXXFLAGS
find . -name 'afl-*' -executable -type f | xargs cp -t $OUT
popd > /dev/null