OSDN Git Service

kbuild: allow archs to select link dead code/data elimination
authorNicholas Piggin <npiggin@gmail.com>
Wed, 24 Aug 2016 12:29:20 +0000 (22:29 +1000)
committer0ranko0P <ranko0p@outlook.com>
Sat, 7 Dec 2019 08:37:11 +0000 (16:37 +0800)
commit7f24b15a610ad7a42a2259718efcb8f108ab119a
tree900390c9a24973c86a9a5ed1b72cbde016ac476c
parentcbf9962757b12c107c2140ac684d1cf56727ce3b
kbuild: allow archs to select link dead code/data elimination

Introduce LD_DEAD_CODE_DATA_ELIMINATION option for architectures to
select to build with -ffunction-sections, -fdata-sections, and link
with --gc-sections. It requires some work (documented) to ensure all
unreferenced entrypoints are live, and requires toolchain and build
verification, so it is made a per-arch option for now.

On a random powerpc64le build, this yelds a significant size saving,
it boots and runs fine, but there is a lot I haven't tested as yet, so
these savings may be reduced if there are bugs in the link.

    text      data        bss        dec   filename
11169741   1180744    1923176 14273661   vmlinux
10445269   1004127    1919707 13369103   vmlinux.dce

~700K text, ~170K data, 6% removed from kernel image size.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.com>
Signed-off-by: Subhajeet Muhuri <kenny3fcb@gmail.com>
Makefile
arch/Kconfig
include/asm-generic/vmlinux.lds.h
include/linux/compiler.h
include/linux/export.h
include/linux/init.h
init/Makefile