Skip to contentSkip to conversation

section name cleanup for cris

PATCH New Tim Abbott 4 participants 5 messages Apr 30, 2009 – Jun 23, 2009 Generic include/asm header files

lore
Share & tools
lore

Tim Abbott

author
#0 lore raw

PATCH 1/1 section name cleanup for cris

This patch series cleans up the section names on the cris 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 (1):
cris: use new macros for .data.init_task.

 arch/cris/kernel/process.c     |    3 +--
 arch/cris/kernel/vmlinux.lds.S |    4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)
author
#1 lore raw

PATCH 1/1 cris: use new macros for .data.init_task.

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

Cc Mikael Starvik <[email protected]>
Cc Jesper Nilsson <[email protected]>
---
 arch/cris/kernel/process.c     |    3 +--
 arch/cris/kernel/vmlinux.lds.S |    4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)
arch/cris/kernel/process.c +1 -2
index 4df0b32..7a270c6 100644
@@ -49,8 +49,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/cris/kernel/vmlinux.lds.S +1 -3
index 0d2adfc..e4f7490 100644
@@ -62,14 +62,12 @@ SECTIONS
 	___data_start = . ;
 	__Sdata = . ;
 	.data : {			/* Data */
+		INIT_TASK_DATA(PAGE_SIZE)
 		DATA_DATA
 	}
 	__edata = . ;			/* End of data section. */
 	_edata = . ;
 
-	. = ALIGN(PAGE_SIZE);	/* init_task and stack, must be aligned. */
-	.data.init_task : { *(.data.init_task) }
-
 	. = ALIGN(PAGE_SIZE);		/* Init code and data. */
 	__init_begin = .;
 	.init.text : {
Signature · 1 line
1.6.2.1
#2 lore raw

Re: [PATCH] cris: use new macros for .data.init_task.

Quoted 2 lines · Tim Abbott

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

Hi,

Sorry about not picking this up earlier, but what's the status of the prerequisite macros? From what I can see, the prerequisite for the first part of the patch is now in mainline, but there seems to be no users of INIT_TASK_DATA yet.
(And it looks a bit dodgy as it uses INIT_TASK without any argument...)

Should I split up your patch or is there any reason to keep them together?

/Jesper

Quoted 45 lines
Cc Mikael Starvik <[email protected]>
Cc Jesper Nilsson <[email protected]>
---
 arch/cris/kernel/process.c     |    3 +--
 arch/cris/kernel/vmlinux.lds.S |    4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)
arch/cris/kernel/process.c +1 -2
index 4df0b32..7a270c6 100644
@@ -49,8 +49,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/cris/kernel/vmlinux.lds.S +1 -3
index 0d2adfc..e4f7490 100644
@@ -62,14 +62,12 @@ SECTIONS
 	___data_start = . ;
 	__Sdata = . ;
 	.data : {			/* Data */
+		INIT_TASK_DATA(PAGE_SIZE)
 		DATA_DATA
 	}
 	__edata = . ;			/* End of data section. */
 	_edata = . ;
 
-	. = ALIGN(PAGE_SIZE);	/* init_task and stack, must be aligned. */
-	.data.init_task : { *(.data.init_task) }
-
 	. = ALIGN(PAGE_SIZE);		/* Init code and data. */
 	__init_begin = .;
 	.init.text : {
Signature · 1 line
1.6.2.1

/^JN - Jesper Nilsson

Signature · 1 line
               Jesper Nilsson -- [email protected]
#3 lore raw

Re: [PATCH] cris: use new macros for .data.init_task.

Quoted 11 lines · Jesper Nilsson
Quoted 2 lines · Tim Abbott

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

Hi,

Sorry about not picking this up earlier, but what's the status of the prerequisite macros? From what I can see, the prerequisite for the first part of the patch is now in mainline, but there seems to be no users of INIT_TASK_DATA yet.
(And it looks a bit dodgy as it uses INIT_TASK without any argument...)

I applied that patch already.

I have concentrated on the vmlinux.lds stuff.
And I hope Tim will look into the rest once more.

Tim - any news from your side?

Sam

#4 lore raw

PATCH 1/1 Shuffle INIT_TASK* macro names in vmlinux.lds.h (was Re: [PATCH] cris: use new macros for .data.init_task.)

Quoted 4 lines · Sam Ravnborg

I have concentrated on the vmlinux.lds stuff.
And I hope Tim will look into the rest once more.

Tim - any news from your side?

I've been extremely busy and so I've not had time to rebase my patch series for all the architectures for the changes made to the macros in vmlinux.lds.h since my original patches were written. But I will find time to send a new version of the prerequisite macros to the files other than vmlinux.lds.h tonight, since the macros are just a few small patches.

Quoted 2 lines · Jesper Nilsson
Quoted 1 line

(And it looks a bit dodgy as it uses INIT_TASK without any argument...)

Also, Jesper's comment reveals a bug in the new macros we merged into vmlinux.lds.h:

We recently added a INIT_TASK(align) in include/asm-generic/vmlinux.lds.h, but there is already a macro INIT_TASK in include/linux/init_task.h, which is quite confusing. We should switch the macro in the linker script to INIT_TASK_DATA. (Sorry that I missed this in reviewing the patch). Since the macros are new, there is only one user of the INIT_TASK in vmlinux.lds.h, arch/mn10300/kernel/vmlinux.lds.S.

However, we are currently using INIT_TASK_DATA for laying down an entire .data.init_task section. So rename that to INIT_TASK_DATA_SECTION.

I would be worried about changing the meaning of INIT_TASK_DATA, but the old INIT_TASK_DATA implementation had no users, and in fact if anyone had tried to use it, it would have failed to compile because it didn't pass the alignment to the old INIT_TASK.

Cc David Howells <[email protected]>
---
 arch/mn10300/kernel/vmlinux.lds.S |    2 +-
 include/asm-generic/vmlinux.lds.h |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
arch/mn10300/kernel/vmlinux.lds.S +1 -1
index bcebcef..c96ba3d 100644
@@ -61,7 +61,7 @@ SECTIONS
 	_edata = .;		/* End of data section */
   }
 
-  .data.init_task : { INIT_TASK(THREAD_SIZE); }
+  .data.init_task : { INIT_TASK_DATA(THREAD_SIZE); }
 
   /* might get freed after init */
   . = ALIGN(PAGE_SIZE);
include/asm-generic/vmlinux.lds.h +4 -4
index 92b73b6..fb20e74 100644
@@ -191,7 +191,7 @@
 	. = ALIGN(align);						\
 	*(.data.cacheline_aligned)
 
-#define INIT_TASK(align)						\
+#define INIT_TASK_DATA(align)						\
 	. = ALIGN(align);						\
 	*(.data.init_task)
 
@@ -434,10 +434,10 @@
 /*
  * Init task
  */
-#define INIT_TASK_DATA(align)						\
+#define INIT_TASK_DATA_SECTION(align)					\
 	. = ALIGN(align);						\
 	.data.init_task : {						\
-		INIT_TASK						\
+		INIT_TASK_DATA(align)					\
 	}
 
 #ifdef CONFIG_CONSTRUCTORS
@@ -707,7 +707,7 @@
 #define RW_DATA_SECTION(cacheline, nosave, pagealigned, inittask)	\
 	. = ALIGN(PAGE_SIZE);						\
 	.data : AT(ADDR(.data) - LOAD_OFFSET) {				\
-		INIT_TASK(inittask)					\
+		INIT_TASK_DATA(inittask)				\
 		CACHELINE_ALIGNED_DATA(cacheline)			\
 		READ_MOSTLY_DATA(cacheline)				\
 		DATA_DATA						\
Signature · 3 lines
1.6.3.1

	-Tim Abbott