fix(system): place idf's stray sections while linking

This commit is contained in:
Alexey Lapshin
2024-04-26 16:37:32 +04:00
parent 51b6d16b43
commit 89218b35e4
26 changed files with 717 additions and 208 deletions

View File

@@ -0,0 +1,87 @@
#include "sdkconfig.h"
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
.debug_pubtypes 0 : { *(.debug_pubtypes) }
/* DWARF 3 */
.debug_ranges 0 : { *(.debug_ranges) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/* GNU DWARF 2 extensions */
.debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) }
.debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) }
/* DWARF 4 */
.debug_types 0 : { *(.debug_types) }
/* DWARF 5 */
.debug_addr 0 : { *(.debug_addr) }
.debug_line_str 0 : { *(.debug_line_str) }
.debug_loclists 0 : { *(.debug_loclists) }
.debug_macro 0 : { *(.debug_macro) }
.debug_names 0 : { *(.debug_names) }
.debug_rnglists 0 : { *(.debug_rnglists) }
.debug_str_offsets 0 : { *(.debug_str_offsets) }
.comment 0 : { *(.comment) }
.note.GNU-stack 0: { *(.note.GNU-stack) }
#if CONFIG_IDF_TARGET_ARCH_RISCV
.riscv.attributes 0: { *(.riscv.attributes) }
/DISCARD/ :
{
/**
* Discarding .rela.* sections results in the following mapping:
* .rela.text.* -> .text.*
* .rela.data.* -> .data.*
* And so forth...
*/
*(.rela.*)
#if !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
*(.eh_frame_hdr)
*(.eh_frame)
#endif // !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
}
#elif CONFIG_IDF_TARGET_ARCH_XTENSA
/**
* .xt.prop and .xt.lit sections will be used by the debugger and disassembler
* to get more information about raw data present in the code.
* Indeed, it may be required to add some padding at some points in the code
* in order to align a branch/jump destination on a particular bound.
* Padding these instructions will generate null bytes that shall be
* interpreted as data, and not code by the debugger or disassembler.
* This section will only be present in the ELF file, not in the final binary
* For more details, check GCC-212
*/
.xtensa.info 0: { *(.xtensa.info) }
.xt.prop 0 : { *(.xt.prop .xt.prop.* .gnu.linkonce.prop.*) }
.xt.lit 0 : { *(.xt.lit .xt.lit.* .gnu.linkonce.p.*) }
/DISCARD/ :
{
*(.fini)
*(.eh_frame_hdr)
#if !CONFIG_COMPILER_CXX_EXCEPTIONS
*(.eh_frame)
#endif // !CONFIG_COMPILER_CXX_EXCEPTIONS
}
#else
#error "Target architecture is not supported!"
#endif

View File

@@ -218,6 +218,7 @@ SECTIONS
*(.UserEnter.literal);
*(.UserEnter.text);
. = ALIGN (16);
*(.entry.literal)
*(.entry.text)
*(.init.literal)
*(.init)
@@ -490,33 +491,7 @@ SECTIONS
ALIGNED_SYMBOL(8, _heap_low_start)
} > dram0_0_seg
/**
* This section will be used by the debugger and disassembler to get more
* information about raw data present in the code.
* Indeed, it may be required to add some padding at some points in the code
* in order to align a branch/jump destination on a particular bound.
* Padding these instructions will generate null bytes that shall be
* interpreted as data, and not code by the debugger or disassembler.
* This section will only be present in the ELF file, not in the final binary
* For more details, check GCC-212
*/
.xt.prop 0 :
{
KEEP (*(.xt.prop .xt.prop.* .gnu.linkonce.prop.*))
}
.xt.lit 0 :
{
KEEP (*(.xt.lit .xt.lit.* .gnu.linkonce.p.*))
}
/DISCARD/ :
{
*(.eh_frame_hdr)
#if !CONFIG_COMPILER_CXX_EXCEPTIONS
*(.eh_frame)
#endif // !CONFIG_COMPILER_CXX_EXCEPTIONS
}
#include "elf_misc.ld.in"
}
ASSERT(((_iram_end - ORIGIN(iram0_0_seg)) <= LENGTH(iram0_0_seg)),

View File

@@ -345,20 +345,7 @@ SECTIONS
ALIGNED_SYMBOL(16, _heap_start)
} > dram0_0_seg
/DISCARD/ :
{
/**
* Discarding .rela.* sections results in the following mapping:
* .rela.text.* -> .text.*
* .rela.data.* -> .data.*
* And so forth...
*/
*(.rela.*)
#if !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
*(.eh_frame_hdr)
*(.eh_frame)
#endif // !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
}
#include "elf_misc.ld.in"
}
ASSERT(((_iram_end - ORIGIN(iram0_0_seg)) <= LENGTH(iram0_0_seg)),

View File

@@ -457,20 +457,7 @@ SECTIONS
ALIGNED_SYMBOL(16, _heap_start)
} > dram0_0_seg
/DISCARD/ :
{
/**
* Discarding .rela.* sections results in the following mapping:
* .rela.text.* -> .text.*
* .rela.data.* -> .data.*
* And so forth...
*/
*(.rela.*)
#if !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
*(.eh_frame_hdr)
*(.eh_frame)
#endif // !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
}
#include "elf_misc.ld.in"
}
ASSERT(((_iram_end - ORIGIN(iram0_0_seg)) <= LENGTH(iram0_0_seg)),

View File

@@ -448,20 +448,7 @@ SECTIONS
ALIGNED_SYMBOL(16, _heap_start)
} > dram0_0_seg
/DISCARD/ :
{
/**
* Discarding .rela.* sections results in the following mapping:
* .rela.text.* -> .text.*
* .rela.data.* -> .data.*
* And so forth...
*/
*(.rela.*)
#if !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
*(.eh_frame_hdr)
*(.eh_frame)
#endif // !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
}
#include "elf_misc.ld.in"
}
ASSERT(((_iram_end - ORIGIN(iram0_0_seg)) <= LENGTH(iram0_0_seg)),

View File

@@ -448,20 +448,7 @@ SECTIONS
ALIGNED_SYMBOL(16, _heap_start)
} > sram_seg
/DISCARD/ :
{
/**
* Discarding .rela.* sections results in the following mapping:
* .rela.text.* -> .text.*
* .rela.data.* -> .data.*
* And so forth...
*/
*(.rela.*)
#if !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
*(.eh_frame_hdr)
*(.eh_frame)
#endif // !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
}
#include "elf_misc.ld.in"
}
ASSERT(((_iram_end - ORIGIN(sram_seg)) <= LENGTH(sram_seg)),

View File

@@ -438,18 +438,5 @@ SECTIONS
ALIGNED_SYMBOL(16, _heap_start)
} > sram_seg
/DISCARD/ :
{
/**
* Discarding .rela.* sections results in the following mapping:
* .rela.text.* -> .text.*
* .rela.data.* -> .data.*
* And so forth...
*/
*(.rela.*)
#if !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
*(.eh_frame_hdr)
*(.eh_frame)
#endif // !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
}
#include "elf_misc.ld.in"
}

View File

@@ -448,20 +448,7 @@ SECTIONS
ALIGNED_SYMBOL(16, _heap_start)
} > sram_seg
/DISCARD/ :
{
/**
* Discarding .rela.* sections results in the following mapping:
* .rela.text.* -> .text.*
* .rela.data.* -> .data.*
* And so forth...
*/
*(.rela.*)
#if !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
*(.eh_frame_hdr)
*(.eh_frame)
#endif // !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
}
#include "elf_misc.ld.in"
}
ASSERT(((_iram_end - ORIGIN(sram_seg)) <= LENGTH(sram_seg)),

View File

@@ -438,18 +438,5 @@ SECTIONS
ALIGNED_SYMBOL(16, _heap_start)
} > sram_seg
/DISCARD/ :
{
/**
* Discarding .rela.* sections results in the following mapping:
* .rela.text.* -> .text.*
* .rela.data.* -> .data.*
* And so forth...
*/
*(.rela.*)
#if !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
*(.eh_frame_hdr)
*(.eh_frame)
#endif // !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
}
#include "elf_misc.ld.in"
}

View File

@@ -514,18 +514,5 @@ SECTIONS
ALIGNED_SYMBOL(16, _heap_start_high)
} > sram_high
/DISCARD/ :
{
/**
* Discarding .rela.* sections results in the following mapping:
* .rela.text.* -> .text.*
* .rela.data.* -> .data.*
* And so forth...
*/
*(.rela.*)
#if !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
*(.eh_frame_hdr)
*(.eh_frame)
#endif // !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
}
#include "elf_misc.ld.in"
}

View File

@@ -204,6 +204,7 @@ SECTIONS
*(.UserEnter.literal);
*(.UserEnter.text);
. = ALIGN (16);
*(.entry.literal)
*(.entry.text)
*(.init.literal)
*(.init)
@@ -454,33 +455,7 @@ SECTIONS
ALIGNED_SYMBOL(8, _heap_low_start)
} > dram0_0_seg
/**
* This section will be used by the debugger and disassembler to get more
* information about raw data present in the code.
* Indeed, it may be required to add some padding at some points in the code
* in order to align a branch/jump destination on a particular bound.
* Padding these instructions will generate null bytes that shall be
* interpreted as data, and not code by the debugger or disassembler.
* This section will only be present in the ELF file, not in the final binary
* For more details, check GCC-212
*/
.xt.prop 0 :
{
KEEP (*(.xt.prop .xt.prop.* .gnu.linkonce.prop.*))
}
.xt.lit 0 :
{
KEEP (*(.xt.lit .xt.lit.* .gnu.linkonce.p.*))
}
/DISCARD/ :
{
*(.eh_frame_hdr)
#if !CONFIG_COMPILER_CXX_EXCEPTIONS
*(.eh_frame)
#endif // !CONFIG_COMPILER_CXX_EXCEPTIONS
}
#include "elf_misc.ld.in"
}
ASSERT(((_iram_text_end - ORIGIN(iram0_0_seg)) <= LENGTH(iram0_0_seg)),

View File

@@ -20,7 +20,7 @@ SECTIONS
ALIGNED_SYMBOL(4, _rtc_fast_start)
ALIGNED_SYMBOL(4, _rtc_text_start)
*(.rtc.entry.text)
*(.rtc.entry.literal .rtc.entry.text)
mapping[rtc_text]
@@ -187,6 +187,7 @@ SECTIONS
*(.UserEnter.literal);
*(.UserEnter.text);
. = ALIGN (16);
*(.entry.literal)
*(.entry.text)
*(.init.literal)
*(.init)
@@ -487,33 +488,7 @@ SECTIONS
ALIGNED_SYMBOL(8, _heap_low_start)
} > dram0_0_seg
/**
* This section will be used by the debugger and disassembler to get more
* information about raw data present in the code.
* Indeed, it may be required to add some padding at some points in the code
* in order to align a branch/jump destination on a particular bound.
* Padding these instructions will generate null bytes that shall be
* interpreted as data, and not code by the debugger or disassembler.
* This section will only be present in the ELF file, not in the final binary
* For more details, check GCC-212
*/
.xt.prop 0 :
{
KEEP (*(.xt.prop .xt.prop.* .gnu.linkonce.prop.*))
}
.xt.lit 0 :
{
KEEP (*(.xt.lit .xt.lit.* .gnu.linkonce.p.*))
}
/DISCARD/ :
{
*(.eh_frame_hdr)
#if !CONFIG_COMPILER_CXX_EXCEPTIONS
*(.eh_frame)
#endif // !CONFIG_COMPILER_CXX_EXCEPTIONS
}
#include "elf_misc.ld.in"
}
ASSERT(((_iram_end - ORIGIN(iram0_0_seg)) <= LENGTH(iram0_0_seg)),