public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Roland McGrath <roland@hack.frob.com>
To: Ian Lance Taylor <iant@google.com>
Cc: Alan Modra <amodra@gmail.com>,
	   "GNU C. Library" <libc-alpha@sourceware.org>,
	   Binutils <binutils@sourceware.org>
Subject: Re: gold vs libc
Date: Mon, 31 Mar 2014 21:40:00 -0000	[thread overview]
Message-ID: <20140331214025.E61517447E@topped-with-meat.com> (raw)
In-Reply-To: Ian Lance Taylor's message of  Monday, 31 March 2014 13:53:44 -0700 <CAKOQZ8x19YZ_oyJXyxe9JST4nfaG8dDvVrdf-vmgkNWydrpsrw@mail.gmail.com>

> On Mon, Mar 31, 2014 at 1:04 PM, Roland McGrath <roland@hack.frob.com> wrote:
> >
> > When an input file contains a symbol pointing to a location in an
> > input section, the output file should define that symbol so it points
> > to the part of the output section that corresponds to the origin input
> > location.  When the symbol points to input contents of at least one
> > byte, what this means is pretty incontrovertibly clear.  In this case,
> > it points to an empty input section.  But I claim that it's adequately
> > clear what it should mean in this case too.
> 
> It's really not.  When the eh_frame section is being optimized, there
> is no longer any correspondence between symbols defined in the input
> sections and data defined in the output section.

I understand that's what's going on underneath.  But the user didn't ask
you to fiddle with his .eh_frame contents.  He did ask you to place some
symbols in his .eh_frame section.  If .eh_frame optimization is not
transparent, then it's broken.

IMHO it would be acceptable to simply disable .eh_frame optimization when
there are any symbols in input .eh_frame sections that will survive to
affect the output of anything except the .eh_frame output section's
contents.  (That tortured wording is to distinguish __EH_FRAME_BEGIN__,
whose value is used by relocs in other sections like .text, from the
various .L* symbols used within individual input sections that are only
used in arithmetic producing values inside the section.)  What's not
acceptable is breaking the core semantics of linking that would apply if
nobody had ever thought of .eh_frame optimization.

> The current code has a simple algorithm that usually produces the
> result we want: we simply copy .eh_frame sections until we find one we
> can optimize.  Perhaps we could change to a different algorithm: put
> all unoptimized .eh_frame sections first, then all optimized .eh_frame
> sections.

In the concrete scenario, that would violate the abstract principles I
described but would deliver an even better practical result.  The empty
.eh_frame section (and its __EH_FRAME_BEGIN__ symbol) from crtbeginT.o
count as "unoptimized", while the .eh_frame content from crt1.o could count
as "optimized".  So it would place the emptiness and __EH_FRAME_BEGIN__
first, and everything else (including crt1.o's contributions) after, even
though crt1.o appears before crtbeginT.o in the link.

I think either this or disabling the optimization entirely are acceptable
resolutions to the bug.


Thanks,
Roland

  reply	other threads:[~2014-03-31 21:40 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-30  4:25 Roland McGrath
2014-03-30  4:56 ` Alan Modra
2014-03-30  5:09   ` Roland McGrath
2014-03-31 19:03     ` Ian Lance Taylor
2014-03-31 20:04       ` Roland McGrath
2014-03-31 20:53         ` Ian Lance Taylor
2014-03-31 21:40           ` Roland McGrath [this message]
2014-04-01 18:25             ` Ian Lance Taylor
2014-09-10 20:56               ` Cary Coutant
2014-09-10 22:05                 ` Rafael Espíndola
2014-09-11  0:32                   ` Alan Modra
2014-09-10 22:52                 ` Roland McGrath
2014-09-11  0:04                   ` Ian Lance Taylor
2014-12-20 13:58                     ` PATCH: PR gold/14675: No eh_frame info registered in exception_static_test H.J. Lu
2014-12-22 17:37                       ` Cary Coutant
2014-12-22 22:40                         ` H.J. Lu
2014-12-23  0:58                           ` H.J. Lu
2015-01-07 13:17                         ` H.J. Lu
2015-01-07 14:43                           ` H.J. Lu
2015-01-07 18:50                             ` Cary Coutant
2015-01-26 17:22                               ` H.J. Lu
2015-03-02 16:03                                 ` H.J. Lu
2015-03-09 17:16                                   ` Cary Coutant
2015-03-09 17:22                                     ` H.J. Lu
2015-03-20 15:41                                     ` H.J. Lu
2014-09-11 16:00                   ` gold vs libc Cary Coutant
2014-09-11 16:05                     ` Cary Coutant
2014-09-11 16:45                       ` Rafael Espíndola
2014-09-11 16:21                     ` Ian Lance Taylor
2014-09-11 18:33                     ` Roland McGrath
2014-03-30 18:28 ` Carlos O'Donell

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=20140331214025.E61517447E@topped-with-meat.com \
    --to=roland@hack.frob.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=iant@google.com \
    --cc=libc-alpha@sourceware.org \
    /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).