From 43e56639c6739953d5a6686823bcd0d256512ea5 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 12 Feb 2016 22:12:47 -0500 Subject: 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 --- Makefile.flags | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Makefile.flags') 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 -- cgit v1.2.3