From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75404 invoked by alias); 19 Dec 2019 15:49:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 75396 invoked by uid 89); 19 Dec 2019 15:49:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00,KAM_SHORT,SPF_PASS autolearn=ham version=3.3.1 spammy=Linking, HX-Languages-Length:2419 X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (209.51.188.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Dec 2019 15:49:38 +0000 Received: from fencepost.gnu.org ([2001:470:142:3::e]:35327) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ihy3U-0005qG-4B; Thu, 19 Dec 2019 10:49:36 -0500 Received: from [176.228.60.248] (port=3294 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ihy3T-0003ox-6b; Thu, 19 Dec 2019 10:49:35 -0500 Date: Thu, 19 Dec 2019 15:49:00 -0000 Message-Id: <83pngk1fjs.fsf@gnu.org> From: Eli Zaretskii To: Pedro Alves CC: cbiesinger@google.com, gdb-patches@sourceware.org In-reply-to: <6f19911a-405e-77b5-e543-4fbb8ee80d8a@redhat.com> (message from Pedro Alves on Thu, 19 Dec 2019 14:19:45 +0000) Subject: Re: [PATCH] Link to -lssp when available (fixes mingw build) References: <20191218181413.128412-1-cbiesinger@google.com> <83h81x323k.fsf@gnu.org> <83fthh310d.fsf@gnu.org> <83eex12zj1.fsf@gnu.org> <83d0cl2yqd.fsf@gnu.org> <83bls52w6e.fsf@gnu.org> <6f19911a-405e-77b5-e543-4fbb8ee80d8a@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-IsSubscribed: yes X-SW-Source: 2019-12/txt/msg00817.txt.bz2 > Cc: gdb-patches > From: Pedro Alves > Date: Thu, 19 Dec 2019 14:19:45 +0000 > > >> libstdc++ and libgcc DLLs indeed have the same problem. Which is why > >> I mentioned the fact that the binary of GDB 9.0.90 produced by the > >> MinGW build had dependencies on these two. I solved that locally by > >> linking with "CXX='g++ -static-libstdc++ -static-libgcc'", but I > >> thought Pedro once said these dependencies shouldn't happen, and I > >> still hope we could understand why they suddenly appeared. > > > > Hm, I wonder why Pedro said that. GDB uses good amounts of the C++ > > standard library, so I would totally expect libstdc++ to appear. > > There's some confusion going on here. We must certainly link with > libstdc++ somehow. The only question is whether we link to the > dynamic or static version. Right. Sorry if I inadvertently caused this confusion. > Linking with static versions of the runtime is problematic if we also link > with some other library that is itself linked with a different libstdc++. > Multiple versions of libstc++/libgcc in a program is a recipe for disaster, > such as for example C++ exceptions not working properly. Discussions about > this started a few years ago when we switched to C++. E.g.: > > https://sourceware.org/ml/gdb-patches/2017-02/msg00705.html > > That is why the top level configure was recently changed to avoid the > -static-libstc++/-static-libgcc: > > https://gcc.gnu.org/ml/gcc-patches/2019-08/msg00287.html > > Note that the patch added a new --with-static-standard-libraries > configure switch which you can use to get back the previous behavior > of linking with the static versions of the standard libraries. Ah, okay, so I need to use that configure option. (The original problem with exceptions thrown across shared libraries doesn't exist in my build, because no C++-compiled shared library is used, they all are linked statically.) > I think a NEWS entry for that switch would be helpful, though. Right, that would be helpful. > > I don't really know what libgcc is used for. > > libgcc is GCC's low-level runtime library. It's an essential part > of any program compiled by GCC: > https://gcc.gnu.org/onlinedocs/gccint/Libgcc.html Not every GCC complied program needs it, IME, but whenever libstdc++ is linked in, so is libgcc.