configure: Fix make check-tcg for ppc64le
cover configure: Fix make check-tcg for ppc64le
At present make check-tcg will produce errors like
RUN tests for ppc64
TEST test-mmap (default) on ppc64
test-mmap: Invalid ELF image for this architecture make[2]: *** [run-test-mmap] Error 255 make[1]: *** [run-guest-tests] Error 2
make: *** [run-tcg-tests-ppc64-linux-user] Error 2
which is caused by the use of the host ppc64le compiler in building guest ppc64(be) executables.
r~
Richard Henderson (2):
configure: Distinguish ppc64 and ppc64le hosts
configure: Use quotes around uses of $CPU_CFLAGS
configure | 54 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 20 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/2 configure: Distinguish ppc64 and ppc64le hosts
We cannot use the ppc64le host compiler to build ppc64(be) guest code. Clean up confusion between cross_cc_powerpc and cross_cc_ppc; make use of the cflags variable as well.
--- configure | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-)
configure +26 -12
@@ -198,7 +198,7 @@ supported_kvm_target() { i386:i386 | i386:x86_64 | i386:x32 | \ x86_64:i386 | x86_64:x86_64 | x86_64:x32 | \ mips:mips | mipsel:mips | \ - ppc:ppc | ppc64:ppc | ppc:ppc64 | ppc64:ppc64 | \ + ppc:ppc | ppc64:ppc | ppc:ppc64 | ppc64:ppc64 | ppc64:ppc64le | \ s390x:s390x) return 0 ;;
@@ -502,8 +502,11 @@ cross_cc_arm="arm-linux-gnueabihf-gcc" cross_cc_cflags_armeb="-mbig-endian" cross_cc_i386="i386-pc-linux-gnu-gcc" cross_cc_cflags_i386="" -cross_cc_powerpc="powerpc-linux-gnu-gcc" -cross_cc_powerpc="powerpc-linux-gnu-gcc" +cross_cc_ppc="powerpc-linux-gnu-gcc" +cross_cc_cflags_ppc="-m32" +cross_cc_ppc64="powerpc-linux-gnu-gcc" +cross_cc_cflags_ppc64="-m64" +cross_cc_ppc64le="powerpc64le-linux-gnu-gcc" enabled_cross_compilers=""
@@ -700,7 +703,11 @@ elif check_define __sparc__ ; then fi elif check_define _ARCH_PPC ; then if check_define _ARCH_PPC64 ; then - cpu="ppc64" + if check_define _LITTLE_ENDIAN ; then + cpu="ppc64le" + else + cpu="ppc64" + fi else cpu="ppc" fi
@@ -731,10 +738,14 @@ ARCH= # Note that this case should only have supported host CPUs, not guests. case "$cpu" in ppc|ppc64|s390|s390x|sparc64|x32|riscv32|riscv64) - cpu="$cpu" supported_cpu="yes" eval "cross_cc_${cpu}=\$host_cc" ;; + ppc64le) + ARCH="ppc64" + supported_cpu="yes" + cross_cc_ppc64le=$host_cc + ;; i386|i486|i586|i686|i86pc|BePC) cpu="i386" supported_cpu="yes"
@@ -1525,8 +1536,8 @@ case "$cpu" in ppc) CPU_CFLAGS="-m32" LDFLAGS="-m32 $LDFLAGS" - cross_cc_powerpc=$cc - cross_cc_cflags_powerpc=$CPU_CFLAGS + cross_cc_ppc=$cc + cross_cc_cflags_ppc="$CPU_CFLAGS" ;; ppc64) CPU_CFLAGS="-m64"
@@ -2379,7 +2390,7 @@ if test "$seccomp" != "no" ; then arm|aarch64) libseccomp_minver="2.2.3" ;; - ppc|ppc64|s390x) + ppc|ppc64|ppc64le|s390x) libseccomp_minver="2.3.0" ;; *)
@@ -6160,7 +6171,7 @@ if { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ fi done fi -if test "$cpu" = "ppc64" && test "$targetos" != "Darwin" ; then +if test "$ARCH" = "ppc64" && test "$targetos" != "Darwin" ; then roms="$roms spapr-rtas" fi
@@ -7345,7 +7356,7 @@ if test "$linux" = "yes" ; then i386|x86_64|x32) linux_arch=x86 ;; - ppc|ppc64) + ppc|ppc64|ppc64le) linux_arch=powerpc ;; s390x)
@@ -7506,7 +7517,8 @@ case "$target_name" in ;; ppc) gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" - target_compiler=$cross_cc_powerpc + target_compiler=$cross_cc_ppc + target_compiler_cflags="$cross_cc_cflags_ppc" ;; ppc64) TARGET_BASE_ARCH=ppc
@@ -7514,6 +7526,7 @@ case "$target_name" in mttcg=yes gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" target_compiler=$cross_cc_ppc64 + target_compiler_cflags="$cross_cc_cflags_ppc64" ;; ppc64le) TARGET_ARCH=ppc64
@@ -7529,7 +7542,8 @@ case "$target_name" in TARGET_ABI_DIR=ppc echo "TARGET_ABI32=y" >> $config_target_mak gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml" - target_compiler=$cross_cc_ppc64abi32 + target_compiler=$cross_cc_ppc + target_compiler_cflags="$cross_cc_cflags_ppc" ;; riscv32) TARGET_BASE_ARCH=riscv
Signature · 1 line
2.17.1
PATCH 2/2 configure: Use quotes around uses of $CPU_CFLAGS
In reply to Richard HendersonAbout half of the values to which CPU_CFLAGS is set have multiple space separated arguments.
--- configure | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
configure +8 -8
@@ -1543,37 +1543,37 @@ case "$cpu" in CPU_CFLAGS="-m64" LDFLAGS="-m64 $LDFLAGS" cross_cc_ppc64=$cc - cross_cc_cflags_ppc64=$CPU_CFLAGS + cross_cc_cflags_ppc64="$CPU_CFLAGS" ;; sparc) CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" LDFLAGS="-m32 -mv8plus $LDFLAGS" cross_cc_sparc=$cc - cross_cc_cflags_sparc=$CPU_CFLAGS + cross_cc_cflags_sparc="$CPU_CFLAGS" ;; sparc64) CPU_CFLAGS="-m64 -mcpu=ultrasparc" LDFLAGS="-m64 $LDFLAGS" cross_cc_sparc64=$cc - cross_cc_cflags_sparc64=$CPU_CFLAGS + cross_cc_cflags_sparc64="$CPU_CFLAGS" ;; s390) CPU_CFLAGS="-m31" LDFLAGS="-m31 $LDFLAGS" cross_cc_s390=$cc - cross_cc_cflags_s390=$CPU_CFLAGS + cross_cc_cflags_s390="$CPU_CFLAGS" ;; s390x) CPU_CFLAGS="-m64" LDFLAGS="-m64 $LDFLAGS" cross_cc_s390x=$cc - cross_cc_cflags_s390x=$CPU_CFLAGS + cross_cc_cflags_s390x="$CPU_CFLAGS" ;; i386) CPU_CFLAGS="-m32" LDFLAGS="-m32 $LDFLAGS" cross_cc_i386=$cc - cross_cc_cflags_i386=$CPU_CFLAGS + cross_cc_cflags_i386="$CPU_CFLAGS" ;; x86_64) # ??? Only extremely old AMD cpus do not have cmpxchg16b.
@@ -1582,13 +1582,13 @@ case "$cpu" in CPU_CFLAGS="-m64 -mcx16" LDFLAGS="-m64 $LDFLAGS" cross_cc_x86_64=$cc - cross_cc_cflags_x86_64=$CPU_CFLAGS + cross_cc_cflags_x86_64="$CPU_CFLAGS" ;; x32) CPU_CFLAGS="-mx32" LDFLAGS="-mx32 $LDFLAGS" cross_cc_i386=$cc - cross_cc_cflags_i386=$CPU_CFLAGS + cross_cc_cflags_i386="$CPU_CFLAGS" ;; # No special flags required for other host CPUs esac
Signature · 1 line
2.17.1
Re: [Qemu-devel] [PATCH 2/2] configure: Use quotes around uses of $CPU_CFLAGS
Quoted 4 lines · Richard Henderson
About half of the values to which
CPU_CFLAGSis set have multiple space separated arguments.Signed-off-by Richard Henderson <[email protected]>
Quoted 69 lines
--- configure | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)configure +8
-8@@ -1543,37 +1543,37 @@ case "$cpu" in CPU_CFLAGS="-m64" LDFLAGS="-m64 $LDFLAGS" cross_cc_ppc64=$cc - cross_cc_cflags_ppc64=$CPU_CFLAGS + cross_cc_cflags_ppc64="$CPU_CFLAGS" ;; sparc) CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" LDFLAGS="-m32 -mv8plus $LDFLAGS" cross_cc_sparc=$cc - cross_cc_cflags_sparc=$CPU_CFLAGS + cross_cc_cflags_sparc="$CPU_CFLAGS" ;; sparc64) CPU_CFLAGS="-m64 -mcpu=ultrasparc" LDFLAGS="-m64 $LDFLAGS" cross_cc_sparc64=$cc - cross_cc_cflags_sparc64=$CPU_CFLAGS + cross_cc_cflags_sparc64="$CPU_CFLAGS" ;; s390) CPU_CFLAGS="-m31" LDFLAGS="-m31 $LDFLAGS" cross_cc_s390=$cc - cross_cc_cflags_s390=$CPU_CFLAGS + cross_cc_cflags_s390="$CPU_CFLAGS" ;; s390x) CPU_CFLAGS="-m64" LDFLAGS="-m64 $LDFLAGS" cross_cc_s390x=$cc - cross_cc_cflags_s390x=$CPU_CFLAGS + cross_cc_cflags_s390x="$CPU_CFLAGS" ;; i386) CPU_CFLAGS="-m32" LDFLAGS="-m32 $LDFLAGS" cross_cc_i386=$cc - cross_cc_cflags_i386=$CPU_CFLAGS + cross_cc_cflags_i386="$CPU_CFLAGS" ;; x86_64) # ??? Only extremely old AMD cpus do not have cmpxchg16b.@@ -1582,13 +1582,13 @@ case "$cpu" in CPU_CFLAGS="-m64 -mcx16" LDFLAGS="-m64 $LDFLAGS" cross_cc_x86_64=$cc - cross_cc_cflags_x86_64=$CPU_CFLAGS + cross_cc_cflags_x86_64="$CPU_CFLAGS" ;; x32) CPU_CFLAGS="-mx32" LDFLAGS="-mx32 $LDFLAGS" cross_cc_i386=$cc - cross_cc_cflags_i386=$CPU_CFLAGS + cross_cc_cflags_i386="$CPU_CFLAGS" ;; # No special flags required for other host CPUs esac
Re: [Qemu-devel] [PATCH 2/2] configure: Use quotes around uses of $CPU_CFLAGS
In reply to Richard HendersonQuoted 13 lines · Richard Henderson
About half of the values to which
CPU_CFLAGSis set have multiple space separated arguments.Signed-off-by Richard Henderson <[email protected]>--- configure | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)configure +0
-0
configure case "$cpu" in · line 1546
Quoted 5 lines
configure +1
-1@@ -1543,37 +1543,37 @@ case "$cpu" in CPU_CFLAGS="-m64" LDFLAGS="-m64 $LDFLAGS" cross_cc_ppc64=$cc - cross_cc_cflags_ppc64=$CPU_CFLAGS + cross_cc_cflags_ppc64="$CPU_CFLAGS"
Makes no difference semantically (bare variable assignments are not subject to word splitting or globbing, so the quotes don't change the result); the only reason to change this is for consistency (using quotes everywhere is easier to remember, whether or not they are in a context that matter).
So I'm okay whether this patch goes in or is omitted.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 11 lines · Richard Henderson
At present make check-tcg will produce errors like
RUN tests for ppc64
TEST test-mmap (default) on ppc64
test-mmap: Invalid ELF image for this architecture make[2]: *** [run-test-mmap] Error 255 make[1]: *** [run-guest-tests] Error 2
make: *** [run-tcg-tests-ppc64-linux-user] Error 2which is caused by the use of the host ppc64le compiler in building guest ppc64(be) executables.
Thanks for looking at this.
I've staged this tentatively in ppc-for-4.1. However while it removes the "Invalid ELF image" message I still get:
TEST test-mmap (4096 byte pages) on ppc64le
test-mmap: Invalid argument
make[2]: *** [/home/dwg/qemu/tests/tcg/multiarch/Makefile.target:35: run-test-mmap-4096] Error 255 make[2]: Target 'run' not remade because of errors.
make[1]: *** [/home/dwg/qemu/tests/tcg/Makefile.include:71: run-guest-tests] Error 2
make: *** [/home/dwg/qemu/tests/Makefile.include:1079: run-tcg-tests-ppc64le-linux-user] Error 2
Running on a POWER9 host. Do you see that as well?
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 11 lines · David Gibson
I've staged this tentatively in ppc-for-4.1. However while it removes the "Invalid ELF image" message I still get:
TEST test-mmap (4096 byte pages) on ppc64le
test-mmap: Invalid argument
make[2]: *** [/home/dwg/qemu/tests/tcg/multiarch/Makefile.target:35: run-test-mmap-4096] Error 255 make[2]: Target 'run' not remade because of errors.
make[1]: *** [/home/dwg/qemu/tests/tcg/Makefile.include:71: run-guest-tests] Error 2
make: *** [/home/dwg/qemu/tests/Makefile.include:1079: run-tcg-tests-ppc64le-linux-user] Error 2Running on a POWER9 host. Do you see that as well?
Yes.
It's a semi-bogus test, really. We can't run test-mmap with a page size smaller than that of the host, and of course ppc64le uses 64k pages.
This needs a different set of cleanups. ;-)
r~
Quoted 11 lines · Richard Henderson
Quoted 10 lines · David Gibson
I've staged this tentatively in ppc-for-4.1. However while it removes the "Invalid ELF image" message I still get:
TEST test-mmap (4096 byte pages) on ppc64le
test-mmap: Invalid argument
make[2]: *** [/home/dwg/qemu/tests/tcg/multiarch/Makefile.target:35: run-test-mmap-4096] Error 255 make[2]: Target 'run' not remade because of errors.
make[1]: *** [/home/dwg/qemu/tests/tcg/Makefile.include:71: run-guest-tests] Error 2
make: *** [/home/dwg/qemu/tests/Makefile.include:1079: run-tcg-tests-ppc64le-linux-user] Error 2
Quoted 7 lines
Quoted 1 line
Running on a POWER9 host. Do you see that as well?
Yes.
It's a semi-bogus test, really. We can't run test-mmap with a page size smaller than that of the host, and of course ppc64le uses 64k pages.
The default run-test-mmap should just run against the host page size (which may be bogus for the emulated architecture). The additional runs are all added with EXTRA_RUNS:
EXTRA_RUNS+=run-test-mmap-4096 #run-test-mmap-65536
Currently the 64k pages are disabled because it crashes so somebody should probably look into that.
Looking at -p setting the confusing named qemu_host_page_size doesn't seem to reflect this in:
#ifdef TARGET_NR_getpagesize
case TARGET_NR_getpagesize:
return TARGET_PAGE_SIZE;
#endifQuoted 1 line
This needs a different set of cleanups. ;-)
I guess this is another use case for softmmu support in linux-user where HOST_PAGE != TARGET_PAGE?
--
Alex Bennée
Quoted 4 lines · Alex Bennée
Quoted 1 line
This needs a different set of cleanups. ;-)
I guess this is another use case for softmmu support in linux-user where
HOST_PAGE!=TARGET_PAGE?
Well, yes, but I was thinking more short-term, wherein we do not test things that we know will not work. E.g. testing 4k pages on a 64k page host.
r~
Quoted 8 lines · Richard Henderson
Quoted 4 lines · Alex Bennée
Quoted 1 line
This needs a different set of cleanups. ;-)
I guess this is another use case for softmmu support in linux-user where
HOST_PAGE!=TARGET_PAGE?Well, yes, but I was thinking more short-term, wherein we do not test things that we know will not work. E.g. testing 4k pages on a 64k page host.
I guess we could add something to configure to emit the host page size so we can conditionalise the tests. Or just fix mmap to take advantage of the fact that getpagesize() reports the host page size and nope out when that is greater than test-mmap -p....
Quoted 3 lines
r~
--
Alex Bennée