From 4f7b144ef6d919ed46db5ff5f4b254a37036f593 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 10 Apr 2024 13:14:31 +0200 Subject: [PATCH] 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 --- arch/posix/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/posix/CMakeLists.txt b/arch/posix/CMakeLists.txt index 469e1876a08..7ce45f9ad9b 100644 --- a/arch/posix/CMakeLists.txt +++ b/arch/posix/CMakeLists.txt @@ -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})