Skip to contentSkip to conversation

make section names compatible with -ffunction-sections -fdata-sections: arm

PATCH In review Denys Vlasenko 2 participants 2 messages Jul 1, 2008 – Jul 2, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/23 make section names compatible with -ffunction-sections -fdata-sections: arm

The purpose of this patch is to make kernel buildable with "gcc -ffunction-sections -fdata-sections". This patch fixes arm architecture.

--
vda

arch/arm/kernel/head-nommu.S +1 -1
@@ -33,7 +33,7 @@
  * numbers for r1.
  *
  */
-	.section ".text.head", "ax"
+	.section ".head.text", "ax"
 	.type	stext, %function
 ENTRY(stext)
 	msr	cpsr_c, #PSR_F_BIT | PSR_I_BIT | SVC_MODE @ ensure svc mode
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"
+	.section ".head.text", "ax"
 	.type	stext, %function
 ENTRY(stext)
 	msr	cpsr_c, #PSR_F_BIT | PSR_I_BIT | SVC_MODE @ ensure svc mode
arch/arm/kernel/init_task.c +1 -1
@@ -30,7 +30,7 @@
  * The things we do for performance..
  */
 union thread_union init_thread_union
-	__attribute__((__section__(".data.init_task"))) =
+	__attribute__((__section__(".init_task.data"))) =
 		{ INIT_THREAD_INFO(init_task) };
 
 /*
arch/arm/kernel/vmlinux.lds.S +7 -7
@@ -23,10 +23,10 @@
 #else
 	. = PAGE_OFFSET + TEXT_OFFSET;
 #endif
-	.text.head : {
+	.head.text : {
 		_stext = .;
 		_sinittext = .;
-		*(.text.head)
+		*(.head.text)
 	}
 
 	.init : {			/* Init code and data		*/
@@ -65,8 +65,8 @@
 #endif
 		. = ALIGN(4096);
 		__per_cpu_start = .;
-			*(.data.percpu)
-			*(.data.percpu.shared_aligned)
+			*(.percpu.data)
+			*(.percpu.shared_aligned.data)
 		__per_cpu_end = .;
 #ifndef CONFIG_XIP_KERNEL
 		__init_begin = _stext;
@@ -125,7 +125,7 @@
 		 * first, the init task union, aligned
 		 * to an 8192 byte boundary.
 		 */
-		*(.data.init_task)
+		*(.init_task.data)
 
 #ifdef CONFIG_XIP_KERNEL
 		. = ALIGN(4096);
@@ -137,7 +137,7 @@
 
 		. = ALIGN(4096);
 		__nosave_begin = .;
-		*(.data.nosave)
+		*(.nosave.data)
 		. = ALIGN(4096);
 		__nosave_end = .;
 
@@ -145,7 +145,7 @@
 		 * then the cacheline aligned data
 		 */
 		. = ALIGN(32);
-		*(.data.cacheline_aligned)
+		*(.cacheline_aligned.data)
 
 		/*
 		 * The exception fixup table (might need resorting at runtime)
arch/arm/mm/proc-v6.S +1 -1
@@ -164,7 +164,7 @@
 	.asciz	"ARMv6-compatible processor"
 	.align
 
-	.section ".text.init", #alloc, #execinstr
+	.section ".init.text", #alloc, #execinstr
 
 /*
  *	__v6_setup
arch/arm/mm/proc-v7.S +1 -1
@@ -146,7 +146,7 @@
 	.ascii	"ARMv7 Processor"
 	.align
 
-	.section ".text.init", #alloc, #execinstr
+	.section ".init.text", #alloc, #execinstr
 
 /*
  *	__v7_setup
arch/arm/mm/tlb-v6.S +1 -1
@@ -87,7 +87,7 @@
 	mcr	p15, 0, r2, c7, c5, 4		@ prefetch flush
 	mov	pc, lr
 
-	.section ".text.init", #alloc, #execinstr
+	.section ".init.text", #alloc, #execinstr
 
 	.type	v6wbi_tlb_fns, #object
 ENTRY(v6wbi_tlb_fns)
arch/arm/mm/tlb-v7.S +1 -1
@@ -78,7 +78,7 @@
 	isb
 	mov	pc, lr
 
-	.section ".text.init", #alloc, #execinstr
+	.section ".init.text", #alloc, #execinstr
 
 	.type	v7wbi_tlb_fns, #object
 ENTRY(v7wbi_tlb_fns)
#1 lore raw

2008/7/2 Denys Vlasenko <[email protected]>:

Quoted 4 lines

The purpose of this patch is to make kernel buildable with "gcc -ffunction-sections -fdata-sections". This patch fixes arm architecture.

Hi Denys,

I see your patchset. may I suggest you to take a look to this tools?

http://www.emn.fr/x-info/coccinelle/

I think it could simplify this kind of patching for the future. I found it reading the kernel janitors m-list and I hope it helps.

Cheers,

Signature · 1 line
/roberto