aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2019-08-27 12:45:25 -0500
committerRob Landley <rob@landley.net>2019-08-27 12:45:25 -0500
commitac84e8507983f9dee1df75bdd961a7dfd4f44b09 (patch)
tree9bca76daab48c023535bef968f3238fdebfe1884 /configure
parent0ec6b113985f4470e021f84b216c1b98e1e194ad (diff)
downloadtoybox-ac84e8507983f9dee1df75bdd961a7dfd4f44b09.tar.gz
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`.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure2
1 files changed, 2 insertions, 0 deletions
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" ]