From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Pedro Alves <palves@redhat.com>, Paul_Koning@Dell.com
Cc: Tom Tromey <tromey@redhat.com>, gdb@sourceware.org
Subject: Re: Will therefore GDB utilize C++ or not?
Date: Sat, 26 May 2012 15:50:00 -0000 [thread overview]
Message-ID: <20120526155005.GA30091@host2.jankratochvil.net> (raw)
In-Reply-To: <03B278D5-20FA-48DD-BAE1-B49019FA30C4@Dell.com> <4FBA6583.5000002@redhat.com>
On Mon, 21 May 2012 17:55:47 +0200, Pedro Alves wrote:
> However, I'll note that such comparisons assume an unchanged C-style codebase,
> and ignore the size increase you get when you actually start using C++
> features, such as, throwing exceptions, or using iostream. In my quick
> experiment adding a cout << "foo" (-static-libstdc++ -flto -Os + strip) more
> than triples the binary size.
FSF GDB HEAD plain C build:
x86_64 -Os -flto gcc (GCC) 4.7.1 20120526 (prerelease)
linux-vdso.so.1 => (0x00007fff4b093000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fb835780000)
libc.so.6 => /lib64/libc.so.6 (0x00007fb8353c8000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb835994000)
-rwxr-xr-x 1 jkratoch jkratoch 265000 May 26 16:05 gdbserver*
After adding that cout I really get ~1.1MB bytes build. But iostream is not
useful for gdbserver.
With the useful C++ features exploited by
#include <vector>
#include <unordered_map>
#include <string>
{
unordered_map<string, string> foo;
foo["bar"] = "b";
vector<string> bar;
try {
throw 0;
} catch (int e) {
bar.push_back(string("bar"));
}
}
I get:
x86_64 -Os -flto gcc (GCC) 4.7.1 20120526 (prerelease)
linux-vdso.so.1 => (0x00007fff084b5000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fa35d6e8000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fa35d3e4000)
libm.so.6 => /lib64/libm.so.6 (0x00007fa35d0e9000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fa35ced4000)
libc.so.6 => /lib64/libc.so.6 (0x00007fa35cb1c000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa35d8fc000)
-rwxr-xr-x 1 jkratoch jkratoch 285816 May 26 16:50 gdbserver*
With linking statically the additional libraries the C build has not depended
upon:
x86_64 -Os -flto gcc (GCC) 4.7.1 20120526 (prerelease)
linux-vdso.so.1 => (0x00007fffee9ff000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f54fbf07000)
libc.so.6 => /lib64/libc.so.6 (0x00007f54fbb4f000)
/lib64/ld-linux-x86-64.so.2 (0x00007f54fc11b000)
-rwxr-xr-x 1 jkratoch jkratoch 453728 May 26 17:22 gdbserver*
453728 vs. 265000 bytes is +71% increase.
It still seems perfectly worth to me for all the discussed C++ benefits for GDB.
(Maybe one could also look for some inadvertent libraries parts brought in.)
On Tue, 22 May 2012 20:03:41 +0200, Paul_Koning@Dell.com wrote:
> > On Mon, 21 May 2012 19:36:57 +0200, Paul_Koning@Dell.com wrote:
> > > I'm working on a system where the boot device has about a megabyte free
> > > space, on a good day.
> It's a NetBSD/MIPS64 derivative embedded system. No other secondary storage
> for code.
I have used gcc42.fsffrance.org producing:
gdbserver: ELF 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV), for GNU/Linux 2.6.8, dynamically linked (uses shared libs), stripped
FSF GDB HEAD plain C build:
mips32 -Os gcc (RAYS 4.3.0-4.rays0) 4.3.1 20080501 (prerelease)
libdl.so.2 => /lib/libdl.so.2 (0x2aaec000)
libc.so.6 => /lib/libc.so.6 (0x2ab00000)
/lib/ld.so.1 (0x2aaa8000)
-rwxr-xr-x 1 jankratochvil jankratochvil 306092 2012-05-26 05:12 gdbserver*
With the <vector>/<unordered_map>/<string> C++ features I get:
libdl.so.2 => /lib/libdl.so.2 (0x2aaec000)
libc.so.6 => /lib/libc.so.6 (0x2ab00000)
/lib/ld.so.1 (0x2aaa8000)
-rwxr-xr-x 1 jankratochvil jankratochvil 846668 2012-05-26 17:44 gdbserver*
The size increase is primarily due to libm.a, with libm.so I get:
libdl.so.2 => /lib/libdl.so.2 (0x2aaec000)
libm.so.6 => /lib/libm.so.6 (0x2ab00000)
libc.so.6 => /lib/libc.so.6 (0x2ab98000)
/lib/ld.so.1 (0x2aaa8000)
-rwxr-xr-x 1 jankratochvil jankratochvil 462188 2012-05-26 17:41 gdbserver*
I believe we can get mips under 500KB as libm should not be needed anywhere.
For 64-bit mips64:
When I used CFLAGS="-Os -mips64 -mabi=64" there producing:
gdbserver: ELF 64-bit LSB executable, MIPS, MIPS32 version 1 (SYSV), for GNU/Linux 2.6.8, dynamically linked (uses shared libs), not stripped
I did not have static 64-bit libstdc++ available on gcc42.fsffrance.org. I had
some issues building mips64 toolchain and I did not spend too much time on it.
64-bit libstdc++.so would work but it would not provide the size benchmark
numbers here. 64-bit FSF GDB HEAD gdbserver was 289496 bytes (instead of
32-bit 306092) so 64-bit mips build size numbers should not be in disadvantage.
Thanks,
Jan
next prev parent reply other threads:[~2012-05-26 15:50 UTC|newest]
Thread overview: 116+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-30 16:14 Jan Kratochvil
2012-04-04 20:48 ` Tom Tromey
2012-04-04 21:55 ` Mark Kettenis
2012-04-05 3:31 ` Sergio Durigan Junior
2012-04-05 11:46 ` Phil Muldoon
2012-04-06 0:35 ` Will therefore GDB utilize C++? Not John Gilmore
2012-04-06 1:35 ` Russell Shaw
2012-04-06 13:16 ` Joel Brobecker
2012-04-06 14:43 ` Russell Shaw
2012-04-06 15:34 ` Michael Eager
2012-04-06 23:32 ` John Gilmore
2012-04-07 1:04 ` Robert Dewar
2012-04-07 1:52 ` Thomas Dineen
2012-04-07 16:54 ` Michael Eager
2012-04-09 23:59 ` Stan Shebs
2012-04-05 0:22 ` Will therefore GDB utilize C++ or not? asmwarrior
2012-04-09 18:41 ` Pedro Alves
2012-04-09 19:05 ` Jan Kratochvil
2012-04-09 19:49 ` Pedro Alves
2012-04-09 20:15 ` Paul Smith
2012-04-12 20:06 ` Daniel Jacobowitz
2012-04-12 21:28 ` Paul_Koning
2012-04-13 0:04 ` Doug Evans
2012-04-18 14:10 ` Pedro Alves
2012-04-18 20:27 ` Tom Tromey
2012-04-18 14:08 ` Pedro Alves
2012-04-21 17:24 ` Daniel Jacobowitz
2012-04-16 6:55 ` Jan Kratochvil
2012-04-18 14:11 ` Pedro Alves
2012-04-18 15:16 ` Jan Kratochvil
2012-04-18 15:28 ` Pedro Alves
2012-04-18 15:54 ` Jan Kratochvil
2012-04-18 16:01 ` Pedro Alves
2012-04-18 16:07 ` Joel Brobecker
2012-04-18 16:13 ` Jan Kratochvil
2012-04-18 16:23 ` Joel Brobecker
2012-04-18 16:31 ` Joel Sherrill
2012-04-18 16:50 ` Pedro Alves
2012-04-18 16:57 ` Joel Brobecker
2012-04-18 17:28 ` Joel Sherrill
2012-04-18 17:40 ` Paul_Koning
2012-04-18 20:37 ` Frank Ch. Eigler
2012-04-18 20:38 ` Paul_Koning
2012-04-18 20:36 ` Tom Tromey
2012-04-18 17:48 ` John Gilmore
2012-04-18 19:07 ` Tom Tromey
2012-04-18 23:10 ` John Gilmore
2012-05-18 18:36 ` Tom Tromey
2012-05-18 18:47 ` Paul_Koning
2012-05-18 19:36 ` Tom Tromey
2012-05-18 19:44 ` Paul_Koning
2012-05-18 20:07 ` Tom Tromey
2012-05-18 20:41 ` Aurelian Melinte
2012-05-18 18:51 ` Lazy CU expansion (Was: Will therefore GDB utilize C++ or not?) Tom Tromey
2012-04-18 20:34 ` Will therefore GDB utilize C++ or not? Tom Tromey
2012-04-18 19:18 ` Will C++ proponents spend 20 minutes to try what they're proposing? John Gilmore
2012-04-18 19:23 ` Jan Kratochvil
2012-04-18 20:40 ` Tom Tromey
2012-04-18 20:56 ` Mike Frysinger
2012-04-18 20:31 ` Will therefore GDB utilize C++ or not? Tom Tromey
2012-04-18 20:25 ` Tom Tromey
2012-05-21 18:11 ` Pedro Alves
2012-05-21 18:36 ` Jan Kratochvil
2012-11-21 20:18 ` Jan Kratochvil
2012-04-10 0:23 ` Yao Qi
2012-04-10 9:47 ` Yao Qi
2012-04-18 20:11 ` Tom Tromey
2012-04-18 20:31 ` Can it really be ok to map GPL'd code into any old process? John Gilmore
2012-04-18 20:36 ` Pedro Alves
2012-04-23 18:03 ` Will therefore GDB utilize C++ or not? Tom Tromey
2012-05-18 19:55 ` Tom Tromey
2012-05-18 21:56 ` Joel Brobecker
2012-05-19 2:17 ` Tom Tromey
2012-05-19 15:21 ` Daniel Jacobowitz
2012-05-19 21:36 ` Joel Brobecker
2012-05-20 12:16 ` Frank Ch. Eigler
2012-05-21 15:56 ` Pedro Alves
2012-05-21 16:15 ` Jan Kratochvil
2012-05-21 17:37 ` Paul_Koning
2012-05-21 17:58 ` Jan Kratochvil
2012-05-22 18:03 ` Paul_Koning
2012-05-21 18:08 ` Pedro Alves
2012-05-21 18:08 ` Tom Tromey
2012-05-21 18:10 ` Jan Kratochvil
2012-05-21 18:54 ` Matt Rice
2012-05-26 15:50 ` Jan Kratochvil [this message]
2012-06-02 7:01 ` Russell Shaw
2012-06-02 7:13 ` Jan Kratochvil
2012-06-02 10:47 ` Russell Shaw
2012-06-02 11:10 ` Jan Kratochvil
2012-06-02 11:15 ` Russell Shaw
2012-06-02 11:15 ` Jan Kratochvil
2012-11-22 18:46 ` Jan Kratochvil
2012-11-22 21:42 ` John Gilmore
2012-11-23 15:26 ` Jan Kratochvil
2012-11-27 1:29 ` Stan Shebs
2012-11-27 2:02 ` Paul_Koning
2012-11-27 2:59 ` Stan Shebs
2012-11-27 15:17 ` Paul_Koning
2012-11-27 21:14 ` Tom Tromey
2012-04-09 23:23 ` Stan Shebs
2012-04-18 14:22 ` Pedro Alves
2012-04-18 18:12 ` Stan Shebs
2012-04-18 18:32 ` Paul_Koning
2012-04-18 18:37 ` Pedro Alves
2012-04-19 8:43 ` Yao Qi
2012-12-04 14:17 ` Jan Kratochvil
2012-12-04 14:44 ` Mark Kettenis
2012-12-04 14:52 ` Jan Kratochvil
2012-12-06 20:39 ` Matt Rice
2012-12-07 12:57 ` Jan Kratochvil
2012-12-07 13:25 ` Yao Qi
2012-12-11 6:25 ` Matt Rice
2012-12-13 15:12 ` Jan Kratochvil
2012-12-14 11:03 ` Matt Rice
2012-12-14 12:16 ` Jan Kratochvil
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=20120526155005.GA30091@host2.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=Paul_Koning@Dell.com \
--cc=gdb@sourceware.org \
--cc=palves@redhat.com \
--cc=tromey@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).