Hello all,
I am currently working on adding cpp exception support to loadable elf binaries in my project. The current issue is that, even though I have mentioned the sections for exidx and extab in the linker script, the actual elf file generated does not follow the linker script.
SECTIONS{ .text 0x00000000 : { _stext_flash = . ; *(.text) *(.text.*) *(.gnu.warning) *(.stub) *(.glue_7) *(.glue_7t) *(.jcr)
*(.gnu.linkonce.t.*) *(.init) /* Old ABI */ *(.fini) /* Old ABI */ _etext_flash = . ; }
.rodata : { _srodata = . ; *(.rodata) *(.rodata1) *(.rodata.*) *(.gnu.linkonce.r*) _erodata = . ; _eronly = .; }
.data 0x00000000 : { _sdata = . ; *(.data) *(.data1) *(.data.*) *(.gnu.linkonce.d*) _edata = . ; }
.ctors : { _sctors = . ; *(.ctors) /* Old ABI: Unallocated */ *(.init_array) /* New ABI: Allocated */ _ectors = . ; }
.dtors : { _sdtors = . ; *(.dtors) /* Old ABI: Unallocated */ *(.fini_array) /* New ABI: Allocated */ _edtors = . ; }
.ARM.extab : { *(.ARM.extab*) }
.ARM.exidx : { __exidx_start = . ; *(.ARM.exidx*) __exidx_end = . ; }
.bss : { _sbss = . ; *(.bss) *(.bss.*) *(.sbss) *(.sbss.*) *(.gnu.linkonce.b*) *(COMMON) _ebss = . ; }
/* Stabs debugging sections. */...}
But, when I checked the sections created using readelf -S, it has multiple section of text, extab, exidx even though I have grouped them together in the linker script.
Is there something wrong with my linker script? Any guidance would you very helpful.
Incase I dont add any cpp code, the sections are fine,
Using the flag --force-group-allocation will prevent the generation of the additional sections. However this flag was not present in the tool chain version that I was using 6.3.1 arm none eabi. I have upgraded my tool chain to the latest version and with the above mentioned ld flag, the build is as expected.