Gentoo Archives: gentoo-user

From: Daniel Troeder <daniel@×××××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] bloated by gcc
Date: Mon, 29 Sep 2014 16:36:08
Message-Id: 54298A6B.7060309@admin-box.com
In Reply to: [gentoo-user] bloated by gcc by Jorge Almeida
1 Am 28.09.2014 um 10:44 schrieb Jorge Almeida:
2 > I'm having a somewhat disgusting issue on my Gentoo: binaries are
3 > unaccountably large.
4 >
5 > I'm talking about C programs of my own, so no version related issues
6 > whatsoever. The computer is a core i3 with a 32 bit system.
7 >
8 > Example, for the same program:
9 >
10 > 10275 B on an atom running Slackware 14.1 (gcc 4.8.2)
11 > 5896 B (same, stripped with strip --strip-unneeded)
12 >
13 > 11675 B on i3, Gentoo, gcc 4.8.3 (with default gcc it was worse)
14 > 9704 B stripped
15 >
16 > 8207 B on *the same i3 box* running LFS (gcc 4.9.1)
17 > 5768 B stripped
18 >
19 > When compiling against dietlibc, the difference is even more shocking
20 > (almost double size in Gentoo after stripping).
21 >
22 > Compiled with:
23 > gcc -Os -march=i686 -fomit-frame-pointer -pipe -Wall -pedantic
24 > -fdata-sections -ffunction-sections -Wl,--gc-sections
25 > -fno-asynchronous-unwind-tables -std=c99
26 >
27 > Gentoo:
28 > $ gcc -v
29 > Using built-in specs.
30 > COLLECT_GCC=/usr/i686-pc-linux-gnu/gcc-bin/4.8.3/gcc
31 > COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-pc-linux-gnu/4.8.3/lto-wrapper
32 > Target: i686-pc-linux-gnu
33 > Configured with:
34 > /var/tmp/portage/sys-devel/gcc-4.8.3/work/gcc-4.8.3/configure
35 > --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --prefix=/usr
36 > --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.8.3
37 > --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/include
38 > --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.8.3
39 > --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.8.3/man
40 > --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.8.3/info
41 > --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/include/g++-v4
42 > --with-python-dir=/share/gcc-data/i686-pc-linux-gnu/4.8.3/python
43 > --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt
44 > --disable-werror --with-system-zlib --disable-nls
45 > --enable-checking=release --with-bugurl=https://bugs.gentoo.org/
46 > --with-pkgversion='Gentoo 4.8.3' --enable-libstdcxx-time
47 > --enable-shared --enable-threads=posix --enable-__cxa_atexit
48 > --enable-clocale=gnu --disable-multilib --disable-altivec
49 > --disable-fixed-point --with-arch=i686 --enable-targets=all
50 > --disable-libgcj --enable-libgomp --disable-libmudflap
51 > --disable-libssp --enable-lto --without-cloog
52 > Thread model: posix
53 > gcc version 4.8.3 (Gentoo 4.8.3)
54 >
55 > LFS:
56 > ## gcc -v
57 > Using built-in specs.
58 > COLLECT_GCC=gcc
59 > COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-pc-linux-gnu/4.9.1/lto-wrapper
60 > Target: i686-pc-linux-gnu
61 > Configured with: ../gcc-4.9.1/configure --prefix=/usr
62 > --enable-languages=c,c++ --disable-multilib --disable-bootstrap
63 > --with-system-zlib
64 > Thread model: posix
65 > gcc version 4.9.1 (GCC)
66 >
67 > Slackware:
68 > Reading specs from /slash/usr/bin/../lib/gcc/i486-slackware-linux/4.8.2/specs
69 > COLLECT_GCC=gcc
70 > COLLECT_LTO_WRAPPER=/slash/usr/bin/../libexec/gcc/i486-slackware-linux/4.8.2/lto-wrapper
71 > Target: i486-slackware-linux
72 > Configured with: ../gcc-4.8.2/configure --prefix=/usr
73 > --libdir=/usr/lib --mandir=/usr/man --infodir=/usr/info
74 > --enable-shared --enable-bootstrap
75 > --enable-languages=ada,c,c++,fortran,go,java,lto,objc
76 > --enable-threads=posix --enable-checking=release --enable-objc-gc
77 > --with-system-zlib --with-python-dir=/lib/python2.7/site-packages
78 > --disable-libunwind-exceptions --enable-__cxa_atexit --enable-libssp
79 > --enable-lto --with-gnu-ld --verbose --enable-java-home
80 > --with-java-home=/usr/lib/jvm/jre --with-jvm-root-dir=/usr/lib/jvm
81 > --with-jvm-jar-dir=/usr/lib/jvm/jvm-exports --with-arch-directory=i386
82 > --with-antlr-jar=/root/slackware-current/source/d/gcc/antlr-runtime-3.4.jar
83 > --enable-java-awt=gtk --disable-gtktest --with-arch=i486
84 > --target=i486-slackware-linux --build=i486-slackware-linux
85 > --host=i486-slackware-linux
86 > Thread model: posix
87 > gcc version 4.8.2 (GCC)
88 >
89 > I'm not elfwise, but I could post something to google drive if needed.
90 >
91 > TIA
92 >
93 > Jorge Almeida
94 >
95 Hi :)
96
97 I have compared some exes and libs from Ubuntu 14.04 and my Gentoo (both
98 x86_64) and for similar versions it seems like most of _my_ Gentoo
99 binaries are around 10% bigger (a few are 10% smaller). I have
100 completely ignored GCC settings (both are 4.8.x though). IMO your sample
101 (one 5-10 kb program) is not representative for the distro in general.
102
103 I compared:
104 /bin/bash
105 /usr/bin/xterm
106 /bin/bzip2
107 /bin/gzip
108 /usr/bin/xz
109 /usr/bin/xev
110 /usr/lib/libaspell.so
111 /usr/lib/libdaemon.so
112
113 IMO you shouldn't compare 4.8.x with 4.9.x.
114
115 I don't want to dismiss your concern with your specific program. In your
116 case it is a big difference, and I'm curios too, where it comes from.
117
118 Maybe you can find out more by a more thorough comparation of the flags
119 GCC uses at runtime by comparing the output of:
120
121 gcc -Q <your flags (w/o -pipe)> --help=target
122 gcc -Q <your flags (w/o -pipe)> --help=optimizers
123
124 (Find more --help=____ in the man page.)
125
126
127 Greetings
128 Daniel
129
130
131 --
132 Get my PGP key at:
133 *
134 http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x837FB8B5BB9D4887
135 * $ gpg --recv-keys --keyserver keyserver.ubuntu.com 0xBB9D4887

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] bloated by gcc Jorge Almeida <jjalmeida@×××××.com>
Re: [gentoo-user] bloated by gcc Stroller <stroller@××××××××××××××××××.uk>