Received: by 10.192.165.156 with SMTP id m28csp1684008imm; Tue, 17 Apr 2018 03:50:38 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/HPE472rh7Nfx/Z6rYoMWBkcOIaD+Jr+HrL9Qopx+jEFG8kN/N2zrfZhGGOBmlfNYEL1nn X-Received: by 2002:a17:902:43e4:: with SMTP id j91-v6mr1616454pld.118.1523962238231; Tue, 17 Apr 2018 03:50:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523962238; cv=none; d=google.com; s=arc-20160816; b=hf14ZM/KY1UqO15V5fq5wEv8/MQ7AFXBu2a7MYARbgiavno5xyOovvtQHq2PZCyFbD J6DPgwa1ugWMKC6frDNP205Z+n+HP5QkhuFM13GuyyJ+lPNBer0hTYERj2fjx7iwJuiX 12yGLCtqBbR5XjVw7287OXTHbSeGx8q2QA0Wdb2ChO39EvHi9FMhP/OKa5F3kAWAzH/H 04d+fVyO2pLoJD/IIftobpbTtsnGiiUlpCAkv4uU6FRYnr6Md4dseJAQ2xmyGCx9rXEm 707nPfidbN+Yn0xW5xG2f/vmMIhuzsr53TrItH/ZGtPICgwk4Yb7/bwg2KVMpYBBfTmX AWXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:cc:to:subject:from :arc-authentication-results; bh=eeIi7OT/1ult4zSsJBwbM5pGssemXSi+R+qmizWyzgo=; b=tRdhuGGKESJmkoQtParhRfbm8Hba6rvMDt0HVy6OO4Om21pxoH7o3gLUJIfSrtrIN0 n8t9KzdRSlCQTwdxLn0Xkc50pMUX8Yid+zWk4D+SvqwEedFaWf7U/FAVZqz+OHBP/rQV gMT84WBkU/8PfaE6UiZ/q3PuRswc60fJ9Fw++ywerNGOBQpYnyJRc4RaGjOb/v/niYXH 8ncA6GmdfkIYkk1AV4UbzLgVcaAyCoNmhu8G2lOpswtsVWkYVmPfW72bw1C6ySe+tUeq 3+ZlZWIpnIl/K+EglyavuicAQnTVtsoMS87S7kYtVvg2SazG2ozDNhOpCsKFSwbZEEcw RPIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e25si10526101pfn.199.2018.04.17.03.50.23; Tue, 17 Apr 2018 03:50:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752192AbeDQKtL (ORCPT + 99 others); Tue, 17 Apr 2018 06:49:11 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:22141 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751270AbeDQKtK (ORCPT ); Tue, 17 Apr 2018 06:49:10 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 40QMSF1S7pz9ty64; Tue, 17 Apr 2018 12:49:01 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id BvXSZUK0kwXH; Tue, 17 Apr 2018 12:49:01 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 40QMSF10BKz9ty62; Tue, 17 Apr 2018 12:49:01 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 9059E8B928; Tue, 17 Apr 2018 12:49:09 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id d0qEIYbKIY6h; Tue, 17 Apr 2018 12:49:09 +0200 (CEST) Received: from po15720vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.231.2]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 47F358B896; Tue, 17 Apr 2018 12:49:09 +0200 (CEST) Received: by po15720vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 22D416C07D; Tue, 17 Apr 2018 12:49:09 +0200 (CEST) From: Christophe Leroy Subject: [PATCH] powerpc: Allow selection of CONFIG_LD_DEAD_CODE_DATA_ELIMINATION To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Message-Id: <20180417104909.22D416C07D@po15720vm.idsi0.si.c-s.fr> Date: Tue, 17 Apr 2018 12:49:09 +0200 (CEST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This option does dead code and data elimination with the linker by compiling with -ffunction-sections -fdata-sections and linking with --gc-sections. By selecting this option on mpc885_ads_defconfig, vmlinux LOAD segment size gets reduced by 10% Program Header before the patch: LOAD off 0x00010000 vaddr 0xc0000000 paddr 0x00000000 align 2**16 filesz 0x0036eda4 memsz 0x0038de04 flags rwx Program Header after the patch: LOAD off 0x00010000 vaddr 0xc0000000 paddr 0x00000000 align 2**16 filesz 0x00316da4 memsz 0x00334268 flags rwx Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 8fe4353be5e3..e1fac49cf465 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -888,6 +888,14 @@ config PPC_MEM_KEYS If unsure, say y. +config PPC_UNUSED_ELIMINATION + bool "Eliminate unused functions and data from vmlinux" + default n + select LD_DEAD_CODE_DATA_ELIMINATION + help + Select this to do dead code and data elimination with the linker + by compiling with -ffunction-sections -fdata-sections and linking + with --gc-sections. endmenu config ISA_DMA_API -- 2.13.3