In the Apple linker (ld64), when something goes wrong (e.g. no arguments), an exception is thrown. Normally, ld64 has a top-level handler that catches it and prints a diagnostic. In the Gentoo version, however, exceptions are left unhandled. As a result, ld64 "crashes" and the CrashReporter pops up. The CrashReporter dialog is annoying, and it gives a sense that something is horribly wrong with ld64. I have no idea why exceptions are left unhandled; nothing in the patchfiles indicates any exception handlers being removed. All I know is that the default Xcode linker does not have this problem, and the Gentoo linker does. Reproducible: Always Steps to Reproduce: 1. Run ld (from binutils-apple) with no arguments 2. Wait for crash Actual Results: ld64 throws an exception and lets it go. libstdc++ calls std::terminate() which calls std::abort(). The system detects this and pops up the CrashReporter dialog. Expected Results: ld64 should still throw the exception, but instead of leaving it unhandled, it should catch it and display a diagnostic. Mac OS X 10.6.4 (was .3 when I bootstrapped the prefix). Xcode Tools 3.2.3 (beta 4). Portage 2.2.00.15842-prefix (prefix/darwin/macos/10.6/x86, gcc-4.2.1, unavailable, 10.4.0 i386) ================================================================= System Settings ================================================================= System uname: Darwin-10.4.0-i386-32bit Timestamp of tree: Sun, 20 Jun 2010 01:40:08 +0000 distcc 3.1-toolwhip.1 i386-apple-darwin10.0 [disabled] app-shells/bash: 4.0_p38 dev-lang/python: 2.6.5-r2 dev-util/cmake: 2.8.1-r2 sys-devel/autoconf: 2.65 sys-devel/automake: 1.11.1 sys-devel/gcc-config: 1.4.1-r00.2 sys-devel/libtool: 2.2.6b ACCEPT_KEYWORDS="~x86-macos" ACCEPT_LICENSE="* -@EULA" CBUILD="i686-apple-darwin10" CFLAGS="-O2 -pipe -march=core2" CHOST="i686-apple-darwin10" CONFIG_PROTECT="/etc" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo" CXXFLAGS="-O2 -pipe -march=core2" DISTDIR="/Users/chip/Gentoo/usr/portage/distfiles" FEATURES="assume-digests collision-protect distlocks fixpackages news nostrip parallel-fetch preserve-libs protect-owned sfperms strict unmerge-logs unmerge-orphans userfetch" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="en_US.UTF-8" LDFLAGS="" PKGDIR="/Users/chip/Gentoo/usr/portage/packages" PORTAGE_CONFIGROOT="/Users/chip/Gentoo/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/Users/chip/Gentoo/var/tmp" PORTDIR="/Users/chip/Gentoo/usr/portage" SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix" USE="aqua bash-completion berkdb coreaudio cracklib crypt curl cxx expat extensions gdbm gnutls gpg iconv icu lzma lzo mmx mmxext modules mysql ncurses nls objc objc++ perl prefix python readline ruby sql sqlite3 sse sse2 ssl subversion tcl threads tk unicode x86-macos zlib" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="Darwin" INPUT_DEVICES="keyboard mouse" KERNEL="Darwin" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" RUBY_TARGETS="ruby18" USERLAND="GNU" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY ================================================================= Package Settings ================================================================= sys-devel/binutils-apple-3.2.2 was built with the following: USE="(prefix) -test"
This has to do with Apple not giving us the LibUnwind they use to do this IIRC. I never saw the crasreporter app, and concur it is indeed very annoying.
I doubt it will help, but does 3.2.3 change anything?
(In reply to comment #2) > I doubt it will help, but does 3.2.3 change anything? > Nope.
(In reply to comment #3) > (In reply to comment #2) > > I doubt it will help, but does 3.2.3 change anything? > > > > Nope. > You'll either need to use a pre-90.x ld64 or the hosts one. Our ld64 > 90.x uses a patch, that makes it compile, but removes all calls to libunwind (which would set up the eh_frame for the new unwind format). Long story short: C++ Exceptions are currently broken for at least X.6. You're welcome to write a drop-in replacement for that closed libunwind :)
> You'll either need to use a pre-90.x ld64 or the hosts one. Our ld64 > 90.x > uses a patch, that makes it compile, but removes all calls to libunwind (which > would set up the eh_frame for the new unwind format). Long story short: C++ > Exceptions are currently broken for at least X.6. > > You're welcome to write a drop-in replacement for that closed libunwind :) > Another way could be adding the (undocumented) ld option '-no_compact_unwind'. Then no __unwind_info section is created and the unwinding would be done the old-fashioned slow way.
hmmm, maybe it's worth making this the default in the sources, or hacking the ld wrapper to add this flag to make things at least work.
(In reply to comment #6) > hmmm, maybe it's worth making this the default in the sources, or hacking the > ld wrapper to add this flag to make things at least work. > Me thought the same: [master d586e0e] Stop ld64 from even trying to write __unwind_info for now. Before: [ticktock][tests] >> ./exc.prefix_hostlib terminate called after throwing an instance of 'char*' Abort trap After: [ticktock][tests] >> ./exc.prefix_hostlib Exception caught Tested against host's libstdc++ since i haven't gotten around to recompile gcc-apple, yet, though the result should be the same.
I released heiko's patch in binutils-apple-3.2.3-r1
(In reply to comment #8) > I released heiko's patch in binutils-apple-3.2.3-r1 > You're fast :) Just finished gcc-apple recompilation. Behavior is as expected: Before: [ticktock][tests] >> ./exc.prefix_prefixlib terminate called after throwing an instance of 'char*' Abort trap After: [ticktock][tests] >> ./exc.prefix_prefixlib Exception caught YAY! :)
(In reply to comment #8) > I released heiko's patch in binutils-apple-3.2.3-r1 > To get an un-screwed ld64 you need to: # Get the fixed output of ld64 emerge -1 binutils-apple # Get a fixed libsdtc++ emerge -1 gcc-apple # Get a fixed ld64 which links against the above libstdc++ emerge -1 binutils-apple [ticktock][~] >> ld ld: warning: -arch not specified got unhandled exception: no object files specified ld: no object files specified for inferred architecture x86_64 Grobian, you need to remove the 'message before abort' patch to remove the (now) redundant second output line :)
crap, so my simple revbump wasn't enough/necessary basically :(
(In reply to comment #10) > Grobian, you need to remove the 'message before abort' patch to remove the > (now) redundant second output line :) Your wishes are fulfilled, master. *bow*
I thought we fixed this in the meanwhile.
Closing.