From 8399a780d810beadf7a5cc3b34b7dfed9bb2bb6e Mon Sep 17 00:00:00 2001 From: Daniel Jasinski Date: Wed, 7 Aug 2024 15:22:01 -0400 Subject: [PATCH] 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 --- arch/sim/src/cmake/Toolchain.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/sim/src/cmake/Toolchain.cmake b/arch/sim/src/cmake/Toolchain.cmake index c787a9fe30..c1caedd3c6 100644 --- a/arch/sim/src/cmake/Toolchain.cmake +++ b/arch/sim/src/cmake/Toolchain.cmake @@ -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})