public inbox for bfd@sourceware.org
 help / color / mirror / Atom feed
From: rth@cygnus.com (Richard Henderson)
To: bfd@cygnus.com
Subject: Re: linker section gc
Date: Thu, 02 Jul 1998 11:14:00 -0000	[thread overview]
Message-ID: <6ngida$g1o$1@dot.cygnus.com> (raw)
In-Reply-To: <19980701233246.A21545.cygnus.bfd@dot.cygnus.com>

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~

       reply	other threads:[~1998-07-02 11:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <19980701233246.A21545.cygnus.bfd@dot.cygnus.com>
1998-07-02 11:14 ` Richard Henderson [this message]
1998-07-01 23:32 Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='6ngida$g1o$1@dot.cygnus.com' \
    --to=rth@cygnus.com \
    --cc=bfd@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).