From patchwork Wed Apr 18 13:36:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 900126 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40R3GH6fkxz9s3W for ; Wed, 18 Apr 2018 23:42:47 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=c-s.fr Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40R3GH593FzF1pj for ; Wed, 18 Apr 2018 23:42:47 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=c-s.fr X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=c-s.fr (client-ip=93.17.236.30; helo=pegase1.c-s.fr; envelope-from=christophe.leroy@c-s.fr; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=c-s.fr Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40R36d4sJRzF1xm for ; Wed, 18 Apr 2018 23:36:09 +1000 (AEST) Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 40R36M3wVfz9ttSV; Wed, 18 Apr 2018 15:35:55 +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 b21FCw7P6O6C; Wed, 18 Apr 2018 15:35:55 +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 40R36M31bbz9ttC4; Wed, 18 Apr 2018 15:35:55 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D7E758B973; Wed, 18 Apr 2018 15:36:05 +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 69BqfE5AD3aX; Wed, 18 Apr 2018 15:36:05 +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 C07C28B972; Wed, 18 Apr 2018 15:36:05 +0200 (CEST) Received: by po15720vm.idsi0.si.c-s.fr (Postfix, from userid 0) id B7DF86C0AF; Wed, 18 Apr 2018 15:36:05 +0200 (CEST) Message-Id: <0051d3c950c957983c018230b7fd3c7ddde513f7.1524055122.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v2 2/2] powerpc: Allow selection of CONFIG_LD_DEAD_CODE_DATA_ELIMINATION To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Date: Wed, 18 Apr 2018 15:36:05 +0200 (CEST) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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