0

objcopy --prefix-symbols allows me to prefix all symbols exported by an object file / static library.

Can I perform a more sophisticated transformation?

In particular, I would like to be able to add a C++ namespace to an object file / static library, i.e., demangle the symbols, prefix the result, and remangle it.

too honest for this site
  • 12,050
  • 4
  • 30
  • 52
Petr Skocik
  • 58,047
  • 6
  • 95
  • 142

1 Answers1

0

Found the answer(s).

Any transformation(s):

objcopy --redefine-sym old=new
objcopy --redefine-syms=filename

--redefine-sym old=new Change the name of a symbol old, to new. This can be useful when one is trying link two things together for which you have no source, and there are name collisions.

--redefine-syms=filename Apply --redefine-sym to each symbol pair "old new" listed in the file filename. filename is simply a flat file, with one symbol pair per line. Line comments may be introduced by the hash character. This option may be given more than once.

Demangling

 c++filt

Mangling

Getting mangled name from demangled name

Community
  • 1
  • 1
Petr Skocik
  • 58,047
  • 6
  • 95
  • 142