1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0 2bb273211SMasahiro Yamada 3cdf8a76fSKees Cook# Enable available and selected UBSAN features. 4cdf8a76fSKees Cookubsan-cflags-$(CONFIG_UBSAN_ALIGNMENT) += -fsanitize=alignment 5*2d47c695SKees Cookubsan-cflags-$(CONFIG_UBSAN_BOUNDS_STRICT) += -fsanitize=bounds-strict 6cdf8a76fSKees Cookubsan-cflags-$(CONFIG_UBSAN_ARRAY_BOUNDS) += -fsanitize=array-bounds 7cdf8a76fSKees Cookubsan-cflags-$(CONFIG_UBSAN_LOCAL_BOUNDS) += -fsanitize=local-bounds 8cdf8a76fSKees Cookubsan-cflags-$(CONFIG_UBSAN_SHIFT) += -fsanitize=shift 9cdf8a76fSKees Cookubsan-cflags-$(CONFIG_UBSAN_DIV_ZERO) += -fsanitize=integer-divide-by-zero 10cdf8a76fSKees Cookubsan-cflags-$(CONFIG_UBSAN_UNREACHABLE) += -fsanitize=unreachable 11cdf8a76fSKees Cookubsan-cflags-$(CONFIG_UBSAN_BOOL) += -fsanitize=bool 12cdf8a76fSKees Cookubsan-cflags-$(CONFIG_UBSAN_ENUM) += -fsanitize=enum 13cdf8a76fSKees Cookubsan-cflags-$(CONFIG_UBSAN_TRAP) += -fsanitize-undefined-trap-on-error 14bb273211SMasahiro Yamada 15cdf8a76fSKees Cookexport CFLAGS_UBSAN := $(ubsan-cflags-y) 16