Skip to content

Commit a4fde2d

Browse files
keith-packardhenrikbrixandersen
authored andcommitted
linker/xt-ld: Compute crtbegin/crtend paths in toolchain_linker_finalize
The computation of paths to crtbegin.o and crtend.o must be delayed until after the compiler_file_path function has been defined. The toolchain_linker_finalize function is where these are supposed to get set now. Signed-off-by: Keith Packard <[email protected]>
1 parent ad849de commit a4fde2d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cmake/linker/xt-ld/target.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ find_program(CMAKE_LINKER xt-ld ${LD_SEARCH_PATH})
1111

1212
set_ifndef(LINKERFLAGPREFIX -Wl)
1313

14-
compiler_file_path(crtbegin.o CRTBEGIN_PATH)
15-
compiler_file_path(crtend.o CRTEND_PATH)
1614
if(CONFIG_CPP_EXCEPTIONS AND CRTBEGIN_PATH AND CRTEND_PATH)
1715
# When building with C++ Exceptions, it is important that crtbegin and crtend
1816
# are linked at specific locations.
@@ -156,6 +154,10 @@ macro(toolchain_linker_finalize)
156154
set(CMAKE_ASM_LINK_EXECUTABLE "<CMAKE_ASM_COMPILER> <FLAGS> <CMAKE_ASM_LINK_FLAGS> ${common_link}")
157155
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> ${common_link}")
158156
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> ${common_link}")
157+
158+
compiler_file_path(crtbegin.o CRTBEGIN_PATH)
159+
compiler_file_path(crtend.o CRTEND_PATH)
160+
159161
endmacro()
160162

161163
# Function to map compiler flags into suitable linker flags

0 commit comments

Comments
 (0)