Blame view

scripts/Makefile.kcsan 739 Bytes
dfd402a4c   Marco Elver   kcsan: Add Kernel...
1
  # SPDX-License-Identifier: GPL-2.0
17168f5c1   Marco Elver   kcsan: Avoid inse...
2
3
4
5
6
  # GCC and Clang accept backend options differently. Do not wrap in cc-option,
  # because Clang accepts "--param" even if it is unused.
  ifdef CONFIG_CC_IS_CLANG
  cc-param = -mllvm -$(1)
  else
e68dcd8ea   Marco Elver   kcsan: Re-add GCC...
7
  cc-param = --param $(1)
17168f5c1   Marco Elver   kcsan: Avoid inse...
8
  endif
75d75b7a4   Marco Elver   kcsan: Support di...
9
10
  # Keep most options here optional, to allow enabling more compilers if absence
  # of some options does not break KCSAN nor causes false positive reports.
bb2732112   Masahiro Yamada   kbuild: move CFLA...
11
  export CFLAGS_KCSAN := -fsanitize=thread \
75d75b7a4   Marco Elver   kcsan: Support di...
12
  	$(call cc-option,$(call cc-param,tsan-instrument-func-entry-exit=0) -fno-optimize-sibling-calls) \
14e2ac8de   Marco Elver   kcsan: Support co...
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))) \
75d75b7a4   Marco Elver   kcsan: Support di...
14
  	$(call cc-param,tsan-distinguish-volatile=1)