[PATCH 07/10] configure: unify x86_64 and x32

Paolo Bonzini posted 10 patches 4 years, 1 month ago
Maintainers: Mahmoud Mandour <ma.mandourr@gmail.com>, "Alex Bennée" <alex.bennee@linaro.org>, Alexandre Iooss <erdnaxe@crans.org>
[PATCH 07/10] configure: unify x86_64 and x32
Posted by Paolo Bonzini 4 years, 1 month ago
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



Re: [PATCH 07/10] configure: unify x86_64 and x32
Posted by Philippe Mathieu-Daudé 4 years, 1 month ago
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(-)


Re: [PATCH 07/10] configure: unify x86_64 and x32
Posted by Paolo Bonzini 4 years, 1 month ago
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

Re: [PATCH 07/10] configure: unify x86_64 and x32
Posted by Richard Henderson 4 years, 1 month ago
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~

Re: [PATCH 07/10] configure: unify x86_64 and x32
Posted by Philippe Mathieu-Daudé 4 years, 1 month ago
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

...


Re: [PATCH 07/10] configure: unify x86_64 and x32
Posted by Richard Henderson 4 years, 1 month ago
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~