Support for exception handling in linker scripts.
This is needed even in plain C when 64 bit variable (e.g. long long int) arithmetic is used. For example it is required when newlib is compiled with --enable-newlib-io-long-long. Conflicts: lib/stm32/f1/libopencm3_stm32f1.ld lib/stm32/f2/libopencm3_stm32f2.ld
This commit is contained in:
committed by
Piotr Esden-Tempski
parent
c3038bc876
commit
bf65589183
@@ -40,17 +40,22 @@ SECTIONS
|
||||
. = ALIGN(4);
|
||||
} >rom
|
||||
|
||||
/* exception index - required due to libgcc.a issuing /0 exceptions */
|
||||
__exidx_start = .;
|
||||
/*
|
||||
* Another section used by C++ stuff, appears when using newlib with
|
||||
* 64bit (long long) printf support
|
||||
*/
|
||||
.ARM.extab : {
|
||||
*(.ARM.extab*)
|
||||
} >rom
|
||||
.ARM.exidx : {
|
||||
*(.ARM.exidx*)
|
||||
} > rom
|
||||
__exidx_end = .;
|
||||
__exidx_start = .;
|
||||
*(.ARM.exidx*)
|
||||
__exidx_end = .;
|
||||
} >rom
|
||||
|
||||
. = ORIGIN(ram);
|
||||
|
||||
_etext = .;
|
||||
|
||||
.data : {
|
||||
.data : AT (__exidx_end) {
|
||||
_data = .;
|
||||
*(.data*) /* Read-write initialized data */
|
||||
. = ALIGN(4);
|
||||
@@ -64,11 +69,6 @@ SECTIONS
|
||||
_ebss = .;
|
||||
} >ram
|
||||
|
||||
/* exception unwind data - required due to libgcc.a issuing /0 exceptions */
|
||||
.ARM.extab : {
|
||||
*(.ARM.extab*)
|
||||
} >ram
|
||||
|
||||
. = ALIGN(4);
|
||||
end = .;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#define WEAK __attribute__ ((weak))
|
||||
|
||||
/* Symbols exported by the linker script(s): */
|
||||
extern unsigned _etext, _data, _edata, _ebss, _stack;
|
||||
extern unsigned __exidx_end, _data, _edata, _ebss, _stack;
|
||||
|
||||
void main(void);
|
||||
void reset_handler(void);
|
||||
@@ -224,7 +224,7 @@ void reset_handler(void)
|
||||
|
||||
__asm__("MSR msp, %0" : : "r"(&_stack));
|
||||
|
||||
for (src = &_etext, dest = &_data; dest < &_edata; src++, dest++)
|
||||
for (src = &__exidx_end, dest = &_data; dest < &_edata; src++, dest++)
|
||||
*dest = *src;
|
||||
|
||||
while (dest < &_ebss)
|
||||
|
||||
Reference in New Issue
Block a user