Skip to content

Commit 8413113

Browse files
axelnxpfabiobaltieri
authored andcommitted
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 <axel.lebourhis@nxp.com>
1 parent 1a0c852 commit 8413113

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
@@ -156,7 +156,7 @@ macro(toolchain_linker_finalize)
156156
endforeach()
157157
string(REPLACE ";" " " zephyr_std_libs "${zephyr_std_libs}")
158158

159-
set(link_libraries "<LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${zephyr_std_libs}")
159+
set(link_libraries "<OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${zephyr_std_libs}")
160160
set(common_link "<LINK_FLAGS> ${link_libraries}")
161161

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

0 commit comments

Comments
 (0)