Commit 7bf6b27c authored by Kai Germaschewski's avatar Kai Germaschewski Committed by Linus Torvalds

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.
parent 11aa9341
......@@ -52,7 +52,7 @@ o Gnu C 2.95.3 # gcc --version
o Gnu make 3.78 # make --version
o binutils 2.9.5.0.25 # ld -v
o util-linux 2.10o # fdformat --version
o module-init-tools 0.9 # rmmod -V
o module-init-tools 0.9.8 # rmmod -V
o e2fsprogs 1.29 # tune2fs
o jfsutils 1.0.14 # fsck.jfs -V
o reiserfsprogs 3.6.3 # reiserfsck -V 2>&1|grep reiserfsprogs
......
......@@ -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) } \
......
......@@ -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
{
......
......@@ -6,7 +6,7 @@
IN_PER_CPU=0
}
/__per_cpu$$/ && ! / __ksymtab_/ {
/__per_cpu$$/ && ! ( / __ksymtab_/ || / __kstrtab_/ ) {
if (!IN_PER_CPU) {
print $$3 " not in per-cpu section" > "/dev/stderr";
FOUND=1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment