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 <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe 2017-07-15 19:18:56 +02:00 коммит произвёл Junio C Hamano
Родитель 566cf0b3bd
Коммит 425ca6710b
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -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