[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ros2o1p7-r65q-n4p-3o38-oo36rr58q041@syhkavp.arg>
Date: Wed, 10 Mar 2021 16:47:49 -0500 (EST)
From: Nicolas Pitre <nico@...xnic.net>
To: Sedat Dilek <sedat.dilek@...il.com>
cc: Arnd Bergmann <arnd@...nel.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Nicholas Piggin <npiggin@...il.com>,
Fangrui Song <maskray@...gle.com>,
Ard Biesheuvel <ardb@...nel.org>,
Andrew Scull <ascull@...gle.com>,
Mark Brown <broonie@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
clang-built-linux <clang-built-linux@...glegroups.com>,
David Brazdil <dbrazdil@...gle.com>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Ionela Voinescu <ionela.voinescu@....com>,
Kees Cook <keescook@...omium.org>,
Kristina Martsenko <kristina.martsenko@....com>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Mark Rutland <mark.rutland@....com>,
Marc Zyngier <maz@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Vincenzo Frascino <vincenzo.frascino@....com>,
Will Deacon <will@...nel.org>
Subject: Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION
On Wed, 10 Mar 2021, Sedat Dilek wrote:
> The best results on size-reduction of vmlinux I got with Clang-CFI on x86-64.
>
> Clang-LTO and Clang-CFI:
> I was able to build with CONFIG_TRIM_UNUSED_KSYMS=y which needs to add
> a whitelist file or add a whitelist to scripts/gen_autoksyms.sh.
> And boot on bare metal.
> Furthermore, I was able to compile
> CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=y with and without
> CONFIG_TRIM_UNUSED_KSYMS=y.
> Every kernel I had CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=y does not boot.
> Yes, there is a size reduction with both enabled but not that good as
> with Clang-CFI.
> All testings with several iterations of LLVM/Clang v13-git.
> With CONFIG_TRIM_UNUSED_KSYMS=y I see a 3x-loops of building .version
> and folowing steps - got no answer if this is intended.
Yes it is intended. I explained it here:
https://lkml.org/lkml/2021/3/9/1099
With CONFIG_TRIM_UNUSED_KSYMS some EXPORT_SYMBOL() are removed, which
allows for optimizing away the corresponding code, which in turn opens
the possibility for more EXPORT_SYMBOL() to be removed, etc. The process
eventually converge to a stable build. Normally only 2 passes are needed
to converge, but LTO opens the possibilities for extra passes.
> Means longer build-time.
Oh, absolutely. LTO (at least when I played with it) is slow. Add the
multi-pass from CONFIG_TRIM_UNUSED_KSYMS on top of that and your kernel
build becomes agonizingly slow. This is not something you want when
doing kernel development.
> I did not follow this anymore as both Kconfigs with Clang-LTO consume
> more build-time and the resulting vmlinux is some MiB bigger than with
> Clang-CFI.
That's rather strange. At least with gcc LTO I always obtained smaller
kernels.
Nicolas
Powered by blists - more mailing lists