LoongArch: Sync loongarch64 code to lnd.36
Signed-off-by: ticat_fp <fanpeng@loongson.cn>
This commit is contained in:
parent
3e66ea24ef
commit
b311b3b3bd
15 changed files with 12089 additions and 1 deletions
3946
glibc-2.28-Add-macro-defination-of-lasx-lsx-and-fcc-.patch
Normal file
3946
glibc-2.28-Add-macro-defination-of-lasx-lsx-and-fcc-.patch
Normal file
File diff suppressed because it is too large
Load diff
29
glibc-2.28-Add-new-struct-user_fp_state-in-user.h.patch
Normal file
29
glibc-2.28-Add-new-struct-user_fp_state-in-user.h.patch
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
From dc2d26d52c129c47fa1f16bd0157cd20c6d9a958 Mon Sep 17 00:00:00 2001
|
||||||
|
From: caiyinyu <caiyinyu@loongson.cn>
|
||||||
|
Date: Wed, 21 Jun 2023 11:55:02 +0800
|
||||||
|
Subject: [PATCH 08/14] glibc-2.28: Add new struct user_fp_state in user.h
|
||||||
|
|
||||||
|
Change-Id: Idc233cc11c8f76b624dc2891b432f4d02a53cebc
|
||||||
|
Signed-off-by: ticat_fp <fanpeng@loongson.cn>
|
||||||
|
---
|
||||||
|
sysdeps/unix/sysv/linux/loongarch/sys/user.h | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/sysdeps/unix/sysv/linux/loongarch/sys/user.h b/sysdeps/unix/sysv/linux/loongarch/sys/user.h
|
||||||
|
index f9108350..21e340f6 100644
|
||||||
|
--- a/sysdeps/unix/sysv/linux/loongarch/sys/user.h
|
||||||
|
+++ b/sysdeps/unix/sysv/linux/loongarch/sys/user.h
|
||||||
|
@@ -28,4 +28,10 @@ struct user_regs_struct
|
||||||
|
uint64_t reserved[11];
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct user_fp_struct {
|
||||||
|
+ uint64_t fpr[32];
|
||||||
|
+ uint64_t fcc;
|
||||||
|
+ uint32_t fcsr;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
#endif /* _SYS_USER_H */
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
116
glibc-2.28-Add-run-one-test-convenience-target-and-m.patch
Normal file
116
glibc-2.28-Add-run-one-test-convenience-target-and-m.patch
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
From bbc404e8f6e59aa808642c2a40e24a81744967e3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: caiyinyu <caiyinyu@loongson.cn>
|
||||||
|
Date: Mon, 15 May 2023 12:00:50 +0800
|
||||||
|
Subject: [PATCH 04/14] glibc-2.28: Add run-one-test convenience target and
|
||||||
|
makefile help text
|
||||||
|
|
||||||
|
Reference:
|
||||||
|
|
||||||
|
commit 2ac579f9c25388a7734948d77b03e4dd10f35334
|
||||||
|
Author: DJ Delorie <dj@redhat.com>
|
||||||
|
Date: Mon Sep 30 16:04:52 2019 -0400
|
||||||
|
|
||||||
|
Add run-one-test convenience target and makefile help text
|
||||||
|
|
||||||
|
Adds "make test" for re-running just one test. Also adds
|
||||||
|
"make help" for help with our Makefile targets, and adds a
|
||||||
|
mini-help when you just run "make".
|
||||||
|
|
||||||
|
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||||
|
|
||||||
|
Change-Id: I8c7ccf9a5ec4dc4afd4901d2f8f693677d0d94ea
|
||||||
|
Signed-off-by: ticat_fp <fanpeng@loongson.cn>
|
||||||
|
---
|
||||||
|
Makefile | 22 ++++++++++++++++++++--
|
||||||
|
Makefile.help | 42 ++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
2 files changed, 62 insertions(+), 2 deletions(-)
|
||||||
|
create mode 100644 Makefile.help
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 6d73241b..6518f62e 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -26,8 +26,17 @@ include Makeconfig
|
||||||
|
|
||||||
|
|
||||||
|
# This is the default target; it makes everything except the tests.
|
||||||
|
-.PHONY: all
|
||||||
|
-all: lib others
|
||||||
|
+.PHONY: all help minihelp
|
||||||
|
+all: minihelp lib others
|
||||||
|
+
|
||||||
|
+help:
|
||||||
|
+ @sed '0,/^help-starts-here$$/d' Makefile.help
|
||||||
|
+
|
||||||
|
+minihelp:
|
||||||
|
+ @echo
|
||||||
|
+ @echo type \"make help\" for help with common glibc makefile targets
|
||||||
|
+ @echo
|
||||||
|
+
|
||||||
|
|
||||||
|
ifneq ($(AUTOCONF),no)
|
||||||
|
|
||||||
|
@@ -503,3 +512,12 @@ FORCE:
|
||||||
|
|
||||||
|
iconvdata/% localedata/% po/%: FORCE
|
||||||
|
$(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
|
||||||
|
+
|
||||||
|
+# Convenience target to rerun one test, from the top of the build tree
|
||||||
|
+# Example: make test t=wcsmbs/test-wcsnlen
|
||||||
|
+.PHONY: test
|
||||||
|
+test :
|
||||||
|
+ @-rm -f $(objpfx)$t.out
|
||||||
|
+ $(MAKE) subdir=$(dir $t) -C $(dir $t) ..=../ $(objpfx)$t.out
|
||||||
|
+ @cat $(objpfx)$t.test-result
|
||||||
|
+ @cat $(objpfx)$t.out
|
||||||
|
diff --git a/Makefile.help b/Makefile.help
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..319fdaa1
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/Makefile.help
|
||||||
|
@@ -0,0 +1,42 @@
|
||||||
|
+# Copyright (C) 2019 Free Software Foundation, Inc.
|
||||||
|
+# This file is part of the GNU C Library.
|
||||||
|
+
|
||||||
|
+# The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
+# modify it under the terms of the GNU Lesser General Public
|
||||||
|
+# License as published by the Free Software Foundation; either
|
||||||
|
+# version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+
|
||||||
|
+# The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+# Lesser General Public License for more details.
|
||||||
|
+
|
||||||
|
+# You should have received a copy of the GNU Lesser General Public
|
||||||
|
+# License along with the GNU C Library; if not, see
|
||||||
|
+# <https://www.gnu.org/licenses/>.
|
||||||
|
+
|
||||||
|
+This is the file that gets printed when the user runs "make help",
|
||||||
|
+starting just after the "help-starts-here" line.
|
||||||
|
+
|
||||||
|
+help-starts-here
|
||||||
|
+
|
||||||
|
+all
|
||||||
|
+ The usual default; builds everything but doesn't run the
|
||||||
|
+ tests.
|
||||||
|
+
|
||||||
|
+check (or tests)
|
||||||
|
+ Runs the standard set of tests.
|
||||||
|
+
|
||||||
|
+test
|
||||||
|
+ Runs one test. Use like this:
|
||||||
|
+ make test t=wcsmbs/test-wcsnlen
|
||||||
|
+ Note that this will rebuild the test if needed, but will not
|
||||||
|
+ rebuild what "make all" would have rebuilt.
|
||||||
|
+
|
||||||
|
+--
|
||||||
|
+Other useful hints:
|
||||||
|
+
|
||||||
|
+builddir$ rm testroot.pristine/install.stamp
|
||||||
|
+ Forces the testroot to be reinstalled the next time you run
|
||||||
|
+ the testsuite (or just rm -rf testroot.pristine)
|
||||||
|
+
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
162
glibc-2.28-Fix-ifunc-str-mem-functions-xfail-problem.patch
Normal file
162
glibc-2.28-Fix-ifunc-str-mem-functions-xfail-problem.patch
Normal file
|
@ -0,0 +1,162 @@
|
||||||
|
From 647a0a28e5c9aed2f1fa59bbb7595133e7a4e62f Mon Sep 17 00:00:00 2001
|
||||||
|
From: caiyinyu <caiyinyu@loongson.cn>
|
||||||
|
Date: Mon, 24 Apr 2023 18:09:55 +0800
|
||||||
|
Subject: [PATCH 03/14] glibc-2.28: Fix ifunc str/mem functions xfail problems.
|
||||||
|
|
||||||
|
Change-Id: Ibff4229fcfef23c0b19fb94b21a4d17b49eceec6
|
||||||
|
Signed-off-by: ticat_fp <fanpeng@loongson.cn>
|
||||||
|
---
|
||||||
|
.../lp64/multiarch/ifunc-impl-list.c | 76 +++++++++----------
|
||||||
|
1 file changed, 38 insertions(+), 38 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/sysdeps/loongarch/lp64/multiarch/ifunc-impl-list.c b/sysdeps/loongarch/lp64/multiarch/ifunc-impl-list.c
|
||||||
|
index c2b6bbf7..fdeae797 100644
|
||||||
|
--- a/sysdeps/loongarch/lp64/multiarch/ifunc-impl-list.c
|
||||||
|
+++ b/sysdeps/loongarch/lp64/multiarch/ifunc-impl-list.c
|
||||||
|
@@ -36,105 +36,105 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
||||||
|
size_t i = 0;
|
||||||
|
|
||||||
|
IFUNC_IMPL (i, name, memcpy,
|
||||||
|
- IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_lasx)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, memcpy, SUPPORT_LASX, __memcpy_lasx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, memcpy, SUPPORT_LSX, __memcpy_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, memcpy, SUPPORT_UAL, __memcpy_unaligned)
|
||||||
|
IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_aligned)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_unaligned)
|
||||||
|
)
|
||||||
|
|
||||||
|
IFUNC_IMPL (i, name, memmove,
|
||||||
|
- IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_lasx)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, memmove, SUPPORT_LASX, __memmove_lasx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, memmove, SUPPORT_LSX, __memmove_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, memmove, SUPPORT_UAL, __memmove_unaligned)
|
||||||
|
IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_aligned)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_unaligned)
|
||||||
|
)
|
||||||
|
|
||||||
|
IFUNC_IMPL (i, name, memset,
|
||||||
|
- IFUNC_IMPL_ADD (array, i, memset, 1, __memset_lasx)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, memset, 1, __memset_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, memset, SUPPORT_LASX, __memset_lasx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, memset, SUPPORT_LSX, __memset_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, memset, SUPPORT_UAL, __memset_unaligned)
|
||||||
|
IFUNC_IMPL_ADD (array, i, memset, 1, __memset_aligned)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, memset, 1, __memset_unaligned)
|
||||||
|
)
|
||||||
|
|
||||||
|
IFUNC_IMPL (i, name, memchr,
|
||||||
|
- IFUNC_IMPL_ADD (array, i, memchr, 1, __memchr_lasx)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, memchr, 1, __memchr_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, memchr, SUPPORT_LASX, __memchr_lasx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, memchr, SUPPORT_LSX, __memchr_lsx)
|
||||||
|
IFUNC_IMPL_ADD (array, i, memchr, 1, __memchr_aligned)
|
||||||
|
)
|
||||||
|
|
||||||
|
IFUNC_IMPL (i, name, memrchr,
|
||||||
|
- IFUNC_IMPL_ADD (array, i, memrchr, 1, __memrchr_lasx)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, memrchr, 1, __memrchr_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, memrchr, SUPPORT_LASX, __memrchr_lasx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, memrchr, SUPPORT_LSX, __memrchr_lsx)
|
||||||
|
IFUNC_IMPL_ADD (array, i, memrchr, 1, __memrchr_generic)
|
||||||
|
)
|
||||||
|
|
||||||
|
IFUNC_IMPL (i, name, memcmp,
|
||||||
|
- IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_lasx)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, memcmp, SUPPORT_LASX, __memcmp_lasx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, memcmp, SUPPORT_LSX, __memcmp_lsx)
|
||||||
|
IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_aligned)
|
||||||
|
)
|
||||||
|
|
||||||
|
IFUNC_IMPL (i, name, rawmemchr,
|
||||||
|
- IFUNC_IMPL_ADD (array, i, rawmemchr, 1, __rawmemchr_lasx)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, rawmemchr, 1, __rawmemchr_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, rawmemchr, SUPPORT_LASX, __rawmemchr_lasx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, rawmemchr, SUPPORT_LSX, __rawmemchr_lsx)
|
||||||
|
IFUNC_IMPL_ADD (array, i, rawmemchr, 1, __rawmemchr_aligned)
|
||||||
|
)
|
||||||
|
|
||||||
|
IFUNC_IMPL (i, name, strchr,
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_lasx)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strchr, SUPPORT_LASX, __strchr_lasx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strchr, SUPPORT_LSX, __strchr_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strchr, SUPPORT_UAL, __strchr_unaligned)
|
||||||
|
IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_aligned)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_unaligned)
|
||||||
|
)
|
||||||
|
|
||||||
|
IFUNC_IMPL (i, name, strrchr,
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strrchr, 1, __strrchr_lasx)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strrchr, 1, __strrchr_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strrchr, SUPPORT_LASX, __strrchr_lasx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strrchr, SUPPORT_LSX, __strrchr_lsx)
|
||||||
|
IFUNC_IMPL_ADD (array, i, strrchr, 1, __strrchr_aligned)
|
||||||
|
)
|
||||||
|
|
||||||
|
IFUNC_IMPL (i, name, strlen,
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_lasx)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strlen, SUPPORT_LASX, __strlen_lasx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strlen, SUPPORT_LSX, __strlen_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strlen, SUPPORT_UAL, __strlen_unaligned)
|
||||||
|
IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_aligned)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_unaligned)
|
||||||
|
)
|
||||||
|
|
||||||
|
IFUNC_IMPL (i, name, strnlen,
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strnlen, 1, __strnlen_lasx)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strnlen, 1, __strnlen_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strnlen, SUPPORT_LASX, __strnlen_lasx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strnlen, SUPPORT_LSX, __strnlen_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strnlen, SUPPORT_UAL, __strnlen_unaligned)
|
||||||
|
IFUNC_IMPL_ADD (array, i, strnlen, 1, __strnlen_aligned)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strnlen, 1, __strnlen_unaligned)
|
||||||
|
)
|
||||||
|
|
||||||
|
IFUNC_IMPL (i, name, strchrnul,
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strchrnul, 1, __strchrnul_lasx)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strchrnul, 1, __strchrnul_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strchrnul, SUPPORT_LASX, __strchrnul_lasx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strchrnul, SUPPORT_LSX, __strchrnul_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strchrnul, SUPPORT_UAL, __strchrnul_unaligned)
|
||||||
|
IFUNC_IMPL_ADD (array, i, strchrnul, 1, __strchrnul_aligned)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strchrnul, 1, __strchrnul_unaligned)
|
||||||
|
)
|
||||||
|
|
||||||
|
IFUNC_IMPL (i, name, strncmp,
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strncmp, SUPPORT_LSX, __strncmp_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strncmp, SUPPORT_UAL, __strncmp_unaligned)
|
||||||
|
IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_aligned)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_unaligned)
|
||||||
|
)
|
||||||
|
|
||||||
|
IFUNC_IMPL (i, name, strcpy,
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strcpy, 1, __strcpy_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strcpy, SUPPORT_LSX, __strcpy_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strcpy, SUPPORT_UAL, __strcpy_unaligned)
|
||||||
|
IFUNC_IMPL_ADD (array, i, strcpy, 1, __strcpy_aligned)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strcpy, 1, __strcpy_unaligned)
|
||||||
|
)
|
||||||
|
|
||||||
|
IFUNC_IMPL (i, name, stpcpy,
|
||||||
|
- IFUNC_IMPL_ADD (array, i, stpcpy, 1, __stpcpy_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, stpcpy, SUPPORT_LSX, __stpcpy_lsx)
|
||||||
|
IFUNC_IMPL_ADD (array, i, stpcpy, 1, __stpcpy_aligned)
|
||||||
|
)
|
||||||
|
|
||||||
|
IFUNC_IMPL (i, name, strcmp,
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strcmp, 1, __strcmp_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strcmp, SUPPORT_LSX, __strcmp_lsx)
|
||||||
|
+ IFUNC_IMPL_ADD (array, i, strcmp, SUPPORT_UAL, __strcmp_unaligned)
|
||||||
|
IFUNC_IMPL_ADD (array, i, strcmp, 1, __strcmp_aligned)
|
||||||
|
- IFUNC_IMPL_ADD (array, i, strcmp, 1, __strcmp_unaligned)
|
||||||
|
)
|
||||||
|
|
||||||
|
return i;
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
57
glibc-2.28-Redefine-macro-LEAF-ENTRY.patch
Normal file
57
glibc-2.28-Redefine-macro-LEAF-ENTRY.patch
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
From 00537d6945e71af8c9b0b1e7c2695f6a9a1ef1f5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: caiyinyu <caiyinyu@loongson.cn>
|
||||||
|
Date: Sun, 25 Jun 2023 16:23:25 +0800
|
||||||
|
Subject: [PATCH 09/14] glibc-2.28: Redefine macro LEAF/ENTRY.
|
||||||
|
|
||||||
|
The following usage of macro LEAF/ENTRY are all feasible:
|
||||||
|
1. LEAF(fcn) -- the align value of fcn is .align 3 (default value)
|
||||||
|
2. LEAF(fcn, 6) -- the align value of fcn is .align 6
|
||||||
|
|
||||||
|
Change-Id: Ie3df4df8dba5259b665bd0e4702aaab0a09a5f65
|
||||||
|
Signed-off-by: ticat_fp <fanpeng@loongson.cn>
|
||||||
|
---
|
||||||
|
sysdeps/loongarch/sys/asm.h | 15 ++++++++++-----
|
||||||
|
1 file changed, 10 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/sysdeps/loongarch/sys/asm.h b/sysdeps/loongarch/sys/asm.h
|
||||||
|
index 357a5ba3..734e45ae 100644
|
||||||
|
--- a/sysdeps/loongarch/sys/asm.h
|
||||||
|
+++ b/sysdeps/loongarch/sys/asm.h
|
||||||
|
@@ -26,16 +26,21 @@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
-/* Declare leaf routine. */
|
||||||
|
-#define LEAF(symbol, aln) \
|
||||||
|
+/* Declare leaf routine.
|
||||||
|
+ The usage of macro LEAF/ENTRY is as follows:
|
||||||
|
+ 1. LEAF(fcn) -- the align value of fcn is .align 3 (default value)
|
||||||
|
+ 2. LEAF(fcn, 6) -- the align value of fcn is .align 6
|
||||||
|
+*/
|
||||||
|
+#define LEAF_IMPL(symbol, aln, ...) \
|
||||||
|
.text; \
|
||||||
|
.globl symbol; \
|
||||||
|
.align aln; \
|
||||||
|
.type symbol, @function; \
|
||||||
|
symbol: \
|
||||||
|
- cfi_startproc; \
|
||||||
|
+ cfi_startproc;
|
||||||
|
|
||||||
|
-# define ENTRY(symbol, aln) LEAF(symbol, aln)
|
||||||
|
+#define LEAF(...) LEAF_IMPL(__VA_ARGS__, 3)
|
||||||
|
+#define ENTRY(...) LEAF(__VA_ARGS__)
|
||||||
|
|
||||||
|
#define LEAF_NO_ALIGN(symbol) \
|
||||||
|
.text; \
|
||||||
|
@@ -44,7 +49,7 @@ symbol: \
|
||||||
|
symbol: \
|
||||||
|
cfi_startproc;
|
||||||
|
|
||||||
|
-# define ENTRY_NO_ALIGN(symbol) LEAF_NO_ALIGN(symbol)
|
||||||
|
+#define ENTRY_NO_ALIGN(symbol) LEAF_NO_ALIGN(symbol)
|
||||||
|
|
||||||
|
/* Mark end of function. */
|
||||||
|
#undef END
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
306
glibc-2.28-Refactor-code-and-fix-bug-in-_dl_runtime_.patch
Normal file
306
glibc-2.28-Refactor-code-and-fix-bug-in-_dl_runtime_.patch
Normal file
|
@ -0,0 +1,306 @@
|
||||||
|
From 27a004c9777340afd86fc0d129f6ffad508bf090 Mon Sep 17 00:00:00 2001
|
||||||
|
From: caiyinyu <caiyinyu@loongson.cn>
|
||||||
|
Date: Tue, 11 Jul 2023 16:09:55 +0800
|
||||||
|
Subject: [PATCH 12/14] glibc-2.28: Refactor code and fix bug in
|
||||||
|
_dl_runtime_resolve.
|
||||||
|
|
||||||
|
Change-Id: I4907e6643ef25b87d7862e957ce9bf6d201da816
|
||||||
|
Signed-off-by: ticat_fp <fanpeng@loongson.cn>
|
||||||
|
---
|
||||||
|
sysdeps/loongarch/dl-machine.h | 8 +-
|
||||||
|
sysdeps/loongarch/dl-trampoline.S | 7 ++
|
||||||
|
sysdeps/loongarch/dl-trampoline.h | 159 +++++++++++++-----------------
|
||||||
|
sysdeps/loongarch/sys/asm.h | 9 ++
|
||||||
|
4 files changed, 90 insertions(+), 93 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/sysdeps/loongarch/dl-machine.h b/sysdeps/loongarch/dl-machine.h
|
||||||
|
index 6e9c6258..ff520a07 100644
|
||||||
|
--- a/sysdeps/loongarch/dl-machine.h
|
||||||
|
+++ b/sysdeps/loongarch/dl-machine.h
|
||||||
|
@@ -381,9 +381,13 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
|
||||||
|
/* If using PLTs, fill in the first two entries of .got.plt. */
|
||||||
|
if (l->l_info[DT_JMPREL])
|
||||||
|
{
|
||||||
|
- extern void _dl_runtime_resolve (void) __attribute__ ((visibility ("hidden")));
|
||||||
|
+
|
||||||
|
+#if HAVE_LOONGARCH_VEC_ASM && !defined __loongarch_soft_float
|
||||||
|
extern void _dl_runtime_resolve_lasx (void) __attribute__ ((visibility ("hidden")));
|
||||||
|
extern void _dl_runtime_resolve_lsx (void) __attribute__ ((visibility ("hidden")));
|
||||||
|
+#endif
|
||||||
|
+ extern void _dl_runtime_resolve (void) __attribute__ ((visibility ("hidden")));
|
||||||
|
+
|
||||||
|
ElfW(Addr) *gotplt = (ElfW(Addr) *) D_PTR (l, l_info[DT_PLTGOT]);
|
||||||
|
/* If a library is prelinked but we have to relocate anyway,
|
||||||
|
we have to be able to undo the prelinking of .got.plt.
|
||||||
|
@@ -391,11 +395,13 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
|
||||||
|
if (gotplt[1])
|
||||||
|
l->l_mach.plt = gotplt[1] + l->l_addr;
|
||||||
|
|
||||||
|
+#if HAVE_LOONGARCH_VEC_ASM && !defined __loongarch_soft_float
|
||||||
|
if (SUPPORT_LASX)
|
||||||
|
gotplt[0] = (ElfW(Addr)) &_dl_runtime_resolve_lasx;
|
||||||
|
else if (SUPPORT_LSX)
|
||||||
|
gotplt[0] = (ElfW(Addr)) &_dl_runtime_resolve_lsx;
|
||||||
|
else
|
||||||
|
+#endif
|
||||||
|
gotplt[0] = (ElfW(Addr)) &_dl_runtime_resolve;
|
||||||
|
|
||||||
|
gotplt[1] = (ElfW(Addr)) l;
|
||||||
|
diff --git a/sysdeps/loongarch/dl-trampoline.S b/sysdeps/loongarch/dl-trampoline.S
|
||||||
|
index 5f627a63..78d741f3 100644
|
||||||
|
--- a/sysdeps/loongarch/dl-trampoline.S
|
||||||
|
+++ b/sysdeps/loongarch/dl-trampoline.S
|
||||||
|
@@ -16,16 +16,23 @@
|
||||||
|
License along with the GNU C Library. If not, see
|
||||||
|
<http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
+#include <sysdep.h>
|
||||||
|
+#include <sys/asm.h>
|
||||||
|
+
|
||||||
|
+#if HAVE_LOONGARCH_VEC_ASM && !defined __loongarch_soft_float
|
||||||
|
#define USE_LASX
|
||||||
|
#define _dl_runtime_resolve _dl_runtime_resolve_lasx
|
||||||
|
#include "dl-trampoline.h"
|
||||||
|
+#undef FRAME_SIZE
|
||||||
|
#undef USE_LASX
|
||||||
|
#undef _dl_runtime_resolve
|
||||||
|
|
||||||
|
#define USE_LSX
|
||||||
|
#define _dl_runtime_resolve _dl_runtime_resolve_lsx
|
||||||
|
#include "dl-trampoline.h"
|
||||||
|
+#undef FRAME_SIZE
|
||||||
|
#undef USE_LSX
|
||||||
|
#undef _dl_runtime_resolve
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#include "dl-trampoline.h"
|
||||||
|
diff --git a/sysdeps/loongarch/dl-trampoline.h b/sysdeps/loongarch/dl-trampoline.h
|
||||||
|
index 96f41f1d..9a6d9b6c 100644
|
||||||
|
--- a/sysdeps/loongarch/dl-trampoline.h
|
||||||
|
+++ b/sysdeps/loongarch/dl-trampoline.h
|
||||||
|
@@ -17,31 +17,24 @@
|
||||||
|
License along with the GNU C Library. If not, see
|
||||||
|
<http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
-#include <sysdep.h>
|
||||||
|
-#include <sys/asm.h>
|
||||||
|
-
|
||||||
|
/* Assembler veneer called from the PLT header code for lazy loading.
|
||||||
|
The PLT header passes its own args in t0-t2. */
|
||||||
|
-
|
||||||
|
-#ifdef __loongarch_soft_float
|
||||||
|
-# define FRAME_SIZE (-((-10 * SZREG) & ALMASK))
|
||||||
|
+#ifdef USE_LASX
|
||||||
|
+# define FRAME_SIZE (-((-9 * SZREG - 8 * SZFREG - 8 * SZXREG) & ALMASK))
|
||||||
|
+#elif defined USE_LSX
|
||||||
|
+# define FRAME_SIZE (-((-9 * SZREG - 8 * SZFREG - 8 * SZVREG) & ALMASK))
|
||||||
|
+#elif !defined __loongarch_soft_float
|
||||||
|
+# define FRAME_SIZE (-((-9 * SZREG - 8 * SZFREG) & ALMASK))
|
||||||
|
#else
|
||||||
|
-# define FRAME_SIZE (-((-10 * SZREG - 8 * 256) & ALMASK))
|
||||||
|
+# define FRAME_SIZE (-((-9 * SZREG) & ALMASK))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ENTRY (_dl_runtime_resolve, 3)
|
||||||
|
- # Save arguments to stack.
|
||||||
|
-
|
||||||
|
-#ifdef __loongarch64
|
||||||
|
- li.d t3, -FRAME_SIZE
|
||||||
|
- add.d sp, sp, t3
|
||||||
|
-#elif defined __loongarch32
|
||||||
|
- li.w t3, -FRAME_SIZE
|
||||||
|
- add.w sp, sp, t3
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
+ /* Save arguments to stack. */
|
||||||
|
+ ADDI sp, sp, -FRAME_SIZE
|
||||||
|
|
||||||
|
- REG_S ra, sp, 9*SZREG
|
||||||
|
+ REG_S ra, sp, 0*SZREG
|
||||||
|
REG_S a0, sp, 1*SZREG
|
||||||
|
REG_S a1, sp, 2*SZREG
|
||||||
|
REG_S a2, sp, 3*SZREG
|
||||||
|
@@ -51,55 +44,45 @@ ENTRY (_dl_runtime_resolve, 3)
|
||||||
|
REG_S a6, sp, 7*SZREG
|
||||||
|
REG_S a7, sp, 8*SZREG
|
||||||
|
|
||||||
|
-#ifndef __loongarch_soft_float
|
||||||
|
- FREG_S fa0, sp, 10*SZREG + 0*SZFREG
|
||||||
|
- FREG_S fa1, sp, 10*SZREG + 1*SZFREG
|
||||||
|
- FREG_S fa2, sp, 10*SZREG + 2*SZFREG
|
||||||
|
- FREG_S fa3, sp, 10*SZREG + 3*SZFREG
|
||||||
|
- FREG_S fa4, sp, 10*SZREG + 4*SZFREG
|
||||||
|
- FREG_S fa5, sp, 10*SZREG + 5*SZFREG
|
||||||
|
- FREG_S fa6, sp, 10*SZREG + 6*SZFREG
|
||||||
|
- FREG_S fa7, sp, 10*SZREG + 7*SZFREG
|
||||||
|
#ifdef USE_LASX
|
||||||
|
- xvst xr0, sp, 10*SZREG + 0*256
|
||||||
|
- xvst xr1, sp, 10*SZREG + 1*256
|
||||||
|
- xvst xr2, sp, 10*SZREG + 2*256
|
||||||
|
- xvst xr3, sp, 10*SZREG + 3*256
|
||||||
|
- xvst xr4, sp, 10*SZREG + 4*256
|
||||||
|
- xvst xr5, sp, 10*SZREG + 5*256
|
||||||
|
- xvst xr6, sp, 10*SZREG + 6*256
|
||||||
|
- xvst xr7, sp, 10*SZREG + 7*256
|
||||||
|
+ xvst xr0, sp, 9*SZREG + 8*SZFREG + 0*SZXREG
|
||||||
|
+ xvst xr1, sp, 9*SZREG + 8*SZFREG + 1*SZXREG
|
||||||
|
+ xvst xr2, sp, 9*SZREG + 8*SZFREG + 2*SZXREG
|
||||||
|
+ xvst xr3, sp, 9*SZREG + 8*SZFREG + 3*SZXREG
|
||||||
|
+ xvst xr4, sp, 9*SZREG + 8*SZFREG + 4*SZXREG
|
||||||
|
+ xvst xr5, sp, 9*SZREG + 8*SZFREG + 5*SZXREG
|
||||||
|
+ xvst xr6, sp, 9*SZREG + 8*SZFREG + 6*SZXREG
|
||||||
|
+ xvst xr7, sp, 9*SZREG + 8*SZFREG + 7*SZXREG
|
||||||
|
#elif defined USE_LSX
|
||||||
|
- vst vr0, sp, 10*SZREG + 0*128
|
||||||
|
- vst vr1, sp, 10*SZREG + 1*128
|
||||||
|
- vst vr2, sp, 10*SZREG + 2*128
|
||||||
|
- vst vr3, sp, 10*SZREG + 3*128
|
||||||
|
- vst vr4, sp, 10*SZREG + 4*128
|
||||||
|
- vst vr5, sp, 10*SZREG + 5*128
|
||||||
|
- vst vr6, sp, 10*SZREG + 6*128
|
||||||
|
- vst vr7, sp, 10*SZREG + 7*128
|
||||||
|
-#endif
|
||||||
|
+ vst vr0, sp, 9*SZREG + 8*SZFREG + 0*SZVREG
|
||||||
|
+ vst vr1, sp, 9*SZREG + 8*SZFREG + 1*SZVREG
|
||||||
|
+ vst vr2, sp, 9*SZREG + 8*SZFREG + 2*SZVREG
|
||||||
|
+ vst vr3, sp, 9*SZREG + 8*SZFREG + 3*SZVREG
|
||||||
|
+ vst vr4, sp, 9*SZREG + 8*SZFREG + 4*SZVREG
|
||||||
|
+ vst vr5, sp, 9*SZREG + 8*SZFREG + 5*SZVREG
|
||||||
|
+ vst vr6, sp, 9*SZREG + 8*SZFREG + 6*SZVREG
|
||||||
|
+ vst vr7, sp, 9*SZREG + 8*SZFREG + 7*SZVREG
|
||||||
|
+#elif !defined __loongarch_soft_float
|
||||||
|
+ FREG_S fa0, sp, 9*SZREG + 0*SZFREG
|
||||||
|
+ FREG_S fa1, sp, 9*SZREG + 1*SZFREG
|
||||||
|
+ FREG_S fa2, sp, 9*SZREG + 2*SZFREG
|
||||||
|
+ FREG_S fa3, sp, 9*SZREG + 3*SZFREG
|
||||||
|
+ FREG_S fa4, sp, 9*SZREG + 4*SZFREG
|
||||||
|
+ FREG_S fa5, sp, 9*SZREG + 5*SZFREG
|
||||||
|
+ FREG_S fa6, sp, 9*SZREG + 6*SZFREG
|
||||||
|
+ FREG_S fa7, sp, 9*SZREG + 7*SZFREG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
- # Update .got.plt and obtain runtime address of callee.
|
||||||
|
-#ifdef __loongarch64
|
||||||
|
- slli.d a1, t1, 1
|
||||||
|
+ /* Update .got.plt and obtain runtime address of callee */
|
||||||
|
+ SLLI a1, t1, 1
|
||||||
|
or a0, t0, zero
|
||||||
|
- add.d a1, a1, t1
|
||||||
|
+ ADD a1, a1, t1
|
||||||
|
la a2, _dl_fixup
|
||||||
|
jirl ra, a2, 0
|
||||||
|
or t1, v0, zero
|
||||||
|
-#elif defined __loongarch32
|
||||||
|
- slli.w a1, t1, 1
|
||||||
|
- or a0, t0, zero
|
||||||
|
- add.w a1, a1, t1
|
||||||
|
- la a2, _dl_fixup
|
||||||
|
- jirl ra, a2, 0
|
||||||
|
- or t1, v0, zero
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
- # Restore arguments from stack.
|
||||||
|
- REG_L ra, sp, 9*SZREG
|
||||||
|
+ /* Restore arguments from stack. */
|
||||||
|
+ REG_L ra, sp, 0*SZREG
|
||||||
|
REG_L a0, sp, 1*SZREG
|
||||||
|
REG_L a1, sp, 2*SZREG
|
||||||
|
REG_L a2, sp, 3*SZREG
|
||||||
|
@@ -109,45 +92,37 @@ ENTRY (_dl_runtime_resolve, 3)
|
||||||
|
REG_L a6, sp, 7*SZREG
|
||||||
|
REG_L a7, sp, 8*SZREG
|
||||||
|
|
||||||
|
-#ifndef __loongarch_soft_float
|
||||||
|
- FREG_L fa0, sp, 10*SZREG + 0*SZFREG
|
||||||
|
- FREG_L fa1, sp, 10*SZREG + 1*SZFREG
|
||||||
|
- FREG_L fa2, sp, 10*SZREG + 2*SZFREG
|
||||||
|
- FREG_L fa3, sp, 10*SZREG + 3*SZFREG
|
||||||
|
- FREG_L fa4, sp, 10*SZREG + 4*SZFREG
|
||||||
|
- FREG_L fa5, sp, 10*SZREG + 5*SZFREG
|
||||||
|
- FREG_L fa6, sp, 10*SZREG + 6*SZFREG
|
||||||
|
- FREG_L fa7, sp, 10*SZREG + 7*SZFREG
|
||||||
|
#ifdef USE_LASX
|
||||||
|
- xvld xr0, sp, 10*SZREG + 0*256
|
||||||
|
- xvld xr1, sp, 10*SZREG + 1*256
|
||||||
|
- xvld xr2, sp, 10*SZREG + 2*256
|
||||||
|
- xvld xr3, sp, 10*SZREG + 3*256
|
||||||
|
- xvld xr4, sp, 10*SZREG + 4*256
|
||||||
|
- xvld xr5, sp, 10*SZREG + 5*256
|
||||||
|
- xvld xr6, sp, 10*SZREG + 6*256
|
||||||
|
- xvld xr7, sp, 10*SZREG + 7*256
|
||||||
|
+ xvld xr0, sp, 9*SZREG + 8*SZFREG + 0*SZXREG
|
||||||
|
+ xvld xr1, sp, 9*SZREG + 8*SZFREG + 1*SZXREG
|
||||||
|
+ xvld xr2, sp, 9*SZREG + 8*SZFREG + 2*SZXREG
|
||||||
|
+ xvld xr3, sp, 9*SZREG + 8*SZFREG + 3*SZXREG
|
||||||
|
+ xvld xr4, sp, 9*SZREG + 8*SZFREG + 4*SZXREG
|
||||||
|
+ xvld xr5, sp, 9*SZREG + 8*SZFREG + 5*SZXREG
|
||||||
|
+ xvld xr6, sp, 9*SZREG + 8*SZFREG + 6*SZXREG
|
||||||
|
+ xvld xr7, sp, 9*SZREG + 8*SZFREG + 7*SZXREG
|
||||||
|
#elif defined USE_LSX
|
||||||
|
- vld vr0, sp, 10*SZREG + 0*128
|
||||||
|
- vld vr1, sp, 10*SZREG + 1*128
|
||||||
|
- vld vr2, sp, 10*SZREG + 2*128
|
||||||
|
- vld vr3, sp, 10*SZREG + 3*128
|
||||||
|
- vld vr4, sp, 10*SZREG + 4*128
|
||||||
|
- vld vr5, sp, 10*SZREG + 5*128
|
||||||
|
- vld vr6, sp, 10*SZREG + 6*128
|
||||||
|
- vld vr7, sp, 10*SZREG + 7*128
|
||||||
|
-#endif
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
-#ifdef __loongarch64
|
||||||
|
- li.d t3, FRAME_SIZE
|
||||||
|
- add.d sp, sp, t3
|
||||||
|
-#elif defined __loongarch32
|
||||||
|
- li.w t3, FRAME_SIZE
|
||||||
|
- addi.w sp, sp, FRAME_SIZE
|
||||||
|
+ vld vr0, sp, 9*SZREG + 8*SZFREG + 0*SZVREG
|
||||||
|
+ vld vr1, sp, 9*SZREG + 8*SZFREG + 1*SZVREG
|
||||||
|
+ vld vr2, sp, 9*SZREG + 8*SZFREG + 2*SZVREG
|
||||||
|
+ vld vr3, sp, 9*SZREG + 8*SZFREG + 3*SZVREG
|
||||||
|
+ vld vr4, sp, 9*SZREG + 8*SZFREG + 4*SZVREG
|
||||||
|
+ vld vr5, sp, 9*SZREG + 8*SZFREG + 5*SZVREG
|
||||||
|
+ vld vr6, sp, 9*SZREG + 8*SZFREG + 6*SZVREG
|
||||||
|
+ vld vr7, sp, 9*SZREG + 8*SZFREG + 7*SZVREG
|
||||||
|
+#elif !defined __loongarch_soft_float
|
||||||
|
+ FREG_L fa0, sp, 9*SZREG + 0*SZFREG
|
||||||
|
+ FREG_L fa1, sp, 9*SZREG + 1*SZFREG
|
||||||
|
+ FREG_L fa2, sp, 9*SZREG + 2*SZFREG
|
||||||
|
+ FREG_L fa3, sp, 9*SZREG + 3*SZFREG
|
||||||
|
+ FREG_L fa4, sp, 9*SZREG + 4*SZFREG
|
||||||
|
+ FREG_L fa5, sp, 9*SZREG + 5*SZFREG
|
||||||
|
+ FREG_L fa6, sp, 9*SZREG + 6*SZFREG
|
||||||
|
+ FREG_L fa7, sp, 9*SZREG + 7*SZFREG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+ ADDI sp, sp, FRAME_SIZE
|
||||||
|
|
||||||
|
- # Invoke the callee.
|
||||||
|
+ /* Invoke the callee. */
|
||||||
|
jirl zero, t1, 0
|
||||||
|
END (_dl_runtime_resolve)
|
||||||
|
diff --git a/sysdeps/loongarch/sys/asm.h b/sysdeps/loongarch/sys/asm.h
|
||||||
|
index 734e45ae..e80c6245 100644
|
||||||
|
--- a/sysdeps/loongarch/sys/asm.h
|
||||||
|
+++ b/sysdeps/loongarch/sys/asm.h
|
||||||
|
@@ -9,8 +9,17 @@
|
||||||
|
# define PTRLOG 3
|
||||||
|
# define SZREG 8
|
||||||
|
# define SZFREG 8
|
||||||
|
+# define SZVREG 16
|
||||||
|
+# define SZXREG 32
|
||||||
|
# define REG_L ld.d
|
||||||
|
# define REG_S st.d
|
||||||
|
+# define SRLI srli.d
|
||||||
|
+# define SLLI slli.d
|
||||||
|
+# define ADDI addi.d
|
||||||
|
+# define ADD add.d
|
||||||
|
+# define SUB sub.d
|
||||||
|
+# define BSTRINS bstrins.d
|
||||||
|
+# define LI li.d
|
||||||
|
# define FREG_L fld.d
|
||||||
|
# define FREG_S fst.d
|
||||||
|
#elif defined __loongarch32
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
3031
glibc-2.28-Refactor-code-of-raw-mem-functions.patch
Normal file
3031
glibc-2.28-Refactor-code-of-raw-mem-functions.patch
Normal file
File diff suppressed because it is too large
Load diff
2770
glibc-2.28-Refactor-code-of-st-r-p-functions.patch
Normal file
2770
glibc-2.28-Refactor-code-of-st-r-p-functions.patch
Normal file
File diff suppressed because it is too large
Load diff
292
glibc-2.28-Remove-unseless-ANDROID_CHANGES-and-relat.patch
Normal file
292
glibc-2.28-Remove-unseless-ANDROID_CHANGES-and-relat.patch
Normal file
|
@ -0,0 +1,292 @@
|
||||||
|
From e2dd1f13592fa3b99b70eb54cc61e9f98cdcb123 Mon Sep 17 00:00:00 2001
|
||||||
|
From: caiyinyu <caiyinyu@loongson.cn>
|
||||||
|
Date: Mon, 17 Apr 2023 17:20:04 +0800
|
||||||
|
Subject: [PATCH 01/14] glibc-2.28: Remove unseless ANDROID_CHANGES and related
|
||||||
|
code.
|
||||||
|
|
||||||
|
Change-Id: Ib08e92d435126c7b56096ff6f24f1c6b5ea57f46
|
||||||
|
Signed-off-by: ticat_fp <fanpeng@loongson.cn>
|
||||||
|
---
|
||||||
|
sysdeps/loongarch/lp64/memchr.S | 6 ------
|
||||||
|
sysdeps/loongarch/lp64/memcpy.S | 13 -------------
|
||||||
|
sysdeps/loongarch/lp64/memset.S | 6 ------
|
||||||
|
sysdeps/loongarch/lp64/multiarch/memcpy-unaligned.S | 6 ------
|
||||||
|
.../loongarch/lp64/multiarch/memmove-unaligned.S | 6 ------
|
||||||
|
sysdeps/loongarch/lp64/multiarch/memset-unaligned.S | 7 -------
|
||||||
|
sysdeps/loongarch/lp64/multiarch/strchr-unaligned.S | 2 --
|
||||||
|
.../loongarch/lp64/multiarch/strchrnul-unaligned.S | 2 --
|
||||||
|
sysdeps/loongarch/lp64/multiarch/strcpy-unaligned.S | 2 --
|
||||||
|
sysdeps/loongarch/lp64/multiarch/strlen-unaligned.S | 2 --
|
||||||
|
.../loongarch/lp64/multiarch/strncmp-unaligned.S | 2 --
|
||||||
|
.../loongarch/lp64/multiarch/strnlen-unaligned.S | 2 --
|
||||||
|
12 files changed, 56 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/sysdeps/loongarch/lp64/memchr.S b/sysdeps/loongarch/lp64/memchr.S
|
||||||
|
index ec34b1af..75c4e15c 100644
|
||||||
|
--- a/sysdeps/loongarch/lp64/memchr.S
|
||||||
|
+++ b/sysdeps/loongarch/lp64/memchr.S
|
||||||
|
@@ -11,11 +11,7 @@
|
||||||
|
#define MEMCHR_NAME memchr
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-#ifdef ANDROID_CHANGES
|
||||||
|
-LEAF(MEMCHR_NAME, 0)
|
||||||
|
-#else
|
||||||
|
LEAF(MEMCHR_NAME)
|
||||||
|
-#endif
|
||||||
|
.align 6
|
||||||
|
beqz a2, L(out)
|
||||||
|
andi t1, a0, 0x7
|
||||||
|
@@ -92,8 +88,6 @@ L(out):
|
||||||
|
jr ra
|
||||||
|
END(MEMCHR_NAME)
|
||||||
|
|
||||||
|
-#ifndef ANDROID_CHANGES
|
||||||
|
#ifdef _LIBC
|
||||||
|
libc_hidden_builtin_def (MEMCHR_NAME)
|
||||||
|
#endif
|
||||||
|
-#endif
|
||||||
|
diff --git a/sysdeps/loongarch/lp64/memcpy.S b/sysdeps/loongarch/lp64/memcpy.S
|
||||||
|
index 1076e678..b6ca60a1 100644
|
||||||
|
--- a/sysdeps/loongarch/lp64/memcpy.S
|
||||||
|
+++ b/sysdeps/loongarch/lp64/memcpy.S
|
||||||
|
@@ -35,29 +35,18 @@
|
||||||
|
st.d t6, reg, n+48; \
|
||||||
|
st.d t7, reg, n+56;
|
||||||
|
|
||||||
|
-#ifdef ANDROID_CHANGES
|
||||||
|
-LEAF(MEMMOVE_NAME, 0)
|
||||||
|
-#else
|
||||||
|
LEAF(MEMMOVE_NAME)
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
.align 6
|
||||||
|
sub.d t0, a0, a1
|
||||||
|
bltu t0, a2, L(copy_back)
|
||||||
|
|
||||||
|
END(MEMMOVE_NAME)
|
||||||
|
|
||||||
|
-#ifndef ANDROID_CHANGES
|
||||||
|
#ifdef _LIBC
|
||||||
|
libc_hidden_builtin_def (MEMMOVE_NAME)
|
||||||
|
#endif
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
-#ifdef ANDROID_CHANGES
|
||||||
|
-LEAF(MEMCPY_NAME, 0)
|
||||||
|
-#else
|
||||||
|
LEAF(MEMCPY_NAME)
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
srai.d a3, a2, 4
|
||||||
|
beqz a3, L(short_data) # less than 16 bytes
|
||||||
|
@@ -811,8 +800,6 @@ L(back_end):
|
||||||
|
|
||||||
|
END(MEMCPY_NAME)
|
||||||
|
|
||||||
|
-#ifndef ANDROID_CHANGES
|
||||||
|
#ifdef _LIBC
|
||||||
|
libc_hidden_builtin_def (MEMCPY_NAME)
|
||||||
|
#endif
|
||||||
|
-#endif
|
||||||
|
diff --git a/sysdeps/loongarch/lp64/memset.S b/sysdeps/loongarch/lp64/memset.S
|
||||||
|
index 9fe42b24..41629e7e 100644
|
||||||
|
--- a/sysdeps/loongarch/lp64/memset.S
|
||||||
|
+++ b/sysdeps/loongarch/lp64/memset.S
|
||||||
|
@@ -21,11 +21,7 @@
|
||||||
|
st.d a1, a0, n+48; \
|
||||||
|
st.d a1, a0, n+56;
|
||||||
|
|
||||||
|
-#ifdef ANDROID_CHANGES
|
||||||
|
-LEAF(MEMSET_NAME, 0)
|
||||||
|
-#else
|
||||||
|
LEAF(MEMSET_NAME)
|
||||||
|
-#endif
|
||||||
|
.align 6
|
||||||
|
move t0, a0
|
||||||
|
andi a3, a0, 0x7
|
||||||
|
@@ -166,8 +162,6 @@ L(short_0):
|
||||||
|
|
||||||
|
END(MEMSET_NAME)
|
||||||
|
|
||||||
|
-#ifndef ANDROID_CHANGES
|
||||||
|
#ifdef _LIBC
|
||||||
|
libc_hidden_builtin_def (MEMSET_NAME)
|
||||||
|
#endif
|
||||||
|
-#endif
|
||||||
|
diff --git a/sysdeps/loongarch/lp64/multiarch/memcpy-unaligned.S b/sysdeps/loongarch/lp64/multiarch/memcpy-unaligned.S
|
||||||
|
index 5e38df0d..64b60244 100644
|
||||||
|
--- a/sysdeps/loongarch/lp64/multiarch/memcpy-unaligned.S
|
||||||
|
+++ b/sysdeps/loongarch/lp64/multiarch/memcpy-unaligned.S
|
||||||
|
@@ -31,11 +31,7 @@
|
||||||
|
st.d t6, reg, n+48; \
|
||||||
|
st.d t7, reg, n+56;
|
||||||
|
|
||||||
|
-#ifdef ANDROID_CHANGES
|
||||||
|
-LEAF(MEMCPY_NAME, 0)
|
||||||
|
-#else
|
||||||
|
LEAF(MEMCPY_NAME)
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
//1st var: dst ptr: void *a1 $r4 a0
|
||||||
|
//2nd var: src ptr: void *a2 $r5 a1
|
||||||
|
@@ -250,10 +246,8 @@ end_0_8_unalign:
|
||||||
|
|
||||||
|
END(MEMCPY_NAME)
|
||||||
|
|
||||||
|
-#ifndef ANDROID_CHANGES
|
||||||
|
#ifdef _LIBC
|
||||||
|
libc_hidden_builtin_def (MEMCPY_NAME)
|
||||||
|
#endif
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
diff --git a/sysdeps/loongarch/lp64/multiarch/memmove-unaligned.S b/sysdeps/loongarch/lp64/multiarch/memmove-unaligned.S
|
||||||
|
index 27ed0c9c..42920a1a 100644
|
||||||
|
--- a/sysdeps/loongarch/lp64/multiarch/memmove-unaligned.S
|
||||||
|
+++ b/sysdeps/loongarch/lp64/multiarch/memmove-unaligned.S
|
||||||
|
@@ -100,11 +100,7 @@
|
||||||
|
LD_64(a4, -1024); \
|
||||||
|
ST_64(a3, -1024);
|
||||||
|
|
||||||
|
-#ifdef ANDROID_CHANGES
|
||||||
|
-LEAF(MEMMOVE_NAME, 0)
|
||||||
|
-#else
|
||||||
|
LEAF(MEMMOVE_NAME)
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
//1st var: dest ptr: void *str1 $r4 a0
|
||||||
|
//2nd var: src ptr: void *str2 $r5 a1
|
||||||
|
@@ -469,10 +465,8 @@ end_unalign_proc_back:
|
||||||
|
|
||||||
|
END(MEMMOVE_NAME)
|
||||||
|
|
||||||
|
-#ifndef ANDROID_CHANGES
|
||||||
|
#ifdef _LIBC
|
||||||
|
libc_hidden_builtin_def (MEMMOVE_NAME)
|
||||||
|
#endif
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
diff --git a/sysdeps/loongarch/lp64/multiarch/memset-unaligned.S b/sysdeps/loongarch/lp64/multiarch/memset-unaligned.S
|
||||||
|
index 16ff2ef7..54e51546 100644
|
||||||
|
--- a/sysdeps/loongarch/lp64/multiarch/memset-unaligned.S
|
||||||
|
+++ b/sysdeps/loongarch/lp64/multiarch/memset-unaligned.S
|
||||||
|
@@ -33,12 +33,7 @@
|
||||||
|
//2nd var: int val $5 a1
|
||||||
|
//3rd var: size_t num $6 a2
|
||||||
|
|
||||||
|
-#ifdef ANDROID_CHANGES
|
||||||
|
-LEAF(MEMSET_NAME, 0)
|
||||||
|
-#else
|
||||||
|
LEAF(MEMSET_NAME)
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
.align 6
|
||||||
|
bstrins.d a1, a1, 15, 8
|
||||||
|
add.d t7, a0, a2
|
||||||
|
@@ -168,10 +163,8 @@ end_0_8_unalign:
|
||||||
|
|
||||||
|
END(MEMSET_NAME)
|
||||||
|
|
||||||
|
-#ifndef ANDROID_CHANGES
|
||||||
|
#ifdef _LIBC
|
||||||
|
libc_hidden_builtin_def (MEMSET_NAME)
|
||||||
|
#endif
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
diff --git a/sysdeps/loongarch/lp64/multiarch/strchr-unaligned.S b/sysdeps/loongarch/lp64/multiarch/strchr-unaligned.S
|
||||||
|
index 1d5e56c5..de6c7f4f 100644
|
||||||
|
--- a/sysdeps/loongarch/lp64/multiarch/strchr-unaligned.S
|
||||||
|
+++ b/sysdeps/loongarch/lp64/multiarch/strchr-unaligned.S
|
||||||
|
@@ -123,10 +123,8 @@ L(_mc8_a):
|
||||||
|
jr ra
|
||||||
|
END(STRCHR_NAME)
|
||||||
|
|
||||||
|
-#ifndef ANDROID_CHANGES
|
||||||
|
#ifdef _LIBC
|
||||||
|
libc_hidden_builtin_def (STRCHR_NAME)
|
||||||
|
#endif
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
diff --git a/sysdeps/loongarch/lp64/multiarch/strchrnul-unaligned.S b/sysdeps/loongarch/lp64/multiarch/strchrnul-unaligned.S
|
||||||
|
index 6338d005..abc246ca 100644
|
||||||
|
--- a/sysdeps/loongarch/lp64/multiarch/strchrnul-unaligned.S
|
||||||
|
+++ b/sysdeps/loongarch/lp64/multiarch/strchrnul-unaligned.S
|
||||||
|
@@ -136,11 +136,9 @@ L(_mc8_a):
|
||||||
|
jr ra
|
||||||
|
END(STRCHRNUL_NAME)
|
||||||
|
|
||||||
|
-#ifndef ANDROID_CHANGES
|
||||||
|
#ifdef _LIBC
|
||||||
|
weak_alias(STRCHRNUL_NAME, strchrnul)
|
||||||
|
libc_hidden_builtin_def (STRCHRNUL_NAME)
|
||||||
|
#endif
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
diff --git a/sysdeps/loongarch/lp64/multiarch/strcpy-unaligned.S b/sysdeps/loongarch/lp64/multiarch/strcpy-unaligned.S
|
||||||
|
index 449733cb..c77dc1a9 100644
|
||||||
|
--- a/sysdeps/loongarch/lp64/multiarch/strcpy-unaligned.S
|
||||||
|
+++ b/sysdeps/loongarch/lp64/multiarch/strcpy-unaligned.S
|
||||||
|
@@ -190,10 +190,8 @@ strcpy_page_cross:
|
||||||
|
beqz has_nul, strcpy_page_cross_ok
|
||||||
|
b strcpy_end
|
||||||
|
END(STRCPY)
|
||||||
|
-#ifndef ANDROID_CHANGES
|
||||||
|
#ifdef _LIBC
|
||||||
|
libc_hidden_builtin_def (STRCPY)
|
||||||
|
#endif
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
diff --git a/sysdeps/loongarch/lp64/multiarch/strlen-unaligned.S b/sysdeps/loongarch/lp64/multiarch/strlen-unaligned.S
|
||||||
|
index e9b7cf67..2fe0fb34 100644
|
||||||
|
--- a/sysdeps/loongarch/lp64/multiarch/strlen-unaligned.S
|
||||||
|
+++ b/sysdeps/loongarch/lp64/multiarch/strlen-unaligned.S
|
||||||
|
@@ -107,10 +107,8 @@ strlen_loop_noascii:
|
||||||
|
jr ra
|
||||||
|
END(STRLEN)
|
||||||
|
|
||||||
|
-#ifndef ANDROID_CHANGES
|
||||||
|
#ifdef _LIBC
|
||||||
|
libc_hidden_builtin_def (STRLEN)
|
||||||
|
#endif
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
diff --git a/sysdeps/loongarch/lp64/multiarch/strncmp-unaligned.S b/sysdeps/loongarch/lp64/multiarch/strncmp-unaligned.S
|
||||||
|
index 558df29b..6ec107ca 100644
|
||||||
|
--- a/sysdeps/loongarch/lp64/multiarch/strncmp-unaligned.S
|
||||||
|
+++ b/sysdeps/loongarch/lp64/multiarch/strncmp-unaligned.S
|
||||||
|
@@ -248,10 +248,8 @@ strncmp_ret0:
|
||||||
|
then exchange(src1,src2). */
|
||||||
|
|
||||||
|
END(STRNCMP)
|
||||||
|
-#ifndef ANDROID_CHANGES
|
||||||
|
#ifdef _LIBC
|
||||||
|
libc_hidden_builtin_def (STRNCMP)
|
||||||
|
#endif
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
diff --git a/sysdeps/loongarch/lp64/multiarch/strnlen-unaligned.S b/sysdeps/loongarch/lp64/multiarch/strnlen-unaligned.S
|
||||||
|
index 60eccf00..4a195b7c 100644
|
||||||
|
--- a/sysdeps/loongarch/lp64/multiarch/strnlen-unaligned.S
|
||||||
|
+++ b/sysdeps/loongarch/lp64/multiarch/strnlen-unaligned.S
|
||||||
|
@@ -136,10 +136,8 @@ L(_hit_limit):
|
||||||
|
move len, limit
|
||||||
|
jr ra
|
||||||
|
END(STRNLEN)
|
||||||
|
-#ifndef ANDROID_CHANGES
|
||||||
|
#ifdef _LIBC
|
||||||
|
libc_hidden_builtin_def (STRNLEN)
|
||||||
|
#endif
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
40
glibc-2.28-Remove-useless-IS_LA-264-364-464-and-IS_L.patch
Normal file
40
glibc-2.28-Remove-useless-IS_LA-264-364-464-and-IS_L.patch
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
From f4041e5da609a9f5da966fa000c00b150788a948 Mon Sep 17 00:00:00 2001
|
||||||
|
From: caiyinyu <caiyinyu@loongson.cn>
|
||||||
|
Date: Sun, 23 Jul 2023 14:32:08 +0800
|
||||||
|
Subject: [PATCH 13/14] glibc-2.28: Remove useless IS_LA{264,364,464} and
|
||||||
|
IS_LA{264, 364, 464}.
|
||||||
|
|
||||||
|
Change-Id: Id9a573510e2a493151191372d651f381ec2aefe7
|
||||||
|
Signed-off-by: ticat_fp <fanpeng@loongson.cn>
|
||||||
|
---
|
||||||
|
sysdeps/unix/sysv/linux/loongarch/cpu-features.h | 7 -------
|
||||||
|
1 file changed, 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/sysdeps/unix/sysv/linux/loongarch/cpu-features.h b/sysdeps/unix/sysv/linux/loongarch/cpu-features.h
|
||||||
|
index b46a8489..2703d4f7 100644
|
||||||
|
--- a/sysdeps/unix/sysv/linux/loongarch/cpu-features.h
|
||||||
|
+++ b/sysdeps/unix/sysv/linux/loongarch/cpu-features.h
|
||||||
|
@@ -22,10 +22,6 @@
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <sys/auxv.h>
|
||||||
|
|
||||||
|
-#define LA264 0x14a000
|
||||||
|
-#define LA364 0x14b000
|
||||||
|
-#define LA464 0x14c011
|
||||||
|
-
|
||||||
|
struct cpu_features
|
||||||
|
{
|
||||||
|
uint64_t cpucfg_prid;
|
||||||
|
@@ -42,9 +38,6 @@ extern const struct cpu_features *_dl_larch_get_cpu_features (void)
|
||||||
|
:"=r"(ret) \
|
||||||
|
:"r"(index));
|
||||||
|
|
||||||
|
-#define IS_LA264(prid) (prid == LA264)
|
||||||
|
-#define IS_LA364(prid) (prid == LA364)
|
||||||
|
-#define IS_LA464(prid) (prid == LA464)
|
||||||
|
#define SUPPORT_UAL (GLRO (dl_hwcap) & HWCAP_LOONGARCH_UAL)
|
||||||
|
#define SUPPORT_LSX (GLRO (dl_hwcap) & HWCAP_LOONGARCH_LSX)
|
||||||
|
#define SUPPORT_LASX (GLRO (dl_hwcap) & HWCAP_LOONGARCH_LASX)
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
123
glibc-2.28-Use-RTLD_SUPPORT_-LSX-LASX-to-choose-_dl_.patch
Normal file
123
glibc-2.28-Use-RTLD_SUPPORT_-LSX-LASX-to-choose-_dl_.patch
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
From c94d9376e241dc52eb9f2a2107313b7836e0e9ad Mon Sep 17 00:00:00 2001
|
||||||
|
From: caiyinyu <caiyinyu@loongson.cn>
|
||||||
|
Date: Wed, 6 Sep 2023 16:41:09 +0800
|
||||||
|
Subject: [PATCH 14/14] glibc-2.28: Use RTLD_SUPPORT_{LSX, LASX} to choose
|
||||||
|
_dl_runtime_resolve.
|
||||||
|
|
||||||
|
Key Points:
|
||||||
|
1. On lasx & lsx platforms, use _dl_runtime_resolve_{lsx, lasx} to save vector registers.
|
||||||
|
2. Via "tunables", users can choose str/mem functions with
|
||||||
|
`export GLIBC_TUNABLES=glibc.cpu.hwcaps=LASX`.
|
||||||
|
Note: glibc.cpu.hwcaps doesn't affect _dl_runtime_resolve_{lsx, lasx} selection.
|
||||||
|
|
||||||
|
Usage Notes:
|
||||||
|
1. Only valid inputs: LASX, LSX, UAL. Case-sensitive, comma-separated, no spaces.
|
||||||
|
2. Example: `export GLIBC_TUNABLES=glibc.cpu.hwcaps=LASX,UAL` turns on LASX & UAL.
|
||||||
|
Unmentioned features turn off. With default ifunc: lasx > lsx > unaligned >
|
||||||
|
aligned > generic, effect is: lasx > unaligned > aligned > generic; lsx off.
|
||||||
|
3. Incorrect GLIBC_TUNABLES settings will show error messages.
|
||||||
|
4. Valid input examples:
|
||||||
|
- GLIBC_TUNABLES=glibc.cpu.hwcaps=LASX: lasx > aligned > generic.
|
||||||
|
- GLIBC_TUNABLES=glibc.cpu.hwcaps=LSX,UAL: lsx > unaligned > aligned > generic.
|
||||||
|
- GLIBC_TUNABLES=glibc.cpu.hwcaps=LASX,UAL,LASX,UAL,LSX,LASX,UAL: Repetitions
|
||||||
|
allowed but not recommended. Results in: lasx > lsx > unaligned > aligned >
|
||||||
|
generic.
|
||||||
|
|
||||||
|
Change-Id: I555ce2039bc36bf071fc9265d7b0bb7b93b96ae7
|
||||||
|
Signed-off-by: ticat_fp <fanpeng@loongson.cn>
|
||||||
|
---
|
||||||
|
sysdeps/loongarch/cpu-tunables.c | 2 +-
|
||||||
|
sysdeps/loongarch/dl-machine.h | 11 ++++++-----
|
||||||
|
sysdeps/unix/sysv/linux/loongarch/cpu-features.c | 2 ++
|
||||||
|
sysdeps/unix/sysv/linux/loongarch/cpu-features.h | 10 +++++++---
|
||||||
|
4 files changed, 16 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/sysdeps/loongarch/cpu-tunables.c b/sysdeps/loongarch/cpu-tunables.c
|
||||||
|
index 840c1b8c..e0799ca9 100644
|
||||||
|
--- a/sysdeps/loongarch/cpu-tunables.c
|
||||||
|
+++ b/sysdeps/loongarch/cpu-tunables.c
|
||||||
|
@@ -88,7 +88,7 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp)
|
||||||
|
}
|
||||||
|
while (*c != '\0');
|
||||||
|
|
||||||
|
- GLRO (dl_hwcap) &= hwcap;
|
||||||
|
+ GLRO (dl_larch_cpu_features).hwcap &= hwcap;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
diff --git a/sysdeps/loongarch/dl-machine.h b/sysdeps/loongarch/dl-machine.h
|
||||||
|
index ff520a07..b5f43c84 100644
|
||||||
|
--- a/sysdeps/loongarch/dl-machine.h
|
||||||
|
+++ b/sysdeps/loongarch/dl-machine.h
|
||||||
|
@@ -75,13 +75,14 @@ dl_platform_init (void)
|
||||||
|
GLRO(dl_platform) = NULL;
|
||||||
|
|
||||||
|
#ifdef SHARED
|
||||||
|
+ /* init_cpu_features has been called early from __libc_start_main in
|
||||||
|
+ static executable. */
|
||||||
|
+ init_cpu_features (&GLRO(dl_larch_cpu_features));
|
||||||
|
|
||||||
|
#if HAVE_TUNABLES
|
||||||
|
TUNABLE_GET (hwcaps, tunable_val_t *, TUNABLE_CALLBACK (set_hwcaps));
|
||||||
|
#endif
|
||||||
|
- /* init_cpu_features has been called early from __libc_start_main in
|
||||||
|
- static executable. */
|
||||||
|
- init_cpu_features (&GLRO(dl_larch_cpu_features));
|
||||||
|
+
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -396,9 +397,9 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
|
||||||
|
l->l_mach.plt = gotplt[1] + l->l_addr;
|
||||||
|
|
||||||
|
#if HAVE_LOONGARCH_VEC_ASM && !defined __loongarch_soft_float
|
||||||
|
- if (SUPPORT_LASX)
|
||||||
|
+ if (RTLD_SUPPORT_LASX)
|
||||||
|
gotplt[0] = (ElfW(Addr)) &_dl_runtime_resolve_lasx;
|
||||||
|
- else if (SUPPORT_LSX)
|
||||||
|
+ else if (RTLD_SUPPORT_LSX)
|
||||||
|
gotplt[0] = (ElfW(Addr)) &_dl_runtime_resolve_lsx;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
diff --git a/sysdeps/unix/sysv/linux/loongarch/cpu-features.c b/sysdeps/unix/sysv/linux/loongarch/cpu-features.c
|
||||||
|
index 80870f3c..cf015011 100644
|
||||||
|
--- a/sysdeps/unix/sysv/linux/loongarch/cpu-features.c
|
||||||
|
+++ b/sysdeps/unix/sysv/linux/loongarch/cpu-features.c
|
||||||
|
@@ -29,4 +29,6 @@ init_cpu_features (struct cpu_features *cpu_features)
|
||||||
|
|
||||||
|
__cpucfg(cpucfg_word, 2);
|
||||||
|
cpu_features->cpucfg_word_idx2 = cpucfg_word;
|
||||||
|
+
|
||||||
|
+ GLRO (dl_larch_cpu_features).hwcap = GLRO (dl_hwcap);
|
||||||
|
}
|
||||||
|
diff --git a/sysdeps/unix/sysv/linux/loongarch/cpu-features.h b/sysdeps/unix/sysv/linux/loongarch/cpu-features.h
|
||||||
|
index 2703d4f7..17c9f5a7 100644
|
||||||
|
--- a/sysdeps/unix/sysv/linux/loongarch/cpu-features.h
|
||||||
|
+++ b/sysdeps/unix/sysv/linux/loongarch/cpu-features.h
|
||||||
|
@@ -26,6 +26,7 @@ struct cpu_features
|
||||||
|
{
|
||||||
|
uint64_t cpucfg_prid;
|
||||||
|
uint64_t cpucfg_word_idx2;
|
||||||
|
+ uint64_t hwcap;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Get a pointer to the CPU features structure. */
|
||||||
|
@@ -38,9 +39,12 @@ extern const struct cpu_features *_dl_larch_get_cpu_features (void)
|
||||||
|
:"=r"(ret) \
|
||||||
|
:"r"(index));
|
||||||
|
|
||||||
|
-#define SUPPORT_UAL (GLRO (dl_hwcap) & HWCAP_LOONGARCH_UAL)
|
||||||
|
-#define SUPPORT_LSX (GLRO (dl_hwcap) & HWCAP_LOONGARCH_LSX)
|
||||||
|
-#define SUPPORT_LASX (GLRO (dl_hwcap) & HWCAP_LOONGARCH_LASX)
|
||||||
|
+#define SUPPORT_UAL (GLRO (dl_larch_cpu_features).hwcap & HWCAP_LOONGARCH_UAL)
|
||||||
|
+#define SUPPORT_LSX (GLRO (dl_larch_cpu_features).hwcap & HWCAP_LOONGARCH_LSX)
|
||||||
|
+#define SUPPORT_LASX (GLRO (dl_larch_cpu_features).hwcap & HWCAP_LOONGARCH_LASX)
|
||||||
|
+
|
||||||
|
+#define RTLD_SUPPORT_LSX (GLRO (dl_hwcap) & HWCAP_LOONGARCH_LSX)
|
||||||
|
+#define RTLD_SUPPORT_LASX (GLRO (dl_hwcap) & HWCAP_LOONGARCH_LASX)
|
||||||
|
|
||||||
|
#endif /* _CPU_FEATURES_LOONGARCH64_H */
|
||||||
|
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
91
glibc-2.28-config-Added-HAVE_LOONGARCH_VEC_ASM.patch
Normal file
91
glibc-2.28-config-Added-HAVE_LOONGARCH_VEC_ASM.patch
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
From 58b1f882644f839259505dde3205e226a1c649f1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: caiyinyu <caiyinyu@loongson.cn>
|
||||||
|
Date: Tue, 11 Jul 2023 15:42:26 +0800
|
||||||
|
Subject: [PATCH 10/14] glibc-2.28: config: Added HAVE_LOONGARCH_VEC_ASM.
|
||||||
|
|
||||||
|
Change-Id: Iea464ea0c975a351682a60f66251167f6c79385b
|
||||||
|
Signed-off-by: ticat_fp <fanpeng@loongson.cn>
|
||||||
|
---
|
||||||
|
config.h.in | 5 +++++
|
||||||
|
sysdeps/loongarch/configure | 28 ++++++++++++++++++++++++++++
|
||||||
|
sysdeps/loongarch/configure.ac | 15 +++++++++++++++
|
||||||
|
3 files changed, 48 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/config.h.in b/config.h.in
|
||||||
|
index 94d5ea36..fa53cc2d 100644
|
||||||
|
--- a/config.h.in
|
||||||
|
+++ b/config.h.in
|
||||||
|
@@ -123,6 +123,11 @@
|
||||||
|
/* RISC-V floating-point ABI for ld.so. */
|
||||||
|
#undef RISCV_ABI_FLEN
|
||||||
|
|
||||||
|
+/* Assembler support LoongArch LASX/LSX vector instructions.
|
||||||
|
+ This macro becomes obsolete when glibc increased the minimum
|
||||||
|
+ required version of GNU 'binutils' to 2.41 or later. */
|
||||||
|
+#define HAVE_LOONGARCH_VEC_ASM 0
|
||||||
|
+
|
||||||
|
/* Linux specific: minimum supported kernel version. */
|
||||||
|
#undef __LINUX_KERNEL_VERSION
|
||||||
|
|
||||||
|
diff --git a/sysdeps/loongarch/configure b/sysdeps/loongarch/configure
|
||||||
|
index 1e5abf81..0f0dae3a 100755
|
||||||
|
--- a/sysdeps/loongarch/configure
|
||||||
|
+++ b/sysdeps/loongarch/configure
|
||||||
|
@@ -2,3 +2,31 @@
|
||||||
|
# Local configure fragment for sysdeps/loongarch/elf.
|
||||||
|
|
||||||
|
#AC_DEFINE(PI_STATIC_AND_HIDDEN)
|
||||||
|
+
|
||||||
|
+# Check if asm support vector instructions.
|
||||||
|
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for vector support in assembler" >&5
|
||||||
|
+$as_echo_n "checking for vector support in assembler... " >&6; }
|
||||||
|
+if ${libc_cv_loongarch_vec_asm+:} false; then :
|
||||||
|
+ $as_echo_n "(cached) " >&6
|
||||||
|
+else
|
||||||
|
+ cat > conftest.s <<\EOF
|
||||||
|
+ vld $vr0, $sp, 0
|
||||||
|
+EOF
|
||||||
|
+if { ac_try='${CC-cc} -c $CFLAGS conftest.s -o conftest 1>&5'
|
||||||
|
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||||
|
+ (eval $ac_try) 2>&5
|
||||||
|
+ ac_status=$?
|
||||||
|
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
+ test $ac_status = 0; }; }; then
|
||||||
|
+ libc_cv_loongarch_vec_asm=yes
|
||||||
|
+else
|
||||||
|
+ libc_cv_loongarch_vec_asm=no
|
||||||
|
+fi
|
||||||
|
+rm -f conftest*
|
||||||
|
+fi
|
||||||
|
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_loongarch_vec_asm" >&5
|
||||||
|
+$as_echo "$libc_cv_loongarch_vec_asm" >&6; }
|
||||||
|
+if test $libc_cv_loongarch_vec_asm = yes; then
|
||||||
|
+ $as_echo "#define HAVE_LOONGARCH_VEC_ASM 1" >>confdefs.h
|
||||||
|
+
|
||||||
|
+fi
|
||||||
|
diff --git a/sysdeps/loongarch/configure.ac b/sysdeps/loongarch/configure.ac
|
||||||
|
index 67b46ce0..aac0efa9 100644
|
||||||
|
--- a/sysdeps/loongarch/configure.ac
|
||||||
|
+++ b/sysdeps/loongarch/configure.ac
|
||||||
|
@@ -4,3 +4,18 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
|
||||||
|
dnl It is always possible to access static and hidden symbols in an
|
||||||
|
dnl position independent way.
|
||||||
|
#AC_DEFINE(PI_STATIC_AND_HIDDEN)
|
||||||
|
+
|
||||||
|
+# Check if asm support vector instructions.
|
||||||
|
+AC_CACHE_CHECK(for vector support in assembler, libc_cv_loongarch_vec_asm, [dnl
|
||||||
|
+cat > conftest.s <<\EOF
|
||||||
|
+ vld $vr0, $sp, 0
|
||||||
|
+EOF
|
||||||
|
+if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s -o conftest 1>&AS_MESSAGE_LOG_FD); then
|
||||||
|
+ libc_cv_loongarch_vec_asm=yes
|
||||||
|
+else
|
||||||
|
+ libc_cv_loongarch_vec_asm=no
|
||||||
|
+fi
|
||||||
|
+rm -f conftest*])
|
||||||
|
+if test $libc_cv_loongarch_vec_asm = yes; then
|
||||||
|
+ AC_DEFINE(HAVE_LOONGARCH_VEC_ASM)
|
||||||
|
+fi
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
75
glibc-2.28-remove-ABILPX32-related-code.patch
Normal file
75
glibc-2.28-remove-ABILPX32-related-code.patch
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
From 0153532f680527c4378a10673518cabda2e02584 Mon Sep 17 00:00:00 2001
|
||||||
|
From: caiyinyu <caiyinyu@loongson.cn>
|
||||||
|
Date: Fri, 26 May 2023 14:58:39 +0800
|
||||||
|
Subject: [PATCH 05/14] glibc-2.28: remove ABILPX32 related code.
|
||||||
|
|
||||||
|
Change-Id: I73eb5bc4d4ca12e4d45ed6b533fa38d60a3a633f
|
||||||
|
Signed-off-by: ticat_fp <fanpeng@loongson.cn>
|
||||||
|
---
|
||||||
|
elf/elf.h | 3 +--
|
||||||
|
sysdeps/loongarch/dl-machine.h | 2 --
|
||||||
|
sysdeps/loongarch/nptl/bits/pthreadtypes-arch.h | 2 +-
|
||||||
|
sysdeps/loongarch/sys/regdef.h | 4 +---
|
||||||
|
4 files changed, 3 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/elf/elf.h b/elf/elf.h
|
||||||
|
index 65d1fb46..4bfbad61 100644
|
||||||
|
--- a/elf/elf.h
|
||||||
|
+++ b/elf/elf.h
|
||||||
|
@@ -3933,10 +3933,9 @@ enum
|
||||||
|
#define R_NDS32_TLS_TPOFF 102
|
||||||
|
#define R_NDS32_TLS_DESC 119
|
||||||
|
|
||||||
|
-/* LoongISA ELF Flags */
|
||||||
|
+/* LoongArch ELF Flags */
|
||||||
|
#define EF_LARCH_ABI 0x0003
|
||||||
|
#define EF_LARCH_ABI_LP64 0x0003
|
||||||
|
-#define EF_LARCH_ABI_LPX32 0x0002
|
||||||
|
#define EF_LARCH_ABI_LP32 0x0001
|
||||||
|
|
||||||
|
/* Loongarch specific dynamic relocations. */
|
||||||
|
diff --git a/sysdeps/loongarch/dl-machine.h b/sysdeps/loongarch/dl-machine.h
|
||||||
|
index 2d527241..6e9c6258 100644
|
||||||
|
--- a/sysdeps/loongarch/dl-machine.h
|
||||||
|
+++ b/sysdeps/loongarch/dl-machine.h
|
||||||
|
@@ -96,8 +96,6 @@ elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
|
||||||
|
|
||||||
|
#ifdef _ABILP64
|
||||||
|
if ((ehdr->e_flags & EF_LARCH_ABI) != EF_LARCH_ABI_LP64)
|
||||||
|
-#elif defined _ABILPX32
|
||||||
|
- if ((ehdr->e_flags & EF_LARCH_ABI) != EF_LARCH_ABI_LPX32)
|
||||||
|
#elif defined _ABILP32
|
||||||
|
if ((ehdr->e_flags & EF_LARCH_ABI) != EF_LARCH_ABI_LP32)
|
||||||
|
#else
|
||||||
|
diff --git a/sysdeps/loongarch/nptl/bits/pthreadtypes-arch.h b/sysdeps/loongarch/nptl/bits/pthreadtypes-arch.h
|
||||||
|
index 5a761355..aa63bce1 100644
|
||||||
|
--- a/sysdeps/loongarch/nptl/bits/pthreadtypes-arch.h
|
||||||
|
+++ b/sysdeps/loongarch/nptl/bits/pthreadtypes-arch.h
|
||||||
|
@@ -32,7 +32,7 @@
|
||||||
|
# define __SIZEOF_PTHREAD_BARRIER_T 32
|
||||||
|
# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
|
||||||
|
#else
|
||||||
|
-# error "rv32i-based systems are not supported"
|
||||||
|
+# error "32-bit based systems are not supported"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define __PTHREAD_COMPAT_PADDING_MID
|
||||||
|
diff --git a/sysdeps/loongarch/sys/regdef.h b/sysdeps/loongarch/sys/regdef.h
|
||||||
|
index 769784b8..36f00939 100644
|
||||||
|
--- a/sysdeps/loongarch/sys/regdef.h
|
||||||
|
+++ b/sysdeps/loongarch/sys/regdef.h
|
||||||
|
@@ -72,10 +72,8 @@
|
||||||
|
# define fs6 $f30
|
||||||
|
# define fs7 $f31
|
||||||
|
|
||||||
|
-#elif _LOONGARCH_SIM == _ABILPX32
|
||||||
|
-# error ABILPX32
|
||||||
|
#elif _LOONGARCH_SIM == _ABILP32
|
||||||
|
-# error ABILP32
|
||||||
|
+# error ABILP32 not support yet
|
||||||
|
#else
|
||||||
|
# error noABI
|
||||||
|
#endif
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
1033
glibc-2.28-use-new-macro-LEAF-and-ENTRY-and-modify-r.patch
Normal file
1033
glibc-2.28-use-new-macro-LEAF-and-ENTRY-and-modify-r.patch
Normal file
File diff suppressed because it is too large
Load diff
19
glibc.spec
19
glibc.spec
|
@ -133,7 +133,7 @@ end \
|
||||||
Summary: The GNU libc libraries
|
Summary: The GNU libc libraries
|
||||||
Name: glibc
|
Name: glibc
|
||||||
Version: %{glibcversion}
|
Version: %{glibcversion}
|
||||||
Release: %{glibcrelease}.12
|
Release: %{glibcrelease}.13
|
||||||
|
|
||||||
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
|
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
|
||||||
# libraries.
|
# libraries.
|
||||||
|
@ -1074,6 +1074,20 @@ Patch2006: glibc-Sync-to-lnd-35-for-LoongArch.patch
|
||||||
Patch2007: Fix-tst-cancel21.c-to-suit-kernel-struct-sigcontext-.patch
|
Patch2007: Fix-tst-cancel21.c-to-suit-kernel-struct-sigcontext-.patch
|
||||||
Patch2008: glibc-aarch64-Increase-small-and-medium-cases-for-__memcpy.patch
|
Patch2008: glibc-aarch64-Increase-small-and-medium-cases-for-__memcpy.patch
|
||||||
Patch2009: glibc-Add-Hygon-Support.patch
|
Patch2009: glibc-Add-Hygon-Support.patch
|
||||||
|
Patch2010: glibc-2.28-Remove-unseless-ANDROID_CHANGES-and-relat.patch
|
||||||
|
Patch2011: glibc-2.28-use-new-macro-LEAF-and-ENTRY-and-modify-r.patch
|
||||||
|
Patch2012: glibc-2.28-Fix-ifunc-str-mem-functions-xfail-problem.patch
|
||||||
|
Patch2013: glibc-2.28-Add-run-one-test-convenience-target-and-m.patch
|
||||||
|
Patch2014: glibc-2.28-remove-ABILPX32-related-code.patch
|
||||||
|
Patch2015: glibc-2.28-Refactor-code-of-raw-mem-functions.patch
|
||||||
|
Patch2016: glibc-2.28-Refactor-code-of-st-r-p-functions.patch
|
||||||
|
Patch2017: glibc-2.28-Add-new-struct-user_fp_state-in-user.h.patch
|
||||||
|
Patch2018: glibc-2.28-Redefine-macro-LEAF-ENTRY.patch
|
||||||
|
Patch2019: glibc-2.28-config-Added-HAVE_LOONGARCH_VEC_ASM.patch
|
||||||
|
Patch2020: glibc-2.28-Add-macro-defination-of-lasx-lsx-and-fcc-.patch
|
||||||
|
Patch2021: glibc-2.28-Refactor-code-and-fix-bug-in-_dl_runtime_.patch
|
||||||
|
Patch2022: glibc-2.28-Remove-useless-IS_LA-264-364-464-and-IS_L.patch
|
||||||
|
Patch2023: glibc-2.28-Use-RTLD_SUPPORT_-LSX-LASX-to-choose-_dl_.patch
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Continued list of core "glibc" package information:
|
# Continued list of core "glibc" package information:
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
@ -2908,6 +2922,9 @@ fi
|
||||||
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
|
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat May 11 2024 Peng Fan <fanpeng@loongson.cn> - 2.28-236.0.1.13
|
||||||
|
- Sync loongarch64 code to lnd.36.
|
||||||
|
|
||||||
* Mon May 06 2024 Rongwei Wang <rongwei.wang@linux.alibaba.com> - 2.28-236.0.1.12
|
* Mon May 06 2024 Rongwei Wang <rongwei.wang@linux.alibaba.com> - 2.28-236.0.1.12
|
||||||
- elf: Properly align PT_LOAD segments
|
- elf: Properly align PT_LOAD segments
|
||||||
- Sync loongarch64 code to lnd.35. (lixing@loongson.cn)
|
- Sync loongarch64 code to lnd.35. (lixing@loongson.cn)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue