Browse Source

dubhe: glibc: Upgrade version to 2.38

Forked from Poky master branch with SRCREV change.
Dropped 9a20fbe23f63d87e30b0291ae1dba863c0f5de31 from Poky as the suffix "-crosssdk" is still needed in Kirkstone version.

Signed-off-by: weiheng.cheng <weiheng.cheng@starfivetech.com>
weiheng.cheng 4 months ago
parent
commit
612b1049b1
64 changed files with 255 additions and 8317 deletions
  1. 2 2
      recipes-core/glibc/cross-localedef-native_2.38.bb
  2. 1 1
      recipes-core/glibc/glibc-common.inc
  3. 5 5
      recipes-core/glibc/glibc-locale.inc
  4. 0 0
      recipes-core/glibc/glibc-locale_2.38.bb
  5. 0 0
      recipes-core/glibc/glibc-mtrace_2.38.bb
  6. 5 5
      recipes-core/glibc/glibc-package.inc
  7. 0 0
      recipes-core/glibc/glibc-scripts_2.38.bb
  8. 1 0
      recipes-core/glibc/glibc-testsuite_2.38.bb
  9. 12 5
      recipes-core/glibc/glibc-version.inc
  10. 2 2
      recipes-core/glibc/glibc-y2038-tests_2.38.bb
  11. 3 1
      recipes-core/glibc/glibc.inc
  12. 0 528
      recipes-core/glibc/glibc/0001-Linux-Add-ppoll-fortify-symbol-for-64-bit-time_t-BZ-.patch
  13. 0 245
      recipes-core/glibc/glibc/0001-RISCV-enable-align-loops-8-for-optimized-func.patch
  14. 1 1
      recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch
  15. 0 273
      recipes-core/glibc/glibc/0001-modify-and-merge-sifive-patches-to-support-V.patch
  16. 0 297
      recipes-core/glibc/glibc/0002-RISCV-revert-strchrnul-strncmp-strnlen.patch
  17. 0 1529
      recipes-core/glibc/glibc/0002-add-vector-support-for-memset-memcmp-memmove-memcpy-.patch
  18. 1 1
      recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch
  19. 0 25
      recipes-core/glibc/glibc/0003-add-NT_RISCV_VECTOR-macro-definition-to-align-with-l.patch
  20. 4 4
      recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch
  21. 0 33
      recipes-core/glibc/glibc/0004-fix-the-bcmp-unrecognized-issue.patch
  22. 3 3
      recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch
  23. 19 20
      recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch
  24. 0 137
      recipes-core/glibc/glibc/0005-riscv-Resolve-symbols-directly-for-symbols-with-STO_.patch
  25. 0 33
      recipes-core/glibc/glibc/0006-change-memcpy_vector-LMUL-to-m8.patch
  26. 2 2
      recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch
  27. 0 182
      recipes-core/glibc/glibc/0007-add-header-files-for-vector-support.patch
  28. 5 5
      recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch
  29. 2 2
      recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch
  30. 0 598
      recipes-core/glibc/glibc/0008-prohibit-from-generating-plt-table-when-static-linki.patch
  31. 0 25
      recipes-core/glibc/glibc/0009-resolve-__memcmpeq-aliased-to-undefined-symbol-memcm.patch
  32. 43 43
      recipes-core/glibc/glibc/0009-yes-within-the-path-sets-wrong-config-variables.patch
  33. 1 1
      recipes-core/glibc/glibc/0010-eglibc-Cross-building-and-testing-instructions.patch
  34. 0 1382
      recipes-core/glibc/glibc/0010-merge-demin-s-mem_xxx-optimization.patch
  35. 0 32
      recipes-core/glibc/glibc/0011-add-alias-to-bcmp.patch
  36. 2 2
      recipes-core/glibc/glibc/0011-eglibc-Help-bootstrap-cross-toolchain.patch
  37. 3 3
      recipes-core/glibc/glibc/0012-eglibc-Resolve-__fpscr_values-on-SH4.patch
  38. 0 236
      recipes-core/glibc/glibc/0012-remove-unnecessary-changes-to-support-v.patch
  39. 12 12
      recipes-core/glibc/glibc/0013-eglibc-Forward-port-cross-locale-generation-support.patch
  40. 0 46
      recipes-core/glibc/glibc/0013-fix-compiling-error-when-march-not-include-b-ext.patch
  41. 0 53
      recipes-core/glibc/glibc/0014-fix-memcmp-bug-relate-to-use-jmp-table.patch
  42. 2 2
      recipes-core/glibc/glibc/0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch
  43. 0 53
      recipes-core/glibc/glibc/0015-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch
  44. 0 980
      recipes-core/glibc/glibc/0015-memxxx-align-version-with-merge-tech-or-B-ext.patch
  45. 2 2
      recipes-core/glibc/glibc/0015-powerpc-Do-not-ask-compiler-for-finding-arch.patch
  46. 0 29
      recipes-core/glibc/glibc/0016-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch
  47. 0 675
      recipes-core/glibc/glibc/0016-strxxx-B-ext-opt-version.patch
  48. 13 31
      recipes-core/glibc/glibc/0016-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch
  49. 1 1
      recipes-core/glibc/glibc/0017-Replace-echo-with-printf-builtin-in-nscd-init-script.patch
  50. 0 28
      recipes-core/glibc/glibc/0017-fix-strchr-missing-index-weak-alias.patch
  51. 0 25
      recipes-core/glibc/glibc/0018-fix-memmove-align-fail-because-of-typo.patch
  52. 4 3
      recipes-core/glibc/glibc/0018-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch
  53. 0 123
      recipes-core/glibc/glibc/0019-fix-missing-alias-functions.patch
  54. 5 5
      recipes-core/glibc/glibc/0019-timezone-Make-shell-interpreter-overridable-in-tzsel.patch
  55. 1 1
      recipes-core/glibc/glibc/0020-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch
  56. 5 5
      recipes-core/glibc/glibc/0021-fix-create-thread-failed-in-unprivileged-process-BZ-.patch
  57. 3 3
      recipes-core/glibc/glibc/0022-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch
  58. 56 0
      recipes-core/glibc/glibc/0023-aarch64-configure-Pass-mcpu-along-with-march-to-dete.patch
  59. 0 28
      recipes-core/glibc/glibc/0025-startup-Force-O2.patch
  60. 0 490
      recipes-core/glibc/glibc/1f34a2328890aa192141f96449d25b77f666bf47.patch
  61. 1 1
      recipes-core/glibc/glibc/check-test-wrapper
  62. 7 7
      recipes-core/glibc/glibc/run-ptest
  63. 26 50
      recipes-core/glibc/glibc_2.38.bb
  64. 0 1
      recipes-core/glibc/ldconfig-native_2.12.1.bb

+ 2 - 2
recipes-core/glibc/cross-localedef-native_2.36.bb → recipes-core/glibc/cross-localedef-native_2.38.bb

@@ -30,8 +30,8 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
            file://0012-eglibc-Resolve-__fpscr_values-on-SH4.patch \
            file://0013-eglibc-Forward-port-cross-locale-generation-support.patch \
            file://0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
-           file://0019-Replace-echo-with-printf-builtin-in-nscd-init-script.patch \
-           file://0021-timezone-Make-shell-interpreter-overridable-in-tzsel.patch \
+           file://0017-Replace-echo-with-printf-builtin-in-nscd-init-script.patch \
+           file://0019-timezone-Make-shell-interpreter-overridable-in-tzsel.patch \
            "
 # Makes for a rather long rev (22 characters), but...
 #

+ 1 - 1
recipes-core/glibc/glibc-common.inc

@@ -22,4 +22,4 @@ ARM_INSTRUCTION_SET:armv6 = "arm"
 #
 COMPATIBLE_HOST:libc-musl:class-target = "null"
 
-PV = "2.36"
+PV = "2.38"

+ 5 - 5
recipes-core/glibc/glibc-locale.inc

@@ -20,7 +20,7 @@ ENABLE_BINARY_LOCALE_GENERATION:pn-nativesdk-glibc-locale = "1"
 
 #enable locale generation on these arches
 # BINARY_LOCALE_ARCHES is a space separated list of regular expressions
-BINARY_LOCALE_ARCHES ?= "arc arm.* aarch64 i[3-6]86 x86_64 powerpc mips mips64 riscv32 riscv64"
+BINARY_LOCALE_ARCHES ?= "arc arm.* aarch64 i[3-6]86 x86_64 powerpc mips mips64 riscv32 riscv64 loongarch64"
 
 # set "1" to use cross-localedef for locale generation
 # set "0" for qemu emulation of native localedef for locale generation
@@ -37,22 +37,22 @@ PACKAGES_DYNAMIC = "^locale-base-.* \
 # Create a glibc-binaries package
 ALLOW_EMPTY:${BPN}-binaries = "1"
 PACKAGES += "${BPN}-binaries"
-RRECOMMENDS:${BPN}-binaries =  "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-binary") != -1])}"
+RRECOMMENDS:${BPN}-binaries =  "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-binary-") != -1])}"
 
 # Create a glibc-charmaps package
 ALLOW_EMPTY:${BPN}-charmaps = "1"
 PACKAGES += "${BPN}-charmaps"
-RRECOMMENDS:${BPN}-charmaps =  "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-charmap") != -1])}"
+RRECOMMENDS:${BPN}-charmaps =  "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-charmap-") != -1])}"
 
 # Create a glibc-gconvs package
 ALLOW_EMPTY:${BPN}-gconvs = "1"
 PACKAGES += "${BPN}-gconvs"
-RRECOMMENDS:${BPN}-gconvs =  "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-gconv") != -1])}"
+RRECOMMENDS:${BPN}-gconvs =  "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-gconv-") != -1])}"
 
 # Create a glibc-localedatas package
 ALLOW_EMPTY:${BPN}-localedatas = "1"
 PACKAGES += "${BPN}-localedatas"
-RRECOMMENDS:${BPN}-localedatas =  "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-localedata") != -1])}"
+RRECOMMENDS:${BPN}-localedatas =  "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-localedata-") != -1])}"
 
 DESCRIPTION:localedef = "glibc: compile locale definition files"
 

+ 0 - 0
recipes-core/glibc/glibc-locale_2.36.bb → recipes-core/glibc/glibc-locale_2.38.bb


+ 0 - 0
recipes-core/glibc/glibc-mtrace_2.36.bb → recipes-core/glibc/glibc-mtrace_2.38.bb


+ 5 - 5
recipes-core/glibc/glibc-package.inc

@@ -42,7 +42,7 @@ FILES_SOLIBSDEV = "${libdir}/lib*${SOLIBSDEV}"
 FILES:${PN}-dev += "${libdir}/libpthread.a ${libdir}/libdl.a ${libdir}/libutil.a ${libdir}/libanl.a ${libdir}/*_nonshared.a ${base_libdir}/*_nonshared.a ${base_libdir}/*.o ${datadir}/aclocal"
 RDEPENDS:${PN}-dev = "linux-libc-headers-dev"
 FILES:${PN}-staticdev += "${libdir}/*.a ${base_libdir}/*.a"
-FILES:nscd = "${sbindir}/nscd* ${sysconfdir}/init.d/nscd ${systemd_system_unitdir}/nscd* ${sysconfdir}/tmpfiles.d/nscd.conf \
+FILES:nscd = "${sbindir}/nscd* ${sysconfdir}/init.d/nscd ${systemd_system_unitdir}/nscd* ${nonarch_libdir}/tmpfiles.d/nscd.conf \
               ${sysconfdir}/nscd.conf ${sysconfdir}/default/volatiles/98_nscd ${localstatedir}/db/nscd"
 FILES:${PN}-mtrace = "${bindir}/mtrace"
 FILES:tzcode = "${bindir}/tzselect ${sbindir}/zic ${bindir}/zdump"
@@ -87,7 +87,7 @@ do_install() {
 		rmdir --ignore-fail-on-non-empty ${D}${libexecdir}
 	fi
 
-	oe_multilib_header bits/syscall.h bits/long-double.h bits/floatn.h bits/endianness.h bits/struct_rwlock.h
+	oe_multilib_header bits/syscall.h bits/long-double.h bits/floatn.h bits/endianness.h bits/struct_rwlock.h bits/math-vector.h
 
 	if [ -f ${D}${bindir}/mtrace ]; then
 		sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' -e '2s,exec.*perl,exec ${USRBINPATH}/env perl,' ${D}${bindir}/mtrace
@@ -132,9 +132,9 @@ def get_libc_fpu_setting(bb, d):
 
 do_install:append:class-target() {
 	if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
-		install -d ${D}${sysconfdir}/tmpfiles.d
+		install -d ${D}${nonarch_libdir}/tmpfiles.d
 		echo "d /run/nscd 755 root root -" \
-			> ${D}${sysconfdir}/tmpfiles.d/nscd.conf
+			> ${D}${nonarch_libdir}/tmpfiles.d/nscd.conf
 	fi
 
 	if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
@@ -280,7 +280,7 @@ python populate_packages:prepend () {
 pkg_postinst:nscd () {
 	if [ -z "$D" ]; then
 		if command -v systemd-tmpfiles >/dev/null; then
-			systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/nscd.conf
+			systemd-tmpfiles --create ${nonarch_libdir}/tmpfiles.d/nscd.conf
 		elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
 			${sysconfdir}/init.d/populate-volatile.sh update
 		fi

+ 0 - 0
recipes-core/glibc/glibc-scripts_2.36.bb → recipes-core/glibc/glibc-scripts_2.38.bb


+ 1 - 0
recipes-core/glibc/glibc-testsuite_2.36.bb → recipes-core/glibc/glibc-testsuite_2.38.bb

@@ -16,6 +16,7 @@ TOOLCHAIN_TEST_HOST_USER ??= "root"
 TOOLCHAIN_TEST_HOST_PORT ??= "2222"
 
 do_check[nostamp] = "1"
+do_check[network] = "1"
 do_check:append () {
     chmod 0755 ${WORKDIR}/check-test-wrapper
 

+ 12 - 5
recipes-core/glibc/glibc-version.inc

@@ -1,8 +1,15 @@
-SRCBRANCH ?= "release/2.36/master"
-PV = "2.36"
-SRCREV_glibc ?= "b3736d1a3c60a3ec9959bf3b38794958546bf6a2"
-SRCREV_localedef ?= "794da69788cbf9bf57b59a852f9f11307663fa87"
+SRCBRANCH ?= "release/2.38/master"
+PV = "2.38+git"
+SRCREV_glibc ?= "36f2487f13e3540be9ee0fb51876b1da72176d3f"
+SRCREV_localedef ?= "e0eca29583b9e0f62645c4316ced93cf4e4e26e1"
 
-GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
+GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git;protocol=https"
 
 UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+\.\d+(\.(?!90)\d+)*)"
+
+CVE_STATUS[CVE-2023-4527] = "fixed-version: Fixed in stable branch updates"
+CVE_STATUS[CVE-2023-4911] = "fixed-version: Fixed in stable branch updates"
+CVE_STATUS[CVE-2023-4806] = "fixed-version: Fixed in stable branch updates"
+CVE_STATUS[CVE-2023-5156] = "fixed-version: Fixed in stable branch updates"
+CVE_STATUS[CVE-2023-4527] = "fixed-version: Fixed in stable branch updates"
+CVE_STATUS[CVE-2023-0687] = "fixed-version: Fixed in stable branch updates"

+ 2 - 2
recipes-core/glibc/glibc-tests_2.36.bb → recipes-core/glibc/glibc-y2038-tests_2.38.bb

@@ -8,7 +8,7 @@ SRC_URI += "\
 	file://run-ptest \
 "
 
-SUMMARY = "glibc tests to be run with ptest"
+SUMMARY = "glibc tests using time32/time64 interfaces to be run with ptest for the purpose of checking y2038 compatiblity"
 
 # Erase some variables already set by glibc_${PV}
 python __anonymous() {
@@ -27,7 +27,7 @@ python __anonymous() {
 # Remove any leftovers from original glibc recipe
 RPROVIDES:${PN} = "${PN}"
 RRECOMMENDS:${PN} = ""
-RDEPENDS:${PN} = " glibc sed"
+RDEPENDS:${PN} = "glibc libgcc sed bash"
 RDEPENDS:${PN}-ptest = "${PN}"
 DEPENDS += "sed"
 

+ 3 - 1
recipes-core/glibc/glibc.inc

@@ -1,7 +1,9 @@
 require glibc-common.inc
 require glibc-ld.inc
 
-DEPENDS = "virtual/${TARGET_PREFIX}gcc libgcc-initial linux-libc-headers"
+DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}binutils${BUSUFFIX} libgcc-initial linux-libc-headers"
+BUSUFFIX= ""
+BUSUFFIX:class-nativesdk = "-crosssdk"
 
 PROVIDES = "virtual/libc"
 PROVIDES += "virtual/libintl virtual/libiconv"

+ 0 - 528
recipes-core/glibc/glibc/0001-Linux-Add-ppoll-fortify-symbol-for-64-bit-time_t-BZ-.patch

@@ -1,528 +0,0 @@
-From 69318192d16adc7d57adcd69fbbb1e3e107b2783 Mon Sep 17 00:00:00 2001
-From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-Date: Fri, 4 Nov 2022 16:02:52 -0300
-Subject: [PATCH] Linux: Add ppoll fortify symbol for 64 bit time_t (BZ# 29746)
-
-Similar to ppoll, the poll.h header needs to redirect the poll call
-to a proper fortified ppoll with 64 bit time_t support.
-
-The implementation is straightforward, just need to add a similar
-check as __poll_chk and call the 64 bit time_t ppoll version.  The
-debug fortify tests are also extended to cover 64 bit time_t for
-affected ABIs.
-
-Unfortunately it requires an aditional symbol, which makes backport
-tricky.  One possibility is to add a static inline version if compiler
-supports is and call abort instead of __chk_fail, so fortified version
-will call __poll64 in the end.
-
-Another possibility is to just remove the fortify support for
-_TIME_BITS=64.
-
-Checked on i686-linux-gnu.
-
-Upstream-Status: Backport
-
-Signed-off-by: Ola Nilsson <olani@axis.com>
----
- debug/Makefile                                | 41 ++++++++++++------
- include/sys/poll.h                            |  5 ++-
- io/bits/poll2.h                               | 25 +++++++++++
- sysdeps/unix/sysv/linux/Versions              |  5 +++
- sysdeps/unix/sysv/linux/arm/be/libc.abilist   |  1 +
- sysdeps/unix/sysv/linux/arm/le/libc.abilist   |  1 +
- sysdeps/unix/sysv/linux/csky/libc.abilist     |  1 +
- sysdeps/unix/sysv/linux/hppa/libc.abilist     |  1 +
- sysdeps/unix/sysv/linux/i386/libc.abilist     |  1 +
- .../sysv/linux/m68k/coldfire/libc.abilist     |  1 +
- .../unix/sysv/linux/m68k/m680x0/libc.abilist  |  1 +
- .../sysv/linux/microblaze/be/libc.abilist     |  1 +
- .../sysv/linux/microblaze/le/libc.abilist     |  1 +
- .../sysv/linux/mips/mips32/fpu/libc.abilist   |  1 +
- .../sysv/linux/mips/mips32/nofpu/libc.abilist |  1 +
- .../sysv/linux/mips/mips64/n32/libc.abilist   |  1 +
- sysdeps/unix/sysv/linux/nios2/libc.abilist    |  1 +
- .../linux/powerpc/powerpc32/fpu/libc.abilist  |  1 +
- .../powerpc/powerpc32/nofpu/libc.abilist      |  1 +
- sysdeps/unix/sysv/linux/ppoll.c               |  3 +-
- sysdeps/unix/sysv/linux/ppoll_chk.c           | 42 +++++++++++++++++++
- .../unix/sysv/linux/s390/s390-32/libc.abilist |  1 +
- sysdeps/unix/sysv/linux/sh/be/libc.abilist    |  1 +
- sysdeps/unix/sysv/linux/sh/le/libc.abilist    |  1 +
- .../sysv/linux/sparc/sparc32/libc.abilist     |  1 +
- 25 files changed, 125 insertions(+), 15 deletions(-)
- create mode 100644 sysdeps/unix/sysv/linux/ppoll_chk.c
-
-diff --git a/debug/Makefile b/debug/Makefile
-index 456b349c4d..075a135a2b 100644
---- a/debug/Makefile
-+++ b/debug/Makefile
-@@ -120,8 +120,10 @@ CPPFLAGS-tst-read-chk-cancel.c += -D_FORTIFY_SOURCE=2
- # CFLAGS for the file.
- 
- tests-all-chk = tst-fortify
--tests-c-chk =
--tests-cc-chk =
-+tests-c-def-chk =
-+tests-cc-def-chk =
-+tests-c-time64-chk =
-+tests-cc-time64-chk =
- 
- CFLAGS-tst-fortify.c += -Wno-format -Wno-deprecated-declarations -Wno-error
- 
-@@ -130,11 +132,11 @@ define cflags-default
- endef
- 
- define cflags-lfs
--CFLAGS-tst-fortify-$(1)-lfs-$(2).$(1) += -D_FILE_OFFSET_BITS=64
-+CFLAGS-tst-fortify-$(1)-lfs-$(2)-$(3).$(1) += -D_FILE_OFFSET_BITS=64
- endef
- 
- define cflags-nongnu
--CFLAGS-tst-fortify-$(1)-nongnu-$(2).$(1) += -D_LARGEFILE64_SOURCE=1
-+CFLAGS-tst-fortify-$(1)-nongnu-$(2)-$(3).$(1) += -D_LARGEFILE64_SOURCE=1
- endef
- 
- src-chk-nongnu = \#undef _GNU_SOURCE
-@@ -145,12 +147,12 @@ src-chk-nongnu = \#undef _GNU_SOURCE
- # And they also generate warnings from warning attributes, which
- # cannot be disabled via pragmas, so require -Wno-error to be used.
- define gen-chk-test
--tests-$(1)-chk += tst-fortify-$(1)-$(2)-$(3)
--CFLAGS-tst-fortify-$(1)-$(2)-$(3).$(1) += -D_FORTIFY_SOURCE=$(3) -Wno-format \
-+tests-$(1)-$(4)-chk += tst-fortify-$(1)-$(2)-$(3)-$(4)
-+CFLAGS-tst-fortify-$(1)-$(2)-$(3)-$(4).$(1) += -D_FORTIFY_SOURCE=$(3) -Wno-format \
- 					  -Wno-deprecated-declarations \
- 					  -Wno-error
--$(eval $(call cflags-$(2),$(1),$(3)))
--$(objpfx)tst-fortify-$(1)-$(2)-$(3).$(1): tst-fortify.c Makefile
-+$(eval $(call cflags-$(2),$(1),$(3),$(4)))
-+$(objpfx)tst-fortify-$(1)-$(2)-$(3)-$(4).$(1): tst-fortify.c Makefile
- 	( echo "/* Autogenerated from Makefile.  */"; \
- 	  echo "$(src-chk-$(2))"; \
- 	  echo "#include \"tst-fortify.c\"" ) > $$@.tmp
-@@ -159,19 +161,29 @@ endef
- 
- chk-extensions = c cc
- chk-types = default lfs nongnu
-+# 64 bit time_t implies LFS.
-+chk-types-time64 = default nongnu
- chk-levels = 1 2 3
- 
- $(foreach e,$(chk-extensions), \
-   $(foreach t,$(chk-types), \
-     $(foreach l,$(chk-levels), \
--      $(eval $(call gen-chk-test,$(e),$(t),$(l))))))
-+      $(eval $(call gen-chk-test,$(e),$(t),$(l),def)))))
- 
--tests-all-chk += $(tests-c-chk) $(tests-cc-chk)
-+tests-all-chk += $(tests-c-def-chk) $(tests-cc-def-chk)
-+
-+$(foreach e,$(chk-extensions), \
-+  $(foreach t,$(chk-types-time64), \
-+    $(foreach l,$(chk-levels), \
-+      $(eval $(call gen-chk-test,$(e),$(t),$(l),time64)))))
-+
-+tests-all-time64-chk += $(tests-c-time64-chk) $(tests-cc-time64-chk)
- 
- define link-cc
- LDLIBS-$(1) = -lstdc++
- endef
--$(foreach t,$(tests-cc-chk), $(eval $(call link-cc,$(t))))
-+$(foreach t,$(tests-cc-def-chk), $(eval $(call link-cc,$(t))))
-+$(foreach t,$(tests-cc-time64-chk), $(eval $(call link-cc,$(t))))
- 
- # backtrace_symbols only works if we link with -rdynamic.  backtrace
- # requires unwind tables on most architectures.
-@@ -201,6 +213,10 @@ tests = backtrace-tst \
- 	tst-realpath-chk \
- 	$(tests-all-chk)
- 
-+tests-time64 += \
-+	$(tests-all-time64-chk) \
-+	# tests-time64
-+
- ifeq ($(have-ssp),yes)
- tests += tst-ssp-1
- endif
-@@ -210,7 +226,7 @@ tests += tst-read-chk-cancel
- endif
- 
- ifeq (,$(CXX))
--tests-unsupported = $(tests-cc-chk)
-+tests-unsupported = $(tests-cc-def-chk) $(test-cc-time64-chk)
- endif
- 
- extra-libs = libpcprofile
-@@ -235,6 +251,7 @@ define chk-gen-locales
- $(objpfx)$(1).out: $(gen-locales)
- endef
- $(foreach t, $(tests-all-chk), $(eval $(call chk-gen-locales,$(t))))
-+$(foreach t, $(tests-all-time64-chk), $(eval $(call chk-gen-locales,$(t))))
- endif
- 
- sLIBdir := $(shell echo $(slibdir) | sed 's,lib\(\|64\)$$,\\\\$$LIB,')
-diff --git a/include/sys/poll.h b/include/sys/poll.h
-index f904e21f89..228704fe79 100644
---- a/include/sys/poll.h
-+++ b/include/sys/poll.h
-@@ -2,13 +2,16 @@
- # include <io/sys/poll.h>
- 
- #ifndef _ISOMAC
-+#include <include/struct___timespec64.h>
-+
- extern int __poll (struct pollfd *__fds, unsigned long int __nfds,
- 		   int __timeout);
- libc_hidden_proto (__poll)
- libc_hidden_proto (ppoll)
- 
- # if __TIMESIZE == 64
--#  define __ppoll64 __ppoll
-+#  define __ppoll64 ppoll
-+#  define __ppoll64_chk __ppoll_chk
- # else
- # include <time.h>
- # include <signal.h>
-diff --git a/io/bits/poll2.h b/io/bits/poll2.h
-index 3679d8451a..90f5574969 100644
---- a/io/bits/poll2.h
-+++ b/io/bits/poll2.h
-@@ -43,6 +43,30 @@ poll (struct pollfd *__fds, nfds_t __nfds, int __timeout)
- 
- 
- #ifdef __USE_GNU
-+# ifdef __USE_TIME_BITS64
-+extern int __REDIRECT (__ppoll64_alias, (struct pollfd *__fds, nfds_t __nfds,
-+				       const struct timespec *__timeout,
-+				       const __sigset_t *__ss), __ppoll64);
-+extern int __ppoll64_chk (struct pollfd *__fds, nfds_t __nfds,
-+			  const struct timespec *__timeout,
-+			  const __sigset_t *__ss, __SIZE_TYPE__ __fdslen)
-+    __attr_access ((__write_only__, 1, 2));
-+extern int __REDIRECT (__ppoll64_chk_warn, (struct pollfd *__fds, nfds_t __n,
-+					    const struct timespec *__timeout,
-+					    const __sigset_t *__ss,
-+					    __SIZE_TYPE__ __fdslen),
-+		       __ppoll64_chk)
-+  __warnattr ("ppoll called with fds buffer too small file nfds entries");
-+
-+__fortify_function __fortified_attr_access (__write_only__, 1, 2) int
-+ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout,
-+       const __sigset_t *__ss)
-+{
-+  return __glibc_fortify (ppoll64, __nfds, sizeof (*__fds),
-+			  __glibc_objsize (__fds),
-+			  __fds, __nfds, __timeout, __ss);
-+}
-+# else
- extern int __REDIRECT (__ppoll_alias, (struct pollfd *__fds, nfds_t __nfds,
- 				       const struct timespec *__timeout,
- 				       const __sigset_t *__ss), ppoll);
-@@ -65,6 +89,7 @@ ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout,
- 			  __glibc_objsize (__fds),
- 			  __fds, __nfds, __timeout, __ss);
- }
-+# endif
- #endif
- 
- __END_DECLS
-diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
-index 65d2ceda2c..ca6eb1a49e 100644
---- a/sysdeps/unix/sysv/linux/Versions
-+++ b/sysdeps/unix/sysv/linux/Versions
-@@ -313,6 +313,11 @@ libc {
-     process_madvise;
-     process_mrelease;
-   }
-+  GLIBC_2.37 {
-+%ifdef TIME64_NON_DEFAULT
-+    __ppoll64_chk;
-+%endif
-+  }
-   GLIBC_PRIVATE {
-     # functions used in other libraries
-     __syscall_rt_sigqueueinfo;
-diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
-index e0668a80cf..f28402fe03 100644
---- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
-@@ -513,6 +513,7 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
- GLIBC_2.4 _Exit F
- GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
- GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
-diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
-index d28e7c60b7..e2f56880ed 100644
---- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
-@@ -510,6 +510,7 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
- GLIBC_2.4 _Exit F
- GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
- GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
-diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
-index 922b05062f..319d92356e 100644
---- a/sysdeps/unix/sysv/linux/csky/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
-@@ -2669,3 +2669,4 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
-diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
-index 412144f94c..6450e17ebe 100644
---- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
-@@ -2618,6 +2618,7 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
- GLIBC_2.4 __confstr_chk F
- GLIBC_2.4 __fgets_chk F
- GLIBC_2.4 __fgets_unlocked_chk F
-diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
-index 134393900a..0a24ec9afd 100644
---- a/sysdeps/unix/sysv/linux/i386/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
-@@ -2802,6 +2802,7 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
- GLIBC_2.4 __confstr_chk F
- GLIBC_2.4 __fgets_chk F
- GLIBC_2.4 __fgets_unlocked_chk F
-diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
-index 0604029c68..16243a7a92 100644
---- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
-@@ -514,6 +514,7 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
- GLIBC_2.4 _Exit F
- GLIBC_2.4 _IO_2_1_stderr_ D 0x98
- GLIBC_2.4 _IO_2_1_stdin_ D 0x98
-diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
-index af2be5c80d..564a553b27 100644
---- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
-@@ -2745,6 +2745,7 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
- GLIBC_2.4 __confstr_chk F
- GLIBC_2.4 __fgets_chk F
- GLIBC_2.4 __fgets_unlocked_chk F
-diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
-index e090b8d48f..e850f47b21 100644
---- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
-@@ -2718,3 +2718,4 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
-diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
-index 8c5b2db243..37178c503f 100644
---- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
-@@ -2715,3 +2715,4 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
-diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
-index 68847134a2..3b30b31466 100644
---- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
-@@ -2710,6 +2710,7 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
- GLIBC_2.4 __confstr_chk F
- GLIBC_2.4 __fgets_chk F
- GLIBC_2.4 __fgets_unlocked_chk F
-diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
-index daa44e64fa..0e358570a2 100644
---- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
-@@ -2708,6 +2708,7 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
- GLIBC_2.4 __confstr_chk F
- GLIBC_2.4 __fgets_chk F
- GLIBC_2.4 __fgets_unlocked_chk F
-diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
-index 6169188c96..59c598b98f 100644
---- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
-@@ -2716,6 +2716,7 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
- GLIBC_2.4 __confstr_chk F
- GLIBC_2.4 __fgets_chk F
- GLIBC_2.4 __fgets_unlocked_chk F
-diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
-index 58e9b486b0..463e01ab84 100644
---- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
-@@ -2757,3 +2757,4 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
-diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
-index 8c9ca32cbe..405d40d11c 100644
---- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
-@@ -2772,6 +2772,7 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
- GLIBC_2.4 _IO_fprintf F
- GLIBC_2.4 _IO_printf F
- GLIBC_2.4 _IO_sprintf F
-diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
-index 08a6604aab..ce89602b93 100644
---- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
-@@ -2805,6 +2805,7 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
- GLIBC_2.4 _IO_fprintf F
- GLIBC_2.4 _IO_printf F
- GLIBC_2.4 _IO_sprintf F
-diff --git a/sysdeps/unix/sysv/linux/ppoll.c b/sysdeps/unix/sysv/linux/ppoll.c
-index 1105e29b00..2e173b931d 100644
---- a/sysdeps/unix/sysv/linux/ppoll.c
-+++ b/sysdeps/unix/sysv/linux/ppoll.c
-@@ -67,7 +67,7 @@ __ppoll64 (struct pollfd *fds, nfds_t nfds, const struct __timespec64 *timeout,
- libc_hidden_def (__ppoll64)
- 
- int
--__ppoll (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
-+ppoll (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
-          const sigset_t *sigmask)
- {
-   struct __timespec64 ts64;
-@@ -77,5 +77,4 @@ __ppoll (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
-   return __ppoll64 (fds, nfds, timeout ? &ts64 : NULL, sigmask);
- }
- #endif
--strong_alias (__ppoll, ppoll)
- libc_hidden_def (ppoll)
-diff --git a/sysdeps/unix/sysv/linux/ppoll_chk.c b/sysdeps/unix/sysv/linux/ppoll_chk.c
-new file mode 100644
-index 0000000000..65c4b56671
---- /dev/null
-+++ b/sysdeps/unix/sysv/linux/ppoll_chk.c
-@@ -0,0 +1,42 @@
-+/* Fortify ppoll implementation.  Linux version.
-+   Copyright (C) 2022 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/>.  */
-+
-+#include <poll.h>
-+
-+int
-+__ppoll64_chk (struct pollfd *fds, nfds_t nfds,
-+	       const struct __timespec64 *tmo, const __sigset_t *ss,
-+	       __SIZE_TYPE__ fdslen)
-+{
-+  if (fdslen / sizeof (*fds) < nfds)
-+    __chk_fail ();
-+
-+  return __ppoll64 (fds, nfds, tmo, ss);
-+}
-+
-+#if __TIMESIZE != 64
-+int
-+__ppoll_chk (struct pollfd *fds, nfds_t nfds, const struct timespec *tmo,
-+	     const __sigset_t *ss, __SIZE_TYPE__ fdslen)
-+{
-+  if (fdslen / sizeof (*fds) < nfds)
-+    __chk_fail ();
-+
-+  return ppoll (fds, nfds, tmo, ss);
-+}
-+#endif
-diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
-index 009f22931e..5ca051a9eb 100644
---- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
-@@ -2770,6 +2770,7 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
- GLIBC_2.4 _IO_fprintf F
- GLIBC_2.4 _IO_printf F
- GLIBC_2.4 _IO_sprintf F
-diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
-index afb5bc37b1..5b48168ec6 100644
---- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
-@@ -2625,6 +2625,7 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
- GLIBC_2.4 __confstr_chk F
- GLIBC_2.4 __fgets_chk F
- GLIBC_2.4 __fgets_unlocked_chk F
-diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
-index 2b53a3cf92..c42b39cea8 100644
---- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
-@@ -2622,6 +2622,7 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
- GLIBC_2.4 __confstr_chk F
- GLIBC_2.4 __fgets_chk F
- GLIBC_2.4 __fgets_unlocked_chk F
-diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
-index 43b9844a99..5a0a662dee 100644
---- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
-+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
-@@ -2765,6 +2765,7 @@ GLIBC_2.36 pidfd_open F
- GLIBC_2.36 pidfd_send_signal F
- GLIBC_2.36 process_madvise F
- GLIBC_2.36 process_mrelease F
-+GLIBC_2.37 __ppoll64_chk F
- GLIBC_2.4 _IO_fprintf F
- GLIBC_2.4 _IO_printf F
- GLIBC_2.4 _IO_sprintf F

+ 0 - 245
recipes-core/glibc/glibc/0001-RISCV-enable-align-loops-8-for-optimized-func.patch

@@ -1,245 +0,0 @@
-From 1199d8653f9c8e6f7d197a040f83e6374bcb376c Mon Sep 17 00:00:00 2001
-From: "demin.han" <demin.han@starfivetech.com>
-Date: Wed, 15 Mar 2023 15:29:14 +0800
-Subject: [PATCH 1/2] [RISCV] enable align-loops=8 for optimized func
-
----
- sysdeps/riscv/rv64/multiarch/memchr_as.S  | 1 +
- sysdeps/riscv/rv64/multiarch/memcmp_as.S  | 6 ++----
- sysdeps/riscv/rv64/multiarch/memcpy_as.S  | 2 ++
- sysdeps/riscv/rv64/multiarch/memmove_as.S | 6 ++++--
- sysdeps/riscv/rv64/multiarch/memrchr.S    | 1 +
- sysdeps/riscv/rv64/multiarch/memset_as.S  | 2 +-
- sysdeps/riscv/rv64/multiarch/strcmp_as.S  | 2 +-
- sysdeps/riscv/rv64/multiarch/strlen_as.S  | 2 +-
- sysdeps/riscv/rv64/strchr.S               | 1 +
- sysdeps/riscv/rv64/strchrnul.S            | 1 +
- sysdeps/riscv/rv64/strncmp.S              | 1 +
- sysdeps/riscv/rv64/strnlen.S              | 2 +-
- 12 files changed, 17 insertions(+), 10 deletions(-)
-
-diff --git a/sysdeps/riscv/rv64/multiarch/memchr_as.S b/sysdeps/riscv/rv64/multiarch/memchr_as.S
-index 4d3221c60e..1294562e1b 100644
---- a/sysdeps/riscv/rv64/multiarch/memchr_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/memchr_as.S
-@@ -55,6 +55,7 @@ ENTRY (__memchr)
-     slli    a3, a1, 32
-     or      a1, a1, a3
-     li      a5, -1
-+    .p2align 3
- .L_loop:
-     ld      a3, 0(a0)
-     xor     a3, a3, a1
-diff --git a/sysdeps/riscv/rv64/multiarch/memcmp_as.S b/sysdeps/riscv/rv64/multiarch/memcmp_as.S
-index 972f6cb5fd..8e8fd680d6 100644
---- a/sysdeps/riscv/rv64/multiarch/memcmp_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/memcmp_as.S
-@@ -57,6 +57,7 @@ ENTRY (memcmp)
-     andi    t5, a1, 0x7
-     andi    a2, a2, (16-1)
-     bnez    t5, .L_merge
-+    .p2align 3
- .L_loop:
-     ld      a3, 0(a1)
-     ld      a0, 0(a5)
-@@ -99,9 +100,6 @@ ENTRY (memcmp)
-     li      a0, 0
-     ret
- 
--    .balign 4
--    .option push
--    .option norvc
- .L_merge:
-     andi    a1, a1, -8
-     ld      t2, 0(a1)
-@@ -109,6 +107,7 @@ ENTRY (memcmp)
-     neg     t4, t3
-     andi    t4, t4, (64 - 1)
-     srl     t1, t2, t3
-+    .p2align 3
- 1:
-     ld      t2, 8(a1)
-     sll     a3, t2, t4
-@@ -123,7 +122,6 @@ ENTRY (memcmp)
-     ld      a0, 8(a5)
-     bne     a3, a0, .L_end
-     srl     t1, t2, t3
--    .option pop
- 
-     addi    a5, a5, 16
-     addi    a1, a1, 16
-diff --git a/sysdeps/riscv/rv64/multiarch/memcpy_as.S b/sysdeps/riscv/rv64/multiarch/memcpy_as.S
-index fae522684c..35419d2f9f 100644
---- a/sysdeps/riscv/rv64/multiarch/memcpy_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/memcpy_as.S
-@@ -78,6 +78,7 @@ ENTRY (memcpy)
-     andi    a4, a2, -32
-     beqz    a4, .L_tail
-     add     a4, a4, a5
-+    .p2align  3
- .L_loop:
-     copy_32B a5, a1
-     addi    a5, a5, 32
-@@ -121,6 +122,7 @@ ENTRY (memcpy)
-     neg     t4, t3
-     andi    t4, t4, (64 - 1)
-     srl     t1, t2, t3
-+    .p2align 3
- 1:
-     ld      t2, 8(a1)
-     sll     a3, t2, t4
-diff --git a/sysdeps/riscv/rv64/multiarch/memmove_as.S b/sysdeps/riscv/rv64/multiarch/memmove_as.S
-index 35d0905186..b859f9778d 100644
---- a/sysdeps/riscv/rv64/multiarch/memmove_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/memmove_as.S
-@@ -58,6 +58,7 @@ ENTRY (memmove)
-     andi    a2, a2, (32 - 1)
-     beqz    a4, .L_8B_fwd
-     add     a4, a4, a5
-+    .p2align 3
- 0:
-     ld      a3, 0(a1)
-     sd      a3, 0(a5)
-@@ -102,7 +103,6 @@ ENTRY (memmove)
- .L_ret_fwd:
-     ret
- 
--    .balign 4
- .L_merge_fwd:
-     andi    a4, a2, -8
-     beqz    a4, .L_byte_tail_fwd
-@@ -113,6 +113,7 @@ ENTRY (memmove)
-     neg     t4, t3
-     andi    t4, t4, (64 - 1)
-     srl     t1, t2, t3
-+    .p2align 3
- 1:
-     ld      t2, 8(a1)
-     sll     a3, t2, t4
-@@ -149,6 +150,7 @@ ENTRY (memmove)
-     andi    a2, a2, (32 - 1)
-     beqz    a4, .L_8B_bwd
-     sub     a4, a5, a4
-+    .p2align 3
- 0:
-     addi    a5, a5, -32
-     addi    a1, a1, -32
-@@ -193,7 +195,6 @@ ENTRY (memmove)
- .L_ret_bwd:
-     ret
- 
--    .balign 4
- .L_merge_bwd:
-     andi    a4, a2, -8
-     beqz    a4, .L_byte_tail_bwd
-@@ -204,6 +205,7 @@ ENTRY (memmove)
-     neg     t4, t3
-     andi    t4, t4, (64 - 1)
-     sll     t1, t2, t4
-+    .p2align 3
- 1:
-     ld      t2, -8(a1)
-     srl     a3, t2, t3
-diff --git a/sysdeps/riscv/rv64/multiarch/memrchr.S b/sysdeps/riscv/rv64/multiarch/memrchr.S
-index b72a13e62a..223db0702a 100644
---- a/sysdeps/riscv/rv64/multiarch/memrchr.S
-+++ b/sysdeps/riscv/rv64/multiarch/memrchr.S
-@@ -59,6 +59,7 @@ ENTRY (MEMRCHR)
-     slli    a3, a1, 32
-     or      a1, a1, a3
-     li      a5, -1
-+    .p2align 3
- .L_loop:
-     ld      a3, -8(a0)
-     xor     a3, a3, a1
-diff --git a/sysdeps/riscv/rv64/multiarch/memset_as.S b/sysdeps/riscv/rv64/multiarch/memset_as.S
-index 455033adf0..0793237051 100644
---- a/sysdeps/riscv/rv64/multiarch/memset_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/memset_as.S
-@@ -63,7 +63,7 @@ ENTRY (memset)
-     andi    a4, a2, -64
-     beqz    a4, .L_tail
-     add     a4, a4, a5
--
-+    .p2align 3
- .L_loop:
-     sd      a1, 0(a5)
-     sd      a1, 8(a5)
-diff --git a/sysdeps/riscv/rv64/multiarch/strcmp_as.S b/sysdeps/riscv/rv64/multiarch/strcmp_as.S
-index 40bdbfef08..e23eb9f74c 100644
---- a/sysdeps/riscv/rv64/multiarch/strcmp_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/strcmp_as.S
-@@ -57,7 +57,7 @@ ENTRY (strcmp)
-       ret
-     .endif
-   .endm
--
-+.p2align 3
- .Lloop:
-   add   a0, a0, N*8
-   add   a1, a1, N*8
-diff --git a/sysdeps/riscv/rv64/multiarch/strlen_as.S b/sysdeps/riscv/rv64/multiarch/strlen_as.S
-index 862f5ebb72..9601ab2b11 100644
---- a/sysdeps/riscv/rv64/multiarch/strlen_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/strlen_as.S
-@@ -36,7 +36,7 @@ ENTRY (strlen)
-   addi  a3, a1, 8
-   li    a4, -1
- 
--  .align 2
-+  .p2align 3
- .Lloop:
-   ld    a2, 8(a1)
-   addi  a1, a1, 8
-diff --git a/sysdeps/riscv/rv64/strchr.S b/sysdeps/riscv/rv64/strchr.S
-index 2d108800c1..dfeec6da7e 100644
---- a/sysdeps/riscv/rv64/strchr.S
-+++ b/sysdeps/riscv/rv64/strchr.S
-@@ -41,6 +41,7 @@ ENTRY (strchr)
- 
-   li    a5, -1
-   addi  a0, a0, -8
-+  .p2align 3
- .Lloop:
-   addi  a0, a0, 8
-   ld    a2, 0(a0)
-diff --git a/sysdeps/riscv/rv64/strchrnul.S b/sysdeps/riscv/rv64/strchrnul.S
-index 3e48445f11..6cf125cf46 100644
---- a/sysdeps/riscv/rv64/strchrnul.S
-+++ b/sysdeps/riscv/rv64/strchrnul.S
-@@ -41,6 +41,7 @@ ENTRY (__strchrnul)
- 
-   li    a5, -1
-   addi  a0, a0, -8
-+  .p2align 3
- .Lloop:
-   addi  a0, a0, 8
-   ld    a2, 0(a0)
-diff --git a/sysdeps/riscv/rv64/strncmp.S b/sysdeps/riscv/rv64/strncmp.S
-index 85245df98d..200bee4fe1 100644
---- a/sysdeps/riscv/rv64/strncmp.S
-+++ b/sysdeps/riscv/rv64/strncmp.S
-@@ -27,6 +27,7 @@ ENTRY (strncmp)
-   beqz  a4, .Lenter
-   j     .Lmisaligned
- 
-+  .p2align 3
- .Lloop:
-   addi  a0, a0, 8
-   addi  a1, a1, 8
-diff --git a/sysdeps/riscv/rv64/strnlen.S b/sysdeps/riscv/rv64/strnlen.S
-index 73757b69f2..502f108710 100644
---- a/sysdeps/riscv/rv64/strnlen.S
-+++ b/sysdeps/riscv/rv64/strnlen.S
-@@ -37,7 +37,7 @@ ENTRY (__strnlen)
-   beqz  a4, .Llenth
-   addi  a5, a5, 1
-   j     .Lmisaligned  
--
-+.p2align 3
- .Laligned:
-   addi  a5, a5, 8
-   addi  a1, a1, -8
--- 
-2.25.1
-

+ 1 - 1
recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch

@@ -1,4 +1,4 @@
-From c6dca721df6dd8c39ffe16e61623516bd8742d39 Mon Sep 17 00:00:00 2001
+From 7c06ca59b47ce06f785b9fce7b9e9d675d5b6e10 Mon Sep 17 00:00:00 2001
 From: Jason Wessel <jason.wessel@windriver.com>
 Date: Sat, 7 Dec 2019 09:59:22 -0800
 Subject: [PATCH] localedef: Add hardlink resolver from util-linux

+ 0 - 273
recipes-core/glibc/glibc/0001-modify-and-merge-sifive-patches-to-support-V.patch

@@ -1,273 +0,0 @@
-From d8b1bc0917a815fdb55457ad8e1eb14d0042f469 Mon Sep 17 00:00:00 2001
-From: "max.ma" <max.ma@starfivetech.com>
-Date: Mon, 5 Sep 2022 22:03:01 -0700
-Subject: [PATCH 01/19] modify &and merge sifive patches to support V
-
----
- sysdeps/riscv/Makefile                        |  5 +++
- .../unix/sysv/linux/riscv/bits/sigcontext.h   | 31 --------------
- sysdeps/unix/sysv/linux/riscv/getcontext.S    | 24 ++++++++++-
- sysdeps/unix/sysv/linux/riscv/setcontext.S    | 22 ++++++++++
- sysdeps/unix/sysv/linux/riscv/swapcontext.S   | 41 +++++++++++++++++++
- sysdeps/unix/sysv/linux/riscv/sys/ucontext.h  |  2 +
- sysdeps/unix/sysv/linux/riscv/sysdep.h        |  1 +
- sysdeps/unix/sysv/linux/riscv/ucontext_i.sym  |  5 +++
- 8 files changed, 98 insertions(+), 33 deletions(-)
- delete mode 100644 sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h
-
-diff --git a/sysdeps/riscv/Makefile b/sysdeps/riscv/Makefile
-index 8fb10b164f..e2d84640d4 100644
---- a/sysdeps/riscv/Makefile
-+++ b/sysdeps/riscv/Makefile
-@@ -2,6 +2,11 @@ ifeq ($(subdir),misc)
- sysdep_headers += sys/asm.h
- endif
- 
-+ifeq ($(subdir),csu)
-+# get offset to rtld_global._dl_hwcap and rtld_global._dl_hwcap2.
-+gen-as-const-headers += rtld-global-offsets.sym
-+endif
-+
- # RISC-V's assembler also needs to know about PIC as it changes the definition
- # of some assembler macros.
- ASFLAGS-.os += $(pic-ccflag)
-diff --git a/sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h b/sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h
-deleted file mode 100644
-index b6e15b5f62..0000000000
---- a/sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h
-+++ /dev/null
-@@ -1,31 +0,0 @@
--/* Machine-dependent signal context structure for Linux.  RISC-V version.
--   Copyright (C) 1996-2022 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/>.  */
--
--#ifndef _BITS_SIGCONTEXT_H
--#define _BITS_SIGCONTEXT_H 1
--
--#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
--# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
--#endif
--
--struct sigcontext {
--  /* gregs[0] holds the program counter.  */
--  unsigned long int gregs[32];
--  unsigned long long int fpregs[66] __attribute__ ((__aligned__ (16)));
--};
--
--#endif
-diff --git a/sysdeps/unix/sysv/linux/riscv/getcontext.S b/sysdeps/unix/sysv/linux/riscv/getcontext.S
-index 499f70b65d..371ebd52a7 100644
---- a/sysdeps/unix/sysv/linux/riscv/getcontext.S
-+++ b/sysdeps/unix/sysv/linux/riscv/getcontext.S
-@@ -16,6 +16,8 @@
-    License along with the GNU C Library.  If not, see
-    <https://www.gnu.org/licenses/>.  */
- 
-+#include <sysdep.h>
-+#include <rtld-global-offsets.h>
- #include "ucontext-macros.h"
- 
- /* int getcontext (ucontext_t *ucp) */
-@@ -39,6 +41,25 @@ LEAF (__getcontext)
- 	SAVE_INT_REG (s10, 26, a0)
- 	SAVE_INT_REG (s11, 27, a0)
- 
-+#ifdef __riscv_vector
-+# ifdef SHARED
-+	la	t1, _rtld_global_ro
-+	REG_L   t1, RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(t1)
-+# else
-+	la	t1, _dl_hwcap
-+	REG_L	t1, (t1)
-+# endif
-+	li	t2, HWCAP_ISA_V
-+	and	t2, t1, t2
-+	beqz	t2, 1f
-+	addi	t2, a0,	MCONTEXT_EXTENSION
-+	li	t1, RVV_MAGIC
-+	sw	t1, (t2)
-+	csrr	t1, vcsr
-+	REG_S	t1, VCSR_OFFSET(t2)
-+1:
-+#endif
-+
- #ifndef __riscv_float_abi_soft
- 	frsr	a1
- 
-@@ -73,5 +94,4 @@ LEAF (__getcontext)
- 99:	j	__syscall_error
- 
- PSEUDO_END (__getcontext)
--
--weak_alias (__getcontext, getcontext)
-+weak_alias (__getcontext, getcontext)
-\ No newline at end of file
-diff --git a/sysdeps/unix/sysv/linux/riscv/setcontext.S b/sysdeps/unix/sysv/linux/riscv/setcontext.S
-index e3bc84a2e6..423d94df27 100644
---- a/sysdeps/unix/sysv/linux/riscv/setcontext.S
-+++ b/sysdeps/unix/sysv/linux/riscv/setcontext.S
-@@ -16,6 +16,8 @@
-    License along with the GNU C Library.  If not, see
-    <https://www.gnu.org/licenses/>.  */
- 
-+#include <sysdep.h>
-+#include <rtld-global-offsets.h>
- #include "ucontext-macros.h"
- 
- /*  int __setcontext (const ucontext_t *ucp)
-@@ -64,6 +66,26 @@ LEAF (__setcontext)
- 	fssr	t1
- #endif /* __riscv_float_abi_soft */
- 
-+#ifdef __riscv_vector
-+#ifdef SHARED
-+	la	t1, _rtld_global_ro
-+	REG_L   t1, RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(t1)
-+#else
-+	la	t1, _dl_hwcap
-+	REG_L	t1, (t1)
-+#endif
-+	li	t2, HWCAP_ISA_V
-+	and	t2, t1, t2
-+	beqz	t2, 1f
-+	li      t1, RVV_MAGIC
-+	addi	t2, t0,	MCONTEXT_EXTENSION
-+	lw	a1, (t2)
-+	bne	a1, t1, 1f
-+	REG_L   t1, VCSR_OFFSET(t2)
-+	csrw	vcsr, t1
-+1:
-+#endif
-+
- 	/* Note the contents of argument registers will be random
- 	   unless makecontext() has been called.  */
- 	RESTORE_INT_REG     (t1,   0, t0)
-diff --git a/sysdeps/unix/sysv/linux/riscv/swapcontext.S b/sysdeps/unix/sysv/linux/riscv/swapcontext.S
-index 4da615f6d4..16600f78df 100644
---- a/sysdeps/unix/sysv/linux/riscv/swapcontext.S
-+++ b/sysdeps/unix/sysv/linux/riscv/swapcontext.S
-@@ -16,6 +16,8 @@
-    License along with the GNU C Library.  If not, see
-    <https://www.gnu.org/licenses/>.  */
- 
-+#include <sysdep.h>
-+#include <rtld-global-offsets.h>
- #include "ucontext-macros.h"
- 
- /* int swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */
-@@ -40,6 +42,25 @@ LEAF (__swapcontext)
- 	SAVE_INT_REG (s10, 26, a0)
- 	SAVE_INT_REG (s11, 27, a0)
- 
-+#ifdef __riscv_vector
-+#ifdef SHARED
-+	la      t1, _rtld_global_ro
-+	REG_L   t1, RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(t1)
-+#else
-+	la	t1, _dl_hwcap
-+	REG_L   t1, (t1)
-+#endif
-+	li	t2, HWCAP_ISA_V
-+	and	t2, t1, t2
-+	beqz	t2, 1f
-+	addi	t2, a0,	MCONTEXT_EXTENSION
-+	li	t1, RVV_MAGIC
-+	sw	t1, (t2)
-+	csrr	t1, vcsr
-+	REG_S	t1, VCSR_OFFSET(t2)
-+1:
-+#endif
-+
- #ifndef __riscv_float_abi_soft
- 	frsr a1
- 
-@@ -89,6 +110,26 @@ LEAF (__swapcontext)
- 	fssr	t1
- #endif /* __riscv_float_abi_soft */
- 
-+#ifdef __riscv_vector
-+#ifdef SHARED
-+	la      t1, _rtld_global_ro
-+	REG_L   t1, RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(t1)
-+#else
-+	la	t1, _dl_hwcap
-+	REG_L   t1, (t1)
-+#endif
-+	li	t2, HWCAP_ISA_V
-+	and	t2, t1, t2
-+	beqz	t2, 1f
-+	li      t1, RVV_MAGIC
-+	addi	t2, t0,	MCONTEXT_EXTENSION
-+	lw	a1, (t2)
-+	bne	a1, t1, 1f
-+	REG_L   t1, VCSR_OFFSET(t2)
-+	csrw	vcsr, t1
-+1:
-+#endif
-+
- 	/* Note the contents of argument registers will be random
- 	   unless makecontext() has been called.  */
- 	RESTORE_INT_REG (t1,   0, t0)
-diff --git a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h b/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h
-index e226ee85ee..1b370f0f45 100644
---- a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h
-+++ b/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h
-@@ -82,6 +82,8 @@ typedef struct mcontext_t
-   {
-     __riscv_mc_gp_state __gregs;
-     union  __riscv_mc_fp_state __fpregs;
-+    /* 5K + 256 reserved for vector state and future expansion.  */
-+    unsigned char __reserved[5376] __attribute__ ((__aligned__ (16)));
-   } mcontext_t;
- 
- /* Userlevel context.  */
-diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h
-index 37ff07a0d7..c9f8fd8236 100644
---- a/sysdeps/unix/sysv/linux/riscv/sysdep.h
-+++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h
-@@ -50,6 +50,7 @@
- 
- #ifdef __ASSEMBLER__
- 
-+# include <bits/hwcap.h>
- # include <sys/asm.h>
- 
- # define ENTRY(name) LEAF(name)
-diff --git a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
-index be55b26310..b91945a080 100644
---- a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
-+++ b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
-@@ -2,6 +2,7 @@
- #include <signal.h>
- #include <stddef.h>
- #include <sys/ucontext.h>
-+#include <asm/sigcontext.h>
- 
- -- Constants used by the rt_sigprocmask call.
- 
-@@ -27,5 +28,9 @@ STACK_FLAGS			stack (ss_flags)
- 
- MCONTEXT_GREGS			mcontext (__gregs)
- MCONTEXT_FPREGS			mcontext (__fpregs)
-+MCONTEXT_EXTENSION 		mcontext (__reserved)
- 
- UCONTEXT_SIZE			sizeof (ucontext_t)
-+VCSR_OFFSET			offsetof (struct __riscv_v_state, vcsr)
-+
-+RVV_MAGIC
--- 
-2.25.1
-

+ 0 - 297
recipes-core/glibc/glibc/0002-RISCV-revert-strchrnul-strncmp-strnlen.patch

@@ -1,297 +0,0 @@
-From 0dfcc83599765108e12ab6630a16bd27adae2b6a Mon Sep 17 00:00:00 2001
-From: "max.ma" <max.ma@starfivetech.com>
-Date: Thu, 16 Mar 2023 00:22:15 -0700
-Subject: [PATCH 2/2] [RISCV] revert strchrnul/strncmp/strnlen
-
----
- .../riscv/rv64/multiarch/ifunc-impl-list.c    | 11 ---
- sysdeps/riscv/rv64/multiarch/rtld-strchrnul.S |  1 -
- sysdeps/riscv/rv64/multiarch/rtld-strncmp.S   |  1 -
- sysdeps/riscv/rv64/strchrnul.S                | 80 -------------------
- sysdeps/riscv/rv64/strncmp.S                  | 74 -----------------
- sysdeps/riscv/rv64/strnlen.S                  | 65 ---------------
- 6 files changed, 232 deletions(-)
- delete mode 100644 sysdeps/riscv/rv64/multiarch/rtld-strchrnul.S
- delete mode 100644 sysdeps/riscv/rv64/multiarch/rtld-strncmp.S
- delete mode 100644 sysdeps/riscv/rv64/strchrnul.S
- delete mode 100644 sysdeps/riscv/rv64/strncmp.S
- delete mode 100644 sysdeps/riscv/rv64/strnlen.S
-
-diff --git a/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c b/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c
-index 7bba6fa30c..07d584deec 100644
---- a/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c
-+++ b/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c
-@@ -61,17 +61,6 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
- 	      IFUNC_IMPL_ADD (array, i, memset, use_rvv, __memset_vector)
- 	      IFUNC_IMPL_ADD (array, i, memset, 1, __memset_riscv));
- 
--  IFUNC_IMPL (i, name, strchr,
--	      IFUNC_IMPL_ADD (array, i, strchr, use_rvv, __strchr_riscv)
--	      IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_riscv));
--
--  IFUNC_IMPL (i, name, strchrnul,
--	      IFUNC_IMPL_ADD (array, i, strchrnul, use_rvv, __strchrnul_riscv)
--	      IFUNC_IMPL_ADD (array, i, strchrnul, 1, __strchrnul_riscv));
--
--  IFUNC_IMPL (i, name, strncmp,
--	      IFUNC_IMPL_ADD (array, i, strncmp, use_rvv, __strncmp_riscv)
--	      IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_riscv));
- #endif
-   return i;
- }
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-strchrnul.S b/sysdeps/riscv/rv64/multiarch/rtld-strchrnul.S
-deleted file mode 100644
-index 5799994393..0000000000
---- a/sysdeps/riscv/rv64/multiarch/rtld-strchrnul.S
-+++ /dev/null
-@@ -1 +0,0 @@
--#include "../strchrnul.S"
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-strncmp.S b/sysdeps/riscv/rv64/multiarch/rtld-strncmp.S
-deleted file mode 100644
-index c5a02a137c..0000000000
---- a/sysdeps/riscv/rv64/multiarch/rtld-strncmp.S
-+++ /dev/null
-@@ -1 +0,0 @@
--#include "../strncmp.S"
-diff --git a/sysdeps/riscv/rv64/strchrnul.S b/sysdeps/riscv/rv64/strchrnul.S
-deleted file mode 100644
-index 6cf125cf46..0000000000
---- a/sysdeps/riscv/rv64/strchrnul.S
-+++ /dev/null
-@@ -1,80 +0,0 @@
--/* The assembly function for strchrnul.  RISC-V version.
--   Copyright (C) 2018 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
--   <http://www.gnu.org/licenses/>.  */
--
--#include <sysdep.h>
--
--	.p2align 6
--ENTRY (__strchrnul)
--  andi  a1, a1, 0xff
--
--.Lmisaligned:
--  andi  a5, a0, 7
--  beqz  a5, .Laligned
--  lbu   a5, 0(a0)
--  beq   a5, a1, .Ldone
--  beqz  a5, .Ldone
--  addi  a0, a0, 1
--  j .Lmisaligned
--
--.Laligned:
--  slli  a5, a1, 0x8
--  or    a5, a5, a1
--  slli  t0, a5, 0x10
--  or    t0, t0, a5
--  slli  a5, t0, 0x20
--  or    t0, t0, a5
--
--  li    a5, -1
--  addi  a0, a0, -8
--  .p2align 3
--.Lloop:
--  addi  a0, a0, 8
--  ld    a2, 0(a0)
--  orc.b t1, a2
--  bne   t1, a5, .Lnull
--  xor   a3, a2, t0
--  orc.b a3, a3
--  bne   a3, a5, .Lfind
--  orc.b a2, a2
--  beq   a2, a5, .Lloop
--
--.Ldone:
--  ret
--
--.Lfind:
--  not   a3, a3
--  ctz   a3, a3
--  srli  a3, a3, 3
--  add   a0, a0, a3
--  ret
--
--# cases in which a null byte was detected
--.Lnull:
--  bne   a2, t0, .Lend
--  j .Lfind
--
--.Lend:
--  lbu   a5, 0(a0)
--  beq   a5, a1, .Ldone
--  beqz  a5, .Ldone
--  addi  a0, a0, 1
--  j .Lend
--
--END (__strchrnul)
--weak_alias (__strchrnul,strchrnul)
--libc_hidden_builtin_def (__strchrnul)
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/strncmp.S b/sysdeps/riscv/rv64/strncmp.S
-deleted file mode 100644
-index 200bee4fe1..0000000000
---- a/sysdeps/riscv/rv64/strncmp.S
-+++ /dev/null
-@@ -1,74 +0,0 @@
--/* The assembly function for strncmp.  RISC-V version.
--   Copyright (C) 2018 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
--   <http://www.gnu.org/licenses/>.  */
--
--#include <sysdep.h>
--
--	.p2align 6
--ENTRY (strncmp)
--  beqz  a2, .Lequal
--  or    a4, a0, a1
--  li    t2, -1
--  and   a4, a4, 7
--  beqz  a4, .Lenter
--  j     .Lmisaligned
--
--  .p2align 3
--.Lloop:
--  addi  a0, a0, 8
--  addi  a1, a1, 8
--  addi  a2, a2, -8
--
--.Lenter:
--  addi  a5, a2, -8
--  blez  a5, .Lmisaligned
--  ld    a3, 0(a0)
--  ld    a4, 0(a1)
--  orc.b t0, a3
--  bne   t0, t2, .Lnull
--  beq   a3, a4, .Lloop
--  rev8  a6, a3
--  rev8  a7, a4
--  bgeu  a6, a7, 1f
--  li    a0, -1
--  ret
--1:
--  li    a0, 1
--  ret
--
--.Lmisaligned:
--  blez  a2, .Ldone
--  lbu   a3, 0(a0)
--  lbu   a4, 0(a1)
--  addi  a0, a0, 1
--  addi  a1, a1, 1
--  addi  a2, a2, -1
--  bne   a3, a4, .Ldone
--  bnez  a3, .Lmisaligned
--.Ldone:
--  sub   a0, a3, a4
--  ret
--
--# cases in which a null byte was detected
--.Lnull:
--  bne   a3, a4, .Lmisaligned
--.Lequal:
--  li    a0, 0
--  ret
--
--END (strncmp)
--libc_hidden_builtin_def (strncmp)
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/strnlen.S b/sysdeps/riscv/rv64/strnlen.S
-deleted file mode 100644
-index 502f108710..0000000000
---- a/sysdeps/riscv/rv64/strnlen.S
-+++ /dev/null
-@@ -1,65 +0,0 @@
--/* The assembly function for strnlen.  RISC-V version.
--   Copyright (C) 2018 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
--   <http://www.gnu.org/licenses/>.  */
--
--#include <sysdep.h>
--
--	.p2align 6
--ENTRY (__strnlen)
--  mv    a2, a0
--  mv    a0, a1
--  li    a3, -1
--  beqz  a1, .Ldone
--  add   a0, a2, a1
--  bleu  a2, a0, 1f
--  li    a0, -1
--1:
--  mv    a5, a2
--
--.Lmisaligned:
--  andi  a4, a5, 7
--  beqz  a4, .Lloop
--  lbu   a4, 0(a5)
--  beqz  a4, .Llenth
--  addi  a5, a5, 1
--  j     .Lmisaligned  
--.p2align 3
--.Laligned:
--  addi  a5, a5, 8
--  addi  a1, a1, -8
--.Lloop:
--  bleu  a1, x0, .Llenth
--  ld    a4, 0(a5)
--  orc.b a4, a4
--  beq   a4, a3, .Laligned
--  not   a4, a4
--  ctz   a4, a4
--  srli  a4, a4, 3
--  add   a5, a5, a4
--.Llenth:
--  minu  a5, a5, a0
--  sub   a0, a5, a2
--.Ldone:
--  ret
--
--END (__strnlen)
--
--#ifndef STRNLEN
--libc_hidden_def (__strnlen)
--weak_alias (__strnlen, strnlen)
--#endif
--libc_hidden_def (strnlen)
--- 
-2.25.1
-

+ 0 - 1529
recipes-core/glibc/glibc/0002-add-vector-support-for-memset-memcmp-memmove-memcpy-.patch

@@ -1,1529 +0,0 @@
-From 0d709adf42cb79137b8d125eff8c4a386cf69187 Mon Sep 17 00:00:00 2001
-From: "max.ma" <max.ma@starfivetech.com>
-Date: Tue, 21 Dec 2021 17:42:04 -0800
-Subject: [PATCH 02/19] add vector support for
- memset/memcmp/memmove/memcpy/memchr/strlen/strcmp
-
----
- sysdeps/riscv/riscv-ifunc.h                   |  34 ++++++
- sysdeps/riscv/rv64/multiarch/Makefile         |   5 +
- sysdeps/riscv/rv64/multiarch/aeabi_memcpy.c   |   2 +
- sysdeps/riscv/rv64/multiarch/ifunc-common.h   |  30 +++++
- .../riscv/rv64/multiarch/ifunc-impl-list.c    |  65 ++++++++++
- sysdeps/riscv/rv64/multiarch/memchr.c         |  32 +++++
- sysdeps/riscv/rv64/multiarch/memchr_as.S      |  88 ++++++++++++++
- sysdeps/riscv/rv64/multiarch/memchr_riscv.S   |  25 ++++
- sysdeps/riscv/rv64/multiarch/memchr_vector.S  |  53 ++++++++
- sysdeps/riscv/rv64/multiarch/memcmp.c         |  32 +++++
- sysdeps/riscv/rv64/multiarch/memcmp_riscv.c   |  29 +++++
- sysdeps/riscv/rv64/multiarch/memcmp_vector.S  |  56 +++++++++
- sysdeps/riscv/rv64/multiarch/memcpy.c         |  33 +++++
- sysdeps/riscv/rv64/multiarch/memcpy_as.S      | 114 ++++++++++++++++++
- sysdeps/riscv/rv64/multiarch/memcpy_riscv.S   |  25 ++++
- sysdeps/riscv/rv64/multiarch/memcpy_vector.S  |  54 +++++++++
- sysdeps/riscv/rv64/multiarch/memmove.c        |  32 +++++
- sysdeps/riscv/rv64/multiarch/memmove_riscv.c  |  29 +++++
- sysdeps/riscv/rv64/multiarch/memmove_vector.S |  56 +++++++++
- sysdeps/riscv/rv64/multiarch/memset.c         |  33 +++++
- sysdeps/riscv/rv64/multiarch/memset_riscv.c   |  29 +++++
- sysdeps/riscv/rv64/multiarch/memset_vector.S  |  45 +++++++
- sysdeps/riscv/rv64/multiarch/rtld-memchr.S    |   1 +
- sysdeps/riscv/rv64/multiarch/rtld-memcmp.c    |   1 +
- sysdeps/riscv/rv64/multiarch/rtld-memcpy.S    |   1 +
- sysdeps/riscv/rv64/multiarch/rtld-memmove.c   |  19 +++
- sysdeps/riscv/rv64/multiarch/rtld-memset.c    |   1 +
- sysdeps/riscv/rv64/multiarch/rtld-strcmp.S    |   1 +
- sysdeps/riscv/rv64/multiarch/rtld-strlen.c    |   1 +
- sysdeps/riscv/rv64/multiarch/strcmp.c         |  33 +++++
- sysdeps/riscv/rv64/multiarch/strcmp_.S        |  39 ++++++
- sysdeps/riscv/rv64/multiarch/strcmp_riscv.S   |   9 ++
- sysdeps/riscv/rv64/multiarch/strcmp_vector.S  |  54 +++++++++
- sysdeps/riscv/rv64/multiarch/strlen.c         |  32 +++++
- sysdeps/riscv/rv64/multiarch/strlen_riscv.c   |  29 +++++
- sysdeps/riscv/rv64/multiarch/strlen_vector.S  |  46 +++++++
- sysdeps/riscv/sysdep.h                        |  24 ++++
- sysdeps/unix/sysv/linux/riscv/sysdep.h        |   2 +-
- 38 files changed, 1193 insertions(+), 1 deletion(-)
- create mode 100644 sysdeps/riscv/riscv-ifunc.h
- create mode 100644 sysdeps/riscv/rv64/multiarch/Makefile
- create mode 100644 sysdeps/riscv/rv64/multiarch/aeabi_memcpy.c
- create mode 100644 sysdeps/riscv/rv64/multiarch/ifunc-common.h
- create mode 100644 sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c
- create mode 100644 sysdeps/riscv/rv64/multiarch/memchr.c
- create mode 100644 sysdeps/riscv/rv64/multiarch/memchr_as.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/memchr_riscv.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/memchr_vector.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/memcmp.c
- create mode 100644 sysdeps/riscv/rv64/multiarch/memcmp_riscv.c
- create mode 100644 sysdeps/riscv/rv64/multiarch/memcmp_vector.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/memcpy.c
- create mode 100644 sysdeps/riscv/rv64/multiarch/memcpy_as.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/memcpy_riscv.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/memcpy_vector.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/memmove.c
- create mode 100644 sysdeps/riscv/rv64/multiarch/memmove_riscv.c
- create mode 100644 sysdeps/riscv/rv64/multiarch/memmove_vector.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/memset.c
- create mode 100644 sysdeps/riscv/rv64/multiarch/memset_riscv.c
- create mode 100644 sysdeps/riscv/rv64/multiarch/memset_vector.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/rtld-memchr.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/rtld-memcmp.c
- create mode 100644 sysdeps/riscv/rv64/multiarch/rtld-memcpy.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/rtld-memmove.c
- create mode 100644 sysdeps/riscv/rv64/multiarch/rtld-memset.c
- create mode 100644 sysdeps/riscv/rv64/multiarch/rtld-strcmp.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/rtld-strlen.c
- create mode 100644 sysdeps/riscv/rv64/multiarch/strcmp.c
- create mode 100644 sysdeps/riscv/rv64/multiarch/strcmp_.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/strcmp_riscv.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/strcmp_vector.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/strlen.c
- create mode 100644 sysdeps/riscv/rv64/multiarch/strlen_riscv.c
- create mode 100644 sysdeps/riscv/rv64/multiarch/strlen_vector.S
- create mode 100644 sysdeps/riscv/sysdep.h
-
-diff --git a/sysdeps/riscv/riscv-ifunc.h b/sysdeps/riscv/riscv-ifunc.h
-new file mode 100644
-index 0000000000..6b4ea24758
---- /dev/null
-+++ b/sysdeps/riscv/riscv-ifunc.h
-@@ -0,0 +1,34 @@
-+/* Common definition for ifunc resolvers.  Linux/RISCV version.
-+   This file is part of the GNU C Library.
-+   Copyright (C) 2017-2021 Free Software Foundation, Inc.
-+
-+   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/>.  */
-+
-+#include <sysdep.h>
-+#include <ifunc-init.h>
-+
-+#define INIT_ARCH()
-+
-+#define riscv_libc_ifunc_redirected(redirected_name, name, expr)	\
-+  __ifunc (redirected_name, name, expr(hwcap), int hwcap, INIT_ARCH)
-+
-+#if defined SHARED
-+# define riscv_libc_ifunc_hidden_def(redirect_name, name) \
-+  __hidden_ver1 (name, __GI_##name, redirect_name) \
-+    __attribute__ ((visibility ("hidden"))) \
-+    __attribute_copy__ (name)
-+#else
-+# define riscv_libc_ifunc_hidden_def(redirect_name, name)
-+#endif
-diff --git a/sysdeps/riscv/rv64/multiarch/Makefile b/sysdeps/riscv/rv64/multiarch/Makefile
-new file mode 100644
-index 0000000000..3349bf4888
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/Makefile
-@@ -0,0 +1,5 @@
-+ifeq ($(subdir),string)
-+sysdep_routines += memcpy_vector memcpy_riscv memchr_riscv memchr_vector memcmp_riscv \
-+                 memcmp_vector strcmp_riscv strcmp_vector strlen_riscv strlen_vector \
-+                 memmove_vector memmove_riscv memset_vector memset_riscv
-+endif
-diff --git a/sysdeps/riscv/rv64/multiarch/aeabi_memcpy.c b/sysdeps/riscv/rv64/multiarch/aeabi_memcpy.c
-new file mode 100644
-index 0000000000..2054d18261
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/aeabi_memcpy.c
-@@ -0,0 +1,2 @@
-+/* Empty file to override sysdeps/riscv version. See memcpy.S for definitions
-+   of these functions.  */
-diff --git a/sysdeps/riscv/rv64/multiarch/ifunc-common.h b/sysdeps/riscv/rv64/multiarch/ifunc-common.h
-new file mode 100644
-index 0000000000..8c4c95371f
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/ifunc-common.h
-@@ -0,0 +1,30 @@
-+/* Common definition for memcmp resolver.
-+   Copyright (C) 2017-2021 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/>.  */
-+
-+#include <sys/auxv.h>
-+
-+__typeof (REDIRECT_NAME) OPTIMIZE (riscv) attribute_hidden;
-+__typeof (REDIRECT_NAME) OPTIMIZE (vector) attribute_hidden;
-+
-+static inline void *
-+IFUNC_SELECTOR (int hwcap)
-+{
-+  if (hwcap & HWCAP_ISA_V)
-+    return OPTIMIZE (vector);
-+  return OPTIMIZE (riscv);
-+}
-diff --git a/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c b/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c
-new file mode 100644
-index 0000000000..28c6e123f0
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c
-@@ -0,0 +1,65 @@
-+/* Enumerate available IFUNC implementations of a function.  RISCV version.
-+   Copyright (C) 2013-2021 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/>.  */
-+
-+#include <stdbool.h>
-+#include <string.h>
-+#include <ldsodefs.h>
-+#include <sysdep.h>
-+#include <ifunc-impl-list.h>
-+
-+/* Fill ARRAY of MAX elements with IFUNC implementations for function
-+   NAME and return the number of valid entries.  */
-+
-+size_t
-+__libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
-+			size_t max)
-+{
-+  size_t i = 0;
-+
-+  bool use_rvv = (GLRO(dl_hwcap) & HWCAP_ISA_V) != 0;
-+
-+  IFUNC_IMPL (i, name, memcpy,
-+	      IFUNC_IMPL_ADD (array, i, memcpy, use_rvv, __memcpy_vector)
-+	      IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_riscv));
-+
-+  IFUNC_IMPL (i, name, memchr,
-+	      IFUNC_IMPL_ADD (array, i, memchr, use_rvv, __memchr_vector)
-+	      IFUNC_IMPL_ADD (array, i, memchr, 1, __memchr_riscv));
-+
-+  IFUNC_IMPL (i, name, memcmp,
-+	      IFUNC_IMPL_ADD (array, i, memcmp, use_rvv, __memcmp_vector)
-+	      IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_riscv));
-+
-+  IFUNC_IMPL (i, name, strcmp,
-+	      IFUNC_IMPL_ADD (array, i, strcmp, use_rvv, __strcmp_vector)
-+	      IFUNC_IMPL_ADD (array, i, strcmp, 1, __strcmp_riscv));
-+
-+  IFUNC_IMPL (i, name, strlen,
-+	      IFUNC_IMPL_ADD (array, i, strlen, use_rvv, __strlen_vector)
-+	      IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_riscv));
-+
-+  IFUNC_IMPL (i, name, memmove,
-+	      IFUNC_IMPL_ADD (array, i, memmove, use_rvv, __memmove_vector)
-+	      IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_riscv));
-+
-+  IFUNC_IMPL (i, name, memset,
-+	      IFUNC_IMPL_ADD (array, i, memset, use_rvv, __memset_vector)
-+	      IFUNC_IMPL_ADD (array, i, memset, 1, __memset_riscv));
-+
-+  return i;
-+}
-diff --git a/sysdeps/riscv/rv64/multiarch/memchr.c b/sysdeps/riscv/rv64/multiarch/memchr.c
-new file mode 100644
-index 0000000000..1544bc3d01
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memchr.c
-@@ -0,0 +1,32 @@
-+/* Multiple versions of memchr.
-+   All versions must be listed in ifunc-impl-list.c.
-+   Copyright (C) 2017-2021 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/>.  */
-+
-+#if IS_IN (libc)
-+# define memchr __redirect_memchr
-+# include <string.h>
-+# undef memchr
-+
-+# include <riscv-ifunc.h>
-+
-+# define SYMBOL_NAME memchr
-+# include "ifunc-common.h"
-+
-+riscv_libc_ifunc_redirected (__redirect_memchr, memchr, IFUNC_SELECTOR);
-+riscv_libc_ifunc_hidden_def (__redirect_memchr, memchr);
-+#endif
-diff --git a/sysdeps/riscv/rv64/multiarch/memchr_as.S b/sysdeps/riscv/rv64/multiarch/memchr_as.S
-new file mode 100644
-index 0000000000..557098afda
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memchr_as.S
-@@ -0,0 +1,88 @@
-+
-+/* The assembly function for memchr.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+ENTRY (memchr)
-+   zext.b	a3,a1
-+   beqz	a2, .L_not_found
-+   andi	a5,a0,7
-+.L_not_aligned:      
-+   beqz	a5,.L_aligned_8byte
-+   lbu	a5,0(a0)
-+   addi	a2,a2,-1
-+   beq	a5,a3,.L_found
-+   addi	a0,a0,1
-+   andi	a5,a0,7
-+   bnez	a2,.L_not_aligned
-+
-+.L_not_found:
-+   li	a0,0
-+.L_found:   
-+   ret
-+
-+.L_aligned_8byte:
-+   zext.b	a1,a1
-+   slli	a5,a1,0x8
-+   or	a1,a1,a5
-+   slli	a5,a1,0x10
-+   or	a5,a5,a1
-+   slli	a1,a5,0x20
-+   li	a4,7
-+   or	a1,a1,a5
-+   bgeu	a4,a2,.L_less_8bytes
-+
-+   ld    a7, mask1   
-+   ld    a6, mask2
-+   
-+   li	t1,7
-+   j	.L_8byte_compare_loop
-+.L_8byte_compare:
-+   addi	a2,a2,-8
-+   addi	a0,a0,8
-+   bgeu	t1,a2,.L_8byte_compare_exit
-+.L_8byte_compare_loop:   
-+   ld	a5,0(a0)
-+   xor	a5,a5,a1
-+   add	a4,a5,a7
-+   not	a5,a5
-+   and	a5,a5,a4
-+   and	a5,a5,a6
-+   beqz	a5,.L_8byte_compare
-+
-+.L_less_8bytes:
-+   add	a2,a2,a0
-+   j	.L_less_8bytes_compare
-+.L_less_8bytes_loop:   
-+   addi	a0,a0,1
-+   beq	a2,a0,.L_not_found
-+.L_less_8bytes_compare:   
-+   lbu	a5,0(a0)
-+   bne	a5,a3,.L_less_8bytes_loop
-+   ret
-+.L_8byte_compare_exit:
-+   bnez	a2,.L_less_8bytes
-+   j	.L_not_found
-+  .align 3
-+mask1:
-+  .dword 0xfefefefefefefeff
-+mask2:
-+  .dword 0x8080808080808080
-+END (memchr)
-+libc_hidden_builtin_def (memchr)
-diff --git a/sysdeps/riscv/rv64/multiarch/memchr_riscv.S b/sysdeps/riscv/rv64/multiarch/memchr_riscv.S
-new file mode 100644
-index 0000000000..ce7b64bbe0
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memchr_riscv.S
-@@ -0,0 +1,25 @@
-+/* The assembly function for memchr.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+#define memchr __memchr_riscv
-+#undef libc_hidden_builtin_def
-+#define libc_hidden_builtin_def(name)
-+
-+#include "memchr_as.S"
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/memchr_vector.S b/sysdeps/riscv/rv64/multiarch/memchr_vector.S
-new file mode 100644
-index 0000000000..77693d716d
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memchr_vector.S
-@@ -0,0 +1,53 @@
-+/* The assembly function for memchr.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+/* For __riscv_vector this file defines memchr.  */
-+/* #ifndef __riscv_vector */
-+# define memchr __memchr_vector
-+# undef libc_hidden_builtin_def
-+# define libc_hidden_builtin_def(a)
-+/* #endif */
-+
-+	.p2align 6
-+ENTRY (memchr)
-+
-+   zext.b	a1,a1
-+
-+.L_memchr_loop:
-+   vsetvli	a3,a2,e8,m8,tu,mu
-+   vle8ff.v	v0,(a0)
-+   vmseq.vx	v8,v0,a1
-+   csrr	a3,vl
-+   vfirst.m	a4,v8
-+   sub	a2,a2,a3
-+   bgez	a4,.L_found
-+   add	a0,a0,a3
-+   bltu	zero,a2,.L_memchr_loop
-+
-+.L_found:
-+   bltz	a4,.L_not_found
-+   
-+   add	a0,a0,a4
-+   ret
-+.L_not_found:   
-+   add	a0,zero,zero
-+   ret
-+END (memchr)
-+libc_hidden_builtin_def (memchr)
-diff --git a/sysdeps/riscv/rv64/multiarch/memcmp.c b/sysdeps/riscv/rv64/multiarch/memcmp.c
-new file mode 100644
-index 0000000000..29730c6ed1
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memcmp.c
-@@ -0,0 +1,32 @@
-+/* Multiple versions of memcmp.
-+   All versions must be listed in ifunc-impl-list.c.
-+   Copyright (C) 2017-2021 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/>.  */
-+
-+#if IS_IN (libc)
-+# define memcmp __redirect_memcmp
-+# include <string.h>
-+# undef memcmp
-+
-+# include <riscv-ifunc.h>
-+
-+# define SYMBOL_NAME memcmp
-+# include "ifunc-common.h"
-+
-+riscv_libc_ifunc_redirected (__redirect_memcmp, memcmp, IFUNC_SELECTOR);
-+riscv_libc_ifunc_hidden_def (__redirect_memcmp, memcmp);
-+#endif
-diff --git a/sysdeps/riscv/rv64/multiarch/memcmp_riscv.c b/sysdeps/riscv/rv64/multiarch/memcmp_riscv.c
-new file mode 100644
-index 0000000000..dda15d7d35
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memcmp_riscv.c
-@@ -0,0 +1,29 @@
-+/* RISCV C version memcmp.
-+   Copyright (C) 2018-2021 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/>.  */
-+
-+#if IS_IN (libc)
-+#undef libc_hidden_builtin_def
-+#define libc_hidden_builtin_def(name)
-+
-+#undef weak_alias
-+#  define MEMCMP __memcmp_riscv
-+# include <string/memcmp.c>
-+#else
-+
-+# include <string/memcmp.c>
-+#endif
-diff --git a/sysdeps/riscv/rv64/multiarch/memcmp_vector.S b/sysdeps/riscv/rv64/multiarch/memcmp_vector.S
-new file mode 100644
-index 0000000000..f6cbc1307b
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memcmp_vector.S
-@@ -0,0 +1,56 @@
-+/* The assembly function for memcmp.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+/* For __riscv_vector this file defines strcmp.  */
-+/* #ifndef __riscv_vector */
-+# define memcmp __memcmp_vector
-+# undef libc_hidden_builtin_def
-+# define libc_hidden_builtin_def(a)
-+/* #endif */
-+
-+	.p2align 6
-+ENTRY (memcmp)
-+
-+.L_compare_loop:
-+   vsetvli	a3,a2,e8,m8,tu,mu
-+   vle8.v	v0,(a0)
-+   vle8.v	v8,(a1)
-+   vmsne.vv	v16,v0,v8
-+   sub	a2,a2,a3
-+   vfirst.m	a4,v16
-+   bgez	a4,.L_compare_not_equal
-+   add	a0,a0,a3
-+   add	a1,a1,a3
-+   bltu	zero,a2,.L_compare_loop
-+   bltz	a4,.L_compare_equal
-+   
-+.L_compare_not_equal:   
-+   add	a0,a0,a4
-+   add	a1,a1,a4
-+   lbu	a5,0(a0)
-+   lbu	a6,0(a1)
-+   sub	a0,a5,a6
-+   ret
-+.L_compare_equal:
-+   add	a0,zero,zero
-+   ret
-+END (memcmp)
-+libc_hidden_builtin_def (memcmp)
-+
-diff --git a/sysdeps/riscv/rv64/multiarch/memcpy.c b/sysdeps/riscv/rv64/multiarch/memcpy.c
-new file mode 100644
-index 0000000000..0f20b7fd44
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memcpy.c
-@@ -0,0 +1,33 @@
-+/* Multiple versions of memcpy.
-+   All versions must be listed in ifunc-impl-list.c.
-+   Copyright (C) 2017-2021 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/>.  */
-+
-+#if IS_IN (libc)
-+# define memcpy __redirect_memcpy
-+# include <string.h>
-+# undef memcpy
-+
-+# include <riscv-ifunc.h>
-+
-+# define SYMBOL_NAME memcpy
-+# include "ifunc-common.h"
-+
-+riscv_libc_ifunc_redirected (__redirect_memcpy, memcpy, IFUNC_SELECTOR);
-+
-+riscv_libc_ifunc_hidden_def (__redirect_memcpy, memcpy);
-+#endif
-diff --git a/sysdeps/riscv/rv64/multiarch/memcpy_as.S b/sysdeps/riscv/rv64/multiarch/memcpy_as.S
-new file mode 100644
-index 0000000000..f0a074df13
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memcpy_as.S
-@@ -0,0 +1,114 @@
-+/* The assembly function for memcpy.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+
-+#  define LABLE_ALIGN   \
-+        .balignl 16, 0x00000013
-+
-+ENTRY (memcpy)
-+
-+        /* Test if len less than 8 bytes.  */
-+        mv      t6, a0
-+        sltiu   a3, a2, 8
-+        li     t3, 1
-+        bnez    a3, .L_copy_by_byte
-+
-+        andi    a3, a0, 7
-+        li     t5, 8
-+	/* Test if dest is not 8 bytes aligned.  */
-+        bnez    a3, .L_dest_not_aligned
-+.L_dest_aligned:
-+        /* If dest is aligned, then copy.  */
-+        srli    t4, a2, 6
-+        /* Test if len less than 32 bytes.  */
-+        beqz     t4, .L_len_less_16bytes
-+	andi    a2, a2, 63
-+
-+.L_len_larger_16bytes:
-+        ld      a4, 0(a1)
-+        sd      a4, 0(a0)
-+        ld      a5, 8(a1)
-+        sd      a5, 8(a0)
-+        ld      a6, 16(a1)
-+        sd      a6, 16(a0)
-+        ld      a7, 24(a1)
-+        sd      a7, 24(a0)
-+        ld      a4, 32(a1)
-+        sd      a4, 32(a0)
-+        ld      a5, 40(a1)
-+        sd      a5, 40(a0)
-+        ld      a6, 48(a1)
-+        sd      a6, 48(a0)
-+        ld      a7, 56(a1)
-+        sub     t4, t4, t3
-+        addi    a1, a1, 64
-+        sd      a7, 56(a0)
-+        addi    a0, a0, 64
-+	bnez	t4, .L_len_larger_16bytes
-+
-+.L_len_less_16bytes:
-+	srli    t4, a2, 2
-+        beqz     t4, .L_copy_by_byte
-+        andi    a2, a2, 3
-+.L_len_less_16bytes_loop:
-+        lw      a4, 0(a1)
-+	sub	t4, t4, t3
-+        addi    a1, a1, 4
-+        sw      a4, 0(a0)
-+        addi    a0, a0, 4
-+	bnez    t4, .L_len_less_16bytes_loop
-+
-+        /* Copy tail.  */
-+.L_copy_by_byte:
-+        andi    t4, a2, 7
-+        beqz     t4, .L_return
-+.L_copy_by_byte_loop:
-+        lb     a4, 0(a1)
-+	sub	t4, t4, t3
-+        addi    a1, a1, 1
-+        sb     a4, 0(a0)
-+        addi    a0, a0, 1
-+	bnez	t4, .L_copy_by_byte_loop
-+
-+.L_return:
-+        mv      a0, t6
-+        ret
-+
-+        /* If dest is not aligned, just copying some bytes makes the dest
-+           align.  */
-+.L_dest_not_aligned:
-+        sub     a3, t5, a3
-+        mv      t5, a3
-+.L_dest_not_aligned_loop:
-+        /* Makes the dest align.  */
-+        lb     a4, 0(a1)
-+	sub	a3, a3, t3
-+        addi    a1, a1, 1
-+        sb     a4, 0(a0)
-+        addi    a0, a0, 1
-+	bnez	a3, .L_dest_not_aligned_loop
-+        sub     a2, a2, t5
-+	sltiu	a3, a2, 4
-+        bnez    a3, .L_copy_by_byte
-+        /* Check whether the src is aligned.  */
-+        j		.L_dest_aligned
-+END (memcpy)
-+
-+libc_hidden_builtin_def (memcpy)
-diff --git a/sysdeps/riscv/rv64/multiarch/memcpy_riscv.S b/sysdeps/riscv/rv64/multiarch/memcpy_riscv.S
-new file mode 100644
-index 0000000000..a0ba2150fc
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memcpy_riscv.S
-@@ -0,0 +1,25 @@
-+/* The assembly function for memcpy.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+#define memcpy __memcpy_riscv
-+#undef libc_hidden_builtin_def
-+#define libc_hidden_builtin_def(name)
-+
-+#include "memcpy_as.S"
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/memcpy_vector.S b/sysdeps/riscv/rv64/multiarch/memcpy_vector.S
-new file mode 100644
-index 0000000000..2319647de8
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memcpy_vector.S
-@@ -0,0 +1,54 @@
-+/* The assembly function for memcpy.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+/* For __riscv_vector this file defines memcpy.  */
-+/* #ifndef __riscv_vector */
-+# define memcpy __memcpy_vector
-+# undef libc_hidden_builtin_def
-+# define libc_hidden_builtin_def(a)
-+/* #endif */
-+
-+	.p2align 6
-+ENTRY (memcpy)
-+	mv	a3, a0
-+	sltiu	a4, a2, 16
-+	bnez	a4, .loop_cpy
-+	andi	a5, a0, 15
-+	li	a6, 16
-+	beqz	a5, .loop_cpy
-+	sub	a5, a6, a5
-+	vsetvli	t0, a5, e8, m4
-+	vle8.v	v0, (a1)
-+	add	a1, a1, t0
-+	sub	a2, a2, t0
-+	vse8.v	v0, (a3)
-+	add	a3, a3, t0
-+.loop_cpy:
-+	vsetvli	t0, a2, e8, m4
-+	vle8.v	v0, (a1)
-+	add	a1, a1, t0
-+	sub	a2, a2, t0
-+	vse8.v	v0, (a3)
-+	add	a3, a3, t0
-+	bnez	a2, .loop_cpy
-+	ret
-+END (memcpy)
-+
-+libc_hidden_builtin_def (memcpy)
-diff --git a/sysdeps/riscv/rv64/multiarch/memmove.c b/sysdeps/riscv/rv64/multiarch/memmove.c
-new file mode 100644
-index 0000000000..8d33da166d
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memmove.c
-@@ -0,0 +1,32 @@
-+/* Multiple versions of memmove.
-+   All versions must be listed in ifunc-impl-list.c.
-+   Copyright (C) 2017-2021 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/>.  */
-+
-+#if IS_IN (libc)
-+# define memmove __redirect_memmove
-+# include <string.h>
-+# undef memmove
-+
-+# include <riscv-ifunc.h>
-+
-+# define SYMBOL_NAME memmove
-+# include "ifunc-common.h"
-+
-+riscv_libc_ifunc_redirected (__redirect_memmove, memmove, IFUNC_SELECTOR);
-+riscv_libc_ifunc_hidden_def (__redirect_memmove, memmove);
-+#endif
-diff --git a/sysdeps/riscv/rv64/multiarch/memmove_riscv.c b/sysdeps/riscv/rv64/multiarch/memmove_riscv.c
-new file mode 100644
-index 0000000000..e11a9d1a43
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memmove_riscv.c
-@@ -0,0 +1,29 @@
-+/* RISCV C version memmov.
-+   Copyright (C) 2018-2021 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/>.  */
-+
-+#if IS_IN (libc)
-+#undef libc_hidden_builtin_def
-+#define libc_hidden_builtin_def(name)
-+
-+#undef weak_alias
-+#  define MEMMOVE __memmove_riscv
-+# include <string/memmove.c>
-+#else
-+
-+# include <string/memmove.c>
-+#endif
-diff --git a/sysdeps/riscv/rv64/multiarch/memmove_vector.S b/sysdeps/riscv/rv64/multiarch/memmove_vector.S
-new file mode 100644
-index 0000000000..7bf89e6cf6
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memmove_vector.S
-@@ -0,0 +1,56 @@
-+/* The assembly function for memmov.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+/* For __riscv_vector this file defines memmov.  */
-+/* #ifndef __riscv_vector */
-+# define memmove __memmove_vector
-+# undef libc_hidden_builtin_def
-+# define libc_hidden_builtin_def(a)
-+/* #endif */
-+
-+	.p2align 6
-+ENTRY (memmove)
-+	add	a4,a0,zero
-+	bgeu	a1,a0,.L_forward_copy_loop
-+	add	a5,a1,a2
-+	add	a6,a0,a2
-+	bltu	a0,a5,.L_backward_copy_loop
-+
-+.L_forward_copy_loop:
-+	vsetvli	a3,a2,e8,m8,tu,mu
-+	vle8.v	v0,(a1)
-+	sub	a2,a2,a3
-+	add	a1,a1,a3
-+	vse8.v	v0,(a4)
-+	add	a4,a4,a3
-+	bltu	zero,a2,.L_forward_copy_loop
-+	ret
-+
-+.L_backward_copy_loop:
-+	vsetvli	a3,a2,e8,m8,tu,mu
-+	sub	a5,a5,a3
-+	vle8.v	v0,(a5)
-+	sub	a2,a2,a3
-+	sub	a6,a6,a3
-+	vse8.v	v0,(a6)
-+	bltu	zero,a2,.L_backward_copy_loop
-+	ret
-+END (memmove)
-+libc_hidden_builtin_def (memmove)
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/memset.c b/sysdeps/riscv/rv64/multiarch/memset.c
-new file mode 100644
-index 0000000000..0d3582e49f
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memset.c
-@@ -0,0 +1,33 @@
-+/* Multiple versions of memset.
-+   All versions must be listed in ifunc-impl-list.c.
-+   Copyright (C) 2017-2021 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/>.  */
-+
-+#if IS_IN (libc)
-+# define memset __redirect_memset
-+# include <string.h>
-+# undef memset
-+
-+# include <riscv-ifunc.h>
-+
-+# define SYMBOL_NAME memset
-+# include "ifunc-common.h"
-+
-+riscv_libc_ifunc_redirected (__redirect_memset, memset, IFUNC_SELECTOR);
-+
-+riscv_libc_ifunc_hidden_def (__redirect_memset, memset);
-+#endif
-diff --git a/sysdeps/riscv/rv64/multiarch/memset_riscv.c b/sysdeps/riscv/rv64/multiarch/memset_riscv.c
-new file mode 100644
-index 0000000000..1101c10f96
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memset_riscv.c
-@@ -0,0 +1,29 @@
-+/* RISCV C version memset.
-+   Copyright (C) 2018-2021 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/>.  */
-+
-+#if IS_IN (libc)
-+#undef libc_hidden_builtin_def
-+#define libc_hidden_builtin_def(name)
-+
-+#undef weak_alias
-+#  define MEMSET __memset_riscv
-+# include <string/memset.c>
-+#else
-+
-+# include <string/memset.c>
-+#endif
-diff --git a/sysdeps/riscv/rv64/multiarch/memset_vector.S b/sysdeps/riscv/rv64/multiarch/memset_vector.S
-new file mode 100644
-index 0000000000..54d04238d3
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memset_vector.S
-@@ -0,0 +1,45 @@
-+
-+/* The assembly function for memset.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+/* For __riscv_vector this file defines memcpy.  */
-+/* #ifndef __riscv_vector */
-+# define memset __memset_vector
-+# undef libc_hidden_builtin_def
-+# define libc_hidden_builtin_def(a)
-+/* #endif */
-+
-+	.p2align 6
-+ENTRY (memset)
-+
-+  zext.b	a1,a1
-+  add	a5,a0,zero
-+  vsetvli	a3,a2,e8,m8,tu,mu
-+  vmv.v.x	v0,a1
-+.L_memset_loop:
-+  vse8.v	v0,(a5)
-+  sub	a2,a2,a3
-+  add	a5,a5,a3
-+  vsetvli	a3,a2,e8,m8,tu,mu
-+  bltu	zero,a2,.L_memset_loop
-+  ret
-+
-+END (memset)
-+libc_hidden_builtin_def (memset)
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-memchr.S b/sysdeps/riscv/rv64/multiarch/rtld-memchr.S
-new file mode 100644
-index 0000000000..0e68548e97
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/rtld-memchr.S
-@@ -0,0 +1 @@
-+#include "memchr_as.S"
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-memcmp.c b/sysdeps/riscv/rv64/multiarch/rtld-memcmp.c
-new file mode 100644
-index 0000000000..25faa66478
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/rtld-memcmp.c
-@@ -0,0 +1 @@
-+#include "memcmp_riscv.c"
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-memcpy.S b/sysdeps/riscv/rv64/multiarch/rtld-memcpy.S
-new file mode 100644
-index 0000000000..81f48f3aea
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/rtld-memcpy.S
-@@ -0,0 +1 @@
-+#include "memcpy_as.S"
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-memmove.c b/sysdeps/riscv/rv64/multiarch/rtld-memmove.c
-new file mode 100644
-index 0000000000..435c059184
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/rtld-memmove.c
-@@ -0,0 +1,19 @@
-+/* RISCV C version memmove.
-+   Copyright (C) 2018-2021 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/>.  */
-+
-+#include "memmove_riscv.c"
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-memset.c b/sysdeps/riscv/rv64/multiarch/rtld-memset.c
-new file mode 100644
-index 0000000000..eff6790df5
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/rtld-memset.c
-@@ -0,0 +1 @@
-+#include "memset_riscv.c"
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-strcmp.S b/sysdeps/riscv/rv64/multiarch/rtld-strcmp.S
-new file mode 100644
-index 0000000000..eb6ff5f8d3
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/rtld-strcmp.S
-@@ -0,0 +1 @@
-+#include "strcmp_.S"
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-strlen.c b/sysdeps/riscv/rv64/multiarch/rtld-strlen.c
-new file mode 100644
-index 0000000000..73308eb0fa
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/rtld-strlen.c
-@@ -0,0 +1 @@
-+#include "strlen_riscv.c"
-diff --git a/sysdeps/riscv/rv64/multiarch/strcmp.c b/sysdeps/riscv/rv64/multiarch/strcmp.c
-new file mode 100644
-index 0000000000..56969c77e8
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/strcmp.c
-@@ -0,0 +1,33 @@
-+/* Multiple versions of strcmp.
-+   All versions must be listed in ifunc-impl-list.c.
-+   Copyright (C) 2017-2021 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/>.  */
-+
-+#if IS_IN (libc)
-+# define strcmp __redirect_strcmp
-+# include <string.h>
-+# undef strcmp
-+
-+# include <riscv-ifunc.h>
-+
-+# define SYMBOL_NAME strcmp
-+# include "ifunc-common.h"
-+
-+riscv_libc_ifunc_redirected (__redirect_strcmp, strcmp, IFUNC_SELECTOR);
-+
-+riscv_libc_ifunc_hidden_def (__redirect_strcmp, strcmp);
-+#endif
-diff --git a/sysdeps/riscv/rv64/multiarch/strcmp_.S b/sysdeps/riscv/rv64/multiarch/strcmp_.S
-new file mode 100644
-index 0000000000..db5a6346b8
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/strcmp_.S
-@@ -0,0 +1,39 @@
-+
-+
-+/* The assembly function for strcmp.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+	.p2align 6
-+ENTRY (strcmp)
-+.L_strcmp_by_byte:
-+   lbu	a5,0(a0)
-+   addi	a1,a1,1
-+   addi	a0,a0,1
-+   lbu	a4,-1(a1)
-+   beqz	a5,.L_strcmp_by_byte_exit
-+   beq	a5,a4,.L_strcmp_by_byte
-+   subw	a0,a5,a4
-+   ret
-+.L_strcmp_by_byte_exit:
-+   negw	a0,a4
-+   ret
-+
-+END (strcmp)
-+libc_hidden_builtin_def (strcmp)
-diff --git a/sysdeps/riscv/rv64/multiarch/strcmp_riscv.S b/sysdeps/riscv/rv64/multiarch/strcmp_riscv.S
-new file mode 100644
-index 0000000000..93e598f0c5
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/strcmp_riscv.S
-@@ -0,0 +1,9 @@
-+
-+/* For __riscv_vector this file defines strcmp.  */
-+/* #ifndef __riscv_vector */
-+# define strcmp __strcmp_riscv
-+# undef libc_hidden_builtin_def
-+# define libc_hidden_builtin_def(a)
-+/* #endif */
-+
-+#include "strcmp_.S"
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/strcmp_vector.S b/sysdeps/riscv/rv64/multiarch/strcmp_vector.S
-new file mode 100644
-index 0000000000..41d653748a
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/strcmp_vector.S
-@@ -0,0 +1,54 @@
-+/* The assembly function for strcmp.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+/* For __riscv_vector this file defines strcmp.  */
-+/* #ifndef __riscv_vector */
-+# define strcmp __strcmp_vector
-+# undef libc_hidden_builtin_def
-+# define libc_hidden_builtin_def(a)
-+/* #endif */
-+
-+	.p2align 6
-+ENTRY (strcmp)
-+
-+   vsetvli	a3,zero,e8,m8,tu,mu
-+.L_strcmp_loop:
-+   vle8ff.v	v0,(a0)
-+   vmseq.vx	v16,v0,zero
-+   vle8ff.v	v8,(a1)
-+   vmsne.vv	v17,v0,v8
-+   vmor.mm v16,v16,v17
-+   vfirst.m	a4,v16
-+   bgez a4, .L_strcmp_loop_exit
-+   add a0,a0,a3
-+   add a1,a1,a3
-+   j .L_strcmp_loop
-+
-+.L_strcmp_loop_exit:
-+   add a0,a0,a4
-+   add a1,a1,a4
-+   lbu a4,0(a0)
-+  	lbu a5,0(a1)
-+  	sub a0,a4,a5
-+   ret
-+
-+END (strcmp)
-+libc_hidden_builtin_def (strcmp)
-+
-diff --git a/sysdeps/riscv/rv64/multiarch/strlen.c b/sysdeps/riscv/rv64/multiarch/strlen.c
-new file mode 100644
-index 0000000000..292c9103fa
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/strlen.c
-@@ -0,0 +1,32 @@
-+/* Multiple versions of strlen.
-+   All versions must be listed in ifunc-impl-list.c.
-+   Copyright (C) 2017-2021 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/>.  */
-+
-+#if IS_IN (libc)
-+# define strlen __redirect_strlen
-+# include <string.h>
-+# undef strlen
-+
-+# include <riscv-ifunc.h>
-+
-+# define SYMBOL_NAME strlen
-+# include "ifunc-common.h"
-+
-+riscv_libc_ifunc_redirected (__redirect_strlen, strlen, IFUNC_SELECTOR);
-+riscv_libc_ifunc_hidden_def (__redirect_strlen, strlen);
-+#endif
-diff --git a/sysdeps/riscv/rv64/multiarch/strlen_riscv.c b/sysdeps/riscv/rv64/multiarch/strlen_riscv.c
-new file mode 100644
-index 0000000000..e17a5dde31
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/strlen_riscv.c
-@@ -0,0 +1,29 @@
-+/* RISCV C version strlen.
-+   Copyright (C) 2018-2021 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/>.  */
-+
-+#if IS_IN (libc)
-+#undef libc_hidden_builtin_def
-+#define libc_hidden_builtin_def(name)
-+
-+#undef weak_alias
-+#  define STRLEN __strlen_riscv
-+# include <string/strlen.c>
-+#else
-+
-+# include <string/strlen.c>
-+#endif
-diff --git a/sysdeps/riscv/rv64/multiarch/strlen_vector.S b/sysdeps/riscv/rv64/multiarch/strlen_vector.S
-new file mode 100644
-index 0000000000..dd080e3a2f
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/strlen_vector.S
-@@ -0,0 +1,46 @@
-+/* The assembly function for strlen.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+/* For __riscv_vector this file defines strlen.  */
-+/* #ifndef __riscv_vector */
-+# define strlen __strlen_vector
-+# undef libc_hidden_builtin_def
-+# define libc_hidden_builtin_def(a)
-+/* #endif */
-+
-+	.p2align 6
-+ENTRY (strlen)
-+   mv	a1,a0
-+
-+.strlen_loop:
-+   vsetvli	a2,zero,e8,m8,tu,mu
-+   vle8ff.v	v0,(a1)
-+   csrr	a2,vl
-+   vmseq.vi	v8,v0,0
-+   vfirst.m	a3,v8
-+   add	a1,a1,a2
-+   bltz	a3, .strlen_loop
-+   add	a0,a0,a2
-+   add	a1,a1,a3
-+   sub	a0,a1,a0
-+   ret
-+
-+END (strlen)
-+libc_hidden_builtin_def (strlen)
-diff --git a/sysdeps/riscv/sysdep.h b/sysdeps/riscv/sysdep.h
-new file mode 100644
-index 0000000000..5229cfaf02
---- /dev/null
-+++ b/sysdeps/riscv/sysdep.h
-@@ -0,0 +1,24 @@
-+/* Copyright (C) 2011-2021 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/>.  */
-+
-+#define _SYSDEPS_SYSDEP_H 1
-+#include <sysdeps/generic/sysdep.h>
-+#include <sys/auxv.h>
-+
-+#ifdef	__ASSEMBLER__
-+
-+#endif	/* __ASSEMBLER__ */
-diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h
-index c9f8fd8236..7b75bdfee2 100644
---- a/sysdeps/unix/sysv/linux/riscv/sysdep.h
-+++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h
-@@ -21,6 +21,7 @@
- 
- #include <sysdeps/unix/sysv/linux/generic/sysdep.h>
- #include <tls.h>
-+# include <bits/hwcap.h>
- 
- #undef SYS_ify
- #define SYS_ify(syscall_name)	__NR_##syscall_name
-@@ -50,7 +51,6 @@
- 
- #ifdef __ASSEMBLER__
- 
--# include <bits/hwcap.h>
- # include <sys/asm.h>
- 
- # define ENTRY(name) LEAF(name)
--- 
-2.25.1
-

+ 1 - 1
recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch

@@ -1,4 +1,4 @@
-From 3e391efa9b179ae886dd0942202bd2a6698e2679 Mon Sep 17 00:00:00 2001
+From 9ff5200eb16e9c89ca8da89d7e07975d082a13b0 Mon Sep 17 00:00:00 2001
 From: Jason Wessel <jason.wessel@windriver.com>
 Date: Sat, 7 Dec 2019 10:01:37 -0800
 Subject: [PATCH] localedef: fix-ups hardlink to make it compile

+ 0 - 25
recipes-core/glibc/glibc/0003-add-NT_RISCV_VECTOR-macro-definition-to-align-with-l.patch

@@ -1,25 +0,0 @@
-From aa022f152236190a26964971ec3a7c6b62028ad1 Mon Sep 17 00:00:00 2001
-From: "max.ma" <max.ma@starfivetech.com>
-Date: Tue, 21 Dec 2021 18:39:15 -0800
-Subject: [PATCH 03/19] add NT_RISCV_VECTOR macro definition to align with
- linux elf.h
-
----
- elf/elf.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/elf/elf.h b/elf/elf.h
-index 02a1b3f52f..7d1571043d 100644
---- a/elf/elf.h
-+++ b/elf/elf.h
-@@ -829,6 +829,7 @@ typedef struct
- #define NT_MIPS_DSP	0x800		/* MIPS DSP ASE registers.  */
- #define NT_MIPS_FP_MODE	0x801		/* MIPS floating-point mode.  */
- #define NT_MIPS_MSA	0x802		/* MIPS SIMD registers.  */
-+#define NT_RISCV_VECTOR	0x900		/* RISC-V vector registers */
- 
- /* Legal values for the note segment descriptor types for object files.  */
- 
--- 
-2.25.1
-

+ 4 - 4
recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch

@@ -1,4 +1,4 @@
-From a74ac72e6a25121c99f3875cf0245a435729e897 Mon Sep 17 00:00:00 2001
+From 0d996c5600603a67f0265e870511cdd18dbaa8a6 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 01:48:24 +0000
 Subject: [PATCH] nativesdk-glibc: Look for host system ld.so.cache as well
@@ -30,10 +30,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  1 file changed, 8 insertions(+), 8 deletions(-)
 
 diff --git a/elf/dl-load.c b/elf/dl-load.c
-index 1ad0868dad..c5e235d918 100644
+index 9a87fda9c9..0a6fa9b8f0 100644
 --- a/elf/dl-load.c
 +++ b/elf/dl-load.c
-@@ -2109,6 +2109,14 @@ _dl_map_object (struct link_map *loader, const char *name,
+@@ -2102,6 +2102,14 @@ _dl_map_object (struct link_map *loader, const char *name,
              }
          }
  
@@ -48,7 +48,7 @@ index 1ad0868dad..c5e235d918 100644
  #ifdef USE_LDCONFIG
        if (fd == -1
  	  && (__glibc_likely ((mode & __RTLD_SECURE) == 0)
-@@ -2167,14 +2175,6 @@ _dl_map_object (struct link_map *loader, const char *name,
+@@ -2160,14 +2168,6 @@ _dl_map_object (struct link_map *loader, const char *name,
  	}
  #endif
  

+ 0 - 33
recipes-core/glibc/glibc/0004-fix-the-bcmp-unrecognized-issue.patch

@@ -1,33 +0,0 @@
-From d23b3456285b4276b439f207530208cebcb2ab44 Mon Sep 17 00:00:00 2001
-From: "max.ma" <max.ma@starfivetech.com>
-Date: Sun, 16 Jan 2022 16:56:07 -0800
-Subject: [PATCH 04/19] fix the bcmp unrecognized issue
-
----
- sysdeps/riscv/rv64/multiarch/aeabi_memcpy.c  | 2 --
- sysdeps/riscv/rv64/multiarch/memcmp_vector.S | 1 +
- 2 files changed, 1 insertion(+), 2 deletions(-)
- delete mode 100644 sysdeps/riscv/rv64/multiarch/aeabi_memcpy.c
-
-diff --git a/sysdeps/riscv/rv64/multiarch/aeabi_memcpy.c b/sysdeps/riscv/rv64/multiarch/aeabi_memcpy.c
-deleted file mode 100644
-index 2054d18261..0000000000
---- a/sysdeps/riscv/rv64/multiarch/aeabi_memcpy.c
-+++ /dev/null
-@@ -1,2 +0,0 @@
--/* Empty file to override sysdeps/riscv version. See memcpy.S for definitions
--   of these functions.  */
-diff --git a/sysdeps/riscv/rv64/multiarch/memcmp_vector.S b/sysdeps/riscv/rv64/multiarch/memcmp_vector.S
-index f6cbc1307b..fe89f92268 100644
---- a/sysdeps/riscv/rv64/multiarch/memcmp_vector.S
-+++ b/sysdeps/riscv/rv64/multiarch/memcmp_vector.S
-@@ -52,5 +52,6 @@ ENTRY (memcmp)
-    add	a0,zero,zero
-    ret
- END (memcmp)
-+weak_alias (memcmp, bcmp)
- libc_hidden_builtin_def (memcmp)
- 
--- 
-2.25.1
-

+ 3 - 3
recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch

@@ -1,4 +1,4 @@
-From d2f16ab250dbb93ae21e9e9286ddf696141db735 Mon Sep 17 00:00:00 2001
+From c3492719b2deaf3339eefb1ab30f4337e592ed80 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 01:50:00 +0000
 Subject: [PATCH] nativesdk-glibc: Fix buffer overrun with a relocated SDK
@@ -21,10 +21,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  1 file changed, 12 insertions(+)
 
 diff --git a/elf/dl-load.c b/elf/dl-load.c
-index c5e235d918..ce3cbfa3c4 100644
+index 0a6fa9b8f0..3a23dc618c 100644
 --- a/elf/dl-load.c
 +++ b/elf/dl-load.c
-@@ -1809,7 +1809,19 @@ open_path (const char *name, size_t namelen, int mode,
+@@ -1802,7 +1802,19 @@ open_path (const char *name, size_t namelen, int mode,
         given on the command line when rtld is run directly.  */
      return -1;
  

+ 19 - 20
recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch

@@ -1,4 +1,4 @@
-From 2d41508ed1059df2df9994d35d870be2005f575f Mon Sep 17 00:00:00 2001
+From e874dacbfdb06520240887e9077c58006ee33f87 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 01:51:38 +0000
 Subject: [PATCH] nativesdk-glibc: Raise the size of arrays containing dl paths
@@ -19,14 +19,14 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  elf/dl-load.c              | 4 ++--
  elf/dl-usage.c             | 6 ++++--
  elf/interp.c               | 2 +-
- elf/ldconfig.c             | 3 +++
+ elf/ldconfig.c             | 2 ++
  elf/rtld.c                 | 1 +
  iconv/gconv_conf.c         | 2 +-
  sysdeps/generic/dl-cache.h | 4 ----
- 8 files changed, 16 insertions(+), 10 deletions(-)
+ 8 files changed, 15 insertions(+), 10 deletions(-)
 
 diff --git a/elf/dl-cache.c b/elf/dl-cache.c
-index 8bbf110d02..c02a95d9b5 100644
+index 804bf23222..d99501c389 100644
 --- a/elf/dl-cache.c
 +++ b/elf/dl-cache.c
 @@ -352,6 +352,10 @@ search_cache (const char *string_table, uint32_t string_table_size,
@@ -41,7 +41,7 @@ index 8bbf110d02..c02a95d9b5 100644
  _dl_cache_libcmp (const char *p1, const char *p2)
  {
 diff --git a/elf/dl-load.c b/elf/dl-load.c
-index ce3cbfa3c4..e116db24a1 100644
+index 3a23dc618c..563e703096 100644
 --- a/elf/dl-load.c
 +++ b/elf/dl-load.c
 @@ -117,8 +117,8 @@ enum { ncapstr = 1, max_capstrlen = 0 };
@@ -56,7 +56,7 @@ index ce3cbfa3c4..e116db24a1 100644
    SYSTEM_DIRS_LEN
  };
 diff --git a/elf/dl-usage.c b/elf/dl-usage.c
-index 98d8c98948..77ca98cbf9 100644
+index 98f0b0d027..ab4f76e1fe 100644
 --- a/elf/dl-usage.c
 +++ b/elf/dl-usage.c
 @@ -25,6 +25,8 @@
@@ -68,7 +68,7 @@ index 98d8c98948..77ca98cbf9 100644
  void
  _dl_usage (const char *argv0, const char *wrong_option)
  {
-@@ -244,7 +246,7 @@ setting environment variables (which would be inherited by subprocesses).\n\
+@@ -184,7 +186,7 @@ setting environment variables (which would be inherited by subprocesses).\n\
    --list                list all dependencies and how they are resolved\n\
    --verify              verify that given object really is a dynamically linked\n\
                          object we can handle\n\
@@ -77,7 +77,7 @@ index 98d8c98948..77ca98cbf9 100644
    --library-path PATH   use given PATH instead of content of the environment\n\
                          variable LD_LIBRARY_PATH\n\
    --glibc-hwcaps-prepend LIST\n\
-@@ -267,7 +269,7 @@ setting environment variables (which would be inherited by subprocesses).\n\
+@@ -203,7 +205,7 @@ setting environment variables (which would be inherited by subprocesses).\n\
  \n\
  This program interpreter self-identifies as: " RTLD "\n\
  ",
@@ -85,9 +85,9 @@ index 98d8c98948..77ca98cbf9 100644
 +              argv0, LD_SO_CACHE);
    print_search_path_for_help (state);
    print_hwcaps_subdirectories (state);
-   print_legacy_hwcap_directories ();
+   _exit (EXIT_SUCCESS);
 diff --git a/elf/interp.c b/elf/interp.c
-index d82af036d1..9d282b2769 100644
+index ae21ae0cb3..b168e6da66 100644
 --- a/elf/interp.c
 +++ b/elf/interp.c
 @@ -18,5 +18,5 @@
@@ -98,24 +98,23 @@ index d82af036d1..9d282b2769 100644
 +const char __invoke_dynamic_linker__[4096] __attribute__ ((section (".interp")))
    = RUNTIME_LINKER;
 diff --git a/elf/ldconfig.c b/elf/ldconfig.c
-index 9394ac6438..7f66b1a460 100644
+index d26eef1fb4..e5af6e5c01 100644
 --- a/elf/ldconfig.c
 +++ b/elf/ldconfig.c
-@@ -176,6 +176,9 @@ static struct argp argp =
+@@ -150,6 +150,8 @@ static struct argp argp =
    options, parse_opt, NULL, doc, NULL, more_help, NULL
  };
  
-+
 +extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache")));
 +
- /* Check if string corresponds to an important hardware capability or
-    a platform.  */
- static int
+ /* Handle program arguments.  */
+ static error_t
+ parse_opt (int key, char *arg, struct argp_state *state)
 diff --git a/elf/rtld.c b/elf/rtld.c
-index cbbaf4a331..d2d27a0127 100644
+index a91e2a4471..56d816d4d9 100644
 --- a/elf/rtld.c
 +++ b/elf/rtld.c
-@@ -189,6 +189,7 @@ dso_name_valid_for_suid (const char *p)
+@@ -190,6 +190,7 @@ dso_name_valid_for_suid (const char *p)
      }
    return *p != '\0';
  }
@@ -124,7 +123,7 @@ index cbbaf4a331..d2d27a0127 100644
  static void
  audit_list_init (struct audit_list *list)
 diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c
-index f069e28323..6288f715ba 100644
+index ee9e97e1bd..01a99382d0 100644
 --- a/iconv/gconv_conf.c
 +++ b/iconv/gconv_conf.c
 @@ -35,7 +35,7 @@
@@ -137,7 +136,7 @@ index f069e28323..6288f715ba 100644
  /* Type to represent search path.  */
  struct path_elem
 diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h
-index 93d4bea930..5249176441 100644
+index bd39ff7fb7..38f9e2ad57 100644
 --- a/sysdeps/generic/dl-cache.h
 +++ b/sysdeps/generic/dl-cache.h
 @@ -34,10 +34,6 @@

+ 0 - 137
recipes-core/glibc/glibc/0005-riscv-Resolve-symbols-directly-for-symbols-with-STO_.patch

@@ -1,137 +0,0 @@
-From 66e355177a3c5f637852e47290878e06a7f95c32 Mon Sep 17 00:00:00 2001
-From: Hsiangkai Wang <kai.wang@sifive.com>
-Date: Tue, 18 Jan 2022 12:31:59 +0800
-Subject: [PATCH 05/19] riscv: Resolve symbols directly for symbols with
- STO_RISCV_VARIANT_CC.
-
-In some cases, we do not want to go through the resolver for function
-calls. For example, functions with vector arguments will use vector
-registers to pass arguments. In the resolver, we do not save/restore the
-vector argument registers for lazy binding efficiency. To avoid ruining
-the vector arguments, functions with vector arguments will not go
-through the resolver.
-
-To achieve the goal, we will annotate the function symbols with
-STO_RISCV_VARIANT_CC flag and add DT_RISCV_VARIANT_CC tag in the dynamic
-section. In the first pass on PLT relocations, we do not set up to call
-_dl_runtime_resolve. Instead, we resolve the functions directly.
-
-Signed-off-by: Hsiangkai Wang <kai.wang@sifive.com>
-Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
----
- elf/elf.h                    |  7 +++++++
- manual/platform.texi         |  6 ++++++
- sysdeps/riscv/dl-dtprocnum.h | 21 +++++++++++++++++++++
- sysdeps/riscv/dl-machine.h   | 26 ++++++++++++++++++++++++++
- 4 files changed, 60 insertions(+)
- create mode 100644 sysdeps/riscv/dl-dtprocnum.h
-
-diff --git a/elf/elf.h b/elf/elf.h
-index 7d1571043d..27009bdbc0 100644
---- a/elf/elf.h
-+++ b/elf/elf.h
-@@ -3925,6 +3925,13 @@ enum
- 
- #define R_TILEGX_NUM		130
- 
-+/* RISC-V specific values for the Dyn d_tag field.  */
-+#define DT_RISCV_VARIANT_CC	(DT_LOPROC + 1)
-+#define DT_RISCV_NUM		2
-+
-+/* RISC-V specific values for the st_other field.  */
-+#define STO_RISCV_VARIANT_CC 0x80
-+
- /* RISC-V ELF Flags */
- #define EF_RISCV_RVC 			0x0001
- #define EF_RISCV_FLOAT_ABI 		0x0006
-diff --git a/manual/platform.texi b/manual/platform.texi
-index d5fdc5bd05..a1a740f381 100644
---- a/manual/platform.texi
-+++ b/manual/platform.texi
-@@ -121,6 +121,12 @@ when it is not allowed, the priority is set to medium.
- @node RISC-V
- @appendixsec RISC-V-specific Facilities
- 
-+Functions that are lazily bound must be compatible with the standard calling
-+convention. When a function is annotated with STO_RISCV_VARIANT_CC, it means
-+this function is not compatible with the standard calling convention. The
-+dynamic linker will directly resolve it instead of using the lazy binding
-+mechanism.
-+
- Cache management facilities specific to RISC-V systems that implement the Linux
- ABI are declared in @file{sys/cachectl.h}.
- 
-diff --git a/sysdeps/riscv/dl-dtprocnum.h b/sysdeps/riscv/dl-dtprocnum.h
-new file mode 100644
-index 0000000000..f189fd700a
---- /dev/null
-+++ b/sysdeps/riscv/dl-dtprocnum.h
-@@ -0,0 +1,21 @@
-+/* Configuration of lookup functions.  RISC-V version.
-+   Copyright (C) 2019-2021 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/>.  */
-+
-+/* Number of extra dynamic section entries for this architecture.  By
-+   default there are none.  */
-+#define DT_THISPROCNUM	DT_RISCV_NUM
-diff --git a/sysdeps/riscv/dl-machine.h b/sysdeps/riscv/dl-machine.h
-index dfedc9801d..11523ae627 100644
---- a/sysdeps/riscv/dl-machine.h
-+++ b/sysdeps/riscv/dl-machine.h
-@@ -53,6 +53,9 @@
-      || (__WORDSIZE == 64 && (type) == R_RISCV_TLS_TPREL64)))	\
-    | (ELF_RTYPE_CLASS_COPY * ((type) == R_RISCV_COPY)))
- 
-+//* Translate a processor specific dynamic tag to the index in l_info array.  */
-+#define DT_RISCV(x) (DT_RISCV_##x - DT_LOPROC + DT_NUM)
-+
- /* Return nonzero iff ELF header is compatible with the running host.  */
- static inline int __attribute_used__
- elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
-@@ -281,6 +284,29 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
-   /* Check for unexpected PLT reloc type.  */
-   if (__glibc_likely (r_type == R_RISCV_JUMP_SLOT))
-     {
-+      if (__glibc_unlikely (map->l_info[DT_RISCV (VARIANT_CC)] != NULL))
-+	{
-+          /* Check the symbol table for variant CC symbols.  */
-+          const Elf_Symndx symndx = ELFW(R_SYM) (reloc->r_info);
-+          const ElfW(Sym) *symtab =
-+            (const void *)D_PTR (map, l_info[DT_SYMTAB]);
-+          const ElfW(Sym) *sym = &symtab[symndx];
-+          if (__glibc_unlikely (sym->st_other & STO_RISCV_VARIANT_CC))
-+            {
-+              /* Avoid lazy resolution of variant CC symbols.  */
-+              const struct r_found_version *version = NULL;
-+              if (map->l_info[VERSYMIDX (DT_VERSYM)] != NULL)
-+                {
-+                  const ElfW(Half) *vernum =
-+                    (const void *)D_PTR (map, l_info[VERSYMIDX (DT_VERSYM)]);
-+                  version = &map->l_versions[vernum[symndx] & 0x7fff];
-+                }
-+              elf_machine_rela (map, scope, reloc, sym, version, reloc_addr,
-+                                skip_ifunc);
-+              return;
-+            }
-+	}
-+
-       if (__glibc_unlikely (map->l_mach.plt == 0))
- 	{
- 	  if (l_addr)
--- 
-2.25.1
-

+ 0 - 33
recipes-core/glibc/glibc/0006-change-memcpy_vector-LMUL-to-m8.patch

@@ -1,33 +0,0 @@
-From 8c1459b734f8cfe1562d72ad302d3dfa55fa85e7 Mon Sep 17 00:00:00 2001
-From: "max.ma" <max.ma@starfivetech.com>
-Date: Mon, 28 Feb 2022 18:49:58 -0800
-Subject: [PATCH 06/19] change memcpy_vector LMUL to m8
-
----
- sysdeps/riscv/rv64/multiarch/memcpy_vector.S | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/sysdeps/riscv/rv64/multiarch/memcpy_vector.S b/sysdeps/riscv/rv64/multiarch/memcpy_vector.S
-index 2319647de8..bae330f6e0 100644
---- a/sysdeps/riscv/rv64/multiarch/memcpy_vector.S
-+++ b/sysdeps/riscv/rv64/multiarch/memcpy_vector.S
-@@ -34,14 +34,14 @@ ENTRY (memcpy)
- 	li	a6, 16
- 	beqz	a5, .loop_cpy
- 	sub	a5, a6, a5
--	vsetvli	t0, a5, e8, m4
-+	vsetvli	t0, a5, e8, m8
- 	vle8.v	v0, (a1)
- 	add	a1, a1, t0
- 	sub	a2, a2, t0
- 	vse8.v	v0, (a3)
- 	add	a3, a3, t0
- .loop_cpy:
--	vsetvli	t0, a2, e8, m4
-+	vsetvli	t0, a2, e8, m8
- 	vle8.v	v0, (a1)
- 	add	a1, a1, t0
- 	sub	a2, a2, t0
--- 
-2.25.1
-

+ 2 - 2
recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch

@@ -1,4 +1,4 @@
-From 946d1cadf0bb54216409e8e0eb09be3e96044dbf Mon Sep 17 00:00:00 2001
+From 76eaf7340a7f9063ab1ad2d7c6c0e205f22f544c Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Thu, 31 Dec 2015 14:35:35 -0800
 Subject: [PATCH] nativesdk-glibc: Allow 64 bit atomics for x86
@@ -17,7 +17,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  1 file changed, 1 insertion(+), 6 deletions(-)
 
 diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h
-index f24f1c71ed..574487ca54 100644
+index 95663099e4..4d81efc51a 100644
 --- a/sysdeps/x86/atomic-machine.h
 +++ b/sysdeps/x86/atomic-machine.h
 @@ -26,19 +26,14 @@

+ 0 - 182
recipes-core/glibc/glibc/0007-add-header-files-for-vector-support.patch

@@ -1,182 +0,0 @@
-From 850779729c6da29f45bc10b2fa4f500c9edfd19b Mon Sep 17 00:00:00 2001
-From: "max.ma" <max.ma@starfivetech.com>
-Date: Tue, 6 Sep 2022 02:21:53 -0700
-Subject: [PATCH 07/19] add header files for vector support
-
-cx
----
- sysdeps/riscv/rtld-global-offsets.sym         |  7 ++++
- sysdeps/unix/sysv/linux/riscv/bits/hwcap.h    | 31 +++++++++++++++
- .../sysv/linux/riscv/bits/pthread_stack_min.h | 21 ++++++++++
- sysdeps/unix/sysv/linux/riscv/bits/sigstack.h | 32 +++++++++++++++
- .../linux/riscv/sysconf-pthread_stack_min.h   | 39 +++++++++++++++++++
- 5 files changed, 130 insertions(+)
- create mode 100644 sysdeps/riscv/rtld-global-offsets.sym
- create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/hwcap.h
- create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/pthread_stack_min.h
- create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/sigstack.h
- create mode 100644 sysdeps/unix/sysv/linux/riscv/sysconf-pthread_stack_min.h
-
-diff --git a/sysdeps/riscv/rtld-global-offsets.sym b/sysdeps/riscv/rtld-global-offsets.sym
-new file mode 100644
-index 0000000000..ff4e97f2a6
---- /dev/null
-+++ b/sysdeps/riscv/rtld-global-offsets.sym
-@@ -0,0 +1,7 @@
-+#define SHARED 1
-+
-+#include <ldsodefs.h>
-+
-+#define rtld_global_ro_offsetof(mem) offsetof (struct rtld_global_ro, mem)
-+
-+RTLD_GLOBAL_RO_DL_HWCAP_OFFSET	rtld_global_ro_offsetof (_dl_hwcap)
-diff --git a/sysdeps/unix/sysv/linux/riscv/bits/hwcap.h b/sysdeps/unix/sysv/linux/riscv/bits/hwcap.h
-new file mode 100644
-index 0000000000..dbd101fa2e
---- /dev/null
-+++ b/sysdeps/unix/sysv/linux/riscv/bits/hwcap.h
-@@ -0,0 +1,31 @@
-+/* Defines for bits in AT_HWCAP.  RISC-V Linux version.
-+   Copyright (C) 2022 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#if !defined (_SYS_AUXV_H) && !defined (_LINUX_RISCV_SYSDEP_H)
-+# error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead."
-+#endif
-+
-+/* The following must match the kernel's <asm/hwcap.h>.  */
-+#define HWCAP_ISA_I      0x100		//(1 << ('I' - 'A'))
-+#define HWCAP_ISA_M      0x1000 	//(1 << ('M' - 'A'))
-+#define HWCAP_ISA_A      0x1		//(1 << ('A' - 'A'))
-+#define HWCAP_ISA_F      0x20		//(1 << ('F' - 'A'))
-+#define HWCAP_ISA_D      0x8		//(1 << ('D' - 'A'))
-+#define HWCAP_ISA_C      0x4		//(1 << ('C' - 'A'))
-+#define HWCAP_ISA_V      0x200000	//(1 << ('V' - 'A'))
-+
-diff --git a/sysdeps/unix/sysv/linux/riscv/bits/pthread_stack_min.h b/sysdeps/unix/sysv/linux/riscv/bits/pthread_stack_min.h
-new file mode 100644
-index 0000000000..0ab7feb4a7
---- /dev/null
-+++ b/sysdeps/unix/sysv/linux/riscv/bits/pthread_stack_min.h
-@@ -0,0 +1,21 @@
-+/* Definition of PTHREAD_STACK_MIN.  Linux/riscv version.
-+   Copyright (C) 2022 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/>.  */
-+
-+/* Minimum size for a thread.  We are free to choose a reasonable value.  */
-+#define PTHREAD_STACK_MIN	20480
-diff --git a/sysdeps/unix/sysv/linux/riscv/bits/sigstack.h b/sysdeps/unix/sysv/linux/riscv/bits/sigstack.h
-new file mode 100644
-index 0000000000..c75ddc03b0
---- /dev/null
-+++ b/sysdeps/unix/sysv/linux/riscv/bits/sigstack.h
-@@ -0,0 +1,32 @@
-+/* sigstack, sigaltstack definitions.
-+   Copyright (C) 2022 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/>.  */
-+
-+#ifndef _BITS_SIGSTACK_H
-+#define _BITS_SIGSTACK_H 1
-+
-+#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
-+# error "Never include this file directly.  Use <signal.h> instead"
-+#endif
-+
-+/* Minimum stack size (5k+256 bytes) for a signal handler.  */
-+#define MINSIGSTKSZ	5376
-+
-+/* System default stack size.  */
-+#define SIGSTKSZ	16384
-+
-+#endif /* bits/sigstack.h */
-diff --git a/sysdeps/unix/sysv/linux/riscv/sysconf-pthread_stack_min.h b/sysdeps/unix/sysv/linux/riscv/sysconf-pthread_stack_min.h
-new file mode 100644
-index 0000000000..53ba6a1142
---- /dev/null
-+++ b/sysdeps/unix/sysv/linux/riscv/sysconf-pthread_stack_min.h
-@@ -0,0 +1,39 @@
-+/* __get_pthread_stack_min ().  Linux version.
-+   Copyright (C) 2021 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/>.  */
-+
-+/* Return sysconf (_SC_THREAD_STACK_MIN).  */
-+
-+static inline long int
-+__get_pthread_stack_min (void)
-+{
-+  /* sysconf (_SC_THREAD_STACK_MIN) >= sysconf (_SC_MINSIGSTKSZ).  */
-+  long int pthread_stack_min = GLRO(dl_minsigstacksize) * 4;
-+  assert (pthread_stack_min != 0);
-+  _Static_assert (__builtin_constant_p (PTHREAD_STACK_MIN),
-+		  "PTHREAD_STACK_MIN is constant");
-+  /* Return MAX (PTHREAD_STACK_MIN, pthread_stack_min).  */
-+  if (pthread_stack_min < PTHREAD_STACK_MIN)
-+    pthread_stack_min = PTHREAD_STACK_MIN;
-+  /* We have a private interface, __pthread_get_minstack@GLIBC_PRIVATE
-+     which returns a larger size that includes the required TLS variable
-+     space which has been determined at startup.  For sysconf here we are
-+     conservative and don't include the space required for TLS access.
-+     Eventually the TLS variable space will not be part of the stack
-+     (Bug 11787).  */
-+  return pthread_stack_min;
-+}
--- 
-2.25.1
-

+ 5 - 5
recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch

@@ -1,4 +1,4 @@
-From ce4e796fa8bd2df962cf7a0e4bc69ab6181e4ebf Mon Sep 17 00:00:00 2001
+From ef8bb46455d602cb00caf59b2044a9a23b240cc2 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 3 Aug 2018 09:55:12 -0700
 Subject: [PATCH] nativesdk-glibc: Make relocatable install for locales
@@ -19,7 +19,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  4 files changed, 8 insertions(+), 7 deletions(-)
 
 diff --git a/locale/findlocale.c b/locale/findlocale.c
-index fc433b61d8..d6f030f13c 100644
+index 1b7034348b..939d4fd613 100644
 --- a/locale/findlocale.c
 +++ b/locale/findlocale.c
 @@ -55,7 +55,7 @@ struct __locale_data *const _nl_C[] attribute_hidden =
@@ -41,7 +41,7 @@ index fc433b61d8..d6f030f13c 100644
    else
      /* We really have to load some data.  First see whether the name is
 diff --git a/locale/loadarchive.c b/locale/loadarchive.c
-index fcc4913319..62cae8c6c0 100644
+index 5b857d5d24..e642912e2a 100644
 --- a/locale/loadarchive.c
 +++ b/locale/loadarchive.c
 @@ -42,7 +42,7 @@
@@ -54,7 +54,7 @@ index fcc4913319..62cae8c6c0 100644
  /* Size of initial mapping window, optimal if large enough to
     cover the header plus the initial locale.  */
 diff --git a/locale/localeinfo.h b/locale/localeinfo.h
-index fd43033a19..3dc26272a0 100644
+index 8bbf281427..7a930079a5 100644
 --- a/locale/localeinfo.h
 +++ b/locale/localeinfo.h
 @@ -347,7 +347,7 @@ _nl_lookup_word (locale_t l, int category, int item)
@@ -67,7 +67,7 @@ index fd43033a19..3dc26272a0 100644
  /* Load the locale data for CATEGORY from the file specified by *NAME.
     If *NAME is "", use environment variables as specified by POSIX, and
 diff --git a/locale/programs/locale.c b/locale/programs/locale.c
-index 1b51b50d68..87c9049444 100644
+index 1d1a9b2f00..d9ed395b39 100644
 --- a/locale/programs/locale.c
 +++ b/locale/programs/locale.c
 @@ -631,6 +631,7 @@ nameentcmp (const void *a, const void *b)

+ 2 - 2
recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch

@@ -1,4 +1,4 @@
-From 95508f06f13604ed96f28d18eb1670ea1ed02063 Mon Sep 17 00:00:00 2001
+From 7f05e35c675a6d1af2144b4cfbabab250de43f38 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Sat, 6 Mar 2021 14:48:56 -0800
 Subject: [PATCH] nativesdk-glibc: Fall back to faccessat on faccess2 returns
@@ -14,7 +14,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  1 file changed, 5 insertions(+), 1 deletion(-)
 
 diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c
-index 1378bb2db8..19f2044172 100644
+index 0ccbd778b5..9df1a0fe12 100644
 --- a/sysdeps/unix/sysv/linux/faccessat.c
 +++ b/sysdeps/unix/sysv/linux/faccessat.c
 @@ -30,7 +30,11 @@ __faccessat (int fd, const char *file, int mode, int flag)

+ 0 - 598
recipes-core/glibc/glibc/0008-prohibit-from-generating-plt-table-when-static-linki.patch

@@ -1,598 +0,0 @@
-From 3549fcbe22dab50b01361db0d8e5542879ccdfc2 Mon Sep 17 00:00:00 2001
-From: "max.ma" <max.ma@starfivetech.com>
-Date: Wed, 15 Jun 2022 00:10:33 -0700
-Subject: [PATCH 08/19] prohibit from generating plt table when static linking
-
----
- sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c |  4 ++--
- sysdeps/riscv/rv64/multiarch/memchr.c          |  5 ++++-
- sysdeps/riscv/rv64/multiarch/memchr_as.S       |  2 ++
- sysdeps/riscv/rv64/multiarch/memchr_riscv.S    | 10 +++++++++-
- sysdeps/riscv/rv64/multiarch/memchr_vector.S   |  6 ++++--
- sysdeps/riscv/rv64/multiarch/memcmp.c          |  6 +++++-
- sysdeps/riscv/rv64/multiarch/memcmp_riscv.c    |  9 +++++++--
- sysdeps/riscv/rv64/multiarch/memcmp_vector.S   |  7 +++++--
- sysdeps/riscv/rv64/multiarch/memcpy.c          |  5 ++++-
- sysdeps/riscv/rv64/multiarch/memcpy_riscv.S    | 11 ++++++++++-
- sysdeps/riscv/rv64/multiarch/memcpy_vector.S   |  6 ++++--
- sysdeps/riscv/rv64/multiarch/memmove.c         |  5 ++++-
- sysdeps/riscv/rv64/multiarch/memmove_riscv.c   |  6 ++++--
- sysdeps/riscv/rv64/multiarch/memmove_vector.S  |  8 +++++---
- sysdeps/riscv/rv64/multiarch/memset.c          |  5 ++++-
- sysdeps/riscv/rv64/multiarch/memset_riscv.c    |  6 ++++--
- sysdeps/riscv/rv64/multiarch/memset_vector.S   |  7 ++++---
- sysdeps/riscv/rv64/multiarch/rtld-memcmp.c     |  2 +-
- sysdeps/riscv/rv64/multiarch/rtld-memmove.c    |  2 +-
- sysdeps/riscv/rv64/multiarch/rtld-memset.c     |  2 +-
- sysdeps/riscv/rv64/multiarch/rtld-strlen.c     |  2 +-
- sysdeps/riscv/rv64/multiarch/strcmp.c          |  5 ++++-
- sysdeps/riscv/rv64/multiarch/strcmp_riscv.S    | 12 ++++++++----
- sysdeps/riscv/rv64/multiarch/strcmp_vector.S   |  7 ++++---
- sysdeps/riscv/rv64/multiarch/strlen.c          |  5 ++++-
- sysdeps/riscv/rv64/multiarch/strlen_riscv.c    |  7 +++++--
- sysdeps/riscv/rv64/multiarch/strlen_vector.S   |  6 ++++--
- 27 files changed, 114 insertions(+), 44 deletions(-)
-
-diff --git a/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c b/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c
-index 28c6e123f0..1a6611ab88 100644
---- a/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c
-+++ b/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c
-@@ -30,7 +30,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
- 			size_t max)
- {
-   size_t i = 0;
--
-+#if defined SHARED && defined __riscv_vector
-   bool use_rvv = (GLRO(dl_hwcap) & HWCAP_ISA_V) != 0;
- 
-   IFUNC_IMPL (i, name, memcpy,
-@@ -60,6 +60,6 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
-   IFUNC_IMPL (i, name, memset,
- 	      IFUNC_IMPL_ADD (array, i, memset, use_rvv, __memset_vector)
- 	      IFUNC_IMPL_ADD (array, i, memset, 1, __memset_riscv));
--
-+#endif
-   return i;
- }
-diff --git a/sysdeps/riscv/rv64/multiarch/memchr.c b/sysdeps/riscv/rv64/multiarch/memchr.c
-index 1544bc3d01..0a059b2977 100644
---- a/sysdeps/riscv/rv64/multiarch/memchr.c
-+++ b/sysdeps/riscv/rv64/multiarch/memchr.c
-@@ -17,7 +17,8 @@
-    License along with the GNU C Library; if not, see
-    <https://www.gnu.org/licenses/>.  */
- 
--#if IS_IN (libc)
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector  
-+
- # define memchr __redirect_memchr
- # include <string.h>
- # undef memchr
-@@ -29,4 +30,6 @@
- 
- riscv_libc_ifunc_redirected (__redirect_memchr, memchr, IFUNC_SELECTOR);
- riscv_libc_ifunc_hidden_def (__redirect_memchr, memchr);
-+#else 
-+# include <string.h>
- #endif
-diff --git a/sysdeps/riscv/rv64/multiarch/memchr_as.S b/sysdeps/riscv/rv64/multiarch/memchr_as.S
-index 557098afda..b8691744f3 100644
---- a/sysdeps/riscv/rv64/multiarch/memchr_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/memchr_as.S
-@@ -19,6 +19,8 @@
- 
- #include <sysdep.h>
- 
-+	.p2align 6
-+
- ENTRY (memchr)
-    zext.b	a3,a1
-    beqz	a2, .L_not_found
-diff --git a/sysdeps/riscv/rv64/multiarch/memchr_riscv.S b/sysdeps/riscv/rv64/multiarch/memchr_riscv.S
-index ce7b64bbe0..ee4394fef9 100644
---- a/sysdeps/riscv/rv64/multiarch/memchr_riscv.S
-+++ b/sysdeps/riscv/rv64/multiarch/memchr_riscv.S
-@@ -18,8 +18,16 @@
- 
- #include <sysdep.h>
- 
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
-+
- #define memchr __memchr_riscv
- #undef libc_hidden_builtin_def
- #define libc_hidden_builtin_def(name)
-+#include "memchr_as.S"
-+
-+
-+#elif !defined __riscv_vector
-+
-+#include "memchr_as.S"
- 
--#include "memchr_as.S"
-\ No newline at end of file
-+#endif
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/memchr_vector.S b/sysdeps/riscv/rv64/multiarch/memchr_vector.S
-index 77693d716d..9441ddb489 100644
---- a/sysdeps/riscv/rv64/multiarch/memchr_vector.S
-+++ b/sysdeps/riscv/rv64/multiarch/memchr_vector.S
-@@ -19,11 +19,12 @@
- #include <sysdep.h>
- 
- /* For __riscv_vector this file defines memchr.  */
--/* #ifndef __riscv_vector */
-+#ifdef __riscv_vector 
-+#ifdef SHARED
- # define memchr __memchr_vector
- # undef libc_hidden_builtin_def
- # define libc_hidden_builtin_def(a)
--/* #endif */
-+#endif
- 
- 	.p2align 6
- ENTRY (memchr)
-@@ -51,3 +52,4 @@ ENTRY (memchr)
-    ret
- END (memchr)
- libc_hidden_builtin_def (memchr)
-+#endif
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/memcmp.c b/sysdeps/riscv/rv64/multiarch/memcmp.c
-index 29730c6ed1..3dab42ea74 100644
---- a/sysdeps/riscv/rv64/multiarch/memcmp.c
-+++ b/sysdeps/riscv/rv64/multiarch/memcmp.c
-@@ -17,7 +17,8 @@
-    License along with the GNU C Library; if not, see
-    <https://www.gnu.org/licenses/>.  */
- 
--#if IS_IN (libc)
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
-+
- # define memcmp __redirect_memcmp
- # include <string.h>
- # undef memcmp
-@@ -29,4 +30,7 @@
- 
- riscv_libc_ifunc_redirected (__redirect_memcmp, memcmp, IFUNC_SELECTOR);
- riscv_libc_ifunc_hidden_def (__redirect_memcmp, memcmp);
-+
-+#else 
-+# include <string.h>
- #endif
-diff --git a/sysdeps/riscv/rv64/multiarch/memcmp_riscv.c b/sysdeps/riscv/rv64/multiarch/memcmp_riscv.c
-index dda15d7d35..076431132b 100644
---- a/sysdeps/riscv/rv64/multiarch/memcmp_riscv.c
-+++ b/sysdeps/riscv/rv64/multiarch/memcmp_riscv.c
-@@ -16,14 +16,19 @@
-    License along with the GNU C Library; if not, see
-    <https://www.gnu.org/licenses/>.  */
- 
--#if IS_IN (libc)
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
-+
- #undef libc_hidden_builtin_def
- #define libc_hidden_builtin_def(name)
- 
- #undef weak_alias
- #  define MEMCMP __memcmp_riscv
- # include <string/memcmp.c>
--#else
- 
-+#elif !defined __riscv_vector
- # include <string/memcmp.c>
-+
- #endif
-+
-+
-+
-diff --git a/sysdeps/riscv/rv64/multiarch/memcmp_vector.S b/sysdeps/riscv/rv64/multiarch/memcmp_vector.S
-index fe89f92268..4810af026a 100644
---- a/sysdeps/riscv/rv64/multiarch/memcmp_vector.S
-+++ b/sysdeps/riscv/rv64/multiarch/memcmp_vector.S
-@@ -20,10 +20,13 @@
- 
- /* For __riscv_vector this file defines strcmp.  */
- /* #ifndef __riscv_vector */
-+
-+#ifdef __riscv_vector 
-+#ifdef SHARED
- # define memcmp __memcmp_vector
- # undef libc_hidden_builtin_def
- # define libc_hidden_builtin_def(a)
--/* #endif */
-+#endif 
- 
- 	.p2align 6
- ENTRY (memcmp)
-@@ -54,4 +57,4 @@ ENTRY (memcmp)
- END (memcmp)
- weak_alias (memcmp, bcmp)
- libc_hidden_builtin_def (memcmp)
--
-+#endif
-diff --git a/sysdeps/riscv/rv64/multiarch/memcpy.c b/sysdeps/riscv/rv64/multiarch/memcpy.c
-index 0f20b7fd44..45cf14f52a 100644
---- a/sysdeps/riscv/rv64/multiarch/memcpy.c
-+++ b/sysdeps/riscv/rv64/multiarch/memcpy.c
-@@ -17,7 +17,8 @@
-    License along with the GNU C Library; if not, see
-    <https://www.gnu.org/licenses/>.  */
- 
--#if IS_IN (libc)
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
-+
- # define memcpy __redirect_memcpy
- # include <string.h>
- # undef memcpy
-@@ -30,4 +31,6 @@
- riscv_libc_ifunc_redirected (__redirect_memcpy, memcpy, IFUNC_SELECTOR);
- 
- riscv_libc_ifunc_hidden_def (__redirect_memcpy, memcpy);
-+#else 
-+# include <string.h>
- #endif
-diff --git a/sysdeps/riscv/rv64/multiarch/memcpy_riscv.S b/sysdeps/riscv/rv64/multiarch/memcpy_riscv.S
-index a0ba2150fc..249d4f6067 100644
---- a/sysdeps/riscv/rv64/multiarch/memcpy_riscv.S
-+++ b/sysdeps/riscv/rv64/multiarch/memcpy_riscv.S
-@@ -18,8 +18,17 @@
- 
- #include <sysdep.h>
- 
-+#if IS_IN (libc)  && defined SHARED && defined __riscv_vector
-+
- #define memcpy __memcpy_riscv
- #undef libc_hidden_builtin_def
- #define libc_hidden_builtin_def(name)
- 
--#include "memcpy_as.S"
-\ No newline at end of file
-+#include "memcpy_as.S"
-+
-+#elif !defined __riscv_vector
-+#include "memcpy_as.S"
-+
-+#endif
-+
-+
-diff --git a/sysdeps/riscv/rv64/multiarch/memcpy_vector.S b/sysdeps/riscv/rv64/multiarch/memcpy_vector.S
-index bae330f6e0..d15f4c3954 100644
---- a/sysdeps/riscv/rv64/multiarch/memcpy_vector.S
-+++ b/sysdeps/riscv/rv64/multiarch/memcpy_vector.S
-@@ -19,11 +19,12 @@
- #include <sysdep.h>
- 
- /* For __riscv_vector this file defines memcpy.  */
--/* #ifndef __riscv_vector */
-+#ifdef __riscv_vector 
-+#ifdef SHARED
- # define memcpy __memcpy_vector
- # undef libc_hidden_builtin_def
- # define libc_hidden_builtin_def(a)
--/* #endif */
-+#endif
- 
- 	.p2align 6
- ENTRY (memcpy)
-@@ -52,3 +53,4 @@ ENTRY (memcpy)
- END (memcpy)
- 
- libc_hidden_builtin_def (memcpy)
-+#endif
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/memmove.c b/sysdeps/riscv/rv64/multiarch/memmove.c
-index 8d33da166d..3fc276e943 100644
---- a/sysdeps/riscv/rv64/multiarch/memmove.c
-+++ b/sysdeps/riscv/rv64/multiarch/memmove.c
-@@ -17,7 +17,7 @@
-    License along with the GNU C Library; if not, see
-    <https://www.gnu.org/licenses/>.  */
- 
--#if IS_IN (libc)
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
- # define memmove __redirect_memmove
- # include <string.h>
- # undef memmove
-@@ -29,4 +29,7 @@
- 
- riscv_libc_ifunc_redirected (__redirect_memmove, memmove, IFUNC_SELECTOR);
- riscv_libc_ifunc_hidden_def (__redirect_memmove, memmove);
-+
-+#else 
-+# include <string.h>
- #endif
-diff --git a/sysdeps/riscv/rv64/multiarch/memmove_riscv.c b/sysdeps/riscv/rv64/multiarch/memmove_riscv.c
-index e11a9d1a43..03708e0deb 100644
---- a/sysdeps/riscv/rv64/multiarch/memmove_riscv.c
-+++ b/sysdeps/riscv/rv64/multiarch/memmove_riscv.c
-@@ -16,14 +16,16 @@
-    License along with the GNU C Library; if not, see
-    <https://www.gnu.org/licenses/>.  */
- 
--#if IS_IN (libc)
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
-+
- #undef libc_hidden_builtin_def
- #define libc_hidden_builtin_def(name)
- 
- #undef weak_alias
- #  define MEMMOVE __memmove_riscv
- # include <string/memmove.c>
--#else
-+#elif !defined __riscv_vector
- 
- # include <string/memmove.c>
- #endif
-+
-diff --git a/sysdeps/riscv/rv64/multiarch/memmove_vector.S b/sysdeps/riscv/rv64/multiarch/memmove_vector.S
-index 7bf89e6cf6..af748be5b2 100644
---- a/sysdeps/riscv/rv64/multiarch/memmove_vector.S
-+++ b/sysdeps/riscv/rv64/multiarch/memmove_vector.S
-@@ -19,11 +19,12 @@
- #include <sysdep.h>
- 
- /* For __riscv_vector this file defines memmov.  */
--/* #ifndef __riscv_vector */
-+#ifdef __riscv_vector 
-+#ifdef SHARED
- # define memmove __memmove_vector
- # undef libc_hidden_builtin_def
- # define libc_hidden_builtin_def(a)
--/* #endif */
-+#endif
- 
- 	.p2align 6
- ENTRY (memmove)
-@@ -53,4 +54,5 @@ ENTRY (memmove)
- 	bltu	zero,a2,.L_backward_copy_loop
- 	ret
- END (memmove)
--libc_hidden_builtin_def (memmove)
-\ No newline at end of file
-+libc_hidden_builtin_def (memmove)
-+#endif
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/memset.c b/sysdeps/riscv/rv64/multiarch/memset.c
-index 0d3582e49f..56d7169ad1 100644
---- a/sysdeps/riscv/rv64/multiarch/memset.c
-+++ b/sysdeps/riscv/rv64/multiarch/memset.c
-@@ -17,7 +17,7 @@
-    License along with the GNU C Library; if not, see
-    <https://www.gnu.org/licenses/>.  */
- 
--#if IS_IN (libc)
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
- # define memset __redirect_memset
- # include <string.h>
- # undef memset
-@@ -30,4 +30,7 @@
- riscv_libc_ifunc_redirected (__redirect_memset, memset, IFUNC_SELECTOR);
- 
- riscv_libc_ifunc_hidden_def (__redirect_memset, memset);
-+#else 
-+# include <string.h>
-+
- #endif
-diff --git a/sysdeps/riscv/rv64/multiarch/memset_riscv.c b/sysdeps/riscv/rv64/multiarch/memset_riscv.c
-index 1101c10f96..de631eb187 100644
---- a/sysdeps/riscv/rv64/multiarch/memset_riscv.c
-+++ b/sysdeps/riscv/rv64/multiarch/memset_riscv.c
-@@ -16,14 +16,16 @@
-    License along with the GNU C Library; if not, see
-    <https://www.gnu.org/licenses/>.  */
- 
--#if IS_IN (libc)
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
- #undef libc_hidden_builtin_def
- #define libc_hidden_builtin_def(name)
- 
- #undef weak_alias
- #  define MEMSET __memset_riscv
- # include <string/memset.c>
--#else
-+#elif !defined __riscv_vector
- 
- # include <string/memset.c>
- #endif
-+
-+
-diff --git a/sysdeps/riscv/rv64/multiarch/memset_vector.S b/sysdeps/riscv/rv64/multiarch/memset_vector.S
-index 54d04238d3..dc407630a6 100644
---- a/sysdeps/riscv/rv64/multiarch/memset_vector.S
-+++ b/sysdeps/riscv/rv64/multiarch/memset_vector.S
-@@ -19,12 +19,12 @@
- 
- #include <sysdep.h>
- 
--/* For __riscv_vector this file defines memcpy.  */
--/* #ifndef __riscv_vector */
-+#ifdef __riscv_vector 
-+#ifdef SHARED
- # define memset __memset_vector
- # undef libc_hidden_builtin_def
- # define libc_hidden_builtin_def(a)
--/* #endif */
-+#endif
- 
- 	.p2align 6
- ENTRY (memset)
-@@ -43,3 +43,4 @@ ENTRY (memset)
- 
- END (memset)
- libc_hidden_builtin_def (memset)
-+#endif
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-memcmp.c b/sysdeps/riscv/rv64/multiarch/rtld-memcmp.c
-index 25faa66478..36a22eee60 100644
---- a/sysdeps/riscv/rv64/multiarch/rtld-memcmp.c
-+++ b/sysdeps/riscv/rv64/multiarch/rtld-memcmp.c
-@@ -1 +1 @@
--#include "memcmp_riscv.c"
-+# include <string/memcmp.c>
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-memmove.c b/sysdeps/riscv/rv64/multiarch/rtld-memmove.c
-index 435c059184..90e37dbd8b 100644
---- a/sysdeps/riscv/rv64/multiarch/rtld-memmove.c
-+++ b/sysdeps/riscv/rv64/multiarch/rtld-memmove.c
-@@ -16,4 +16,4 @@
-    License along with the GNU C Library; if not, see
-    <https://www.gnu.org/licenses/>.  */
- 
--#include "memmove_riscv.c"
-+# include <string/memmove.c>
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-memset.c b/sysdeps/riscv/rv64/multiarch/rtld-memset.c
-index eff6790df5..fa3c6f4104 100644
---- a/sysdeps/riscv/rv64/multiarch/rtld-memset.c
-+++ b/sysdeps/riscv/rv64/multiarch/rtld-memset.c
-@@ -1 +1 @@
--#include "memset_riscv.c"
-\ No newline at end of file
-+# include <string/memset.c>
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-strlen.c b/sysdeps/riscv/rv64/multiarch/rtld-strlen.c
-index 73308eb0fa..d3f1dd4a23 100644
---- a/sysdeps/riscv/rv64/multiarch/rtld-strlen.c
-+++ b/sysdeps/riscv/rv64/multiarch/rtld-strlen.c
-@@ -1 +1 @@
--#include "strlen_riscv.c"
-+# include <string/strlen.c>
-diff --git a/sysdeps/riscv/rv64/multiarch/strcmp.c b/sysdeps/riscv/rv64/multiarch/strcmp.c
-index 56969c77e8..3b65aaf55d 100644
---- a/sysdeps/riscv/rv64/multiarch/strcmp.c
-+++ b/sysdeps/riscv/rv64/multiarch/strcmp.c
-@@ -17,7 +17,7 @@
-    License along with the GNU C Library; if not, see
-    <https://www.gnu.org/licenses/>.  */
- 
--#if IS_IN (libc)
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
- # define strcmp __redirect_strcmp
- # include <string.h>
- # undef strcmp
-@@ -30,4 +30,7 @@
- riscv_libc_ifunc_redirected (__redirect_strcmp, strcmp, IFUNC_SELECTOR);
- 
- riscv_libc_ifunc_hidden_def (__redirect_strcmp, strcmp);
-+#else 
-+# include <string.h>
-+
- #endif
-diff --git a/sysdeps/riscv/rv64/multiarch/strcmp_riscv.S b/sysdeps/riscv/rv64/multiarch/strcmp_riscv.S
-index 93e598f0c5..f5be83d5b7 100644
---- a/sysdeps/riscv/rv64/multiarch/strcmp_riscv.S
-+++ b/sysdeps/riscv/rv64/multiarch/strcmp_riscv.S
-@@ -1,9 +1,13 @@
- 
--/* For __riscv_vector this file defines strcmp.  */
--/* #ifndef __riscv_vector */
-+#include <sysdep.h>
-+
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
- # define strcmp __strcmp_riscv
- # undef libc_hidden_builtin_def
- # define libc_hidden_builtin_def(a)
--/* #endif */
- 
--#include "strcmp_.S"
-\ No newline at end of file
-+#include "strcmp_.S"
-+#elif !defined __riscv_vector
-+
-+#include "strcmp_.S"
-+#endif
-diff --git a/sysdeps/riscv/rv64/multiarch/strcmp_vector.S b/sysdeps/riscv/rv64/multiarch/strcmp_vector.S
-index 41d653748a..d0b8e316f9 100644
---- a/sysdeps/riscv/rv64/multiarch/strcmp_vector.S
-+++ b/sysdeps/riscv/rv64/multiarch/strcmp_vector.S
-@@ -19,11 +19,12 @@
- #include <sysdep.h>
- 
- /* For __riscv_vector this file defines strcmp.  */
--/* #ifndef __riscv_vector */
-+#ifdef __riscv_vector 
-+#ifdef SHARED
- # define strcmp __strcmp_vector
- # undef libc_hidden_builtin_def
- # define libc_hidden_builtin_def(a)
--/* #endif */
-+#endif 
- 
- 	.p2align 6
- ENTRY (strcmp)
-@@ -51,4 +52,4 @@ ENTRY (strcmp)
- 
- END (strcmp)
- libc_hidden_builtin_def (strcmp)
--
-+#endif
-diff --git a/sysdeps/riscv/rv64/multiarch/strlen.c b/sysdeps/riscv/rv64/multiarch/strlen.c
-index 292c9103fa..8fab570609 100644
---- a/sysdeps/riscv/rv64/multiarch/strlen.c
-+++ b/sysdeps/riscv/rv64/multiarch/strlen.c
-@@ -17,7 +17,7 @@
-    License along with the GNU C Library; if not, see
-    <https://www.gnu.org/licenses/>.  */
- 
--#if IS_IN (libc)
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
- # define strlen __redirect_strlen
- # include <string.h>
- # undef strlen
-@@ -29,4 +29,7 @@
- 
- riscv_libc_ifunc_redirected (__redirect_strlen, strlen, IFUNC_SELECTOR);
- riscv_libc_ifunc_hidden_def (__redirect_strlen, strlen);
-+#else 
-+# include <string.h>
-+
- #endif
-diff --git a/sysdeps/riscv/rv64/multiarch/strlen_riscv.c b/sysdeps/riscv/rv64/multiarch/strlen_riscv.c
-index e17a5dde31..d605941766 100644
---- a/sysdeps/riscv/rv64/multiarch/strlen_riscv.c
-+++ b/sysdeps/riscv/rv64/multiarch/strlen_riscv.c
-@@ -16,14 +16,17 @@
-    License along with the GNU C Library; if not, see
-    <https://www.gnu.org/licenses/>.  */
- 
--#if IS_IN (libc)
-+
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
- #undef libc_hidden_builtin_def
- #define libc_hidden_builtin_def(name)
- 
- #undef weak_alias
- #  define STRLEN __strlen_riscv
- # include <string/strlen.c>
--#else
-+#elif !defined __riscv_vector
- 
- # include <string/strlen.c>
- #endif
-+
-+
-diff --git a/sysdeps/riscv/rv64/multiarch/strlen_vector.S b/sysdeps/riscv/rv64/multiarch/strlen_vector.S
-index dd080e3a2f..f674de3a26 100644
---- a/sysdeps/riscv/rv64/multiarch/strlen_vector.S
-+++ b/sysdeps/riscv/rv64/multiarch/strlen_vector.S
-@@ -19,11 +19,12 @@
- #include <sysdep.h>
- 
- /* For __riscv_vector this file defines strlen.  */
--/* #ifndef __riscv_vector */
-+#ifdef __riscv_vector 
-+#ifdef SHARED
- # define strlen __strlen_vector
- # undef libc_hidden_builtin_def
- # define libc_hidden_builtin_def(a)
--/* #endif */
-+#endif
- 
- 	.p2align 6
- ENTRY (strlen)
-@@ -44,3 +45,4 @@ ENTRY (strlen)
- 
- END (strlen)
- libc_hidden_builtin_def (strlen)
-+#endif
-\ No newline at end of file
--- 
-2.25.1
-

+ 0 - 25
recipes-core/glibc/glibc/0009-resolve-__memcmpeq-aliased-to-undefined-symbol-memcm.patch

@@ -1,25 +0,0 @@
-From 5d6ab9fef7281483da3e9c306b56413c40165ef1 Mon Sep 17 00:00:00 2001
-From: "max.ma" <max.ma@starfivetech.com>
-Date: Tue, 6 Sep 2022 20:01:36 -0700
-Subject: [PATCH 09/19] resolve '__memcmpeq' aliased to undefined symbol
- 'memcmp' issue
-
-cx
----
- string/memcmp.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/string/memcmp.c b/string/memcmp.c
-index 40029474e6..b275e5fbff 100644
---- a/string/memcmp.c
-+++ b/string/memcmp.c
-@@ -361,5 +361,5 @@ weak_alias (memcmp, bcmp)
- #endif
- 
- #undef __memcmpeq
--strong_alias (memcmp, __memcmpeq)
-+strong_alias (MEMCMP, __memcmpeq)
- libc_hidden_def(__memcmpeq)
--- 
-2.25.1
-

+ 43 - 43
recipes-core/glibc/glibc/0009-yes-within-the-path-sets-wrong-config-variables.patch

@@ -1,4 +1,4 @@
-From 07655aaa14f9d1f3a521caadde2936067ce84b07 Mon Sep 17 00:00:00 2001
+From 70e721856c3ebf6ae0ea84b828396bd2af090acf Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:31:06 +0000
 Subject: [PATCH] 'yes' within the path sets wrong config variables
@@ -29,10 +29,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  12 files changed, 28 insertions(+), 28 deletions(-)
 
 diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure
-index bf972122b1..f9397b8d6e 100644
+index ca57edce47..5e91fab023 100644
 --- a/sysdeps/aarch64/configure
 +++ b/sysdeps/aarch64/configure
-@@ -152,12 +152,12 @@ else
+@@ -165,12 +165,12 @@ else $as_nop
    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  /* end confdefs.h.  */
  #ifdef __AARCH64EB__
@@ -42,13 +42,13 @@ index bf972122b1..f9397b8d6e 100644
  
  _ACEOF
  if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
--  $EGREP "yes" >/dev/null 2>&1; then :
-+  $EGREP "is_aarch64_be" >/dev/null 2>&1; then :
+-  $EGREP "yes" >/dev/null 2>&1
++  $EGREP "is_aarch64_be" >/dev/null 2>&1
+ then :
    libc_cv_aarch64_be=yes
- else
-   libc_cv_aarch64_be=no
+ else $as_nop
 diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac
-index 51253d9802..ba36a0e8b4 100644
+index 27874eceb4..8a708f2ef4 100644
 --- a/sysdeps/aarch64/configure.ac
 +++ b/sysdeps/aarch64/configure.ac
 @@ -13,8 +13,8 @@ AC_DEFINE(SUPPORT_STATIC_PIE)
@@ -63,10 +63,10 @@ index 51253d9802..ba36a0e8b4 100644
    ], libc_cv_aarch64_be=yes, libc_cv_aarch64_be=no)])
  if test $libc_cv_aarch64_be = yes; then
 diff --git a/sysdeps/arm/configure b/sysdeps/arm/configure
-index 5b0237e521..969fc9fe95 100644
+index 35e2918922..94d7fbe8bb 100644
 --- a/sysdeps/arm/configure
 +++ b/sysdeps/arm/configure
-@@ -148,12 +148,12 @@ else
+@@ -161,12 +161,12 @@ else $as_nop
    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  /* end confdefs.h.  */
  #ifdef __ARM_PCS_VFP
@@ -76,11 +76,11 @@ index 5b0237e521..969fc9fe95 100644
  
  _ACEOF
  if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
--  $EGREP "yes" >/dev/null 2>&1; then :
-+  $EGREP "use_arm_pcs_vfp" >/dev/null 2>&1; then :
+-  $EGREP "yes" >/dev/null 2>&1
++  $EGREP "use_arm_pcs_vfp" >/dev/null 2>&1
+ then :
    libc_cv_arm_pcs_vfp=yes
- else
-   libc_cv_arm_pcs_vfp=no
+ else $as_nop
 diff --git a/sysdeps/arm/configure.ac b/sysdeps/arm/configure.ac
 index 5172e30bbe..f06dedd7c5 100644
 --- a/sysdeps/arm/configure.ac
@@ -97,10 +97,10 @@ index 5172e30bbe..f06dedd7c5 100644
    ], libc_cv_arm_pcs_vfp=yes, libc_cv_arm_pcs_vfp=no)])
  if test $libc_cv_arm_pcs_vfp = yes; then
 diff --git a/sysdeps/mips/configure b/sysdeps/mips/configure
-index 3f4d9e9759..888453c70b 100644
+index 1e8c6711e6..ae52ccd929 100644
 --- a/sysdeps/mips/configure
 +++ b/sysdeps/mips/configure
-@@ -145,11 +145,11 @@ else
+@@ -158,11 +158,11 @@ else $as_nop
  /* end confdefs.h.  */
  dnl
  #ifdef __mips_nan2008
@@ -109,11 +109,11 @@ index 3f4d9e9759..888453c70b 100644
  #endif
  _ACEOF
  if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
--  $EGREP "yes" >/dev/null 2>&1; then :
-+  $EGREP "use_mips_nan2008" >/dev/null 2>&1; then :
+-  $EGREP "yes" >/dev/null 2>&1
++  $EGREP "use_mips_nan2008" >/dev/null 2>&1
+ then :
    libc_cv_mips_nan2008=yes
- else
-   libc_cv_mips_nan2008=no
+ else $as_nop
 diff --git a/sysdeps/mips/configure.ac b/sysdeps/mips/configure.ac
 index d3cd780d78..250223d206 100644
 --- a/sysdeps/mips/configure.ac
@@ -131,10 +131,10 @@ index d3cd780d78..250223d206 100644
  if test x$libc_cv_mips_nan2008 = xyes; then
    AC_DEFINE(HAVE_MIPS_NAN2008)
 diff --git a/sysdeps/nios2/configure b/sysdeps/nios2/configure
-index b3cd28349e..f47e5a5adc 100644
+index 2fb230cbaa..1959d0a444 100644
 --- a/sysdeps/nios2/configure
 +++ b/sysdeps/nios2/configure
-@@ -142,12 +142,12 @@ else
+@@ -155,12 +155,12 @@ else $as_nop
    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  /* end confdefs.h.  */
  #ifdef __nios2_big_endian__
@@ -144,11 +144,11 @@ index b3cd28349e..f47e5a5adc 100644
  
  _ACEOF
  if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
--  $EGREP "yes" >/dev/null 2>&1; then :
-+  $EGREP "is_nios2_be" >/dev/null 2>&1; then :
+-  $EGREP "yes" >/dev/null 2>&1
++  $EGREP "is_nios2_be" >/dev/null 2>&1
+ then :
    libc_cv_nios2_be=yes
- else
-   libc_cv_nios2_be=no
+ else $as_nop
 diff --git a/sysdeps/nios2/configure.ac b/sysdeps/nios2/configure.ac
 index f738e9a7ed..4085851cbc 100644
 --- a/sysdeps/nios2/configure.ac
@@ -165,10 +165,10 @@ index f738e9a7ed..4085851cbc 100644
    ], libc_cv_nios2_be=yes, libc_cv_nios2_be=no)])
  if test $libc_cv_nios2_be = yes; then
 diff --git a/sysdeps/unix/sysv/linux/mips/configure b/sysdeps/unix/sysv/linux/mips/configure
-index f25f2a3a65..1b7483e6c6 100644
+index a060901de4..0ac7019438 100644
 --- a/sysdeps/unix/sysv/linux/mips/configure
 +++ b/sysdeps/unix/sysv/linux/mips/configure
-@@ -414,11 +414,11 @@ else
+@@ -441,11 +441,11 @@ else $as_nop
  /* end confdefs.h.  */
  dnl
  #ifdef __mips_nan2008
@@ -177,11 +177,11 @@ index f25f2a3a65..1b7483e6c6 100644
  #endif
  _ACEOF
  if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
--  $EGREP "yes" >/dev/null 2>&1; then :
-+  $EGREP "use_mips_nan2008" >/dev/null 2>&1; then :
+-  $EGREP "yes" >/dev/null 2>&1
++  $EGREP "use_mips_nan2008" >/dev/null 2>&1
+ then :
    libc_cv_mips_nan2008=yes
- else
-   libc_cv_mips_nan2008=no
+ else $as_nop
 diff --git a/sysdeps/unix/sysv/linux/mips/configure.ac b/sysdeps/unix/sysv/linux/mips/configure.ac
 index 049a0f4bdf..005526d4e8 100644
 --- a/sysdeps/unix/sysv/linux/mips/configure.ac
@@ -199,10 +199,10 @@ index 049a0f4bdf..005526d4e8 100644
  
  libc_mips_nan=
 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure
-index ae7f254da4..874519000b 100644
+index cf1b70c745..0dccf6cd76 100644
 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure
 +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure
-@@ -155,12 +155,12 @@ else
+@@ -168,12 +168,12 @@ else $as_nop
    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  /* end confdefs.h.  */
  #if _CALL_ELF == 2
@@ -212,12 +212,12 @@ index ae7f254da4..874519000b 100644
  
  _ACEOF
  if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
--  $EGREP "yes" >/dev/null 2>&1; then :
-+  $EGREP "use_ppc_elfv2_abi" >/dev/null 2>&1; then :
+-  $EGREP "yes" >/dev/null 2>&1
++  $EGREP "use_ppc_elfv2_abi" >/dev/null 2>&1
+ then :
    libc_cv_ppc64_elfv2_abi=yes
- else
-   libc_cv_ppc64_elfv2_abi=no
-@@ -188,12 +188,12 @@ else
+ else $as_nop
+@@ -203,12 +203,12 @@ else $as_nop
    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  /* end confdefs.h.  */
  #ifdef _CALL_ELF
@@ -227,11 +227,11 @@ index ae7f254da4..874519000b 100644
  
  _ACEOF
  if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
--  $EGREP "yes" >/dev/null 2>&1; then :
-+  $EGREP "is_def_call_elf" >/dev/null 2>&1; then :
+-  $EGREP "yes" >/dev/null 2>&1
++  $EGREP "is_def_call_elf" >/dev/null 2>&1
+ then :
    libc_cv_ppc64_def_call_elf=yes
- else
-   libc_cv_ppc64_def_call_elf=no
+ else $as_nop
 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac
 index f9cba6e15d..b21f72f1e4 100644
 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac

+ 1 - 1
recipes-core/glibc/glibc/0010-eglibc-Cross-building-and-testing-instructions.patch

@@ -1,4 +1,4 @@
-From 9373891f13f3550f9b3f896c34ac152efd369ca9 Mon Sep 17 00:00:00 2001
+From 9625e90bdf35774c71f1e566e73d435e38c04171 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:42:58 +0000
 Subject: [PATCH] eglibc: Cross building and testing instructions

+ 0 - 1382
recipes-core/glibc/glibc/0010-merge-demin-s-mem_xxx-optimization.patch

@@ -1,1382 +0,0 @@
-From 87fc954b961c326c9630df55201320b0d32f66f9 Mon Sep 17 00:00:00 2001
-From: "max.ma" <max.ma@starfivetech.com>
-Date: Tue, 13 Sep 2022 01:06:07 -0700
-Subject: [PATCH 10/19] merge demin's mem_xxx optimization
-
----
- sysdeps/riscv/rv64/multiarch/Makefile         |   2 +-
- sysdeps/riscv/rv64/multiarch/memchr_as.S      | 150 ++++++++------
- sysdeps/riscv/rv64/multiarch/memchr_riscv.S   |   6 +-
- sysdeps/riscv/rv64/multiarch/memchr_vector.S  |   6 +-
- sysdeps/riscv/rv64/multiarch/memcmp.c         |   2 +
- sysdeps/riscv/rv64/multiarch/memcmp_as.S      | 150 ++++++++++++++
- .../{memcmp_riscv.c => memcmp_riscv.S}        |   8 +-
- sysdeps/riscv/rv64/multiarch/memcmp_vector.S  |   7 +-
- sysdeps/riscv/rv64/multiarch/memcpy.c         |   1 +
- sysdeps/riscv/rv64/multiarch/memcpy_as.S      | 196 ++++++++++--------
- sysdeps/riscv/rv64/multiarch/memcpy_riscv.S   |   2 +-
- sysdeps/riscv/rv64/multiarch/memcpy_vector.S  |   5 +-
- sysdeps/riscv/rv64/multiarch/memmove_as.S     | 168 +++++++++++++++
- .../{memmove_riscv.c => memmove_riscv.S}      |   9 +-
- sysdeps/riscv/rv64/multiarch/memmove_vector.S |   6 +-
- sysdeps/riscv/rv64/multiarch/memrchr.S        | 123 +++++++++++
- sysdeps/riscv/rv64/multiarch/memset_as.S      | 123 +++++++++++
- .../{memset_riscv.c => memset_riscv.S}        |   8 +-
- sysdeps/riscv/rv64/multiarch/memset_vector.S  |   6 +-
- .../{rtld-memmove.c => rtld-memmove.S}        |   3 +-
- sysdeps/riscv/rv64/multiarch/rtld-memrchr.S   |   1 +
- sysdeps/riscv/rv64/multiarch/rtld-strcmp.S    |   2 +-
- .../rv64/multiarch/{strcmp_.S => strcmp_as.S} |   0
- sysdeps/riscv/rv64/multiarch/strcmp_riscv.S   |   6 +-
- sysdeps/riscv/rv64/multiarch/strcmp_vector.S  |   6 +-
- sysdeps/riscv/rv64/multiarch/strlen_riscv.c   |   2 +-
- sysdeps/riscv/rv64/multiarch/strlen_vector.S  |   6 +-
- 27 files changed, 799 insertions(+), 205 deletions(-)
- create mode 100644 sysdeps/riscv/rv64/multiarch/memcmp_as.S
- rename sysdeps/riscv/rv64/multiarch/{memcmp_riscv.c => memcmp_riscv.S} (89%)
- create mode 100644 sysdeps/riscv/rv64/multiarch/memmove_as.S
- rename sysdeps/riscv/rv64/multiarch/{memmove_riscv.c => memmove_riscv.S} (88%)
- create mode 100644 sysdeps/riscv/rv64/multiarch/memrchr.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/memset_as.S
- rename sysdeps/riscv/rv64/multiarch/{memset_riscv.c => memset_riscv.S} (89%)
- rename sysdeps/riscv/rv64/multiarch/{rtld-memmove.c => rtld-memmove.S} (93%)
- create mode 100644 sysdeps/riscv/rv64/multiarch/rtld-memrchr.S
- rename sysdeps/riscv/rv64/multiarch/{strcmp_.S => strcmp_as.S} (100%)
-
-diff --git a/sysdeps/riscv/rv64/multiarch/Makefile b/sysdeps/riscv/rv64/multiarch/Makefile
-index 3349bf4888..7e8bfde544 100644
---- a/sysdeps/riscv/rv64/multiarch/Makefile
-+++ b/sysdeps/riscv/rv64/multiarch/Makefile
-@@ -1,5 +1,5 @@
- ifeq ($(subdir),string)
- sysdep_routines += memcpy_vector memcpy_riscv memchr_riscv memchr_vector memcmp_riscv \
-                  memcmp_vector strcmp_riscv strcmp_vector strlen_riscv strlen_vector \
--                 memmove_vector memmove_riscv memset_vector memset_riscv
-+                 memmove_vector memmove_riscv memset_vector memset_riscv memrchr
- endif
-diff --git a/sysdeps/riscv/rv64/multiarch/memchr_as.S b/sysdeps/riscv/rv64/multiarch/memchr_as.S
-index b8691744f3..e614630a4d 100644
---- a/sysdeps/riscv/rv64/multiarch/memchr_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/memchr_as.S
-@@ -19,72 +19,90 @@
- 
- #include <sysdep.h>
- 
--	.p2align 6
--
--ENTRY (memchr)
--   zext.b	a3,a1
--   beqz	a2, .L_not_found
--   andi	a5,a0,7
--.L_not_aligned:      
--   beqz	a5,.L_aligned_8byte
--   lbu	a5,0(a0)
--   addi	a2,a2,-1
--   beq	a5,a3,.L_found
--   addi	a0,a0,1
--   andi	a5,a0,7
--   bnez	a2,.L_not_aligned
--
--.L_not_found:
--   li	a0,0
--.L_found:   
--   ret
-+.macro chr_8B
-+    ld      a4, 0(a0)
-+    xor     a4, a4, a1
-+    sub     a3, a4, t1
-+    andn    a3, a3, a4
-+    and     a3, a3, a5
-+    bnez    a3, .L_find
-+.endm
-+.macro gen_pat
-+    slli    a3, a1, 8
-+    or      a1, a1, a3
-+    slli    a3, a1, 16
-+    or      a1, a1, a3
-+    slli    a3, a1, 32
-+    or      a1, a1, a3
- 
--.L_aligned_8byte:
--   zext.b	a1,a1
--   slli	a5,a1,0x8
--   or	a1,a1,a5
--   slli	a5,a1,0x10
--   or	a5,a5,a1
--   slli	a1,a5,0x20
--   li	a4,7
--   or	a1,a1,a5
--   bgeu	a4,a2,.L_less_8bytes
-+    li      a5, 0x80
-+    slli    a3, a5, 8
-+    or      a5, a5, a3
-+    slli    a3, a5, 16
-+    or      a5, a5, a3
-+    slli    a3, a5, 32
-+    or      a5, a5, a3  # 0x8080808080808080
-+    srli    t1, a5, 7   # 0x0101010101010101
-+.endm
- 
--   ld    a7, mask1   
--   ld    a6, mask2
--   
--   li	t1,7
--   j	.L_8byte_compare_loop
--.L_8byte_compare:
--   addi	a2,a2,-8
--   addi	a0,a0,8
--   bgeu	t1,a2,.L_8byte_compare_exit
--.L_8byte_compare_loop:   
--   ld	a5,0(a0)
--   xor	a5,a5,a1
--   add	a4,a5,a7
--   not	a5,a5
--   and	a5,a5,a4
--   and	a5,a5,a6
--   beqz	a5,.L_8byte_compare
--
--.L_less_8bytes:
--   add	a2,a2,a0
--   j	.L_less_8bytes_compare
--.L_less_8bytes_loop:   
--   addi	a0,a0,1
--   beq	a2,a0,.L_not_found
--.L_less_8bytes_compare:   
--   lbu	a5,0(a0)
--   bne	a5,a3,.L_less_8bytes_loop
--   ret
--.L_8byte_compare_exit:
--   bnez	a2,.L_less_8bytes
--   j	.L_not_found
--  .align 3
--mask1:
--  .dword 0xfefefefefefefeff
--mask2:
--  .dword 0x8080808080808080
-+	.p2align 6
-+ENTRY (memchr)
-+    li      a3, 7
-+    bgtu    a2, a3, .L_8_to_16
-+.L_0_to_7:
-+    beqz    a2, 1f
-+0:
-+    lbu     a4, 0(a0)
-+    beq     a1, a4, 2f
-+    addi    a2, a2, -1
-+    addi    a0, a0, 1
-+    bnez    a2, 0b
-+1:
-+    li      a0, 0
-+    ret
-+2:
-+    ret
-+.L_8_to_16:
-+    gen_pat
-+    li      a3, 16
-+    bgtu    a2, a3, .L_over_16
-+    addi    a2, a2, -8
-+    chr_8B
-+    add     a0, a0, a2
-+    chr_8B
-+    j       .L_not_find
-+.L_over_16:
-+    neg     t4, a0
-+    andi    t4, t4, 0x7
-+    beqz    t4, .L_dst_aligned
-+    chr_8B
-+    sub     a2, a2, t4
-+    add     a0, a0, t4
-+.L_dst_aligned:
-+    andi    t0, a2, (16-1)
-+    srli    a2, a2, 4
-+    beqz    a2, .L_tail
-+.L_loop:
-+    chr_8B
-+    add     a0, a0, 8
-+    chr_8B
-+    addi    a2, a2, -1
-+    add     a0, a0, 8
-+    bnez    a2, .L_loop
-+    beqz    t0, .L_not_find
-+.L_tail:
-+    add     a0, a0, t0
-+    addi    a0, a0, -16
-+    chr_8B
-+    add     a0, a0, 8
-+    chr_8B
-+.L_not_find:
-+    li      a0, 0
-+    ret
-+.L_find:
-+    ctz     a3, a3
-+    srli    a3, a3, 3
-+    add     a0, a0, a3
-+    ret
- END (memchr)
--libc_hidden_builtin_def (memchr)
-+libc_hidden_builtin_def (memchr)
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/memchr_riscv.S b/sysdeps/riscv/rv64/multiarch/memchr_riscv.S
-index ee4394fef9..84b3375f31 100644
---- a/sysdeps/riscv/rv64/multiarch/memchr_riscv.S
-+++ b/sysdeps/riscv/rv64/multiarch/memchr_riscv.S
-@@ -26,8 +26,10 @@
- #include "memchr_as.S"
- 
- 
--#elif !defined __riscv_vector
-+#else
- 
- #include "memchr_as.S"
- 
--#endif
-\ No newline at end of file
-+#endif
-+
-+
-diff --git a/sysdeps/riscv/rv64/multiarch/memchr_vector.S b/sysdeps/riscv/rv64/multiarch/memchr_vector.S
-index 9441ddb489..87a464f38f 100644
---- a/sysdeps/riscv/rv64/multiarch/memchr_vector.S
-+++ b/sysdeps/riscv/rv64/multiarch/memchr_vector.S
-@@ -19,12 +19,10 @@
- #include <sysdep.h>
- 
- /* For __riscv_vector this file defines memchr.  */
--#ifdef __riscv_vector 
--#ifdef SHARED
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
- # define memchr __memchr_vector
- # undef libc_hidden_builtin_def
- # define libc_hidden_builtin_def(a)
--#endif
- 
- 	.p2align 6
- ENTRY (memchr)
-@@ -51,5 +49,5 @@ ENTRY (memchr)
-    add	a0,zero,zero
-    ret
- END (memchr)
--libc_hidden_builtin_def (memchr)
-+
- #endif
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/memcmp.c b/sysdeps/riscv/rv64/multiarch/memcmp.c
-index 3dab42ea74..a67159346a 100644
---- a/sysdeps/riscv/rv64/multiarch/memcmp.c
-+++ b/sysdeps/riscv/rv64/multiarch/memcmp.c
-@@ -34,3 +34,5 @@ riscv_libc_ifunc_hidden_def (__redirect_memcmp, memcmp);
- #else 
- # include <string.h>
- #endif
-+
-+
-diff --git a/sysdeps/riscv/rv64/multiarch/memcmp_as.S b/sysdeps/riscv/rv64/multiarch/memcmp_as.S
-new file mode 100644
-index 0000000000..a737172980
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memcmp_as.S
-@@ -0,0 +1,150 @@
-+/* The assembly function for memcmp.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+	.p2align 6
-+ENTRY (memcmp)
-+    li      a3, 32
-+    mv      a5, a0
-+    bgtu    a2, a3, .L_over_32
-+    li      a3, 3
-+    bgtu    a2, a3, .L_4_to_8
-+.L_0_to_3:
-+    beqz    a2, 2f
-+0:
-+    lbu     a3, 0(a1)
-+    lbu     a4, 0(a5)
-+    bne     a3, a4, 1f
-+    addi    a2, a2, -1
-+    addi    a1, a1, 1
-+    addi    a5, a5, 1
-+    bnez    a2, 0b
-+1:
-+    sub     a0, a4, a3
-+    ret
-+2:
-+    li      a0, 0
-+    ret
-+.L_4_to_8:
-+    li      a3, 8
-+    bgtu    a2, a3, .L_9_to_16
-+    lwu     a3, 0(a1)
-+    lwu     a0, 0(a5)
-+    bne     a3, a0, .L_end
-+    add     a1, a1, a2
-+    add     a5, a5, a2
-+    lwu     a3, -4(a1)
-+    lwu     a0, -4(a5)
-+    j       .L_end
-+.L_9_to_16:
-+    li      a3, 16
-+    bgtu    a2, a3, .L_17_to_32
-+    addi    a2, a2, -8
-+    ld      a3, 0(a1)
-+    ld      a0, 0(a5)
-+    bne     a3, a0, .L_end
-+    add     a1, a1, a2
-+    add     a5, a5, a2
-+    ld      a3, 0(a1)
-+    ld      a0, 0(a5)
-+    j       .L_end
-+.L_17_to_32:
-+    addi    a2, a2, -16
-+    ld      a3, 0(a1)
-+    ld      a0, 0(a5)
-+    bne     a3, a0, .L_end
-+    ld      a3, 8(a1)
-+    ld      a0, 8(a5)
-+    bne     a3, a0, .L_end
-+    add     a1, a1, a2
-+    add     a5, a5, a2
-+    ld      a3, 0(a1)
-+    ld      a0, 0(a5)
-+    bne     a3, a0, .L_end
-+    ld      a3, 8(a1)
-+    ld      a0, 8(a5)
-+    j       .L_end
-+.L_over_32:
-+    neg     a4, a5
-+    andi    a4, a4, 0x7
-+    beqz    a4, .L_dst_aligned
-+    ld      a3, 0(a1)
-+    ld      a0, 0(a5)
-+    bne     a3, a0, .L_end
-+    sub     a2, a2, a4
-+    add     a5, a5, a4
-+    add     a1, a1, a4
-+.L_dst_aligned:
-+    andi    a4, a2, -32
-+    andi    a2, a2, (32-1)
-+    beqz    a4, .L_tail
-+    add     a4, a4, a5
-+.L_loop:
-+    ld      a3, 0(a1)
-+    ld      a0, 0(a5)
-+    bne     a3, a0, .L_end
-+    ld      a3, 8(a1)
-+    ld      a0, 8(a5)
-+    bne     a3, a0, .L_end
-+    ld      a3, 16(a1)
-+    ld      a0, 16(a5)
-+    bne     a3, a0, .L_end
-+    ld      a3, 24(a1)
-+    ld      a0, 24(a5)
-+    bne     a3, a0, .L_end
-+    addi    a5, a5, 32
-+    addi    a1, a1, 32
-+    bltu    a5, a4, .L_loop
-+    beqz    a2, .L_end
-+.L_tail:
-+    andi    a4, a2, -1
-+.L_pc:
-+    auipc   a3, 0
-+    andi    a4, a4, -8
-+    sub     a3, a3, a4
-+    .equ    offset, .L_jmp_end - .L_pc
-+    jalr    x0, a3, %lo(offset)
-+    ld      a3, 16(a1)
-+    ld      a0, 16(a5)
-+    bne     a3, a0, .L_end
-+    ld      a3, 8(a1)
-+    ld      a0, 8(a5)
-+    bne     a3, a0, .L_end
-+    ld      a3, 0(a1)
-+    ld      a0, 0(a5)
-+    bne     a3, a0, .L_end
-+.L_jmp_end:
-+    add     a1, a1, a2
-+    add     a5, a5, a2
-+    ld      a3, -8(a1)
-+    ld      a0, -8(a5)
-+.L_end:
-+    bltu    a0, a3, 2f
-+    beq     a0, a3, 3f
-+    li      a0, 1
-+    ret
-+2:
-+    li      a0, -1
-+    ret
-+3:
-+    li      a0, 0
-+    ret
-+END (memcmp)
-+
-+libc_hidden_builtin_def (memcmp)
-diff --git a/sysdeps/riscv/rv64/multiarch/memcmp_riscv.c b/sysdeps/riscv/rv64/multiarch/memcmp_riscv.S
-similarity index 89%
-rename from sysdeps/riscv/rv64/multiarch/memcmp_riscv.c
-rename to sysdeps/riscv/rv64/multiarch/memcmp_riscv.S
-index 076431132b..32df79f769 100644
---- a/sysdeps/riscv/rv64/multiarch/memcmp_riscv.c
-+++ b/sysdeps/riscv/rv64/multiarch/memcmp_riscv.S
-@@ -22,11 +22,11 @@
- #define libc_hidden_builtin_def(name)
- 
- #undef weak_alias
--#  define MEMCMP __memcmp_riscv
--# include <string/memcmp.c>
-+#  define memcmp __memcmp_riscv
-+# include "memcmp_as.S"
- 
--#elif !defined __riscv_vector
--# include <string/memcmp.c>
-+#else
-+# include "memcmp_as.S"
- 
- #endif
- 
-diff --git a/sysdeps/riscv/rv64/multiarch/memcmp_vector.S b/sysdeps/riscv/rv64/multiarch/memcmp_vector.S
-index 4810af026a..89d8a7e08f 100644
---- a/sysdeps/riscv/rv64/multiarch/memcmp_vector.S
-+++ b/sysdeps/riscv/rv64/multiarch/memcmp_vector.S
-@@ -21,12 +21,10 @@
- /* For __riscv_vector this file defines strcmp.  */
- /* #ifndef __riscv_vector */
- 
--#ifdef __riscv_vector 
--#ifdef SHARED
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
- # define memcmp __memcmp_vector
- # undef libc_hidden_builtin_def
- # define libc_hidden_builtin_def(a)
--#endif 
- 
- 	.p2align 6
- ENTRY (memcmp)
-@@ -55,6 +53,5 @@ ENTRY (memcmp)
-    add	a0,zero,zero
-    ret
- END (memcmp)
--weak_alias (memcmp, bcmp)
--libc_hidden_builtin_def (memcmp)
-+
- #endif
-diff --git a/sysdeps/riscv/rv64/multiarch/memcpy.c b/sysdeps/riscv/rv64/multiarch/memcpy.c
-index 45cf14f52a..4fa4cccd9d 100644
---- a/sysdeps/riscv/rv64/multiarch/memcpy.c
-+++ b/sysdeps/riscv/rv64/multiarch/memcpy.c
-@@ -34,3 +34,4 @@ riscv_libc_ifunc_hidden_def (__redirect_memcpy, memcpy);
- #else 
- # include <string.h>
- #endif
-+
-diff --git a/sysdeps/riscv/rv64/multiarch/memcpy_as.S b/sysdeps/riscv/rv64/multiarch/memcpy_as.S
-index f0a074df13..4a97d75545 100644
---- a/sysdeps/riscv/rv64/multiarch/memcpy_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/memcpy_as.S
-@@ -19,96 +19,116 @@
- #include <sysdep.h>
- 
- 
--#  define LABLE_ALIGN   \
--        .balignl 16, 0x00000013
-+.macro copy_32B d, s
-+    ld      a3, 0(\s)
-+    sd      a3, 0(\d)
-+    ld      a3, 8(\s)
-+    sd      a3, 8(\d)
-+    ld      a3, 16(\s)
-+    sd      a3, 16(\d)
-+    ld      a3, 24(\s)
-+    sd      a3, 24(\d)
-+.endm
- 
-+    .p2align 6
- ENTRY (memcpy)
--
--        /* Test if len less than 8 bytes.  */
--        mv      t6, a0
--        sltiu   a3, a2, 8
--        li     t3, 1
--        bnez    a3, .L_copy_by_byte
--
--        andi    a3, a0, 7
--        li     t5, 8
--	/* Test if dest is not 8 bytes aligned.  */
--        bnez    a3, .L_dest_not_aligned
--.L_dest_aligned:
--        /* If dest is aligned, then copy.  */
--        srli    t4, a2, 6
--        /* Test if len less than 32 bytes.  */
--        beqz     t4, .L_len_less_16bytes
--	andi    a2, a2, 63
--
--.L_len_larger_16bytes:
--        ld      a4, 0(a1)
--        sd      a4, 0(a0)
--        ld      a5, 8(a1)
--        sd      a5, 8(a0)
--        ld      a6, 16(a1)
--        sd      a6, 16(a0)
--        ld      a7, 24(a1)
--        sd      a7, 24(a0)
--        ld      a4, 32(a1)
--        sd      a4, 32(a0)
--        ld      a5, 40(a1)
--        sd      a5, 40(a0)
--        ld      a6, 48(a1)
--        sd      a6, 48(a0)
--        ld      a7, 56(a1)
--        sub     t4, t4, t3
--        addi    a1, a1, 64
--        sd      a7, 56(a0)
--        addi    a0, a0, 64
--	bnez	t4, .L_len_larger_16bytes
--
--.L_len_less_16bytes:
--	srli    t4, a2, 2
--        beqz     t4, .L_copy_by_byte
--        andi    a2, a2, 3
--.L_len_less_16bytes_loop:
--        lw      a4, 0(a1)
--	sub	t4, t4, t3
--        addi    a1, a1, 4
--        sw      a4, 0(a0)
--        addi    a0, a0, 4
--	bnez    t4, .L_len_less_16bytes_loop
--
--        /* Copy tail.  */
--.L_copy_by_byte:
--        andi    t4, a2, 7
--        beqz     t4, .L_return
--.L_copy_by_byte_loop:
--        lb     a4, 0(a1)
--	sub	t4, t4, t3
--        addi    a1, a1, 1
--        sb     a4, 0(a0)
--        addi    a0, a0, 1
--	bnez	t4, .L_copy_by_byte_loop
--
--.L_return:
--        mv      a0, t6
--        ret
--
--        /* If dest is not aligned, just copying some bytes makes the dest
--           align.  */
--.L_dest_not_aligned:
--        sub     a3, t5, a3
--        mv      t5, a3
--.L_dest_not_aligned_loop:
--        /* Makes the dest align.  */
--        lb     a4, 0(a1)
--	sub	a3, a3, t3
--        addi    a1, a1, 1
--        sb     a4, 0(a0)
--        addi    a0, a0, 1
--	bnez	a3, .L_dest_not_aligned_loop
--        sub     a2, a2, t5
--	sltiu	a3, a2, 4
--        bnez    a3, .L_copy_by_byte
--        /* Check whether the src is aligned.  */
--        j		.L_dest_aligned
-+    li      a3, 32
-+    mv      a5, a0
-+    bgtu    a2, a3, .L_over_32
-+    li      a3, 4
-+    bgtu    a2, a3, .L_5_to_8
-+.L_0_to_4:
-+    beqz    a2, 1f
-+    lb      a4, 0(a1)
-+    sb      a4, 0(a5)
-+    /* process [n-1] */
-+    add     t1, a1, a2
-+    lb      a4, -1(t1)
-+    add     t0, a5, a2
-+    sb      a4, -1(t0)
-+    li      a3, 2
-+    bleu    a2, a3, 1f
-+    lb      a4, 2(a1)
-+    sb      a4, 2(a5)
-+    lb      a4, 1(a1)
-+    sb      a4, 1(a5)
-+1:
-+    ret
-+.L_5_to_8:
-+    li      a3, 8
-+    bgtu    a2, a3, .L_9_to_16
-+    lw      a3, 0(a1)
-+    sw      a3, 0(a5)
-+    add     a1, a1, a2
-+    add     a5, a5, a2
-+    lw      a3, -4(a1)
-+    sw      a3, -4(a5)
-+    ret
-+.L_9_to_16:
-+    li      a3, 16
-+    bgtu    a2, a3, .L_17_to_32
-+    ld      a3, 0(a1)
-+    sd      a3, 0(a5)
-+    add     a1, a1, a2
-+    add     a5, a5, a2
-+    ld      a3, -8(a1)
-+    sd      a3, -8(a5)
-+    ret
-+.L_17_to_32:
-+    addi    a2, a2, -16
-+    ld      a3, 0(a1)
-+    sd      a3, 0(a5)
-+    ld      a3, 8(a1)
-+    sd      a3, 8(a5)
-+    add     a1, a1, a2
-+    add     a5, a5, a2
-+    ld      a3, 0(a1)
-+    sd      a3, 0(a5)
-+    ld      a3, 8(a1)
-+    sd      a3, 8(a5)
-+    ret
-+.L_over_32:
-+    neg     a4, a5
-+    andi    a4, a4, 0x7
-+    beqz    a4, .L_dst_aligned
-+    ld      a3, 0(a1)
-+    sd      a3, 0(a5)
-+    sub     a2, a2, a4
-+    add     a5, a5, a4
-+    add     a1, a1, a4
-+.L_dst_aligned:
-+    andi    a4, a2, -32
-+    andi    a2, a2, (32-1)
-+    beqz    a4, .L_tail
-+    add     a4, a4, a5
-+.L_loop:
-+    copy_32B a5, a1
-+    addi    a5, a5, 32
-+    addi    a1, a1, 32
-+    bltu    a5, a4, .L_loop
-+    beqz    a2, .L_ret
-+.L_tail:
-+    andi    a4, a2, -1
-+.L_pc:
-+    auipc   a3, 0
-+    andi    a4, a4, -8
-+    srli    a4, a4, 1
-+    sub     a3, a3, a4
-+    .equ    offset, .L_jmp_end - .L_pc
-+    jalr    x0, a3, %lo(offset)
-+    ld      a3, 16(a1) # offset-12
-+    sd      a3, 16(a5)
-+    ld      a3, 8(a1)  # offset-8
-+    sd      a3, 8(a5)
-+    ld      a3, 0(a1)  # offset-4
-+    sd      a3, 0(a5)
-+.L_jmp_end:
-+    add     a1, a1, a2
-+    add     a5, a5, a2
-+    ld      a3, -8(a1)
-+    sd      a3, -8(a5)
-+.L_ret:
-+    ret
- END (memcpy)
- 
- libc_hidden_builtin_def (memcpy)
-diff --git a/sysdeps/riscv/rv64/multiarch/memcpy_riscv.S b/sysdeps/riscv/rv64/multiarch/memcpy_riscv.S
-index 249d4f6067..34b4e981c1 100644
---- a/sysdeps/riscv/rv64/multiarch/memcpy_riscv.S
-+++ b/sysdeps/riscv/rv64/multiarch/memcpy_riscv.S
-@@ -26,7 +26,7 @@
- 
- #include "memcpy_as.S"
- 
--#elif !defined __riscv_vector
-+#else
- #include "memcpy_as.S"
- 
- #endif
-diff --git a/sysdeps/riscv/rv64/multiarch/memcpy_vector.S b/sysdeps/riscv/rv64/multiarch/memcpy_vector.S
-index d15f4c3954..cba5e00f19 100644
---- a/sysdeps/riscv/rv64/multiarch/memcpy_vector.S
-+++ b/sysdeps/riscv/rv64/multiarch/memcpy_vector.S
-@@ -19,12 +19,10 @@
- #include <sysdep.h>
- 
- /* For __riscv_vector this file defines memcpy.  */
--#ifdef __riscv_vector 
--#ifdef SHARED
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
- # define memcpy __memcpy_vector
- # undef libc_hidden_builtin_def
- # define libc_hidden_builtin_def(a)
--#endif
- 
- 	.p2align 6
- ENTRY (memcpy)
-@@ -52,5 +50,4 @@ ENTRY (memcpy)
- 	ret
- END (memcpy)
- 
--libc_hidden_builtin_def (memcpy)
- #endif
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/memmove_as.S b/sysdeps/riscv/rv64/multiarch/memmove_as.S
-new file mode 100644
-index 0000000000..222b87b9c8
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memmove_as.S
-@@ -0,0 +1,168 @@
-+/* The assembly function for memmove.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+#define memcpy memcpy_internal 
-+#include "memcpy_as.S"
-+
-+
-+	.p2align 6
-+    
-+ENTRY (memmove)
-+    beq     a0, a1, .L_ret_fwd
-+    /* abs(dst - src) */
-+    sub     a3, a0, a1
-+    srai    a4, a3, 63
-+    xor     a3, a3, a4
-+    subw    a3, a3, a4
-+
-+    bltu    a3, a2, .L_overlap
-+    j       memcpy
-+.L_overlap:
-+    li      a4, 8
-+    bltu    a1, a0, .L_backward
-+    mv      a5, a0
-+    bltu    a2, a4, .L_byte_fwd
-+    neg     a4, a0
-+    andi    a4, a4, 0x7
-+    beqz    a4, .L_32B_fwd
-+.L_byte_head_fwd:
-+    sub     a2, a2, a4
-+    add     a4, a5, a4
-+0:
-+    lb      a3, 0(a1)
-+    sb      a3, 0(a5)
-+    addi    a5, a5, 1
-+    addi    a1, a1, 1
-+    bltu    a5, a4, 0b
-+.L_32B_fwd:
-+    andi    a4, a2, -32
-+    andi    a2, a2, (32 - 1)
-+    beqz    a4, .L_8B_fwd
-+    add     a4, a4, a5
-+0:
-+    ld      a3, 0(a1)
-+    sd      a3, 0(a5)
-+    ld      a3, 8(a1)
-+    sd      a3, 8(a5)
-+    ld      a3, 16(a1)
-+    sd      a3, 16(a5)
-+    ld      a3, 24(a1)
-+    sd      a3, 24(a5)
-+    addi    a5, a5, 32
-+    addi    a1, a1, 32
-+    bltu    a5, a4, 0b
-+    beqz    a2, .L_ret_fwd
-+.L_8B_fwd:
-+    andi    a4, a2, -8
-+    beqz    a4, .L_byte_tail_fwd
-+.L_pc_fwd:
-+    auipc   a3, 0
-+    add     a1, a1, a4
-+    add     a5, a5, a4
-+    sub     a3, a3, a4
-+    .equ    offset_fwd, .L_jmp_end_fwd - .L_pc_fwd
-+    jalr    x0, a3, %lo(offset_fwd)
-+    ld      a3, -24(a1)
-+    sd      a3, -24(a5)
-+    ld      a3, -16(a1)
-+    sd      a3, -16(a5)
-+    ld      a3, -8(a1)
-+    sd      a3, -8(a5)
-+.L_jmp_end_fwd:
-+.L_byte_tail_fwd:
-+    andi    a2, a2, (8 - 1)
-+.L_byte_fwd:
-+    beqz    a2, .L_ret_fwd
-+    add     a2, a2, a5
-+0:
-+    lb      a3, 0(a1)
-+    sb      a3, 0(a5)
-+    addi    a5, a5, 1
-+    addi    a1, a1, 1
-+    bltu    a5, a2, 0b
-+.L_ret_fwd:
-+    ret
-+
-+.L_backward:
-+    add     a1, a1, a2
-+    add     a5, a0, a2
-+    bltu    a2, a4, .L_byte_bwd
-+    andi    a4, a5, 0x7
-+    beqz    a4, .L_32B_bwd
-+.L_byte_head_bwd:
-+    sub     a2, a2, a4
-+    sub     a4, a5, a4
-+0:
-+    addi    a5, a5, -1
-+    addi    a1, a1, -1
-+    lb      a3, 0(a1)
-+    sb      a3, 0(a5)
-+    bltu    a4, a5, 0b
-+.L_32B_bwd:
-+    andi    a4, a2, -32
-+    andi    a2, a2, (32 - 1)
-+    beqz    a4, .L_8B_bwd
-+    sub     a4, a5, a4
-+0:
-+    addi    a5, a5, -32
-+    addi    a1, a1, -32
-+    ld      a3, 24(a1)
-+    sd      a3, 24(a5)
-+    ld      a3, 16(a1)
-+    sd      a3, 16(a5)
-+    ld      a3, 8(a1)
-+    sd      a3, 8(a5)
-+    ld      a3, 0(a1)
-+    sd      a3, 0(a5)
-+    bltu    a4, a5, 0b
-+    beqz    a2, .L_ret_bwd
-+.L_8B_bwd:
-+    andi    a4, a2, -8
-+    beqz    a4, .L_byte_tail_bwd
-+.L_pc_bwd:
-+    auipc   a3, 0
-+    sub     a1, a1, a4
-+    sub     a5, a5, a4
-+    srli    a4, a4, 1
-+    sub     a3, a3, a4
-+    .equ    offset_bwd, .L_jmp_end_bwd - .L_pc_bwd
-+    jalr    x0, a3, %lo(offset_bwd)
-+    ld      a3, 16(a1)
-+    sd      a3, 16(a5)
-+    ld      a3, 8(a1)
-+    sd      a3, 8(a5)
-+    ld      a3, 0(a1)
-+    sd      a3, 0(a5)
-+.L_jmp_end_bwd:
-+.L_byte_tail_bwd:
-+    andi    a2, a2, (8 - 1)
-+.L_byte_bwd:
-+    beqz    a2, .L_ret_bwd
-+0:
-+    addi    a5, a5, -1
-+    addi    a1, a1, -1
-+    lb      a3, 0(a1)
-+    sb      a3, 0(a5)
-+    bltu    a0, a5, 0b
-+.L_ret_bwd:
-+    ret
-+END (memmove)
-+
-+libc_hidden_builtin_def (memmove)
-diff --git a/sysdeps/riscv/rv64/multiarch/memmove_riscv.c b/sysdeps/riscv/rv64/multiarch/memmove_riscv.S
-similarity index 88%
-rename from sysdeps/riscv/rv64/multiarch/memmove_riscv.c
-rename to sysdeps/riscv/rv64/multiarch/memmove_riscv.S
-index 03708e0deb..14f154e226 100644
---- a/sysdeps/riscv/rv64/multiarch/memmove_riscv.c
-+++ b/sysdeps/riscv/rv64/multiarch/memmove_riscv.S
-@@ -22,10 +22,11 @@
- #define libc_hidden_builtin_def(name)
- 
- #undef weak_alias
--#  define MEMMOVE __memmove_riscv
--# include <string/memmove.c>
--#elif !defined __riscv_vector
-+#  define memmove __memmove_riscv
-+# include "memmove_as.S"
- 
--# include <string/memmove.c>
-+#else
-+
-+# include "memmove_as.S"
- #endif
- 
-diff --git a/sysdeps/riscv/rv64/multiarch/memmove_vector.S b/sysdeps/riscv/rv64/multiarch/memmove_vector.S
-index af748be5b2..e45137298e 100644
---- a/sysdeps/riscv/rv64/multiarch/memmove_vector.S
-+++ b/sysdeps/riscv/rv64/multiarch/memmove_vector.S
-@@ -19,12 +19,10 @@
- #include <sysdep.h>
- 
- /* For __riscv_vector this file defines memmov.  */
--#ifdef __riscv_vector 
--#ifdef SHARED
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
- # define memmove __memmove_vector
- # undef libc_hidden_builtin_def
- # define libc_hidden_builtin_def(a)
--#endif
- 
- 	.p2align 6
- ENTRY (memmove)
-@@ -54,5 +52,5 @@ ENTRY (memmove)
- 	bltu	zero,a2,.L_backward_copy_loop
- 	ret
- END (memmove)
--libc_hidden_builtin_def (memmove)
-+
- #endif
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/memrchr.S b/sysdeps/riscv/rv64/multiarch/memrchr.S
-new file mode 100644
-index 0000000000..c6db183163
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memrchr.S
-@@ -0,0 +1,123 @@
-+
-+/* The assembly function for memrchr.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+.macro chr_8B
-+    ld      a4, -8(a0)
-+    xor     a4, a4, a1
-+    sub     a3, a4, t1
-+    andn    a3, a3, a4
-+    and     a3, a3, a5
-+    bnez    a3, .L_find
-+.endm
-+.macro gen_pat
-+    slli    a3, a1, 8
-+    or      a1, a1, a3
-+    slli    a3, a1, 16
-+    or      a1, a1, a3
-+    slli    a3, a1, 32
-+    or      a1, a1, a3
-+
-+    li      a5, 0x80
-+    slli    a3, a5, 8
-+    or      a5, a5, a3
-+    slli    a3, a5, 16
-+    or      a5, a5, a3
-+    slli    a3, a5, 32
-+    or      a5, a5, a3  # 0x8080808080808080
-+    srli    t1, a5, 7   # 0x0101010101010101
-+.endm
-+
-+    .p2align 6
-+#ifndef MEMRCHR
-+ENTRY (__memrchr)
-+#else
-+ENTRY (MEMRCHR)
-+#endif
-+    li      a3, 7
-+    add     a0, a0, a2
-+    bgtu    a2, a3, .L_8_to_16
-+.L_0_to_7:
-+    beqz    a2, 1f
-+0:
-+    lbu     a4, -1(a0)
-+    beq     a1, a4, 2f
-+    addi    a2, a2, -1
-+    addi    a0, a0, -1
-+    bnez    a2, 0b
-+1:
-+    li      a0, 0
-+    ret
-+2:
-+    addi    a0, a0, -1
-+    ret
-+.L_8_to_16:
-+    gen_pat
-+    li      a3, 16
-+    bgtu    a2, a3, .L_over_16
-+    addi    a2, a2, -8
-+    chr_8B
-+    sub     a0, a0, a2
-+    chr_8B
-+    j       .L_not_find
-+.L_over_16:
-+    and     t4, a0, 0x7
-+    beqz    t4, .L_dst_aligned
-+    chr_8B
-+    sub     a2, a2, t4
-+    sub     a0, a0, t4
-+.L_dst_aligned:
-+    andi    t0, a2, (16-1)
-+    srli    a2, a2, 4
-+    beqz    a2, .L_tail
-+.L_loop:
-+    chr_8B
-+    addi    a0, a0, -8
-+    chr_8B
-+    addi    a2, a2, -1
-+    addi    a0, a0, -8
-+    bnez    a2, .L_loop
-+    beqz    t0, .L_not_find
-+.L_tail:
-+    sub     a0, a0, t0
-+    addi    a0, a0, 16
-+    chr_8B
-+    addi    a0, a0, -8
-+    chr_8B
-+.L_not_find:
-+    li      a0, 0
-+    ret
-+.L_find:
-+    clz     a3, a3
-+    addi    a0, a0, -1
-+    srli    a3, a3, 3
-+    sub     a0, a0, a3
-+    ret
-+#ifndef MEMRCHR
-+END (__memrchr)
-+#else
-+END (MEMRCHR)
-+#endif
-+
-+#ifndef MEMRCHR
-+# ifdef weak_alias
-+weak_alias (__memrchr, memrchr)
-+# endif
-+#endif
-diff --git a/sysdeps/riscv/rv64/multiarch/memset_as.S b/sysdeps/riscv/rv64/multiarch/memset_as.S
-new file mode 100644
-index 0000000000..7f67c79215
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/memset_as.S
-@@ -0,0 +1,123 @@
-+
-+/* The assembly function for memset.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+    .p2align 6
-+ENTRY (memset)
-+    li      a3, 32
-+    andi    a1, a1, 0xff
-+    mv      a5, a0
-+    bgtu    a2, a3, .L_over_32
-+    li      a3, 4
-+    bgtu    a2, a3, .L_5_to_8
-+.L_0_to_4:
-+    beqz    a2, 1f
-+    sb      a1, 0(a5)
-+    add     t0, a5, a2
-+    sb      a1, -1(t0)
-+    li      a3, 2
-+    bleu    a2, a3, 1f
-+    sb      a1, 1(a5)
-+    sb      a1, 2(a5)
-+1:
-+    ret
-+.L_5_to_8:
-+    slli    a3, a1, 8
-+    or      a1, a1, a3
-+    slli    a3, a1, 16
-+    or      a1, a1, a3
-+    li      a3, 8
-+    bgtu    a2, a3, .L_9_to_16
-+    sw      a1, 0(a5)
-+    add     a5, a5, a2
-+    sw      a1, -4(a5)
-+    ret
-+.L_9_to_16:
-+    li      a3, 16
-+    bgtu    a2, a3, .L_17_to_32
-+    sw      a1, 0(a5)
-+    sw      a1, 4(a5)
-+    add     a5, a5, a2
-+    sw      a1, -8(a5)
-+    sw      a1, -4(a5)
-+    ret
-+.L_17_to_32:
-+    slli    a3, a1, 32
-+    or      a1, a1, a3
-+    sd      a1, 0(a5)
-+    sd      a1, 8(a5)
-+    add     a5, a5, a2
-+    sd      a1, -16(a5)
-+    sd      a1, -8(a5)
-+    ret
-+.L_over_32:
-+    slli    a3, a1, 8
-+    or      a1, a1, a3
-+    slli    a3, a1, 16
-+    or      a1, a1, a3
-+    slli    a3, a1, 32
-+    or      a1, a1, a3
-+
-+    neg     a4, a5
-+    andi    a4, a4, 0x7
-+    beqz    a4, .L_dst_aligned
-+    sd      a1, 0(a5)
-+    sub     a2, a2, a4
-+    add     a5, a5, a4
-+.L_dst_aligned:
-+    andi    a4, a2, -64
-+    andi    a2, a2, (64-1)
-+    beqz    a4, .L_tail
-+    add     a4, a4, a5
-+.L_loop:
-+    sd      a1, 0(a5)
-+    sd      a1, 8(a5)
-+    sd      a1, 16(a5)
-+    sd      a1, 24(a5)
-+    sd      a1, 32(a5)
-+    sd      a1, 40(a5)
-+    sd      a1, 48(a5)
-+    sd      a1, 56(a5)
-+    addi    a5, a5, 64
-+    bltu    a5, a4, .L_loop
-+    beqz    a2, .L_ret
-+.L_tail:
-+    andi    a4, a2, -1
-+.L_pc:
-+    auipc   a3, 0
-+    andi    a4, a4, -8
-+    srli    a4, a4, 2
-+    sub     a3, a3, a4
-+    .equ    offset, .L_jmp_end - .L_pc
-+    jalr    x0, a3, %lo(offset)
-+    sd      a1, 48(a5)
-+    sd      a1, 40(a5)
-+    sd      a1, 32(a5)
-+    sd      a1, 24(a5)
-+    sd      a1, 16(a5)
-+    sd      a1, 8(a5)
-+    sd      a1, 0(a5)
-+.L_jmp_end:
-+    add     a5, a5, a2
-+    sd      a1, -8(a5)
-+ .L_ret:
-+    ret
-+END (memset)
-+libc_hidden_builtin_def (memset)
-diff --git a/sysdeps/riscv/rv64/multiarch/memset_riscv.c b/sysdeps/riscv/rv64/multiarch/memset_riscv.S
-similarity index 89%
-rename from sysdeps/riscv/rv64/multiarch/memset_riscv.c
-rename to sysdeps/riscv/rv64/multiarch/memset_riscv.S
-index de631eb187..8585db0228 100644
---- a/sysdeps/riscv/rv64/multiarch/memset_riscv.c
-+++ b/sysdeps/riscv/rv64/multiarch/memset_riscv.S
-@@ -21,11 +21,11 @@
- #define libc_hidden_builtin_def(name)
- 
- #undef weak_alias
--#  define MEMSET __memset_riscv
--# include <string/memset.c>
--#elif !defined __riscv_vector
-+#  define memset __memset_riscv
-+# include "memset_as.S"
-+#else
- 
--# include <string/memset.c>
-+# include "memset_as.S"
- #endif
- 
- 
-diff --git a/sysdeps/riscv/rv64/multiarch/memset_vector.S b/sysdeps/riscv/rv64/multiarch/memset_vector.S
-index dc407630a6..1271b04ba1 100644
---- a/sysdeps/riscv/rv64/multiarch/memset_vector.S
-+++ b/sysdeps/riscv/rv64/multiarch/memset_vector.S
-@@ -19,12 +19,11 @@
- 
- #include <sysdep.h>
- 
--#ifdef __riscv_vector 
--#ifdef SHARED
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
-+
- # define memset __memset_vector
- # undef libc_hidden_builtin_def
- # define libc_hidden_builtin_def(a)
--#endif
- 
- 	.p2align 6
- ENTRY (memset)
-@@ -42,5 +41,4 @@ ENTRY (memset)
-   ret
- 
- END (memset)
--libc_hidden_builtin_def (memset)
- #endif
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-memmove.c b/sysdeps/riscv/rv64/multiarch/rtld-memmove.S
-similarity index 93%
-rename from sysdeps/riscv/rv64/multiarch/rtld-memmove.c
-rename to sysdeps/riscv/rv64/multiarch/rtld-memmove.S
-index 90e37dbd8b..fb6c2c3748 100644
---- a/sysdeps/riscv/rv64/multiarch/rtld-memmove.c
-+++ b/sysdeps/riscv/rv64/multiarch/rtld-memmove.S
-@@ -16,4 +16,5 @@
-    License along with the GNU C Library; if not, see
-    <https://www.gnu.org/licenses/>.  */
- 
--# include <string/memmove.c>
-+//# include <string/memmove.c>
-+#include "memmove_as.S"
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-memrchr.S b/sysdeps/riscv/rv64/multiarch/rtld-memrchr.S
-new file mode 100644
-index 0000000000..b1154d0f2a
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/rtld-memrchr.S
-@@ -0,0 +1 @@
-+#include "memrchr_as.S"
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-strcmp.S b/sysdeps/riscv/rv64/multiarch/rtld-strcmp.S
-index eb6ff5f8d3..e59c57f738 100644
---- a/sysdeps/riscv/rv64/multiarch/rtld-strcmp.S
-+++ b/sysdeps/riscv/rv64/multiarch/rtld-strcmp.S
-@@ -1 +1 @@
--#include "strcmp_.S"
-\ No newline at end of file
-+#include "strcmp_as.S"
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/strcmp_.S b/sysdeps/riscv/rv64/multiarch/strcmp_as.S
-similarity index 100%
-rename from sysdeps/riscv/rv64/multiarch/strcmp_.S
-rename to sysdeps/riscv/rv64/multiarch/strcmp_as.S
-diff --git a/sysdeps/riscv/rv64/multiarch/strcmp_riscv.S b/sysdeps/riscv/rv64/multiarch/strcmp_riscv.S
-index f5be83d5b7..abf2984230 100644
---- a/sysdeps/riscv/rv64/multiarch/strcmp_riscv.S
-+++ b/sysdeps/riscv/rv64/multiarch/strcmp_riscv.S
-@@ -6,8 +6,8 @@
- # undef libc_hidden_builtin_def
- # define libc_hidden_builtin_def(a)
- 
--#include "strcmp_.S"
--#elif !defined __riscv_vector
-+#include "strcmp_as.S"
-+#else
- 
--#include "strcmp_.S"
-+#include "strcmp_as.S"
- #endif
-diff --git a/sysdeps/riscv/rv64/multiarch/strcmp_vector.S b/sysdeps/riscv/rv64/multiarch/strcmp_vector.S
-index d0b8e316f9..40fc474695 100644
---- a/sysdeps/riscv/rv64/multiarch/strcmp_vector.S
-+++ b/sysdeps/riscv/rv64/multiarch/strcmp_vector.S
-@@ -19,12 +19,10 @@
- #include <sysdep.h>
- 
- /* For __riscv_vector this file defines strcmp.  */
--#ifdef __riscv_vector 
--#ifdef SHARED
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
- # define strcmp __strcmp_vector
- # undef libc_hidden_builtin_def
- # define libc_hidden_builtin_def(a)
--#endif 
- 
- 	.p2align 6
- ENTRY (strcmp)
-@@ -51,5 +49,5 @@ ENTRY (strcmp)
-    ret
- 
- END (strcmp)
--libc_hidden_builtin_def (strcmp)
-+
- #endif
-diff --git a/sysdeps/riscv/rv64/multiarch/strlen_riscv.c b/sysdeps/riscv/rv64/multiarch/strlen_riscv.c
-index d605941766..d3bae0fc43 100644
---- a/sysdeps/riscv/rv64/multiarch/strlen_riscv.c
-+++ b/sysdeps/riscv/rv64/multiarch/strlen_riscv.c
-@@ -24,7 +24,7 @@
- #undef weak_alias
- #  define STRLEN __strlen_riscv
- # include <string/strlen.c>
--#elif !defined __riscv_vector
-+#else
- 
- # include <string/strlen.c>
- #endif
-diff --git a/sysdeps/riscv/rv64/multiarch/strlen_vector.S b/sysdeps/riscv/rv64/multiarch/strlen_vector.S
-index f674de3a26..0b4ae7ba90 100644
---- a/sysdeps/riscv/rv64/multiarch/strlen_vector.S
-+++ b/sysdeps/riscv/rv64/multiarch/strlen_vector.S
-@@ -19,12 +19,10 @@
- #include <sysdep.h>
- 
- /* For __riscv_vector this file defines strlen.  */
--#ifdef __riscv_vector 
--#ifdef SHARED
-+#if IS_IN (libc) && defined SHARED && defined __riscv_vector
- # define strlen __strlen_vector
- # undef libc_hidden_builtin_def
- # define libc_hidden_builtin_def(a)
--#endif
- 
- 	.p2align 6
- ENTRY (strlen)
-@@ -44,5 +42,5 @@ ENTRY (strlen)
-    ret
- 
- END (strlen)
--libc_hidden_builtin_def (strlen)
-+
- #endif
-\ No newline at end of file
--- 
-2.25.1
-

+ 0 - 32
recipes-core/glibc/glibc/0011-add-alias-to-bcmp.patch

@@ -1,32 +0,0 @@
-From c598ae46e8159326563883b6243de8ac8391dc45 Mon Sep 17 00:00:00 2001
-From: "max.ma" <max.ma@starfivetech.com>
-Date: Tue, 13 Sep 2022 18:33:27 -0700
-Subject: [PATCH 11/19] add alias to bcmp
-
----
- sysdeps/riscv/rv64/multiarch/memcmp_as.S | 11 ++++++++++-
- 1 file changed, 10 insertions(+), 1 deletion(-)
-
-diff --git a/sysdeps/riscv/rv64/multiarch/memcmp_as.S b/sysdeps/riscv/rv64/multiarch/memcmp_as.S
-index a737172980..c9c6b3e909 100644
---- a/sysdeps/riscv/rv64/multiarch/memcmp_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/memcmp_as.S
-@@ -146,5 +146,14 @@ ENTRY (memcmp)
-     li      a0, 0
-     ret
- END (memcmp)
--
- libc_hidden_builtin_def (memcmp)
-+
-+#ifdef weak_alias
-+# undef bcmp
-+weak_alias (memcmp, bcmp)
-+#endif
-+
-+#undef __memcmpeq
-+strong_alias (memcmp, __memcmpeq)
-+libc_hidden_def(__memcmpeq)
-+
--- 
-2.25.1
-

+ 2 - 2
recipes-core/glibc/glibc/0011-eglibc-Help-bootstrap-cross-toolchain.patch

@@ -1,4 +1,4 @@
-From 7f2fd574646cb5ecbbc09372a2d8580ab72ec158 Mon Sep 17 00:00:00 2001
+From cf2126b2d6e073137a3a7d9bcc261e0a760a82da Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:49:28 +0000
 Subject: [PATCH] eglibc: Help bootstrap cross toolchain
@@ -29,7 +29,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  create mode 100644 include/stubs-bootstrap.h
 
 diff --git a/Makefile b/Makefile
-index 179dd478ff..55cfb740bf 100644
+index c6d4817a9e..b4b0e23560 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -79,9 +79,18 @@ subdir-dirs = include

+ 3 - 3
recipes-core/glibc/glibc/0012-eglibc-Resolve-__fpscr_values-on-SH4.patch

@@ -1,4 +1,4 @@
-From 9f1803a2f91d59a9478ca4d8d93e1de5c62671e5 Mon Sep 17 00:00:00 2001
+From 61948c02226acea68d34313cc6286ee1ab44a98c Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:55:53 +0000
 Subject: [PATCH] eglibc: Resolve __fpscr_values on SH4
@@ -21,7 +21,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  2 files changed, 12 insertions(+)
 
 diff --git a/sysdeps/unix/sysv/linux/sh/Versions b/sysdeps/unix/sysv/linux/sh/Versions
-index 9c734ff755..974e33b4b1 100644
+index 3ad702e165..931985b5d6 100644
 --- a/sysdeps/unix/sysv/linux/sh/Versions
 +++ b/sysdeps/unix/sysv/linux/sh/Versions
 @@ -3,6 +3,7 @@ libc {
@@ -33,7 +33,7 @@ index 9c734ff755..974e33b4b1 100644
      # a*
      alphasort64;
 diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.S b/sysdeps/unix/sysv/linux/sh/sysdep.S
-index c5e3a7a365..35120031c4 100644
+index 9d85ff99a0..6bda921ca3 100644
 --- a/sysdeps/unix/sysv/linux/sh/sysdep.S
 +++ b/sysdeps/unix/sysv/linux/sh/sysdep.S
 @@ -30,3 +30,14 @@ ENTRY (__syscall_error)

+ 0 - 236
recipes-core/glibc/glibc/0012-remove-unnecessary-changes-to-support-v.patch

@@ -1,236 +0,0 @@
-From 0df4da2c05981efe9aab12570b68106fca1e801d Mon Sep 17 00:00:00 2001
-From: "max.ma" <max.ma@starfivetech.com>
-Date: Fri, 7 Oct 2022 22:45:48 -0700
-Subject: [PATCH 12/19] remove unnecessary changes to support v
-
----
- sysdeps/riscv/Makefile                       |  5 ---
- sysdeps/riscv/rtld-global-offsets.sym        |  7 ----
- sysdeps/unix/sysv/linux/riscv/getcontext.S   | 24 +-----------
- sysdeps/unix/sysv/linux/riscv/setcontext.S   | 22 -----------
- sysdeps/unix/sysv/linux/riscv/swapcontext.S  | 41 --------------------
- sysdeps/unix/sysv/linux/riscv/sys/ucontext.h |  2 -
- sysdeps/unix/sysv/linux/riscv/ucontext_i.sym |  5 ---
- 7 files changed, 2 insertions(+), 104 deletions(-)
- delete mode 100644 sysdeps/riscv/rtld-global-offsets.sym
-
-diff --git a/sysdeps/riscv/Makefile b/sysdeps/riscv/Makefile
-index e2d84640d4..8fb10b164f 100644
---- a/sysdeps/riscv/Makefile
-+++ b/sysdeps/riscv/Makefile
-@@ -2,11 +2,6 @@ ifeq ($(subdir),misc)
- sysdep_headers += sys/asm.h
- endif
- 
--ifeq ($(subdir),csu)
--# get offset to rtld_global._dl_hwcap and rtld_global._dl_hwcap2.
--gen-as-const-headers += rtld-global-offsets.sym
--endif
--
- # RISC-V's assembler also needs to know about PIC as it changes the definition
- # of some assembler macros.
- ASFLAGS-.os += $(pic-ccflag)
-diff --git a/sysdeps/riscv/rtld-global-offsets.sym b/sysdeps/riscv/rtld-global-offsets.sym
-deleted file mode 100644
-index ff4e97f2a6..0000000000
---- a/sysdeps/riscv/rtld-global-offsets.sym
-+++ /dev/null
-@@ -1,7 +0,0 @@
--#define SHARED 1
--
--#include <ldsodefs.h>
--
--#define rtld_global_ro_offsetof(mem) offsetof (struct rtld_global_ro, mem)
--
--RTLD_GLOBAL_RO_DL_HWCAP_OFFSET	rtld_global_ro_offsetof (_dl_hwcap)
-diff --git a/sysdeps/unix/sysv/linux/riscv/getcontext.S b/sysdeps/unix/sysv/linux/riscv/getcontext.S
-index 371ebd52a7..499f70b65d 100644
---- a/sysdeps/unix/sysv/linux/riscv/getcontext.S
-+++ b/sysdeps/unix/sysv/linux/riscv/getcontext.S
-@@ -16,8 +16,6 @@
-    License along with the GNU C Library.  If not, see
-    <https://www.gnu.org/licenses/>.  */
- 
--#include <sysdep.h>
--#include <rtld-global-offsets.h>
- #include "ucontext-macros.h"
- 
- /* int getcontext (ucontext_t *ucp) */
-@@ -41,25 +39,6 @@ LEAF (__getcontext)
- 	SAVE_INT_REG (s10, 26, a0)
- 	SAVE_INT_REG (s11, 27, a0)
- 
--#ifdef __riscv_vector
--# ifdef SHARED
--	la	t1, _rtld_global_ro
--	REG_L   t1, RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(t1)
--# else
--	la	t1, _dl_hwcap
--	REG_L	t1, (t1)
--# endif
--	li	t2, HWCAP_ISA_V
--	and	t2, t1, t2
--	beqz	t2, 1f
--	addi	t2, a0,	MCONTEXT_EXTENSION
--	li	t1, RVV_MAGIC
--	sw	t1, (t2)
--	csrr	t1, vcsr
--	REG_S	t1, VCSR_OFFSET(t2)
--1:
--#endif
--
- #ifndef __riscv_float_abi_soft
- 	frsr	a1
- 
-@@ -94,4 +73,5 @@ LEAF (__getcontext)
- 99:	j	__syscall_error
- 
- PSEUDO_END (__getcontext)
--weak_alias (__getcontext, getcontext)
-\ No newline at end of file
-+
-+weak_alias (__getcontext, getcontext)
-diff --git a/sysdeps/unix/sysv/linux/riscv/setcontext.S b/sysdeps/unix/sysv/linux/riscv/setcontext.S
-index 423d94df27..e3bc84a2e6 100644
---- a/sysdeps/unix/sysv/linux/riscv/setcontext.S
-+++ b/sysdeps/unix/sysv/linux/riscv/setcontext.S
-@@ -16,8 +16,6 @@
-    License along with the GNU C Library.  If not, see
-    <https://www.gnu.org/licenses/>.  */
- 
--#include <sysdep.h>
--#include <rtld-global-offsets.h>
- #include "ucontext-macros.h"
- 
- /*  int __setcontext (const ucontext_t *ucp)
-@@ -66,26 +64,6 @@ LEAF (__setcontext)
- 	fssr	t1
- #endif /* __riscv_float_abi_soft */
- 
--#ifdef __riscv_vector
--#ifdef SHARED
--	la	t1, _rtld_global_ro
--	REG_L   t1, RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(t1)
--#else
--	la	t1, _dl_hwcap
--	REG_L	t1, (t1)
--#endif
--	li	t2, HWCAP_ISA_V
--	and	t2, t1, t2
--	beqz	t2, 1f
--	li      t1, RVV_MAGIC
--	addi	t2, t0,	MCONTEXT_EXTENSION
--	lw	a1, (t2)
--	bne	a1, t1, 1f
--	REG_L   t1, VCSR_OFFSET(t2)
--	csrw	vcsr, t1
--1:
--#endif
--
- 	/* Note the contents of argument registers will be random
- 	   unless makecontext() has been called.  */
- 	RESTORE_INT_REG     (t1,   0, t0)
-diff --git a/sysdeps/unix/sysv/linux/riscv/swapcontext.S b/sysdeps/unix/sysv/linux/riscv/swapcontext.S
-index 16600f78df..4da615f6d4 100644
---- a/sysdeps/unix/sysv/linux/riscv/swapcontext.S
-+++ b/sysdeps/unix/sysv/linux/riscv/swapcontext.S
-@@ -16,8 +16,6 @@
-    License along with the GNU C Library.  If not, see
-    <https://www.gnu.org/licenses/>.  */
- 
--#include <sysdep.h>
--#include <rtld-global-offsets.h>
- #include "ucontext-macros.h"
- 
- /* int swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */
-@@ -42,25 +40,6 @@ LEAF (__swapcontext)
- 	SAVE_INT_REG (s10, 26, a0)
- 	SAVE_INT_REG (s11, 27, a0)
- 
--#ifdef __riscv_vector
--#ifdef SHARED
--	la      t1, _rtld_global_ro
--	REG_L   t1, RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(t1)
--#else
--	la	t1, _dl_hwcap
--	REG_L   t1, (t1)
--#endif
--	li	t2, HWCAP_ISA_V
--	and	t2, t1, t2
--	beqz	t2, 1f
--	addi	t2, a0,	MCONTEXT_EXTENSION
--	li	t1, RVV_MAGIC
--	sw	t1, (t2)
--	csrr	t1, vcsr
--	REG_S	t1, VCSR_OFFSET(t2)
--1:
--#endif
--
- #ifndef __riscv_float_abi_soft
- 	frsr a1
- 
-@@ -110,26 +89,6 @@ LEAF (__swapcontext)
- 	fssr	t1
- #endif /* __riscv_float_abi_soft */
- 
--#ifdef __riscv_vector
--#ifdef SHARED
--	la      t1, _rtld_global_ro
--	REG_L   t1, RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(t1)
--#else
--	la	t1, _dl_hwcap
--	REG_L   t1, (t1)
--#endif
--	li	t2, HWCAP_ISA_V
--	and	t2, t1, t2
--	beqz	t2, 1f
--	li      t1, RVV_MAGIC
--	addi	t2, t0,	MCONTEXT_EXTENSION
--	lw	a1, (t2)
--	bne	a1, t1, 1f
--	REG_L   t1, VCSR_OFFSET(t2)
--	csrw	vcsr, t1
--1:
--#endif
--
- 	/* Note the contents of argument registers will be random
- 	   unless makecontext() has been called.  */
- 	RESTORE_INT_REG (t1,   0, t0)
-diff --git a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h b/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h
-index 1b370f0f45..e226ee85ee 100644
---- a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h
-+++ b/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h
-@@ -82,8 +82,6 @@ typedef struct mcontext_t
-   {
-     __riscv_mc_gp_state __gregs;
-     union  __riscv_mc_fp_state __fpregs;
--    /* 5K + 256 reserved for vector state and future expansion.  */
--    unsigned char __reserved[5376] __attribute__ ((__aligned__ (16)));
-   } mcontext_t;
- 
- /* Userlevel context.  */
-diff --git a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
-index b91945a080..be55b26310 100644
---- a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
-+++ b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
-@@ -2,7 +2,6 @@
- #include <signal.h>
- #include <stddef.h>
- #include <sys/ucontext.h>
--#include <asm/sigcontext.h>
- 
- -- Constants used by the rt_sigprocmask call.
- 
-@@ -28,9 +27,5 @@ STACK_FLAGS			stack (ss_flags)
- 
- MCONTEXT_GREGS			mcontext (__gregs)
- MCONTEXT_FPREGS			mcontext (__fpregs)
--MCONTEXT_EXTENSION 		mcontext (__reserved)
- 
- UCONTEXT_SIZE			sizeof (ucontext_t)
--VCSR_OFFSET			offsetof (struct __riscv_v_state, vcsr)
--
--RVV_MAGIC
--- 
-2.25.1
-

+ 12 - 12
recipes-core/glibc/glibc/0013-eglibc-Forward-port-cross-locale-generation-support.patch

@@ -1,4 +1,4 @@
-From 2c6449014151a4bcd4b253b2acc920f0b3d6b13f Mon Sep 17 00:00:00 2001
+From befa58c48a8ba664e7bbdfcf22e2a15efa2e0d17 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 01:33:49 +0000
 Subject: [PATCH] eglibc: Forward port cross locale generation support
@@ -23,7 +23,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  create mode 100644 locale/catnames.c
 
 diff --git a/locale/Makefile b/locale/Makefile
-index eb55750496..b0461ac4b9 100644
+index d7036b0855..ed795e2710 100644
 --- a/locale/Makefile
 +++ b/locale/Makefile
 @@ -26,7 +26,8 @@ headers		= langinfo.h locale.h bits/locale.h \
@@ -89,7 +89,7 @@ index 0000000000..538f3f5edb
 +    [LC_ALL] = sizeof ("LC_ALL") - 1
 +  };
 diff --git a/locale/localeinfo.h b/locale/localeinfo.h
-index 3dc26272a0..b667d32c23 100644
+index 7a930079a5..05d7848d29 100644
 --- a/locale/localeinfo.h
 +++ b/locale/localeinfo.h
 @@ -246,7 +246,7 @@ __libc_tsd_define (extern, locale_t, LOCALE)
@@ -102,7 +102,7 @@ index 3dc26272a0..b667d32c23 100644
  # define NL_CURRENT_INDIRECT	1
  #endif
 diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c
-index 396a0d76c0..91f4a765ee 100644
+index 9582f2d167..8f9f3f582c 100644
 --- a/locale/programs/charmap-dir.c
 +++ b/locale/programs/charmap-dir.c
 @@ -18,7 +18,9 @@
@@ -148,7 +148,7 @@ index 396a0d76c0..91f4a765ee 100644
    return NULL;
  }
 diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
-index 992814491d..da4dde4663 100644
+index 2c9f540bf1..c937cfd2ab 100644
 --- a/locale/programs/ld-collate.c
 +++ b/locale/programs/ld-collate.c
 @@ -352,7 +352,7 @@ new_element (struct locale_collate_t *collate, const char *mbs, size_t mbslen,
@@ -197,7 +197,7 @@ index 992814491d..da4dde4663 100644
  			 == runp->wcnext->wcs[runp->nwcs - 1] + 1));
  
 diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
-index c6749dbd82..ac99777925 100644
+index d285b72611..4bf01fa3db 100644
 --- a/locale/programs/ld-ctype.c
 +++ b/locale/programs/ld-ctype.c
 @@ -914,7 +914,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap,
@@ -279,7 +279,7 @@ index c6749dbd82..ac99777925 100644
  	      srunp = srunp->next;
  	    }
 diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
-index b58fecfcee..a4d70e0780 100644
+index a590b013b3..5ed4fa0f59 100644
 --- a/locale/programs/ld-time.c
 +++ b/locale/programs/ld-time.c
 @@ -219,8 +219,10 @@ No definition for %s category found"), "LC_TIME");
@@ -348,7 +348,7 @@ index b58fecfcee..a4d70e0780 100644
  
  
 diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
-index 0460074a0c..31a7151f66 100644
+index f8c49ac06f..ddda006037 100644
 --- a/locale/programs/linereader.c
 +++ b/locale/programs/linereader.c
 @@ -776,7 +776,7 @@ get_string (struct linereader *lr, const struct charmap_t *charmap,
@@ -361,7 +361,7 @@ index 0460074a0c..31a7151f66 100644
    lr_buffer_init (&lrb);
  
 diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
-index 35a092a111..94712bf114 100644
+index 1b751bb7be..c255e2b436 100644
 --- a/locale/programs/localedef.c
 +++ b/locale/programs/localedef.c
 @@ -108,6 +108,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
@@ -407,7 +407,7 @@ index 35a092a111..94712bf114 100644
        force_output = 1;
        break;
 diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
-index 8fa74dce60..8d5aca6d9e 100644
+index e3eef59295..711d6fbea0 100644
 --- a/locale/programs/locfile.c
 +++ b/locale/programs/locfile.c
 @@ -543,6 +543,9 @@ compare_files (const char *filename1, const char *filename2, size_t size,
@@ -430,7 +430,7 @@ index 8fa74dce60..8d5aca6d9e 100644
  
  /* Record that FILE's next element is the 32-bit integer VALUE.  */
 diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h
-index 57b2211e2f..e9498c6c7e 100644
+index 5caf5c348f..76856a32c2 100644
 --- a/locale/programs/locfile.h
 +++ b/locale/programs/locfile.h
 @@ -70,6 +70,8 @@ extern void write_all_categories (struct localedef_t *definitions,
@@ -519,7 +519,7 @@ index 57b2211e2f..e9498c6c7e 100644
 +
  #endif /* locfile.h */
 diff --git a/locale/setlocale.c b/locale/setlocale.c
-index 56c14d8533..6aac00503e 100644
+index 6a902faa50..17413f0a9c 100644
 --- a/locale/setlocale.c
 +++ b/locale/setlocale.c
 @@ -63,35 +63,6 @@ static char *const _nl_current_used[] =

+ 0 - 46
recipes-core/glibc/glibc/0013-fix-compiling-error-when-march-not-include-b-ext.patch

@@ -1,46 +0,0 @@
-From 66b5c3e50b1acf0a4cb7cdaf7ddad7c7f8e2c3b8 Mon Sep 17 00:00:00 2001
-From: "demin.han" <demin.han@starfivetech.com>
-Date: Mon, 31 Oct 2022 11:20:22 +0800
-Subject: [PATCH 13/19] fix compiling error when -march not include b ext
-
----
- sysdeps/riscv/rv64/multiarch/memchr_as.S | 4 +++-
- sysdeps/riscv/rv64/multiarch/memrchr.S   | 2 ++
- 2 files changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/sysdeps/riscv/rv64/multiarch/memchr_as.S b/sysdeps/riscv/rv64/multiarch/memchr_as.S
-index e614630a4d..aa6c22a3d0 100644
---- a/sysdeps/riscv/rv64/multiarch/memchr_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/memchr_as.S
-@@ -19,6 +19,8 @@
- 
- #include <sysdep.h>
- 
-+.option arch, +zbb
-+
- .macro chr_8B
-     ld      a4, 0(a0)
-     xor     a4, a4, a1
-@@ -105,4 +107,4 @@ ENTRY (memchr)
-     add     a0, a0, a3
-     ret
- END (memchr)
--libc_hidden_builtin_def (memchr)
-\ No newline at end of file
-+libc_hidden_builtin_def (memchr)
-diff --git a/sysdeps/riscv/rv64/multiarch/memrchr.S b/sysdeps/riscv/rv64/multiarch/memrchr.S
-index c6db183163..01c2d949de 100644
---- a/sysdeps/riscv/rv64/multiarch/memrchr.S
-+++ b/sysdeps/riscv/rv64/multiarch/memrchr.S
-@@ -19,6 +19,8 @@
- 
- #include <sysdep.h>
- 
-+.option arch, +zbb
-+
- .macro chr_8B
-     ld      a4, -8(a0)
-     xor     a4, a4, a1
--- 
-2.25.1
-

+ 0 - 53
recipes-core/glibc/glibc/0014-fix-memcmp-bug-relate-to-use-jmp-table.patch

@@ -1,53 +0,0 @@
-From c3dd8b0c45f338b0f5bca70871ea08322fe499d0 Mon Sep 17 00:00:00 2001
-From: "demin.han" <demin.han@starfivetech.com>
-Date: Fri, 11 Nov 2022 14:29:51 +0800
-Subject: [PATCH 14/19] fix memcmp bug relate to use jmp table
-
-jump table tech is not suitable for memcmp
-memcmp has order requirement, but jmp table has reverse order feature
----
- sysdeps/riscv/rv64/multiarch/memcmp_as.S | 25 +++++++++++-------------
- 1 file changed, 11 insertions(+), 14 deletions(-)
-
-diff --git a/sysdeps/riscv/rv64/multiarch/memcmp_as.S b/sysdeps/riscv/rv64/multiarch/memcmp_as.S
-index c9c6b3e909..984aeb7645 100644
---- a/sysdeps/riscv/rv64/multiarch/memcmp_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/memcmp_as.S
-@@ -113,23 +113,20 @@ ENTRY (memcmp)
-     bltu    a5, a4, .L_loop
-     beqz    a2, .L_end
- .L_tail:
--    andi    a4, a2, -1
--.L_pc:
--    auipc   a3, 0
--    andi    a4, a4, -8
--    sub     a3, a3, a4
--    .equ    offset, .L_jmp_end - .L_pc
--    jalr    x0, a3, %lo(offset)
--    ld      a3, 16(a1)
--    ld      a0, 16(a5)
--    bne     a3, a0, .L_end
--    ld      a3, 8(a1)
--    ld      a0, 8(a5)
--    bne     a3, a0, .L_end
-+    andi    a4, a2, -8
-+    beqz    a4, .L_last
-+    add     a4, a4, a5
-+0:
-     ld      a3, 0(a1)
-     ld      a0, 0(a5)
-     bne     a3, a0, .L_end
--.L_jmp_end:
-+    add     a5, a5, 8
-+    add     a1, a1, 8
-+    bltu    a5, a4, 0b
-+
-+.L_last:
-+    andi    a2, a2, (8-1)
-+    beqz    a2, 3f
-     add     a1, a1, a2
-     add     a5, a5, a2
-     ld      a3, -8(a1)
--- 
-2.25.1
-

+ 2 - 2
recipes-core/glibc/glibc/0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch

@@ -1,4 +1,4 @@
-From 8ebf6708ba54147b44f5638b93f123fd55d4c37e Mon Sep 17 00:00:00 2001
+From 653b0631f80f17abe01957c06ef8a8d5d189b789 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 3 Aug 2018 09:42:06 -0700
 Subject: [PATCH] localedef --add-to-archive uses a hard-coded locale path
@@ -18,7 +18,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  1 file changed, 25 insertions(+), 10 deletions(-)
 
 diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
-index eeb2fa6ffe..15274b0191 100644
+index 71fd9f34fa..cd3eb90ad5 100644
 --- a/locale/programs/locarchive.c
 +++ b/locale/programs/locarchive.c
 @@ -339,12 +339,24 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)

+ 0 - 53
recipes-core/glibc/glibc/0015-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch

@@ -1,53 +0,0 @@
-From bd2b87eaa2e99310f5439df95bea12a48dc978bf Mon Sep 17 00:00:00 2001
-From: Martin Jansa <martin.jansa@gmail.com>
-Date: Mon, 17 Dec 2018 21:36:18 +0000
-Subject: [PATCH] locale: prevent maybe-uninitialized errors with -Os [BZ
- #19444]
-
-Fixes following error when building for aarch64 with -Os:
-| In file included from strcoll_l.c:43:
-| strcoll_l.c: In function '__strcoll_l':
-| ../locale/weight.h:31:26: error: 'seq2.back_us' may be used uninitialized in this function [-Werror=maybe-uninitialized]
-|    int_fast32_t i = table[*(*cpp)++];
-|                           ^~~~~~~~~
-| strcoll_l.c:304:18: note: 'seq2.back_us' was declared here
-|    coll_seq seq1, seq2;
-|                   ^~~~
-| In file included from strcoll_l.c:43:
-| ../locale/weight.h:31:26: error: 'seq1.back_us' may be used uninitialized in this function [-Werror=maybe-uninitialized]
-|    int_fast32_t i = table[*(*cpp)++];
-|                           ^~~~~~~~~
-| strcoll_l.c:304:12: note: 'seq1.back_us' was declared here
-|    coll_seq seq1, seq2;
-|             ^~~~
-
-        Partial fix for [BZ #19444]
-        * locale/weight.h: Fix build with -Os.
-
-Upstream-Status: Submitted [https://patchwork.ozlabs.org/patch/1014766]
-
-Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- locale/weight.h | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/locale/weight.h b/locale/weight.h
-index 8be2d220f8..4a4d5aa6b2 100644
---- a/locale/weight.h
-+++ b/locale/weight.h
-@@ -27,7 +27,14 @@ findidx (const int32_t *table,
- 	 const unsigned char *extra,
- 	 const unsigned char **cpp, size_t len)
- {
-+  /* With GCC 8 when compiling with -Os the compiler warns that
-+     seq1.back_us and seq2.back_us might be used uninitialized.
-+     This uninitialized use is impossible for the same reason
-+     as described in comments in locale/weightwc.h.  */
-+  DIAG_PUSH_NEEDS_COMMENT;
-+  DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
-   int32_t i = table[*(*cpp)++];
-+  DIAG_POP_NEEDS_COMMENT;
-   const unsigned char *cp;
-   const unsigned char *usrc;
- 

+ 0 - 980
recipes-core/glibc/glibc/0015-memxxx-align-version-with-merge-tech-or-B-ext.patch

@@ -1,980 +0,0 @@
-From 58e09fded3cf5222461c2a0198b47368bb69d3d6 Mon Sep 17 00:00:00 2001
-From: "demin.han" <demin.han@starfivetech.com>
-Date: Fri, 2 Dec 2022 15:06:20 +0800
-Subject: [PATCH 15/19] memxxx align version with merge tech or B ext
-
----
- sysdeps/riscv/rv64/multiarch/memchr_as.S  | 115 +++++++--------
- sysdeps/riscv/rv64/multiarch/memcmp_as.S  | 171 ++++++++++------------
- sysdeps/riscv/rv64/multiarch/memcpy_as.S  | 145 +++++++++---------
- sysdeps/riscv/rv64/multiarch/memmove_as.S |  62 +++++++-
- sysdeps/riscv/rv64/multiarch/memrchr.S    | 114 +++++++--------
- sysdeps/riscv/rv64/multiarch/memset_as.S  | 129 ++++++++--------
- 6 files changed, 374 insertions(+), 362 deletions(-)
-
-diff --git a/sysdeps/riscv/rv64/multiarch/memchr_as.S b/sysdeps/riscv/rv64/multiarch/memchr_as.S
-index aa6c22a3d0..ad559e6a11 100644
---- a/sysdeps/riscv/rv64/multiarch/memchr_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/memchr_as.S
-@@ -21,90 +21,75 @@
- 
- .option arch, +zbb
- 
--.macro chr_8B
--    ld      a4, 0(a0)
--    xor     a4, a4, a1
--    sub     a3, a4, t1
--    andn    a3, a3, a4
--    and     a3, a3, a5
--    bnez    a3, .L_find
--.endm
--.macro gen_pat
--    slli    a3, a1, 8
--    or      a1, a1, a3
--    slli    a3, a1, 16
--    or      a1, a1, a3
--    slli    a3, a1, 32
--    or      a1, a1, a3
--
--    li      a5, 0x80
--    slli    a3, a5, 8
--    or      a5, a5, a3
--    slli    a3, a5, 16
--    or      a5, a5, a3
--    slli    a3, a5, 32
--    or      a5, a5, a3  # 0x8080808080808080
--    srli    t1, a5, 7   # 0x0101010101010101
--.endm
--
- 	.p2align 6
- ENTRY (memchr)
--    li      a3, 7
--    bgtu    a2, a3, .L_8_to_16
--.L_0_to_7:
--    beqz    a2, 1f
-+    beqz    a2, .L_not_find
-+    li      a4, 9
-+    bltu    a2, a4, .L_0_to_8 
-+    
-+    neg     a4, a0
-+    andi    a4, a4, 0x7
-+    beqz    a4, .L_dst_aligned
-+
-+.L_0_to_8:
-+    min     a4, a4, a2
-+.L_head:
-+    sub     a2, a2, a4
- 0:
--    lbu     a4, 0(a0)
--    beq     a1, a4, 2f
--    addi    a2, a2, -1
-+    lbu     a3, 0(a0)
-+    beq     a1, a3, .L_find_byte
-+    addi    a4, a4, -1
-     addi    a0, a0, 1
--    bnez    a2, 0b
--1:
--    li      a0, 0
--    ret
--2:
--    ret
--.L_8_to_16:
--    gen_pat
--    li      a3, 16
--    bgtu    a2, a3, .L_over_16
--    addi    a2, a2, -8
--    chr_8B
--    add     a0, a0, a2
--    chr_8B
--    j       .L_not_find
--.L_over_16:
--    neg     t4, a0
--    andi    t4, t4, 0x7
--    beqz    t4, .L_dst_aligned
--    chr_8B
--    sub     a2, a2, t4
--    add     a0, a0, t4
-+    bnez    a4, 0b
-+    beqz    a2, .L_not_find
-+
- .L_dst_aligned:
--    andi    t0, a2, (16-1)
-+    andi    a4, a2, (16-1)
-     srli    a2, a2, 4
-     beqz    a2, .L_tail
-+    
-+    slli    a3, a1, 8
-+    or      a1, a1, a3
-+    slli    a3, a1, 16
-+    or      a1, a1, a3
-+    slli    a3, a1, 32
-+    or      a1, a1, a3
-+    li      a5, -1
- .L_loop:
--    chr_8B
--    add     a0, a0, 8
--    chr_8B
-+    ld      a3, 0(a0)
-+    xor     a3, a3, a1
-+    orc.b   a3, a3
-+    bne     a3, a5, .L_find
-+    addi    a0, a0, 8
-+    
-+    ld      a3, 0(a0)
-+    xor     a3, a3, a1
-+    orc.b   a3, a3
-+    bne     a3, a5, .L_find
-+    
-     addi    a2, a2, -1
-     add     a0, a0, 8
-     bnez    a2, .L_loop
--    beqz    t0, .L_not_find
-+    beqz    a4, .L_not_find
-+
- .L_tail:
--    add     a0, a0, t0
--    addi    a0, a0, -16
--    chr_8B
--    add     a0, a0, 8
--    chr_8B
-+    andi    a1, a1, 0xff
-+0:
-+    lbu     a3, 0(a0)
-+    beq     a1, a3, .L_find_byte
-+    addi    a4, a4, -1
-+    addi    a0, a0, 1
-+    bnez    a4, 0b
-+
- .L_not_find:
-     li      a0, 0
-     ret
- .L_find:
-+    not     a3, a3
-     ctz     a3, a3
-     srli    a3, a3, 3
-     add     a0, a0, a3
-+.L_find_byte:
-     ret
- END (memchr)
- libc_hidden_builtin_def (memchr)
-diff --git a/sysdeps/riscv/rv64/multiarch/memcmp_as.S b/sysdeps/riscv/rv64/multiarch/memcmp_as.S
-index 984aeb7645..972f6cb5fd 100644
---- a/sysdeps/riscv/rv64/multiarch/memcmp_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/memcmp_as.S
-@@ -17,84 +17,46 @@
-    <http://www.gnu.org/licenses/>.  */
- 
- #include <sysdep.h>
-+.option arch, +zbb
- 
- 	.p2align 6
- ENTRY (memcmp)
--    li      a3, 32
-     mv      a5, a0
--    bgtu    a2, a3, .L_over_32
--    li      a3, 3
--    bgtu    a2, a3, .L_4_to_8
--.L_0_to_3:
--    beqz    a2, 2f
-+    li      a4, 9
-+    bltu    a2, a4, .L_0_to_8
-+
-+    neg     a4, a5
-+    andi    a4, a4, 0x7
-+    beqz    a4, .L_8B_aligned
-+
-+.L_0_to_8:
-+    min     a4, a4, a2
-+.L_head:
-+    beqz    a4, 2f
-+    sub     a2, a2, a4
-+    add     a4, a4, a5
- 0:
-     lbu     a3, 0(a1)
--    lbu     a4, 0(a5)
--    bne     a3, a4, 1f
--    addi    a2, a2, -1
-+    lbu     a0, 0(a5)
-+    bne     a3, a0, 1f
-     addi    a1, a1, 1
-     addi    a5, a5, 1
--    bnez    a2, 0b
-+    bltu    a5, a4, 0b
-+    beqz    a2, 2f
-+    j       .L_8B_aligned
- 1:
--    sub     a0, a4, a3
-+    sub     a0, a0, a3
-     ret
- 2:
-     li      a0, 0
-     ret
--.L_4_to_8:
--    li      a3, 8
--    bgtu    a2, a3, .L_9_to_16
--    lwu     a3, 0(a1)
--    lwu     a0, 0(a5)
--    bne     a3, a0, .L_end
--    add     a1, a1, a2
--    add     a5, a5, a2
--    lwu     a3, -4(a1)
--    lwu     a0, -4(a5)
--    j       .L_end
--.L_9_to_16:
--    li      a3, 16
--    bgtu    a2, a3, .L_17_to_32
--    addi    a2, a2, -8
--    ld      a3, 0(a1)
--    ld      a0, 0(a5)
--    bne     a3, a0, .L_end
--    add     a1, a1, a2
--    add     a5, a5, a2
--    ld      a3, 0(a1)
--    ld      a0, 0(a5)
--    j       .L_end
--.L_17_to_32:
--    addi    a2, a2, -16
--    ld      a3, 0(a1)
--    ld      a0, 0(a5)
--    bne     a3, a0, .L_end
--    ld      a3, 8(a1)
--    ld      a0, 8(a5)
--    bne     a3, a0, .L_end
--    add     a1, a1, a2
--    add     a5, a5, a2
--    ld      a3, 0(a1)
--    ld      a0, 0(a5)
--    bne     a3, a0, .L_end
--    ld      a3, 8(a1)
--    ld      a0, 8(a5)
--    j       .L_end
--.L_over_32:
--    neg     a4, a5
--    andi    a4, a4, 0x7
--    beqz    a4, .L_dst_aligned
--    ld      a3, 0(a1)
--    ld      a0, 0(a5)
--    bne     a3, a0, .L_end
--    sub     a2, a2, a4
--    add     a5, a5, a4
--    add     a1, a1, a4
--.L_dst_aligned:
--    andi    a4, a2, -32
--    andi    a2, a2, (32-1)
--    beqz    a4, .L_tail
-+.L_8B_aligned:
-+    andi    a4, a2, -16
-+    beqz    a4, .L_byte
-     add     a4, a4, a5
-+    andi    t5, a1, 0x7
-+    andi    a2, a2, (16-1)
-+    bnez    t5, .L_merge
- .L_loop:
-     ld      a3, 0(a1)
-     ld      a0, 0(a5)
-@@ -102,36 +64,14 @@ ENTRY (memcmp)
-     ld      a3, 8(a1)
-     ld      a0, 8(a5)
-     bne     a3, a0, .L_end
--    ld      a3, 16(a1)
--    ld      a0, 16(a5)
--    bne     a3, a0, .L_end
--    ld      a3, 24(a1)
--    ld      a0, 24(a5)
--    bne     a3, a0, .L_end
--    addi    a5, a5, 32
--    addi    a1, a1, 32
-+    addi    a5, a5, 16
-+    addi    a1, a1, 16
-     bltu    a5, a4, .L_loop
--    beqz    a2, .L_end
--.L_tail:
--    andi    a4, a2, -8
--    beqz    a4, .L_last
--    add     a4, a4, a5
--0:
--    ld      a3, 0(a1)
--    ld      a0, 0(a5)
--    bne     a3, a0, .L_end
--    add     a5, a5, 8
--    add     a1, a1, 8
--    bltu    a5, a4, 0b
-+    bnez    a2, .L_byte
- 
--.L_last:
--    andi    a2, a2, (8-1)
--    beqz    a2, 3f
--    add     a1, a1, a2
--    add     a5, a5, a2
--    ld      a3, -8(a1)
--    ld      a0, -8(a5)
- .L_end:
-+    rev8    a0, a0
-+    rev8    a3, a3
-     bltu    a0, a3, 2f
-     beq     a0, a3, 3f
-     li      a0, 1
-@@ -142,6 +82,55 @@ ENTRY (memcmp)
- 3:
-     li      a0, 0
-     ret
-+
-+.L_byte:
-+    add     a2, a2, a5
-+0:
-+    lbu     a3, 0(a1)
-+    lbu     a4, 0(a5)
-+    bne     a3, a4, 1f
-+    addi    a5, a5, 1
-+    addi    a1, a1, 1
-+    bltu    a5, a2, 0b
-+1:
-+    sub     a0, a4, a3
-+    ret
-+2:
-+    li      a0, 0
-+    ret
-+
-+    .balign 4
-+    .option push
-+    .option norvc
-+.L_merge:
-+    andi    a1, a1, -8
-+    ld      t2, 0(a1)
-+    slli    t3, t5, 3
-+    neg     t4, t3
-+    andi    t4, t4, (64 - 1)
-+    srl     t1, t2, t3
-+1:
-+    ld      t2, 8(a1)
-+    sll     a3, t2, t4
-+    or      a3, a3, t1
-+    ld      a0, 0(a5)
-+    bne     a3, a0, .L_end
-+    srl     t1, t2, t3
-+
-+    ld      t2, 16(a1)
-+    sll     a3, t2, t4
-+    or      a3, a3, t1
-+    ld      a0, 8(a5)
-+    bne     a3, a0, .L_end
-+    srl     t1, t2, t3
-+    .option pop
-+
-+    addi    a5, a5, 16
-+    addi    a1, a1, 16
-+    bltu    a5, a4, 1b
-+    beqz    a2, .L_end
-+    add     a1, a1, t5
-+    j       .L_byte
- END (memcmp)
- libc_hidden_builtin_def (memcmp)
- 
-diff --git a/sysdeps/riscv/rv64/multiarch/memcpy_as.S b/sysdeps/riscv/rv64/multiarch/memcpy_as.S
-index 4a97d75545..fae522684c 100644
---- a/sysdeps/riscv/rv64/multiarch/memcpy_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/memcpy_as.S
-@@ -32,73 +32,50 @@
- 
-     .p2align 6
- ENTRY (memcpy)
--    li      a3, 32
-     mv      a5, a0
--    bgtu    a2, a3, .L_over_32
--    li      a3, 4
--    bgtu    a2, a3, .L_5_to_8
--.L_0_to_4:
--    beqz    a2, 1f
--    lb      a4, 0(a1)
--    sb      a4, 0(a5)
--    /* process [n-1] */
--    add     t1, a1, a2
--    lb      a4, -1(t1)
--    add     t0, a5, a2
--    sb      a4, -1(t0)
--    li      a3, 2
--    bleu    a2, a3, 1f
--    lb      a4, 2(a1)
--    sb      a4, 2(a5)
--    lb      a4, 1(a1)
--    sb      a4, 1(a5)
--1:
--    ret
--.L_5_to_8:
--    li      a3, 8
--    bgtu    a2, a3, .L_9_to_16
--    lw      a3, 0(a1)
--    sw      a3, 0(a5)
--    add     a1, a1, a2
--    add     a5, a5, a2
--    lw      a3, -4(a1)
--    sw      a3, -4(a5)
--    ret
--.L_9_to_16:
--    li      a3, 16
--    bgtu    a2, a3, .L_17_to_32
--    ld      a3, 0(a1)
--    sd      a3, 0(a5)
--    add     a1, a1, a2
--    add     a5, a5, a2
--    ld      a3, -8(a1)
--    sd      a3, -8(a5)
--    ret
--.L_17_to_32:
--    addi    a2, a2, -16
--    ld      a3, 0(a1)
--    sd      a3, 0(a5)
--    ld      a3, 8(a1)
--    sd      a3, 8(a5)
--    add     a1, a1, a2
--    add     a5, a5, a2
--    ld      a3, 0(a1)
--    sd      a3, 0(a5)
--    ld      a3, 8(a1)
--    sd      a3, 8(a5)
--    ret
--.L_over_32:
-+    li      a4, 9
-+    bltu    a2, a4, .L_byte
-+
-     neg     a4, a5
-     andi    a4, a4, 0x7
-     beqz    a4, .L_dst_aligned
--    ld      a3, 0(a1)
--    sd      a3, 0(a5)
--    sub     a2, a2, a4
-+    j       .L_pc_0
-+
-+.L_byte:
-+    mv      a4, a2
-+
-+.L_pc_0:
-+    auipc   a3, 0
-+    slli    t0, a4, 3
-+    sub     a3, a3, t0
-+    .equ    offset_0, .L_jmp_end_0 - .L_pc_0
-+    jalr    x0, a3, %lo(offset_0)
-+    lb      a3, 7(a1)
-+    sb      a3, 7(a5)
-+    lb      a3, 6(a1)
-+    sb      a3, 6(a5)
-+    lb      a3, 5(a1)
-+    sb      a3, 5(a5)
-+    lb      a3, 4(a1)
-+    sb      a3, 4(a5)
-+    lb      a3, 3(a1)
-+    sb      a3, 3(a5)
-+    lb      a3, 2(a1)
-+    sb      a3, 2(a5)
-+    lb      a3, 1(a1)
-+    sb      a3, 1(a5)
-+    lb      a3, 0(a1)
-+    sb      a3, 0(a5)
-+.L_jmp_end_0:
-+    sub     a2, a2, a4          /* update cnt */
-+    beqz    a2, .L_ret
-     add     a5, a5, a4
-     add     a1, a1, a4
-+
- .L_dst_aligned:
-+    andi    t5, a1, 0x7
-+    bnez    t5, .L_merge
-     andi    a4, a2, -32
--    andi    a2, a2, (32-1)
-     beqz    a4, .L_tail
-     add     a4, a4, a5
- .L_loop:
-@@ -106,29 +83,57 @@ ENTRY (memcpy)
-     addi    a5, a5, 32
-     addi    a1, a1, 32
-     bltu    a5, a4, .L_loop
-+    andi    a2, a2, (32-1)
-     beqz    a2, .L_ret
-+
- .L_tail:
--    andi    a4, a2, -1
-+    andi    a4, a2, -8
- .L_pc:
-     auipc   a3, 0
--    andi    a4, a4, -8
--    srli    a4, a4, 1
--    sub     a3, a3, a4
-+    srli    t0, a4, 1
-+    sub     a3, a3, t0
-     .equ    offset, .L_jmp_end - .L_pc
-     jalr    x0, a3, %lo(offset)
--    ld      a3, 16(a1) # offset-12
-+    ld      a3, 16(a1)
-     sd      a3, 16(a5)
--    ld      a3, 8(a1)  # offset-8
-+    ld      a3, 8(a1)
-     sd      a3, 8(a5)
--    ld      a3, 0(a1)  # offset-4
-+    ld      a3, 0(a1)
-     sd      a3, 0(a5)
- .L_jmp_end:
--    add     a1, a1, a2
--    add     a5, a5, a2
--    ld      a3, -8(a1)
--    sd      a3, -8(a5)
-+    add     a1, a1, a4
-+    add     a5, a5, a4
-+    andi    a2, a2, (8 - 1)     /* update cnt */
-+    j       .L_byte
-+
- .L_ret:
-     ret
-+
-+    .balign 4
-+.L_merge:
-+    andi    a4, a2, -8
-+    andi    a2, a2, (8 - 1)     /* update cnt */
-+    beqz    a4, .L_byte
-+    add     a4, a4, a5
-+    andi    a1, a1, -8
-+    ld      t2, 0(a1)
-+    slli    t3, t5, 3
-+    neg     t4, t3
-+    andi    t4, t4, (64 - 1)
-+    srl     t1, t2, t3
-+1:
-+    ld      t2, 8(a1)
-+    sll     a3, t2, t4
-+    or      a3, a3, t1
-+    sd      a3, 0(a5)
-+    srl     t1, t2, t3
-+
-+    addi    a5, a5, 8
-+    addi    a1, a1, 8
-+    bltu    a5, a4, 1b
-+    beqz    a2, .L_ret
-+    add     a1, a1, t5
-+    j       .L_byte
- END (memcpy)
- 
- libc_hidden_builtin_def (memcpy)
-diff --git a/sysdeps/riscv/rv64/multiarch/memmove_as.S b/sysdeps/riscv/rv64/multiarch/memmove_as.S
-index 222b87b9c8..b8275b6dd7 100644
---- a/sysdeps/riscv/rv64/multiarch/memmove_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/memmove_as.S
-@@ -35,10 +35,10 @@ ENTRY (memmove)
-     bltu    a3, a2, .L_overlap
-     j       memcpy
- .L_overlap:
--    li      a4, 8
-     bltu    a1, a0, .L_backward
-     mv      a5, a0
--    bltu    a2, a4, .L_byte_fwd
-+    li      a3, 8
-+    bltu    a2, a3, .L_byte_fwd
-     neg     a4, a0
-     andi    a4, a4, 0x7
-     beqz    a4, .L_32B_fwd
-@@ -52,6 +52,8 @@ ENTRY (memmove)
-     addi    a1, a1, 1
-     bltu    a5, a4, 0b
- .L_32B_fwd:
-+    andi    t5, a1, 0x7
-+    bnez    t5, .L_merge_fwd
-     andi    a4, a2, -32
-     andi    a2, a2, (32 - 1)
-     beqz    a4, .L_8B_fwd
-@@ -100,11 +102,36 @@ ENTRY (memmove)
- .L_ret_fwd:
-     ret
- 
-+    .balign 4
-+.L_merge_fwd:
-+    andi    a4, a2, -8
-+    beqz    a4, .L_byte_tail_fwd
-+    add     a4, a4, a5
-+    andi    a1, a1, -8
-+    ld      t2, 0(a1)
-+    slli    t3, t5, 3
-+    neg     t4, t3
-+    andi    t4, t4, (64 - 1)
-+    srl     t1, t2, t3
-+1:
-+    ld      t2, 8(a1)
-+    sll     a3, t2, t4
-+    or      a3, a3, t1
-+    sd      a3, 0(a5)
-+    srl     t1, t2, t3
-+
-+    addi    a5, a5, 8
-+    addi    a1, a1, 8
-+    bltu    a5, a4, 1b
-+    add     a1, a1, t5
-+    j       .L_byte_tail_fwd
-+
- .L_backward:
-     add     a1, a1, a2
-     add     a5, a0, a2
--    bltu    a2, a4, .L_byte_bwd
--    andi    a4, a5, 0x7
-+    li      a3, 8
-+    bltu    a2, a3, .L_byte_bwd
-+    andi    a4, a0, 0x7
-     beqz    a4, .L_32B_bwd
- .L_byte_head_bwd:
-     sub     a2, a2, a4
-@@ -116,6 +143,8 @@ ENTRY (memmove)
-     sb      a3, 0(a5)
-     bltu    a4, a5, 0b
- .L_32B_bwd:
-+    andi    t5, a1, 0x7
-+    bnez    t5, .L_merge_bwd
-     andi    a4, a2, -32
-     andi    a2, a2, (32 - 1)
-     beqz    a4, .L_8B_bwd
-@@ -163,6 +192,31 @@ ENTRY (memmove)
-     bltu    a0, a5, 0b
- .L_ret_bwd:
-     ret
-+
-+    .balign 4
-+.L_merge_bwd:
-+    andi    a4, a2, -8
-+    beqz    a4, .L_byte_tail_bwd
-+    sub     a4, a5, a4
-+    andi    a1, a1, -8
-+    ld      t2, 0(a1)   
-+    slli    t3, t5, 3
-+    neg     t4, t3
-+    andi    t4, t4, (64 - 1)
-+    sll     t1, t2, t4
-+1:
-+    ld      t2, -8(a1)
-+    srl     a3, t2, t3
-+    or      a3, a3, t1
-+    sd      a3, -8(a5)
-+    sll     t1, t2, t4
-+    
-+    addi    a5, a5, -8
-+    addi    a1, a1, -8
-+    bltu    a4, a5, 1b
-+    add     a1, a1, t5 
-+    j       .L_byte_tail_bwd
-+
- END (memmove)
- 
- libc_hidden_builtin_def (memmove)
-diff --git a/sysdeps/riscv/rv64/multiarch/memrchr.S b/sysdeps/riscv/rv64/multiarch/memrchr.S
-index 01c2d949de..b72a13e62a 100644
---- a/sysdeps/riscv/rv64/multiarch/memrchr.S
-+++ b/sysdeps/riscv/rv64/multiarch/memrchr.S
-@@ -21,96 +21,80 @@
- 
- .option arch, +zbb
- 
--.macro chr_8B
--    ld      a4, -8(a0)
--    xor     a4, a4, a1
--    sub     a3, a4, t1
--    andn    a3, a3, a4
--    and     a3, a3, a5
--    bnez    a3, .L_find
--.endm
--.macro gen_pat
--    slli    a3, a1, 8
--    or      a1, a1, a3
--    slli    a3, a1, 16
--    or      a1, a1, a3
--    slli    a3, a1, 32
--    or      a1, a1, a3
--
--    li      a5, 0x80
--    slli    a3, a5, 8
--    or      a5, a5, a3
--    slli    a3, a5, 16
--    or      a5, a5, a3
--    slli    a3, a5, 32
--    or      a5, a5, a3  # 0x8080808080808080
--    srli    t1, a5, 7   # 0x0101010101010101
--.endm
--
-     .p2align 6
- #ifndef MEMRCHR
- ENTRY (__memrchr)
- #else
- ENTRY (MEMRCHR)
- #endif
--    li      a3, 7
-+    beqz    a2, .L_not_find
-     add     a0, a0, a2
--    bgtu    a2, a3, .L_8_to_16
--.L_0_to_7:
--    beqz    a2, 1f
-+    li      a4, 9
-+    bltu    a2, a4, .L_0_to_8 
-+    
-+    andi    a4, a0, 0x7
-+    beqz    a4, .L_dst_aligned
-+
-+.L_0_to_8:
-+    min     a4, a4, a2
-+.L_head:
-+    sub     a2, a2, a4
- 0:
--    lbu     a4, -1(a0)
--    beq     a1, a4, 2f
--    addi    a2, a2, -1
-+    lbu     a3, -1(a0)
-+    beq     a1, a3, .L_find_byte
-+    addi    a4, a4, -1
-     addi    a0, a0, -1
--    bnez    a2, 0b
--1:
--    li      a0, 0
--    ret
--2:
--    addi    a0, a0, -1
--    ret
--.L_8_to_16:
--    gen_pat
--    li      a3, 16
--    bgtu    a2, a3, .L_over_16
--    addi    a2, a2, -8
--    chr_8B
--    sub     a0, a0, a2
--    chr_8B
--    j       .L_not_find
--.L_over_16:
--    and     t4, a0, 0x7
--    beqz    t4, .L_dst_aligned
--    chr_8B
--    sub     a2, a2, t4
--    sub     a0, a0, t4
-+    bnez    a4, 0b
-+    beqz    a2, .L_not_find
-+
- .L_dst_aligned:
--    andi    t0, a2, (16-1)
-+    andi    a4, a2, (16-1)
-     srli    a2, a2, 4
-     beqz    a2, .L_tail
-+    
-+    slli    a3, a1, 8
-+    or      a1, a1, a3
-+    slli    a3, a1, 16
-+    or      a1, a1, a3
-+    slli    a3, a1, 32
-+    or      a1, a1, a3
-+    li      a5, -1
- .L_loop:
--    chr_8B
-+    ld      a3, -8(a0)
-+    xor     a3, a3, a1
-+    orc.b   a3, a3
-+    bne     a3, a5, .L_find 
-     addi    a0, a0, -8
--    chr_8B
-+
-+    ld      a3, -8(a0)
-+    xor     a3, a3, a1
-+    orc.b   a3, a3
-+    bne     a3, a5, .L_find
-+
-     addi    a2, a2, -1
-     addi    a0, a0, -8
-     bnez    a2, .L_loop
--    beqz    t0, .L_not_find
-+    beqz    a4, .L_not_find
-+
- .L_tail:
--    sub     a0, a0, t0
--    addi    a0, a0, 16
--    chr_8B
--    addi    a0, a0, -8
--    chr_8B
-+    andi    a1, a1, 0xff
-+0:
-+    lbu     a3, -1(a0)
-+    beq     a1, a3, .L_find_byte
-+    addi    a4, a4, -1
-+    addi    a0, a0, -1
-+    bnez    a4, 0b
-+
- .L_not_find:
-     li      a0, 0
-     ret
- .L_find:
-+    not     a3, a3
-     clz     a3, a3
--    addi    a0, a0, -1
-     srli    a3, a3, 3
-     sub     a0, a0, a3
-+.L_find_byte:
-+    addi    a0, a0, -1
-     ret
- #ifndef MEMRCHR
- END (__memrchr)
-diff --git a/sysdeps/riscv/rv64/multiarch/memset_as.S b/sysdeps/riscv/rv64/multiarch/memset_as.S
-index 7f67c79215..455033adf0 100644
---- a/sysdeps/riscv/rv64/multiarch/memset_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/memset_as.S
-@@ -21,53 +21,38 @@
- 
-     .p2align 6
- ENTRY (memset)
--    li      a3, 32
--    andi    a1, a1, 0xff
-     mv      a5, a0
--    bgtu    a2, a3, .L_over_32
--    li      a3, 4
--    bgtu    a2, a3, .L_5_to_8
--.L_0_to_4:
--    beqz    a2, 1f
--    sb      a1, 0(a5)
--    add     t0, a5, a2
--    sb      a1, -1(t0)
--    li      a3, 2
--    bleu    a2, a3, 1f
--    sb      a1, 1(a5)
-+    andi    a1, a1, 0xff
-+    li      a4, 9
-+    bltu    a2, a4, .L_0_to_8 
-+    
-+    neg     a4, a5
-+    andi    a4, a4, 0x7
-+    beqz    a4, .L_dst_aligned
-+    j       .L_pc_0
-+.L_0_to_8:
-+    mv      a4, a2
-+
-+.L_pc_0:
-+    auipc   a3, 0
-+    slli    t0, a4, 2
-+    sub     a3, a3, t0
-+    .equ    offset_0, .L_jmp_end_0 - .L_pc_0
-+    jalr    x0, a3, %lo(offset_0)
-+    sb      a1, 7(a5)
-+    sb      a1, 6(a5)
-+    sb      a1, 5(a5)
-+    sb      a1, 4(a5)
-+    sb      a1, 3(a5)
-     sb      a1, 2(a5)
--1:
--    ret
--.L_5_to_8:
--    slli    a3, a1, 8
--    or      a1, a1, a3
--    slli    a3, a1, 16
--    or      a1, a1, a3
--    li      a3, 8
--    bgtu    a2, a3, .L_9_to_16
--    sw      a1, 0(a5)
--    add     a5, a5, a2
--    sw      a1, -4(a5)
--    ret
--.L_9_to_16:
--    li      a3, 16
--    bgtu    a2, a3, .L_17_to_32
--    sw      a1, 0(a5)
--    sw      a1, 4(a5)
--    add     a5, a5, a2
--    sw      a1, -8(a5)
--    sw      a1, -4(a5)
--    ret
--.L_17_to_32:
--    slli    a3, a1, 32
--    or      a1, a1, a3
--    sd      a1, 0(a5)
--    sd      a1, 8(a5)
--    add     a5, a5, a2
--    sd      a1, -16(a5)
--    sd      a1, -8(a5)
--    ret
--.L_over_32:
-+    sb      a1, 1(a5)
-+    sb      a1, 0(a5)
-+.L_jmp_end_0:
-+    sub     a2, a2, a4          /* update cnt */
-+    beqz    a2, .L_ret
-+    add     a5, a5, a4
-+
-+.L_dst_aligned:
-     slli    a3, a1, 8
-     or      a1, a1, a3
-     slli    a3, a1, 16
-@@ -75,17 +60,10 @@ ENTRY (memset)
-     slli    a3, a1, 32
-     or      a1, a1, a3
- 
--    neg     a4, a5
--    andi    a4, a4, 0x7
--    beqz    a4, .L_dst_aligned
--    sd      a1, 0(a5)
--    sub     a2, a2, a4
--    add     a5, a5, a4
--.L_dst_aligned:
-     andi    a4, a2, -64
--    andi    a2, a2, (64-1)
-     beqz    a4, .L_tail
-     add     a4, a4, a5
-+
- .L_loop:
-     sd      a1, 0(a5)
-     sd      a1, 8(a5)
-@@ -97,27 +75,44 @@ ENTRY (memset)
-     sd      a1, 56(a5)
-     addi    a5, a5, 64
-     bltu    a5, a4, .L_loop
-+    andi    a2, a2, (64-1)      /* update cnt */
-     beqz    a2, .L_ret
-+
- .L_tail:
--    andi    a4, a2, -1
-+    andi    a4, a2, -8
- .L_pc:
-     auipc   a3, 0
--    andi    a4, a4, -8
--    srli    a4, a4, 2
--    sub     a3, a3, a4
-+    srli    t0, a4, 2
-+    sub     a3, a3, t0
-     .equ    offset, .L_jmp_end - .L_pc
-     jalr    x0, a3, %lo(offset)
--    sd      a1, 48(a5)
--    sd      a1, 40(a5)
--    sd      a1, 32(a5)
--    sd      a1, 24(a5)
--    sd      a1, 16(a5)
--    sd      a1, 8(a5)
--    sd      a1, 0(a5)
-+    sd      a1, 6*8(a5)
-+    sd      a1, 5*8(a5)
-+    sd      a1, 4*8(a5)
-+    sd      a1, 3*8(a5)
-+    sd      a1, 2*8(a5)
-+    sd      a1, 1*8(a5)
-+    sd      a1, 0*8(a5)
- .L_jmp_end:
--    add     a5, a5, a2
--    sd      a1, -8(a5)
-- .L_ret:
-+    add     a5, a5, a4
-+    andi    a4, a2, (8 - 1)     /* update cnt */
-+
-+.L_tail_byte:
-+.L_pc_2:
-+    auipc   a3, 0
-+    slli    a4, a4, 2
-+    sub     a3, a3, a4
-+    .equ    offset_2, .L_jmp_end_2 - .L_pc_2
-+    jalr    x0, a3, %lo(offset_2)
-+    sb      a1, 6(a5)
-+    sb      a1, 5(a5)
-+    sb      a1, 4(a5)
-+    sb      a1, 3(a5)
-+    sb      a1, 2(a5)
-+    sb      a1, 1(a5)
-+    sb      a1, 0(a5)
-+.L_jmp_end_2:
-+.L_ret:
-     ret
- END (memset)
- libc_hidden_builtin_def (memset)
--- 
-2.25.1
-

+ 2 - 2
recipes-core/glibc/glibc/0017-powerpc-Do-not-ask-compiler-for-finding-arch.patch → recipes-core/glibc/glibc/0015-powerpc-Do-not-ask-compiler-for-finding-arch.patch

@@ -1,4 +1,4 @@
-From 93c5b86fae5e42e148e5182466eb0ac26298159c Mon Sep 17 00:00:00 2001
+From fae5ee7d7b9dca2f25684a99f7046042d870235f Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 7 Aug 2020 14:31:16 -0700
 Subject: [PATCH] powerpc: Do not ask compiler for finding arch
@@ -15,7 +15,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  2 files changed, 2 insertions(+), 8 deletions(-)
 
 diff --git a/sysdeps/powerpc/preconfigure b/sysdeps/powerpc/preconfigure
-index dfe8e20399..bbff040f0f 100644
+index 4de94089a3..428ad7b162 100644
 --- a/sysdeps/powerpc/preconfigure
 +++ b/sysdeps/powerpc/preconfigure
 @@ -29,10 +29,7 @@ esac

+ 0 - 29
recipes-core/glibc/glibc/0016-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch

@@ -1,29 +0,0 @@
-From 58dd1336c1c32716f4f0938bf18f2ddfbe9305ca Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 18 Mar 2015 00:11:22 +0000
-Subject: [PATCH] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known names
-
-This bolts in a hook for OE to pass its own version of interpreter
-names into glibc especially for multilib case, where it differs from any
-other distros
-
-Upstream-Status: Inappropriate [OE specific]
-
-Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- elf/readlib.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/elf/readlib.c b/elf/readlib.c
-index ed42fbd48e..777f6c80be 100644
---- a/elf/readlib.c
-+++ b/elf/readlib.c
-@@ -49,6 +49,7 @@ static struct known_names interpreters[] =
- #ifdef SYSDEP_KNOWN_INTERPRETER_NAMES
-   SYSDEP_KNOWN_INTERPRETER_NAMES
- #endif
-+  OECORE_KNOWN_INTERPRETER_NAMES
- };
- 
- static struct known_names known_libs[] =

+ 0 - 675
recipes-core/glibc/glibc/0016-strxxx-B-ext-opt-version.patch

@@ -1,675 +0,0 @@
-From cb7b9da1f6e784440bbebc2377acc0e6d888e1a4 Mon Sep 17 00:00:00 2001
-From: "yilun.xie" <yilun.xie@starfivetech.com>
-Date: Wed, 10 Aug 2022 00:16:46 -0700
-Subject: [PATCH 16/19] strxxx B ext opt version
-
----
- sysdeps/riscv/rv64/multiarch/Makefile         |  3 +-
- .../riscv/rv64/multiarch/ifunc-impl-list.c    | 12 +++
- sysdeps/riscv/rv64/multiarch/rtld-strchr.S    |  1 +
- sysdeps/riscv/rv64/multiarch/rtld-strchrnul.S |  1 +
- sysdeps/riscv/rv64/multiarch/rtld-strlen.S    |  1 +
- sysdeps/riscv/rv64/multiarch/rtld-strlen.c    |  1 -
- sysdeps/riscv/rv64/multiarch/rtld-strncmp.S   |  1 +
- sysdeps/riscv/rv64/multiarch/strcmp.c         |  1 -
- sysdeps/riscv/rv64/multiarch/strcmp_as.S      | 85 ++++++++++++++++---
- sysdeps/riscv/rv64/multiarch/strcmp_riscv.S   | 17 ++++
- sysdeps/riscv/rv64/multiarch/strlen_as.S      | 56 ++++++++++++
- .../{strlen_riscv.c => strlen_riscv.S}        | 23 ++---
- sysdeps/riscv/rv64/strchr.S                   | 81 ++++++++++++++++++
- sysdeps/riscv/rv64/strchrnul.S                | 79 +++++++++++++++++
- sysdeps/riscv/rv64/strncmp.S                  | 73 ++++++++++++++++
- sysdeps/riscv/rv64/strnlen.S                  | 62 ++++++++++++++
- 16 files changed, 471 insertions(+), 26 deletions(-)
- create mode 100644 sysdeps/riscv/rv64/multiarch/rtld-strchr.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/rtld-strchrnul.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/rtld-strlen.S
- delete mode 100644 sysdeps/riscv/rv64/multiarch/rtld-strlen.c
- create mode 100644 sysdeps/riscv/rv64/multiarch/rtld-strncmp.S
- create mode 100644 sysdeps/riscv/rv64/multiarch/strlen_as.S
- rename sysdeps/riscv/rv64/multiarch/{strlen_riscv.c => strlen_riscv.S} (60%)
- create mode 100644 sysdeps/riscv/rv64/strchr.S
- create mode 100644 sysdeps/riscv/rv64/strchrnul.S
- create mode 100644 sysdeps/riscv/rv64/strncmp.S
- create mode 100644 sysdeps/riscv/rv64/strnlen.S
-
-diff --git a/sysdeps/riscv/rv64/multiarch/Makefile b/sysdeps/riscv/rv64/multiarch/Makefile
-index 7e8bfde544..3123ced35d 100644
---- a/sysdeps/riscv/rv64/multiarch/Makefile
-+++ b/sysdeps/riscv/rv64/multiarch/Makefile
-@@ -1,5 +1,6 @@
- ifeq ($(subdir),string)
- sysdep_routines += memcpy_vector memcpy_riscv memchr_riscv memchr_vector memcmp_riscv \
-                  memcmp_vector strcmp_riscv strcmp_vector strlen_riscv strlen_vector \
--                 memmove_vector memmove_riscv memset_vector memset_riscv memrchr
-+                 memmove_vector memmove_riscv memset_vector memset_riscv memrchr \
-+                  
- endif
-diff --git a/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c b/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c
-index 1a6611ab88..7bba6fa30c 100644
---- a/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c
-+++ b/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c
-@@ -60,6 +60,18 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
-   IFUNC_IMPL (i, name, memset,
- 	      IFUNC_IMPL_ADD (array, i, memset, use_rvv, __memset_vector)
- 	      IFUNC_IMPL_ADD (array, i, memset, 1, __memset_riscv));
-+
-+  IFUNC_IMPL (i, name, strchr,
-+	      IFUNC_IMPL_ADD (array, i, strchr, use_rvv, __strchr_riscv)
-+	      IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_riscv));
-+
-+  IFUNC_IMPL (i, name, strchrnul,
-+	      IFUNC_IMPL_ADD (array, i, strchrnul, use_rvv, __strchrnul_riscv)
-+	      IFUNC_IMPL_ADD (array, i, strchrnul, 1, __strchrnul_riscv));
-+
-+  IFUNC_IMPL (i, name, strncmp,
-+	      IFUNC_IMPL_ADD (array, i, strncmp, use_rvv, __strncmp_riscv)
-+	      IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_riscv));
- #endif
-   return i;
- }
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-strchr.S b/sysdeps/riscv/rv64/multiarch/rtld-strchr.S
-new file mode 100644
-index 0000000000..d969c0ab57
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/rtld-strchr.S
-@@ -0,0 +1 @@
-+#include "../strchr.S"
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-strchrnul.S b/sysdeps/riscv/rv64/multiarch/rtld-strchrnul.S
-new file mode 100644
-index 0000000000..5799994393
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/rtld-strchrnul.S
-@@ -0,0 +1 @@
-+#include "../strchrnul.S"
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-strlen.S b/sysdeps/riscv/rv64/multiarch/rtld-strlen.S
-new file mode 100644
-index 0000000000..801def494d
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/rtld-strlen.S
-@@ -0,0 +1 @@
-+#include "strlen_as.S"
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-strlen.c b/sysdeps/riscv/rv64/multiarch/rtld-strlen.c
-deleted file mode 100644
-index d3f1dd4a23..0000000000
---- a/sysdeps/riscv/rv64/multiarch/rtld-strlen.c
-+++ /dev/null
-@@ -1 +0,0 @@
--# include <string/strlen.c>
-diff --git a/sysdeps/riscv/rv64/multiarch/rtld-strncmp.S b/sysdeps/riscv/rv64/multiarch/rtld-strncmp.S
-new file mode 100644
-index 0000000000..c5a02a137c
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/rtld-strncmp.S
-@@ -0,0 +1 @@
-+#include "../strncmp.S"
-diff --git a/sysdeps/riscv/rv64/multiarch/strcmp.c b/sysdeps/riscv/rv64/multiarch/strcmp.c
-index 3b65aaf55d..d18ae03246 100644
---- a/sysdeps/riscv/rv64/multiarch/strcmp.c
-+++ b/sysdeps/riscv/rv64/multiarch/strcmp.c
-@@ -28,7 +28,6 @@
- # include "ifunc-common.h"
- 
- riscv_libc_ifunc_redirected (__redirect_strcmp, strcmp, IFUNC_SELECTOR);
--
- riscv_libc_ifunc_hidden_def (__redirect_strcmp, strcmp);
- #else 
- # include <string.h>
-diff --git a/sysdeps/riscv/rv64/multiarch/strcmp_as.S b/sysdeps/riscv/rv64/multiarch/strcmp_as.S
-index db5a6346b8..40bdbfef08 100644
---- a/sysdeps/riscv/rv64/multiarch/strcmp_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/strcmp_as.S
-@@ -19,21 +19,82 @@
-    <http://www.gnu.org/licenses/>.  */
- 
- #include <sysdep.h>
-+#define N 3
- 
- 	.p2align 6
- ENTRY (strcmp)
--.L_strcmp_by_byte:
--   lbu	a5,0(a0)
--   addi	a1,a1,1
--   addi	a0,a0,1
--   lbu	a4,-1(a1)
--   beqz	a5,.L_strcmp_by_byte_exit
--   beq	a5,a4,.L_strcmp_by_byte
--   subw	a0,a5,a4
--   ret
--.L_strcmp_by_byte_exit:
--   negw	a0,a4
--   ret
-+  or    a4, a0, a1
-+  li    t2, -1
-+  and   a4, a4, 7
-+  beqz  a4, .Lenter
-+  j .Lmisaligned
-+
-+  .macro check_one_word i n
-+    ld a2, \i*8(a0)
-+    ld a3, \i*8(a1)
-+
-+    orc.b t0, a2
-+
-+    bne   t0, t2, .Lnull\i
-+    .if \i+1-\n
-+      bne   a2, a3, .Lmismatch
-+    .else
-+      beq   a2, a3, .Lloop
-+      # fall through to .Lmismatch
-+    .endif
-+  .endm
-+
-+  .macro foundnull i n
-+    .ifne \i
-+      .Lnull\i:
-+      add   a0, a0, \i*8
-+      add   a1, a1, \i*8
-+      .ifeq \i-1
-+        .Lnull0:
-+      .endif
-+      bne   a2, a3, .Lmisaligned
-+      li    a0, 0
-+      ret
-+    .endif
-+  .endm
-+
-+.Lloop:
-+  add   a0, a0, N*8
-+  add   a1, a1, N*8
-+
-+.Lenter:
-+  # examine full words at a time, favoring strings of a couple dozen chars
-+  check_one_word 0 N
-+  check_one_word 1 N
-+  check_one_word 2 N
-+  # backwards branch to .Lloop contained above
-+
-+.Lmismatch:
-+  rev8 a4, a2
-+  rev8 a5, a3
-+  bgeu a4, a5, 1f
-+  li a0, -1
-+  ret
-+1:
-+  li a0, 1
-+  ret
-+
-+.Lmisaligned:
-+  # misaligned
-+  lbu   a2, 0(a0)
-+  lbu   a3, 0(a1)
-+  add   a0, a0, 1
-+  add   a1, a1, 1
-+  bne   a2, a3, 1f
-+  bnez  a2, .Lmisaligned
-+1:
-+  sub   a0, a2, a3
-+  ret
-+
-+  # cases in which a null byte was detected
-+  foundnull 0 N
-+  foundnull 1 N
-+  foundnull 2 N
- 
- END (strcmp)
- libc_hidden_builtin_def (strcmp)
-diff --git a/sysdeps/riscv/rv64/multiarch/strcmp_riscv.S b/sysdeps/riscv/rv64/multiarch/strcmp_riscv.S
-index abf2984230..8a2bfa9629 100644
---- a/sysdeps/riscv/rv64/multiarch/strcmp_riscv.S
-+++ b/sysdeps/riscv/rv64/multiarch/strcmp_riscv.S
-@@ -1,3 +1,20 @@
-+/* The assembly function for strcmp.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
- 
- #include <sysdep.h>
- 
-diff --git a/sysdeps/riscv/rv64/multiarch/strlen_as.S b/sysdeps/riscv/rv64/multiarch/strlen_as.S
-new file mode 100644
-index 0000000000..862f5ebb72
---- /dev/null
-+++ b/sysdeps/riscv/rv64/multiarch/strlen_as.S
-@@ -0,0 +1,56 @@
-+/* The assembly function for strlen.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+	.p2align 6
-+ENTRY (strlen)
-+  andi  a3, a0, 7
-+  andi  a1, a0, -8
-+.Lprologue:
-+  li    a4, 8
-+  sub   a4, a4, a3
-+  slli  a3, a3, 3
-+  ld    a2, 0(a1)
-+  srl   a2, a2, a3
-+  orc.b a2, a2
-+  not   a2, a2
-+  ctz   a2, a2
-+  srli  a0, a2, 3
-+  bgtu  a4, a0, .Ldone
-+  addi  a3, a1, 8
-+  li    a4, -1
-+
-+  .align 2
-+.Lloop:
-+  ld    a2, 8(a1)
-+  addi  a1, a1, 8
-+  orc.b a2, a2
-+  beq   a2, a4, .Lloop
-+.Lepilogue:
-+  not   a2, a2
-+  ctz   a2, a2
-+  sub   a1, a1, a3
-+  add   a0, a0, a1
-+  srli  a2, a2, 3
-+  add   a0, a0, a2
-+.Ldone:
-+  ret
-+
-+END (strlen)
-+libc_hidden_builtin_def (strlen)
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/multiarch/strlen_riscv.c b/sysdeps/riscv/rv64/multiarch/strlen_riscv.S
-similarity index 60%
-rename from sysdeps/riscv/rv64/multiarch/strlen_riscv.c
-rename to sysdeps/riscv/rv64/multiarch/strlen_riscv.S
-index d3bae0fc43..d6fd969afb 100644
---- a/sysdeps/riscv/rv64/multiarch/strlen_riscv.c
-+++ b/sysdeps/riscv/rv64/multiarch/strlen_riscv.S
-@@ -1,5 +1,5 @@
--/* RISCV C version strlen.
--   Copyright (C) 2018-2021 Free Software Foundation, Inc.
-+/* The assembly function for strlen.  RISC-V version.
-+   Copyright (C) 2018 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
-@@ -13,20 +13,21 @@
-    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/>.  */
-+   License along with the GNU C Library.  If not, see
-+   <http://www.gnu.org/licenses/>.  */
- 
-+#include <sysdep.h>
- 
--#if IS_IN (libc) && defined SHARED && defined __riscv_vector
--#undef libc_hidden_builtin_def
--#define libc_hidden_builtin_def(name)
-+#if IS_IN (libc)  && defined SHARED && defined __riscv_vector
-+# define strlen __strlen_riscv
-+# undef libc_hidden_builtin_def
-+# define libc_hidden_builtin_def(name)
-+
-+# include "strlen_as.S"
- 
--#undef weak_alias
--#  define STRLEN __strlen_riscv
--# include <string/strlen.c>
- #else
-+# include "strlen_as.S"
- 
--# include <string/strlen.c>
- #endif
- 
- 
-diff --git a/sysdeps/riscv/rv64/strchr.S b/sysdeps/riscv/rv64/strchr.S
-new file mode 100644
-index 0000000000..a9059c19ca
---- /dev/null
-+++ b/sysdeps/riscv/rv64/strchr.S
-@@ -0,0 +1,81 @@
-+/* The assembly function for strchr.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+	.p2align 6
-+ENTRY (strchr)
-+  andi  a1, a1, 0xff
-+
-+.Lmisaligned:
-+  andi  a5, a0, 7
-+  beqz  a5, .Laligned
-+  lbu   a5, 0(a0)
-+  beq   a5, a1, .Ldone
-+  beqz  a5, .Lnofind
-+  addi  a0, a0, 1
-+  j .Lmisaligned
-+
-+.Laligned:
-+  slli  a5, a1, 0x8
-+  or    a5, a5, a1
-+  slli  t0, a5, 0x10
-+  or    t0, t0, a5
-+  slli  a5, t0, 0x20
-+  or    t0, t0, a5
-+
-+  li    a5, -1
-+  addi  a0, a0, -8
-+.Lloop:
-+  addi  a0, a0, 8
-+  ld    a2, 0(a0)
-+  orc.b t1, a2
-+  bne   t1, a5, .Lnull
-+  xor   a3, a2, t0
-+  orc.b a3, a3
-+  bne   a3, a5, .Lfind
-+  orc.b a2, a2
-+  beq   a2, a5, .Lloop
-+
-+.Lnofind:
-+  li    a0, 0
-+.Ldone:
-+  ret
-+
-+.Lfind:
-+  not   a3, a3
-+  ctz   a3, a3
-+  srli  a3, a3, 3
-+  add   a0, a0, a3
-+  ret
-+
-+# cases in which a null byte was detected
-+.Lnull:
-+  bne   a2, t0, .Lend
-+  j .Lfind
-+
-+.Lend:
-+  lbu   a5, 0(a0)
-+  beq   a5, a1, .Ldone
-+  beqz  a5, .Lnofind
-+  addi  a0, a0, 1
-+  j .Lend
-+     
-+
-+END (strchr)
-+libc_hidden_builtin_def (strchr)
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/strchrnul.S b/sysdeps/riscv/rv64/strchrnul.S
-new file mode 100644
-index 0000000000..3e48445f11
---- /dev/null
-+++ b/sysdeps/riscv/rv64/strchrnul.S
-@@ -0,0 +1,79 @@
-+/* The assembly function for strchrnul.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+	.p2align 6
-+ENTRY (__strchrnul)
-+  andi  a1, a1, 0xff
-+
-+.Lmisaligned:
-+  andi  a5, a0, 7
-+  beqz  a5, .Laligned
-+  lbu   a5, 0(a0)
-+  beq   a5, a1, .Ldone
-+  beqz  a5, .Ldone
-+  addi  a0, a0, 1
-+  j .Lmisaligned
-+
-+.Laligned:
-+  slli  a5, a1, 0x8
-+  or    a5, a5, a1
-+  slli  t0, a5, 0x10
-+  or    t0, t0, a5
-+  slli  a5, t0, 0x20
-+  or    t0, t0, a5
-+
-+  li    a5, -1
-+  addi  a0, a0, -8
-+.Lloop:
-+  addi  a0, a0, 8
-+  ld    a2, 0(a0)
-+  orc.b t1, a2
-+  bne   t1, a5, .Lnull
-+  xor   a3, a2, t0
-+  orc.b a3, a3
-+  bne   a3, a5, .Lfind
-+  orc.b a2, a2
-+  beq   a2, a5, .Lloop
-+
-+.Ldone:
-+  ret
-+
-+.Lfind:
-+  not   a3, a3
-+  ctz   a3, a3
-+  srli  a3, a3, 3
-+  add   a0, a0, a3
-+  ret
-+
-+# cases in which a null byte was detected
-+.Lnull:
-+  bne   a2, t0, .Lend
-+  j .Lfind
-+
-+.Lend:
-+  lbu   a5, 0(a0)
-+  beq   a5, a1, .Ldone
-+  beqz  a5, .Ldone
-+  addi  a0, a0, 1
-+  j .Lend
-+
-+END (__strchrnul)
-+weak_alias (__strchrnul,strchrnul)
-+libc_hidden_builtin_def (__strchrnul)
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/strncmp.S b/sysdeps/riscv/rv64/strncmp.S
-new file mode 100644
-index 0000000000..85245df98d
---- /dev/null
-+++ b/sysdeps/riscv/rv64/strncmp.S
-@@ -0,0 +1,73 @@
-+/* The assembly function for strncmp.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+	.p2align 6
-+ENTRY (strncmp)
-+  beqz  a2, .Lequal
-+  or    a4, a0, a1
-+  li    t2, -1
-+  and   a4, a4, 7
-+  beqz  a4, .Lenter
-+  j     .Lmisaligned
-+
-+.Lloop:
-+  addi  a0, a0, 8
-+  addi  a1, a1, 8
-+  addi  a2, a2, -8
-+
-+.Lenter:
-+  addi  a5, a2, -8
-+  blez  a5, .Lmisaligned
-+  ld    a3, 0(a0)
-+  ld    a4, 0(a1)
-+  orc.b t0, a3
-+  bne   t0, t2, .Lnull
-+  beq   a3, a4, .Lloop
-+  rev8  a6, a3
-+  rev8  a7, a4
-+  bgeu  a6, a7, 1f
-+  li    a0, -1
-+  ret
-+1:
-+  li    a0, 1
-+  ret
-+
-+.Lmisaligned:
-+  blez  a2, .Ldone
-+  lbu   a3, 0(a0)
-+  lbu   a4, 0(a1)
-+  addi  a0, a0, 1
-+  addi  a1, a1, 1
-+  addi  a2, a2, -1
-+  bne   a3, a4, .Ldone
-+  bnez  a3, .Lmisaligned
-+.Ldone:
-+  sub   a0, a3, a4
-+  ret
-+
-+# cases in which a null byte was detected
-+.Lnull:
-+  bne   a3, a4, .Lmisaligned
-+.Lequal:
-+  li    a0, 0
-+  ret
-+
-+END (strncmp)
-+libc_hidden_builtin_def (strncmp)
-\ No newline at end of file
-diff --git a/sysdeps/riscv/rv64/strnlen.S b/sysdeps/riscv/rv64/strnlen.S
-new file mode 100644
-index 0000000000..33b140a0ac
---- /dev/null
-+++ b/sysdeps/riscv/rv64/strnlen.S
-@@ -0,0 +1,62 @@
-+/* The assembly function for strnlen.  RISC-V version.
-+   Copyright (C) 2018 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
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#include <sysdep.h>
-+
-+	.p2align 6
-+ENTRY (strnlen)
-+  mv    a2, a0
-+  mv    a0, a1
-+  li    a3, -1
-+  beqz  a1, .Ldone
-+  add   a0, a2, a1
-+  bleu  a2, a0, 1f
-+  li    a0, -1
-+1:
-+  mv    a5, a2
-+
-+.Lmisaligned:
-+  andi  a4, a5, 7
-+  beqz  a4, .Lloop
-+  lbu   a4, 0(a5)
-+  beqz  a4, .Llenth
-+  addi  a5, a5, 1
-+  j     .Lmisaligned  
-+
-+.Laligned:
-+  addi  a5, a5, 8
-+  addi  a1, a1, -8
-+.Lloop:
-+  bleu  a1, x0, .Llenth
-+  ld    a4, 0(a5)
-+  orc.b a4, a4
-+  beq   a4, a3, .Laligned
-+  not   a4, a4
-+  ctz   a4, a4
-+  srli  a4, a4, 3
-+  add   a5, a5, a4
-+.Llenth:
-+  minu  a5, a5, a0
-+  sub   a0, a5, a2
-+.Ldone:
-+  ret
-+
-+END (strnlen)
-+weak_alias (strnlen, __strnlen)
-+libc_hidden_builtin_def (strnlen)
-+libc_hidden_builtin_def (__strnlen)
--- 
-2.25.1
-

+ 13 - 31
recipes-core/glibc/glibc/0018-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch → recipes-core/glibc/glibc/0016-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch

@@ -1,4 +1,4 @@
-From e2dba281429384cc22a73a58eaf79459e64be266 Mon Sep 17 00:00:00 2001
+From 91a7848698ce6c96c646f3a170714ee71eab6884 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 15 May 2020 17:05:45 -0700
 Subject: [PATCH] wordsize.h: Unify the header between arm and aarch64
@@ -11,13 +11,13 @@ Upstream-Status: Inappropriate [ OE-Specific ]
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
 ---
- sysdeps/aarch64/bits/wordsize.h          | 8 ++++++--
- sysdeps/{aarch64 => arm}/bits/wordsize.h | 8 ++++++--
- 2 files changed, 12 insertions(+), 4 deletions(-)
- copy sysdeps/{aarch64 => arm}/bits/wordsize.h (85%)
+ sysdeps/aarch64/bits/wordsize.h | 8 ++++++--
+ sysdeps/arm/bits/wordsize.h     | 1 +
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+ create mode 120000 sysdeps/arm/bits/wordsize.h
 
 diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
-index 4635431f0e..5ef0ed21f3 100644
+index 04d4be9519..63876a7830 100644
 --- a/sysdeps/aarch64/bits/wordsize.h
 +++ b/sysdeps/aarch64/bits/wordsize.h
 @@ -17,12 +17,16 @@
@@ -39,29 +39,11 @@ index 4635431f0e..5ef0ed21f3 100644
  #endif
  
  #define __WORDSIZE_TIME64_COMPAT32	0
-diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/arm/bits/wordsize.h
-similarity index 85%
-copy from sysdeps/aarch64/bits/wordsize.h
-copy to sysdeps/arm/bits/wordsize.h
-index 4635431f0e..5ef0ed21f3 100644
---- a/sysdeps/aarch64/bits/wordsize.h
+diff --git a/sysdeps/arm/bits/wordsize.h b/sysdeps/arm/bits/wordsize.h
+new file mode 120000
+index 0000000000..4c4a788ec2
+--- /dev/null
 +++ b/sysdeps/arm/bits/wordsize.h
-@@ -17,12 +17,16 @@
-    License along with the GNU C Library; if not, see
-    <https://www.gnu.org/licenses/>.  */
- 
--#ifdef __LP64__
-+#if defined (__aarch64__) && defined (__LP64__)
- # define __WORDSIZE			64
--#else
-+#elif defined (__aarch64__)
- # define __WORDSIZE			32
- # define __WORDSIZE32_SIZE_ULONG	1
- # define __WORDSIZE32_PTRDIFF_LONG	1
-+#else
-+# define __WORDSIZE			32
-+# define __WORDSIZE32_SIZE_ULONG	0
-+# define __WORDSIZE32_PTRDIFF_LONG	0
- #endif
- 
- #define __WORDSIZE_TIME64_COMPAT32	0
+@@ -0,0 +1 @@
++../../aarch64/bits/wordsize.h
+\ No newline at end of file

+ 1 - 1
recipes-core/glibc/glibc/0019-Replace-echo-with-printf-builtin-in-nscd-init-script.patch → recipes-core/glibc/glibc/0017-Replace-echo-with-printf-builtin-in-nscd-init-script.patch

@@ -1,4 +1,4 @@
-From 97a71e1dd07ba6721464150b03fd67823b6271e2 Mon Sep 17 00:00:00 2001
+From 63611cfd3b25f3656db168aee41a5850ac769dfc Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Thu, 31 Dec 2015 14:33:02 -0800
 Subject: [PATCH] Replace echo with printf builtin in nscd init script

+ 0 - 28
recipes-core/glibc/glibc/0017-fix-strchr-missing-index-weak-alias.patch

@@ -1,28 +0,0 @@
-From 3ecd64e60697cf19c98a2afb5e6f51f5f9c8fe63 Mon Sep 17 00:00:00 2001
-From: "demin.han" <demin.han@starfivetech.com>
-Date: Thu, 8 Dec 2022 15:18:15 +0800
-Subject: [PATCH 17/19] fix strchr missing 'index' weak alias
-
----
- sysdeps/riscv/rv64/strchr.S | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/sysdeps/riscv/rv64/strchr.S b/sysdeps/riscv/rv64/strchr.S
-index a9059c19ca..2d108800c1 100644
---- a/sysdeps/riscv/rv64/strchr.S
-+++ b/sysdeps/riscv/rv64/strchr.S
-@@ -78,4 +78,9 @@ ENTRY (strchr)
-      
- 
- END (strchr)
--libc_hidden_builtin_def (strchr)
-\ No newline at end of file
-+
-+#ifdef weak_alias
-+# undef index
-+weak_alias (strchr, index)
-+#endif
-+libc_hidden_builtin_def (strchr)
--- 
-2.25.1
-

+ 0 - 25
recipes-core/glibc/glibc/0018-fix-memmove-align-fail-because-of-typo.patch

@@ -1,25 +0,0 @@
-From 8461fb86ab5ac8b38bdc3114c09654362d7e9ecf Mon Sep 17 00:00:00 2001
-From: "demin.han" <demin.han@starfivetech.com>
-Date: Mon, 12 Dec 2022 15:38:27 +0800
-Subject: [PATCH 18/19] fix memmove align fail because of typo
-
----
- sysdeps/riscv/rv64/multiarch/memmove_as.S | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sysdeps/riscv/rv64/multiarch/memmove_as.S b/sysdeps/riscv/rv64/multiarch/memmove_as.S
-index b8275b6dd7..35d0905186 100644
---- a/sysdeps/riscv/rv64/multiarch/memmove_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/memmove_as.S
-@@ -131,7 +131,7 @@ ENTRY (memmove)
-     add     a5, a0, a2
-     li      a3, 8
-     bltu    a2, a3, .L_byte_bwd
--    andi    a4, a0, 0x7
-+    andi    a4, a5, 0x7
-     beqz    a4, .L_32B_bwd
- .L_byte_head_bwd:
-     sub     a2, a2, a4
--- 
-2.25.1
-

+ 4 - 3
recipes-core/glibc/glibc/0020-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch → recipes-core/glibc/glibc/0018-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch

@@ -1,4 +1,4 @@
-From 3b5b6079512af8af50d0a43d4c1c218f5ba1b302 Mon Sep 17 00:00:00 2001
+From 912ccb5001ffa5355caff09354558e89e9aa937b Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:27:10 +0000
 Subject: [PATCH] sysdeps/gnu/configure.ac: Set libc_cv_rootsbindir only if its
@@ -15,10 +15,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  2 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/sysdeps/gnu/configure b/sysdeps/gnu/configure
-index c15d1087e8..d30d6e37ae 100644
+index 18c9d7945a..ef22cc845d 100644
 --- a/sysdeps/gnu/configure
 +++ b/sysdeps/gnu/configure
-@@ -32,6 +32,6 @@ case "$prefix" in
+@@ -32,7 +32,7 @@ case "$prefix" in
    else
      libc_cv_localstatedir=$localstatedir
     fi
@@ -26,6 +26,7 @@ index c15d1087e8..d30d6e37ae 100644
 +  libc_cv_rootsbindir=${libc_cv_rootsbindir:=/sbin}
    ;;
  esac
+ 
 diff --git a/sysdeps/gnu/configure.ac b/sysdeps/gnu/configure.ac
 index 634fe4de2a..492112e0fd 100644
 --- a/sysdeps/gnu/configure.ac

+ 0 - 123
recipes-core/glibc/glibc/0019-fix-missing-alias-functions.patch

@@ -1,123 +0,0 @@
-From 6de07625ef56d37f9804ef4ffc7fe568954cb689 Mon Sep 17 00:00:00 2001
-From: "max.ma" <max.ma@starfivetech.com>
-Date: Wed, 14 Dec 2022 16:55:05 -0800
-Subject: [PATCH 19/19] fix missing alias functions
-
----
- sysdeps/riscv/rv64/multiarch/memchr_as.S     |  8 ++++++--
- sysdeps/riscv/rv64/multiarch/memchr_riscv.S  |  3 +--
- sysdeps/riscv/rv64/multiarch/memcmp_riscv.S  |  1 -
- sysdeps/riscv/rv64/multiarch/memmove_riscv.S |  1 -
- sysdeps/riscv/rv64/multiarch/memset_riscv.S  |  1 -
- sysdeps/riscv/rv64/strnlen.S                 | 13 ++++++++-----
- 6 files changed, 15 insertions(+), 12 deletions(-)
-
-diff --git a/sysdeps/riscv/rv64/multiarch/memchr_as.S b/sysdeps/riscv/rv64/multiarch/memchr_as.S
-index ad559e6a11..4d3221c60e 100644
---- a/sysdeps/riscv/rv64/multiarch/memchr_as.S
-+++ b/sysdeps/riscv/rv64/multiarch/memchr_as.S
-@@ -22,7 +22,7 @@
- .option arch, +zbb
- 
- 	.p2align 6
--ENTRY (memchr)
-+ENTRY (__memchr)
-     beqz    a2, .L_not_find
-     li      a4, 9
-     bltu    a2, a4, .L_0_to_8 
-@@ -91,5 +91,9 @@ ENTRY (memchr)
-     add     a0, a0, a3
- .L_find_byte:
-     ret
--END (memchr)
-+END (__memchr)
-+#ifdef weak_alias
-+weak_alias (__memchr, memchr)
-+#endif
-+
- libc_hidden_builtin_def (memchr)
-diff --git a/sysdeps/riscv/rv64/multiarch/memchr_riscv.S b/sysdeps/riscv/rv64/multiarch/memchr_riscv.S
-index 84b3375f31..829f57e7e5 100644
---- a/sysdeps/riscv/rv64/multiarch/memchr_riscv.S
-+++ b/sysdeps/riscv/rv64/multiarch/memchr_riscv.S
-@@ -20,12 +20,11 @@
- 
- #if IS_IN (libc) && defined SHARED && defined __riscv_vector
- 
--#define memchr __memchr_riscv
-+#define __memchr __memchr_riscv
- #undef libc_hidden_builtin_def
- #define libc_hidden_builtin_def(name)
- #include "memchr_as.S"
- 
--
- #else
- 
- #include "memchr_as.S"
-diff --git a/sysdeps/riscv/rv64/multiarch/memcmp_riscv.S b/sysdeps/riscv/rv64/multiarch/memcmp_riscv.S
-index 32df79f769..f9ba9da081 100644
---- a/sysdeps/riscv/rv64/multiarch/memcmp_riscv.S
-+++ b/sysdeps/riscv/rv64/multiarch/memcmp_riscv.S
-@@ -21,7 +21,6 @@
- #undef libc_hidden_builtin_def
- #define libc_hidden_builtin_def(name)
- 
--#undef weak_alias
- #  define memcmp __memcmp_riscv
- # include "memcmp_as.S"
- 
-diff --git a/sysdeps/riscv/rv64/multiarch/memmove_riscv.S b/sysdeps/riscv/rv64/multiarch/memmove_riscv.S
-index 14f154e226..f829e0d5c3 100644
---- a/sysdeps/riscv/rv64/multiarch/memmove_riscv.S
-+++ b/sysdeps/riscv/rv64/multiarch/memmove_riscv.S
-@@ -21,7 +21,6 @@
- #undef libc_hidden_builtin_def
- #define libc_hidden_builtin_def(name)
- 
--#undef weak_alias
- #  define memmove __memmove_riscv
- # include "memmove_as.S"
- 
-diff --git a/sysdeps/riscv/rv64/multiarch/memset_riscv.S b/sysdeps/riscv/rv64/multiarch/memset_riscv.S
-index 8585db0228..6540639296 100644
---- a/sysdeps/riscv/rv64/multiarch/memset_riscv.S
-+++ b/sysdeps/riscv/rv64/multiarch/memset_riscv.S
-@@ -20,7 +20,6 @@
- #undef libc_hidden_builtin_def
- #define libc_hidden_builtin_def(name)
- 
--#undef weak_alias
- #  define memset __memset_riscv
- # include "memset_as.S"
- #else
-diff --git a/sysdeps/riscv/rv64/strnlen.S b/sysdeps/riscv/rv64/strnlen.S
-index 33b140a0ac..73757b69f2 100644
---- a/sysdeps/riscv/rv64/strnlen.S
-+++ b/sysdeps/riscv/rv64/strnlen.S
-@@ -19,7 +19,7 @@
- #include <sysdep.h>
- 
- 	.p2align 6
--ENTRY (strnlen)
-+ENTRY (__strnlen)
-   mv    a2, a0
-   mv    a0, a1
-   li    a3, -1
-@@ -56,7 +56,10 @@ ENTRY (strnlen)
- .Ldone:
-   ret
- 
--END (strnlen)
--weak_alias (strnlen, __strnlen)
--libc_hidden_builtin_def (strnlen)
--libc_hidden_builtin_def (__strnlen)
-+END (__strnlen)
-+
-+#ifndef STRNLEN
-+libc_hidden_def (__strnlen)
-+weak_alias (__strnlen, strnlen)
-+#endif
-+libc_hidden_def (strnlen)
--- 
-2.25.1
-

+ 5 - 5
recipes-core/glibc/glibc/0021-timezone-Make-shell-interpreter-overridable-in-tzsel.patch → recipes-core/glibc/glibc/0019-timezone-Make-shell-interpreter-overridable-in-tzsel.patch

@@ -1,4 +1,4 @@
-From 8d5ff7357354394b958321204b75e3855781aefe Mon Sep 17 00:00:00 2001
+From 1d518ac57b00a3335f80f10f899c1bc24a0ddbf5 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Thu, 9 Dec 2021 15:14:42 -0800
 Subject: [PATCH] timezone: Make shell interpreter overridable in tzselect.ksh
@@ -14,10 +14,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  2 files changed, 10 insertions(+)
 
 diff --git a/Makeconfig b/Makeconfig
-index ba70321af1..4b643768d9 100644
+index 77d7fd14df..e253046861 100644
 --- a/Makeconfig
 +++ b/Makeconfig
-@@ -293,6 +293,15 @@ ifndef sysincludedir
+@@ -309,6 +309,15 @@ ifndef sysincludedir
  sysincludedir = /usr/include
  endif
  
@@ -34,10 +34,10 @@ index ba70321af1..4b643768d9 100644
  # Commands to install files.
  ifndef INSTALL_DATA
 diff --git a/timezone/Makefile b/timezone/Makefile
-index a789c22d26..3e69409a94 100644
+index 0306c0bca9..4dfdcebdb7 100644
 --- a/timezone/Makefile
 +++ b/timezone/Makefile
-@@ -134,6 +134,7 @@ $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
+@@ -136,6 +136,7 @@ $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
  	    -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \
  	    -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \
  	    -e '/REPORT_BUGS_TO=/s|=.*|="$(REPORT_BUGS_TO)"|' \

+ 1 - 1
recipes-core/glibc/glibc/0022-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch → recipes-core/glibc/glibc/0020-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch

@@ -1,4 +1,4 @@
-From ba1365f19ccc8378f2fcff892721187537479884 Mon Sep 17 00:00:00 2001
+From 7274541782927394852712ba0c8dfd67bd9b8b5b Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 15 Dec 2021 21:47:53 -0800
 Subject: [PATCH] tzselect.ksh: Use /bin/sh default shell interpreter

+ 5 - 5
recipes-core/glibc/glibc/0023-fix-create-thread-failed-in-unprivileged-process-BZ-.patch → recipes-core/glibc/glibc/0021-fix-create-thread-failed-in-unprivileged-process-BZ-.patch

@@ -1,4 +1,4 @@
-From ffbb37732807e180b14a21d1bf79ad5038252c02 Mon Sep 17 00:00:00 2001
+From 4a1bff4c1e34ad9b596a7ba44ab61f4c9d00097b Mon Sep 17 00:00:00 2001
 From: Hongxu Jia <hongxu.jia@windriver.com>
 Date: Sun, 29 Aug 2021 20:49:16 +0800
 Subject: [PATCH] fix create thread failed in unprivileged process [BZ #28287]
@@ -72,13 +72,13 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/sysdeps/unix/sysv/linux/clone-internal.c b/sysdeps/unix/sysv/linux/clone-internal.c
-index a71effcbd3..a0569113aa 100644
+index 790739cfce..8d24d04917 100644
 --- a/sysdeps/unix/sysv/linux/clone-internal.c
 +++ b/sysdeps/unix/sysv/linux/clone-internal.c
-@@ -52,7 +52,7 @@ __clone_internal (struct clone_args *cl_args,
-   /* Try clone3 first.  */
+@@ -106,7 +106,7 @@ __clone_internal (struct clone_args *cl_args,
+ #ifdef HAVE_CLONE3_WRAPPER
    int saved_errno = errno;
-   ret = __clone3 (cl_args, sizeof (*cl_args), func, arg);
+   int ret = __clone3_internal (cl_args, func, arg);
 -  if (ret != -1 || errno != ENOSYS)
 +  if (ret != -1 || (errno != ENOSYS && errno != EPERM))
      return ret;

+ 3 - 3
recipes-core/glibc/glibc/0024-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch → recipes-core/glibc/glibc/0022-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch

@@ -1,4 +1,4 @@
-From f873e25e29684cbbf7b141d9c6ee725268505c29 Mon Sep 17 00:00:00 2001
+From e61792fc978f9b8a9c790be468fbf97828ac8ae9 Mon Sep 17 00:00:00 2001
 From: Richard Purdie <richard.purdie@linuxfoundation.org>
 Date: Sun, 24 Jul 2022 07:07:29 -0700
 Subject: [PATCH] Avoid hardcoded build time paths in the output binaries
@@ -14,10 +14,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  1 file changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/support/Makefile b/support/Makefile
-index 9b50eac117..4c24d9f61a 100644
+index 917a858bd1..17a747c8c7 100644
 --- a/support/Makefile
 +++ b/support/Makefile
-@@ -218,9 +218,9 @@ libsupport-inhibit-o += .o
+@@ -227,9 +227,9 @@ libsupport-inhibit-o += .o
  endif
  
  CFLAGS-support_paths.c = \

+ 56 - 0
recipes-core/glibc/glibc/0023-aarch64-configure-Pass-mcpu-along-with-march-to-dete.patch

@@ -0,0 +1,56 @@
+From d836f008a96aa9b2e88c7b394bfc110542e57176 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 4 Aug 2023 09:34:50 -0700
+Subject: [PATCH] aarch64/configure: Pass -mcpu along with -march to detect sve
+ support
+
+SVE support logic in configure is rightly passing -march=<arch>+sve to
+compiler to override whatever user might have passed via environment,
+however GCC does not do as intended when -mcpu is part of environment
+compiler flags, then it overrides the -march computed from -mcpu and
+igonores other -march values so this test fails for lot of aarch64
+machines which pass -mcpu that does not support sve. This is seemingly a
+bug in GCC [1], until that is fixed we preempt -mcpu along with -march
+in the configure test itself. It does not change functionality and yet
+lets us through the GCC inconsistency.
+
+[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110901
+
+Upstream-Status: Inappropriate [Workaround for a GCC issue]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ sysdeps/aarch64/configure    | 2 +-
+ sysdeps/aarch64/configure.ac | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure
+index 5e91fab023..39dddc66d4 100644
+--- a/sysdeps/aarch64/configure
++++ b/sysdeps/aarch64/configure
+@@ -327,7 +327,7 @@ else $as_nop
+   cat > conftest.s <<\EOF
+         ptrue p0.b
+ EOF
+-if { ac_try='${CC-cc} -c -march=armv8.2-a+sve conftest.s 1>&5'
++if { ac_try='${CC-cc} -c -mcpu=generic+sve -march=armv8.2-a+sve conftest.s 1>&5'
+   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+   (eval $ac_try) 2>&5
+   ac_status=$?
+diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac
+index 8a708f2ef4..b6a146d2be 100644
+--- a/sysdeps/aarch64/configure.ac
++++ b/sysdeps/aarch64/configure.ac
+@@ -92,7 +92,7 @@ AC_CACHE_CHECK([for SVE support in assembler], [libc_cv_aarch64_sve_asm], [dnl
+ cat > conftest.s <<\EOF
+         ptrue p0.b
+ EOF
+-if AC_TRY_COMMAND(${CC-cc} -c -march=armv8.2-a+sve conftest.s 1>&AS_MESSAGE_LOG_FD); then
++if AC_TRY_COMMAND(${CC-cc} -c -mcpu=generic+sve -march=armv8.2-a+sve conftest.s 1>&AS_MESSAGE_LOG_FD); then
+   libc_cv_aarch64_sve_asm=yes
+ else
+   libc_cv_aarch64_sve_asm=no
+-- 
+2.41.0
+

+ 0 - 28
recipes-core/glibc/glibc/0025-startup-Force-O2.patch

@@ -1,28 +0,0 @@
-From 5e635e5dc7d1b21a78f38109d4f43a03bec865c8 Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Sun, 7 Aug 2022 12:51:48 +0200
-Subject: [PATCH] startup: Force -O2
-
-Upstream-Status: Submitted [https://sourceware.org/bugzilla/show_bug.cgi?id=29249]
-
-Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
----
- sysdeps/unix/sysv/linux/startup.h | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/sysdeps/unix/sysv/linux/startup.h b/sysdeps/unix/sysv/linux/startup.h
-index 39859b404a..e1fc1b682d 100644
---- a/sysdeps/unix/sysv/linux/startup.h
-+++ b/sysdeps/unix/sysv/linux/startup.h
-@@ -21,6 +21,11 @@
- #else
- # include <sysdep.h>
- 
-+# if !defined __OPTIMIZE__ || __OPTIMIZE__ < 2
-+/* Force to fold strlen.  */
-+#  pragma GCC optimize(2)
-+# endif
-+
- /* Avoid a run-time invocation of strlen.  */
- #define _startup_fatal(message)                                         \
-   do                                                                    \

+ 0 - 490
recipes-core/glibc/glibc/1f34a2328890aa192141f96449d25b77f666bf47.patch

@@ -1,490 +0,0 @@
-From 1f34a2328890aa192141f96449d25b77f666bf47 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Thu, 3 Nov 2022 17:28:03 +0100
-Subject: [PATCH] elf: Introduce <dl-call_tls_init_tp.h> and call_tls_init_tp
- (bug 29249)
-
-This makes it more likely that the compiler can compute the strlen
-argument in _startup_fatal at compile time, which is required to
-avoid a dependency on strlen this early during process startup.
-
-Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
----
- csu/libc-tls.c                        | 14 ++++-------
- elf/rtld.c                            | 14 +++--------
- sysdeps/aarch64/nptl/tls.h            |  2 +-
- sysdeps/alpha/nptl/tls.h              |  2 +-
- sysdeps/arc/nptl/tls.h                |  3 +--
- sysdeps/csky/nptl/tls.h               |  3 +--
- sysdeps/generic/dl-call_tls_init_tp.h | 34 +++++++++++++++++++++++++++
- sysdeps/generic/startup.h             |  2 +-
- sysdeps/hppa/nptl/tls.h               |  2 +-
- sysdeps/i386/nptl/tls.h               |  3 +--
- sysdeps/ia64/nptl/tls.h               |  2 +-
- sysdeps/loongarch/nptl/tls.h          |  2 +-
- sysdeps/m68k/nptl/tls.h               |  2 +-
- sysdeps/mach/hurd/i386/tls.h          | 10 ++++----
- sysdeps/microblaze/nptl/tls.h         |  2 +-
- sysdeps/mips/nptl/tls.h               |  3 +--
- sysdeps/nios2/nptl/tls.h              |  2 +-
- sysdeps/or1k/nptl/tls.h               |  2 +-
- sysdeps/powerpc/nptl/tls.h            |  2 +-
- sysdeps/riscv/nptl/tls.h              |  2 +-
- sysdeps/s390/nptl/tls.h               |  2 +-
- sysdeps/sh/nptl/tls.h                 |  2 +-
- sysdeps/sparc/nptl/tls.h              |  2 +-
- sysdeps/unix/sysv/linux/arm/tls.h     |  3 +--
- sysdeps/x86_64/nptl/tls.h             |  2 +-
- 25 files changed, 68 insertions(+), 51 deletions(-)
- create mode 100644 sysdeps/generic/dl-call_tls_init_tp.h
-
-diff --git a/csu/libc-tls.c b/csu/libc-tls.c
-index 0a216c55028..ca4def26133 100644
---- a/csu/libc-tls.c
-+++ b/csu/libc-tls.c
-@@ -25,6 +25,7 @@
- #include <sys/param.h>
- #include <array_length.h>
- #include <pthreadP.h>
-+#include <dl-call_tls_init_tp.h>
- 
- #ifdef SHARED
-  #error makefile bug, this file is for static only
-@@ -147,14 +148,14 @@ __libc_setup_tls (void)
-   tcb_offset = roundup (memsz + GLRO(dl_tls_static_surplus), max_align);
-   tlsblock = _dl_early_allocate (tcb_offset + TLS_INIT_TCB_SIZE + max_align);
-   if (tlsblock == NULL)
--    _startup_fatal ("Fatal glibc error: Cannot allocate TLS block\n");
-+    _startup_fatal_tls_error ();
- #elif TLS_DTV_AT_TP
-   tcb_offset = roundup (TLS_INIT_TCB_SIZE, align ?: 1);
-   tlsblock = _dl_early_allocate (tcb_offset + memsz + max_align
- 				 + TLS_PRE_TCB_SIZE
- 				 + GLRO(dl_tls_static_surplus));
-   if (tlsblock == NULL)
--    _startup_fatal ("Fatal glibc error: Cannot allocate TLS block\n");
-+    _startup_fatal_tls_error ();
-   tlsblock += TLS_PRE_TCB_SIZE;
- #else
-   /* In case a model with a different layout for the TCB and DTV
-@@ -191,16 +192,11 @@ __libc_setup_tls (void)
- #if TLS_TCB_AT_TP
-   INSTALL_DTV ((char *) tlsblock + tcb_offset, _dl_static_dtv);
- 
--  const char *lossage = TLS_INIT_TP ((char *) tlsblock + tcb_offset);
-+  call_tls_init_tp ((char *) tlsblock + tcb_offset);
- #elif TLS_DTV_AT_TP
-   INSTALL_DTV (tlsblock, _dl_static_dtv);
--  const char *lossage = TLS_INIT_TP (tlsblock);
--#else
--# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
-+  call_tls_init_tp (tlsblock);
- #endif
--  if (__builtin_expect (lossage != NULL, 0))
--    _startup_fatal (lossage);
--  __tls_init_tp ();
- 
-   /* Update the executable's link map with enough information to make
-      the TLS routines happy.  */
-diff --git a/elf/rtld.c b/elf/rtld.c
-index 8671594f1f5..70ad1acc43e 100644
---- a/elf/rtld.c
-+++ b/elf/rtld.c
-@@ -52,6 +52,7 @@
- #include <dl-execve.h>
- #include <dl-find_object.h>
- #include <dl-audit-check.h>
-+#include <dl-call_tls_init_tp.h>
- 
- #include <assert.h>
- 
-@@ -796,10 +797,7 @@ cannot allocate TLS data structures for initial thread\n");
-   GL(dl_initial_dtv) = GET_DTV (tcbp);
- 
-   /* And finally install it for the main thread.  */
--  const char *lossage = TLS_INIT_TP (tcbp);
--  if (__glibc_unlikely (lossage != NULL))
--    _dl_fatal_printf ("cannot set up thread-local storage: %s\n", lossage);
--  __tls_init_tp ();
-+  call_tls_init_tp (tcbp);
-   tls_init_tp_called = true;
- 
-   return tcbp;
-@@ -2348,13 +2346,7 @@ dl_main (const ElfW(Phdr) *phdr,
- 
-   /* And finally install it for the main thread.  */
-   if (! tls_init_tp_called)
--    {
--      const char *lossage = TLS_INIT_TP (tcbp);
--      if (__glibc_unlikely (lossage != NULL))
--	_dl_fatal_printf ("cannot set up thread-local storage: %s\n",
--			  lossage);
--      __tls_init_tp ();
--    }
-+    call_tls_init_tp (tcbp);
- 
-   /* Make sure no new search directories have been added.  */
-   assert (GLRO(dl_init_all_dirs) == GL(dl_all_dirs));
-diff --git a/sysdeps/aarch64/nptl/tls.h b/sysdeps/aarch64/nptl/tls.h
-index 08aa2eff891..6fe084c1ef9 100644
---- a/sysdeps/aarch64/nptl/tls.h
-+++ b/sysdeps/aarch64/nptl/tls.h
-@@ -72,7 +72,7 @@ typedef struct
-    special attention since 'errno' is not yet available and if the
-    operation can cause a failure 'errno' must not be touched.  */
- # define TLS_INIT_TP(tcbp) \
--  ({ __asm __volatile ("msr tpidr_el0, %0" : : "r" (tcbp)); NULL; })
-+  ({ __asm __volatile ("msr tpidr_el0, %0" : : "r" (tcbp)); true; })
- 
- /* Value passed to 'clone' for initialization of the thread register.  */
- # define TLS_DEFINE_INIT_TP(tp, pd) void *tp = (pd) + 1
-diff --git a/sysdeps/alpha/nptl/tls.h b/sysdeps/alpha/nptl/tls.h
-index 8f5b69ad3b1..48dc1369fc1 100644
---- a/sysdeps/alpha/nptl/tls.h
-+++ b/sysdeps/alpha/nptl/tls.h
-@@ -69,7 +69,7 @@ typedef struct
-    special attention since 'errno' is not yet available and if the
-    operation can cause a failure 'errno' must not be touched.  */
- # define TLS_INIT_TP(tcbp) \
--  (__builtin_set_thread_pointer ((void *)(tcbp)), NULL)
-+  (__builtin_set_thread_pointer ((void *)(tcbp)), true)
- 
- /* Value passed to 'clone' for initialization of the thread register.  */
- # define TLS_DEFINE_INIT_TP(tp, pd) void *tp = (pd) + 1
-diff --git a/sysdeps/arc/nptl/tls.h b/sysdeps/arc/nptl/tls.h
-index 7fc6602b236..948e618a3aa 100644
---- a/sysdeps/arc/nptl/tls.h
-+++ b/sysdeps/arc/nptl/tls.h
-@@ -75,8 +75,7 @@ typedef struct
- 	long result_var;					\
- 	__builtin_set_thread_pointer (tcbp);     		\
- 	result_var = INTERNAL_SYSCALL_CALL (arc_settls, (tcbp));\
--	INTERNAL_SYSCALL_ERROR_P (result_var)			\
--	  ? "settls syscall error" : NULL;			\
-+	!INTERNAL_SYSCALL_ERROR_P (result_var);			\
-    })
- 
- /* Value passed to 'clone' for initialization of the thread register.  */
-diff --git a/sysdeps/csky/nptl/tls.h b/sysdeps/csky/nptl/tls.h
-index 58d6ab0fb2a..3f7afc93391 100644
---- a/sysdeps/csky/nptl/tls.h
-+++ b/sysdeps/csky/nptl/tls.h
-@@ -92,8 +92,7 @@ typedef struct
-   ({ long int result_var;						\
-      result_var = INTERNAL_SYSCALL_CALL (set_thread_area, 		\
-                     (char *) (tcbp) + TLS_TCB_OFFSET);			\
--     INTERNAL_SYSCALL_ERROR_P (result_var)				\
--       ? "unknown error" : NULL; })
-+     !INTERNAL_SYSCALL_ERROR_P (result_var); })
- 
- /* Return the address of the dtv for the current thread.  */
- # define THREAD_DTV() \
-diff --git a/sysdeps/generic/dl-call_tls_init_tp.h b/sysdeps/generic/dl-call_tls_init_tp.h
-new file mode 100644
-index 00000000000..411feda3fc0
---- /dev/null
-+++ b/sysdeps/generic/dl-call_tls_init_tp.h
-@@ -0,0 +1,34 @@
-+/* Invoke TLS_INIT_TP and __tls_init_tp with error handling.
-+   Copyright (C) 2022 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/>.  */
-+
-+#include <startup.h>
-+#include <tls.h>
-+
-+static inline void
-+_startup_fatal_tls_error (void)
-+{
-+  _startup_fatal ("Fatal glibc error: Cannot allocate TLS block\n");
-+}
-+
-+static inline void
-+call_tls_init_tp (void *addr)
-+{
-+  if (!TLS_INIT_TP (addr))
-+    _startup_fatal_tls_error ();
-+  __tls_init_tp ();
-+}
-diff --git a/sysdeps/generic/startup.h b/sysdeps/generic/startup.h
-index 45979ab2319..4b444511b4f 100644
---- a/sysdeps/generic/startup.h
-+++ b/sysdeps/generic/startup.h
-@@ -19,7 +19,7 @@
- /* Targets should override this file if the default definitions below
-    will not work correctly very early before TLS is initialized.  */
- 
--#include <unistd.h>
-+#include <stdio.h>
- 
- /* Use macro instead of inline function to avoid including <stdio.h>.  */
- #define _startup_fatal(message) __libc_fatal ((message))
-diff --git a/sysdeps/hppa/nptl/tls.h b/sysdeps/hppa/nptl/tls.h
-index e6b0bd5c718..6af22cdc004 100644
---- a/sysdeps/hppa/nptl/tls.h
-+++ b/sysdeps/hppa/nptl/tls.h
-@@ -74,7 +74,7 @@ typedef struct
-    special attention since 'errno' is not yet available and if the
-    operation can cause a failure 'errno' must not be touched.  */
- # define TLS_INIT_TP(tcbp) \
--  ({ __set_cr27(tcbp); NULL; })
-+  ({ __set_cr27(tcbp); true; })
- 
- /* Value passed to 'clone' for initialization of the thread register.  */
- # define TLS_DEFINE_INIT_TP(tp, pd) void *tp = (pd) + 1
-diff --git a/sysdeps/i386/nptl/tls.h b/sysdeps/i386/nptl/tls.h
-index 91090bf2877..553b55b3f2d 100644
---- a/sysdeps/i386/nptl/tls.h
-+++ b/sysdeps/i386/nptl/tls.h
-@@ -203,8 +203,7 @@ tls_fill_user_desc (union user_desc_init *desc,
- 	  which is necessary since we have changed it.   */		      \
-        TLS_SET_GS (_segdescr.desc.entry_number * 8 + 3);		      \
- 									      \
--     _result == 0 ? NULL						      \
--     : "set_thread_area failed when setting up thread-local storage\n"; })
-+     _result == 0; })
- 
- # define TLS_DEFINE_INIT_TP(tp, pd)					      \
-   union user_desc_init _segdescr;					      \
-diff --git a/sysdeps/ia64/nptl/tls.h b/sysdeps/ia64/nptl/tls.h
-index d2411b3c1ac..4085c568326 100644
---- a/sysdeps/ia64/nptl/tls.h
-+++ b/sysdeps/ia64/nptl/tls.h
-@@ -105,7 +105,7 @@ register struct pthread *__thread_self __asm__("r13");
-    special attention since 'errno' is not yet available and if the
-    operation can cause a failure 'errno' must not be touched.  */
- # define TLS_INIT_TP(thrdescr) \
--  (__thread_self = (thrdescr), INIT_SYSINFO, NULL)
-+  (__thread_self = (thrdescr), INIT_SYSINFO, true)
- 
- /* Value passed to 'clone2' for initialization of the thread register.  */
- # define TLS_DEFINE_INIT_TP(tp, pd) \
-diff --git a/sysdeps/loongarch/nptl/tls.h b/sysdeps/loongarch/nptl/tls.h
-index 24bffe3a0ad..e8b616854f7 100644
---- a/sysdeps/loongarch/nptl/tls.h
-+++ b/sysdeps/loongarch/nptl/tls.h
-@@ -83,7 +83,7 @@ typedef struct
- #define TLS_INIT_TP(tcbp) \
-   ({ \
-     __thread_self = (char *) tcbp + TLS_TCB_OFFSET; \
--    NULL; \
-+    true; \
-   })
- 
- /* Return the address of the dtv for the current thread.  */
-diff --git a/sysdeps/m68k/nptl/tls.h b/sysdeps/m68k/nptl/tls.h
-index 742e1b6767d..ebcc118bbe2 100644
---- a/sysdeps/m68k/nptl/tls.h
-+++ b/sysdeps/m68k/nptl/tls.h
-@@ -90,7 +90,7 @@ typedef struct
- 									\
-     _sys_result = INTERNAL_SYSCALL_CALL (set_thread_area, 		\
- 				    ((void *) (tcbp)) + TLS_TCB_OFFSET); \
--    INTERNAL_SYSCALL_ERROR_P (_sys_result) ? "unknown error" : NULL; })
-+    !INTERNAL_SYSCALL_ERROR_P (_sys_result); })
- 
- # define TLS_DEFINE_INIT_TP(tp, pd) \
-   void *tp = (void *) (pd) + TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE
-diff --git a/sysdeps/mach/hurd/i386/tls.h b/sysdeps/mach/hurd/i386/tls.h
-index 602bacc0de0..2847e3ee61c 100644
---- a/sysdeps/mach/hurd/i386/tls.h
-+++ b/sysdeps/mach/hurd/i386/tls.h
-@@ -117,12 +117,12 @@ extern unsigned short __init1_desc;
- 
- # define HURD_SEL_LDT(sel) (__builtin_expect ((sel) & 4, 0))
- 
--static inline const char * __attribute__ ((unused))
-+static inline bool __attribute__ ((unused))
- _hurd_tls_init (tcbhead_t *tcb)
- {
-   HURD_TLS_DESC_DECL (desc, tcb);
-   thread_t self = __mach_thread_self ();
--  const char *msg = NULL;
-+  bool success = true;
- 
-   /* This field is used by TLS accesses to get our "thread pointer"
-      from the TLS point of view.  */
-@@ -141,14 +141,14 @@ _hurd_tls_init (tcbhead_t *tcb)
-       assert_perror (err);
-       if (err)
-       {
--	msg = "i386_set_ldt failed";
-+	success = false;
- 	goto out;
-       }
-     }
-   else if (err)
-     {
-       assert_perror (err); /* Separate from above with different line #. */
--      msg = "i386_set_gdt failed";
-+      success = false;
-       goto out;
-     }
- 
-@@ -157,7 +157,7 @@ _hurd_tls_init (tcbhead_t *tcb)
- 
- out:
-   __mach_port_deallocate (__mach_task_self (), self);
--  return msg;
-+  return success;
- }
- 
- /* Code to initially initialize the thread pointer.  This might need
-diff --git a/sysdeps/microblaze/nptl/tls.h b/sysdeps/microblaze/nptl/tls.h
-index 588fd1c5d63..d8be1932b9b 100644
---- a/sysdeps/microblaze/nptl/tls.h
-+++ b/sysdeps/microblaze/nptl/tls.h
-@@ -75,7 +75,7 @@ typedef struct
- /* Code to initially initialize the thread pointer.
-    r21 is reserved for thread pointer.  */
- # define TLS_INIT_TP(tcbp) \
--  ({ __asm __volatile ("or r21,r0,%0" : : "r" ((void *)tcbp)); NULL; })
-+  ({ __asm __volatile ("or r21,r0,%0" : : "r" ((void *)tcbp)); true; })
- 
- # define TLS_DEFINE_INIT_TP(tp, pd) void *tp = (pd) + 1
- 
-diff --git a/sysdeps/mips/nptl/tls.h b/sysdeps/mips/nptl/tls.h
-index 2aa7cb4bb8d..bac6e8771cd 100644
---- a/sysdeps/mips/nptl/tls.h
-+++ b/sysdeps/mips/nptl/tls.h
-@@ -116,8 +116,7 @@ typedef struct
-   ({ long int result_var;						\
-      result_var = INTERNAL_SYSCALL_CALL (set_thread_area, 		\
- 				    (char *) (tcbp) + TLS_TCB_OFFSET);	\
--     INTERNAL_SYSCALL_ERROR_P (result_var)				\
--       ? "unknown error" : NULL; })
-+     !INTERNAL_SYSCALL_ERROR_P (result_var); })
- 
- /* Value passed to 'clone' for initialization of the thread register.  */
- # define TLS_DEFINE_INIT_TP(tp, pd) \
-diff --git a/sysdeps/nios2/nptl/tls.h b/sysdeps/nios2/nptl/tls.h
-index cb231e2a4bb..f5a9713f93f 100644
---- a/sysdeps/nios2/nptl/tls.h
-+++ b/sysdeps/nios2/nptl/tls.h
-@@ -88,7 +88,7 @@ register struct pthread *__thread_self __asm__("r23");
- 
- /* Code to initially initialize the thread pointer.  */
- # define TLS_INIT_TP(tcbp) \
--  (__thread_self = (struct pthread *) ((char *) tcbp + TLS_TCB_OFFSET), NULL)
-+  (__thread_self = (struct pthread *) ((char *) tcbp + TLS_TCB_OFFSET), true)
- 
- /* Value passed to 'clone' for initialization of the thread register.  */
- # define TLS_DEFINE_INIT_TP(tp, pd) \
-diff --git a/sysdeps/or1k/nptl/tls.h b/sysdeps/or1k/nptl/tls.h
-index e82f444738d..eda0e893aea 100644
---- a/sysdeps/or1k/nptl/tls.h
-+++ b/sysdeps/or1k/nptl/tls.h
-@@ -112,7 +112,7 @@ register tcbhead_t *__thread_self __asm__("r10");
-    It's hard to fail this, so return NULL always.  */
- 
- # define TLS_INIT_TP(tcbp) \
--  ({__thread_self = ((tcbhead_t *)tcbp + 1); NULL;})
-+  ({__thread_self = ((tcbhead_t *)tcbp + 1); true;})
- 
- /* Value passed to 'clone' for initialization of the thread register.  */
- # define TLS_DEFINE_INIT_TP(tp, pd) \
-diff --git a/sysdeps/powerpc/nptl/tls.h b/sysdeps/powerpc/nptl/tls.h
-index e62a96238aa..68a1d8b546b 100644
---- a/sysdeps/powerpc/nptl/tls.h
-+++ b/sysdeps/powerpc/nptl/tls.h
-@@ -139,7 +139,7 @@ typedef struct
-     __thread_register = (void *) (tcbp) + TLS_TCB_OFFSET;		      \
-     THREAD_SET_HWCAP (__tcb.hwcap);					      \
-     THREAD_SET_AT_PLATFORM (__tcb.at_platform);				      \
--    NULL;								      \
-+    true;								      \
-   })
- 
- /* Value passed to 'clone' for initialization of the thread register.  */
-diff --git a/sysdeps/riscv/nptl/tls.h b/sysdeps/riscv/nptl/tls.h
-index 700c2f51899..b221980399b 100644
---- a/sysdeps/riscv/nptl/tls.h
-+++ b/sysdeps/riscv/nptl/tls.h
-@@ -79,7 +79,7 @@ typedef struct
- 
- /* Code to initially initialize the thread pointer.  */
- # define TLS_INIT_TP(tcbp) \
--  ({ __thread_self = (char*)tcbp + TLS_TCB_OFFSET; NULL; })
-+  ({ __thread_self = (char*)tcbp + TLS_TCB_OFFSET; true; })
- 
- /* Return the address of the dtv for the current thread.  */
- # define THREAD_DTV() \
-diff --git a/sysdeps/s390/nptl/tls.h b/sysdeps/s390/nptl/tls.h
-index 98d7870148c..937c49dda68 100644
---- a/sysdeps/s390/nptl/tls.h
-+++ b/sysdeps/s390/nptl/tls.h
-@@ -112,7 +112,7 @@ typedef struct
-      INIT_SYSINFO;							      \
- 									      \
-     __builtin_set_thread_pointer (_thrdescr);				      \
--    NULL;								      \
-+    true;								      \
-   })
- 
- /* Value passed to 'clone' for initialization of the thread register.  */
-diff --git a/sysdeps/sh/nptl/tls.h b/sysdeps/sh/nptl/tls.h
-index 1530489a6ce..3882114f5c8 100644
---- a/sysdeps/sh/nptl/tls.h
-+++ b/sysdeps/sh/nptl/tls.h
-@@ -83,7 +83,7 @@ typedef struct
-    special attention since 'errno' is not yet available and if the
-    operation can cause a failure 'errno' must not be touched.  */
- # define TLS_INIT_TP(tcbp) \
--  ({ __asm __volatile ("ldc %0,gbr" : : "r" (tcbp)); NULL; })
-+  ({ __asm __volatile ("ldc %0,gbr" : : "r" (tcbp)); true; })
- 
- # define TLS_DEFINE_INIT_TP(tp, pd) void *tp = (pd) + 1
- 
-diff --git a/sysdeps/sparc/nptl/tls.h b/sysdeps/sparc/nptl/tls.h
-index 95a69cb8249..e8fbe40e7bb 100644
---- a/sysdeps/sparc/nptl/tls.h
-+++ b/sysdeps/sparc/nptl/tls.h
-@@ -89,7 +89,7 @@ register struct pthread *__thread_self __asm__("%g7");
- 
- /* Code to initially initialize the thread pointer.  */
- # define TLS_INIT_TP(descr) \
--  (__thread_self = (__typeof (__thread_self)) (descr), NULL)
-+  (__thread_self = (__typeof (__thread_self)) (descr), true)
- 
- /* Value passed to 'clone' for initialization of the thread register.  */
- # define TLS_DEFINE_INIT_TP(tp, pd) void *tp = (pd)
-diff --git a/sysdeps/unix/sysv/linux/arm/tls.h b/sysdeps/unix/sysv/linux/arm/tls.h
-index 9d1601af44c..045fad22751 100644
---- a/sysdeps/unix/sysv/linux/arm/tls.h
-+++ b/sysdeps/unix/sysv/linux/arm/tls.h
-@@ -33,8 +33,7 @@
- # define TLS_INIT_TP(tcbp) \
-   ({ long int result_var;						\
-      result_var = INTERNAL_SYSCALL_CALL (set_tls, (tcbp));		\
--     INTERNAL_SYSCALL_ERROR_P (result_var)				\
--       ? "unknown error" : NULL; })
-+     !INTERNAL_SYSCALL_ERROR_P (result_var); })
- 
- #endif /* __ASSEMBLER__ */
- 
-diff --git a/sysdeps/x86_64/nptl/tls.h b/sysdeps/x86_64/nptl/tls.h
-index 75f80209758..63744f63845 100644
---- a/sysdeps/x86_64/nptl/tls.h
-+++ b/sysdeps/x86_64/nptl/tls.h
-@@ -156,7 +156,7 @@ _Static_assert (offsetof (tcbhead_t, __glibc_unused2) == 0x80,
- 		     "S" (_thrdescr)					      \
- 		   : "memory", "cc", "r11", "cx");			      \
- 									      \
--    _result ? "cannot set %fs base address for thread-local storage" : 0;     \
-+    _result == 0;							      \
-   })
- 
- # define TLS_DEFINE_INIT_TP(tp, pd) void *tp = (pd)

+ 1 - 1
recipes-core/glibc/glibc/check-test-wrapper

@@ -58,7 +58,7 @@ elif targettype == "ssh":
     user = os.environ.get("SSH_HOST_USER", None)
     port = os.environ.get("SSH_HOST_PORT", None)
 
-    command = ["ssh", "-o", "UserKnownHostsFile=/dev/null", "-o", "StrictHostKeyChecking=no"]
+    command = ["ssh", "-o", "UserKnownHostsFile=/dev/null", "-o", "StrictHostKeyChecking=no", "-o", "LogLevel=quiet"]
     if port:
         command += ["-p", str(port)]
     if not host:

+ 7 - 7
recipes-core/glibc/glibc/run-ptest

@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # ptest script for glibc - to run time related tests to
 # facilitate Y2038 validation
 # Run with 'ptest-runner glibc-tests'
@@ -22,12 +22,12 @@ tst_time64=$(ls -r ${PWD}/tests/glibc-ptest/*-time64)
 # related
 tst_time_tmp=$(sed -e "s/-time64$//" <<< ${tst_time64})
 
-# Run tests supporting only 32 bit time
-for i in ${tst_time_tmp}
-do
-	$i >/dev/null 2>&1
-	output
-done
+# Do not run tests supporting only 32 bit time
+#for i in ${tst_time_tmp}
+#do
+#	$i >/dev/null 2>&1
+#	output
+#done
 
 # Run tests supporting only 64 bit time
 for i in ${tst_time64}

+ 26 - 50
recipes-core/glibc/glibc_2.36.bb → recipes-core/glibc/glibc_2.38.bb

@@ -1,23 +1,22 @@
 require glibc.inc
 require glibc-version.inc
 
-CVE_CHECK_IGNORE += "CVE-2020-10029 CVE-2021-27645"
-
 # glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010022
 # glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010023
 # glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010024
-# Upstream glibc maintainers dispute there is any issue and have no plans to address it further.
-# "this is being treated as a non-security bug and no real threat."
-CVE_CHECK_IGNORE += "CVE-2019-1010022 CVE-2019-1010023 CVE-2019-1010024"
+CVE_STATUS_GROUPS = "CVE_STATUS_RECIPE"
+CVE_STATUS_RECIPE = "CVE-2019-1010022 CVE-2019-1010023 CVE-2019-1010024"
+CVE_STATUS_RECIPE[status] = "disputed: \
+Upstream glibc maintainers dispute there is any issue and have no plans to address it further. \
+this is being treated as a non-security bug and no real threat."
 
 # glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010025
-# Allows for ASLR bypass so can bypass some hardening, not an exploit in itself, may allow
-# easier access for another. "ASLR bypass itself is not a vulnerability."
 # Potential patch at https://sourceware.org/bugzilla/show_bug.cgi?id=22853
-CVE_CHECK_IGNORE += "CVE-2019-1010025"
+CVE_STATUS[CVE-2019-1010025] = "disputed: \
+Allows for ASLR bypass so can bypass some hardening, not an exploit in itself, may allow \
+easier access for another. 'ASLR bypass itself is not a vulnerability.'"
 
-# This has been integrated into the 2.36 branch as of c399271 so is now fixed
-CVE_CHECK_IGNORE += "CVE-2022-39046"
+CVE_STATUS[CVE-2023-25139] = "cpe-stable-backport: This is integrated into the 2.37 branch as of 07b9521fc6"
 
 DEPENDS += "gperf-native bison-native"
 
@@ -29,13 +28,13 @@ NATIVESDKFIXES:class-nativesdk = "\
            file://0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch \
            file://0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch \
            file://0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch \
-	   file://1f34a2328890aa192141f96449d25b77f666bf47.patch \
 "
 
 SRC_URI =  "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
            file://etc/ld.so.conf \
            file://generate-supported.mk \
            file://makedbs.sh \
+           \
            ${NATIVESDKFIXES} \
            file://0009-yes-within-the-path-sets-wrong-config-variables.patch \
            file://0010-eglibc-Cross-building-and-testing-instructions.patch \
@@ -43,40 +42,16 @@ SRC_URI =  "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
            file://0012-eglibc-Resolve-__fpscr_values-on-SH4.patch \
            file://0013-eglibc-Forward-port-cross-locale-generation-support.patch \
            file://0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
-           file://0015-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch \
-           file://0016-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \
-           file://0017-powerpc-Do-not-ask-compiler-for-finding-arch.patch \
-           file://0018-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch \
-           file://0019-Replace-echo-with-printf-builtin-in-nscd-init-script.patch \
-           file://0020-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch \
-           file://0021-timezone-Make-shell-interpreter-overridable-in-tzsel.patch \
-           file://0022-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch \
-           file://0023-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \
-           file://0024-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch \
-           file://0025-startup-Force-O2.patch \
-           file://0001-Linux-Add-ppoll-fortify-symbol-for-64-bit-time_t-BZ-.patch \
-	   file://0001-modify-and-merge-sifive-patches-to-support-V.patch \
-           file://0002-add-vector-support-for-memset-memcmp-memmove-memcpy-.patch \
-           file://0003-add-NT_RISCV_VECTOR-macro-definition-to-align-with-l.patch \
-           file://0004-fix-the-bcmp-unrecognized-issue.patch \
-           file://0005-riscv-Resolve-symbols-directly-for-symbols-with-STO_.patch \
-           file://0006-change-memcpy_vector-LMUL-to-m8.patch \
-           file://0007-add-header-files-for-vector-support.patch \
-           file://0008-prohibit-from-generating-plt-table-when-static-linki.patch \
-           file://0009-resolve-__memcmpeq-aliased-to-undefined-symbol-memcm.patch \
-           file://0010-merge-demin-s-mem_xxx-optimization.patch \
-           file://0011-add-alias-to-bcmp.patch \
-           file://0012-remove-unnecessary-changes-to-support-v.patch \
-           file://0013-fix-compiling-error-when-march-not-include-b-ext.patch \
-           file://0014-fix-memcmp-bug-relate-to-use-jmp-table.patch \
-           file://0015-memxxx-align-version-with-merge-tech-or-B-ext.patch \
-           file://0016-strxxx-B-ext-opt-version.patch \
-           file://0017-fix-strchr-missing-index-weak-alias.patch \
-           file://0018-fix-memmove-align-fail-because-of-typo.patch \
-           file://0019-fix-missing-alias-functions.patch \
-	   file://0001-RISCV-enable-align-loops-8-for-optimized-func.patch \
-	   file://0002-RISCV-revert-strchrnul-strncmp-strnlen.patch \
-	   "
+           file://0015-powerpc-Do-not-ask-compiler-for-finding-arch.patch \
+           file://0016-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch \
+           file://0017-Replace-echo-with-printf-builtin-in-nscd-init-script.patch \
+           file://0018-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch \
+           file://0019-timezone-Make-shell-interpreter-overridable-in-tzsel.patch \
+           file://0020-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch \
+           file://0021-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \
+           file://0022-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch \
+           file://0023-aarch64-configure-Pass-mcpu-along-with-march-to-dete.patch \
+"
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build-${TARGET_SYS}"
 
@@ -86,8 +61,6 @@ PACKAGES_DYNAMIC = ""
 BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}"
 TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}"
 
-EXTRA_OEMAKE:class-target += "CFLAGS+=' -march=rv64gc_zba_zbb_zbc_zbs' ASFLAGS+=' -march=rv64gc_zba_zbb_zbc_zbs'"
-
 GLIBC_BROKEN_LOCALES = ""
 
 GLIBCPIE ??= ""
@@ -98,21 +71,22 @@ EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \
                 --enable-clocale=gnu \
                 --with-headers=${STAGING_INCDIR} \
                 --without-selinux \
-                --enable-tunables \
                 --enable-bind-now \
                 --enable-stack-protector=strong \
                 --disable-crypt \
                 --with-default-link \
+                --disable-werror \
+                --enable-fortify-source \
                 ${@bb.utils.contains_any('SELECTED_OPTIMIZATION', '-O0 -Og', '--disable-werror', '', d)} \
                 ${GLIBCPIE} \
                 ${GLIBC_EXTRA_OECONF}"
 
 EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}"
 
-EXTRA_OECONF:append:x86 = " ${@bb.utils.contains_any('TUNE_FEATURES', 'i586 c3', '--disable-cet', '--enable-cet', d)}"
 EXTRA_OECONF:append:x86-64 = " --enable-cet"
 
 PACKAGECONFIG ??= "nscd memory-tagging"
+
 PACKAGECONFIG[nscd] = "--enable-nscd,--disable-nscd"
 PACKAGECONFIG[memory-tagging] = "--enable-memory-tagging,--disable-memory-tagging"
 
@@ -131,10 +105,12 @@ do_configure () {
 # version check and doesn't really help with anything
         (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
         find ${S} -name "configure" | xargs touch
-        CPPFLAGS="" oe_runconf
+        CPPFLAGS="" LD="${HOST_PREFIX}ld.bfd ${TOOLCHAIN_OPTIONS}" oe_runconf
 }
 
 LDFLAGS += "-fuse-ld=bfd"
+CC += "-fuse-ld=bfd"
+
 do_compile () {
 	base_do_compile
 	echo "Adjust ldd script"

+ 0 - 1
recipes-core/glibc/ldconfig-native_2.12.1.bb

@@ -18,7 +18,6 @@ SRC_URI = "file://ldconfig-native-2.12.1.tar.bz2 \
            file://add-riscv-support.patch \
 "
 
-PR = "r2"
 
 FILESEXTRAPATHS =. "${FILE_DIRNAME}/${P}:"