linux-atm: headroom/padding fixes
[openwrt.git] / target / linux / generic / patches-3.0 / 220-module_exports.patch
1 --- a/include/asm-generic/vmlinux.lds.h
2 +++ b/include/asm-generic/vmlinux.lds.h
3 @@ -52,6 +52,27 @@
4 #define LOAD_OFFSET 0
5 #endif
6
7 +#ifndef SYMTAB_KEEP_STR
8 +#define SYMTAB_KEEP_STR *(__ksymtab_strings+*)
9 +#define SYMTAB_DISCARD_STR
10 +#else
11 +#define SYMTAB_DISCARD_STR *(__ksymtab_strings+*)
12 +#endif
13 +
14 +#ifndef SYMTAB_KEEP
15 +#define SYMTAB_KEEP *(SORT(___ksymtab+*))
16 +#define SYMTAB_DISCARD
17 +#else
18 +#define SYMTAB_DISCARD *(SORT(___ksymtab+*))
19 +#endif
20 +
21 +#ifndef SYMTAB_KEEP_GPL
22 +#define SYMTAB_KEEP_GPL *(SORT(___ksymtab_gpl+*))
23 +#define SYMTAB_DISCARD_GPL
24 +#else
25 +#define SYMTAB_DISCARD_GPL *(SORT(___ksymtab_gpl+*))
26 +#endif
27 +
28 #ifndef SYMBOL_PREFIX
29 #define VMLINUX_SYMBOL(sym) sym
30 #else
31 @@ -276,14 +297,14 @@
32 /* Kernel symbol table: Normal symbols */ \
33 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
34 VMLINUX_SYMBOL(__start___ksymtab) = .; \
35 - *(SORT(___ksymtab+*)) \
36 + SYMTAB_KEEP \
37 VMLINUX_SYMBOL(__stop___ksymtab) = .; \
38 } \
39 \
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+*)) \
44 + SYMTAB_KEEP_GPL \
45 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
46 } \
47 \
48 @@ -345,7 +366,7 @@
49 \
50 /* Kernel symbol table: strings */ \
51 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
52 - *(__ksymtab_strings) \
53 + SYMTAB_KEEP_STR \
54 } \
55 \
56 /* __*init sections */ \
57 @@ -677,6 +698,9 @@
58 EXIT_TEXT \
59 EXIT_DATA \
60 EXIT_CALL \
61 + SYMTAB_DISCARD \
62 + SYMTAB_DISCARD_GPL \
63 + SYMTAB_DISCARD_STR \
64 *(.discard) \
65 *(.discard.*) \
66 }
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)
71 #endif
72
73 +#ifdef MODULE
74 +#define __EXPORT_SUFFIX(sym)
75 +#else
76 +#define __EXPORT_SUFFIX(sym) "+" #sym
77 +#endif
78 +
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 \
89 __used \
This page took 0.044664 seconds and 5 git commands to generate.