public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* idea for ld feature: eliding unreferenced input sections
@ 1999-07-07 15:52 Roland McGrath
  1999-07-07 16:00 ` Ian Lance Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: Roland McGrath @ 1999-07-07 15:52 UTC (permalink / raw)
  To: binutils

How hard do people think it would be to add an ld feature as follows?

I have in mind a new option, perhaps `--remove-unneeded-sections', that
would tell ld to discard from the output any input sections to which no
relocs in other sections refer.  It could be positional and apply to some
input files and not others, or it could just take the input section
containing the entry point as the root of the section dependency graph. 

I am thinking of using this in combination with something like gcc's
`-ffunction-sections' to achieve the effect of splitting up object files
and omitting the unreferenced ones from the link.

You can think of it as a moral equivalent to `--no-whole-archive' (the
default state of the switch being inverted, of course), considering each
object file to be an "archive of sections".  (The important difference is
that you still have a local symbol scope in each "archive" object file.)


Comments?


Thanks,
Roland

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

* Re: idea for ld feature: eliding unreferenced input sections
  1999-07-07 15:52 idea for ld feature: eliding unreferenced input sections Roland McGrath
@ 1999-07-07 16:00 ` Ian Lance Taylor
  1999-07-07 16:13   ` Roland McGrath
  1999-07-07 20:35   ` Mark E.
  0 siblings, 2 replies; 5+ messages in thread
From: Ian Lance Taylor @ 1999-07-07 16:00 UTC (permalink / raw)
  To: roland; +Cc: binutils

   Date: Wed, 7 Jul 1999 18:52:40 -0400
   From: Roland McGrath <roland@frob.com>

   How hard do people think it would be to add an ld feature as follows?

   I have in mind a new option, perhaps `--remove-unneeded-sections', that
   would tell ld to discard from the output any input sections to which no
   relocs in other sections refer.  It could be positional and apply to some
   input files and not others, or it could just take the input section
   containing the entry point as the root of the section dependency graph. 

It's a great idea, and Richard Henderson has already implemented it
for most ELF targets.  It's called --gc-sections.

Ian

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

* Re: idea for ld feature: eliding unreferenced input sections
  1999-07-07 16:00 ` Ian Lance Taylor
@ 1999-07-07 16:13   ` Roland McGrath
  1999-07-07 20:35   ` Mark E.
  1 sibling, 0 replies; 5+ messages in thread
From: Roland McGrath @ 1999-07-07 16:13 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: binutils

> It's a great idea, and Richard Henderson has already implemented it
> for most ELF targets.  It's called --gc-sections.

Well, there you go.  That'll show me to read the documentation in a
released version instead of the current development sources!

Thanks,
Roland

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

* Re: idea for ld feature: eliding unreferenced input sections
  1999-07-07 16:00 ` Ian Lance Taylor
  1999-07-07 16:13   ` Roland McGrath
@ 1999-07-07 20:35   ` Mark E.
  1999-07-07 21:02     ` Richard Henderson
  1 sibling, 1 reply; 5+ messages in thread
From: Mark E. @ 1999-07-07 20:35 UTC (permalink / raw)
  To: binutils

> It's a great idea, and Richard Henderson has already implemented it
> for most ELF targets.  It's called --gc-sections.

Just out of curiousity, how hard would it be to implement for COFF 
targets?

Mark

--- 
Mark Elbrecht, snowball3@bigfoot.com
http://snowball.frogspace.net/

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

* Re: idea for ld feature: eliding unreferenced input sections
  1999-07-07 20:35   ` Mark E.
@ 1999-07-07 21:02     ` Richard Henderson
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 1999-07-07 21:02 UTC (permalink / raw)
  To: Mark E.; +Cc: binutils

On Wed, Jul 07, 1999 at 11:35:29PM -0400, Mark E. wrote:
> Just out of curiousity, how hard would it be to implement for COFF 
> targets?

Not too bad.


r~

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

end of thread, other threads:[~1999-07-07 21:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-07 15:52 idea for ld feature: eliding unreferenced input sections Roland McGrath
1999-07-07 16:00 ` Ian Lance Taylor
1999-07-07 16:13   ` Roland McGrath
1999-07-07 20:35   ` Mark E.
1999-07-07 21:02     ` Richard Henderson

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).