public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] reduce module image and resident size
@ 2008-03-13  9:02 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2008-03-13  9:02 UTC (permalink / raw)
  To: linux-kernel

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 <jbeulich@novell.com>

---
 include/linux/module.h |    2 +-
 kernel/module.c        |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

--- linux-2.6.25-rc5/include/linux/module.h	2008-03-10 13:24:33.000000000 +0100
+++ 2.6.25-rc5-module-reduce-size/include/linux/module.h	2008-03-04 11:26:17.000000000 +0100
@@ -190,7 +190,7 @@ void *__symbol_get_gpl(const char *symbo
 	extern 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							\
--- linux-2.6.25-rc5/kernel/module.c	2008-03-10 13:24:35.000000000 +0100
+++ 2.6.25-rc5-module-reduce-size/kernel/module.c	2008-03-04 11:26:17.000000000 +0100
@@ -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;




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-13  9:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-13  9:02 [PATCH] reduce module image and resident size Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox