1 --- a/include/asm-generic/vmlinux.lds.h
2 +++ b/include/asm-generic/vmlinux.lds.h
7 +#ifndef SYMTAB_KEEP_STR
8 +#define SYMTAB_KEEP_STR *(__ksymtab_strings.*)
12 +#define SYMTAB_KEEP *(__ksymtab.*)
15 +#ifndef SYMTAB_KEEP_GPL
16 +#define SYMTAB_KEEP_GPL *(__ksymtab_gpl.*)
19 #ifndef VMLINUX_SYMBOL
20 #define VMLINUX_SYMBOL(_sym_) _sym_
23 /* Kernel symbol table: Normal symbols */ \
24 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
25 VMLINUX_SYMBOL(__start___ksymtab) = .; \
28 VMLINUX_SYMBOL(__stop___ksymtab) = .; \
31 /* Kernel symbol table: GPL-only symbols */ \
32 __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
33 VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
36 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
39 /* Kernel symbol table: Normal unused symbols */ \
40 __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
41 VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \
42 - *(__ksymtab_unused) \
43 + *(__ksymtab_unused.*) \
44 VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \
47 /* Kernel symbol table: GPL-only unused symbols */ \
48 __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
49 VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \
50 - *(__ksymtab_unused_gpl) \
51 + *(__ksymtab_unused_gpl.*) \
52 VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \
55 /* Kernel symbol table: GPL-future-only symbols */ \
56 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
57 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
58 - *(__ksymtab_gpl_future) \
59 + *(__ksymtab_gpl_future.*) \
60 VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \
65 /* Kernel symbol table: strings */ \
66 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
67 - *(__ksymtab_strings) \
73 + *(__ksymtab_gpl.*) \
74 + *(__ksymtab_strings.*) \
77 /* __*init sections */ \
78 --- a/include/linux/module.h
79 +++ b/include/linux/module.h
80 @@ -187,16 +187,24 @@ void *__symbol_get_gpl(const char *symbo
81 #define __CRC_SYMBOL(sym, sec)
85 +#define __EXPORT_SUFFIX(sym)
87 +#define __EXPORT_SUFFIX(sym) "." #sym
90 /* For every exported symbol, place a struct in the __ksymtab section */
91 #define __EXPORT_SYMBOL(sym, sec) \
92 extern typeof(sym) sym; \
93 __CRC_SYMBOL(sym, sec) \
94 static const char __kstrtab_##sym[] \
95 - __attribute__((section("__ksymtab_strings"), aligned(1))) \
96 + __attribute__((section("__ksymtab_strings" \
97 + __EXPORT_SUFFIX(sym)), aligned(1))) \
98 = MODULE_SYMBOL_PREFIX #sym; \
99 static const struct kernel_symbol __ksymtab_##sym \
101 - __attribute__((section("__ksymtab" sec), unused)) \
102 + __attribute__((section("__ksymtab" sec \
103 + __EXPORT_SUFFIX(sym)), unused)) \
104 = { (unsigned long)&sym, __kstrtab_##sym }
106 #define EXPORT_SYMBOL(sym) \
109 @@ -994,7 +994,7 @@ prepare: prepare0
110 # Leave this as default for preprocessing vmlinux.lds.S, which is now
111 # done in arch/$(ARCH)/kernel/Makefile
113 -export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
114 +export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) $(EXTRA_LDSFLAGS)
116 # The asm symlink changes when $(ARCH) changes.
117 # Detect this and ask user to run make mrproper