From b22ee5213ea61d733d36ea71c6ae984fcd929ba3 Mon Sep 17 00:00:00 2001 From: leisiji <2265215145@qq.com> Date: Fri, 5 Jun 2026 12:06:11 +0800 Subject: [PATCH] mm/kasan: Fix compile options applied to wrong target in SPLIT build In SPLIT build mode, nuttx_add_kernel_library(mm SPLIT) creates two targets: mm (system library) and kmm (kernel library). The compile options were being applied to the mm target via target_compile_options(mm ...), but the kasan instrumentation is compiled as part of the kmm target. Change target_compile_options(mm ...) to target_compile_options(kmm ...) so that FLAGS (including -fno-builtin and NO_LTO) are correctly applied to the kernel target where kasan code is compiled. Signed-off-by: leisiji <2265215145@qq.com> --- mm/kasan/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm/kasan/CMakeLists.txt b/mm/kasan/CMakeLists.txt index d33e1805fed..d802a55b1a4 100644 --- a/mm/kasan/CMakeLists.txt +++ b/mm/kasan/CMakeLists.txt @@ -34,4 +34,9 @@ if(CONFIG_MM_KASAN) endif() target_sources(mm PRIVATE ${SRCS}) -target_compile_options(mm PRIVATE ${FLAGS}) + +if(CONFIG_BUILD_FLAT) + target_compile_options(mm PRIVATE ${FLAGS}) +else() + target_compile_options(kmm PRIVATE ${FLAGS}) +endif()