V.S.
V.S.

Reputation: 3004

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 naivety 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!

Upvotes: 5

Views: 874

Answers (1)

zvrba
zvrba

Reputation: 24546

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

Upvotes: 7

Related Questions