aboutsummaryrefslogtreecommitdiff
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
parent8efcc9589bd61171ec1fe4f71c33e9df62b6005b (diff)
downloadbusybox-w32-43e56639c6739953d5a6686823bcd0d256512ea5.tar.gz
busybox-w32-43e56639c6739953d5a6686823bcd0d256512ea5.tar.bz2
busybox-w32-43e56639c6739953d5a6686823bcd0d256512ea5.zip
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>
-rw-r--r--Config.in10
-rw-r--r--Makefile.flags5
2 files changed, 15 insertions, 0 deletions
diff --git a/Config.in b/Config.in
index 07b4bf36b..0a0b5d7cb 100644
--- a/Config.in
+++ b/Config.in
@@ -688,6 +688,16 @@ config DEBUG_PESSIMIZE
688 in a much bigger executable that more closely matches the source 688 in a much bigger executable that more closely matches the source
689 code. 689 code.
690 690
691config DEBUG_SANITIZE
692 bool "Enable runtime sanitizers (ASAN/LSAN/USAN/etc...)"
693 default n
694 help
695 Say Y here if you want to enable runtime sanitizers. These help
696 catch bad memory accesses (e.g. buffer overflows), but will make
697 the executable larger and slow down runtime a bit.
698
699 If you aren't developing/testing busybox, say N here.
700
691config UNIT_TEST 701config UNIT_TEST
692 bool "Build unit tests" 702 bool "Build unit tests"
693 default n 703 default n
diff --git a/Makefile.flags b/Makefile.flags
index 9f77674ba..65021de25 100644
--- a/Makefile.flags
+++ b/Makefile.flags
@@ -75,6 +75,11 @@ else
75CFLAGS += $(call cc-option,-Os,$(call cc-option,-O2,)) 75CFLAGS += $(call cc-option,-Os,$(call cc-option,-O2,))
76endif 76endif
77endif 77endif
78ifeq ($(CONFIG_DEBUG_SANITIZE),y)
79CFLAGS += $(call cc-option,-fsanitize=address,)
80CFLAGS += $(call cc-option,-fsanitize=leak,)
81CFLAGS += $(call cc-option,-fsanitize=undefined,)
82endif
78 83
79# If arch/$(ARCH)/Makefile did not override it (with, say, -fPIC)... 84# If arch/$(ARCH)/Makefile did not override it (with, say, -fPIC)...
80ARCH_FPIC ?= -fpic 85ARCH_FPIC ?= -fpic