From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KkbFz-0002zY-M0 for qemu-devel@nongnu.org; Tue, 30 Sep 2008 05:10:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KkbFu-0002xC-Hg for qemu-devel@nongnu.org; Tue, 30 Sep 2008 05:10:57 -0400 Received: from [199.232.76.173] (port=60680 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KkbFu-0002x6-6G for qemu-devel@nongnu.org; Tue, 30 Sep 2008 05:10:54 -0400 Received: from mtagate2.de.ibm.com ([195.212.17.162]:52068) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KkbFu-0000eS-3O for qemu-devel@nongnu.org; Tue, 30 Sep 2008 05:10:54 -0400 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate2.de.ibm.com (8.13.1/8.13.1) with ESMTP id m8U9Ajeh002087 for ; Tue, 30 Sep 2008 09:10:48 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id m8U9AhIm2392228 for ; Tue, 30 Sep 2008 11:10:45 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m8U9AHCL008202 for ; Tue, 30 Sep 2008 11:10:18 +0200 From: ehrhardt@linux.vnet.ibm.com Date: Tue, 30 Sep 2008 11:10:17 +0200 Message-Id: <1222765817-26552-1-git-send-email-ehrhardt@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 2/3] kvm-userspace: kvmppc: fix hostlonbits detection when cross compiling v2 Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, avi@qumranet.com, qemu-devel@nongnu.org Cc: ehrhardt@linux.vnet.ibm.com, hollisb@us.ibm.com From: Christian Ehrhardt *update* further debugging according to some requests revealed that ARCH_CFLAGS does not contain all CFLAGS that might be needed, especially those supplied via extra-cflags. Therefore people supplying things via extra-cflags instead of an environment variable might have had issues. A recent kvm merge with qemu brought code for 64bit power that broke cross compilation. The issue is caused by configure trying to execute target architecture binaries where configure is executed. I tried to change that detection so that it works with&without cross compilation with only a small change and especially without an addtional configure command line switch. Including the bits/wordsize.h header a platform usually can check its wordsize and by doing that configure can check the hostlongbits without executing the binary. Instead it now stops after preprocessing stage which resolved the __WORDSIZE constant and retrieves that value. I don't like my new check style, but it is at least less broken than before. Another approach that was suggested was that qemu might end up needing something like asm-offsets in the kernel to manage architecture sizes etc. Comments and other approaches welcome. Signed-off-by: Christian Ehrhardt --- [diffstat] configure | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) [diff] 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 < +__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