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

On Tue, Aug 15, 2006 at 07:46:53PM +0200, Segher Boessenkool wrote:

> That's how it's done, looks good.  I haven't checked the details
> though, look at the resulting image with readelf to check if
> everything is exactly as you want it to be ;-)

From: Tony Breeds <tony@xxxxxxxxxxxxxxxxxx>

This patch explicitly creates 3 program headers and maps the sections
into these sections.  Also adds section to PHDR mappings for .init.data
and __builtin_cmdline.

This avoids the:
        "Not enough room for program +headers (allocated 2, need 3)"
error when NR_CPUS becomes largish.

This has been booted on a JS20.

Signed-off-by: Tony Breeds <tony@xxxxxxxxxxxxxxxxxx>

---
diffstat:
 xen.lds.S |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

readelf -l xen/xen-syms:
Elf file type is EXEC (Executable file)
Entry point 0x400100
There are 3 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000000000 0x0000000000400000 0x0000000000400000
                 0x0000000000069788 0x0000000000069788  RWE    80
  LOAD           0x0000000000069800 0x0000000000469800 0x0000000000469800
                 0x0000000000253310 0x0000000000253310  RW     80
  LOAD           0x00000000002bcb80 0x00000000006c8000 0x00000000006c8000
                 0x000000000000a2e8 0x000000000001dc60  RW     80

 Section to Segment mapping:
  Segment Sections...
   00     .text .init.text .rodata __ex_table .init.data __builtin_cmdline 
   01     .data .setup.init .initcall.init .inithcall.text 
   02     .opd .got .bss 

---
diff -r 41827ce2cceb xen/arch/powerpc/xen.lds.S
--- a/xen/arch/powerpc/xen.lds.S        Mon Aug 14 19:22:16 2006 -0500
+++ b/xen/arch/powerpc/xen.lds.S        Wed Aug 16 11:36:03 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) }
@@ -101,11 +107,13 @@ SECTIONS
   PROVIDE (__fini_array_start = .);
   .fini_array     : { *(.fini_array) }
   PROVIDE (__fini_array_end = .);
+  .init.data : { *(.init.data) }
+  __builtin_cmdline : { *(__builtin_cmdline) }
   .data           :
   {
     *(.data .data.* .gnu.linkonce.d.*)
     SORT(CONSTRUCTORS)
-  }
+  } :data
 
   /* Xen addition */
 
@@ -121,7 +129,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 +137,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)) }

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