For Clang debugging build, only pass selected UBSanitizer options.

This makes CLANG=1 RELEASE=0 DEBUGANYWAY=2 OPTLEVEL=1 builds definitely pretty
playable (only Polymost tested) while having a decent amount of sanitization.

git-svn-id: https://svn.eduke32.com/eduke32@4020 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-08-18 19:24:15 +00:00
parent ba4cfe704c
commit bac4265a0b
2 changed files with 7 additions and 9 deletions

View file

@ -335,6 +335,11 @@ endif
debug+= -O$(OPTLEVEL)
# See http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation
# for a list of possible UBSan options.
# Clang 3.2 does only supports -fsanitize=address for the AddressSanitizer
CLANG_DEBUG_FLAGS := -fsanitize=address -fsanitize=bounds,enum,float-cast-overflow,object-size
ifneq (0,$(RELEASE))
# Debugging disabled
ifeq (0,$(CLANG))
@ -366,13 +371,7 @@ else
endif
ifneq (0,$(CLANG))
# KEEPINSYNC with build/Makefile:
# Older Clang (2.9?)
# BASECFLAGS+= -Xclang -fcatch-undefined-behavior
# Clang 3.2
# debug+= -fsanitize=address
# Clang 3.3 or SVN
debug+= -fsanitize=address -fsanitize=undefined
debug+= $(CLANG_DEBUG_FLAGS)
endif
ifeq ($(SUBPLATFORM),LINUX)
BASELIBS+=-rdynamic

View file

@ -291,8 +291,7 @@ $(OBJ)/%.$o: $(SRC)/%.nasm
# Comment out the following rule to debug a-c.o
$(OBJ)/a-c.$o: $(SRC)/a-c.c
$(COMPILE_STATUS)
if $(COMPILER) $(subst -O$(OPTLEVEL),-O2,$(subst -fsanitize=address -fsanitize=undefined,,$(OURCFLAGS))) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
# KEEPINSYNC the Clang -f option(s) with Makefile.common
if $(COMPILER) $(subst -O$(OPTLEVEL),-O2,$(subst $(CLANG_DEBUG_FLAGS),,$(OURCFLAGS))) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
$(OBJ)/%.$o: $(SRC)/%.c
$(COMPILE_STATUS)