section name cleanup for sh
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(-)
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
@@ -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
@@ -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
@@ -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
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
@@ -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
@@ -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
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
@@ -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
@@ -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
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
@@ -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
@@ -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
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
@@ -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
@@ -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
@@ -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
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
@@ -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
@@ -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
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
@@ -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
@@ -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