zephyr/cmake/modules
Torsten Rasmussen 2e3873adde cmake: improve Zephyr link phase
Zephyr is a bare metal build where standard libs are disabled.

This means that c and runtime libraries must manually be linked in.

This has generally been handled by using CMake's link libraries handling
but the issue with that is both de-duplication but also library link
order.

Standard libraries must be linked at last location to ensure symbols
are always available, however this is not optimal with
target_link_libraries() because this would ultimately require every
library to know the c library to link with, which is not desired.

Therefore, setup standard C and runtime library linking in linker
CMake files for toolchains where this is required.

This commit expands the principle introduced with toolchain abstraction,
see PR#24851.

This means that a toolchain implementation may specify standard C,
runtime, C++, etc libraries, as well as their link order.
Because a property approach is used, then Zephyr modules, such as the
Picolibc module can adjust such properties.

An optional `zephyr_linker_finalize()` macro is called at the end of
Zephyr's CMakeList process and can be used by the toolchain
implementation to define the final linker invocation.

This aligns the linker handling flow to the principle introduced in
PR#24851 and improves the flexibility and robustness of Zephyr build
system.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-10-04 16:34:35 +01:00
..
arch_v1.cmake hwmv2: Introduce Hardware model version 2 and convert devices 2024-03-02 16:56:33 -05:00
arch_v2.cmake hwmv2: Introduce Hardware model version 2 and convert devices 2024-03-02 16:56:33 -05:00
basic_settings.cmake sysbuild: Use UTF-8 encoding for cache 2024-06-13 05:31:50 -04:00
boards.cmake doc: cmake: fix cmake config documentation 2024-06-10 00:59:50 -07:00
ccache.cmake
configuration_files.cmake cmake: use zephyr_get() and zephyr_file() for APPLICATION_CONFIG_DIR 2024-05-30 08:59:25 +02:00
doc.cmake
dts.cmake cmake: modules: dts: fix in/out docs 2024-10-03 11:40:09 +01:00
extensions.cmake cmake: improve Zephyr link phase 2024-10-04 16:34:35 +01:00
Findarmclang.cmake
FindBabbleSim.cmake nrf5_bsim cmake: Check that the simulator version is new enough 2024-03-19 21:18:13 -05:00
FindDeprecated.cmake cmake: add toolchain_ld_<name> macros to FindDeprecated 2024-09-16 20:18:17 +02:00
FindDtc.cmake
FindGnuLd.cmake cmake: Normalize GNULD_LINKER variable 2024-04-16 16:38:35 -07:00
FindHostTools.cmake hwmv2: Introduce Hardware model version 2 and convert devices 2024-03-02 16:56:33 -05:00
FindLlvmLld.cmake
FindoneApi.cmake
FindScaTools.cmake
FindTargetTools.cmake cmake: improve Zephyr link phase 2024-10-04 16:34:35 +01:00
FindThreads.cmake cmake: modules: fix FindThreads use of deprecated PTHREAD config 2024-06-20 17:03:57 -04:00
FindZephyr-sdk.cmake cmake: support list mode in Zephyr-sdk module package 2024-08-20 14:45:09 +02:00
generated_file_directories.cmake build: namespace the generated headers with zephyr/ 2024-05-28 22:03:55 +02:00
git.cmake cmake: Create git module 2024-09-12 10:04:05 +02:00
hwm_v2.cmake sysbuild: add SoC-specific sysbuild configuration 2024-04-10 17:53:24 +02:00
kconfig.cmake cmake: use SOC_ROOT for SoCs instead of BOARD_ROOT 2024-06-13 05:33:38 -04:00
kernel.cmake doc: fix trivial typo 2024-09-05 09:49:18 +02:00
pre_dt.cmake cmake: modules: dts: fix in/out docs 2024-10-03 11:40:09 +01:00
python.cmake cmake: Require Python >= 3.10 2024-09-23 10:01:20 +02:00
root.cmake sysbuild: introduce sysbuild_root for root adjustment 2024-05-30 11:55:01 +01:00
shields.cmake cmake: shields: Simplify shield processing, print shields from modules 2024-04-12 15:03:29 +02:00
snippets.cmake
soc_v1.cmake cmake: remove dead 'soc_legacy' folder handling 2024-06-12 17:15:28 -05:00
soc_v2.cmake west: runners: Add run once commands and deferred reset 2024-04-29 17:56:19 +01:00
unittest.cmake unittest: Enable debug info by default 2024-09-12 13:02:31 -04:00
user_cache.cmake
version.cmake cmake: version.cmake: cleanup docs 2024-06-24 08:28:54 -04:00
west.cmake
yaml.cmake cmake: initial version of a CMake yaml module 2024-08-23 08:02:11 -04:00
zephyr_default.cmake cmake: initial version of a CMake yaml module 2024-08-23 08:02:11 -04:00
zephyr_module.cmake