]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
linker script: throw away .discard section
authorTejun Heo <tj@kernel.org>
Wed, 24 Jun 2009 06:13:38 +0000 (15:13 +0900)
committerTejun Heo <tj@kernel.org>
Wed, 24 Jun 2009 06:13:38 +0000 (15:13 +0900)
x86 throws away .discard section but no other archs do.  Also,
.discard is not thrown away while linking modules.  Make every arch
and module linking throw it away.  This will be used to define dummy
variables for percpu declarations and definitions.

This patch is based on Ivan Kokshaysky's alpha percpu patch.

[ Impact: always throw away everything in .discard ]

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Bryan Wu <cooloney@kernel.org>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Ingo Molnar <mingo@elte.hu>
26 files changed:
Makefile
arch/alpha/kernel/vmlinux.lds.S
arch/arm/kernel/vmlinux.lds.S
arch/avr32/kernel/vmlinux.lds.S
arch/blackfin/kernel/vmlinux.lds.S
arch/cris/kernel/vmlinux.lds.S
arch/frv/kernel/vmlinux.lds.S
arch/h8300/kernel/vmlinux.lds.S
arch/ia64/kernel/vmlinux.lds.S
arch/m32r/kernel/vmlinux.lds.S
arch/m68k/kernel/vmlinux-std.lds
arch/m68k/kernel/vmlinux-sun3.lds
arch/m68knommu/kernel/vmlinux.lds.S
arch/microblaze/kernel/vmlinux.lds.S
arch/mips/kernel/vmlinux.lds.S
arch/mn10300/kernel/vmlinux.lds.S
arch/parisc/kernel/vmlinux.lds.S
arch/powerpc/kernel/vmlinux.lds.S
arch/s390/kernel/vmlinux.lds.S
arch/sh/kernel/vmlinux.lds.S
arch/sparc/kernel/vmlinux.lds.S
arch/um/kernel/dyn.lds.S
arch/um/kernel/uml.lds.S
arch/xtensa/kernel/vmlinux.lds.S
include/asm-generic/vmlinux.lds.h
scripts/module-common.lds [new file with mode: 0644]

index 46e1c9d03d515c4a32945b189584a1f652e87c1c..12245be05122cb4cb80f0ee5ba1b438fd391f749 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -327,7 +327,7 @@ CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
 MODFLAGS       = -DMODULE
 CFLAGS_MODULE   = $(MODFLAGS)
 AFLAGS_MODULE   = $(MODFLAGS)
-LDFLAGS_MODULE  =
+LDFLAGS_MODULE  = -T $(srctree)/scripts/module-common.lds
 CFLAGS_KERNEL  =
 AFLAGS_KERNEL  =
 CFLAGS_GCOV    = -fprofile-arcs -ftest-coverage
index b9d6568e5f7f0eb68f7ecb2dac4207a705e0e47b..75fe1d6877e9ec07f5a785c8c0a64aaa9b83b6ad 100644 (file)
@@ -139,6 +139,7 @@ SECTIONS
                EXIT_TEXT
                EXIT_DATA
                *(.exitcall.exit)
+               *(.discard)
        }
 
        .mdebug 0 : {
index 6c0779792546d5c58d4ab722d4b3e037022a1ffa..e256c57b89814c134aac1b9fdc491ff48a4f36d3 100644 (file)
@@ -82,6 +82,7 @@ SECTIONS
                EXIT_TEXT
                EXIT_DATA
                *(.exitcall.exit)
+               *(.discard)
                *(.ARM.exidx.exit.text)
                *(.ARM.extab.exit.text)
 #ifndef CONFIG_MMU
index 7910d41eb886358981cd32bfc5b36ba215d4b636..b8324608ec0c9b8ee5db861576d159e3b8bd6bce 100644 (file)
@@ -131,6 +131,7 @@ SECTIONS
        /DISCARD/               : {
                EXIT_DATA
                *(.exitcall.exit)
+               *(.discard)
        }
 
        DWARF_DEBUG
index 6ac307ca0d805a7487d1990b59978bcf9f834ec1..6e8eabd8f0a6dd9e5afe68a7b57d9095a49b0797 100644 (file)
@@ -280,5 +280,6 @@ SECTIONS
        /DISCARD/ :
        {
                *(.exitcall.exit)
+               *(.discard)
        }
 }
index 0d2adfc794d49d0bcb8e4a63f3671875dbd7e816..a3175ebb38ccfa62a64d93f4fcf7cb06d2e0a104 100644 (file)
@@ -145,6 +145,7 @@ SECTIONS
                EXIT_TEXT
                EXIT_DATA
                *(.exitcall.exit)
+               *(.discard)
         }
 
        dram_end = dram_start + (CONFIG_ETRAX_DRAM_SIZE - __CONFIG_ETRAX_VMEM_SIZE)*1024*1024;
index 22d9787406ed9862f2ac0771c2345c13502751be..64b5a5e4d35e77040c398871a6f40c9afc07c7df 100644 (file)
@@ -177,6 +177,8 @@ SECTIONS
   .debug_ranges                0 : { *(.debug_ranges) }
 
   .comment 0 : { *(.comment) }
+
+  /DISCARD/ : { *(.discard) }
 }
 
 __kernel_image_size_no_bss = __bss_start - __kernel_image_start;
index 43a87b9085b6b449cb7fbfb64bfb5d715551185c..03d6c0df33db44462aee6e8c290acc8e0dffe37b 100644 (file)
@@ -154,6 +154,7 @@ SECTIONS
        }
        /DISCARD/ : {
                *(.exitcall.exit)
+               *(.discard)
        }
         .romfs :       
        {
index 4a95e86b9ac200bafd30ddca8b1d50be6aec5081..13d958975874bba06d9060eecdd4fa8421e9eb82 100644 (file)
@@ -29,6 +29,7 @@ SECTIONS
        EXIT_TEXT
        EXIT_DATA
        *(.exitcall.exit)
+       *(.discard)
        *(.IA_64.unwind.exit.text)
        *(.IA_64.unwind_info.exit.text)
        }
index 4179adf6c624f0f6c5af62bf82bef34e761a17ed..480a49944cfd426c5d05bda87a69e676b4e41071 100644 (file)
@@ -125,6 +125,7 @@ SECTIONS
        EXIT_TEXT
        EXIT_DATA
        *(.exitcall.exit)
+       *(.discard)
        }
 
   /* Stabs debugging sections.  */
index 01d212bb05a6edcc965636f887b6117d3e92c863..905a797ada935a3a1a2517cb38bd61537efe01ee 100644 (file)
@@ -87,6 +87,7 @@ SECTIONS
        EXIT_TEXT
        EXIT_DATA
        *(.exitcall.exit)
+       *(.discard)
        }
 
   /* Stabs debugging sections.  */
index c192f773db9684a261a5d3529f501a1cd6c57c91..47d04be322aac4e86dc5350193f4ca1fd8beb936 100644 (file)
@@ -82,6 +82,7 @@ __init_begin = .;
        EXIT_TEXT
        EXIT_DATA
        *(.exitcall.exit)
+       *(.discard)
        }
 
   .crap : {
index b7fe505e358d853e1d38d11b78826f1ee050169e..68111a61a77f26f175a3cc15931f88d482b04dac 100644 (file)
@@ -188,6 +188,7 @@ SECTIONS {
                EXIT_TEXT
                EXIT_DATA
                *(.exitcall.exit)
+               *(.discard)
        }
 
        .bss : {
index d34d38dcd12c71a733da03bee3b0e017f9320ca8..a207543c5927f0e5168e64af9c879712f2977a40 100644 (file)
@@ -162,4 +162,6 @@ SECTIONS {
        }
        . = ALIGN(4096);
        _end = .;
+
+       /DISCARD/ : { *(.discard) }
 }
index 58738c8d754feb09bf525fe6862c62e1f6bda39a..45901609b741df293b027fe0dffba7822c54b122 100644 (file)
@@ -179,6 +179,7 @@ SECTIONS
        /* Sections to be discarded */
        /DISCARD/ : {
                *(.exitcall.exit)
+               *(.discard)
 
                /* ABI crap starts here */
                *(.MIPS.options)
index 24de6b90f4014af918790c714181077a041fe714..5d9f2f96ad921ce29f685a3426a4533ef5cc5dc3 100644 (file)
@@ -146,6 +146,7 @@ SECTIONS
   /* Sections to be discarded */
   /DISCARD/ : {
        *(.exitcall.exit)
+       *(.discard)
        }
 
   STABS_DEBUG
index fd2cc4fd2b65adc5b84dd46639d4eaea1ea58d77..ccf58341845a1484b529c08d251d475613fdfcdb 100644 (file)
@@ -240,6 +240,7 @@ SECTIONS
        /* Sections to be discarded */
        /DISCARD/ : {
                *(.exitcall.exit)
+               *(.discard)
 #ifdef CONFIG_64BIT
                /* temporary hack until binutils is fixed to not emit these
                 * for static binaries
index 8ef8a14abc95b5ccf9bc2ba93e84ba9c881a6729..7fca9355fd3d6a1fffce12d8cc7d09d30a250f36 100644 (file)
@@ -40,6 +40,7 @@ SECTIONS
        /* Sections to be discarded. */
        /DISCARD/ : {
        *(.exitcall.exit)
+       *(.discard)
        EXIT_DATA
        }
 
index a53db23ee092fcbd37f2fa2e16ca5fbc8a583cd7..98867dfea4696ac9cffe386934b500a9aa14f6ad 100644 (file)
@@ -161,6 +161,7 @@ SECTIONS
        /DISCARD/ : {
                EXIT_DATA
                *(.exitcall.exit)
+               *(.discard)
        }
 
        /* Debugging sections.  */
index f53c76acaede2f1af80aaec431e53308c4681bee..766976d27b21960c0a205ee454fc129a8a84633e 100644 (file)
@@ -171,6 +171,7 @@ SECTIONS
         */
        /DISCARD/ : {
                *(.exitcall.exit)
+               *(.discard)
        }
 
        STABS_DEBUG
index fcbbd000ec08408725997c3cd07db77a6d2684ac..d63cf914667de8c0cb327aaf182f2e83d19b42a9 100644 (file)
@@ -175,6 +175,7 @@ SECTIONS
                EXIT_TEXT
                EXIT_DATA
                *(.exitcall.exit)
+               *(.discard)
        }
 
        STABS_DEBUG
index 9975e1ab44fb38aa71c720e70170eceee8c91198..2916d6eadffd4ce92d9a922ab911b3b166e8590f 100644 (file)
@@ -156,4 +156,6 @@ SECTIONS
   STABS_DEBUG
 
   DWARF_DEBUG
+
+  /DISCARD/    : { *(.discard) }
 }
index 11b835248b865338f025a88d40a2c276ad3b7d88..1f8a622cabe1909ab237916462857dae3ea338ab 100644 (file)
@@ -100,4 +100,6 @@ SECTIONS
   STABS_DEBUG
 
   DWARF_DEBUG
+
+  /DISCARD/    : { *(.discard) }
 }
index 41c159cd872f14bb55893c42c7c158cfacb6b6ac..b1e24638acd7c3b2040cad8ea1487b85ec78fa8e 100644 (file)
@@ -287,6 +287,7 @@ SECTIONS
        EXIT_TEXT
        EXIT_DATA
         *(.exitcall.exit)
+       *(.discard)
   }
 
   .xt.lit : { *(.xt.lit) }
index 55413e568f07d138e568ca0e0002bbf7ecdaa138..a19120c4e1095541e4f38bf613aea504d45390fb 100644 (file)
 #define INITRAMFS
 #endif
 
+#define DISCARDS                                                       \
+       /DISCARD/ : {                                                   \
+       EXIT_TEXT                                                       \
+       EXIT_DATA                                                       \
+       *(.exitcall.exit)                                               \
+       *(.discard)                                                     \
+       }
+
 /**
  * PERCPU_VADDR - define output section for percpu area
  * @vaddr: explicit base address (optional)
diff --git a/scripts/module-common.lds b/scripts/module-common.lds
new file mode 100644 (file)
index 0000000..47a1f9a
--- /dev/null
@@ -0,0 +1,8 @@
+/*
+ * 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 {
+       /DISCARD/ : { *(.discard) }
+}