fix(system): discard eh_frame sections if disabled in sdkconfig

This commit is contained in:
Alexey Lapshin
2024-05-07 21:03:04 +04:00
parent 9b3ae86417
commit 1f3f65b40e
9 changed files with 158 additions and 33 deletions
@@ -4,6 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include "sdkconfig.h"
/* Default entry point */
ENTRY(call_start_cpu0);
@@ -389,9 +391,12 @@ SECTIONS
*(.tbss)
*(.tbss.*)
_thread_local_end = ABSOLUTE(.);
#if CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME
. = ALIGN(ALIGNOF(.eh_frame));
#endif // CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME
} > default_rodata_seg
#if CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME
/* Keep this section shall be at least aligned on 4 */
.eh_frame : ALIGN(8)
{
@@ -411,6 +416,7 @@ SECTIONS
KEEP (*(.eh_frame_hdr))
__eh_frame_hdr_end = ABSOLUTE(.);
} > default_rodata_seg
#endif // CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME
/*
This section is a place where we dump all the rodata which aren't used at runtime,
@@ -433,6 +439,14 @@ SECTIONS
. = ALIGN (16);
_heap_start = ABSOLUTE(.);
} > dram0_0_seg
/DISCARD/ :
{
#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)
}
}
ASSERT(((_iram_end - ORIGIN(iram0_0_seg)) <= LENGTH(iram0_0_seg)),