mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-23 04:34:11 +08:00
bb2732112b
Move CFLAGS_KASAN*, CFLAGS_UBSAN, CFLAGS_KCSAN to Makefile.kasan, Makefile.ubsan, Makefile.kcsan, respectively. This commit also avoids the same -fsanitize=* flags being added to CFLAGS_UBSAN multiple times. Prior to this commit, the ubsan flags were appended by the '+=' operator, without any initialization. Some build targets such as 'make bindeb-pkg' recurses to the top Makefile, and ended up with adding the same flags to CFLAGS_UBSAN twice. Clear CFLAGS_UBSAN with ':=' to make it a simply expanded variable. This is better than a recursively expanded variable, which evaluates $(call cc-option, ...) multiple times before Kbuild starts descending to subdirectories. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Marco Elver <elver@google.com>
16 lines
670 B
Makefile
16 lines
670 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
# 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.
|
|
export 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)
|