2009-04-30 23:44:54

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 0/6] 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(-)


2009-04-30 23:40:30

by Tim Abbott

[permalink] [raw]
Subject: [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.

Signed-off-by: Tim Abbott <[email protected]>
Cc: Russell King <[email protected]>
Cc: Linus Torvalds <[email protected]>
---
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(-)

diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index cc87e17..4f10d1c 100644
--- a/arch/arm/kernel/head-nommu.S
+++ b/arch/arm/kernel/head-nommu.S
@@ -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
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 21e17dc..f1877a5 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -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
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index c90f272..15520be 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -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 = .;
--
1.6.2.1

2009-04-30 23:40:43

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 6/6] arm: use PERCPU macro in linker script.

Signed-off-by: Tim Abbott <[email protected]>
Cc: Russell King <[email protected]>
---
arch/arm/kernel/vmlinux.lds.S | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index eede3be..5ff99b3 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -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
--
1.6.2.1

2009-04-30 23:40:59

by Tim Abbott

[permalink] [raw]
Subject: [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.

Signed-off-by: Tim Abbott <[email protected]>
---
arch/arm/include/asm/page.h | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h
index e6eb8a6..185c833 100644
--- a/arch/arm/include/asm/page.h
+++ b/arch/arm/include/asm/page.h
@@ -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__
--
1.6.2.1

2009-04-30 23:44:37

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 4/6] arm: use new macro for .data.cacheline_aligned section.

Signed-off-by: Tim Abbott <[email protected]>
Cc: Russell King <[email protected]>
---
arch/arm/kernel/vmlinux.lds.S | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 3e2f644..a9bd142 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -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)
--
1.6.2.1

2009-04-30 23:45:17

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 5/6] arm: use new macros for .data.init_task.

Signed-off-by: Tim Abbott <[email protected]>
Cc: Russell King <[email protected]>
---
arch/arm/kernel/init_task.c | 3 +--
arch/arm/kernel/vmlinux.lds.S | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/arm/kernel/init_task.c b/arch/arm/kernel/init_task.c
index e859af3..f3c4aac 100644
--- a/arch/arm/kernel/init_task.c
+++ b/arch/arm/kernel/init_task.c
@@ -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) };

/*
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index a9bd142..eede3be 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -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);
--
1.6.2.1

2009-04-30 23:46:42

by Tim Abbott

[permalink] [raw]
Subject: [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).

Signed-off-by: Tim Abbott <[email protected]>
Cc: Russell King <[email protected]>
---
arch/arm/kernel/vmlinux.lds.S | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 15520be..3e2f644 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -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
--
1.6.2.1