[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a85b5a4c-9888-8a33-4424-98140783db3e@prevas.dk>
Date: Wed, 10 Mar 2021 22:45:58 +0100
From: Rasmus Villemoes <rasmus.villemoes@...vas.dk>
To: Masahiro Yamada <masahiroy@...nel.org>,
Nicholas Piggin <npiggin@...il.com>
Cc: Arnd Bergmann <arnd@...nel.org>, Fangrui Song <maskray@...gle.com>,
Ard Biesheuvel <ardb@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
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>, Nicolas Pitre <nico@...xnic.net>
Subject: Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION
On 10/03/2021 21.49, Masahiro Yamada wrote:
> On Mon, Mar 1, 2021 at 10:11 AM Nicholas Piggin <npiggin@...il.com> wrote:
>
> I tested LD_DEAD_CODE_DATA_ELIMINATION for the latest kernel.
>
> I added an unused function, this_func_is_unused(),
> then built the ppc kernel with LD_DEAD_CODE_DATA_ELIMINATION.
>
> It remained in vmlinux.
>
>
> masahiro@...ar:~/ref/linux$ echo 'void this_func_is_unused(void) {}'
>>> kernel/cpu.c
> masahiro@...ar:~/ref/linux$ export
> CROSS_COMPILE=/home/masahiro/tools/powerpc-10.1.0/bin/powerpc-linux-
> masahiro@...ar:~/ref/linux$ make ARCH=powerpc defconfig
> masahiro@...ar:~/ref/linux$ ./scripts/config -e EXPERT
> masahiro@...ar:~/ref/linux$ ./scripts/config -e LD_DEAD_CODE_DATA_ELIMINATION
> masahiro@...ar:~/ref/linux$
> ~/tools/powerpc-10.1.0/bin/powerpc-linux-nm -n vmlinux | grep
> this_func
> c000000000170560 T .this_func_is_unused
> c000000001d8d560 D this_func_is_unused
Dunno, works just fine for my ppc32 target in v4.19 (i.e., the function
gets eliminated when enabling LD_DEAD_CODE_DATA_ELIMINATION).
But yes, I can reproduce for master ppc64 defconfig. kernel/.cpu.o.cmd
says that it wasn't even compiled with -ffunction-sections, nor does
.vmlinux.cmd mention --gc-sections.
> masahiro@...ar:~/ref/linux$ grep DEAD_CODE_ .config
> CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=y
> CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y
Ah, but scripts/config just blindly adds that config option - I don't
think ppc64 actually supports this, and
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y automagically vanishes from
.config when building.
Rasmus
Powered by blists - more mailing lists