aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-06-24 02:13:38 -0400
committerTejun Heo <tj@kernel.org>2009-06-24 02:13:38 -0400
commit405d967dc70002991f8fc35c20e0d3cbc7614f63 (patch)
treeace31796327e9035488310d42e06acbab3a28656
parente74e396204bfcb67570ba4517b08f5918e69afea (diff)
linker script: throw away .discard section
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>
-rw-r--r--Makefile2
-rw-r--r--arch/alpha/kernel/vmlinux.lds.S1
-rw-r--r--arch/arm/kernel/vmlinux.lds.S1
-rw-r--r--arch/avr32/kernel/vmlinux.lds.S1
-rw-r--r--arch/blackfin/kernel/vmlinux.lds.S1
-rw-r--r--arch/cris/kernel/vmlinux.lds.S1
-rw-r--r--arch/frv/kernel/vmlinux.lds.S2
-rw-r--r--arch/h8300/kernel/vmlinux.lds.S1
-rw-r--r--arch/ia64/kernel/vmlinux.lds.S1
-rw-r--r--arch/m32r/kernel/vmlinux.lds.S1
-rw-r--r--arch/m68k/kernel/vmlinux-std.lds1
-rw-r--r--arch/m68k/kernel/vmlinux-sun3.lds1
-rw-r--r--arch/m68knommu/kernel/vmlinux.lds.S1
-rw-r--r--arch/microblaze/kernel/vmlinux.lds.S2
-rw-r--r--arch/mips/kernel/vmlinux.lds.S1
-rw-r--r--arch/mn10300/kernel/vmlinux.lds.S1
-rw-r--r--arch/parisc/kernel/vmlinux.lds.S1
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S1
-rw-r--r--arch/s390/kernel/vmlinux.lds.S1
-rw-r--r--arch/sh/kernel/vmlinux.lds.S1
-rw-r--r--arch/sparc/kernel/vmlinux.lds.S1
-rw-r--r--arch/um/kernel/dyn.lds.S2
-rw-r--r--arch/um/kernel/uml.lds.S2
-rw-r--r--arch/xtensa/kernel/vmlinux.lds.S1
-rw-r--r--include/asm-generic/vmlinux.lds.h8
-rw-r--r--scripts/module-common.lds8
26 files changed, 44 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 46e1c9d03d51..12245be05122 100644
--- a/Makefile
+++ b/Makefile
@@ -327,7 +327,7 @@ CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
327MODFLAGS = -DMODULE 327MODFLAGS = -DMODULE
328CFLAGS_MODULE = $(MODFLAGS) 328CFLAGS_MODULE = $(MODFLAGS)
329AFLAGS_MODULE = $(MODFLAGS) 329AFLAGS_MODULE = $(MODFLAGS)
330LDFLAGS_MODULE = 330LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds
331CFLAGS_KERNEL = 331CFLAGS_KERNEL =
332AFLAGS_KERNEL = 332AFLAGS_KERNEL =
333CFLAGS_GCOV = -fprofile-arcs -ftest-coverage 333CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S
index b9d6568e5f7f..75fe1d6877e9 100644
--- a/arch/alpha/kernel/vmlinux.lds.S
+++ b/arch/alpha/kernel/vmlinux.lds.S
@@ -139,6 +139,7 @@ SECTIONS
139 EXIT_TEXT 139 EXIT_TEXT
140 EXIT_DATA 140 EXIT_DATA
141 *(.exitcall.exit) 141 *(.exitcall.exit)
142 *(.discard)
142 } 143 }
143 144
144 .mdebug 0 : { 145 .mdebug 0 : {
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 6c0779792546..e256c57b8981 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -82,6 +82,7 @@ SECTIONS
82 EXIT_TEXT 82 EXIT_TEXT
83 EXIT_DATA 83 EXIT_DATA
84 *(.exitcall.exit) 84 *(.exitcall.exit)
85 *(.discard)
85 *(.ARM.exidx.exit.text) 86 *(.ARM.exidx.exit.text)
86 *(.ARM.extab.exit.text) 87 *(.ARM.extab.exit.text)
87#ifndef CONFIG_MMU 88#ifndef CONFIG_MMU
diff --git a/arch/avr32/kernel/vmlinux.lds.S b/arch/avr32/kernel/vmlinux.lds.S
index 7910d41eb886..b8324608ec0c 100644
--- a/arch/avr32/kernel/vmlinux.lds.S
+++ b/arch/avr32/kernel/vmlinux.lds.S
@@ -131,6 +131,7 @@ SECTIONS
131 /DISCARD/ : { 131 /DISCARD/ : {
132 EXIT_DATA 132 EXIT_DATA
133 *(.exitcall.exit) 133 *(.exitcall.exit)
134 *(.discard)
134 } 135 }
135 136
136 DWARF_DEBUG 137 DWARF_DEBUG
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S
index 6ac307ca0d80..6e8eabd8f0a6 100644
--- a/arch/blackfin/kernel/vmlinux.lds.S
+++ b/arch/blackfin/kernel/vmlinux.lds.S
@@ -280,5 +280,6 @@ SECTIONS
280 /DISCARD/ : 280 /DISCARD/ :
281 { 281 {
282 *(.exitcall.exit) 282 *(.exitcall.exit)
283 *(.discard)
283 } 284 }
284} 285}
diff --git a/arch/cris/kernel/vmlinux.lds.S b/arch/cris/kernel/vmlinux.lds.S
index 0d2adfc794d4..a3175ebb38cc 100644
--- a/arch/cris/kernel/vmlinux.lds.S
+++ b/arch/cris/kernel/vmlinux.lds.S
@@ -145,6 +145,7 @@ SECTIONS
145 EXIT_TEXT 145 EXIT_TEXT
146 EXIT_DATA 146 EXIT_DATA
147 *(.exitcall.exit) 147 *(.exitcall.exit)
148 *(.discard)
148 } 149 }
149 150
150 dram_end = dram_start + (CONFIG_ETRAX_DRAM_SIZE - __CONFIG_ETRAX_VMEM_SIZE)*1024*1024; 151 dram_end = dram_start + (CONFIG_ETRAX_DRAM_SIZE - __CONFIG_ETRAX_VMEM_SIZE)*1024*1024;
diff --git a/arch/frv/kernel/vmlinux.lds.S b/arch/frv/kernel/vmlinux.lds.S
index 22d9787406ed..64b5a5e4d35e 100644
--- a/arch/frv/kernel/vmlinux.lds.S
+++ b/arch/frv/kernel/vmlinux.lds.S
@@ -177,6 +177,8 @@ SECTIONS
177 .debug_ranges 0 : { *(.debug_ranges) } 177 .debug_ranges 0 : { *(.debug_ranges) }
178 178
179 .comment 0 : { *(.comment) } 179 .comment 0 : { *(.comment) }
180
181 /DISCARD/ : { *(.discard) }
180} 182}
181 183
182__kernel_image_size_no_bss = __bss_start - __kernel_image_start; 184__kernel_image_size_no_bss = __bss_start - __kernel_image_start;
diff --git a/arch/h8300/kernel/vmlinux.lds.S b/arch/h8300/kernel/vmlinux.lds.S
index 43a87b9085b6..03d6c0df33db 100644
--- a/arch/h8300/kernel/vmlinux.lds.S
+++ b/arch/h8300/kernel/vmlinux.lds.S
@@ -154,6 +154,7 @@ SECTIONS
154 } 154 }
155 /DISCARD/ : { 155 /DISCARD/ : {
156 *(.exitcall.exit) 156 *(.exitcall.exit)
157 *(.discard)
157 } 158 }
158 .romfs : 159 .romfs :
159 { 160 {
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index 4a95e86b9ac2..13d958975874 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -29,6 +29,7 @@ SECTIONS
29 EXIT_TEXT 29 EXIT_TEXT
30 EXIT_DATA 30 EXIT_DATA
31 *(.exitcall.exit) 31 *(.exitcall.exit)
32 *(.discard)
32 *(.IA_64.unwind.exit.text) 33 *(.IA_64.unwind.exit.text)
33 *(.IA_64.unwind_info.exit.text) 34 *(.IA_64.unwind_info.exit.text)
34 } 35 }
diff --git a/arch/m32r/kernel/vmlinux.lds.S b/arch/m32r/kernel/vmlinux.lds.S
index 4179adf6c624..480a49944cfd 100644
--- a/arch/m32r/kernel/vmlinux.lds.S
+++ b/arch/m32r/kernel/vmlinux.lds.S
@@ -125,6 +125,7 @@ SECTIONS
125 EXIT_TEXT 125 EXIT_TEXT
126 EXIT_DATA 126 EXIT_DATA
127 *(.exitcall.exit) 127 *(.exitcall.exit)
128 *(.discard)
128 } 129 }
129 130
130 /* Stabs debugging sections. */ 131 /* Stabs debugging sections. */
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index 01d212bb05a6..905a797ada93 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -87,6 +87,7 @@ SECTIONS
87 EXIT_TEXT 87 EXIT_TEXT
88 EXIT_DATA 88 EXIT_DATA
89 *(.exitcall.exit) 89 *(.exitcall.exit)
90 *(.discard)
90 } 91 }
91 92
92 /* Stabs debugging sections. */ 93 /* Stabs debugging sections. */
diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds
index c192f773db96..47d04be322aa 100644
--- a/arch/m68k/kernel/vmlinux-sun3.lds
+++ b/arch/m68k/kernel/vmlinux-sun3.lds
@@ -82,6 +82,7 @@ __init_begin = .;
82 EXIT_TEXT 82 EXIT_TEXT
83 EXIT_DATA 83 EXIT_DATA
84 *(.exitcall.exit) 84 *(.exitcall.exit)
85 *(.discard)
85 } 86 }
86 87
87 .crap : { 88 .crap : {
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index b7fe505e358d..68111a61a77f 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -188,6 +188,7 @@ SECTIONS {
188 EXIT_TEXT 188 EXIT_TEXT
189 EXIT_DATA 189 EXIT_DATA
190 *(.exitcall.exit) 190 *(.exitcall.exit)
191 *(.discard)
191 } 192 }
192 193
193 .bss : { 194 .bss : {
diff --git a/arch/microblaze/kernel/vmlinux.lds.S b/arch/microblaze/kernel/vmlinux.lds.S
index d34d38dcd12c..a207543c5927 100644
--- a/arch/microblaze/kernel/vmlinux.lds.S
+++ b/arch/microblaze/kernel/vmlinux.lds.S
@@ -162,4 +162,6 @@ SECTIONS {
162 } 162 }
163 . = ALIGN(4096); 163 . = ALIGN(4096);
164 _end = .; 164 _end = .;
165
166 /DISCARD/ : { *(.discard) }
165} 167}
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 58738c8d754f..45901609b741 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -179,6 +179,7 @@ SECTIONS
179 /* Sections to be discarded */ 179 /* Sections to be discarded */
180 /DISCARD/ : { 180 /DISCARD/ : {
181 *(.exitcall.exit) 181 *(.exitcall.exit)
182 *(.discard)
182 183
183 /* ABI crap starts here */ 184 /* ABI crap starts here */
184 *(.MIPS.options) 185 *(.MIPS.options)
diff --git a/arch/mn10300/kernel/vmlinux.lds.S b/arch/mn10300/kernel/vmlinux.lds.S
index 24de6b90f401..5d9f2f96ad92 100644
--- a/arch/mn10300/kernel/vmlinux.lds.S
+++ b/arch/mn10300/kernel/vmlinux.lds.S
@@ -146,6 +146,7 @@ SECTIONS
146 /* Sections to be discarded */ 146 /* Sections to be discarded */
147 /DISCARD/ : { 147 /DISCARD/ : {
148 *(.exitcall.exit) 148 *(.exitcall.exit)
149 *(.discard)
149 } 150 }
150 151
151 STABS_DEBUG 152 STABS_DEBUG
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S
index fd2cc4fd2b65..ccf58341845a 100644
--- a/arch/parisc/kernel/vmlinux.lds.S
+++ b/arch/parisc/kernel/vmlinux.lds.S
@@ -240,6 +240,7 @@ SECTIONS
240 /* Sections to be discarded */ 240 /* Sections to be discarded */
241 /DISCARD/ : { 241 /DISCARD/ : {
242 *(.exitcall.exit) 242 *(.exitcall.exit)
243 *(.discard)
243#ifdef CONFIG_64BIT 244#ifdef CONFIG_64BIT
244 /* temporary hack until binutils is fixed to not emit these 245 /* temporary hack until binutils is fixed to not emit these
245 * for static binaries 246 * for static binaries
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 8ef8a14abc95..7fca9355fd3d 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -40,6 +40,7 @@ SECTIONS
40 /* Sections to be discarded. */ 40 /* Sections to be discarded. */
41 /DISCARD/ : { 41 /DISCARD/ : {
42 *(.exitcall.exit) 42 *(.exitcall.exit)
43 *(.discard)
43 EXIT_DATA 44 EXIT_DATA
44 } 45 }
45 46
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index a53db23ee092..98867dfea469 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -161,6 +161,7 @@ SECTIONS
161 /DISCARD/ : { 161 /DISCARD/ : {
162 EXIT_DATA 162 EXIT_DATA
163 *(.exitcall.exit) 163 *(.exitcall.exit)
164 *(.discard)
164 } 165 }
165 166
166 /* Debugging sections. */ 167 /* Debugging sections. */
diff --git a/arch/sh/kernel/vmlinux.lds.S b/arch/sh/kernel/vmlinux.lds.S
index f53c76acaede..766976d27b21 100644
--- a/arch/sh/kernel/vmlinux.lds.S
+++ b/arch/sh/kernel/vmlinux.lds.S
@@ -171,6 +171,7 @@ SECTIONS
171 */ 171 */
172 /DISCARD/ : { 172 /DISCARD/ : {
173 *(.exitcall.exit) 173 *(.exitcall.exit)
174 *(.discard)
174 } 175 }
175 176
176 STABS_DEBUG 177 STABS_DEBUG
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index fcbbd000ec08..d63cf914667d 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -175,6 +175,7 @@ SECTIONS
175 EXIT_TEXT 175 EXIT_TEXT
176 EXIT_DATA 176 EXIT_DATA
177 *(.exitcall.exit) 177 *(.exitcall.exit)
178 *(.discard)
178 } 179 }
179 180
180 STABS_DEBUG 181 STABS_DEBUG
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index 9975e1ab44fb..2916d6eadffd 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -156,4 +156,6 @@ SECTIONS
156 STABS_DEBUG 156 STABS_DEBUG
157 157
158 DWARF_DEBUG 158 DWARF_DEBUG
159
160 /DISCARD/ : { *(.discard) }
159} 161}
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index 11b835248b86..1f8a622cabe1 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -100,4 +100,6 @@ SECTIONS
100 STABS_DEBUG 100 STABS_DEBUG
101 101
102 DWARF_DEBUG 102 DWARF_DEBUG
103
104 /DISCARD/ : { *(.discard) }
103} 105}
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index 41c159cd872f..b1e24638acd7 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -287,6 +287,7 @@ SECTIONS
287 EXIT_TEXT 287 EXIT_TEXT
288 EXIT_DATA 288 EXIT_DATA
289 *(.exitcall.exit) 289 *(.exitcall.exit)
290 *(.discard)
290 } 291 }
291 292
292 .xt.lit : { *(.xt.lit) } 293 .xt.lit : { *(.xt.lit) }
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 55413e568f07..a19120c4e109 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -628,6 +628,14 @@
628#define INITRAMFS 628#define INITRAMFS
629#endif 629#endif
630 630
631#define DISCARDS \
632 /DISCARD/ : { \
633 EXIT_TEXT \
634 EXIT_DATA \
635 *(.exitcall.exit) \
636 *(.discard) \
637 }
638
631/** 639/**
632 * PERCPU_VADDR - define output section for percpu area 640 * PERCPU_VADDR - define output section for percpu area
633 * @vaddr: explicit base address (optional) 641 * @vaddr: explicit base address (optional)
diff --git a/scripts/module-common.lds b/scripts/module-common.lds
new file mode 100644
index 000000000000..47a1f9ae0ede
--- /dev/null
+++ b/scripts/module-common.lds
@@ -0,0 +1,8 @@
1/*
2 * Common module linker script, always used when linking a module.
3 * Archs are free to supply their own linker scripts. ld will
4 * combine them automatically.
5 */
6SECTIONS {
7 /DISCARD/ : { *(.discard) }
8}