From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8741 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] configure: add gcc flags for better link-time optimization Date: Fri, 23 Oct 2015 15:12:02 +0200 Message-ID: <20151023131202.GI10551@port70.net> References: <1445603426-4827-1-git-send-email-vda.linux@googlemail.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1445605976 999 80.91.229.3 (23 Oct 2015 13:12:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 23 Oct 2015 13:12:56 +0000 (UTC) Cc: Rich Felker , Denys Vlasenko To: musl@lists.openwall.com Original-X-From: musl-return-8754-gllmg-musl=m.gmane.org@lists.openwall.com Fri Oct 23 15:12:50 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Zpc9D-0001lw-N4 for gllmg-musl@m.gmane.org; Fri, 23 Oct 2015 15:12:43 +0200 Original-Received: (qmail 20293 invoked by uid 550); 23 Oct 2015 13:12:14 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 20245 invoked from network); 23 Oct 2015 13:12:14 -0000 Mail-Followup-To: musl@lists.openwall.com, Rich Felker , Denys Vlasenko Content-Disposition: inline In-Reply-To: <1445603426-4827-1-git-send-email-vda.linux@googlemail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Xref: news.gmane.org gmane.linux.lib.musl.general:8741 Archived-At: * Denys Vlasenko [2015-10-23 14:30:26 +0200]: > libc.so size reduction: > > text data bss dec hex filename > 564099 1944 11768 577811 8d113 libc.so.before > 562277 1924 11576 575777 8c921 libc.so > i assume this is x86_64, nice improvement. > +# When linker merges sections, a tiny section (such as one resulting > +# from "static char flag_var") with no alignment restrictions > +# can end up logded between two more strongly aligned ones (say, > +# "static int global_cnt1/2", both of which want 32-bit alignment). > +# Then this byte-sized "flag_var" gets 3 bytes of padding. > +# > +# With section sorting by alignment, one-byte flag variables have > +# higher chance of being grouped together and not require padding. > +# (It can be made even better. Linker is too dumb. > +# ld needs to grow -Wl,--pack-sections-optimally) > +# > +# For us, this affects the size of only one file: libc.so > +# > +tryldflag LDFLAGS_AUTO -Wl,--sort-section=alignment > +tryldflag LDFLAGS_AUTO -Wl,--sort-common i think this came up before https://sourceware.org/bugzilla/show_bug.cgi?id=14156 it was also noted at some point that the optimal sorting is 'sort by use' so all the unused legacy functions end up on the same page so they never need to be loaded. probably config knobs would be useful that turn off libc features, but not by dropping them, just moving them to a different part of libc.so that is assumed to be never needed.