From: Sami Tolvanen Date: Tue, 13 Feb 2018 21:59:47 +0000 (-0800) Subject: FROMLIST: kbuild: fix LD_DEAD_CODE_DATA_ELIMINATION X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9945e128a0960902c62d5aae50f799328871f6d7;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git FROMLIST: kbuild: fix LD_DEAD_CODE_DATA_ELIMINATION Don't remove .head.text or .exitcall.exit when linking with --gc-sections, and include .init.text.* in .init.text and .init.rodata.* in .init.rodata. Bug: 62093296 Bug: 67506682 Change-Id: Ia0f9e735d04c2322dcc8bcfc94241f0551b149c4 (am from https://patchwork.kernel.org/patch/10085773/) Reviewed-by: Nicholas Piggin Signed-off-by: Sami Tolvanen --- diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 353f52fdc35e..f4a6799cfbc5 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -105,7 +105,7 @@ #ifdef CONFIG_FTRACE_MCOUNT_RECORD #define MCOUNT_REC() . = ALIGN(8); \ VMLINUX_SYMBOL(__start_mcount_loc) = .; \ - *(__mcount_loc) \ + KEEP(*(__mcount_loc)) \ VMLINUX_SYMBOL(__stop_mcount_loc) = .; #else #define MCOUNT_REC() @@ -512,7 +512,7 @@ VMLINUX_SYMBOL(__softirqentry_text_end) = .; /* Section used for early init (in .S files) */ -#define HEAD_TEXT *(.head.text) +#define HEAD_TEXT KEEP(*(.head.text)) #define HEAD_TEXT_SECTION \ .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \ @@ -557,7 +557,7 @@ MEM_DISCARD(init.data) \ KERNEL_CTORS() \ MCOUNT_REC() \ - *(.init.rodata) \ + *(.init.rodata .init.rodata.*) \ FTRACE_EVENTS() \ TRACE_SYSCALLS() \ KPROBE_BLACKLIST() \ @@ -576,7 +576,7 @@ EARLYCON_TABLE() #define INIT_TEXT \ - *(.init.text) \ + *(.init.text .init.text.*) \ *(.text.startup) \ MEM_DISCARD(init.text) @@ -593,7 +593,7 @@ MEM_DISCARD(exit.text) #define EXIT_CALL \ - *(.exitcall.exit) + KEEP(*(.exitcall.exit)) /* * bss (Block Started by Symbol) - uninitialized data