aboutsummaryrefslogtreecommitdiff
path: root/Makefile.flags
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-02-12 22:12:47 -0500
committerMike Frysinger <vapier@gentoo.org>2016-02-12 22:12:47 -0500
commit43e56639c6739953d5a6686823bcd0d256512ea5 (patch)
tree65bf6cf13f2f366a7a8739cc3fb2f404dc473c07 /Makefile.flags
parent8efcc9589bd61171ec1fe4f71c33e9df62b6005b (diff)
downloadbusybox-43e56639c6739953d5a6686823bcd0d256512ea5.tar.gz
build: add a sanitizer debug option
Building & running with ASAN is super helpful, so add a dedicated config knob for it. This way people don't have to guess at the right compiler settings in order to get a good build. We can just tell people to enable this one option. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'Makefile.flags')
-rw-r--r--Makefile.flags5
1 files changed, 5 insertions, 0 deletions
diff --git a/Makefile.flags b/Makefile.flags
index 9f77674ba..65021de25 100644
--- a/Makefile.flags
+++ b/Makefile.flags
@@ -75,6 +75,11 @@ else
CFLAGS += $(call cc-option,-Os,$(call cc-option,-O2,))
endif
endif
+ifeq ($(CONFIG_DEBUG_SANITIZE),y)
+CFLAGS += $(call cc-option,-fsanitize=address,)
+CFLAGS += $(call cc-option,-fsanitize=leak,)
+CFLAGS += $(call cc-option,-fsanitize=undefined,)
+endif
# If arch/$(ARCH)/Makefile did not override it (with, say, -fPIC)...
ARCH_FPIC ?= -fpic