[master] c6b151d Fix sanitizer builds with gcc
Federico G. Schwindt
fgsch at lodoss.net
Mon Oct 23 04:20:07 UTC 2017
commit c6b151dfa0d86974c1d657817e38922cf26f4c82
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date: Sun Oct 22 21:05:40 2017 -0700
Fix sanitizer builds with gcc
diff --git a/bin/varnishd/hpack/vhp_gen_hufdec.c b/bin/varnishd/hpack/vhp_gen_hufdec.c
index 5f86440..bc62567 100644
--- a/bin/varnishd/hpack/vhp_gen_hufdec.c
+++ b/bin/varnishd/hpack/vhp_gen_hufdec.c
@@ -252,3 +252,11 @@ main(int argc, const char **argv)
return (0);
}
+
+#if defined(__SANITIZER)
+int __lsan_is_turned_off(void);
+int __lsan_is_turned_off()
+{
+ return (1);
+}
+#endif
diff --git a/bin/varnishd/mgt/mgt_param.c b/bin/varnishd/mgt/mgt_param.c
index 25b06df..9cb4900 100644
--- a/bin/varnishd/mgt/mgt_param.c
+++ b/bin/varnishd/mgt/mgt_param.c
@@ -510,7 +510,7 @@ MCF_InitParams(struct cli *cli)
low = sysconf(_SC_THREAD_STACK_MIN);
MCF_ParamConf(MCF_MINIMUM, "thread_pool_stack", "%jdb", (intmax_t)low);
-#if defined(WITH_SANITIZERS)
+#if defined(__SANITIZER)
def = 92 * 1024;
#else
def = 48 * 1024;
diff --git a/configure.ac b/configure.ac
index a6081a5..9d72283 100644
--- a/configure.ac
+++ b/configure.ac
@@ -267,8 +267,13 @@ AC_ARG_ENABLE(msan,
MSAN_FLAGS="-fsanitize=memory")
if test "x$UBSAN_FLAGS$TSAN_FLAGS$ASAN_FLAGS$MSAN_FLAGS" != "x"; then
- SAN_CFLAGS="-DWITH_SANITIZERS=1 ${UBSAN_FLAGS} ${TSAN_FLAGS} ${ASAN_FLAGS} ${MSAN_FLAGS} -fPIC -fPIE -fno-omit-frame-pointer"
+ SAN_CFLAGS="-D__SANITIZER=1 ${UBSAN_FLAGS} ${TSAN_FLAGS} ${ASAN_FLAGS} ${MSAN_FLAGS} -fPIC -fPIE -fno-omit-frame-pointer"
SAN_LDFLAGS="${UBSAN_FLAGS} ${TSAN_FLAGS} ${ASAN_FLAGS} ${MSAN_FLAGS} -pie"
+ case $CC in
+ gcc*)
+ SAN_CFLAGS="${SAN_CFLAGS} -fuse-ld=gold"
+ ;;
+ esac
fi
AC_SUBST(SAN_CFLAGS)
AC_SUBST(SAN_LDFLAGS)
More information about the varnish-commit
mailing list