force symbol to local

Nick Clifton nickc@redhat.com
Tue Jul 18 09:50:00 GMT 2006


Hi Noah,

> How can I force a symbol to be local when using "ld -r", 

The linker does not have this functionality but the objcopy program does.

> a typically use is that I have a lists of global symbol 
 > provided to the ld and want all else are local,

This is slightly tricker.  The easiest way would be to use the "nm" 
program to obtain the full list of global symbols in the object file(s) 
and then use a script to extract all the ones you want to keep as 
global.  Then use the "--localize-symbols" switch supported by objcopy 
to take the remaining symbols and convert them into local symbols.

Cheers
   Nick



More information about the Binutils mailing list