This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 8399a780d8 build: Fix Toolchain.cmake for CONFIG_SIM_ASAN enabled
8399a780d8 is described below

commit 8399a780d810beadf7a5cc3b34b7dfed9bb2bb6e
Author: Daniel Jasinski <[email protected]>
AuthorDate: Wed Aug 7 15:22:01 2024 -0400

    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 <[email protected]>
---
 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})

Reply via email to