From 425ca6710b207f36ca0dfd28cc28b5f360355bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 15 Jul 2017 19:18:56 +0200 Subject: Makefile: allow combining UBSan with other sanitizers Multiple sanitizers can be specified as a comma-separated list. Set the flag NO_UNALIGNED_LOADS even if UndefinedBehaviorSanitizer is not the only sanitizer to build with. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 852dedc25..d3ba23fdd 100644 --- a/Makefile +++ b/Makefile @@ -991,10 +991,15 @@ ifdef DEVELOPER CFLAGS += $(DEVELOPER_CFLAGS) endif +comma := , +empty := +space := $(empty) $(empty) + ifdef SANITIZE +SANITIZERS := $(foreach flag,$(subst $(comma),$(space),$(SANITIZE)),$(flag)) BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE) BASIC_CFLAGS += -fno-omit-frame-pointer -ifeq ($(SANITIZE),undefined) +ifneq ($(filter undefined,$(SANITIZERS)),) BASIC_CFLAGS += -DNO_UNALIGNED_LOADS endif endif -- cgit v1.2.1