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+*)
9 +#define SYMTAB_DISCARD_STR
11 +#define SYMTAB_DISCARD_STR *(__ksymtab_strings+*)
15 +#define SYMTAB_KEEP *(SORT(___ksymtab+*))
16 +#define SYMTAB_DISCARD
18 +#define SYMTAB_DISCARD *(SORT(___ksymtab+*))
21 +#ifndef SYMTAB_KEEP_GPL
22 +#define SYMTAB_KEEP_GPL *(SORT(___ksymtab_gpl+*))
23 +#define SYMTAB_DISCARD_GPL
25 +#define SYMTAB_DISCARD_GPL *(SORT(___ksymtab_gpl+*))
29 #define VMLINUX_SYMBOL(sym) sym
32 /* Kernel symbol table: Normal symbols */ \
33 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
34 VMLINUX_SYMBOL(__start___ksymtab) = .; \
35 - *(SORT(___ksymtab+*)) \
37 VMLINUX_SYMBOL(__stop___ksymtab) = .; \
40 /* Kernel symbol table: GPL-only symbols */ \
41 __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
42 VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
43 - *(SORT(___ksymtab_gpl+*)) \
45 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
50 /* Kernel symbol table: strings */ \
51 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
52 - *(__ksymtab_strings) \
56 /* __*init sections */ \
62 + SYMTAB_DISCARD_GPL \
63 + SYMTAB_DISCARD_STR \
67 --- a/include/linux/module.h
68 +++ b/include/linux/module.h
69 @@ -230,12 +230,19 @@ struct module_use {
70 #define __CRC_SYMBOL(sym, sec)
74 +#define __EXPORT_SUFFIX(sym)
76 +#define __EXPORT_SUFFIX(sym) "+" #sym
79 /* For every exported symbol, place a struct in the __ksymtab section */
80 #define __EXPORT_SYMBOL(sym, sec) \
81 extern typeof(sym) sym; \
82 __CRC_SYMBOL(sym, sec) \
83 static const char __kstrtab_##sym[] \
84 - __attribute__((section("__ksymtab_strings"), aligned(1))) \
85 + __attribute__((section("__ksymtab_strings" \
86 + __EXPORT_SUFFIX(sym)), aligned(1))) \
87 = MODULE_SYMBOL_PREFIX #sym; \
88 static const struct kernel_symbol __ksymtab_##sym \