Skip to contentSkip to conversation

consolidate .text section definition in asm-generic

PATCH In review Sam Ravnborg 1 participant 2 messages May 12, 2007 – May 13, 2007

Subsystems (13)
Arm (32-bit) PowerPC MIPS s390 +9 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 consolidate .text section definition in asm-generic

Move definition of .text section to asm-generic.

---
As-is this patch looks pointless but I need
to add another section in parallel with .text
so this patch allows me to do so in one place
instead of touching all .lds files.

Question: Some arch's reference .text.* -
can I add this one to asm-generic too?

From the diffstat it is obvious a lot of files are touced but changes are minimal.
The lds files could use some janitorial effort....

Sam

 arch/v850/kernel/vmlinux.lds.S               |    2 +-
 b/arch/alpha/kernel/vmlinux.lds.S            |    2 +-
 b/arch/arm/kernel/vmlinux.lds.S              |    2 +-
 b/arch/arm26/kernel/vmlinux-arm26-xip.lds.in |    2 +-
 b/arch/arm26/kernel/vmlinux-arm26.lds.in     |    2 +-
 b/arch/avr32/kernel/vmlinux.lds.c            |    2 +-
 b/arch/blackfin/kernel/vmlinux.lds.S         |    2 +-
 b/arch/frv/kernel/vmlinux.lds.S              |    3 ++-
 b/arch/h8300/kernel/vmlinux.lds.S            |    2 +-
 b/arch/i386/kernel/vmlinux.lds.S             |    2 +-
 b/arch/ia64/kernel/vmlinux.lds.S             |    2 +-
 b/arch/m32r/kernel/vmlinux.lds.S             |    2 +-
 b/arch/m68k/kernel/vmlinux-std.lds           |    2 +-
 b/arch/m68k/kernel/vmlinux-sun3.lds          |    2 +-
 b/arch/m68knommu/kernel/vmlinux.lds.S        |    2 +-
 b/arch/mips/kernel/vmlinux.lds.S             |    2 +-
 b/arch/parisc/kernel/vmlinux.lds.S           |    2 +-
 b/arch/powerpc/kernel/vmlinux.lds.S          |    3 ++-
 b/arch/ppc/kernel/vmlinux.lds.S              |    2 +-
 b/arch/s390/kernel/vmlinux.lds.S             |    2 +-
 b/arch/sh/kernel/vmlinux.lds.S               |    2 +-
 b/arch/sh64/kernel/vmlinux.lds.S             |    2 +-
 b/arch/sparc/kernel/vmlinux.lds.S            |    2 +-
 b/arch/sparc64/kernel/vmlinux.lds.S          |    2 +-
 b/arch/um/kernel/dyn.lds.S                   |    2 +-
 b/arch/um/kernel/uml.lds.S                   |    2 +-
 b/arch/x86_64/kernel/vmlinux.lds.S           |    2 +-
 b/arch/xtensa/kernel/vmlinux.lds.S           |    3 ++-
 b/include/asm-generic/vmlinux.lds.h          |    6 ++++++
 29 files changed, 37 insertions(+), 28 deletions(-)
arch/alpha/kernel/vmlinux.lds.S +1 -1
index cf1e6fc..ab60e81 100644
@@ -15,7 +15,7 @@ SECTIONS
 
   _text = .;					/* Text and read-only data */
   .text : { 
-	*(.text) 
+	TEXT_TEXT
 	SCHED_TEXT
 	LOCK_TEXT
 	*(.fixup)
arch/arm/kernel/vmlinux.lds.S +1 -1
index e4156e7..8d4e248 100644
@@ -90,7 +90,7 @@ SECTIONS
 			__exception_text_start = .;
 			*(.exception.text)
 			__exception_text_end = .;
-			*(.text)
+			TEXT_TEXT
 			SCHED_TEXT
 			LOCK_TEXT
 #ifdef CONFIG_MMU
arch/arm26/kernel/vmlinux-arm26-xip.lds.in +1 -1
index 046a850..89c806a 100644
@@ -64,7 +64,7 @@ SECTIONS
 
 	.text : {			/* Real text segment		*/
 		_text = .;		/* Text and read-only data	*/
-			*(.text)
+			TEXT_TEXT
 			SCHED_TEXT
 			LOCK_TEXT       /* FIXME - borrowed from arm32 - check*/
 			*(.fixup)
arch/arm26/kernel/vmlinux-arm26.lds.in +1 -1
index 1d2949e..e3f9b18 100644
@@ -65,7 +65,7 @@ SECTIONS
 
 	.text : {			/* Real text segment		*/
 		_text = .;		/* Text and read-only data	*/
-			*(.text)
+			TEXT_TEXT
 			SCHED_TEXT
 			LOCK_TEXT
 			*(.fixup)
arch/avr32/kernel/vmlinux.lds.c +1 -1
index e7f72c9..dbba391 100644
@@ -76,7 +76,7 @@ SECTIONS
 		. = 0x100;
 		*(.scall.text)
 		*(.irq.text)
-		*(.text)
+		TEXT_TEXT
 		SCHED_TEXT
 		LOCK_TEXT
 		KPROBES_TEXT
arch/blackfin/kernel/vmlinux.lds.S +1 -1
index 6ae9ebb..36fcc77 100644
@@ -54,7 +54,7 @@ SECTIONS
 	{
 		 _text = .;
 		 __stext = .;
-		*(.text)
+		TEXT_TEXT
 		SCHED_TEXT
 		*(.text.lock)
 		. = ALIGN(16);
arch/frv/kernel/vmlinux.lds.S +2 -1
index 28eae97..7e0998f 100644
@@ -101,13 +101,14 @@ SECTIONS
   _stext = .;
   .text : {
 	*(
-		.text.start .text .text.*
+		.text.start .text.*
 #ifdef CONFIG_DEBUG_INFO
 	.init.text
 	.exit.text
 	.exitcall.exit
 #endif
 	)
+	TEXT_TEXT
 	SCHED_TEXT
 	LOCK_TEXT
 	*(.fixup)
arch/h8300/kernel/vmlinux.lds.S +1 -1
index 65f1cdc..4365162 100644
@@ -75,7 +75,7 @@ SECTIONS
 	*(.int_redirect)
 #endif
 	__stext = . ;
-        	*(.text)
+	TEXT_TEXT
 	SCHED_TEXT
 	LOCK_TEXT
 	__etext = . ;
arch/i386/kernel/vmlinux.lds.S +1 -1
index 80bec66..dfc439a 100644
@@ -44,7 +44,7 @@ SECTIONS
 
   /* read-only */
   .text : AT(ADDR(.text) - LOAD_OFFSET) {
-	*(.text)
+	TEXT_TEXT
 	SCHED_TEXT
 	LOCK_TEXT
 	KPROBES_TEXT
arch/ia64/kernel/vmlinux.lds.S +1 -1
index 6923826..19108d0 100644
@@ -44,7 +44,7 @@ SECTIONS
   .text : AT(ADDR(.text) - LOAD_OFFSET)
     {
 	IVT_TEXT
-	*(.text)
+	TEXT_TEXT
 	SCHED_TEXT
 	LOCK_TEXT
 	KPROBES_TEXT
arch/m32r/kernel/vmlinux.lds.S +1 -1
index 6c73bca..bb1a2f5 100644
@@ -27,7 +27,7 @@ SECTIONS
   _text = .;			/* Text and read-only data */
   .boot : { *(.boot) } = 0
   .text : {
-	*(.text)
+	TEXT_TEXT
 	SCHED_TEXT
 	LOCK_TEXT
 	*(.fixup)
arch/m68k/kernel/vmlinux-std.lds +1 -1
index 437b4f8..a65cef8 100644
@@ -11,7 +11,7 @@ SECTIONS
   . = 0x1000;
   _text = .;			/* Text and read-only data */
   .text : {
-	*(.text)
+	TEXT_TEXT
 	SCHED_TEXT
 	LOCK_TEXT
 	*(.fixup)
arch/m68k/kernel/vmlinux-sun3.lds +1 -1
index 2868e20..fa44d6c 100644
@@ -12,7 +12,7 @@ SECTIONS
   _text = .;			/* Text and read-only data */
   .text : {
 	*(.head)
-	*(.text)
+	TEXT_TEXT
 	SCHED_TEXT
 	LOCK_TEXT
 	*(.fixup)
arch/m68knommu/kernel/vmlinux.lds.S +1 -1
index c86a1bf..6d4585e 100644
@@ -62,7 +62,7 @@ SECTIONS {
 	.text : {
 		_text = .;
 		_stext = . ;
-        	*(.text)
+		TEXT_TEXT
 		SCHED_TEXT
         	*(.text.lock)
 
arch/mips/kernel/vmlinux.lds.S +1 -1
index 043f637..cfe4b67 100644
@@ -27,7 +27,7 @@ SECTIONS
   /* read-only */
   _text = .;			/* Text and read-only data */
   .text : {
-    *(.text)
+    TEXT_TEXT
     SCHED_TEXT
     LOCK_TEXT
     *(.fixup)
arch/parisc/kernel/vmlinux.lds.S +1 -1
index c745859..321de82 100644
@@ -51,7 +51,7 @@ SECTIONS
 
   _text = .;			/* Text and read-only data */
   .text ALIGN(16) : {
-	*(.text)
+	TEXT_TEXT
 	SCHED_TEXT
 	LOCK_TEXT
 	*(.text.do_softirq)
arch/powerpc/kernel/vmlinux.lds.S +2 -1
index 1320673..f266209 100644
@@ -34,7 +34,8 @@ SECTIONS
 	/* Text and gots */
 	.text : {
 		_text = .;
-		*(.text .text.*)
+		*(.text.*)
+		TEXT_TEXT
 		SCHED_TEXT
 		LOCK_TEXT
 		KPROBES_TEXT
arch/ppc/kernel/vmlinux.lds.S +1 -1
index 44cd128..419ef7e 100644
@@ -32,7 +32,7 @@ SECTIONS
   .text      :
   {
     _text = .;
-    *(.text)
+    TEXT_TEXT
     SCHED_TEXT
     LOCK_TEXT
     *(.fixup)
arch/s390/kernel/vmlinux.lds.S +1 -1
index e9d3432..89c2ec5 100644
@@ -21,7 +21,7 @@ SECTIONS
   . = 0x00000000;
   _text = .;			/* Text and read-only data */
   .text : {
-	*(.text)
+	TEXT_TEXT
 	SCHED_TEXT
 	LOCK_TEXT
 	KPROBES_TEXT
arch/sh/kernel/vmlinux.lds.S +1 -1
index d83143c..2367869 100644
@@ -22,7 +22,7 @@ SECTIONS
 	*(.empty_zero_page)
 	} = 0
   .text : {
-	*(.text)
+	TEXT_TEXT
 	SCHED_TEXT
 	LOCK_TEXT
 	*(.fixup)
arch/sh64/kernel/vmlinux.lds.S +1 -1
index 4f9616f..fdf72ce 100644
@@ -54,7 +54,7 @@ SECTIONS
 	} = 0
 
   .text : C_PHYS(.text) {
-	*(.text)
+	TEXT_TEXT
 	*(.text64)
         *(.text..SHmedia32)
 	SCHED_TEXT
arch/sparc/kernel/vmlinux.lds.S +1 -1
index f0bb6e6..5cb600e 100644
@@ -12,7 +12,7 @@ SECTIONS
   .text 0xf0004000 :
   {
     _text = .;
-    *(.text)
+    TEXT_TEXT
     SCHED_TEXT
     LOCK_TEXT
     *(.gnu.warning)
arch/sparc64/kernel/vmlinux.lds.S +1 -1
index 13fa2a2..f06da20 100644
@@ -14,7 +14,7 @@ SECTIONS
   .text 0x0000000000404000 :
   {
     _text = .;
-    *(.text)
+    TEXT_TEXT
     SCHED_TEXT
     LOCK_TEXT
     KPROBES_TEXT
arch/um/kernel/dyn.lds.S +1 -1
index 87a4e44..ec8477d 100644
@@ -62,7 +62,7 @@ SECTIONS
   } =0x90909090
   .plt            : { *(.plt) }
   .text           : {
-    *(.text)
+    TEXT_TEXT
     SCHED_TEXT
     LOCK_TEXT
     *(.fixup)
arch/um/kernel/uml.lds.S +1 -1
index bc59f97..8435105 100644
@@ -37,7 +37,7 @@ SECTIONS
 
   .text      :
   {
-    *(.text)
+    TEXT_TEXT
     SCHED_TEXT
     LOCK_TEXT
     *(.fixup)
arch/um/kernel/vmlinux.lds.S +0 -0
arch/v850/kernel/vmlinux.lds.S +1 -1
index 3563082..9e2b4bc 100644
@@ -92,7 +92,7 @@
 #define TEXT_CONTENTS							      \
 		_text = .;						      \
 		__stext = . ;						      \
-        	*(.text)						      \
+		TEXT_TEXT						      \
 		SCHED_TEXT						      \
 			*(.exit.text)	/* 2.5 convention */		      \
 			*(.text.exit)	/* 2.4 convention */		      \
arch/x86_64/kernel/vmlinux.lds.S +1 -1
index 88cfa50..c77142d 100644
@@ -31,7 +31,7 @@ SECTIONS
 	*(.bootstrap.text)
 	_stext = .;
 	/* Then the rest */
-	*(.text)
+	TEXT_TEXT
 	SCHED_TEXT
 	LOCK_TEXT
 	KPROBES_TEXT
arch/xtensa/kernel/vmlinux.lds.S +2 -1
index 4fbd66a..7d2dfb2 100644
@@ -84,7 +84,8 @@ SECTIONS
   {
     /* The .head.text section must be the first section! */
     *(.head.text)
-    *(.literal .text)
+    *(.literal)
+    TEXT_TEXT
     *(.srom.text)
     VMLINUX_SYMBOL(__sched_text_start) = .;
     *(.sched.literal .sched.text)
include/asm-generic/vmlinux.lds.h +6 -0
index f3806a7..a464227 100644
@@ -139,6 +139,12 @@
 		VMLINUX_SYMBOL(__security_initcall_end) = .;		\
 	}
 
+/* .text section. Map to function alignment to avoid address changes
+ * during second ld run in second ld pass when generating System.map */
+#define TEXT_TEXT							\
+		ALIGN_FUNCTION();					\
+		*(.text)
+
 /* sched.text is aling to function alignment to secure we have same
  * address even at second ld pass when generating System.map */
 #define SCHED_TEXT							\
#1 lore raw

arch/alpha/kernel/vmlinux.lds.S SECTIONS · line 21

Quoted 10 lines

+++ b/arch/alpha/kernel/vmlinux.lds.S

arch/alpha/kernel/vmlinux.lds.S +1 -1
@@ -15,7 +15,7 @@ SECTIONS
 
   _text = .;					/* Text and read-only data */
   .text : { 
-	*(.text) 
+	TEXT_TEXT
 	SCHED_TEXT
 	LOCK_TEXT
 	*(.fixup)

It was in private mail suggested to improve naming a bit. Originally I thought of CODE_TEXT but ended up with TEXT_TEXT.

Any better ideas?

As time permits I will try to do a bit more consolidation of the lds files. But nothing earthshaking.

Sam