Simon Josefsson wrote:
> checking build system type... loongarch64-unknown-linux-gnu
> checking host system type... loongarch64-unknown-linux-gnu
> ...
> checking 32-bit host C ABI... no
> 
> Isn't that the right result?

Right. That is as expected on loongarch64 machines.

> > --- guile-fibers-1.3.1.orig/configure
> > +++ guile-fibers-1.3.1/configure
> > @@ -7134,6 +7134,26 @@ ia64-*-hpux*)
> >    fi
> >    rm -rf conftest*
> >    ;;
> > +         loong64 | loongarch64 )

This line is not right: As can be seen from config.guess and config.sub,
'loong64' is not a valid CPU.

> > +           # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d.

This line is partially correct. According to [1] table 6, the names
of the 6 ABIs are:
  ilp32s, ilp32f, ilp32d, lp64s, lp64f, lp64d

> > +           # Size of 'long' and 'void *':
> > +           cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> > +/* end confdefs.h.  */
> > +#if defined __LP64__
> > +                    int ok;
> > +                  #else
> > +                    error fail
> > +                  #endif

This test is nonsense: According to [1] table 9, cpu = loongarch64 implies
one of the lp64* ABIs. Therefore there is no need to test __LP64__.
As a user, you have to pass --host=loongarch32-linux-gnu when you are using
an ilp32* ABI compiler. It is *WRONG* to pass --host=loongarch64-linux-gnu
when using an ilp32* ABI compiler.

> >  mips64*-*linux*)
> >    # Find out what ABI is being produced by ac_compile, and set linker
> > @@ -13283,7 +13303,7 @@ else $as_nop
> >         case "$gl_cv_host_cpu_c_abi" in
> >           i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 
> > | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc)
> >             gl_cv_host_cpu_c_abi_32bit=yes ;;
> > -         x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | 
> > powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
> > +         x86_64 | alpha | arm64 | hppa64 | ia64 | loongarch64 | mips64 | 
> > powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
> >             gl_cv_host_cpu_c_abi_32bit=no ;;
> >           *)
> >             gl_cv_host_cpu_c_abi_32bit=unknown ;;

This change is correct, but is missing a corresponding change for loongarch32.

I'm applying the patch below instead.

[1] LoongArch toolchain conventions,
    
https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.pdf


2025-02-21  Bruno Haible  <br...@clisp.org>

        host-cpu-c-abi: Improve support for loongarch32.
        Reported by <wuruil...@loongson.cn>
        in <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1098478>
        via Simon Josefsson.
        * m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI): Prepare template for
        __loongarch32__ in config.h.
        (gl_HOST_CPU_C_ABI_32BIT): Speed up the configure test on loongarch*.

diff --git a/m4/host-cpu-c-abi.m4 b/m4/host-cpu-c-abi.m4
index af801e4c66..f97ba73be5 100644
--- a/m4/host-cpu-c-abi.m4
+++ b/m4/host-cpu-c-abi.m4
@@ -1,5 +1,5 @@
 # host-cpu-c-abi.m4
-# serial 18
+# serial 19
 dnl Copyright (C) 2002-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -384,6 +384,9 @@ AC_DEFUN([gl_HOST_CPU_C_ABI]
 #ifndef __ia64__
 #undef __ia64__
 #endif
+#ifndef __loongarch32__
+#undef __loongarch32__
+#endif
 #ifndef __loongarch64__
 #undef __loongarch64__
 #endif
@@ -503,9 +506,9 @@ AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT]
          if test -n "$gl_cv_host_cpu_c_abi"; then
            dnl gl_HOST_CPU_C_ABI has already been run. Use its result.
            case "$gl_cv_host_cpu_c_abi" in
-             i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 
| mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc)
+             i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 
| loongarch32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc)
                gl_cv_host_cpu_c_abi_32bit=yes ;;
-             x86_64 | alpha | arm64 | aarch64c | hppa64 | ia64 | mips64 | 
powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
+             x86_64 | alpha | arm64 | aarch64c | hppa64 | ia64 | loongarch64 | 
mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
                gl_cv_host_cpu_c_abi_32bit=no ;;
              *)
                gl_cv_host_cpu_c_abi_32bit=unknown ;;

Reply via email to