reduce module image and resident size
PATCH 1/1 reduce module image and resident size
Resulting reduction (x86-64, gcc 4.1.2) with my (special purpose, i.e. much reduced) configurations:
- 16k kernel resident size
- 180k module resident size
- 10k module image size
Signed-off-by Jan Beulich <[email protected]>
--- include/linux/module.h | 2 +- kernel/module.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
include/linux/module.h +1 -1
@@ -190,7 +190,7 @@ void *__symbol_get_gpl(const char *symboextern typeof (sym) sym; \ __CRC_SYMBOL(sym, sec) \ static const char __kstrtab_##sym[] \ - __attribute__((section("__ksymtab_strings"))) \ + __attribute__((section("__ksymtab_strings"), aligned(1))) \ = MODULE_SYMBOL_PREFIX #sym; \ static const struct kernel_symbol __ksymtab_##sym \ __used \
kernel/module.c +2 -1
@@ -1815,8 +1815,9 @@ static struct module *load_module(void _ unwindex =find_sec (hdr, sechdrs, secstrings,ARCH_UNWIND_SECTION_NAME );#endif -/* Don't keep modinfo section */ +/* Don't keep modinfo and version sections. */ sechdrs[infoindex].sh_flags &= ~(unsigned long )SHF_ALLOC ; + sechdrs[versindex].sh_flags &= ~(unsigned long )SHF_ALLOC ;#ifdef CONFIG_KALLSYMS /* Keep symbol and string tables for decoding later. */ sechdrs[symindex].sh_flags |=SHF_ALLOC ;