From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A649AC433DB for ; Thu, 25 Feb 2021 11:23:17 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2AB3D64EF1 for ; Thu, 25 Feb 2021 11:23:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2AB3D64EF1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=9P9Z3r71udEJ/T76DYNLZ+y27JXqADzb8T+V9aHHr0Q=; b=Pojte4fz0nV+eTadjNNS0WCKpm /NvwODDkocybp6sP65e/geJdYO3ydxCCNNcwmnhf89Nk1cHmsf2rFMmAIGwJnY4C7S+CBEjv2IqnP 54MZu2LK5vwrrp4YzdRYEElUGweNKYR+yfF8Wbi0vXfsabJQBgTUiYFeRDCERCRjixi66RXC6u/ik 2A97cOS/qFAMJeBMDJ0TEfnIhdt8CMZXEuS2qr7SZUrUEXmJnQEsQC8VArL1gPjKNZ0WM1tHABrPZ 2i4t0oW8vbjQDd+QQg2bKez03wGkZ0GOd0XONlFjPJlxdXQZ8BY8Nz2bPqjxhSCb6tn6nMp3ISbub dwR27ShA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFEi5-0000mQ-Uu; Thu, 25 Feb 2021 11:21:33 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFEi3-0000lp-F4 for linux-arm-kernel@lists.infradead.org; Thu, 25 Feb 2021 11:21:32 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id A128964EF1; Thu, 25 Feb 2021 11:21:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614252090; bh=PqWn91KrIETiPlzBFDZjY6Somdl4vci+5xNgQ83B00Q=; h=From:To:Cc:Subject:Date:From; b=p/ZwyTzdtsjXQtkNhRRjE38XN33+oamIKs7NaqMoHtZ5ytJu2LGEPHiBMl3ZT1w+h T+emWFOtMZbM5WxWJvFg4DddYY9WFEGWcmLDhx0SQ+DViQRm/rb/Hzsc/3+0cvTKBf llrjN1TWCqgIwS30MJLYXt1tDML2guwysFs7QTumAdHCXf4uDLHvX6A+JFl7LWQzSt jfUL2aD3U61JqiZ9o4xbAkj8t/wo83rLjIOqpScBg4CQPcM8uTBcmTiNG6p3obE0BW d3FJcVWcjbff9/Y5b0nHXtz0OsfUtk9cB+bR2KCOfKR+7I8Ll4t79E3EstZU1Ur9O6 kky/BAI/Xp31w== From: Arnd Bergmann To: Catalin Marinas , Will Deacon , Nathan Chancellor , Nick Desaulniers Subject: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION Date: Thu, 25 Feb 2021 12:20:56 +0100 Message-Id: <20210225112122.2198845-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210225_062131_664863_AD68C3E5 X-CRM114-Status: GOOD ( 17.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , David Brazdil , Kees Cook , Geert Uytterhoeven , Marc Zyngier , linux-kernel@vger.kernel.org, Kristina Martsenko , clang-built-linux@googlegroups.com, Mark Brown , Arnd Bergmann , Andrew Scull , Vincenzo Frascino , Ionela Voinescu , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Arnd Bergmann When looking at kernel size optimizations, I found that arm64 does not currently support HAVE_LD_DEAD_CODE_DATA_ELIMINATION, which enables the --gc-sections flag to the linker. I see that for a defconfig build with llvm, there are some notable improvements from enabling this, in particular when combined with the recently added CONFIG_LTO_CLANG_THIN and CONFIG_TRIM_UNUSED_KSYMS: text data bss dec hex filename 16570322 10998617 506468 28075407 1ac658f defconfig/vmlinux 16318793 10569913 506468 27395174 1a20466 trim_defconfig/vmlinux 16281234 10984848 504291 27770373 1a7be05 gc_defconfig/vmlinux 16029705 10556880 504355 27090940 19d5ffc gc+trim_defconfig/vmlinux 17040142 11102945 504196 28647283 1b51f73 thinlto_defconfig/vmlinux 16788613 10663201 504196 27956010 1aa932a thinlto+trim_defconfig/vmlinux 16347062 11043384 502499 27892945 1a99cd1 gc+thinlto_defconfig/vmlinux 15759453 10532792 502395 26794640 198da90 gc+thinlto+trim_defconfig/vmlinux I needed a small change to the linker script to get clean randconfig builds, but I have not done any meaningful boot testing on it to see if it works. If there are no regressions, I wonder whether this should be autmatically done for LTO builds, given that it improves both kernel size and compile speed. Link: https://lore.kernel.org/lkml/CAK8P3a05VZ9hSKRzVTxTn+1nf9E+gqebJWTj6N23nfm+ELHt9A@mail.gmail.com/ Signed-off-by: Arnd Bergmann --- arch/arm64/Kconfig | 1 + arch/arm64/kernel/vmlinux.lds.S | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index b94a678afce4..75e13cc52928 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -2,6 +2,7 @@ config ARM64 def_bool y select ACPI_CCA_REQUIRED if ACPI + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION select ACPI_GENERIC_GSI if ACPI select ACPI_GTDT if ACPI select ACPI_IORT if ACPI diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index bad2b9eaab22..926cdb597a45 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -217,7 +217,7 @@ SECTIONS INIT_CALLS CON_INITCALL INIT_RAM_FS - *(.init.altinstructions .init.bss .init.bss.*) /* from the EFI stub */ + *(.init.altinstructions .init.data.* .init.bss .init.bss.*) /* from the EFI stub */ } .exit.data : { EXIT_DATA -- 2.29.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel