aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2006-06-28 07:26:45 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-28 17:59:04 -0400
commitf71d20e961474dde77e6558396efb93d6ac80a4b (patch)
tree669610f79521fd173c28fc47bef39ecd4cdf52ab /include
parentf5e54d6e53a20cef45af7499e86164f0e0d16bb2 (diff)
[PATCH] Add EXPORT_UNUSED_SYMBOL and EXPORT_UNUSED_SYMBOL_GPL
Temporarily add EXPORT_UNUSED_SYMBOL and EXPORT_UNUSED_SYMBOL_GPL. These will be used as a transition measure for symbols that aren't used in the kernel and are on the way out. When a module uses such a symbol, a warning is printk'd at modprobe time. The main reason for removing unused exports is size: eacho export takes roughly between 100 and 150 bytes of kernel space in the binary. This patch gives users the option to immediately get this size gain via a config option. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/vmlinux.lds.h28
-rw-r--r--include/linux/module.h20
2 files changed, 48 insertions, 0 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 9d11550b4818..db5a3732f106 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -58,6 +58,20 @@
58 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \ 58 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
59 } \ 59 } \
60 \ 60 \
61 /* Kernel symbol table: Normal unused symbols */ \
62 __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
63 VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \
64 *(__ksymtab_unused) \
65 VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \
66 } \
67 \
68 /* Kernel symbol table: GPL-only unused symbols */ \
69 __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
70 VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \
71 *(__ksymtab_unused_gpl) \
72 VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \
73 } \
74 \
61 /* Kernel symbol table: GPL-future-only symbols */ \ 75 /* Kernel symbol table: GPL-future-only symbols */ \
62 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \ 76 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
63 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \ 77 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
@@ -79,6 +93,20 @@
79 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \ 93 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
80 } \ 94 } \
81 \ 95 \
96 /* Kernel symbol table: Normal unused symbols */ \
97 __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \
98 VMLINUX_SYMBOL(__start___kcrctab_unused) = .; \
99 *(__kcrctab_unused) \
100 VMLINUX_SYMBOL(__stop___kcrctab_unused) = .; \
101 } \
102 \
103 /* Kernel symbol table: GPL-only unused symbols */ \
104 __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
105 VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \
106 *(__kcrctab_unused_gpl) \
107 VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \
108 } \
109 \
82 /* Kernel symbol table: GPL-future-only symbols */ \ 110 /* Kernel symbol table: GPL-future-only symbols */ \
83 __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \ 111 __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
84 VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \ 112 VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \
diff --git a/include/linux/module.h b/include/linux/module.h
index 9ebbb74b7b72..9e9dc7c24d95 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -203,6 +203,15 @@ void *__symbol_get_gpl(const char *symbol);
203#define EXPORT_SYMBOL_GPL_FUTURE(sym) \ 203#define EXPORT_SYMBOL_GPL_FUTURE(sym) \
204 __EXPORT_SYMBOL(sym, "_gpl_future") 204 __EXPORT_SYMBOL(sym, "_gpl_future")
205 205
206
207#ifdef CONFIG_UNUSED_SYMBOLS
208#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
209#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
210#else
211#define EXPORT_UNUSED_SYMBOL(sym)
212#define EXPORT_UNUSED_SYMBOL_GPL(sym)
213#endif
214
206#endif 215#endif
207 216
208struct module_ref 217struct module_ref
@@ -261,6 +270,15 @@ struct module
261 unsigned int num_gpl_syms; 270 unsigned int num_gpl_syms;
262 const unsigned long *gpl_crcs; 271 const unsigned long *gpl_crcs;
263 272
273 /* unused exported symbols. */
274 const struct kernel_symbol *unused_syms;
275 unsigned int num_unused_syms;
276 const unsigned long *unused_crcs;
277 /* GPL-only, unused exported symbols. */
278 const struct kernel_symbol *unused_gpl_syms;
279 unsigned int num_unused_gpl_syms;
280 const unsigned long *unused_gpl_crcs;
281
264 /* symbols that will be GPL-only in the near future. */ 282 /* symbols that will be GPL-only in the near future. */
265 const struct kernel_symbol *gpl_future_syms; 283 const struct kernel_symbol *gpl_future_syms;
266 unsigned int num_gpl_future_syms; 284 unsigned int num_gpl_future_syms;
@@ -456,6 +474,8 @@ void module_remove_driver(struct device_driver *);
456#define EXPORT_SYMBOL(sym) 474#define EXPORT_SYMBOL(sym)
457#define EXPORT_SYMBOL_GPL(sym) 475#define EXPORT_SYMBOL_GPL(sym)
458#define EXPORT_SYMBOL_GPL_FUTURE(sym) 476#define EXPORT_SYMBOL_GPL_FUTURE(sym)
477#define EXPORT_UNUSED_SYMBOL(sym)
478#define EXPORT_UNUSED_SYMBOL_GPL(sym)
459 479
460/* Given an address, look for it in the exception tables. */ 480/* Given an address, look for it in the exception tables. */
461static inline const struct exception_table_entry * 481static inline const struct exception_table_entry *