ar71xx: ag71xx: make ring sizes configurable via ethtool
[openwrt.git] / target / linux / generic / patches-2.6.31 / 028-module_exports.patch
1 --- a/include/asm-generic/vmlinux.lds.h
2 +++ b/include/asm-generic/vmlinux.lds.h
3 @@ -55,6 +55,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 *(__ksymtab.*)
16 +#define SYMTAB_DISCARD
17 +#else
18 +#define SYMTAB_DISCARD *(__ksymtab.*)
19 +#endif
20 +
21 +#ifndef SYMTAB_KEEP_GPL
22 +#define SYMTAB_KEEP_GPL *(__ksymtab_gpl.*)
23 +#define SYMTAB_DISCARD_GPL
24 +#else
25 +#define SYMTAB_DISCARD_GPL *(__ksymtab_gpl.*)
26 +#endif
27 +
28 #ifndef VMLINUX_SYMBOL
29 #define VMLINUX_SYMBOL(_sym_) _sym_
30 #endif
31 @@ -256,35 +277,35 @@
32 /* Kernel symbol table: Normal symbols */ \
33 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
34 VMLINUX_SYMBOL(__start___ksymtab) = .; \
35 - *(__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 - *(__ksymtab_gpl) \
44 + SYMTAB_KEEP_GPL \
45 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
46 } \
47 \
48 /* Kernel symbol table: Normal unused symbols */ \
49 __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
50 VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \
51 - *(__ksymtab_unused) \
52 + *(__ksymtab_unused.*) \
53 VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \
54 } \
55 \
56 /* Kernel symbol table: GPL-only unused symbols */ \
57 __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
58 VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \
59 - *(__ksymtab_unused_gpl) \
60 + *(__ksymtab_unused_gpl.*) \
61 VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \
62 } \
63 \
64 /* Kernel symbol table: GPL-future-only symbols */ \
65 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
66 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
67 - *(__ksymtab_gpl_future) \
68 + *(__ksymtab_gpl_future.*) \
69 VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \
70 } \
71 \
72 @@ -325,7 +346,13 @@
73 \
74 /* Kernel symbol table: strings */ \
75 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
76 - *(__ksymtab_strings) \
77 + SYMTAB_KEEP_STR \
78 + } \
79 + \
80 + /DISCARD/ : { \
81 + SYMTAB_DISCARD \
82 + SYMTAB_DISCARD_GPL \
83 + SYMTAB_DISCARD_STR \
84 } \
85 \
86 /* __*init sections */ \
87 --- a/include/linux/module.h
88 +++ b/include/linux/module.h
89 @@ -188,16 +188,24 @@ void *__symbol_get_gpl(const char *symbo
90 #define __CRC_SYMBOL(sym, sec)
91 #endif
92
93 +#ifdef MODULE
94 +#define __EXPORT_SUFFIX(sym)
95 +#else
96 +#define __EXPORT_SUFFIX(sym) "." #sym
97 +#endif
98 +
99 /* For every exported symbol, place a struct in the __ksymtab section */
100 #define __EXPORT_SYMBOL(sym, sec) \
101 extern typeof(sym) sym; \
102 __CRC_SYMBOL(sym, sec) \
103 static const char __kstrtab_##sym[] \
104 - __attribute__((section("__ksymtab_strings"), aligned(1))) \
105 + __attribute__((section("__ksymtab_strings" \
106 + __EXPORT_SUFFIX(sym)), aligned(1))) \
107 = MODULE_SYMBOL_PREFIX #sym; \
108 static const struct kernel_symbol __ksymtab_##sym \
109 __used \
110 - __attribute__((section("__ksymtab" sec), unused)) \
111 + __attribute__((section("__ksymtab" sec \
112 + __EXPORT_SUFFIX(sym)), unused)) \
113 = { (unsigned long)&sym, __kstrtab_##sym }
114
115 #define EXPORT_SYMBOL(sym) \
116 --- a/arch/arm/kernel/vmlinux.lds.S
117 +++ b/arch/arm/kernel/vmlinux.lds.S
118 @@ -79,26 +79,6 @@ SECTIONS
119 #endif
120 }
121
122 - /DISCARD/ : { /* Exit code and data */
123 - EXIT_TEXT
124 - EXIT_DATA
125 - *(.exitcall.exit)
126 - *(.ARM.exidx.exit.text)
127 - *(.ARM.extab.exit.text)
128 -#ifndef CONFIG_HOTPLUG_CPU
129 - *(.ARM.exidx.cpuexit.text)
130 - *(.ARM.extab.cpuexit.text)
131 -#endif
132 -#ifndef CONFIG_HOTPLUG
133 - *(.ARM.exidx.devexit.text)
134 - *(.ARM.extab.devexit.text)
135 -#endif
136 -#ifndef CONFIG_MMU
137 - *(.fixup)
138 - *(__ex_table)
139 -#endif
140 - }
141 -
142 .text : { /* Real text segment */
143 _text = .; /* Text and read-only data */
144 __exception_text_start = .;
145 @@ -205,6 +185,28 @@ SECTIONS
146 __bss_stop = .;
147 _end = .;
148 }
149 +
150 + /DISCARD/ : { /* Exit code and data */
151 + EXIT_TEXT
152 + EXIT_DATA
153 + *(.discard)
154 + *(.exitcall.exit)
155 + *(.ARM.exidx.exit.text)
156 + *(.ARM.extab.exit.text)
157 +#ifndef CONFIG_HOTPLUG_CPU
158 + *(.ARM.exidx.cpuexit.text)
159 + *(.ARM.extab.cpuexit.text)
160 +#endif
161 +#ifndef CONFIG_HOTPLUG
162 + *(.ARM.exidx.devexit.text)
163 + *(.ARM.extab.devexit.text)
164 +#endif
165 +#ifndef CONFIG_MMU
166 + *(.fixup)
167 + *(__ex_table)
168 +#endif
169 + }
170 +
171 /* Stabs debugging sections. */
172 .stab 0 : { *(.stab) }
173 .stabstr 0 : { *(.stabstr) }
174 --- a/arch/powerpc/kernel/vmlinux.lds.S
175 +++ b/arch/powerpc/kernel/vmlinux.lds.S
176 @@ -37,12 +37,6 @@ jiffies = jiffies_64 + 4;
177 #endif
178 SECTIONS
179 {
180 - /* Sections to be discarded. */
181 - /DISCARD/ : {
182 - *(.exitcall.exit)
183 - EXIT_DATA
184 - }
185 -
186 . = KERNELBASE;
187
188 /*
189 @@ -295,6 +289,12 @@ SECTIONS
190 __bss_stop = .;
191 }
192
193 + /* Sections to be discarded. */
194 + /DISCARD/ : {
195 + *(.exitcall.exit)
196 + EXIT_DATA
197 + }
198 +
199 . = ALIGN(PAGE_SIZE);
200 _end = . ;
201 PROVIDE32 (end = .);
This page took 0.043425 seconds and 5 git commands to generate.