This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: removing symbol from shared lib


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]