arch posix: When building for the native_simulator only link ASAN once

Only request the linker to link ASAN in the final stage, not
during the partial linking stage.
This fixes a link issue when building with llvm.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2024-04-10 13:14:31 +02:00 committed by Alberto Escolar
commit 4f7b144ef6

View file

@ -188,7 +188,9 @@ list(JOIN LLVM_SANITIZERS "," LLVM_SANITIZERS_ARG)
if(NOT ${LLVM_SANITIZERS_ARG} STREQUAL "")
set(LLVM_SANITIZERS_ARG "-fsanitize=${LLVM_SANITIZERS_ARG}")
zephyr_compile_options("${LLVM_SANITIZERS_ARG}")
zephyr_link_libraries("${LLVM_SANITIZERS_ARG}")
if (CONFIG_NATIVE_APPLICATION)
zephyr_link_libraries("${LLVM_SANITIZERS_ARG}")
endif()
target_link_options(native_simulator INTERFACE ${LLVM_SANITIZERS_ARG})
target_compile_options(native_simulator INTERFACE ${LLVM_SANITIZERS_ARG})