Skip to contentSkip to conversation

m68knommu: missing sections for linker script

PATCH In review Greg Ungerer 3 participants 5 messages May 7, 2008 – Jun 7, 2008 Generic include/asm header files

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 m68knommu: missing sections for linker script

Inlucde the missing kcrctab and kcrctab_unused sections into the m68knommu linker script.

---

arch/m68knommu/kernel/vmlinux.lds.S +10 -0
diff -Naurp linux-2.6.25-rc1/arch/m68knommu/kernel/vmlinux.lds.S linux-2.6.25-rc1-uc0/arch/m68knommu/kernel/vmlinux.lds.S
@@ -114,6 +114,16 @@ SECTIONS {
 		*(__kcrctab_gpl)
 		__stop___kcrctab_gpl = .;
 
+		/* Kernel symbol table: Normal unused symbols */
+		__start___kcrctab_unused = .;
+		*(__kcrctab_unused)
+		__stop___kcrctab_unused = .;
+
+		/* Kernel symbol table: GPL-only unused symbols */
+		__start___kcrctab_unused_gpl = .;
+		*(__kcrctab_unused_gpl)
+		__stop___kcrctab_unused_gpl = .;
+
 		/* Kernel symbol table: GPL-future symbols */
 		__start___kcrctab_gpl_future = .;
 		*(__kcrctab_gpl_future)
#1 lore raw
Quoted 16 lines · Greg Ungerer

Inlucde the missing kcrctab and kcrctab_unused sections into the m68knommu linker script.

---

diff -Naurp linux-2.6.25-rc1/arch/m68knommu/kernel/vmlinux.lds.S linux-2.6.25-rc1-uc0/arch/m68knommu/kernel/vmlinux.lds.S

arch/m68knommu/kernel/vmlinux.lds.S +3 -0
@@ -114,6 +114,16 @@ SECTIONS {
 		*(__kcrctab_gpl)
 		__stop___kcrctab_gpl = .;
 
+		/* Kernel symbol table: Normal unused symbols */
+		__start___kcrctab_unused = .;
+		*(__kcrctab_unused)

arch/m68knommu/kernel/vmlinux.lds.S SECTIONS { · line 129

Quoted 10 lines
arch/m68knommu/kernel/vmlinux.lds.S +7 -0
+		__stop___kcrctab_unused = .;
+
+		/* Kernel symbol table: GPL-only unused symbols */
+		__start___kcrctab_unused_gpl = .;
+		*(__kcrctab_unused_gpl)
+		__stop___kcrctab_unused_gpl = .;
+
 		/* Kernel symbol table: GPL-future symbols */
 		__start___kcrctab_gpl_future = .;
 		*(__kcrctab_gpl_future)

Hi Greg.

Any specific reasons why m68knommu does
not use include/asm-generic/vmlinux-lds.h?

There are defined there as well as many other common things.

Sam

#2 lore raw
Quoted 2 lines · * Sam Ravnborg | 2008-05-11 02:41:07 [+0200]:

Any specific reasons why m68knommu does
not use include/asm-generic/vmlinux-lds.h?

Yes, binutils syntax. I made a patch that changes vmlinux-lds a little to make it work with the generic one. I posted it to uclinux ml and wait for Greg's feedback (whether here is fine with this approach). I can recall that he wanted to use the generic if possible. Here is the patch so you drop an eye on it.

Quoted 2 lines

Sam

Sebastian
---

From: Sebastian Siewior <[email protected]>
Subject: [PATCH] generic: add OUTPUT_DATA_SECTION to vmlinux.lds.h

the m68k compiler requires an information in which memory location this section belongs. Something like

|       .data DATA_ADDR : {
|                 . = ALIGN(4);
|                 _sdata = . ;
|                 DATA_DATA
|                 . = ALIGN(8192) ;
|                 *(.data.init_task)
|                 _edata = . ;
|         } > DATA
|

is used where DATA is defined as something like

| MEMORY {
|         DATA     : ORIGIN = RAM_START, LENGTH = RAM_LENGTH
| }

and RAM_START & RAM_LENGTH is comming from Kconfig and describes the memory.
With this patch the arch specific vmlinux.lds.S could get a little smaller and requires less updates cycles (after adding new section to the kernel).

---
 include/asm-generic/vmlinux.lds.h |   43 ++++++++++++++++++++----------------
 1 files changed, 24 insertions(+), 19 deletions(-)
include/asm-generic/vmlinux.lds.h +24 -19
index f054778..4f1feae 100644
@@ -6,6 +6,10 @@
 #define VMLINUX_SYMBOL(_sym_) _sym_
 #endif
 
+#ifndef OUTPUT_DATA_SECTION
+#define OUTPUT_DATA_SECTION
+#endif
+
 /* Align . to a 8 byte boundary equals to maximum function alignment. */
 #define ALIGN_FUNCTION()  . = ALIGN(8)
 
@@ -61,11 +65,11 @@
 		*(.rodata) *(.rodata.*)					\
 		*(__vermagic)		/* Kernel version magic */	\
 		*(__markers_strings)	/* Markers: strings */		\
-	}								\
+	} OUTPUT_DATA_SECTION						\
 									\
 	.rodata1          : AT(ADDR(.rodata1) - LOAD_OFFSET) {		\
 		*(.rodata1)						\
-	}								\
+	} OUTPUT_DATA_SECTION						\
 									\
 	/* PCI quirks */						\
 	.pci_fixup        : AT(ADDR(.pci_fixup) - LOAD_OFFSET) {	\
@@ -84,89 +88,89 @@
 		VMLINUX_SYMBOL(__start_pci_fixups_resume) = .;		\
 		*(.pci_fixup_resume)					\
 		VMLINUX_SYMBOL(__end_pci_fixups_resume) = .;		\
-	}								\
+	} OUTPUT_DATA_SECTION						\
 									\
 	/* RapidIO route ops */						\
 	.rio_route        : AT(ADDR(.rio_route) - LOAD_OFFSET) {	\
 		VMLINUX_SYMBOL(__start_rio_route_ops) = .;		\
 		*(.rio_route_ops)					\
 		VMLINUX_SYMBOL(__end_rio_route_ops) = .;		\
-	}								\
+	} OUTPUT_DATA_SECTION						\
 									\
 	/* Kernel symbol table: Normal symbols */			\
 	__ksymtab         : AT(ADDR(__ksymtab) - LOAD_OFFSET) {		\
 		VMLINUX_SYMBOL(__start___ksymtab) = .;			\
 		*(__ksymtab)						\
 		VMLINUX_SYMBOL(__stop___ksymtab) = .;			\
-	}								\
+	} OUTPUT_DATA_SECTION						\
 									\
 	/* Kernel symbol table: GPL-only symbols */			\
 	__ksymtab_gpl     : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) {	\
 		VMLINUX_SYMBOL(__start___ksymtab_gpl) = .;		\
 		*(__ksymtab_gpl)					\
 		VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .;		\
-	}								\
+	} OUTPUT_DATA_SECTION						\
 									\
 	/* Kernel symbol table: Normal unused symbols */		\
 	__ksymtab_unused  : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) {	\
 		VMLINUX_SYMBOL(__start___ksymtab_unused) = .;		\
 		*(__ksymtab_unused)					\
 		VMLINUX_SYMBOL(__stop___ksymtab_unused) = .;		\
-	}								\
+	} OUTPUT_DATA_SECTION						\
 									\
 	/* Kernel symbol table: GPL-only unused symbols */		\
 	__ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
 		VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .;	\
 		*(__ksymtab_unused_gpl)					\
 		VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .;	\
-	}								\
+	} OUTPUT_DATA_SECTION						\
 									\
 	/* Kernel symbol table: GPL-future-only symbols */		\
 	__ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
 		VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .;	\
 		*(__ksymtab_gpl_future)					\
 		VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .;	\
-	}								\
+	} OUTPUT_DATA_SECTION						\
 									\
 	/* Kernel symbol table: Normal symbols */			\
 	__kcrctab         : AT(ADDR(__kcrctab) - LOAD_OFFSET) {		\
 		VMLINUX_SYMBOL(__start___kcrctab) = .;			\
 		*(__kcrctab)						\
 		VMLINUX_SYMBOL(__stop___kcrctab) = .;			\
-	}								\
+	} OUTPUT_DATA_SECTION						\
 									\
 	/* Kernel symbol table: GPL-only symbols */			\
 	__kcrctab_gpl     : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) {	\
 		VMLINUX_SYMBOL(__start___kcrctab_gpl) = .;		\
 		*(__kcrctab_gpl)					\
 		VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .;		\
-	}								\
+	} OUTPUT_DATA_SECTION						\
 									\
 	/* Kernel symbol table: Normal unused symbols */		\
 	__kcrctab_unused  : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) {	\
 		VMLINUX_SYMBOL(__start___kcrctab_unused) = .;		\
 		*(__kcrctab_unused)					\
 		VMLINUX_SYMBOL(__stop___kcrctab_unused) = .;		\
-	}								\
+	} OUTPUT_DATA_SECTION						\
 									\
 	/* Kernel symbol table: GPL-only unused symbols */		\
 	__kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
 		VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .;	\
 		*(__kcrctab_unused_gpl)					\
 		VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .;	\
-	}								\
+	} OUTPUT_DATA_SECTION						\
 									\
 	/* Kernel symbol table: GPL-future-only symbols */		\
 	__kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
 		VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .;	\
 		*(__kcrctab_gpl_future)					\
 		VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .;	\
-	}								\
+	} OUTPUT_DATA_SECTION						\
 									\
 	/* Kernel symbol table: strings */				\
         __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) {	\
 		*(__ksymtab_strings)					\
-	}								\
+	} OUTPUT_DATA_SECTION						\
 									\
 	/* __*init sections */						\
 	__init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) {		\
@@ -177,7 +181,7 @@
 		CPU_KEEP(exit.rodata)					\
 		MEM_KEEP(init.rodata)					\
 		MEM_KEEP(exit.rodata)					\
-	}								\
+	} OUTPUT_DATA_SECTION						\
 									\
 	/* Built-in module parameters. */				\
 	__param : AT(ADDR(__param) - LOAD_OFFSET) {			\
@@ -186,7 +190,8 @@
 		VMLINUX_SYMBOL(__stop___param) = .;			\
 		. = ALIGN((align));					\
 		VMLINUX_SYMBOL(__end_rodata) = .;			\
-	}								\
+	} OUTPUT_DATA_SECTION						\
+									\
 	. = ALIGN((align));
 
 /* RODATA provided for backward compatibility.
@@ -316,7 +321,7 @@
 		__start___bug_table = .;				\
 		*(__bug_table)						\
 		__stop___bug_table = .;					\
-	}
+	} OUTPUT_DATA_SECTION
 
 #define NOTES								\
 	.notes : AT(ADDR(.notes) - LOAD_OFFSET) {			\
@@ -350,5 +355,5 @@
 	.data.percpu  : AT(ADDR(.data.percpu) - LOAD_OFFSET) {		\
 		*(.data.percpu)						\
 		*(.data.percpu.shared_aligned)				\
-	}								\
+	} OUTPUT_DATA_SECTION						\
 	__per_cpu_end = .;
Signature · 1 line
1.5.4.3
#3 lore raw
Quoted 11 lines · Sebastian Siewior
Quoted 2 lines · * Sam Ravnborg | 2008-05-11 02:41:07 [+0200]:

Any specific reasons why m68knommu does
not use include/asm-generic/vmlinux-lds.h?

Yes, binutils syntax. I made a patch that changes vmlinux-lds a little to make it work with the generic one. I posted it to uclinux ml and wait for Greg's feedback (whether here is fine with this approach). I can recall that he wanted to use the generic if possible. Here is the patch so you drop an eye on it.

Quoted 1 line
Quoted 6 lines
Quoted 1 line

Sam

Sebastian
---

From: Sebastian Siewior <[email protected]>
Subject: [PATCH] generic: add OUTPUT_DATA_SECTION to vmlinux.lds.h

Looks good Sebastian.
I have this one applied and I assume you or Greg will folloup with the m68knommu simplification.

Sam

#4 lore raw
In reply to Sam Ravnborg

Hi Sam,

Quoted 30 lines · Sam Ravnborg
Quoted 16 lines · Greg Ungerer

Inlucde the missing kcrctab and kcrctab_unused sections into the m68knommu linker script.

---

diff -Naurp linux-2.6.25-rc1/arch/m68knommu/kernel/vmlinux.lds.S linux-2.6.25-rc1-uc0/arch/m68knommu/kernel/vmlinux.lds.S

arch/m68knommu/kernel/vmlinux.lds.S +3 -0
@@ -114,6 +114,16 @@ SECTIONS {
 		*(__kcrctab_gpl)
 		__stop___kcrctab_gpl = .;
 
+		/* Kernel symbol table: Normal unused symbols */
+		__start___kcrctab_unused = .;
+		*(__kcrctab_unused)

arch/m68knommu/kernel/vmlinux.lds.S SECTIONS { · line 129

Quoted 10 lines
arch/m68knommu/kernel/vmlinux.lds.S +7 -0
+		__stop___kcrctab_unused = .;
+
+		/* Kernel symbol table: GPL-only unused symbols */
+		__start___kcrctab_unused_gpl = .;
+		*(__kcrctab_unused_gpl)
+		__stop___kcrctab_unused_gpl = .;
+
 		/* Kernel symbol table: GPL-future symbols */
 		__start___kcrctab_gpl_future = .;
 		*(__kcrctab_gpl_future)

Hi Greg.

Quoted 4 lines

Any specific reasons why m68knommu does
not use include/asm-generic/vmlinux-lds.h?

There are defined there as well as many other common things.

I would very much like to use the common defines in vmlinux-lds.h.

And historically it goes back to wanting to be able to directly build ROM based kernels. There has been a couple of threads on this over th years, this one http://lkml.org/lkml/2003/1/21/213
touches on it. I think there is more before this too, but I couldn't find a link to it just now.

Sebastians patch in this thread goes to resolving this. I haven't had a good look over it yet though.

Regards
Greg

------------------------------------------------------------------------

Greg Ungerer  --  Chief Software Dude       EMAIL:     [email protected]
Secure Computing Corporation                PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com