Skip to content
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

Batch merge 2.9.0 #2339

Merged
merged 24 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
07f81d2
Revert "[nrf fromtree] cmake: update build_info() calls to use PATH a…
tejlmand Dec 4, 2024
ac636d6
Revert "[nrf fromtree] cmake: nordic: save build information regardin…
tejlmand Dec 4, 2024
b18c567
Revert "[nrf fromtree] cmake: support build info in Zephyr"
tejlmand Dec 4, 2024
ce9d8d3
[nrf fromtree] picolibc: Update module to version 1.8.8
keith-packard Sep 26, 2024
0747c5c
[nrf fromtree] cmake: linker: Use the same linker for cmake checks an…
jonathonpenix Aug 28, 2024
2b27d64
[nrf fromtree] cmake: improve Zephyr link phase
tejlmand Aug 6, 2024
9a8b56b
[nrf fromtree] cmake: PROPERTY flag support on compile options and li…
tejlmand Sep 11, 2024
497a0be
[nrf fromtree] cmake: make TARGET optional in set_linker_property()
tejlmand Sep 11, 2024
e338119
[nrf fromtree] cmake: move specs compiler and linker flags to toolcha…
tejlmand Aug 26, 2024
d915f06
[nrf fromtree] manifest: update picolibc to support the new c_library…
tejlmand Sep 12, 2024
32ebd10
[nrf fromtree] cmake: detect LLVM picolibc and newlib support
tejlmand Sep 11, 2024
f49c153
[nrf fromtree] cmake: support build info in Zephyr
tejlmand Aug 9, 2024
d552044
[nrf fromtree] cmake: nordic: save build information regarding SVD fi…
tejlmand Aug 22, 2024
c87e19d
[nrf fromtree] cmake: update build_info() calls to use PATH argument
tejlmand Oct 10, 2024
c126c8e
[nrf fromtree] cmake: deprecate BUILD_NO_GAP_FILL and introduce type …
tejlmand Nov 28, 2024
55f9255
[nrf fromtree] cmake: clear llvm bintool gapfill property
tejlmand Nov 28, 2024
b341d05
[nrf noup] samples: subsys: smp_svr: 54l10 and 54l05 sample.yaml
michalek-no Nov 28, 2024
65ecde5
[nrf fromlist] drivers: nrf_wifi: Restructure to carve out a new nrf7…
bama-nordic Dec 1, 2024
09601f1
[nrf fromlist] tests: boards: nrf70: Add ztests for bus library
bama-nordic Dec 1, 2024
1df2f22
[nrf fromlist] Bluetooth: Host: Cancel pending deferred work on disco…
weeTike Dec 4, 2024
b3bcaf0
[nrf fromlist] soc: nordic: add common symbol for RAM control helper …
nika-nordic Nov 27, 2024
f246ad8
[nrf fromlist] drivers: retained_mem: nrf: make ram_ctrl variant expl…
nika-nordic Nov 27, 2024
1a1b96d
[nrf fromlist] soc: nordic: poweroff: add retention management
nika-nordic Nov 27, 2024
d750488
[nrf fromlist] samples: nordic: system_off: use retained_mem on all t…
nika-nordic Nov 28, 2024
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
15 changes: 8 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1617,10 +1617,9 @@ list(APPEND
)
list(APPEND post_build_byproducts ${KERNEL_MAP_NAME})

if(NOT CONFIG_BUILD_NO_GAP_FILL)
# Use ';' as separator to get proper space in resulting command.
set(GAP_FILL "$<TARGET_PROPERTY:bintools,elfconvert_flag_gapfill>0xff")
endif()
# Use ';' as separator to get proper space in resulting command.
set(gap_fill_prop "$<TARGET_PROPERTY:bintools,elfconvert_flag_gapfill>")
set(gap_fill "$<$<BOOL:${gap_fill_prop}>:${gap_fill_prop}${CONFIG_BUILD_GAP_FILL_PATTERN}>")

if(CONFIG_OUTPUT_PRINT_MEMORY_USAGE)
target_link_libraries(${logical_target_for_zephyr_elf} $<TARGET_PROPERTY:linker,memusage>)
Expand Down Expand Up @@ -1681,7 +1680,7 @@ if(CONFIG_BUILD_OUTPUT_HEX OR BOARD_FLASH_RUNNER STREQUAL openocd)
post_build_commands
COMMAND $<TARGET_PROPERTY:bintools,elfconvert_command>
$<TARGET_PROPERTY:bintools,elfconvert_flag>
${GAP_FILL}
$<$<BOOL:${CONFIG_BUILD_OUTPUT_HEX_GAP_FILL}>:${gap_fill}>
$<TARGET_PROPERTY:bintools,elfconvert_flag_outtarget>ihex
${remove_sections_argument_list}
$<TARGET_PROPERTY:bintools,elfconvert_flag_infile>${KERNEL_ELF_NAME}
Expand All @@ -1703,7 +1702,7 @@ if(CONFIG_BUILD_OUTPUT_BIN)
post_build_commands
COMMAND $<TARGET_PROPERTY:bintools,elfconvert_command>
$<TARGET_PROPERTY:bintools,elfconvert_flag>
${GAP_FILL}
${gap_fill}
$<TARGET_PROPERTY:bintools,elfconvert_flag_outtarget>binary
${remove_sections_argument_list}
$<TARGET_PROPERTY:bintools,elfconvert_flag_infile>${KERNEL_ELF_NAME}
Expand Down Expand Up @@ -1790,7 +1789,7 @@ if(CONFIG_BUILD_OUTPUT_S19)
post_build_commands
COMMAND $<TARGET_PROPERTY:bintools,elfconvert_command>
$<TARGET_PROPERTY:bintools,elfconvert_flag>
${GAP_FILL}
$<$<BOOL:${CONFIG_BUILD_OUTPUT_S19_GAP_FILL}>:${gap_fill}>
$<TARGET_PROPERTY:bintools,elfconvert_flag_outtarget>srec
$<TARGET_PROPERTY:bintools,elfconvert_flag_srec_len>1
$<TARGET_PROPERTY:bintools,elfconvert_flag_infile>${KERNEL_ELF_NAME}
Expand Down Expand Up @@ -2233,6 +2232,8 @@ add_subdirectory_ifdef(
cmake/makefile_exports
)

toolchain_linker_finalize()

yaml_context(EXISTS NAME build_info result)
if(result)
build_info(zephyr version VALUE ${PROJECT_VERSION_STR})
Expand Down
27 changes: 26 additions & 1 deletion Kconfig.zephyr
Original file line number Diff line number Diff line change
Expand Up @@ -706,15 +706,34 @@ config CLEANUP_INTERMEDIATE_FILES
from the build process. Note this breaks incremental builds, west spdx
(Software Bill of Material generation), and maybe others.

config BUILD_GAP_FILL_PATTERN
hex "Gap fill pattern"
default 0xFF
help
Pattern used for gap filling of output files.
This value should be set to the value of a clean flash as this can
significantly reduce flash write times.
This setting only defines the gap fill pattern and doesn't enable gap
filling.
Note: binary files are always gap filled as they contain no address
information.

config BUILD_NO_GAP_FILL
bool "Don't fill gaps in generated hex/bin/s19 files."
bool "Don't fill gaps in generated hex/s19 files [DEPRECATED]."
select DEPRECATED

config BUILD_OUTPUT_HEX
bool "Build a binary in HEX format"
help
Build an Intel HEX binary zephyr/zephyr.hex in the build directory.
The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.

config BUILD_OUTPUT_HEX_GAP_FILL
bool "Fill gaps in hex files"
depends on !BUILD_NO_GAP_FILL
help
Fill gaps in hex based files.

config BUILD_OUTPUT_BIN
bool "Build a binary in BIN format"
default y
Expand Down Expand Up @@ -749,6 +768,12 @@ config BUILD_OUTPUT_S19
Build an S19 binary zephyr/zephyr.s19 in the build directory.
The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.

config BUILD_OUTPUT_S19_GAP_FILL
bool "Fill gaps in s19 files"
depends on !BUILD_NO_GAP_FILL
help
Fill gaps in s19 based files.

config BUILD_OUTPUT_UF2
bool "Build a binary in UF2 format"
depends on BUILD_OUTPUT_BIN
Expand Down
7 changes: 2 additions & 5 deletions cmake/bintools/llvm/target_bintools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,8 @@ set_property(TARGET bintools PROPERTY elfconvert_flag_section_remove "--remove-s
set_property(TARGET bintools PROPERTY elfconvert_flag_section_only "--only-section=")
set_property(TARGET bintools PROPERTY elfconvert_flag_section_rename "--rename-section;")

# Note, placing a ';' at the end results in the following param to be a list,
# and hence space separated.
# Thus the command line argument becomes:
# `--gap-file <value>` instead of `--gap-fill<value>` (The latter would result in an error)
set_property(TARGET bintools PROPERTY elfconvert_flag_gapfill "--gap-fill;")
# llvm-objcopy doesn't support gap fill argument.
set_property(TARGET bintools PROPERTY elfconvert_flag_gapfill "")
set_property(TARGET bintools PROPERTY elfconvert_flag_srec_len "--srec-len=")

set_property(TARGET bintools PROPERTY elfconvert_flag_infile "")
Expand Down
2 changes: 2 additions & 0 deletions cmake/compiler/clang/compiler_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,5 @@ set_compiler_property(PROPERTY warning_error_coding_guideline
)

set_compiler_property(PROPERTY no_global_merge "-mno-global-merge")

set_compiler_property(PROPERTY specs)
40 changes: 38 additions & 2 deletions cmake/compiler/clang/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,42 @@ if(NOT "${ARCH}" STREQUAL "posix")
endif()
endif()

# LLVM will use a default sysroot for selection of the C library. The default
# C library sysroot was defined at built time of clang/LLVM.
#
# For example, LLVM for Arm comes pre-built with Picolibc, and thus no flags
# are required for selecting Picolibc.
#
# Other clang/LLVM distributions may come with other pre-built C libraries.
# clang/LLVM supports using an alternative C library, either by direct linking,
# or by specifying '--sysroot <path>'.
#
# LLVM for Arm provides a 'newlib.cfg' file for newlib C selection.
# Let us support this principle by looking for a dedicated 'newlib.cfg' or
# 'picolibc.cfg' and specify '--config <spec>.cfg' if such a file is found.
# If no cfg-file matching the chosen C implementation, then we assume that the
# chosen C implementation is identical to the default C library used be the
# toolchain.
if(CONFIG_NEWLIB_LIBC)
file(GLOB_RECURSE newlib_cfg ${LLVM_TOOLCHAIN_PATH}/newlib.cfg)
if(newlib_cfg)
list(GET newlib_cfg 0 newlib_cfg)
set_linker_property(PROPERTY c_library "--config=${newlib_cfg};-lc")
list(APPEND CMAKE_REQUIRED_FLAGS --config=${newlib_cfg})
list(APPEND TOOLCHAIN_C_FLAGS --config=${newlib_cfg})
endif()
endif()

if(CONFIG_PICOLIBC)
file(GLOB_RECURSE picolibc_cfg ${LLVM_TOOLCHAIN_PATH}/picolibc.cfg)
if(picolibc_cfg)
list(GET picolibc_cfg 0 picolibc_cfg)
set_linker_property(PROPERTY c_library "--config=${picolibc_cfg};-lc")
list(APPEND CMAKE_REQUIRED_FLAGS --config=${picolibc_cfg})
list(APPEND TOOLCHAIN_C_FLAGS --config=${picolibc_cfg})
endif()
endif()

# This libgcc code is partially duplicated in compiler/*/target.cmake
execute_process(
COMMAND ${CMAKE_C_COMPILER} ${clang_target_flag} ${TOOLCHAIN_C_FLAGS}
Expand All @@ -76,8 +112,8 @@ if(NOT "${ARCH}" STREQUAL "posix")
get_filename_component(RTLIB_NAME_WITH_PREFIX ${RTLIB_FILE_NAME} NAME_WLE)
string(REPLACE lib "" RTLIB_NAME ${RTLIB_NAME_WITH_PREFIX})

list(APPEND LIB_INCLUDE_DIR -L${RTLIB_DIR})
list(APPEND TOOLCHAIN_LIBS ${RTLIB_NAME})
set_property(TARGET linker PROPERTY lib_include_dir "-L${RTLIB_DIR}")
set_property(TARGET linker PROPERTY rt_library "-l${RTLIB_NAME}")

list(APPEND CMAKE_REQUIRED_FLAGS -nostartfiles -nostdlib ${isystem_include_flags})
string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
Expand Down
4 changes: 4 additions & 0 deletions cmake/compiler/compiler_flags_template.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,7 @@ set_compiler_property(PROPERTY warning_shadow_variables)
# Compiler flags to avoid recognizing built-in functions
set_compiler_property(PROPERTY no_builtin)
set_compiler_property(PROPERTY no_builtin_malloc)

# Compiler flag for defining specs. Used only by gcc, other compilers may keep
# this undefined.
set_compiler_property(PROPERTY specs)
2 changes: 2 additions & 0 deletions cmake/compiler/gcc/compiler_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,5 @@ set_compiler_property(PROPERTY warning_shadow_variables -Wshadow)

set_compiler_property(PROPERTY no_builtin -fno-builtin)
set_compiler_property(PROPERTY no_builtin_malloc -fno-builtin-malloc)

set_compiler_property(PROPERTY specs -specs=)
3 changes: 1 addition & 2 deletions cmake/compiler/gcc/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ get_filename_component(LIBGCC_DIR ${LIBGCC_FILE_NAME} DIRECTORY)

assert_exists(LIBGCC_DIR)

LIST(APPEND LIB_INCLUDE_DIR "-L\"${LIBGCC_DIR}\"")
LIST(APPEND TOOLCHAIN_LIBS gcc)
set_linker_property(PROPERTY lib_include_dir "-L\"${LIBGCC_DIR}\"")

# For CMake to be able to test if a compiler flag is supported by the
# toolchain we need to give CMake the necessary flags to compile and
Expand Down
6 changes: 0 additions & 6 deletions cmake/linker/armlink/linker_flags.cmake

This file was deleted.

8 changes: 8 additions & 0 deletions cmake/linker/armlink/linker_libraries.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: Apache-2.0

# Per default armclang (Arm Compiler 6) doesn't need explicit C library linking
# so we only need to set link order linking in case a custom C library is linked
# in, such as picolibc.
set_property(TARGET linker APPEND PROPERTY link_order_library "c;rt")
18 changes: 18 additions & 0 deletions cmake/linker/armlink/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,23 @@ function(toolchain_ld_link_elf)
)
endfunction(toolchain_ld_link_elf)

# This function will generate the correct CMAKE_C_LINK_EXECUTABLE / CMAKE_CXX_LINK_EXECUTABLE
# rule to ensure that standard c and runtime libraries are correctly placed
# and the end of link invocation and doesn't appear in the middle of the link
# command invocation.
macro(toolchain_linker_finalize)
set(zephyr_std_libs)
get_property(link_order TARGET linker PROPERTY link_order_library)
foreach(lib ${link_order})
get_property(link_flag TARGET linker PROPERTY ${lib}_library)
set(zephyr_std_libs "${zephyr_std_libs} ${link_flag}")
endforeach()

set(common_link "<LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> ${zephyr_std_libs} -o <TARGET>")
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> <CMAKE_C_LINK_FLAGS> ${common_link}")
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_LINKER> <CMAKE_CXX_LINK_FLAGS> ${common_link}")
set(CMAKE_ASM_LINK_EXECUTABLE "<CMAKE_LINKER> <CMAKE_ASM_LINK_FLAGS> ${common_link}")
endmacro()

include(${ZEPHYR_BASE}/cmake/linker/ld/target_relocation.cmake)
include(${ZEPHYR_BASE}/cmake/linker/ld/target_configure.cmake)
2 changes: 2 additions & 0 deletions cmake/linker/ld/gcc/linker_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ add_link_options(-gdwarf-4)

# Extra warnings options for twister run
set_property(TARGET linker PROPERTY warnings_as_errors -Wl,--fatal-warnings)

set_linker_property(PROPERTY specs -specs=)
4 changes: 0 additions & 4 deletions cmake/linker/ld/linker_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ check_set_linker_property(TARGET linker PROPERTY base
${LINKERFLAGPREFIX},--build-id=none
)

if(NOT CONFIG_MINIMAL_LIBCPP AND NOT CONFIG_NATIVE_LIBRARY AND NOT CONFIG_EXTERNAL_MODULE_LIBCPP)
set_property(TARGET linker PROPERTY cpp_base -lstdc++)
endif()

check_set_linker_property(TARGET linker PROPERTY baremetal
-nostdlib
-static
Expand Down
38 changes: 38 additions & 0 deletions cmake/linker/ld/linker_libraries.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: Apache-2.0

# Do not specify default link libraries when targeting host (native build).
if(NOT CONFIG_NATIVE_BUILD)
set_linker_property(NO_CREATE PROPERTY c_library "-lc")
set_linker_property(NO_CREATE PROPERTY rt_library "-lgcc")
set_linker_property(NO_CREATE PROPERTY c++_library "-lstdc++")
set_linker_property(NO_CREATE PROPERTY math_library "-lm")
# Keeping default include dir empty. The linker will then select libraries
# from its default search path. The toolchain may adjust the value to a
# specific location, for example gcc infrastructure will set the value based
# on output from --print-libgcc-file-name.
set_linker_property(NO_CREATE PROPERTY lib_include_dir "")
endif()

if(CONFIG_CPP
AND NOT CONFIG_MINIMAL_LIBCPP
AND NOT CONFIG_NATIVE_LIBRARY
# When new link principle is fully introduced, then the below condition can
# be removed, and instead the external module c++ should use:
# set_property(TARGET linker PROPERTY c++_library "<external_c++_lib>")
AND NOT CONFIG_EXTERNAL_MODULE_LIBCPP
)
set_property(TARGET linker PROPERTY link_order_library "c++")
endif()


if(CONFIG_NEWLIB_LIBC AND CMAKE_C_COMPILER_ID STREQUAL "GNU")
# We are using c;rt;c (expands to '-lc -lgcc -lc') in code below.
# This is needed because when linking with newlib on aarch64, then libgcc has a
# link dependency to libc (strchr), but libc also has dependencies to libgcc.
# Lib C depends on libgcc. e.g. libc.a(lib_a-fvwrite.o) references __aeabi_idiv
set_property(TARGET linker APPEND PROPERTY link_order_library "math;c;rt;c")
else()
set_property(TARGET linker APPEND PROPERTY link_order_library "c;rt")
endif()
57 changes: 38 additions & 19 deletions cmake/linker/ld/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ set(CMAKE_LINKER ${GNULD_LINKER})

set_ifndef(LINKERFLAGPREFIX -Wl)

if(NOT "${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "host")
if(CONFIG_CPP_EXCEPTIONS AND LIBGCC_DIR)
# When building with C++ Exceptions, it is important that crtbegin and crtend
# are linked at specific locations.
# The location is so important that we cannot let this be controlled by normal
# link libraries, instead we must control the link command specifically as
# part of toolchain.
set(CMAKE_CXX_LINK_EXECUTABLE
"<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> ${LIBGCC_DIR}/crtbegin.o <OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${LIBGCC_DIR}/crtend.o")
endif()
if((${CMAKE_LINKER} STREQUAL "${CROSS_COMPILE}ld.bfd") OR
${GNULD_LINKER_IS_BFD})
# ld.bfd was found so let's explicitly use that for linking, see #32237
list(APPEND TOOLCHAIN_LD_FLAGS -fuse-ld=bfd)
list(APPEND CMAKE_REQUIRED_FLAGS -fuse-ld=bfd)
string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
endif()

# Run $LINKER_SCRIPT file through the C preprocessor, producing ${linker_script_gen}
Expand Down Expand Up @@ -118,16 +114,9 @@ function(toolchain_ld_link_elf)
${ARGN} # input args to parse
)

if((${CMAKE_LINKER} STREQUAL "${CROSS_COMPILE}ld.bfd") OR
${GNULD_LINKER_IS_BFD})
# ld.bfd was found so let's explicitly use that for linking, see #32237
set(use_linker "-fuse-ld=bfd")
endif()

target_link_libraries(
${TOOLCHAIN_LD_LINK_ELF_TARGET_ELF}
${TOOLCHAIN_LD_LINK_ELF_LIBRARIES_PRE_SCRIPT}
${use_linker}
${TOPT}
${TOOLCHAIN_LD_LINK_ELF_LINKER_SCRIPT}
${TOOLCHAIN_LD_LINK_ELF_LIBRARIES_POST_SCRIPT}
Expand All @@ -138,14 +127,44 @@ function(toolchain_ld_link_elf)
${LINKERFLAGPREFIX},--no-whole-archive
${NO_WHOLE_ARCHIVE_LIBS}
$<TARGET_OBJECTS:${OFFSETS_LIB}>
${LIB_INCLUDE_DIR}
-L${PROJECT_BINARY_DIR}
${TOOLCHAIN_LIBS}

${TOOLCHAIN_LD_LINK_ELF_DEPENDENCIES}
)
endfunction(toolchain_ld_link_elf)

# Function for finalizing link setup after Zephyr configuration has completed.
#
# This function will generate the correct CMAKE_C_LINK_EXECUTABLE / CMAKE_CXX_LINK_EXECUTABLE
# rule to ensure that standard c and runtime libraries are correctly placed
# and the end of link invocation and doesn't appear in the middle of the link
# command invocation.
macro(toolchain_linker_finalize)
get_property(zephyr_std_libs TARGET linker PROPERTY lib_include_dir)
get_property(link_order TARGET linker PROPERTY link_order_library)
foreach(lib ${link_order})
get_property(link_flag TARGET linker PROPERTY ${lib}_library)
list(APPEND zephyr_std_libs "${link_flag}")
endforeach()
string(REPLACE ";" " " zephyr_std_libs "${zephyr_std_libs}")

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

set(CMAKE_ASM_LINK_EXECUTABLE "<CMAKE_ASM_COMPILER> <FLAGS> <CMAKE_ASM_LINK_FLAGS> ${common_link}")
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> ${common_link}")

set(cpp_link "${common_link}")
if(NOT "${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "host")
if(CONFIG_CPP_EXCEPTIONS AND LIBGCC_DIR)
# When building with C++ Exceptions, it is important that crtbegin and crtend
# are linked at specific locations.
set(cpp_link "<LINK_FLAGS> ${LIBGCC_DIR}/crtbegin.o ${link_libraries} ${LIBGCC_DIR}/crtend.o")
endif()
endif()
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> ${cpp_link}")
endmacro()

# Load toolchain_ld-family macros
include(${ZEPHYR_BASE}/cmake/linker/${LINKER}/target_relocation.cmake)
include(${ZEPHYR_BASE}/cmake/linker/${LINKER}/target_configure.cmake)
4 changes: 4 additions & 0 deletions cmake/linker/linker_flags_template.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,7 @@ set_property(TARGET linker PROPERTY no_relax)

# Linker flag for enabling relaxation of address optimization for jump calls.
set_property(TARGET linker PROPERTY relax)

# Linker flag for defining specs. Defined only by gcc, when gcc is used as
# front-end for ld.
set_compiler_property(PROPERTY specs)
Loading
Loading