diff options
author | takeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp> | 2020-11-02 11:07:33 +0900 |
---|---|---|
committer | takeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp> | 2020-11-02 11:07:33 +0900 |
commit | 1c7d6584a7811b7785ae5c1e378f14b5ba0971cf (patch) | |
tree | cd70a267a5ef105ba32f200aa088e281fbd85747 /external/poky/meta/recipes-core/glibc | |
parent | 4204309872da5cb401cbb2729d9e2d4869a87f42 (diff) |
basesystem-jjsandbox/ToshikazuOhiwa/master-jj
recipes
Diffstat (limited to 'external/poky/meta/recipes-core/glibc')
62 files changed, 2167 insertions, 3666 deletions
diff --git a/external/poky/meta/recipes-core/glibc/cross-localedef-native_2.28.bb b/external/poky/meta/recipes-core/glibc/cross-localedef-native_2.31.bb index a05b94e3..24de55d9 100644 --- a/external/poky/meta/recipes-core/glibc/cross-localedef-native_2.28.bb +++ b/external/poky/meta/recipes-core/glibc/cross-localedef-native_2.31.bb @@ -3,11 +3,13 @@ HOMEPAGE = "http://www.gnu.org/software/libc/libc.html" SECTION = "libs" LICENSE = "LGPL-2.1" -LIC_FILES_CHKSUM = "file://LICENSES;md5=cfc0ed77a9f62fa62eded042ebe31d72 \ +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" @@ -17,24 +19,22 @@ inherit autotools FILESEXTRAPATHS =. "${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/glibc:" -SRCBRANCH ?= "release/${PV}/master" -GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git" -UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+\.\d+(\.(?!90)\d+)*)" - -SRCREV_glibc ?= "3c03baca37fdcb52c3881e653ca392bba7a99c2b" -SRCREV_localedef ?= "c328777219ccc480be3112cf807217ca6b570b64" - SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ git://github.com/kraj/localedef;branch=master;name=localedef;destsuffix=git/localedef \ - file://0016-timezone-re-written-tzselect-as-posix-sh.patch \ - file://0017-Remove-bash-dependency-for-nscd-init-script.patch \ - file://0018-eglibc-Cross-building-and-testing-instructions.patch \ - file://0019-eglibc-Help-bootstrap-cross-toolchain.patch \ - file://0020-eglibc-Clear-cache-lines-on-ppc8xx.patch \ - file://0021-eglibc-Resolve-__fpscr_values-on-SH4.patch \ - file://0022-eglibc-Forward-port-cross-locale-generation-support.patch \ - file://0023-Define-DUMMY_LOCALE_T-if-not-defined.patch \ - file://0029-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ + \ + file://0001-localedef-Add-hardlink-resolver-to-build.patch;patchdir=localedef \ + \ + file://0001-localedef-Add-hardlink-resolver-from-util-linux.patch \ + file://0002-localedef-fix-ups-hardlink-to-make-it-compile.patch \ + \ + file://0018-timezone-re-written-tzselect-as-posix-sh.patch \ + file://0019-Remove-bash-dependency-for-nscd-init-script.patch \ + file://0020-eglibc-Cross-building-and-testing-instructions.patch \ + file://0021-eglibc-Help-bootstrap-cross-toolchain.patch \ + file://0022-eglibc-Resolve-__fpscr_values-on-SH4.patch \ + file://0023-eglibc-Forward-port-cross-locale-generation-support.patch \ + file://0024-Define-DUMMY_LOCALE_T-if-not-defined.patch \ + file://0025-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ " # Makes for a rather long rev (22 characters), but... # @@ -48,4 +48,5 @@ 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/external/poky/meta/recipes-core/glibc/glibc-collateral.inc b/external/poky/meta/recipes-core/glibc/glibc-collateral.inc index 536edfb0..52880791 100644 --- a/external/poky/meta/recipes-core/glibc/glibc-collateral.inc +++ b/external/poky/meta/recipes-core/glibc/glibc-collateral.inc @@ -1,15 +1,7 @@ -INHIBIT_DEFAULT_DEPS = "1" -LICENSE = "GPLv2 & LGPLv2.1" -LIC_FILES_CHKSUM ?= "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6 \ - file://${COMMON_LICENSE_DIR}/LGPL-2.1;md5=1a6d268fd218675ffea8be556788b780" -HOMEPAGE = "http://www.gnu.org/software/libc/index.html" +require glibc-common.inc -# This needs to match with glibc.inc, otherwise glibc-scripts and glibc-locale -# will fail to find main glibc, for details see -# http://lists.openembedded.org/pipermail/openembedded-core/2015-January/100679.html -ARM_INSTRUCTION_SET_armv4 = "arm" -ARM_INSTRUCTION_SET_armv5 = "arm" -ARM_INSTRUCTION_SET_armv6 = "arm" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6 \ + file://${COMMON_LICENSE_DIR}/LGPL-2.1;md5=1a6d268fd218675ffea8be556788b780" deltask do_fetch deltask do_unpack @@ -18,6 +10,3 @@ do_configure[noexec] = "1" do_compile[noexec] = "1" do_install[depends] += "virtual/${MLPREFIX}libc:do_stash_locale" - -COMPATIBLE_HOST_libc-musl_class-target = "null" - diff --git a/external/poky/meta/recipes-core/glibc/glibc-common.inc b/external/poky/meta/recipes-core/glibc/glibc-common.inc index b05e162f..8d412cc8 100644 --- a/external/poky/meta/recipes-core/glibc/glibc-common.inc +++ b/external/poky/meta/recipes-core/glibc/glibc-common.inc @@ -3,8 +3,23 @@ DESCRIPTION = "The GNU C Library is used as the system C library in most systems HOMEPAGE = "http://www.gnu.org/software/libc/libc.html" SECTION = "libs" LICENSE = "GPLv2 & LGPLv2.1" -LIC_FILES_CHKSUM ?= "file://LICENSES;md5=07a394b26e0902b9ffdec03765209770 \ - file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \ + +LIC_FILES_CHKSUM ?= "file://LICENSES;md5=1541fd8f5e8f1579512bf05f533371ba \ + file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \ - file://COPYING.LIB;md5=bbb461211a33b134d42ed5ee802b37ff " + file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c" + CVE_PRODUCT = "glibc" + +INHIBIT_DEFAULT_DEPS = "1" + +ARM_INSTRUCTION_SET_armv4 = "arm" +ARM_INSTRUCTION_SET_armv5 = "arm" +ARM_INSTRUCTION_SET_armv6 = "arm" +# +# We will skip parsing glibc when target system C library selection is not glibc +# this helps in easing out parsing for non-glibc system libraries +# +COMPATIBLE_HOST_libc-musl_class-target = "null" + +PV = "2.31" diff --git a/external/poky/meta/recipes-core/glibc/glibc-initial.inc b/external/poky/meta/recipes-core/glibc/glibc-initial.inc deleted file mode 100644 index acd0d6b1..00000000 --- a/external/poky/meta/recipes-core/glibc/glibc-initial.inc +++ /dev/null @@ -1,57 +0,0 @@ -DEPENDS = "linux-libc-headers virtual/${TARGET_PREFIX}gcc-initial libgcc-initial make-native bison-native" -PROVIDES = "virtual/${TARGET_PREFIX}libc-initial" - -PACKAGES = "" -PACKAGES_DYNAMIC = "" - -STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}" -STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}" - -do_configure () { - (cd ${S} && gnu-configize) || die "failure in running gnu-configize" - find ${S} -name "configure" | xargs touch - cfgscript=`python3 -c "import os; print(os.path.relpath('${S}', '.'))"`/configure - $cfgscript --host=${TARGET_SYS} --build=${BUILD_SYS} \ - --prefix=/usr \ - --disable-sanity-checks \ - --with-headers=${STAGING_DIR_TARGET}${includedir} \ - --enable-hacker-mode -} - -do_compile () { - : -} - -do_install () { - oe_runmake cross-compiling=yes install_root=${D} \ - includedir='${includedir}' prefix='${prefix}' \ - install-bootstrap-headers=yes install-headers - - oe_runmake csu/subdir_lib - mkdir -p ${D}${libdir}/ - install -m 644 csu/crt[1in].o ${D}${libdir} - - # Two headers -- stubs.h and features.h -- aren't installed by install-headers, - # so do them by hand. We can tolerate an empty stubs.h for the moment. - # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html - mkdir -p ${D}${includedir}/gnu/ - touch ${D}${includedir}/gnu/stubs.h - cp ${S}/include/features.h ${D}${includedir}/features.h - - if [ -e ${B}/bits/stdio_lim.h ]; then - cp ${B}/bits/stdio_lim.h ${D}${includedir}/bits/ - fi -} - -do_stash_locale() { - : -} - -do_siteconfig () { - : -} - -inherit nopackages - -# We really only want this built by things that need it, not any recrdeptask -deltask do_build diff --git a/external/poky/meta/recipes-core/glibc/glibc-initial_2.28.bb b/external/poky/meta/recipes-core/glibc/glibc-initial_2.28.bb deleted file mode 100644 index e86770e1..00000000 --- a/external/poky/meta/recipes-core/glibc/glibc-initial_2.28.bb +++ /dev/null @@ -1,9 +0,0 @@ -require glibc_${PV}.bb -require glibc-initial.inc - -# main glibc recipes muck with TARGET_CPPFLAGS to point into -# final target sysroot but we -# are not there when building glibc-initial -# so reset it here - -TARGET_CPPFLAGS = "" diff --git a/external/poky/meta/recipes-core/glibc/glibc-ld.inc b/external/poky/meta/recipes-core/glibc/glibc-ld.inc index bb167b32..041ffbb9 100644 --- a/external/poky/meta/recipes-core/glibc/glibc-ld.inc +++ b/external/poky/meta/recipes-core/glibc/glibc-ld.inc @@ -10,8 +10,8 @@ def glibc_dl_info(d): infos['ldconfig'].add('{"' + loader + '",' + "FLAG_ELF_LIBC6" + ' }') infos['lddrewrite'].add(loader) - infos['ldconfig'] = ','.join(infos['ldconfig']) - infos['lddrewrite'] = ' '.join(infos['lddrewrite']) + infos['ldconfig'] = ','.join(sorted(infos['ldconfig'])) + infos['lddrewrite'] = ' '.join(sorted(infos['lddrewrite'])) return infos EGLIBC_KNOWN_INTERPRETER_NAMES = "${@glibc_dl_info(d)['ldconfig']}" diff --git a/external/poky/meta/recipes-core/glibc/glibc-locale.inc b/external/poky/meta/recipes-core/glibc/glibc-locale.inc index 97d83cb8..ef06389f 100644 --- a/external/poky/meta/recipes-core/glibc/glibc-locale.inc +++ b/external/poky/meta/recipes-core/glibc/glibc-locale.inc @@ -12,9 +12,7 @@ BINUTILSDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}binutils:do_populate_sysroot" BINUTILSDEP_class-nativesdk = "virtual/${TARGET_PREFIX}binutils-crosssdk:do_populate_sysroot" do_package[depends] += "${BINUTILSDEP}" -# localedef links with libc.so and glibc-collateral.inc inhibits all default deps -# cannot add virtual/libc to DEPENDS, because it would conflict with libc-initial in RSS -RDEPENDS_localedef += "glibc" +DEPENDS += "virtual/libc" # Binary locales are generated at build time if ENABLE_BINARY_LOCALE_GENERATION # is set. The idea is to avoid running localedef on the target (at first boot) @@ -27,7 +25,7 @@ ENABLE_BINARY_LOCALE_GENERATION_pn-nativesdk-glibc-locale = "1" #enable locale generation on these arches # BINARY_LOCALE_ARCHES is a space separated list of regular expressions -BINARY_LOCALE_ARCHES ?= "arm.* aarch64 i[3-6]86 x86_64 powerpc mips mips64 riscv32 riscv64" +BINARY_LOCALE_ARCHES ?= "arc arm.* aarch64 i[3-6]86 x86_64 powerpc mips mips64 riscv32 riscv64" # set "1" to use cross-localedef for locale generation # set "0" for qemu emulation of native localedef for locale generation @@ -71,25 +69,30 @@ FILES_localedef = "${bindir}/localedef" LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale" -do_install () { - mkdir -p ${D}${bindir} ${D}${datadir} ${D}${libdir} - if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then - cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${bindir}/* ${D}${bindir} - fi - if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then - mkdir -p ${D}${localedir} - cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${localedir}/* ${D}${localedir} - fi - if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then - cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir} - fi - if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then - cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir} - fi - if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then - cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/locale ${D}${datadir} +copy_locale_files() { + local dir=$1 mode=$2 + + [ -e "${LOCALETREESRC}$dir" ] || return 0 + + for d in . $(find "${LOCALETREESRC}$dir" -type d -printf '%P '); do + install -d ${D}$dir/$d + find "${LOCALETREESRC}$dir/$d" -maxdepth 1 -type f \ + -exec install -m $mode -t "${D}$dir/$d" {} \; + done +} + +do_install() { + copy_locale_files ${bindir} 0755 + copy_locale_files ${localedir} 0644 + if [ ${PACKAGE_NO_GCONV} -eq 0 ]; then + copy_locale_files ${libdir}/gconv 0755 + copy_locale_files ${datadir}/i18n 0644 + else + # Remove the libdir if it is empty when gconv is not copied + find ${D}${libdir} -type d -empty -delete fi - cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/SUPPORTED ${WORKDIR} + copy_locale_files ${datadir}/locale 0644 + install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED } inherit libc-package diff --git a/external/poky/meta/recipes-core/glibc/glibc-locale_2.28.bb b/external/poky/meta/recipes-core/glibc/glibc-locale_2.31.bb index f7702e03..f7702e03 100644 --- a/external/poky/meta/recipes-core/glibc/glibc-locale_2.28.bb +++ b/external/poky/meta/recipes-core/glibc/glibc-locale_2.31.bb diff --git a/external/poky/meta/recipes-core/glibc/glibc-mtrace_2.28.bb b/external/poky/meta/recipes-core/glibc/glibc-mtrace_2.31.bb index 0b69bad4..0b69bad4 100644 --- a/external/poky/meta/recipes-core/glibc/glibc-mtrace_2.28.bb +++ b/external/poky/meta/recipes-core/glibc/glibc-mtrace_2.31.bb diff --git a/external/poky/meta/recipes-core/glibc/glibc-package.inc b/external/poky/meta/recipes-core/glibc/glibc-package.inc index a98ae1a2..285a9aa2 100644 --- a/external/poky/meta/recipes-core/glibc/glibc-package.inc +++ b/external/poky/meta/recipes-core/glibc/glibc-package.inc @@ -1,6 +1,6 @@ INHIBIT_SYSROOT_STRIP = "1" -PACKAGES = "${PN}-dbg catchsegv sln nscd ldd tzcode glibc-thread-db ${PN}-pic libcidn libmemusage libnss-db libsegfault ${PN}-pcprofile libsotruss ${PN} ${PN}-utils glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc" +PACKAGES = "${PN}-dbg catchsegv sln nscd ldconfig ldd tzcode glibc-thread-db ${PN}-pic libcidn libmemusage libnss-db libsegfault ${PN}-pcprofile libsotruss ${PN} ${PN}-utils glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc" # The ld.so in this glibc supports the GNU_HASH RPROVIDES_${PN} = "eglibc rtld(GNU_HASH)" @@ -15,10 +15,17 @@ RPROVIDES_glibc-thread-db = "eglibc-thread-db" RPROVIDES_${PN}-pcprofile = "eglibc-pcprofile" RPROVIDES_${PN}-dbg = "eglibc-dbg" libc_baselibs = "${base_libdir}/libc.so.* ${base_libdir}/libc-*.so ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so ${base_libdir}/libmvec-*.so ${base_libdir}/ld*.so.* ${base_libdir}/ld-*.so ${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so ${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so ${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so ${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so ${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so ${base_libdir}/libnss_files*.so.* ${base_libdir}/libnss_files-*.so ${base_libdir}/libnss_compat*.so.* ${base_libdir}/libnss_compat-*.so ${base_libdir}/libnss_dns*.so.* ${base_libdir}/libnss_dns-*.so ${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so ${base_libdir}/libanl*.so.* ${base_libdir}/libanl-*.so ${base_libdir}/libBrokenLocale*.so.* ${base_libdir}/libBrokenLocale-*.so" -libc_baselibs_append_aarch64 = " /lib/ld-linux-aarch64*.so.1" +ARCH_DYNAMIC_LOADER = "" +# The aarch64 ABI says the dynamic linker -must- be +# /lib/ld-linux-aarch64{,_be}.so.1. With usrmerge, that may mean that +# we need to install it in /usr/lib. +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" -FILES_${PN} = "${libc_baselibs} ${libexecdir}/* ${base_sbindir}/ldconfig ${sysconfdir}/ld.so.conf" +FILES_${PN} = "${libc_baselibs} ${libexecdir}/*" +RRECOMMENDS_${PN} = "${@bb.utils.filter('DISTRO_FEATURES', 'ldconfig', d)}" +FILES_ldconfig = "${base_sbindir}/ldconfig ${sysconfdir}/ld.so.conf" FILES_ldd = "${bindir}/ldd" FILES_libsegfault = "${base_libdir}/libSegFault*" FILES_libcidn = "${base_libdir}/libcidn-*.so ${base_libdir}/libcidn.so.*" @@ -31,6 +38,7 @@ FILES_${PN}-pic = "${libdir}/*_pic.a ${libdir}/*_pic.map ${libdir}/libc_pic/*.o" FILES_libsotruss = "${libdir}/audit/sotruss-lib.so" FILES_SOLIBSDEV = "${libdir}/lib*${SOLIBSDEV}" FILES_${PN}-dev += "${libdir}/*_nonshared.a ${base_libdir}/*_nonshared.a ${base_libdir}/*.o ${datadir}/aclocal" +RDEPENDS_${PN}-dev = "linux-libc-headers-dev" FILES_${PN}-staticdev += "${libdir}/*.a ${base_libdir}/*.a" FILES_nscd = "${sbindir}/nscd* ${sysconfdir}/init.d/nscd ${systemd_unitdir}/system/nscd* ${sysconfdir}/tmpfiles.d/nscd.conf \ ${sysconfdir}/nscd.conf ${sysconfdir}/default/volatiles/98_nscd ${localstatedir}/db/nscd" @@ -57,9 +65,21 @@ DESCRIPTION_${PN}-utils = "Miscellaneous utilities including getconf, iconv, loc DESCRIPTION_libsotruss = "Library to support sotruss which traces calls through PLTs" DESCRIPTION_tzcode = "tzcode, timezone zoneinfo utils -- zic, zdump, tzselect" -inherit libc-common multilib_header +inherit multilib_header + +do_install() { + oe_runmake install_root=${D} install + install -Dm 0644 ${WORKDIR}/etc/ld.so.conf ${D}/${sysconfdir}/ld.so.conf + install -d ${D}${localedir} + make -f ${WORKDIR}/generate-supported.mk IN="${S}/localedata/SUPPORTED" OUT="${WORKDIR}/SUPPORTED" + # get rid of some broken files... + for i in ${GLIBC_BROKEN_LOCALES}; do + sed -i "/$i/d" ${WORKDIR}/SUPPORTED + done + rm -f ${D}${sysconfdir}/rpc + rm -rf ${D}${datadir}/zoneinfo + rm -rf ${D}${libexecdir}/getconf -do_install_append () { rm -f ${D}${sysconfdir}/localtime # remove empty glibc dir @@ -67,7 +87,7 @@ do_install_append () { rmdir --ignore-fail-on-non-empty ${D}${libexecdir} fi - oe_multilib_header bits/syscall.h bits/long-double.h bits/floatn.h + oe_multilib_header bits/syscall.h bits/long-double.h bits/floatn.h bits/endianness.h bits/struct_rwlock.h if [ -f ${D}${bindir}/mtrace ]; then sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' -e '2s,exec.*perl,exec ${USRBINPATH}/env perl,' ${D}${bindir}/mtrace @@ -77,21 +97,6 @@ do_install_append () { rm -f ${D}${infodir}/dir fi - if ! ${@bb.utils.contains('DISTRO_FEATURES', 'ldconfig', 'true', 'false', d)}; then - # The distro doesn't want these files so let's not install them - rm -f ${D}${sysconfdir}/ld.so.conf - rm -f ${D}${base_sbindir}/ldconfig - # This directory will be empty now so remove it too. - # But check whether it exists first, since it won't for glibc-initial. - if [ -d ${D}${sysconfdir} ]; then - rmdir ${D}${sysconfdir} - fi - fi - - if echo ${PN}|grep -q "glibc-initial"; then - return - fi - install -d ${D}${sysconfdir}/init.d install -d ${D}${localstatedir}/db/nscd install -m 0755 ${S}/nscd/nscd.init ${D}${sysconfdir}/init.d/nscd @@ -103,29 +108,38 @@ do_install_append () { install -d ${D}${systemd_unitdir}/system install -m 0644 ${S}/nscd/nscd.service ${D}${systemd_unitdir}/system/ + # The dynamic loader will have been installed into + # ${base_libdir}. However, if that isn't going to end up being + # available in the ABI-mandated location, then a symlink must + # be created. + + if [ -n "${ARCH_DYNAMIC_LOADER}" -a ! -e "${D}${root_prefix}/lib/${ARCH_DYNAMIC_LOADER}" ]; then + install -d ${D}${root_prefix}/lib + ln -s ${@oe.path.relative('${root_prefix}/lib', '${base_libdir}')}/${ARCH_DYNAMIC_LOADER} \ + ${D}${root_prefix}/lib/${ARCH_DYNAMIC_LOADER} + fi +} + +def get_libc_fpu_setting(bb, d): + if d.getVar('TARGET_FPU') in [ 'soft', 'ppc-efd' ]: + return "--without-fp" + return "" + +do_install_append_class-target() { if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then install -d ${D}${sysconfdir}/tmpfiles.d echo "d /run/nscd 755 root root -" \ > ${D}${sysconfdir}/tmpfiles.d/nscd.conf - else + fi + + if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then install -d ${D}${sysconfdir}/default/volatiles echo "d root root 0755 /var/run/nscd none" \ > ${D}${sysconfdir}/default/volatiles/98_nscd fi -} +} do_install_append_aarch64 () { - if [ "${base_libdir}" != "${nonarch_base_libdir}" ]; then - # The aarch64 ABI says the dynamic linker -must- be /lib/ld-linux-aarch64[_be].so.1 - install -d ${D}${nonarch_base_libdir} - if [ -e ${D}${base_libdir}/ld-linux-aarch64.so.1 ]; then - ln -s ${@oe.path.relative('${nonarch_base_libdir}', '${base_libdir}')}/ld-linux-aarch64.so.1 \ - ${D}${nonarch_base_libdir}/ld-linux-aarch64.so.1 - elif [ -e ${D}${base_libdir}/ld-linux-aarch64_be.so.1 ]; then - ln -s ${@oe.path.relative('${nonarch_base_libdir}', '${base_libdir}')}/ld-linux-aarch64_be.so.1 \ - ${D}${nonarch_base_libdir}/ld-linux-aarch64_be.so.1 - fi - fi do_install_armmultilib } @@ -141,6 +155,7 @@ do_install_armmultilib () { oe_multilib_header bits/endian.h bits/fcntl.h bits/fenv.h bits/fp-fast.h bits/hwcap.h bits/ipc.h bits/link.h bits/wordsize.h oe_multilib_header bits/local_lim.h bits/mman.h bits/msq.h bits/pthreadtypes.h bits/pthreadtypes-arch.h bits/sem.h bits/semaphore.h bits/setjmp.h oe_multilib_header bits/shm.h bits/sigstack.h bits/stat.h bits/statfs.h bits/typesizes.h + oe_multilib_header bits/procfs-id.h bits/procfs.h bits/shmlba.h oe_multilib_header fpu_control.h gnu/lib-names.h gnu/stubs.h ieee754.h @@ -153,27 +168,34 @@ bashscripts = "mtrace sotruss xtrace" do_stash_locale () { dest=${LOCALESTASH} - install -d ${dest}${base_libdir} ${dest}${bindir} ${dest}${libdir} ${dest}${datadir} - if [ "${base_libdir}" != "${libdir}" ]; then - cp -fpPR ${D}${base_libdir}/* ${dest}${base_libdir} - fi + install -d $dest${base_libdir} $dest${bindir} $dest${libdir} $dest${datadir} + # Hide away the locale data from the deployment if [ -e ${D}${bindir}/localedef ]; then - mv -f ${D}${bindir}/localedef ${dest}${bindir} + cp -a ${D}${bindir}/localedef $dest${bindir} fi if [ -e ${D}${libdir}/gconv ]; then - mv -f ${D}${libdir}/gconv ${dest}${libdir} - fi - if [ -e ${D}${exec_prefix}/lib ]; then - cp -fpPR ${D}${exec_prefix}/lib ${dest}${exec_prefix} + cp -a ${D}${libdir}/gconv $dest${libdir} fi if [ -e ${D}${datadir}/i18n ]; then - mv ${D}${datadir}/i18n ${dest}${datadir} + cp -a ${D}${datadir}/i18n $dest${datadir} fi - cp -fpPR ${D}${datadir}/* ${dest}${datadir} + + # Make a copy of all the libraries into the locale stash + cp -fpPR ${D}${libdir}/* $dest${libdir} + if [ "${base_libdir}" != "${libdir}" ]; then + cp -fpPR ${D}${base_libdir}/* $dest${base_libdir} + fi + if [ -e ${D}${exec_prefix}/lib ]; then + if [ ${exec_prefix}/lib != ${base_libdir} ] && [ ${exec_prefix}/lib != ${libdir} ]; then + cp -fpPR ${D}${exec_prefix}/lib $dest${exec_prefix} + fi + fi + + cp -fpPR ${D}${datadir}/* $dest${datadir} rm -rf ${D}${datadir}/locale/ - cp -fpPR ${WORKDIR}/SUPPORTED ${dest} + cp -fpPR ${WORKDIR}/SUPPORTED $dest - target=${dest}/scripts + target=$dest/scripts mkdir -p $target for i in ${bashscripts}; do if [ -f ${D}${bindir}/$i ]; then @@ -195,27 +217,59 @@ python do_stash_locale_setscene () { } addtask do_stash_locale_setscene -do_poststash_install_cleanup () { - # Remove all files which do_stash_locale would remove (mv) - # since that task could have come from sstate and not get run. +PACKAGE_PREPROCESS_FUNCS += "stash_locale_package_cleanup" +SYSROOT_PREPROCESS_FUNCS += "stash_locale_sysroot_cleanup" +stash_locale_cleanup () { + cleanupdir=$1 + # Remove all files which do_stash_locale() copies for i in ${bashscripts}; do - rm -f ${D}${bindir}/$i + rm -f $cleanupdir${bindir}/$i done - rm -f ${D}${bindir}/localedef - rm -rf ${D}${datadir}/i18n - rm -rf ${D}${libdir}/gconv - rm -rf ${D}/${localedir} - rm -rf ${D}${datadir}/locale - if [ "${libdir}" != "${exec_prefix}/lib" ]; then - if [ -d ${D}${exec_prefix}/lib ]; then - # error out if directory isn't empty - # this dir should only contain locale dir - # which has been deleted in the previous step - rmdir ${D}${exec_prefix}/lib + rm -f $cleanupdir${bindir}/localedef + rm -rf $cleanupdir${datadir}/i18n + rm -rf $cleanupdir${libdir}/gconv + rm -rf $cleanupdir${localedir} + rm -rf $cleanupdir${datadir}/locale + rmdir --ignore-fail-on-non-empty $cleanupdir${datadir} + + if [ "${libdir}" != "${exec_prefix}/lib" ] && [ "${root_prefix}/lib" != "${exec_prefix}/lib" ]; then + if [ -d "$cleanupdir${exec_prefix}/lib" ]; then + if [ -z "${ARCH_DYNAMIC_LOADER}" -o \ + ! -e "$cleanupdir${exec_prefix}/lib/${ARCH_DYNAMIC_LOADER}" ]; then + # error out if directory isn't empty + # this dir should only contain locale dir + # which has been deleted in the previous step + rmdir $cleanupdir${exec_prefix}/lib + fi fi fi } -addtask do_poststash_install_cleanup after do_stash_locale do_install before do_populate_sysroot do_package + +stash_locale_sysroot_cleanup() { + stash_locale_cleanup ${SYSROOT_DESTDIR} +} +stash_locale_package_cleanup() { + stash_locale_cleanup ${PKGD} +} + +python populate_packages_prepend () { + if d.getVar('DEBIAN_NAMES'): + pkgs = d.getVar('PACKAGES').split() + bpn = d.getVar('BPN') + prefix = d.getVar('MLPREFIX') or "" + # Set the base package... + d.setVar('PKG_' + prefix + bpn, prefix + 'libc6') + libcprefix = prefix + bpn + '-' + for p in pkgs: + # And all the subpackages. + if p.startswith(libcprefix): + renamed = p.replace(bpn, 'libc6', 1) + d.setVar('PKG_' + p, renamed) + # For backward compatibility with old -dbg package + d.appendVar('RPROVIDES_' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg') + d.appendVar('RCONFLICTS_' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg') + d.appendVar('RREPLACES_' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg') +} pkg_postinst_nscd () { if [ -z "$D" ]; then diff --git a/external/poky/meta/recipes-core/glibc/glibc-scripts_2.28.bb b/external/poky/meta/recipes-core/glibc/glibc-scripts_2.31.bb index 5a89bd80..5a89bd80 100644 --- a/external/poky/meta/recipes-core/glibc/glibc-scripts_2.28.bb +++ b/external/poky/meta/recipes-core/glibc/glibc-scripts_2.31.bb diff --git a/external/poky/meta/recipes-core/glibc/glibc-testing.inc b/external/poky/meta/recipes-core/glibc/glibc-testing.inc deleted file mode 100644 index 0a42ae7f..00000000 --- a/external/poky/meta/recipes-core/glibc/glibc-testing.inc +++ /dev/null @@ -1,95 +0,0 @@ -do_compile_append () { - # now generate script to drive testing - echo "#!/usr/bin/env sh" >${B}/${HOST_PREFIX}testglibc - set >> ${B}/${HOST_PREFIX}testglibc - # prune out the unneeded vars - sed -i -e "/^BASH/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^USER/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^OPT/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^DIRSTACK/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^EUID/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^FUNCNAME/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^GROUPS/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^HOST/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^HOME/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^IFS/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^LC_ALL/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^LOGNAME/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^MACHTYPE/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^OSTYPE/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^PIPE/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^SHELL/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^'/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^UID/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^TERM/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^PKG_/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^POSIXLY_/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^PPID/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^PS4/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^Q/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^SHLVL/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^STAGING/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^LD_LIBRARY_PATH/d" ${B}/${HOST_PREFIX}testglibc - sed -i -e "/^PSEUDO/d" ${B}/${HOST_PREFIX}testglibc - - # point to real sysroot not the toolchain bootstrap sysroot - sed -i -e "s/\-tcbootstrap//g" ${B}/${HOST_PREFIX}testglibc - - # use the final cross-gcc to test since some tests need libstdc++ - sed -i -e "s/^PATH=.*\.gcc-cross-initial\:/PATH=/g" ${B}/${HOST_PREFIX}testglibc - - # append execution part script -cat >> ${B}/${HOST_PREFIX}testglibc << STOP -target="\$1" -if [ "x\$target" = "x" ] -then - echo "Please specify the target machine and remote user in form of user@target" - exit 1; -fi -ssh \$target ls \$PWD\ 2>&1 > /dev/null -if [ "x\$?" != "x0" ] -then - echo "Failed connecting to \$target it could be because of:" - echo "1. You dont have passwordless ssh setup to access \$target" - echo "2. NFS share on \$target is not mounted or if mounted then not matching the build tree layout." - echo " The tree should be accessible at same location on build host and target" - echo " You can add nfs-client to IMAGE_FEATURES to get the nfs client on target" - echo "3. nfs server on build host is not running." - echo " Please make sure that you have 'no_root_squash' added in /etc/exports if you want" - echo " to test as root user on target (usually its recommended to create a non" - echo " root user." - echo " As a sanity check make sure that target can read/write to the glibc build tree" - echo " Please refer to ${S}/EGLIBC.cross-testing for further instructions on setup" - exit 1 -fi - echo "# we test using cross compiler from real sysroot therefore override the" > ${B}/configparms - echo "# definitions that come from ${B}/config.make" >> ${B}/configparms - fgrep tcbootstrap ${B}/config.make > ${B}/configparms - sed -i -e "s/\-tcbootstrap//g" ${B}/configparms - -# g++ uses flag -nostdinc, so the locations of system include headers must be explicitly specified -# If the locations are not already specified in config.make, then we provide the following locations: -# <sysroot>/usr/include/c++/<g++ version> -# <sysroot>/usr/include/c++/<g++ version>/<machine> - -cxxincludes=\`cat ${B}/config.make | gawk '\$1 == "c++-sysincludes"' | gawk -F"=" '{print \$2}' | sed "s/[ \t]\?//g"\` - -if [ -z "\$cxxincludes" ]; then - sysroot=\`cat ${B}/configparms | sed -n "/CXX/p" | sed -e "s/^.*--sysroot=//"\` - cxx=\`cat ${B}/configparms | gawk '\$1 ~ /^CXX/' | gawk -F"=" '{print \$2}' | gawk '{print \$1}'\` - cxxmachine=\`\$cxx -dumpmachine\` - cxxversion=\`\$cxx -dumpversion\` - # pass the new value of c++-sysincludes via configparms - echo "# c++-sysincludes added:" >> ${B}/configparms - echo "c++-sysincludes = -isystem \$sysroot/usr/include/c++/\$cxxversion -isystem \$sysroot/usr/include/c++/\$cxxversion/\$cxxmachine" >> ${B}/configparms -fi - -wrapper="${S}/scripts/cross-test-ssh.sh \$target" -localedef="${STAGING_BINDIR_NATIVE}/cross-localedef --little-endian --uint32-align=4" -make tests-clean -make cross-localedef="\$localedef" cross-test-wrapper="\$wrapper" -k check -rm -rf ${B}/configparms -STOP - - chmod +x ${B}/${HOST_PREFIX}testglibc -} diff --git a/external/poky/meta/recipes-core/glibc/glibc-testsuite_2.31.bb b/external/poky/meta/recipes-core/glibc/glibc-testsuite_2.31.bb new file mode 100644 index 00000000..d887aeff --- /dev/null +++ b/external/poky/meta/recipes-core/glibc/glibc-testsuite_2.31.bb @@ -0,0 +1,63 @@ +require glibc_${PV}.bb + +EXCLUDE_FROM_WORLD = "1" + +# handle PN differences +FILESEXTRAPATHS_prepend := "${THISDIR}/glibc:" + +# strip provides +PROVIDES = "" +# setup depends +INHIBIT_DEFAULT_DEPS = "" + +python () { + libc = d.getVar("PREFERRED_PROVIDER_virtual/libc") + libclocale = d.getVar("PREFERRED_PROVIDER_virtual/libc-locale") + if libc != "glibc" or libclocale != "glibc-locale": + raise bb.parse.SkipRecipe("glibc-testsuite requires that virtual/libc is glibc") +} + +DEPENDS += "glibc-locale libgcc gcc-runtime" + +# remove the initial depends +DEPENDS_remove = "libgcc-initial" + +inherit qemu + +SRC_URI += "file://check-test-wrapper" + +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[dirs] += "${B}" +do_check[nostamp] = "1" +do_check () { + chmod 0755 ${WORKDIR}/check-test-wrapper + + # clean out previous test results + oe_runmake tests-clean + # makefiles don't clean entirely (and also sometimes fails due to too many args) + find ${B} -type f -name "*.out" -delete + find ${B} -type f -name "*.test-result" -delete + find ${B}/catgets -name "*.cat" -delete + find ${B}/conform -name "symlist-*" -delete + [ ! -e ${B}/timezone/testdata ] || rm -rf ${B}/timezone/testdata + + 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 +} +addtask do_check after do_compile + +inherit nopackages +deltask do_stash_locale +deltask do_install diff --git a/external/poky/meta/recipes-core/glibc/glibc-version.inc b/external/poky/meta/recipes-core/glibc/glibc-version.inc new file mode 100644 index 00000000..3bcd336d --- /dev/null +++ b/external/poky/meta/recipes-core/glibc/glibc-version.inc @@ -0,0 +1,8 @@ +SRCBRANCH ?= "release/2.31/master" +PV = "2.31+git${SRCPV}" +SRCREV_glibc ?= "6fdf971c9dbf7dac9bea552113fe4694015bbc4d" +SRCREV_localedef ?= "cd9f958c4c94a638fa7b2b4e21627364f1a1a655" + +GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git" + +UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+\.\d+(\.(?!90)\d+)*)" diff --git a/external/poky/meta/recipes-core/glibc/glibc.inc b/external/poky/meta/recipes-core/glibc/glibc.inc index 99c92ce4..23a6ca99 100644 --- a/external/poky/meta/recipes-core/glibc/glibc.inc +++ b/external/poky/meta/recipes-core/glibc/glibc.inc @@ -1,44 +1,19 @@ require glibc-common.inc require glibc-ld.inc -require glibc-testing.inc -STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}" -STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}" -PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:" +DEPENDS = "virtual/${TARGET_PREFIX}gcc libgcc-initial linux-libc-headers" -python () { - opt_effective = "-O" - for opt in d.getVar('SELECTED_OPTIMIZATION').split(): - if opt in ("-O0", "-O", "-O1", "-O2", "-O3", "-Os"): - opt_effective = opt - if opt_effective == "-O0": - bb.fatal("%s can't be built with %s, try -O1 instead" % (d.getVar('PN'), opt_effective)) -} - -# siteconfig.bbclass runs configure which needs a working compiler -# For the compiler to work we need a working libc yet libc isn't -# in the sysroots directory at this point. This means the libc.so -# linker script won't work as the --sysroot setting isn't correct. -# Here we create a hacked up libc linker script and pass in the right -# flags to let configure work. Ugly. -EXTRASITECONFIG = "CFLAGS='${CFLAGS} -Wl,-L${WORKDIR}/site_config_libc -L${WORKDIR}/site_config_libc -L${SYSROOT_DESTDIR}${libdir} -L${SYSROOT_DESTDIR}${base_libdir} -Wl,-L${SYSROOT_DESTDIR}${libdir} -Wl,-L${SYSROOT_DESTDIR}${base_libdir}'" -siteconfig_do_siteconfig_gencache_prepend = " \ - mkdir -p ${WORKDIR}/site_config_libc; \ - cp ${SYSROOT_DESTDIR}${libdir}/libc.so ${WORKDIR}/site_config_libc; \ - sed -i -e 's# ${base_libdir}# ${SYSROOT_DESTDIR}${base_libdir}#g' -e 's# ${libdir}# ${SYSROOT_DESTDIR}${libdir}#g' ${WORKDIR}/site_config_libc/libc.so; \ -" - -# nptl needs unwind support in gcc, which can't be built without glibc. -DEPENDS = "virtual/${TARGET_PREFIX}gcc-initial libgcc-initial linux-libc-headers virtual/${TARGET_PREFIX}libc-initial" - -PROVIDES = "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc" +PROVIDES = "virtual/libc" PROVIDES += "virtual/libintl virtual/libiconv" -inherit autotools texinfo distro_features_check systemd +inherit autotools texinfo features_check systemd LEAD_SONAME = "libc.so" +# msgfmt could come from gettext-native but we don't depend on that and +# disable for reproducibility CACHED_CONFIGUREVARS += " \ ac_cv_path_BASH_SHELL=${base_bindir}/bash \ + ac_cv_prog_MSGFMT= \ libc_cv_slibdir=${base_libdir} \ libc_cv_rootsbindir=${base_sbindir} \ libc_cv_localedir=${localedir} \ @@ -47,16 +22,11 @@ CACHED_CONFIGUREVARS += " \ libc_cv_ssp=no \ " +# ifunc doesn't appear to work on mips, casuses libbfd assertion failures +CACHED_CONFIGUREVARS_append_mipsarch = " libc_cv_ld_gnu_indirect_function=no" + GLIBC_EXTRA_OECONF ?= "" GLIBC_EXTRA_OECONF_class-nativesdk = "" -INHIBIT_DEFAULT_DEPS = "1" - -# This needs to match with glibc-collateral.inc, otherwise glibc-scripts and glibc-locale -# will fail to find main glibc, for details see -# http://lists.openembedded.org/pipermail/openembedded-core/2015-January/100679.html -ARM_INSTRUCTION_SET_armv4 = "arm" -ARM_INSTRUCTION_SET_armv5 = "arm" -ARM_INSTRUCTION_SET_armv6 = "arm" # glibc uses PARALLELMFLAGS variable to pass parallel build info so transfer # PARALLEL_MAKE into PARALLELMFLAGS and empty out PARALLEL_MAKE diff --git a/external/poky/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch b/external/poky/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch new file mode 100644 index 00000000..d0786be8 --- /dev/null +++ b/external/poky/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch @@ -0,0 +1,1130 @@ +From 3dcf144e998aed17b3fb957a255b1e923ba07d71 Mon Sep 17 00:00:00 2001 +From: Jason Wessel <jason.wessel@windriver.com> +Date: Sat, 7 Dec 2019 09:59:22 -0800 +Subject: [PATCH] localedef: Add hardlink resolver from util-linux + +The hard link resolver that is built into localedef cannot be run in +parallel. It will search sibling directories (which are be processed +in parallel) and perform a creation of a .tmp file and remove the +original and move the .tmp file in. The problem is that if a probe +occurs a hard link can be requested to the file that is being removed. +This will lead to a stray copy or potentially, on a loaded system +cause race condition which pseudo cannot deal with, where it is left +with a hard link request to a file that no longer exists. In this +situation psuedo will inherit the permissions of what ever the target +inode had to offer. + +In short, there are two problems: + +1) You will be left with stray copies when using the hard link +resolution that is built in while running in parallel with +localedef. + +2) When running under pseudo the possibility exists for uid/gid +leakage when the source file is removed before the hard link can +be completed. + +The solution is to call localedef with --no-hard-links and separately +process the hardlinks at a later point. To do this requires the +inclusion of the hardlink utility found in modern versions of +util-linux. Most host systems do not have this, so it will be +included with the cross-localedef binary. + +[YOCTO #11299] +[YOCTO #12434] + +Upstream-Status: Pending + +Signed-off-by: Jason Wessel <jason.wessel@windriver.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + locale/programs/c.h | 407 ++++++++++++++++ + locale/programs/cross-localedef-hardlink.c | 528 +++++++++++++++++++++ + locale/programs/xalloc.h | 129 +++++ + 3 files changed, 1064 insertions(+) + create mode 100644 locale/programs/c.h + create mode 100644 locale/programs/cross-localedef-hardlink.c + create mode 100644 locale/programs/xalloc.h + +diff --git a/locale/programs/c.h b/locale/programs/c.h +new file mode 100644 +index 0000000000..d0a402e90e +--- /dev/null ++++ b/locale/programs/c.h +@@ -0,0 +1,407 @@ ++/* ++ * Fundamental C definitions. ++ */ ++ ++#ifndef UTIL_LINUX_C_H ++#define UTIL_LINUX_C_H ++ ++#include <limits.h> ++#include <stddef.h> ++#include <stdint.h> ++#include <stdio.h> ++#include <unistd.h> ++#include <stdarg.h> ++#include <stdlib.h> ++#include <string.h> ++#include <errno.h> ++ ++#include <assert.h> ++ ++#ifdef HAVE_ERR_H ++# include <err.h> ++#endif ++ ++#ifdef HAVE_SYS_SYSMACROS_H ++# include <sys/sysmacros.h> /* for major, minor */ ++#endif ++ ++#ifndef LOGIN_NAME_MAX ++# define LOGIN_NAME_MAX 256 ++#endif ++ ++#ifndef NAME_MAX ++# define NAME_MAX PATH_MAX ++#endif ++ ++/* ++ * __GNUC_PREREQ is deprecated in favour of __has_attribute() and ++ * __has_feature(). The __has macros are supported by clang and gcc>=5. ++ */ ++#ifndef __GNUC_PREREQ ++# if defined __GNUC__ && defined __GNUC_MINOR__ ++# define __GNUC_PREREQ(maj, min) \ ++ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) ++# else ++# define __GNUC_PREREQ(maj, min) 0 ++# endif ++#endif ++ ++#ifdef __GNUC__ ++ ++/* &a[0] degrades to a pointer: a different type from an array */ ++# define __must_be_array(a) \ ++ UL_BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(__typeof__(a), __typeof__(&a[0]))) ++ ++# define ignore_result(x) __extension__ ({ \ ++ __typeof__(x) __dummy __attribute__((__unused__)) = (x); (void) __dummy; \ ++}) ++ ++#else /* !__GNUC__ */ ++# define __must_be_array(a) 0 ++# define __attribute__(_arg_) ++# define ignore_result(x) ((void) (x)) ++#endif /* !__GNUC__ */ ++ ++/* ++ * It evaluates to 1 if the attribute/feature is supported by the current ++ * compilation targed. Fallback for old compilers. ++ */ ++#ifndef __has_attribute ++ #define __has_attribute(x) 0 ++#endif ++ ++#ifndef __has_feature ++ #define __has_feature(x) 0 ++#endif ++ ++/* ++ * Function attributes ++ */ ++#ifndef __ul_alloc_size ++# if (__has_attribute(alloc_size) && __has_attribute(warn_unused_result)) || __GNUC_PREREQ (4, 3) ++# define __ul_alloc_size(s) __attribute__((alloc_size(s), warn_unused_result)) ++# else ++# define __ul_alloc_size(s) ++# endif ++#endif ++ ++#ifndef __ul_calloc_size ++# if (__has_attribute(alloc_size) && __has_attribute(warn_unused_result)) || __GNUC_PREREQ (4, 3) ++# define __ul_calloc_size(n, s) __attribute__((alloc_size(n, s), warn_unused_result)) ++# else ++# define __ul_calloc_size(n, s) ++# endif ++#endif ++ ++#if __has_attribute(returns_nonnull) || __GNUC_PREREQ (4, 9) ++# define __ul_returns_nonnull __attribute__((returns_nonnull)) ++#else ++# define __ul_returns_nonnull ++#endif ++ ++/* ++ * Force a compilation error if condition is true, but also produce a ++ * result (of value 0 and type size_t), so the expression can be used ++ * e.g. in a structure initializer (or wherever else comma expressions ++ * aren't permitted). ++ */ ++#define UL_BUILD_BUG_ON_ZERO(e) __extension__ (sizeof(struct { int:-!!(e); })) ++#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) ++ ++#ifndef ARRAY_SIZE ++# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) ++#endif ++ ++#ifndef PATH_MAX ++# define PATH_MAX 4096 ++#endif ++ ++#ifndef TRUE ++# define TRUE 1 ++#endif ++ ++#ifndef FALSE ++# define FALSE 0 ++#endif ++ ++#ifndef min ++# define min(x, y) __extension__ ({ \ ++ __typeof__(x) _min1 = (x); \ ++ __typeof__(y) _min2 = (y); \ ++ (void) (&_min1 == &_min2); \ ++ _min1 < _min2 ? _min1 : _min2; }) ++#endif ++ ++#ifndef max ++# define max(x, y) __extension__ ({ \ ++ __typeof__(x) _max1 = (x); \ ++ __typeof__(y) _max2 = (y); \ ++ (void) (&_max1 == &_max2); \ ++ _max1 > _max2 ? _max1 : _max2; }) ++#endif ++ ++#ifndef cmp_numbers ++# define cmp_numbers(x, y) __extension__ ({ \ ++ __typeof__(x) _a = (x); \ ++ __typeof__(y) _b = (y); \ ++ (void) (&_a == &_b); \ ++ _a == _b ? 0 : _a > _b ? 1 : -1; }) ++#endif ++ ++#ifndef offsetof ++#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) ++#endif ++ ++/* ++ * container_of - cast a member of a structure out to the containing structure ++ * @ptr: the pointer to the member. ++ * @type: the type of the container struct this is embedded in. ++ * @member: the name of the member within the struct. ++ */ ++#ifndef container_of ++#define container_of(ptr, type, member) __extension__ ({ \ ++ const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \ ++ (type *)( (char *)__mptr - offsetof(type,member) );}) ++#endif ++ ++#ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME ++# ifdef HAVE___PROGNAME ++extern char *__progname; ++# define program_invocation_short_name __progname ++# else ++# ifdef HAVE_GETEXECNAME ++# define program_invocation_short_name \ ++ prog_inv_sh_nm_from_file(getexecname(), 0) ++# else ++# define program_invocation_short_name \ ++ prog_inv_sh_nm_from_file(__FILE__, 1) ++# endif ++static char prog_inv_sh_nm_buf[256]; ++static inline char * ++prog_inv_sh_nm_from_file(char *f, char stripext) ++{ ++ char *t; ++ ++ if ((t = strrchr(f, '/')) != NULL) ++ t++; ++ else ++ t = f; ++ ++ strncpy(prog_inv_sh_nm_buf, t, sizeof(prog_inv_sh_nm_buf) - 1); ++ prog_inv_sh_nm_buf[sizeof(prog_inv_sh_nm_buf) - 1] = '\0'; ++ ++ if (stripext && (t = strrchr(prog_inv_sh_nm_buf, '.')) != NULL) ++ *t = '\0'; ++ ++ return prog_inv_sh_nm_buf; ++} ++# endif ++#endif ++ ++ ++#ifndef HAVE_ERR_H ++static inline void ++errmsg(char doexit, int excode, char adderr, const char *fmt, ...) ++{ ++ fprintf(stderr, "%s: ", program_invocation_short_name); ++ if (fmt != NULL) { ++ va_list argp; ++ va_start(argp, fmt); ++ vfprintf(stderr, fmt, argp); ++ va_end(argp); ++ if (adderr) ++ fprintf(stderr, ": "); ++ } ++ if (adderr) ++ fprintf(stderr, "%m"); ++ fprintf(stderr, "\n"); ++ if (doexit) ++ exit(excode); ++} ++ ++#ifndef HAVE_ERR ++# define err(E, FMT...) errmsg(1, E, 1, FMT) ++#endif ++ ++#ifndef HAVE_ERRX ++# define errx(E, FMT...) errmsg(1, E, 0, FMT) ++#endif ++ ++#ifndef HAVE_WARN ++# define warn(FMT...) errmsg(0, 0, 1, FMT) ++#endif ++ ++#ifndef HAVE_WARNX ++# define warnx(FMT...) errmsg(0, 0, 0, FMT) ++#endif ++#endif /* !HAVE_ERR_H */ ++ ++ ++/* Don't use inline function to avoid '#include "nls.h"' in c.h ++ */ ++#define errtryhelp(eval) __extension__ ({ \ ++ fprintf(stderr, _("Try '%s --help' for more information.\n"), \ ++ program_invocation_short_name); \ ++ exit(eval); \ ++}) ++ ++/* After failed execvp() */ ++#define EX_EXEC_FAILED 126 /* Program located, but not usable. */ ++#define EX_EXEC_ENOENT 127 /* Could not find program to exec. */ ++#define errexec(name) err(errno == ENOENT ? EX_EXEC_ENOENT : EX_EXEC_FAILED, \ ++ _("failed to execute %s"), name) ++ ++ ++static inline __attribute__((const)) int is_power_of_2(unsigned long num) ++{ ++ return (num != 0 && ((num & (num - 1)) == 0)); ++} ++ ++#ifndef HAVE_LOFF_T ++typedef int64_t loff_t; ++#endif ++ ++#if !defined(HAVE_DIRFD) && (!defined(HAVE_DECL_DIRFD) || HAVE_DECL_DIRFD == 0) && defined(HAVE_DIR_DD_FD) ++#include <sys/types.h> ++#include <dirent.h> ++static inline int dirfd(DIR *d) ++{ ++ return d->dd_fd; ++} ++#endif ++ ++/* ++ * Fallback defines for old versions of glibc ++ */ ++#include <fcntl.h> ++ ++#ifdef O_CLOEXEC ++#define UL_CLOEXECSTR "e" ++#else ++#define UL_CLOEXECSTR "" ++#endif ++ ++#ifndef O_CLOEXEC ++#define O_CLOEXEC 0 ++#endif ++ ++#ifdef __FreeBSD_kernel__ ++#ifndef F_DUPFD_CLOEXEC ++#define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ ++#endif ++#endif ++ ++ ++#ifndef AI_ADDRCONFIG ++#define AI_ADDRCONFIG 0x0020 ++#endif ++ ++#ifndef IUTF8 ++#define IUTF8 0040000 ++#endif ++ ++/* ++ * MAXHOSTNAMELEN replacement ++ */ ++static inline size_t get_hostname_max(void) ++{ ++ long len = sysconf(_SC_HOST_NAME_MAX); ++ ++ if (0 < len) ++ return len; ++ ++#ifdef MAXHOSTNAMELEN ++ return MAXHOSTNAMELEN; ++#elif HOST_NAME_MAX ++ return HOST_NAME_MAX; ++#endif ++ return 64; ++} ++ ++ ++/* ++ * Constant strings for usage() functions. For more info see ++ * Documentation/{howto-usage-function.txt,boilerplate.c} ++ */ ++#define USAGE_HEADER ("\nUsage:\n") ++#define USAGE_OPTIONS ("\nOptions:\n") ++#define USAGE_FUNCTIONS ("\nFunctions:\n") ++#define USAGE_COMMANDS ("\nCommands:\n") ++#define USAGE_COLUMNS ("\nAvailable output columns:\n") ++#define USAGE_SEPARATOR "\n" ++ ++#define USAGE_OPTSTR_HELP ("display this help") ++#define USAGE_OPTSTR_VERSION ("display version") ++ ++#define USAGE_HELP_OPTIONS(marg_dsc) \ ++ "%-" #marg_dsc "s%s\n" \ ++ "%-" #marg_dsc "s%s\n" \ ++ , " -h, --help", USAGE_OPTSTR_HELP \ ++ , " -V, --version", USAGE_OPTSTR_VERSION ++ ++#define USAGE_MAN_TAIL(_man) ("\nFor more details see %s.\n"), _man ++ ++#define UTIL_LINUX_VERSION ("%s from %s\n"), program_invocation_short_name, PACKAGE_STRING ++ ++#define print_version(eval) __extension__ ({ \ ++ printf(UTIL_LINUX_VERSION); \ ++ exit(eval); \ ++}) ++ ++/* ++ * scanf modifiers for "strings allocation" ++ */ ++#ifdef HAVE_SCANF_MS_MODIFIER ++#define UL_SCNsA "%ms" ++#elif defined(HAVE_SCANF_AS_MODIFIER) ++#define UL_SCNsA "%as" ++#endif ++ ++/* ++ * seek stuff ++ */ ++#ifndef SEEK_DATA ++# define SEEK_DATA 3 ++#endif ++#ifndef SEEK_HOLE ++# define SEEK_HOLE 4 ++#endif ++ ++ ++/* ++ * Macros to convert #define'itions to strings, for example ++ * #define XYXXY 42 ++ * printf ("%s=%s\n", stringify(XYXXY), stringify_value(XYXXY)); ++ */ ++#define stringify_value(s) stringify(s) ++#define stringify(s) #s ++ ++/* ++ * UL_ASAN_BLACKLIST is a macro to tell AddressSanitizer (a compile-time ++ * instrumentation shipped with Clang and GCC) to not instrument the ++ * annotated function. Furthermore, it will prevent the compiler from ++ * inlining the function because inlining currently breaks the blacklisting ++ * mechanism of AddressSanitizer. ++ */ ++#if __has_feature(address_sanitizer) && __has_attribute(no_sanitize_memory) && __has_attribute(no_sanitize_address) ++# define UL_ASAN_BLACKLIST __attribute__((noinline)) __attribute__((no_sanitize_memory)) __attribute__((no_sanitize_address)) ++#else ++# define UL_ASAN_BLACKLIST /* nothing */ ++#endif ++ ++/* ++ * Note that sysconf(_SC_GETPW_R_SIZE_MAX) returns *initial* suggested size for ++ * pwd buffer and in some cases it is not large enough. See POSIX and ++ * getpwnam_r man page for more details. ++ */ ++#define UL_GETPW_BUFSIZ (16 * 1024) ++ ++/* ++ * Darwin or other BSDs may only have MAP_ANON. To get it on Darwin we must ++ * define _DARWIN_C_SOURCE before including sys/mman.h. We do this in config.h. ++ */ ++#if !defined MAP_ANONYMOUS && defined MAP_ANON ++# define MAP_ANONYMOUS (MAP_ANON) ++#endif ++ ++#endif /* UTIL_LINUX_C_H */ +diff --git a/locale/programs/cross-localedef-hardlink.c b/locale/programs/cross-localedef-hardlink.c +new file mode 100644 +index 0000000000..63615896b0 +--- /dev/null ++++ b/locale/programs/cross-localedef-hardlink.c +@@ -0,0 +1,528 @@ ++/* ++ * hardlink - consolidate duplicate files via hardlinks ++ * ++ * Copyright (C) 2018 Red Hat, Inc. All rights reserved. ++ * Written by Jakub Jelinek <jakub@redhat.com> ++ * ++ * Copyright (C) 2019 Karel Zak <kzak@redhat.com> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it would be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License along ++ * with this program; if not, write to the Free Software Foundation, Inc., ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ++ */ ++#include <sys/types.h> ++#include <stdlib.h> ++#include <getopt.h> ++#include <stdio.h> ++#include <unistd.h> ++#include <sys/stat.h> ++#include <sys/mman.h> ++#include <string.h> ++#include <dirent.h> ++#include <fcntl.h> ++#include <errno.h> ++#ifdef HAVE_PCRE ++# define PCRE2_CODE_UNIT_WIDTH 8 ++# include <pcre2.h> ++#endif ++ ++#include "c.h" ++#include "xalloc.h" ++#include "nls.h" ++#include "closestream.h" ++ ++#define NHASH (1<<17) /* Must be a power of 2! */ ++#define NBUF 64 ++ ++struct hardlink_file; ++ ++struct hardlink_hash { ++ struct hardlink_hash *next; ++ struct hardlink_file *chain; ++ off_t size; ++ time_t mtime; ++}; ++ ++struct hardlink_dir { ++ struct hardlink_dir *next; ++ char name[]; ++}; ++ ++struct hardlink_file { ++ struct hardlink_file *next; ++ ino_t ino; ++ dev_t dev; ++ unsigned int cksum; ++ char name[]; ++}; ++ ++struct hardlink_dynstr { ++ char *buf; ++ size_t alloc; ++}; ++ ++struct hardlink_ctl { ++ struct hardlink_dir *dirs; ++ struct hardlink_hash *hps[NHASH]; ++ char iobuf1[BUFSIZ]; ++ char iobuf2[BUFSIZ]; ++ /* summary counters */ ++ unsigned long long ndirs; ++ unsigned long long nobjects; ++ unsigned long long nregfiles; ++ unsigned long long ncomp; ++ unsigned long long nlinks; ++ unsigned long long nsaved; ++ /* current device */ ++ dev_t dev; ++ /* flags */ ++ unsigned int verbose; ++ unsigned int ++ no_link:1, ++ content_only:1, ++ force:1; ++}; ++/* ctl is in global scope due use in atexit() */ ++struct hardlink_ctl global_ctl; ++ ++__attribute__ ((always_inline)) ++static inline unsigned int hash(off_t size, time_t mtime) ++{ ++ return (size ^ mtime) & (NHASH - 1); ++} ++ ++__attribute__ ((always_inline)) ++static inline int stcmp(struct stat *st1, struct stat *st2, int content_scope) ++{ ++ if (content_scope) ++ return st1->st_size != st2->st_size; ++ ++ return st1->st_mode != st2->st_mode ++ || st1->st_uid != st2->st_uid ++ || st1->st_gid != st2->st_gid ++ || st1->st_size != st2->st_size ++ || st1->st_mtime != st2->st_mtime; ++} ++ ++static void print_summary(void) ++{ ++ struct hardlink_ctl const *const ctl = &global_ctl; ++ ++ if (!ctl->verbose) ++ return; ++ ++ if (ctl->verbose > 1 && ctl->nlinks) ++ fputc('\n', stdout); ++ ++ printf(_("Directories: %9lld\n"), ctl->ndirs); ++ printf(_("Objects: %9lld\n"), ctl->nobjects); ++ printf(_("Regular files: %9lld\n"), ctl->nregfiles); ++ printf(_("Comparisons: %9lld\n"), ctl->ncomp); ++ printf( "%s%9lld\n", (ctl->no_link ? ++ _("Would link: ") : ++ _("Linked: ")), ctl->nlinks); ++ printf( "%s %9lld\n", (ctl->no_link ? ++ _("Would save: ") : ++ _("Saved: ")), ctl->nsaved); ++} ++ ++static void __attribute__((__noreturn__)) usage(void) ++{ ++ fputs(USAGE_HEADER, stdout); ++ printf(_(" %s [options] directory...\n"), program_invocation_short_name); ++ ++ fputs(USAGE_SEPARATOR, stdout); ++ puts(_("Consolidate duplicate files using hardlinks.")); ++ ++ fputs(USAGE_OPTIONS, stdout); ++ puts(_(" -c, --content compare only contents, ignore permission, etc.")); ++ puts(_(" -n, --dry-run don't actually link anything")); ++ puts(_(" -v, --verbose print summary after hardlinking")); ++ puts(_(" -vv print every hardlinked file and summary")); ++ puts(_(" -f, --force force hardlinking across filesystems")); ++ puts(_(" -x, --exclude <regex> exclude files matching pattern")); ++ ++ fputs(USAGE_SEPARATOR, stdout); ++ printf(USAGE_HELP_OPTIONS(16)); /* char offset to align option descriptions */ ++ printf(USAGE_MAN_TAIL("hardlink(1)")); ++ exit(EXIT_SUCCESS); ++} ++ ++__attribute__ ((always_inline)) ++static inline size_t add2(size_t a, size_t b) ++{ ++ size_t sum = a + b; ++ ++ if (sum < a) ++ errx(EXIT_FAILURE, _("integer overflow")); ++ return sum; ++} ++ ++__attribute__ ((always_inline)) ++static inline size_t add3(size_t a, size_t b, size_t c) ++{ ++ return add2(add2(a, b), c); ++} ++ ++static void growstr(struct hardlink_dynstr *str, size_t newlen) ++{ ++ if (newlen < str->alloc) ++ return; ++ str->buf = xrealloc(str->buf, str->alloc = add2(newlen, 1)); ++} ++ ++static void process_path(struct hardlink_ctl *ctl, const char *name) ++{ ++ struct stat st, st2, st3; ++ const size_t namelen = strlen(name); ++ ++ ctl->nobjects++; ++ if (lstat(name, &st)) ++ return; ++ ++ if (st.st_dev != ctl->dev && !ctl->force) { ++ if (ctl->dev) ++ errx(EXIT_FAILURE, ++ _("%s is on different filesystem than the rest " ++ "(use -f option to override)."), name); ++ ctl->dev = st.st_dev; ++ } ++ if (S_ISDIR(st.st_mode)) { ++ struct hardlink_dir *dp = xmalloc(add3(sizeof(*dp), namelen, 1)); ++ memcpy(dp->name, name, namelen + 1); ++ dp->next = ctl->dirs; ++ ctl->dirs = dp; ++ ++ } else if (S_ISREG(st.st_mode)) { ++ int fd, i; ++ struct hardlink_file *fp, *fp2; ++ struct hardlink_hash *hp; ++ const char *n1, *n2; ++ unsigned int buf[NBUF]; ++ int cksumsize = sizeof(buf); ++ unsigned int cksum; ++ time_t mtime = ctl->content_only ? 0 : st.st_mtime; ++ unsigned int hsh = hash(st.st_size, mtime); ++ off_t fsize; ++ ++ ctl->nregfiles++; ++ if (ctl->verbose > 1) ++ printf("%s\n", name); ++ ++ fd = open(name, O_RDONLY); ++ if (fd < 0) ++ return; ++ ++ if ((size_t)st.st_size < sizeof(buf)) { ++ cksumsize = st.st_size; ++ memset(((char *)buf) + cksumsize, 0, ++ (sizeof(buf) - cksumsize) % sizeof(buf[0])); ++ } ++ if (read(fd, buf, cksumsize) != cksumsize) { ++ close(fd); ++ return; ++ } ++ cksumsize = (cksumsize + sizeof(buf[0]) - 1) / sizeof(buf[0]); ++ for (i = 0, cksum = 0; i < cksumsize; i++) { ++ if (cksum + buf[i] < cksum) ++ cksum += buf[i] + 1; ++ else ++ cksum += buf[i]; ++ } ++ for (hp = ctl->hps[hsh]; hp; hp = hp->next) { ++ if (hp->size == st.st_size && hp->mtime == mtime) ++ break; ++ } ++ if (!hp) { ++ hp = xmalloc(sizeof(*hp)); ++ hp->size = st.st_size; ++ hp->mtime = mtime; ++ hp->chain = NULL; ++ hp->next = ctl->hps[hsh]; ++ ctl->hps[hsh] = hp; ++ } ++ for (fp = hp->chain; fp; fp = fp->next) { ++ if (fp->cksum == cksum) ++ break; ++ } ++ for (fp2 = fp; fp2 && fp2->cksum == cksum; fp2 = fp2->next) { ++ if (fp2->ino == st.st_ino && fp2->dev == st.st_dev) { ++ close(fd); ++ return; ++ } ++ } ++ for (fp2 = fp; fp2 && fp2->cksum == cksum; fp2 = fp2->next) { ++ ++ if (!lstat(fp2->name, &st2) && S_ISREG(st2.st_mode) && ++ !stcmp(&st, &st2, ctl->content_only) && ++ st2.st_ino != st.st_ino && ++ st2.st_dev == st.st_dev) { ++ ++ int fd2 = open(fp2->name, O_RDONLY); ++ if (fd2 < 0) ++ continue; ++ ++ if (fstat(fd2, &st2) || !S_ISREG(st2.st_mode) ++ || st2.st_size == 0) { ++ close(fd2); ++ continue; ++ } ++ ctl->ncomp++; ++ lseek(fd, 0, SEEK_SET); ++ ++ for (fsize = st.st_size; fsize > 0; ++ fsize -= (off_t)sizeof(ctl->iobuf1)) { ++ ssize_t xsz; ++ ssize_t rsize = fsize > (ssize_t) sizeof(ctl->iobuf1) ? ++ (ssize_t) sizeof(ctl->iobuf1) : fsize; ++ ++ if ((xsz = read(fd, ctl->iobuf1, rsize)) != rsize) ++ warn(_("cannot read %s"), name); ++ else if ((xsz = read(fd2, ctl->iobuf2, rsize)) != rsize) ++ warn(_("cannot read %s"), fp2->name); ++ ++ if (xsz != rsize) { ++ close(fd); ++ close(fd2); ++ return; ++ } ++ if (memcmp(ctl->iobuf1, ctl->iobuf2, rsize)) ++ break; ++ } ++ close(fd2); ++ if (fsize > 0) ++ continue; ++ if (lstat(name, &st3)) { ++ warn(_("cannot stat %s"), name); ++ close(fd); ++ return; ++ } ++ st3.st_atime = st.st_atime; ++ if (stcmp(&st, &st3, 0)) { ++ warnx(_("file %s changed underneath us"), name); ++ close(fd); ++ return; ++ } ++ n1 = fp2->name; ++ n2 = name; ++ ++ if (!ctl->no_link) { ++ const char *suffix = ++ ".$$$___cleanit___$$$"; ++ const size_t suffixlen = strlen(suffix); ++ size_t n2len = strlen(n2); ++ struct hardlink_dynstr nam2 = { NULL, 0 }; ++ ++ growstr(&nam2, add2(n2len, suffixlen)); ++ memcpy(nam2.buf, n2, n2len); ++ memcpy(&nam2.buf[n2len], suffix, ++ suffixlen + 1); ++ /* First create a temporary link to n1 under a new name */ ++ if (link(n1, nam2.buf)) { ++ warn(_("failed to hardlink %s to %s (create temporary link as %s failed)"), ++ n1, n2, nam2.buf); ++ free(nam2.buf); ++ continue; ++ } ++ /* Then rename into place over the existing n2 */ ++ if (rename(nam2.buf, n2)) { ++ warn(_("failed to hardlink %s to %s (rename temporary link to %s failed)"), ++ n1, n2, n2); ++ /* Something went wrong, try to remove the now redundant temporary link */ ++ if (unlink(nam2.buf)) ++ warn(_("failed to remove temporary link %s"), nam2.buf); ++ free(nam2.buf); ++ continue; ++ } ++ free(nam2.buf); ++ } ++ ctl->nlinks++; ++ if (st3.st_nlink > 1) { ++ /* We actually did not save anything this time, since the link second argument ++ had some other links as well. */ ++ if (ctl->verbose > 1) ++ printf(_(" %s %s to %s\n"), ++ (ctl->no_link ? _("Would link") : _("Linked")), ++ n1, n2); ++ } else { ++ ctl->nsaved += ((st.st_size + 4095) / 4096) * 4096; ++ if (ctl->verbose > 1) ++ printf(_(" %s %s to %s, %s %jd\n"), ++ (ctl->no_link ? _("Would link") : _("Linked")), ++ n1, n2, ++ (ctl->no_link ? _("would save") : _("saved")), ++ (intmax_t)st.st_size); ++ } ++ close(fd); ++ return; ++ } ++ } ++ fp2 = xmalloc(add3(sizeof(*fp2), namelen, 1)); ++ close(fd); ++ fp2->ino = st.st_ino; ++ fp2->dev = st.st_dev; ++ fp2->cksum = cksum; ++ memcpy(fp2->name, name, namelen + 1); ++ ++ if (fp) { ++ fp2->next = fp->next; ++ fp->next = fp2; ++ } else { ++ fp2->next = hp->chain; ++ hp->chain = fp2; ++ } ++ return; ++ } ++} ++ ++int main(int argc, char **argv) ++{ ++ int ch; ++ int i; ++#ifdef HAVE_PCRE ++ int errornumber; ++ PCRE2_SIZE erroroffset; ++ pcre2_code *re = NULL; ++ PCRE2_SPTR exclude_pattern = NULL; ++ pcre2_match_data *match_data = NULL; ++#endif ++ struct hardlink_dynstr nam1 = { NULL, 0 }; ++ struct hardlink_ctl *ctl = &global_ctl; ++ ++ static const struct option longopts[] = { ++ { "content", no_argument, NULL, 'c' }, ++ { "dry-run", no_argument, NULL, 'n' }, ++ { "exclude", required_argument, NULL, 'x' }, ++ { "force", no_argument, NULL, 'f' }, ++ { "help", no_argument, NULL, 'h' }, ++ { "verbose", no_argument, NULL, 'v' }, ++ { "version", no_argument, NULL, 'V' }, ++ { NULL, 0, NULL, 0 }, ++ }; ++ ++ setlocale(LC_ALL, ""); ++ bindtextdomain(PACKAGE, LOCALEDIR); ++ textdomain(PACKAGE); ++ close_stdout_atexit(); ++ ++ while ((ch = getopt_long(argc, argv, "cnvfx:Vh", longopts, NULL)) != -1) { ++ switch (ch) { ++ case 'n': ++ ctl->no_link = 1; ++ break; ++ case 'v': ++ ctl->verbose++; ++ break; ++ case 'c': ++ ctl->content_only = 1; ++ break; ++ case 'f': ++ ctl->force = 1; ++ break; ++ case 'x': ++#ifdef HAVE_PCRE ++ exclude_pattern = (PCRE2_SPTR) optarg; ++#else ++ errx(EXIT_FAILURE, ++ _("option --exclude not supported (built without pcre2)")); ++#endif ++ break; ++ case 'V': ++ print_version(EXIT_SUCCESS); ++ case 'h': ++ usage(); ++ default: ++ errtryhelp(EXIT_FAILURE); ++ } ++ } ++ ++ if (optind == argc) { ++ warnx(_("no directory specified")); ++ errtryhelp(EXIT_FAILURE); ++ } ++ ++#ifdef HAVE_PCRE ++ if (exclude_pattern) { ++ re = pcre2_compile(exclude_pattern, /* the pattern */ ++ PCRE2_ZERO_TERMINATED, /* indicates pattern is zero-terminate */ ++ 0, /* default options */ ++ &errornumber, &erroroffset, NULL); /* use default compile context */ ++ if (!re) { ++ PCRE2_UCHAR buffer[256]; ++ pcre2_get_error_message(errornumber, buffer, ++ sizeof(buffer)); ++ errx(EXIT_FAILURE, _("pattern error at offset %d: %s"), ++ (int)erroroffset, buffer); ++ } ++ match_data = pcre2_match_data_create_from_pattern(re, NULL); ++ } ++#endif ++ atexit(print_summary); ++ ++ for (i = optind; i < argc; i++) ++ process_path(ctl, argv[i]); ++ ++ while (ctl->dirs) { ++ DIR *dh; ++ struct dirent *di; ++ struct hardlink_dir *dp = ctl->dirs; ++ size_t nam1baselen = strlen(dp->name); ++ ++ ctl->dirs = dp->next; ++ growstr(&nam1, add2(nam1baselen, 1)); ++ memcpy(nam1.buf, dp->name, nam1baselen); ++ free(dp); ++ nam1.buf[nam1baselen++] = '/'; ++ nam1.buf[nam1baselen] = 0; ++ dh = opendir(nam1.buf); ++ ++ if (dh == NULL) ++ continue; ++ ctl->ndirs++; ++ ++ while ((di = readdir(dh)) != NULL) { ++ if (!di->d_name[0]) ++ continue; ++ if (di->d_name[0] == '.') { ++ if (!di->d_name[1] || !strcmp(di->d_name, "..")) ++ continue; ++ } ++#ifdef HAVE_PCRE ++ if (re && pcre2_match(re, /* compiled regex */ ++ (PCRE2_SPTR) di->d_name, strlen(di->d_name), 0, /* start at offset 0 */ ++ 0, /* default options */ ++ match_data, /* block for storing the result */ ++ NULL) /* use default match context */ ++ >=0) { ++ if (ctl->verbose) { ++ nam1.buf[nam1baselen] = 0; ++ printf(_("Skipping %s%s\n"), nam1.buf, di->d_name); ++ } ++ continue; ++ } ++#endif ++ { ++ size_t subdirlen; ++ growstr(&nam1, ++ add2(nam1baselen, subdirlen = ++ strlen(di->d_name))); ++ memcpy(&nam1.buf[nam1baselen], di->d_name, ++ add2(subdirlen, 1)); ++ } ++ process_path(ctl, nam1.buf); ++ } ++ closedir(dh); ++ } ++ ++ return 0; ++} +diff --git a/locale/programs/xalloc.h b/locale/programs/xalloc.h +new file mode 100644 +index 0000000000..0129a85e2e +--- /dev/null ++++ b/locale/programs/xalloc.h +@@ -0,0 +1,129 @@ ++/* ++ * Copyright (C) 2010 Davidlohr Bueso <dave@gnu.org> ++ * ++ * This file may be redistributed under the terms of the ++ * GNU Lesser General Public License. ++ * ++ * General memory allocation wrappers for malloc, realloc, calloc and strdup ++ */ ++ ++#ifndef UTIL_LINUX_XALLOC_H ++#define UTIL_LINUX_XALLOC_H ++ ++#include <stdlib.h> ++#include <string.h> ++ ++#include "c.h" ++ ++#ifndef XALLOC_EXIT_CODE ++# define XALLOC_EXIT_CODE EXIT_FAILURE ++#endif ++ ++static inline void __attribute__((__noreturn__)) ++__err_oom(const char *file, unsigned int line) ++{ ++ err(XALLOC_EXIT_CODE, "%s: %u: cannot allocate memory", file, line); ++} ++ ++#define err_oom() __err_oom(__FILE__, __LINE__) ++ ++static inline __ul_alloc_size(1) __ul_returns_nonnull ++void *xmalloc(const size_t size) ++{ ++ void *ret = malloc(size); ++ ++ if (!ret && size) ++ err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size); ++ return ret; ++} ++ ++static inline __ul_alloc_size(2) __ul_returns_nonnull ++void *xrealloc(void *ptr, const size_t size) ++{ ++ void *ret = realloc(ptr, size); ++ ++ if (!ret && size) ++ err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size); ++ return ret; ++} ++ ++static inline __ul_calloc_size(1, 2) __ul_returns_nonnull ++void *xcalloc(const size_t nelems, const size_t size) ++{ ++ void *ret = calloc(nelems, size); ++ ++ if (!ret && size && nelems) ++ err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size); ++ return ret; ++} ++ ++static inline char __attribute__((warn_unused_result)) __ul_returns_nonnull ++*xstrdup(const char *str) ++{ ++ char *ret; ++ ++ if (!str) ++ return NULL; ++ ++ ret = strdup(str); ++ ++ if (!ret) ++ err(XALLOC_EXIT_CODE, "cannot duplicate string"); ++ return ret; ++} ++ ++static inline char * __attribute__((warn_unused_result)) __ul_returns_nonnull ++xstrndup(const char *str, size_t size) ++{ ++ char *ret; ++ ++ if (!str) ++ return NULL; ++ ++ ret = strndup(str, size); ++ ++ if (!ret) ++ err(XALLOC_EXIT_CODE, "cannot duplicate string"); ++ return ret; ++} ++ ++ ++static inline int __attribute__ ((__format__(printf, 2, 3))) ++ xasprintf(char **strp, const char *fmt, ...) ++{ ++ int ret; ++ va_list args; ++ va_start(args, fmt); ++ ret = vasprintf(&(*strp), fmt, args); ++ va_end(args); ++ if (ret < 0) ++ err(XALLOC_EXIT_CODE, "cannot allocate string"); ++ return ret; ++} ++ ++static inline int __attribute__ ((__format__(printf, 2, 0))) ++xvasprintf(char **strp, const char *fmt, va_list ap) ++{ ++ int ret = vasprintf(&(*strp), fmt, ap); ++ if (ret < 0) ++ err(XALLOC_EXIT_CODE, "cannot allocate string"); ++ return ret; ++} ++ ++ ++static inline char * __attribute__((warn_unused_result)) xgethostname(void) ++{ ++ char *name; ++ size_t sz = get_hostname_max() + 1; ++ ++ name = xmalloc(sizeof(char) * sz); ++ ++ if (gethostname(name, sz) != 0) { ++ free(name); ++ return NULL; ++ } ++ name[sz - 1] = '\0'; ++ return name; ++} ++ ++#endif diff --git a/external/poky/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-to-build.patch b/external/poky/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-to-build.patch new file mode 100644 index 00000000..d6652981 --- /dev/null +++ b/external/poky/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-to-build.patch @@ -0,0 +1,52 @@ +From 56ae260ac24ade94e2e0e77c81751312372d253f Mon Sep 17 00:00:00 2001 +From: Jason Wessel <jason.wessel@windriver.com> +Date: Sat, 7 Dec 2019 09:56:23 -0800 +Subject: [PATCH] localedef: Add hardlink resolver to build + +The sourcecode for this is imported from util-linux and is kept with +glibc sources + +Upstream-Status: Pending +Signed-off-by: Jason Wessel <jason.wessel@windriver.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + Makefile.in | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/Makefile.in b/Makefile.in +index 77fbded..a87e5b2 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -40,6 +40,8 @@ WARNFLAGS = -Wall -Wno-format + FULLCC = $(CC) $(CPPFLAGS) $(CFLAGS) \ + $(DEFINES) $(INCLUDES) $(WARNFLAGS) + ++CROSS_LOCALEDEF_HARDLINK_OBJS = cross-localedef-hardlink.o ++ + LOCALEDEF_OBJS = charmap.o charmap-dir.o ld-address.o ld-collate.o \ + ld-ctype.o ld-identification.o ld-measurement.o \ + ld-messages.o ld-monetary.o ld-name.o ld-numeric.o \ +@@ -54,11 +56,14 @@ LOCALEDEF_OBJS = charmap.o charmap-dir.o ld-address.o ld-collate.o \ + asprintf.o getdelim.o localedef_extra.o \ + obstack_printf.o vasprintf.o + +-all: localedef$(EXEEXT) ++all: localedef$(EXEEXT) cross-localedef-hardlink$(EXEEXT) + + localedef$(EXEEXT): $(LOCALEDEF_OBJS) + $(CC) -o $@ $(LOCALEDEF_OBJS) $(LIBS) + ++cross-localedef-hardlink$(EXEEXT): $(CROSS_LOCALEDEF_HARDLINK_OBJS) ++ $(CC) -o $@ $(CROSS_LOCALEDEF_HARDLINK_OBJS) $(LIBS) ++ + clean: + rm -f locale$(EXEEXT) $(LOCALEDEF_OBJS) + +@@ -77,6 +82,7 @@ clean: + %.o: $(srcdir)/%.c + $(FULLCC) -c -o $@ $< + ++cross-localedef-hardlink.o: glibc/locale/programs/cross-localedef-hardlink.c + charmap.o: glibc/locale/programs/charmap.c + charmap-dir.o: glibc/locale/programs/charmap-dir.c + ld-address.o: glibc/locale/programs/ld-address.c diff --git a/external/poky/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch b/external/poky/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch new file mode 100644 index 00000000..5222e37d --- /dev/null +++ b/external/poky/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch @@ -0,0 +1,238 @@ +From b52dba15527380cc18635e3696e0ef87efee9a84 Mon Sep 17 00:00:00 2001 +From: Jason Wessel <jason.wessel@windriver.com> +Date: Sat, 7 Dec 2019 10:01:37 -0800 +Subject: [PATCH] localedef: fix-ups hardlink to make it compile + +Upstream-Status: Pending +Signed-off-by: Jason Wessel <jason.wessel@windriver.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + locale/programs/c.h | 2 +- + locale/programs/cross-localedef-hardlink.c | 79 +++++++++++----------- + 2 files changed, 39 insertions(+), 42 deletions(-) + +diff --git a/locale/programs/c.h b/locale/programs/c.h +index d0a402e90e..1804d31c73 100644 +--- a/locale/programs/c.h ++++ b/locale/programs/c.h +@@ -240,7 +240,7 @@ errmsg(char doexit, int excode, char adderr, const char *fmt, ...) + /* Don't use inline function to avoid '#include "nls.h"' in c.h + */ + #define errtryhelp(eval) __extension__ ({ \ +- fprintf(stderr, _("Try '%s --help' for more information.\n"), \ ++ fprintf(stderr, ("Try '%s --help' for more information.\n"), \ + program_invocation_short_name); \ + exit(eval); \ + }) +diff --git a/locale/programs/cross-localedef-hardlink.c b/locale/programs/cross-localedef-hardlink.c +index 63615896b0..726e6dd948 100644 +--- a/locale/programs/cross-localedef-hardlink.c ++++ b/locale/programs/cross-localedef-hardlink.c +@@ -20,6 +20,8 @@ + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ ++ ++#undef HAVE_PCRE + #include <sys/types.h> + #include <stdlib.h> + #include <getopt.h> +@@ -38,8 +40,8 @@ + + #include "c.h" + #include "xalloc.h" +-#include "nls.h" +-#include "closestream.h" ++//#include "nls.h" ++//#include "closestream.h" + + #define NHASH (1<<17) /* Must be a power of 2! */ + #define NBUF 64 +@@ -124,33 +126,33 @@ static void print_summary(void) + if (ctl->verbose > 1 && ctl->nlinks) + fputc('\n', stdout); + +- printf(_("Directories: %9lld\n"), ctl->ndirs); +- printf(_("Objects: %9lld\n"), ctl->nobjects); +- printf(_("Regular files: %9lld\n"), ctl->nregfiles); +- printf(_("Comparisons: %9lld\n"), ctl->ncomp); ++ printf(("Directories: %9lld\n"), ctl->ndirs); ++ printf(("Objects: %9lld\n"), ctl->nobjects); ++ printf(("Regular files: %9lld\n"), ctl->nregfiles); ++ printf(("Comparisons: %9lld\n"), ctl->ncomp); + printf( "%s%9lld\n", (ctl->no_link ? +- _("Would link: ") : +- _("Linked: ")), ctl->nlinks); ++ ("Would link: ") : ++ ("Linked: ")), ctl->nlinks); + printf( "%s %9lld\n", (ctl->no_link ? +- _("Would save: ") : +- _("Saved: ")), ctl->nsaved); ++ ("Would save: ") : ++ ("Saved: ")), ctl->nsaved); + } + + static void __attribute__((__noreturn__)) usage(void) + { + fputs(USAGE_HEADER, stdout); +- printf(_(" %s [options] directory...\n"), program_invocation_short_name); ++ printf((" %s [options] directory...\n"), program_invocation_short_name); + + fputs(USAGE_SEPARATOR, stdout); +- puts(_("Consolidate duplicate files using hardlinks.")); ++ puts(("Consolidate duplicate files using hardlinks.")); + + fputs(USAGE_OPTIONS, stdout); +- puts(_(" -c, --content compare only contents, ignore permission, etc.")); +- puts(_(" -n, --dry-run don't actually link anything")); +- puts(_(" -v, --verbose print summary after hardlinking")); +- puts(_(" -vv print every hardlinked file and summary")); +- puts(_(" -f, --force force hardlinking across filesystems")); +- puts(_(" -x, --exclude <regex> exclude files matching pattern")); ++ puts((" -c, --content compare only contents, ignore permission, etc.")); ++ puts((" -n, --dry-run don't actually link anything")); ++ puts((" -v, --verbose print summary after hardlinking")); ++ puts((" -vv print every hardlinked file and summary")); ++ puts((" -f, --force force hardlinking across filesystems")); ++ puts((" -x, --exclude <regex> exclude files matching pattern")); + + fputs(USAGE_SEPARATOR, stdout); + printf(USAGE_HELP_OPTIONS(16)); /* char offset to align option descriptions */ +@@ -164,7 +166,7 @@ static inline size_t add2(size_t a, size_t b) + size_t sum = a + b; + + if (sum < a) +- errx(EXIT_FAILURE, _("integer overflow")); ++ errx(EXIT_FAILURE, ("integer overflow")); + return sum; + } + +@@ -193,7 +195,7 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) + if (st.st_dev != ctl->dev && !ctl->force) { + if (ctl->dev) + errx(EXIT_FAILURE, +- _("%s is on different filesystem than the rest " ++ ("%s is on different filesystem than the rest " + "(use -f option to override)."), name); + ctl->dev = st.st_dev; + } +@@ -287,9 +289,9 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) + (ssize_t) sizeof(ctl->iobuf1) : fsize; + + if ((xsz = read(fd, ctl->iobuf1, rsize)) != rsize) +- warn(_("cannot read %s"), name); ++ warn(("cannot read %s"), name); + else if ((xsz = read(fd2, ctl->iobuf2, rsize)) != rsize) +- warn(_("cannot read %s"), fp2->name); ++ warn(("cannot read %s"), fp2->name); + + if (xsz != rsize) { + close(fd); +@@ -303,13 +305,13 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) + if (fsize > 0) + continue; + if (lstat(name, &st3)) { +- warn(_("cannot stat %s"), name); ++ warn(("cannot stat %s"), name); + close(fd); + return; + } + st3.st_atime = st.st_atime; + if (stcmp(&st, &st3, 0)) { +- warnx(_("file %s changed underneath us"), name); ++ warnx(("file %s changed underneath us"), name); + close(fd); + return; + } +@@ -329,18 +331,18 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) + suffixlen + 1); + /* First create a temporary link to n1 under a new name */ + if (link(n1, nam2.buf)) { +- warn(_("failed to hardlink %s to %s (create temporary link as %s failed)"), ++ warn(("failed to hardlink %s to %s (create temporary link as %s failed)"), + n1, n2, nam2.buf); + free(nam2.buf); + continue; + } + /* Then rename into place over the existing n2 */ + if (rename(nam2.buf, n2)) { +- warn(_("failed to hardlink %s to %s (rename temporary link to %s failed)"), ++ warn(("failed to hardlink %s to %s (rename temporary link to %s failed)"), + n1, n2, n2); + /* Something went wrong, try to remove the now redundant temporary link */ + if (unlink(nam2.buf)) +- warn(_("failed to remove temporary link %s"), nam2.buf); ++ warn(("failed to remove temporary link %s"), nam2.buf); + free(nam2.buf); + continue; + } +@@ -351,16 +353,16 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) + /* We actually did not save anything this time, since the link second argument + had some other links as well. */ + if (ctl->verbose > 1) +- printf(_(" %s %s to %s\n"), +- (ctl->no_link ? _("Would link") : _("Linked")), ++ printf((" %s %s to %s\n"), ++ (ctl->no_link ? ("Would link") : ("Linked")), + n1, n2); + } else { + ctl->nsaved += ((st.st_size + 4095) / 4096) * 4096; + if (ctl->verbose > 1) +- printf(_(" %s %s to %s, %s %jd\n"), +- (ctl->no_link ? _("Would link") : _("Linked")), ++ printf((" %s %s to %s, %s %jd\n"), ++ (ctl->no_link ? ("Would link") : ("Linked")), + n1, n2, +- (ctl->no_link ? _("would save") : _("saved")), ++ (ctl->no_link ? ("would save") : ("saved")), + (intmax_t)st.st_size); + } + close(fd); +@@ -410,11 +412,6 @@ int main(int argc, char **argv) + { NULL, 0, NULL, 0 }, + }; + +- setlocale(LC_ALL, ""); +- bindtextdomain(PACKAGE, LOCALEDIR); +- textdomain(PACKAGE); +- close_stdout_atexit(); +- + while ((ch = getopt_long(argc, argv, "cnvfx:Vh", longopts, NULL)) != -1) { + switch (ch) { + case 'n': +@@ -434,7 +431,7 @@ int main(int argc, char **argv) + exclude_pattern = (PCRE2_SPTR) optarg; + #else + errx(EXIT_FAILURE, +- _("option --exclude not supported (built without pcre2)")); ++ ("option --exclude not supported (built without pcre2)")); + #endif + break; + case 'V': +@@ -447,7 +444,7 @@ int main(int argc, char **argv) + } + + if (optind == argc) { +- warnx(_("no directory specified")); ++ warnx(("no directory specified")); + errtryhelp(EXIT_FAILURE); + } + +@@ -461,7 +458,7 @@ int main(int argc, char **argv) + PCRE2_UCHAR buffer[256]; + pcre2_get_error_message(errornumber, buffer, + sizeof(buffer)); +- errx(EXIT_FAILURE, _("pattern error at offset %d: %s"), ++ errx(EXIT_FAILURE, ("pattern error at offset %d: %s"), + (int)erroroffset, buffer); + } + match_data = pcre2_match_data_create_from_pattern(re, NULL); +@@ -506,7 +503,7 @@ int main(int argc, char **argv) + >=0) { + if (ctl->verbose) { + nam1.buf[nam1baselen] = 0; +- printf(_("Skipping %s%s\n"), nam1.buf, di->d_name); ++ printf(("Skipping %s%s\n"), nam1.buf, di->d_name); + } + continue; + } diff --git a/external/poky/meta/recipes-core/glibc/glibc/0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch b/external/poky/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch index 5df26a85..4cdc8354 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch @@ -1,4 +1,4 @@ -From bd51b3add89a5cb2d8f44029a1027c780b2afff5 Mon Sep 17 00:00:00 2001 +From 6987ad183770cb56680ccc4f6ea065a04f31ccb6 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 18 Mar 2015 01:48:24 +0000 Subject: [PATCH] nativesdk-glibc: Look for host system ld.so.cache as well @@ -30,10 +30,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/elf/dl-load.c b/elf/dl-load.c -index c51e4b3718..44bbb69dc4 100644 +index a6b80f9395..3226f2e531 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c -@@ -2085,6 +2085,14 @@ _dl_map_object (struct link_map *loader, const char *name, +@@ -2073,6 +2073,14 @@ _dl_map_object (struct link_map *loader, const char *name, } } @@ -48,7 +48,7 @@ index c51e4b3718..44bbb69dc4 100644 #ifdef USE_LDCONFIG if (fd == -1 && (__glibc_likely ((mode & __RTLD_SECURE) == 0) -@@ -2143,14 +2151,6 @@ _dl_map_object (struct link_map *loader, const char *name, +@@ -2131,14 +2139,6 @@ _dl_map_object (struct link_map *loader, const char *name, } #endif diff --git a/external/poky/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch b/external/poky/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch deleted file mode 100644 index 1ae2e33b..00000000 --- a/external/poky/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch +++ /dev/null @@ -1,31 +0,0 @@ -From a237553ccd15276462be2023057a017fa8ee5d7c Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Thu, 31 Dec 2015 14:35:35 -0800 -Subject: [PATCH] nativesdk-glibc: Allow 64 bit atomics for x86 - -The fix consist of allowing 64bit atomic ops for x86. -This should be safe for i586 and newer CPUs. -It also makes the synchronization more efficient. - -Upstream-Status: Inappropriate [OE-Specific] - -Signed-off-by: Juro Bystricky <juro.bystricky@intel.com> -Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - sysdeps/i386/atomic-machine.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sysdeps/i386/atomic-machine.h b/sysdeps/i386/atomic-machine.h -index 272da5dd8f..409c759f14 100644 ---- a/sysdeps/i386/atomic-machine.h -+++ b/sysdeps/i386/atomic-machine.h -@@ -54,7 +54,7 @@ typedef uintmax_t uatomic_max_t; - # endif - #endif - --#define __HAVE_64B_ATOMICS 0 -+#define __HAVE_64B_ATOMICS 1 - #define USE_ATOMIC_COMPILER_BUILTINS 0 - #define ATOMIC_EXCHANGE_USES_CAS 0 - diff --git a/external/poky/meta/recipes-core/glibc/glibc/0002-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch b/external/poky/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch index daadec76..62e12897 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0002-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch @@ -1,4 +1,4 @@ -From fdc8a33ac2c81a0237b8a6d8b1aac7f1cdbb46af Mon Sep 17 00:00:00 2001 +From 7806340c2accc2c51e7e861b618c29fb5609a007 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 18 Mar 2015 01:50:00 +0000 Subject: [PATCH] nativesdk-glibc: Fix buffer overrun with a relocated SDK @@ -21,10 +21,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> 1 file changed, 12 insertions(+) diff --git a/elf/dl-load.c b/elf/dl-load.c -index 44bbb69dc4..74e2e5e962 100644 +index 3226f2e531..7cb8a86fab 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c -@@ -1785,7 +1785,19 @@ open_path (const char *name, size_t namelen, int mode, +@@ -1773,7 +1773,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/external/poky/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch b/external/poky/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch index e0825403..294c2b97 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch @@ -1,4 +1,4 @@ -From 055dd46b793168fb08e44913153010b088011ba2 Mon Sep 17 00:00:00 2001 +From 1b97befbe693eb93a77b6098f6ae1394a53462f4 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 18 Mar 2015 01:51:38 +0000 Subject: [PATCH] nativesdk-glibc: Raise the size of arrays containing dl paths @@ -25,7 +25,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/elf/dl-cache.c b/elf/dl-cache.c -index 6ee5153ff9..37a5f701fa 100644 +index 3eedd9afcf..efdfe5cae7 100644 --- a/elf/dl-cache.c +++ b/elf/dl-cache.c @@ -133,6 +133,10 @@ do \ @@ -40,7 +40,7 @@ index 6ee5153ff9..37a5f701fa 100644 _dl_cache_libcmp (const char *p1, const char *p2) { diff --git a/elf/dl-load.c b/elf/dl-load.c -index 74e2e5e962..8f19186e1c 100644 +index 7cb8a86fab..e32d4aa936 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -110,8 +110,8 @@ static size_t max_capstrlen attribute_relro; @@ -55,7 +55,7 @@ index 74e2e5e962..8f19186e1c 100644 SYSTEM_DIRS_LEN }; diff --git a/elf/interp.c b/elf/interp.c -index 9cd50c7291..fc2f39d73c 100644 +index 331cc1df48..885b2d9476 100644 --- a/elf/interp.c +++ b/elf/interp.c @@ -18,5 +18,5 @@ @@ -66,7 +66,7 @@ index 9cd50c7291..fc2f39d73c 100644 +const char __invoke_dynamic_linker__[4096] __attribute__ ((section (".interp"))) = RUNTIME_LINKER; diff --git a/elf/ldconfig.c b/elf/ldconfig.c -index fbdd814edf..9f4d8d69b1 100644 +index 681ed78496..8833ed0a6b 100644 --- a/elf/ldconfig.c +++ b/elf/ldconfig.c @@ -168,6 +168,9 @@ static struct argp argp = @@ -80,10 +80,10 @@ index fbdd814edf..9f4d8d69b1 100644 a platform. */ static int diff --git a/elf/rtld.c b/elf/rtld.c -index 1b0c74739f..a70a62d31e 100644 +index 553cfbd1b7..39347c2c03 100644 --- a/elf/rtld.c +++ b/elf/rtld.c -@@ -130,6 +130,7 @@ dso_name_valid_for_suid (const char *p) +@@ -175,6 +175,7 @@ dso_name_valid_for_suid (const char *p) } return *p != '\0'; } @@ -91,7 +91,7 @@ index 1b0c74739f..a70a62d31e 100644 /* LD_AUDIT variable contents. Must be processed before the audit_list below. */ -@@ -1001,12 +1002,12 @@ of this helper program; chances are you did not intend to run this program.\n\ +@@ -1222,13 +1223,13 @@ of this helper program; chances are you did not intend to run this program.\n\ --list list all dependencies and how they are resolved\n\ --verify verify that given object really is a dynamically linked\n\ object we can handle\n\ @@ -101,13 +101,14 @@ index 1b0c74739f..a70a62d31e 100644 variable LD_LIBRARY_PATH\n\ --inhibit-rpath LIST ignore RUNPATH and RPATH information in object names\n\ in LIST\n\ -- --audit LIST use objects named in LIST as auditors\n"); -+ --audit LIST use objects named in LIST as auditors\n", LD_SO_CACHE); + --audit LIST use objects named in LIST as auditors\n\ +- --preload LIST preload objects named in LIST\n"); ++ --preload LIST preload objects named in LIST\n", LD_SO_CACHE); ++_dl_skip_args; --_dl_argc; diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c -index f173cde71b..5c3205026f 100644 +index 735bd1f2d5..25100ba666 100644 --- a/iconv/gconv_conf.c +++ b/iconv/gconv_conf.c @@ -36,7 +36,7 @@ @@ -117,10 +118,10 @@ index f173cde71b..5c3205026f 100644 -static const char default_gconv_path[] = GCONV_PATH; +static char default_gconv_path[4096] __attribute__ ((section (".gccrelocprefix"))) = GCONV_PATH; - /* The path elements, as determined by the __gconv_get_path function. - All path elements end in a slash. */ + /* Type to represent search path. */ + struct path_elem diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h -index cf43f1cf3b..7f07adde53 100644 +index 6b310e9e15..3877311df4 100644 --- a/sysdeps/generic/dl-cache.h +++ b/sysdeps/generic/dl-cache.h @@ -27,10 +27,6 @@ diff --git a/external/poky/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch b/external/poky/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch new file mode 100644 index 00000000..db8b6c0f --- /dev/null +++ b/external/poky/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch @@ -0,0 +1,39 @@ +From a752857cc342ee5136c9a593037b6ee6ff8af8ee Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Thu, 31 Dec 2015 14:35:35 -0800 +Subject: [PATCH] nativesdk-glibc: Allow 64 bit atomics for x86 + +The fix consist of allowing 64bit atomic ops for x86. +This should be safe for i586 and newer CPUs. +It also makes the synchronization more efficient. + +Upstream-Status: Inappropriate [OE-Specific] + +Signed-off-by: Juro Bystricky <juro.bystricky@intel.com> +Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + sysdeps/x86/atomic-machine.h | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h +index bb49648374..aa08d3c0a7 100644 +--- a/sysdeps/x86/atomic-machine.h ++++ b/sysdeps/x86/atomic-machine.h +@@ -58,15 +58,14 @@ typedef uintmax_t uatomic_max_t; + #endif + + #define USE_ATOMIC_COMPILER_BUILTINS 1 ++# define __HAVE_64B_ATOMICS 1 + + #ifdef __x86_64__ +-# define __HAVE_64B_ATOMICS 1 + # define SP_REG "rsp" + # define SEG_REG "fs" + # define BR_CONSTRAINT "q" + # define IBR_CONSTRAINT "iq" + #else +-# define __HAVE_64B_ATOMICS 0 + # define SP_REG "esp" + # define SEG_REG "gs" + # define BR_CONSTRAINT "r" diff --git a/external/poky/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Make-relocatable-install-for-locales.patch b/external/poky/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch index b53f2ef2..27cd17cd 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Make-relocatable-install-for-locales.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch @@ -1,4 +1,4 @@ -From e1dc85af1800afa4fbf4eb5a59cc41025495af57 Mon Sep 17 00:00:00 2001 +From 3df91d1d8b9c7a01b3ef8133c4f9b9764227d583 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Fri, 3 Aug 2018 09:55:12 -0700 Subject: [PATCH] nativesdk-glibc: Make relocatable install for locales @@ -17,11 +17,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> locale/localeinfo.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) -diff --git a/locale/findlocale.c b/locale/findlocale.c -index 872cadb5b9..dd651e07f5 100644 ---- a/locale/findlocale.c -+++ b/locale/findlocale.c -@@ -56,7 +56,7 @@ struct __locale_data *const _nl_C[] attribute_hidden = +Index: git/locale/findlocale.c +=================================================================== +--- git.orig/locale/findlocale.c ++++ git/locale/findlocale.c +@@ -56,7 +56,7 @@ struct __locale_data *const _nl_C[] attr which are somehow addressed. */ struct loaded_l10nfile *_nl_locale_file_list[__LC_LAST]; @@ -30,7 +30,7 @@ index 872cadb5b9..dd651e07f5 100644 /* Checks if the name is actually present, that is, not NULL and not empty. */ -@@ -167,7 +167,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len, +@@ -166,7 +166,7 @@ _nl_find_locale (const char *locale_path /* Nothing in the archive. Set the default path to search below. */ locale_path = _nl_default_locale_path; @@ -39,10 +39,10 @@ index 872cadb5b9..dd651e07f5 100644 } else /* We really have to load some data. First see whether the name is -diff --git a/locale/loadarchive.c b/locale/loadarchive.c -index 516d30d8d1..9bfbe1a5dd 100644 ---- a/locale/loadarchive.c -+++ b/locale/loadarchive.c +Index: git/locale/loadarchive.c +=================================================================== +--- git.orig/locale/loadarchive.c ++++ git/locale/loadarchive.c @@ -42,7 +42,7 @@ @@ -52,11 +52,11 @@ index 516d30d8d1..9bfbe1a5dd 100644 /* Size of initial mapping window, optimal if large enough to cover the header plus the initial locale. */ -diff --git a/locale/localeinfo.h b/locale/localeinfo.h -index 68822a6319..537bc35149 100644 ---- a/locale/localeinfo.h -+++ b/locale/localeinfo.h -@@ -325,7 +325,7 @@ _nl_lookup_word (locale_t l, int category, int item) +Index: git/locale/localeinfo.h +=================================================================== +--- git.orig/locale/localeinfo.h ++++ git/locale/localeinfo.h +@@ -331,7 +331,7 @@ _nl_lookup_word (locale_t l, int categor } /* Default search path if no LOCPATH environment variable. */ @@ -65,3 +65,35 @@ index 68822a6319..537bc35149 100644 /* Load the locale data for CATEGORY from the file specified by *NAME. If *NAME is "", use environment variables as specified by POSIX, and +Index: git/locale/programs/locale.c +=================================================================== +--- git.orig/locale/programs/locale.c ++++ git/locale/programs/locale.c +@@ -632,6 +632,7 @@ nameentcmp (const void *a, const void *b + ((const struct nameent *) b)->name); + } + ++static char _write_archive_locales_path[4096] attribute_hidden __attribute__ ((section (".gccrelocprefix"))) = ARCHIVE_NAME; + + static int + write_archive_locales (void **all_datap, char *linebuf) +@@ -645,7 +646,7 @@ write_archive_locales (void **all_datap, + int fd, ret = 0; + uint32_t cnt; + +- fd = open64 (ARCHIVE_NAME, O_RDONLY); ++ fd = open64 (_write_archive_locales_path, O_RDONLY); + if (fd < 0) + return 0; + +@@ -700,8 +701,8 @@ write_archive_locales (void **all_datap, + if (cnt) + putchar_unlocked ('\n'); + +- printf ("locale: %-15.15s archive: " ARCHIVE_NAME "\n%s\n", +- names[cnt].name, linebuf); ++ printf ("locale: %-15.15s archive: %s\n%s\n", ++ names[cnt].name, _write_archive_locales_path, linebuf); + + locrec = (struct locrecent *) (addr + names[cnt].locrec_offset); + diff --git a/external/poky/meta/recipes-core/glibc/glibc/0006-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch b/external/poky/meta/recipes-core/glibc/glibc/0008-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch index 971700a6..3dac3253 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0006-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0008-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch @@ -1,4 +1,4 @@ -From d23c577b0b70b34335971abaf3f50e617dda615e Mon Sep 17 00:00:00 2001 +From 61b6c9737897c5828ef4b40699ee0a74c570034a Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 18 Mar 2015 00:01:50 +0000 Subject: [PATCH] fsl e500/e5500/e6500/603e fsqrt implementation diff --git a/external/poky/meta/recipes-core/glibc/glibc/0007-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch b/external/poky/meta/recipes-core/glibc/glibc/0009-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch index 48713468..456f91fb 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0007-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0009-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch @@ -1,4 +1,4 @@ -From d65f6ee214d7d91445fceabc6a5d6bf55b0e8d4b Mon Sep 17 00:00:00 2001 +From 13beb1f428ec06778590bf526d6e641f73d5cf62 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 18 Mar 2015 00:11:22 +0000 Subject: [PATCH] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known names @@ -16,7 +16,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> 1 file changed, 1 insertion(+) diff --git a/elf/readlib.c b/elf/readlib.c -index 573c01476c..d8c7412287 100644 +index 994a4426a1..baabf099b1 100644 --- a/elf/readlib.c +++ b/elf/readlib.c @@ -51,6 +51,7 @@ static struct known_names interpreters[] = diff --git a/external/poky/meta/recipes-core/glibc/glibc/0008-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch b/external/poky/meta/recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch index c0d96eb1..01446abc 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0008-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch @@ -1,4 +1,4 @@ -From ee3aa1464f40c916c62cf326bf4c18f8b71a229b Mon Sep 17 00:00:00 2001 +From 4483a83074a340a921e319b88d72166f18e0df0b Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 18 Mar 2015 00:15:07 +0000 Subject: [PATCH] ppc/sqrt: Fix undefined reference to `__sqrt_finite' diff --git a/external/poky/meta/recipes-core/glibc/glibc/0009-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch b/external/poky/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch index d0b47cd6..451f3726 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0009-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch @@ -1,4 +1,4 @@ -From 17e82d594b2d8d3a6998face953382f9d14fb046 Mon Sep 17 00:00:00 2001 +From 347b2e31d010b04c42e78157a028aa1d58fe0f5e Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 18 Mar 2015 00:16:38 +0000 Subject: [PATCH] __ieee754_sqrt{,f} are now inline functions and call out diff --git a/external/poky/meta/recipes-core/glibc/glibc/0010-Quote-from-bug-1443-which-explains-what-the-patch-do.patch b/external/poky/meta/recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch index 86ef3a10..a0b46c04 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0010-Quote-from-bug-1443-which-explains-what-the-patch-do.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch @@ -1,4 +1,4 @@ -From fe8d9b76e7c881cc0a0b728ea2bd637fafca0978 Mon Sep 17 00:00:00 2001 +From 8ca8e5cd78cbd37a713e1181f8f6641b57352aa8 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 18 Mar 2015 00:20:09 +0000 Subject: [PATCH] Quote from bug 1443 which explains what the patch does : @@ -44,7 +44,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h -index 1a4fd3f17b..a02c47571a 100644 +index 90856779b1..a29bb86c56 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -510,7 +510,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, diff --git a/external/poky/meta/recipes-core/glibc/glibc/0011-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch b/external/poky/meta/recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch index 32aae5cd..736de8cf 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0011-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch @@ -1,4 +1,4 @@ -From 3012cb839a64e7d5c621efa79b643d169290e6e9 Mon Sep 17 00:00:00 2001 +From 21509735678990760d5ebf9d0c65efa4b52b838d Mon Sep 17 00:00:00 2001 From: Ting Liu <b28495@freescale.com> Date: Wed, 19 Dec 2012 04:39:57 -0600 Subject: [PATCH] eglibc: run libm-err-tab.pl with specific dirs in ${S} @@ -18,16 +18,16 @@ Signed-off-by: Ting Liu <b28495@freescale.com> 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manual/Makefile b/manual/Makefile -index c2756640a7..1b5bb16a96 100644 +index c61e11dcd7..5d859e6f84 100644 --- a/manual/Makefile +++ b/manual/Makefile -@@ -102,7 +102,8 @@ $(objpfx)libm-err.texi: $(objpfx)stamp-libm-err - $(objpfx)stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\ - $(dir)/libm-test-ulps)) +@@ -103,7 +103,8 @@ $(objpfx)stamp-libm-err: $(..)math/gen-libm-test.py \ + $(wildcard $(foreach dir,$(sysdirs),\ + $(dir)/libm-test-ulps)) pwd=`pwd`; \ -- $(PERL) $< $$pwd/.. > $(objpfx)libm-err-tmp -+ $(PERL) $< $$pwd/../ports > $(objpfx)libm-err-tmp -+ $(PERL) $< $$pwd/../sysdeps >> $(objpfx)libm-err-tmp +- $(PYTHON) $< -s $$pwd/.. -m $(objpfx)libm-err-tmp ++ $(PYTHON) $< -s $$pwd/../ports -m $(objpfx)libm-err-tmp ++ $(PYTHON) $< -s $$pwd/../sysdeps -m $(objpfx)libm-err-tmp $(move-if-change) $(objpfx)libm-err-tmp $(objpfx)libm-err.texi touch $@ diff --git a/external/poky/meta/recipes-core/glibc/glibc/0014-Add-unused-attribute.patch b/external/poky/meta/recipes-core/glibc/glibc/0014-Add-unused-attribute.patch deleted file mode 100644 index 9d6ab30e..00000000 --- a/external/poky/meta/recipes-core/glibc/glibc/0014-Add-unused-attribute.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 2ce5bc6da23dcb402afdeb967fa44c39eecf6d37 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Wed, 18 Mar 2015 00:28:41 +0000 -Subject: [PATCH] Add unused attribute - -Helps in avoiding gcc warning when header is is included in -a source file which does not use both functions - - * iconv/gconv_charset.h (strip): - Add unused attribute. - -Signed-off-by: Khem Raj <raj.khem@gmail.com> - -Upstream-Status: Pending ---- - iconv/gconv_charset.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/iconv/gconv_charset.h b/iconv/gconv_charset.h -index 123e2a62ce..63cc83ec84 100644 ---- a/iconv/gconv_charset.h -+++ b/iconv/gconv_charset.h -@@ -21,7 +21,7 @@ - #include <locale.h> - - --static void -+static void __attribute__ ((unused)) - strip (char *wp, const char *s) - { - int slash_count = 0; diff --git a/external/poky/meta/recipes-core/glibc/glibc/0012-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch b/external/poky/meta/recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch index 93395c38..e73b640c 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0012-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch @@ -1,4 +1,4 @@ -From 93ab69ae4c98303929ba9492130a021fa4a215be Mon Sep 17 00:00:00 2001 +From e33deb119734ef443ef44c42a00a569f90e1e149 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 18 Mar 2015 00:24:46 +0000 Subject: [PATCH] __ieee754_sqrt{,f} are now inline functions and call out diff --git a/external/poky/meta/recipes-core/glibc/glibc/0013-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch b/external/poky/meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch index 9998691f..0cdd0567 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0013-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch @@ -1,4 +1,4 @@ -From a7bd8aa65f3f2755d6dbd0d5adbfd269c1fb0094 Mon Sep 17 00:00:00 2001 +From c50cae36e90c41849301a9a668adf31e81e43a07 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 18 Mar 2015 00:27:10 +0000 Subject: [PATCH] sysdeps/gnu/configure.ac: handle correctly diff --git a/external/poky/meta/recipes-core/glibc/glibc/0015-yes-within-the-path-sets-wrong-config-variables.patch b/external/poky/meta/recipes-core/glibc/glibc/0017-yes-within-the-path-sets-wrong-config-variables.patch index 0267e7a4..49089af4 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0015-yes-within-the-path-sets-wrong-config-variables.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0017-yes-within-the-path-sets-wrong-config-variables.patch @@ -1,4 +1,4 @@ -From b382138c41ccf6079b44592f1e74f183ca8281bb Mon Sep 17 00:00:00 2001 +From c421cd7e885497a99179b982dc4a27e8405f8857 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 18 Mar 2015 00:31:06 +0000 Subject: [PATCH] 'yes' within the path sets wrong config variables @@ -165,7 +165,7 @@ index f05f43802b..dc8639902d 100644 ], libc_cv_nios2_be=yes, libc_cv_nios2_be=no)]) if test $libc_cv_nios2_be = yes; then diff --git a/sysdeps/unix/sysv/linux/mips/configure b/sysdeps/unix/sysv/linux/mips/configure -index 1ee7f41a36..77e38bebde 100644 +index 25f98e0c7b..e95bfae359 100644 --- a/sysdeps/unix/sysv/linux/mips/configure +++ b/sysdeps/unix/sysv/linux/mips/configure @@ -414,11 +414,11 @@ else @@ -183,7 +183,7 @@ index 1ee7f41a36..77e38bebde 100644 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 9147aa4582..7898e24738 100644 +index 3db1b32b08..f8cd375ebc 100644 --- a/sysdeps/unix/sysv/linux/mips/configure.ac +++ b/sysdeps/unix/sysv/linux/mips/configure.ac @@ -105,9 +105,9 @@ AC_COMPILE_IFELSE( diff --git a/external/poky/meta/recipes-core/glibc/glibc/0016-timezone-re-written-tzselect-as-posix-sh.patch b/external/poky/meta/recipes-core/glibc/glibc/0018-timezone-re-written-tzselect-as-posix-sh.patch index 15453ec6..20b0ee98 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0016-timezone-re-written-tzselect-as-posix-sh.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0018-timezone-re-written-tzselect-as-posix-sh.patch @@ -1,4 +1,4 @@ -From 04fb7b93dc40c1f96ebc05d29a2f02f9e4f0d572 Mon Sep 17 00:00:00 2001 +From 2023d88c355b8af6458c8e39ce38b75c1ca4ea2a Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 18 Mar 2015 00:33:03 +0000 Subject: [PATCH] timezone: re-written tzselect as posix sh @@ -15,7 +15,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/timezone/Makefile b/timezone/Makefile -index 0194aba4a1..58e5405a05 100644 +index 75f38df527..74e1ab7ff7 100644 --- a/timezone/Makefile +++ b/timezone/Makefile @@ -122,7 +122,7 @@ $(testdata)/XT%: testdata/XT% @@ -28,10 +28,10 @@ index 0194aba4a1..58e5405a05 100644 -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \ -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \ diff --git a/timezone/tzselect.ksh b/timezone/tzselect.ksh -index d2c3a6d1dd..089679f306 100755 +index 18fce27e24..70745f9d36 100755 --- a/timezone/tzselect.ksh +++ b/timezone/tzselect.ksh -@@ -35,7 +35,7 @@ REPORT_BUGS_TO=tz@iana.org +@@ -34,7 +34,7 @@ REPORT_BUGS_TO=tz@iana.org # Specify default values for environment variables if they are unset. : ${AWK=awk} diff --git a/external/poky/meta/recipes-core/glibc/glibc/0017-Remove-bash-dependency-for-nscd-init-script.patch b/external/poky/meta/recipes-core/glibc/glibc/0019-Remove-bash-dependency-for-nscd-init-script.patch index 06d2cd1d..1c15a513 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0017-Remove-bash-dependency-for-nscd-init-script.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0019-Remove-bash-dependency-for-nscd-init-script.patch @@ -1,4 +1,4 @@ -From 7a2f244c0980a54ed74f9544ab44a7269ef12bce Mon Sep 17 00:00:00 2001 +From 06da20d9f89907e5f2777537244e6589ca3c9703 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Thu, 31 Dec 2015 14:33:02 -0800 Subject: [PATCH] Remove bash dependency for nscd init script diff --git a/external/poky/meta/recipes-core/glibc/glibc/0020-eglibc-Clear-cache-lines-on-ppc8xx.patch b/external/poky/meta/recipes-core/glibc/glibc/0020-eglibc-Clear-cache-lines-on-ppc8xx.patch deleted file mode 100644 index 6e475a71..00000000 --- a/external/poky/meta/recipes-core/glibc/glibc/0020-eglibc-Clear-cache-lines-on-ppc8xx.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 6c23660d035e71de0e20b40460ad3050bd057665 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Thu, 31 Dec 2015 15:15:09 -0800 -Subject: [PATCH] eglibc: Clear cache lines on ppc8xx - -2007-06-13 Nathan Sidwell <nathan@codesourcery.com> - Mark Shinwell <shinwell@codesourcery.com> - - * sysdeps/unix/sysv/linux/powerpc/libc-start.c - (__libc_start_main): Detect 8xx parts and clear - __cache_line_size if detected. - * sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c - (DL_PLATFORM_AUXV): Likewise. - -Upstream-Status: Pending - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c | 14 +++++++++++++- - sysdeps/unix/sysv/linux/powerpc/libc-start.c | 16 +++++++++++++++- - 2 files changed, 28 insertions(+), 2 deletions(-) - -diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c -index 78051bc7bc..e24f442320 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c -+++ b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c -@@ -24,9 +24,21 @@ int __cache_line_size attribute_hidden; - /* Scan the Aux Vector for the "Data Cache Block Size" entry. If found - verify that the static extern __cache_line_size is defined by checking - for not NULL. If it is defined then assign the cache block size -- value to __cache_line_size. */ -+ value to __cache_line_size. This is used by memset to -+ optimize setting to zero. We have to detect 8xx processors, which -+ have buggy dcbz implementations that cannot report page faults -+ correctly. That requires reading SPR, which is a privileged -+ operation. Fortunately 2.2.18 and later emulates PowerPC mfspr -+ reads from the PVR register. */ - #define DL_PLATFORM_AUXV \ - case AT_DCACHEBSIZE: \ -+ if (__LINUX_KERNEL_VERSION >= 0x020218) \ -+ { \ -+ unsigned pvr = 0; \ -+ asm ("mfspr %0, 287" : "=r" (pvr)); \ -+ if ((pvr & 0xffff0000) == 0x00500000) \ -+ break; \ -+ } \ - __cache_line_size = av->a_un.a_val; \ - break; - -diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-start.c b/sysdeps/unix/sysv/linux/powerpc/libc-start.c -index f2ad0c355d..3e6773795e 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/libc-start.c -+++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.c -@@ -73,11 +73,25 @@ __libc_start_main (int argc, char **argv, - - /* Initialize the __cache_line_size variable from the aux vector. For the - static case, we also need _dl_hwcap, _dl_hwcap2 and _dl_platform, so we -- can call __tcb_parse_hwcap_and_convert_at_platform (). */ -+ can call __tcb_parse_hwcap_and_convert_at_platform (). -+ -+ This is used by memset to optimize setting to zero. We have to -+ detect 8xx processors, which have buggy dcbz implementations that -+ cannot report page faults correctly. That requires reading SPR, -+ which is a privileged operation. Fortunately 2.2.18 and later -+ emulates PowerPC mfspr reads from the PVR register. */ - for (ElfW (auxv_t) * av = auxvec; av->a_type != AT_NULL; ++av) - switch (av->a_type) - { - case AT_DCACHEBSIZE: -+ if (__LINUX_KERNEL_VERSION >= 0x020218) -+ { -+ unsigned pvr = 0; -+ -+ asm ("mfspr %0, 287" : "=r" (pvr) :); -+ if ((pvr & 0xffff0000) == 0x00500000) -+ break; -+ } - __cache_line_size = av->a_un.a_val; - break; - #ifndef SHARED diff --git a/external/poky/meta/recipes-core/glibc/glibc/0018-eglibc-Cross-building-and-testing-instructions.patch b/external/poky/meta/recipes-core/glibc/glibc/0020-eglibc-Cross-building-and-testing-instructions.patch index 29109a26..eda55653 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0018-eglibc-Cross-building-and-testing-instructions.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0020-eglibc-Cross-building-and-testing-instructions.patch @@ -1,4 +1,4 @@ -From 44a5c79efea09f5b990e524ec42abdeef444056a Mon Sep 17 00:00:00 2001 +From 5641452a24f76c5dafa3749a542fcac93f77390f Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 18 Mar 2015 00:42:58 +0000 Subject: [PATCH] eglibc: Cross building and testing instructions diff --git a/external/poky/meta/recipes-core/glibc/glibc/0019-eglibc-Help-bootstrap-cross-toolchain.patch b/external/poky/meta/recipes-core/glibc/glibc/0021-eglibc-Help-bootstrap-cross-toolchain.patch index 71c2ab91..6374ea40 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0019-eglibc-Help-bootstrap-cross-toolchain.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0021-eglibc-Help-bootstrap-cross-toolchain.patch @@ -1,4 +1,4 @@ -From f4ec5527d562d38523abb8587a6c7532e9d21f8a Mon Sep 17 00:00:00 2001 +From 6a32d5bf40deee5d12d24c06f3ea9b5479c16802 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 18 Mar 2015 00:49:28 +0000 Subject: [PATCH] eglibc: Help bootstrap cross toolchain @@ -29,10 +29,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> create mode 100644 include/stubs-bootstrap.h diff --git a/Makefile b/Makefile -index d3f25a525a..ab383867e2 100644 +index 8f0a93aceb..8eba23a868 100644 --- a/Makefile +++ b/Makefile -@@ -70,9 +70,18 @@ subdir-dirs = include +@@ -79,9 +79,18 @@ subdir-dirs = include vpath %.h $(subdir-dirs) # What to install. @@ -52,7 +52,7 @@ index d3f25a525a..ab383867e2 100644 ifeq (yes,$(build-shared)) headers += gnu/lib-names.h endif -@@ -195,6 +204,16 @@ others: $(common-objpfx)testrun.sh +@@ -407,6 +416,16 @@ others: $(common-objpfx)testrun.sh $(common-objpfx)debugglibc.sh subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs) @@ -69,7 +69,7 @@ index d3f25a525a..ab383867e2 100644 ifndef abi-variants installed-stubs = $(inst_includedir)/gnu/stubs.h else -@@ -221,6 +240,7 @@ $(inst_includedir)/gnu/stubs.h: $(+force) +@@ -433,6 +452,7 @@ $(inst_includedir)/gnu/stubs.h: $(+force) install-others-nosubdir: $(installed-stubs) endif diff --git a/external/poky/meta/recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch b/external/poky/meta/recipes-core/glibc/glibc/0022-eglibc-Resolve-__fpscr_values-on-SH4.patch index 8aecf262..2a503c81 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0022-eglibc-Resolve-__fpscr_values-on-SH4.patch @@ -1,4 +1,4 @@ -From 55531ef57d04006c5a1e3b32a8e0410372f86007 Mon Sep 17 00:00:00 2001 +From 25c21857a3fc0eb26831616ba88a696dd31ecba1 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 18 Mar 2015 00:55:53 +0000 Subject: [PATCH] eglibc: Resolve __fpscr_values on SH4 @@ -33,7 +33,7 @@ index e0938c4165..ca1d7da339 100644 # a* alphasort64; diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.S b/sysdeps/unix/sysv/linux/sh/sysdep.S -index c4e28ffb98..648bae03d5 100644 +index 85ff3f900e..7743b8d57a 100644 --- a/sysdeps/unix/sysv/linux/sh/sysdep.S +++ b/sysdeps/unix/sysv/linux/sh/sysdep.S @@ -30,3 +30,14 @@ ENTRY (__syscall_error) diff --git a/external/poky/meta/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch b/external/poky/meta/recipes-core/glibc/glibc/0023-eglibc-Forward-port-cross-locale-generation-support.patch index aa62c635..1a90f22d 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0023-eglibc-Forward-port-cross-locale-generation-support.patch @@ -1,4 +1,4 @@ -From 4bb23fbb07984b93fd14f353fd9325d927b0cd98 Mon Sep 17 00:00:00 2001 +From 30008327aadf0c775e644bb387d7c25952ed05b5 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 18 Mar 2015 01:33:49 +0000 Subject: [PATCH] eglibc: Forward port cross locale generation support @@ -8,7 +8,7 @@ Upstream-Status: Pending Signed-off-by: Khem Raj <raj.khem@gmail.com> --- locale/Makefile | 3 +- - locale/catnames.c | 48 ++++++++++++++++++++++++++++ + locale/catnames.c | 46 +++++++++++++++++++++++++++ locale/localeinfo.h | 2 +- locale/programs/charmap-dir.c | 6 ++++ locale/programs/ld-collate.c | 17 +++++----- @@ -18,12 +18,12 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> locale/programs/localedef.c | 8 +++++ locale/programs/locfile.c | 5 ++- locale/programs/locfile.h | 59 +++++++++++++++++++++++++++++++++-- - locale/setlocale.c | 30 ------------------ - 12 files changed, 169 insertions(+), 69 deletions(-) + 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 fd9972279b..176b3946de 100644 +index c9694e236e..ba7105fad6 100644 --- a/locale/Makefile +++ b/locale/Makefile @@ -26,7 +26,8 @@ headers = langinfo.h locale.h bits/locale.h \ @@ -38,10 +38,10 @@ index fd9972279b..176b3946de 100644 address telephone measurement identification collate diff --git a/locale/catnames.c b/locale/catnames.c new file mode 100644 -index 0000000000..9fad357db1 +index 0000000000..538f3f5edb --- /dev/null +++ b/locale/catnames.c -@@ -0,0 +1,48 @@ +@@ -0,0 +1,46 @@ +/* Copyright (C) 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + @@ -63,20 +63,18 @@ index 0000000000..9fad357db1 +#include "localeinfo.h" + +/* Define an array of category names (also the environment variable names). */ -+const union catnamestr_t _nl_category_names attribute_hidden = ++const struct catnamestr_t _nl_category_names attribute_hidden = + { -+ { +#define DEFINE_CATEGORY(category, category_name, items, a) \ -+ category_name, ++ 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 (union catnamestr_t, CATNAMEMF (__LINE__)), ++ [category] = offsetof (struct catnamestr_t, CATNAMEMF (__LINE__)), +#include "categories.def" +#undef DEFINE_CATEGORY + }; @@ -91,10 +89,10 @@ index 0000000000..9fad357db1 + [LC_ALL] = sizeof ("LC_ALL") - 1 + }; diff --git a/locale/localeinfo.h b/locale/localeinfo.h -index 537bc35149..73ba20d695 100644 +index fdc283c69a..4eeed35f90 100644 --- a/locale/localeinfo.h +++ b/locale/localeinfo.h -@@ -224,7 +224,7 @@ __libc_tsd_define (extern, locale_t, LOCALE) +@@ -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. */ @@ -104,7 +102,7 @@ index 537bc35149..73ba20d695 100644 # define NL_CURRENT_INDIRECT 1 #endif diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c -index 34a8d32c92..cbb9436cd1 100644 +index 1a526a240d..0fb2daf936 100644 --- a/locale/programs/charmap-dir.c +++ b/locale/programs/charmap-dir.c @@ -18,7 +18,9 @@ @@ -150,7 +148,7 @@ index 34a8d32c92..cbb9436cd1 100644 return NULL; } diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c -index d2eebcfdbb..c3718d6589 100644 +index feb1a11258..5a8e522470 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, @@ -199,7 +197,7 @@ index d2eebcfdbb..c3718d6589 100644 == runp->wcnext->wcs[runp->nwcs - 1] + 1)); diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c -index f791e6b7e9..d809d6db7f 100644 +index 3328093d0e..d58fb0f4b7 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, @@ -211,7 +209,7 @@ index f791e6b7e9..d809d6db7f 100644 : 0); init_locale_data (&file, nelems); -@@ -1926,7 +1926,7 @@ read_translit_entry (struct linereader *ldfile, struct locale_ctype_t *ctype, +@@ -1927,7 +1927,7 @@ read_translit_entry (struct linereader *ldfile, struct locale_ctype_t *ctype, ignore = 1; else /* This value is usable. */ @@ -220,7 +218,7 @@ index f791e6b7e9..d809d6db7f 100644 first = 0; } -@@ -2460,8 +2460,8 @@ with character code range values one must use the absolute ellipsis `...'")); +@@ -2461,8 +2461,8 @@ with character code range values one must use the absolute ellipsis `...'")); } handle_tok_digit: @@ -231,7 +229,7 @@ index f791e6b7e9..d809d6db7f 100644 handle_digits = 1; goto read_charclass; -@@ -3901,8 +3901,7 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, +@@ -3904,8 +3904,7 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, while (idx < number) { @@ -241,7 +239,7 @@ index f791e6b7e9..d809d6db7f 100644 if (res == 0) { replace = 1; -@@ -3939,11 +3938,11 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, +@@ -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; @@ -255,7 +253,7 @@ index f791e6b7e9..d809d6db7f 100644 srunp = srunp->next; } /* Plus one for the extra NUL character marking the end of -@@ -3967,18 +3966,18 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, +@@ -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; @@ -281,7 +279,7 @@ index f791e6b7e9..d809d6db7f 100644 srunp = srunp->next; } diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c -index a755792363..e8b2f85522 100644 +index f7db873adb..fec3773c9d 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"); @@ -350,7 +348,7 @@ index a755792363..e8b2f85522 100644 diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c -index 3525c8a43d..f8a7fd9c24 100644 +index 7ebd933801..5753750756 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, @@ -363,18 +361,18 @@ index 3525c8a43d..f8a7fd9c24 100644 size_t bufmax = 56; diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c -index d718d2e9f4..e0a3ad5a83 100644 +index dbbb0145c0..097a8b6193 100644 --- a/locale/programs/localedef.c +++ b/locale/programs/localedef.c -@@ -105,6 +105,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; - #define OPT_BIG_ENDIAN 401 +@@ -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_UINT32_ALIGN 404 + #define OPT_NO_HARD_LINKS 404 ++#define OPT_UINT32_ALIGN 405 /* Definitions of arguments for argp functions. */ static const struct argp_option options[] = -@@ -147,6 +148,8 @@ 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") }, @@ -383,7 +381,7 @@ index d718d2e9f4..e0a3ad5a83 100644 { NULL, 0, NULL, 0, NULL } }; -@@ -236,12 +239,14 @@ main (int argc, char *argv[]) +@@ -242,12 +245,14 @@ main (int argc, char *argv[]) ctype locale. (P1003.2 4.35.5.2) */ setlocale (LC_CTYPE, "POSIX"); @@ -398,9 +396,9 @@ index d718d2e9f4..e0a3ad5a83 100644 /* Process charmap file. */ charmap = charmap_read (charmap_file, verbose, 1, be_quiet, 1); -@@ -389,6 +394,9 @@ parse_opt (int key, char *arg, struct argp_state *state) - /* Enable the warnings. */ - set_warnings (arg, true); +@@ -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; @@ -409,7 +407,7 @@ index d718d2e9f4..e0a3ad5a83 100644 force_output = 1; break; diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c -index 32e5f761f2..b41e77bd8d 100644 +index eb2f4634da..d387147323 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, @@ -432,7 +430,7 @@ index 32e5f761f2..b41e77bd8d 100644 /* Record that FILE's next element is the 32-bit integer VALUE. */ diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h -index 89b347c72d..a636fc2960 100644 +index 7ea10038b4..0888c09762 100644 --- a/locale/programs/locfile.h +++ b/locale/programs/locfile.h @@ -71,6 +71,8 @@ extern void write_all_categories (struct localedef_t *definitions, @@ -521,28 +519,27 @@ index 89b347c72d..a636fc2960 100644 + #endif /* locfile.h */ diff --git a/locale/setlocale.c b/locale/setlocale.c -index e4de907e1f..b5d8f5c17d 100644 +index 030f1727bd..096d8ed895 100644 --- a/locale/setlocale.c +++ b/locale/setlocale.c -@@ -64,36 +64,6 @@ static char *const _nl_current_used[] = - #endif +@@ -63,35 +63,6 @@ static char *const _nl_current_used[] = + #endif +- -/* Define an array of category names (also the environment variable names). */ --const union catnamestr_t _nl_category_names attribute_hidden = +-const struct catnamestr_t _nl_category_names attribute_hidden = - { -- { -#define DEFINE_CATEGORY(category, category_name, items, a) \ -- category_name, +- 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 (union catnamestr_t, CATNAMEMF (__LINE__)), +- [category] = offsetof (struct catnamestr_t, CATNAMEMF (__LINE__)), -#include "categories.def" -#undef DEFINE_CATEGORY - }; diff --git a/external/poky/meta/recipes-core/glibc/glibc/0023-Define-DUMMY_LOCALE_T-if-not-defined.patch b/external/poky/meta/recipes-core/glibc/glibc/0024-Define-DUMMY_LOCALE_T-if-not-defined.patch index 68fad964..15e460eb 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0023-Define-DUMMY_LOCALE_T-if-not-defined.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0024-Define-DUMMY_LOCALE_T-if-not-defined.patch @@ -1,4 +1,4 @@ -From 1b2ceb6c2414e3c98c7bcd029583287ced9f3159 Mon Sep 17 00:00:00 2001 +From 067f71a381ce6626ef1179be3dd90c4ed2aa52fb Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 20 Apr 2016 21:11:00 -0700 Subject: [PATCH] Define DUMMY_LOCALE_T if not defined @@ -14,7 +14,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> 1 file changed, 3 insertions(+) diff --git a/locale/programs/config.h b/locale/programs/config.h -index 9956cd8446..04342f3644 100644 +index d76d9f7e8b..92b56d7df3 100644 --- a/locale/programs/config.h +++ b/locale/programs/config.h @@ -19,6 +19,9 @@ diff --git a/external/poky/meta/recipes-core/glibc/glibc/0025-locale-fix-hard-coded-reference-to-gcc-E.patch b/external/poky/meta/recipes-core/glibc/glibc/0025-locale-fix-hard-coded-reference-to-gcc-E.patch deleted file mode 100644 index 4a7919ff..00000000 --- a/external/poky/meta/recipes-core/glibc/glibc/0025-locale-fix-hard-coded-reference-to-gcc-E.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 6c6aecba19b3e7947100623532a41b6f16734ace Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Rosen?= <jeremy.rosen@smile.fr> -Date: Mon, 22 Aug 2016 16:09:25 +0200 -Subject: [PATCH] locale: fix hard-coded reference to gcc -E - -When new version of compilers are published, they may not be compatible with -older versions of software. This is particularly common when software is built -with -Werror. - -Autotools provides a way for a user to specify the name of his compiler using a -set of variables ($CC $CXX $CPP etc.). Those variables are used correctly when -compiling glibc but the script used to generate transliterations in the locale/ -subdirectory directly calls the gcc binary to get the output of the -preprocessor instead of using the $CPP variable provided by the build -environment. - -This patch replaces the hard-coded reference to the gcc binary with the proper -environment variable, thus allowing a user to override it. - -Upstream-Status: Submitted [https://sourceware.org/ml/libc-alpha/2016-08/msg00746.html] ---- - locale/gen-translit.pl | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/locale/gen-translit.pl b/locale/gen-translit.pl -index 30d3f2f195..e97653017c 100644 ---- a/locale/gen-translit.pl -+++ b/locale/gen-translit.pl -@@ -1,5 +1,5 @@ - #!/usr/bin/perl -w --open F, "cat C-translit.h.in | gcc -E - |" || die "Cannot preprocess input file"; -+open F, 'cat C-translit.h.in | ${CPP:-gcc -E} - |' || die "Cannot preprocess input file"; - - - sub cstrlen { diff --git a/external/poky/meta/recipes-core/glibc/glibc/0029-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch b/external/poky/meta/recipes-core/glibc/glibc/0025-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch index e17f6aa3..543f65d6 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0029-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0025-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch @@ -1,4 +1,4 @@ -From 865651d2496a90f7ae8e7cc19a2e54b6f17a8ad5 Mon Sep 17 00:00:00 2001 +From 8f4b0bac85d14b184e08848b02de3f30775f05b1 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Fri, 3 Aug 2018 09:42:06 -0700 Subject: [PATCH] localedef --add-to-archive uses a hard-coded locale path @@ -14,11 +14,11 @@ Upstream-Status: Inappropriate (OE-specific) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Khem Raj <raj.khem@gmail.com> --- - locale/programs/locarchive.c | 37 ++++++++++++++++++++++++++---------- - 1 file changed, 27 insertions(+), 10 deletions(-) + 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 ca332a345f..91f62da662 100644 +index dccaf04e3b..ae0b7fe155 100644 --- a/locale/programs/locarchive.c +++ b/locale/programs/locarchive.c @@ -340,12 +340,24 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) @@ -34,7 +34,7 @@ index ca332a345f..91f62da662 100644 - if (output_prefix) - memcpy (archivefname, output_prefix, prefix_len); - strcpy (archivefname + prefix_len, ARCHIVE_NAME); -+ if (envarchive != NULL) ++ if (envarchive != NULL) + { + archivefname = xmalloc(strlen(envarchive) + 1); + fname = xmalloc(strlen(envarchive) + sizeof (".XXXXXX")); @@ -51,16 +51,7 @@ index ca332a345f..91f62da662 100644 strcpy (stpcpy (fname, archivefname), ".XXXXXX"); /* Not all of the old file has to be mapped. Change this now this -@@ -551,6 +563,8 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) - - /* Add the information for the new one. */ - *ah = new_ah; -+ free(archivefname); -+ free(fname); - } - - -@@ -569,10 +583,13 @@ open_archive (struct locarhandle *ah, bool readonly) +@@ -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) { @@ -78,7 +69,7 @@ index ca332a345f..91f62da662 100644 } while (1) -@@ -585,7 +602,7 @@ open_archive (struct locarhandle *ah, bool readonly) +@@ -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. */ diff --git a/external/poky/meta/recipes-core/glibc/glibc/0024-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch b/external/poky/meta/recipes-core/glibc/glibc/0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch index 28cff2b9..5f6ee40f 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0024-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch @@ -1,4 +1,4 @@ -From a6159c9486745664a5f116ee9cc45837021b7624 Mon Sep 17 00:00:00 2001 +From 1dad746ce93928a57b2fe618c74722f710751826 Mon Sep 17 00:00:00 2001 From: Mark Hatle <mark.hatle@windriver.com> Date: Thu, 18 Aug 2016 14:07:58 -0500 Subject: [PATCH] elf/dl-deps.c: Make _dl_build_local_scope breadth first @@ -24,7 +24,7 @@ Signed-off-by: Mark Hatle <mark.hatle@windriver.com> 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/elf/dl-deps.c b/elf/dl-deps.c -index 9d9b1ba7f2..8414028c58 100644 +index 5103a8a111..54cd80aaff 100644 --- a/elf/dl-deps.c +++ b/elf/dl-deps.c @@ -73,13 +73,19 @@ _dl_build_local_scope (struct link_map **list, struct link_map *map) diff --git a/external/poky/meta/recipes-core/glibc/glibc/0030-intl-Emit-no-lines-in-bison-generated-files.patch b/external/poky/meta/recipes-core/glibc/glibc/0027-intl-Emit-no-lines-in-bison-generated-files.patch index db97d91c..2c317d58 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0030-intl-Emit-no-lines-in-bison-generated-files.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0027-intl-Emit-no-lines-in-bison-generated-files.patch @@ -1,4 +1,4 @@ -From a54c15d0567d547137066f41b1b22eba4875c27b Mon Sep 17 00:00:00 2001 +From 3c8d9eae83ab4f1677afc9b379f97114e8503363 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Fri, 3 Aug 2018 09:44:00 -0700 Subject: [PATCH] intl: Emit no lines in bison generated files @@ -17,7 +17,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intl/Makefile b/intl/Makefile -index 672edf1b38..d31888d013 100644 +index ce3072420f..58457840d9 100644 --- a/intl/Makefile +++ b/intl/Makefile @@ -155,7 +155,7 @@ $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out diff --git a/external/poky/meta/recipes-core/glibc/glibc/0028-bits-siginfo-consts.h-enum-definition-for-TRAP_HWBKP.patch b/external/poky/meta/recipes-core/glibc/glibc/0028-bits-siginfo-consts.h-enum-definition-for-TRAP_HWBKP.patch deleted file mode 100644 index fae8d004..00000000 --- a/external/poky/meta/recipes-core/glibc/glibc/0028-bits-siginfo-consts.h-enum-definition-for-TRAP_HWBKP.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 38fad3e5ab3b45c56810abd35fa11a72fa10b8f1 Mon Sep 17 00:00:00 2001 -From: Pratyush Anand <panand@redhat.com> -Date: Wed, 22 Mar 2017 17:02:38 +0530 -Subject: [PATCH] bits/siginfo-consts.h: enum definition for TRAP_HWBKPT is - missing -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Compile following linux kernel test code with latest glibc: - -https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c - -and we get following error: -breakpoint_test_arm64.c: In function ‘run_test’: -breakpoint_test_arm64.c:171:25: error: ‘TRAP_HWBKPT’ undeclared (first use in this function) - if (siginfo.si_code != TRAP_HWBKPT) { - ^ -I can compile test code by modifying my local -/usr/include/bits/siginfo.h and test works great. Therefore, this patch -will be needed in upstream glibc so that issue is fixed there as well. - -Signed-off-by: Pratyush Anand <panand@redhat.com> - -Upstream-Status: Submitted [https://sourceware.org/bugzilla/show_bug.cgi?id=21286] ---- - bits/siginfo-consts.h | 6 +++++- - sysdeps/unix/sysv/linux/bits/siginfo-consts.h | 6 +++++- - 2 files changed, 10 insertions(+), 2 deletions(-) - -diff --git a/bits/siginfo-consts.h b/bits/siginfo-consts.h -index 7464c1882b..298314527a 100644 ---- a/bits/siginfo-consts.h -+++ b/bits/siginfo-consts.h -@@ -106,8 +106,12 @@ enum - { - TRAP_BRKPT = 1, /* Process breakpoint. */ - # define TRAP_BRKPT TRAP_BRKPT -- TRAP_TRACE /* Process trace trap. */ -+ TRAP_TRACE, /* Process trace trap. */ - # define TRAP_TRACE TRAP_TRACE -+ TRAP_BRANCH, /* Process branch trap. */ -+# define TRAP_BRANCH TRAP_BRANCH -+ TRAP_HWBKPT /* hardware breakpoint/watchpoint */ -+# define TRAP_HWBKPT TRAP_HWBKPT - }; - # endif - -diff --git a/sysdeps/unix/sysv/linux/bits/siginfo-consts.h b/sysdeps/unix/sysv/linux/bits/siginfo-consts.h -index 193bd9c471..3fe852bc5f 100644 ---- a/sysdeps/unix/sysv/linux/bits/siginfo-consts.h -+++ b/sysdeps/unix/sysv/linux/bits/siginfo-consts.h -@@ -141,8 +141,12 @@ enum - { - TRAP_BRKPT = 1, /* Process breakpoint. */ - # define TRAP_BRKPT TRAP_BRKPT -- TRAP_TRACE /* Process trace trap. */ -+ TRAP_TRACE, /* Process trace trap. */ - # define TRAP_TRACE TRAP_TRACE -+ TRAP_BRANCH, /* Process branch trap. */ -+# define TRAP_BRANCH TRAP_BRANCH -+ TRAP_HWBKPT /* hardware breakpoint/watchpoint */ -+# define TRAP_HWBKPT TRAP_HWBKPT - }; - # endif - diff --git a/external/poky/meta/recipes-core/glibc/glibc/0034-inject-file-assembly-directives.patch b/external/poky/meta/recipes-core/glibc/glibc/0028-inject-file-assembly-directives.patch index 55eba2d4..e1a030d1 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0034-inject-file-assembly-directives.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0028-inject-file-assembly-directives.patch @@ -1,7 +1,12 @@ -Currently, non-IA builds are not reproducibile since build paths are +From 420454f7098b5445730caa855c37b8143bfccc1b Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Thu, 29 Nov 2018 17:29:35 -0800 +Subject: [PATCH] inject file assembly directives + +Currently, non-IA builds are not reproducibile since build paths are being injected into the debug symbols. These are coming from the use of .S assembler files during the glibc build. No STT_FILE section is added -during the assembly but when linking, ld decides to add one to aid +during the assembly but when linking, ld decides to add one to aid debugging and ensure references between the different object files its linking remain clear. @@ -18,8 +23,32 @@ RP Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + csu/abi-note.S | 2 ++ + sysdeps/aarch64/crti.S | 2 ++ + sysdeps/aarch64/crtn.S | 2 ++ + sysdeps/aarch64/dl-tlsdesc.S | 2 ++ + sysdeps/aarch64/dl-trampoline.S | 2 ++ + sysdeps/aarch64/start.S | 2 ++ + sysdeps/arm/abi-note.S | 2 ++ + sysdeps/arm/crti.S | 2 ++ + sysdeps/arm/crtn.S | 2 ++ + sysdeps/arm/dl-tlsdesc.S | 2 ++ + sysdeps/arm/dl-trampoline.S | 2 ++ + sysdeps/arm/start.S | 2 ++ + sysdeps/mips/start.S | 2 ++ + sysdeps/powerpc/powerpc32/dl-start.S | 2 ++ + sysdeps/powerpc/powerpc32/start.S | 2 ++ + sysdeps/powerpc/powerpc64/start.S | 2 ++ + sysdeps/unix/sysv/linux/aarch64/__read_tp.S | 2 ++ + sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S | 2 ++ + sysdeps/unix/sysv/linux/arm/libc-do-syscall.S | 2 ++ + sysdeps/unix/sysv/linux/powerpc/dl-brk.S | 2 ++ + 20 files changed, 40 insertions(+) + diff --git a/csu/abi-note.S b/csu/abi-note.S -index 5d0ca7803d..8ce41581b1 100644 +index 2b4b5f8824..964843016c 100644 --- a/csu/abi-note.S +++ b/csu/abi-note.S @@ -56,6 +56,8 @@ offset length contents @@ -32,7 +61,7 @@ index 5d0ca7803d..8ce41581b1 100644 name begins with `.note' and creates a PT_NOTE program header entry pointing at it. */ diff --git a/sysdeps/aarch64/crti.S b/sysdeps/aarch64/crti.S -index 2b213758b2..736f33e314 100644 +index 1728eac37a..76a8ab590b 100644 --- a/sysdeps/aarch64/crti.S +++ b/sysdeps/aarch64/crti.S @@ -50,6 +50,8 @@ @@ -45,7 +74,7 @@ index 2b213758b2..736f33e314 100644 weak_extern (PREINIT_FUNCTION) #else diff --git a/sysdeps/aarch64/crtn.S b/sysdeps/aarch64/crtn.S -index d72300af80..cb249bf3ca 100644 +index c3e97cc449..fc2e5c2df8 100644 --- a/sysdeps/aarch64/crtn.S +++ b/sysdeps/aarch64/crtn.S @@ -37,6 +37,8 @@ @@ -57,34 +86,8 @@ index d72300af80..cb249bf3ca 100644 .section .init,"ax",%progbits ldp x29, x30, [sp], 16 RET -diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S -index bad000f555..5957c028cd 100644 ---- a/sysdeps/aarch64/start.S -+++ b/sysdeps/aarch64/start.S -@@ -18,6 +18,8 @@ - - #include <sysdep.h> - -+ .file "start.S" -+ - /* This is the canonical entry point, usually the first thing in the text - segment. - -diff --git a/sysdeps/unix/sysv/linux/aarch64/__read_tp.S b/sysdeps/unix/sysv/linux/aarch64/__read_tp.S -index 92fc0191a5..715bfcb9e4 100644 ---- a/sysdeps/unix/sysv/linux/aarch64/__read_tp.S -+++ b/sysdeps/unix/sysv/linux/aarch64/__read_tp.S -@@ -18,6 +18,8 @@ - - #include <sysdep.h> - -+ .file "__read_tp.S" -+ - .hidden __read_tp - ENTRY (__read_tp) - mrs x0, tpidr_el0 diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S -index 43a62ef307..42f85cdde9 100644 +index 557ad1d505..194a8531da 100644 --- a/sysdeps/aarch64/dl-tlsdesc.S +++ b/sysdeps/aarch64/dl-tlsdesc.S @@ -22,6 +22,8 @@ @@ -97,7 +100,7 @@ index 43a62ef307..42f85cdde9 100644 #define SAVE_Q_REGISTERS \ stp q0, q1, [sp, #-32*NSAVEDQREGPAIRS]!; \ diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S -index a86d0722d4..92edab1d01 100644 +index 94e965c096..ba18742f3e 100644 --- a/sysdeps/aarch64/dl-trampoline.S +++ b/sysdeps/aarch64/dl-trampoline.S @@ -21,6 +21,8 @@ @@ -109,6 +112,19 @@ index a86d0722d4..92edab1d01 100644 #define ip0 x16 #define ip0l PTR_REG (16) #define ip1 x17 +diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S +index d96cf57e2d..07a523978a 100644 +--- a/sysdeps/aarch64/start.S ++++ b/sysdeps/aarch64/start.S +@@ -18,6 +18,8 @@ + + #include <sysdep.h> + ++ .file "start.S" ++ + /* This is the canonical entry point, usually the first thing in the text + segment. + diff --git a/sysdeps/arm/abi-note.S b/sysdeps/arm/abi-note.S index 07bd4c4619..7213b16f27 100644 --- a/sysdeps/arm/abi-note.S @@ -120,7 +136,7 @@ index 07bd4c4619..7213b16f27 100644 alignment in any callee. */ .eabi_attribute 25, 1 diff --git a/sysdeps/arm/crti.S b/sysdeps/arm/crti.S -index a1424d0333..bca1dab256 100644 +index 8169783267..f56e0c85a6 100644 --- a/sysdeps/arm/crti.S +++ b/sysdeps/arm/crti.S @@ -57,6 +57,8 @@ @@ -133,7 +149,7 @@ index a1424d0333..bca1dab256 100644 .p2align 2 .type call_weak_fn, %function diff --git a/sysdeps/arm/crtn.S b/sysdeps/arm/crtn.S -index 26027693ce..65a0502826 100644 +index d60f9f05de..1e10ec439f 100644 --- a/sysdeps/arm/crtn.S +++ b/sysdeps/arm/crtn.S @@ -37,6 +37,8 @@ @@ -146,7 +162,7 @@ index 26027693ce..65a0502826 100644 corresponding to the prologues in crti.S. */ diff --git a/sysdeps/arm/dl-tlsdesc.S b/sysdeps/arm/dl-tlsdesc.S -index 056e17d52d..a98c68dfb9 100644 +index 8415e47607..29c2cb8128 100644 --- a/sysdeps/arm/dl-tlsdesc.S +++ b/sysdeps/arm/dl-tlsdesc.S @@ -21,6 +21,8 @@ @@ -159,7 +175,7 @@ index 056e17d52d..a98c68dfb9 100644 @ emit debug information with cfi @ use arm-specific pseudos for unwinding itself diff --git a/sysdeps/arm/dl-trampoline.S b/sysdeps/arm/dl-trampoline.S -index c731b01286..4b37b25344 100644 +index a20baf555e..2dd3bef04e 100644 --- a/sysdeps/arm/dl-trampoline.S +++ b/sysdeps/arm/dl-trampoline.S @@ -21,6 +21,8 @@ @@ -172,7 +188,7 @@ index c731b01286..4b37b25344 100644 .globl _dl_runtime_resolve .type _dl_runtime_resolve, #function diff --git a/sysdeps/arm/start.S b/sysdeps/arm/start.S -index adef090717..d22e4128e0 100644 +index 2ff56179d2..c118046ec6 100644 --- a/sysdeps/arm/start.S +++ b/sysdeps/arm/start.S @@ -57,6 +57,8 @@ @@ -184,21 +200,8 @@ index adef090717..d22e4128e0 100644 /* Tag_ABI_align8_preserved: This code preserves 8-byte alignment in any callee. */ .eabi_attribute 25, 1 -diff --git a/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S b/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S -index 871702317a..20a942dbac 100644 ---- a/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S -+++ b/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S -@@ -39,6 +39,8 @@ - a normal function call) in a high page of memory; tail call to the - helper. */ - -+ .file "aeabi_read_tp.S" -+ - .hidden __aeabi_read_tp - ENTRY (__aeabi_read_tp) - #ifdef ARCH_HAS_HARD_TP diff --git a/sysdeps/mips/start.S b/sysdeps/mips/start.S -index a4c4ef0fae..d00fff31a8 100644 +index fabc8080df..83c6b91d7d 100644 --- a/sysdeps/mips/start.S +++ b/sysdeps/mips/start.S @@ -38,6 +38,8 @@ @@ -210,16 +213,21 @@ index a4c4ef0fae..d00fff31a8 100644 #ifndef ENTRY_POINT #error ENTRY_POINT needs to be defined for start.S on MIPS/ELF. #endif -diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-brk.S b/sysdeps/unix/sysv/linux/powerpc/dl-brk.S -index eeb96544e3..da182b28f8 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/dl-brk.S -+++ b/sysdeps/unix/sysv/linux/powerpc/dl-brk.S -@@ -1 +1,3 @@ -+ .file "dl-brk.S" +diff --git a/sysdeps/powerpc/powerpc32/dl-start.S b/sysdeps/powerpc/powerpc32/dl-start.S +index c15242d3bc..6ca27715a4 100644 +--- a/sysdeps/powerpc/powerpc32/dl-start.S ++++ b/sysdeps/powerpc/powerpc32/dl-start.S +@@ -18,6 +18,8 @@ + + #include <sysdep.h> + ++ .file "dl-start.S" + - #include <brk.S> + /* Initial entry point code for the dynamic linker. + The C function `_dl_start' is the real entry point; + its return value is the user program's entry point. */ diff --git a/sysdeps/powerpc/powerpc32/start.S b/sysdeps/powerpc/powerpc32/start.S -index 5c10a22f8a..2b52627f27 100644 +index b7b9a133a2..8df714f81a 100644 --- a/sysdeps/powerpc/powerpc32/start.S +++ b/sysdeps/powerpc/powerpc32/start.S @@ -35,6 +35,8 @@ @@ -232,7 +240,7 @@ index 5c10a22f8a..2b52627f27 100644 before crtbegin.o, the file defining __EH_FRAME_BEGIN__. */ #undef cfi_startproc diff --git a/sysdeps/powerpc/powerpc64/start.S b/sysdeps/powerpc/powerpc64/start.S -index bd7189310c..2e22b8472d 100644 +index 94bf771e83..cffb99500a 100644 --- a/sysdeps/powerpc/powerpc64/start.S +++ b/sysdeps/powerpc/powerpc64/start.S @@ -35,6 +35,8 @@ @@ -244,21 +252,34 @@ index bd7189310c..2e22b8472d 100644 /* We do not want .eh_frame info for crt1.o since crt1.o is linked before crtbegin.o, the file defining __EH_FRAME_BEGIN__. */ #undef cfi_startproc -diff --git a/sysdeps/powerpc/powerpc32/dl-start.S b/sysdeps/powerpc/powerpc32/dl-start.S -index 244d87fb6d..14d3e2ce14 100644 ---- a/sysdeps/powerpc/powerpc32/dl-start.S -+++ b/sysdeps/powerpc/powerpc32/dl-start.S +diff --git a/sysdeps/unix/sysv/linux/aarch64/__read_tp.S b/sysdeps/unix/sysv/linux/aarch64/__read_tp.S +index 12e1131fe7..767e0d043b 100644 +--- a/sysdeps/unix/sysv/linux/aarch64/__read_tp.S ++++ b/sysdeps/unix/sysv/linux/aarch64/__read_tp.S @@ -18,6 +18,8 @@ #include <sysdep.h> -+ .file "dl-start.S" ++ .file "__read_tp.S" + - /* Initial entry point code for the dynamic linker. - The C function `_dl_start' is the real entry point; - its return value is the user program's entry point. */ + .hidden __read_tp + ENTRY (__read_tp) + mrs x0, tpidr_el0 +diff --git a/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S b/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S +index 3b0d611039..4a7e476c37 100644 +--- a/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S ++++ b/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S +@@ -39,6 +39,8 @@ + a normal function call) in a high page of memory; tail call to the + helper. */ + ++ .file "aeabi_read_tp.S" ++ + .hidden __aeabi_read_tp + ENTRY (__aeabi_read_tp) + #ifdef ARCH_HAS_HARD_TP diff --git a/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S b/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S -index d26ad1f8d3..a0de10bf81 100644 +index fb5e0c7d97..bd07bdb38b 100644 --- a/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S +++ b/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S @@ -27,6 +27,8 @@ @@ -270,3 +291,11 @@ index d26ad1f8d3..a0de10bf81 100644 #if defined(__thumb__) .thumb .syntax unified +diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-brk.S b/sysdeps/unix/sysv/linux/powerpc/dl-brk.S +index eeb96544e3..da182b28f8 100644 +--- a/sysdeps/unix/sysv/linux/powerpc/dl-brk.S ++++ b/sysdeps/unix/sysv/linux/powerpc/dl-brk.S +@@ -1 +1,3 @@ ++ .file "dl-brk.S" ++ + #include <brk.S> diff --git a/external/poky/meta/recipes-core/glibc/glibc/0033-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch b/external/poky/meta/recipes-core/glibc/glibc/0029-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch index 31058ca9..c8c359f2 100644 --- a/external/poky/meta/recipes-core/glibc/glibc/0033-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch +++ b/external/poky/meta/recipes-core/glibc/glibc/0029-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch @@ -1,6 +1,6 @@ -From cbada1a1b218c1ef61d0eb4363fad7598e6509d6 Mon Sep 17 00:00:00 2001 -From: Martin Jansa <Martin.Jansa@gmail.com> -Date: Sun, 30 Sep 2018 09:16:48 +0000 +From 66963ad83bdd3b075006ddca9dfe357aed181d6a Mon Sep 17 00:00:00 2001 +From: Martin Jansa <martin.jansa@gmail.com> +Date: Mon, 17 Dec 2018 21:36:18 +0000 Subject: [PATCH] locale: prevent maybe-uninitialized errors with -Os [BZ #19444] @@ -21,34 +21,19 @@ Fixes following error when building for aarch64 with -Os: | coll_seq seq1, seq2; | ^~~~ - Partial fix for [BZ #23716] + Partial fix for [BZ #19444] * locale/weight.h: Fix build with -Os. -Work around the issue instead of removing -O like we do with -SELECTED_OPTIMIZATION - -Upstream-Status: Submitted [https://www.sourceware.org/ml/libc-alpha/2018-09/msg00539.html] +Upstream-Status: Submitted [https://patchwork.ozlabs.org/patch/1014766] Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> --- - ChangeLog | 4 ++++ locale/weight.h | 7 +++++++ - 2 files changed, 11 insertions(+) + 1 file changed, 7 insertions(+) -diff --git a/ChangeLog b/ChangeLog -index 216336edc9..84fbbf47ed 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2018-09-30 Martin Jansa <Martin.Jansa@gmail.com> -+ Partial fix for [BZ #23716] -+ * locale/weight.h: Fix build with -Os. -+ - 2018-09-30 Martin Jansa <Martin.Jansa@gmail.com> - Partial fix for [BZ #23716] - * sysdeps/ieee754/soft-fp/s_fdiv.c: Fix build with -O. diff --git a/locale/weight.h b/locale/weight.h -index 6028d3595e..10bcea25e5 100644 +index e071253f85..2889c395f1 100644 --- a/locale/weight.h +++ b/locale/weight.h @@ -28,7 +28,14 @@ findidx (const int32_t *table, diff --git a/external/poky/meta/recipes-core/glibc/glibc/0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors-w.patch b/external/poky/meta/recipes-core/glibc/glibc/0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors-w.patch deleted file mode 100644 index 61f55d4f..00000000 --- a/external/poky/meta/recipes-core/glibc/glibc/0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors-w.patch +++ /dev/null @@ -1,258 +0,0 @@ -From 546b46c309a52ed74dc906114b1e984bb9703d74 Mon Sep 17 00:00:00 2001 -From: Martin Jansa <Martin.Jansa@gmail.com> -Date: Fri, 14 Sep 2018 23:23:03 +0000 -Subject: [PATCH] sysdeps/ieee754: prevent maybe-uninitialized errors with -O - [BZ #19444] - -With -O included in CFLAGS it fails to build with: - -../sysdeps/ieee754/ldbl-96/e_jnl.c: In function '__ieee754_jnl': -../sysdeps/ieee754/ldbl-96/e_jnl.c:146:20: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized] - b = invsqrtpi * temp / sqrtl (x); - ~~~~~~~~~~^~~~~~ -../sysdeps/ieee754/ldbl-96/e_jnl.c: In function '__ieee754_ynl': -../sysdeps/ieee754/ldbl-96/e_jnl.c:375:16: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized] - b = invsqrtpi * temp / sqrtl (x); - ~~~~~~~~~~^~~~~~ -../sysdeps/ieee754/dbl-64/e_jn.c: In function '__ieee754_jn': -../sysdeps/ieee754/dbl-64/e_jn.c:113:20: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized] - b = invsqrtpi * temp / sqrt (x); - ~~~~~~~~~~^~~~~~ -../sysdeps/ieee754/dbl-64/e_jn.c: In function '__ieee754_yn': -../sysdeps/ieee754/dbl-64/e_jn.c:320:16: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized] - b = invsqrtpi * temp / sqrt (x); - ~~~~~~~~~~^~~~~~ - -Build tested with Yocto for ARM, AARCH64, X86, X86_64, PPC, MIPS, MIPS64 -with -O, -O1, -Os. -For soft-fp ARM it needs one more fix for -O1: -https://sourceware.org/ml/libc-alpha/2018-09/msg00300.html -For AARCH64 it needs one more fix in locale for -Os. - - [BZ #23716] - * sysdeps/ieee754/dbl-96/e_jnl.c: Fix build with -O - * sysdeps/ieee754/ldbl-96/e_jnl.c: Likewise. - * sysdeps/ieee754/ldbl-128/e_jnl.c: Likewise. - * sysdeps/ieee754/ldbl-128ibm/e_jnl.c: Likewise. - -Work around the issue instead of removing -O like we do with -SELECTED_OPTIMIZATION - -Upstream-Status: Submitted [https://www.sourceware.org/ml/libc-alpha/2018-09/msg00299.html] - -Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> ---- - ChangeLog | 7 +++++++ - sysdeps/ieee754/dbl-64/e_jn.c | 21 +++++++++++++++++++++ - sysdeps/ieee754/ldbl-128/e_jnl.c | 21 +++++++++++++++++++++ - sysdeps/ieee754/ldbl-128ibm/e_jnl.c | 21 +++++++++++++++++++++ - sysdeps/ieee754/ldbl-96/e_jnl.c | 21 +++++++++++++++++++++ - 5 files changed, 91 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 11a9b8d98e..922e916f2c 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,10 @@ -+2018-09-29 Martin Jansa <Martin.Jansa@gmail.com> -+ Partial fix for [BZ #23716] -+ * sysdeps/ieee754/dbl-96/e_jnl.c: Fix build with -O -+ * sysdeps/ieee754/ldbl-96/e_jnl.c: Likewise. -+ * sysdeps/ieee754/ldbl-128/e_jnl.c: Likewise. -+ * sysdeps/ieee754/ldbl-128ibm/e_jnl.c: Likewise. -+ - 2018-09-28 Adhemerval Zanella <adhemerval.zanella@linaro.org> - - [BZ #23579] -diff --git a/sysdeps/ieee754/dbl-64/e_jn.c b/sysdeps/ieee754/dbl-64/e_jn.c -index 9181b22bb8..9ff52c737f 100644 ---- a/sysdeps/ieee754/dbl-64/e_jn.c -+++ b/sysdeps/ieee754/dbl-64/e_jn.c -@@ -42,6 +42,7 @@ - #include <math-narrow-eval.h> - #include <math_private.h> - #include <math-underflow.h> -+#include <libc-diag.h> - - static const double - invsqrtpi = 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */ -@@ -109,7 +110,17 @@ __ieee754_jn (int n, double x) - case 2: temp = -c - s; break; - case 3: temp = c - s; break; - } -+ /* With GCC 8 (and older) when compiling with -O the compiler -+ warns that the variable 'temp', may be used uninitialized. -+ The switch above covers all possible values of n & 3 -+ but GCC without VRP enabled isn't able to figure out the -+ range of possible values is [0,3] as explained in: -+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69230 -+ so it's false possitive with -O1 and lower. */ -+ DIAG_PUSH_NEEDS_COMMENT; -+ DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); - b = invsqrtpi * temp / sqrt (x); -+ DIAG_POP_NEEDS_COMMENT; - } - else - { -@@ -316,7 +327,17 @@ __ieee754_yn (int n, double x) - case 2: temp = -s + c; break; - case 3: temp = s + c; break; - } -+ /* With GCC 8 (and older) when compiling with -O the compiler -+ warns that the variable 'temp', may be used uninitialized. -+ The switch above covers all possible values of n & 3 -+ but GCC without VRP enabled isn't able to figure out the -+ range of possible values is [0,3] as explained in: -+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69230 -+ so it's false possitive with -O1 and lower. */ -+ DIAG_PUSH_NEEDS_COMMENT; -+ DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); - b = invsqrtpi * temp / sqrt (x); -+ DIAG_POP_NEEDS_COMMENT; - } - else - { -diff --git a/sysdeps/ieee754/ldbl-128/e_jnl.c b/sysdeps/ieee754/ldbl-128/e_jnl.c -index 7739eec291..8706a11575 100644 ---- a/sysdeps/ieee754/ldbl-128/e_jnl.c -+++ b/sysdeps/ieee754/ldbl-128/e_jnl.c -@@ -61,6 +61,7 @@ - #include <math.h> - #include <math_private.h> - #include <math-underflow.h> -+#include <libc-diag.h> - - static const _Float128 - invsqrtpi = L(5.6418958354775628694807945156077258584405E-1), -@@ -150,7 +151,17 @@ __ieee754_jnl (int n, _Float128 x) - temp = c - s; - break; - } -+ /* With GCC 8 (and older) when compiling with -O the compiler -+ warns that the variable 'temp', may be used uninitialized. -+ The switch above covers all possible values of n & 3 -+ but GCC without VRP enabled isn't able to figure out the -+ range of possible values is [0,3] as explained in: -+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69230 -+ so it's false possitive with -O1 and lower. */ -+ DIAG_PUSH_NEEDS_COMMENT; -+ DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); - b = invsqrtpi * temp / sqrtl (x); -+ DIAG_POP_NEEDS_COMMENT; - } - else - { -@@ -386,7 +397,17 @@ __ieee754_ynl (int n, _Float128 x) - temp = s + c; - break; - } -+ /* With GCC 8 (and older) when compiling with -O the compiler -+ warns that the variable 'temp', may be used uninitialized. -+ The switch above covers all possible values of n & 3 -+ but GCC without VRP enabled isn't able to figure out the -+ range of possible values is [0,3] as explained in: -+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69230 -+ so it's false possitive with -O1 and lower. */ -+ DIAG_PUSH_NEEDS_COMMENT; -+ DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); - b = invsqrtpi * temp / sqrtl (x); -+ DIAG_POP_NEEDS_COMMENT; - } - else - { -diff --git a/sysdeps/ieee754/ldbl-128ibm/e_jnl.c b/sysdeps/ieee754/ldbl-128ibm/e_jnl.c -index 71b3addfba..3226d02309 100644 ---- a/sysdeps/ieee754/ldbl-128ibm/e_jnl.c -+++ b/sysdeps/ieee754/ldbl-128ibm/e_jnl.c -@@ -61,6 +61,7 @@ - #include <math.h> - #include <math_private.h> - #include <math-underflow.h> -+#include <libc-diag.h> - - static const long double - invsqrtpi = 5.6418958354775628694807945156077258584405E-1L, -@@ -150,7 +151,17 @@ __ieee754_jnl (int n, long double x) - temp = c - s; - break; - } -+ /* With GCC 8 (and older) when compiling with -O the compiler -+ warns that the variable 'temp', may be used uninitialized. -+ The switch above covers all possible values of n & 3 -+ but GCC without VRP enabled isn't able to figure out the -+ range of possible values is [0,3] as explained in: -+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69230 -+ so it's false possitive with -O1 and lower. */ -+ DIAG_PUSH_NEEDS_COMMENT; -+ DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); - b = invsqrtpi * temp / sqrtl (x); -+ DIAG_POP_NEEDS_COMMENT; - } - else - { -@@ -386,7 +397,17 @@ __ieee754_ynl (int n, long double x) - temp = s + c; - break; - } -+ /* With GCC 8 (and older) when compiling with -O the compiler -+ warns that the variable 'temp', may be used uninitialized. -+ The switch above covers all possible values of n & 3 -+ but GCC without VRP enabled isn't able to figure out the -+ range of possible values is [0,3] as explained in: -+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69230 -+ so it's false possitive with -O1 and lower. */ -+ DIAG_PUSH_NEEDS_COMMENT; -+ DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); - b = invsqrtpi * temp / sqrtl (x); -+ DIAG_POP_NEEDS_COMMENT; - } - else - { -diff --git a/sysdeps/ieee754/ldbl-96/e_jnl.c b/sysdeps/ieee754/ldbl-96/e_jnl.c -index 394921f564..da5c2cc93e 100644 ---- a/sysdeps/ieee754/ldbl-96/e_jnl.c -+++ b/sysdeps/ieee754/ldbl-96/e_jnl.c -@@ -61,6 +61,7 @@ - #include <math.h> - #include <math_private.h> - #include <math-underflow.h> -+#include <libc-diag.h> - - static const long double - invsqrtpi = 5.64189583547756286948079e-1L, two = 2.0e0L, one = 1.0e0L; -@@ -143,7 +144,17 @@ __ieee754_jnl (int n, long double x) - temp = c - s; - break; - } -+ /* With GCC 8 (and older) when compiling with -O the compiler -+ warns that the variable 'temp', may be used uninitialized. -+ The switch above covers all possible values of n & 3 -+ but GCC without VRP enabled isn't able to figure out the -+ range of possible values is [0,3] as explained in: -+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69230 -+ so it's false possitive with -O1 and lower. */ -+ DIAG_PUSH_NEEDS_COMMENT; -+ DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); - b = invsqrtpi * temp / sqrtl (x); -+ DIAG_POP_NEEDS_COMMENT; - } - else - { -@@ -372,7 +383,17 @@ __ieee754_ynl (int n, long double x) - temp = s + c; - break; - } -+ /* With GCC 8 (and older) when compiling with -O the compiler -+ warns that the variable 'temp', may be used uninitialized. -+ The switch above covers all possible values of n & 3 -+ but GCC without VRP enabled isn't able to figure out the -+ range of possible values is [0,3] as explained in: -+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69230 -+ so it's false possitive with -O1 and lower. */ -+ DIAG_PUSH_NEEDS_COMMENT; -+ DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); - b = invsqrtpi * temp / sqrtl (x); -+ DIAG_POP_NEEDS_COMMENT; - } - else - { diff --git a/external/poky/meta/recipes-core/glibc/glibc/0032-sysdeps-ieee754-soft-fp-ignore-maybe-uninitialized-w.patch b/external/poky/meta/recipes-core/glibc/glibc/0032-sysdeps-ieee754-soft-fp-ignore-maybe-uninitialized-w.patch deleted file mode 100644 index 99cd2509..00000000 --- a/external/poky/meta/recipes-core/glibc/glibc/0032-sysdeps-ieee754-soft-fp-ignore-maybe-uninitialized-w.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 618668540e263c09b0eb28131dde7b4500158fd4 Mon Sep 17 00:00:00 2001 -From: Martin Jansa <Martin.Jansa@gmail.com> -Date: Sun, 16 Sep 2018 12:39:22 +0000 -Subject: [PATCH] sysdeps/ieee754/soft-fp: ignore maybe-uninitialized with -O - [BZ #19444] - -* with -O, -O1, -Os it fails with: - -In file included from ../soft-fp/soft-fp.h:318, - from ../sysdeps/ieee754/soft-fp/s_fdiv.c:28: -../sysdeps/ieee754/soft-fp/s_fdiv.c: In function '__fdiv': -../soft-fp/op-2.h:98:25: error: 'R_f1' may be used uninitialized in this function [-Werror=maybe-uninitialized] - X##_f0 = (X##_f1 << (_FP_W_TYPE_SIZE - (N)) | X##_f0 >> (N) \ - ^~ -../sysdeps/ieee754/soft-fp/s_fdiv.c:38:14: note: 'R_f1' was declared here - FP_DECL_D (R); - ^ -../soft-fp/op-2.h:37:36: note: in definition of macro '_FP_FRAC_DECL_2' - _FP_W_TYPE X##_f0 _FP_ZERO_INIT, X##_f1 _FP_ZERO_INIT - ^ -../soft-fp/double.h:95:24: note: in expansion of macro '_FP_DECL' - # define FP_DECL_D(X) _FP_DECL (2, X) - ^~~~~~~~ -../sysdeps/ieee754/soft-fp/s_fdiv.c:38:3: note: in expansion of macro 'FP_DECL_D' - FP_DECL_D (R); - ^~~~~~~~~ -../soft-fp/op-2.h:101:17: error: 'R_f0' may be used uninitialized in this function [-Werror=maybe-uninitialized] - : (X##_f0 << (_FP_W_TYPE_SIZE - (N))) != 0)); \ - ^~ -../sysdeps/ieee754/soft-fp/s_fdiv.c:38:14: note: 'R_f0' was declared here - FP_DECL_D (R); - ^ -../soft-fp/op-2.h:37:14: note: in definition of macro '_FP_FRAC_DECL_2' - _FP_W_TYPE X##_f0 _FP_ZERO_INIT, X##_f1 _FP_ZERO_INIT - ^ -../soft-fp/double.h:95:24: note: in expansion of macro '_FP_DECL' - # define FP_DECL_D(X) _FP_DECL (2, X) - ^~~~~~~~ -../sysdeps/ieee754/soft-fp/s_fdiv.c:38:3: note: in expansion of macro 'FP_DECL_D' - FP_DECL_D (R); - ^~~~~~~~~ - -Build tested with Yocto for ARM, AARCH64, X86, X86_64, PPC, MIPS, MIPS64 -with -O, -O1, -Os. -For AARCH64 it needs one more fix in locale for -Os. - - Partial fix for [BZ #23716] - * sysdeps/ieee754/soft-fp/s_fdiv.c: Fix build with -O - -Work around the issue instead of removing -O like we do with -SELECTED_OPTIMIZATION - -Upstream-Status: Submitted [https://www.sourceware.org/ml/libc-alpha/2018-09/msg00300.html] - -Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> ---- - ChangeLog | 4 ++++ - sysdeps/ieee754/soft-fp/s_fdiv.c | 12 ++++++++++++ - 2 files changed, 16 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 922e916f2c..216336edc9 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2018-09-30 Martin Jansa <Martin.Jansa@gmail.com> -+ Partial fix for [BZ #23716] -+ * sysdeps/ieee754/soft-fp/s_fdiv.c: Fix build with -O. -+ - 2018-09-29 Martin Jansa <Martin.Jansa@gmail.com> - Partial fix for [BZ #23716] - * sysdeps/ieee754/dbl-96/e_jnl.c: Fix build with -O -diff --git a/sysdeps/ieee754/soft-fp/s_fdiv.c b/sysdeps/ieee754/soft-fp/s_fdiv.c -index 341339f5ed..14655b77da 100644 ---- a/sysdeps/ieee754/soft-fp/s_fdiv.c -+++ b/sysdeps/ieee754/soft-fp/s_fdiv.c -@@ -25,6 +25,16 @@ - #undef fdivl - - #include <math-narrow.h> -+ -+#include <libc-diag.h> -+/* R_f[01] are not set in cases where it is not used in packing, but the -+ compiler does not see that it is set in all cases where it is -+ used, resulting in warnings that it may be used uninitialized. -+ The location of the warning differs in different versions of GCC, -+ it may be where R is defined using a macro or it may be where the -+ macro is defined. */ -+DIAG_PUSH_NEEDS_COMMENT; -+DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); - #include <soft-fp.h> - #include <single.h> - #include <double.h> -@@ -53,4 +63,6 @@ __fdiv (double x, double y) - CHECK_NARROW_DIV (ret, x, y); - return ret; - } -+DIAG_POP_NEEDS_COMMENT; -+ - libm_alias_float_double (div) diff --git a/external/poky/meta/recipes-core/glibc/glibc/CVE-2016-10739.patch b/external/poky/meta/recipes-core/glibc/glibc/CVE-2016-10739.patch deleted file mode 100644 index 7dc84288..00000000 --- a/external/poky/meta/recipes-core/glibc/glibc/CVE-2016-10739.patch +++ /dev/null @@ -1,1136 +0,0 @@ -CVE: CVE-2016-10739 -Upstream-Status: Backport -Signed-off-by: Ross Burton <ross.burton@intel.com> - -From 8e92ca5dd7a7e38a4dddf1ebc4e1e8f0cb27e4aa Mon Sep 17 00:00:00 2001 -From: Florian Weimer <fweimer@redhat.com> -Date: Mon, 21 Jan 2019 08:59:42 +0100 -Subject: [PATCH 1/4] resolv: Reformat inet_addr, inet_aton to GNU style - -(cherry picked from commit 5e30b8ef0758763effa115634e0ed7d8938e4bc0) ---- - ChangeLog | 5 ++ - resolv/inet_addr.c | 192 ++++++++++++++++++++++++--------------------- - 2 files changed, 106 insertions(+), 91 deletions(-) - -diff --git a/resolv/inet_addr.c b/resolv/inet_addr.c -index 022f7ea084..32f58b0e13 100644 ---- a/resolv/inet_addr.c -+++ b/resolv/inet_addr.c -@@ -1,3 +1,21 @@ -+/* Legacy IPv4 text-to-address functions. -+ Copyright (C) 2019 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ <http://www.gnu.org/licenses/>. */ -+ - /* - * Copyright (c) 1983, 1990, 1993 - * The Regents of the University of California. All rights reserved. -@@ -78,105 +96,97 @@ - #include <limits.h> - #include <errno.h> - --/* -- * Ascii internet address interpretation routine. -- * The value returned is in network order. -- */ -+/* ASCII IPv4 Internet address interpretation routine. The value -+ returned is in network order. */ - in_addr_t --__inet_addr(const char *cp) { -- struct in_addr val; -+__inet_addr (const char *cp) -+{ -+ struct in_addr val; - -- if (__inet_aton(cp, &val)) -- return (val.s_addr); -- return (INADDR_NONE); -+ if (__inet_aton (cp, &val)) -+ return val.s_addr; -+ return INADDR_NONE; - } - weak_alias (__inet_addr, inet_addr) - --/* -- * Check whether "cp" is a valid ascii representation -- * of an Internet address and convert to a binary address. -- * Returns 1 if the address is valid, 0 if not. -- * This replaces inet_addr, the return value from which -- * cannot distinguish between failure and a local broadcast address. -- */ -+/* Check whether "cp" is a valid ASCII representation of an IPv4 -+ Internet address and convert it to a binary address. Returns 1 if -+ the address is valid, 0 if not. This replaces inet_addr, the -+ return value from which cannot distinguish between failure and a -+ local broadcast address. */ - int --__inet_aton(const char *cp, struct in_addr *addr) -+__inet_aton (const char *cp, struct in_addr *addr) - { -- static const in_addr_t max[4] = { 0xffffffff, 0xffffff, 0xffff, 0xff }; -- in_addr_t val; -- char c; -- union iaddr { -- uint8_t bytes[4]; -- uint32_t word; -- } res; -- uint8_t *pp = res.bytes; -- int digit; -- -- int saved_errno = errno; -- __set_errno (0); -- -- res.word = 0; -- -- c = *cp; -- for (;;) { -- /* -- * Collect number up to ``.''. -- * Values are specified as for C: -- * 0x=hex, 0=octal, isdigit=decimal. -- */ -- if (!isdigit(c)) -- goto ret_0; -- { -- char *endp; -- unsigned long ul = strtoul (cp, (char **) &endp, 0); -- if (ul == ULONG_MAX && errno == ERANGE) -- goto ret_0; -- if (ul > 0xfffffffful) -- goto ret_0; -- val = ul; -- digit = cp != endp; -- cp = endp; -- } -- c = *cp; -- if (c == '.') { -- /* -- * Internet format: -- * a.b.c.d -- * a.b.c (with c treated as 16 bits) -- * a.b (with b treated as 24 bits) -- */ -- if (pp > res.bytes + 2 || val > 0xff) -- goto ret_0; -- *pp++ = val; -- c = *++cp; -- } else -- break; -- } -- /* -- * Check for trailing characters. -- */ -- if (c != '\0' && (!isascii(c) || !isspace(c))) -- goto ret_0; -- /* -- * Did we get a valid digit? -- */ -- if (!digit) -- goto ret_0; -- -- /* Check whether the last part is in its limits depending on -- the number of parts in total. */ -- if (val > max[pp - res.bytes]) -+ static const in_addr_t max[4] = { 0xffffffff, 0xffffff, 0xffff, 0xff }; -+ in_addr_t val; -+ char c; -+ union iaddr -+ { -+ uint8_t bytes[4]; -+ uint32_t word; -+ } res; -+ uint8_t *pp = res.bytes; -+ int digit; -+ -+ int saved_errno = errno; -+ __set_errno (0); -+ -+ res.word = 0; -+ -+ c = *cp; -+ for (;;) -+ { -+ /* Collect number up to ``.''. Values are specified as for C: -+ 0x=hex, 0=octal, isdigit=decimal. */ -+ if (!isdigit (c)) -+ goto ret_0; -+ { -+ char *endp; -+ unsigned long ul = strtoul (cp, &endp, 0); -+ if (ul == ULONG_MAX && errno == ERANGE) - goto ret_0; -- -- if (addr != NULL) -- addr->s_addr = res.word | htonl (val); -- -- __set_errno (saved_errno); -- return (1); -- --ret_0: -- __set_errno (saved_errno); -- return (0); -+ if (ul > 0xfffffffful) -+ goto ret_0; -+ val = ul; -+ digit = cp != endp; -+ cp = endp; -+ } -+ c = *cp; -+ if (c == '.') -+ { -+ /* Internet format: -+ a.b.c.d -+ a.b.c (with c treated as 16 bits) -+ a.b (with b treated as 24 bits). */ -+ if (pp > res.bytes + 2 || val > 0xff) -+ goto ret_0; -+ *pp++ = val; -+ c = *++cp; -+ } -+ else -+ break; -+ } -+ /* Check for trailing characters. */ -+ if (c != '\0' && (!isascii (c) || !isspace (c))) -+ goto ret_0; -+ /* Did we get a valid digit? */ -+ if (!digit) -+ goto ret_0; -+ -+ /* Check whether the last part is in its limits depending on the -+ number of parts in total. */ -+ if (val > max[pp - res.bytes]) -+ goto ret_0; -+ -+ if (addr != NULL) -+ addr->s_addr = res.word | htonl (val); -+ -+ __set_errno (saved_errno); -+ return 1; -+ -+ ret_0: -+ __set_errno (saved_errno); -+ return 0; - } - weak_alias (__inet_aton, inet_aton) - libc_hidden_def (__inet_aton) --- -2.20.1 - - -From 37edf1d3f8ab9adefb61cc466ac52b53114fbd5b Mon Sep 17 00:00:00 2001 -From: Florian Weimer <fweimer@redhat.com> -Date: Mon, 21 Jan 2019 09:26:41 +0100 -Subject: [PATCH 2/4] resolv: Do not send queries for non-host-names in nss_dns - [BZ #24112] - -Before this commit, nss_dns would send a query which did not contain a -host name as the query name (such as invalid\032name.example.com) and -then reject the answer in getanswer_r and gaih_getanswer_slice, using -a check based on res_hnok. With this commit, no query is sent, and a -host-not-found error is returned to NSS without network interaction. - -(cherry picked from commit 6ca53a2453598804a2559a548a08424fca96434a) ---- - ChangeLog | 9 +++++++++ - resolv/nss_dns/dns-host.c | 24 ++++++++++++++++++++++-- - 2 files changed, 31 insertions(+), 2 deletions(-) - -diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c -index 5dc2829cd1..99c3b61e1c 100644 ---- a/resolv/nss_dns/dns-host.c -+++ b/resolv/nss_dns/dns-host.c -@@ -274,11 +274,26 @@ gethostbyname3_context (struct resolv_context *ctx, - return status; - } - -+/* Verify that the name looks like a host name. There is no point in -+ sending a query which will not produce a usable name in the -+ response. */ -+static enum nss_status -+check_name (const char *name, int *h_errnop) -+{ -+ if (res_hnok (name)) -+ return NSS_STATUS_SUCCESS; -+ *h_errnop = HOST_NOT_FOUND; -+ return NSS_STATUS_NOTFOUND; -+} -+ - enum nss_status - _nss_dns_gethostbyname2_r (const char *name, int af, struct hostent *result, - char *buffer, size_t buflen, int *errnop, - int *h_errnop) - { -+ enum nss_status status = check_name (name, h_errnop); -+ if (status != NSS_STATUS_SUCCESS) -+ return status; - return _nss_dns_gethostbyname3_r (name, af, result, buffer, buflen, errnop, - h_errnop, NULL, NULL); - } -@@ -289,6 +304,9 @@ _nss_dns_gethostbyname_r (const char *name, struct hostent *result, - char *buffer, size_t buflen, int *errnop, - int *h_errnop) - { -+ enum nss_status status = check_name (name, h_errnop); -+ if (status != NSS_STATUS_SUCCESS) -+ return status; - struct resolv_context *ctx = __resolv_context_get (); - if (ctx == NULL) - { -@@ -296,7 +314,7 @@ _nss_dns_gethostbyname_r (const char *name, struct hostent *result, - *h_errnop = NETDB_INTERNAL; - return NSS_STATUS_UNAVAIL; - } -- enum nss_status status = NSS_STATUS_NOTFOUND; -+ status = NSS_STATUS_NOTFOUND; - if (res_use_inet6 ()) - status = gethostbyname3_context (ctx, name, AF_INET6, result, buffer, - buflen, errnop, h_errnop, NULL, NULL); -@@ -313,6 +331,9 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, - char *buffer, size_t buflen, int *errnop, - int *herrnop, int32_t *ttlp) - { -+ enum nss_status status = check_name (name, herrnop); -+ if (status != NSS_STATUS_SUCCESS) -+ return status; - struct resolv_context *ctx = __resolv_context_get (); - if (ctx == NULL) - { -@@ -347,7 +368,6 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, - int ans2p_malloced = 0; - - int olderr = errno; -- enum nss_status status; - int n = __res_context_search (ctx, name, C_IN, T_QUERY_A_AND_AAAA, - host_buffer.buf->buf, 2048, &host_buffer.ptr, - &ans2p, &nans2p, &resplen2, &ans2p_malloced); --- -2.20.1 - - -From 2373941bd73cb288c8a42a33e23e7f7bb81151e7 Mon Sep 17 00:00:00 2001 -From: Florian Weimer <fweimer@redhat.com> -Date: Mon, 21 Jan 2019 21:26:03 +0100 -Subject: [PATCH 3/4] CVE-2016-10739: getaddrinfo: Fully parse IPv4 address - strings [BZ #20018] - -The IPv4 address parser in the getaddrinfo function is changed so that -it does not ignore trailing whitespace and all characters after it. -For backwards compatibility, the getaddrinfo function still recognizes -legacy name syntax, such as 192.000.002.010 interpreted as 192.0.2.8 -(octal). - -This commit does not change the behavior of inet_addr and inet_aton. -gethostbyname already had additional sanity checks (but is switched -over to the new __inet_aton_exact function for completeness as well). - -To avoid sending the problematic query names over DNS, commit -6ca53a2453598804a2559a548a08424fca96434a ("resolv: Do not send queries -for non-host-names in nss_dns [BZ #24112]") is needed. - -(cherry picked from commit 108bc4049f8ae82710aec26a92ffdb4b439c83fd) ---- - ChangeLog | 33 ++++++++ - NEWS | 4 + - include/arpa/inet.h | 6 +- - nscd/gai.c | 1 - - nscd/gethstbynm3_r.c | 2 - - nss/digits_dots.c | 3 +- - resolv/Makefile | 7 ++ - resolv/Versions | 1 + - resolv/inet_addr.c | 62 ++++++++++----- - resolv/res_init.c | 17 ++-- - resolv/tst-aton.c | 35 +++++++-- - resolv/tst-inet_aton_exact.c | 47 +++++++++++ - resolv/tst-resolv-nondecimal.c | 139 +++++++++++++++++++++++++++++++++ - resolv/tst-resolv-trailing.c | 136 ++++++++++++++++++++++++++++++++ - sysdeps/posix/getaddrinfo.c | 2 +- - 15 files changed, 455 insertions(+), 40 deletions(-) - create mode 100644 resolv/tst-inet_aton_exact.c - create mode 100644 resolv/tst-resolv-nondecimal.c - create mode 100644 resolv/tst-resolv-trailing.c - -diff --git a/include/arpa/inet.h b/include/arpa/inet.h -index c3f28f2baa..19aec74275 100644 ---- a/include/arpa/inet.h -+++ b/include/arpa/inet.h -@@ -1,10 +1,10 @@ - #include <inet/arpa/inet.h> - - #ifndef _ISOMAC --extern int __inet_aton (const char *__cp, struct in_addr *__inp); --libc_hidden_proto (__inet_aton) -+/* Variant of inet_aton which rejects trailing garbage. */ -+extern int __inet_aton_exact (const char *__cp, struct in_addr *__inp); -+libc_hidden_proto (__inet_aton_exact) - --libc_hidden_proto (inet_aton) - libc_hidden_proto (inet_ntop) - libc_hidden_proto (inet_pton) - extern __typeof (inet_pton) __inet_pton; -diff --git a/nscd/gai.c b/nscd/gai.c -index 24bdfee1db..f57f396f57 100644 ---- a/nscd/gai.c -+++ b/nscd/gai.c -@@ -19,7 +19,6 @@ - - /* This file uses the getaddrinfo code but it compiles it without NSCD - support. We just need a few symbol renames. */ --#define __inet_aton inet_aton - #define __ioctl ioctl - #define __getsockname getsockname - #define __socket socket -diff --git a/nscd/gethstbynm3_r.c b/nscd/gethstbynm3_r.c -index 7beb9dce9f..f792c4fcd0 100644 ---- a/nscd/gethstbynm3_r.c -+++ b/nscd/gethstbynm3_r.c -@@ -38,8 +38,6 @@ - #define HAVE_LOOKUP_BUFFER 1 - #define HAVE_AF 1 - --#define __inet_aton inet_aton -- - /* We are nscd, so we don't want to be talking to ourselves. */ - #undef USE_NSCD - -diff --git a/nss/digits_dots.c b/nss/digits_dots.c -index 39bff38865..5441bce16e 100644 ---- a/nss/digits_dots.c -+++ b/nss/digits_dots.c -@@ -29,7 +29,6 @@ - #include "nsswitch.h" - - #ifdef USE_NSCD --# define inet_aton __inet_aton - # include <nscd/nscd_proto.h> - #endif - -@@ -160,7 +159,7 @@ __nss_hostname_digits_dots_context (struct resolv_context *ctx, - 255.255.255.255? The test below will succeed - spuriously... ??? */ - if (af == AF_INET) -- ok = __inet_aton (name, (struct in_addr *) host_addr); -+ ok = __inet_aton_exact (name, (struct in_addr *) host_addr); - else - { - assert (af == AF_INET6); -diff --git a/resolv/Makefile b/resolv/Makefile -index ea395ac3eb..d36eedd34a 100644 ---- a/resolv/Makefile -+++ b/resolv/Makefile -@@ -34,6 +34,9 @@ routines := herror inet_addr inet_ntop inet_pton nsap_addr res_init \ - tests = tst-aton tst-leaks tst-inet_ntop - xtests = tst-leaks2 - -+tests-internal += tst-inet_aton_exact -+ -+ - generate := mtrace-tst-leaks.out tst-leaks.mtrace tst-leaks2.mtrace - - extra-libs := libresolv libnss_dns -@@ -54,8 +57,10 @@ tests += \ - tst-resolv-binary \ - tst-resolv-edns \ - tst-resolv-network \ -+ tst-resolv-nondecimal \ - tst-resolv-res_init-multi \ - tst-resolv-search \ -+ tst-resolv-trailing \ - - # These tests need libdl. - ifeq (yes,$(build-shared)) -@@ -190,9 +195,11 @@ $(objpfx)tst-resolv-res_init-multi: $(objpfx)libresolv.so \ - $(shared-thread-library) - $(objpfx)tst-resolv-res_init-thread: $(libdl) $(objpfx)libresolv.so \ - $(shared-thread-library) -+$(objpfx)tst-resolv-nondecimal: $(objpfx)libresolv.so $(shared-thread-library) - $(objpfx)tst-resolv-qtypes: $(objpfx)libresolv.so $(shared-thread-library) - $(objpfx)tst-resolv-rotate: $(objpfx)libresolv.so $(shared-thread-library) - $(objpfx)tst-resolv-search: $(objpfx)libresolv.so $(shared-thread-library) -+$(objpfx)tst-resolv-trailing: $(objpfx)libresolv.so $(shared-thread-library) - $(objpfx)tst-resolv-threads: \ - $(libdl) $(objpfx)libresolv.so $(shared-thread-library) - $(objpfx)tst-resolv-canonname: \ -diff --git a/resolv/Versions b/resolv/Versions -index b05778d965..9a82704af7 100644 ---- a/resolv/Versions -+++ b/resolv/Versions -@@ -27,6 +27,7 @@ libc { - __h_errno; __resp; - - __res_iclose; -+ __inet_aton_exact; - __inet_pton_length; - __resolv_context_get; - __resolv_context_get_preinit; -diff --git a/resolv/inet_addr.c b/resolv/inet_addr.c -index 32f58b0e13..41b6166a5b 100644 ---- a/resolv/inet_addr.c -+++ b/resolv/inet_addr.c -@@ -96,26 +96,14 @@ - #include <limits.h> - #include <errno.h> - --/* ASCII IPv4 Internet address interpretation routine. The value -- returned is in network order. */ --in_addr_t --__inet_addr (const char *cp) --{ -- struct in_addr val; -- -- if (__inet_aton (cp, &val)) -- return val.s_addr; -- return INADDR_NONE; --} --weak_alias (__inet_addr, inet_addr) -- - /* Check whether "cp" is a valid ASCII representation of an IPv4 - Internet address and convert it to a binary address. Returns 1 if - the address is valid, 0 if not. This replaces inet_addr, the - return value from which cannot distinguish between failure and a -- local broadcast address. */ --int --__inet_aton (const char *cp, struct in_addr *addr) -+ local broadcast address. Write a pointer to the first -+ non-converted character to *endp. */ -+static int -+inet_aton_end (const char *cp, struct in_addr *addr, const char **endp) - { - static const in_addr_t max[4] = { 0xffffffff, 0xffffff, 0xffff, 0xff }; - in_addr_t val; -@@ -180,6 +168,7 @@ __inet_aton (const char *cp, struct in_addr *addr) - - if (addr != NULL) - addr->s_addr = res.word | htonl (val); -+ *endp = cp; - - __set_errno (saved_errno); - return 1; -@@ -188,6 +177,41 @@ __inet_aton (const char *cp, struct in_addr *addr) - __set_errno (saved_errno); - return 0; - } --weak_alias (__inet_aton, inet_aton) --libc_hidden_def (__inet_aton) --libc_hidden_weak (inet_aton) -+ -+int -+__inet_aton_exact (const char *cp, struct in_addr *addr) -+{ -+ struct in_addr val; -+ const char *endp; -+ /* Check that inet_aton_end parsed the entire string. */ -+ if (inet_aton_end (cp, &val, &endp) != 0 && *endp == 0) -+ { -+ *addr = val; -+ return 1; -+ } -+ else -+ return 0; -+} -+libc_hidden_def (__inet_aton_exact) -+ -+/* inet_aton ignores trailing garbage. */ -+int -+__inet_aton_ignore_trailing (const char *cp, struct in_addr *addr) -+{ -+ const char *endp; -+ return inet_aton_end (cp, addr, &endp); -+} -+weak_alias (__inet_aton_ignore_trailing, inet_aton) -+ -+/* ASCII IPv4 Internet address interpretation routine. The value -+ returned is in network order. */ -+in_addr_t -+__inet_addr (const char *cp) -+{ -+ struct in_addr val; -+ const char *endp; -+ if (inet_aton_end (cp, &val, &endp)) -+ return val.s_addr; -+ return INADDR_NONE; -+} -+weak_alias (__inet_addr, inet_addr) -diff --git a/resolv/res_init.c b/resolv/res_init.c -index f5e52cbbb9..94743a252e 100644 ---- a/resolv/res_init.c -+++ b/resolv/res_init.c -@@ -399,8 +399,16 @@ res_vinit_1 (FILE *fp, struct resolv_conf_parser *parser) - cp = parser->buffer + sizeof ("nameserver") - 1; - while (*cp == ' ' || *cp == '\t') - cp++; -+ -+ /* Ignore trailing contents on the name server line. */ -+ { -+ char *el; -+ if ((el = strpbrk (cp, " \t\n")) != NULL) -+ *el = '\0'; -+ } -+ - struct sockaddr *sa; -- if ((*cp != '\0') && (*cp != '\n') && __inet_aton (cp, &a)) -+ if ((*cp != '\0') && (*cp != '\n') && __inet_aton_exact (cp, &a)) - { - sa = allocate_address_v4 (a, NAMESERVER_PORT); - if (sa == NULL) -@@ -410,9 +418,6 @@ res_vinit_1 (FILE *fp, struct resolv_conf_parser *parser) - { - struct in6_addr a6; - char *el; -- -- if ((el = strpbrk (cp, " \t\n")) != NULL) -- *el = '\0'; - if ((el = strchr (cp, SCOPE_DELIMITER)) != NULL) - *el = '\0'; - if ((*cp != '\0') && (__inet_pton (AF_INET6, cp, &a6) > 0)) -@@ -472,7 +477,7 @@ res_vinit_1 (FILE *fp, struct resolv_conf_parser *parser) - char separator = *cp; - *cp = 0; - struct resolv_sortlist_entry e; -- if (__inet_aton (net, &a)) -+ if (__inet_aton_exact (net, &a)) - { - e.addr = a; - if (is_sort_mask (separator)) -@@ -484,7 +489,7 @@ res_vinit_1 (FILE *fp, struct resolv_conf_parser *parser) - cp++; - separator = *cp; - *cp = 0; -- if (__inet_aton (net, &a)) -+ if (__inet_aton_exact (net, &a)) - e.mask = a.s_addr; - else - e.mask = net_mask (e.addr); -diff --git a/resolv/tst-aton.c b/resolv/tst-aton.c -index 08110a007a..eb734d7758 100644 ---- a/resolv/tst-aton.c -+++ b/resolv/tst-aton.c -@@ -1,11 +1,29 @@ -+/* Test legacy IPv4 text-to-address function inet_aton. -+ Copyright (C) 1998-2019 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ <http://www.gnu.org/licenses/>. */ -+ -+#include <array_length.h> - #include <stdio.h> - #include <stdint.h> - #include <sys/socket.h> - #include <netinet/in.h> - #include <arpa/inet.h> - -- --static struct tests -+static const struct tests - { - const char *input; - int valid; -@@ -16,6 +34,7 @@ static struct tests - { "-1", 0, 0 }, - { "256", 1, 0x00000100 }, - { "256.", 0, 0 }, -+ { "255a", 0, 0 }, - { "256a", 0, 0 }, - { "0x100", 1, 0x00000100 }, - { "0200.0x123456", 1, 0x80123456 }, -@@ -40,7 +59,12 @@ static struct tests - { "1.2.256.4", 0, 0 }, - { "1.2.3.0x100", 0, 0 }, - { "323543357756889", 0, 0 }, -- { "10.1.2.3.4", 0, 0}, -+ { "10.1.2.3.4", 0, 0 }, -+ { "192.0.2.1", 1, 0xc0000201 }, -+ { "192.0.2.2\nX", 1, 0xc0000202 }, -+ { "192.0.2.3 Y", 1, 0xc0000203 }, -+ { "192.0.2.3Z", 0, 0 }, -+ { "192.000.002.010", 1, 0xc0000208 }, - }; - - -@@ -50,7 +74,7 @@ do_test (void) - int result = 0; - size_t cnt; - -- for (cnt = 0; cnt < sizeof (tests) / sizeof (tests[0]); ++cnt) -+ for (cnt = 0; cnt < array_length (tests); ++cnt) - { - struct in_addr addr; - -@@ -73,5 +97,4 @@ do_test (void) - return result; - } - --#define TEST_FUNCTION do_test () --#include "../test-skeleton.c" -+#include <support/test-driver.c> -diff --git a/resolv/tst-inet_aton_exact.c b/resolv/tst-inet_aton_exact.c -new file mode 100644 -index 0000000000..0fdfa3d6aa ---- /dev/null -+++ b/resolv/tst-inet_aton_exact.c -@@ -0,0 +1,47 @@ -+/* Test internal legacy IPv4 text-to-address function __inet_aton_exact. -+ Copyright (C) 2019 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ <http://www.gnu.org/licenses/>. */ -+ -+#include <arpa/inet.h> -+#include <support/check.h> -+ -+static int -+do_test (void) -+{ -+ struct in_addr addr = { }; -+ -+ TEST_COMPARE (__inet_aton_exact ("192.0.2.1", &addr), 1); -+ TEST_COMPARE (ntohl (addr.s_addr), 0xC0000201); -+ -+ TEST_COMPARE (__inet_aton_exact ("192.000.002.010", &addr), 1); -+ TEST_COMPARE (ntohl (addr.s_addr), 0xC0000208); -+ TEST_COMPARE (__inet_aton_exact ("0xC0000234", &addr), 1); -+ TEST_COMPARE (ntohl (addr.s_addr), 0xC0000234); -+ -+ /* Trailing content is not accepted. */ -+ TEST_COMPARE (__inet_aton_exact ("192.0.2.2X", &addr), 0); -+ TEST_COMPARE (__inet_aton_exact ("192.0.2.3 Y", &addr), 0); -+ TEST_COMPARE (__inet_aton_exact ("192.0.2.4\nZ", &addr), 0); -+ TEST_COMPARE (__inet_aton_exact ("192.0.2.5\tT", &addr), 0); -+ TEST_COMPARE (__inet_aton_exact ("192.0.2.6 Y", &addr), 0); -+ TEST_COMPARE (__inet_aton_exact ("192.0.2.7\n", &addr), 0); -+ TEST_COMPARE (__inet_aton_exact ("192.0.2.8\t", &addr), 0); -+ -+ return 0; -+} -+ -+#include <support/test-driver.c> -diff --git a/resolv/tst-resolv-nondecimal.c b/resolv/tst-resolv-nondecimal.c -new file mode 100644 -index 0000000000..a0df6f332a ---- /dev/null -+++ b/resolv/tst-resolv-nondecimal.c -@@ -0,0 +1,139 @@ -+/* Test name resolution behavior for octal, hexadecimal IPv4 addresses. -+ Copyright (C) 2019 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ <http://www.gnu.org/licenses/>. */ -+ -+#include <netdb.h> -+#include <stdlib.h> -+#include <support/check.h> -+#include <support/check_nss.h> -+#include <support/resolv_test.h> -+#include <support/support.h> -+ -+static void -+response (const struct resolv_response_context *ctx, -+ struct resolv_response_builder *b, -+ const char *qname, uint16_t qclass, uint16_t qtype) -+{ -+ /* The tests are not supposed send any DNS queries. */ -+ FAIL_EXIT1 ("unexpected DNS query for %s/%d/%d", qname, qclass, qtype); -+} -+ -+static void -+run_query_addrinfo (const char *query, const char *address) -+{ -+ char *quoted_query = support_quote_string (query); -+ -+ struct addrinfo *ai; -+ struct addrinfo hints = -+ { -+ .ai_socktype = SOCK_STREAM, -+ .ai_protocol = IPPROTO_TCP, -+ }; -+ -+ char *context = xasprintf ("getaddrinfo \"%s\" AF_INET", quoted_query); -+ char *expected = xasprintf ("address: STREAM/TCP %s 80\n", address); -+ hints.ai_family = AF_INET; -+ int ret = getaddrinfo (query, "80", &hints, &ai); -+ check_addrinfo (context, ai, ret, expected); -+ if (ret == 0) -+ freeaddrinfo (ai); -+ free (context); -+ -+ context = xasprintf ("getaddrinfo \"%s\" AF_UNSPEC", quoted_query); -+ hints.ai_family = AF_UNSPEC; -+ ret = getaddrinfo (query, "80", &hints, &ai); -+ check_addrinfo (context, ai, ret, expected); -+ if (ret == 0) -+ freeaddrinfo (ai); -+ free (expected); -+ free (context); -+ -+ context = xasprintf ("getaddrinfo \"%s\" AF_INET6", quoted_query); -+ expected = xasprintf ("flags: AI_V4MAPPED\n" -+ "address: STREAM/TCP ::ffff:%s 80\n", -+ address); -+ hints.ai_family = AF_INET6; -+ hints.ai_flags = AI_V4MAPPED; -+ ret = getaddrinfo (query, "80", &hints, &ai); -+ check_addrinfo (context, ai, ret, expected); -+ if (ret == 0) -+ freeaddrinfo (ai); -+ free (expected); -+ free (context); -+ -+ free (quoted_query); -+} -+ -+static void -+run_query (const char *query, const char *address) -+{ -+ char *quoted_query = support_quote_string (query); -+ char *context = xasprintf ("gethostbyname (\"%s\")", quoted_query); -+ char *expected = xasprintf ("name: %s\n" -+ "address: %s\n", query, address); -+ check_hostent (context, gethostbyname (query), expected); -+ free (context); -+ -+ context = xasprintf ("gethostbyname_r \"%s\"", quoted_query); -+ struct hostent storage; -+ char buf[4096]; -+ struct hostent *e = NULL; -+ TEST_COMPARE (gethostbyname_r (query, &storage, buf, sizeof (buf), -+ &e, &h_errno), 0); -+ check_hostent (context, e, expected); -+ free (context); -+ -+ context = xasprintf ("gethostbyname2 (\"%s\", AF_INET)", quoted_query); -+ check_hostent (context, gethostbyname2 (query, AF_INET), expected); -+ free (context); -+ -+ context = xasprintf ("gethostbyname2_r \"%s\" AF_INET", quoted_query); -+ e = NULL; -+ TEST_COMPARE (gethostbyname2_r (query, AF_INET, &storage, buf, sizeof (buf), -+ &e, &h_errno), 0); -+ check_hostent (context, e, expected); -+ free (context); -+ free (expected); -+ -+ free (quoted_query); -+ -+ /* The gethostbyname tests are always valid for getaddrinfo, but not -+ vice versa. */ -+ run_query_addrinfo (query, address); -+} -+ -+static int -+do_test (void) -+{ -+ struct resolv_test *aux = resolv_test_start -+ ((struct resolv_redirect_config) -+ { -+ .response_callback = response, -+ }); -+ -+ run_query ("192.000.002.010", "192.0.2.8"); -+ -+ /* Hexadecimal numbers are not accepted by gethostbyname. */ -+ run_query_addrinfo ("0xc0000210", "192.0.2.16"); -+ run_query_addrinfo ("192.0x234", "192.0.2.52"); -+ -+ resolv_test_end (aux); -+ -+ return 0; -+} -+ -+#include <support/test-driver.c> -diff --git a/resolv/tst-resolv-trailing.c b/resolv/tst-resolv-trailing.c -new file mode 100644 -index 0000000000..7504bdae57 ---- /dev/null -+++ b/resolv/tst-resolv-trailing.c -@@ -0,0 +1,136 @@ -+/* Test name resolution behavior with trailing characters. -+ Copyright (C) 2019 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ <http://www.gnu.org/licenses/>. */ -+ -+#include <array_length.h> -+#include <netdb.h> -+#include <support/check.h> -+#include <support/check_nss.h> -+#include <support/resolv_test.h> -+#include <support/support.h> -+ -+static void -+response (const struct resolv_response_context *ctx, -+ struct resolv_response_builder *b, -+ const char *qname, uint16_t qclass, uint16_t qtype) -+{ -+ /* The tests are not supposed send any DNS queries. */ -+ FAIL_EXIT1 ("unexpected DNS query for %s/%d/%d", qname, qclass, qtype); -+} -+ -+static int -+do_test (void) -+{ -+ struct resolv_test *aux = resolv_test_start -+ ((struct resolv_redirect_config) -+ { -+ .response_callback = response, -+ }); -+ -+ static const char *const queries[] = -+ { -+ "192.0.2.1 ", -+ "192.0.2.2\t", -+ "192.0.2.3\n", -+ "192.0.2.4 X", -+ "192.0.2.5\tY", -+ "192.0.2.6\nZ", -+ "192.0.2. ", -+ "192.0.2.\t", -+ "192.0.2.\n", -+ "192.0.2. X", -+ "192.0.2.\tY", -+ "192.0.2.\nZ", -+ "2001:db8::1 ", -+ "2001:db8::2\t", -+ "2001:db8::3\n", -+ "2001:db8::4 X", -+ "2001:db8::5\tY", -+ "2001:db8::6\nZ", -+ }; -+ for (size_t query_idx = 0; query_idx < array_length (queries); ++query_idx) -+ { -+ const char *query = queries[query_idx]; -+ struct hostent storage; -+ char buf[4096]; -+ struct hostent *e; -+ -+ h_errno = 0; -+ TEST_VERIFY (gethostbyname (query) == NULL); -+ TEST_COMPARE (h_errno, HOST_NOT_FOUND); -+ -+ h_errno = 0; -+ e = NULL; -+ TEST_COMPARE (gethostbyname_r (query, &storage, buf, sizeof (buf), -+ &e, &h_errno), 0); -+ TEST_VERIFY (e == NULL); -+ TEST_COMPARE (h_errno, HOST_NOT_FOUND); -+ -+ h_errno = 0; -+ TEST_VERIFY (gethostbyname2 (query, AF_INET) == NULL); -+ TEST_COMPARE (h_errno, HOST_NOT_FOUND); -+ -+ h_errno = 0; -+ e = NULL; -+ TEST_COMPARE (gethostbyname2_r (query, AF_INET, -+ &storage, buf, sizeof (buf), -+ &e, &h_errno), 0); -+ TEST_VERIFY (e == NULL); -+ TEST_COMPARE (h_errno, HOST_NOT_FOUND); -+ -+ h_errno = 0; -+ TEST_VERIFY (gethostbyname2 (query, AF_INET6) == NULL); -+ TEST_COMPARE (h_errno, HOST_NOT_FOUND); -+ -+ h_errno = 0; -+ e = NULL; -+ TEST_COMPARE (gethostbyname2_r (query, AF_INET6, -+ &storage, buf, sizeof (buf), -+ &e, &h_errno), 0); -+ TEST_VERIFY (e == NULL); -+ TEST_COMPARE (h_errno, HOST_NOT_FOUND); -+ -+ static const int gai_flags[] = -+ { -+ 0, -+ AI_ADDRCONFIG, -+ AI_NUMERICHOST, -+ AI_IDN, -+ AI_IDN | AI_NUMERICHOST, -+ AI_V4MAPPED, -+ AI_V4MAPPED | AI_NUMERICHOST, -+ }; -+ for (size_t gai_flags_idx; gai_flags_idx < array_length (gai_flags); -+ ++gai_flags_idx) -+ { -+ struct addrinfo hints = { .ai_flags = gai_flags[gai_flags_idx], }; -+ struct addrinfo *ai; -+ hints.ai_family = AF_INET; -+ TEST_COMPARE (getaddrinfo (query, "80", &hints, &ai), EAI_NONAME); -+ hints.ai_family = AF_INET6; -+ TEST_COMPARE (getaddrinfo (query, "80", &hints, &ai), EAI_NONAME); -+ hints.ai_family = AF_UNSPEC; -+ TEST_COMPARE (getaddrinfo (query, "80", &hints, &ai), EAI_NONAME); -+ } -+ }; -+ -+ resolv_test_end (aux); -+ -+ return 0; -+} -+ -+#include <support/test-driver.c> -diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c -index 553833d1f2..c91b281e31 100644 ---- a/sysdeps/posix/getaddrinfo.c -+++ b/sysdeps/posix/getaddrinfo.c -@@ -488,7 +488,7 @@ gaih_inet (const char *name, const struct gaih_service *service, - malloc_name = true; - } - -- if (__inet_aton (name, (struct in_addr *) at->addr) != 0) -+ if (__inet_aton_exact (name, (struct in_addr *) at->addr) != 0) - { - if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET) - at->family = AF_INET; --- -2.20.1 - - -From c533244b8e00ae701583ec50aeb43377d292452d Mon Sep 17 00:00:00 2001 -From: Florian Weimer <fweimer@redhat.com> -Date: Mon, 4 Feb 2019 20:07:18 +0100 -Subject: [PATCH 4/4] nscd: Do not use __inet_aton_exact@GLIBC_PRIVATE [BZ - #20018] - -This commit avoids referencing the __inet_aton_exact@GLIBC_PRIVATE -symbol from nscd. In master, the separately-compiled getaddrinfo -implementation in nscd needs it, however such an internal ABI change -is not desirable on a release branch if it can be avoided. ---- - ChangeLog | 10 ++++++++++ - nscd/Makefile | 2 +- - nscd/gai.c | 6 ++++++ - nscd/nscd-inet_addr.c | 32 ++++++++++++++++++++++++++++++++ - 4 files changed, 49 insertions(+), 1 deletion(-) - create mode 100644 nscd/nscd-inet_addr.c - -diff --git a/nscd/Makefile b/nscd/Makefile -index b713a84c49..eb23c01a39 100644 ---- a/nscd/Makefile -+++ b/nscd/Makefile -@@ -36,7 +36,7 @@ nscd-modules := nscd connections pwdcache getpwnam_r getpwuid_r grpcache \ - getsrvbynm_r getsrvbypt_r servicescache \ - dbg_log nscd_conf nscd_stat cache mem nscd_setup_thread \ - xmalloc xstrdup aicache initgrcache gai res_hconf \ -- netgroupcache -+ netgroupcache nscd-inet_addr - - ifeq ($(build-nscd)$(have-thread-library),yesyes) - -diff --git a/nscd/gai.c b/nscd/gai.c -index f57f396f57..68a4abd30e 100644 ---- a/nscd/gai.c -+++ b/nscd/gai.c -@@ -33,6 +33,12 @@ - #define __getifaddrs getifaddrs - #define __freeifaddrs freeifaddrs - -+/* We do not want to export __inet_aton_exact. Get the prototype and -+ change its visibility to hidden. */ -+#include <arpa/inet.h> -+__typeof__ (__inet_aton_exact) __inet_aton_exact -+ __attribute__ ((visibility ("hidden"))); -+ - /* We are nscd, so we don't want to be talking to ourselves. */ - #undef USE_NSCD - -diff --git a/nscd/nscd-inet_addr.c b/nscd/nscd-inet_addr.c -new file mode 100644 -index 0000000000..f366b9567d ---- /dev/null -+++ b/nscd/nscd-inet_addr.c -@@ -0,0 +1,32 @@ -+/* Legacy IPv4 text-to-address functions. Version for nscd. -+ Copyright (C) 2019 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ <http://www.gnu.org/licenses/>. */ -+ -+#include <arpa/inet.h> -+ -+/* We do not want to export __inet_aton_exact. Get the prototype and -+ change the visibility to hidden. */ -+#include <arpa/inet.h> -+__typeof__ (__inet_aton_exact) __inet_aton_exact -+ __attribute__ ((visibility ("hidden"))); -+ -+/* Do not provide definitions of the public symbols exported from -+ libc. */ -+#undef weak_alias -+#define weak_alias(from, to) -+ -+#include <resolv/inet_addr.c> --- -2.20.1 diff --git a/external/poky/meta/recipes-core/glibc/glibc/CVE-2018-19591.patch b/external/poky/meta/recipes-core/glibc/glibc/CVE-2018-19591.patch deleted file mode 100644 index 9c78a3df..00000000 --- a/external/poky/meta/recipes-core/glibc/glibc/CVE-2018-19591.patch +++ /dev/null @@ -1,48 +0,0 @@ -CVE: CVE-2018-19591 -Upstream-Status: Backport -Signed-off-by: Ross Burton <ross.burton@intel.com> - -From ce6ba630dbc96f49eb1f30366aa62261df4792f9 Mon Sep 17 00:00:00 2001 -From: Florian Weimer <fweimer@redhat.com> -Date: Tue, 27 Nov 2018 16:12:43 +0100 -Subject: [PATCH] CVE-2018-19591: if_nametoindex: Fix descriptor for overlong - name [BZ #23927] - -(cherry picked from commit d527c860f5a3f0ed687bd03f0cb464612dc23408) ---- - ChangeLog | 7 +++++++ - NEWS | 6 ++++++ - sysdeps/unix/sysv/linux/if_index.c | 11 ++++++----- - 3 files changed, 19 insertions(+), 5 deletions(-) - -diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c -index e3d08982d9..782fc5e175 100644 ---- a/sysdeps/unix/sysv/linux/if_index.c -+++ b/sysdeps/unix/sysv/linux/if_index.c -@@ -38,11 +38,6 @@ __if_nametoindex (const char *ifname) - return 0; - #else - struct ifreq ifr; -- int fd = __opensock (); -- -- if (fd < 0) -- return 0; -- - if (strlen (ifname) >= IFNAMSIZ) - { - __set_errno (ENODEV); -@@ -50,6 +45,12 @@ __if_nametoindex (const char *ifname) - } - - strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); -+ -+ int fd = __opensock (); -+ -+ if (fd < 0) -+ return 0; -+ - if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) - { - int saved_errno = errno; --- -2.11.0 diff --git a/external/poky/meta/recipes-core/glibc/glibc/CVE-2019-6488.patch b/external/poky/meta/recipes-core/glibc/glibc/CVE-2019-6488.patch deleted file mode 100644 index fa423754..00000000 --- a/external/poky/meta/recipes-core/glibc/glibc/CVE-2019-6488.patch +++ /dev/null @@ -1,274 +0,0 @@ -From 718016100d889a986c536b595bf6ec0d6ab4b90e Mon Sep 17 00:00:00 2001 -From: "H.J. Lu" <hjl.tools@gmail.com> -Date: Fri, 1 Feb 2019 12:17:09 -0800 -Subject: [PATCH] x86-64 memchr/wmemchr: Properly handle the length parameter - [BZ #24097] -Reply-To: muislam@microsoft.com - -On x32, the size_t parameter may be passed in the lower 32 bits of a -64-bit register with the non-zero upper 32 bits. The string/memory -functions written in assembly can only use the lower 32 bits of a -64-bit register as length or must clear the upper 32 bits before using -the full 64-bit register for length. - -This pach fixes memchr/wmemchr for x32. Tested on x86-64 and x32. On -x86-64, libc.so is the same with and withou the fix. - - [BZ #24097] - CVE-2019-6488 - * sysdeps/x86_64/memchr.S: Use RDX_LP for length. Clear the - upper 32 bits of RDX register. - * sysdeps/x86_64/multiarch/memchr-avx2.S: Likewise. - * sysdeps/x86_64/x32/Makefile (tests): Add tst-size_t-memchr and - tst-size_t-wmemchr. - * sysdeps/x86_64/x32/test-size_t.h: New file. - * sysdeps/x86_64/x32/tst-size_t-memchr.c: Likewise. - * sysdeps/x86_64/x32/tst-size_t-wmemchr.c: Likewise. - -(cherry picked from commit 97700a34f36721b11a754cf37a1cc40695ece1fd) - -CVE: CVE-2019-6488 - -Upstream-Status: Backport - -Signed-off-by: Muminul Islam <muislam@microsoft.com> ---- - NEWS | 1 - - sysdeps/x86_64/memchr.S | 10 ++-- - sysdeps/x86_64/multiarch/memchr-avx2.S | 8 ++- - sysdeps/x86_64/x32/Makefile | 8 +++ - sysdeps/x86_64/x32/test-size_t.h | 35 ++++++++++++ - sysdeps/x86_64/x32/tst-size_t-memchr.c | 72 +++++++++++++++++++++++++ - sysdeps/x86_64/x32/tst-size_t-wmemchr.c | 20 +++++++ - 7 files changed, 148 insertions(+), 6 deletions(-) - create mode 100644 sysdeps/x86_64/x32/test-size_t.h - create mode 100644 sysdeps/x86_64/x32/tst-size_t-memchr.c - create mode 100644 sysdeps/x86_64/x32/tst-size_t-wmemchr.c - -diff --git a/NEWS b/NEWS -index fd14941128..b158973a30 100644 ---- a/NEWS -+++ b/NEWS -@@ -17,7 +17,6 @@ The following bugs are resolved with this release: - [23606] Missing ENDBR32 in sysdeps/i386/start.S - [23679] gethostid: Missing NULL check for gethostbyname_r result - [23717] Fix stack overflow in stdlib/tst-setcontext9 -- - - Version 2.28 - -diff --git a/sysdeps/x86_64/memchr.S b/sysdeps/x86_64/memchr.S -index feef5d4f24..cb320257a2 100644 ---- a/sysdeps/x86_64/memchr.S -+++ b/sysdeps/x86_64/memchr.S -@@ -34,12 +34,16 @@ ENTRY(MEMCHR) - mov %edi, %ecx - - #ifdef USE_AS_WMEMCHR -- test %rdx, %rdx -+ test %RDX_LP, %RDX_LP - jz L(return_null) -- shl $2, %rdx -+ shl $2, %RDX_LP - #else -+# ifdef __ILP32__ -+ /* Clear the upper 32 bits. */ -+ movl %edx, %edx -+# endif - punpcklbw %xmm1, %xmm1 -- test %rdx, %rdx -+ test %RDX_LP, %RDX_LP - jz L(return_null) - punpcklbw %xmm1, %xmm1 - #endif -diff --git a/sysdeps/x86_64/multiarch/memchr-avx2.S b/sysdeps/x86_64/multiarch/memchr-avx2.S -index 5f5e772554..c81da19bf0 100644 ---- a/sysdeps/x86_64/multiarch/memchr-avx2.S -+++ b/sysdeps/x86_64/multiarch/memchr-avx2.S -@@ -40,16 +40,20 @@ - ENTRY (MEMCHR) - # ifndef USE_AS_RAWMEMCHR - /* Check for zero length. */ -- testq %rdx, %rdx -+ test %RDX_LP, %RDX_LP - jz L(null) - # endif - movl %edi, %ecx - /* Broadcast CHAR to YMM0. */ - vmovd %esi, %xmm0 - # ifdef USE_AS_WMEMCHR -- shl $2, %rdx -+ shl $2, %RDX_LP - vpbroadcastd %xmm0, %ymm0 - # else -+# ifdef __ILP32__ -+ /* Clear the upper 32 bits. */ -+ movl %edx, %edx -+# endif - vpbroadcastb %xmm0, %ymm0 - # endif - /* Check if we may cross page boundary with one vector load. */ -diff --git a/sysdeps/x86_64/x32/Makefile b/sysdeps/x86_64/x32/Makefile -index f2ebc24fb0..7d528889c6 100644 ---- a/sysdeps/x86_64/x32/Makefile -+++ b/sysdeps/x86_64/x32/Makefile -@@ -4,3 +4,11 @@ ifeq ($(subdir),math) - # 64-bit llround. Add -fno-builtin-lround to silence the compiler. - CFLAGS-s_llround.c += -fno-builtin-lround - endif -+ -+ifeq ($(subdir),string) -+tests += tst-size_t-memchr -+endif -+ -+ifeq ($(subdir),wcsmbs) -+tests += tst-size_t-wmemchr -+endif -diff --git a/sysdeps/x86_64/x32/test-size_t.h b/sysdeps/x86_64/x32/test-size_t.h -new file mode 100644 -index 0000000000..78a940863e ---- /dev/null -+++ b/sysdeps/x86_64/x32/test-size_t.h -@@ -0,0 +1,35 @@ -+/* Test string/memory functions with size_t in the lower 32 bits of -+ 64-bit register. -+ Copyright (C) 2019 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ <http://www.gnu.org/licenses/>. */ -+ -+#define TEST_MAIN -+#include <string/test-string.h> -+ -+/* On x32, parameter_t may be passed in a 64-bit register with the LEN -+ field in the lower 32 bits. When the LEN field of 64-bit register -+ is passed to string/memory function as the size_t parameter, only -+ the lower 32 bits can be used. */ -+typedef struct -+{ -+ union -+ { -+ size_t len; -+ void (*fn) (void); -+ }; -+ void *p; -+} parameter_t; -diff --git a/sysdeps/x86_64/x32/tst-size_t-memchr.c b/sysdeps/x86_64/x32/tst-size_t-memchr.c -new file mode 100644 -index 0000000000..29a3daf102 ---- /dev/null -+++ b/sysdeps/x86_64/x32/tst-size_t-memchr.c -@@ -0,0 +1,72 @@ -+/* Test memchr with size_t in the lower 32 bits of 64-bit register. -+ Copyright (C) 2019 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ <http://www.gnu.org/licenses/>. */ -+ -+#ifndef WIDE -+# define TEST_NAME "memchr" -+#else -+# define TEST_NAME "wmemchr" -+#endif /* WIDE */ -+#include "test-size_t.h" -+ -+#ifndef WIDE -+# define MEMCHR memchr -+# define CHAR char -+# define UCHAR unsigned char -+#else -+# include <wchar.h> -+# define MEMCHR wmemchr -+# define CHAR wchar_t -+# define UCHAR wchar_t -+#endif /* WIDE */ -+ -+IMPL (MEMCHR, 1) -+ -+typedef CHAR * (*proto_t) (const CHAR*, int, size_t); -+ -+static CHAR * -+__attribute__ ((noinline, noclone)) -+do_memchr (parameter_t a, parameter_t b) -+{ -+ return CALL (&b, a.p, (uintptr_t) b.p, a.len); -+} -+ -+static int -+test_main (void) -+{ -+ test_init (); -+ -+ parameter_t src = { { page_size / sizeof (CHAR) }, buf2 }; -+ parameter_t c = { { 0 }, (void *) (uintptr_t) 0x12 }; -+ -+ int ret = 0; -+ FOR_EACH_IMPL (impl, 0) -+ { -+ c.fn = impl->fn; -+ CHAR *res = do_memchr (src, c); -+ if (res) -+ { -+ error (0, 0, "Wrong result in function %s: %p != NULL", -+ impl->name, res); -+ ret = 1; -+ } -+ } -+ -+ return ret ? EXIT_FAILURE : EXIT_SUCCESS; -+} -+ -+#include <support/test-driver.c> -diff --git a/sysdeps/x86_64/x32/tst-size_t-wmemchr.c b/sysdeps/x86_64/x32/tst-size_t-wmemchr.c -new file mode 100644 -index 0000000000..877801d646 ---- /dev/null -+++ b/sysdeps/x86_64/x32/tst-size_t-wmemchr.c -@@ -0,0 +1,20 @@ -+/* Test wmemchr with size_t in the lower 32 bits of 64-bit register. -+ Copyright (C) 2019 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ <http://www.gnu.org/licenses/>. */ -+ -+#define WIDE 1 -+#include "tst-size_t-memchr.c" --- -2.23.0 - diff --git a/external/poky/meta/recipes-core/glibc/glibc/CVE-2019-7309.patch b/external/poky/meta/recipes-core/glibc/glibc/CVE-2019-7309.patch deleted file mode 100644 index 04963c29..00000000 --- a/external/poky/meta/recipes-core/glibc/glibc/CVE-2019-7309.patch +++ /dev/null @@ -1,207 +0,0 @@ -From af7f46c45a60e6df754fb6258b546917e61ae6f1 Mon Sep 17 00:00:00 2001 -From: "H.J. Lu" <hjl.tools@gmail.com> -Date: Mon, 4 Feb 2019 08:55:52 -0800 -Subject: [PATCH] x86-64 memcmp: Use unsigned Jcc instructions on size [BZ - #24155] -Reply-To: muislam@microsoft.com - -Since the size argument is unsigned. we should use unsigned Jcc -instructions, instead of signed, to check size. - -Tested on x86-64 and x32, with and without --disable-multi-arch. - - [BZ #24155] - CVE-2019-7309 - * NEWS: Updated for CVE-2019-7309. - * sysdeps/x86_64/memcmp.S: Use RDX_LP for size. Clear the - upper 32 bits of RDX register for x32. Use unsigned Jcc - instructions, instead of signed. - * sysdeps/x86_64/x32/Makefile (tests): Add tst-size_t-memcmp-2. - * sysdeps/x86_64/x32/tst-size_t-memcmp-2.c: New test. - -(cherry picked from commit 3f635fb43389b54f682fc9ed2acc0b2aaf4a923d) - -Signed-off-by: Muminul Islam <muislam@microsoft.com> - -CVE: CVE-2019-7309 - -Upstream-Status: Backport ---- - sysdeps/x86_64/memcmp.S | 20 +++--- - sysdeps/x86_64/x32/Makefile | 2 +- - sysdeps/x86_64/x32/tst-size_t-memcmp-2.c | 79 ++++++++++++++++++++++++ - 3 files changed, 92 insertions(+), 9 deletions(-) - create mode 100644 sysdeps/x86_64/x32/tst-size_t-memcmp-2.c - -diff --git a/sysdeps/x86_64/memcmp.S b/sysdeps/x86_64/memcmp.S -index bcb4a2e88d..45918d375a 100644 ---- a/sysdeps/x86_64/memcmp.S -+++ b/sysdeps/x86_64/memcmp.S -@@ -21,14 +21,18 @@ - - .text - ENTRY (memcmp) -- test %rdx, %rdx -+#ifdef __ILP32__ -+ /* Clear the upper 32 bits. */ -+ movl %edx, %edx -+#endif -+ test %RDX_LP, %RDX_LP - jz L(finz) - cmpq $1, %rdx -- jle L(finr1b) -+ jbe L(finr1b) - subq %rdi, %rsi - movq %rdx, %r10 - cmpq $32, %r10 -- jge L(gt32) -+ jae L(gt32) - /* Handle small chunks and last block of less than 32 bytes. */ - L(small): - testq $1, %r10 -@@ -156,7 +160,7 @@ L(A32): - movq %r11, %r10 - andq $-32, %r10 - cmpq %r10, %rdi -- jge L(mt16) -+ jae L(mt16) - /* Pre-unroll to be ready for unrolled 64B loop. */ - testq $32, %rdi - jz L(A64) -@@ -178,7 +182,7 @@ L(A64): - movq %r11, %r10 - andq $-64, %r10 - cmpq %r10, %rdi -- jge L(mt32) -+ jae L(mt32) - - L(A64main): - movdqu (%rdi,%rsi), %xmm0 -@@ -216,7 +220,7 @@ L(mt32): - movq %r11, %r10 - andq $-32, %r10 - cmpq %r10, %rdi -- jge L(mt16) -+ jae L(mt16) - - L(A32main): - movdqu (%rdi,%rsi), %xmm0 -@@ -254,7 +258,7 @@ L(ATR): - movq %r11, %r10 - andq $-32, %r10 - cmpq %r10, %rdi -- jge L(mt16) -+ jae L(mt16) - testq $16, %rdi - jz L(ATR32) - -@@ -325,7 +329,7 @@ L(ATR64main): - movq %r11, %r10 - andq $-32, %r10 - cmpq %r10, %rdi -- jge L(mt16) -+ jae L(mt16) - - L(ATR32res): - movdqa (%rdi,%rsi), %xmm0 -diff --git a/sysdeps/x86_64/x32/Makefile b/sysdeps/x86_64/x32/Makefile -index 7d528889c6..c9850beeb5 100644 ---- a/sysdeps/x86_64/x32/Makefile -+++ b/sysdeps/x86_64/x32/Makefile -@@ -6,7 +6,7 @@ CFLAGS-s_llround.c += -fno-builtin-lround - endif - - ifeq ($(subdir),string) --tests += tst-size_t-memchr -+tests += tst-size_t-memchr tst-size_t-memcmp-2 - endif - - ifeq ($(subdir),wcsmbs) -diff --git a/sysdeps/x86_64/x32/tst-size_t-memcmp-2.c b/sysdeps/x86_64/x32/tst-size_t-memcmp-2.c -new file mode 100644 -index 0000000000..d8ae1a0813 ---- /dev/null -+++ b/sysdeps/x86_64/x32/tst-size_t-memcmp-2.c -@@ -0,0 +1,79 @@ -+/* Test memcmp with size_t in the lower 32 bits of 64-bit register. -+ Copyright (C) 2019 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ <http://www.gnu.org/licenses/>. */ -+ -+#define TEST_MAIN -+#ifdef WIDE -+# define TEST_NAME "wmemcmp" -+#else -+# define TEST_NAME "memcmp" -+#endif -+ -+#include "test-size_t.h" -+ -+#ifdef WIDE -+# include <inttypes.h> -+# include <wchar.h> -+ -+# define MEMCMP wmemcmp -+# define CHAR wchar_t -+#else -+# define MEMCMP memcmp -+# define CHAR char -+#endif -+ -+IMPL (MEMCMP, 1) -+ -+typedef int (*proto_t) (const CHAR *, const CHAR *, size_t); -+ -+static int -+__attribute__ ((noinline, noclone)) -+do_memcmp (parameter_t a, parameter_t b) -+{ -+ return CALL (&b, a.p, b.p, a.len); -+} -+ -+static int -+test_main (void) -+{ -+ test_init (); -+ -+ parameter_t dest = { { page_size / sizeof (CHAR) }, buf1 }; -+ parameter_t src = { { 0 }, buf2 }; -+ -+ memcpy (buf1, buf2, page_size); -+ -+ CHAR *p = (CHAR *) buf1; -+ p[page_size / sizeof (CHAR) - 1] = (CHAR) 1; -+ -+ int ret = 0; -+ FOR_EACH_IMPL (impl, 0) -+ { -+ src.fn = impl->fn; -+ int res = do_memcmp (dest, src); -+ if (res >= 0) -+ { -+ error (0, 0, "Wrong result in function %s: %i >= 0", -+ impl->name, res); -+ ret = 1; -+ } -+ } -+ -+ return ret ? EXIT_FAILURE : EXIT_SUCCESS; -+} -+ -+#include <support/test-driver.c> --- -2.23.0 - diff --git a/external/poky/meta/recipes-core/glibc/glibc/CVE-2019-9169.patch b/external/poky/meta/recipes-core/glibc/glibc/CVE-2019-9169.patch deleted file mode 100644 index 14cfaa35..00000000 --- a/external/poky/meta/recipes-core/glibc/glibc/CVE-2019-9169.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 583dd860d5b833037175247230a328f0050dbfe9 Mon Sep 17 00:00:00 2001 -From: Paul Eggert <eggert@cs.ucla.edu> -Date: Mon, 21 Jan 2019 11:08:13 -0800 -Subject: [PATCH] regex: fix read overrun [BZ #24114] - -Problem found by AddressSanitizer, reported by Hongxu Chen in: -https://debbugs.gnu.org/34140 -* posix/regexec.c (proceed_next_node): -Do not read past end of input buffer. - -Upstream-Status: Backport -https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=583dd860d5b833037175247230a328f0050dbfe9 - -CVE: CVE-2019-9169 -Signed-off-by: Armin Kuster <akuster@mvista.com> - ---- - ChangeLog | 10 +++++++++- - posix/regexec.c | 6 ++++-- - 2 files changed, 13 insertions(+), 3 deletions(-) - -Index: git/ChangeLog -=================================================================== ---- git.orig/ChangeLog -+++ git/ChangeLog -@@ -1,3 +1,11 @@ -+2019-01-31 Paul Eggert <eggert@cs.ucla.edu> -+ -+ regex: fix read overrun [BZ #24114] -+ Problem found by AddressSanitizer, reported by Hongxu Chen in: -+ https://debbugs.gnu.org/34140 -+ * posix/regexec.c (proceed_next_node): -+ Do not read past end of input buffer. -+ - 2018-09-30 Martin Jansa <Martin.Jansa@gmail.com> - Partial fix for [BZ #23716] - * locale/weight.h: Fix build with -Os. -@@ -10917,7 +10925,7 @@ - (CFLAGS-wcstof_l.c): Likewise. - (CPPFLAGS-tst-wchar-h.c): Likewise. - (CPPFLAGS-wcstold_l.c): Likewise. ----- -+ - 2017-12-11 Paul A. Clarke <pc@us.ibm.com> - - * sysdeps/ieee754/flt-32/s_cosf.c: New implementation. -Index: git/posix/regexec.c -=================================================================== ---- git.orig/posix/regexec.c -+++ git/posix/regexec.c -@@ -1289,8 +1289,10 @@ proceed_next_node (const re_match_contex - else if (naccepted) - { - char *buf = (char *) re_string_get_buffer (&mctx->input); -- if (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx, -- naccepted) != 0) -+ if (mctx->input.valid_len - *pidx < naccepted -+ || (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx, -+ naccepted) -+ != 0)) - return -1; - } - } diff --git a/external/poky/meta/recipes-core/glibc/glibc/check-test-wrapper b/external/poky/meta/recipes-core/glibc/glibc/check-test-wrapper new file mode 100644 index 00000000..f8e04e02 --- /dev/null +++ b/external/poky/meta/recipes-core/glibc/glibc/check-test-wrapper @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +import sys +import os +import subprocess + +env = os.environ.copy() +args = sys.argv[1:] +targettype = args.pop(0) + +if targettype == "user": + qemuargs = os.environ.get("QEMU_OPTIONS", "").split() + if not os.path.exists(qemuargs[0]): + # ensure qemu args has a valid absolute path + for i in os.environ.get("PATH", "").split(":"): + if os.path.exists(os.path.join(i, qemuargs[0])): + qemuargs[0] = os.path.join(i, qemuargs[0]) + break + sysroot = os.environ.get("QEMU_SYSROOT", None) + if not sysroot: + sys.exit(-1) + libpaths = [sysroot + "/usr/lib", sysroot + "/lib"] + + if args[0] == "env": + args.pop(0) + if len(args) == 0: + args = ["env"] + else: + # process options + while args[0].startswith("-"): + opt = args.pop(0).lstrip("-") + if "i" in opt: + env.clear() + # process environment vars + while "=" in args[0]: + key, val = args.pop(0).split("=", 1) + if key == "LD_LIBRARY_PATH": + libpaths += val.split(":") + else: + env[key] = val + if args[0] == "cp": + # ignore copies, the filesystem is the same + sys.exit(0) + + qemuargs += ["-L", sysroot] + qemuargs += ["-E", "LD_LIBRARY_PATH={}".format(":".join(libpaths))] + command = qemuargs + args +elif targettype == "ssh": + host = os.environ.get("SSH_HOST", None) + user = os.environ.get("SSH_HOST_USER", None) + port = os.environ.get("SSH_HOST_PORT", None) + + command = ["ssh", "-o", "UserKnownHostsFile=/dev/null", "-o", "StrictHostKeyChecking=no"] + if port: + command += ["-p", str(port)] + if not host: + sys.exit(-1) + command += ["{}@{}".format(user, host) if user else host] + + # wrap and replace quotes for correct transformation on ssh + wrapped = " ".join(["'{0}'".format(i.replace("'", r"'\''")) for i in ["cd", os.getcwd()]]) + "; " + wrapped += " ".join(["'{0}'".format(i.replace("'", r"'\''")) for i in args]) + command += ["sh", "-c", "\"{}\"".format(wrapped)] +else: + sys.exit(-1) + +try: + r = subprocess.run(command, timeout = 1800, env = env) + sys.exit(r.returncode) +except subprocess.TimeoutExpired: + sys.exit(-1) + diff --git a/external/poky/meta/recipes-core/glibc/glibc_2.28.bb b/external/poky/meta/recipes-core/glibc/glibc_2.28.bb deleted file mode 100644 index 4e6ee4dc..00000000 --- a/external/poky/meta/recipes-core/glibc/glibc_2.28.bb +++ /dev/null @@ -1,138 +0,0 @@ -require glibc.inc - -LIC_FILES_CHKSUM = "file://LICENSES;md5=cfc0ed77a9f62fa62eded042ebe31d72 \ - file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \ - file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c" - -DEPENDS += "gperf-native bison-native make-native" - -SRCREV ?= "044c96f0d5595aeb0bb4e79355081c5a7f4faca5" - -SRCBRANCH ?= "release/${PV}/master" - -GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git" -UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+\.\d+(\.(?!90)\d+)*)" - -SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ - file://etc/ld.so.conf \ - file://generate-supported.mk \ - file://makedbs.sh \ - \ - ${NATIVESDKFIXES} \ - file://0006-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch \ - file://0007-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \ - file://0008-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch \ - file://0009-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch \ - file://0010-Quote-from-bug-1443-which-explains-what-the-patch-do.patch \ - file://0011-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch \ - file://0012-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch \ - file://0013-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch \ - file://0014-Add-unused-attribute.patch \ - file://0015-yes-within-the-path-sets-wrong-config-variables.patch \ - file://0016-timezone-re-written-tzselect-as-posix-sh.patch \ - file://0017-Remove-bash-dependency-for-nscd-init-script.patch \ - file://0018-eglibc-Cross-building-and-testing-instructions.patch \ - file://0019-eglibc-Help-bootstrap-cross-toolchain.patch \ - file://0020-eglibc-Clear-cache-lines-on-ppc8xx.patch \ - file://0021-eglibc-Resolve-__fpscr_values-on-SH4.patch \ - file://0022-eglibc-Forward-port-cross-locale-generation-support.patch \ - file://0023-Define-DUMMY_LOCALE_T-if-not-defined.patch \ - file://0024-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \ - file://0025-locale-fix-hard-coded-reference-to-gcc-E.patch \ - file://0028-bits-siginfo-consts.h-enum-definition-for-TRAP_HWBKP.patch \ - file://0029-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ - file://0030-intl-Emit-no-lines-in-bison-generated-files.patch \ - file://0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors-w.patch \ - file://0032-sysdeps-ieee754-soft-fp-ignore-maybe-uninitialized-w.patch \ - file://0033-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch \ - file://0034-inject-file-assembly-directives.patch \ - file://CVE-2019-9169.patch \ - file://CVE-2016-10739.patch \ - file://CVE-2018-19591.patch \ - file://CVE-2019-6488.patch \ - file://CVE-2019-7309.patch \ -" - -NATIVESDKFIXES ?= "" -NATIVESDKFIXES_class-nativesdk = "\ - file://0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch \ - file://0002-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch \ - file://0003-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch \ - file://0004-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch \ - file://0005-nativesdk-glibc-Make-relocatable-install-for-locales.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 = "" -# -# We will skip parsing glibc when target system C library selection is not glibc -# this helps in easing out parsing for non-glibc system libraries -# -COMPATIBLE_HOST_libc-musl_class-target = "null" - -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 \ - --enable-stackguard-randomization \ - --disable-crypt \ - ${GLIBCPIE} \ - ${GLIBC_EXTRA_OECONF}" - -EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}" -EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'libc-inet-anl', '--enable-nscd', '--disable-nscd', d)}" - - -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 -} - -do_compile () { - # -Wl,-rpath-link <staging>/lib in LDFLAGS can cause breakage if another glibc is in staging - unset LDFLAGS - base_do_compile - echo "Adjust ldd script" - if [ -n "${RTLDLIST}" ] - then - prevrtld=`cat ${B}/elf/ldd | grep "^RTLDLIST=" | sed 's#^RTLDLIST="\?\([^"]*\)"\?$#\1#'` - if [ "${prevrtld}" != "${RTLDLIST}" ] - then - sed -i ${B}/elf/ldd -e "s#^RTLDLIST=.*\$#RTLDLIST=\"${prevrtld} ${RTLDLIST}\"#" - fi - fi - -} - -require glibc-package.inc - -BBCLASSEXTEND = "nativesdk" diff --git a/external/poky/meta/recipes-core/glibc/glibc_2.31.bb b/external/poky/meta/recipes-core/glibc/glibc_2.31.bb new file mode 100644 index 00000000..3d486fbb --- /dev/null +++ b/external/poky/meta/recipes-core/glibc/glibc_2.31.bb @@ -0,0 +1,111 @@ +require glibc.inc +require glibc-version.inc + +CVE_CHECK_WHITELIST += "CVE-2020-10029 CVE-2020-6096 CVE-2016-10228 CVE-2020-1751 CVE-2020-1752" + +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 \ +" + +SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ + file://etc/ld.so.conf \ + file://generate-supported.mk \ + file://makedbs.sh \ + \ + ${NATIVESDKFIXES} \ + file://0008-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch \ + file://0009-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \ + file://0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch \ + file://0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch \ + file://0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch \ + file://0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch \ + file://0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch \ + file://0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch \ + file://0017-yes-within-the-path-sets-wrong-config-variables.patch \ + file://0018-timezone-re-written-tzselect-as-posix-sh.patch \ + file://0019-Remove-bash-dependency-for-nscd-init-script.patch \ + file://0020-eglibc-Cross-building-and-testing-instructions.patch \ + file://0021-eglibc-Help-bootstrap-cross-toolchain.patch \ + file://0022-eglibc-Resolve-__fpscr_values-on-SH4.patch \ + file://0023-eglibc-Forward-port-cross-locale-generation-support.patch \ + file://0024-Define-DUMMY_LOCALE_T-if-not-defined.patch \ + file://0025-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ + file://0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \ + file://0027-intl-Emit-no-lines-in-bison-generated-files.patch \ + file://0028-inject-file-assembly-directives.patch \ + file://0029-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.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 \ + --enable-stackguard-randomization \ + --disable-crypt \ + --with-default-link \ + --enable-nscd \ + ${@bb.utils.contains_any('SELECTED_OPTIMIZATION', '-O0 -Og', '--disable-werror', '', d)} \ + ${GLIBCPIE} \ + ${GLIBC_EXTRA_OECONF}" + +EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}" + +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/external/poky/meta/recipes-core/glibc/site_config/funcs b/external/poky/meta/recipes-core/glibc/site_config/funcs deleted file mode 100644 index ccc85392..00000000 --- a/external/poky/meta/recipes-core/glibc/site_config/funcs +++ /dev/null @@ -1,474 +0,0 @@ -a64l -abs -access -__adjtimex -alarm -alphasort -argz_append -__argz_count -argz_create_sep -argz_insert -__argz_next -argz_next -__argz_stringify -argz_stringify -asprintf -atexit -atof -atoi -bcmp -bcopy -bindresvport -bind_textdomain_codeset -btowc -bzero -calloc -canonicalize_file_name -catgets -cfgetospeed -cfsetispeed -cfsetspeed -chmod -chown -chroot -clock -close -closedir -closelog -confstr -connect -daemon -dcgettext -difftime -dirfd -dirname -dngettext -dup2 -ecvt -endgrent -endmntent -endpwent -endutent -endutxent -epoll_ctl -err -ether_hostton -ether_ntohost -euidaccess -execv -fchdir -fchmod -fchmodat -fchown -fchownat -fcntl -fcvt -fdatasync -fdopendir -feof_unlocked -fgets_unlocked -fgetxattr -finite -flistxattr -flock -flockfile -fnmatch -fork -fpathconf -__fpending -fprintf -free -freeaddrinfo -freeifaddrs -fseeko -__fsetlocking -fsetxattr -fstat64 -fstat -fstatfs -fsync -ftello -ftime -ftruncate -funlockfile -futimes -futimesat -gai_strerror -gcvt -getaddrinfo -getc_unlocked -getcwd -getdelim -getdomainname -getdtablesize -getegid -getenv -geteuid -getgid -getgrent -getgrent_r -getgrgid_r -getgrnam -getgrnam_r -getgrouplist -getgroups -gethostbyaddr_r -gethostbyname2 -gethostbyname -gethostbyname_r -gethostent -gethostid -gethostname -getifaddrs -getline -getloadavg -getmntent -getmsg -getnameinfo -getnetbyaddr_r -getnetgrent_r -getopt -getopt_long -getopt_long_only -getpagesize -getpass -getpeername -getpgrp -getpid -getppid -getprotoent_r -getpwent -getpwent_r -getpwnam -getpwnam_r -getpwuid -getpwuid_r -getresuid -getrlimit -getrusage -getservbyname -getservbyname_r -getservbyport_r -getservent -getservent_r -getspnam -getspnam_r -gettimeofday -getttyent -getttynam -getuid -getusershell -getutent -getutid -getutline -getutmp -getutmpx -getutxent -getutxid -getutxline -getwd -getxattr -glob -gmtime -gmtime_r -grantpt -group_member -herror -hstrerror -iconv -iconv_open -if_freenameindex -if_indextoname -if_nameindex -if_nametoindex -index -inet_addr -inet_aton -inet_ntoa -inet_ntop -inet_pton -initgroups -innetgr -iruserok -isascii -isatty -isblank -isgraph -isinf -isnan -isprint -isspace -iswalnum -iswcntrl -iswctype -iswprint -iswspace -iswupper -isxdigit -kill -killpg -lchown -lckpwdf -lgetxattr -link -listxattr -llistxattr -localtime -localtime_r -lockf -lrand48 -lsearch -lseek64 -lsetxattr -lstat -mallinfo -malloc -mblen -mbrlen -mbrtowc -mbsinit -mbsrtowcs -mbtowc -memalign -memchr -memcmp -memcpy -memmove -mempcpy -memrchr -memset -mkdir -mkdirat -mkdtemp -mkfifo -mknod -mkstemp64 -mkstemp -mktime -mlock -mmap -mtrace -munlock -munmap -nanosleep -nice -nl_langinfo -ntp_adjtime -ntp_gettime -_obstack_free -on_exit -open64 -open -openat -opendir -openlog -pathconf -pipe -poll -popen -posix_memalign -prctl -pread -printf -__progname -pselect -pthread_mutex_lock -ptsname -putenv -putgrent -putpwent -putspent -pututline -pututxline -putwc -pwrite -qsort -raise -rand -random -rand_r -read -readdir -readdir_r -readlink -realloc -realpath -re_comp -recvmsg -re_exec -regcomp -regexec -remove -rename -re_search -rmdir -rpmatch -rresvport_af -ruserok -ruserok_af -sbrk -scandir -sched_setscheduler -sched_yield -__secure_getenv -select -semctl -semget -sendmsg -setbuf -setbuffer -setegid -setenv -seteuid -setgid -setgroups -sethostname -setitimer -_setjmp -setjmp -setlinebuf -setlocale -setmntent -setpgid -setpgrp -setpriority -setregid -setresgid -setresuid -setreuid -setrlimit -setsid -setsockopt -settimeofday -setuid -setutent -setutxent -setvbuf -setxattr -sgetspent -shmat -shmctl -shmdt -shmget -shutdown -sigaction -sigaddset -sigaltstack -sigblock -sigemptyset -sighold -siginterrupt -signal -sigprocmask -sigset -sigsetmask -sigstack -sigsuspend -sigvec -snprintf -socket -socketpair -sprintf -srand48 -srand -srandom -sscanf -stat -statfs -statvfs -stime -stpcpy -strcasecmp -strcasestr -strchr -strchrnul -strcmp -strcspn -strdup -strerror -strerror_r -strftime -strlen -strncasecmp -strncmp -strndup -strnlen -strpbrk -strptime -strrchr -strsep -strsignal -strspn -strstr -strtod -strtoimax -strtok_r -strtol -strtoll -strtoul -strtoull -strtoumax -strverscmp -strxfrm -symlink -sync -sysconf -sysctl -sysinfo -syslog -_sys_siglist -sys_siglist -system -tcgetattr -tcgetpgrp -tcsetattr -tcsetpgrp -time -timegm -times -timezone -tmpnam -towlower -towupper -truncate -tsearch -ttyname -tzset -ulimit -umask -uname -unlink -unsetenv -unshare -updwtmp -updwtmpx -usleep -ustat -utime -utimes -utmpname -utmpxname -valloc -vasprintf -verrx -vfork -vfprintf -vfscanf -vhangup -vprintf -vsnprintf -vsprintf -wait3 -wait4 -waitpid -wcrtomb -wcscoll -wcsdup -wcslen -wctob -wctomb -wctype -wcwidth -wmemchr -wmemcpy -wmempcpy diff --git a/external/poky/meta/recipes-core/glibc/site_config/headers b/external/poky/meta/recipes-core/glibc/site_config/headers deleted file mode 100644 index 69fedea4..00000000 --- a/external/poky/meta/recipes-core/glibc/site_config/headers +++ /dev/null @@ -1,155 +0,0 @@ -aio.h -alloca.h -argz.h -arpa/inet.h -arpa/nameser.h -asm/byteorder.h -asm/ioctls.h -asm/page.h -asm/types.h -assert.h -byteswap.h -ctype.h -dirent.h -dlfcn.h -elf.h -endian.h -err.h -errno.h -execinfo.h -fcntl.h -features.h -float.h -fstab.h -ftw.h -getopt.h -glob.h -grp.h -iconv.h -ifaddrs.h -inttypes.h -langinfo.h -lastlog.h -libgen.h -libintl.h -limits.h -linux/capability.h -linux/fd.h -linux/fs.h -linux/hayesesp.h -linux/hdreg.h -linux/icmp.h -linux/in6.h -linux/joystick.h -linux/ptrace.h -linux/serial.h -linux/sonypi.h -linux/unistd.h -linux/utsname.h -linux/version.h -locale.h -malloc.h -math.h -mcheck.h -memory.h -mntent.h -mqueue.h -netdb.h -net/if.h -netinet/ether.h -netinet/in.h -netinet/ip6.h -netinet/ip.h -netinet/tcp.h -netinet/udp.h -netipx/ipx.h -net/route.h -paths.h -poll.h -pthread.h -pty.h -pwd.h -regex.h -resolv.h -rpc/rpc.h -rpc/types.h -sched.h -scsi/scsi.h -search.h -semaphore.h -setjmp.h -sgtty.h -shadow.h -signal.h -stdarg.h -stdbool.h -stdc -stddef.h -stdint.h -stdio.h -stdlib.h -string.h -strings.h -stropts.h -sys/bitypes.h -sys/cdefs.h -sys/dir.h -sys/epoll.h -sysexits.h -sys/fcntl.h -sys/file.h -sys/fsuid.h -sys/ioctl.h -sys/ipc.h -syslog.h -sys/mman.h -sys/mount.h -sys/mtio.h -sys/param.h -sys/poll.h -sys/prctl.h -sys/ptrace.h -sys/queue.h -sys/reg.h -sys/resource.h -sys/select.h -sys/sem.h -sys/shm.h -sys/signal.h -sys/socket.h -sys/socketvar.h -sys/soundcard.h -sys/statfs.h -sys/stat.h -sys/statvfs.h -sys/stropts.h -sys/swap.h -sys/sysctl.h -sys/sysinfo.h -sys/sysmacros.h -sys/termios.h -sys/timeb.h -sys/time.h -sys/times.h -sys/timex.h -sys/types.h -sys/uio.h -sys/un.h -sys/unistd.h -sys/user.h -sys/utsname.h -sys/vfs.h -sys/wait.h -termio.h -termios.h -time.h -ttyent.h -ulimit.h -unistd.h -ustat.h -utime.h -utmp.h -utmpx.h -values.h -wchar.h -wctype.h diff --git a/external/poky/meta/recipes-core/glibc/site_config/types b/external/poky/meta/recipes-core/glibc/site_config/types deleted file mode 100644 index 178bd85a..00000000 --- a/external/poky/meta/recipes-core/glibc/site_config/types +++ /dev/null @@ -1,21 +0,0 @@ -char -char * -double -float -int -long -long double -long int -long long -long long int -short -short int -signed char -unsigned char -unsigned int -unsigned long -unsigned long int -unsigned long long int -unsigned short -unsigned short int -void * |