File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -51,8 +51,26 @@ int cplusplus_system_init(void)
5151 (* ctors_func )();
5252 }
5353#elif defined(__CC_ARM )
54+ # if 1
55+ /* If there is no SHT$$INIT_ARRAY, calling
56+ * $Super$$__cpp_initialize__aeabi_() will fault. At least until Keil5.12
57+ * the problem still exists. So we have to initialize the C++ runtime our
58+ * own. */
59+ typedef void PROC ();
60+ extern const unsigned long SHT$$INIT_ARRAY$$Base [];
61+ extern const unsigned long SHT$$INIT_ARRAY$$Limit [];
62+ const unsigned long * base = SHT$$INIT_ARRAY$$Base ;
63+ const unsigned long * lim = SHT$$INIT_ARRAY$$Limit ;
64+
65+ for (; base != lim ; base ++ )
66+ {
67+ PROC * proc = (PROC * )((const char * )base + * base );
68+ (* proc )();
69+ }
70+ # else
5471 /* call armcc lib to initialize cplusplus */
5572 $Super$$__cpp_initialize__aeabi_ ();
73+ # endif
5674#endif
5775
5876 return 0 ;
You can’t perform that action at this time.
0 commit comments