FW: Huge binaries

Andrew Haley aph@redhat.com
Mon Feb 21 16:38:00 GMT 2011


On 02/21/2011 03:59 PM, Hite, Christopher wrote:
> Hi, I'm upgrading from 4.4.3  =>  4.5.2 and the size of my already large
> binaries got even bigger.
>
> 60MB - stripped old or new
> 180MB - old release binary with debug info (-g)
> 1200MB - new compiler with same flags
>
> strings are only a small part of the debug info:
> 45MB - strings<binary>
>
> I'm using a bunch of meta-programming.
>
> Did something big happen between these versions?
> Are there any options between the stripped binary and the 1.2GB version?

Debuginfo got better.

> Can I debug a core from a stripped binary using a non-stripped binary?

Yes.  gdb knows how to read separate debuginfo, and objcopy(1) knows how to
extract it.

  $ gcc -g hello.c
  $ objcopy --only-keep-debug hello hello.debug
  $ strip -g hello
  $ objcopy --add-gnu-debuglink=hello.debug hello
  $ gdb hello
GNU gdb (GDB) Fedora (7.2-41.fc14)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/aph/hello...Reading symbols from /home/aph/hello.debug...done.
done.
(gdb) b main
Breakpoint 1 at 0x400508: file hello.c, line 5.
(gdb) r
Starting program: /home/aph/hello

Breakpoint 1, main () at hello.c:5
5	    fprintf(stderr, "Hello, world!\n");



More information about the Gcc-help mailing list