From 62c3e8987f3d979f0e880522c17cc094e9e0cb99 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Mon, 25 Aug 2025 02:52:54 +0000 Subject: [PATCH] LoongArch: common sync from upstream --- ...RCH_LSPW-from-Linux-6.12-to-bits-hwc.patch | 25 ++++++++ LoongArch-Update-ulps.patch | 38 ++++++++++++ glibc.spec | 9 ++- ..._GI_XXX-for-strcpy-stpcpy-IFUNC-impl.patch | 61 +++++++++++++++++++ ...e-stpcpy-in-stpcpy-aligned.S-for-rtl.patch | 29 +++++++++ 5 files changed, 161 insertions(+), 1 deletion(-) create mode 100644 Add-HWCAP_LOONGARCH_LSPW-from-Linux-6.12-to-bits-hwc.patch create mode 100644 LoongArch-Update-ulps.patch create mode 100644 loongarch-Drop-__GI_XXX-for-strcpy-stpcpy-IFUNC-impl.patch create mode 100644 loongarch-Provide-stpcpy-in-stpcpy-aligned.S-for-rtl.patch diff --git a/Add-HWCAP_LOONGARCH_LSPW-from-Linux-6.12-to-bits-hwc.patch b/Add-HWCAP_LOONGARCH_LSPW-from-Linux-6.12-to-bits-hwc.patch new file mode 100644 index 0000000..97144fe --- /dev/null +++ b/Add-HWCAP_LOONGARCH_LSPW-from-Linux-6.12-to-bits-hwc.patch @@ -0,0 +1,25 @@ +From f8661bbdd3abe67c08d40ba88c6a9e02c0a51f25 Mon Sep 17 00:00:00 2001 +From: Joseph Myers +Date: Fri, 20 Dec 2024 11:47:03 +0000 +Subject: [PATCH 2/4] Add HWCAP_LOONGARCH_LSPW from Linux 6.12 to bits/hwcap.h + +Add the new Linux 6.12 HWCAP_LOONGARCH_LSPW to the corresponding +bits/hwcap.h. + +Tested with build-many-glibcs.py for loongarch64-linux-gnu-lp64d. +--- + sysdeps/unix/sysv/linux/loongarch/bits/hwcap.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sysdeps/unix/sysv/linux/loongarch/bits/hwcap.h b/sysdeps/unix/sysv/linux/loongarch/bits/hwcap.h +index 7acec23d..fa9f4bd7 100644 +--- a/sysdeps/unix/sysv/linux/loongarch/bits/hwcap.h ++++ b/sysdeps/unix/sysv/linux/loongarch/bits/hwcap.h +@@ -36,3 +36,4 @@ + #define HWCAP_LOONGARCH_LBT_ARM (1 << 11) + #define HWCAP_LOONGARCH_LBT_MIPS (1 << 12) + #define HWCAP_LOONGARCH_PTW (1 << 13) ++#define HWCAP_LOONGARCH_LSPW (1 << 14) +-- +2.47.3 + diff --git a/LoongArch-Update-ulps.patch b/LoongArch-Update-ulps.patch new file mode 100644 index 0000000..7c27ebd --- /dev/null +++ b/LoongArch-Update-ulps.patch @@ -0,0 +1,38 @@ +From c988fdee39681d2fc118126fe6ecc9704c1d704c Mon Sep 17 00:00:00 2001 +From: caiyinyu +Date: Mon, 11 Nov 2024 09:56:05 +0800 +Subject: [PATCH 1/4] LoongArch: Update ulps + +Needed for test-float-cacosh, test-float-csin, test-float32-cacosh and +test-float32-csin. + +Signed-off-by: caiyinyu +Reviewed-by: Florian Weimer +--- + sysdeps/loongarch/lp64/libm-test-ulps | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/sysdeps/loongarch/lp64/libm-test-ulps b/sysdeps/loongarch/lp64/libm-test-ulps +index 770bf36b..4ecc0e65 100644 +--- a/sysdeps/loongarch/lp64/libm-test-ulps ++++ b/sysdeps/loongarch/lp64/libm-test-ulps +@@ -228,7 +228,7 @@ ldouble: 3 + + Function: Real part of "cacosh_upward": + double: 4 +-float: 3 ++float: 4 + ldouble: 6 + + Function: Imaginary part of "cacosh_upward": +@@ -720,6 +720,7 @@ float: 1 + ldouble: 1 + + Function: Imaginary part of "csin": ++float: 1 + ldouble: 1 + + Function: Real part of "csin_downward": +-- +2.47.3 + diff --git a/glibc.spec b/glibc.spec index cfc54b9..3e24175 100644 --- a/glibc.spec +++ b/glibc.spec @@ -67,7 +67,7 @@ ############################################################################## Name: glibc Version: 2.38 -Release: 69 +Release: 70 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ @@ -359,6 +359,10 @@ Patch269: i386-Update-___tls_get_addr-to-preserve-vector-regis.patch Patch270: x86-64-Add-GLIBC_ABI_GNU2_TLS-version-BZ-33129.patch Patch271: i386-Also-add-GLIBC_ABI_GNU2_TLS-version-BZ-33129.patch Patch272: i386-Add-GLIBC_ABI_GNU_TLS-version-BZ-33221.patch +Patch273: LoongArch-Update-ulps.patch +Patch274: Add-HWCAP_LOONGARCH_LSPW-from-Linux-6.12-to-bits-hwc.patch +Patch275: loongarch-Provide-stpcpy-in-stpcpy-aligned.S-for-rtl.patch +Patch276: loongarch-Drop-__GI_XXX-for-strcpy-stpcpy-IFUNC-impl.patch #openEuler patch list Patch9000: turn-default-value-of-x86_rep_stosb_threshold_form_2K_to_1M.patch @@ -1594,6 +1598,9 @@ fi %endif %changelog +* Mon Aug 25 2025 Peng Fan - 2.38-70 +- LoongArch: Sync from glibc upstream + * Tue Oct 21 2025 swcompiler - 2.38-69 - Sw64:Change libdir from lib to lib64 diff --git a/loongarch-Drop-__GI_XXX-for-strcpy-stpcpy-IFUNC-impl.patch b/loongarch-Drop-__GI_XXX-for-strcpy-stpcpy-IFUNC-impl.patch new file mode 100644 index 0000000..63b8e10 --- /dev/null +++ b/loongarch-Drop-__GI_XXX-for-strcpy-stpcpy-IFUNC-impl.patch @@ -0,0 +1,61 @@ +From fb7ee7cf7743ec8358678516e3e73471491a995f Mon Sep 17 00:00:00 2001 +From: "H.J. Lu" +Date: Sat, 4 Jan 2025 05:53:19 +0800 +Subject: [PATCH 4/4] loongarch: Drop __GI_XXX for strcpy/stpcpy IFUNC + implementations + +There is no need for __GI_XXX symbols, like __GI___strcpy_aligned since +__strcpy_aligned is used directly. + +Signed-off-by: H.J. Lu +Reviewed-by: Sam James +--- + sysdeps/loongarch/lp64/multiarch/strcpy-aligned.S | 2 -- + sysdeps/loongarch/lp64/multiarch/strcpy-lasx.S | 1 - + sysdeps/loongarch/lp64/multiarch/strcpy-lsx.S | 1 - + sysdeps/loongarch/lp64/multiarch/strcpy-unaligned.S | 1 - + 4 files changed, 5 deletions(-) + +diff --git a/sysdeps/loongarch/lp64/multiarch/strcpy-aligned.S b/sysdeps/loongarch/lp64/multiarch/strcpy-aligned.S +index 4ed539fd..1913fa63 100644 +--- a/sysdeps/loongarch/lp64/multiarch/strcpy-aligned.S ++++ b/sysdeps/loongarch/lp64/multiarch/strcpy-aligned.S +@@ -198,5 +198,3 @@ L(un_out): + #endif + jr ra + END(STRCPY) +- +-libc_hidden_builtin_def (STRCPY) +diff --git a/sysdeps/loongarch/lp64/multiarch/strcpy-lasx.S b/sysdeps/loongarch/lp64/multiarch/strcpy-lasx.S +index c2825612..3f20d359 100644 +--- a/sysdeps/loongarch/lp64/multiarch/strcpy-lasx.S ++++ b/sysdeps/loongarch/lp64/multiarch/strcpy-lasx.S +@@ -211,5 +211,4 @@ L(zero_byte): + jr ra + END(STRCPY) + +-libc_hidden_builtin_def (STRCPY) + #endif +diff --git a/sysdeps/loongarch/lp64/multiarch/strcpy-lsx.S b/sysdeps/loongarch/lp64/multiarch/strcpy-lsx.S +index fc2498f7..b3e7ec89 100644 +--- a/sysdeps/loongarch/lp64/multiarch/strcpy-lsx.S ++++ b/sysdeps/loongarch/lp64/multiarch/strcpy-lsx.S +@@ -208,5 +208,4 @@ L(INDEX): + .dword 0x0706050403020100 + .dword 0x0f0e0d0c0b0a0908 + +-libc_hidden_builtin_def (STRCPY) + #endif +diff --git a/sysdeps/loongarch/lp64/multiarch/strcpy-unaligned.S b/sysdeps/loongarch/lp64/multiarch/strcpy-unaligned.S +index 9e31883b..fee2a7c4 100644 +--- a/sysdeps/loongarch/lp64/multiarch/strcpy-unaligned.S ++++ b/sysdeps/loongarch/lp64/multiarch/strcpy-unaligned.S +@@ -134,5 +134,4 @@ L(page_cross): + b L(end) + END(STRCPY) + +-libc_hidden_builtin_def (STRCPY) + #endif +-- +2.47.3 + diff --git a/loongarch-Provide-stpcpy-in-stpcpy-aligned.S-for-rtl.patch b/loongarch-Provide-stpcpy-in-stpcpy-aligned.S-for-rtl.patch new file mode 100644 index 0000000..d837523 --- /dev/null +++ b/loongarch-Provide-stpcpy-in-stpcpy-aligned.S-for-rtl.patch @@ -0,0 +1,29 @@ +From d505aa00528b702c9fb451ada22055598d8c76c8 Mon Sep 17 00:00:00 2001 +From: "H.J. Lu" +Date: Sat, 4 Jan 2025 05:43:21 +0800 +Subject: [PATCH 3/4] loongarch: Provide stpcpy in stpcpy-aligned.S for rtld + [BZ #32512] + +When stpcpy-aligned.S is used in rtld, provide stpcpy as a weak alias of +__stpcpy. This fixes BZ #32512. + +Signed-off-by: H.J. Lu +--- + sysdeps/loongarch/lp64/multiarch/stpcpy-aligned.S | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sysdeps/loongarch/lp64/multiarch/stpcpy-aligned.S b/sysdeps/loongarch/lp64/multiarch/stpcpy-aligned.S +index 1f763db6..99f2c270 100644 +--- a/sysdeps/loongarch/lp64/multiarch/stpcpy-aligned.S ++++ b/sysdeps/loongarch/lp64/multiarch/stpcpy-aligned.S +@@ -20,6 +20,7 @@ + # define STPCPY __stpcpy_aligned + #else + # define STPCPY __stpcpy ++weak_alias (__stpcpy, stpcpy) + #endif + + #define USE_AS_STPCPY +-- +2.47.3 + -- Gitee