Skip to content

Commit 425ca67

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 566cf0b commit 425ca67

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,10 +991,15 @@ ifdef DEVELOPER
991991
CFLAGS += $(DEVELOPER_CFLAGS)
992992
endif
993993

994+
comma := ,
995+
empty :=
996+
space := $(empty) $(empty)
997+
994998
ifdef SANITIZE
999+
SANITIZERS := $(foreach flag,$(subst $(comma),$(space),$(SANITIZE)),$(flag))
9951000
BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE)
9961001
BASIC_CFLAGS += -fno-omit-frame-pointer
997-
ifeq ($(SANITIZE),undefined)
1002+
ifneq ($(filter undefined,$(SANITIZERS)),)
9981003
BASIC_CFLAGS += -DNO_UNALIGNED_LOADS
9991004
endif
10001005
endif

0 commit comments

Comments
 (0)