section name cleanup for arm
cover section name cleanup for arm
This patch series cleans up the section names on the arm 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 (6):
arm: use _AC(1, UL) when defining PAGE_SIZE.
arm: convert to use __HEAD and HEAD_TEXT macros.
arm: use NOSAVE_DATA macro for .data.nosave section.
arm: use new macro for .data.cacheline_aligned section.
arm: use new macros for .data.init_task.
arm: use PERCPU macro in linker script.
arch/arm/include/asm/page.h | 4 +++- arch/arm/kernel/head-nommu.S | 2 +- arch/arm/kernel/head.S | 2 +- arch/arm/kernel/init_task.c | 3 +-- arch/arm/kernel/vmlinux.lds.S | 29 +++++++++-------------------- 5 files changed, 15 insertions(+), 25 deletions(-)
PATCH 1/6 arm: use _AC(1, UL) when defining PAGE_SIZE.
This makes it so that we can use PAGE_SIZE in the linker script.
--- arch/arm/include/asm/page.h | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
arch/arm/include/asm/page.h +3 -1
@@ -10,9 +10,11 @@#ifndef _ASMARM_PAGE_H#define _ASMARM_PAGE_H +#include <linux/const.h> +/* PAGE_SHIFT determines the page size */ #define PAGE_SHIFT 12 -#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)#define PAGE_MASK (~(PAGE_SIZE-1))#ifndef __ASSEMBLY__
Signature · 1 line
1.6.2.1
PATCH 2/6 arm: convert to use __HEAD and HEAD_TEXT macros.
This has the consequence of changing the section name used for head code from ".text.head" to ".head.text". Since this commit changes all users in the architecture, this change should be harmless.
The .text.head output section is eliminated and the head text code is included at the start of the .init output section.
--- arch/arm/kernel/head-nommu.S | 2 +- arch/arm/kernel/head.S | 2 +- arch/arm/kernel/vmlinux.lds.S | 8 +++----- 3 files changed, 5 insertions(+), 7 deletions(-)
arch/arm/kernel/head-nommu.S +1 -1
@@ -32,7 +32,7 @@ * numbers for r1. * */ - .section ".text.head", "ax" + __HEAD ENTRY(stext) msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | SVC_MODE @ ensure svc mode @ and irqs disabled
arch/arm/kernel/head.S +1 -1
@@ -74,7 +74,7 @@ * crap here - that's what the boot loader (or in extreme, well justified * circumstances, zImage) is for. */ - .section ".text.head", "ax" + __HEAD ENTRY(stext) msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | SVC_MODE @ ensure svc mode @ and irqs disabled
arch/arm/kernel/vmlinux.lds.S +3 -5
@@ -23,13 +23,11 @@ SECTIONS #else . = PAGE_OFFSET + TEXT_OFFSET; #endif - .text.head : { - _stext = .; - _sinittext = .; - *(.text.head) - } .init : { /* Init code and data */ + _stext = .; + _sinittext = .; + HEAD_TEXT INIT_TEXT _einittext = .; __proc_info_begin = .;
Signature · 1 line
1.6.2.1
PATCH 3/6 arm: use NOSAVE_DATA macro for .data.nosave section.
This has the nice consequence of replacing the alignment of 4096 with an alignment of PAGE_SIZE (=4096).
--- arch/arm/kernel/vmlinux.lds.S | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-)
arch/arm/kernel/vmlinux.lds.S +2 -5
@@ -4,6 +4,7 @@ */ #include <asm-generic/vmlinux.lds.h> +#include <asm/page.h> #include <asm/thread_info.h> #include <asm/memory.h>
@@ -154,11 +155,7 @@ SECTIONS __init_end = .; #endif - . = ALIGN(4096); - __nosave_begin = .; - *(.data.nosave) - . = ALIGN(4096); - __nosave_end = .; + NOSAVE_DATA /* * then the cacheline aligned data
Signature · 1 line
1.6.2.1
PATCH 4/6 arm: use new macro for .data.cacheline_aligned section.
--- arch/arm/kernel/vmlinux.lds.S | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
arch/arm/kernel/vmlinux.lds.S +1 -2
@@ -160,8 +160,7 @@ SECTIONS /* * then the cacheline aligned data */ - . = ALIGN(32); - *(.data.cacheline_aligned) + CACHELINE_ALIGNED_DATA(32) /* * The exception fixup table (might need resorting at runtime)
Signature · 1 line
1.6.2.1
PATCH 5/6 arm: use new macros for .data.init_task.
--- arch/arm/kernel/init_task.c | 3 +-- arch/arm/kernel/vmlinux.lds.S | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)
arch/arm/kernel/init_task.c +1 -2
@@ -28,8 +28,7 @@ EXPORT_SYMBOL(init_mm);* * The things we do for performance.. */ -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/arm/kernel/vmlinux.lds.S +1 -1
@@ -145,7 +145,7 @@ SECTIONS * first, the init task union, aligned * to an 8192 byte boundary. */ - *(.data.init_task) + INIT_TASK_DATA(THREAD_SIZE) #ifdef CONFIG_XIP_KERNEL . = ALIGN(4096);
Signature · 1 line
1.6.2.1
PATCH 6/6 arm: use PERCPU macro in linker script.
--- arch/arm/kernel/vmlinux.lds.S | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-)
arch/arm/kernel/vmlinux.lds.S +2 -7
@@ -62,13 +62,6 @@ SECTIONS usr/built-in.o(.init.ramfs) __initramfs_end = .; #endif - . = ALIGN(4096); - __per_cpu_load = .; - __per_cpu_start = .; - *(.data.percpu.page_aligned) - *(.data.percpu) - *(.data.percpu.shared_aligned) - __per_cpu_end = .; #ifndef CONFIG_XIP_KERNEL __init_begin = _stext; INIT_DATA
@@ -77,6 +70,8 @@ SECTIONS #endif } + PERCPU(4096) + /DISCARD/ : { /* Exit code and data */ EXIT_TEXT EXIT_DATA
Signature · 1 line
1.6.2.1