From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 95466 invoked by alias); 13 Aug 2019 15:18:53 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 95416 invoked by uid 89); 13 Aug 2019 15:18:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1287 X-HELO: gateway34.websitewelcome.com Received: from gateway34.websitewelcome.com (HELO gateway34.websitewelcome.com) (192.185.148.231) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 13 Aug 2019 15:18:51 +0000 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 0FE2C8C199 for ; Tue, 13 Aug 2019 10:18:50 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id xYZVhs4iR3Qi0xYZVha4zK; Tue, 13 Aug 2019 10:18:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=VgSghgbH9uaGNgxFI1BmD+8ehQcmbj9qf5NjHIWn+j8=; b=Xsldt1oBdvAYfwrn/3/u3bcxvX AjkBwBUQMf3ezgVwQP8BsbHtAXGZ7x8s7jYTbYzKymKZqjbMjgRknM9vpVtXSLkcPnDxy+2I9KK/y ZLnRXAzhl/tlVGh7igdHVCU8j; Received: from 97-122-178-82.hlrn.qwest.net ([97.122.178.82]:33794 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1hxYZV-003zFo-J9; Tue, 13 Aug 2019 10:18:49 -0500 From: Tom Tromey To: Jonathan Wakely Cc: Jeff Law , Tom Tromey , GCC Patches Subject: Re: [PATCH] Add --with-static-standard-libraries to the top level References: <87y307bidk.fsf@tromey.com> <83bc1c24-31cd-7435-4846-b245fa7bb8c0@redhat.com> <20190813104041.GD9487@redhat.com> Date: Tue, 13 Aug 2019 15:49:00 -0000 In-Reply-To: <20190813104041.GD9487@redhat.com> (Jonathan Wakely's message of "Tue, 13 Aug 2019 11:40:41 +0100") Message-ID: <87o90tw0tj.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-08/txt/msg00880.txt.bz2 Jonathan> What I don't understand is why GDB crashes. It should still be able to Jonathan> catch exceptions from a shared library even if linked to libstdc++.a, Jonathan> unless the static libstdc++.a is somehow incompatible with the shared Jonathan> libstdc++.so the shared lib linked to. Jonathan> Is this on GNU/Linux, or something with a different linking model? GNU/Linux, Fedora 29 in particular. I didn't look into why it fails but the gcc docs specifically mention this problem: '-static-libgcc' [...] There are several situations in which an application should use the shared 'libgcc' instead of the static version. The most common of these is when the application wishes to throw and catch exceptions across different shared libraries. In that case, each of the libraries as well as the application itself should use the shared 'libgcc'. I was able to reproduce it with a simple test program: $ cd /tmp $ cat t.cc void thrower() { throw 23; } $ g++ -fPIC -shared -o libt.so t.cc $ cat a.cc extern void thrower (); int main () { try { thrower (); } catch (...) { } return 0; } $ g++ -o a -static-libgcc -static-libstdc++ a.cc -L$(pwd) -lt $ LD_LIBRARY_PATH=$(pwd) ./a Aborted (core dumped) thanks, Tom