From mboxrd@z Thu Jan 1 00:00:00 1970 From: ehrhardt@linux.vnet.ibm.com Date: Tue, 30 Sep 2008 09:10:17 +0000 Subject: [PATCH 2/3] kvm-userspace: kvmppc: fix hostlonbits detection when cross compiling v2 Message-Id: <1222765817-26552-1-git-send-email-ehrhardt@linux.vnet.ibm.com> List-Id: References: <1221554914-29751-3-git-send-email-ehrhardt@linux.vnet.ibm.com> In-Reply-To: <1221554914-29751-3-git-send-email-ehrhardt@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org, qemu-devel-qX2TKyscuCcdnm+yROfE0A@public.gmane.org Cc: hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org, ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org Subject: [PATCH 2/3] kvm-userspace: kvmppc: fix hostlonbits detection when cross compiling v2 Date: Tue, 30 Sep 2008 11:10:17 +0200 Message-ID: <1222765817-26552-1-git-send-email-ehrhardt@linux.vnet.ibm.com> Cc: hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org, ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org To: kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org, qemu-devel-qX2TKyscuCcdnm+yROfE0A@public.gmane.org Return-path: Sender: kvm-ppc-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: kvm.vger.kernel.org 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 -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html