Marco Elver | dfd402a | 2019-11-14 19:02:54 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
Marco Elver | 17168f5 | 2020-05-21 16:20:38 +0200 | [diff] [blame] | 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 |
Marco Elver | e68dcd8 | 2020-06-18 11:31:16 +0200 | [diff] [blame] | 7 | cc-param = --param $(1) |
Marco Elver | 17168f5 | 2020-05-21 16:20:38 +0200 | [diff] [blame] | 8 | endif |
| 9 | |
Marco Elver | 75d75b7 | 2020-05-21 16:20:39 +0200 | [diff] [blame] | 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. |
Masahiro Yamada | bb27321 | 2020-09-10 22:44:29 +0900 | [diff] [blame] | 12 | export CFLAGS_KCSAN := -fsanitize=thread \ |
Marco Elver | 75d75b7 | 2020-05-21 16:20:39 +0200 | [diff] [blame] | 13 | $(call cc-option,$(call cc-param,tsan-instrument-func-entry-exit=0) -fno-optimize-sibling-calls) \ |
Marco Elver | 14e2ac8 | 2020-07-24 09:00:01 +0200 | [diff] [blame] | 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))) \ |
Marco Elver | 75d75b7 | 2020-05-21 16:20:39 +0200 | [diff] [blame] | 15 | $(call cc-param,tsan-distinguish-volatile=1) |