Skip to content

Commit 2996dfb

Browse files
jeff-openvpndsommers
authored andcommitted
Build with ASAN when requested
This commit will build with ASAN when the environment variable ASAN=1. Building with ASAN: - Add "-fsanitize=address" to enable ASAN checks - Add "-ggdb3" for higher-fidelity stack traces - Add "-fno-omit-frame-pointer" to maintain fp info on call stacks If both ASAN=1 and VAL=1, ASAN takes precedence. Signed-off-by: Jeff Lucovsky <[email protected]>
1 parent 5580e89 commit 2996dfb

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

scripts/build

+11-3
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ if [ -z "$1" ]; then
5151
echo " CITY=1 -- build with Cityhash hash library"
5252
echo " XXHASH=1 -- build with XXHash hash library"
5353
echo " CAP=1 -- build with libcap"
54-
echo " VAL=1 -- build with valgrind run-time extensions"
5554
echo " JAVA=1 -- build with JVM"
5655
echo ' EXTRA_CPP="foo1.cpp foo2.cpp" -- add extra .cpp files'
5756
echo " GTEST_DIR=<dir> -- specify googletest tree, required for building unit tests"
57+
echo " VAL=1 -- (optional) build with valgrind run-time extensions"
58+
echo " ASAN=1 -- (optional) enable ASAN run-time checks"
5859
echo " PCRE=1 -- build with PCRE library"
5960
for s in $(enum_build_extras) ; do
6061
. $s args
@@ -294,8 +295,15 @@ if [ "$PCRE" = "1" ]; then
294295
LIBS="$LIBS -lpcre"
295296
fi
296297

297-
# Valgrind
298-
if [ "$VAL" = "1" ]; then
298+
# ASAN requested -- ensure higher-fidelity stacks
299+
if [ "$ASAN" = "1" ]; then
300+
FLAGS+=" -ggdb3 -fno-omit-frame-pointer -fsanitize=address"
301+
else
302+
ASAN=
303+
fi
304+
305+
# Valgrind -- but only if ASAN is not enabled
306+
if [ "$ASAN" = "" -a "$VAL" = "1" ]; then
299307
CPPFLAGS="$CPPFLAGS -DHAVE_VALGRIND"
300308
fi
301309

0 commit comments

Comments
 (0)