Skip to contentSkip to conversation

m32r: Remove unused .altinstructions and .exit.* code from linker script.

PATCH New Tim Abbott 1 participant 3 messages Jul 31, 2009

lore
Share & tools
lore

Tim Abbott

author
#0 lore raw

PATCH 1/3 m32r: Remove unused .altinstructions and .exit.* code from linker script.

It appears that m32r copied the .altinstructions definition from x86 when the architecture was first merged into Linux. m32r doesn't put anything in .altinstructions, so this is just dead code.

The following block affecting .exit.text/.exit.data, which has a comment also copied from x86, should also be deleted; the linker script later discards the .exit.text and .exit.data sections.

Cc Hirokazu Takata <[email protected]>
---
 arch/m32r/kernel/vmlinux.lds.S |    9 ---------
 1 files changed, 0 insertions(+), 9 deletions(-)
arch/m32r/kernel/vmlinux.lds.S +0 -9
index 4179adf..eb3e425 100644
@@ -91,15 +91,6 @@ SECTIONS
   .con_initcall.init : { *(.con_initcall.init) }
   __con_initcall_end = .;
   SECURITY_INIT
-  . = ALIGN(4);
-  __alt_instructions = .;
-  .altinstructions : { *(.altinstructions) }
-  __alt_instructions_end = .;
-  .altinstr_replacement : { *(.altinstr_replacement) }
-  /* .exit.text is discard at runtime, not link time, to deal with references
-     from .altinstructions and .eh_frame */
-  .exit.text : { EXIT_TEXT }
-  .exit.data : { EXIT_DATA }
 
 #ifdef CONFIG_BLK_DEV_INITRD
   . = ALIGN(4096);
Signature · 1 line
1.6.3.3
author
#1 lore raw

PATCH 2/3 m32r: Move the spi_stack_top and spu_stack_top into .data section.

Since these get squashed into the .data output section by the m32r linker script, it seems likely that they don't need their own input sections.

I'd like an explicit confirmation from Hirokazu Takata that this is correct (in particular, that there isn't some hidden reason why there two structures need to be at the start of the .data output section).

This patch is preparation for cleaning up the m32r architecture to use the new macros in vmlinux.lds.h; if these sections are indeed not needed, then we can use the RW_DATA_SECTION macro for m32r and save a bunch of redundant code.

Cc Hirokazu Takata <[email protected]>
---
 arch/m32r/kernel/head.S        |    4 ++--
 arch/m32r/kernel/vmlinux.lds.S |    2 --
 2 files changed, 2 insertions(+), 4 deletions(-)
arch/m32r/kernel/head.S +2 -2
index 0a71944..fc4d769 100644
@@ -268,13 +268,13 @@ ENTRY(empty_zero_page)
 /*------------------------------------------------------------------------
  * Stack area
  */
-	.section .spi
+	.section .data
 	ALIGN
 	.global spi_stack_top
 	.zero	1024
 spi_stack_top:
 
-	.section .spu
+	.section .data
 	ALIGN
 	.global spu_stack_top
 	.zero	1024
arch/m32r/kernel/vmlinux.lds.S +0 -2
index eb3e425..1984b9f 100644
@@ -49,8 +49,6 @@ SECTIONS
 
   /* writeable */
   .data : {			/* Data */
-	*(.spu)
-	*(.spi)
 	DATA_DATA
 	CONSTRUCTORS
 	}
Signature · 1 line
1.6.3.3
author
#2 lore raw

PATCH 3/3 m32r: Cleanup linker script using new linker script macros.

In reply to Tim Abbott

This patch is largely a straightforward conversion. One thing to note is that the new macros use fewer separate output sections than the old code; this should have no functional impact but is relevant for people objdumping vmlinux files.

Also note that it moves the .data.init_task output sections inside _edata.

Cc Hirokazu Takata <[email protected]>
---
 arch/m32r/kernel/vmlinux.lds.S |   66 +++++-----------------------------------
 1 files changed, 8 insertions(+), 58 deletions(-)
arch/m32r/kernel/vmlinux.lds.S +8 -58
index 1984b9f..9b5a7eb 100644
@@ -40,72 +40,22 @@ SECTIONS
 #endif
   _etext = .;			/* End of text section */
 
-  . = ALIGN(16);		/* Exception table */
-  __start___ex_table = .;
-  __ex_table : { *(__ex_table) }
-  __stop___ex_table = .;
-
+  EXCEPTION_TABLE(16)
   RODATA
-
-  /* writeable */
-  .data : {			/* Data */
-	DATA_DATA
-	CONSTRUCTORS
-	}
-
-  . = ALIGN(4096);
-  __nosave_begin = .;
-  .data_nosave : { *(.data.nosave) }
-  . = ALIGN(4096);
-  __nosave_end = .;
-
-  . = ALIGN(32);
-  .data.cacheline_aligned : { *(.data.cacheline_aligned) }
-
+  RW_DATA_SECTION(32, PAGE_SIZE, THREAD_SIZE)
   _edata = .;			/* End of data section */
 
-  . = ALIGN(8192);		/* init_task */
-  .data.init_task : { *(.data.init_task) }
-
   /* will be freed after init */
-  . = ALIGN(4096);		/* Init code and data */
+  . = ALIGN(PAGE_SIZE);		/* Init code and data */
   __init_begin = .;
-  .init.text : {
-	_sinittext = .;
-	INIT_TEXT
-	_einittext = .;
-  }
-  .init.data : { INIT_DATA }
-  . = ALIGN(16);
-  __setup_start = .;
-  .init.setup : { *(.init.setup) }
-  __setup_end = .;
-  __initcall_start = .;
-  .initcall.init : {
-	INITCALLS
-  }
-  __initcall_end = .;
-  __con_initcall_start = .;
-  .con_initcall.init : { *(.con_initcall.init) }
-  __con_initcall_end = .;
-  SECURITY_INIT
-
-#ifdef CONFIG_BLK_DEV_INITRD
-  . = ALIGN(4096);
-  __initramfs_start = .;
-  .init.ramfs : { *(.init.ramfs) }
-  __initramfs_end = .;
-#endif
-
-  PERCPU(4096)
-  . = ALIGN(4096);
+  INIT_TEXT_SECTION(PAGE_SIZE)
+  INIT_DATA_SECTION(16)
+  PERCPU(PAGE_SIZE)
+  . = ALIGN(PAGE_SIZE);
   __init_end = .;
   /* freed after init ends here */
 
-  __bss_start = .;		/* BSS */
-  .bss : { *(.bss) }
-  . = ALIGN(4);
-  __bss_stop = .;
+  BSS_SECTION(0, 0, 4)
 
   _end = . ;
 
Signature · 1 line
1.6.3.3