Skip to content

Commit 5c7c671

Browse files
committed
cmake: linker: separate toolchain_ld_options() calls for grouped flags
Fixes #91045 Adding NO_SPLIT in the TOOLCHAIN_LD_FLAGS list caused every flags in the list to be checked together by the linker. This caused issues where incompatible flags was passed together, and the result was that none was propagated to the linker. By using separate variables, we can achieve the initial goal of NO_SPLIT to only group a sub-set of flags. Signed-off-by: Pierrick Guillaume <pguillaume@fymyte.com>
1 parent cf0f00d commit 5c7c671

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,10 @@ if(DEFINED TOOLCHAIN_LD_FLAGS)
409409
zephyr_ld_options(${TOOLCHAIN_LD_FLAGS})
410410
endif()
411411

412+
foreach(GROUPED_FLAGS IN LISTS TOOLCHAIN_GROUPED_LD_FLAGS)
413+
zephyr_ld_options(NO_SPLIT ${${GROUPED_FLAGS}})
414+
endforeach()
415+
412416
zephyr_link_libraries(PROPERTY base)
413417

414418
zephyr_link_libraries_ifndef(CONFIG_LINKER_USE_RELAX PROPERTY no_relax)

cmake/compiler/clang/target_arm.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ if(CONFIG_FP16)
3939
endif()
4040
endif()
4141
list(APPEND TOOLCHAIN_C_FLAGS ${ARM_C_FLAGS})
42-
list(APPEND TOOLCHAIN_LD_FLAGS NO_SPLIT ${ARM_C_FLAGS})
42+
list(APPEND TOOLCHAIN_GROUPED_LD_FLAGS ARM_C_FLAGS)

cmake/compiler/gcc/target_arm.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ if(CONFIG_THREAD_LOCAL_STORAGE)
4545
endif()
4646

4747
list(APPEND TOOLCHAIN_C_FLAGS ${ARM_C_FLAGS})
48-
list(APPEND TOOLCHAIN_LD_FLAGS NO_SPLIT ${ARM_C_FLAGS})
48+
list(APPEND TOOLCHAIN_GROUPED_LD_FLAGS ARM_C_FLAGS)
4949

5050
# Flags not supported by llext linker
5151
# (regexps are supported and match whole word)

cmake/compiler/gcc/target_riscv.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ if(NOT CONFIG_RISCV_ISA_EXT_M AND
8989
endif()
9090

9191
list(APPEND TOOLCHAIN_C_FLAGS -mabi=${riscv_mabi} -march=${riscv_march})
92-
list(APPEND TOOLCHAIN_LD_FLAGS NO_SPLIT -mabi=${riscv_mabi} -march=${riscv_march})
92+
list(APPEND RISCV_LD_FLAGS -mabi=${riscv_mabi} -march=${riscv_march})
93+
list(APPEND TOOLCHAIN_GROUPED_LD_FLAGS RISCV_LD_FLAGS)
9394

9495
# Flags not supported by llext linker
9596
# (regexps are supported and match whole word)

0 commit comments

Comments
 (0)