public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hans-Peter Nilsson <hp@bitrange.com>
To: Geoff Keating <geoffk@redhat.com>
Cc: <jsm28@cam.ac.uk>,  <gcc@gcc.gnu.org>
Subject: Re: Regression tester v. runtime libraries
Date: Sat, 22 Dec 2001 20:20:00 -0000	[thread overview]
Message-ID: <Pine.BSF.4.30.0112222014580.70654-100000@dair.pair.com> (raw)
In-Reply-To: <200112222113.NAA03925@geoffk.org>

On Sat, 22 Dec 2001, Geoff Keating wrote:
> > Date: Sun, 16 Dec 2001 00:02:58 -0500 (EST)
> > From: Hans-Peter Nilsson <hp@bitrange.com>
> > On 30 Nov 2001, Geoff Keating wrote:
> > > - libstdc++-v3 got switched off because of a bug in linking C++
> > >   objects compiled with different optimisation levels that would cause
> > >   FAILs to appear and disappear at random; and
> >
> > Is that the gcc <-> binutils mismatch with relocs against
> > symbols in discarded linkonce sections that we discussed on the
> > binutils list some time ago?  (That description certainly
> > matches what I saw then.)
>
> Yes, it's the bug where EH information ends up in the executable for
> linkonce functions that were deleted.

Not a precise enough description for my hair-splitting.
Fixable by s/the executable/some exception helper table
generated at run-time/ though.

I think I should summarize my recollection: the EH information
was (is?) emitted to one and the same section, .eh_frame for all
code, while the code itself would as usual be split into
function-named linkonce-sections for template instantiations and
similar.  The problem was that binutils stopped emitting zero
for relocs to the discarded linkonce code sections (the
duplicate template instantiations) while GCC still expected zero
emitted there, which it would use to filter out EH records for
the discarded sections.  IIRC, the relocated data, in place of
the zero, points to the remaining section, so it looks valid.
This mismatch started with binutils 2.11.  H.J. has imported
the fix into his binutils releases AFAIK.

It was concluded that emitting zero for linkonce-discarded
sections wasn't really right.  Instead, a link error was TRT,
but zero would be continued to be emitted for compatibility with
older GCC for a limited period, until releases of gcc with a new
scheme are abundant, where the EH info for a function is
discarded together with the code.  I haven't checked, but I hope
this new layout scheme is in 3.1.  Hope to do more than hope,
soon I hope.

The mismatch will result in incorrect frame information when
unwinding the stack.  It will be seen as uncaught_exception
(usually leading on to abort) being called IIRC.  This will
happen only if the library and the program are compiled with
different optimization options or different releases of GCC (so
there are different stack frame information for the included and
the excluded linkonce sections), and if a helper table that is
generated at exception-time has the "excluded" EH info entries
at an unfortunate place.  To wit, it'll break if your program
throws an exception and you're (deterministically) unlucky with
the EH info layout.  I don't remember if there are additional
requirements; it may be restricted to only exceptions passing
functions that are part of a template instantiation.  The
scenario can be visualized as using the result of bsearching a
sorted table required to have unique keys, but in fact having
duplicate keys for some entries with bogus data.

Point being, IMHO the regression tester should test libstdc++-v3
too now.  If the EH info layout in GCC isn't "fixed", it should
use binutils CVS (or a release with the zero-emitting fix) for
both the powerpc-sim and native tests.

brgds, H-P
PS.  Happy holidays.

  reply	other threads:[~2001-12-23  3:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-21 13:48 Joseph S. Myers
2001-11-21 15:38 ` Phil Edwards
2001-11-29  8:50   ` Phil Edwards
2001-11-22  0:22 ` Richard Henderson
2001-11-29 14:54   ` Richard Henderson
2001-11-22 13:34 ` Geoff Keating
2001-11-30  0:02   ` Geoff Keating
2001-12-15 21:10   ` Hans-Peter Nilsson
2001-12-22 12:25     ` Geoff Keating
2001-12-22 20:20       ` Hans-Peter Nilsson [this message]
2001-11-29  4:44 ` Joseph S. Myers

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=Pine.BSF.4.30.0112222014580.70654-100000@dair.pair.com \
    --to=hp@bitrange.com \
    --cc=gcc@gcc.gnu.org \
    --cc=geoffk@redhat.com \
    --cc=jsm28@cam.ac.uk \
    /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).