This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 176e69e2a13b57f5f4813174b418e6c99d7fa541 Author: zhangyu117 <[email protected]> AuthorDate: Fri May 29 16:52:16 2026 +0800 arch/tricore: support kasan function Add the CONFIG_MM_KASAN_* compile options to the GCC cmake toolchain file (-fsanitize=kernel-address and the asan-globals / asan-instrument- reads / asan-instrument-writes params), and disable asan-stack and the call threshold in both cmake and make builds as the other architectures do. Signed-off-by: zhangyu117 <[email protected]> --- arch/tricore/src/cmake/gcc.cmake | 18 ++++++++++++++++++ arch/tricore/src/common/ToolchainGnuc.defs | 2 ++ 2 files changed, 20 insertions(+) diff --git a/arch/tricore/src/cmake/gcc.cmake b/arch/tricore/src/cmake/gcc.cmake index 95a00450446..f923771509b 100644 --- a/arch/tricore/src/cmake/gcc.cmake +++ b/arch/tricore/src/cmake/gcc.cmake @@ -147,6 +147,24 @@ endif() add_link_options(-Wl,--no-warn-rwx-segments) +if(CONFIG_MM_KASAN_INSTRUMENT_ALL) + add_compile_options(-fsanitize=kernel-address) + add_compile_options(--param=asan-stack=0) + add_compile_options(--param=asan-instrumentation-with-call-threshold=0) +endif() + +if(CONFIG_MM_KASAN_GLOBAL) + add_compile_options(--param=asan-globals=1) +endif() + +if(CONFIG_MM_KASAN_DISABLE_READS_CHECK) + add_compile_options(--param=asan-instrument-reads=0) +endif() + +if(CONFIG_MM_KASAN_DISABLE_WRITES_CHECK) + add_compile_options(--param=asan-instrument-writes=0) +endif() + add_compile_options(-Wno-attributes -Wno-unknown-pragmas $<$<COMPILE_LANGUAGE:C>:-Wstrict-prototypes>) diff --git a/arch/tricore/src/common/ToolchainGnuc.defs b/arch/tricore/src/common/ToolchainGnuc.defs index 106ab4d5b24..1f169cf061c 100644 --- a/arch/tricore/src/common/ToolchainGnuc.defs +++ b/arch/tricore/src/common/ToolchainGnuc.defs @@ -74,6 +74,8 @@ endif ifeq ($(CONFIG_MM_KASAN_INSTRUMENT_ALL),y) ARCHOPTIMIZATION += -fsanitize=kernel-address + ARCHOPTIMIZATION += --param asan-stack=0 + ARCHOPTIMIZATION += --param asan-instrumentation-with-call-threshold=0 endif ifeq ($(CONFIG_MM_KASAN_GLOBAL),y)
