init: call pre_main before C++ constructors

This moves the platform specific initialization function pre_main
in front of C++ constructors. This is especially necessary for
platforms which need to setup the stack pointer (pre_main itself
is inline, hence no stack needed for this function).
This commit is contained in:
Stefan Agner 2014-08-17 22:26:30 +02:00 committed by Karl Palsson
parent 4c190a3fa3
commit 0d5dac515a
1 changed files with 3 additions and 3 deletions

View File

@ -74,6 +74,9 @@ void WEAK __attribute__ ((naked)) reset_handler(void)
*dest++ = 0;
}
/* might be provided by platform specific vector.c */
pre_main();
/* Constructors. */
for (fp = &__preinit_array_start; fp < &__preinit_array_end; fp++) {
(*fp)();
@ -82,9 +85,6 @@ void WEAK __attribute__ ((naked)) reset_handler(void)
(*fp)();
}
/* might be provided by platform specific vector.c */
pre_main();
/* Call the application's entry point. */
main();