]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
LoongArch: fmv: Fix compilation errors when using glibc versions earlier than 2.38.
authorLulu Cheng <chenglulu@loongson.cn>
Mon, 24 Nov 2025 09:03:49 +0000 (17:03 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Thu, 27 Nov 2025 01:49:52 +0000 (09:49 +0800)
The macros HWCAP_LOONGARCH_LSX and HWCAP_LOONGARCH_LASX were defined
in glibc 2.38.  However, r16-5155 uses these two macros directly
without checking whether they are defined.  This causes errors when
compiling libgcc with glibc versions earlier than 2.38.

gcc/ChangeLog:

* doc/extend.texi: Remove the incorrect prompt message.

libgcc/ChangeLog:

* config/loongarch/cpuinfo.c (HWCAP_LOONGARCH_LSX): Define
it if it is not defined.
(HWCAP_LOONGARCH_LASX): Likewise.

gcc/doc/extend.texi
libgcc/config/loongarch/cpuinfo.c

index cc414313884b1f208ae42c4a7d6f283ba37c903e..11f6b02db366e59b483b76725d2849fc03185bdd 100644 (file)
@@ -5015,8 +5015,6 @@ from the code model of the callee function.
 Like attribute @code{target}, these options also reflect the behavior of
 similar command line options.
 
-Note that this attribute requires GLIBC2.38 and newer that support HWCAP.
-
 @code{string} can take the following values:
 
 @itemize @bullet
index 293eb52f047a6eafc72dff9b5cfafc77e449a2e6..a398bcbff1228e42d937d63a2a031fc6bc14c81b 100644 (file)
@@ -73,6 +73,17 @@ __init_loongarch_features_resolver (void)
   if (CPUCFG3 & CPUCFG3_LD_SEQ_SA)
     setCPUFeature (FEAT_LD_SEQ_SA);
 
+/* The macros HWCAP_LOONGARCH_LSX and HWCAP_LOONGARCH_LASX are not defined
+   in glibc versions earlier than 2.38.  If these two macros are not defined,
+   define them with reference to asm/hwcap.h.  */
+#ifndef HWCAP_LOONGARCH_LSX
+#define HWCAP_LOONGARCH_LSX             (1 << 4)
+#endif
+
+#ifndef HWCAP_LOONGARCH_LASX
+#define HWCAP_LOONGARCH_LASX            (1 << 5)
+#endif
+
   /* LSX and LASX can be disabled/enabled by kernel: on some old kernel
      versions the vector context switch wasn't implemented and so they are
      always disabled, and on Linux >= 6.18-rc1 the user can pass simd=