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 Wed, Aug 16, 2006 at 10:23:08PM -0400, Jimi Xenidis wrote:

> Not really its not like we protect any of it :) and the section  
> separation still exits
> after-all we all (kernels/xen) link with -N/--omagic, which does not  
> page align the data sections which has always implied a single PHDR.   
> Besides, the more I do this the less I trust FW and bootloaders so a  
> single segment is just cleaner.

OK

> >   /* Read-only sections, merged into text segment: */
> >   PROVIDE (__executable_start = 0x10000000); . = 0x10000000 +  
> >SIZEOF_HEADERS;
> Actually the above line should just be:
>    PROVIDE (__executable_start = .);
> 
> We always specific the link address on the command line and not that  
> we define PHDRS there is no need for SIZEOF_HEADERS (as the linker  
> docs indicate)

Okay.  I'll have a look at that.  It'd be a clenup tho. as it's not
required to fix this problem.

Also if I understand correctly the SEARCH_DIR()s aren't needed as we're not
linking to anything in those dirs.

Perhaps a seperate clenaup is worthwhile.

Anyone else with cleanups for xen.lds.S ?
 
> I'm pretty sure the rest of the changes are unnecessary.

No, they required.  See below.

> >-  .interp         : { *(.interp) }
> >+  .interp         : { *(.interp) } :text

Without adding this then the sections just disapper.  

---
$ readelf -l xen-syms 

Elf file type is EXEC (Executable file)
Entry point 0x400100
There are 1 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000078 0x0000000000000078  R      8

 Section to Segment mapping:
  Segment Sections...
   00
---

> >-  .data.percpu : { *(.data.percpu) } :text
> >+  .data.percpu : { *(.data.percpu) }

Sure this is optional, It doens't do any harm but it also doesn't do any good.
Cleaning it out seems liek the right thing to me.

Patch below.

From: Tony Breeds <tony@xxxxxxxxxxxxxxxxxx>

This patch tells the link to only create one PHDR and place all sections
in it, also removing an unrequired mapping for the .data.percpu section.

This avoids the "Not enough room for program headers (allocated 2, need 3)"

Booted on a JS20.

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

---
Diffstat:
 xen.lds.S |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Readelf:
Elf file type is EXEC (Executable file)
Entry point 0x400100
There are 1 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000000000 0x0000000000400080 0x0000000000400080
                 0x00000000002d2268 0x00000000002e5be0  RWE    80

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

---
diff -r 279843441136 xen/arch/powerpc/xen.lds.S
--- a/xen/arch/powerpc/xen.lds.S        Wed Aug 16 17:19:38 2006 -0500
+++ b/xen/arch/powerpc/xen.lds.S        Thu Aug 17 11:30:50 2006 +1000
@@ -10,11 +10,15 @@ 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;
+}
 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) }
@@ -121,7 +125,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);



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