aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/module.h
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@windriver.com>2011-05-23 14:11:39 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2011-10-31 09:20:11 -0400
commitf50169324df4ad942e544386d136216c8617636a (patch)
treee5b92d7ea573057f38c29a7771e06b7079b9024b /include/linux/module.h
parent839d8810747bbf39e0a5a7f223b67bffa7945f8d (diff)
module.h: split out the EXPORT_SYMBOL into export.h
A lot of files pull in module.h when all they are really looking for is the basic EXPORT_SYMBOL functionality. The recent data from Ingo[1] shows that this is one of several instances that has a significant impact on compile times, and it should be targeted for factoring out (as done here). Note that several commonly used header files in include/* directly include <linux/module.h> themselves (some 34 of them!) The most commonly used ones of these will have to be made independent of module.h before the full benefit of this change can be realized. We also transition THIS_MODULE from module.h to export.h, since there are lots of files with subsystem structs that in turn will have a struct module *owner and only be doing: .owner = THIS_MODULE; and absolutely nothing else modular. So, we also want to have the THIS_MODULE definition present in the lightweight header. [1] https://lkml.org/lkml/2011/5/23/76 Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'include/linux/module.h')
-rw-r--r--include/linux/module.h68
1 files changed, 1 insertions, 67 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index 863921637d9f..9f0ddc808a82 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -16,6 +16,7 @@
16#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/moduleparam.h> 17#include <linux/moduleparam.h>
18#include <linux/tracepoint.h> 18#include <linux/tracepoint.h>
19#include <linux/export.h>
19 20
20#include <linux/percpu.h> 21#include <linux/percpu.h>
21#include <asm/module.h> 22#include <asm/module.h>
@@ -25,21 +26,8 @@
25/* Not Yet Implemented */ 26/* Not Yet Implemented */
26#define MODULE_SUPPORTED_DEVICE(name) 27#define MODULE_SUPPORTED_DEVICE(name)
27 28
28/* Some toolchains use a `_' prefix for all user symbols. */
29#ifdef CONFIG_SYMBOL_PREFIX
30#define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
31#else
32#define MODULE_SYMBOL_PREFIX ""
33#endif
34
35#define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN 29#define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN
36 30
37struct kernel_symbol
38{
39 unsigned long value;
40 const char *name;
41};
42
43struct modversion_info 31struct modversion_info
44{ 32{
45 unsigned long crc; 33 unsigned long crc;
@@ -98,11 +86,8 @@ void trim_init_extable(struct module *m);
98extern const struct gtype##_id __mod_##gtype##_table \ 86extern const struct gtype##_id __mod_##gtype##_table \
99 __attribute__ ((unused, alias(__stringify(name)))) 87 __attribute__ ((unused, alias(__stringify(name))))
100 88
101extern struct module __this_module;
102#define THIS_MODULE (&__this_module)
103#else /* !MODULE */ 89#else /* !MODULE */
104#define MODULE_GENERIC_TABLE(gtype,name) 90#define MODULE_GENERIC_TABLE(gtype,name)
105#define THIS_MODULE ((struct module *)0)
106#endif 91#endif
107 92
108/* Generic info of form tag = "info" */ 93/* Generic info of form tag = "info" */
@@ -218,52 +203,6 @@ struct module_use {
218 struct module *source, *target; 203 struct module *source, *target;
219}; 204};
220 205
221#ifndef __GENKSYMS__
222#ifdef CONFIG_MODVERSIONS
223/* Mark the CRC weak since genksyms apparently decides not to
224 * generate a checksums for some symbols */
225#define __CRC_SYMBOL(sym, sec) \
226 extern void *__crc_##sym __attribute__((weak)); \
227 static const unsigned long __kcrctab_##sym \
228 __used \
229 __attribute__((section("___kcrctab" sec "+" #sym), unused)) \
230 = (unsigned long) &__crc_##sym;
231#else
232#define __CRC_SYMBOL(sym, sec)
233#endif
234
235/* For every exported symbol, place a struct in the __ksymtab section */
236#define __EXPORT_SYMBOL(sym, sec) \
237 extern typeof(sym) sym; \
238 __CRC_SYMBOL(sym, sec) \
239 static const char __kstrtab_##sym[] \
240 __attribute__((section("__ksymtab_strings"), aligned(1))) \
241 = MODULE_SYMBOL_PREFIX #sym; \
242 static const struct kernel_symbol __ksymtab_##sym \
243 __used \
244 __attribute__((section("___ksymtab" sec "+" #sym), unused)) \
245 = { (unsigned long)&sym, __kstrtab_##sym }
246
247#define EXPORT_SYMBOL(sym) \
248 __EXPORT_SYMBOL(sym, "")
249
250#define EXPORT_SYMBOL_GPL(sym) \
251 __EXPORT_SYMBOL(sym, "_gpl")
252
253#define EXPORT_SYMBOL_GPL_FUTURE(sym) \
254 __EXPORT_SYMBOL(sym, "_gpl_future")
255
256
257#ifdef CONFIG_UNUSED_SYMBOLS
258#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
259#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
260#else
261#define EXPORT_UNUSED_SYMBOL(sym)
262#define EXPORT_UNUSED_SYMBOL_GPL(sym)
263#endif
264
265#endif
266
267enum module_state 206enum module_state
268{ 207{
269 MODULE_STATE_LIVE, 208 MODULE_STATE_LIVE,
@@ -581,11 +520,6 @@ int unregister_module_notifier(struct notifier_block * nb);
581extern void print_modules(void); 520extern void print_modules(void);
582 521
583#else /* !CONFIG_MODULES... */ 522#else /* !CONFIG_MODULES... */
584#define EXPORT_SYMBOL(sym)
585#define EXPORT_SYMBOL_GPL(sym)
586#define EXPORT_SYMBOL_GPL_FUTURE(sym)
587#define EXPORT_UNUSED_SYMBOL(sym)
588#define EXPORT_UNUSED_SYMBOL_GPL(sym)
589 523
590/* Given an address, look for it in the exception tables. */ 524/* Given an address, look for it in the exception tables. */
591static inline const struct exception_table_entry * 525static inline const struct exception_table_entry *