This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Removing unwanted symbols from a .so
On Sat, 2004-11-06 at 04:35 +0100, Thomas Lopatic wrote:
> [unwanted symbols end up in the dynamic symbol table]
> > Is there either (a) a way to prevent these symbols from being added to
> > the .so in the first place (maybe through partial linking?) or (b) a way
> > to strip these extra symbols whilst keeping the library functional and
> > keeping the API symbols available?
> You might want to try writing a linker version script, for example as
> follows:
-snip-
> This would make functions func1() and func2() visible to the outside
> ("global") and hide all other symbols ("local", "*" wildcard). Save this
> to a file, say script.txt, and add the following command line option to
> GCC when linking:
>
> -Wl,--version-script=script.txt
Superb, does exactly what I was after. Thanks for the quick reply.
--
Miah Gregory