configure cleanups, mostly wrt $cpu and $targetos
cover configure cleanups, mostly wrt $cpu and $targetos
The bulk is in patches 2 to 9; they unify the names of architectures between configure and meson, and remove the ARCH symbol from configure. It is only used during QEMU build, so it can be derived from host_machine.cpu_family(), instead of having to pass it in config-host.mak.
Paolo Bonzini (10):
configure: simplify creation of plugin symbol list
configure: make $targetos lowercase, use windows instead of MINGW32
configure: move target detection before CPU detection
configure: do not set bsd_user/linux_user early
configure: unify two case statements on $cpu
configure: unify ppc64 and ppc64le
configure: unify x86_64 and x32
meson: rename "arch" variable
configure, meson: move ARCH to meson.build
configure: remove unnecessary symlinks
configure | 283 +++++++++++++++++------------------------ meson.build | 39 +++--- pc-bios/meson.build | 2 +- plugins/meson.build | 13 +- tests/tcg/configure.sh | 4 +- 5 files changed, 155 insertions(+), 186 deletions(-)
Signature · 1 line
2.33.1
PATCH 1/10 configure: simplify creation of plugin symbol list
--dynamic-list is present on all supported ELF (not Windows or Darwin) platforms, since it dates back to 2006; -exported_symbols_list is likewise present on all supported versions of macOS. Do not bother doing a functional test in configure.
Since stuff is being moved to meson, move the creation of the Darwin-formatted symbols list there, reducing the transform to a single sed command. This also requires using -Xlinker instead of -Wl, in order to support weird paths that include a comma.
--- configure | 16 ---------------- plugins/meson.build | 13 +++++++++---- 2 files changed, 9 insertions(+), 20 deletions(-)
configure +0 -16
@@ -3689,22 +3689,6 @@ fi if test "$plugins" = "yes" ; then echo "CONFIG_PLUGIN=y" >> $config_host_mak - # Copy the export object list to the build dir - if test "$ld_dynamic_list" = "yes" ; then - echo "CONFIG_HAS_LD_DYNAMIC_LIST=yes" >> $config_host_mak - ld_symbols=qemu-plugins-ld.symbols - cp "$source_path/plugins/qemu-plugins.symbols" $ld_symbols - elif test "$ld_exported_symbols_list" = "yes" ; then - echo "CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST=yes" >> $config_host_mak - ld64_symbols=qemu-plugins-ld64.symbols - echo "# Automatically generated by configure - do not modify" > $ld64_symbols - grep 'qemu_' "$source_path/plugins/qemu-plugins.symbols" | sed 's/;//g' | \ - sed -E 's/^[[:space:]]*(.*)/_\1/' >> $ld64_symbols - else - error_exit \ - "If \$plugins=yes, either \$ld_dynamic_list or " \ - "\$ld_exported_symbols_list should have been set to 'yes'." - fi fi if test -n "$gdb_bin"; then
plugins/meson.build +9 -4
@@ -1,10 +1,15 @@ plugin_ldflags = [] # Modules need more symbols than just those in plugins/qemu-plugins.symbols if not enable_modules - if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host - plugin_ldflags = ['-Wl,--dynamic-list=qemu-plugins-ld.symbols'] - elif 'CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST' in config_host - plugin_ldflags = ['-Wl,-exported_symbols_list,qemu-plugins-ld64.symbols'] + if targetos == 'darwin' + qemu_plugins_symbols_list = configure_file( + input: files('qemu-plugins.symbols'), + output: 'qemu-plugins-ld64.symbols', + capture: true, + command: ['sed', '-ne', 's/^[[:space:]]*\\(qemu_.*\\);/_\\1/p', '@INPUT@']) + plugin_ldflags = ['-Xlinker', '-exported_symbols_list', '-Xlinker', qemu_plugins_symbols_list] + else + plugin_ldflags = ['-Xlinker', '--dynamic-list=' + (meson.project_source_root() / 'plugins/qemu-plugins.symbols')] endif endif
Signature · 1 line
2.33.1
Re: [PATCH 01/10] configure: simplify creation of plugin symbol list
Quoted 10 lines · Paolo Bonzini
--dynamic-list is present on all supported ELF (not Windows or Darwin) platforms, since it dates back to 2006; -exported_symbols_list is likewise present on all supported versions of macOS. Do not bother doing a functional test in configure.
Since stuff is being moved to meson, move the creation of the Darwin-formatted symbols list there, reducing the transform to a single sed command. This also requires using -Xlinker instead of -Wl, in order to support weird paths that include a comma.
Quoted 5 lines
Signed-off-by Paolo Bonzini<[email protected]>--- configure | 16 ---------------- plugins/meson.build | 13 +++++++++---- 2 files changed, 9 insertions(+), 20 deletions(-)
Surely you'd want to be removing all of the ld_dynamic_list and ld_exported_symbols_list code as well?
r~
PATCH 2/10 configure: make $targetos lowercase, use windows instead of MINGW32
In reply to Paolo Bonzinitargetos is already mostly the same as Meson host_machine.system(), just in CamelCase. Adjust Windows, which is different, and switch to lowercase to match Meson.
--- configure | 58 ++++++++++++++++++++++++------------------------------- 1 file changed, 25 insertions(+), 33 deletions(-)
configure +25 -33
@@ -502,30 +502,30 @@ EOF } if check_define __linux__ ; then - targetos="Linux" + targetos=linux elif check_define _WIN32 ; then - targetos='MINGW32' + targetos=windows elif check_define __OpenBSD__ ; then - targetos='OpenBSD' + targetos=openbsd elif check_define __sun__ ; then - targetos='SunOS' + targetos=sunos elif check_define __HAIKU__ ; then - targetos='Haiku' + targetos=haiku elif check_define __FreeBSD__ ; then - targetos='FreeBSD' + targetos=freebsd elif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then - targetos='GNU/kFreeBSD' + targetos=gnu/kfreebsd elif check_define __DragonFly__ ; then - targetos='DragonFly' + targetos=dragonfly elif check_define __NetBSD__; then - targetos='NetBSD' + targetos=netbsd elif check_define __APPLE__; then - targetos='Darwin' + targetos=darwin else # This is a fatal error, but don't report it yet, because we # might be going to just print the --help text, or it might # be the result of a missing compiler. - targetos='bogus' + targetos=bogus fi # Some host OSes need non-standard checks for which CPU to use.
@@ -533,7 +533,7 @@ fi # cross-compiling to one of these OSes then you'll need to specify # the correct CPU with the --cpu option. case $targetos in -SunOS) +sunos) # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then cpu="x86_64"
@@ -624,40 +624,40 @@ fi # OS specific case $targetos in -MINGW32*) +windows) mingw32="yes" plugins="no" pie="no" ;; -GNU/kFreeBSD) +gnu/kfreebsd) bsd="yes" ;; -FreeBSD) +freebsd) bsd="yes" bsd_user="yes" make="${MAKE-gmake}" # needed for kinfo_getvmmap(3) in libutil.h ;; -DragonFly) +dragonfly) bsd="yes" make="${MAKE-gmake}" ;; -NetBSD) +netbsd) bsd="yes" make="${MAKE-gmake}" ;; -OpenBSD) +openbsd) bsd="yes" make="${MAKE-gmake}" ;; -Darwin) +darwin) bsd="yes" darwin="yes" # Disable attempts to use ObjectiveC features in os/object.h since they # won't work when we're compiling with gcc as a C compiler. QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" ;; -SunOS) +sunos) solaris="yes" make="${MAKE-gmake}" smbd="${SMBD-/usr/sfw/sbin/smbd}"
@@ -666,11 +666,11 @@ SunOS) # needed for TIOCWIN* defines in termios.h QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" ;; -Haiku) +haiku) pie="no" QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -D_BSD_SOURCE -fPIC $QEMU_CFLAGS" ;; -Linux) +linux) linux="yes" linux_user="yes" vhost_user=${default_feature:-yes}
@@ -3355,8 +3355,8 @@ QEMU_GA_MSI_MINGW_DLL_PATH="$($pkg_config --variable=prefix glib-2.0)/bin" # Mac OS X ships with a broken assembler roms= if { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ - test "$targetos" != "Darwin" && test "$targetos" != "SunOS" && \ - test "$targetos" != "Haiku" && test "$softmmu" = yes ; then + test "$targetos" != "darwin" && test "$targetos" != "sunos" && \ + test "$targetos" != "haiku" && test "$softmmu" = yes ; then # Different host OS linkers have different ideas about the name of the ELF # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe.
@@ -3914,15 +3914,7 @@ if test "$skip_meson" = no; then if test "$cross_compile" = "yes"; then cross_arg="--cross-file config-meson.cross" echo "[host_machine]" >> $cross - if test "$mingw32" = "yes" ; then - echo "system = 'windows'" >> $cross - fi - if test "$linux" = "yes" ; then - echo "system = 'linux'" >> $cross - fi - if test "$darwin" = "yes" ; then - echo "system = 'darwin'" >> $cross - fi + echo "system = '$targetos'" >> $cross case "$ARCH" in i386) echo "cpu_family = 'x86'" >> $cross
Signature · 1 line
2.33.1
Re: [PATCH 02/10] configure: make $targetos lowercase, use windows instead of MINGW32
Quoted 8 lines · Paolo Bonzini
targetos is already mostly the same as Meson
host_machine.system(), just in CamelCase. Adjust Windows, which is different, and switch to lowercase to match Meson.Signed-off-by Paolo Bonzini<[email protected]>--- configure | 58 ++++++++++++++++++++++++------------------------------- 1 file changed, 25 insertions(+), 33 deletions(-)
r~
PATCH 3/10 configure: move target detection before CPU detection
In reply to Paolo BonziniThis makes more sense, since target detection can affect CPU detection on Solaris.
--- configure | 115 ++++++++++++++++++++++++++---------------------------- 1 file changed, 55 insertions(+), 60 deletions(-)
configure +55 -60
@@ -528,16 +528,67 @@ else targetos=bogus fi -# Some host OSes need non-standard checks for which CPU to use. -# Note that these checks are broken for cross-compilation: if you're -# cross-compiling to one of these OSes then you'll need to specify -# the correct CPU with the --cpu option. +# OS specific + case $targetos in +windows) + mingw32="yes" + plugins="no" + pie="no" +;; +gnu/kfreebsd) + bsd="yes" +;; +freebsd) + bsd="yes" + bsd_user="yes" + make="${MAKE-gmake}" + # needed for kinfo_getvmmap(3) in libutil.h +;; +dragonfly) + bsd="yes" + make="${MAKE-gmake}" +;; +netbsd) + bsd="yes" + make="${MAKE-gmake}" +;; +openbsd) + bsd="yes" + make="${MAKE-gmake}" +;; +darwin) + bsd="yes" + darwin="yes" + # Disable attempts to use ObjectiveC features in os/object.h since they + # won't work when we're compiling with gcc as a C compiler. + QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" +;; sunos) + solaris="yes" + make="${MAKE-gmake}" + smbd="${SMBD-/usr/sfw/sbin/smbd}" +# needed for CMSG_ macros in sys/socket.h + QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" +# needed for TIOCWIN* defines in termios.h + QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo + # Note that this check is broken for cross-compilation: if you're + # cross-compiling to one of these OSes then you'll need to specify + # the correct CPU with the --cpu option. if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then cpu="x86_64" fi +;; +haiku) + pie="no" + QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -D_BSD_SOURCE -fPIC $QEMU_CFLAGS" +;; +linux) + linux="yes" + linux_user="yes" + vhost_user=${default_feature:-yes} +;; esac if test ! -z "$cpu" ; then
@@ -621,62 +672,6 @@ if test -z "$ARCH"; then ARCH="$cpu" fi -# OS specific - -case $targetos in -windows) - mingw32="yes" - plugins="no" - pie="no" -;; -gnu/kfreebsd) - bsd="yes" -;; -freebsd) - bsd="yes" - bsd_user="yes" - make="${MAKE-gmake}" - # needed for kinfo_getvmmap(3) in libutil.h -;; -dragonfly) - bsd="yes" - make="${MAKE-gmake}" -;; -netbsd) - bsd="yes" - make="${MAKE-gmake}" -;; -openbsd) - bsd="yes" - make="${MAKE-gmake}" -;; -darwin) - bsd="yes" - darwin="yes" - # Disable attempts to use ObjectiveC features in os/object.h since they - # won't work when we're compiling with gcc as a C compiler. - QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" -;; -sunos) - solaris="yes" - make="${MAKE-gmake}" - smbd="${SMBD-/usr/sfw/sbin/smbd}" -# needed for CMSG_ macros in sys/socket.h - QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" -# needed for TIOCWIN* defines in termios.h - QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" -;; -haiku) - pie="no" - QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -D_BSD_SOURCE -fPIC $QEMU_CFLAGS" -;; -linux) - linux="yes" - linux_user="yes" - vhost_user=${default_feature:-yes} -;; -esac - : ${make=${MAKE-make}} # We prefer python 3.x. A bare 'python' is traditionally
Signature · 1 line
2.33.1
PATCH 4/10 configure: do not set bsd_user/linux_user early
In reply to Paolo BonziniSimilar to other optional features, leave the variables empty and compute the actual value later. Use the existence of include or source directories to detect whether an OS or CPU supports respectively bsd-user and linux-user.
For now, BSD user-mode emulation is buildable even on TCI-only architectures. This probably will change once safe signals are brought over from linux-user.
--- configure | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
configure +16 -11
@@ -322,8 +322,8 @@ linux="no" solaris="no" profiler="no" softmmu="yes" -linux_user="no" -bsd_user="no" +linux_user="" +bsd_user="" pkgversion="" pie="" qom_cast_debug="yes"
@@ -541,7 +541,6 @@ gnu/kfreebsd) ;; freebsd) bsd="yes" - bsd_user="yes" make="${MAKE-gmake}" # needed for kinfo_getvmmap(3) in libutil.h ;;
@@ -586,7 +585,6 @@ haiku) ;; linux) linux="yes" - linux_user="yes" vhost_user=${default_feature:-yes} ;; esac
@@ -1280,18 +1278,25 @@ if eval test -z "\${cross_cc_$cpu}"; then cross_cc_vars="$cross_cc_vars cross_cc_${cpu}" fi -# For user-mode emulation the host arch has to be one we explicitly -# support, even if we're using TCI. -if [ "$ARCH" = "unknown" ]; then - bsd_user="no" - linux_user="no" -fi - default_target_list="" deprecated_targets_list=ppc64abi32-linux-user deprecated_features="" mak_wilds="" +if [ "$linux_user" != no ]; then + if [ "$targetos" = linux ] && [ -d $source_path/linux-user/host/$cpu ]; then + linux_user=yes + elif [ "$linux_user" = yes ]; then + error_exit "linux-user not supported on this architecture" + fi +fi +if [ "$bsd_user" != no ]; then + if [ -d $source_path/bsd-user/$targetos ]; then + bsd_user=yes + elif [ "$bsd_user" = yes ]; then + error_exit "bsd-user not supported on this host OS" + fi +fi if [ "$softmmu" = "yes" ]; then mak_wilds="${mak_wilds} $source_path/configs/targets/*-softmmu.mak" fi
Signature · 1 line
2.33.1
Re: [PATCH 04/10] configure: do not set bsd_user/linux_user early
Quoted 16 lines · Paolo Bonzini
configure +0
-2@@ -541,7 +541,6 @@ gnu/kfreebsd) ;; freebsd) bsd="yes" - bsd_user="yes" make="${MAKE-gmake}" # needed for kinfo_getvmmap(3) in libutil.h ;;@@ -586,7 +585,6 @@ haiku) ;; linux) linux="yes" - linux_user="yes" vhost_user=${default_feature:-yes} ;; esac
...
Quoted 4 lines
configure +4
-0+if [ "$linux_user" != no ]; then + if [ "$targetos" = linux ] && [ -d $source_path/linux-user/host/$cpu ]; then + linux_user=yes + elif [ "$linux_user" = yes ]; then
configure if eval test -z "\${cross_cc_$cpu}"; then · line 1299
Quoted 10 lines
configure +10
-0+ error_exit "linux-user not supported on this architecture" + fi +fi +if [ "$bsd_user" != no ]; then + if [ -d $source_path/bsd-user/$targetos ]; then + bsd_user=yes + elif [ "$bsd_user" = yes ]; then + error_exit "bsd-user not supported on this host OS" + fi +fi
Missing the check for $targetos = freebsd. This looks like it would enable bsd_user on linux, etc.
r~
Re: [PATCH 04/10] configure: do not set bsd_user/linux_user early
Quoted 28 lines · Richard Henderson
Quoted 16 lines · Paolo Bonzini
configure +0
-0@@ -541,7 +541,6 @@ gnu/kfreebsd) ;; freebsd)bsd="yes"
- bsd_user="yes"
make="${MAKE-gmake}"# needed for kinfo_getvmmap(3) in libutil.h ;;(quoted diff) +0
-0@@ -586,7 +585,6 @@ haiku) ;; linux)linux="yes"
- linux_user="yes"
vhost_user=${default_feature:-yes}
;;
esac...
Quoted 10 lines
+if [ "$linux_user" != no ]; then
+ if [ "$targetos" = linux ] && [ -d $source_path/linux-user/host/$cpu ]; then
+ linux_user=yes
+ elif [ "$linux_user" = yes ]; then
+error_exit"linux-user not supported on this architecture" + ficonfigure +3
-0+fi +if [ "$bsd_user" != no ]; then + if [ -d $source_path/bsd-user/$targetos ]; then
Quoted 8 lines
Quoted 5 lines
+ bsd_user=yes
+ elif [ "$bsd_user" = yes ]; then
+error_exit"bsd-user not supported on this host OS" + fi
+fiMissing the check for $targetos = freebsd. This looks like it would enable
bsd_useron linux, etc.
It's replaced by checking for bsd-user/$targetos but yes, that would flip the default for netbsd and openbsd.
A better condition is
if [ "$bsd_user" != no ]; then
if [ "$bsd_user" = "" ]; then
test $targetos = freebsd && bsd_user=yes
fi
if [ "$bsd_user" = yes ] && ! [ -d $source_path/bsd-user/$targetos ]; then
error_exit "bsd-user not supported on this host OS"
fi
fi
Paolo
PATCH 5/10 configure: unify two case statements on $cpu
In reply to Paolo Bonzini--- configure | 67 ++++++++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 35 deletions(-)
configure +32 -35
@@ -635,32 +635,47 @@ else fi ARCH= -# Normalise host CPU name and set ARCH. +# Normalise host CPU name, set ARCH and multilib cflags # Note that this case should only have supported host CPUs, not guests. case "$cpu" in - ppc|ppc64|s390x|sparc64|x32|riscv) - ;; - ppc64le) - ARCH="ppc64" - ;; + aarch64|riscv) ;; + armv*b|armv*l|arm) + cpu="arm" ;; + i386|i486|i586|i686|i86pc|BePC) cpu="i386" - ;; + CPU_CFLAGS="-m32" ;; + x32) + CPU_CFLAGS="-mx32" ;; x86_64|amd64) cpu="x86_64" - ;; - armv*b|armv*l|arm) - cpu="arm" - ;; - aarch64) - cpu="aarch64" - ;; + # ??? Only extremely old AMD cpus do not have cmpxchg16b. + # If we truly care, we should simply detect this case at + # runtime and generate the fallback to serial emulation. + CPU_CFLAGS="-m64 -mcx16" ;; + mips*) - cpu="mips" - ;; + cpu="mips" ;; + + ppc) + CPU_CFLAGS="-m32" ;; + ppc64) + CPU_CFLAGS="-m64" ;; + ppc64le) + ARCH="ppc64" ;; + + s390) + CPU_CFLAGS="-m31" + ARCH=unknown ;; + s390x) + CPU_CFLAGS="-m64" ;; + sparc|sun4[cdmuv]) cpu="sparc" - ;; + CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" ;; + sparc64) + CPU_CFLAGS="-m64 -mcpu=ultrasparc" ;; + *) # This will result in either an error or falling back to TCI later ARCH=unknown
@@ -1255,24 +1270,6 @@ local_statedir="${local_statedir:-$prefix/var}" firmwarepath="${firmwarepath:-$datadir/qemu-firmware}" localedir="${localedir:-$datadir/locale}" -case "$cpu" in - ppc) CPU_CFLAGS="-m32" ;; - ppc64) CPU_CFLAGS="-m64" ;; - sparc) CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" ;; - sparc64) CPU_CFLAGS="-m64 -mcpu=ultrasparc" ;; - s390) CPU_CFLAGS="-m31" ;; - s390x) CPU_CFLAGS="-m64" ;; - i386) CPU_CFLAGS="-m32" ;; - x32) CPU_CFLAGS="-mx32" ;; - - # ??? Only extremely old AMD cpus do not have cmpxchg16b. - # If we truly care, we should simply detect this case at - # runtime and generate the fallback to serial emulation. - x86_64) CPU_CFLAGS="-m64 -mcx16" ;; - - # No special flags required for other host CPUs -esac - if eval test -z "\${cross_cc_$cpu}"; then eval "cross_cc_${cpu}=\$cc" cross_cc_vars="$cross_cc_vars cross_cc_${cpu}"
Signature · 1 line
2.33.1
Re: [PATCH 05/10] configure: unify two case statements on $cpu
configure else · line 669
Quoted 3 lines · Paolo Bonzini
configure +3
-0+ s390) + CPU_CFLAGS="-m31" + ARCH=unknown ;;
Eh, ok. I could also support removing the case entirely. I don't see the point in having an entry for an unsupported host.
This will actively not compile as soon as my safe-signal reorg hits.
Otherwise,
r~
PATCH 6/10 configure: unify ppc64 and ppc64le
In reply to Paolo BonziniThe only difference between the two, as far as either configure or Meson are concerned, is the default endianness of the compiler.
For tests/tcg, specify the endianness explicitly on the command line; for configure, do the same so that it is possible to have --cpu=ppc64le on a bigendian system or vice versa. Apart from this, cpu=ppc64le can be normalized to ppc64 also in configure and not just in the meson cross file.
--- configure | 10 ++++------ tests/tcg/configure.sh | 4 +++- 2 files changed, 7 insertions(+), 7 deletions(-)
configure +4 -6
@@ -660,9 +660,10 @@ case "$cpu" in ppc) CPU_CFLAGS="-m32" ;; ppc64) - CPU_CFLAGS="-m64" ;; + CPU_CFLAGS="-m64 -mbig" ;; ppc64le) - ARCH="ppc64" ;; + cpu="ppc64" + CPU_CFLAGS="-m64 -mlittle" ;; s390) CPU_CFLAGS="-m31"
@@ -3737,7 +3738,7 @@ if test "$linux" = "yes" ; then i386|x86_64|x32) linux_arch=x86 ;; - ppc|ppc64|ppc64le) + ppc|ppc64) linux_arch=powerpc ;; s390x)
@@ -3919,9 +3920,6 @@ if test "$skip_meson" = no; then x86_64|x32) echo "cpu_family = 'x86_64'" >> $cross ;; - ppc64le) - echo "cpu_family = 'ppc64'" >> $cross - ;; *) echo "cpu_family = '$ARCH'" >> $cross ;;
tests/tcg/configure.sh +3 -1
@@ -64,7 +64,9 @@ fi : ${cross_cc_ppc="powerpc-linux-gnu-gcc"} : ${cross_cc_cflags_ppc="-m32"} : ${cross_cc_ppc64="powerpc64-linux-gnu-gcc"} -: ${cross_cc_ppc64le="powerpc64le-linux-gnu-gcc"} +: ${cross_cc_cflags_ppc64="-m64 -mbig"} +: ${cross_cc_ppc64le="$cross_cc_ppc64"} +: ${cross_cc_cflags_ppc64le="-m64 -mlittle"} : ${cross_cc_riscv64="riscv64-linux-gnu-gcc"} : ${cross_cc_s390x="s390x-linux-gnu-gcc"} : ${cross_cc_sh4="sh4-linux-gnu-gcc"}
Signature · 1 line
2.33.1
Re: [PATCH 06/10] configure: unify ppc64 and ppc64le
Quoted 9 lines · Paolo Bonzini
The only difference between the two, as far as either configure or Meson are concerned, is the default endianness of the compiler.
For tests/tcg, specify the endianness explicitly on the command line; for configure, do the same so that it is possible to have --cpu=ppc64le on a bigendian system or vice versa. Apart from this, cpu=ppc64le can be normalized to ppc64 also in configure and not just in the meson cross file.
Quoted 5 lines
Signed-off-by Paolo Bonzini <[email protected]>--- configure | 10 ++++------ tests/tcg/configure.sh | 4 +++- 2 files changed, 7 insertions(+), 7 deletions(-)
Re: [PATCH 06/10] configure: unify ppc64 and ppc64le
In reply to Paolo BonziniQuoted 9 lines · Paolo Bonzini
The only difference between the two, as far as either configure or Meson are concerned, is the default endianness of the compiler.
For tests/tcg, specify the endianness explicitly on the command line; for configure, do the same so that it is possible to have --cpu=ppc64le on a bigendian system or vice versa. Apart from this, cpu=ppc64le can be normalized to ppc64 also in configure and not just in the meson cross file.
Quoted 5 lines
Signed-off-by Paolo Bonzini<[email protected]>--- configure | 10 ++++------ tests/tcg/configure.sh | 4 +++- 2 files changed, 7 insertions(+), 7 deletions(-)
r~
PATCH 7/10 configure: unify x86_64 and x32
In reply to Paolo BonziniThe only difference between the two, as far as either configure or Meson are concerned, is in the multilib flags passed to the compiler.
For QEMU, this fixes the handling of TYPE_OLDDEVT in include/exec/user/thunk.h and enables testing of dirty ring buffer, because both are using HOST_X86_64.
For tests/tcg, this means that on a hypothetical x32 host the cross compiler will not be used to build the tests.
--- configure | 6 ++---- meson.build | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-)
configure +2 -4
@@ -646,6 +646,7 @@ case "$cpu" in cpu="i386" CPU_CFLAGS="-m32" ;; x32) + cpu="x86_64" CPU_CFLAGS="-mx32" ;; x86_64|amd64) cpu="x86_64"
@@ -3735,7 +3736,7 @@ fi if test "$linux" = "yes" ; then mkdir -p linux-headers case "$cpu" in - i386|x86_64|x32) + i386|x86_64) linux_arch=x86 ;; ppc|ppc64)
@@ -3917,9 +3918,6 @@ if test "$skip_meson" = no; then i386) echo "cpu_family = 'x86'" >> $cross ;; - x86_64|x32) - echo "cpu_family = 'x86_64'" >> $cross - ;; *) echo "cpu_family = '$ARCH'" >> $cross ;;
meson.build +1 -2
@@ -355,7 +355,7 @@ if not get_option('tcg').disabled() tcg_arch = 'tci' elif config_host['ARCH'] == 'sparc64' tcg_arch = 'sparc' - elif config_host['ARCH'] in ['x86_64', 'x32'] + elif config_host['ARCH'] == 'x86_64' tcg_arch = 'i386' elif config_host['ARCH'] == 'ppc64' tcg_arch = 'ppc'
@@ -1801,7 +1801,6 @@ disassemblers = { 'hppa' : ['CONFIG_HPPA_DIS'], 'i386' : ['CONFIG_I386_DIS'], 'x86_64' : ['CONFIG_I386_DIS'], - 'x32' : ['CONFIG_I386_DIS'], 'm68k' : ['CONFIG_M68K_DIS'], 'microblaze' : ['CONFIG_MICROBLAZE_DIS'], 'mips' : ['CONFIG_MIPS_DIS'],
Signature · 1 line
2.33.1
Re: [PATCH 07/10] configure: unify x86_64 and x32
Quoted 9 lines · Paolo Bonzini
The only difference between the two, as far as either configure or Meson are concerned, is in the multilib flags passed to the compiler.
For QEMU, this fixes the handling of
TYPE_OLDDEVTininclude/exec/user/thunk.hand enables testing of dirty ring buffer, because both are usingHOST_X86_64.For tests/tcg, this means that on a hypothetical x32 host the cross compiler will not be used to build the tests.
Why not add the cross compiler definitions to tests/tcg?
+: ${cross_cc_x32="$cross_cc_x86_64"}
+: ${cross_cc_cflags_x32="-mx32"}
Quoted 5 lines
Signed-off-by Paolo Bonzini <[email protected]>--- configure | 6 ++---- meson.build | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-)
Re: [PATCH 07/10] configure: unify x86_64 and x32
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Paolo Bonzini
The only difference between the two, as far as either configure or Meson are concerned, is in the multilib flags passed to the compiler.
For QEMU, this fixes the handling of
TYPE_OLDDEVTininclude/exec/user/thunk.hand enables testing of dirty ring buffer, because both are usingHOST_X86_64.
Quoted 7 lines
Quoted 2 lines
For tests/tcg, this means that on a hypothetical x32 host the cross compiler will not be used to build the tests.
Why not add the cross compiler definitions to tests/tcg?
+: ${cross_cc_x32="$cross_cc_x86_64"}
+: ${cross_cc_cflags_x32="-mx32"}
tests/tcg does not support building x32 tests right now, does it? What I meant is that, if you're on an x32 host, tests/tcg will now build i386 and x86-64 tests with the native compiler.
Paolo
Re: [PATCH 07/10] configure: unify x86_64 and x32
Quoted 12 lines · Paolo Bonzini
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 9 lines · Paolo Bonzini
The only difference between the two, as far as either configure or Meson are concerned, is in the multilib flags passed to the compiler.
For QEMU, this fixes the handling of
TYPE_OLDDEVTininclude/exec/user/thunk.hand enables testing of dirty ring buffer, because both are usingHOST_X86_64.For tests/tcg, this means that on a hypothetical x32 host the cross compiler will not be used to build the tests.
Quoted 6 lines
Quoted 4 lines
Why not add the cross compiler definitions to tests/tcg?
+: ${cross_cc_x32="$cross_cc_x86_64"}
+: ${cross_cc_cflags_x32="-mx32"}tests/tcg does not support building x32 tests right now, does it?
We don't have docker support for x32, if that's what you mean. But if you have x32 libraries installed on your host, I would think it would work.
Quoted 2 lines
What I meant is that, if you're on an x32 host, tests/tcg will now build i386 and x86-64 tests with the native compiler.
And of course, those multilibs must be installed as well.
r~
Re: [PATCH 07/10] configure: unify x86_64 and x32
Quoted 20 lines · Richard Henderson
Quoted 12 lines · Paolo Bonzini
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 9 lines · Paolo Bonzini
The only difference between the two, as far as either configure or Meson are concerned, is in the multilib flags passed to the compiler.
For QEMU, this fixes the handling of
TYPE_OLDDEVTininclude/exec/user/thunk.hand enables testing of dirty ring buffer, because both are usingHOST_X86_64.For tests/tcg, this means that on a hypothetical x32 host the cross compiler will not be used to build the tests.
Quoted 6 lines
Quoted 4 lines
Why not add the cross compiler definitions to tests/tcg?
+: ${cross_cc_x32="$cross_cc_x86_64"}
+: ${cross_cc_cflags_x32="-mx32"}tests/tcg does not support building x32 tests right now, does it?
Quoted 8 lines
We don't have docker support for x32, if that's what you mean. But if you have x32 libraries installed on your host, I would think it would work.
Quoted 3 lines
What I meant is that, if you're on an x32 host, tests/tcg will now build i386 and
x86-64 tests with the native compiler.And of course, those multilibs must be installed as well.
Debian still builds it:
https://buildd.debian.org/status/logs.php?pkg=qemu&ver=1%3A6.1%2Bdfsg-8%2Bb2&arch=x32
+=====================================================================+ | qemu 1:6.1+dfsg-8+b2 (x32) Wed, 15 Dec 2021 00:23:53 +0000 | +=====================================================================+
Package: qemu
Version: 1:6.1+dfsg-8+b2
Source Version: 1:6.1+dfsg-8
Distribution: sid
Machine Architecture: amd64
Host Architecture: x32
Build Architecture: x32
Build Type: any
qemu-user_6.1+dfsg-8+b2_x32.deb
Package: qemu-user
Source: qemu (1:6.1+dfsg-8)
Version: 1:6.1+dfsg-8+b2
Architecture: x32
Maintainer: Debian QEMU Team <[email protected]>
Installed-Size: 91013
qemu-user-static_6.1+dfsg-8+b2_x32.deb
Package: qemu-user-static
Source: qemu (1:6.1+dfsg-8)
Version: 1:6.1+dfsg-8+b2
Architecture: x32
Maintainer: Debian QEMU Team <[email protected]>
Installed-Size: 268968
qemu-system-ppc_6.1+dfsg-8+b2_x32.deb
Package: qemu-system-ppc
Source: qemu (1:6.1+dfsg-8)
Version: 1:6.1+dfsg-8+b2
Architecture: x32
Maintainer: Debian QEMU Team <[email protected]>
Installed-Size: 25187
...
Re: [PATCH 07/10] configure: unify x86_64 and x32
In reply to Paolo BonziniQuoted 7 lines · Paolo Bonzini
The only difference between the two, as far as either configure or Meson are concerned, is in the multilib flags passed to the compiler.
For QEMU, this fixes the handling of
TYPE_OLDDEVTininclude/exec/user/thunk.hand enables testing of dirty ring buffer, because both are usingHOST_X86_64.
Quoted 8 lines
For tests/tcg, this means that on a hypothetical x32 host the cross compiler will not be used to build the tests.
Signed-off-by Paolo Bonzini <[email protected]>--- configure | 6 ++---- meson.build | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-)
r~
PATCH 8/10 meson: rename "arch" variable
In reply to Paolo BonziniAvoid confusion between the ARCH variable of configure/config-host.mak and the same-named variable of meson.build.
--- meson.build | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
meson.build +6 -6
@@ -2845,7 +2845,7 @@ emulators = {} foreach target : target_dirs config_target = config_target_mak[target] target_name = config_target['TARGET_NAME'] - arch = config_target['TARGET_BASE_ARCH'] + target_base_arch = config_target['TARGET_BASE_ARCH'] arch_srcs = [config_target_h[target]] arch_deps = [] c_args = ['-DNEED_CPU_H',
@@ -2861,11 +2861,11 @@ foreach target : target_dirs if target.endswith('-softmmu') qemu_target_name = 'qemu-system-' + target_name target_type='system' - t = target_softmmu_arch[arch].apply(config_target, strict: false) + t = target_softmmu_arch[target_base_arch].apply(config_target, strict: false) arch_srcs += t.sources() arch_deps += t.dependencies() - hw_dir = target_name == 'sparc64' ? 'sparc64' : arch + hw_dir = target_name == 'sparc64' ? 'sparc64' : target_base_arch hw = hw_arch[hw_dir].apply(config_target, strict: false) arch_srcs += hw.sources() arch_deps += hw.dependencies()
@@ -2876,8 +2876,8 @@ foreach target : target_dirs abi = config_target['TARGET_ABI_DIR'] target_type='user' qemu_target_name = 'qemu-' + target_name - if arch in target_user_arch - t = target_user_arch[arch].apply(config_target, strict: false) + if target_base_arch in target_user_arch + t = target_user_arch[target_base_arch].apply(config_target, strict: false) arch_srcs += t.sources() arch_deps += t.dependencies() endif
@@ -2915,7 +2915,7 @@ foreach target : target_dirs arch_srcs += gdbstub_xml endif - t = target_arch[arch].apply(config_target, strict: false) + t = target_arch[target_base_arch].apply(config_target, strict: false) arch_srcs += t.sources() arch_deps += t.dependencies()
Signature · 1 line
2.33.1
Re: [PATCH 08/10] meson: rename "arch" variable
Quoted 7 lines · Paolo Bonzini
Avoid confusion between the ARCH variable of configure/config-host.mak and the same-named variable of meson.build.
Signed-off-by Paolo Bonzini <[email protected]>--- meson.build | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
Re: [PATCH 08/10] meson: rename "arch" variable
In reply to Paolo BonziniQuoted 7 lines · Paolo Bonzini
Avoid confusion between the ARCH variable of configure/config-host.mak and the same-named variable of meson.build.
Signed-off-by Paolo Bonzini<[email protected]>--- meson.build | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
r~
PATCH 9/10 configure, meson: move ARCH to meson.build
In reply to Paolo Bonzini$ARCH and the HOST_* symbols are only used by the QEMU build; configure uses $cpu instead. Remove it from config-host.mak.
--- configure | 21 ++++----------------- meson.build | 26 +++++++++++++++++--------- 2 files changed, 21 insertions(+), 26 deletions(-)
configure +4 -17
@@ -634,11 +634,9 @@ else cpu=$(uname -m) fi -ARCH= -# Normalise host CPU name, set ARCH and multilib cflags +# Normalise host CPU name, set multilib cflags # Note that this case should only have supported host CPUs, not guests. case "$cpu" in - aarch64|riscv) ;; armv*b|armv*l|arm) cpu="arm" ;;
@@ -667,8 +665,7 @@ case "$cpu" in CPU_CFLAGS="-m64 -mlittle" ;; s390) - CPU_CFLAGS="-m31" - ARCH=unknown ;; + CPU_CFLAGS="-m31" ;; s390x) CPU_CFLAGS="-m64" ;;
@@ -677,15 +674,7 @@ case "$cpu" in CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" ;; sparc64) CPU_CFLAGS="-m64 -mcpu=ultrasparc" ;; - - *) - # This will result in either an error or falling back to TCI later - ARCH=unknown - ;; esac -if test -z "$ARCH"; then - ARCH="$cpu" -fi : ${make=${MAKE-make}}
@@ -3432,8 +3421,6 @@ echo "GIT=$git" >> $config_host_mak echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak -echo "ARCH=$ARCH" >> $config_host_mak - if test "$debug_tcg" = "yes" ; then echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak fi
@@ -3914,12 +3901,12 @@ if test "$skip_meson" = no; then cross_arg="--cross-file config-meson.cross" echo "[host_machine]" >> $cross echo "system = '$targetos'" >> $cross - case "$ARCH" in + case "$cpu" in i386) echo "cpu_family = 'x86'" >> $cross ;; *) - echo "cpu_family = '$ARCH'" >> $cross + echo "cpu_family = '$cpu'" >> $cross ;; esac echo "cpu = '$cpu'" >> $cross
meson.build +17 -9
@@ -67,6 +67,14 @@ endif targetos = host_machine.system() +if cpu not in supported_cpus + host_arch = 'unknown' +elif cpu == 'x86' + host_arch = 'i386' +else + host_arch = cpu +endif + if cpu in ['x86', 'x86_64'] kvm_targets = ['i386-softmmu', 'x86_64-softmmu'] elif cpu == 'aarch64'
@@ -335,9 +343,9 @@ if targetos == 'netbsd' endif endif -tcg_arch = config_host['ARCH'] +tcg_arch = host_arch if not get_option('tcg').disabled() - if cpu not in supported_cpus + if host_arch == 'unknown' if get_option('tcg_interpreter') warning('Unsupported CPU @0@, will use TCG with TCI (slow)'.format(cpu)) else
@@ -353,11 +361,11 @@ if not get_option('tcg').disabled() endif if get_option('tcg_interpreter') tcg_arch = 'tci' - elif config_host['ARCH'] == 'sparc64' + elif host_arch == 'sparc64' tcg_arch = 'sparc' - elif config_host['ARCH'] == 'x86_64' + elif host_arch == 'x86_64' tcg_arch = 'i386' - elif config_host['ARCH'] == 'ppc64' + elif host_arch == 'ppc64' tcg_arch = 'ppc' endif add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch,
@@ -1422,6 +1430,8 @@ config_host_data.set_quoted('CONFIG_QEMU_LOCALSTATEDIR', get_option('prefix') / config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') / qemu_moddir) config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_option('sysconfdir')) +config_host_data.set('HOST_' + host_arch.to_upper(), 1) + config_host_data.set('CONFIG_ATTR', libattr.found()) config_host_data.set('CONFIG_BRLAPI', brlapi.found()) config_host_data.set('CONFIG_COCOA', cocoa.found())
@@ -1770,8 +1780,6 @@ foreach k, v: config_host v = '"' + '", "'.join(v.split()) + '", ' endif config_host_data.set(k, v) - elif k == 'ARCH' - config_host_data.set('HOST_' + v.to_upper(), 1) elif strings.contains(k) config_host_data.set_quoted(k, v) elif k.startswith('CONFIG_')
@@ -1914,7 +1922,7 @@ foreach target : target_dirs endif foreach k, v: disassemblers - if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k) + if host_arch.startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k) foreach sym: v config_target += { sym: 'y' } config_all_disas += { sym: 'y' }
@@ -2883,7 +2891,7 @@ foreach target : target_dirs endif if 'CONFIG_LINUX_USER' in config_target base_dir = 'linux-user' - target_inc += include_directories('linux-user/host/' / config_host['ARCH']) + target_inc += include_directories('linux-user/host/' / host_arch) endif if 'CONFIG_BSD_USER' in config_target base_dir = 'bsd-user'
Signature · 1 line
2.33.1
Re: [PATCH 09/10] configure, meson: move ARCH to meson.build
meson.build foreach target : target_dirs · line 1925
Quoted 2 lines · Paolo Bonzini
meson.build +1
-1- if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k) + if host_arch.startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
Not a problem with this patch, but a missed use of target_base_arch variable?
Anyway,
r~
PATCH 10/10 configure: remove unnecessary symlinks
In reply to Paolo BonziniMake pc-bios/meson.build use the files in the source tree as inputs to bzip2.
--- configure | 1 - pc-bios/meson.build | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
configure +0 -1
@@ -3817,7 +3817,6 @@ for bios_file in \ $source_path/pc-bios/*.img \ $source_path/pc-bios/openbios-* \ $source_path/pc-bios/u-boot.* \ - $source_path/pc-bios/edk2-*.fd.bz2 \ $source_path/pc-bios/palcode-* \ $source_path/pc-bios/qemu_vga.ndrv
pc-bios/meson.build +1 -1
@@ -15,7 +15,7 @@ if unpack_edk2_blobs roms += custom_target(f, build_by_default: have_system, output: f, - input: '@[email protected]'.format(f), + input: files('@[email protected]'.format(f)), capture: true, install: get_option('install_blobs'), install_dir: qemu_datadir,
Signature · 1 line
2.33.1
Re: [PATCH 10/10] configure: remove unnecessary symlinks
Quoted 8 lines · Paolo Bonzini
Make pc-bios/meson.build use the files in the source tree as inputs to bzip2.
Signed-off-by Paolo Bonzini<[email protected]>--- configure | 1 - pc-bios/meson.build | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
r~