# e.g.
# $CXX $CXXFLAGS -std=c++11 -Iinclude \
# /path/to/name_of_fuzzer.cc -o $OUT/name_of_fuzzer \
-# $LIB_FUZZING_ENGINE /path/to/library.a
+# -fsanitize=fuzzer /path/to/library.a
fatal () {
echo "Error : ${*}, exiting."
cd $OSS_FUZZ_BUILD_DIR || fatal "cd $OSS_FUZZ_BUILD_DIR failed"
-if [ -z ${LIB_FUZZING_ENGINE+x} ]; then
- LIB_FUZZING_ENGINE="-fsanitize=fuzzer"
-fi
-
if [ -z ${OUT+x} ]; then
DEST_DIR=$(realpath "./DEST_DIR")
else
mkdir -p "$DEST_DIR/lib/" # Copy the shared libraries here
# Build once to get the list of dynamic lib paths, and copy them over
-../configure --disable-werror --cc="$CC" --cxx="$CXX" \
+../configure --disable-werror --cc="$CC" --cxx="$CXX" --enable-fuzzing \
--extra-cflags="$EXTRA_CFLAGS" --target-list="i386-softmmu"
-if ! make CONFIG_FUZZ=y CFLAGS="$LIB_FUZZING_ENGINE" "-j$(nproc)" \
- i386-softmmu/fuzz; then
+if ! make "-j$(nproc)" i386-softmmu/fuzz; then
fatal "Build failed. Please specify a compiler with fuzzing support"\
- "using the \$CC and \$CXX environemnt variables, or specify a"\
- "\$LIB_FUZZING_ENGINE compatible with your compiler"\
+ "using the \$CC and \$CXX environemnt variables"\
"\nFor example: CC=clang CXX=clang++ $0"
fi
../configure --bindir="$DEST_DIR" --datadir="$DEST_DIR/data/" --disable-werror \
--cc="$CC" --cxx="$CXX" --extra-cflags="$EXTRA_CFLAGS" \
--extra-ldflags="-Wl,-rpath,'\$\$ORIGIN/lib'"
-make CONFIG_FUZZ=y CFLAGS="$LIB_FUZZING_ENGINE" "-j$(nproc)" i386-softmmu/fuzz
+make "-j$(nproc)" i386-softmmu/fuzz
# Copy over the datadir
cp -r ../pc-bios/ "$DEST_DIR/pc-bios"