qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] configure: Fix linux-user host detection for riscv64
@ 2023-08-05 18:02 Richard Henderson
  2023-08-07  8:26 ` Joel Stanley
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Henderson @ 2023-08-05 18:02 UTC (permalink / raw)
  To: qemu-devel

Mirror the host_arch variable from meson.build, so that we
probe for the correct linux-user/include/host/ directory.

Fixes: e3e477c3bca0 ("configure: Fix cross-building for RISCV host")
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 configure | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index afb25fd558..98dc78280e 100755
--- a/configure
+++ b/configure
@@ -469,6 +469,13 @@ else
   echo "WARNING: unrecognized host CPU, proceeding with 'uname -m' output '$cpu'"
 fi
 
+case "$cpu" in
+  riscv*)
+    host_arch=riscv ;;
+  *)
+    host_arch="$cpu" ;;
+esac
+
 # Normalise host CPU name and set multilib cflags.  The canonicalization
 # isn't really necessary, because the architectures that we check for
 # should not hit the 'uname -m' case, but better safe than sorry.
@@ -803,7 +810,7 @@ default_target_list=""
 mak_wilds=""
 
 if [ "$linux_user" != no ]; then
-    if [ "$targetos" = linux ] && [ -d "$source_path/linux-user/include/host/$cpu" ]; then
+    if [ "$targetos" = linux ] && [ -d "$source_path/linux-user/include/host/$host_arch" ]; then
         linux_user=yes
     elif [ "$linux_user" = yes ]; then
         error_exit "linux-user not supported on this architecture"
-- 
2.34.1



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

* Re: [PATCH] configure: Fix linux-user host detection for riscv64
  2023-08-05 18:02 [PATCH] configure: Fix linux-user host detection for riscv64 Richard Henderson
@ 2023-08-07  8:26 ` Joel Stanley
  2023-08-07 16:00   ` Richard Henderson
  0 siblings, 1 reply; 5+ messages in thread
From: Joel Stanley @ 2023-08-07  8:26 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel

On Sat, 5 Aug 2023 at 18:02, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Mirror the host_arch variable from meson.build, so that we
> probe for the correct linux-user/include/host/ directory.

This broke all of the linux-user targets for me on a ppc64le host.
None show up when running configure --help, and trying to select one
with --target-list errors out:

  ERROR: Unknown target name 'aarch64-linux-user'

Reverting this patch restores the old behaviour.

This test is the one that fails with the patch applied:

if [ "$linux_user" != no ]; then
    if [ "$targetos" = linux ] && [ -d
"$source_path/linux-user/include/host/$host_arch" ]; then
        linux_user=yes

WIth your patch $host_arch is ppc64le. Previously the line was:

 if [ "$linux_user" != no ]; then
     if [ "$targetos" = linux ] && [ -d
"$source_path/linux-user/include/host/$cpu" ]; then
      linux_user=yes

The directory needs to be /linux-user/include/host/ppc64 for even for ppc64le.

You've put the new test just above the switch statement that does
normalisation of the host CPU name. Could add riscv to that switch
statement instead of adding the host_arch variable?

@@ -508,6 +501,9 @@ case "$cpu" in
     cpu="ppc64"
     CPU_CFLAGS="-m64 -mlittle-endian" ;;

+  riscv*)
+    cpu="riscv" ;;
+
   s390)
     CPU_CFLAGS="-m31" ;;
   s390x)

Cheers,

Joel

>
> Fixes: e3e477c3bca0 ("configure: Fix cross-building for RISCV host")
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  configure | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index afb25fd558..98dc78280e 100755
> --- a/configure
> +++ b/configure
> @@ -469,6 +469,13 @@ else
>    echo "WARNING: unrecognized host CPU, proceeding with 'uname -m' output '$cpu'"
>  fi
>
> +case "$cpu" in
> +  riscv*)
> +    host_arch=riscv ;;
> +  *)
> +    host_arch="$cpu" ;;
> +esac
> +
>  # Normalise host CPU name and set multilib cflags.  The canonicalization
>  # isn't really necessary, because the architectures that we check for
>  # should not hit the 'uname -m' case, but better safe than sorry.
> @@ -803,7 +810,7 @@ default_target_list=""
>  mak_wilds=""
>
>  if [ "$linux_user" != no ]; then
> -    if [ "$targetos" = linux ] && [ -d "$source_path/linux-user/include/host/$cpu" ]; then
> +    if [ "$targetos" = linux ] && [ -d "$source_path/linux-user/include/host/$host_arch" ]; then
>          linux_user=yes
>      elif [ "$linux_user" = yes ]; then
>          error_exit "linux-user not supported on this architecture"
> --
> 2.34.1
>
>


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

* Re: [PATCH] configure: Fix linux-user host detection for riscv64
  2023-08-07  8:26 ` Joel Stanley
@ 2023-08-07 16:00   ` Richard Henderson
  2023-08-07 16:03     ` Peter Maydell
  2023-08-07 16:04     ` Michael Tokarev
  0 siblings, 2 replies; 5+ messages in thread
From: Richard Henderson @ 2023-08-07 16:00 UTC (permalink / raw)
  To: Joel Stanley; +Cc: qemu-devel

On 8/7/23 01:26, Joel Stanley wrote:
> On Sat, 5 Aug 2023 at 18:02, Richard Henderson
> <richard.henderson@linaro.org> wrote:
>>
>> Mirror the host_arch variable from meson.build, so that we
>> probe for the correct linux-user/include/host/ directory.
> 
> This broke all of the linux-user targets for me on a ppc64le host.
> None show up when running configure --help, and trying to select one
> with --target-list errors out:
> 
>    ERROR: Unknown target name 'aarch64-linux-user'
> 
> Reverting this patch restores the old behaviour.
> 
> This test is the one that fails with the patch applied:
> 
> if [ "$linux_user" != no ]; then
>      if [ "$targetos" = linux ] && [ -d
> "$source_path/linux-user/include/host/$host_arch" ]; then
>          linux_user=yes
> 
> WIth your patch $host_arch is ppc64le. Previously the line was:
> 
>   if [ "$linux_user" != no ]; then
>       if [ "$targetos" = linux ] && [ -d
> "$source_path/linux-user/include/host/$cpu" ]; then
>        linux_user=yes
> 
> The directory needs to be /linux-user/include/host/ppc64 for even for ppc64le.
> 
> You've put the new test just above the switch statement that does
> normalisation of the host CPU name. Could add riscv to that switch
> statement instead of adding the host_arch variable?
> 
> @@ -508,6 +501,9 @@ case "$cpu" in
>       cpu="ppc64"
>       CPU_CFLAGS="-m64 -mlittle-endian" ;;
> 
> +  riscv*)
> +    cpu="riscv" ;;
> +
>     s390)
>       CPU_CFLAGS="-m31" ;;
>     s390x)

Grr.  No, I cannot simply do that, because passing "riscv" and not "riscv64" to meson also 
breaks things.  See e3e477c3 and 887cba85.

I'll figure out something else.


r~


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

* Re: [PATCH] configure: Fix linux-user host detection for riscv64
  2023-08-07 16:00   ` Richard Henderson
@ 2023-08-07 16:03     ` Peter Maydell
  2023-08-07 16:04     ` Michael Tokarev
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2023-08-07 16:03 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Joel Stanley, qemu-devel

On Mon, 7 Aug 2023 at 17:01, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 8/7/23 01:26, Joel Stanley wrote:
> > On Sat, 5 Aug 2023 at 18:02, Richard Henderson
> > <richard.henderson@linaro.org> wrote:
> >>
> >> Mirror the host_arch variable from meson.build, so that we
> >> probe for the correct linux-user/include/host/ directory.
> >
> > This broke all of the linux-user targets for me on a ppc64le host.
> > None show up when running configure --help, and trying to select one
> > with --target-list errors out:
> >
> >    ERROR: Unknown target name 'aarch64-linux-user'
> >
> > Reverting this patch restores the old behaviour.
> >
> > This test is the one that fails with the patch applied:
> >
> > if [ "$linux_user" != no ]; then
> >      if [ "$targetos" = linux ] && [ -d
> > "$source_path/linux-user/include/host/$host_arch" ]; then
> >          linux_user=yes
> >
> > WIth your patch $host_arch is ppc64le. Previously the line was:
> >
> >   if [ "$linux_user" != no ]; then
> >       if [ "$targetos" = linux ] && [ -d
> > "$source_path/linux-user/include/host/$cpu" ]; then
> >        linux_user=yes
> >
> > The directory needs to be /linux-user/include/host/ppc64 for even for ppc64le.
> >
> > You've put the new test just above the switch statement that does
> > normalisation of the host CPU name. Could add riscv to that switch
> > statement instead of adding the host_arch variable?
> >
> > @@ -508,6 +501,9 @@ case "$cpu" in
> >       cpu="ppc64"
> >       CPU_CFLAGS="-m64 -mlittle-endian" ;;
> >
> > +  riscv*)
> > +    cpu="riscv" ;;
> > +
> >     s390)
> >       CPU_CFLAGS="-m31" ;;
> >     s390x)
>
> Grr.  No, I cannot simply do that, because passing "riscv" and not "riscv64" to meson also
> breaks things.  See e3e477c3 and 887cba85.
>
> I'll figure out something else.

Did you see Paolo's patchset?
https://patchew.org/QEMU/20230807094807.471646-1-pbonzini@redhat.com/

-- PMM


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

* Re: [PATCH] configure: Fix linux-user host detection for riscv64
  2023-08-07 16:00   ` Richard Henderson
  2023-08-07 16:03     ` Peter Maydell
@ 2023-08-07 16:04     ` Michael Tokarev
  1 sibling, 0 replies; 5+ messages in thread
From: Michael Tokarev @ 2023-08-07 16:04 UTC (permalink / raw)
  To: Richard Henderson, Joel Stanley; +Cc: qemu-devel

07.08.2023 19:00, Richard Henderson пишет:

> I'll figure out something else.

Paolo already sent a patchset, see "linux-user, configure: fix CPU canonicalization"
> r~
> 



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

end of thread, other threads:[~2023-08-07 16:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-05 18:02 [PATCH] configure: Fix linux-user host detection for riscv64 Richard Henderson
2023-08-07  8:26 ` Joel Stanley
2023-08-07 16:00   ` Richard Henderson
2023-08-07 16:03     ` Peter Maydell
2023-08-07 16:04     ` Michael Tokarev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).