diff options
author | Elliott Hughes <enh@google.com> | 2019-07-28 22:12:35 -0700 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-07-29 04:14:36 -0500 |
commit | 71bdf7a5ac09e4b52265b782623071b1cc6d32d7 (patch) | |
tree | f91361a4139870fff4acf25794125ddd48f0c6a5 | |
parent | cde31cc6bbc32fc3c5405c63243697e1cdd21884 (diff) | |
download | toybox-71bdf7a5ac09e4b52265b782623071b1cc6d32d7.tar.gz |
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`.
-rwxr-xr-x | scripts/make.sh | 7 |
1 files changed, 7 insertions, 0 deletions
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 |