Skip to content

Commit d4e950d

Browse files
committed
Merge branch 'feature/cxx_exceptions' into 'master'
Partial support for C++ exceptions See merge request !930
2 parents c92fba3 + f698a1b commit d4e950d

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

components/esp32/cpu_start.c

+7
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ extern volatile int port_xSchedulerRunning[2];
9494

9595
static const char* TAG = "cpu_start";
9696

97+
struct object { long placeholder[ 10 ]; };
98+
void __register_frame_info (const void *begin, struct object *ob);
99+
extern char __eh_frame[];
100+
97101
/*
98102
* We arrive here after the bootloader finished loading the program from flash. The hardware is mostly uninitialized,
99103
* and the app CPU is in reset. We do have a stack, so we can do the initialization in C.
@@ -334,6 +338,9 @@ void start_cpu1_default(void)
334338

335339
static void do_global_ctors(void)
336340
{
341+
static struct object ob;
342+
__register_frame_info( __eh_frame, &ob );
343+
337344
void (**p)(void);
338345
for (p = &__init_array_end - 1; p >= &__init_array_start; --p) {
339346
(*p)();

components/esp32/ld/esp32.common.ld

+4-2
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,13 @@ SECTIONS
154154
*(.rodata1)
155155
__XT_EXCEPTION_TABLE_ = ABSOLUTE(.);
156156
*(.xt_except_table)
157-
*(.gcc_except_table)
157+
*(.gcc_except_table .gcc_except_table.*)
158158
*(.gnu.linkonce.e.*)
159159
*(.gnu.version_r)
160-
*(.eh_frame)
161160
. = (. + 3) & ~ 3;
161+
__eh_frame = ABSOLUTE(.);
162+
KEEP(*(.eh_frame))
163+
. = (. + 7) & ~ 3;
162164
/* C++ constructor and destructor tables, properly ordered: */
163165
__init_array_start = ABSOLUTE(.);
164166
KEEP (*crtbegin.o(.ctors))

0 commit comments

Comments
 (0)