This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

__attribute((used))has been declared, but the variable is still deleted when linking

test code:

int TestMain()
{
g_TestTest++;
return 0;
}

#pragma clang section rodata=".rti_fn.6"
__attribute((used)) const init_fn_t __rt_init_TestMain = TestMain;
#pragma clang section rodata=""

If you link to a .o file, no problem. But if you use armar to generate the.a file and then link it, the variable is deleted

How to solve this problem?