1*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun# Enable available and selected UBSAN features. 4*4882a593Smuzhiyunubsan-cflags-$(CONFIG_UBSAN_ALIGNMENT) += -fsanitize=alignment 5*4882a593Smuzhiyunubsan-cflags-$(CONFIG_UBSAN_ONLY_BOUNDS) += -fsanitize=bounds 6*4882a593Smuzhiyunubsan-cflags-$(CONFIG_UBSAN_ARRAY_BOUNDS) += -fsanitize=array-bounds 7*4882a593Smuzhiyunubsan-cflags-$(CONFIG_UBSAN_LOCAL_BOUNDS) += -fsanitize=local-bounds 8*4882a593Smuzhiyunubsan-cflags-$(CONFIG_UBSAN_SHIFT) += -fsanitize=shift 9*4882a593Smuzhiyunubsan-cflags-$(CONFIG_UBSAN_DIV_ZERO) += -fsanitize=integer-divide-by-zero 10*4882a593Smuzhiyunubsan-cflags-$(CONFIG_UBSAN_UNREACHABLE) += -fsanitize=unreachable 11*4882a593Smuzhiyunubsan-cflags-$(CONFIG_UBSAN_BOOL) += -fsanitize=bool 12*4882a593Smuzhiyunubsan-cflags-$(CONFIG_UBSAN_ENUM) += -fsanitize=enum 13*4882a593Smuzhiyunubsan-cflags-$(CONFIG_UBSAN_TRAP) += -fsanitize-undefined-trap-on-error 14*4882a593Smuzhiyun 15*4882a593Smuzhiyunexport CFLAGS_UBSAN := $(ubsan-cflags-y) 16