public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86_64: Some vmlinux.lds.S cleanups
@ 2006-10-24 21:01 Vivek Goyal
  2006-10-26  7:08 ` Jan Beulich
  0 siblings, 1 reply; 5+ messages in thread
From: Vivek Goyal @ 2006-10-24 21:01 UTC (permalink / raw)
  To: linux kernel mailing list; +Cc: Andi Kleen, Jan Beulich, Ian Campbell



o Some cleanups based on Jan Beulich's suggestions. It boots on my box. Hope
  does not break anything else.

o Renamed program header name data.init to init. "init" is now supposed
  to contain init text/data.

o Moved sections ".data.init_task" and ".data.page_aligned" into program
  header "data" as they don't fit logically into "init".

o Got rid of "R" permission for "note" phdr as only boot loaer is supposed
  to look at note phdr.

o Got rid of "E" permission for "data" phdr.  

Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com>
---

 arch/x86_64/kernel/vmlinux.lds.S |   32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff -puN arch/x86_64/kernel/vmlinux.lds.S~x86_64-vmlinux-lds-S-cleanup arch/x86_64/kernel/vmlinux.lds.S
--- linux-2.6.19-rc3/arch/x86_64/kernel/vmlinux.lds.S~x86_64-vmlinux-lds-S-cleanup	2006-10-24 15:58:23.000000000 -0400
+++ linux-2.6.19-rc3-root/arch/x86_64/kernel/vmlinux.lds.S	2006-10-24 16:35:56.000000000 -0400
@@ -15,10 +15,10 @@ ENTRY(phys_startup_64)
 jiffies_64 = jiffies;
 PHDRS {
 	text PT_LOAD FLAGS(5);	/* R_E */
-	data PT_LOAD FLAGS(7);	/* RWE */
+	data PT_LOAD FLAGS(6);	/* RW_ */
 	user PT_LOAD FLAGS(7);	/* RWE */
-	data.init PT_LOAD FLAGS(7);	/* RWE */
-	note PT_NOTE FLAGS(4);	/* R__ */
+	init PT_LOAD FLAGS(7);	/* RWE */
+	note PT_NOTE FLAGS(0);	/* None */
 }
 SECTIONS
 {
@@ -78,9 +78,19 @@ SECTIONS
   	*(.data.read_mostly)
   }
 
+  . = ALIGN(8192);		/* init_task */
+  .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
+	*(.data.init_task)
+  }
+
+  . = ALIGN(4096);
+  .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
+	*(.data.page_aligned)
+  }
+
 #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.page_aligned) + SIZEOF(.data.page_aligned) + 4095) & ~(4095))
+#define VSYSCALL_VIRT_ADDR ((ADDR(.data.page_aligned) + SIZEOF(.data.page_aligned) + 4095) & ~(4095))
 
 #define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
 #define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
@@ -129,23 +139,13 @@ SECTIONS
 #undef VVIRT_OFFSET
 #undef VVIRT
 
-  . = ALIGN(8192);		/* init_task */
-  .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
-	*(.data.init_task)
-  }:data.init
-
-  . = ALIGN(4096);
-  .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
-	*(.data.page_aligned)
-  }
-
   /* might get freed after init */
   . = ALIGN(4096);
   __smp_alt_begin = .;
   __smp_alt_instructions = .;
   .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) {
 	*(.smp_altinstructions)
-  }
+  }:init
   __smp_alt_instructions_end = .;
   . = ALIGN(8);
   __smp_locks = .;
_

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

* Re: [PATCH] x86_64: Some vmlinux.lds.S cleanups
  2006-10-24 21:01 [PATCH] x86_64: Some vmlinux.lds.S cleanups Vivek Goyal
@ 2006-10-26  7:08 ` Jan Beulich
  2006-10-26 13:44   ` Vivek Goyal
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2006-10-26  7:08 UTC (permalink / raw)
  To: vgoyal, linux kernel mailing list; +Cc: Andi Kleen, Ian Campbell

I was about to ack it when I saw that you left .bss in init - that doesn't seem
too good an idea... Jan

>>> Vivek Goyal <vgoyal@in.ibm.com> 24.10.06 23:01 >>>


o Some cleanups based on Jan Beulich's suggestions. It boots on my box. Hope
  does not break anything else.

o Renamed program header name data.init to init. "init" is now supposed
  to contain init text/data.

o Moved sections ".data.init_task" and ".data.page_aligned" into program
  header "data" as they don't fit logically into "init".

o Got rid of "R" permission for "note" phdr as only boot loaer is supposed
  to look at note phdr.

o Got rid of "E" permission for "data" phdr.  

Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com>
---

 arch/x86_64/kernel/vmlinux.lds.S |   32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff -puN arch/x86_64/kernel/vmlinux.lds.S~x86_64-vmlinux-lds-S-cleanup arch/x86_64/kernel/vmlinux.lds.S
--- linux-2.6.19-rc3/arch/x86_64/kernel/vmlinux.lds.S~x86_64-vmlinux-lds-S-cleanup	2006-10-24 15:58:23.000000000
-0400
+++ linux-2.6.19-rc3-root/arch/x86_64/kernel/vmlinux.lds.S	2006-10-24 16:35:56.000000000 -0400
@@ -15,10 +15,10 @@ ENTRY(phys_startup_64)
 jiffies_64 = jiffies;
 PHDRS {
 	text PT_LOAD FLAGS(5);	/* R_E */
-	data PT_LOAD FLAGS(7);	/* RWE */
+	data PT_LOAD FLAGS(6);	/* RW_ */
 	user PT_LOAD FLAGS(7);	/* RWE */
-	data.init PT_LOAD FLAGS(7);	/* RWE */
-	note PT_NOTE FLAGS(4);	/* R__ */
+	init PT_LOAD FLAGS(7);	/* RWE */
+	note PT_NOTE FLAGS(0);	/* None */
 }
 SECTIONS
 {
@@ -78,9 +78,19 @@ SECTIONS
   	*(.data.read_mostly)
   }
 
+  . = ALIGN(8192);		/* init_task */
+  .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
+	*(.data.init_task)
+  }
+
+  . = ALIGN(4096);
+  .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
+	*(.data.page_aligned)
+  }
+
 #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.page_aligned) + SIZEOF(.data.page_aligned) + 4095) & ~(4095))
+#define VSYSCALL_VIRT_ADDR ((ADDR(.data.page_aligned) + SIZEOF(.data.page_aligned) + 4095) & ~(4095))
 
 #define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
 #define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
@@ -129,23 +139,13 @@ SECTIONS
 #undef VVIRT_OFFSET
 #undef VVIRT
 
-  . = ALIGN(8192);		/* init_task */
-  .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
-	*(.data.init_task)
-  }:data.init
-
-  . = ALIGN(4096);
-  .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
-	*(.data.page_aligned)
-  }
-
   /* might get freed after init */
   . = ALIGN(4096);
   __smp_alt_begin = .;
   __smp_alt_instructions = .;
   .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) {
 	*(.smp_altinstructions)
-  }
+  }:init
   __smp_alt_instructions_end = .;
   . = ALIGN(8);
   __smp_locks = .;
_

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

* Re: [PATCH] x86_64: Some vmlinux.lds.S cleanups
  2006-10-26  7:08 ` Jan Beulich
@ 2006-10-26 13:44   ` Vivek Goyal
  2006-10-26 13:52     ` Jan Beulich
  0 siblings, 1 reply; 5+ messages in thread
From: Vivek Goyal @ 2006-10-26 13:44 UTC (permalink / raw)
  To: Jan Beulich; +Cc: linux kernel mailing list, Andi Kleen, Ian Campbell

On Thu, Oct 26, 2006 at 08:08:21AM +0100, Jan Beulich wrote:
> I was about to ack it when I saw that you left .bss in init - that doesn't seem
> too good an idea... Jan
> 

Should I create a separate program header say "bss" for .bss section? Last
time when I suggested it you said there is no need to create a separate
program header for bss.

More program headers we create, we need to make sure that they are on page
size boundaries so that kexec on vmlinux does not break.

Thanks
Vivek

> >>> Vivek Goyal <vgoyal@in.ibm.com> 24.10.06 23:01 >>>
> 
> 
> o Some cleanups based on Jan Beulich's suggestions. It boots on my box. Hope
>   does not break anything else.
> 
> o Renamed program header name data.init to init. "init" is now supposed
>   to contain init text/data.
> 
> o Moved sections ".data.init_task" and ".data.page_aligned" into program
>   header "data" as they don't fit logically into "init".
> 
> o Got rid of "R" permission for "note" phdr as only boot loaer is supposed
>   to look at note phdr.
> 
> o Got rid of "E" permission for "data" phdr.  
> 
> Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com>
> ---
> 
>  arch/x86_64/kernel/vmlinux.lds.S |   32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff -puN arch/x86_64/kernel/vmlinux.lds.S~x86_64-vmlinux-lds-S-cleanup arch/x86_64/kernel/vmlinux.lds.S
> --- linux-2.6.19-rc3/arch/x86_64/kernel/vmlinux.lds.S~x86_64-vmlinux-lds-S-cleanup	2006-10-24 15:58:23.000000000
> -0400
> +++ linux-2.6.19-rc3-root/arch/x86_64/kernel/vmlinux.lds.S	2006-10-24 16:35:56.000000000 -0400
> @@ -15,10 +15,10 @@ ENTRY(phys_startup_64)
>  jiffies_64 = jiffies;
>  PHDRS {
>  	text PT_LOAD FLAGS(5);	/* R_E */
> -	data PT_LOAD FLAGS(7);	/* RWE */
> +	data PT_LOAD FLAGS(6);	/* RW_ */
>  	user PT_LOAD FLAGS(7);	/* RWE */
> -	data.init PT_LOAD FLAGS(7);	/* RWE */
> -	note PT_NOTE FLAGS(4);	/* R__ */
> +	init PT_LOAD FLAGS(7);	/* RWE */
> +	note PT_NOTE FLAGS(0);	/* None */
>  }
>  SECTIONS
>  {
> @@ -78,9 +78,19 @@ SECTIONS
>    	*(.data.read_mostly)
>    }
>  
> +  . = ALIGN(8192);		/* init_task */
> +  .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
> +	*(.data.init_task)
> +  }
> +
> +  . = ALIGN(4096);
> +  .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
> +	*(.data.page_aligned)
> +  }
> +
>  #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.page_aligned) + SIZEOF(.data.page_aligned) + 4095) & ~(4095))
> +#define VSYSCALL_VIRT_ADDR ((ADDR(.data.page_aligned) + SIZEOF(.data.page_aligned) + 4095) & ~(4095))
>  
>  #define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
>  #define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
> @@ -129,23 +139,13 @@ SECTIONS
>  #undef VVIRT_OFFSET
>  #undef VVIRT
>  
> -  . = ALIGN(8192);		/* init_task */
> -  .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
> -	*(.data.init_task)
> -  }:data.init
> -
> -  . = ALIGN(4096);
> -  .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
> -	*(.data.page_aligned)
> -  }
> -
>    /* might get freed after init */
>    . = ALIGN(4096);
>    __smp_alt_begin = .;
>    __smp_alt_instructions = .;
>    .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) {
>  	*(.smp_altinstructions)
> -  }
> +  }:init
>    __smp_alt_instructions_end = .;
>    . = ALIGN(8);
>    __smp_locks = .;
> _

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

* Re: [PATCH] x86_64: Some vmlinux.lds.S cleanups
  2006-10-26 13:44   ` Vivek Goyal
@ 2006-10-26 13:52     ` Jan Beulich
  2006-10-26 15:12       ` Vivek Goyal
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2006-10-26 13:52 UTC (permalink / raw)
  To: vgoyal; +Cc: Andi Kleen, linux kernel mailing list, Ian Campbell

>>> Vivek Goyal <vgoyal@in.ibm.com> 26.10.06 15:44 >>>
>On Thu, Oct 26, 2006 at 08:08:21AM +0100, Jan Beulich wrote:
>> I was about to ack it when I saw that you left .bss in init - that doesn't seem
>> too good an idea... Jan
>> 
>
>Should I create a separate program header say "bss" for .bss section? Last
>time when I suggested it you said there is no need to create a separate
>program header for bss.

No, I continue to think .bss naturally belongs at the end of the data segment.

>More program headers we create, we need to make sure that they are on page
>size boundaries so that kexec on vmlinux does not break.

Jan

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

* Re: [PATCH] x86_64: Some vmlinux.lds.S cleanups
  2006-10-26 13:52     ` Jan Beulich
@ 2006-10-26 15:12       ` Vivek Goyal
  0 siblings, 0 replies; 5+ messages in thread
From: Vivek Goyal @ 2006-10-26 15:12 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Andi Kleen, linux kernel mailing list, Ian Campbell

On Thu, Oct 26, 2006 at 03:52:47PM +0200, Jan Beulich wrote:
> >>> Vivek Goyal <vgoyal@in.ibm.com> 26.10.06 15:44 >>>
> >On Thu, Oct 26, 2006 at 08:08:21AM +0100, Jan Beulich wrote:
> >> I was about to ack it when I saw that you left .bss in init - that doesn't seem
> >> too good an idea... Jan
> >> 
> >
> >Should I create a separate program header say "bss" for .bss section? Last
> >time when I suggested it you said there is no need to create a separate
> >program header for bss.
> 
> No, I continue to think .bss naturally belongs at the end of the data segment.
> 

Only disadvantage of this is that .bss becomes part of the compressed data
and size of vmlinux.bin and bzImage increases.

OTOH, all the sections being mapped in segment "user" are also effectively
data only. isn't it? So .bss coming after that would make sense.

Thanks
Vivek

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

end of thread, other threads:[~2006-10-26 15:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-24 21:01 [PATCH] x86_64: Some vmlinux.lds.S cleanups Vivek Goyal
2006-10-26  7:08 ` Jan Beulich
2006-10-26 13:44   ` Vivek Goyal
2006-10-26 13:52     ` Jan Beulich
2006-10-26 15:12       ` Vivek Goyal

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