From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id CD50C1393EA for ; Sun, 28 Sep 2014 23:09:42 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 98D44E0923; Sun, 28 Sep 2014 23:09:36 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 39AB0E087C for ; Sun, 28 Sep 2014 23:09:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id F2ADB34016F for ; Sun, 28 Sep 2014 23:09:33 +0000 (UTC) X-Virus-Scanned: by amavisd-new using ClamAV at gentoo.org X-Spam-Flag: NO X-Spam-Score: 2.11 X-Spam-Level: ** X-Spam-Status: No, score=2.11 tagged_above=-999 required=5.5 tests=[AWL=0.353, DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, FSL_HELO_BARE_IP_2=1, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_NUMERIC_HELO=0.865, RP_MATCHES_RCVD=-0.608, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=no Received: from smtp.gentoo.org ([IPv6:::ffff:127.0.0.1]) by localhost (smtp.gentoo.org [IPv6:::ffff:127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hv7nWssigiGH for ; Sun, 28 Sep 2014 23:09:28 +0000 (UTC) Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B1DA733BE3A for ; Sun, 28 Sep 2014 23:09:27 +0000 (UTC) Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XYMSR-0002A0-5s for gentoo-user@gentoo.org; Sun, 28 Sep 2014 23:56:43 +0200 Received: from 216.240.144.2 ([216.240.144.2]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 28 Sep 2014 23:56:43 +0200 Received: from w41ter by 216.240.144.2 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 28 Sep 2014 23:56:43 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: gentoo-user@lists.gentoo.org From: walt Subject: [gentoo-user] Re: bloated by gcc Date: Sun, 28 Sep 2014 14:56:26 -0700 Message-ID: References: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 216.240.144.2 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 In-Reply-To: X-Archives-Salt: b98d5c35-1b12-4fa8-9cc0-e50bfeb5233e X-Archives-Hash: fd1ef53b99f14a4fa166fc09d0ee3809 On 09/28/2014 01:44 AM, Jorge Almeida wrote: > I'm having a somewhat disgusting issue on my Gentoo: binaries are > unaccountably large. > > I'm talking about C programs of my own, so no version related issues > whatsoever. The computer is a core i3 with a 32 bit system. > > Example, for the same program: > > 10275 B on an atom running Slackware 14.1 (gcc 4.8.2) > 5896 B (same, stripped with strip --strip-unneeded) > > 11675 B on i3, Gentoo, gcc 4.8.3 (with default gcc it was worse) > 9704 B stripped > > 8207 B on *the same i3 box* running LFS (gcc 4.9.1) > 5768 B stripped > > When compiling against dietlibc, the difference is even more shocking > (almost double size in Gentoo after stripping). > > Compiled with: > gcc -Os -march=i686 -fomit-frame-pointer -pipe -Wall -pedantic > -fdata-sections -ffunction-sections -Wl,--gc-sections > -fno-asynchronous-unwind-tables -std=c99 > > Gentoo: > $ gcc -v > Using built-in specs. > COLLECT_GCC=/usr/i686-pc-linux-gnu/gcc-bin/4.8.3/gcc > COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-pc-linux-gnu/4.8.3/lto-wrapper > Target: i686-pc-linux-gnu > Configured with: > /var/tmp/portage/sys-devel/gcc-4.8.3/work/gcc-4.8.3/configure > --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --prefix=/usr > --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.8.3 > --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/include > --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.8.3 > --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.8.3/man > --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.8.3/info > --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/include/g++-v4 > --with-python-dir=/share/gcc-data/i686-pc-linux-gnu/4.8.3/python > --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt > --disable-werror --with-system-zlib --disable-nls > --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ > --with-pkgversion='Gentoo 4.8.3' --enable-libstdcxx-time > --enable-shared --enable-threads=posix --enable-__cxa_atexit > --enable-clocale=gnu --disable-multilib --disable-altivec > --disable-fixed-point --with-arch=i686 --enable-targets=all > --disable-libgcj --enable-libgomp --disable-libmudflap > --disable-libssp --enable-lto --without-cloog > Thread model: posix > gcc version 4.8.3 (Gentoo 4.8.3) > > LFS: > ## gcc -v > Using built-in specs. > COLLECT_GCC=gcc > COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-pc-linux-gnu/4.9.1/lto-wrapper > Target: i686-pc-linux-gnu > Configured with: ../gcc-4.9.1/configure --prefix=/usr > --enable-languages=c,c++ --disable-multilib --disable-bootstrap > --with-system-zlib > Thread model: posix > gcc version 4.9.1 (GCC) > > Slackware: > Reading specs from /slash/usr/bin/../lib/gcc/i486-slackware-linux/4.8.2/specs > COLLECT_GCC=gcc > COLLECT_LTO_WRAPPER=/slash/usr/bin/../libexec/gcc/i486-slackware-linux/4.8.2/lto-wrapper > Target: i486-slackware-linux > Configured with: ../gcc-4.8.2/configure --prefix=/usr > --libdir=/usr/lib --mandir=/usr/man --infodir=/usr/info > --enable-shared --enable-bootstrap > --enable-languages=ada,c,c++,fortran,go,java,lto,objc > --enable-threads=p osix --enable-checking=release --enable-objc-gc > --with-system-zlib --with-python-dir=/lib/python2.7/site-packages > --disable-libunwind-exceptions --enable-__cxa_atexit --enable-libssp > --enable-lto --with-gnu-ld --verbose --enable-java-home > --with-java-home=/usr/lib/jvm/jre --with-jvm-root-dir=/usr/lib/jvm > --with-jvm-jar-dir=/usr/lib/jvm/jvm-exports --with-arch-directory=i386 > --with-antlr-jar=/root/slackware-current/source/d/gcc/antlr-runtime-3.4.jar > --enable-java-awt=gtk --disable-gtktest --with-arch=i486 > --target=i486-slackware-linux --build=i486-slackware-linux > --host=i486-slackware-linux > Thread model: posix > gcc version 4.8.2 (GCC) > > I'm not elfwise, but I could post something to google drive if needed. Are you cross-compiling for different hardware? I'm just curious what results you get with --march=native. Also, I looked up data-sections and function-sections (which I'd never heard of before today :) The gcc man page says the resulting executable will be larger and slower, and not to use them "unless there are significant benefits" but then doesn't say what those benefits might be. Hm, cryptic.