Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp826783pxb; Thu, 25 Feb 2021 16:43:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJzbaXg8o5Giz++uhco+OKUAPDQ8a2aIfwZQR7UtCFOWC2HvXlS67RK2A5ZSxQtJaAyaBhdw X-Received: by 2002:aa7:d145:: with SMTP id r5mr622744edo.246.1614300219932; Thu, 25 Feb 2021 16:43:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614300219; cv=none; d=google.com; s=arc-20160816; b=vkESOKqfZ8s6dkjS0QbVm68iSrxb/xtP/Wnjm4C2TP/8AgjSY/ZpMxoGqFsd5cpeJR kXs7XG1M5+7cPfaW2KDhEHNmRuhAwUaeCP2t0Nevl/98nC1a0prcksES4y5iNAAXigWT 0uDkBPOii24nIbFsZUVk5pnMBn++vbsrsZeLr+1RHC9KX/eWyG/uLjP7YUNeGk6r+nxf vTYFd+tZ5hiS42SGYTMQGIhfWw4zv6HIU/jxbrf2QGlZHvbGe5xD8QgYogl19YVenFmJ 2I7C533tN+GbxEzxqMB7fV3xv+pEuTaBxGhG0cDHX2yJY0JY1WuFz8Mld8xmJ2U+j6ZS 2jTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:reply-to :in-reply-to:references:mime-version:dkim-signature; bh=zSQkfXYILeFIsnw9KPEpR0PnZSHnbzsSZbKt0dU2Xn4=; b=YihpEX4yvOHAQHHvVPcBvN1cpLfQdWUOjjfWr2rscnJJqyIgWaSOl3T+oujzggu8Cz sJEZqiBfa89QskbfzuAGKZ0pIxFaW161em5mOrFkUM6kqd6rdKQcCxc5lpJVjqMgUav4 gQG3jjx/JizS/91ddFpGSksSuOB9H2mj0F0ZGbkjNp3VPN3W05jD+N/467LeeESFNamz cWfV7tmNB1NjnIBX6yk1wlNfLNsQ/TPSVWUIGz9MEEXvuOexiS1xx2qsqcYk+Az+y28E Fh+5uOJIVCwgjpf4q5y0UhjwaVbo6GIMvxRXS7vvHol/saSBEq9WaNjnkna2PEi1fin/ oqkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Sd2TROa1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si4374856ejb.594.2021.02.25.16.43.17; Thu, 25 Feb 2021 16:43:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Sd2TROa1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230100AbhBZAgy (ORCPT + 99 others); Thu, 25 Feb 2021 19:36:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229966AbhBZAgx (ORCPT ); Thu, 25 Feb 2021 19:36:53 -0500 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEB60C061574 for ; Thu, 25 Feb 2021 16:36:13 -0800 (PST) Received: by mail-io1-xd36.google.com with SMTP id o11so21267iob.1 for ; Thu, 25 Feb 2021 16:36:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=zSQkfXYILeFIsnw9KPEpR0PnZSHnbzsSZbKt0dU2Xn4=; b=Sd2TROa1mctfXj+UUVvMkeau6EdMtkXhi9JcWQa1ABoOk15mmQEdyYhU+yxe/qx6s9 zp8p2HujWwDhdWUEeEB3fi5JHzUGeIGl/H/55kyI7XzRbVz5fSqE8bVGYnod2vvjJrlf x+0M7U2kJ/8v7oli95zqvEhfSHLYixt9T3XaHT4xjIMH98zWyMx9qKwoZYEJJVj/8PyR +JAsUJ53DqavDuoq3j1i1c16JjNXDpeTOH0UsZoGICAO41H3fAJlq3vhAB+j7AGKOFkp dbg+hXP55ZUefNxzbfLNYByV6X39QrDFgiuoLXPjArU66RoRoHjI/n7D/LpakwAnSztL ZDLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=zSQkfXYILeFIsnw9KPEpR0PnZSHnbzsSZbKt0dU2Xn4=; b=Yss5fLUsTdQ1GrNxmfdEStjFkpPmaKqo+jsCYAKM7oxLYiKU+Q4tIMOLAQ+B+FgUJ4 ViURU6Wny04ZH3/4fiRpfMtBS2vYLkUvtgCeTUTmBTGbI7QpjxVrxI7viWjIsBEd5sIh qFh8hb1UrZBSQ8Uu7EJrlBO3LE1QL4B2D2qsfyb2nsIRgkN4cUNHJqKHUZ866vmGgyzw qvIiCwYQZDeYyClaBHTo+18N3ONpwAmt1WyI7fwxRMhiGTqHEfPn8nnFEWho9V+0T05O y/rLn9NPk3wCtQ8R+G6Cuhb9EJKpKulU2arWwL2IwMi3uACNnT3nDTgkB+yqq2E3PpQM CJYA== X-Gm-Message-State: AOAM5334knY6JTZtUUjlBMPQm8dnbUN3yILr/HXWLZfzqcX2WYv3bI8P 3BHfOfkww6Cb1u90DxKse3w/r4u4A5/Ipkud6Yc= X-Received: by 2002:a02:b890:: with SMTP id p16mr399359jam.138.1614299773124; Thu, 25 Feb 2021 16:36:13 -0800 (PST) MIME-Version: 1.0 References: <20210225112122.2198845-1-arnd@kernel.org> In-Reply-To: <20210225112122.2198845-1-arnd@kernel.org> Reply-To: sedat.dilek@gmail.com From: Sedat Dilek Date: Fri, 26 Feb 2021 01:36:02 +0100 Message-ID: Subject: Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION To: Arnd Bergmann Cc: Catalin Marinas , Will Deacon , Nathan Chancellor , Nick Desaulniers , Arnd Bergmann , Kees Cook , Mark Brown , Vincenzo Frascino , Geert Uytterhoeven , Kristina Martsenko , Ionela Voinescu , Mark Rutland , Andrew Scull , David Brazdil , Marc Zyngier , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Clang-Built-Linux ML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 25, 2021 at 12:21 PM Arnd Bergmann wrote: > > 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 > Thanks for the numbers. Does CONFIG_TRIM_UNUSED_KSYMS=y have an impact to the build-time (and disc-usage - negative way means longer/bigger)? Do you have any build-time for the above numbers? BTW, is CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y setable for x86 (64bit)? ( Did not look or check for it. ) - Sedat - > 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 > > -- > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210225112122.2198845-1-arnd%40kernel.org.