All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] configure cleanups, mostly wrt $cpu and $targetos
@ 2021-12-16  8:51 Paolo Bonzini
  2021-12-16  8:51 ` [PATCH 01/10] configure: simplify creation of plugin symbol list Paolo Bonzini
                   ` (9 more replies)
  0 siblings, 10 replies; 27+ messages in thread
From: Paolo Bonzini @ 2021-12-16  8:51 UTC (permalink / raw)
  To: qemu-devel

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(-)

-- 
2.33.1



^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 01/10] configure: simplify creation of plugin symbol list
  2021-12-16  8:51 [PATCH 00/10] configure cleanups, mostly wrt $cpu and $targetos Paolo Bonzini
@ 2021-12-16  8:51 ` Paolo Bonzini
  2021-12-17 20:42   ` Richard Henderson
  2021-12-16  8:51 ` [PATCH 02/10] configure: make $targetos lowercase, use windows instead of MINGW32 Paolo Bonzini
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 27+ messages in thread
From: Paolo Bonzini @ 2021-12-16  8:51 UTC (permalink / raw)
  To: qemu-devel

--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.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure           | 16 ----------------
 plugins/meson.build | 13 +++++++++----
 2 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/configure b/configure
index d3aac031a5..ba7ab435a6 100755
--- a/configure
+++ b/configure
@@ -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
diff --git a/plugins/meson.build b/plugins/meson.build
index b3de57853b..eec10283c5 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -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
 
-- 
2.33.1




^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 02/10] configure: make $targetos lowercase, use windows instead of MINGW32
  2021-12-16  8:51 [PATCH 00/10] configure cleanups, mostly wrt $cpu and $targetos Paolo Bonzini
  2021-12-16  8:51 ` [PATCH 01/10] configure: simplify creation of plugin symbol list Paolo Bonzini
@ 2021-12-16  8:51 ` Paolo Bonzini
  2021-12-17 20:44   ` Richard Henderson
  2021-12-16  8:51 ` [PATCH 03/10] configure: move target detection before CPU detection Paolo Bonzini
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 27+ messages in thread
From: Paolo Bonzini @ 2021-12-16  8:51 UTC (permalink / raw)
  To: qemu-devel

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 <pbonzini@redhat.com>
---
 configure | 58 ++++++++++++++++++++++++-------------------------------
 1 file changed, 25 insertions(+), 33 deletions(-)

diff --git a/configure b/configure
index ba7ab435a6..63438c1900 100755
--- a/configure
+++ b/configure
@@ -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
-- 
2.33.1




^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 03/10] configure: move target detection before CPU detection
  2021-12-16  8:51 [PATCH 00/10] configure cleanups, mostly wrt $cpu and $targetos Paolo Bonzini
  2021-12-16  8:51 ` [PATCH 01/10] configure: simplify creation of plugin symbol list Paolo Bonzini
  2021-12-16  8:51 ` [PATCH 02/10] configure: make $targetos lowercase, use windows instead of MINGW32 Paolo Bonzini
@ 2021-12-16  8:51 ` Paolo Bonzini
  2021-12-16  8:51 ` [PATCH 04/10] configure: do not set bsd_user/linux_user early Paolo Bonzini
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2021-12-16  8:51 UTC (permalink / raw)
  To: qemu-devel

This makes more sense, since target detection can affect CPU detection
on Solaris.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 115 ++++++++++++++++++++++++++----------------------------
 1 file changed, 55 insertions(+), 60 deletions(-)

diff --git a/configure b/configure
index 63438c1900..157691d99e 100755
--- a/configure
+++ b/configure
@@ -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
-- 
2.33.1




^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 04/10] configure: do not set bsd_user/linux_user early
  2021-12-16  8:51 [PATCH 00/10] configure cleanups, mostly wrt $cpu and $targetos Paolo Bonzini
                   ` (2 preceding siblings ...)
  2021-12-16  8:51 ` [PATCH 03/10] configure: move target detection before CPU detection Paolo Bonzini
@ 2021-12-16  8:51 ` Paolo Bonzini
  2021-12-17 20:49   ` Richard Henderson
  2021-12-16  8:51 ` [PATCH 05/10] configure: unify two case statements on $cpu Paolo Bonzini
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 27+ messages in thread
From: Paolo Bonzini @ 2021-12-16  8:51 UTC (permalink / raw)
  To: qemu-devel

Similar 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.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/configure b/configure
index 157691d99e..a774086891 100755
--- a/configure
+++ b/configure
@@ -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
-- 
2.33.1




^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 05/10] configure: unify two case statements on $cpu
  2021-12-16  8:51 [PATCH 00/10] configure cleanups, mostly wrt $cpu and $targetos Paolo Bonzini
                   ` (3 preceding siblings ...)
  2021-12-16  8:51 ` [PATCH 04/10] configure: do not set bsd_user/linux_user early Paolo Bonzini
@ 2021-12-16  8:51 ` Paolo Bonzini
  2021-12-17 21:37   ` Richard Henderson
  2021-12-16  8:51 ` [PATCH 06/10] configure: unify ppc64 and ppc64le Paolo Bonzini
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 27+ messages in thread
From: Paolo Bonzini @ 2021-12-16  8:51 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 67 ++++++++++++++++++++++++++-----------------------------
 1 file changed, 32 insertions(+), 35 deletions(-)

diff --git a/configure b/configure
index a774086891..65df8d02d9 100755
--- a/configure
+++ b/configure
@@ -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}"
-- 
2.33.1




^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 06/10] configure: unify ppc64 and ppc64le
  2021-12-16  8:51 [PATCH 00/10] configure cleanups, mostly wrt $cpu and $targetos Paolo Bonzini
                   ` (4 preceding siblings ...)
  2021-12-16  8:51 ` [PATCH 05/10] configure: unify two case statements on $cpu Paolo Bonzini
@ 2021-12-16  8:51 ` Paolo Bonzini
  2021-12-16  9:06   ` Philippe Mathieu-Daudé
  2021-12-17 21:43   ` Richard Henderson
  2021-12-16  8:51 ` [PATCH 07/10] configure: unify x86_64 and x32 Paolo Bonzini
                   ` (3 subsequent siblings)
  9 siblings, 2 replies; 27+ messages in thread
From: Paolo Bonzini @ 2021-12-16  8:51 UTC (permalink / raw)
  To: qemu-devel

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.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure              | 10 ++++------
 tests/tcg/configure.sh |  4 +++-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index 65df8d02d9..741ff99f4f 100755
--- a/configure
+++ b/configure
@@ -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
             ;;
diff --git a/tests/tcg/configure.sh b/tests/tcg/configure.sh
index 9b76f58258..9ef913df5b 100755
--- a/tests/tcg/configure.sh
+++ b/tests/tcg/configure.sh
@@ -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"}
-- 
2.33.1




^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 07/10] configure: unify x86_64 and x32
  2021-12-16  8:51 [PATCH 00/10] configure cleanups, mostly wrt $cpu and $targetos Paolo Bonzini
                   ` (5 preceding siblings ...)
  2021-12-16  8:51 ` [PATCH 06/10] configure: unify ppc64 and ppc64le Paolo Bonzini
@ 2021-12-16  8:51 ` Paolo Bonzini
  2021-12-16  9:10   ` Philippe Mathieu-Daudé
  2021-12-17 21:46   ` Richard Henderson
  2021-12-16  8:51 ` [PATCH 08/10] meson: rename "arch" variable Paolo Bonzini
                   ` (2 subsequent siblings)
  9 siblings, 2 replies; 27+ messages in thread
From: Paolo Bonzini @ 2021-12-16  8:51 UTC (permalink / raw)
  To: qemu-devel

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_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.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure   | 6 ++----
 meson.build | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index 741ff99f4f..741c33c7ad 100755
--- a/configure
+++ b/configure
@@ -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
             ;;
diff --git a/meson.build b/meson.build
index 96de1a6ef9..903d4f3b10 100644
--- a/meson.build
+++ b/meson.build
@@ -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'],
-- 
2.33.1




^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 08/10] meson: rename "arch" variable
  2021-12-16  8:51 [PATCH 00/10] configure cleanups, mostly wrt $cpu and $targetos Paolo Bonzini
                   ` (6 preceding siblings ...)
  2021-12-16  8:51 ` [PATCH 07/10] configure: unify x86_64 and x32 Paolo Bonzini
@ 2021-12-16  8:51 ` Paolo Bonzini
  2021-12-16  9:10   ` Philippe Mathieu-Daudé
  2021-12-17 21:49   ` Richard Henderson
  2021-12-16  8:51 ` [PATCH 09/10] configure, meson: move ARCH to meson.build Paolo Bonzini
  2021-12-16  8:51 ` [PATCH 10/10] configure: remove unnecessary symlinks Paolo Bonzini
  9 siblings, 2 replies; 27+ messages in thread
From: Paolo Bonzini @ 2021-12-16  8:51 UTC (permalink / raw)
  To: qemu-devel

Avoid confusion between the ARCH variable of configure/config-host.mak
and the same-named variable of meson.build.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/meson.build b/meson.build
index 903d4f3b10..677ab1b57d 100644
--- a/meson.build
+++ b/meson.build
@@ -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()
 
-- 
2.33.1




^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 09/10] configure, meson: move ARCH to meson.build
  2021-12-16  8:51 [PATCH 00/10] configure cleanups, mostly wrt $cpu and $targetos Paolo Bonzini
                   ` (7 preceding siblings ...)
  2021-12-16  8:51 ` [PATCH 08/10] meson: rename "arch" variable Paolo Bonzini
@ 2021-12-16  8:51 ` Paolo Bonzini
  2021-12-17 22:02   ` Richard Henderson
  2021-12-16  8:51 ` [PATCH 10/10] configure: remove unnecessary symlinks Paolo Bonzini
  9 siblings, 1 reply; 27+ messages in thread
From: Paolo Bonzini @ 2021-12-16  8:51 UTC (permalink / raw)
  To: qemu-devel

$ARCH and the HOST_* symbols are only used by the QEMU build; configure
uses $cpu instead.  Remove it from config-host.mak.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure   | 21 ++++-----------------
 meson.build | 26 +++++++++++++++++---------
 2 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/configure b/configure
index 741c33c7ad..2cecbd4c66 100755
--- a/configure
+++ b/configure
@@ -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
diff --git a/meson.build b/meson.build
index 677ab1b57d..93f296e283 100644
--- a/meson.build
+++ b/meson.build
@@ -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'
-- 
2.33.1




^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 10/10] configure: remove unnecessary symlinks
  2021-12-16  8:51 [PATCH 00/10] configure cleanups, mostly wrt $cpu and $targetos Paolo Bonzini
                   ` (8 preceding siblings ...)
  2021-12-16  8:51 ` [PATCH 09/10] configure, meson: move ARCH to meson.build Paolo Bonzini
@ 2021-12-16  8:51 ` Paolo Bonzini
  2021-12-17 22:03   ` Richard Henderson
  9 siblings, 1 reply; 27+ messages in thread
From: Paolo Bonzini @ 2021-12-16  8:51 UTC (permalink / raw)
  To: qemu-devel

Make pc-bios/meson.build use the files in the source tree as inputs
to bzip2.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure           | 1 -
 pc-bios/meson.build | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/configure b/configure
index 2cecbd4c66..7751cc31b8 100755
--- a/configure
+++ b/configure
@@ -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
 
diff --git a/pc-bios/meson.build b/pc-bios/meson.build
index b40ff3f2bd..1812a4084f 100644
--- a/pc-bios/meson.build
+++ b/pc-bios/meson.build
@@ -15,7 +15,7 @@ if unpack_edk2_blobs
     roms += custom_target(f,
                   build_by_default: have_system,
                   output: f,
-                  input: '@0@.bz2'.format(f),
+                  input: files('@0@.bz2'.format(f)),
                   capture: true,
                   install: get_option('install_blobs'),
                   install_dir: qemu_datadir,
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [PATCH 06/10] configure: unify ppc64 and ppc64le
  2021-12-16  8:51 ` [PATCH 06/10] configure: unify ppc64 and ppc64le Paolo Bonzini
@ 2021-12-16  9:06   ` Philippe Mathieu-Daudé
  2021-12-17 21:43   ` Richard Henderson
  1 sibling, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-12-16  9:06 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 12/16/21 09:51, Paolo Bonzini wrote:
> 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.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure              | 10 ++++------
>  tests/tcg/configure.sh |  4 +++-
>  2 files changed, 7 insertions(+), 7 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 07/10] configure: unify x86_64 and x32
  2021-12-16  8:51 ` [PATCH 07/10] configure: unify x86_64 and x32 Paolo Bonzini
@ 2021-12-16  9:10   ` Philippe Mathieu-Daudé
  2021-12-16 15:30     ` Paolo Bonzini
  2021-12-17 21:46   ` Richard Henderson
  1 sibling, 1 reply; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-12-16  9:10 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 12/16/21 09:51, Paolo Bonzini wrote:
> 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_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.

Why not add the cross compiler definitions to tests/tcg?

+: ${cross_cc_x32="$cross_cc_x86_64"}
+: ${cross_cc_cflags_x32="-mx32"}

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure   | 6 ++----
>  meson.build | 3 +--
>  2 files changed, 3 insertions(+), 6 deletions(-)



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 08/10] meson: rename "arch" variable
  2021-12-16  8:51 ` [PATCH 08/10] meson: rename "arch" variable Paolo Bonzini
@ 2021-12-16  9:10   ` Philippe Mathieu-Daudé
  2021-12-17 21:49   ` Richard Henderson
  1 sibling, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-12-16  9:10 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 12/16/21 09:51, Paolo Bonzini wrote:
> Avoid confusion between the ARCH variable of configure/config-host.mak
> and the same-named variable of meson.build.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  meson.build | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 07/10] configure: unify x86_64 and x32
  2021-12-16  9:10   ` Philippe Mathieu-Daudé
@ 2021-12-16 15:30     ` Paolo Bonzini
  2021-12-17 21:48       ` Richard Henderson
  0 siblings, 1 reply; 27+ messages in thread
From: Paolo Bonzini @ 2021-12-16 15:30 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel

On 12/16/21 10:10, Philippe Mathieu-Daudé wrote:
> On 12/16/21 09:51, Paolo Bonzini wrote:
>> 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_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.
> 
> 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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/10] configure: simplify creation of plugin symbol list
  2021-12-16  8:51 ` [PATCH 01/10] configure: simplify creation of plugin symbol list Paolo Bonzini
@ 2021-12-17 20:42   ` Richard Henderson
  0 siblings, 0 replies; 27+ messages in thread
From: Richard Henderson @ 2021-12-17 20:42 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 12/16/21 12:51 AM, Paolo Bonzini wrote:
> --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.
> 
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   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~


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 02/10] configure: make $targetos lowercase, use windows instead of MINGW32
  2021-12-16  8:51 ` [PATCH 02/10] configure: make $targetos lowercase, use windows instead of MINGW32 Paolo Bonzini
@ 2021-12-17 20:44   ` Richard Henderson
  0 siblings, 0 replies; 27+ messages in thread
From: Richard Henderson @ 2021-12-17 20:44 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 12/16/21 12:51 AM, Paolo Bonzini wrote:
> 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<pbonzini@redhat.com>
> ---
>   configure | 58 ++++++++++++++++++++++++-------------------------------
>   1 file changed, 25 insertions(+), 33 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 04/10] configure: do not set bsd_user/linux_user early
  2021-12-16  8:51 ` [PATCH 04/10] configure: do not set bsd_user/linux_user early Paolo Bonzini
@ 2021-12-17 20:49   ` Richard Henderson
  2021-12-18 10:16     ` Paolo Bonzini
  0 siblings, 1 reply; 27+ messages in thread
From: Richard Henderson @ 2021-12-17 20:49 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 12/16/21 12:51 AM, Paolo Bonzini wrote:
> @@ -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
...
> +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

Missing the check for $targetos = freebsd.
This looks like it would enable bsd_user on linux, etc.


r~


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 05/10] configure: unify two case statements on $cpu
  2021-12-16  8:51 ` [PATCH 05/10] configure: unify two case statements on $cpu Paolo Bonzini
@ 2021-12-17 21:37   ` Richard Henderson
  0 siblings, 0 replies; 27+ messages in thread
From: Richard Henderson @ 2021-12-17 21:37 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 12/16/21 12:51 AM, Paolo Bonzini wrote:
> +  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,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 06/10] configure: unify ppc64 and ppc64le
  2021-12-16  8:51 ` [PATCH 06/10] configure: unify ppc64 and ppc64le Paolo Bonzini
  2021-12-16  9:06   ` Philippe Mathieu-Daudé
@ 2021-12-17 21:43   ` Richard Henderson
  1 sibling, 0 replies; 27+ messages in thread
From: Richard Henderson @ 2021-12-17 21:43 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 12/16/21 12:51 AM, Paolo Bonzini wrote:
> 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.
> 
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   configure              | 10 ++++------
>   tests/tcg/configure.sh |  4 +++-
>   2 files changed, 7 insertions(+), 7 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 07/10] configure: unify x86_64 and x32
  2021-12-16  8:51 ` [PATCH 07/10] configure: unify x86_64 and x32 Paolo Bonzini
  2021-12-16  9:10   ` Philippe Mathieu-Daudé
@ 2021-12-17 21:46   ` Richard Henderson
  1 sibling, 0 replies; 27+ messages in thread
From: Richard Henderson @ 2021-12-17 21:46 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 12/16/21 12:51 AM, Paolo Bonzini wrote:
> 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_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.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   configure   | 6 ++----
>   meson.build | 3 +--
>   2 files changed, 3 insertions(+), 6 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 07/10] configure: unify x86_64 and x32
  2021-12-16 15:30     ` Paolo Bonzini
@ 2021-12-17 21:48       ` Richard Henderson
  2021-12-20  9:52         ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 27+ messages in thread
From: Richard Henderson @ 2021-12-17 21:48 UTC (permalink / raw)
  To: Paolo Bonzini, Philippe Mathieu-Daudé, qemu-devel

On 12/16/21 7:30 AM, Paolo Bonzini wrote:
> On 12/16/21 10:10, Philippe Mathieu-Daudé wrote:
>> On 12/16/21 09:51, Paolo Bonzini wrote:
>>> 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_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.
>>
>> 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.


> 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~


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 08/10] meson: rename "arch" variable
  2021-12-16  8:51 ` [PATCH 08/10] meson: rename "arch" variable Paolo Bonzini
  2021-12-16  9:10   ` Philippe Mathieu-Daudé
@ 2021-12-17 21:49   ` Richard Henderson
  1 sibling, 0 replies; 27+ messages in thread
From: Richard Henderson @ 2021-12-17 21:49 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 12/16/21 12:51 AM, Paolo Bonzini wrote:
> Avoid confusion between the ARCH variable of configure/config-host.mak
> and the same-named variable of meson.build.
> 
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   meson.build | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 09/10] configure, meson: move ARCH to meson.build
  2021-12-16  8:51 ` [PATCH 09/10] configure, meson: move ARCH to meson.build Paolo Bonzini
@ 2021-12-17 22:02   ` Richard Henderson
  0 siblings, 0 replies; 27+ messages in thread
From: Richard Henderson @ 2021-12-17 22:02 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 12/16/21 12:51 AM, Paolo Bonzini wrote:
> -    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,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 10/10] configure: remove unnecessary symlinks
  2021-12-16  8:51 ` [PATCH 10/10] configure: remove unnecessary symlinks Paolo Bonzini
@ 2021-12-17 22:03   ` Richard Henderson
  0 siblings, 0 replies; 27+ messages in thread
From: Richard Henderson @ 2021-12-17 22:03 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 12/16/21 12:51 AM, Paolo Bonzini wrote:
> Make pc-bios/meson.build use the files in the source tree as inputs
> to bzip2.
> 
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   configure           | 1 -
>   pc-bios/meson.build | 2 +-
>   2 files changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 04/10] configure: do not set bsd_user/linux_user early
  2021-12-17 20:49   ` Richard Henderson
@ 2021-12-18 10:16     ` Paolo Bonzini
  0 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2021-12-18 10:16 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel

On 12/17/21 21:49, Richard Henderson wrote:
> On 12/16/21 12:51 AM, Paolo Bonzini wrote:
>> @@ -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
> ...
>> +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
> 
> Missing the check for $targetos = freebsd.
> This looks like it would enable bsd_user on 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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 07/10] configure: unify x86_64 and x32
  2021-12-17 21:48       ` Richard Henderson
@ 2021-12-20  9:52         ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-12-20  9:52 UTC (permalink / raw)
  To: Richard Henderson, Paolo Bonzini, qemu-devel

On 12/17/21 22:48, Richard Henderson wrote:
> On 12/16/21 7:30 AM, Paolo Bonzini wrote:
>> On 12/16/21 10:10, Philippe Mathieu-Daudé wrote:
>>> On 12/16/21 09:51, Paolo Bonzini wrote:
>>>> 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_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.
>>>
>>> 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.
> 
> 
>> 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 <pkg-qemu-devel@lists.alioth.debian.org>
 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 <pkg-qemu-devel@lists.alioth.debian.org>
 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 <pkg-qemu-devel@lists.alioth.debian.org>
 Installed-Size: 25187

...



^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2021-12-20 16:00 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16  8:51 [PATCH 00/10] configure cleanups, mostly wrt $cpu and $targetos Paolo Bonzini
2021-12-16  8:51 ` [PATCH 01/10] configure: simplify creation of plugin symbol list Paolo Bonzini
2021-12-17 20:42   ` Richard Henderson
2021-12-16  8:51 ` [PATCH 02/10] configure: make $targetos lowercase, use windows instead of MINGW32 Paolo Bonzini
2021-12-17 20:44   ` Richard Henderson
2021-12-16  8:51 ` [PATCH 03/10] configure: move target detection before CPU detection Paolo Bonzini
2021-12-16  8:51 ` [PATCH 04/10] configure: do not set bsd_user/linux_user early Paolo Bonzini
2021-12-17 20:49   ` Richard Henderson
2021-12-18 10:16     ` Paolo Bonzini
2021-12-16  8:51 ` [PATCH 05/10] configure: unify two case statements on $cpu Paolo Bonzini
2021-12-17 21:37   ` Richard Henderson
2021-12-16  8:51 ` [PATCH 06/10] configure: unify ppc64 and ppc64le Paolo Bonzini
2021-12-16  9:06   ` Philippe Mathieu-Daudé
2021-12-17 21:43   ` Richard Henderson
2021-12-16  8:51 ` [PATCH 07/10] configure: unify x86_64 and x32 Paolo Bonzini
2021-12-16  9:10   ` Philippe Mathieu-Daudé
2021-12-16 15:30     ` Paolo Bonzini
2021-12-17 21:48       ` Richard Henderson
2021-12-20  9:52         ` Philippe Mathieu-Daudé
2021-12-17 21:46   ` Richard Henderson
2021-12-16  8:51 ` [PATCH 08/10] meson: rename "arch" variable Paolo Bonzini
2021-12-16  9:10   ` Philippe Mathieu-Daudé
2021-12-17 21:49   ` Richard Henderson
2021-12-16  8:51 ` [PATCH 09/10] configure, meson: move ARCH to meson.build Paolo Bonzini
2021-12-17 22:02   ` Richard Henderson
2021-12-16  8:51 ` [PATCH 10/10] configure: remove unnecessary symlinks Paolo Bonzini
2021-12-17 22:03   ` Richard Henderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.