linux-mips
[Top] [All Lists]

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

To: linux-mips@linux-mips.org, Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: merge .text.*/.rel.text.* sections in module build with -ffunction-section
From: matthieu castet <castet.matthieu@free.fr>
Date: Sat, 27 Feb 2010 18:57:30 +0100
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.8.1.23) Gecko/20090823 SeaMonkey/1.1.18
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) }
}
<Prev in Thread] Current Thread [Next in Thread>
  • merge .text.*/.rel.text.* sections in module build with -ffunction-section, matthieu castet <=