Commit 4c1d9bb0 authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Masahiro Yamada

powerpc: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selected

This requires further changes to linker script to KEEP some tables
and wildcard compiler generated sections into the right place. This
includes pp32 modifications from Christophe Leroy.

When compiling powernv_defconfig with this option, the resulting
kernel is almost 400kB smaller (and still boots):

    text      data       bss        dec   filename
11827621   4810490   1341080   17979191   vmlinux
11752437   4598858   1338776   17690071   vmlinux.dcde

Mathieu's numbers for custom Mac Mini G4 config has almost 200kB
saving. It also had some increase in vmlinux size for as-yet
unknown reasons.

    text      data       bss        dec   filename
 7461457   2475122   1428064   11364643   vmlinux
 7386425   2364370   1425432   11176227   vmlinux.dcde

Tested-by: Christophe Leroy <christophe.leroy@c-s.fr> [8xx]
Tested-by: Mathieu Malaterre <malat@debian.org> [32-bit powermac]
Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 5d20ee31
...@@ -205,6 +205,7 @@ config PPC ...@@ -205,6 +205,7 @@ config PPC
select HAVE_KPROBES select HAVE_KPROBES
select HAVE_KPROBES_ON_FTRACE select HAVE_KPROBES_ON_FTRACE
select HAVE_KRETPROBES select HAVE_KRETPROBES
select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
select HAVE_LIVEPATCH if HAVE_DYNAMIC_FTRACE_WITH_REGS select HAVE_LIVEPATCH if HAVE_DYNAMIC_FTRACE_WITH_REGS
select HAVE_MEMBLOCK select HAVE_MEMBLOCK
select HAVE_MEMBLOCK_NODE_MAP select HAVE_MEMBLOCK_NODE_MAP
......
...@@ -89,7 +89,7 @@ SECTIONS ...@@ -89,7 +89,7 @@ SECTIONS
*/ */
.text BLOCK(0) : AT(ADDR(.text) - LOAD_OFFSET) { .text BLOCK(0) : AT(ADDR(.text) - LOAD_OFFSET) {
#ifdef CONFIG_LD_HEAD_STUB_CATCH #ifdef CONFIG_LD_HEAD_STUB_CATCH
*(.linker_stub_catch); KEEP(*(.linker_stub_catch));
. = . ; . = . ;
#endif #endif
...@@ -98,7 +98,7 @@ SECTIONS ...@@ -98,7 +98,7 @@ SECTIONS
ALIGN_FUNCTION(); ALIGN_FUNCTION();
#endif #endif
/* careful! __ftr_alt_* sections need to be close to .text */ /* careful! __ftr_alt_* sections need to be close to .text */
*(.text.hot .text .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text); *(.text.hot TEXT_MAIN .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text);
SCHED_TEXT SCHED_TEXT
CPUIDLE_TEXT CPUIDLE_TEXT
LOCK_TEXT LOCK_TEXT
...@@ -170,10 +170,10 @@ SECTIONS ...@@ -170,10 +170,10 @@ SECTIONS
.init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
INIT_DATA INIT_DATA
__vtop_table_begin = .; __vtop_table_begin = .;
*(.vtop_fixup); KEEP(*(.vtop_fixup));
__vtop_table_end = .; __vtop_table_end = .;
__ptov_table_begin = .; __ptov_table_begin = .;
*(.ptov_fixup); KEEP(*(.ptov_fixup));
__ptov_table_end = .; __ptov_table_end = .;
} }
...@@ -194,26 +194,26 @@ SECTIONS ...@@ -194,26 +194,26 @@ SECTIONS
. = ALIGN(8); . = ALIGN(8);
__ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) { __ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) {
__start___ftr_fixup = .; __start___ftr_fixup = .;
*(__ftr_fixup) KEEP(*(__ftr_fixup))
__stop___ftr_fixup = .; __stop___ftr_fixup = .;
} }
. = ALIGN(8); . = ALIGN(8);
__mmu_ftr_fixup : AT(ADDR(__mmu_ftr_fixup) - LOAD_OFFSET) { __mmu_ftr_fixup : AT(ADDR(__mmu_ftr_fixup) - LOAD_OFFSET) {
__start___mmu_ftr_fixup = .; __start___mmu_ftr_fixup = .;
*(__mmu_ftr_fixup) KEEP(*(__mmu_ftr_fixup))
__stop___mmu_ftr_fixup = .; __stop___mmu_ftr_fixup = .;
} }
. = ALIGN(8); . = ALIGN(8);
__lwsync_fixup : AT(ADDR(__lwsync_fixup) - LOAD_OFFSET) { __lwsync_fixup : AT(ADDR(__lwsync_fixup) - LOAD_OFFSET) {
__start___lwsync_fixup = .; __start___lwsync_fixup = .;
*(__lwsync_fixup) KEEP(*(__lwsync_fixup))
__stop___lwsync_fixup = .; __stop___lwsync_fixup = .;
} }
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
. = ALIGN(8); . = ALIGN(8);
__fw_ftr_fixup : AT(ADDR(__fw_ftr_fixup) - LOAD_OFFSET) { __fw_ftr_fixup : AT(ADDR(__fw_ftr_fixup) - LOAD_OFFSET) {
__start___fw_ftr_fixup = .; __start___fw_ftr_fixup = .;
*(__fw_ftr_fixup) KEEP(*(__fw_ftr_fixup))
__stop___fw_ftr_fixup = .; __stop___fw_ftr_fixup = .;
} }
#endif #endif
...@@ -226,7 +226,7 @@ SECTIONS ...@@ -226,7 +226,7 @@ SECTIONS
. = ALIGN(8); . = ALIGN(8);
.machine.desc : AT(ADDR(.machine.desc) - LOAD_OFFSET) { .machine.desc : AT(ADDR(.machine.desc) - LOAD_OFFSET) {
__machine_desc_start = . ; __machine_desc_start = . ;
*(.machine.desc) KEEP(*(.machine.desc))
__machine_desc_end = . ; __machine_desc_end = . ;
} }
#ifdef CONFIG_RELOCATABLE #ifdef CONFIG_RELOCATABLE
...@@ -274,7 +274,7 @@ SECTIONS ...@@ -274,7 +274,7 @@ SECTIONS
.data : AT(ADDR(.data) - LOAD_OFFSET) { .data : AT(ADDR(.data) - LOAD_OFFSET) {
DATA_DATA DATA_DATA
*(.data.rel*) *(.data.rel*)
*(.sdata) *(SDATA_MAIN)
*(.sdata2) *(.sdata2)
*(.got.plt) *(.got) *(.got.plt) *(.got)
*(.plt) *(.plt)
...@@ -289,7 +289,7 @@ SECTIONS ...@@ -289,7 +289,7 @@ SECTIONS
.opd : AT(ADDR(.opd) - LOAD_OFFSET) { .opd : AT(ADDR(.opd) - LOAD_OFFSET) {
__start_opd = .; __start_opd = .;
*(.opd) KEEP(*(.opd))
__end_opd = .; __end_opd = .;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment