qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Some OpenBSD/amd64 build fixes


From: Laurence Tratt
Subject: [Qemu-devel] Some OpenBSD/amd64 build fixes
Date: Wed, 23 Sep 2009 21:31:16 +0100
User-agent: mutt

Dear all,

I've been trying to get the qemu in git to build on OpenBSD/amd64. It's not
there yet, but I have made some progress. The first problem encountered is
that x86_64.ld fails:

  $ gmake
    LINK  i386-bsd-user/qemu-i386
  /usr/bin/ld:/tmp/qemu/x86_64.ld:61: syntax error
  collect2: ld returned 1 exit status
  gmake[1]: *** [qemu-i386] Error 1
  gmake: *** [subdir-i386-bsd-user] Error 2
  $

One of the patches at the end of this e-mail fixes that by removing the
ONLY_IF_RO parts that make it choke [thanks to address@hidden for the
hint]. I don't honestly know the precise semantic effect ONLY_IF_RO has, but
I'm assuming it's not critical.

Another problem I've patched is with signrom.sh which uses the -A option
which isn't found in OpenBSD's od. I've hacked around that (inelegantly, I
admit) in a way which I think should still preserve correct operation on
other platforms (it works OK under Linux, at least).


Unfortunately there are still a couple of places that I'm stuck. Any help
would be much appreciated, and I can provide an OpenBSD/amd64 account for
anyone who's interested in playing further.

First, if I do a plain "./configure", the build dies as follows:

  ...
    AR    i386-bsd-user/libqemu.a
    LINK  i386-bsd-user/qemu-i386
  libqemu.a(i386-dis.o)(.text+0x19af): In function `oappend':
  /home/ltratt/qemu/i386-dis.c:4656: warning: strcpy() is almost always 
misused, please use strlcpy()
  main.o(.text+0x5fc): In function `main':
  /home/ltratt/qemu/bsd-user/main.c:911: undefined reference to `guest_base'
  main.o(.text+0x740):/home/ltratt/qemu/bsd-user/main.c:941: undefined 
reference to `guest_base'
  bsdload.o(.text+0x31): In function `memcpy_to_target':
  /home/ltratt/qemu/bsd-user/qemu.h:331: undefined reference to `guest_base'
  bsdload.o(.text+0x230): In function `loader_build_argptr':
  /home/ltratt/qemu/bsd-user/qemu.h:331: undefined reference to `guest_base'
  bsdload.o(.text+0x262):/home/ltratt/qemu/bsd-user/qemu.h:331: undefined 
reference to `guest_base'
  bsdload.o(.text+0x2a1):/home/ltratt/qemu/bsd-user/qemu.h:331: more undefined 
references to `guest_base' follow
  collect2: ld returned 1 exit status
  gmake[1]: *** [qemu-i386] Error 1
  gmake: *** [subdir-i386-bsd-user] Error 2
  $

I haven't yet investigated this in depth. If I do "./configure
-disable-guest", then the above error doesn't occur, but
pc-bios/optionrom/multiboot.S dies as follows:

  $
    AS    optionrom/multiboot.o
  multiboot.S: Assembler messages:
  multiboot.S:116: Error: `%es:-4(%edi)' is not a valid 16 bit base/index
expression
  $

What little Intel assembler I ever knew has long since departed from my
brain, so I don't know why that error occurs, nor what a fix might be.


Laurie
-- 
http://tratt.net/laurie/ -- Personal
http://fetegeo.org/      -- Free text geocoding
http://convergepl.org/   -- The Converge programming language
http://www.model-transformation.org/ICMT2010/ -- ICMT 2010


diff --git a/x86_64.ld b/x86_64.ld
index 24ea77d..aeb0bce 100644
--- a/x86_64.ld
+++ b/x86_64.ld
@@ -58,8 +58,8 @@ SECTIONS
   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
   .rodata1        : { *(.rodata1) }
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
-  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table) }
+  .eh_frame       : { KEEP (*(.eh_frame)) }
+  .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 - .) & (0x100000 - 1)); . = 
DATA_SEGMENT_ALIGN (0x100000, 0x1000);
@@ -85,8 +85,8 @@ SECTIONS
   .data1          : { *(.data1) }
   .tdata         : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
   .tbss                  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
-  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
-  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table) }
+  .eh_frame       : { KEEP (*(.eh_frame)) }
+  .gcc_except_table   : { *(.gcc_except_table) }
   .dynamic        : { *(.dynamic) }
   .ctors          :
   {
--- a/pc-bios/optionrom/signrom.sh
+++ b/pc-bios/optionrom/signrom.sh
@@ -26,12 +26,16 @@ test "$1" -a "$2" || exit 1
 sum=0
 
 # find out the file size
-x=`dd if="$1" bs=1 count=1 skip=2 2>/dev/null | od -t u1 -A n`
+tmp=`mktemp`
+dd if="$1" bs=1 count=1 skip=2 2>/dev/null > $tmp
+x=`od -v -t u1 $tmp | head -n 1 | cut -d " " -f 2- | sed "s/ //g" | sed 
"s/^0*//g"`
+rm $tmp
 #size=`expr $x \* 512 - 1`
 size=$(( $x * 512 - 1 ))
 
 # now get the checksum
-nums=`od -A n -t u1 -v "$1"`
+num_lines=`od -v -t u1 "$1" | wc -l`
+nums=`od -v -t u1 "$1" | head -n $(( num_lines - 1 ))  | cut -d " " -f 2-`
 for i in ${nums}; do
     # add each byte's value to sum
     sum=`expr $sum + $i`
diff --git a/x86_64.ld b/x86_64.ld
index 24ea77d..aeb0bce 100644




reply via email to

[Prev in Thread] Current Thread [Next in Thread]