summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>2003-01-15 22:00:59 -0600
committerLinus Torvalds <torvalds@home.transmeta.com>2003-01-15 22:00:59 -0600
commit7bf6b27cdd85617388c6d104427031ccc561206d (patch)
tree867a6874f16a6cfc42041a015fef64e75c5b1204 /include
parent11aa9341c58365769a7b25e22dca7681723775ce (diff)
kbuild/modules: Save space on symbol list
The current code reserves 60 bytes for the symbol string of every exported symbol, unnecessarily wasting kernel memory since most symbols are much shorter. We revert to the 2.4 solution where the actual strings are saved out of line and only the pointers are kept. The latest module-init-tools already handle this case, people who are using older versions need to update to make sure depmod works properly. Saves 80 KB in vmlinux with my .config.
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/vmlinux.lds.h4
-rw-r--r--include/linux/module.h24
2 files changed, 18 insertions, 10 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 9e0847712481..ef0e28700cd1 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -8,7 +8,6 @@
__vermagic : { *(__vermagic) } \
\
/* Kernel symbol table */ \
- . = ALIGN(64); \
__start___ksymtab = .; \
__ksymtab : { *(__ksymtab) } \
__stop___ksymtab = .; \
@@ -18,6 +17,9 @@
__gpl_ksymtab : { *(__gpl_ksymtab) } \
__stop___gpl_ksymtab = .; \
\
+ /* Kernel symbol table: strings */ \
+ __ksymtab_strings : { *(__ksymtab_strings) } \
+ \
/* All kernel symbols */ \
__start___kallsyms = .; \
__kallsyms : { *(__kallsyms) } \
diff --git a/include/linux/module.h b/include/linux/module.h
index f38e535eacd9..507fa6c563ef 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -36,7 +36,7 @@
struct kernel_symbol
{
unsigned long value;
- char name[MODULE_NAME_LEN];
+ const char *name;
};
/* These are either module local, or the kernel's dummy ones. */
@@ -140,17 +140,23 @@ void *__symbol_get_gpl(const char *symbol);
#define symbol_get(x) ((typeof(&x))(__symbol_get(MODULE_SYMBOL_PREFIX #x)))
/* For every exported symbol, place a struct in the __ksymtab section */
-#define EXPORT_SYMBOL(sym) \
- const struct kernel_symbol __ksymtab_##sym \
- __attribute__((section("__ksymtab"))) \
- = { (unsigned long)&sym, MODULE_SYMBOL_PREFIX #sym }
+#define EXPORT_SYMBOL(sym) \
+ static const char __kstrtab_##sym[] \
+ __attribute__((section("__ksymtab_strings"))) \
+ = MODULE_SYMBOL_PREFIX #sym; \
+ static const struct kernel_symbol __ksymtab_##sym \
+ __attribute__((section("__ksymtab"))) \
+ = { (unsigned long)&sym, __kstrtab_##sym }
#define EXPORT_SYMBOL_NOVERS(sym) EXPORT_SYMBOL(sym)
-#define EXPORT_SYMBOL_GPL(sym) \
- const struct kernel_symbol __ksymtab_##sym \
- __attribute__((section("__gpl_ksymtab"))) \
- = { (unsigned long)&sym, #sym }
+#define EXPORT_SYMBOL_GPL(sym) \
+ static const char __kstrtab_##sym[] \
+ __attribute__((section("__ksymtab_strings"))) \
+ = MODULE_SYMBOL_PREFIX #sym; \
+ static const struct kernel_symbol __ksymtab_##sym \
+ __attribute__((section("__gpl_ksymtab"))) \
+ = { (unsigned long)&sym, __kstrtab_##sym }
struct module_ref
{