aboutsummaryrefslogtreecommitdiffhomepage
path: root/projects
diff options
context:
space:
mode:
authorGravatar Lizan Zhou <lizan@tetrate.io>2019-08-07 08:41:47 -0700
committerGravatar Max Moroz <mmoroz@chromium.org>2019-08-07 08:41:47 -0700
commitbe1baac06a91b2a04453f79ae7f7c17ea0c856c6 (patch)
treee2f7bb65f3fcdba66c5a2212273c2e9b16c4ff59 /projects
parent40dbd8d101b469581e2370aecdb9942939b94385 (diff)
[envoy] fix ubsan build (#2664)
Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Diffstat (limited to 'projects')
-rwxr-xr-xprojects/envoy/build.sh12
1 files changed, 9 insertions, 3 deletions
diff --git a/projects/envoy/build.sh b/projects/envoy/build.sh
index 61ef0bfd..27ed9ddf 100755
--- a/projects/envoy/build.sh
+++ b/projects/envoy/build.sh
@@ -15,9 +15,8 @@
#
################################################################################
-# Disable UBSan vptr since target built with -fno-rtti.
-export CFLAGS="$CFLAGS -fno-sanitize=vptr"
-export CXXFLAGS="$CXXFLAGS -fno-sanitize=vptr"
+export CFLAGS="$CFLAGS"
+export CXXFLAGS="$CXXFLAGS"
declare -r FUZZER_TARGETS_CC=$(find . -name *_fuzz_test.cc)
declare -r FUZZER_TARGETS="$(for t in ${FUZZER_TARGETS_CC}; do echo "${t:2:-3}"; done)"
@@ -39,6 +38,13 @@ done
for f in ${CXXFLAGS}; do
echo "--cxxopt=${f}" "--linkopt=${f}"
done
+
+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)\""
+fi
)"
declare BAZEL_BUILD_TARGETS=""