Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Christian Biesinger <cbiesinger@google.com>,
	Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Link to -lssp when available (fixes mingw build)
Date: Thu, 19 Dec 2019 14:19:00 -0000	[thread overview]
Message-ID: <6f19911a-405e-77b5-e543-4fbb8ee80d8a@redhat.com> (raw)
In-Reply-To: <CAPTJ0XH6QyjRv76eL_KD77rEzxYxOtGcGgCfG_zQ8XGFcfgG8A@mail.gmail.com>

On 12/18/19 11:23 PM, Christian Biesinger via gdb-patches wrote:
> On Wed, Dec 18, 2019 at 5:12 PM Eli Zaretskii <eliz@gnu.org> wrote:
>>
>>> From: "Christian Biesinger via gdb-patches" <gdb-patches@sourceware.org>
>>> Date: Wed, 18 Dec 2019 14:40:42 -0600
>>> Cc: gdb-patches <gdb-patches@sourceware.org>a lot of
>>>
>>> BTW -- you mentioned a licensing issue with depending on DLLs. Doesn't
>>> libstdc++ and perhaps others have the same issue? Or does mingw.org
>>> link it statically?
>>
>> 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.  What I've said in the past is that GDB
inherited the -static-libstdc++ and -static-libgcc from GCC, due to
the shared top level configure:

  https://sourceware.org/ml/gdb-patches/2019-07/msg00040.html

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.

I think a NEWS entry for that switch would be helpful, though.

> 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

Thanks,
Pedro Alves


  reply	other threads:[~2019-12-19 14:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-18 18:14 Christian Biesinger via gdb-patches
2019-12-18 18:23 ` Christian Biesinger via gdb-patches
2019-12-18 18:45 ` Eli Zaretskii
2019-12-18 18:57   ` Christian Biesinger via gdb-patches
2019-12-18 19:07     ` [PATCH v2] Don't define _FORTIFY_SOURCE on mingw Christian Biesinger via gdb-patches
2020-01-02 11:31       ` Joel Brobecker
2020-01-07 23:43         ` Christian Biesinger via gdb-patches
2020-01-08  3:30           ` Eli Zaretskii
2020-01-09 22:23           ` Tom Tromey
2020-01-09 22:32             ` Christian Biesinger via gdb-patches
2020-01-10  0:28               ` Tom Tromey
2019-12-18 19:08     ` [PATCH] Link to -lssp when available (fixes mingw build) Eli Zaretskii
2019-12-18 19:12       ` Christian Biesinger via gdb-patches
2019-12-18 19:40         ` Eli Zaretskii
2019-12-18 19:50           ` Christian Biesinger via gdb-patches
2019-12-18 19:57             ` Eli Zaretskii
2019-12-18 20:41               ` Christian Biesinger via gdb-patches
2019-12-18 23:12                 ` Eli Zaretskii
2019-12-18 23:24                   ` Christian Biesinger via gdb-patches
2019-12-19 14:19                     ` Pedro Alves [this message]
2019-12-19 15:49                       ` Eli Zaretskii
2020-02-15 14:06                         ` Eli Zaretskii
2019-12-19 20:41                       ` Christian Biesinger via gdb-patches
2019-12-19 15:32                     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6f19911a-405e-77b5-e543-4fbb8ee80d8a@redhat.com \
    --to=palves@redhat.com \
    --cc=cbiesinger@google.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox