3 @@ -963,7 +963,7 @@ prepare: prepare0
4 # Leave this as default for preprocessing vmlinux.lds.S, which is now
5 # done in arch/$(ARCH)/kernel/Makefile
7 -export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
8 +export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) $(EXTRA_LDSFLAGS)
10 # The asm symlink changes when $(ARCH) changes.
11 # Detect this and ask user to run make mrproper
12 --- a/include/asm-generic/vmlinux.lds.h
13 +++ b/include/asm-generic/vmlinux.lds.h
18 +#ifndef SYMTAB_KEEP_STR
19 +#define SYMTAB_KEEP_STR *(__ksymtab_strings.*)
23 +#define SYMTAB_KEEP *(__ksymtab.*)
26 +#ifndef SYMTAB_KEEP_GPL
27 +#define SYMTAB_KEEP_GPL *(__ksymtab_gpl.*)
30 #ifndef VMLINUX_SYMBOL
31 #define VMLINUX_SYMBOL(_sym_) _sym_
34 /* Kernel symbol table: Normal symbols */ \
35 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
36 VMLINUX_SYMBOL(__start___ksymtab) = .; \
39 VMLINUX_SYMBOL(__stop___ksymtab) = .; \
42 /* Kernel symbol table: GPL-only symbols */ \
43 __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
44 VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
47 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
50 /* Kernel symbol table: Normal unused symbols */ \
51 __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
52 VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \
53 - *(__ksymtab_unused) \
54 + *(__ksymtab_unused.*) \
55 VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \
58 /* Kernel symbol table: GPL-only unused symbols */ \
59 __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
60 VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \
61 - *(__ksymtab_unused_gpl) \
62 + *(__ksymtab_unused_gpl.*) \
63 VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \
66 /* Kernel symbol table: GPL-future-only symbols */ \
67 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
68 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
69 - *(__ksymtab_gpl_future) \
70 + *(__ksymtab_gpl_future.*) \
71 VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \
76 /* Kernel symbol table: strings */ \
77 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
78 - *(__ksymtab_strings) \
84 + *(__ksymtab_gpl.*) \
85 + *(__ksymtab_strings.*) \
88 /* __*init sections */ \
89 --- a/include/linux/module.h
90 +++ b/include/linux/module.h
91 @@ -187,16 +187,24 @@ void *__symbol_get_gpl(const char *symbo
92 #define __CRC_SYMBOL(sym, sec)
96 +#define __EXPORT_SUFFIX(sym)
98 +#define __EXPORT_SUFFIX(sym) "." #sym
101 /* For every exported symbol, place a struct in the __ksymtab section */
102 #define __EXPORT_SYMBOL(sym, sec) \
103 extern typeof(sym) sym; \
104 __CRC_SYMBOL(sym, sec) \
105 static const char __kstrtab_##sym[] \
106 - __attribute__((section("__ksymtab_strings"), aligned(1))) \
107 + __attribute__((section("__ksymtab_strings" \
108 + __EXPORT_SUFFIX(sym)), aligned(1))) \
109 = MODULE_SYMBOL_PREFIX #sym; \
110 static const struct kernel_symbol __ksymtab_##sym \
112 - __attribute__((section("__ksymtab" sec), unused)) \
113 + __attribute__((section("__ksymtab" sec \
114 + __EXPORT_SUFFIX(sym)), unused)) \
115 = { (unsigned long)&sym, __kstrtab_##sym }
117 #define EXPORT_SYMBOL(sym) \