Skip to content

cmake: linker: separate toolchain_ld_options() calls for grouped flags #91515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,10 @@ if(DEFINED TOOLCHAIN_LD_FLAGS)
zephyr_ld_options(${TOOLCHAIN_LD_FLAGS})
endif()

foreach(GROUPED_FLAGS IN LISTS TOOLCHAIN_GROUPED_LD_FLAGS)
zephyr_ld_options(NO_SPLIT ${${GROUPED_FLAGS}})
endforeach()

zephyr_link_libraries(PROPERTY base)

zephyr_link_libraries_ifndef(CONFIG_LINKER_USE_RELAX PROPERTY no_relax)
Expand Down
2 changes: 1 addition & 1 deletion cmake/compiler/clang/target_arm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ if(CONFIG_FP16)
endif()
endif()
list(APPEND TOOLCHAIN_C_FLAGS ${ARM_C_FLAGS})
list(APPEND TOOLCHAIN_LD_FLAGS NO_SPLIT ${ARM_C_FLAGS})
list(APPEND TOOLCHAIN_GROUPED_LD_FLAGS ARM_C_FLAGS)
2 changes: 1 addition & 1 deletion cmake/compiler/gcc/target_arm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if(CONFIG_THREAD_LOCAL_STORAGE)
endif()

list(APPEND TOOLCHAIN_C_FLAGS ${ARM_C_FLAGS})
list(APPEND TOOLCHAIN_LD_FLAGS NO_SPLIT ${ARM_C_FLAGS})
list(APPEND TOOLCHAIN_GROUPED_LD_FLAGS ARM_C_FLAGS)

# Flags not supported by llext linker
# (regexps are supported and match whole word)
Expand Down
10 changes: 3 additions & 7 deletions cmake/compiler/gcc/target_riscv.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,13 @@ if(NOT CONFIG_RISCV_ISA_EXT_M AND
string(CONCAT riscv_march ${riscv_march} "_zmmul")
endif()

list(APPEND TOOLCHAIN_C_FLAGS
-mabi=${riscv_mabi}
-march=${riscv_march}
-mcmodel=${riscv_mcmodel}
)

list(APPEND TOOLCHAIN_LD_FLAGS NO_SPLIT
list(APPEND RISCV_C_FLAGS
-mabi=${riscv_mabi}
-march=${riscv_march}
-mcmodel=${riscv_mcmodel}
)
list(APPEND TOOLCHAIN_C_FLAGS ${RISCV_C_FLAGS})
list(APPEND TOOLCHAIN_GROUPED_LD_FLAGS RISCV_C_FLAGS)

# Flags not supported by llext linker
# (regexps are supported and match whole word)
Expand Down