From 78c29a183f9f4df5db7f841c21b85bfd3e0767cb Mon Sep 17 00:00:00 2001 From: DavidKorczynski Date: Wed, 27 Apr 2022 15:22:19 +0100 Subject: [PATCH] icu,unrar: fix projects for fuzzintrospector (#7630) * icu: fix for fuzz-introspector * unrar: fix for fuzz-introspector --- projects/icu/build.sh | 10 ++-------- projects/unrar/build.sh | 8 +++----- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/projects/icu/build.sh b/projects/icu/build.sh index d05907192..2d8e35323 100755 --- a/projects/icu/build.sh +++ b/projects/icu/build.sh @@ -16,12 +16,6 @@ # ################################################################################ -# Fuzz introspector uses LDFLAGS, so ensure LDFLAGS -# is always set for other sanitizer options. -if [ "$SANITIZER" != "introspector" ]; then - export LDFLAGS="" -fi - mkdir $WORK/icu cd $WORK/icu @@ -39,7 +33,7 @@ export UBSAN_OPTIONS="detect_leaks=0" make -j$(nproc) -$CXX $CXXFLAGS $LDFLAGS -std=c++11 -c $SRC/icu/icu4c/source/test/fuzzer/locale_util.cpp \ +$CXX $CXXFLAGS -std=c++11 -c $SRC/icu/icu4c/source/test/fuzzer/locale_util.cpp \ -I$SRC/icu4c/source/test/fuzzer FUZZER_PATH=$SRC/icu/icu4c/source/test/fuzzer @@ -48,7 +42,7 @@ FUZZERS=$FUZZER_PATH/*_fuzzer.cpp for fuzzer in $FUZZERS; do file=${fuzzer:${#FUZZER_PATH}+1} - $CXX $CXXFLAGS $LDFLAGS -std=c++11 \ + $CXX $CXXFLAGS -std=c++11 \ $fuzzer -o $OUT/${file/.cpp/} locale_util.o \ -I$SRC/icu/icu4c/source/common -I$SRC/icu/icu4c/source/i18n -L$WORK/icu/lib \ $LIB_FUZZING_ENGINE -licui18n -licuuc -licutu -licudata diff --git a/projects/unrar/build.sh b/projects/unrar/build.sh index e4f65811c..5d09a2f19 100644 --- a/projects/unrar/build.sh +++ b/projects/unrar/build.sh @@ -20,11 +20,9 @@ if [ "$SANITIZER" != "introspector" ]; then export LDFLAGS="" else - # We need to add -flto flags because the makefile in unrar does not + # We need to add -flto LDFLAGS because the makefile in unrar does not # pass cxxflags, which holds the -flto flag from fuzz-introspector. - # This should probably be updated in the future, namely, including - # -flto into LDFLAGS in OSS-Fuzz fuzz-introspector builds. - export LDFLAGS="${LDFLAGS} -flto" + export LDFLAGS="-flto" fi UNRAR_DEFINES="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DRAR_SMP -DRARDLL -DSILENT -DNOVOLUME" @@ -37,7 +35,7 @@ CXXFLAGS="$CXXFLAGS -fno-sanitize=enum" # build 'lib'. This builds libunrar.a and libunrar.so # -fPIC is required for successful compilation. -make CXX=$CXX LDFLAGS="$LDFLAGS" CXXFLAGS="$CXXFLAGS -fPIC $UNRAR_DEFINES $UNRAR_WNOS" \ +make CXX=$CXX LDFLAGS="${LDFLAGS}" CXXFLAGS="$CXXFLAGS -fPIC $UNRAR_DEFINES $UNRAR_WNOS" \ -C $UNRAR_SRC_DIR lib # remove the .so file so that the linker links unrar statically.