diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2008-01-20 14:07:28 -0500 |
---|---|---|
committer | Sam Ravnborg <sam@ravnborg.org> | 2008-01-28 17:21:17 -0500 |
commit | eb8f689046b857874e964463619f09df06d59fad (patch) | |
tree | ec726cd06764746a07689ede3b782c36a24d3e55 /include/linux | |
parent | f3fe866d59d707c7a2bba0b23add078e19edb3dc (diff) |
Use separate sections for __dev/__cpu/__mem code/data
Introducing separate sections for __dev* (HOTPLUG),
__cpu* (HOTPLUG_CPU) and __mem* (MEMORY_HOTPLUG)
allows us to do a much more reliable Section mismatch
check in modpost. We are no longer dependent on the actual
configuration of for example HOTPLUG.
This has the effect that all users see much more
Section mismatch warnings than before because they
were almost all hidden when HOTPLUG was enabled.
The advantage of this is that when building a piece
of code then it is much more likely that the Section
mismatch errors are spotted and the warnings will be
felt less random of nature.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Greg KH <greg@kroah.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Adrian Bunk <bunk@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/init.h | 77 |
1 files changed, 38 insertions, 39 deletions
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 |