[Reinhard Tartler]
> It got built now on i386 and amd64. It stills FTBFS for ppc, but this
> seems to be an issue with binutils:

[Octavian Cerna]
> For PPC you can try the following patch, already applied to Qemu CVS:
> http://lists.gnu.org/archive/html/qemu-devel/2005-06/msg00004.html

[Sebastian Dröge]
> The patch to the ppc linker script doesn't work for me on my ibook with
> binutils 2.16,etc on breezy. I get the same error as without the patch
 [...]
> /usr/bin/ld: qemu-i386: Not enough room for program headers (allocated
> 8, need 9 )
> /usr/bin/ld: final link failed: Bad value

[Roger Leigh]
> It also fails on Debian/powerpc:
 [...]
> /usr/bin/ld: qemu-i386: Not enough room for program headers (allocated 8, 
> need 9)
> /usr/bin/ld: final link failed: Bad value

Thank you for reporting the build failures on PowerPC.

It seems that the patch from qemu-devel is not enough to fix the
problem.

Attached is the second version of my patch, against qemu_0.7.0-2:

 * debian/control (Build-Depends): add missing zlib1g-dev,
   depend on gcc-3.4, depend on binutils-2.16 for the updated
   ppc linker script
 * debian/rules: compile with gcc-3.4
 * debian/patches/02_fix_librt_linkage.patch: link with librt
   for clock_gettime (Reinhard Tartler)
 * debian/patches/34_syscalls_types.patch: new, fix compile error
   with linux-kernel-headers 2.6.12 (it's a hack:
   include linux/types.h before any other glibc header)
 * debian/patches/41_ppc_ldscript.patch: new, update the ppc linker
   script from /usr/lib/ldscripts/elf32ppclinux.x in binutils-2.16

With this patch I was able to build and run qemu on an uptodate Debian
sid emulated by qemu-system-ppc.

Octavian
diff -urN qemu-0.7.0-orig/debian/control qemu-0.7.0/debian/control
--- qemu-0.7.0-orig/debian/control      2005-07-23 01:13:01.488124413 +0300
+++ qemu-0.7.0/debian/control   2005-07-24 22:58:45.240500629 +0300
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Debian QEMU Team <[EMAIL PROTECTED]>
 Uploaders: Guilherme de S. Pastore <[EMAIL PROTECTED]>, Guillem Jover <[EMAIL 
PROTECTED]>, Elrond <[EMAIL PROTECTED]>
-Build-Depends: cdbs, debhelper (>= 4.1.0), libx11-dev | xlibs-dev, 
libsdl1.2-dev (>> 1.2.1), texi2html, sharutils, libgpmg1-dev [amd64 i386 
powerpc alpha sparc arm s390]
+Build-Depends: cdbs, debhelper (>= 4.1.0), gcc-3.4, binutils (>= 2.16), 
libx11-dev | xlibs-dev, libsdl1.2-dev (>> 1.2.1), zlib1g-dev, texi2html, 
sharutils, libgpmg1-dev [amd64 i386 powerpc alpha sparc arm s390]
 Standards-Version: 3.6.1.1
 
 Package: qemu
diff -urN qemu-0.7.0-orig/debian/patches/02_fix_librt_linkage.patch 
qemu-0.7.0/debian/patches/02_fix_librt_linkage.patch
--- qemu-0.7.0-orig/debian/patches/02_fix_librt_linkage.patch   1970-01-01 
02:00:00.000000000 +0200
+++ qemu-0.7.0/debian/patches/02_fix_librt_linkage.patch        2005-07-24 
21:55:41.816348746 +0300
@@ -0,0 +1,12 @@
+#DPATCHLEVEL=1
+--- qemu-0.7.0.orig/Makefile.target    2005-04-27 20:52:05.000000000 +0000
++++ qemu-0.7.0/Makefile.target 2005-07-23 11:07:19.449003328 +0000
+@@ -212,7 +212,7 @@
+ #########################################################
+ 
+ DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+-LIBS+=-lm
++LIBS+=-lm -lrt
+ ifndef CONFIG_USER_ONLY
+ LIBS+=-lz
+ endif
diff -urN qemu-0.7.0-orig/debian/patches/34_syscalls_types.patch 
qemu-0.7.0/debian/patches/34_syscalls_types.patch
--- qemu-0.7.0-orig/debian/patches/34_syscalls_types.patch      1970-01-01 
02:00:00.000000000 +0200
+++ qemu-0.7.0/debian/patches/34_syscalls_types.patch   2005-07-24 
21:55:41.817348539 +0300
@@ -0,0 +1,11 @@
+#DPATCHLEVEL=0
+--- linux-user/syscall.c.orig  2005-07-23 01:55:22.169404147 +0300
++++ linux-user/syscall.c       2005-07-23 01:52:31.157924629 +0300
+@@ -17,6 +17,7 @@
+  *  along with this program; if not, write to the Free Software
+  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+  */
++#include <linux/types.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <stdarg.h>
diff -urN qemu-0.7.0-orig/debian/patches/41_ppc_ldscript.patch 
qemu-0.7.0/debian/patches/41_ppc_ldscript.patch
--- qemu-0.7.0-orig/debian/patches/41_ppc_ldscript.patch        1970-01-01 
02:00:00.000000000 +0200
+++ qemu-0.7.0/debian/patches/41_ppc_ldscript.patch     2005-07-24 
21:55:41.817348539 +0300
@@ -0,0 +1,286 @@
+#DPATCHLEVEL=0
+--- ppc.ld.old 2005-07-24 01:10:38.705795341 +0300
++++ ppc.ld     2005-07-24 01:01:45.000000000 +0300
+@@ -1,106 +1,190 @@
+-/* ld script to make i386 Linux kernel
+- * Written by Martin Mares <[EMAIL PROTECTED]>;
+- */
+-OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
+-OUTPUT_ARCH(powerpc)
+-SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); 
SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib);
++/* Default linker script, for normal executables */
++OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc",
++            "elf32-powerpc")
++OUTPUT_ARCH(powerpc:common)
+ ENTRY(_start)
++SEARCH_DIR("/usr/powerpc-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); 
SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
++/* Do we need any of these for elf?
++   __DYNAMIC = 0;    */
+ SECTIONS
+ {
+   /* Read-only sections, merged into text segment: */
+-  . = 0x60000000 + SIZEOF_HEADERS;
+-  .interp     : { *(.interp)  }
+-  .hash          : { *(.hash)         }
+-  .dynsym        : { *(.dynsym)               }
+-  .dynstr        : { *(.dynstr)               }
+-  .gnu.version   : { *(.gnu.version)  }
+-  .gnu.version_d   : { *(.gnu.version_d)      }
+-  .gnu.version_r   : { *(.gnu.version_r)      }
+-  .rel.text      :
+-    { *(.rel.text) *(.rel.gnu.linkonce.t*) }
+-  .rela.text     :
+-    { *(.rela.text) *(.rela.gnu.linkonce.t*) }
+-  .rel.data      :
+-    { *(.rel.data) *(.rel.gnu.linkonce.d*) }
+-  .rela.data     :
+-    { *(.rela.data) *(.rela.gnu.linkonce.d*) }
+-  .rel.rodata    :
+-    { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
+-  .rela.rodata   :
+-    { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
+-  .rel.got       : { *(.rel.got)              }
+-  .rela.got      : { *(.rela.got)             }
+-  .rel.ctors     : { *(.rel.ctors)    }
+-  .rela.ctors    : { *(.rela.ctors)   }
+-  .rel.dtors     : { *(.rel.dtors)    }
+-  .rela.dtors    : { *(.rela.dtors)   }
+-  .rel.init      : { *(.rel.init)     }
+-  .rela.init     : { *(.rela.init)    }
+-  .rel.fini      : { *(.rel.fini)     }
+-  .rela.fini     : { *(.rela.fini)    }
+-  .rel.bss       : { *(.rel.bss)              }
+-  .rela.bss      : { *(.rela.bss)             }
+-  .rel.plt       : { *(.rel.plt)              }
+-  .rela.plt      : { *(.rela.plt)             }
+-  .init          : { *(.init) } =0x47ff041f
+-  .text      :
++  PROVIDE (__executable_start = 0x60000000); . = 0x60000000 + SIZEOF_HEADERS;
++  .interp         : { *(.interp) }
++  .hash           : { *(.hash) }
++  .dynsym         : { *(.dynsym) }
++  .dynstr         : { *(.dynstr) }
++  .gnu.version    : { *(.gnu.version) }
++  .gnu.version_d  : { *(.gnu.version_d) }
++  .gnu.version_r  : { *(.gnu.version_r) }
++  .rel.init       : { *(.rel.init) }
++  .rela.init      : { *(.rela.init) }
++  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
++  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
++  .rel.fini       : { *(.rel.fini) }
++  .rela.fini      : { *(.rela.fini) }
++  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
++  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
++  .rel.data.rel.ro   : { *(.rel.data.rel.ro*) }
++  .rela.data.rel.ro   : { *(.rel.data.rel.ro*) }
++  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
++  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
++  .rel.tdata    : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
++  .rela.tdata   : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
++  .rel.tbss     : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
++  .rela.tbss    : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
++  .rel.ctors      : { *(.rel.ctors) }
++  .rela.ctors     : { *(.rela.ctors) }
++  .rel.dtors      : { *(.rel.dtors) }
++  .rela.dtors     : { *(.rela.dtors) }
++  .rel.got        : { *(.rel.got) }
++  .rela.got       : { *(.rela.got) }
++  .rela.got1           : { *(.rela.got1) }
++  .rela.got2           : { *(.rela.got2) }
++  .rel.sdata      : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
++  .rela.sdata     : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
++  .rel.sbss       : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
++  .rela.sbss      : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
++  .rel.sdata2     : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
++  .rela.sdata2    : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
++  .rel.sbss2      : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
++  .rela.sbss2     : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
++  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
++  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
++  .rel.plt        : { *(.rel.plt) }
++  .rela.plt       : { *(.rela.plt) }
++  .init           :
+   {
+-    *(.text)
++    KEEP (*(.init))
++  } =0
++  .text           :
++  {
++    *(.text .stub .text.* .gnu.linkonce.t.*)
++    KEEP (*(.text.*personality*))
+     /* .gnu.warning sections are handled specially by elf32.em.  */
+     *(.gnu.warning)
+-    *(.gnu.linkonce.t*)
+-  } =0x47ff041f
+-  _etext = .;
++  } =0
++  .fini           :
++  {
++    KEEP (*(.fini))
++  } =0
++  PROVIDE (__etext = .);
++  PROVIDE (_etext = .);
+   PROVIDE (etext = .);
+-  .fini      : { *(.fini)    } =0x47ff041f
+-  .rodata    : { *(.rodata) *(.gnu.linkonce.r*) }
+-  .rodata1   : { *(.rodata1) }
+-  .reginfo : { *(.reginfo) }
++  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
++  .rodata1        : { *(.rodata1) }
++  .sdata2         : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) }
++  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
++  .eh_frame_hdr : { *(.eh_frame_hdr) }
++  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
++  .gcc_except_table   : ONLY_IF_RO { KEEP (*(.gcc_except_table)) 
*(.gcc_except_table.*) }
+   /* Adjust the address for the data segment.  We want to adjust up to
+      the same address within the page on the next page up.  */
+-  . = ALIGN(0x100000) + (. & (0x100000 - 1));
+-  .data    :
++  . = ALIGN (0x10000) - ((0x10000 - .) & (0x10000 - 1)); . = 
DATA_SEGMENT_ALIGN (0x10000, 0x1000);
++  /* Exception handling  */
++  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
++  .gcc_except_table   : ONLY_IF_RW { KEEP (*(.gcc_except_table)) 
*(.gcc_except_table.*) }
++  /* Thread Local Storage sections  */
++  .tdata        : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
++  .tbss                 : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
++  /* Ensure the __preinit_array_start label is properly aligned.  We
++     could instead move the label definition inside the section, but
++     the linker would then create the section even if it turns out to
++     be empty, which isn't pretty.  */
++  . = ALIGN(32 / 8);
++  PROVIDE (__preinit_array_start = .);
++  .preinit_array     : { KEEP (*(.preinit_array)) }
++  PROVIDE (__preinit_array_end = .);
++  PROVIDE (__init_array_start = .);
++  .init_array     : { KEEP (*(.init_array)) }
++  PROVIDE (__init_array_end = .);
++  PROVIDE (__fini_array_start = .);
++  .fini_array     : { KEEP (*(.fini_array)) }
++  PROVIDE (__fini_array_end = .);
++  .ctors          :
+   {
+-    *(.data)
+-    *(.gnu.linkonce.d*)
+-    CONSTRUCTORS
++    /* gcc uses crtbegin.o to find the start of
++       the constructors, so we make sure it is
++       first.  Because this is a wildcard, it
++       doesn't matter if the user does not
++       actually link against crtbegin.o; the
++       linker won't look for a file to match a
++       wildcard.  The wildcard also means that it
++       doesn't matter which directory crtbegin.o
++       is in.  */
++    KEEP (*crtbegin*.o(.ctors))
++    /* We don't want to include the .ctor section from
++       from the crtend.o file until after the sorted ctors.
++       The .ctor section from the crtend file contains the
++       end of ctors marker and it must be last */
++    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
++    KEEP (*(SORT(.ctors.*)))
++    KEEP (*(.ctors))
+   }
+-  .data1   : { *(.data1) }
+-  .ctors         :
++  .dtors          :
+   {
+-    *(.ctors)
++    KEEP (*crtbegin*.o(.dtors))
++    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
++    KEEP (*(SORT(.dtors.*)))
++    KEEP (*(.dtors))
+   }
+-  .dtors         :
++  .jcr            : { KEEP (*(.jcr)) }
++  .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) }
++  .got1           : { *(.got1) }
++  .got2           : { *(.got2) }
++  .dynamic        : { *(.dynamic) }
++  . = DATA_SEGMENT_RELRO_END (0, .);
++  .data           :
+   {
+-    *(.dtors)
++    *(.data .data.* .gnu.linkonce.d.*)
++    KEEP (*(.gnu.linkonce.d.*personality*))
++    SORT(CONSTRUCTORS)
+   }
+-  .plt      : { *(.plt)       }
+-  .got           : { *(.got.plt) *(.got) }
+-  .dynamic       : { *(.dynamic) }
++  .data1          : { *(.data1) }
++  .got            : { *(.got.plt) *(.got) }
+   /* We want the small data sections together, so single-instruction offsets
+      can access them all, and initialized data all before uninitialized, so
+      we can shorten the on-disk segment size.  */
+-  .sdata     : { *(.sdata) }
+-  _edata  =  .;
++  .sdata          :
++  {
++    *(.sdata .sdata.* .gnu.linkonce.s.*)
++  }
++  _edata = .;
+   PROVIDE (edata = .);
+   __bss_start = .;
+-  .sbss      : { *(.sbss) *(.scommon) }
+-  .bss       :
++  .sbss           :
++  {
++    PROVIDE (__sbss_start = .);
++    PROVIDE (___sbss_start = .);
++    *(.dynsbss)
++    *(.sbss .sbss.* .gnu.linkonce.sb.*)
++    *(.scommon)
++    PROVIDE (__sbss_end = .);
++    PROVIDE (___sbss_end = .);
++  }
++  .plt            : { *(.plt) }
++  .bss            :
+   {
+    *(.dynbss)
+-   *(.bss)
++   *(.bss .bss.* .gnu.linkonce.b.*)
+    *(COMMON)
++   /* Align here to ensure that the .bss section occupies space up to
++      _end.  Align after .bss to ensure correct alignment even if the
++      .bss section disappears because there are no input sections.  */
++   . = ALIGN(32 / 8);
+   }
+-  _end = . ;
++  . = ALIGN(32 / 8);
++  _end = .;
+   PROVIDE (end = .);
++  . = DATA_SEGMENT_END (.);
+   /* Stabs debugging sections.  */
+-  .stab 0 : { *(.stab) }
+-  .stabstr 0 : { *(.stabstr) }
+-  .stab.excl 0 : { *(.stab.excl) }
+-  .stab.exclstr 0 : { *(.stab.exclstr) }
+-  .stab.index 0 : { *(.stab.index) }
++  .stab          0 : { *(.stab) }
++  .stabstr       0 : { *(.stabstr) }
++  .stab.excl     0 : { *(.stab.excl) }
++  .stab.exclstr  0 : { *(.stab.exclstr) }
++  .stab.index    0 : { *(.stab.index) }
+   .stab.indexstr 0 : { *(.stab.indexstr) }
+-  .comment 0 : { *(.comment) }
++  .comment       0 : { *(.comment) }
+   /* DWARF debug sections.
+      Symbols in the DWARF debugging sections are relative to the beginning
+      of the section so we begin them at 0.  */
+@@ -114,7 +198,7 @@
+   .debug_aranges  0 : { *(.debug_aranges) }
+   .debug_pubnames 0 : { *(.debug_pubnames) }
+   /* DWARF 2 */
+-  .debug_info     0 : { *(.debug_info) }
++  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
+   .debug_abbrev   0 : { *(.debug_abbrev) }
+   .debug_line     0 : { *(.debug_line) }
+   .debug_frame    0 : { *(.debug_frame) }
+@@ -126,5 +210,6 @@
+   .debug_funcnames 0 : { *(.debug_funcnames) }
+   .debug_typenames 0 : { *(.debug_typenames) }
+   .debug_varnames  0 : { *(.debug_varnames) }
+-  /* These must appear regardless of  .  */
++  /DISCARD/   : { *(.fixup) }
++  /DISCARD/ : { *(.note.GNU-stack) }
+ }
diff -urN qemu-0.7.0-orig/debian/rules qemu-0.7.0/debian/rules
--- qemu-0.7.0-orig/debian/rules        2005-07-23 01:13:01.493123375 +0300
+++ qemu-0.7.0/debian/rules     2005-07-24 21:56:01.740210397 +0300
@@ -12,7 +12,7 @@
        ppc_rom.bin \
        proll.elf
 
-DEB_CONFIGURE_NORMAL_ARGS := --prefix=$(DEB_CONFIGURE_PREFIX) --enable-slirp
+DEB_CONFIGURE_NORMAL_ARGS := --prefix=$(DEB_CONFIGURE_PREFIX) --cc=gcc-3.4 
--enable-slirp
 
 DEB_MAKE_INSTALL_TARGET := install prefix=$(DEB_DESTDIR)/usr \
                                   bindir=$(DEB_DESTDIR)/usr/bin \

Reply via email to