WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

Re: [XenPPC] PHDR link failure testcase

To: Amos Waterland <apw@xxxxxxxxxx>
Subject: Re: [XenPPC] PHDR link failure testcase
From: Tony Breeds <tony@xxxxxxxxxxxxxxxxxx>
Date: Tue, 15 Aug 2006 16:41:14 +1000
Cc: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>, xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 14 Aug 2006 23:41:33 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20060814231737.GA24108@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20060814231737.GA24108@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.9i
On Mon, Aug 14, 2006 at 07:17:37PM -0400, Amos Waterland wrote:
> Using a `powerpc64-linux-gcc (GCC) 4.1.1 ()' x86->ppc toolchain, if I do this:
> 
> diff -r 9563f5c9ab19 xen/include/asm-powerpc/config.h

<snip>
 
> /usr/powerpc64/lib/gcc/powerpc64-linux/4.1.1/../../../../powerpc64-linux/bin/ld:
> /home/apw/devel/xen/xen.hg/xen/xen-syms: Not enough room for program
> headers (allocated 2, need 3)

I believe the root cause for this is the fact that the .data.percpu
section is becoming large.  As it's empty the linker decides to start a
3rd segment rather than waste disk space.  Initially the linker guessed
it would need 2 segments, but due to this decision it actually uses 3,
causeing the abort.

Aparently the newer (read current CVS) tools don't abort here but do
the right thing.

I have 2 solutions to this problem.

1) Explicitly add 3 segmnets in the linker script and manually map
   sections to segments.
2) Use the linker script to manually place a bogus data element in the
   .data.percpu section, which results in the linker doign the right
   thing.

I'm not in a position to judge which is better over the longer term but
"option 2" is a gross hack.

Option 1; Looks like:
------
diff -r 9563f5c9ab19 xen/arch/powerpc/xen.lds.S
--- a/xen/arch/powerpc/xen.lds.S        Mon Aug 14 15:22:22 2006 -0500
+++ b/xen/arch/powerpc/xen.lds.S        Tue Aug 15 16:28:59 2006 +1000
@@ -10,11 +10,17 @@ SEARCH_DIR("=/usr/local/lib64"); SEARCH_
 SEARCH_DIR("=/usr/local/lib64"); SEARCH_DIR("=/lib64"); SEARCH_DIR("=/usr/lib64
"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
 /* Do we need any of these for elf?
    __DYNAMIC = 0;    */
+PHDRS
+{
+  text  PT_LOAD FILEHDR PHDRS;
+  data  PT_LOAD;
+  extra PT_LOAD;
+}
 SECTIONS
 {
   /* Read-only sections, merged into text segment: */
   PROVIDE (__executable_start = 0x10000000); . = 0x10000000 + SIZEOF_HEADERS;
-  .interp         : { *(.interp) }
+  .interp         : { *(.interp) } :text
   .hash           : { *(.hash) }
   .dynsym         : { *(.dynsym) }
   .dynstr         : { *(.dynstr) }
@@ -105,13 +111,13 @@ SECTIONS
   {
     *(.data .data.* .gnu.linkonce.d.*)
     SORT(CONSTRUCTORS)
-  }
+  } :data
 
   /* Xen addition */
 
   . = ALIGN(32);
   __setup_start = .;
-  .setup.init : { *(.setup.init) }
+  .setup.init : { *(.setup.init) } :text
   __setup_end = .;
   __initcall_start = .;
   .initcall.init : { *(.initcall.init) }
@@ -121,7 +127,7 @@ SECTIONS
   __inithcall_end = .;
 
   __per_cpu_start = .;
-  .data.percpu : { *(.data.percpu) } :text
+  .data.percpu : { *(.data.percpu) }
   __per_cpu_data_end = .;
   . = __per_cpu_start + (NR_CPUS << PERCPU_SHIFT);
   . = ALIGN(STACK_SIZE);
@@ -129,7 +135,7 @@ SECTIONS
 
   /* end Xen addition */
 
-  .data1          : { *(.data1) }
+  .data1          : { *(.data1) } :extra
   .tdata         : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
   .tbss                  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
   .eh_frame       : { KEEP (*(.eh_frame)) }
------

Option 2; Looks like:
------
diff -r 9563f5c9ab19 xen/arch/powerpc/xen.lds.S
--- a/xen/arch/powerpc/xen.lds.S        Mon Aug 14 15:22:22 2006 -0500
+++ b/xen/arch/powerpc/xen.lds.S        Tue Aug 15 16:34:27 2006 +1000
@@ -121,11 +121,12 @@ SECTIONS
   __inithcall_end = .;
 
   __per_cpu_start = .;
-  .data.percpu : { *(.data.percpu) } :text
+  .data.percpu : { *(.data.percpu)
   __per_cpu_data_end = .;
-  . = __per_cpu_start + (NR_CPUS << PERCPU_SHIFT);
+  . = __per_cpu_start + (NR_CPUS << PERCPU_SHIFT) - 4;
+  LONG(0);
   . = ALIGN(STACK_SIZE);
-  __per_cpu_end = .;
+  __per_cpu_end = .; }
 
   /* end Xen addition */
 
------

Both have been compiled and boot on the JS20 here.  Neither of these 2 patches
is suggested for inclusion ATM.  I wanted some feedback on which seems
better.

Yours Tony

   linux.conf.au       http://linux.conf.au/ || http://lca2007.linux.org.au/
   Jan 15-20 2007      The Australian Linux Technical Conference!


_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel