1 --- a/include/asm-generic/vmlinux.lds.h
2 +++ b/include/asm-generic/vmlinux.lds.h
8 +#define SYMTAB_KEEP KEEP(*(SORT(___ksymtab+*)))
9 +#define SYMTAB_KEEP_GPL KEEP(*(SORT(___ksymtab_gpl+*)))
12 +#ifndef SYMTAB_DISCARD
13 +#define SYMTAB_DISCARD
14 +#define SYMTAB_DISCARD_GPL
18 #define VMLINUX_SYMBOL(sym) sym
21 /* Kernel symbol table: Normal symbols */ \
22 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
23 VMLINUX_SYMBOL(__start___ksymtab) = .; \
24 - KEEP(*(SORT(___ksymtab+*))) \
26 VMLINUX_SYMBOL(__stop___ksymtab) = .; \
29 /* Kernel symbol table: GPL-only symbols */ \
30 __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
31 VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
32 - KEEP(*(SORT(___ksymtab_gpl+*))) \
34 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
39 /* Kernel symbol table: strings */ \
40 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
41 - *(__ksymtab_strings) \
42 + *(__ksymtab_strings+*) \
45 /* __*init sections */ \
51 + SYMTAB_DISCARD_GPL \
55 --- a/scripts/Makefile.build
56 +++ b/scripts/Makefile.build
57 @@ -348,7 +348,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $(
58 # Linker scripts preprocessor (.lds.S -> .lds)
59 # ---------------------------------------------------------------------------
60 quiet_cmd_cpp_lds_S = LDS $@
61 - cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -C -U$(ARCH) \
62 + cmd_cpp_lds_S = $(CPP) $(EXTRA_LDSFLAGS) $(cpp_flags) -P -C -U$(ARCH) \
63 -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $<
65 $(obj)/%.lds: $(src)/%.lds.S FORCE
66 --- a/include/linux/export.h
67 +++ b/include/linux/export.h
68 @@ -45,12 +45,19 @@ extern struct module __this_module;
69 #define __CRC_SYMBOL(sym, sec)
73 +#define __EXPORT_SUFFIX(sym)
75 +#define __EXPORT_SUFFIX(sym) "+" #sym
78 /* For every exported symbol, place a struct in the __ksymtab section */
79 #define __EXPORT_SYMBOL(sym, sec) \
80 extern typeof(sym) sym; \
81 __CRC_SYMBOL(sym, sec) \
82 static const char __kstrtab_##sym[] \
83 - __attribute__((section("__ksymtab_strings"), aligned(1))) \
84 + __attribute__((section("__ksymtab_strings" \
85 + __EXPORT_SUFFIX(sym)), aligned(1))) \
86 = MODULE_SYMBOL_PREFIX #sym; \
87 static const struct kernel_symbol __ksymtab_##sym \