[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100723202946.GA27288@merkur.ravnborg.org>
Date: Fri, 23 Jul 2010 22:29:46 +0200
From: Sam Ravnborg <sam@...nborg.org>
To: Denys Vlasenko <vda.linux@...glemail.com>
Cc: Tim Abbott <tabbott@...lice.com>, Tim Bird <tim.bird@...sony.com>,
James Bottomley <James.Bottomley@...senpartnership.com>,
linux-kernel@...r.kernel.org,
Matt Fleming <matt@...sole-pimps.org>,
linux-arch@...r.kernel.org, Arnd Bergmann <arnd@...db.de>,
Michal Marek <mmarek@...e.cz>,
Parisc List <linux-parisc@...r.kernel.org>
Subject: Re: Testing of function/data-sections on linux-2.6.35-rc4
> * fix for module linker script: linux-2.6.35-rc4-fs.fix-ko-module-linker-script.patch
> Prevents kernel modules from having unnecessarily many
> sections and thus prevents module size growth.
Acked-by: Sam Ravnborg <sam@...nborg.org>
--- linux-2.6.35-rc4/scripts/module-common.lds
+++ linux-2.6.35-rc4.new/scripts/module-common.lds
@@ -3,6 +3,29 @@
* Archs are free to supply their own linker scripts. ld will
* combine them automatically.
*/
+
+/* .data.foo are generated by gcc itself with -fdata-sections,
+ * whereas double-dot sections (like .data..percpu) are generated
+ * by kernel's magic macros.
+ *
+ * Since this script does not specify what to do with double-dot sections,
+ * ld -r will coalesce all .data..foo input sections into one .data..foo
+ * output section, all .data..bar input sections into one .data..bar
+ * output section and so on. This is exactly what we want.
+ *
+ * Same goes for .text, .bss and .rodata. In case of .rodata, various
+ * .rodata.foo sections are generated by gcc even without -fdata-sections
+ */
+
SECTIONS {
+
+ /* Coalesce sections produced by gcc -ffunction-sections */
+ .text 0 : AT(0) { *(.text .text.[A-Za-z0-9_$^]*) }
+
+ /* Coalesce sections produced by gcc -fdata-sections */
+ .rodata 0 : AT(0) { *(.rodata .rodata.[A-Za-z0-9_$^]*) }
+ .data 0 : AT(0) { *(.data .data.[A-Za-z0-9_$^]*) }
+ .bss 0 : AT(0) { *(.bss .bss.[A-Za-z0-9_$^]*) }
+
/DISCARD/ : { *(.discard) }
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists