[PATCH v6 11/13] LoongArch: Build Infastructure

caiyinyu caiyinyu@loongson.cn
Wed Jul 13 07:51:19 GMT 2022


在 2022/7/13 上午11:43, WANG Xuerui 写道:
> On 2022/7/13 11:07, Xi Ruoyao wrote:
>> On Fri, 2022-07-08 at 14:52 +0800, caiyinyu wrote:
>>> grlen=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 
>>> 's/^#define __loongarch_grlen \(.*\)/\1/p'`
>> I suggest to use "__loongarch_lp64" for checking ABI grlen. Consider:
>>
>> "gcc -march=la464 -mabi=ilp32d ..."
>>
>> Once ILP32 ABIs are available, will __loongarch_grlen be 64 or 32 in
>> this case, where the hardware has 64-bit registers but the ABI uses them
>> as 32-bit?  Our documentation is not clear about this question and
>> currently we understand __loongarch_grlen as hardware GR length instead
>> of the register length used in ABI [1].
>>
>> [1]:https://github.com/loongson/LoongArch-Documentation/pull/28#discussion_r917364055 
>>
>>
>> OTOH if you think "we should define __loongarch_grlen as the register
>> length for ABI, irrelevant to the hardware", you need to inform your
>> colleagues to clarify it in the doc.
>
> To my intuition it's the hardware GRLEN, but thinking about it harder, 
> there is indeed ambiguity. Some clarification would be useful here.
>
> (BTW, Yinyu, could you keep me CC-ed when sending your next revisions? 
> I'd like to take a quick review to ensure there are as few historical 
> warts as possible when the patchset get updated.)


Fixed, thanks.

 >>>>>>>>>

diff --git a/sysdeps/loongarch/preconfigure b/sysdeps/loongarch/preconfigure
index 489af6f0b7..118963cda6 100644
--- a/sysdeps/loongarch/preconfigure
+++ b/sysdeps/loongarch/preconfigure
@@ -4,7 +4,7 @@
  case "$machine" in
  loongarch*)

-    grlen=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 
's/^#define __loongarch_grlen \(.*\)/\1/p'`
+    abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 
's/^#define __loongarch_\(lp64\|ilp32\).*/\1/p'`
      float_abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 
's/^#define __loongarch_\(soft\|single\|double\)_float.*/\1/p'`

      with_fp_cond="!defined __loongarch_soft_float"
@@ -25,11 +25,12 @@ loongarch*)
         ;;
      esac

-    case "$grlen" in
-    32)
+    case "$abi" in
+    ilp32)
         as_fn_error 1 "loongarch does not yet support ilp32 ABI!!" 
"$LINENO" 5
         ;;
-    64)
+    lp64)
+       grlen=64
         machine=loongarch/lp64
         ;;
      *)
diff --git a/sysdeps/loongarch/preconfigure.ac 
b/sysdeps/loongarch/preconfigure.ac
index 8eb94e9efe..1aba743c15 100644
--- a/sysdeps/loongarch/preconfigure.ac
+++ b/sysdeps/loongarch/preconfigure.ac
@@ -4,7 +4,7 @@ GLIBC_PROVIDES[]dnl See aclocal.m4 in the top level 
source directory.
  case "$machine" in
  loongarch*)

-    grlen=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 
's/^#define __loongarch_grlen \(.*\)/\1/p'`
+    abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 
's/^#define __loongarch_\(lp64\|ilp32\).*/\1/p'`
      float_abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 
's/^#define __loongarch_\(soft\|single\|double\)_float.*/\1/p'`

      with_fp_cond="!defined __loongarch_soft_float"
@@ -25,11 +25,12 @@ loongarch*)
         ;;
      esac

-    case "$grlen" in
-    32)
+    case "$abi" in
+    ilp32)
         AC_MSG_ERROR([loongarch does not yet support ilp32 ABI!!], 1)
         ;;
-    64)
+    lp64)
+       grlen=64
         machine=loongarch/lp64
         ;;
      *)

<<<<<<



More information about the Libc-alpha mailing list