Skip to contentSkip to conversation

update for x86_64-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch

PATCH Jan Beulich 2 participants 3 messages Aug 28, 2006 – Sep 11, 2006

lore
Share & tools
lore
#0 lore raw

Older binutils (prior to 2.16) have a problem with the linker script resulting from the change introducing explicit segment maps. Namely does the respective linker not properly handle @nobits sections (i.e. .bss) sitting between @progbits ones (i.e. .data.*). The .bss section must therefore be moved past all initialized sections (as is already the case on i386). Replacement patch attached.

Jan

arch/x86_64/kernel/vmlinux.lds.S +20 -11
@@ -13,6 +13,12 @@ OUTPUT_FORMAT("elf64-x86-64", "elf64-x86
 OUTPUT_ARCH(i386:x86-64)
 ENTRY(phys_startup_64)
 jiffies_64 = jiffies;
+PHDRS {
+	text PT_LOAD FLAGS(5);	/* R_E */
+	data PT_LOAD FLAGS(7);	/* RWE */
+	user PT_LOAD FLAGS(7);	/* RWE */
+	note PT_NOTE FLAGS(4);	/* R__ */
+}
 SECTIONS
 {
   . = __START_KERNEL;
@@ -31,7 +37,7 @@ SECTIONS
 	KPROBES_TEXT
 	*(.fixup)
 	*(.gnu.warning)
-	} = 0x9090
+	} :text = 0x9090
   				/* out-of-line lock text */
   .text.lock : AT(ADDR(.text.lock) - LOAD_OFFSET) { *(.text.lock) }
 
@@ -57,17 +63,10 @@ #endif
   .data : AT(ADDR(.data) - LOAD_OFFSET) {
 	*(.data)
 	CONSTRUCTORS
-	}
+	} :data
 
   _edata = .;			/* End of data section */
 
-  __bss_start = .;		/* BSS */
-  .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
-	*(.bss.page_aligned)	
-	*(.bss)
-	}
-  __bss_stop = .;
-
   . = ALIGN(PAGE_SIZE);
   . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
   .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
@@ -89,7 +88,7 @@ #define VVIRT_OFFSET (VSYSCALL_ADDR - VS
 #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET)
 
   . = VSYSCALL_ADDR;
-  .vsyscall_0 :	 AT(VSYSCALL_PHYS_ADDR) { *(.vsyscall_0) }
+  .vsyscall_0 :	 AT(VSYSCALL_PHYS_ADDR) { *(.vsyscall_0) } :user
   __vsyscall_0 = VSYSCALL_VIRT_ADDR;
 
   . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
@@ -132,7 +131,7 @@ #undef VVIRT
   . = ALIGN(8192);		/* init_task */
   .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
 	*(.data.init_task)
-  }
+  } :data
 
   . = ALIGN(4096);
   .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
@@ -222,6 +221,14 @@ SECTIONS
   . = ALIGN(4096);
   __nosave_end = .;
 
+  __bss_start = .;		/* BSS */
+  . = ALIGN(4096);
+  .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
+	*(.bss.page_aligned)
+	*(.bss)
+	}
+  __bss_stop = .;
+
   _end = . ;
 
   /* Sections to be discarded */
@@ -235,4 +242,6 @@ #endif
   STABS_DEBUG
 
   DWARF_DEBUG
+
+  NOTES
 }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 6 lines · Jan Beulich

Older binutils (prior to 2.16) have a problem with the linker script resulting from the change introducing explicit segment maps. Namely does the respective linker not properly handle @nobits sections (i.e. .bss) sitting between @progbits ones (i.e. .data.*). The .bss section must therefore be moved past all initialized sections (as is already the case on i386). Replacement patch attached.

I've applied this now. Sorry for the delay, it slipped off my radar...

I'm a little wary of the problem described here
http://marc.theaimsgroup.com/?l=linux-kernel&m=115629369729911&w=2 but I was unable to reproduce it and for now it seems preferable to not working at all with older binutils.

Ian.

#2 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line

Ian Campbell <[email protected]> 09.09.06 21:59 >>>

Quoted 6 lines · Jan Beulich

Older binutils (prior to 2.16) have a problem with the linker script resulting from the change introducing explicit segment maps. Namely does the respective linker not properly handle @nobits sections (i.e. .bss) sitting between @progbits ones (i.e. .data.*). The .bss section must therefore be moved past all initialized sections (as is already the case on i386). Replacement patch attached.

Quoted 6 lines

I've applied this now. Sorry for the delay, it slipped off my radar...

I'm a little wary of the problem described here
http://marc.theaimsgroup.com/?l=linux-kernel&m=115629369729911&w=2 but I was unable to reproduce it and for now it seems preferable to not working at all with older binutils.

I discussed this at some length with Andi Kleen (as I'm of the opinion that if that patch introduced a problem like this, then the problem was likely just hidden before). Since we have so little data about the problem, we'd need to see this again in order to analyze it more thoroughly; I would have wanted it to be put back in even in the native kernel for this purpose, but Andi wanted to at least delay doing so until we (internally) have a wider test window again than at this point in time.
Therefore, should anyone run into any problems because of this change, I would very much appreciate being explicitly notified about that.

Jan