From 6600c64331dd019228ca7b5bc641612a867c12e1 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Fri, 19 Oct 2018 10:15:19 -0700 Subject: [PATCH] linker: warn about orphan sections (Previous patch set was reverted due to issue with priv_stack. Resubmitting after fixing the faults caused by priv_stack.noinit not at the end of RAM.) This adds a linker flag and necessary changes to linker scripts so that linker will warn about orphan sections. Relates to #5534. Fixes #10473, #10474, #10515. Signed-off-by: Daniel Leung --- CMakeLists.txt | 26 +++++++++++++ Kconfig.zephyr | 23 +++++++++++ include/arch/arc/v2/linker.ld | 6 +++ include/arch/arm/cortex_m/scripts/linker.ld | 43 +++++++++++++++++++++ include/arch/nios2/linker.ld | 19 +++++++++ include/arch/riscv32/common/linker.ld | 19 +++++++++ include/arch/riscv32/pulpino/linker.ld | 21 ++++++++++ include/arch/x86/linker.ld | 5 +++ include/linker/debug-sections.ld | 40 +++++++++++++++++++ include/linker/rel-sections.ld | 33 ++++++++++++++++ soc/xtensa/D_108mini/linker.ld | 5 +++ soc/xtensa/D_212GP/linker.ld | 5 +++ soc/xtensa/D_233L/linker.ld | 5 +++ soc/xtensa/XRC_D2PM_5swIrq/linker.ld | 5 +++ soc/xtensa/XRC_FUSION_AON_ALL_LM/linker.ld | 5 +++ soc/xtensa/esp32/linker.ld | 11 ++++++ soc/xtensa/hifi2_std/linker.ld | 5 +++ soc/xtensa/hifi3_bd5/linker.ld | 5 +++ soc/xtensa/hifi3_bd5_call0/linker.ld | 5 +++ soc/xtensa/hifi4_bd7/linker.ld | 5 +++ soc/xtensa/hifi_mini/linker.ld | 5 +++ soc/xtensa/hifi_mini_4swIrq/linker.ld | 5 +++ soc/xtensa/intel_s1000/linker.ld | 6 +++ soc/xtensa/sample_controller/linker.ld | 5 +++ 24 files changed, 312 insertions(+) create mode 100644 include/linker/debug-sections.ld create mode 100644 include/linker/rel-sections.ld diff --git a/CMakeLists.txt b/CMakeLists.txt index 437b801772a..5e78978f4ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -287,6 +287,32 @@ zephyr_ld_options( ${LINKERFLAGPREFIX},--build-id=none ) +if(NOT CONFIG_NATIVE_APPLICATION) + # Funny thing is if this is set to =error, some architectures will + # skip this flag even though the compiler flag check passes + # (e.g. ARC and Xtensa). So warning should be the default for now. + # + # Skip this for native application as Zephyr only provides + # additions to the host toolchain linker script. The relocation + # sections (.rel*) requires us to override those provided + # by host toolchain. As we can't account for all possible + # combination of compiler and linker on all machines used + # for development, it is better to turn this off. + # + # CONFIG_LINKER_ORPHAN_SECTION_PLACE is to place the orphan sections + # without any warnings or errors, which is the default behavior. + # So there is no need to explicity set a linker flag. + if(CONFIG_LINKER_ORPHAN_SECTION_WARN) + zephyr_ld_options( + ${LINKERFLAGPREFIX},--orphan-handling=warn + ) + elseif(CONFIG_LINKER_ORPHAN_SECTION_ERROR) + zephyr_ld_options( + ${LINKERFLAGPREFIX},--orphan-handling=error + ) + endif() +endif() + if(CONFIG_HAVE_CUSTOM_LINKER_SCRIPT) set(LINKER_SCRIPT ${APPLICATION_SOURCE_DIR}/${CONFIG_CUSTOM_LINKER_SCRIPT}) if(NOT EXISTS ${LINKER_SCRIPT}) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 604c62378cd..d80bf268241 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -43,3 +43,26 @@ source "subsys/Kconfig" source "ext/Kconfig" source "tests/Kconfig" + +choice + prompt "Linker Orphan Section Handling" + default LINKER_ORPHAN_SECTION_WARN + +config LINKER_ORPHAN_SECTION_PLACE + bool "Place" + help + Linker puts orphan sections in place without warnings + or errors. + +config LINKER_ORPHAN_SECTION_WARN + bool "Warn" + help + Linker places the orphan sections in ouput and issues + warning about those sections. + +config LINKER_ORPHAN_SECTION_ERROR + bool "Error" + help + Linker exits with error when an orphan section is found. + +endchoice diff --git a/include/arch/arc/v2/linker.ld b/include/arch/arc/v2/linker.ld index 8702c34dbbc..357e5fab1af 100644 --- a/include/arch/arc/v2/linker.ld +++ b/include/arch/arc/v2/linker.ld @@ -73,6 +73,9 @@ MEMORY { } SECTIONS { + +#include + GROUP_START(ROMABLE_REGION) SECTION_PROLOGUE(_TEXT_SECTION_NAME,,ALIGN(1024)) { @@ -283,4 +286,7 @@ SECTIONS { #ifdef CONFIG_GEN_ISR_TABLES #include #endif + +#include + } diff --git a/include/arch/arm/cortex_m/scripts/linker.ld b/include/arch/arm/cortex_m/scripts/linker.ld index 94cc988de76..05f88c3e128 100644 --- a/include/arch/arm/cortex_m/scripts/linker.ld +++ b/include/arch/arm/cortex_m/scripts/linker.ld @@ -87,6 +87,23 @@ ENTRY(CONFIG_KERNEL_ENTRY) SECTIONS { + +#include + + /* + * .plt and .iplt are here according to 'arm-zephyr-elf-ld --verbose', + * before text section. + */ + SECTION_PROLOGUE(.plt,,) + { + *(.plt) + } + + SECTION_PROLOGUE(.iplt,,) + { + *(.iplt) + } + GROUP_START(ROMABLE_REGION) _image_rom_start = ROM_ADDR; @@ -133,6 +150,12 @@ SECTIONS *(".text.*") *(.gnu.linkonce.t.*) + /* + * These are here according to 'arm-zephyr-elf-ld --verbose', + * after .gnu.linkonce.t.* + */ + *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx) + #include #include @@ -219,6 +242,18 @@ SECTIONS } > FLASH_CCFG #endif + /* + * These are here according to 'arm-zephyr-elf-ld --verbose', + * before data section. + */ + SECTION_PROLOGUE(.got,,) + { + *(.got.plt) + *(.igot.plt) + *(.got) + *(.igot) + } + GROUP_START(RAMABLE_REGION) @@ -429,4 +464,12 @@ SECTIONS #include #endif +#include + + SECTION_PROLOGUE(.ARM.attributes, 0,) + { + KEEP(*(.ARM.attributes)) + KEEP(*(.gnu.attributes)) + } + } diff --git a/include/arch/nios2/linker.ld b/include/arch/nios2/linker.ld index a3918476c93..138aabbbe4a 100644 --- a/include/arch/nios2/linker.ld +++ b/include/arch/nios2/linker.ld @@ -82,6 +82,23 @@ ENTRY(CONFIG_KERNEL_ENTRY) SECTIONS { + +#include + + /* + * .plt and .iplt are here according to + * 'nios2-zephyr-elf-ld --verbose', before text section. + */ + SECTION_PROLOGUE(.plt,,) + { + *(.plt) + } + + SECTION_PROLOGUE(.iplt,,) + { + *(.iplt) + } + GROUP_START(ROMABLE_REGION) _image_rom_start = _ROM_ADDR; @@ -261,5 +278,7 @@ SECTIONS #include #endif +#include + } diff --git a/include/arch/riscv32/common/linker.ld b/include/arch/riscv32/common/linker.ld index ee85d6ef69d..a65a4fe9191 100644 --- a/include/arch/riscv32/common/linker.ld +++ b/include/arch/riscv32/common/linker.ld @@ -46,6 +46,22 @@ ENTRY(CONFIG_KERNEL_ENTRY) SECTIONS { +#include + + /* + * The .plt and .iplt are here according to + * 'riscv32-zephyr-elf-ld --verbose', before text section. + */ + SECTION_PROLOGUE(.plt,,) + { + *(.plt) + } + + SECTION_PROLOGUE(.iplt,,) + { + *(.iplt) + } + GROUP_START(ROM) _image_rom_start = .; @@ -175,4 +191,7 @@ SECTIONS #endif GROUP_END(RAMABLE_REGION) + +#include + } diff --git a/include/arch/riscv32/pulpino/linker.ld b/include/arch/riscv32/pulpino/linker.ld index c4e74a570ab..2f4960b0244 100644 --- a/include/arch/riscv32/pulpino/linker.ld +++ b/include/arch/riscv32/pulpino/linker.ld @@ -41,6 +41,23 @@ ENTRY(CONFIG_KERNEL_ENTRY) SECTIONS { + +#include + + /* + * .plt and .iplt are here according to + * 'riscv32-zephyr-elf-ld --verbose', before text section. + */ + SECTION_PROLOGUE(.plt,,) + { + *(.plt) + } + + SECTION_PROLOGUE(.iplt,,) + { + *(.iplt) + } + GROUP_START(INSTRRAM) SECTION_PROLOGUE(_VECTOR_SECTION_NAME,,) @@ -71,6 +88,7 @@ SECTIONS *(.text) *(".text.*") *(.gnu.linkonce.t.*) + *(.eh_frame) } GROUP_LINK_IN(INSTRRAM) _image_text_end = .; @@ -160,4 +178,7 @@ SECTIONS #endif GROUP_END(RAMABLE_REGION) + +#include + } diff --git a/include/arch/x86/linker.ld b/include/arch/x86/linker.ld index f3d0e197351..0cd66057486 100644 --- a/include/arch/x86/linker.ld +++ b/include/arch/x86/linker.ld @@ -66,6 +66,9 @@ ENTRY(CONFIG_KERNEL_ENTRY) /* SECTIONS definitions */ SECTIONS { + +#include + GROUP_START(ROMABLE_REGION) #ifdef CONFIG_REALMODE /* 16-bit sections */ @@ -378,6 +381,8 @@ SECTIONS #include #endif +#include + } #ifdef CONFIG_XIP diff --git a/include/linker/debug-sections.ld b/include/linker/debug-sections.ld new file mode 100644 index 00000000000..4a7d04fdb21 --- /dev/null +++ b/include/linker/debug-sections.ld @@ -0,0 +1,40 @@ + /* following sections are obtained via 'ld --verbose' */ + + /* Stabs debugging sections. */ + SECTION_PROLOGUE(.stab, 0,) { *(.stab) } + SECTION_PROLOGUE(.stabstr, 0,) { *(.stabstr) } + SECTION_PROLOGUE(.stab.excl, 0,) { *(.stab.excl) } + SECTION_PROLOGUE(.stab.exclstr, 0,) { *(.stab.exclstr) } + SECTION_PROLOGUE(.stab.index, 0,) { *(.stab.index) } + SECTION_PROLOGUE(.stab.indexstr, 0,) { *(.stab.indexstr) } + SECTION_PROLOGUE(.comment, 0,) { *(.comment) } + /* 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 */ + SECTION_PROLOGUE(.debug, 0,) { *(.debug) } + SECTION_PROLOGUE(.line, 0,) { *(.line) } + /* GNU DWARF 1 extensions */ + SECTION_PROLOGUE(.debug_srcinfo, 0,) { *(.debug_srcinfo) } + SECTION_PROLOGUE(.debug_sfnames, 0,) { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + SECTION_PROLOGUE(.debug_aranges, 0,) { *(.debug_aranges) } + SECTION_PROLOGUE(.debug_pubnames, 0,) { *(.debug_pubnames) } + /* DWARF 2 */ + SECTION_PROLOGUE(.debug_info, 0,) { *(.debug_info .gnu.linkonce.wi.*) } + SECTION_PROLOGUE(.debug_abbrev, 0,) { *(.debug_abbrev) } + SECTION_PROLOGUE(.debug_line, 0,) { *(.debug_line .debug_line.* .debug_line_end ) } + SECTION_PROLOGUE(.debug_frame, 0,) { *(.debug_frame) } + SECTION_PROLOGUE(.debug_str, 0,) { *(.debug_str) } + SECTION_PROLOGUE(.debug_loc, 0,) { *(.debug_loc) } + SECTION_PROLOGUE(.debug_macinfo, 0,) { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + SECTION_PROLOGUE(.debug_weaknames, 0,) { *(.debug_weaknames) } + SECTION_PROLOGUE(.debug_funcnames, 0,) { *(.debug_funcnames) } + SECTION_PROLOGUE(.debug_typenames, 0,) { *(.debug_typenames) } + SECTION_PROLOGUE(.debug_varnames, 0,) { *(.debug_varnames) } + /* DWARF 3 */ + SECTION_PROLOGUE(.debug_pubtypes, 0,) { *(.debug_pubtypes) } + SECTION_PROLOGUE(.debug_ranges, 0,) { *(.debug_ranges) } + /* DWARF Extension. */ + SECTION_PROLOGUE(.debug_macro, 0,) { *(.debug_macro) } diff --git a/include/linker/rel-sections.ld b/include/linker/rel-sections.ld new file mode 100644 index 00000000000..48174e2778d --- /dev/null +++ b/include/linker/rel-sections.ld @@ -0,0 +1,33 @@ + /* + * .rel.* are for relocation. + * These are being produced by compiler/linker. + * Specify these here so they are not considered orphan sections. + */ + + SECTION_PROLOGUE(.rel.plt,,) + { + *(.rel.plt) + + PROVIDE_HIDDEN (__rel_iplt_start = .); + *(.rel.iplt) + PROVIDE_HIDDEN (__rel_iplt_end = .); + } + + SECTION_PROLOGUE(.rela.plt,,) + { + *(.rela.plt) + + PROVIDE_HIDDEN (__rela_iplt_start = .); + *(.rela.iplt) + PROVIDE_HIDDEN (__rela_iplt_end = .); + } + + SECTION_PROLOGUE(.rel.dyn,,) + { + *(.rel.*) + } + + SECTION_PROLOGUE(.rela.dyn,,) + { + *(.rela.*) + } diff --git a/soc/xtensa/D_108mini/linker.ld b/soc/xtensa/D_108mini/linker.ld index 8af2dab8ea7..896462fb2f2 100644 --- a/soc/xtensa/D_108mini/linker.ld +++ b/soc/xtensa/D_108mini/linker.ld @@ -178,6 +178,8 @@ PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull); SECTIONS { +#include + .dram1.rodata : ALIGN(4) { _dram1_rodata_start = ABSOLUTE(.); @@ -563,6 +565,7 @@ SECTIONS } >sram0_seg :sram0_bss_phdr __stack = 0x64000000; _heap_sentry = 0x64000000; + .comment 0 : { *(.comment) } .debug 0 : { *(.debug) } .line 0 : { *(.line) } .debug_srcinfo 0 : { *(.debug_srcinfo) } @@ -580,6 +583,8 @@ SECTIONS .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } + .debug_ranges 0 : { *(.debug_ranges) } + .xtensa.info 0 : { *(.xtensa.info) } .xt.insn 0 : { KEEP (*(.xt.insn)) diff --git a/soc/xtensa/D_212GP/linker.ld b/soc/xtensa/D_212GP/linker.ld index b52d9f0f6e9..9060766d29f 100644 --- a/soc/xtensa/D_212GP/linker.ld +++ b/soc/xtensa/D_212GP/linker.ld @@ -178,6 +178,8 @@ PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull); SECTIONS { +#include + .dport0.rodata : ALIGN(4) { _dport0_rodata_start = ABSOLUTE(.); @@ -569,6 +571,7 @@ SECTIONS } >sram19_seg :sram19_bss_phdr __stack = 0x64000000; _heap_sentry = 0x64000000; + .comment 0 : { *(.comment) } .debug 0 : { *(.debug) } .line 0 : { *(.line) } .debug_srcinfo 0 : { *(.debug_srcinfo) } @@ -586,6 +589,8 @@ SECTIONS .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } + .debug_ranges 0 : { *(.debug_ranges) } + .xtensa.info 0 : { *(.xtensa.info) } .xt.insn 0 : { KEEP (*(.xt.insn)) diff --git a/soc/xtensa/D_233L/linker.ld b/soc/xtensa/D_233L/linker.ld index cd7b6ac27c8..681f8fe2fc9 100644 --- a/soc/xtensa/D_233L/linker.ld +++ b/soc/xtensa/D_233L/linker.ld @@ -159,6 +159,8 @@ PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull); SECTIONS { +#include + .WindowVectors.text : ALIGN(4) { _WindowVectors_text_start = ABSOLUTE(.); @@ -470,6 +472,7 @@ SECTIONS _memmap_seg_srom1_end = ALIGN(0x8); _image_rom_end = ABSOLUTE(.); } >srom1_seg :srom1_phdr + .comment 0 : { *(.comment) } .debug 0 : { *(.debug) } .line 0 : { *(.line) } .debug_srcinfo 0 : { *(.debug_srcinfo) } @@ -487,6 +490,8 @@ SECTIONS .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } + .debug_ranges 0 : { *(.debug_ranges) } + .xtensa.info 0 : { *(.xtensa.info) } .xt.insn 0 : { KEEP (*(.xt.insn)) diff --git a/soc/xtensa/XRC_D2PM_5swIrq/linker.ld b/soc/xtensa/XRC_D2PM_5swIrq/linker.ld index 6fb62476f4a..0bde2ef63f2 100644 --- a/soc/xtensa/XRC_D2PM_5swIrq/linker.ld +++ b/soc/xtensa/XRC_D2PM_5swIrq/linker.ld @@ -178,6 +178,8 @@ PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull); SECTIONS { +#include + .ResetVector.text : ALIGN(4) { _image_rom_start = ABSOLUTE(.); @@ -573,6 +575,7 @@ SECTIONS } >sram19_seg :sram19_bss_phdr PROVIDE(__stack = 0x64000000); _heap_sentry = 0x64000000; + .comment 0 : { *(.comment) } .debug 0 : { *(.debug) } .line 0 : { *(.line) } .debug_srcinfo 0 : { *(.debug_srcinfo) } @@ -590,6 +593,8 @@ SECTIONS .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } + .debug_ranges 0 : { *(.debug_ranges) } + .xtensa.info 0 : { *(.xtensa.info) } .xt.insn 0 : { KEEP (*(.xt.insn)) diff --git a/soc/xtensa/XRC_FUSION_AON_ALL_LM/linker.ld b/soc/xtensa/XRC_FUSION_AON_ALL_LM/linker.ld index 6eddc61e6ab..0c8899b15f5 100644 --- a/soc/xtensa/XRC_FUSION_AON_ALL_LM/linker.ld +++ b/soc/xtensa/XRC_FUSION_AON_ALL_LM/linker.ld @@ -120,6 +120,8 @@ PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull); SECTIONS { +#include + .dram0.rodata : ALIGN(4) { _dram0_rodata_start = ABSOLUTE(.); @@ -402,6 +404,7 @@ SECTIONS PROVIDE(__stack = 0x64000000); _heap_sentry = 0x64000000; + .comment 0 : { *(.comment) } .debug 0 : { *(.debug) } .line 0 : { *(.line) } .debug_srcinfo 0 : { *(.debug_srcinfo) } @@ -419,6 +422,8 @@ SECTIONS .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } + .debug_ranges 0 : { *(.debug_ranges) } + .xtensa.info 0 : { *(.xtensa.info) } .xt.insn 0 : { KEEP (*(.xt.insn)) diff --git a/soc/xtensa/esp32/linker.ld b/soc/xtensa/esp32/linker.ld index d92587a4ec1..291255b52bb 100644 --- a/soc/xtensa/esp32/linker.ld +++ b/soc/xtensa/esp32/linker.ld @@ -64,6 +64,9 @@ PROVIDE(_memmap_reset_vector = 0x40000400); SECTIONS { + +#include + /* RTC fast memory holds RTC wake stub code, including from any source file named rtc_wake_stub*.c */ @@ -252,4 +255,12 @@ SECTIONS #ifdef CONFIG_GEN_ISR_TABLES #include #endif + +#include + + SECTION_PROLOGUE(.xtensa.info, 0,) + { + *(.xtensa.info) + } + } diff --git a/soc/xtensa/hifi2_std/linker.ld b/soc/xtensa/hifi2_std/linker.ld index bf6b7ce18e1..4df129b5e79 100644 --- a/soc/xtensa/hifi2_std/linker.ld +++ b/soc/xtensa/hifi2_std/linker.ld @@ -178,6 +178,8 @@ PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull); SECTIONS { +#include + .dram1.rodata : ALIGN(4) { _dram1_rodata_start = ABSOLUTE(.); @@ -573,6 +575,7 @@ SECTIONS } >sram19_seg :sram19_bss_phdr PROVIDE(__stack = 0x64000000); _heap_sentry = 0x64000000; + .comment 0 : { *(.comment) } .debug 0 : { *(.debug) } .line 0 : { *(.line) } .debug_srcinfo 0 : { *(.debug_srcinfo) } @@ -590,6 +593,8 @@ SECTIONS .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } + .debug_ranges 0 : { *(.debug_ranges) } + .xtensa.info 0 : { *(.xtensa.info) } .xt.insn 0 : { KEEP (*(.xt.insn)) diff --git a/soc/xtensa/hifi3_bd5/linker.ld b/soc/xtensa/hifi3_bd5/linker.ld index c9c5ce7b2a8..25fb3297471 100644 --- a/soc/xtensa/hifi3_bd5/linker.ld +++ b/soc/xtensa/hifi3_bd5/linker.ld @@ -118,6 +118,8 @@ PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull); SECTIONS { +#include + .ResetVector.text : ALIGN(4) { _image_rom_start = ABSOLUTE(.); @@ -349,6 +351,7 @@ SECTIONS } >sram9_seg :sram9_bss_phdr __stack = 0x64000000; _heap_sentry = 0x64000000; + .comment 0 : { *(.comment) } .debug 0 : { *(.debug) } .line 0 : { *(.line) } .debug_srcinfo 0 : { *(.debug_srcinfo) } @@ -366,6 +369,8 @@ SECTIONS .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } + .debug_ranges 0 : { *(.debug_ranges) } + .xtensa.info 0 : { *(.xtensa.info) } .xt.insn 0 : { KEEP (*(.xt.insn)) diff --git a/soc/xtensa/hifi3_bd5_call0/linker.ld b/soc/xtensa/hifi3_bd5_call0/linker.ld index c9c5ce7b2a8..25fb3297471 100644 --- a/soc/xtensa/hifi3_bd5_call0/linker.ld +++ b/soc/xtensa/hifi3_bd5_call0/linker.ld @@ -118,6 +118,8 @@ PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull); SECTIONS { +#include + .ResetVector.text : ALIGN(4) { _image_rom_start = ABSOLUTE(.); @@ -349,6 +351,7 @@ SECTIONS } >sram9_seg :sram9_bss_phdr __stack = 0x64000000; _heap_sentry = 0x64000000; + .comment 0 : { *(.comment) } .debug 0 : { *(.debug) } .line 0 : { *(.line) } .debug_srcinfo 0 : { *(.debug_srcinfo) } @@ -366,6 +369,8 @@ SECTIONS .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } + .debug_ranges 0 : { *(.debug_ranges) } + .xtensa.info 0 : { *(.xtensa.info) } .xt.insn 0 : { KEEP (*(.xt.insn)) diff --git a/soc/xtensa/hifi4_bd7/linker.ld b/soc/xtensa/hifi4_bd7/linker.ld index 08d103ac4fa..cefb8196640 100644 --- a/soc/xtensa/hifi4_bd7/linker.ld +++ b/soc/xtensa/hifi4_bd7/linker.ld @@ -133,6 +133,8 @@ PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull); SECTIONS { +#include + .ResetVector.text : ALIGN(4) { _image_rom_start = ABSOLUTE(.); @@ -396,6 +398,7 @@ SECTIONS } >sram13_seg :sram13_bss_phdr __stack = 0x60400000; _heap_sentry = 0x60400000; + .comment 0 : { *(.comment) } .debug 0 : { *(.debug) } .line 0 : { *(.line) } .debug_srcinfo 0 : { *(.debug_srcinfo) } @@ -413,6 +416,8 @@ SECTIONS .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } + .debug_ranges 0 : { *(.debug_ranges) } + .xtensa.info 0 : { *(.xtensa.info) } .xt.insn 0 : { KEEP (*(.xt.insn)) diff --git a/soc/xtensa/hifi_mini/linker.ld b/soc/xtensa/hifi_mini/linker.ld index 73bdebc4a0a..5578de67364 100644 --- a/soc/xtensa/hifi_mini/linker.ld +++ b/soc/xtensa/hifi_mini/linker.ld @@ -105,6 +105,8 @@ PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull); SECTIONS { +#include + .dram0.rodata : ALIGN(4) { _dram0_rodata_start = ABSOLUTE(.); @@ -321,6 +323,7 @@ SECTIONS _etext = .; } >iram0_7_seg :iram0_7_phdr _image_text_end = .; + .comment 0 : { *(.comment) } .debug 0 : { *(.debug) } .line 0 : { *(.line) } .debug_srcinfo 0 : { *(.debug_srcinfo) } @@ -338,6 +341,8 @@ SECTIONS .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } + .debug_ranges 0 : { *(.debug_ranges) } + .xtensa.info 0 : { *(.xtensa.info) } .xt.insn 0 : { KEEP (*(.xt.insn)) diff --git a/soc/xtensa/hifi_mini_4swIrq/linker.ld b/soc/xtensa/hifi_mini_4swIrq/linker.ld index 9df77e97ad4..a18f6279b14 100644 --- a/soc/xtensa/hifi_mini_4swIrq/linker.ld +++ b/soc/xtensa/hifi_mini_4swIrq/linker.ld @@ -105,6 +105,8 @@ PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull); SECTIONS { +#include + .dram0.rodata : ALIGN(4) { _dram0_rodata_start = ABSOLUTE(.); @@ -321,6 +323,7 @@ SECTIONS _etext = .; } >iram0_7_seg :iram0_7_phdr _image_text_end = .; + .comment 0 : { *(.comment) } .debug 0 : { *(.debug) } .line 0 : { *(.line) } .debug_srcinfo 0 : { *(.debug_srcinfo) } @@ -338,6 +341,8 @@ SECTIONS .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } + .debug_ranges 0 : { *(.debug_ranges) } + .xtensa.info 0 : { *(.xtensa.info) } .xt.insn 0 : { KEEP (*(.xt.insn)) diff --git a/soc/xtensa/intel_s1000/linker.ld b/soc/xtensa/intel_s1000/linker.ld index 41841b6e188..b7d2f7932b6 100644 --- a/soc/xtensa/intel_s1000/linker.ld +++ b/soc/xtensa/intel_s1000/linker.ld @@ -167,6 +167,9 @@ _memmap_cacheattr_intel_s1000 = 0xf2ff4242; PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_intel_s1000); SECTIONS { + +#include + .ResetVector.text : ALIGN(4) { _ResetVector_text_start = ABSOLUTE(.); @@ -415,6 +418,7 @@ SECTIONS _end = ALIGN(8); PROVIDE(end = ALIGN(8)); __stack = L2_SRAM_BASE + L2_SRAM_SIZE; + .comment 0 : { *(.comment) } .debug 0 : { *(.debug) } .line 0 : { *(.line) } .debug_srcinfo 0 : { *(.debug_srcinfo) } @@ -432,6 +436,8 @@ SECTIONS .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } + .debug_ranges 0 : { *(.debug_ranges) } + .xtensa.info 0 : { *(.xtensa.info) } .xt.insn 0 : { KEEP (*(.xt.insn)) diff --git a/soc/xtensa/sample_controller/linker.ld b/soc/xtensa/sample_controller/linker.ld index 8af2dab8ea7..896462fb2f2 100644 --- a/soc/xtensa/sample_controller/linker.ld +++ b/soc/xtensa/sample_controller/linker.ld @@ -178,6 +178,8 @@ PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull); SECTIONS { +#include + .dram1.rodata : ALIGN(4) { _dram1_rodata_start = ABSOLUTE(.); @@ -563,6 +565,7 @@ SECTIONS } >sram0_seg :sram0_bss_phdr __stack = 0x64000000; _heap_sentry = 0x64000000; + .comment 0 : { *(.comment) } .debug 0 : { *(.debug) } .line 0 : { *(.line) } .debug_srcinfo 0 : { *(.debug_srcinfo) } @@ -580,6 +583,8 @@ SECTIONS .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } + .debug_ranges 0 : { *(.debug_ranges) } + .xtensa.info 0 : { *(.xtensa.info) } .xt.insn 0 : { KEEP (*(.xt.insn))