xref: /openbmc/linux/scripts/Makefile.kcsan (revision 17168f5c)
1dfd402a4SMarco Elver# SPDX-License-Identifier: GPL-2.0
2dfd402a4SMarco Elverifdef CONFIG_KCSAN
3dfd402a4SMarco Elver
417168f5cSMarco Elver# GCC and Clang accept backend options differently. Do not wrap in cc-option,
517168f5cSMarco Elver# because Clang accepts "--param" even if it is unused.
617168f5cSMarco Elverifdef CONFIG_CC_IS_CLANG
717168f5cSMarco Elvercc-param = -mllvm -$(1)
817168f5cSMarco Elverelse
917168f5cSMarco Elvercc-param = --param -$(1)
1017168f5cSMarco Elverendif
1117168f5cSMarco Elver
1217168f5cSMarco ElverCFLAGS_KCSAN := -fsanitize=thread \
1317168f5cSMarco Elver	$(call cc-option,$(call cc-param,tsan-instrument-func-entry-exit=0) -fno-optimize-sibling-calls)
14dfd402a4SMarco Elver
15dfd402a4SMarco Elverendif # CONFIG_KCSAN
16