build: Fix Toolchain.cmake for CONFIG_SIM_ASAN enabled

This commit adds missing add_link_options to specify sanitizers
also during linking stage.

Signed-off-by: Daniel Jasinski <jasinskidaniel95szcz@gmail.com>
This commit is contained in:
Daniel Jasinski 2024-08-07 15:22:01 -04:00 committed by Xiang Xiao
parent 77cfbf8914
commit 8399a780d8
1 changed files with 2 additions and 0 deletions

View File

@ -78,12 +78,14 @@ if(CONFIG_SIM_ASAN)
add_compile_options(-fsanitize-address-use-after-scope)
add_compile_options(-fsanitize=pointer-compare)
add_compile_options(-fsanitize=pointer-subtract)
add_link_options(-fsanitize=address)
elseif(CONFIG_MM_KASAN_ALL)
add_compile_options(-fsanitize=kernel-address)
endif()
if(CONFIG_SIM_UBSAN)
add_compile_options(-fsanitize=undefined)
add_link_options(-fsanitize=undefined)
else()
if(CONFIG_MM_UBSAN_ALL)
add_compile_options(${CONFIG_MM_UBSAN_OPTION})