Skip to content

Commit aa34a56

Browse files
axelnxptejlmand
authored andcommitted
[nrf fromtree] 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 <[email protected]> (cherry picked from commit 8413113)
1 parent 4212416 commit aa34a56

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmake/linker/ld/target.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ macro(toolchain_linker_finalize)
148148
endforeach()
149149
string(REPLACE ";" " " zephyr_std_libs "${zephyr_std_libs}")
150150

151-
set(link_libraries "<LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${zephyr_std_libs}")
151+
set(link_libraries "<OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${zephyr_std_libs}")
152152
set(common_link "<LINK_FLAGS> ${link_libraries}")
153153

154154
set(CMAKE_ASM_LINK_EXECUTABLE "<CMAKE_ASM_COMPILER> <FLAGS> <CMAKE_ASM_LINK_FLAGS> ${common_link}")

0 commit comments

Comments
 (0)