merge .text.*/.rel.text.* sections in module build with -ffunction-section

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 !
/*
 * 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) }
}

[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux