From 841311330b03d01c4b224b7031a21c6350390206 Mon Sep 17 00:00:00 2001 From: Axel Le Bourhis Date: Thu, 28 Nov 2024 19:48:15 +0100 Subject: [PATCH] cmake: linker: ld: fix duplicate LINK_FLAGS Original implementation of `toolchain_linker_finalize` duplicates the `LINK_FLAGS` in the link command. This can cause some problems like duplicate definitions when using link options like `--whole-archive`. This commit fixes it by removing the duplicate `LINK_FLAGS`. Fixes #82281 Signed-off-by: Axel Le Bourhis --- cmake/linker/ld/target.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/linker/ld/target.cmake b/cmake/linker/ld/target.cmake index bdeecd0b0b3..37a88b837c4 100644 --- a/cmake/linker/ld/target.cmake +++ b/cmake/linker/ld/target.cmake @@ -156,7 +156,7 @@ macro(toolchain_linker_finalize) endforeach() string(REPLACE ";" " " zephyr_std_libs "${zephyr_std_libs}") - set(link_libraries " -o ${zephyr_std_libs}") + set(link_libraries " -o ${zephyr_std_libs}") set(common_link " ${link_libraries}") set(CMAKE_ASM_LINK_EXECUTABLE " ${common_link}")