Skip to contentSkip to conversation

section name cleanup for sh

PATCH New Tim Abbott 1 participant 8 messages Apr 30, 2009 – May 1, 2009 SuperH

lore
Share & tools
lore

Tim Abbott

author
#0 lore raw

cover section name cleanup for sh

This patch series cleans up the section names on the sh 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 (7):
sh: Use macros for .bss.page_aligned section.
sh: Use macros for .data.page_aligned section.
sh: use NOSAVE_DATA macro for .data.nosave section.
sh: use new macro for .data.cacheline_aligned section.
sh: use new macros for .data.init_task.
sh: use new macro for .data.read_mostly section.
sh: convert to new generic read_mostly support.

 arch/sh/Kconfig                 |    3 +++
 arch/sh/include/asm/cache.h     |    2 --
 arch/sh/kernel/init_task.c      |    3 +--
 arch/sh/kernel/irq.c            |    6 ++----
 arch/sh/kernel/vmlinux_32.lds.S |   24 ++++++------------------
 arch/sh/kernel/vmlinux_64.lds.S |   24 ++++++------------------
 6 files changed, 18 insertions(+), 44 deletions(-)
author
#1 lore raw

PATCH 1/7 sh: Use macros for .bss.page_aligned section.

---
 arch/sh/kernel/irq.c            |    6 ++----
 arch/sh/kernel/vmlinux_32.lds.S |    2 +-
 arch/sh/kernel/vmlinux_64.lds.S |    2 +-
 3 files changed, 4 insertions(+), 6 deletions(-)
arch/sh/kernel/irq.c +2 -4
index 3f1372e..9853fde 100644
@@ -157,11 +157,9 @@ asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs)
 }
 
 #ifdef CONFIG_IRQSTACKS
-static char softirq_stack[NR_CPUS * THREAD_SIZE]
-		__attribute__((__section__(".bss.page_aligned")));
+static char softirq_stack[NR_CPUS * THREAD_SIZE] __page_aligned_bss;
 
-static char hardirq_stack[NR_CPUS * THREAD_SIZE]
-		__attribute__((__section__(".bss.page_aligned")));
+static char hardirq_stack[NR_CPUS * THREAD_SIZE] __page_aligned_bss;
 
 /*
  * allocate per-cpu stacks for hardirq and for softirq processing
arch/sh/kernel/vmlinux_32.lds.S +1 -1
index dd9b2ee..99a4124 100644
@@ -131,7 +131,7 @@ SECTIONS
 	.bss : {
 		__init_end = .;
 		__bss_start = .;		/* BSS */
-		*(.bss.page_aligned)
+		PAGE_ALIGNED_BSS
 		*(.bss)
 		*(COMMON)
 		. = ALIGN(4);
arch/sh/kernel/vmlinux_64.lds.S +1 -1
index 6966446..cb46577 100644
@@ -140,7 +140,7 @@ SECTIONS
 	.bss : C_PHYS(.bss) {
 		__init_end = .;
 		__bss_start = .;		/* BSS */
-		*(.bss.page_aligned)
+		PAGE_ALIGNED_BSS
 		*(.bss)
 		*(COMMON)
 		. = ALIGN(4);
Signature · 1 line
1.6.2.1
author
#2 lore raw

PATCH 2/7 sh: Use macros for .data.page_aligned section.

---
 arch/sh/kernel/vmlinux_32.lds.S |    3 +--
 arch/sh/kernel/vmlinux_64.lds.S |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
arch/sh/kernel/vmlinux_32.lds.S +1 -2
index 99a4124..325af0b 100644
@@ -69,8 +69,7 @@ SECTIONS
 		. = ALIGN(L1_CACHE_BYTES);
 		*(.data.read_mostly)
 
-		. = ALIGN(PAGE_SIZE);
-		*(.data.page_aligned)
+		PAGE_ALIGNED_DATA
 
 		__nosave_begin = .;
 		*(.data.nosave)
arch/sh/kernel/vmlinux_64.lds.S +1 -2
index cb46577..b222700 100644
@@ -78,8 +78,7 @@ SECTIONS
 		. = ALIGN(L1_CACHE_BYTES);
 		*(.data.read_mostly)
 
-		. = ALIGN(PAGE_SIZE);
-		*(.data.page_aligned)
+		PAGE_ALIGNED_DATA
 
 		__nosave_begin = .;
 		*(.data.nosave)
Signature · 1 line
1.6.2.1
author
#3 lore raw

PATCH 3/7 sh: use NOSAVE_DATA macro for .data.nosave section.

---
 arch/sh/kernel/vmlinux_32.lds.S |    7 +------
 arch/sh/kernel/vmlinux_64.lds.S |    7 +------
 2 files changed, 2 insertions(+), 12 deletions(-)
arch/sh/kernel/vmlinux_32.lds.S +1 -6
index 325af0b..5f5e190 100644
@@ -70,12 +70,7 @@ SECTIONS
 		*(.data.read_mostly)
 
 		PAGE_ALIGNED_DATA
-
-		__nosave_begin = .;
-		*(.data.nosave)
-		. = ALIGN(PAGE_SIZE);
-		__nosave_end = .;
-
+		NOSAVE_DATA
 		DATA_DATA
 		CONSTRUCTORS
 	}
arch/sh/kernel/vmlinux_64.lds.S +1 -6
index b222700..9cccb3d 100644
@@ -79,12 +79,7 @@ SECTIONS
 		*(.data.read_mostly)
 
 		PAGE_ALIGNED_DATA
-
-		__nosave_begin = .;
-		*(.data.nosave)
-		. = ALIGN(PAGE_SIZE);
-		__nosave_end = .;
-
+		NOSAVE_DATA
 		DATA_DATA
 		CONSTRUCTORS
 	}
Signature · 1 line
1.6.2.1
author
#4 lore raw

PATCH 4/7 sh: use new macro for .data.cacheline_aligned section.

I moved the section after NOSAVE_DATA with the intention of having the alignment levels of the sections placed in the .data output section being strictly decreasing.

---
 arch/sh/kernel/vmlinux_32.lds.S |    4 +---
 arch/sh/kernel/vmlinux_64.lds.S |    4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
arch/sh/kernel/vmlinux_32.lds.S +1 -3
index 5f5e190..eabb0bb 100644
@@ -64,13 +64,11 @@ SECTIONS
 		*(.data.init_task)
 
 		. = ALIGN(L1_CACHE_BYTES);
-		*(.data.cacheline_aligned)
-
-		. = ALIGN(L1_CACHE_BYTES);
 		*(.data.read_mostly)
 
 		PAGE_ALIGNED_DATA
 		NOSAVE_DATA
+		CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES)
 		DATA_DATA
 		CONSTRUCTORS
 	}
arch/sh/kernel/vmlinux_64.lds.S +1 -3
index 9cccb3d..e0e2e1b 100644
@@ -73,13 +73,11 @@ SECTIONS
 		*(.data.init_task)
 
 		. = ALIGN(L1_CACHE_BYTES);
-		*(.data.cacheline_aligned)
-
-		. = ALIGN(L1_CACHE_BYTES);
 		*(.data.read_mostly)
 
 		PAGE_ALIGNED_DATA
 		NOSAVE_DATA
+		CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES)
 		DATA_DATA
 		CONSTRUCTORS
 	}
Signature · 1 line
1.6.2.1
author
#5 lore raw

PATCH 5/7 sh: use new macros for .data.init_task.

---
 arch/sh/kernel/init_task.c      |    3 +--
 arch/sh/kernel/vmlinux_32.lds.S |    3 +--
 arch/sh/kernel/vmlinux_64.lds.S |    3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)
arch/sh/kernel/init_task.c +0 -2
index 80c35ff..9522d9a 100644
@@ -20,8 +20,7 @@ EXPORT_SYMBOL(init_mm);
  * way process stacks are handled. This is done by having a special
  * "init_task" linker map entry..
  */
-union thread_union init_thread_union
-	__attribute__((__section__(".data.init_task"))) +union thread_union init_thread_union __init_task_data  		{ INIT_THREAD_INFO(init_task) };
 
 /*
arch/sh/kernel/vmlinux_32.lds.S +1 -2
index eabb0bb..7a0f3c4 100644
@@ -59,9 +59,8 @@ SECTIONS
 	.uncached.data : { *(.uncached.data) }
 	__uncached_end = .;
 
-	. = ALIGN(THREAD_SIZE);
 	.data : {			/* Data */
-		*(.data.init_task)
+		INIT_TASK_DATA(THREAD_SIZE)
 
 		. = ALIGN(L1_CACHE_BYTES);
 		*(.data.read_mostly)
arch/sh/kernel/vmlinux_64.lds.S +1 -2
index e0e2e1b..5cd3e78 100644
@@ -68,9 +68,8 @@ SECTIONS
 	NOTES 
 	RO_DATA(PAGE_SIZE)
 
-	. = ALIGN(THREAD_SIZE);
 	.data : C_PHYS(.data) {			/* Data */
-		*(.data.init_task)
+		INIT_TASK_DATA(THREAD_SIZE)
 
 		. = ALIGN(L1_CACHE_BYTES);
 		*(.data.read_mostly)
Signature · 1 line
1.6.2.1
author
#6 lore raw

PATCH 6/7 sh: use new macro for .data.read_mostly section.

---
 arch/sh/kernel/vmlinux_32.lds.S |    5 +----
 arch/sh/kernel/vmlinux_64.lds.S |    5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)
arch/sh/kernel/vmlinux_32.lds.S +1 -4
index 7a0f3c4..de80e50 100644
@@ -61,13 +61,10 @@ SECTIONS
 
 	.data : {			/* Data */
 		INIT_TASK_DATA(THREAD_SIZE)
-
-		. = ALIGN(L1_CACHE_BYTES);
-		*(.data.read_mostly)
-
 		PAGE_ALIGNED_DATA
 		NOSAVE_DATA
 		CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES)
+		READ_MOSTLY_DATA(L1_CACHE_BYTES)
 		DATA_DATA
 		CONSTRUCTORS
 	}
arch/sh/kernel/vmlinux_64.lds.S +1 -4
index 5cd3e78..72e856b 100644
@@ -70,13 +70,10 @@ SECTIONS
 
 	.data : C_PHYS(.data) {			/* Data */
 		INIT_TASK_DATA(THREAD_SIZE)
-
-		. = ALIGN(L1_CACHE_BYTES);
-		*(.data.read_mostly)
-
 		PAGE_ALIGNED_DATA
 		NOSAVE_DATA
 		CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES)
+		READ_MOSTLY_DATA(L1_CACHE_BYTES)
 		DATA_DATA
 		CONSTRUCTORS
 	}
Signature · 1 line
1.6.2.1
author
#7 lore raw

PATCH 7/7 sh: convert to new generic read_mostly support.

---
 arch/sh/Kconfig             |    3 +++
 arch/sh/include/asm/cache.h |    2 --
 2 files changed, 3 insertions(+), 2 deletions(-)
arch/sh/Kconfig +3 -0
index e7390dd..efafd78 100644
@@ -137,6 +137,9 @@ config ARCH_HAS_DEFAULT_IDLE
 config IO_TRAPPED
 	bool
 
+config HAVE_READ_MOSTLY_DATA
+	def_bool y
+
 source "init/Kconfig"
 
 source "kernel/Kconfig.freezer"
arch/sh/include/asm/cache.h +0 -2
index 02df18e..0d44279 100644
@@ -14,8 +14,6 @@
 
 #define L1_CACHE_BYTES		(1 << L1_CACHE_SHIFT)
 
-#define __read_mostly __attribute__((__section__(".data.read_mostly")))
-
 #ifndef __ASSEMBLY__
 struct cache_info {
 	unsigned int ways;		/* Number of cache ways */
Signature · 1 line
1.6.2.1