Messages in this thread | | | Subject | Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION | From | Rasmus Villemoes <> | Date | Wed, 10 Mar 2021 22:45:58 +0100 |
| |
On 10/03/2021 21.49, Masahiro Yamada wrote: > On Mon, Mar 1, 2021 at 10:11 AM Nicholas Piggin <npiggin@gmail.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@oscar:~/ref/linux$ echo 'void this_func_is_unused(void) {}' >>> kernel/cpu.c > masahiro@oscar:~/ref/linux$ export > CROSS_COMPILE=/home/masahiro/tools/powerpc-10.1.0/bin/powerpc-linux- > masahiro@oscar:~/ref/linux$ make ARCH=powerpc defconfig > masahiro@oscar:~/ref/linux$ ./scripts/config -e EXPERT > masahiro@oscar:~/ref/linux$ ./scripts/config -e LD_DEAD_CODE_DATA_ELIMINATION > masahiro@oscar:~/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@oscar:~/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
| |