lkml.org 
[lkml]   [2014]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [GIT] kbuild/lto changes for 3.15-rc1
On Tue, Apr 15, 2014 at 01:36:02PM +0200, Markus Trippelsdorf wrote:
> On 2014.04.15 at 13:19 +0200, Sam Ravnborg wrote:
> > >
> > > And while the code size reduction is less for MIPS than what others have
> > > reported for their platforms (I'm still investigating) is still is enough
> > > that embedded developers would commit murder for.
> >
> > I have experimented a little with a patch that links all of vmlinux in one step.
> > I compared the text size of vmlinux without and with -ffunction-sections.
> >
> > With a defconfig build on x86 (32 bit) I got following results:
> >
> > size difference
> > singlelink 10266506
> > function-sections 9487369 779137 7,5%
> >
> > So this is a reduction of ~800 kb by enabling -ffunction-sections which
> > allows the linker to throw away unused sections.
> >
> > I have not boot tested the kernel so chances are that too much was thrown out by the linker.
> > But this is an option that has much smaller cost to use than lto.
> > And seems to benefit nicely in size.
> >
> > I have not tried this wihtout my singlelink patch - but I assume similar results.
>
> No, it wouldn't work, because you cannot mix -r and --gc-sections (or
> gold's --icf (identical code folding)).
With make allnoconfig I see a 5% decrease in text size by applying -ffunction-sections.
This is with latest mainline and no other than the following applied:

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 602f57e..51bac0a 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -171,6 +171,8 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
KBUILD_CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,)
KBUILD_CFLAGS += $(call cc-option,-mno-avx,)

+KBUILD_CFLAGS += -ffunction-sections
+
KBUILD_CFLAGS += $(mflags-y)
KBUILD_AFLAGS += $(mflags-y)

What can then explain this size difference?

Sam


\
 
 \ /
  Last update: 2014-04-16 09:41    [W:0.065 / U:2.580 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site