aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2020-02-21 09:11:47 -0800
committerRob Landley <rob@landley.net>2020-02-22 06:11:48 -0600
commitdc16c1161cf9dcc5153fcbe1b1649ad209f49a9e (patch)
tree59ca67ec61ff929e4caee5a5c8f39e4468b84a49 /scripts
parentf428c2cc6f3de4d88333ca3faf7ffb3ac6fe9ac1 (diff)
downloadtoybox-dc16c1161cf9dcc5153fcbe1b1649ad209f49a9e.tar.gz
Make ASAN=1 affect the HOSTCC-built tools too.
Bug: https://github.com/landley/toybox/issues/169
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/make.sh13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/make.sh b/scripts/make.sh
index 538ba121..e4333ba2 100755
--- a/scripts/make.sh
+++ b/scripts/make.sh
@@ -3,10 +3,15 @@
# 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"
+ echo "Enabling ASan..."
+ # Turn ASan on. Everything except -fsanitize=address is optional, but
+ # but effectively required for useful backtraces.
+ asan_flags="-fsanitize=address \
+ -O1 -g -fno-omit-frame-pointer -fno-optimize-sibling-calls"
+ CFLAGS="$asan_flags $CFLAGS"
+ HOSTCC="$HOSTCC $asan_flags"
+ # Ignore leaks on exit.
+ export ASAN_OPTIONS="detect_leaks=0"
fi
export LANG=c