C/C++ linker CALL16 reloc at xxxxx not against global symbol

元气小坏坏 提交于 2019-12-01 08:53:11

Aha! Thanks to a colleague of mine, we found the issue.

Here was the issue:

There was a forward declaration/prototype of a function.

void FooBarIsBest(void);

Later on in the file the function was defined.

static void FooBarIsBest(void)
{
    // do the best
} 

The issue here was that in the prototype the keyword static was left out. So it was like a whole new function was being defined.

The CALL16 reference is used by gcc for relocatable code. The assembly code of the file showed that CALL16 was being used on this function... Which is wrong, as this function is local.

Interestingly, this code used to compile & link just fine with an older version of gcc (3.2.2). Another lessoned learned. :)

Try -mlong-calls flag to the compiler.

Also see the manual for more specific MIPS options.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!