public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ro at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/59788] New: Mixing libc and libgcc_s unwinders on 64-bit Solaris 10+/x86 breaks EH
Date: Mon, 13 Jan 2014 14:15:00 -0000	[thread overview]
Message-ID: <bug-59788-4@http.gcc.gnu.org/bugzilla/> (raw)

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788

            Bug ID: 59788
           Summary: Mixing libc and libgcc_s unwinders on 64-bit Solaris
                    10+/x86 breaks EH
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: ro at gcc dot gnu.org
          Reporter: ro at gcc dot gnu.org
              Host: i386-pc-solaris2.1[01]
            Target: i386-pc-solaris2.1[01]
             Build: i386-pc-solaris2.1[01]

I've received a few reports in private mail that exception handling on 64-bit
Solaris 10+/x86 is broken when linking with -Bdirect.

The following testcase shows this:

$ cat unwind-direct.cc
#include <stdexcept>

int
main(void)
{
  try
    { throw std::runtime_error( "Catch me if you can!"); }
  catch(...)
    { return 0; }
  return 1;
}
$ g++ -Wl,-Bdirect -m64 -o unwind-direct unwind-direct.cc
$ ./unwind-direct
terminate called after throwing an instance of 'std::runtime_error'
Segmentation Fault (core dumped)

Investigating this with LD_DEBUG=bindings, one finds

$ LD_DEBUG=bindings ./unwind-direct 2>&1 | grep Unwind
03243: 1: binding
file=../../../i386-pc-solaris2.11/amd64/libstdc++-v3/src/.libs/libstdc++.so.6
to file=/lib/64/libc.so.1: symbol '_Unwind_RaiseException'
03243: 1: binding
file=../../../i386-pc-solaris2.11/amd64/libstdc++-v3/src/.libs/libstdc++.so.6
to file=/lib/64/libc.so.1: symbol '_Unwind_GetLanguageSpecificData'
03243: 1: binding
file=../../../i386-pc-solaris2.11/amd64/libstdc++-v3/src/.libs/libstdc++.so.6
to file=/lib/64/libc.so.1: symbol '_Unwind_GetRegionStart'
03243: 1: binding
file=../../../i386-pc-solaris2.11/amd64/libstdc++-v3/src/.libs/libstdc++.so.6
to file=../../amd64/libgcc_s.so.1: symbol '_Unwind_GetIPInfo'
03243: 1: binding
file=../../../i386-pc-solaris2.11/amd64/libstdc++-v3/src/.libs/libstdc++.so.6
to file=../../amd64/libgcc_s.so.1: symbol '_Unwind_Resume_or_Rethrow'
03243: 1: binding file=../../amd64/libgcc_s.so.1 to file=/lib/64/libc.so.1:
symbol '_Unwind_RaiseException'

The problem is that the amd64 Solaris 10+ libc contains an implementation of
the amd64 unwinder, as prescribed by the amd64 ABI, but only those functions
that are listed there.  libgcc_s contains some more, and both implementations
use different internal datastructures, so mixing them wreaks havoc.

This problem has been seen several times during gcc development when it
affected
gcc runtime libraries.

I'm working on a patch to avoid this once and for all by forcing all gcc-built
executables to bind to the unwinder in libgcc_s.

  Rainer


             reply	other threads:[~2014-01-13 14:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-13 14:15 ro at gcc dot gnu.org [this message]
2014-01-13 14:15 ` [Bug target/59788] " ro at gcc dot gnu.org
2014-01-15 12:48 ` ro at gcc dot gnu.org
2014-01-17 14:22 ` ro at gcc dot gnu.org
2014-02-04  9:32 ` ro at gcc dot gnu.org
2014-02-04  9:33 ` ro at gcc dot gnu.org

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=bug-59788-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).