Skip to contentSkip to conversation

section name cleanup for mips

PATCH New Tim Abbott 1 participant 5 messages Apr 30, 2009 MIPS

lore
Share & tools
lore

Tim Abbott

author
#0 lore raw

cover section name cleanup for mips

This patch series cleans up the section names on the mips architecture. It requires the architecture-independent macro definitions from this patch series:

<http://www.spinics.net/lists/mips/msg33499.html>

The long-term goal here is to add support for building the kernel with -ffunction-sections -fdata-sections. This requires renaming all the magic section names in the kernel of the form .text.foo, .data.foo, .bss.foo, and .rodata.foo to not have collisions with sections generated for code like:

static int nosave = 0; /* -fdata-sections places in .data.nosave */ static void head(); /* -ffunction-sections places in .text.head */

Note that these patches have not been boot-tested (aside from testing the analogous changes on x86), since I don't have access to the appropriate hardware.

-Tim Abbott

Tim Abbott (4):
mips: use NOSAVE_DATA macro for .data.nosave section.
mips: use new macro for .data.cacheline_aligned section.
mips: use new macros for .data.init_task.
mips: use .text, not .text.start, for lasat boot loader.

 arch/mips/kernel/init_task.c           |    5 ++---
 arch/mips/kernel/vmlinux.lds.S         |   19 +++----------------
 arch/mips/lasat/image/head.S           |    2 +-
 arch/mips/lasat/image/romscript.normal |    2 +-
 4 files changed, 7 insertions(+), 21 deletions(-)
author
#1 lore raw

PATCH 1/4 mips: use NOSAVE_DATA macro for .data.nosave section.

This has the consequence of replacing the alignment of _PAGE_SIZE with an alignment of PAGE_SIZE. I believe these have the same value.

.data.nosave should not need a separate output section; this change moves it into the .data section.

---
 arch/mips/kernel/vmlinux.lds.S |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)
arch/mips/kernel/vmlinux.lds.S +1 -9
index 58738c8..2a6a995 100644
@@ -78,7 +78,7 @@ SECTIONS
 		 */
 		. = ALIGN(_PAGE_SIZE);
 		*(.data.init_task)
-
+		NOSAVE_DATA
 		DATA_DATA
 		CONSTRUCTORS
 	}
@@ -96,14 +96,6 @@ SECTIONS
 		*(.sdata)
 	}
 
-	. = ALIGN(_PAGE_SIZE);
-	.data_nosave : {
-		__nosave_begin = .;
-		*(.data.nosave)
-	}
-	. = ALIGN(_PAGE_SIZE);
-	__nosave_end = .;
-
 	. = ALIGN(1 << CONFIG_MIPS_L1_CACHE_SHIFT);
 	.data.cacheline_aligned : {
 		*(.data.cacheline_aligned)
Signature · 1 line
1.6.2.1
author
#2 lore raw

PATCH 2/4 mips: use new macro for .data.cacheline_aligned section.

.data.cacheline_aligned should not need a separate output section; this change moves it into the .data section.

---
 arch/mips/kernel/vmlinux.lds.S |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
arch/mips/kernel/vmlinux.lds.S +1 -5
index 2a6a995..ba459cb 100644
@@ -79,6 +79,7 @@ SECTIONS
 		. = ALIGN(_PAGE_SIZE);
 		*(.data.init_task)
 		NOSAVE_DATA
+		CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
 		DATA_DATA
 		CONSTRUCTORS
 	}
@@ -95,11 +96,6 @@ SECTIONS
 	.sdata : {
 		*(.sdata)
 	}
-
-	. = ALIGN(1 << CONFIG_MIPS_L1_CACHE_SHIFT);
-	.data.cacheline_aligned : {
-		*(.data.cacheline_aligned)
-	}
 	_edata =  .;			/* End of data section */
 
 	/* will be freed after init */
Signature · 1 line
1.6.2.1
author
#3 lore raw

PATCH 3/4 mips: use new macros for .data.init_task.

---
 arch/mips/kernel/init_task.c   |    5 ++---
 arch/mips/kernel/vmlinux.lds.S |    3 +--
 2 files changed, 3 insertions(+), 5 deletions(-)
arch/mips/kernel/init_task.c +2 -3
index 149cd91..30051b4 100644
@@ -25,9 +25,8 @@ EXPORT_SYMBOL(init_mm);
  *
  * The things we do for performance..
  */
-union thread_union init_thread_union
-	__attribute__((__section__(".data.init_task"),
-	               __aligned__(THREAD_SIZE))) =
+union thread_union init_thread_union __init_task_data
+	__attribute__((__aligned__(THREAD_SIZE))) =
 		{ INIT_THREAD_INFO(init_task) };
 
 /*
arch/mips/kernel/vmlinux.lds.S +1 -2
index ba459cb..85085e3 100644
@@ -76,8 +76,7 @@ SECTIONS
 		 * of ‘init_thread_union’ is greater than maximum
 		 * object file alignment.  Using 32768
 		 */
-		. = ALIGN(_PAGE_SIZE);
-		*(.data.init_task)
+		INIT_TASK_DATA(_PAGE_SIZE)
 		NOSAVE_DATA
 		CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
 		DATA_DATA
Signature · 1 line
1.6.2.1
author
#4 lore raw

PATCH 4/4 mips: use .text, not .text.start, for lasat boot loader.

There doesn't seem to be a reason to use a special section here, so just use the normal .text.

---
 arch/mips/lasat/image/head.S           |    2 +-
 arch/mips/lasat/image/romscript.normal |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/mips/lasat/image/head.S +1 -1
index efb95f2..c699363 100644
@@ -1,7 +1,7 @@
 #include <asm/lasat/head.h>
 
 	.text
-	.section .text.start, "ax"
+	.section .text, "ax"
 	.set noreorder
 	.set mips3
 
arch/mips/lasat/image/romscript.normal +1 -1
index 988f8ad..f470353 100644
@@ -4,7 +4,7 @@ SECTIONS
 {
   .text :
   {
-    *(.text.start)
+    *(.text)
   }
 
   /* Data in ROM */
Signature · 1 line
1.6.2.1