Skip to content

treewide: Merge all of the SDK 1.0 changes together #94368

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 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
93fc175
rpi_pico: make it work with picolibc
nashif Jun 2, 2025
4bae387
modules/hal_rpi_pico: Switch boot_stage2 to picolibc
keith-packard Jun 4, 2025
9c5c6f9
modules/cmsis_6: Move to version with picolibc patch
keith-packard Jul 11, 2025
a53a585
modules/psa-arch-tests: Add GCC 14.3 support patch
keith-packard Jul 28, 2025
0b6a139
west: Add mbedtls fix for gcc 14.3
keith-packard Jun 5, 2025
dc1b280
arch/x86: Support picolibc with zefi
keith-packard May 19, 2025
fcbe455
soc/intel_adsp: soc_adsp_halt_cpu always fails when NUM_CPUS <= 1
keith-packard Jul 11, 2025
9a0590d
drivers/adc/adc_stm32: Check both single-ended and differential defines
keith-packard Jul 29, 2025
d12147f
modules/cmsis-dsp: Don't use Zephyr stdint.h
keith-packard May 19, 2025
df71a35
cmake: Pass optimization flag to linker too
keith-packard Mar 25, 2025
19cc9f0
cmake: Delay computation of linker paths until needed
keith-packard Aug 11, 2025
f3cbacf
west: Add cmsis-dsp fix for gcc 14.3
keith-packard Aug 6, 2025
74a6235
west: Add cmsis-dsp fix for shifting by negative amounts
keith-packard Aug 11, 2025
9e43ef9
toolchain/gcc: Add "memory" clobber to asm traps before CODE_UNREACHABLE
keith-packard Aug 10, 2025
d854986
tests/kernel: Avoid C library calls from interrupt handlers
keith-packard Aug 8, 2025
a973447
tests/arm_mpu_pxn: Insist that trivial functions are not inlined
keith-packard Aug 11, 2025
c590e76
tests/kernel: Loosen bounds on timeslice schedule for slow clocked sy…
keith-packard Aug 11, 2025
e203de9
modules: Update trusted-firmware-m for picolibc
keith-packard Jun 5, 2025
28f5a14
Merge branch 'rpi_pico-picolibc' into keithp-sdk-1.0-all
keith-packard Aug 11, 2025
b9601d6
Merge branch 'cmsis_6-picolibc' into keithp-sdk-1.0-all
keith-packard Aug 11, 2025
b9cde5f
Merge branch 'psa-arch-tests-picolibc' into keithp-sdk-1.0-all
keith-packard Aug 11, 2025
896a240
Merge branch 'mbedtls-picolibc' into keithp-sdk-1.0-all
keith-packard Aug 11, 2025
83b410c
Merge branch 'linker-optimization-flag' into keithp-sdk-1.0-all
keith-packard Aug 11, 2025
f0f8518
Merge branch 'cmsis-dsp-avoid-negative-shift' into keithp-sdk-1.0-all
keith-packard Aug 11, 2025
e825ef3
Merge branch 'tf-m-picolibc' into keithp-sdk-1.0-all
keith-packard Aug 11, 2025
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
35 changes: 35 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ get_property(ASM_OPTIMIZE_FOR_SPEED_FLAG TARGET asm PROPERTY optimization_speed)
get_property(ASM_OPTIMIZE_FOR_SIZE_FLAG TARGET asm PROPERTY optimization_size)
get_property(ASM_OPTIMIZE_FOR_SIZE_AGGRESSIVE_FLAG TARGET asm PROPERTY optimization_size_aggressive)

get_property(LINKER_OPTIMIZE_FOR_NO_OPTIMIZATIONS_FLAG TARGET linker PROPERTY no_optimization)
get_property(LINKER_OPTIMIZE_FOR_DEBUG_FLAG TARGET linker PROPERTY optimization_debug)
get_property(LINKER_OPTIMIZE_FOR_SPEED_FLAG TARGET linker PROPERTY optimization_speed)
get_property(LINKER_OPTIMIZE_FOR_SIZE_FLAG TARGET linker PROPERTY optimization_size)
get_property(LINKER_OPTIMIZE_FOR_SIZE_AGGRESSIVE_FLAG TARGET linker PROPERTY optimization_size_aggressive)

# Let the assembler inherit the optimization flags of the compiler if it is
# not set explicitly.
if(NOT ASM_OPTIMIZE_FOR_NO_OPTIMIZATIONS_FLAG)
Expand All @@ -244,23 +250,46 @@ if(NOT ASM_OPTIMIZE_FOR_SIZE_AGGRESSIVE_FLAG)
set(ASM_OPTIMIZE_FOR_SIZE_AGGRESSIVE_FLAG ${COMPILER_OPTIMIZE_FOR_SIZE_AGGRESSIVE_FLAG})
endif()

# Let the linker inherit the optimization flags of the compiler if it is
# not set explicitly.
if(NOT LINKER_OPTIMIZE_FOR_NO_OPTIMIZATIONS_FLAG)
set(LINKER_OPTIMIZE_FOR_NO_OPTIMIZATIONS_FLAG ${COMPILER_OPTIMIZE_FOR_NO_OPTIMIZATIONS_FLAG})
endif()
if(NOT LINKER_OPTIMIZE_FOR_DEBUG_FLAG)
set(LINKER_OPTIMIZE_FOR_DEBUG_FLAG ${COMPILER_OPTIMIZE_FOR_DEBUG_FLAG})
endif()
if(NOT LINKER_OPTIMIZE_FOR_SPEED_FLAG)
set(LINKER_OPTIMIZE_FOR_SPEED_FLAG ${COMPILER_OPTIMIZE_FOR_SPEED_FLAG})
endif()
if(NOT LINKER_OPTIMIZE_FOR_SIZE_FLAG)
set(LINKER_OPTIMIZE_FOR_SIZE_FLAG ${COMPILER_OPTIMIZE_FOR_SIZE_FLAG})
endif()
if(NOT LINKER_OPTIMIZE_FOR_SIZE_AGGRESSIVE_FLAG)
set(LINKER_OPTIMIZE_FOR_SIZE_AGGRESSIVE_FLAG ${COMPILER_OPTIMIZE_FOR_SIZE_AGGRESSIVE_FLAG})
endif()

# From kconfig choice, pick the actual OPTIMIZATION_FLAG to use.
# Kconfig choice ensures only one of these CONFIG_*_OPTIMIZATIONS is set.
if(CONFIG_NO_OPTIMIZATIONS)
set(COMPILER_OPTIMIZATION_FLAG ${COMPILER_OPTIMIZE_FOR_NO_OPTIMIZATIONS_FLAG})
set(ASM_OPTIMIZATION_FLAG ${ASM_OPTIMIZE_FOR_NO_OPTIMIZATIONS_FLAG})
set(LINKER_OPTIMIZATION_FLAG ${LINKER_OPTIMIZE_FOR_NO_OPTIMIZATIONS_FLAG})
elseif(CONFIG_DEBUG_OPTIMIZATIONS)
set(COMPILER_OPTIMIZATION_FLAG ${COMPILER_OPTIMIZE_FOR_DEBUG_FLAG})
set(ASM_OPTIMIZATION_FLAG ${ASM_OPTIMIZE_FOR_DEBUG_FLAG})
set(LINKER_OPTIMIZATION_FLAG ${LINKER_OPTIMIZE_FOR_DEBUG_FLAG})
elseif(CONFIG_SPEED_OPTIMIZATIONS)
set(COMPILER_OPTIMIZATION_FLAG ${COMPILER_OPTIMIZE_FOR_SPEED_FLAG})
set(ASM_OPTIMIZATION_FLAG ${ASM_OPTIMIZE_FOR_SPEED_FLAG})
set(LINKER_OPTIMIZATION_FLAG ${LINKER_OPTIMIZE_FOR_SPEED_FLAG})
elseif(CONFIG_SIZE_OPTIMIZATIONS)
set(COMPILER_OPTIMIZATION_FLAG ${COMPILER_OPTIMIZE_FOR_SIZE_FLAG}) # Default in kconfig
set(ASM_OPTIMIZATION_FLAG ${ASM_OPTIMIZE_FOR_SIZE_FLAG})
set(LINKER_OPTIMIZATION_FLAG ${LINKER_OPTIMIZE_FOR_SIZE_FLAG})
elseif(CONFIG_SIZE_OPTIMIZATIONS_AGGRESSIVE)
set(COMPILER_OPTIMIZATION_FLAG ${COMPILER_OPTIMIZE_FOR_SIZE_AGGRESSIVE_FLAG})
set(ASM_OPTIMIZATION_FLAG ${ASM_OPTIMIZE_FOR_SIZE_AGGRESSIVE_FLAG})
set(LINKER_OPTIMIZATION_FLAG ${LINKER_OPTIMIZE_FOR_SIZE_AGGRESSIVE_FLAG})
else()
message(FATAL_ERROR
"Unreachable code. Expected optimization level to have been chosen. See Kconfig.zephyr")
Expand All @@ -277,6 +306,9 @@ endif()
zephyr_compile_options($<$<COMPILE_LANGUAGE:ASM>:${ASM_OPTIMIZATION_FLAG}>)
zephyr_compile_options($<$<COMPILE_LANGUAGE:C>:${COMPILER_OPTIMIZATION_FLAG}>)
zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:${COMPILER_OPTIMIZATION_FLAG}>)
add_link_options(${LINKER_OPTIMIZATION_FLAG})
compiler_simple_options(simple_options)
toolchain_linker_add_compiler_options(${simple_options})

if(CONFIG_LTO)
zephyr_compile_options($<TARGET_PROPERTY:compiler,optimization_lto>)
Expand Down Expand Up @@ -2371,6 +2403,9 @@ add_subdirectory_ifdef(
cmake/makefile_exports
)

# Ask the compiler to set the lib_include_dir and rt_library properties
compiler_set_linker_properties()

toolchain_linker_finalize()

# export build information
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/core/cortex_m/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ FUNC_NORETURN void z_arm_switch_to_main_no_multithreading(k_thread_entry_t main_
,
[_psplim] "r"(psplim)
#endif
: "r0", "r1", "r2", "ip", "lr");
: "r0", "r1", "r2", "ip", "lr", "memory");

CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
}
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/core/ia32/fatal.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ static FUNC_NORETURN __used void df_handler_top(void)
/* NT bit is set in EFLAGS so we will task switch back to _main_tss
* and run df_handler_bottom
*/
__asm__ volatile ("iret");
__asm__ volatile ("iret" ::: "memory");
CODE_UNREACHABLE;
}

Expand Down
2 changes: 1 addition & 1 deletion arch/x86/zefi/zefi.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def build_elf(elf_file, include_dirs):
includes.extend(["-I", include_dir])
cmd = ([args.compiler, "-shared", "-Wall", "-Werror", "-I."] + includes +
["-fno-stack-protector", "-fpic", "-mno-red-zone", "-fshort-wchar",
"-Wl,-nostdlib", "-T", ldscript, "-o", "zefi.elf", cfile])
"-Wl,-nostdlib", "-nostartfiles", "-T", ldscript, "-o", "zefi.elf", cfile])
verbose(" ".join(cmd))
subprocess.run(cmd, check = True)

Expand Down
2 changes: 1 addition & 1 deletion arch/xtensa/core/fatal.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void xtensa_simulator_exit(int return_code)
"simcall\n\t"
:
: [code] "r" (return_code), [call] "i" (SYS_exit)
: "a3", "a2");
: "a3", "a2", "memory");

CODE_UNREACHABLE;
}
Expand Down
15 changes: 0 additions & 15 deletions cmake/compiler/clang/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,6 @@ if(NOT "${ARCH}" STREQUAL "posix")
endif()
endif()

# This libgcc code is partially duplicated in compiler/*/target.cmake
execute_process(
COMMAND ${CMAKE_C_COMPILER} ${clang_target_flag} ${TOOLCHAIN_C_FLAGS}
--print-libgcc-file-name
OUTPUT_VARIABLE RTLIB_FILE_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE
)

get_filename_component(RTLIB_DIR ${RTLIB_FILE_NAME} DIRECTORY)
get_filename_component(RTLIB_NAME_WITH_PREFIX ${RTLIB_FILE_NAME} NAME_WLE)
string(REPLACE lib "" RTLIB_NAME ${RTLIB_NAME_WITH_PREFIX})

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
15 changes: 0 additions & 15 deletions cmake/compiler/gcc/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -98,21 +98,6 @@ if(SYSROOT_DIR)
set(LIBC_LIBRARY_DIR "\"${SYSROOT_DIR}\"/lib/${NEWLIB_DIR}")
endif()

# This libgcc code is partially duplicated in compiler/*/target.cmake
execute_process(
COMMAND ${CMAKE_C_COMPILER} ${TOOLCHAIN_C_FLAGS} --print-libgcc-file-name
OUTPUT_VARIABLE LIBGCC_FILE_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE
)

assert_exists(LIBGCC_FILE_NAME)

get_filename_component(LIBGCC_DIR ${LIBGCC_FILE_NAME} DIRECTORY)

assert_exists(LIBGCC_DIR)

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
# link a dummy C file.
Expand Down
15 changes: 0 additions & 15 deletions cmake/compiler/icx/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,6 @@ else()
list(APPEND TOOLCHAIN_C_FLAGS "-m32")
endif()


# This libgcc code is partially duplicated in compiler/*/target.cmake
execute_process(
COMMAND ${CMAKE_C_COMPILER} ${TOOLCHAIN_C_FLAGS} --print-libgcc-file-name
OUTPUT_VARIABLE LIBGCC_FILE_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE
)

get_filename_component(LIBGCC_DIR ${LIBGCC_FILE_NAME} DIRECTORY)

list(APPEND LIB_INCLUDE_DIR "-L\"${LIBGCC_DIR}\"")
if(LIBGCC_DIR)
list(APPEND TOOLCHAIN_LIBS gcc)
endif()

set(CMAKE_REQUIRED_FLAGS -nostartfiles -nostdlib ${isystem_include_flags})
string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")

Expand Down
108 changes: 108 additions & 0 deletions cmake/compiler/target_template.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2025, Nordic Semiconductor ASA

# Template file for optional Zephyr compiler functions.
#
# This file will define optional compiler functions for toolchains that are not
# defining these functions themselves.

# Extract all of the compiler options which don't involve generator
# expressions. We hope that none of the flags required to compute compiler
# support library paths depend upon those.

function(compiler_simple_options simple_options_out)

get_property(flags TARGET zephyr_interface PROPERTY INTERFACE_COMPILE_OPTIONS)

set(simple_options "")

foreach(flag ${flags})

# Include this flag if GENEX_STRIP has no effect,
# otherwise skip the whole thing

string(GENEX_STRIP "${flag}" sflag)
if(flag STREQUAL sflag)
if(flag MATCHES "^SHELL:[ ]*(.*)")
separate_arguments(flag UNIX_COMMAND ${CMAKE_MATCH_1})
endif()
list(APPEND simple_options ${flag})
endif()

endforeach()

set(${simple_options_out} "${simple_options}" PARENT_SCOPE)
endfunction()

if(NOT COMMAND compiler_file_path)

# Search for filename in default compiler library path using the
# --print-file-name option which is common to gcc and clang. If the
# file is not found, filepath_out will be set to an empty string.
#
# This only works if none of the compiler flags used to compute
# the library path involve generator expressions as we cannot
# evaluate those in this function.
#
# Compilers needing a different implementation should provide this
# function in their target.cmake file

function(compiler_file_path filename filepath_out)

compiler_simple_options(simple_options)

execute_process(
COMMAND ${CMAKE_C_COMPILER} ${TOOLCHAIN_C_FLAGS} ${COMPILER_OPTIMIZATION_FLAG} ${simple_options}
--print-file-name ${filename}
OUTPUT_VARIABLE filepath
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(${filepath} STREQUAL ${filename})
set(filepath "")
endif()
set(${filepath_out} "${filepath}" PARENT_SCOPE)
endfunction()

endif()

if(NOT COMMAND compiler_set_linker_properties)

# Set the lib_include_dir and rt_library linker properties
# by searching for the runtime library in the compiler default
# library search path. If no runtime library is found, these
# properties will remain unset
#
# Compilers needing a different implementation should provide this
# function in their target.cmake file

function(compiler_set_linker_properties)

compiler_simple_options(simple_options)

# Compute complete path to the runtime library using the
# --print-libgcc-file-name compiler flag
execute_process(
COMMAND ${CMAKE_C_COMPILER} ${TOOLCHAIN_C_FLAGS} ${COMPILER_OPTIMIZATION_FLAG} ${simple_options}
--print-libgcc-file-name
OUTPUT_VARIABLE library_path
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# Compute the library directory name

get_filename_component(library_dir ${library_path} DIRECTORY)
set_linker_property(PROPERTY lib_include_dir "-L${library_dir}")

# Compute the linker option for this library

get_filename_component(library_basename ${library_path} NAME_WLE)

# Remove the leading 'lib' prefix to leave a value suitable for use with
# the linker -l flag
string(REPLACE lib "" library_name ${library_basename})

set_linker_property(PROPERTY rt_library "-l${library_name}")
endfunction()

endif()
11 changes: 0 additions & 11 deletions cmake/compiler/xcc/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,6 @@ foreach(file_name include/stddef.h include-fixed/limits.h)
endif()
endforeach()

# This libgcc code is partially duplicated in compiler/*/target.cmake
execute_process(
COMMAND ${CMAKE_C_COMPILER} ${TOOLCHAIN_C_FLAGS} --print-libgcc-file-name
OUTPUT_VARIABLE LIBGCC_FILE_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE
)

get_filename_component(LIBGCC_DIR ${LIBGCC_FILE_NAME} DIRECTORY)

list(APPEND 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
# link a dummy C file.
Expand Down
14 changes: 12 additions & 2 deletions cmake/linker/ld/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,25 @@ macro(toolchain_linker_finalize)

set(cpp_link "${common_link}")
if(NOT "${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "host")
if(CONFIG_CPP_EXCEPTIONS AND LIBGCC_DIR)
compiler_file_path(crtbegin.o CRTBEGIN_PATH)
compiler_file_path(crtend.o CRTEND_PATH)
if(CONFIG_CPP_EXCEPTIONS AND CRTBEGIN_PATH AND CRTEND_PATH)
# 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")
set(cpp_link "<LINK_FLAGS> ${CRTBEGIN_PATH} ${link_libraries} ${CRTEND_PATH}")
endif()
endif()
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> ${cpp_link}")
endmacro()

# Function to map compiler flags into suitable linker flags
# When using the compiler driver to run the linker, just pass
# them all through

function(toolchain_linker_add_compiler_options)
add_link_options(${ARGV})
endfunction()

# Load toolchain_ld-family macros
include(${ZEPHYR_BASE}/cmake/linker/${LINKER}/target_relocation.cmake)
include(${ZEPHYR_BASE}/cmake/linker/${LINKER}/target_configure.cmake)
8 changes: 8 additions & 0 deletions cmake/linker/lld/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ macro(toolchain_linker_finalize)
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> ${common_link}")
endmacro()

# Function to map compiler flags into suitable linker flags
# When using the compiler driver to run the linker, just pass
# them all through

function(toolchain_linker_add_compiler_options)
add_link_options(${ARGV})
endfunction()

# Load toolchain_ld-family macros
include(${ZEPHYR_BASE}/cmake/linker/ld/target_relocation.cmake)
include(${ZEPHYR_BASE}/cmake/linker/ld/target_configure.cmake)
10 changes: 10 additions & 0 deletions cmake/linker/target_template.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,13 @@ if(NOT COMMAND toolchain_linker_finalize)
macro(toolchain_linker_finalize)
endmacro()
endif()

if(NOT COMMAND toolchain_linker_add_compiler_options)

# If the linker doesn't provide a method for mapping compiler options
# to linker options, then assume we can't. This matters when the linker
# is using additional flags when computing toolchain library paths.

function(toolchain_linker_add_compiler_options)
endfunction()
endif()
14 changes: 12 additions & 2 deletions cmake/linker/xt-ld/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ find_program(CMAKE_LINKER xt-ld ${LD_SEARCH_PATH})

set_ifndef(LINKERFLAGPREFIX -Wl)

if(CONFIG_CPP_EXCEPTIONS)
compiler_file_path(crtbegin.o CRTBEGIN_PATH)
compiler_file_path(crtend.o CRTEND_PATH)
if(CONFIG_CPP_EXCEPTIONS AND CRTBEGIN_PATH AND CRTEND_PATH)
# 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")
"<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> ${CRTBEGIN_PATH} <OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${CRTEND_PATH}")
endif()

# Run $LINKER_SCRIPT file through the C preprocessor, producing ${linker_script_gen}
Expand Down Expand Up @@ -156,6 +158,14 @@ macro(toolchain_linker_finalize)
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> ${common_link}")
endmacro()

# Function to map compiler flags into suitable linker flags
# When using the compiler driver to run the linker, just pass
# them all through

function(toolchain_linker_add_compiler_options)
add_link_options(${ARGV})
endfunction()

# xt-ld is Xtensa's own version of binutils' ld.
# So we can reuse most of the ld configurations.
include(${ZEPHYR_BASE}/cmake/linker/ld/target_relocation.cmake)
Expand Down
Loading
Loading