Bug: https://github.com/landley/toybox/issues/169
---
 scripts/make.sh | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
From 56c7d9bed4d0f731925705f6fd17640efd6fe48a Mon Sep 17 00:00:00 2001
From: Elliott Hughes <[email protected]>
Date: Fri, 21 Feb 2020 09:11:47 -0800
Subject: [PATCH] Make ASAN=1 affect the HOSTCC-built tools too.

Bug: https://github.com/landley/toybox/issues/169
---
 scripts/make.sh | 13 +++++++++----
 1 file 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
-- 
2.25.0.265.gbab2e86ba0-goog

_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to