开发者

Changing symbol names after linking

Is it possible to take a static object and rename symbols in such a way that it wouldn't break function calls?

For example if we have a static object containing two functions:

void A()
{
  //Do stuff
}

and

void B()
{
  A();
}

Assuming these are externally declared C functions then the .so would contain two symbols - A and B. Is there a way to rename A -> funcA and B -> funcB?

(The second part of the question relating to function calls is based upon my 开发者_如何学Pythonnaivety with respect to linking, if you simply change the name will the function calls break or not?)

P.S. Platform is linux, probably compiled with gcc, but if there's a cross compiler way then I'd be glad for it!


See the man page on objcopy utility, in particular the --redefine-syms option.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜