public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: fix build with older binutils and consolidate linker script
@ 2009-08-18 15:51 Jan Beulich
  2009-08-21 20:23 ` H. Peter Anvin
  2009-08-24 22:55 ` [tip:x86/urgent] x86: Fix " tip-bot for Jan Beulich
  0 siblings, 2 replies; 16+ messages in thread
From: Jan Beulich @ 2009-08-18 15:51 UTC (permalink / raw)
  To: mingo, tglx, sam, hpa; +Cc: linux-kernel

Impact: build fix

binutils prior to 2.17 can't deal with the currently possible situation
of a new segment following the per-CPU segment, but that new segment
being empty - objcopy misplaces the .bss (and perhaps also the .brk)
sections outside of any segment. However, the current ordering of
sections really just appears to be the effect of cumulative unrelated
changes; re-ordering things allows to easily guarantee that the segment
following the per-CPU one is non-empty, and at once eliminates the need
for the bogus data.init2 segment.

Once touching this code, also use the various data section helper
macros from include/asm-generic/vmlinux.lds.h.

Signed-off-by: Jan Beulich <jbeulich@novell.com>

---
 arch/x86/kernel/vmlinux.lds.S |  126 +++++++++++++++---------------------------
 1 file changed, 47 insertions(+), 79 deletions(-)

--- linux-2.6.31-rc6/arch/x86/kernel/vmlinux.lds.S	2009-08-18 15:31:16.000000000 +0200
+++ 2.6.31-rc6-x86-link-order/arch/x86/kernel/vmlinux.lds.S	2009-08-18 16:42:54.000000000 +0200
@@ -46,11 +46,10 @@ PHDRS {
 	data PT_LOAD FLAGS(7);          /* RWE */
 #ifdef CONFIG_X86_64
 	user PT_LOAD FLAGS(7);          /* RWE */
-	data.init PT_LOAD FLAGS(7);     /* RWE */
 #ifdef CONFIG_SMP
 	percpu PT_LOAD FLAGS(7);        /* RWE */
+	init PT_LOAD FLAGS(7);          /* RWE */
 #endif
-	data.init2 PT_LOAD FLAGS(7);    /* RWE */
 #endif
 	note PT_NOTE FLAGS(0);          /* ___ */
 }
@@ -103,65 +102,43 @@ SECTIONS
 		__stop___ex_table = .;
 	} :text = 0x9090
 
-	RODATA
+	RO_DATA(PAGE_SIZE)
 
 	/* Data */
-	. = ALIGN(PAGE_SIZE);
 	.data : AT(ADDR(.data) - LOAD_OFFSET) {
 		/* Start of data section */
 		_sdata = .;
-		DATA_DATA
-		CONSTRUCTORS
-	} :data
+
+		/* init_task */
+		INIT_TASK_DATA(THREAD_SIZE)
 
 #ifdef CONFIG_X86_32
-	/* 32 bit has nosave before _edata */
-	. = ALIGN(PAGE_SIZE);
-	.data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
-		__nosave_begin = .;
-		*(.data.nosave)
-		. = ALIGN(PAGE_SIZE);
-		__nosave_end = .;
-	}
+		/* 32 bit has nosave before _edata */
+		NOSAVE_DATA
 #endif
 
-	. = ALIGN(PAGE_SIZE);
-	.data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
-		*(.data.page_aligned)
+		PAGE_ALIGNED_DATA(PAGE_SIZE)
 		*(.data.idt)
-	}
 
-#ifdef CONFIG_X86_32
-	. = ALIGN(32);
-#else
-	. = ALIGN(PAGE_SIZE);
-	. = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
-#endif
-	.data.cacheline_aligned :
-		AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
-		*(.data.cacheline_aligned)
-	}
+		CACHELINE_ALIGNED_DATA(CONFIG_X86_L1_CACHE_BYTES)
 
-	/* rarely changed data like cpu maps */
-#ifdef CONFIG_X86_32
-	. = ALIGN(32);
-#else
-	. = ALIGN(CONFIG_X86_INTERNODE_CACHE_BYTES);
-#endif
-	.data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
-		*(.data.read_mostly)
+		DATA_DATA
+		CONSTRUCTORS
+
+		/* rarely changed data like cpu maps */
+		READ_MOSTLY_DATA(CONFIG_X86_INTERNODE_CACHE_BYTES)
 
 		/* End of data section */
 		_edata = .;
-	}
+	} :data
 
 #ifdef CONFIG_X86_64
 
 #define VSYSCALL_ADDR (-10*1024*1024)
-#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.read_mostly) + \
-                            SIZEOF(.data.read_mostly) + 4095) & ~(4095))
-#define VSYSCALL_VIRT_ADDR ((ADDR(.data.read_mostly) + \
-                            SIZEOF(.data.read_mostly) + 4095) & ~(4095))
+#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data) + SIZEOF(.data) + \
+                            PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
+#define VSYSCALL_VIRT_ADDR ((ADDR(.data) + SIZEOF(.data) + \
+                            PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
 
 #define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
 #define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
@@ -227,35 +204,29 @@ SECTIONS
 
 #endif /* CONFIG_X86_64 */
 
-	/* init_task */
-	. = ALIGN(THREAD_SIZE);
-	.data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
-		*(.data.init_task)
+	/* Init code and data - will be freed after init */
+	. = ALIGN(PAGE_SIZE);
+	.init.begin : AT(ADDR(.init.begin) - LOAD_OFFSET) {
+		__init_begin = .; /* paired with __init_end */
 	}
-#ifdef CONFIG_X86_64
-	 :data.init
-#endif
 
+#if defined(CONFIG_X86_64) && defined(CONFIG_SMP)
 	/*
-	 * smp_locks might be freed after init
-	 * start/end must be page aligned
+	 * percpu offsets are zero-based on SMP.  PERCPU_VADDR() changes the
+	 * output PHDR, so the next output section - .init.text - should
+	 * start another segment - init.
 	 */
-	. = ALIGN(PAGE_SIZE);
-	.smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
-		__smp_locks = .;
-		*(.smp_locks)
-		__smp_locks_end = .;
-		. = ALIGN(PAGE_SIZE);
-	}
+	PERCPU_VADDR(0, :percpu)
+#endif
 
-	/* Init code and data - will be freed after init */
-	. = ALIGN(PAGE_SIZE);
 	.init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
-		__init_begin = .; /* paired with __init_end */
 		_sinittext = .;
 		INIT_TEXT
 		_einittext = .;
 	}
+#if defined(CONFIG_X86_64) && defined(CONFIG_SMP)
+	:init
+#endif
 
 	.init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
 		INIT_DATA
@@ -326,17 +297,7 @@ SECTIONS
 	}
 #endif
 
-#if defined(CONFIG_X86_64) && defined(CONFIG_SMP)
-	/*
-	 * percpu offsets are zero-based on SMP.  PERCPU_VADDR() changes the
-	 * output PHDR, so the next output section - __data_nosave - should
-	 * start another section data.init2.  Also, pda should be at the head of
-	 * percpu area.  Preallocate it and define the percpu offset symbol
-	 * so that it can be accessed as a percpu variable.
-	 */
-	. = ALIGN(PAGE_SIZE);
-	PERCPU_VADDR(0, :percpu)
-#else
+#if !defined(CONFIG_X86_64) || !defined(CONFIG_SMP)
 	PERCPU(PAGE_SIZE)
 #endif
 
@@ -347,15 +308,22 @@ SECTIONS
 		__init_end = .;
 	}
 
+	/*
+	 * smp_locks might be freed after init
+	 * start/end must be page aligned
+	 */
+	. = ALIGN(PAGE_SIZE);
+	.smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
+		__smp_locks = .;
+		*(.smp_locks)
+		__smp_locks_end = .;
+		. = ALIGN(PAGE_SIZE);
+	}
+
 #ifdef CONFIG_X86_64
 	.data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
-		. = ALIGN(PAGE_SIZE);
-		__nosave_begin = .;
-		*(.data.nosave)
-		. = ALIGN(PAGE_SIZE);
-		__nosave_end = .;
-	} :data.init2
-	/* use another section data.init2, see PERCPU_VADDR() above */
+		NOSAVE_DATA
+	}
 #endif
 
 	/* BSS */



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] x86: fix build with older binutils and consolidate  linker script
  2009-08-18 15:51 [PATCH] x86: fix build with older binutils and consolidate linker script Jan Beulich
@ 2009-08-21 20:23 ` H. Peter Anvin
  2009-08-24  6:55   ` Jan Beulich
  2009-08-24 22:55 ` [tip:x86/urgent] x86: Fix " tip-bot for Jan Beulich
  1 sibling, 1 reply; 16+ messages in thread
From: H. Peter Anvin @ 2009-08-21 20:23 UTC (permalink / raw)
  To: Jan Beulich; +Cc: mingo, tglx, sam, linux-kernel

On 08/18/2009 08:51 AM, Jan Beulich wrote:
>  
>  #define VSYSCALL_ADDR (-10*1024*1024)
> -#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.read_mostly) + \
> -                            SIZEOF(.data.read_mostly) + 4095) & ~(4095))
> -#define VSYSCALL_VIRT_ADDR ((ADDR(.data.read_mostly) + \
> -                            SIZEOF(.data.read_mostly) + 4095) & ~(4095))
> +#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data) + SIZEOF(.data) + \
> +                            PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
> +#define VSYSCALL_VIRT_ADDR ((ADDR(.data) + SIZEOF(.data) + \
> +                            PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
>  

I'm missing something with this chunk... could you please explain?

	-hpa

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] x86: fix build with older binutils and consolidate  linker script
  2009-08-21 20:23 ` H. Peter Anvin
@ 2009-08-24  6:55   ` Jan Beulich
  2009-08-24  7:13     ` H. Peter Anvin
  0 siblings, 1 reply; 16+ messages in thread
From: Jan Beulich @ 2009-08-24  6:55 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: mingo, tglx, sam, linux-kernel

>>> "H. Peter Anvin" <hpa@zytor.com> 21.08.09 22:23 >>>
>On 08/18/2009 08:51 AM, Jan Beulich wrote:
>>  
>>  #define VSYSCALL_ADDR (-10*1024*1024)
>> -#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.read_mostly) + \
>> -                            SIZEOF(.data.read_mostly) + 4095) & ~(4095))
>> -#define VSYSCALL_VIRT_ADDR ((ADDR(.data.read_mostly) + \
>> -                            SIZEOF(.data.read_mostly) + 4095) & ~(4095))
>> +#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data) + SIZEOF(.data) + \
>> +                            PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
>> +#define VSYSCALL_VIRT_ADDR ((ADDR(.data) + SIZEOF(.data) + \
>> +                            PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
>>  
>
>I'm missing something with this chunk... could you please explain?

There are two changes here: One is the adjustment to properly use the
new preceding section's name, and the other is to replace the hard coded
4095 by PAGE_SIZE-1.

Jan


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] x86: fix build with older binutils and  consolidate  linker script
  2009-08-24  6:55   ` Jan Beulich
@ 2009-08-24  7:13     ` H. Peter Anvin
  2009-08-24  7:21       ` Jan Beulich
  0 siblings, 1 reply; 16+ messages in thread
From: H. Peter Anvin @ 2009-08-24  7:13 UTC (permalink / raw)
  To: Jan Beulich; +Cc: mingo, tglx, sam, linux-kernel

On 08/23/2009 11:55 PM, Jan Beulich wrote:
>>>> "H. Peter Anvin" <hpa@zytor.com> 21.08.09 22:23 >>>
>> On 08/18/2009 08:51 AM, Jan Beulich wrote:
>>>  
>>>  #define VSYSCALL_ADDR (-10*1024*1024)
>>> -#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.read_mostly) + \
>>> -                            SIZEOF(.data.read_mostly) + 4095) & ~(4095))
>>> -#define VSYSCALL_VIRT_ADDR ((ADDR(.data.read_mostly) + \
>>> -                            SIZEOF(.data.read_mostly) + 4095) & ~(4095))
>>> +#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data) + SIZEOF(.data) + \
>>> +                            PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
>>> +#define VSYSCALL_VIRT_ADDR ((ADDR(.data) + SIZEOF(.data) + \
>>> +                            PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
>>>  
>> I'm missing something with this chunk... could you please explain?
> 
> There are two changes here: One is the adjustment to properly use the
> new preceding section's name, and the other is to replace the hard coded
> 4095 by PAGE_SIZE-1.
> 

Hm.  I'm wondering if an actual (NOLOAD)/@nobits section wouldn't be
better...

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] x86: fix build with older binutils and  consolidate  linker script
  2009-08-24  7:13     ` H. Peter Anvin
@ 2009-08-24  7:21       ` Jan Beulich
  2009-08-24 16:09         ` H. Peter Anvin
  0 siblings, 1 reply; 16+ messages in thread
From: Jan Beulich @ 2009-08-24  7:21 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: mingo, tglx, sam, linux-kernel

>>> "H. Peter Anvin" <hpa@zytor.com> 24.08.09 09:13 >>>
>On 08/23/2009 11:55 PM, Jan Beulich wrote:
>>>>> "H. Peter Anvin" <hpa@zytor.com> 21.08.09 22:23 >>>
>>> On 08/18/2009 08:51 AM, Jan Beulich wrote:
>>>>  
>>>>  #define VSYSCALL_ADDR (-10*1024*1024)
>>>> -#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.read_mostly) + \
>>>> -                            SIZEOF(.data.read_mostly) + 4095) & ~(4095))
>>>> -#define VSYSCALL_VIRT_ADDR ((ADDR(.data.read_mostly) + \
>>>> -                            SIZEOF(.data.read_mostly) + 4095) & ~(4095))
>>>> +#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data) + SIZEOF(.data) + \
>>>> +                            PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
>>>> +#define VSYSCALL_VIRT_ADDR ((ADDR(.data) + SIZEOF(.data) + \
>>>> +                            PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
>>>>  
>>> I'm missing something with this chunk... could you please explain?
>> 
>> There are two changes here: One is the adjustment to properly use the
>> new preceding section's name, and the other is to replace the hard coded
>> 4095 by PAGE_SIZE-1.
>> 
>
>Hm.  I'm wondering if an actual (NOLOAD)/@nobits section wouldn't be
>better...

For what? The immediately preceding section?

In any case, it would seem that this would be an independent patch on top
of mine...

Jan


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] x86: fix build with older binutils and   consolidate linker script
  2009-08-24  7:21       ` Jan Beulich
@ 2009-08-24 16:09         ` H. Peter Anvin
  0 siblings, 0 replies; 16+ messages in thread
From: H. Peter Anvin @ 2009-08-24 16:09 UTC (permalink / raw)
  To: Jan Beulich; +Cc: mingo, tglx, sam, linux-kernel

On 08/24/2009 12:21 AM, Jan Beulich wrote:
> In any case, it would seem that this would be an independent patch on top
> of mine...

Agreed.  I'll look at it later.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [tip:x86/urgent] x86: Fix build with older binutils and consolidate linker script
  2009-08-18 15:51 [PATCH] x86: fix build with older binutils and consolidate linker script Jan Beulich
  2009-08-21 20:23 ` H. Peter Anvin
@ 2009-08-24 22:55 ` tip-bot for Jan Beulich
  2009-08-25  7:50   ` Ingo Molnar
  1 sibling, 1 reply; 16+ messages in thread
From: tip-bot for Jan Beulich @ 2009-08-24 22:55 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, jbeulich, JBeulich, tglx

Commit-ID:  ddc98b38b6320d5de2e3167673a06ec1a48e9d0e
Gitweb:     http://git.kernel.org/tip/ddc98b38b6320d5de2e3167673a06ec1a48e9d0e
Author:     Jan Beulich <JBeulich@novell.com>
AuthorDate: Tue, 18 Aug 2009 16:51:27 +0100
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 24 Aug 2009 15:51:35 -0700

x86: Fix build with older binutils and consolidate linker script

binutils prior to 2.17 can't deal with the currently possible situation
of a new segment following the per-CPU segment, but that new segment
being empty - objcopy misplaces the .bss (and perhaps also the .brk)
sections outside of any segment. However, the current ordering of
sections really just appears to be the effect of cumulative unrelated
changes; re-ordering things allows to easily guarantee that the segment
following the per-CPU one is non-empty, and at once eliminates the need
for the bogus data.init2 segment.

Once touching this code, also use the various data section helper
macros from include/asm-generic/vmlinux.lds.h.

[ Impact: build fix ]

Signed-off-by: Jan Beulich <jbeulich@novell.com>
LKML-Reference: <4A8AEA1F0200007800010563@vpn.id2.novell.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>


---
 arch/x86/kernel/vmlinux.lds.S |  126 +++++++++++++++-------------------------
 1 files changed, 47 insertions(+), 79 deletions(-)

diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 78d185d..9fbcd5b 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -46,11 +46,10 @@ PHDRS {
 	data PT_LOAD FLAGS(7);          /* RWE */
 #ifdef CONFIG_X86_64
 	user PT_LOAD FLAGS(7);          /* RWE */
-	data.init PT_LOAD FLAGS(7);     /* RWE */
 #ifdef CONFIG_SMP
 	percpu PT_LOAD FLAGS(7);        /* RWE */
+	init PT_LOAD FLAGS(7);          /* RWE */
 #endif
-	data.init2 PT_LOAD FLAGS(7);    /* RWE */
 #endif
 	note PT_NOTE FLAGS(0);          /* ___ */
 }
@@ -103,65 +102,43 @@ SECTIONS
 		__stop___ex_table = .;
 	} :text = 0x9090
 
-	RODATA
+	RO_DATA(PAGE_SIZE)
 
 	/* Data */
-	. = ALIGN(PAGE_SIZE);
 	.data : AT(ADDR(.data) - LOAD_OFFSET) {
 		/* Start of data section */
 		_sdata = .;
-		DATA_DATA
-		CONSTRUCTORS
-	} :data
+
+		/* init_task */
+		INIT_TASK_DATA(THREAD_SIZE)
 
 #ifdef CONFIG_X86_32
-	/* 32 bit has nosave before _edata */
-	. = ALIGN(PAGE_SIZE);
-	.data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
-		__nosave_begin = .;
-		*(.data.nosave)
-		. = ALIGN(PAGE_SIZE);
-		__nosave_end = .;
-	}
+		/* 32 bit has nosave before _edata */
+		NOSAVE_DATA
 #endif
 
-	. = ALIGN(PAGE_SIZE);
-	.data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
-		*(.data.page_aligned)
+		PAGE_ALIGNED_DATA(PAGE_SIZE)
 		*(.data.idt)
-	}
 
-#ifdef CONFIG_X86_32
-	. = ALIGN(32);
-#else
-	. = ALIGN(PAGE_SIZE);
-	. = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
-#endif
-	.data.cacheline_aligned :
-		AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
-		*(.data.cacheline_aligned)
-	}
+		CACHELINE_ALIGNED_DATA(CONFIG_X86_L1_CACHE_BYTES)
 
-	/* rarely changed data like cpu maps */
-#ifdef CONFIG_X86_32
-	. = ALIGN(32);
-#else
-	. = ALIGN(CONFIG_X86_INTERNODE_CACHE_BYTES);
-#endif
-	.data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
-		*(.data.read_mostly)
+		DATA_DATA
+		CONSTRUCTORS
+
+		/* rarely changed data like cpu maps */
+		READ_MOSTLY_DATA(CONFIG_X86_INTERNODE_CACHE_BYTES)
 
 		/* End of data section */
 		_edata = .;
-	}
+	} :data
 
 #ifdef CONFIG_X86_64
 
 #define VSYSCALL_ADDR (-10*1024*1024)
-#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.read_mostly) + \
-                            SIZEOF(.data.read_mostly) + 4095) & ~(4095))
-#define VSYSCALL_VIRT_ADDR ((ADDR(.data.read_mostly) + \
-                            SIZEOF(.data.read_mostly) + 4095) & ~(4095))
+#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data) + SIZEOF(.data) + \
+                            PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
+#define VSYSCALL_VIRT_ADDR ((ADDR(.data) + SIZEOF(.data) + \
+                            PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
 
 #define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
 #define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
@@ -227,35 +204,29 @@ SECTIONS
 
 #endif /* CONFIG_X86_64 */
 
-	/* init_task */
-	. = ALIGN(THREAD_SIZE);
-	.data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
-		*(.data.init_task)
+	/* Init code and data - will be freed after init */
+	. = ALIGN(PAGE_SIZE);
+	.init.begin : AT(ADDR(.init.begin) - LOAD_OFFSET) {
+		__init_begin = .; /* paired with __init_end */
 	}
-#ifdef CONFIG_X86_64
-	 :data.init
-#endif
 
+#if defined(CONFIG_X86_64) && defined(CONFIG_SMP)
 	/*
-	 * smp_locks might be freed after init
-	 * start/end must be page aligned
+	 * percpu offsets are zero-based on SMP.  PERCPU_VADDR() changes the
+	 * output PHDR, so the next output section - .init.text - should
+	 * start another segment - init.
 	 */
-	. = ALIGN(PAGE_SIZE);
-	.smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
-		__smp_locks = .;
-		*(.smp_locks)
-		__smp_locks_end = .;
-		. = ALIGN(PAGE_SIZE);
-	}
+	PERCPU_VADDR(0, :percpu)
+#endif
 
-	/* Init code and data - will be freed after init */
-	. = ALIGN(PAGE_SIZE);
 	.init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
-		__init_begin = .; /* paired with __init_end */
 		_sinittext = .;
 		INIT_TEXT
 		_einittext = .;
 	}
+#if defined(CONFIG_X86_64) && defined(CONFIG_SMP)
+	:init
+#endif
 
 	.init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
 		INIT_DATA
@@ -326,17 +297,7 @@ SECTIONS
 	}
 #endif
 
-#if defined(CONFIG_X86_64) && defined(CONFIG_SMP)
-	/*
-	 * percpu offsets are zero-based on SMP.  PERCPU_VADDR() changes the
-	 * output PHDR, so the next output section - __data_nosave - should
-	 * start another section data.init2.  Also, pda should be at the head of
-	 * percpu area.  Preallocate it and define the percpu offset symbol
-	 * so that it can be accessed as a percpu variable.
-	 */
-	. = ALIGN(PAGE_SIZE);
-	PERCPU_VADDR(0, :percpu)
-#else
+#if !defined(CONFIG_X86_64) || !defined(CONFIG_SMP)
 	PERCPU(PAGE_SIZE)
 #endif
 
@@ -347,15 +308,22 @@ SECTIONS
 		__init_end = .;
 	}
 
+	/*
+	 * smp_locks might be freed after init
+	 * start/end must be page aligned
+	 */
+	. = ALIGN(PAGE_SIZE);
+	.smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
+		__smp_locks = .;
+		*(.smp_locks)
+		__smp_locks_end = .;
+		. = ALIGN(PAGE_SIZE);
+	}
+
 #ifdef CONFIG_X86_64
 	.data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
-		. = ALIGN(PAGE_SIZE);
-		__nosave_begin = .;
-		*(.data.nosave)
-		. = ALIGN(PAGE_SIZE);
-		__nosave_end = .;
-	} :data.init2
-	/* use another section data.init2, see PERCPU_VADDR() above */
+		NOSAVE_DATA
+	}
 #endif
 
 	/* BSS */

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [tip:x86/urgent] x86: Fix build with older binutils and consolidate linker script
  2009-08-24 22:55 ` [tip:x86/urgent] x86: Fix " tip-bot for Jan Beulich
@ 2009-08-25  7:50   ` Ingo Molnar
  2009-08-25  8:01     ` Jan Beulich
  2009-08-25 13:53     ` Jan Beulich
  0 siblings, 2 replies; 16+ messages in thread
From: Ingo Molnar @ 2009-08-25  7:50 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, jbeulich, tglx; +Cc: linux-tip-commits


* tip-bot for Jan Beulich <JBeulich@novell.com> wrote:

> Commit-ID:  ddc98b38b6320d5de2e3167673a06ec1a48e9d0e
> Gitweb:     http://git.kernel.org/tip/ddc98b38b6320d5de2e3167673a06ec1a48e9d0e
> Author:     Jan Beulich <JBeulich@novell.com>
> AuthorDate: Tue, 18 Aug 2009 16:51:27 +0100
> Committer:  H. Peter Anvin <hpa@zytor.com>
> CommitDate: Mon, 24 Aug 2009 15:51:35 -0700
> 
> x86: Fix build with older binutils and consolidate linker script

this breaks the build with newer binutils:

  LD      .tmp_vmlinux1
ld: .tmp_vmlinux1: section `.init.text' can't be allocated in segment 2
LOAD: .vsyscall_0 .vsyscall_fn .vsyscall_gtod_data .vsyscall_1 
.vsyscall_2 .vgetcpu_mode .jiffies .init.text .init.data .init.setup 
.initcall.init .con_initcall.init .x86_cpu_dev.init 
.security_initcall.init .parainstructions .altinstructions 
.altinstr_replacement .exit.text .bss .brk
ld: final link failed: Bad value
make: *** [.tmp_vmlinux1] Error 1

	Ingo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [tip:x86/urgent] x86: Fix build with older binutils and consolidate linker script
  2009-08-25  7:50   ` Ingo Molnar
@ 2009-08-25  8:01     ` Jan Beulich
  2009-08-25  8:27       ` Ingo Molnar
  2009-08-25 13:53     ` Jan Beulich
  1 sibling, 1 reply; 16+ messages in thread
From: Jan Beulich @ 2009-08-25  8:01 UTC (permalink / raw)
  To: Ingo Molnar, tglx, mingo, hpa; +Cc: linux-kernel, linux-tip-commits

Was that using a UP config perhaps?

Jan

>>> Ingo Molnar <mingo@elte.hu> 25.08.09 09:50 >>>

* tip-bot for Jan Beulich <JBeulich@novell.com> wrote:

> Commit-ID:  ddc98b38b6320d5de2e3167673a06ec1a48e9d0e
> Gitweb:     http://git.kernel.org/tip/ddc98b38b6320d5de2e3167673a06ec1a48e9d0e 
> Author:     Jan Beulich <JBeulich@novell.com>
> AuthorDate: Tue, 18 Aug 2009 16:51:27 +0100
> Committer:  H. Peter Anvin <hpa@zytor.com>
> CommitDate: Mon, 24 Aug 2009 15:51:35 -0700
> 
> x86: Fix build with older binutils and consolidate linker script

this breaks the build with newer binutils:

  LD      .tmp_vmlinux1
ld: .tmp_vmlinux1: section `.init.text' can't be allocated in segment 2
LOAD: .vsyscall_0 .vsyscall_fn .vsyscall_gtod_data .vsyscall_1 
.vsyscall_2 .vgetcpu_mode .jiffies .init.text .init.data .init.setup 
.initcall.init .con_initcall.init .x86_cpu_dev.init 
.security_initcall.init .parainstructions .altinstructions 
.altinstr_replacement .exit.text .bss .brk
ld: final link failed: Bad value
make: *** [.tmp_vmlinux1] Error 1

	Ingo


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [tip:x86/urgent] x86: Fix build with older binutils and consolidate linker script
  2009-08-25  8:01     ` Jan Beulich
@ 2009-08-25  8:27       ` Ingo Molnar
  0 siblings, 0 replies; 16+ messages in thread
From: Ingo Molnar @ 2009-08-25  8:27 UTC (permalink / raw)
  To: Jan Beulich; +Cc: tglx, mingo, hpa, linux-kernel, linux-tip-commits


* Jan Beulich <JBeulich@novell.com> wrote:

> Was that using a UP config perhaps?

yeah - UP 64-bit.

	Ingo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [tip:x86/urgent] x86: Fix build with older binutils and consolidate linker script
  2009-08-25  7:50   ` Ingo Molnar
  2009-08-25  8:01     ` Jan Beulich
@ 2009-08-25 13:53     ` Jan Beulich
  2009-08-25 13:56       ` Ingo Molnar
  1 sibling, 1 reply; 16+ messages in thread
From: Jan Beulich @ 2009-08-25 13:53 UTC (permalink / raw)
  To: Ingo Molnar, tglx, mingo, hpa; +Cc: linux-kernel, linux-tip-commits

>>> Ingo Molnar <mingo@elte.hu> 25.08.09 09:50 >>>
>
>* tip-bot for Jan Beulich <JBeulich@novell.com> wrote:
>
>> Commit-ID:  ddc98b38b6320d5de2e3167673a06ec1a48e9d0e
>> Gitweb:     http://git.kernel.org/tip/ddc98b38b6320d5de2e3167673a06ec1a48e9d0e 
>> Author:     Jan Beulich <JBeulich@novell.com>
>> AuthorDate: Tue, 18 Aug 2009 16:51:27 +0100
>> Committer:  H. Peter Anvin <hpa@zytor.com>
>> CommitDate: Mon, 24 Aug 2009 15:51:35 -0700
>> 
>> x86: Fix build with older binutils and consolidate linker script
>
>this breaks the build with newer binutils:

With the updated patch just submitted I made sure UP and SMP builds
work as well as building with old and current binutils. Sorry for having
forgotten to do so before submitting the first time (I know I had
intended to).

Jan


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [tip:x86/urgent] x86: Fix build with older binutils and consolidate linker script
  2009-08-25 13:53     ` Jan Beulich
@ 2009-08-25 13:56       ` Ingo Molnar
  2009-08-25 14:01         ` [tip:x86/urgent] x86: Fix build with older binutils andconsolidate " Jan Beulich
  0 siblings, 1 reply; 16+ messages in thread
From: Ingo Molnar @ 2009-08-25 13:56 UTC (permalink / raw)
  To: Jan Beulich; +Cc: tglx, mingo, hpa, linux-kernel, linux-tip-commits


* Jan Beulich <JBeulich@novell.com> wrote:

> >>> Ingo Molnar <mingo@elte.hu> 25.08.09 09:50 >>>
> >
> >* tip-bot for Jan Beulich <JBeulich@novell.com> wrote:
> >
> >> Commit-ID:  ddc98b38b6320d5de2e3167673a06ec1a48e9d0e
> >> Gitweb:     http://git.kernel.org/tip/ddc98b38b6320d5de2e3167673a06ec1a48e9d0e 
> >> Author:     Jan Beulich <JBeulich@novell.com>
> >> AuthorDate: Tue, 18 Aug 2009 16:51:27 +0100
> >> Committer:  H. Peter Anvin <hpa@zytor.com>
> >> CommitDate: Mon, 24 Aug 2009 15:51:35 -0700
> >> 
> >> x86: Fix build with older binutils and consolidate linker script
> >
> >this breaks the build with newer binutils:
> 
> With the updated patch just submitted I made sure UP and SMP 
> builds work as well as building with old and current binutils. 

Thanks, applied.

> Sorry for having forgotten to do so before submitting the first 
> time (I know I had intended to).

This happens. I'm still unsure whether we can do it in .31.0 or need 
to delay it to .31.1 via a -stable backport tag. One more problem 
with it and i think we'll need to delay it - it's just too large and 
changes too many aspects of the linker script.

Would it be possible to split it into two pieces: 'minimal fix' and 
'clean up' portions?

	Ingo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [tip:x86/urgent] x86: Fix build with older binutils andconsolidate linker script
  2009-08-25 13:56       ` Ingo Molnar
@ 2009-08-25 14:01         ` Jan Beulich
  2009-08-25 14:14           ` Ingo Molnar
  0 siblings, 1 reply; 16+ messages in thread
From: Jan Beulich @ 2009-08-25 14:01 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: tglx, mingo, linux-kernel, linux-tip-commits, hpa

>>> Ingo Molnar <mingo@elte.hu> 25.08.09 15:56 >>>
>* Jan Beulich <JBeulich@novell.com> wrote:
>> Sorry for having forgotten to do so before submitting the first 
>> time (I know I had intended to).
>
>This happens. I'm still unsure whether we can do it in .31.0 or need 
>to delay it to .31.1 via a -stable backport tag. One more problem 
>with it and i think we'll need to delay it - it's just too large and 
>changes too many aspects of the linker script.
>
>Would it be possible to split it into two pieces: 'minimal fix' and 
>'clean up' portions?

Besides being cumbersome, that would make it even larger, so I'd say
that's not worth it.

Jan


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [tip:x86/urgent] x86: Fix build with older binutils andconsolidate linker script
  2009-08-25 14:01         ` [tip:x86/urgent] x86: Fix build with older binutils andconsolidate " Jan Beulich
@ 2009-08-25 14:14           ` Ingo Molnar
  2009-08-25 14:35             ` [tip:x86/urgent] x86: Fix build with older binutilsandconsolidate " Jan Beulich
  0 siblings, 1 reply; 16+ messages in thread
From: Ingo Molnar @ 2009-08-25 14:14 UTC (permalink / raw)
  To: Jan Beulich; +Cc: tglx, mingo, linux-kernel, linux-tip-commits, hpa


* Jan Beulich <JBeulich@novell.com> wrote:

> >>> Ingo Molnar <mingo@elte.hu> 25.08.09 15:56 >>>
> >* Jan Beulich <JBeulich@novell.com> wrote:
> >> Sorry for having forgotten to do so before submitting the first 
> >> time (I know I had intended to).
> >
> >This happens. I'm still unsure whether we can do it in .31.0 or need 
> >to delay it to .31.1 via a -stable backport tag. One more problem 
> >with it and i think we'll need to delay it - it's just too large and 
> >changes too many aspects of the linker script.
> >
> >Would it be possible to split it into two pieces: 'minimal fix' and 
> >'clean up' portions?
> 
> Besides being cumbersome, that would make it even larger, so I'd 
> say that's not worth it.

I mean the two patches yield the same end result. The first one 
(which is smaller, hopefully) gets committed to x86/urgent, the 
second one (the cleanups and other non-essentials) gets pushed 
upstream in .32.

	Ingo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [tip:x86/urgent] x86: Fix build with older binutilsandconsolidate linker script
  2009-08-25 14:14           ` Ingo Molnar
@ 2009-08-25 14:35             ` Jan Beulich
  2009-08-25 14:48               ` Ingo Molnar
  0 siblings, 1 reply; 16+ messages in thread
From: Jan Beulich @ 2009-08-25 14:35 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: tglx, mingo, linux-kernel, linux-tip-commits, hpa

>>> Ingo Molnar <mingo@elte.hu> 25.08.09 16:14 >>>
>
>* Jan Beulich <JBeulich@novell.com> wrote:
>
>> >>> Ingo Molnar <mingo@elte.hu> 25.08.09 15:56 >>>
>> >Would it be possible to split it into two pieces: 'minimal fix' and 
>> >'clean up' portions?
>> 
>> Besides being cumbersome, that would make it even larger, so I'd 
>> say that's not worth it.
>
>I mean the two patches yield the same end result. The first one 

I also understood it that way.

>(which is smaller, hopefully) gets committed to x86/urgent, the 
>second one (the cleanups and other non-essentials) gets pushed 
>upstream in .32.

The cleanup part really isn't much more than what I described with
"Once touching this code, also use the various data section helper
macros from include/asm-generic/vmlinux.lds.h.", and if the first
patch wouldn't use those macros, it would just grow and become
even less readable.

Jan


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [tip:x86/urgent] x86: Fix build with older binutilsandconsolidate linker script
  2009-08-25 14:35             ` [tip:x86/urgent] x86: Fix build with older binutilsandconsolidate " Jan Beulich
@ 2009-08-25 14:48               ` Ingo Molnar
  0 siblings, 0 replies; 16+ messages in thread
From: Ingo Molnar @ 2009-08-25 14:48 UTC (permalink / raw)
  To: Jan Beulich; +Cc: tglx, mingo, linux-kernel, linux-tip-commits, hpa


* Jan Beulich <JBeulich@novell.com> wrote:

> >>> Ingo Molnar <mingo@elte.hu> 25.08.09 16:14 >>>
> >
> >* Jan Beulich <JBeulich@novell.com> wrote:
> >
> >> >>> Ingo Molnar <mingo@elte.hu> 25.08.09 15:56 >>>
> >> >Would it be possible to split it into two pieces: 'minimal fix' and 
> >> >'clean up' portions?
> >> 
> >> Besides being cumbersome, that would make it even larger, so I'd 
> >> say that's not worth it.
> >
> >I mean the two patches yield the same end result. The first one 
> 
> I also understood it that way.
> 
> >(which is smaller, hopefully) gets committed to x86/urgent, the 
> >second one (the cleanups and other non-essentials) gets pushed 
> >upstream in .32.
> 
> The cleanup part really isn't much more than what I described with 
> "Once touching this code, also use the various data section helper 
> macros from include/asm-generic/vmlinux.lds.h.", and if the first 
> patch wouldn't use those macros, it would just grow and become 
> even less readable.

fair enough. Lets hope it all goes fine.

	Ingo

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2009-08-25 14:48 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-18 15:51 [PATCH] x86: fix build with older binutils and consolidate linker script Jan Beulich
2009-08-21 20:23 ` H. Peter Anvin
2009-08-24  6:55   ` Jan Beulich
2009-08-24  7:13     ` H. Peter Anvin
2009-08-24  7:21       ` Jan Beulich
2009-08-24 16:09         ` H. Peter Anvin
2009-08-24 22:55 ` [tip:x86/urgent] x86: Fix " tip-bot for Jan Beulich
2009-08-25  7:50   ` Ingo Molnar
2009-08-25  8:01     ` Jan Beulich
2009-08-25  8:27       ` Ingo Molnar
2009-08-25 13:53     ` Jan Beulich
2009-08-25 13:56       ` Ingo Molnar
2009-08-25 14:01         ` [tip:x86/urgent] x86: Fix build with older binutils andconsolidate " Jan Beulich
2009-08-25 14:14           ` Ingo Molnar
2009-08-25 14:35             ` [tip:x86/urgent] x86: Fix build with older binutilsandconsolidate " Jan Beulich
2009-08-25 14:48               ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox