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.
-fprefix-function-name
I believe this answer will give you the solution.
In short, you can 'prefix' symbols in an existing library using objcopy like this:
objcopy
objcopy --prefix-symbols=foo_ foo.o