xburst: Remove unmaintained target
[openwrt/staging/mkresin.git] / target / linux / generic / pending-3.18 / 221-module_exports.patch
1 --- a/include/asm-generic/vmlinux.lds.h
2 +++ b/include/asm-generic/vmlinux.lds.h
3 @@ -54,6 +54,16 @@
4 #define LOAD_OFFSET 0
5 #endif
6
7 +#ifndef SYMTAB_KEEP
8 +#define SYMTAB_KEEP KEEP(*(SORT(___ksymtab+*)))
9 +#define SYMTAB_KEEP_GPL KEEP(*(SORT(___ksymtab_gpl+*)))
10 +#endif
11 +
12 +#ifndef SYMTAB_DISCARD
13 +#define SYMTAB_DISCARD
14 +#define SYMTAB_DISCARD_GPL
15 +#endif
16 +
17 #include <linux/export.h>
18
19 /* Align . to a 8 byte boundary equals to maximum function alignment. */
20 @@ -288,14 +298,14 @@
21 /* Kernel symbol table: Normal symbols */ \
22 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
23 VMLINUX_SYMBOL(__start___ksymtab) = .; \
24 - KEEP(*(SORT(___ksymtab+*))) \
25 + SYMTAB_KEEP \
26 VMLINUX_SYMBOL(__stop___ksymtab) = .; \
27 } \
28 \
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+*))) \
33 + SYMTAB_KEEP_GPL \
34 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
35 } \
36 \
37 @@ -357,7 +367,7 @@
38 \
39 /* Kernel symbol table: strings */ \
40 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
41 - *(__ksymtab_strings) \
42 + *(__ksymtab_strings+*) \
43 } \
44 \
45 /* __*init sections */ \
46 @@ -679,6 +689,8 @@
47 EXIT_TEXT \
48 EXIT_DATA \
49 EXIT_CALL \
50 + SYMTAB_DISCARD \
51 + SYMTAB_DISCARD_GPL \
52 *(.discard) \
53 *(.discard.*) \
54 }
55 --- a/scripts/Makefile.build
56 +++ b/scripts/Makefile.build
57 @@ -298,7 +298,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 $@ $<
64
65 $(obj)/%.lds: $(src)/%.lds.S FORCE
66 --- a/include/linux/export.h
67 +++ b/include/linux/export.h
68 @@ -52,12 +52,19 @@ extern struct module __this_module;
69 #define __CRC_SYMBOL(sym, sec)
70 #endif
71
72 +#ifdef MODULE
73 +#define __EXPORT_SUFFIX(sym)
74 +#else
75 +#define __EXPORT_SUFFIX(sym) "+" #sym
76 +#endif
77 +
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 = VMLINUX_SYMBOL_STR(sym); \
87 extern const struct kernel_symbol __ksymtab_##sym; \
88 __visible const struct kernel_symbol __ksymtab_##sym \