Skip to contentSkip to conversation

section name cleanup for alpha

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

lore
Share & tools
lore

Tim Abbott

author
#0 lore raw

cover section name cleanup for alpha

This patch series cleans up the section names on the alpha 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):
alpha: Use macros for .data.page_aligned.
alpha: use new macro for .data.cacheline_aligned section.
alpha: make THREAD_SIZE available to assembly files.
alpha: use .data.init_task instead of .data.init_thread

 arch/alpha/include/asm/thread_info.h |    4 ++--
 arch/alpha/kernel/init_task.c        |    5 ++---
 arch/alpha/kernel/vmlinux.lds.S      |   19 ++++---------------
 3 files changed, 8 insertions(+), 20 deletions(-)
author
#1 lore raw

PATCH 1/4 alpha: Use macros for .data.page_aligned.

.data.page_aligned should not need a separate output section, so as part of this cleanup I moved into the .data output section in the linker scripts in order to eliminate unnecessary references to the section name.

---
 arch/alpha/kernel/vmlinux.lds.S |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
arch/alpha/kernel/vmlinux.lds.S +1 -5
index b9d6568..2f33cf9 100644
@@ -97,11 +97,6 @@ SECTIONS
 		*(.data.init_thread)
 	}
 
-	. = ALIGN(PAGE_SIZE);
-	.data.page_aligned : {
-		*(.data.page_aligned)
-	}
-
 	. = ALIGN(64);
 	.data.cacheline_aligned : {
 		*(.data.cacheline_aligned)
@@ -110,6 +105,7 @@ SECTIONS
 	_data = .;
 	/* Data */
 	.data : {
+		PAGE_ALIGNED_DATA
 		DATA_DATA
 		CONSTRUCTORS
 	}
Signature · 1 line
1.6.2.1
author
#2 lore raw

PATCH 2/4 alpha: 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/alpha/kernel/vmlinux.lds.S |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
arch/alpha/kernel/vmlinux.lds.S +1 -5
index 2f33cf9..7acd1eb 100644
@@ -97,15 +97,11 @@ SECTIONS
 		*(.data.init_thread)
 	}
 
-	. = ALIGN(64);
-	.data.cacheline_aligned : {
-		*(.data.cacheline_aligned)
-	}
-
 	_data = .;
 	/* Data */
 	.data : {
 		PAGE_ALIGNED_DATA
+		CACHELINE_ALIGNED_DATA(64)
 		DATA_DATA
 		CONSTRUCTORS
 	}
Signature · 1 line
1.6.2.1
author
#3 lore raw

PATCH 3/4 alpha: make THREAD_SIZE available to assembly files.

This allows THREAD_SIZE to be used in the linker script.

---
 arch/alpha/include/asm/thread_info.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/alpha/include/asm/thread_info.h +2 -2
index d069526..a64d74d 100644
@@ -49,12 +49,12 @@ struct thread_info {
 register struct thread_info *__current_thread_info __asm__("$8");
 #define current_thread_info()  __current_thread_info
 
+#endif /* __ASSEMBLY__ */
+
 /* Thread information allocation.  */
 #define THREAD_SIZE_ORDER 1
 #define THREAD_SIZE (2*PAGE_SIZE)
 
-#endif /* __ASSEMBLY__ */
-
 #define PREEMPT_ACTIVE		0x40000000
 
 /*
Signature · 1 line
1.6.2.1
author
#4 lore raw

PATCH 4/4 alpha: use .data.init_task instead of .data.init_thread

alpha is the only architecture that uses the section name .data.init_thread instead of .data.init_task. So convert alpha to use .data.init_task like everything else.

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

---
 arch/alpha/kernel/init_task.c   |    5 ++---
 arch/alpha/kernel/vmlinux.lds.S |    7 ++-----
 2 files changed, 4 insertions(+), 8 deletions(-)
arch/alpha/kernel/init_task.c +2 -3
index c2938e5..475d46a 100644
@@ -16,6 +16,5 @@ struct task_struct init_task = INIT_TASK(init_task);
 EXPORT_SYMBOL(init_mm);
 EXPORT_SYMBOL(init_task);
 
-union thread_union init_thread_union
-	__attribute__((section(".data.init_thread")))
-	= { INIT_THREAD_INFO(init_task) };
+union thread_union init_thread_union __init_task_data =
+	{ INIT_THREAD_INFO(init_task) };
arch/alpha/kernel/vmlinux.lds.S +2 -5
index 7acd1eb..caca724 100644
@@ -1,5 +1,6 @@
 #include <asm-generic/vmlinux.lds.h>
 #include <asm/page.h>
+#include <asm/thread_info.h>
 
 OUTPUT_FORMAT("elf64-alpha")
 OUTPUT_ARCH(alpha)
@@ -92,14 +93,10 @@ SECTIONS
 	__init_end = .;
 	/* Freed after init ends here */
 
-	/* Note 2 page alignment above.  */
-	.data.init_thread : {
-		*(.data.init_thread)
-	}
-
 	_data = .;
 	/* Data */
 	.data : {
+		INIT_TASK_DATA(THREAD_SIZE)
 		PAGE_ALIGNED_DATA
 		CACHELINE_ALIGNED_DATA(64)
 		DATA_DATA
Signature · 1 line
1.6.2.1