mirror of https://github.com/google/oss-fuzz.git
[infra] removing FUZZER_LDFLAGS (fixes #73)
Workarounds libc++abi issue by folding libc++abi.a into libc++.a. Will keep FUZZER_LDFLAGS empty for a while until tpm2 is fixed.
This commit is contained in:
parent
5018d81c62
commit
487e9f4ed6
|
@ -105,8 +105,7 @@ make -j$(nproc) clean all
|
|||
# build the fuzzer, linking with libFuzzer and libexpat.a
|
||||
$CXX $CXXFLAGS -std=c++11 -Ilib/ \
|
||||
$SRC/parse_fuzzer.cc -o /out/expat_parse_fuzzer \
|
||||
-lfuzzer .libs/libexpat.a \
|
||||
$FUZZER_LDFLAGS
|
||||
-lfuzzer .libs/libexpat.a
|
||||
```
|
||||
|
||||
### build.sh Script Environment
|
||||
|
@ -125,7 +124,6 @@ These flags are provided in following environment variables:
|
|||
| ------------- | --------
|
||||
| `$CC`, `$CXX`, `$CCC` | The C and C++ compiler binaries.
|
||||
| `$CFLAGS`, `$CXXFLAGS` | C and C++ compiler flags.
|
||||
| `$FUZZER_LDFLAGS` | Linker flags for fuzzer binaries.
|
||||
|
||||
Many well-crafted build scripts will automatically use these variables. If not,
|
||||
passing them manually to a build tool might be required.
|
||||
|
|
|
@ -26,15 +26,23 @@ cd $SRC/llvm/projects && git clone --depth 1 http://llvm.org/git/libcxx.git
|
|||
cd $SRC/llvm/projects && git clone --depth 1 http://llvm.org/git/libcxxabi.git
|
||||
|
||||
# Build & Install
|
||||
mkdir -p /work/llvm
|
||||
cd /work/llvm
|
||||
mkdir -p $WORK/llvm
|
||||
cd $WORK/llvm
|
||||
cmake -G "Ninja" \
|
||||
-DLIBCXX_ENABLE_SHARED=OFF -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" \
|
||||
$SRC/llvm
|
||||
ninja
|
||||
ninja install
|
||||
rm -rf /work/llvm
|
||||
rm -rf $WORK/llvm
|
||||
|
||||
# Merge libc++abi.a into libc++.a
|
||||
# https://llvm.org/bugs/show_bug.cgi?id=30919
|
||||
mkdir $WORK/libcxx
|
||||
cd $WORK/libcxx
|
||||
ar -x /usr/local/lib/libc++abi.a
|
||||
ar -q /usr/local/lib/libc++.a *.o
|
||||
rm -rf $WORK/libcxx
|
||||
|
||||
# Copy libfuzzer sources
|
||||
mkdir $SRC/libfuzzer
|
||||
|
|
|
@ -21,7 +21,7 @@ RUN apt-get install -y git subversion jq zip python3
|
|||
ENV SANITIZER_FLAGS="-fsanitize=address"
|
||||
ENV COV_FLAGS="-fsanitize-coverage=edge,indirect-calls,8bit-counters"
|
||||
ENV ASAN_OPTIONS="symbolize=1:detect_leaks=0"
|
||||
ENV FUZZER_LDFLAGS "-Wl,-whole-archive /usr/local/lib/libc++.a /usr/local/lib/libc++abi.a -Wl,-no-whole-archive"
|
||||
ENV FUZZER_LDFLAGS ""
|
||||
|
||||
COPY coverage_report compile srcmap reproduce run just_run test \
|
||||
/usr/local/bin/
|
||||
|
|
|
@ -38,7 +38,6 @@ These flags are provided in following environment variables:
|
|||
| `$CXX`, `$CCC` | The C++ compiler binary.
|
||||
| `$CFLAGS` | C compiler flags.
|
||||
| `$CXXFLAGS` | C++ compiler flags.
|
||||
| `$FUZZER_LDFLAGS` | Linker flags for fuzzer binaries.
|
||||
|
||||
Many well-crafted build scripts will automatically use these variables. If not,
|
||||
passing them manually to a build tool might be required.
|
||||
|
|
|
@ -33,7 +33,6 @@ echo "CC=$CC"
|
|||
echo "CXX=$CXX"
|
||||
echo "CFLAGS=$CFLAGS"
|
||||
echo "CXXFLAGS=$CXXFLAGS"
|
||||
echo "FUZZER_LDFLAGS=$FUZZER_LDFLAGS"
|
||||
|
||||
echo "---------------------------------------------------------------"
|
||||
|
||||
|
|
|
@ -93,5 +93,5 @@ BUILD_TEMPLATE = """\
|
|||
# e.g.
|
||||
# $CXX $CXXFLAGS -std=c++11 -Iinclude \\
|
||||
# /path/to/name_of_fuzzer.cc -o /out/name_of_fuzzer \\
|
||||
# -lfuzzer /path/to/library.a $FUZZER_LDFLAGS
|
||||
# -lfuzzer /path/to/library.a
|
||||
"""
|
||||
|
|
|
@ -20,11 +20,9 @@ cd $WORK/boringssl
|
|||
|
||||
CFLAGS="$CFLAGS -DBORINGSSL_UNSAFE_FUZZER_MODE"
|
||||
CXXFLAGS="$CXXFLAGS -DBORINGSSL_UNSAFE_FUZZER_MODE"
|
||||
export LDFLAGS=$FUZZER_LDFLAGS
|
||||
|
||||
cmake -GNinja -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \
|
||||
-DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="$FUZZER_LDFLAGS" \
|
||||
$SRC/boringssl/
|
||||
ninja
|
||||
|
||||
|
@ -35,7 +33,7 @@ find . -name "*.a"
|
|||
for F in $fuzzerFiles; do
|
||||
fuzzerName=$(basename $F .cc)
|
||||
echo "Building fuzzer $fuzzerName"
|
||||
$CXX $CXXFLAGS $FUZZER_LDFLAGS -std=c++11 \
|
||||
$CXX $CXXFLAGS -std=c++11 \
|
||||
-o $OUT/${fuzzerName} -lfuzzer $F \
|
||||
-I $SRC/boringssl/include ./ssl/libssl.a ./crypto/libcrypto.a
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
export LDFLAGS="$FUZZER_LDFLAGS"
|
||||
|
||||
# Build the target.
|
||||
./buildconf
|
||||
./configure
|
||||
|
@ -27,4 +25,4 @@ make CFLAGS= -j$(nproc) all
|
|||
$CXX $CXXFLAGS -std=c++11 -I. \
|
||||
$SRC/c_ares_ares_create_query_fuzzer.cc \
|
||||
-o $OUT/c_ares_ares_create_query_fuzzer \
|
||||
-lfuzzer $SRC/c-ares/.libs/libcares.a $FUZZER_LDFLAGS
|
||||
-lfuzzer $SRC/c-ares/.libs/libcares.a
|
||||
|
|
|
@ -18,5 +18,5 @@
|
|||
./buildconf
|
||||
./configure --disable-shared --enable-debug --enable-maintainer-mode --disable-symbol-hiding --disable-threaded-resolver --enable-ipv6 --with-random=/dev/null
|
||||
make -j$(nproc)
|
||||
$CXX $CXXFLAGS $SRC/curl_fuzzer.cc -Iinclude lib/.libs/libcurl.a -lssl -lcrypto -lz -lfuzzer -o $OUT/curl_fuzzer $FUZZER_LDFLAGS
|
||||
$CXX $CXXFLAGS $SRC/curl_fuzzer.cc -Iinclude lib/.libs/libcurl.a -lssl -lcrypto -lz -lfuzzer -o $OUT/curl_fuzzer
|
||||
cp $SRC/*.dict $SRC/*.options $OUT/
|
||||
|
|
|
@ -22,6 +22,6 @@ make -j$(nproc) all
|
|||
|
||||
$CXX $CXXFLAGS -std=c++11 -Ilib/ \
|
||||
$SRC/parse_fuzzer.cc -o $OUT/parse_fuzzer \
|
||||
-lfuzzer .libs/libexpat.a $FUZZER_LDFLAGS
|
||||
-lfuzzer .libs/libexpat.a
|
||||
|
||||
cp $SRC/*.dict $SRC/*.options $OUT/
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
export LDFLAGS="$FUZZER_LDFLAGS"
|
||||
|
||||
# Build dependencies.
|
||||
export FFMPEG_DEPS_PATH=$SRC/ffmpeg_deps
|
||||
mkdir -p $FFMPEG_DEPS_PATH
|
||||
|
@ -130,7 +128,6 @@ cd $SRC/x265/build/linux
|
|||
cmake -G "Unix Makefiles" \
|
||||
-DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \
|
||||
-DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="$FUZZER_LDFLAGS" \
|
||||
-DCMAKE_INSTALL_PREFIX="$FFMPEG_DEPS_PATH" -DENABLE_SHARED:bool=off \
|
||||
../../source
|
||||
make clean
|
||||
|
@ -175,7 +172,7 @@ cd $SRC/ffmpeg
|
|||
export TEMP_VAR_CODEC="AV_CODEC_ID_H264"
|
||||
export TEMP_VAR_CODEC_TYPE="VIDEO"
|
||||
|
||||
FFMPEG_FUZZERS_COMMON_FLAGS="-lfuzzer $FUZZER_LDFLAGS \
|
||||
FFMPEG_FUZZERS_COMMON_FLAGS="-lfuzzer \
|
||||
-L$FFMPEG_DEPS_PATH/lib \
|
||||
-Llibavcodec -Llibavdevice -Llibavfilter -Llibavformat -Llibavresample \
|
||||
-Llibavutil -Llibpostproc -Llibswscale -Llibswresample \
|
||||
|
|
|
@ -21,7 +21,7 @@ make V=1 all
|
|||
|
||||
$CXX $CXXFLAGS -std=c++11 -Isrc/ \
|
||||
$SRC/magic_fuzzer.cc -o $OUT/magic_fuzzer \
|
||||
-lfuzzer ./src/.libs/libmagic.a $FUZZER_LDFLAGS
|
||||
-lfuzzer ./src/.libs/libmagic.a
|
||||
|
||||
cp ./magic/magic.mgc $OUT/
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
./configure
|
||||
make -j$(nproc) clean all
|
||||
|
||||
$CXX $CXXFLAGS $FUZZER_LDFLAGS -std=c++11 \
|
||||
$CXX $CXXFLAGS -std=c++11 \
|
||||
-I./include -I. \
|
||||
./src/tools/ftfuzzer/ftfuzzer.cc -o $OUT/ftfuzzer \
|
||||
./objs/*.o -lfuzzer \
|
||||
|
|
|
@ -17,10 +17,9 @@
|
|||
|
||||
# Build the library.
|
||||
./autogen.sh
|
||||
export LDFLAGS=$FUZZER_LDFLAGS
|
||||
./configure
|
||||
make -j$(nproc) clean all
|
||||
|
||||
$CXX $CXXFLAGS -std=c++11 -Isrc \
|
||||
$SRC/harfbuzz_fuzzer.cc -o $OUT/harfbuzz_fuzzer \
|
||||
-lfuzzer src/.libs/*.o src/hb-ucdn/.libs/*.o $FUZZER_LDFLAGS
|
||||
-lfuzzer src/.libs/*.o src/hb-ucdn/.libs/*.o
|
||||
|
|
|
@ -24,7 +24,7 @@ DEFINES="-DU_CHARSET_IS_UTF8=1 -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DU
|
|||
CFLAGS="$CFLAGS $DEFINES"
|
||||
CXXFLAGS="$CXXFLAGS $DEFINES"
|
||||
|
||||
CFLAGS=$CFLAGS CXXFLAGS=$CXXFLAGS CC=$CC CXX=$CXX LDFLAGS=$FUZZER_LDFLAGS \
|
||||
CFLAGS=$CFLAGS CXXFLAGS=$CXXFLAGS CC=$CC CXX=$CXX \
|
||||
/bin/bash $SRC/icu/source/runConfigureICU Linux \
|
||||
--with-library-bits=64 --with-data-packaging=static --enable-static --disable-shared
|
||||
|
||||
|
@ -42,7 +42,7 @@ for fuzzer in $FUZZERS; do
|
|||
$CXX $CXXFLAGS -std=c++11 \
|
||||
$SRC/$fuzzer.cc -o $OUT/$fuzzer \
|
||||
-I$SRC/icu/source/common -I$SRC/icu/source/i18n -L$WORK/icu/lib \
|
||||
-lfuzzer -licui18n -licuuc -licutu -licudata $FUZZER_LDFLAGS
|
||||
-lfuzzer -licui18n -licuuc -licutu -licudata
|
||||
done
|
||||
|
||||
cp $SRC/*.dict $SRC/*.options $OUT/
|
||||
|
|
|
@ -17,6 +17,6 @@
|
|||
|
||||
$CXX $CXXFLAGS -std=c++11 -Isrc/ \
|
||||
$SRC/parse_fuzzer.cc -o $OUT/parse_fuzzer \
|
||||
-lfuzzer $FUZZER_LDFLAGS
|
||||
-lfuzzer
|
||||
|
||||
cp $SRC/*.options $OUT/
|
||||
|
|
|
@ -24,7 +24,7 @@ FUZZERS="cmsIT8_load_fuzzer cms_transform_fuzzer"
|
|||
for F in $FUZZERS; do
|
||||
$CC $CFLAGS -Iinclude \
|
||||
$SRC/$F.c -o $OUT/$F \
|
||||
-lfuzzer src/.libs/liblcms2.a $FUZZER_LDFLAGS
|
||||
-lfuzzer src/.libs/liblcms2.a
|
||||
done
|
||||
|
||||
cp $SRC/icc.dict $SRC/*.options $OUT/
|
||||
|
|
|
@ -23,5 +23,5 @@ make -j$(nproc) all
|
|||
# build your fuzzer(s)
|
||||
$CXX $CXXFLAGS -Ilibarchive \
|
||||
$SRC/libarchive_fuzzer.cc -o $OUT/libarchive_fuzzer \
|
||||
-lfuzzer .libs/libarchive.a $FUZZER_LDFLAGS \
|
||||
-lfuzzer .libs/libarchive.a \
|
||||
-lbz2 -llzo2 -llzma -lxml2 -lz -lcrypto -llz4
|
||||
|
|
|
@ -30,7 +30,6 @@ make -j$(nproc)
|
|||
$CXX $CXXFLAGS -std=c++11 -I$SRC/libass \
|
||||
$SRC/libass_fuzzer.cc -o $OUT/libass_fuzzer \
|
||||
-lfuzzer libass/.libs/libass.a \
|
||||
-Wl,-Bstatic -lfontconfig -lfribidi -lfreetype -lz -lpng12 -lexpat -Wl,-Bdynamic \
|
||||
$FUZZER_LDFLAGS
|
||||
-Wl,-Bstatic -lfontconfig -lfribidi -lfreetype -lz -lpng12 -lexpat
|
||||
|
||||
cp $SRC/*.dict $SRC/*.options $OUT/
|
||||
|
|
|
@ -29,7 +29,7 @@ for variant in default random_init dynamic_config; do
|
|||
-o $OUT/chewing_${variant}_fuzzer \
|
||||
$SRC/chewing_${variant}_fuzzer.c $SRC/chewing_fuzzer_common.c \
|
||||
test/stress.o test/.libs/libtesthelper.a src/.libs/libchewing.a \
|
||||
-lfuzzer $FUZZER_LDFLAGS
|
||||
-lfuzzer
|
||||
done
|
||||
|
||||
# install data files
|
||||
|
|
|
@ -21,6 +21,6 @@ make "-j$(nproc)"
|
|||
|
||||
$CXX $CXXFLAGS -std=c++11 -I. \
|
||||
$SRC/libjpeg_turbo_fuzzer.cc -o $OUT/libjpeg_turbo_fuzzer \
|
||||
-lfuzzer ./.libs/libturbojpeg.a $FUZZER_LDFLAGS
|
||||
-lfuzzer ./.libs/libturbojpeg.a
|
||||
|
||||
cp $SRC/libjpeg_turbo_fuzzer_seed_corpus.zip $OUT/
|
||||
|
|
|
@ -28,6 +28,6 @@ make -j$(nproc) clean all
|
|||
# build libpng_read_fuzzer
|
||||
$CXX $CXXFLAGS -std=c++11 -I. -lz \
|
||||
$SRC/libpng_read_fuzzer.cc -o $OUT/libpng_read_fuzzer \
|
||||
-lfuzzer .libs/libpng16.a $FUZZER_LDFLAGS
|
||||
-lfuzzer .libs/libpng16.a
|
||||
|
||||
cp $SRC/*.dict $SRC/*.options $OUT/
|
||||
|
|
|
@ -23,4 +23,4 @@ CFLAGS="$CFLAGS -D__unused=" pmake -C teken/libteken libteken.a
|
|||
$CC $CFLAGS -Iteken \
|
||||
-o $OUT/libteken_fuzzer \
|
||||
libteken_fuzzer.c \
|
||||
-lfuzzer teken/libteken/libteken.a $FUZZER_LDFLAGS
|
||||
-lfuzzer teken/libteken/libteken.a
|
||||
|
|
|
@ -24,4 +24,4 @@ $CC $CFLAGS -Isrc/tsm \
|
|||
-o $OUT/libtsm_fuzzer \
|
||||
$SRC/libtsm_fuzzer.c \
|
||||
.libs/libtsm.a \
|
||||
-lfuzzer $FUZZER_LDFLAGS
|
||||
-lfuzzer
|
||||
|
|
|
@ -23,7 +23,7 @@ make -j$(nproc) clean all
|
|||
for fuzzer in libxml2_xml_read_memory_fuzzer libxml2_xml_regexp_compile_fuzzer; do
|
||||
$CXX $CXXFLAGS -std=c++11 -Iinclude/ \
|
||||
$SRC/$fuzzer.cc -o $OUT/$fuzzer \
|
||||
-lfuzzer .libs/libxml2.a $FUZZER_LDFLAGS
|
||||
-lfuzzer .libs/libxml2.a
|
||||
done
|
||||
|
||||
cp $SRC/*.dict $SRC/*.options $OUT/
|
||||
|
|
|
@ -57,7 +57,7 @@ for fuzzer in $FUZZERS; do
|
|||
-lfuzzer \
|
||||
$WORK/nss/lib/libnss.a $WORK/nss/lib/libnssutil.a \
|
||||
$WORK/nss/lib/libnspr4.a $WORK/nss/lib/libplc4.a $WORK/nss/lib/libplds4.a \
|
||||
$WORK/nss/lib/prlog2.o -o $OUT/$fuzzer $FUZZER_LDFLAGS
|
||||
$WORK/nss/lib/prlog2.o -o $OUT/$fuzzer
|
||||
done
|
||||
|
||||
# Archive and copy to $OUT seed corpus if the build succeeded.
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
################################################################################
|
||||
|
||||
./config enable-fuzz-libfuzzer -DPEDANTIC no-shared --with-fuzzer-lib=/usr/lib/libfuzzer $CFLAGS
|
||||
make -j$(nproc) EX_LIBS="-ldl $FUZZER_LDFLAGS"
|
||||
make -j$(nproc) EX_LIBS="-ldl"
|
||||
|
||||
fuzzers=$(find fuzz -executable -type f '!' -name \*.py '!' -name \*-test)
|
||||
for f in $fuzzers; do
|
||||
|
|
|
@ -19,14 +19,12 @@
|
|||
./autogen.sh
|
||||
./configure
|
||||
|
||||
#export LDFLAGS=$FUZZER_LDFLAGS
|
||||
make libots.a libwoff2.a libbrotli.a
|
||||
|
||||
# Build the fuzzer.
|
||||
$CXX $CXXFLAGS -std=c++11 -Iinclude \
|
||||
$SRC/ots_fuzzer.cc -o $OUT/ots_fuzzer \
|
||||
-lfuzzer -lz $SRC/ots/libots.a $SRC/ots/libwoff2.a $SRC/ots/libbrotli.a \
|
||||
$FUZZER_LDFLAGS
|
||||
-lfuzzer -lz $SRC/ots/libots.a $SRC/ots/libwoff2.a $SRC/ots/libbrotli.a
|
||||
|
||||
cp $SRC/ots_fuzzer.options $OUT/
|
||||
zip $OUT/ots_fuzzer_seed_corpus.zip $SRC/seed_corpus/*
|
||||
|
|
|
@ -24,5 +24,4 @@ make -j$(nproc) clean all
|
|||
|
||||
# Build the target.
|
||||
$CXX $CXXFLAGS -o $OUT/pcre2_fuzzer \
|
||||
-lfuzzer .libs/libpcre2-fuzzsupport.a .libs/libpcre2-8.a \
|
||||
$FUZZER_LDFLAGS
|
||||
-lfuzzer .libs/libpcre2-fuzzsupport.a .libs/libpcre2-8.a
|
||||
|
|
|
@ -30,6 +30,6 @@ make -j$(nproc) obj/libre2.a
|
|||
# Second, build our fuzzers.
|
||||
$CXX $CXXFLAGS -std=c++11 -I. \
|
||||
$SRC/re2_fuzzer.cc -o $OUT/re2_fuzzer \
|
||||
-lfuzzer ./obj/libre2.a $FUZZER_LDFLAGS
|
||||
-lfuzzer ./obj/libre2.a
|
||||
|
||||
cp $SRC/*.options $OUT/
|
||||
|
|
|
@ -29,7 +29,7 @@ make sqlite3.c
|
|||
|
||||
$CC $CFLAGS -I. \
|
||||
$SRC/sqlite3/test/ossfuzz.c -o $OUT/ossfuzz \
|
||||
-lfuzzer ./sqlite3.o $FUZZER_LDFLAGS
|
||||
-lfuzzer ./sqlite3.o
|
||||
|
||||
cp $SRC/*.options $SRC/*.dict $SRC/*.zip $OUT/
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ cat Makefile | sed -e "s/-no-canonical-prefixes//" \
|
|||
mv Makefile.temp Makefile
|
||||
|
||||
# woff2 uses LFLAGS instead of LDFLAGS.
|
||||
export LFLAGS=$FUZZER_LDFLAGS
|
||||
make -j$(nproc) CC="$CC $CFLAGS" CXX="$CXX $CXXFLAGS" clean all
|
||||
|
||||
# To avoid multiple main() definitions.
|
||||
|
@ -36,6 +35,6 @@ rm src/woff2_compress.o src/woff2_decompress.o
|
|||
fuzzer=convert_woff2ttf_fuzzer
|
||||
$CXX $CXXFLAGS -std=c++11 -Isrc \
|
||||
$SRC/$fuzzer.cc -o $OUT/$fuzzer \
|
||||
-lfuzzer src/*.o brotli/dec/*.o brotli/enc/*.o $FUZZER_LDFLAGS
|
||||
-lfuzzer src/*.o brotli/dec/*.o brotli/enc/*.o
|
||||
|
||||
cp $SRC/*.options $OUT/
|
||||
|
|
|
@ -5,4 +5,4 @@ make -j$(nproc) clean all
|
|||
|
||||
$CXX $CXXFLAGS -std=c++11 -I. \
|
||||
$SRC/zlib_uncompress_fuzzer.cc -o $OUT/zlib_uncompress_fuzzer \
|
||||
-lfuzzer ./libz.a $FUZZER_LDFLAGS
|
||||
-lfuzzer ./libz.a
|
||||
|
|
Loading…
Reference in New Issue