Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / scripts / Makefile.kcsan
blob37cb504c77e136e6838a166d184978c4e5e0d97a
1 # SPDX-License-Identifier: GPL-2.0
2 # GCC and Clang accept backend options differently. Do not wrap in cc-option,
3 # because Clang accepts "--param" even if it is unused.
4 ifdef CONFIG_CC_IS_CLANG
5 cc-param = -mllvm -$(1)
6 else
7 cc-param = --param $(1)
8 endif
10 # Keep most options here optional, to allow enabling more compilers if absence
11 # of some options does not break KCSAN nor causes false positive reports.
12 export CFLAGS_KCSAN := -fsanitize=thread \
13         $(call cc-option,$(call cc-param,tsan-instrument-func-entry-exit=0) -fno-optimize-sibling-calls) \
14         $(call cc-option,$(call cc-param,tsan-compound-read-before-write=1),$(call cc-option,$(call cc-param,tsan-instrument-read-before-write=1))) \
15         $(call cc-param,tsan-distinguish-volatile=1)