build(core): account for ARM unwinding info in memory layout

Currently the 8-byte section is inserted under semi-random name like
.ARM.exidx.text._ZN50_$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$4into17h79ccbc4bdfe3f200E.
This makes it hard to include it in _codelen that is later baked into
firmware header. This change adds new section because including it in
.flash causes linker error due to mixing "ordered" and "unordered"
sections.

By renaming .exidx to /DISCARD/ we'd drop this info, there may also
exist compiler flag to do that.
pull/1625/head
Martin Milata 3 years ago
parent 20fe8552ca
commit 8c6b93e0bd

@ -26,8 +26,7 @@ sram_end = ORIGIN(SRAM) + LENGTH(SRAM);
_ram_start = sram_start;
_ram_end = sram_end;
/* .ARM.exidx.text.__aeabi_ui2f is probably not needed as long as we are using panic = "abort" */
_codelen = SIZEOF(.flash) + SIZEOF(.data) + SIZEOF(.ARM.exidx) + SIZEOF(.ARM.exidx.text.__aeabi_ui2f);
_codelen = SIZEOF(.flash) + SIZEOF(.data) + SIZEOF(.exidx);
_flash_start = ORIGIN(FLASH);
_flash_end = ORIGIN(FLASH) + LENGTH(FLASH);
_heap_start = ADDR(.heap);
@ -47,6 +46,12 @@ SECTIONS {
. = ALIGN(512);
} >FLASH AT>FLASH
/* exception handling info generated by llvm which should consist of 8 bytes of "cantunwind" */
.exidx : ALIGN(4) {
*(.ARM.exidx*);
. = ALIGN(4);
} >FLASH AT>FLASH
.data : ALIGN(4) {
*(.data*);
. = ALIGN(512);

@ -26,8 +26,7 @@ sram_end = ORIGIN(SRAM) + LENGTH(SRAM);
_ram_start = sram_start;
_ram_end = sram_end;
/* .ARM.exidx.text.__aeabi_ui2f is probably not needed as long as we are using panic = "abort" */
_codelen = SIZEOF(.flash) + SIZEOF(.data) + SIZEOF(.ARM.exidx.text.__aeabi_ui2f);
_codelen = SIZEOF(.flash) + SIZEOF(.data) + SIZEOF(.exidx);
_flash_start = ORIGIN(FLASH);
_flash_end = ORIGIN(FLASH) + LENGTH(FLASH);
_heap_start = ADDR(.heap);
@ -47,6 +46,12 @@ SECTIONS {
. = ALIGN(512);
} >FLASH AT>FLASH
/* exception handling info generated by llvm which should consist of 8 bytes of "cantunwind" */
.exidx : ALIGN(4) {
*(.ARM.exidx*);
. = ALIGN(4);
} >FLASH AT>FLASH
.data : ALIGN(4) {
*(.data*);
. = ALIGN(512);

Loading…
Cancel
Save