Browse Source

dubhe: glibc: Update & patch glibc toolchain (2.35 -> 2.36).

Signed-off-by: weiheng.cheng <weiheng.cheng@starfivetech.com>
weiheng.cheng 1 year ago
parent
commit
f0ca47f0e7
80 changed files with 5849 additions and 3586 deletions
  1. 1 1
      conf/machine/starfive-dubhe.conf
  2. 13 11
      recipes-core/glibc/cross-localedef-native_2.36.bb
  3. 2 2
      recipes-core/glibc/glibc-common.inc
  4. 5 11
      recipes-core/glibc/glibc-locale.inc
  5. 0 0
      recipes-core/glibc/glibc-locale_2.36.bb
  6. 0 0
      recipes-core/glibc/glibc-mtrace_2.36.bb
  7. 15 12
      recipes-core/glibc/glibc-package.inc
  8. 0 0
      recipes-core/glibc/glibc-scripts_2.36.bb
  9. 119 0
      recipes-core/glibc/glibc-tests_2.36.bb
  10. 0 0
      recipes-core/glibc/glibc-testsuite_2.36.bb
  11. 4 4
      recipes-core/glibc/glibc-version.inc
  12. 4 0
      recipes-core/glibc/glibc.inc
  13. 0 59
      recipes-core/glibc/glibc/0001-Add-array_length-support.patch
  14. 0 43
      recipes-core/glibc/glibc/0001-CVE-2021-38604.patch
  15. 528 0
      recipes-core/glibc/glibc/0001-Linux-Add-ppoll-fortify-symbol-for-64-bit-time_t-BZ-.patch
  16. 0 55
      recipes-core/glibc/glibc/0001-RISC-V-Remove-riscv-specific-sigcontext.h.patch
  17. 1 1
      recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch
  18. 74 81
      recipes-core/glibc/glibc/0001-modify-and-merge-sifive-patches-to-support-V.patch
  19. 0 150
      recipes-core/glibc/glibc/0002-CVE-2021-38604.patch
  20. 0 30
      recipes-core/glibc/glibc/0002-RISC-V-Reserve-about-5K-space-in-mcontext_t-to-suppo.patch
  21. 3 3
      recipes-core/glibc/glibc/0002-add-vector-support-for-memset-memcmp-memmove-memcpy-.patch
  22. 1 1
      recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch
  23. 6 6
      recipes-core/glibc/glibc/0003-add-NT_RISCV_VECTOR-macro-definition-to-align-with-l.patch
  24. 4 4
      recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch
  25. 0 61
      recipes-core/glibc/glibc/0004-RISC-V-Extend-MINSIGSTKSZ-and-SIGSTKSZ-to-backup-RVV.patch
  26. 3 3
      recipes-core/glibc/glibc/0004-fix-the-bcmp-unrecognized-issue.patch
  27. 3 3
      recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch
  28. 0 93
      recipes-core/glibc/glibc/0005-RISC-V-Expand-PTHREAD_STACK_MIN-to-support-RVV-envir.patch
  29. 14 14
      recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch
  30. 7 7
      recipes-core/glibc/glibc/0005-riscv-Resolve-symbols-directly-for-symbols-with-STO_.patch
  31. 3 3
      recipes-core/glibc/glibc/0006-change-memcpy_vector-LMUL-to-m8.patch
  32. 9 5
      recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch
  33. 182 0
      recipes-core/glibc/glibc/0007-add-header-files-for-vector-support.patch
  34. 11 11
      recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch
  35. 2 2
      recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch
  36. 598 0
      recipes-core/glibc/glibc/0008-prohibit-from-generating-plt-table-when-static-linki.patch
  37. 0 27
      recipes-core/glibc/glibc/0009-Revert-RISC-V-Reserve-about-5K-space-in-mcontext_t-t.patch
  38. 0 1581
      recipes-core/glibc/glibc/0009-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch
  39. 25 0
      recipes-core/glibc/glibc/0009-resolve-__memcmpeq-aliased-to-undefined-symbol-memcm.patch
  40. 15 15
      recipes-core/glibc/glibc/0009-yes-within-the-path-sets-wrong-config-variables.patch
  41. 1 1
      recipes-core/glibc/glibc/0010-eglibc-Cross-building-and-testing-instructions.patch
  42. 1382 0
      recipes-core/glibc/glibc/0010-merge-demin-s-mem_xxx-optimization.patch
  43. 0 205
      recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch
  44. 0 384
      recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
  45. 32 0
      recipes-core/glibc/glibc/0011-add-alias-to-bcmp.patch
  46. 4 4
      recipes-core/glibc/glibc/0011-eglibc-Help-bootstrap-cross-toolchain.patch
  47. 0 58
      recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch
  48. 0 49
      recipes-core/glibc/glibc/0012-add-hwcap.h-header-file.patch
  49. 2 2
      recipes-core/glibc/glibc/0012-eglibc-Resolve-__fpscr_values-on-SH4.patch
  50. 30 56
      recipes-core/glibc/glibc/0012-remove-unnecessary-changes-to-support-v.patch
  51. 41 41
      recipes-core/glibc/glibc/0013-eglibc-Forward-port-cross-locale-generation-support.patch
  52. 0 33
      recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch
  53. 46 0
      recipes-core/glibc/glibc/0013-fix-compiling-error-when-march-not-include-b-ext.patch
  54. 0 58
      recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
  55. 53 0
      recipes-core/glibc/glibc/0014-fix-memcmp-bug-relate-to-use-jmp-table.patch
  56. 5 5
      recipes-core/glibc/glibc/0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch
  57. 4 4
      recipes-core/glibc/glibc/0015-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch
  58. 980 0
      recipes-core/glibc/glibc/0015-memxxx-align-version-with-merge-tech-or-B-ext.patch
  59. 3 3
      recipes-core/glibc/glibc/0016-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch
  60. 675 0
      recipes-core/glibc/glibc/0016-strxxx-B-ext-opt-version.patch
  61. 28 0
      recipes-core/glibc/glibc/0017-fix-strchr-missing-index-weak-alias.patch
  62. 1 1
      recipes-core/glibc/glibc/0017-powerpc-Do-not-ask-compiler-for-finding-arch.patch
  63. 0 34
      recipes-core/glibc/glibc/0017-timezone-re-written-tzselect-as-posix-sh.patch
  64. 25 0
      recipes-core/glibc/glibc/0018-fix-memmove-align-fail-because-of-typo.patch
  65. 8 8
      recipes-core/glibc/glibc/0018-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch
  66. 26 19
      recipes-core/glibc/glibc/0019-Replace-echo-with-printf-builtin-in-nscd-init-script.patch
  67. 123 0
      recipes-core/glibc/glibc/0019-fix-missing-alias-functions.patch
  68. 9 8
      recipes-core/glibc/glibc/0020-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch
  69. 47 0
      recipes-core/glibc/glibc/0021-timezone-Make-shell-interpreter-overridable-in-tzsel.patch
  70. 27 0
      recipes-core/glibc/glibc/0022-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch
  71. 13 6
      recipes-core/glibc/glibc/0023-fix-create-thread-failed-in-unprivileged-process-BZ-.patch
  72. 32 0
      recipes-core/glibc/glibc/0024-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch
  73. 0 53
      recipes-core/glibc/glibc/0025-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch
  74. 28 0
      recipes-core/glibc/glibc/0025-startup-Force-O2.patch
  75. 0 31
      recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch
  76. 490 0
      recipes-core/glibc/glibc/1f34a2328890aa192141f96449d25b77f666bf47.patch
  77. 0 184
      recipes-core/glibc/glibc/CVE-2021-43396.patch
  78. 37 0
      recipes-core/glibc/glibc/run-ptest
  79. 44 39
      recipes-core/glibc/glibc_2.36.bb
  80. 1 1
      recipes-core/glibc/ldconfig-native_2.12.1.bb

+ 1 - 1
conf/machine/starfive-dubhe.conf

@@ -42,7 +42,7 @@ RISCV_SBI_PAYLOAD = "${@oe.utils.conditional('ENABLE_NFS','1','Image-starfive-du
 
 
 QEMU_EXTRAOPTIONS:riscv64 = " -cpu rv64,x-b=true,x-v=true"
 QEMU_EXTRAOPTIONS:riscv64 = " -cpu rv64,x-b=true,x-v=true"
 
 
-GLIBCVERSION = "2.35"
+GLIBCVERSION = "2.36"
 
 
 BINUVERSION = "2.37"
 BINUVERSION = "2.37"
 
 

+ 13 - 11
recipes-core/glibc/cross-localedef-native_2.35.bb → recipes-core/glibc/cross-localedef-native_2.36.bb

@@ -1,7 +1,7 @@
 SUMMARY = "Cross locale generation tool for glibc"
 SUMMARY = "Cross locale generation tool for glibc"
 HOMEPAGE = "http://www.gnu.org/software/libc/libc.html"
 HOMEPAGE = "http://www.gnu.org/software/libc/libc.html"
 SECTION = "libs"
 SECTION = "libs"
-LICENSE = "LGPL-2.1"
+LICENSE = "LGPL-2.1-only"
 
 
 LIC_FILES_CHKSUM = "file://LICENSES;md5=1541fd8f5e8f1579512bf05f533371ba \
 LIC_FILES_CHKSUM = "file://LICENSES;md5=1541fd8f5e8f1579512bf05f533371ba \
       file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
       file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
@@ -25,15 +25,14 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
            file://0001-localedef-Add-hardlink-resolver-from-util-linux.patch \
            file://0001-localedef-Add-hardlink-resolver-from-util-linux.patch \
            file://0002-localedef-fix-ups-hardlink-to-make-it-compile.patch \
            file://0002-localedef-fix-ups-hardlink-to-make-it-compile.patch \
            \
            \
-           file://0017-timezone-re-written-tzselect-as-posix-sh.patch \
-           file://0018-Remove-bash-dependency-for-nscd-init-script.patch \
-           file://0019-eglibc-Cross-building-and-testing-instructions.patch \
-           file://0020-eglibc-Help-bootstrap-cross-toolchain.patch \
-           file://0021-eglibc-Resolve-__fpscr_values-on-SH4.patch \
-           file://0022-eglibc-Forward-port-cross-locale-generation-support.patch \
-           file://0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
-           file://0001-Add-array_length-support.patch \
-"
+           file://0010-eglibc-Cross-building-and-testing-instructions.patch \
+           file://0011-eglibc-Help-bootstrap-cross-toolchain.patch \
+           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 \
+           "
 # Makes for a rather long rev (22 characters), but...
 # Makes for a rather long rev (22 characters), but...
 #
 #
 SRCREV_FORMAT = "glibc_localedef"
 SRCREV_FORMAT = "glibc_localedef"
@@ -41,9 +40,12 @@ SRCREV_FORMAT = "glibc_localedef"
 S = "${WORKDIR}/git"
 S = "${WORKDIR}/git"
 
 
 EXTRA_OECONF = "--with-glibc=${S}"
 EXTRA_OECONF = "--with-glibc=${S}"
-CFLAGS += "-fgnu89-inline -std=gnu99 -DIS_IN\(x\)='0'"
 
 
+# We do not need bash to run tzselect script, the default is to use
+# bash but it can be configured by setting KSHELL Makefile variable
+EXTRA_OEMAKE += "KSHELL=/bin/sh"
 
 
+CFLAGS += "-fgnu89-inline -std=gnu99 -DIS_IN\(x\)='0'"
 
 
 do_install() {
 do_install() {
 	install -d ${D}${bindir}
 	install -d ${D}${bindir}

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

@@ -2,7 +2,7 @@ SUMMARY = "GLIBC (GNU C Library)"
 DESCRIPTION = "The GNU C Library is used as the system C library in most systems with the Linux kernel."
 DESCRIPTION = "The GNU C Library is used as the system C library in most systems with the Linux kernel."
 HOMEPAGE = "http://www.gnu.org/software/libc/libc.html"
 HOMEPAGE = "http://www.gnu.org/software/libc/libc.html"
 SECTION = "libs"
 SECTION = "libs"
-LICENSE = "GPLv2 & LGPLv2.1"
+LICENSE = "GPL-2.0-only & LGPL-2.1-only"
 
 
 LIC_FILES_CHKSUM ?= "file://LICENSES;md5=1541fd8f5e8f1579512bf05f533371ba \
 LIC_FILES_CHKSUM ?= "file://LICENSES;md5=1541fd8f5e8f1579512bf05f533371ba \
       file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
       file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
@@ -22,4 +22,4 @@ ARM_INSTRUCTION_SET:armv6 = "arm"
 #
 #
 COMPATIBLE_HOST:libc-musl:class-target = "null"
 COMPATIBLE_HOST:libc-musl:class-target = "null"
 
 
-PV = "2.35"
+PV = "2.36"

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

@@ -5,14 +5,9 @@ SUMMARY = "Locale data from glibc"
 BPN = "glibc"
 BPN = "glibc"
 LOCALEBASEPN = "${MLPREFIX}glibc"
 LOCALEBASEPN = "${MLPREFIX}glibc"
 
 
-# glibc-collateral.inc inhibits all default deps, but do_package needs objcopy
-# ERROR: objcopy failed with exit code 127 (cmd was 'i586-webos-linux-objcopy' --only-keep-debug 'glibc-locale/2.17-r0/package/usr/lib/gconv/IBM1166.so' 'glibc-locale/2.17-r0/package/usr/lib/gconv/.debug/IBM1166.so')
-# ERROR: Function failed: split_and_strip_files
-BINUTILSDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}binutils:do_populate_sysroot"
-BINUTILSDEP:class-nativesdk = "virtual/${TARGET_PREFIX}binutils-crosssdk:do_populate_sysroot"
-do_package[depends] += "${BINUTILSDEP}"
-
-DEPENDS += "virtual/libc"
+# Do not inhibit default deps, do_package requires binutils/gcc for
+# objcopy/gcc-nm and glibc-locale depends on virtual/libc directly.
+INHIBIT_DEFAULT_DEPS = ""
 
 
 # Binary locales are generated at build time if ENABLE_BINARY_LOCALE_GENERATION
 # Binary locales are generated at build time if ENABLE_BINARY_LOCALE_GENERATION
 # is set. The idea is to avoid running localedef on the target (at first boot)
 # is set. The idea is to avoid running localedef on the target (at first boot)
@@ -87,10 +82,9 @@ do_install() {
 	if [ ${PACKAGE_NO_GCONV} -eq 0 ]; then
 	if [ ${PACKAGE_NO_GCONV} -eq 0 ]; then
 		copy_locale_files ${libdir}/gconv 0755
 		copy_locale_files ${libdir}/gconv 0755
 		copy_locale_files ${datadir}/i18n 0644
 		copy_locale_files ${datadir}/i18n 0644
-	else
-		# Remove the libdir if it is empty when gconv is not copied
-		find ${D}${libdir} -type d -empty -delete
 	fi
 	fi
+	# Remove empty dirs in libdir when gconv or locales are not copied
+	find ${D}${libdir} -type d -empty -delete
 	copy_locale_files ${datadir}/locale 0644
 	copy_locale_files ${datadir}/locale 0644
 	install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
 	install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
 }
 }

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


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


+ 15 - 12
recipes-core/glibc/glibc-package.inc

@@ -1,6 +1,6 @@
 INHIBIT_SYSROOT_STRIP = "1"
 INHIBIT_SYSROOT_STRIP = "1"
 
 
-PACKAGES = "${PN}-dbg catchsegv sln nscd ldconfig ldd tzcode glibc-thread-db ${PN}-pic libmemusage malloc-debug libnss-db libsegfault ${PN}-pcprofile libsotruss ${PN} ${PN}-utils glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc ${PN}-src"
+PACKAGES = "${PN}-dbg sln nscd ldconfig ldd ldso tzcode glibc-thread-db ${PN}-pic libmemusage malloc-debug libnss-db ${PN}-pcprofile libsotruss ${PN} ${PN}-utils glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc ${PN}-src"
 
 
 # The ld.so in this glibc supports the GNU_HASH
 # The ld.so in this glibc supports the GNU_HASH
 RPROVIDES:${PN} = "eglibc rtld(GNU_HASH)"
 RPROVIDES:${PN} = "eglibc rtld(GNU_HASH)"
@@ -23,21 +23,22 @@ ARCH_DYNAMIC_LOADER:aarch64 = "ld-linux-${TARGET_ARCH}.so.1"
 libc_baselibs:append = " ${@oe.utils.conditional('ARCH_DYNAMIC_LOADER', '', '', '${root_prefix}/lib/${ARCH_DYNAMIC_LOADER}', d)}"
 libc_baselibs:append = " ${@oe.utils.conditional('ARCH_DYNAMIC_LOADER', '', '', '${root_prefix}/lib/${ARCH_DYNAMIC_LOADER}', d)}"
 INSANE_SKIP:${PN}:append:aarch64 = " libdir"
 INSANE_SKIP:${PN}:append:aarch64 = " libdir"
 INSANE_SKIP:${PN}-dev += "staticdev"
 INSANE_SKIP:${PN}-dev += "staticdev"
+INSANE_SKIP:${MLPREFIX}ldso:append = " dev-so libdir"
 
 
 FILES:${PN} = "${libc_baselibs} ${libexecdir}/* ${sysconfdir}/ld.so.conf"
 FILES:${PN} = "${libc_baselibs} ${libexecdir}/* ${sysconfdir}/ld.so.conf"
 RRECOMMENDS:${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'ldconfig', '${MLPREFIX}ldconfig', '', d)}"
 RRECOMMENDS:${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'ldconfig', '${MLPREFIX}ldconfig', '', d)}"
 FILES:ldconfig = "${base_sbindir}/ldconfig"
 FILES:ldconfig = "${base_sbindir}/ldconfig"
 FILES:ldd = "${bindir}/ldd"
 FILES:ldd = "${bindir}/ldd"
-FILES:libsegfault = "${base_libdir}/libSegFault*"
+FILES:ldso = "${bindir}/${MLPREFIX}ld.so"
 FILES:libmemusage = "${base_libdir}/libmemusage.so"
 FILES:libmemusage = "${base_libdir}/libmemusage.so"
 FILES:malloc-debug = "${base_libdir}/libc_malloc_debug.so.0"
 FILES:malloc-debug = "${base_libdir}/libc_malloc_debug.so.0"
 FILES:libnss-db = "${base_libdir}/libnss_db.so.* ${base_libdir}/libnss_db-*.so ${localstatedir}/db/Makefile ${localstatedir}/db/makedbs.sh"
 FILES:libnss-db = "${base_libdir}/libnss_db.so.* ${base_libdir}/libnss_db-*.so ${localstatedir}/db/Makefile ${localstatedir}/db/makedbs.sh"
-RDEPENDS_libnss-db = "${PN}-utils"
+RDEPENDS:libnss-db = "${PN}-utils"
 FILES:glibc-extra-nss = "${base_libdir}/libnss_*-*.so ${base_libdir}/libnss_*.so.*"
 FILES:glibc-extra-nss = "${base_libdir}/libnss_*-*.so ${base_libdir}/libnss_*.so.*"
 FILES:sln = "${base_sbindir}/sln"
 FILES:sln = "${base_sbindir}/sln"
 FILES:${PN}-pic = "${libdir}/*_pic.a ${libdir}/*_pic.map ${libdir}/libc_pic/*.o"
 FILES:${PN}-pic = "${libdir}/*_pic.a ${libdir}/*_pic.map ${libdir}/libc_pic/*.o"
 FILES:libsotruss = "${libdir}/audit/sotruss-lib.so"
 FILES:libsotruss = "${libdir}/audit/sotruss-lib.so"
-FILES:SOLIBSDEV = "${libdir}/lib*${SOLIBSDEV}"
+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"
 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"
 RDEPENDS:${PN}-dev = "linux-libc-headers-dev"
 FILES:${PN}-staticdev += "${libdir}/*.a ${base_libdir}/*.a"
 FILES:${PN}-staticdev += "${libdir}/*.a ${base_libdir}/*.a"
@@ -46,8 +47,6 @@ FILES:nscd = "${sbindir}/nscd* ${sysconfdir}/init.d/nscd ${systemd_system_unitdi
 FILES:${PN}-mtrace = "${bindir}/mtrace"
 FILES:${PN}-mtrace = "${bindir}/mtrace"
 FILES:tzcode = "${bindir}/tzselect ${sbindir}/zic ${bindir}/zdump"
 FILES:tzcode = "${bindir}/tzselect ${sbindir}/zic ${bindir}/zdump"
 FILES:${PN}-utils = "${bindir}/* ${sbindir}/*"
 FILES:${PN}-utils = "${bindir}/* ${sbindir}/*"
-FILES:catchsegv = "${bindir}/catchsegv"
-RDEPENDS:catchsegv = "libsegfault"
 FILES:${PN}-pcprofile = "${base_libdir}/libpcprofile.so"
 FILES:${PN}-pcprofile = "${base_libdir}/libpcprofile.so"
 FILES:glibc-thread-db = "${base_libdir}/libthread_db.so.* ${base_libdir}/libthread_db-*.so"
 FILES:glibc-thread-db = "${base_libdir}/libthread_db.so.* ${base_libdir}/libthread_db-*.so"
 RPROVIDES:${PN}-dev += "libc-dev"
 RPROVIDES:${PN}-dev += "libc-dev"
@@ -58,7 +57,7 @@ DESCRIPTION:sln = "Similar to the 'ln' utility, but statically linked.  sln is u
 SUMMARY:nscd = "Name service cache daemon"
 SUMMARY:nscd = "Name service cache daemon"
 DESCRIPTION:nscd = "nscd, name service cache daemon, caches name service lookups for the passwd, group and hosts information.  It can damatically improvide performance with remote, such as NIS or NIS+, name services."
 DESCRIPTION:nscd = "nscd, name service cache daemon, caches name service lookups for the passwd, group and hosts information.  It can damatically improvide performance with remote, such as NIS or NIS+, name services."
 SUMMARY:glibc-extra-nss = "hesiod, NIS and NIS+ nss libraries"
 SUMMARY:glibc-extra-nss = "hesiod, NIS and NIS+ nss libraries"
-DESCRIPTION:glibc-extra-nss = "glibc_ nis, nisplus and hesiod search services."
+DESCRIPTION:glibc-extra-nss = "glibc: nis, nisplus and hesiod search services."
 SUMMARY:ldd = "print shared library dependencies"
 SUMMARY:ldd = "print shared library dependencies"
 DESCRIPTION:ldd = "${bindir}/ldd prints shared library dependencies for each program or shared library specified on the command line."
 DESCRIPTION:ldd = "${bindir}/ldd prints shared library dependencies for each program or shared library specified on the command line."
 SUMMARY:${PN}-utils = "Miscellaneous utilities provided by glibc"
 SUMMARY:${PN}-utils = "Miscellaneous utilities provided by glibc"
@@ -121,6 +120,9 @@ do_install() {
 	fi
 	fi
         ln -rs ${D}${base_libdir}/libpthread.so.0 ${D}${libdir}/libpthread.so
         ln -rs ${D}${base_libdir}/libpthread.so.0 ${D}${libdir}/libpthread.so
         ln -rs ${D}${base_libdir}/librt.so.1 ${D}${libdir}/librt.so
         ln -rs ${D}${base_libdir}/librt.so.1 ${D}${libdir}/librt.so
+        if [ -n "${MLPREFIX}" ]; then
+                mv ${D}${bindir}/ld.so ${D}${bindir}/${MLPREFIX}ld.so
+        fi
 }
 }
 
 
 def get_libc_fpu_setting(bb, d):
 def get_libc_fpu_setting(bb, d):
@@ -160,6 +162,7 @@ do_install_armmultilib () {
 	oe_multilib_header bits/shm.h bits/sigstack.h bits/stat.h bits/statfs.h bits/typesizes.h
 	oe_multilib_header bits/shm.h bits/sigstack.h bits/stat.h bits/statfs.h bits/typesizes.h
 	oe_multilib_header bits/procfs-id.h bits/procfs.h bits/shmlba.h
 	oe_multilib_header bits/procfs-id.h bits/procfs.h bits/shmlba.h
 	oe_multilib_header bits/struct_stat.h bits/pthread_stack_min.h
 	oe_multilib_header bits/struct_stat.h bits/pthread_stack_min.h
+	oe_multilib_header bits/dl_find_object.h bits/rseq.h bits/timesize.h
 
 
 	oe_multilib_header fpu_control.h gnu/lib-names.h gnu/stubs.h ieee754.h
 	oe_multilib_header fpu_control.h gnu/lib-names.h gnu/stubs.h ieee754.h
 
 
@@ -261,17 +264,17 @@ python populate_packages:prepend () {
         bpn = d.getVar('BPN')
         bpn = d.getVar('BPN')
         prefix = d.getVar('MLPREFIX') or ""
         prefix = d.getVar('MLPREFIX') or ""
         # Set the base package...
         # Set the base package...
-        d.setVar('PKG_' + prefix + bpn, prefix + 'libc6')
+        d.setVar('PKG:' + prefix + bpn, prefix + 'libc6')
         libcprefix = prefix + bpn + '-'
         libcprefix = prefix + bpn + '-'
         for p in pkgs:
         for p in pkgs:
             # And all the subpackages.
             # And all the subpackages.
             if p.startswith(libcprefix):
             if p.startswith(libcprefix):
                 renamed = p.replace(bpn, 'libc6', 1)
                 renamed = p.replace(bpn, 'libc6', 1)
-                d.setVar('PKG_' + p, renamed)
+                d.setVar('PKG:' + p, renamed)
         # For backward compatibility with old -dbg package
         # For backward compatibility with old -dbg package
-        d.appendVar('RPROVIDES_' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg')
-        d.appendVar('RCONFLICTS_' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg')
-        d.appendVar('RREPLACES_' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg')
+        d.appendVar('RPROVIDES:' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg')
+        d.appendVar('RCONFLICTS:' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg')
+        d.appendVar('RREPLACES:' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg')
 }
 }
 
 
 pkg_postinst:nscd () {
 pkg_postinst:nscd () {

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


+ 119 - 0
recipes-core/glibc/glibc-tests_2.36.bb

@@ -0,0 +1,119 @@
+require glibc_${PV}.bb
+require glibc-tests.inc
+
+inherit ptest features_check
+REQUIRED_DISTRO_FEATURES = "ptest"
+
+SRC_URI += "\
+	file://run-ptest \
+"
+
+SUMMARY = "glibc tests to be run with ptest"
+
+# Erase some variables already set by glibc_${PV}
+python __anonymous() {
+       # Remove packages provided by glibc build, we only need a subset of them
+       d.setVar("PACKAGES", "${PN} ${PN}-ptest")
+
+       d.setVar("PROVIDES", "${PN} ${PN}-ptest")
+
+       bbclassextend = d.getVar("BBCLASSEXTEND").replace("nativesdk", "").strip()
+       d.setVar("BBCLASSEXTEND", bbclassextend)
+       d.setVar("RRECOMMENDS", "")
+       d.setVar("SYSTEMD_SERVICE:nscd", "")
+       d.setVar("SYSTEMD_PACKAGES", "")
+}
+
+# Remove any leftovers from original glibc recipe
+RPROVIDES:${PN} = "${PN}"
+RRECOMMENDS:${PN} = ""
+RDEPENDS:${PN} = " glibc sed"
+RDEPENDS:${PN}-ptest = "${PN}"
+DEPENDS += "sed"
+
+export oe_srcdir="${exec_prefix}/src/debug/glibc/${PV}/"
+
+# Just build tests for target - do not run them
+do_check:append () {
+	oe_runmake -i check run-built-tests=no
+}
+addtask do_check after do_compile before do_install_ptest_base
+
+glibc_strip_build_directory () {
+	# Delete all non executable files from build directory
+	find ${B} ! -executable -type f -delete
+
+	# Remove build dynamic libraries and links to them as
+	# those are already installed in the target device
+	find ${B} -type f -name "*.so" -delete
+	find ${B} -type l -name "*.so*" -delete
+
+	# Remove headers (installed with glibc)
+	find ${B} -type f -name "*.h" -delete
+
+	find ${B} -type f -name "isomac" -delete
+	find ${B} -type f -name "annexc" -delete
+}
+
+do_install_ptest_base () {
+	glibc_strip_build_directory
+
+	ls -r ${B}/*/*-time64 > ${B}/tst_time64
+
+	# Remove '-time64' suffix - those tests are also time related
+	sed -e "s/-time64$//" ${B}/tst_time64 > ${B}/tst_time_tmp
+	tst_time=$(cat ${B}/tst_time_tmp ${B}/tst_time64)
+
+	rm ${B}/tst_time_tmp ${B}/tst_time64
+	echo "${tst_time}"
+
+	# Install build test programs to the image
+	install -d ${D}${PTEST_PATH}/tests/glibc-ptest/
+
+	for f in "${tst_time}"
+	do
+	    cp -r ${f} ${D}${PTEST_PATH}/tests/glibc-ptest/
+	done
+
+	install -d ${D}${PTEST_PATH}
+	cp ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/
+
+}
+
+# The datadir directory is required to allow core (and reused)
+# glibc cleanup function to finish correctly, as this directory
+# is not created for ptests
+stash_locale_package_cleanup:prepend () {
+	mkdir -p ${PKGD}${datadir}
+}
+
+stash_locale_sysroot_cleanup:prepend () {
+	mkdir -p ${SYSROOT_DESTDIR}${datadir}
+}
+
+# Prevent the do_package() task to set 'libc6' prefix
+# for glibc tests related packages
+python populate_packages:prepend () {
+    if d.getVar('DEBIAN_NAMES'):
+        d.setVar('DEBIAN_NAMES', '')
+}
+
+FILES:${PN} = "${PTEST_PATH}/* /usr/src/debug/${PN}/*"
+
+EXCLUDE_FROM_SHLIBS = "1"
+
+# Install debug data in .debug and sources in /usr/src/debug
+# It is more handy to have _all_ the sources and symbols in one
+# place (package) as this recipe will be used for validation and
+# debugging.
+PACKAGE_DEBUG_SPLIT_STYLE = ".debug"
+
+# glibc test cases violate by default some Yocto/OE checks (staticdev,
+# textrel)
+# 'debug-files' - add everything (including debug) into one package
+#                 (no need to install/build *-src package)
+INSANE_SKIP:${PN} += "staticdev textrel debug-files rpaths"
+
+deltask do_stash_locale
+do_install[noexec] = "1"
+do_populate_sysroot[noexec] = "1"

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


+ 4 - 4
recipes-core/glibc/glibc-version.inc

@@ -1,7 +1,7 @@
-SRCBRANCH ?= "master"
-PV = "2.35"
-SRCREV_glibc ?= "1d3decee997ba2fc24af81803299b2f4f3c47063"
-SRCREV_localedef ?= "95c0221703ad970a52445e9eaf91c4aff35eebef"
+SRCBRANCH ?= "release/2.36/master"
+PV = "2.36"
+SRCREV_glibc ?= "b3736d1a3c60a3ec9959bf3b38794958546bf6a2"
+SRCREV_localedef ?= "794da69788cbf9bf57b59a852f9f11307663fa87"
 
 
 GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
 GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
 
 

+ 4 - 0
recipes-core/glibc/glibc.inc

@@ -41,6 +41,10 @@ PARALLEL_MAKE = ""
 # ensure make uses /bin/bash
 # ensure make uses /bin/bash
 EXTRA_OEMAKE += "SHELL=/bin/bash"
 EXTRA_OEMAKE += "SHELL=/bin/bash"
 
 
+# We do not need bash to run tzselect script, the default is to use
+# bash but it can be configured by setting KSHELL Makefile variable
+EXTRA_OEMAKE += "KSHELL=/bin/sh"
+
 do_configure:prepend() {
 do_configure:prepend() {
 	sed -e "s#/bin/bash#/bin/sh#" -i ${S}/elf/ldd.bash.in
 	sed -e "s#/bin/bash#/bin/sh#" -i ${S}/elf/ldd.bash.in
 }
 }

+ 0 - 59
recipes-core/glibc/glibc/0001-Add-array_length-support.patch

@@ -1,59 +0,0 @@
-From ce34f0e215324455bbb1e4b18f5723b081cae801 Mon Sep 17 00:00:00 2001
-From: Jun Yuan Tan <junyuan.tan@starfivetech.com>
-Date: Tue, 23 Nov 2021 12:08:27 +0800
-Subject: [PATCH 1/1] Add array_length support
-
-This is needed to build localedef from glibc 2.35 in master branch.
-(Commit f5117c6504888fab5423282a4607c552b90fd3f9)
-
-Signed-off-by: Jun Yuan Tan <junyuan.tan@starfivetech.com>
----
- localedef/include/array_length.h | 36 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 36 insertions(+)
- create mode 100644 localedef/include/array_length.h
-
-diff --git a/localedef/include/array_length.h b/localedef/include/array_length.h
-new file mode 100644
-index 0000000..12c5126
---- /dev/null
-+++ b/localedef/include/array_length.h
-@@ -0,0 +1,36 @@
-+/* The array_length and array_end macros.
-+   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/>.  */
-+
-+#ifndef _ARRAY_LENGTH_H
-+#define _ARRAY_LENGTH_H
-+
-+/* array_length (VAR) is the number of elements in the array VAR.  VAR
-+   must evaluate to an array, not a pointer.  */
-+#define array_length(var)                                               \
-+  (sizeof (var) / sizeof ((var)[0])                                     \
-+   + 0 * sizeof (struct {                                               \
-+       _Static_assert (!__builtin_types_compatible_p                    \
-+                       (__typeof (var), __typeof (&(var)[0])),          \
-+                       "argument must be an array");                    \
-+   }))
-+
-+/* array_end (VAR) is a pointer one past the end of the array VAR.
-+   VAR must evaluate to an array, not a pointer.  */
-+#define array_end(var) (&(var)[array_length (var)])
-+
-+#endif /* _ARRAY_LENGTH_H */
--- 
-2.33.1
-

+ 0 - 43
recipes-core/glibc/glibc/0001-CVE-2021-38604.patch

@@ -1,43 +0,0 @@
-From b805aebd42364fe696e417808a700fdb9800c9e8 Mon Sep 17 00:00:00 2001
-From: Nikita Popov <npv1310@gmail.com>
-Date: Mon, 9 Aug 2021 20:17:34 +0530
-Subject: [PATCH] librt: fix NULL pointer dereference (bug 28213)
-
-Helper thread frees copied attribute on NOTIFY_REMOVED message
-received from the OS kernel.  Unfortunately, it fails to check whether
-copied attribute actually exists (data.attr != NULL).  This worked
-earlier because free() checks passed pointer before actually
-attempting to release corresponding memory.  But
-__pthread_attr_destroy assumes pointer is not NULL.
-
-So passing NULL pointer to __pthread_attr_destroy will result in
-segmentation fault.  This scenario is possible if
-notification->sigev_notify_attributes == NULL (which means default
-thread attributes should be used).
-
-Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=b805aebd42364fe696e417808a700fdb9800c9e8]
-CVE: CVE-2021-38604
-
-Signed-off-by: Nikita Popov <npv1310@gmail.com>
-Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Signed-off-by: Vinay Kumar <vinay.m.engg@gmail.com>
----
- sysdeps/unix/sysv/linux/mq_notify.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c
-index 9799dcdaa4..eccae2e4c6 100644
---- a/sysdeps/unix/sysv/linux/mq_notify.c
-+++ b/sysdeps/unix/sysv/linux/mq_notify.c
-@@ -131,7 +131,7 @@ helper_thread (void *arg)
- 	       to wait until it is done with it.  */
- 	    (void) __pthread_barrier_wait (&notify_barrier);
- 	}
--      else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED)
-+      else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED && data.attr != NULL)
- 	{
- 	  /* The only state we keep is the copy of the thread attributes.  */
- 	  __pthread_attr_destroy (data.attr);
--- 
-2.31.1
-

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

@@ -0,0 +1,528 @@
+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 - 55
recipes-core/glibc/glibc/0001-RISC-V-Remove-riscv-specific-sigcontext.h.patch

@@ -1,55 +0,0 @@
-From 4f78efecb2ef9e87a15a3dde8adbdaa53f0598d7 Mon Sep 17 00:00:00 2001
-From: Vincent Chen <vincent.chen@sifive.com>
-Date: Mon, 13 Sep 2021 09:41:14 +0800
-Subject: [PATCH 1/8] RISC-V: Remove riscv-specific sigcontext.h
-
-Remove riscv-specific sigcontext.h so that Glibc can directly use
-sigcontext.h provided by the kernel to reduce synchronization work
-when new extension support is introduced.
-
-Signed-off-by: max.ma <max.ma@starfivetech.com>
----
- .../unix/sysv/linux/riscv/bits/sigcontext.h   | 31 -------------------
- 1 file changed, 31 deletions(-)
- delete mode 100644 sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h
-
-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 14e4e06fac..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-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/>.  */
--
--#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
--- 
-2.33.1
-

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

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

+ 74 - 81
recipes-core/glibc/glibc/0003-RISC-V-Save-and-restore-VCSR-when-doing-user-context.patch → recipes-core/glibc/glibc/0001-modify-and-merge-sifive-patches-to-support-V.patch

@@ -1,30 +1,22 @@
-From 1c08ed548a24c41542bdb7309e05c1aef70f135d Mon Sep 17 00:00:00 2001
-From: Vincent Chen <vincent.chen@sifive.com>
-Date: Mon, 13 Sep 2021 09:41:16 +0800
-Subject: [PATCH 3/8] RISC-V: Save and restore VCSR when doing user context
- switch
+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
 
 
-According to the RISC-V V extension specification, all vector registers
-except VCSR are caller-saved registers. The VCSR (vxrm + vxsat) has thread
-storage duration. Therefore, only VCSR needs to be added to the user
-context operation.
-
-Signed-off-by: max.ma <max.ma@starfivetech.com>
 ---
 ---
- sysdeps/riscv/Makefile                       |  5 +++
- sysdeps/riscv/rtld-global-offsets.sym        |  7 ++++
- sysdeps/unix/sysv/linux/riscv/bits/hwcap.h   | 31 +++++++++++++++
- sysdeps/unix/sysv/linux/riscv/getcontext.S   | 22 ++++++++++-
- sysdeps/unix/sysv/linux/riscv/setcontext.S   | 22 +++++++++++
- sysdeps/unix/sysv/linux/riscv/swapcontext.S  | 41 ++++++++++++++++++++
- sysdeps/unix/sysv/linux/riscv/sysdep.h       |  1 +
- sysdeps/unix/sysv/linux/riscv/ucontext_i.sym |  6 +++
- 8 files changed, 134 insertions(+), 1 deletion(-)
- create mode 100644 sysdeps/riscv/rtld-global-offsets.sym
- create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/hwcap.h
+ 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
 diff --git a/sysdeps/riscv/Makefile b/sysdeps/riscv/Makefile
-index 20a9968106..a5c2106a09 100644
+index 8fb10b164f..e2d84640d4 100644
 --- a/sysdeps/riscv/Makefile
 --- a/sysdeps/riscv/Makefile
 +++ b/sysdeps/riscv/Makefile
 +++ b/sysdeps/riscv/Makefile
 @@ -2,6 +2,11 @@ ifeq ($(subdir),misc)
 @@ -2,6 +2,11 @@ ifeq ($(subdir),misc)
@@ -39,58 +31,45 @@ index 20a9968106..a5c2106a09 100644
  # RISC-V's assembler also needs to know about PIC as it changes the definition
  # RISC-V's assembler also needs to know about PIC as it changes the definition
  # of some assembler macros.
  # of some assembler macros.
  ASFLAGS-.os += $(pic-ccflag)
  ASFLAGS-.os += $(pic-ccflag)
-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..e6c5ef5740
---- /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) 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
-+   <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/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
 diff --git a/sysdeps/unix/sysv/linux/riscv/getcontext.S b/sysdeps/unix/sysv/linux/riscv/getcontext.S
-index d6a9bbca60..840d8feca4 100644
+index 499f70b65d..371ebd52a7 100644
 --- a/sysdeps/unix/sysv/linux/riscv/getcontext.S
 --- a/sysdeps/unix/sysv/linux/riscv/getcontext.S
 +++ b/sysdeps/unix/sysv/linux/riscv/getcontext.S
 +++ b/sysdeps/unix/sysv/linux/riscv/getcontext.S
 @@ -16,6 +16,8 @@
 @@ -16,6 +16,8 @@
@@ -133,9 +112,11 @@ index d6a9bbca60..840d8feca4 100644
  
  
  PSEUDO_END (__getcontext)
  PSEUDO_END (__getcontext)
 -
 -
- weak_alias (__getcontext, 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
 diff --git a/sysdeps/unix/sysv/linux/riscv/setcontext.S b/sysdeps/unix/sysv/linux/riscv/setcontext.S
-index 9510518750..d2404fbe9c 100644
+index e3bc84a2e6..423d94df27 100644
 --- a/sysdeps/unix/sysv/linux/riscv/setcontext.S
 --- a/sysdeps/unix/sysv/linux/riscv/setcontext.S
 +++ b/sysdeps/unix/sysv/linux/riscv/setcontext.S
 +++ b/sysdeps/unix/sysv/linux/riscv/setcontext.S
 @@ -16,6 +16,8 @@
 @@ -16,6 +16,8 @@
@@ -175,7 +156,7 @@ index 9510518750..d2404fbe9c 100644
  	   unless makecontext() has been called.  */
  	   unless makecontext() has been called.  */
  	RESTORE_INT_REG     (t1,   0, t0)
  	RESTORE_INT_REG     (t1,   0, t0)
 diff --git a/sysdeps/unix/sysv/linux/riscv/swapcontext.S b/sysdeps/unix/sysv/linux/riscv/swapcontext.S
 diff --git a/sysdeps/unix/sysv/linux/riscv/swapcontext.S b/sysdeps/unix/sysv/linux/riscv/swapcontext.S
-index df0f69969c..94ae8e4bdc 100644
+index 4da615f6d4..16600f78df 100644
 --- a/sysdeps/unix/sysv/linux/riscv/swapcontext.S
 --- a/sysdeps/unix/sysv/linux/riscv/swapcontext.S
 +++ b/sysdeps/unix/sysv/linux/riscv/swapcontext.S
 +++ b/sysdeps/unix/sysv/linux/riscv/swapcontext.S
 @@ -16,6 +16,8 @@
 @@ -16,6 +16,8 @@
@@ -240,6 +221,19 @@ index df0f69969c..94ae8e4bdc 100644
  	/* Note the contents of argument registers will be random
  	/* Note the contents of argument registers will be random
  	   unless makecontext() has been called.  */
  	   unless makecontext() has been called.  */
  	RESTORE_INT_REG (t1,   0, t0)
  	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
 diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h
 index 37ff07a0d7..c9f8fd8236 100644
 index 37ff07a0d7..c9f8fd8236 100644
 --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h
 --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h
@@ -253,7 +247,7 @@ index 37ff07a0d7..c9f8fd8236 100644
  
  
  # define ENTRY(name) LEAF(name)
  # 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
 diff --git a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
-index be55b26310..4037473c9a 100644
+index be55b26310..b91945a080 100644
 --- a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
 --- a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
 +++ b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
 +++ b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
 @@ -2,6 +2,7 @@
 @@ -2,6 +2,7 @@
@@ -264,17 +258,16 @@ index be55b26310..4037473c9a 100644
  
  
  -- Constants used by the rt_sigprocmask call.
  -- Constants used by the rt_sigprocmask call.
  
  
-@@ -27,5 +28,10 @@ STACK_FLAGS			stack (ss_flags)
+@@ -27,5 +28,9 @@ STACK_FLAGS			stack (ss_flags)
  
  
  MCONTEXT_GREGS			mcontext (__gregs)
  MCONTEXT_GREGS			mcontext (__gregs)
  MCONTEXT_FPREGS			mcontext (__fpregs)
  MCONTEXT_FPREGS			mcontext (__fpregs)
 +MCONTEXT_EXTENSION 		mcontext (__reserved)
 +MCONTEXT_EXTENSION 		mcontext (__reserved)
  
  
  UCONTEXT_SIZE			sizeof (ucontext_t)
  UCONTEXT_SIZE			sizeof (ucontext_t)
-+
 +VCSR_OFFSET			offsetof (struct __riscv_v_state, vcsr)
 +VCSR_OFFSET			offsetof (struct __riscv_v_state, vcsr)
 +
 +
 +RVV_MAGIC
 +RVV_MAGIC
 -- 
 -- 
-2.33.1
+2.25.1
 
 

+ 0 - 150
recipes-core/glibc/glibc/0002-CVE-2021-38604.patch

@@ -1,150 +0,0 @@
-From 4cc79c217744743077bf7a0ec5e0a4318f1e6641 Mon Sep 17 00:00:00 2001
-From: Nikita Popov <npv1310@gmail.com>
-Date: Thu, 12 Aug 2021 16:09:50 +0530
-Subject: [PATCH] librt: add test (bug 28213)
-
-This test implements following logic:
-1) Create POSIX message queue.
-   Register a notification with mq_notify (using NULL attributes).
-   Then immediately unregister the notification with mq_notify.
-   Helper thread in a vulnerable version of glibc
-   should cause NULL pointer dereference after these steps.
-2) Once again, register the same notification.
-   Try to send a dummy message.
-   Test is considered successfulif the dummy message
-   is successfully received by the callback function.
-
-Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=4cc79c217744743077bf7a0ec5e0a4318f1e6641]
-CVE: CVE-2021-38604
-
-Signed-off-by: Nikita Popov <npv1310@gmail.com>
-Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Signed-off-by: Vinay Kumar <vinay.m.engg@gmail.com>
----
- rt/Makefile      |   1 +
- rt/tst-bz28213.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 102 insertions(+)
- create mode 100644 rt/tst-bz28213.c
-
-diff --git a/rt/Makefile b/rt/Makefile
-index 113cea03a5..910e775995 100644
---- a/rt/Makefile
-+++ b/rt/Makefile
-@@ -74,6 +74,7 @@ tests := tst-shm tst-timer tst-timer2 \
- 	 tst-aio7 tst-aio8 tst-aio9 tst-aio10 \
- 	 tst-mqueue1 tst-mqueue2 tst-mqueue3 tst-mqueue4 \
- 	 tst-mqueue5 tst-mqueue6 tst-mqueue7 tst-mqueue8 tst-mqueue9 \
-+	 tst-bz28213 \
- 	 tst-timer3 tst-timer4 tst-timer5 \
- 	 tst-cpuclock2 tst-cputimer1 tst-cputimer2 tst-cputimer3 \
- 	 tst-shm-cancel \
-diff --git a/rt/tst-bz28213.c b/rt/tst-bz28213.c
-new file mode 100644
-index 0000000000..0c096b5a0a
---- /dev/null
-+++ b/rt/tst-bz28213.c
-@@ -0,0 +1,101 @@
-+/* Bug 28213: test for NULL pointer dereference in mq_notify.
-+   Copyright (C) The GNU Toolchain Authors.
-+   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 <errno.h>
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <fcntl.h>
-+#include <unistd.h>
-+#include <mqueue.h>
-+#include <signal.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <support/check.h>
-+
-+static mqd_t m = -1;
-+static const char msg[] = "hello";
-+
-+static void
-+check_bz28213_cb (union sigval sv)
-+{
-+  char buf[sizeof (msg)];
-+
-+  (void) sv;
-+
-+  TEST_VERIFY_EXIT ((size_t) mq_receive (m, buf, sizeof (buf), NULL)
-+		    == sizeof (buf));
-+  TEST_VERIFY_EXIT (memcmp (buf, msg, sizeof (buf)) == 0);
-+
-+  exit (0);
-+}
-+
-+static void
-+check_bz28213 (void)
-+{
-+  struct sigevent sev;
-+
-+  memset (&sev, '\0', sizeof (sev));
-+  sev.sigev_notify = SIGEV_THREAD;
-+  sev.sigev_notify_function = check_bz28213_cb;
-+
-+  /* Step 1: Register & unregister notifier.
-+     Helper thread should receive NOTIFY_REMOVED notification.
-+     In a vulnerable version of glibc, NULL pointer dereference follows. */
-+  TEST_VERIFY_EXIT (mq_notify (m, &sev) == 0);
-+  TEST_VERIFY_EXIT (mq_notify (m, NULL) == 0);
-+
-+  /* Step 2: Once again, register notification.
-+     Try to send one message.
-+     Test is considered successful, if the callback does exit (0). */
-+  TEST_VERIFY_EXIT (mq_notify (m, &sev) == 0);
-+  TEST_VERIFY_EXIT (mq_send (m, msg, sizeof (msg), 1) == 0);
-+
-+  /* Wait... */
-+  pause ();
-+}
-+
-+static int
-+do_test (void)
-+{
-+  static const char m_name[] = "/bz28213_queue";
-+  struct mq_attr m_attr;
-+
-+  memset (&m_attr, '\0', sizeof (m_attr));
-+  m_attr.mq_maxmsg = 1;
-+  m_attr.mq_msgsize = sizeof (msg);
-+
-+  m = mq_open (m_name,
-+               O_RDWR | O_CREAT | O_EXCL,
-+               0600,
-+               &m_attr);
-+
-+  if (m < 0)
-+    {
-+      if (errno == ENOSYS)
-+        FAIL_UNSUPPORTED ("POSIX message queues are not implemented\n");
-+      FAIL_EXIT1 ("Failed to create POSIX message queue: %m\n");
-+    }
-+
-+  TEST_VERIFY_EXIT (mq_unlink (m_name) == 0);
-+
-+  check_bz28213 ();
-+
-+  return 0;
-+}
-+
-+#include <support/test-driver.c>
--- 
-2.31.1
-

+ 0 - 30
recipes-core/glibc/glibc/0002-RISC-V-Reserve-about-5K-space-in-mcontext_t-to-suppo.patch

@@ -1,30 +0,0 @@
-From bcface37cf6df3f3b0800f79e4282a690122b0c8 Mon Sep 17 00:00:00 2001
-From: Vincent Chen <vincent.chen@sifive.com>
-Date: Mon, 13 Sep 2021 09:41:15 +0800
-Subject: [PATCH 2/8] RISC-V: Reserve about 5K space in mcontext_t to support
- future ISA expansion.
-
-Following the changes of struct sigcontext in Linux to reserve about 5K space
-to support future ISA expansion.
-
-Signed-off-by: max.ma <max.ma@starfivetech.com>
----
- sysdeps/unix/sysv/linux/riscv/sys/ucontext.h | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h b/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h
-index cfafa44f99..80caf078fc 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.  */
--- 
-2.33.1
-

+ 3 - 3
recipes-core/glibc/glibc/0006-add-vector-support-for-memset-memcmp-memmove-memcpy-.patch → recipes-core/glibc/glibc/0002-add-vector-support-for-memset-memcmp-memmove-memcpy-.patch

@@ -1,7 +1,7 @@
-From c4c3986117a0d2b5c4e093872f471b2b5b882cee Mon Sep 17 00:00:00 2001
+From 0d709adf42cb79137b8d125eff8c4a386cf69187 Mon Sep 17 00:00:00 2001
 From: "max.ma" <max.ma@starfivetech.com>
 From: "max.ma" <max.ma@starfivetech.com>
 Date: Tue, 21 Dec 2021 17:42:04 -0800
 Date: Tue, 21 Dec 2021 17:42:04 -0800
-Subject: [PATCH 6/8] add vector support for
+Subject: [PATCH 02/19] add vector support for
  memset/memcmp/memmove/memcpy/memchr/strlen/strcmp
  memset/memcmp/memmove/memcpy/memchr/strlen/strcmp
 
 
 ---
 ---
@@ -1525,5 +1525,5 @@ index c9f8fd8236..7b75bdfee2 100644
  
  
  # define ENTRY(name) LEAF(name)
  # define ENTRY(name) LEAF(name)
 -- 
 -- 
-2.33.1
+2.25.1
 
 

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

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

+ 6 - 6
recipes-core/glibc/glibc/0007-add-NT_RISCV_VECTOR-macro-definition-to-align-with-l.patch → recipes-core/glibc/glibc/0003-add-NT_RISCV_VECTOR-macro-definition-to-align-with-l.patch

@@ -1,18 +1,18 @@
-From 4ca3f0f9517885ab7b6c60d9ec4e3a15b83d8d82 Mon Sep 17 00:00:00 2001
+From aa022f152236190a26964971ec3a7c6b62028ad1 Mon Sep 17 00:00:00 2001
 From: "max.ma" <max.ma@starfivetech.com>
 From: "max.ma" <max.ma@starfivetech.com>
 Date: Tue, 21 Dec 2021 18:39:15 -0800
 Date: Tue, 21 Dec 2021 18:39:15 -0800
-Subject: [PATCH 7/8] add NT_RISCV_VECTOR macro definition to align with linux
- elf.h
+Subject: [PATCH 03/19] add NT_RISCV_VECTOR macro definition to align with
+ linux elf.h
 
 
 ---
 ---
  elf/elf.h | 1 +
  elf/elf.h | 1 +
  1 file changed, 1 insertion(+)
  1 file changed, 1 insertion(+)
 
 
 diff --git a/elf/elf.h b/elf/elf.h
 diff --git a/elf/elf.h b/elf/elf.h
-index 50f87baceb..27f46afa27 100644
+index 02a1b3f52f..7d1571043d 100644
 --- a/elf/elf.h
 --- a/elf/elf.h
 +++ b/elf/elf.h
 +++ b/elf/elf.h
-@@ -822,6 +822,7 @@ typedef struct
+@@ -829,6 +829,7 @@ typedef struct
  #define NT_MIPS_DSP	0x800		/* MIPS DSP ASE registers.  */
  #define NT_MIPS_DSP	0x800		/* MIPS DSP ASE registers.  */
  #define NT_MIPS_FP_MODE	0x801		/* MIPS floating-point mode.  */
  #define NT_MIPS_FP_MODE	0x801		/* MIPS floating-point mode.  */
  #define NT_MIPS_MSA	0x802		/* MIPS SIMD registers.  */
  #define NT_MIPS_MSA	0x802		/* MIPS SIMD registers.  */
@@ -21,5 +21,5 @@ index 50f87baceb..27f46afa27 100644
  /* Legal values for the note segment descriptor types for object files.  */
  /* Legal values for the note segment descriptor types for object files.  */
  
  
 -- 
 -- 
-2.33.1
+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 776a53db6afba8a7ff4412aba88b0679227877f9 Mon Sep 17 00:00:00 2001
+From a74ac72e6a25121c99f3875cf0245a435729e897 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 01:48:24 +0000
 Date: Wed, 18 Mar 2015 01:48:24 +0000
 Subject: [PATCH] nativesdk-glibc: Look for host system ld.so.cache as well
 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(-)
  1 file changed, 8 insertions(+), 8 deletions(-)
 
 
 diff --git a/elf/dl-load.c b/elf/dl-load.c
 diff --git a/elf/dl-load.c b/elf/dl-load.c
-index a08df001af..d09daf9e41 100644
+index 1ad0868dad..c5e235d918 100644
 --- a/elf/dl-load.c
 --- a/elf/dl-load.c
 +++ b/elf/dl-load.c
 +++ b/elf/dl-load.c
-@@ -2196,6 +2196,14 @@ _dl_map_object (struct link_map *loader, const char *name,
+@@ -2109,6 +2109,14 @@ _dl_map_object (struct link_map *loader, const char *name,
              }
              }
          }
          }
  
  
@@ -48,7 +48,7 @@ index a08df001af..d09daf9e41 100644
  #ifdef USE_LDCONFIG
  #ifdef USE_LDCONFIG
        if (fd == -1
        if (fd == -1
  	  && (__glibc_likely ((mode & __RTLD_SECURE) == 0)
  	  && (__glibc_likely ((mode & __RTLD_SECURE) == 0)
-@@ -2254,14 +2262,6 @@ _dl_map_object (struct link_map *loader, const char *name,
+@@ -2167,14 +2175,6 @@ _dl_map_object (struct link_map *loader, const char *name,
  	}
  	}
  #endif
  #endif
  
  

+ 0 - 61
recipes-core/glibc/glibc/0004-RISC-V-Extend-MINSIGSTKSZ-and-SIGSTKSZ-to-backup-RVV.patch

@@ -1,61 +0,0 @@
-From 05c65dd1e572b489bbd85488c2897af76a143a01 Mon Sep 17 00:00:00 2001
-From: Vincent Chen <vincent.chen@sifive.com>
-Date: Mon, 13 Sep 2021 09:41:17 +0800
-Subject: [PATCH 4/8] RISC-V: Extend MINSIGSTKSZ and SIGSTKSZ to backup RVV
- registers
-
-As using RVV extension, the original MINSIGSTKSZ is not enough to
-back up all RVV registers for the normal case. Therefore, the MINSIGSTKSZ
-is expanded to about 5K and the SIGSTKSZ is expanded to about 16K. This
-space is enough for the case that the VLENB of a vector register is 128
-bytes. For the case that VLENB > 128 bytes, users can use
-sysconf (_SC_MINSIGSTKSZ) and sysconf (_SC_SIGSTKSZ) to get the
-appropriate signal stack size.
-
-Signed-off-by: max.ma <max.ma@starfivetech.com>
----
- sysdeps/unix/sysv/linux/riscv/bits/sigstack.h | 32 +++++++++++++++++++
- 1 file changed, 32 insertions(+)
- create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/sigstack.h
-
-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..c18512f083
---- /dev/null
-+++ b/sysdeps/unix/sysv/linux/riscv/bits/sigstack.h
-@@ -0,0 +1,32 @@
-+/* sigstack, sigaltstack definitions.
-+   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/>.  */
-+
-+#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 */
--- 
-2.33.1
-

+ 3 - 3
recipes-core/glibc/glibc/0008-fix-the-bcmp-unrecognized-issue.patch → recipes-core/glibc/glibc/0004-fix-the-bcmp-unrecognized-issue.patch

@@ -1,7 +1,7 @@
-From 9f30b03a901457dd59b5c0f7740f8b413f653d5f Mon Sep 17 00:00:00 2001
+From d23b3456285b4276b439f207530208cebcb2ab44 Mon Sep 17 00:00:00 2001
 From: "max.ma" <max.ma@starfivetech.com>
 From: "max.ma" <max.ma@starfivetech.com>
 Date: Sun, 16 Jan 2022 16:56:07 -0800
 Date: Sun, 16 Jan 2022 16:56:07 -0800
-Subject: [PATCH 8/8] fix the bcmp unrecognized issue
+Subject: [PATCH 04/19] fix the bcmp unrecognized issue
 
 
 ---
 ---
  sysdeps/riscv/rv64/multiarch/aeabi_memcpy.c  | 2 --
  sysdeps/riscv/rv64/multiarch/aeabi_memcpy.c  | 2 --
@@ -29,5 +29,5 @@ index f6cbc1307b..fe89f92268 100644
  libc_hidden_builtin_def (memcmp)
  libc_hidden_builtin_def (memcmp)
  
  
 -- 
 -- 
-2.33.1
+2.25.1
 
 

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

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

+ 0 - 93
recipes-core/glibc/glibc/0005-RISC-V-Expand-PTHREAD_STACK_MIN-to-support-RVV-envir.patch

@@ -1,93 +0,0 @@
-From 200ea75b0643350a162a22d3a7fa1f1a056337c1 Mon Sep 17 00:00:00 2001
-From: Vincent Chen <vincent.chen@sifive.com>
-Date: Mon, 13 Sep 2021 09:41:18 +0800
-Subject: [PATCH 5/8] RISC-V: Expand PTHREAD_STACK_MIN to support RVV
- environment
-
-In order to support all pthread operations in the RVV environment, here
-PTHREAD_STACK_MIN is set to 4 times GLRO(dl_minsigstacksize), and the
-default PTHREAD_STACK_MIN is expanded to 20K bytes.
-
-Signed-off-by: max.ma <max.ma@starfivetech.com>
----
- .../sysv/linux/riscv/bits/pthread_stack_min.h | 21 ++++++++++
- .../linux/riscv/sysconf-pthread_stack_min.h   | 39 +++++++++++++++++++
- 2 files changed, 60 insertions(+)
- create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/pthread_stack_min.h
- create mode 100644 sysdeps/unix/sysv/linux/riscv/sysconf-pthread_stack_min.h
-
-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..83585b39f3
---- /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) 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/>.  */
-+
-+/* 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/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.33.1
-

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

@@ -1,4 +1,4 @@
-From 6af8ce8eceed86addbc188f773a2d36d83ee4042 Mon Sep 17 00:00:00 2001
+From 2d41508ed1059df2df9994d35d870be2005f575f Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 01:51:38 +0000
 Date: Wed, 18 Mar 2015 01:51:38 +0000
 Subject: [PATCH] nativesdk-glibc: Raise the size of arrays containing dl paths
 Subject: [PATCH] nativesdk-glibc: Raise the size of arrays containing dl paths
@@ -26,10 +26,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  8 files changed, 16 insertions(+), 10 deletions(-)
  8 files changed, 16 insertions(+), 10 deletions(-)
 
 
 diff --git a/elf/dl-cache.c b/elf/dl-cache.c
 diff --git a/elf/dl-cache.c b/elf/dl-cache.c
-index 2b8da8650d..3d9787bda4 100644
+index 8bbf110d02..c02a95d9b5 100644
 --- a/elf/dl-cache.c
 --- a/elf/dl-cache.c
 +++ b/elf/dl-cache.c
 +++ b/elf/dl-cache.c
-@@ -355,6 +355,10 @@ search_cache (const char *string_table, uint32_t string_table_size,
+@@ -352,6 +352,10 @@ search_cache (const char *string_table, uint32_t string_table_size,
    return best;
    return best;
  }
  }
  
  
@@ -41,10 +41,10 @@ index 2b8da8650d..3d9787bda4 100644
  _dl_cache_libcmp (const char *p1, const char *p2)
  _dl_cache_libcmp (const char *p1, const char *p2)
  {
  {
 diff --git a/elf/dl-load.c b/elf/dl-load.c
 diff --git a/elf/dl-load.c b/elf/dl-load.c
-index 2c6270e2a7..23018d2f7e 100644
+index ce3cbfa3c4..e116db24a1 100644
 --- a/elf/dl-load.c
 --- a/elf/dl-load.c
 +++ b/elf/dl-load.c
 +++ b/elf/dl-load.c
-@@ -115,8 +115,8 @@ enum { ncapstr = 1, max_capstrlen = 0 };
+@@ -117,8 +117,8 @@ enum { ncapstr = 1, max_capstrlen = 0 };
     gen-trusted-dirs.awk.  */
     gen-trusted-dirs.awk.  */
  #include "trusted-dirs.h"
  #include "trusted-dirs.h"
  
  
@@ -56,7 +56,7 @@ index 2c6270e2a7..23018d2f7e 100644
    SYSTEM_DIRS_LEN
    SYSTEM_DIRS_LEN
  };
  };
 diff --git a/elf/dl-usage.c b/elf/dl-usage.c
 diff --git a/elf/dl-usage.c b/elf/dl-usage.c
-index 5ad3a72559..88f26d3692 100644
+index 98d8c98948..77ca98cbf9 100644
 --- a/elf/dl-usage.c
 --- a/elf/dl-usage.c
 +++ b/elf/dl-usage.c
 +++ b/elf/dl-usage.c
 @@ -25,6 +25,8 @@
 @@ -25,6 +25,8 @@
@@ -87,7 +87,7 @@ index 5ad3a72559..88f26d3692 100644
    print_hwcaps_subdirectories (state);
    print_hwcaps_subdirectories (state);
    print_legacy_hwcap_directories ();
    print_legacy_hwcap_directories ();
 diff --git a/elf/interp.c b/elf/interp.c
 diff --git a/elf/interp.c b/elf/interp.c
-index 91966702ca..dc86c20e83 100644
+index d82af036d1..9d282b2769 100644
 --- a/elf/interp.c
 --- a/elf/interp.c
 +++ b/elf/interp.c
 +++ b/elf/interp.c
 @@ -18,5 +18,5 @@
 @@ -18,5 +18,5 @@
@@ -98,10 +98,10 @@ index 91966702ca..dc86c20e83 100644
 +const char __invoke_dynamic_linker__[4096] __attribute__ ((section (".interp")))
 +const char __invoke_dynamic_linker__[4096] __attribute__ ((section (".interp")))
    = RUNTIME_LINKER;
    = RUNTIME_LINKER;
 diff --git a/elf/ldconfig.c b/elf/ldconfig.c
 diff --git a/elf/ldconfig.c b/elf/ldconfig.c
-index 1037e8d0cf..ffdac84952 100644
+index 9394ac6438..7f66b1a460 100644
 --- a/elf/ldconfig.c
 --- a/elf/ldconfig.c
 +++ b/elf/ldconfig.c
 +++ b/elf/ldconfig.c
-@@ -177,6 +177,9 @@ static struct argp argp =
+@@ -176,6 +176,9 @@ static struct argp argp =
    options, parse_opt, NULL, doc, NULL, more_help, NULL
    options, parse_opt, NULL, doc, NULL, more_help, NULL
  };
  };
  
  
@@ -112,10 +112,10 @@ index 1037e8d0cf..ffdac84952 100644
     a platform.  */
     a platform.  */
  static int
  static int
 diff --git a/elf/rtld.c b/elf/rtld.c
 diff --git a/elf/rtld.c b/elf/rtld.c
-index fbbd60b446..fce9940f80 100644
+index cbbaf4a331..d2d27a0127 100644
 --- a/elf/rtld.c
 --- a/elf/rtld.c
 +++ b/elf/rtld.c
 +++ b/elf/rtld.c
-@@ -185,6 +185,7 @@ dso_name_valid_for_suid (const char *p)
+@@ -189,6 +189,7 @@ dso_name_valid_for_suid (const char *p)
      }
      }
    return *p != '\0';
    return *p != '\0';
  }
  }
@@ -124,10 +124,10 @@ index fbbd60b446..fce9940f80 100644
  static void
  static void
  audit_list_init (struct audit_list *list)
  audit_list_init (struct audit_list *list)
 diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c
 diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c
-index 62bee28769..67b60dc88c 100644
+index f069e28323..6288f715ba 100644
 --- a/iconv/gconv_conf.c
 --- a/iconv/gconv_conf.c
 +++ b/iconv/gconv_conf.c
 +++ b/iconv/gconv_conf.c
-@@ -36,7 +36,7 @@
+@@ -35,7 +35,7 @@
  #include <gconv_parseconfdir.h>
  #include <gconv_parseconfdir.h>
  
  
  /* This is the default path where we look for module lists.  */
  /* This is the default path where we look for module lists.  */
@@ -137,7 +137,7 @@ index 62bee28769..67b60dc88c 100644
  /* Type to represent search path.  */
  /* Type to represent search path.  */
  struct path_elem
  struct path_elem
 diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h
 diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h
-index 964d50a486..94bf68ca9d 100644
+index 93d4bea930..5249176441 100644
 --- a/sysdeps/generic/dl-cache.h
 --- a/sysdeps/generic/dl-cache.h
 +++ b/sysdeps/generic/dl-cache.h
 +++ b/sysdeps/generic/dl-cache.h
 @@ -34,10 +34,6 @@
 @@ -34,10 +34,6 @@

+ 7 - 7
recipes-core/glibc/glibc/0011-riscv-Resolve-symbols-directly-for-symbols-with-STO_.patch → recipes-core/glibc/glibc/0005-riscv-Resolve-symbols-directly-for-symbols-with-STO_.patch

@@ -1,7 +1,7 @@
-From fac8b2beac5d568ca0ed7f5e04a347befda44f58 Mon Sep 17 00:00:00 2001
+From 66e355177a3c5f637852e47290878e06a7f95c32 Mon Sep 17 00:00:00 2001
 From: Hsiangkai Wang <kai.wang@sifive.com>
 From: Hsiangkai Wang <kai.wang@sifive.com>
 Date: Tue, 18 Jan 2022 12:31:59 +0800
 Date: Tue, 18 Jan 2022 12:31:59 +0800
-Subject: [PATCH 11/12] riscv: Resolve symbols directly for symbols with
+Subject: [PATCH 05/19] riscv: Resolve symbols directly for symbols with
  STO_RISCV_VARIANT_CC.
  STO_RISCV_VARIANT_CC.
 
 
 In some cases, we do not want to go through the resolver for function
 In some cases, we do not want to go through the resolver for function
@@ -27,10 +27,10 @@ Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
  create mode 100644 sysdeps/riscv/dl-dtprocnum.h
  create mode 100644 sysdeps/riscv/dl-dtprocnum.h
 
 
 diff --git a/elf/elf.h b/elf/elf.h
 diff --git a/elf/elf.h b/elf/elf.h
-index 27f46afa27..cc62deca0d 100644
+index 7d1571043d..27009bdbc0 100644
 --- a/elf/elf.h
 --- a/elf/elf.h
 +++ b/elf/elf.h
 +++ b/elf/elf.h
-@@ -3907,6 +3907,13 @@ enum
+@@ -3925,6 +3925,13 @@ enum
  
  
  #define R_TILEGX_NUM		130
  #define R_TILEGX_NUM		130
  
  
@@ -89,7 +89,7 @@ index 0000000000..f189fd700a
 +   default there are none.  */
 +   default there are none.  */
 +#define DT_THISPROCNUM	DT_RISCV_NUM
 +#define DT_THISPROCNUM	DT_RISCV_NUM
 diff --git a/sysdeps/riscv/dl-machine.h b/sysdeps/riscv/dl-machine.h
 diff --git a/sysdeps/riscv/dl-machine.h b/sysdeps/riscv/dl-machine.h
-index ce2b3c3875..22e3c81706 100644
+index dfedc9801d..11523ae627 100644
 --- a/sysdeps/riscv/dl-machine.h
 --- a/sysdeps/riscv/dl-machine.h
 +++ b/sysdeps/riscv/dl-machine.h
 +++ b/sysdeps/riscv/dl-machine.h
 @@ -53,6 +53,9 @@
 @@ -53,6 +53,9 @@
@@ -102,7 +102,7 @@ index ce2b3c3875..22e3c81706 100644
  /* Return nonzero iff ELF header is compatible with the running host.  */
  /* Return nonzero iff ELF header is compatible with the running host.  */
  static inline int __attribute_used__
  static inline int __attribute_used__
  elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
  elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
-@@ -299,6 +302,29 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
+@@ -281,6 +284,29 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
    /* Check for unexpected PLT reloc type.  */
    /* Check for unexpected PLT reloc type.  */
    if (__glibc_likely (r_type == R_RISCV_JUMP_SLOT))
    if (__glibc_likely (r_type == R_RISCV_JUMP_SLOT))
      {
      {
@@ -133,5 +133,5 @@ index ce2b3c3875..22e3c81706 100644
  	{
  	{
  	  if (l_addr)
  	  if (l_addr)
 -- 
 -- 
-2.33.1
+2.25.1
 
 

+ 3 - 3
recipes-core/glibc/glibc/0013-change-memcpy_vector-LMUL-to-m8.patch → recipes-core/glibc/glibc/0006-change-memcpy_vector-LMUL-to-m8.patch

@@ -1,7 +1,7 @@
-From 5ba1268621eb208a5ed4a8ce2bbb6ae3392046a7 Mon Sep 17 00:00:00 2001
+From 8c1459b734f8cfe1562d72ad302d3dfa55fa85e7 Mon Sep 17 00:00:00 2001
 From: "max.ma" <max.ma@starfivetech.com>
 From: "max.ma" <max.ma@starfivetech.com>
 Date: Mon, 28 Feb 2022 18:49:58 -0800
 Date: Mon, 28 Feb 2022 18:49:58 -0800
-Subject: [PATCH 13/13] change memcpy_vector LMUL to m8
+Subject: [PATCH 06/19] change memcpy_vector LMUL to m8
 
 
 ---
 ---
  sysdeps/riscv/rv64/multiarch/memcpy_vector.S | 4 ++--
  sysdeps/riscv/rv64/multiarch/memcpy_vector.S | 4 ++--
@@ -29,5 +29,5 @@ index 2319647de8..bae330f6e0 100644
  	add	a1, a1, t0
  	add	a1, a1, t0
  	sub	a2, a2, t0
  	sub	a2, a2, t0
 -- 
 -- 
-2.33.1
+2.25.1
 
 

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

@@ -1,4 +1,4 @@
-From b30f380cd88ae181a4a6a3a4784206ffe3ccd19b Mon Sep 17 00:00:00 2001
+From 946d1cadf0bb54216409e8e0eb09be3e96044dbf Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 From: Khem Raj <raj.khem@gmail.com>
 Date: Thu, 31 Dec 2015 14:35:35 -0800
 Date: Thu, 31 Dec 2015 14:35:35 -0800
 Subject: [PATCH] nativesdk-glibc: Allow 64 bit atomics for x86
 Subject: [PATCH] nativesdk-glibc: Allow 64 bit atomics for x86
@@ -13,14 +13,14 @@ Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
 Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
 Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
 ---
 ---
- sysdeps/x86/atomic-machine.h | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
+ sysdeps/x86/atomic-machine.h | 7 +------
+ 1 file changed, 1 insertion(+), 6 deletions(-)
 
 
 diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h
 diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h
-index 695222e4fa..9d39bfdbd5 100644
+index f24f1c71ed..574487ca54 100644
 --- a/sysdeps/x86/atomic-machine.h
 --- a/sysdeps/x86/atomic-machine.h
 +++ b/sysdeps/x86/atomic-machine.h
 +++ b/sysdeps/x86/atomic-machine.h
-@@ -52,15 +52,14 @@ typedef uintmax_t uatomic_max_t;
+@@ -26,19 +26,14 @@
  #define LOCK_PREFIX "lock;"
  #define LOCK_PREFIX "lock;"
  
  
  #define USE_ATOMIC_COMPILER_BUILTINS	1
  #define USE_ATOMIC_COMPILER_BUILTINS	1
@@ -33,6 +33,10 @@ index 695222e4fa..9d39bfdbd5 100644
  # define BR_CONSTRAINT			"q"
  # define BR_CONSTRAINT			"q"
  # define IBR_CONSTRAINT			"iq"
  # define IBR_CONSTRAINT			"iq"
  #else
  #else
+-/* Since the Pentium, i386 CPUs have supported 64-bit atomics, but the
+-   i386 psABI supplement provides only 4-byte alignment for uint64_t
+-   inside structs, so it is currently not possible to use 64-bit
+-   atomics on this platform.  */
 -# define __HAVE_64B_ATOMICS		0
 -# define __HAVE_64B_ATOMICS		0
  # define SP_REG				"esp"
  # define SP_REG				"esp"
  # define SEG_REG			"gs"
  # define SEG_REG			"gs"

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

@@ -0,0 +1,182 @@
+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
+

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

@@ -1,4 +1,4 @@
-From 24bffe9c2645cd6542e29cb57786dc703cced07b Mon Sep 17 00:00:00 2001
+From ce4e796fa8bd2df962cf7a0e4bc69ab6181e4ebf Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 3 Aug 2018 09:55:12 -0700
 Date: Fri, 3 Aug 2018 09:55:12 -0700
 Subject: [PATCH] nativesdk-glibc: Make relocatable install for locales
 Subject: [PATCH] nativesdk-glibc: Make relocatable install for locales
@@ -19,10 +19,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  4 files changed, 8 insertions(+), 7 deletions(-)
  4 files changed, 8 insertions(+), 7 deletions(-)
 
 
 diff --git a/locale/findlocale.c b/locale/findlocale.c
 diff --git a/locale/findlocale.c b/locale/findlocale.c
-index ab09122b0c..f42cc75780 100644
+index fc433b61d8..d6f030f13c 100644
 --- a/locale/findlocale.c
 --- a/locale/findlocale.c
 +++ b/locale/findlocale.c
 +++ b/locale/findlocale.c
-@@ -56,7 +56,7 @@ struct __locale_data *const _nl_C[] attribute_hidden =
+@@ -55,7 +55,7 @@ struct __locale_data *const _nl_C[] attribute_hidden =
     which are somehow addressed.  */
     which are somehow addressed.  */
  struct loaded_l10nfile *_nl_locale_file_list[__LC_LAST];
  struct loaded_l10nfile *_nl_locale_file_list[__LC_LAST];
  
  
@@ -31,7 +31,7 @@ index ab09122b0c..f42cc75780 100644
  
  
  /* Checks if the name is actually present, that is, not NULL and not
  /* Checks if the name is actually present, that is, not NULL and not
     empty.  */
     empty.  */
-@@ -166,7 +166,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
+@@ -165,7 +165,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
  
  
        /* Nothing in the archive.  Set the default path to search below.  */
        /* Nothing in the archive.  Set the default path to search below.  */
        locale_path = _nl_default_locale_path;
        locale_path = _nl_default_locale_path;
@@ -41,7 +41,7 @@ index ab09122b0c..f42cc75780 100644
    else
    else
      /* We really have to load some data.  First see whether the name is
      /* We really have to load some data.  First see whether the name is
 diff --git a/locale/loadarchive.c b/locale/loadarchive.c
 diff --git a/locale/loadarchive.c b/locale/loadarchive.c
-index 512769eaec..436619091b 100644
+index fcc4913319..62cae8c6c0 100644
 --- a/locale/loadarchive.c
 --- a/locale/loadarchive.c
 +++ b/locale/loadarchive.c
 +++ b/locale/loadarchive.c
 @@ -42,7 +42,7 @@
 @@ -42,7 +42,7 @@
@@ -54,10 +54,10 @@ index 512769eaec..436619091b 100644
  /* Size of initial mapping window, optimal if large enough to
  /* Size of initial mapping window, optimal if large enough to
     cover the header plus the initial locale.  */
     cover the header plus the initial locale.  */
 diff --git a/locale/localeinfo.h b/locale/localeinfo.h
 diff --git a/locale/localeinfo.h b/locale/localeinfo.h
-index b3d4da0185..22f9dc1140 100644
+index fd43033a19..3dc26272a0 100644
 --- a/locale/localeinfo.h
 --- a/locale/localeinfo.h
 +++ b/locale/localeinfo.h
 +++ b/locale/localeinfo.h
-@@ -331,7 +331,7 @@ _nl_lookup_word (locale_t l, int category, int item)
+@@ -347,7 +347,7 @@ _nl_lookup_word (locale_t l, int category, int item)
  }
  }
  
  
  /* Default search path if no LOCPATH environment variable.  */
  /* Default search path if no LOCPATH environment variable.  */
@@ -67,10 +67,10 @@ index b3d4da0185..22f9dc1140 100644
  /* Load the locale data for CATEGORY from the file specified by *NAME.
  /* Load the locale data for CATEGORY from the file specified by *NAME.
     If *NAME is "", use environment variables as specified by POSIX, and
     If *NAME is "", use environment variables as specified by POSIX, and
 diff --git a/locale/programs/locale.c b/locale/programs/locale.c
 diff --git a/locale/programs/locale.c b/locale/programs/locale.c
-index ca0a95be99..6b98895203 100644
+index 1b51b50d68..87c9049444 100644
 --- a/locale/programs/locale.c
 --- a/locale/programs/locale.c
 +++ b/locale/programs/locale.c
 +++ b/locale/programs/locale.c
-@@ -632,6 +632,7 @@ nameentcmp (const void *a, const void *b)
+@@ -631,6 +631,7 @@ nameentcmp (const void *a, const void *b)
  		  ((const struct nameent *) b)->name);
  		  ((const struct nameent *) b)->name);
  }
  }
  
  
@@ -78,7 +78,7 @@ index ca0a95be99..6b98895203 100644
  
  
  static int
  static int
  write_archive_locales (void **all_datap, char *linebuf)
  write_archive_locales (void **all_datap, char *linebuf)
-@@ -645,7 +646,7 @@ write_archive_locales (void **all_datap, char *linebuf)
+@@ -644,7 +645,7 @@ write_archive_locales (void **all_datap, char *linebuf)
    int fd, ret = 0;
    int fd, ret = 0;
    uint32_t cnt;
    uint32_t cnt;
  
  
@@ -87,7 +87,7 @@ index ca0a95be99..6b98895203 100644
    if (fd < 0)
    if (fd < 0)
      return 0;
      return 0;
  
  
-@@ -700,8 +701,8 @@ write_archive_locales (void **all_datap, char *linebuf)
+@@ -699,8 +700,8 @@ write_archive_locales (void **all_datap, char *linebuf)
  	  if (cnt)
  	  if (cnt)
  	    putchar_unlocked ('\n');
  	    putchar_unlocked ('\n');
  
  

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

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

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

@@ -0,0 +1,598 @@
+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 - 27
recipes-core/glibc/glibc/0009-Revert-RISC-V-Reserve-about-5K-space-in-mcontext_t-t.patch

@@ -1,27 +0,0 @@
-From 0e504f890152ef8c96f4a5913dddd8179dbc1f71 Mon Sep 17 00:00:00 2001
-From: "max.ma" <max.ma@starfivetech.com>
-Date: Wed, 9 Feb 2022 23:04:46 -0800
-Subject: [PATCH 09/12] Revert "RISC-V: Reserve about 5K space in mcontext_t to
- support future ISA expansion."
-
-This reverts commit bcface37cf6df3f3b0800f79e4282a690122b0c8.
----
- sysdeps/unix/sysv/linux/riscv/sys/ucontext.h | 2 --
- 1 file changed, 2 deletions(-)
-
-diff --git a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h b/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h
-index 80caf078fc..cfafa44f99 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.  */
--- 
-2.33.1
-

+ 0 - 1581
recipes-core/glibc/glibc/0009-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch

@@ -1,1581 +0,0 @@
-From 74923ca4b1ae0ed5a2478e7d265b37534f6815d7 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 18 Mar 2015 00:01:50 +0000
-Subject: [PATCH] fsl e500/e5500/e6500/603e fsqrt implementation
-
-Upstream-Status: Pending
-Signed-off-by: Edmar Wienskoski <edmar@freescale.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c   | 134 ++++++++++++++++++
- sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c  | 101 +++++++++++++
- sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c | 134 ++++++++++++++++++
- .../powerpc/powerpc32/e500mc/fpu/e_sqrtf.c    | 101 +++++++++++++
- sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c  | 134 ++++++++++++++++++
- sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c | 101 +++++++++++++
- sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c  | 134 ++++++++++++++++++
- sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c | 101 +++++++++++++
- sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c  | 134 ++++++++++++++++++
- sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c | 101 +++++++++++++
- sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c  | 134 ++++++++++++++++++
- sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c | 101 +++++++++++++
- .../linux/powerpc/powerpc32/603e/fpu/Implies  |   1 +
- .../powerpc/powerpc32/e300c3/fpu/Implies      |   2 +
- .../powerpc/powerpc32/e500mc/fpu/Implies      |   1 +
- .../linux/powerpc/powerpc32/e5500/fpu/Implies |   1 +
- .../linux/powerpc/powerpc32/e6500/fpu/Implies |   1 +
- .../linux/powerpc/powerpc64/e5500/fpu/Implies |   1 +
- .../linux/powerpc/powerpc64/e6500/fpu/Implies |   1 +
- 19 files changed, 1418 insertions(+)
- create mode 100644 sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
- create mode 100644 sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
- create mode 100644 sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
- create mode 100644 sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
- create mode 100644 sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
- create mode 100644 sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
- create mode 100644 sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
- create mode 100644 sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
- create mode 100644 sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
- create mode 100644 sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
- create mode 100644 sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
- create mode 100644 sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
- create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies
- create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies
- create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies
- create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies
- create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies
- create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies
- create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies
-
-diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
-new file mode 100644
-index 0000000000..71e516d1c8
---- /dev/null
-+++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
-@@ -0,0 +1,134 @@
-+/* Double-precision floating point square root.
-+   Copyright (C) 2010 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, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <math.h>
-+#include <math_private.h>
-+#include <fenv_libc.h>
-+#include <inttypes.h>
-+
-+#include <sysdep.h>
-+#include <ldsodefs.h>
-+
-+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
-+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
-+static const float two108 = 3.245185536584267269e+32;
-+static const float twom54 = 5.551115123125782702e-17;
-+static const float half = 0.5;
-+
-+/* The method is based on the descriptions in:
-+
-+   _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
-+   _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
-+
-+   We find the actual square root and half of its reciprocal
-+   simultaneously.  */
-+
-+#ifdef __STDC__
-+double
-+__ieee754_sqrt (double b)
-+#else
-+double
-+__ieee754_sqrt (b)
-+     double b;
-+#endif
-+{
-+  if (__builtin_expect (b > 0, 1))
-+    {
-+      double y, g, h, d, r;
-+      ieee_double_shape_type u;
-+
-+      if (__builtin_expect (b != a_inf.value, 1))
-+        {
-+          fenv_t fe;
-+
-+          fe = fegetenv_register ();
-+
-+          u.value = b;
-+
-+          relax_fenv_state ();
-+
-+          __asm__ ("frsqrte %[estimate], %[x]\n"
-+                   : [estimate] "=f" (y) : [x] "f" (b));
-+
-+          /* Following Muller et al, page 168, equation 5.20.
-+
-+             h goes to 1/(2*sqrt(b))
-+             g goes to sqrt(b).
-+
-+             We need three iterations to get within 1ulp.  */
-+
-+          /* Indicate that these can be performed prior to the branch.  GCC
-+             insists on sinking them below the branch, however; it seems like
-+             they'd be better before the branch so that we can cover any latency
-+             from storing the argument and loading its high word.  Oh well.  */
-+
-+          g = b * y;
-+          h = 0.5 * y;
-+
-+          /* Handle small numbers by scaling.  */
-+          if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
-+            return __ieee754_sqrt (b * two108) * twom54;
-+
-+#define FMADD(a_, c_, b_)                                               \
-+          ({ double __r;                                                \
-+          __asm__ ("fmadd %[r], %[a], %[c], %[b]\n"                     \
-+                   : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+          __r;})
-+#define FNMSUB(a_, c_, b_)                                          \
-+          ({ double __r;                                                \
-+          __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n"                     \
-+                   : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+          __r;})
-+
-+          r = FNMSUB (g, h, half);
-+          g = FMADD (g, r, g);
-+          h = FMADD (h, r, h);
-+
-+          r = FNMSUB (g, h, half);
-+          g = FMADD (g, r, g);
-+          h = FMADD (h, r, h);
-+
-+          r = FNMSUB (g, h, half);
-+          g = FMADD (g, r, g);
-+          h = FMADD (h, r, h);
-+
-+          /* g is now +/- 1ulp, or exactly equal to, the square root of b.  */
-+
-+          /* Final refinement.  */
-+          d = FNMSUB (g, g, b);
-+
-+          fesetenv_register (fe);
-+          return FMADD (d, h, g);
-+        }
-+    }
-+  else if (b < 0)
-+    {
-+      /* For some reason, some PowerPC32 processors don't implement
-+         FE_INVALID_SQRT.  */
-+#ifdef FE_INVALID_SQRT
-+      feraiseexcept (FE_INVALID_SQRT);
-+
-+      fenv_union_t u = { .fenv = fegetenv_register () };
-+      if ((u.l & FE_INVALID) == 0)
-+#endif
-+	feraiseexcept (FE_INVALID);
-+      b = a_nan.value;
-+    }
-+  return f_wash (b);
-+}
-diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
-new file mode 100644
-index 0000000000..26fa067abf
---- /dev/null
-+++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
-@@ -0,0 +1,101 @@
-+/* Single-precision floating point square root.
-+   Copyright (C) 2010 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, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <math.h>
-+#include <math_private.h>
-+#include <fenv_libc.h>
-+#include <inttypes.h>
-+
-+#include <sysdep.h>
-+#include <ldsodefs.h>
-+
-+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
-+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
-+static const float threehalf = 1.5;
-+
-+/* The method is based on the descriptions in:
-+
-+   _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
-+   _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
-+
-+   We find the reciprocal square root and use that to compute the actual
-+   square root.  */
-+
-+#ifdef __STDC__
-+float
-+__ieee754_sqrtf (float b)
-+#else
-+float
-+__ieee754_sqrtf (b)
-+     float b;
-+#endif
-+{
-+  if (__builtin_expect (b > 0, 1))
-+    {
-+#define FMSUB(a_, c_, b_)                                               \
-+      ({ double __r;                                                    \
-+        __asm__ ("fmsub %[r], %[a], %[c], %[b]\n"                       \
-+                 : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+        __r;})
-+#define FNMSUB(a_, c_, b_)                                              \
-+      ({ double __r;                                                    \
-+        __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n"                      \
-+                 : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+        __r;})
-+
-+      if (__builtin_expect (b != a_inf.value, 1))
-+        {
-+          double y, x;
-+          fenv_t fe;
-+
-+          fe = fegetenv_register ();
-+
-+          relax_fenv_state ();
-+
-+          /* Compute y = 1.5 * b - b.  Uses fewer constants than y = 0.5 * b.  */
-+          y = FMSUB (threehalf, b, b);
-+
-+          /* Initial estimate.  */
-+          __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b));
-+
-+          /* Iterate.  x_{n+1} = x_n * (1.5 - y * (x_n * x_n)).  */
-+          x = x * FNMSUB (y, x * x, threehalf);
-+          x = x * FNMSUB (y, x * x, threehalf);
-+          x = x * FNMSUB (y, x * x, threehalf);
-+
-+          /* All done.  */
-+          fesetenv_register (fe);
-+          return x * b;
-+        }
-+    }
-+  else if (b < 0)
-+    {
-+      /* For some reason, some PowerPC32 processors don't implement
-+         FE_INVALID_SQRT.  */
-+#ifdef FE_INVALID_SQRT
-+      feraiseexcept (FE_INVALID_SQRT);
-+
-+      fenv_union_t u = { .fenv = fegetenv_register () };
-+      if ((u.l & FE_INVALID) == 0)
-+#endif
-+	feraiseexcept (FE_INVALID);
-+      b = a_nan.value;
-+    }
-+  return f_washf (b);
-+}
-diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
-new file mode 100644
-index 0000000000..71e516d1c8
---- /dev/null
-+++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
-@@ -0,0 +1,134 @@
-+/* Double-precision floating point square root.
-+   Copyright (C) 2010 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, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <math.h>
-+#include <math_private.h>
-+#include <fenv_libc.h>
-+#include <inttypes.h>
-+
-+#include <sysdep.h>
-+#include <ldsodefs.h>
-+
-+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
-+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
-+static const float two108 = 3.245185536584267269e+32;
-+static const float twom54 = 5.551115123125782702e-17;
-+static const float half = 0.5;
-+
-+/* The method is based on the descriptions in:
-+
-+   _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
-+   _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
-+
-+   We find the actual square root and half of its reciprocal
-+   simultaneously.  */
-+
-+#ifdef __STDC__
-+double
-+__ieee754_sqrt (double b)
-+#else
-+double
-+__ieee754_sqrt (b)
-+     double b;
-+#endif
-+{
-+  if (__builtin_expect (b > 0, 1))
-+    {
-+      double y, g, h, d, r;
-+      ieee_double_shape_type u;
-+
-+      if (__builtin_expect (b != a_inf.value, 1))
-+        {
-+          fenv_t fe;
-+
-+          fe = fegetenv_register ();
-+
-+          u.value = b;
-+
-+          relax_fenv_state ();
-+
-+          __asm__ ("frsqrte %[estimate], %[x]\n"
-+                   : [estimate] "=f" (y) : [x] "f" (b));
-+
-+          /* Following Muller et al, page 168, equation 5.20.
-+
-+             h goes to 1/(2*sqrt(b))
-+             g goes to sqrt(b).
-+
-+             We need three iterations to get within 1ulp.  */
-+
-+          /* Indicate that these can be performed prior to the branch.  GCC
-+             insists on sinking them below the branch, however; it seems like
-+             they'd be better before the branch so that we can cover any latency
-+             from storing the argument and loading its high word.  Oh well.  */
-+
-+          g = b * y;
-+          h = 0.5 * y;
-+
-+          /* Handle small numbers by scaling.  */
-+          if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
-+            return __ieee754_sqrt (b * two108) * twom54;
-+
-+#define FMADD(a_, c_, b_)                                               \
-+          ({ double __r;                                                \
-+          __asm__ ("fmadd %[r], %[a], %[c], %[b]\n"                     \
-+                   : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+          __r;})
-+#define FNMSUB(a_, c_, b_)                                          \
-+          ({ double __r;                                                \
-+          __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n"                     \
-+                   : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+          __r;})
-+
-+          r = FNMSUB (g, h, half);
-+          g = FMADD (g, r, g);
-+          h = FMADD (h, r, h);
-+
-+          r = FNMSUB (g, h, half);
-+          g = FMADD (g, r, g);
-+          h = FMADD (h, r, h);
-+
-+          r = FNMSUB (g, h, half);
-+          g = FMADD (g, r, g);
-+          h = FMADD (h, r, h);
-+
-+          /* g is now +/- 1ulp, or exactly equal to, the square root of b.  */
-+
-+          /* Final refinement.  */
-+          d = FNMSUB (g, g, b);
-+
-+          fesetenv_register (fe);
-+          return FMADD (d, h, g);
-+        }
-+    }
-+  else if (b < 0)
-+    {
-+      /* For some reason, some PowerPC32 processors don't implement
-+         FE_INVALID_SQRT.  */
-+#ifdef FE_INVALID_SQRT
-+      feraiseexcept (FE_INVALID_SQRT);
-+
-+      fenv_union_t u = { .fenv = fegetenv_register () };
-+      if ((u.l & FE_INVALID) == 0)
-+#endif
-+	feraiseexcept (FE_INVALID);
-+      b = a_nan.value;
-+    }
-+  return f_wash (b);
-+}
-diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
-new file mode 100644
-index 0000000000..26fa067abf
---- /dev/null
-+++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
-@@ -0,0 +1,101 @@
-+/* Single-precision floating point square root.
-+   Copyright (C) 2010 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, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <math.h>
-+#include <math_private.h>
-+#include <fenv_libc.h>
-+#include <inttypes.h>
-+
-+#include <sysdep.h>
-+#include <ldsodefs.h>
-+
-+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
-+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
-+static const float threehalf = 1.5;
-+
-+/* The method is based on the descriptions in:
-+
-+   _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
-+   _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
-+
-+   We find the reciprocal square root and use that to compute the actual
-+   square root.  */
-+
-+#ifdef __STDC__
-+float
-+__ieee754_sqrtf (float b)
-+#else
-+float
-+__ieee754_sqrtf (b)
-+     float b;
-+#endif
-+{
-+  if (__builtin_expect (b > 0, 1))
-+    {
-+#define FMSUB(a_, c_, b_)                                               \
-+      ({ double __r;                                                    \
-+        __asm__ ("fmsub %[r], %[a], %[c], %[b]\n"                       \
-+                 : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+        __r;})
-+#define FNMSUB(a_, c_, b_)                                              \
-+      ({ double __r;                                                    \
-+        __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n"                      \
-+                 : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+        __r;})
-+
-+      if (__builtin_expect (b != a_inf.value, 1))
-+        {
-+          double y, x;
-+          fenv_t fe;
-+
-+          fe = fegetenv_register ();
-+
-+          relax_fenv_state ();
-+
-+          /* Compute y = 1.5 * b - b.  Uses fewer constants than y = 0.5 * b.  */
-+          y = FMSUB (threehalf, b, b);
-+
-+          /* Initial estimate.  */
-+          __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b));
-+
-+          /* Iterate.  x_{n+1} = x_n * (1.5 - y * (x_n * x_n)).  */
-+          x = x * FNMSUB (y, x * x, threehalf);
-+          x = x * FNMSUB (y, x * x, threehalf);
-+          x = x * FNMSUB (y, x * x, threehalf);
-+
-+          /* All done.  */
-+          fesetenv_register (fe);
-+          return x * b;
-+        }
-+    }
-+  else if (b < 0)
-+    {
-+      /* For some reason, some PowerPC32 processors don't implement
-+         FE_INVALID_SQRT.  */
-+#ifdef FE_INVALID_SQRT
-+      feraiseexcept (FE_INVALID_SQRT);
-+
-+      fenv_union_t u = { .fenv = fegetenv_register () };
-+      if ((u.l & FE_INVALID) == 0)
-+#endif
-+	feraiseexcept (FE_INVALID);
-+      b = a_nan.value;
-+    }
-+  return f_washf (b);
-+}
-diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
-new file mode 100644
-index 0000000000..71e516d1c8
---- /dev/null
-+++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
-@@ -0,0 +1,134 @@
-+/* Double-precision floating point square root.
-+   Copyright (C) 2010 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, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <math.h>
-+#include <math_private.h>
-+#include <fenv_libc.h>
-+#include <inttypes.h>
-+
-+#include <sysdep.h>
-+#include <ldsodefs.h>
-+
-+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
-+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
-+static const float two108 = 3.245185536584267269e+32;
-+static const float twom54 = 5.551115123125782702e-17;
-+static const float half = 0.5;
-+
-+/* The method is based on the descriptions in:
-+
-+   _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
-+   _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
-+
-+   We find the actual square root and half of its reciprocal
-+   simultaneously.  */
-+
-+#ifdef __STDC__
-+double
-+__ieee754_sqrt (double b)
-+#else
-+double
-+__ieee754_sqrt (b)
-+     double b;
-+#endif
-+{
-+  if (__builtin_expect (b > 0, 1))
-+    {
-+      double y, g, h, d, r;
-+      ieee_double_shape_type u;
-+
-+      if (__builtin_expect (b != a_inf.value, 1))
-+        {
-+          fenv_t fe;
-+
-+          fe = fegetenv_register ();
-+
-+          u.value = b;
-+
-+          relax_fenv_state ();
-+
-+          __asm__ ("frsqrte %[estimate], %[x]\n"
-+                   : [estimate] "=f" (y) : [x] "f" (b));
-+
-+          /* Following Muller et al, page 168, equation 5.20.
-+
-+             h goes to 1/(2*sqrt(b))
-+             g goes to sqrt(b).
-+
-+             We need three iterations to get within 1ulp.  */
-+
-+          /* Indicate that these can be performed prior to the branch.  GCC
-+             insists on sinking them below the branch, however; it seems like
-+             they'd be better before the branch so that we can cover any latency
-+             from storing the argument and loading its high word.  Oh well.  */
-+
-+          g = b * y;
-+          h = 0.5 * y;
-+
-+          /* Handle small numbers by scaling.  */
-+          if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
-+            return __ieee754_sqrt (b * two108) * twom54;
-+
-+#define FMADD(a_, c_, b_)                                               \
-+          ({ double __r;                                                \
-+          __asm__ ("fmadd %[r], %[a], %[c], %[b]\n"                     \
-+                   : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+          __r;})
-+#define FNMSUB(a_, c_, b_)                                          \
-+          ({ double __r;                                                \
-+          __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n"                     \
-+                   : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+          __r;})
-+
-+          r = FNMSUB (g, h, half);
-+          g = FMADD (g, r, g);
-+          h = FMADD (h, r, h);
-+
-+          r = FNMSUB (g, h, half);
-+          g = FMADD (g, r, g);
-+          h = FMADD (h, r, h);
-+
-+          r = FNMSUB (g, h, half);
-+          g = FMADD (g, r, g);
-+          h = FMADD (h, r, h);
-+
-+          /* g is now +/- 1ulp, or exactly equal to, the square root of b.  */
-+
-+          /* Final refinement.  */
-+          d = FNMSUB (g, g, b);
-+
-+          fesetenv_register (fe);
-+          return FMADD (d, h, g);
-+        }
-+    }
-+  else if (b < 0)
-+    {
-+      /* For some reason, some PowerPC32 processors don't implement
-+         FE_INVALID_SQRT.  */
-+#ifdef FE_INVALID_SQRT
-+      feraiseexcept (FE_INVALID_SQRT);
-+
-+      fenv_union_t u = { .fenv = fegetenv_register () };
-+      if ((u.l & FE_INVALID) == 0)
-+#endif
-+	feraiseexcept (FE_INVALID);
-+      b = a_nan.value;
-+    }
-+  return f_wash (b);
-+}
-diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
-new file mode 100644
-index 0000000000..26fa067abf
---- /dev/null
-+++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
-@@ -0,0 +1,101 @@
-+/* Single-precision floating point square root.
-+   Copyright (C) 2010 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, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <math.h>
-+#include <math_private.h>
-+#include <fenv_libc.h>
-+#include <inttypes.h>
-+
-+#include <sysdep.h>
-+#include <ldsodefs.h>
-+
-+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
-+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
-+static const float threehalf = 1.5;
-+
-+/* The method is based on the descriptions in:
-+
-+   _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
-+   _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
-+
-+   We find the reciprocal square root and use that to compute the actual
-+   square root.  */
-+
-+#ifdef __STDC__
-+float
-+__ieee754_sqrtf (float b)
-+#else
-+float
-+__ieee754_sqrtf (b)
-+     float b;
-+#endif
-+{
-+  if (__builtin_expect (b > 0, 1))
-+    {
-+#define FMSUB(a_, c_, b_)                                               \
-+      ({ double __r;                                                    \
-+        __asm__ ("fmsub %[r], %[a], %[c], %[b]\n"                       \
-+                 : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+        __r;})
-+#define FNMSUB(a_, c_, b_)                                              \
-+      ({ double __r;                                                    \
-+        __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n"                      \
-+                 : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+        __r;})
-+
-+      if (__builtin_expect (b != a_inf.value, 1))
-+        {
-+          double y, x;
-+          fenv_t fe;
-+
-+          fe = fegetenv_register ();
-+
-+          relax_fenv_state ();
-+
-+          /* Compute y = 1.5 * b - b.  Uses fewer constants than y = 0.5 * b.  */
-+          y = FMSUB (threehalf, b, b);
-+
-+          /* Initial estimate.  */
-+          __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b));
-+
-+          /* Iterate.  x_{n+1} = x_n * (1.5 - y * (x_n * x_n)).  */
-+          x = x * FNMSUB (y, x * x, threehalf);
-+          x = x * FNMSUB (y, x * x, threehalf);
-+          x = x * FNMSUB (y, x * x, threehalf);
-+
-+          /* All done.  */
-+          fesetenv_register (fe);
-+          return x * b;
-+        }
-+    }
-+  else if (b < 0)
-+    {
-+      /* For some reason, some PowerPC32 processors don't implement
-+         FE_INVALID_SQRT.  */
-+#ifdef FE_INVALID_SQRT
-+      feraiseexcept (FE_INVALID_SQRT);
-+
-+      fenv_union_t u = { .fenv = fegetenv_register () };
-+      if ((u.l & FE_INVALID) == 0)
-+#endif
-+	feraiseexcept (FE_INVALID);
-+      b = a_nan.value;
-+    }
-+  return f_washf (b);
-+}
-diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-new file mode 100644
-index 0000000000..71e516d1c8
---- /dev/null
-+++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-@@ -0,0 +1,134 @@
-+/* Double-precision floating point square root.
-+   Copyright (C) 2010 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, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <math.h>
-+#include <math_private.h>
-+#include <fenv_libc.h>
-+#include <inttypes.h>
-+
-+#include <sysdep.h>
-+#include <ldsodefs.h>
-+
-+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
-+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
-+static const float two108 = 3.245185536584267269e+32;
-+static const float twom54 = 5.551115123125782702e-17;
-+static const float half = 0.5;
-+
-+/* The method is based on the descriptions in:
-+
-+   _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
-+   _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
-+
-+   We find the actual square root and half of its reciprocal
-+   simultaneously.  */
-+
-+#ifdef __STDC__
-+double
-+__ieee754_sqrt (double b)
-+#else
-+double
-+__ieee754_sqrt (b)
-+     double b;
-+#endif
-+{
-+  if (__builtin_expect (b > 0, 1))
-+    {
-+      double y, g, h, d, r;
-+      ieee_double_shape_type u;
-+
-+      if (__builtin_expect (b != a_inf.value, 1))
-+        {
-+          fenv_t fe;
-+
-+          fe = fegetenv_register ();
-+
-+          u.value = b;
-+
-+          relax_fenv_state ();
-+
-+          __asm__ ("frsqrte %[estimate], %[x]\n"
-+                   : [estimate] "=f" (y) : [x] "f" (b));
-+
-+          /* Following Muller et al, page 168, equation 5.20.
-+
-+             h goes to 1/(2*sqrt(b))
-+             g goes to sqrt(b).
-+
-+             We need three iterations to get within 1ulp.  */
-+
-+          /* Indicate that these can be performed prior to the branch.  GCC
-+             insists on sinking them below the branch, however; it seems like
-+             they'd be better before the branch so that we can cover any latency
-+             from storing the argument and loading its high word.  Oh well.  */
-+
-+          g = b * y;
-+          h = 0.5 * y;
-+
-+          /* Handle small numbers by scaling.  */
-+          if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
-+            return __ieee754_sqrt (b * two108) * twom54;
-+
-+#define FMADD(a_, c_, b_)                                               \
-+          ({ double __r;                                                \
-+          __asm__ ("fmadd %[r], %[a], %[c], %[b]\n"                     \
-+                   : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+          __r;})
-+#define FNMSUB(a_, c_, b_)                                          \
-+          ({ double __r;                                                \
-+          __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n"                     \
-+                   : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+          __r;})
-+
-+          r = FNMSUB (g, h, half);
-+          g = FMADD (g, r, g);
-+          h = FMADD (h, r, h);
-+
-+          r = FNMSUB (g, h, half);
-+          g = FMADD (g, r, g);
-+          h = FMADD (h, r, h);
-+
-+          r = FNMSUB (g, h, half);
-+          g = FMADD (g, r, g);
-+          h = FMADD (h, r, h);
-+
-+          /* g is now +/- 1ulp, or exactly equal to, the square root of b.  */
-+
-+          /* Final refinement.  */
-+          d = FNMSUB (g, g, b);
-+
-+          fesetenv_register (fe);
-+          return FMADD (d, h, g);
-+        }
-+    }
-+  else if (b < 0)
-+    {
-+      /* For some reason, some PowerPC32 processors don't implement
-+         FE_INVALID_SQRT.  */
-+#ifdef FE_INVALID_SQRT
-+      feraiseexcept (FE_INVALID_SQRT);
-+
-+      fenv_union_t u = { .fenv = fegetenv_register () };
-+      if ((u.l & FE_INVALID) == 0)
-+#endif
-+	feraiseexcept (FE_INVALID);
-+      b = a_nan.value;
-+    }
-+  return f_wash (b);
-+}
-diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
-new file mode 100644
-index 0000000000..26fa067abf
---- /dev/null
-+++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
-@@ -0,0 +1,101 @@
-+/* Single-precision floating point square root.
-+   Copyright (C) 2010 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, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <math.h>
-+#include <math_private.h>
-+#include <fenv_libc.h>
-+#include <inttypes.h>
-+
-+#include <sysdep.h>
-+#include <ldsodefs.h>
-+
-+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
-+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
-+static const float threehalf = 1.5;
-+
-+/* The method is based on the descriptions in:
-+
-+   _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
-+   _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
-+
-+   We find the reciprocal square root and use that to compute the actual
-+   square root.  */
-+
-+#ifdef __STDC__
-+float
-+__ieee754_sqrtf (float b)
-+#else
-+float
-+__ieee754_sqrtf (b)
-+     float b;
-+#endif
-+{
-+  if (__builtin_expect (b > 0, 1))
-+    {
-+#define FMSUB(a_, c_, b_)                                               \
-+      ({ double __r;                                                    \
-+        __asm__ ("fmsub %[r], %[a], %[c], %[b]\n"                       \
-+                 : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+        __r;})
-+#define FNMSUB(a_, c_, b_)                                              \
-+      ({ double __r;                                                    \
-+        __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n"                      \
-+                 : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+        __r;})
-+
-+      if (__builtin_expect (b != a_inf.value, 1))
-+        {
-+          double y, x;
-+          fenv_t fe;
-+
-+          fe = fegetenv_register ();
-+
-+          relax_fenv_state ();
-+
-+          /* Compute y = 1.5 * b - b.  Uses fewer constants than y = 0.5 * b.  */
-+          y = FMSUB (threehalf, b, b);
-+
-+          /* Initial estimate.  */
-+          __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b));
-+
-+          /* Iterate.  x_{n+1} = x_n * (1.5 - y * (x_n * x_n)).  */
-+          x = x * FNMSUB (y, x * x, threehalf);
-+          x = x * FNMSUB (y, x * x, threehalf);
-+          x = x * FNMSUB (y, x * x, threehalf);
-+
-+          /* All done.  */
-+          fesetenv_register (fe);
-+          return x * b;
-+        }
-+    }
-+  else if (b < 0)
-+    {
-+      /* For some reason, some PowerPC32 processors don't implement
-+         FE_INVALID_SQRT.  */
-+#ifdef FE_INVALID_SQRT
-+      feraiseexcept (FE_INVALID_SQRT);
-+
-+      fenv_union_t u = { .fenv = fegetenv_register () };
-+      if ((u.l & FE_INVALID) == 0)
-+#endif
-+	feraiseexcept (FE_INVALID);
-+      b = a_nan.value;
-+    }
-+  return f_washf (b);
-+}
-diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
-new file mode 100644
-index 0000000000..71e516d1c8
---- /dev/null
-+++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
-@@ -0,0 +1,134 @@
-+/* Double-precision floating point square root.
-+   Copyright (C) 2010 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, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <math.h>
-+#include <math_private.h>
-+#include <fenv_libc.h>
-+#include <inttypes.h>
-+
-+#include <sysdep.h>
-+#include <ldsodefs.h>
-+
-+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
-+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
-+static const float two108 = 3.245185536584267269e+32;
-+static const float twom54 = 5.551115123125782702e-17;
-+static const float half = 0.5;
-+
-+/* The method is based on the descriptions in:
-+
-+   _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
-+   _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
-+
-+   We find the actual square root and half of its reciprocal
-+   simultaneously.  */
-+
-+#ifdef __STDC__
-+double
-+__ieee754_sqrt (double b)
-+#else
-+double
-+__ieee754_sqrt (b)
-+     double b;
-+#endif
-+{
-+  if (__builtin_expect (b > 0, 1))
-+    {
-+      double y, g, h, d, r;
-+      ieee_double_shape_type u;
-+
-+      if (__builtin_expect (b != a_inf.value, 1))
-+        {
-+          fenv_t fe;
-+
-+          fe = fegetenv_register ();
-+
-+          u.value = b;
-+
-+          relax_fenv_state ();
-+
-+          __asm__ ("frsqrte %[estimate], %[x]\n"
-+                   : [estimate] "=f" (y) : [x] "f" (b));
-+
-+          /* Following Muller et al, page 168, equation 5.20.
-+
-+             h goes to 1/(2*sqrt(b))
-+             g goes to sqrt(b).
-+
-+             We need three iterations to get within 1ulp.  */
-+
-+          /* Indicate that these can be performed prior to the branch.  GCC
-+             insists on sinking them below the branch, however; it seems like
-+             they'd be better before the branch so that we can cover any latency
-+             from storing the argument and loading its high word.  Oh well.  */
-+
-+          g = b * y;
-+          h = 0.5 * y;
-+
-+          /* Handle small numbers by scaling.  */
-+          if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
-+            return __ieee754_sqrt (b * two108) * twom54;
-+
-+#define FMADD(a_, c_, b_)                                               \
-+          ({ double __r;                                                \
-+          __asm__ ("fmadd %[r], %[a], %[c], %[b]\n"                     \
-+                   : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+          __r;})
-+#define FNMSUB(a_, c_, b_)                                          \
-+          ({ double __r;                                                \
-+          __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n"                     \
-+                   : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+          __r;})
-+
-+          r = FNMSUB (g, h, half);
-+          g = FMADD (g, r, g);
-+          h = FMADD (h, r, h);
-+
-+          r = FNMSUB (g, h, half);
-+          g = FMADD (g, r, g);
-+          h = FMADD (h, r, h);
-+
-+          r = FNMSUB (g, h, half);
-+          g = FMADD (g, r, g);
-+          h = FMADD (h, r, h);
-+
-+          /* g is now +/- 1ulp, or exactly equal to, the square root of b.  */
-+
-+          /* Final refinement.  */
-+          d = FNMSUB (g, g, b);
-+
-+          fesetenv_register (fe);
-+          return FMADD (d, h, g);
-+        }
-+    }
-+  else if (b < 0)
-+    {
-+      /* For some reason, some PowerPC32 processors don't implement
-+         FE_INVALID_SQRT.  */
-+#ifdef FE_INVALID_SQRT
-+      feraiseexcept (FE_INVALID_SQRT);
-+
-+      fenv_union_t u = { .fenv = fegetenv_register () };
-+      if ((u.l & FE_INVALID) == 0)
-+#endif
-+	feraiseexcept (FE_INVALID);
-+      b = a_nan.value;
-+    }
-+  return f_wash (b);
-+}
-diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
-new file mode 100644
-index 0000000000..26fa067abf
---- /dev/null
-+++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
-@@ -0,0 +1,101 @@
-+/* Single-precision floating point square root.
-+   Copyright (C) 2010 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, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <math.h>
-+#include <math_private.h>
-+#include <fenv_libc.h>
-+#include <inttypes.h>
-+
-+#include <sysdep.h>
-+#include <ldsodefs.h>
-+
-+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
-+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
-+static const float threehalf = 1.5;
-+
-+/* The method is based on the descriptions in:
-+
-+   _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
-+   _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
-+
-+   We find the reciprocal square root and use that to compute the actual
-+   square root.  */
-+
-+#ifdef __STDC__
-+float
-+__ieee754_sqrtf (float b)
-+#else
-+float
-+__ieee754_sqrtf (b)
-+     float b;
-+#endif
-+{
-+  if (__builtin_expect (b > 0, 1))
-+    {
-+#define FMSUB(a_, c_, b_)                                               \
-+      ({ double __r;                                                    \
-+        __asm__ ("fmsub %[r], %[a], %[c], %[b]\n"                       \
-+                 : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+        __r;})
-+#define FNMSUB(a_, c_, b_)                                              \
-+      ({ double __r;                                                    \
-+        __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n"                      \
-+                 : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+        __r;})
-+
-+      if (__builtin_expect (b != a_inf.value, 1))
-+        {
-+          double y, x;
-+          fenv_t fe;
-+
-+          fe = fegetenv_register ();
-+
-+          relax_fenv_state ();
-+
-+          /* Compute y = 1.5 * b - b.  Uses fewer constants than y = 0.5 * b.  */
-+          y = FMSUB (threehalf, b, b);
-+
-+          /* Initial estimate.  */
-+          __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b));
-+
-+          /* Iterate.  x_{n+1} = x_n * (1.5 - y * (x_n * x_n)).  */
-+          x = x * FNMSUB (y, x * x, threehalf);
-+          x = x * FNMSUB (y, x * x, threehalf);
-+          x = x * FNMSUB (y, x * x, threehalf);
-+
-+          /* All done.  */
-+          fesetenv_register (fe);
-+          return x * b;
-+        }
-+    }
-+  else if (b < 0)
-+    {
-+      /* For some reason, some PowerPC32 processors don't implement
-+         FE_INVALID_SQRT.  */
-+#ifdef FE_INVALID_SQRT
-+      feraiseexcept (FE_INVALID_SQRT);
-+
-+      fenv_union_t u = { .fenv = fegetenv_register () };
-+      if ((u.l & FE_INVALID) == 0)
-+#endif
-+	feraiseexcept (FE_INVALID);
-+      b = a_nan.value;
-+    }
-+  return f_washf (b);
-+}
-diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
-new file mode 100644
-index 0000000000..71e516d1c8
---- /dev/null
-+++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
-@@ -0,0 +1,134 @@
-+/* Double-precision floating point square root.
-+   Copyright (C) 2010 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, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <math.h>
-+#include <math_private.h>
-+#include <fenv_libc.h>
-+#include <inttypes.h>
-+
-+#include <sysdep.h>
-+#include <ldsodefs.h>
-+
-+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
-+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
-+static const float two108 = 3.245185536584267269e+32;
-+static const float twom54 = 5.551115123125782702e-17;
-+static const float half = 0.5;
-+
-+/* The method is based on the descriptions in:
-+
-+   _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
-+   _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
-+
-+   We find the actual square root and half of its reciprocal
-+   simultaneously.  */
-+
-+#ifdef __STDC__
-+double
-+__ieee754_sqrt (double b)
-+#else
-+double
-+__ieee754_sqrt (b)
-+     double b;
-+#endif
-+{
-+  if (__builtin_expect (b > 0, 1))
-+    {
-+      double y, g, h, d, r;
-+      ieee_double_shape_type u;
-+
-+      if (__builtin_expect (b != a_inf.value, 1))
-+        {
-+          fenv_t fe;
-+
-+          fe = fegetenv_register ();
-+
-+          u.value = b;
-+
-+          relax_fenv_state ();
-+
-+          __asm__ ("frsqrte %[estimate], %[x]\n"
-+                   : [estimate] "=f" (y) : [x] "f" (b));
-+
-+          /* Following Muller et al, page 168, equation 5.20.
-+
-+             h goes to 1/(2*sqrt(b))
-+             g goes to sqrt(b).
-+
-+             We need three iterations to get within 1ulp.  */
-+
-+          /* Indicate that these can be performed prior to the branch.  GCC
-+             insists on sinking them below the branch, however; it seems like
-+             they'd be better before the branch so that we can cover any latency
-+             from storing the argument and loading its high word.  Oh well.  */
-+
-+          g = b * y;
-+          h = 0.5 * y;
-+
-+          /* Handle small numbers by scaling.  */
-+          if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
-+            return __ieee754_sqrt (b * two108) * twom54;
-+
-+#define FMADD(a_, c_, b_)                                               \
-+          ({ double __r;                                                \
-+          __asm__ ("fmadd %[r], %[a], %[c], %[b]\n"                     \
-+                   : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+          __r;})
-+#define FNMSUB(a_, c_, b_)                                          \
-+          ({ double __r;                                                \
-+          __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n"                     \
-+                   : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+          __r;})
-+
-+          r = FNMSUB (g, h, half);
-+          g = FMADD (g, r, g);
-+          h = FMADD (h, r, h);
-+
-+          r = FNMSUB (g, h, half);
-+          g = FMADD (g, r, g);
-+          h = FMADD (h, r, h);
-+
-+          r = FNMSUB (g, h, half);
-+          g = FMADD (g, r, g);
-+          h = FMADD (h, r, h);
-+
-+          /* g is now +/- 1ulp, or exactly equal to, the square root of b.  */
-+
-+          /* Final refinement.  */
-+          d = FNMSUB (g, g, b);
-+
-+          fesetenv_register (fe);
-+          return FMADD (d, h, g);
-+        }
-+    }
-+  else if (b < 0)
-+    {
-+      /* For some reason, some PowerPC32 processors don't implement
-+         FE_INVALID_SQRT.  */
-+#ifdef FE_INVALID_SQRT
-+      feraiseexcept (FE_INVALID_SQRT);
-+
-+      fenv_union_t u = { .fenv = fegetenv_register () };
-+      if ((u.l & FE_INVALID) == 0)
-+#endif
-+	feraiseexcept (FE_INVALID);
-+      b = a_nan.value;
-+    }
-+  return f_wash (b);
-+}
-diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
-new file mode 100644
-index 0000000000..26fa067abf
---- /dev/null
-+++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
-@@ -0,0 +1,101 @@
-+/* Single-precision floating point square root.
-+   Copyright (C) 2010 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, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <math.h>
-+#include <math_private.h>
-+#include <fenv_libc.h>
-+#include <inttypes.h>
-+
-+#include <sysdep.h>
-+#include <ldsodefs.h>
-+
-+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
-+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
-+static const float threehalf = 1.5;
-+
-+/* The method is based on the descriptions in:
-+
-+   _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
-+   _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
-+
-+   We find the reciprocal square root and use that to compute the actual
-+   square root.  */
-+
-+#ifdef __STDC__
-+float
-+__ieee754_sqrtf (float b)
-+#else
-+float
-+__ieee754_sqrtf (b)
-+     float b;
-+#endif
-+{
-+  if (__builtin_expect (b > 0, 1))
-+    {
-+#define FMSUB(a_, c_, b_)                                               \
-+      ({ double __r;                                                    \
-+        __asm__ ("fmsub %[r], %[a], %[c], %[b]\n"                       \
-+                 : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+        __r;})
-+#define FNMSUB(a_, c_, b_)                                              \
-+      ({ double __r;                                                    \
-+        __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n"                      \
-+                 : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
-+        __r;})
-+
-+      if (__builtin_expect (b != a_inf.value, 1))
-+        {
-+          double y, x;
-+          fenv_t fe;
-+
-+          fe = fegetenv_register ();
-+
-+          relax_fenv_state ();
-+
-+          /* Compute y = 1.5 * b - b.  Uses fewer constants than y = 0.5 * b.  */
-+          y = FMSUB (threehalf, b, b);
-+
-+          /* Initial estimate.  */
-+          __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b));
-+
-+          /* Iterate.  x_{n+1} = x_n * (1.5 - y * (x_n * x_n)).  */
-+          x = x * FNMSUB (y, x * x, threehalf);
-+          x = x * FNMSUB (y, x * x, threehalf);
-+          x = x * FNMSUB (y, x * x, threehalf);
-+
-+          /* All done.  */
-+          fesetenv_register (fe);
-+          return x * b;
-+        }
-+    }
-+  else if (b < 0)
-+    {
-+      /* For some reason, some PowerPC32 processors don't implement
-+         FE_INVALID_SQRT.  */
-+#ifdef FE_INVALID_SQRT
-+      feraiseexcept (FE_INVALID_SQRT);
-+
-+      fenv_union_t u = { .fenv = fegetenv_register () };
-+      if ((u.l & FE_INVALID) == 0)
-+#endif
-+	feraiseexcept (FE_INVALID);
-+      b = a_nan.value;
-+    }
-+  return f_washf (b);
-+}
-diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies
-new file mode 100644
-index 0000000000..b103b4dea5
---- /dev/null
-+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies
-@@ -0,0 +1 @@
-+powerpc/powerpc32/603e/fpu
-diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies
-new file mode 100644
-index 0000000000..64db17fada
---- /dev/null
-+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies
-@@ -0,0 +1,2 @@
-+# e300c3 is a variant of 603e so use the same optimizations for sqrt
-+powerpc/powerpc32/603e/fpu
-diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies
-new file mode 100644
-index 0000000000..7eac5fcf02
---- /dev/null
-+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies
-@@ -0,0 +1 @@
-+powerpc/powerpc32/e500mc/fpu
-diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies
-new file mode 100644
-index 0000000000..264b2a7700
---- /dev/null
-+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies
-@@ -0,0 +1 @@
-+powerpc/powerpc32/e5500/fpu
-diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies
-new file mode 100644
-index 0000000000..a25934467b
---- /dev/null
-+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies
-@@ -0,0 +1 @@
-+powerpc/powerpc32/e6500/fpu
-diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies
-new file mode 100644
-index 0000000000..a7bc854be8
---- /dev/null
-+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies
-@@ -0,0 +1 @@
-+powerpc/powerpc64/e5500/fpu
-diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies
-new file mode 100644
-index 0000000000..04ff8cc181
---- /dev/null
-+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies
-@@ -0,0 +1 @@
-+powerpc/powerpc64/e6500/fpu

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

@@ -0,0 +1,25 @@
+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
+

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

@@ -1,4 +1,4 @@
-From 7be3e82b66394a7b242e56c6fc609e858b8e2436 Mon Sep 17 00:00:00 2001
+From 07655aaa14f9d1f3a521caadde2936067ce84b07 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:31:06 +0000
 Date: Wed, 18 Mar 2015 00:31:06 +0000
 Subject: [PATCH] 'yes' within the path sets wrong config variables
 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(-)
  12 files changed, 28 insertions(+), 28 deletions(-)
 
 
 diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure
 diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure
-index 4c1fac49f3..597314f476 100644
+index bf972122b1..f9397b8d6e 100644
 --- a/sysdeps/aarch64/configure
 --- a/sysdeps/aarch64/configure
 +++ b/sysdeps/aarch64/configure
 +++ b/sysdeps/aarch64/configure
-@@ -157,12 +157,12 @@ else
+@@ -152,12 +152,12 @@ else
    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  /* end confdefs.h.  */
  /* end confdefs.h.  */
  #ifdef __AARCH64EB__
  #ifdef __AARCH64EB__
@@ -48,10 +48,10 @@ index 4c1fac49f3..597314f476 100644
  else
  else
    libc_cv_aarch64_be=no
    libc_cv_aarch64_be=no
 diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac
 diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac
-index 3347c13fa1..4af163c0b6 100644
+index 51253d9802..ba36a0e8b4 100644
 --- a/sysdeps/aarch64/configure.ac
 --- a/sysdeps/aarch64/configure.ac
 +++ b/sysdeps/aarch64/configure.ac
 +++ b/sysdeps/aarch64/configure.ac
-@@ -17,8 +17,8 @@ AC_DEFINE(SUPPORT_STATIC_PIE)
+@@ -13,8 +13,8 @@ AC_DEFINE(SUPPORT_STATIC_PIE)
  # the dynamic linker via %ifdef.
  # the dynamic linker via %ifdef.
  AC_CACHE_CHECK([for big endian],
  AC_CACHE_CHECK([for big endian],
    [libc_cv_aarch64_be],
    [libc_cv_aarch64_be],
@@ -63,10 +63,10 @@ index 3347c13fa1..4af163c0b6 100644
    ], libc_cv_aarch64_be=yes, libc_cv_aarch64_be=no)])
    ], libc_cv_aarch64_be=yes, libc_cv_aarch64_be=no)])
  if test $libc_cv_aarch64_be = yes; then
  if test $libc_cv_aarch64_be = yes; then
 diff --git a/sysdeps/arm/configure b/sysdeps/arm/configure
 diff --git a/sysdeps/arm/configure b/sysdeps/arm/configure
-index 431e843b2b..e152461138 100644
+index 5b0237e521..969fc9fe95 100644
 --- a/sysdeps/arm/configure
 --- a/sysdeps/arm/configure
 +++ b/sysdeps/arm/configure
 +++ b/sysdeps/arm/configure
-@@ -151,12 +151,12 @@ else
+@@ -148,12 +148,12 @@ else
    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  /* end confdefs.h.  */
  /* end confdefs.h.  */
  #ifdef __ARM_PCS_VFP
  #ifdef __ARM_PCS_VFP
@@ -82,10 +82,10 @@ index 431e843b2b..e152461138 100644
  else
  else
    libc_cv_arm_pcs_vfp=no
    libc_cv_arm_pcs_vfp=no
 diff --git a/sysdeps/arm/configure.ac b/sysdeps/arm/configure.ac
 diff --git a/sysdeps/arm/configure.ac b/sysdeps/arm/configure.ac
-index 90cdd69c75..05a262ba00 100644
+index 5172e30bbe..f06dedd7c5 100644
 --- a/sysdeps/arm/configure.ac
 --- a/sysdeps/arm/configure.ac
 +++ b/sysdeps/arm/configure.ac
 +++ b/sysdeps/arm/configure.ac
-@@ -15,8 +15,8 @@ AC_DEFINE(PI_STATIC_AND_HIDDEN)
+@@ -10,8 +10,8 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
  # the dynamic linker via %ifdef.
  # the dynamic linker via %ifdef.
  AC_CACHE_CHECK([whether the compiler is using the ARM hard-float ABI],
  AC_CACHE_CHECK([whether the compiler is using the ARM hard-float ABI],
    [libc_cv_arm_pcs_vfp],
    [libc_cv_arm_pcs_vfp],
@@ -97,10 +97,10 @@ index 90cdd69c75..05a262ba00 100644
    ], libc_cv_arm_pcs_vfp=yes, libc_cv_arm_pcs_vfp=no)])
    ], libc_cv_arm_pcs_vfp=yes, libc_cv_arm_pcs_vfp=no)])
  if test $libc_cv_arm_pcs_vfp = yes; then
  if test $libc_cv_arm_pcs_vfp = yes; then
 diff --git a/sysdeps/mips/configure b/sysdeps/mips/configure
 diff --git a/sysdeps/mips/configure b/sysdeps/mips/configure
-index 4e13248c03..f14af952d0 100644
+index 3f4d9e9759..888453c70b 100644
 --- a/sysdeps/mips/configure
 --- a/sysdeps/mips/configure
 +++ b/sysdeps/mips/configure
 +++ b/sysdeps/mips/configure
-@@ -143,11 +143,11 @@ else
+@@ -145,11 +145,11 @@ else
  /* end confdefs.h.  */
  /* end confdefs.h.  */
  dnl
  dnl
  #ifdef __mips_nan2008
  #ifdef __mips_nan2008
@@ -115,11 +115,11 @@ index 4e13248c03..f14af952d0 100644
  else
  else
    libc_cv_mips_nan2008=no
    libc_cv_mips_nan2008=no
 diff --git a/sysdeps/mips/configure.ac b/sysdeps/mips/configure.ac
 diff --git a/sysdeps/mips/configure.ac b/sysdeps/mips/configure.ac
-index bcbdaffd9f..ad3057f4cc 100644
+index d3cd780d78..250223d206 100644
 --- a/sysdeps/mips/configure.ac
 --- a/sysdeps/mips/configure.ac
 +++ b/sysdeps/mips/configure.ac
 +++ b/sysdeps/mips/configure.ac
 @@ -6,9 +6,9 @@ dnl position independent way.
 @@ -6,9 +6,9 @@ dnl position independent way.
- dnl AC_DEFINE(PI_STATIC_AND_HIDDEN)
+ AC_DEFINE(HIDDEN_VAR_NEEDS_DYNAMIC_RELOC)
  
  
  AC_CACHE_CHECK([whether the compiler is using the 2008 NaN encoding],
  AC_CACHE_CHECK([whether the compiler is using the 2008 NaN encoding],
 -  libc_cv_mips_nan2008, [AC_EGREP_CPP(yes, [dnl
 -  libc_cv_mips_nan2008, [AC_EGREP_CPP(yes, [dnl
@@ -131,7 +131,7 @@ index bcbdaffd9f..ad3057f4cc 100644
  if test x$libc_cv_mips_nan2008 = xyes; then
  if test x$libc_cv_mips_nan2008 = xyes; then
    AC_DEFINE(HAVE_MIPS_NAN2008)
    AC_DEFINE(HAVE_MIPS_NAN2008)
 diff --git a/sysdeps/nios2/configure b/sysdeps/nios2/configure
 diff --git a/sysdeps/nios2/configure b/sysdeps/nios2/configure
-index 14c8a3a014..dde3814ef2 100644
+index b3cd28349e..f47e5a5adc 100644
 --- a/sysdeps/nios2/configure
 --- a/sysdeps/nios2/configure
 +++ b/sysdeps/nios2/configure
 +++ b/sysdeps/nios2/configure
 @@ -142,12 +142,12 @@ else
 @@ -142,12 +142,12 @@ else
@@ -150,7 +150,7 @@ index 14c8a3a014..dde3814ef2 100644
  else
  else
    libc_cv_nios2_be=no
    libc_cv_nios2_be=no
 diff --git a/sysdeps/nios2/configure.ac b/sysdeps/nios2/configure.ac
 diff --git a/sysdeps/nios2/configure.ac b/sysdeps/nios2/configure.ac
-index f05f43802b..dc8639902d 100644
+index f738e9a7ed..4085851cbc 100644
 --- a/sysdeps/nios2/configure.ac
 --- a/sysdeps/nios2/configure.ac
 +++ b/sysdeps/nios2/configure.ac
 +++ b/sysdeps/nios2/configure.ac
 @@ -4,8 +4,8 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
 @@ -4,8 +4,8 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.

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

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

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

@@ -0,0 +1,1382 @@
+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 - 205
recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch

@@ -1,205 +0,0 @@
-From 5da3da7f2d276c2a6ae1b04419b28e96953803ec Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 18 Mar 2015 00:15:07 +0000
-Subject: [PATCH] ppc/sqrt: Fix undefined reference to `__sqrt_finite'
-
-on ppc fixes the errors like below
-| ./.libs/libpulsecore-1.1.so: undefined reference to `__sqrt_finite'
-| collect2: ld returned 1 exit status
-
-Upstream-Status: Pending
-
-ChangeLog
-
-2012-01-06  Khem Raj  <raj.khem@gmail.com>
-
-        * sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c: Add __*_finite alias.
-        Remove cruft.
-        * sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c: Ditto.
-        * sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c: Ditto.
-        * sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c: Ditto.
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c    | 7 +------
- sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c   | 7 +------
- sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c  | 1 +
- sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c | 1 +
- sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c   | 1 +
- sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c  | 1 +
- sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c   | 1 +
- sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c  | 1 +
- sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c   | 7 +------
- sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c  | 7 +------
- sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c   | 1 +
- sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c  | 1 +
- 12 files changed, 12 insertions(+), 24 deletions(-)
-
-diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
-index 71e516d1c8..1795fd6c3e 100644
---- a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
-@@ -39,14 +39,8 @@ static const float half = 0.5;
-    We find the actual square root and half of its reciprocal
-    simultaneously.  */
- 
--#ifdef __STDC__
- double
- __ieee754_sqrt (double b)
--#else
--double
--__ieee754_sqrt (b)
--     double b;
--#endif
- {
-   if (__builtin_expect (b > 0, 1))
-     {
-@@ -132,3 +126,4 @@ __ieee754_sqrt (b)
-     }
-   return f_wash (b);
- }
-+strong_alias (__ieee754_sqrt, __sqrt_finite)
-diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
-index 26fa067abf..a917f313ab 100644
---- a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
-@@ -37,14 +37,8 @@ static const float threehalf = 1.5;
-    We find the reciprocal square root and use that to compute the actual
-    square root.  */
- 
--#ifdef __STDC__
- float
- __ieee754_sqrtf (float b)
--#else
--float
--__ieee754_sqrtf (b)
--     float b;
--#endif
- {
-   if (__builtin_expect (b > 0, 1))
-     {
-@@ -99,3 +93,4 @@ __ieee754_sqrtf (b)
-     }
-   return f_washf (b);
- }
-+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
-index 71e516d1c8..fc4a74990e 100644
---- a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
-@@ -132,3 +132,4 @@ __ieee754_sqrt (b)
-     }
-   return f_wash (b);
- }
-+strong_alias (__ieee754_sqrt, __sqrt_finite)
-diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
-index 26fa067abf..9d175122a8 100644
---- a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
-@@ -99,3 +99,4 @@ __ieee754_sqrtf (b)
-     }
-   return f_washf (b);
- }
-+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
-index 71e516d1c8..fc4a74990e 100644
---- a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
-@@ -132,3 +132,4 @@ __ieee754_sqrt (b)
-     }
-   return f_wash (b);
- }
-+strong_alias (__ieee754_sqrt, __sqrt_finite)
-diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
-index 26fa067abf..9d175122a8 100644
---- a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
-@@ -99,3 +99,4 @@ __ieee754_sqrtf (b)
-     }
-   return f_washf (b);
- }
-+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-index 71e516d1c8..fc4a74990e 100644
---- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-@@ -132,3 +132,4 @@ __ieee754_sqrt (b)
-     }
-   return f_wash (b);
- }
-+strong_alias (__ieee754_sqrt, __sqrt_finite)
-diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
-index 26fa067abf..9d175122a8 100644
---- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
-@@ -99,3 +99,4 @@ __ieee754_sqrtf (b)
-     }
-   return f_washf (b);
- }
-+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
-index 71e516d1c8..1795fd6c3e 100644
---- a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
-@@ -39,14 +39,8 @@ static const float half = 0.5;
-    We find the actual square root and half of its reciprocal
-    simultaneously.  */
- 
--#ifdef __STDC__
- double
- __ieee754_sqrt (double b)
--#else
--double
--__ieee754_sqrt (b)
--     double b;
--#endif
- {
-   if (__builtin_expect (b > 0, 1))
-     {
-@@ -132,3 +126,4 @@ __ieee754_sqrt (b)
-     }
-   return f_wash (b);
- }
-+strong_alias (__ieee754_sqrt, __sqrt_finite)
-diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
-index 26fa067abf..a917f313ab 100644
---- a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
-@@ -37,14 +37,8 @@ static const float threehalf = 1.5;
-    We find the reciprocal square root and use that to compute the actual
-    square root.  */
- 
--#ifdef __STDC__
- float
- __ieee754_sqrtf (float b)
--#else
--float
--__ieee754_sqrtf (b)
--     float b;
--#endif
- {
-   if (__builtin_expect (b > 0, 1))
-     {
-@@ -99,3 +93,4 @@ __ieee754_sqrtf (b)
-     }
-   return f_washf (b);
- }
-+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
-index 71e516d1c8..fc4a74990e 100644
---- a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
-@@ -132,3 +132,4 @@ __ieee754_sqrt (b)
-     }
-   return f_wash (b);
- }
-+strong_alias (__ieee754_sqrt, __sqrt_finite)
-diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
-index 26fa067abf..9d175122a8 100644
---- a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
-@@ -99,3 +99,4 @@ __ieee754_sqrtf (b)
-     }
-   return f_washf (b);
- }
-+strong_alias (__ieee754_sqrtf, __sqrtf_finite)

+ 0 - 384
recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch

@@ -1,384 +0,0 @@
-From 77f1c90d67a2f8852184fb8fd95cb0ed63065dc7 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 18 Mar 2015 00:16:38 +0000
-Subject: [PATCH] __ieee754_sqrt{,f} are now inline functions and call out
- __slow versions
-
-Upstream-Status: Pending
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c    | 12 ++++++++++--
- sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c   |  8 +++++++-
- sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c  | 14 +++++++++++---
- sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c | 12 ++++++++++--
- sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c   | 14 +++++++++++---
- sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c  | 12 ++++++++++--
- sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c   |  8 ++++++++
- sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c  |  8 ++++++++
- sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c   | 12 ++++++++++--
- sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c  |  9 ++++++++-
- sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c   | 14 +++++++++++---
- sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c  | 12 ++++++++++--
- 12 files changed, 114 insertions(+), 21 deletions(-)
-
-diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
-index 1795fd6c3e..daa83f3fe8 100644
---- a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
-@@ -40,7 +40,7 @@ static const float half = 0.5;
-    simultaneously.  */
- 
- double
--__ieee754_sqrt (double b)
-+__slow_ieee754_sqrt (double b)
- {
-   if (__builtin_expect (b > 0, 1))
-     {
-@@ -77,7 +77,7 @@ __ieee754_sqrt (double b)
- 
-           /* Handle small numbers by scaling.  */
-           if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
--            return __ieee754_sqrt (b * two108) * twom54;
-+            return __slow_ieee754_sqrt (b * two108) * twom54;
- 
- #define FMADD(a_, c_, b_)                                               \
-           ({ double __r;                                                \
-@@ -126,4 +126,12 @@ __ieee754_sqrt (double b)
-     }
-   return f_wash (b);
- }
-+
-+#undef __ieee754_sqrt
-+double
-+__ieee754_sqrt (double x)
-+{
-+   return __slow_ieee754_sqrt (x);
-+}
-+
- strong_alias (__ieee754_sqrt, __sqrt_finite)
-diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
-index a917f313ab..b812cf1705 100644
---- a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
-@@ -38,7 +38,7 @@ static const float threehalf = 1.5;
-    square root.  */
- 
- float
--__ieee754_sqrtf (float b)
-+__slow_ieee754_sqrtf (float b)
- {
-   if (__builtin_expect (b > 0, 1))
-     {
-@@ -93,4 +93,10 @@ __ieee754_sqrtf (float b)
-     }
-   return f_washf (b);
- }
-+#undef __ieee754_sqrtf
-+float
-+__ieee754_sqrtf (float x)
-+{
-+  return __slow_ieee754_sqrtf (x);
-+}
- strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
-index fc4a74990e..7038a70b47 100644
---- a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
-@@ -41,10 +41,10 @@ static const float half = 0.5;
- 
- #ifdef __STDC__
- double
--__ieee754_sqrt (double b)
-+__slow_ieee754_sqrt (double b)
- #else
- double
--__ieee754_sqrt (b)
-+__slow_ieee754_sqrt (b)
-      double b;
- #endif
- {
-@@ -83,7 +83,7 @@ __ieee754_sqrt (b)
- 
-           /* Handle small numbers by scaling.  */
-           if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
--            return __ieee754_sqrt (b * two108) * twom54;
-+            return __slow_ieee754_sqrt (b * two108) * twom54;
- 
- #define FMADD(a_, c_, b_)                                               \
-           ({ double __r;                                                \
-@@ -132,4 +132,12 @@ __ieee754_sqrt (b)
-     }
-   return f_wash (b);
- }
-+
-+#undef __ieee754_sqrt
-+double
-+__ieee754_sqrt (double x)
-+{
-+   return __slow_ieee754_sqrt (x);
-+}
-+
- strong_alias (__ieee754_sqrt, __sqrt_finite)
-diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
-index 9d175122a8..10de1f0cc3 100644
---- a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
-@@ -39,10 +39,10 @@ static const float threehalf = 1.5;
- 
- #ifdef __STDC__
- float
--__ieee754_sqrtf (float b)
-+__slow_ieee754_sqrtf (float b)
- #else
- float
--__ieee754_sqrtf (b)
-+__slow_ieee754_sqrtf (b)
-      float b;
- #endif
- {
-@@ -99,4 +99,12 @@ __ieee754_sqrtf (b)
-     }
-   return f_washf (b);
- }
-+
-+#undef __ieee754_sqrtf
-+float
-+__ieee754_sqrtf (float x)
-+{
-+  return __slow_ieee754_sqrtf (x);
-+}
-+
- strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
-index fc4a74990e..7038a70b47 100644
---- a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
-@@ -41,10 +41,10 @@ static const float half = 0.5;
- 
- #ifdef __STDC__
- double
--__ieee754_sqrt (double b)
-+__slow_ieee754_sqrt (double b)
- #else
- double
--__ieee754_sqrt (b)
-+__slow_ieee754_sqrt (b)
-      double b;
- #endif
- {
-@@ -83,7 +83,7 @@ __ieee754_sqrt (b)
- 
-           /* Handle small numbers by scaling.  */
-           if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
--            return __ieee754_sqrt (b * two108) * twom54;
-+            return __slow_ieee754_sqrt (b * two108) * twom54;
- 
- #define FMADD(a_, c_, b_)                                               \
-           ({ double __r;                                                \
-@@ -132,4 +132,12 @@ __ieee754_sqrt (b)
-     }
-   return f_wash (b);
- }
-+
-+#undef __ieee754_sqrt
-+double
-+__ieee754_sqrt (double x)
-+{
-+   return __slow_ieee754_sqrt (x);
-+}
-+
- strong_alias (__ieee754_sqrt, __sqrt_finite)
-diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
-index 9d175122a8..10de1f0cc3 100644
---- a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
-@@ -39,10 +39,10 @@ static const float threehalf = 1.5;
- 
- #ifdef __STDC__
- float
--__ieee754_sqrtf (float b)
-+__slow_ieee754_sqrtf (float b)
- #else
- float
--__ieee754_sqrtf (b)
-+__slow_ieee754_sqrtf (b)
-      float b;
- #endif
- {
-@@ -99,4 +99,12 @@ __ieee754_sqrtf (b)
-     }
-   return f_washf (b);
- }
-+
-+#undef __ieee754_sqrtf
-+float
-+__ieee754_sqrtf (float x)
-+{
-+  return __slow_ieee754_sqrtf (x);
-+}
-+
- strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-index fc4a74990e..1c34244bd8 100644
---- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-@@ -132,4 +132,12 @@ __ieee754_sqrt (b)
-     }
-   return f_wash (b);
- }
-+
-+#undef __ieee754_sqrt
-+double
-+__ieee754_sqrt (double x)
-+{
-+   return __slow_ieee754_sqrt (x);
-+}
-+
- strong_alias (__ieee754_sqrt, __sqrt_finite)
-diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
-index 9d175122a8..812653558f 100644
---- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
-@@ -99,4 +99,12 @@ __ieee754_sqrtf (b)
-     }
-   return f_washf (b);
- }
-+
-+#undef __ieee754_sqrtf
-+float
-+__ieee754_sqrtf (float x)
-+{
-+  return __slow_ieee754_sqrtf (x);
-+}
-+
- strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
-index 1795fd6c3e..13a81973e3 100644
---- a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
-@@ -40,7 +40,7 @@ static const float half = 0.5;
-    simultaneously.  */
- 
- double
--__ieee754_sqrt (double b)
-+__slow_ieee754_sqrt (double b)
- {
-   if (__builtin_expect (b > 0, 1))
-     {
-@@ -77,7 +77,7 @@ __ieee754_sqrt (double b)
- 
-           /* Handle small numbers by scaling.  */
-           if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
--            return __ieee754_sqrt (b * two108) * twom54;
-+            return __slow_ieee754_sqrt (b * two108) * twom54;
- 
- #define FMADD(a_, c_, b_)                                               \
-           ({ double __r;                                                \
-@@ -126,4 +126,12 @@ __ieee754_sqrt (double b)
-     }
-   return f_wash (b);
- }
-+
-+#undef __ieee754_sqrt
-+double
-+__ieee754_sqrt (double x)
-+{
-+  return __slow_ieee754_sqrt (x);
-+}
-+
- strong_alias (__ieee754_sqrt, __sqrt_finite)
-diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
-index a917f313ab..fae2d81210 100644
---- a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
-@@ -38,7 +38,7 @@ static const float threehalf = 1.5;
-    square root.  */
- 
- float
--__ieee754_sqrtf (float b)
-+__slow_ieee754_sqrtf (float b)
- {
-   if (__builtin_expect (b > 0, 1))
-     {
-@@ -93,4 +93,11 @@ __ieee754_sqrtf (float b)
-     }
-   return f_washf (b);
- }
-+#undef __ieee754_sqrtf
-+float
-+__ieee754_sqrtf (float x)
-+{
-+  return __slow_ieee754_sqrtf (x);
-+}
-+
- strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
-index fc4a74990e..7038a70b47 100644
---- a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
-@@ -41,10 +41,10 @@ static const float half = 0.5;
- 
- #ifdef __STDC__
- double
--__ieee754_sqrt (double b)
-+__slow_ieee754_sqrt (double b)
- #else
- double
--__ieee754_sqrt (b)
-+__slow_ieee754_sqrt (b)
-      double b;
- #endif
- {
-@@ -83,7 +83,7 @@ __ieee754_sqrt (b)
- 
-           /* Handle small numbers by scaling.  */
-           if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
--            return __ieee754_sqrt (b * two108) * twom54;
-+            return __slow_ieee754_sqrt (b * two108) * twom54;
- 
- #define FMADD(a_, c_, b_)                                               \
-           ({ double __r;                                                \
-@@ -132,4 +132,12 @@ __ieee754_sqrt (b)
-     }
-   return f_wash (b);
- }
-+
-+#undef __ieee754_sqrt
-+double
-+__ieee754_sqrt (double x)
-+{
-+   return __slow_ieee754_sqrt (x);
-+}
-+
- strong_alias (__ieee754_sqrt, __sqrt_finite)
-diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
-index 9d175122a8..10de1f0cc3 100644
---- a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
-@@ -39,10 +39,10 @@ static const float threehalf = 1.5;
- 
- #ifdef __STDC__
- float
--__ieee754_sqrtf (float b)
-+__slow_ieee754_sqrtf (float b)
- #else
- float
--__ieee754_sqrtf (b)
-+__slow_ieee754_sqrtf (b)
-      float b;
- #endif
- {
-@@ -99,4 +99,12 @@ __ieee754_sqrtf (b)
-     }
-   return f_washf (b);
- }
-+
-+#undef __ieee754_sqrtf
-+float
-+__ieee754_sqrtf (float x)
-+{
-+  return __slow_ieee754_sqrtf (x);
-+}
-+
- strong_alias (__ieee754_sqrtf, __sqrtf_finite)

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

@@ -0,0 +1,32 @@
+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
+

+ 4 - 4
recipes-core/glibc/glibc/0020-eglibc-Help-bootstrap-cross-toolchain.patch → recipes-core/glibc/glibc/0011-eglibc-Help-bootstrap-cross-toolchain.patch

@@ -1,4 +1,4 @@
-From 7856684f76c100155cad11b5b236fb31234b6e28 Mon Sep 17 00:00:00 2001
+From 7f2fd574646cb5ecbbc09372a2d8580ab72ec158 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:49:28 +0000
 Date: Wed, 18 Mar 2015 00:49:28 +0000
 Subject: [PATCH] eglibc: Help bootstrap cross toolchain
 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
  create mode 100644 include/stubs-bootstrap.h
 
 
 diff --git a/Makefile b/Makefile
 diff --git a/Makefile b/Makefile
-index f98d5a9e67..c36d04da0f 100644
+index 179dd478ff..55cfb740bf 100644
 --- a/Makefile
 --- a/Makefile
 +++ b/Makefile
 +++ b/Makefile
 @@ -79,9 +79,18 @@ subdir-dirs = include
 @@ -79,9 +79,18 @@ subdir-dirs = include
@@ -52,7 +52,7 @@ index f98d5a9e67..c36d04da0f 100644
  ifeq (yes,$(build-shared))
  ifeq (yes,$(build-shared))
  headers += gnu/lib-names.h
  headers += gnu/lib-names.h
  endif
  endif
-@@ -415,6 +424,16 @@ others: $(common-objpfx)testrun.sh $(common-objpfx)debugglibc.sh
+@@ -421,6 +430,16 @@ others: $(common-objpfx)testrun.sh $(common-objpfx)debugglibc.sh
  
  
  subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
  subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
  
  
@@ -69,7 +69,7 @@ index f98d5a9e67..c36d04da0f 100644
  ifndef abi-variants
  ifndef abi-variants
  installed-stubs = $(inst_includedir)/gnu/stubs.h
  installed-stubs = $(inst_includedir)/gnu/stubs.h
  else
  else
-@@ -441,6 +460,7 @@ $(inst_includedir)/gnu/stubs.h: $(+force)
+@@ -447,6 +466,7 @@ $(inst_includedir)/gnu/stubs.h: $(+force)
  
  
  install-others-nosubdir: $(installed-stubs)
  install-others-nosubdir: $(installed-stubs)
  endif
  endif

+ 0 - 58
recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch

@@ -1,58 +0,0 @@
-From add514edf4299d1bf540d85d0aa0bd5fe0d46b78 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 18 Mar 2015 00:20:09 +0000
-Subject: [PATCH] Quote from bug 1443 which explains what the patch does :
-
-  We build some random program and link it with -lust.  When we run it,
-  it dies with a SIGSEGV before reaching main().
-
-  Libust.so depends on liburcu-bp.so from the usermode-rcu package.
-  Although libust.so is not prelinked, liburcu-bp.so IS prelinked; this
-  is critical.
-
-  Libust.so uses a TLS / __thread variable that is defined in liburcu-
-  bp.so.  There are special ARM-specific relocation types that allow two
-  shared libraries to share thread-specific data.  This is critical too.
-
-  One more critical issue: although liburcu-bp.so is prelinked, we can't
-  load it at its prelinked address, because we also link against
-  librt.so, and librt.so uses that address.
-
-  The dynamic linker is forced to relink liburcu-bp.so at a different
-  address.  In the course of relinking, it processes the special ARM
-  relocation record mentioned above.  The prelinker has already filled
-  in the information, which is a short offset into a table of thread-
-  specific data that is allocated per-thread for each library that uses
-  TLS.  Because the normal behavior of a relocation is to add the symbol
-  value to an addend stored at the address being relocated, we end up
-  adding the short offset to itself, doubling it.
-
-  Now we have an awkward situation.  The libust.so library doesn't know
-  about the addend, so its TLS data for this element is correct.  The
-  liburcu-bp.so library has a different offset for the element.  When we
-  go to initialize the element for the first time in liburcu-bp.so, we
-  write the address of the result at the doubled (broken) offset.
-  Later, when we refer to the address from libust.so, we check the value
-  at the correct offset, but it's NULL, so we eat hot SIGSEGV.
-
-Upstream-Status: Pending
-
-Signed-off-by: Andrei Dinu <andrei.adrianx.dinu@intel.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- sysdeps/arm/dl-machine.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
-index ff5e09e207..d68bfe5cbe 100644
---- a/sysdeps/arm/dl-machine.h
-+++ b/sysdeps/arm/dl-machine.h
-@@ -510,7 +510,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
- 
- 	case R_ARM_TLS_DTPOFF32:
- 	  if (sym != NULL)
--	    *reloc_addr += sym->st_value;
-+	    *reloc_addr = sym->st_value;
- 	  break;
- 
- 	case R_ARM_TLS_TPOFF32:

+ 0 - 49
recipes-core/glibc/glibc/0012-add-hwcap.h-header-file.patch

@@ -1,49 +0,0 @@
-From b20b70ad45a75c817b2320bed6c8f463e230c20e Mon Sep 17 00:00:00 2001
-From: "max.ma" <max.ma@starfivetech.com>
-Date: Mon, 14 Feb 2022 15:40:51 -0800
-Subject: [PATCH 12/12] add hwcap.h header file
-
----
- sysdeps/unix/sysv/linux/riscv/bits/hwcap.h | 30 ++++++++++++++++++++++
- 1 file changed, 30 insertions(+)
- create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/hwcap.h
-
-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..a90e7bb070
---- /dev/null
-+++ b/sysdeps/unix/sysv/linux/riscv/bits/hwcap.h
-@@ -0,0 +1,30 @@
-+/* Defines for bits in AT_HWCAP.  RISC-V 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
-+   <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'))
--- 
-2.33.1
-

+ 2 - 2
recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch → recipes-core/glibc/glibc/0012-eglibc-Resolve-__fpscr_values-on-SH4.patch

@@ -1,4 +1,4 @@
-From 111ab95a85314d1e70fb159a14250354cc69d899 Mon Sep 17 00:00:00 2001
+From 9f1803a2f91d59a9478ca4d8d93e1de5c62671e5 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:55:53 +0000
 Date: Wed, 18 Mar 2015 00:55:53 +0000
 Subject: [PATCH] eglibc: Resolve __fpscr_values on SH4
 Subject: [PATCH] eglibc: Resolve __fpscr_values on SH4
@@ -33,7 +33,7 @@ index 9c734ff755..974e33b4b1 100644
      # a*
      # a*
      alphasort64;
      alphasort64;
 diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.S b/sysdeps/unix/sysv/linux/sh/sysdep.S
 diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.S b/sysdeps/unix/sysv/linux/sh/sysdep.S
-index a18fbb2e8b..59421bfbb0 100644
+index c5e3a7a365..35120031c4 100644
 --- a/sysdeps/unix/sysv/linux/sh/sysdep.S
 --- a/sysdeps/unix/sysv/linux/sh/sysdep.S
 +++ b/sysdeps/unix/sysv/linux/sh/sysdep.S
 +++ b/sysdeps/unix/sysv/linux/sh/sysdep.S
 @@ -30,3 +30,14 @@ ENTRY (__syscall_error)
 @@ -30,3 +30,14 @@ ENTRY (__syscall_error)

+ 30 - 56
recipes-core/glibc/glibc/0010-Revert-RISC-V-Save-and-restore-VCSR-when-doing-user-.patch → recipes-core/glibc/glibc/0012-remove-unnecessary-changes-to-support-v.patch

@@ -1,24 +1,21 @@
-From edd15521391233dec3a1538c1e091881395b277b Mon Sep 17 00:00:00 2001
+From 0df4da2c05981efe9aab12570b68106fca1e801d Mon Sep 17 00:00:00 2001
 From: "max.ma" <max.ma@starfivetech.com>
 From: "max.ma" <max.ma@starfivetech.com>
-Date: Wed, 9 Feb 2022 23:12:18 -0800
-Subject: [PATCH 10/12] Revert "RISC-V: Save and restore VCSR when doing user
- context switch"
+Date: Fri, 7 Oct 2022 22:45:48 -0700
+Subject: [PATCH 12/19] remove unnecessary changes to support v
 
 
-This reverts commit 1c08ed548a24c41542bdb7309e05c1aef70f135d.
 ---
 ---
  sysdeps/riscv/Makefile                       |  5 ---
  sysdeps/riscv/Makefile                       |  5 ---
  sysdeps/riscv/rtld-global-offsets.sym        |  7 ----
  sysdeps/riscv/rtld-global-offsets.sym        |  7 ----
- sysdeps/unix/sysv/linux/riscv/bits/hwcap.h   | 31 ---------------
- sysdeps/unix/sysv/linux/riscv/getcontext.S   | 22 +----------
+ sysdeps/unix/sysv/linux/riscv/getcontext.S   | 24 +-----------
  sysdeps/unix/sysv/linux/riscv/setcontext.S   | 22 -----------
  sysdeps/unix/sysv/linux/riscv/setcontext.S   | 22 -----------
  sysdeps/unix/sysv/linux/riscv/swapcontext.S  | 41 --------------------
  sysdeps/unix/sysv/linux/riscv/swapcontext.S  | 41 --------------------
- sysdeps/unix/sysv/linux/riscv/ucontext_i.sym |  6 ---
- 7 files changed, 1 insertion(+), 133 deletions(-)
+ 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
  delete mode 100644 sysdeps/riscv/rtld-global-offsets.sym
- delete mode 100644 sysdeps/unix/sysv/linux/riscv/bits/hwcap.h
 
 
 diff --git a/sysdeps/riscv/Makefile b/sysdeps/riscv/Makefile
 diff --git a/sysdeps/riscv/Makefile b/sysdeps/riscv/Makefile
-index a5c2106a09..20a9968106 100644
+index e2d84640d4..8fb10b164f 100644
 --- a/sysdeps/riscv/Makefile
 --- a/sysdeps/riscv/Makefile
 +++ b/sysdeps/riscv/Makefile
 +++ b/sysdeps/riscv/Makefile
 @@ -2,11 +2,6 @@ ifeq ($(subdir),misc)
 @@ -2,11 +2,6 @@ ifeq ($(subdir),misc)
@@ -46,45 +43,8 @@ index ff4e97f2a6..0000000000
 -#define rtld_global_ro_offsetof(mem) offsetof (struct rtld_global_ro, mem)
 -#define rtld_global_ro_offsetof(mem) offsetof (struct rtld_global_ro, mem)
 -
 -
 -RTLD_GLOBAL_RO_DL_HWCAP_OFFSET	rtld_global_ro_offsetof (_dl_hwcap)
 -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
-deleted file mode 100644
-index e6c5ef5740..0000000000
---- a/sysdeps/unix/sysv/linux/riscv/bits/hwcap.h
-+++ /dev/null
-@@ -1,31 +0,0 @@
--/* Defines for bits in AT_HWCAP.  RISC-V 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
--   <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/getcontext.S b/sysdeps/unix/sysv/linux/riscv/getcontext.S
 diff --git a/sysdeps/unix/sysv/linux/riscv/getcontext.S b/sysdeps/unix/sysv/linux/riscv/getcontext.S
-index 840d8feca4..d6a9bbca60 100644
+index 371ebd52a7..499f70b65d 100644
 --- a/sysdeps/unix/sysv/linux/riscv/getcontext.S
 --- a/sysdeps/unix/sysv/linux/riscv/getcontext.S
 +++ b/sysdeps/unix/sysv/linux/riscv/getcontext.S
 +++ b/sysdeps/unix/sysv/linux/riscv/getcontext.S
 @@ -16,8 +16,6 @@
 @@ -16,8 +16,6 @@
@@ -126,10 +86,12 @@ index 840d8feca4..d6a9bbca60 100644
  99:	j	__syscall_error
  99:	j	__syscall_error
  
  
  PSEUDO_END (__getcontext)
  PSEUDO_END (__getcontext)
+-weak_alias (__getcontext, getcontext)
+\ No newline at end of file
 +
 +
- weak_alias (__getcontext, getcontext)
++weak_alias (__getcontext, getcontext)
 diff --git a/sysdeps/unix/sysv/linux/riscv/setcontext.S b/sysdeps/unix/sysv/linux/riscv/setcontext.S
 diff --git a/sysdeps/unix/sysv/linux/riscv/setcontext.S b/sysdeps/unix/sysv/linux/riscv/setcontext.S
-index d2404fbe9c..9510518750 100644
+index 423d94df27..e3bc84a2e6 100644
 --- a/sysdeps/unix/sysv/linux/riscv/setcontext.S
 --- a/sysdeps/unix/sysv/linux/riscv/setcontext.S
 +++ b/sysdeps/unix/sysv/linux/riscv/setcontext.S
 +++ b/sysdeps/unix/sysv/linux/riscv/setcontext.S
 @@ -16,8 +16,6 @@
 @@ -16,8 +16,6 @@
@@ -169,7 +131,7 @@ index d2404fbe9c..9510518750 100644
  	   unless makecontext() has been called.  */
  	   unless makecontext() has been called.  */
  	RESTORE_INT_REG     (t1,   0, t0)
  	RESTORE_INT_REG     (t1,   0, t0)
 diff --git a/sysdeps/unix/sysv/linux/riscv/swapcontext.S b/sysdeps/unix/sysv/linux/riscv/swapcontext.S
 diff --git a/sysdeps/unix/sysv/linux/riscv/swapcontext.S b/sysdeps/unix/sysv/linux/riscv/swapcontext.S
-index 94ae8e4bdc..df0f69969c 100644
+index 16600f78df..4da615f6d4 100644
 --- a/sysdeps/unix/sysv/linux/riscv/swapcontext.S
 --- a/sysdeps/unix/sysv/linux/riscv/swapcontext.S
 +++ b/sysdeps/unix/sysv/linux/riscv/swapcontext.S
 +++ b/sysdeps/unix/sysv/linux/riscv/swapcontext.S
 @@ -16,8 +16,6 @@
 @@ -16,8 +16,6 @@
@@ -234,8 +196,21 @@ index 94ae8e4bdc..df0f69969c 100644
  	/* Note the contents of argument registers will be random
  	/* Note the contents of argument registers will be random
  	   unless makecontext() has been called.  */
  	   unless makecontext() has been called.  */
  	RESTORE_INT_REG (t1,   0, t0)
  	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
 diff --git a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
-index 4037473c9a..be55b26310 100644
+index b91945a080..be55b26310 100644
 --- a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
 --- a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
 +++ b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
 +++ b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
 @@ -2,7 +2,6 @@
 @@ -2,7 +2,6 @@
@@ -246,17 +221,16 @@ index 4037473c9a..be55b26310 100644
  
  
  -- Constants used by the rt_sigprocmask call.
  -- Constants used by the rt_sigprocmask call.
  
  
-@@ -28,10 +27,5 @@ STACK_FLAGS			stack (ss_flags)
+@@ -28,9 +27,5 @@ STACK_FLAGS			stack (ss_flags)
  
  
  MCONTEXT_GREGS			mcontext (__gregs)
  MCONTEXT_GREGS			mcontext (__gregs)
  MCONTEXT_FPREGS			mcontext (__fpregs)
  MCONTEXT_FPREGS			mcontext (__fpregs)
 -MCONTEXT_EXTENSION 		mcontext (__reserved)
 -MCONTEXT_EXTENSION 		mcontext (__reserved)
  
  
  UCONTEXT_SIZE			sizeof (ucontext_t)
  UCONTEXT_SIZE			sizeof (ucontext_t)
--
 -VCSR_OFFSET			offsetof (struct __riscv_v_state, vcsr)
 -VCSR_OFFSET			offsetof (struct __riscv_v_state, vcsr)
 -
 -
 -RVV_MAGIC
 -RVV_MAGIC
 -- 
 -- 
-2.33.1
+2.25.1
 
 

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

@@ -1,4 +1,4 @@
-From 4e5de801a39d66b8bd93d09f5912dcbe5db4ef04 Mon Sep 17 00:00:00 2001
+From 2c6449014151a4bcd4b253b2acc920f0b3d6b13f Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 01:33:49 +0000
 Date: Wed, 18 Mar 2015 01:33:49 +0000
 Subject: [PATCH] eglibc: Forward port cross locale generation support
 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
  create mode 100644 locale/catnames.c
 
 
 diff --git a/locale/Makefile b/locale/Makefile
 diff --git a/locale/Makefile b/locale/Makefile
-index b7c60681fa..07c606cde3 100644
+index eb55750496..b0461ac4b9 100644
 --- a/locale/Makefile
 --- a/locale/Makefile
 +++ b/locale/Makefile
 +++ b/locale/Makefile
 @@ -26,7 +26,8 @@ headers		= langinfo.h locale.h bits/locale.h \
 @@ -26,7 +26,8 @@ headers		= langinfo.h locale.h bits/locale.h \
@@ -89,10 +89,10 @@ index 0000000000..538f3f5edb
 +    [LC_ALL] = sizeof ("LC_ALL") - 1
 +    [LC_ALL] = sizeof ("LC_ALL") - 1
 +  };
 +  };
 diff --git a/locale/localeinfo.h b/locale/localeinfo.h
 diff --git a/locale/localeinfo.h b/locale/localeinfo.h
-index 22f9dc1140..fa31b3c5ea 100644
+index 3dc26272a0..b667d32c23 100644
 --- a/locale/localeinfo.h
 --- a/locale/localeinfo.h
 +++ b/locale/localeinfo.h
 +++ b/locale/localeinfo.h
-@@ -230,7 +230,7 @@ __libc_tsd_define (extern, locale_t, LOCALE)
+@@ -246,7 +246,7 @@ __libc_tsd_define (extern, locale_t, LOCALE)
     unused.  We can manage this playing some tricks with weak references.
     unused.  We can manage this playing some tricks with weak references.
     But with thread-local locale settings, it becomes quite ungainly unless
     But with thread-local locale settings, it becomes quite ungainly unless
     we can use __thread variables.  So only in that case do we attempt this.  */
     we can use __thread variables.  So only in that case do we attempt this.  */
@@ -102,7 +102,7 @@ index 22f9dc1140..fa31b3c5ea 100644
  # define NL_CURRENT_INDIRECT	1
  # define NL_CURRENT_INDIRECT	1
  #endif
  #endif
 diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c
 diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c
-index 4841bfd05d..ffcba1fd79 100644
+index 396a0d76c0..91f4a765ee 100644
 --- a/locale/programs/charmap-dir.c
 --- a/locale/programs/charmap-dir.c
 +++ b/locale/programs/charmap-dir.c
 +++ b/locale/programs/charmap-dir.c
 @@ -18,7 +18,9 @@
 @@ -18,7 +18,9 @@
@@ -148,10 +148,10 @@ index 4841bfd05d..ffcba1fd79 100644
    return NULL;
    return NULL;
  }
  }
 diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
 diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
-index b6406b775d..bfa4adba9c 100644
+index 992814491d..da4dde4663 100644
 --- a/locale/programs/ld-collate.c
 --- a/locale/programs/ld-collate.c
 +++ b/locale/programs/ld-collate.c
 +++ b/locale/programs/ld-collate.c
-@@ -349,7 +349,7 @@ new_element (struct locale_collate_t *collate, const char *mbs, size_t mbslen,
+@@ -352,7 +352,7 @@ new_element (struct locale_collate_t *collate, const char *mbs, size_t mbslen,
      }
      }
    if (wcs != NULL)
    if (wcs != NULL)
      {
      {
@@ -160,7 +160,7 @@ index b6406b775d..bfa4adba9c 100644
        uint32_t zero = 0;
        uint32_t zero = 0;
        /* Handle <U0000> as a single character.  */
        /* Handle <U0000> as a single character.  */
        if (nwcs == 0)
        if (nwcs == 0)
-@@ -1775,8 +1775,7 @@ symbol `%s' has the same encoding as"), (*eptr)->name);
+@@ -1776,8 +1776,7 @@ symbol `%s' has the same encoding as"), (*eptr)->name);
  
  
  	      if ((*eptr)->nwcs == runp->nwcs)
  	      if ((*eptr)->nwcs == runp->nwcs)
  		{
  		{
@@ -170,7 +170,7 @@ index b6406b775d..bfa4adba9c 100644
  
  
  		  if (c == 0)
  		  if (c == 0)
  		    {
  		    {
-@@ -2003,9 +2002,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp)
+@@ -2004,9 +2003,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp)
  	     one consecutive entry.  */
  	     one consecutive entry.  */
  	  if (runp->wcnext != NULL
  	  if (runp->wcnext != NULL
  	      && runp->nwcs == runp->wcnext->nwcs
  	      && runp->nwcs == runp->wcnext->nwcs
@@ -183,7 +183,7 @@ index b6406b775d..bfa4adba9c 100644
  	      && (runp->wcs[runp->nwcs - 1]
  	      && (runp->wcs[runp->nwcs - 1]
  		  == runp->wcnext->wcs[runp->nwcs - 1] + 1))
  		  == runp->wcnext->wcs[runp->nwcs - 1] + 1))
  	    {
  	    {
-@@ -2029,9 +2028,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp)
+@@ -2030,9 +2029,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp)
  		runp = runp->wcnext;
  		runp = runp->wcnext;
  	      while (runp->wcnext != NULL
  	      while (runp->wcnext != NULL
  		     && runp->nwcs == runp->wcnext->nwcs
  		     && runp->nwcs == runp->wcnext->nwcs
@@ -197,10 +197,10 @@ index b6406b775d..bfa4adba9c 100644
  			 == runp->wcnext->wcs[runp->nwcs - 1] + 1));
  			 == runp->wcnext->wcs[runp->nwcs - 1] + 1));
  
  
 diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
 diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
-index 2fb579bbbf..d0be99581c 100644
+index c6749dbd82..ac99777925 100644
 --- a/locale/programs/ld-ctype.c
 --- a/locale/programs/ld-ctype.c
 +++ b/locale/programs/ld-ctype.c
 +++ b/locale/programs/ld-ctype.c
-@@ -915,7 +915,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap,
+@@ -914,7 +914,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap,
    allocate_arrays (ctype, charmap, ctype->repertoire);
    allocate_arrays (ctype, charmap, ctype->repertoire);
  
  
    default_missing_len = (ctype->default_missing
    default_missing_len = (ctype->default_missing
@@ -209,7 +209,7 @@ index 2fb579bbbf..d0be99581c 100644
  			 : 0);
  			 : 0);
  
  
    init_locale_data (&file, nelems);
    init_locale_data (&file, nelems);
-@@ -1927,7 +1927,7 @@ read_translit_entry (struct linereader *ldfile, struct locale_ctype_t *ctype,
+@@ -1926,7 +1926,7 @@ read_translit_entry (struct linereader *ldfile, struct locale_ctype_t *ctype,
  	    ignore = 1;
  	    ignore = 1;
  	  else
  	  else
  	    /* This value is usable.  */
  	    /* This value is usable.  */
@@ -218,7 +218,7 @@ index 2fb579bbbf..d0be99581c 100644
  
  
  	  first = 0;
  	  first = 0;
  	}
  	}
-@@ -2461,8 +2461,8 @@ with character code range values one must use the absolute ellipsis `...'"));
+@@ -2460,8 +2460,8 @@ with character code range values one must use the absolute ellipsis `...'"));
  	    }
  	    }
  
  
  	handle_tok_digit:
  	handle_tok_digit:
@@ -229,7 +229,7 @@ index 2fb579bbbf..d0be99581c 100644
  	  handle_digits = 1;
  	  handle_digits = 1;
  	  goto read_charclass;
  	  goto read_charclass;
  
  
-@@ -3904,8 +3904,7 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
+@@ -3876,8 +3876,7 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
  
  
  	  while (idx < number)
  	  while (idx < number)
  	    {
  	    {
@@ -239,7 +239,7 @@ index 2fb579bbbf..d0be99581c 100644
  	      if (res == 0)
  	      if (res == 0)
  		{
  		{
  		  replace = 1;
  		  replace = 1;
-@@ -3942,11 +3941,11 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
+@@ -3914,11 +3913,11 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
        for (size_t cnt = 0; cnt < number; ++cnt)
        for (size_t cnt = 0; cnt < number; ++cnt)
  	{
  	{
  	  struct translit_to_t *srunp;
  	  struct translit_to_t *srunp;
@@ -253,7 +253,7 @@ index 2fb579bbbf..d0be99581c 100644
  	      srunp = srunp->next;
  	      srunp = srunp->next;
  	    }
  	    }
  	  /* Plus one for the extra NUL character marking the end of
  	  /* Plus one for the extra NUL character marking the end of
-@@ -3970,18 +3969,18 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
+@@ -3942,18 +3941,18 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
  	  ctype->translit_from_idx[cnt] = from_len;
  	  ctype->translit_from_idx[cnt] = from_len;
  	  ctype->translit_to_idx[cnt] = to_len;
  	  ctype->translit_to_idx[cnt] = to_len;
  
  
@@ -279,10 +279,10 @@ index 2fb579bbbf..d0be99581c 100644
  	      srunp = srunp->next;
  	      srunp = srunp->next;
  	    }
  	    }
 diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
 diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
-index dcd2a2386d..6814740325 100644
+index b58fecfcee..a4d70e0780 100644
 --- a/locale/programs/ld-time.c
 --- a/locale/programs/ld-time.c
 +++ b/locale/programs/ld-time.c
 +++ b/locale/programs/ld-time.c
-@@ -220,8 +220,10 @@ No definition for %s category found"), "LC_TIME");
+@@ -219,8 +219,10 @@ No definition for %s category found"), "LC_TIME");
  	}
  	}
        else
        else
  	{
  	{
@@ -294,7 +294,7 @@ index dcd2a2386d..6814740325 100644
  	}
  	}
      }
      }
  
  
-@@ -231,7 +233,7 @@ No definition for %s category found"), "LC_TIME");
+@@ -230,7 +232,7 @@ No definition for %s category found"), "LC_TIME");
        const int days_per_month[12] = { 31, 29, 31, 30, 31, 30,
        const int days_per_month[12] = { 31, 29, 31, 30, 31, 30,
  				       31, 31, 30, 31 ,30, 31 };
  				       31, 31, 30, 31 ,30, 31 };
        size_t idx;
        size_t idx;
@@ -303,7 +303,7 @@ index dcd2a2386d..6814740325 100644
  
  
        time->era_entries =
        time->era_entries =
  	(struct era_data *) xmalloc (time->num_era
  	(struct era_data *) xmalloc (time->num_era
-@@ -457,18 +459,18 @@ No definition for %s category found"), "LC_TIME");
+@@ -456,18 +458,18 @@ No definition for %s category found"), "LC_TIME");
  	    }
  	    }
  
  
  	  /* Now generate the wide character name and format.  */
  	  /* Now generate the wide character name and format.  */
@@ -329,7 +329,7 @@ index dcd2a2386d..6814740325 100644
  		}
  		}
  	      else
  	      else
  		time->era_entries[idx].wname =
  		time->era_entries[idx].wname =
-@@ -527,7 +529,16 @@ No definition for %s category found"), "LC_TIME");
+@@ -526,7 +528,16 @@ No definition for %s category found"), "LC_TIME");
    if (time->date_fmt == NULL)
    if (time->date_fmt == NULL)
      time->date_fmt = "%a %b %e %H:%M:%S %Z %Y";
      time->date_fmt = "%a %b %e %H:%M:%S %Z %Y";
    if (time->wdate_fmt == NULL)
    if (time->wdate_fmt == NULL)
@@ -348,23 +348,23 @@ index dcd2a2386d..6814740325 100644
  
  
  
  
 diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
 diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
-index 96d3ab66db..3af379d2c3 100644
+index 0460074a0c..31a7151f66 100644
 --- a/locale/programs/linereader.c
 --- a/locale/programs/linereader.c
 +++ b/locale/programs/linereader.c
 +++ b/locale/programs/linereader.c
-@@ -595,7 +595,7 @@ get_string (struct linereader *lr, const struct charmap_t *charmap,
+@@ -776,7 +776,7 @@ get_string (struct linereader *lr, const struct charmap_t *charmap,
  {
  {
    int return_widestr = lr->return_widestr;
    int return_widestr = lr->return_widestr;
-   char *buf;
+   struct lr_buffer lrb;
 -  wchar_t *buf2 = NULL;
 -  wchar_t *buf2 = NULL;
 +  uint32_t *buf2 = NULL;
 +  uint32_t *buf2 = NULL;
-   size_t bufact;
-   size_t bufmax = 56;
+ 
+   lr_buffer_init (&lrb);
  
  
 diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
 diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
-index 832c8fd1fc..fe689b3ae1 100644
+index 35a092a111..94712bf114 100644
 --- a/locale/programs/localedef.c
 --- a/locale/programs/localedef.c
 +++ b/locale/programs/localedef.c
 +++ b/locale/programs/localedef.c
-@@ -109,6 +109,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
+@@ -108,6 +108,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
  #define OPT_NO_WARN 402
  #define OPT_NO_WARN 402
  #define OPT_WARN 403
  #define OPT_WARN 403
  #define OPT_NO_HARD_LINKS 404
  #define OPT_NO_HARD_LINKS 404
@@ -372,7 +372,7 @@ index 832c8fd1fc..fe689b3ae1 100644
  
  
  /* Definitions of arguments for argp functions.  */
  /* Definitions of arguments for argp functions.  */
  static const struct argp_option options[] =
  static const struct argp_option options[] =
-@@ -153,6 +154,8 @@ static const struct argp_option options[] =
+@@ -152,6 +153,8 @@ static const struct argp_option options[] =
      N_("Generate little-endian output") },
      N_("Generate little-endian output") },
    { "big-endian", OPT_BIG_ENDIAN, NULL, 0,
    { "big-endian", OPT_BIG_ENDIAN, NULL, 0,
      N_("Generate big-endian output") },
      N_("Generate big-endian output") },
@@ -381,7 +381,7 @@ index 832c8fd1fc..fe689b3ae1 100644
    { NULL, 0, NULL, 0, NULL }
    { NULL, 0, NULL, 0, NULL }
  };
  };
  
  
-@@ -243,12 +246,14 @@ main (int argc, char *argv[])
+@@ -242,12 +245,14 @@ main (int argc, char *argv[])
       ctype locale.  (P1003.2 4.35.5.2)  */
       ctype locale.  (P1003.2 4.35.5.2)  */
    setlocale (LC_CTYPE, "POSIX");
    setlocale (LC_CTYPE, "POSIX");
  
  
@@ -396,7 +396,7 @@ index 832c8fd1fc..fe689b3ae1 100644
  
  
    /* Process charmap file.  */
    /* Process charmap file.  */
    charmap = charmap_read (charmap_file, verbose, 1, be_quiet, 1);
    charmap = charmap_read (charmap_file, verbose, 1, be_quiet, 1);
-@@ -400,6 +405,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
+@@ -399,6 +404,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
        /* Do not hard link to other locales.  */
        /* Do not hard link to other locales.  */
        hard_links = false;
        hard_links = false;
        break;
        break;
@@ -407,10 +407,10 @@ index 832c8fd1fc..fe689b3ae1 100644
        force_output = 1;
        force_output = 1;
        break;
        break;
 diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
 diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
-index 0f1affa1d4..7d86fae801 100644
+index 8fa74dce60..8d5aca6d9e 100644
 --- a/locale/programs/locfile.c
 --- a/locale/programs/locfile.c
 +++ b/locale/programs/locfile.c
 +++ b/locale/programs/locfile.c
-@@ -544,6 +544,9 @@ compare_files (const char *filename1, const char *filename2, size_t size,
+@@ -543,6 +543,9 @@ compare_files (const char *filename1, const char *filename2, size_t size,
     machine running localedef.  */
     machine running localedef.  */
  bool swap_endianness_p;
  bool swap_endianness_p;
  
  
@@ -420,7 +420,7 @@ index 0f1affa1d4..7d86fae801 100644
  /* When called outside a start_locale_structure/end_locale_structure
  /* When called outside a start_locale_structure/end_locale_structure
     or start_locale_prelude/end_locale_prelude block, record that the
     or start_locale_prelude/end_locale_prelude block, record that the
     next byte in FILE's obstack will be the first byte of a new element.
     next byte in FILE's obstack will be the first byte of a new element.
-@@ -621,7 +624,7 @@ add_locale_string (struct locale_file *file, const char *string)
+@@ -620,7 +623,7 @@ add_locale_string (struct locale_file *file, const char *string)
  void
  void
  add_locale_wstring (struct locale_file *file, const uint32_t *string)
  add_locale_wstring (struct locale_file *file, const uint32_t *string)
  {
  {
@@ -430,10 +430,10 @@ index 0f1affa1d4..7d86fae801 100644
  
  
  /* Record that FILE's next element is the 32-bit integer VALUE.  */
  /* Record that FILE's next element is the 32-bit integer VALUE.  */
 diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h
 diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h
-index c986d599ec..222a779176 100644
+index 57b2211e2f..e9498c6c7e 100644
 --- a/locale/programs/locfile.h
 --- a/locale/programs/locfile.h
 +++ b/locale/programs/locfile.h
 +++ b/locale/programs/locfile.h
-@@ -71,6 +71,8 @@ extern void write_all_categories (struct localedef_t *definitions,
+@@ -70,6 +70,8 @@ extern void write_all_categories (struct localedef_t *definitions,
  
  
  extern bool swap_endianness_p;
  extern bool swap_endianness_p;
  
  
@@ -442,7 +442,7 @@ index c986d599ec..222a779176 100644
  /* Change the output to be big-endian if BIG_ENDIAN is true and
  /* Change the output to be big-endian if BIG_ENDIAN is true and
     little-endian otherwise.  */
     little-endian otherwise.  */
  static inline void
  static inline void
-@@ -89,7 +91,8 @@ maybe_swap_uint32 (uint32_t value)
+@@ -88,7 +90,8 @@ maybe_swap_uint32 (uint32_t value)
  }
  }
  
  
  /* Likewise, but munge an array of N uint32_ts starting at ARRAY.  */
  /* Likewise, but munge an array of N uint32_ts starting at ARRAY.  */
@@ -452,7 +452,7 @@ index c986d599ec..222a779176 100644
  maybe_swap_uint32_array (uint32_t *array, size_t n)
  maybe_swap_uint32_array (uint32_t *array, size_t n)
  {
  {
    if (swap_endianness_p)
    if (swap_endianness_p)
-@@ -99,7 +102,8 @@ maybe_swap_uint32_array (uint32_t *array, size_t n)
+@@ -98,7 +101,8 @@ maybe_swap_uint32_array (uint32_t *array, size_t n)
  
  
  /* Like maybe_swap_uint32_array, but the array of N elements is at
  /* Like maybe_swap_uint32_array, but the array of N elements is at
     the end of OBSTACK's current object.  */
     the end of OBSTACK's current object.  */
@@ -462,7 +462,7 @@ index c986d599ec..222a779176 100644
  maybe_swap_uint32_obstack (struct obstack *obstack, size_t n)
  maybe_swap_uint32_obstack (struct obstack *obstack, size_t n)
  {
  {
    maybe_swap_uint32_array ((uint32_t *) obstack_next_free (obstack) - n, n);
    maybe_swap_uint32_array ((uint32_t *) obstack_next_free (obstack) - n, n);
-@@ -276,4 +280,55 @@ extern void identification_output (struct localedef_t *locale,
+@@ -275,4 +279,55 @@ extern void identification_output (struct localedef_t *locale,
  				   const struct charmap_t *charmap,
  				   const struct charmap_t *charmap,
  				   const char *output_path);
  				   const char *output_path);
  
  
@@ -519,7 +519,7 @@ index c986d599ec..222a779176 100644
 +
 +
  #endif /* locfile.h */
  #endif /* locfile.h */
 diff --git a/locale/setlocale.c b/locale/setlocale.c
 diff --git a/locale/setlocale.c b/locale/setlocale.c
-index 19ed85ae8e..f28ca11446 100644
+index 56c14d8533..6aac00503e 100644
 --- a/locale/setlocale.c
 --- a/locale/setlocale.c
 +++ b/locale/setlocale.c
 +++ b/locale/setlocale.c
 @@ -63,35 +63,6 @@ static char *const _nl_current_used[] =
 @@ -63,35 +63,6 @@ static char *const _nl_current_used[] =

+ 0 - 33
recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch

@@ -1,33 +0,0 @@
-From c5047b8f7d1a17324cfa02b99f07a70ebcec2cf2 Mon Sep 17 00:00:00 2001
-From: Ting Liu <b28495@freescale.com>
-Date: Wed, 19 Dec 2012 04:39:57 -0600
-Subject: [PATCH] eglibc: run libm-err-tab.pl with specific dirs in ${S}
-
-libm-err-tab.pl will parse all the files named "libm-test-ulps"
-in the given dir recursively. To avoid parsing the one in
-${S}/.pc/ (it does exist after eglibc adds aarch64 support,
-${S}/.pc/aarch64-0001-glibc-fsf-v1-eaf6f205.patch/ports/sysdeps/
-aarch64/libm-test-ulps), run libm-err-tab.pl with specific dirs
-in ${S}.
-
-Upstream-Status: inappropriate [OE specific]
-
-Signed-off-by: Ting Liu <b28495@freescale.com>
----
- manual/Makefile | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/manual/Makefile b/manual/Makefile
-index e83444341e..aa2645bc55 100644
---- a/manual/Makefile
-+++ b/manual/Makefile
-@@ -103,7 +103,8 @@ $(objpfx)stamp-libm-err: $(..)math/gen-libm-test.py \
- 			 $(wildcard $(foreach dir,$(sysdirs),\
- 						  $(dir)/libm-test-ulps))
- 	pwd=`pwd`; \
--	$(PYTHON) $< -s $$pwd/.. -m $(objpfx)libm-err-tmp
-+	$(PYTHON) $< -s $$pwd/../ports -m $(objpfx)libm-err-tmp
-+	$(PYTHON) $< -s $$pwd/../sysdeps -m $(objpfx)libm-err-tmp
- 	$(move-if-change) $(objpfx)libm-err-tmp $(objpfx)libm-err.texi
- 	touch $@
- 

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

@@ -0,0 +1,46 @@
+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 - 58
recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch

@@ -1,58 +0,0 @@
-From 133870f12ba36686dd8df1311fac32a4c5b28579 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 18 Mar 2015 00:24:46 +0000
-Subject: [PATCH] __ieee754_sqrt{,f} are now inline functions and call out
- __slow versions
-
-Upstream-Status: Pending
-
-Signed-off-by: chunrong guo <B40290@freescale.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c  | 6 +++---
- sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c | 4 ++--
- 2 files changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-index 1c34244bd8..7038a70b47 100644
---- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-@@ -41,10 +41,10 @@ static const float half = 0.5;
- 
- #ifdef __STDC__
- double
--__ieee754_sqrt (double b)
-+__slow_ieee754_sqrt (double b)
- #else
- double
--__ieee754_sqrt (b)
-+__slow_ieee754_sqrt (b)
-      double b;
- #endif
- {
-@@ -83,7 +83,7 @@ __ieee754_sqrt (b)
- 
-           /* Handle small numbers by scaling.  */
-           if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
--            return __ieee754_sqrt (b * two108) * twom54;
-+            return __slow_ieee754_sqrt (b * two108) * twom54;
- 
- #define FMADD(a_, c_, b_)                                               \
-           ({ double __r;                                                \
-diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
-index 812653558f..10de1f0cc3 100644
---- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
-@@ -39,10 +39,10 @@ static const float threehalf = 1.5;
- 
- #ifdef __STDC__
- float
--__ieee754_sqrtf (float b)
-+__slow_ieee754_sqrtf (float b)
- #else
- float
--__ieee754_sqrtf (b)
-+__slow_ieee754_sqrtf (b)
-      float b;
- #endif
- {

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

@@ -0,0 +1,53 @@
+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
+

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

@@ -1,4 +1,4 @@
-From 13bc0e53cc91e102472d532f28b3d44c30d291fc Mon Sep 17 00:00:00 2001
+From 8ebf6708ba54147b44f5638b93f123fd55d4c37e Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 3 Aug 2018 09:42:06 -0700
 Date: Fri, 3 Aug 2018 09:42:06 -0700
 Subject: [PATCH] localedef --add-to-archive uses a hard-coded locale path
 Subject: [PATCH] localedef --add-to-archive uses a hard-coded locale path
@@ -18,10 +18,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  1 file changed, 25 insertions(+), 10 deletions(-)
  1 file changed, 25 insertions(+), 10 deletions(-)
 
 
 diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
 diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
-index f38e835c52..8d8f8699b2 100644
+index eeb2fa6ffe..15274b0191 100644
 --- a/locale/programs/locarchive.c
 --- a/locale/programs/locarchive.c
 +++ b/locale/programs/locarchive.c
 +++ b/locale/programs/locarchive.c
-@@ -340,12 +340,24 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
+@@ -339,12 +339,24 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
    struct namehashent *oldnamehashtab;
    struct namehashent *oldnamehashtab;
    struct locarhandle new_ah;
    struct locarhandle new_ah;
    size_t prefix_len = output_prefix ? strlen (output_prefix) : 0;
    size_t prefix_len = output_prefix ? strlen (output_prefix) : 0;
@@ -51,7 +51,7 @@ index f38e835c52..8d8f8699b2 100644
    strcpy (stpcpy (fname, archivefname), ".XXXXXX");
    strcpy (stpcpy (fname, archivefname), ".XXXXXX");
  
  
    /* Not all of the old file has to be mapped.  Change this now this
    /* Not all of the old file has to be mapped.  Change this now this
-@@ -569,10 +581,13 @@ open_archive (struct locarhandle *ah, bool readonly)
+@@ -568,10 +580,13 @@ open_archive (struct locarhandle *ah, bool readonly)
    /* If ah has a non-NULL fname open that otherwise open the default.  */
    /* If ah has a non-NULL fname open that otherwise open the default.  */
    if (archivefname == NULL)
    if (archivefname == NULL)
      {
      {
@@ -69,7 +69,7 @@ index f38e835c52..8d8f8699b2 100644
      }
      }
  
  
    while (1)
    while (1)
-@@ -585,7 +600,7 @@ open_archive (struct locarhandle *ah, bool readonly)
+@@ -584,7 +599,7 @@ open_archive (struct locarhandle *ah, bool readonly)
  	     the default locale archive we ignore the failure and
  	     the default locale archive we ignore the failure and
  	     list an empty archive, otherwise we print an error
  	     list an empty archive, otherwise we print an error
  	     and exit.  */
  	     and exit.  */

+ 4 - 4
recipes-core/glibc/glibc/0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch → recipes-core/glibc/glibc/0015-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch

@@ -1,4 +1,4 @@
-From 3190ada9ecaec915794886a608221655c120f90c Mon Sep 17 00:00:00 2001
+From bd2b87eaa2e99310f5439df95bea12a48dc978bf Mon Sep 17 00:00:00 2001
 From: Martin Jansa <martin.jansa@gmail.com>
 From: Martin Jansa <martin.jansa@gmail.com>
 Date: Mon, 17 Dec 2018 21:36:18 +0000
 Date: Mon, 17 Dec 2018 21:36:18 +0000
 Subject: [PATCH] locale: prevent maybe-uninitialized errors with -Os [BZ
 Subject: [PATCH] locale: prevent maybe-uninitialized errors with -Os [BZ
@@ -33,10 +33,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  1 file changed, 7 insertions(+)
  1 file changed, 7 insertions(+)
 
 
 diff --git a/locale/weight.h b/locale/weight.h
 diff --git a/locale/weight.h b/locale/weight.h
-index 723e1fefda..f5798d379a 100644
+index 8be2d220f8..4a4d5aa6b2 100644
 --- a/locale/weight.h
 --- a/locale/weight.h
 +++ b/locale/weight.h
 +++ b/locale/weight.h
-@@ -28,7 +28,14 @@ findidx (const int32_t *table,
+@@ -27,7 +27,14 @@ findidx (const int32_t *table,
  	 const unsigned char *extra,
  	 const unsigned char *extra,
  	 const unsigned char **cpp, size_t len)
  	 const unsigned char **cpp, size_t len)
  {
  {
@@ -46,7 +46,7 @@ index 723e1fefda..f5798d379a 100644
 +     as described in comments in locale/weightwc.h.  */
 +     as described in comments in locale/weightwc.h.  */
 +  DIAG_PUSH_NEEDS_COMMENT;
 +  DIAG_PUSH_NEEDS_COMMENT;
 +  DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
 +  DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
-   int_fast32_t i = table[*(*cpp)++];
+   int32_t i = table[*(*cpp)++];
 +  DIAG_POP_NEEDS_COMMENT;
 +  DIAG_POP_NEEDS_COMMENT;
    const unsigned char *cp;
    const unsigned char *cp;
    const unsigned char *usrc;
    const unsigned char *usrc;

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

@@ -0,0 +1,980 @@
+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
+

+ 3 - 3
recipes-core/glibc/glibc/0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch → recipes-core/glibc/glibc/0016-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch

@@ -1,4 +1,4 @@
-From 5d201a75918a0e181ee6206f701901fdb91baf81 Mon Sep 17 00:00:00 2001
+From 58dd1336c1c32716f4f0938bf18f2ddfbe9305ca Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:11:22 +0000
 Date: Wed, 18 Mar 2015 00:11:22 +0000
 Subject: [PATCH] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known names
 Subject: [PATCH] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known names
@@ -16,10 +16,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  1 file changed, 1 insertion(+)
  1 file changed, 1 insertion(+)
 
 
 diff --git a/elf/readlib.c b/elf/readlib.c
 diff --git a/elf/readlib.c b/elf/readlib.c
-index 7383c23249..e97ea9449d 100644
+index ed42fbd48e..777f6c80be 100644
 --- a/elf/readlib.c
 --- a/elf/readlib.c
 +++ b/elf/readlib.c
 +++ b/elf/readlib.c
-@@ -51,6 +51,7 @@ static struct known_names interpreters[] =
+@@ -49,6 +49,7 @@ static struct known_names interpreters[] =
  #ifdef SYSDEP_KNOWN_INTERPRETER_NAMES
  #ifdef SYSDEP_KNOWN_INTERPRETER_NAMES
    SYSDEP_KNOWN_INTERPRETER_NAMES
    SYSDEP_KNOWN_INTERPRETER_NAMES
  #endif
  #endif

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

@@ -0,0 +1,675 @@
+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
+

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

@@ -0,0 +1,28 @@
+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
+

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

@@ -1,4 +1,4 @@
-From 60aa53f547911163b42a1c436d695a15c87f34ee Mon Sep 17 00:00:00 2001
+From 93c5b86fae5e42e148e5182466eb0ac26298159c Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 7 Aug 2020 14:31:16 -0700
 Date: Fri, 7 Aug 2020 14:31:16 -0700
 Subject: [PATCH] powerpc: Do not ask compiler for finding arch
 Subject: [PATCH] powerpc: Do not ask compiler for finding arch

+ 0 - 34
recipes-core/glibc/glibc/0017-timezone-re-written-tzselect-as-posix-sh.patch

@@ -1,34 +0,0 @@
-From 2731fa0c7463cd160361a8ac92f3bd7f984d953d Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 18 Mar 2015 00:33:03 +0000
-Subject: [PATCH] timezone: re-written tzselect as posix sh
-
-To avoid the bash dependency.
-
-Upstream-Status: Pending
-
-Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- timezone/tzselect.ksh | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/timezone/tzselect.ksh b/timezone/tzselect.ksh
-index 18fce27e24..7705df83d7 100755
---- a/timezone/tzselect.ksh
-+++ b/timezone/tzselect.ksh
-@@ -1,4 +1,4 @@
--#!/bin/bash
-+#!/bin/sh
- # Ask the user about the time zone, and output the resulting TZ value to stdout.
- # Interact with the user via stderr and stdin.
- 
-@@ -34,7 +34,7 @@ REPORT_BUGS_TO=tz@iana.org
- 
- # Specify default values for environment variables if they are unset.
- : ${AWK=awk}
--: ${TZDIR=`pwd`}
-+: ${TZDIR=$(pwd)}
- 
- # Output one argument as-is to standard output.
- # Safer than 'echo', which can mishandle '\' or leading '-'.

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

@@ -0,0 +1,25 @@
+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
+

+ 8 - 8
recipes-core/glibc/glibc/0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch → recipes-core/glibc/glibc/0018-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch

@@ -1,4 +1,4 @@
-From baba3c6021340a9070b734f931a15cea4cfe6c31 Mon Sep 17 00:00:00 2001
+From e2dba281429384cc22a73a58eaf79459e64be266 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 15 May 2020 17:05:45 -0700
 Date: Fri, 15 May 2020 17:05:45 -0700
 Subject: [PATCH] wordsize.h: Unify the header between arm and aarch64
 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>
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
 ---
 ---
- sysdeps/aarch64/bits/wordsize.h          |  8 ++++++--
- sysdeps/{aarch64 => arm}/bits/wordsize.h | 10 +++++++---
- 2 files changed, 13 insertions(+), 5 deletions(-)
- copy sysdeps/{aarch64 => arm}/bits/wordsize.h (80%)
+ 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%)
 
 
 diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
 diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
-index 91da566b74..9a754514b3 100644
+index 4635431f0e..5ef0ed21f3 100644
 --- a/sysdeps/aarch64/bits/wordsize.h
 --- a/sysdeps/aarch64/bits/wordsize.h
 +++ b/sysdeps/aarch64/bits/wordsize.h
 +++ b/sysdeps/aarch64/bits/wordsize.h
 @@ -17,12 +17,16 @@
 @@ -17,12 +17,16 @@
@@ -40,10 +40,10 @@ index 91da566b74..9a754514b3 100644
  
  
  #define __WORDSIZE_TIME64_COMPAT32	0
  #define __WORDSIZE_TIME64_COMPAT32	0
 diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/arm/bits/wordsize.h
 diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/arm/bits/wordsize.h
-similarity index 80%
+similarity index 85%
 copy from sysdeps/aarch64/bits/wordsize.h
 copy from sysdeps/aarch64/bits/wordsize.h
 copy to sysdeps/arm/bits/wordsize.h
 copy to sysdeps/arm/bits/wordsize.h
-index 91da566b74..34fcdef1f1 100644
+index 4635431f0e..5ef0ed21f3 100644
 --- a/sysdeps/aarch64/bits/wordsize.h
 --- a/sysdeps/aarch64/bits/wordsize.h
 +++ b/sysdeps/arm/bits/wordsize.h
 +++ b/sysdeps/arm/bits/wordsize.h
 @@ -17,12 +17,16 @@
 @@ -17,12 +17,16 @@

+ 26 - 19
recipes-core/glibc/glibc/0018-Remove-bash-dependency-for-nscd-init-script.patch → recipes-core/glibc/glibc/0019-Replace-echo-with-printf-builtin-in-nscd-init-script.patch

@@ -1,21 +1,22 @@
-From 412d33bbfe42a10a9b1f62afcc73fe121a0363b0 Mon Sep 17 00:00:00 2001
+From 97a71e1dd07ba6721464150b03fd67823b6271e2 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 From: Khem Raj <raj.khem@gmail.com>
 Date: Thu, 31 Dec 2015 14:33:02 -0800
 Date: Thu, 31 Dec 2015 14:33:02 -0800
-Subject: [PATCH] Remove bash dependency for nscd init script
+Subject: [PATCH] Replace echo with printf builtin in nscd init script
 
 
-The nscd init script uses #! /bin/bash but only really uses one bashism
-(translated strings), so remove them and switch the shell to #!/bin/sh.
+The nscd init script calls for #! /bin/bash interpreter
+since it uses bash specific extentions namely (translated strings)
+and echo -n command, replace echo with printf and
+switch the shell interpreter to #!/bin/sh.
 
 
 Upstream-Status: Pending
 Upstream-Status: Pending
-
-Signed-off-by: Ross Burton <ross.burton@intel.com>
+Signed-off-by: Ross Burton <ross.burton@arm.com>
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
 ---
 ---
- nscd/nscd.init | 14 +++++++-------
- 1 file changed, 7 insertions(+), 7 deletions(-)
+ nscd/nscd.init | 20 ++++++++++----------
+ 1 file changed, 10 insertions(+), 10 deletions(-)
 
 
 diff --git a/nscd/nscd.init b/nscd/nscd.init
 diff --git a/nscd/nscd.init b/nscd/nscd.init
-index a882da7d8b..b02986ec15 100644
+index a882da7d8b..857b541381 100644
 --- a/nscd/nscd.init
 --- a/nscd/nscd.init
 +++ b/nscd/nscd.init
 +++ b/nscd/nscd.init
 @@ -1,4 +1,4 @@
 @@ -1,4 +1,4 @@
@@ -24,25 +25,27 @@ index a882da7d8b..b02986ec15 100644
  #
  #
  # nscd:		Starts the Name Switch Cache Daemon
  # nscd:		Starts the Name Switch Cache Daemon
  #
  #
-@@ -49,7 +49,7 @@ prog=nscd
+@@ -49,16 +49,16 @@ prog=nscd
  start () {
  start () {
      [ -d /var/run/nscd ] || mkdir /var/run/nscd
      [ -d /var/run/nscd ] || mkdir /var/run/nscd
      [ -d /var/db/nscd ] || mkdir /var/db/nscd
      [ -d /var/db/nscd ] || mkdir /var/db/nscd
 -    echo -n $"Starting $prog: "
 -    echo -n $"Starting $prog: "
-+    echo -n "Starting $prog: "
++    printf "Starting $prog: "
      daemon /usr/sbin/nscd
      daemon /usr/sbin/nscd
      RETVAL=$?
      RETVAL=$?
-     echo
-@@ -58,7 +58,7 @@ start () {
+-    echo
++    printf "\n"
+     [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd
+     return $RETVAL
  }
  }
  
  
  stop () {
  stop () {
 -    echo -n $"Stopping $prog: "
 -    echo -n $"Stopping $prog: "
-+    echo -n "Stopping $prog: "
++    printf "Stopping $prog: "
      /usr/sbin/nscd -K
      /usr/sbin/nscd -K
      RETVAL=$?
      RETVAL=$?
      if [ $RETVAL -eq 0 ]; then
      if [ $RETVAL -eq 0 ]; then
-@@ -67,9 +67,9 @@ stop () {
+@@ -67,11 +67,11 @@ stop () {
  	# a non-privileged user
  	# a non-privileged user
  	rm -f /var/run/nscd/nscd.pid
  	rm -f /var/run/nscd/nscd.pid
  	rm -f /var/run/nscd/socket
  	rm -f /var/run/nscd/socket
@@ -52,21 +55,25 @@ index a882da7d8b..b02986ec15 100644
 -       	failure $"$prog shutdown"
 -       	failure $"$prog shutdown"
 +	failure "$prog shutdown"
 +	failure "$prog shutdown"
      fi
      fi
-     echo
+-    echo
++    printf "\n"
      return $RETVAL
      return $RETVAL
+ }
+ 
 @@ -103,13 +103,13 @@ case "$1" in
 @@ -103,13 +103,13 @@ case "$1" in
  	RETVAL=$?
  	RETVAL=$?
  	;;
  	;;
      force-reload | reload)
      force-reload | reload)
 -    	echo -n $"Reloading $prog: "
 -    	echo -n $"Reloading $prog: "
-+	echo -n "Reloading $prog: "
++	printf "Reloading $prog: "
  	killproc /usr/sbin/nscd -HUP
  	killproc /usr/sbin/nscd -HUP
  	RETVAL=$?
  	RETVAL=$?
- 	echo
+-	echo
++	printf "\n"
  	;;
  	;;
      *)
      *)
 -	echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
 -	echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
-+	echo "Usage: $0 {start|stop|status|restart|reload|condrestart}"
++	printf "Usage: $0 {start|stop|status|restart|reload|condrestart}\n"
  	RETVAL=1
  	RETVAL=1
  	;;
  	;;
  esac
  esac

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

@@ -0,0 +1,123 @@
+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
+

+ 9 - 8
recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch → recipes-core/glibc/glibc/0020-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch

@@ -1,11 +1,12 @@
-From b4613f814ba7ba5db95d18116172f81a83ac8f5b Mon Sep 17 00:00:00 2001
+From 3b5b6079512af8af50d0a43d4c1c218f5ba1b302 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:27:10 +0000
 Date: Wed, 18 Mar 2015 00:27:10 +0000
-Subject: [PATCH] sysdeps/gnu/configure.ac: handle correctly
- $libc_cv_rootsbindir
+Subject: [PATCH] sysdeps/gnu/configure.ac: Set libc_cv_rootsbindir only if its
+ empty
 
 
-Upstream-Status:Pending
+This ensures that it can be set in build environment
 
 
+Upstream-Status: Pending
 Signed-off-by: Matthieu Crapet <Matthieu.Crapet@ingenico.com>
 Signed-off-by: Matthieu Crapet <Matthieu.Crapet@ingenico.com>
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
 ---
 ---
@@ -14,7 +15,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  2 files changed, 2 insertions(+), 2 deletions(-)
  2 files changed, 2 insertions(+), 2 deletions(-)
 
 
 diff --git a/sysdeps/gnu/configure b/sysdeps/gnu/configure
 diff --git a/sysdeps/gnu/configure b/sysdeps/gnu/configure
-index c15d1087e8..37cc983f2a 100644
+index c15d1087e8..d30d6e37ae 100644
 --- a/sysdeps/gnu/configure
 --- a/sysdeps/gnu/configure
 +++ b/sysdeps/gnu/configure
 +++ b/sysdeps/gnu/configure
 @@ -32,6 +32,6 @@ case "$prefix" in
 @@ -32,6 +32,6 @@ case "$prefix" in
@@ -22,11 +23,11 @@ index c15d1087e8..37cc983f2a 100644
      libc_cv_localstatedir=$localstatedir
      libc_cv_localstatedir=$localstatedir
     fi
     fi
 -  libc_cv_rootsbindir=/sbin
 -  libc_cv_rootsbindir=/sbin
-+  test -n "$libc_cv_rootsbindir" || libc_cv_rootsbindir=/sbin
++  libc_cv_rootsbindir=${libc_cv_rootsbindir:=/sbin}
    ;;
    ;;
  esac
  esac
 diff --git a/sysdeps/gnu/configure.ac b/sysdeps/gnu/configure.ac
 diff --git a/sysdeps/gnu/configure.ac b/sysdeps/gnu/configure.ac
-index 634fe4de2a..3db1697f4f 100644
+index 634fe4de2a..492112e0fd 100644
 --- a/sysdeps/gnu/configure.ac
 --- a/sysdeps/gnu/configure.ac
 +++ b/sysdeps/gnu/configure.ac
 +++ b/sysdeps/gnu/configure.ac
 @@ -21,6 +21,6 @@ case "$prefix" in
 @@ -21,6 +21,6 @@ case "$prefix" in
@@ -34,6 +35,6 @@ index 634fe4de2a..3db1697f4f 100644
      libc_cv_localstatedir=$localstatedir
      libc_cv_localstatedir=$localstatedir
     fi
     fi
 -  libc_cv_rootsbindir=/sbin
 -  libc_cv_rootsbindir=/sbin
-+  test -n "$libc_cv_rootsbindir" || libc_cv_rootsbindir=/sbin
++  libc_cv_rootsbindir=${libc_cv_rootsbindir:=/sbin}
    ;;
    ;;
  esac
  esac

+ 47 - 0
recipes-core/glibc/glibc/0021-timezone-Make-shell-interpreter-overridable-in-tzsel.patch

@@ -0,0 +1,47 @@
+From 8d5ff7357354394b958321204b75e3855781aefe 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
+
+define new macro called KSHELL which can be used to define default shell
+use Bash by default
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Makeconfig        | 9 +++++++++
+ timezone/Makefile | 1 +
+ 2 files changed, 10 insertions(+)
+
+diff --git a/Makeconfig b/Makeconfig
+index ba70321af1..4b643768d9 100644
+--- a/Makeconfig
++++ b/Makeconfig
+@@ -293,6 +293,15 @@ ifndef sysincludedir
+ sysincludedir = /usr/include
+ endif
+ 
++# The full path name of a Posix-compliant shell, preferably one that supports
++# the Korn shell's 'select' statement as an extension.
++# These days, Bash is the most popular.
++# It should be OK to set this to /bin/sh, on platforms where /bin/sh
++# lacks 'select' or doesn't completely conform to Posix, but /bin/bash
++# is typically nicer if it works.
++ifndef KSHELL
++KSHELL = /bin/bash
++endif
+ 
+ # Commands to install files.
+ ifndef INSTALL_DATA
+diff --git a/timezone/Makefile b/timezone/Makefile
+index a789c22d26..3e69409a94 100644
+--- a/timezone/Makefile
++++ b/timezone/Makefile
+@@ -134,6 +134,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)"|' \
++	    -e 's|#!/bin/bash|#!$(KSHELL)|g' \
+ 	    < $< > $@.new
+ 	chmod 555 $@.new
+ 	mv -f $@.new $@

+ 27 - 0
recipes-core/glibc/glibc/0022-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch

@@ -0,0 +1,27 @@
+From ba1365f19ccc8378f2fcff892721187537479884 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
+
+checkbashism reports no issues with tzselect.ksh, therefore using
+/bin/sh instead of /bin/bash should be safe and portable across systems
+which don't ship bash ( embedded systems )
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org>
+Cc: Paul Eggert <eggert@cs.ucla.edu>
+---
+ timezone/tzselect.ksh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/timezone/tzselect.ksh b/timezone/tzselect.ksh
+index 18fce27e24..cc08efb0fb 100755
+--- a/timezone/tzselect.ksh
++++ b/timezone/tzselect.ksh
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ # Ask the user about the time zone, and output the resulting TZ value to stdout.
+ # Interact with the user via stderr and stdin.
+ 

+ 13 - 6
recipes-core/glibc/glibc/0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch → recipes-core/glibc/glibc/0023-fix-create-thread-failed-in-unprivileged-process-BZ-.patch

@@ -1,4 +1,4 @@
-From a8bc44936202692edcd82a48c07d7cf27d6ed8ee Mon Sep 17 00:00:00 2001
+From ffbb37732807e180b14a21d1bf79ad5038252c02 Mon Sep 17 00:00:00 2001
 From: Hongxu Jia <hongxu.jia@windriver.com>
 From: Hongxu Jia <hongxu.jia@windriver.com>
 Date: Sun, 29 Aug 2021 20:49:16 +0800
 Date: Sun, 29 Aug 2021 20:49:16 +0800
 Subject: [PATCH] fix create thread failed in unprivileged process [BZ #28287]
 Subject: [PATCH] fix create thread failed in unprivileged process [BZ #28287]
@@ -54,15 +54,25 @@ $ ./conftest
 start thread: check_me 42
 start thread: check_me 42
 check_me 42, p 0x7ffe253c6f20
 check_me 42, p 0x7ffe253c6f20
 
 
-Upstream-Status: Submitted [libc-alpha@sourceware.org]
+Upstream-Status: Inappropriate [Rejected by upstream]
+
+Upstream glibc rejected it because the latest docker has resolved the issue [1],
+and upstream glibc does not backward compatibility with old docker[2]
+
+In order to build Yocto with uninative in old docker, we need this local
+patch
+
+[1] https://github.com/moby/moby/commit/9f6b562dd12ef7b1f9e2f8e6f2ab6477790a6594
+[2] https://sourceware.org/pipermail/libc-alpha/2021-August/130590.html
 
 
 Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
 Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
 ---
 ---
  sysdeps/unix/sysv/linux/clone-internal.c | 2 +-
  sysdeps/unix/sysv/linux/clone-internal.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
  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
 diff --git a/sysdeps/unix/sysv/linux/clone-internal.c b/sysdeps/unix/sysv/linux/clone-internal.c
-index 979f7880be..97101994e8 100644
+index a71effcbd3..a0569113aa 100644
 --- a/sysdeps/unix/sysv/linux/clone-internal.c
 --- a/sysdeps/unix/sysv/linux/clone-internal.c
 +++ b/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,
 @@ -52,7 +52,7 @@ __clone_internal (struct clone_args *cl_args,
@@ -74,6 +84,3 @@ index 979f7880be..97101994e8 100644
      return ret;
      return ret;
  
  
    /* NB: Restore errno since errno may be checked against non-zero
    /* NB: Restore errno since errno may be checked against non-zero
--- 
-2.30.2
-

+ 32 - 0
recipes-core/glibc/glibc/0024-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch

@@ -0,0 +1,32 @@
+From f873e25e29684cbbf7b141d9c6ee725268505c29 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
+
+replace the compile definitions with the output locations.
+
+Upstream-Status: Inappropriate [would need reworking somehow to be acceptable upstream]
+
+Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ support/Makefile | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/support/Makefile b/support/Makefile
+index 9b50eac117..4c24d9f61a 100644
+--- a/support/Makefile
++++ b/support/Makefile
+@@ -218,9 +218,9 @@ libsupport-inhibit-o += .o
+ endif
+ 
+ CFLAGS-support_paths.c = \
+-		-DSRCDIR_PATH=\"`cd .. ; pwd`\" \
+-		-DOBJDIR_PATH=\"`cd $(objpfx)/..; pwd`\" \
+-		-DOBJDIR_ELF_LDSO_PATH=\"`cd $(objpfx)/..; pwd`/elf/$(rtld-installed-name)\" \
++		-DSRCDIR_PATH=\"$(oe_srcdir)\" \
++		-DOBJDIR_PATH=\"$(libdir)/glibc-tests/ptest/tests/glibc-ptest\" \
++		-DOBJDIR_ELF_LDSO_PATH=\"$(slibdir)/$(rtld-installed-name)\" \
+ 		-DINSTDIR_PATH=\"$(prefix)\" \
+ 		-DLIBDIR_PATH=\"$(libdir)\" \
+ 		-DBINDIR_PATH=\"$(bindir)\" \

+ 0 - 53
recipes-core/glibc/glibc/0025-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch

@@ -1,53 +0,0 @@
-From 50b605dece16606dd9d1c737e579c13725eab11d Mon Sep 17 00:00:00 2001
-From: Mark Hatle <mark.hatle@windriver.com>
-Date: Thu, 18 Aug 2016 14:07:58 -0500
-Subject: [PATCH] elf/dl-deps.c: Make _dl_build_local_scope breadth first
-
-According to the ELF specification:
-
-When resolving symbolic references, the dynamic linker examines the symbol
-tables with a breadth-first search.
-
-This function was using a depth first search.  By doing so the conflict
-resolution reported to the prelinker (when LD_TRACE_PRELINKING=1 is set)
-was incorrect.  This caused problems when their were various circular
-dependencies between libraries.  The problem usually manifested itself by
-the wrong IFUNC being executed.
-
-[BZ# 20488]
-
-Upstream-Status: Submitted [libc-alpha]
-
-Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
----
- elf/dl-deps.c | 14 ++++++++++----
- 1 file changed, 10 insertions(+), 4 deletions(-)
-
-diff --git a/elf/dl-deps.c b/elf/dl-deps.c
-index 087a49b212..c09f9334f2 100644
---- a/elf/dl-deps.c
-+++ b/elf/dl-deps.c
-@@ -73,13 +73,19 @@ _dl_build_local_scope (struct link_map **list, struct link_map *map)
- {
-   struct link_map **p = list;
-   struct link_map **q;
-+  struct link_map **r;
- 
-   *p++ = map;
-   map->l_reserved = 1;
--  if (map->l_initfini)
--    for (q = map->l_initfini + 1; *q; ++q)
--      if (! (*q)->l_reserved)
--	p += _dl_build_local_scope (p, *q);
-+
-+  for (r = list; r < p; ++r)
-+    if ((*r)->l_initfini)
-+      for (q = (*r)->l_initfini + 1; *q; ++q)
-+	if (! (*q)->l_reserved)
-+	  {
-+	    *p++ = *q;
-+	    (*q)->l_reserved = 1;
-+	  }
-   return p - list;
- }
- 

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

@@ -0,0 +1,28 @@
+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 - 31
recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch

@@ -1,31 +0,0 @@
-From 99ab34278a6ebec134267412b4f619f43e278dea Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 3 Aug 2018 09:44:00 -0700
-Subject: [PATCH] intl: Emit no lines in bison generated files
-
-Improve reproducibility:
-Do not put any #line preprocessor commands in bison generated files.
-These lines contain absolute paths containing file locations on
-the host build machine.
-
-Upstream-Status: Pending
-
-Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- intl/Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/intl/Makefile b/intl/Makefile
-index 93478d87e8..b27a7935eb 100644
---- a/intl/Makefile
-+++ b/intl/Makefile
-@@ -155,7 +155,7 @@ $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out
- 
- CPPFLAGS += -D'LOCALEDIR="$(localedir)"' \
- 	    -D'LOCALE_ALIAS_PATH="$(localedir)"'
--BISONFLAGS = --yacc --name-prefix=__gettext --output
-+BISONFLAGS = --yacc --no-lines --name-prefix=__gettext --output
- 
- $(inst_localedir)/locale.alias: locale.alias $(+force)
- 	$(do-install)

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

@@ -0,0 +1,490 @@
+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)

+ 0 - 184
recipes-core/glibc/glibc/CVE-2021-43396.patch

@@ -1,184 +0,0 @@
-From ff012870b2c02a62598c04daa1e54632e020fd7d Mon Sep 17 00:00:00 2001
-From: Nikita Popov <npv1310@gmail.com>
-Date: Tue, 2 Nov 2021 13:21:42 +0500
-Subject: [PATCH] gconv: Do not emit spurious NUL character in ISO-2022-JP-3
- (bug 28524)
-
-Bugfix 27256 has introduced another issue:
-In conversion from ISO-2022-JP-3 encoding, it is possible
-to force iconv to emit extra NUL character on internal state reset.
-To do this, it is sufficient to feed iconv with escape sequence
-which switches active character set.
-The simplified check 'data->__statep->__count != ASCII_set'
-introduced by the aforementioned bugfix picks that case and
-behaves as if '\0' character has been queued thus emitting it.
-
-To eliminate this issue, these steps are taken:
-* Restore original condition
-'(data->__statep->__count & ~7) != ASCII_set'.
-It is necessary since bits 0-2 may contain
-number of buffered input characters.
-* Check that queued character is not NUL.
-Similar step is taken for main conversion loop.
-
-Bundled test case follows following logic:
-* Try to convert ISO-2022-JP-3 escape sequence
-switching active character set
-* Reset internal state by providing NULL as input buffer
-* Ensure that nothing has been converted.
-
-Signed-off-by: Nikita Popov <npv1310@gmail.com>
-
-CVE: CVE-2021-43396
-Upstream-Status: Backport [ff012870b2c02a62598c04daa1e54632e020fd7d]
----
- iconvdata/Makefile        |  5 +++-
- iconvdata/bug-iconv15.c   | 60 +++++++++++++++++++++++++++++++++++++++
- iconvdata/iso-2022-jp-3.c | 28 ++++++++++++------
- 3 files changed, 84 insertions(+), 9 deletions(-)
- create mode 100644 iconvdata/bug-iconv15.c
-
-Index: git/iconvdata/Makefile
-===================================================================
---- git.orig/iconvdata/Makefile
-+++ git/iconvdata/Makefile
-@@ -1,4 +1,5 @@
- # Copyright (C) 1997-2021 Free Software Foundation, Inc.
-+# Copyright (C) The GNU Toolchain Authors.
- # This file is part of the GNU C Library.
- 
- # The GNU C Library is free software; you can redistribute it and/or
-@@ -74,7 +75,7 @@ ifeq (yes,$(build-shared))
- tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
- 	tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9 \
- 	bug-iconv10 bug-iconv11 bug-iconv12 tst-iconv-big5-hkscs-to-2ucs4 \
--	bug-iconv13 bug-iconv14
-+	bug-iconv13 bug-iconv14 bug-iconv15
- ifeq ($(have-thread-library),yes)
- tests += bug-iconv3
- endif
-@@ -327,6 +328,8 @@ $(objpfx)bug-iconv12.out: $(addprefix $(
- 			  $(addprefix $(objpfx),$(modules.so))
- $(objpfx)bug-iconv14.out: $(addprefix $(objpfx), $(gconv-modules)) \
- 			  $(addprefix $(objpfx),$(modules.so))
-+$(objpfx)bug-iconv15.out: $(addprefix $(objpfx), $(gconv-modules)) \
-+			  $(addprefix $(objpfx),$(modules.so))
- 
- $(objpfx)iconv-test.out: run-iconv-test.sh \
- 			 $(addprefix $(objpfx), $(gconv-modules)) \
-Index: git/iconvdata/bug-iconv15.c
-===================================================================
---- /dev/null
-+++ git/iconvdata/bug-iconv15.c
-@@ -0,0 +1,60 @@
-+/* Bug 28524: Conversion from ISO-2022-JP-3 with iconv
-+   may emit spurious NUL character on state reset.
-+   Copyright (C) The GNU Toolchain Authors.
-+   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 <stddef.h>
-+#include <iconv.h>
-+#include <support/check.h>
-+
-+static int
-+do_test (void)
-+{
-+  char in[] = "\x1b(I";
-+  char *inbuf = in;
-+  size_t inleft = sizeof (in) - 1;
-+  char out[1];
-+  char *outbuf = out;
-+  size_t outleft = sizeof (out);
-+  iconv_t cd;
-+
-+  cd = iconv_open ("UTF8", "ISO-2022-JP-3");
-+  TEST_VERIFY_EXIT (cd != (iconv_t) -1);
-+
-+  /* First call to iconv should alter internal state.
-+     Now, JISX0201_Kana_set is selected and
-+     state value != ASCII_set.  */
-+  TEST_VERIFY (iconv (cd, &inbuf, &inleft, &outbuf, &outleft) != (size_t) -1);
-+
-+  /* No bytes should have been added to
-+     the output buffer at this point.  */
-+  TEST_VERIFY (outbuf == out);
-+  TEST_VERIFY (outleft == sizeof (out));
-+
-+  /* Second call shall emit spurious NUL character in unpatched glibc.  */
-+  TEST_VERIFY (iconv (cd, NULL, NULL, &outbuf, &outleft) != (size_t) -1);
-+
-+  /* No characters are expected to be produced.  */
-+  TEST_VERIFY (outbuf == out);
-+  TEST_VERIFY (outleft == sizeof (out));
-+
-+  TEST_VERIFY_EXIT (iconv_close (cd) != -1);
-+
-+  return 0;
-+}
-+
-+#include <support/test-driver.c>
-Index: git/iconvdata/iso-2022-jp-3.c
-===================================================================
---- git.orig/iconvdata/iso-2022-jp-3.c
-+++ git/iconvdata/iso-2022-jp-3.c
-@@ -1,5 +1,6 @@
- /* Conversion module for ISO-2022-JP-3.
-    Copyright (C) 1998-2021 Free Software Foundation, Inc.
-+   Copyright (C) The GNU Toolchain Authors.
-    This file is part of the GNU C Library.
-    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998,
-    and Bruno Haible <bruno@clisp.org>, 2002.
-@@ -81,20 +82,31 @@ enum
-    the output state to the initial state.  This has to be done during the
-    flushing.  */
- #define EMIT_SHIFT_TO_INIT \
--  if (data->__statep->__count != ASCII_set)			      \
-+  if ((data->__statep->__count & ~7) != ASCII_set)			      \
-     {									      \
-       if (FROM_DIRECTION)						      \
- 	{								      \
--	  if (__glibc_likely (outbuf + 4 <= outend))			      \
-+	  uint32_t ch = data->__statep->__count >> 6;			      \
-+									      \
-+	  if (__glibc_unlikely (ch != 0))				      \
- 	    {								      \
--	      /* Write out the last character.  */			      \
--	      *((uint32_t *) outbuf) = data->__statep->__count >> 6;	      \
--	      outbuf += sizeof (uint32_t);				      \
--	      data->__statep->__count = ASCII_set;			\
-+	      if (__glibc_likely (outbuf + 4 <= outend))		      \
-+		{							      \
-+		  /* Write out the last character.  */			      \
-+		  put32u (outbuf, ch);					      \
-+		  outbuf += 4;						      \
-+		  data->__statep->__count &= 7;				      \
-+		  data->__statep->__count |= ASCII_set;			      \
-+		}							      \
-+	      else							      \
-+		/* We don't have enough room in the output buffer.  */	      \
-+		status = __GCONV_FULL_OUTPUT;				      \
- 	    }								      \
- 	  else								      \
--	    /* We don't have enough room in the output buffer.  */	      \
--	    status = __GCONV_FULL_OUTPUT;				      \
-+	    {								      \
-+	      data->__statep->__count &= 7;				      \
-+	      data->__statep->__count |= ASCII_set;			      \
-+	    }								      \
- 	}								      \
-       else								      \
- 	{								      \

+ 37 - 0
recipes-core/glibc/glibc/run-ptest

@@ -0,0 +1,37 @@
+#!/bin/sh
+# ptest script for glibc - to run time related tests to
+# facilitate Y2038 validation
+# Run with 'ptest-runner glibc-tests'
+
+output() {
+  retcode=$?
+  if [ $retcode -eq 0 ]
+    then echo "PASS: $i"
+  elif [ $retcode -eq 77 ]
+    then echo "SKIP: $i"
+  else echo "FAIL: $i"
+  fi
+}
+
+# Allow altering time on the target
+export GLIBC_TEST_ALLOW_TIME_SETTING="1"
+
+tst_time64=$(ls -r ${PWD}/tests/glibc-ptest/*-time64)
+
+# Remove '-time64' suffix - those tests are also time
+# 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
+
+# Run tests supporting only 64 bit time
+for i in ${tst_time64}
+do
+	$i >/dev/null 2>&1
+	output
+done

+ 44 - 39
recipes-core/glibc/glibc_2.35.bb → recipes-core/glibc/glibc_2.36.bb

@@ -16,7 +16,10 @@ CVE_CHECK_IGNORE += "CVE-2019-1010022 CVE-2019-1010023 CVE-2019-1010024"
 # Potential patch at https://sourceware.org/bugzilla/show_bug.cgi?id=22853
 # Potential patch at https://sourceware.org/bugzilla/show_bug.cgi?id=22853
 CVE_CHECK_IGNORE += "CVE-2019-1010025"
 CVE_CHECK_IGNORE += "CVE-2019-1010025"
 
 
-DEPENDS += "gperf-native bison-native make-native"
+# This has been integrated into the 2.36 branch as of c399271 so is now fixed
+CVE_CHECK_IGNORE += "CVE-2022-39046"
+
+DEPENDS += "gperf-native bison-native"
 
 
 NATIVESDKFIXES ?= ""
 NATIVESDKFIXES ?= ""
 NATIVESDKFIXES:class-nativesdk = "\
 NATIVESDKFIXES:class-nativesdk = "\
@@ -26,50 +29,52 @@ NATIVESDKFIXES:class-nativesdk = "\
            file://0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch \
            file://0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch \
            file://0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch \
            file://0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch \
            file://0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.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 \
 SRC_URI =  "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
            file://etc/ld.so.conf \
            file://etc/ld.so.conf \
            file://generate-supported.mk \
            file://generate-supported.mk \
            file://makedbs.sh \
            file://makedbs.sh \
-           \
            ${NATIVESDKFIXES} \
            ${NATIVESDKFIXES} \
-           file://0009-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch \
-           file://0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch \
-           file://0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch \
-           file://0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch \
-           file://0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch \
-           file://0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch \
-           file://0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch \
-           file://0016-yes-within-the-path-sets-wrong-config-variables.patch \
-           file://0017-timezone-re-written-tzselect-as-posix-sh.patch \
-           file://0018-Remove-bash-dependency-for-nscd-init-script.patch \
-           file://0019-eglibc-Cross-building-and-testing-instructions.patch \
-           file://0020-eglibc-Help-bootstrap-cross-toolchain.patch \
-           file://0021-eglibc-Resolve-__fpscr_values-on-SH4.patch \
-           file://0022-eglibc-Forward-port-cross-locale-generation-support.patch \
-           file://0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
-           file://0025-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \
-           file://0026-intl-Emit-no-lines-in-bison-generated-files.patch \
-           file://0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch \
-           file://0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \
-           file://0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch \
-           file://0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch \
-           file://0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \
-           file://0001-RISC-V-Remove-riscv-specific-sigcontext.h.patch \
-           file://0002-RISC-V-Reserve-about-5K-space-in-mcontext_t-to-suppo.patch \
-           file://0003-RISC-V-Save-and-restore-VCSR-when-doing-user-context.patch \
-           file://0004-RISC-V-Extend-MINSIGSTKSZ-and-SIGSTKSZ-to-backup-RVV.patch \
-           file://0005-RISC-V-Expand-PTHREAD_STACK_MIN-to-support-RVV-envir.patch \
-           file://0006-add-vector-support-for-memset-memcmp-memmove-memcpy-.patch \
-           file://0007-add-NT_RISCV_VECTOR-macro-definition-to-align-with-l.patch \
-           file://0008-fix-the-bcmp-unrecognized-issue.patch \
-           file://0009-Revert-RISC-V-Reserve-about-5K-space-in-mcontext_t-t.patch  \
-           file://0010-Revert-RISC-V-Save-and-restore-VCSR-when-doing-user-.patch  \
-           file://0011-riscv-Resolve-symbols-directly-for-symbols-with-STO_.patch  \
-           file://0012-add-hwcap.h-header-file.patch  \
-           file://0013-change-memcpy_vector-LMUL-to-m8.patch \
-           "
+           file://0009-yes-within-the-path-sets-wrong-config-variables.patch \
+           file://0010-eglibc-Cross-building-and-testing-instructions.patch \
+           file://0011-eglibc-Help-bootstrap-cross-toolchain.patch \
+           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 \
+	   "
 S = "${WORKDIR}/git"
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build-${TARGET_SYS}"
 B = "${WORKDIR}/build-${TARGET_SYS}"
 
 
@@ -100,7 +105,7 @@ EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \
 
 
 EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}"
 EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}"
 
 
-EXTRA_OECONF:append:x86 = " --enable-cet"
+EXTRA_OECONF:append:x86 = " ${@bb.utils.contains_any('TUNE_FEATURES', 'i586 c3', '--disable-cet', '--enable-cet', d)}"
 EXTRA_OECONF:append:x86-64 = " --enable-cet"
 EXTRA_OECONF:append:x86-64 = " --enable-cet"
 
 
 PACKAGECONFIG ??= "nscd memory-tagging"
 PACKAGECONFIG ??= "nscd memory-tagging"

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

@@ -1,6 +1,6 @@
 SUMMARY = "A standalone native ldconfig build"
 SUMMARY = "A standalone native ldconfig build"
 
 
-LICENSE = "GPLv2+"
+LICENSE = "GPL-2.0-or-later"
 
 
 LIC_FILES_CHKSUM = "file://${S}/ldconfig.c;endline=17;md5=1d15f20937c055cb5de2329a4c054399"
 LIC_FILES_CHKSUM = "file://${S}/ldconfig.c;endline=17;md5=1d15f20937c055cb5de2329a4c054399"