Search code examples
c++cgccg++pre-compilation

How can I get gcc to add a prefix to all symbol names


I know that in the past there was an option -fprefix-function-name that would add a prefix to all generated symbols, it doesn't seem to be part of gcc anymore. Is there any other way to do this?


Solution

  • I believe this answer will give you the solution.

    In short, you can 'prefix' symbols in an existing library using objcopy like this:

    objcopy --prefix-symbols=foo_ foo.o