Hiding symbols in a static library

Erik de Castro Lopo mle+tools@mega-nerd.com
Tue Sep 29 01:01:00 GMT 2009


Ian Lance Taylor wrote:

> It may be that --retain-symbols-file keeps symbol which have
> relocations and does not convert them to local.  I haven't checked.
> You may need to follow it with a call to objcopy --localize-symbols.
> Or just skip --retain-symbols-file, --localize-symbols should do the
> job (on a single object file produced by ld -r --whole-archive).

Ah, a solution at last. Here's what I'm doing:

    ld -r --whole-archive libABC.a -o libABC_temp.o

    objcopy --keep-global-symbols=Symbols.static libABC_temp.o libABC.o

    ar cru libABC.a libABC.o

Thanks to all that helped.

Cheers,
Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/



More information about the Binutils mailing list