@@ -233,17 +233,21 @@ SECTIONS
233233
234234 .eh_frame_hdr :
235235 {
236+ #if CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME
236237 ALIGNED_SYMBOL(4, __eh_frame_hdr)
237238
238239 KEEP (*(.eh_frame_hdr))
239240
240241 __eh_frame_hdr_end = ABSOLUTE(.);
242+ #endif // CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME
243+
241244 . = ALIGN(ALIGNOF(.eh_frame));
242245 } > default_rodata_seg
243246 ASSERT_SECTIONS_GAP(.eh_frame_hdr, .eh_frame)
244247
245248 .eh_frame :
246249 {
250+ #if CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME
247251 ALIGNED_SYMBOL(4, __eh_frame)
248252
249253 KEEP (*(.eh_frame))
@@ -254,6 +258,8 @@ SECTIONS
254258 LONG(0);
255259
256260 __eh_frame_end = ABSOLUTE(.);
261+ #endif // CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME
262+
257263 . = ALIGN(ALIGNOF(.flash.tdata));
258264 } > default_rodata_seg
259265 ASSERT_SECTIONS_GAP(.eh_frame, .flash.tdata)
@@ -339,13 +345,20 @@ SECTIONS
339345 ALIGNED_SYMBOL(16, _heap_start)
340346 } > dram0_0_seg
341347
342- /**
343- * Discarding .rela.* sections results in the following mapping:
344- * .rela.text.* -> .text.*
345- * .rela.data.* -> .data.*
346- * And so forth...
347- */
348- /DISCARD/ : { *(.rela.*) }
348+ /DISCARD/ :
349+ {
350+ /**
351+ * Discarding .rela.* sections results in the following mapping:
352+ * .rela.text.* -> .text.*
353+ * .rela.data.* -> .data.*
354+ * And so forth...
355+ */
356+ *(.rela.*)
357+ #if !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
358+ *(.eh_frame_hdr)
359+ *(.eh_frame)
360+ #endif // !(CONFIG_COMPILER_CXX_EXCEPTIONS || CONFIG_ESP_SYSTEM_USE_EH_FRAME)
361+ }
349362}
350363
351364ASSERT(((_iram_end - ORIGIN(iram0_0_seg)) <= LENGTH(iram0_0_seg)),
0 commit comments