zephyr/cmake/linker_script/common/debug-sections.cmake
Björn Bergman 128698fd36 cmake: userspace: A stab at USERSPACE + CMAKE_LINKER_GENERATOR
All in all this makes cmake linker generator able to work for at least
most of the kernel tests and samples, on cortex m4.

Make the cmake linker generator have a file-structure more similar to
the ld-skeletons.

Add or edit groups, sections and logic to make the generator reflect
what the ld-skeletons do, esp. for kobjects and APP_SMEM, nonint and
some other details are also effected.

Use the new zephyr_linker_include_generated() and
zephyr_linker_include_var() functions to to handle
${DEVICE_API_LINKER_SECTIONS_CMAKE}, the kobject-prebuilt-*.h files and
APP_SMEM partition. Essentially the output from gen_app_partitions.py,
gen_kobject_placeholders.py.

Add ALIGN_WITH_INPUT on sections being put into DATA_REGION. This makes
the init layout work for ld.

This leverages the updates in gen_app_partitions.py to generate its
output as cmake linker generator sections too, and puts them into a
group defined in linker.cmake

Setup generator variables for alignment of APP_SMEM. Note that this does
not yet handle MPU_ALIGN which depends on the size of the section...

Fix broken k_object_assignment iterable section

Signed-off-by: Björn Bergman <bjorn.bergman@iar.com>
2025-03-27 17:17:03 +01:00

62 lines
2.4 KiB
CMake

# SPDX-License-Identifier: Apache-2.0
# The contents of this file is based on include/zephyr/linker/debug-sections.ld
# Please keep in sync
# Following sections are obtained via 'ld --verbose'
# Stabs debugging sections.
zephyr_linker_section(NAME .stab ADDRESS 0)
zephyr_linker_section(NAME .stabstr ADDRESS 0)
zephyr_linker_section(NAME .stab.excl ADDRESS 0)
zephyr_linker_section(NAME .stab.exclstr ADDRESS 0)
zephyr_linker_section(NAME .stab.index ADDRESS 0)
zephyr_linker_section(NAME .stab.indexstr ADDRESS 0)
zephyr_linker_section(NAME .gnu.build.attributes ADDRESS 0)
zephyr_linker_section(NAME .comment ADDRESS 0)
# DWARF debug sections.
# Symbols in the DWARF debugging sections are relative to the beginning
# of the section so we begin them at 0.
# DWARF 1 */
zephyr_linker_section(NAME .debug ADDRESS 0)
zephyr_linker_section(NAME .line ADDRESS 0)
# GNU DWARF 1 extensions
zephyr_linker_section(NAME .debug_srcinfo ADDRESS 0)
zephyr_linker_section(NAME .debug_sfnames ADDRESS 0)
# DWARF 1.1 and DWARF 2
zephyr_linker_section(NAME .debug_aranges ADDRESS 0)
zephyr_linker_section(NAME .debug_pubnames ADDRESS 0)
# DWARF 2
zephyr_linker_section(NAME .debug_info ADDRESS 0)
zephyr_linker_section_configure(SECTION .debug_info INPUT ".gnu.linkonce.wi.*")
zephyr_linker_section(NAME .debug_abbrev ADDRESS 0)
zephyr_linker_section(NAME .debug_line ADDRESS 0)
zephyr_linker_section_configure(SECTION .debug_line INPUT ".debug_line_end")
zephyr_linker_section(NAME .debug_frame ADDRESS 0)
zephyr_linker_section(NAME .debug_str ADDRESS 0)
zephyr_linker_section(NAME .debug_loc ADDRESS 0)
zephyr_linker_section(NAME .debug_macinfo ADDRESS 0)
# SGI/MIPS DWARF 2 extensions
zephyr_linker_section(NAME .debug_weaknames ADDRESS 0)
zephyr_linker_section(NAME .debug_funcnames ADDRESS 0)
zephyr_linker_section(NAME .debug_typenames ADDRESS 0)
zephyr_linker_section(NAME .debug_varnames ADDRESS 0)
# DWARF 3
zephyr_linker_section(NAME .debug_pubtypes ADDRESS 0)
zephyr_linker_section(NAME .debug_ranges ADDRESS 0)
# DWARF 5
zephyr_linker_section(NAME .debug_addr ADDRESS 0)
zephyr_linker_section(NAME .debug_line_str ADDRESS 0)
zephyr_linker_section(NAME .debug_loclists ADDRESS 0)
zephyr_linker_section(NAME .debug_macro ADDRESS 0)
zephyr_linker_section(NAME .debug_names ADDRESS 0)
zephyr_linker_section(NAME .debug_rnglists ADDRESS 0)
zephyr_linker_section(NAME .debug_str_offsets ADDRESS 0)
zephyr_linker_section(NAME .debug_sup ADDRESS 0)