diff options
Diffstat (limited to 'include/linux/init.h')
-rw-r--r-- | include/linux/init.h | 128 |
1 files changed, 72 insertions, 56 deletions
diff --git a/include/linux/init.h b/include/linux/init.h index 5141381a7527..a404a0055dd7 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
@@ -40,10 +40,10 @@ | |||
40 | 40 | ||
41 | /* These are for everybody (although not all archs will actually | 41 | /* These are for everybody (although not all archs will actually |
42 | discard it in modules) */ | 42 | discard it in modules) */ |
43 | #define __init __attribute__ ((__section__ (".init.text"))) __cold | 43 | #define __init __section(.init.text) __cold |
44 | #define __initdata __attribute__ ((__section__ (".init.data"))) | 44 | #define __initdata __section(.init.data) |
45 | #define __exitdata __attribute__ ((__section__(".exit.data"))) | 45 | #define __exitdata __section(.exit.data) |
46 | #define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) | 46 | #define __exit_call __used __section(.exitcall.exit) |
47 | 47 | ||
48 | /* modpost check for section mismatches during the kernel build. | 48 | /* modpost check for section mismatches during the kernel build. |
49 | * A section mismatch happens when there are references from a | 49 | * A section mismatch happens when there are references from a |
@@ -52,25 +52,79 @@ | |||
52 | * when early init has completed so all such references are potential bugs. | 52 | * when early init has completed so all such references are potential bugs. |
53 | * For exit sections the same issue exists. | 53 | * For exit sections the same issue exists. |
54 | * The following markers are used for the cases where the reference to | 54 | * The following markers are used for the cases where the reference to |
55 | * the init/exit section (code or data) is valid and will teach modpost | 55 | * the *init / *exit section (code or data) is valid and will teach |
56 | * not to issue a warning. | 56 | * modpost not to issue a warning. |
57 | * The markers follow same syntax rules as __init / __initdata. */ | 57 | * The markers follow same syntax rules as __init / __initdata. */ |
58 | #define __init_refok noinline __attribute__ ((__section__ (".text.init.refok"))) | 58 | #define __ref __section(.ref.text) noinline |
59 | #define __initdata_refok __attribute__ ((__section__ (".data.init.refok"))) | 59 | #define __refdata __section(.ref.data) |
60 | #define __exit_refok noinline __attribute__ ((__section__ (".exit.text.refok"))) | 60 | #define __refconst __section(.ref.rodata) |
61 | |||
62 | /* backward compatibility note | ||
63 | * A few places hardcode the old section names: | ||
64 | * .text.init.refok | ||
65 | * .data.init.refok | ||
66 | * .exit.text.refok | ||
67 | * They should be converted to use the defines from this file | ||
68 | */ | ||
69 | |||
70 | /* compatibility defines */ | ||
71 | #define __init_refok __ref | ||
72 | #define __initdata_refok __refdata | ||
73 | #define __exit_refok __ref | ||
74 | |||
61 | 75 | ||
62 | #ifdef MODULE | 76 | #ifdef MODULE |
63 | #define __exit __attribute__ ((__section__(".exit.text"))) __cold | 77 | #define __exitused |
64 | #else | 78 | #else |
65 | #define __exit __attribute_used__ __attribute__ ((__section__(".exit.text"))) __cold | 79 | #define __exitused __used |
66 | #endif | 80 | #endif |
67 | 81 | ||
82 | #define __exit __section(.exit.text) __exitused __cold | ||
83 | |||
84 | /* Used for HOTPLUG */ | ||
85 | #define __devinit __section(.devinit.text) __cold | ||
86 | #define __devinitdata __section(.devinit.data) | ||
87 | #define __devinitconst __section(.devinit.rodata) | ||
88 | #define __devexit __section(.devexit.text) __exitused __cold | ||
89 | #define __devexitdata __section(.devexit.data) | ||
90 | #define __devexitconst __section(.devexit.rodata) | ||
91 | |||
92 | /* Used for HOTPLUG_CPU */ | ||
93 | #define __cpuinit __section(.cpuinit.text) __cold | ||
94 | #define __cpuinitdata __section(.cpuinit.data) | ||
95 | #define __cpuinitconst __section(.cpuinit.rodata) | ||
96 | #define __cpuexit __section(.cpuexit.text) __exitused __cold | ||
97 | #define __cpuexitdata __section(.cpuexit.data) | ||
98 | #define __cpuexitconst __section(.cpuexit.rodata) | ||
99 | |||
100 | /* Used for MEMORY_HOTPLUG */ | ||
101 | #define __meminit __section(.meminit.text) __cold | ||
102 | #define __meminitdata __section(.meminit.data) | ||
103 | #define __meminitconst __section(.meminit.rodata) | ||
104 | #define __memexit __section(.memexit.text) __exitused __cold | ||
105 | #define __memexitdata __section(.memexit.data) | ||
106 | #define __memexitconst __section(.memexit.rodata) | ||
107 | |||
68 | /* For assembly routines */ | 108 | /* For assembly routines */ |
69 | #define __INIT .section ".init.text","ax" | 109 | #define __INIT .section ".init.text","ax" |
70 | #define __INIT_REFOK .section ".text.init.refok","ax" | ||
71 | #define __FINIT .previous | 110 | #define __FINIT .previous |
111 | |||
72 | #define __INITDATA .section ".init.data","aw" | 112 | #define __INITDATA .section ".init.data","aw" |
73 | #define __INITDATA_REFOK .section ".data.init.refok","aw" | 113 | #define __FINITDATA .previous |
114 | |||
115 | #define __DEVINIT .section ".devinit.text", "ax" | ||
116 | #define __DEVINITDATA .section ".devinit.data", "aw" | ||
117 | |||
118 | #define __CPUINIT .section ".cpuinit.text", "ax" | ||
119 | #define __CPUINITDATA .section ".cpuinit.data", "aw" | ||
120 | |||
121 | #define __MEMINIT .section ".meminit.text", "ax" | ||
122 | #define __MEMINITDATA .section ".meminit.data", "aw" | ||
123 | |||
124 | /* silence warnings when references are OK */ | ||
125 | #define __REF .section ".ref.text", "ax" | ||
126 | #define __REFDATA .section ".ref.data", "aw" | ||
127 | #define __REFCONST .section ".ref.rodata", "aw" | ||
74 | 128 | ||
75 | #ifndef __ASSEMBLY__ | 129 | #ifndef __ASSEMBLY__ |
76 | /* | 130 | /* |
@@ -108,7 +162,7 @@ void prepare_namespace(void); | |||
108 | */ | 162 | */ |
109 | 163 | ||
110 | #define __define_initcall(level,fn,id) \ | 164 | #define __define_initcall(level,fn,id) \ |
111 | static initcall_t __initcall_##fn##id __attribute_used__ \ | 165 | static initcall_t __initcall_##fn##id __used \ |
112 | __attribute__((__section__(".initcall" level ".init"))) = fn | 166 | __attribute__((__section__(".initcall" level ".init"))) = fn |
113 | 167 | ||
114 | /* | 168 | /* |
@@ -142,11 +196,11 @@ void prepare_namespace(void); | |||
142 | 196 | ||
143 | #define console_initcall(fn) \ | 197 | #define console_initcall(fn) \ |
144 | static initcall_t __initcall_##fn \ | 198 | static initcall_t __initcall_##fn \ |
145 | __attribute_used__ __attribute__((__section__(".con_initcall.init")))=fn | 199 | __used __section(.con_initcall.init) = fn |
146 | 200 | ||
147 | #define security_initcall(fn) \ | 201 | #define security_initcall(fn) \ |
148 | static initcall_t __initcall_##fn \ | 202 | static initcall_t __initcall_##fn \ |
149 | __attribute_used__ __attribute__((__section__(".security_initcall.init"))) = fn | 203 | __used __section(.security_initcall.init) = fn |
150 | 204 | ||
151 | struct obs_kernel_param { | 205 | struct obs_kernel_param { |
152 | const char *str; | 206 | const char *str; |
@@ -163,8 +217,7 @@ struct obs_kernel_param { | |||
163 | #define __setup_param(str, unique_id, fn, early) \ | 217 | #define __setup_param(str, unique_id, fn, early) \ |
164 | static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \ | 218 | static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \ |
165 | static struct obs_kernel_param __setup_##unique_id \ | 219 | static struct obs_kernel_param __setup_##unique_id \ |
166 | __attribute_used__ \ | 220 | __used __section(.init.setup) \ |
167 | __attribute__((__section__(".init.setup"))) \ | ||
168 | __attribute__((aligned((sizeof(long))))) \ | 221 | __attribute__((aligned((sizeof(long))))) \ |
169 | = { __setup_str_##unique_id, fn, early } | 222 | = { __setup_str_##unique_id, fn, early } |
170 | 223 | ||
@@ -242,7 +295,7 @@ void __init parse_early_param(void); | |||
242 | #endif | 295 | #endif |
243 | 296 | ||
244 | /* Data marked not to be saved by software suspend */ | 297 | /* Data marked not to be saved by software suspend */ |
245 | #define __nosavedata __attribute__ ((__section__ (".data.nosave"))) | 298 | #define __nosavedata __section(.data.nosave) |
246 | 299 | ||
247 | /* This means "can be init if no module support, otherwise module load | 300 | /* This means "can be init if no module support, otherwise module load |
248 | may call it." */ | 301 | may call it." */ |
@@ -254,43 +307,6 @@ void __init parse_early_param(void); | |||
254 | #define __initdata_or_module __initdata | 307 | #define __initdata_or_module __initdata |
255 | #endif /*CONFIG_MODULES*/ | 308 | #endif /*CONFIG_MODULES*/ |
256 | 309 | ||
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 | 310 | /* Functions marked as __devexit may be discarded at kernel link time, depending |
295 | on config options. Newer versions of binutils detect references from | 311 | on config options. Newer versions of binutils detect references from |
296 | retained sections to discarded sections and flag an error. Pointers to | 312 | retained sections to discarded sections and flag an error. Pointers to |