C++

C++ ARMCC 编译,静态的初始类的构造函数初始化?

发布于 2021-05-14 08:40:42    浏览:171

C++ ARMCC 编译,静态的初始类的构造函数初始化不对,已经移植了crt_init.c

OS_WEAK int cplusplus_system_init(void)
{
#if defined(__CC_ARM) || defined(__CLANG_ARM)
    /* If there is no SHT$$INIT_ARRAY, calling
     * $Super$$__cpp_initialize__aeabi_() will cause fault. At least until Keil5.12
     * the problem still exists. So we have to initialize the C++ runtime by ourself.
     */
    typedef void PROC();
    extern const unsigned long SHT$$INIT_ARRAY$$Base[];
    extern const unsigned long SHT$$INIT_ARRAY$$Limit[];

    const unsigned long *base = SHT$$INIT_ARRAY$$Base;
    const unsigned long *lim  = SHT$$INIT_ARRAY$$Limit;

    for (; base != lim; base++)
    {
        PROC *proc = (PROC *)((const char *)base + *base);
        (*proc)();
    }

查看更多

1 个回答
zaijianleba
zaijianleba 2021-05-14
This guy hasn't written anything yet

已解决

撰写答案

请登录后再发布答案,点击登录
关注者
0
被浏览
171

发布
问题

分享
好友

手机
浏览

扫码手机浏览