qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hollis Blanchard <hollisb@us.ibm.com>
To: ehrhardt@linux.vnet.ibm.com
Cc: avi@qumranet.com, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org,
	qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 2/3] kvm-userspace: kvmppc: fix hostlonbits detection when cross compiling v2
Date: Tue, 30 Sep 2008 09:13:59 -0500	[thread overview]
Message-ID: <1222784039.4796.18.camel@localhost.localdomain> (raw)
In-Reply-To: <1222765817-26552-1-git-send-email-ehrhardt@linux.vnet.ibm.com>

On Tue, 2008-09-30 at 11:10 +0200, ehrhardt@linux.vnet.ibm.com wrote:
> diff --git a/qemu/configure b/qemu/configure
> --- a/qemu/configure
> +++ b/qemu/configure
> @@ -685,14 +685,15 @@
>  # ppc specific hostlongbits selection
>  if test "$cpu" = "powerpc" ; then
>      cat > $TMPC <<EOF
> -int main(void){return sizeof(long);}
> +#include <bits/wordsize.h>
> +__WORDSIZE
>  EOF
> 
> -    if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null; then
> -        $TMPE
> -        case $? in
> -            4) hostlongbits="32";;
> -            8) hostlongbits="64";;
> +    if $cc $ARCH_CFLAGS $CFLAGS -E -o $TMPE.E $TMPC 2> /dev/null; then
> +        wordsize=`tail -n 1 ${TMPE}.E`
> +        case $wordsize in
> +            32) hostlongbits="32";;
> +            64) hostlongbits="64";;
>              *) echo "Couldn't determine bits per long value"; exit 1;;
>          esac
>      else

Yeah, trying to execute target-specific code is simply incompatible with
cross-compiling, so clearly this needs to be changed.

<bits/wordsize.h> might be too Linux-specific, not sure. Also, I worry
about the preprocessor being allowed to insert all the whitespace it
wants, so I'm not sure if you can assume that __WORDSIZE will be on the
last output line.

Instead you could use this:
	$cc -E -dM - < /dev/null | grep __powerpc64__

-- 
Hollis Blanchard
IBM Linux Technology Center

  reply	other threads:[~2008-09-30 14:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-30  9:10 [Qemu-devel] [PATCH 2/3] kvm-userspace: kvmppc: fix hostlonbits detection when cross compiling v2 ehrhardt
2008-09-30 14:13 ` Hollis Blanchard [this message]
2008-09-30 19:38 ` malc
2008-10-01 12:26   ` Christian Ehrhardt
2008-09-30 21:19 ` malc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1222784039.4796.18.camel@localhost.localdomain \
    --to=hollisb@us.ibm.com \
    --cc=avi@qumranet.com \
    --cc=ehrhardt@linux.vnet.ibm.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).