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>
This commit is contained in:
leisiji 2026-06-05 12:06:11 +08:00 committed by Xiang Xiao
parent 9c10bbd04a
commit 14e434c3f0

View file

@ -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()