From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MqYV6-0005kN-8T for qemu-devel@nongnu.org; Wed, 23 Sep 2009 16:31:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MqYV1-0005dZ-HM for qemu-devel@nongnu.org; Wed, 23 Sep 2009 16:31:43 -0400 Received: from [199.232.76.173] (port=39244 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MqYV1-0005dL-BZ for qemu-devel@nongnu.org; Wed, 23 Sep 2009 16:31:39 -0400 Received: from purcell.dcs.kcl.ac.uk ([137.73.8.80]:27869 helo=echo.tratt.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MqYV0-0006L4-Qr for qemu-devel@nongnu.org; Wed, 23 Sep 2009 16:31:39 -0400 Date: Wed, 23 Sep 2009 21:31:16 +0100 From: Laurence Tratt Message-ID: <20090923203116.GF4859@overdrive.home.tratt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Some OpenBSD/amd64 build fixes List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Dear all, I've been trying to get the qemu in git to build on OpenBSD/amd64. It's n= ot there yet, but I have made some progress. The first problem encountered i= s that x86_64.ld fails: =A0$ gmake =A0 =A0LINK =A0i386-bsd-user/qemu-i386 =A0/usr/bin/ld:/tmp/qemu/x86_64.ld:61: syntax error =A0collect2: ld returned 1 exit status =A0gmake[1]: *** [qemu-i386] Error 1 =A0gmake: *** [subdir-i386-bsd-user] Error 2 =A0$ 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 blauwirbel@gmail.com for t= he 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 m= isused, please use strlcpy() main.o(.text+0x5fc): In function `main': /home/ltratt/qemu/bsd-user/main.c:911: undefined reference to `guest_ba= se' main.o(.text+0x740):/home/ltratt/qemu/bsd-user/main.c:941: undefined re= ference to `guest_base' bsdload.o(.text+0x31): In function `memcpy_to_target': /home/ltratt/qemu/bsd-user/qemu.h:331: undefined reference to `guest_ba= se' bsdload.o(.text+0x230): In function `loader_build_argptr': /home/ltratt/qemu/bsd-user/qemu.h:331: undefined reference to `guest_ba= se' 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 unde= fined 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 --=20 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. */ . =3D ALIGN (0x100000) - ((0x100000 - .) & (0x100000 - 1)); . =3D 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=3D0 =20 # find out the file size -x=3D`dd if=3D"$1" bs=3D1 count=3D1 skip=3D2 2>/dev/null | od -t u1 -A n` +tmp=3D`mktemp` +dd if=3D"$1" bs=3D1 count=3D1 skip=3D2 2>/dev/null > $tmp +x=3D`od -v -t u1 $tmp | head -n 1 | cut -d " " -f 2- | sed "s/ //g" | se= d "s/^0*//g"` +rm $tmp #size=3D`expr $x \* 512 - 1` size=3D$(( $x * 512 - 1 )) =20 # now get the checksum -nums=3D`od -A n -t u1 -v "$1"` +num_lines=3D`od -v -t u1 "$1" | wc -l` +nums=3D`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=3D`expr $sum + $i` diff --git a/x86_64.ld b/x86_64.ld index 24ea77d..aeb0bce 100644