]>
Commit | Line | Data |
---|---|---|
dfd402a4 | 1 | # SPDX-License-Identifier: GPL-2.0 |
17168f5c ME |
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 | |
e68dcd8e | 7 | cc-param = --param $(1) |
17168f5c ME |
8 | endif |
9 | ||
75d75b7a ME |
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. | |
69562e49 | 12 | kcsan-cflags := -fsanitize=thread -fno-optimize-sibling-calls \ |
14e2ac8d | 13 | $(call cc-option,$(call cc-param,tsan-compound-read-before-write=1),$(call cc-option,$(call cc-param,tsan-instrument-read-before-write=1))) \ |
75d75b7a | 14 | $(call cc-param,tsan-distinguish-volatile=1) |
69562e49 | 15 | |
116af35e ME |
16 | ifdef CONFIG_CC_IS_GCC |
17 | # GCC started warning about operations unsupported by the TSan runtime. But | |
18 | # KCSAN != TSan, so just ignore these warnings. | |
19 | kcsan-cflags += -Wno-tsan | |
20 | endif | |
21 | ||
69562e49 ME |
22 | ifndef CONFIG_KCSAN_WEAK_MEMORY |
23 | kcsan-cflags += $(call cc-option,$(call cc-param,tsan-instrument-func-entry-exit=0)) | |
24 | endif | |
25 | ||
26 | export CFLAGS_KCSAN := $(kcsan-cflags) |