diff mbox

Testing of function/data-sections on linux-2.6.35-rc4

Message ID 20100723202448.GB27054@merkur.ravnborg.org (mailing list archive)
State Not Applicable
Headers show

Commit Message

Sam Ravnborg July 23, 2010, 8:24 p.m. UTC
None
diff mbox

Patch

--- linux-2.6.35-rc4/arch/arm/boot/compressed/vmlinux.lds.in
+++ linux-2.6.35-rc4.new/arch/arm/boot/compressed/vmlinux.lds.in
@@ -29,12 +29,10 @@ 
   .text : {
     _start = .;
     *(.start)
-    *(.text)
-    *(.text.*)
+    *(.text .text.*)
     *(.fixup)
     *(.gnu.warning)
-    *(.rodata)
-    *(.rodata.*)
+    *(.rodata .rodata.*)
     *(.glue_7)
     *(.glue_7t)
     *(.piggydata)

This is one example where the patch only does layout changes.

--- linux-2.6.35-rc4/arch/arm/kernel/vmlinux.lds.S
+++ linux-2.6.35-rc4.new/arch/arm/kernel/vmlinux.lds.S
@@ -95,8 +95,7 @@ 
 			*(.fixup)
 #endif
 			*(.gnu.warning)
-			*(.rodata)
-			*(.rodata.*)
+			*(.rodata .rodata.*)
 			*(.glue_7)
 			*(.glue_7t)

Likewise...

--- linux-2.6.35-rc4/arch/frv/kernel/vmlinux.lds.S
+++ linux-2.6.35-rc4.new/arch/frv/kernel/vmlinux.lds.S
@@ -114,7 +114,7 @@ 
 
   .sbss		: { *(.sbss .sbss.*) }
   .bss		: { *(.bss .bss.*) }
-  .bss..stack	: { *(.bss) }
+  .bss..stack	: { *(.bss) } /* BUG??? we already absorbed it into .bss */

As the comments says the last line is redundant - remove it.

 
--- linux-2.6.35-rc4/include/asm-generic/vmlinux.lds.h
+++ linux-2.6.35-rc4.new/include/asm-generic/vmlinux.lds.h
@@ -140,9 +140,21 @@ 
 #define TRACE_SYSCALLS()
 #endif
 
+/* .data.foo are generated by gcc itself with -fdata-sections,
+ * whereas double-dot sections (like .data..percpu) are generated
+ * by kernel's magic macros.
+ *
+ * arch/.../vmlinux.lds.S decides where to place various double-dot sections
+ * as needed by its arch, here DATA_DATA needs to be careful and collect
+ * only .data and .data.foo sections, skipping .data..foo
+ *
+ * Same goes for .text, .bss and .rodata. In case of .rodata, various
+ * .rodata.foo sections are generated by gcc even without -fdata-sections
+ */
+
 /* .data section */
 #define DATA_DATA							\
-	*(.data)							\
+	*(.data .data.[A-Za-z0-9_$^]*)					\
 	*(.ref.data)							\
 	DEV_KEEP(init.data)						\
 	DEV_KEEP(exit.data)						\
@@ -202,7 +214,7 @@ 
 	. = ALIGN((align));						\
 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
 		VMLINUX_SYMBOL(__start_rodata) = .;			\
-		*(.rodata) *(.rodata.*)					\
+		*(.rodata .rodata.[A-Za-z0-9_$^]*)			\

.rodata deserve same comment as .data