forked from luck/tmp_suning_uos_patched
e68dcd8eac
GCC version 11 recently implemented all requirements to correctly support KCSAN: 1. Correct no_sanitize-attribute inlining behaviour: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=4089df8ef4a63126b0774c39b6638845244c20d2 2. --param=tsan-distinguish-volatile https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=ab2789ec507a94f1a75a6534bca51c7b39037ce0 3. --param=tsan-instrument-func-entry-exit https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=06712fc68dc9843d9af7c7ac10047f49d305ad76 Therefore, we can re-enable GCC for KCSAN, and document the new compiler requirements. Signed-off-by: Marco Elver <elver@google.com> Cc: Martin Liska <mliska@suse.cz> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
20 lines
705 B
Makefile
20 lines
705 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
ifdef CONFIG_KCSAN
|
|
|
|
# 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
|
|
cc-param = --param $(1)
|
|
endif
|
|
|
|
# Keep most options here optional, to allow enabling more compilers if absence
|
|
# of some options does not break KCSAN nor causes false positive reports.
|
|
CFLAGS_KCSAN := -fsanitize=thread \
|
|
$(call cc-option,$(call cc-param,tsan-instrument-func-entry-exit=0) -fno-optimize-sibling-calls) \
|
|
$(call cc-option,$(call cc-param,tsan-instrument-read-before-write=1)) \
|
|
$(call cc-param,tsan-distinguish-volatile=1)
|
|
|
|
endif # CONFIG_KCSAN
|