[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Some OpenBSD/amd64 build fixes
From: |
Juergen Lock |
Subject: |
Re: [Qemu-devel] Some OpenBSD/amd64 build fixes |
Date: |
Wed, 23 Sep 2009 22:55:02 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Wed, Sep 23, 2009 at 09:31:16PM +0100, Laurence Tratt wrote:
> 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.
>
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 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",
You mean --disable-bsd-user?
> 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.
>
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 @@
CFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
CFLAGS += -I$(SRC_PATH)
-CFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector,"")
+CFLAGS := $(CFLAGS) $(call cc-option, $(CFLAGS), -fno-stack-protector,"")
build-all: multiboot.bin
+%.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)$@")
HTH,
Juergen