mirror of
https://github.com/adulau/aha.git
synced 2024-12-26 18:56:14 +00:00
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>
This commit is contained in:
parent
e74e396204
commit
405d967dc7
26 changed files with 44 additions and 1 deletions
2
Makefile
2
Makefile
|
@ -327,7 +327,7 @@ CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
|
||||||
MODFLAGS = -DMODULE
|
MODFLAGS = -DMODULE
|
||||||
CFLAGS_MODULE = $(MODFLAGS)
|
CFLAGS_MODULE = $(MODFLAGS)
|
||||||
AFLAGS_MODULE = $(MODFLAGS)
|
AFLAGS_MODULE = $(MODFLAGS)
|
||||||
LDFLAGS_MODULE =
|
LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds
|
||||||
CFLAGS_KERNEL =
|
CFLAGS_KERNEL =
|
||||||
AFLAGS_KERNEL =
|
AFLAGS_KERNEL =
|
||||||
CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
|
CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
|
||||||
|
|
|
@ -139,6 +139,7 @@ SECTIONS
|
||||||
EXIT_TEXT
|
EXIT_TEXT
|
||||||
EXIT_DATA
|
EXIT_DATA
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
}
|
}
|
||||||
|
|
||||||
.mdebug 0 : {
|
.mdebug 0 : {
|
||||||
|
|
|
@ -82,6 +82,7 @@ SECTIONS
|
||||||
EXIT_TEXT
|
EXIT_TEXT
|
||||||
EXIT_DATA
|
EXIT_DATA
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
*(.ARM.exidx.exit.text)
|
*(.ARM.exidx.exit.text)
|
||||||
*(.ARM.extab.exit.text)
|
*(.ARM.extab.exit.text)
|
||||||
#ifndef CONFIG_MMU
|
#ifndef CONFIG_MMU
|
||||||
|
|
|
@ -131,6 +131,7 @@ SECTIONS
|
||||||
/DISCARD/ : {
|
/DISCARD/ : {
|
||||||
EXIT_DATA
|
EXIT_DATA
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
}
|
}
|
||||||
|
|
||||||
DWARF_DEBUG
|
DWARF_DEBUG
|
||||||
|
|
|
@ -280,5 +280,6 @@ SECTIONS
|
||||||
/DISCARD/ :
|
/DISCARD/ :
|
||||||
{
|
{
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,6 +145,7 @@ SECTIONS
|
||||||
EXIT_TEXT
|
EXIT_TEXT
|
||||||
EXIT_DATA
|
EXIT_DATA
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
}
|
}
|
||||||
|
|
||||||
dram_end = dram_start + (CONFIG_ETRAX_DRAM_SIZE - __CONFIG_ETRAX_VMEM_SIZE)*1024*1024;
|
dram_end = dram_start + (CONFIG_ETRAX_DRAM_SIZE - __CONFIG_ETRAX_VMEM_SIZE)*1024*1024;
|
||||||
|
|
|
@ -177,6 +177,8 @@ SECTIONS
|
||||||
.debug_ranges 0 : { *(.debug_ranges) }
|
.debug_ranges 0 : { *(.debug_ranges) }
|
||||||
|
|
||||||
.comment 0 : { *(.comment) }
|
.comment 0 : { *(.comment) }
|
||||||
|
|
||||||
|
/DISCARD/ : { *(.discard) }
|
||||||
}
|
}
|
||||||
|
|
||||||
__kernel_image_size_no_bss = __bss_start - __kernel_image_start;
|
__kernel_image_size_no_bss = __bss_start - __kernel_image_start;
|
||||||
|
|
|
@ -154,6 +154,7 @@ SECTIONS
|
||||||
}
|
}
|
||||||
/DISCARD/ : {
|
/DISCARD/ : {
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
}
|
}
|
||||||
.romfs :
|
.romfs :
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,6 +29,7 @@ SECTIONS
|
||||||
EXIT_TEXT
|
EXIT_TEXT
|
||||||
EXIT_DATA
|
EXIT_DATA
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
*(.IA_64.unwind.exit.text)
|
*(.IA_64.unwind.exit.text)
|
||||||
*(.IA_64.unwind_info.exit.text)
|
*(.IA_64.unwind_info.exit.text)
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,6 +125,7 @@ SECTIONS
|
||||||
EXIT_TEXT
|
EXIT_TEXT
|
||||||
EXIT_DATA
|
EXIT_DATA
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stabs debugging sections. */
|
/* Stabs debugging sections. */
|
||||||
|
|
|
@ -87,6 +87,7 @@ SECTIONS
|
||||||
EXIT_TEXT
|
EXIT_TEXT
|
||||||
EXIT_DATA
|
EXIT_DATA
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stabs debugging sections. */
|
/* Stabs debugging sections. */
|
||||||
|
|
|
@ -82,6 +82,7 @@ __init_begin = .;
|
||||||
EXIT_TEXT
|
EXIT_TEXT
|
||||||
EXIT_DATA
|
EXIT_DATA
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
}
|
}
|
||||||
|
|
||||||
.crap : {
|
.crap : {
|
||||||
|
|
|
@ -188,6 +188,7 @@ SECTIONS {
|
||||||
EXIT_TEXT
|
EXIT_TEXT
|
||||||
EXIT_DATA
|
EXIT_DATA
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
}
|
}
|
||||||
|
|
||||||
.bss : {
|
.bss : {
|
||||||
|
|
|
@ -162,4 +162,6 @@ SECTIONS {
|
||||||
}
|
}
|
||||||
. = ALIGN(4096);
|
. = ALIGN(4096);
|
||||||
_end = .;
|
_end = .;
|
||||||
|
|
||||||
|
/DISCARD/ : { *(.discard) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,6 +179,7 @@ SECTIONS
|
||||||
/* Sections to be discarded */
|
/* Sections to be discarded */
|
||||||
/DISCARD/ : {
|
/DISCARD/ : {
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
|
|
||||||
/* ABI crap starts here */
|
/* ABI crap starts here */
|
||||||
*(.MIPS.options)
|
*(.MIPS.options)
|
||||||
|
|
|
@ -146,6 +146,7 @@ SECTIONS
|
||||||
/* Sections to be discarded */
|
/* Sections to be discarded */
|
||||||
/DISCARD/ : {
|
/DISCARD/ : {
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
}
|
}
|
||||||
|
|
||||||
STABS_DEBUG
|
STABS_DEBUG
|
||||||
|
|
|
@ -240,6 +240,7 @@ SECTIONS
|
||||||
/* Sections to be discarded */
|
/* Sections to be discarded */
|
||||||
/DISCARD/ : {
|
/DISCARD/ : {
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
#ifdef CONFIG_64BIT
|
#ifdef CONFIG_64BIT
|
||||||
/* temporary hack until binutils is fixed to not emit these
|
/* temporary hack until binutils is fixed to not emit these
|
||||||
* for static binaries
|
* for static binaries
|
||||||
|
|
|
@ -40,6 +40,7 @@ SECTIONS
|
||||||
/* Sections to be discarded. */
|
/* Sections to be discarded. */
|
||||||
/DISCARD/ : {
|
/DISCARD/ : {
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
EXIT_DATA
|
EXIT_DATA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,7 @@ SECTIONS
|
||||||
/DISCARD/ : {
|
/DISCARD/ : {
|
||||||
EXIT_DATA
|
EXIT_DATA
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Debugging sections. */
|
/* Debugging sections. */
|
||||||
|
|
|
@ -171,6 +171,7 @@ SECTIONS
|
||||||
*/
|
*/
|
||||||
/DISCARD/ : {
|
/DISCARD/ : {
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
}
|
}
|
||||||
|
|
||||||
STABS_DEBUG
|
STABS_DEBUG
|
||||||
|
|
|
@ -175,6 +175,7 @@ SECTIONS
|
||||||
EXIT_TEXT
|
EXIT_TEXT
|
||||||
EXIT_DATA
|
EXIT_DATA
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
}
|
}
|
||||||
|
|
||||||
STABS_DEBUG
|
STABS_DEBUG
|
||||||
|
|
|
@ -156,4 +156,6 @@ SECTIONS
|
||||||
STABS_DEBUG
|
STABS_DEBUG
|
||||||
|
|
||||||
DWARF_DEBUG
|
DWARF_DEBUG
|
||||||
|
|
||||||
|
/DISCARD/ : { *(.discard) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,4 +100,6 @@ SECTIONS
|
||||||
STABS_DEBUG
|
STABS_DEBUG
|
||||||
|
|
||||||
DWARF_DEBUG
|
DWARF_DEBUG
|
||||||
|
|
||||||
|
/DISCARD/ : { *(.discard) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,6 +287,7 @@ SECTIONS
|
||||||
EXIT_TEXT
|
EXIT_TEXT
|
||||||
EXIT_DATA
|
EXIT_DATA
|
||||||
*(.exitcall.exit)
|
*(.exitcall.exit)
|
||||||
|
*(.discard)
|
||||||
}
|
}
|
||||||
|
|
||||||
.xt.lit : { *(.xt.lit) }
|
.xt.lit : { *(.xt.lit) }
|
||||||
|
|
|
@ -628,6 +628,14 @@
|
||||||
#define INITRAMFS
|
#define INITRAMFS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define DISCARDS \
|
||||||
|
/DISCARD/ : { \
|
||||||
|
EXIT_TEXT \
|
||||||
|
EXIT_DATA \
|
||||||
|
*(.exitcall.exit) \
|
||||||
|
*(.discard) \
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PERCPU_VADDR - define output section for percpu area
|
* PERCPU_VADDR - define output section for percpu area
|
||||||
* @vaddr: explicit base address (optional)
|
* @vaddr: explicit base address (optional)
|
||||||
|
|
8
scripts/module-common.lds
Normal file
8
scripts/module-common.lds
Normal file
|
@ -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) }
|
||||||
|
}
|
Loading…
Reference in a new issue