mirror of https://github.com/google/oss-fuzz.git
[infra] FUZZING_ENGINE to choose compile script (#128)
This commit is contained in:
parent
8156f1d7a1
commit
feff4b8a66
|
@ -23,12 +23,17 @@ ENV SANITIZER_FLAGS_undefined "-fsanitize=bool,signed-integer-overflow,shift,vpt
|
|||
|
||||
# Default sanitizer to use
|
||||
ENV SANITIZER="address"
|
||||
ENV FUZZING_ENGINE="libfuzzer"
|
||||
|
||||
ENV COV_FLAGS="-fsanitize-coverage=edge,indirect-calls,8bit-counters"
|
||||
ENV ASAN_OPTIONS="symbolize=1:detect_leaks=0"
|
||||
|
||||
ENV LIBFUZZER_LIB="/usr/lib/libFuzzingEngine.a"
|
||||
|
||||
# TODO: remove after tpm2 catchup
|
||||
ENV FUZZER_LDFLAGS ""
|
||||
|
||||
COPY coverage_report compile srcmap reproduce run just_run \
|
||||
COPY coverage_report compile compile_libfuzzer srcmap reproduce run just_run \
|
||||
/usr/local/bin/
|
||||
|
||||
WORKDIR $SRC
|
||||
|
|
|
@ -17,20 +17,12 @@
|
|||
|
||||
echo "---------------------------------------------------------------"
|
||||
|
||||
pushd . > /dev/null 2>&1
|
||||
|
||||
if [ -z "${SANITIZER_FLAGS+}" ]; then
|
||||
FLAGS_VAR="SANITIZER_FLAGS_${SANITIZER}"
|
||||
SANITIZER_FLAGS=$(echo ${!FLAGS_VAR})
|
||||
export SANITIZER_FLAGS=$(echo ${!FLAGS_VAR})
|
||||
fi
|
||||
|
||||
echo -n "Compiling libFuzzer into /usr/lib/libfuzzer.a ..."
|
||||
mkdir -p $WORK/libfuzzer
|
||||
cd $WORK/libfuzzer
|
||||
$CXX $CXXFLAGS -std=c++11 $SANITIZER_FLAGS -c $SRC/libfuzzer/*.cpp -I$SRC/libfuzzer
|
||||
ar ruv /usr/lib/libFuzzingEngine.a $WORK/libfuzzer/*.o > /dev/null 2>&1
|
||||
ln -s /usr/lib/libFuzzingEngine.a /usr/lib/libfuzzer.a
|
||||
echo " done."
|
||||
bash compile_${FUZZING_ENGINE}
|
||||
|
||||
export CFLAGS="$CFLAGS $SANITIZER_FLAGS $COV_FLAGS"
|
||||
export CXXFLAGS="$CFLAGS $CXXFLAGS_EXTRA"
|
||||
|
@ -42,5 +34,4 @@ echo "CXXFLAGS=$CXXFLAGS"
|
|||
|
||||
echo "---------------------------------------------------------------"
|
||||
|
||||
popd >/dev/null 2>&1
|
||||
bash -x $SRC/build.sh
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash -eu
|
||||
# Copyright 2016 Google Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
echo -n "Compiling libFuzzer into $LIBFUZZER_LIB ..."
|
||||
mkdir -p $WORK/libfuzzer
|
||||
cd $WORK/libfuzzer
|
||||
$CXX $CXXFLAGS -std=c++11 $SANITIZER_FLAGS -c $SRC/libfuzzer/*.cpp -I$SRC/libfuzzer
|
||||
ar r $LIBFUZZER_LIB $WORK/libfuzzer/*.o
|
||||
# TODO: remove once migration is complete
|
||||
ln -s $LIBFUZZER_LIB /usr/lib/libfuzzer.a
|
||||
rm -rf $WORK/libfuzzer
|
||||
echo " done."
|
Loading…
Reference in New Issue