linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] linker script: unify usage of discard definition
@ 2009-07-03 23:37 Tejun Heo
  2009-07-03 23:37 ` Tejun Heo
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Tejun Heo @ 2009-07-03 23:37 UTC (permalink / raw)
  To: linux-arch@vger.kernel.org, Linux Kernel, Michal Simek,
	microblaze-uclinux, Sam

Discarded sections in different archs share some commonality but have
considerable differences.  This led to linker script for each arch
implementing its own /DISCARD/ definition, which makes maintaining
tedious and adding new entries error-prone.

This patch makes all linker scripts to move discard definitions to the
end of the linker script and use the common DISCARDS macro.  As ld
uses the first matching section definition, archs can include default
discarded sections by including them earlier in the linker script.

On x86-64 which explicitly includes EXIT_TEXT, this produces identical
output as before and all but one archs included directives (include or
discard) for all default discarded sections, so this patch shouldn't
cause any behavior difference.

The only problem case is microblaze, which didn't explicitly included
EXIT_TEXT and DATA but didn't discard them either leaving ld to create
identically names output sections for them.  This patch will make the
end result different by throwing away exit text and data.  It looks
like the ommission was accidental and throwing away is the right thing
to do, but I won't push it till someone who knows microblaze confirms
it.

This patch is on top of the current percpu#for-next.

  git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu.git for-next

Thanks.

NOT_SIGNED_OFF_YET
Cc: linux-arch@vger.kernel.org
Cc: Michal Simek <monstr@monstr.eu>
Cc: microblaze-uclinux@itee.uq.edu.au
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Tony Luck <tony.luck@intel.com>
---
 arch/alpha/kernel/vmlinux.lds.S      |   10 ++--------
 arch/avr32/kernel/vmlinux.lds.S      |   10 +++-------
 arch/blackfin/kernel/vmlinux.lds.S   |    6 +-----
 arch/cris/kernel/vmlinux.lds.S       |   10 ++--------
 arch/frv/kernel/vmlinux.lds.S        |    2 +-
 arch/h8300/kernel/vmlinux.lds.S      |    6 ++----
 arch/ia64/kernel/vmlinux.lds.S       |   22 +++++++++-------------
 arch/m32r/kernel/vmlinux.lds.S       |   11 +++--------
 arch/m68k/kernel/vmlinux-std.lds     |   11 +++--------
 arch/m68k/kernel/vmlinux-sun3.lds    |   10 ++--------
 arch/m68knommu/kernel/vmlinux.lds.S  |    8 +-------
 arch/microblaze/kernel/vmlinux.lds.S |    2 +-
 arch/mips/kernel/vmlinux.lds.S       |   22 ++++++++++------------
 arch/mn10300/kernel/vmlinux.lds.S    |    9 +++------
 arch/parisc/kernel/vmlinux.lds.S     |    9 ++++-----
 arch/powerpc/kernel/vmlinux.lds.S    |   10 +++-------
 arch/s390/kernel/vmlinux.lds.S       |   10 +++-------
 arch/sh/kernel/vmlinux.lds.S         |   11 ++++-------
 arch/sparc/kernel/vmlinux.lds.S      |    9 ++-------
 arch/um/include/asm/common.lds.S     |    5 -----
 arch/um/kernel/dyn.lds.S             |    2 +-
 arch/um/kernel/uml.lds.S             |    2 +-
 arch/x86/kernel/vmlinux.lds.S        |   11 ++++-------
 arch/xtensa/kernel/vmlinux.lds.S     |   14 ++++----------
 include/asm-generic/vmlinux.lds.h    |   14 ++++++++------
 25 files changed, 77 insertions(+), 159 deletions(-)

Index: work/arch/alpha/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/alpha/kernel/vmlinux.lds.S
+++ work/arch/alpha/kernel/vmlinux.lds.S
@@ -134,14 +134,6 @@ SECTIONS
 	__bss_stop = .;
 	_end = .;
 
-	/* Sections to be discarded */
-	/DISCARD/ : {
-		EXIT_TEXT
-		EXIT_DATA
-		*(.exitcall.exit)
-		*(.discard)
-	}
-
 	.mdebug 0 : {
 		*(.mdebug)
 	}
@@ -151,4 +143,6 @@ SECTIONS
 
 	STABS_DEBUG
 	DWARF_DEBUG
+
+	DISCARDS
 }
Index: work/arch/avr32/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/avr32/kernel/vmlinux.lds.S
+++ work/arch/avr32/kernel/vmlinux.lds.S
@@ -124,15 +124,11 @@ SECTIONS
 		_end = .;
 	}
 
+	DWARF_DEBUG
+
 	/* When something in the kernel is NOT compiled as a module, the module
 	 * cleanup code and data are put into these segments. Both can then be
 	 * thrown away, as cleanup code is never called unless it's a module.
 	 */
-	/DISCARD/       	: {
-		EXIT_DATA
-		*(.exitcall.exit)
-		*(.discard)
-	}
-
-	DWARF_DEBUG
+	DISCARDS
 }
Index: work/arch/blackfin/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/blackfin/kernel/vmlinux.lds.S
+++ work/arch/blackfin/kernel/vmlinux.lds.S
@@ -277,9 +277,5 @@ SECTIONS
 
 	DWARF_DEBUG
 
-	/DISCARD/ :
-	{
-		*(.exitcall.exit)
-		*(.discard)
-	}
+	DISCARDS
 }
Index: work/arch/cris/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/cris/kernel/vmlinux.lds.S
+++ work/arch/cris/kernel/vmlinux.lds.S
@@ -140,13 +140,7 @@ SECTIONS
 	_end = .;
 	__end = .;
 
-	/* Sections to be discarded */
-	/DISCARD/ : {
-		EXIT_TEXT
-		EXIT_DATA
-		*(.exitcall.exit)
-		*(.discard)
-        }
-
 	dram_end = dram_start + (CONFIG_ETRAX_DRAM_SIZE - __CONFIG_ETRAX_VMEM_SIZE)*1024*1024;
+
+	DISCARDS
 }
Index: work/arch/frv/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/frv/kernel/vmlinux.lds.S
+++ work/arch/frv/kernel/vmlinux.lds.S
@@ -178,7 +178,7 @@ SECTIONS
 
   .comment 0 : { *(.comment) }
 
-  /DISCARD/ : { *(.discard) }
+  DISCARDS
 }
 
 __kernel_image_size_no_bss = __bss_start - __kernel_image_start;
Index: work/arch/h8300/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/h8300/kernel/vmlinux.lds.S
+++ work/arch/h8300/kernel/vmlinux.lds.S
@@ -152,10 +152,6 @@ SECTIONS
 	__end = . ;
 	__ramstart = .;
 	}
-	/DISCARD/ : {
-		*(.exitcall.exit)
-		*(.discard)
-	}
         .romfs :	
 	{
 		*(.romfs*)
@@ -166,4 +162,6 @@ SECTIONS
 	COMMAND_START = . - 0x200 ;
 	__ramend = . ;
 	}
+
+	DISCARDS
 }
Index: work/arch/ia64/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/ia64/kernel/vmlinux.lds.S
+++ work/arch/ia64/kernel/vmlinux.lds.S
@@ -24,16 +24,6 @@ PHDRS {
 }
 SECTIONS
 {
-  /* Sections to be discarded */
-  /DISCARD/ : {
-	EXIT_TEXT
-	EXIT_DATA
-	*(.exitcall.exit)
-	*(.discard)
-	*(.IA_64.unwind.exit.text)
-	*(.IA_64.unwind_info.exit.text)
-	}
-
   v = PAGE_OFFSET;	/* this symbol is here to make debugging easier... */
   phys_start = _start - LOAD_OFFSET;
 
@@ -317,7 +307,13 @@ SECTIONS
   .debug_funcnames 0 : { *(.debug_funcnames) }
   .debug_typenames 0 : { *(.debug_typenames) }
   .debug_varnames  0 : { *(.debug_varnames) }
-  /* These must appear regardless of  .  */
-  /DISCARD/ : { *(.comment) }
-  /DISCARD/ : { *(.note) }
+
+  /* Sections to be discarded */
+  DISCARDS
+  /DISCARD/ : {
+	*(.IA_64.unwind.exit.text)
+	*(.IA_64.unwind_info.exit.text)
+	*(.comment)
+	*(.note)
+	}
 }
Index: work/arch/m32r/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/m32r/kernel/vmlinux.lds.S
+++ work/arch/m32r/kernel/vmlinux.lds.S
@@ -120,14 +120,6 @@ SECTIONS
 
   _end = . ;
 
-  /* Sections to be discarded */
-  /DISCARD/ : {
-	EXIT_TEXT
-	EXIT_DATA
-	*(.exitcall.exit)
-	*(.discard)
-	}
-
   /* Stabs debugging sections.  */
   .stab 0 : { *(.stab) }
   .stabstr 0 : { *(.stabstr) }
@@ -136,4 +128,7 @@ SECTIONS
   .stab.index 0 : { *(.stab.index) }
   .stab.indexstr 0 : { *(.stab.indexstr) }
   .comment 0 : { *(.comment) }
+
+  /* Sections to be discarded */
+  DISCARDS
 }
Index: work/arch/m68knommu/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/m68knommu/kernel/vmlinux.lds.S
+++ work/arch/m68knommu/kernel/vmlinux.lds.S
@@ -184,13 +184,6 @@ SECTIONS {
 		__init_end = .;
 	} > INIT
 
-	/DISCARD/ : {
-		EXIT_TEXT
-		EXIT_DATA
-		*(.exitcall.exit)
-		*(.discard)
-	}
-
 	.bss : {
 		. = ALIGN(4);
 		_sbss = . ;
@@ -201,5 +194,6 @@ SECTIONS {
 	 	_end = . ;
 	} > BSS
 
+	DISCARDS
 }
 
Index: work/arch/microblaze/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/microblaze/kernel/vmlinux.lds.S
+++ work/arch/microblaze/kernel/vmlinux.lds.S
@@ -163,5 +163,5 @@ SECTIONS {
 	. = ALIGN(4096);
 	_end = .;
 
-	/DISCARD/ : { *(.discard) }
+	DISCARDS
 }
Index: work/arch/mips/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/mips/kernel/vmlinux.lds.S
+++ work/arch/mips/kernel/vmlinux.lds.S
@@ -176,18 +176,6 @@ SECTIONS
 
 	_end = . ;
 
-	/* Sections to be discarded */
-	/DISCARD/ : {
-		*(.exitcall.exit)
-		*(.discard)
-
-		/* ABI crap starts here */
-		*(.MIPS.options)
-		*(.options)
-		*(.pdr)
-		*(.reginfo)
-	}
-
 	/* These mark the ABI of the kernel for debuggers.  */
 	.mdebug.abi32 : {
 		KEEP(*(.mdebug.abi32))
@@ -213,4 +201,14 @@ SECTIONS
 		*(.gptab.bss)
 		*(.gptab.sbss)
 	}
+
+	/* Sections to be discarded */
+	DISCARDS
+	/DISCARD/ : {
+		/* ABI crap starts here */
+		*(.MIPS.options)
+		*(.options)
+		*(.pdr)
+		*(.reginfo)
+	}
 }
Index: work/arch/mn10300/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/mn10300/kernel/vmlinux.lds.S
+++ work/arch/mn10300/kernel/vmlinux.lds.S
@@ -115,13 +115,10 @@ SECTIONS
   . = ALIGN(PAGE_SIZE);
   pg0 = .;
 
-  /* Sections to be discarded */
-  /DISCARD/ : {
-	EXIT_CALL
-	*(.discard)
-	}
-
   STABS_DEBUG
 
   DWARF_DEBUG
+
+  /* Sections to be discarded */
+  DISCARDS
 }
Index: work/arch/parisc/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/parisc/kernel/vmlinux.lds.S
+++ work/arch/parisc/kernel/vmlinux.lds.S
@@ -237,10 +237,12 @@ SECTIONS
 	/* freed after init ends here */
 	_end = . ;
 
+	STABS_DEBUG
+	.note 0 : { *(.note) }
+
 	/* Sections to be discarded */
+	DISCARDS
 	/DISCARD/ : {
-		*(.exitcall.exit)
-		*(.discard)
 #ifdef CONFIG_64BIT
 		/* temporary hack until binutils is fixed to not emit these
 	 	 * for static binaries
@@ -253,7 +255,4 @@ SECTIONS
 		*(.gnu.hash)
 #endif
 	}
-
-	STABS_DEBUG
-	.note 0 : { *(.note) }	
 }
Index: work/arch/powerpc/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/powerpc/kernel/vmlinux.lds.S
+++ work/arch/powerpc/kernel/vmlinux.lds.S
@@ -37,13 +37,6 @@ jiffies = jiffies_64 + 4;
 #endif
 SECTIONS
 {
-	/* Sections to be discarded. */
-	/DISCARD/ : {
-	*(.exitcall.exit)
-	*(.discard)
-	EXIT_DATA
-	}
-
 	. = KERNELBASE;
 
 /*
@@ -299,4 +292,7 @@ SECTIONS
 	. = ALIGN(PAGE_SIZE);
 	_end = . ;
 	PROVIDE32 (end = .);
+
+	/* Sections to be discarded. */
+	DISCARDS
 }
Index: work/arch/s390/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/s390/kernel/vmlinux.lds.S
+++ work/arch/s390/kernel/vmlinux.lds.S
@@ -157,14 +157,10 @@ SECTIONS
 
 	_end = . ;
 
-	/* Sections to be discarded */
-	/DISCARD/ : {
-		EXIT_DATA
-		*(.exitcall.exit)
-		*(.discard)
-	}
-
 	/* Debugging sections.	*/
 	STABS_DEBUG
 	DWARF_DEBUG
+
+	/* Sections to be discarded */
+	DISCARDS
 }
Index: work/arch/sh/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/sh/kernel/vmlinux.lds.S
+++ work/arch/sh/kernel/vmlinux.lds.S
@@ -163,17 +163,14 @@ SECTIONS
 		_end = . ;
 	}
 
+	STABS_DEBUG
+	DWARF_DEBUG
+
 	/*
 	 * When something in the kernel is NOT compiled as a module, the
 	 * module cleanup code and data are put into these segments. Both
 	 * can then be thrown away, as cleanup code is never called unless
 	 * it's a module.
 	 */
-	/DISCARD/ : {
-		*(.exitcall.exit)
-		*(.discard)
-	}
-
-	STABS_DEBUG
-	DWARF_DEBUG
+	DISCARDS
 }
Index: work/arch/sparc/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/sparc/kernel/vmlinux.lds.S
+++ work/arch/sparc/kernel/vmlinux.lds.S
@@ -171,13 +171,8 @@ SECTIONS
 	}
 	_end = . ;
 
-	/DISCARD/ : {
-		EXIT_TEXT
-		EXIT_DATA
-		*(.exitcall.exit)
-		*(.discard)
-	}
-
 	STABS_DEBUG
 	DWARF_DEBUG
+
+	DISCARDS
 }
Index: work/arch/x86/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/x86/kernel/vmlinux.lds.S
+++ work/arch/x86/kernel/vmlinux.lds.S
@@ -387,15 +387,12 @@ SECTIONS
 		_end = .;
 	}
 
-	/* Sections to be discarded */
-	/DISCARD/ : {
-		*(.exitcall.exit)
-		*(.eh_frame)
-		*(.discard)
-	}
-
         STABS_DEBUG
         DWARF_DEBUG
+
+	/* Sections to be discarded */
+	DISCARDS
+	/DISCARD/ : { *(.eh_frame) }
 }
 
 
Index: work/arch/xtensa/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/xtensa/kernel/vmlinux.lds.S
+++ work/arch/xtensa/kernel/vmlinux.lds.S
@@ -280,16 +280,6 @@ SECTIONS
     *(.ResetVector.text)
   }
 
-  /* Sections to be discarded */
-  /DISCARD/ :
-  {
-	*(.exit.literal)
-	EXIT_TEXT
-	EXIT_DATA
-        *(.exitcall.exit)
-	*(.discard)
-  }
-
   .xt.lit : { *(.xt.lit) }
   .xt.prop : { *(.xt.prop) }
 
@@ -322,4 +312,8 @@ SECTIONS
     *(.xt.lit)
     *(.gnu.linkonce.p*)
   }
+
+  /* Sections to be discarded */
+  DISCARDS
+  /DISCARD/ : { *(.exit.literal) }
 }
Index: work/include/asm-generic/vmlinux.lds.h
===================================================================
--- work.orig/include/asm-generic/vmlinux.lds.h
+++ work/include/asm-generic/vmlinux.lds.h
@@ -35,13 +35,10 @@
  *	__bss_stop = .;
  *	_end = .;
  *
- *	/DISCARD/ : {
- *		EXIT_TEXT
- *		EXIT_DATA
- *		EXIT_CALL
- *	}
  *	STABS_DEBUG
  *	DWARF_DEBUG
+ *
+ *	DISCARDS		// must be the last
  * }
  *
  * [__init_begin, __init_end] is the init section that may be freed after init
@@ -629,11 +626,16 @@
 #define INIT_RAM_FS
 #endif
 
+/*
+ * DISCARDS must be the last and archs which want some of the default
+ * discarded sections in the kernel image can do so by putting them in
+ * earlier section definition.
+ */
 #define DISCARDS							\
 	/DISCARD/ : {							\
 	EXIT_TEXT							\
 	EXIT_DATA							\
-	*(.exitcall.exit)						\
+	EXIT_CALL							\
 	*(.discard)							\
 	}
 
Index: work/arch/m68k/kernel/vmlinux-std.lds
===================================================================
--- work.orig/arch/m68k/kernel/vmlinux-std.lds
+++ work/arch/m68k/kernel/vmlinux-std.lds
@@ -82,14 +82,6 @@ SECTIONS
 
   _end = . ;
 
-  /* Sections to be discarded */
-  /DISCARD/ : {
-	EXIT_TEXT
-	EXIT_DATA
-	*(.exitcall.exit)
-	*(.discard)
-	}
-
   /* Stabs debugging sections.  */
   .stab 0 : { *(.stab) }
   .stabstr 0 : { *(.stabstr) }
@@ -98,4 +90,7 @@ SECTIONS
   .stab.index 0 : { *(.stab.index) }
   .stab.indexstr 0 : { *(.stab.indexstr) }
   .comment 0 : { *(.comment) }
+
+  /* Sections to be discarded */
+  DISCARDS
 }
Index: work/arch/m68k/kernel/vmlinux-sun3.lds
===================================================================
--- work.orig/arch/m68k/kernel/vmlinux-sun3.lds
+++ work/arch/m68k/kernel/vmlinux-sun3.lds
@@ -77,14 +77,6 @@ __init_begin = .;
 
   _end = . ;
 
-  /* Sections to be discarded */
-  /DISCARD/ : {
-	EXIT_TEXT
-	EXIT_DATA
-	*(.exitcall.exit)
-	*(.discard)
-	}
-
   .crap : {
 	/* Stabs debugging sections.  */
 	*(.stab)
@@ -97,4 +89,6 @@ __init_begin = .;
 	*(.note)
   }
 
+  /* Sections to be discarded */
+  DISCARDS
 }
Index: work/arch/um/include/asm/common.lds.S
===================================================================
--- work.orig/arch/um/include/asm/common.lds.S
+++ work/arch/um/include/asm/common.lds.S
@@ -123,8 +123,3 @@
 	__initramfs_end = .;
   }
 
-  /* Sections to be discarded */
-  /DISCARD/ : {
- 	*(.exitcall.exit)
-  }
-
Index: work/arch/um/kernel/dyn.lds.S
===================================================================
--- work.orig/arch/um/kernel/dyn.lds.S
+++ work/arch/um/kernel/dyn.lds.S
@@ -157,5 +157,5 @@ SECTIONS
 
   DWARF_DEBUG
 
-  /DISCARD/	: { *(.discard) }
+  DISCARDS
 }
Index: work/arch/um/kernel/uml.lds.S
===================================================================
--- work.orig/arch/um/kernel/uml.lds.S
+++ work/arch/um/kernel/uml.lds.S
@@ -101,5 +101,5 @@ SECTIONS
 
   DWARF_DEBUG
 
-  /DISCARD/	: { *(.discard) }
+  DISCARDS
 }

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [RFC PATCH] linker script: unify usage of discard definition
  2009-07-03 23:37 [RFC PATCH] linker script: unify usage of discard definition Tejun Heo
@ 2009-07-03 23:37 ` Tejun Heo
  2009-07-04  1:34 ` linux-next submission requirements (Was: [RFC PATCH] linker script: unify usage of discard definition) Stephen Rothwell
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Tejun Heo @ 2009-07-03 23:37 UTC (permalink / raw)
  To: linux-arch@vger.kernel.org, Linux Kernel, Michal Simek,
	microblaze-uclinux, Sam Ravnborg, Paul Mundt, Tony Luck

Discarded sections in different archs share some commonality but have
considerable differences.  This led to linker script for each arch
implementing its own /DISCARD/ definition, which makes maintaining
tedious and adding new entries error-prone.

This patch makes all linker scripts to move discard definitions to the
end of the linker script and use the common DISCARDS macro.  As ld
uses the first matching section definition, archs can include default
discarded sections by including them earlier in the linker script.

On x86-64 which explicitly includes EXIT_TEXT, this produces identical
output as before and all but one archs included directives (include or
discard) for all default discarded sections, so this patch shouldn't
cause any behavior difference.

The only problem case is microblaze, which didn't explicitly included
EXIT_TEXT and DATA but didn't discard them either leaving ld to create
identically names output sections for them.  This patch will make the
end result different by throwing away exit text and data.  It looks
like the ommission was accidental and throwing away is the right thing
to do, but I won't push it till someone who knows microblaze confirms
it.

This patch is on top of the current percpu#for-next.

  git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu.git for-next

Thanks.

NOT_SIGNED_OFF_YET
Cc: linux-arch@vger.kernel.org
Cc: Michal Simek <monstr@monstr.eu>
Cc: microblaze-uclinux@itee.uq.edu.au
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Tony Luck <tony.luck@intel.com>
---
 arch/alpha/kernel/vmlinux.lds.S      |   10 ++--------
 arch/avr32/kernel/vmlinux.lds.S      |   10 +++-------
 arch/blackfin/kernel/vmlinux.lds.S   |    6 +-----
 arch/cris/kernel/vmlinux.lds.S       |   10 ++--------
 arch/frv/kernel/vmlinux.lds.S        |    2 +-
 arch/h8300/kernel/vmlinux.lds.S      |    6 ++----
 arch/ia64/kernel/vmlinux.lds.S       |   22 +++++++++-------------
 arch/m32r/kernel/vmlinux.lds.S       |   11 +++--------
 arch/m68k/kernel/vmlinux-std.lds     |   11 +++--------
 arch/m68k/kernel/vmlinux-sun3.lds    |   10 ++--------
 arch/m68knommu/kernel/vmlinux.lds.S  |    8 +-------
 arch/microblaze/kernel/vmlinux.lds.S |    2 +-
 arch/mips/kernel/vmlinux.lds.S       |   22 ++++++++++------------
 arch/mn10300/kernel/vmlinux.lds.S    |    9 +++------
 arch/parisc/kernel/vmlinux.lds.S     |    9 ++++-----
 arch/powerpc/kernel/vmlinux.lds.S    |   10 +++-------
 arch/s390/kernel/vmlinux.lds.S       |   10 +++-------
 arch/sh/kernel/vmlinux.lds.S         |   11 ++++-------
 arch/sparc/kernel/vmlinux.lds.S      |    9 ++-------
 arch/um/include/asm/common.lds.S     |    5 -----
 arch/um/kernel/dyn.lds.S             |    2 +-
 arch/um/kernel/uml.lds.S             |    2 +-
 arch/x86/kernel/vmlinux.lds.S        |   11 ++++-------
 arch/xtensa/kernel/vmlinux.lds.S     |   14 ++++----------
 include/asm-generic/vmlinux.lds.h    |   14 ++++++++------
 25 files changed, 77 insertions(+), 159 deletions(-)

Index: work/arch/alpha/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/alpha/kernel/vmlinux.lds.S
+++ work/arch/alpha/kernel/vmlinux.lds.S
@@ -134,14 +134,6 @@ SECTIONS
 	__bss_stop = .;
 	_end = .;
 
-	/* Sections to be discarded */
-	/DISCARD/ : {
-		EXIT_TEXT
-		EXIT_DATA
-		*(.exitcall.exit)
-		*(.discard)
-	}
-
 	.mdebug 0 : {
 		*(.mdebug)
 	}
@@ -151,4 +143,6 @@ SECTIONS
 
 	STABS_DEBUG
 	DWARF_DEBUG
+
+	DISCARDS
 }
Index: work/arch/avr32/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/avr32/kernel/vmlinux.lds.S
+++ work/arch/avr32/kernel/vmlinux.lds.S
@@ -124,15 +124,11 @@ SECTIONS
 		_end = .;
 	}
 
+	DWARF_DEBUG
+
 	/* When something in the kernel is NOT compiled as a module, the module
 	 * cleanup code and data are put into these segments. Both can then be
 	 * thrown away, as cleanup code is never called unless it's a module.
 	 */
-	/DISCARD/       	: {
-		EXIT_DATA
-		*(.exitcall.exit)
-		*(.discard)
-	}
-
-	DWARF_DEBUG
+	DISCARDS
 }
Index: work/arch/blackfin/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/blackfin/kernel/vmlinux.lds.S
+++ work/arch/blackfin/kernel/vmlinux.lds.S
@@ -277,9 +277,5 @@ SECTIONS
 
 	DWARF_DEBUG
 
-	/DISCARD/ :
-	{
-		*(.exitcall.exit)
-		*(.discard)
-	}
+	DISCARDS
 }
Index: work/arch/cris/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/cris/kernel/vmlinux.lds.S
+++ work/arch/cris/kernel/vmlinux.lds.S
@@ -140,13 +140,7 @@ SECTIONS
 	_end = .;
 	__end = .;
 
-	/* Sections to be discarded */
-	/DISCARD/ : {
-		EXIT_TEXT
-		EXIT_DATA
-		*(.exitcall.exit)
-		*(.discard)
-        }
-
 	dram_end = dram_start + (CONFIG_ETRAX_DRAM_SIZE - __CONFIG_ETRAX_VMEM_SIZE)*1024*1024;
+
+	DISCARDS
 }
Index: work/arch/frv/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/frv/kernel/vmlinux.lds.S
+++ work/arch/frv/kernel/vmlinux.lds.S
@@ -178,7 +178,7 @@ SECTIONS
 
   .comment 0 : { *(.comment) }
 
-  /DISCARD/ : { *(.discard) }
+  DISCARDS
 }
 
 __kernel_image_size_no_bss = __bss_start - __kernel_image_start;
Index: work/arch/h8300/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/h8300/kernel/vmlinux.lds.S
+++ work/arch/h8300/kernel/vmlinux.lds.S
@@ -152,10 +152,6 @@ SECTIONS
 	__end = . ;
 	__ramstart = .;
 	}
-	/DISCARD/ : {
-		*(.exitcall.exit)
-		*(.discard)
-	}
         .romfs :	
 	{
 		*(.romfs*)
@@ -166,4 +162,6 @@ SECTIONS
 	COMMAND_START = . - 0x200 ;
 	__ramend = . ;
 	}
+
+	DISCARDS
 }
Index: work/arch/ia64/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/ia64/kernel/vmlinux.lds.S
+++ work/arch/ia64/kernel/vmlinux.lds.S
@@ -24,16 +24,6 @@ PHDRS {
 }
 SECTIONS
 {
-  /* Sections to be discarded */
-  /DISCARD/ : {
-	EXIT_TEXT
-	EXIT_DATA
-	*(.exitcall.exit)
-	*(.discard)
-	*(.IA_64.unwind.exit.text)
-	*(.IA_64.unwind_info.exit.text)
-	}
-
   v = PAGE_OFFSET;	/* this symbol is here to make debugging easier... */
   phys_start = _start - LOAD_OFFSET;
 
@@ -317,7 +307,13 @@ SECTIONS
   .debug_funcnames 0 : { *(.debug_funcnames) }
   .debug_typenames 0 : { *(.debug_typenames) }
   .debug_varnames  0 : { *(.debug_varnames) }
-  /* These must appear regardless of  .  */
-  /DISCARD/ : { *(.comment) }
-  /DISCARD/ : { *(.note) }
+
+  /* Sections to be discarded */
+  DISCARDS
+  /DISCARD/ : {
+	*(.IA_64.unwind.exit.text)
+	*(.IA_64.unwind_info.exit.text)
+	*(.comment)
+	*(.note)
+	}
 }
Index: work/arch/m32r/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/m32r/kernel/vmlinux.lds.S
+++ work/arch/m32r/kernel/vmlinux.lds.S
@@ -120,14 +120,6 @@ SECTIONS
 
   _end = . ;
 
-  /* Sections to be discarded */
-  /DISCARD/ : {
-	EXIT_TEXT
-	EXIT_DATA
-	*(.exitcall.exit)
-	*(.discard)
-	}
-
   /* Stabs debugging sections.  */
   .stab 0 : { *(.stab) }
   .stabstr 0 : { *(.stabstr) }
@@ -136,4 +128,7 @@ SECTIONS
   .stab.index 0 : { *(.stab.index) }
   .stab.indexstr 0 : { *(.stab.indexstr) }
   .comment 0 : { *(.comment) }
+
+  /* Sections to be discarded */
+  DISCARDS
 }
Index: work/arch/m68knommu/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/m68knommu/kernel/vmlinux.lds.S
+++ work/arch/m68knommu/kernel/vmlinux.lds.S
@@ -184,13 +184,6 @@ SECTIONS {
 		__init_end = .;
 	} > INIT
 
-	/DISCARD/ : {
-		EXIT_TEXT
-		EXIT_DATA
-		*(.exitcall.exit)
-		*(.discard)
-	}
-
 	.bss : {
 		. = ALIGN(4);
 		_sbss = . ;
@@ -201,5 +194,6 @@ SECTIONS {
 	 	_end = . ;
 	} > BSS
 
+	DISCARDS
 }
 
Index: work/arch/microblaze/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/microblaze/kernel/vmlinux.lds.S
+++ work/arch/microblaze/kernel/vmlinux.lds.S
@@ -163,5 +163,5 @@ SECTIONS {
 	. = ALIGN(4096);
 	_end = .;
 
-	/DISCARD/ : { *(.discard) }
+	DISCARDS
 }
Index: work/arch/mips/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/mips/kernel/vmlinux.lds.S
+++ work/arch/mips/kernel/vmlinux.lds.S
@@ -176,18 +176,6 @@ SECTIONS
 
 	_end = . ;
 
-	/* Sections to be discarded */
-	/DISCARD/ : {
-		*(.exitcall.exit)
-		*(.discard)
-
-		/* ABI crap starts here */
-		*(.MIPS.options)
-		*(.options)
-		*(.pdr)
-		*(.reginfo)
-	}
-
 	/* These mark the ABI of the kernel for debuggers.  */
 	.mdebug.abi32 : {
 		KEEP(*(.mdebug.abi32))
@@ -213,4 +201,14 @@ SECTIONS
 		*(.gptab.bss)
 		*(.gptab.sbss)
 	}
+
+	/* Sections to be discarded */
+	DISCARDS
+	/DISCARD/ : {
+		/* ABI crap starts here */
+		*(.MIPS.options)
+		*(.options)
+		*(.pdr)
+		*(.reginfo)
+	}
 }
Index: work/arch/mn10300/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/mn10300/kernel/vmlinux.lds.S
+++ work/arch/mn10300/kernel/vmlinux.lds.S
@@ -115,13 +115,10 @@ SECTIONS
   . = ALIGN(PAGE_SIZE);
   pg0 = .;
 
-  /* Sections to be discarded */
-  /DISCARD/ : {
-	EXIT_CALL
-	*(.discard)
-	}
-
   STABS_DEBUG
 
   DWARF_DEBUG
+
+  /* Sections to be discarded */
+  DISCARDS
 }
Index: work/arch/parisc/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/parisc/kernel/vmlinux.lds.S
+++ work/arch/parisc/kernel/vmlinux.lds.S
@@ -237,10 +237,12 @@ SECTIONS
 	/* freed after init ends here */
 	_end = . ;
 
+	STABS_DEBUG
+	.note 0 : { *(.note) }
+
 	/* Sections to be discarded */
+	DISCARDS
 	/DISCARD/ : {
-		*(.exitcall.exit)
-		*(.discard)
 #ifdef CONFIG_64BIT
 		/* temporary hack until binutils is fixed to not emit these
 	 	 * for static binaries
@@ -253,7 +255,4 @@ SECTIONS
 		*(.gnu.hash)
 #endif
 	}
-
-	STABS_DEBUG
-	.note 0 : { *(.note) }	
 }
Index: work/arch/powerpc/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/powerpc/kernel/vmlinux.lds.S
+++ work/arch/powerpc/kernel/vmlinux.lds.S
@@ -37,13 +37,6 @@ jiffies = jiffies_64 + 4;
 #endif
 SECTIONS
 {
-	/* Sections to be discarded. */
-	/DISCARD/ : {
-	*(.exitcall.exit)
-	*(.discard)
-	EXIT_DATA
-	}
-
 	. = KERNELBASE;
 
 /*
@@ -299,4 +292,7 @@ SECTIONS
 	. = ALIGN(PAGE_SIZE);
 	_end = . ;
 	PROVIDE32 (end = .);
+
+	/* Sections to be discarded. */
+	DISCARDS
 }
Index: work/arch/s390/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/s390/kernel/vmlinux.lds.S
+++ work/arch/s390/kernel/vmlinux.lds.S
@@ -157,14 +157,10 @@ SECTIONS
 
 	_end = . ;
 
-	/* Sections to be discarded */
-	/DISCARD/ : {
-		EXIT_DATA
-		*(.exitcall.exit)
-		*(.discard)
-	}
-
 	/* Debugging sections.	*/
 	STABS_DEBUG
 	DWARF_DEBUG
+
+	/* Sections to be discarded */
+	DISCARDS
 }
Index: work/arch/sh/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/sh/kernel/vmlinux.lds.S
+++ work/arch/sh/kernel/vmlinux.lds.S
@@ -163,17 +163,14 @@ SECTIONS
 		_end = . ;
 	}
 
+	STABS_DEBUG
+	DWARF_DEBUG
+
 	/*
 	 * When something in the kernel is NOT compiled as a module, the
 	 * module cleanup code and data are put into these segments. Both
 	 * can then be thrown away, as cleanup code is never called unless
 	 * it's a module.
 	 */
-	/DISCARD/ : {
-		*(.exitcall.exit)
-		*(.discard)
-	}
-
-	STABS_DEBUG
-	DWARF_DEBUG
+	DISCARDS
 }
Index: work/arch/sparc/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/sparc/kernel/vmlinux.lds.S
+++ work/arch/sparc/kernel/vmlinux.lds.S
@@ -171,13 +171,8 @@ SECTIONS
 	}
 	_end = . ;
 
-	/DISCARD/ : {
-		EXIT_TEXT
-		EXIT_DATA
-		*(.exitcall.exit)
-		*(.discard)
-	}
-
 	STABS_DEBUG
 	DWARF_DEBUG
+
+	DISCARDS
 }
Index: work/arch/x86/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/x86/kernel/vmlinux.lds.S
+++ work/arch/x86/kernel/vmlinux.lds.S
@@ -387,15 +387,12 @@ SECTIONS
 		_end = .;
 	}
 
-	/* Sections to be discarded */
-	/DISCARD/ : {
-		*(.exitcall.exit)
-		*(.eh_frame)
-		*(.discard)
-	}
-
         STABS_DEBUG
         DWARF_DEBUG
+
+	/* Sections to be discarded */
+	DISCARDS
+	/DISCARD/ : { *(.eh_frame) }
 }
 
 
Index: work/arch/xtensa/kernel/vmlinux.lds.S
===================================================================
--- work.orig/arch/xtensa/kernel/vmlinux.lds.S
+++ work/arch/xtensa/kernel/vmlinux.lds.S
@@ -280,16 +280,6 @@ SECTIONS
     *(.ResetVector.text)
   }
 
-  /* Sections to be discarded */
-  /DISCARD/ :
-  {
-	*(.exit.literal)
-	EXIT_TEXT
-	EXIT_DATA
-        *(.exitcall.exit)
-	*(.discard)
-  }
-
   .xt.lit : { *(.xt.lit) }
   .xt.prop : { *(.xt.prop) }
 
@@ -322,4 +312,8 @@ SECTIONS
     *(.xt.lit)
     *(.gnu.linkonce.p*)
   }
+
+  /* Sections to be discarded */
+  DISCARDS
+  /DISCARD/ : { *(.exit.literal) }
 }
Index: work/include/asm-generic/vmlinux.lds.h
===================================================================
--- work.orig/include/asm-generic/vmlinux.lds.h
+++ work/include/asm-generic/vmlinux.lds.h
@@ -35,13 +35,10 @@
  *	__bss_stop = .;
  *	_end = .;
  *
- *	/DISCARD/ : {
- *		EXIT_TEXT
- *		EXIT_DATA
- *		EXIT_CALL
- *	}
  *	STABS_DEBUG
  *	DWARF_DEBUG
+ *
+ *	DISCARDS		// must be the last
  * }
  *
  * [__init_begin, __init_end] is the init section that may be freed after init
@@ -629,11 +626,16 @@
 #define INIT_RAM_FS
 #endif
 
+/*
+ * DISCARDS must be the last and archs which want some of the default
+ * discarded sections in the kernel image can do so by putting them in
+ * earlier section definition.
+ */
 #define DISCARDS							\
 	/DISCARD/ : {							\
 	EXIT_TEXT							\
 	EXIT_DATA							\
-	*(.exitcall.exit)						\
+	EXIT_CALL							\
 	*(.discard)							\
 	}
 
Index: work/arch/m68k/kernel/vmlinux-std.lds
===================================================================
--- work.orig/arch/m68k/kernel/vmlinux-std.lds
+++ work/arch/m68k/kernel/vmlinux-std.lds
@@ -82,14 +82,6 @@ SECTIONS
 
   _end = . ;
 
-  /* Sections to be discarded */
-  /DISCARD/ : {
-	EXIT_TEXT
-	EXIT_DATA
-	*(.exitcall.exit)
-	*(.discard)
-	}
-
   /* Stabs debugging sections.  */
   .stab 0 : { *(.stab) }
   .stabstr 0 : { *(.stabstr) }
@@ -98,4 +90,7 @@ SECTIONS
   .stab.index 0 : { *(.stab.index) }
   .stab.indexstr 0 : { *(.stab.indexstr) }
   .comment 0 : { *(.comment) }
+
+  /* Sections to be discarded */
+  DISCARDS
 }
Index: work/arch/m68k/kernel/vmlinux-sun3.lds
===================================================================
--- work.orig/arch/m68k/kernel/vmlinux-sun3.lds
+++ work/arch/m68k/kernel/vmlinux-sun3.lds
@@ -77,14 +77,6 @@ __init_begin = .;
 
   _end = . ;
 
-  /* Sections to be discarded */
-  /DISCARD/ : {
-	EXIT_TEXT
-	EXIT_DATA
-	*(.exitcall.exit)
-	*(.discard)
-	}
-
   .crap : {
 	/* Stabs debugging sections.  */
 	*(.stab)
@@ -97,4 +89,6 @@ __init_begin = .;
 	*(.note)
   }
 
+  /* Sections to be discarded */
+  DISCARDS
 }
Index: work/arch/um/include/asm/common.lds.S
===================================================================
--- work.orig/arch/um/include/asm/common.lds.S
+++ work/arch/um/include/asm/common.lds.S
@@ -123,8 +123,3 @@
 	__initramfs_end = .;
   }
 
-  /* Sections to be discarded */
-  /DISCARD/ : {
- 	*(.exitcall.exit)
-  }
-
Index: work/arch/um/kernel/dyn.lds.S
===================================================================
--- work.orig/arch/um/kernel/dyn.lds.S
+++ work/arch/um/kernel/dyn.lds.S
@@ -157,5 +157,5 @@ SECTIONS
 
   DWARF_DEBUG
 
-  /DISCARD/	: { *(.discard) }
+  DISCARDS
 }
Index: work/arch/um/kernel/uml.lds.S
===================================================================
--- work.orig/arch/um/kernel/uml.lds.S
+++ work/arch/um/kernel/uml.lds.S
@@ -101,5 +101,5 @@ SECTIONS
 
   DWARF_DEBUG
 
-  /DISCARD/	: { *(.discard) }
+  DISCARDS
 }

^ permalink raw reply	[flat|nested] 11+ messages in thread

* linux-next submission requirements (Was: [RFC PATCH] linker script: unify usage of discard definition)
  2009-07-03 23:37 [RFC PATCH] linker script: unify usage of discard definition Tejun Heo
  2009-07-03 23:37 ` Tejun Heo
@ 2009-07-04  1:34 ` Stephen Rothwell
  2009-07-04  3:18   ` Tejun Heo
  2009-07-04  5:51 ` [RFC PATCH] linker script: unify usage of discard definition Mike Frysinger
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Stephen Rothwell @ 2009-07-04  1:34 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-arch@vger.kernel.org, Linux Kernel, linux-next

[-- Attachment #1: Type: text/plain, Size: 1235 bytes --]

Hi Tejun,

[This is not aimed just at you ... this patch just gave me an
opportunity to point this out again.]

On Sat, 04 Jul 2009 08:37:28 +0900 Tejun Heo <tj@kernel.org> wrote:
>
> This patch is on top of the current percpu#for-next.
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu.git for-next
> 
> Thanks.
> 
> NOT_SIGNED_OFF_YET

Well, given no SOB and that this is a RFC patch, it should *not* be in a
branch that is pulled into linux-next.

This is what I send to any maintainer that submits a tree for linux-next
inclusion (and before anyone else points it out: this was not true early
on):

"all patches/commits in the tree/series must have been:

	posted to a relevant mailing list
	reviewed
	unit tested
	destined for the next merge window (or the current release)

*before* they are included.  The linux-next tree is for integration
testing and to lower the impact of conflicts between subsystems in the
next merge window.

Basically, this should be just what you would send to Linus (or ask him
to fetch).  It is allowed to be rebased if you deem it necessary."

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: linux-next submission requirements (Was: [RFC PATCH] linker script: unify usage of discard definition)
  2009-07-04  1:34 ` linux-next submission requirements (Was: [RFC PATCH] linker script: unify usage of discard definition) Stephen Rothwell
@ 2009-07-04  3:18   ` Tejun Heo
  2009-07-04  4:03     ` Stephen Rothwell
  0 siblings, 1 reply; 11+ messages in thread
From: Tejun Heo @ 2009-07-04  3:18 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-arch@vger.kernel.org, Linux Kernel, linux-next

Hello,

Stephen Rothwell wrote:
> Hi Tejun,
> 
> [This is not aimed just at you ... this patch just gave me an
> opportunity to point this out again.]
> 
> On Sat, 04 Jul 2009 08:37:28 +0900 Tejun Heo <tj@kernel.org> wrote:
>> This patch is on top of the current percpu#for-next.
>>
>>   git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu.git for-next
>>
>> Thanks.
>>
>> NOT_SIGNED_OFF_YET
> 
> Well, given no SOB and that this is a RFC patch, it should *not* be in a
> branch that is pulled into linux-next.

It's not _in_ the branch.  It's on _top_ of the branch.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: linux-next submission requirements (Was: [RFC PATCH] linker script: unify usage of discard definition)
  2009-07-04  3:18   ` Tejun Heo
@ 2009-07-04  4:03     ` Stephen Rothwell
  2009-07-04  4:03       ` Stephen Rothwell
  2009-07-04  4:07       ` Tejun Heo
  0 siblings, 2 replies; 11+ messages in thread
From: Stephen Rothwell @ 2009-07-04  4:03 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-arch@vger.kernel.org, Linux Kernel, linux-next

[-- Attachment #1: Type: text/plain, Size: 499 bytes --]

Hi Tejun,

On Sat, 04 Jul 2009 12:18:02 +0900 Tejun Heo <tj@kernel.org> wrote:
>
> Stephen Rothwell wrote:
> > 
> > [This is not aimed just at you ... this patch just gave me an
> > opportunity to point this out again.]
>
> It's not _in_ the branch.  It's on _top_ of the branch.

Ah, sorry, I read that as "at the top of".  In that case, this is not
aimed at you at all :-)


-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: linux-next submission requirements (Was: [RFC PATCH] linker script: unify usage of discard definition)
  2009-07-04  4:03     ` Stephen Rothwell
@ 2009-07-04  4:03       ` Stephen Rothwell
  2009-07-04  4:07       ` Tejun Heo
  1 sibling, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2009-07-04  4:03 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-arch@vger.kernel.org, Linux Kernel, linux-next

[-- Attachment #1: Type: text/plain, Size: 499 bytes --]

Hi Tejun,

On Sat, 04 Jul 2009 12:18:02 +0900 Tejun Heo <tj@kernel.org> wrote:
>
> Stephen Rothwell wrote:
> > 
> > [This is not aimed just at you ... this patch just gave me an
> > opportunity to point this out again.]
>
> It's not _in_ the branch.  It's on _top_ of the branch.

Ah, sorry, I read that as "at the top of".  In that case, this is not
aimed at you at all :-)


-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: linux-next submission requirements (Was: [RFC PATCH] linker script: unify usage of discard definition)
  2009-07-04  4:03     ` Stephen Rothwell
  2009-07-04  4:03       ` Stephen Rothwell
@ 2009-07-04  4:07       ` Tejun Heo
  1 sibling, 0 replies; 11+ messages in thread
From: Tejun Heo @ 2009-07-04  4:07 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-arch@vger.kernel.org, Linux Kernel, linux-next

Stephen Rothwell wrote:
> Hi Tejun,
> 
> On Sat, 04 Jul 2009 12:18:02 +0900 Tejun Heo <tj@kernel.org> wrote:
>> Stephen Rothwell wrote:
>>> [This is not aimed just at you ... this patch just gave me an
>>> opportunity to point this out again.]
>> It's not _in_ the branch.  It's on _top_ of the branch.
> 
> Ah, sorry, I read that as "at the top of".  In that case, this is not
> aimed at you at all :-)

:-)

-- 
tejun

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC PATCH] linker script: unify usage of discard definition
  2009-07-03 23:37 [RFC PATCH] linker script: unify usage of discard definition Tejun Heo
  2009-07-03 23:37 ` Tejun Heo
  2009-07-04  1:34 ` linux-next submission requirements (Was: [RFC PATCH] linker script: unify usage of discard definition) Stephen Rothwell
@ 2009-07-04  5:51 ` Mike Frysinger
  2009-07-04 15:37   ` Paul Mundt
  2009-07-04 18:40 ` [microblaze-uclinux] " Michal Simek
  2009-07-06  6:17 ` Michal Simek
  4 siblings, 1 reply; 11+ messages in thread
From: Mike Frysinger @ 2009-07-04  5:51 UTC (permalink / raw)
  To: Tejun Heo
  Cc: linux-arch@vger.kernel.org, Linux Kernel, Michal Simek,
	microblaze-uclinux, Sam Ravnborg, Paul Mundt, Tony Luck

On Fri, Jul 3, 2009 at 19:37, Tejun Heo wrote:
> +/*
> + * DISCARDS must be the last and archs which want some of the default
> + * discarded sections in the kernel image can do so by putting them in
> + * earlier section definition.
> + */
>  #define DISCARDS                                                       \
>        /DISCARD/ : {                                                   \
>        EXIT_TEXT                                                       \
>        EXIT_DATA                                                       \
> -       *(.exitcall.exit)                                               \
> +       EXIT_CALL                                                       \
>        *(.discard)                                                     \
>        }

i would add to the comment that some people want to discard exit
text/data at runtime rather than link time due to cross-section
references such as alt instructions, bug table, eh_frame, etc...

otherwise, looks good to me.  thanks !

Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC PATCH] linker script: unify usage of discard definition
  2009-07-04  5:51 ` [RFC PATCH] linker script: unify usage of discard definition Mike Frysinger
@ 2009-07-04 15:37   ` Paul Mundt
  0 siblings, 0 replies; 11+ messages in thread
From: Paul Mundt @ 2009-07-04 15:37 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: Tejun Heo, linux-arch@vger.kernel.org, Linux Kernel, Michal Simek,
	microblaze-uclinux, Sam Ravnborg, Tony Luck

On Sat, Jul 04, 2009 at 01:51:04AM -0400, Mike Frysinger wrote:
> On Fri, Jul 3, 2009 at 19:37, Tejun Heo wrote:
> > +/*
> > + * DISCARDS must be the last and archs which want some of the default
> > + * discarded sections in the kernel image can do so by putting them in
> > + * earlier section definition.
> > + */
> 
> i would add to the comment that some people want to discard exit
> text/data at runtime rather than link time due to cross-section
> references such as alt instructions, bug table, eh_frame, etc...
> 
> otherwise, looks good to me.  thanks !
> 
> Acked-by: Mike Frysinger <vapier@gentoo.org>

Agreed, as this was a source of confusion initially it is certainly worth
documenting the next time someone is scratching their head thinking about
the variations ;-)

Acked-by: Paul Mundt <lethal@linux-sh.org>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [microblaze-uclinux] [RFC PATCH] linker script: unify usage of discard definition
  2009-07-03 23:37 [RFC PATCH] linker script: unify usage of discard definition Tejun Heo
                   ` (2 preceding siblings ...)
  2009-07-04  5:51 ` [RFC PATCH] linker script: unify usage of discard definition Mike Frysinger
@ 2009-07-04 18:40 ` Michal Simek
  2009-07-06  6:17 ` Michal Simek
  4 siblings, 0 replies; 11+ messages in thread
From: Michal Simek @ 2009-07-04 18:40 UTC (permalink / raw)
  To: microblaze-uclinux
  Cc: linux-arch@vger.kernel.org, Linux Kernel, Michal Simek,
	Sam Ravnborg, Paul Mundt, Tony Luck, tj



Tejun Heo wrote:
> Discarded sections in different archs share some commonality but have
> considerable differences.  This led to linker script for each arch
> implementing its own /DISCARD/ definition, which makes maintaining
> tedious and adding new entries error-prone.
> 
> This patch makes all linker scripts to move discard definitions to the
> end of the linker script and use the common DISCARDS macro.  As ld
> uses the first matching section definition, archs can include default
> discarded sections by including them earlier in the linker script.
> 
> On x86-64 which explicitly includes EXIT_TEXT, this produces identical
> output as before and all but one archs included directives (include or
> discard) for all default discarded sections, so this patch shouldn't
> cause any behavior difference.
> 
> The only problem case is microblaze, which didn't explicitly included
> EXIT_TEXT and DATA but didn't discard them either leaving ld to create
> identically names output sections for them.  This patch will make the
> end result different by throwing away exit text and data.  It looks
> like the ommission was accidental and throwing away is the right thing
> to do, but I won't push it till someone who knows microblaze confirms
> it.

As you expected noMMU Microblaze kernel has some problems with that patch. (MMU version is fine)
I'll take a look at it closer yesterday.

Thanks,
Michal



> ___________________________
> microblaze-uclinux mailing list
> microblaze-uclinux@itee.uq.edu.au
> Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
> Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/
> 
> 


-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [microblaze-uclinux] [RFC PATCH] linker script: unify usage of discard definition
  2009-07-03 23:37 [RFC PATCH] linker script: unify usage of discard definition Tejun Heo
                   ` (3 preceding siblings ...)
  2009-07-04 18:40 ` [microblaze-uclinux] " Michal Simek
@ 2009-07-06  6:17 ` Michal Simek
  4 siblings, 0 replies; 11+ messages in thread
From: Michal Simek @ 2009-07-06  6:17 UTC (permalink / raw)
  To: microblaze-uclinux
  Cc: linux-arch@vger.kernel.org, Linux Kernel, Michal Simek,
	Sam Ravnborg, Paul Mundt, Tony Luck, John Williams



Tejun Heo wrote:
> Discarded sections in different archs share some commonality but have
> considerable differences.  This led to linker script for each arch
> implementing its own /DISCARD/ definition, which makes maintaining
> tedious and adding new entries error-prone.
> 
> This patch makes all linker scripts to move discard definitions to the
> end of the linker script and use the common DISCARDS macro.  As ld
> uses the first matching section definition, archs can include default
> discarded sections by including them earlier in the linker script.
> 
> On x86-64 which explicitly includes EXIT_TEXT, this produces identical
> output as before and all but one archs included directives (include or
> discard) for all default discarded sections, so this patch shouldn't
> cause any behavior difference.
> 
> The only problem case is microblaze, which didn't explicitly included
> EXIT_TEXT and DATA but didn't discard them either leaving ld to create
> identically names output sections for them.  This patch will make the
> end result different by throwing away exit text and data.  It looks
> like the ommission was accidental and throwing away is the right thing
> to do, but I won't push it till someone who knows microblaze confirms
> it.

Please include EXIT_TEXT to .text section. EXIT_DATA can be discard. Patch is below.

Tested-by: Michal Simek <monstr@monstr.eu>

Thanks,
Michal


diff --git a/arch/microblaze/kernel/vmlinux.lds.S b/arch/microblaze/kernel/vmlinux.lds.S
index aa5b0e9..39c0d0b 100644
--- a/arch/microblaze/kernel/vmlinux.lds.S
+++ b/arch/microblaze/kernel/vmlinux.lds.S
@@ -23,8 +23,8 @@ SECTIONS {
                _stext = . ;
                *(.text .text.*)
                *(.fixup)
-
-               *(.exitcall.exit)
+               EXIT_TEXT
+               EXIT_CALL
                SCHED_TEXT
                LOCK_TEXT
                KPROBES_TEXT


-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-07-06  6:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-03 23:37 [RFC PATCH] linker script: unify usage of discard definition Tejun Heo
2009-07-03 23:37 ` Tejun Heo
2009-07-04  1:34 ` linux-next submission requirements (Was: [RFC PATCH] linker script: unify usage of discard definition) Stephen Rothwell
2009-07-04  3:18   ` Tejun Heo
2009-07-04  4:03     ` Stephen Rothwell
2009-07-04  4:03       ` Stephen Rothwell
2009-07-04  4:07       ` Tejun Heo
2009-07-04  5:51 ` [RFC PATCH] linker script: unify usage of discard definition Mike Frysinger
2009-07-04 15:37   ` Paul Mundt
2009-07-04 18:40 ` [microblaze-uclinux] " Michal Simek
2009-07-06  6:17 ` Michal Simek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).