public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* merge .text.*/.rel.text.* sections in module build with -ffunction-section
@ 2010-02-27 17:57 matthieu castet
  0 siblings, 0 replies; only message in thread
From: matthieu castet @ 2010-02-27 17:57 UTC (permalink / raw)
  To: linux-mips, Linux Kernel list

[-- Attachment #1: Type: text/plain, Size: 874 bytes --]

Hi,

mips (and other arch) use -ffunction-section (I am not sure why. It may be to prevent gcc to emit bad relocation).

Apart from making the code a bit bigger it :
- make very difficult to analyze binary kernel dump (without symbol) of module : you can't easily knowing the load address of the module find the symbol of an address.
- make module bigger (due to alignment between section and bigger section table)
- make the module loading slower (more section to parse)

I wondering why we doesn't merge all text section in one section when building .ko.
This can be done with :
mipsel-openwrt-linux-uclibc-ld -r  -m elf32ltsmip  -o vfat2.ko vfat.ko -T module-common.lds

Why doesn't mips provide a custom module-common.lds that does that ?


Matthieu

PS : could you keep me in CC

PS2 : 
ls -l vfat2.ko vfat.ko
12881 vfat2.ko
14748 vfat.ko

we save 13% of module size !

[-- Attachment #2: module-common.lds --]
[-- Type: text/plain, Size: 272 bytes --]

/*
 * Common module linker script, always used when linking a module.
 * Archs are free to supply their own linker scripts.  ld will
 * combine them automatically.
 */
SECTIONS {
	.text : {
		*(.text.*)
	}
	.rel.text : {
		*(.rel.text.*)
	}
	/DISCARD/ : { *(.discard) }
}

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

only message in thread, other threads:[~2010-02-27 18:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-27 17:57 merge .text.*/.rel.text.* sections in module build with -ffunction-section matthieu castet

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