Envoy: overriding CC and CXX when building in oss-fuzz (#6805)

* Envoy: overriding CC and CXX when building in oss-fuzz
Signed-off-by: Adi Suissa-Peleg <adip@google.com>
This commit is contained in:
Adi (Suissa) Peleg 2021-11-16 10:02:18 -05:00 committed by GitHub
parent 9fc819841f
commit bc9682e03a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -22,11 +22,18 @@ declare -r FUZZ_TARGET_QUERY='
declare -r OSS_FUZZ_TARGETS="$(bazel query "${FUZZ_TARGET_QUERY}" | sed 's/$/_oss_fuzz/')"
declare -r EXTRA_BAZEL_FLAGS="$(
if [ -n "$CC" ]; then
echo "--action_env=CC=${CC}"
fi
if [ -n "$CXX" ]; then
echo "--action_env=CXX=${CXX}"
fi
if [ "$SANITIZER" = "undefined" ]
then
# Bazel uses clang to link binary, which does not link clang_rt ubsan library for C++ automatically.
# See issue: https://github.com/bazelbuild/bazel/issues/8777
echo "--linkopt=\"$(find $(llvm-config --libdir) -name libclang_rt.ubsan_standalone_cxx-x86_64.a | head -1)\""
echo "--linkopt=$(find $(llvm-config --libdir) -name libclang_rt.ubsan_standalone_cxx-x86_64.a | head -1)"
echo "--linkopt=-fsanitize=undefined"
elif [ "$SANITIZER" = "address" ]
then
echo "--copt=-D__SANITIZE_ADDRESS__" "--copt=-DADDRESS_SANITIZER=1" "--linkopt=-fsanitize=address"