From patchwork Tue Apr 15 18:19:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 3994821 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 95B84BFF02 for ; Tue, 15 Apr 2014 18:21:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C0BB02017B for ; Tue, 15 Apr 2014 18:21:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E7B5D20160 for ; Tue, 15 Apr 2014 18:21:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754769AbaDOST5 (ORCPT ); Tue, 15 Apr 2014 14:19:57 -0400 Received: from asavdk4.altibox.net ([109.247.116.15]:33600 "EHLO asavdk4.altibox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751849AbaDOSTy (ORCPT ); Tue, 15 Apr 2014 14:19:54 -0400 Received: from localhost (localhost [127.0.0.1]) by asavdk4.altibox.net (Postfix) with ESMTP id E2965800B7; Tue, 15 Apr 2014 20:19:51 +0200 (CEST) Received: from asavdk4.altibox.net ([127.0.0.1]) by localhost (asavdk4.lysetele.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id iFYIDTAHA-rC; Tue, 15 Apr 2014 20:19:51 +0200 (CEST) Received: from ravnborg.org (unknown [188.228.89.252]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by asavdk4.altibox.net (Postfix) with ESMTPS id DCF6B800B6; Tue, 15 Apr 2014 20:19:46 +0200 (CEST) Date: Tue, 15 Apr 2014 20:19:45 +0200 From: Sam Ravnborg To: Markus Trippelsdorf Cc: Ralf Baechle , Josh Triplett , Ingo Molnar , Andi Kleen , Linus Torvalds , Michal Marek , Linux Kbuild mailing list , Linux Kernel Mailing List , John Crispin Subject: Re: [GIT] kbuild/lto changes for 3.15-rc1 Message-ID: <20140415181945.GA22608@ravnborg.org> References: <20140408204906.GA3616@cloud> <20140409013557.GA32556@tassilo.jf.intel.com> <20140409060133.GA6766@gmail.com> <20140409081709.GA283@x4> <20140414103205.GA2846@gmail.com> <20140415010003.GA2765@jtriplet-mobl1> <20140415093622.GB27556@linux-mips.org> <20140415111916.GA9390@ravnborg.org> <20140415113602.GB283@x4> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140415113602.GB283@x4> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: What can then explain this size difference? Sam --- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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)