xref: /linux/mm/kmsan/Makefile (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
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
17# Disable ftrace to avoid recursion.
18CFLAGS_REMOVE_core.o = $(CC_FLAGS_FTRACE)
19CFLAGS_REMOVE_hooks.o = $(CC_FLAGS_FTRACE)
20CFLAGS_REMOVE_init.o = $(CC_FLAGS_FTRACE)
21CFLAGS_REMOVE_instrumentation.o = $(CC_FLAGS_FTRACE)
22CFLAGS_REMOVE_report.o = $(CC_FLAGS_FTRACE)
23CFLAGS_REMOVE_shadow.o = $(CC_FLAGS_FTRACE)
24
25CFLAGS_core.o := $(CC_FLAGS_KMSAN_RUNTIME)
26CFLAGS_hooks.o := $(CC_FLAGS_KMSAN_RUNTIME)
27CFLAGS_init.o := $(CC_FLAGS_KMSAN_RUNTIME)
28CFLAGS_instrumentation.o := $(CC_FLAGS_KMSAN_RUNTIME)
29CFLAGS_report.o := $(CC_FLAGS_KMSAN_RUNTIME)
30CFLAGS_shadow.o := $(CC_FLAGS_KMSAN_RUNTIME)
31
32obj-$(CONFIG_KMSAN_KUNIT_TEST) += kmsan_test.o
33KMSAN_SANITIZE_kmsan_test.o := y
34CFLAGS_kmsan_test.o += $(call cc-disable-warning, uninitialized)
35