^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) # SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) # Enable available and selected UBSAN features.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) ubsan-cflags-$(CONFIG_UBSAN_ALIGNMENT) += -fsanitize=alignment
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) ubsan-cflags-$(CONFIG_UBSAN_ONLY_BOUNDS) += -fsanitize=bounds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) ubsan-cflags-$(CONFIG_UBSAN_ARRAY_BOUNDS) += -fsanitize=array-bounds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) ubsan-cflags-$(CONFIG_UBSAN_LOCAL_BOUNDS) += -fsanitize=local-bounds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) ubsan-cflags-$(CONFIG_UBSAN_SHIFT) += -fsanitize=shift
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) ubsan-cflags-$(CONFIG_UBSAN_DIV_ZERO) += -fsanitize=integer-divide-by-zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) ubsan-cflags-$(CONFIG_UBSAN_UNREACHABLE) += -fsanitize=unreachable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) ubsan-cflags-$(CONFIG_UBSAN_OBJECT_SIZE) += -fsanitize=object-size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) ubsan-cflags-$(CONFIG_UBSAN_BOOL) += -fsanitize=bool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) ubsan-cflags-$(CONFIG_UBSAN_ENUM) += -fsanitize=enum
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) ubsan-cflags-$(CONFIG_UBSAN_TRAP) += -fsanitize-undefined-trap-on-error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) export CFLAGS_UBSAN := $(ubsan-cflags-y)