icu,unrar: fix projects for fuzzintrospector (#7630)

* icu: fix for fuzz-introspector

* unrar: fix for fuzz-introspector
This commit is contained in:
DavidKorczynski 2022-04-27 15:22:19 +01:00 committed by GitHub
parent 44863db4c0
commit 78c29a183f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 13 deletions

View File

@ -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

View File

@ -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.