From a8b7d51ccec6208ec91be7c7b207b110e3269e78 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sat, 5 Feb 2022 17:50:25 +0000 Subject: glibc: Upgrade to 2.35 Package /usr/bin/ld.so in a separate package ld.so is a new tool which is added as a symlink to original dynamic linker so make it available with same name across architectures which is useful to leveral features like --preload, --audit, and --list-diagnostics more accessible to end users (From OE-Core rev: 2658dcbcfc3db814af1ee104303effc1b6cfa489) Signed-off-by: Khem Raj Signed-off-by: Richard Purdie --- .../glibc/cross-localedef-native_2.34.bb | 54 -- .../glibc/cross-localedef-native_2.35.bb | 54 ++ meta/recipes-core/glibc/glibc-common.inc | 2 +- meta/recipes-core/glibc/glibc-locale_2.34.bb | 1 - meta/recipes-core/glibc/glibc-locale_2.35.bb | 1 + meta/recipes-core/glibc/glibc-mtrace_2.34.bb | 1 - meta/recipes-core/glibc/glibc-mtrace_2.35.bb | 1 + meta/recipes-core/glibc/glibc-package.inc | 7 +- meta/recipes-core/glibc/glibc-scripts_2.34.bb | 1 - meta/recipes-core/glibc/glibc-scripts_2.35.bb | 1 + meta/recipes-core/glibc/glibc-tests_2.34.bb | 115 ---- meta/recipes-core/glibc/glibc-tests_2.35.bb | 115 ++++ meta/recipes-core/glibc/glibc-testsuite_2.34.bb | 35 -- meta/recipes-core/glibc/glibc-testsuite_2.35.bb | 35 ++ meta/recipes-core/glibc/glibc-version.inc | 8 +- .../glibc/glibc/0001-CVE-2021-38604.patch | 43 -- .../glibc/glibc/0001-CVE-2021-3998.patch | 282 ---------- .../glibc/glibc/0001-CVE-2021-3999.patch | 36 -- .../glibc/glibc/0001-CVE-2022-23218.patch | 178 ------ .../glibc/glibc/0001-CVE-2022-23219.patch | 55 -- ...l-interpreter-overridable-in-tzselect.ksh.patch | 50 -- ...thread-failed-in-unprivileged-process-BZ-.patch | 79 --- ...def-Add-hardlink-resolver-from-util-linux.patch | 2 +- .../glibc/glibc/0002-CVE-2021-38604.patch | 150 ----- .../glibc/glibc/0002-CVE-2021-3998.patch | 138 ----- .../glibc/glibc/0002-CVE-2021-3999.patch | 357 ------------ .../glibc/glibc/0002-CVE-2022-23218.patch | 126 ----- .../glibc/glibc/0002-CVE-2022-23219.patch | 89 --- ...ledef-fix-ups-hardlink-to-make-it-compile.patch | 2 +- ...libc-Look-for-host-system-ld.so.cache-as-.patch | 8 +- ...libc-Fix-buffer-overrun-with-a-relocated-.patch | 6 +- ...libc-Raise-the-size-of-arrays-containing-.patch | 18 +- ...ivesdk-glibc-Allow-64-bit-atomics-for-x86.patch | 14 +- ...libc-Make-relocatable-install-for-locales.patch | 16 +- ...libc-Fall-back-to-faccessat-on-faccess2-r.patch | 2 +- ...thin-the-path-sets-wrong-config-variables.patch | 260 +++++++++ ...c-Cross-building-and-testing-instructions.patch | 616 +++++++++++++++++++++ ...011-eglibc-Help-bootstrap-cross-toolchain.patch | 97 ++++ ...0012-eglibc-Resolve-__fpscr_values-on-SH4.patch | 53 ++ ...ward-port-cross-locale-generation-support.patch | 560 +++++++++++++++++++ ...dd-to-archive-uses-a-hard-coded-locale-pa.patch | 80 +++ ...-configure.ac-handle-correctly-libc_cv_ro.patch | 39 -- ...ent-maybe-uninitialized-errors-with-Os-BZ.patch | 53 ++ ...thin-the-path-sets-wrong-config-variables.patch | 260 --------- ...-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch | 29 + ...move-bash-dependency-for-nscd-init-script.patch | 72 --- ...-Unify-the-header-between-arm-and-aarch64.patch | 78 +++ ...c-Cross-building-and-testing-instructions.patch | 616 --------------------- ...erpc-Do-not-ask-compiler-for-finding-arch.patch | 48 ++ ...020-eglibc-Help-bootstrap-cross-toolchain.patch | 97 ---- ...o-with-printf-builtin-in-nscd-init-script.patch | 79 +++ ...0021-eglibc-Resolve-__fpscr_values-on-SH4.patch | 53 -- ...ward-port-cross-locale-generation-support.patch | 560 ------------------- ...-configure.ac-Set-libc_cv_rootsbindir-onl.patch | 39 ++ ...ke-shell-interpreter-overridable-in-tzsel.patch | 47 ++ ...dd-to-archive-uses-a-hard-coded-locale-pa.patch | 80 --- ...tl-Emit-no-lines-in-bison-generated-files.patch | 31 -- ...ent-maybe-uninitialized-errors-with-Os-BZ.patch | 53 -- ...-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch | 29 - ...-Unify-the-header-between-arm-and-aarch64.patch | 67 --- ...erpc-Do-not-ask-compiler-for-finding-arch.patch | 48 -- meta/recipes-core/glibc/glibc/CVE-2021-43396.patch | 184 ------ meta/recipes-core/glibc/glibc_2.34.bb | 135 ----- meta/recipes-core/glibc/glibc_2.35.bb | 122 ++++ 64 files changed, 2415 insertions(+), 4152 deletions(-) delete mode 100644 meta/recipes-core/glibc/cross-localedef-native_2.34.bb create mode 100644 meta/recipes-core/glibc/cross-localedef-native_2.35.bb delete mode 100644 meta/recipes-core/glibc/glibc-locale_2.34.bb create mode 100644 meta/recipes-core/glibc/glibc-locale_2.35.bb delete mode 100644 meta/recipes-core/glibc/glibc-mtrace_2.34.bb create mode 100644 meta/recipes-core/glibc/glibc-mtrace_2.35.bb delete mode 100644 meta/recipes-core/glibc/glibc-scripts_2.34.bb create mode 100644 meta/recipes-core/glibc/glibc-scripts_2.35.bb delete mode 100644 meta/recipes-core/glibc/glibc-tests_2.34.bb create mode 100644 meta/recipes-core/glibc/glibc-tests_2.35.bb delete mode 100644 meta/recipes-core/glibc/glibc-testsuite_2.34.bb create mode 100644 meta/recipes-core/glibc/glibc-testsuite_2.35.bb delete mode 100644 meta/recipes-core/glibc/glibc/0001-CVE-2021-38604.patch delete mode 100644 meta/recipes-core/glibc/glibc/0001-CVE-2021-3998.patch delete mode 100644 meta/recipes-core/glibc/glibc/0001-CVE-2021-3999.patch delete mode 100644 meta/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch delete mode 100644 meta/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch delete mode 100644 meta/recipes-core/glibc/glibc/0001-Make-shell-interpreter-overridable-in-tzselect.ksh.patch delete mode 100644 meta/recipes-core/glibc/glibc/0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch delete mode 100644 meta/recipes-core/glibc/glibc/0002-CVE-2021-38604.patch delete mode 100644 meta/recipes-core/glibc/glibc/0002-CVE-2021-3998.patch delete mode 100644 meta/recipes-core/glibc/glibc/0002-CVE-2021-3999.patch delete mode 100644 meta/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch delete mode 100644 meta/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch create mode 100644 meta/recipes-core/glibc/glibc/0009-yes-within-the-path-sets-wrong-config-variables.patch create mode 100644 meta/recipes-core/glibc/glibc/0010-eglibc-Cross-building-and-testing-instructions.patch create mode 100644 meta/recipes-core/glibc/glibc/0011-eglibc-Help-bootstrap-cross-toolchain.patch create mode 100644 meta/recipes-core/glibc/glibc/0012-eglibc-Resolve-__fpscr_values-on-SH4.patch create mode 100644 meta/recipes-core/glibc/glibc/0013-eglibc-Forward-port-cross-locale-generation-support.patch create mode 100644 meta/recipes-core/glibc/glibc/0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch delete mode 100644 meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch create mode 100644 meta/recipes-core/glibc/glibc/0016-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch delete mode 100644 meta/recipes-core/glibc/glibc/0016-yes-within-the-path-sets-wrong-config-variables.patch create mode 100644 meta/recipes-core/glibc/glibc/0017-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch delete mode 100644 meta/recipes-core/glibc/glibc/0018-Remove-bash-dependency-for-nscd-init-script.patch create mode 100644 meta/recipes-core/glibc/glibc/0018-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch delete mode 100644 meta/recipes-core/glibc/glibc/0019-eglibc-Cross-building-and-testing-instructions.patch create mode 100644 meta/recipes-core/glibc/glibc/0019-powerpc-Do-not-ask-compiler-for-finding-arch.patch delete mode 100644 meta/recipes-core/glibc/glibc/0020-eglibc-Help-bootstrap-cross-toolchain.patch create mode 100644 meta/recipes-core/glibc/glibc/0021-Replace-echo-with-printf-builtin-in-nscd-init-script.patch delete mode 100644 meta/recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch delete mode 100644 meta/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch create mode 100644 meta/recipes-core/glibc/glibc/0022-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch create mode 100644 meta/recipes-core/glibc/glibc/0023-timezone-Make-shell-interpreter-overridable-in-tzsel.patch delete mode 100644 meta/recipes-core/glibc/glibc/0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch delete mode 100644 meta/recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch delete mode 100644 meta/recipes-core/glibc/glibc/0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch delete mode 100644 meta/recipes-core/glibc/glibc/0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch delete mode 100644 meta/recipes-core/glibc/glibc/0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch delete mode 100644 meta/recipes-core/glibc/glibc/0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch delete mode 100644 meta/recipes-core/glibc/glibc/CVE-2021-43396.patch delete mode 100644 meta/recipes-core/glibc/glibc_2.34.bb create mode 100644 meta/recipes-core/glibc/glibc_2.35.bb (limited to 'meta/recipes-core/glibc') diff --git a/meta/recipes-core/glibc/cross-localedef-native_2.34.bb b/meta/recipes-core/glibc/cross-localedef-native_2.34.bb deleted file mode 100644 index c37814ee24..0000000000 --- a/meta/recipes-core/glibc/cross-localedef-native_2.34.bb +++ /dev/null @@ -1,54 +0,0 @@ -SUMMARY = "Cross locale generation tool for glibc" -HOMEPAGE = "http://www.gnu.org/software/libc/libc.html" -SECTION = "libs" -LICENSE = "LGPL-2.1" - -LIC_FILES_CHKSUM = "file://LICENSES;md5=1541fd8f5e8f1579512bf05f533371ba \ - file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \ - file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c" - -require glibc-version.inc - -# Tell autotools that we're working in the localedef directory -# -AUTOTOOLS_SCRIPT_PATH = "${S}/localedef" - -inherit autotools -inherit native - -FILESEXTRAPATHS =. "${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/glibc:" - -SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ - git://github.com/kraj/localedef;branch=master;name=localedef;destsuffix=git/localedef;protocol=https \ - \ - file://0001-localedef-Add-hardlink-resolver-from-util-linux.patch \ - file://0002-localedef-fix-ups-hardlink-to-make-it-compile.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-Make-shell-interpreter-overridable-in-tzselect.ksh.patch \ -" -# Makes for a rather long rev (22 characters), but... -# -SRCREV_FORMAT = "glibc_localedef" - -S = "${WORKDIR}/git" - -EXTRA_OECONF = "--with-glibc=${S}" - -# 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() { - install -d ${D}${bindir} - install -m 0755 ${B}/localedef ${D}${bindir}/cross-localedef - install -m 0755 ${B}/cross-localedef-hardlink ${D}${bindir}/cross-localedef-hardlink -} diff --git a/meta/recipes-core/glibc/cross-localedef-native_2.35.bb b/meta/recipes-core/glibc/cross-localedef-native_2.35.bb new file mode 100644 index 0000000000..893d376459 --- /dev/null +++ b/meta/recipes-core/glibc/cross-localedef-native_2.35.bb @@ -0,0 +1,54 @@ +SUMMARY = "Cross locale generation tool for glibc" +HOMEPAGE = "http://www.gnu.org/software/libc/libc.html" +SECTION = "libs" +LICENSE = "LGPL-2.1" + +LIC_FILES_CHKSUM = "file://LICENSES;md5=1541fd8f5e8f1579512bf05f533371ba \ + file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \ + file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c" + +require glibc-version.inc + +# Tell autotools that we're working in the localedef directory +# +AUTOTOOLS_SCRIPT_PATH = "${S}/localedef" + +inherit autotools +inherit native + +FILESEXTRAPATHS =. "${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/glibc:" + +SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ + git://github.com/kraj/localedef;branch=master;name=localedef;destsuffix=git/localedef;protocol=https \ + \ + file://0001-localedef-Add-hardlink-resolver-from-util-linux.patch \ + file://0002-localedef-fix-ups-hardlink-to-make-it-compile.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://0021-Replace-echo-with-printf-builtin-in-nscd-init-script.patch \ + file://0023-timezone-Make-shell-interpreter-overridable-in-tzsel.patch \ + " +# Makes for a rather long rev (22 characters), but... +# +SRCREV_FORMAT = "glibc_localedef" + +S = "${WORKDIR}/git" + +EXTRA_OECONF = "--with-glibc=${S}" + +# 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() { + install -d ${D}${bindir} + install -m 0755 ${B}/localedef ${D}${bindir}/cross-localedef + install -m 0755 ${B}/cross-localedef-hardlink ${D}${bindir}/cross-localedef-hardlink +} diff --git a/meta/recipes-core/glibc/glibc-common.inc b/meta/recipes-core/glibc/glibc-common.inc index f695cd6a4a..098ebbc932 100644 --- a/meta/recipes-core/glibc/glibc-common.inc +++ b/meta/recipes-core/glibc/glibc-common.inc @@ -22,4 +22,4 @@ ARM_INSTRUCTION_SET:armv6 = "arm" # COMPATIBLE_HOST:libc-musl:class-target = "null" -PV = "2.34" +PV = "2.35" diff --git a/meta/recipes-core/glibc/glibc-locale_2.34.bb b/meta/recipes-core/glibc/glibc-locale_2.34.bb deleted file mode 100644 index f7702e0358..0000000000 --- a/meta/recipes-core/glibc/glibc-locale_2.34.bb +++ /dev/null @@ -1 +0,0 @@ -require glibc-locale.inc diff --git a/meta/recipes-core/glibc/glibc-locale_2.35.bb b/meta/recipes-core/glibc/glibc-locale_2.35.bb new file mode 100644 index 0000000000..f7702e0358 --- /dev/null +++ b/meta/recipes-core/glibc/glibc-locale_2.35.bb @@ -0,0 +1 @@ +require glibc-locale.inc diff --git a/meta/recipes-core/glibc/glibc-mtrace_2.34.bb b/meta/recipes-core/glibc/glibc-mtrace_2.34.bb deleted file mode 100644 index 0b69bad46a..0000000000 --- a/meta/recipes-core/glibc/glibc-mtrace_2.34.bb +++ /dev/null @@ -1 +0,0 @@ -require glibc-mtrace.inc diff --git a/meta/recipes-core/glibc/glibc-mtrace_2.35.bb b/meta/recipes-core/glibc/glibc-mtrace_2.35.bb new file mode 100644 index 0000000000..0b69bad46a --- /dev/null +++ b/meta/recipes-core/glibc/glibc-mtrace_2.35.bb @@ -0,0 +1 @@ +require glibc-mtrace.inc diff --git a/meta/recipes-core/glibc/glibc-package.inc b/meta/recipes-core/glibc/glibc-package.inc index 54e2a08906..90437a1c6f 100644 --- a/meta/recipes-core/glibc/glibc-package.inc +++ b/meta/recipes-core/glibc/glibc-package.inc @@ -1,6 +1,6 @@ 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 catchsegv sln nscd ldconfig ldd ldso 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" # The ld.so in this glibc supports the GNU_HASH RPROVIDES:${PN} = "eglibc rtld(GNU_HASH)" @@ -23,12 +23,14 @@ 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)}" INSANE_SKIP:${PN}:append:aarch64 = " libdir" INSANE_SKIP:${PN}-dev += "staticdev" +INSANE_SKIP:${MLPREFIX}ldso:append = " dev-so libdir" FILES:${PN} = "${libc_baselibs} ${libexecdir}/* ${sysconfdir}/ld.so.conf" RRECOMMENDS:${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'ldconfig', '${MLPREFIX}ldconfig', '', d)}" FILES:ldconfig = "${base_sbindir}/ldconfig" FILES:ldd = "${bindir}/ldd" FILES:libsegfault = "${base_libdir}/libSegFault*" +FILES:ldso = "${bindir}/${MLPREFIX}ld.so" FILES:libmemusage = "${base_libdir}/libmemusage.so" 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" @@ -121,6 +123,9 @@ do_install() { fi ln -rs ${D}${base_libdir}/libpthread.so.0 ${D}${libdir}/libpthread.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): diff --git a/meta/recipes-core/glibc/glibc-scripts_2.34.bb b/meta/recipes-core/glibc/glibc-scripts_2.34.bb deleted file mode 100644 index 5a89bd8022..0000000000 --- a/meta/recipes-core/glibc/glibc-scripts_2.34.bb +++ /dev/null @@ -1 +0,0 @@ -require glibc-scripts.inc diff --git a/meta/recipes-core/glibc/glibc-scripts_2.35.bb b/meta/recipes-core/glibc/glibc-scripts_2.35.bb new file mode 100644 index 0000000000..5a89bd8022 --- /dev/null +++ b/meta/recipes-core/glibc/glibc-scripts_2.35.bb @@ -0,0 +1 @@ +require glibc-scripts.inc diff --git a/meta/recipes-core/glibc/glibc-tests_2.34.bb b/meta/recipes-core/glibc/glibc-tests_2.34.bb deleted file mode 100644 index 8c7ecf89ba..0000000000 --- a/meta/recipes-core/glibc/glibc-tests_2.34.bb +++ /dev/null @@ -1,115 +0,0 @@ -require glibc_${PV}.bb -require glibc-tests.inc - -inherit ptest - -SRC_URI:append = " \ - 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") - d.setVar("RPROVIDES", "${PN} ${PN}-ptest") - - d.setVar("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" -DEPENDS:append = " sed" - -# 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/glibc-tests/*" - -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" diff --git a/meta/recipes-core/glibc/glibc-tests_2.35.bb b/meta/recipes-core/glibc/glibc-tests_2.35.bb new file mode 100644 index 0000000000..8c7ecf89ba --- /dev/null +++ b/meta/recipes-core/glibc/glibc-tests_2.35.bb @@ -0,0 +1,115 @@ +require glibc_${PV}.bb +require glibc-tests.inc + +inherit ptest + +SRC_URI:append = " \ + 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") + d.setVar("RPROVIDES", "${PN} ${PN}-ptest") + + d.setVar("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" +DEPENDS:append = " sed" + +# 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/glibc-tests/*" + +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" diff --git a/meta/recipes-core/glibc/glibc-testsuite_2.34.bb b/meta/recipes-core/glibc/glibc-testsuite_2.34.bb deleted file mode 100644 index e8ad2a938b..0000000000 --- a/meta/recipes-core/glibc/glibc-testsuite_2.34.bb +++ /dev/null @@ -1,35 +0,0 @@ -require glibc_${PV}.bb -require glibc-tests.inc - -inherit qemu - -SRC_URI += "file://check-test-wrapper" - -# strip provides -PROVIDES = "" - -DEPENDS += "${@'qemu-native' if d.getVar('TOOLCHAIN_TEST_TARGET') == 'user' else ''}" - -TOOLCHAIN_TEST_TARGET ??= "user" -TOOLCHAIN_TEST_HOST ??= "localhost" -TOOLCHAIN_TEST_HOST_USER ??= "root" -TOOLCHAIN_TEST_HOST_PORT ??= "2222" - -do_check[nostamp] = "1" -do_check:append () { - chmod 0755 ${WORKDIR}/check-test-wrapper - - oe_runmake -i \ - QEMU_SYSROOT="${RECIPE_SYSROOT}" \ - QEMU_OPTIONS="${@qemu_target_binary(d)} ${QEMU_OPTIONS}" \ - SSH_HOST="${TOOLCHAIN_TEST_HOST}" \ - SSH_HOST_USER="${TOOLCHAIN_TEST_HOST_USER}" \ - SSH_HOST_PORT="${TOOLCHAIN_TEST_HOST_PORT}" \ - test-wrapper="${WORKDIR}/check-test-wrapper ${TOOLCHAIN_TEST_TARGET}" \ - check -} - -inherit nopackages -deltask do_stash_locale -deltask do_install -deltask do_populate_sysroot diff --git a/meta/recipes-core/glibc/glibc-testsuite_2.35.bb b/meta/recipes-core/glibc/glibc-testsuite_2.35.bb new file mode 100644 index 0000000000..e8ad2a938b --- /dev/null +++ b/meta/recipes-core/glibc/glibc-testsuite_2.35.bb @@ -0,0 +1,35 @@ +require glibc_${PV}.bb +require glibc-tests.inc + +inherit qemu + +SRC_URI += "file://check-test-wrapper" + +# strip provides +PROVIDES = "" + +DEPENDS += "${@'qemu-native' if d.getVar('TOOLCHAIN_TEST_TARGET') == 'user' else ''}" + +TOOLCHAIN_TEST_TARGET ??= "user" +TOOLCHAIN_TEST_HOST ??= "localhost" +TOOLCHAIN_TEST_HOST_USER ??= "root" +TOOLCHAIN_TEST_HOST_PORT ??= "2222" + +do_check[nostamp] = "1" +do_check:append () { + chmod 0755 ${WORKDIR}/check-test-wrapper + + oe_runmake -i \ + QEMU_SYSROOT="${RECIPE_SYSROOT}" \ + QEMU_OPTIONS="${@qemu_target_binary(d)} ${QEMU_OPTIONS}" \ + SSH_HOST="${TOOLCHAIN_TEST_HOST}" \ + SSH_HOST_USER="${TOOLCHAIN_TEST_HOST_USER}" \ + SSH_HOST_PORT="${TOOLCHAIN_TEST_HOST_PORT}" \ + test-wrapper="${WORKDIR}/check-test-wrapper ${TOOLCHAIN_TEST_TARGET}" \ + check +} + +inherit nopackages +deltask do_stash_locale +deltask do_install +deltask do_populate_sysroot diff --git a/meta/recipes-core/glibc/glibc-version.inc b/meta/recipes-core/glibc/glibc-version.inc index 281df7ecda..080e905b6e 100644 --- a/meta/recipes-core/glibc/glibc-version.inc +++ b/meta/recipes-core/glibc/glibc-version.inc @@ -1,7 +1,7 @@ -SRCBRANCH ?= "release/2.34/master" -PV = "2.34" -SRCREV_glibc ?= "ae37d06c7d127817ba43850f0f898b793d42aea7" -SRCREV_localedef ?= "95c0221703ad970a52445e9eaf91c4aff35eebef" +SRCBRANCH ?= "release/2.35/master" +PV = "2.35" +SRCREV_glibc ?= "24962427071fa532c3c48c918e9d64d719cc8a6c" +SRCREV_localedef ?= "794da69788cbf9bf57b59a852f9f11307663fa87" GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git" diff --git a/meta/recipes-core/glibc/glibc/0001-CVE-2021-38604.patch b/meta/recipes-core/glibc/glibc/0001-CVE-2021-38604.patch deleted file mode 100644 index 1e94049004..0000000000 --- a/meta/recipes-core/glibc/glibc/0001-CVE-2021-38604.patch +++ /dev/null @@ -1,43 +0,0 @@ -From b805aebd42364fe696e417808a700fdb9800c9e8 Mon Sep 17 00:00:00 2001 -From: Nikita Popov -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 -Reviewed-by: Siddhesh Poyarekar -Signed-off-by: Vinay Kumar ---- - 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 (¬ify_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 - diff --git a/meta/recipes-core/glibc/glibc/0001-CVE-2021-3998.patch b/meta/recipes-core/glibc/glibc/0001-CVE-2021-3998.patch deleted file mode 100644 index c6bd5916e3..0000000000 --- a/meta/recipes-core/glibc/glibc/0001-CVE-2021-3998.patch +++ /dev/null @@ -1,282 +0,0 @@ -From fb7bff12e81c677a6622f724edd4d4987dd9d971 Mon Sep 17 00:00:00 2001 -From: Siddhesh Poyarekar -Date: Tue, 18 Jan 2022 13:29:36 +0530 -Subject: [PATCH] support: Add helpers to create paths longer than PATH_MAX - -Add new helpers support_create_and_chdir_toolong_temp_directory and -support_chdir_toolong_temp_directory to create and descend into -directory trees longer than PATH_MAX. - -Reviewed-by: Adhemerval Zanella -Signed-off-by: Siddhesh Poyarekar - -Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=062ff490c1467059f6cd64bb9c3d85f6cc6cf97a] -CVE: CVE-2021-3998 - -Signed-off-by: Pgowda ---- - support/temp_file.c | 159 +++++++++++++++++++++++++++++++++++++++++--- - support/temp_file.h | 9 +++ - 2 files changed, 159 insertions(+), 9 deletions(-) - -diff --git a/support/temp_file.c b/support/temp_file.c -index e7bb8aadb9..e41128c2d4 100644 ---- a/support/temp_file.c -+++ b/support/temp_file.c -@@ -1,5 +1,6 @@ - /* Temporary file handling for tests. - Copyright (C) 1998-2021 Free Software Foundation, Inc. -+ Copyright The GNU Tools Authors. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or -@@ -20,15 +21,17 @@ - some 32-bit platforms. */ - #define _FILE_OFFSET_BITS 64 - -+#include - #include - #include - #include - -+#include - #include - #include - #include - #include --#include -+#include - - /* List of temporary files. */ - static struct temp_name_list -@@ -36,14 +39,20 @@ static struct temp_name_list - struct temp_name_list *next; - char *name; - pid_t owner; -+ bool toolong; - } *temp_name_list; - - /* Location of the temporary files. Set by the test skeleton via - support_set_test_dir. The string is not be freed. */ - static const char *test_dir = _PATH_TMP; - --void --add_temp_file (const char *name) -+/* Name of subdirectories in a too long temporary directory tree. */ -+static char toolong_subdir[NAME_MAX + 1]; -+static bool toolong_initialized; -+static size_t toolong_path_max; -+ -+static void -+add_temp_file_internal (const char *name, bool toolong) - { - struct temp_name_list *newp - = (struct temp_name_list *) xcalloc (sizeof (*newp), 1); -@@ -53,12 +62,19 @@ add_temp_file (const char *name) - newp->name = newname; - newp->next = temp_name_list; - newp->owner = getpid (); -+ newp->toolong = toolong; - temp_name_list = newp; - } - else - free (newp); - } - -+void -+add_temp_file (const char *name) -+{ -+ add_temp_file_internal (name, false); -+} -+ - int - create_temp_file_in_dir (const char *base, const char *dir, char **filename) - { -@@ -90,8 +106,8 @@ create_temp_file (const char *base, char - return create_temp_file_in_dir (base, test_dir, filename); - } - --char * --support_create_temp_directory (const char *base) -+static char * -+create_temp_directory_internal (const char *base, bool toolong) - { - char *path = xasprintf ("%s/%sXXXXXX", test_dir, base); - if (mkdtemp (path) == NULL) -@@ -99,16 +115,132 @@ support_create_temp_directory (const cha - printf ("error: mkdtemp (\"%s\"): %m", path); - exit (1); - } -- add_temp_file (path); -+ add_temp_file_internal (path, toolong); - return path; - } - --/* Helper functions called by the test skeleton follow. */ -+char * -+support_create_temp_directory (const char *base) -+{ -+ return create_temp_directory_internal (base, false); -+} -+ -+static void -+ensure_toolong_initialized (void) -+{ -+ if (!toolong_initialized) -+ FAIL_EXIT1 ("uninitialized toolong directory tree\n"); -+} -+ -+static void -+initialize_toolong (const char *base) -+{ -+ long name_max = pathconf (base, _PC_NAME_MAX); -+ name_max = (name_max < 0 ? 64 -+ : (name_max < sizeof (toolong_subdir) ? name_max -+ : sizeof (toolong_subdir) - 1)); -+ -+ long path_max = pathconf (base, _PC_PATH_MAX); -+ path_max = (path_max < 0 ? 1024 -+ : path_max <= PTRDIFF_MAX ? path_max : PTRDIFF_MAX); -+ -+ /* Sanity check to ensure that the test does not create temporary directories -+ in different filesystems because this API doesn't support it. */ -+ if (toolong_initialized) -+ { -+ if (name_max != strlen (toolong_subdir)) -+ FAIL_UNSUPPORTED ("name_max: Temporary directories in different" -+ " filesystems not supported yet\n"); -+ if (path_max != toolong_path_max) -+ FAIL_UNSUPPORTED ("path_max: Temporary directories in different" -+ " filesystems not supported yet\n"); -+ return; -+ } -+ -+ toolong_path_max = path_max; -+ -+ size_t len = name_max; -+ memset (toolong_subdir, 'X', len); -+ toolong_initialized = true; -+} -+ -+char * -+support_create_and_chdir_toolong_temp_directory (const char *basename) -+{ -+ char *base = create_temp_directory_internal (basename, true); -+ xchdir (base); -+ -+ initialize_toolong (base); -+ -+ size_t sz = strlen (toolong_subdir); -+ -+ /* Create directories and descend into them so that the final path is larger -+ than PATH_MAX. */ -+ for (size_t i = 0; i <= toolong_path_max / sz; i++) -+ { -+ int ret = mkdir (toolong_subdir, S_IRWXU); -+ if (ret != 0 && errno == ENAMETOOLONG) -+ FAIL_UNSUPPORTED ("Filesystem does not support creating too long " -+ "directory trees\n"); -+ else if (ret != 0) -+ FAIL_EXIT1 ("Failed to create directory tree: %m\n"); -+ xchdir (toolong_subdir); -+ } -+ return base; -+} - - void --support_set_test_dir (const char *path) -+support_chdir_toolong_temp_directory (const char *base) - { -- test_dir = path; -+ ensure_toolong_initialized (); -+ -+ xchdir (base); -+ -+ size_t sz = strlen (toolong_subdir); -+ for (size_t i = 0; i <= toolong_path_max / sz; i++) -+ xchdir (toolong_subdir); -+} -+ -+/* Helper functions called by the test skeleton follow. */ -+ -+static void -+remove_toolong_subdirs (const char *base) -+{ -+ ensure_toolong_initialized (); -+ -+ if (chdir (base) != 0) -+ { -+ printf ("warning: toolong cleanup base failed: chdir (\"%s\"): %m\n", -+ base); -+ return; -+ } -+ -+ /* Descend. */ -+ int levels = 0; -+ size_t sz = strlen (toolong_subdir); -+ for (levels = 0; levels <= toolong_path_max / sz; levels++) -+ if (chdir (toolong_subdir) != 0) -+ { -+ printf ("warning: toolong cleanup failed: chdir (\"%s\"): %m\n", -+ toolong_subdir); -+ break; -+ } -+ -+ /* Ascend and remove. */ -+ while (--levels >= 0) -+ { -+ if (chdir ("..") != 0) -+ { -+ printf ("warning: toolong cleanup failed: chdir (\"..\"): %m\n"); -+ return; -+ } -+ if (remove (toolong_subdir) != 0) -+ { -+ printf ("warning: could not remove subdirectory: %s: %m\n", -+ toolong_subdir); -+ return; -+ } -+ } - } - - void -@@ -123,6 +255,9 @@ support_delete_temp_files (void) - around, to prevent PID reuse.) */ - if (temp_name_list->owner == pid) - { -+ if (temp_name_list->toolong) -+ remove_toolong_subdirs (temp_name_list->name); -+ - if (remove (temp_name_list->name) != 0) - printf ("warning: could not remove temporary file: %s: %m\n", - temp_name_list->name); -@@ -147,3 +282,9 @@ support_print_temp_files (FILE *f) - fprintf (f, ")\n"); - } - } -+ -+void -+support_set_test_dir (const char *path) -+{ -+ test_dir = path; -+} -diff --git a/support/temp_file.h b/support/temp_file.h -index 50a443abe4..8459ddda72 100644 ---- a/support/temp_file.h -+++ b/support/temp_file.h -@@ -44,6 +44,15 @@ int create_temp_file_in_dir (const char - returns. The caller should free this string. */ - char *support_create_temp_directory (const char *base); - -+/* Create a temporary directory tree that is longer than PATH_MAX and schedule -+ it for deletion. BASENAME is used as a prefix for the unique directory -+ name, which the function returns. The caller should free this string. */ -+char *support_create_and_chdir_toolong_temp_directory (const char *basename); -+ -+/* Change into the innermost directory of the directory tree BASE, which was -+ created using support_create_and_chdir_toolong_temp_directory. */ -+void support_chdir_toolong_temp_directory (const char *base); -+ - __END_DECLS - - #endif /* SUPPORT_TEMP_FILE_H */ diff --git a/meta/recipes-core/glibc/glibc/0001-CVE-2021-3999.patch b/meta/recipes-core/glibc/glibc/0001-CVE-2021-3999.patch deleted file mode 100644 index 64749390b5..0000000000 --- a/meta/recipes-core/glibc/glibc/0001-CVE-2021-3999.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 8c8a71c85f2ed5cc90d08d82ce645513fc907cb6 Mon Sep 17 00:00:00 2001 -From: Siddhesh Poyarekar -Date: Mon, 24 Jan 2022 10:57:09 +0530 -Subject: [PATCH] tst-realpath-toolong: Fix hurd build - -Define PATH_MAX to a constant if it isn't already defined, like in hurd. - -Signed-off-by: Siddhesh Poyarekar -(cherry picked from commit 976db046bc3a3738f69255ae00b0a09b8e77fd9c) - -Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=8c8a71c85f2ed5cc90d08d82ce645513fc907cb6] -CVE: CVE-2021-3999 - -Signed-off-by: Pgowda ---- - stdlib/tst-realpath-toolong.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/stdlib/tst-realpath-toolong.c b/stdlib/tst-realpath-toolong.c -index 8bed772460..4388890294 100644 ---- a/stdlib/tst-realpath-toolong.c -+++ b/stdlib/tst-realpath-toolong.c -@@ -29,6 +29,10 @@ - - #define BASENAME "tst-realpath-toolong." - -+#ifndef PATH_MAX -+# define PATH_MAX 1024 -+#endif -+ - int - do_test (void) - { --- -2.27.0 - diff --git a/meta/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch b/meta/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch deleted file mode 100644 index 4eb1fb7fbe..0000000000 --- a/meta/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch +++ /dev/null @@ -1,178 +0,0 @@ -From e368b12f6c16b6888dda99ba641e999b9c9643c8 Mon Sep 17 00:00:00 2001 -From: Florian Weimer -Date: Mon, 17 Jan 2022 10:21:34 +0100 -Subject: [PATCH] socket: Add the __sockaddr_un_set function - -Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=e368b12f6c16b6888dda99ba641e999b9c9643c8] -CVE: CVE-2022-23219 - -Reviewed-by: Siddhesh Poyarekar -Signed-off-by: Pgowda ---- - include/sys/un.h | 12 +++++++ - socket/Makefile | 6 +++- - socket/sockaddr_un_set.c | 41 ++++++++++++++++++++++++ - socket/tst-sockaddr_un_set.c | 62 ++++++++++++++++++++++++++++++++++++ - 4 files changed, 120 insertions(+), 1 deletion(-) - create mode 100644 socket/sockaddr_un_set.c - create mode 100644 socket/tst-sockaddr_un_set.c - -diff --git a/include/sys/un.h b/include/sys/un.h -index bdbee99980..152afd9fc7 100644 ---- a/include/sys/un.h -+++ b/include/sys/un.h -@@ -1 +1,13 @@ - #include -+ -+#ifndef _ISOMAC -+ -+/* Set ADDR->sun_family to AF_UNIX and ADDR->sun_path to PATHNAME. -+ Return 0 on success or -1 on failure (due to overlong PATHNAME). -+ The caller should always use sizeof (struct sockaddr_un) as the -+ socket address length, disregaring the length of PATHNAME. -+ Only concrete (non-abstract) pathnames are supported. */ -+int __sockaddr_un_set (struct sockaddr_un *addr, const char *pathname) -+ attribute_hidden; -+ -+#endif /* _ISOMAC */ -diff --git a/socket/Makefile b/socket/Makefile -index 39333e10ca..156eec6c85 100644 ---- a/socket/Makefile -+++ b/socket/Makefile -@@ -29,13 +29,17 @@ headers := sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h \ - routines := accept bind connect getpeername getsockname getsockopt \ - listen recv recvfrom recvmsg send sendmsg sendto \ - setsockopt shutdown socket socketpair isfdtype opensock \ -- sockatmark accept4 recvmmsg sendmmsg -+ sockatmark accept4 recvmmsg sendmmsg sockaddr_un_set - - tests := \ - tst-accept4 \ - tst-sockopt \ - # tests - -+tests-internal := \ -+ tst-sockaddr_un_set \ -+ # tests-internal -+ - tests-time64 := \ - tst-sockopt-time64 \ - # tests -diff --git a/socket/sockaddr_un_set.c b/socket/sockaddr_un_set.c -new file mode 100644 -index 0000000000..0bd40dc34e ---- /dev/null -+++ b/socket/sockaddr_un_set.c -@@ -0,0 +1,41 @@ -+/* Set the sun_path member of struct sockaddr_un. -+ 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 -+ . */ -+ -+#include -+#include -+#include -+#include -+ -+int -+__sockaddr_un_set (struct sockaddr_un *addr, const char *pathname) -+{ -+ size_t name_length = strlen (pathname); -+ -+ /* The kernel supports names of exactly sizeof (addr->sun_path) -+ bytes, without a null terminator, but userspace does not; see the -+ SUN_LEN macro. */ -+ if (name_length >= sizeof (addr->sun_path)) -+ { -+ __set_errno (EINVAL); /* Error code used by the kernel. */ -+ return -1; -+ } -+ -+ addr->sun_family = AF_UNIX; -+ memcpy (addr->sun_path, pathname, name_length + 1); -+ return 0; -+} -diff --git a/socket/tst-sockaddr_un_set.c b/socket/tst-sockaddr_un_set.c -new file mode 100644 -index 0000000000..29c2a81afd ---- /dev/null -+++ b/socket/tst-sockaddr_un_set.c -@@ -0,0 +1,62 @@ -+/* Test the __sockaddr_un_set function. -+ 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 -+ . */ -+ -+/* Re-compile the function because the version in libc is not -+ exported. */ -+#include "sockaddr_un_set.c" -+ -+#include -+ -+static int -+do_test (void) -+{ -+ struct sockaddr_un sun; -+ -+ memset (&sun, 0xcc, sizeof (sun)); -+ __sockaddr_un_set (&sun, ""); -+ TEST_COMPARE (sun.sun_family, AF_UNIX); -+ TEST_COMPARE (__sockaddr_un_set (&sun, ""), 0); -+ -+ memset (&sun, 0xcc, sizeof (sun)); -+ TEST_COMPARE (__sockaddr_un_set (&sun, "/example"), 0); -+ TEST_COMPARE_STRING (sun.sun_path, "/example"); -+ -+ { -+ char pathname[108]; /* Length of sun_path (ABI constant). */ -+ memset (pathname, 'x', sizeof (pathname)); -+ pathname[sizeof (pathname) - 1] = '\0'; -+ memset (&sun, 0xcc, sizeof (sun)); -+ TEST_COMPARE (__sockaddr_un_set (&sun, pathname), 0); -+ TEST_COMPARE (sun.sun_family, AF_UNIX); -+ TEST_COMPARE_STRING (sun.sun_path, pathname); -+ } -+ -+ { -+ char pathname[109]; -+ memset (pathname, 'x', sizeof (pathname)); -+ pathname[sizeof (pathname) - 1] = '\0'; -+ memset (&sun, 0xcc, sizeof (sun)); -+ errno = 0; -+ TEST_COMPARE (__sockaddr_un_set (&sun, pathname), -1); -+ TEST_COMPARE (errno, EINVAL); -+ } -+ -+ return 0; -+} -+ -+#include --- -2.27.0 - diff --git a/meta/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch b/meta/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch deleted file mode 100644 index 261c2909db..0000000000 --- a/meta/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 226b46770c82899b555986583294b049c6ec9b40 Mon Sep 17 00:00:00 2001 -From: Florian Weimer -Date: Mon, 17 Jan 2022 10:21:34 +0100 -Subject: [PATCH] CVE-2022-23219: Buffer overflow in sunrpc clnt_create for - "unix" (bug 22542) - -Processing an overlong pathname in the sunrpc clnt_create function -results in a stack-based buffer overflow. - -Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=226b46770c82899b555986583294b049c6ec9b40] -CVE: CVE-2022-23219 - -Reviewed-by: Siddhesh Poyarekar -Signed-off-by: Pgowda ---- - NEWS | 4 +++- - sunrpc/clnt_gen.c | 10 +++++++--- - 2 files changed, 10 insertions(+), 4 deletions(-) - -diff --git a/NEWS b/NEWS -index ddd95a8329..38a9ddb2cf 100644 ---- a/NEWS -+++ b/NEWS -@@ -206,6 +206,10 @@ Security related changes: - CVE-2022-23218: Passing an overlong file name to the svcunix_create - legacy function could result in a stack-based buffer overflow. - -+ CVE-2022-23219: Passing an overlong file name to the clnt_create -+ legacy function could result in a stack-based buffer overflow when -+ using the "unix" protocol. Reported by Martin Sebor. -+ - The following bugs are resolved with this release: - - [4737] libc: fork is not async-signal-safe -diff --git a/sunrpc/clnt_gen.c b/sunrpc/clnt_gen.c -index 13ced8994e..b44357cd88 100644 ---- a/sunrpc/clnt_gen.c -+++ b/sunrpc/clnt_gen.c -@@ -57,9 +57,13 @@ clnt_create (const char *hostname, u_lon - - if (strcmp (proto, "unix") == 0) - { -- memset ((char *)&sun, 0, sizeof (sun)); -- sun.sun_family = AF_UNIX; -- strcpy (sun.sun_path, hostname); -+ if (__sockaddr_un_set (&sun, hostname) < 0) -+ { -+ struct rpc_createerr *ce = &get_rpc_createerr (); -+ ce->cf_stat = RPC_SYSTEMERROR; -+ ce->cf_error.re_errno = errno; -+ return NULL; -+ } - sock = RPC_ANYSOCK; - client = clntunix_create (&sun, prog, vers, &sock, 0, 0); - if (client == NULL) diff --git a/meta/recipes-core/glibc/glibc/0001-Make-shell-interpreter-overridable-in-tzselect.ksh.patch b/meta/recipes-core/glibc/glibc/0001-Make-shell-interpreter-overridable-in-tzselect.ksh.patch deleted file mode 100644 index 0480c47b49..0000000000 --- a/meta/recipes-core/glibc/glibc/0001-Make-shell-interpreter-overridable-in-tzselect.ksh.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 76d170fbbfd07b26a0288212201e5d15558db36f Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Thu, 9 Dec 2021 15:14:42 -0800 -Subject: [PATCH] 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: Submitted [https://patchwork.sourceware.org/project/glibc/patch/20211209234015.1554552-1-raj.khem@gmail.com/] -Signed-off-by: Khem Raj ---- - Makeconfig | 9 +++++++++ - timezone/Makefile | 1 + - 2 files changed, 10 insertions(+) - -diff --git a/Makeconfig b/Makeconfig -index 3fa2f13003..a1ea5d5571 100644 ---- a/Makeconfig -+++ b/Makeconfig -@@ -292,6 +292,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 c624a189b3..dc8f5277de 100644 ---- a/timezone/Makefile -+++ b/timezone/Makefile -@@ -127,6 +127,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 $@ --- -2.34.1 - diff --git a/meta/recipes-core/glibc/glibc/0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch b/meta/recipes-core/glibc/glibc/0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch deleted file mode 100644 index 3283dd7ad8..0000000000 --- a/meta/recipes-core/glibc/glibc/0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch +++ /dev/null @@ -1,79 +0,0 @@ -From a8bc44936202692edcd82a48c07d7cf27d6ed8ee Mon Sep 17 00:00:00 2001 -From: Hongxu Jia -Date: Sun, 29 Aug 2021 20:49:16 +0800 -Subject: [PATCH] fix create thread failed in unprivileged process [BZ #28287] - -Since commit [d8ea0d0168 Add an internal wrapper for clone, clone2 and clone3] -applied, start a unprivileged container (docker run without --privileged), -it creates a thread failed in container. - -In commit d8ea0d0168, it calls __clone3 if HAVE_CLONE3_WAPPER is defined. If -__clone3 returns -1 with ENOSYS, fall back to clone or clone2. - -As known from [1], cloneXXX fails with EPERM if CLONE_NEWCGROUP, -CLONE_NEWIPC, CLONE_NEWNET, CLONE_NEWNS, CLONE_NEWPID, or CLONE_NEWUTS -was specified by an unprivileged process (process without CAP_SYS_ADMIN) - -[1] https://man7.org/linux/man-pages/man2/clone3.2.html - -So if __clone3 returns -1 with EPERM, fall back to clone or clone2 could -fix the issue. Here are the test steps: - -1) Prepare test code -cat > conftest.c < - #include - -int check_me = 0; -void* func(void* data) {check_me = 42; printf("start thread: check_me %d\n", check_me); return &check_me;} -int main() -{ - pthread_t t; - void *ret; - pthread_create (&t, 0, func, 0); - pthread_join (t, &ret); - printf("check_me %d, p %p\n", check_me, &ret); - return (check_me != 42 || ret != &check_me); -} - -ENDOF - -2) Compile -gcc -o conftest -pthread conftest.c - -3) Start a container with glibc 2.34 installed -[skip details] -docker run -it bash - -4) Run conftest without this patch -$ ./conftest -check_me 0, p 0x7ffd91ccd400 - -5) Run conftest with this patch -$ ./conftest -start thread: check_me 42 -check_me 42, p 0x7ffe253c6f20 - -Upstream-Status: Submitted [libc-alpha@sourceware.org] - -Signed-off-by: Hongxu Jia ---- - sysdeps/unix/sysv/linux/clone-internal.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sysdeps/unix/sysv/linux/clone-internal.c b/sysdeps/unix/sysv/linux/clone-internal.c -index 979f7880be..97101994e8 100644 ---- a/sysdeps/unix/sysv/linux/clone-internal.c -+++ b/sysdeps/unix/sysv/linux/clone-internal.c -@@ -52,7 +52,7 @@ __clone_internal (struct clone_args *cl_args, - /* Try clone3 first. */ - int saved_errno = errno; - ret = __clone3 (cl_args, sizeof (*cl_args), func, arg); -- if (ret != -1 || errno != ENOSYS) -+ if (ret != -1 || (errno != ENOSYS && errno != EPERM)) - return ret; - - /* NB: Restore errno since errno may be checked against non-zero --- -2.30.2 - diff --git a/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch b/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch index 3ff485b1e3..546fe58214 100644 --- a/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch +++ b/meta/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 8778429a3345bb5c0361332cf5103f394717a396 Mon Sep 17 00:00:00 2001 From: Jason Wessel Date: Sat, 7 Dec 2019 09:59:22 -0800 Subject: [PATCH] localedef: Add hardlink resolver from util-linux diff --git a/meta/recipes-core/glibc/glibc/0002-CVE-2021-38604.patch b/meta/recipes-core/glibc/glibc/0002-CVE-2021-38604.patch deleted file mode 100644 index 9f71fecddb..0000000000 --- a/meta/recipes-core/glibc/glibc/0002-CVE-2021-38604.patch +++ /dev/null @@ -1,150 +0,0 @@ -From 4cc79c217744743077bf7a0ec5e0a4318f1e6641 Mon Sep 17 00:00:00 2001 -From: Nikita Popov -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 -Reviewed-by: Siddhesh Poyarekar -Signed-off-by: Vinay Kumar ---- - 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 -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+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 --- -2.31.1 - diff --git a/meta/recipes-core/glibc/glibc/0002-CVE-2021-3998.patch b/meta/recipes-core/glibc/glibc/0002-CVE-2021-3998.patch deleted file mode 100644 index 0a4c34452d..0000000000 --- a/meta/recipes-core/glibc/glibc/0002-CVE-2021-3998.patch +++ /dev/null @@ -1,138 +0,0 @@ -From f7a79879c0b2bef0dadd6caaaeeb0d26423e04e5 Mon Sep 17 00:00:00 2001 -From: Siddhesh Poyarekar -Date: Thu, 13 Jan 2022 11:28:36 +0530 -Subject: [PATCH] realpath: Set errno to ENAMETOOLONG for result larger than - PATH_MAX [BZ #28770] - -realpath returns an allocated string when the result exceeds PATH_MAX, -which is unexpected when its second argument is not NULL. This results -in the second argument (resolved) being uninitialized and also results -in a memory leak since the caller expects resolved to be the same as the -returned value. - -Return NULL and set errno to ENAMETOOLONG if the result exceeds -PATH_MAX. This fixes [BZ #28770], which is CVE-2021-3998. - -Reviewed-by: Adhemerval Zanella -Signed-off-by: Siddhesh Poyarekar -(cherry picked from commit ee8d5e33adb284601c00c94687bc907e10aec9bb) - -Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=f7a79879c0b2bef0dadd6caaaeeb0d26423e04e5] -CVE: CVE-2021-3998 - -Signed-off-by: Pgowda ---- - NEWS | 4 +++ - stdlib/Makefile | 1 + - stdlib/canonicalize.c | 12 +++++++-- - stdlib/tst-realpath-toolong.c | 49 +++++++++++++++++++++++++++++++++++ - 4 files changed, 64 insertions(+), 2 deletions(-) - create mode 100644 stdlib/tst-realpath-toolong.c - -diff --git a/NEWS b/NEWS -index 7e773bd005..b4f81c2668 100644 ---- a/NEWS -+++ b/NEWS -@@ -210,6 +210,10 @@ Security related changes: - legacy function could result in a stack-based buffer overflow when - using the "unix" protocol. Reported by Martin Sebor. - -+ CVE-2021-3998: Passing a path longer than PATH_MAX to the realpath -+ function could result in a memory leak and potential access of -+ uninitialized memory. Reported by Qualys. -+ - The following bugs are resolved with this release: - - [4737] libc: fork is not async-signal-safe -diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c -index 698f9ede25..7a23a51b3a 100644 ---- a/stdlib/canonicalize.c -+++ b/stdlib/canonicalize.c -@@ -400,8 +400,16 @@ realpath_stk (const char *name, char *re - - error: - *dest++ = '\0'; -- if (resolved != NULL && dest - rname <= get_path_max ()) -- rname = strcpy (resolved, rname); -+ if (resolved != NULL) -+ { -+ if (dest - rname <= get_path_max ()) -+ rname = strcpy (resolved, rname); -+ else -+ { -+ failed = true; -+ __set_errno (ENAMETOOLONG); -+ } -+ } - - error_nomem: - scratch_buffer_free (&extra_buffer); -diff --git a/stdlib/Makefile b/stdlib/Makefile -index 9bb5c221e8..a4ac30d1f6 100644 ---- a/stdlib/Makefile -+++ b/stdlib/Makefile -@@ -88,7 +88,8 @@ tests := tst-strtol tst-strtod testmb t - tst-swapcontext1 tst-setcontext4 tst-setcontext5 \ - tst-setcontext6 tst-setcontext7 tst-setcontext8 \ - tst-setcontext9 tst-bz20544 tst-canon-bz26341 \ -- tst-realpath -+ tst-realpath \ -+ tst-realpath-toolong - - tests-internal := tst-strtod1i tst-strtod3 tst-strtod4 tst-strtod5i \ - tst-tls-atexit tst-tls-atexit-nodelete -diff --git a/stdlib/tst-realpath-toolong.c b/stdlib/tst-realpath-toolong.c -new file mode 100644 -index 0000000000..8bed772460 ---- /dev/null -+++ b/stdlib/tst-realpath-toolong.c -@@ -0,0 +1,49 @@ -+/* Verify that realpath returns NULL with ENAMETOOLONG if the result exceeds -+ NAME_MAX. -+ Copyright 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 -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define BASENAME "tst-realpath-toolong." -+ -+int -+do_test (void) -+{ -+ char *base = support_create_and_chdir_toolong_temp_directory (BASENAME); -+ -+ char buf[PATH_MAX + 1]; -+ const char *res = realpath (".", buf); -+ -+ /* canonicalize.c states that if the real path is >= PATH_MAX, then -+ realpath returns NULL and sets ENAMETOOLONG. */ -+ TEST_VERIFY (res == NULL); -+ TEST_VERIFY (errno == ENAMETOOLONG); -+ -+ free (base); -+ return 0; -+} -+ -+#include diff --git a/meta/recipes-core/glibc/glibc/0002-CVE-2021-3999.patch b/meta/recipes-core/glibc/glibc/0002-CVE-2021-3999.patch deleted file mode 100644 index ef3a504fdf..0000000000 --- a/meta/recipes-core/glibc/glibc/0002-CVE-2021-3999.patch +++ /dev/null @@ -1,357 +0,0 @@ -From 472e799a5f2102bc0c3206dbd5a801765fceb39c Mon Sep 17 00:00:00 2001 -From: Siddhesh Poyarekar -Date: Fri, 21 Jan 2022 23:32:56 +0530 -Subject: [PATCH] getcwd: Set errno to ERANGE for size == 1 (CVE-2021-3999) - -No valid path returned by getcwd would fit into 1 byte, so reject the -size early and return NULL with errno set to ERANGE. This change is -prompted by CVE-2021-3999, which describes a single byte buffer -underflow and overflow when all of the following conditions are met: - -- The buffer size (i.e. the second argument of getcwd) is 1 byte -- The current working directory is too long -- '/' is also mounted on the current working directory - -Sequence of events: - -- In sysdeps/unix/sysv/linux/getcwd.c, the syscall returns ENAMETOOLONG - because the linux kernel checks for name length before it checks - buffer size - -- The code falls back to the generic getcwd in sysdeps/posix - -- In the generic func, the buf[0] is set to '\0' on line 250 - -- this while loop on line 262 is bypassed: - - while (!(thisdev == rootdev && thisino == rootino)) - - since the rootfs (/) is bind mounted onto the directory and the flow - goes on to line 449, where it puts a '/' in the byte before the - buffer. - -- Finally on line 458, it moves 2 bytes (the underflowed byte and the - '\0') to the buf[0] and buf[1], resulting in a 1 byte buffer overflow. - -- buf is returned on line 469 and errno is not set. - -This resolves BZ #28769. - -Reviewed-by: Andreas Schwab -Reviewed-by: Adhemerval Zanella -Signed-off-by: Qualys Security Advisory -Signed-off-by: Siddhesh Poyarekar -(cherry picked from commit 23e0e8f5f1fb5ed150253d986ecccdc90c2dcd5e) - -Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=472e799a5f2102bc0c3206dbd5a801765fceb39c] -CVE: CVE-2021-3999 - -Signed-off-by: Pgowda ---- - NEWS | 6 + - sysdeps/posix/getcwd.c | 7 + - sysdeps/unix/sysv/linux/Makefile | 7 +- - .../unix/sysv/linux/tst-getcwd-smallbuff.c | 241 ++++++++++++++++++ - 4 files changed, 260 insertions(+), 1 deletion(-) - create mode 100644 sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c - -diff --git a/NEWS b/NEWS -index b4f81c2668..8d7467d2c1 100644 ---- a/NEWS -+++ b/NEWS -@@ -214,6 +214,12 @@ Security related changes: - function could result in a memory leak and potential access of - uninitialized memory. Reported by Qualys. - -+ CVE-2021-3999: Passing a buffer of size exactly 1 byte to the getcwd -+ function may result in an off-by-one buffer underflow and overflow -+ when the current working directory is longer than PATH_MAX and also -+ corresponds to the / directory through an unprivileged mount -+ namespace. Reported by Qualys. -+ - The following bugs are resolved with this release: - - [4737] libc: fork is not async-signal-safe -diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c -index 13680026ff..b6984a382c 100644 ---- a/sysdeps/posix/getcwd.c -+++ b/sysdeps/posix/getcwd.c -@@ -187,6 +187,13 @@ __getcwd_generic (char *buf, size_t size - size_t allocated = size; - size_t used; - -+ /* A size of 1 byte is never useful. */ -+ if (allocated == 1) -+ { -+ __set_errno (ERANGE); -+ return NULL; -+ } -+ - #if HAVE_MINIMALLY_WORKING_GETCWD - /* If AT_FDCWD is not defined, the algorithm below is O(N**2) and - this is much slower than the system getcwd (at least on -diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile -index 76ad06361c..9380d3848d 100644 ---- a/sysdeps/unix/sysv/linux/Makefile -+++ b/sysdeps/unix/sysv/linux/Makefile -@@ -331,7 +331,12 @@ sysdep_routines += xstatconv internal_st - - sysdep_headers += bits/fcntl-linux.h - --tests += tst-fallocate tst-fallocate64 tst-o_path-locks -+tests += \ -+ tst-fallocate \ -+ tst-fallocate64 \ -+ tst-getcwd-smallbuff \ -+ tst-o_path-locks \ -+# tests - endif - - ifeq ($(subdir),elf) -diff --git a/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c b/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c -new file mode 100644 -index 0000000000..d460d6e766 ---- /dev/null -+++ b/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c -@@ -0,0 +1,241 @@ -+/* Verify that getcwd returns ERANGE for size 1 byte and does not underflow -+ buffer when the CWD is too long and is also a mount target of /. See bug -+ #28769 or CVE-2021-3999 for more context. -+ Copyright 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 -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static char *base; -+#define BASENAME "tst-getcwd-smallbuff" -+#define MOUNT_NAME "mpoint" -+static int sockfd[2]; -+ -+static void -+do_cleanup (void) -+{ -+ support_chdir_toolong_temp_directory (base); -+ TEST_VERIFY_EXIT (rmdir (MOUNT_NAME) == 0); -+ free (base); -+} -+ -+static void -+send_fd (const int sock, const int fd) -+{ -+ struct msghdr msg = {0}; -+ union -+ { -+ struct cmsghdr hdr; -+ char buf[CMSG_SPACE (sizeof (int))]; -+ } cmsgbuf = {0}; -+ struct cmsghdr *cmsg; -+ struct iovec vec; -+ char ch = 'A'; -+ ssize_t n; -+ -+ msg.msg_control = &cmsgbuf.buf; -+ msg.msg_controllen = sizeof (cmsgbuf.buf); -+ -+ cmsg = CMSG_FIRSTHDR (&msg); -+ cmsg->cmsg_len = CMSG_LEN (sizeof (int)); -+ cmsg->cmsg_level = SOL_SOCKET; -+ cmsg->cmsg_type = SCM_RIGHTS; -+ memcpy (CMSG_DATA (cmsg), &fd, sizeof (fd)); -+ -+ vec.iov_base = &ch; -+ vec.iov_len = 1; -+ msg.msg_iov = &vec; -+ msg.msg_iovlen = 1; -+ -+ while ((n = sendmsg (sock, &msg, 0)) == -1 && errno == EINTR); -+ -+ TEST_VERIFY_EXIT (n == 1); -+} -+ -+static int -+recv_fd (const int sock) -+{ -+ struct msghdr msg = {0}; -+ union -+ { -+ struct cmsghdr hdr; -+ char buf[CMSG_SPACE(sizeof(int))]; -+ } cmsgbuf = {0}; -+ struct cmsghdr *cmsg; -+ struct iovec vec; -+ ssize_t n; -+ char ch = '\0'; -+ int fd = -1; -+ -+ vec.iov_base = &ch; -+ vec.iov_len = 1; -+ msg.msg_iov = &vec; -+ msg.msg_iovlen = 1; -+ -+ msg.msg_control = &cmsgbuf.buf; -+ msg.msg_controllen = sizeof (cmsgbuf.buf); -+ -+ while ((n = recvmsg (sock, &msg, 0)) == -1 && errno == EINTR); -+ if (n != 1 || ch != 'A') -+ return -1; -+ -+ cmsg = CMSG_FIRSTHDR (&msg); -+ if (cmsg == NULL) -+ return -1; -+ if (cmsg->cmsg_type != SCM_RIGHTS) -+ return -1; -+ memcpy (&fd, CMSG_DATA (cmsg), sizeof (fd)); -+ if (fd < 0) -+ return -1; -+ return fd; -+} -+ -+static int -+child_func (void * const arg) -+{ -+ xclose (sockfd[0]); -+ const int sock = sockfd[1]; -+ char ch; -+ -+ TEST_VERIFY_EXIT (read (sock, &ch, 1) == 1); -+ TEST_VERIFY_EXIT (ch == '1'); -+ -+ if (mount ("/", MOUNT_NAME, NULL, MS_BIND | MS_REC, NULL)) -+ FAIL_EXIT1 ("mount failed: %m\n"); -+ const int fd = xopen ("mpoint", -+ O_RDONLY | O_PATH | O_DIRECTORY | O_NOFOLLOW, 0); -+ -+ send_fd (sock, fd); -+ xclose (fd); -+ -+ TEST_VERIFY_EXIT (read (sock, &ch, 1) == 1); -+ TEST_VERIFY_EXIT (ch == 'a'); -+ -+ xclose (sock); -+ return 0; -+} -+ -+static void -+update_map (char * const mapping, const char * const map_file) -+{ -+ const size_t map_len = strlen (mapping); -+ -+ const int fd = xopen (map_file, O_WRONLY, 0); -+ xwrite (fd, mapping, map_len); -+ xclose (fd); -+} -+ -+static void -+proc_setgroups_write (const long child_pid, const char * const str) -+{ -+ const size_t str_len = strlen(str); -+ -+ char setgroups_path[sizeof ("/proc//setgroups") + INT_STRLEN_BOUND (long)]; -+ -+ snprintf (setgroups_path, sizeof (setgroups_path), -+ "/proc/%ld/setgroups", child_pid); -+ -+ const int fd = open (setgroups_path, O_WRONLY); -+ -+ if (fd < 0) -+ { -+ TEST_VERIFY_EXIT (errno == ENOENT); -+ FAIL_UNSUPPORTED ("/proc/%ld/setgroups not found\n", child_pid); -+ } -+ -+ xwrite (fd, str, str_len); -+ xclose(fd); -+} -+ -+static char child_stack[1024 * 1024]; -+ -+int -+do_test (void) -+{ -+ base = support_create_and_chdir_toolong_temp_directory (BASENAME); -+ -+ xmkdir (MOUNT_NAME, S_IRWXU); -+ atexit (do_cleanup); -+ -+ TEST_VERIFY_EXIT (socketpair (AF_UNIX, SOCK_STREAM, 0, sockfd) == 0); -+ pid_t child_pid = xclone (child_func, NULL, child_stack, -+ sizeof (child_stack), -+ CLONE_NEWUSER | CLONE_NEWNS | SIGCHLD); -+ -+ xclose (sockfd[1]); -+ const int sock = sockfd[0]; -+ -+ char map_path[sizeof ("/proc//uid_map") + INT_STRLEN_BOUND (long)]; -+ char map_buf[sizeof ("0 1") + INT_STRLEN_BOUND (long)]; -+ -+ snprintf (map_path, sizeof (map_path), "/proc/%ld/uid_map", -+ (long) child_pid); -+ snprintf (map_buf, sizeof (map_buf), "0 %ld 1", (long) getuid()); -+ update_map (map_buf, map_path); -+ -+ proc_setgroups_write ((long) child_pid, "deny"); -+ snprintf (map_path, sizeof (map_path), "/proc/%ld/gid_map", -+ (long) child_pid); -+ snprintf (map_buf, sizeof (map_buf), "0 %ld 1", (long) getgid()); -+ update_map (map_buf, map_path); -+ -+ TEST_VERIFY_EXIT (send (sock, "1", 1, MSG_NOSIGNAL) == 1); -+ const int fd = recv_fd (sock); -+ TEST_VERIFY_EXIT (fd >= 0); -+ TEST_VERIFY_EXIT (fchdir (fd) == 0); -+ -+ static char buf[2 * 10 + 1]; -+ memset (buf, 'A', sizeof (buf)); -+ -+ /* Finally, call getcwd and check if it resulted in a buffer underflow. */ -+ char * cwd = getcwd (buf + sizeof (buf) / 2, 1); -+ TEST_VERIFY (cwd == NULL); -+ TEST_VERIFY (errno == ERANGE); -+ -+ for (int i = 0; i < sizeof (buf); i++) -+ if (buf[i] != 'A') -+ { -+ printf ("buf[%d] = %02x\n", i, (unsigned int) buf[i]); -+ support_record_failure (); -+ } -+ -+ TEST_VERIFY_EXIT (send (sock, "a", 1, MSG_NOSIGNAL) == 1); -+ xclose (sock); -+ TEST_VERIFY_EXIT (xwaitpid (child_pid, NULL, 0) == child_pid); -+ -+ return 0; -+} -+ -+#define CLEANUP_HANDLER do_cleanup -+#include diff --git a/meta/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch b/meta/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch deleted file mode 100644 index 00fb3266c6..0000000000 --- a/meta/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch +++ /dev/null @@ -1,126 +0,0 @@ -From f545ad4928fa1f27a3075265182b38a4f939a5f7 Mon Sep 17 00:00:00 2001 -From: Florian Weimer -Date: Mon, 17 Jan 2022 10:21:34 +0100 -Subject: [PATCH] CVE-2022-23218: Buffer overflow in sunrpc svcunix_create (bug - 28768) - -The sunrpc function svcunix_create suffers from a stack-based buffer -overflow with overlong pathname arguments. - -Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=f545ad4928fa1f27a3075265182b38a4f939a5f7] -CVE: CVE-2022-23218 - -Reviewed-by: Siddhesh Poyarekar -Signed-off-by: Pgowda ---- - NEWS | 3 +++ - sunrpc/Makefile | 2 +- - sunrpc/svc_unix.c | 11 ++++------- - sunrpc/tst-bug28768.c | 42 ++++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 50 insertions(+), 8 deletions(-) - create mode 100644 sunrpc/tst-bug28768.c - -diff --git a/NEWS b/NEWS -index 38a9ddb2cf..38802f0673 100644 ---- a/NEWS -+++ b/NEWS -@@ -203,6 +203,9 @@ Security related changes: - parameter number when processing the expansion resulting in a crash. - Reported by Philippe Antoine. - -+ CVE-2022-23218: Passing an overlong file name to the svcunix_create -+ legacy function could result in a stack-based buffer overflow. -+ - The following bugs are resolved with this release: - - [4737] libc: fork is not async-signal-safe -diff --git a/sunrpc/Makefile b/sunrpc/Makefile -index 183ef3dc55..a79a7195fc 100644 ---- a/sunrpc/Makefile -+++ b/sunrpc/Makefile -@@ -65,7 +65,7 @@ shared-only-routines = $(routines) - endif - - tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error tst-udp-timeout \ -- tst-udp-nonblocking -+ tst-udp-nonblocking tst-bug28768 - xtests := tst-getmyaddr - - ifeq ($(have-thread-library),yes) -diff --git a/sunrpc/svc_unix.c b/sunrpc/svc_unix.c -index f2280b4c49..67177a2e78 100644 ---- a/sunrpc/svc_unix.c -+++ b/sunrpc/svc_unix.c -@@ -154,7 +154,10 @@ svcunix_create (int sock, u_int sendsize - SVCXPRT *xprt; - struct unix_rendezvous *r; - struct sockaddr_un addr; -- socklen_t len = sizeof (struct sockaddr_in); -+ socklen_t len = sizeof (addr); -+ -+ if (__sockaddr_un_set (&addr, path) < 0) -+ return NULL; - - if (sock == RPC_ANYSOCK) - { -@@ -165,12 +168,6 @@ svcunix_create (int sock, u_int sendsize - } - madesock = TRUE; - } -- memset (&addr, '\0', sizeof (addr)); -- addr.sun_family = AF_UNIX; -- len = strlen (path) + 1; -- memcpy (addr.sun_path, path, len); -- len += sizeof (addr.sun_family); -- - __bind (sock, (struct sockaddr *) &addr, len); - - if (__getsockname (sock, (struct sockaddr *) &addr, &len) != 0 -diff --git a/sunrpc/tst-bug28768.c b/sunrpc/tst-bug28768.c -new file mode 100644 -index 0000000000..35a4b7b0b3 ---- /dev/null -+++ b/sunrpc/tst-bug28768.c -@@ -0,0 +1,42 @@ -+/* Test to verify that long path is rejected by svcunix_create (bug 28768). -+ 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 -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+/* svcunix_create does not have a default version in linkobj/libc.so. */ -+compat_symbol_reference (libc, svcunix_create, svcunix_create, GLIBC_2_1); -+ -+static int -+do_test (void) -+{ -+ char pathname[109]; -+ memset (pathname, 'x', sizeof (pathname)); -+ pathname[sizeof (pathname) - 1] = '\0'; -+ -+ errno = 0; -+ TEST_VERIFY (svcunix_create (RPC_ANYSOCK, 4096, 4096, pathname) == NULL); -+ TEST_COMPARE (errno, EINVAL); -+ -+ return 0; -+} -+ -+#include diff --git a/meta/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch b/meta/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch deleted file mode 100644 index 6779e9afdf..0000000000 --- a/meta/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch +++ /dev/null @@ -1,89 +0,0 @@ -From ef972a4c50014a16132b5c75571cfb6b30bef136 Mon Sep 17 00:00:00 2001 -From: Martin Sebor -Date: Mon, 17 Jan 2022 10:21:34 +0100 -Subject: [PATCH] sunrpc: Test case for clnt_create "unix" buffer overflow (bug - 22542) - -Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=ef972a4c50014a16132b5c75571cfb6b30bef136] -CVE: CVE-2022-23219 - -Reviewed-by: Siddhesh Poyarekar -Signed-off-by: Pgowda ---- - sunrpc/Makefile | 5 ++++- - sunrpc/tst-bug22542.c | 44 +++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 48 insertions(+), 1 deletion(-) - create mode 100644 sunrpc/tst-bug22542.c - -diff --git a/sunrpc/Makefile b/sunrpc/Makefile -index 9a31fe48b9..183ef3dc55 100644 ---- a/sunrpc/Makefile -+++ b/sunrpc/Makefile -@@ -65,7 +65,7 @@ shared-only-routines = $(routines) - endif - - tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error tst-udp-timeout \ -- tst-udp-nonblocking tst-bug28768 -+ tst-udp-nonblocking tst-bug22542 tst-bug28768 - xtests := tst-getmyaddr - - ifeq ($(have-thread-library),yes) -@@ -110,6 +110,8 @@ $(objpfx)tst-udp-nonblocking: $(common-o - $(objpfx)tst-udp-garbage: \ - $(common-objpfx)linkobj/libc.so $(shared-thread-library) - -+$(objpfx)tst-bug22542: $(common-objpfx)linkobj/libc.so -+ - else # !have-GLIBC_2.31 - - routines = $(routines-for-nss) -diff --git a/sunrpc/tst-bug22542.c b/sunrpc/tst-bug22542.c -new file mode 100644 -index 0000000000..d6cd79787b ---- /dev/null -+++ b/sunrpc/tst-bug22542.c -@@ -0,0 +1,44 @@ -+/* Test to verify that overlong hostname is rejected by clnt_create -+ and doesn't cause a buffer overflow (bug 22542). -+ -+ 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 -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static int -+do_test (void) -+{ -+ /* Create an arbitrary hostname that's longer than fits in sun_path. */ -+ char name [sizeof ((struct sockaddr_un*)0)->sun_path * 2]; -+ memset (name, 'x', sizeof name - 1); -+ name [sizeof name - 1] = '\0'; -+ -+ errno = 0; -+ CLIENT *clnt = clnt_create (name, 0, 0, "unix"); -+ -+ TEST_VERIFY (clnt == NULL); -+ TEST_COMPARE (errno, EINVAL); -+ return 0; -+} -+ -+#include diff --git a/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch b/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch index 2445aa56b3..94a05cf954 100644 --- a/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch +++ b/meta/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 87a69126d97bb8d5d52e34e451b4a7076efd6bed Mon Sep 17 00:00:00 2001 From: Jason Wessel Date: Sat, 7 Dec 2019 10:01:37 -0800 Subject: [PATCH] localedef: fix-ups hardlink to make it compile diff --git a/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch b/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch index 210cc1076c..9a605078b9 100644 --- a/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch +++ b/meta/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 752b0d32fc96728ee624dbd62bf23e034d8d2aed Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 18 Mar 2015 01:48:24 +0000 Subject: [PATCH] nativesdk-glibc: Look for host system ld.so.cache as well @@ -30,10 +30,10 @@ Signed-off-by: Khem Raj 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/elf/dl-load.c b/elf/dl-load.c -index a08df001af..d09daf9e41 100644 +index 721593135e..39c4657fa2 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c -@@ -2196,6 +2196,14 @@ _dl_map_object (struct link_map *loader, const char *name, +@@ -2208,6 +2208,14 @@ _dl_map_object (struct link_map *loader, const char *name, } } @@ -48,7 +48,7 @@ index a08df001af..d09daf9e41 100644 #ifdef USE_LDCONFIG if (fd == -1 && (__glibc_likely ((mode & __RTLD_SECURE) == 0) -@@ -2254,14 +2262,6 @@ _dl_map_object (struct link_map *loader, const char *name, +@@ -2266,14 +2274,6 @@ _dl_map_object (struct link_map *loader, const char *name, } #endif diff --git a/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch b/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch index 010b816e11..da288d6ccf 100644 --- a/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch +++ b/meta/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 2f7407697f2a905fedb98037152e7830f73bc6c6 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 18 Mar 2015 01:50:00 +0000 Subject: [PATCH] nativesdk-glibc: Fix buffer overrun with a relocated SDK @@ -21,10 +21,10 @@ Signed-off-by: Khem Raj 1 file changed, 12 insertions(+) diff --git a/elf/dl-load.c b/elf/dl-load.c -index d09daf9e41..2c6270e2a7 100644 +index 39c4657fa2..daa3af6c51 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c -@@ -1892,7 +1892,19 @@ open_path (const char *name, size_t namelen, int mode, +@@ -1904,7 +1904,19 @@ open_path (const char *name, size_t namelen, int mode, given on the command line when rtld is run directly. */ return -1; diff --git a/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch b/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch index bf9f3e36ca..14bcaf3ef9 100644 --- a/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch +++ b/meta/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 88a31cd08801df53249963f3b26c7dbcee6ae2f8 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 18 Mar 2015 01:51:38 +0000 Subject: [PATCH] nativesdk-glibc: Raise the size of arrays containing dl paths @@ -41,10 +41,10 @@ index 2b8da8650d..3d9787bda4 100644 _dl_cache_libcmp (const char *p1, const char *p2) { diff --git a/elf/dl-load.c b/elf/dl-load.c -index 2c6270e2a7..23018d2f7e 100644 +index daa3af6c51..e323952993 100644 --- a/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. */ #include "trusted-dirs.h" @@ -98,10 +98,10 @@ index 91966702ca..dc86c20e83 100644 +const char __invoke_dynamic_linker__[4096] __attribute__ ((section (".interp"))) = RUNTIME_LINKER; diff --git a/elf/ldconfig.c b/elf/ldconfig.c -index 1037e8d0cf..ffdac84952 100644 +index 101d56ac8e..33debef60a 100644 --- a/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 }; @@ -112,10 +112,10 @@ index 1037e8d0cf..ffdac84952 100644 a platform. */ static int diff --git a/elf/rtld.c b/elf/rtld.c -index fbbd60b446..fce9940f80 100644 +index 4b09e84b0d..56d93ff616 100644 --- a/elf/rtld.c +++ b/elf/rtld.c -@@ -185,6 +185,7 @@ dso_name_valid_for_suid (const char *p) +@@ -193,6 +193,7 @@ dso_name_valid_for_suid (const char *p) } return *p != '\0'; } @@ -124,10 +124,10 @@ index fbbd60b446..fce9940f80 100644 static void audit_list_init (struct audit_list *list) diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c -index 62bee28769..67b60dc88c 100644 +index 077082af66..46b6152455 100644 --- a/iconv/gconv_conf.c +++ b/iconv/gconv_conf.c -@@ -36,7 +36,7 @@ +@@ -35,7 +35,7 @@ #include /* This is the default path where we look for module lists. */ diff --git a/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch b/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch index 3a37f7af72..493b2daad3 100644 --- a/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch +++ b/meta/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 a1fbd7ef1da02f334ff72c52cb11116164649067 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Thu, 31 Dec 2015 14:35:35 -0800 Subject: [PATCH] nativesdk-glibc: Allow 64 bit atomics for x86 @@ -13,14 +13,14 @@ Signed-off-by: Juro Bystricky Signed-off-by: Richard Purdie Signed-off-by: Khem Raj --- - 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 -index 695222e4fa..9d39bfdbd5 100644 +index 2692d94a92..9d39bfdbd5 100644 --- a/sysdeps/x86/atomic-machine.h +++ b/sysdeps/x86/atomic-machine.h -@@ -52,15 +52,14 @@ typedef uintmax_t uatomic_max_t; +@@ -52,19 +52,14 @@ typedef uintmax_t uatomic_max_t; #define LOCK_PREFIX "lock;" #define USE_ATOMIC_COMPILER_BUILTINS 1 @@ -33,6 +33,10 @@ index 695222e4fa..9d39bfdbd5 100644 # define BR_CONSTRAINT "q" # define IBR_CONSTRAINT "iq" #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 SP_REG "esp" # define SEG_REG "gs" diff --git a/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch b/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch index d763178f21..b40d2bdef6 100644 --- a/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch +++ b/meta/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 bf1603b3d73f64de777be00f7e55f2cfef596102 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 3 Aug 2018 09:55:12 -0700 Subject: [PATCH] nativesdk-glibc: Make relocatable install for locales @@ -19,10 +19,10 @@ Signed-off-by: Khem Raj 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/locale/findlocale.c b/locale/findlocale.c -index ab09122b0c..f42cc75780 100644 +index 5986373edd..856ba9afc0 100644 --- a/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. */ 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 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. */ locale_path = _nl_default_locale_path; @@ -67,10 +67,10 @@ index b3d4da0185..22f9dc1140 100644 /* Load the locale data for CATEGORY from the file specified by *NAME. If *NAME is "", use environment variables as specified by POSIX, and diff --git a/locale/programs/locale.c b/locale/programs/locale.c -index ca0a95be99..6b98895203 100644 +index e9275d6b83..a9109155e5 100644 --- a/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); } @@ -78,7 +78,7 @@ index ca0a95be99..6b98895203 100644 static int 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; uint32_t cnt; @@ -87,7 +87,7 @@ index ca0a95be99..6b98895203 100644 if (fd < 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) putchar_unlocked ('\n'); diff --git a/meta/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch b/meta/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch index f4fc1d68c4..a47dd5331a 100644 --- a/meta/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch +++ b/meta/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 78b2e81940561069faf7698931a033784f794e40 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 6 Mar 2021 14:48:56 -0800 Subject: [PATCH] nativesdk-glibc: Fall back to faccessat on faccess2 returns diff --git a/meta/recipes-core/glibc/glibc/0009-yes-within-the-path-sets-wrong-config-variables.patch b/meta/recipes-core/glibc/glibc/0009-yes-within-the-path-sets-wrong-config-variables.patch new file mode 100644 index 0000000000..77644a2ee3 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0009-yes-within-the-path-sets-wrong-config-variables.patch @@ -0,0 +1,260 @@ +From f6e96a95212bc1fef57b9594a7dddc0c20639873 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:31:06 +0000 +Subject: [PATCH] 'yes' within the path sets wrong config variables + +It seems that the 'AC_EGREP_CPP(yes...' example is quite popular +but being such a short word to grep it is likely to produce +false-positive matches with the path it is configured into. + +The change is to use a more elaborated string to grep for. + +Upstream-Status: Submitted [libc-alpha@sourceware.org] + +Signed-off-by: Benjamin Esquivel +Signed-off-by: Khem Raj +--- + sysdeps/aarch64/configure | 4 ++-- + sysdeps/aarch64/configure.ac | 4 ++-- + sysdeps/arm/configure | 4 ++-- + sysdeps/arm/configure.ac | 4 ++-- + sysdeps/mips/configure | 4 ++-- + sysdeps/mips/configure.ac | 4 ++-- + sysdeps/nios2/configure | 4 ++-- + sysdeps/nios2/configure.ac | 4 ++-- + sysdeps/unix/sysv/linux/mips/configure | 4 ++-- + sysdeps/unix/sysv/linux/mips/configure.ac | 4 ++-- + sysdeps/unix/sysv/linux/powerpc/powerpc64/configure | 8 ++++---- + sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac | 8 ++++---- + 12 files changed, 28 insertions(+), 28 deletions(-) + +diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure +index 4c1fac49f3..597314f476 100644 +--- a/sysdeps/aarch64/configure ++++ b/sysdeps/aarch64/configure +@@ -157,12 +157,12 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #ifdef __AARCH64EB__ +- yes ++ is_aarch64_be + #endif + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1; then : ++ $EGREP "is_aarch64_be" >/dev/null 2>&1; then : + libc_cv_aarch64_be=yes + else + libc_cv_aarch64_be=no +diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac +index 3347c13fa1..4af163c0b6 100644 +--- a/sysdeps/aarch64/configure.ac ++++ b/sysdeps/aarch64/configure.ac +@@ -17,8 +17,8 @@ AC_DEFINE(SUPPORT_STATIC_PIE) + # the dynamic linker via %ifdef. + AC_CACHE_CHECK([for big endian], + [libc_cv_aarch64_be], +- [AC_EGREP_CPP(yes,[#ifdef __AARCH64EB__ +- yes ++ [AC_EGREP_CPP(is_aarch64_be,[#ifdef __AARCH64EB__ ++ is_aarch64_be + #endif + ], libc_cv_aarch64_be=yes, libc_cv_aarch64_be=no)]) + if test $libc_cv_aarch64_be = yes; then +diff --git a/sysdeps/arm/configure b/sysdeps/arm/configure +index 431e843b2b..e152461138 100644 +--- a/sysdeps/arm/configure ++++ b/sysdeps/arm/configure +@@ -151,12 +151,12 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #ifdef __ARM_PCS_VFP +- yes ++ use_arm_pcs_vfp + #endif + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1; then : ++ $EGREP "use_arm_pcs_vfp" >/dev/null 2>&1; then : + libc_cv_arm_pcs_vfp=yes + else + libc_cv_arm_pcs_vfp=no +diff --git a/sysdeps/arm/configure.ac b/sysdeps/arm/configure.ac +index 90cdd69c75..05a262ba00 100644 +--- a/sysdeps/arm/configure.ac ++++ b/sysdeps/arm/configure.ac +@@ -15,8 +15,8 @@ AC_DEFINE(PI_STATIC_AND_HIDDEN) + # the dynamic linker via %ifdef. + AC_CACHE_CHECK([whether the compiler is using the ARM hard-float ABI], + [libc_cv_arm_pcs_vfp], +- [AC_EGREP_CPP(yes,[#ifdef __ARM_PCS_VFP +- yes ++ [AC_EGREP_CPP(use_arm_pcs_vfp,[#ifdef __ARM_PCS_VFP ++ use_arm_pcs_vfp + #endif + ], libc_cv_arm_pcs_vfp=yes, libc_cv_arm_pcs_vfp=no)]) + if test $libc_cv_arm_pcs_vfp = yes; then +diff --git a/sysdeps/mips/configure b/sysdeps/mips/configure +index 4e13248c03..f14af952d0 100644 +--- a/sysdeps/mips/configure ++++ b/sysdeps/mips/configure +@@ -143,11 +143,11 @@ else + /* end confdefs.h. */ + dnl + #ifdef __mips_nan2008 +-yes ++use_mips_nan2008 + #endif + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1; then : ++ $EGREP "use_mips_nan2008" >/dev/null 2>&1; then : + libc_cv_mips_nan2008=yes + else + libc_cv_mips_nan2008=no +diff --git a/sysdeps/mips/configure.ac b/sysdeps/mips/configure.ac +index bcbdaffd9f..ad3057f4cc 100644 +--- a/sysdeps/mips/configure.ac ++++ b/sysdeps/mips/configure.ac +@@ -6,9 +6,9 @@ dnl position independent way. + dnl AC_DEFINE(PI_STATIC_AND_HIDDEN) + + 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(use_mips_nan2008, [dnl + #ifdef __mips_nan2008 +-yes ++use_mips_nan2008 + #endif], libc_cv_mips_nan2008=yes, libc_cv_mips_nan2008=no)]) + if test x$libc_cv_mips_nan2008 = xyes; then + AC_DEFINE(HAVE_MIPS_NAN2008) +diff --git a/sysdeps/nios2/configure b/sysdeps/nios2/configure +index 14c8a3a014..dde3814ef2 100644 +--- a/sysdeps/nios2/configure ++++ b/sysdeps/nios2/configure +@@ -142,12 +142,12 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #ifdef __nios2_big_endian__ +- yes ++ is_nios2_be + #endif + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1; then : ++ $EGREP "is_nios2_be" >/dev/null 2>&1; then : + libc_cv_nios2_be=yes + else + libc_cv_nios2_be=no +diff --git a/sysdeps/nios2/configure.ac b/sysdeps/nios2/configure.ac +index f05f43802b..dc8639902d 100644 +--- a/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. + # Nios II big endian is not yet supported. + AC_CACHE_CHECK([for big endian], + [libc_cv_nios2_be], +- [AC_EGREP_CPP(yes,[#ifdef __nios2_big_endian__ +- yes ++ [AC_EGREP_CPP(is_nios2_be,[#ifdef __nios2_big_endian__ ++ is_nios2_be + #endif + ], libc_cv_nios2_be=yes, libc_cv_nios2_be=no)]) + if test $libc_cv_nios2_be = yes; then +diff --git a/sysdeps/unix/sysv/linux/mips/configure b/sysdeps/unix/sysv/linux/mips/configure +index f25f2a3a65..1b7483e6c6 100644 +--- a/sysdeps/unix/sysv/linux/mips/configure ++++ b/sysdeps/unix/sysv/linux/mips/configure +@@ -414,11 +414,11 @@ else + /* end confdefs.h. */ + dnl + #ifdef __mips_nan2008 +-yes ++use_mips_nan2008 + #endif + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1; then : ++ $EGREP "use_mips_nan2008" >/dev/null 2>&1; then : + libc_cv_mips_nan2008=yes + else + libc_cv_mips_nan2008=no +diff --git a/sysdeps/unix/sysv/linux/mips/configure.ac b/sysdeps/unix/sysv/linux/mips/configure.ac +index 049a0f4bdf..005526d4e8 100644 +--- a/sysdeps/unix/sysv/linux/mips/configure.ac ++++ b/sysdeps/unix/sysv/linux/mips/configure.ac +@@ -105,9 +105,9 @@ AC_COMPILE_IFELSE( + LIBC_CONFIG_VAR([mips-mode-switch],[${libc_mips_mode_switch}]) + + 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(use_mips_nan2008, [dnl + #ifdef __mips_nan2008 +-yes ++use_mips_nan2008 + #endif], libc_cv_mips_nan2008=yes, libc_cv_mips_nan2008=no)]) + + libc_mips_nan= +diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure +index ae7f254da4..874519000b 100644 +--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure ++++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure +@@ -155,12 +155,12 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #if _CALL_ELF == 2 +- yes ++ use_ppc_elfv2_abi + #endif + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1; then : ++ $EGREP "use_ppc_elfv2_abi" >/dev/null 2>&1; then : + libc_cv_ppc64_elfv2_abi=yes + else + libc_cv_ppc64_elfv2_abi=no +@@ -188,12 +188,12 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #ifdef _CALL_ELF +- yes ++ is_def_call_elf + #endif + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1; then : ++ $EGREP "is_def_call_elf" >/dev/null 2>&1; then : + libc_cv_ppc64_def_call_elf=yes + else + libc_cv_ppc64_def_call_elf=no +diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac +index f9cba6e15d..b21f72f1e4 100644 +--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac ++++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac +@@ -6,8 +6,8 @@ LIBC_SLIBDIR_RTLDDIR([lib64], [lib64]) + # Define default-abi according to compiler flags. + AC_CACHE_CHECK([whether the compiler is using the PowerPC64 ELFv2 ABI], + [libc_cv_ppc64_elfv2_abi], +- [AC_EGREP_CPP(yes,[#if _CALL_ELF == 2 +- yes ++ [AC_EGREP_CPP(use_ppc_elfv2_abi,[#if _CALL_ELF == 2 ++ use_ppc_elfv2_abi + #endif + ], libc_cv_ppc64_elfv2_abi=yes, libc_cv_ppc64_elfv2_abi=no)]) + if test $libc_cv_ppc64_elfv2_abi = yes; then +@@ -19,8 +19,8 @@ else + # Compiler that do not support ELFv2 ABI does not define _CALL_ELF + AC_CACHE_CHECK([whether the compiler defines _CALL_ELF], + [libc_cv_ppc64_def_call_elf], +- [AC_EGREP_CPP(yes,[#ifdef _CALL_ELF +- yes ++ [AC_EGREP_CPP(is_def_call_elf,[#ifdef _CALL_ELF ++ is_def_call_elf + #endif + ], libc_cv_ppc64_def_call_elf=yes, libc_cv_ppc64_def_call_elf=no)]) + if test $libc_cv_ppc64_def_call_elf = no; then diff --git a/meta/recipes-core/glibc/glibc/0010-eglibc-Cross-building-and-testing-instructions.patch b/meta/recipes-core/glibc/glibc/0010-eglibc-Cross-building-and-testing-instructions.patch new file mode 100644 index 0000000000..295fa315d8 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0010-eglibc-Cross-building-and-testing-instructions.patch @@ -0,0 +1,616 @@ +From d6300e80c7c010fa7ca33e36e826151558cec498 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:42:58 +0000 +Subject: [PATCH] eglibc: Cross building and testing instructions + +Ported from eglibc +Upstream-Status: Pending + +Signed-off-by: Khem Raj +--- + GLIBC.cross-building | 383 +++++++++++++++++++++++++++++++++++++++++++ + GLIBC.cross-testing | 205 +++++++++++++++++++++++ + 2 files changed, 588 insertions(+) + create mode 100644 GLIBC.cross-building + create mode 100644 GLIBC.cross-testing + +diff --git a/GLIBC.cross-building b/GLIBC.cross-building +new file mode 100644 +index 0000000000..e6e0da1aaf +--- /dev/null ++++ b/GLIBC.cross-building +@@ -0,0 +1,383 @@ ++ -*- mode: text -*- ++ ++ Cross-Compiling GLIBC ++ Jim Blandy ++ ++ ++Introduction ++ ++Most GNU tools have a simple build procedure: you run their ++'configure' script, and then you run 'make'. Unfortunately, the ++process of cross-compiling the GNU C library is quite a bit more ++involved: ++ ++1) Build a cross-compiler, with certain facilities disabled. ++ ++2) Configure the C library using the compiler you built in step 1). ++ Build a few of the C run-time object files, but not the rest of the ++ library. Install the library's header files and the run-time ++ object files, and create a dummy libc.so. ++ ++3) Build a second cross-compiler, using the header files and object ++ files you installed in step 2. ++ ++4) Configure, build, and install a fresh C library, using the compiler ++ built in step 3. ++ ++5) Build a third cross-compiler, based on the C library built in step 4. ++ ++The reason for this complexity is that, although GCC and the GNU C ++library are distributed separately, they are not actually independent ++of each other: GCC requires the C library's headers and some object ++files to compile its own libraries, while the C library depends on ++GCC's libraries. GLIBC includes features and bug fixes to the stock ++GNU C library that simplify this process, but the fundamental ++interdependency stands. ++ ++In this document, we explain how to cross-compile an GLIBC/GCC pair ++from source. Our intended audience is developers who are already ++familiar with the GNU toolchain and comfortable working with ++cross-development tools. While we do present a worked example to ++accompany the explanation, for clarity's sake we do not cover many of ++the options available to cross-toolchain users. ++ ++ ++Preparation ++ ++GLIBC requires recent versions of the GNU binutils, GCC, and the ++Linux kernel. The web page ++documents the current requirements, and lists patches needed for ++certain target architectures. As of this writing, these build ++instructions have been tested with binutils 2.22.51, GCC 4.6.2, ++and Linux 3.1. ++ ++First, let's set some variables, to simplify later commands. We'll ++build GLIBC and GCC for an ARM target, known to the Linux kernel ++as 'arm', and we'll do the build on an Intel x86_64 Linux box: ++ ++ $ build=x86_64-pc-linux-gnu ++ $ host=$build ++ $ target=arm-none-linux-gnueabi ++ $ linux_arch=arm ++ ++We're using the aforementioned versions of Binutils, GCC, and Linux: ++ ++ $ binutilsv=binutils-2.22.51 ++ $ gccv=gcc-4.6.2 ++ $ linuxv=linux-3.1 ++ ++We're carrying out the entire process under '~/cross-build', which ++contains unpacked source trees for binutils, gcc, and linux kernel, ++along with GLIBC svn trunk (which can be checked-out with ++'svn co http://www.eglibc.org/svn/trunk eglibc'): ++ ++ $ top=$HOME/cross-build/$target ++ $ src=$HOME/cross-build/src ++ $ ls $src ++ binutils-2.22.51 glibc gcc-4.6.2 linux-3.1 ++ ++We're going to place our build directories in a subdirectory 'obj', ++we'll install the cross-development toolchain in 'tools', and we'll ++place our sysroot (containing files to be installed on the target ++system) in 'sysroot': ++ ++ $ obj=$top/obj ++ $ tools=$top/tools ++ $ sysroot=$top/sysroot ++ ++ ++Binutils ++ ++Configuring and building binutils for the target is straightforward: ++ ++ $ mkdir -p $obj/binutils ++ $ cd $obj/binutils ++ $ $src/$binutilsv/configure \ ++ > --target=$target \ ++ > --prefix=$tools \ ++ > --with-sysroot=$sysroot ++ $ make ++ $ make install ++ ++ ++The First GCC ++ ++For our work, we need a cross-compiler targeting an ARM Linux ++system. However, that configuration includes the shared library ++'libgcc_s.so', which is compiled against the GLIBC headers (which we ++haven't installed yet) and linked against 'libc.so' (which we haven't ++built yet). ++ ++Fortunately, there are configuration options for GCC which tell it not ++to build 'libgcc_s.so'. The '--without-headers' option is supposed to ++take care of this, but its implementation is incomplete, so you must ++also configure with the '--with-newlib' option. While '--with-newlib' ++appears to mean "Use the Newlib C library", its effect is to tell the ++GCC build machinery, "Don't assume there is a C library available." ++ ++We also need to disable some of the libraries that would normally be ++built along with GCC, and specify that only the compiler for the C ++language is needed. ++ ++So, we create a build directory, configure, make, and install. ++ ++ $ mkdir -p $obj/gcc1 ++ $ cd $obj/gcc1 ++ $ $src/$gccv/configure \ ++ > --target=$target \ ++ > --prefix=$tools \ ++ > --without-headers --with-newlib \ ++ > --disable-shared --disable-threads --disable-libssp \ ++ > --disable-libgomp --disable-libmudflap --disable-libquadmath \ ++ > --disable-decimal-float --disable-libffi \ ++ > --enable-languages=c ++ $ PATH=$tools/bin:$PATH make ++ $ PATH=$tools/bin:$PATH make install ++ ++ ++Linux Kernel Headers ++ ++To configure GLIBC, we also need Linux kernel headers in place. ++Fortunately, the Linux makefiles have a target that installs them for ++us. Since the process does modify the source tree a bit, we make a ++copy first: ++ ++ $ cp -r $src/$linuxv $obj/linux ++ $ cd $obj/linux ++ ++Now we're ready to install the headers into the sysroot: ++ ++ $ PATH=$tools/bin:$PATH \ ++ > make headers_install \ ++ > ARCH=$linux_arch CROSS_COMPILE=$target- \ ++ > INSTALL_HDR_PATH=$sysroot/usr ++ ++ ++GLIBC Headers and Preliminary Objects ++ ++Using the cross-compiler we've just built, we can now configure GLIBC ++well enough to install the headers and build the object files that the ++full cross-compiler will need: ++ ++ $ mkdir -p $obj/glibc-headers ++ $ cd $obj/glibc-headers ++ $ BUILD_CC=gcc \ ++ > CC=$tools/bin/$target-gcc \ ++ > CXX=$tools/bin/$target-g++ \ ++ > AR=$tools/bin/$target-ar \ ++ > RANLIB=$tools/bin/$target-ranlib \ ++ > $src/glibc/libc/configure \ ++ > --prefix=/usr \ ++ > --with-headers=$sysroot/usr/include \ ++ > --build=$build \ ++ > --host=$target \ ++ > --disable-profile --without-gd --without-cvs \ ++ > --enable-add-ons=nptl,libidn,../ports ++ ++The option '--prefix=/usr' may look strange, but you should never ++configure GLIBC with a prefix other than '/usr': in various places, ++GLIBC's build system checks whether the prefix is '/usr', and does ++special handling only if that is the case. Unless you use this ++prefix, you will get a sysroot that does not use the standard Linux ++directory layouts and cannot be used as a basis for the root ++filesystem on your target system compatibly with normal GLIBC ++installations. ++ ++The '--with-headers' option tells GLIBC where the Linux headers have ++been installed. ++ ++The '--enable-add-ons=nptl,libidn,../ports' option tells GLIBC to look ++for the listed glibc add-ons. Most notably the ports add-on (located ++just above the libc sources in the GLIBC svn tree) is required to ++support ARM targets. ++ ++We can now use the 'install-headers' makefile target to install the ++headers: ++ ++ $ make install-headers install_root=$sysroot \ ++ > install-bootstrap-headers=yes ++ ++The 'install_root' variable indicates where the files should actually ++be installed; its value is treated as the parent of the '--prefix' ++directory we passed to the configure script, so the headers will go in ++'$sysroot/usr/include'. The 'install-bootstrap-headers' variable ++requests special handling for certain tricky header files. ++ ++Next, there are a few object files needed to link shared libraries, ++which we build and install by hand: ++ ++ $ mkdir -p $sysroot/usr/lib ++ $ make csu/subdir_lib ++ $ cp csu/crt1.o csu/crti.o csu/crtn.o $sysroot/usr/lib ++ ++Finally, 'libgcc_s.so' requires a 'libc.so' to link against. However, ++since we will never actually execute its code, it doesn't matter what ++it contains. So, treating '/dev/null' as a C source file, we produce ++a dummy 'libc.so' in one step: ++ ++ $ $tools/bin/$target-gcc -nostdlib -nostartfiles -shared -x c /dev/null \ ++ > -o $sysroot/usr/lib/libc.so ++ ++ ++The Second GCC ++ ++With the GLIBC headers and selected object files installed, we can ++now build a GCC that is capable of compiling GLIBC. We configure, ++build, and install the second GCC, again building only the C compiler, ++and avoiding libraries we won't use: ++ ++ $ mkdir -p $obj/gcc2 ++ $ cd $obj/gcc2 ++ $ $src/$gccv/configure \ ++ > --target=$target \ ++ > --prefix=$tools \ ++ > --with-sysroot=$sysroot \ ++ > --disable-libssp --disable-libgomp --disable-libmudflap \ ++ > --disable-libffi --disable-libquadmath \ ++ > --enable-languages=c ++ $ PATH=$tools/bin:$PATH make ++ $ PATH=$tools/bin:$PATH make install ++ ++ ++GLIBC, Complete ++ ++With the second compiler built and installed, we're now ready for the ++full GLIBC build: ++ ++ $ mkdir -p $obj/glibc ++ $ cd $obj/glibc ++ $ BUILD_CC=gcc \ ++ > CC=$tools/bin/$target-gcc \ ++ > CXX=$tools/bin/$target-g++ \ ++ > AR=$tools/bin/$target-ar \ ++ > RANLIB=$tools/bin/$target-ranlib \ ++ > $src/glibc/libc/configure \ ++ > --prefix=/usr \ ++ > --with-headers=$sysroot/usr/include \ ++ > --with-kconfig=$obj/linux/scripts/kconfig \ ++ > --build=$build \ ++ > --host=$target \ ++ > --disable-profile --without-gd --without-cvs \ ++ > --enable-add-ons=nptl,libidn,../ports ++ ++Note the additional '--with-kconfig' option. This tells GLIBC where to ++find the host config tools used by the kernel 'make config' and 'make ++menuconfig'. These tools can be re-used by GLIBC for its own 'make ++*config' support, which will create 'option-groups.config' for you. ++But first make sure those tools have been built by running some ++dummy 'make *config' calls in the kernel directory: ++ ++ $ cd $obj/linux ++ $ PATH=$tools/bin:$PATH make config \ ++ > ARCH=$linux_arch CROSS_COMPILE=$target- \ ++ $ PATH=$tools/bin:$PATH make menuconfig \ ++ > ARCH=$linux_arch CROSS_COMPILE=$target- \ ++ ++Now we can configure and build the full GLIBC: ++ ++ $ cd $obj/glibc ++ $ PATH=$tools/bin:$PATH make defconfig ++ $ PATH=$tools/bin:$PATH make menuconfig ++ $ PATH=$tools/bin:$PATH make ++ $ PATH=$tools/bin:$PATH make install install_root=$sysroot ++ ++At this point, we have a complete GLIBC installation in '$sysroot', ++with header files, library files, and most of the C runtime startup ++files in place. ++ ++ ++The Third GCC ++ ++Finally, we recompile GCC against this full installation, enabling ++whatever languages and libraries we would like to use: ++ ++ $ mkdir -p $obj/gcc3 ++ $ cd $obj/gcc3 ++ $ $src/$gccv/configure \ ++ > --target=$target \ ++ > --prefix=$tools \ ++ > --with-sysroot=$sysroot \ ++ > --enable-__cxa_atexit \ ++ > --disable-libssp --disable-libgomp --disable-libmudflap \ ++ > --enable-languages=c,c++ ++ $ PATH=$tools/bin:$PATH make ++ $ PATH=$tools/bin:$PATH make install ++ ++The '--enable-__cxa_atexit' option tells GCC what sort of C++ ++destructor support to expect from the C library; it's required with ++GLIBC. ++ ++And since GCC's installation process isn't designed to help construct ++sysroot trees, we must manually copy certain libraries into place in ++the sysroot. ++ ++ $ cp -d $tools/$target/lib/libgcc_s.so* $sysroot/lib ++ $ cp -d $tools/$target/lib/libstdc++.so* $sysroot/usr/lib ++ ++ ++Trying Things Out ++ ++At this point, '$tools' contains a cross toolchain ready to use ++the GLIBC installation in '$sysroot': ++ ++ $ cat > hello.c < #include ++ > int ++ > main (int argc, char **argv) ++ > { ++ > puts ("Hello, world!"); ++ > return 0; ++ > } ++ > EOF ++ $ $tools/bin/$target-gcc -Wall hello.c -o hello ++ $ cat > c++-hello.cc < #include ++ > int ++ > main (int argc, char **argv) ++ > { ++ > std::cout << "Hello, C++ world!" << std::endl; ++ > return 0; ++ > } ++ > EOF ++ $ $tools/bin/$target-g++ -Wall c++-hello.cc -o c++-hello ++ ++ ++We can use 'readelf' to verify that these are indeed executables for ++our target, using our dynamic linker: ++ ++ $ $tools/bin/$target-readelf -hl hello ++ ELF Header: ++ ... ++ Type: EXEC (Executable file) ++ Machine: ARM ++ ++ ... ++ Program Headers: ++ Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align ++ PHDR 0x000034 0x10000034 0x10000034 0x00100 0x00100 R E 0x4 ++ INTERP 0x000134 0x00008134 0x00008134 0x00013 0x00013 R 0x1 ++ [Requesting program interpreter: /lib/ld-linux.so.3] ++ LOAD 0x000000 0x00008000 0x00008000 0x0042c 0x0042c R E 0x8000 ++ ... ++ ++Looking at the dynamic section of the installed 'libgcc_s.so', we see ++that the 'NEEDED' entry for the C library does include the '.6' ++suffix, indicating that was linked against our fully build GLIBC, and ++not our dummy 'libc.so': ++ ++ $ $tools/bin/$target-readelf -d $sysroot/lib/libgcc_s.so.1 ++ Dynamic section at offset 0x1083c contains 24 entries: ++ Tag Type Name/Value ++ 0x00000001 (NEEDED) Shared library: [libc.so.6] ++ 0x0000000e (SONAME) Library soname: [libgcc_s.so.1] ++ ... ++ ++ ++And on the target machine, we can run our programs: ++ ++ $ $sysroot/lib/ld.so.1 --library-path $sysroot/lib:$sysroot/usr/lib \ ++ > ./hello ++ Hello, world! ++ $ $sysroot/lib/ld.so.1 --library-path $sysroot/lib:$sysroot/usr/lib \ ++ > ./c++-hello ++ Hello, C++ world! +diff --git a/GLIBC.cross-testing b/GLIBC.cross-testing +new file mode 100644 +index 0000000000..b67b468466 +--- /dev/null ++++ b/GLIBC.cross-testing +@@ -0,0 +1,205 @@ ++ -*- mode: text -*- ++ ++ Cross-Testing With GLIBC ++ Jim Blandy ++ ++ ++Introduction ++ ++Developers writing software for embedded systems often use a desktop ++or other similarly capable computer for development, but need to run ++tests on the embedded system, or perhaps on a simulator. When ++configured for cross-compilation, the stock GNU C library simply ++disables running tests altogether: the command 'make tests' builds ++test programs, but does not run them. GLIBC, however, provides ++facilities for compiling tests and generating data files on the build ++system, but running the test programs themselves on a remote system or ++simulator. ++ ++ ++Test environment requirements ++ ++The test environment must meet certain conditions for GLIBC's ++cross-testing facilities to work: ++ ++- Shared filesystems. The 'build' system, on which you configure and ++ compile GLIBC, and the 'host' system, on which you intend to run ++ GLIBC, must share a filesystem containing the GLIBC build and ++ source trees. Files must appear at the same paths on both systems. ++ ++- Remote-shell like invocation. There must be a way to run a program ++ on the host system from the build system, passing it properly quoted ++ command-line arguments, setting environment variables, and ++ inheriting the caller's standard input and output. ++ ++ ++Usage ++ ++To use GLIBC's cross-testing support, provide values for the ++following Make variables when you invoke 'make': ++ ++- cross-test-wrapper ++ ++ This should be the name of the cross-testing wrapper command, along ++ with any arguments. ++ ++- cross-localedef ++ ++ This should be the name of a cross-capable localedef program, like ++ that included in the GLIBC 'localedef' module, along with any ++ arguments needed. ++ ++These are each explained in detail below. ++ ++ ++The Cross-Testing Wrapper ++ ++To run test programs reliably, the stock GNU C library takes care to ++ensure that test programs use the newly compiled dynamic linker and ++shared libraries, and never the host system's installed libraries. To ++accomplish this, it runs the tests by explicitly invoking the dynamic ++linker from the build tree, passing it a list of build tree ++directories to search for shared libraries, followed by the name of ++the executable to run and its arguments. ++ ++For example, where one might normally run a test program like this: ++ ++ $ ./tst-foo arg1 arg2 ++ ++the GNU C library might run that program like this: ++ ++ $ $objdir/elf/ld-linux.so.3 --library-path $objdir \ ++ ./tst-foo arg1 arg2 ++ ++(where $objdir is the path to the top of the build tree, and the ++trailing backslash indicates a continuation of the command). In other ++words, each test program invocation is 'wrapped up' inside an explicit ++invocation of the dynamic linker, which must itself execute the test ++program, having loaded shared libraries from the appropriate ++directories. ++ ++To support cross-testing, GLIBC allows the developer to optionally ++set the 'cross-test-wrapper' Make variable to another wrapper command, ++to which it passes the entire dynamic linker invocation shown above as ++arguments. For example, if the developer supplies a wrapper of ++'my-wrapper hostname', then GLIBC would run the test above as ++follows: ++ ++ $ my-wrapper hostname \ ++ $objdir/elf/ld-linux.so.3 --library-path $objdir \ ++ ./tst-foo arg1 arg2 ++ ++The 'my-wrapper' command is responsible for executing the command ++given on the host system. ++ ++Since tests are run in varying directories, the wrapper should either ++be in your command search path, or 'cross-test-wrapper' should give an ++absolute path for the wrapper. ++ ++The wrapper must meet several requirements: ++ ++- It must preserve the current directory. As explained above, the ++ build directory tree must be visible on both the build and host ++ systems, at the same path. The test wrapper must ensure that the ++ current directory it inherits is also inherited by the dynamic ++ linker (and thus the test program itself). ++ ++- It must preserve environment variables' values. Many GLIBC tests ++ set environment variables for test runs; in native testing, it ++ invokes programs like this: ++ ++ $ GCONV_PATH=$objdir/iconvdata \ ++ $objdir/elf/ld-linux.so.3 --library-path $objdir \ ++ ./tst-foo arg1 arg2 ++ ++ With the cross-testing wrapper, that invocation becomes: ++ ++ $ GCONV_PATH=$objdir/iconvdata \ ++ my-wrapper hostname \ ++ $objdir/elf/ld-linux.so.3 --library-path $objdir \ ++ ./tst-foo arg1 arg2 ++ ++ Here, 'my-wrapper' must ensure that the value it sees for ++ 'GCONV_PATH' will be seen by the dynamic linker, and thus 'tst-foo' ++ itself. (The wrapper supplied with GLIBC simply preserves the ++ values of *all* enviroment variables, with a fixed set of ++ exceptions.) ++ ++ If your wrapper is a shell script, take care to correctly propagate ++ environment variables whose values contain spaces and shell ++ metacharacters. ++ ++- It must pass the command's arguments, unmodified. The arguments ++ seen by the test program should be exactly those seen by the wrapper ++ (after whatever arguments are given to the wrapper itself). The ++ GLIBC test framework performs all needed shell word splitting and ++ expansion (wildcard expansion, parameter substitution, and so on) ++ before invoking the wrapper; further expansion may break the tests. ++ ++ ++The 'cross-test-ssh.sh' script ++ ++If you want to use 'ssh' (or something sufficiently similar) to run ++test programs on your host system, GLIBC includes a shell script, ++'scripts/cross-test-ssh.sh', which you can use as your wrapper ++command. This script takes care of setting the test command's current ++directory, propagating environment variable values, and carrying ++command-line arguments, all across an 'ssh' connection. You may even ++supply an alternative to 'ssh' on the command line, if needed. ++ ++For more details, pass 'cross-test-ssh.sh' the '--help' option. ++ ++ ++The Cross-Compiling Locale Definition Command ++ ++Some GLIBC tests rely on locales generated especially for the test ++process. In a native configuration, these tests simply run the ++'localedef' command built by the normal GLIBC build process, ++'locale/localedef', to process and install their locales. However, in ++a cross-compiling configuration, this 'localedef' is built for the ++host system, not the build system, and since it requires quite a bit ++of memory to run (we have seen it fail on systems with 64MiB of ++memory), it may not be practical to run it on the host system. ++ ++If set, GLIBC uses the 'cross-localedef' Make variable as the command ++to run on the build system to process and install locales. The ++localedef program built from the GLIBC 'localedef' module is ++suitable. ++ ++The value of 'cross-localedef' may also include command-line arguments ++to be passed to the program; if you are using GLIBC's 'localedef', ++you may include endianness and 'uint32_t' alignment arguments here. ++ ++ ++Example ++ ++In developing GLIBC's cross-testing facility, we invoked 'make' with ++the following script: ++ ++ #!/bin/sh ++ ++ srcdir=... ++ test_hostname=... ++ localedefdir=... ++ cross_gxx=...-g++ ++ ++ wrapper="$srcdir/scripts/cross-test-ssh.sh $test_hostname" ++ localedef="$localedefdir/localedef --little-endian --uint32-align=4" ++ ++ make cross-test-wrapper="$wrapper" \ ++ cross-localedef="$localedef" \ ++ CXX="$cross_gxx" \ ++ "$@" ++ ++ ++Other Cross-Testing Concerns ++ ++Here are notes on some other issues which you may encounter in running ++the GLIBC tests in a cross-compiling environment: ++ ++- Some tests require a C++ cross-compiler; you should set the 'CXX' ++ Make variable to the name of an appropriate cross-compiler. ++ ++- Some tests require access to libstdc++.so.6 and libgcc_s.so.1; we ++ simply place copies of these libraries in the top GLIBC build ++ directory. diff --git a/meta/recipes-core/glibc/glibc/0011-eglibc-Help-bootstrap-cross-toolchain.patch b/meta/recipes-core/glibc/glibc/0011-eglibc-Help-bootstrap-cross-toolchain.patch new file mode 100644 index 0000000000..9e00da894d --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0011-eglibc-Help-bootstrap-cross-toolchain.patch @@ -0,0 +1,97 @@ +From 1c8044544d2cbdc529910a3ed6eba4b0ce7ae549 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:49:28 +0000 +Subject: [PATCH] eglibc: Help bootstrap cross toolchain + +Taken from EGLIBC, r1484 + r1525 + + 2007-02-20 Jim Blandy + + * Makefile (install-headers): Preserve old behavior: depend on + $(inst_includedir)/gnu/stubs.h only if install-bootstrap-headers + is set; otherwise, place gnu/stubs.h on the 'install-others' list. + + 2007-02-16 Jim Blandy + + * Makefile: Amend make install-headers to install everything + necessary for building a cross-compiler. Install gnu/stubs.h as + part of 'install-headers', not 'install-others'. + If install-bootstrap-headers is 'yes', install a dummy copy of + gnu/stubs.h, instead of computing the real thing. + * include/stubs-bootstrap.h: New file. + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + Makefile | 22 +++++++++++++++++++++- + include/stubs-bootstrap.h | 12 ++++++++++++ + 2 files changed, 33 insertions(+), 1 deletion(-) + create mode 100644 include/stubs-bootstrap.h + +diff --git a/Makefile b/Makefile +index a49870d3d1..81673d7645 100644 +--- a/Makefile ++++ b/Makefile +@@ -79,9 +79,18 @@ subdir-dirs = include + vpath %.h $(subdir-dirs) + + # What to install. +-install-others = $(inst_includedir)/gnu/stubs.h + install-bin-script = + ++# If we're bootstrapping, install a dummy gnu/stubs.h along with the ++# other headers, so 'make install-headers' produces a useable include ++# tree. Otherwise, install gnu/stubs.h later, after the rest of the ++# build is done. ++ifeq ($(install-bootstrap-headers),yes) ++install-headers: $(inst_includedir)/gnu/stubs.h ++else ++install-others = $(inst_includedir)/gnu/stubs.h ++endif ++ + ifeq (yes,$(build-shared)) + headers += gnu/lib-names.h + endif +@@ -420,6 +429,16 @@ others: $(common-objpfx)testrun.sh $(common-objpfx)debugglibc.sh + + subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs) + ++# gnu/stubs.h depends (via the subdir 'stubs' targets) on all the .o ++# files in EGLIBC. For bootstrapping a GCC/EGLIBC pair, an empty ++# gnu/stubs.h is good enough. ++ifeq ($(install-bootstrap-headers),yes) ++$(inst_includedir)/gnu/stubs.h: include/stubs-bootstrap.h $(+force) ++ $(make-target-directory) ++ $(INSTALL_DATA) $< $@ ++ ++installed-stubs = ++else + ifndef abi-variants + installed-stubs = $(inst_includedir)/gnu/stubs.h + else +@@ -446,6 +465,7 @@ $(inst_includedir)/gnu/stubs.h: $(+force) + + install-others-nosubdir: $(installed-stubs) + endif ++endif + + + # Since stubs.h is never needed when building the library, we simplify the +diff --git a/include/stubs-bootstrap.h b/include/stubs-bootstrap.h +new file mode 100644 +index 0000000000..1d2b669aff +--- /dev/null ++++ b/include/stubs-bootstrap.h +@@ -0,0 +1,12 @@ ++/* Placeholder stubs.h file for bootstrapping. ++ ++ When bootstrapping a GCC/EGLIBC pair, GCC requires that the EGLIBC ++ headers be installed, but we can't fully build EGLIBC without that ++ GCC. So we run the command: ++ ++ make install-headers install-bootstrap-headers=yes ++ ++ to install the headers GCC needs, but avoid building certain ++ difficult headers. The header depends, via the ++ EGLIBC subdir 'stubs' make targets, on every .o file in EGLIBC, but ++ an empty stubs.h like this will do fine for GCC. */ diff --git a/meta/recipes-core/glibc/glibc/0012-eglibc-Resolve-__fpscr_values-on-SH4.patch b/meta/recipes-core/glibc/glibc/0012-eglibc-Resolve-__fpscr_values-on-SH4.patch new file mode 100644 index 0000000000..03c81bfbd7 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0012-eglibc-Resolve-__fpscr_values-on-SH4.patch @@ -0,0 +1,53 @@ +From e5999ffd1b8690c2902a6406c07f51023a6bf7ec Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:55:53 +0000 +Subject: [PATCH] eglibc: Resolve __fpscr_values on SH4 + +2010-09-29 Nobuhiro Iwamatsu + Andrew Stubbs + + Resolve SH's __fpscr_values to symbol in libc.so. + + * sysdeps/sh/sh4/fpu/fpu_control.h: Add C++ __set_fpscr prototype. + * sysdeps/unix/sysv/linux/sh/Versions (GLIBC_2.2): Add __fpscr_values. + * sysdeps/unix/sysv/linux/sh/sysdep.S (___fpscr_values): New constant. + +Upstream-Status: Pending + +Signed-off-by: Khem Raj +--- + sysdeps/unix/sysv/linux/sh/Versions | 1 + + sysdeps/unix/sysv/linux/sh/sysdep.S | 11 +++++++++++ + 2 files changed, 12 insertions(+) + +diff --git a/sysdeps/unix/sysv/linux/sh/Versions b/sysdeps/unix/sysv/linux/sh/Versions +index 9c734ff755..974e33b4b1 100644 +--- a/sysdeps/unix/sysv/linux/sh/Versions ++++ b/sysdeps/unix/sysv/linux/sh/Versions +@@ -3,6 +3,7 @@ libc { + GLIBC_2.2 { + # functions used in other libraries + __xstat64; __fxstat64; __lxstat64; ++ __fpscr_values; + + # a* + alphasort64; +diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.S b/sysdeps/unix/sysv/linux/sh/sysdep.S +index a18fbb2e8b..59421bfbb0 100644 +--- a/sysdeps/unix/sysv/linux/sh/sysdep.S ++++ b/sysdeps/unix/sysv/linux/sh/sysdep.S +@@ -30,3 +30,14 @@ ENTRY (__syscall_error) + + #define __syscall_error __syscall_error_1 + #include ++ ++ .data ++ .align 3 ++ .globl ___fpscr_values ++ .type ___fpscr_values, @object ++ .size ___fpscr_values, 8 ++___fpscr_values: ++ .long 0 ++ .long 0x80000 ++weak_alias (___fpscr_values, __fpscr_values) ++ diff --git a/meta/recipes-core/glibc/glibc/0013-eglibc-Forward-port-cross-locale-generation-support.patch b/meta/recipes-core/glibc/glibc/0013-eglibc-Forward-port-cross-locale-generation-support.patch new file mode 100644 index 0000000000..48bb062e09 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0013-eglibc-Forward-port-cross-locale-generation-support.patch @@ -0,0 +1,560 @@ +From 99ae3189430eaa5472b2117e5a999109a6ca9251 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 01:33:49 +0000 +Subject: [PATCH] eglibc: Forward port cross locale generation support + +Upstream-Status: Pending + +Signed-off-by: Khem Raj +--- + locale/Makefile | 3 +- + locale/catnames.c | 46 +++++++++++++++++++++++++++ + locale/localeinfo.h | 2 +- + locale/programs/charmap-dir.c | 6 ++++ + locale/programs/ld-collate.c | 17 +++++----- + locale/programs/ld-ctype.c | 27 ++++++++-------- + locale/programs/ld-time.c | 31 ++++++++++++------ + locale/programs/linereader.c | 2 +- + locale/programs/localedef.c | 8 +++++ + locale/programs/locfile.c | 5 ++- + locale/programs/locfile.h | 59 +++++++++++++++++++++++++++++++++-- + locale/setlocale.c | 29 ----------------- + 12 files changed, 167 insertions(+), 68 deletions(-) + create mode 100644 locale/catnames.c + +diff --git a/locale/Makefile b/locale/Makefile +index b7c60681fa..07c606cde3 100644 +--- a/locale/Makefile ++++ b/locale/Makefile +@@ -26,7 +26,8 @@ headers = langinfo.h locale.h bits/locale.h \ + bits/types/locale_t.h bits/types/__locale_t.h + routines = setlocale findlocale loadlocale loadarchive \ + localeconv nl_langinfo nl_langinfo_l mb_cur_max \ +- newlocale duplocale freelocale uselocale ++ newlocale duplocale freelocale uselocale \ ++ catnames + tests = tst-C-locale tst-locname tst-duplocale + tests-container = tst-localedef-path-norm + categories = ctype messages monetary numeric time paper name \ +diff --git a/locale/catnames.c b/locale/catnames.c +new file mode 100644 +index 0000000000..538f3f5edb +--- /dev/null ++++ b/locale/catnames.c +@@ -0,0 +1,46 @@ ++/* Copyright (C) 2006 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 "localeinfo.h" ++ ++/* Define an array of category names (also the environment variable names). */ ++const struct catnamestr_t _nl_category_names attribute_hidden = ++ { ++#define DEFINE_CATEGORY(category, category_name, items, a) \ ++ category_name, ++#include "categories.def" ++#undef DEFINE_CATEGORY ++ }; ++ ++const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden = ++ { ++#define DEFINE_CATEGORY(category, category_name, items, a) \ ++ [category] = offsetof (struct catnamestr_t, CATNAMEMF (__LINE__)), ++#include "categories.def" ++#undef DEFINE_CATEGORY ++ }; ++ ++/* An array of their lengths, for convenience. */ ++const uint8_t _nl_category_name_sizes[] attribute_hidden = ++ { ++#define DEFINE_CATEGORY(category, category_name, items, a) \ ++ [category] = sizeof (category_name) - 1, ++#include "categories.def" ++#undef DEFINE_CATEGORY ++ [LC_ALL] = sizeof ("LC_ALL") - 1 ++ }; +diff --git a/locale/localeinfo.h b/locale/localeinfo.h +index 22f9dc1140..fa31b3c5ea 100644 +--- a/locale/localeinfo.h ++++ b/locale/localeinfo.h +@@ -230,7 +230,7 @@ __libc_tsd_define (extern, locale_t, LOCALE) + unused. We can manage this playing some tricks with weak references. + 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. */ +-#ifndef SHARED ++#if !defined SHARED && !defined IN_GLIBC_LOCALEDEF + # include + # define NL_CURRENT_INDIRECT 1 + #endif +diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c +index 4841bfd05d..ffcba1fd79 100644 +--- a/locale/programs/charmap-dir.c ++++ b/locale/programs/charmap-dir.c +@@ -18,7 +18,9 @@ + #include + #include + #include ++#ifndef NO_UNCOMPRESS + #include ++#endif + #include + #include + #include +@@ -154,6 +156,7 @@ charmap_closedir (CHARMAP_DIR *cdir) + return closedir (dir); + } + ++#ifndef NO_UNCOMPRESS + /* Creates a subprocess decompressing the given pathname, and returns + a stream reading its output (the decompressed data). */ + static +@@ -202,6 +205,7 @@ fopen_uncompressed (const char *pathname, const char *compressor) + } + return NULL; + } ++#endif + + /* Opens a charmap for reading, given its name (not an alias name). */ + FILE * +@@ -224,6 +228,7 @@ charmap_open (const char *directory, const char *name) + if (stream != NULL) + return stream; + ++#ifndef NO_UNCOMPRESS + memcpy (p, ".gz", 4); + stream = fopen_uncompressed (pathname, "gzip"); + if (stream != NULL) +@@ -233,6 +238,7 @@ charmap_open (const char *directory, const char *name) + stream = fopen_uncompressed (pathname, "bzip2"); + if (stream != NULL) + return stream; ++#endif + + return NULL; + } +diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c +index 06a5203334..84b3ff4166 100644 +--- a/locale/programs/ld-collate.c ++++ b/locale/programs/ld-collate.c +@@ -352,7 +352,7 @@ new_element (struct locale_collate_t *collate, const char *mbs, size_t mbslen, + } + if (wcs != NULL) + { +- size_t nwcs = wcslen ((wchar_t *) wcs); ++ size_t nwcs = wcslen_uint32 (wcs); + uint32_t zero = 0; + /* Handle as a single character. */ + if (nwcs == 0) +@@ -1783,8 +1783,7 @@ symbol `%s' has the same encoding as"), (*eptr)->name); + + if ((*eptr)->nwcs == runp->nwcs) + { +- int c = wmemcmp ((wchar_t *) (*eptr)->wcs, +- (wchar_t *) runp->wcs, runp->nwcs); ++ int c = wmemcmp_uint32 ((*eptr)->wcs, runp->wcs, runp->nwcs); + + if (c == 0) + { +@@ -2011,9 +2010,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp) + one consecutive entry. */ + if (runp->wcnext != NULL + && runp->nwcs == runp->wcnext->nwcs +- && wmemcmp ((wchar_t *) runp->wcs, +- (wchar_t *)runp->wcnext->wcs, +- runp->nwcs - 1) == 0 ++ && wmemcmp_uint32 (runp->wcs, ++ runp->wcnext->wcs, ++ runp->nwcs - 1) == 0 + && (runp->wcs[runp->nwcs - 1] + == runp->wcnext->wcs[runp->nwcs - 1] + 1)) + { +@@ -2037,9 +2036,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp) + runp = runp->wcnext; + while (runp->wcnext != NULL + && runp->nwcs == runp->wcnext->nwcs +- && wmemcmp ((wchar_t *) runp->wcs, +- (wchar_t *)runp->wcnext->wcs, +- runp->nwcs - 1) == 0 ++ && wmemcmp_uint32 (runp->wcs, ++ runp->wcnext->wcs, ++ runp->nwcs - 1) == 0 + && (runp->wcs[runp->nwcs - 1] + == runp->wcnext->wcs[runp->nwcs - 1] + 1)); + +diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c +index 07b64ac5a1..70b49ab733 100644 +--- a/locale/programs/ld-ctype.c ++++ b/locale/programs/ld-ctype.c +@@ -914,7 +914,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap, + allocate_arrays (ctype, charmap, ctype->repertoire); + + default_missing_len = (ctype->default_missing +- ? wcslen ((wchar_t *) ctype->default_missing) ++ ? wcslen_uint32 (ctype->default_missing) + : 0); + + init_locale_data (&file, nelems); +@@ -1926,7 +1926,7 @@ read_translit_entry (struct linereader *ldfile, struct locale_ctype_t *ctype, + ignore = 1; + else + /* This value is usable. */ +- obstack_grow (ob, to_wstr, wcslen ((wchar_t *) to_wstr) * 4); ++ obstack_grow (ob, to_wstr, wcslen_uint32 (to_wstr) * 4); + + first = 0; + } +@@ -2460,8 +2460,8 @@ with character code range values one must use the absolute ellipsis `...'")); + } + + handle_tok_digit: +- class_bit = _ISwdigit; +- class256_bit = _ISdigit; ++ class_bit = BITw (tok_digit); ++ class256_bit = BIT (tok_digit); + handle_digits = 1; + goto read_charclass; + +@@ -3903,8 +3903,7 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, + + while (idx < number) + { +- int res = wcscmp ((const wchar_t *) sorted[idx]->from, +- (const wchar_t *) runp->from); ++ int res = wcscmp_uint32 (sorted[idx]->from, runp->from); + if (res == 0) + { + replace = 1; +@@ -3941,11 +3940,11 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, + for (size_t cnt = 0; cnt < number; ++cnt) + { + struct translit_to_t *srunp; +- from_len += wcslen ((const wchar_t *) sorted[cnt]->from) + 1; ++ from_len += wcslen_uint32 (sorted[cnt]->from) + 1; + srunp = sorted[cnt]->to; + while (srunp != NULL) + { +- to_len += wcslen ((const wchar_t *) srunp->str) + 1; ++ to_len += wcslen_uint32 (srunp->str) + 1; + srunp = srunp->next; + } + /* Plus one for the extra NUL character marking the end of +@@ -3969,18 +3968,18 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, + ctype->translit_from_idx[cnt] = from_len; + ctype->translit_to_idx[cnt] = to_len; + +- len = wcslen ((const wchar_t *) sorted[cnt]->from) + 1; +- wmemcpy ((wchar_t *) &ctype->translit_from_tbl[from_len], +- (const wchar_t *) sorted[cnt]->from, len); ++ len = wcslen_uint32 (sorted[cnt]->from) + 1; ++ wmemcpy_uint32 (&ctype->translit_from_tbl[from_len], ++ sorted[cnt]->from, len); + from_len += len; + + ctype->translit_to_idx[cnt] = to_len; + srunp = sorted[cnt]->to; + while (srunp != NULL) + { +- len = wcslen ((const wchar_t *) srunp->str) + 1; +- wmemcpy ((wchar_t *) &ctype->translit_to_tbl[to_len], +- (const wchar_t *) srunp->str, len); ++ len = wcslen_uint32 (srunp->str) + 1; ++ wmemcpy_uint32 (&ctype->translit_to_tbl[to_len], ++ srunp->str, len); + to_len += len; + srunp = srunp->next; + } +diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c +index e6f320d2b3..c6631ad101 100644 +--- a/locale/programs/ld-time.c ++++ b/locale/programs/ld-time.c +@@ -219,8 +219,10 @@ No definition for %s category found"), "LC_TIME"); + } + else + { ++ static const uint32_t wt_fmt_ampm[] ++ = { '%','I',':','%','M',':','%','S',' ','%','p',0 }; + time->t_fmt_ampm = "%I:%M:%S %p"; +- time->wt_fmt_ampm = (const uint32_t *) L"%I:%M:%S %p"; ++ time->wt_fmt_ampm = wt_fmt_ampm; + } + } + +@@ -230,7 +232,7 @@ No definition for %s category found"), "LC_TIME"); + const int days_per_month[12] = { 31, 29, 31, 30, 31, 30, + 31, 31, 30, 31 ,30, 31 }; + size_t idx; +- wchar_t *wstr; ++ uint32_t *wstr; + + time->era_entries = + (struct era_data *) xmalloc (time->num_era +@@ -456,18 +458,18 @@ No definition for %s category found"), "LC_TIME"); + } + + /* Now generate the wide character name and format. */ +- wstr = wcschr ((wchar_t *) time->wera[idx], L':');/* end direction */ +- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end offset */ +- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end start */ +- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end end */ ++ wstr = wcschr_uint32 (time->wera[idx], L':'); /* end direction */ ++ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end offset */ ++ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end start */ ++ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end end */ + if (wstr != NULL) + { +- time->era_entries[idx].wname = (uint32_t *) wstr + 1; +- wstr = wcschr (wstr + 1, L':'); /* end name */ ++ time->era_entries[idx].wname = wstr + 1; ++ wstr = wcschr_uint32 (wstr + 1, L':'); /* end name */ + if (wstr != NULL) + { + *wstr = L'\0'; +- time->era_entries[idx].wformat = (uint32_t *) wstr + 1; ++ time->era_entries[idx].wformat = wstr + 1; + } + else + time->era_entries[idx].wname = +@@ -526,7 +528,16 @@ No definition for %s category found"), "LC_TIME"); + if (time->date_fmt == NULL) + time->date_fmt = "%a %b %e %H:%M:%S %Z %Y"; + if (time->wdate_fmt == NULL) +- time->wdate_fmt = (const uint32_t *) L"%a %b %e %H:%M:%S %Z %Y"; ++ { ++ static const uint32_t wdate_fmt[] = ++ { '%','a',' ', ++ '%','b',' ', ++ '%','e',' ', ++ '%','H',':','%','M',':','%','S',' ', ++ '%','Z',' ', ++ '%','Y',0 }; ++ time->wdate_fmt = wdate_fmt; ++ } + } + + +diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c +index a1f22b28ed..cbd3b40ceb 100644 +--- a/locale/programs/linereader.c ++++ b/locale/programs/linereader.c +@@ -594,7 +594,7 @@ get_string (struct linereader *lr, const struct charmap_t *charmap, + { + int return_widestr = lr->return_widestr; + char *buf; +- wchar_t *buf2 = NULL; ++ uint32_t *buf2 = NULL; + size_t bufact; + size_t bufmax = 56; + +diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c +index f0da25e9e5..5d9e01cda2 100644 +--- a/locale/programs/localedef.c ++++ b/locale/programs/localedef.c +@@ -108,6 +108,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; + #define OPT_NO_WARN 402 + #define OPT_WARN 403 + #define OPT_NO_HARD_LINKS 404 ++#define OPT_UINT32_ALIGN 405 + + /* Definitions of arguments for argp functions. */ + static const struct argp_option options[] = +@@ -152,6 +153,8 @@ static const struct argp_option options[] = + N_("Generate little-endian output") }, + { "big-endian", OPT_BIG_ENDIAN, NULL, 0, + N_("Generate big-endian output") }, ++ { "uint32-align", OPT_UINT32_ALIGN, "ALIGNMENT", 0, ++ N_("Set the target's uint32_t alignment in bytes (default 4)") }, + { NULL, 0, NULL, 0, NULL } + }; + +@@ -242,12 +245,14 @@ main (int argc, char *argv[]) + ctype locale. (P1003.2 4.35.5.2) */ + setlocale (LC_CTYPE, "POSIX"); + ++#ifndef NO_SYSCONF + /* Look whether the system really allows locale definitions. POSIX + defines error code 3 for this situation so I think it must be + a fatal error (see P1003.2 4.35.8). */ + if (sysconf (_SC_2_LOCALEDEF) < 0) + record_error (3, 0, _("\ + FATAL: system does not define `_POSIX2_LOCALEDEF'")); ++#endif + + /* Process charmap file. */ + charmap = charmap_read (charmap_file, verbose, 1, be_quiet, 1); +@@ -399,6 +404,9 @@ parse_opt (int key, char *arg, struct argp_state *state) + /* Do not hard link to other locales. */ + hard_links = false; + break; ++ case OPT_UINT32_ALIGN: ++ uint32_align_mask = strtol (arg, NULL, 0) - 1; ++ break; + case 'c': + force_output = 1; + break; +diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c +index 1427b518a9..dafa84a20b 100644 +--- a/locale/programs/locfile.c ++++ b/locale/programs/locfile.c +@@ -543,6 +543,9 @@ compare_files (const char *filename1, const char *filename2, size_t size, + machine running localedef. */ + bool swap_endianness_p; + ++/* The target's value of __align__(uint32_t) - 1. */ ++unsigned int uint32_align_mask = 3; ++ + /* When called outside a start_locale_structure/end_locale_structure + 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. +@@ -620,7 +623,7 @@ add_locale_string (struct locale_file *file, const char *string) + void + add_locale_wstring (struct locale_file *file, const uint32_t *string) + { +- add_locale_uint32_array (file, string, wcslen ((const wchar_t *) string) + 1); ++ add_locale_uint32_array (file, string, wcslen_uint32 (string) + 1); + } + + /* Record that FILE's next element is the 32-bit integer VALUE. */ +diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h +index cbc20fe88d..ae88e6d0af 100644 +--- a/locale/programs/locfile.h ++++ b/locale/programs/locfile.h +@@ -70,6 +70,8 @@ extern void write_all_categories (struct localedef_t *definitions, + + extern bool swap_endianness_p; + ++extern unsigned int uint32_align_mask; ++ + /* Change the output to be big-endian if BIG_ENDIAN is true and + little-endian otherwise. */ + static inline void +@@ -88,7 +90,8 @@ maybe_swap_uint32 (uint32_t value) + } + + /* Likewise, but munge an array of N uint32_ts starting at ARRAY. */ +-static inline void ++static void ++__attribute__ ((unused)) + maybe_swap_uint32_array (uint32_t *array, size_t n) + { + if (swap_endianness_p) +@@ -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 + the end of OBSTACK's current object. */ +-static inline void ++static void ++__attribute__ ((unused)) + maybe_swap_uint32_obstack (struct obstack *obstack, size_t n) + { + maybe_swap_uint32_array ((uint32_t *) obstack_next_free (obstack) - n, n); +@@ -275,4 +279,55 @@ extern void identification_output (struct localedef_t *locale, + const struct charmap_t *charmap, + const char *output_path); + ++static size_t wcslen_uint32 (const uint32_t *str) __attribute__ ((unused)); ++static uint32_t * wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n) __attribute__ ((unused)); ++static uint32_t * wcschr_uint32 (const uint32_t *s, uint32_t ch) __attribute__ ((unused)); ++static int wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2) __attribute__ ((unused)); ++static int wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n) __attribute__ ((unused)); ++ ++static size_t ++wcslen_uint32 (const uint32_t *str) ++{ ++ size_t len = 0; ++ while (str[len] != 0) ++ len++; ++ return len; ++} ++ ++static int ++wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n) ++{ ++ while (n-- != 0) ++ { ++ int diff = *s1++ - *s2++; ++ if (diff != 0) ++ return diff; ++ } ++ return 0; ++} ++ ++static int ++wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2) ++{ ++ while (*s1 != 0 && *s1 == *s2) ++ s1++, s2++; ++ return *s1 - *s2; ++} ++ ++static uint32_t * ++wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n) ++{ ++ return memcpy (s1, s2, n * sizeof (uint32_t)); ++} ++ ++static uint32_t * ++wcschr_uint32 (const uint32_t *s, uint32_t ch) ++{ ++ do ++ if (*s == ch) ++ return (uint32_t *) s; ++ while (*s++ != 0); ++ return 0; ++} ++ + #endif /* locfile.h */ +diff --git a/locale/setlocale.c b/locale/setlocale.c +index 19ed85ae8e..f28ca11446 100644 +--- a/locale/setlocale.c ++++ b/locale/setlocale.c +@@ -63,35 +63,6 @@ static char *const _nl_current_used[] = + + #endif + +- +-/* Define an array of category names (also the environment variable names). */ +-const struct catnamestr_t _nl_category_names attribute_hidden = +- { +-#define DEFINE_CATEGORY(category, category_name, items, a) \ +- category_name, +-#include "categories.def" +-#undef DEFINE_CATEGORY +- }; +- +-const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden = +- { +-#define DEFINE_CATEGORY(category, category_name, items, a) \ +- [category] = offsetof (struct catnamestr_t, CATNAMEMF (__LINE__)), +-#include "categories.def" +-#undef DEFINE_CATEGORY +- }; +- +-/* An array of their lengths, for convenience. */ +-const uint8_t _nl_category_name_sizes[] attribute_hidden = +- { +-#define DEFINE_CATEGORY(category, category_name, items, a) \ +- [category] = sizeof (category_name) - 1, +-#include "categories.def" +-#undef DEFINE_CATEGORY +- [LC_ALL] = sizeof ("LC_ALL") - 1 +- }; +- +- + #ifdef NL_CURRENT_INDIRECT + # define WEAK_POSTLOAD(postload) weak_extern (postload) + #else diff --git a/meta/recipes-core/glibc/glibc/0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch b/meta/recipes-core/glibc/glibc/0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch new file mode 100644 index 0000000000..eae1ee8907 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch @@ -0,0 +1,80 @@ +From 32c2e23ad29f63f57f544daf1a59259147cd1008 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 3 Aug 2018 09:42:06 -0700 +Subject: [PATCH] localedef --add-to-archive uses a hard-coded locale path + +it doesn't exist in normal use, and there's no way to pass an +alternative filename. + +Add a fallback of $LOCALEARCHIVE from the environment, and allow +creation of new locale archives that are not the system archive. + +Upstream-Status: Inappropriate (OE-specific) + +Signed-off-by: Ross Burton +Signed-off-by: Khem Raj +--- + locale/programs/locarchive.c | 35 +++++++++++++++++++++++++---------- + 1 file changed, 25 insertions(+), 10 deletions(-) + +diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c +index 477499bd40..fe7b5ff60c 100644 +--- a/locale/programs/locarchive.c ++++ b/locale/programs/locarchive.c +@@ -339,12 +339,24 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) + struct namehashent *oldnamehashtab; + struct locarhandle new_ah; + size_t prefix_len = output_prefix ? strlen (output_prefix) : 0; +- char archivefname[prefix_len + sizeof (ARCHIVE_NAME)]; +- char fname[prefix_len + sizeof (ARCHIVE_NAME) + sizeof (".XXXXXX") - 1]; ++ char *archivefname; ++ char *fname; ++ char *envarchive = getenv("LOCALEARCHIVE"); + +- if (output_prefix) +- memcpy (archivefname, output_prefix, prefix_len); +- strcpy (archivefname + prefix_len, ARCHIVE_NAME); ++ if (envarchive != NULL) ++ { ++ archivefname = xmalloc(strlen(envarchive) + 1); ++ fname = xmalloc(strlen(envarchive) + sizeof (".XXXXXX")); ++ strcpy (archivefname, envarchive); ++ } ++ else ++ { ++ archivefname = xmalloc(prefix_len + sizeof (ARCHIVE_NAME)); ++ fname = xmalloc(prefix_len + sizeof (ARCHIVE_NAME) + sizeof (".XXXXXX") - 1); ++ if (output_prefix) ++ memcpy (archivefname, output_prefix, prefix_len); ++ strcpy (archivefname + prefix_len, ARCHIVE_NAME); ++ } + strcpy (stpcpy (fname, archivefname), ".XXXXXX"); + + /* Not all of the old file has to be mapped. Change this now this +@@ -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 (archivefname == NULL) + { +- archivefname = default_fname; +- if (output_prefix) +- memcpy (default_fname, output_prefix, prefix_len); +- strcpy (default_fname + prefix_len, ARCHIVE_NAME); ++ archivefname = getenv("LOCALEARCHIVE"); ++ if (archivefname == NULL) { ++ archivefname = default_fname; ++ if (output_prefix) ++ memcpy (default_fname, output_prefix, prefix_len); ++ strcpy (default_fname + prefix_len, ARCHIVE_NAME); ++ } + } + + while (1) +@@ -584,7 +599,7 @@ open_archive (struct locarhandle *ah, bool readonly) + the default locale archive we ignore the failure and + list an empty archive, otherwise we print an error + and exit. */ +- if (errno == ENOENT && archivefname == default_fname) ++ if (errno == ENOENT) + { + if (readonly) + { diff --git a/meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch b/meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch deleted file mode 100644 index 1b99af7110..0000000000 --- a/meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch +++ /dev/null @@ -1,39 +0,0 @@ -From b4613f814ba7ba5db95d18116172f81a83ac8f5b Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 18 Mar 2015 00:27:10 +0000 -Subject: [PATCH] sysdeps/gnu/configure.ac: handle correctly - $libc_cv_rootsbindir - -Upstream-Status: Pending - -Signed-off-by: Matthieu Crapet -Signed-off-by: Khem Raj ---- - sysdeps/gnu/configure | 2 +- - sysdeps/gnu/configure.ac | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/sysdeps/gnu/configure b/sysdeps/gnu/configure -index c15d1087e8..37cc983f2a 100644 ---- a/sysdeps/gnu/configure -+++ b/sysdeps/gnu/configure -@@ -32,6 +32,6 @@ case "$prefix" in - else - libc_cv_localstatedir=$localstatedir - fi -- libc_cv_rootsbindir=/sbin -+ test -n "$libc_cv_rootsbindir" || libc_cv_rootsbindir=/sbin - ;; - esac -diff --git a/sysdeps/gnu/configure.ac b/sysdeps/gnu/configure.ac -index 634fe4de2a..3db1697f4f 100644 ---- a/sysdeps/gnu/configure.ac -+++ b/sysdeps/gnu/configure.ac -@@ -21,6 +21,6 @@ case "$prefix" in - else - libc_cv_localstatedir=$localstatedir - fi -- libc_cv_rootsbindir=/sbin -+ test -n "$libc_cv_rootsbindir" || libc_cv_rootsbindir=/sbin - ;; - esac diff --git a/meta/recipes-core/glibc/glibc/0016-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch b/meta/recipes-core/glibc/glibc/0016-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch new file mode 100644 index 0000000000..4e51036ce5 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0016-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch @@ -0,0 +1,53 @@ +From c59bc6eb421ad3310c43951a11d2561bbf34e95e Mon Sep 17 00:00:00 2001 +From: Martin Jansa +Date: Mon, 17 Dec 2018 21:36:18 +0000 +Subject: [PATCH] locale: prevent maybe-uninitialized errors with -Os [BZ + #19444] + +Fixes following error when building for aarch64 with -Os: +| In file included from strcoll_l.c:43: +| strcoll_l.c: In function '__strcoll_l': +| ../locale/weight.h:31:26: error: 'seq2.back_us' may be used uninitialized in this function [-Werror=maybe-uninitialized] +| int_fast32_t i = table[*(*cpp)++]; +| ^~~~~~~~~ +| strcoll_l.c:304:18: note: 'seq2.back_us' was declared here +| coll_seq seq1, seq2; +| ^~~~ +| In file included from strcoll_l.c:43: +| ../locale/weight.h:31:26: error: 'seq1.back_us' may be used uninitialized in this function [-Werror=maybe-uninitialized] +| int_fast32_t i = table[*(*cpp)++]; +| ^~~~~~~~~ +| strcoll_l.c:304:12: note: 'seq1.back_us' was declared here +| coll_seq seq1, seq2; +| ^~~~ + + Partial fix for [BZ #19444] + * locale/weight.h: Fix build with -Os. + +Upstream-Status: Submitted [https://patchwork.ozlabs.org/patch/1014766] + +Signed-off-by: Martin Jansa +Signed-off-by: Khem Raj +--- + locale/weight.h | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/locale/weight.h b/locale/weight.h +index 076529c0ba..2ac83657f7 100644 +--- a/locale/weight.h ++++ b/locale/weight.h +@@ -27,7 +27,14 @@ findidx (const int32_t *table, + const unsigned char *extra, + const unsigned char **cpp, size_t len) + { ++ /* With GCC 8 when compiling with -Os the compiler warns that ++ seq1.back_us and seq2.back_us might be used uninitialized. ++ This uninitialized use is impossible for the same reason ++ as described in comments in locale/weightwc.h. */ ++ DIAG_PUSH_NEEDS_COMMENT; ++ DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); + int_fast32_t i = table[*(*cpp)++]; ++ DIAG_POP_NEEDS_COMMENT; + const unsigned char *cp; + const unsigned char *usrc; + diff --git a/meta/recipes-core/glibc/glibc/0016-yes-within-the-path-sets-wrong-config-variables.patch b/meta/recipes-core/glibc/glibc/0016-yes-within-the-path-sets-wrong-config-variables.patch deleted file mode 100644 index f7e7f1cd10..0000000000 --- a/meta/recipes-core/glibc/glibc/0016-yes-within-the-path-sets-wrong-config-variables.patch +++ /dev/null @@ -1,260 +0,0 @@ -From 7be3e82b66394a7b242e56c6fc609e858b8e2436 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 18 Mar 2015 00:31:06 +0000 -Subject: [PATCH] 'yes' within the path sets wrong config variables - -It seems that the 'AC_EGREP_CPP(yes...' example is quite popular -but being such a short word to grep it is likely to produce -false-positive matches with the path it is configured into. - -The change is to use a more elaborated string to grep for. - -Upstream-Status: Submitted [libc-alpha@sourceware.org] - -Signed-off-by: Benjamin Esquivel -Signed-off-by: Khem Raj ---- - sysdeps/aarch64/configure | 4 ++-- - sysdeps/aarch64/configure.ac | 4 ++-- - sysdeps/arm/configure | 4 ++-- - sysdeps/arm/configure.ac | 4 ++-- - sysdeps/mips/configure | 4 ++-- - sysdeps/mips/configure.ac | 4 ++-- - sysdeps/nios2/configure | 4 ++-- - sysdeps/nios2/configure.ac | 4 ++-- - sysdeps/unix/sysv/linux/mips/configure | 4 ++-- - sysdeps/unix/sysv/linux/mips/configure.ac | 4 ++-- - sysdeps/unix/sysv/linux/powerpc/powerpc64/configure | 8 ++++---- - sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac | 8 ++++---- - 12 files changed, 28 insertions(+), 28 deletions(-) - -diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure -index 4c1fac49f3..597314f476 100644 ---- a/sysdeps/aarch64/configure -+++ b/sysdeps/aarch64/configure -@@ -157,12 +157,12 @@ else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - #ifdef __AARCH64EB__ -- yes -+ is_aarch64_be - #endif - - _ACEOF - if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -- $EGREP "yes" >/dev/null 2>&1; then : -+ $EGREP "is_aarch64_be" >/dev/null 2>&1; then : - libc_cv_aarch64_be=yes - else - libc_cv_aarch64_be=no -diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac -index 3347c13fa1..4af163c0b6 100644 ---- a/sysdeps/aarch64/configure.ac -+++ b/sysdeps/aarch64/configure.ac -@@ -17,8 +17,8 @@ AC_DEFINE(SUPPORT_STATIC_PIE) - # the dynamic linker via %ifdef. - AC_CACHE_CHECK([for big endian], - [libc_cv_aarch64_be], -- [AC_EGREP_CPP(yes,[#ifdef __AARCH64EB__ -- yes -+ [AC_EGREP_CPP(is_aarch64_be,[#ifdef __AARCH64EB__ -+ is_aarch64_be - #endif - ], libc_cv_aarch64_be=yes, libc_cv_aarch64_be=no)]) - if test $libc_cv_aarch64_be = yes; then -diff --git a/sysdeps/arm/configure b/sysdeps/arm/configure -index 431e843b2b..e152461138 100644 ---- a/sysdeps/arm/configure -+++ b/sysdeps/arm/configure -@@ -151,12 +151,12 @@ else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - #ifdef __ARM_PCS_VFP -- yes -+ use_arm_pcs_vfp - #endif - - _ACEOF - if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -- $EGREP "yes" >/dev/null 2>&1; then : -+ $EGREP "use_arm_pcs_vfp" >/dev/null 2>&1; then : - libc_cv_arm_pcs_vfp=yes - else - libc_cv_arm_pcs_vfp=no -diff --git a/sysdeps/arm/configure.ac b/sysdeps/arm/configure.ac -index 90cdd69c75..05a262ba00 100644 ---- a/sysdeps/arm/configure.ac -+++ b/sysdeps/arm/configure.ac -@@ -15,8 +15,8 @@ AC_DEFINE(PI_STATIC_AND_HIDDEN) - # the dynamic linker via %ifdef. - AC_CACHE_CHECK([whether the compiler is using the ARM hard-float ABI], - [libc_cv_arm_pcs_vfp], -- [AC_EGREP_CPP(yes,[#ifdef __ARM_PCS_VFP -- yes -+ [AC_EGREP_CPP(use_arm_pcs_vfp,[#ifdef __ARM_PCS_VFP -+ use_arm_pcs_vfp - #endif - ], libc_cv_arm_pcs_vfp=yes, libc_cv_arm_pcs_vfp=no)]) - if test $libc_cv_arm_pcs_vfp = yes; then -diff --git a/sysdeps/mips/configure b/sysdeps/mips/configure -index 4e13248c03..f14af952d0 100644 ---- a/sysdeps/mips/configure -+++ b/sysdeps/mips/configure -@@ -143,11 +143,11 @@ else - /* end confdefs.h. */ - dnl - #ifdef __mips_nan2008 --yes -+use_mips_nan2008 - #endif - _ACEOF - if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -- $EGREP "yes" >/dev/null 2>&1; then : -+ $EGREP "use_mips_nan2008" >/dev/null 2>&1; then : - libc_cv_mips_nan2008=yes - else - libc_cv_mips_nan2008=no -diff --git a/sysdeps/mips/configure.ac b/sysdeps/mips/configure.ac -index bcbdaffd9f..ad3057f4cc 100644 ---- a/sysdeps/mips/configure.ac -+++ b/sysdeps/mips/configure.ac -@@ -6,9 +6,9 @@ dnl position independent way. - dnl AC_DEFINE(PI_STATIC_AND_HIDDEN) - - 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(use_mips_nan2008, [dnl - #ifdef __mips_nan2008 --yes -+use_mips_nan2008 - #endif], libc_cv_mips_nan2008=yes, libc_cv_mips_nan2008=no)]) - if test x$libc_cv_mips_nan2008 = xyes; then - AC_DEFINE(HAVE_MIPS_NAN2008) -diff --git a/sysdeps/nios2/configure b/sysdeps/nios2/configure -index 14c8a3a014..dde3814ef2 100644 ---- a/sysdeps/nios2/configure -+++ b/sysdeps/nios2/configure -@@ -142,12 +142,12 @@ else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - #ifdef __nios2_big_endian__ -- yes -+ is_nios2_be - #endif - - _ACEOF - if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -- $EGREP "yes" >/dev/null 2>&1; then : -+ $EGREP "is_nios2_be" >/dev/null 2>&1; then : - libc_cv_nios2_be=yes - else - libc_cv_nios2_be=no -diff --git a/sysdeps/nios2/configure.ac b/sysdeps/nios2/configure.ac -index f05f43802b..dc8639902d 100644 ---- a/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. - # Nios II big endian is not yet supported. - AC_CACHE_CHECK([for big endian], - [libc_cv_nios2_be], -- [AC_EGREP_CPP(yes,[#ifdef __nios2_big_endian__ -- yes -+ [AC_EGREP_CPP(is_nios2_be,[#ifdef __nios2_big_endian__ -+ is_nios2_be - #endif - ], libc_cv_nios2_be=yes, libc_cv_nios2_be=no)]) - if test $libc_cv_nios2_be = yes; then -diff --git a/sysdeps/unix/sysv/linux/mips/configure b/sysdeps/unix/sysv/linux/mips/configure -index f25f2a3a65..1b7483e6c6 100644 ---- a/sysdeps/unix/sysv/linux/mips/configure -+++ b/sysdeps/unix/sysv/linux/mips/configure -@@ -414,11 +414,11 @@ else - /* end confdefs.h. */ - dnl - #ifdef __mips_nan2008 --yes -+use_mips_nan2008 - #endif - _ACEOF - if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -- $EGREP "yes" >/dev/null 2>&1; then : -+ $EGREP "use_mips_nan2008" >/dev/null 2>&1; then : - libc_cv_mips_nan2008=yes - else - libc_cv_mips_nan2008=no -diff --git a/sysdeps/unix/sysv/linux/mips/configure.ac b/sysdeps/unix/sysv/linux/mips/configure.ac -index 049a0f4bdf..005526d4e8 100644 ---- a/sysdeps/unix/sysv/linux/mips/configure.ac -+++ b/sysdeps/unix/sysv/linux/mips/configure.ac -@@ -105,9 +105,9 @@ AC_COMPILE_IFELSE( - LIBC_CONFIG_VAR([mips-mode-switch],[${libc_mips_mode_switch}]) - - 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(use_mips_nan2008, [dnl - #ifdef __mips_nan2008 --yes -+use_mips_nan2008 - #endif], libc_cv_mips_nan2008=yes, libc_cv_mips_nan2008=no)]) - - libc_mips_nan= -diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure -index ae7f254da4..874519000b 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure -+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure -@@ -155,12 +155,12 @@ else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - #if _CALL_ELF == 2 -- yes -+ use_ppc_elfv2_abi - #endif - - _ACEOF - if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -- $EGREP "yes" >/dev/null 2>&1; then : -+ $EGREP "use_ppc_elfv2_abi" >/dev/null 2>&1; then : - libc_cv_ppc64_elfv2_abi=yes - else - libc_cv_ppc64_elfv2_abi=no -@@ -188,12 +188,12 @@ else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - #ifdef _CALL_ELF -- yes -+ is_def_call_elf - #endif - - _ACEOF - if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -- $EGREP "yes" >/dev/null 2>&1; then : -+ $EGREP "is_def_call_elf" >/dev/null 2>&1; then : - libc_cv_ppc64_def_call_elf=yes - else - libc_cv_ppc64_def_call_elf=no -diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac -index f9cba6e15d..b21f72f1e4 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac -+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac -@@ -6,8 +6,8 @@ LIBC_SLIBDIR_RTLDDIR([lib64], [lib64]) - # Define default-abi according to compiler flags. - AC_CACHE_CHECK([whether the compiler is using the PowerPC64 ELFv2 ABI], - [libc_cv_ppc64_elfv2_abi], -- [AC_EGREP_CPP(yes,[#if _CALL_ELF == 2 -- yes -+ [AC_EGREP_CPP(use_ppc_elfv2_abi,[#if _CALL_ELF == 2 -+ use_ppc_elfv2_abi - #endif - ], libc_cv_ppc64_elfv2_abi=yes, libc_cv_ppc64_elfv2_abi=no)]) - if test $libc_cv_ppc64_elfv2_abi = yes; then -@@ -19,8 +19,8 @@ else - # Compiler that do not support ELFv2 ABI does not define _CALL_ELF - AC_CACHE_CHECK([whether the compiler defines _CALL_ELF], - [libc_cv_ppc64_def_call_elf], -- [AC_EGREP_CPP(yes,[#ifdef _CALL_ELF -- yes -+ [AC_EGREP_CPP(is_def_call_elf,[#ifdef _CALL_ELF -+ is_def_call_elf - #endif - ], libc_cv_ppc64_def_call_elf=yes, libc_cv_ppc64_def_call_elf=no)]) - if test $libc_cv_ppc64_def_call_elf = no; then diff --git a/meta/recipes-core/glibc/glibc/0017-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch b/meta/recipes-core/glibc/glibc/0017-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch new file mode 100644 index 0000000000..77a2bab87d --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0017-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch @@ -0,0 +1,29 @@ +From 9f4fcec5662bfa6f8aa6a36dda6f4c05f6e30e51 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:11:22 +0000 +Subject: [PATCH] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known names + +This bolts in a hook for OE to pass its own version of interpreter +names into glibc especially for multilib case, where it differs from any +other distros + +Upstream-Status: Inappropriate [OE specific] + +Signed-off-by: Lianhao Lu +Signed-off-by: Khem Raj +--- + elf/readlib.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/elf/readlib.c b/elf/readlib.c +index 64b20d7804..50318158fb 100644 +--- a/elf/readlib.c ++++ b/elf/readlib.c +@@ -49,6 +49,7 @@ static struct known_names interpreters[] = + #ifdef SYSDEP_KNOWN_INTERPRETER_NAMES + SYSDEP_KNOWN_INTERPRETER_NAMES + #endif ++ OECORE_KNOWN_INTERPRETER_NAMES + }; + + static struct known_names known_libs[] = diff --git a/meta/recipes-core/glibc/glibc/0018-Remove-bash-dependency-for-nscd-init-script.patch b/meta/recipes-core/glibc/glibc/0018-Remove-bash-dependency-for-nscd-init-script.patch deleted file mode 100644 index 23296da61d..0000000000 --- a/meta/recipes-core/glibc/glibc/0018-Remove-bash-dependency-for-nscd-init-script.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 412d33bbfe42a10a9b1f62afcc73fe121a0363b0 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Thu, 31 Dec 2015 14:33:02 -0800 -Subject: [PATCH] Remove bash dependency for 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. - -Upstream-Status: Pending - -Signed-off-by: Ross Burton -Signed-off-by: Khem Raj ---- - nscd/nscd.init | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/nscd/nscd.init b/nscd/nscd.init -index a882da7d8b..b02986ec15 100644 ---- a/nscd/nscd.init -+++ b/nscd/nscd.init -@@ -1,4 +1,4 @@ --#!/bin/bash -+#!/bin/sh - # - # nscd: Starts the Name Switch Cache Daemon - # -@@ -49,7 +49,7 @@ prog=nscd - start () { - [ -d /var/run/nscd ] || mkdir /var/run/nscd - [ -d /var/db/nscd ] || mkdir /var/db/nscd -- echo -n $"Starting $prog: " -+ echo -n "Starting $prog: " - daemon /usr/sbin/nscd - RETVAL=$? - echo -@@ -58,7 +58,7 @@ start () { - } - - stop () { -- echo -n $"Stopping $prog: " -+ echo -n "Stopping $prog: " - /usr/sbin/nscd -K - RETVAL=$? - if [ $RETVAL -eq 0 ]; then -@@ -67,9 +67,9 @@ stop () { - # a non-privileged user - rm -f /var/run/nscd/nscd.pid - rm -f /var/run/nscd/socket -- success $"$prog shutdown" -+ success "$prog shutdown" - else -- failure $"$prog shutdown" -+ failure "$prog shutdown" - fi - echo - return $RETVAL -@@ -103,13 +103,13 @@ case "$1" in - RETVAL=$? - ;; - force-reload | reload) -- echo -n $"Reloading $prog: " -+ echo -n "Reloading $prog: " - killproc /usr/sbin/nscd -HUP - RETVAL=$? - echo - ;; - *) -- echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}" -+ echo "Usage: $0 {start|stop|status|restart|reload|condrestart}" - RETVAL=1 - ;; - esac diff --git a/meta/recipes-core/glibc/glibc/0018-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch b/meta/recipes-core/glibc/glibc/0018-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch new file mode 100644 index 0000000000..63f7749ecb --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0018-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch @@ -0,0 +1,78 @@ +From 4d6bce6b106d9d9a629aadba74d74cd8a500ccbf Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 15 May 2020 17:05:45 -0700 +Subject: [PATCH 18/24] wordsize.h: Unify the header between arm and aarch64 + +This helps OE multilibs to not sythesize this header which causes all +kind of recursions and other issues since wordsize is fundamental header +and ends up including itself in many case e.g. clang tidy, bpf etc. + +Upstream-Status: Inappropriate [ OE-Specific ] + +Signed-off-by: Khem Raj +--- + 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%) + +diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h +index 4635431f0e..5ef0ed21f3 100644 +--- a/sysdeps/aarch64/bits/wordsize.h ++++ b/sysdeps/aarch64/bits/wordsize.h +@@ -17,12 +17,16 @@ + License along with the GNU C Library; if not, see + . */ + +-#ifdef __LP64__ ++#if defined (__aarch64__) && defined (__LP64__) + # define __WORDSIZE 64 +-#else ++#elif defined (__aarch64__) + # define __WORDSIZE 32 + # define __WORDSIZE32_SIZE_ULONG 1 + # define __WORDSIZE32_PTRDIFF_LONG 1 ++#else ++# define __WORDSIZE 32 ++# define __WORDSIZE32_SIZE_ULONG 0 ++# define __WORDSIZE32_PTRDIFF_LONG 0 + #endif + + #define __WORDSIZE_TIME64_COMPAT32 0 +diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/arm/bits/wordsize.h +similarity index 80% +copy from sysdeps/aarch64/bits/wordsize.h +copy to sysdeps/arm/bits/wordsize.h +index 4635431f0e..34fcdef1f1 100644 +--- a/sysdeps/aarch64/bits/wordsize.h ++++ b/sysdeps/arm/bits/wordsize.h +@@ -1,6 +1,6 @@ + /* Determine the wordsize from the preprocessor defines. + +- Copyright (C) 2016-2022 Free Software Foundation, Inc. ++ Copyright (C) 2016-2020 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 +@@ -17,12 +17,16 @@ + License along with the GNU C Library; if not, see + . */ + +-#ifdef __LP64__ ++#if defined (__aarch64__) && defined (__LP64__) + # define __WORDSIZE 64 +-#else ++#elif defined (__aarch64__) + # define __WORDSIZE 32 + # define __WORDSIZE32_SIZE_ULONG 1 + # define __WORDSIZE32_PTRDIFF_LONG 1 ++#else ++# define __WORDSIZE 32 ++# define __WORDSIZE32_SIZE_ULONG 0 ++# define __WORDSIZE32_PTRDIFF_LONG 0 + #endif + + #define __WORDSIZE_TIME64_COMPAT32 0 +-- +2.34.1 + diff --git a/meta/recipes-core/glibc/glibc/0019-eglibc-Cross-building-and-testing-instructions.patch b/meta/recipes-core/glibc/glibc/0019-eglibc-Cross-building-and-testing-instructions.patch deleted file mode 100644 index 8fb9182d98..0000000000 --- a/meta/recipes-core/glibc/glibc/0019-eglibc-Cross-building-and-testing-instructions.patch +++ /dev/null @@ -1,616 +0,0 @@ -From db9674ffc6583a508da1a3cb044c3ccf3febaea1 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 18 Mar 2015 00:42:58 +0000 -Subject: [PATCH] eglibc: Cross building and testing instructions - -Ported from eglibc -Upstream-Status: Pending - -Signed-off-by: Khem Raj ---- - GLIBC.cross-building | 383 +++++++++++++++++++++++++++++++++++++++++++ - GLIBC.cross-testing | 205 +++++++++++++++++++++++ - 2 files changed, 588 insertions(+) - create mode 100644 GLIBC.cross-building - create mode 100644 GLIBC.cross-testing - -diff --git a/GLIBC.cross-building b/GLIBC.cross-building -new file mode 100644 -index 0000000000..e6e0da1aaf ---- /dev/null -+++ b/GLIBC.cross-building -@@ -0,0 +1,383 @@ -+ -*- mode: text -*- -+ -+ Cross-Compiling GLIBC -+ Jim Blandy -+ -+ -+Introduction -+ -+Most GNU tools have a simple build procedure: you run their -+'configure' script, and then you run 'make'. Unfortunately, the -+process of cross-compiling the GNU C library is quite a bit more -+involved: -+ -+1) Build a cross-compiler, with certain facilities disabled. -+ -+2) Configure the C library using the compiler you built in step 1). -+ Build a few of the C run-time object files, but not the rest of the -+ library. Install the library's header files and the run-time -+ object files, and create a dummy libc.so. -+ -+3) Build a second cross-compiler, using the header files and object -+ files you installed in step 2. -+ -+4) Configure, build, and install a fresh C library, using the compiler -+ built in step 3. -+ -+5) Build a third cross-compiler, based on the C library built in step 4. -+ -+The reason for this complexity is that, although GCC and the GNU C -+library are distributed separately, they are not actually independent -+of each other: GCC requires the C library's headers and some object -+files to compile its own libraries, while the C library depends on -+GCC's libraries. GLIBC includes features and bug fixes to the stock -+GNU C library that simplify this process, but the fundamental -+interdependency stands. -+ -+In this document, we explain how to cross-compile an GLIBC/GCC pair -+from source. Our intended audience is developers who are already -+familiar with the GNU toolchain and comfortable working with -+cross-development tools. While we do present a worked example to -+accompany the explanation, for clarity's sake we do not cover many of -+the options available to cross-toolchain users. -+ -+ -+Preparation -+ -+GLIBC requires recent versions of the GNU binutils, GCC, and the -+Linux kernel. The web page -+documents the current requirements, and lists patches needed for -+certain target architectures. As of this writing, these build -+instructions have been tested with binutils 2.22.51, GCC 4.6.2, -+and Linux 3.1. -+ -+First, let's set some variables, to simplify later commands. We'll -+build GLIBC and GCC for an ARM target, known to the Linux kernel -+as 'arm', and we'll do the build on an Intel x86_64 Linux box: -+ -+ $ build=x86_64-pc-linux-gnu -+ $ host=$build -+ $ target=arm-none-linux-gnueabi -+ $ linux_arch=arm -+ -+We're using the aforementioned versions of Binutils, GCC, and Linux: -+ -+ $ binutilsv=binutils-2.22.51 -+ $ gccv=gcc-4.6.2 -+ $ linuxv=linux-3.1 -+ -+We're carrying out the entire process under '~/cross-build', which -+contains unpacked source trees for binutils, gcc, and linux kernel, -+along with GLIBC svn trunk (which can be checked-out with -+'svn co http://www.eglibc.org/svn/trunk eglibc'): -+ -+ $ top=$HOME/cross-build/$target -+ $ src=$HOME/cross-build/src -+ $ ls $src -+ binutils-2.22.51 glibc gcc-4.6.2 linux-3.1 -+ -+We're going to place our build directories in a subdirectory 'obj', -+we'll install the cross-development toolchain in 'tools', and we'll -+place our sysroot (containing files to be installed on the target -+system) in 'sysroot': -+ -+ $ obj=$top/obj -+ $ tools=$top/tools -+ $ sysroot=$top/sysroot -+ -+ -+Binutils -+ -+Configuring and building binutils for the target is straightforward: -+ -+ $ mkdir -p $obj/binutils -+ $ cd $obj/binutils -+ $ $src/$binutilsv/configure \ -+ > --target=$target \ -+ > --prefix=$tools \ -+ > --with-sysroot=$sysroot -+ $ make -+ $ make install -+ -+ -+The First GCC -+ -+For our work, we need a cross-compiler targeting an ARM Linux -+system. However, that configuration includes the shared library -+'libgcc_s.so', which is compiled against the GLIBC headers (which we -+haven't installed yet) and linked against 'libc.so' (which we haven't -+built yet). -+ -+Fortunately, there are configuration options for GCC which tell it not -+to build 'libgcc_s.so'. The '--without-headers' option is supposed to -+take care of this, but its implementation is incomplete, so you must -+also configure with the '--with-newlib' option. While '--with-newlib' -+appears to mean "Use the Newlib C library", its effect is to tell the -+GCC build machinery, "Don't assume there is a C library available." -+ -+We also need to disable some of the libraries that would normally be -+built along with GCC, and specify that only the compiler for the C -+language is needed. -+ -+So, we create a build directory, configure, make, and install. -+ -+ $ mkdir -p $obj/gcc1 -+ $ cd $obj/gcc1 -+ $ $src/$gccv/configure \ -+ > --target=$target \ -+ > --prefix=$tools \ -+ > --without-headers --with-newlib \ -+ > --disable-shared --disable-threads --disable-libssp \ -+ > --disable-libgomp --disable-libmudflap --disable-libquadmath \ -+ > --disable-decimal-float --disable-libffi \ -+ > --enable-languages=c -+ $ PATH=$tools/bin:$PATH make -+ $ PATH=$tools/bin:$PATH make install -+ -+ -+Linux Kernel Headers -+ -+To configure GLIBC, we also need Linux kernel headers in place. -+Fortunately, the Linux makefiles have a target that installs them for -+us. Since the process does modify the source tree a bit, we make a -+copy first: -+ -+ $ cp -r $src/$linuxv $obj/linux -+ $ cd $obj/linux -+ -+Now we're ready to install the headers into the sysroot: -+ -+ $ PATH=$tools/bin:$PATH \ -+ > make headers_install \ -+ > ARCH=$linux_arch CROSS_COMPILE=$target- \ -+ > INSTALL_HDR_PATH=$sysroot/usr -+ -+ -+GLIBC Headers and Preliminary Objects -+ -+Using the cross-compiler we've just built, we can now configure GLIBC -+well enough to install the headers and build the object files that the -+full cross-compiler will need: -+ -+ $ mkdir -p $obj/glibc-headers -+ $ cd $obj/glibc-headers -+ $ BUILD_CC=gcc \ -+ > CC=$tools/bin/$target-gcc \ -+ > CXX=$tools/bin/$target-g++ \ -+ > AR=$tools/bin/$target-ar \ -+ > RANLIB=$tools/bin/$target-ranlib \ -+ > $src/glibc/libc/configure \ -+ > --prefix=/usr \ -+ > --with-headers=$sysroot/usr/include \ -+ > --build=$build \ -+ > --host=$target \ -+ > --disable-profile --without-gd --without-cvs \ -+ > --enable-add-ons=nptl,libidn,../ports -+ -+The option '--prefix=/usr' may look strange, but you should never -+configure GLIBC with a prefix other than '/usr': in various places, -+GLIBC's build system checks whether the prefix is '/usr', and does -+special handling only if that is the case. Unless you use this -+prefix, you will get a sysroot that does not use the standard Linux -+directory layouts and cannot be used as a basis for the root -+filesystem on your target system compatibly with normal GLIBC -+installations. -+ -+The '--with-headers' option tells GLIBC where the Linux headers have -+been installed. -+ -+The '--enable-add-ons=nptl,libidn,../ports' option tells GLIBC to look -+for the listed glibc add-ons. Most notably the ports add-on (located -+just above the libc sources in the GLIBC svn tree) is required to -+support ARM targets. -+ -+We can now use the 'install-headers' makefile target to install the -+headers: -+ -+ $ make install-headers install_root=$sysroot \ -+ > install-bootstrap-headers=yes -+ -+The 'install_root' variable indicates where the files should actually -+be installed; its value is treated as the parent of the '--prefix' -+directory we passed to the configure script, so the headers will go in -+'$sysroot/usr/include'. The 'install-bootstrap-headers' variable -+requests special handling for certain tricky header files. -+ -+Next, there are a few object files needed to link shared libraries, -+which we build and install by hand: -+ -+ $ mkdir -p $sysroot/usr/lib -+ $ make csu/subdir_lib -+ $ cp csu/crt1.o csu/crti.o csu/crtn.o $sysroot/usr/lib -+ -+Finally, 'libgcc_s.so' requires a 'libc.so' to link against. However, -+since we will never actually execute its code, it doesn't matter what -+it contains. So, treating '/dev/null' as a C source file, we produce -+a dummy 'libc.so' in one step: -+ -+ $ $tools/bin/$target-gcc -nostdlib -nostartfiles -shared -x c /dev/null \ -+ > -o $sysroot/usr/lib/libc.so -+ -+ -+The Second GCC -+ -+With the GLIBC headers and selected object files installed, we can -+now build a GCC that is capable of compiling GLIBC. We configure, -+build, and install the second GCC, again building only the C compiler, -+and avoiding libraries we won't use: -+ -+ $ mkdir -p $obj/gcc2 -+ $ cd $obj/gcc2 -+ $ $src/$gccv/configure \ -+ > --target=$target \ -+ > --prefix=$tools \ -+ > --with-sysroot=$sysroot \ -+ > --disable-libssp --disable-libgomp --disable-libmudflap \ -+ > --disable-libffi --disable-libquadmath \ -+ > --enable-languages=c -+ $ PATH=$tools/bin:$PATH make -+ $ PATH=$tools/bin:$PATH make install -+ -+ -+GLIBC, Complete -+ -+With the second compiler built and installed, we're now ready for the -+full GLIBC build: -+ -+ $ mkdir -p $obj/glibc -+ $ cd $obj/glibc -+ $ BUILD_CC=gcc \ -+ > CC=$tools/bin/$target-gcc \ -+ > CXX=$tools/bin/$target-g++ \ -+ > AR=$tools/bin/$target-ar \ -+ > RANLIB=$tools/bin/$target-ranlib \ -+ > $src/glibc/libc/configure \ -+ > --prefix=/usr \ -+ > --with-headers=$sysroot/usr/include \ -+ > --with-kconfig=$obj/linux/scripts/kconfig \ -+ > --build=$build \ -+ > --host=$target \ -+ > --disable-profile --without-gd --without-cvs \ -+ > --enable-add-ons=nptl,libidn,../ports -+ -+Note the additional '--with-kconfig' option. This tells GLIBC where to -+find the host config tools used by the kernel 'make config' and 'make -+menuconfig'. These tools can be re-used by GLIBC for its own 'make -+*config' support, which will create 'option-groups.config' for you. -+But first make sure those tools have been built by running some -+dummy 'make *config' calls in the kernel directory: -+ -+ $ cd $obj/linux -+ $ PATH=$tools/bin:$PATH make config \ -+ > ARCH=$linux_arch CROSS_COMPILE=$target- \ -+ $ PATH=$tools/bin:$PATH make menuconfig \ -+ > ARCH=$linux_arch CROSS_COMPILE=$target- \ -+ -+Now we can configure and build the full GLIBC: -+ -+ $ cd $obj/glibc -+ $ PATH=$tools/bin:$PATH make defconfig -+ $ PATH=$tools/bin:$PATH make menuconfig -+ $ PATH=$tools/bin:$PATH make -+ $ PATH=$tools/bin:$PATH make install install_root=$sysroot -+ -+At this point, we have a complete GLIBC installation in '$sysroot', -+with header files, library files, and most of the C runtime startup -+files in place. -+ -+ -+The Third GCC -+ -+Finally, we recompile GCC against this full installation, enabling -+whatever languages and libraries we would like to use: -+ -+ $ mkdir -p $obj/gcc3 -+ $ cd $obj/gcc3 -+ $ $src/$gccv/configure \ -+ > --target=$target \ -+ > --prefix=$tools \ -+ > --with-sysroot=$sysroot \ -+ > --enable-__cxa_atexit \ -+ > --disable-libssp --disable-libgomp --disable-libmudflap \ -+ > --enable-languages=c,c++ -+ $ PATH=$tools/bin:$PATH make -+ $ PATH=$tools/bin:$PATH make install -+ -+The '--enable-__cxa_atexit' option tells GCC what sort of C++ -+destructor support to expect from the C library; it's required with -+GLIBC. -+ -+And since GCC's installation process isn't designed to help construct -+sysroot trees, we must manually copy certain libraries into place in -+the sysroot. -+ -+ $ cp -d $tools/$target/lib/libgcc_s.so* $sysroot/lib -+ $ cp -d $tools/$target/lib/libstdc++.so* $sysroot/usr/lib -+ -+ -+Trying Things Out -+ -+At this point, '$tools' contains a cross toolchain ready to use -+the GLIBC installation in '$sysroot': -+ -+ $ cat > hello.c < #include -+ > int -+ > main (int argc, char **argv) -+ > { -+ > puts ("Hello, world!"); -+ > return 0; -+ > } -+ > EOF -+ $ $tools/bin/$target-gcc -Wall hello.c -o hello -+ $ cat > c++-hello.cc < #include -+ > int -+ > main (int argc, char **argv) -+ > { -+ > std::cout << "Hello, C++ world!" << std::endl; -+ > return 0; -+ > } -+ > EOF -+ $ $tools/bin/$target-g++ -Wall c++-hello.cc -o c++-hello -+ -+ -+We can use 'readelf' to verify that these are indeed executables for -+our target, using our dynamic linker: -+ -+ $ $tools/bin/$target-readelf -hl hello -+ ELF Header: -+ ... -+ Type: EXEC (Executable file) -+ Machine: ARM -+ -+ ... -+ Program Headers: -+ Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align -+ PHDR 0x000034 0x10000034 0x10000034 0x00100 0x00100 R E 0x4 -+ INTERP 0x000134 0x00008134 0x00008134 0x00013 0x00013 R 0x1 -+ [Requesting program interpreter: /lib/ld-linux.so.3] -+ LOAD 0x000000 0x00008000 0x00008000 0x0042c 0x0042c R E 0x8000 -+ ... -+ -+Looking at the dynamic section of the installed 'libgcc_s.so', we see -+that the 'NEEDED' entry for the C library does include the '.6' -+suffix, indicating that was linked against our fully build GLIBC, and -+not our dummy 'libc.so': -+ -+ $ $tools/bin/$target-readelf -d $sysroot/lib/libgcc_s.so.1 -+ Dynamic section at offset 0x1083c contains 24 entries: -+ Tag Type Name/Value -+ 0x00000001 (NEEDED) Shared library: [libc.so.6] -+ 0x0000000e (SONAME) Library soname: [libgcc_s.so.1] -+ ... -+ -+ -+And on the target machine, we can run our programs: -+ -+ $ $sysroot/lib/ld.so.1 --library-path $sysroot/lib:$sysroot/usr/lib \ -+ > ./hello -+ Hello, world! -+ $ $sysroot/lib/ld.so.1 --library-path $sysroot/lib:$sysroot/usr/lib \ -+ > ./c++-hello -+ Hello, C++ world! -diff --git a/GLIBC.cross-testing b/GLIBC.cross-testing -new file mode 100644 -index 0000000000..b67b468466 ---- /dev/null -+++ b/GLIBC.cross-testing -@@ -0,0 +1,205 @@ -+ -*- mode: text -*- -+ -+ Cross-Testing With GLIBC -+ Jim Blandy -+ -+ -+Introduction -+ -+Developers writing software for embedded systems often use a desktop -+or other similarly capable computer for development, but need to run -+tests on the embedded system, or perhaps on a simulator. When -+configured for cross-compilation, the stock GNU C library simply -+disables running tests altogether: the command 'make tests' builds -+test programs, but does not run them. GLIBC, however, provides -+facilities for compiling tests and generating data files on the build -+system, but running the test programs themselves on a remote system or -+simulator. -+ -+ -+Test environment requirements -+ -+The test environment must meet certain conditions for GLIBC's -+cross-testing facilities to work: -+ -+- Shared filesystems. The 'build' system, on which you configure and -+ compile GLIBC, and the 'host' system, on which you intend to run -+ GLIBC, must share a filesystem containing the GLIBC build and -+ source trees. Files must appear at the same paths on both systems. -+ -+- Remote-shell like invocation. There must be a way to run a program -+ on the host system from the build system, passing it properly quoted -+ command-line arguments, setting environment variables, and -+ inheriting the caller's standard input and output. -+ -+ -+Usage -+ -+To use GLIBC's cross-testing support, provide values for the -+following Make variables when you invoke 'make': -+ -+- cross-test-wrapper -+ -+ This should be the name of the cross-testing wrapper command, along -+ with any arguments. -+ -+- cross-localedef -+ -+ This should be the name of a cross-capable localedef program, like -+ that included in the GLIBC 'localedef' module, along with any -+ arguments needed. -+ -+These are each explained in detail below. -+ -+ -+The Cross-Testing Wrapper -+ -+To run test programs reliably, the stock GNU C library takes care to -+ensure that test programs use the newly compiled dynamic linker and -+shared libraries, and never the host system's installed libraries. To -+accomplish this, it runs the tests by explicitly invoking the dynamic -+linker from the build tree, passing it a list of build tree -+directories to search for shared libraries, followed by the name of -+the executable to run and its arguments. -+ -+For example, where one might normally run a test program like this: -+ -+ $ ./tst-foo arg1 arg2 -+ -+the GNU C library might run that program like this: -+ -+ $ $objdir/elf/ld-linux.so.3 --library-path $objdir \ -+ ./tst-foo arg1 arg2 -+ -+(where $objdir is the path to the top of the build tree, and the -+trailing backslash indicates a continuation of the command). In other -+words, each test program invocation is 'wrapped up' inside an explicit -+invocation of the dynamic linker, which must itself execute the test -+program, having loaded shared libraries from the appropriate -+directories. -+ -+To support cross-testing, GLIBC allows the developer to optionally -+set the 'cross-test-wrapper' Make variable to another wrapper command, -+to which it passes the entire dynamic linker invocation shown above as -+arguments. For example, if the developer supplies a wrapper of -+'my-wrapper hostname', then GLIBC would run the test above as -+follows: -+ -+ $ my-wrapper hostname \ -+ $objdir/elf/ld-linux.so.3 --library-path $objdir \ -+ ./tst-foo arg1 arg2 -+ -+The 'my-wrapper' command is responsible for executing the command -+given on the host system. -+ -+Since tests are run in varying directories, the wrapper should either -+be in your command search path, or 'cross-test-wrapper' should give an -+absolute path for the wrapper. -+ -+The wrapper must meet several requirements: -+ -+- It must preserve the current directory. As explained above, the -+ build directory tree must be visible on both the build and host -+ systems, at the same path. The test wrapper must ensure that the -+ current directory it inherits is also inherited by the dynamic -+ linker (and thus the test program itself). -+ -+- It must preserve environment variables' values. Many GLIBC tests -+ set environment variables for test runs; in native testing, it -+ invokes programs like this: -+ -+ $ GCONV_PATH=$objdir/iconvdata \ -+ $objdir/elf/ld-linux.so.3 --library-path $objdir \ -+ ./tst-foo arg1 arg2 -+ -+ With the cross-testing wrapper, that invocation becomes: -+ -+ $ GCONV_PATH=$objdir/iconvdata \ -+ my-wrapper hostname \ -+ $objdir/elf/ld-linux.so.3 --library-path $objdir \ -+ ./tst-foo arg1 arg2 -+ -+ Here, 'my-wrapper' must ensure that the value it sees for -+ 'GCONV_PATH' will be seen by the dynamic linker, and thus 'tst-foo' -+ itself. (The wrapper supplied with GLIBC simply preserves the -+ values of *all* enviroment variables, with a fixed set of -+ exceptions.) -+ -+ If your wrapper is a shell script, take care to correctly propagate -+ environment variables whose values contain spaces and shell -+ metacharacters. -+ -+- It must pass the command's arguments, unmodified. The arguments -+ seen by the test program should be exactly those seen by the wrapper -+ (after whatever arguments are given to the wrapper itself). The -+ GLIBC test framework performs all needed shell word splitting and -+ expansion (wildcard expansion, parameter substitution, and so on) -+ before invoking the wrapper; further expansion may break the tests. -+ -+ -+The 'cross-test-ssh.sh' script -+ -+If you want to use 'ssh' (or something sufficiently similar) to run -+test programs on your host system, GLIBC includes a shell script, -+'scripts/cross-test-ssh.sh', which you can use as your wrapper -+command. This script takes care of setting the test command's current -+directory, propagating environment variable values, and carrying -+command-line arguments, all across an 'ssh' connection. You may even -+supply an alternative to 'ssh' on the command line, if needed. -+ -+For more details, pass 'cross-test-ssh.sh' the '--help' option. -+ -+ -+The Cross-Compiling Locale Definition Command -+ -+Some GLIBC tests rely on locales generated especially for the test -+process. In a native configuration, these tests simply run the -+'localedef' command built by the normal GLIBC build process, -+'locale/localedef', to process and install their locales. However, in -+a cross-compiling configuration, this 'localedef' is built for the -+host system, not the build system, and since it requires quite a bit -+of memory to run (we have seen it fail on systems with 64MiB of -+memory), it may not be practical to run it on the host system. -+ -+If set, GLIBC uses the 'cross-localedef' Make variable as the command -+to run on the build system to process and install locales. The -+localedef program built from the GLIBC 'localedef' module is -+suitable. -+ -+The value of 'cross-localedef' may also include command-line arguments -+to be passed to the program; if you are using GLIBC's 'localedef', -+you may include endianness and 'uint32_t' alignment arguments here. -+ -+ -+Example -+ -+In developing GLIBC's cross-testing facility, we invoked 'make' with -+the following script: -+ -+ #!/bin/sh -+ -+ srcdir=... -+ test_hostname=... -+ localedefdir=... -+ cross_gxx=...-g++ -+ -+ wrapper="$srcdir/scripts/cross-test-ssh.sh $test_hostname" -+ localedef="$localedefdir/localedef --little-endian --uint32-align=4" -+ -+ make cross-test-wrapper="$wrapper" \ -+ cross-localedef="$localedef" \ -+ CXX="$cross_gxx" \ -+ "$@" -+ -+ -+Other Cross-Testing Concerns -+ -+Here are notes on some other issues which you may encounter in running -+the GLIBC tests in a cross-compiling environment: -+ -+- Some tests require a C++ cross-compiler; you should set the 'CXX' -+ Make variable to the name of an appropriate cross-compiler. -+ -+- Some tests require access to libstdc++.so.6 and libgcc_s.so.1; we -+ simply place copies of these libraries in the top GLIBC build -+ directory. diff --git a/meta/recipes-core/glibc/glibc/0019-powerpc-Do-not-ask-compiler-for-finding-arch.patch b/meta/recipes-core/glibc/glibc/0019-powerpc-Do-not-ask-compiler-for-finding-arch.patch new file mode 100644 index 0000000000..4313c6860f --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0019-powerpc-Do-not-ask-compiler-for-finding-arch.patch @@ -0,0 +1,48 @@ +From eb44466ec976d800bb697b10775efa28f22ec216 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 7 Aug 2020 14:31:16 -0700 +Subject: [PATCH] powerpc: Do not ask compiler for finding arch + +This does not work well in cross compiling environments like OE +and moreover it uses its own -mcpu/-march options via cflags + +Upstream-Status: Inappropriate [ OE-Specific] + +Signed-off-by: Khem Raj +--- + sysdeps/powerpc/preconfigure | 5 +---- + sysdeps/powerpc/preconfigure.ac | 5 +---- + 2 files changed, 2 insertions(+), 8 deletions(-) + +diff --git a/sysdeps/powerpc/preconfigure b/sysdeps/powerpc/preconfigure +index dfe8e20399..bbff040f0f 100644 +--- a/sysdeps/powerpc/preconfigure ++++ b/sysdeps/powerpc/preconfigure +@@ -29,10 +29,7 @@ esac + # directive which shows up, and try using it. + case "${machine}:${submachine}" in + *powerpc*:) +- archcpu=`echo "int foo () { return 0; }" \ +- | $CC $CFLAGS $CPPFLAGS -S -frecord-gcc-switches -xc -o - - \ +- | grep -E "mcpu=|.machine" -m 1 \ +- | sed -e "s/.*machine //" -e "s/.*mcpu=\(.*\)\"/\1/"` ++ archcpu='' + # Note if you add patterns here you must ensure that an appropriate + # directory exists in sysdeps/powerpc. Likewise, if we find a + # cpu, don't let the generic configure append extra compiler options. +diff --git a/sysdeps/powerpc/preconfigure.ac b/sysdeps/powerpc/preconfigure.ac +index 6c63bd8257..3e925f1d48 100644 +--- a/sysdeps/powerpc/preconfigure.ac ++++ b/sysdeps/powerpc/preconfigure.ac +@@ -29,10 +29,7 @@ esac + # directive which shows up, and try using it. + case "${machine}:${submachine}" in + *powerpc*:) +- archcpu=`echo "int foo () { return 0; }" \ +- | $CC $CFLAGS $CPPFLAGS -S -frecord-gcc-switches -xc -o - - \ +- | grep -E "mcpu=|[.]machine" -m 1 \ +- | sed -e "s/.*machine //" -e "s/.*mcpu=\(.*\)\"/\1/"` ++ archcpu='' + # Note if you add patterns here you must ensure that an appropriate + # directory exists in sysdeps/powerpc. Likewise, if we find a + # cpu, don't let the generic configure append extra compiler options. diff --git a/meta/recipes-core/glibc/glibc/0020-eglibc-Help-bootstrap-cross-toolchain.patch b/meta/recipes-core/glibc/glibc/0020-eglibc-Help-bootstrap-cross-toolchain.patch deleted file mode 100644 index 9b76cfd3b8..0000000000 --- a/meta/recipes-core/glibc/glibc/0020-eglibc-Help-bootstrap-cross-toolchain.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 7856684f76c100155cad11b5b236fb31234b6e28 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 18 Mar 2015 00:49:28 +0000 -Subject: [PATCH] eglibc: Help bootstrap cross toolchain - -Taken from EGLIBC, r1484 + r1525 - - 2007-02-20 Jim Blandy - - * Makefile (install-headers): Preserve old behavior: depend on - $(inst_includedir)/gnu/stubs.h only if install-bootstrap-headers - is set; otherwise, place gnu/stubs.h on the 'install-others' list. - - 2007-02-16 Jim Blandy - - * Makefile: Amend make install-headers to install everything - necessary for building a cross-compiler. Install gnu/stubs.h as - part of 'install-headers', not 'install-others'. - If install-bootstrap-headers is 'yes', install a dummy copy of - gnu/stubs.h, instead of computing the real thing. - * include/stubs-bootstrap.h: New file. - -Upstream-Status: Pending -Signed-off-by: Khem Raj ---- - Makefile | 22 +++++++++++++++++++++- - include/stubs-bootstrap.h | 12 ++++++++++++ - 2 files changed, 33 insertions(+), 1 deletion(-) - create mode 100644 include/stubs-bootstrap.h - -diff --git a/Makefile b/Makefile -index f98d5a9e67..c36d04da0f 100644 ---- a/Makefile -+++ b/Makefile -@@ -79,9 +79,18 @@ subdir-dirs = include - vpath %.h $(subdir-dirs) - - # What to install. --install-others = $(inst_includedir)/gnu/stubs.h - install-bin-script = - -+# If we're bootstrapping, install a dummy gnu/stubs.h along with the -+# other headers, so 'make install-headers' produces a useable include -+# tree. Otherwise, install gnu/stubs.h later, after the rest of the -+# build is done. -+ifeq ($(install-bootstrap-headers),yes) -+install-headers: $(inst_includedir)/gnu/stubs.h -+else -+install-others = $(inst_includedir)/gnu/stubs.h -+endif -+ - ifeq (yes,$(build-shared)) - headers += gnu/lib-names.h - endif -@@ -415,6 +424,16 @@ others: $(common-objpfx)testrun.sh $(common-objpfx)debugglibc.sh - - subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs) - -+# gnu/stubs.h depends (via the subdir 'stubs' targets) on all the .o -+# files in EGLIBC. For bootstrapping a GCC/EGLIBC pair, an empty -+# gnu/stubs.h is good enough. -+ifeq ($(install-bootstrap-headers),yes) -+$(inst_includedir)/gnu/stubs.h: include/stubs-bootstrap.h $(+force) -+ $(make-target-directory) -+ $(INSTALL_DATA) $< $@ -+ -+installed-stubs = -+else - ifndef abi-variants - installed-stubs = $(inst_includedir)/gnu/stubs.h - else -@@ -441,6 +460,7 @@ $(inst_includedir)/gnu/stubs.h: $(+force) - - install-others-nosubdir: $(installed-stubs) - endif -+endif - - - # Since stubs.h is never needed when building the library, we simplify the -diff --git a/include/stubs-bootstrap.h b/include/stubs-bootstrap.h -new file mode 100644 -index 0000000000..1d2b669aff ---- /dev/null -+++ b/include/stubs-bootstrap.h -@@ -0,0 +1,12 @@ -+/* Placeholder stubs.h file for bootstrapping. -+ -+ When bootstrapping a GCC/EGLIBC pair, GCC requires that the EGLIBC -+ headers be installed, but we can't fully build EGLIBC without that -+ GCC. So we run the command: -+ -+ make install-headers install-bootstrap-headers=yes -+ -+ to install the headers GCC needs, but avoid building certain -+ difficult headers. The header depends, via the -+ EGLIBC subdir 'stubs' make targets, on every .o file in EGLIBC, but -+ an empty stubs.h like this will do fine for GCC. */ diff --git a/meta/recipes-core/glibc/glibc/0021-Replace-echo-with-printf-builtin-in-nscd-init-script.patch b/meta/recipes-core/glibc/glibc/0021-Replace-echo-with-printf-builtin-in-nscd-init-script.patch new file mode 100644 index 0000000000..42c498bbc8 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0021-Replace-echo-with-printf-builtin-in-nscd-init-script.patch @@ -0,0 +1,79 @@ +From 77fbd98f551d5b2cd338aa7f524e5ed980edb65e Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 31 Dec 2015 14:33:02 -0800 +Subject: [PATCH] Replace echo with printf builtin in nscd init script + +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: Submitted [https://patchwork.sourceware.org/project/glibc/patch/20211209203557.1318333-1-raj.khem@gmail.com/] +Signed-off-by: Ross Burton +Signed-off-by: Khem Raj +--- + nscd/nscd.init | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/nscd/nscd.init b/nscd/nscd.init +index a882da7d8b..857b541381 100644 +--- a/nscd/nscd.init ++++ b/nscd/nscd.init +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # nscd: Starts the Name Switch Cache Daemon + # +@@ -49,16 +49,16 @@ prog=nscd + start () { + [ -d /var/run/nscd ] || mkdir /var/run/nscd + [ -d /var/db/nscd ] || mkdir /var/db/nscd +- echo -n $"Starting $prog: " ++ printf "Starting $prog: " + daemon /usr/sbin/nscd + RETVAL=$? +- echo ++ printf "\n" + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd + return $RETVAL + } + + stop () { +- echo -n $"Stopping $prog: " ++ printf "Stopping $prog: " + /usr/sbin/nscd -K + RETVAL=$? + if [ $RETVAL -eq 0 ]; then +@@ -67,11 +67,11 @@ stop () { + # a non-privileged user + rm -f /var/run/nscd/nscd.pid + rm -f /var/run/nscd/socket +- success $"$prog shutdown" ++ success "$prog shutdown" + else +- failure $"$prog shutdown" ++ failure "$prog shutdown" + fi +- echo ++ printf "\n" + return $RETVAL + } + +@@ -103,13 +103,13 @@ case "$1" in + RETVAL=$? + ;; + force-reload | reload) +- echo -n $"Reloading $prog: " ++ printf "Reloading $prog: " + killproc /usr/sbin/nscd -HUP + RETVAL=$? +- echo ++ printf "\n" + ;; + *) +- echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}" ++ printf "Usage: $0 {start|stop|status|restart|reload|condrestart}\n" + RETVAL=1 + ;; + esac diff --git a/meta/recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch b/meta/recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch deleted file mode 100644 index 74c8c10661..0000000000 --- a/meta/recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 111ab95a85314d1e70fb159a14250354cc69d899 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 18 Mar 2015 00:55:53 +0000 -Subject: [PATCH] eglibc: Resolve __fpscr_values on SH4 - -2010-09-29 Nobuhiro Iwamatsu - Andrew Stubbs - - Resolve SH's __fpscr_values to symbol in libc.so. - - * sysdeps/sh/sh4/fpu/fpu_control.h: Add C++ __set_fpscr prototype. - * sysdeps/unix/sysv/linux/sh/Versions (GLIBC_2.2): Add __fpscr_values. - * sysdeps/unix/sysv/linux/sh/sysdep.S (___fpscr_values): New constant. - -Upstream-Status: Pending - -Signed-off-by: Khem Raj ---- - sysdeps/unix/sysv/linux/sh/Versions | 1 + - sysdeps/unix/sysv/linux/sh/sysdep.S | 11 +++++++++++ - 2 files changed, 12 insertions(+) - -diff --git a/sysdeps/unix/sysv/linux/sh/Versions b/sysdeps/unix/sysv/linux/sh/Versions -index 9c734ff755..974e33b4b1 100644 ---- a/sysdeps/unix/sysv/linux/sh/Versions -+++ b/sysdeps/unix/sysv/linux/sh/Versions -@@ -3,6 +3,7 @@ libc { - GLIBC_2.2 { - # functions used in other libraries - __xstat64; __fxstat64; __lxstat64; -+ __fpscr_values; - - # a* - alphasort64; -diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.S b/sysdeps/unix/sysv/linux/sh/sysdep.S -index a18fbb2e8b..59421bfbb0 100644 ---- a/sysdeps/unix/sysv/linux/sh/sysdep.S -+++ b/sysdeps/unix/sysv/linux/sh/sysdep.S -@@ -30,3 +30,14 @@ ENTRY (__syscall_error) - - #define __syscall_error __syscall_error_1 - #include -+ -+ .data -+ .align 3 -+ .globl ___fpscr_values -+ .type ___fpscr_values, @object -+ .size ___fpscr_values, 8 -+___fpscr_values: -+ .long 0 -+ .long 0x80000 -+weak_alias (___fpscr_values, __fpscr_values) -+ diff --git a/meta/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch b/meta/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch deleted file mode 100644 index a9ff8e92ea..0000000000 --- a/meta/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch +++ /dev/null @@ -1,560 +0,0 @@ -From 4e5de801a39d66b8bd93d09f5912dcbe5db4ef04 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 18 Mar 2015 01:33:49 +0000 -Subject: [PATCH] eglibc: Forward port cross locale generation support - -Upstream-Status: Pending - -Signed-off-by: Khem Raj ---- - locale/Makefile | 3 +- - locale/catnames.c | 46 +++++++++++++++++++++++++++ - locale/localeinfo.h | 2 +- - locale/programs/charmap-dir.c | 6 ++++ - locale/programs/ld-collate.c | 17 +++++----- - locale/programs/ld-ctype.c | 27 ++++++++-------- - locale/programs/ld-time.c | 31 ++++++++++++------ - locale/programs/linereader.c | 2 +- - locale/programs/localedef.c | 8 +++++ - locale/programs/locfile.c | 5 ++- - locale/programs/locfile.h | 59 +++++++++++++++++++++++++++++++++-- - locale/setlocale.c | 29 ----------------- - 12 files changed, 167 insertions(+), 68 deletions(-) - create mode 100644 locale/catnames.c - -diff --git a/locale/Makefile b/locale/Makefile -index b7c60681fa..07c606cde3 100644 ---- a/locale/Makefile -+++ b/locale/Makefile -@@ -26,7 +26,8 @@ headers = langinfo.h locale.h bits/locale.h \ - bits/types/locale_t.h bits/types/__locale_t.h - routines = setlocale findlocale loadlocale loadarchive \ - localeconv nl_langinfo nl_langinfo_l mb_cur_max \ -- newlocale duplocale freelocale uselocale -+ newlocale duplocale freelocale uselocale \ -+ catnames - tests = tst-C-locale tst-locname tst-duplocale - tests-container = tst-localedef-path-norm - categories = ctype messages monetary numeric time paper name \ -diff --git a/locale/catnames.c b/locale/catnames.c -new file mode 100644 -index 0000000000..538f3f5edb ---- /dev/null -+++ b/locale/catnames.c -@@ -0,0 +1,46 @@ -+/* Copyright (C) 2006 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 "localeinfo.h" -+ -+/* Define an array of category names (also the environment variable names). */ -+const struct catnamestr_t _nl_category_names attribute_hidden = -+ { -+#define DEFINE_CATEGORY(category, category_name, items, a) \ -+ category_name, -+#include "categories.def" -+#undef DEFINE_CATEGORY -+ }; -+ -+const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden = -+ { -+#define DEFINE_CATEGORY(category, category_name, items, a) \ -+ [category] = offsetof (struct catnamestr_t, CATNAMEMF (__LINE__)), -+#include "categories.def" -+#undef DEFINE_CATEGORY -+ }; -+ -+/* An array of their lengths, for convenience. */ -+const uint8_t _nl_category_name_sizes[] attribute_hidden = -+ { -+#define DEFINE_CATEGORY(category, category_name, items, a) \ -+ [category] = sizeof (category_name) - 1, -+#include "categories.def" -+#undef DEFINE_CATEGORY -+ [LC_ALL] = sizeof ("LC_ALL") - 1 -+ }; -diff --git a/locale/localeinfo.h b/locale/localeinfo.h -index 22f9dc1140..fa31b3c5ea 100644 ---- a/locale/localeinfo.h -+++ b/locale/localeinfo.h -@@ -230,7 +230,7 @@ __libc_tsd_define (extern, locale_t, LOCALE) - unused. We can manage this playing some tricks with weak references. - 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. */ --#ifndef SHARED -+#if !defined SHARED && !defined IN_GLIBC_LOCALEDEF - # include - # define NL_CURRENT_INDIRECT 1 - #endif -diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c -index 4841bfd05d..ffcba1fd79 100644 ---- a/locale/programs/charmap-dir.c -+++ b/locale/programs/charmap-dir.c -@@ -18,7 +18,9 @@ - #include - #include - #include -+#ifndef NO_UNCOMPRESS - #include -+#endif - #include - #include - #include -@@ -154,6 +156,7 @@ charmap_closedir (CHARMAP_DIR *cdir) - return closedir (dir); - } - -+#ifndef NO_UNCOMPRESS - /* Creates a subprocess decompressing the given pathname, and returns - a stream reading its output (the decompressed data). */ - static -@@ -202,6 +205,7 @@ fopen_uncompressed (const char *pathname, const char *compressor) - } - return NULL; - } -+#endif - - /* Opens a charmap for reading, given its name (not an alias name). */ - FILE * -@@ -224,6 +228,7 @@ charmap_open (const char *directory, const char *name) - if (stream != NULL) - return stream; - -+#ifndef NO_UNCOMPRESS - memcpy (p, ".gz", 4); - stream = fopen_uncompressed (pathname, "gzip"); - if (stream != NULL) -@@ -233,6 +238,7 @@ charmap_open (const char *directory, const char *name) - stream = fopen_uncompressed (pathname, "bzip2"); - if (stream != NULL) - return stream; -+#endif - - return NULL; - } -diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c -index b6406b775d..bfa4adba9c 100644 ---- a/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, - } - if (wcs != NULL) - { -- size_t nwcs = wcslen ((wchar_t *) wcs); -+ size_t nwcs = wcslen_uint32 (wcs); - uint32_t zero = 0; - /* Handle as a single character. */ - if (nwcs == 0) -@@ -1775,8 +1775,7 @@ symbol `%s' has the same encoding as"), (*eptr)->name); - - if ((*eptr)->nwcs == runp->nwcs) - { -- int c = wmemcmp ((wchar_t *) (*eptr)->wcs, -- (wchar_t *) runp->wcs, runp->nwcs); -+ int c = wmemcmp_uint32 ((*eptr)->wcs, runp->wcs, runp->nwcs); - - if (c == 0) - { -@@ -2003,9 +2002,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp) - one consecutive entry. */ - if (runp->wcnext != NULL - && runp->nwcs == runp->wcnext->nwcs -- && wmemcmp ((wchar_t *) runp->wcs, -- (wchar_t *)runp->wcnext->wcs, -- runp->nwcs - 1) == 0 -+ && wmemcmp_uint32 (runp->wcs, -+ runp->wcnext->wcs, -+ runp->nwcs - 1) == 0 - && (runp->wcs[runp->nwcs - 1] - == runp->wcnext->wcs[runp->nwcs - 1] + 1)) - { -@@ -2029,9 +2028,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp) - runp = runp->wcnext; - while (runp->wcnext != NULL - && runp->nwcs == runp->wcnext->nwcs -- && wmemcmp ((wchar_t *) runp->wcs, -- (wchar_t *)runp->wcnext->wcs, -- runp->nwcs - 1) == 0 -+ && wmemcmp_uint32 (runp->wcs, -+ runp->wcnext->wcs, -+ runp->nwcs - 1) == 0 - && (runp->wcs[runp->nwcs - 1] - == runp->wcnext->wcs[runp->nwcs - 1] + 1)); - -diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c -index 2fb579bbbf..d0be99581c 100644 ---- a/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, - allocate_arrays (ctype, charmap, ctype->repertoire); - - default_missing_len = (ctype->default_missing -- ? wcslen ((wchar_t *) ctype->default_missing) -+ ? wcslen_uint32 (ctype->default_missing) - : 0); - - init_locale_data (&file, nelems); -@@ -1927,7 +1927,7 @@ read_translit_entry (struct linereader *ldfile, struct locale_ctype_t *ctype, - ignore = 1; - else - /* This value is usable. */ -- obstack_grow (ob, to_wstr, wcslen ((wchar_t *) to_wstr) * 4); -+ obstack_grow (ob, to_wstr, wcslen_uint32 (to_wstr) * 4); - - first = 0; - } -@@ -2461,8 +2461,8 @@ with character code range values one must use the absolute ellipsis `...'")); - } - - handle_tok_digit: -- class_bit = _ISwdigit; -- class256_bit = _ISdigit; -+ class_bit = BITw (tok_digit); -+ class256_bit = BIT (tok_digit); - handle_digits = 1; - goto read_charclass; - -@@ -3904,8 +3904,7 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, - - while (idx < number) - { -- int res = wcscmp ((const wchar_t *) sorted[idx]->from, -- (const wchar_t *) runp->from); -+ int res = wcscmp_uint32 (sorted[idx]->from, runp->from); - if (res == 0) - { - replace = 1; -@@ -3942,11 +3941,11 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, - for (size_t cnt = 0; cnt < number; ++cnt) - { - struct translit_to_t *srunp; -- from_len += wcslen ((const wchar_t *) sorted[cnt]->from) + 1; -+ from_len += wcslen_uint32 (sorted[cnt]->from) + 1; - srunp = sorted[cnt]->to; - while (srunp != NULL) - { -- to_len += wcslen ((const wchar_t *) srunp->str) + 1; -+ to_len += wcslen_uint32 (srunp->str) + 1; - srunp = srunp->next; - } - /* 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, - ctype->translit_from_idx[cnt] = from_len; - ctype->translit_to_idx[cnt] = to_len; - -- len = wcslen ((const wchar_t *) sorted[cnt]->from) + 1; -- wmemcpy ((wchar_t *) &ctype->translit_from_tbl[from_len], -- (const wchar_t *) sorted[cnt]->from, len); -+ len = wcslen_uint32 (sorted[cnt]->from) + 1; -+ wmemcpy_uint32 (&ctype->translit_from_tbl[from_len], -+ sorted[cnt]->from, len); - from_len += len; - - ctype->translit_to_idx[cnt] = to_len; - srunp = sorted[cnt]->to; - while (srunp != NULL) - { -- len = wcslen ((const wchar_t *) srunp->str) + 1; -- wmemcpy ((wchar_t *) &ctype->translit_to_tbl[to_len], -- (const wchar_t *) srunp->str, len); -+ len = wcslen_uint32 (srunp->str) + 1; -+ wmemcpy_uint32 (&ctype->translit_to_tbl[to_len], -+ srunp->str, len); - to_len += len; - srunp = srunp->next; - } -diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c -index dcd2a2386d..6814740325 100644 ---- a/locale/programs/ld-time.c -+++ b/locale/programs/ld-time.c -@@ -220,8 +220,10 @@ No definition for %s category found"), "LC_TIME"); - } - else - { -+ static const uint32_t wt_fmt_ampm[] -+ = { '%','I',':','%','M',':','%','S',' ','%','p',0 }; - time->t_fmt_ampm = "%I:%M:%S %p"; -- time->wt_fmt_ampm = (const uint32_t *) L"%I:%M:%S %p"; -+ time->wt_fmt_ampm = wt_fmt_ampm; - } - } - -@@ -231,7 +233,7 @@ No definition for %s category found"), "LC_TIME"); - const int days_per_month[12] = { 31, 29, 31, 30, 31, 30, - 31, 31, 30, 31 ,30, 31 }; - size_t idx; -- wchar_t *wstr; -+ uint32_t *wstr; - - time->era_entries = - (struct era_data *) xmalloc (time->num_era -@@ -457,18 +459,18 @@ No definition for %s category found"), "LC_TIME"); - } - - /* Now generate the wide character name and format. */ -- wstr = wcschr ((wchar_t *) time->wera[idx], L':');/* end direction */ -- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end offset */ -- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end start */ -- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end end */ -+ wstr = wcschr_uint32 (time->wera[idx], L':'); /* end direction */ -+ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end offset */ -+ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end start */ -+ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end end */ - if (wstr != NULL) - { -- time->era_entries[idx].wname = (uint32_t *) wstr + 1; -- wstr = wcschr (wstr + 1, L':'); /* end name */ -+ time->era_entries[idx].wname = wstr + 1; -+ wstr = wcschr_uint32 (wstr + 1, L':'); /* end name */ - if (wstr != NULL) - { - *wstr = L'\0'; -- time->era_entries[idx].wformat = (uint32_t *) wstr + 1; -+ time->era_entries[idx].wformat = wstr + 1; - } - else - time->era_entries[idx].wname = -@@ -527,7 +529,16 @@ No definition for %s category found"), "LC_TIME"); - if (time->date_fmt == NULL) - time->date_fmt = "%a %b %e %H:%M:%S %Z %Y"; - if (time->wdate_fmt == NULL) -- time->wdate_fmt = (const uint32_t *) L"%a %b %e %H:%M:%S %Z %Y"; -+ { -+ static const uint32_t wdate_fmt[] = -+ { '%','a',' ', -+ '%','b',' ', -+ '%','e',' ', -+ '%','H',':','%','M',':','%','S',' ', -+ '%','Z',' ', -+ '%','Y',0 }; -+ time->wdate_fmt = wdate_fmt; -+ } - } - - -diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c -index 96d3ab66db..3af379d2c3 100644 ---- a/locale/programs/linereader.c -+++ b/locale/programs/linereader.c -@@ -595,7 +595,7 @@ get_string (struct linereader *lr, const struct charmap_t *charmap, - { - int return_widestr = lr->return_widestr; - char *buf; -- wchar_t *buf2 = NULL; -+ uint32_t *buf2 = NULL; - size_t bufact; - size_t bufmax = 56; - -diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c -index 832c8fd1fc..fe689b3ae1 100644 ---- a/locale/programs/localedef.c -+++ b/locale/programs/localedef.c -@@ -109,6 +109,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; - #define OPT_NO_WARN 402 - #define OPT_WARN 403 - #define OPT_NO_HARD_LINKS 404 -+#define OPT_UINT32_ALIGN 405 - - /* Definitions of arguments for argp functions. */ - static const struct argp_option options[] = -@@ -153,6 +154,8 @@ static const struct argp_option options[] = - N_("Generate little-endian output") }, - { "big-endian", OPT_BIG_ENDIAN, NULL, 0, - N_("Generate big-endian output") }, -+ { "uint32-align", OPT_UINT32_ALIGN, "ALIGNMENT", 0, -+ N_("Set the target's uint32_t alignment in bytes (default 4)") }, - { NULL, 0, NULL, 0, NULL } - }; - -@@ -243,12 +246,14 @@ main (int argc, char *argv[]) - ctype locale. (P1003.2 4.35.5.2) */ - setlocale (LC_CTYPE, "POSIX"); - -+#ifndef NO_SYSCONF - /* Look whether the system really allows locale definitions. POSIX - defines error code 3 for this situation so I think it must be - a fatal error (see P1003.2 4.35.8). */ - if (sysconf (_SC_2_LOCALEDEF) < 0) - record_error (3, 0, _("\ - FATAL: system does not define `_POSIX2_LOCALEDEF'")); -+#endif - - /* Process charmap file. */ - charmap = charmap_read (charmap_file, verbose, 1, be_quiet, 1); -@@ -400,6 +405,9 @@ parse_opt (int key, char *arg, struct argp_state *state) - /* Do not hard link to other locales. */ - hard_links = false; - break; -+ case OPT_UINT32_ALIGN: -+ uint32_align_mask = strtol (arg, NULL, 0) - 1; -+ break; - case 'c': - force_output = 1; - break; -diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c -index 0f1affa1d4..7d86fae801 100644 ---- a/locale/programs/locfile.c -+++ b/locale/programs/locfile.c -@@ -544,6 +544,9 @@ compare_files (const char *filename1, const char *filename2, size_t size, - machine running localedef. */ - bool swap_endianness_p; - -+/* The target's value of __align__(uint32_t) - 1. */ -+unsigned int uint32_align_mask = 3; -+ - /* When called outside a start_locale_structure/end_locale_structure - 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. -@@ -621,7 +624,7 @@ add_locale_string (struct locale_file *file, const char *string) - void - add_locale_wstring (struct locale_file *file, const uint32_t *string) - { -- add_locale_uint32_array (file, string, wcslen ((const wchar_t *) string) + 1); -+ add_locale_uint32_array (file, string, wcslen_uint32 (string) + 1); - } - - /* Record that FILE's next element is the 32-bit integer VALUE. */ -diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h -index c986d599ec..222a779176 100644 ---- a/locale/programs/locfile.h -+++ b/locale/programs/locfile.h -@@ -71,6 +71,8 @@ extern void write_all_categories (struct localedef_t *definitions, - - extern bool swap_endianness_p; - -+extern unsigned int uint32_align_mask; -+ - /* Change the output to be big-endian if BIG_ENDIAN is true and - little-endian otherwise. */ - static inline void -@@ -89,7 +91,8 @@ maybe_swap_uint32 (uint32_t value) - } - - /* Likewise, but munge an array of N uint32_ts starting at ARRAY. */ --static inline void -+static void -+__attribute__ ((unused)) - maybe_swap_uint32_array (uint32_t *array, size_t n) - { - if (swap_endianness_p) -@@ -99,7 +102,8 @@ maybe_swap_uint32_array (uint32_t *array, size_t n) - - /* Like maybe_swap_uint32_array, but the array of N elements is at - the end of OBSTACK's current object. */ --static inline void -+static void -+__attribute__ ((unused)) - maybe_swap_uint32_obstack (struct obstack *obstack, size_t 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, - const struct charmap_t *charmap, - const char *output_path); - -+static size_t wcslen_uint32 (const uint32_t *str) __attribute__ ((unused)); -+static uint32_t * wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n) __attribute__ ((unused)); -+static uint32_t * wcschr_uint32 (const uint32_t *s, uint32_t ch) __attribute__ ((unused)); -+static int wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2) __attribute__ ((unused)); -+static int wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n) __attribute__ ((unused)); -+ -+static size_t -+wcslen_uint32 (const uint32_t *str) -+{ -+ size_t len = 0; -+ while (str[len] != 0) -+ len++; -+ return len; -+} -+ -+static int -+wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n) -+{ -+ while (n-- != 0) -+ { -+ int diff = *s1++ - *s2++; -+ if (diff != 0) -+ return diff; -+ } -+ return 0; -+} -+ -+static int -+wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2) -+{ -+ while (*s1 != 0 && *s1 == *s2) -+ s1++, s2++; -+ return *s1 - *s2; -+} -+ -+static uint32_t * -+wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n) -+{ -+ return memcpy (s1, s2, n * sizeof (uint32_t)); -+} -+ -+static uint32_t * -+wcschr_uint32 (const uint32_t *s, uint32_t ch) -+{ -+ do -+ if (*s == ch) -+ return (uint32_t *) s; -+ while (*s++ != 0); -+ return 0; -+} -+ - #endif /* locfile.h */ -diff --git a/locale/setlocale.c b/locale/setlocale.c -index 19ed85ae8e..f28ca11446 100644 ---- a/locale/setlocale.c -+++ b/locale/setlocale.c -@@ -63,35 +63,6 @@ static char *const _nl_current_used[] = - - #endif - -- --/* Define an array of category names (also the environment variable names). */ --const struct catnamestr_t _nl_category_names attribute_hidden = -- { --#define DEFINE_CATEGORY(category, category_name, items, a) \ -- category_name, --#include "categories.def" --#undef DEFINE_CATEGORY -- }; -- --const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden = -- { --#define DEFINE_CATEGORY(category, category_name, items, a) \ -- [category] = offsetof (struct catnamestr_t, CATNAMEMF (__LINE__)), --#include "categories.def" --#undef DEFINE_CATEGORY -- }; -- --/* An array of their lengths, for convenience. */ --const uint8_t _nl_category_name_sizes[] attribute_hidden = -- { --#define DEFINE_CATEGORY(category, category_name, items, a) \ -- [category] = sizeof (category_name) - 1, --#include "categories.def" --#undef DEFINE_CATEGORY -- [LC_ALL] = sizeof ("LC_ALL") - 1 -- }; -- -- - #ifdef NL_CURRENT_INDIRECT - # define WEAK_POSTLOAD(postload) weak_extern (postload) - #else diff --git a/meta/recipes-core/glibc/glibc/0022-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch b/meta/recipes-core/glibc/glibc/0022-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch new file mode 100644 index 0000000000..5ac9d6d3a1 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0022-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch @@ -0,0 +1,39 @@ +From 5d1384d86fc44404ca32c6fda2d46ec357337c91 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:27:10 +0000 +Subject: [PATCH] sysdeps/gnu/configure.ac: Set libc_cv_rootsbindir only if its empty + +This ensures that it can be set in build environment + +Upstream-Status: Submitted [https://patchwork.sourceware.org/project/glibc/patch/20211209203557.1318333-2-raj.khem@gmail.com/] +Signed-off-by: Matthieu Crapet +Signed-off-by: Khem Raj +--- + sysdeps/gnu/configure | 2 +- + sysdeps/gnu/configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sysdeps/gnu/configure b/sysdeps/gnu/configure +index c15d1087e8..d30d6e37ae 100644 +--- a/sysdeps/gnu/configure ++++ b/sysdeps/gnu/configure +@@ -32,6 +32,6 @@ case "$prefix" in + else + libc_cv_localstatedir=$localstatedir + fi +- libc_cv_rootsbindir=/sbin ++ libc_cv_rootsbindir=${libc_cv_rootsbindir:=/sbin} + ;; + esac +diff --git a/sysdeps/gnu/configure.ac b/sysdeps/gnu/configure.ac +index 634fe4de2a..492112e0fd 100644 +--- a/sysdeps/gnu/configure.ac ++++ b/sysdeps/gnu/configure.ac +@@ -21,6 +21,6 @@ case "$prefix" in + else + libc_cv_localstatedir=$localstatedir + fi +- libc_cv_rootsbindir=/sbin ++ libc_cv_rootsbindir=${libc_cv_rootsbindir:=/sbin} + ;; + esac diff --git a/meta/recipes-core/glibc/glibc/0023-timezone-Make-shell-interpreter-overridable-in-tzsel.patch b/meta/recipes-core/glibc/glibc/0023-timezone-Make-shell-interpreter-overridable-in-tzsel.patch new file mode 100644 index 0000000000..e5e6ceba60 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0023-timezone-Make-shell-interpreter-overridable-in-tzsel.patch @@ -0,0 +1,47 @@ +From c0f251c58655e3377fe1c67a026c21ef68d2abcf Mon Sep 17 00:00:00 2001 +From: Khem Raj +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: Submitted [https://patchwork.sourceware.org/project/glibc/patch/20211209234015.1554552-1-raj.khem@gmail.com/] +Signed-off-by: Khem Raj +--- + Makeconfig | 9 +++++++++ + timezone/Makefile | 1 + + 2 files changed, 10 insertions(+) + +diff --git a/Makeconfig b/Makeconfig +index 775bf12b65..7b9a8f0a94 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 c624a189b3..dc8f5277de 100644 +--- a/timezone/Makefile ++++ b/timezone/Makefile +@@ -127,6 +127,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 $@ diff --git a/meta/recipes-core/glibc/glibc/0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch b/meta/recipes-core/glibc/glibc/0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch deleted file mode 100644 index 50c2e14735..0000000000 --- a/meta/recipes-core/glibc/glibc/0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 13bc0e53cc91e102472d532f28b3d44c30d291fc Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 3 Aug 2018 09:42:06 -0700 -Subject: [PATCH] localedef --add-to-archive uses a hard-coded locale path - -it doesn't exist in normal use, and there's no way to pass an -alternative filename. - -Add a fallback of $LOCALEARCHIVE from the environment, and allow -creation of new locale archives that are not the system archive. - -Upstream-Status: Inappropriate (OE-specific) - -Signed-off-by: Ross Burton -Signed-off-by: Khem Raj ---- - locale/programs/locarchive.c | 35 +++++++++++++++++++++++++---------- - 1 file changed, 25 insertions(+), 10 deletions(-) - -diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c -index f38e835c52..8d8f8699b2 100644 ---- a/locale/programs/locarchive.c -+++ b/locale/programs/locarchive.c -@@ -340,12 +340,24 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) - struct namehashent *oldnamehashtab; - struct locarhandle new_ah; - size_t prefix_len = output_prefix ? strlen (output_prefix) : 0; -- char archivefname[prefix_len + sizeof (ARCHIVE_NAME)]; -- char fname[prefix_len + sizeof (ARCHIVE_NAME) + sizeof (".XXXXXX") - 1]; -+ char *archivefname; -+ char *fname; -+ char *envarchive = getenv("LOCALEARCHIVE"); - -- if (output_prefix) -- memcpy (archivefname, output_prefix, prefix_len); -- strcpy (archivefname + prefix_len, ARCHIVE_NAME); -+ if (envarchive != NULL) -+ { -+ archivefname = xmalloc(strlen(envarchive) + 1); -+ fname = xmalloc(strlen(envarchive) + sizeof (".XXXXXX")); -+ strcpy (archivefname, envarchive); -+ } -+ else -+ { -+ archivefname = xmalloc(prefix_len + sizeof (ARCHIVE_NAME)); -+ fname = xmalloc(prefix_len + sizeof (ARCHIVE_NAME) + sizeof (".XXXXXX") - 1); -+ if (output_prefix) -+ memcpy (archivefname, output_prefix, prefix_len); -+ strcpy (archivefname + prefix_len, ARCHIVE_NAME); -+ } - strcpy (stpcpy (fname, archivefname), ".XXXXXX"); - - /* 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) - /* If ah has a non-NULL fname open that otherwise open the default. */ - if (archivefname == NULL) - { -- archivefname = default_fname; -- if (output_prefix) -- memcpy (default_fname, output_prefix, prefix_len); -- strcpy (default_fname + prefix_len, ARCHIVE_NAME); -+ archivefname = getenv("LOCALEARCHIVE"); -+ if (archivefname == NULL) { -+ archivefname = default_fname; -+ if (output_prefix) -+ memcpy (default_fname, output_prefix, prefix_len); -+ strcpy (default_fname + prefix_len, ARCHIVE_NAME); -+ } - } - - while (1) -@@ -585,7 +600,7 @@ open_archive (struct locarhandle *ah, bool readonly) - the default locale archive we ignore the failure and - list an empty archive, otherwise we print an error - and exit. */ -- if (errno == ENOENT && archivefname == default_fname) -+ if (errno == ENOENT) - { - if (readonly) - { diff --git a/meta/recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch b/meta/recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch deleted file mode 100644 index 998db39b47..0000000000 --- a/meta/recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 99ab34278a6ebec134267412b4f619f43e278dea Mon Sep 17 00:00:00 2001 -From: Khem Raj -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 -Signed-off-by: Khem Raj ---- - 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) diff --git a/meta/recipes-core/glibc/glibc/0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch b/meta/recipes-core/glibc/glibc/0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch deleted file mode 100644 index 2bfa2aaa06..0000000000 --- a/meta/recipes-core/glibc/glibc/0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 3190ada9ecaec915794886a608221655c120f90c Mon Sep 17 00:00:00 2001 -From: Martin Jansa -Date: Mon, 17 Dec 2018 21:36:18 +0000 -Subject: [PATCH] locale: prevent maybe-uninitialized errors with -Os [BZ - #19444] - -Fixes following error when building for aarch64 with -Os: -| In file included from strcoll_l.c:43: -| strcoll_l.c: In function '__strcoll_l': -| ../locale/weight.h:31:26: error: 'seq2.back_us' may be used uninitialized in this function [-Werror=maybe-uninitialized] -| int_fast32_t i = table[*(*cpp)++]; -| ^~~~~~~~~ -| strcoll_l.c:304:18: note: 'seq2.back_us' was declared here -| coll_seq seq1, seq2; -| ^~~~ -| In file included from strcoll_l.c:43: -| ../locale/weight.h:31:26: error: 'seq1.back_us' may be used uninitialized in this function [-Werror=maybe-uninitialized] -| int_fast32_t i = table[*(*cpp)++]; -| ^~~~~~~~~ -| strcoll_l.c:304:12: note: 'seq1.back_us' was declared here -| coll_seq seq1, seq2; -| ^~~~ - - Partial fix for [BZ #19444] - * locale/weight.h: Fix build with -Os. - -Upstream-Status: Submitted [https://patchwork.ozlabs.org/patch/1014766] - -Signed-off-by: Martin Jansa -Signed-off-by: Khem Raj ---- - locale/weight.h | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/locale/weight.h b/locale/weight.h -index 723e1fefda..f5798d379a 100644 ---- a/locale/weight.h -+++ b/locale/weight.h -@@ -28,7 +28,14 @@ findidx (const int32_t *table, - const unsigned char *extra, - const unsigned char **cpp, size_t len) - { -+ /* With GCC 8 when compiling with -Os the compiler warns that -+ seq1.back_us and seq2.back_us might be used uninitialized. -+ This uninitialized use is impossible for the same reason -+ as described in comments in locale/weightwc.h. */ -+ DIAG_PUSH_NEEDS_COMMENT; -+ DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); - int_fast32_t i = table[*(*cpp)++]; -+ DIAG_POP_NEEDS_COMMENT; - const unsigned char *cp; - const unsigned char *usrc; - diff --git a/meta/recipes-core/glibc/glibc/0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch b/meta/recipes-core/glibc/glibc/0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch deleted file mode 100644 index 8042caaeae..0000000000 --- a/meta/recipes-core/glibc/glibc/0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 5d201a75918a0e181ee6206f701901fdb91baf81 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 18 Mar 2015 00:11:22 +0000 -Subject: [PATCH] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known names - -This bolts in a hook for OE to pass its own version of interpreter -names into glibc especially for multilib case, where it differs from any -other distros - -Upstream-Status: Inappropriate [OE specific] - -Signed-off-by: Lianhao Lu -Signed-off-by: Khem Raj ---- - elf/readlib.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/elf/readlib.c b/elf/readlib.c -index 7383c23249..e97ea9449d 100644 ---- a/elf/readlib.c -+++ b/elf/readlib.c -@@ -51,6 +51,7 @@ static struct known_names interpreters[] = - #ifdef SYSDEP_KNOWN_INTERPRETER_NAMES - SYSDEP_KNOWN_INTERPRETER_NAMES - #endif -+ OECORE_KNOWN_INTERPRETER_NAMES - }; - - static struct known_names known_libs[] = diff --git a/meta/recipes-core/glibc/glibc/0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch b/meta/recipes-core/glibc/glibc/0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch deleted file mode 100644 index ece792509e..0000000000 --- a/meta/recipes-core/glibc/glibc/0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch +++ /dev/null @@ -1,67 +0,0 @@ -From baba3c6021340a9070b734f931a15cea4cfe6c31 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 15 May 2020 17:05:45 -0700 -Subject: [PATCH] wordsize.h: Unify the header between arm and aarch64 - -This helps OE multilibs to not sythesize this header which causes all -kind of recursions and other issues since wordsize is fundamental header -and ends up including itself in many case e.g. clang tidy, bpf etc. - -Upstream-Status: Inappropriate [ OE-Specific ] - -Signed-off-by: Khem Raj ---- - 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%) - -diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h -index 91da566b74..9a754514b3 100644 ---- a/sysdeps/aarch64/bits/wordsize.h -+++ b/sysdeps/aarch64/bits/wordsize.h -@@ -17,12 +17,16 @@ - License along with the GNU C Library; if not, see - . */ - --#ifdef __LP64__ -+#if defined (__aarch64__) && defined (__LP64__) - # define __WORDSIZE 64 --#else -+#elif defined (__aarch64__) - # define __WORDSIZE 32 - # define __WORDSIZE32_SIZE_ULONG 1 - # define __WORDSIZE32_PTRDIFF_LONG 1 -+#else -+# define __WORDSIZE 32 -+# define __WORDSIZE32_SIZE_ULONG 0 -+# define __WORDSIZE32_PTRDIFF_LONG 0 - #endif - - #define __WORDSIZE_TIME64_COMPAT32 0 -diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/arm/bits/wordsize.h -similarity index 80% -copy from sysdeps/aarch64/bits/wordsize.h -copy to sysdeps/arm/bits/wordsize.h -index 91da566b74..34fcdef1f1 100644 ---- a/sysdeps/aarch64/bits/wordsize.h -+++ b/sysdeps/arm/bits/wordsize.h -@@ -17,12 +17,16 @@ - License along with the GNU C Library; if not, see - . */ - --#ifdef __LP64__ -+#if defined (__aarch64__) && defined (__LP64__) - # define __WORDSIZE 64 --#else -+#elif defined (__aarch64__) - # define __WORDSIZE 32 - # define __WORDSIZE32_SIZE_ULONG 1 - # define __WORDSIZE32_PTRDIFF_LONG 1 -+#else -+# define __WORDSIZE 32 -+# define __WORDSIZE32_SIZE_ULONG 0 -+# define __WORDSIZE32_PTRDIFF_LONG 0 - #endif - - #define __WORDSIZE_TIME64_COMPAT32 0 diff --git a/meta/recipes-core/glibc/glibc/0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch b/meta/recipes-core/glibc/glibc/0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch deleted file mode 100644 index 22df820aed..0000000000 --- a/meta/recipes-core/glibc/glibc/0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 60aa53f547911163b42a1c436d695a15c87f34ee Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 7 Aug 2020 14:31:16 -0700 -Subject: [PATCH] powerpc: Do not ask compiler for finding arch - -This does not work well in cross compiling environments like OE -and moreover it uses its own -mcpu/-march options via cflags - -Upstream-Status: Inappropriate [ OE-Specific] - -Signed-off-by: Khem Raj ---- - sysdeps/powerpc/preconfigure | 5 +---- - sysdeps/powerpc/preconfigure.ac | 5 +---- - 2 files changed, 2 insertions(+), 8 deletions(-) - -diff --git a/sysdeps/powerpc/preconfigure b/sysdeps/powerpc/preconfigure -index dfe8e20399..bbff040f0f 100644 ---- a/sysdeps/powerpc/preconfigure -+++ b/sysdeps/powerpc/preconfigure -@@ -29,10 +29,7 @@ esac - # directive which shows up, and try using it. - case "${machine}:${submachine}" in - *powerpc*:) -- archcpu=`echo "int foo () { return 0; }" \ -- | $CC $CFLAGS $CPPFLAGS -S -frecord-gcc-switches -xc -o - - \ -- | grep -E "mcpu=|.machine" -m 1 \ -- | sed -e "s/.*machine //" -e "s/.*mcpu=\(.*\)\"/\1/"` -+ archcpu='' - # Note if you add patterns here you must ensure that an appropriate - # directory exists in sysdeps/powerpc. Likewise, if we find a - # cpu, don't let the generic configure append extra compiler options. -diff --git a/sysdeps/powerpc/preconfigure.ac b/sysdeps/powerpc/preconfigure.ac -index 6c63bd8257..3e925f1d48 100644 ---- a/sysdeps/powerpc/preconfigure.ac -+++ b/sysdeps/powerpc/preconfigure.ac -@@ -29,10 +29,7 @@ esac - # directive which shows up, and try using it. - case "${machine}:${submachine}" in - *powerpc*:) -- archcpu=`echo "int foo () { return 0; }" \ -- | $CC $CFLAGS $CPPFLAGS -S -frecord-gcc-switches -xc -o - - \ -- | grep -E "mcpu=|[.]machine" -m 1 \ -- | sed -e "s/.*machine //" -e "s/.*mcpu=\(.*\)\"/\1/"` -+ archcpu='' - # Note if you add patterns here you must ensure that an appropriate - # directory exists in sysdeps/powerpc. Likewise, if we find a - # cpu, don't let the generic configure append extra compiler options. diff --git a/meta/recipes-core/glibc/glibc/CVE-2021-43396.patch b/meta/recipes-core/glibc/glibc/CVE-2021-43396.patch deleted file mode 100644 index ebea5efd34..0000000000 --- a/meta/recipes-core/glibc/glibc/CVE-2021-43396.patch +++ /dev/null @@ -1,184 +0,0 @@ -From ff012870b2c02a62598c04daa1e54632e020fd7d Mon Sep 17 00:00:00 2001 -From: Nikita Popov -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 - -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 -+ . */ -+ -+#include -+#include -+#include -+ -+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 -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 , 1998, - and Bruno Haible , 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 \ - { \ diff --git a/meta/recipes-core/glibc/glibc_2.34.bb b/meta/recipes-core/glibc/glibc_2.34.bb deleted file mode 100644 index 67464d6ce0..0000000000 --- a/meta/recipes-core/glibc/glibc_2.34.bb +++ /dev/null @@ -1,135 +0,0 @@ -require glibc.inc -require glibc-version.inc - -CVE_CHECK_WHITELIST += "CVE-2020-10029 CVE-2021-27645" - -# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010022 -# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010023 -# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010024 -# Upstream glibc maintainers dispute there is any issue and have no plans to address it further. -# "this is being treated as a non-security bug and no real threat." -CVE_CHECK_WHITELIST += "CVE-2019-1010022 CVE-2019-1010023 CVE-2019-1010024" - -# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010025 -# Allows for ASLR bypass so can bypass some hardening, not an exploit in itself, may allow -# easier access for another. "ASLR bypass itself is not a vulnerability." -# Potential patch at https://sourceware.org/bugzilla/show_bug.cgi?id=22853 -CVE_CHECK_WHITELIST += "CVE-2019-1010025" - -DEPENDS += "gperf-native bison-native make-native" - -NATIVESDKFIXES ?= "" -NATIVESDKFIXES:class-nativesdk = "\ - file://0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch \ - file://0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch \ - file://0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch \ - file://0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch \ - file://0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch \ - file://0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch \ -" - -SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ - file://etc/ld.so.conf \ - file://generate-supported.mk \ - file://makedbs.sh \ - \ - ${NATIVESDKFIXES} \ - file://0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch \ - file://0016-yes-within-the-path-sets-wrong-config-variables.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://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-CVE-2021-38604.patch \ - file://0002-CVE-2021-38604.patch \ - file://0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \ - file://CVE-2021-43396.patch \ - file://0001-Make-shell-interpreter-overridable-in-tzselect.ksh.patch \ - file://0001-CVE-2022-23218.patch \ - file://0002-CVE-2022-23218.patch \ - file://0001-CVE-2022-23219.patch \ - file://0002-CVE-2022-23219.patch \ - file://0001-CVE-2021-3998.patch \ - file://0002-CVE-2021-3998.patch \ - file://0001-CVE-2021-3999.patch \ - file://0002-CVE-2021-3999.patch \ - " -S = "${WORKDIR}/git" -B = "${WORKDIR}/build-${TARGET_SYS}" - -PACKAGES_DYNAMIC = "" - -# the -isystem in bitbake.conf screws up glibc do_stage -BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}" -TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}" - -GLIBC_BROKEN_LOCALES = "" - -GLIBCPIE ??= "" - -EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \ - --disable-profile \ - --disable-debug --without-gd \ - --enable-clocale=gnu \ - --with-headers=${STAGING_INCDIR} \ - --without-selinux \ - --enable-tunables \ - --enable-bind-now \ - --enable-stack-protector=strong \ - --disable-crypt \ - --with-default-link \ - ${@bb.utils.contains_any('SELECTED_OPTIMIZATION', '-O0 -Og', '--disable-werror', '', d)} \ - ${GLIBCPIE} \ - ${GLIBC_EXTRA_OECONF}" - -EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}" - -EXTRA_OECONF:append:x86 = " ${@bb.utils.contains_any('TUNE_FEATURES', 'i586 c3', '--disable-cet', '--enable-cet', d)}" -EXTRA_OECONF:append:x86-64 = " --enable-cet" - -PACKAGECONFIG ??= "nscd memory-tagging" -PACKAGECONFIG[nscd] = "--enable-nscd,--disable-nscd" -PACKAGECONFIG[memory-tagging] = "--enable-memory-tagging,--disable-memory-tagging" - -do_patch:append() { - bb.build.exec_func('do_fix_readlib_c', d) -} - -do_fix_readlib_c () { - sed -i -e 's#OECORE_KNOWN_INTERPRETER_NAMES#${EGLIBC_KNOWN_INTERPRETER_NAMES}#' ${S}/elf/readlib.c -} - -do_configure () { -# override this function to avoid the autoconf/automake/aclocal/autoheader -# calls for now -# don't pass CPPFLAGS into configure, since it upsets the kernel-headers -# version check and doesn't really help with anything - (cd ${S} && gnu-configize) || die "failure in running gnu-configize" - find ${S} -name "configure" | xargs touch - CPPFLAGS="" oe_runconf -} - -LDFLAGS += "-fuse-ld=bfd" -do_compile () { - base_do_compile - echo "Adjust ldd script" - if [ -n "${RTLDLIST}" ] - then - prevrtld=`cat ${B}/elf/ldd | grep "^RTLDLIST=" | sed 's#^RTLDLIST="\?\([^"]*\)"\?$#\1#'` - # remove duplicate entries - newrtld=`echo $(printf '%s\n' ${prevrtld} ${RTLDLIST} | LC_ALL=C sort -u)` - echo "ldd \"${prevrtld} ${RTLDLIST}\" -> \"${newrtld}\"" - sed -i ${B}/elf/ldd -e "s#^RTLDLIST=.*\$#RTLDLIST=\"${newrtld}\"#" - fi -} - -require glibc-package.inc - -BBCLASSEXTEND = "nativesdk" diff --git a/meta/recipes-core/glibc/glibc_2.35.bb b/meta/recipes-core/glibc/glibc_2.35.bb new file mode 100644 index 0000000000..2903a4001f --- /dev/null +++ b/meta/recipes-core/glibc/glibc_2.35.bb @@ -0,0 +1,122 @@ +require glibc.inc +require glibc-version.inc + +CVE_CHECK_WHITELIST += "CVE-2020-10029 CVE-2021-27645" + +# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010022 +# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010023 +# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010024 +# Upstream glibc maintainers dispute there is any issue and have no plans to address it further. +# "this is being treated as a non-security bug and no real threat." +CVE_CHECK_WHITELIST += "CVE-2019-1010022 CVE-2019-1010023 CVE-2019-1010024" + +# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010025 +# Allows for ASLR bypass so can bypass some hardening, not an exploit in itself, may allow +# easier access for another. "ASLR bypass itself is not a vulnerability." +# Potential patch at https://sourceware.org/bugzilla/show_bug.cgi?id=22853 +CVE_CHECK_WHITELIST += "CVE-2019-1010025" + +DEPENDS += "gperf-native bison-native make-native" + +NATIVESDKFIXES ?= "" +NATIVESDKFIXES:class-nativesdk = "\ + file://0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch \ + file://0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch \ + file://0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch \ + file://0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch \ + file://0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch \ + file://0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch \ +" + +SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ + file://etc/ld.so.conf \ + file://generate-supported.mk \ + file://makedbs.sh \ + \ + ${NATIVESDKFIXES} \ + file://0009-yes-within-the-path-sets-wrong-config-variables.patch \ + file://0010-eglibc-Cross-building-and-testing-instructions.patch \ + 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://0016-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch \ + file://0017-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \ + file://0018-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch \ + file://0019-powerpc-Do-not-ask-compiler-for-finding-arch.patch \ + file://0021-Replace-echo-with-printf-builtin-in-nscd-init-script.patch \ + file://0022-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch \ + file://0023-timezone-Make-shell-interpreter-overridable-in-tzsel.patch \ + " +S = "${WORKDIR}/git" +B = "${WORKDIR}/build-${TARGET_SYS}" + +PACKAGES_DYNAMIC = "" + +# the -isystem in bitbake.conf screws up glibc do_stage +BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}" +TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}" + +GLIBC_BROKEN_LOCALES = "" + +GLIBCPIE ??= "" + +EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \ + --disable-profile \ + --disable-debug --without-gd \ + --enable-clocale=gnu \ + --with-headers=${STAGING_INCDIR} \ + --without-selinux \ + --enable-tunables \ + --enable-bind-now \ + --enable-stack-protector=strong \ + --disable-crypt \ + --with-default-link \ + ${@bb.utils.contains_any('SELECTED_OPTIMIZATION', '-O0 -Og', '--disable-werror', '', d)} \ + ${GLIBCPIE} \ + ${GLIBC_EXTRA_OECONF}" + +EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}" + +EXTRA_OECONF:append:x86 = " ${@bb.utils.contains_any('TUNE_FEATURES', 'i586 c3', '--disable-cet', '--enable-cet', d)}" +EXTRA_OECONF:append:x86-64 = " --enable-cet" + +PACKAGECONFIG ??= "nscd memory-tagging" +PACKAGECONFIG[nscd] = "--enable-nscd,--disable-nscd" +PACKAGECONFIG[memory-tagging] = "--enable-memory-tagging,--disable-memory-tagging" + +do_patch:append() { + bb.build.exec_func('do_fix_readlib_c', d) +} + +do_fix_readlib_c () { + sed -i -e 's#OECORE_KNOWN_INTERPRETER_NAMES#${EGLIBC_KNOWN_INTERPRETER_NAMES}#' ${S}/elf/readlib.c +} + +do_configure () { +# override this function to avoid the autoconf/automake/aclocal/autoheader +# calls for now +# don't pass CPPFLAGS into configure, since it upsets the kernel-headers +# version check and doesn't really help with anything + (cd ${S} && gnu-configize) || die "failure in running gnu-configize" + find ${S} -name "configure" | xargs touch + CPPFLAGS="" oe_runconf +} + +LDFLAGS += "-fuse-ld=bfd" +do_compile () { + base_do_compile + echo "Adjust ldd script" + if [ -n "${RTLDLIST}" ] + then + prevrtld=`cat ${B}/elf/ldd | grep "^RTLDLIST=" | sed 's#^RTLDLIST="\?\([^"]*\)"\?$#\1#'` + # remove duplicate entries + newrtld=`echo $(printf '%s\n' ${prevrtld} ${RTLDLIST} | LC_ALL=C sort -u)` + echo "ldd \"${prevrtld} ${RTLDLIST}\" -> \"${newrtld}\"" + sed -i ${B}/elf/ldd -e "s#^RTLDLIST=.*\$#RTLDLIST=\"${newrtld}\"#" + fi +} + +require glibc-package.inc + +BBCLASSEXTEND = "nativesdk" -- cgit v1.2.3-54-g00ecf