dfd402a4c4baa (Marco Elver 2019-11-14 19:02:54 +0100 1) # SPDX-License-Identifier: GPL-2.0
17168f5c1bef4 (Marco Elver 2020-05-21 16:20:38 +0200 2) # GCC and Clang accept backend options differently. Do not wrap in cc-option,
17168f5c1bef4 (Marco Elver 2020-05-21 16:20:38 +0200 3) # because Clang accepts "--param" even if it is unused.
17168f5c1bef4 (Marco Elver 2020-05-21 16:20:38 +0200 4) ifdef CONFIG_CC_IS_CLANG
17168f5c1bef4 (Marco Elver 2020-05-21 16:20:38 +0200 5) cc-param = -mllvm -$(1)
17168f5c1bef4 (Marco Elver 2020-05-21 16:20:38 +0200 6) else
e68dcd8eac63c (Marco Elver 2020-06-18 11:31:16 +0200 7) cc-param = --param $(1)
17168f5c1bef4 (Marco Elver 2020-05-21 16:20:38 +0200 8) endif
17168f5c1bef4 (Marco Elver 2020-05-21 16:20:38 +0200 9)
75d75b7a4d548 (Marco Elver 2020-05-21 16:20:39 +0200 10) # Keep most options here optional, to allow enabling more compilers if absence
75d75b7a4d548 (Marco Elver 2020-05-21 16:20:39 +0200 11) # of some options does not break KCSAN nor causes false positive reports.
bb2732112bc52 (Masahiro Yamada 2020-09-10 22:44:29 +0900 12) export CFLAGS_KCSAN := -fsanitize=thread \
75d75b7a4d548 (Marco Elver 2020-05-21 16:20:39 +0200 13) $(call cc-option,$(call cc-param,tsan-instrument-func-entry-exit=0) -fno-optimize-sibling-calls) \
14e2ac8de0f91 (Marco Elver 2020-07-24 09:00:01 +0200 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))) \
75d75b7a4d548 (Marco Elver 2020-05-21 16:20:39 +0200 15) $(call cc-param,tsan-distinguish-volatile=1)