Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2efac77e82a36bf616d474f2eb721d95543cfae9
Commit:     2efac77e82a36bf616d474f2eb721d95543cfae9
Parent:     8b2f35504d81422beb9e3562ee3dd99e8567cc80
Author:     Ralf Baechle <[EMAIL PROTECTED]>
AuthorDate: Mon Dec 11 11:54:52 2006 +0000
Committer:  Ralf Baechle <[EMAIL PROTECTED]>
CommitDate: Tue Dec 12 01:46:24 2006 +0000

    [MIPS] Discard .exit.text and .exit.data at runtime.
    
    While the recent cset 86384d544157db23879064cde36061cdcafc6794 did improve
    things it didn't resolve all the problems.  So bite the bullet and discard
    .exit.text and .exit.data at runtime.  Which of course sucks because it
    bloats binaries with code that will never ever be used but it's the only
    thing that will work reliable as demonstrated by the function sd_major() in
    drivers/scsi/sd.c.
    
    Gcc may compile sd_major() using a jump table which it will put into
    .rodata.  If it also inlines sd_major's function body into exit_sd() which
    gcc > 3.4.x does.  If CONFIG_BLK_DEV_SD has been set to y we would like ld
    to discard exit_sd's code at link time.  However sd_major happens to
    contain a switch statement which gcc will compile using a jump table in
    .rodata on the architectures I checked.  So, when ld later discards
    .exit.text only the jump table in .rodata with its stale references to
    the discard .exit.text will be left which any no antique ld will honor
    with a link error.
    
    Signed-off-by: Ralf Baechle <[EMAIL PROTECTED]>
---
 arch/mips/kernel/vmlinux.lds.S |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 2f4508f..cecff24 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -109,6 +109,10 @@ SECTIONS
   .con_initcall.init : { *(.con_initcall.init) }
   __con_initcall_end = .;
   SECURITY_INIT
+    /* .exit.text is discarded at runtime, not link time, to deal with
+     references from .rodata */
+  .exit.text : { *(.exit.text) }
+  .exit.data : { *(.exit.data) }
   . = ALIGN(_PAGE_SIZE);
   __initramfs_start = .;
   .init.ramfs : { *(.init.ramfs) }
@@ -136,8 +140,6 @@ SECTIONS
 
   /* Sections to be discarded */
   /DISCARD/ : {
-       *(.exit.text)
-        *(.exit.data)
         *(.exitcall.exit)
 
        /* ABI crap starts here */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to