0001
0002
0003
0004 ifdef CONFIG_CC_IS_CLANG
0005 cc-param = -mllvm -$(1)
0006 else
0007 cc-param = --param $(1)
0008 endif
0009
0010
0011
0012 kcsan-cflags := -fsanitize=thread -fno-optimize-sibling-calls \
0013 $(call cc-option,$(call cc-param,tsan-compound-read-before-write=1),$(call cc-option,$(call cc-param,tsan-instrument-read-before-write=1))) \
0014 $(call cc-param,tsan-distinguish-volatile=1)
0015
0016 ifdef CONFIG_CC_IS_GCC
0017
0018
0019 kcsan-cflags += -Wno-tsan
0020 endif
0021
0022 ifndef CONFIG_KCSAN_WEAK_MEMORY
0023 kcsan-cflags += $(call cc-option,$(call cc-param,tsan-instrument-func-entry-exit=0))
0024 endif
0025
0026 export CFLAGS_KCSAN := $(kcsan-cflags)