Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jun 2012 20:15:27 -0400
From:      Brandon Falk <bfalk_bsd@brandonfa.lk>
To:        Juergen Lock <nox@jelal.kn-bremen.de>
Cc:        freebsd-emulation@freebsd.org
Subject:   Re: Building QEMU with clang
Message-ID:  <CAGSJxJ6K2SuGFeZ8PFx=KSKSi7AKcmUaeEo17gA3kA_-ZRJp=A@mail.gmail.com>
In-Reply-To: <201206121811.q5CIBugV088678@triton8.kn-bremen.de>
References:  <4FD67192.2010001@brandonfa.lk> <201206121811.q5CIBugV088678@triton8.kn-bremen.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Worked great! Ill play with it when I get home.
On Jun 12, 2012 2:13 PM, "Juergen Lock" <nox@jelal.kn-bremen.de> wrote:

> In article <4FD67192.2010001@brandonfa.lk> you write:
> >Greetings,
> Hi!
> >
> >I could go on a rant, but I'll keep it short and sweet. I'm wondering if
> >there are any efforts to get QEMU building with clang. I know this
> >should go on the QEMU mailing lists, but I wanted to post it here as
> >well as I'd be using FreeBSD as the host.
> >
> >When working with qemu-devel (with --enable-tcg-interpreter), I get:
> >
> >multiboot.S:31:8: error: .code16 not supported yet
> >
> >multiboot.S:123:17: error: unexpected token in argument list
> >  data32 lgdt %gs:6
> >                 ^
> >multiboot.S:131:15: error: unknown token in expression
> >  data32 ljmp *%gs:0
> >
> >Now, code16 is a pretty big deal, and that's obviously a feature that
> >clang needs to add. However what is it with the complaints of the other
> >two (I'm an Intel syntax guy, not AT&T :P)?
> >
>  I don't know about those but I do know clang can be told to call (g)as
> instead of using its internal assembler by passing -no-integrated-as.
>
> >Semi-sidenote:
> >Since clang does not support global registers, --enable-tcg-interpreter
> >has to be specified to ./configure. This should be added to the port as
> >an option.
>
>  Heh I didn't know about --enable-tcg-interpreter...  The following
> patch makes the port build, but the result is much slower than with
> gcc. (and without --enable-tcg-interpreter.)  And also halt -p in a
> FreeBSD guest causes qemu-system-x86_64 to fail with a tcg error.
>
>  I'm not sure it makes much sense to commit this nevertheless...?
>
> Index: Makefile
> ===================================================================
> RCS file: /home/pcvs/ports/emulators/qemu-devel/Makefile,v
> retrieving revision 1.140
> diff -u -p -r1.140 Makefile
> --- Makefile    9 Jun 2012 16:19:05 -0000       1.140
> +++ Makefile    12 Jun 2012 17:57:16 -0000
> @@ -48,11 +48,19 @@ ADD_AUDIO_DESC=             "Emulate more audio har
>  ALL_TARGETS_DESC=      "Also build bsd-user targets (for testing)"
>  OPTIONS_DEFAULT=SDL OPENGL GNUTLS SASL JPEG PNG CURL CDROM_DMA PCAP
>
> -.include <bsd.port.options.mk>
> +.include <bsd.port.pre.mk>
>
>  CONFIGURE_ARGS+=       --extra-ldflags=-L${LOCALBASE}/lib
>  PORTDOCS=      docs qemu-doc.html qemu-tech.html
>
> +# XXX this fixes build with clang but --enable-tcg-interpreter that's
> +# needed to avoid global register usage that clang doesn't support
> +# causes the result to be slow.
> +.if ${CC:T:Mclang} == "clang"
> +CONFIGURE_ARGS+=       --enable-tcg-interpreter
> +CLANG_CFLAGS_AS+=      -no-integrated-as
> +.endif
> +
>  .if empty(PORT_OPTIONS:MALL_TARGETS)
>  CONFIGURE_ARGS+=       --disable-bsd-user
>  PLIST_SUB+=    ALLTARGETS="@comment "
> @@ -191,6 +199,9 @@ post-patch:
>                -e "s|^(LDFLAGS=).*|\1${LDFLAGS}|" \
>                ${WRKSRC}/Makefile
>        @${REINPLACE_CMD} -E \
> +               -e "s|^(CFLAGS[         ]*:=.*)|\1 ${CLANG_CFLAGS_AS}|" \
> +               ${WRKSRC}/pc-bios/optionrom/Makefile
> +       @${REINPLACE_CMD} -E \
>                -e "1s|^(#! )/usr/bin/perl|\1${PERL}|" \
>                ${WRKSRC}/scripts/texi2pod.pl
>
> @@ -217,4 +228,4 @@ post-install:
>        fi
>        @${CAT} ${PKGMESSAGE}
>
> -.include <bsd.port.mk>
> +.include <bsd.port.post.mk>
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGSJxJ6K2SuGFeZ8PFx=KSKSi7AKcmUaeEo17gA3kA_-ZRJp=A>