public inbox for bfd@sourceware.org
 help / color / mirror / Atom feed
* Re: linker section gc
       [not found] <19980701233246.A21545.cygnus.bfd@dot.cygnus.com>
@ 1998-07-02 11:14 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 1998-07-02 11:14 UTC (permalink / raw)
  To: bfd

In article <19980701233246.A21545.cygnus.bfd@dot.cygnus.com>,
Richard Henderson <rth@cygnus.com> wrote:
>I don't actually remember when I started work on this feature,
>but it had to be October-ish.  At long last, I've committed
>the stuff to devo.

Ok, I now realize this has like zero context and probably makes
no sense to any one except those that have been looking over my
shoulder for the past who knows how long.

The basic idea is that we collect all of the object files as normal,
but as we are laying them out, we realize that some sections cannot 
be referenced, because there are no relocations to them.  This bit
is done by a simple mark and sweep.

The effect is enhanced by compiling the source with -ffunction-sections
and/or -fdata-sections, which will put each function or initialized
data item in its own section.  These are named .text.foo or .data.bar
to make it easy to write linker script patterns to merge them all back
together in the end.

The roots of the mark-and sweep are: the entry symbol, all symbols
marked with -u on the command line, all sections marked with KEEP
in the linker script, and the tables created by CONSTRUCTORS.

There is an additional feature that is of tremendous help to c++.
Ordinarily, the relocations used to implement virtual function
tables would inhibit a good bit of collection.  With some additional
information from the c++ front end we can determine which entries 
in the table are actually used, allowing us to smash to zero those
that aren't, allowing the methods that can never be called to be
collected.

Everything but the relatively small patches to gcc have been committed.



r~

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

* linker section gc
@ 1998-07-01 23:32 Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 1998-07-01 23:32 UTC (permalink / raw)
  To: bfd

I don't actually remember when I started work on this feature,
but it had to be October-ish.  At long last, I've committed
the stuff to devo.

This is everything given to ECC except for the hooks in g++,
which needs to be hooked in elsewhere; mainly cause it is
gross in its current incarnation, but also that java will
want to use it.

What a relief.


r~

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

end of thread, other threads:[~1998-07-02 11:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <19980701233246.A21545.cygnus.bfd@dot.cygnus.com>
1998-07-02 11:14 ` linker section gc Richard Henderson
1998-07-01 23:32 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).