diff --git a/CONFIG b/CONFIG index ef86055252..d87b869356 100644 --- a/CONFIG +++ b/CONFIG @@ -43,6 +43,9 @@ CONFIG_COVERAGE?=n # Build with Address Sanitizer enabled CONFIG_ASAN?=n +# Build with Undefined Behavior Sanitizer enabled +CONFIG_UBSAN?=n + # Directory that contains the desired SPDK environment library. # By default, this is implemented using DPDK. CONFIG_ENV?=$(SPDK_ROOT_DIR)/lib/env_dpdk diff --git a/mk/spdk.common.mk b/mk/spdk.common.mk index 2abcbf0eba..c43c415547 100644 --- a/mk/spdk.common.mk +++ b/mk/spdk.common.mk @@ -100,6 +100,11 @@ COMMON_CFLAGS += -fsanitize=address LDFLAGS += -fsanitize=address endif +ifeq ($(CONFIG_UBSAN),y) +COMMON_CFLAGS += -fsanitize=undefined +LDFLAGS += -fsanitize=undefined +endif + COMMON_CFLAGS += -pthread LDFLAGS += -pthread