public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* force symbol to local
@ 2006-07-17 17:50 Noah yan
  2006-07-18  9:50 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Noah yan @ 2006-07-17 17:50 UTC (permalink / raw)
  To: binutils

Dear All,

How can I force a symbol to be local when using "ld -r", a typically
use is that I have a lists of global symbol provided to the ld and
want all else are local, how can I do this in ld?

The reason we use this is that we are creating a bootstrap runtime
linker that can link binaries generated from ld. and in some stage, we
have to hide some symbol to make the runtime linker boot strap.

Thanks very much in advance!
Noah

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: force symbol to local
  2006-07-17 17:50 force symbol to local Noah yan
@ 2006-07-18  9:50 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2006-07-18  9:50 UTC (permalink / raw)
  To: Noah yan; +Cc: binutils

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-07-18  9:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-17 17:50 force symbol to local Noah yan
2006-07-18  9:50 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).