From 71bdf7a5ac09e4b52265b782623071b1cc6d32d7 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Sun, 28 Jul 2019 22:12:35 -0700 Subject: Add ASAN=1 to the build system. Just use `ASAN=1 make test_grep` or whatever. You'll probably want to set $ASAN_SYMBOLIZER_PATH to point to llvm-symbolizer, but Debian makes that annoying by calling the symbolizer /usr/bin/llvm-symbolizer-4.0 or whatever, and ASan refuses to use it: ==43370==ERROR: External symbolizer path is set to '/usr/bin/llvm-symbolizer-4.0' which isn't a known symbolizer. Please set the path to the llvm-symbolizer binary or other known tool. My usual workaround for this is to drop an llvm-symbolizer symlink in the current directory, and I'm happy to automate that in the script to make it require no knowledge of any of this nonsense, but haven't done so in this initial patch. I tested that this is actually working by reverting the grep fix and running `ASAN=1 make test_grep`. --- scripts/make.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'scripts') diff --git a/scripts/make.sh b/scripts/make.sh index 2a78844d..540199b6 100755 --- a/scripts/make.sh +++ b/scripts/make.sh @@ -2,6 +2,13 @@ # Grab default values for $CFLAGS and such. +if [ ! -z "$ASAN" ]; then + # Turn ASan on. + CFLAGS="-fsanitize=address $CFLAGS" + # Optional, but effectively necessary if you want useful backtraces. + CFLAGS="-O1 -g -fno-omit-frame-pointer -fno-optimize-sibling-calls $CFLAGS" +fi + export LANG=c export LC_ALL=C set -o pipefail -- cgit v1.2.3