1 |
I'm having a somewhat disgusting issue on my Gentoo: binaries are |
2 |
unaccountably large. |
3 |
|
4 |
I'm talking about C programs of my own, so no version related issues |
5 |
whatsoever. The computer is a core i3 with a 32 bit system. |
6 |
|
7 |
Example, for the same program: |
8 |
|
9 |
10275 B on an atom running Slackware 14.1 (gcc 4.8.2) |
10 |
5896 B (same, stripped with strip --strip-unneeded) |
11 |
|
12 |
11675 B on i3, Gentoo, gcc 4.8.3 (with default gcc it was worse) |
13 |
9704 B stripped |
14 |
|
15 |
8207 B on *the same i3 box* running LFS (gcc 4.9.1) |
16 |
5768 B stripped |
17 |
|
18 |
When compiling against dietlibc, the difference is even more shocking |
19 |
(almost double size in Gentoo after stripping). |
20 |
|
21 |
Compiled with: |
22 |
gcc -Os -march=i686 -fomit-frame-pointer -pipe -Wall -pedantic |
23 |
-fdata-sections -ffunction-sections -Wl,--gc-sections |
24 |
-fno-asynchronous-unwind-tables -std=c99 |
25 |
|
26 |
Gentoo: |
27 |
$ gcc -v |
28 |
Using built-in specs. |
29 |
COLLECT_GCC=/usr/i686-pc-linux-gnu/gcc-bin/4.8.3/gcc |
30 |
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-pc-linux-gnu/4.8.3/lto-wrapper |
31 |
Target: i686-pc-linux-gnu |
32 |
Configured with: |
33 |
/var/tmp/portage/sys-devel/gcc-4.8.3/work/gcc-4.8.3/configure |
34 |
--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --prefix=/usr |
35 |
--bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.8.3 |
36 |
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/include |
37 |
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.8.3 |
38 |
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.8.3/man |
39 |
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.8.3/info |
40 |
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/include/g++-v4 |
41 |
--with-python-dir=/share/gcc-data/i686-pc-linux-gnu/4.8.3/python |
42 |
--enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt |
43 |
--disable-werror --with-system-zlib --disable-nls |
44 |
--enable-checking=release --with-bugurl=https://bugs.gentoo.org/ |
45 |
--with-pkgversion='Gentoo 4.8.3' --enable-libstdcxx-time |
46 |
--enable-shared --enable-threads=posix --enable-__cxa_atexit |
47 |
--enable-clocale=gnu --disable-multilib --disable-altivec |
48 |
--disable-fixed-point --with-arch=i686 --enable-targets=all |
49 |
--disable-libgcj --enable-libgomp --disable-libmudflap |
50 |
--disable-libssp --enable-lto --without-cloog |
51 |
Thread model: posix |
52 |
gcc version 4.8.3 (Gentoo 4.8.3) |
53 |
|
54 |
LFS: |
55 |
## gcc -v |
56 |
Using built-in specs. |
57 |
COLLECT_GCC=gcc |
58 |
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-pc-linux-gnu/4.9.1/lto-wrapper |
59 |
Target: i686-pc-linux-gnu |
60 |
Configured with: ../gcc-4.9.1/configure --prefix=/usr |
61 |
--enable-languages=c,c++ --disable-multilib --disable-bootstrap |
62 |
--with-system-zlib |
63 |
Thread model: posix |
64 |
gcc version 4.9.1 (GCC) |
65 |
|
66 |
Slackware: |
67 |
Reading specs from /slash/usr/bin/../lib/gcc/i486-slackware-linux/4.8.2/specs |
68 |
COLLECT_GCC=gcc |
69 |
COLLECT_LTO_WRAPPER=/slash/usr/bin/../libexec/gcc/i486-slackware-linux/4.8.2/lto-wrapper |
70 |
Target: i486-slackware-linux |
71 |
Configured with: ../gcc-4.8.2/configure --prefix=/usr |
72 |
--libdir=/usr/lib --mandir=/usr/man --infodir=/usr/info |
73 |
--enable-shared --enable-bootstrap |
74 |
--enable-languages=ada,c,c++,fortran,go,java,lto,objc |
75 |
--enable-threads=posix --enable-checking=release --enable-objc-gc |
76 |
--with-system-zlib --with-python-dir=/lib/python2.7/site-packages |
77 |
--disable-libunwind-exceptions --enable-__cxa_atexit --enable-libssp |
78 |
--enable-lto --with-gnu-ld --verbose --enable-java-home |
79 |
--with-java-home=/usr/lib/jvm/jre --with-jvm-root-dir=/usr/lib/jvm |
80 |
--with-jvm-jar-dir=/usr/lib/jvm/jvm-exports --with-arch-directory=i386 |
81 |
--with-antlr-jar=/root/slackware-current/source/d/gcc/antlr-runtime-3.4.jar |
82 |
--enable-java-awt=gtk --disable-gtktest --with-arch=i486 |
83 |
--target=i486-slackware-linux --build=i486-slackware-linux |
84 |
--host=i486-slackware-linux |
85 |
Thread model: posix |
86 |
gcc version 4.8.2 (GCC) |
87 |
|
88 |
I'm not elfwise, but I could post something to google drive if needed. |
89 |
|
90 |
TIA |
91 |
|
92 |
Jorge Almeida |