Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* static linking of gdb
@ 2020-04-05 10:13 Bernd Edlinger
  2020-04-05 13:17 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Bernd Edlinger @ 2020-04-05 10:13 UTC (permalink / raw)
  To: gdb-patches, Tom Tromey

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.



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-04-06 14:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-05 10:13 static linking of gdb Bernd Edlinger
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox