define UBSan flags for SHARED_FLAGS to reuse it

This commit is contained in:
Daniel Micay 2022-01-16 11:50:55 -05:00
parent 189d3362d5
commit 705211ef49

View File

@ -30,6 +30,10 @@ ifeq ($(CONFIG_NATIVE),true)
SHARED_FLAGS += -march=native SHARED_FLAGS += -march=native
endif endif
ifeq ($(CONFIG_UBSAN),true)
SHARED_FLAGS += -fsanitize=undefined -fno-sanitize-recover=undefined
endif
CFLAGS := $(CFLAGS) -std=c17 $(SHARED_FLAGS) -Wmissing-prototypes CFLAGS := $(CFLAGS) -std=c17 $(SHARED_FLAGS) -Wmissing-prototypes
CXXFLAGS := $(CXXFLAGS) -std=c++17 -fsized-deallocation $(SHARED_FLAGS) CXXFLAGS := $(CXXFLAGS) -std=c++17 -fsized-deallocation $(SHARED_FLAGS)
LDFLAGS := $(LDFLAGS) -Wl,--as-needed,-z,defs,-z,relro,-z,now,-z,nodlopen,-z,text LDFLAGS := $(LDFLAGS) -Wl,--as-needed,-z,defs,-z,relro,-z,now,-z,nodlopen,-z,text
@ -48,11 +52,6 @@ endif
OBJECTS := $(addprefix $(OUT)/,$(OBJECTS)) OBJECTS := $(addprefix $(OUT)/,$(OBJECTS))
ifeq ($(CONFIG_UBSAN),true)
CFLAGS += -fsanitize=undefined -fno-sanitize-recover=undefined
CXXFLAGS += -fsanitize=undefined -fno-sanitize-recover=undefined
endif
ifeq (,$(filter $(CONFIG_SEAL_METADATA),true false)) ifeq (,$(filter $(CONFIG_SEAL_METADATA),true false))
$(error CONFIG_SEAL_METADATA must be true or false) $(error CONFIG_SEAL_METADATA must be true or false)
endif endif