add configuration option for testing with UBSan

This commit is contained in:
Daniel Micay 2018-10-14 18:58:54 -04:00
parent 535466fdfd
commit d728afae8e

View File

@ -1,4 +1,5 @@
CONFIG_CXX_ALLOCATOR := true CONFIG_CXX_ALLOCATOR := true
CONFIG_UBSAN := false
CPPFLAGS := -D_GNU_SOURCE CPPFLAGS := -D_GNU_SOURCE
SHARED_FLAGS := -O2 -flto -fPIC -fvisibility=hidden -fno-plt -pipe -Wall -Wextra SHARED_FLAGS := -O2 -flto -fPIC -fvisibility=hidden -fno-plt -pipe -Wall -Wextra
@ -16,6 +17,11 @@ ifeq ($(CONFIG_CXX_ALLOCATOR),true)
OBJECTS += new.o OBJECTS += new.o
endif endif
ifeq ($(CONFIG_UBSAN),true)
CFLAGS += -fsanitize=undefined
CXXFLAGS += -fsanitize=undefined
endif
hardened_malloc.so: $(OBJECTS) hardened_malloc.so: $(OBJECTS)
$(CC) $(CFLAGS) $(LDFLAGS) -shared $^ $(LDLIBS) -o $@ $(CC) $(CFLAGS) $(LDFLAGS) -shared $^ $(LDLIBS) -o $@