1# SPDX-License-Identifier: GPL-2.0
2#
3# Makefile for KernelMemorySanitizer (KMSAN).
4#
5#
6obj-y := core.o instrumentation.o init.o hooks.o report.o shadow.o
7
8KMSAN_SANITIZE := n
9KCOV_INSTRUMENT := n
10UBSAN_SANITIZE := n
11
12# Disable instrumentation of KMSAN runtime with other tools.
13CC_FLAGS_KMSAN_RUNTIME := -fno-stack-protector
14CC_FLAGS_KMSAN_RUNTIME += $(call cc-option,-fno-conserve-stack)
15CC_FLAGS_KMSAN_RUNTIME += -DDISABLE_BRANCH_PROFILING
16
17CFLAGS_REMOVE.o = $(CC_FLAGS_FTRACE)
18
19CFLAGS_core.o := $(CC_FLAGS_KMSAN_RUNTIME)
20CFLAGS_hooks.o := $(CC_FLAGS_KMSAN_RUNTIME)
21CFLAGS_init.o := $(CC_FLAGS_KMSAN_RUNTIME)
22CFLAGS_instrumentation.o := $(CC_FLAGS_KMSAN_RUNTIME)
23CFLAGS_report.o := $(CC_FLAGS_KMSAN_RUNTIME)
24CFLAGS_shadow.o := $(CC_FLAGS_KMSAN_RUNTIME)
25
26obj-$(CONFIG_KMSAN_KUNIT_TEST) += kmsan_test.o
27KMSAN_SANITIZE_kmsan_test.o := y
28CFLAGS_kmsan_test.o += $(call cc-disable-warning, uninitialized)
29