From ac84e8507983f9dee1df75bdd961a7dfd4f44b09 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 27 Aug 2019 12:45:25 -0500 Subject: Add ASAN=1 to the build, in a slightly different way than Elliott suggested. I put it in configure, with the other environment variables, instead of in scripts/make.sh. Here's Elliott's original commit comment: ========== 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`. --- configure | 2 ++ 1 file changed, 2 insertions(+) (limited to 'configure') diff --git a/configure b/configure index 06d7cbab..e386cc3a 100755 --- a/configure +++ b/configure @@ -20,6 +20,8 @@ fi # Required for our expected ABI. we're 8-bit clean thus "char" must be unsigned. CFLAGS="$CFLAGS -funsigned-char" [ -z "$OPTIMIZE" ] && OPTIMIZE="-Os -ffunction-sections -fdata-sections -fno-asynchronous-unwind-tables -fno-strict-aliasing" +# set ASAN=1 to enable "address sanitizer" and debuggable backtraces +[ -z "$ASAN" ] || CFLAGS="$CFLAGS -O1 -g -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=address" # We accept LDFLAGS, but by default don't have anything in it if [ "$(uname)" != "Darwin" ] -- cgit v1.2.3