http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
--- Comment #2 from Rainer Orth <ro at gcc dot gnu.org> --- Created attachment 31843 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31843&action=edit initial patch The attached initial patch works fine and fixes the testcase from the PR, but is unacceptable as is. Initially, I attempted to force direct binding to the libgcc_s unwinder by linking with a special mapfile if linking with -lgcc_s. This doesn't work since libtool builds shared libraries with -shared -nostdlib, adding -lgcc_s itself. The second attempt (attached) instead uses that mapfile when -shared is passed. When libtool adds -lgcc_s -lc -lgcc_s itself, it usually `optimizes' this into -lc -lgcc_s. When direct binding is in effect due to the mapfile, we achieve exactly what this patch intends to avoid, namely binding to the partial unwinder in amd64 libc. This can be avoided by patching libtool to disable this optimization on *solaris2*, which this patch does. While this works fine for the gcc runtime libraries, as can be observed with elfdump -y, gcc 4.9 cannot be released with this patch included: even if the libtool (ltmain.sh actually) patch were accepted upstream, every package built with libtool will contain an old copy without that change, causing the breakage this patch is designed to avoid. While the optimization can be avoided by invoking libtool with --preserve-dup-deps, this seem unacceptable, as would requiring users to run libtoolize from a hypothetical new libtool release with the ltmain.sh patch.