Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Bernd Edlinger <bernd.edlinger@hotmail.de>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	Tom Tromey <tom@tromey.com>
Subject: static linking of gdb
Date: Sun, 5 Apr 2020 12:13:42 +0200	[thread overview]
Message-ID: <AM6PR03MB5170FB7B650637F3795D0D02E4C50@AM6PR03MB5170.eurprd03.prod.outlook.com> (raw)

Hi,

I noticed that gdb is currently not
linking libstdc++ statically, as it did
in the past if I remember correclty.




$ ldd `which gdb`
	linux-vdso.so.1 =>  (0x00007ffe59eb4000)
	libncurses.so.5 => /lib/x86_64-linux-gnu/libncurses.so.5 (0x00007f43f4448000)
	libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f43f4218000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f43f4010000)
	libpython2.7.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 (0x00007f43f3aa8000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f43f3888000)
	libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f43f3680000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f43f3378000)
	libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f43f3148000)
	libstdc++.so.6 => /home/ed/gnu/install/lib64/libstdc++.so.6 (0x00007f43f4698000)
	libgcc_s.so.1 => /home/ed/gnu/install/lib64/libgcc_s.so.1 (0x00007f43f3128000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f43f2d58000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f43f4670000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f43f2b38000)

this means, this gdb that I build here will not run with the libstdc++ version
that is on my system, by default, only with the gcc version that I used to build.

We should use static libraries as much as possible, especially libstdc++ and libgcc
are not always downward compatible and are easy to make the binary unusable.

$ ldd `which gdbserver`
	linux-vdso.so.1 =>  (0x00007ffea4384000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fac78c08000)
	libstdc++.so.6 => /home/ed/gnu/install/lib64/libstdc++.so.6 (0x00007fac78e38000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fac78900000)
	libgcc_s.so.1 => /home/ed/gnu/install/lib64/libgcc_s.so.1 (0x00007fac788e0000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fac786c0000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fac782f0000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fac78e10000)

even gdbserver is not selfcontained.

compare that to gcc:

$ ldd `which gcc`
	linux-vdso.so.1 =>  (0x00007ffee448c000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ffa7da50000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffa7d680000)
	/lib64/ld-linux-x86-64.so.2 (0x00007ffa7dd58000)

which is selfcontained.


All we should do, is at least do add -static-libstdc++ -static-libgcc
to the build rules (when using gcc at least), who knows how to do that,
please do it.


Thanks
Bernd.



             reply	other threads:[~2020-04-05 10:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-05 10:13 Bernd Edlinger [this message]
2020-04-05 13:17 ` Eli Zaretskii
2020-04-05 13:23   ` Bernd Edlinger
2020-04-05 13:48   ` Bernd Edlinger
2020-04-05 14:19     ` Eli Zaretskii
2020-04-05 14:56       ` Bernd Edlinger
2020-04-06  3:27   ` Bernd Edlinger
2020-04-06  7:14     ` Bernd Edlinger
2020-04-06 13:43       ` Tom Tromey
2020-04-06 13:42     ` Tom Tromey
2020-04-06 13:45       ` Bernd Edlinger
2020-04-06 14:11         ` Tom Tromey

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=AM6PR03MB5170FB7B650637F3795D0D02E4C50@AM6PR03MB5170.eurprd03.prod.outlook.com \
    --to=bernd.edlinger@hotmail.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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