Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MqZ2h-0003n1-Fw for qemu-devel@nongnu.org; Wed, 23 Sep 2009 17:06:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MqZ2g-0003mp-Oz for qemu-devel@nongnu.org; Wed, 23 Sep 2009 17:06:26 -0400 Received: from [199.232.76.173] (port=34731 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MqZ2g-0003mm-LL for qemu-devel@nongnu.org; Wed, 23 Sep 2009 17:06:26 -0400 Received: from gelbbaer.kn-bremen.de ([78.46.108.116]:40050 helo=smtp.kn-bremen.de) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MqZ2f-00045T-VR for qemu-devel@nongnu.org; Wed, 23 Sep 2009 17:06:26 -0400 From: Juergen Lock Date: Wed, 23 Sep 2009 22:55:02 +0200 Subject: Re: [Qemu-devel] Some OpenBSD/amd64 build fixes Message-ID: <20090923205502.GA4540@triton8.kn-bremen.de> References: <20090923203116.GF4859@overdrive.home.tratt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20090923203116.GF4859@overdrive.home.tratt.net> Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurence Tratt Cc: qemu-devel@nongnu.org On Wed, Sep 23, 2009 at 09:31:16PM +0100, Laurence Tratt wrote: > Dear all, >=20 > 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: >=20 > =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$ >=20 > 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= the > hint]. I don't honestly know the precise semantic effect ONLY_IF_RO has= , but > I'm assuming it's not critical. >=20 Yup, I've had this on FreeBSD as well (and came up with practically the same workaround.) > Another problem I've patched is with signrom.sh which uses the -A optio= n > 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 o= n > other platforms (it works OK under Linux, at least). >=20 >=20 > Unfortunately there are still a couple of places that I'm stuck. Any he= lp > would be much appreciated, and I can provide an OpenBSD/amd64 account f= or > anyone who's interested in playing further. >=20 > First, if I do a plain "./configure", the build dies as follows: >=20 > ... > 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: undefin= ed reference to `guest_base' > bsdload.o(.text+0x2a1):/home/ltratt/qemu/bsd-user/qemu.h:331: more un= defined references to `guest_base' follow > collect2: ld returned 1 exit status > gmake[1]: *** [qemu-i386] Error 1 > gmake: *** [subdir-i386-bsd-user] Error 2 > $ >=20 > I haven't yet investigated this in depth. If I do "./configure > -disable-guest", You mean --disable-bsd-user? > then the above error doesn't occur, but > pc-bios/optionrom/multiboot.S dies as follows: >=20 > $ > AS optionrom/multiboot.o > multiboot.S: Assembler messages: > multiboot.S:116: Error: `%es:-4(%edi)' is not a valid 16 bit base/ind= ex > expression > $ >=20 > 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. >=20 It occurs because of too old binutils (as(1) in this case), on FreeBSD we now have a port for newer ones, http://www.freshports.org/devel/binutils so I depend on that and have the optionrom Makefile use the new as like this: (the first change wrt CFLAGS is unrelated and has probably been fixed in the meantime; it caused gmake to complain about recursive use of CFLAGS.) Index: qemu/pc-bios/optionrom/Makefile @@ -9,10 +9,13 @@ =20 CFLAGS =3D -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-b= uiltin CFLAGS +=3D -I$(SRC_PATH) -CFLAGS +=3D $(call cc-option, $(CFLAGS), -fno-stack-protector,"") +CFLAGS :=3D $(CFLAGS) $(call cc-option, $(CFLAGS), -fno-stack-protector,= "") =20 build-all: multiboot.bin =20 +%.o: %.S + $(CC) -E $(CFLAGS) -o - -c $< |${LOCALBASE}/bin/as -V -Qy -o $@ + %.img: %.o $(call quiet-command,$(LD) -Ttext 0 -e _start -s -o $@ $<," Building $= (TARGET_DIR)$@") =20 HTH, Juergen