提交 876a9148 编写于 作者: B bernard

[C++] Add WEAK for cplusplus_system_init routine.

上级 924fc4fa
......@@ -22,6 +22,7 @@
* 2014-12-03 Bernard Add copyright header.
* 2014-12-29 Bernard Add cplusplus initialization for ARMCC.
* 2016-06-28 Bernard Add _init/_fini routines for GCC.
* 2016-10-02 Bernard Add WEAK for cplusplus_system_init routine.
*/
#include <rtthread.h>
......@@ -44,22 +45,18 @@ void _fini()
}
#endif
WEAK
int cplusplus_system_init(void)
{
#if defined(__GNUC__) && !defined(__CC_ARM)
extern unsigned char __ctors_start__;
extern unsigned char __ctors_end__;
typedef void (*func)(void);
typedef void (*pfunc) ();
extern pfunc __ctors_start__[];
extern pfunc __ctors_end__[];
pfunc *p;
/* .ctors initalization */
func *ctors_func;
for (p = __ctors_start__; p < __ctors_end__; p++)
(*p)();
for (ctors_func = (func *)&__ctors_start__;
ctors_func < (func *)&__ctors_end__;
ctors_func ++)
{
(*ctors_func)();
}
#elif defined(__CC_ARM)
/* If there is no SHT$$INIT_ARRAY, calling
* $Super$$__cpp_initialize__aeabi_() will cause fault. At least until Keil5.12
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册