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);
@@ -340,9 +342,11 @@ SECTIONS
*(.gnu.linkonce.e.*)
*(.gnu.version_r)
. = (. + 3) & ~ 3;
#if CONFIG_COMPILER_CXX_EXCEPTIONS
__eh_frame = ABSOLUTE(.);
KEEP(*(.eh_frame))
. = (. + 7) & ~ 3;
#endif // CONFIG_COMPILER_CXX_EXCEPTIONS
/* C++ constructor and destructor tables */
/* Don't include anything from crtbegin.o or crtend.o, as IDF doesn't use toolchain crt */
__init_array_start = ABSOLUTE(.);
@@ -473,12 +477,20 @@ SECTIONS
*/
.xt.prop 0 :
{
KEEP (*(.xt.prop .gnu.linkonce.prop.*))
KEEP (*(.xt.prop .xt.prop.* .gnu.linkonce.prop.*))
}
.xt.lit 0 :
{
KEEP (*(.xt.lit .gnu.linkonce.p.*))
KEEP (*(.xt.lit .xt.lit.* .gnu.linkonce.p.*))
}
/DISCARD/ :
{
*(.eh_frame_hdr)
#if !CONFIG_COMPILER_CXX_EXCEPTIONS
*(.eh_frame)
#endif // !CONFIG_COMPILER_CXX_EXCEPTIONS
}
}