xref: /openbmc/linux/scripts/Makefile.kcsan (revision 17168f5c)
1# SPDX-License-Identifier: GPL-2.0
2ifdef CONFIG_KCSAN
3
4# GCC and Clang accept backend options differently. Do not wrap in cc-option,
5# because Clang accepts "--param" even if it is unused.
6ifdef CONFIG_CC_IS_CLANG
7cc-param = -mllvm -$(1)
8else
9cc-param = --param -$(1)
10endif
11
12CFLAGS_KCSAN := -fsanitize=thread \
13	$(call cc-option,$(call cc-param,tsan-instrument-func-entry-exit=0) -fno-optimize-sibling-calls)
14
15endif # CONFIG_KCSAN
16