diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/vmlinux.lds.h | 88 | ||||
-rw-r--r-- | include/linux/init.h | 77 |
2 files changed, 120 insertions, 45 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index ae0166e83490..e0a56fb8f813 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -9,10 +9,46 @@ | |||
9 | /* Align . to a 8 byte boundary equals to maximum function alignment. */ | 9 | /* Align . to a 8 byte boundary equals to maximum function alignment. */ |
10 | #define ALIGN_FUNCTION() . = ALIGN(8) | 10 | #define ALIGN_FUNCTION() . = ALIGN(8) |
11 | 11 | ||
12 | /* The actual configuration determine if the init/exit sections | ||
13 | * are handled as text/data or they can be discarded (which | ||
14 | * often happens at runtime) | ||
15 | */ | ||
16 | #ifdef CONFIG_HOTPLUG | ||
17 | #define DEV_KEEP(sec) *(.dev##sec) | ||
18 | #define DEV_DISCARD(sec) | ||
19 | #else | ||
20 | #define DEV_KEEP(sec) | ||
21 | #define DEV_DISCARD(sec) *(.dev##sec) | ||
22 | #endif | ||
23 | |||
24 | #ifdef CONFIG_HOTPLUG_CPU | ||
25 | #define CPU_KEEP(sec) *(.cpu##sec) | ||
26 | #define CPU_DISCARD(sec) | ||
27 | #else | ||
28 | #define CPU_KEEP(sec) | ||
29 | #define CPU_DISCARD(sec) *(.cpu##sec) | ||
30 | #endif | ||
31 | |||
32 | #if defined(CONFIG_MEMORY_HOTPLUG) || defined(CONFIG_ACPI_HOTPLUG_MEMORY) \ | ||
33 | || defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE) | ||
34 | #define MEM_KEEP(sec) *(.mem##sec) | ||
35 | #define MEM_DISCARD(sec) | ||
36 | #else | ||
37 | #define MEM_KEEP(sec) | ||
38 | #define MEM_DISCARD(sec) *(.mem##sec) | ||
39 | #endif | ||
40 | |||
41 | |||
12 | /* .data section */ | 42 | /* .data section */ |
13 | #define DATA_DATA \ | 43 | #define DATA_DATA \ |
14 | *(.data) \ | 44 | *(.data) \ |
15 | *(.data.init.refok) \ | 45 | *(.data.init.refok) \ |
46 | DEV_KEEP(init.data) \ | ||
47 | DEV_KEEP(exit.data) \ | ||
48 | CPU_KEEP(init.data) \ | ||
49 | CPU_KEEP(exit.data) \ | ||
50 | MEM_KEEP(init.data) \ | ||
51 | MEM_KEEP(exit.data) \ | ||
16 | . = ALIGN(8); \ | 52 | . = ALIGN(8); \ |
17 | VMLINUX_SYMBOL(__start___markers) = .; \ | 53 | VMLINUX_SYMBOL(__start___markers) = .; \ |
18 | *(__markers) \ | 54 | *(__markers) \ |
@@ -132,6 +168,16 @@ | |||
132 | *(__ksymtab_strings) \ | 168 | *(__ksymtab_strings) \ |
133 | } \ | 169 | } \ |
134 | \ | 170 | \ |
171 | /* __*init sections */ \ | ||
172 | __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \ | ||
173 | DEV_KEEP(init.rodata) \ | ||
174 | DEV_KEEP(exit.rodata) \ | ||
175 | CPU_KEEP(init.rodata) \ | ||
176 | CPU_KEEP(exit.rodata) \ | ||
177 | MEM_KEEP(init.rodata) \ | ||
178 | MEM_KEEP(exit.rodata) \ | ||
179 | } \ | ||
180 | \ | ||
135 | /* Built-in module parameters. */ \ | 181 | /* Built-in module parameters. */ \ |
136 | __param : AT(ADDR(__param) - LOAD_OFFSET) { \ | 182 | __param : AT(ADDR(__param) - LOAD_OFFSET) { \ |
137 | VMLINUX_SYMBOL(__start___param) = .; \ | 183 | VMLINUX_SYMBOL(__start___param) = .; \ |
@@ -139,7 +185,6 @@ | |||
139 | VMLINUX_SYMBOL(__stop___param) = .; \ | 185 | VMLINUX_SYMBOL(__stop___param) = .; \ |
140 | VMLINUX_SYMBOL(__end_rodata) = .; \ | 186 | VMLINUX_SYMBOL(__end_rodata) = .; \ |
141 | } \ | 187 | } \ |
142 | \ | ||
143 | . = ALIGN((align)); | 188 | . = ALIGN((align)); |
144 | 189 | ||
145 | /* RODATA provided for backward compatibility. | 190 | /* RODATA provided for backward compatibility. |
@@ -159,7 +204,14 @@ | |||
159 | ALIGN_FUNCTION(); \ | 204 | ALIGN_FUNCTION(); \ |
160 | *(.text) \ | 205 | *(.text) \ |
161 | *(.text.init.refok) \ | 206 | *(.text.init.refok) \ |
162 | *(.exit.text.refok) | 207 | *(.exit.text.refok) \ |
208 | DEV_KEEP(init.text) \ | ||
209 | DEV_KEEP(exit.text) \ | ||
210 | CPU_KEEP(init.text) \ | ||
211 | CPU_KEEP(exit.text) \ | ||
212 | MEM_KEEP(init.text) \ | ||
213 | MEM_KEEP(exit.text) | ||
214 | |||
163 | 215 | ||
164 | /* sched.text is aling to function alignment to secure we have same | 216 | /* sched.text is aling to function alignment to secure we have same |
165 | * address even at second ld pass when generating System.map */ | 217 | * address even at second ld pass when generating System.map */ |
@@ -184,11 +236,35 @@ | |||
184 | VMLINUX_SYMBOL(__kprobes_text_end) = .; | 236 | VMLINUX_SYMBOL(__kprobes_text_end) = .; |
185 | 237 | ||
186 | /* init and exit section handling */ | 238 | /* init and exit section handling */ |
187 | #define INIT_TEXT *(.init.text) | 239 | #define INIT_DATA \ |
188 | #define INIT_DATA *(.init.data) | 240 | *(.init.data) \ |
189 | #define EXIT_TEXT *(.exit.text) | 241 | DEV_DISCARD(init.data) \ |
190 | #define EXIT_DATA *(.exit.data) | 242 | DEV_DISCARD(init.rodata) \ |
243 | CPU_DISCARD(init.data) \ | ||
244 | CPU_DISCARD(init.rodata) \ | ||
245 | MEM_DISCARD(init.data) \ | ||
246 | MEM_DISCARD(init.rodata) | ||
247 | |||
248 | #define INIT_TEXT \ | ||
249 | *(.init.text) \ | ||
250 | DEV_DISCARD(init.text) \ | ||
251 | CPU_DISCARD(init.text) \ | ||
252 | MEM_DISCARD(init.text) | ||
253 | |||
254 | #define EXIT_DATA \ | ||
255 | *(.exit.data) \ | ||
256 | DEV_DISCARD(exit.data) \ | ||
257 | DEV_DISCARD(exit.rodata) \ | ||
258 | CPU_DISCARD(exit.data) \ | ||
259 | CPU_DISCARD(exit.rodata) \ | ||
260 | MEM_DISCARD(exit.data) \ | ||
261 | MEM_DISCARD(exit.rodata) | ||
191 | 262 | ||
263 | #define EXIT_TEXT \ | ||
264 | *(.exit.text) \ | ||
265 | DEV_DISCARD(exit.text) \ | ||
266 | CPU_DISCARD(exit.text) \ | ||
267 | MEM_DISCARD(exit.text) | ||
192 | 268 | ||
193 | /* DWARF debug sections. | 269 | /* DWARF debug sections. |
194 | Symbols in the DWARF debugging sections are relative to | 270 | Symbols in the DWARF debugging sections are relative to |
diff --git a/include/linux/init.h b/include/linux/init.h index 998076818402..dcb66c76bd48 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
@@ -60,18 +60,54 @@ | |||
60 | #define __exit_refok noinline __section(.exit.text.refok) | 60 | #define __exit_refok noinline __section(.exit.text.refok) |
61 | 61 | ||
62 | #ifdef MODULE | 62 | #ifdef MODULE |
63 | #define __exit __section(.exit.text) __cold | 63 | #define __exitused |
64 | #else | 64 | #else |
65 | #define __exit __attribute_used__ __section(.exit.text) __cold | 65 | #define __exitused __used |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | #define __exit __section(.exit.text) __exitused __cold | ||
69 | |||
70 | /* Used for HOTPLUG */ | ||
71 | #define __devinit __section(.devinit.text) __cold | ||
72 | #define __devinitdata __section(.devinit.data) | ||
73 | #define __devinitconst __section(.devinit.rodata) | ||
74 | #define __devexit __section(.devexit.text) __exitused __cold | ||
75 | #define __devexitdata __section(.devexit.data) | ||
76 | #define __devexitconst __section(.devexit.rodata) | ||
77 | |||
78 | /* Used for HOTPLUG_CPU */ | ||
79 | #define __cpuinit __section(.cpuinit.text) __cold | ||
80 | #define __cpuinitdata __section(.cpuinit.data) | ||
81 | #define __cpuinitconst __section(.cpuinit.rodata) | ||
82 | #define __cpuexit __section(.cpuexit.text) __exitused __cold | ||
83 | #define __cpuexitdata __section(.cpuexit.data) | ||
84 | #define __cpuexitconst __section(.cpuexit.rodata) | ||
85 | |||
86 | /* Used for MEMORY_HOTPLUG */ | ||
87 | #define __meminit __section(.meminit.text) __cold | ||
88 | #define __meminitdata __section(.meminit.data) | ||
89 | #define __meminitconst __section(.meminit.rodata) | ||
90 | #define __memexit __section(.memexit.text) __exitused __cold | ||
91 | #define __memexitdata __section(.memexit.data) | ||
92 | #define __memexitconst __section(.memexit.rodata) | ||
93 | |||
68 | /* For assembly routines */ | 94 | /* For assembly routines */ |
69 | #define __INIT .section ".init.text","ax" | 95 | #define __INIT .section ".init.text","ax" |
70 | #define __INIT_REFOK .section ".text.init.refok","ax" | 96 | #define __INIT_REFOK .section ".text.init.refok","ax" |
71 | #define __FINIT .previous | 97 | #define __FINIT .previous |
98 | |||
72 | #define __INITDATA .section ".init.data","aw" | 99 | #define __INITDATA .section ".init.data","aw" |
73 | #define __INITDATA_REFOK .section ".data.init.refok","aw" | 100 | #define __INITDATA_REFOK .section ".data.init.refok","aw" |
74 | 101 | ||
102 | #define __DEVINIT .section ".devinit.text", "ax" | ||
103 | #define __DEVINITDATA .section ".devinit.data", "aw" | ||
104 | |||
105 | #define __CPUINIT .section ".cpuinit.text", "ax" | ||
106 | #define __CPUINITDATA .section ".cpuinit.data", "aw" | ||
107 | |||
108 | #define __MEMINIT .section ".meminit.text", "ax" | ||
109 | #define __MEMINITDATA .section ".meminit.data", "aw" | ||
110 | |||
75 | #ifndef __ASSEMBLY__ | 111 | #ifndef __ASSEMBLY__ |
76 | /* | 112 | /* |
77 | * Used for initialization calls.. | 113 | * Used for initialization calls.. |
@@ -254,43 +290,6 @@ void __init parse_early_param(void); | |||
254 | #define __initdata_or_module __initdata | 290 | #define __initdata_or_module __initdata |
255 | #endif /*CONFIG_MODULES*/ | 291 | #endif /*CONFIG_MODULES*/ |
256 | 292 | ||
257 | #ifdef CONFIG_HOTPLUG | ||
258 | #define __devinit | ||
259 | #define __devinitdata | ||
260 | #define __devexit | ||
261 | #define __devexitdata | ||
262 | #else | ||
263 | #define __devinit __init | ||
264 | #define __devinitdata __initdata | ||
265 | #define __devexit __exit | ||
266 | #define __devexitdata __exitdata | ||
267 | #endif | ||
268 | |||
269 | #ifdef CONFIG_HOTPLUG_CPU | ||
270 | #define __cpuinit | ||
271 | #define __cpuinitdata | ||
272 | #define __cpuexit | ||
273 | #define __cpuexitdata | ||
274 | #else | ||
275 | #define __cpuinit __init | ||
276 | #define __cpuinitdata __initdata | ||
277 | #define __cpuexit __exit | ||
278 | #define __cpuexitdata __exitdata | ||
279 | #endif | ||
280 | |||
281 | #if defined(CONFIG_MEMORY_HOTPLUG) || defined(CONFIG_ACPI_HOTPLUG_MEMORY) \ | ||
282 | || defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE) | ||
283 | #define __meminit | ||
284 | #define __meminitdata | ||
285 | #define __memexit | ||
286 | #define __memexitdata | ||
287 | #else | ||
288 | #define __meminit __init | ||
289 | #define __meminitdata __initdata | ||
290 | #define __memexit __exit | ||
291 | #define __memexitdata __exitdata | ||
292 | #endif | ||
293 | |||
294 | /* Functions marked as __devexit may be discarded at kernel link time, depending | 293 | /* Functions marked as __devexit may be discarded at kernel link time, depending |
295 | on config options. Newer versions of binutils detect references from | 294 | on config options. Newer versions of binutils detect references from |
296 | retained sections to discarded sections and flag an error. Pointers to | 295 | retained sections to discarded sections and flag an error. Pointers to |