This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: removing symbol from shared lib
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Erik Leunissen <e dot leunissen at hccnet dot nl>
- Cc: binutils at sourceware dot org
- Date: Wed, 15 Nov 2006 10:44:54 +1030
- Subject: Re: removing symbol from shared lib
- References: <455A31E8.4030805@hccnet.nl>
On Tue, Nov 14, 2006 at 10:15:20PM +0100, Erik Leunissen wrote:
> I've got two object files: a.o and b.o which are going to be linked into
> a shared lib.
>
> b.o defines a global symbol XXX which a.o needs. But symbol XXX is not
> going to be needed outside the shared lib.
>
> What I want to accomplish is to make symbol XXX in the shared lib
> invisible from the outside, or even remove it completely, while not
> affecting the functionality of the shared lib.
Use __attribute__ ((visibility ("hidden"))) in the source or a linker
version script to make the symbol local to the shared lib. That
should prevent the symbol appearing in the dynamic symbol table. If
you want to remove the symbol from the static symbol table too, use
objcopy --strip-symbol.
--
Alan Modra
IBM OzLabs - Linux Technology Centre