diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2016-08-24 15:29:20 +0300 |
---|---|---|
committer | Michal Marek <mmarek@suse.com> | 2016-09-09 11:47:00 +0300 |
commit | b67067f1176df6ee727450546b58704e4b588563 (patch) | |
tree | 59cfd4ebc0ea13e799b9e4393740591f9e16985d /init | |
parent | a5967db9af51a84f5e181600954714a9e4c69f1f (diff) | |
download | linux-b67067f1176df6ee727450546b58704e4b588563.tar.xz |
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>
Diffstat (limited to 'init')
-rw-r--r-- | init/Makefile | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/init/Makefile b/init/Makefile index 7bc47ee31c36..c4fb45525d08 100644 --- a/init/Makefile +++ b/init/Makefile @@ -2,6 +2,8 @@ # Makefile for the linux kernel. # +ccflags-y := -fno-function-sections -fno-data-sections + obj-y := main.o version.o mounts.o ifneq ($(CONFIG_BLK_DEV_INITRD),y) obj-y += noinitramfs.o |