nuttx/mm: fix cmake kasan flags

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
This commit is contained in:
xuxingliang 2024-06-25 16:56:08 +08:00 committed by Xiang Xiao
parent 496e44db7f
commit 38010adc02
1 changed files with 15 additions and 5 deletions

View File

@ -22,11 +22,21 @@
set(SRCS hook.c) set(SRCS hook.c)
if(CONFIG_MM_KASAN) if(CONFIG_MM_KASAN)
list(APPEND SRCS generic.c) list(APPEND FLAGS -fno-builtin)
set_source_files_properties(generic.c PROPERTIES COMPILE_FLAGS if(CONFIG_MM_KASAN_GENERIC)
-fno-sanitize=kernel-address) list(APPEND SRCS generic.c)
set_source_files_properties(generic.c PROPERTIES COMPILE_FLAGS -fno-builtin) list(APPEND FLAGS -fno-sanitize=kernel-address)
set_source_files_properties(generic.c PROPERTIES COMPILE_FLAGS -fno-lto) endif()
if(CONFIG_MM_KASAN_SW_TAGS)
list(APPEND SRCS sw_tags.c)
list(APPEND FLAGS -fno-sanitize=kernel-hwaddress)
endif()
if(CONFIG_LTO_NONE)
list(APPEND FLAGS -fno-lto)
endif()
endif() endif()
target_sources(mm PRIVATE ${SRCS}) target_sources(mm PRIVATE ${SRCS})
target_compile_options(mm PRIVATE ${FLAGS})