From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8520 invoked by alias); 15 Jan 2014 12:48:16 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 8492 invoked by uid 48); 15 Jan 2014 12:48:11 -0000 From: "ro at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/59788] Mixing libc and libgcc_s unwinders on 64-bit Solaris 10+/x86 breaks EH Date: Wed, 15 Jan 2014 12:48:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ro at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ro at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.9.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-01/txt/msg01579.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 --- Comment #2 from Rainer Orth --- 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.