problems at defining own gcc linker script
hello!
i try to write/configure my own linker script for programming with C++ for the stm32303vc with ARM Cortex M4. i downloaded the newest available toolchain (4.9-2015-
i link with:
--specs=nano.specs
-mthumb
-nostartfiles
-Wl,--gc-sections
--specs=nosys.specs
my 1st question is: what are sections .ARM.extab and .ARM.exidx stand for and used for?
what does extab and exidx mean? do i realy need them?
***************
...
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.
} > FLASH
__exidx_start = .;
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.
} > FLASH
__exidx_end = .;
...
***************
next, when initalizing ram at startup i copy all data beginning at __data_start__ to __data_end__ from rom (LMA) to ram (VMA). section data includes *(.data*) but also includes *(vtable), preinit data, init data, fini data and *(.jcr*).
for me, it makes sense to copy all data from *(.data*). but what is vtable exactly for? does it deal with virtual functions defined by c++classes? do i have to copy it too?
preinit/init/fini array contain addresses to functions and should be called, not copied. am i right?
what exactly is *(.jcr)?
isn't it better to put must parts of section .data into FLASH or ROM instead of RAM (except *(.data*) and maybe *(vtable) ?) ?
***************
...
__etext = .;
.data : AT (__etext)
{
__data_start__ = .;
*(vtable) /* what is vtable? */
*(.data*)
. = ALIGN(4); /* shouldn't preinit/init and fini data better be put to ROM (eg. section .text) ? */
/* preinit data */
PROVIDE_HIDDEN (__preinit_
KEEP(
PROVIDE_HIDDEN (__preinit_
. = ALIGN(4);
/* init data */
PROVIDE_HIDDEN (__init_array_start = .);
KEEP(
KEEP(
PROVIDE_HIDDEN (__init_array_end = .);
. = ALIGN(4);
/* finit data */
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP(
KEEP(
PROVIDE_HIDDEN (__fini_array_end = .);
KEEP(*(.jcr*)) /* what is .jcr? */
. = ALIGN(4);
/* All data end */
__data_end__ = .;
} > RAM
...
***************
hope my questions are prased clear enough. i'm new to linker scripts an a bit confused about all the symbols, sections, alignments and so on.
Tom
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Thomas_Z for more information if necessary.