[C++] Add WEAK for cplusplus_system_init routine.
This commit is contained in:
parent
924fc4fa88
commit
876a9148e7
@ -22,6 +22,7 @@
|
|||||||
* 2014-12-03 Bernard Add copyright header.
|
* 2014-12-03 Bernard Add copyright header.
|
||||||
* 2014-12-29 Bernard Add cplusplus initialization for ARMCC.
|
* 2014-12-29 Bernard Add cplusplus initialization for ARMCC.
|
||||||
* 2016-06-28 Bernard Add _init/_fini routines for GCC.
|
* 2016-06-28 Bernard Add _init/_fini routines for GCC.
|
||||||
|
* 2016-10-02 Bernard Add WEAK for cplusplus_system_init routine.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
@ -44,22 +45,18 @@ void _fini()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
WEAK
|
||||||
int cplusplus_system_init(void)
|
int cplusplus_system_init(void)
|
||||||
{
|
{
|
||||||
#if defined(__GNUC__) && !defined(__CC_ARM)
|
#if defined(__GNUC__) && !defined(__CC_ARM)
|
||||||
extern unsigned char __ctors_start__;
|
typedef void (*pfunc) ();
|
||||||
extern unsigned char __ctors_end__;
|
extern pfunc __ctors_start__[];
|
||||||
typedef void (*func)(void);
|
extern pfunc __ctors_end__[];
|
||||||
|
pfunc *p;
|
||||||
|
|
||||||
/* .ctors initalization */
|
for (p = __ctors_start__; p < __ctors_end__; p++)
|
||||||
func *ctors_func;
|
(*p)();
|
||||||
|
|
||||||
for (ctors_func = (func *)&__ctors_start__;
|
|
||||||
ctors_func < (func *)&__ctors_end__;
|
|
||||||
ctors_func ++)
|
|
||||||
{
|
|
||||||
(*ctors_func)();
|
|
||||||
}
|
|
||||||
#elif defined(__CC_ARM)
|
#elif defined(__CC_ARM)
|
||||||
/* If there is no SHT$$INIT_ARRAY, calling
|
/* If there is no SHT$$INIT_ARRAY, calling
|
||||||
* $Super$$__cpp_initialize__aeabi_() will cause fault. At least until Keil5.12
|
* $Super$$__cpp_initialize__aeabi_() will cause fault. At least until Keil5.12
|
||||||
|
Loading…
x
Reference in New Issue
Block a user