public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bryce McKinlay <bmckinlay@gmail.com>
To: gcc@gcc.gnu.org, java@gcc.gnu.org,
	Jack Howarth <howarth@bromo.med.uc.edu>
Subject: _darwin10_Unwind_FindEnclosingFunction
Date: Mon, 23 Jul 2012 11:24:00 -0000	[thread overview]
Message-ID: <CALUNu-rAQF1da1HT7=nLijCn2kNt6aXaEq1DXqMdUPrRBysVsQ@mail.gmail.com> (raw)

libgcc_s and libgcj contain a hack which renames
_Unwind_FindEnclosingFunction to
_darwin10_Unwind_FindEnclosingFunction on darwin targets. It appears
this was introduced to work around an issue in OS X 10.6 where the
_Unwind_FindEnclosingFunction was implemented as a stub which called
abort(). see: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41991

This has since been fixed in OS X 10.7+, and the system's
_Unwind_FindEnclosingFunction now works.

In Mac OS X 10.7 and 10.8, libgcc_s is installed as a symlink to libSystem:

$ ls -l /usr/lib/libgcc_s.1.dylib
lrwxr-xr-x 1 root wheel 17 Jun 19 13:16 /usr/lib/libgcc_s.1.dylib ->
libSystem.B.dylib

Unfortunately this means that libgcj does not work on a standard Mac
OS X installation, because dyld will see the symlink and resolve
libgcc_s to libSystem before it checks anywhere else:

$ gcj Hello.class --main=Hello
$ ./a.out
dyld: _dyld_bind_fully_image_containing_address() error
dyld: Symbol not found: __darwin10_Unwind_FindEnclosingFunction
  Referenced from: /usr/local/lib/libgcj.13.dylib
  Expected in: /usr/lib/libSystem.B.dylib
 in /usr/local/lib/libgcj.13.dylib
Trace/BPT trap: 5

This can be worked around by adjusting the system library path, or
forcing libgcc_s to be loaded with DYLD_INSERT_LIBRARIES, but libgcj
should work out-of-the-box for without having to hack the dyld
configuration - so clearly we should not be renaming
_Unwind_FindEnclosingFunction on OS X 10.7+ configurations.

But I'm not convinced that this solution was ever really right to
begin with. Even on a 10.6 system, things ought to work so long as you
ensure libgcc_s is loaded before libSystem. Shouldn't the
_darwin10_Unwind_FindEnclosingFunction rename be removed entirely?

Bryce

             reply	other threads:[~2012-07-23 11:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-23 11:24 Bryce McKinlay [this message]
2012-07-26 13:44 ` _darwin10_Unwind_FindEnclosingFunction Jack Howarth

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='CALUNu-rAQF1da1HT7=nLijCn2kNt6aXaEq1DXqMdUPrRBysVsQ@mail.gmail.com' \
    --to=bmckinlay@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=howarth@bromo.med.uc.edu \
    --cc=java@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).