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?
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