From 7bf6b27cdd85617388c6d104427031ccc561206d Mon Sep 17 00:00:00 2001 From: Kai Germaschewski Date: Wed, 15 Jan 2003 22:00:59 -0600 Subject: 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. --- include/linux/module.h | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'include/linux') 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 { -- cgit v1.2.3