Commit 4b89b7f7 authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Michal Marek

kbuild: keep data tables through dead code elimination

When CONFIG_LD_DEAD_CODE_DATA_ELIMINATION is enabled we must ensure
that we still keep various programatically-accessed tables.

[npiggin: Fold Paul's patches into one, and add a few more tables.
 diff symbol tables of allyesconfig with/without -gc-sections shows up
 lost tables quite easily.]
Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
parent 9da2f584
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
#ifdef CONFIG_KPROBES #ifdef CONFIG_KPROBES
#define KPROBE_BLACKLIST() . = ALIGN(8); \ #define KPROBE_BLACKLIST() . = ALIGN(8); \
VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \ VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \
*(_kprobe_blacklist) \ KEEP(*(_kprobe_blacklist)) \
VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .; VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .;
#else #else
#define KPROBE_BLACKLIST() #define KPROBE_BLACKLIST()
...@@ -123,10 +123,10 @@ ...@@ -123,10 +123,10 @@
#ifdef CONFIG_EVENT_TRACING #ifdef CONFIG_EVENT_TRACING
#define FTRACE_EVENTS() . = ALIGN(8); \ #define FTRACE_EVENTS() . = ALIGN(8); \
VMLINUX_SYMBOL(__start_ftrace_events) = .; \ VMLINUX_SYMBOL(__start_ftrace_events) = .; \
*(_ftrace_events) \ KEEP(*(_ftrace_events)) \
VMLINUX_SYMBOL(__stop_ftrace_events) = .; \ VMLINUX_SYMBOL(__stop_ftrace_events) = .; \
VMLINUX_SYMBOL(__start_ftrace_enum_maps) = .; \ VMLINUX_SYMBOL(__start_ftrace_enum_maps) = .; \
*(_ftrace_enum_map) \ KEEP(*(_ftrace_enum_map)) \
VMLINUX_SYMBOL(__stop_ftrace_enum_maps) = .; VMLINUX_SYMBOL(__stop_ftrace_enum_maps) = .;
#else #else
#define FTRACE_EVENTS() #define FTRACE_EVENTS()
...@@ -134,10 +134,10 @@ ...@@ -134,10 +134,10 @@
#ifdef CONFIG_TRACING #ifdef CONFIG_TRACING
#define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .; \ #define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .; \
*(__trace_printk_fmt) /* Trace_printk fmt' pointer */ \ KEEP(*(__trace_printk_fmt)) /* Trace_printk fmt' pointer */ \
VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .; VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .;
#define TRACEPOINT_STR() VMLINUX_SYMBOL(__start___tracepoint_str) = .; \ #define TRACEPOINT_STR() VMLINUX_SYMBOL(__start___tracepoint_str) = .; \
*(__tracepoint_str) /* Trace_printk fmt' pointer */ \ KEEP(*(__tracepoint_str)) /* Trace_printk fmt' pointer */ \
VMLINUX_SYMBOL(__stop___tracepoint_str) = .; VMLINUX_SYMBOL(__stop___tracepoint_str) = .;
#else #else
#define TRACE_PRINTKS() #define TRACE_PRINTKS()
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
#ifdef CONFIG_FTRACE_SYSCALLS #ifdef CONFIG_FTRACE_SYSCALLS
#define TRACE_SYSCALLS() . = ALIGN(8); \ #define TRACE_SYSCALLS() . = ALIGN(8); \
VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \ VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \
*(__syscalls_metadata) \ KEEP(*(__syscalls_metadata)) \
VMLINUX_SYMBOL(__stop_syscalls_metadata) = .; VMLINUX_SYMBOL(__stop_syscalls_metadata) = .;
#else #else
#define TRACE_SYSCALLS() #define TRACE_SYSCALLS()
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
#ifdef CONFIG_SERIAL_EARLYCON #ifdef CONFIG_SERIAL_EARLYCON
#define EARLYCON_TABLE() STRUCT_ALIGN(); \ #define EARLYCON_TABLE() STRUCT_ALIGN(); \
VMLINUX_SYMBOL(__earlycon_table) = .; \ VMLINUX_SYMBOL(__earlycon_table) = .; \
*(__earlycon_table) \ KEEP(*(__earlycon_table)) \
VMLINUX_SYMBOL(__earlycon_table_end) = .; VMLINUX_SYMBOL(__earlycon_table_end) = .;
#else #else
#define EARLYCON_TABLE() #define EARLYCON_TABLE()
...@@ -169,8 +169,8 @@ ...@@ -169,8 +169,8 @@
#define _OF_TABLE_1(name) \ #define _OF_TABLE_1(name) \
. = ALIGN(8); \ . = ALIGN(8); \
VMLINUX_SYMBOL(__##name##_of_table) = .; \ VMLINUX_SYMBOL(__##name##_of_table) = .; \
*(__##name##_of_table) \ KEEP(*(__##name##_of_table)) \
*(__##name##_of_table_end) KEEP(*(__##name##_of_table_end))
#define CLKSRC_OF_TABLES() OF_TABLE(CONFIG_CLKSRC_OF, clksrc) #define CLKSRC_OF_TABLES() OF_TABLE(CONFIG_CLKSRC_OF, clksrc)
#define IRQCHIP_OF_MATCH_TABLE() OF_TABLE(CONFIG_IRQCHIP, irqchip) #define IRQCHIP_OF_MATCH_TABLE() OF_TABLE(CONFIG_IRQCHIP, irqchip)
...@@ -184,7 +184,7 @@ ...@@ -184,7 +184,7 @@
#define ACPI_PROBE_TABLE(name) \ #define ACPI_PROBE_TABLE(name) \
. = ALIGN(8); \ . = ALIGN(8); \
VMLINUX_SYMBOL(__##name##_acpi_probe_table) = .; \ VMLINUX_SYMBOL(__##name##_acpi_probe_table) = .; \
*(__##name##_acpi_probe_table) \ KEEP(*(__##name##_acpi_probe_table)) \
VMLINUX_SYMBOL(__##name##_acpi_probe_table_end) = .; VMLINUX_SYMBOL(__##name##_acpi_probe_table_end) = .;
#else #else
#define ACPI_PROBE_TABLE(name) #define ACPI_PROBE_TABLE(name)
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
#define KERNEL_DTB() \ #define KERNEL_DTB() \
STRUCT_ALIGN(); \ STRUCT_ALIGN(); \
VMLINUX_SYMBOL(__dtb_start) = .; \ VMLINUX_SYMBOL(__dtb_start) = .; \
*(.dtb.init.rodata) \ KEEP(*(.dtb.init.rodata)) \
VMLINUX_SYMBOL(__dtb_end) = .; VMLINUX_SYMBOL(__dtb_end) = .;
/* /*
...@@ -214,11 +214,11 @@ ...@@ -214,11 +214,11 @@
/* implement dynamic printk debug */ \ /* implement dynamic printk debug */ \
. = ALIGN(8); \ . = ALIGN(8); \
VMLINUX_SYMBOL(__start___jump_table) = .; \ VMLINUX_SYMBOL(__start___jump_table) = .; \
*(__jump_table) \ KEEP(*(__jump_table)) \
VMLINUX_SYMBOL(__stop___jump_table) = .; \ VMLINUX_SYMBOL(__stop___jump_table) = .; \
. = ALIGN(8); \ . = ALIGN(8); \
VMLINUX_SYMBOL(__start___verbose) = .; \ VMLINUX_SYMBOL(__start___verbose) = .; \
*(__verbose) \ KEEP(*(__verbose)) \
VMLINUX_SYMBOL(__stop___verbose) = .; \ VMLINUX_SYMBOL(__stop___verbose) = .; \
LIKELY_PROFILE() \ LIKELY_PROFILE() \
BRANCH_PROFILE() \ BRANCH_PROFILE() \
...@@ -271,10 +271,10 @@ ...@@ -271,10 +271,10 @@
VMLINUX_SYMBOL(__start_rodata) = .; \ VMLINUX_SYMBOL(__start_rodata) = .; \
*(.rodata) *(.rodata.*) \ *(.rodata) *(.rodata.*) \
RO_AFTER_INIT_DATA /* Read only after init */ \ RO_AFTER_INIT_DATA /* Read only after init */ \
*(__vermagic) /* Kernel version magic */ \ KEEP(*(__vermagic)) /* Kernel version magic */ \
. = ALIGN(8); \ . = ALIGN(8); \
VMLINUX_SYMBOL(__start___tracepoints_ptrs) = .; \ VMLINUX_SYMBOL(__start___tracepoints_ptrs) = .; \
*(__tracepoints_ptrs) /* Tracepoints: pointer array */\ KEEP(*(__tracepoints_ptrs)) /* Tracepoints: pointer array */ \
VMLINUX_SYMBOL(__stop___tracepoints_ptrs) = .; \ VMLINUX_SYMBOL(__stop___tracepoints_ptrs) = .; \
*(__tracepoints_strings)/* Tracepoints: strings */ \ *(__tracepoints_strings)/* Tracepoints: strings */ \
} \ } \
...@@ -288,35 +288,35 @@ ...@@ -288,35 +288,35 @@
/* PCI quirks */ \ /* PCI quirks */ \
.pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \ .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \ VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \
*(.pci_fixup_early) \ KEEP(*(.pci_fixup_early)) \
VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \ VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \
VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \ VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \
*(.pci_fixup_header) \ KEEP(*(.pci_fixup_header)) \
VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \ VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \
VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \ VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \
*(.pci_fixup_final) \ KEEP(*(.pci_fixup_final)) \
VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \ VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \
VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \ VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \
*(.pci_fixup_enable) \ KEEP(*(.pci_fixup_enable)) \
VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \ VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \
VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \ VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \
*(.pci_fixup_resume) \ KEEP(*(.pci_fixup_resume)) \
VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \ VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \
VMLINUX_SYMBOL(__start_pci_fixups_resume_early) = .; \ VMLINUX_SYMBOL(__start_pci_fixups_resume_early) = .; \
*(.pci_fixup_resume_early) \ KEEP(*(.pci_fixup_resume_early)) \
VMLINUX_SYMBOL(__end_pci_fixups_resume_early) = .; \ VMLINUX_SYMBOL(__end_pci_fixups_resume_early) = .; \
VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .; \ VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .; \
*(.pci_fixup_suspend) \ KEEP(*(.pci_fixup_suspend)) \
VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .; \ VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .; \
VMLINUX_SYMBOL(__start_pci_fixups_suspend_late) = .; \ VMLINUX_SYMBOL(__start_pci_fixups_suspend_late) = .; \
*(.pci_fixup_suspend_late) \ KEEP(*(.pci_fixup_suspend_late)) \
VMLINUX_SYMBOL(__end_pci_fixups_suspend_late) = .; \ VMLINUX_SYMBOL(__end_pci_fixups_suspend_late) = .; \
} \ } \
\ \
/* Built-in firmware blobs */ \ /* Built-in firmware blobs */ \
.builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \ .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__start_builtin_fw) = .; \ VMLINUX_SYMBOL(__start_builtin_fw) = .; \
*(.builtin_fw) \ KEEP(*(.builtin_fw)) \
VMLINUX_SYMBOL(__end_builtin_fw) = .; \ VMLINUX_SYMBOL(__end_builtin_fw) = .; \
} \ } \
\ \
...@@ -394,7 +394,7 @@ ...@@ -394,7 +394,7 @@
\ \
/* Kernel symbol table: strings */ \ /* Kernel symbol table: strings */ \
__ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
KEEP(*(__ksymtab_strings)) \ *(__ksymtab_strings) \
} \ } \
\ \
/* __*init sections */ \ /* __*init sections */ \
...@@ -407,14 +407,14 @@ ...@@ -407,14 +407,14 @@
/* Built-in module parameters. */ \ /* Built-in module parameters. */ \
__param : AT(ADDR(__param) - LOAD_OFFSET) { \ __param : AT(ADDR(__param) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__start___param) = .; \ VMLINUX_SYMBOL(__start___param) = .; \
*(__param) \ KEEP(*(__param)) \
VMLINUX_SYMBOL(__stop___param) = .; \ VMLINUX_SYMBOL(__stop___param) = .; \
} \ } \
\ \
/* Built-in module versions. */ \ /* Built-in module versions. */ \
__modver : AT(ADDR(__modver) - LOAD_OFFSET) { \ __modver : AT(ADDR(__modver) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__start___modver) = .; \ VMLINUX_SYMBOL(__start___modver) = .; \
*(__modver) \ KEEP(*(__modver)) \
VMLINUX_SYMBOL(__stop___modver) = .; \ VMLINUX_SYMBOL(__stop___modver) = .; \
. = ALIGN((align)); \ . = ALIGN((align)); \
VMLINUX_SYMBOL(__end_rodata) = .; \ VMLINUX_SYMBOL(__end_rodata) = .; \
...@@ -517,7 +517,7 @@ ...@@ -517,7 +517,7 @@
. = ALIGN(align); \ . = ALIGN(align); \
__ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \ __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__start___ex_table) = .; \ VMLINUX_SYMBOL(__start___ex_table) = .; \
*(__ex_table) \ KEEP(*(__ex_table)) \
VMLINUX_SYMBOL(__stop___ex_table) = .; \ VMLINUX_SYMBOL(__stop___ex_table) = .; \
} }
...@@ -533,9 +533,9 @@ ...@@ -533,9 +533,9 @@
#ifdef CONFIG_CONSTRUCTORS #ifdef CONFIG_CONSTRUCTORS
#define KERNEL_CTORS() . = ALIGN(8); \ #define KERNEL_CTORS() . = ALIGN(8); \
VMLINUX_SYMBOL(__ctors_start) = .; \ VMLINUX_SYMBOL(__ctors_start) = .; \
*(.ctors) \ KEEP(*(.ctors)) \
*(SORT(.init_array.*)) \ KEEP(*(SORT(.init_array.*))) \
*(.init_array) \ KEEP(*(.init_array)) \
VMLINUX_SYMBOL(__ctors_end) = .; VMLINUX_SYMBOL(__ctors_end) = .;
#else #else
#define KERNEL_CTORS() #define KERNEL_CTORS()
...@@ -659,7 +659,7 @@ ...@@ -659,7 +659,7 @@
. = ALIGN(8); \ . = ALIGN(8); \
__bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \ __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__start___bug_table) = .; \ VMLINUX_SYMBOL(__start___bug_table) = .; \
*(__bug_table) \ KEEP(*(__bug_table)) \
VMLINUX_SYMBOL(__stop___bug_table) = .; \ VMLINUX_SYMBOL(__stop___bug_table) = .; \
} }
#else #else
...@@ -671,7 +671,7 @@ ...@@ -671,7 +671,7 @@
. = ALIGN(4); \ . = ALIGN(4); \
.tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \ .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__tracedata_start) = .; \ VMLINUX_SYMBOL(__tracedata_start) = .; \
*(.tracedata) \ KEEP(*(.tracedata)) \
VMLINUX_SYMBOL(__tracedata_end) = .; \ VMLINUX_SYMBOL(__tracedata_end) = .; \
} }
#else #else
...@@ -688,7 +688,7 @@ ...@@ -688,7 +688,7 @@
#define INIT_SETUP(initsetup_align) \ #define INIT_SETUP(initsetup_align) \
. = ALIGN(initsetup_align); \ . = ALIGN(initsetup_align); \
VMLINUX_SYMBOL(__setup_start) = .; \ VMLINUX_SYMBOL(__setup_start) = .; \
*(.init.setup) \ KEEP(*(.init.setup)) \
VMLINUX_SYMBOL(__setup_end) = .; VMLINUX_SYMBOL(__setup_end) = .;
#define INIT_CALLS_LEVEL(level) \ #define INIT_CALLS_LEVEL(level) \
......
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