summaryrefslogtreecommitdiffstats
path: root/import-layers/yocto-poky/meta/recipes-core
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2018-02-01 10:27:11 -0500
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-03-12 22:51:39 -0400
commit6e60e8b2b2bab889379b380a28a167a0edd9d1d3 (patch)
treef12f54d5ba8e74e67e5fad3651a1e125bb8f4191 /import-layers/yocto-poky/meta/recipes-core
parent509842add85b53e13164c1569a1fd43d5b8d91c5 (diff)
downloadblackbird-openbmc-6e60e8b2b2bab889379b380a28a167a0edd9d1d3.tar.gz
blackbird-openbmc-6e60e8b2b2bab889379b380a28a167a0edd9d1d3.zip
Yocto 2.3
Move OpenBMC to Yocto 2.3(pyro). Tested: Built and verified Witherspoon and Palmetto images Change-Id: I50744030e771f4850afc2a93a10d3507e76d36bc Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com> Resolves: openbmc/openbmc#2461
Diffstat (limited to 'import-layers/yocto-poky/meta/recipes-core')
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/base-files/base-files/profile31
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/base-files/base-files_3.0.14.bb17
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb43
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox.inc32
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox/0001-ip-fix-an-improper-optimization-req.r.rtm_scope-may-.patch33
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox/0001-iproute-support-scope-.-Closes-8561.patch122
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox/CVE-2016-2147_2.patch2
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox/busybox-tar-add-IF_FEATURE_-checks.patch70
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox/defconfig10
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox_1.24.1.bb7
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox_git.bb52
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/console-tools/console-tools-0.3.2/0001-Fix-format-security-compilation-error.patch57
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/console-tools/console-tools_0.3.2.bb1
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-6.9-cp-i-u.patch120
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-install.patch101
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-texinfo.patch375
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-i18n.patch4051
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-ls-x.patch117
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-overflow.patch19
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils_fix_for_automake-1.12.patch32
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/fix_for_manpage_building.patch85
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/futimens.patch63
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/gnulib_m4.patch21
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/loadavg.patch18
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/man-touch.patch24
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/0001-Unset-need_charset_alias-when-building-for-musl.patch (renamed from import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.25/0001-Unset-need_charset_alias-when-building-for-musl.patch)0
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/0001-local.mk-fix-cross-compiling-problem.patch26
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/0001-uname-report-processor-and-hardware-correctly.patch (renamed from import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.25/0001-uname-report-processor-and-hardware-correctly.patch)0
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/disable-ls-output-quoting.patch (renamed from import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.25/disable-ls-output-quoting.patch)0
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/fix-selinux-flask.patch (renamed from import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.25/fix-selinux-flask.patch)0
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/man-decouple-manpages-from-build.patch (renamed from import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.25/man-decouple-manpages-from-build.patch)0
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/remove-usr-local-lib-from-m4.patch (renamed from import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.25/remove-usr-local-lib-from-m4.patch)0
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils_6.9.bb107
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils_8.26.bb (renamed from import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils_8.25.bb)20
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/dbus/dbus-glib_0.106.bb4
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/dbus/dbus-glib_0.108.bb4
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/dbus/dbus-test_1.10.14.bb (renamed from import-layers/yocto-poky/meta/recipes-core/dbus/dbus-test_1.10.10.bb)4
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/dbus/dbus_1.10.14.bb (renamed from import-layers/yocto-poky/meta/recipes-core/dbus/dbus_1.10.10.bb)13
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/dropbear/dropbear.inc6
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-core/dropbear/dropbear/init36
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/expat/expat.inc6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/fts/fts.bb5
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/disable_java.patch39
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/fix_aclocal_version.patch110
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/fix_gnu_source_circular.patch348
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/gettext-autoconf-lib-link-no-L.patch19
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/gettext-vpath.patch20
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/hardcode_macro_version.patch51
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/linklib_from_0.17.patch720
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.19.8.1/cr-statement.c-timsort.h-fix-formatting-issues.patch87
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/gettext/gettext_0.16.1.bb124
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/gettext/gettext_0.19.8.1.bb6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib-2.0/0001-Test-for-pthread_getname_np-before-using-it.patch70
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib-2.0/0002-tests-Ignore-y2k-warnings.patch42
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib-2.0/gi-exclude.patch59
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib-2.0_2.50.3.bb (renamed from import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib-2.0_2.48.2.bb)7
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib.inc34
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glib-networking/glib-networking_2.50.0.bb (renamed from import-layers/yocto-poky/meta/recipes-core/glib-networking/glib-networking_2.48.2.bb)6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/cross-localedef-native_2.25.bb (renamed from import-layers/yocto-poky/meta/recipes-core/glibc/cross-localedef-native_2.24.bb)3
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc-collateral.inc8
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc-common.inc1
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc-initial.inc29
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc-initial_2.25.bb (renamed from import-layers/yocto-poky/meta/recipes-core/glibc/glibc-initial_2.24.bb)0
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc-ld.inc27
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc-locale.inc16
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc-locale_2.25.bb (renamed from import-layers/yocto-poky/meta/recipes-core/glibc/glibc-locale_2.24.bb)0
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc-mtrace.inc4
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc-mtrace_2.25.bb (renamed from import-layers/yocto-poky/meta/recipes-core/glibc/glibc-mtrace_2.24.bb)0
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc-package.inc79
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc-scripts.inc4
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc-scripts_2.25.bb (renamed from import-layers/yocto-poky/meta/recipes-core/glibc/glibc-scripts_2.24.bb)0
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc.inc8
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0001-Add-atomic_exchange_relaxed.patch58
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0001-Include-locale_t.h-compatibility-header.patch29
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch12
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0002-Add-atomic-operations-required-by-the-new-condition-.patch124
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0002-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch10
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0003-Add-pretty-printers-for-the-NPTL-lock-types.patch3197
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch123
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0004-New-condvar-implementation-that-provides-stronger-or.patch7171
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch8
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0005-Remove-__ASSUME_REQUEUE_PI.patch149
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0005-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0006-Fix-atomic_fetch_xor_release.patch81
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0006-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0007-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0008-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0009-Quote-from-bug-1443-which-explains-what-the-patch-do.patch6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0010-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0012-Make-ld-version-output-matching-grok-gold-s-output.patch14
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0013-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0014-Add-unused-attribute.patch6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0015-yes-within-the-path-sets-wrong-config-variables.patch6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0016-timezone-re-written-tzselect-as-posix-sh.patch6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0017-Remove-bash-dependency-for-nscd-init-script.patch8
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0018-eglibc-Cross-building-and-testing-instructions.patch6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0019-eglibc-Help-bootstrap-cross-toolchain.patch14
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0020-eglibc-cherry-picked-from.patch6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0021-eglibc-Clear-cache-lines-on-ppc8xx.patch6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0022-eglibc-Resolve-__fpscr_values-on-SH4.patch6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0023-eglibc-Install-PIC-archives.patch20
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0024-eglibc-Forward-port-cross-locale-generation-support.patch18
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0025-Define-DUMMY_LOCALE_T-if-not-defined.patch6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch (renamed from import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0026-build_local_scope.patch)8
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0027-locale-fix-hard-coded-reference-to-gcc-E.patch (renamed from import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0001-locale-fix-hard-coded-reference-to-gcc-E.patch)17
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0028-Bug-20116-Fix-use-after-free-in-pthread_create.patch668
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0028-Rework-fno-omit-frame-pointer-support-on-i386.patch268
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc/CVE-2016-6323.patch39
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/glibc/glibc_2.25.bb (renamed from import-layers/yocto-poky/meta/recipes-core/glibc/glibc_2.24.bb)27
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/ifupdown/files/inet-6-.defn-fix-inverted-checks-for-loopback.patch395
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/ifupdown/ifupdown_0.8.16.bb (renamed from import-layers/yocto-poky/meta/recipes-core/ifupdown/ifupdown_0.8.2.bb)9
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/images/build-appliance-image/README_VirtualBox_Toaster.txt78
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/images/build-appliance-image_15.0.0.bb28
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/images/core-image-minimal.bb2
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/images/core-image-tiny-initramfs.bb42
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh12
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi.sh17
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install.sh5
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh14
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh4
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts-1.0/volatiles6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts_1.0.bb2
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/kbd/kbd_2.0.4.bb (renamed from import-layers/yocto-poky/meta/recipes-core/kbd/kbd_2.0.3.bb)6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch99
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/CVE-2016-9318.patch207
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-0663.patch40
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-5969.patch62
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-8872.patch37
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-9047_CVE-2017-9048.patch103
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-9049_CVE-2017-9050.patch291
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-fix_and_simplify_xmlParseStartTag2.patch590
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/runtest.patch25
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/libxml/libxml2_2.9.4.bb43
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/meta/build-sysroots.bb38
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/meta/buildtools-tarball.bb2
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/meta/meta-environment-extsdk.bb4
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/meta/meta-environment.bb23
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/meta/meta-extsdk-toolchain.bb8
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/meta/meta-ide-support.bb3
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/meta/meta-toolchain.bb3
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/meta/meta-world-pkgdata.bb16
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb1
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/meta/package-index.bb24
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/meta/signing-keys.bb20
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/meta/testexport-tarball.bb2
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/meta/uninative-tarball.bb5
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/meta/wic-tools.bb32
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/musl/files/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch62
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/musl/musl.inc1
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/musl/musl_git.bb6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/ncurses/files/configure-reproducible.patch20
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/ncurses/files/fix-cflags-mangle.patch18
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/ncurses/ncurses.inc8
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/ncurses/ncurses_6.0+20161126.bb (renamed from import-layers/yocto-poky/meta/recipes-core/ncurses/ncurses_6.0+20160625.bb)4
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/netbase/netbase/netbase-add-rpcbind-as-an-alias-to-sunrpc.patch24
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/netbase/netbase_5.4.bb (renamed from import-layers/yocto-poky/meta/recipes-core/netbase/netbase_5.3.bb)6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/os-release/os-release.bb5
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf-shell-image.bb17
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/0001-MdeModulePkg-UefiHiiLib-Fix-incorrect-comparison-exp.patch39
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/0002-ovmf-update-path-to-native-BaseTools.patch32
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/0003-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch39
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/0007-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch1124
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/VfrCompile-increase-path-length-limit.patch33
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/ovmf-shell-image.wks4
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf_git.bb243
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb3
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-base.bb4
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb7
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb11
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb3
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/psplash/psplash_git.bb22
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/readline/files/config-dirent-symbols.patch34
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/readline/readline-5.2/configure-fix.patch26
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/readline/readline-5.2/fix-redundant-rpath.patch21
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/readline/readline-7.0/configure-fix.patch (renamed from import-layers/yocto-poky/meta/recipes-core/readline/readline-6.3/configure-fix.patch)0
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/readline/readline-7.0/norpath.patch (renamed from import-layers/yocto-poky/meta/recipes-core/readline/readline-6.3/norpath.patch)0
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/readline/readline_5.2.bb84
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/readline/readline_6.3.bb34
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/readline/readline_7.0.bb7
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/systemd/systemd-compat-units.bb3
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/systemd/systemd-systemctl-native.bb2
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-core-load-fragment-refuse-units-with-errors-in-certa.patch329
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/systemd/systemd/validate-user.patch856
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/systemd/systemd_232.bb23
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty2
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb4
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/udev/eudev/0014-Revert-rules-remove-firmware-loading-rules.patch28
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/udev/eudev/Revert-udev-remove-userspace-firmware-loading-suppor.patch364
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/udev/eudev_3.2.1.bb (renamed from import-layers/yocto-poky/meta/recipes-core/udev/eudev_3.2.bb)10
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/udev/udev-extraconf_1.1.bb3
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/util-linux/util-linux.inc27
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/util-linux/util-linux_2.29.1.bb (renamed from import-layers/yocto-poky/meta/recipes-core/util-linux/util-linux_2.28.1.bb)6
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/volatile-binds/volatile-binds.bb2
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.11/Makefile-runtests.patch (renamed from import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.8/Makefile-runtests.patch)0
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.11/ldflags-tests.patch (renamed from import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.8/ldflags-tests.patch)0
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.11/remove.ldconfig.call.patch (renamed from import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.8/remove.ldconfig.call.patch)0
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.11/run-ptest (renamed from import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.8/run-ptest)0
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/zlib/zlib_1.2.11.bb (renamed from import-layers/yocto-poky/meta/recipes-core/zlib/zlib_1.2.8.bb)19
199 files changed, 5563 insertions, 20168 deletions
diff --git a/import-layers/yocto-poky/meta/recipes-core/base-files/base-files/profile b/import-layers/yocto-poky/meta/recipes-core/base-files/base-files/profile
index c616616ce..ceaf15f79 100644
--- a/import-layers/yocto-poky/meta/recipes-core/base-files/base-files/profile
+++ b/import-layers/yocto-poky/meta/recipes-core/base-files/base-files/profile
@@ -6,28 +6,29 @@ EDITOR="vi" # needed for packages like cron, git-commit
test -z "$TERM" && TERM="vt100" # Basic terminal capab. For screen etc.
if [ "$HOME" = "ROOTHOME" ]; then
- PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
+ PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
fi
if [ "$PS1" ]; then
-# works for bash and ash (no other shells known to be in use here)
- PS1='\u@\h:\w\$ '
+ # works for bash and ash (no other shells known to be in use here)
+ PS1='\u@\h:\w\$ '
fi
if [ -d /etc/profile.d ]; then
- for i in /etc/profile.d/*.sh ; do
- if [ -f $i -a -r $i ]; then
- . $i
- fi
- done
- unset i
+ for i in /etc/profile.d/*.sh; do
+ if [ -f $i -a -r $i ]; then
+ . $i
+ fi
+ done
+ unset i
fi
-if [ -x /usr/bin/resize ] && termpath="`tty`"; then
- # Make sure we are on a serial console (i.e. the device used starts with /dev/tty),
- # otherwise we confuse e.g. the eclipse launcher which tries do use ssh
- case "$termpath" in
- /dev/tty[A-z]*) resize >/dev/null
- esac
+if command -v resize >/dev/null && command -v tty >/dev/null; then
+ # Make sure we are on a serial console (i.e. the device used starts with
+ # /dev/tty[A-z]), otherwise we confuse e.g. the eclipse launcher which
+ # tries do use ssh
+ case $(tty) in
+ /dev/tty[A-z]*) resize >/dev/null;;
+ esac
fi
export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM
diff --git a/import-layers/yocto-poky/meta/recipes-core/base-files/base-files_3.0.14.bb b/import-layers/yocto-poky/meta/recipes-core/base-files/base-files_3.0.14.bb
index 533311061..ca7bf0635 100644
--- a/import-layers/yocto-poky/meta/recipes-core/base-files/base-files_3.0.14.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/base-files/base-files_3.0.14.bb
@@ -32,8 +32,9 @@ INHIBIT_DEFAULT_DEPS = "1"
docdir_append = "/${P}"
dirs1777 = "/tmp ${localstatedir}/volatile/tmp"
dirs2775 = ""
-dirs755 = "/bin /boot /dev ${sysconfdir} ${sysconfdir}/default \
- ${sysconfdir}/skel /lib /mnt /proc ${ROOT_HOME} /run /sbin \
+dirs755 = "/boot /dev ${base_bindir} ${base_sbindir} ${base_libdir} \
+ ${sysconfdir} ${sysconfdir}/default \
+ ${sysconfdir}/skel ${nonarch_base_libdir} /mnt /proc ${ROOT_HOME} /run \
${prefix} ${bindir} ${docdir} /usr/games ${includedir} \
${libdir} ${sbindir} ${datadir} \
${datadir}/common-licenses ${datadir}/dict ${infodir} \
@@ -127,10 +128,6 @@ do_install () {
install -m 0644 ${WORKDIR}/host.conf ${D}${sysconfdir}/host.conf
install -m 0644 ${WORKDIR}/motd ${D}${sysconfdir}/motd
- if [ "/usr/bin" != "${bindir}" ]; then
- sed -i "s,/usr/bin/resize,${bindir}/resize," ${D}${sysconfdir}/profile
- fi
-
ln -sf /proc/mounts ${D}${sysconfdir}/mtab
}
@@ -145,8 +142,9 @@ do_install_basefilesissue () {
printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
if [ -n "${DISTRO_VERSION}" ]; then
- printf "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue
- printf "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue.net
+ distro_version_nodate=${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot').replace('${DATE}','')}
+ printf "%s " $distro_version_nodate >> ${D}${sysconfdir}/issue
+ printf "%s " $distro_version_nodate >> ${D}${sysconfdir}/issue.net
fi
printf "\\\n \\\l\n" >> ${D}${sysconfdir}/issue
echo >> ${D}${sysconfdir}/issue
@@ -154,6 +152,7 @@ do_install_basefilesissue () {
echo >> ${D}${sysconfdir}/issue.net
fi
}
+do_install_basefilesissue[vardepsexclude] += "DATE"
do_install_append_linuxstdbase() {
for d in ${dirs755-lsb}; do
@@ -173,5 +172,5 @@ FILES_${PN}-doc = "${docdir} ${datadir}/common-licenses"
PACKAGE_ARCH = "${MACHINE_ARCH}"
-CONFFILES_${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname'][(d.getVar('hostname', True) != '')]} ${sysconfdir}/shells"
+CONFFILES_${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname'][(d.getVar('hostname') != '')]} ${sysconfdir}/shells"
CONFFILES_${PN} += "${sysconfdir}/motd ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile"
diff --git a/import-layers/yocto-poky/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb b/import-layers/yocto-poky/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
index 10457b2de..c6be1c1d0 100644
--- a/import-layers/yocto-poky/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
@@ -23,8 +23,6 @@ UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/b/base-passwd/"
inherit autotools
-SSTATEPOSTINSTFUNCS += "base_passwd_sstate_postinst"
-
do_install () {
install -d -m 755 ${D}${sbindir}
install -o root -g root -p -m 755 ${B}/update-passwd ${D}${sbindir}/
@@ -45,23 +43,32 @@ do_install () {
install -p -m 644 ${S}/debian/copyright ${D}${docdir}/${BPN}/
}
-base_passwd_sstate_postinst() {
- if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
- then
- # Staging does not copy ${sysconfdir} files into the
- # target sysroot, so we need to do so manually. We
- # put these files in the target sysroot so they can
- # be used by recipes which use custom user/group
- # permissions.
- # Install passwd.master and group.master to sysconfdir and mv
- # them to make sure they are atomically install.
- install -d -m 755 ${STAGING_DIR_TARGET}${sysconfdir}
- for i in passwd group; do
- install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/$i.master \
- ${STAGING_DIR_TARGET}${sysconfdir}/
- mv ${STAGING_DIR_TARGET}${sysconfdir}/$i.master ${STAGING_DIR_TARGET}${sysconfdir}/$i
- done
+basepasswd_sysroot_postinst() {
+#!/bin/sh
+
+# Install passwd.master and group.master to sysconfdir
+install -d -m 755 ${STAGING_DIR_TARGET}${sysconfdir}
+for i in passwd group; do
+ install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/\$i.master \
+ ${STAGING_DIR_TARGET}${sysconfdir}/\$i
+done
+
+# Run any useradd postinsts
+for script in ${STAGING_DIR_TARGET}${bindir}/postinst-useradd-*; do
+ if [ -f \$script ]; then
+ \$script
fi
+done
+}
+
+SYSROOT_DIRS += "${sysconfdir}"
+SYSROOT_PREPROCESS_FUNCS += "base_passwd_tweaksysroot"
+
+base_passwd_tweaksysroot () {
+ mkdir -p ${SYSROOT_DESTDIR}${bindir}
+ dest=${SYSROOT_DESTDIR}${bindir}/postinst-${PN}
+ echo "${basepasswd_sysroot_postinst}" > $dest
+ chmod 0755 $dest
}
python populate_packages_prepend() {
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox.inc b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox.inc
index b2f196022..adc6e9a71 100644
--- a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox.inc
+++ b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox.inc
@@ -18,7 +18,6 @@ BUSYBOX_SPLIT_SUID ?= "1"
export EXTRA_CFLAGS = "${CFLAGS}"
export EXTRA_LDFLAGS = "${LDFLAGS}"
-# We don't want '-e MAKEFLAGS=' in EXTRA_OEMAKE
EXTRA_OEMAKE = "CC='${CC}' LD='${CCLD}' V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y HOSTCC='${BUILD_CC}' HOSTCPP='${BUILD_CPP}'"
PACKAGES =+ "${PN}-httpd ${PN}-udhcpd ${PN}-udhcpc ${PN}-syslog ${PN}-mdev ${PN}-hwclock"
@@ -63,8 +62,8 @@ def busybox_cfg(feature, tokens, cnf, rem):
def features_to_busybox_settings(d):
cnf, rem = ([], [])
busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'ipv6', True, False, d), 'CONFIG_FEATURE_IPV6', cnf, rem)
- busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'largefile', True, False, d), 'CONFIG_LFS', cnf, rem)
- busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'largefile', True, False, d), 'CONFIG_FDISK_SUPPORT_LARGE_DISKS', cnf, rem)
+ busybox_cfg(True, 'CONFIG_LFS', cnf, rem)
+ busybox_cfg(True, 'CONFIG_FDISK_SUPPORT_LARGE_DISKS', cnf, rem)
busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'nls', True, False, d), 'CONFIG_LOCALE_SUPPORT', cnf, rem)
busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'ipv4', True, False, d), 'CONFIG_FEATURE_IFUPDOWN_IPV4', cnf, rem)
busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'ipv6', True, False, d), 'CONFIG_FEATURE_IFUPDOWN_IPV6', cnf, rem)
@@ -141,6 +140,10 @@ do_compile() {
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
if [ "${BUSYBOX_SPLIT_SUID}" = "1" -a x`grep "CONFIG_FEATURE_INDIVIDUAL=y" .config` = x ]; then
# split the .config into two parts, and make two busybox binaries
+ if [ -e .config.orig ]; then
+ # Need to guard again an interrupted do_compile - restore any backup
+ cp .config.orig .config
+ fi
cp .config .config.orig
oe_runmake busybox.cfg.suid
oe_runmake busybox.cfg.nosuid
@@ -331,21 +334,21 @@ ALTERNATIVE_LINK_NAME[syslog-conf] = "${sysconfdir}/syslog.conf"
python () {
if bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
- pn = d.getVar('PN', True)
+ pn = d.getVar('PN')
d.appendVar('ALTERNATIVE_%s-syslog' % (pn), ' syslog-init')
- d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-init', '%s/init.d/syslog' % (d.getVar('sysconfdir', True)))
- d.setVarFlag('ALTERNATIVE_TARGET', 'syslog-init', '%s/init.d/syslog.%s' % (d.getVar('sysconfdir', True), d.getVar('BPN', True)))
+ d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-init', '%s/init.d/syslog' % (d.getVar('sysconfdir')))
+ d.setVarFlag('ALTERNATIVE_TARGET', 'syslog-init', '%s/init.d/syslog.%s' % (d.getVar('sysconfdir'), d.getVar('BPN')))
d.appendVar('ALTERNATIVE_%s-syslog' % (pn), ' syslog-startup-conf')
- d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-startup-conf', '%s/syslog-startup.conf' % (d.getVar('sysconfdir', True)))
- d.setVarFlag('ALTERNATIVE_TARGET', 'syslog-startup-conf', '%s/syslog-startup.conf.%s' % (d.getVar('sysconfdir', True), d.getVar('BPN', True)))
+ d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-startup-conf', '%s/syslog-startup.conf' % (d.getVar('sysconfdir')))
+ d.setVarFlag('ALTERNATIVE_TARGET', 'syslog-startup-conf', '%s/syslog-startup.conf.%s' % (d.getVar('sysconfdir'), d.getVar('BPN')))
}
python do_package_prepend () {
# We need to load the full set of busybox provides from the /etc/busybox.links
# Use this to see the update-alternatives with the right information
- dvar = d.getVar('D', True)
- pn = d.getVar('PN', True)
+ dvar = d.getVar('D')
+ pn = d.getVar('PN')
def set_alternative_vars(links, target):
links = d.expand(links)
target = d.expand(target)
@@ -395,6 +398,9 @@ pkg_postinst_${PN} () {
fi
done
fi
+ if grep -q "^${base_bindir}/bash$" $D${sysconfdir}/busybox.links*; then
+ grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells
+ fi
}
pkg_prerm_${PN} () {
@@ -419,6 +425,12 @@ pkg_prerm_${PN} () {
export PATH=$PATH:$tmpdir
}
+pkg_postrm_${PN} () {
+ if grep -q "^${base_bindir}/bash$" $D${sysconfdir}/busybox.links* && [ ! -e $D${base_bindir}/bash ]; then
+ printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells
+ fi
+}
+
pkg_prerm_${PN}-syslog () {
# remove syslog
if test "x$D" = "x"; then
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/0001-ip-fix-an-improper-optimization-req.r.rtm_scope-may-.patch b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/0001-ip-fix-an-improper-optimization-req.r.rtm_scope-may-.patch
new file mode 100644
index 000000000..812a50748
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/0001-ip-fix-an-improper-optimization-req.r.rtm_scope-may-.patch
@@ -0,0 +1,33 @@
+From 34ecc3b7aefdd6c31e8691bd5485037bbabedbd4 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Sun, 14 Aug 2016 01:30:34 +0200
+Subject: [PATCH] ip: fix an improper optimization: req.r.rtm_scope may be
+ nonzero here
+
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+---
+Upstream-Status: Backport
+Signed-off-by: André Draszik <adraszik@tycoint.com>
+
+ networking/libiproute/iproute.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
+index e674e9a0d..48dc6e3d9 100644
+--- a/networking/libiproute/iproute.c
++++ b/networking/libiproute/iproute.c
+@@ -362,10 +362,9 @@ IF_FEATURE_IP_RULE(ARG_table,)
+ req.r.rtm_scope = RT_SCOPE_NOWHERE;
+
+ if (cmd != RTM_DELROUTE) {
++ req.r.rtm_scope = RT_SCOPE_UNIVERSE;
+ if (RTPROT_BOOT != 0)
+ req.r.rtm_protocol = RTPROT_BOOT;
+- if (RT_SCOPE_UNIVERSE != 0)
+- req.r.rtm_scope = RT_SCOPE_UNIVERSE;
+ if (RTN_UNICAST != 0)
+ req.r.rtm_type = RTN_UNICAST;
+ }
+--
+2.11.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/0001-iproute-support-scope-.-Closes-8561.patch b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/0001-iproute-support-scope-.-Closes-8561.patch
new file mode 100644
index 000000000..66bc76e65
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/0001-iproute-support-scope-.-Closes-8561.patch
@@ -0,0 +1,122 @@
+From ce4bc1ed048233e89ee4cb95830bf6f01d523d1e Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Wed, 30 Dec 2015 17:32:51 +0100
+Subject: [PATCH] iproute: support "scope". Closes 8561
+
+function old new delta
+iproute_modify 1051 1120 +69
+
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+
+Upstream-Status: Backport
+Modified patch to build against busybox 1.24.1:
+- s/invarg_1_to_2/invarg
+Signed-off-by: André Draszik <adraszik@tycoint.com>
+---
+ networking/libiproute/iproute.c | 52 ++++++++++++++++++++++++++---------------
+ 1 file changed, 33 insertions(+), 19 deletions(-)
+
+diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
+index d232ee6fd..82827488f 100644
+--- a/networking/libiproute/iproute.c
++++ b/networking/libiproute/iproute.c
+@@ -313,12 +313,13 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM,
+ static int iproute_modify(int cmd, unsigned flags, char **argv)
+ {
+ static const char keywords[] ALIGN1 =
+- "src\0""via\0""mtu\0""lock\0""protocol\0"IF_FEATURE_IP_RULE("table\0")
++ "src\0""via\0""mtu\0""lock\0""scope\0""protocol\0"IF_FEATURE_IP_RULE("table\0")
+ "dev\0""oif\0""to\0""metric\0""onlink\0";
+ enum {
+ ARG_src,
+ ARG_via,
+ ARG_mtu, PARM_lock,
++ ARG_scope,
+ ARG_protocol,
+ IF_FEATURE_IP_RULE(ARG_table,)
+ ARG_dev,
+@@ -344,6 +345,7 @@ IF_FEATURE_IP_RULE(ARG_table,)
+ unsigned mxlock = 0;
+ char *d = NULL;
+ smalluint ok = 0;
++ smalluint scope_ok = 0;
+ int arg;
+
+ memset(&req, 0, sizeof(req));
+@@ -352,15 +354,18 @@ IF_FEATURE_IP_RULE(ARG_table,)
+ req.n.nlmsg_flags = NLM_F_REQUEST | flags;
+ req.n.nlmsg_type = cmd;
+ req.r.rtm_family = preferred_family;
+- if (RT_TABLE_MAIN) /* if it is zero, memset already did it */
++ if (RT_TABLE_MAIN != 0) /* if it is zero, memset already did it */
+ req.r.rtm_table = RT_TABLE_MAIN;
+- if (RT_SCOPE_NOWHERE)
++ if (RT_SCOPE_NOWHERE != 0)
+ req.r.rtm_scope = RT_SCOPE_NOWHERE;
+
+ if (cmd != RTM_DELROUTE) {
+- req.r.rtm_protocol = RTPROT_BOOT;
+- req.r.rtm_scope = RT_SCOPE_UNIVERSE;
+- req.r.rtm_type = RTN_UNICAST;
++ if (RTPROT_BOOT != 0)
++ req.r.rtm_protocol = RTPROT_BOOT;
++ if (RT_SCOPE_UNIVERSE != 0)
++ req.r.rtm_scope = RT_SCOPE_UNIVERSE;
++ if (RTN_UNICAST != 0)
++ req.r.rtm_type = RTN_UNICAST;
+ }
+
+ mxrta->rta_type = RTA_METRICS;
+@@ -393,6 +398,13 @@ IF_FEATURE_IP_RULE(ARG_table,)
+ }
+ mtu = get_unsigned(*argv, "mtu");
+ rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu);
++ } else if (arg == ARG_scope) {
++ uint32_t scope;
++ NEXT_ARG();
++ if (rtnl_rtscope_a2n(&scope, *argv))
++ invarg(*argv, "scope");
++ req.r.rtm_scope = scope;
++ scope_ok = 1;
+ } else if (arg == ARG_protocol) {
+ uint32_t prot;
+ NEXT_ARG();
+@@ -469,20 +481,22 @@ IF_FEATURE_IP_RULE(ARG_table,)
+ addattr_l(&req.n, sizeof(req), RTA_METRICS, RTA_DATA(mxrta), RTA_PAYLOAD(mxrta));
+ }
+
+- if (req.r.rtm_type == RTN_LOCAL || req.r.rtm_type == RTN_NAT)
+- req.r.rtm_scope = RT_SCOPE_HOST;
+- else
+- if (req.r.rtm_type == RTN_BROADCAST
+- || req.r.rtm_type == RTN_MULTICAST
+- || req.r.rtm_type == RTN_ANYCAST
+- ) {
+- req.r.rtm_scope = RT_SCOPE_LINK;
+- }
+- else if (req.r.rtm_type == RTN_UNICAST || req.r.rtm_type == RTN_UNSPEC) {
+- if (cmd == RTM_DELROUTE)
+- req.r.rtm_scope = RT_SCOPE_NOWHERE;
+- else if (!(ok & gw_ok))
++ if (!scope_ok) {
++ if (req.r.rtm_type == RTN_LOCAL || req.r.rtm_type == RTN_NAT)
++ req.r.rtm_scope = RT_SCOPE_HOST;
++ else
++ if (req.r.rtm_type == RTN_BROADCAST
++ || req.r.rtm_type == RTN_MULTICAST
++ || req.r.rtm_type == RTN_ANYCAST
++ ) {
+ req.r.rtm_scope = RT_SCOPE_LINK;
++ }
++ else if (req.r.rtm_type == RTN_UNICAST || req.r.rtm_type == RTN_UNSPEC) {
++ if (cmd == RTM_DELROUTE)
++ req.r.rtm_scope = RT_SCOPE_NOWHERE;
++ else if (!(ok & gw_ok))
++ req.r.rtm_scope = RT_SCOPE_LINK;
++ }
+ }
+
+ if (req.r.rtm_family == AF_UNSPEC) {
+--
+2.11.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/CVE-2016-2147_2.patch b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/CVE-2016-2147_2.patch
index 1473d4603..b8349c04a 100644
--- a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/CVE-2016-2147_2.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/CVE-2016-2147_2.patch
@@ -4,7 +4,7 @@ Date: Fri, 11 Mar 2016 00:26:58 +0100
Subject: [PATCH] udhcpc: fix a warning in debug code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-Upsteam-Status: Backport
+Upstream-Status: Backport
CVE: CVE-2016-2147 regression fix
https://git.busybox.net/busybox/commit/?id=1b7c17
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/busybox-tar-add-IF_FEATURE_-checks.patch b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/busybox-tar-add-IF_FEATURE_-checks.patch
new file mode 100644
index 000000000..0c3c9c0f4
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/busybox-tar-add-IF_FEATURE_-checks.patch
@@ -0,0 +1,70 @@
+From f94412f6bb49136694c5478d0aecb19118d1b08d Mon Sep 17 00:00:00 2001
+From: Ming Liu <peter.x.liu@external.atlascopco.com>
+Date: Wed, 31 May 2017 11:48:09 +0200
+Subject: [PATCH] tar: add IF_FEATURE_* checks
+
+A following linking error was observed:
+| ==========
+| archival/lib.a(tar.o): In function `tar_main':
+| archival/tar.c:1168: undefined reference to `unpack_Z_stream'
+| archival/tar.c:1168: undefined reference to `unpack_Z_stream'
+| ld: busybox_unstripped: hidden symbol `unpack_Z_stream' isn't defined
+| ld: final link failed: Bad value
+
+this happened with clang compiler, with the following configs:
+| CONFIG_TAR=y
+| # CONFIG_FEATURE_SEAMLESS_Z is not set
+
+which can be fixed by adding IF_FEATURE_* checks in.
+
+Upstream-Status: Pending [ Sent to busybox upstream on 2017-06-02 ]
+
+Signed-off-by: Ming Liu <peter.x.liu@external.atlascopco.com>
+---
+ archival/tar.c | 25 +++++++++++++++----------
+ 1 file changed, 15 insertions(+), 10 deletions(-)
+
+diff --git a/archival/tar.c b/archival/tar.c
+index b70e00a..7598b71 100644
+--- a/archival/tar.c
++++ b/archival/tar.c
+@@ -1216,21 +1216,26 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
+ USE_FOR_MMU(IF_DESKTOP(long long) int FAST_FUNC (*xformer)(transformer_state_t *xstate);)
+ USE_FOR_NOMMU(const char *xformer_prog;)
+
+- if (opt & OPT_COMPRESS)
+- USE_FOR_MMU(xformer = unpack_Z_stream;)
++ if (opt & OPT_COMPRESS) {
++ USE_FOR_MMU(IF_FEATURE_SEAMLESS_Z(xformer = unpack_Z_stream;))
+ USE_FOR_NOMMU(xformer_prog = "uncompress";)
+- if (opt & OPT_GZIP)
+- USE_FOR_MMU(xformer = unpack_gz_stream;)
++ }
++ if (opt & OPT_GZIP) {
++ USE_FOR_MMU(IF_FEATURE_SEAMLESS_GZ(xformer = unpack_gz_stream;))
+ USE_FOR_NOMMU(xformer_prog = "gunzip";)
+- if (opt & OPT_BZIP2)
+- USE_FOR_MMU(xformer = unpack_bz2_stream;)
++ }
++ if (opt & OPT_BZIP2) {
++ USE_FOR_MMU(IF_FEATURE_SEAMLESS_BZ2(xformer = unpack_bz2_stream;))
+ USE_FOR_NOMMU(xformer_prog = "bunzip2";)
+- if (opt & OPT_LZMA)
+- USE_FOR_MMU(xformer = unpack_lzma_stream;)
++ }
++ if (opt & OPT_LZMA) {
++ USE_FOR_MMU(IF_FEATURE_SEAMLESS_LZMA(xformer = unpack_lzma_stream;))
+ USE_FOR_NOMMU(xformer_prog = "unlzma";)
+- if (opt & OPT_XZ)
+- USE_FOR_MMU(xformer = unpack_xz_stream;)
++ }
++ if (opt & OPT_XZ) {
++ USE_FOR_MMU(IF_FEATURE_SEAMLESS_XZ(xformer = unpack_xz_stream;))
+ USE_FOR_NOMMU(xformer_prog = "unxz";)
++ }
+
+ fork_transformer_with_sig(tar_handle->src_fd, xformer, xformer_prog);
+ /* Can't lseek over pipes */
+--
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/defconfig b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/defconfig
index c0459d596..8803b52ac 100644
--- a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/defconfig
+++ b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/defconfig
@@ -279,7 +279,7 @@ CONFIG_SEQ=y
# CONFIG_SHA3SUM is not set
CONFIG_SLEEP=y
CONFIG_FEATURE_FANCY_SLEEP=y
-# CONFIG_FEATURE_FLOAT_SLEEP is not set
+CONFIG_FEATURE_FLOAT_SLEEP=y
CONFIG_SORT=y
CONFIG_FEATURE_SORT_BIG=y
# CONFIG_SPLIT is not set
@@ -582,7 +582,7 @@ CONFIG_FEATURE_FBSET_READMODE=y
# CONFIG_FDFLUSH is not set
# CONFIG_FDFORMAT is not set
CONFIG_FDISK=y
-# CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set
+CONFIG_FDISK_SUPPORT_LARGE_DISKS=y
CONFIG_FEATURE_FDISK_WRITABLE=y
# CONFIG_FEATURE_AIX_LABEL is not set
# CONFIG_FEATURE_SGI_LABEL is not set
@@ -981,6 +981,10 @@ CONFIG_SV_DEFAULT_SERVICE_DIR=""
# CONFIG_ENVUIDGID is not set
# CONFIG_ENVDIR is not set
# CONFIG_SOFTLIMIT is not set
+
+#
+# SELinux utilities
+#
# CONFIG_CHCON is not set
# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set
# CONFIG_GETENFORCE is not set
@@ -1010,7 +1014,7 @@ CONFIG_ASH_BUILTIN_ECHO=y
CONFIG_ASH_BUILTIN_PRINTF=y
CONFIG_ASH_BUILTIN_TEST=y
CONFIG_ASH_HELP=y
-# CONFIG_ASH_CMDCMD is not set
+CONFIG_ASH_CMDCMD=y
# CONFIG_ASH_MAIL is not set
CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
# CONFIG_ASH_RANDOM_SUPPORT is not set
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox_1.24.1.bb b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox_1.24.1.bb
index 400cdfe28..6ccbffd97 100644
--- a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox_1.24.1.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox_1.24.1.bb
@@ -38,8 +38,8 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
file://sha256sum.cfg \
file://getopts.cfg \
file://resize.cfg \
- ${@["", "file://init.cfg"][(d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'busybox')]} \
- ${@["", "file://mdev.cfg"][(d.getVar('VIRTUAL-RUNTIME_dev_manager', True) == 'busybox-mdev')]} \
+ ${@["", "file://init.cfg"][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'busybox')]} \
+ ${@["", "file://mdev.cfg"][(d.getVar('VIRTUAL-RUNTIME_dev_manager') == 'busybox-mdev')]} \
file://inittab \
file://rcS \
file://rcK \
@@ -57,6 +57,9 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
file://0001-libiproute-handle-table-ids-larger-than-255.patch \
file://ifupdown-pass-interface-device-name-for-ipv6-route-c.patch \
file://BUG9071_buffer_overflow_arp.patch \
+ file://busybox-tar-add-IF_FEATURE_-checks.patch \
+ file://0001-iproute-support-scope-.-Closes-8561.patch \
+ file://0001-ip-fix-an-improper-optimization-req.r.rtm_scope-may-.patch \
"
SRC_URI_append_libc-musl = " file://musl.cfg "
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox_git.bb b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox_git.bb
deleted file mode 100644
index c29b89434..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox_git.bb
+++ /dev/null
@@ -1,52 +0,0 @@
-require busybox.inc
-
-SRCREV = "1b7c17391de66502dd7a97c866e0a33681edbb1f"
-# Lookout for PV bump too when SRCREV is changed
-PV = "1.25.0+git${SRCPV}"
-
-S = "${WORKDIR}/git"
-
-SRC_URI = "git://busybox.net/busybox.git \
- file://busybox-udhcpc-no_deconfig.patch \
- file://find-touchscreen.sh \
- file://busybox-cron \
- file://busybox-httpd \
- file://busybox-udhcpd \
- file://default.script \
- file://simple.script \
- file://hwclock.sh \
- file://mount.busybox \
- file://syslog \
- file://syslog-startup.conf \
- file://syslog.conf \
- file://busybox-syslog.default \
- file://mdev \
- file://mdev.conf \
- file://mdev-mount.sh \
- file://umount.busybox \
- file://defconfig \
- file://busybox-syslog.service.in \
- file://busybox-klogd.service.in \
- file://fail_on_no_media.patch \
- file://run-ptest \
- file://inetd.conf \
- file://inetd \
- file://login-utilities.cfg \
- file://recognize_connmand.patch \
- file://busybox-cross-menuconfig.patch \
- file://0001-Use-CC-when-linking-instead-of-LD-and-use-CFLAGS-and.patch \
- file://mount-via-label.cfg \
- file://sha1sum.cfg \
- file://sha256sum.cfg \
- file://getopts.cfg \
- file://resize.cfg \
- ${@["", "file://init.cfg"][(d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'busybox')]} \
- ${@["", "file://mdev.cfg"][(d.getVar('VIRTUAL-RUNTIME_dev_manager', True) == 'busybox-mdev')]} \
- file://inittab \
- file://rcS \
- file://rcK \
- file://runlevel \
-"
-SRC_URI_append_libc-musl = " file://musl.cfg "
-
-DEFAULT_PREFERENCE = "-1"
diff --git a/import-layers/yocto-poky/meta/recipes-core/console-tools/console-tools-0.3.2/0001-Fix-format-security-compilation-error.patch b/import-layers/yocto-poky/meta/recipes-core/console-tools/console-tools-0.3.2/0001-Fix-format-security-compilation-error.patch
new file mode 100644
index 000000000..6e72ec665
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/console-tools/console-tools-0.3.2/0001-Fix-format-security-compilation-error.patch
@@ -0,0 +1,57 @@
+Subject: Fix 'format-security' compilation error.
+
+Upstream-Status: Pending
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ kbdtools/kbd_mode.c | 6 +++---
+ kbdtools/setmetamode.c | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/kbdtools/kbd_mode.c b/kbdtools/kbd_mode.c
+index 02dca38..8dbcd39 100644
+--- a/kbdtools/kbd_mode.c
++++ b/kbdtools/kbd_mode.c
+@@ -120,7 +120,7 @@ int main(int argc, char *argv[])
+ /* report mode */
+ if (ioctl(fd, KDGKBMODE, &mode))
+ {
+- fprintf(stderr, progname);
++ fprintf(stderr, "%s", progname);
+ perror(_(": error reading keyboard mode\n"));
+ exit(1);
+ }
+@@ -151,7 +151,7 @@ int main(int argc, char *argv[])
+ kbd_rep.period = rate;
+ if (ioctl(fd, KDKBDREP, &kbd_rep))
+ {
+- fprintf(stderr, progname);
++ fprintf(stderr, "%s", progname);
+ perror(_(": error setting keyboard repeat mode\n"));
+ exit(1);
+ }
+@@ -160,7 +160,7 @@ int main(int argc, char *argv[])
+
+ if (ioctl(fd, KDSKBMODE, mode))
+ {
+- fprintf(stderr, progname);
++ fprintf(stderr, "%s", progname);
+ perror(_(": error setting keyboard mode\n"));
+ exit(1);
+ }
+diff --git a/kbdtools/setmetamode.c b/kbdtools/setmetamode.c
+index 5bed945..0ba7676 100644
+--- a/kbdtools/setmetamode.c
++++ b/kbdtools/setmetamode.c
+@@ -42,7 +42,7 @@ void report(int meta)
+ default:
+ s = N_("Strange mode for Meta key?\n");
+ }
+- printf(_(s));
++ printf("%s", _(s));
+ }
+
+ struct meta
+--
+2.8.3
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/console-tools/console-tools_0.3.2.bb b/import-layers/yocto-poky/meta/recipes-core/console-tools/console-tools_0.3.2.bb
index 1db8414cb..286c2a475 100644
--- a/import-layers/yocto-poky/meta/recipes-core/console-tools/console-tools_0.3.2.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/console-tools/console-tools_0.3.2.bb
@@ -16,6 +16,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/lct/console-tools-${PV}.tar.gz \
file://no-dep-on-libfl.patch \
file://0001-kbdtools-Include-sys-types.h-for-u_char-and-u_short-.patch \
file://0001-Cover-the-else-with-__GLIBC__.patch \
+ file://0001-Fix-format-security-compilation-error.patch \
file://lcmessage.m4 \
file://Makevars"
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-6.9-cp-i-u.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-6.9-cp-i-u.patch
deleted file mode 100644
index 5452b46bb..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-6.9-cp-i-u.patch
+++ /dev/null
@@ -1,120 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-This patch was imported from the Fedora Core 8 coreutils-6.9-9 package.
-
-The package is stated as being Licensed as GPLv2+.
-
-Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-
-----
-
-When "cp -i --update old new" would do nothing because "new" is
-newer than "old", cp would nonetheless prompt for whether it is
-ok to overwrite "new". Then, regardless of the response (because
-of the --update option), cp would do nothing.
-
-The following patch eliminates the unnecessary prompt in that case.
-
-diff --git a/src/copy.c b/src/copy.c
-index b7bf73b..0e549d2 100644
---- a/src/copy.c
-+++ b/src/copy.c
-@@ -1210,6 +1210,30 @@ copy_internal (char const *src_name, char const *dst_name,
- return false;
- }
-
-+ if (!S_ISDIR (src_mode) && x->update)
-+ {
-+ /* When preserving time stamps (but not moving within a file
-+ system), don't worry if the destination time stamp is
-+ less than the source merely because of time stamp
-+ truncation. */
-+ int options = ((x->preserve_timestamps
-+ && ! (x->move_mode
-+ && dst_sb.st_dev == src_sb.st_dev))
-+ ? UTIMECMP_TRUNCATE_SOURCE
-+ : 0);
-+
-+ if (0 <= utimecmp (dst_name, &dst_sb, &src_sb, options))
-+ {
-+ /* We're using --update and the destination is not older
-+ than the source, so do not copy or move. Pretend the
-+ rename succeeded, so the caller (if it's mv) doesn't
-+ end up removing the source file. */
-+ if (rename_succeeded)
-+ *rename_succeeded = true;
-+ return true;
-+ }
-+ }
-+
- /* When there is an existing destination file, we may end up
- returning early, and hence not copying/moving the file.
- This may be due to an interactive `negative' reply to the
-@@ -1302,30 +1326,6 @@ copy_internal (char const *src_name, char const *dst_name,
- return false;
- }
- }
--
-- if (x->update)
-- {
-- /* When preserving time stamps (but not moving within a file
-- system), don't worry if the destination time stamp is
-- less than the source merely because of time stamp
-- truncation. */
-- int options = ((x->preserve_timestamps
-- && ! (x->move_mode
-- && dst_sb.st_dev == src_sb.st_dev))
-- ? UTIMECMP_TRUNCATE_SOURCE
-- : 0);
--
-- if (0 <= utimecmp (dst_name, &dst_sb, &src_sb, options))
-- {
-- /* We're using --update and the destination is not older
-- than the source, so do not copy or move. Pretend the
-- rename succeeded, so the caller (if it's mv) doesn't
-- end up removing the source file. */
-- if (rename_succeeded)
-- *rename_succeeded = true;
-- return true;
-- }
-- }
- }
-
- if (x->move_mode)
-diff --git a/tests/mv/update b/tests/mv/update
-index 0c06024..6c3d149 100755
---- a/tests/mv/update
-+++ b/tests/mv/update
-@@ -1,7 +1,7 @@
- #!/bin/sh
- # make sure --update works as advertised
-
--# Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
-+# Copyright (C) 2001, 2004, 2006-2007 Free Software Foundation, Inc.
-
- # 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
-@@ -46,11 +46,16 @@ fi
-
- fail=0
-
--for cp_or_mv in cp mv; do
-- # This is a no-op.
-- $cp_or_mv --update old new || fail=1
-- case "`cat new`" in new) ;; *) fail=1 ;; esac
-- case "`cat old`" in old) ;; *) fail=1 ;; esac
-+for interactive in '' -i; do
-+ for cp_or_mv in cp mv; do
-+ # This is a no-op, with no prompt.
-+ # With coreutils-6.9 and earlier, using --update with -i would
-+ # mistakenly elicit a prompt.
-+ $cp_or_mv $interactive --update old new < /dev/null > out 2>&1 || fail=1
-+ test -s out && fail=1
-+ case "`cat new`" in new) ;; *) fail=1 ;; esac
-+ case "`cat old`" in old) ;; *) fail=1 ;; esac
-+ done
- done
-
- # This will actually perform the rename.
---
-1.5.3.rc1.16.g9d6f
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-install.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-install.patch
deleted file mode 100644
index 88f61fa10..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-install.patch
+++ /dev/null
@@ -1,101 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-The install command doesn't over write the dangling symlink, for
-example:
-
-$ install fileA /tmp/fileA
-
-If /tmp/fileA is a dangling symlink, there would be an error:
-
-install: cannot create regular file '/tmp/fileA': File exists
-
-This is because of the following code in copy.c:
-
- if (!new_dst)
- {
- if (XSTAT (x, dst_name, &dst_sb) != 0)
- {
- if (errno != ENOENT)
- {
- error (0, errno, _("cannot stat %s"), quote (dst_name));
- return false;
- }
- else
- {
- new_dst = true;
- }
- }
-
-XSTAT() use stat() for dst_name(the dangling symlink /tmp/fileA) when
-install.c invokes it, and stat will set errno to ENOENT, and then
-new_dst will be set to true which means that /tmp/fileA doesn't exist,
-then we will create /tmp/fileA without remove it first, so the error
-comes.
-
-This is fixed in a way which adds the member cmd_install in
-struct cp_options to make sure my change only affected to the install
-command and use lstat to fix the problem.
-
-Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
-Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-
----
- src/copy.c | 10 +++++++++-
- src/copy.h | 3 +++
- src/install.c | 1 +
- 3 files changed, 13 insertions(+), 1 deletions(-)
-
-diff --git a/src/copy.c b/src/copy.c
---- a/src/copy.c
-+++ b/src/copy.c
-@@ -1029,6 +1029,7 @@ copy_internal (char const *src_name, char const *dst_name,
- bool delayed_ok;
- bool copied_as_regular = false;
- bool preserve_metadata;
-+ int dst_stat_result;
-
- if (x->move_mode && rename_succeeded)
- *rename_succeeded = false;
-@@ -1069,7 +1070,14 @@ copy_internal (char const *src_name, char const *dst_name,
-
- if (!new_dst)
- {
-- if (XSTAT (x, dst_name, &dst_sb) != 0)
-+ if ( x->cmd_install && ( x->backup_type == no_backups))
-+ dst_stat_result = lstat (dst_name, &dst_sb);
-+ else
-+ {
-+ dst_stat_result = XSTAT (x, dst_name, &dst_sb);
-+ }
-+
-+ if (dst_stat_result != 0)
- {
- if (errno != ENOENT)
- {
-diff --git a/src/copy.h b/src/copy.h
---- a/src/copy.h
-+++ b/src/copy.h
-@@ -114,6 +114,9 @@ struct cp_options
- If that fails, then resort to copying. */
- bool move_mode;
-
-+ /* For the install command */
-+ bool cmd_install;
-+
- /* Whether this process has appropriate privileges to chown a file
- whose owner is not the effective user ID. */
- bool chown_privileges;
-diff --git a/src/install.c b/src/install.c
---- a/src/install.c
-+++ b/src/install.c
-@@ -149,6 +149,7 @@ cp_option_init (struct cp_options *x)
- x->hard_link = false;
- x->interactive = I_UNSPECIFIED;
- x->move_mode = false;
-+ x->cmd_install = true;
- x->chown_privileges = chown_privileges ();
- x->one_file_system = false;
- x->preserve_ownership = false;
---
-1.7.0.1
-
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-texinfo.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-texinfo.patch
deleted file mode 100644
index 3ae5a2fae..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-texinfo.patch
+++ /dev/null
@@ -1,375 +0,0 @@
-From 170be4023bbf9e9698a709e03265945588ac8e01 Mon Sep 17 00:00:00 2001
-From: Robert Yang <liezhi.yang@windriver.com>
-Date: Tue, 26 Nov 2013 00:21:50 +0800
-Subject: [PATCH] doc/coreutils.texi: Use '@item' instead of '@itemx'
-
-Use '@item' instead of '@itemx' in several places, as Texinfo 5 refuses
-to process an '@itemx' that is not preceded by an '@item'. Ensure that
-node extended names in menus and sectioning are consistent, and that
-ordering and presence of nodes in menus and in the actual text are
-consistent as well.
-
-Upstream-Status: Backport [From: coreutils.7620.n7.nabble.com, bug#11828]
-
-Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
----
- doc/coreutils.texi | 82 +++++++++++++++++++++++++++---------------------------
- 1 file changed, 41 insertions(+), 41 deletions(-)
-
-diff --git a/doc/coreutils.texi b/doc/coreutils.texi
-index 588147f..2dae3fe 100644
---- a/doc/coreutils.texi
-+++ b/doc/coreutils.texi
-@@ -555,7 +555,7 @@ symbolic link to a directory. @xref{Target directory}.
- @end macro
-
- @macro optSi
--@itemx --si
-+@item --si
- @opindex --si
- @cindex SI output
- Append an SI-style abbreviation to each size, such as @samp{M} for
-@@ -578,7 +578,7 @@ Use the @option{--si} option if you prefer powers of 1000.
- @end macro
-
- @macro optStripTrailingSlashes
--@itemx @w{@kbd{--strip-trailing-slashes}}
-+@item @w{@kbd{--strip-trailing-slashes}}
- @opindex --strip-trailing-slashes
- @cindex stripping trailing slashes
- Remove any trailing slashes from each @var{source} argument.
-@@ -2496,7 +2496,7 @@ by 1048576.
- However, if @var{n} starts with a @samp{-},
- print all but the last @var{n} bytes of each file.
-
--@itemx -n @var{n}
-+@item -n @var{n}
- @itemx --lines=@var{n}
- @opindex -n
- @opindex --lines
-@@ -2633,7 +2633,7 @@ This option is the same as @option{--follow=name --retry}. That is, tail
- will attempt to reopen a file when it is removed. Should this fail, tail
- will keep trying until it becomes accessible again.
-
--@itemx --retry
-+@item --retry
- @opindex --retry
- This option is useful mainly when following by name (i.e., with
- @option{--follow=name}).
-@@ -2641,7 +2641,7 @@ Without this option, when tail encounters a file that doesn't
- exist or is otherwise inaccessible, it reports that fact and
- never checks it again.
-
--@itemx --sleep-interval=@var{number}
-+@item --sleep-interval=@var{number}
- @opindex --sleep-interval
- Change the number of seconds to wait between iterations (the default is 1.0).
- During one iteration, every specified file is checked to see if it has
-@@ -2651,7 +2651,7 @@ Historical implementations of @command{tail} have required that
- an arbitrary floating point number (using a period before any
- fractional digits).
-
--@itemx --pid=@var{pid}
-+@item --pid=@var{pid}
- @opindex --pid
- When following by name or by descriptor, you may specify the process ID,
- @var{pid}, of the sole writer of all @var{file} arguments. Then, shortly
-@@ -2674,7 +2674,7 @@ terminate until long after the real writer has terminated.
- Note that @option{--pid} cannot be supported on some systems; @command{tail}
- will print a warning if this is the case.
-
--@itemx --max-unchanged-stats=@var{n}
-+@item --max-unchanged-stats=@var{n}
- @opindex --max-unchanged-stats
- When tailing a file by name, if there have been @var{n} (default
- n=@value{DEFAULT_MAX_N_UNCHANGED_STATS_BETWEEN_OPENS}) consecutive
-@@ -2686,7 +2686,7 @@ number of seconds between when tail prints the last pre-rotation lines
- and when it prints the lines that have accumulated in the new log file.
- This option is meaningful only when following by name.
-
--@itemx -n @var{n}
-+@item -n @var{n}
- @itemx --lines=@var{n}
- @opindex -n
- @opindex --lines
-@@ -2817,7 +2817,7 @@ option.
- @opindex --numeric-suffixes
- Use digits in suffixes rather than lower-case letters.
-
--@itemx --verbose
-+@item --verbose
- @opindex --verbose
- Write a diagnostic to standard error just before each output file is opened.
-
-@@ -3055,7 +3055,7 @@ Print only the newline counts.
- @opindex --max-line-length
- Print only the maximum line lengths.
-
--@itemx --files0-from=@var{FILE}
-+@item --files0-from=@var{FILE}
- @opindex --files0-from=@var{FILE}
- @cindex including files from @command{du}
- Rather than processing files named on the command line, process those
-@@ -3250,7 +3250,7 @@ an MD5 checksum inconsistent with the associated file, or if no valid
- line is found, @command{md5sum} exits with nonzero status. Otherwise,
- it exits successfully.
-
--@itemx --status
-+@item --status
- @opindex --status
- @cindex verifying MD5 checksums
- This option is useful only when verifying checksums.
-@@ -5837,7 +5837,7 @@ command line unless the @option{--dereference-command-line} (@option{-H}),
- If a command line argument specifies a symbolic link, show information
- for the file the link references rather than for the link itself.
-
--@itemx --dereference-command-line-symlink-to-dir
-+@item --dereference-command-line-symlink-to-dir
- @opindex --dereference-command-line-symlink-to-dir
- @cindex symbolic links, dereferencing
- Do not dereference symbolic links, with one exception:
-@@ -7015,15 +7015,15 @@ If specified, the @var{attribute_list} must be a comma-separated list
- of one or more of the following strings:
-
- @table @samp
--@itemx mode
-+@item mode
- Preserve the file mode bits and access control lists.
--@itemx ownership
-+@item ownership
- Preserve the owner and group. On most modern systems,
- only users with appropriate privileges may change the owner of a file,
- and ordinary users
- may preserve the group ownership of a file only if they happen to be
- a member of the desired group.
--@itemx timestamps
-+@item timestamps
- Preserve the times of last access and last modification, when possible.
- In general, it is not possible to preserve these attributes
- when the affected file is a symbolic link.
-@@ -7031,12 +7031,12 @@ However, FreeBSD now provides the @code{lutimes} function, which makes
- it possibile even for symbolic links. However, this implementation does
- not yet take advantage of that.
- @c FIXME: once we provide lutimes support, update the above.
--@itemx links
-+@item links
- Preserve in the destination files
- any links between corresponding source files.
- @c Give examples illustrating how hard links are preserved.
- @c Also, show how soft links map to hard links with -L and -H.
--@itemx all
-+@item all
- Preserve all file attributes.
- Equivalent to specifying all of the above.
- @end table
-@@ -7049,12 +7049,12 @@ mode bits of the corresponding source file, minus the bits set in the
- umask and minus the set-user-ID and set-group-ID bits.
- @xref{File permissions}.
-
--@itemx @w{@kbd{--no-preserve}=@var{attribute_list}}
-+@item @w{@kbd{--no-preserve}=@var{attribute_list}}
- @cindex file information, preserving
- Do not preserve the specified attributes. The @var{attribute_list}
- has the same form as for @option{--preserve}.
-
--@itemx --parents
-+@item --parents
- @opindex --parents
- @cindex parent directories and @command{cp}
- Form the name of each destination file by appending to the target
-@@ -7070,7 +7070,7 @@ cp --parents a/b/c existing_dir
- copies the file @file{a/b/c} to @file{existing_dir/a/b/c}, creating
- any missing intermediate directories.
-
--@itemx @w{@kbd{--reply}=@var{how}}
-+@item @w{@kbd{--reply}=@var{how}}
- @opindex --reply
- @cindex interactivity
- @c FIXME: remove in 2008
-@@ -7742,7 +7742,7 @@ Prompt whether to overwrite each existing destination file, regardless
- of its permissions.
- If the response is not affirmative, the file is skipped.
-
--@itemx @w{@kbd{--reply}=@var{how}}
-+@item @w{@kbd{--reply}=@var{how}}
- @opindex --reply
- @cindex interactivity
- @c FIXME: remove in 2008
-@@ -7847,7 +7847,7 @@ files are named or if a recursive removal is requested. Ignore any
- previous @option{--force} (@option{-f}) option. Equivalent to
- @option{--interactive=once}.
-
--@itemx --interactive [=@var{when}]
-+@item --interactive [=@var{when}]
- @opindex --interactive
- Specify when to issue an interactive prompt. @var{when} may be
- omitted, or one of:
-@@ -7866,7 +7866,7 @@ removal is requested. Equivalent to @option{-I}.
- Specifying @option{--interactive} and no @var{when} is equivalent to
- @option{--interactive=always}.
-
--@itemx --one-file-system
-+@item --one-file-system
- @opindex --one-file-system
- @cindex one file system, restricting @command{rm} to
- When removing a hierarchy recursively, skip any directory that is on a
-@@ -7884,7 +7884,7 @@ warn about and skip directories on other file systems.
- Of course, this will not save your @file{/home} if it and your
- chroot happen to be on the same file system.
-
--@itemx --preserve-root
-+@item --preserve-root
- @opindex --preserve-root
- @cindex root directory, disallow recursive destruction
- Fail upon any attempt to remove the root directory, @file{/},
-@@ -7892,7 +7892,7 @@ when used with the @option{--recursive} option.
- This is the default behavior.
- @xref{Treating / specially}.
-
--@itemx --no-preserve-root
-+@item --no-preserve-root
- @opindex --no-preserve-root
- @cindex root directory, allow recursive destruction
- Do not treat @file{/} specially when removing recursively.
-@@ -8874,7 +8874,7 @@ actually changes.
- Do not print error messages about files whose ownership cannot be
- changed.
-
--@itemx @w{@kbd{--from}=@var{old-owner}}
-+@item @w{@kbd{--from}=@var{old-owner}}
- @opindex --from
- @cindex symbolic links, changing owner
- Change a @var{file}'s ownership only if it has current attributes specified
-@@ -8928,14 +8928,14 @@ is a symbolic link.
- By default, no diagnostic is issued for symbolic links encountered
- during a recursive traversal, but see @option{--verbose}.
-
--@itemx --preserve-root
-+@item --preserve-root
- @opindex --preserve-root
- @cindex root directory, disallow recursive modification
- Fail upon any attempt to recursively change the root directory, @file{/}.
- Without @option{--recursive}, this option has no effect.
- @xref{Treating / specially}.
-
--@itemx --no-preserve-root
-+@item --no-preserve-root
- @opindex --no-preserve-root
- @cindex root directory, allow recursive modification
- Cancel the effect of any preceding @option{--preserve-root} option.
-@@ -9054,14 +9054,14 @@ is a symbolic link.
- By default, no diagnostic is issued for symbolic links encountered
- during a recursive traversal, but see @option{--verbose}.
-
--@itemx --preserve-root
-+@item --preserve-root
- @opindex --preserve-root
- @cindex root directory, disallow recursive modification
- Fail upon any attempt to recursively change the root directory, @file{/}.
- Without @option{--recursive}, this option has no effect.
- @xref{Treating / specially}.
-
--@itemx --no-preserve-root
-+@item --no-preserve-root
- @opindex --no-preserve-root
- @cindex root directory, allow recursive modification
- Cancel the effect of any preceding @option{--preserve-root} option.
-@@ -9175,14 +9175,14 @@ actually changes.
- Do not print error messages about files whose permissions cannot be
- changed.
-
--@itemx --preserve-root
-+@item --preserve-root
- @opindex --preserve-root
- @cindex root directory, disallow recursive modification
- Fail upon any attempt to recursively change the root directory, @file{/}.
- Without @option{--recursive}, this option has no effect.
- @xref{Treating / specially}.
-
--@itemx --no-preserve-root
-+@item --no-preserve-root
- @opindex --no-preserve-root
- @cindex root directory, allow recursive modification
- Cancel the effect of any preceding @option{--preserve-root} option.
-@@ -9603,7 +9603,7 @@ The program accepts the following options. Also see @ref{Common options}.
- @opindex --all
- Show counts for all files, not just directories.
-
--@itemx --apparent-size
-+@item --apparent-size
- @opindex --apparent-size
- Print apparent sizes, rather than disk usage. The apparent size of a
- file is the number of bytes reported by @code{wc -c} on regular files,
-@@ -9654,7 +9654,7 @@ Does not affect other symbolic links. This is helpful for finding
- out the disk usage of directories, such as @file{/usr/tmp}, which
- are often symbolic links.
-
--@itemx --files0-from=@var{FILE}
-+@item --files0-from=@var{FILE}
- @opindex --files0-from=@var{FILE}
- @cindex including files from @command{du}
- Rather than processing files named on the command line, process those
-@@ -9733,7 +9733,7 @@ Output a null byte at the end of each line, rather than a newline.
- This option enables other programs to parse the output of @command{du}
- even when that output would contain file names with embedded newlines.
-
--@itemx --si
-+@item --si
- @opindex --si
- @cindex SI output
- Append an SI-style abbreviation to each size, such as @samp{MB} for
-@@ -9754,13 +9754,13 @@ Display only a total for each argument.
- Report the size of each directory separately, not including the sizes
- of subdirectories.
-
--@itemx --time
-+@item --time
- @opindex --time
- @cindex last modified dates, displaying in @command{du}
- Show time of the most recent modification of any file in the directory,
- or any of its subdirectories.
-
--@itemx --time=ctime
-+@item --time=ctime
- @itemx --time=status
- @itemx --time=use
- @opindex --time
-@@ -9770,7 +9770,7 @@ or any of its subdirectories.
- Show the most recent status change time (the @samp{ctime} in the inode) of
- any file in the directory, instead of the modification time.
-
--@itemx --time=atime
-+@item --time=atime
- @itemx --time=access
- @opindex --time
- @opindex atime@r{, show the most recent}
-@@ -9911,7 +9911,7 @@ $ stat --format=%d:%i / /usr
- 2057:2
- @end example
-
--@itemx --printf=@var{format}
-+@item --printf=@var{format}
- @opindex --printf=@var{format}
- @cindex output format
- Use @var{format} rather than the default format.
-@@ -12240,7 +12240,7 @@ Overrides all other options.
- @opindex -s
- Ignored; for compatibility with other versions of @command{who}.
-
--@itemx -u
-+@item -u
- @opindex -u
- @cindex idle time
- After the login time, print the number of hours and minutes that the
-@@ -12254,7 +12254,7 @@ user has been idle. @samp{.} means the user was active in the last minute.
- List only the entries that correspond to processes via which the
- system is waiting for a user to login. The user name is always @samp{LOGIN}.
-
--@itemx --lookup
-+@item --lookup
- @opindex --lookup
- Attempt to canonicalize hostnames found in utmp through a DNS lookup. This
- is not the default because it can cause significant delays on systems with
---
-1.8.3.1
-
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-i18n.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-i18n.patch
deleted file mode 100644
index 653722348..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-i18n.patch
+++ /dev/null
@@ -1,4051 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-This patch was imported from the Fedora Core 8 coreutils-6.9-9 package.
-
-The package is stated as being Licensed as GPLv2+.
-
-The comment indicates that the purpose is lin18nux/lsb compliance.
-
-Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-
---- /dev/null 2007-03-01 09:16:39.219409909 +0000
-+++ coreutils-6.8+/tests/sort/sort-mb-tests 2007-03-01 15:08:24.000000000 +0000
-@@ -0,0 +1,58 @@
-+#! /bin/sh
-+case $# in
-+ 0) xx='../../src/sort';;
-+ *) xx="$1";;
-+esac
-+test "$VERBOSE" && echo=echo || echo=:
-+$echo testing program: $xx
-+errors=0
-+test "$srcdir" || srcdir=.
-+test "$VERBOSE" && $xx --version 2> /dev/null
-+
-+export LC_ALL=en_US.UTF-8
-+locale -k LC_CTYPE 2>&1 | grep -q charmap.*UTF-8 || exit 77
-+errors=0
-+
-+$xx -t @ -k2 -n mb1.I > mb1.O
-+code=$?
-+if test $code != 0; then
-+ $echo "Test mb1 failed: $xx return code $code differs from expected value 0" 1>&2
-+ errors=`expr $errors + 1`
-+else
-+ cmp mb1.O $srcdir/mb1.X > /dev/null 2>&1
-+ case $? in
-+ 0) if test "$VERBOSE"; then $echo "passed mb1"; fi;;
-+ 1) $echo "Test mb1 failed: files mb1.O and $srcdir/mb1.X differ" 1>&2
-+ (diff -c mb1.O $srcdir/mb1.X) 2> /dev/null
-+ errors=`expr $errors + 1`;;
-+ 2) $echo "Test mb1 may have failed." 1>&2
-+ $echo The command "cmp mb1.O $srcdir/mb1.X" failed. 1>&2
-+ errors=`expr $errors + 1`;;
-+ esac
-+fi
-+
-+$xx -t @ -k4 -n mb2.I > mb2.O
-+code=$?
-+if test $code != 0; then
-+ $echo "Test mb2 failed: $xx return code $code differs from expected value 0" 1>&2
-+ errors=`expr $errors + 1`
-+else
-+ cmp mb2.O $srcdir/mb2.X > /dev/null 2>&1
-+ case $? in
-+ 0) if test "$VERBOSE"; then $echo "passed mb2"; fi;;
-+ 1) $echo "Test mb2 failed: files mb2.O and $srcdir/mb2.X differ" 1>&2
-+ (diff -c mb2.O $srcdir/mb2.X) 2> /dev/null
-+ errors=`expr $errors + 1`;;
-+ 2) $echo "Test mb2 may have failed." 1>&2
-+ $echo The command "cmp mb2.O $srcdir/mb2.X" failed. 1>&2
-+ errors=`expr $errors + 1`;;
-+ esac
-+fi
-+
-+if test $errors = 0; then
-+ $echo Passed all 113 tests. 1>&2
-+else
-+ $echo Failed $errors tests. 1>&2
-+fi
-+test $errors = 0 || errors=1
-+exit $errors
---- /dev/null 2007-03-01 09:16:39.219409909 +0000
-+++ coreutils-6.8+/tests/sort/mb2.I 2007-03-01 15:08:24.000000000 +0000
-@@ -0,0 +1,4 @@
-+Apple@AA10@@20
-+Banana@AA5@@30
-+Citrus@AA20@@5
-+Cherry@AA30@@10
---- /dev/null 2007-03-01 09:16:39.219409909 +0000
-+++ coreutils-6.8+/tests/sort/mb2.X 2007-03-01 15:08:24.000000000 +0000
-@@ -0,0 +1,4 @@
-+Citrus@AA20@@5
-+Cherry@AA30@@10
-+Apple@AA10@@20
-+Banana@AA5@@30
---- /dev/null 2007-03-01 09:16:39.219409909 +0000
-+++ coreutils-6.8+/tests/sort/mb1.I 2007-03-01 15:08:24.000000000 +0000
-@@ -0,0 +1,4 @@
-+Apple@10
-+Banana@5
-+Citrus@20
-+Cherry@30
---- /dev/null 2007-03-01 09:16:39.219409909 +0000
-+++ coreutils-6.8+/tests/sort/mb1.X 2007-03-01 15:08:24.000000000 +0000
-@@ -0,0 +1,4 @@
-+Banana@5
-+Apple@10
-+Citrus@20
-+Cherry@30
---- coreutils-6.8+/tests/sort/Makefile.am.i18n 2007-01-24 07:47:37.000000000 +0000
-+++ coreutils-6.8+/tests/sort/Makefile.am 2007-03-01 15:09:59.000000000 +0000
-@@ -66,15 +66,17 @@
- bigfield.O bigfield.E
- ##test-files-end
-
--EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
--noinst_SCRIPTS = $x-tests
-+run_gen += mb1.0 mb2.0
-+
-+EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen) mb1.I mb1.X mb2.I mb2.X
-+noinst_SCRIPTS = $x-tests # $x-mb-tests
- TESTS_ENVIRONMENT = \
- CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \
- PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH"
-
- editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,$(srcdir),g'
-
--TESTS = $x-tests
-+TESTS = $x-tests $x-mb-tests
-
- mk_script = $(srcdir)/../mk-script
- $(srcdir)/$x-tests: $(mk_script) Test.pm Makefile.am
---- coreutils-6.8+/lib/linebuffer.h.i18n 2005-05-14 07:44:24.000000000 +0100
-+++ coreutils-6.8+/lib/linebuffer.h 2007-03-01 15:08:24.000000000 +0000
-@@ -22,6 +22,11 @@
-
- # include <stdio.h>
-
-+/* Get mbstate_t. */
-+# if HAVE_WCHAR_H
-+# include <wchar.h>
-+# endif
-+
- /* A `struct linebuffer' holds a line of text. */
-
- struct linebuffer
-@@ -29,6 +34,9 @@
- size_t size; /* Allocated. */
- size_t length; /* Used. */
- char *buffer;
-+# if HAVE_WCHAR_H
-+ mbstate_t state;
-+# endif
- };
-
- /* Initialize linebuffer LINEBUFFER for use. */
---- coreutils-6.8+/src/expand.c.i18n 2007-01-14 15:41:28.000000000 +0000
-+++ coreutils-6.8+/src/expand.c 2007-03-01 15:08:24.000000000 +0000
-@@ -38,11 +38,28 @@
- #include <stdio.h>
- #include <getopt.h>
- #include <sys/types.h>
-+
-+/* Get mbstate_t, mbrtowc(), wcwidth(). */
-+#if HAVE_WCHAR_H
-+# include <wchar.h>
-+#endif
-+
- #include "system.h"
- #include "error.h"
- #include "quote.h"
- #include "xstrndup.h"
-
-+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
-+ installation; work around this configuration error. */
-+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
-+# define MB_LEN_MAX 16
-+#endif
-+
-+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
-+#if HAVE_MBRTOWC && defined mbstate_t
-+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
-+#endif
-+
- /* The official name of this program (e.g., no `g' prefix). */
- #define PROGRAM_NAME "expand"
-
-@@ -183,6 +200,7 @@
- stops = num_start + len - 1;
- }
- }
-+
- else
- {
- error (0, 0, _("tab size contains invalid character(s): %s"),
-@@ -365,6 +383,142 @@
- }
- }
-
-+#if HAVE_MBRTOWC
-+static void
-+expand_multibyte (void)
-+{
-+ FILE *fp; /* Input strem. */
-+ mbstate_t i_state; /* Current shift state of the input stream. */
-+ mbstate_t i_state_bak; /* Back up the I_STATE. */
-+ mbstate_t o_state; /* Current shift state of the output stream. */
-+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
-+ char *bufpos; /* Next read position of BUF. */
-+ size_t buflen = 0; /* The length of the byte sequence in buf. */
-+ wchar_t wc; /* A gotten wide character. */
-+ size_t mblength; /* The byte size of a multibyte character
-+ which shows as same character as WC. */
-+ int tab_index = 0; /* Index in `tab_list' of next tabstop. */
-+ int column = 0; /* Column on screen of the next char. */
-+ int next_tab_column; /* Column the next tab stop is on. */
-+ int convert = 1; /* If nonzero, perform translations. */
-+
-+ fp = next_file ((FILE *) NULL);
-+ if (fp == NULL)
-+ return;
-+
-+ memset (&o_state, '\0', sizeof(mbstate_t));
-+ memset (&i_state, '\0', sizeof(mbstate_t));
-+
-+ for (;;)
-+ {
-+ /* Refill the buffer BUF. */
-+ if (buflen < MB_LEN_MAX && !feof(fp) && !ferror(fp))
-+ {
-+ memmove (buf, bufpos, buflen);
-+ buflen += fread (buf + buflen, sizeof(char), BUFSIZ, fp);
-+ bufpos = buf;
-+ }
-+
-+ /* No character is left in BUF. */
-+ if (buflen < 1)
-+ {
-+ fp = next_file (fp);
-+
-+ if (fp == NULL)
-+ break; /* No more files. */
-+ else
-+ {
-+ memset (&i_state, '\0', sizeof(mbstate_t));
-+ continue;
-+ }
-+ }
-+
-+ /* Get a wide character. */
-+ i_state_bak = i_state;
-+ mblength = mbrtowc (&wc, bufpos, buflen, &i_state);
-+
-+ switch (mblength)
-+ {
-+ case (size_t)-1: /* illegal byte sequence. */
-+ case (size_t)-2:
-+ mblength = 1;
-+ i_state = i_state_bak;
-+ if (convert)
-+ {
-+ ++column;
-+ if (convert_entire_line == 0)
-+ convert = 0;
-+ }
-+ putchar (*bufpos);
-+ break;
-+
-+ case 0: /* null. */
-+ mblength = 1;
-+ if (convert && convert_entire_line == 0)
-+ convert = 0;
-+ putchar ('\0');
-+ break;
-+
-+ default:
-+ if (wc == L'\n') /* LF. */
-+ {
-+ tab_index = 0;
-+ column = 0;
-+ convert = 1;
-+ putchar ('\n');
-+ }
-+ else if (wc == L'\t' && convert) /* Tab. */
-+ {
-+ if (tab_size == 0)
-+ {
-+ /* Do not let tab_index == first_free_tab;
-+ stop when it is 1 less. */
-+ while (tab_index < first_free_tab - 1
-+ && column >= tab_list[tab_index])
-+ tab_index++;
-+ next_tab_column = tab_list[tab_index];
-+ if (tab_index < first_free_tab - 1)
-+ tab_index++;
-+ if (column >= next_tab_column)
-+ next_tab_column = column + 1;
-+ }
-+ else
-+ next_tab_column = column + tab_size - column % tab_size;
-+
-+ while (column < next_tab_column)
-+ {
-+ putchar (' ');
-+ ++column;
-+ }
-+ }
-+ else /* Others. */
-+ {
-+ if (convert)
-+ {
-+ if (wc == L'\b')
-+ {
-+ if (column > 0)
-+ --column;
-+ }
-+ else
-+ {
-+ int width; /* The width of WC. */
-+
-+ width = wcwidth (wc);
-+ column += (width > 0) ? width : 0;
-+ if (convert_entire_line == 0)
-+ convert = 0;
-+ }
-+ }
-+ fwrite (bufpos, sizeof(char), mblength, stdout);
-+ }
-+ }
-+ buflen -= mblength;
-+ bufpos += mblength;
-+ }
-+}
-+#endif
-+
- int
- main (int argc, char **argv)
- {
-@@ -429,7 +583,12 @@
-
- file_list = (optind < argc ? &argv[optind] : stdin_argv);
-
-- expand ();
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ expand_multibyte ();
-+ else
-+#endif
-+ expand ();
-
- if (have_read_stdin && fclose (stdin) != 0)
- error (EXIT_FAILURE, errno, "-");
---- coreutils-6.8+/src/join.c.i18n 2007-01-14 15:41:28.000000000 +0000
-+++ coreutils-6.8+/src/join.c 2007-03-01 15:08:24.000000000 +0000
-@@ -23,16 +23,30 @@
- #include <sys/types.h>
- #include <getopt.h>
-
-+/* Get mbstate_t, mbrtowc(), mbrtowc(), wcwidth(). */
-+#if HAVE_WCHAR_H
-+# include <wchar.h>
-+#endif
-+
-+/* Get iswblank(), towupper. */
-+#if HAVE_WCTYPE_H
-+# include <wctype.h>
-+#endif
-+
- #include "system.h"
- #include "error.h"
- #include "hard-locale.h"
- #include "linebuffer.h"
--#include "memcasecmp.h"
- #include "quote.h"
- #include "stdio--.h"
- #include "xmemcoll.h"
- #include "xstrtol.h"
-
-+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
-+#if HAVE_MBRTOWC && defined mbstate_t
-+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
-+#endif
-+
- /* The official name of this program (e.g., no `g' prefix). */
- #define PROGRAM_NAME "join"
-
-@@ -104,10 +118,12 @@
- /* Last element in `outlist', where a new element can be added. */
- static struct outlist *outlist_end = &outlist_head;
-
--/* Tab character separating fields. If negative, fields are separated
-- by any nonempty string of blanks, otherwise by exactly one
-- tab character whose value (when cast to unsigned char) equals TAB. */
--static int tab = -1;
-+/* Tab character separating fields. If NULL, fields are separated
-+ by any nonempty string of blanks. */
-+static char *tab = NULL;
-+
-+/* The number of bytes used for tab. */
-+static size_t tablen = 0;
-
- static struct option const longopts[] =
- {
-@@ -190,6 +206,8 @@
-
- /* Fill in the `fields' structure in LINE. */
-
-+/* Fill in the `fields' structure in LINE. */
-+
- static void
- xfields (struct line *line)
- {
-@@ -199,10 +217,11 @@
- if (ptr == lim)
- return;
-
-- if (0 <= tab)
-+ if (tab != NULL)
- {
-+ unsigned char t = tab[0];
- char *sep;
-- for (; (sep = memchr (ptr, tab, lim - ptr)) != NULL; ptr = sep + 1)
-+ for (; (sep = memchr (ptr, t, lim - ptr)) != NULL; ptr = sep + 1)
- extract_field (line, ptr, sep - ptr);
- }
- else
-@@ -229,6 +248,148 @@
- extract_field (line, ptr, lim - ptr);
- }
-
-+#if HAVE_MBRTOWC
-+static void
-+xfields_multibyte (struct line *line)
-+{
-+ char *ptr = line->buf.buffer;
-+ char const *lim = ptr + line->buf.length - 1;
-+ wchar_t wc = 0;
-+ size_t mblength = 1;
-+ mbstate_t state, state_bak;
-+
-+ memset (&state, 0, sizeof (mbstate_t));
-+
-+ if (ptr == lim)
-+ return;
-+
-+ if (tab != NULL)
-+ {
-+ unsigned char t = tab[0];
-+ char *sep = ptr;
-+ for (; ptr < lim; ptr = sep + mblength)
-+ {
-+ sep = ptr;
-+ while (sep < lim)
-+ {
-+ state_bak = state;
-+ mblength = mbrtowc (&wc, sep, lim - sep + 1, &state);
-+
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ mblength = 1;
-+ state = state_bak;
-+ }
-+ mblength = (mblength < 1) ? 1 : mblength;
-+
-+ if (mblength == tablen && !memcmp (sep, tab, mblength))
-+ break;
-+ else
-+ {
-+ sep += mblength;
-+ continue;
-+ }
-+ }
-+
-+ if (sep == lim)
-+ break;
-+
-+ extract_field (line, ptr, sep - ptr);
-+ }
-+ }
-+ else
-+ {
-+ /* Skip leading blanks before the first field. */
-+ while(ptr < lim)
-+ {
-+ state_bak = state;
-+ mblength = mbrtowc (&wc, ptr, lim - ptr + 1, &state);
-+
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ mblength = 1;
-+ state = state_bak;
-+ break;
-+ }
-+ mblength = (mblength < 1) ? 1 : mblength;
-+
-+ if (!iswblank(wc))
-+ break;
-+ ptr += mblength;
-+ }
-+
-+ do
-+ {
-+ char *sep;
-+ state_bak = state;
-+ mblength = mbrtowc (&wc, ptr, lim - ptr + 1, &state);
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ mblength = 1;
-+ state = state_bak;
-+ break;
-+ }
-+ mblength = (mblength < 1) ? 1 : mblength;
-+
-+ sep = ptr + mblength;
-+ while (sep != lim)
-+ {
-+ state_bak = state;
-+ mblength = mbrtowc (&wc, sep, lim - sep + 1, &state);
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ mblength = 1;
-+ state = state_bak;
-+ break;
-+ }
-+ mblength = (mblength < 1) ? 1 : mblength;
-+
-+ if (iswblank (wc))
-+ break;
-+
-+ sep += mblength;
-+ }
-+
-+ extract_field (line, ptr, sep - ptr);
-+ if (sep == lim)
-+ return;
-+
-+ state_bak = state;
-+ mblength = mbrtowc (&wc, sep, lim - sep + 1, &state);
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ mblength = 1;
-+ state = state_bak;
-+ break;
-+ }
-+ mblength = (mblength < 1) ? 1 : mblength;
-+
-+ ptr = sep + mblength;
-+ while (ptr != lim)
-+ {
-+ state_bak = state;
-+ mblength = mbrtowc (&wc, ptr, lim - ptr + 1, &state);
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ mblength = 1;
-+ state = state_bak;
-+ break;
-+ }
-+ mblength = (mblength < 1) ? 1 : mblength;
-+
-+ if (!iswblank (wc))
-+ break;
-+
-+ ptr += mblength;
-+ }
-+ }
-+ while (ptr != lim);
-+ }
-+
-+ extract_field (line, ptr, lim - ptr);
-+}
-+#endif
-+
- /* Read a line from FP into LINE and split it into fields.
- Return true if successful. */
-
-@@ -249,6 +410,11 @@
- line->nfields_allocated = 0;
- line->nfields = 0;
- line->fields = NULL;
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ xfields_multibyte (line);
-+ else
-+#endif
- xfields (line);
- return true;
- }
-@@ -303,56 +469,114 @@
- keycmp (struct line const *line1, struct line const *line2)
- {
- /* Start of field to compare in each file. */
-- char *beg1;
-- char *beg2;
--
-- size_t len1;
-- size_t len2; /* Length of fields to compare. */
-+ char *beg[2];
-+ char *copy[2];
-+ size_t len[2]; /* Length of fields to compare. */
- int diff;
-+ int i, j;
-
- if (join_field_1 < line1->nfields)
- {
-- beg1 = line1->fields[join_field_1].beg;
-- len1 = line1->fields[join_field_1].len;
-+ beg[0] = line1->fields[join_field_1].beg;
-+ len[0] = line1->fields[join_field_1].len;
- }
- else
- {
-- beg1 = NULL;
-- len1 = 0;
-+ beg[0] = NULL;
-+ len[0] = 0;
- }
-
- if (join_field_2 < line2->nfields)
- {
-- beg2 = line2->fields[join_field_2].beg;
-- len2 = line2->fields[join_field_2].len;
-+ beg[1] = line2->fields[join_field_2].beg;
-+ len[1] = line2->fields[join_field_2].len;
- }
- else
- {
-- beg2 = NULL;
-- len2 = 0;
-+ beg[1] = NULL;
-+ len[1] = 0;
- }
-
-- if (len1 == 0)
-- return len2 == 0 ? 0 : -1;
-- if (len2 == 0)
-+ if (len[0] == 0)
-+ return len[1] == 0 ? 0 : -1;
-+ if (len[1] == 0)
- return 1;
-
- if (ignore_case)
- {
-- /* FIXME: ignore_case does not work with NLS (in particular,
-- with multibyte chars). */
-- diff = memcasecmp (beg1, beg2, MIN (len1, len2));
-+#ifdef HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ {
-+ size_t mblength;
-+ wchar_t wc, uwc;
-+ mbstate_t state, state_bak;
-+
-+ memset (&state, '\0', sizeof (mbstate_t));
-+
-+ for (i = 0; i < 2; i++)
-+ {
-+ copy[i] = alloca (len[i] + 1);
-+
-+ for (j = 0; j < MIN (len[0], len[1]);)
-+ {
-+ state_bak = state;
-+ mblength = mbrtowc (&wc, beg[i] + j, len[i] - j, &state);
-+
-+ switch (mblength)
-+ {
-+ case (size_t) -1:
-+ case (size_t) -2:
-+ state = state_bak;
-+ /* Fall through */
-+ case 0:
-+ mblength = 1;
-+ break;
-+
-+ default:
-+ uwc = towupper (wc);
-+
-+ if (uwc != wc)
-+ {
-+ mbstate_t state_wc;
-+
-+ memset (&state_wc, '\0', sizeof (mbstate_t));
-+ wcrtomb (copy[i] + j, uwc, &state_wc);
-+ }
-+ else
-+ memcpy (copy[i] + j, beg[i] + j, mblength);
-+ }
-+ j += mblength;
-+ }
-+ copy[i][j] = '\0';
-+ }
-+ }
-+ else
-+#endif
-+ {
-+ for (i = 0; i < 2; i++)
-+ {
-+ copy[i] = alloca (len[i] + 1);
-+
-+ for (j = 0; j < MIN (len[0], len[1]); j++)
-+ copy[i][j] = toupper (beg[i][j]);
-+
-+ copy[i][j] = '\0';
-+ }
-+ }
- }
- else
- {
-- if (hard_LC_COLLATE)
-- return xmemcoll (beg1, len1, beg2, len2);
-- diff = memcmp (beg1, beg2, MIN (len1, len2));
-+ copy[0] = (unsigned char *) beg[0];
-+ copy[1] = (unsigned char *) beg[1];
- }
-
-+ if (hard_LC_COLLATE)
-+ return xmemcoll ((char *) copy[0], len[0], (char *) copy[1], len[1]);
-+ diff = memcmp (copy[0], copy[1], MIN (len[0], len[1]));
-+
- if (diff)
- return diff;
-- return len1 < len2 ? -1 : len1 != len2;
-+ return len[0] - len[1];
- }
-
- /* Print field N of LINE if it exists and is nonempty, otherwise
-@@ -377,11 +601,18 @@
-
- /* Print the join of LINE1 and LINE2. */
-
-+#define PUT_TAB_CHAR \
-+ do \
-+ { \
-+ (tab != NULL) ? \
-+ fwrite(tab, sizeof(char), tablen, stdout) : putchar (' '); \
-+ } \
-+ while (0)
-+
- static void
- prjoin (struct line const *line1, struct line const *line2)
- {
- const struct outlist *outlist;
-- char output_separator = tab < 0 ? ' ' : tab;
-
- outlist = outlist_head.next;
- if (outlist)
-@@ -397,12 +628,12 @@
- if (o->file == 0)
- {
- if (line1 == &uni_blank)
-- {
-+ {
- line = line2;
- field = join_field_2;
- }
- else
-- {
-+ {
- line = line1;
- field = join_field_1;
- }
-@@ -416,7 +647,7 @@
- o = o->next;
- if (o == NULL)
- break;
-- putchar (output_separator);
-+ PUT_TAB_CHAR;
- }
- putchar ('\n');
- }
-@@ -434,23 +665,23 @@
- prfield (join_field_1, line1);
- for (i = 0; i < join_field_1 && i < line1->nfields; ++i)
- {
-- putchar (output_separator);
-+ PUT_TAB_CHAR;
- prfield (i, line1);
- }
- for (i = join_field_1 + 1; i < line1->nfields; ++i)
- {
-- putchar (output_separator);
-+ PUT_TAB_CHAR;
- prfield (i, line1);
- }
-
- for (i = 0; i < join_field_2 && i < line2->nfields; ++i)
- {
-- putchar (output_separator);
-+ PUT_TAB_CHAR;
- prfield (i, line2);
- }
- for (i = join_field_2 + 1; i < line2->nfields; ++i)
- {
-- putchar (output_separator);
-+ PUT_TAB_CHAR;
- prfield (i, line2);
- }
- putchar ('\n');
-@@ -859,20 +1090,41 @@
-
- case 't':
- {
-- unsigned char newtab = optarg[0];
-- if (! newtab)
-+ char *newtab;
-+ size_t newtablen;
-+ if (! optarg[0])
- error (EXIT_FAILURE, 0, _("empty tab"));
-- if (optarg[1])
-+ newtab = xstrdup (optarg);
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ {
-+ mbstate_t state;
-+
-+ memset (&state, 0, sizeof (mbstate_t));
-+ newtablen = mbrtowc (NULL, newtab,
-+ strnlen (newtab, MB_LEN_MAX),
-+ &state);
-+ if (newtablen == (size_t) 0
-+ || newtablen == (size_t) -1
-+ || newtablen == (size_t) -2)
-+ newtablen = 1;
-+ }
-+ else
-+#endif
-+ newtablen = 1;
-+
-+ if (newtablen == 1 && newtab[1])
-+ {
-+ if (STREQ (newtab, "\\0"))
-+ newtab[0] = '\0';
-+ }
-+ if (tab != NULL && strcmp (tab, newtab))
- {
-- if (STREQ (optarg, "\\0"))
-- newtab = '\0';
-- else
-- error (EXIT_FAILURE, 0, _("multi-character tab %s"),
-- quote (optarg));
-+ free (newtab);
-+ error (EXIT_FAILURE, 0, _("incompatible tabs"));
- }
-- if (0 <= tab && tab != newtab)
-- error (EXIT_FAILURE, 0, _("incompatible tabs"));
- tab = newtab;
-+ tablen = newtablen;
- }
- break;
-
---- coreutils-6.8+/src/uniq.c.i18n 2007-01-14 15:41:28.000000000 +0000
-+++ coreutils-6.8+/src/uniq.c 2007-03-01 15:08:24.000000000 +0000
-@@ -23,6 +23,16 @@
- #include <getopt.h>
- #include <sys/types.h>
-
-+/* Get mbstate_t, mbrtowc(). */
-+#if HAVE_WCHAR_H
-+# include <wchar.h>
-+#endif
-+
-+/* Get isw* functions. */
-+#if HAVE_WCTYPE_H
-+# include <wctype.h>
-+#endif
-+
- #include "system.h"
- #include "argmatch.h"
- #include "linebuffer.h"
-@@ -32,7 +42,19 @@
- #include "quote.h"
- #include "xmemcoll.h"
- #include "xstrtol.h"
--#include "memcasecmp.h"
-+#include "xmemcoll.h"
-+
-+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
-+ installation; work around this configuration error. */
-+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
-+# define MB_LEN_MAX 16
-+#endif
-+
-+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
-+#if HAVE_MBRTOWC && defined mbstate_t
-+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
-+#endif
-+
-
- /* The official name of this program (e.g., no `g' prefix). */
- #define PROGRAM_NAME "uniq"
-@@ -109,6 +131,10 @@
- /* Select whether/how to delimit groups of duplicate lines. */
- static enum delimit_method delimit_groups;
-
-+/* Function pointers. */
-+static char *
-+(*find_field) (struct linebuffer *line);
-+
- static struct option const longopts[] =
- {
- {"count", no_argument, NULL, 'c'},
-@@ -198,7 +224,7 @@
- return a pointer to the beginning of the line's field to be compared. */
-
- static char *
--find_field (const struct linebuffer *line)
-+find_field_uni (struct linebuffer *line)
- {
- size_t count;
- char *lp = line->buffer;
-@@ -219,6 +245,83 @@
- return lp + i;
- }
-
-+#if HAVE_MBRTOWC
-+
-+# define MBCHAR_TO_WCHAR(WC, MBLENGTH, LP, POS, SIZE, STATEP, CONVFAIL) \
-+ do \
-+ { \
-+ mbstate_t state_bak; \
-+ \
-+ CONVFAIL = 0; \
-+ state_bak = *STATEP; \
-+ \
-+ MBLENGTH = mbrtowc (&WC, LP + POS, SIZE - POS, STATEP); \
-+ \
-+ switch (MBLENGTH) \
-+ { \
-+ case (size_t)-2: \
-+ case (size_t)-1: \
-+ *STATEP = state_bak; \
-+ CONVFAIL++; \
-+ /* Fall through */ \
-+ case 0: \
-+ MBLENGTH = 1; \
-+ } \
-+ } \
-+ while (0)
-+
-+static char *
-+find_field_multi (struct linebuffer *line)
-+{
-+ size_t count;
-+ char *lp = line->buffer;
-+ size_t size = line->length - 1;
-+ size_t pos;
-+ size_t mblength;
-+ wchar_t wc;
-+ mbstate_t *statep;
-+ int convfail;
-+
-+ pos = 0;
-+ statep = &(line->state);
-+
-+ /* skip fields. */
-+ for (count = 0; count < skip_fields && pos < size; count++)
-+ {
-+ while (pos < size)
-+ {
-+ MBCHAR_TO_WCHAR (wc, mblength, lp, pos, size, statep, convfail);
-+
-+ if (convfail || !iswblank (wc))
-+ {
-+ pos += mblength;
-+ break;
-+ }
-+ pos += mblength;
-+ }
-+
-+ while (pos < size)
-+ {
-+ MBCHAR_TO_WCHAR (wc, mblength, lp, pos, size, statep, convfail);
-+
-+ if (!convfail && iswblank (wc))
-+ break;
-+
-+ pos += mblength;
-+ }
-+ }
-+
-+ /* skip fields. */
-+ for (count = 0; count < skip_chars && pos < size; count++)
-+ {
-+ MBCHAR_TO_WCHAR (wc, mblength, lp, pos, size, statep, convfail);
-+ pos += mblength;
-+ }
-+
-+ return lp + pos;
-+}
-+#endif
-+
- /* Return false if two strings OLD and NEW match, true if not.
- OLD and NEW point not to the beginnings of the lines
- but rather to the beginnings of the fields to compare.
-@@ -227,6 +330,8 @@
- static bool
- different (char *old, char *new, size_t oldlen, size_t newlen)
- {
-+ char *copy_old, *copy_new;
-+
- if (check_chars < oldlen)
- oldlen = check_chars;
- if (check_chars < newlen)
-@@ -234,14 +339,92 @@
-
- if (ignore_case)
- {
-- /* FIXME: This should invoke strcoll somehow. */
-- return oldlen != newlen || memcasecmp (old, new, oldlen);
-+ size_t i;
-+
-+ copy_old = alloca (oldlen + 1);
-+ copy_new = alloca (oldlen + 1);
-+
-+ for (i = 0; i < oldlen; i++)
-+ {
-+ copy_old[i] = toupper (old[i]);
-+ copy_new[i] = toupper (new[i]);
-+ }
- }
-- else if (hard_LC_COLLATE)
-- return xmemcoll (old, oldlen, new, newlen) != 0;
- else
-- return oldlen != newlen || memcmp (old, new, oldlen);
-+ {
-+ copy_old = (char *)old;
-+ copy_new = (char *)new;
-+ }
-+
-+ return xmemcoll (copy_old, oldlen, copy_new, newlen);
-+}
-+
-+#if HAVE_MBRTOWC
-+static int
-+different_multi (const char *old, const char *new, size_t oldlen, size_t newlen, mbstate_t oldstate, mbstate_t newstate)
-+{
-+ size_t i, j, chars;
-+ const char *str[2];
-+ char *copy[2];
-+ size_t len[2];
-+ mbstate_t state[2];
-+ size_t mblength;
-+ wchar_t wc, uwc;
-+ mbstate_t state_bak;
-+
-+ str[0] = old;
-+ str[1] = new;
-+ len[0] = oldlen;
-+ len[1] = newlen;
-+ state[0] = oldstate;
-+ state[1] = newstate;
-+
-+ for (i = 0; i < 2; i++)
-+ {
-+ copy[i] = alloca (len[i] + 1);
-+
-+ for (j = 0, chars = 0; j < len[i] && chars < check_chars; chars++)
-+ {
-+ state_bak = state[i];
-+ mblength = mbrtowc (&wc, str[i] + j, len[i] - j, &(state[i]));
-+
-+ switch (mblength)
-+ {
-+ case (size_t)-1:
-+ case (size_t)-2:
-+ state[i] = state_bak;
-+ /* Fall through */
-+ case 0:
-+ mblength = 1;
-+ break;
-+
-+ default:
-+ if (ignore_case)
-+ {
-+ uwc = towupper (wc);
-+
-+ if (uwc != wc)
-+ {
-+ mbstate_t state_wc;
-+
-+ memset (&state_wc, '\0', sizeof(mbstate_t));
-+ wcrtomb (copy[i] + j, uwc, &state_wc);
-+ }
-+ else
-+ memcpy (copy[i] + j, str[i] + j, mblength);
-+ }
-+ else
-+ memcpy (copy[i] + j, str[i] + j, mblength);
-+ }
-+ j += mblength;
-+ }
-+ copy[i][j] = '\0';
-+ len[i] = j;
-+ }
-+
-+ return xmemcoll (copy[0], len[0], copy[1], len[1]);
- }
-+#endif
-
- /* Output the line in linebuffer LINE to standard output
- provided that the switches say it should be output.
-@@ -295,15 +478,43 @@
- {
- char *prevfield IF_LINT (= NULL);
- size_t prevlen IF_LINT (= 0);
-+#if HAVE_MBRTOWC
-+ mbstate_t prevstate;
-+
-+ memset (&prevstate, '\0', sizeof (mbstate_t));
-+#endif
-
- while (!feof (stdin))
- {
- char *thisfield;
- size_t thislen;
-+#if HAVE_MBRTOWC
-+ mbstate_t thisstate;
-+#endif
-+
- if (readlinebuffer (thisline, stdin) == 0)
- break;
- thisfield = find_field (thisline);
- thislen = thisline->length - 1 - (thisfield - thisline->buffer);
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ {
-+ thisstate = thisline->state;
-+
-+ if (prevline->length == 0 || different_multi
-+ (thisfield, prevfield, thislen, prevlen, thisstate, prevstate))
-+ {
-+ fwrite (thisline->buffer, sizeof (char),
-+ thisline->length, stdout);
-+
-+ SWAP_LINES (prevline, thisline);
-+ prevfield = thisfield;
-+ prevlen = thislen;
-+ prevstate = thisstate;
-+ }
-+ }
-+ else
-+#endif
- if (prevline->length == 0
- || different (thisfield, prevfield, thislen, prevlen))
- {
-@@ -322,17 +533,26 @@
- size_t prevlen;
- uintmax_t match_count = 0;
- bool first_delimiter = true;
-+#if HAVE_MBRTOWC
-+ mbstate_t prevstate;
-+#endif
-
- if (readlinebuffer (prevline, stdin) == 0)
- goto closefiles;
- prevfield = find_field (prevline);
- prevlen = prevline->length - 1 - (prevfield - prevline->buffer);
-+#if HAVE_MBRTOWC
-+ prevstate = prevline->state;
-+#endif
-
- while (!feof (stdin))
- {
- bool match;
- char *thisfield;
- size_t thislen;
-+#if HAVE_MBRTOWC
-+ mbstate_t thisstate;
-+#endif
- if (readlinebuffer (thisline, stdin) == 0)
- {
- if (ferror (stdin))
-@@ -341,6 +561,15 @@
- }
- thisfield = find_field (thisline);
- thislen = thisline->length - 1 - (thisfield - thisline->buffer);
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ {
-+ thisstate = thisline->state;
-+ match = !different_multi (thisfield, prevfield,
-+ thislen, prevlen, thisstate, prevstate);
-+ }
-+ else
-+#endif
- match = !different (thisfield, prevfield, thislen, prevlen);
- match_count += match;
-
-@@ -373,6 +602,9 @@
- SWAP_LINES (prevline, thisline);
- prevfield = thisfield;
- prevlen = thislen;
-+#if HAVE_MBRTOWC
-+ prevstate = thisstate;
-+#endif
- if (!match)
- match_count = 0;
- }
-@@ -417,6 +649,19 @@
-
- atexit (close_stdout);
-
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ {
-+ find_field = find_field_multi;
-+ }
-+ else
-+#endif
-+ {
-+ find_field = find_field_uni;
-+ }
-+
-+
-+
- skip_chars = 0;
- skip_fields = 0;
- check_chars = SIZE_MAX;
---- coreutils-6.8+/src/fold.c.i18n 2007-02-23 12:01:47.000000000 +0000
-+++ coreutils-6.8+/src/fold.c 2007-03-01 15:08:24.000000000 +0000
-@@ -23,11 +23,33 @@
- #include <getopt.h>
- #include <sys/types.h>
-
-+/* Get mbstate_t, mbrtowc(), wcwidth(). */
-+#if HAVE_WCHAR_H
-+# include <wchar.h>
-+#endif
-+
-+/* Get iswprint(), iswblank(), wcwidth(). */
-+#if HAVE_WCTYPE_H
-+# include <wctype.h>
-+#endif
-+
- #include "system.h"
- #include "error.h"
- #include "quote.h"
- #include "xstrtol.h"
-
-+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
-+ installation; work around this configuration error. */
-+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
-+# undef MB_LEN_MAX
-+# define MB_LEN_MAX 16
-+#endif
-+
-+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
-+#if HAVE_MBRTOWC && defined mbstate_t
-+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
-+#endif
-+
- #define TAB_WIDTH 8
-
- /* The official name of this program (e.g., no `g' prefix). */
-@@ -35,23 +57,44 @@
-
- #define AUTHORS "David MacKenzie"
-
-+#define FATAL_ERROR(Message) \
-+ do \
-+ { \
-+ error (0, 0, (Message)); \
-+ usage (2); \
-+ } \
-+ while (0)
-+
-+enum operating_mode
-+{
-+ /* Fold texts by columns that are at the given positions. */
-+ column_mode,
-+
-+ /* Fold texts by bytes that are at the given positions. */
-+ byte_mode,
-+
-+ /* Fold texts by characters that are at the given positions. */
-+ character_mode,
-+};
-+
- /* The name this program was run with. */
- char *program_name;
-
-+/* The argument shows current mode. (Default: column_mode) */
-+static enum operating_mode operating_mode;
-+
- /* If nonzero, try to break on whitespace. */
- static bool break_spaces;
-
--/* If nonzero, count bytes, not column positions. */
--static bool count_bytes;
--
- /* If nonzero, at least one of the files we read was standard input. */
- static bool have_read_stdin;
-
--static char const shortopts[] = "bsw:0::1::2::3::4::5::6::7::8::9::";
-+static char const shortopts[] = "bcsw:0::1::2::3::4::5::6::7::8::9::";
-
- static struct option const longopts[] =
- {
- {"bytes", no_argument, NULL, 'b'},
-+ {"characters", no_argument, NULL, 'c'},
- {"spaces", no_argument, NULL, 's'},
- {"width", required_argument, NULL, 'w'},
- {GETOPT_HELP_OPTION_DECL},
-@@ -81,6 +124,7 @@
- "), stdout);
- fputs (_("\
- -b, --bytes count bytes rather than columns\n\
-+ -c, --characters count characters rather than columns\n\
- -s, --spaces break at spaces\n\
- -w, --width=WIDTH use WIDTH columns instead of 80\n\
- "), stdout);
-@@ -98,7 +142,7 @@
- static size_t
- adjust_column (size_t column, char c)
- {
-- if (!count_bytes)
-+ if (operating_mode != byte_mode)
- {
- if (c == '\b')
- {
-@@ -121,30 +165,14 @@
- to stdout, with maximum line length WIDTH.
- Return true if successful. */
-
--static bool
--fold_file (char const *filename, size_t width)
-+static void
-+fold_text (FILE *istream, size_t width, int *saved_errno)
- {
-- FILE *istream;
- int c;
- size_t column = 0; /* Screen column where next char will go. */
- size_t offset_out = 0; /* Index in `line_out' for next char. */
- static char *line_out = NULL;
- static size_t allocated_out = 0;
-- int saved_errno;
--
-- if (STREQ (filename, "-"))
-- {
-- istream = stdin;
-- have_read_stdin = true;
-- }
-- else
-- istream = fopen (filename, "r");
--
-- if (istream == NULL)
-- {
-- error (0, errno, "%s", filename);
-- return false;
-- }
-
- while ((c = getc (istream)) != EOF)
- {
-@@ -172,6 +200,15 @@
- bool found_blank = false;
- size_t logical_end = offset_out;
-
-+ /* If LINE_OUT has no wide character,
-+ put a new wide character in LINE_OUT
-+ if column is bigger than width. */
-+ if (offset_out == 0)
-+ {
-+ line_out[offset_out++] = c;
-+ continue;
-+ }
-+
- /* Look for the last blank. */
- while (logical_end)
- {
-@@ -218,11 +255,225 @@
- line_out[offset_out++] = c;
- }
-
-- saved_errno = errno;
-+ *saved_errno = errno;
-+
-+ if (offset_out)
-+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
-+
-+ free(line_out);
-+}
-+
-+#if HAVE_MBRTOWC
-+static void
-+fold_multibyte_text (FILE *istream, size_t width, int *saved_errno)
-+{
-+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
-+ size_t buflen = 0; /* The length of the byte sequence in buf. */
-+ char *bufpos; /* Next read position of BUF. */
-+ wint_t wc; /* A gotten wide character. */
-+ size_t mblength; /* The byte size of a multibyte character which shows
-+ as same character as WC. */
-+ mbstate_t state, state_bak; /* State of the stream. */
-+ int convfail; /* 1, when conversion is failed. Otherwise 0. */
-+
-+ char *line_out = NULL;
-+ size_t offset_out = 0; /* Index in `line_out' for next char. */
-+ size_t allocated_out = 0;
-+
-+ int increment;
-+ size_t column = 0;
-+
-+ size_t last_blank_pos;
-+ size_t last_blank_column;
-+ int is_blank_seen;
-+ int last_blank_increment;
-+ int is_bs_following_last_blank;
-+ size_t bs_following_last_blank_num;
-+ int is_cr_after_last_blank;
-+
-+#define CLEAR_FLAGS \
-+ do \
-+ { \
-+ last_blank_pos = 0; \
-+ last_blank_column = 0; \
-+ is_blank_seen = 0; \
-+ is_bs_following_last_blank = 0; \
-+ bs_following_last_blank_num = 0; \
-+ is_cr_after_last_blank = 0; \
-+ } \
-+ while (0)
-+
-+#define START_NEW_LINE \
-+ do \
-+ { \
-+ putchar ('\n'); \
-+ column = 0; \
-+ offset_out = 0; \
-+ CLEAR_FLAGS; \
-+ } \
-+ while (0)
-+
-+ CLEAR_FLAGS;
-+ memset (&state, '\0', sizeof(mbstate_t));
-+
-+ for (;; bufpos += mblength, buflen -= mblength)
-+ {
-+ if (buflen < MB_LEN_MAX && !feof (istream) && !ferror (istream))
-+ {
-+ memmove (buf, bufpos, buflen);
-+ buflen += fread (buf + buflen, sizeof(char), BUFSIZ, istream);
-+ bufpos = buf;
-+ }
-+
-+ if (buflen < 1)
-+ break;
-+
-+ /* Get a wide character. */
-+ convfail = 0;
-+ state_bak = state;
-+ mblength = mbrtowc ((wchar_t *)&wc, bufpos, buflen, &state);
-+
-+ switch (mblength)
-+ {
-+ case (size_t)-1:
-+ case (size_t)-2:
-+ convfail++;
-+ state = state_bak;
-+ /* Fall through. */
-+
-+ case 0:
-+ mblength = 1;
-+ break;
-+ }
-+
-+rescan:
-+ if (operating_mode == byte_mode) /* byte mode */
-+ increment = mblength;
-+ else if (operating_mode == character_mode) /* character mode */
-+ increment = 1;
-+ else /* column mode */
-+ {
-+ if (convfail)
-+ increment = 1;
-+ else
-+ {
-+ switch (wc)
-+ {
-+ case L'\n':
-+ fwrite (line_out, sizeof(char), offset_out, stdout);
-+ START_NEW_LINE;
-+ continue;
-+
-+ case L'\b':
-+ increment = (column > 0) ? -1 : 0;
-+ break;
-+
-+ case L'\r':
-+ increment = -1 * column;
-+ break;
-+
-+ case L'\t':
-+ increment = 8 - column % 8;
-+ break;
-+
-+ default:
-+ increment = wcwidth (wc);
-+ increment = (increment < 0) ? 0 : increment;
-+ }
-+ }
-+ }
-+
-+ if (column + increment > width && break_spaces && last_blank_pos)
-+ {
-+ fwrite (line_out, sizeof(char), last_blank_pos, stdout);
-+ putchar ('\n');
-+
-+ offset_out = offset_out - last_blank_pos;
-+ column = column - last_blank_column + ((is_cr_after_last_blank)
-+ ? last_blank_increment : bs_following_last_blank_num);
-+ memmove (line_out, line_out + last_blank_pos, offset_out);
-+ CLEAR_FLAGS;
-+ goto rescan;
-+ }
-+
-+ if (column + increment > width && column != 0)
-+ {
-+ fwrite (line_out, sizeof(char), offset_out, stdout);
-+ START_NEW_LINE;
-+ goto rescan;
-+ }
-+
-+ if (allocated_out < offset_out + mblength)
-+ {
-+ allocated_out += 1024;
-+ line_out = xrealloc (line_out, allocated_out);
-+ }
-+
-+ memcpy (line_out + offset_out, bufpos, mblength);
-+ offset_out += mblength;
-+ column += increment;
-+
-+ if (is_blank_seen && !convfail && wc == L'\r')
-+ is_cr_after_last_blank = 1;
-+
-+ if (is_bs_following_last_blank && !convfail && wc == L'\b')
-+ ++bs_following_last_blank_num;
-+ else
-+ is_bs_following_last_blank = 0;
-+
-+ if (break_spaces && !convfail && iswblank (wc))
-+ {
-+ last_blank_pos = offset_out;
-+ last_blank_column = column;
-+ is_blank_seen = 1;
-+ last_blank_increment = increment;
-+ is_bs_following_last_blank = 1;
-+ bs_following_last_blank_num = 0;
-+ is_cr_after_last_blank = 0;
-+ }
-+ }
-+
-+ *saved_errno = errno;
-
- if (offset_out)
- fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
-
-+ free(line_out);
-+}
-+#endif
-+
-+/* Fold file FILENAME, or standard input if FILENAME is "-",
-+ to stdout, with maximum line length WIDTH.
-+ Return 0 if successful, 1 if an error occurs. */
-+
-+static bool
-+fold_file (char *filename, size_t width)
-+{
-+ FILE *istream;
-+ int saved_errno;
-+
-+ if (STREQ (filename, "-"))
-+ {
-+ istream = stdin;
-+ have_read_stdin = 1;
-+ }
-+ else
-+ istream = fopen (filename, "r");
-+
-+ if (istream == NULL)
-+ {
-+ error (0, errno, "%s", filename);
-+ return 1;
-+ }
-+
-+ /* Define how ISTREAM is being folded. */
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ fold_multibyte_text (istream, width, &saved_errno);
-+ else
-+#endif
-+ fold_text (istream, width, &saved_errno);
-+
- if (ferror (istream))
- {
- error (0, saved_errno, "%s", filename);
-@@ -255,7 +506,8 @@
-
- atexit (close_stdout);
-
-- break_spaces = count_bytes = have_read_stdin = false;
-+ operating_mode = column_mode;
-+ break_spaces = have_read_stdin = false;
-
- while ((optc = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1)
- {
-@@ -264,7 +516,15 @@
- switch (optc)
- {
- case 'b': /* Count bytes rather than columns. */
-- count_bytes = true;
-+ if (operating_mode != column_mode)
-+ FATAL_ERROR (_("only one way of folding may be specified"));
-+ operating_mode = byte_mode;
-+ break;
-+
-+ case 'c':
-+ if (operating_mode != column_mode)
-+ FATAL_ERROR (_("only one way of folding may be specified"));
-+ operating_mode = character_mode;
- break;
-
- case 's': /* Break at word boundaries. */
---- coreutils-6.8+/src/sort.c.i18n 2007-02-24 11:23:23.000000000 +0000
-+++ coreutils-6.8+/src/sort.c 2007-03-01 15:10:57.000000000 +0000
-@@ -23,10 +23,19 @@
-
- #include <config.h>
-
-+#include <assert.h>
- #include <getopt.h>
- #include <sys/types.h>
- #include <sys/wait.h>
- #include <signal.h>
-+#if HAVE_WCHAR_H
-+# include <wchar.h>
-+#endif
-+/* Get isw* functions. */
-+#if HAVE_WCTYPE_H
-+# include <wctype.h>
-+#endif
-+
- #include "system.h"
- #include "argmatch.h"
- #include "error.h"
-@@ -116,14 +125,38 @@
- /* Thousands separator; if -1, then there isn't one. */
- static int thousands_sep;
-
-+static int force_general_numcompare = 0;
-+
- /* Nonzero if the corresponding locales are hard. */
- static bool hard_LC_COLLATE;
--#if HAVE_NL_LANGINFO
-+#if HAVE_LANGINFO_CODESET
- static bool hard_LC_TIME;
- #endif
-
- #define NONZERO(x) ((x) != 0)
-
-+/* get a multibyte character's byte length. */
-+#define GET_BYTELEN_OF_CHAR(LIM, PTR, MBLENGTH, STATE) \
-+ do \
-+ { \
-+ wchar_t wc; \
-+ mbstate_t state_bak; \
-+ \
-+ state_bak = STATE; \
-+ mblength = mbrtowc (&wc, PTR, LIM - PTR, &STATE); \
-+ \
-+ switch (MBLENGTH) \
-+ { \
-+ case (size_t)-1: \
-+ case (size_t)-2: \
-+ STATE = state_bak; \
-+ /* Fall through. */ \
-+ case 0: \
-+ MBLENGTH = 1; \
-+ } \
-+ } \
-+ while (0)
-+
- /* The kind of blanks for '-b' to skip in various options. */
- enum blanktype { bl_start, bl_end, bl_both };
-
-@@ -261,13 +294,11 @@
- they were read if all keys compare equal. */
- static bool stable;
-
--/* If TAB has this value, blanks separate fields. */
--enum { TAB_DEFAULT = CHAR_MAX + 1 };
--
--/* Tab character separating fields. If TAB_DEFAULT, then fields are
-+/* Tab character separating fields. If tab_length is 0, then fields are
- separated by the empty string between a non-blank character and a blank
- character. */
--static int tab = TAB_DEFAULT;
-+static char tab[MB_LEN_MAX + 1];
-+static size_t tab_length = 0;
-
- /* Flag to remove consecutive duplicate lines from the output.
- Only the last of a sequence of equal lines will be output. */
-@@ -639,6 +670,44 @@
- update_proc (pid);
- }
-
-+/* Function pointers. */
-+static void
-+(*inittables) (void);
-+static char *
-+(*begfield) (const struct line*, const struct keyfield *);
-+static char *
-+(*limfield) (const struct line*, const struct keyfield *);
-+static int
-+(*getmonth) (char const *, size_t);
-+static int
-+(*keycompare) (const struct line *, const struct line *);
-+static int
-+(*numcompare) (const char *, const char *);
-+
-+/* Test for white space multibyte character.
-+ Set LENGTH the byte length of investigated multibyte character. */
-+#if HAVE_MBRTOWC
-+static int
-+ismbblank (const char *str, size_t len, size_t *length)
-+{
-+ size_t mblength;
-+ wchar_t wc;
-+ mbstate_t state;
-+
-+ memset (&state, '\0', sizeof(mbstate_t));
-+ mblength = mbrtowc (&wc, str, len, &state);
-+
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ *length = 1;
-+ return 0;
-+ }
-+
-+ *length = (mblength < 1) ? 1 : mblength;
-+ return iswblank (wc);
-+}
-+#endif
-+
- /* Clean up any remaining temporary files. */
-
- static void
-@@ -978,7 +1047,7 @@
- free (node);
- }
-
--#if HAVE_NL_LANGINFO
-+#if HAVE_LANGINFO_CODESET
-
- static int
- struct_month_cmp (const void *m1, const void *m2)
-@@ -993,7 +1062,7 @@
- /* Initialize the character class tables. */
-
- static void
--inittables (void)
-+inittables_uni (void)
- {
- size_t i;
-
-@@ -1005,7 +1074,7 @@
- fold_toupper[i] = toupper (i);
- }
-
--#if HAVE_NL_LANGINFO
-+#if HAVE_LANGINFO_CODESET
- /* If we're not in the "C" locale, read different names for months. */
- if (hard_LC_TIME)
- {
-@@ -1031,6 +1100,64 @@
- #endif
- }
-
-+#if HAVE_MBRTOWC
-+static void
-+inittables_mb (void)
-+{
-+ int i, j, k, l;
-+ char *name, *s;
-+ size_t s_len, mblength;
-+ char mbc[MB_LEN_MAX];
-+ wchar_t wc, pwc;
-+ mbstate_t state_mb, state_wc;
-+
-+ for (i = 0; i < MONTHS_PER_YEAR; i++)
-+ {
-+ s = (char *) nl_langinfo (ABMON_1 + i);
-+ s_len = strlen (s);
-+ monthtab[i].name = name = (char *) xmalloc (s_len + 1);
-+ monthtab[i].val = i + 1;
-+
-+ memset (&state_mb, '\0', sizeof (mbstate_t));
-+ memset (&state_wc, '\0', sizeof (mbstate_t));
-+
-+ for (j = 0; j < s_len;)
-+ {
-+ if (!ismbblank (s + j, s_len - j, &mblength))
-+ break;
-+ j += mblength;
-+ }
-+
-+ for (k = 0; j < s_len;)
-+ {
-+ mblength = mbrtowc (&wc, (s + j), (s_len - j), &state_mb);
-+ assert (mblength != (size_t)-1 && mblength != (size_t)-2);
-+ if (mblength == 0)
-+ break;
-+
-+ pwc = towupper (wc);
-+ if (pwc == wc)
-+ {
-+ memcpy (mbc, s + j, mblength);
-+ j += mblength;
-+ }
-+ else
-+ {
-+ j += mblength;
-+ mblength = wcrtomb (mbc, pwc, &state_wc);
-+ assert (mblength != (size_t)0 && mblength != (size_t)-1);
-+ }
-+
-+ for (l = 0; l < mblength; l++)
-+ name[k++] = mbc[l];
-+ }
-+ name[k] = '\0';
-+ }
-+ qsort ((void *) monthtab, MONTHS_PER_YEAR,
-+ sizeof (struct month), struct_month_cmp);
-+}
-+#endif
-+
- /* Specify the amount of main memory to use when sorting. */
- static void
- specify_sort_size (char const *s)
-@@ -1241,7 +1368,7 @@
- by KEY in LINE. */
-
- static char *
--begfield (const struct line *line, const struct keyfield *key)
-+begfield_uni (const struct line *line, const struct keyfield *key)
- {
- char *ptr = line->text, *lim = ptr + line->length - 1;
- size_t sword = key->sword;
-@@ -1251,10 +1378,10 @@
- /* The leading field separator itself is included in a field when -t
- is absent. */
-
-- if (tab != TAB_DEFAULT)
-+ if (tab_length)
- while (ptr < lim && sword--)
- {
-- while (ptr < lim && *ptr != tab)
-+ while (ptr < lim && *ptr != tab[0])
- ++ptr;
- if (ptr < lim)
- ++ptr;
-@@ -1282,11 +1409,70 @@
- return ptr;
- }
-
-+#if HAVE_MBRTOWC
-+static char *
-+begfield_mb (const struct line *line, const struct keyfield *key)
-+{
-+ int i;
-+ char *ptr = line->text, *lim = ptr + line->length - 1;
-+ size_t sword = key->sword;
-+ size_t schar = key->schar;
-+ size_t mblength;
-+ mbstate_t state;
-+
-+ memset (&state, '\0', sizeof(mbstate_t));
-+
-+ if (tab_length)
-+ while (ptr < lim && sword--)
-+ {
-+ while (ptr < lim && memcmp (ptr, tab, tab_length) != 0)
-+ {
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+ ptr += mblength;
-+ }
-+ if (ptr < lim)
-+ {
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+ ptr += mblength;
-+ }
-+ }
-+ else
-+ while (ptr < lim && sword--)
-+ {
-+ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength))
-+ ptr += mblength;
-+ if (ptr < lim)
-+ {
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+ ptr += mblength;
-+ }
-+ while (ptr < lim && !ismbblank (ptr, lim - ptr, &mblength))
-+ ptr += mblength;
-+ }
-+
-+ if (key->skipsblanks)
-+ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength))
-+ ptr += mblength;
-+
-+ for (i = 0; i < schar; i++)
-+ {
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+
-+ if (ptr + mblength > lim)
-+ break;
-+ else
-+ ptr += mblength;
-+ }
-+
-+ return ptr;
-+}
-+#endif
-+
- /* Return the limit of (a pointer to the first character after) the field
- in LINE specified by KEY. */
-
- static char *
--limfield (const struct line *line, const struct keyfield *key)
-+limfield_uni (const struct line *line, const struct keyfield *key)
- {
- char *ptr = line->text, *lim = ptr + line->length - 1;
- size_t eword = key->eword, echar = key->echar;
-@@ -1299,10 +1485,10 @@
- `beginning' is the first character following the delimiting TAB.
- Otherwise, leave PTR pointing at the first `blank' character after
- the preceding field. */
-- if (tab != TAB_DEFAULT)
-+ if (tab_length)
- while (ptr < lim && eword--)
- {
-- while (ptr < lim && *ptr != tab)
-+ while (ptr < lim && *ptr != tab[0])
- ++ptr;
- if (ptr < lim && (eword | echar))
- ++ptr;
-@@ -1348,10 +1534,10 @@
- */
-
- /* Make LIM point to the end of (one byte past) the current field. */
-- if (tab != TAB_DEFAULT)
-+ if (tab_length)
- {
- char *newlim;
-- newlim = memchr (ptr, tab, lim - ptr);
-+ newlim = memchr (ptr, tab[0], lim - ptr);
- if (newlim)
- lim = newlim;
- }
-@@ -1384,6 +1570,107 @@
- return ptr;
- }
-
-+#if HAVE_MBRTOWC
-+static char *
-+limfield_mb (const struct line *line, const struct keyfield *key)
-+{
-+ char *ptr = line->text, *lim = ptr + line->length - 1;
-+ size_t eword = key->eword, echar = key->echar;
-+ int i;
-+ size_t mblength;
-+ mbstate_t state;
-+
-+ memset (&state, '\0', sizeof(mbstate_t));
-+
-+ if (tab_length)
-+ while (ptr < lim && eword--)
-+ {
-+ while (ptr < lim && memcmp (ptr, tab, tab_length) != 0)
-+ {
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+ ptr += mblength;
-+ }
-+ if (ptr < lim && (eword | echar))
-+ {
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+ ptr += mblength;
-+ }
-+ }
-+ else
-+ while (ptr < lim && eword--)
-+ {
-+ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength))
-+ ptr += mblength;
-+ if (ptr < lim)
-+ {
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+ ptr += mblength;
-+ }
-+ while (ptr < lim && !ismbblank (ptr, lim - ptr, &mblength))
-+ ptr += mblength;
-+ }
-+
-+
-+# ifdef POSIX_UNSPECIFIED
-+ /* Make LIM point to the end of (one byte past) the current field. */
-+ if (tab_length)
-+ {
-+ char *newlim, *p;
-+
-+ newlim = NULL;
-+ for (p = ptr; p < lim;)
-+ {
-+ if (memcmp (p, tab, tab_length) == 0)
-+ {
-+ newlim = p;
-+ break;
-+ }
-+
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+ p += mblength;
-+ }
-+ }
-+ else
-+ {
-+ char *newlim;
-+ newlim = ptr;
-+
-+ while (newlim < lim && ismbblank (newlim, lim - newlim, &mblength))
-+ newlim += mblength;
-+ if (ptr < lim)
-+ {
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+ ptr += mblength;
-+ }
-+ while (newlim < lim && !ismbblank (newlim, lim - newlim, &mblength))
-+ newlim += mblength;
-+ lim = newlim;
-+ }
-+# endif
-+
-+ /* If we're skipping leading blanks, don't start counting characters
-+ * until after skipping past any leading blanks. */
-+ if (key->skipsblanks)
-+ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength))
-+ ptr += mblength;
-+
-+ memset (&state, '\0', sizeof(mbstate_t));
-+
-+ /* Advance PTR by ECHAR (if possible), but no further than LIM. */
-+ for (i = 0; i < echar; i++)
-+ {
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+
-+ if (ptr + mblength > lim)
-+ break;
-+ else
-+ ptr += mblength;
-+ }
-+
-+ return ptr;
-+}
-+#endif
-+
- /* Fill BUF reading from FP, moving buf->left bytes from the end
- of buf->buf to the beginning first. If EOF is reached and the
- file wasn't terminated by a newline, supply one. Set up BUF's line
-@@ -1466,8 +1753,24 @@
- else
- {
- if (key->skipsblanks)
-- while (blanks[to_uchar (*line_start)])
-- line_start++;
-+ {
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ {
-+ size_t mblength;
-+ mbstate_t state;
-+ memset (&state, '\0', sizeof(mbstate_t));
-+ while (line_start < line->keylim &&
-+ ismbblank (line_start,
-+ line->keylim - line_start,
-+ &mblength))
-+ line_start += mblength;
-+ }
-+ else
-+#endif
-+ while (blanks[to_uchar (*line_start)])
-+ line_start++;
-+ }
- line->keybeg = line_start;
- }
- }
-@@ -1500,7 +1803,7 @@
- hideously fast. */
-
- static int
--numcompare (const char *a, const char *b)
-+numcompare_uni (const char *a, const char *b)
- {
- while (blanks[to_uchar (*a)])
- a++;
-@@ -1510,6 +1813,25 @@
- return strnumcmp (a, b, decimal_point, thousands_sep);
- }
-
-+#if HAVE_MBRTOWC
-+static int
-+numcompare_mb (const char *a, const char *b)
-+{
-+ size_t mblength, len;
-+ len = strlen (a); /* okay for UTF-8 */
-+ while (*a && ismbblank (a, len > MB_CUR_MAX ? MB_CUR_MAX : len, &mblength))
-+ {
-+ a += mblength;
-+ len -= mblength;
-+ }
-+ len = strlen (b); /* okay for UTF-8 */
-+ while (*b && ismbblank (b, len > MB_CUR_MAX ? MB_CUR_MAX : len, &mblength))
-+ b += mblength;
-+
-+ return strnumcmp (a, b, decimal_point, thousands_sep);
-+}
-+#endif /* HAV_EMBRTOWC */
-+
- static int
- general_numcompare (const char *sa, const char *sb)
- {
-@@ -1543,7 +1865,7 @@
- Return 0 if the name in S is not recognized. */
-
- static int
--getmonth (char const *month, size_t len)
-+getmonth_uni (char const *month, size_t len)
- {
- size_t lo = 0;
- size_t hi = MONTHS_PER_YEAR;
-@@ -1698,11 +2020,79 @@
- return diff;
- }
-
-+#if HAVE_MBRTOWC
-+static int
-+getmonth_mb (const char *s, size_t len)
-+{
-+ char *month;
-+ register size_t i;
-+ register int lo = 0, hi = MONTHS_PER_YEAR, result;
-+ char *tmp;
-+ size_t wclength, mblength;
-+ const char **pp;
-+ const wchar_t **wpp;
-+ wchar_t *month_wcs;
-+ mbstate_t state;
-+
-+ while (len > 0 && ismbblank (s, len, &mblength))
-+ {
-+ s += mblength;
-+ len -= mblength;
-+ }
-+
-+ if (len == 0)
-+ return 0;
-+
-+ month = (char *) alloca (len + 1);
-+
-+ tmp = (char *) alloca (len + 1);
-+ memcpy (tmp, s, len);
-+ tmp[len] = '\0';
-+ pp = (const char **)&tmp;
-+ month_wcs = (wchar_t *) alloca ((len + 1) * sizeof (wchar_t));
-+ memset (&state, '\0', sizeof(mbstate_t));
-+
-+ wclength = mbsrtowcs (month_wcs, pp, len + 1, &state);
-+ assert (wclength != (size_t)-1 && *pp == NULL);
-+
-+ for (i = 0; i < wclength; i++)
-+ {
-+ month_wcs[i] = towupper(month_wcs[i]);
-+ if (iswblank (month_wcs[i]))
-+ {
-+ month_wcs[i] = L'\0';
-+ break;
-+ }
-+ }
-+
-+ wpp = (const wchar_t **)&month_wcs;
-+
-+ mblength = wcsrtombs (month, wpp, len + 1, &state);
-+ assert (mblength != (-1) && *wpp == NULL);
-+
-+ do
-+ {
-+ int ix = (lo + hi) / 2;
-+
-+ if (strncmp (month, monthtab[ix].name, strlen (monthtab[ix].name)) < 0)
-+ hi = ix;
-+ else
-+ lo = ix;
-+ }
-+ while (hi - lo > 1);
-+
-+ result = (!strncmp (month, monthtab[lo].name, strlen (monthtab[lo].name))
-+ ? monthtab[lo].val : 0);
-+
-+ return result;
-+}
-+#endif
-+
- /* Compare two lines A and B trying every key in sequence until there
- are no more keys or a difference is found. */
-
- static int
--keycompare (const struct line *a, const struct line *b)
-+keycompare_uni (const struct line *a, const struct line *b)
- {
- struct keyfield const *key = keylist;
-
-@@ -1875,6 +2265,179 @@
- return key->reverse ? -diff : diff;
- }
-
-+#if HAVE_MBRTOWC
-+static int
-+keycompare_mb (const struct line *a, const struct line *b)
-+{
-+ struct keyfield *key = keylist;
-+
-+ /* For the first iteration only, the key positions have been
-+ precomputed for us. */
-+ char *texta = a->keybeg;
-+ char *textb = b->keybeg;
-+ char *lima = a->keylim;
-+ char *limb = b->keylim;
-+
-+ size_t mblength_a, mblength_b;
-+ wchar_t wc_a, wc_b;
-+ mbstate_t state_a, state_b;
-+
-+ int diff;
-+
-+ memset (&state_a, '\0', sizeof(mbstate_t));
-+ memset (&state_b, '\0', sizeof(mbstate_t));
-+
-+ for (;;)
-+ {
-+ unsigned char *translate = (unsigned char *) key->translate;
-+ bool const *ignore = key->ignore;
-+
-+ /* Find the lengths. */
-+ size_t lena = lima <= texta ? 0 : lima - texta;
-+ size_t lenb = limb <= textb ? 0 : limb - textb;
-+
-+ /* Actually compare the fields. */
-+ if (key->random)
-+ diff = compare_random (texta, lena, textb, lenb);
-+ else if (key->numeric | key->general_numeric)
-+ {
-+ char savea = *lima, saveb = *limb;
-+
-+ *lima = *limb = '\0';
-+ if (force_general_numcompare)
-+ diff = general_numcompare (texta, textb);
-+ else
-+ diff = ((key->numeric ? numcompare : general_numcompare)
-+ (texta, textb));
-+ *lima = savea, *limb = saveb;
-+ }
-+ else if (key->month)
-+ diff = getmonth (texta, lena) - getmonth (textb, lenb);
-+ else
-+ {
-+ if (ignore || translate)
-+ {
-+ char *copy_a = (char *) alloca (lena + 1 + lenb + 1);
-+ char *copy_b = copy_a + lena + 1;
-+ size_t new_len_a, new_len_b;
-+ size_t i, j;
-+
-+ /* Ignore and/or translate chars before comparing. */
-+# define IGNORE_CHARS(NEW_LEN, LEN, TEXT, COPY, WC, MBLENGTH, STATE) \
-+ do \
-+ { \
-+ wchar_t uwc; \
-+ char mbc[MB_LEN_MAX]; \
-+ mbstate_t state_wc; \
-+ \
-+ for (NEW_LEN = i = 0; i < LEN;) \
-+ { \
-+ mbstate_t state_bak; \
-+ \
-+ state_bak = STATE; \
-+ MBLENGTH = mbrtowc (&WC, TEXT + i, LEN - i, &STATE); \
-+ \
-+ if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1 \
-+ || MBLENGTH == 0) \
-+ { \
-+ if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1) \
-+ STATE = state_bak; \
-+ if (!ignore) \
-+ COPY[NEW_LEN++] = TEXT[i++]; \
-+ continue; \
-+ } \
-+ \
-+ if (ignore) \
-+ { \
-+ if ((ignore == nonprinting && !iswprint (WC)) \
-+ || (ignore == nondictionary \
-+ && !iswalnum (WC) && !iswblank (WC))) \
-+ { \
-+ i += MBLENGTH; \
-+ continue; \
-+ } \
-+ } \
-+ \
-+ if (translate) \
-+ { \
-+ \
-+ uwc = towupper(WC); \
-+ if (WC == uwc) \
-+ { \
-+ memcpy (mbc, TEXT + i, MBLENGTH); \
-+ i += MBLENGTH; \
-+ } \
-+ else \
-+ { \
-+ i += MBLENGTH; \
-+ WC = uwc; \
-+ memset (&state_wc, '\0', sizeof (mbstate_t)); \
-+ \
-+ MBLENGTH = wcrtomb (mbc, WC, &state_wc); \
-+ assert (MBLENGTH != (size_t)-1 && MBLENGTH != 0); \
-+ } \
-+ \
-+ for (j = 0; j < MBLENGTH; j++) \
-+ COPY[NEW_LEN++] = mbc[j]; \
-+ } \
-+ else \
-+ for (j = 0; j < MBLENGTH; j++) \
-+ COPY[NEW_LEN++] = TEXT[i++]; \
-+ } \
-+ COPY[NEW_LEN] = '\0'; \
-+ } \
-+ while (0)
-+ IGNORE_CHARS (new_len_a, lena, texta, copy_a,
-+ wc_a, mblength_a, state_a);
-+ IGNORE_CHARS (new_len_b, lenb, textb, copy_b,
-+ wc_b, mblength_b, state_b);
-+ diff = xmemcoll (copy_a, new_len_a, copy_b, new_len_b);
-+ }
-+ else if (lena == 0)
-+ diff = - NONZERO (lenb);
-+ else if (lenb == 0)
-+ goto greater;
-+ else
-+ diff = xmemcoll (texta, lena, textb, lenb);
-+ }
-+
-+ if (diff)
-+ goto not_equal;
-+
-+ key = key->next;
-+ if (! key)
-+ break;
-+
-+ /* Find the beginning and limit of the next field. */
-+ if (key->eword != -1)
-+ lima = limfield (a, key), limb = limfield (b, key);
-+ else
-+ lima = a->text + a->length - 1, limb = b->text + b->length - 1;
-+
-+ if (key->sword != -1)
-+ texta = begfield (a, key), textb = begfield (b, key);
-+ else
-+ {
-+ texta = a->text, textb = b->text;
-+ if (key->skipsblanks)
-+ {
-+ while (texta < lima && ismbblank (texta, lima - texta, &mblength_a))
-+ texta += mblength_a;
-+ while (textb < limb && ismbblank (textb, limb - textb, &mblength_b))
-+ textb += mblength_b;
-+ }
-+ }
-+ }
-+
-+ return 0;
-+
-+greater:
-+ diff = 1;
-+not_equal:
-+ return key->reverse ? -diff : diff;
-+}
-+#endif
-+
- /* Compare two lines A and B, returning negative, zero, or positive
- depending on whether A compares less than, equal to, or greater than B. */
-
-@@ -2744,7 +3305,7 @@
- initialize_exit_failure (SORT_FAILURE);
-
- hard_LC_COLLATE = hard_locale (LC_COLLATE);
--#if HAVE_NL_LANGINFO
-+#if HAVE_LANGINFO_CODESET
- hard_LC_TIME = hard_locale (LC_TIME);
- #endif
-
-@@ -2765,6 +3326,27 @@
- thousands_sep = -1;
- }
-
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ {
-+ inittables = inittables_mb;
-+ begfield = begfield_mb;
-+ limfield = limfield_mb;
-+ getmonth = getmonth_mb;
-+ keycompare = keycompare_mb;
-+ numcompare = numcompare_mb;
-+ }
-+ else
-+#endif
-+ {
-+ inittables = inittables_uni;
-+ begfield = begfield_uni;
-+ limfield = limfield_uni;
-+ getmonth = getmonth_uni;
-+ keycompare = keycompare_uni;
-+ numcompare = numcompare_uni;
-+ }
-+
- have_read_stdin = false;
- inittables ();
-
-@@ -3015,13 +3597,35 @@
-
- case 't':
- {
-- char newtab = optarg[0];
-- if (! newtab)
-+ char newtab[MB_LEN_MAX + 1];
-+ size_t newtab_length = 1;
-+ strncpy (newtab, optarg, MB_LEN_MAX);
-+ if (! newtab[0])
- error (SORT_FAILURE, 0, _("empty tab"));
-- if (optarg[1])
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ {
-+ wchar_t wc;
-+ mbstate_t state;
-+ size_t i;
-+
-+ memset (&state, '\0', sizeof (mbstate_t));
-+ newtab_length = mbrtowc (&wc, newtab, strnlen (newtab,
-+ MB_LEN_MAX),
-+ &state);
-+ switch (newtab_length)
-+ {
-+ case (size_t) -1:
-+ case (size_t) -2:
-+ case 0:
-+ newtab_length = 1;
-+ }
-+ }
-+#endif
-+ if (newtab_length == 1 && optarg[1])
- {
- if (STREQ (optarg, "\\0"))
-- newtab = '\0';
-+ newtab[0] = '\0';
- else
- {
- /* Provoke with `sort -txx'. Complain about
-@@ -3032,9 +3636,12 @@
- quote (optarg));
- }
- }
-- if (tab != TAB_DEFAULT && tab != newtab)
-+ if (tab_length
-+ && (tab_length != newtab_length
-+ || memcmp (tab, newtab, tab_length) != 0))
- error (SORT_FAILURE, 0, _("incompatible tabs"));
-- tab = newtab;
-+ memcpy (tab, newtab, newtab_length);
-+ tab_length = newtab_length;
- }
- break;
-
---- coreutils-6.8+/src/unexpand.c.i18n 2007-01-14 15:41:28.000000000 +0000
-+++ coreutils-6.8+/src/unexpand.c 2007-03-01 15:08:24.000000000 +0000
-@@ -39,11 +39,28 @@
- #include <stdio.h>
- #include <getopt.h>
- #include <sys/types.h>
-+
-+/* Get mbstate_t, mbrtowc(), wcwidth(). */
-+#if HAVE_WCHAR_H
-+# include <wchar.h>
-+#endif
-+
- #include "system.h"
- #include "error.h"
- #include "quote.h"
- #include "xstrndup.h"
-
-+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
-+ installation; work around this configuration error. */
-+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
-+# define MB_LEN_MAX 16
-+#endif
-+
-+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
-+#if HAVE_MBRTOWC && defined mbstate_t
-+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
-+#endif
-+
- /* The official name of this program (e.g., no `g' prefix). */
- #define PROGRAM_NAME "unexpand"
-
-@@ -110,6 +127,208 @@
- {NULL, 0, NULL, 0}
- };
-
-+static FILE *next_file (FILE *fp);
-+
-+#if HAVE_MBRTOWC
-+static void
-+unexpand_multibyte (void)
-+{
-+ FILE *fp; /* Input stream. */
-+ mbstate_t i_state; /* Current shift state of the input stream. */
-+ mbstate_t i_state_bak; /* Back up the I_STATE. */
-+ mbstate_t o_state; /* Current shift state of the output stream. */
-+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
-+ char *bufpos; /* Next read position of BUF. */
-+ size_t buflen = 0; /* The length of the byte sequence in buf. */
-+ wint_t wc; /* A gotten wide character. */
-+ size_t mblength; /* The byte size of a multibyte character
-+ which shows as same character as WC. */
-+
-+ /* Index in `tab_list' of next tabstop: */
-+ int tab_index = 0; /* For calculating width of pending tabs. */
-+ int print_tab_index = 0; /* For printing as many tabs as possible. */
-+ unsigned int column = 0; /* Column on screen of next char. */
-+ int next_tab_column; /* Column the next tab stop is on. */
-+ int convert = 1; /* If nonzero, perform translations. */
-+ unsigned int pending = 0; /* Pending columns of blanks. */
-+
-+ fp = next_file ((FILE *) NULL);
-+ if (fp == NULL)
-+ return;
-+
-+ memset (&o_state, '\0', sizeof(mbstate_t));
-+ memset (&i_state, '\0', sizeof(mbstate_t));
-+
-+ for (;;)
-+ {
-+ if (buflen < MB_LEN_MAX && !feof(fp) && !ferror(fp))
-+ {
-+ memmove (buf, bufpos, buflen);
-+ buflen += fread (buf + buflen, sizeof(char), BUFSIZ, fp);
-+ bufpos = buf;
-+ }
-+
-+ /* Get a wide character. */
-+ if (buflen < 1)
-+ {
-+ mblength = 1;
-+ wc = WEOF;
-+ }
-+ else
-+ {
-+ i_state_bak = i_state;
-+ mblength = mbrtowc ((wchar_t *)&wc, bufpos, buflen, &i_state);
-+ }
-+
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ i_state = i_state_bak;
-+ wc = L'\0';
-+ }
-+
-+ if (wc == L' ' && convert && column < INT_MAX)
-+ {
-+ ++pending;
-+ ++column;
-+ }
-+ else if (wc == L'\t' && convert)
-+ {
-+ if (tab_size == 0)
-+ {
-+ /* Do not let tab_index == first_free_tab;
-+ stop when it is 1 less. */
-+ while (tab_index < first_free_tab - 1
-+ && column >= tab_list[tab_index])
-+ tab_index++;
-+ next_tab_column = tab_list[tab_index];
-+ if (tab_index < first_free_tab - 1)
-+ tab_index++;
-+ if (column >= next_tab_column)
-+ {
-+ convert = 0; /* Ran out of tab stops. */
-+ goto flush_pend_mb;
-+ }
-+ }
-+ else
-+ {
-+ next_tab_column = column + tab_size - column % tab_size;
-+ }
-+ pending += next_tab_column - column;
-+ column = next_tab_column;
-+ }
-+ else
-+ {
-+flush_pend_mb:
-+ /* Flush pending spaces. Print as many tabs as possible,
-+ then print the rest as spaces. */
-+ if (pending == 1)
-+ {
-+ putchar (' ');
-+ pending = 0;
-+ }
-+ column -= pending;
-+ while (pending > 0)
-+ {
-+ if (tab_size == 0)
-+ {
-+ /* Do not let print_tab_index == first_free_tab;
-+ stop when it is 1 less. */
-+ while (print_tab_index < first_free_tab - 1
-+ && column >= tab_list[print_tab_index])
-+ print_tab_index++;
-+ next_tab_column = tab_list[print_tab_index];
-+ if (print_tab_index < first_free_tab - 1)
-+ print_tab_index++;
-+ }
-+ else
-+ {
-+ next_tab_column =
-+ column + tab_size - column % tab_size;
-+ }
-+ if (next_tab_column - column <= pending)
-+ {
-+ putchar ('\t');
-+ pending -= next_tab_column - column;
-+ column = next_tab_column;
-+ }
-+ else
-+ {
-+ --print_tab_index;
-+ column += pending;
-+ while (pending != 0)
-+ {
-+ putchar (' ');
-+ pending--;
-+ }
-+ }
-+ }
-+
-+ if (wc == WEOF)
-+ {
-+ fp = next_file (fp);
-+ if (fp == NULL)
-+ break; /* No more files. */
-+ else
-+ {
-+ memset (&i_state, '\0', sizeof(mbstate_t));
-+ continue;
-+ }
-+ }
-+
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ if (convert)
-+ {
-+ ++column;
-+ if (convert_entire_line == 0)
-+ convert = 0;
-+ }
-+ mblength = 1;
-+ putchar (buf[0]);
-+ }
-+ else if (mblength == 0)
-+ {
-+ if (convert && convert_entire_line == 0)
-+ convert = 0;
-+ mblength = 1;
-+ putchar ('\0');
-+ }
-+ else
-+ {
-+ if (convert)
-+ {
-+ if (wc == L'\b')
-+ {
-+ if (column > 0)
-+ --column;
-+ }
-+ else
-+ {
-+ int width; /* The width of WC. */
-+
-+ width = wcwidth (wc);
-+ column += (width > 0) ? width : 0;
-+ if (convert_entire_line == 0)
-+ convert = 0;
-+ }
-+ }
-+
-+ if (wc == L'\n')
-+ {
-+ tab_index = print_tab_index = 0;
-+ column = pending = 0;
-+ convert = 1;
-+ }
-+ fwrite (bufpos, sizeof(char), mblength, stdout);
-+ }
-+ }
-+ buflen -= mblength;
-+ bufpos += mblength;
-+ }
-+}
-+#endif
-+
-+
- void
- usage (int status)
- {
-@@ -531,7 +750,12 @@
-
- file_list = (optind < argc ? &argv[optind] : stdin_argv);
-
-- unexpand ();
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ unexpand_multibyte ();
-+ else
-+#endif
-+ unexpand ();
-
- if (have_read_stdin && fclose (stdin) != 0)
- error (EXIT_FAILURE, errno, "-");
---- coreutils-6.8+/src/pr.c.i18n 2007-01-14 15:41:28.000000000 +0000
-+++ coreutils-6.8+/src/pr.c 2007-03-01 15:08:24.000000000 +0000
-@@ -313,6 +313,32 @@
-
- #include <getopt.h>
- #include <sys/types.h>
-+
-+/* Get MB_LEN_MAX. */
-+#include <limits.h>
-+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
-+ installation; work around this configuration error. */
-+#if !defined MB_LEN_MAX || MB_LEN_MAX == 1
-+# define MB_LEN_MAX 16
-+#endif
-+
-+/* Get MB_CUR_MAX. */
-+#include <stdlib.h>
-+
-+/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
-+/* Get mbstate_t, mbrtowc(), wcwidth(). */
-+#if HAVE_WCHAR_H
-+# include <wchar.h>
-+#endif
-+
-+/* Get iswprint(). -- for wcwidth(). */
-+#if HAVE_WCTYPE_H
-+# include <wctype.h>
-+#endif
-+#if !defined iswprint && !HAVE_ISWPRINT
-+# define iswprint(wc) 1
-+#endif
-+
- #include "system.h"
- #include "error.h"
- #include "hard-locale.h"
-@@ -324,6 +350,18 @@
- #include "strftime.h"
- #include "xstrtol.h"
-
-+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
-+#if HAVE_MBRTOWC && defined mbstate_t
-+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
-+#endif
-+
-+#ifndef HAVE_DECL_WCWIDTH
-+"this configure-time declaration test was not run"
-+#endif
-+#if !HAVE_DECL_WCWIDTH
-+extern int wcwidth ();
-+#endif
-+
- /* The official name of this program (e.g., no `g' prefix). */
- #define PROGRAM_NAME "pr"
-
-@@ -416,7 +454,20 @@
-
- #define NULLCOL (COLUMN *)0
-
--static int char_to_clump (char c);
-+/* Funtion pointers to switch functions for single byte locale or for
-+ multibyte locale. If multibyte functions do not exist in your sysytem,
-+ these pointers always point the function for single byte locale. */
-+static void (*print_char) (char c);
-+static int (*char_to_clump) (char c);
-+
-+/* Functions for single byte locale. */
-+static void print_char_single (char c);
-+static int char_to_clump_single (char c);
-+
-+/* Functions for multibyte locale. */
-+static void print_char_multi (char c);
-+static int char_to_clump_multi (char c);
-+
- static bool read_line (COLUMN *p);
- static bool print_page (void);
- static bool print_stored (COLUMN *p);
-@@ -426,6 +477,7 @@
- static void pad_across_to (int position);
- static void add_line_number (COLUMN *p);
- static void getoptarg (char *arg, char switch_char, char *character,
-+ int *character_length, int *character_width,
- int *number);
- void usage (int status);
- static void print_files (int number_of_files, char **av);
-@@ -440,7 +492,6 @@
- static void pad_down (int lines);
- static void read_rest_of_line (COLUMN *p);
- static void skip_read (COLUMN *p, int column_number);
--static void print_char (char c);
- static void cleanup (void);
- static void print_sep_string (void);
- static void separator_string (const char *optarg_S);
-@@ -455,7 +506,7 @@
- we store the leftmost columns contiguously in buff.
- To print a line from buff, get the index of the first character
- from line_vector[i], and print up to line_vector[i + 1]. */
--static char *buff;
-+static unsigned char *buff;
-
- /* Index of the position in buff where the next character
- will be stored. */
-@@ -559,7 +610,7 @@
- static bool untabify_input = false;
-
- /* (-e) The input tab character. */
--static char input_tab_char = '\t';
-+static char input_tab_char[MB_LEN_MAX] = "\t";
-
- /* (-e) Tabstops are at chars_per_tab, 2*chars_per_tab, 3*chars_per_tab, ...
- where the leftmost column is 1. */
-@@ -569,7 +620,10 @@
- static bool tabify_output = false;
-
- /* (-i) The output tab character. */
--static char output_tab_char = '\t';
-+static char output_tab_char[MB_LEN_MAX] = "\t";
-+
-+/* (-i) The byte length of output tab character. */
-+static int output_tab_char_length = 1;
-
- /* (-i) The width of the output tab. */
- static int chars_per_output_tab = 8;
-@@ -643,7 +697,13 @@
- static bool numbered_lines = false;
-
- /* (-n) Character which follows each line number. */
--static char number_separator = '\t';
-+static char number_separator[MB_LEN_MAX] = "\t";
-+
-+/* (-n) The byte length of the character which follows each line number. */
-+static int number_separator_length = 1;
-+
-+/* (-n) The character width of the character which follows each line number. */
-+static int number_separator_width = 0;
-
- /* (-n) line counting starts with 1st line of input file (not with 1st
- line of 1st page printed). */
-@@ -696,6 +756,7 @@
- -a|COLUMN|-m is a `space' and with the -J option a `tab'. */
- static char *col_sep_string = "";
- static int col_sep_length = 0;
-+static int col_sep_width = 0;
- static char *column_separator = " ";
- static char *line_separator = "\t";
-
-@@ -852,6 +913,13 @@
- col_sep_length = (int) strlen (optarg_S);
- col_sep_string = xmalloc (col_sep_length + 1);
- strcpy (col_sep_string, optarg_S);
-+
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ col_sep_width = mbswidth (col_sep_string, 0);
-+ else
-+#endif
-+ col_sep_width = col_sep_length;
- }
-
- int
-@@ -877,6 +945,21 @@
-
- atexit (close_stdout);
-
-+/* Define which functions are used, the ones for single byte locale or the ones
-+ for multibyte locale. */
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ {
-+ print_char = print_char_multi;
-+ char_to_clump = char_to_clump_multi;
-+ }
-+ else
-+#endif
-+ {
-+ print_char = print_char_single;
-+ char_to_clump = char_to_clump_single;
-+ }
-+
- n_files = 0;
- file_names = (argc > 1
- ? xmalloc ((argc - 1) * sizeof (char *))
-@@ -949,8 +1032,12 @@
- break;
- case 'e':
- if (optarg)
-- getoptarg (optarg, 'e', &input_tab_char,
-- &chars_per_input_tab);
-+ {
-+ int dummy_length, dummy_width;
-+
-+ getoptarg (optarg, 'e', input_tab_char, &dummy_length,
-+ &dummy_width, &chars_per_input_tab);
-+ }
- /* Could check tab width > 0. */
- untabify_input = true;
- break;
-@@ -963,8 +1050,12 @@
- break;
- case 'i':
- if (optarg)
-- getoptarg (optarg, 'i', &output_tab_char,
-- &chars_per_output_tab);
-+ {
-+ int dummy_width;
-+
-+ getoptarg (optarg, 'i', output_tab_char, &output_tab_char_length,
-+ &dummy_width, &chars_per_output_tab);
-+ }
- /* Could check tab width > 0. */
- tabify_output = true;
- break;
-@@ -991,8 +1082,8 @@
- case 'n':
- numbered_lines = true;
- if (optarg)
-- getoptarg (optarg, 'n', &number_separator,
-- &chars_per_number);
-+ getoptarg (optarg, 'n', number_separator, &number_separator_length,
-+ &number_separator_width, &chars_per_number);
- break;
- case 'N':
- skip_count = false;
-@@ -1031,7 +1122,7 @@
- old_s = false;
- /* Reset an additional input of -s, -S dominates -s */
- col_sep_string = "";
-- col_sep_length = 0;
-+ col_sep_length = col_sep_width = 0;
- use_col_separator = true;
- if (optarg)
- separator_string (optarg);
-@@ -1188,10 +1279,45 @@
- a number. */
-
- static void
--getoptarg (char *arg, char switch_char, char *character, int *number)
-+getoptarg (char *arg, char switch_char, char *character, int *character_length,
-+ int *character_width, int *number)
- {
- if (!ISDIGIT (*arg))
-- *character = *arg++;
-+ {
-+#ifdef HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1) /* for multibyte locale. */
-+ {
-+ wchar_t wc;
-+ size_t mblength;
-+ int width;
-+ mbstate_t state = {'\0'};
-+
-+ mblength = mbrtowc (&wc, arg, strnlen(arg, MB_LEN_MAX), &state);
-+
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ *character_length = 1;
-+ *character_width = 1;
-+ }
-+ else
-+ {
-+ *character_length = (mblength < 1) ? 1 : mblength;
-+ width = wcwidth (wc);
-+ *character_width = (width < 0) ? 0 : width;
-+ }
-+
-+ strncpy (character, arg, *character_length);
-+ arg += *character_length;
-+ }
-+ else /* for single byte locale. */
-+#endif
-+ {
-+ *character = *arg++;
-+ *character_length = 1;
-+ *character_width = 1;
-+ }
-+ }
-+
- if (*arg)
- {
- long int tmp_long;
-@@ -1256,7 +1382,7 @@
- else
- col_sep_string = column_separator;
-
-- col_sep_length = 1;
-+ col_sep_length = col_sep_width = 1;
- use_col_separator = true;
- }
- /* It's rather pointless to define a TAB separator with column
-@@ -1288,11 +1414,11 @@
- TAB_WIDTH (chars_per_input_tab, chars_per_number); */
-
- /* Estimate chars_per_text without any margin and keep it constant. */
-- if (number_separator == '\t')
-+ if (number_separator[0] == '\t')
- number_width = chars_per_number +
- TAB_WIDTH (chars_per_default_tab, chars_per_number);
- else
-- number_width = chars_per_number + 1;
-+ number_width = chars_per_number + number_separator_width;
-
- /* The number is part of the column width unless we are
- printing files in parallel. */
-@@ -1307,7 +1433,7 @@
- }
-
- chars_per_column = (chars_per_line - chars_used_by_number -
-- (columns - 1) * col_sep_length) / columns;
-+ (columns - 1) * col_sep_width) / columns;
-
- if (chars_per_column < 1)
- error (EXIT_FAILURE, 0, _("page width too narrow"));
-@@ -1432,7 +1558,7 @@
-
- /* Enlarge p->start_position of first column to use the same form of
- padding_not_printed with all columns. */
-- h = h + col_sep_length;
-+ h = h + col_sep_width;
-
- /* This loop takes care of all but the rightmost column. */
-
-@@ -1466,7 +1592,7 @@
- }
- else
- {
-- h = h_next + col_sep_length;
-+ h = h_next + col_sep_width;
- h_next = h + chars_per_column;
- }
- }
-@@ -1756,9 +1882,9 @@
- align_column (COLUMN *p)
- {
- padding_not_printed = p->start_position;
-- if (padding_not_printed - col_sep_length > 0)
-+ if (padding_not_printed - col_sep_width > 0)
- {
-- pad_across_to (padding_not_printed - col_sep_length);
-+ pad_across_to (padding_not_printed - col_sep_width);
- padding_not_printed = ANYWHERE;
- }
-
-@@ -2029,13 +2155,13 @@
- /* May be too generous. */
- buff = X2REALLOC (buff, &buff_allocated);
- }
-- buff[buff_current++] = c;
-+ buff[buff_current++] = (unsigned char) c;
- }
-
- static void
- add_line_number (COLUMN *p)
- {
-- int i;
-+ int i, j;
- char *s;
- int left_cut;
-
-@@ -2058,22 +2184,24 @@
- /* Tabification is assumed for multiple columns, also for n-separators,
- but `default n-separator = TAB' hasn't been given priority over
- equal column_width also specified by POSIX. */
-- if (number_separator == '\t')
-+ if (number_separator[0] == '\t')
- {
- i = number_width - chars_per_number;
- while (i-- > 0)
- (p->char_func) (' ');
- }
- else
-- (p->char_func) (number_separator);
-+ for (j = 0; j < number_separator_length; j++)
-+ (p->char_func) (number_separator[j]);
- }
- else
- /* To comply with POSIX, we avoid any expansion of default TAB
- separator with a single column output. No column_width requirement
- has to be considered. */
- {
-- (p->char_func) (number_separator);
-- if (number_separator == '\t')
-+ for (j = 0; j < number_separator_length; j++)
-+ (p->char_func) (number_separator[j]);
-+ if (number_separator[0] == '\t')
- output_position = POS_AFTER_TAB (chars_per_output_tab,
- output_position);
- }
-@@ -2234,7 +2362,7 @@
- while (goal - h_old > 1
- && (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal)
- {
-- putchar (output_tab_char);
-+ fwrite (output_tab_char, sizeof(char), output_tab_char_length, stdout);
- h_old = h_new;
- }
- while (++h_old <= goal)
-@@ -2254,6 +2382,7 @@
- {
- char *s;
- int l = col_sep_length;
-+ int not_space_flag;
-
- s = col_sep_string;
-
-@@ -2267,6 +2396,7 @@
- {
- for (; separators_not_printed > 0; --separators_not_printed)
- {
-+ not_space_flag = 0;
- while (l-- > 0)
- {
- /* 3 types of sep_strings: spaces only, spaces and chars,
-@@ -2280,12 +2410,15 @@
- }
- else
- {
-+ not_space_flag = 1;
- if (spaces_not_printed > 0)
- print_white_space ();
- putchar (*s++);
-- ++output_position;
- }
- }
-+ if (not_space_flag)
-+ output_position += col_sep_width;
-+
- /* sep_string ends with some spaces */
- if (spaces_not_printed > 0)
- print_white_space ();
-@@ -2313,7 +2446,7 @@
- required number of tabs and spaces. */
-
- static void
--print_char (char c)
-+print_char_single (char c)
- {
- if (tabify_output)
- {
-@@ -2337,6 +2470,74 @@
- putchar (c);
- }
-
-+#ifdef HAVE_MBRTOWC
-+static void
-+print_char_multi (char c)
-+{
-+ static size_t mbc_pos = 0;
-+ static char mbc[MB_LEN_MAX] = {'\0'};
-+ static mbstate_t state = {'\0'};
-+ mbstate_t state_bak;
-+ wchar_t wc;
-+ size_t mblength;
-+ int width;
-+
-+ if (tabify_output)
-+ {
-+ state_bak = state;
-+ mbc[mbc_pos++] = c;
-+ mblength = mbrtowc (&wc, mbc, mbc_pos, &state);
-+
-+ while (mbc_pos > 0)
-+ {
-+ switch (mblength)
-+ {
-+ case (size_t)-2:
-+ state = state_bak;
-+ return;
-+
-+ case (size_t)-1:
-+ state = state_bak;
-+ ++output_position;
-+ putchar (mbc[0]);
-+ memmove (mbc, mbc + 1, MB_CUR_MAX - 1);
-+ --mbc_pos;
-+ break;
-+
-+ case 0:
-+ mblength = 1;
-+
-+ default:
-+ if (wc == L' ')
-+ {
-+ memmove (mbc, mbc + mblength, MB_CUR_MAX - mblength);
-+ --mbc_pos;
-+ ++spaces_not_printed;
-+ return;
-+ }
-+ else if (spaces_not_printed > 0)
-+ print_white_space ();
-+
-+ /* Nonprintables are assumed to have width 0, except L'\b'. */
-+ if ((width = wcwidth (wc)) < 1)
-+ {
-+ if (wc == L'\b')
-+ --output_position;
-+ }
-+ else
-+ output_position += width;
-+
-+ fwrite (mbc, sizeof(char), mblength, stdout);
-+ memmove (mbc, mbc + mblength, MB_CUR_MAX - mblength);
-+ mbc_pos -= mblength;
-+ }
-+ }
-+ return;
-+ }
-+ putchar (c);
-+}
-+#endif
-+
- /* Skip to page PAGE before printing.
- PAGE may be larger than total number of pages. */
-
-@@ -2517,9 +2718,9 @@
- align_empty_cols = false;
- }
-
-- if (padding_not_printed - col_sep_length > 0)
-+ if (padding_not_printed - col_sep_width > 0)
- {
-- pad_across_to (padding_not_printed - col_sep_length);
-+ pad_across_to (padding_not_printed - col_sep_width);
- padding_not_printed = ANYWHERE;
- }
-
-@@ -2620,9 +2821,9 @@
- }
- }
-
-- if (padding_not_printed - col_sep_length > 0)
-+ if (padding_not_printed - col_sep_width > 0)
- {
-- pad_across_to (padding_not_printed - col_sep_length);
-+ pad_across_to (padding_not_printed - col_sep_width);
- padding_not_printed = ANYWHERE;
- }
-
-@@ -2635,8 +2836,8 @@
- if (spaces_not_printed == 0)
- {
- output_position = p->start_position + end_vector[line];
-- if (p->start_position - col_sep_length == chars_per_margin)
-- output_position -= col_sep_length;
-+ if (p->start_position - col_sep_width == chars_per_margin)
-+ output_position -= col_sep_width;
- }
-
- return true;
-@@ -2655,7 +2856,7 @@
- number of characters is 1.) */
-
- static int
--char_to_clump (char c)
-+char_to_clump_single (char c)
- {
- unsigned char uc = c;
- char *s = clump_buff;
-@@ -2665,10 +2866,10 @@
- int chars;
- int chars_per_c = 8;
-
-- if (c == input_tab_char)
-+ if (c == input_tab_char[0])
- chars_per_c = chars_per_input_tab;
-
-- if (c == input_tab_char || c == '\t')
-+ if (c == input_tab_char[0] || c == '\t')
- {
- width = TAB_WIDTH (chars_per_c, input_position);
-
-@@ -2739,6 +2940,154 @@
- return chars;
- }
-
-+#ifdef HAVE_MBRTOWC
-+static int
-+char_to_clump_multi (char c)
-+{
-+ static size_t mbc_pos = 0;
-+ static char mbc[MB_LEN_MAX] = {'\0'};
-+ static mbstate_t state = {'\0'};
-+ mbstate_t state_bak;
-+ wchar_t wc;
-+ size_t mblength;
-+ int wc_width;
-+ register char *s = clump_buff;
-+ register int i, j;
-+ char esc_buff[4];
-+ int width;
-+ int chars;
-+ int chars_per_c = 8;
-+
-+ state_bak = state;
-+ mbc[mbc_pos++] = c;
-+ mblength = mbrtowc (&wc, mbc, mbc_pos, &state);
-+
-+ width = 0;
-+ chars = 0;
-+ while (mbc_pos > 0)
-+ {
-+ switch (mblength)
-+ {
-+ case (size_t)-2:
-+ state = state_bak;
-+ return 0;
-+
-+ case (size_t)-1:
-+ state = state_bak;
-+ mblength = 1;
-+
-+ if (use_esc_sequence || use_cntrl_prefix)
-+ {
-+ width = +4;
-+ chars = +4;
-+ *s++ = '\\';
-+ sprintf (esc_buff, "%03o", mbc[0]);
-+ for (i = 0; i <= 2; ++i)
-+ *s++ = (int) esc_buff[i];
-+ }
-+ else
-+ {
-+ width += 1;
-+ chars += 1;
-+ *s++ = mbc[0];
-+ }
-+ break;
-+
-+ case 0:
-+ mblength = 1;
-+ /* Fall through */
-+
-+ default:
-+ if (memcmp (mbc, input_tab_char, mblength) == 0)
-+ chars_per_c = chars_per_input_tab;
-+
-+ if (memcmp (mbc, input_tab_char, mblength) == 0 || c == '\t')
-+ {
-+ int width_inc;
-+
-+ width_inc = TAB_WIDTH (chars_per_c, input_position);
-+ width += width_inc;
-+
-+ if (untabify_input)
-+ {
-+ for (i = width_inc; i; --i)
-+ *s++ = ' ';
-+ chars += width_inc;
-+ }
-+ else
-+ {
-+ for (i = 0; i < mblength; i++)
-+ *s++ = mbc[i];
-+ chars += mblength;
-+ }
-+ }
-+ else if ((wc_width = wcwidth (wc)) < 1)
-+ {
-+ if (use_esc_sequence)
-+ {
-+ for (i = 0; i < mblength; i++)
-+ {
-+ width += 4;
-+ chars += 4;
-+ *s++ = '\\';
-+ sprintf (esc_buff, "%03o", c);
-+ for (j = 0; j <= 2; ++j)
-+ *s++ = (int) esc_buff[j];
-+ }
-+ }
-+ else if (use_cntrl_prefix)
-+ {
-+ if (wc < 0200)
-+ {
-+ width += 2;
-+ chars += 2;
-+ *s++ = '^';
-+ *s++ = wc ^ 0100;
-+ }
-+ else
-+ {
-+ for (i = 0; i < mblength; i++)
-+ {
-+ width += 4;
-+ chars += 4;
-+ *s++ = '\\';
-+ sprintf (esc_buff, "%03o", c);
-+ for (j = 0; j <= 2; ++j)
-+ *s++ = (int) esc_buff[j];
-+ }
-+ }
-+ }
-+ else if (wc == L'\b')
-+ {
-+ width += -1;
-+ chars += 1;
-+ *s++ = c;
-+ }
-+ else
-+ {
-+ width += 0;
-+ chars += mblength;
-+ for (i = 0; i < mblength; i++)
-+ *s++ = mbc[i];
-+ }
-+ }
-+ else
-+ {
-+ width += wc_width;
-+ chars += mblength;
-+ for (i = 0; i < mblength; i++)
-+ *s++ = mbc[i];
-+ }
-+ }
-+ memmove (mbc, mbc + mblength, MB_CUR_MAX - mblength);
-+ mbc_pos -= mblength;
-+ }
-+
-+ input_position += width;
-+ return chars;
-+}
-+#endif
-+
- /* We've just printed some files and need to clean up things before
- looking for more options and printing the next batch of files.
-
---- coreutils-6.8+/src/cut.c.i18n 2007-01-14 15:41:28.000000000 +0000
-+++ coreutils-6.8+/src/cut.c 2007-03-01 15:08:24.000000000 +0000
-@@ -29,6 +29,11 @@
- #include <assert.h>
- #include <getopt.h>
- #include <sys/types.h>
-+
-+/* Get mbstate_t, mbrtowc(). */
-+#if HAVE_WCHAR_H
-+# include <wchar.h>
-+#endif
- #include "system.h"
-
- #include "error.h"
-@@ -37,6 +42,18 @@
- #include "quote.h"
- #include "xstrndup.h"
-
-+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
-+ installation; work around this configuration error. */
-+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
-+# undef MB_LEN_MAX
-+# define MB_LEN_MAX 16
-+#endif
-+
-+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
-+#if HAVE_MBRTOWC && defined mbstate_t
-+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
-+#endif
-+
- /* The official name of this program (e.g., no `g' prefix). */
- #define PROGRAM_NAME "cut"
-
-@@ -67,6 +84,52 @@
- } \
- while (0)
-
-+/* Refill the buffer BUF to get a multibyte character. */
-+#define REFILL_BUFFER(BUF, BUFPOS, BUFLEN, STREAM) \
-+ do \
-+ { \
-+ if (BUFLEN < MB_LEN_MAX && !feof (STREAM) && !ferror (STREAM)) \
-+ { \
-+ memmove (BUF, BUFPOS, BUFLEN); \
-+ BUFLEN += fread (BUF + BUFLEN, sizeof(char), BUFSIZ, STREAM); \
-+ BUFPOS = BUF; \
-+ } \
-+ } \
-+ while (0)
-+
-+/* Get wide character on BUFPOS. BUFPOS is not included after that.
-+ If byte sequence is not valid as a character, CONVFAIL is 1. Otherwise 0. */
-+#define GET_NEXT_WC_FROM_BUFFER(WC, BUFPOS, BUFLEN, MBLENGTH, STATE, CONVFAIL) \
-+ do \
-+ { \
-+ mbstate_t state_bak; \
-+ \
-+ if (BUFLEN < 1) \
-+ { \
-+ WC = WEOF; \
-+ break; \
-+ } \
-+ \
-+ /* Get a wide character. */ \
-+ CONVFAIL = 0; \
-+ state_bak = STATE; \
-+ MBLENGTH = mbrtowc ((wchar_t *)&WC, BUFPOS, BUFLEN, &STATE); \
-+ \
-+ switch (MBLENGTH) \
-+ { \
-+ case (size_t)-1: \
-+ case (size_t)-2: \
-+ CONVFAIL++; \
-+ STATE = state_bak; \
-+ /* Fall througn. */ \
-+ \
-+ case 0: \
-+ MBLENGTH = 1; \
-+ break; \
-+ } \
-+ } \
-+ while (0)
-+
- struct range_pair
- {
- size_t lo;
-@@ -85,7 +148,7 @@
- /* The number of bytes allocated for FIELD_1_BUFFER. */
- static size_t field_1_bufsize;
-
--/* The largest field or byte index used as an endpoint of a closed
-+/* The largest byte, character or field index used as an endpoint of a closed
- or degenerate range specification; this doesn't include the starting
- index of right-open-ended ranges. For example, with either range spec
- `2-5,9-', `2-3,5,9-' this variable would be set to 5. */
-@@ -97,10 +160,11 @@
-
- /* This is a bit vector.
- In byte mode, which bytes to output.
-+ In character mode, which characters to output.
- In field mode, which DELIM-separated fields to output.
-- Both bytes and fields are numbered starting with 1,
-+ Bytes, characters and fields are numbered starting with 1,
- so the zeroth bit of this array is unused.
-- A field or byte K has been selected if
-+ A byte, character or field K has been selected if
- (K <= MAX_RANGE_ENDPOINT and is_printable_field(K))
- || (EOL_RANGE_START > 0 && K >= EOL_RANGE_START). */
- static unsigned char *printable_field;
-@@ -109,9 +173,12 @@
- {
- undefined_mode,
-
-- /* Output characters that are in the given bytes. */
-+ /* Output bytes that are at the given positions. */
- byte_mode,
-
-+ /* Output characters that are at the given positions. */
-+ character_mode,
-+
- /* Output the given delimeter-separated fields. */
- field_mode
- };
-@@ -121,6 +188,13 @@
-
- static enum operating_mode operating_mode;
-
-+/* If nonzero, when in byte mode, don't split multibyte characters. */
-+static int byte_mode_character_aware;
-+
-+/* If nonzero, the function for single byte locale is work
-+ if this program runs on multibyte locale. */
-+static int force_singlebyte_mode;
-+
- /* If true do not output lines containing no delimeter characters.
- Otherwise, all such lines are printed. This option is valid only
- with field mode. */
-@@ -132,6 +206,9 @@
-
- /* The delimeter character for field mode. */
- static unsigned char delim;
-+#if HAVE_WCHAR_H
-+static wchar_t wcdelim;
-+#endif
-
- /* True if the --output-delimiter=STRING option was specified. */
- static bool output_delimiter_specified;
-@@ -205,7 +282,7 @@
- -f, --fields=LIST select only these fields; also print any line\n\
- that contains no delimiter character, unless\n\
- the -s option is specified\n\
-- -n (ignored)\n\
-+ -n with -b: don't split multibyte characters\n\
- "), stdout);
- fputs (_("\
- --complement complement the set of selected bytes, characters\n\
-@@ -362,7 +439,7 @@
- in_digits = false;
- /* Starting a range. */
- if (dash_found)
-- FATAL_ERROR (_("invalid byte or field list"));
-+ FATAL_ERROR (_("invalid byte, character or field list"));
- dash_found = true;
- fieldstr++;
-
-@@ -387,14 +464,16 @@
- if (value == 0)
- {
- /* `n-'. From `initial' to end of line. */
-- eol_range_start = initial;
-+ if (eol_range_start == 0 ||
-+ (eol_range_start != 0 && eol_range_start > initial))
-+ eol_range_start = initial;
- field_found = true;
- }
- else
- {
- /* `m-n' or `-n' (1-n). */
- if (value < initial)
-- FATAL_ERROR (_("invalid byte or field list"));
-+ FATAL_ERROR (_("invalid byte, character or field list"));
-
- /* Is there already a range going to end of line? */
- if (eol_range_start != 0)
-@@ -467,6 +546,9 @@
- if (operating_mode == byte_mode)
- error (0, 0,
- _("byte offset %s is too large"), quote (bad_num));
-+ else if (operating_mode == character_mode)
-+ error (0, 0,
-+ _("character offset %s is too large"), quote (bad_num));
- else
- error (0, 0,
- _("field number %s is too large"), quote (bad_num));
-@@ -477,7 +559,7 @@
- fieldstr++;
- }
- else
-- FATAL_ERROR (_("invalid byte or field list"));
-+ FATAL_ERROR (_("invalid byte, character or field list"));
- }
-
- max_range_endpoint = 0;
-@@ -570,6 +652,63 @@
- }
- }
-
-+#if HAVE_MBRTOWC
-+/* This function is in use for the following case.
-+
-+ 1. Read from the stream STREAM, printing to standard output any selected
-+ characters.
-+
-+ 2. Read from stream STREAM, printing to standard output any selected bytes,
-+ without splitting multibyte characters. */
-+
-+static void
-+cut_characters_or_cut_bytes_no_split (FILE *stream)
-+{
-+ int idx; /* number of bytes or characters in the line so far. */
-+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
-+ char *bufpos; /* Next read position of BUF. */
-+ size_t buflen; /* The length of the byte sequence in buf. */
-+ wint_t wc; /* A gotten wide character. */
-+ size_t mblength; /* The byte size of a multibyte character which shows
-+ as same character as WC. */
-+ mbstate_t state; /* State of the stream. */
-+ int convfail; /* 1, when conversion is failed. Otherwise 0. */
-+
-+ idx = 0;
-+ buflen = 0;
-+ bufpos = buf;
-+ memset (&state, '\0', sizeof(mbstate_t));
-+
-+ while (1)
-+ {
-+ REFILL_BUFFER (buf, bufpos, buflen, stream);
-+
-+ GET_NEXT_WC_FROM_BUFFER (wc, bufpos, buflen, mblength, state, convfail);
-+
-+ if (wc == WEOF)
-+ {
-+ if (idx > 0)
-+ putchar ('\n');
-+ break;
-+ }
-+ else if (wc == L'\n')
-+ {
-+ putchar ('\n');
-+ idx = 0;
-+ }
-+ else
-+ {
-+ idx += (operating_mode == byte_mode) ? mblength : 1;
-+ if (print_kth (idx, NULL))
-+ fwrite (bufpos, mblength, sizeof(char), stdout);
-+ }
-+
-+ buflen -= mblength;
-+ bufpos += mblength;
-+ }
-+}
-+#endif
-+
- /* Read from stream STREAM, printing to standard output any selected fields. */
-
- static void
-@@ -692,13 +831,192 @@
- }
- }
-
-+#if HAVE_MBRTOWC
-+static void
-+cut_fields_mb (FILE *stream)
-+{
-+ int c;
-+ unsigned int field_idx;
-+ int found_any_selected_field;
-+ int buffer_first_field;
-+ int empty_input;
-+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
-+ char *bufpos; /* Next read position of BUF. */
-+ size_t buflen; /* The length of the byte sequence in buf. */
-+ wint_t wc = 0; /* A gotten wide character. */
-+ size_t mblength; /* The byte size of a multibyte character which shows
-+ as same character as WC. */
-+ mbstate_t state; /* State of the stream. */
-+ int convfail; /* 1, when conversion is failed. Otherwise 0. */
-+
-+ found_any_selected_field = 0;
-+ field_idx = 1;
-+ bufpos = buf;
-+ buflen = 0;
-+ memset (&state, '\0', sizeof(mbstate_t));
-+
-+ c = getc (stream);
-+ empty_input = (c == EOF);
-+ if (c != EOF)
-+ ungetc (c, stream);
-+ else
-+ wc = WEOF;
-+
-+ /* To support the semantics of the -s flag, we may have to buffer
-+ all of the first field to determine whether it is `delimited.'
-+ But that is unnecessary if all non-delimited lines must be printed
-+ and the first field has been selected, or if non-delimited lines
-+ must be suppressed and the first field has *not* been selected.
-+ That is because a non-delimited line has exactly one field. */
-+ buffer_first_field = (suppress_non_delimited ^ !print_kth (1, NULL));
-+
-+ while (1)
-+ {
-+ if (field_idx == 1 && buffer_first_field)
-+ {
-+ int len = 0;
-+
-+ while (1)
-+ {
-+ REFILL_BUFFER (buf, bufpos, buflen, stream);
-+
-+ GET_NEXT_WC_FROM_BUFFER
-+ (wc, bufpos, buflen, mblength, state, convfail);
-+
-+ if (wc == WEOF)
-+ break;
-+
-+ field_1_buffer = xrealloc (field_1_buffer, len + mblength);
-+ memcpy (field_1_buffer + len, bufpos, mblength);
-+ len += mblength;
-+ buflen -= mblength;
-+ bufpos += mblength;
-+
-+ if (!convfail && (wc == L'\n' || wc == wcdelim))
-+ break;
-+ }
-+
-+ if (wc == WEOF)
-+ break;
-+
-+ /* If the first field extends to the end of line (it is not
-+ delimited) and we are printing all non-delimited lines,
-+ print this one. */
-+ if (convfail || (!convfail && wc != wcdelim))
-+ {
-+ if (suppress_non_delimited)
-+ {
-+ /* Empty. */
-+ }
-+ else
-+ {
-+ fwrite (field_1_buffer, sizeof (char), len, stdout);
-+ /* Make sure the output line is newline terminated. */
-+ if (convfail || (!convfail && wc != L'\n'))
-+ putchar ('\n');
-+ }
-+ continue;
-+ }
-+
-+ if (print_kth (1, NULL))
-+ {
-+ /* Print the field, but not the trailing delimiter. */
-+ fwrite (field_1_buffer, sizeof (char), len - 1, stdout);
-+ found_any_selected_field = 1;
-+ }
-+ ++field_idx;
-+ }
-+
-+ if (wc != WEOF)
-+ {
-+ if (print_kth (field_idx, NULL))
-+ {
-+ if (found_any_selected_field)
-+ {
-+ fwrite (output_delimiter_string, sizeof (char),
-+ output_delimiter_length, stdout);
-+ }
-+ found_any_selected_field = 1;
-+ }
-+
-+ while (1)
-+ {
-+ REFILL_BUFFER (buf, bufpos, buflen, stream);
-+
-+ GET_NEXT_WC_FROM_BUFFER
-+ (wc, bufpos, buflen, mblength, state, convfail);
-+
-+ if (wc == WEOF)
-+ break;
-+ else if (!convfail && (wc == wcdelim || wc == L'\n'))
-+ {
-+ buflen -= mblength;
-+ bufpos += mblength;
-+ break;
-+ }
-+
-+ if (print_kth (field_idx, NULL))
-+ fwrite (bufpos, mblength, sizeof(char), stdout);
-+
-+ buflen -= mblength;
-+ bufpos += mblength;
-+ }
-+ }
-+
-+ if ((!convfail || wc == L'\n') && buflen < 1)
-+ wc = WEOF;
-+
-+ if (!convfail && wc == wcdelim)
-+ ++field_idx;
-+ else if (wc == WEOF || (!convfail && wc == L'\n'))
-+ {
-+ if (found_any_selected_field
-+ || (!empty_input && !(suppress_non_delimited && field_idx == 1)))
-+ putchar ('\n');
-+ if (wc == WEOF)
-+ break;
-+ field_idx = 1;
-+ found_any_selected_field = 0;
-+ }
-+ }
-+}
-+#endif
-+
- static void
- cut_stream (FILE *stream)
- {
-- if (operating_mode == byte_mode)
-- cut_bytes (stream);
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1 && !force_singlebyte_mode)
-+ {
-+ switch (operating_mode)
-+ {
-+ case byte_mode:
-+ if (byte_mode_character_aware)
-+ cut_characters_or_cut_bytes_no_split (stream);
-+ else
-+ cut_bytes (stream);
-+ break;
-+
-+ case character_mode:
-+ cut_characters_or_cut_bytes_no_split (stream);
-+ break;
-+
-+ case field_mode:
-+ cut_fields_mb (stream);
-+ break;
-+
-+ default:
-+ abort ();
-+ }
-+ }
- else
-- cut_fields (stream);
-+#endif
-+ {
-+ if (operating_mode == field_mode)
-+ cut_fields (stream);
-+ else
-+ cut_bytes (stream);
-+ }
- }
-
- /* Process file FILE to standard output.
-@@ -748,6 +1066,8 @@
- bool ok;
- bool delim_specified = false;
- char *spec_list_string IF_LINT(= NULL);
-+ char mbdelim[MB_LEN_MAX + 1];
-+ size_t delimlen = 0;
-
- initialize_main (&argc, &argv);
- program_name = argv[0];
-@@ -770,7 +1090,6 @@
- switch (optc)
- {
- case 'b':
-- case 'c':
- /* Build the byte list. */
- if (operating_mode != undefined_mode)
- FATAL_ERROR (_("only one type of list may be specified"));
-@@ -778,6 +1097,14 @@
- spec_list_string = optarg;
- break;
-
-+ case 'c':
-+ /* Build the character list. */
-+ if (operating_mode != undefined_mode)
-+ FATAL_ERROR (_("only one type of list may be specified"));
-+ operating_mode = character_mode;
-+ spec_list_string = optarg;
-+ break;
-+
- case 'f':
- /* Build the field list. */
- if (operating_mode != undefined_mode)
-@@ -789,10 +1116,35 @@
- case 'd':
- /* New delimiter. */
- /* Interpret -d '' to mean `use the NUL byte as the delimiter.' */
-- if (optarg[0] != '\0' && optarg[1] != '\0')
-- FATAL_ERROR (_("the delimiter must be a single character"));
-- delim = optarg[0];
-- delim_specified = true;
-+#if HAVE_MBRTOWC
-+ {
-+ if(MB_CUR_MAX > 1)
-+ {
-+ mbstate_t state;
-+
-+ memset (&state, '\0', sizeof(mbstate_t));
-+ delimlen = mbrtowc (&wcdelim, optarg, strnlen(optarg, MB_LEN_MAX), &state);
-+
-+ if (delimlen == (size_t)-1 || delimlen == (size_t)-2)
-+ ++force_singlebyte_mode;
-+ else
-+ {
-+ delimlen = (delimlen < 1) ? 1 : delimlen;
-+ if (wcdelim != L'\0' && *(optarg + delimlen) != '\0')
-+ FATAL_ERROR (_("the delimiter must be a single character"));
-+ memcpy (mbdelim, optarg, delimlen);
-+ }
-+ }
-+
-+ if (MB_CUR_MAX <= 1 || force_singlebyte_mode)
-+#endif
-+ {
-+ if (optarg[0] != '\0' && optarg[1] != '\0')
-+ FATAL_ERROR (_("the delimiter must be a single character"));
-+ delim = (unsigned char) optarg[0];
-+ }
-+ delim_specified = true;
-+ }
- break;
-
- case OUTPUT_DELIMITER_OPTION:
-@@ -805,6 +1157,7 @@
- break;
-
- case 'n':
-+ byte_mode_character_aware = 1;
- break;
-
- case 's':
-@@ -827,7 +1180,7 @@
- if (operating_mode == undefined_mode)
- FATAL_ERROR (_("you must specify a list of bytes, characters, or fields"));
-
-- if (delim != '\0' && operating_mode != field_mode)
-+ if (delim_specified && operating_mode != field_mode)
- FATAL_ERROR (_("an input delimiter may be specified only\
- when operating on fields"));
-
-@@ -854,15 +1207,34 @@
- }
-
- if (!delim_specified)
-- delim = '\t';
-+ {
-+ delim = '\t';
-+#ifdef HAVE_MBRTOWC
-+ wcdelim = L'\t';
-+ mbdelim[0] = '\t';
-+ mbdelim[1] = '\0';
-+ delimlen = 1;
-+#endif
-+ }
-
- if (output_delimiter_string == NULL)
- {
-- static char dummy[2];
-- dummy[0] = delim;
-- dummy[1] = '\0';
-- output_delimiter_string = dummy;
-- output_delimiter_length = 1;
-+#ifdef HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1 && !force_singlebyte_mode)
-+ {
-+ output_delimiter_string = xstrdup(mbdelim);
-+ output_delimiter_length = delimlen;
-+ }
-+
-+ if (MB_CUR_MAX <= 1 || force_singlebyte_mode)
-+#endif
-+ {
-+ static char dummy[2];
-+ dummy[0] = delim;
-+ dummy[1] = '\0';
-+ output_delimiter_string = dummy;
-+ output_delimiter_length = 1;
-+ }
- }
-
- if (optind == argc)
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-ls-x.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-ls-x.patch
deleted file mode 100644
index aba8742f6..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-ls-x.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-This patch was imported from the Fedora Core 8 coreutils-6.9-9 package.
-
-The package is stated as being Licensed as GPLv2+.
-
-Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-
---- coreutils-6.9/src/ls.c.ls-x 2007-06-13 14:27:36.000000000 +0100
-+++ coreutils-6.9/src/ls.c 2007-06-13 14:28:42.000000000 +0100
-@@ -4151,16 +4151,16 @@
- size_t pos = 0;
- size_t cols = calculate_columns (false);
- struct column_info const *line_fmt = &column_info[cols - 1];
-- size_t name_length = length_of_file_name_and_frills (cwd_file);
-+ struct fileinfo const *f = sorted_file[0];
-+ size_t name_length = length_of_file_name_and_frills (f);
- size_t max_name_length = line_fmt->col_arr[0];
-
- /* Print first entry. */
-- print_file_name_and_frills (cwd_file);
-+ print_file_name_and_frills (f);
-
- /* Now the rest. */
- for (filesno = 1; filesno < cwd_n_used; ++filesno)
- {
-- struct fileinfo const *f;
- size_t col = filesno % cols;
-
- if (col == 0)
---- coreutils-6.9/tests/ls/Makefile.am.ls-x 2007-03-18 21:36:43.000000000 +0000
-+++ coreutils-6.9/tests/ls/Makefile.am 2007-06-13 14:28:42.000000000 +0100
-@@ -24,7 +24,7 @@
- stat-dtype \
- inode dangle file-type recursive dired infloop \
- rt-1 time-1 symlink-slash follow-slink no-arg m-option \
-- stat-vs-dirent
-+ stat-vs-dirent x-option
-
- EXTRA_DIST = $(TESTS)
- TESTS_ENVIRONMENT = \
---- /dev/null 2007-06-13 08:43:51.993263382 +0100
-+++ coreutils-6.9/tests/ls/x-option 2007-06-13 14:28:42.000000000 +0100
-@@ -0,0 +1,59 @@
-+#!/bin/sh
-+# Exercise the -x option.
-+
-+# Copyright (C) 2007 Free Software Foundation, Inc.
-+
-+# 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 will 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.
-+
-+if test "$VERBOSE" = yes; then
-+ set -x
-+ ls --version
-+fi
-+
-+. $srcdir/../envvar-check
-+. $srcdir/../lang-default
-+
-+pwd=`pwd`
-+t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-+trap '(exit $?); exit $?' 1 2 13 15
-+
-+framework_failure=0
-+mkdir -p $tmp || framework_failure=1
-+cd $tmp || framework_failure=1
-+mkdir subdir || framework_failure=1
-+touch subdir/b || framework_failure=1
-+touch subdir/a || framework_failure=1
-+
-+if test $framework_failure = 1; then
-+ echo "$0: failure in testing framework" 1>&2
-+ (exit 1); exit 1
-+fi
-+
-+fail=0
-+
-+# Coreutils 6.8 and 6.9 would output this in the wrong order.
-+ls -x subdir > out || fail=1
-+ls -rx subdir >> out || fail=1
-+cat <<\EOF > exp || fail=1
-+a b
-+b a
-+EOF
-+
-+cmp out exp || fail=1
-+test $fail = 1 && diff out exp 2> /dev/null
-+
-+(exit $fail); exit $fail
---- coreutils-6.9/NEWS.ls-x 2007-03-22 21:19:45.000000000 +0000
-+++ coreutils-6.9/NEWS 2007-06-13 14:28:42.000000000 +0100
-@@ -13,6 +13,11 @@
- Using pr -m -s (i.e. merging files, with TAB as the output separator)
- no longer inserts extraneous spaces between output columns.
-
-+** Bug fixes
-+
-+ ls -x DIR would sometimes output the wrong string in place of the
-+ first entry. [introduced in coreutils-6.8]
-+
-
- * Noteworthy changes in release 6.8 (2007-02-24) [not-unstable]
-
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-overflow.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-overflow.patch
deleted file mode 100644
index 58074c09a..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils-overflow.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-This patch was imported from the Fedora Core 8 coreutils-6.9-9 package.
-
-The package is stated as being Licensed as GPLv2+.
-
-Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-
---- coreutils-5.2.1/src/who.c.overflow 2005-05-25 09:59:06.000000000 +0100
-+++ coreutils-5.2.1/src/who.c 2005-05-25 10:00:31.000000000 +0100
-@@ -75,7 +75,7 @@
- # define NEW_TIME 0
- #endif
-
--#define IDLESTR_LEN 6
-+#define IDLESTR_LEN 10
-
- #if HAVE_STRUCT_XTMP_UT_PID
- # define PIDSTR_DECL_AND_INIT(Var, Utmp_ent) \
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils_fix_for_automake-1.12.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils_fix_for_automake-1.12.patch
deleted file mode 100644
index 64e5f12ba..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/coreutils_fix_for_automake-1.12.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-Upstream-Status: Pending
-
-automake 1.12 has depricated automatic de-ANSI-fication support
-
-this patch avoids these kinds of errors:
-
-| configure.ac:40: error: automatic de-ANSI-fication support has been removed
-| /srv/home/nitin/builds/build-gcc47/tmp/sysroots/x86_64-linux/usr/share/aclocal-1.12/protos.m4:12: AM_C_PROTOTYPES is expanded from...
-| /srv/home/nitin/builds/build-gcc47/tmp/work/x86_64-linux/coreutils-native-6.9-r2/coreutils-6.9/m4/jm-macros.m4:138: gl_CHECK_ALL_TYPES is expanded from...
-| /srv/home/nitin/builds/build-gcc47/tmp/work/x86_64-linux/coreutils-native-6.9-r2/coreutils-6.9/m4/jm-macros.m4:24: coreutils_MACROS is expanded from...
-| configure.ac:40: the top level
-| autom4te: m4 failed with exit status: 1
-
-Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
-2012/05/04
-
-Index: coreutils-6.9/m4/jm-macros.m4
-===================================================================
---- coreutils-6.9.orig/m4/jm-macros.m4
-+++ coreutils-6.9/m4/jm-macros.m4
-@@ -142,11 +142,6 @@ AC_DEFUN([gl_CHECK_ALL_TYPES],
- dnl whether functions and headers are available, whether they work, etc.
- AC_REQUIRE([AC_SYS_LARGEFILE])
-
-- dnl This test must precede tests of compiler characteristics like
-- dnl that for the inline keyword, since it may change the degree to
-- dnl which the compiler supports such features.
-- AC_REQUIRE([AM_C_PROTOTYPES])
--
- dnl Checks for typedefs, structures, and compiler characteristics.
- AC_REQUIRE([AC_C_BIGENDIAN])
- AC_REQUIRE([AC_C_VOLATILE])
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/fix_for_manpage_building.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/fix_for_manpage_building.patch
deleted file mode 100644
index e0d600a39..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/fix_for_manpage_building.patch
+++ /dev/null
@@ -1,85 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-Use native coreutils binaries to build manpages in cross environment.
-This avoids man page build issues like this:
-
-| Making all in man
-| make[1]: Entering directory `/build_disk/poky_build/build1/tmp/work/i586-poky-linux/coreutils-6.9-r0/coreutils-6.9/man'
-| Updating man page cut.1
-| Updating man page dir.1
-| Updating man page expand.1
-| Updating man page fold.1
-| Updating man page install.1
-| Updating man page join.1
-| Updating man page pr.1
-| Updating man page ls.1
-| Updating man page sort.1
-| Updating man page unexpand.1
-| Updating man page uniq.1
-| Updating man page who.1
-| Updating man page vdir.1
-| help2man: can't get `--help' info from dir.td/dir
-| help2man: can't get `--help' info from cut.td/cut
-| make[1]: *** [dir.1] Error 126
-| make[1]: *** Waiting for unfinished jobs....
-| help2man: can't get `--help' info from fold.td/fold
-| help2man: can't get `--help' info from install.td/install
-| help2man: can't get `--help' info from expand.td/expand
-| help2man: can't get `--help' info from join.td/join
-| make[1]: *** [cut.1] Error 126
-| make[1]: *** [fold.1] Error 126
-| make[1]: *** [install.1] Error 126
-| help2man: can't get `--help' info from sort.td/sort
-| make[1]: *** [expand.1] Error 126
-| help2man: can't get `--help' info from pr.td/pr
-| make[1]: *** [join.1] Error 126
-| help2man: can't get `--help' info from ls.td/ls
-| help2man: can't get `--help' info from unexpand.td/unexpand
-| help2man: can't get `--help' info from uniq.td/uniq
-| help2man: can't get `--help' info from who.td/who
-| make[1]: *** [sort.1] Error 126
-| make[1]: *** [pr.1] Error 126
-| help2man: can't get `--help' info from vdir.td/vdir
-| make[1]: *** [ls.1] Error 126
-| make[1]: *** [uniq.1] Error 126
-| make[1]: *** [unexpand.1] Error 126
-| make[1]: *** [who.1] Error 126
-| make[1]: *** [vdir.1] Error 126
-| make[1]: Leaving directory `/build_disk/poky_build/build1/tmp/work/i586-poky-linux/coreutils-6.9-r0/coreutils-6.9/man'
-| make: *** [all-recursive] Error 1
-| FATAL: oe_runmake failed
-| ERROR: Function 'do_compile' failed (see /build_disk/poky_build/build1/tmp/work/i586-poky-linux/coreutils-6.9-r0/temp/log.do_compile.12780 for further information)
-NOTE: package coreutils-6.9-r0: task do_compile: Failed
-ERROR: Task 8 (/home/nitin/prj/poky.git/meta/recipes-core/coreutils/coreutils_6.9.bb, do_compile) failed with exit code '1'
-
-
-This patch is made for gplv2 coreutils the recipe
-Nitin A Kamble <nitin.a.kamble@intel.com>
-2011/03/17
-
-Index: man/Makefile.am
-===================================================================
---- a/man.orig/Makefile.am
-+++ b/man/Makefile.am
-@@ -167,7 +167,7 @@ mapped_name = `echo $*|sed 's/install/gi
- $(PERL) -- $(srcdir)/help2man \
- --source='$(PACKAGE_STRING)' \
- --include=$(srcdir)/$*.x \
-- --output=$t/$@ $t/$*; \
-+ --output=$t/$@ $*; \
- } \
- && sed 's|$*\.td/||g' $t/$@ > $@ \
- && chmod a-w $@ \
-Index: man/Makefile.in
-===================================================================
---- a/man.orig/Makefile.in
-+++ b/man/Makefile.in
-@@ -865,7 +865,7 @@ yes.1: $(common_dep) $(srcdir)/yes.x .
- $(PERL) -- $(srcdir)/help2man \
- --source='$(PACKAGE_STRING)' \
- --include=$(srcdir)/$*.x \
-- --output=$t/$@ $t/$*; \
-+ --output=$t/$@ $*; \
- } \
- && sed 's|$*\.td/||g' $t/$@ > $@ \
- && chmod a-w $@ \
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/futimens.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/futimens.patch
deleted file mode 100644
index 508810623..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/futimens.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-# coreutils uses gnulib which conflicts with newer libc header on futimens
-# this patch simply renames coreutils futimes to avoid confliction
-#
-# Signed-off-by: Kevin Tian <kevin.tian@intel.com>, 2010-08-18
-# (this patch is licensed under GPLv2)
-
-diff --git a/lib/utimens.c b/lib/utimens.c
-index 71bc510..ae870b8 100644
---- a/lib/utimens.c
-+++ b/lib/utimens.c
-@@ -75,7 +75,7 @@ struct utimbuf
- Return 0 on success, -1 (setting errno) on failure. */
-
- int
--futimens (int fd ATTRIBUTE_UNUSED,
-+futimens_coreutils (int fd ATTRIBUTE_UNUSED,
- char const *file, struct timespec const timespec[2])
- {
- /* Some Linux-based NFS clients are buggy, and mishandle time stamps
-@@ -185,5 +185,5 @@ futimens (int fd ATTRIBUTE_UNUSED,
- int
- utimens (char const *file, struct timespec const timespec[2])
- {
-- return futimens (-1, file, timespec);
-+ return futimens_coreutils (-1, file, timespec);
- }
-diff --git a/lib/utimens.h b/lib/utimens.h
-index 0097aaa..13fc45a 100644
---- a/lib/utimens.h
-+++ b/lib/utimens.h
-@@ -1,3 +1,3 @@
- #include <time.h>
--int futimens (int, char const *, struct timespec const [2]);
-+int futimens_coreutils (int, char const *, struct timespec const [2]);
- int utimens (char const *, struct timespec const [2]);
-diff --git a/src/copy.c b/src/copy.c
-index 4bdb75c..04634f1 100644
---- a/src/copy.c
-+++ b/src/copy.c
-@@ -518,7 +518,7 @@ copy_reg (char const *src_name, char const *dst_name,
- timespec[0] = get_stat_atime (src_sb);
- timespec[1] = get_stat_mtime (src_sb);
-
-- if (futimens (dest_desc, dst_name, timespec) != 0)
-+ if (futimens_coreutils (dest_desc, dst_name, timespec) != 0)
- {
- error (0, errno, _("preserving times for %s"), quote (dst_name));
- if (x->require_preserve)
-diff --git a/src/touch.c b/src/touch.c
-index a79c26d..6ef317d 100644
---- a/src/touch.c
-+++ b/src/touch.c
-@@ -182,7 +182,7 @@ touch (const char *file)
- t = timespec;
- }
-
-- ok = (futimens (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0);
-+ ok = (futimens_coreutils (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0);
-
- if (fd == STDIN_FILENO)
- {
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/gnulib_m4.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/gnulib_m4.patch
deleted file mode 100644
index 8a8ffa726..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/gnulib_m4.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-# remove the line to cause recursive inclusion error from autoreconf, sicne
-# newer autoconf has included this definition. Simply rename it here.
-#
-# Signed-off-by: Kevin Tian <kevin.tian@intel.com>, 2010-08-18
-# (this patch is licensed under GPLv2)
-
-diff --git a/extensions.m4 b/extensions.m4
-index 143a9e5..f6558f1 100644
---- a/m4/extensions.m4
-+++ b/m4/extensions.m4
-@@ -16,7 +16,7 @@
- # ------------------------
- # Enable extensions on systems that normally disable them,
- # typically due to standards-conformance issues.
--AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
-+AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS_DUMMY],
- [
- AC_BEFORE([$0], [AC_COMPILE_IFELSE])
- AC_BEFORE([$0], [AC_RUN_IFELSE])
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/loadavg.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/loadavg.patch
deleted file mode 100644
index c72efd4d3..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/loadavg.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Remove hardcoded paths so OE's configure QA does not detect it and fail the builds
-For cross compilation is less interesting to look into host paths for target libraries anyway
-
-Upstream-Status: Inappropriate [OE Specific]
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Index: coreutils-6.9/m4/getloadavg.m4
-===================================================================
---- coreutils-6.9.orig/m4/getloadavg.m4
-+++ coreutils-6.9/m4/getloadavg.m4
-@@ -49,7 +49,6 @@ if test $gl_have_func = no; then
- # There is a commonly available library for RS/6000 AIX.
- # Since it is not a standard part of AIX, it might be installed locally.
- gl_getloadavg_LIBS=$LIBS
-- LIBS="-L/usr/local/lib $LIBS"
- AC_CHECK_LIB(getloadavg, getloadavg,
- [LIBS="-lgetloadavg $LIBS"], [LIBS=$gl_getloadavg_LIBS])
- fi
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/man-touch.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/man-touch.patch
deleted file mode 100644
index 59a4fe005..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-6.9/man-touch.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-# man page for 'touch' is generated differently from others. All other utilities
-# are provided static man source files, while for 'touch' it requires help2man
-# to invoke "touch --help" and then convert the output into the manual. Since touch
-# is with target format which can't be invoked on build system, disable building
-# 'touch' man page here.
-#
-# Signed-off-by: Kevin Tian <kevin.tian@intel.com>, 2010-08-18
-# (this patch is licensed under GPLv2)
-
-diff --git a/man/Makefile.am b/man/Makefile.am
-index 32df9d1..37b09e3 100644
---- a/man/Makefile.am
-+++ b/man/Makefile.am
-@@ -27,7 +27,7 @@ dist_man_MANS = \
- paste.1 pathchk.1 pr.1 printenv.1 printf.1 ptx.1 pwd.1 readlink.1 \
- rm.1 rmdir.1 seq.1 sha1sum.1 sha224sum.1 sha256sum.1 sha384sum.1 sha512sum.1 \
- shred.1 shuf.1 sleep.1 sort.1 split.1 stat.1 \
-- su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 touch.1 tr.1 true.1 tsort.1 \
-+ su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 tr.1 true.1 tsort.1 \
- tty.1 unexpand.1 uniq.1 unlink.1 vdir.1 wc.1 \
- whoami.1 yes.1 $(MAN)
- optional_mans = \
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.25/0001-Unset-need_charset_alias-when-building-for-musl.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/0001-Unset-need_charset_alias-when-building-for-musl.patch
index ba1a4bab4..ba1a4bab4 100644
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.25/0001-Unset-need_charset_alias-when-building-for-musl.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/0001-Unset-need_charset_alias-when-building-for-musl.patch
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/0001-local.mk-fix-cross-compiling-problem.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/0001-local.mk-fix-cross-compiling-problem.patch
new file mode 100644
index 000000000..66f9a716c
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/0001-local.mk-fix-cross-compiling-problem.patch
@@ -0,0 +1,26 @@
+Subject: local.mk: fix cross compiling problem
+
+We meet the following error when cross compiling.
+| Makefile:3418: *** Recursive variable 'INSTALL' references itself (eventually). Stop.
+This patch fixes this problem.
+
+Upstream-Status: Pending
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/local.mk | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/local.mk b/src/local.mk
+index 36dfa4e..c5898cc 100644
+--- a/src/local.mk
++++ b/src/local.mk
+@@ -649,4 +649,4 @@ cu_install_program = @INSTALL_PROGRAM@
+ else
+ cu_install_program = src/ginstall
+ endif
+-INSTALL = $(cu_install_program) -c
++INSTALL_PROGRAM = $(cu_install_program)
+--
+2.1.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.25/0001-uname-report-processor-and-hardware-correctly.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/0001-uname-report-processor-and-hardware-correctly.patch
index 3c43e1d5d..3c43e1d5d 100644
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.25/0001-uname-report-processor-and-hardware-correctly.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/0001-uname-report-processor-and-hardware-correctly.patch
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.25/disable-ls-output-quoting.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/disable-ls-output-quoting.patch
index e68c21355..e68c21355 100644
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.25/disable-ls-output-quoting.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/disable-ls-output-quoting.patch
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.25/fix-selinux-flask.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/fix-selinux-flask.patch
index 9d1ae55d4..9d1ae55d4 100644
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.25/fix-selinux-flask.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/fix-selinux-flask.patch
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.25/man-decouple-manpages-from-build.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/man-decouple-manpages-from-build.patch
index 3c896a11b..3c896a11b 100644
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.25/man-decouple-manpages-from-build.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/man-decouple-manpages-from-build.patch
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.25/remove-usr-local-lib-from-m4.patch b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/remove-usr-local-lib-from-m4.patch
index 2ef8a548a..2ef8a548a 100644
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.25/remove-usr-local-lib-from-m4.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils-8.26/remove-usr-local-lib-from-m4.patch
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils_6.9.bb b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils_6.9.bb
deleted file mode 100644
index 35700a32f..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils_6.9.bb
+++ /dev/null
@@ -1,107 +0,0 @@
-SUMMARY = "The basic file, shell and text manipulation utilities"
-DESCRIPTION = "The GNU Core Utilities provide the basic file, shell and text \
-manipulation utilities. These are the core utilities which are expected to exist on \
-every system."
-
-HOMEPAGE = "http://www.gnu.org/software/coreutils/"
-BUGTRACKER = "http://debbugs.gnu.org/coreutils"
-LICENSE = "GPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
- file://src/ls.c;beginline=4;endline=16;md5=15ed60f67b1db5fedd5dbc37cf8a9543"
-PR = "r5"
-DEPENDS = "virtual/libiconv"
-
-inherit autotools gettext texinfo
-
-SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.bz2 \
- file://gnulib_m4.patch \
- file://futimens.patch \
- file://coreutils-ls-x.patch \
- file://coreutils-6.9-cp-i-u.patch \
- file://coreutils-i18n.patch \
- file://coreutils-overflow.patch \
- file://coreutils-fix-install.patch \
- file://man-touch.patch \
- file://coreutils_fix_for_automake-1.12.patch \
- file://coreutils-fix-texinfo.patch \
- file://fix_for_manpage_building.patch \
- file://loadavg.patch \
- "
-
-SRC_URI[md5sum] = "c9607d8495f16e98906e7ed2d9751a06"
-SRC_URI[sha256sum] = "89c2895ad157de50e53298b22d91db116ee4e1dd3fdf4019260254e2e31497b0"
-
-EXTRA_OECONF += "ac_cv_func_getgroups_works=yes \
- ac_cv_func_strcoll_works=yes"
-
-# acl is not a default feature
-#
-PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'acl', 'acl', '', d)}"
-
-# with, without, depends, rdepends
-#
-PACKAGECONFIG[acl] = "ac_cv_header_sys_acl_h=yes ac_cv_header_acl_libacl_h=yes ac_cv_search_acl_get_file=-lacl,ac_cv_header_sys_acl_h=no ac_cv_header_acl_libacl_h=no ac_cv_search_acl_get_file=,acl,"
-
-
-# [ gets a special treatment and is not included in this
-bindir_progs = "base64 basename cksum comm csplit cut dir dircolors dirname du \
- env expand expr factor fmt fold groups head hostid id install \
- join link logname md5sum mkfifo nice nl nohup od paste pathchk \
- pinky pr printenv printf ptx readlink seq sha1sum sha224sum sha256sum \
- sha384sum sha512sum shred shuf sort split sum tac tail tee test \
- tr tsort tty unexpand uniq unlink users vdir wc who whoami yes uptime"
-
-# hostname gets a special treatment and is not included in this
-base_bindir_progs = "cat chgrp chmod chown cp date dd echo false kill ln ls mkdir \
- mknod mv pwd rm rmdir sleep stty sync touch true uname hostname stat"
-
-sbindir_progs= "chroot"
-
-# Let aclocal use the relative path for the m4 file rather than the
-# absolute since coreutils has a lot of m4 files, otherwise there might
-# be an "Argument list too long" error when it is built in a long/deep
-# directory.
-acpaths = "-I ./m4"
-
-do_install() {
- autotools_do_install
-
- install -d ${D}${base_bindir}
- [ "${bindir}" != "${base_bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i; done
-
- install -d ${D}${sbindir}
- [ "${bindir}" != "${sbindir}" ] && for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i; done
-
- # [ requires special handling because [.coreutils will cause the sed stuff
- # in update-alternatives to fail, therefore use lbracket - the name used
- # for the actual source file.
- mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${BPN}
-
- # Newer versions of coreutils do not include su, to mimic this behavior
- # we simply remove it.
- rm -f ${D}${bindir}/su
-}
-
-inherit update-alternatives
-
-ALTERNATIVE_PRIORITY = "100"
-
-ALTERNATIVE_${PN} = "lbracket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs}"
-
-ALTERNATIVE_${PN}-doc = "su.1 hostname.1"
-ALTERNATIVE_LINK_NAME[su.1] = "${mandir}/man1/su.1"
-ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1"
-
-ALTERNATIVE_PRIORITY[uptime] = "10"
-ALTERNATIVE_PRIORITY[hostname] = "10"
-
-ALTERNATIVE_LINK_NAME[lbracket] = "${bindir}/["
-ALTERNATIVE_TARGET[lbracket] = "${bindir}/lbracket.${BPN}"
-
-python __anonymous() {
- for prog in d.getVar('base_bindir_progs', True).split():
- d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir', True), prog))
-
- for prog in d.getVar('sbindir_progs', True).split():
- d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir', True), prog))
-}
diff --git a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils_8.25.bb b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils_8.26.bb
index df6ad380f..52ef1013c 100644
--- a/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils_8.25.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/coreutils/coreutils_8.26.bb
@@ -20,12 +20,13 @@ SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz;name=tarball \
file://0001-Unset-need_charset_alias-when-building-for-musl.patch \
file://0001-uname-report-processor-and-hardware-correctly.patch \
file://disable-ls-output-quoting.patch \
+ file://0001-local.mk-fix-cross-compiling-problem.patch \
"
-SRC_URI[tarball.md5sum] = "070e43ba7f618d747414ef56ab248a48"
-SRC_URI[tarball.sha256sum] = "31e67c057a5b32a582f26408c789e11c2e8d676593324849dcf5779296cdce87"
-SRC_URI[manpages.md5sum] = "415cc0552bc4e480b27ce8b2aebfdeb5"
-SRC_URI[manpages.sha256sum] = "2ee31c3a6d2276f49c5515375d4a0c1047580da6ac10536898e0f0de81707f29"
+SRC_URI[tarball.md5sum] = "d5aa2072f662d4118b9f4c63b94601a6"
+SRC_URI[tarball.sha256sum] = "155e94d748f8e2bc327c66e0cbebdb8d6ab265d2f37c3c928f7bf6c3beba9a8e"
+SRC_URI[manpages.md5sum] = "b58107f532f7beffcb2f38e2ac1f2da3"
+SRC_URI[manpages.sha256sum] = "9324ec412ffca3b0431e6299720c33ac98e749e430f72a7c6e65f3635c86aa29"
EXTRA_OECONF_class-native = "--without-gmp"
EXTRA_OECONF_class-target = "--enable-install-program=arch --libexecdir=${libdir}"
@@ -34,8 +35,7 @@ EXTRA_OECONF_class-nativesdk = "--enable-install-program=arch"
# acl and xattr are not default features
#
PACKAGECONFIG_class-target ??= "\
- ${@bb.utils.contains('DISTRO_FEATURES', 'acl', 'acl', '', d)} \
- ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'xattr', '', d)} \
+ ${@bb.utils.filter('DISTRO_FEATURES', 'acl xattr', d)} \
"
# The lib/oe/path.py requires xattr
@@ -132,11 +132,11 @@ ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
ALTERNATIVE_LINK_NAME[stat.1] = "${mandir}/man1/stat.1"
python __anonymous() {
- for prog in d.getVar('base_bindir_progs', True).split():
- d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir', True), prog))
+ for prog in d.getVar('base_bindir_progs').split():
+ d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog))
- for prog in d.getVar('sbindir_progs', True).split():
- d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir', True), prog))
+ for prog in d.getVar('sbindir_progs').split():
+ d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir'), prog))
}
BBCLASSEXTEND = "native nativesdk"
diff --git a/import-layers/yocto-poky/meta/recipes-core/dbus/dbus-glib_0.106.bb b/import-layers/yocto-poky/meta/recipes-core/dbus/dbus-glib_0.106.bb
deleted file mode 100644
index 0ae848e40..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/dbus/dbus-glib_0.106.bb
+++ /dev/null
@@ -1,4 +0,0 @@
-require dbus-glib.inc
-
-SRC_URI[md5sum] = "2eea0b7f52b49f600a07abfd8535d4e4"
-SRC_URI[sha256sum] = "b38952706dcf68bad9c302999ef0f420b8cf1a2428227123f0ac4764b689c046"
diff --git a/import-layers/yocto-poky/meta/recipes-core/dbus/dbus-glib_0.108.bb b/import-layers/yocto-poky/meta/recipes-core/dbus/dbus-glib_0.108.bb
new file mode 100644
index 000000000..7a9a69e1e
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/dbus/dbus-glib_0.108.bb
@@ -0,0 +1,4 @@
+require dbus-glib.inc
+
+SRC_URI[md5sum] = "a66a613705870752ca9786e0359aea97"
+SRC_URI[sha256sum] = "9f340c7e2352e9cdf113893ca77ca9075d9f8d5e81476bf2bf361099383c602c"
diff --git a/import-layers/yocto-poky/meta/recipes-core/dbus/dbus-test_1.10.10.bb b/import-layers/yocto-poky/meta/recipes-core/dbus/dbus-test_1.10.14.bb
index 650b7ab02..539481472 100644
--- a/import-layers/yocto-poky/meta/recipes-core/dbus/dbus-test_1.10.10.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/dbus/dbus-test_1.10.14.bb
@@ -17,8 +17,8 @@ SRC_URI = "http://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \
file://clear-guid_from_server-if-send_negotiate_unix_f.patch \
"
-SRC_URI[md5sum] = "495676d240eb982921b3ad1343526849"
-SRC_URI[sha256sum] = "9d8f1d069ab4d1a0255d7b400ea3bcef4430c42e729b1012abb2890e3f739a43"
+SRC_URI[md5sum] = "3f7b013ce8f641cd4c897acda0ef3467"
+SRC_URI[sha256sum] = "23238f70353e38ce5ca183ebc9525c0d97ac00ef640ad29cf794782af6e6a083"
S="${WORKDIR}/dbus-${PV}"
FILESEXTRAPATHS =. "${FILE_DIRNAME}/dbus:"
diff --git a/import-layers/yocto-poky/meta/recipes-core/dbus/dbus_1.10.10.bb b/import-layers/yocto-poky/meta/recipes-core/dbus/dbus_1.10.14.bb
index 4db0b9b0b..e1d735630 100644
--- a/import-layers/yocto-poky/meta/recipes-core/dbus/dbus_1.10.10.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/dbus/dbus_1.10.14.bb
@@ -20,8 +20,8 @@ SRC_URI = "http://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \
file://0001-configure.ac-explicitely-check-stdint.h.patch \
"
-SRC_URI[md5sum] = "495676d240eb982921b3ad1343526849"
-SRC_URI[sha256sum] = "9d8f1d069ab4d1a0255d7b400ea3bcef4430c42e729b1012abb2890e3f739a43"
+SRC_URI[md5sum] = "3f7b013ce8f641cd4c897acda0ef3467"
+SRC_URI[sha256sum] = "23238f70353e38ce5ca183ebc9525c0d97ac00ef640ad29cf794782af6e6a083"
inherit useradd autotools pkgconfig gettext update-rc.d upstream-version-is-even
@@ -76,6 +76,7 @@ FILES_${PN}-lib = "${libdir}/lib*.so.*"
RRECOMMENDS_${PN}-lib = "${PN}"
FILES_${PN}-dev += "${libdir}/dbus-1.0/include ${bindir}/dbus-test-tool"
+PACKAGE_WRITE_DEPS += "${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','systemd-systemctl-native','',d)}"
pkg_postinst_dbus() {
# If both systemd and sysvinit are enabled, mask the dbus-1 init script
if ${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','true','false',d)}; then
@@ -94,19 +95,18 @@ EXTRA_OECONF = "--disable-tests \
--disable-xml-docs \
--disable-doxygen-docs \
--disable-libaudit \
+ --enable-largefile \
"
+EXTRA_OECONF_append_class-target = " SYSTEMCTL=${base_bindir}/systemctl"
EXTRA_OECONF_append_class-native = " --disable-selinux"
-PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
- ${@bb.utils.contains('DISTRO_FEATURES', 'largefile', 'largefile', '', d)} \
- ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd x11', d)}"
PACKAGECONFIG_class-native = ""
PACKAGECONFIG_class-nativesdk = ""
PACKAGECONFIG[systemd] = "--enable-systemd --with-systemdsystemunitdir=${systemd_system_unitdir},--disable-systemd --without-systemdsystemunitdir,systemd"
PACKAGECONFIG[x11] = "--with-x --enable-x11-autolaunch,--without-x --disable-x11-autolaunch, virtual/libx11 libsm"
-PACKAGECONFIG[largefile] = "--enable-largefile,--disable-largefile,,"
PACKAGECONFIG[user-session] = "--enable-user-session --with-systemduserunitdir=${systemd_user_unitdir},--disable-user-session"
do_install() {
@@ -122,7 +122,6 @@ do_install() {
for i in dbus.target.wants sockets.target.wants multi-user.target.wants; do \
install -d ${D}${systemd_system_unitdir}/$i; done
install -m 0644 ${B}/bus/dbus.service ${B}/bus/dbus.socket ${D}${systemd_system_unitdir}/
- cd ${D}${systemd_system_unitdir}/dbus.target.wants/
ln -fs ../dbus.socket ${D}${systemd_system_unitdir}/dbus.target.wants/dbus.socket
ln -fs ../dbus.socket ${D}${systemd_system_unitdir}/sockets.target.wants/dbus.socket
ln -fs ../dbus.service ${D}${systemd_system_unitdir}/multi-user.target.wants/dbus.service
diff --git a/import-layers/yocto-poky/meta/recipes-core/dropbear/dropbear.inc b/import-layers/yocto-poky/meta/recipes-core/dropbear/dropbear.inc
index bda7eb847..b6b436c58 100644
--- a/import-layers/yocto-poky/meta/recipes-core/dropbear/dropbear.inc
+++ b/import-layers/yocto-poky/meta/recipes-core/dropbear/dropbear.inc
@@ -8,7 +8,7 @@ LICENSE = "MIT & BSD-3-Clause & BSD-2-Clause & PD"
LIC_FILES_CHKSUM = "file://LICENSE;md5=a5ec40cafba26fc4396d0b550f824e01"
DEPENDS = "zlib"
-RPROVIDES_${PN} = "ssh sshd"
+RPROVIDES_${PN} = "ssh sshd"
DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
@@ -63,7 +63,7 @@ do_install() {
install -m 0755 dropbearmulti ${D}${sbindir}/
ln -s ${sbindir}/dropbearmulti ${D}${bindir}/dbclient
-
+
for i in ${SBINCOMMANDS}
do
ln -s ./dropbearmulti ${D}${sbindir}/$i
@@ -74,7 +74,7 @@ do_install() {
-e 's,/usr/bin,${bindir},g' \
-e 's,/usr,${prefix},g' ${WORKDIR}/init > ${D}${sysconfdir}/init.d/dropbear
chmod 755 ${D}${sysconfdir}/init.d/dropbear
- if [ "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" = "pam" ]; then
+ if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
install -d ${D}${sysconfdir}/pam.d
install -m 0644 ${WORKDIR}/dropbear ${D}${sysconfdir}/pam.d/
fi
diff --git a/import-layers/yocto-poky/meta/recipes-core/dropbear/dropbear/init b/import-layers/yocto-poky/meta/recipes-core/dropbear/dropbear/init
index 434bd6b97..f6e1c462f 100755
--- a/import-layers/yocto-poky/meta/recipes-core/dropbear/dropbear/init
+++ b/import-layers/yocto-poky/meta/recipes-core/dropbear/dropbear/init
@@ -40,49 +40,28 @@ done
if [ $readonly_rootfs = "1" ]; then
mkdir -p /var/lib/dropbear
DROPBEAR_RSAKEY_DEFAULT="/var/lib/dropbear/dropbear_rsa_host_key"
- DROPBEAR_DSSKEY_DEFAULT="/var/lib/dropbear/dropbear_dss_host_key"
else
DROPBEAR_RSAKEY_DEFAULT="/etc/dropbear/dropbear_rsa_host_key"
- DROPBEAR_DSSKEY_DEFAULT="/etc/dropbear/dropbear_dss_host_key"
fi
test -z "$DROPBEAR_BANNER" || \
DROPBEAR_EXTRA_ARGS="$DROPBEAR_EXTRA_ARGS -b $DROPBEAR_BANNER"
test -n "$DROPBEAR_RSAKEY" || \
DROPBEAR_RSAKEY=$DROPBEAR_RSAKEY_DEFAULT
-test -n "$DROPBEAR_DSSKEY" || \
- DROPBEAR_DSSKEY=$DROPBEAR_DSSKEY_DEFAULT
-test -n "$DROPBEAR_KEYTYPES" || \
- DROPBEAR_KEYTYPES="rsa"
gen_keys() {
-for t in $DROPBEAR_KEYTYPES; do
- case $t in
- rsa)
- if [ -f "$DROPBEAR_RSAKEY" -a ! -s "$DROPBEAR_RSAKEY" ]; then
- rm $DROPBEAR_RSAKEY || true
- fi
- test -f $DROPBEAR_RSAKEY || dropbearkey -t rsa -f $DROPBEAR_RSAKEY $DROPBEAR_RSAKEY_ARGS
- ;;
- dsa)
- if [ -f "$DROPBEAR_DSSKEY" -a ! -s "$DROPBEAR_DSSKEY" ]; then
- rm $DROPBEAR_DSSKEY || true
- fi
- test -f $DROPBEAR_DSSKEY || dropbearkey -t dss -f $DROPBEAR_DSSKEY $DROPBEAR_DSSKEY_ARGS
- ;;
- esac
-done
+ if [ -f "$DROPBEAR_RSAKEY" -a ! -s "$DROPBEAR_RSAKEY" ]; then
+ rm $DROPBEAR_RSAKEY || true
+ fi
+ test -f $DROPBEAR_RSAKEY || dropbearkey -t rsa -f $DROPBEAR_RSAKEY $DROPBEAR_RSAKEY_ARGS
}
case "$1" in
start)
echo -n "Starting $DESC: "
gen_keys
- KEY_ARGS=""
- test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
- test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY"
start-stop-daemon -S -p $PIDFILE \
- -x "$DAEMON" -- $KEY_ARGS \
+ -x "$DAEMON" -- -r $DROPBEAR_RSAKEY \
-p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
echo "$NAME."
;;
@@ -95,11 +74,8 @@ case "$1" in
echo -n "Restarting $DESC: "
start-stop-daemon -K -x "$DAEMON" -p $PIDFILE
sleep 1
- KEY_ARGS=""
- test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
- test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY"
start-stop-daemon -S -p $PIDFILE \
- -x "$DAEMON" -- $KEY_ARGS \
+ -x "$DAEMON" -- -r $DROPBEAR_RSAKEY \
-p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
echo "$NAME."
;;
diff --git a/import-layers/yocto-poky/meta/recipes-core/expat/expat.inc b/import-layers/yocto-poky/meta/recipes-core/expat/expat.inc
index fe9d7e74f..9fa0ca2eb 100644
--- a/import-layers/yocto-poky/meta/recipes-core/expat/expat.inc
+++ b/import-layers/yocto-poky/meta/recipes-core/expat/expat.inc
@@ -7,12 +7,12 @@ LICENSE = "MIT"
SRC_URI = "${SOURCEFORGE_MIRROR}/expat/expat-${PV}.tar.bz2 \
file://autotools.patch \
"
-
-inherit autotools lib_package gzipnative
+inherit autotools lib_package
# This package uses an archive format known to have issue with some
# versions of gzip
-do_unpack[depends] += "gzip-native:do_populate_sysroot"
+DEPENDS += "pigz-native"
+do_unpack[depends] += "pigz-native:do_populate_sysroot"
do_configure_prepend () {
rm -f ${S}/conftools/libtool.m4
diff --git a/import-layers/yocto-poky/meta/recipes-core/fts/fts.bb b/import-layers/yocto-poky/meta/recipes-core/fts/fts.bb
index 9d8230fa3..de9297ebe 100644
--- a/import-layers/yocto-poky/meta/recipes-core/fts/fts.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/fts/fts.bb
@@ -22,10 +22,7 @@ S = "${WORKDIR}/${BPN}"
do_configure[noexec] = "1"
-HASHSTYLE_mips = "sysv"
-HASHSTYLE_mipsel = "sysv"
-HASHSTYLE_mips64 = "sysv"
-HASHSTYLE_mips64el = "sysv"
+HASHSTYLE_mipsarch = "sysv"
HASHSTYLE = "gnu"
VER = "0"
diff --git a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/disable_java.patch b/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/disable_java.patch
deleted file mode 100644
index e4c5f1566..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/disable_java.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-
-# Pulled from OpenEmbedded
-#
-# Commented by: Saul Wold <saul.wold@intel.com>
-
-Upstream-Status: Inappropriate [licensing]
-
-Index: gettext-0.16.1/gettext-tools/configure.ac
-===================================================================
---- gettext-0.16.1.orig/gettext-tools/configure.ac 2006-11-27 09:02:01.000000000 -0800
-+++ gettext-0.16.1/gettext-tools/configure.ac 2011-03-16 16:55:36.111396557 -0700
-@@ -36,27 +36,15 @@
- gt_JAVA_CHOICE
-
- gt_GCJ
--if test -n "$HAVE_GCJ" && test "$JAVA_CHOICE" = yes; then
-- BUILDJAVAEXE=yes
--else
- BUILDJAVAEXE=no
--fi
- AC_SUBST(BUILDJAVAEXE)
-
- gt_JAVAEXEC
- gt_JAVACOMP([1.3])
- AC_CHECK_PROG(JAR, jar, jar)
--if test -n "$HAVE_JAVACOMP" && test -n "$JAR" && test "$JAVA_CHOICE" != no; then
-- BUILDJAVA=yes
--else
- BUILDJAVA=no
--fi
- AC_SUBST(BUILDJAVA)
--if test -n "$HAVE_JAVAEXEC" && test $BUILDJAVA = yes; then
-- TESTJAVA=yes
--else
- TESTJAVA=no
--fi
- AC_SUBST(TESTJAVA)
-
- gt_CSHARPCOMP
diff --git a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/fix_aclocal_version.patch b/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/fix_aclocal_version.patch
deleted file mode 100644
index 49a10f5b1..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/fix_aclocal_version.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-
-This patch updates the required version number from 2.61 to the
-current 2.65 version of aclocal, this will need to be updated
-when we update aclocal
-
-Upstream-Status: Inappropriate [configuration]
-
-Signed-off-by: Saul Wold <sgw@linux.intel.com>
-
-Index: gettext-0.16.1/autoconf-lib-link/m4/lib-link.m4
-===================================================================
---- gettext-0.16.1.orig/autoconf-lib-link/m4/lib-link.m4 2011-03-17 02:24:36.391519775 -0700
-+++ gettext-0.16.1/autoconf-lib-link/m4/lib-link.m4 2011-03-17 02:24:45.569526073 -0700
-@@ -148,7 +148,7 @@
- define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
- dnl Autoconf >= 2.61 supports dots in --with options.
-- define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit([$1],[.],[_])],[$1])])
-+ define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.65]),[-1],[translit([$1],[.],[_])],[$1])])
- dnl By default, look in $includedir and $libdir.
- use_additional=yes
- AC_LIB_WITH_FINAL_PREFIX([
-Index: gettext-0.16.1/autoconf-lib-link/tests/rpathly/aclocal.m4
-===================================================================
---- gettext-0.16.1.orig/autoconf-lib-link/tests/rpathly/aclocal.m4 2011-03-17 02:24:36.391519775 -0700
-+++ gettext-0.16.1/autoconf-lib-link/tests/rpathly/aclocal.m4 2011-03-17 02:24:45.570526904 -0700
-@@ -11,8 +11,8 @@
- # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- # PARTICULAR PURPOSE.
-
--m4_if(m4_PACKAGE_VERSION, [2.61],,
--[m4_fatal([this file was generated for autoconf 2.61.
-+m4_if(m4_PACKAGE_VERSION, [2.65],,
-+[m4_fatal([this file was generated for autoconf 2.65.
- You have another version of autoconf. If you want to use that,
- you should regenerate the build system entirely.], [63])])
-
-Index: gettext-0.16.1/autoconf-lib-link/tests/rpathx/aclocal.m4
-===================================================================
---- gettext-0.16.1.orig/autoconf-lib-link/tests/rpathx/aclocal.m4 2011-03-17 02:24:36.391519775 -0700
-+++ gettext-0.16.1/autoconf-lib-link/tests/rpathx/aclocal.m4 2011-03-17 02:24:45.572525773 -0700
-@@ -11,8 +11,8 @@
- # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- # PARTICULAR PURPOSE.
-
--m4_if(m4_PACKAGE_VERSION, [2.61],,
--[m4_fatal([this file was generated for autoconf 2.61.
-+m4_if(m4_PACKAGE_VERSION, [2.65],,
-+[m4_fatal([this file was generated for autoconf 2.65.
- You have another version of autoconf. If you want to use that,
- you should regenerate the build system entirely.], [63])])
-
-Index: gettext-0.16.1/autoconf-lib-link/tests/rpathy/aclocal.m4
-===================================================================
---- gettext-0.16.1.orig/autoconf-lib-link/tests/rpathy/aclocal.m4 2011-03-17 02:24:36.391519775 -0700
-+++ gettext-0.16.1/autoconf-lib-link/tests/rpathy/aclocal.m4 2011-03-17 02:24:45.578394916 -0700
-@@ -11,7 +11,7 @@
- # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- # PARTICULAR PURPOSE.
-
--m4_if(m4_PACKAGE_VERSION, [2.61],,
-+m4_if(m4_PACKAGE_VERSION, [2.65],,
- [m4_fatal([this file was generated for autoconf 2.61.
- You have another version of autoconf. If you want to use that,
- you should regenerate the build system entirely.], [63])])
-Index: gettext-0.16.1/autoconf-lib-link/tests/rpathz/aclocal.m4
-===================================================================
---- gettext-0.16.1.orig/autoconf-lib-link/tests/rpathz/aclocal.m4 2011-03-17 02:24:36.391519775 -0700
-+++ gettext-0.16.1/autoconf-lib-link/tests/rpathz/aclocal.m4 2011-03-17 02:24:45.586395416 -0700
-@@ -11,8 +11,8 @@
- # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- # PARTICULAR PURPOSE.
-
--m4_if(m4_PACKAGE_VERSION, [2.61],,
--[m4_fatal([this file was generated for autoconf 2.61.
-+m4_if(m4_PACKAGE_VERSION, [2.65],,
-+[m4_fatal([this file was generated for autoconf 2.65.
- You have another version of autoconf. If you want to use that,
- you should regenerate the build system entirely.], [63])])
-
-Index: gettext-0.16.1/gettext-tools/aclocal.m4
-===================================================================
---- gettext-0.16.1.orig/gettext-tools/aclocal.m4 2006-11-27 09:34:32.000000000 -0800
-+++ gettext-0.16.1/gettext-tools/aclocal.m4 2011-03-17 02:27:01.135682807 -0700
-@@ -11,8 +11,8 @@
- # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- # PARTICULAR PURPOSE.
-
--m4_if(m4_PACKAGE_VERSION, [2.61],,
--[m4_fatal([this file was generated for autoconf 2.61.
-+m4_if(m4_PACKAGE_VERSION, [2.65],,
-+[m4_fatal([this file was generated for autoconf 2.65.
- You have another version of autoconf. If you want to use that,
- you should regenerate the build system entirely.], [63])])
-
-Index: gettext-0.16.1/gettext-tools/examples/aclocal.m4
-===================================================================
---- gettext-0.16.1.orig/gettext-tools/examples/aclocal.m4 2006-11-27 09:16:23.000000000 -0800
-+++ gettext-0.16.1/gettext-tools/examples/aclocal.m4 2011-03-17 02:26:52.589396683 -0700
-@@ -11,8 +11,8 @@
- # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- # PARTICULAR PURPOSE.
-
--m4_if(m4_PACKAGE_VERSION, [2.61],,
--[m4_fatal([this file was generated for autoconf 2.61.
-+m4_if(m4_PACKAGE_VERSION, [2.65],,
-+[m4_fatal([this file was generated for autoconf 2.65.
- You have another version of autoconf. If you want to use that,
- you should regenerate the build system entirely.], [63])])
-
diff --git a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/fix_gnu_source_circular.patch b/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/fix_gnu_source_circular.patch
deleted file mode 100644
index fd5feebc8..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/fix_gnu_source_circular.patch
+++ /dev/null
@@ -1,348 +0,0 @@
-
-This patch removes the circular dependency on AC_GNU_SOURCE in
-AC_USE_SYSTEM_EXTENSIONS.
-
-Thanks to Mark Hatle for the timely pointers and fixes.
-
-Upstream-Status: Inappropriate [licensing]
-
-Signed-off-by: Saul Wold <sgw@linux.intel.com>
-
-diff -ru gettext-0.16.1/gettext-runtime/gnulib-m4/extensions.m4 gettext.patched/gettext-runtime/gnulib-m4/extensions.m4
---- gettext-0.16.1/gettext-runtime/gnulib-m4/extensions.m4 2006-11-27 09:14:38.000000000 -0800
-+++ gettext.patched/gettext-runtime/gnulib-m4/extensions.m4 2011-03-16 23:54:01.711923448 -0700
-@@ -16,43 +16,47 @@
- # ------------------------
- # Enable extensions on systems that normally disable them,
- # typically due to standards-conformance issues.
--AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
--[
-- AC_BEFORE([$0], [AC_COMPILE_IFELSE])
-- AC_BEFORE([$0], [AC_RUN_IFELSE])
--
-- AC_REQUIRE([AC_GNU_SOURCE])
-- AC_REQUIRE([AC_AIX])
-- AC_REQUIRE([AC_MINIX])
--
-- AH_VERBATIM([__EXTENSIONS__],
--[/* Enable extensions on Solaris. */
--#ifndef __EXTENSIONS__
--# undef __EXTENSIONS__
--#endif
--#ifndef _POSIX_PTHREAD_SEMANTICS
--# undef _POSIX_PTHREAD_SEMANTICS
--#endif
--#ifndef _TANDEM_SOURCE
--# undef _TANDEM_SOURCE
--#endif])
-- AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
-- [ac_cv_safe_to_define___extensions__],
-- [AC_COMPILE_IFELSE(
-- [AC_LANG_PROGRAM([
--# define __EXTENSIONS__ 1
-- AC_INCLUDES_DEFAULT])],
-- [ac_cv_safe_to_define___extensions__=yes],
-- [ac_cv_safe_to_define___extensions__=no])])
-- test $ac_cv_safe_to_define___extensions__ = yes &&
-- AC_DEFINE([__EXTENSIONS__])
-- AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
-- AC_DEFINE([_TANDEM_SOURCE])
--])
-+#AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
-+#[
-+# AC_BEFORE([$0], [AC_COMPILE_IFELSE])
-+# AC_BEFORE([$0], [AC_RUN_IFELSE])
-+#
-+# AC_REQUIRE([AC_GNU_SOURCE])
-+# AC_REQUIRE([AC_AIX])
-+# AC_REQUIRE([AC_MINIX])
-+#
-+# AH_VERBATIM([__EXTENSIONS__],
-+#[/* Enable extensions on Solaris. */
-+##ifndef __EXTENSIONS__
-+## undef __EXTENSIONS__
-+##endif
-+##ifndef _POSIX_PTHREAD_SEMANTICS
-+## undef _POSIX_PTHREAD_SEMANTICS
-+##endif
-+##ifndef _TANDEM_SOURCE
-+## undef _TANDEM_SOURCE
-+##endif])
-+# AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
-+# [ac_cv_safe_to_define___extensions__],
-+# [AC_COMPILE_IFELSE(
-+# [AC_LANG_PROGRAM([
-+## define __EXTENSIONS__ 1
-+# AC_INCLUDES_DEFAULT])],
-+# [ac_cv_safe_to_define___extensions__=yes],
-+# [ac_cv_safe_to_define___extensions__=no])])
-+# test $ac_cv_safe_to_define___extensions__ = yes &&
-+# AC_DEFINE([__EXTENSIONS__])
-+# AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
-+# AC_DEFINE([_TANDEM_SOURCE])
-+#])
-
- # gl_USE_SYSTEM_EXTENSIONS
- # ------------------------
- # Enable extensions on systems that normally disable them,
- # typically due to standards-conformance issues.
- AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
-- [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])
-+[
-+ AC_REQUIRE([AC_GNU_SOURCE])
-+
-+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-+])
-diff -ru gettext-0.16.1/gettext-runtime/gnulib-m4/gnulib-comp.m4 gettext.patched/gettext-runtime/gnulib-m4/gnulib-comp.m4
---- gettext-0.16.1/gettext-runtime/gnulib-m4/gnulib-comp.m4 2006-11-27 09:33:19.000000000 -0800
-+++ gettext.patched/gettext-runtime/gnulib-m4/gnulib-comp.m4 2011-03-16 23:50:17.471531838 -0700
-@@ -25,7 +25,7 @@
- m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
- m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
- AC_REQUIRE([AC_PROG_RANLIB])
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- ])
-
-diff -ru gettext-0.16.1/gettext-runtime/gnulib-m4/mbchar.m4 gettext.patched/gettext-runtime/gnulib-m4/mbchar.m4
---- gettext-0.16.1/gettext-runtime/gnulib-m4/mbchar.m4 2006-11-27 09:14:38.000000000 -0800
-+++ gettext.patched/gettext-runtime/gnulib-m4/mbchar.m4 2011-03-16 23:50:10.814396529 -0700
-@@ -9,7 +9,7 @@
-
- AC_DEFUN([gl_MBCHAR],
- [
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
- dnl The following line is that so the user can test HAVE_WCHAR_H
- dnl before #include "mbchar.h".
- AC_CHECK_HEADERS_ONCE([wchar.h])
-diff -ru gettext-0.16.1/gettext-runtime/gnulib-m4/wcwidth.m4 gettext.patched/gettext-runtime/gnulib-m4/wcwidth.m4
---- gettext-0.16.1/gettext-runtime/gnulib-m4/wcwidth.m4 2006-11-27 09:14:38.000000000 -0800
-+++ gettext.patched/gettext-runtime/gnulib-m4/wcwidth.m4 2011-03-16 23:50:08.357396247 -0700
-@@ -7,7 +7,7 @@
- AC_DEFUN([gl_FUNC_WCWIDTH],
- [
- dnl Persuade glibc <wchar.h> to declare wcwidth().
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
-
- AC_REQUIRE([AC_C_INLINE])
- AC_REQUIRE([gt_TYPE_WCHAR_T])
-diff -ru gettext-0.16.1/gettext-runtime/m4/lock.m4 gettext.patched/gettext-runtime/m4/lock.m4
---- gettext-0.16.1/gettext-runtime/m4/lock.m4 2006-10-24 13:59:59.000000000 -0700
-+++ gettext.patched/gettext-runtime/m4/lock.m4 2011-03-16 23:50:04.355891676 -0700
-@@ -35,7 +35,7 @@
- AC_BEFORE([$0], [gl_ARGP])dnl
-
- AC_REQUIRE([AC_CANONICAL_HOST])
-- AC_REQUIRE([AC_GNU_SOURCE]) dnl needed for pthread_rwlock_t on glibc systems
-+ dnl AC_REQUIRE([AC_GNU_SOURCE]) dnl needed for pthread_rwlock_t on glibc systems
- dnl Check for multithreading.
- AC_ARG_ENABLE(threads,
- AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API])
-diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/extensions.m4 gettext.patched/gettext-tools/gnulib-m4/extensions.m4
---- gettext-0.16.1/gettext-tools/gnulib-m4/extensions.m4 2006-11-27 09:14:54.000000000 -0800
-+++ gettext.patched/gettext-tools/gnulib-m4/extensions.m4 2011-03-16 23:53:28.487671266 -0700
-@@ -16,43 +16,47 @@
- # ------------------------
- # Enable extensions on systems that normally disable them,
- # typically due to standards-conformance issues.
--AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
--[
-- AC_BEFORE([$0], [AC_COMPILE_IFELSE])
-- AC_BEFORE([$0], [AC_RUN_IFELSE])
--
-- AC_REQUIRE([AC_GNU_SOURCE])
-- AC_REQUIRE([AC_AIX])
-- AC_REQUIRE([AC_MINIX])
--
-- AH_VERBATIM([__EXTENSIONS__],
--[/* Enable extensions on Solaris. */
--#ifndef __EXTENSIONS__
--# undef __EXTENSIONS__
--#endif
--#ifndef _POSIX_PTHREAD_SEMANTICS
--# undef _POSIX_PTHREAD_SEMANTICS
--#endif
--#ifndef _TANDEM_SOURCE
--# undef _TANDEM_SOURCE
--#endif])
-- AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
-- [ac_cv_safe_to_define___extensions__],
-- [AC_COMPILE_IFELSE(
-- [AC_LANG_PROGRAM([
--# define __EXTENSIONS__ 1
-- AC_INCLUDES_DEFAULT])],
-- [ac_cv_safe_to_define___extensions__=yes],
-- [ac_cv_safe_to_define___extensions__=no])])
-- test $ac_cv_safe_to_define___extensions__ = yes &&
-- AC_DEFINE([__EXTENSIONS__])
-- AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
-- AC_DEFINE([_TANDEM_SOURCE])
--])
-+#AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
-+#[
-+# AC_BEFORE([$0], [AC_COMPILE_IFELSE])
-+# AC_BEFORE([$0], [AC_RUN_IFELSE])
-+#
-+# AC_REQUIRE([AC_GNU_SOURCE])
-+# AC_REQUIRE([AC_AIX])
-+# AC_REQUIRE([AC_MINIX])
-+#
-+# AH_VERBATIM([__EXTENSIONS__],
-+#[/* Enable extensions on Solaris. */
-+##ifndef __EXTENSIONS__
-+## undef __EXTENSIONS__
-+##endif
-+##ifndef _POSIX_PTHREAD_SEMANTICS
-+## undef _POSIX_PTHREAD_SEMANTICS
-+##endif
-+##ifndef _TANDEM_SOURCE
-+## undef _TANDEM_SOURCE
-+##endif])
-+# AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
-+# [ac_cv_safe_to_define___extensions__],
-+# [AC_COMPILE_IFELSE(
-+# [AC_LANG_PROGRAM([
-+## define __EXTENSIONS__ 1
-+# AC_INCLUDES_DEFAULT])],
-+# [ac_cv_safe_to_define___extensions__=yes],
-+# [ac_cv_safe_to_define___extensions__=no])])
-+# test $ac_cv_safe_to_define___extensions__ = yes &&
-+# AC_DEFINE([__EXTENSIONS__])
-+# AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
-+# AC_DEFINE([_TANDEM_SOURCE])
-+#])
-
- # gl_USE_SYSTEM_EXTENSIONS
- # ------------------------
- # Enable extensions on systems that normally disable them,
- # typically due to standards-conformance issues.
- AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
-- [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])
-+[
-+ AC_REQUIRE([AC_GNU_SOURCE])
-+
-+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-+])
-diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/fnmatch.m4 gettext.patched/gettext-tools/gnulib-m4/fnmatch.m4
---- gettext-0.16.1/gettext-tools/gnulib-m4/fnmatch.m4 2006-11-27 09:14:54.000000000 -0800
-+++ gettext.patched/gettext-tools/gnulib-m4/fnmatch.m4 2011-03-16 23:52:06.477463671 -0700
-@@ -91,7 +91,7 @@
- AC_DEFUN([gl_FUNC_FNMATCH_GNU],
- [
- dnl Persuade glibc <fnmatch.h> to declare FNM_CASEFOLD etc.
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
-
- FNMATCH_H=
- _AC_FUNC_FNMATCH_IF([GNU], [ac_cv_func_fnmatch_gnu],
-diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/getdelim.m4 gettext.patched/gettext-tools/gnulib-m4/getdelim.m4
---- gettext-0.16.1/gettext-tools/gnulib-m4/getdelim.m4 2006-11-27 09:14:54.000000000 -0800
-+++ gettext.patched/gettext-tools/gnulib-m4/getdelim.m4 2011-03-16 23:52:22.871674845 -0700
-@@ -12,7 +12,7 @@
- [
-
- dnl Persuade glibc <stdio.h> to declare getdelim().
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
-
- AC_REPLACE_FUNCS(getdelim)
- AC_CHECK_DECLS_ONCE(getdelim)
-diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/getline.m4 gettext.patched/gettext-tools/gnulib-m4/getline.m4
---- gettext-0.16.1/gettext-tools/gnulib-m4/getline.m4 2006-11-27 09:14:54.000000000 -0800
-+++ gettext.patched/gettext-tools/gnulib-m4/getline.m4 2011-03-16 23:51:49.829971108 -0700
-@@ -16,7 +16,7 @@
- AC_DEFUN([gl_FUNC_GETLINE],
- [
- dnl Persuade glibc <stdio.h> to declare getline().
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
-
- AC_CHECK_DECLS([getline])
-
-diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/gnulib-comp.m4 gettext.patched/gettext-tools/gnulib-m4/gnulib-comp.m4
---- gettext-0.16.1/gettext-tools/gnulib-m4/gnulib-comp.m4 2006-11-27 09:33:36.000000000 -0800
-+++ gettext.patched/gettext-tools/gnulib-m4/gnulib-comp.m4 2011-03-16 23:52:18.970450488 -0700
-@@ -25,7 +25,7 @@
- m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
- m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
- AC_REQUIRE([AC_PROG_RANLIB])
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_REQUIRE([gl_LOCK_EARLY])
- ])
-diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/mbchar.m4 gettext.patched/gettext-tools/gnulib-m4/mbchar.m4
---- gettext-0.16.1/gettext-tools/gnulib-m4/mbchar.m4 2006-11-27 09:14:55.000000000 -0800
-+++ gettext.patched/gettext-tools/gnulib-m4/mbchar.m4 2011-03-16 23:51:40.844410216 -0700
-@@ -9,7 +9,7 @@
-
- AC_DEFUN([gl_MBCHAR],
- [
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
- dnl The following line is that so the user can test HAVE_WCHAR_H
- dnl before #include "mbchar.h".
- AC_CHECK_HEADERS_ONCE([wchar.h])
-diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/stpcpy.m4 gettext.patched/gettext-tools/gnulib-m4/stpcpy.m4
---- gettext-0.16.1/gettext-tools/gnulib-m4/stpcpy.m4 2006-11-27 09:14:55.000000000 -0800
-+++ gettext.patched/gettext-tools/gnulib-m4/stpcpy.m4 2011-03-16 23:52:14.691396045 -0700
-@@ -7,7 +7,7 @@
- AC_DEFUN([gl_FUNC_STPCPY],
- [
- dnl Persuade glibc <string.h> to declare stpcpy().
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
-
- AC_REPLACE_FUNCS(stpcpy)
- if test $ac_cv_func_stpcpy = no; then
-diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/stpncpy.m4 gettext.patched/gettext-tools/gnulib-m4/stpncpy.m4
---- gettext-0.16.1/gettext-tools/gnulib-m4/stpncpy.m4 2006-11-27 09:14:55.000000000 -0800
-+++ gettext.patched/gettext-tools/gnulib-m4/stpncpy.m4 2011-03-16 23:52:10.356641459 -0700
-@@ -7,7 +7,7 @@
- AC_DEFUN([gl_FUNC_STPNCPY],
- [
- dnl Persuade glibc <string.h> to declare stpncpy().
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
-
- dnl Both glibc and AIX (4.3.3, 5.1) have an stpncpy() function
- dnl declared in <string.h>. Its side effects are the same as those
-diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/wcwidth.m4 gettext.patched/gettext-tools/gnulib-m4/wcwidth.m4
---- gettext-0.16.1/gettext-tools/gnulib-m4/wcwidth.m4 2006-11-27 09:14:55.000000000 -0800
-+++ gettext.patched/gettext-tools/gnulib-m4/wcwidth.m4 2011-03-16 23:51:08.260324221 -0700
-@@ -7,7 +7,7 @@
- AC_DEFUN([gl_FUNC_WCWIDTH],
- [
- dnl Persuade glibc <wchar.h> to declare wcwidth().
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
-
- AC_REQUIRE([AC_C_INLINE])
- AC_REQUIRE([gt_TYPE_WCHAR_T])
-diff -ru gettext-0.16.1/gettext-tools/libgettextpo/gnulib-m4/gnulib-comp.m4 gettext.patched/gettext-tools/libgettextpo/gnulib-m4/gnulib-comp.m4
---- gettext-0.16.1/gettext-tools/libgettextpo/gnulib-m4/gnulib-comp.m4 2006-11-27 09:33:45.000000000 -0800
-+++ gettext.patched/gettext-tools/libgettextpo/gnulib-m4/gnulib-comp.m4 2011-03-16 23:51:02.036061317 -0700
-@@ -25,7 +25,7 @@
- m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
- m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
- AC_REQUIRE([AC_PROG_RANLIB])
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_REQUIRE([gl_LOCK_EARLY])
- ])
-diff -ru gettext-0.16.1/gettext-tools/m4/regex.m4 gettext.patched/gettext-tools/m4/regex.m4
---- gettext-0.16.1/gettext-tools/m4/regex.m4 2006-11-27 09:02:05.000000000 -0800
-+++ gettext.patched/gettext-tools/m4/regex.m4 2011-03-16 23:50:53.533477195 -0700
-@@ -116,7 +116,7 @@
- dnl to get them.
-
- dnl Persuade glibc <string.h> to declare mempcpy().
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
-
- AC_REQUIRE([AC_C_RESTRICT])
- AC_REQUIRE([AC_FUNC_ALLOCA])
diff --git a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/gettext-autoconf-lib-link-no-L.patch b/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/gettext-autoconf-lib-link-no-L.patch
deleted file mode 100644
index 072fe5ff6..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/gettext-autoconf-lib-link-no-L.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-
-# Pulled from OpenEmbedded
-#
-# Commented by: Saul Wold <saul.wold@intel.com>
-
-Upstream-Status: Inappropriate [licensing]
-
---- gettext-0.17/autoconf-lib-link/m4/lib-link.m4~ 2009-04-17 15:12:30.000000000 -0700
-+++ gettext-0.17/autoconf-lib-link/m4/lib-link.m4 2009-04-17 15:37:39.000000000 -0700
-@@ -267,6 +267,9 @@
- fi
- fi
- fi
-+ dnl Just let the compiler find the library, the compiler and user are smarter then this script
-+ dnl when cross compiling and working with a relocated install.
-+ found_dir=""
- if test "X$found_dir" = "X"; then
- for x in $LDFLAGS $LTLIB[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
diff --git a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/gettext-vpath.patch b/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/gettext-vpath.patch
deleted file mode 100644
index f09e450ef..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/gettext-vpath.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-
-# Pulled from OpenEmbedded
-#
-# Commented by: Saul Wold <saul.wold@intel.com>
-
-Upstream-Status: Inappropriate [licensing]
-
-Index: gettext-0.16.1/gettext-runtime/intl/Makefile.in
-===================================================================
---- gettext-0.16.1.orig/gettext-runtime/intl/Makefile.in 2006-11-27 09:02:00.000000000 -0800
-+++ gettext-0.16.1/gettext-runtime/intl/Makefile.in 2011-03-16 16:04:49.175419930 -0700
-@@ -35,7 +35,7 @@
- # 'make' does the wrong thing if GNU gettext was configured with
- # "./configure --srcdir=`pwd`", namely it gets confused by the .lo and .la
- # files it finds in srcdir = ../../gettext-runtime/intl.
--VPATH = $(srcdir)
-+#VPATH = $(srcdir)
-
- prefix = @prefix@
- exec_prefix = @exec_prefix@
diff --git a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/hardcode_macro_version.patch b/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/hardcode_macro_version.patch
deleted file mode 100644
index 4da8dd453..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/hardcode_macro_version.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-
-This patch hardcodes in version 0.17 for the GETTEXT_MACRO_VERSION,
-the version check is only part of 0.17 and will not affect any 0.16.1
-operations
-
-Upstream-Status: Inappropriate [licensing]
-
-Signed-off-by: Saul Wold <sgw@linux.intel.com>
-
-Index: gettext-0.16.1/gettext-runtime/m4/po.m4
-===================================================================
---- gettext-0.16.1.orig/gettext-runtime/m4/po.m4 2011-03-17 02:24:28.953520231 -0700
-+++ gettext-0.16.1/gettext-runtime/m4/po.m4 2011-03-17 02:28:25.455396862 -0700
-@@ -27,6 +27,9 @@
- AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
- AC_REQUIRE([AM_NLS])dnl
-
-+ dnl Hardcode the MACRO_VERSION to 0.17 for gnutls
-+ AC_SUBST([GETTEXT_MACRO_VERSION], [0.17])
-+
- dnl Perform the following tests also if --disable-nls has been given,
- dnl because they are needed for "make dist" to work.
-
-Index: gettext-0.16.1/gettext-runtime/po/Makefile.in.in
-===================================================================
---- gettext-0.16.1.orig/gettext-runtime/po/Makefile.in.in 2011-03-17 02:24:28.953520231 -0700
-+++ gettext-0.16.1/gettext-runtime/po/Makefile.in.in 2011-03-17 02:28:07.574395144 -0700
-@@ -10,6 +10,9 @@
- #
- # Origin: gettext-0.16
-
-+# Hardcode this value for gnutls building against gplv2 code
-+GETTEXT_MACRO_VERSION = 0.17
-+
- PACKAGE = @PACKAGE@
- VERSION = @VERSION@
- PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-Index: gettext-0.16.1/gettext-tools/po/Makefile.in.in
-===================================================================
---- gettext-0.16.1.orig/gettext-tools/po/Makefile.in.in 2011-03-17 02:24:28.953520231 -0700
-+++ gettext-0.16.1/gettext-tools/po/Makefile.in.in 2011-03-17 02:28:07.574395144 -0700
-@@ -10,6 +10,9 @@
- #
- # Origin: gettext-0.16
-
-+# Hardcode this value for gnutls building against gplv2 code
-+GETTEXT_MACRO_VERSION = 0.17
-+
- PACKAGE = @PACKAGE@
- VERSION = @VERSION@
- PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
diff --git a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/linklib_from_0.17.patch b/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/linklib_from_0.17.patch
deleted file mode 100644
index d92106971..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.16.1/linklib_from_0.17.patch
+++ /dev/null
@@ -1,720 +0,0 @@
-
-# Pulled from OpenEmbedded
-#
-# Commented by: Saul Wold <saul.wold@intel.com>
-
-Upstream-Status: Inappropriate [licensing]
-
-Index: gettext-0.16.1/autoconf-lib-link/m4/lib-link.m4
-===================================================================
---- gettext-0.16.1.orig/autoconf-lib-link/m4/lib-link.m4 2006-11-27 09:01:58.000000000 -0800
-+++ gettext-0.16.1/autoconf-lib-link/m4/lib-link.m4 2011-03-17 00:36:08.710836720 -0700
-@@ -6,12 +6,14 @@
-
- dnl From Bruno Haible.
-
--AC_PREREQ(2.50)
-+AC_PREREQ(2.54)
-
- dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
- dnl the libraries corresponding to explicit and implicit dependencies.
- dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
- dnl augments the CPPFLAGS variable.
-+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
-+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
- AC_DEFUN([AC_LIB_LINKFLAGS],
- [
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
-@@ -24,13 +26,16 @@
- ac_cv_lib[]Name[]_libs="$LIB[]NAME"
- ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
- ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
-+ ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
- ])
- LIB[]NAME="$ac_cv_lib[]Name[]_libs"
- LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
- INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
-+ LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
- AC_SUBST([LIB]NAME)
- AC_SUBST([LTLIB]NAME)
-+ AC_SUBST([LIB]NAME[_PREFIX])
- dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
- dnl results of this search when this library appears as a dependency.
- HAVE_LIB[]NAME=yes
-@@ -46,6 +51,8 @@
- dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
- dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
- dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
-+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
-+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
- AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
- [
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
-@@ -82,17 +89,24 @@
- CPPFLAGS="$ac_save_CPPFLAGS"
- LIB[]NAME=
- LTLIB[]NAME=
-+ LIB[]NAME[]_PREFIX=
-+
- fi
- AC_SUBST([HAVE_LIB]NAME)
- AC_SUBST([LIB]NAME)
- AC_SUBST([LTLIB]NAME)
-+ AC_SUBST([LIB]NAME[_PREFIX])
- undefine([Name])
- undefine([NAME])
- ])
-
- dnl Determine the platform dependent parameters needed to use rpath:
--dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
--dnl hardcode_direct, hardcode_minus_L.
-+dnl acl_libext,
-+dnl acl_shlibext,
-+dnl acl_hardcode_libdir_flag_spec,
-+dnl acl_hardcode_libdir_separator,
-+dnl acl_hardcode_direct,
-+dnl acl_hardcode_minus_L.
- AC_DEFUN([AC_LIB_RPATH],
- [
- dnl Tell automake >= 1.10 to complain if config.rpath is missing.
-@@ -109,12 +123,14 @@
- acl_cv_rpath=done
- ])
- wl="$acl_cv_wl"
-- libext="$acl_cv_libext"
-- shlibext="$acl_cv_shlibext"
-- hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
-- hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
-- hardcode_direct="$acl_cv_hardcode_direct"
-- hardcode_minus_L="$acl_cv_hardcode_minus_L"
-+ acl_libext="$acl_cv_libext"
-+ acl_shlibext="$acl_cv_shlibext"
-+ acl_libname_spec="$acl_cv_libname_spec"
-+ acl_library_names_spec="$acl_cv_library_names_spec"
-+ acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
-+ acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
-+ acl_hardcode_direct="$acl_cv_hardcode_direct"
-+ acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
- dnl Determine whether the user wants rpath handling at all.
- AC_ARG_ENABLE(rpath,
- [ --disable-rpath do not hardcode runtime library paths],
-@@ -124,20 +140,24 @@
- dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
- dnl the libraries corresponding to explicit and implicit dependencies.
- dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
-+dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
-+dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
- AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
- [
- AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
- define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
-+ dnl Autoconf >= 2.61 supports dots in --with options.
-+ define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit([$1],[.],[_])],[$1])])
- dnl By default, look in $includedir and $libdir.
- use_additional=yes
- AC_LIB_WITH_FINAL_PREFIX([
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- ])
-- AC_LIB_ARG_WITH([lib$1-prefix],
--[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
-- --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
-+ AC_LIB_ARG_WITH([lib]N_A_M_E[-prefix],
-+[ --with-lib]N_A_M_E[-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
-+ --without-lib]N_A_M_E[-prefix don't search for lib$1 in includedir and libdir],
- [
- if test "X$withval" = "Xno"; then
- use_additional=no
-@@ -158,6 +178,7 @@
- LIB[]NAME=
- LTLIB[]NAME=
- INC[]NAME=
-+ LIB[]NAME[]_PREFIX=
- rpathdirs=
- ltrpathdirs=
- names_already_handled=
-@@ -197,27 +218,53 @@
- found_la=
- found_so=
- found_a=
-+ eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
-+ if test -n "$acl_shlibext"; then
-+ shrext=".$acl_shlibext" # typically: shrext=.so
-+ else
-+ shrext=
-+ fi
- if test $use_additional = yes; then
-- if test -n "$shlibext" \
-- && { test -f "$additional_libdir/lib$name.$shlibext" \
-- || { test "$shlibext" = dll \
-- && test -f "$additional_libdir/lib$name.dll.a"; }; }; then
-- found_dir="$additional_libdir"
-- if test -f "$additional_libdir/lib$name.$shlibext"; then
-- found_so="$additional_libdir/lib$name.$shlibext"
-+ dir="$additional_libdir"
-+ dnl The same code as in the loop below:
-+ dnl First look for a shared library.
-+ if test -n "$acl_shlibext"; then
-+ if test -f "$dir/$libname$shrext"; then
-+ found_dir="$dir"
-+ found_so="$dir/$libname$shrext"
- else
-- found_so="$additional_libdir/lib$name.dll.a"
-+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
-+ ver=`(cd "$dir" && \
-+ for f in "$libname$shrext".*; do echo "$f"; done \
-+ | sed -e "s,^$libname$shrext\\\\.,," \
-+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
-+ | sed 1q ) 2>/dev/null`
-+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
-+ found_dir="$dir"
-+ found_so="$dir/$libname$shrext.$ver"
-+ fi
-+ else
-+ eval library_names=\"$acl_library_names_spec\"
-+ for f in $library_names; do
-+ if test -f "$dir/$f"; then
-+ found_dir="$dir"
-+ found_so="$dir/$f"
-+ break
-+ fi
-+ done
-+ fi
- fi
-- if test -f "$additional_libdir/lib$name.la"; then
-- found_la="$additional_libdir/lib$name.la"
-+ fi
-+ dnl Then look for a static library.
-+ if test "X$found_dir" = "X"; then
-+ if test -f "$dir/$libname.$acl_libext"; then
-+ found_dir="$dir"
-+ found_a="$dir/$libname.$acl_libext"
- fi
-- else
-- if test -f "$additional_libdir/lib$name.$libext"; then
-- found_dir="$additional_libdir"
-- found_a="$additional_libdir/lib$name.$libext"
-- if test -f "$additional_libdir/lib$name.la"; then
-- found_la="$additional_libdir/lib$name.la"
-- fi
-+ fi
-+ if test "X$found_dir" != "X"; then
-+ if test -f "$dir/$libname.la"; then
-+ found_la="$dir/$libname.la"
- fi
- fi
- fi
-@@ -227,26 +274,44 @@
- case "$x" in
- -L*)
- dir=`echo "X$x" | sed -e 's/^X-L//'`
-- if test -n "$shlibext" \
-- && { test -f "$dir/lib$name.$shlibext" \
-- || { test "$shlibext" = dll \
-- && test -f "$dir/lib$name.dll.a"; }; }; then
-- found_dir="$dir"
-- if test -f "$dir/lib$name.$shlibext"; then
-- found_so="$dir/lib$name.$shlibext"
-+ dnl First look for a shared library.
-+ if test -n "$acl_shlibext"; then
-+ if test -f "$dir/$libname$shrext"; then
-+ found_dir="$dir"
-+ found_so="$dir/$libname$shrext"
- else
-- found_so="$dir/lib$name.dll.a"
-- fi
-- if test -f "$dir/lib$name.la"; then
-- found_la="$dir/lib$name.la"
-+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
-+ ver=`(cd "$dir" && \
-+ for f in "$libname$shrext".*; do echo "$f"; done \
-+ | sed -e "s,^$libname$shrext\\\\.,," \
-+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
-+ | sed 1q ) 2>/dev/null`
-+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
-+ found_dir="$dir"
-+ found_so="$dir/$libname$shrext.$ver"
-+ fi
-+ else
-+ eval library_names=\"$acl_library_names_spec\"
-+ for f in $library_names; do
-+ if test -f "$dir/$f"; then
-+ found_dir="$dir"
-+ found_so="$dir/$f"
-+ break
-+ fi
-+ done
-+ fi
- fi
-- else
-- if test -f "$dir/lib$name.$libext"; then
-+ fi
-+ dnl Then look for a static library.
-+ if test "X$found_dir" = "X"; then
-+ if test -f "$dir/$libname.$acl_libext"; then
- found_dir="$dir"
-- found_a="$dir/lib$name.$libext"
-- if test -f "$dir/lib$name.la"; then
-- found_la="$dir/lib$name.la"
-- fi
-+ found_a="$dir/$libname.$acl_libext"
-+ fi
-+ fi
-+ if test "X$found_dir" != "X"; then
-+ if test -f "$dir/$libname.la"; then
-+ found_la="$dir/$libname.la"
- fi
- fi
- ;;
-@@ -282,12 +347,12 @@
- ltrpathdirs="$ltrpathdirs $found_dir"
- fi
- dnl The hardcoding into $LIBNAME is system dependent.
-- if test "$hardcode_direct" = yes; then
-+ if test "$acl_hardcode_direct" = yes; then
- dnl Using DIR/libNAME.so during linking hardcodes DIR into the
- dnl resulting binary.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- else
-- if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
-+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
- dnl Use an explicit option to hardcode DIR into the resulting
- dnl binary.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
-@@ -318,13 +383,13 @@
- if test -z "$haveit"; then
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
- fi
-- if test "$hardcode_minus_L" != no; then
-+ if test "$acl_hardcode_minus_L" != no; then
- dnl FIXME: Not sure whether we should use
- dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
- dnl here.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- else
-- dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
-+ dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
- dnl here, because this doesn't fit in flags passed to the
- dnl compiler. So give up. No hardcoding. This affects only
- dnl very old systems.
-@@ -512,18 +577,18 @@
- done
- done
- if test "X$rpathdirs" != "X"; then
-- if test -n "$hardcode_libdir_separator"; then
-+ if test -n "$acl_hardcode_libdir_separator"; then
- dnl Weird platform: only the last -rpath option counts, the user must
- dnl pass all path elements in one option. We can arrange that for a
- dnl single library, but not when more than one $LIBNAMEs are used.
- alldirs=
- for found_dir in $rpathdirs; do
-- alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
-+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
- done
-- dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
-+ dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
- acl_save_libdir="$libdir"
- libdir="$alldirs"
-- eval flag=\"$hardcode_libdir_flag_spec\"
-+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
- libdir="$acl_save_libdir"
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
- else
-@@ -531,7 +596,7 @@
- for found_dir in $rpathdirs; do
- acl_save_libdir="$libdir"
- libdir="$found_dir"
-- eval flag=\"$hardcode_libdir_flag_spec\"
-+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
- libdir="$acl_save_libdir"
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
- done
-@@ -642,3 +707,79 @@
- fi
- AC_SUBST([$1])
- ])
-+
-+dnl For those cases where a variable contains several -L and -l options
-+dnl referring to unknown libraries and directories, this macro determines the
-+dnl necessary additional linker options for the runtime path.
-+dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
-+dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
-+dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
-+dnl otherwise linking without libtool is assumed.
-+AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
-+[
-+ AC_REQUIRE([AC_LIB_RPATH])
-+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
-+ $1=
-+ if test "$enable_rpath" != no; then
-+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
-+ dnl Use an explicit option to hardcode directories into the resulting
-+ dnl binary.
-+ rpathdirs=
-+ next=
-+ for opt in $2; do
-+ if test -n "$next"; then
-+ dir="$next"
-+ dnl No need to hardcode the standard /usr/lib.
-+ if test "X$dir" != "X/usr/$acl_libdirstem"; then
-+ rpathdirs="$rpathdirs $dir"
-+ fi
-+ next=
-+ else
-+ case $opt in
-+ -L) next=yes ;;
-+ -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
-+ dnl No need to hardcode the standard /usr/lib.
-+ if test "X$dir" != "X/usr/$acl_libdirstem"; then
-+ rpathdirs="$rpathdirs $dir"
-+ fi
-+ next= ;;
-+ *) next= ;;
-+ esac
-+ fi
-+ done
-+ if test "X$rpathdirs" != "X"; then
-+ if test -n ""$3""; then
-+ dnl libtool is used for linking. Use -R options.
-+ for dir in $rpathdirs; do
-+ $1="${$1}${$1:+ }-R$dir"
-+ done
-+ else
-+ dnl The linker is used for linking directly.
-+ if test -n "$acl_hardcode_libdir_separator"; then
-+ dnl Weird platform: only the last -rpath option counts, the user
-+ dnl must pass all path elements in one option.
-+ alldirs=
-+ for dir in $rpathdirs; do
-+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
-+ done
-+ acl_save_libdir="$libdir"
-+ libdir="$alldirs"
-+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
-+ libdir="$acl_save_libdir"
-+ $1="$flag"
-+ else
-+ dnl The -rpath options are cumulative.
-+ for dir in $rpathdirs; do
-+ acl_save_libdir="$libdir"
-+ libdir="$dir"
-+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
-+ libdir="$acl_save_libdir"
-+ $1="${$1}${$1:+ }$flag"
-+ done
-+ fi
-+ fi
-+ fi
-+ fi
-+ fi
-+ AC_SUBST([$1])
-+])
-Index: gettext-0.16.1/autoconf-lib-link/config.rpath
-===================================================================
---- gettext-0.16.1.orig/autoconf-lib-link/config.rpath 2006-11-27 09:01:58.000000000 -0800
-+++ gettext-0.16.1/autoconf-lib-link/config.rpath 2011-03-17 00:33:23.336539490 -0700
-@@ -2,7 +2,7 @@
- # Output a system dependent set of variables, describing how to set the
- # run time search path of shared libraries in an executable.
- #
--# Copyright 1996-2006 Free Software Foundation, Inc.
-+# Copyright 1996-2007 Free Software Foundation, Inc.
- # Taken from GNU libtool, 2001
- # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
- #
-@@ -47,6 +47,18 @@
- done
- cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
-
-+# Code taken from libtool.m4's _LT_CC_BASENAME.
-+
-+for cc_temp in $CC""; do
-+ case $cc_temp in
-+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
-+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
-+ \-*) ;;
-+ *) break;;
-+ esac
-+done
-+cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
-+
- # Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
-
- wl=
-@@ -64,7 +76,14 @@
- ;;
- esac
- ;;
-- mingw* | pw32* | os2*)
-+ darwin*)
-+ case $cc_basename in
-+ xlc*)
-+ wl='-Wl,'
-+ ;;
-+ esac
-+ ;;
-+ mingw* | cygwin* | pw32* | os2*)
- ;;
- hpux9* | hpux10* | hpux11*)
- wl='-Wl,'
-@@ -74,7 +93,7 @@
- ;;
- newsos6)
- ;;
-- linux*)
-+ linux* | k*bsd*-gnu)
- case $cc_basename in
- icc* | ecc*)
- wl='-Wl,'
-@@ -100,7 +119,7 @@
- osf3* | osf4* | osf5*)
- wl='-Wl,'
- ;;
-- sco3.2v5*)
-+ rdos*)
- ;;
- solaris*)
- wl='-Wl,'
-@@ -108,11 +127,14 @@
- sunos4*)
- wl='-Qoption ld '
- ;;
-- sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
-+ sysv4 | sysv4.2uw2* | sysv4.3*)
- wl='-Wl,'
- ;;
- sysv4*MP*)
- ;;
-+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-+ wl='-Wl,'
-+ ;;
- unicos*)
- wl='-Wl,'
- ;;
-@@ -141,6 +163,10 @@
- # we just hope/assume this is gcc and not c89 (= MSVC++)
- with_gnu_ld=yes
- ;;
-+ interix*)
-+ # we just hope/assume this is gcc and not c89 (= MSVC++)
-+ with_gnu_ld=yes
-+ ;;
- openbsd*)
- with_gnu_ld=no
- ;;
-@@ -189,11 +215,11 @@
- ld_shlibs=no
- fi
- ;;
-- interix3*)
-+ interix[3-9]*)
- hardcode_direct=no
- hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
- ;;
-- linux*)
-+ gnu* | linux* | k*bsd*-gnu)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- :
- else
-@@ -280,7 +306,7 @@
- strings "$collect2name" | grep resolve_lib_name >/dev/null
- then
- # We have reworked collect2
-- hardcode_direct=yes
-+ :
- else
- # We have old collect2
- hardcode_direct=unsupported
-@@ -359,7 +385,7 @@
- hardcode_direct=yes
- hardcode_minus_L=yes
- ;;
-- freebsd* | kfreebsd*-gnu | dragonfly*)
-+ freebsd* | dragonfly*)
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- ;;
-@@ -412,18 +438,22 @@
- hardcode_libdir_separator=:
- ;;
- openbsd*)
-- hardcode_direct=yes
-- if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-- hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-+ if test -f /usr/libexec/ld.so; then
-+ hardcode_direct=yes
-+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-+ else
-+ case "$host_os" in
-+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
-+ hardcode_libdir_flag_spec='-R$libdir'
-+ ;;
-+ *)
-+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-+ ;;
-+ esac
-+ fi
- else
-- case "$host_os" in
-- openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
-- hardcode_libdir_flag_spec='-R$libdir'
-- ;;
-- *)
-- hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-- ;;
-- esac
-+ ld_shlibs=no
- fi
- ;;
- os2*)
-@@ -471,7 +501,7 @@
- ld_shlibs=yes
- fi
- ;;
-- sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
-+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* |sco3.2v5.0.[024]*)
- ;;
- sysv5* | sco3.2v5* | sco5v6*)
- hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
-@@ -488,33 +518,51 @@
-
- # Check dynamic linker characteristics
- # Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
-+# Unlike libtool.m4, here we don't care about _all_ names of the library, but
-+# only about the one the linker finds when passed -lNAME. This is the last
-+# element of library_names_spec in libtool.m4, or possibly two of them if the
-+# linker has special search rules.
-+library_names_spec= # the last element of library_names_spec in libtool.m4
- libname_spec='lib$name'
- case "$host_os" in
- aix3*)
-+ library_names_spec='$libname.a'
- ;;
- aix4* | aix5*)
-+ library_names_spec='$libname$shrext'
- ;;
- amigaos*)
-+ library_names_spec='$libname.a'
- ;;
- beos*)
-+ library_names_spec='$libname$shrext'
- ;;
- bsdi[45]*)
-+ library_names_spec='$libname$shrext'
- ;;
- cygwin* | mingw* | pw32*)
- shrext=.dll
-+ library_names_spec='$libname.dll.a $libname.lib'
- ;;
- darwin* | rhapsody*)
- shrext=.dylib
-+ library_names_spec='$libname$shrext'
- ;;
- dgux*)
-+ library_names_spec='$libname$shrext'
- ;;
- freebsd1*)
- ;;
-- kfreebsd*-gnu)
-- ;;
- freebsd* | dragonfly*)
-+ case "$host_os" in
-+ freebsd[123]*)
-+ library_names_spec='$libname$shrext$versuffix' ;;
-+ *)
-+ library_names_spec='$libname$shrext' ;;
-+ esac
- ;;
- gnu*)
-+ library_names_spec='$libname$shrext'
- ;;
- hpux9* | hpux10* | hpux11*)
- case $host_cpu in
-@@ -528,10 +576,13 @@
- shrext=.sl
- ;;
- esac
-+ library_names_spec='$libname$shrext'
- ;;
-- interix3*)
-+ interix[3-9]*)
-+ library_names_spec='$libname$shrext'
- ;;
- irix5* | irix6* | nonstopux*)
-+ library_names_spec='$libname$shrext'
- case "$host_os" in
- irix5* | nonstopux*)
- libsuff= shlibsuff=
-@@ -548,33 +599,46 @@
- ;;
- linux*oldld* | linux*aout* | linux*coff*)
- ;;
-- linux*)
-+ linux* | k*bsd*-gnu)
-+ library_names_spec='$libname$shrext'
- ;;
- knetbsd*-gnu)
-+ library_names_spec='$libname$shrext'
- ;;
- netbsd*)
-+ library_names_spec='$libname$shrext'
- ;;
- newsos6)
-+ library_names_spec='$libname$shrext'
- ;;
- nto-qnx*)
-+ library_names_spec='$libname$shrext'
- ;;
- openbsd*)
-+ library_names_spec='$libname$shrext$versuffix'
- ;;
- os2*)
- libname_spec='$name'
- shrext=.dll
-+ library_names_spec='$libname.a'
- ;;
- osf3* | osf4* | osf5*)
-+ library_names_spec='$libname$shrext'
- ;;
- solaris*)
-+ library_names_spec='$libname$shrext'
- ;;
- sunos4*)
-+ library_names_spec='$libname$shrext$versuffix'
- ;;
- sysv4 | sysv4.3*)
-+ library_names_spec='$libname$shrext'
- ;;
- sysv4*MP*)
-+ library_names_spec='$libname$shrext'
- ;;
- sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-+ library_names_spec='$libname$shrext'
- ;;
- uts4*)
- ;;
-@@ -583,6 +647,8 @@
- sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
- escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
- shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
-+escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
-+escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
- escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
-
- LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
-@@ -596,6 +662,12 @@
- # Shared library suffix (normally "so").
- shlibext="$shlibext"
-
-+# Format of library name prefix.
-+libname_spec="$escaped_libname_spec"
-+
-+# Library names that the linker finds when passed -lNAME.
-+library_names_spec="$escaped_library_names_spec"
-+
- # Flag to hardcode \$libdir into a binary during linking.
- # This must work even if \$libdir does not exist.
- hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
diff --git a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.19.8.1/cr-statement.c-timsort.h-fix-formatting-issues.patch b/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.19.8.1/cr-statement.c-timsort.h-fix-formatting-issues.patch
new file mode 100644
index 000000000..6af160419
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/gettext/gettext-0.19.8.1/cr-statement.c-timsort.h-fix-formatting-issues.patch
@@ -0,0 +1,87 @@
+From e546de65a333789e83f5485757967cee29ee3681 Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Sun, 19 Feb 2017 23:32:46 -0800
+Subject: [PATCH] cr-statement.c/timsort.h: fix formatting issues
+
+Fixed when compile with "-Wformat -Wformat-security -Werror=format-security":
+| gettext-tools/gnulib-lib/libcroco/cr-statement.c: In function 'cr_statement_dump_charset':
+| gettext-tools/gnulib-lib/libcroco/cr-statement.c:2661:17: error: format not a string literal and no format arguments [-Werror=format-security]
+| fprintf (a_fp, str) ;
+
+And:
+gettext-tools/gnulib-lib/libxml/timsort.h:326:80: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'unsigned int' [-Wformat=]
+ fprintf(stderr, "Error allocating temporary storage for tim sort: need %lu bytes", sizeof(SORT_TYPE) * new_size);
+
+Upstream-Status: Pending
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+ gettext-tools/gnulib-lib/libcroco/cr-statement.c | 10 +++++-----
+ gettext-tools/gnulib-lib/libxml/timsort.h | 2 +-
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/gettext-tools/gnulib-lib/libcroco/cr-statement.c b/gettext-tools/gnulib-lib/libcroco/cr-statement.c
+index 617520f..100104b 100644
+--- a/gettext-tools/gnulib-lib/libcroco/cr-statement.c
++++ b/gettext-tools/gnulib-lib/libcroco/cr-statement.c
+@@ -2607,7 +2607,7 @@ cr_statement_dump_ruleset (CRStatement * a_this, FILE * a_fp, glong a_indent)
+ g_return_if_fail (a_fp && a_this);
+ str = cr_statement_ruleset_to_string (a_this, a_indent);
+ if (str) {
+- fprintf (a_fp, str);
++ fprintf (a_fp, "%s", str);
+ g_free (str);
+ str = NULL;
+ }
+@@ -2658,7 +2658,7 @@ cr_statement_dump_charset (CRStatement * a_this, FILE * a_fp, gulong a_indent)
+ str = cr_statement_charset_to_string (a_this,
+ a_indent) ;
+ if (str) {
+- fprintf (a_fp, str) ;
++ fprintf (a_fp, "%s", str) ;
+ g_free (str) ;
+ str = NULL ;
+ }
+@@ -2685,7 +2685,7 @@ cr_statement_dump_page (CRStatement * a_this, FILE * a_fp, gulong a_indent)
+
+ str = cr_statement_at_page_rule_to_string (a_this, a_indent) ;
+ if (str) {
+- fprintf (a_fp, str);
++ fprintf (a_fp, "%s", str);
+ g_free (str) ;
+ str = NULL ;
+ }
+@@ -2711,7 +2711,7 @@ cr_statement_dump_media_rule (CRStatement * a_this,
+
+ str = cr_statement_media_rule_to_string (a_this, a_indent) ;
+ if (str) {
+- fprintf (a_fp, str) ;
++ fprintf (a_fp, "%s", str) ;
+ g_free (str) ;
+ str = NULL ;
+ }
+@@ -2737,7 +2737,7 @@ cr_statement_dump_import_rule (CRStatement * a_this, FILE * a_fp,
+
+ str = cr_statement_import_rule_to_string (a_this, a_indent) ;
+ if (str) {
+- fprintf (a_fp, str) ;
++ fprintf (a_fp, "%s", str) ;
+ g_free (str) ;
+ str = NULL ;
+ }
+diff --git a/gettext-tools/gnulib-lib/libxml/timsort.h b/gettext-tools/gnulib-lib/libxml/timsort.h
+index 795f272..443918a 100644
+--- a/gettext-tools/gnulib-lib/libxml/timsort.h
++++ b/gettext-tools/gnulib-lib/libxml/timsort.h
+@@ -323,7 +323,7 @@ static void TIM_SORT_RESIZE(TEMP_STORAGE_T *store, const size_t new_size)
+ SORT_TYPE *tempstore = (SORT_TYPE *)realloc(store->storage, new_size * sizeof(SORT_TYPE));
+ if (tempstore == NULL)
+ {
+- fprintf(stderr, "Error allocating temporary storage for tim sort: need %lu bytes", sizeof(SORT_TYPE) * new_size);
++ fprintf(stderr, "Error allocating temporary storage for tim sort: need %zu bytes", sizeof(SORT_TYPE) * new_size);
+ exit(1);
+ }
+ store->storage = tempstore;
+--
+2.10.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext_0.16.1.bb b/import-layers/yocto-poky/meta/recipes-core/gettext/gettext_0.16.1.bb
deleted file mode 100644
index e79f4dacf..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext_0.16.1.bb
+++ /dev/null
@@ -1,124 +0,0 @@
-SUMMARY = "Utilities and libraries for producing multi-lingual messages"
-DESCRIPTION = "GNU gettext is a set of tools that provides a framework to help other programs produce multi-lingual messages. These tools include a set of conventions about how programs should be written to support message catalogs, a directory and file naming organization for the message catalogs themselves, a runtime library supporting the retrieval of translated messages, and a few stand-alone programs to massage in various ways the sets of translatable and already translated strings."
-HOMEPAGE = "http://www.gnu.org/software/gettext/gettext.html"
-SECTION = "libs"
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://COPYING;md5=9ea3144f04c41cd2eada5d3f472e6ea5"
-
-PR = "r6"
-DEPENDS = "virtual/libiconv"
-DEPENDS_class-native = ""
-PROVIDES = "virtual/libintl virtual/gettext"
-PROVIDES_class-native = "virtual/gettext-native"
-
-SRC_URI = "${GNU_MIRROR}/gettext/gettext-${PV}.tar.gz \
- file://gettext-vpath.patch \
- file://linklib_from_0.17.patch \
- file://gettext-autoconf-lib-link-no-L.patch \
- file://disable_java.patch \
- file://fix_aclocal_version.patch \
- file://fix_gnu_source_circular.patch \
- file://hardcode_macro_version.patch \
- "
-
-SRC_URI[md5sum] = "3d9ad24301c6d6b17ec30704a13fe127"
-SRC_URI[sha256sum] = "0bf850d1a079fb5a61f0a47b1a9efd35eb44032255375e1cedb0253bc27b376d"
-
-PARALLEL_MAKE = ""
-
-LDFLAGS_prepend_libc-uclibc = " -lrt -lpthread "
-
-inherit autotools texinfo
-
-EXTRA_OECONF += "--without-lispdir \
- --disable-csharp \
- --disable-libasprintf \
- --disable-java \
- --disable-native-java \
- --disable-openmp \
- --without-emacs \
- "
-EXTRA_OECONF_append_libc-musl = "\
- gt_cv_func_gnugettext1_libc=yes \
- gt_cv_func_gnugettext2_libc=yes \
- "
-
-acpaths = '-I ${S}/autoconf-lib-link/m4/ \
- -I ${S}/gettext-runtime/m4 \
- -I ${S}/gettext-tools/m4'
-
-do_configure_prepend() {
- rm -f ${S}/config/m4/libtool.m4
-}
-
-do_install_append_libc-musl () {
- rm -f ${D}${libdir}/charset.alias
-}
-
-# these lack the .x behind the .so, but shouldn't be in the -dev package
-# Otherwise you get the following results:
-# 7.4M glibc/images/ep93xx/Angstrom-console-image-glibc-ipk-2008.1-test-20080104-ep93xx.rootfs.tar.gz
-# 25M uclibc/images/ep93xx/Angstrom-console-image-uclibc-ipk-2008.1-test-20080104-ep93xx.rootfs.tar.gz
-# because gettext depends on gettext-dev, which pulls in more -dev packages:
-# 15228 KiB /ep93xx/libstdc++-dev_4.2.2-r2_ep93xx.ipk
-# 1300 KiB /ep93xx/uclibc-dev_0.9.29-r8_ep93xx.ipk
-# 140 KiB /armv4t/gettext-dev_0.14.1-r6_armv4t.ipk
-# 4 KiB /ep93xx/libgcc-s-dev_4.2.2-r2_ep93xx.ipk
-
-PACKAGES =+ "libgettextlib libgettextsrc"
-FILES_libgettextlib = "${libdir}/libgettextlib-*.so*"
-FILES_libgettextsrc = "${libdir}/libgettextsrc-*.so*"
-
-PACKAGES =+ "gettext-runtime gettext-runtime-dev gettext-runtime-staticdev gettext-runtime-doc"
-
-FILES_${PN} += "${libdir}/${BPN}/*"
-
-FILES_gettext-runtime = "${bindir}/gettext \
- ${bindir}/ngettext \
- ${bindir}/envsubst \
- ${bindir}/gettext.sh \
- ${libdir}/libasprintf${SODEV} \
- ${libdir}/GNU.Gettext.dll \
- "
-FILES_gettext-runtime_append_libc-uclibc = " ${libdir}/libintl.so.* \
- ${libdir}/charset.alias \
- "
-FILES_gettext-runtime-staticdev += "${libdir}/libasprintf.a"
-FILES_gettext-runtime-dev += "${includedir}/autosprintf.h \
- ${libdir}/libasprintf${SOLIBDEV}"
-FILES_gettext-runtime-dev_append_libc-uclibc = " ${libdir}/libintl.so \
- ${includedir}/libintl.h \
- "
-FILES_gettext-runtime-doc = "${mandir}/man1/gettext.* \
- ${mandir}/man1/ngettext.* \
- ${mandir}/man1/envsubst.* \
- ${mandir}/man1/.* \
- ${mandir}/man3/* \
- ${docdir}/gettext/gettext.* \
- ${docdir}/gettext/ngettext.* \
- ${docdir}/gettext/envsubst.* \
- ${docdir}/gettext/*.3.html \
- ${datadir}/gettext/ABOUT-NLS \
- ${docdir}/gettext/csharpdoc/* \
- ${docdir}/libasprintf/autosprintf.html \
- ${infodir}/autosprintf.info \
- "
-
-do_install_append() {
- rm -f ${D}${libdir}/preloadable_libintl.so
-}
-
-do_install_append_class-native () {
- rm ${D}${datadir}/aclocal/*
- rm ${D}${datadir}/gettext/config.rpath
- rm ${D}${datadir}/gettext/po/Makefile.in.in
- rm ${D}${datadir}/gettext/po/remove-potcdate.sin
-}
-
-# Anyone inheriting gettext will have both gettext-native and gettext
-# available, and we don't want to use older macros from the target gettext in
-# a non-gplv3 build, so kill them and let dependent recipes rely on
-# gettext-native.
-SYSROOT_DIRS_BLACKLIST += "${datadir}/aclocal"
-
-BBCLASSEXTEND = "native nativesdk"
diff --git a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext_0.19.8.1.bb b/import-layers/yocto-poky/meta/recipes-core/gettext/gettext_0.19.8.1.bb
index 7b8c1e8eb..83edffe53 100644
--- a/import-layers/yocto-poky/meta/recipes-core/gettext/gettext_0.19.8.1.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/gettext/gettext_0.19.8.1.bb
@@ -1,5 +1,8 @@
SUMMARY = "Utilities and libraries for producing multi-lingual messages"
-DESCRIPTION = "GNU gettext is a set of tools that provides a framework to help other programs produce multi-lingual messages. These tools include a set of conventions about how programs should be written to support message catalogs, a directory and file naming organization for the message catalogs themselves, a runtime library supporting the retrieval of translated messages, and a few stand-alone programs to massage in various ways the sets of translatable and already translated strings."
+DESCRIPTION = "GNU gettext is a set of tools that provides a framework to help other programs produce multi-lingual messages. \
+These tools include a set of conventions about how programs should be written to support message catalogs, a directory and file \
+naming organization for the message catalogs themselves, a runtime library supporting the retrieval of translated messages, and \
+a few stand-alone programs to massage in various ways the sets of translatable and already translated strings."
HOMEPAGE = "http://www.gnu.org/software/gettext/gettext.html"
SECTION = "libs"
LICENSE = "GPLv3+ & LGPL-2.1+"
@@ -13,6 +16,7 @@ RCONFLICTS_${PN} = "proxy-libintl"
SRC_URI = "${GNU_MIRROR}/gettext/gettext-${PV}.tar.gz \
file://parallel.patch \
file://add-with-bisonlocaledir.patch \
+ file://cr-statement.c-timsort.h-fix-formatting-issues.patch \
"
SRC_URI[md5sum] = "97e034cf8ce5ba73a28ff6c3c0638092"
diff --git a/import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib-2.0/0001-Test-for-pthread_getname_np-before-using-it.patch b/import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib-2.0/0001-Test-for-pthread_getname_np-before-using-it.patch
new file mode 100644
index 000000000..c6e4966bb
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib-2.0/0001-Test-for-pthread_getname_np-before-using-it.patch
@@ -0,0 +1,70 @@
+From f627fe16099a2b08d8b4e9023ae6b4f352451967 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 6 Nov 2016 08:59:08 -0800
+Subject: [PATCH] Test for pthread_getname_np before using it
+
+Its a GNU extention and not all libc implement it
+musl e.g. implements the setname API but not getname
+in any case, it seems to be safer to check for the
+function before using it.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ config.h.in | 3 +++
+ configure.ac | 10 ++++++++++
+ glib/tests/thread.c | 2 +-
+ 3 files changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/config.h.in b/config.h.in
+index 2c35ff1..da7ac30 100644
+--- a/config.h.in
++++ b/config.h.in
+@@ -326,6 +326,9 @@
+ #undef HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP
+
+ /* Have function pthread_setname_np(const char*) */
++#undef HAVE_PTHREAD_GETNAME_NP
++
++/* Have function pthread_setname_np(const char*) */
+ #undef HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID
+
+ /* Have function pthread_setname_np(pthread_t, const char*) */
+diff --git a/configure.ac b/configure.ac
+index 4309671..209770a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -2121,6 +2121,16 @@ AS_IF([ test x"$have_threads" = xposix], [
+ AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP,1,
+ [Have function pthread_cond_timedwait_relative_np])],
+ [AC_MSG_RESULT(no)])
++ dnl gets thread names
++ AC_MSG_CHECKING(for pthread_getname_np(pthread_t, char*, size_t))
++ AC_LINK_IFELSE(
++ [AC_LANG_PROGRAM(
++ [#include <pthread.h>],
++ [pthread_getname_np(pthread_self(),"example",0)])],
++ [AC_MSG_RESULT(yes)
++ AC_DEFINE(HAVE_PTHREAD_GETNAME_NP,1,
++ [Have function pthread_setname_np(const char*)])],
++ [AC_MSG_RESULT(no)])
+ dnl Sets thread names on OS X 10.6, iOS 3.2 (and higher)
+ AC_MSG_CHECKING(for pthread_setname_np(const char*))
+ AC_LINK_IFELSE(
+diff --git a/glib/tests/thread.c b/glib/tests/thread.c
+index 5447836..2f248a6 100644
+--- a/glib/tests/thread.c
++++ b/glib/tests/thread.c
+@@ -174,7 +174,7 @@ test_thread5 (void)
+ static gpointer
+ thread6_func (gpointer data)
+ {
+-#ifdef HAVE_PTHREAD_SETNAME_NP_WITH_TID
++#if defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID) && defined(HAVE_PTHREAD_GETNAME_NP)
+ char name[16];
+
+ pthread_getname_np (pthread_self(), name, 16);
+--
+2.10.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib-2.0/0002-tests-Ignore-y2k-warnings.patch b/import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib-2.0/0002-tests-Ignore-y2k-warnings.patch
deleted file mode 100644
index f61fa0ae6..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib-2.0/0002-tests-Ignore-y2k-warnings.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From b06b22fecc7deda8c65e28670562ca2371e4e725 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 16 Apr 2016 13:43:54 -0700
-Subject: [PATCH 2/2] tests: Ignore y2k warnings
-
-silences
-| ../../../../../../../../workspace/sources/glib-2.0/glib/tests/gdatetime.c: In function 'test_strftime':
-| ../../../../../../../../workspace/sources/glib-2.0/glib/tests/gdatetime.c:1338:3: error: '%c' yields only last 2 digits of year in some locales [-Werror=format-y2k]
-| "a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M "
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Submitted
-
- glib/tests/gdatetime.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c
-index 16a163c..e6062fc 100644
---- a/glib/tests/gdatetime.c
-+++ b/glib/tests/gdatetime.c
-@@ -1326,6 +1326,9 @@ test_z (void)
- g_time_zone_unref (tz);
- }
-
-+#pragma GCC diagnostic push
-+#pragma GCC diagnostic ignored "-Wformat-y2k"
-+
- static void
- test_strftime (void)
- {
-@@ -1351,6 +1354,7 @@ test_strftime (void)
- }
- #endif
- }
-+#pragma GCC diagnostic pop
-
- static void
- test_find_interval (void)
---
-2.8.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib-2.0/gi-exclude.patch b/import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib-2.0/gi-exclude.patch
deleted file mode 100644
index dc62b92ef..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib-2.0/gi-exclude.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-The autoptr types should be excluded from gobject-introspection parsing as
-they're not user-facing.
-
-Upstream-Status: Submitted
-Signed-off-by: Ross Burton <ross.burton@intel.com>
-
-diff --git a/gio/gio-autocleanups.h b/gio/gio-autocleanups.h
-index a95ba65..24ccc2d 100644
---- a/gio/gio-autocleanups.h
-+++ b/gio/gio-autocleanups.h
-@@ -21,6 +21,8 @@
- #error "Only <gio/gio.h> can be included directly."
- #endif
-
-+#ifndef __GI_SCANNER__
-+
- G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAction, g_object_unref)
- G_DEFINE_AUTOPTR_CLEANUP_FUNC(GActionMap, g_object_unref)
- G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAppInfo, g_object_unref)
-@@ -146,3 +148,5 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVolume, g_object_unref)
- G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVolumeMonitor, g_object_unref)
- G_DEFINE_AUTOPTR_CLEANUP_FUNC(GZlibCompressor, g_object_unref)
- G_DEFINE_AUTOPTR_CLEANUP_FUNC(GZlibDecompressor, g_object_unref)
-+
-+#endif
-diff --git a/glib/glib-autocleanups.h b/glib/glib-autocleanups.h
-index 6355f75..09d28be 100644
---- a/glib/glib-autocleanups.h
-+++ b/glib/glib-autocleanups.h
-@@ -21,6 +21,8 @@
- #error "Only <glib.h> can be included directly."
- #endif
-
-+#ifndef __GI_SCANNER__
-+
- static inline void
- g_autoptr_cleanup_generic_gfree (void *p)
- {
-@@ -87,3 +89,5 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantDict, g_variant_dict_unref)
- G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantDict, g_variant_dict_clear)
- G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantType, g_variant_type_free)
- G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GStrv, g_strfreev, NULL)
-+
-+#endif
-diff --git a/gobject/gobject-autocleanups.h b/gobject/gobject-autocleanups.h
-index 980203f..a1d4ba1 100644
---- a/gobject/gobject-autocleanups.h
-+++ b/gobject/gobject-autocleanups.h
-@@ -21,6 +21,10 @@
- #error "Only <glib-object.h> can be included directly."
- #endif
-
-+#ifndef __GI_SCANNER__
-+
- G_DEFINE_AUTOPTR_CLEANUP_FUNC(GObject, g_object_unref)
- G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInitiallyUnowned, g_object_unref)
- G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GValue, g_value_unset)
-+
-+#endif
diff --git a/import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib-2.0_2.48.2.bb b/import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib-2.0_2.50.3.bb
index a45f64444..22ea347e1 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib-2.0_2.48.2.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib-2.0_2.50.3.bb
@@ -13,14 +13,13 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
file://allow-run-media-sdX-drive-mount-if-username-root.patch \
file://0001-Remove-the-warning-about-deprecated-paths-in-schemas.patch \
file://Enable-more-tests-while-cross-compiling.patch \
- file://gi-exclude.patch \
file://0001-Install-gio-querymodules-as-libexec_PROGRAM.patch \
file://0001-Do-not-ignore-return-value-of-write.patch \
- file://0002-tests-Ignore-y2k-warnings.patch \
+ file://0001-Test-for-pthread_getname_np-before-using-it.patch \
"
SRC_URI_append_class-native = " file://glib-gettextize-dir.patch \
file://relocate-modules.patch"
-SRC_URI[md5sum] = "f4ac1aa2efd4f5798c37625ea697ac57"
-SRC_URI[sha256sum] = "f25e751589cb1a58826eac24fbd4186cda4518af772806b666a3f91f66e6d3f4"
+SRC_URI[md5sum] = "381ab22934f296750d036aa55a397ded"
+SRC_URI[sha256sum] = "82ee94bf4c01459b6b00cb9db0545c2237921e3060c0b74cff13fbc020cfd999"
diff --git a/import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib.inc b/import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib.inc
index 906e0d4d5..2b30e372d 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib.inc
+++ b/import-layers/yocto-poky/meta/recipes-core/glib-2.0/glib.inc
@@ -15,6 +15,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=3bf50002aefd002f49e7bb854063f7e7 \
BUGTRACKER = "http://bugzilla.gnome.org"
SECTION = "libs"
+CVE_PRODUCT = "glib"
+
BBCLASSEXTEND = "native nativesdk"
DEPENDS = "virtual/libiconv libffi zlib glib-2.0-native"
@@ -26,15 +28,17 @@ PACKAGES += "${PN}-codegen ${PN}-utils"
LEAD_SONAME = "libglib-2.0.*"
-inherit autotools gettext gtk-doc pkgconfig ptest-gnome upstream-version-is-even bash-completion gio-module-cache python3native
+inherit autotools gettext gtk-doc pkgconfig ptest-gnome upstream-version-is-even bash-completion gio-module-cache python3native manpages
S = "${WORKDIR}/glib-${PV}"
-PACKAGECONFIG ??= "system-pcre"
+PACKAGECONFIG ??= "system-pcre libmount"
# To use the system pcre it must be configured with --enable-unicode-properties
PACKAGECONFIG[system-pcre] = "--with-pcre=system,--with-pcre=internal,libpcre"
+PACKAGECONFIG[libmount] = "--enable-libmount,--disable-libmount,util-linux"
+PACKAGECONFIG[manpages] = "--enable-man --with-xml-catalog=${STAGING_ETCDIR_NATIVE}/xml/catalog.xml, --disable-man, libxslt-native xmlto-native"
-CORECONF = "--disable-dtrace --disable-fam --disable-libelf --disable-systemtap --disable-man"
+CORECONF = "--disable-dtrace --disable-fam --disable-libelf --disable-systemtap"
PRINTF = "--enable-included-printf=no"
PRINTF_darwin = "--enable-included-printf=yes"
@@ -43,6 +47,9 @@ EXTRA_OECONF = "${PRINTF} ${CORECONF}"
EXTRA_OECONF_class-native = "${CORECONF} --disable-selinux"
EXTRA_OECONF_append_libc-uclibc = " --with-libiconv=gnu"
+# Tell configure that we'll have dbus-daemon on the target for the tests
+EXTRA_OECONF_class-target_append = " ${@bb.utils.contains('PTEST_ENABLED', '1', ' ac_cv_prog_DBUS_DAEMON=dbus-daemon', '', d)}"
+
do_configure_prepend() {
sed -i -e '1s,#!.*,#!${USRBINPATH}/env python3,' ${S}/gio/gdbus-2.0/codegen/gdbus-codegen.in
}
@@ -90,23 +97,28 @@ do_install_append () {
sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' ${D}${bindir}/glib-mkenums
fi
+ if [ -e ${D}${libdir}/charset.alias ]; then
+ rm -f ${D}${libdir}/charset.alias
+ fi
+}
+
+do_install_append_class-target () {
+ # Tests are only installed on targets, not native builds. Separating this out
+ # keeps glib-2.0-native from depending on ${DISTRO_FEATURES}
if [ -f ${D}${datadir}/installed-tests/glib/gdbus-serialization.test ]; then
if ${@bb.utils.contains("DISTRO_FEATURES", "x11", "false", "true", d)}; then
rm ${D}${datadir}/installed-tests/glib/gdbus-serialization.test
fi
fi
- # Make sure gio-querymodules is unique among multilibs
- if test "x${MLPREFIX}" != "x"; then
- mv ${D}${libexecdir}/gio-querymodules ${D}${libexecdir}/${MLPREFIX}gio-querymodules
- fi
-}
-
-do_install_append_libc-musl () {
- rm -f ${D}${libdir}/charset.alias
+ # Make sure gio-querymodules is unique among multilibs
+ if test "x${MLPREFIX}" != "x"; then
+ mv ${D}${libexecdir}/gio-querymodules ${D}${libexecdir}/${MLPREFIX}gio-querymodules
+ fi
}
RDEPENDS_${PN}-ptest += "\
+ dbus \
gnome-desktop-testing \
tzdata \
tzdata-americas \
diff --git a/import-layers/yocto-poky/meta/recipes-core/glib-networking/glib-networking_2.48.2.bb b/import-layers/yocto-poky/meta/recipes-core/glib-networking/glib-networking_2.50.0.bb
index 50d9983fe..2782bd95c 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glib-networking/glib-networking_2.48.2.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/glib-networking/glib-networking_2.50.0.bb
@@ -7,10 +7,10 @@ LICENSE = "LGPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2"
SECTION = "libs"
-DEPENDS = "glib-2.0 intltool-native"
+DEPENDS = "glib-2.0"
-SRC_URI[archive.md5sum] = "d7cf81d52c856b0c66f7821021f40e08"
-SRC_URI[archive.sha256sum] = "925c0c49d6b2b8b5695f2e33cd952d1dbb7d18d3f2f796413577719315bb3a84"
+SRC_URI[archive.md5sum] = "4d06d0224646f274918b1cb6da9a07f6"
+SRC_URI[archive.sha256sum] = "3f1a442f3c2a734946983532ce59ed49120319fdb10c938447c373d5e5286bee"
PACKAGECONFIG ??= "ca-certificates gnutls"
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/cross-localedef-native_2.24.bb b/import-layers/yocto-poky/meta/recipes-core/glibc/cross-localedef-native_2.25.bb
index d4cccedb4..fae8683ee 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/cross-localedef-native_2.24.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/cross-localedef-native_2.25.bb
@@ -21,7 +21,7 @@ SRCBRANCH ?= "release/${PV}/master"
GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+\.\d+(\.\d+)*)"
-SRCREV_glibc ?= "ea23815a795f72035262953dad5beb03e09c17dd"
+SRCREV_glibc ?= "db0242e3023436757bbc7c488a779e6e3343db04"
SRCREV_localedef ?= "29869b6dc11427c5bab839bdb155c85a7c644c71"
SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
@@ -36,6 +36,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
file://0023-eglibc-Install-PIC-archives.patch \
file://0024-eglibc-Forward-port-cross-locale-generation-support.patch \
file://0025-Define-DUMMY_LOCALE_T-if-not-defined.patch \
+ file://0001-Include-locale_t.h-compatibility-header.patch \
"
# Makes for a rather long rev (22 characters), but...
#
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-collateral.inc b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-collateral.inc
index 60655eba3..37f27ca44 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-collateral.inc
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-collateral.inc
@@ -9,13 +9,13 @@ HOMEPAGE = "http://www.gnu.org/software/libc/index.html"
# http://lists.openembedded.org/pipermail/openembedded-core/2015-January/100679.html
ARM_INSTRUCTION_SET = "arm"
-do_fetch[noexec] = "1"
-do_unpack[noexec] = "1"
-do_patch[noexec] = "1"
+deltask do_fetch
+deltask do_unpack
+deltask do_patch
do_configure[noexec] = "1"
do_compile[noexec] = "1"
-do_install[depends] += "virtual/${MLPREFIX}libc:do_populate_sysroot"
+do_install[depends] += "virtual/${MLPREFIX}libc:do_stash_locale"
COMPATIBLE_HOST_libc-musl_class-target = "null"
COMPATIBLE_HOST_libc-uclibc_class-target = "null"
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-common.inc b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-common.inc
index bba1568ba..b05e162f8 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-common.inc
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-common.inc
@@ -7,3 +7,4 @@ LIC_FILES_CHKSUM ?= "file://LICENSES;md5=07a394b26e0902b9ffdec03765209770 \
file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \
file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
file://COPYING.LIB;md5=bbb461211a33b134d42ed5ee802b37ff "
+CVE_PRODUCT = "glibc"
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-initial.inc b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-initial.inc
index 2e3bc8104..b86e2fb2d 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-initial.inc
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-initial.inc
@@ -6,7 +6,6 @@ PACKAGES_DYNAMIC = ""
STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}"
-TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
do_configure () {
(cd ${S} && gnu-configize) || die "failure in running gnu-configize"
@@ -42,13 +41,9 @@ do_install () {
if [ -e ${B}/bits/stdio_lim.h ]; then
cp ${B}/bits/stdio_lim.h ${D}${includedir}/bits/
fi
- # add links to linux-libc-headers: final glibc build need this.
- for t in linux asm asm-generic; do
- ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/
- done
}
-do_install_locale() {
+do_stash_locale() {
:
}
@@ -56,23 +51,7 @@ do_siteconfig () {
:
}
-SSTATEPOSTINSTFUNCS += "glibcinitial_sstate_postinst"
-glibcinitial_sstate_postinst() {
- if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
- then
- # Recreate the symlinks to ensure they point to the correct location
- for t in linux asm asm-generic; do
- rm -f ${STAGING_DIR_TCBOOTSTRAP}${includedir}/$t
- ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${STAGING_DIR_TCBOOTSTRAP}${includedir}/
- done
- fi
-}
-
-do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_TCBOOTSTRAP}/"
-
-# We don't install any scripts so there is nothing to evacuate
-do_evacuate_scripts () {
- :
-}
-
inherit nopackages
+
+# We really only want this built by things that need it, not any recrdeptask
+deltask do_build
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-initial_2.24.bb b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-initial_2.25.bb
index e86770e12..e86770e12 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-initial_2.24.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-initial_2.25.bb
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-ld.inc b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-ld.inc
index b982368d8..c1d635dc8 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-ld.inc
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-ld.inc
@@ -1,27 +1,14 @@
def ld_append_if_tune_exists(d, infos, dict):
- tune = d.getVar("DEFAULTTUNE", True) or ""
- libdir = d.getVar("base_libdir", True) or ""
+ tune = d.getVar("DEFAULTTUNE") or ""
+ libdir = d.getVar("base_libdir") or ""
if tune in dict:
infos['ldconfig'].add('{"' + libdir + '/' + dict[tune][0] + '",' + dict[tune][1] + ' }')
infos['lddrewrite'].add(libdir+'/'+dict[tune][0])
def glibc_dl_info(d):
ld_info_all = {
- "mips": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mips64-n32": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mips64": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mipsel": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mips64el-n32": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mips64el": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mips-nf": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mipsisa32r6": ["ld-linux-mipsn8.so.1", "FLAG_ELF_LIBC6"],
- "mipsisa32r6el": ["ld-linux-mipsn8.so.1", "FLAG_ELF_LIBC6"],
- "mips64-nf-n32": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mips64-nf": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mips64el-nf-n32": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mips64el-nf": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mipsisa64r6": ["ld-linux-mipsn8.so.1", "FLAG_ELF_LIBC6"],
- "mipsisa64r6el": ["ld-linux-mipsn8.so.1", "FLAG_ELF_LIBC6"],
+ "mipsarch": ["ld.so.1", "FLAG_ELF_LIBC6"],
+ "mipsarchr6": ["ld-linux-mipsn8.so.1", "FLAG_ELF_LIBC6"],
"powerpc": ["ld.so.1", "FLAG_ELF_LIBC6"],
"powerpc-nf": ["ld.so.1", "FLAG_ELF_LIBC6"],
"powerpc64": ["ld64.so.1", "FLAG_ELF_LIBC6"],
@@ -39,18 +26,17 @@ def glibc_dl_info(d):
ld_append_if_tune_exists(d, infos, ld_info_all)
#DEFAULTTUNE_MULTILIB_ORIGINAL
- original_tune=d.getVar("DEFAULTTUNE_MULTILIB_ORIGINAL",True)
+ original_tune=d.getVar("DEFAULTTUNE_MULTILIB_ORIGINAL")
if original_tune:
localdata = bb.data.createCopy(d)
localdata.setVar("DEFAULTTUNE", original_tune)
ld_append_if_tune_exists(localdata, infos, ld_info_all)
- variants = d.getVar("MULTILIB_VARIANTS", True) or ""
+ variants = d.getVar("MULTILIB_VARIANTS") or ""
for item in variants.split():
localdata = bb.data.createCopy(d)
overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item
localdata.setVar("OVERRIDES", overrides)
- bb.data.update_data(localdata)
ld_append_if_tune_exists(localdata, infos, ld_info_all)
infos['ldconfig'] = ','.join(infos['ldconfig'])
infos['lddrewrite'] = ' '.join(infos['lddrewrite'])
@@ -58,4 +44,5 @@ def glibc_dl_info(d):
EGLIBC_KNOWN_INTERPRETER_NAMES = "${@glibc_dl_info(d)['ldconfig']}"
RTLDLIST = "${@glibc_dl_info(d)['lddrewrite']}"
+RTLDLIST_class-nativesdk = "${base_libdir}/${@bb.utils.contains('SDK_ARCH', 'x86_64', 'ld-linux-x86-64.so.2', 'ld-linux.so.2', d)}"
glibc_dl_info[vardepsexclude] = "OVERRIDES"
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-locale.inc b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-locale.inc
index 0a7adfcc8..75ababea6 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-locale.inc
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-locale.inc
@@ -1,4 +1,4 @@
-include glibc-collateral.inc
+require glibc-collateral.inc
SUMMARY = "Locale data from glibc"
@@ -12,6 +12,10 @@ 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.incinhibits all default deps
+# cannot add virtual/libc to DEPENDS, because it would conflict with libc-initial in RSS
+RDEPENDS_localedef += "glibc"
+
# 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)
# to decrease initial boot time and avoid localedef being killed by the OOM
@@ -41,22 +45,22 @@ PACKAGES_DYNAMIC = "^locale-base-.* \
# Create a glibc-binaries package
ALLOW_EMPTY_${BPN}-binaries = "1"
PACKAGES += "${BPN}-binaries"
-RRECOMMENDS_${BPN}-binaries = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("glibc-binary") != -1])}"
+RRECOMMENDS_${BPN}-binaries = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-binary") != -1])}"
# Create a glibc-charmaps package
ALLOW_EMPTY_${BPN}-charmaps = "1"
PACKAGES += "${BPN}-charmaps"
-RRECOMMENDS_${BPN}-charmaps = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("glibc-charmap") != -1])}"
+RRECOMMENDS_${BPN}-charmaps = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-charmap") != -1])}"
# Create a glibc-gconvs package
ALLOW_EMPTY_${BPN}-gconvs = "1"
PACKAGES += "${BPN}-gconvs"
-RRECOMMENDS_${BPN}-gconvs = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("glibc-gconv") != -1])}"
+RRECOMMENDS_${BPN}-gconvs = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-gconv") != -1])}"
# Create a glibc-localedatas package
ALLOW_EMPTY_${BPN}-localedatas = "1"
PACKAGES += "${BPN}-localedatas"
-RRECOMMENDS_${BPN}-localedatas = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("glibc-localedata") != -1])}"
+RRECOMMENDS_${BPN}-localedatas = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-localedata") != -1])}"
DESCRIPTION_localedef = "glibc: compile locale definition files"
@@ -66,7 +70,7 @@ DESCRIPTION_localedef = "glibc: compile locale definition files"
FILES_${MLPREFIX}glibc-gconv = "${libdir}/gconv/*"
FILES_localedef = "${bindir}/localedef"
-LOCALETREESRC = "${STAGING_INCDIR}/glibc-locale-internal-${MULTIMACH_TARGET_SYS}"
+LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
do_install () {
mkdir -p ${D}${bindir} ${D}${datadir} ${D}${libdir}
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-locale_2.24.bb b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-locale_2.25.bb
index f7702e035..f7702e035 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-locale_2.24.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-locale_2.25.bb
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-mtrace.inc b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-mtrace.inc
index e12b079e0..d703c14bd 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-mtrace.inc
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-mtrace.inc
@@ -1,11 +1,11 @@
-include glibc-collateral.inc
+require glibc-collateral.inc
SUMMARY = "mtrace utility provided by glibc"
DESCRIPTION = "mtrace utility provided by glibc"
RDEPENDS_${PN} = "perl"
RPROVIDES_${PN} = "libc-mtrace"
-SRC = "${STAGING_INCDIR}/glibc-scripts-internal-${MULTIMACH_TARGET_SYS}"
+SRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale/scripts"
do_install() {
install -d -m 0755 ${D}${bindir}
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-mtrace_2.24.bb b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-mtrace_2.25.bb
index 0b69bad46..0b69bad46 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-mtrace_2.24.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-mtrace_2.25.bb
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-package.inc b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-package.inc
index bad642449..9f7fa62a3 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-package.inc
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-package.inc
@@ -8,18 +8,15 @@
python __anonymous () {
import bb, re
- uc_os = (re.match('.*uclibc*', d.getVar('TARGET_OS', True)) != None)
+ uc_os = (re.match('.*uclibc*', d.getVar('TARGET_OS')) != None)
if uc_os:
raise bb.parse.SkipPackage("incompatible with target %s" %
- d.getVar('TARGET_OS', True))
+ d.getVar('TARGET_OS'))
}
-# Set this to zero if you don't want ldconfig in the output package
-USE_LDCONFIG ?= "1"
-
INHIBIT_SYSROOT_STRIP = "1"
-PACKAGES = "${PN}-dbg catchsegv sln nscd ldd tzcode ${PN}-utils glibc-thread-db ${PN}-pic libcidn libmemusage libsegfault ${PN}-pcprofile libsotruss ${PN} glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc"
+PACKAGES = "${PN}-dbg catchsegv sln nscd ldd tzcode glibc-thread-db ${PN}-pic libcidn libmemusage 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)"
@@ -37,7 +34,7 @@ libc_baselibs = "${base_libdir}/libcrypt*.so.* ${base_libdir}/libcrypt-*.so ${ba
libc_baselibs_append_aarch64 = " /lib/ld-linux-aarch64*.so.1"
INSANE_SKIP_${PN}_append_aarch64 = " libdir"
-FILES_${PN} = "${libc_baselibs} ${libexecdir}/* ${@base_conditional('USE_LDCONFIG', '1', '${base_sbindir}/ldconfig ${sysconfdir}/ld.so.conf', '', d)}"
+FILES_${PN} = "${libc_baselibs} ${libexecdir}/* ${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.*"
@@ -85,7 +82,7 @@ do_install_append () {
rmdir --ignore-fail-on-non-empty ${D}${libexecdir}
fi
- oe_multilib_header bits/syscall.h
+ oe_multilib_header bits/syscall.h bits/long-double.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
@@ -96,8 +93,8 @@ do_install_append () {
rm -f ${D}${infodir}/dir
fi
- if [ "${USE_LDCONFIG}" != "1" ]; then
- # We won't ship these files (see FILES above) so let's not install them
+ 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.
@@ -143,10 +140,30 @@ do_install_append_aarch64 () {
${D}/lib/ld-linux-aarch64_be.so.1
fi
fi
+ do_install_armmultilib
+}
+
+do_install_append_arm () {
+ do_install_armmultilib
+}
+
+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/sem.h bits/semaphore.h bits/setjmp.h
+ oe_multilib_header bits/shm.h bits/sigstack.h bits/stat.h bits/statfs.h bits/string.h bits/typesizes.h
+
+ oe_multilib_header fpu_control.h gnu/lib-names.h gnu/stubs.h ieee754.h
+
+ oe_multilib_header sys/elf.h sys/procfs.h sys/ptrace.h sys/ucontext.h sys/user.h
}
-do_install_locale () {
- dest=${D}/${includedir}/glibc-locale-internal-${MULTIMACH_TARGET_SYS}
+
+LOCALESTASH = "${WORKDIR}/stashed-locale"
+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}
@@ -166,14 +183,8 @@ do_install_locale () {
cp -fpPR ${D}${datadir}/* ${dest}${datadir}
rm -rf ${D}${datadir}/locale/
cp -fpPR ${WORKDIR}/SUPPORTED ${dest}
-}
-addtask do_install_locale after do_install before do_populate_sysroot do_package
-
-bashscripts = "mtrace sotruss xtrace"
-
-do_evacuate_scripts () {
- target=${D}${includedir}/glibc-scripts-internal-${MULTIMACH_TARGET_SYS}
+ target=${dest}/scripts
mkdir -p $target
for i in ${bashscripts}; do
if [ -f ${D}${bindir}/$i ]; then
@@ -182,22 +193,36 @@ do_evacuate_scripts () {
done
}
-addtask evacuate_scripts after do_install before do_populate_sysroot do_package
+addtask do_stash_locale after do_install before do_populate_sysroot do_package
+do_stash_locale[dirs] = "${B}"
+do_stash_locale[cleandirs] = "${LOCALESTASH}"
+SSTATETASKS += "do_stash_locale"
+do_stash_locale[sstate-inputdirs] = "${LOCALESTASH}"
+do_stash_locale[sstate-outputdirs] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
+do_stash_locale[sstate-fixmedir] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
-PACKAGE_PREPROCESS_FUNCS += "glibc_package_preprocess"
+python do_stash_locale_setscene () {
+ sstate_setscene(d)
+}
+addtask do_stash_locale_setscene
-glibc_package_preprocess () {
- rm -rf ${PKGD}/${includedir}/glibc-locale-internal-${MULTIMACH_TARGET_SYS}
- rm -rf ${PKGD}/${includedir}/glibc-scripts-internal-${MULTIMACH_TARGET_SYS}
+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.
for i in ${bashscripts}; do
- rm -f ${PKGD}${bindir}/$i
+ rm -f ${D}${bindir}/$i
done
- rm -rf ${PKGD}/${localedir}
+ 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
# This dir only exists to hold locales
- rm -rf ${PKGD}${exec_prefix}/lib
+ rm -rf ${D}${exec_prefix}/lib
fi
}
+addtask do_poststash_install_cleanup after do_stash_locale do_install before do_populate_sysroot do_package
pkg_postinst_nscd () {
if [ -z "$D" ]; then
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-scripts.inc b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-scripts.inc
index bce0a4210..2a2b41507 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-scripts.inc
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-scripts.inc
@@ -1,10 +1,10 @@
-include glibc-collateral.inc
+require glibc-collateral.inc
SUMMARY = "utility scripts provided by glibc"
DESCRIPTION = "utility scripts provided by glibc"
RDEPENDS_${PN} = "bash glibc-mtrace"
-SRC = "${STAGING_INCDIR}/glibc-scripts-internal-${MULTIMACH_TARGET_SYS}"
+SRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale/scripts"
bashscripts = "sotruss xtrace"
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-scripts_2.24.bb b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-scripts_2.25.bb
index 5a89bd802..5a89bd802 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-scripts_2.24.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc-scripts_2.25.bb
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc.inc b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc.inc
index 7bae0e955..21bbdc2ad 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc.inc
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc.inc
@@ -6,17 +6,15 @@ STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}"
PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
-TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
-
python () {
opt_effective = "-O"
- for opt in d.getVar('SELECTED_OPTIMIZATION', True).split():
+ 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', True), opt_effective))
+ bb.fatal("%s can't be built with %s, try -O1 instead" % (d.getVar('PN'), opt_effective))
if opt_effective in ("-O", "-O1", "-Os"):
- bb.note("%s doesn't build cleanly with %s, adding -Wno-error to SELECTED_OPTIMIZATION" % (d.getVar('PN', True), opt_effective))
+ bb.note("%s doesn't build cleanly with %s, adding -Wno-error to SELECTED_OPTIMIZATION" % (d.getVar('PN'), opt_effective))
d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error")
}
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0001-Add-atomic_exchange_relaxed.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0001-Add-atomic_exchange_relaxed.patch
deleted file mode 100644
index a33a135f7..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0001-Add-atomic_exchange_relaxed.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From ce74a620bf9e1a40b7ba06d35160e20633a4d8bb Mon Sep 17 00:00:00 2001
-From: Catalin Enache <catalin.enache@windriver.com>
-Date: Fri, 7 Jul 2017 13:11:16 +0300
-Subject: [PATCH 1/6] Add atomic_exchange_relaxed.
-
-* include/atomic.h (atomic_exchange_relaxed): New
-
-Upstream-Status: Backport
-
-Author: Torvald Riegel <triegel@redhat.com>
-Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
----
- ChangeLog | 4 ++++
- include/atomic.h | 9 +++++++++
- 2 files changed, 13 insertions(+)
-
-diff --git a/ChangeLog b/ChangeLog
-index 0fbda90..cb87279 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,3 +1,7 @@
-+2016-08-05 Torvald Riegel <triegel@redhat.com>
-+
-+ * include/atomic.h (atomic_exchange_relaxed): New.
-+
- 2016-01-28 Carlos O'Donell <carlos@redhat.com>
- Alexey Makhalov <amakhalov@vmware.com>
- Florian Weimer <fweimer@redhat.com>
-diff --git a/include/atomic.h b/include/atomic.h
-index ad3db25..129ee24 100644
---- a/include/atomic.h
-+++ b/include/atomic.h
-@@ -588,6 +588,9 @@ void __atomic_link_error (void);
- __atomic_compare_exchange_n ((mem), (expected), (desired), 1, \
- __ATOMIC_RELEASE, __ATOMIC_RELAXED); })
-
-+# define atomic_exchange_relaxed(mem, desired) \
-+ ({ __atomic_check_size((mem)); \
-+ __atomic_exchange_n ((mem), (desired), __ATOMIC_RELAXED); })
- # define atomic_exchange_acquire(mem, desired) \
- ({ __atomic_check_size((mem)); \
- __atomic_exchange_n ((mem), (desired), __ATOMIC_ACQUIRE); })
-@@ -684,6 +687,12 @@ void __atomic_link_error (void);
- *(expected) == __atg103_expected; })
- # endif
-
-+/* XXX Fall back to acquire MO because archs do not define a weaker
-+ atomic_exchange. */
-+# ifndef atomic_exchange_relaxed
-+# define atomic_exchange_relaxed(mem, val) \
-+ atomic_exchange_acq ((mem), (val))
-+# endif
- # ifndef atomic_exchange_acquire
- # define atomic_exchange_acquire(mem, val) \
- atomic_exchange_acq ((mem), (val))
---
-2.10.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0001-Include-locale_t.h-compatibility-header.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0001-Include-locale_t.h-compatibility-header.patch
new file mode 100644
index 000000000..a13c428e1
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0001-Include-locale_t.h-compatibility-header.patch
@@ -0,0 +1,29 @@
+From abfeb0cf4e3261a66a7a23abc9aed33c034c850d Mon Sep 17 00:00:00 2001
+From: Joshua Watt <Joshua.Watt@garmin.com>
+Date: Wed, 6 Dec 2017 13:26:19 -0600
+Subject: [PATCH] Include locale_t.h compatibility header
+
+Newer versions of glibc (since 2.26) moved the locale typedefs from
+xlocale.h to bits/types/locale_t.h. Create a compatibility header for
+these newer versions of glibc
+
+See f0be25b6336db7492e47d2e8e72eb8af53b5506d in glibc
+
+Upstream-Status: Inappropriate compatibility with newer host glibc
+Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
+
+---
+ locale/bits/types/locale_t.h | 1 +
+ 1 file changed, 1 insertion(+)
+ create mode 100644 locale/bits/types/locale_t.h
+
+diff --git a/locale/bits/types/locale_t.h b/locale/bits/types/locale_t.h
+new file mode 100644
+index 0000000000..b519a6c5f8
+--- /dev/null
++++ b/locale/bits/types/locale_t.h
+@@ -0,0 +1 @@
++#include <xlocale.h>
+--
+2.14.3
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch
index ca3375805..0553f8a47 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch
@@ -1,7 +1,7 @@
-From 7e11aafc3a7cb873b3f648740c8acd379597e4d1 Mon Sep 17 00:00:00 2001
+From 2727e58d1d269994de17cadb12195001b14585e7 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 01/25] nativesdk-glibc: Look for host system ld.so.cache as
+Subject: [PATCH 01/26] nativesdk-glibc: Look for host system ld.so.cache as
well
Upstream-Status: Inappropriate [embedded specific]
@@ -31,10 +31,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 c0d6249..2c73105 100644
+index 51fb0d0..f503dbc 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
-@@ -2094,6 +2094,14 @@ _dl_map_object (struct link_map *loader, const char *name,
+@@ -2054,6 +2054,14 @@ _dl_map_object (struct link_map *loader, const char *name,
}
}
@@ -49,7 +49,7 @@ index c0d6249..2c73105 100644
#ifdef USE_LDCONFIG
if (fd == -1
&& (__glibc_likely ((mode & __RTLD_SECURE) == 0)
-@@ -2152,14 +2160,6 @@ _dl_map_object (struct link_map *loader, const char *name,
+@@ -2112,14 +2120,6 @@ _dl_map_object (struct link_map *loader, const char *name,
}
#endif
@@ -65,5 +65,5 @@ index c0d6249..2c73105 100644
if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
_dl_debug_printf ("\n");
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0002-Add-atomic-operations-required-by-the-new-condition-.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0002-Add-atomic-operations-required-by-the-new-condition-.patch
deleted file mode 100644
index c4747fa27..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0002-Add-atomic-operations-required-by-the-new-condition-.patch
+++ /dev/null
@@ -1,124 +0,0 @@
-From b85e30e655027132c4326d2fdde010c517165aaf Mon Sep 17 00:00:00 2001
-From: Catalin Enache <catalin.enache@windriver.com>
-Date: Fri, 30 Jun 2017 14:27:34 +0300
-Subject: [PATCH 2/6] Add atomic operations required by the new condition
- variable.
-
- * include/atomic.h (atomic_fetch_and_relaxed,
- atomic_fetch_and_release, atomic_fetch_or_release,
- atomic_fetch_xor_release): New.
-
-Upstream-Status: Backport
-
-Author: Torvald Riegel <triegel@redhat.com>
-Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
----
- ChangeLog | 6 ++++++
- include/atomic.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 53 insertions(+)
-
-diff --git a/ChangeLog b/ChangeLog
-index cb87279..96b6da2 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,3 +1,9 @@
-+2016-08-09 Torvald Riegel <triegel@redhat.com>
-+
-+ * include/atomic.h (atomic_fetch_and_relaxed,
-+ atomic_fetch_and_release, atomic_fetch_or_release,
-+ atomic_fetch_xor_release): New.
-+
- 2016-08-05 Torvald Riegel <triegel@redhat.com>
-
- * include/atomic.h (atomic_exchange_relaxed): New.
-diff --git a/include/atomic.h b/include/atomic.h
-index 129ee24..5a8e7e7 100644
---- a/include/atomic.h
-+++ b/include/atomic.h
-@@ -611,9 +611,15 @@ void __atomic_link_error (void);
- ({ __atomic_check_size((mem)); \
- __atomic_fetch_add ((mem), (operand), __ATOMIC_ACQ_REL); })
-
-+# define atomic_fetch_and_relaxed(mem, operand) \
-+ ({ __atomic_check_size((mem)); \
-+ __atomic_fetch_and ((mem), (operand), __ATOMIC_RELAXED); })
- # define atomic_fetch_and_acquire(mem, operand) \
- ({ __atomic_check_size((mem)); \
- __atomic_fetch_and ((mem), (operand), __ATOMIC_ACQUIRE); })
-+# define atomic_fetch_and_release(mem, operand) \
-+ ({ __atomic_check_size((mem)); \
-+ __atomic_fetch_and ((mem), (operand), __ATOMIC_RELEASE); })
-
- # define atomic_fetch_or_relaxed(mem, operand) \
- ({ __atomic_check_size((mem)); \
-@@ -621,6 +627,13 @@ void __atomic_link_error (void);
- # define atomic_fetch_or_acquire(mem, operand) \
- ({ __atomic_check_size((mem)); \
- __atomic_fetch_or ((mem), (operand), __ATOMIC_ACQUIRE); })
-+# define atomic_fetch_or_release(mem, operand) \
-+ ({ __atomic_check_size((mem)); \
-+ __atomic_fetch_or ((mem), (operand), __ATOMIC_RELEASE); })
-+
-+# define atomic_fetch_xor_release(mem, operand) \
-+ ({ __atomic_check_size((mem)); \
-+ __atomic_fetch_xor ((mem), (operand), __ATOMIC_RELEASE); })
-
- #else /* !USE_ATOMIC_COMPILER_BUILTINS */
-
-@@ -724,12 +737,24 @@ void __atomic_link_error (void);
- atomic_exchange_and_add_acq ((mem), (operand)); })
- # endif
-
-+/* XXX Fall back to acquire MO because archs do not define a weaker
-+ atomic_and_val. */
-+# ifndef atomic_fetch_and_relaxed
-+# define atomic_fetch_and_relaxed(mem, operand) \
-+ atomic_fetch_and_acquire ((mem), (operand))
-+# endif
- /* XXX The default for atomic_and_val has acquire semantics, but this is not
- documented. */
- # ifndef atomic_fetch_and_acquire
- # define atomic_fetch_and_acquire(mem, operand) \
- atomic_and_val ((mem), (operand))
- # endif
-+# ifndef atomic_fetch_and_release
-+/* XXX This unnecessarily has acquire MO. */
-+# define atomic_fetch_and_release(mem, operand) \
-+ ({ atomic_thread_fence_release (); \
-+ atomic_and_val ((mem), (operand)); })
-+# endif
-
- /* XXX The default for atomic_or_val has acquire semantics, but this is not
- documented. */
-@@ -743,6 +768,28 @@ void __atomic_link_error (void);
- # define atomic_fetch_or_relaxed(mem, operand) \
- atomic_fetch_or_acquire ((mem), (operand))
- # endif
-+/* XXX Contains an unnecessary acquire MO because archs do not define a weaker
-+ atomic_or_val. */
-+# ifndef atomic_fetch_or_release
-+# define atomic_fetch_or_release(mem, operand) \
-+ ({ atomic_thread_fence_release (); \
-+ atomic_fetch_or_acquire ((mem), (operand)); })
-+# endif
-+
-+# ifndef atomic_fetch_xor_release
-+# define atomic_fetch_xor_release(mem, operand) \
-+ ({ __typeof (*(mem)) __atg104_old; \
-+ __typeof (mem) __atg104_memp = (mem); \
-+ __typeof (*(mem)) __atg104_op = (operand); \
-+ \
-+ do \
-+ __atg104_old = (*__atg104_memp); \
-+ while (__builtin_expect \
-+ (atomic_compare_and_exchange_bool_rel ( \
-+ __atg104_memp, __atg104_old ^ __atg104_op, __atg104_old), 0));\
-+ \
-+ __atg104_old; })
-+#endif
-
- #endif /* !USE_ATOMIC_COMPILER_BUILTINS */
-
---
-2.10.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0002-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0002-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch
index 5428468c5..e5ef3410e 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0002-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0002-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch
@@ -1,7 +1,7 @@
-From 5fd884dc28d5d84001fae8ffdd8be698bb84143e Mon Sep 17 00:00:00 2001
+From 1578f52647ec8804186d1944d4cd2095132efc39 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 02/25] nativesdk-glibc: Fix buffer overrun with a relocated
+Subject: [PATCH 02/26] nativesdk-glibc: Fix buffer overrun with a relocated
SDK
When ld-linux-*.so.2 is relocated to a path that is longer than the
@@ -22,10 +22,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 2c73105..c7b8797 100644
+index f503dbc..3a3d112 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
-@@ -1793,7 +1793,19 @@ open_path (const char *name, size_t namelen, int mode,
+@@ -1753,7 +1753,19 @@ open_path (const char *name, size_t namelen, int mode,
given on the command line when rtld is run directly. */
return -1;
@@ -46,5 +46,5 @@ index 2c73105..c7b8797 100644
{
struct r_search_path_elem *this_dir = *dirs;
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0003-Add-pretty-printers-for-the-NPTL-lock-types.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0003-Add-pretty-printers-for-the-NPTL-lock-types.patch
deleted file mode 100644
index 9eb635d71..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0003-Add-pretty-printers-for-the-NPTL-lock-types.patch
+++ /dev/null
@@ -1,3197 +0,0 @@
-From 246fee86fc90c57738ee282a061039f82832f4ea Mon Sep 17 00:00:00 2001
-From: Catalin Enache <catalin.enache@windriver.com>
-Date: Fri, 30 Jun 2017 13:42:04 +0300
-Subject: [PATCH 3/6] Add pretty printers for the NPTL lock types
-
-This patch adds pretty printers for the following NPTL types:
-
-- pthread_mutex_t
-- pthread_mutexattr_t
-- pthread_cond_t
-- pthread_condattr_t
-- pthread_rwlock_t
-- pthread_rwlockattr_t
-
-To load the pretty printers into your gdb session, do the following:
-
-python
-import sys
-sys.path.insert(0, '/path/to/glibc/build/nptl/pretty-printers')
-end
-
-source /path/to/glibc/source/pretty-printers/nptl-printers.py
-
-You can check which printers are registered and enabled by issuing the
-'info pretty-printer' gdb command. Printers should trigger automatically when
-trying to print a variable of one of the types mentioned above.
-
-The printers are architecture-independent, and were tested on an AMD64 running
-Ubuntu 14.04 and an x86 VM running Fedora 24.
-
-In order to work, the printers need to know the values of various flags that
-are scattered throughout pthread.h and pthreadP.h as enums and #defines. Since
-replicating these constants in the printers file itself would create a
-maintenance burden, I wrote a script called gen-py-const.awk that Makerules uses
-to extract the constants. This script is pretty much the same as gen-as-const.awk,
-except it doesn't cast the constant values to 'long' and is thorougly documented.
-The constants need only to be enumerated in a .pysym file, which is then referenced
-by a Make variable called gen-py-const-headers.
-
-As for the install directory, I discussed this with Mike Frysinger and Siddhesh
-Poyarekar, and we agreed that it can be handled in a separate patch, and shouldn't
-block merging of this one.
-
-In addition, I've written a series of test cases for the pretty printers.
-Each lock type (mutex, condvar and rwlock) has two test programs, one for itself
-and other for its related 'attributes' object. Each test program in turn has a
-PExpect-based Python script that drives gdb and compares its output to the
-expected printer's. The tests run on the glibc host, which is assumed to have
-both gdb and PExpect; if either is absent the tests will fail with code 77
-(UNSUPPORTED). For cross-testing you should use cross-test-ssh.sh as test-wrapper.
-I've tested the printers on both native builds and a cross build using a Beaglebone
-Black running Debian, with the build system's filesystem shared with the board
-through NFS.
-
-Finally, I've written a README that explains all this and more.
-
- * INSTALL: Regenerated.
- * Makeconfig: Add comments and whitespace to make the control flow
- clearer.
- (+link-printers-tests, +link-pie-printers-tests, CFLAGS-printers-tests,
- installed-rtld-LDFLAGS, built-rtld-LDFLAGS, link-libc-rpath,
- link-libc-tests-after-rpath-link, link-libc-printers-tests): New.
- (rtld-LDFLAGS, rtld-tests-LDFLAGS, link-libc-tests-rpath-link,
- link-libc-tests): Use the new variables as required.
- * Makerules ($(py-const)): New rule.
- generated: Add $(py-const).
- * README.pretty-printers: New file.
- * Rules (tests-printers-programs, tests-printers-out, py-env): New.
- (others): Depend on $(py-const).
- (tests): Depend on $(tests-printers-programs) or $(tests-printers-out),
- as required. Pass $(tests-printers) to merge-test-results.sh.
- * manual/install.texi: Add requirements for testing the pretty printers.
- * nptl/Makefile (gen-py-const-headers, pretty-printers, tests-printers,
- CFLAGS-test-mutexattr-printers.c CFLAGS-test-mutex-printers.c,
- CFLAGS-test-condattr-printers.c, CFLAGS-test-cond-printers.c,
- CFLAGS-test-rwlockattr-printers.c CFLAGS-test-rwlock-printers.c,
- tests-printers-libs): Define.
- * nptl/nptl-printers.py: New file.
- * nptl/nptl_lock_constants.pysym: Likewise.
- * nptl/test-cond-printers.c: Likewise.
- * nptl/test-cond-printers.py: Likewise.
- * nptl/test-condattr-printers.c: Likewise.
- * nptl/test-condattr-printers.py: Likewise.
- * nptl/test-mutex-printers.c: Likewise.
- * nptl/test-mutex-printers.py: Likewise.
- * nptl/test-mutexattr-printers.c: Likewise.
- * nptl/test-mutexattr-printers.py: Likewise.
- * nptl/test-rwlock-printers.c: Likewise.
- * nptl/test-rwlock-printers.py: Likewise.
- * nptl/test-rwlockattr-printers.c: Likewise.
- * nptl/test-rwlockattr-printers.py: Likewise.
- * scripts/gen-py-const.awk: Likewise.
- * scripts/test_printers_common.py: Likewise.
- * scripts/test_printers_exceptions.py: Likewise.
-
-Upstream-Status: Backport
-
-Author: Martin Galvan <martin.galvan@tallertechnologies.com>
-Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
----
- ChangeLog | 45 +++
- INSTALL | 27 ++
- Makeconfig | 76 ++++-
- Makerules | 46 +++
- NEWS | 6 +
- README.pretty-printers | 169 ++++++++++
- Rules | 44 ++-
- manual/install.texi | 30 ++
- nptl/Makefile | 18 +
- nptl/nptl-printers.py | 633 ++++++++++++++++++++++++++++++++++++
- nptl/nptl_lock_constants.pysym | 75 +++++
- nptl/test-cond-printers.c | 57 ++++
- nptl/test-cond-printers.py | 50 +++
- nptl/test-condattr-printers.c | 94 ++++++
- nptl/test-condattr-printers.py | 71 ++++
- nptl/test-mutex-printers.c | 151 +++++++++
- nptl/test-mutex-printers.py | 97 ++++++
- nptl/test-mutexattr-printers.c | 144 ++++++++
- nptl/test-mutexattr-printers.py | 101 ++++++
- nptl/test-rwlock-printers.c | 78 +++++
- nptl/test-rwlock-printers.py | 64 ++++
- nptl/test-rwlockattr-printers.c | 98 ++++++
- nptl/test-rwlockattr-printers.py | 73 +++++
- scripts/gen-py-const.awk | 118 +++++++
- scripts/test_printers_common.py | 364 +++++++++++++++++++++
- scripts/test_printers_exceptions.py | 61 ++++
- 26 files changed, 2770 insertions(+), 20 deletions(-)
- create mode 100644 README.pretty-printers
- create mode 100644 nptl/nptl-printers.py
- create mode 100644 nptl/nptl_lock_constants.pysym
- create mode 100644 nptl/test-cond-printers.c
- create mode 100644 nptl/test-cond-printers.py
- create mode 100644 nptl/test-condattr-printers.c
- create mode 100644 nptl/test-condattr-printers.py
- create mode 100644 nptl/test-mutex-printers.c
- create mode 100644 nptl/test-mutex-printers.py
- create mode 100644 nptl/test-mutexattr-printers.c
- create mode 100644 nptl/test-mutexattr-printers.py
- create mode 100644 nptl/test-rwlock-printers.c
- create mode 100644 nptl/test-rwlock-printers.py
- create mode 100644 nptl/test-rwlockattr-printers.c
- create mode 100644 nptl/test-rwlockattr-printers.py
- create mode 100644 scripts/gen-py-const.awk
- create mode 100644 scripts/test_printers_common.py
- create mode 100644 scripts/test_printers_exceptions.py
-
-diff --git a/ChangeLog b/ChangeLog
-index 96b6da2..8036c1e 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,3 +1,48 @@
-+2016-12-08 Martin Galvan <martin.galvan@tallertechnologies.com>
-+
-+ * INSTALL: Regenerated.
-+ * Makeconfig: Add comments and whitespace to make the control flow
-+ clearer.
-+ (+link-printers-tests, +link-pie-printers-tests,
-+ CFLAGS-printers-tests, installed-rtld-LDFLAGS,
-+ built-rtld-LDFLAGS, link-libc-rpath,
-+ link-libc-tests-after-rpath-link,
-+ link-libc-printers-tests): New.
-+ (rtld-LDFLAGS, rtld-tests-LDFLAGS, link-libc-tests-rpath-link,
-+ link-libc-tests): Use the new variables as required.
-+ * Makerules ($(py-const)): New rule.
-+ generated: Add $(py-const).
-+ * README.pretty-printers: New file.
-+ * Rules (tests-printers-programs, tests-printers-out, py-env): New.
-+ (others): Depend on $(py-const).
-+ (tests): Depend on $(tests-printers-programs) or
-+ $(tests-printers-out),
-+ as required. Pass $(tests-printers) to merge-test-results.sh.
-+ * manual/install.texi: Add requirements for testing the pretty
-+ printers.
-+ * nptl/Makefile (gen-py-const-headers, pretty-printers,
-+ tests-printers, CFLAGS-test-mutexattr-printers.c
-+ CFLAGS-test-mutex-printers.c, CFLAGS-test-condattr-printers.c,
-+ CFLAGS-test-cond-printers.c, CFLAGS-test-rwlockattr-printers.c
-+ CFLAGS-test-rwlock-printers.c, tests-printers-libs): Define.
-+ * nptl/nptl-printers.py: New file.
-+ * nptl/nptl_lock_constants.pysym: Likewise.
-+ * nptl/test-cond-printers.c: Likewise.
-+ * nptl/test-cond-printers.py: Likewise.
-+ * nptl/test-condattr-printers.c: Likewise.
-+ * nptl/test-condattr-printers.py: Likewise.
-+ * nptl/test-mutex-printers.c: Likewise.
-+ * nptl/test-mutex-printers.py: Likewise.
-+ * nptl/test-mutexattr-printers.c: Likewise.
-+ * nptl/test-mutexattr-printers.py: Likewise.
-+ * nptl/test-rwlock-printers.c: Likewise.
-+ * nptl/test-rwlock-printers.py: Likewise.
-+ * nptl/test-rwlockattr-printers.c: Likewise.
-+ * nptl/test-rwlockattr-printers.py: Likewise.
-+ * scripts/gen-py-const.awk: Likewise.
-+ * scripts/test_printers_common.py: Likewise.
-+ * scripts/test_printers_exceptions.py: Likewise.
-+
- 2016-08-09 Torvald Riegel <triegel@redhat.com>
-
- * include/atomic.h (atomic_fetch_and_relaxed,
-diff --git a/INSTALL b/INSTALL
-index ec3445f..dd62c86 100644
---- a/INSTALL
-+++ b/INSTALL
-@@ -224,6 +224,33 @@ You can specify 'stop-on-test-failure=y' when running 'make check' to
- make the test run stop and exit with an error status immediately when a
- failure occurs.
-
-+ The GNU C Library pretty printers come with their own set of scripts
-+for testing, which run together with the rest of the testsuite through
-+'make check'. These scripts require the following tools to run
-+successfully:
-+
-+ * Python 2.7.6/3.4.3 or later
-+
-+ Python is required for running the printers' test scripts.
-+
-+ * PExpect 4.0
-+
-+ The printer tests drive GDB through test programs and compare its
-+ output to the printers'. PExpect is used to capture the output of
-+ GDB, and should be compatible with the Python version in your
-+ system.
-+
-+ * GDB 7.8 or later with support for Python 2.7.6/3.4.3 or later
-+
-+ GDB itself needs to be configured with Python support in order to
-+ use the pretty printers. Notice that your system having Python
-+ available doesn't imply that GDB supports it, nor that your
-+ system's Python and GDB's have the same version.
-+
-+If these tools are absent, the printer tests will report themselves as
-+'UNSUPPORTED'. Notice that some of the printer tests require the GNU C
-+Library to be compiled with debugging symbols.
-+
- To format the 'GNU C Library Reference Manual' for printing, type
- 'make dvi'. You need a working TeX installation to do this. The
- distribution builds the on-line formatted version of the manual, as Info
-diff --git a/Makeconfig b/Makeconfig
-index 03fd89c..2d92d94 100644
---- a/Makeconfig
-+++ b/Makeconfig
-@@ -416,6 +416,11 @@ $(+link-pie-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \
- $(+link-pie-after-libc)
- $(call after-link,$@)
- endef
-+define +link-pie-printers-tests
-+$(+link-pie-before-libc) $(built-rtld-LDFLAGS) $(link-libc-printers-tests) \
-+ $(+link-pie-after-libc)
-+$(call after-link,$@)
-+endef
- endif
- # Command for statically linking programs with the C library.
- ifndef +link-static
-@@ -445,7 +450,8 @@ ifeq (yes,$(build-pie-default))
- no-pie-ldflag = -no-pie
- +link = $(+link-pie)
- +link-tests = $(+link-pie-tests)
--else
-++link-printers-tests = $(+link-pie-printers-tests)
-+else # not build-pie-default
- +link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \
- $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
- $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
-@@ -466,51 +472,87 @@ $(+link-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \
- $(+link-after-libc)
- $(call after-link,$@)
- endef
--endif
--else
-+define +link-printers-tests
-+$(+link-before-libc) $(built-rtld-LDFLAGS) $(link-libc-printers-tests) \
-+ $(+link-after-libc)
-+$(call after-link,$@)
-+endef
-+endif # build-pie-default
-+else # build-static
- +link = $(+link-static)
- +link-tests = $(+link-static-tests)
--endif
--endif
-++link-printers-tests = $(+link-static-tests)
-+endif # build-shared
-+endif # +link
-+
-+# The pretty printer test programs need to be compiled without optimizations
-+# so they won't confuse gdb. We could use either the 'GCC optimize' pragma
-+# or the 'optimize' function attribute to achieve this; however, at least on
-+# ARM, gcc always produces different debugging symbols when invoked with
-+# a -O greater than 0 than when invoked with -O0, regardless of anything else
-+# we're using to suppress optimizations. Therefore, we need to explicitly pass
-+# -O0 to it through CFLAGS.
-+# Additionally, the build system will try to -include $(common-objpfx)/config.h
-+# when compiling the tests, which will throw an error if some special macros
-+# (such as __OPTIMIZE__ and IS_IN_build) aren't defined. To avoid this, we
-+# tell gcc to define IS_IN_build.
-+CFLAGS-printers-tests := -O0 -ggdb3 -DIS_IN_build
-+
- ifeq (yes,$(build-shared))
-+# These indicate whether to link using the built ld.so or the installed one.
-+installed-rtld-LDFLAGS = -Wl,-dynamic-linker=$(rtlddir)/$(rtld-installed-name)
-+built-rtld-LDFLAGS = -Wl,-dynamic-linker=$(elf-objpfx)ld.so
-+
- ifndef rtld-LDFLAGS
--rtld-LDFLAGS = -Wl,-dynamic-linker=$(rtlddir)/$(rtld-installed-name)
-+rtld-LDFLAGS = $(installed-rtld-LDFLAGS)
- endif
-+
- ifndef rtld-tests-LDFLAGS
- ifeq (yes,$(build-hardcoded-path-in-tests))
--rtld-tests-LDFLAGS = -Wl,-dynamic-linker=$(elf-objpfx)ld.so
-+rtld-tests-LDFLAGS = $(built-rtld-LDFLAGS)
- else
--rtld-tests-LDFLAGS = $(rtld-LDFLAGS)
--endif
--endif
--endif
-+rtld-tests-LDFLAGS = $(installed-rtld-LDFLAGS)
-+endif # build-hardcoded-path-in-tests
-+endif # rtld-tests-LDFLAGS
-+
-+endif # build-shared
-+
- ifndef link-libc
- ifeq (yes,$(build-shared))
- # We need the versioned name of libc.so in the deps of $(others) et al
- # so that the symlink to libc.so is created before anything tries to
- # run the linked programs.
-+link-libc-rpath = -Wl,-rpath=$(rpath-link)
- link-libc-rpath-link = -Wl,-rpath-link=$(rpath-link)
-+
- ifeq (yes,$(build-hardcoded-path-in-tests))
--link-libc-tests-rpath-link = -Wl,-rpath=$(rpath-link)
-+link-libc-tests-rpath-link = $(link-libc-rpath)
- else
- link-libc-tests-rpath-link = $(link-libc-rpath-link)
--endif
-+endif # build-hardcoded-path-in-tests
-+
- link-libc-before-gnulib = $(common-objpfx)libc.so$(libc.so-version) \
- $(common-objpfx)$(patsubst %,$(libtype.oS),c) \
- $(as-needed) $(elf-objpfx)ld.so \
- $(no-as-needed)
- link-libc = $(link-libc-rpath-link) $(link-libc-before-gnulib) $(gnulib)
-+
-+link-libc-tests-after-rpath-link = $(link-libc-before-gnulib) $(gnulib-tests)
- link-libc-tests = $(link-libc-tests-rpath-link) \
-- $(link-libc-before-gnulib) $(gnulib-tests)
-+ $(link-libc-tests-after-rpath-link)
-+# Pretty printer test programs always require rpath instead of rpath-link.
-+link-libc-printers-tests = $(link-libc-rpath) \
-+ $(link-libc-tests-after-rpath-link)
-+
- # This is how to find at build-time things that will be installed there.
- rpath-dirs = math elf dlfcn nss nis rt resolv crypt mathvec
- rpath-link = \
- $(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%)))
--else
-+else # build-static
- link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib)
- link-libc-tests = $(common-objpfx)libc.a $(otherlibs) $(gnulib-tests) $(common-objpfx)libc.a $(gnulib-tests)
--endif
--endif
-+endif # build-shared
-+endif # link-libc
-
- # Differences in the linkers on the various platforms.
- LDFLAGS-rpath-ORIGIN = -Wl,-rpath,'$$ORIGIN'
-diff --git a/Makerules b/Makerules
-index be3c11b..b7e0f59 100644
---- a/Makerules
-+++ b/Makerules
-@@ -214,6 +214,52 @@ sed-remove-dotdot := -e 's@ *\([^ \/$$][^ \]*\)@ $$(..)\1@g' \
- -e 's@^\([^ \/$$][^ \]*\)@$$(..)\1@g'
- endif
-
-+ifdef gen-py-const-headers
-+# We'll use a static pattern rule to match .pysym files with their
-+# corresponding generated .py files.
-+# The generated .py files go in the submodule's dir in the glibc build dir.
-+py-const-files := $(patsubst %.pysym,%.py,$(gen-py-const-headers))
-+py-const-dir := $(objpfx)
-+py-const := $(addprefix $(py-const-dir),$(py-const-files))
-+py-const-script := $(..)scripts/gen-py-const.awk
-+
-+# This is a hack we use to generate .py files with constants for Python
-+# pretty printers. It works the same way as gen-as-const.
-+# See scripts/gen-py-const.awk for details on how the awk | gcc mechanism
-+# works.
-+#
-+# $@.tmp and $@.tmp2 are temporary files we use to store the partial contents
-+# of the target file. We do this instead of just writing on $@ because, if the
-+# build process terminates prematurely, re-running Make wouldn't run this rule
-+# since Make would see that the target file already exists (despite it being
-+# incomplete).
-+#
-+# The sed line replaces "@name@SOME_NAME@value@SOME_VALUE@" strings from the
-+# output of 'gcc -S' with "SOME_NAME = SOME_VALUE" strings.
-+# The '-n' option, combined with the '/p' command, makes sed output only the
-+# modified lines instead of the whole input file. The output is redirected
-+# to a .py file; we'll import it in the pretty printers file to read
-+# the constants generated by gen-py-const.awk.
-+# The regex has two capturing groups, for SOME_NAME and SOME_VALUE
-+# respectively. Notice SOME_VALUE may be prepended by a special character,
-+# depending on the assembly syntax (e.g. immediates are prefixed by a '$'
-+# in AT&T x86, and by a '#' in ARM). We discard it using a complemented set
-+# before the second capturing group.
-+$(py-const): $(py-const-dir)%.py: %.pysym $(py-const-script) \
-+ $(common-before-compile)
-+ $(make-target-directory)
-+ $(AWK) -f $(py-const-script) $< \
-+ | $(CC) -S -o $@.tmp $(CFLAGS) $(CPPFLAGS) -x c -
-+ echo '# GENERATED FILE\n' > $@.tmp2
-+ echo '# Constant definitions for pretty printers.' >> $@.tmp2
-+ echo '# See gen-py-const.awk for details.\n' >> $@.tmp2
-+ sed -n -r 's/^.*@name@([^@]+)@value@[^[:xdigit:]Xx-]*([[:xdigit:]Xx-]+)@.*/\1 = \2/p' \
-+ $@.tmp >> $@.tmp2
-+ mv -f $@.tmp2 $@
-+ rm -f $@.tmp
-+
-+generated += $(py-const)
-+endif # gen-py-const-headers
-
- ifdef gen-as-const-headers
- # Generating headers for assembly constants.
-diff --git a/NEWS b/NEWS
-index b0447e7..3002773 100644
---- a/NEWS
-+++ b/NEWS
-@@ -5,6 +5,12 @@ See the end for copying conditions.
- Please send GNU C library bug reports via <http://sourceware.org/bugzilla/>
- using `glibc' in the "product" field.
-
-+
-+* GDB pretty printers have been added for mutex and condition variable
-+ structures in POSIX Threads. When installed and loaded in gdb these pretty
-+ printers show various pthread variables in human-readable form when read
-+ using the 'print' or 'display' commands in gdb.
-+
- Version 2.24
-
- * The minimum Linux kernel version that this version of the GNU C Library
-diff --git a/README.pretty-printers b/README.pretty-printers
-new file mode 100644
-index 0000000..8662900
---- /dev/null
-+++ b/README.pretty-printers
-@@ -0,0 +1,169 @@
-+README for the glibc Python pretty printers
-+===========================================
-+
-+Pretty printers are gdb extensions that allow it to print useful, human-readable
-+information about a program's variables. For example, for a pthread_mutex_t
-+gdb would usually output something like this:
-+
-+(gdb) print mutex
-+$1 = {
-+ __data = {
-+ __lock = 22020096,
-+ __count = 0,
-+ __owner = 0,
-+ __nusers = 0,
-+ __kind = 576,
-+ __spins = 0,
-+ __elision = 0,
-+ __list = {
-+ __prev = 0x0,
-+ __next = 0x0
-+ }
-+ },
-+ __size = "\000\000P\001", '\000' <repeats 12 times>, "@\002", '\000' <repeats 21 times>,
-+ __align = 22020096
-+}
-+
-+However, with a pretty printer gdb will output something like this:
-+
-+(gdb) print mutex
-+$1 = pthread_mutex_t = {
-+ Type = Normal,
-+ Status = Unlocked,
-+ Robust = No,
-+ Shared = No,
-+ Protocol = Priority protect,
-+ Priority ceiling = 42
-+}
-+
-+Before printing a value, gdb will first check if there's a pretty printer
-+registered for it. If there is, it'll use it, otherwise it'll print the value
-+as usual. Pretty printers can be registered in various ways; for our purposes
-+we register them for the current objfile by calling
-+gdb.printing.register_pretty_printer().
-+
-+Currently our printers are based on gdb.RegexpCollectionPrettyPrinter, which
-+means they'll be triggered if the type of the variable we're printing matches
-+a given regular expression. For example, MutexPrinter will be triggered if
-+our variable's type matches the regexp '^pthread_mutex_t$'.
-+
-+Besides the printers themselves, each module may have a constants file which the
-+printers will import. These constants are generated from C headers during the
-+build process, and need to be in the Python search path when loading the
-+printers.
-+
-+
-+Installing and loading
-+----------------------
-+
-+The pretty printers and their constant files may be installed in different paths
-+for each distro, though gdb should be able to automatically load them by itself.
-+When in doubt, you can use the 'info pretty-printer' gdb command to list the
-+loaded pretty printers.
-+
-+If the printers aren't automatically loaded for some reason, you should add the
-+following to your .gdbinit:
-+
-+python
-+import sys
-+sys.path.insert(0, '/path/to/constants/file/directory')
-+end
-+
-+source /path/to/printers.py
-+
-+If you're building glibc manually, '/path/to/constants/file/directory' should be
-+'/path/to/glibc-build/submodule', where 'submodule' is e.g. nptl.
-+
-+
-+Testing
-+-------
-+
-+The pretty printers come with a small test suite based on PExpect, which is a
-+Python module with Expect-like features for spawning and controlling interactive
-+programs. Each printer has a corresponding C program and a Python script
-+that uses PExpect to drive gdb through the program and compare its output to
-+the expected printer's.
-+
-+The tests run on the glibc host, which is assumed to have both gdb and PExpect;
-+if any of those is absent the tests will fail with code 77 (UNSUPPORTED).
-+Native builds can be tested simply by doing 'make check'; cross builds must use
-+cross-test-ssh.sh as test-wrapper, like this:
-+
-+make test-wrapper='/path/to/scripts/cross-test-ssh.sh user@host' check
-+
-+(Remember to share the build system's filesystem with the glibc host's through
-+NFS or something similar).
-+
-+Running 'make check' on a cross build will only compile the test programs,
-+without running the scripts.
-+
-+
-+Adding new pretty printers
-+--------------------------
-+
-+Adding new pretty printers to glibc requires following these steps:
-+
-+1. Identify which constants must be generated from C headers, and write the
-+corresponding .pysym file. See scripts/gen-py-const.awk for more information
-+on how this works. The name of the .pysym file must be added to the
-+'gen-py-const-headers' variable in your submodule's Makefile (without the .pysym
-+extension).
-+
-+2. Write the pretty printer code itself. For this you can follow the gdb
-+Python API documentation, and use the existing printers as examples. The printer
-+code must import the generated constants file (which will have the same name
-+as your .pysym file). The names of the pretty printer files must be added
-+to the 'pretty-printers' variable in your submodule's Makefile (without the .py
-+extension).
-+
-+3. Write the unit tests for your pretty printers. The build system calls each
-+test script passing it the paths to the test program source, the test program
-+binary, and the printer files you added to 'pretty-printers' in the previous
-+step. The test scripts, in turn, must import scripts/test_printers_common
-+and call the init_test function passing it, among other things, the name of the
-+set of pretty printers to enable (as seen by running 'info pretty-printer').
-+You can use the existing unit tests as examples.
-+
-+4. Add the names of the pretty printer tests to the 'tests-printers' variable
-+in your submodule's Makefile (without extensions). In addition, for each test
-+program you must define a corresponding CFLAGS-* variable and set it to
-+$(CFLAGS-printers-tests) to ensure they're compiled correctly. For example,
-+test-foo-printer.c requires the following:
-+
-+CFLAGS-test-foo-printer.c := $(CFLAGS-printers-tests)
-+
-+Finally, if your programs need to be linked with a specific library, you can add
-+its name to the 'tests-printers-libs' variable in your submodule's Makefile.
-+
-+
-+Known issues
-+------------
-+
-+* Pretty printers are inherently coupled to the code they're targetting, thus
-+any changes to the target code must also update the corresponding printers.
-+On the plus side, the printer code itself may serve as a kind of documentation
-+for the target code.
-+
-+* Older versions of the gdb Python API have a bug where
-+gdb.RegexpCollectionPrettyPrinter would not be able to get a value's real type
-+if it was typedef'd. This would cause gdb to ignore the pretty printers for
-+types like pthread_mutex_t, which is defined as:
-+
-+typedef union
-+{
-+ ...
-+} pthread_mutex_t;
-+
-+This was fixed in commit 1b588015839caafc608a6944a78aea170f5fb2f6, and released
-+as part of gdb 7.8. However, typedef'ing an already typedef'd type may cause
-+a similar issue, e.g.:
-+
-+typedef pthread_mutex_t mutex;
-+mutex a_mutex;
-+
-+Here, trying to print a_mutex won't trigger the pthread_mutex_t printer.
-+
-+* The test programs must be compiled without optimizations. This is necessary
-+because the test scripts rely on the C code structure being preserved when
-+stepping through the programs. Things like aggressive instruction reordering
-+or optimizing variables out may make this kind of testing impossible.
-diff --git a/Rules b/Rules
-index 8306d36..10a6479 100644
---- a/Rules
-+++ b/Rules
-@@ -85,16 +85,27 @@ common-generated += dummy.o dummy.c
-
- .PHONY: others tests bench bench-build
-
-+# Test programs for the pretty printers.
-+tests-printers-programs := $(addprefix $(objpfx),$(tests-printers))
-+
-+# .out files with the output of running the pretty printer tests.
-+tests-printers-out := $(patsubst %,$(objpfx)%.out,$(tests-printers))
-+
- ifeq ($(build-programs),yes)
- others: $(addprefix $(objpfx),$(others) $(sysdep-others) $(extra-objs))
- else
- others: $(addprefix $(objpfx),$(extra-objs))
- endif
-+
-+# Generate constant files for Python pretty printers if required.
-+others: $(py-const)
-+
- ifeq ($(run-built-tests),no)
--tests: $(addprefix $(objpfx),$(tests) $(test-srcs)) $(tests-special)
-+tests: $(addprefix $(objpfx),$(tests) $(test-srcs)) $(tests-special) \
-+ $(tests-printers-programs)
- xtests: tests $(xtests-special)
- else
--tests: $(tests:%=$(objpfx)%.out) $(tests-special)
-+tests: $(tests:%=$(objpfx)%.out) $(tests-special) $(tests-printers-out)
- xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-special)
- endif
-
-@@ -102,7 +113,8 @@ tests-special-notdir = $(patsubst $(objpfx)%, %, $(tests-special))
- xtests-special-notdir = $(patsubst $(objpfx)%, %, $(xtests-special))
- tests:
- $(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \
-- $(sort $(tests) $(tests-special-notdir:.out=)) \
-+ $(sort $(tests) $(tests-special-notdir:.out=) \
-+ $(tests-printers)) \
- > $(objpfx)subdir-tests.sum
- xtests:
- $(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \
-@@ -212,6 +224,32 @@ endif
-
- endif # tests
-
-+ifneq "$(strip $(tests-printers))" ""
-+# We're defining this here for now; later it'll be defined at configure time
-+# inside Makeconfig.
-+PYTHON := python
-+
-+# Static pattern rule for building the test programs for the pretty printers.
-+$(tests-printers-programs): %: %.o $(tests-printers-libs) \
-+ $(sort $(filter $(common-objpfx)lib%,$(link-libc-static-tests))) \
-+ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
-+ $(+link-printers-tests)
-+
-+# Add the paths to the generated constants file and test_common_printers.py
-+# to PYTHONPATH so the test scripts can find them.
-+py-env := PYTHONPATH=$(py-const-dir):$(..)scripts:$${PYTHONPATH}
-+
-+# Static pattern rule that matches the test-* targets to their .c and .py
-+# prerequisites. It'll run the corresponding test script for each test program
-+# we compiled and place its output in the corresponding .out file.
-+# The pretty printer files and test_common_printers.py must be present for all.
-+$(tests-printers-out): $(objpfx)%.out: $(objpfx)% %.py %.c $(pretty-printers) \
-+ $(..)scripts/test_printers_common.py
-+ $(test-wrapper-env) $(py-env) \
-+ $(PYTHON) $*.py $*.c $(objpfx)$* $(pretty-printers) > $@; \
-+ $(evaluate-test)
-+endif
-+
-
- .PHONY: distclean realclean subdir_distclean subdir_realclean \
- subdir_clean subdir_mostlyclean subdir_testclean
-diff --git a/manual/install.texi b/manual/install.texi
-index 79ee45f..468479e 100644
---- a/manual/install.texi
-+++ b/manual/install.texi
-@@ -256,6 +256,36 @@ occurred. You can specify @samp{stop-on-test-failure=y} when running
- @code{make check} to make the test run stop and exit with an error
- status immediately when a failure occurs.
-
-+The @glibcadj{} pretty printers come with their own set of scripts for testing,
-+which run together with the rest of the testsuite through @code{make check}.
-+These scripts require the following tools to run successfully:
-+
-+@itemize @bullet
-+@item
-+Python 2.7.6/3.4.3 or later
-+
-+Python is required for running the printers' test scripts.
-+
-+@item PExpect 4.0
-+
-+The printer tests drive GDB through test programs and compare its output
-+to the printers'. PExpect is used to capture the output of GDB, and should be
-+compatible with the Python version in your system.
-+
-+@item
-+GDB 7.8 or later with support for Python 2.7.6/3.4.3 or later
-+
-+GDB itself needs to be configured with Python support in order to use the
-+pretty printers. Notice that your system having Python available doesn't imply
-+that GDB supports it, nor that your system's Python and GDB's have the same
-+version.
-+@end itemize
-+
-+@noindent
-+If these tools are absent, the printer tests will report themselves as
-+@code{UNSUPPORTED}. Notice that some of the printer tests require @theglibc{}
-+to be compiled with debugging symbols.
-+
- To format the @cite{GNU C Library Reference Manual} for printing, type
- @w{@code{make dvi}}. You need a working @TeX{} installation to do
- this. The distribution builds the on-line formatted version of the
-diff --git a/nptl/Makefile b/nptl/Makefile
-index 7dec4ed..49f6ba6 100644
---- a/nptl/Makefile
-+++ b/nptl/Makefile
-@@ -308,6 +308,24 @@ gen-as-const-headers = pthread-errnos.sym \
- unwindbuf.sym \
- lowlevelrobustlock.sym pthread-pi-defines.sym
-
-+gen-py-const-headers := nptl_lock_constants.pysym
-+pretty-printers := nptl-printers.py
-+tests-printers := test-mutexattr-printers test-mutex-printers \
-+ test-condattr-printers test-cond-printers \
-+ test-rwlockattr-printers test-rwlock-printers
-+
-+CFLAGS-test-mutexattr-printers.c := $(CFLAGS-printers-tests)
-+CFLAGS-test-mutex-printers.c := $(CFLAGS-printers-tests)
-+CFLAGS-test-condattr-printers.c := $(CFLAGS-printers-tests)
-+CFLAGS-test-cond-printers.c := $(CFLAGS-printers-tests)
-+CFLAGS-test-rwlockattr-printers.c := $(CFLAGS-printers-tests)
-+CFLAGS-test-rwlock-printers.c := $(CFLAGS-printers-tests)
-+
-+ifeq ($(build-shared),yes)
-+tests-printers-libs := $(shared-thread-library)
-+else
-+tests-printers-libs := $(static-thread-library)
-+endif
-
- LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
-
-diff --git a/nptl/nptl-printers.py b/nptl/nptl-printers.py
-new file mode 100644
-index 0000000..e402f23
---- /dev/null
-+++ b/nptl/nptl-printers.py
-@@ -0,0 +1,633 @@
-+# Pretty printers for the NPTL lock types.
-+#
-+# Copyright (C) 2016 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/>.
-+
-+"""This file contains the gdb pretty printers for the following types:
-+
-+ * pthread_mutex_t
-+ * pthread_mutexattr_t
-+ * pthread_cond_t
-+ * pthread_condattr_t
-+ * pthread_rwlock_t
-+ * pthread_rwlockattr_t
-+
-+You can check which printers are registered and enabled by issuing the
-+'info pretty-printer' gdb command. Printers should trigger automatically when
-+trying to print a variable of one of the types mentioned above.
-+"""
-+
-+from __future__ import print_function
-+
-+import gdb
-+import gdb.printing
-+from nptl_lock_constants import *
-+
-+MUTEX_TYPES = {
-+ PTHREAD_MUTEX_NORMAL: ('Type', 'Normal'),
-+ PTHREAD_MUTEX_RECURSIVE: ('Type', 'Recursive'),
-+ PTHREAD_MUTEX_ERRORCHECK: ('Type', 'Error check'),
-+ PTHREAD_MUTEX_ADAPTIVE_NP: ('Type', 'Adaptive')
-+}
-+
-+class MutexPrinter(object):
-+ """Pretty printer for pthread_mutex_t."""
-+
-+ def __init__(self, mutex):
-+ """Initialize the printer's internal data structures.
-+
-+ Args:
-+ mutex: A gdb.value representing a pthread_mutex_t.
-+ """
-+
-+ data = mutex['__data']
-+ self.lock = data['__lock']
-+ self.count = data['__count']
-+ self.owner = data['__owner']
-+ self.kind = data['__kind']
-+ self.values = []
-+ self.read_values()
-+
-+ def to_string(self):
-+ """gdb API function.
-+
-+ This is called from gdb when we try to print a pthread_mutex_t.
-+ """
-+
-+ return 'pthread_mutex_t'
-+
-+ def children(self):
-+ """gdb API function.
-+
-+ This is called from gdb when we try to print a pthread_mutex_t.
-+ """
-+
-+ return self.values
-+
-+ def read_values(self):
-+ """Read the mutex's info and store it in self.values.
-+
-+ The data contained in self.values will be returned by the Iterator
-+ created in self.children.
-+ """
-+
-+ self.read_type()
-+ self.read_status()
-+ self.read_attributes()
-+ self.read_misc_info()
-+
-+ def read_type(self):
-+ """Read the mutex's type."""
-+
-+ mutex_type = self.kind & PTHREAD_MUTEX_KIND_MASK
-+
-+ # mutex_type must be casted to int because it's a gdb.Value
-+ self.values.append(MUTEX_TYPES[int(mutex_type)])
-+
-+ def read_status(self):
-+ """Read the mutex's status.
-+
-+ For architectures which support lock elision, this method reads
-+ whether the mutex appears as locked in memory (i.e. it may show it as
-+ unlocked even after calling pthread_mutex_lock).
-+ """
-+
-+ if self.kind == PTHREAD_MUTEX_DESTROYED:
-+ self.values.append(('Status', 'Destroyed'))
-+ elif self.kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP:
-+ self.read_status_robust()
-+ else:
-+ self.read_status_no_robust()
-+
-+ def read_status_robust(self):
-+ """Read the status of a robust mutex.
-+
-+ In glibc robust mutexes are implemented in a very different way than
-+ non-robust ones. This method reads their locking status,
-+ whether it may have waiters, their registered owner (if any),
-+ whether the owner is alive or not, and the status of the state
-+ they're protecting.
-+ """
-+
-+ if self.lock == PTHREAD_MUTEX_UNLOCKED:
-+ self.values.append(('Status', 'Unlocked'))
-+ else:
-+ if self.lock & FUTEX_WAITERS:
-+ self.values.append(('Status', 'Locked, possibly with waiters'))
-+ else:
-+ self.values.append(('Status',
-+ 'Locked, possibly with no waiters'))
-+
-+ if self.lock & FUTEX_OWNER_DIED:
-+ self.values.append(('Owner ID', '%d (dead)' % self.owner))
-+ else:
-+ self.values.append(('Owner ID', self.lock & FUTEX_TID_MASK))
-+
-+ if self.owner == PTHREAD_MUTEX_INCONSISTENT:
-+ self.values.append(('State protected by this mutex',
-+ 'Inconsistent'))
-+ elif self.owner == PTHREAD_MUTEX_NOTRECOVERABLE:
-+ self.values.append(('State protected by this mutex',
-+ 'Not recoverable'))
-+
-+ def read_status_no_robust(self):
-+ """Read the status of a non-robust mutex.
-+
-+ Read info on whether the mutex is locked, if it may have waiters
-+ and its owner (if any).
-+ """
-+
-+ lock_value = self.lock
-+
-+ if self.kind & PTHREAD_MUTEX_PRIO_PROTECT_NP:
-+ lock_value &= ~(PTHREAD_MUTEX_PRIO_CEILING_MASK)
-+
-+ if lock_value == PTHREAD_MUTEX_UNLOCKED:
-+ self.values.append(('Status', 'Unlocked'))
-+ else:
-+ if self.kind & PTHREAD_MUTEX_PRIO_INHERIT_NP:
-+ waiters = self.lock & FUTEX_WAITERS
-+ owner = self.lock & FUTEX_TID_MASK
-+ else:
-+ # Mutex protocol is PP or none
-+ waiters = (self.lock != PTHREAD_MUTEX_LOCKED_NO_WAITERS)
-+ owner = self.owner
-+
-+ if waiters:
-+ self.values.append(('Status', 'Locked, possibly with waiters'))
-+ else:
-+ self.values.append(('Status',
-+ 'Locked, possibly with no waiters'))
-+
-+ self.values.append(('Owner ID', owner))
-+
-+ def read_attributes(self):
-+ """Read the mutex's attributes."""
-+
-+ if self.kind != PTHREAD_MUTEX_DESTROYED:
-+ if self.kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP:
-+ self.values.append(('Robust', 'Yes'))
-+ else:
-+ self.values.append(('Robust', 'No'))
-+
-+ # In glibc, robust mutexes always have their pshared flag set to
-+ # 'shared' regardless of what the pshared flag of their
-+ # mutexattr was. Therefore a robust mutex will act as shared
-+ # even if it was initialized with a 'private' mutexattr.
-+ if self.kind & PTHREAD_MUTEX_PSHARED_BIT:
-+ self.values.append(('Shared', 'Yes'))
-+ else:
-+ self.values.append(('Shared', 'No'))
-+
-+ if self.kind & PTHREAD_MUTEX_PRIO_INHERIT_NP:
-+ self.values.append(('Protocol', 'Priority inherit'))
-+ elif self.kind & PTHREAD_MUTEX_PRIO_PROTECT_NP:
-+ prio_ceiling = ((self.lock & PTHREAD_MUTEX_PRIO_CEILING_MASK)
-+ >> PTHREAD_MUTEX_PRIO_CEILING_SHIFT)
-+
-+ self.values.append(('Protocol', 'Priority protect'))
-+ self.values.append(('Priority ceiling', prio_ceiling))
-+ else:
-+ # PTHREAD_PRIO_NONE
-+ self.values.append(('Protocol', 'None'))
-+
-+ def read_misc_info(self):
-+ """Read miscellaneous info on the mutex.
-+
-+ For now this reads the number of times a recursive mutex was locked
-+ by the same thread.
-+ """
-+
-+ mutex_type = self.kind & PTHREAD_MUTEX_KIND_MASK
-+
-+ if mutex_type == PTHREAD_MUTEX_RECURSIVE and self.count > 1:
-+ self.values.append(('Times locked recursively', self.count))
-+
-+class MutexAttributesPrinter(object):
-+ """Pretty printer for pthread_mutexattr_t.
-+
-+ In the NPTL this is a type that's always casted to struct pthread_mutexattr
-+ which has a single 'mutexkind' field containing the actual attributes.
-+ """
-+
-+ def __init__(self, mutexattr):
-+ """Initialize the printer's internal data structures.
-+
-+ Args:
-+ mutexattr: A gdb.value representing a pthread_mutexattr_t.
-+ """
-+
-+ self.values = []
-+
-+ try:
-+ mutexattr_struct = gdb.lookup_type('struct pthread_mutexattr')
-+ self.mutexattr = mutexattr.cast(mutexattr_struct)['mutexkind']
-+ self.read_values()
-+ except gdb.error:
-+ # libpthread doesn't have debug symbols, thus we can't find the
-+ # real struct type. Just print the union members.
-+ self.values.append(('__size', mutexattr['__size']))
-+ self.values.append(('__align', mutexattr['__align']))
-+
-+ def to_string(self):
-+ """gdb API function.
-+
-+ This is called from gdb when we try to print a pthread_mutexattr_t.
-+ """
-+
-+ return 'pthread_mutexattr_t'
-+
-+ def children(self):
-+ """gdb API function.
-+
-+ This is called from gdb when we try to print a pthread_mutexattr_t.
-+ """
-+
-+ return self.values
-+
-+ def read_values(self):
-+ """Read the mutexattr's info and store it in self.values.
-+
-+ The data contained in self.values will be returned by the Iterator
-+ created in self.children.
-+ """
-+
-+ mutexattr_type = (self.mutexattr
-+ & ~PTHREAD_MUTEXATTR_FLAG_BITS
-+ & ~PTHREAD_MUTEX_NO_ELISION_NP)
-+
-+ # mutexattr_type must be casted to int because it's a gdb.Value
-+ self.values.append(MUTEX_TYPES[int(mutexattr_type)])
-+
-+ if self.mutexattr & PTHREAD_MUTEXATTR_FLAG_ROBUST:
-+ self.values.append(('Robust', 'Yes'))
-+ else:
-+ self.values.append(('Robust', 'No'))
-+
-+ if self.mutexattr & PTHREAD_MUTEXATTR_FLAG_PSHARED:
-+ self.values.append(('Shared', 'Yes'))
-+ else:
-+ self.values.append(('Shared', 'No'))
-+
-+ protocol = ((self.mutexattr & PTHREAD_MUTEXATTR_PROTOCOL_MASK) >>
-+ PTHREAD_MUTEXATTR_PROTOCOL_SHIFT)
-+
-+ if protocol == PTHREAD_PRIO_NONE:
-+ self.values.append(('Protocol', 'None'))
-+ elif protocol == PTHREAD_PRIO_INHERIT:
-+ self.values.append(('Protocol', 'Priority inherit'))
-+ elif protocol == PTHREAD_PRIO_PROTECT:
-+ self.values.append(('Protocol', 'Priority protect'))
-+
-+CLOCK_IDS = {
-+ CLOCK_REALTIME: 'CLOCK_REALTIME',
-+ CLOCK_MONOTONIC: 'CLOCK_MONOTONIC',
-+ CLOCK_PROCESS_CPUTIME_ID: 'CLOCK_PROCESS_CPUTIME_ID',
-+ CLOCK_THREAD_CPUTIME_ID: 'CLOCK_THREAD_CPUTIME_ID',
-+ CLOCK_MONOTONIC_RAW: 'CLOCK_MONOTONIC_RAW',
-+ CLOCK_REALTIME_COARSE: 'CLOCK_REALTIME_COARSE',
-+ CLOCK_MONOTONIC_COARSE: 'CLOCK_MONOTONIC_COARSE'
-+}
-+
-+class ConditionVariablePrinter(object):
-+ """Pretty printer for pthread_cond_t."""
-+
-+ def __init__(self, cond):
-+ """Initialize the printer's internal data structures.
-+
-+ Args:
-+ cond: A gdb.value representing a pthread_cond_t.
-+ """
-+
-+ # Since PTHREAD_COND_SHARED is an integer, we need to cast it to void *
-+ # to be able to compare it to the condvar's __data.__mutex member.
-+ #
-+ # While it looks like self.shared_value should be a class variable,
-+ # that would result in it having an incorrect size if we're loading
-+ # these printers through .gdbinit for a 64-bit objfile in AMD64.
-+ # This is because gdb initially assumes the pointer size to be 4 bytes,
-+ # and only sets it to 8 after loading the 64-bit objfiles. Since
-+ # .gdbinit runs before any objfiles are loaded, this would effectively
-+ # make self.shared_value have a size of 4, thus breaking later
-+ # comparisons with pointers whose types are looked up at runtime.
-+ void_ptr_type = gdb.lookup_type('void').pointer()
-+ self.shared_value = gdb.Value(PTHREAD_COND_SHARED).cast(void_ptr_type)
-+
-+ data = cond['__data']
-+ self.total_seq = data['__total_seq']
-+ self.mutex = data['__mutex']
-+ self.nwaiters = data['__nwaiters']
-+ self.values = []
-+
-+ self.read_values()
-+
-+ def to_string(self):
-+ """gdb API function.
-+
-+ This is called from gdb when we try to print a pthread_cond_t.
-+ """
-+
-+ return 'pthread_cond_t'
-+
-+ def children(self):
-+ """gdb API function.
-+
-+ This is called from gdb when we try to print a pthread_cond_t.
-+ """
-+
-+ return self.values
-+
-+ def read_values(self):
-+ """Read the condvar's info and store it in self.values.
-+
-+ The data contained in self.values will be returned by the Iterator
-+ created in self.children.
-+ """
-+
-+ self.read_status()
-+ self.read_attributes()
-+ self.read_mutex_info()
-+
-+ def read_status(self):
-+ """Read the status of the condvar.
-+
-+ This method reads whether the condvar is destroyed and how many threads
-+ are waiting for it.
-+ """
-+
-+ if self.total_seq == PTHREAD_COND_DESTROYED:
-+ self.values.append(('Status', 'Destroyed'))
-+
-+ self.values.append(('Threads waiting for this condvar',
-+ self.nwaiters >> COND_NWAITERS_SHIFT))
-+
-+ def read_attributes(self):
-+ """Read the condvar's attributes."""
-+
-+ clock_id = self.nwaiters & ((1 << COND_NWAITERS_SHIFT) - 1)
-+
-+ # clock_id must be casted to int because it's a gdb.Value
-+ self.values.append(('Clock ID', CLOCK_IDS[int(clock_id)]))
-+
-+ shared = (self.mutex == self.shared_value)
-+
-+ if shared:
-+ self.values.append(('Shared', 'Yes'))
-+ else:
-+ self.values.append(('Shared', 'No'))
-+
-+ def read_mutex_info(self):
-+ """Read the data of the mutex this condvar is bound to.
-+
-+ A pthread_cond_t's __data.__mutex member is a void * which
-+ must be casted to pthread_mutex_t *. For shared condvars, this
-+ member isn't recorded and has a special value instead.
-+ """
-+
-+ if self.mutex and self.mutex != self.shared_value:
-+ mutex_type = gdb.lookup_type('pthread_mutex_t')
-+ mutex = self.mutex.cast(mutex_type.pointer()).dereference()
-+
-+ self.values.append(('Mutex', mutex))
-+
-+class ConditionVariableAttributesPrinter(object):
-+ """Pretty printer for pthread_condattr_t.
-+
-+ In the NPTL this is a type that's always casted to struct pthread_condattr,
-+ which has a single 'value' field containing the actual attributes.
-+ """
-+
-+ def __init__(self, condattr):
-+ """Initialize the printer's internal data structures.
-+
-+ Args:
-+ condattr: A gdb.value representing a pthread_condattr_t.
-+ """
-+
-+ self.values = []
-+
-+ try:
-+ condattr_struct = gdb.lookup_type('struct pthread_condattr')
-+ self.condattr = condattr.cast(condattr_struct)['value']
-+ self.read_values()
-+ except gdb.error:
-+ # libpthread doesn't have debug symbols, thus we can't find the
-+ # real struct type. Just print the union members.
-+ self.values.append(('__size', condattr['__size']))
-+ self.values.append(('__align', condattr['__align']))
-+
-+ def to_string(self):
-+ """gdb API function.
-+
-+ This is called from gdb when we try to print a pthread_condattr_t.
-+ """
-+
-+ return 'pthread_condattr_t'
-+
-+ def children(self):
-+ """gdb API function.
-+
-+ This is called from gdb when we try to print a pthread_condattr_t.
-+ """
-+
-+ return self.values
-+
-+ def read_values(self):
-+ """Read the condattr's info and store it in self.values.
-+
-+ The data contained in self.values will be returned by the Iterator
-+ created in self.children.
-+ """
-+
-+ clock_id = self.condattr & ((1 << COND_NWAITERS_SHIFT) - 1)
-+
-+ # clock_id must be casted to int because it's a gdb.Value
-+ self.values.append(('Clock ID', CLOCK_IDS[int(clock_id)]))
-+
-+ if self.condattr & 1:
-+ self.values.append(('Shared', 'Yes'))
-+ else:
-+ self.values.append(('Shared', 'No'))
-+
-+class RWLockPrinter(object):
-+ """Pretty printer for pthread_rwlock_t."""
-+
-+ def __init__(self, rwlock):
-+ """Initialize the printer's internal data structures.
-+
-+ Args:
-+ rwlock: A gdb.value representing a pthread_rwlock_t.
-+ """
-+
-+ data = rwlock['__data']
-+ self.readers = data['__nr_readers']
-+ self.queued_readers = data['__nr_readers_queued']
-+ self.queued_writers = data['__nr_writers_queued']
-+ self.writer_id = data['__writer']
-+ self.shared = data['__shared']
-+ self.prefers_writers = data['__flags']
-+ self.values = []
-+ self.read_values()
-+
-+ def to_string(self):
-+ """gdb API function.
-+
-+ This is called from gdb when we try to print a pthread_rwlock_t.
-+ """
-+
-+ return 'pthread_rwlock_t'
-+
-+ def children(self):
-+ """gdb API function.
-+
-+ This is called from gdb when we try to print a pthread_rwlock_t.
-+ """
-+
-+ return self.values
-+
-+ def read_values(self):
-+ """Read the rwlock's info and store it in self.values.
-+
-+ The data contained in self.values will be returned by the Iterator
-+ created in self.children.
-+ """
-+
-+ self.read_status()
-+ self.read_attributes()
-+
-+ def read_status(self):
-+ """Read the status of the rwlock."""
-+
-+ # Right now pthread_rwlock_destroy doesn't do anything, so there's no
-+ # way to check if an rwlock is destroyed.
-+
-+ if self.writer_id:
-+ self.values.append(('Status', 'Locked (Write)'))
-+ self.values.append(('Writer ID', self.writer_id))
-+ elif self.readers:
-+ self.values.append(('Status', 'Locked (Read)'))
-+ self.values.append(('Readers', self.readers))
-+ else:
-+ self.values.append(('Status', 'Unlocked'))
-+
-+ self.values.append(('Queued readers', self.queued_readers))
-+ self.values.append(('Queued writers', self.queued_writers))
-+
-+ def read_attributes(self):
-+ """Read the attributes of the rwlock."""
-+
-+ if self.shared:
-+ self.values.append(('Shared', 'Yes'))
-+ else:
-+ self.values.append(('Shared', 'No'))
-+
-+ if self.prefers_writers:
-+ self.values.append(('Prefers', 'Writers'))
-+ else:
-+ self.values.append(('Prefers', 'Readers'))
-+
-+class RWLockAttributesPrinter(object):
-+ """Pretty printer for pthread_rwlockattr_t.
-+
-+ In the NPTL this is a type that's always casted to
-+ struct pthread_rwlockattr, which has two fields ('lockkind' and 'pshared')
-+ containing the actual attributes.
-+ """
-+
-+ def __init__(self, rwlockattr):
-+ """Initialize the printer's internal data structures.
-+
-+ Args:
-+ rwlockattr: A gdb.value representing a pthread_rwlockattr_t.
-+ """
-+
-+ self.values = []
-+
-+ try:
-+ rwlockattr_struct = gdb.lookup_type('struct pthread_rwlockattr')
-+ self.rwlockattr = rwlockattr.cast(rwlockattr_struct)
-+ self.read_values()
-+ except gdb.error:
-+ # libpthread doesn't have debug symbols, thus we can't find the
-+ # real struct type. Just print the union members.
-+ self.values.append(('__size', rwlockattr['__size']))
-+ self.values.append(('__align', rwlockattr['__align']))
-+
-+ def to_string(self):
-+ """gdb API function.
-+
-+ This is called from gdb when we try to print a pthread_rwlockattr_t.
-+ """
-+
-+ return 'pthread_rwlockattr_t'
-+
-+ def children(self):
-+ """gdb API function.
-+
-+ This is called from gdb when we try to print a pthread_rwlockattr_t.
-+ """
-+
-+ return self.values
-+
-+ def read_values(self):
-+ """Read the rwlockattr's info and store it in self.values.
-+
-+ The data contained in self.values will be returned by the Iterator
-+ created in self.children.
-+ """
-+
-+ rwlock_type = self.rwlockattr['lockkind']
-+ shared = self.rwlockattr['pshared']
-+
-+ if shared == PTHREAD_PROCESS_SHARED:
-+ self.values.append(('Shared', 'Yes'))
-+ else:
-+ # PTHREAD_PROCESS_PRIVATE
-+ self.values.append(('Shared', 'No'))
-+
-+ if (rwlock_type == PTHREAD_RWLOCK_PREFER_READER_NP or
-+ rwlock_type == PTHREAD_RWLOCK_PREFER_WRITER_NP):
-+ # This is a known bug. Using PTHREAD_RWLOCK_PREFER_WRITER_NP will
-+ # still make the rwlock prefer readers.
-+ self.values.append(('Prefers', 'Readers'))
-+ elif rwlock_type == PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP:
-+ self.values.append(('Prefers', 'Writers'))
-+
-+def register(objfile):
-+ """Register the pretty printers within the given objfile."""
-+
-+ printer = gdb.printing.RegexpCollectionPrettyPrinter('glibc-pthread-locks')
-+
-+ printer.add_printer('pthread_mutex_t', r'^pthread_mutex_t$',
-+ MutexPrinter)
-+ printer.add_printer('pthread_mutexattr_t', r'^pthread_mutexattr_t$',
-+ MutexAttributesPrinter)
-+ printer.add_printer('pthread_cond_t', r'^pthread_cond_t$',
-+ ConditionVariablePrinter)
-+ printer.add_printer('pthread_condattr_t', r'^pthread_condattr_t$',
-+ ConditionVariableAttributesPrinter)
-+ printer.add_printer('pthread_rwlock_t', r'^pthread_rwlock_t$',
-+ RWLockPrinter)
-+ printer.add_printer('pthread_rwlockattr_t', r'^pthread_rwlockattr_t$',
-+ RWLockAttributesPrinter)
-+
-+ if objfile == None:
-+ objfile = gdb
-+
-+ gdb.printing.register_pretty_printer(objfile, printer)
-+
-+register(gdb.current_objfile())
-diff --git a/nptl/nptl_lock_constants.pysym b/nptl/nptl_lock_constants.pysym
-new file mode 100644
-index 0000000..303ec61
---- /dev/null
-+++ b/nptl/nptl_lock_constants.pysym
-@@ -0,0 +1,75 @@
-+#include <pthreadP.h>
-+
-+-- Mutex types
-+PTHREAD_MUTEX_KIND_MASK PTHREAD_MUTEX_KIND_MASK_NP
-+PTHREAD_MUTEX_NORMAL
-+PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
-+PTHREAD_MUTEX_ERRORCHECK PTHREAD_MUTEX_ERRORCHECK_NP
-+PTHREAD_MUTEX_ADAPTIVE_NP
-+
-+-- Mutex status
-+-- These are hardcoded all over the code; there are no enums/macros for them.
-+PTHREAD_MUTEX_DESTROYED -1
-+PTHREAD_MUTEX_UNLOCKED 0
-+PTHREAD_MUTEX_LOCKED_NO_WAITERS 1
-+
-+-- For robust mutexes
-+PTHREAD_MUTEX_INCONSISTENT
-+PTHREAD_MUTEX_NOTRECOVERABLE
-+FUTEX_OWNER_DIED
-+
-+-- For robust and PI mutexes
-+FUTEX_WAITERS
-+FUTEX_TID_MASK
-+
-+-- Mutex attributes
-+PTHREAD_MUTEX_ROBUST_NORMAL_NP
-+PTHREAD_MUTEX_PRIO_INHERIT_NP
-+PTHREAD_MUTEX_PRIO_PROTECT_NP
-+PTHREAD_MUTEX_PSHARED_BIT
-+PTHREAD_MUTEX_PRIO_CEILING_SHIFT
-+PTHREAD_MUTEX_PRIO_CEILING_MASK
-+
-+-- Mutex attribute flags
-+PTHREAD_MUTEXATTR_PROTOCOL_SHIFT
-+PTHREAD_MUTEXATTR_PROTOCOL_MASK
-+PTHREAD_MUTEXATTR_PRIO_CEILING_MASK
-+PTHREAD_MUTEXATTR_FLAG_ROBUST
-+PTHREAD_MUTEXATTR_FLAG_PSHARED
-+PTHREAD_MUTEXATTR_FLAG_BITS
-+PTHREAD_MUTEX_NO_ELISION_NP
-+
-+-- Priority protocols
-+PTHREAD_PRIO_NONE
-+PTHREAD_PRIO_INHERIT
-+PTHREAD_PRIO_PROTECT
-+
-+-- These values are hardcoded as well:
-+-- Value of __mutex for shared condvars.
-+PTHREAD_COND_SHARED (void *)~0l
-+
-+-- Value of __total_seq for destroyed condvars.
-+PTHREAD_COND_DESTROYED -1ull
-+
-+-- __nwaiters encodes the number of threads waiting on a condvar
-+-- and the clock ID.
-+-- __nwaiters >> COND_NWAITERS_SHIFT gives us the number of waiters.
-+COND_NWAITERS_SHIFT
-+
-+-- Condvar clock IDs
-+CLOCK_REALTIME
-+CLOCK_MONOTONIC
-+CLOCK_PROCESS_CPUTIME_ID
-+CLOCK_THREAD_CPUTIME_ID
-+CLOCK_MONOTONIC_RAW
-+CLOCK_REALTIME_COARSE
-+CLOCK_MONOTONIC_COARSE
-+
-+-- Rwlock attributes
-+PTHREAD_RWLOCK_PREFER_READER_NP
-+PTHREAD_RWLOCK_PREFER_WRITER_NP
-+PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
-+
-+-- 'Shared' attribute values
-+PTHREAD_PROCESS_PRIVATE
-+PTHREAD_PROCESS_SHARED
-diff --git a/nptl/test-cond-printers.c b/nptl/test-cond-printers.c
-new file mode 100644
-index 0000000..0f2a5f4
---- /dev/null
-+++ b/nptl/test-cond-printers.c
-@@ -0,0 +1,57 @@
-+/* Helper program for testing the pthread_cond_t pretty printer.
-+
-+ Copyright (C) 2016 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/>. */
-+
-+/* Keep the calls to the pthread_* functions on separate lines to make it easy
-+ to advance through the program using the gdb 'next' command. */
-+
-+#include <time.h>
-+#include <pthread.h>
-+
-+#define PASS 0
-+#define FAIL 1
-+
-+static int test_status_destroyed (pthread_cond_t *condvar);
-+
-+int
-+main (void)
-+{
-+ pthread_cond_t condvar;
-+ pthread_condattr_t attr;
-+ int result = FAIL;
-+
-+ if (pthread_condattr_init (&attr) == 0
-+ && test_status_destroyed (&condvar) == PASS)
-+ result = PASS;
-+ /* Else, one of the pthread_cond* functions failed. */
-+
-+ return result;
-+}
-+
-+/* Initializes CONDVAR, then destroys it. */
-+static int
-+test_status_destroyed (pthread_cond_t *condvar)
-+{
-+ int result = FAIL;
-+
-+ if (pthread_cond_init (condvar, NULL) == 0
-+ && pthread_cond_destroy (condvar) == 0)
-+ result = PASS; /* Test status (destroyed). */
-+
-+ return result;
-+}
-diff --git a/nptl/test-cond-printers.py b/nptl/test-cond-printers.py
-new file mode 100644
-index 0000000..af0e12e
---- /dev/null
-+++ b/nptl/test-cond-printers.py
-@@ -0,0 +1,50 @@
-+# Common tests for the ConditionVariablePrinter class.
-+#
-+# Copyright (C) 2016 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/>.
-+
-+import sys
-+
-+from test_printers_common import *
-+
-+test_source = sys.argv[1]
-+test_bin = sys.argv[2]
-+printer_files = sys.argv[3:]
-+printer_names = ['global glibc-pthread-locks']
-+
-+try:
-+ init_test(test_bin, printer_files, printer_names)
-+ go_to_main()
-+
-+ var = 'condvar'
-+ to_string = 'pthread_cond_t'
-+
-+ break_at(test_source, 'Test status (destroyed)')
-+ continue_cmd() # Go to test_status_destroyed
-+ test_printer(var, to_string, {'Status': 'Destroyed'})
-+
-+ continue_cmd() # Exit
-+
-+except (NoLineError, pexpect.TIMEOUT) as exception:
-+ print('Error: {0}'.format(exception))
-+ result = FAIL
-+
-+else:
-+ print('Test succeeded.')
-+ result = PASS
-+
-+exit(result)
-diff --git a/nptl/test-condattr-printers.c b/nptl/test-condattr-printers.c
-new file mode 100644
-index 0000000..4db4098
---- /dev/null
-+++ b/nptl/test-condattr-printers.c
-@@ -0,0 +1,94 @@
-+/* Helper program for testing the pthread_cond_t and pthread_condattr_t
-+ pretty printers.
-+
-+ Copyright (C) 2016 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/>. */
-+
-+/* Keep the calls to the pthread_* functions on separate lines to make it easy
-+ to advance through the program using the gdb 'next' command. */
-+
-+#include <time.h>
-+#include <pthread.h>
-+
-+#define PASS 0
-+#define FAIL 1
-+
-+static int condvar_reinit (pthread_cond_t *condvar,
-+ const pthread_condattr_t *attr);
-+static int test_setclock (pthread_cond_t *condvar, pthread_condattr_t *attr);
-+static int test_setpshared (pthread_cond_t *condvar, pthread_condattr_t *attr);
-+
-+/* Need these so we don't have lines longer than 79 chars. */
-+#define SET_SHARED(attr, shared) pthread_condattr_setpshared (attr, shared)
-+
-+int
-+main (void)
-+{
-+ pthread_cond_t condvar;
-+ pthread_condattr_t attr;
-+ int result = FAIL;
-+
-+ if (pthread_condattr_init (&attr) == 0
-+ && pthread_cond_init (&condvar, NULL) == 0
-+ && test_setclock (&condvar, &attr) == PASS
-+ && test_setpshared (&condvar, &attr) == PASS)
-+ result = PASS;
-+ /* Else, one of the pthread_cond* functions failed. */
-+
-+ return result;
-+}
-+
-+/* Destroys CONDVAR and re-initializes it using ATTR. */
-+static int
-+condvar_reinit (pthread_cond_t *condvar, const pthread_condattr_t *attr)
-+{
-+ int result = FAIL;
-+
-+ if (pthread_cond_destroy (condvar) == 0
-+ && pthread_cond_init (condvar, attr) == 0)
-+ result = PASS;
-+
-+ return result;
-+}
-+
-+/* Tests setting the clock ID attribute. */
-+static int
-+test_setclock (pthread_cond_t *condvar, pthread_condattr_t *attr)
-+{
-+ int result = FAIL;
-+
-+ if (pthread_condattr_setclock (attr, CLOCK_REALTIME) == 0 /* Set clock. */
-+ && condvar_reinit (condvar, attr) == PASS)
-+ result = PASS;
-+
-+ return result;
-+}
-+
-+/* Tests setting whether the condvar can be shared between processes. */
-+static int
-+test_setpshared (pthread_cond_t *condvar, pthread_condattr_t *attr)
-+{
-+ int result = FAIL;
-+
-+ if (SET_SHARED (attr, PTHREAD_PROCESS_SHARED) == 0 /* Set shared. */
-+ && condvar_reinit (condvar, attr) == PASS
-+ && SET_SHARED (attr, PTHREAD_PROCESS_PRIVATE) == 0
-+ && condvar_reinit (condvar, attr) == PASS)
-+ result = PASS;
-+
-+ return result;
-+}
-diff --git a/nptl/test-condattr-printers.py b/nptl/test-condattr-printers.py
-new file mode 100644
-index 0000000..7ea01db
---- /dev/null
-+++ b/nptl/test-condattr-printers.py
-@@ -0,0 +1,71 @@
-+# Common tests for the ConditionVariablePrinter and
-+# ConditionVariableAttributesPrinter classes.
-+#
-+# Copyright (C) 2016 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/>.
-+
-+import sys
-+
-+from test_printers_common import *
-+
-+test_source = sys.argv[1]
-+test_bin = sys.argv[2]
-+printer_files = sys.argv[3:]
-+printer_names = ['global glibc-pthread-locks']
-+
-+try:
-+ init_test(test_bin, printer_files, printer_names)
-+ go_to_main()
-+
-+ check_debug_symbol('struct pthread_condattr')
-+
-+ condvar_var = 'condvar'
-+ condvar_to_string = 'pthread_cond_t'
-+
-+ attr_var = 'attr'
-+ attr_to_string = 'pthread_condattr_t'
-+
-+ break_at(test_source, 'Set clock')
-+ continue_cmd() # Go to test_setclock
-+ next_cmd(2)
-+ test_printer(condvar_var, condvar_to_string, {'Clock ID': 'CLOCK_REALTIME'})
-+ test_printer(attr_var, attr_to_string, {'Clock ID': 'CLOCK_REALTIME'})
-+
-+ break_at(test_source, 'Set shared')
-+ continue_cmd() # Go to test_setpshared
-+ next_cmd(2)
-+ test_printer(condvar_var, condvar_to_string, {'Shared': 'Yes'})
-+ test_printer(attr_var, attr_to_string, {'Shared': 'Yes'})
-+ next_cmd(2)
-+ test_printer(condvar_var, condvar_to_string, {'Shared': 'No'})
-+ test_printer(attr_var, attr_to_string, {'Shared': 'No'})
-+
-+ continue_cmd() # Exit
-+
-+except (NoLineError, pexpect.TIMEOUT) as exception:
-+ print('Error: {0}'.format(exception))
-+ result = FAIL
-+
-+except DebugError as exception:
-+ print(exception)
-+ result = UNSUPPORTED
-+
-+else:
-+ print('Test succeeded.')
-+ result = PASS
-+
-+exit(result)
-diff --git a/nptl/test-mutex-printers.c b/nptl/test-mutex-printers.c
-new file mode 100644
-index 0000000..b973e82
---- /dev/null
-+++ b/nptl/test-mutex-printers.c
-@@ -0,0 +1,151 @@
-+/* Helper program for testing the pthread_mutex_t pretty printer.
-+
-+ Copyright (C) 2016 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/>. */
-+
-+/* Keep the calls to the pthread_* functions on separate lines to make it easy
-+ to advance through the program using the gdb 'next' command. */
-+
-+#include <stdlib.h>
-+#include <errno.h>
-+#include <pthread.h>
-+
-+#define PASS 0
-+#define FAIL 1
-+
-+static int test_status_destroyed (pthread_mutex_t *mutex);
-+static int test_status_no_robust (pthread_mutex_t *mutex,
-+ pthread_mutexattr_t *attr);
-+static int test_status_robust (pthread_mutex_t *mutex,
-+ pthread_mutexattr_t *attr);
-+static int test_locking_state_robust (pthread_mutex_t *mutex);
-+static void *thread_func (void *arg);
-+static int test_recursive_locks (pthread_mutex_t *mutex,
-+ pthread_mutexattr_t *attr);
-+
-+int
-+main (void)
-+{
-+ pthread_mutex_t mutex;
-+ pthread_mutexattr_t attr;
-+ int result = FAIL;
-+
-+ if (pthread_mutexattr_init (&attr) == 0
-+ && test_status_destroyed (&mutex) == PASS
-+ && test_status_no_robust (&mutex, &attr) == PASS
-+ && test_status_robust (&mutex, &attr) == PASS
-+ && test_recursive_locks (&mutex, &attr) == PASS)
-+ result = PASS;
-+ /* Else, one of the pthread_mutex* functions failed. */
-+
-+ return result;
-+}
-+
-+/* Initializes MUTEX, then destroys it. */
-+static int
-+test_status_destroyed (pthread_mutex_t *mutex)
-+{
-+ int result = FAIL;
-+
-+ if (pthread_mutex_init (mutex, NULL) == 0
-+ && pthread_mutex_destroy (mutex) == 0)
-+ result = PASS; /* Test status (destroyed). */
-+
-+ return result;
-+}
-+
-+/* Tests locking of non-robust mutexes. */
-+static int
-+test_status_no_robust (pthread_mutex_t *mutex, pthread_mutexattr_t *attr)
-+{
-+ int result = FAIL;
-+
-+ if (pthread_mutexattr_setrobust (attr, PTHREAD_MUTEX_STALLED) == 0
-+ && pthread_mutex_init (mutex, attr) == 0
-+ && pthread_mutex_lock (mutex) == 0 /* Test status (non-robust). */
-+ && pthread_mutex_unlock (mutex) == 0
-+ && pthread_mutex_destroy (mutex) == 0)
-+ result = PASS;
-+
-+ return result;
-+}
-+
-+/* Tests locking of robust mutexes. */
-+static int
-+test_status_robust (pthread_mutex_t *mutex, pthread_mutexattr_t *attr)
-+{
-+ int result = FAIL;
-+
-+ if (pthread_mutexattr_setrobust (attr, PTHREAD_MUTEX_ROBUST) == 0
-+ && pthread_mutex_init (mutex, attr) == 0
-+ && test_locking_state_robust (mutex) == PASS /* Test status (robust). */
-+ && pthread_mutex_destroy (mutex) == 0)
-+ result = PASS;
-+
-+ return result;
-+}
-+
-+/* Tests locking and state corruption of robust mutexes. We'll mark it as
-+ inconsistent, then not recoverable. */
-+static int
-+test_locking_state_robust (pthread_mutex_t *mutex)
-+{
-+ int result = FAIL;
-+ pthread_t thread;
-+
-+ if (pthread_create (&thread, NULL, thread_func, mutex) == 0 /* Create. */
-+ && pthread_join (thread, NULL) == 0
-+ && pthread_mutex_lock (mutex) == EOWNERDEAD /* Test locking (robust). */
-+ && pthread_mutex_unlock (mutex) == 0)
-+ result = PASS;
-+
-+ return result;
-+}
-+
-+/* Function to be called by the child thread when testing robust mutexes. */
-+static void *
-+thread_func (void *arg)
-+{
-+ pthread_mutex_t *mutex = (pthread_mutex_t *)arg;
-+
-+ if (pthread_mutex_lock (mutex) != 0) /* Thread function. */
-+ exit (FAIL);
-+
-+ /* Thread terminates without unlocking the mutex, thus marking it as
-+ inconsistent. */
-+ return NULL;
-+}
-+
-+/* Tests locking the mutex multiple times in a row. */
-+static int
-+test_recursive_locks (pthread_mutex_t *mutex, pthread_mutexattr_t *attr)
-+{
-+ int result = FAIL;
-+
-+ if (pthread_mutexattr_settype (attr, PTHREAD_MUTEX_RECURSIVE) == 0
-+ && pthread_mutex_init (mutex, attr) == 0
-+ && pthread_mutex_lock (mutex) == 0
-+ && pthread_mutex_lock (mutex) == 0
-+ && pthread_mutex_lock (mutex) == 0 /* Test recursive locks. */
-+ && pthread_mutex_unlock (mutex) == 0
-+ && pthread_mutex_unlock (mutex) == 0
-+ && pthread_mutex_unlock (mutex) == 0
-+ && pthread_mutex_destroy (mutex) == 0)
-+ result = PASS;
-+
-+ return result;
-+}
-diff --git a/nptl/test-mutex-printers.py b/nptl/test-mutex-printers.py
-new file mode 100644
-index 0000000..7f542ad
---- /dev/null
-+++ b/nptl/test-mutex-printers.py
-@@ -0,0 +1,97 @@
-+# Tests for the MutexPrinter class.
-+#
-+# Copyright (C) 2016 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/>.
-+
-+import sys
-+
-+from test_printers_common import *
-+
-+test_source = sys.argv[1]
-+test_bin = sys.argv[2]
-+printer_files = sys.argv[3:]
-+printer_names = ['global glibc-pthread-locks']
-+
-+try:
-+ init_test(test_bin, printer_files, printer_names)
-+ go_to_main()
-+
-+ var = 'mutex'
-+ to_string = 'pthread_mutex_t'
-+
-+ break_at(test_source, 'Test status (destroyed)')
-+ continue_cmd() # Go to test_status_destroyed
-+ test_printer(var, to_string, {'Status': 'Destroyed'})
-+
-+ break_at(test_source, 'Test status (non-robust)')
-+ continue_cmd() # Go to test_status_no_robust
-+ test_printer(var, to_string, {'Status': 'Unlocked'})
-+ next_cmd()
-+ thread_id = get_current_thread_lwpid()
-+ test_printer(var, to_string, {'Status': 'Locked, possibly with no waiters',
-+ 'Owner ID': thread_id})
-+
-+ break_at(test_source, 'Test status (robust)')
-+ continue_cmd() # Go to test_status_robust
-+ test_printer(var, to_string, {'Status': 'Unlocked'})
-+
-+ # We'll now test the robust mutex locking states. We'll create a new
-+ # thread that will lock a robust mutex and exit without unlocking it.
-+ break_at(test_source, 'Create')
-+ continue_cmd() # Go to test_locking_state_robust
-+ # Set a breakpoint for the new thread to hit.
-+ break_at(test_source, 'Thread function')
-+ continue_cmd()
-+ # By now the new thread is created and has hit its breakpoint.
-+ set_scheduler_locking(True)
-+ parent = 1
-+ child = 2
-+ select_thread(child)
-+ child_id = get_current_thread_lwpid()
-+ # We've got the new thread's ID.
-+ select_thread(parent)
-+ # Make the new thread finish its function while we wait.
-+ continue_cmd(thread=child)
-+ # The new thread should be dead by now.
-+ break_at(test_source, 'Test locking (robust)')
-+ continue_cmd()
-+ test_printer(var, to_string, {'Owner ID': r'{0} \(dead\)'.format(child_id)})
-+ # Try to lock and unlock the mutex.
-+ next_cmd()
-+ test_printer(var, to_string, {'Owner ID': thread_id,
-+ 'State protected by this mutex': 'Inconsistent'})
-+ next_cmd()
-+ test_printer(var, to_string, {'Status': 'Unlocked',
-+ 'State protected by this mutex': 'Not recoverable'})
-+ set_scheduler_locking(False)
-+
-+ break_at(test_source, 'Test recursive locks')
-+ continue_cmd() # Go to test_recursive_locks
-+ test_printer(var, to_string, {'Times locked recursively': '2'})
-+ next_cmd()
-+ test_printer(var, to_string, {'Times locked recursively': '3'})
-+ continue_cmd() # Exit
-+
-+except (NoLineError, pexpect.TIMEOUT) as exception:
-+ print('Error: {0}'.format(exception))
-+ result = FAIL
-+
-+else:
-+ print('Test succeeded.')
-+ result = PASS
-+
-+exit(result)
-diff --git a/nptl/test-mutexattr-printers.c b/nptl/test-mutexattr-printers.c
-new file mode 100644
-index 0000000..9ecfff7
---- /dev/null
-+++ b/nptl/test-mutexattr-printers.c
-@@ -0,0 +1,144 @@
-+/* Helper program for testing the pthread_mutex_t and pthread_mutexattr_t
-+ pretty printers.
-+
-+ Copyright (C) 2016 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/>. */
-+
-+/* Keep the calls to the pthread_* functions on separate lines to make it easy
-+ to advance through the program using the gdb 'next' command. */
-+
-+#include <pthread.h>
-+
-+#define PASS 0
-+#define FAIL 1
-+#define PRIOCEILING 42
-+
-+/* Need these so we don't have lines longer than 79 chars. */
-+#define SET_TYPE(attr, type) pthread_mutexattr_settype (attr, type)
-+#define SET_ROBUST(attr, robust) pthread_mutexattr_setrobust (attr, robust)
-+#define SET_SHARED(attr, shared) pthread_mutexattr_setpshared (attr, shared)
-+#define SET_PROTOCOL(attr, protocol) \
-+ pthread_mutexattr_setprotocol (attr, protocol)
-+#define SET_PRIOCEILING(mutex, prioceiling, old_ceiling) \
-+ pthread_mutex_setprioceiling (mutex, prioceiling, old_ceiling)
-+
-+static int mutex_reinit (pthread_mutex_t *mutex,
-+ const pthread_mutexattr_t *attr);
-+static int test_settype (pthread_mutex_t *mutex, pthread_mutexattr_t *attr);
-+static int test_setrobust (pthread_mutex_t *mutex, pthread_mutexattr_t *attr);
-+static int test_setpshared (pthread_mutex_t *mutex, pthread_mutexattr_t *attr);
-+static int test_setprotocol (pthread_mutex_t *mutex,
-+ pthread_mutexattr_t *attr);
-+
-+int
-+main (void)
-+{
-+ pthread_mutex_t mutex;
-+ pthread_mutexattr_t attr;
-+ int result = FAIL;
-+
-+ if (pthread_mutexattr_init (&attr) == 0
-+ && pthread_mutex_init (&mutex, NULL) == 0
-+ && test_settype (&mutex, &attr) == PASS
-+ && test_setrobust (&mutex, &attr) == PASS
-+ && test_setpshared (&mutex, &attr) == PASS
-+ && test_setprotocol (&mutex, &attr) == PASS)
-+ result = PASS;
-+ /* Else, one of the pthread_mutex* functions failed. */
-+
-+ return result;
-+}
-+
-+/* Destroys MUTEX and re-initializes it using ATTR. */
-+static int
-+mutex_reinit (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
-+{
-+ int result = FAIL;
-+
-+ if (pthread_mutex_destroy (mutex) == 0
-+ && pthread_mutex_init (mutex, attr) == 0)
-+ result = PASS;
-+
-+ return result;
-+}
-+
-+/* Tests setting the mutex type. */
-+static int
-+test_settype (pthread_mutex_t *mutex, pthread_mutexattr_t *attr)
-+{
-+ int result = FAIL;
-+
-+ if (SET_TYPE (attr, PTHREAD_MUTEX_ERRORCHECK) == 0 /* Set type. */
-+ && mutex_reinit (mutex, attr) == 0
-+ && SET_TYPE (attr, PTHREAD_MUTEX_RECURSIVE) == 0
-+ && mutex_reinit (mutex, attr) == 0
-+ && SET_TYPE (attr, PTHREAD_MUTEX_NORMAL) == 0
-+ && mutex_reinit (mutex, attr) == 0)
-+ result = PASS;
-+
-+ return result;
-+}
-+
-+/* Tests setting whether the mutex is robust. */
-+static int
-+test_setrobust (pthread_mutex_t *mutex, pthread_mutexattr_t *attr)
-+{
-+ int result = FAIL;
-+
-+ if (SET_ROBUST (attr, PTHREAD_MUTEX_ROBUST) == 0 /* Set robust. */
-+ && mutex_reinit (mutex, attr) == 0
-+ && SET_ROBUST (attr, PTHREAD_MUTEX_STALLED) == 0
-+ && mutex_reinit (mutex, attr) == 0)
-+ result = PASS;
-+
-+ return result;
-+}
-+
-+/* Tests setting whether the mutex can be shared between processes. */
-+static int
-+test_setpshared (pthread_mutex_t *mutex, pthread_mutexattr_t *attr)
-+{
-+ int result = FAIL;
-+
-+ if (SET_SHARED (attr, PTHREAD_PROCESS_SHARED) == 0 /* Set shared. */
-+ && mutex_reinit (mutex, attr) == 0
-+ && SET_SHARED (attr, PTHREAD_PROCESS_PRIVATE) == 0
-+ && mutex_reinit (mutex, attr) == 0)
-+ result = PASS;
-+
-+ return result;
-+}
-+
-+/* Tests setting the mutex protocol and, for Priority Protect, the Priority
-+ Ceiling. */
-+static int
-+test_setprotocol (pthread_mutex_t *mutex, pthread_mutexattr_t *attr)
-+{
-+ int result = FAIL;
-+ int old_prioceiling;
-+
-+ if (SET_PROTOCOL (attr, PTHREAD_PRIO_INHERIT) == 0 /* Set protocol. */
-+ && mutex_reinit (mutex, attr) == 0
-+ && SET_PROTOCOL (attr, PTHREAD_PRIO_PROTECT) == 0
-+ && mutex_reinit (mutex, attr) == 0
-+ && SET_PRIOCEILING(mutex, PRIOCEILING, &old_prioceiling) == 0
-+ && SET_PROTOCOL (attr, PTHREAD_PRIO_NONE) == 0
-+ && mutex_reinit (mutex, attr) == 0)
-+ result = PASS;
-+
-+ return result;
-+}
-diff --git a/nptl/test-mutexattr-printers.py b/nptl/test-mutexattr-printers.py
-new file mode 100644
-index 0000000..4464723
---- /dev/null
-+++ b/nptl/test-mutexattr-printers.py
-@@ -0,0 +1,101 @@
-+# Common tests for the MutexPrinter and MutexAttributesPrinter classes.
-+#
-+# Copyright (C) 2016 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/>.
-+
-+import sys
-+
-+from test_printers_common import *
-+
-+test_source = sys.argv[1]
-+test_bin = sys.argv[2]
-+printer_files = sys.argv[3:]
-+printer_names = ['global glibc-pthread-locks']
-+PRIOCEILING = 42
-+
-+try:
-+ init_test(test_bin, printer_files, printer_names)
-+ go_to_main()
-+
-+ check_debug_symbol('struct pthread_mutexattr')
-+
-+ mutex_var = 'mutex'
-+ mutex_to_string = 'pthread_mutex_t'
-+
-+ attr_var = 'attr'
-+ attr_to_string = 'pthread_mutexattr_t'
-+
-+ break_at(test_source, 'Set type')
-+ continue_cmd() # Go to test_settype
-+ next_cmd(2)
-+ test_printer(attr_var, attr_to_string, {'Type': 'Error check'})
-+ test_printer(mutex_var, mutex_to_string, {'Type': 'Error check'})
-+ next_cmd(2)
-+ test_printer(attr_var, attr_to_string, {'Type': 'Recursive'})
-+ test_printer(mutex_var, mutex_to_string, {'Type': 'Recursive'})
-+ next_cmd(2)
-+ test_printer(attr_var, attr_to_string, {'Type': 'Normal'})
-+ test_printer(mutex_var, mutex_to_string, {'Type': 'Normal'})
-+
-+ break_at(test_source, 'Set robust')
-+ continue_cmd() # Go to test_setrobust
-+ next_cmd(2)
-+ test_printer(attr_var, attr_to_string, {'Robust': 'Yes'})
-+ test_printer(mutex_var, mutex_to_string, {'Robust': 'Yes'})
-+ next_cmd(2)
-+ test_printer(attr_var, attr_to_string, {'Robust': 'No'})
-+ test_printer(mutex_var, mutex_to_string, {'Robust': 'No'})
-+
-+ break_at(test_source, 'Set shared')
-+ continue_cmd() # Go to test_setpshared
-+ next_cmd(2)
-+ test_printer(attr_var, attr_to_string, {'Shared': 'Yes'})
-+ test_printer(mutex_var, mutex_to_string, {'Shared': 'Yes'})
-+ next_cmd(2)
-+ test_printer(attr_var, attr_to_string, {'Shared': 'No'})
-+ test_printer(mutex_var, mutex_to_string, {'Shared': 'No'})
-+
-+ break_at(test_source, 'Set protocol')
-+ continue_cmd() # Go to test_setprotocol
-+ next_cmd(2)
-+ test_printer(attr_var, attr_to_string, {'Protocol': 'Priority inherit'})
-+ test_printer(mutex_var, mutex_to_string, {'Protocol': 'Priority inherit'})
-+ next_cmd(2)
-+ test_printer(attr_var, attr_to_string, {'Protocol': 'Priority protect'})
-+ test_printer(mutex_var, mutex_to_string, {'Protocol': 'Priority protect'})
-+ next_cmd(2)
-+ test_printer(mutex_var, mutex_to_string, {'Priority ceiling':
-+ str(PRIOCEILING)})
-+ next_cmd()
-+ test_printer(attr_var, attr_to_string, {'Protocol': 'None'})
-+ test_printer(mutex_var, mutex_to_string, {'Protocol': 'None'})
-+
-+ continue_cmd() # Exit
-+
-+except (NoLineError, pexpect.TIMEOUT) as exception:
-+ print('Error: {0}'.format(exception))
-+ result = FAIL
-+
-+except DebugError as exception:
-+ print(exception)
-+ result = UNSUPPORTED
-+
-+else:
-+ print('Test succeeded.')
-+ result = PASS
-+
-+exit(result)
-diff --git a/nptl/test-rwlock-printers.c b/nptl/test-rwlock-printers.c
-new file mode 100644
-index 0000000..dbbe9b8
---- /dev/null
-+++ b/nptl/test-rwlock-printers.c
-@@ -0,0 +1,78 @@
-+/* Helper program for testing the pthread_rwlock_t pretty printer.
-+
-+ Copyright (C) 2016 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/>. */
-+
-+/* Keep the calls to the pthread_* functions on separate lines to make it easy
-+ to advance through the program using the gdb 'next' command. */
-+
-+#include <pthread.h>
-+
-+#define PASS 0
-+#define FAIL 1
-+
-+static int test_locking_reader (pthread_rwlock_t *rwlock);
-+static int test_locking_writer (pthread_rwlock_t *rwlock);
-+
-+int
-+main (void)
-+{
-+ pthread_rwlock_t rwlock;
-+
-+ int result = FAIL;
-+
-+ if (test_locking_reader (&rwlock) == PASS
-+ && test_locking_writer (&rwlock) == PASS)
-+ result = PASS;
-+ /* Else, one of the pthread_rwlock* functions failed. */
-+
-+ return result;
-+}
-+
-+/* Tests locking the rwlock multiple times as a reader. */
-+static int
-+test_locking_reader (pthread_rwlock_t *rwlock)
-+{
-+ int result = FAIL;
-+
-+ if (pthread_rwlock_init (rwlock, NULL) == 0
-+ && pthread_rwlock_rdlock (rwlock) == 0 /* Test locking (reader). */
-+ && pthread_rwlock_rdlock (rwlock) == 0
-+ && pthread_rwlock_rdlock (rwlock) == 0
-+ && pthread_rwlock_unlock (rwlock) == 0
-+ && pthread_rwlock_unlock (rwlock) == 0
-+ && pthread_rwlock_unlock (rwlock) == 0
-+ && pthread_rwlock_destroy (rwlock) == 0)
-+ result = PASS;
-+
-+ return result;
-+}
-+
-+/* Tests locking the rwlock as a writer. */
-+static int
-+test_locking_writer (pthread_rwlock_t *rwlock)
-+{
-+ int result = FAIL;
-+
-+ if (pthread_rwlock_init (rwlock, NULL) == 0
-+ && pthread_rwlock_wrlock (rwlock) == 0 /* Test locking (writer). */
-+ && pthread_rwlock_unlock (rwlock) == 0
-+ && pthread_rwlock_destroy (rwlock) == 0)
-+ result = PASS;
-+
-+ return result;
-+}
-diff --git a/nptl/test-rwlock-printers.py b/nptl/test-rwlock-printers.py
-new file mode 100644
-index 0000000..b972fa6
---- /dev/null
-+++ b/nptl/test-rwlock-printers.py
-@@ -0,0 +1,64 @@
-+# Common tests for the RWLockPrinter class.
-+#
-+# Copyright (C) 2016 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/>.
-+
-+import sys
-+
-+from test_printers_common import *
-+
-+test_source = sys.argv[1]
-+test_bin = sys.argv[2]
-+printer_files = sys.argv[3:]
-+printer_names = ['global glibc-pthread-locks']
-+
-+try:
-+ init_test(test_bin, printer_files, printer_names)
-+ go_to_main()
-+
-+ var = 'rwlock'
-+ to_string = 'pthread_rwlock_t'
-+
-+ break_at(test_source, 'Test locking (reader)')
-+ continue_cmd() # Go to test_locking_reader
-+ test_printer(var, to_string, {'Status': 'Unlocked'})
-+ next_cmd()
-+ test_printer(var, to_string, {'Status': r'Locked \(Read\)', 'Readers': '1'})
-+ next_cmd()
-+ test_printer(var, to_string, {'Readers': '2'})
-+ next_cmd()
-+ test_printer(var, to_string, {'Readers': '3'})
-+
-+ break_at(test_source, 'Test locking (writer)')
-+ continue_cmd() # Go to test_locking_writer
-+ test_printer(var, to_string, {'Status': 'Unlocked'})
-+ next_cmd()
-+ thread_id = get_current_thread_lwpid()
-+ test_printer(var, to_string, {'Status': r'Locked \(Write\)',
-+ 'Writer ID': thread_id})
-+
-+ continue_cmd() # Exit
-+
-+except (NoLineError, pexpect.TIMEOUT) as exception:
-+ print('Error: {0}'.format(exception))
-+ result = FAIL
-+
-+else:
-+ print('Test succeeded.')
-+ result = PASS
-+
-+exit(result)
-diff --git a/nptl/test-rwlockattr-printers.c b/nptl/test-rwlockattr-printers.c
-new file mode 100644
-index 0000000..d12facf
---- /dev/null
-+++ b/nptl/test-rwlockattr-printers.c
-@@ -0,0 +1,98 @@
-+/* Helper program for testing the pthread_rwlock_t and pthread_rwlockattr_t
-+ pretty printers.
-+
-+ Copyright (C) 2016 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/>. */
-+
-+/* Keep the calls to the pthread_* functions on separate lines to make it easy
-+ to advance through the program using the gdb 'next' command. */
-+
-+#include <pthread.h>
-+
-+#define PASS 0
-+#define FAIL 1
-+
-+/* Need these so we don't have lines longer than 79 chars. */
-+#define SET_KIND(attr, kind) pthread_rwlockattr_setkind_np (attr, kind)
-+#define SET_SHARED(attr, shared) pthread_rwlockattr_setpshared (attr, shared)
-+
-+static int rwlock_reinit (pthread_rwlock_t *rwlock,
-+ const pthread_rwlockattr_t *attr);
-+static int test_setkind_np (pthread_rwlock_t *rwlock,
-+ pthread_rwlockattr_t *attr);
-+static int test_setpshared (pthread_rwlock_t *rwlock,
-+ pthread_rwlockattr_t *attr);
-+
-+int
-+main (void)
-+{
-+ pthread_rwlock_t rwlock;
-+ pthread_rwlockattr_t attr;
-+ int result = FAIL;
-+
-+ if (pthread_rwlockattr_init (&attr) == 0
-+ && pthread_rwlock_init (&rwlock, NULL) == 0
-+ && test_setkind_np (&rwlock, &attr) == PASS
-+ && test_setpshared (&rwlock, &attr) == PASS)
-+ result = PASS;
-+ /* Else, one of the pthread_rwlock* functions failed. */
-+
-+ return result;
-+}
-+
-+/* Destroys RWLOCK and re-initializes it using ATTR. */
-+static int
-+rwlock_reinit (pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr)
-+{
-+ int result = FAIL;
-+
-+ if (pthread_rwlock_destroy (rwlock) == 0
-+ && pthread_rwlock_init (rwlock, attr) == 0)
-+ result = PASS;
-+
-+ return result;
-+}
-+
-+/* Tests setting whether the rwlock prefers readers or writers. */
-+static int
-+test_setkind_np (pthread_rwlock_t *rwlock, pthread_rwlockattr_t *attr)
-+{
-+ int result = FAIL;
-+
-+ if (SET_KIND (attr, PTHREAD_RWLOCK_PREFER_READER_NP) == 0 /* Set kind. */
-+ && rwlock_reinit (rwlock, attr) == PASS
-+ && SET_KIND (attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP) == 0
-+ && rwlock_reinit (rwlock, attr) == PASS)
-+ result = PASS;
-+
-+ return result;
-+}
-+
-+/* Tests setting whether the rwlock can be shared between processes. */
-+static int
-+test_setpshared (pthread_rwlock_t *rwlock, pthread_rwlockattr_t *attr)
-+{
-+ int result = FAIL;
-+
-+ if (SET_SHARED (attr, PTHREAD_PROCESS_SHARED) == 0 /* Set shared. */
-+ && rwlock_reinit (rwlock, attr) == PASS
-+ && SET_SHARED (attr, PTHREAD_PROCESS_PRIVATE) == 0
-+ && rwlock_reinit (rwlock, attr) == PASS)
-+ result = PASS;
-+
-+ return result;
-+}
-diff --git a/nptl/test-rwlockattr-printers.py b/nptl/test-rwlockattr-printers.py
-new file mode 100644
-index 0000000..1ca2dc6
---- /dev/null
-+++ b/nptl/test-rwlockattr-printers.py
-@@ -0,0 +1,73 @@
-+# Common tests for the RWLockPrinter and RWLockAttributesPrinter classes.
-+#
-+# Copyright (C) 2016 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/>.
-+
-+import sys
-+
-+from test_printers_common import *
-+
-+test_source = sys.argv[1]
-+test_bin = sys.argv[2]
-+printer_files = sys.argv[3:]
-+printer_names = ['global glibc-pthread-locks']
-+
-+try:
-+ init_test(test_bin, printer_files, printer_names)
-+ go_to_main()
-+
-+ check_debug_symbol('struct pthread_rwlockattr')
-+
-+ rwlock_var = 'rwlock'
-+ rwlock_to_string = 'pthread_rwlock_t'
-+
-+ attr_var = 'attr'
-+ attr_to_string = 'pthread_rwlockattr_t'
-+
-+ break_at(test_source, 'Set kind')
-+ continue_cmd() # Go to test_setkind_np
-+ next_cmd(2)
-+ test_printer(rwlock_var, rwlock_to_string, {'Prefers': 'Readers'})
-+ test_printer(attr_var, attr_to_string, {'Prefers': 'Readers'})
-+ next_cmd(2)
-+ test_printer(rwlock_var, rwlock_to_string, {'Prefers': 'Writers'})
-+ test_printer(attr_var, attr_to_string, {'Prefers': 'Writers'})
-+
-+ break_at(test_source, 'Set shared')
-+ continue_cmd() # Go to test_setpshared
-+ next_cmd(2)
-+ test_printer(rwlock_var, rwlock_to_string, {'Shared': 'Yes'})
-+ test_printer(attr_var, attr_to_string, {'Shared': 'Yes'})
-+ next_cmd(2)
-+ test_printer(rwlock_var, rwlock_to_string, {'Shared': 'No'})
-+ test_printer(attr_var, attr_to_string, {'Shared': 'No'})
-+
-+ continue_cmd() # Exit
-+
-+except (NoLineError, pexpect.TIMEOUT) as exception:
-+ print('Error: {0}'.format(exception))
-+ result = FAIL
-+
-+except DebugError as exception:
-+ print(exception)
-+ result = UNSUPPORTED
-+
-+else:
-+ print('Test succeeded.')
-+ result = PASS
-+
-+exit(result)
-diff --git a/scripts/gen-py-const.awk b/scripts/gen-py-const.awk
-new file mode 100644
-index 0000000..4586f59
---- /dev/null
-+++ b/scripts/gen-py-const.awk
-@@ -0,0 +1,118 @@
-+# Script to generate constants for Python pretty printers.
-+#
-+# Copyright (C) 2016 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/>.
-+
-+# This script is a smaller version of the clever gen-asm-const.awk hack used to
-+# generate ASM constants from .sym files. We'll use this to generate constants
-+# for Python pretty printers.
-+#
-+# The input to this script are .pysym files that look like:
-+# #C_Preprocessor_Directive...
-+# NAME1
-+# NAME2 expression...
-+#
-+# A line giving just a name implies an expression consisting of just that name.
-+# Comments start with '--'.
-+#
-+# The output of this script is a 'dummy' function containing 'asm' declarations
-+# for each non-preprocessor line in the .pysym file. The expression values
-+# will appear as input operands to the 'asm' declaration. For example, if we
-+# have:
-+#
-+# /* header.h */
-+# #define MACRO 42
-+#
-+# struct S {
-+# char c1;
-+# char c2;
-+# char c3;
-+# };
-+#
-+# enum E {
-+# ZERO,
-+# ONE
-+# };
-+#
-+# /* symbols.pysym */
-+# #include <stddef.h>
-+# #include "header.h"
-+# -- This is a comment
-+# MACRO
-+# C3_OFFSET offsetof(struct S, c3)
-+# E_ONE ONE
-+#
-+# the output will be:
-+#
-+# #include <stddef.h>
-+# #include "header.h"
-+# void dummy(void)
-+# {
-+# asm ("@name@MACRO@value@%0@" : : "i" (MACRO));
-+# asm ("@name@C3_OFFSET@value@%0@" : : "i" (offsetof(struct S, c3)));
-+# asm ("@name@E_ONE@value@%0@" : : "i" (ONE));
-+# }
-+#
-+# We'll later feed this output to gcc -S. Since '-S' tells gcc to compile but
-+# not assemble, gcc will output something like:
-+#
-+# dummy:
-+# ...
-+# @name@MACRO@value@$42@
-+# @name@C3_OFFSET@value@$2@
-+# @name@E_ONE@value@$1@
-+#
-+# Finally, we can process that output to extract the constant values.
-+# Notice gcc may prepend a special character such as '$' to each value.
-+
-+# found_symbol indicates whether we found a non-comment, non-preprocessor line.
-+BEGIN { found_symbol = 0 }
-+
-+# C preprocessor directives go straight through.
-+/^#/ { print; next; }
-+
-+# Skip comments.
-+/--/ { next; }
-+
-+# Trim leading whitespace.
-+{ sub(/^[[:blank:]]*/, ""); }
-+
-+# If we found a non-comment, non-preprocessor line, print the 'dummy' function
-+# header.
-+NF > 0 && !found_symbol {
-+ print "void dummy(void)\n{";
-+ found_symbol = 1;
-+}
-+
-+# If the line contains just a name, duplicate it so we can use that name
-+# as the value of the expression.
-+NF == 1 { sub(/^.*$/, "& &"); }
-+
-+# If a line contains a name and an expression...
-+NF > 1 {
-+ name = $1;
-+
-+ # Remove any characters before the second field.
-+ sub(/^[^[:blank:]]+[[:blank:]]+/, "");
-+
-+ # '$0' ends up being everything that appeared after the first field
-+ # separator.
-+ printf " asm (\"@name@%s@value@%0@\" : : \"i\" (%s));\n", name, $0;
-+}
-+
-+# Close the 'dummy' function.
-+END { if (found_symbol) print "}"; }
-diff --git a/scripts/test_printers_common.py b/scripts/test_printers_common.py
-new file mode 100644
-index 0000000..c79d7e3
---- /dev/null
-+++ b/scripts/test_printers_common.py
-@@ -0,0 +1,364 @@
-+# Common functions and variables for testing the Python pretty printers.
-+#
-+# Copyright (C) 2016 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/>.
-+
-+"""These tests require PExpect 4.0 or newer.
-+
-+Exported constants:
-+ PASS, FAIL, UNSUPPORTED (int): Test exit codes, as per evaluate-test.sh.
-+"""
-+
-+import os
-+import re
-+from test_printers_exceptions import *
-+
-+PASS = 0
-+FAIL = 1
-+UNSUPPORTED = 77
-+
-+gdb_bin = 'gdb'
-+gdb_options = '-q -nx'
-+gdb_invocation = '{0} {1}'.format(gdb_bin, gdb_options)
-+pexpect_min_version = 4
-+gdb_min_version = (7, 8)
-+encoding = 'utf-8'
-+
-+try:
-+ import pexpect
-+except ImportError:
-+ print('PExpect 4.0 or newer must be installed to test the pretty printers.')
-+ exit(UNSUPPORTED)
-+
-+pexpect_version = pexpect.__version__.split('.')[0]
-+
-+if int(pexpect_version) < pexpect_min_version:
-+ print('PExpect 4.0 or newer must be installed to test the pretty printers.')
-+ exit(UNSUPPORTED)
-+
-+if not pexpect.which(gdb_bin):
-+ print('gdb 7.8 or newer must be installed to test the pretty printers.')
-+ exit(UNSUPPORTED)
-+
-+timeout = 5
-+TIMEOUTFACTOR = os.environ.get('TIMEOUTFACTOR')
-+
-+if TIMEOUTFACTOR:
-+ timeout = int(TIMEOUTFACTOR)
-+
-+try:
-+ # Check the gdb version.
-+ version_cmd = '{0} --version'.format(gdb_invocation, timeout=timeout)
-+ gdb_version_out = pexpect.run(version_cmd, encoding=encoding)
-+
-+ # The gdb version string is "GNU gdb <PKGVERSION><version>", where
-+ # PKGVERSION can be any text. We assume that there'll always be a space
-+ # between PKGVERSION and the version number for the sake of the regexp.
-+ version_match = re.search(r'GNU gdb .* ([1-9]+)\.([0-9]+)', gdb_version_out)
-+
-+ if not version_match:
-+ print('The gdb version string (gdb -v) is incorrectly formatted.')
-+ exit(UNSUPPORTED)
-+
-+ gdb_version = (int(version_match.group(1)), int(version_match.group(2)))
-+
-+ if gdb_version < gdb_min_version:
-+ print('gdb 7.8 or newer must be installed to test the pretty printers.')
-+ exit(UNSUPPORTED)
-+
-+ # Check if gdb supports Python.
-+ gdb_python_cmd = '{0} -ex "python import os" -batch'.format(gdb_invocation,
-+ timeout=timeout)
-+ gdb_python_error = pexpect.run(gdb_python_cmd, encoding=encoding)
-+
-+ if gdb_python_error:
-+ print('gdb must have python support to test the pretty printers.')
-+ exit(UNSUPPORTED)
-+
-+ # If everything's ok, spawn the gdb process we'll use for testing.
-+ gdb = pexpect.spawn(gdb_invocation, echo=False, timeout=timeout,
-+ encoding=encoding)
-+ gdb_prompt = u'\(gdb\)'
-+ gdb.expect(gdb_prompt)
-+
-+except pexpect.ExceptionPexpect as exception:
-+ print('Error: {0}'.format(exception))
-+ exit(FAIL)
-+
-+def test(command, pattern=None):
-+ """Sends 'command' to gdb and expects the given 'pattern'.
-+
-+ If 'pattern' is None, simply consumes everything up to and including
-+ the gdb prompt.
-+
-+ Args:
-+ command (string): The command we'll send to gdb.
-+ pattern (raw string): A pattern the gdb output should match.
-+
-+ Returns:
-+ string: The string that matched 'pattern', or an empty string if
-+ 'pattern' was None.
-+ """
-+
-+ match = ''
-+
-+ gdb.sendline(command)
-+
-+ if pattern:
-+ # PExpect does a non-greedy match for '+' and '*'. Since it can't look
-+ # ahead on the gdb output stream, if 'pattern' ends with a '+' or a '*'
-+ # we may end up matching only part of the required output.
-+ # To avoid this, we'll consume 'pattern' and anything that follows it
-+ # up to and including the gdb prompt, then extract 'pattern' later.
-+ index = gdb.expect([u'{0}.+{1}'.format(pattern, gdb_prompt),
-+ pexpect.TIMEOUT])
-+
-+ if index == 0:
-+ # gdb.after now contains the whole match. Extract the text that
-+ # matches 'pattern'.
-+ match = re.match(pattern, gdb.after, re.DOTALL).group()
-+ elif index == 1:
-+ # We got a timeout exception. Print information on what caused it
-+ # and bail out.
-+ error = ('Response does not match the expected pattern.\n'
-+ 'Command: {0}\n'
-+ 'Expected pattern: {1}\n'
-+ 'Response: {2}'.format(command, pattern, gdb.before))
-+
-+ raise pexpect.TIMEOUT(error)
-+ else:
-+ # Consume just the the gdb prompt.
-+ gdb.expect(gdb_prompt)
-+
-+ return match
-+
-+def init_test(test_bin, printer_files, printer_names):
-+ """Loads the test binary file and the required pretty printers to gdb.
-+
-+ Args:
-+ test_bin (string): The name of the test binary file.
-+ pretty_printers (list of strings): A list with the names of the pretty
-+ printer files.
-+ """
-+
-+ # Load all the pretty printer files. We're assuming these are safe.
-+ for printer_file in printer_files:
-+ test('source {0}'.format(printer_file))
-+
-+ # Disable all the pretty printers.
-+ test('disable pretty-printer', r'0 of [0-9]+ printers enabled')
-+
-+ # Enable only the required printers.
-+ for printer in printer_names:
-+ test('enable pretty-printer {0}'.format(printer),
-+ r'[1-9][0-9]* of [1-9]+ printers enabled')
-+
-+ # Finally, load the test binary.
-+ test('file {0}'.format(test_bin))
-+
-+def go_to_main():
-+ """Executes a gdb 'start' command, which takes us to main."""
-+
-+ test('start', r'main')
-+
-+def get_line_number(file_name, string):
-+ """Returns the number of the line in which 'string' appears within a file.
-+
-+ Args:
-+ file_name (string): The name of the file we'll search through.
-+ string (string): The string we'll look for.
-+
-+ Returns:
-+ int: The number of the line in which 'string' appears, starting from 1.
-+ """
-+ number = -1
-+
-+ with open(file_name) as src_file:
-+ for i, line in enumerate(src_file):
-+ if string in line:
-+ number = i + 1
-+ break
-+
-+ if number == -1:
-+ raise NoLineError(file_name, string)
-+
-+ return number
-+
-+def break_at(file_name, string, temporary=True, thread=None):
-+ """Places a breakpoint on the first line in 'file_name' containing 'string'.
-+
-+ 'string' is usually a comment like "Stop here". Notice this may fail unless
-+ the comment is placed inline next to actual code, e.g.:
-+
-+ ...
-+ /* Stop here */
-+ ...
-+
-+ may fail, while:
-+
-+ ...
-+ some_func(); /* Stop here */
-+ ...
-+
-+ will succeed.
-+
-+ If 'thread' isn't None, the breakpoint will be set for all the threads.
-+ Otherwise, it'll be set only for 'thread'.
-+
-+ Args:
-+ file_name (string): The name of the file we'll place the breakpoint in.
-+ string (string): A string we'll look for inside the file.
-+ We'll place a breakpoint on the line which contains it.
-+ temporary (bool): Whether the breakpoint should be automatically deleted
-+ after we reach it.
-+ thread (int): The number of the thread we'll place the breakpoint for,
-+ as seen by gdb. If specified, it should be greater than zero.
-+ """
-+
-+ if not thread:
-+ thread_str = ''
-+ else:
-+ thread_str = 'thread {0}'.format(thread)
-+
-+ if temporary:
-+ command = 'tbreak'
-+ break_type = 'Temporary breakpoint'
-+ else:
-+ command = 'break'
-+ break_type = 'Breakpoint'
-+
-+ line_number = str(get_line_number(file_name, string))
-+
-+ test('{0} {1}:{2} {3}'.format(command, file_name, line_number, thread_str),
-+ r'{0} [0-9]+ at 0x[a-f0-9]+: file {1}, line {2}\.'.format(break_type,
-+ file_name,
-+ line_number))
-+
-+def continue_cmd(thread=None):
-+ """Executes a gdb 'continue' command.
-+
-+ If 'thread' isn't None, the command will be applied to all the threads.
-+ Otherwise, it'll be applied only to 'thread'.
-+
-+ Args:
-+ thread (int): The number of the thread we'll apply the command to,
-+ as seen by gdb. If specified, it should be greater than zero.
-+ """
-+
-+ if not thread:
-+ command = 'continue'
-+ else:
-+ command = 'thread apply {0} continue'.format(thread)
-+
-+ test(command)
-+
-+def next_cmd(count=1, thread=None):
-+ """Executes a gdb 'next' command.
-+
-+ If 'thread' isn't None, the command will be applied to all the threads.
-+ Otherwise, it'll be applied only to 'thread'.
-+
-+ Args:
-+ count (int): The 'count' argument of the 'next' command.
-+ thread (int): The number of the thread we'll apply the command to,
-+ as seen by gdb. If specified, it should be greater than zero.
-+ """
-+
-+ if not thread:
-+ command = 'next'
-+ else:
-+ command = 'thread apply {0} next'
-+
-+ test('{0} {1}'.format(command, count))
-+
-+def select_thread(thread):
-+ """Selects the thread indicated by 'thread'.
-+
-+ Args:
-+ thread (int): The number of the thread we'll switch to, as seen by gdb.
-+ This should be greater than zero.
-+ """
-+
-+ if thread > 0:
-+ test('thread {0}'.format(thread))
-+
-+def get_current_thread_lwpid():
-+ """Gets the current thread's Lightweight Process ID.
-+
-+ Returns:
-+ string: The current thread's LWP ID.
-+ """
-+
-+ # It's easier to get the LWP ID through the Python API than the gdb CLI.
-+ command = 'python print(gdb.selected_thread().ptid[1])'
-+
-+ return test(command, r'[0-9]+')
-+
-+def set_scheduler_locking(mode):
-+ """Executes the gdb 'set scheduler-locking' command.
-+
-+ Args:
-+ mode (bool): Whether the scheduler locking mode should be 'on'.
-+ """
-+ modes = {
-+ True: 'on',
-+ False: 'off'
-+ }
-+
-+ test('set scheduler-locking {0}'.format(modes[mode]))
-+
-+def test_printer(var, to_string, children=None, is_ptr=True):
-+ """ Tests the output of a pretty printer.
-+
-+ For a variable called 'var', this tests whether its associated printer
-+ outputs the expected 'to_string' and children (if any).
-+
-+ Args:
-+ var (string): The name of the variable we'll print.
-+ to_string (raw string): The expected output of the printer's 'to_string'
-+ method.
-+ children (map {raw string->raw string}): A map with the expected output
-+ of the printer's children' method.
-+ is_ptr (bool): Whether 'var' is a pointer, and thus should be
-+ dereferenced.
-+ """
-+
-+ if is_ptr:
-+ var = '*{0}'.format(var)
-+
-+ test('print {0}'.format(var), to_string)
-+
-+ if children:
-+ for name, value in children.items():
-+ # Children are shown as 'name = value'.
-+ test('print {0}'.format(var), r'{0} = {1}'.format(name, value))
-+
-+def check_debug_symbol(symbol):
-+ """ Tests whether a given debugging symbol exists.
-+
-+ If the symbol doesn't exist, raises a DebugError.
-+
-+ Args:
-+ symbol (string): The symbol we're going to check for.
-+ """
-+
-+ try:
-+ test('ptype {0}'.format(symbol), r'type = {0}'.format(symbol))
-+
-+ except pexpect.TIMEOUT:
-+ # The symbol doesn't exist.
-+ raise DebugError(symbol)
-diff --git a/scripts/test_printers_exceptions.py b/scripts/test_printers_exceptions.py
-new file mode 100644
-index 0000000..17034b5
---- /dev/null
-+++ b/scripts/test_printers_exceptions.py
-@@ -0,0 +1,61 @@
-+# Exception classes used when testing the Python pretty printers.
-+#
-+# Copyright (C) 2016 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/>.
-+
-+class NoLineError(Exception):
-+ """Custom exception to indicate that a test file doesn't contain
-+ the requested string.
-+ """
-+
-+ def __init__(self, file_name, string):
-+ """Constructor.
-+
-+ Args:
-+ file_name (string): The name of the test file.
-+ string (string): The string that was requested.
-+ """
-+
-+ super(NoLineError, self).__init__()
-+ self.file_name = file_name
-+ self.string = string
-+
-+ def __str__(self):
-+ """Shows a readable representation of the exception."""
-+
-+ return ('File {0} has no line containing the following string: {1}'
-+ .format(self.file_name, self.string))
-+
-+class DebugError(Exception):
-+ """Custom exception to indicate that a required debugging symbol is missing.
-+ """
-+
-+ def __init__(self, symbol):
-+ """Constructor.
-+
-+ Args:
-+ symbol (string): The name of the entity whose debug info is missing.
-+ """
-+
-+ super(DebugError, self).__init__()
-+ self.symbol = symbol
-+
-+ def __str__(self):
-+ """Shows a readable representation of the exception."""
-+
-+ return ('The required debugging information for {0} is missing.'
-+ .format(self.symbol))
---
-2.10.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch
index 7cba6cc36..9e207e44d 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch
@@ -1,7 +1,7 @@
-From c99892f2018cd7fa0f37b53e6cebec99fa036472 Mon Sep 17 00:00:00 2001
+From e53968d61804b6bab32ec6e13cc0b3cd57214796 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 03/25] nativesdk-glibc: Raise the size of arrays containing dl
+Subject: [PATCH 03/26] nativesdk-glibc: Raise the size of arrays containing dl
paths
This patch puts the dynamic loader path in the binaries, SYSTEM_DIRS strings
@@ -21,13 +21,14 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
elf/interp.c | 2 +-
elf/ldconfig.c | 3 +++
elf/rtld.c | 5 +++--
+ iconv/gconv_conf.c | 2 +-
sysdeps/generic/dl-cache.h | 4 ----
- 6 files changed, 13 insertions(+), 9 deletions(-)
+ 7 files changed, 14 insertions(+), 10 deletions(-)
-Index: git/elf/dl-cache.c
-===================================================================
---- git.orig/elf/dl-cache.c
-+++ git/elf/dl-cache.c
+diff --git a/elf/dl-cache.c b/elf/dl-cache.c
+index cfa335e..daa12ec 100644
+--- a/elf/dl-cache.c
++++ b/elf/dl-cache.c
@@ -132,6 +132,10 @@ do \
while (0)
@@ -39,11 +40,11 @@ Index: git/elf/dl-cache.c
int
internal_function
_dl_cache_libcmp (const char *p1, const char *p2)
-Index: git/elf/dl-load.c
-===================================================================
---- git.orig/elf/dl-load.c
-+++ git/elf/dl-load.c
-@@ -106,8 +106,8 @@ static size_t max_capstrlen attribute_re
+diff --git a/elf/dl-load.c b/elf/dl-load.c
+index 3a3d112..a1410e4 100644
+--- a/elf/dl-load.c
++++ b/elf/dl-load.c
+@@ -106,8 +106,8 @@ static size_t max_capstrlen attribute_relro;
/* Get the generated information about the trusted directories. */
#include "trusted-dirs.h"
@@ -54,10 +55,10 @@ Index: git/elf/dl-load.c
{
SYSTEM_DIRS_LEN
};
-Index: git/elf/interp.c
-===================================================================
---- git.orig/elf/interp.c
-+++ git/elf/interp.c
+diff --git a/elf/interp.c b/elf/interp.c
+index 9448802..e7e8c70 100644
+--- a/elf/interp.c
++++ b/elf/interp.c
@@ -18,5 +18,5 @@
#include <runtime-linker.h>
@@ -65,10 +66,10 @@ Index: git/elf/interp.c
-const char __invoke_dynamic_linker__[] __attribute__ ((section (".interp")))
+const char __invoke_dynamic_linker__[4096] __attribute__ ((section (".interp")))
= RUNTIME_LINKER;
-Index: git/elf/ldconfig.c
-===================================================================
---- git.orig/elf/ldconfig.c
-+++ git/elf/ldconfig.c
+diff --git a/elf/ldconfig.c b/elf/ldconfig.c
+index 467ca82..631a2a9 100644
+--- a/elf/ldconfig.c
++++ b/elf/ldconfig.c
@@ -168,6 +168,9 @@ static struct argp argp =
options, parse_opt, NULL, doc, NULL, more_help, NULL
};
@@ -79,10 +80,10 @@ Index: git/elf/ldconfig.c
/* Check if string corresponds to an important hardware capability or
a platform. */
static int
-Index: git/elf/rtld.c
-===================================================================
---- git.orig/elf/rtld.c
-+++ git/elf/rtld.c
+diff --git a/elf/rtld.c b/elf/rtld.c
+index 4ec25d7..e159c12 100644
+--- a/elf/rtld.c
++++ b/elf/rtld.c
@@ -99,6 +99,7 @@ uintptr_t __pointer_chk_guard_local
strong_alias (__pointer_chk_guard_local, __pointer_chk_guard)
#endif
@@ -91,7 +92,7 @@ Index: git/elf/rtld.c
/* List of auditing DSOs. */
static struct audit_list
-@@ -873,12 +874,12 @@ of this helper program; chances are you
+@@ -854,12 +855,12 @@ 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\
@@ -106,10 +107,23 @@ Index: git/elf/rtld.c
++_dl_skip_args;
--_dl_argc;
-Index: git/sysdeps/generic/dl-cache.h
-===================================================================
---- git.orig/sysdeps/generic/dl-cache.h
-+++ git/sysdeps/generic/dl-cache.h
+diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c
+index e235188..569f72e 100644
+--- a/iconv/gconv_conf.c
++++ b/iconv/gconv_conf.c
+@@ -36,7 +36,7 @@
+
+
+ /* This is the default path where we look for module lists. */
+-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. */
+diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h
+index eb2f900..505804e 100644
+--- a/sysdeps/generic/dl-cache.h
++++ b/sysdeps/generic/dl-cache.h
@@ -27,10 +27,6 @@
((flags) == 1 || (flags) == _DL_CACHE_DEFAULT_ID)
#endif
@@ -121,51 +135,6 @@ Index: git/sysdeps/generic/dl-cache.h
#ifndef add_system_dir
# define add_system_dir(dir) add_dir (dir)
#endif
-Index: git/iconv/gconv_conf.c
-===================================================================
---- git.orig/iconv/gconv_conf.c
-+++ git/iconv/gconv_conf.c
-@@ -36,7 +36,7 @@
-
-
- /* This is the default path where we look for module lists. */
--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. */
-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];
-
--const char _nl_default_locale_path[] attribute_hidden = COMPLOCALEDIR;
-+char _nl_default_locale_path[4096] __attribute__ ((section (".gccrelocprefix"))) attribute_hidden = COMPLOCALEDIR;
-
- /* Checks if the name is actually present, that is, not NULL and not
- empty. */
-@@ -168,7 +168,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;
-- locale_path_len = sizeof _nl_default_locale_path;
-+ locale_path_len = strlen(_nl_default_locale_path) + 1;
- }
- else
- /* We really have to load some data. First see whether the name is
-Index: git/locale/localeinfo.h
-===================================================================
---- git.orig/locale/localeinfo.h
-+++ git/locale/localeinfo.h
-@@ -322,7 +322,7 @@ _nl_lookup_word (locale_t l, int categor
- }
-
- /* Default search path if no LOCPATH environment variable. */
--extern const char _nl_default_locale_path[] attribute_hidden;
-+extern char _nl_default_locale_path[] attribute_hidden;
-
- /* Load the locale data for CATEGORY from the file specified by *NAME.
- If *NAME is "", use environment variables as specified by POSIX, and
+--
+2.10.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0004-New-condvar-implementation-that-provides-stronger-or.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0004-New-condvar-implementation-that-provides-stronger-or.patch
deleted file mode 100644
index 3c7bfa160..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0004-New-condvar-implementation-that-provides-stronger-or.patch
+++ /dev/null
@@ -1,7171 +0,0 @@
-From 27af8689a6ba8d182f3cbe6ba42cc654ceed0351 Mon Sep 17 00:00:00 2001
-From: Catalin Enache <catalin.enache@windriver.com>
-Date: Fri, 30 Jun 2017 11:56:41 +0300
-Subject: [PATCH 4/6] New condvar implementation that provides stronger
- ordering guarantees.
-
-This is a new implementation for condition variables, required
-after http://austingroupbugs.net/view.php?id=609 to fix bug 13165. In
-essence, we need to be stricter in which waiters a signal or broadcast
-is required to wake up; this couldn't be solved using the old algorithm.
-ISO C++ made a similar clarification, so this also fixes a bug in
-current libstdc++, for example.
-
-We can't use the old algorithm anymore because futexes do not guarantee
-to wake in FIFO order. Thus, when we wake, we can't simply let any
-waiter grab a signal, but we need to ensure that one of the waiters
-happening before the signal is woken up. This is something the previous
-algorithm violated (see bug 13165).
-
-There's another issue specific to condvars: ABA issues on the underlying
-futexes. Unlike mutexes that have just three states, or semaphores that
-have no tokens or a limited number of them, the state of a condvar is
-the *order* of the waiters. A waiter on a semaphore can grab a token
-whenever one is available; a condvar waiter must only consume a signal
-if it is eligible to do so as determined by the relative order of the
-waiter and the signal.
-Therefore, this new algorithm maintains two groups of waiters: Those
-eligible to consume signals (G1), and those that have to wait until
-previous waiters have consumed signals (G2). Once G1 is empty, G2
-becomes the new G1. 64b counters are used to avoid ABA issues.
-
-This condvar doesn't yet use a requeue optimization (ie, on a broadcast,
-waking just one thread and requeueing all others on the futex of the
-mutex supplied by the program). I don't think doing the requeue is
-necessarily the right approach (but I haven't done real measurements
-yet):
-* If a program expects to wake many threads at the same time and make
-that scalable, a condvar isn't great anyway because of how it requires
-waiters to operate mutually exclusive (due to the mutex usage). Thus, a
-thundering herd problem is a scalability problem with or without the
-optimization. Using something like a semaphore might be more
-appropriate in such a case.
-* The scalability problem is actually at the mutex side; the condvar
-could help (and it tries to with the requeue optimization), but it
-should be the mutex who decides how that is done, and whether it is done
-at all.
-* Forcing all but one waiter into the kernel-side wait queue of the
-mutex prevents/avoids the use of lock elision on the mutex. Thus, it
-prevents the only cure against the underlying scalability problem
-inherent to condvars.
-* If condvars use short critical sections (ie, hold the mutex just to
-check a binary flag or such), which they should do ideally, then forcing
-all those waiter to proceed serially with kernel-based hand-off (ie,
-futex ops in the mutex' contended state, via the futex wait queues) will
-be less efficient than just letting a scalable mutex implementation take
-care of it. Our current mutex impl doesn't employ spinning at all, but
-if critical sections are short, spinning can be much better.
-* Doing the requeue stuff requires all waiters to always drive the mutex
-into the contended state. This leads to each waiter having to call
-futex_wake after lock release, even if this wouldn't be necessary.
-
- [BZ #13165]
- * nptl/pthread_cond_broadcast.c (__pthread_cond_broadcast): Rewrite to
- use new algorithm.
- * nptl/pthread_cond_destroy.c (__pthread_cond_destroy): Likewise.
- * nptl/pthread_cond_init.c (__pthread_cond_init): Likewise.
- * nptl/pthread_cond_signal.c (__pthread_cond_signal): Likewise.
- * nptl/pthread_cond_wait.c (__pthread_cond_wait): Likewise.
- (__pthread_cond_timedwait): Move here from pthread_cond_timedwait.c.
- (__condvar_confirm_wakeup, __condvar_cancel_waiting,
- __condvar_cleanup_waiting, __condvar_dec_grefs,
- __pthread_cond_wait_common): New.
- (__condvar_cleanup): Remove.
- * npt/pthread_condattr_getclock.c (pthread_condattr_getclock): Adapt.
- * npt/pthread_condattr_setclock.c (pthread_condattr_setclock):
- Likewise.
- * npt/pthread_condattr_getpshared.c (pthread_condattr_getpshared):
- Likewise.
- * npt/pthread_condattr_init.c (pthread_condattr_init): Likewise.
- * nptl/tst-cond1.c: Add comment.
- * nptl/tst-cond20.c (do_test): Adapt.
- * nptl/tst-cond22.c (do_test): Likewise.
- * sysdeps/aarch64/nptl/bits/pthreadtypes.h (pthread_cond_t): Adapt
- structure.
- * sysdeps/arm/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
- * sysdeps/ia64/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
- * sysdeps/m68k/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
- * sysdeps/microblaze/nptl/bits/pthreadtypes.h (pthread_cond_t):
- Likewise.
- * sysdeps/mips/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
- * sysdeps/nios2/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
- * sysdeps/s390/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
- * sysdeps/sh/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
- * sysdeps/tile/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
- * sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h (pthread_cond_t):
- Likewise.
- * sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h (pthread_cond_t):
- Likewise.
- * sysdeps/x86/bits/pthreadtypes.h (pthread_cond_t): Likewise.
- * sysdeps/nptl/internaltypes.h (COND_NWAITERS_SHIFT): Remove.
- (COND_CLOCK_BITS): Adapt.
- * sysdeps/nptl/pthread.h (PTHREAD_COND_INITIALIZER): Adapt.
- * nptl/pthreadP.h (__PTHREAD_COND_CLOCK_MONOTONIC_MASK,
- __PTHREAD_COND_SHARED_MASK): New.
- * nptl/nptl-printers.py (CLOCK_IDS): Remove.
- (ConditionVariablePrinter, ConditionVariableAttributesPrinter): Adapt.
- * nptl/nptl_lock_constants.pysym: Adapt.
- * nptl/test-cond-printers.py: Adapt.
- * sysdeps/unix/sysv/linux/hppa/internaltypes.h (cond_compat_clear,
- cond_compat_check_and_clear): Adapt.
- * sysdeps/unix/sysv/linux/hppa/pthread_cond_timedwait.c: Remove file ...
- * sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c
- (__pthread_cond_timedwait): ... and move here.
- * nptl/DESIGN-condvar.txt: Remove file.
- * nptl/lowlevelcond.sym: Likewise.
- * nptl/pthread_cond_timedwait.c: Likewise.
- * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S: Likewise.
- * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S: Likewise.
- * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Likewise.
- * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Likewise.
- * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_broadcast.S: Likewise.
- * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_signal.S: Likewise.
- * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_timedwait.S: Likewise.
- * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_wait.S: Likewise.
- * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_broadcast.S: Likewise.
- * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_signal.S: Likewise.
- * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S: Likewise.
- * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_wait.S: Likewise.
- * sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S: Likewise.
- * sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S: Likewise.
- * sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise.
- * sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
-
-Upstream-Status: Backport
-
-Author: Torvald Riegel <triegel@redhat.com>
-Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
----
- ChangeLog | 74 ++
- nptl/DESIGN-condvar.txt | 134 ---
- nptl/Makefile | 6 +-
- nptl/lowlevelcond.sym | 16 -
- nptl/nptl-printers.py | 70 +-
- nptl/nptl_lock_constants.pysym | 27 +-
- nptl/pthreadP.h | 7 +
- nptl/pthread_cond_broadcast.c | 99 ++-
- nptl/pthread_cond_common.c | 466 ++++++++++
- nptl/pthread_cond_destroy.c | 82 +-
- nptl/pthread_cond_init.c | 28 +-
- nptl/pthread_cond_signal.c | 99 ++-
- nptl/pthread_cond_timedwait.c | 268 ------
- nptl/pthread_cond_wait.c | 754 ++++++++++++----
- nptl/pthread_condattr_getclock.c | 2 +-
- nptl/pthread_condattr_getpshared.c | 3 +-
- nptl/pthread_condattr_init.c | 4 +-
- nptl/pthread_condattr_setclock.c | 11 +-
- nptl/test-cond-printers.py | 2 +-
- nptl/tst-cond1.c | 3 +
- nptl/tst-cond20.c | 5 +-
- nptl/tst-cond22.c | 18 +-
- sysdeps/aarch64/nptl/bits/pthreadtypes.h | 31 +-
- sysdeps/arm/nptl/bits/pthreadtypes.h | 29 +-
- sysdeps/ia64/nptl/bits/pthreadtypes.h | 31 +-
- sysdeps/m68k/nptl/bits/pthreadtypes.h | 32 +-
- sysdeps/microblaze/nptl/bits/pthreadtypes.h | 29 +-
- sysdeps/mips/nptl/bits/pthreadtypes.h | 31 +-
- sysdeps/nios2/nptl/bits/pthreadtypes.h | 31 +-
- sysdeps/nptl/internaltypes.h | 17 +-
- sysdeps/nptl/pthread.h | 2 +-
- sysdeps/s390/nptl/bits/pthreadtypes.h | 29 +-
- sysdeps/sh/nptl/bits/pthreadtypes.h | 29 +-
- sysdeps/tile/nptl/bits/pthreadtypes.h | 29 +-
- sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h | 31 +-
- sysdeps/unix/sysv/linux/hppa/internaltypes.h | 40 +-
- .../unix/sysv/linux/hppa/pthread_cond_timedwait.c | 41 -
- sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c | 13 +
- .../sysv/linux/i386/i686/pthread_cond_timedwait.S | 20 -
- .../unix/sysv/linux/i386/pthread_cond_broadcast.S | 241 -----
- sysdeps/unix/sysv/linux/i386/pthread_cond_signal.S | 216 -----
- .../unix/sysv/linux/i386/pthread_cond_timedwait.S | 974 ---------------------
- sysdeps/unix/sysv/linux/i386/pthread_cond_wait.S | 642 --------------
- .../unix/sysv/linux/powerpc/bits/pthreadtypes.h | 31 +-
- .../sysv/linux/x86_64/pthread_cond_broadcast.S | 177 ----
- .../unix/sysv/linux/x86_64/pthread_cond_signal.S | 161 ----
- .../sysv/linux/x86_64/pthread_cond_timedwait.S | 623 -------------
- sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S | 555 ------------
- sysdeps/x86/bits/pthreadtypes.h | 29 +-
- 49 files changed, 1671 insertions(+), 4621 deletions(-)
- delete mode 100644 nptl/DESIGN-condvar.txt
- delete mode 100644 nptl/lowlevelcond.sym
- create mode 100644 nptl/pthread_cond_common.c
- delete mode 100644 nptl/pthread_cond_timedwait.c
- delete mode 100644 sysdeps/unix/sysv/linux/hppa/pthread_cond_timedwait.c
- delete mode 100644 sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S
- delete mode 100644 sysdeps/unix/sysv/linux/i386/pthread_cond_broadcast.S
- delete mode 100644 sysdeps/unix/sysv/linux/i386/pthread_cond_signal.S
- delete mode 100644 sysdeps/unix/sysv/linux/i386/pthread_cond_timedwait.S
- delete mode 100644 sysdeps/unix/sysv/linux/i386/pthread_cond_wait.S
- delete mode 100644 sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
- delete mode 100644 sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
- delete mode 100644 sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
- delete mode 100644 sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
-
-diff --git a/ChangeLog b/ChangeLog
-index 8036c1e..c94db7b 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,3 +1,77 @@
-+2016-12-31 Torvald Riegel <triegel@redhat.com>
-+
-+ [BZ #13165]
-+ * nptl/pthread_cond_broadcast.c (__pthread_cond_broadcast): Rewrite to
-+ use new algorithm.
-+ * nptl/pthread_cond_destroy.c (__pthread_cond_destroy): Likewise.
-+ * nptl/pthread_cond_init.c (__pthread_cond_init): Likewise.
-+ * nptl/pthread_cond_signal.c (__pthread_cond_signal): Likewise.
-+ * nptl/pthread_cond_wait.c (__pthread_cond_wait): Likewise.
-+ (__pthread_cond_timedwait): Move here from pthread_cond_timedwait.c.
-+ (__condvar_confirm_wakeup, __condvar_cancel_waiting,
-+ __condvar_cleanup_waiting, __condvar_dec_grefs,
-+ __pthread_cond_wait_common): New.
-+ (__condvar_cleanup): Remove.
-+ * npt/pthread_condattr_getclock.c (pthread_condattr_getclock): Adapt.
-+ * npt/pthread_condattr_setclock.c (pthread_condattr_setclock):
-+ Likewise.
-+ * npt/pthread_condattr_getpshared.c (pthread_condattr_getpshared):
-+ Likewise.
-+ * npt/pthread_condattr_init.c (pthread_condattr_init): Likewise.
-+ * nptl/tst-cond1.c: Add comment.
-+ * nptl/tst-cond20.c (do_test): Adapt.
-+ * nptl/tst-cond22.c (do_test): Likewise.
-+ * sysdeps/aarch64/nptl/bits/pthreadtypes.h (pthread_cond_t): Adapt
-+ structure.
-+ * sysdeps/arm/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
-+ * sysdeps/ia64/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
-+ * sysdeps/m68k/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
-+ * sysdeps/microblaze/nptl/bits/pthreadtypes.h (pthread_cond_t):
-+ Likewise.
-+ * sysdeps/mips/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
-+ * sysdeps/nios2/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
-+ * sysdeps/s390/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
-+ * sysdeps/sh/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
-+ * sysdeps/tile/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
-+ * sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h (pthread_cond_t):
-+ Likewise.
-+ * sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h (pthread_cond_t):
-+ Likewise.
-+ * sysdeps/x86/bits/pthreadtypes.h (pthread_cond_t): Likewise.
-+ * sysdeps/nptl/internaltypes.h (COND_NWAITERS_SHIFT): Remove.
-+ (COND_CLOCK_BITS): Adapt.
-+ * sysdeps/nptl/pthread.h (PTHREAD_COND_INITIALIZER): Adapt.
-+ * nptl/pthreadP.h (__PTHREAD_COND_CLOCK_MONOTONIC_MASK,
-+ __PTHREAD_COND_SHARED_MASK): New.
-+ * nptl/nptl-printers.py (CLOCK_IDS): Remove.
-+ (ConditionVariablePrinter, ConditionVariableAttributesPrinter): Adapt.
-+ * nptl/nptl_lock_constants.pysym: Adapt.
-+ * nptl/test-cond-printers.py: Adapt.
-+ * sysdeps/unix/sysv/linux/hppa/internaltypes.h (cond_compat_clear,
-+ cond_compat_check_and_clear): Adapt.
-+ * sysdeps/unix/sysv/linux/hppa/pthread_cond_timedwait.c: Remove file ...
-+ * sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c
-+ (__pthread_cond_timedwait): ... and move here.
-+ * nptl/DESIGN-condvar.txt: Remove file.
-+ * nptl/lowlevelcond.sym: Likewise.
-+ * nptl/pthread_cond_timedwait.c: Likewise.
-+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S: Likewise.
-+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S: Likewise.
-+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Likewise.
-+ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Likewise.
-+ * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_broadcast.S: Likewise.
-+ * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_signal.S: Likewise.
-+ * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_timedwait.S: Likewise.
-+ * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_wait.S: Likewise.
-+ * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_broadcast.S: Likewise.
-+ * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_signal.S: Likewise.
-+ * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S: Likewise.
-+ * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_wait.S: Likewise.
-+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S: Likewise.
-+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S: Likewise.
-+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise.
-+ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
-+
- 2016-12-08 Martin Galvan <martin.galvan@tallertechnologies.com>
-
- * INSTALL: Regenerated.
-diff --git a/nptl/DESIGN-condvar.txt b/nptl/DESIGN-condvar.txt
-deleted file mode 100644
-index 4845251..0000000
---- a/nptl/DESIGN-condvar.txt
-+++ /dev/null
-@@ -1,134 +0,0 @@
--Conditional Variable pseudocode.
--================================
--
-- int pthread_cond_timedwait (pthread_cond_t *cv, pthread_mutex_t *mutex);
-- int pthread_cond_signal (pthread_cond_t *cv);
-- int pthread_cond_broadcast (pthread_cond_t *cv);
--
--struct pthread_cond_t {
--
-- unsigned int cond_lock;
--
-- internal mutex
--
-- uint64_t total_seq;
--
-- Total number of threads using the conditional variable.
--
-- uint64_t wakeup_seq;
--
-- sequence number for next wakeup.
--
-- uint64_t woken_seq;
--
-- sequence number of last woken thread.
--
-- uint32_t broadcast_seq;
--
--}
--
--
--struct cv_data {
--
-- pthread_cond_t *cv;
--
-- uint32_t bc_seq
--
--}
--
--
--
--cleanup_handler(cv_data)
--{
-- cv = cv_data->cv;
-- lll_lock(cv->lock);
--
-- if (cv_data->bc_seq == cv->broadcast_seq) {
-- ++cv->wakeup_seq;
-- ++cv->woken_seq;
-- }
--
-- /* make sure no signal gets lost. */
-- FUTEX_WAKE(cv->wakeup_seq, ALL);
--
-- lll_unlock(cv->lock);
--}
--
--
--cond_timedwait(cv, mutex, timeout):
--{
-- lll_lock(cv->lock);
-- mutex_unlock(mutex);
--
-- cleanup_push
--
-- ++cv->total_seq;
-- val = seq = cv->wakeup_seq;
-- cv_data.bc = cv->broadcast_seq;
-- cv_data.cv = cv;
--
-- while (1) {
--
-- lll_unlock(cv->lock);
--
-- enable_async(&cv_data);
--
-- ret = FUTEX_WAIT(cv->wakeup_seq, val, timeout);
--
-- restore_async
--
-- lll_lock(cv->lock);
--
-- if (bc != cv->broadcast_seq)
-- goto bc_out;
--
-- val = cv->wakeup_seq;
--
-- if (val != seq && cv->woken_seq != val) {
-- ret = 0;
-- break;
-- }
--
-- if (ret == TIMEDOUT) {
-- ++cv->wakeup_seq;
-- break;
-- }
-- }
--
-- ++cv->woken_seq;
--
-- bc_out:
-- lll_unlock(cv->lock);
--
-- cleanup_pop
--
-- mutex_lock(mutex);
--
-- return ret;
--}
--
--cond_signal(cv)
--{
-- lll_lock(cv->lock);
--
-- if (cv->total_seq > cv->wakeup_seq) {
-- ++cv->wakeup_seq;
-- FUTEX_WAKE(cv->wakeup_seq, 1);
-- }
--
-- lll_unlock(cv->lock);
--}
--
--cond_broadcast(cv)
--{
-- lll_lock(cv->lock);
--
-- if (cv->total_seq > cv->wakeup_seq) {
-- cv->wakeup_seq = cv->total_seq;
-- cv->woken_seq = cv->total_seq;
-- ++cv->broadcast_seq;
-- FUTEX_WAKE(cv->wakeup_seq, ALL);
-- }
--
-- lll_unlock(cv->lock);
--}
-diff --git a/nptl/Makefile b/nptl/Makefile
-index 49f6ba6..1f0674c 100644
---- a/nptl/Makefile
-+++ b/nptl/Makefile
-@@ -71,7 +71,7 @@ libpthread-routines = nptl-init vars events version pt-interp \
- pthread_rwlockattr_getkind_np \
- pthread_rwlockattr_setkind_np \
- pthread_cond_init pthread_cond_destroy \
-- pthread_cond_wait pthread_cond_timedwait \
-+ pthread_cond_wait \
- pthread_cond_signal pthread_cond_broadcast \
- old_pthread_cond_init old_pthread_cond_destroy \
- old_pthread_cond_wait old_pthread_cond_timedwait \
-@@ -181,7 +181,6 @@ CFLAGS-pthread_timedjoin.c = -fexceptions -fasynchronous-unwind-tables
- CFLAGS-pthread_once.c = $(uses-callbacks) -fexceptions \
- -fasynchronous-unwind-tables
- CFLAGS-pthread_cond_wait.c = -fexceptions -fasynchronous-unwind-tables
--CFLAGS-pthread_cond_timedwait.c = -fexceptions -fasynchronous-unwind-tables
- CFLAGS-sem_wait.c = -fexceptions -fasynchronous-unwind-tables
- CFLAGS-sem_timedwait.c = -fexceptions -fasynchronous-unwind-tables
-
-@@ -303,8 +302,7 @@ test-xfail-tst-once5 = yes
- # Files which must not be linked with libpthread.
- tests-nolibpthread = tst-unload
-
--gen-as-const-headers = pthread-errnos.sym \
-- lowlevelcond.sym lowlevelrwlock.sym \
-+gen-as-const-headers = pthread-errnos.sym lowlevelrwlock.sym \
- unwindbuf.sym \
- lowlevelrobustlock.sym pthread-pi-defines.sym
-
-diff --git a/nptl/lowlevelcond.sym b/nptl/lowlevelcond.sym
-deleted file mode 100644
-index 18e1ada..0000000
---- a/nptl/lowlevelcond.sym
-+++ /dev/null
-@@ -1,16 +0,0 @@
--#include <stddef.h>
--#include <sched.h>
--#include <bits/pthreadtypes.h>
--#include <internaltypes.h>
--
----
--
--cond_lock offsetof (pthread_cond_t, __data.__lock)
--cond_futex offsetof (pthread_cond_t, __data.__futex)
--cond_nwaiters offsetof (pthread_cond_t, __data.__nwaiters)
--total_seq offsetof (pthread_cond_t, __data.__total_seq)
--wakeup_seq offsetof (pthread_cond_t, __data.__wakeup_seq)
--woken_seq offsetof (pthread_cond_t, __data.__woken_seq)
--dep_mutex offsetof (pthread_cond_t, __data.__mutex)
--broadcast_seq offsetof (pthread_cond_t, __data.__broadcast_seq)
--nwaiters_shift COND_NWAITERS_SHIFT
-diff --git a/nptl/nptl-printers.py b/nptl/nptl-printers.py
-index e402f23..76adadd 100644
---- a/nptl/nptl-printers.py
-+++ b/nptl/nptl-printers.py
-@@ -293,16 +293,6 @@ class MutexAttributesPrinter(object):
- elif protocol == PTHREAD_PRIO_PROTECT:
- self.values.append(('Protocol', 'Priority protect'))
-
--CLOCK_IDS = {
-- CLOCK_REALTIME: 'CLOCK_REALTIME',
-- CLOCK_MONOTONIC: 'CLOCK_MONOTONIC',
-- CLOCK_PROCESS_CPUTIME_ID: 'CLOCK_PROCESS_CPUTIME_ID',
-- CLOCK_THREAD_CPUTIME_ID: 'CLOCK_THREAD_CPUTIME_ID',
-- CLOCK_MONOTONIC_RAW: 'CLOCK_MONOTONIC_RAW',
-- CLOCK_REALTIME_COARSE: 'CLOCK_REALTIME_COARSE',
-- CLOCK_MONOTONIC_COARSE: 'CLOCK_MONOTONIC_COARSE'
--}
--
- class ConditionVariablePrinter(object):
- """Pretty printer for pthread_cond_t."""
-
-@@ -313,24 +303,8 @@ class ConditionVariablePrinter(object):
- cond: A gdb.value representing a pthread_cond_t.
- """
-
-- # Since PTHREAD_COND_SHARED is an integer, we need to cast it to void *
-- # to be able to compare it to the condvar's __data.__mutex member.
-- #
-- # While it looks like self.shared_value should be a class variable,
-- # that would result in it having an incorrect size if we're loading
-- # these printers through .gdbinit for a 64-bit objfile in AMD64.
-- # This is because gdb initially assumes the pointer size to be 4 bytes,
-- # and only sets it to 8 after loading the 64-bit objfiles. Since
-- # .gdbinit runs before any objfiles are loaded, this would effectively
-- # make self.shared_value have a size of 4, thus breaking later
-- # comparisons with pointers whose types are looked up at runtime.
-- void_ptr_type = gdb.lookup_type('void').pointer()
-- self.shared_value = gdb.Value(PTHREAD_COND_SHARED).cast(void_ptr_type)
--
- data = cond['__data']
-- self.total_seq = data['__total_seq']
-- self.mutex = data['__mutex']
-- self.nwaiters = data['__nwaiters']
-+ self.wrefs = data['__wrefs']
- self.values = []
-
- self.read_values()
-@@ -360,7 +334,6 @@ class ConditionVariablePrinter(object):
-
- self.read_status()
- self.read_attributes()
-- self.read_mutex_info()
-
- def read_status(self):
- """Read the status of the condvar.
-@@ -369,41 +342,22 @@ class ConditionVariablePrinter(object):
- are waiting for it.
- """
-
-- if self.total_seq == PTHREAD_COND_DESTROYED:
-- self.values.append(('Status', 'Destroyed'))
--
-- self.values.append(('Threads waiting for this condvar',
-- self.nwaiters >> COND_NWAITERS_SHIFT))
-+ self.values.append(('Threads known to still execute a wait function',
-+ self.wrefs >> PTHREAD_COND_WREFS_SHIFT))
-
- def read_attributes(self):
- """Read the condvar's attributes."""
-
-- clock_id = self.nwaiters & ((1 << COND_NWAITERS_SHIFT) - 1)
--
-- # clock_id must be casted to int because it's a gdb.Value
-- self.values.append(('Clock ID', CLOCK_IDS[int(clock_id)]))
-+ if (self.wrefs & PTHREAD_COND_CLOCK_MONOTONIC_MASK) != 0:
-+ self.values.append(('Clock ID', 'CLOCK_MONOTONIC'))
-+ else:
-+ self.values.append(('Clock ID', 'CLOCK_REALTIME'))
-
-- shared = (self.mutex == self.shared_value)
--
-- if shared:
-+ if (self.wrefs & PTHREAD_COND_SHARED_MASK) != 0:
- self.values.append(('Shared', 'Yes'))
- else:
- self.values.append(('Shared', 'No'))
-
-- def read_mutex_info(self):
-- """Read the data of the mutex this condvar is bound to.
--
-- A pthread_cond_t's __data.__mutex member is a void * which
-- must be casted to pthread_mutex_t *. For shared condvars, this
-- member isn't recorded and has a special value instead.
-- """
--
-- if self.mutex and self.mutex != self.shared_value:
-- mutex_type = gdb.lookup_type('pthread_mutex_t')
-- mutex = self.mutex.cast(mutex_type.pointer()).dereference()
--
-- self.values.append(('Mutex', mutex))
--
- class ConditionVariableAttributesPrinter(object):
- """Pretty printer for pthread_condattr_t.
-
-@@ -453,10 +407,12 @@ class ConditionVariableAttributesPrinter(object):
- created in self.children.
- """
-
-- clock_id = self.condattr & ((1 << COND_NWAITERS_SHIFT) - 1)
-+ clock_id = (self.condattr >> 1) & ((1 << COND_CLOCK_BITS) - 1)
-
-- # clock_id must be casted to int because it's a gdb.Value
-- self.values.append(('Clock ID', CLOCK_IDS[int(clock_id)]))
-+ if clock_id != 0:
-+ self.values.append(('Clock ID', 'CLOCK_MONOTONIC'))
-+ else:
-+ self.values.append(('Clock ID', 'CLOCK_REALTIME'))
-
- if self.condattr & 1:
- self.values.append(('Shared', 'Yes'))
-diff --git a/nptl/nptl_lock_constants.pysym b/nptl/nptl_lock_constants.pysym
-index 303ec61..2ab3179 100644
---- a/nptl/nptl_lock_constants.pysym
-+++ b/nptl/nptl_lock_constants.pysym
-@@ -44,26 +44,13 @@ PTHREAD_PRIO_NONE
- PTHREAD_PRIO_INHERIT
- PTHREAD_PRIO_PROTECT
-
---- These values are hardcoded as well:
---- Value of __mutex for shared condvars.
--PTHREAD_COND_SHARED (void *)~0l
--
---- Value of __total_seq for destroyed condvars.
--PTHREAD_COND_DESTROYED -1ull
--
---- __nwaiters encodes the number of threads waiting on a condvar
---- and the clock ID.
---- __nwaiters >> COND_NWAITERS_SHIFT gives us the number of waiters.
--COND_NWAITERS_SHIFT
--
---- Condvar clock IDs
--CLOCK_REALTIME
--CLOCK_MONOTONIC
--CLOCK_PROCESS_CPUTIME_ID
--CLOCK_THREAD_CPUTIME_ID
--CLOCK_MONOTONIC_RAW
--CLOCK_REALTIME_COARSE
--CLOCK_MONOTONIC_COARSE
-+-- Condition variable
-+-- FIXME Why do macros prefixed with __ cannot be used directly?
-+PTHREAD_COND_SHARED_MASK __PTHREAD_COND_SHARED_MASK
-+PTHREAD_COND_CLOCK_MONOTONIC_MASK __PTHREAD_COND_CLOCK_MONOTONIC_MASK
-+COND_CLOCK_BITS
-+-- These values are hardcoded:
-+PTHREAD_COND_WREFS_SHIFT 3
-
- -- Rwlock attributes
- PTHREAD_RWLOCK_PREFER_READER_NP
-diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
-index 4edc74b..e9992bc 100644
---- a/nptl/pthreadP.h
-+++ b/nptl/pthreadP.h
-@@ -167,6 +167,13 @@ enum
- #define __PTHREAD_ONCE_FORK_GEN_INCR 4
-
-
-+/* Condition variable definitions. See __pthread_cond_wait_common.
-+ Need to be defined here so there is one place from which
-+ nptl_lock_constants can grab them. */
-+#define __PTHREAD_COND_CLOCK_MONOTONIC_MASK 2
-+#define __PTHREAD_COND_SHARED_MASK 1
-+
-+
- /* Internal variables. */
-
-
-diff --git a/nptl/pthread_cond_broadcast.c b/nptl/pthread_cond_broadcast.c
-index 552fd42..87c0755 100644
---- a/nptl/pthread_cond_broadcast.c
-+++ b/nptl/pthread_cond_broadcast.c
-@@ -19,72 +19,71 @@
- #include <endian.h>
- #include <errno.h>
- #include <sysdep.h>
--#include <lowlevellock.h>
-+#include <futex-internal.h>
- #include <pthread.h>
- #include <pthreadP.h>
- #include <stap-probe.h>
-+#include <atomic.h>
-
- #include <shlib-compat.h>
--#include <kernel-features.h>
-
-+#include "pthread_cond_common.c"
-
-+
-+/* We do the following steps from __pthread_cond_signal in one critical
-+ section: (1) signal all waiters in G1, (2) close G1 so that it can become
-+ the new G2 and make G2 the new G1, and (3) signal all waiters in the new
-+ G1. We don't need to do all these steps if there are no waiters in G1
-+ and/or G2. See __pthread_cond_signal for further details. */
- int
- __pthread_cond_broadcast (pthread_cond_t *cond)
- {
- LIBC_PROBE (cond_broadcast, 1, cond);
-
-- int pshared = (cond->__data.__mutex == (void *) ~0l)
-- ? LLL_SHARED : LLL_PRIVATE;
-- /* Make sure we are alone. */
-- lll_lock (cond->__data.__lock, pshared);
-+ unsigned int wrefs = atomic_load_relaxed (&cond->__data.__wrefs);
-+ if (wrefs >> 3 == 0)
-+ return 0;
-+ int private = __condvar_get_private (wrefs);
-+
-+ __condvar_acquire_lock (cond, private);
-
-- /* Are there any waiters to be woken? */
-- if (cond->__data.__total_seq > cond->__data.__wakeup_seq)
-+ unsigned long long int wseq = __condvar_load_wseq_relaxed (cond);
-+ unsigned int g2 = wseq & 1;
-+ unsigned int g1 = g2 ^ 1;
-+ wseq >>= 1;
-+ bool do_futex_wake = false;
-+
-+ /* Step (1): signal all waiters remaining in G1. */
-+ if (cond->__data.__g_size[g1] != 0)
- {
-- /* Yes. Mark them all as woken. */
-- cond->__data.__wakeup_seq = cond->__data.__total_seq;
-- cond->__data.__woken_seq = cond->__data.__total_seq;
-- cond->__data.__futex = (unsigned int) cond->__data.__total_seq * 2;
-- int futex_val = cond->__data.__futex;
-- /* Signal that a broadcast happened. */
-- ++cond->__data.__broadcast_seq;
--
-- /* We are done. */
-- lll_unlock (cond->__data.__lock, pshared);
--
-- /* Wake everybody. */
-- pthread_mutex_t *mut = (pthread_mutex_t *) cond->__data.__mutex;
--
-- /* Do not use requeue for pshared condvars. */
-- if (mut == (void *) ~0l
-- || PTHREAD_MUTEX_PSHARED (mut) & PTHREAD_MUTEX_PSHARED_BIT)
-- goto wake_all;
--
--#if (defined lll_futex_cmp_requeue_pi \
-- && defined __ASSUME_REQUEUE_PI)
-- if (USE_REQUEUE_PI (mut))
-- {
-- if (lll_futex_cmp_requeue_pi (&cond->__data.__futex, 1, INT_MAX,
-- &mut->__data.__lock, futex_val,
-- LLL_PRIVATE) == 0)
-- return 0;
-- }
-- else
--#endif
-- /* lll_futex_requeue returns 0 for success and non-zero
-- for errors. */
-- if (!__builtin_expect (lll_futex_requeue (&cond->__data.__futex, 1,
-- INT_MAX, &mut->__data.__lock,
-- futex_val, LLL_PRIVATE), 0))
-- return 0;
--
--wake_all:
-- lll_futex_wake (&cond->__data.__futex, INT_MAX, pshared);
-- return 0;
-+ /* Add as many signals as the remaining size of the group. */
-+ atomic_fetch_add_relaxed (cond->__data.__g_signals + g1,
-+ cond->__data.__g_size[g1] << 1);
-+ cond->__data.__g_size[g1] = 0;
-+
-+ /* We need to wake G1 waiters before we quiesce G1 below. */
-+ /* TODO Only set it if there are indeed futex waiters. We could
-+ also try to move this out of the critical section in cases when
-+ G2 is empty (and we don't need to quiesce). */
-+ futex_wake (cond->__data.__g_signals + g1, INT_MAX, private);
- }
-
-- /* We are done. */
-- lll_unlock (cond->__data.__lock, pshared);
-+ /* G1 is complete. Step (2) is next unless there are no waiters in G2, in
-+ which case we can stop. */
-+ if (__condvar_quiesce_and_switch_g1 (cond, wseq, &g1, private))
-+ {
-+ /* Step (3): Send signals to all waiters in the old G2 / new G1. */
-+ atomic_fetch_add_relaxed (cond->__data.__g_signals + g1,
-+ cond->__data.__g_size[g1] << 1);
-+ cond->__data.__g_size[g1] = 0;
-+ /* TODO Only set it if there are indeed futex waiters. */
-+ do_futex_wake = true;
-+ }
-+
-+ __condvar_release_lock (cond, private);
-+
-+ if (do_futex_wake)
-+ futex_wake (cond->__data.__g_signals + g1, INT_MAX, private);
-
- return 0;
- }
-diff --git a/nptl/pthread_cond_common.c b/nptl/pthread_cond_common.c
-new file mode 100644
-index 0000000..b374396
---- /dev/null
-+++ b/nptl/pthread_cond_common.c
-@@ -0,0 +1,466 @@
-+/* pthread_cond_common -- shared code for condition variable.
-+ Copyright (C) 2016 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 <atomic.h>
-+#include <stdint.h>
-+#include <pthread.h>
-+#include <libc-internal.h>
-+
-+/* We need 3 least-significant bits on __wrefs for something else. */
-+#define __PTHREAD_COND_MAX_GROUP_SIZE ((unsigned) 1 << 29)
-+
-+#if __HAVE_64B_ATOMICS == 1
-+
-+static uint64_t __attribute__ ((unused))
-+__condvar_load_wseq_relaxed (pthread_cond_t *cond)
-+{
-+ return atomic_load_relaxed (&cond->__data.__wseq);
-+}
-+
-+static uint64_t __attribute__ ((unused))
-+__condvar_fetch_add_wseq_acquire (pthread_cond_t *cond, unsigned int val)
-+{
-+ return atomic_fetch_add_acquire (&cond->__data.__wseq, val);
-+}
-+
-+static uint64_t __attribute__ ((unused))
-+__condvar_fetch_xor_wseq_release (pthread_cond_t *cond, unsigned int val)
-+{
-+ return atomic_fetch_xor_release (&cond->__data.__wseq, val);
-+}
-+
-+static uint64_t __attribute__ ((unused))
-+__condvar_load_g1_start_relaxed (pthread_cond_t *cond)
-+{
-+ return atomic_load_relaxed (&cond->__data.__g1_start);
-+}
-+
-+static void __attribute__ ((unused))
-+__condvar_add_g1_start_relaxed (pthread_cond_t *cond, unsigned int val)
-+{
-+ atomic_store_relaxed (&cond->__data.__g1_start,
-+ atomic_load_relaxed (&cond->__data.__g1_start) + val);
-+}
-+
-+#else
-+
-+/* We use two 64b counters: __wseq and __g1_start. They are monotonically
-+ increasing and single-writer-multiple-readers counters, so we can implement
-+ load, fetch-and-add, and fetch-and-xor operations even when we just have
-+ 32b atomics. Values we add or xor are less than or equal to 1<<31 (*),
-+ so we only have to make overflow-and-addition atomic wrt. to concurrent
-+ load operations and xor operations. To do that, we split each counter into
-+ two 32b values of which we reserve the MSB of each to represent an
-+ overflow from the lower-order half to the higher-order half.
-+
-+ In the common case, the state is (higher-order / lower-order half, and . is
-+ basically concatenation of the bits):
-+ 0.h / 0.l = h.l
-+
-+ When we add a value of x that overflows (i.e., 0.l + x == 1.L), we run the
-+ following steps S1-S4 (the values these represent are on the right-hand
-+ side):
-+ S1: 0.h / 1.L == (h+1).L
-+ S2: 1.(h+1) / 1.L == (h+1).L
-+ S3: 1.(h+1) / 0.L == (h+1).L
-+ S4: 0.(h+1) / 0.L == (h+1).L
-+ If the LSB of the higher-order half is set, readers will ignore the
-+ overflow bit in the lower-order half.
-+
-+ To get an atomic snapshot in load operations, we exploit that the
-+ higher-order half is monotonically increasing; if we load a value V from
-+ it, then read the lower-order half, and then read the higher-order half
-+ again and see the same value V, we know that both halves have existed in
-+ the sequence of values the full counter had. This is similar to the
-+ validated reads in the time-based STMs in GCC's libitm (e.g.,
-+ method_ml_wt).
-+
-+ The xor operation needs to be an atomic read-modify-write. The write
-+ itself is not an issue as it affects just the lower-order half but not bits
-+ used in the add operation. To make the full fetch-and-xor atomic, we
-+ exploit that concurrently, the value can increase by at most 1<<31 (*): The
-+ xor operation is only called while having acquired the lock, so not more
-+ than __PTHREAD_COND_MAX_GROUP_SIZE waiters can enter concurrently and thus
-+ increment __wseq. Therefore, if the xor operation observes a value of
-+ __wseq, then the value it applies the modification to later on can be
-+ derived (see below).
-+
-+ One benefit of this scheme is that this makes load operations
-+ obstruction-free because unlike if we would just lock the counter, readers
-+ can almost always interpret a snapshot of each halves. Readers can be
-+ forced to read a new snapshot when the read is concurrent with an overflow.
-+ However, overflows will happen infrequently, so load operations are
-+ practically lock-free.
-+
-+ (*) The highest value we add is __PTHREAD_COND_MAX_GROUP_SIZE << 2 to
-+ __g1_start (the two extra bits are for the lock in the two LSBs of
-+ __g1_start). */
-+
-+typedef struct
-+{
-+ unsigned int low;
-+ unsigned int high;
-+} _condvar_lohi;
-+
-+static uint64_t
-+__condvar_fetch_add_64_relaxed (_condvar_lohi *lh, unsigned int op)
-+{
-+ /* S1. Note that this is an atomic read-modify-write so it extends the
-+ release sequence of release MO store at S3. */
-+ unsigned int l = atomic_fetch_add_relaxed (&lh->low, op);
-+ unsigned int h = atomic_load_relaxed (&lh->high);
-+ uint64_t result = ((uint64_t) h << 31) | l;
-+ l += op;
-+ if ((l >> 31) > 0)
-+ {
-+ /* Overflow. Need to increment higher-order half. Note that all
-+ add operations are ordered in happens-before. */
-+ h++;
-+ /* S2. Release MO to synchronize with the loads of the higher-order half
-+ in the load operation. See __condvar_load_64_relaxed. */
-+ atomic_store_release (&lh->high, h | ((unsigned int) 1 << 31));
-+ l ^= (unsigned int) 1 << 31;
-+ /* S3. See __condvar_load_64_relaxed. */
-+ atomic_store_release (&lh->low, l);
-+ /* S4. Likewise. */
-+ atomic_store_release (&lh->high, h);
-+ }
-+ return result;
-+}
-+
-+static uint64_t
-+__condvar_load_64_relaxed (_condvar_lohi *lh)
-+{
-+ unsigned int h, l, h2;
-+ do
-+ {
-+ /* This load and the second one below to the same location read from the
-+ stores in the overflow handling of the add operation or the
-+ initializing stores (which is a simple special case because
-+ initialization always completely happens before further use).
-+ Because no two stores to the higher-order half write the same value,
-+ the loop ensures that if we continue to use the snapshot, this load
-+ and the second one read from the same store operation. All candidate
-+ store operations have release MO.
-+ If we read from S2 in the first load, then we will see the value of
-+ S1 on the next load (because we synchronize with S2), or a value
-+ later in modification order. We correctly ignore the lower-half's
-+ overflow bit in this case. If we read from S4, then we will see the
-+ value of S3 in the next load (or a later value), which does not have
-+ the overflow bit set anymore.
-+ */
-+ h = atomic_load_acquire (&lh->high);
-+ /* This will read from the release sequence of S3 (i.e, either the S3
-+ store or the read-modify-writes at S1 following S3 in modification
-+ order). Thus, the read synchronizes with S3, and the following load
-+ of the higher-order half will read from the matching S2 (or a later
-+ value).
-+ Thus, if we read a lower-half value here that already overflowed and
-+ belongs to an increased higher-order half value, we will see the
-+ latter and h and h2 will not be equal. */
-+ l = atomic_load_acquire (&lh->low);
-+ /* See above. */
-+ h2 = atomic_load_relaxed (&lh->high);
-+ }
-+ while (h != h2);
-+ if (((l >> 31) > 0) && ((h >> 31) > 0))
-+ l ^= (unsigned int) 1 << 31;
-+ return ((uint64_t) (h & ~((unsigned int) 1 << 31)) << 31) + l;
-+}
-+
-+static uint64_t __attribute__ ((unused))
-+__condvar_load_wseq_relaxed (pthread_cond_t *cond)
-+{
-+ return __condvar_load_64_relaxed ((_condvar_lohi *) &cond->__data.__wseq32);
-+}
-+
-+static uint64_t __attribute__ ((unused))
-+__condvar_fetch_add_wseq_acquire (pthread_cond_t *cond, unsigned int val)
-+{
-+ uint64_t r = __condvar_fetch_add_64_relaxed
-+ ((_condvar_lohi *) &cond->__data.__wseq32, val);
-+ atomic_thread_fence_acquire ();
-+ return r;
-+}
-+
-+static uint64_t __attribute__ ((unused))
-+__condvar_fetch_xor_wseq_release (pthread_cond_t *cond, unsigned int val)
-+{
-+ _condvar_lohi *lh = (_condvar_lohi *) &cond->__data.__wseq32;
-+ /* First, get the current value. See __condvar_load_64_relaxed. */
-+ unsigned int h, l, h2;
-+ do
-+ {
-+ h = atomic_load_acquire (&lh->high);
-+ l = atomic_load_acquire (&lh->low);
-+ h2 = atomic_load_relaxed (&lh->high);
-+ }
-+ while (h != h2);
-+ if (((l >> 31) > 0) && ((h >> 31) == 0))
-+ h++;
-+ h &= ~((unsigned int) 1 << 31);
-+ l &= ~((unsigned int) 1 << 31);
-+
-+ /* Now modify. Due to the coherence rules, the prior load will read a value
-+ earlier in modification order than the following fetch-xor.
-+ This uses release MO to make the full operation have release semantics
-+ (all other operations access the lower-order half). */
-+ unsigned int l2 = atomic_fetch_xor_release (&lh->low, val)
-+ & ~((unsigned int) 1 << 31);
-+ if (l2 < l)
-+ /* The lower-order half overflowed in the meantime. This happened exactly
-+ once due to the limit on concurrent waiters (see above). */
-+ h++;
-+ return ((uint64_t) h << 31) + l2;
-+}
-+
-+static uint64_t __attribute__ ((unused))
-+__condvar_load_g1_start_relaxed (pthread_cond_t *cond)
-+{
-+ return __condvar_load_64_relaxed
-+ ((_condvar_lohi *) &cond->__data.__g1_start32);
-+}
-+
-+static void __attribute__ ((unused))
-+__condvar_add_g1_start_relaxed (pthread_cond_t *cond, unsigned int val)
-+{
-+ ignore_value (__condvar_fetch_add_64_relaxed
-+ ((_condvar_lohi *) &cond->__data.__g1_start32, val));
-+}
-+
-+#endif /* !__HAVE_64B_ATOMICS */
-+
-+
-+/* The lock that signalers use. See pthread_cond_wait_common for uses.
-+ The lock is our normal three-state lock: not acquired (0) / acquired (1) /
-+ acquired-with-futex_wake-request (2). However, we need to preserve the
-+ other bits in the unsigned int used for the lock, and therefore it is a
-+ little more complex. */
-+static void __attribute__ ((unused))
-+__condvar_acquire_lock (pthread_cond_t *cond, int private)
-+{
-+ unsigned int s = atomic_load_relaxed (&cond->__data.__g1_orig_size);
-+ while ((s & 3) == 0)
-+ {
-+ if (atomic_compare_exchange_weak_acquire (&cond->__data.__g1_orig_size,
-+ &s, s | 1))
-+ return;
-+ /* TODO Spinning and back-off. */
-+ }
-+ /* We can't change from not acquired to acquired, so try to change to
-+ acquired-with-futex-wake-request and do a futex wait if we cannot change
-+ from not acquired. */
-+ while (1)
-+ {
-+ while ((s & 3) != 2)
-+ {
-+ if (atomic_compare_exchange_weak_acquire
-+ (&cond->__data.__g1_orig_size, &s, (s & ~(unsigned int) 3) | 2))
-+ {
-+ if ((s & 3) == 0)
-+ return;
-+ break;
-+ }
-+ /* TODO Back off. */
-+ }
-+ futex_wait_simple (&cond->__data.__g1_orig_size,
-+ (s & ~(unsigned int) 3) | 2, private);
-+ /* Reload so we see a recent value. */
-+ s = atomic_load_relaxed (&cond->__data.__g1_orig_size);
-+ }
-+}
-+
-+/* See __condvar_acquire_lock. */
-+static void __attribute__ ((unused))
-+__condvar_release_lock (pthread_cond_t *cond, int private)
-+{
-+ if ((atomic_fetch_and_release (&cond->__data.__g1_orig_size,
-+ ~(unsigned int) 3) & 3)
-+ == 2)
-+ futex_wake (&cond->__data.__g1_orig_size, 1, private);
-+}
-+
-+/* Only use this when having acquired the lock. */
-+static unsigned int __attribute__ ((unused))
-+__condvar_get_orig_size (pthread_cond_t *cond)
-+{
-+ return atomic_load_relaxed (&cond->__data.__g1_orig_size) >> 2;
-+}
-+
-+/* Only use this when having acquired the lock. */
-+static void __attribute__ ((unused))
-+__condvar_set_orig_size (pthread_cond_t *cond, unsigned int size)
-+{
-+ /* We have acquired the lock, but might get one concurrent update due to a
-+ lock state change from acquired to acquired-with-futex_wake-request.
-+ The store with relaxed MO is fine because there will be no further
-+ changes to the lock bits nor the size, and we will subsequently release
-+ the lock with release MO. */
-+ unsigned int s;
-+ s = (atomic_load_relaxed (&cond->__data.__g1_orig_size) & 3)
-+ | (size << 2);
-+ if ((atomic_exchange_relaxed (&cond->__data.__g1_orig_size, s) & 3)
-+ != (s & 3))
-+ atomic_store_relaxed (&cond->__data.__g1_orig_size, (size << 2) | 2);
-+}
-+
-+/* Returns FUTEX_SHARED or FUTEX_PRIVATE based on the provided __wrefs
-+ value. */
-+static int __attribute__ ((unused))
-+__condvar_get_private (int flags)
-+{
-+ if ((flags & __PTHREAD_COND_SHARED_MASK) == 0)
-+ return FUTEX_PRIVATE;
-+ else
-+ return FUTEX_SHARED;
-+}
-+
-+/* This closes G1 (whose index is in G1INDEX), waits for all futex waiters to
-+ leave G1, converts G1 into a fresh G2, and then switches group roles so that
-+ the former G2 becomes the new G1 ending at the current __wseq value when we
-+ eventually make the switch (WSEQ is just an observation of __wseq by the
-+ signaler).
-+ If G2 is empty, it will not switch groups because then it would create an
-+ empty G1 which would require switching groups again on the next signal.
-+ Returns false iff groups were not switched because G2 was empty. */
-+static bool __attribute__ ((unused))
-+__condvar_quiesce_and_switch_g1 (pthread_cond_t *cond, uint64_t wseq,
-+ unsigned int *g1index, int private)
-+{
-+ const unsigned int maxspin = 0;
-+ unsigned int g1 = *g1index;
-+
-+ /* If there is no waiter in G2, we don't do anything. The expression may
-+ look odd but remember that __g_size might hold a negative value, so
-+ putting the expression this way avoids relying on implementation-defined
-+ behavior.
-+ Note that this works correctly for a zero-initialized condvar too. */
-+ unsigned int old_orig_size = __condvar_get_orig_size (cond);
-+ uint64_t old_g1_start = __condvar_load_g1_start_relaxed (cond) >> 1;
-+ if (((unsigned) (wseq - old_g1_start - old_orig_size)
-+ + cond->__data.__g_size[g1 ^ 1]) == 0)
-+ return false;
-+
-+ /* Now try to close and quiesce G1. We have to consider the following kinds
-+ of waiters:
-+ * Waiters from less recent groups than G1 are not affected because
-+ nothing will change for them apart from __g1_start getting larger.
-+ * New waiters arriving concurrently with the group switching will all go
-+ into G2 until we atomically make the switch. Waiters existing in G2
-+ are not affected.
-+ * Waiters in G1 will be closed out immediately by setting a flag in
-+ __g_signals, which will prevent waiters from blocking using a futex on
-+ __g_signals and also notifies them that the group is closed. As a
-+ result, they will eventually remove their group reference, allowing us
-+ to close switch group roles. */
-+
-+ /* First, set the closed flag on __g_signals. This tells waiters that are
-+ about to wait that they shouldn't do that anymore. This basically
-+ serves as an advance notificaton of the upcoming change to __g1_start;
-+ waiters interpret it as if __g1_start was larger than their waiter
-+ sequence position. This allows us to change __g1_start after waiting
-+ for all existing waiters with group references to leave, which in turn
-+ makes recovery after stealing a signal simpler because it then can be
-+ skipped if __g1_start indicates that the group is closed (otherwise,
-+ we would have to recover always because waiters don't know how big their
-+ groups are). Relaxed MO is fine. */
-+ atomic_fetch_or_relaxed (cond->__data.__g_signals + g1, 1);
-+
-+ /* Wait until there are no group references anymore. The fetch-or operation
-+ injects us into the modification order of __g_refs; release MO ensures
-+ that waiters incrementing __g_refs after our fetch-or see the previous
-+ changes to __g_signals and to __g1_start that had to happen before we can
-+ switch this G1 and alias with an older group (we have two groups, so
-+ aliasing requires switching group roles twice). Note that nobody else
-+ can have set the wake-request flag, so we do not have to act upon it.
-+
-+ Also note that it is harmless if older waiters or waiters from this G1
-+ get a group reference after we have quiesced the group because it will
-+ remain closed for them either because of the closed flag in __g_signals
-+ or the later update to __g1_start. New waiters will never arrive here
-+ but instead continue to go into the still current G2. */
-+ unsigned r = atomic_fetch_or_release (cond->__data.__g_refs + g1, 0);
-+ while ((r >> 1) > 0)
-+ {
-+ for (unsigned int spin = maxspin; ((r >> 1) > 0) && (spin > 0); spin--)
-+ {
-+ /* TODO Back off. */
-+ r = atomic_load_relaxed (cond->__data.__g_refs + g1);
-+ }
-+ if ((r >> 1) > 0)
-+ {
-+ /* There is still a waiter after spinning. Set the wake-request
-+ flag and block. Relaxed MO is fine because this is just about
-+ this futex word. */
-+ r = atomic_fetch_or_relaxed (cond->__data.__g_refs + g1, 1);
-+
-+ if ((r >> 1) > 0)
-+ futex_wait_simple (cond->__data.__g_refs + g1, r, private);
-+ /* Reload here so we eventually see the most recent value even if we
-+ do not spin. */
-+ r = atomic_load_relaxed (cond->__data.__g_refs + g1);
-+ }
-+ }
-+ /* Acquire MO so that we synchronize with the release operation that waiters
-+ use to decrement __g_refs and thus happen after the waiters we waited
-+ for. */
-+ atomic_thread_fence_acquire ();
-+
-+ /* Update __g1_start, which finishes closing this group. The value we add
-+ will never be negative because old_orig_size can only be zero when we
-+ switch groups the first time after a condvar was initialized, in which
-+ case G1 will be at index 1 and we will add a value of 1. See above for
-+ why this takes place after waiting for quiescence of the group.
-+ Relaxed MO is fine because the change comes with no additional
-+ constraints that others would have to observe. */
-+ __condvar_add_g1_start_relaxed (cond,
-+ (old_orig_size << 1) + (g1 == 1 ? 1 : - 1));
-+
-+ /* Now reopen the group, thus enabling waiters to again block using the
-+ futex controlled by __g_signals. Release MO so that observers that see
-+ no signals (and thus can block) also see the write __g1_start and thus
-+ that this is now a new group (see __pthread_cond_wait_common for the
-+ matching acquire MO loads). */
-+ atomic_store_release (cond->__data.__g_signals + g1, 0);
-+
-+ /* At this point, the old G1 is now a valid new G2 (but not in use yet).
-+ No old waiter can neither grab a signal nor acquire a reference without
-+ noticing that __g1_start is larger.
-+ We can now publish the group switch by flipping the G2 index in __wseq.
-+ Release MO so that this synchronizes with the acquire MO operation
-+ waiters use to obtain a position in the waiter sequence. */
-+ wseq = __condvar_fetch_xor_wseq_release (cond, 1) >> 1;
-+ g1 ^= 1;
-+ *g1index ^= 1;
-+
-+ /* These values are just observed by signalers, and thus protected by the
-+ lock. */
-+ unsigned int orig_size = wseq - (old_g1_start + old_orig_size);
-+ __condvar_set_orig_size (cond, orig_size);
-+ /* Use and addition to not loose track of cancellations in what was
-+ previously G2. */
-+ cond->__data.__g_size[g1] += orig_size;
-+
-+ /* The new G1's size may be zero because of cancellations during its time
-+ as G2. If this happens, there are no waiters that have to receive a
-+ signal, so we do not need to add any and return false. */
-+ if (cond->__data.__g_size[g1] == 0)
-+ return false;
-+
-+ return true;
-+}
-diff --git a/nptl/pthread_cond_destroy.c b/nptl/pthread_cond_destroy.c
-index 1acd804..5845c6a 100644
---- a/nptl/pthread_cond_destroy.c
-+++ b/nptl/pthread_cond_destroy.c
-@@ -20,66 +20,42 @@
- #include <shlib-compat.h>
- #include "pthreadP.h"
- #include <stap-probe.h>
--
--
-+#include <atomic.h>
-+#include <futex-internal.h>
-+
-+#include "pthread_cond_common.c"
-+
-+/* See __pthread_cond_wait for a high-level description of the algorithm.
-+
-+ A correct program must make sure that no waiters are blocked on the condvar
-+ when it is destroyed, and that there are no concurrent signals or
-+ broadcasts. To wake waiters reliably, the program must signal or
-+ broadcast while holding the mutex or after having held the mutex. It must
-+ also ensure that no signal or broadcast are still pending to unblock
-+ waiters; IOW, because waiters can wake up spuriously, the program must
-+ effectively ensure that destruction happens after the execution of those
-+ signal or broadcast calls.
-+ Thus, we can assume that all waiters that are still accessing the condvar
-+ have been woken. We wait until they have confirmed to have woken up by
-+ decrementing __wrefs. */
- int
- __pthread_cond_destroy (pthread_cond_t *cond)
- {
-- int pshared = (cond->__data.__mutex == (void *) ~0l)
-- ? LLL_SHARED : LLL_PRIVATE;
--
- LIBC_PROBE (cond_destroy, 1, cond);
-
-- /* Make sure we are alone. */
-- lll_lock (cond->__data.__lock, pshared);
--
-- if (cond->__data.__total_seq > cond->__data.__wakeup_seq)
-- {
-- /* If there are still some waiters which have not been
-- woken up, this is an application bug. */
-- lll_unlock (cond->__data.__lock, pshared);
-- return EBUSY;
-- }
--
-- /* Tell pthread_cond_*wait that this condvar is being destroyed. */
-- cond->__data.__total_seq = -1ULL;
--
-- /* If there are waiters which have been already signalled or
-- broadcasted, but still are using the pthread_cond_t structure,
-- pthread_cond_destroy needs to wait for them. */
-- unsigned int nwaiters = cond->__data.__nwaiters;
--
-- if (nwaiters >= (1 << COND_NWAITERS_SHIFT))
-+ /* Set the wake request flag. We could also spin, but destruction that is
-+ concurrent with still-active waiters is probably neither common nor
-+ performance critical. Acquire MO to synchronize with waiters confirming
-+ that they finished. */
-+ unsigned int wrefs = atomic_fetch_or_acquire (&cond->__data.__wrefs, 4);
-+ int private = __condvar_get_private (wrefs);
-+ while (wrefs >> 3 != 0)
- {
-- /* Wake everybody on the associated mutex in case there are
-- threads that have been requeued to it.
-- Without this, pthread_cond_destroy could block potentially
-- for a long time or forever, as it would depend on other
-- thread's using the mutex.
-- When all threads waiting on the mutex are woken up, pthread_cond_wait
-- only waits for threads to acquire and release the internal
-- condvar lock. */
-- if (cond->__data.__mutex != NULL
-- && cond->__data.__mutex != (void *) ~0l)
-- {
-- pthread_mutex_t *mut = (pthread_mutex_t *) cond->__data.__mutex;
-- lll_futex_wake (&mut->__data.__lock, INT_MAX,
-- PTHREAD_MUTEX_PSHARED (mut));
-- }
--
-- do
-- {
-- lll_unlock (cond->__data.__lock, pshared);
--
-- lll_futex_wait (&cond->__data.__nwaiters, nwaiters, pshared);
--
-- lll_lock (cond->__data.__lock, pshared);
--
-- nwaiters = cond->__data.__nwaiters;
-- }
-- while (nwaiters >= (1 << COND_NWAITERS_SHIFT));
-+ futex_wait_simple (&cond->__data.__wrefs, wrefs, private);
-+ /* See above. */
-+ wrefs = atomic_load_acquire (&cond->__data.__wrefs);
- }
--
-+ /* The memory the condvar occupies can now be reused. */
- return 0;
- }
- versioned_symbol (libpthread, __pthread_cond_destroy,
-diff --git a/nptl/pthread_cond_init.c b/nptl/pthread_cond_init.c
-index 9023370..c1eac5f 100644
---- a/nptl/pthread_cond_init.c
-+++ b/nptl/pthread_cond_init.c
-@@ -19,25 +19,29 @@
- #include <shlib-compat.h>
- #include "pthreadP.h"
- #include <stap-probe.h>
-+#include <string.h>
-
-
-+/* See __pthread_cond_wait for details. */
- int
- __pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t *cond_attr)
- {
- struct pthread_condattr *icond_attr = (struct pthread_condattr *) cond_attr;
-
-- cond->__data.__lock = LLL_LOCK_INITIALIZER;
-- cond->__data.__futex = 0;
-- cond->__data.__nwaiters = (icond_attr != NULL
-- ? ((icond_attr->value >> 1)
-- & ((1 << COND_NWAITERS_SHIFT) - 1))
-- : CLOCK_REALTIME);
-- cond->__data.__total_seq = 0;
-- cond->__data.__wakeup_seq = 0;
-- cond->__data.__woken_seq = 0;
-- cond->__data.__mutex = (icond_attr == NULL || (icond_attr->value & 1) == 0
-- ? NULL : (void *) ~0l);
-- cond->__data.__broadcast_seq = 0;
-+ memset (cond, 0, sizeof (pthread_cond_t));
-+
-+ /* Update the pretty printers if the internal representation of icond_attr
-+ is changed. */
-+
-+ /* Iff not equal to ~0l, this is a PTHREAD_PROCESS_PRIVATE condvar. */
-+ if (icond_attr != NULL && (icond_attr->value & 1) != 0)
-+ cond->__data.__wrefs |= __PTHREAD_COND_SHARED_MASK;
-+ int clockid = (icond_attr != NULL
-+ ? ((icond_attr->value >> 1) & ((1 << COND_CLOCK_BITS) - 1))
-+ : CLOCK_REALTIME);
-+ /* If 0, CLOCK_REALTIME is used; CLOCK_MONOTONIC otherwise. */
-+ if (clockid != CLOCK_REALTIME)
-+ cond->__data.__wrefs |= __PTHREAD_COND_CLOCK_MONOTONIC_MASK;
-
- LIBC_PROBE (cond_init, 2, cond, cond_attr);
-
-diff --git a/nptl/pthread_cond_signal.c b/nptl/pthread_cond_signal.c
-index b3a6d3d..a95d569 100644
---- a/nptl/pthread_cond_signal.c
-+++ b/nptl/pthread_cond_signal.c
-@@ -19,62 +19,79 @@
- #include <endian.h>
- #include <errno.h>
- #include <sysdep.h>
--#include <lowlevellock.h>
-+#include <futex-internal.h>
- #include <pthread.h>
- #include <pthreadP.h>
-+#include <atomic.h>
-+#include <stdint.h>
-
- #include <shlib-compat.h>
--#include <kernel-features.h>
- #include <stap-probe.h>
-
-+#include "pthread_cond_common.c"
-
-+/* See __pthread_cond_wait for a high-level description of the algorithm. */
- int
- __pthread_cond_signal (pthread_cond_t *cond)
- {
-- int pshared = (cond->__data.__mutex == (void *) ~0l)
-- ? LLL_SHARED : LLL_PRIVATE;
--
- LIBC_PROBE (cond_signal, 1, cond);
-
-- /* Make sure we are alone. */
-- lll_lock (cond->__data.__lock, pshared);
--
-- /* Are there any waiters to be woken? */
-- if (cond->__data.__total_seq > cond->__data.__wakeup_seq)
-+ /* First check whether there are waiters. Relaxed MO is fine for that for
-+ the same reasons that relaxed MO is fine when observing __wseq (see
-+ below). */
-+ unsigned int wrefs = atomic_load_relaxed (&cond->__data.__wrefs);
-+ if (wrefs >> 3 == 0)
-+ return 0;
-+ int private = __condvar_get_private (wrefs);
-+
-+ __condvar_acquire_lock (cond, private);
-+
-+ /* Load the waiter sequence number, which represents our relative ordering
-+ to any waiters. Relaxed MO is sufficient for that because:
-+ 1) We can pick any position that is allowed by external happens-before
-+ constraints. In particular, if another __pthread_cond_wait call
-+ happened before us, this waiter must be eligible for being woken by
-+ us. The only way do establish such a happens-before is by signaling
-+ while having acquired the mutex associated with the condvar and
-+ ensuring that the signal's critical section happens after the waiter.
-+ Thus, the mutex ensures that we see that waiter's __wseq increase.
-+ 2) Once we pick a position, we do not need to communicate this to the
-+ program via a happens-before that we set up: First, any wake-up could
-+ be a spurious wake-up, so the program must not interpret a wake-up as
-+ an indication that the waiter happened before a particular signal;
-+ second, a program cannot detect whether a waiter has not yet been
-+ woken (i.e., it cannot distinguish between a non-woken waiter and one
-+ that has been woken but hasn't resumed execution yet), and thus it
-+ cannot try to deduce that a signal happened before a particular
-+ waiter. */
-+ unsigned long long int wseq = __condvar_load_wseq_relaxed (cond);
-+ unsigned int g1 = (wseq & 1) ^ 1;
-+ wseq >>= 1;
-+ bool do_futex_wake = false;
-+
-+ /* If G1 is still receiving signals, we put the signal there. If not, we
-+ check if G2 has waiters, and if so, quiesce and switch G1 to the former
-+ G2; if this results in a new G1 with waiters (G2 might have cancellations
-+ already, see __condvar_quiesce_and_switch_g1), we put the signal in the
-+ new G1. */
-+ if ((cond->__data.__g_size[g1] != 0)
-+ || __condvar_quiesce_and_switch_g1 (cond, wseq, &g1, private))
- {
-- /* Yes. Mark one of them as woken. */
-- ++cond->__data.__wakeup_seq;
-- ++cond->__data.__futex;
--
--#if (defined lll_futex_cmp_requeue_pi \
-- && defined __ASSUME_REQUEUE_PI)
-- pthread_mutex_t *mut = cond->__data.__mutex;
--
-- if (USE_REQUEUE_PI (mut)
-- /* This can only really fail with a ENOSYS, since nobody can modify
-- futex while we have the cond_lock. */
-- && lll_futex_cmp_requeue_pi (&cond->__data.__futex, 1, 0,
-- &mut->__data.__lock,
-- cond->__data.__futex, pshared) == 0)
-- {
-- lll_unlock (cond->__data.__lock, pshared);
-- return 0;
-- }
-- else
--#endif
-- /* Wake one. */
-- if (! __builtin_expect (lll_futex_wake_unlock (&cond->__data.__futex,
-- 1, 1,
-- &cond->__data.__lock,
-- pshared), 0))
-- return 0;
--
-- /* Fallback if neither of them work. */
-- lll_futex_wake (&cond->__data.__futex, 1, pshared);
-+ /* Add a signal. Relaxed MO is fine because signaling does not need to
-+ establish a happens-before relation (see above). We do not mask the
-+ release-MO store when initializing a group in
-+ __condvar_quiesce_and_switch_g1 because we use an atomic
-+ read-modify-write and thus extend that store's release sequence. */
-+ atomic_fetch_add_relaxed (cond->__data.__g_signals + g1, 2);
-+ cond->__data.__g_size[g1]--;
-+ /* TODO Only set it if there are indeed futex waiters. */
-+ do_futex_wake = true;
- }
-
-- /* We are done. */
-- lll_unlock (cond->__data.__lock, pshared);
-+ __condvar_release_lock (cond, private);
-+
-+ if (do_futex_wake)
-+ futex_wake (cond->__data.__g_signals + g1, 1, private);
-
- return 0;
- }
-diff --git a/nptl/pthread_cond_timedwait.c b/nptl/pthread_cond_timedwait.c
-deleted file mode 100644
-index 711a51d..0000000
---- a/nptl/pthread_cond_timedwait.c
-+++ /dev/null
-@@ -1,268 +0,0 @@
--/* Copyright (C) 2003-2016 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
--
-- 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 <endian.h>
--#include <errno.h>
--#include <sysdep.h>
--#include <lowlevellock.h>
--#include <pthread.h>
--#include <pthreadP.h>
--#include <sys/time.h>
--#include <kernel-features.h>
--
--#include <shlib-compat.h>
--
--#ifndef HAVE_CLOCK_GETTIME_VSYSCALL
--# undef INTERNAL_VSYSCALL
--# define INTERNAL_VSYSCALL INTERNAL_SYSCALL
--# undef INLINE_VSYSCALL
--# define INLINE_VSYSCALL INLINE_SYSCALL
--#else
--# include <libc-vdso.h>
--#endif
--
--/* Cleanup handler, defined in pthread_cond_wait.c. */
--extern void __condvar_cleanup (void *arg)
-- __attribute__ ((visibility ("hidden")));
--
--struct _condvar_cleanup_buffer
--{
-- int oldtype;
-- pthread_cond_t *cond;
-- pthread_mutex_t *mutex;
-- unsigned int bc_seq;
--};
--
--int
--__pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
-- const struct timespec *abstime)
--{
-- struct _pthread_cleanup_buffer buffer;
-- struct _condvar_cleanup_buffer cbuffer;
-- int result = 0;
--
-- /* Catch invalid parameters. */
-- if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
-- return EINVAL;
--
-- int pshared = (cond->__data.__mutex == (void *) ~0l)
-- ? LLL_SHARED : LLL_PRIVATE;
--
--#if (defined lll_futex_timed_wait_requeue_pi \
-- && defined __ASSUME_REQUEUE_PI)
-- int pi_flag = 0;
--#endif
--
-- /* Make sure we are alone. */
-- lll_lock (cond->__data.__lock, pshared);
--
-- /* Now we can release the mutex. */
-- int err = __pthread_mutex_unlock_usercnt (mutex, 0);
-- if (err)
-- {
-- lll_unlock (cond->__data.__lock, pshared);
-- return err;
-- }
--
-- /* We have one new user of the condvar. */
-- ++cond->__data.__total_seq;
-- ++cond->__data.__futex;
-- cond->__data.__nwaiters += 1 << COND_NWAITERS_SHIFT;
--
-- /* Work around the fact that the kernel rejects negative timeout values
-- despite them being valid. */
-- if (__glibc_unlikely (abstime->tv_sec < 0))
-- goto timeout;
--
-- /* Remember the mutex we are using here. If there is already a
-- different address store this is a bad user bug. Do not store
-- anything for pshared condvars. */
-- if (cond->__data.__mutex != (void *) ~0l)
-- cond->__data.__mutex = mutex;
--
-- /* Prepare structure passed to cancellation handler. */
-- cbuffer.cond = cond;
-- cbuffer.mutex = mutex;
--
-- /* Before we block we enable cancellation. Therefore we have to
-- install a cancellation handler. */
-- __pthread_cleanup_push (&buffer, __condvar_cleanup, &cbuffer);
--
-- /* The current values of the wakeup counter. The "woken" counter
-- must exceed this value. */
-- unsigned long long int val;
-- unsigned long long int seq;
-- val = seq = cond->__data.__wakeup_seq;
-- /* Remember the broadcast counter. */
-- cbuffer.bc_seq = cond->__data.__broadcast_seq;
--
-- while (1)
-- {
--#if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \
-- || !defined lll_futex_timed_wait_bitset)
-- struct timespec rt;
-- {
--# ifdef __NR_clock_gettime
-- INTERNAL_SYSCALL_DECL (err);
-- (void) INTERNAL_VSYSCALL (clock_gettime, err, 2,
-- (cond->__data.__nwaiters
-- & ((1 << COND_NWAITERS_SHIFT) - 1)),
-- &rt);
-- /* Convert the absolute timeout value to a relative timeout. */
-- rt.tv_sec = abstime->tv_sec - rt.tv_sec;
-- rt.tv_nsec = abstime->tv_nsec - rt.tv_nsec;
--# else
-- /* Get the current time. So far we support only one clock. */
-- struct timeval tv;
-- (void) __gettimeofday (&tv, NULL);
--
-- /* Convert the absolute timeout value to a relative timeout. */
-- rt.tv_sec = abstime->tv_sec - tv.tv_sec;
-- rt.tv_nsec = abstime->tv_nsec - tv.tv_usec * 1000;
--# endif
-- }
-- if (rt.tv_nsec < 0)
-- {
-- rt.tv_nsec += 1000000000;
-- --rt.tv_sec;
-- }
-- /* Did we already time out? */
-- if (__glibc_unlikely (rt.tv_sec < 0))
-- {
-- if (cbuffer.bc_seq != cond->__data.__broadcast_seq)
-- goto bc_out;
--
-- goto timeout;
-- }
--#endif
--
-- unsigned int futex_val = cond->__data.__futex;
--
-- /* Prepare to wait. Release the condvar futex. */
-- lll_unlock (cond->__data.__lock, pshared);
--
-- /* Enable asynchronous cancellation. Required by the standard. */
-- cbuffer.oldtype = __pthread_enable_asynccancel ();
--
--/* REQUEUE_PI was implemented after FUTEX_CLOCK_REALTIME, so it is sufficient
-- to check just the former. */
--#if (defined lll_futex_timed_wait_requeue_pi \
-- && defined __ASSUME_REQUEUE_PI)
-- /* If pi_flag remained 1 then it means that we had the lock and the mutex
-- but a spurious waker raced ahead of us. Give back the mutex before
-- going into wait again. */
-- if (pi_flag)
-- {
-- __pthread_mutex_cond_lock_adjust (mutex);
-- __pthread_mutex_unlock_usercnt (mutex, 0);
-- }
-- pi_flag = USE_REQUEUE_PI (mutex);
--
-- if (pi_flag)
-- {
-- unsigned int clockbit = (cond->__data.__nwaiters & 1
-- ? 0 : FUTEX_CLOCK_REALTIME);
-- err = lll_futex_timed_wait_requeue_pi (&cond->__data.__futex,
-- futex_val, abstime, clockbit,
-- &mutex->__data.__lock,
-- pshared);
-- pi_flag = (err == 0);
-- }
-- else
--#endif
--
-- {
--#if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \
-- || !defined lll_futex_timed_wait_bitset)
-- /* Wait until woken by signal or broadcast. */
-- err = lll_futex_timed_wait (&cond->__data.__futex,
-- futex_val, &rt, pshared);
--#else
-- unsigned int clockbit = (cond->__data.__nwaiters & 1
-- ? 0 : FUTEX_CLOCK_REALTIME);
-- err = lll_futex_timed_wait_bitset (&cond->__data.__futex, futex_val,
-- abstime, clockbit, pshared);
--#endif
-- }
--
-- /* Disable asynchronous cancellation. */
-- __pthread_disable_asynccancel (cbuffer.oldtype);
--
-- /* We are going to look at shared data again, so get the lock. */
-- lll_lock (cond->__data.__lock, pshared);
--
-- /* If a broadcast happened, we are done. */
-- if (cbuffer.bc_seq != cond->__data.__broadcast_seq)
-- goto bc_out;
--
-- /* Check whether we are eligible for wakeup. */
-- val = cond->__data.__wakeup_seq;
-- if (val != seq && cond->__data.__woken_seq != val)
-- break;
--
-- /* Not woken yet. Maybe the time expired? */
-- if (__glibc_unlikely (err == -ETIMEDOUT))
-- {
-- timeout:
-- /* Yep. Adjust the counters. */
-- ++cond->__data.__wakeup_seq;
-- ++cond->__data.__futex;
--
-- /* The error value. */
-- result = ETIMEDOUT;
-- break;
-- }
-- }
--
-- /* Another thread woken up. */
-- ++cond->__data.__woken_seq;
--
-- bc_out:
--
-- cond->__data.__nwaiters -= 1 << COND_NWAITERS_SHIFT;
--
-- /* If pthread_cond_destroy was called on this variable already,
-- notify the pthread_cond_destroy caller all waiters have left
-- and it can be successfully destroyed. */
-- if (cond->__data.__total_seq == -1ULL
-- && cond->__data.__nwaiters < (1 << COND_NWAITERS_SHIFT))
-- lll_futex_wake (&cond->__data.__nwaiters, 1, pshared);
--
-- /* We are done with the condvar. */
-- lll_unlock (cond->__data.__lock, pshared);
--
-- /* The cancellation handling is back to normal, remove the handler. */
-- __pthread_cleanup_pop (&buffer, 0);
--
-- /* Get the mutex before returning. */
--#if (defined lll_futex_timed_wait_requeue_pi \
-- && defined __ASSUME_REQUEUE_PI)
-- if (pi_flag)
-- {
-- __pthread_mutex_cond_lock_adjust (mutex);
-- err = 0;
-- }
-- else
--#endif
-- err = __pthread_mutex_cond_lock (mutex);
--
-- return err ?: result;
--}
--
--versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
-- GLIBC_2_3_2);
-diff --git a/nptl/pthread_cond_wait.c b/nptl/pthread_cond_wait.c
-index 3f62acc..2b43402 100644
---- a/nptl/pthread_cond_wait.c
-+++ b/nptl/pthread_cond_wait.c
-@@ -19,219 +19,655 @@
- #include <endian.h>
- #include <errno.h>
- #include <sysdep.h>
--#include <lowlevellock.h>
-+#include <futex-internal.h>
- #include <pthread.h>
- #include <pthreadP.h>
--#include <kernel-features.h>
-+#include <sys/time.h>
-+#include <atomic.h>
-+#include <stdint.h>
-+#include <stdbool.h>
-
- #include <shlib-compat.h>
- #include <stap-probe.h>
-+#include <time.h>
-+
-+#include "pthread_cond_common.c"
-+
-
- struct _condvar_cleanup_buffer
- {
-- int oldtype;
-+ uint64_t wseq;
- pthread_cond_t *cond;
- pthread_mutex_t *mutex;
-- unsigned int bc_seq;
-+ int private;
- };
-
-
--void
--__attribute__ ((visibility ("hidden")))
--__condvar_cleanup (void *arg)
-+/* Decrease the waiter reference count. */
-+static void
-+__condvar_confirm_wakeup (pthread_cond_t *cond, int private)
- {
-- struct _condvar_cleanup_buffer *cbuffer =
-- (struct _condvar_cleanup_buffer *) arg;
-- unsigned int destroying;
-- int pshared = (cbuffer->cond->__data.__mutex == (void *) ~0l)
-- ? LLL_SHARED : LLL_PRIVATE;
-+ /* If destruction is pending (i.e., the wake-request flag is nonzero) and we
-+ are the last waiter (prior value of __wrefs was 1 << 3), then wake any
-+ threads waiting in pthread_cond_destroy. Release MO to synchronize with
-+ these threads. Don't bother clearing the wake-up request flag. */
-+ if ((atomic_fetch_add_release (&cond->__data.__wrefs, -8) >> 2) == 3)
-+ futex_wake (&cond->__data.__wrefs, INT_MAX, private);
-+}
-+
-
-- /* We are going to modify shared data. */
-- lll_lock (cbuffer->cond->__data.__lock, pshared);
-+/* Cancel waiting after having registered as a waiter previously. SEQ is our
-+ position and G is our group index.
-+ The goal of cancellation is to make our group smaller if that is still
-+ possible. If we are in a closed group, this is not possible anymore; in
-+ this case, we need to send a replacement signal for the one we effectively
-+ consumed because the signal should have gotten consumed by another waiter
-+ instead; we must not both cancel waiting and consume a signal.
-+
-+ Must not be called while still holding a reference on the group.
-+
-+ Returns true iff we consumed a signal.
-+
-+ On some kind of timeouts, we may be able to pretend that a signal we
-+ effectively consumed happened before the timeout (i.e., similarly to first
-+ spinning on signals before actually checking whether the timeout has
-+ passed already). Doing this would allow us to skip sending a replacement
-+ signal, but this case might happen rarely because the end of the timeout
-+ must race with someone else sending a signal. Therefore, we don't bother
-+ trying to optimize this. */
-+static void
-+__condvar_cancel_waiting (pthread_cond_t *cond, uint64_t seq, unsigned int g,
-+ int private)
-+{
-+ bool consumed_signal = false;
-
-- if (cbuffer->bc_seq == cbuffer->cond->__data.__broadcast_seq)
-+ /* No deadlock with group switching is possible here because we have do
-+ not hold a reference on the group. */
-+ __condvar_acquire_lock (cond, private);
-+
-+ uint64_t g1_start = __condvar_load_g1_start_relaxed (cond) >> 1;
-+ if (g1_start > seq)
-+ {
-+ /* Our group is closed, so someone provided enough signals for it.
-+ Thus, we effectively consumed a signal. */
-+ consumed_signal = true;
-+ }
-+ else
- {
-- /* This thread is not waiting anymore. Adjust the sequence counters
-- appropriately. We do not increment WAKEUP_SEQ if this would
-- bump it over the value of TOTAL_SEQ. This can happen if a thread
-- was woken and then canceled. */
-- if (cbuffer->cond->__data.__wakeup_seq
-- < cbuffer->cond->__data.__total_seq)
-+ if (g1_start + __condvar_get_orig_size (cond) <= seq)
-+ {
-+ /* We are in the current G2 and thus cannot have consumed a signal.
-+ Reduce its effective size or handle overflow. Remember that in
-+ G2, unsigned int size is zero or a negative value. */
-+ if (cond->__data.__g_size[g] + __PTHREAD_COND_MAX_GROUP_SIZE > 0)
-+ {
-+ cond->__data.__g_size[g]--;
-+ }
-+ else
-+ {
-+ /* Cancellations would overflow the maximum group size. Just
-+ wake up everyone spuriously to create a clean state. This
-+ also means we do not consume a signal someone else sent. */
-+ __condvar_release_lock (cond, private);
-+ __pthread_cond_broadcast (cond);
-+ return;
-+ }
-+ }
-+ else
- {
-- ++cbuffer->cond->__data.__wakeup_seq;
-- ++cbuffer->cond->__data.__futex;
-+ /* We are in current G1. If the group's size is zero, someone put
-+ a signal in the group that nobody else but us can consume. */
-+ if (cond->__data.__g_size[g] == 0)
-+ consumed_signal = true;
-+ else
-+ {
-+ /* Otherwise, we decrease the size of the group. This is
-+ equivalent to atomically putting in a signal just for us and
-+ consuming it right away. We do not consume a signal sent
-+ by someone else. We also cannot have consumed a futex
-+ wake-up because if we were cancelled or timed out in a futex
-+ call, the futex will wake another waiter. */
-+ cond->__data.__g_size[g]--;
-+ }
- }
-- ++cbuffer->cond->__data.__woken_seq;
- }
-
-- cbuffer->cond->__data.__nwaiters -= 1 << COND_NWAITERS_SHIFT;
-+ __condvar_release_lock (cond, private);
-
-- /* If pthread_cond_destroy was called on this variable already,
-- notify the pthread_cond_destroy caller all waiters have left
-- and it can be successfully destroyed. */
-- destroying = 0;
-- if (cbuffer->cond->__data.__total_seq == -1ULL
-- && cbuffer->cond->__data.__nwaiters < (1 << COND_NWAITERS_SHIFT))
-+ if (consumed_signal)
- {
-- lll_futex_wake (&cbuffer->cond->__data.__nwaiters, 1, pshared);
-- destroying = 1;
-+ /* We effectively consumed a signal even though we didn't want to.
-+ Therefore, we need to send a replacement signal.
-+ If we would want to optimize this, we could do what
-+ pthread_cond_signal does right in the critical section above. */
-+ __pthread_cond_signal (cond);
- }
-+}
-
-- /* We are done. */
-- lll_unlock (cbuffer->cond->__data.__lock, pshared);
--
-- /* Wake everybody to make sure no condvar signal gets lost. */
-- if (! destroying)
-- lll_futex_wake (&cbuffer->cond->__data.__futex, INT_MAX, pshared);
--
-- /* Get the mutex before returning unless asynchronous cancellation
-- is in effect. We don't try to get the mutex if we already own it. */
-- if (!(USE_REQUEUE_PI (cbuffer->mutex))
-- || ((cbuffer->mutex->__data.__lock & FUTEX_TID_MASK)
-- != THREAD_GETMEM (THREAD_SELF, tid)))
-- {
-- __pthread_mutex_cond_lock (cbuffer->mutex);
-- }
-- else
-- __pthread_mutex_cond_lock_adjust (cbuffer->mutex);
-+/* Wake up any signalers that might be waiting. */
-+static void
-+__condvar_dec_grefs (pthread_cond_t *cond, unsigned int g, int private)
-+{
-+ /* Release MO to synchronize-with the acquire load in
-+ __condvar_quiesce_and_switch_g1. */
-+ if (atomic_fetch_add_release (cond->__data.__g_refs + g, -2) == 3)
-+ {
-+ /* Clear the wake-up request flag before waking up. We do not need more
-+ than relaxed MO and it doesn't matter if we apply this for an aliased
-+ group because we wake all futex waiters right after clearing the
-+ flag. */
-+ atomic_fetch_and_relaxed (cond->__data.__g_refs + g, ~(unsigned int) 1);
-+ futex_wake (cond->__data.__g_refs + g, INT_MAX, private);
-+ }
- }
-
-+/* Clean-up for cancellation of waiters waiting for normal signals. We cancel
-+ our registration as a waiter, confirm we have woken up, and re-acquire the
-+ mutex. */
-+static void
-+__condvar_cleanup_waiting (void *arg)
-+{
-+ struct _condvar_cleanup_buffer *cbuffer =
-+ (struct _condvar_cleanup_buffer *) arg;
-+ pthread_cond_t *cond = cbuffer->cond;
-+ unsigned g = cbuffer->wseq & 1;
-
--int
--__pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
-+ __condvar_dec_grefs (cond, g, cbuffer->private);
-+
-+ __condvar_cancel_waiting (cond, cbuffer->wseq >> 1, g, cbuffer->private);
-+ /* FIXME With the current cancellation implementation, it is possible that
-+ a thread is cancelled after it has returned from a syscall. This could
-+ result in a cancelled waiter consuming a futex wake-up that is then
-+ causing another waiter in the same group to not wake up. To work around
-+ this issue until we have fixed cancellation, just add a futex wake-up
-+ conservatively. */
-+ futex_wake (cond->__data.__g_signals + g, 1, cbuffer->private);
-+
-+ __condvar_confirm_wakeup (cond, cbuffer->private);
-+
-+ /* XXX If locking the mutex fails, should we just stop execution? This
-+ might be better than silently ignoring the error. */
-+ __pthread_mutex_cond_lock (cbuffer->mutex);
-+}
-+
-+/* This condvar implementation guarantees that all calls to signal and
-+ broadcast and all of the three virtually atomic parts of each call to wait
-+ (i.e., (1) releasing the mutex and blocking, (2) unblocking, and (3) re-
-+ acquiring the mutex) happen in some total order that is consistent with the
-+ happens-before relations in the calling program. However, this order does
-+ not necessarily result in additional happens-before relations being
-+ established (which aligns well with spurious wake-ups being allowed).
-+
-+ All waiters acquire a certain position in a 64b waiter sequence (__wseq).
-+ This sequence determines which waiters are allowed to consume signals.
-+ A broadcast is equal to sending as many signals as are unblocked waiters.
-+ When a signal arrives, it samples the current value of __wseq with a
-+ relaxed-MO load (i.e., the position the next waiter would get). (This is
-+ sufficient because it is consistent with happens-before; the caller can
-+ enforce stronger ordering constraints by calling signal while holding the
-+ mutex.) Only waiters with a position less than the __wseq value observed
-+ by the signal are eligible to consume this signal.
-+
-+ This would be straight-forward to implement if waiters would just spin but
-+ we need to let them block using futexes. Futexes give no guarantee of
-+ waking in FIFO order, so we cannot reliably wake eligible waiters if we
-+ just use a single futex. Also, futex words are 32b in size, but we need
-+ to distinguish more than 1<<32 states because we need to represent the
-+ order of wake-up (and thus which waiters are eligible to consume signals);
-+ blocking in a futex is not atomic with a waiter determining its position in
-+ the waiter sequence, so we need the futex word to reliably notify waiters
-+ that they should not attempt to block anymore because they have been
-+ already signaled in the meantime. While an ABA issue on a 32b value will
-+ be rare, ignoring it when we are aware of it is not the right thing to do
-+ either.
-+
-+ Therefore, we use a 64b counter to represent the waiter sequence (on
-+ architectures which only support 32b atomics, we use a few bits less).
-+ To deal with the blocking using futexes, we maintain two groups of waiters:
-+ * Group G1 consists of waiters that are all eligible to consume signals;
-+ incoming signals will always signal waiters in this group until all
-+ waiters in G1 have been signaled.
-+ * Group G2 consists of waiters that arrive when a G1 is present and still
-+ contains waiters that have not been signaled. When all waiters in G1
-+ are signaled and a new signal arrives, the new signal will convert G2
-+ into the new G1 and create a new G2 for future waiters.
-+
-+ We cannot allocate new memory because of process-shared condvars, so we
-+ have just two slots of groups that change their role between G1 and G2.
-+ Each has a separate futex word, a number of signals available for
-+ consumption, a size (number of waiters in the group that have not been
-+ signaled), and a reference count.
-+
-+ The group reference count is used to maintain the number of waiters that
-+ are using the group's futex. Before a group can change its role, the
-+ reference count must show that no waiters are using the futex anymore; this
-+ prevents ABA issues on the futex word.
-+
-+ To represent which intervals in the waiter sequence the groups cover (and
-+ thus also which group slot contains G1 or G2), we use a 64b counter to
-+ designate the start position of G1 (inclusive), and a single bit in the
-+ waiter sequence counter to represent which group slot currently contains
-+ G2. This allows us to switch group roles atomically wrt. waiters obtaining
-+ a position in the waiter sequence. The G1 start position allows waiters to
-+ figure out whether they are in a group that has already been completely
-+ signaled (i.e., if the current G1 starts at a later position that the
-+ waiter's position). Waiters cannot determine whether they are currently
-+ in G2 or G1 -- but they do not have too because all they are interested in
-+ is whether there are available signals, and they always start in G2 (whose
-+ group slot they know because of the bit in the waiter sequence. Signalers
-+ will simply fill the right group until it is completely signaled and can
-+ be closed (they do not switch group roles until they really have to to
-+ decrease the likelihood of having to wait for waiters still holding a
-+ reference on the now-closed G1).
-+
-+ Signalers maintain the initial size of G1 to be able to determine where
-+ G2 starts (G2 is always open-ended until it becomes G1). They track the
-+ remaining size of a group; when waiters cancel waiting (due to PThreads
-+ cancellation or timeouts), they will decrease this remaining size as well.
-+
-+ To implement condvar destruction requirements (i.e., that
-+ pthread_cond_destroy can be called as soon as all waiters have been
-+ signaled), waiters increment a reference count before starting to wait and
-+ decrement it after they stopped waiting but right before they acquire the
-+ mutex associated with the condvar.
-+
-+ pthread_cond_t thus consists of the following (bits that are used for
-+ flags and are not part of the primary value of each field but necessary
-+ to make some things atomic or because there was no space for them
-+ elsewhere in the data structure):
-+
-+ __wseq: Waiter sequence counter
-+ * LSB is index of current G2.
-+ * Waiters fetch-add while having acquire the mutex associated with the
-+ condvar. Signalers load it and fetch-xor it concurrently.
-+ __g1_start: Starting position of G1 (inclusive)
-+ * LSB is index of current G2.
-+ * Modified by signalers while having acquired the condvar-internal lock
-+ and observed concurrently by waiters.
-+ __g1_orig_size: Initial size of G1
-+ * The two least-significant bits represent the condvar-internal lock.
-+ * Only accessed while having acquired the condvar-internal lock.
-+ __wrefs: Waiter reference counter.
-+ * Bit 2 is true if waiters should run futex_wake when they remove the
-+ last reference. pthread_cond_destroy uses this as futex word.
-+ * Bit 1 is the clock ID (0 == CLOCK_REALTIME, 1 == CLOCK_MONOTONIC).
-+ * Bit 0 is true iff this is a process-shared condvar.
-+ * Simple reference count used by both waiters and pthread_cond_destroy.
-+ (If the format of __wrefs is changed, update nptl_lock_constants.pysym
-+ and the pretty printers.)
-+ For each of the two groups, we have:
-+ __g_refs: Futex waiter reference count.
-+ * LSB is true if waiters should run futex_wake when they remove the
-+ last reference.
-+ * Reference count used by waiters concurrently with signalers that have
-+ acquired the condvar-internal lock.
-+ __g_signals: The number of signals that can still be consumed.
-+ * Used as a futex word by waiters. Used concurrently by waiters and
-+ signalers.
-+ * LSB is true iff this group has been completely signaled (i.e., it is
-+ closed).
-+ __g_size: Waiters remaining in this group (i.e., which have not been
-+ signaled yet.
-+ * Accessed by signalers and waiters that cancel waiting (both do so only
-+ when having acquired the condvar-internal lock.
-+ * The size of G2 is always zero because it cannot be determined until
-+ the group becomes G1.
-+ * Although this is of unsigned type, we rely on using unsigned overflow
-+ rules to make this hold effectively negative values too (in
-+ particular, when waiters in G2 cancel waiting).
-+
-+ A PTHREAD_COND_INITIALIZER condvar has all fields set to zero, which yields
-+ a condvar that has G2 starting at position 0 and a G1 that is closed.
-+
-+ Because waiters do not claim ownership of a group right when obtaining a
-+ position in __wseq but only reference count the group when using futexes
-+ to block, it can happen that a group gets closed before a waiter can
-+ increment the reference count. Therefore, waiters have to check whether
-+ their group is already closed using __g1_start. They also have to perform
-+ this check when spinning when trying to grab a signal from __g_signals.
-+ Note that for these checks, using relaxed MO to load __g1_start is
-+ sufficient because if a waiter can see a sufficiently large value, it could
-+ have also consume a signal in the waiters group.
-+
-+ Waiters try to grab a signal from __g_signals without holding a reference
-+ count, which can lead to stealing a signal from a more recent group after
-+ their own group was already closed. They cannot always detect whether they
-+ in fact did because they do not know when they stole, but they can
-+ conservatively add a signal back to the group they stole from; if they
-+ did so unnecessarily, all that happens is a spurious wake-up. To make this
-+ even less likely, __g1_start contains the index of the current g2 too,
-+ which allows waiters to check if there aliasing on the group slots; if
-+ there wasn't, they didn't steal from the current G1, which means that the
-+ G1 they stole from must have been already closed and they do not need to
-+ fix anything.
-+
-+ It is essential that the last field in pthread_cond_t is __g_signals[1]:
-+ The previous condvar used a pointer-sized field in pthread_cond_t, so a
-+ PTHREAD_COND_INITIALIZER from that condvar implementation might only
-+ initialize 4 bytes to zero instead of the 8 bytes we need (i.e., 44 bytes
-+ in total instead of the 48 we need). __g_signals[1] is not accessed before
-+ the first group switch (G2 starts at index 0), which will set its value to
-+ zero after a harmless fetch-or whose return value is ignored. This
-+ effectively completes initialization.
-+
-+
-+ Limitations:
-+ * This condvar isn't designed to allow for more than
-+ __PTHREAD_COND_MAX_GROUP_SIZE * (1 << 31) calls to __pthread_cond_wait.
-+ * More than __PTHREAD_COND_MAX_GROUP_SIZE concurrent waiters are not
-+ supported.
-+ * Beyond what is allowed as errors by POSIX or documented, we can also
-+ return the following errors:
-+ * EPERM if MUTEX is a recursive mutex and the caller doesn't own it.
-+ * EOWNERDEAD or ENOTRECOVERABLE when using robust mutexes. Unlike
-+ for other errors, this can happen when we re-acquire the mutex; this
-+ isn't allowed by POSIX (which requires all errors to virtually happen
-+ before we release the mutex or change the condvar state), but there's
-+ nothing we can do really.
-+ * When using PTHREAD_MUTEX_PP_* mutexes, we can also return all errors
-+ returned by __pthread_tpp_change_priority. We will already have
-+ released the mutex in such cases, so the caller cannot expect to own
-+ MUTEX.
-+
-+ Other notes:
-+ * Instead of the normal mutex unlock / lock functions, we use
-+ __pthread_mutex_unlock_usercnt(m, 0) / __pthread_mutex_cond_lock(m)
-+ because those will not change the mutex-internal users count, so that it
-+ can be detected when a condvar is still associated with a particular
-+ mutex because there is a waiter blocked on this condvar using this mutex.
-+*/
-+static __always_inline int
-+__pthread_cond_wait_common (pthread_cond_t *cond, pthread_mutex_t *mutex,
-+ const struct timespec *abstime)
- {
-- struct _pthread_cleanup_buffer buffer;
-- struct _condvar_cleanup_buffer cbuffer;
-+ const int maxspin = 0;
- int err;
-- int pshared = (cond->__data.__mutex == (void *) ~0l)
-- ? LLL_SHARED : LLL_PRIVATE;
--
--#if (defined lll_futex_wait_requeue_pi \
-- && defined __ASSUME_REQUEUE_PI)
-- int pi_flag = 0;
--#endif
-+ int result = 0;
-
- LIBC_PROBE (cond_wait, 2, cond, mutex);
-
-- /* Make sure we are alone. */
-- lll_lock (cond->__data.__lock, pshared);
--
-- /* Now we can release the mutex. */
-+ /* Acquire a position (SEQ) in the waiter sequence (WSEQ). We use an
-+ atomic operation because signals and broadcasts may update the group
-+ switch without acquiring the mutex. We do not need release MO here
-+ because we do not need to establish any happens-before relation with
-+ signalers (see __pthread_cond_signal); modification order alone
-+ establishes a total order of waiters/signals. We do need acquire MO
-+ to synchronize with group reinitialization in
-+ __condvar_quiesce_and_switch_g1. */
-+ uint64_t wseq = __condvar_fetch_add_wseq_acquire (cond, 2);
-+ /* Find our group's index. We always go into what was G2 when we acquired
-+ our position. */
-+ unsigned int g = wseq & 1;
-+ uint64_t seq = wseq >> 1;
-+
-+ /* Increase the waiter reference count. Relaxed MO is sufficient because
-+ we only need to synchronize when decrementing the reference count. */
-+ unsigned int flags = atomic_fetch_add_relaxed (&cond->__data.__wrefs, 8);
-+ int private = __condvar_get_private (flags);
-+
-+ /* Now that we are registered as a waiter, we can release the mutex.
-+ Waiting on the condvar must be atomic with releasing the mutex, so if
-+ the mutex is used to establish a happens-before relation with any
-+ signaler, the waiter must be visible to the latter; thus, we release the
-+ mutex after registering as waiter.
-+ If releasing the mutex fails, we just cancel our registration as a
-+ waiter and confirm that we have woken up. */
- err = __pthread_mutex_unlock_usercnt (mutex, 0);
-- if (__glibc_unlikely (err))
-+ if (__glibc_unlikely (err != 0))
- {
-- lll_unlock (cond->__data.__lock, pshared);
-+ __condvar_cancel_waiting (cond, seq, g, private);
-+ __condvar_confirm_wakeup (cond, private);
- return err;
- }
-
-- /* We have one new user of the condvar. */
-- ++cond->__data.__total_seq;
-- ++cond->__data.__futex;
-- cond->__data.__nwaiters += 1 << COND_NWAITERS_SHIFT;
--
-- /* Remember the mutex we are using here. If there is already a
-- different address store this is a bad user bug. Do not store
-- anything for pshared condvars. */
-- if (cond->__data.__mutex != (void *) ~0l)
-- cond->__data.__mutex = mutex;
--
-- /* Prepare structure passed to cancellation handler. */
-- cbuffer.cond = cond;
-- cbuffer.mutex = mutex;
--
-- /* Before we block we enable cancellation. Therefore we have to
-- install a cancellation handler. */
-- __pthread_cleanup_push (&buffer, __condvar_cleanup, &cbuffer);
--
-- /* The current values of the wakeup counter. The "woken" counter
-- must exceed this value. */
-- unsigned long long int val;
-- unsigned long long int seq;
-- val = seq = cond->__data.__wakeup_seq;
-- /* Remember the broadcast counter. */
-- cbuffer.bc_seq = cond->__data.__broadcast_seq;
-+ /* Now wait until a signal is available in our group or it is closed.
-+ Acquire MO so that if we observe a value of zero written after group
-+ switching in __condvar_quiesce_and_switch_g1, we synchronize with that
-+ store and will see the prior update of __g1_start done while switching
-+ groups too. */
-+ unsigned int signals = atomic_load_acquire (cond->__data.__g_signals + g);
-
- do
- {
-- unsigned int futex_val = cond->__data.__futex;
-- /* Prepare to wait. Release the condvar futex. */
-- lll_unlock (cond->__data.__lock, pshared);
--
-- /* Enable asynchronous cancellation. Required by the standard. */
-- cbuffer.oldtype = __pthread_enable_asynccancel ();
--
--#if (defined lll_futex_wait_requeue_pi \
-- && defined __ASSUME_REQUEUE_PI)
-- /* If pi_flag remained 1 then it means that we had the lock and the mutex
-- but a spurious waker raced ahead of us. Give back the mutex before
-- going into wait again. */
-- if (pi_flag)
-+ while (1)
- {
-- __pthread_mutex_cond_lock_adjust (mutex);
-- __pthread_mutex_unlock_usercnt (mutex, 0);
-+ /* Spin-wait first.
-+ Note that spinning first without checking whether a timeout
-+ passed might lead to what looks like a spurious wake-up even
-+ though we should return ETIMEDOUT (e.g., if the caller provides
-+ an absolute timeout that is clearly in the past). However,
-+ (1) spurious wake-ups are allowed, (2) it seems unlikely that a
-+ user will (ab)use pthread_cond_wait as a check for whether a
-+ point in time is in the past, and (3) spinning first without
-+ having to compare against the current time seems to be the right
-+ choice from a performance perspective for most use cases. */
-+ unsigned int spin = maxspin;
-+ while (signals == 0 && spin > 0)
-+ {
-+ /* Check that we are not spinning on a group that's already
-+ closed. */
-+ if (seq < (__condvar_load_g1_start_relaxed (cond) >> 1))
-+ goto done;
-+
-+ /* TODO Back off. */
-+
-+ /* Reload signals. See above for MO. */
-+ signals = atomic_load_acquire (cond->__data.__g_signals + g);
-+ spin--;
-+ }
-+
-+ /* If our group will be closed as indicated by the flag on signals,
-+ don't bother grabbing a signal. */
-+ if (signals & 1)
-+ goto done;
-+
-+ /* If there is an available signal, don't block. */
-+ if (signals != 0)
-+ break;
-+
-+ /* No signals available after spinning, so prepare to block.
-+ We first acquire a group reference and use acquire MO for that so
-+ that we synchronize with the dummy read-modify-write in
-+ __condvar_quiesce_and_switch_g1 if we read from that. In turn,
-+ in this case this will make us see the closed flag on __g_signals
-+ that designates a concurrent attempt to reuse the group's slot.
-+ We use acquire MO for the __g_signals check to make the
-+ __g1_start check work (see spinning above).
-+ Note that the group reference acquisition will not mask the
-+ release MO when decrementing the reference count because we use
-+ an atomic read-modify-write operation and thus extend the release
-+ sequence. */
-+ atomic_fetch_add_acquire (cond->__data.__g_refs + g, 2);
-+ if (((atomic_load_acquire (cond->__data.__g_signals + g) & 1) != 0)
-+ || (seq < (__condvar_load_g1_start_relaxed (cond) >> 1)))
-+ {
-+ /* Our group is closed. Wake up any signalers that might be
-+ waiting. */
-+ __condvar_dec_grefs (cond, g, private);
-+ goto done;
-+ }
-+
-+ // Now block.
-+ struct _pthread_cleanup_buffer buffer;
-+ struct _condvar_cleanup_buffer cbuffer;
-+ cbuffer.wseq = wseq;
-+ cbuffer.cond = cond;
-+ cbuffer.mutex = mutex;
-+ cbuffer.private = private;
-+ __pthread_cleanup_push (&buffer, __condvar_cleanup_waiting, &cbuffer);
-+
-+ if (abstime == NULL)
-+ {
-+ /* Block without a timeout. */
-+ err = futex_wait_cancelable (
-+ cond->__data.__g_signals + g, 0, private);
-+ }
-+ else
-+ {
-+ /* Block, but with a timeout.
-+ Work around the fact that the kernel rejects negative timeout
-+ values despite them being valid. */
-+ if (__glibc_unlikely (abstime->tv_sec < 0))
-+ err = ETIMEDOUT;
-+
-+ else if ((flags & __PTHREAD_COND_CLOCK_MONOTONIC_MASK) != 0)
-+ {
-+ /* CLOCK_MONOTONIC is requested. */
-+ struct timespec rt;
-+ if (__clock_gettime (CLOCK_MONOTONIC, &rt) != 0)
-+ __libc_fatal ("clock_gettime does not support "
-+ "CLOCK_MONOTONIC");
-+ /* Convert the absolute timeout value to a relative
-+ timeout. */
-+ rt.tv_sec = abstime->tv_sec - rt.tv_sec;
-+ rt.tv_nsec = abstime->tv_nsec - rt.tv_nsec;
-+ if (rt.tv_nsec < 0)
-+ {
-+ rt.tv_nsec += 1000000000;
-+ --rt.tv_sec;
-+ }
-+ /* Did we already time out? */
-+ if (__glibc_unlikely (rt.tv_sec < 0))
-+ err = ETIMEDOUT;
-+ else
-+ err = futex_reltimed_wait_cancelable
-+ (cond->__data.__g_signals + g, 0, &rt, private);
-+ }
-+ else
-+ {
-+ /* Use CLOCK_REALTIME. */
-+ err = futex_abstimed_wait_cancelable
-+ (cond->__data.__g_signals + g, 0, abstime, private);
-+ }
-+ }
-+
-+ __pthread_cleanup_pop (&buffer, 0);
-+
-+ if (__glibc_unlikely (err == ETIMEDOUT))
-+ {
-+ __condvar_dec_grefs (cond, g, private);
-+ /* If we timed out, we effectively cancel waiting. Note that
-+ we have decremented __g_refs before cancellation, so that a
-+ deadlock between waiting for quiescence of our group in
-+ __condvar_quiesce_and_switch_g1 and us trying to acquire
-+ the lock during cancellation is not possible. */
-+ __condvar_cancel_waiting (cond, seq, g, private);
-+ result = ETIMEDOUT;
-+ goto done;
-+ }
-+ else
-+ __condvar_dec_grefs (cond, g, private);
-+
-+ /* Reload signals. See above for MO. */
-+ signals = atomic_load_acquire (cond->__data.__g_signals + g);
- }
-- pi_flag = USE_REQUEUE_PI (mutex);
-
-- if (pi_flag)
-+ }
-+ /* Try to grab a signal. Use acquire MO so that we see an up-to-date value
-+ of __g1_start below (see spinning above for a similar case). In
-+ particular, if we steal from a more recent group, we will also see a
-+ more recent __g1_start below. */
-+ while (!atomic_compare_exchange_weak_acquire (cond->__data.__g_signals + g,
-+ &signals, signals - 2));
-+
-+ /* We consumed a signal but we could have consumed from a more recent group
-+ that aliased with ours due to being in the same group slot. If this
-+ might be the case our group must be closed as visible through
-+ __g1_start. */
-+ uint64_t g1_start = __condvar_load_g1_start_relaxed (cond);
-+ if (seq < (g1_start >> 1))
-+ {
-+ /* We potentially stole a signal from a more recent group but we do not
-+ know which group we really consumed from.
-+ We do not care about groups older than current G1 because they are
-+ closed; we could have stolen from these, but then we just add a
-+ spurious wake-up for the current groups.
-+ We will never steal a signal from current G2 that was really intended
-+ for G2 because G2 never receives signals (until it becomes G1). We
-+ could have stolen a signal from G2 that was conservatively added by a
-+ previous waiter that also thought it stole a signal -- but given that
-+ that signal was added unnecessarily, it's not a problem if we steal
-+ it.
-+ Thus, the remaining case is that we could have stolen from the current
-+ G1, where "current" means the __g1_start value we observed. However,
-+ if the current G1 does not have the same slot index as we do, we did
-+ not steal from it and do not need to undo that. This is the reason
-+ for putting a bit with G2's index into__g1_start as well. */
-+ if (((g1_start & 1) ^ 1) == g)
- {
-- err = lll_futex_wait_requeue_pi (&cond->__data.__futex,
-- futex_val, &mutex->__data.__lock,
-- pshared);
--
-- pi_flag = (err == 0);
-+ /* We have to conservatively undo our potential mistake of stealing
-+ a signal. We can stop trying to do that when the current G1
-+ changes because other spinning waiters will notice this too and
-+ __condvar_quiesce_and_switch_g1 has checked that there are no
-+ futex waiters anymore before switching G1.
-+ Relaxed MO is fine for the __g1_start load because we need to
-+ merely be able to observe this fact and not have to observe
-+ something else as well.
-+ ??? Would it help to spin for a little while to see whether the
-+ current G1 gets closed? This might be worthwhile if the group is
-+ small or close to being closed. */
-+ unsigned int s = atomic_load_relaxed (cond->__data.__g_signals + g);
-+ while (__condvar_load_g1_start_relaxed (cond) == g1_start)
-+ {
-+ /* Try to add a signal. We don't need to acquire the lock
-+ because at worst we can cause a spurious wake-up. If the
-+ group is in the process of being closed (LSB is true), this
-+ has an effect similar to us adding a signal. */
-+ if (((s & 1) != 0)
-+ || atomic_compare_exchange_weak_relaxed
-+ (cond->__data.__g_signals + g, &s, s + 2))
-+ {
-+ /* If we added a signal, we also need to add a wake-up on
-+ the futex. We also need to do that if we skipped adding
-+ a signal because the group is being closed because
-+ while __condvar_quiesce_and_switch_g1 could have closed
-+ the group, it might stil be waiting for futex waiters to
-+ leave (and one of those waiters might be the one we stole
-+ the signal from, which cause it to block using the
-+ futex). */
-+ futex_wake (cond->__data.__g_signals + g, 1, private);
-+ break;
-+ }
-+ /* TODO Back off. */
-+ }
- }
-- else
--#endif
-- /* Wait until woken by signal or broadcast. */
-- lll_futex_wait (&cond->__data.__futex, futex_val, pshared);
--
-- /* Disable asynchronous cancellation. */
-- __pthread_disable_asynccancel (cbuffer.oldtype);
--
-- /* We are going to look at shared data again, so get the lock. */
-- lll_lock (cond->__data.__lock, pshared);
--
-- /* If a broadcast happened, we are done. */
-- if (cbuffer.bc_seq != cond->__data.__broadcast_seq)
-- goto bc_out;
--
-- /* Check whether we are eligible for wakeup. */
-- val = cond->__data.__wakeup_seq;
- }
-- while (val == seq || cond->__data.__woken_seq == val);
-
-- /* Another thread woken up. */
-- ++cond->__data.__woken_seq;
-+ done:
-
-- bc_out:
-+ /* Confirm that we have been woken. We do that before acquiring the mutex
-+ to allow for execution of pthread_cond_destroy while having acquired the
-+ mutex. */
-+ __condvar_confirm_wakeup (cond, private);
-
-- cond->__data.__nwaiters -= 1 << COND_NWAITERS_SHIFT;
--
-- /* If pthread_cond_destroy was called on this varaible already,
-- notify the pthread_cond_destroy caller all waiters have left
-- and it can be successfully destroyed. */
-- if (cond->__data.__total_seq == -1ULL
-- && cond->__data.__nwaiters < (1 << COND_NWAITERS_SHIFT))
-- lll_futex_wake (&cond->__data.__nwaiters, 1, pshared);
-+ /* Woken up; now re-acquire the mutex. If this doesn't fail, return RESULT,
-+ which is set to ETIMEDOUT if a timeout occured, or zero otherwise. */
-+ err = __pthread_mutex_cond_lock (mutex);
-+ /* XXX Abort on errors that are disallowed by POSIX? */
-+ return (err != 0) ? err : result;
-+}
-
-- /* We are done with the condvar. */
-- lll_unlock (cond->__data.__lock, pshared);
-
-- /* The cancellation handling is back to normal, remove the handler. */
-- __pthread_cleanup_pop (&buffer, 0);
-+/* See __pthread_cond_wait_common. */
-+int
-+__pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
-+{
-+ return __pthread_cond_wait_common (cond, mutex, NULL);
-+}
-
-- /* Get the mutex before returning. Not needed for PI. */
--#if (defined lll_futex_wait_requeue_pi \
-- && defined __ASSUME_REQUEUE_PI)
-- if (pi_flag)
-- {
-- __pthread_mutex_cond_lock_adjust (mutex);
-- return 0;
-- }
-- else
--#endif
-- return __pthread_mutex_cond_lock (mutex);
-+/* See __pthread_cond_wait_common. */
-+int
-+__pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
-+ const struct timespec *abstime)
-+{
-+ /* Check parameter validity. This should also tell the compiler that
-+ it can assume that abstime is not NULL. */
-+ if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
-+ return EINVAL;
-+ return __pthread_cond_wait_common (cond, mutex, abstime);
- }
-
- versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
- GLIBC_2_3_2);
-+versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
-+ GLIBC_2_3_2);
-diff --git a/nptl/pthread_condattr_getclock.c b/nptl/pthread_condattr_getclock.c
-index d156302..cecb4aa 100644
---- a/nptl/pthread_condattr_getclock.c
-+++ b/nptl/pthread_condattr_getclock.c
-@@ -23,6 +23,6 @@ int
- pthread_condattr_getclock (const pthread_condattr_t *attr, clockid_t *clock_id)
- {
- *clock_id = (((((const struct pthread_condattr *) attr)->value) >> 1)
-- & ((1 << COND_NWAITERS_SHIFT) - 1));
-+ & ((1 << COND_CLOCK_BITS) - 1));
- return 0;
- }
-diff --git a/nptl/pthread_condattr_getpshared.c b/nptl/pthread_condattr_getpshared.c
-index 5a10f3e..8147966 100644
---- a/nptl/pthread_condattr_getpshared.c
-+++ b/nptl/pthread_condattr_getpshared.c
-@@ -22,7 +22,8 @@
- int
- pthread_condattr_getpshared (const pthread_condattr_t *attr, int *pshared)
- {
-- *pshared = ((const struct pthread_condattr *) attr)->value & 1;
-+ *pshared = (((const struct pthread_condattr *) attr)->value & 1
-+ ? PTHREAD_PROCESS_SHARED : PTHREAD_PROCESS_PRIVATE);
-
- return 0;
- }
-diff --git a/nptl/pthread_condattr_init.c b/nptl/pthread_condattr_init.c
-index 0ce42e5..6e5168d 100644
---- a/nptl/pthread_condattr_init.c
-+++ b/nptl/pthread_condattr_init.c
-@@ -23,7 +23,9 @@
- int
- __pthread_condattr_init (pthread_condattr_t *attr)
- {
-- memset (attr, '\0', sizeof (*attr));
-+ struct pthread_condattr *iattr = (struct pthread_condattr *) attr;
-+ /* Default is not pshared and CLOCK_REALTIME. */
-+ iattr-> value = CLOCK_REALTIME << 1;
-
- return 0;
- }
-diff --git a/nptl/pthread_condattr_setclock.c b/nptl/pthread_condattr_setclock.c
-index 25e2a17..3cfad84 100644
---- a/nptl/pthread_condattr_setclock.c
-+++ b/nptl/pthread_condattr_setclock.c
-@@ -18,7 +18,7 @@
-
- #include <assert.h>
- #include <errno.h>
--#include <stdbool.h>
-+#include <futex-internal.h>
- #include <time.h>
- #include <sysdep.h>
- #include "pthreadP.h"
-@@ -33,12 +33,17 @@ pthread_condattr_setclock (pthread_condattr_t *attr, clockid_t clock_id)
- in the pthread_cond_t structure needs to be adjusted. */
- return EINVAL;
-
-+ /* If we do not support waiting using CLOCK_MONOTONIC, return an error. */
-+ if (clock_id == CLOCK_MONOTONIC
-+ && !futex_supports_exact_relative_timeouts())
-+ return ENOTSUP;
-+
- /* Make sure the value fits in the bits we reserved. */
-- assert (clock_id < (1 << COND_NWAITERS_SHIFT));
-+ assert (clock_id < (1 << COND_CLOCK_BITS));
-
- int *valuep = &((struct pthread_condattr *) attr)->value;
-
-- *valuep = ((*valuep & ~(((1 << COND_NWAITERS_SHIFT) - 1) << 1))
-+ *valuep = ((*valuep & ~(((1 << COND_CLOCK_BITS) - 1) << 1))
- | (clock_id << 1));
-
- return 0;
-diff --git a/nptl/test-cond-printers.py b/nptl/test-cond-printers.py
-index af0e12e..9e807c9 100644
---- a/nptl/test-cond-printers.py
-+++ b/nptl/test-cond-printers.py
-@@ -35,7 +35,7 @@ try:
-
- break_at(test_source, 'Test status (destroyed)')
- continue_cmd() # Go to test_status_destroyed
-- test_printer(var, to_string, {'Status': 'Destroyed'})
-+ test_printer(var, to_string, {'Threads known to still execute a wait function': '0'})
-
- continue_cmd() # Exit
-
-diff --git a/nptl/tst-cond1.c b/nptl/tst-cond1.c
-index 75ab9c8..509bbd0 100644
---- a/nptl/tst-cond1.c
-+++ b/nptl/tst-cond1.c
-@@ -73,6 +73,9 @@ do_test (void)
-
- puts ("parent: wait for condition");
-
-+ /* This test will fail on spurious wake-ups, which are allowed; however,
-+ the current implementation shouldn't produce spurious wake-ups in the
-+ scenario we are testing here. */
- err = pthread_cond_wait (&cond, &mut);
- if (err != 0)
- error (EXIT_FAILURE, err, "parent: cannot wait fir signal");
-diff --git a/nptl/tst-cond20.c b/nptl/tst-cond20.c
-index 918c4ad..665a66a 100644
---- a/nptl/tst-cond20.c
-+++ b/nptl/tst-cond20.c
-@@ -96,7 +96,10 @@ do_test (void)
-
- for (i = 0; i < ROUNDS; ++i)
- {
-- pthread_cond_wait (&cond2, &mut);
-+ /* Make sure we discard spurious wake-ups. */
-+ do
-+ pthread_cond_wait (&cond2, &mut);
-+ while (count != N);
-
- if (i & 1)
- pthread_mutex_unlock (&mut);
-diff --git a/nptl/tst-cond22.c b/nptl/tst-cond22.c
-index bd978e5..64f19ea 100644
---- a/nptl/tst-cond22.c
-+++ b/nptl/tst-cond22.c
-@@ -106,10 +106,11 @@ do_test (void)
- status = 1;
- }
-
-- printf ("cond = { %d, %x, %lld, %lld, %lld, %p, %u, %u }\n",
-- c.__data.__lock, c.__data.__futex, c.__data.__total_seq,
-- c.__data.__wakeup_seq, c.__data.__woken_seq, c.__data.__mutex,
-- c.__data.__nwaiters, c.__data.__broadcast_seq);
-+ printf ("cond = { %llu, %llu, %u/%u/%u, %u/%u/%u, %u, %u }\n",
-+ c.__data.__wseq, c.__data.__g1_start,
-+ c.__data.__g_signals[0], c.__data.__g_refs[0], c.__data.__g_size[0],
-+ c.__data.__g_signals[1], c.__data.__g_refs[1], c.__data.__g_size[1],
-+ c.__data.__g1_orig_size, c.__data.__wrefs);
-
- if (pthread_create (&th, NULL, tf, (void *) 1l) != 0)
- {
-@@ -148,10 +149,11 @@ do_test (void)
- status = 1;
- }
-
-- printf ("cond = { %d, %x, %lld, %lld, %lld, %p, %u, %u }\n",
-- c.__data.__lock, c.__data.__futex, c.__data.__total_seq,
-- c.__data.__wakeup_seq, c.__data.__woken_seq, c.__data.__mutex,
-- c.__data.__nwaiters, c.__data.__broadcast_seq);
-+ printf ("cond = { %llu, %llu, %u/%u/%u, %u/%u/%u, %u, %u }\n",
-+ c.__data.__wseq, c.__data.__g1_start,
-+ c.__data.__g_signals[0], c.__data.__g_refs[0], c.__data.__g_size[0],
-+ c.__data.__g_signals[1], c.__data.__g_refs[1], c.__data.__g_size[1],
-+ c.__data.__g1_orig_size, c.__data.__wrefs);
-
- return status;
- }
-diff --git a/sysdeps/aarch64/nptl/bits/pthreadtypes.h b/sysdeps/aarch64/nptl/bits/pthreadtypes.h
-index 13984a7..c6fa632 100644
---- a/sysdeps/aarch64/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/aarch64/nptl/bits/pthreadtypes.h
-@@ -90,17 +90,30 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __wseq;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __wseq32;
-+ };
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __g1_start;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __g1_start32;
-+ };
-+ unsigned int __g_refs[2];
-+ unsigned int __g_size[2];
-+ unsigned int __g1_orig_size;
-+ unsigned int __wrefs;
-+ unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
-- long int __align;
-+ __extension__ long long int __align;
- } pthread_cond_t;
-
- typedef union
-diff --git a/sysdeps/arm/nptl/bits/pthreadtypes.h b/sysdeps/arm/nptl/bits/pthreadtypes.h
-index afb5392..53518c6 100644
---- a/sysdeps/arm/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/arm/nptl/bits/pthreadtypes.h
-@@ -93,14 +93,27 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __wseq;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __wseq32;
-+ };
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __g1_start;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __g1_start32;
-+ };
-+ unsigned int __g_refs[2];
-+ unsigned int __g_size[2];
-+ unsigned int __g1_orig_size;
-+ unsigned int __wrefs;
-+ unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/ia64/nptl/bits/pthreadtypes.h b/sysdeps/ia64/nptl/bits/pthreadtypes.h
-index f2e6dac..e72dbfd 100644
---- a/sysdeps/ia64/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/ia64/nptl/bits/pthreadtypes.h
-@@ -90,17 +90,30 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __wseq;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __wseq32;
-+ };
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __g1_start;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __g1_start32;
-+ };
-+ unsigned int __g_refs[2];
-+ unsigned int __g_size[2];
-+ unsigned int __g1_orig_size;
-+ unsigned int __wrefs;
-+ unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
-- long int __align;
-+ __extension__ long long int __align;
- } pthread_cond_t;
-
- typedef union
-diff --git a/sysdeps/m68k/nptl/bits/pthreadtypes.h b/sysdeps/m68k/nptl/bits/pthreadtypes.h
-index d8faa7a..c5e9021 100644
---- a/sysdeps/m68k/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/m68k/nptl/bits/pthreadtypes.h
-@@ -88,19 +88,33 @@ typedef union
-
-
- /* Data structure for conditional variable handling. The structure of
-- the attribute type is deliberately not exposed. */
-+ the attribute type is not exposed on purpose. */
- typedef union
- {
- struct
- {
-- int __lock __attribute__ ((__aligned__ (4)));
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __wseq;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __wseq32;
-+ };
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __g1_start;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __g1_start32;
-+ };
-+ /* Enforce proper alignment of fields used as futex words. */
-+ unsigned int __g_refs[2] __attribute__ ((__aligned__ (4)));
-+ unsigned int __g_size[2];
-+ unsigned int __g1_orig_size;
-+ unsigned int __wrefs;
-+ unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/microblaze/nptl/bits/pthreadtypes.h b/sysdeps/microblaze/nptl/bits/pthreadtypes.h
-index 9e9e307..b6623c2 100644
---- a/sysdeps/microblaze/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/microblaze/nptl/bits/pthreadtypes.h
-@@ -91,14 +91,27 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __wseq;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __wseq32;
-+ };
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __g1_start;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __g1_start32;
-+ };
-+ unsigned int __g_refs[2];
-+ unsigned int __g_size[2];
-+ unsigned int __g1_orig_size;
-+ unsigned int __wrefs;
-+ unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/mips/nptl/bits/pthreadtypes.h b/sysdeps/mips/nptl/bits/pthreadtypes.h
-index 68ed94b..7ddc7bf 100644
---- a/sysdeps/mips/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/mips/nptl/bits/pthreadtypes.h
-@@ -117,19 +117,32 @@ typedef union
-
-
- /* Data structure for conditional variable handling. The structure of
-- the attribute type is deliberately not exposed. */
-+ the attribute type is not exposed on purpose. */
- typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __wseq;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __wseq32;
-+ };
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __g1_start;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __g1_start32;
-+ };
-+ unsigned int __g_refs[2];
-+ unsigned int __g_size[2];
-+ unsigned int __g1_orig_size;
-+ unsigned int __wrefs;
-+ unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/nios2/nptl/bits/pthreadtypes.h b/sysdeps/nios2/nptl/bits/pthreadtypes.h
-index 76076d0..3995e26 100644
---- a/sysdeps/nios2/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/nios2/nptl/bits/pthreadtypes.h
-@@ -88,19 +88,32 @@ typedef union
-
-
- /* Data structure for conditional variable handling. The structure of
-- the attribute type is deliberately not exposed. */
-+ the attribute type is not exposed on purpose. */
- typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __wseq;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __wseq32;
-+ };
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __g1_start;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __g1_start32;
-+ };
-+ unsigned int __g_refs[2];
-+ unsigned int __g_size[2];
-+ unsigned int __g1_orig_size;
-+ unsigned int __wrefs;
-+ unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/nptl/internaltypes.h b/sysdeps/nptl/internaltypes.h
-index 203c548..31e5a43 100644
---- a/sysdeps/nptl/internaltypes.h
-+++ b/sysdeps/nptl/internaltypes.h
-@@ -68,20 +68,13 @@ struct pthread_condattr
- {
- /* Combination of values:
-
-- Bit 0 : flag whether conditional variable will be sharable between
-- processes.
--
-- Bit 1-7: clock ID. */
-+ Bit 0 : flag whether conditional variable will be
-+ sharable between processes.
-+ Bit 1-COND_CLOCK_BITS: Clock ID. COND_CLOCK_BITS is the number of bits
-+ needed to represent the ID of the clock. */
- int value;
- };
--
--
--/* The __NWAITERS field is used as a counter and to house the number
-- of bits for other purposes. COND_CLOCK_BITS is the number
-- of bits needed to represent the ID of the clock. COND_NWAITERS_SHIFT
-- is the number of bits reserved for other purposes like the clock. */
--#define COND_CLOCK_BITS 1
--#define COND_NWAITERS_SHIFT 1
-+#define COND_CLOCK_BITS 1
-
-
- /* Read-write lock variable attribute data structure. */
-diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h
-index fd0894e..c122446 100644
---- a/sysdeps/nptl/pthread.h
-+++ b/sysdeps/nptl/pthread.h
-@@ -183,7 +183,7 @@ enum
-
-
- /* Conditional variable handling. */
--#define PTHREAD_COND_INITIALIZER { { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }
-+#define PTHREAD_COND_INITIALIZER { { {0}, {0}, {0, 0}, {0, 0}, 0, 0, {0, 0} } }
-
-
- /* Cleanup buffers */
-diff --git a/sysdeps/s390/nptl/bits/pthreadtypes.h b/sysdeps/s390/nptl/bits/pthreadtypes.h
-index 40d10fe..4e455ab 100644
---- a/sysdeps/s390/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/s390/nptl/bits/pthreadtypes.h
-@@ -142,14 +142,27 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __wseq;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __wseq32;
-+ };
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __g1_start;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __g1_start32;
-+ };
-+ unsigned int __g_refs[2];
-+ unsigned int __g_size[2];
-+ unsigned int __g1_orig_size;
-+ unsigned int __wrefs;
-+ unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/sh/nptl/bits/pthreadtypes.h b/sysdeps/sh/nptl/bits/pthreadtypes.h
-index 13fbd73..065dd11 100644
---- a/sysdeps/sh/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/sh/nptl/bits/pthreadtypes.h
-@@ -93,14 +93,27 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __wseq;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __wseq32;
-+ };
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __g1_start;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __g1_start32;
-+ };
-+ unsigned int __g_refs[2];
-+ unsigned int __g_size[2];
-+ unsigned int __g1_orig_size;
-+ unsigned int __wrefs;
-+ unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/tile/nptl/bits/pthreadtypes.h b/sysdeps/tile/nptl/bits/pthreadtypes.h
-index 7d68650..c12737f 100644
---- a/sysdeps/tile/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/tile/nptl/bits/pthreadtypes.h
-@@ -122,14 +122,27 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __wseq;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __wseq32;
-+ };
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __g1_start;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __g1_start32;
-+ };
-+ unsigned int __g_refs[2];
-+ unsigned int __g_size[2];
-+ unsigned int __g1_orig_size;
-+ unsigned int __wrefs;
-+ unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h b/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
-index 1a1779b..d88b045 100644
---- a/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
-+++ b/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
-@@ -84,19 +84,32 @@ typedef union
-
-
- /* Data structure for conditional variable handling. The structure of
-- the attribute type is deliberately not exposed. */
-+ the attribute type is not exposed on purpose. */
- typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __wseq;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __wseq32;
-+ };
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __g1_start;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __g1_start32;
-+ };
-+ unsigned int __g_refs[2];
-+ unsigned int __g_size[2];
-+ unsigned int __g1_orig_size;
-+ unsigned int __wrefs;
-+ unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/unix/sysv/linux/hppa/internaltypes.h b/sysdeps/unix/sysv/linux/hppa/internaltypes.h
-index 651ce2e..d649657 100644
---- a/sysdeps/unix/sysv/linux/hppa/internaltypes.h
-+++ b/sysdeps/unix/sysv/linux/hppa/internaltypes.h
-@@ -46,32 +46,38 @@ fails because __initializer is zero, and the structure will be used as
- is correctly. */
-
- #define cond_compat_clear(var) \
--({ \
-- int tmp = 0; \
-- var->__data.__lock = 0; \
-- var->__data.__futex = 0; \
-- var->__data.__mutex = NULL; \
-- /* Clear __initializer last, to indicate initialization is done. */ \
-- __asm__ __volatile__ ("stw,ma %1,0(%0)" \
-- : : "r" (&var->__data.__initializer), "r" (tmp) : "memory"); \
-+({ \
-+ int tmp = 0; \
-+ var->__data.__wseq = 0; \
-+ var->__data.__signals_sent = 0; \
-+ var->__data.__confirmed = 0; \
-+ var->__data.__generation = 0; \
-+ var->__data.__mutex = NULL; \
-+ var->__data.__quiescence_waiters = 0; \
-+ var->__data.__clockid = 0; \
-+ /* Clear __initializer last, to indicate initialization is done. */ \
-+ /* This synchronizes-with the acquire load below. */ \
-+ atomic_store_release (&var->__data.__initializer, 0); \
- })
-
- #define cond_compat_check_and_clear(var) \
- ({ \
-- int ret; \
-- volatile int *value = &var->__data.__initializer; \
-- if ((ret = atomic_compare_and_exchange_val_acq(value, 2, 1))) \
-+ int v; \
-+ int *value = &var->__data.__initializer; \
-+ /* This synchronizes-with the release store above. */ \
-+ while ((v = atomic_load_acquire (value)) != 0) \
- { \
-- if (ret == 1) \
-+ if (v == 1 \
-+ /* Relaxed MO is fine; it only matters who's first. */ \
-+ && atomic_compare_exchange_acquire_weak_relaxed (value, 1, 2)) \
- { \
-- /* Initialize structure. */ \
-+ /* We're first; initialize structure. */ \
- cond_compat_clear (var); \
-+ break; \
- } \
- else \
-- { \
-- /* Yield until structure is initialized. */ \
-- while (*value == 2) sched_yield (); \
-- } \
-+ /* Yield before we re-check initialization status. */ \
-+ sched_yield (); \
- } \
- })
-
-diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_timedwait.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_timedwait.c
-deleted file mode 100644
-index ec6fd23..0000000
---- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_timedwait.c
-+++ /dev/null
-@@ -1,41 +0,0 @@
--/* Copyright (C) 2009-2016 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
--
-- 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 INCLUDED_SELF
--# define INCLUDED_SELF
--# include <pthread_cond_timedwait.c>
--#else
--# include <pthread.h>
--# include <pthreadP.h>
--# include <internaltypes.h>
--# include <shlib-compat.h>
--int
--__pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
-- const struct timespec *abstime)
--{
-- cond_compat_check_and_clear (cond);
-- return __pthread_cond_timedwait_internal (cond, mutex, abstime);
--}
--versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
-- GLIBC_2_3_2);
--# undef versioned_symbol
--# define versioned_symbol(lib, local, symbol, version)
--# undef __pthread_cond_timedwait
--# define __pthread_cond_timedwait __pthread_cond_timedwait_internal
--# include_next <pthread_cond_timedwait.c>
--#endif
-diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c
-index 8f02831..0611f7d 100644
---- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c
-+++ b/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c
-@@ -32,9 +32,22 @@ __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
- }
- versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
- GLIBC_2_3_2);
-+int
-+__pthread_cond_timedwait (cond, mutex, abstime)
-+ pthread_cond_t *cond;
-+ pthread_mutex_t *mutex;
-+ const struct timespec *abstime;
-+{
-+ cond_compat_check_and_clear (cond);
-+ return __pthread_cond_timedwait_internal (cond, mutex, abstime);
-+}
-+versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
-+ GLIBC_2_3_2);
- # undef versioned_symbol
- # define versioned_symbol(lib, local, symbol, version)
- # undef __pthread_cond_wait
- # define __pthread_cond_wait __pthread_cond_wait_internal
-+# undef __pthread_cond_timedwait
-+# define __pthread_cond_timedwait __pthread_cond_timedwait_internal
- # include_next <pthread_cond_wait.c>
- #endif
-diff --git a/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S b/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S
-deleted file mode 100644
-index f697e5b..0000000
---- a/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S
-+++ /dev/null
-@@ -1,20 +0,0 @@
--/* Copyright (C) 2003-2016 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
--
-- 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 HAVE_CMOV 1
--#include "../pthread_cond_timedwait.S"
-diff --git a/sysdeps/unix/sysv/linux/i386/pthread_cond_broadcast.S b/sysdeps/unix/sysv/linux/i386/pthread_cond_broadcast.S
-deleted file mode 100644
-index 5996688..0000000
---- a/sysdeps/unix/sysv/linux/i386/pthread_cond_broadcast.S
-+++ /dev/null
-@@ -1,241 +0,0 @@
--/* Copyright (C) 2002-2016 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include <sysdep.h>
--#include <shlib-compat.h>
--#include <lowlevellock.h>
--#include <lowlevelcond.h>
--#include <kernel-features.h>
--#include <pthread-pi-defines.h>
--#include <pthread-errnos.h>
--#include <stap-probe.h>
--
-- .text
--
-- /* int pthread_cond_broadcast (pthread_cond_t *cond) */
-- .globl __pthread_cond_broadcast
-- .type __pthread_cond_broadcast, @function
-- .align 16
--__pthread_cond_broadcast:
-- cfi_startproc
-- pushl %ebx
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%ebx, 0)
-- pushl %esi
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%esi, 0)
-- pushl %edi
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%edi, 0)
-- pushl %ebp
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%ebp, 0)
-- cfi_remember_state
--
-- movl 20(%esp), %ebx
--
-- LIBC_PROBE (cond_broadcast, 1, %edx)
--
-- /* Get internal lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %edx, (%ebx)
--#else
-- cmpxchgl %edx, cond_lock(%ebx)
--#endif
-- jnz 1f
--
--2: addl $cond_futex, %ebx
-- movl total_seq+4-cond_futex(%ebx), %eax
-- movl total_seq-cond_futex(%ebx), %ebp
-- cmpl wakeup_seq+4-cond_futex(%ebx), %eax
-- ja 3f
-- jb 4f
-- cmpl wakeup_seq-cond_futex(%ebx), %ebp
-- jna 4f
--
-- /* Cause all currently waiting threads to recognize they are
-- woken up. */
--3: movl %ebp, wakeup_seq-cond_futex(%ebx)
-- movl %eax, wakeup_seq-cond_futex+4(%ebx)
-- movl %ebp, woken_seq-cond_futex(%ebx)
-- movl %eax, woken_seq-cond_futex+4(%ebx)
-- addl %ebp, %ebp
-- addl $1, broadcast_seq-cond_futex(%ebx)
-- movl %ebp, (%ebx)
--
-- /* Get the address of the mutex used. */
-- movl dep_mutex-cond_futex(%ebx), %edi
--
-- /* Unlock. */
-- LOCK
-- subl $1, cond_lock-cond_futex(%ebx)
-- jne 7f
--
-- /* Don't use requeue for pshared condvars. */
--8: cmpl $-1, %edi
-- je 9f
--
-- /* Do not use requeue for pshared condvars. */
-- testl $PS_BIT, MUTEX_KIND(%edi)
-- jne 9f
--
-- /* Requeue to a non-robust PI mutex if the PI bit is set and
-- the robust bit is not set. */
-- movl MUTEX_KIND(%edi), %eax
-- andl $(ROBUST_BIT|PI_BIT), %eax
-- cmpl $PI_BIT, %eax
-- je 81f
--
-- /* Wake up all threads. */
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $(FUTEX_CMP_REQUEUE|FUTEX_PRIVATE_FLAG), %ecx
--#else
-- movl %gs:PRIVATE_FUTEX, %ecx
-- orl $FUTEX_CMP_REQUEUE, %ecx
--#endif
-- movl $SYS_futex, %eax
-- movl $0x7fffffff, %esi
-- movl $1, %edx
-- /* Get the address of the futex involved. */
--# if MUTEX_FUTEX != 0
-- addl $MUTEX_FUTEX, %edi
--# endif
--/* FIXME: Until Ingo fixes 4G/4G vDSO, 6 arg syscalls are broken for sysenter.
-- ENTER_KERNEL */
-- int $0x80
--
-- /* For any kind of error, which mainly is EAGAIN, we try again
-- with WAKE. The general test also covers running on old
-- kernels. */
-- cmpl $0xfffff001, %eax
-- jae 9f
--
--6: xorl %eax, %eax
-- popl %ebp
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%ebp)
-- popl %edi
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%edi)
-- popl %esi
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%esi)
-- popl %ebx
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%ebx)
-- ret
--
-- cfi_restore_state
--
--81: movl $(FUTEX_CMP_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %ecx
-- movl $SYS_futex, %eax
-- movl $0x7fffffff, %esi
-- movl $1, %edx
-- /* Get the address of the futex involved. */
--# if MUTEX_FUTEX != 0
-- addl $MUTEX_FUTEX, %edi
--# endif
-- int $0x80
--
-- /* For any kind of error, which mainly is EAGAIN, we try again
-- with WAKE. The general test also covers running on old
-- kernels. */
-- cmpl $0xfffff001, %eax
-- jb 6b
-- jmp 9f
--
-- /* Initial locking failed. */
--1:
--#if cond_lock == 0
-- movl %ebx, %edx
--#else
-- leal cond_lock(%ebx), %edx
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_lock_wait
-- jmp 2b
--
-- .align 16
-- /* Unlock. */
--4: LOCK
-- subl $1, cond_lock-cond_futex(%ebx)
-- je 6b
--
-- /* Unlock in loop requires wakeup. */
--5: leal cond_lock-cond_futex(%ebx), %eax
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_futex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
-- jmp 6b
--
-- /* Unlock in loop requires wakeup. */
--7: leal cond_lock-cond_futex(%ebx), %eax
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_futex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
-- jmp 8b
--
--9: /* The futex requeue functionality is not available. */
-- movl $0x7fffffff, %edx
--#if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_futex(%ebx)
-- sete %cl
-- subl $1, %ecx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- addl $FUTEX_WAKE, %ecx
-- movl $SYS_futex, %eax
-- ENTER_KERNEL
-- jmp 6b
-- cfi_endproc
-- .size __pthread_cond_broadcast, .-__pthread_cond_broadcast
--versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast,
-- GLIBC_2_3_2)
-diff --git a/sysdeps/unix/sysv/linux/i386/pthread_cond_signal.S b/sysdeps/unix/sysv/linux/i386/pthread_cond_signal.S
-deleted file mode 100644
-index 0038775..0000000
---- a/sysdeps/unix/sysv/linux/i386/pthread_cond_signal.S
-+++ /dev/null
-@@ -1,216 +0,0 @@
--/* Copyright (C) 2002-2016 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include <sysdep.h>
--#include <shlib-compat.h>
--#include <lowlevellock.h>
--#include <lowlevelcond.h>
--#include <kernel-features.h>
--#include <pthread-pi-defines.h>
--#include <pthread-errnos.h>
--#include <stap-probe.h>
--
-- .text
--
-- /* int pthread_cond_signal (pthread_cond_t *cond) */
-- .globl __pthread_cond_signal
-- .type __pthread_cond_signal, @function
-- .align 16
--__pthread_cond_signal:
--
-- cfi_startproc
-- pushl %ebx
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%ebx, 0)
-- pushl %edi
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%edi, 0)
-- cfi_remember_state
--
-- movl 12(%esp), %edi
--
-- LIBC_PROBE (cond_signal, 1, %edi)
--
-- /* Get internal lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %edx, (%edi)
--#else
-- cmpxchgl %edx, cond_lock(%edi)
--#endif
-- jnz 1f
--
--2: leal cond_futex(%edi), %ebx
-- movl total_seq+4(%edi), %eax
-- movl total_seq(%edi), %ecx
-- cmpl wakeup_seq+4(%edi), %eax
--#if cond_lock != 0
-- /* Must use leal to preserve the flags. */
-- leal cond_lock(%edi), %edi
--#endif
-- ja 3f
-- jb 4f
-- cmpl wakeup_seq-cond_futex(%ebx), %ecx
-- jbe 4f
--
-- /* Bump the wakeup number. */
--3: addl $1, wakeup_seq-cond_futex(%ebx)
-- adcl $0, wakeup_seq-cond_futex+4(%ebx)
-- addl $1, (%ebx)
--
-- /* Wake up one thread. */
-- pushl %esi
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%esi, 0)
-- pushl %ebp
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%ebp, 0)
--
--#if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_futex(%ebx)
-- sete %cl
-- je 8f
--
-- movl dep_mutex-cond_futex(%ebx), %edx
-- /* Requeue to a non-robust PI mutex if the PI bit is set and
-- the robust bit is not set. */
-- movl MUTEX_KIND(%edx), %eax
-- andl $(ROBUST_BIT|PI_BIT), %eax
-- cmpl $PI_BIT, %eax
-- je 9f
--
--8: subl $1, %ecx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- addl $FUTEX_WAKE_OP, %ecx
-- movl $SYS_futex, %eax
-- movl $1, %edx
-- movl $1, %esi
-- movl $FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, %ebp
-- /* FIXME: Until Ingo fixes 4G/4G vDSO, 6 arg syscalls are broken for
-- sysenter.
-- ENTER_KERNEL */
-- int $0x80
-- popl %ebp
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%ebp)
-- popl %esi
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%esi)
--
-- /* For any kind of error, we try again with WAKE.
-- The general test also covers running on old kernels. */
-- cmpl $-4095, %eax
-- jae 7f
--
--6: xorl %eax, %eax
-- popl %edi
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%edi)
-- popl %ebx
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%ebx)
-- ret
--
-- cfi_restore_state
--
--9: movl $(FUTEX_CMP_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %ecx
-- movl $SYS_futex, %eax
-- movl $1, %edx
-- xorl %esi, %esi
-- movl dep_mutex-cond_futex(%ebx), %edi
-- movl (%ebx), %ebp
-- /* FIXME: Until Ingo fixes 4G/4G vDSO, 6 arg syscalls are broken for
-- sysenter.
-- ENTER_KERNEL */
-- int $0x80
-- popl %ebp
-- popl %esi
--
-- leal -cond_futex(%ebx), %edi
--
-- /* For any kind of error, we try again with WAKE.
-- The general test also covers running on old kernels. */
-- cmpl $-4095, %eax
-- jb 4f
--
--7:
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- orl $FUTEX_WAKE, %ecx
--
-- movl $SYS_futex, %eax
-- /* %edx should be 1 already from $FUTEX_WAKE_OP syscall.
-- movl $1, %edx */
-- ENTER_KERNEL
--
-- /* Unlock. Note that at this point %edi always points to
-- cond_lock. */
--4: LOCK
-- subl $1, (%edi)
-- je 6b
--
-- /* Unlock in loop requires wakeup. */
--5: movl %edi, %eax
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_futex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
-- jmp 6b
--
-- /* Initial locking failed. */
--1:
--#if cond_lock == 0
-- movl %edi, %edx
--#else
-- leal cond_lock(%edi), %edx
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%edi)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_lock_wait
-- jmp 2b
--
-- cfi_endproc
-- .size __pthread_cond_signal, .-__pthread_cond_signal
--versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal,
-- GLIBC_2_3_2)
-diff --git a/sysdeps/unix/sysv/linux/i386/pthread_cond_timedwait.S b/sysdeps/unix/sysv/linux/i386/pthread_cond_timedwait.S
-deleted file mode 100644
-index 6256376..0000000
---- a/sysdeps/unix/sysv/linux/i386/pthread_cond_timedwait.S
-+++ /dev/null
-@@ -1,974 +0,0 @@
--/* Copyright (C) 2002-2016 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include <sysdep.h>
--#include <shlib-compat.h>
--#include <lowlevellock.h>
--#include <lowlevelcond.h>
--#include <pthread-errnos.h>
--#include <pthread-pi-defines.h>
--#include <kernel-features.h>
--#include <stap-probe.h>
--
-- .text
--
--/* int pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
-- const struct timespec *abstime) */
-- .globl __pthread_cond_timedwait
-- .type __pthread_cond_timedwait, @function
-- .align 16
--__pthread_cond_timedwait:
--.LSTARTCODE:
-- cfi_startproc
--#ifdef SHARED
-- cfi_personality(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect,
-- DW.ref.__gcc_personality_v0)
-- cfi_lsda(DW_EH_PE_pcrel | DW_EH_PE_sdata4, .LexceptSTART)
--#else
-- cfi_personality(DW_EH_PE_udata4, __gcc_personality_v0)
-- cfi_lsda(DW_EH_PE_udata4, .LexceptSTART)
--#endif
--
-- pushl %ebp
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%ebp, 0)
-- pushl %edi
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%edi, 0)
-- pushl %esi
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%esi, 0)
-- pushl %ebx
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%ebx, 0)
--
-- movl 20(%esp), %ebx
-- movl 28(%esp), %ebp
--
-- LIBC_PROBE (cond_timedwait, 3, %ebx, 24(%esp), %ebp)
--
-- cmpl $1000000000, 4(%ebp)
-- movl $EINVAL, %eax
-- jae 18f
--
-- /* Stack frame:
--
-- esp + 32
-- +--------------------------+
-- esp + 24 | timeout value |
-- +--------------------------+
-- esp + 20 | futex pointer |
-- +--------------------------+
-- esp + 16 | pi-requeued flag |
-- +--------------------------+
-- esp + 12 | old broadcast_seq value |
-- +--------------------------+
-- esp + 4 | old wake_seq value |
-- +--------------------------+
-- esp + 0 | old cancellation mode |
-- +--------------------------+
-- */
--
--#ifndef __ASSUME_FUTEX_CLOCK_REALTIME
--# ifdef PIC
-- LOAD_PIC_REG (cx)
-- cmpl $0, __have_futex_clock_realtime@GOTOFF(%ecx)
--# else
-- cmpl $0, __have_futex_clock_realtime
--# endif
-- je .Lreltmo
--#endif
--
-- /* Get internal lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %edx, (%ebx)
--#else
-- cmpxchgl %edx, cond_lock(%ebx)
--#endif
-- jnz 1f
--
-- /* Store the reference to the mutex. If there is already a
-- different value in there this is a bad user bug. */
--2: cmpl $-1, dep_mutex(%ebx)
-- movl 24(%esp), %eax
-- je 17f
-- movl %eax, dep_mutex(%ebx)
--
-- /* Unlock the mutex. */
--17: xorl %edx, %edx
-- call __pthread_mutex_unlock_usercnt
--
-- testl %eax, %eax
-- jne 16f
--
-- addl $1, total_seq(%ebx)
-- adcl $0, total_seq+4(%ebx)
-- addl $1, cond_futex(%ebx)
-- addl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
--
--#ifdef __ASSUME_FUTEX_CLOCK_REALTIME
--# define FRAME_SIZE 24
--#else
--# define FRAME_SIZE 32
--#endif
-- subl $FRAME_SIZE, %esp
-- cfi_adjust_cfa_offset(FRAME_SIZE)
-- cfi_remember_state
--
-- /* Get and store current wakeup_seq value. */
-- movl wakeup_seq(%ebx), %edi
-- movl wakeup_seq+4(%ebx), %edx
-- movl broadcast_seq(%ebx), %eax
-- movl %edi, 4(%esp)
-- movl %edx, 8(%esp)
-- movl %eax, 12(%esp)
--
-- /* Reset the pi-requeued flag. */
-- movl $0, 16(%esp)
--
-- cmpl $0, (%ebp)
-- movl $-ETIMEDOUT, %esi
-- js 6f
--
--8: movl cond_futex(%ebx), %edi
-- movl %edi, 20(%esp)
--
-- /* Unlock. */
-- LOCK
--#if cond_lock == 0
-- subl $1, (%ebx)
--#else
-- subl $1, cond_lock(%ebx)
--#endif
-- jne 3f
--
--.LcleanupSTART:
--4: call __pthread_enable_asynccancel
-- movl %eax, (%esp)
--
-- leal (%ebp), %esi
--#if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- sete %cl
-- je 40f
--
-- movl dep_mutex(%ebx), %edi
-- /* Requeue to a non-robust PI mutex if the PI bit is set and
-- the robust bit is not set. */
-- movl MUTEX_KIND(%edi), %eax
-- andl $(ROBUST_BIT|PI_BIT), %eax
-- cmpl $PI_BIT, %eax
-- jne 40f
--
-- movl $(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %ecx
-- /* The following only works like this because we only support
-- two clocks, represented using a single bit. */
-- testl $1, cond_nwaiters(%ebx)
-- /* XXX Need to implement using sete instead of a jump. */
-- jne 42f
-- orl $FUTEX_CLOCK_REALTIME, %ecx
--
--42: movl 20(%esp), %edx
-- addl $cond_futex, %ebx
--.Ladd_cond_futex_pi:
-- movl $SYS_futex, %eax
-- ENTER_KERNEL
-- subl $cond_futex, %ebx
--.Lsub_cond_futex_pi:
-- movl %eax, %esi
-- /* Set the pi-requeued flag only if the kernel has returned 0. The
-- kernel does not hold the mutex on ETIMEDOUT or any other error. */
-- cmpl $0, %eax
-- sete 16(%esp)
-- je 41f
--
-- /* When a futex syscall with FUTEX_WAIT_REQUEUE_PI returns
-- successfully, it has already locked the mutex for us and the
-- pi_flag (16(%esp)) is set to denote that fact. However, if another
-- thread changed the futex value before we entered the wait, the
-- syscall may return an EAGAIN and the mutex is not locked. We go
-- ahead with a success anyway since later we look at the pi_flag to
-- decide if we got the mutex or not. The sequence numbers then make
-- sure that only one of the threads actually wake up. We retry using
-- normal FUTEX_WAIT only if the kernel returned ENOSYS, since normal
-- and PI futexes don't mix.
--
-- Note that we don't check for EAGAIN specifically; we assume that the
-- only other error the futex function could return is EAGAIN (barring
-- the ETIMEOUT of course, for the timeout case in futex) since
-- anything else would mean an error in our function. It is too
-- expensive to do that check for every call (which is quite common in
-- case of a large number of threads), so it has been skipped. */
-- cmpl $-ENOSYS, %eax
-- jne 41f
-- xorl %ecx, %ecx
--
--40: subl $1, %ecx
-- movl $0, 16(%esp)
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- addl $FUTEX_WAIT_BITSET, %ecx
-- /* The following only works like this because we only support
-- two clocks, represented using a single bit. */
-- testl $1, cond_nwaiters(%ebx)
-- jne 30f
-- orl $FUTEX_CLOCK_REALTIME, %ecx
--30:
-- movl 20(%esp), %edx
-- movl $0xffffffff, %ebp
-- addl $cond_futex, %ebx
--.Ladd_cond_futex:
-- movl $SYS_futex, %eax
-- ENTER_KERNEL
-- subl $cond_futex, %ebx
--.Lsub_cond_futex:
-- movl 28+FRAME_SIZE(%esp), %ebp
-- movl %eax, %esi
--
--41: movl (%esp), %eax
-- call __pthread_disable_asynccancel
--.LcleanupEND:
--
-- /* Lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %edx, (%ebx)
--#else
-- cmpxchgl %edx, cond_lock(%ebx)
--#endif
-- jnz 5f
--
--6: movl broadcast_seq(%ebx), %eax
-- cmpl 12(%esp), %eax
-- jne 23f
--
-- movl woken_seq(%ebx), %eax
-- movl woken_seq+4(%ebx), %ecx
--
-- movl wakeup_seq(%ebx), %edi
-- movl wakeup_seq+4(%ebx), %edx
--
-- cmpl 8(%esp), %edx
-- jne 7f
-- cmpl 4(%esp), %edi
-- je 15f
--
--7: cmpl %ecx, %edx
-- jne 9f
-- cmp %eax, %edi
-- jne 9f
--
--15: cmpl $-ETIMEDOUT, %esi
-- je 28f
--
-- /* We need to go back to futex_wait. If we're using requeue_pi, then
-- release the mutex we had acquired and go back. */
-- movl 16(%esp), %edx
-- test %edx, %edx
-- jz 8b
--
-- /* Adjust the mutex values first and then unlock it. The unlock
-- should always succeed or else the kernel did not lock the mutex
-- correctly. */
-- movl dep_mutex(%ebx), %eax
-- call __pthread_mutex_cond_lock_adjust
-- movl dep_mutex(%ebx), %eax
-- xorl %edx, %edx
-- call __pthread_mutex_unlock_usercnt
-- jmp 8b
--
--28: addl $1, wakeup_seq(%ebx)
-- adcl $0, wakeup_seq+4(%ebx)
-- addl $1, cond_futex(%ebx)
-- movl $ETIMEDOUT, %esi
-- jmp 14f
--
--23: xorl %esi, %esi
-- jmp 24f
--
--9: xorl %esi, %esi
--14: addl $1, woken_seq(%ebx)
-- adcl $0, woken_seq+4(%ebx)
--
--24: subl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
--
-- /* Wake up a thread which wants to destroy the condvar object. */
-- movl total_seq(%ebx), %eax
-- andl total_seq+4(%ebx), %eax
-- cmpl $0xffffffff, %eax
-- jne 25f
-- movl cond_nwaiters(%ebx), %eax
-- andl $~((1 << nwaiters_shift) - 1), %eax
-- jne 25f
--
-- addl $cond_nwaiters, %ebx
-- movl $SYS_futex, %eax
--#if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_nwaiters(%ebx)
-- sete %cl
-- subl $1, %ecx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- addl $FUTEX_WAKE, %ecx
-- movl $1, %edx
-- ENTER_KERNEL
-- subl $cond_nwaiters, %ebx
--
--25: LOCK
--#if cond_lock == 0
-- subl $1, (%ebx)
--#else
-- subl $1, cond_lock(%ebx)
--#endif
-- jne 10f
--
--11: movl 24+FRAME_SIZE(%esp), %eax
-- /* With requeue_pi, the mutex lock is held in the kernel. */
-- movl 16(%esp), %ecx
-- testl %ecx, %ecx
-- jnz 27f
--
-- call __pthread_mutex_cond_lock
--26: addl $FRAME_SIZE, %esp
-- cfi_adjust_cfa_offset(-FRAME_SIZE)
--
-- /* We return the result of the mutex_lock operation if it failed. */
-- testl %eax, %eax
--#ifdef HAVE_CMOV
-- cmovel %esi, %eax
--#else
-- jne 22f
-- movl %esi, %eax
--22:
--#endif
--
--18: popl %ebx
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%ebx)
-- popl %esi
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%esi)
-- popl %edi
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%edi)
-- popl %ebp
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%ebp)
--
-- ret
--
-- cfi_restore_state
--
--27: call __pthread_mutex_cond_lock_adjust
-- xorl %eax, %eax
-- jmp 26b
--
-- cfi_adjust_cfa_offset(-FRAME_SIZE);
-- /* Initial locking failed. */
--1:
--#if cond_lock == 0
-- movl %ebx, %edx
--#else
-- leal cond_lock(%ebx), %edx
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_lock_wait
-- jmp 2b
--
-- /* The initial unlocking of the mutex failed. */
--16:
-- LOCK
--#if cond_lock == 0
-- subl $1, (%ebx)
--#else
-- subl $1, cond_lock(%ebx)
--#endif
-- jne 18b
--
-- movl %eax, %esi
--#if cond_lock == 0
-- movl %ebx, %eax
--#else
-- leal cond_lock(%ebx), %eax
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
--
-- movl %esi, %eax
-- jmp 18b
--
-- cfi_adjust_cfa_offset(FRAME_SIZE)
--
-- /* Unlock in loop requires wakeup. */
--3:
--#if cond_lock == 0
-- movl %ebx, %eax
--#else
-- leal cond_lock(%ebx), %eax
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
-- jmp 4b
--
-- /* Locking in loop failed. */
--5:
--#if cond_lock == 0
-- movl %ebx, %edx
--#else
-- leal cond_lock(%ebx), %edx
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_lock_wait
-- jmp 6b
--
-- /* Unlock after loop requires wakeup. */
--10:
--#if cond_lock == 0
-- movl %ebx, %eax
--#else
-- leal cond_lock(%ebx), %eax
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
-- jmp 11b
--
--#ifndef __ASSUME_FUTEX_CLOCK_REALTIME
-- cfi_adjust_cfa_offset(-FRAME_SIZE)
--.Lreltmo:
-- /* Get internal lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--# if cond_lock == 0
-- cmpxchgl %edx, (%ebx)
--# else
-- cmpxchgl %edx, cond_lock(%ebx)
--# endif
-- jnz 101f
--
-- /* Store the reference to the mutex. If there is already a
-- different value in there this is a bad user bug. */
--102: cmpl $-1, dep_mutex(%ebx)
-- movl 24(%esp), %eax
-- je 117f
-- movl %eax, dep_mutex(%ebx)
--
-- /* Unlock the mutex. */
--117: xorl %edx, %edx
-- call __pthread_mutex_unlock_usercnt
--
-- testl %eax, %eax
-- jne 16b
--
-- addl $1, total_seq(%ebx)
-- adcl $0, total_seq+4(%ebx)
-- addl $1, cond_futex(%ebx)
-- addl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
--
-- subl $FRAME_SIZE, %esp
-- cfi_adjust_cfa_offset(FRAME_SIZE)
--
-- /* Get and store current wakeup_seq value. */
-- movl wakeup_seq(%ebx), %edi
-- movl wakeup_seq+4(%ebx), %edx
-- movl broadcast_seq(%ebx), %eax
-- movl %edi, 4(%esp)
-- movl %edx, 8(%esp)
-- movl %eax, 12(%esp)
--
-- /* Reset the pi-requeued flag. */
-- movl $0, 16(%esp)
--
-- /* Get the current time. */
--108: movl %ebx, %edx
--# ifdef __NR_clock_gettime
-- /* Get the clock number. */
-- movl cond_nwaiters(%ebx), %ebx
-- andl $((1 << nwaiters_shift) - 1), %ebx
-- /* Only clocks 0 and 1 are allowed so far. Both are handled in the
-- kernel. */
-- leal 24(%esp), %ecx
-- movl $__NR_clock_gettime, %eax
-- ENTER_KERNEL
-- movl %edx, %ebx
--
-- /* Compute relative timeout. */
-- movl (%ebp), %ecx
-- movl 4(%ebp), %edx
-- subl 24(%esp), %ecx
-- subl 28(%esp), %edx
--# else
-- /* Get the current time. */
-- leal 24(%esp), %ebx
-- xorl %ecx, %ecx
-- movl $__NR_gettimeofday, %eax
-- ENTER_KERNEL
-- movl %edx, %ebx
--
-- /* Compute relative timeout. */
-- movl 28(%esp), %eax
-- movl $1000, %edx
-- mul %edx /* Milli seconds to nano seconds. */
-- movl (%ebp), %ecx
-- movl 4(%ebp), %edx
-- subl 24(%esp), %ecx
-- subl %eax, %edx
--# endif
-- jns 112f
-- addl $1000000000, %edx
-- subl $1, %ecx
--112: testl %ecx, %ecx
-- movl $-ETIMEDOUT, %esi
-- js 106f
--
-- /* Store relative timeout. */
--121: movl %ecx, 24(%esp)
-- movl %edx, 28(%esp)
--
-- movl cond_futex(%ebx), %edi
-- movl %edi, 20(%esp)
--
-- /* Unlock. */
-- LOCK
--# if cond_lock == 0
-- subl $1, (%ebx)
--# else
-- subl $1, cond_lock(%ebx)
--# endif
-- jne 103f
--
--.LcleanupSTART2:
--104: call __pthread_enable_asynccancel
-- movl %eax, (%esp)
--
-- leal 24(%esp), %esi
--# if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--# endif
-- cmpl $-1, dep_mutex(%ebx)
-- sete %cl
-- subl $1, %ecx
--# ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--# else
-- andl %gs:PRIVATE_FUTEX, %ecx
--# endif
--# if FUTEX_WAIT != 0
-- addl $FUTEX_WAIT, %ecx
--# endif
-- movl 20(%esp), %edx
-- addl $cond_futex, %ebx
--.Ladd_cond_futex2:
-- movl $SYS_futex, %eax
-- ENTER_KERNEL
-- subl $cond_futex, %ebx
--.Lsub_cond_futex2:
-- movl %eax, %esi
--
--141: movl (%esp), %eax
-- call __pthread_disable_asynccancel
--.LcleanupEND2:
--
--
-- /* Lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--# if cond_lock == 0
-- cmpxchgl %edx, (%ebx)
--# else
-- cmpxchgl %edx, cond_lock(%ebx)
--# endif
-- jnz 105f
--
--106: movl broadcast_seq(%ebx), %eax
-- cmpl 12(%esp), %eax
-- jne 23b
--
-- movl woken_seq(%ebx), %eax
-- movl woken_seq+4(%ebx), %ecx
--
-- movl wakeup_seq(%ebx), %edi
-- movl wakeup_seq+4(%ebx), %edx
--
-- cmpl 8(%esp), %edx
-- jne 107f
-- cmpl 4(%esp), %edi
-- je 115f
--
--107: cmpl %ecx, %edx
-- jne 9b
-- cmp %eax, %edi
-- jne 9b
--
--115: cmpl $-ETIMEDOUT, %esi
-- je 28b
--
-- jmp 8b
--
-- cfi_adjust_cfa_offset(-FRAME_SIZE)
-- /* Initial locking failed. */
--101:
--# if cond_lock == 0
-- movl %ebx, %edx
--# else
-- leal cond_lock(%ebx), %edx
--# endif
--# if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--# endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--# if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--# endif
-- call __lll_lock_wait
-- jmp 102b
--
-- cfi_adjust_cfa_offset(FRAME_SIZE)
--
-- /* Unlock in loop requires wakeup. */
--103:
--# if cond_lock == 0
-- movl %ebx, %eax
--# else
-- leal cond_lock(%ebx), %eax
--# endif
--# if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--# endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--# if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--# endif
-- call __lll_unlock_wake
-- jmp 104b
--
-- /* Locking in loop failed. */
--105:
--# if cond_lock == 0
-- movl %ebx, %edx
--# else
-- leal cond_lock(%ebx), %edx
--# endif
--# if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--# endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--# if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--# endif
-- call __lll_lock_wait
-- jmp 106b
--#endif
--
-- .size __pthread_cond_timedwait, .-__pthread_cond_timedwait
--versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
-- GLIBC_2_3_2)
--
--
-- .type __condvar_tw_cleanup2, @function
--__condvar_tw_cleanup2:
-- subl $cond_futex, %ebx
-- .size __condvar_tw_cleanup2, .-__condvar_tw_cleanup2
-- .type __condvar_tw_cleanup, @function
--__condvar_tw_cleanup:
-- movl %eax, %esi
--
-- /* Get internal lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %edx, (%ebx)
--#else
-- cmpxchgl %edx, cond_lock(%ebx)
--#endif
-- jz 1f
--
--#if cond_lock == 0
-- movl %ebx, %edx
--#else
-- leal cond_lock(%ebx), %edx
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_lock_wait
--
--1: movl broadcast_seq(%ebx), %eax
-- cmpl 12(%esp), %eax
-- jne 3f
--
-- /* We increment the wakeup_seq counter only if it is lower than
-- total_seq. If this is not the case the thread was woken and
-- then canceled. In this case we ignore the signal. */
-- movl total_seq(%ebx), %eax
-- movl total_seq+4(%ebx), %edi
-- cmpl wakeup_seq+4(%ebx), %edi
-- jb 6f
-- ja 7f
-- cmpl wakeup_seq(%ebx), %eax
-- jbe 7f
--
--6: addl $1, wakeup_seq(%ebx)
-- adcl $0, wakeup_seq+4(%ebx)
-- addl $1, cond_futex(%ebx)
--
--7: addl $1, woken_seq(%ebx)
-- adcl $0, woken_seq+4(%ebx)
--
--3: subl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
--
-- /* Wake up a thread which wants to destroy the condvar object. */
-- xorl %edi, %edi
-- movl total_seq(%ebx), %eax
-- andl total_seq+4(%ebx), %eax
-- cmpl $0xffffffff, %eax
-- jne 4f
-- movl cond_nwaiters(%ebx), %eax
-- andl $~((1 << nwaiters_shift) - 1), %eax
-- jne 4f
--
-- addl $cond_nwaiters, %ebx
-- movl $SYS_futex, %eax
--#if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_nwaiters(%ebx)
-- sete %cl
-- subl $1, %ecx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- addl $FUTEX_WAKE, %ecx
-- movl $1, %edx
-- ENTER_KERNEL
-- subl $cond_nwaiters, %ebx
-- movl $1, %edi
--
--4: LOCK
--#if cond_lock == 0
-- subl $1, (%ebx)
--#else
-- subl $1, cond_lock(%ebx)
--#endif
-- je 2f
--
--#if cond_lock == 0
-- movl %ebx, %eax
--#else
-- leal cond_lock(%ebx), %eax
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
--
-- /* Wake up all waiters to make sure no signal gets lost. */
--2: testl %edi, %edi
-- jnz 5f
-- addl $cond_futex, %ebx
--#if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_futex(%ebx)
-- sete %cl
-- subl $1, %ecx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- addl $FUTEX_WAKE, %ecx
-- movl $SYS_futex, %eax
-- movl $0x7fffffff, %edx
-- ENTER_KERNEL
--
-- /* Lock the mutex only if we don't own it already. This only happens
-- in case of PI mutexes, if we got cancelled after a successful
-- return of the futex syscall and before disabling async
-- cancellation. */
--5: movl 24+FRAME_SIZE(%esp), %eax
-- movl MUTEX_KIND(%eax), %ebx
-- andl $(ROBUST_BIT|PI_BIT), %ebx
-- cmpl $PI_BIT, %ebx
-- jne 8f
--
-- movl (%eax), %ebx
-- andl $TID_MASK, %ebx
-- cmpl %ebx, %gs:TID
-- jne 8f
-- /* We managed to get the lock. Fix it up before returning. */
-- call __pthread_mutex_cond_lock_adjust
-- jmp 9f
--
--8: call __pthread_mutex_cond_lock
--
--9: movl %esi, (%esp)
--.LcallUR:
-- call _Unwind_Resume
-- hlt
--.LENDCODE:
-- cfi_endproc
-- .size __condvar_tw_cleanup, .-__condvar_tw_cleanup
--
--
-- .section .gcc_except_table,"a",@progbits
--.LexceptSTART:
-- .byte DW_EH_PE_omit # @LPStart format (omit)
-- .byte DW_EH_PE_omit # @TType format (omit)
-- .byte DW_EH_PE_sdata4 # call-site format
-- # DW_EH_PE_sdata4
-- .uleb128 .Lcstend-.Lcstbegin
--.Lcstbegin:
-- .long .LcleanupSTART-.LSTARTCODE
-- .long .Ladd_cond_futex_pi-.LcleanupSTART
-- .long __condvar_tw_cleanup-.LSTARTCODE
-- .uleb128 0
-- .long .Ladd_cond_futex_pi-.LSTARTCODE
-- .long .Lsub_cond_futex_pi-.Ladd_cond_futex_pi
-- .long __condvar_tw_cleanup2-.LSTARTCODE
-- .uleb128 0
-- .long .Lsub_cond_futex_pi-.LSTARTCODE
-- .long .Ladd_cond_futex-.Lsub_cond_futex_pi
-- .long __condvar_tw_cleanup-.LSTARTCODE
-- .uleb128 0
-- .long .Ladd_cond_futex-.LSTARTCODE
-- .long .Lsub_cond_futex-.Ladd_cond_futex
-- .long __condvar_tw_cleanup2-.LSTARTCODE
-- .uleb128 0
-- .long .Lsub_cond_futex-.LSTARTCODE
-- .long .LcleanupEND-.Lsub_cond_futex
-- .long __condvar_tw_cleanup-.LSTARTCODE
-- .uleb128 0
--#ifndef __ASSUME_FUTEX_CLOCK_REALTIME
-- .long .LcleanupSTART2-.LSTARTCODE
-- .long .Ladd_cond_futex2-.LcleanupSTART2
-- .long __condvar_tw_cleanup-.LSTARTCODE
-- .uleb128 0
-- .long .Ladd_cond_futex2-.LSTARTCODE
-- .long .Lsub_cond_futex2-.Ladd_cond_futex2
-- .long __condvar_tw_cleanup2-.LSTARTCODE
-- .uleb128 0
-- .long .Lsub_cond_futex2-.LSTARTCODE
-- .long .LcleanupEND2-.Lsub_cond_futex2
-- .long __condvar_tw_cleanup-.LSTARTCODE
-- .uleb128 0
--#endif
-- .long .LcallUR-.LSTARTCODE
-- .long .LENDCODE-.LcallUR
-- .long 0
-- .uleb128 0
--.Lcstend:
--
--
--#ifdef SHARED
-- .hidden DW.ref.__gcc_personality_v0
-- .weak DW.ref.__gcc_personality_v0
-- .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
-- .align 4
-- .type DW.ref.__gcc_personality_v0, @object
-- .size DW.ref.__gcc_personality_v0, 4
--DW.ref.__gcc_personality_v0:
-- .long __gcc_personality_v0
--#endif
-diff --git a/sysdeps/unix/sysv/linux/i386/pthread_cond_wait.S b/sysdeps/unix/sysv/linux/i386/pthread_cond_wait.S
-deleted file mode 100644
-index 5016718..0000000
---- a/sysdeps/unix/sysv/linux/i386/pthread_cond_wait.S
-+++ /dev/null
-@@ -1,642 +0,0 @@
--/* Copyright (C) 2002-2016 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include <sysdep.h>
--#include <shlib-compat.h>
--#include <lowlevellock.h>
--#include <lowlevelcond.h>
--#include <tcb-offsets.h>
--#include <pthread-errnos.h>
--#include <pthread-pi-defines.h>
--#include <kernel-features.h>
--#include <stap-probe.h>
--
--
-- .text
--
--/* int pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) */
-- .globl __pthread_cond_wait
-- .type __pthread_cond_wait, @function
-- .align 16
--__pthread_cond_wait:
--.LSTARTCODE:
-- cfi_startproc
--#ifdef SHARED
-- cfi_personality(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect,
-- DW.ref.__gcc_personality_v0)
-- cfi_lsda(DW_EH_PE_pcrel | DW_EH_PE_sdata4, .LexceptSTART)
--#else
-- cfi_personality(DW_EH_PE_udata4, __gcc_personality_v0)
-- cfi_lsda(DW_EH_PE_udata4, .LexceptSTART)
--#endif
--
-- pushl %ebp
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%ebp, 0)
-- pushl %edi
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%edi, 0)
-- pushl %esi
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%esi, 0)
-- pushl %ebx
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%ebx, 0)
--
-- xorl %esi, %esi
-- movl 20(%esp), %ebx
--
-- LIBC_PROBE (cond_wait, 2, 24(%esp), %ebx)
--
-- /* Get internal lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %edx, (%ebx)
--#else
-- cmpxchgl %edx, cond_lock(%ebx)
--#endif
-- jnz 1f
--
-- /* Store the reference to the mutex. If there is already a
-- different value in there this is a bad user bug. */
--2: cmpl $-1, dep_mutex(%ebx)
-- movl 24(%esp), %eax
-- je 15f
-- movl %eax, dep_mutex(%ebx)
--
-- /* Unlock the mutex. */
--15: xorl %edx, %edx
-- call __pthread_mutex_unlock_usercnt
--
-- testl %eax, %eax
-- jne 12f
--
-- addl $1, total_seq(%ebx)
-- adcl $0, total_seq+4(%ebx)
-- addl $1, cond_futex(%ebx)
-- addl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
--
--#define FRAME_SIZE 20
-- subl $FRAME_SIZE, %esp
-- cfi_adjust_cfa_offset(FRAME_SIZE)
-- cfi_remember_state
--
-- /* Get and store current wakeup_seq value. */
-- movl wakeup_seq(%ebx), %edi
-- movl wakeup_seq+4(%ebx), %edx
-- movl broadcast_seq(%ebx), %eax
-- movl %edi, 4(%esp)
-- movl %edx, 8(%esp)
-- movl %eax, 12(%esp)
--
-- /* Reset the pi-requeued flag. */
--8: movl $0, 16(%esp)
-- movl cond_futex(%ebx), %ebp
--
-- /* Unlock. */
-- LOCK
--#if cond_lock == 0
-- subl $1, (%ebx)
--#else
-- subl $1, cond_lock(%ebx)
--#endif
-- jne 3f
--
--.LcleanupSTART:
--4: call __pthread_enable_asynccancel
-- movl %eax, (%esp)
--
-- xorl %ecx, %ecx
-- cmpl $-1, dep_mutex(%ebx)
-- sete %cl
-- je 18f
--
-- movl dep_mutex(%ebx), %edi
-- /* Requeue to a non-robust PI mutex if the PI bit is set and
-- the robust bit is not set. */
-- movl MUTEX_KIND(%edi), %eax
-- andl $(ROBUST_BIT|PI_BIT), %eax
-- cmpl $PI_BIT, %eax
-- jne 18f
--
-- movl $(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %ecx
-- movl %ebp, %edx
-- xorl %esi, %esi
-- addl $cond_futex, %ebx
--.Ladd_cond_futex_pi:
-- movl $SYS_futex, %eax
-- ENTER_KERNEL
-- subl $cond_futex, %ebx
--.Lsub_cond_futex_pi:
-- /* Set the pi-requeued flag only if the kernel has returned 0. The
-- kernel does not hold the mutex on error. */
-- cmpl $0, %eax
-- sete 16(%esp)
-- je 19f
--
-- /* When a futex syscall with FUTEX_WAIT_REQUEUE_PI returns
-- successfully, it has already locked the mutex for us and the
-- pi_flag (16(%esp)) is set to denote that fact. However, if another
-- thread changed the futex value before we entered the wait, the
-- syscall may return an EAGAIN and the mutex is not locked. We go
-- ahead with a success anyway since later we look at the pi_flag to
-- decide if we got the mutex or not. The sequence numbers then make
-- sure that only one of the threads actually wake up. We retry using
-- normal FUTEX_WAIT only if the kernel returned ENOSYS, since normal
-- and PI futexes don't mix.
--
-- Note that we don't check for EAGAIN specifically; we assume that the
-- only other error the futex function could return is EAGAIN since
-- anything else would mean an error in our function. It is too
-- expensive to do that check for every call (which is quite common in
-- case of a large number of threads), so it has been skipped. */
-- cmpl $-ENOSYS, %eax
-- jne 19f
-- xorl %ecx, %ecx
--
--18: subl $1, %ecx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
--#if FUTEX_WAIT != 0
-- addl $FUTEX_WAIT, %ecx
--#endif
-- movl %ebp, %edx
-- addl $cond_futex, %ebx
--.Ladd_cond_futex:
-- movl $SYS_futex, %eax
-- ENTER_KERNEL
-- subl $cond_futex, %ebx
--.Lsub_cond_futex:
--
--19: movl (%esp), %eax
-- call __pthread_disable_asynccancel
--.LcleanupEND:
--
-- /* Lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %edx, (%ebx)
--#else
-- cmpxchgl %edx, cond_lock(%ebx)
--#endif
-- jnz 5f
--
--6: movl broadcast_seq(%ebx), %eax
-- cmpl 12(%esp), %eax
-- jne 16f
--
-- movl woken_seq(%ebx), %eax
-- movl woken_seq+4(%ebx), %ecx
--
-- movl wakeup_seq(%ebx), %edi
-- movl wakeup_seq+4(%ebx), %edx
--
-- cmpl 8(%esp), %edx
-- jne 7f
-- cmpl 4(%esp), %edi
-- je 22f
--
--7: cmpl %ecx, %edx
-- jne 9f
-- cmp %eax, %edi
-- je 22f
--
--9: addl $1, woken_seq(%ebx)
-- adcl $0, woken_seq+4(%ebx)
--
-- /* Unlock */
--16: subl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
--
-- /* Wake up a thread which wants to destroy the condvar object. */
-- movl total_seq(%ebx), %eax
-- andl total_seq+4(%ebx), %eax
-- cmpl $0xffffffff, %eax
-- jne 17f
-- movl cond_nwaiters(%ebx), %eax
-- andl $~((1 << nwaiters_shift) - 1), %eax
-- jne 17f
--
-- addl $cond_nwaiters, %ebx
-- movl $SYS_futex, %eax
--#if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_nwaiters(%ebx)
-- sete %cl
-- subl $1, %ecx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- addl $FUTEX_WAKE, %ecx
-- movl $1, %edx
-- ENTER_KERNEL
-- subl $cond_nwaiters, %ebx
--
--17: LOCK
--#if cond_lock == 0
-- subl $1, (%ebx)
--#else
-- subl $1, cond_lock(%ebx)
--#endif
-- jne 10f
--
-- /* With requeue_pi, the mutex lock is held in the kernel. */
--11: movl 24+FRAME_SIZE(%esp), %eax
-- movl 16(%esp), %ecx
-- testl %ecx, %ecx
-- jnz 21f
--
-- call __pthread_mutex_cond_lock
--20: addl $FRAME_SIZE, %esp
-- cfi_adjust_cfa_offset(-FRAME_SIZE);
--
--14: popl %ebx
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%ebx)
-- popl %esi
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%esi)
-- popl %edi
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%edi)
-- popl %ebp
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%ebp)
--
-- /* We return the result of the mutex_lock operation. */
-- ret
--
-- cfi_restore_state
--
--21: call __pthread_mutex_cond_lock_adjust
-- xorl %eax, %eax
-- jmp 20b
--
-- cfi_adjust_cfa_offset(-FRAME_SIZE);
--
-- /* We need to go back to futex_wait. If we're using requeue_pi, then
-- release the mutex we had acquired and go back. */
--22: movl 16(%esp), %edx
-- test %edx, %edx
-- jz 8b
--
-- /* Adjust the mutex values first and then unlock it. The unlock
-- should always succeed or else the kernel did not lock the mutex
-- correctly. */
-- movl dep_mutex(%ebx), %eax
-- call __pthread_mutex_cond_lock_adjust
-- movl dep_mutex(%ebx), %eax
-- xorl %edx, %edx
-- call __pthread_mutex_unlock_usercnt
-- jmp 8b
--
-- /* Initial locking failed. */
--1:
--#if cond_lock == 0
-- movl %ebx, %edx
--#else
-- leal cond_lock(%ebx), %edx
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_lock_wait
-- jmp 2b
--
-- /* The initial unlocking of the mutex failed. */
--12:
-- LOCK
--#if cond_lock == 0
-- subl $1, (%ebx)
--#else
-- subl $1, cond_lock(%ebx)
--#endif
-- jne 14b
--
-- movl %eax, %esi
--#if cond_lock == 0
-- movl %ebx, %eax
--#else
-- leal cond_lock(%ebx), %eax
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
--
-- movl %esi, %eax
-- jmp 14b
--
-- cfi_adjust_cfa_offset(FRAME_SIZE)
--
-- /* Unlock in loop requires wakeup. */
--3:
--#if cond_lock == 0
-- movl %ebx, %eax
--#else
-- leal cond_lock(%ebx), %eax
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
-- jmp 4b
--
-- /* Locking in loop failed. */
--5:
--#if cond_lock == 0
-- movl %ebx, %edx
--#else
-- leal cond_lock(%ebx), %edx
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_lock_wait
-- jmp 6b
--
-- /* Unlock after loop requires wakeup. */
--10:
--#if cond_lock == 0
-- movl %ebx, %eax
--#else
-- leal cond_lock(%ebx), %eax
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
-- jmp 11b
--
-- .size __pthread_cond_wait, .-__pthread_cond_wait
--versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
-- GLIBC_2_3_2)
--
--
-- .type __condvar_w_cleanup2, @function
--__condvar_w_cleanup2:
-- subl $cond_futex, %ebx
-- .size __condvar_w_cleanup2, .-__condvar_w_cleanup2
--.LSbl4:
-- .type __condvar_w_cleanup, @function
--__condvar_w_cleanup:
-- movl %eax, %esi
--
-- /* Get internal lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %edx, (%ebx)
--#else
-- cmpxchgl %edx, cond_lock(%ebx)
--#endif
-- jz 1f
--
--#if cond_lock == 0
-- movl %ebx, %edx
--#else
-- leal cond_lock(%ebx), %edx
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_lock_wait
--
--1: movl broadcast_seq(%ebx), %eax
-- cmpl 12(%esp), %eax
-- jne 3f
--
-- /* We increment the wakeup_seq counter only if it is lower than
-- total_seq. If this is not the case the thread was woken and
-- then canceled. In this case we ignore the signal. */
-- movl total_seq(%ebx), %eax
-- movl total_seq+4(%ebx), %edi
-- cmpl wakeup_seq+4(%ebx), %edi
-- jb 6f
-- ja 7f
-- cmpl wakeup_seq(%ebx), %eax
-- jbe 7f
--
--6: addl $1, wakeup_seq(%ebx)
-- adcl $0, wakeup_seq+4(%ebx)
-- addl $1, cond_futex(%ebx)
--
--7: addl $1, woken_seq(%ebx)
-- adcl $0, woken_seq+4(%ebx)
--
--3: subl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
--
-- /* Wake up a thread which wants to destroy the condvar object. */
-- xorl %edi, %edi
-- movl total_seq(%ebx), %eax
-- andl total_seq+4(%ebx), %eax
-- cmpl $0xffffffff, %eax
-- jne 4f
-- movl cond_nwaiters(%ebx), %eax
-- andl $~((1 << nwaiters_shift) - 1), %eax
-- jne 4f
--
-- addl $cond_nwaiters, %ebx
-- movl $SYS_futex, %eax
--#if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_nwaiters(%ebx)
-- sete %cl
-- subl $1, %ecx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- addl $FUTEX_WAKE, %ecx
-- movl $1, %edx
-- ENTER_KERNEL
-- subl $cond_nwaiters, %ebx
-- movl $1, %edi
--
--4: LOCK
--#if cond_lock == 0
-- subl $1, (%ebx)
--#else
-- subl $1, cond_lock(%ebx)
--#endif
-- je 2f
--
--#if cond_lock == 0
-- movl %ebx, %eax
--#else
-- leal cond_lock(%ebx), %eax
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
--
-- /* Wake up all waiters to make sure no signal gets lost. */
--2: testl %edi, %edi
-- jnz 5f
-- addl $cond_futex, %ebx
--#if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_futex(%ebx)
-- sete %cl
-- subl $1, %ecx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- addl $FUTEX_WAKE, %ecx
-- movl $SYS_futex, %eax
-- movl $0x7fffffff, %edx
-- ENTER_KERNEL
--
-- /* Lock the mutex only if we don't own it already. This only happens
-- in case of PI mutexes, if we got cancelled after a successful
-- return of the futex syscall and before disabling async
-- cancellation. */
--5: movl 24+FRAME_SIZE(%esp), %eax
-- movl MUTEX_KIND(%eax), %ebx
-- andl $(ROBUST_BIT|PI_BIT), %ebx
-- cmpl $PI_BIT, %ebx
-- jne 8f
--
-- movl (%eax), %ebx
-- andl $TID_MASK, %ebx
-- cmpl %ebx, %gs:TID
-- jne 8f
-- /* We managed to get the lock. Fix it up before returning. */
-- call __pthread_mutex_cond_lock_adjust
-- jmp 9f
--
--8: call __pthread_mutex_cond_lock
--
--9: movl %esi, (%esp)
--.LcallUR:
-- call _Unwind_Resume
-- hlt
--.LENDCODE:
-- cfi_endproc
-- .size __condvar_w_cleanup, .-__condvar_w_cleanup
--
--
-- .section .gcc_except_table,"a",@progbits
--.LexceptSTART:
-- .byte DW_EH_PE_omit # @LPStart format (omit)
-- .byte DW_EH_PE_omit # @TType format (omit)
-- .byte DW_EH_PE_sdata4 # call-site format
-- # DW_EH_PE_sdata4
-- .uleb128 .Lcstend-.Lcstbegin
--.Lcstbegin:
-- .long .LcleanupSTART-.LSTARTCODE
-- .long .Ladd_cond_futex_pi-.LcleanupSTART
-- .long __condvar_w_cleanup-.LSTARTCODE
-- .uleb128 0
-- .long .Ladd_cond_futex_pi-.LSTARTCODE
-- .long .Lsub_cond_futex_pi-.Ladd_cond_futex_pi
-- .long __condvar_w_cleanup2-.LSTARTCODE
-- .uleb128 0
-- .long .Lsub_cond_futex_pi-.LSTARTCODE
-- .long .Ladd_cond_futex-.Lsub_cond_futex_pi
-- .long __condvar_w_cleanup-.LSTARTCODE
-- .uleb128 0
-- .long .Ladd_cond_futex-.LSTARTCODE
-- .long .Lsub_cond_futex-.Ladd_cond_futex
-- .long __condvar_w_cleanup2-.LSTARTCODE
-- .uleb128 0
-- .long .Lsub_cond_futex-.LSTARTCODE
-- .long .LcleanupEND-.Lsub_cond_futex
-- .long __condvar_w_cleanup-.LSTARTCODE
-- .uleb128 0
-- .long .LcallUR-.LSTARTCODE
-- .long .LENDCODE-.LcallUR
-- .long 0
-- .uleb128 0
--.Lcstend:
--
--#ifdef SHARED
-- .hidden DW.ref.__gcc_personality_v0
-- .weak DW.ref.__gcc_personality_v0
-- .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
-- .align 4
-- .type DW.ref.__gcc_personality_v0, @object
-- .size DW.ref.__gcc_personality_v0, 4
--DW.ref.__gcc_personality_v0:
-- .long __gcc_personality_v0
--#endif
-diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h b/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
-index 345e79a..371bc3c 100644
---- a/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
-+++ b/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
-@@ -123,19 +123,32 @@ typedef union
-
-
- /* Data structure for conditional variable handling. The structure of
-- the attribute type is deliberately not exposed. */
-+ the attribute type is not exposed on purpose. */
- typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __wseq;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __wseq32;
-+ };
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __g1_start;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __g1_start32;
-+ };
-+ unsigned int __g_refs[2];
-+ unsigned int __g_size[2];
-+ unsigned int __g1_orig_size;
-+ unsigned int __wrefs;
-+ unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S b/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
-deleted file mode 100644
-index de455dd..0000000
---- a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
-+++ /dev/null
-@@ -1,177 +0,0 @@
--/* Copyright (C) 2002-2016 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include <sysdep.h>
--#include <shlib-compat.h>
--#include <lowlevellock.h>
--#include <lowlevelcond.h>
--#include <kernel-features.h>
--#include <pthread-pi-defines.h>
--#include <pthread-errnos.h>
--#include <stap-probe.h>
--
-- .text
--
-- /* int pthread_cond_broadcast (pthread_cond_t *cond) */
--ENTRY(__pthread_cond_broadcast)
--
-- LIBC_PROBE (cond_broadcast, 1, %rdi)
--
-- /* Get internal lock. */
-- movl $1, %esi
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %esi, (%rdi)
--#else
-- cmpxchgl %esi, cond_lock(%rdi)
--#endif
-- jnz 1f
--
--2: addq $cond_futex, %rdi
-- movq total_seq-cond_futex(%rdi), %r9
-- cmpq wakeup_seq-cond_futex(%rdi), %r9
-- jna 4f
--
-- /* Cause all currently waiting threads to recognize they are
-- woken up. */
-- movq %r9, wakeup_seq-cond_futex(%rdi)
-- movq %r9, woken_seq-cond_futex(%rdi)
-- addq %r9, %r9
-- movl %r9d, (%rdi)
-- incl broadcast_seq-cond_futex(%rdi)
--
-- /* Get the address of the mutex used. */
-- mov dep_mutex-cond_futex(%rdi), %R8_LP
--
-- /* Unlock. */
-- LOCK
-- decl cond_lock-cond_futex(%rdi)
-- jne 7f
--
--8: cmp $-1, %R8_LP
-- je 9f
--
-- /* Do not use requeue for pshared condvars. */
-- testl $PS_BIT, MUTEX_KIND(%r8)
-- jne 9f
--
-- /* Requeue to a PI mutex if the PI bit is set. */
-- movl MUTEX_KIND(%r8), %eax
-- andl $(ROBUST_BIT|PI_BIT), %eax
-- cmpl $PI_BIT, %eax
-- je 81f
--
-- /* Wake up all threads. */
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $(FUTEX_CMP_REQUEUE|FUTEX_PRIVATE_FLAG), %esi
--#else
-- movl %fs:PRIVATE_FUTEX, %esi
-- orl $FUTEX_CMP_REQUEUE, %esi
--#endif
-- movl $SYS_futex, %eax
-- movl $1, %edx
-- movl $0x7fffffff, %r10d
-- syscall
--
-- /* For any kind of error, which mainly is EAGAIN, we try again
-- with WAKE. The general test also covers running on old
-- kernels. */
-- cmpq $-4095, %rax
-- jae 9f
--
--10: xorl %eax, %eax
-- retq
--
-- /* Wake up all threads. */
--81: movl $(FUTEX_CMP_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi
-- movl $SYS_futex, %eax
-- movl $1, %edx
-- movl $0x7fffffff, %r10d
-- syscall
--
-- /* For any kind of error, which mainly is EAGAIN, we try again
-- with WAKE. The general test also covers running on old
-- kernels. */
-- cmpq $-4095, %rax
-- jb 10b
-- jmp 9f
--
-- .align 16
-- /* Unlock. */
--4: LOCK
-- decl cond_lock-cond_futex(%rdi)
-- jne 5f
--
--6: xorl %eax, %eax
-- retq
--
-- /* Initial locking failed. */
--1:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_lock_wait
--#if cond_lock != 0
-- subq $cond_lock, %rdi
--#endif
-- jmp 2b
--
-- /* Unlock in loop requires wakeup. */
--5: addq $cond_lock-cond_futex, %rdi
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_unlock_wake
-- jmp 6b
--
-- /* Unlock in loop requires wakeup. */
--7: addq $cond_lock-cond_futex, %rdi
-- cmp $-1, %R8_LP
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_unlock_wake
-- subq $cond_lock-cond_futex, %rdi
-- jmp 8b
--
--9: /* The futex requeue functionality is not available. */
-- cmp $-1, %R8_LP
-- movl $0x7fffffff, %edx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $FUTEX_WAKE, %eax
-- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi
-- cmove %eax, %esi
--#else
-- movl $0, %eax
-- movl %fs:PRIVATE_FUTEX, %esi
-- cmove %eax, %esi
-- orl $FUTEX_WAKE, %esi
--#endif
-- movl $SYS_futex, %eax
-- syscall
-- jmp 10b
--END(__pthread_cond_broadcast)
--
--versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast,
-- GLIBC_2_3_2)
-diff --git a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S b/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
-deleted file mode 100644
-index da14bc3..0000000
---- a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
-+++ /dev/null
-@@ -1,161 +0,0 @@
--/* Copyright (C) 2002-2016 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include <sysdep.h>
--#include <shlib-compat.h>
--#include <lowlevellock.h>
--#include <lowlevelcond.h>
--#include <pthread-pi-defines.h>
--#include <kernel-features.h>
--#include <pthread-errnos.h>
--#include <stap-probe.h>
--
--
-- .text
--
--ENTRY(__pthread_cond_signal)
--
-- LIBC_PROBE (cond_signal, 1, %rdi)
--
-- /* Get internal lock. */
-- movq %rdi, %r8
-- movl $1, %esi
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %esi, (%rdi)
--#else
-- cmpxchgl %esi, cond_lock(%rdi)
--#endif
-- jnz 1f
--
--2: addq $cond_futex, %rdi
-- movq total_seq(%r8), %rcx
-- cmpq wakeup_seq(%r8), %rcx
-- jbe 4f
--
-- /* Bump the wakeup number. */
-- addq $1, wakeup_seq(%r8)
-- addl $1, (%rdi)
--
-- /* Wake up one thread. */
-- LP_OP(cmp) $-1, dep_mutex(%r8)
-- movl $FUTEX_WAKE_OP, %esi
-- movl $1, %edx
-- movl $SYS_futex, %eax
-- je 8f
--
-- /* Get the address of the mutex used. */
-- mov dep_mutex(%r8), %RCX_LP
-- movl MUTEX_KIND(%rcx), %r11d
-- andl $(ROBUST_BIT|PI_BIT), %r11d
-- cmpl $PI_BIT, %r11d
-- je 9f
--
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $(FUTEX_WAKE_OP|FUTEX_PRIVATE_FLAG), %esi
--#else
-- orl %fs:PRIVATE_FUTEX, %esi
--#endif
--
--8: movl $1, %r10d
--#if cond_lock != 0
-- addq $cond_lock, %r8
--#endif
-- movl $FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, %r9d
-- syscall
--#if cond_lock != 0
-- subq $cond_lock, %r8
--#endif
-- /* For any kind of error, we try again with WAKE.
-- The general test also covers running on old kernels. */
-- cmpq $-4095, %rax
-- jae 7f
--
-- xorl %eax, %eax
-- retq
--
-- /* Wake up one thread and requeue none in the PI Mutex case. */
--9: movl $(FUTEX_CMP_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi
-- movq %rcx, %r8
-- xorq %r10, %r10
-- movl (%rdi), %r9d // XXX Can this be right?
-- syscall
--
-- leaq -cond_futex(%rdi), %r8
--
-- /* For any kind of error, we try again with WAKE.
-- The general test also covers running on old kernels. */
-- cmpq $-4095, %rax
-- jb 4f
--
--7:
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %esi
--#else
-- andl %fs:PRIVATE_FUTEX, %esi
--#endif
-- orl $FUTEX_WAKE, %esi
-- movl $SYS_futex, %eax
-- /* %rdx should be 1 already from $FUTEX_WAKE_OP syscall.
-- movl $1, %edx */
-- syscall
--
-- /* Unlock. */
--4: LOCK
--#if cond_lock == 0
-- decl (%r8)
--#else
-- decl cond_lock(%r8)
--#endif
-- jne 5f
--
--6: xorl %eax, %eax
-- retq
--
-- /* Initial locking failed. */
--1:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_lock_wait
--#if cond_lock != 0
-- subq $cond_lock, %rdi
--#endif
-- jmp 2b
--
-- /* Unlock in loop requires wakeup. */
--5:
-- movq %r8, %rdi
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_unlock_wake
-- jmp 6b
--END(__pthread_cond_signal)
--
--versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal,
-- GLIBC_2_3_2)
-diff --git a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
-deleted file mode 100644
-index 82ffa1a..0000000
---- a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
-+++ /dev/null
-@@ -1,623 +0,0 @@
--/* Copyright (C) 2002-2016 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include <sysdep.h>
--#include <shlib-compat.h>
--#include <lowlevellock.h>
--#include <lowlevelcond.h>
--#include <pthread-pi-defines.h>
--#include <pthread-errnos.h>
--#include <stap-probe.h>
--
--#include <kernel-features.h>
--
--
-- .text
--
--
--/* int pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
-- const struct timespec *abstime) */
-- .globl __pthread_cond_timedwait
-- .type __pthread_cond_timedwait, @function
-- .align 16
--__pthread_cond_timedwait:
--.LSTARTCODE:
-- cfi_startproc
--#ifdef SHARED
-- cfi_personality(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect,
-- DW.ref.__gcc_personality_v0)
-- cfi_lsda(DW_EH_PE_pcrel | DW_EH_PE_sdata4, .LexceptSTART)
--#else
-- cfi_personality(DW_EH_PE_udata4, __gcc_personality_v0)
-- cfi_lsda(DW_EH_PE_udata4, .LexceptSTART)
--#endif
--
-- pushq %r12
-- cfi_adjust_cfa_offset(8)
-- cfi_rel_offset(%r12, 0)
-- pushq %r13
-- cfi_adjust_cfa_offset(8)
-- cfi_rel_offset(%r13, 0)
-- pushq %r14
-- cfi_adjust_cfa_offset(8)
-- cfi_rel_offset(%r14, 0)
-- pushq %r15
-- cfi_adjust_cfa_offset(8)
-- cfi_rel_offset(%r15, 0)
--#define FRAME_SIZE (32+8)
-- subq $FRAME_SIZE, %rsp
-- cfi_adjust_cfa_offset(FRAME_SIZE)
-- cfi_remember_state
--
-- LIBC_PROBE (cond_timedwait, 3, %rdi, %rsi, %rdx)
--
-- cmpq $1000000000, 8(%rdx)
-- movl $EINVAL, %eax
-- jae 48f
--
-- /* Stack frame:
--
-- rsp + 48
-- +--------------------------+
-- rsp + 32 | timeout value |
-- +--------------------------+
-- rsp + 24 | old wake_seq value |
-- +--------------------------+
-- rsp + 16 | mutex pointer |
-- +--------------------------+
-- rsp + 8 | condvar pointer |
-- +--------------------------+
-- rsp + 4 | old broadcast_seq value |
-- +--------------------------+
-- rsp + 0 | old cancellation mode |
-- +--------------------------+
-- */
--
-- LP_OP(cmp) $-1, dep_mutex(%rdi)
--
-- /* Prepare structure passed to cancellation handler. */
-- movq %rdi, 8(%rsp)
-- movq %rsi, 16(%rsp)
-- movq %rdx, %r13
--
-- je 22f
-- mov %RSI_LP, dep_mutex(%rdi)
--
--22:
-- xorb %r15b, %r15b
--
-- /* Get internal lock. */
-- movl $1, %esi
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %esi, (%rdi)
--#else
-- cmpxchgl %esi, cond_lock(%rdi)
--#endif
-- jnz 31f
--
-- /* Unlock the mutex. */
--32: movq 16(%rsp), %rdi
-- xorl %esi, %esi
-- callq __pthread_mutex_unlock_usercnt
--
-- testl %eax, %eax
-- jne 46f
--
-- movq 8(%rsp), %rdi
-- incq total_seq(%rdi)
-- incl cond_futex(%rdi)
-- addl $(1 << nwaiters_shift), cond_nwaiters(%rdi)
--
-- /* Get and store current wakeup_seq value. */
-- movq 8(%rsp), %rdi
-- movq wakeup_seq(%rdi), %r9
-- movl broadcast_seq(%rdi), %edx
-- movq %r9, 24(%rsp)
-- movl %edx, 4(%rsp)
--
-- cmpq $0, (%r13)
-- movq $-ETIMEDOUT, %r14
-- js 36f
--
--38: movl cond_futex(%rdi), %r12d
--
-- /* Unlock. */
-- LOCK
--#if cond_lock == 0
-- decl (%rdi)
--#else
-- decl cond_lock(%rdi)
--#endif
-- jne 33f
--
--.LcleanupSTART1:
--34: callq __pthread_enable_asynccancel
-- movl %eax, (%rsp)
--
-- movq %r13, %r10
-- movl $FUTEX_WAIT_BITSET, %esi
-- LP_OP(cmp) $-1, dep_mutex(%rdi)
-- je 60f
--
-- mov dep_mutex(%rdi), %R8_LP
-- /* Requeue to a non-robust PI mutex if the PI bit is set and
-- the robust bit is not set. */
-- movl MUTEX_KIND(%r8), %eax
-- andl $(ROBUST_BIT|PI_BIT), %eax
-- cmpl $PI_BIT, %eax
-- jne 61f
--
-- movl $(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi
-- xorl %eax, %eax
-- /* The following only works like this because we only support
-- two clocks, represented using a single bit. */
-- testl $1, cond_nwaiters(%rdi)
-- movl $FUTEX_CLOCK_REALTIME, %edx
-- cmove %edx, %eax
-- orl %eax, %esi
-- movq %r12, %rdx
-- addq $cond_futex, %rdi
-- movl $SYS_futex, %eax
-- syscall
--
-- cmpl $0, %eax
-- sete %r15b
--
--#ifdef __ASSUME_REQUEUE_PI
-- jmp 62f
--#else
-- je 62f
--
-- /* When a futex syscall with FUTEX_WAIT_REQUEUE_PI returns
-- successfully, it has already locked the mutex for us and the
-- pi_flag (%r15b) is set to denote that fact. However, if another
-- thread changed the futex value before we entered the wait, the
-- syscall may return an EAGAIN and the mutex is not locked. We go
-- ahead with a success anyway since later we look at the pi_flag to
-- decide if we got the mutex or not. The sequence numbers then make
-- sure that only one of the threads actually wake up. We retry using
-- normal FUTEX_WAIT only if the kernel returned ENOSYS, since normal
-- and PI futexes don't mix.
--
-- Note that we don't check for EAGAIN specifically; we assume that the
-- only other error the futex function could return is EAGAIN (barring
-- the ETIMEOUT of course, for the timeout case in futex) since
-- anything else would mean an error in our function. It is too
-- expensive to do that check for every call (which is quite common in
-- case of a large number of threads), so it has been skipped. */
-- cmpl $-ENOSYS, %eax
-- jne 62f
--
-- subq $cond_futex, %rdi
--#endif
--
--61: movl $(FUTEX_WAIT_BITSET|FUTEX_PRIVATE_FLAG), %esi
--60: xorb %r15b, %r15b
-- xorl %eax, %eax
-- /* The following only works like this because we only support
-- two clocks, represented using a single bit. */
-- testl $1, cond_nwaiters(%rdi)
-- movl $FUTEX_CLOCK_REALTIME, %edx
-- movl $0xffffffff, %r9d
-- cmove %edx, %eax
-- orl %eax, %esi
-- movq %r12, %rdx
-- addq $cond_futex, %rdi
-- movl $SYS_futex, %eax
-- syscall
--62: movq %rax, %r14
--
-- movl (%rsp), %edi
-- callq __pthread_disable_asynccancel
--.LcleanupEND1:
--
-- /* Lock. */
-- movq 8(%rsp), %rdi
-- movl $1, %esi
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %esi, (%rdi)
--#else
-- cmpxchgl %esi, cond_lock(%rdi)
--#endif
-- jne 35f
--
--36: movl broadcast_seq(%rdi), %edx
--
-- movq woken_seq(%rdi), %rax
--
-- movq wakeup_seq(%rdi), %r9
--
-- cmpl 4(%rsp), %edx
-- jne 53f
--
-- cmpq 24(%rsp), %r9
-- jbe 45f
--
-- cmpq %rax, %r9
-- ja 39f
--
--45: cmpq $-ETIMEDOUT, %r14
-- je 99f
--
-- /* We need to go back to futex_wait. If we're using requeue_pi, then
-- release the mutex we had acquired and go back. */
-- test %r15b, %r15b
-- jz 38b
--
-- /* Adjust the mutex values first and then unlock it. The unlock
-- should always succeed or else the kernel did not lock the
-- mutex correctly. */
-- movq %r8, %rdi
-- callq __pthread_mutex_cond_lock_adjust
-- xorl %esi, %esi
-- callq __pthread_mutex_unlock_usercnt
-- /* Reload cond_var. */
-- movq 8(%rsp), %rdi
-- jmp 38b
--
--99: incq wakeup_seq(%rdi)
-- incl cond_futex(%rdi)
-- movl $ETIMEDOUT, %r14d
-- jmp 44f
--
--53: xorq %r14, %r14
-- jmp 54f
--
--39: xorq %r14, %r14
--44: incq woken_seq(%rdi)
--
--54: subl $(1 << nwaiters_shift), cond_nwaiters(%rdi)
--
-- /* Wake up a thread which wants to destroy the condvar object. */
-- cmpq $0xffffffffffffffff, total_seq(%rdi)
-- jne 55f
-- movl cond_nwaiters(%rdi), %eax
-- andl $~((1 << nwaiters_shift) - 1), %eax
-- jne 55f
--
-- addq $cond_nwaiters, %rdi
-- LP_OP(cmp) $-1, dep_mutex-cond_nwaiters(%rdi)
-- movl $1, %edx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $FUTEX_WAKE, %eax
-- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi
-- cmove %eax, %esi
--#else
-- movl $0, %eax
-- movl %fs:PRIVATE_FUTEX, %esi
-- cmove %eax, %esi
-- orl $FUTEX_WAKE, %esi
--#endif
-- movl $SYS_futex, %eax
-- syscall
-- subq $cond_nwaiters, %rdi
--
--55: LOCK
--#if cond_lock == 0
-- decl (%rdi)
--#else
-- decl cond_lock(%rdi)
--#endif
-- jne 40f
--
-- /* If requeue_pi is used the kernel performs the locking of the
-- mutex. */
--41: movq 16(%rsp), %rdi
-- testb %r15b, %r15b
-- jnz 64f
--
-- callq __pthread_mutex_cond_lock
--
--63: testq %rax, %rax
-- cmoveq %r14, %rax
--
--48: addq $FRAME_SIZE, %rsp
-- cfi_adjust_cfa_offset(-FRAME_SIZE)
-- popq %r15
-- cfi_adjust_cfa_offset(-8)
-- cfi_restore(%r15)
-- popq %r14
-- cfi_adjust_cfa_offset(-8)
-- cfi_restore(%r14)
-- popq %r13
-- cfi_adjust_cfa_offset(-8)
-- cfi_restore(%r13)
-- popq %r12
-- cfi_adjust_cfa_offset(-8)
-- cfi_restore(%r12)
--
-- retq
--
-- cfi_restore_state
--
--64: callq __pthread_mutex_cond_lock_adjust
-- movq %r14, %rax
-- jmp 48b
--
-- /* Initial locking failed. */
--31:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_lock_wait
-- jmp 32b
--
-- /* Unlock in loop requires wakeup. */
--33:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_unlock_wake
-- jmp 34b
--
-- /* Locking in loop failed. */
--35:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_lock_wait
--#if cond_lock != 0
-- subq $cond_lock, %rdi
--#endif
-- jmp 36b
--
-- /* Unlock after loop requires wakeup. */
--40:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_unlock_wake
-- jmp 41b
--
-- /* The initial unlocking of the mutex failed. */
--46: movq 8(%rsp), %rdi
-- movq %rax, (%rsp)
-- LOCK
--#if cond_lock == 0
-- decl (%rdi)
--#else
-- decl cond_lock(%rdi)
--#endif
-- jne 47f
--
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_unlock_wake
--
--47: movq (%rsp), %rax
-- jmp 48b
--
-- .size __pthread_cond_timedwait, .-__pthread_cond_timedwait
--versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
-- GLIBC_2_3_2)
--
--
-- .align 16
-- .type __condvar_cleanup2, @function
--__condvar_cleanup2:
-- /* Stack frame:
--
-- rsp + 72
-- +--------------------------+
-- rsp + 64 | %r12 |
-- +--------------------------+
-- rsp + 56 | %r13 |
-- +--------------------------+
-- rsp + 48 | %r14 |
-- +--------------------------+
-- rsp + 24 | unused |
-- +--------------------------+
-- rsp + 16 | mutex pointer |
-- +--------------------------+
-- rsp + 8 | condvar pointer |
-- +--------------------------+
-- rsp + 4 | old broadcast_seq value |
-- +--------------------------+
-- rsp + 0 | old cancellation mode |
-- +--------------------------+
-- */
--
-- movq %rax, 24(%rsp)
--
-- /* Get internal lock. */
-- movq 8(%rsp), %rdi
-- movl $1, %esi
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %esi, (%rdi)
--#else
-- cmpxchgl %esi, cond_lock(%rdi)
--#endif
-- jz 1f
--
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_lock_wait
--#if cond_lock != 0
-- subq $cond_lock, %rdi
--#endif
--
--1: movl broadcast_seq(%rdi), %edx
-- cmpl 4(%rsp), %edx
-- jne 3f
--
-- /* We increment the wakeup_seq counter only if it is lower than
-- total_seq. If this is not the case the thread was woken and
-- then canceled. In this case we ignore the signal. */
-- movq total_seq(%rdi), %rax
-- cmpq wakeup_seq(%rdi), %rax
-- jbe 6f
-- incq wakeup_seq(%rdi)
-- incl cond_futex(%rdi)
--6: incq woken_seq(%rdi)
--
--3: subl $(1 << nwaiters_shift), cond_nwaiters(%rdi)
--
-- /* Wake up a thread which wants to destroy the condvar object. */
-- xorq %r12, %r12
-- cmpq $0xffffffffffffffff, total_seq(%rdi)
-- jne 4f
-- movl cond_nwaiters(%rdi), %eax
-- andl $~((1 << nwaiters_shift) - 1), %eax
-- jne 4f
--
-- LP_OP(cmp) $-1, dep_mutex(%rdi)
-- leaq cond_nwaiters(%rdi), %rdi
-- movl $1, %edx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $FUTEX_WAKE, %eax
-- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi
-- cmove %eax, %esi
--#else
-- movl $0, %eax
-- movl %fs:PRIVATE_FUTEX, %esi
-- cmove %eax, %esi
-- orl $FUTEX_WAKE, %esi
--#endif
-- movl $SYS_futex, %eax
-- syscall
-- subq $cond_nwaiters, %rdi
-- movl $1, %r12d
--
--4: LOCK
--#if cond_lock == 0
-- decl (%rdi)
--#else
-- decl cond_lock(%rdi)
--#endif
-- je 2f
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_unlock_wake
--
-- /* Wake up all waiters to make sure no signal gets lost. */
--2: testq %r12, %r12
-- jnz 5f
-- addq $cond_futex, %rdi
-- LP_OP(cmp) $-1, dep_mutex-cond_futex(%rdi)
-- movl $0x7fffffff, %edx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $FUTEX_WAKE, %eax
-- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi
-- cmove %eax, %esi
--#else
-- movl $0, %eax
-- movl %fs:PRIVATE_FUTEX, %esi
-- cmove %eax, %esi
-- orl $FUTEX_WAKE, %esi
--#endif
-- movl $SYS_futex, %eax
-- syscall
--
-- /* Lock the mutex only if we don't own it already. This only happens
-- in case of PI mutexes, if we got cancelled after a successful
-- return of the futex syscall and before disabling async
-- cancellation. */
--5: movq 16(%rsp), %rdi
-- movl MUTEX_KIND(%rdi), %eax
-- andl $(ROBUST_BIT|PI_BIT), %eax
-- cmpl $PI_BIT, %eax
-- jne 7f
--
-- movl (%rdi), %eax
-- andl $TID_MASK, %eax
-- cmpl %eax, %fs:TID
-- jne 7f
-- /* We managed to get the lock. Fix it up before returning. */
-- callq __pthread_mutex_cond_lock_adjust
-- jmp 8f
--
--7: callq __pthread_mutex_cond_lock
--
--8: movq 24(%rsp), %rdi
-- movq FRAME_SIZE(%rsp), %r15
-- movq FRAME_SIZE+8(%rsp), %r14
-- movq FRAME_SIZE+16(%rsp), %r13
-- movq FRAME_SIZE+24(%rsp), %r12
--.LcallUR:
-- call _Unwind_Resume
-- hlt
--.LENDCODE:
-- cfi_endproc
-- .size __condvar_cleanup2, .-__condvar_cleanup2
--
--
-- .section .gcc_except_table,"a",@progbits
--.LexceptSTART:
-- .byte DW_EH_PE_omit # @LPStart format
-- .byte DW_EH_PE_omit # @TType format
-- .byte DW_EH_PE_uleb128 # call-site format
-- .uleb128 .Lcstend-.Lcstbegin
--.Lcstbegin:
-- .uleb128 .LcleanupSTART1-.LSTARTCODE
-- .uleb128 .LcleanupEND1-.LcleanupSTART1
-- .uleb128 __condvar_cleanup2-.LSTARTCODE
-- .uleb128 0
-- .uleb128 .LcallUR-.LSTARTCODE
-- .uleb128 .LENDCODE-.LcallUR
-- .uleb128 0
-- .uleb128 0
--.Lcstend:
--
--
--#ifdef SHARED
-- .hidden DW.ref.__gcc_personality_v0
-- .weak DW.ref.__gcc_personality_v0
-- .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
-- .align LP_SIZE
-- .type DW.ref.__gcc_personality_v0, @object
-- .size DW.ref.__gcc_personality_v0, LP_SIZE
--DW.ref.__gcc_personality_v0:
-- ASM_ADDR __gcc_personality_v0
--#endif
-diff --git a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
-deleted file mode 100644
-index c82f37b..0000000
---- a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
-+++ /dev/null
-@@ -1,555 +0,0 @@
--/* Copyright (C) 2002-2016 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include <sysdep.h>
--#include <shlib-compat.h>
--#include <lowlevellock.h>
--#include <lowlevelcond.h>
--#include <tcb-offsets.h>
--#include <pthread-pi-defines.h>
--#include <pthread-errnos.h>
--#include <stap-probe.h>
--
--#include <kernel-features.h>
--
--
-- .text
--
--/* int pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) */
-- .globl __pthread_cond_wait
-- .type __pthread_cond_wait, @function
-- .align 16
--__pthread_cond_wait:
--.LSTARTCODE:
-- cfi_startproc
--#ifdef SHARED
-- cfi_personality(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect,
-- DW.ref.__gcc_personality_v0)
-- cfi_lsda(DW_EH_PE_pcrel | DW_EH_PE_sdata4, .LexceptSTART)
--#else
-- cfi_personality(DW_EH_PE_udata4, __gcc_personality_v0)
-- cfi_lsda(DW_EH_PE_udata4, .LexceptSTART)
--#endif
--
--#define FRAME_SIZE (32+8)
-- leaq -FRAME_SIZE(%rsp), %rsp
-- cfi_adjust_cfa_offset(FRAME_SIZE)
--
-- /* Stack frame:
--
-- rsp + 32
-- +--------------------------+
-- rsp + 24 | old wake_seq value |
-- +--------------------------+
-- rsp + 16 | mutex pointer |
-- +--------------------------+
-- rsp + 8 | condvar pointer |
-- +--------------------------+
-- rsp + 4 | old broadcast_seq value |
-- +--------------------------+
-- rsp + 0 | old cancellation mode |
-- +--------------------------+
-- */
--
-- LIBC_PROBE (cond_wait, 2, %rdi, %rsi)
--
-- LP_OP(cmp) $-1, dep_mutex(%rdi)
--
-- /* Prepare structure passed to cancellation handler. */
-- movq %rdi, 8(%rsp)
-- movq %rsi, 16(%rsp)
--
-- je 15f
-- mov %RSI_LP, dep_mutex(%rdi)
--
-- /* Get internal lock. */
--15: movl $1, %esi
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %esi, (%rdi)
--#else
-- cmpxchgl %esi, cond_lock(%rdi)
--#endif
-- jne 1f
--
-- /* Unlock the mutex. */
--2: movq 16(%rsp), %rdi
-- xorl %esi, %esi
-- callq __pthread_mutex_unlock_usercnt
--
-- testl %eax, %eax
-- jne 12f
--
-- movq 8(%rsp), %rdi
-- incq total_seq(%rdi)
-- incl cond_futex(%rdi)
-- addl $(1 << nwaiters_shift), cond_nwaiters(%rdi)
--
-- /* Get and store current wakeup_seq value. */
-- movq 8(%rsp), %rdi
-- movq wakeup_seq(%rdi), %r9
-- movl broadcast_seq(%rdi), %edx
-- movq %r9, 24(%rsp)
-- movl %edx, 4(%rsp)
--
-- /* Unlock. */
--8: movl cond_futex(%rdi), %edx
-- LOCK
--#if cond_lock == 0
-- decl (%rdi)
--#else
-- decl cond_lock(%rdi)
--#endif
-- jne 3f
--
--.LcleanupSTART:
--4: callq __pthread_enable_asynccancel
-- movl %eax, (%rsp)
--
-- xorq %r10, %r10
-- LP_OP(cmp) $-1, dep_mutex(%rdi)
-- leaq cond_futex(%rdi), %rdi
-- movl $FUTEX_WAIT, %esi
-- je 60f
--
-- mov dep_mutex-cond_futex(%rdi), %R8_LP
-- /* Requeue to a non-robust PI mutex if the PI bit is set and
-- the robust bit is not set. */
-- movl MUTEX_KIND(%r8), %eax
-- andl $(ROBUST_BIT|PI_BIT), %eax
-- cmpl $PI_BIT, %eax
-- jne 61f
--
-- movl $(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi
-- movl $SYS_futex, %eax
-- syscall
--
-- cmpl $0, %eax
-- sete %r8b
--
--#ifdef __ASSUME_REQUEUE_PI
-- jmp 62f
--#else
-- je 62f
--
-- /* When a futex syscall with FUTEX_WAIT_REQUEUE_PI returns
-- successfully, it has already locked the mutex for us and the
-- pi_flag (%r8b) is set to denote that fact. However, if another
-- thread changed the futex value before we entered the wait, the
-- syscall may return an EAGAIN and the mutex is not locked. We go
-- ahead with a success anyway since later we look at the pi_flag to
-- decide if we got the mutex or not. The sequence numbers then make
-- sure that only one of the threads actually wake up. We retry using
-- normal FUTEX_WAIT only if the kernel returned ENOSYS, since normal
-- and PI futexes don't mix.
--
-- Note that we don't check for EAGAIN specifically; we assume that the
-- only other error the futex function could return is EAGAIN since
-- anything else would mean an error in our function. It is too
-- expensive to do that check for every call (which is quite common in
-- case of a large number of threads), so it has been skipped. */
-- cmpl $-ENOSYS, %eax
-- jne 62f
--
--# ifndef __ASSUME_PRIVATE_FUTEX
-- movl $FUTEX_WAIT, %esi
--# endif
--#endif
--
--61:
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $(FUTEX_WAIT|FUTEX_PRIVATE_FLAG), %esi
--#else
-- orl %fs:PRIVATE_FUTEX, %esi
--#endif
--60: xorb %r8b, %r8b
-- movl $SYS_futex, %eax
-- syscall
--
--62: movl (%rsp), %edi
-- callq __pthread_disable_asynccancel
--.LcleanupEND:
--
-- /* Lock. */
-- movq 8(%rsp), %rdi
-- movl $1, %esi
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %esi, (%rdi)
--#else
-- cmpxchgl %esi, cond_lock(%rdi)
--#endif
-- jnz 5f
--
--6: movl broadcast_seq(%rdi), %edx
--
-- movq woken_seq(%rdi), %rax
--
-- movq wakeup_seq(%rdi), %r9
--
-- cmpl 4(%rsp), %edx
-- jne 16f
--
-- cmpq 24(%rsp), %r9
-- jbe 19f
--
-- cmpq %rax, %r9
-- jna 19f
--
-- incq woken_seq(%rdi)
--
-- /* Unlock */
--16: subl $(1 << nwaiters_shift), cond_nwaiters(%rdi)
--
-- /* Wake up a thread which wants to destroy the condvar object. */
-- cmpq $0xffffffffffffffff, total_seq(%rdi)
-- jne 17f
-- movl cond_nwaiters(%rdi), %eax
-- andl $~((1 << nwaiters_shift) - 1), %eax
-- jne 17f
--
-- addq $cond_nwaiters, %rdi
-- LP_OP(cmp) $-1, dep_mutex-cond_nwaiters(%rdi)
-- movl $1, %edx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $FUTEX_WAKE, %eax
-- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi
-- cmove %eax, %esi
--#else
-- movl $0, %eax
-- movl %fs:PRIVATE_FUTEX, %esi
-- cmove %eax, %esi
-- orl $FUTEX_WAKE, %esi
--#endif
-- movl $SYS_futex, %eax
-- syscall
-- subq $cond_nwaiters, %rdi
--
--17: LOCK
--#if cond_lock == 0
-- decl (%rdi)
--#else
-- decl cond_lock(%rdi)
--#endif
-- jne 10f
--
-- /* If requeue_pi is used the kernel performs the locking of the
-- mutex. */
--11: movq 16(%rsp), %rdi
-- testb %r8b, %r8b
-- jnz 18f
--
-- callq __pthread_mutex_cond_lock
--
--14: leaq FRAME_SIZE(%rsp), %rsp
-- cfi_adjust_cfa_offset(-FRAME_SIZE)
--
-- /* We return the result of the mutex_lock operation. */
-- retq
--
-- cfi_adjust_cfa_offset(FRAME_SIZE)
--
--18: callq __pthread_mutex_cond_lock_adjust
-- xorl %eax, %eax
-- jmp 14b
--
-- /* We need to go back to futex_wait. If we're using requeue_pi, then
-- release the mutex we had acquired and go back. */
--19: testb %r8b, %r8b
-- jz 8b
--
-- /* Adjust the mutex values first and then unlock it. The unlock
-- should always succeed or else the kernel did not lock the mutex
-- correctly. */
-- movq 16(%rsp), %rdi
-- callq __pthread_mutex_cond_lock_adjust
-- movq %rdi, %r8
-- xorl %esi, %esi
-- callq __pthread_mutex_unlock_usercnt
-- /* Reload cond_var. */
-- movq 8(%rsp), %rdi
-- jmp 8b
--
-- /* Initial locking failed. */
--1:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_lock_wait
-- jmp 2b
--
-- /* Unlock in loop requires wakeup. */
--3:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- /* The call preserves %rdx. */
-- callq __lll_unlock_wake
--#if cond_lock != 0
-- subq $cond_lock, %rdi
--#endif
-- jmp 4b
--
-- /* Locking in loop failed. */
--5:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_lock_wait
--#if cond_lock != 0
-- subq $cond_lock, %rdi
--#endif
-- jmp 6b
--
-- /* Unlock after loop requires wakeup. */
--10:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_unlock_wake
-- jmp 11b
--
-- /* The initial unlocking of the mutex failed. */
--12: movq %rax, %r10
-- movq 8(%rsp), %rdi
-- LOCK
--#if cond_lock == 0
-- decl (%rdi)
--#else
-- decl cond_lock(%rdi)
--#endif
-- je 13f
--
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_unlock_wake
--
--13: movq %r10, %rax
-- jmp 14b
--
-- .size __pthread_cond_wait, .-__pthread_cond_wait
--versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
-- GLIBC_2_3_2)
--
--
-- .align 16
-- .type __condvar_cleanup1, @function
-- .globl __condvar_cleanup1
-- .hidden __condvar_cleanup1
--__condvar_cleanup1:
-- /* Stack frame:
--
-- rsp + 32
-- +--------------------------+
-- rsp + 24 | unused |
-- +--------------------------+
-- rsp + 16 | mutex pointer |
-- +--------------------------+
-- rsp + 8 | condvar pointer |
-- +--------------------------+
-- rsp + 4 | old broadcast_seq value |
-- +--------------------------+
-- rsp + 0 | old cancellation mode |
-- +--------------------------+
-- */
--
-- movq %rax, 24(%rsp)
--
-- /* Get internal lock. */
-- movq 8(%rsp), %rdi
-- movl $1, %esi
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %esi, (%rdi)
--#else
-- cmpxchgl %esi, cond_lock(%rdi)
--#endif
-- jz 1f
--
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_lock_wait
--#if cond_lock != 0
-- subq $cond_lock, %rdi
--#endif
--
--1: movl broadcast_seq(%rdi), %edx
-- cmpl 4(%rsp), %edx
-- jne 3f
--
-- /* We increment the wakeup_seq counter only if it is lower than
-- total_seq. If this is not the case the thread was woken and
-- then canceled. In this case we ignore the signal. */
-- movq total_seq(%rdi), %rax
-- cmpq wakeup_seq(%rdi), %rax
-- jbe 6f
-- incq wakeup_seq(%rdi)
-- incl cond_futex(%rdi)
--6: incq woken_seq(%rdi)
--
--3: subl $(1 << nwaiters_shift), cond_nwaiters(%rdi)
--
-- /* Wake up a thread which wants to destroy the condvar object. */
-- xorl %ecx, %ecx
-- cmpq $0xffffffffffffffff, total_seq(%rdi)
-- jne 4f
-- movl cond_nwaiters(%rdi), %eax
-- andl $~((1 << nwaiters_shift) - 1), %eax
-- jne 4f
--
-- LP_OP(cmp) $-1, dep_mutex(%rdi)
-- leaq cond_nwaiters(%rdi), %rdi
-- movl $1, %edx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $FUTEX_WAKE, %eax
-- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi
-- cmove %eax, %esi
--#else
-- movl $0, %eax
-- movl %fs:PRIVATE_FUTEX, %esi
-- cmove %eax, %esi
-- orl $FUTEX_WAKE, %esi
--#endif
-- movl $SYS_futex, %eax
-- syscall
-- subq $cond_nwaiters, %rdi
-- movl $1, %ecx
--
--4: LOCK
--#if cond_lock == 0
-- decl (%rdi)
--#else
-- decl cond_lock(%rdi)
--#endif
-- je 2f
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- /* The call preserves %rcx. */
-- callq __lll_unlock_wake
--
-- /* Wake up all waiters to make sure no signal gets lost. */
--2: testl %ecx, %ecx
-- jnz 5f
-- addq $cond_futex, %rdi
-- LP_OP(cmp) $-1, dep_mutex-cond_futex(%rdi)
-- movl $0x7fffffff, %edx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $FUTEX_WAKE, %eax
-- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi
-- cmove %eax, %esi
--#else
-- movl $0, %eax
-- movl %fs:PRIVATE_FUTEX, %esi
-- cmove %eax, %esi
-- orl $FUTEX_WAKE, %esi
--#endif
-- movl $SYS_futex, %eax
-- syscall
--
-- /* Lock the mutex only if we don't own it already. This only happens
-- in case of PI mutexes, if we got cancelled after a successful
-- return of the futex syscall and before disabling async
-- cancellation. */
--5: movq 16(%rsp), %rdi
-- movl MUTEX_KIND(%rdi), %eax
-- andl $(ROBUST_BIT|PI_BIT), %eax
-- cmpl $PI_BIT, %eax
-- jne 7f
--
-- movl (%rdi), %eax
-- andl $TID_MASK, %eax
-- cmpl %eax, %fs:TID
-- jne 7f
-- /* We managed to get the lock. Fix it up before returning. */
-- callq __pthread_mutex_cond_lock_adjust
-- jmp 8f
--
--
--7: callq __pthread_mutex_cond_lock
--
--8: movq 24(%rsp), %rdi
--.LcallUR:
-- call _Unwind_Resume
-- hlt
--.LENDCODE:
-- cfi_endproc
-- .size __condvar_cleanup1, .-__condvar_cleanup1
--
--
-- .section .gcc_except_table,"a",@progbits
--.LexceptSTART:
-- .byte DW_EH_PE_omit # @LPStart format
-- .byte DW_EH_PE_omit # @TType format
-- .byte DW_EH_PE_uleb128 # call-site format
-- .uleb128 .Lcstend-.Lcstbegin
--.Lcstbegin:
-- .uleb128 .LcleanupSTART-.LSTARTCODE
-- .uleb128 .LcleanupEND-.LcleanupSTART
-- .uleb128 __condvar_cleanup1-.LSTARTCODE
-- .uleb128 0
-- .uleb128 .LcallUR-.LSTARTCODE
-- .uleb128 .LENDCODE-.LcallUR
-- .uleb128 0
-- .uleb128 0
--.Lcstend:
--
--
--#ifdef SHARED
-- .hidden DW.ref.__gcc_personality_v0
-- .weak DW.ref.__gcc_personality_v0
-- .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
-- .align LP_SIZE
-- .type DW.ref.__gcc_personality_v0, @object
-- .size DW.ref.__gcc_personality_v0, LP_SIZE
--DW.ref.__gcc_personality_v0:
-- ASM_ADDR __gcc_personality_v0
--#endif
-diff --git a/sysdeps/x86/bits/pthreadtypes.h b/sysdeps/x86/bits/pthreadtypes.h
-index 16b8f4f..a3a738f 100644
---- a/sysdeps/x86/bits/pthreadtypes.h
-+++ b/sysdeps/x86/bits/pthreadtypes.h
-@@ -140,14 +140,27 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __wseq;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __wseq32;
-+ };
-+ __extension__ union
-+ {
-+ __extension__ unsigned long long int __g1_start;
-+ struct {
-+ unsigned int __low;
-+ unsigned int __high;
-+ } __g1_start32;
-+ };
-+ unsigned int __g_refs[2];
-+ unsigned int __g_size[2];
-+ unsigned int __g1_orig_size;
-+ unsigned int __wrefs;
-+ unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
---
-2.10.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch
index 3127de68e..b981f7bf7 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch
@@ -1,7 +1,7 @@
-From a56e7aa2fd10b178b9498f88a7a2ca8aad671a53 Mon Sep 17 00:00:00 2001
+From 0b95f34207ffed3aa53fa949662bfbccc7c864a4 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 04/25] nativesdk-glibc: Allow 64 bit atomics for x86
+Subject: [PATCH 04/26] 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.
@@ -11,8 +11,6 @@ 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>
---
-Upstream-Status: Pending
-
sysdeps/i386/atomic-machine.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -30,5 +28,5 @@ index ce62b33..4fe44ea 100644
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0005-Remove-__ASSUME_REQUEUE_PI.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0005-Remove-__ASSUME_REQUEUE_PI.patch
deleted file mode 100644
index 8d4ba4107..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0005-Remove-__ASSUME_REQUEUE_PI.patch
+++ /dev/null
@@ -1,149 +0,0 @@
-From 27b7131d3d8133bf3a5ce72d4e4ff4dfadd71f20 Mon Sep 17 00:00:00 2001
-From: Catalin Enache <catalin.enache@windriver.com>
-Date: Fri, 30 Jun 2017 12:08:29 +0300
-Subject: [PATCH 5/6] Remove __ASSUME_REQUEUE_PI
-
-The new cond var implementation (ed19993b5b0d) removed all the
-__ASSUME_{REQUEUE_PI,FUTEX_LOCK_PI} internal usage so there is no
-need to keep defining it. This patch removes all USE_REQUEUE_PI
-and __ASSUME_REQUEUE_PI. It is as follow up from BZ#18463.
-
-Checked with a build for x86_64-linux-gnu, arm-linux-gnueabhf,
-m68-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.
-
- * nptl/pthreadP.h (USE_REQUEUE_PI): Remove ununsed macro.
- * sysdeps/unix/sysv/linux/arm/kernel-features.h
- (__ASSUME_REQUEUE_PI): Likewise.
- * sysdeps/unix/sysv/linux/kernel-features.h
- (__ASSUME_REQUEUE_PI): Likewise.
- * sysdeps/unix/sysv/linux/m68k/kernel-features.h
- (__ASSUME_REQUEUE_PI): Likewise.
- * sysdeps/unix/sysv/linux/mips/kernel-features.h
- (__ASSUME_REQUEUE_PI): Likewise.
- * sysdeps/unix/sysv/linux/sparc/kernel-features.h
- (__ASSUME_REQUEUE_PI): Likewise.
-
-Upstream-Status: Backport
-
-Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
----
- ChangeLog | 14 ++++++++++++++
- nptl/pthreadP.h | 12 ------------
- sysdeps/unix/sysv/linux/arm/kernel-features.h | 1 -
- sysdeps/unix/sysv/linux/kernel-features.h | 5 -----
- sysdeps/unix/sysv/linux/m68k/kernel-features.h | 1 -
- sysdeps/unix/sysv/linux/mips/kernel-features.h | 1 -
- sysdeps/unix/sysv/linux/sparc/kernel-features.h | 1 -
- 7 files changed, 14 insertions(+), 21 deletions(-)
-
-diff --git a/ChangeLog b/ChangeLog
-index c94db7b..44c518b 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,3 +1,17 @@
-+2017-04-04 Adhemerval Zanella <adhemerval.zanella@linaro.org>
-+
-+ * nptl/pthreadP.h (USE_REQUEUE_PI): Remove ununsed macro.
-+ * sysdeps/unix/sysv/linux/arm/kernel-features.h
-+ (__ASSUME_REQUEUE_PI): Likewise.
-+ * sysdeps/unix/sysv/linux/kernel-features.h
-+ (__ASSUME_REQUEUE_PI): Likewise.
-+ * sysdeps/unix/sysv/linux/m68k/kernel-features.h
-+ (__ASSUME_REQUEUE_PI): Likewise.
-+ * sysdeps/unix/sysv/linux/mips/kernel-features.h
-+ (__ASSUME_REQUEUE_PI): Likewise.
-+ * sysdeps/unix/sysv/linux/sparc/kernel-features.h
-+ (__ASSUME_REQUEUE_PI): Likewise.
-+
- 2016-12-31 Torvald Riegel <triegel@redhat.com>
-
- [BZ #13165]
-diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
-index e9992bc..730c4ad 100644
---- a/nptl/pthreadP.h
-+++ b/nptl/pthreadP.h
-@@ -594,18 +594,6 @@ extern void __wait_lookup_done (void) attribute_hidden;
- # define PTHREAD_STATIC_FN_REQUIRE(name) __asm (".globl " #name);
- #endif
-
--/* Test if the mutex is suitable for the FUTEX_WAIT_REQUEUE_PI operation. */
--#if (defined lll_futex_wait_requeue_pi \
-- && defined __ASSUME_REQUEUE_PI)
--# define USE_REQUEUE_PI(mut) \
-- ((mut) && (mut) != (void *) ~0l \
-- && (((mut)->__data.__kind \
-- & (PTHREAD_MUTEX_PRIO_INHERIT_NP | PTHREAD_MUTEX_ROBUST_NORMAL_NP)) \
-- == PTHREAD_MUTEX_PRIO_INHERIT_NP))
--#else
--# define USE_REQUEUE_PI(mut) 0
--#endif
--
- /* Returns 0 if POL is a valid scheduling policy. */
- static inline int
- check_sched_policy_attr (int pol)
-diff --git a/sysdeps/unix/sysv/linux/arm/kernel-features.h b/sysdeps/unix/sysv/linux/arm/kernel-features.h
-index 6ca607e..339ad45 100644
---- a/sysdeps/unix/sysv/linux/arm/kernel-features.h
-+++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h
-@@ -23,7 +23,6 @@
- futex_atomic_cmpxchg_inatomic, depending on kernel
- configuration. */
- #if __LINUX_KERNEL_VERSION < 0x030E03
--# undef __ASSUME_REQUEUE_PI
- # undef __ASSUME_SET_ROBUST_LIST
- #endif
-
-diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
-index 1d3b554..9f2cf9f 100644
---- a/sysdeps/unix/sysv/linux/kernel-features.h
-+++ b/sysdeps/unix/sysv/linux/kernel-features.h
-@@ -101,11 +101,6 @@
- #define __ASSUME_PREADV 1
- #define __ASSUME_PWRITEV 1
-
--/* Support for FUTEX_*_REQUEUE_PI was added in 2.6.31 (but some
-- architectures lack futex_atomic_cmpxchg_inatomic in some
-- configurations). */
--#define __ASSUME_REQUEUE_PI 1
--
- /* Support for recvmmsg functionality was added in 2.6.33. The macros
- defined correspond to those for accept4. */
- #if __LINUX_KERNEL_VERSION >= 0x020621
-diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
-index 46ec601..174c1c6 100644
---- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
-+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
-@@ -51,6 +51,5 @@
-
- /* No support for PI futexes or robust mutexes before 3.10 for m68k. */
- #if __LINUX_KERNEL_VERSION < 0x030a00
--# undef __ASSUME_REQUEUE_PI
- # undef __ASSUME_SET_ROBUST_LIST
- #endif
-diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h
-index b486d90..a795911c 100644
---- a/sysdeps/unix/sysv/linux/mips/kernel-features.h
-+++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h
-@@ -24,7 +24,6 @@
- /* The MIPS kernel does not support futex_atomic_cmpxchg_inatomic if
- emulating LL/SC. */
- #if __mips == 1 || defined _MIPS_ARCH_R5900
--# undef __ASSUME_REQUEUE_PI
- # undef __ASSUME_SET_ROBUST_LIST
- #endif
-
-diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
-index 69c9c7c..dd3ddf0 100644
---- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
-+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
-@@ -34,6 +34,5 @@
- /* 32-bit SPARC kernels do not support
- futex_atomic_cmpxchg_inatomic. */
- #if !defined __arch64__ && !defined __sparc_v9__
--# undef __ASSUME_REQUEUE_PI
- # undef __ASSUME_SET_ROBUST_LIST
- #endif
---
-2.10.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0005-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0005-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch
index dc0dfad9a..ee5000031 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0005-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0005-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch
@@ -1,7 +1,7 @@
-From 450473ce27b47cebec2c5c5b611a8c8bed41e6e8 Mon Sep 17 00:00:00 2001
+From 77a7495376c7d0c5507c0ec99bf1568150339ef4 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 05/25] fsl e500/e5500/e6500/603e fsqrt implementation
+Subject: [PATCH 05/26] fsl e500/e5500/e6500/603e fsqrt implementation
Upstream-Status: Pending
Signed-off-by: Edmar Wienskoski <edmar@freescale.com>
@@ -1580,5 +1580,5 @@ index 0000000..04ff8cc
@@ -0,0 +1 @@
+powerpc/powerpc64/e6500/fpu
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0006-Fix-atomic_fetch_xor_release.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0006-Fix-atomic_fetch_xor_release.patch
deleted file mode 100644
index 7616efa18..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0006-Fix-atomic_fetch_xor_release.patch
+++ /dev/null
@@ -1,81 +0,0 @@
-From b671f20cc160238b62894d032a55baf85867106e Mon Sep 17 00:00:00 2001
-From: Catalin Enache <catalin.enache@windriver.com>
-Date: Fri, 30 Jun 2017 19:12:43 +0300
-Subject: [PATCH 6/6] Fix atomic_fetch_xor_release.
-
-No code uses atomic_fetch_xor_release except for the upcoming
-conditional variable rewrite. Therefore there is no user
-visible bug here. The use of atomic_compare_and_exchange_bool_rel
-is removed (since it doesn't exist anymore), and is replaced
-by atomic_compare_exchange_weak_release.
-
-We use weak_release because it provides better performance in
-the loop (the weak semantic) and because the xor is release MO
-(the release semantic). We don't reload expected in the loop
-because atomic_compare_and_exchange_weak_release does this for
-us as part of the CAS failure.
-
-It is otherwise a fairly plain conversion that fixes building
-the new condvar for 32-bit x86. Passes all regression tests
-for x86.
-
-Upstream-Status: Backport
-
-Author: Carlos O'Donell <carlos@systemhalted.org>
-Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
----
- ChangeLog | 6 ++++++
- include/atomic.h | 19 +++++++++++--------
- 2 files changed, 17 insertions(+), 8 deletions(-)
-
-diff --git a/ChangeLog b/ChangeLog
-index 44c518b..893262d 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,3 +1,9 @@
-+2016-10-26 Carlos O'Donell <carlos@redhat.com>
-+
-+ * include/atomic.h
-+ [USE_COMPILER_ATOMIC_BUILTINS && !atomic_fetch_xor_release]
-+ (atomic_fetch_xor_release): Use atomic_compare_exchange_weak_release.
-+
- 2017-04-04 Adhemerval Zanella <adhemerval.zanella@linaro.org>
-
- * nptl/pthreadP.h (USE_REQUEUE_PI): Remove ununsed macro.
-diff --git a/include/atomic.h b/include/atomic.h
-index 5a8e7e7..c8b4664 100644
---- a/include/atomic.h
-+++ b/include/atomic.h
-@@ -777,18 +777,21 @@ void __atomic_link_error (void);
- # endif
-
- # ifndef atomic_fetch_xor_release
-+/* Failing the atomic_compare_exchange_weak_release reloads the value in
-+ __atg104_expected, so we need only do the XOR again and retry. */
- # define atomic_fetch_xor_release(mem, operand) \
-- ({ __typeof (*(mem)) __atg104_old; \
-- __typeof (mem) __atg104_memp = (mem); \
-+ ({ __typeof (mem) __atg104_memp = (mem); \
-+ __typeof (*(mem)) __atg104_expected = (*__atg104_memp); \
-+ __typeof (*(mem)) __atg104_desired; \
- __typeof (*(mem)) __atg104_op = (operand); \
- \
- do \
-- __atg104_old = (*__atg104_memp); \
-- while (__builtin_expect \
-- (atomic_compare_and_exchange_bool_rel ( \
-- __atg104_memp, __atg104_old ^ __atg104_op, __atg104_old), 0));\
-- \
-- __atg104_old; })
-+ __atg104_desired = __atg104_expected ^ __atg104_op; \
-+ while (__glibc_unlikely \
-+ (atomic_compare_exchange_weak_release ( \
-+ __atg104_memp, &__atg104_expected, __atg104_desired) \
-+ == 0)); \
-+ __atg104_expected; })
- #endif
-
- #endif /* !USE_ATOMIC_COMPILER_BUILTINS */
---
-2.10.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0006-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0006-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch
index f267f66cd..9088d29c4 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0006-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0006-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch
@@ -1,7 +1,7 @@
-From bb065b78e9e0d3301e64a26e37550a657c885ebc Mon Sep 17 00:00:00 2001
+From 520cb9e746af637cf01fea385b7f4ee4aadbdfdd 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 06/25] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known
+Subject: [PATCH 06/26] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known
names
This bolts in a hook for OE to pass its own version of interpreter
@@ -29,5 +29,5 @@ index 8a66ffe..08d56fc 100644
static struct known_names known_libs[] =
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0007-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0007-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch
index 612e892e8..f33defe07 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0007-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0007-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch
@@ -1,7 +1,7 @@
-From 4a91bbdb11a15f93094695bba4e0849c421fad48 Mon Sep 17 00:00:00 2001
+From 64130262787d54e2e6695ae4ed8783bfec14ffef 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 07/25] ppc/sqrt: Fix undefined reference to `__sqrt_finite'
+Subject: [PATCH 07/26] ppc/sqrt: Fix undefined reference to `__sqrt_finite'
on ppc fixes the errors like below
| ./.libs/libpulsecore-1.1.so: undefined reference to `__sqrt_finite'
@@ -204,5 +204,5 @@ index 26fa067..9d17512 100644
}
+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0008-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0008-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
index 9e222b7b4..26f65c5b1 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0008-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0008-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
@@ -1,7 +1,7 @@
-From ce2746a1560b4430d89d114e1b65c7be225b4c2a Mon Sep 17 00:00:00 2001
+From 5afb0147e3e49c3b474404524014efe51b2bca5a 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 08/25] __ieee754_sqrt{,f} are now inline functions and call
+Subject: [PATCH 08/26] __ieee754_sqrt{,f} are now inline functions and call
out __slow versions
Upstream-Status: Pending
@@ -383,5 +383,5 @@ index 9d17512..10de1f0 100644
+
strong_alias (__ieee754_sqrtf, __sqrtf_finite)
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0009-Quote-from-bug-1443-which-explains-what-the-patch-do.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0009-Quote-from-bug-1443-which-explains-what-the-patch-do.patch
index 7aa74df23..d416acde3 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0009-Quote-from-bug-1443-which-explains-what-the-patch-do.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0009-Quote-from-bug-1443-which-explains-what-the-patch-do.patch
@@ -1,7 +1,7 @@
-From 1b61649e545de76dd79a5e2c39bb16d0c4623160 Mon Sep 17 00:00:00 2001
+From ddd51bb4e005432cb3c0f8f33822954408a9fee1 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 09/25] Quote from bug 1443 which explains what the patch does
+Subject: [PATCH 09/26] Quote from bug 1443 which explains what the patch does
:
We build some random program and link it with -lust. When we run it,
@@ -58,5 +58,5 @@ index 60eee00..7d54d5e 100644
case R_ARM_TLS_TPOFF32:
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0010-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0010-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch
index 14963a357..276f1fa4c 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0010-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0010-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch
@@ -1,7 +1,7 @@
-From 91af416408b8718b004c83d93a6daa1f34cba48d Mon Sep 17 00:00:00 2001
+From d7e74670825330f5421a55f5aa2a1ce6fda7d7fb Mon Sep 17 00:00:00 2001
From: Ting Liu <b28495@freescale.com>
Date: Wed, 19 Dec 2012 04:39:57 -0600
-Subject: [PATCH 10/25] eglibc: run libm-err-tab.pl with specific dirs in ${S}
+Subject: [PATCH 10/26] eglibc: run libm-err-tab.pl with specific dirs in ${S}
libm-err-tab.pl will parse all the files named "libm-test-ulps"
in the given dir recursively. To avoid parsing the one in
@@ -32,5 +32,5 @@ index f2f694f..e062833 100644
touch $@
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
index e92d04c62..096dab547 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
@@ -1,7 +1,7 @@
-From 6a71f688471fe0c85f8ad9afc4ee0723a20aae1d Mon Sep 17 00:00:00 2001
+From d6e2076571263e45c48889896d3d94ff576df2be 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 11/25] __ieee754_sqrt{,f} are now inline functions and call
+Subject: [PATCH 11/26] __ieee754_sqrt{,f} are now inline functions and call
out __slow versions
Upstream-Status: Pending
@@ -57,5 +57,5 @@ index 8126535..10de1f0 100644
#endif
{
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0012-Make-ld-version-output-matching-grok-gold-s-output.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0012-Make-ld-version-output-matching-grok-gold-s-output.patch
index 4cba03f23..7728c61a9 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0012-Make-ld-version-output-matching-grok-gold-s-output.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0012-Make-ld-version-output-matching-grok-gold-s-output.patch
@@ -1,7 +1,7 @@
-From f9d024edb158659e403b51cc9d93da9bca6e5d7b Mon Sep 17 00:00:00 2001
+From c0974c746e026650bef5d1940eb3f519765c77af Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:25:45 +0000
-Subject: [PATCH 12/25] Make ld --version output matching grok gold's output
+Subject: [PATCH 12/26] Make ld --version output matching grok gold's output
adapted from from upstream branch roland/gold-vs-libc
@@ -14,10 +14,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
-index 8fe5937..7888a3f 100755
+index 5cf3230..391f29d 100755
--- a/configure
+++ b/configure
-@@ -4482,7 +4482,7 @@ else
+@@ -4555,7 +4555,7 @@ else
# Found it, now check the version.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $LD" >&5
$as_echo_n "checking version of $LD... " >&6; }
@@ -27,10 +27,10 @@ index 8fe5937..7888a3f 100755
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
2.1[0-9][0-9]*|2.2[2-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*)
diff --git a/configure.ac b/configure.ac
-index 3c766b7..6908a99 100644
+index d719fad..5b5877c 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -944,7 +944,7 @@ AC_CHECK_PROG_VER(AS, $AS, --version,
+@@ -990,7 +990,7 @@ AC_CHECK_PROG_VER(AS, $AS, --version,
[2.1[0-9][0-9]*|2.2[2-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
AS=: critic_missing="$critic_missing as")
AC_CHECK_PROG_VER(LD, $LD, --version,
@@ -40,5 +40,5 @@ index 3c766b7..6908a99 100644
LD=: critic_missing="$critic_missing ld")
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0013-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0013-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch
index 6a82f8d93..1c81c729d 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0013-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0013-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch
@@ -1,7 +1,7 @@
-From 2ece12093c8ba4cf688d235f35d36f1feb02324c Mon Sep 17 00:00:00 2001
+From 2a12eadfd7940b6b0913de8e95d851254cce7953 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 13/25] sysdeps/gnu/configure.ac: handle correctly
+Subject: [PATCH 13/26] sysdeps/gnu/configure.ac: handle correctly
$libc_cv_rootsbindir
Upstream-Status:Pending
@@ -38,5 +38,5 @@ index 634fe4d..3db1697 100644
;;
esac
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0014-Add-unused-attribute.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0014-Add-unused-attribute.patch
index d14a6d4cd..b23e104ff 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0014-Add-unused-attribute.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0014-Add-unused-attribute.patch
@@ -1,7 +1,7 @@
-From 9fec083dc99d2b524090e1d098e03709eed64a72 Mon Sep 17 00:00:00 2001
+From ec4f7763b30603b7ba0b70bd7750e34d442821b3 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 14/25] Add unused attribute
+Subject: [PATCH 14/26] Add unused attribute
Helps in avoiding gcc warning when header is is included in
a source file which does not use both functions
@@ -30,5 +30,5 @@ index 95cbce7..191a0dd 100644
{
int slash_count = 0;
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0015-yes-within-the-path-sets-wrong-config-variables.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0015-yes-within-the-path-sets-wrong-config-variables.patch
index 8ceccec41..98d425a7b 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0015-yes-within-the-path-sets-wrong-config-variables.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0015-yes-within-the-path-sets-wrong-config-variables.patch
@@ -1,7 +1,7 @@
-From 1794a97cba0b09b726eebc565c783c7b7c22dfba Mon Sep 17 00:00:00 2001
+From 18d64951cbb68d8d75e8ef347cbd0e0a5c14604b 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 15/25] 'yes' within the path sets wrong config variables
+Subject: [PATCH 15/26] 'yes' within the path sets wrong config variables
It seems that the 'AC_EGREP_CPP(yes...' example is quite popular
but being such a short word to grep it is likely to produce
@@ -259,5 +259,5 @@ index 0822915..9a32fdd 100644
], libc_cv_ppc64_def_call_elf=yes, libc_cv_ppc64_def_call_elf=no)])
if test $libc_cv_ppc64_def_call_elf = no; then
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0016-timezone-re-written-tzselect-as-posix-sh.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0016-timezone-re-written-tzselect-as-posix-sh.patch
index e5b508330..426a2c0c2 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0016-timezone-re-written-tzselect-as-posix-sh.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0016-timezone-re-written-tzselect-as-posix-sh.patch
@@ -1,7 +1,7 @@
-From fdb5c9c88e3d1bc5ae6ef9ebcfcf560d3c42f0a6 Mon Sep 17 00:00:00 2001
+From 2bed515b9f9f613ae0db9b9607d8fa60a4afca5b 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 16/25] timezone: re-written tzselect as posix sh
+Subject: [PATCH 16/26] timezone: re-written tzselect as posix sh
To avoid the bash dependency.
@@ -41,5 +41,5 @@ index 2c3b2f4..0c04a61 100755
# Output one argument as-is to standard output.
# Safer than 'echo', which can mishandle '\' or leading '-'.
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0017-Remove-bash-dependency-for-nscd-init-script.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0017-Remove-bash-dependency-for-nscd-init-script.patch
index c8da05dc6..6c2506ccc 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0017-Remove-bash-dependency-for-nscd-init-script.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0017-Remove-bash-dependency-for-nscd-init-script.patch
@@ -1,7 +1,7 @@
-From 88ad88d014a5ee68b0e044d2def5ab13743c8ae0 Mon Sep 17 00:00:00 2001
+From c8814875b362efbfd778345d0d2777478bf11a30 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 17/25] Remove bash dependency for nscd init script
+Subject: [PATCH 17/26] Remove bash dependency for nscd init script
The nscd init script uses #! /bin/bash but only really uses one bashism
(translated strings), so remove them and switch the shell to #!/bin/sh.
@@ -9,8 +9,6 @@ The nscd init script uses #! /bin/bash but only really uses one bashism
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
-Upstream-Status: Pending
-
nscd/nscd.init | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
@@ -71,5 +69,5 @@ index a882da7..b02986e 100644
;;
esac
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0018-eglibc-Cross-building-and-testing-instructions.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0018-eglibc-Cross-building-and-testing-instructions.patch
index 175076524..2ec01f05c 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0018-eglibc-Cross-building-and-testing-instructions.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0018-eglibc-Cross-building-and-testing-instructions.patch
@@ -1,7 +1,7 @@
-From 49c0ad7dc2e02e808ed150296a109b586c34115a Mon Sep 17 00:00:00 2001
+From df96d6b61bb60f13cd3d4989d1afc56d705f4a33 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 18/25] eglibc: Cross building and testing instructions
+Subject: [PATCH 18/26] eglibc: Cross building and testing instructions
Ported from eglibc
Upstream-Status: Pending
@@ -615,5 +615,5 @@ index 0000000..b67b468
+ simply place copies of these libraries in the top GLIBC build
+ directory.
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0019-eglibc-Help-bootstrap-cross-toolchain.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0019-eglibc-Help-bootstrap-cross-toolchain.patch
index f983d86a9..f5921bb7b 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0019-eglibc-Help-bootstrap-cross-toolchain.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0019-eglibc-Help-bootstrap-cross-toolchain.patch
@@ -1,7 +1,7 @@
-From e881face7a10354612bf634b44e09e3bc6462c67 Mon Sep 17 00:00:00 2001
+From 2cb7e3cae4020f431d426ad1740bb25506cde899 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 19/25] eglibc: Help bootstrap cross toolchain
+Subject: [PATCH 19/26] eglibc: Help bootstrap cross toolchain
Taken from EGLIBC, r1484 + r1525
@@ -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 32748b3..6d055ba 100644
+index 1ae3281..26ab7bf 100644
--- a/Makefile
+++ b/Makefile
-@@ -69,9 +69,18 @@ subdir-dirs = include
+@@ -70,9 +70,18 @@ subdir-dirs = include
vpath %.h $(subdir-dirs)
# What to install.
@@ -52,7 +52,7 @@ index 32748b3..6d055ba 100644
ifeq (yes,$(build-shared))
headers += gnu/lib-names.h
endif
-@@ -151,6 +160,16 @@ others: $(common-objpfx)testrun.sh
+@@ -152,6 +161,16 @@ others: $(common-objpfx)testrun.sh
subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
@@ -69,7 +69,7 @@ index 32748b3..6d055ba 100644
ifndef abi-variants
installed-stubs = $(inst_includedir)/gnu/stubs.h
else
-@@ -177,6 +196,7 @@ $(inst_includedir)/gnu/stubs.h: $(+force)
+@@ -178,6 +197,7 @@ $(inst_includedir)/gnu/stubs.h: $(+force)
install-others-nosubdir: $(installed-stubs)
endif
@@ -96,5 +96,5 @@ index 0000000..1d2b669
+ EGLIBC subdir 'stubs' make targets, on every .o file in EGLIBC, but
+ an empty stubs.h like this will do fine for GCC. */
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0020-eglibc-cherry-picked-from.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0020-eglibc-cherry-picked-from.patch
index 30c4c6987..43445739b 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0020-eglibc-cherry-picked-from.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0020-eglibc-cherry-picked-from.patch
@@ -1,7 +1,7 @@
-From 723a31d3e2627211b39fbcc08f75b3c23c4096c5 Mon Sep 17 00:00:00 2001
+From b2ed906ec864583b43379ef9ad2b5630c1232565 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 31 Dec 2015 15:10:33 -0800
-Subject: [PATCH 20/25] eglibc: cherry-picked from
+Subject: [PATCH 20/26] eglibc: cherry-picked from
http://www.eglibc.org/archives/patches/msg00772.html
@@ -60,5 +60,5 @@ index a4b376f..3256e12 100644
if (resp->nscount > 0)
__res_iclose (resp, true);
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0021-eglibc-Clear-cache-lines-on-ppc8xx.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0021-eglibc-Clear-cache-lines-on-ppc8xx.patch
index 8931c9e25..a9a73916f 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0021-eglibc-Clear-cache-lines-on-ppc8xx.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0021-eglibc-Clear-cache-lines-on-ppc8xx.patch
@@ -1,7 +1,7 @@
-From 9699873820d0347c2f377f0d86bce615d87a5e47 Mon Sep 17 00:00:00 2001
+From 000ab518aa1269714bc0a9a4633b0a538fae91d9 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 21/25] eglibc: Clear cache lines on ppc8xx
+Subject: [PATCH 21/26] eglibc: Clear cache lines on ppc8xx
2007-06-13 Nathan Sidwell <nathan@codesourcery.com>
Mark Shinwell <shinwell@codesourcery.com>
@@ -79,5 +79,5 @@ index 0efd297..8cc0ef8 100644
break;
#ifndef SHARED
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0022-eglibc-Resolve-__fpscr_values-on-SH4.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0022-eglibc-Resolve-__fpscr_values-on-SH4.patch
index f53f5ff87..c0cd5b0d1 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0022-eglibc-Resolve-__fpscr_values-on-SH4.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0022-eglibc-Resolve-__fpscr_values-on-SH4.patch
@@ -1,7 +1,7 @@
-From 8904f4249c930d187e19c7e9d3e73c835d11e18f Mon Sep 17 00:00:00 2001
+From a50c6e80543fb4cbc589978c11fe846bf4a94492 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 22/25] eglibc: Resolve __fpscr_values on SH4
+Subject: [PATCH 22/26] eglibc: Resolve __fpscr_values on SH4
2010-09-29 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Andrew Stubbs <ams@codesourcery.com>
@@ -52,5 +52,5 @@ index 0024d79..d1db7e4 100644
+weak_alias (___fpscr_values, __fpscr_values)
+
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0023-eglibc-Install-PIC-archives.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0023-eglibc-Install-PIC-archives.patch
index f985f3ca1..c3e571f8a 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0023-eglibc-Install-PIC-archives.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0023-eglibc-Install-PIC-archives.patch
@@ -1,7 +1,7 @@
-From 1947f211fab4001e84bb52868cddbd401e597889 Mon Sep 17 00:00:00 2001
+From 101568daf48d99e71b280a2fdd85460fe740d583 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 01:57:01 +0000
-Subject: [PATCH 23/25] eglibc: Install PIC archives
+Subject: [PATCH 23/26] eglibc: Install PIC archives
Forward port from eglibc
@@ -29,10 +29,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 file changed, 40 insertions(+), 2 deletions(-)
diff --git a/Makerules b/Makerules
-index 53eabfa..1cd2a53 100644
+index 61a0240..373e628 100644
--- a/Makerules
+++ b/Makerules
-@@ -694,6 +694,9 @@ ifeq ($(build-shared),yes)
+@@ -762,6 +762,9 @@ ifeq ($(build-shared),yes)
$(common-objpfx)libc.so: $(common-objpfx)libc.map
endif
common-generated += libc.so libc_pic.os
@@ -42,7 +42,7 @@ index 53eabfa..1cd2a53 100644
ifdef libc.so-version
$(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
$(make-link)
-@@ -936,6 +939,7 @@ endif
+@@ -1004,6 +1007,7 @@ endif
install: check-install-supported
@@ -50,7 +50,7 @@ index 53eabfa..1cd2a53 100644
install: $(installed-libcs)
$(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
$(make-target-directory)
-@@ -964,6 +968,22 @@ versioned := $(strip $(foreach so,$(install-lib.so),\
+@@ -1032,6 +1036,22 @@ versioned := $(strip $(foreach so,$(install-lib.so),\
install-lib.so-versioned := $(filter $(versioned), $(install-lib.so))
install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))
@@ -73,7 +73,7 @@ index 53eabfa..1cd2a53 100644
# For versioned libraries, we install three files:
# $(inst_libdir)/libfoo.so -- for linking, symlink or ld script
# $(inst_slibdir)/libfoo.so.NN -- for loading by SONAME, symlink
-@@ -1206,9 +1226,22 @@ $(addprefix $(inst_includedir)/,$(headers-nonh)): $(inst_includedir)/%: \
+@@ -1275,9 +1295,22 @@ $(addprefix $(inst_includedir)/,$(headers-nonh)): $(inst_includedir)/%: \
endif # headers-nonh
endif # headers
@@ -97,7 +97,7 @@ index 53eabfa..1cd2a53 100644
install-bin-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin))
install-bin-script-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin-script))
install-rootsbin-nosubdir: \
-@@ -1221,6 +1254,10 @@ install-data-nosubdir: $(addprefix $(inst_datadir)/,$(install-data))
+@@ -1290,6 +1323,10 @@ install-data-nosubdir: $(addprefix $(inst_datadir)/,$(install-data))
install-headers-nosubdir: $(addprefix $(inst_includedir)/,$(headers))
install-others-nosubdir: $(install-others)
install-others-programs-nosubdir: $(install-others-programs)
@@ -108,7 +108,7 @@ index 53eabfa..1cd2a53 100644
# We need all the `-nosubdir' targets so that `install' in the parent
# doesn't depend on several things which each iterate over the subdirs.
-@@ -1230,7 +1267,8 @@ install-%:: install-%-nosubdir ;
+@@ -1299,7 +1336,8 @@ install-%:: install-%-nosubdir ;
.PHONY: install install-no-libc.a-nosubdir
install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir \
@@ -119,5 +119,5 @@ index 53eabfa..1cd2a53 100644
install-no-libc.a-nosubdir: install-bin-nosubdir install-bin-script-nosubdir \
install-rootsbin-nosubdir install-sbin-nosubdir \
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0024-eglibc-Forward-port-cross-locale-generation-support.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0024-eglibc-Forward-port-cross-locale-generation-support.patch
index c45b557ab..3399890de 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0024-eglibc-Forward-port-cross-locale-generation-support.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0024-eglibc-Forward-port-cross-locale-generation-support.patch
@@ -1,7 +1,7 @@
-From 11d7633178301add26a24657e2f1596a2f7dddce Mon Sep 17 00:00:00 2001
+From 82516e3ed372f618c886a2de4f9498f597aa8a8b 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 24/25] eglibc: Forward port cross locale generation support
+Subject: [PATCH 24/26] eglibc: Forward port cross locale generation support
Upstream-Status: Pending
@@ -91,7 +91,7 @@ index 0000000..9fad357
+ [LC_ALL] = sizeof ("LC_ALL") - 1
+ };
diff --git a/locale/localeinfo.h b/locale/localeinfo.h
-index 94627f3..d0db77b 100644
+index 1f4da92..7f68935 100644
--- a/locale/localeinfo.h
+++ b/locale/localeinfo.h
@@ -224,7 +224,7 @@ __libc_tsd_define (extern, __locale_t, LOCALE)
@@ -363,10 +363,10 @@ index b885f65..0afb631 100644
size_t bufmax = 56;
diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
-index 6becd9a..8ddd080 100644
+index b4c48f1..ed08d48 100644
--- a/locale/programs/localedef.c
+++ b/locale/programs/localedef.c
-@@ -114,6 +114,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
+@@ -108,6 +108,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
#define OPT_LIST_ARCHIVE 309
#define OPT_LITTLE_ENDIAN 400
#define OPT_BIG_ENDIAN 401
@@ -374,7 +374,7 @@ index 6becd9a..8ddd080 100644
/* Definitions of arguments for argp functions. */
static const struct argp_option options[] =
-@@ -150,6 +151,8 @@ static const struct argp_option options[] =
+@@ -143,6 +144,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 +383,7 @@ index 6becd9a..8ddd080 100644
{ NULL, 0, NULL, 0, NULL }
};
-@@ -239,12 +242,14 @@ main (int argc, char *argv[])
+@@ -232,12 +235,14 @@ main (int argc, char *argv[])
ctype locale. (P1003.2 4.35.5.2) */
setlocale (LC_CTYPE, "POSIX");
@@ -398,7 +398,7 @@ index 6becd9a..8ddd080 100644
/* Process charmap file. */
charmap = charmap_read (charmap_file, verbose, 1, be_quiet, 1);
-@@ -338,6 +343,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
+@@ -328,6 +333,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
case OPT_BIG_ENDIAN:
set_big_endian (true);
break;
@@ -562,5 +562,5 @@ index 69b3141..1cef0be 100644
# define WEAK_POSTLOAD(postload) weak_extern (postload)
#else
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0025-Define-DUMMY_LOCALE_T-if-not-defined.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0025-Define-DUMMY_LOCALE_T-if-not-defined.patch
index 9d60d0282..1f0f5d4da 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0025-Define-DUMMY_LOCALE_T-if-not-defined.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0025-Define-DUMMY_LOCALE_T-if-not-defined.patch
@@ -1,7 +1,7 @@
-From 89ec25290d34413ce5c8ba6c378e31dbae3a37c0 Mon Sep 17 00:00:00 2001
+From c2d8cdeab116caacdfedb35eeb3e743b44807bec 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 25/25] Define DUMMY_LOCALE_T if not defined
+Subject: [PATCH 25/26] Define DUMMY_LOCALE_T if not defined
This is a hack to fix building the locale bits on an older
CentOs 5.X machine
@@ -28,5 +28,5 @@ index f606365..0e5f8c3 100644
#define PACKAGE _libc_intl_domainname
#ifndef VERSION
--
-2.8.2
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0026-build_local_scope.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch
index 8e0cb8319..852f5304c 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0026-build_local_scope.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch
@@ -1,7 +1,7 @@
-From 6e4ec5a3c5fe63b6458036f18d43124de4a7e724 Mon Sep 17 00:00:00 2001
+From fb315c197cca61299a6f6588ea3460145c255d06 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
+Subject: [PATCH 26/26] elf/dl-deps.c: Make _dl_build_local_scope breadth first
According to the ELF specification:
@@ -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 6a82987..fc37c87 100644
+index 6a82987..53be824 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)
@@ -52,5 +52,5 @@ index 6a82987..fc37c87 100644
}
--
-2.5.5
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0001-locale-fix-hard-coded-reference-to-gcc-E.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0027-locale-fix-hard-coded-reference-to-gcc-E.patch
index d5fce7371..71c0bdcae 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0001-locale-fix-hard-coded-reference-to-gcc-E.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0027-locale-fix-hard-coded-reference-to-gcc-E.patch
@@ -1,30 +1,29 @@
-From 2c0ab83eb54c0e0fccbf261726dc03803b236079 Mon Sep 17 00:00:00 2001
+From a2fc86cb8d0366171f100ebd033aeb9609fa40de 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
+Subject: [PATCH 27/27] locale: fix hard-coded reference to gcc -E
-When new version of compilers are published, they may not be compatible with
+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.
+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 30d3f2f..7b287fa 100644
+index 30d3f2f..e976530 100644
--- a/locale/gen-translit.pl
+++ b/locale/gen-translit.pl
@@ -1,5 +1,5 @@
@@ -35,5 +34,5 @@ index 30d3f2f..7b287fa 100644
sub cstrlen {
--
-2.9.3
+2.10.2
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0028-Bug-20116-Fix-use-after-free-in-pthread_create.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0028-Bug-20116-Fix-use-after-free-in-pthread_create.patch
deleted file mode 100644
index 66f1fcd0f..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0028-Bug-20116-Fix-use-after-free-in-pthread_create.patch
+++ /dev/null
@@ -1,668 +0,0 @@
-From e7ba24f05d86acf7072e066ea6d7b235a106688c Mon Sep 17 00:00:00 2001
-From: Carlos O'Donell <carlos@redhat.com>
-Date: Sat, 28 Jan 2017 19:13:34 -0500
-Subject: [PATCH] Bug 20116: Fix use after free in pthread_create()
-
-The commit documents the ownership rules around 'struct pthread' and
-when a thread can read or write to the descriptor. With those ownership
-rules in place it becomes obvious that pd->stopped_start should not be
-touched in several of the paths during thread startup, particularly so
-for detached threads. In the case of detached threads, between the time
-the thread is created by the OS kernel and the creating thread checks
-pd->stopped_start, the detached thread might have already exited and the
-memory for pd unmapped. As a regression test we add a simple test which
-exercises this exact case by quickly creating detached threads with
-large enough stacks to ensure the thread stack cache is bypassed and the
-stacks are unmapped. Before the fix the testcase segfaults, after the
-fix it works correctly and completes without issue.
-
-For a detailed discussion see:
-https://www.sourceware.org/ml/libc-alpha/2017-01/msg00505.html
-
-(cherry-picked from commit f8bf15febcaf137bbec5a61101e88cd5a9d56ca8)
-
-Upstream-Status: Backport [master]
-Signed-off-by: Yuanjie Huang <yuanjie.huang@windriver.com>
----
- ChangeLog | 23 ++++
- nptl/Makefile | 3 +-
- nptl/createthread.c | 10 +-
- nptl/pthread_create.c | 207 +++++++++++++++++++++++++++------
- nptl/pthread_getschedparam.c | 1 +
- nptl/pthread_setschedparam.c | 1 +
- nptl/pthread_setschedprio.c | 1 +
- nptl/tpp.c | 2 +
- nptl/tst-create-detached.c | 137 ++++++++++++++++++++++
- sysdeps/nacl/createthread.c | 10 +-
- sysdeps/unix/sysv/linux/createthread.c | 16 ++-
- 11 files changed, 356 insertions(+), 55 deletions(-)
- create mode 100644 nptl/tst-create-detached.c
-
-diff --git a/ChangeLog b/ChangeLog
-index 84ae7a7af8..0fbda9020e 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,3 +1,26 @@
-+2016-01-28 Carlos O'Donell <carlos@redhat.com>
-+ Alexey Makhalov <amakhalov@vmware.com>
-+ Florian Weimer <fweimer@redhat.com>
-+
-+ [BZ #20116]
-+ * nptl/pthread_create.c: Document concurrency notes.
-+ Enhance thread creation notes.
-+ (create_thread): Use bool *stopped_start.
-+ (START_THREAD_DEFN): Comment ownership of PD.
-+ (__pthread_create_2_1): Add local bool stopped_start and use
-+ that instead of pd->stopped_start where appropriate.
-+ * nptl/createthread.c (create_thread): Use bool *stopped_start.
-+ * sysdeps/nacl/createthread.c (create_thread): Use bool *stopped_start.
-+ * sysdeps/unix/sysv/linux/createthread.c (create_thread): Likewise.
-+ * nptl/tst-create-detached.c: New file.
-+ * nptl/Makefile (tests): Add tst-create-detached.
-+ * nptl/pthread_getschedparam.c (__pthread_getschedparam):
-+ Reference the enhanced thread creation notes.
-+ * nptl/pthread_setschedparam.c (__pthread_setschedparam): Likewise.
-+ * nptl/pthread_setschedprio.c (pthread_setschedprio): Likewise.
-+ * nptl/tpp.c (__pthread_tpp_change_priority): Likewise.
-+ (__pthread_current_priority): Likewise.
-+
- 2016-08-04 Carlos O'Donell <carlos@redhat.com>
-
- * po/de.po: Update from Translation Project.
-diff --git a/nptl/Makefile b/nptl/Makefile
-index 0d8aadebed..7dec4edb53 100644
---- a/nptl/Makefile
-+++ b/nptl/Makefile
-@@ -290,7 +290,8 @@ tests = tst-typesizes \
- tst-initializers1 $(addprefix tst-initializers1-,\
- c89 gnu89 c99 gnu99 c11 gnu11) \
- tst-bad-schedattr \
-- tst-thread_local1 tst-mutex-errorcheck tst-robust10
-+ tst-thread_local1 tst-mutex-errorcheck tst-robust10 \
-+ tst-create-detached \
- xtests = tst-setuid1 tst-setuid1-static tst-setuid2 \
- tst-mutexpp1 tst-mutexpp6 tst-mutexpp10
- test-srcs = tst-oddstacklimit
-diff --git a/nptl/createthread.c b/nptl/createthread.c
-index ba2f9c7167..328f85865d 100644
---- a/nptl/createthread.c
-+++ b/nptl/createthread.c
-@@ -25,16 +25,14 @@
-
- static int
- create_thread (struct pthread *pd, const struct pthread_attr *attr,
-- bool stopped_start, STACK_VARIABLES_PARMS, bool *thread_ran)
-+ bool *stopped_start, STACK_VARIABLES_PARMS, bool *thread_ran)
- {
- /* If the implementation needs to do some tweaks to the thread after
- it has been created at the OS level, it can set STOPPED_START here. */
-
-- pd->stopped_start = stopped_start;
-- if (__glibc_unlikely (stopped_start))
-- /* We make sure the thread does not run far by forcing it to get a
-- lock. We lock it here too so that the new thread cannot continue
-- until we tell it to. */
-+ pd->stopped_start = *stopped_start;
-+ if (__glibc_unlikely (*stopped_start))
-+ /* See CONCURRENCY NOTES in nptl/pthread_create.c. */
- lll_lock (pd->lock, LLL_PRIVATE);
-
- return ENOSYS;
-diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
-index a834063ad5..44b17bec86 100644
---- a/nptl/pthread_create.c
-+++ b/nptl/pthread_create.c
-@@ -54,25 +54,141 @@ unsigned int __nptl_nthreads = 1;
- /* Code to allocate and deallocate a stack. */
- #include "allocatestack.c"
-
--/* createthread.c defines this function, and two macros:
-+/* CONCURRENCY NOTES:
-+
-+ Understanding who is the owner of the 'struct pthread' or 'PD'
-+ (refers to the value of the 'struct pthread *pd' function argument)
-+ is critically important in determining exactly which operations are
-+ allowed and which are not and when, particularly when it comes to the
-+ implementation of pthread_create, pthread_join, pthread_detach, and
-+ other functions which all operate on PD.
-+
-+ The owner of PD is responsible for freeing the final resources
-+ associated with PD, and may examine the memory underlying PD at any
-+ point in time until it frees it back to the OS or to reuse by the
-+ runtime.
-+
-+ The thread which calls pthread_create is called the creating thread.
-+ The creating thread begins as the owner of PD.
-+
-+ During startup the new thread may examine PD in coordination with the
-+ owner thread (which may be itself).
-+
-+ The four cases of ownership transfer are:
-+
-+ (1) Ownership of PD is released to the process (all threads may use it)
-+ after the new thread starts in a joinable state
-+ i.e. pthread_create returns a usable pthread_t.
-+
-+ (2) Ownership of PD is released to the new thread starting in a detached
-+ state.
-+
-+ (3) Ownership of PD is dynamically released to a running thread via
-+ pthread_detach.
-+
-+ (4) Ownership of PD is acquired by the thread which calls pthread_join.
-+
-+ Implementation notes:
-+
-+ The PD->stopped_start and thread_ran variables are used to determine
-+ exactly which of the four ownership states we are in and therefore
-+ what actions can be taken. For example after (2) we cannot read or
-+ write from PD anymore since the thread may no longer exist and the
-+ memory may be unmapped. The most complicated cases happen during
-+ thread startup:
-+
-+ (a) If the created thread is in a detached (PTHREAD_CREATE_DETACHED),
-+ or joinable (default PTHREAD_CREATE_JOINABLE) state and
-+ STOPPED_START is true, then the creating thread has ownership of
-+ PD until the PD->lock is released by pthread_create. If any
-+ errors occur we are in states (c), (d), or (e) below.
-+
-+ (b) If the created thread is in a detached state
-+ (PTHREAD_CREATED_DETACHED), and STOPPED_START is false, then the
-+ creating thread has ownership of PD until it invokes the OS
-+ kernel's thread creation routine. If this routine returns
-+ without error, then the created thread owns PD; otherwise, see
-+ (c) and (e) below.
-+
-+ (c) If the detached thread setup failed and THREAD_RAN is true, then
-+ the creating thread releases ownership to the new thread by
-+ sending a cancellation signal. All threads set THREAD_RAN to
-+ true as quickly as possible after returning from the OS kernel's
-+ thread creation routine.
-+
-+ (d) If the joinable thread setup failed and THREAD_RAN is true, then
-+ then the creating thread retains ownership of PD and must cleanup
-+ state. Ownership cannot be released to the process via the
-+ return of pthread_create since a non-zero result entails PD is
-+ undefined and therefore cannot be joined to free the resources.
-+ We privately call pthread_join on the thread to finish handling
-+ the resource shutdown (Or at least we should, see bug 19511).
-+
-+ (e) If the thread creation failed and THREAD_RAN is false, then the
-+ creating thread retains ownership of PD and must cleanup state.
-+ No waiting for the new thread is required because it never
-+ started.
-+
-+ The nptl_db interface:
-+
-+ The interface with nptl_db requires that we enqueue PD into a linked
-+ list and then call a function which the debugger will trap. The PD
-+ will then be dequeued and control returned to the thread. The caller
-+ at the time must have ownership of PD and such ownership remains
-+ after control returns to thread. The enqueued PD is removed from the
-+ linked list by the nptl_db callback td_thr_event_getmsg. The debugger
-+ must ensure that the thread does not resume execution, otherwise
-+ ownership of PD may be lost and examining PD will not be possible.
-+
-+ Note that the GNU Debugger as of (December 10th 2015) commit
-+ c2c2a31fdb228d41ce3db62b268efea04bd39c18 no longer uses
-+ td_thr_event_getmsg and several other related nptl_db interfaces. The
-+ principal reason for this is that nptl_db does not support non-stop
-+ mode where other threads can run concurrently and modify runtime
-+ structures currently in use by the debugger and the nptl_db
-+ interface.
-+
-+ Axioms:
-+
-+ * The create_thread function can never set stopped_start to false.
-+ * The created thread can read stopped_start but never write to it.
-+ * The variable thread_ran is set some time after the OS thread
-+ creation routine returns, how much time after the thread is created
-+ is unspecified, but it should be as quickly as possible.
-+
-+*/
-+
-+/* CREATE THREAD NOTES:
-+
-+ createthread.c defines the create_thread function, and two macros:
- START_THREAD_DEFN and START_THREAD_SELF (see below).
-
-- create_thread is obliged to initialize PD->stopped_start. It
-- should be true if the STOPPED_START parameter is true, or if
-- create_thread needs the new thread to synchronize at startup for
-- some other implementation reason. If PD->stopped_start will be
-- true, then create_thread is obliged to perform the operation
-- "lll_lock (PD->lock, LLL_PRIVATE)" before starting the thread.
-+ create_thread must initialize PD->stopped_start. It should be true
-+ if the STOPPED_START parameter is true, or if create_thread needs the
-+ new thread to synchronize at startup for some other implementation
-+ reason. If STOPPED_START will be true, then create_thread is obliged
-+ to lock PD->lock before starting the thread. Then pthread_create
-+ unlocks PD->lock which synchronizes-with START_THREAD_DEFN in the
-+ child thread which does an acquire/release of PD->lock as the last
-+ action before calling the user entry point. The goal of all of this
-+ is to ensure that the required initial thread attributes are applied
-+ (by the creating thread) before the new thread runs user code. Note
-+ that the the functions pthread_getschedparam, pthread_setschedparam,
-+ pthread_setschedprio, __pthread_tpp_change_priority, and
-+ __pthread_current_priority reuse the same lock, PD->lock, for a
-+ similar purpose e.g. synchronizing the setting of similar thread
-+ attributes. These functions are never called before the thread is
-+ created, so don't participate in startup syncronization, but given
-+ that the lock is present already and in the unlocked state, reusing
-+ it saves space.
-
- The return value is zero for success or an errno code for failure.
- If the return value is ENOMEM, that will be translated to EAGAIN,
- so create_thread need not do that. On failure, *THREAD_RAN should
- be set to true iff the thread actually started up and then got
-- cancelled before calling user code (*PD->start_routine), in which
-- case it is responsible for doing its own cleanup. */
--
-+ canceled before calling user code (*PD->start_routine). */
- static int create_thread (struct pthread *pd, const struct pthread_attr *attr,
-- bool stopped_start, STACK_VARIABLES_PARMS,
-+ bool *stopped_start, STACK_VARIABLES_PARMS,
- bool *thread_ran);
-
- #include <createthread.c>
-@@ -314,12 +430,19 @@ START_THREAD_DEFN
- /* Store the new cleanup handler info. */
- THREAD_SETMEM (pd, cleanup_jmp_buf, &unwind_buf);
-
-+ /* We are either in (a) or (b), and in either case we either own
-+ PD already (2) or are about to own PD (1), and so our only
-+ restriction would be that we can't free PD until we know we
-+ have ownership (see CONCURRENCY NOTES above). */
- if (__glibc_unlikely (pd->stopped_start))
- {
- int oldtype = CANCEL_ASYNC ();
-
- /* Get the lock the parent locked to force synchronization. */
- lll_lock (pd->lock, LLL_PRIVATE);
-+
-+ /* We have ownership of PD now. */
-+
- /* And give it up right away. */
- lll_unlock (pd->lock, LLL_PRIVATE);
-
-@@ -378,7 +501,8 @@ START_THREAD_DEFN
- pd, pd->nextevent));
- }
-
-- /* Now call the function to signal the event. */
-+ /* Now call the function which signals the event. See
-+ CONCURRENCY NOTES for the nptl_db interface comments. */
- __nptl_death_event ();
- }
- }
-@@ -642,19 +766,28 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr,
- that cares whether the thread count is correct. */
- atomic_increment (&__nptl_nthreads);
-
-- bool thread_ran = false;
-+ /* Our local value of stopped_start and thread_ran can be accessed at
-+ any time. The PD->stopped_start may only be accessed if we have
-+ ownership of PD (see CONCURRENCY NOTES above). */
-+ bool stopped_start = false; bool thread_ran = false;
-
- /* Start the thread. */
- if (__glibc_unlikely (report_thread_creation (pd)))
- {
-- /* Create the thread. We always create the thread stopped
-- so that it does not get far before we tell the debugger. */
-- retval = create_thread (pd, iattr, true, STACK_VARIABLES_ARGS,
-- &thread_ran);
-+ stopped_start = true;
-+
-+ /* We always create the thread stopped at startup so we can
-+ notify the debugger. */
-+ retval = create_thread (pd, iattr, &stopped_start,
-+ STACK_VARIABLES_ARGS, &thread_ran);
- if (retval == 0)
- {
-- /* create_thread should have set this so that the logic below can
-- test it. */
-+ /* We retain ownership of PD until (a) (see CONCURRENCY NOTES
-+ above). */
-+
-+ /* Assert stopped_start is true in both our local copy and the
-+ PD copy. */
-+ assert (stopped_start);
- assert (pd->stopped_start);
-
- /* Now fill in the information about the new thread in
-@@ -671,26 +804,30 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr,
- pd, pd->nextevent)
- != 0);
-
-- /* Now call the function which signals the event. */
-+ /* Now call the function which signals the event. See
-+ CONCURRENCY NOTES for the nptl_db interface comments. */
- __nptl_create_event ();
- }
- }
- else
-- retval = create_thread (pd, iattr, false, STACK_VARIABLES_ARGS,
-- &thread_ran);
-+ retval = create_thread (pd, iattr, &stopped_start,
-+ STACK_VARIABLES_ARGS, &thread_ran);
-
- if (__glibc_unlikely (retval != 0))
- {
-- /* If thread creation "failed", that might mean that the thread got
-- created and ran a little--short of running user code--but then
-- create_thread cancelled it. In that case, the thread will do all
-- its own cleanup just like a normal thread exit after a successful
-- creation would do. */
--
- if (thread_ran)
-- assert (pd->stopped_start);
-+ /* State (c) or (d) and we may not have PD ownership (see
-+ CONCURRENCY NOTES above). We can assert that STOPPED_START
-+ must have been true because thread creation didn't fail, but
-+ thread attribute setting did. */
-+ /* See bug 19511 which explains why doing nothing here is a
-+ resource leak for a joinable thread. */
-+ assert (stopped_start);
- else
- {
-+ /* State (e) and we have ownership of PD (see CONCURRENCY
-+ NOTES above). */
-+
- /* Oops, we lied for a second. */
- atomic_decrement (&__nptl_nthreads);
-
-@@ -710,10 +847,14 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr,
- }
- else
- {
-- if (pd->stopped_start)
-- /* The thread blocked on this lock either because we're doing TD_CREATE
-- event reporting, or for some other reason that create_thread chose.
-- Now let it run free. */
-+ /* We don't know if we have PD ownership. Once we check the local
-+ stopped_start we'll know if we're in state (a) or (b) (see
-+ CONCURRENCY NOTES above). */
-+ if (stopped_start)
-+ /* State (a), we own PD. The thread blocked on this lock either
-+ because we're doing TD_CREATE event reporting, or for some
-+ other reason that create_thread chose. Now let it run
-+ free. */
- lll_unlock (pd->lock, LLL_PRIVATE);
-
- /* We now have for sure more than one thread. The main thread might
-diff --git a/nptl/pthread_getschedparam.c b/nptl/pthread_getschedparam.c
-index b887881baf..de71171a08 100644
---- a/nptl/pthread_getschedparam.c
-+++ b/nptl/pthread_getschedparam.c
-@@ -35,6 +35,7 @@ __pthread_getschedparam (pthread_t threadid, int *policy,
-
- int result = 0;
-
-+ /* See CREATE THREAD NOTES in nptl/pthread_create.c. */
- lll_lock (pd->lock, LLL_PRIVATE);
-
- /* The library is responsible for maintaining the values at all
-diff --git a/nptl/pthread_setschedparam.c b/nptl/pthread_setschedparam.c
-index dfb52b9dbf..dcb520f1c8 100644
---- a/nptl/pthread_setschedparam.c
-+++ b/nptl/pthread_setschedparam.c
-@@ -36,6 +36,7 @@ __pthread_setschedparam (pthread_t threadid, int policy,
-
- int result = 0;
-
-+ /* See CREATE THREAD NOTES in nptl/pthread_create.c. */
- lll_lock (pd->lock, LLL_PRIVATE);
-
- struct sched_param p;
-diff --git a/nptl/pthread_setschedprio.c b/nptl/pthread_setschedprio.c
-index cefc6481d6..8134b50560 100644
---- a/nptl/pthread_setschedprio.c
-+++ b/nptl/pthread_setschedprio.c
-@@ -38,6 +38,7 @@ pthread_setschedprio (pthread_t threadid, int prio)
- struct sched_param param;
- param.sched_priority = prio;
-
-+ /* See CREATE THREAD NOTES in nptl/pthread_create.c. */
- lll_lock (pd->lock, LLL_PRIVATE);
-
- /* If the thread should have higher priority because of some
-diff --git a/nptl/tpp.c b/nptl/tpp.c
-index e175bf4d53..223bd6bbee 100644
---- a/nptl/tpp.c
-+++ b/nptl/tpp.c
-@@ -114,6 +114,7 @@ __pthread_tpp_change_priority (int previous_prio, int new_prio)
- if (priomax == newpriomax)
- return 0;
-
-+ /* See CREATE THREAD NOTES in nptl/pthread_create.c. */
- lll_lock (self->lock, LLL_PRIVATE);
-
- tpp->priomax = newpriomax;
-@@ -165,6 +166,7 @@ __pthread_current_priority (void)
-
- int result = 0;
-
-+ /* See CREATE THREAD NOTES in nptl/pthread_create.c. */
- lll_lock (self->lock, LLL_PRIVATE);
-
- if ((self->flags & ATTR_FLAG_SCHED_SET) == 0)
-diff --git a/nptl/tst-create-detached.c b/nptl/tst-create-detached.c
-new file mode 100644
-index 0000000000..ea93e441c7
---- /dev/null
-+++ b/nptl/tst-create-detached.c
-@@ -0,0 +1,137 @@
-+/* Bug 20116: Test rapid creation of detached threads.
-+ Copyright (C) 2017 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; see the file COPYING.LIB. If
-+ not, see <http://www.gnu.org/licenses/>. */
-+
-+/* The goal of the test is to trigger a failure if the parent touches
-+ any part of the thread descriptor after the detached thread has
-+ exited. We test this by creating many detached threads with large
-+ stacks. The stacks quickly fill the the stack cache and subsequent
-+ threads will start to cause the thread stacks to be immediately
-+ unmapped to satisfy the stack cache max. With the stacks being
-+ unmapped the parent's read of any part of the thread descriptor will
-+ trigger a segfault. That segfault is what we are trying to cause,
-+ since any segfault is a defect in the implementation. */
-+
-+#include <pthread.h>
-+#include <stdio.h>
-+#include <errno.h>
-+#include <unistd.h>
-+#include <stdbool.h>
-+#include <sys/resource.h>
-+#include <support/xthread.h>
-+
-+/* Number of threads to create. */
-+enum { threads_to_create = 100000 };
-+
-+/* Number of threads which should spawn other threads. */
-+enum { creator_threads = 2 };
-+
-+/* Counter of threads created so far. This is incremented by all the
-+ running creator threads. */
-+static unsigned threads_created;
-+
-+/* Thread callback which does nothing, so that the thread exits
-+ immediatedly. */
-+static void *
-+do_nothing (void *arg)
-+{
-+ return NULL;
-+}
-+
-+/* Attribute indicating that the thread should be created in a detached
-+ fashion. */
-+static pthread_attr_t detached;
-+
-+/* Barrier to synchronize initialization. */
-+static pthread_barrier_t barrier;
-+
-+static void *
-+creator_thread (void *arg)
-+{
-+ int ret;
-+ xpthread_barrier_wait (&barrier);
-+
-+ while (true)
-+ {
-+ pthread_t thr;
-+ /* Thread creation will fail if the kernel does not free old
-+ threads quickly enough, so we do not report errors. */
-+ ret = pthread_create (&thr, &detached, do_nothing, NULL);
-+ if (ret == 0 && __atomic_add_fetch (&threads_created, 1, __ATOMIC_SEQ_CST)
-+ >= threads_to_create)
-+ break;
-+ }
-+
-+ return NULL;
-+}
-+
-+static int
-+do_test (void)
-+{
-+ /* Limit the size of the process, so that memory allocation will
-+ fail without impacting the entire system. */
-+ {
-+ struct rlimit limit;
-+ if (getrlimit (RLIMIT_AS, &limit) != 0)
-+ {
-+ printf ("FAIL: getrlimit (RLIMIT_AS) failed: %m\n");
-+ return 1;
-+ }
-+ /* This limit, 800MB, is just a heuristic. Any value can be
-+ picked. */
-+ long target = 800 * 1024 * 1024;
-+ if (limit.rlim_cur == RLIM_INFINITY || limit.rlim_cur > target)
-+ {
-+ limit.rlim_cur = target;
-+ if (setrlimit (RLIMIT_AS, &limit) != 0)
-+ {
-+ printf ("FAIL: setrlimit (RLIMIT_AS) failed: %m\n");
-+ return 1;
-+ }
-+ }
-+ }
-+
-+ xpthread_attr_init (&detached);
-+
-+ xpthread_attr_setdetachstate (&detached, PTHREAD_CREATE_DETACHED);
-+
-+ /* A large thread stack seems beneficial for reproducing a race
-+ condition in detached thread creation. The goal is to reach the
-+ limit of the runtime thread stack cache such that the detached
-+ thread's stack is unmapped after exit and causes a segfault when
-+ the parent reads the thread descriptor data stored on the the
-+ unmapped stack. */
-+ xpthread_attr_setstacksize (&detached, 16 * 1024 * 1024);
-+
-+ xpthread_barrier_init (&barrier, NULL, creator_threads);
-+
-+ pthread_t threads[creator_threads];
-+
-+ for (int i = 0; i < creator_threads; ++i)
-+ threads[i] = xpthread_create (NULL, creator_thread, NULL);
-+
-+ for (int i = 0; i < creator_threads; ++i)
-+ xpthread_join (threads[i]);
-+
-+ xpthread_attr_destroy (&detached);
-+
-+ xpthread_barrier_destroy (&barrier);
-+
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
-diff --git a/sysdeps/nacl/createthread.c b/sysdeps/nacl/createthread.c
-index 7b571c34e2..5465558cc1 100644
---- a/sysdeps/nacl/createthread.c
-+++ b/sysdeps/nacl/createthread.c
-@@ -32,15 +32,13 @@ static void start_thread (void) __attribute__ ((noreturn));
-
- static int
- create_thread (struct pthread *pd, const struct pthread_attr *attr,
-- bool stopped_start, STACK_VARIABLES_PARMS, bool *thread_ran)
-+ bool *stopped_start, STACK_VARIABLES_PARMS, bool *thread_ran)
- {
- pd->tid = __nacl_get_tid (pd);
-
-- pd->stopped_start = stopped_start;
-- if (__glibc_unlikely (stopped_start))
-- /* We make sure the thread does not run far by forcing it to get a
-- lock. We lock it here too so that the new thread cannot continue
-- until we tell it to. */
-+ pd->stopped_start = *stopped_start;
-+ if (__glibc_unlikely (*stopped_start))
-+ /* See CONCURRENCY NOTES in nptl/pthread_create.c. */
- lll_lock (pd->lock, LLL_PRIVATE);
-
- TLS_DEFINE_INIT_TP (tp, pd);
-diff --git a/sysdeps/unix/sysv/linux/createthread.c b/sysdeps/unix/sysv/linux/createthread.c
-index 6d32cece48..66ddae61d4 100644
---- a/sysdeps/unix/sysv/linux/createthread.c
-+++ b/sysdeps/unix/sysv/linux/createthread.c
-@@ -46,7 +46,7 @@ static int start_thread (void *arg) __attribute__ ((noreturn));
-
- static int
- create_thread (struct pthread *pd, const struct pthread_attr *attr,
-- bool stopped_start, STACK_VARIABLES_PARMS, bool *thread_ran)
-+ bool *stopped_start, STACK_VARIABLES_PARMS, bool *thread_ran)
- {
- /* Determine whether the newly created threads has to be started
- stopped since we have to set the scheduling parameters or set the
-@@ -54,13 +54,11 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr,
- if (attr != NULL
- && (__glibc_unlikely (attr->cpuset != NULL)
- || __glibc_unlikely ((attr->flags & ATTR_FLAG_NOTINHERITSCHED) != 0)))
-- stopped_start = true;
-+ *stopped_start = true;
-
-- pd->stopped_start = stopped_start;
-- if (__glibc_unlikely (stopped_start))
-- /* We make sure the thread does not run far by forcing it to get a
-- lock. We lock it here too so that the new thread cannot continue
-- until we tell it to. */
-+ pd->stopped_start = *stopped_start;
-+ if (__glibc_unlikely (*stopped_start))
-+ /* See CONCURRENCY NOTES in nptl/pthread_creat.c. */
- lll_lock (pd->lock, LLL_PRIVATE);
-
- /* We rely heavily on various flags the CLONE function understands:
-@@ -117,7 +115,7 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr,
- /* Set the affinity mask if necessary. */
- if (attr->cpuset != NULL)
- {
-- assert (stopped_start);
-+ assert (*stopped_start);
-
- res = INTERNAL_SYSCALL (sched_setaffinity, err, 3, pd->tid,
- attr->cpusetsize, attr->cpuset);
-@@ -140,7 +138,7 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr,
- /* Set the scheduling parameters. */
- if ((attr->flags & ATTR_FLAG_NOTINHERITSCHED) != 0)
- {
-- assert (stopped_start);
-+ assert (*stopped_start);
-
- res = INTERNAL_SYSCALL (sched_setscheduler, err, 3, pd->tid,
- pd->schedpolicy, &pd->schedparam);
---
-2.11.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0028-Rework-fno-omit-frame-pointer-support-on-i386.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0028-Rework-fno-omit-frame-pointer-support-on-i386.patch
new file mode 100644
index 000000000..7ed2b902d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/0028-Rework-fno-omit-frame-pointer-support-on-i386.patch
@@ -0,0 +1,268 @@
+From 1ea003d4fccc4646fd1848a182405a1c7000ab18 Mon Sep 17 00:00:00 2001
+From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
+Date: Sun, 8 Jan 2017 11:38:23 -0200
+Subject: [PATCH 28/28] Rework -fno-omit-frame-pointer support on i386
+
+Commit 6b1df8b27f fixed the -OS build issue on i386 (BZ#20729) by
+expliciting disabling frame pointer (-fomit-frame-pointer) on the
+faulty objects. Although it does fix the issue, it is a subpar
+workaround that adds complexity in build process (a rule for each
+object to add the required compiler option and pontentially more
+rules for objects that call {INLINE,INTERNAL}_SYSCALL) and does not
+allow the implementations to get all the possible debug/calltrack
+information possible (used mainly in debuggers and performance
+measurement tools).
+
+This patch fixes it by adding an explicit configure check to see
+if -fno-omit-frame-pointer is set and to act accordingly (set or
+not OPTIMIZE_FOR_GCC_5). The make rules is simplified and only
+one is required: to add libc-do-syscall on loader due mmap
+(which will be empty anyway for default build with
+-fomit-frame-pointer).
+
+Checked on i386-linux-gnu with GCC 6.2.1 with CFLAGS sets as
+'-Os', '-O2 -fno-omit-frame-pointer', and '-O2 -fomit-frame-pointer'.
+For '-Os' the testsuite issues described by BZ#19463 and BZ#15105
+still applied.
+
+It fixes BZ #21029, although it is marked as duplicated of #20729
+(I reopened to track this cleanup).
+
+ [BZ #21029]
+ * config.h.in [CAN_USE_REGISTER_ASM_EBP]: New define.
+ * sysdeps/unix/sysv/linux/i386/Makefile
+ [$(subdir) = elf] (sysdep-dl-routines): Add libc-do-syscall.
+ (uses-6-syscall-arguments): Remove.
+ [$(subdir) = misc] (CFLAGS-epoll_pwait.o): Likewise.
+ [$(subdir) = misc] (CFLAGS-epoll_pwait.os): Likewise.
+ [$(subdir) = misc] (CFLAGS-mmap.o): Likewise.
+ [$(subdir) = misc] (CFLAGS-mmap.os): Likewise.
+ [$(subdir) = misc] (CFLAGS-mmap64.o): Likewise.
+ [$(subdir) = misc] (CFLAGS-mmap64.os): Likewise.
+ [$(subdir) = misc] (CFLAGS-pselect.o): Likewise.
+ [$(subdir) = misc] (cflags-pselect.o): Likewise.
+ [$(subdir) = misc] (cflags-pselect.os): Likewise.
+ [$(subdir) = misc] (cflags-rtld-mmap.os): Likewise.
+ [$(subdir) = sysvipc] (cflags-semtimedop.o): Likewise.
+ [$(subdir) = sysvipc] (cflags-semtimedop.os): Likewise.
+ [$(subdir) = io] (CFLAGS-posix_fadvise64.o): Likewise.
+ [$(subdir) = io] (CFLAGS-posix_fadvise64.os): Likewise.
+ [$(subdir) = io] (CFLAGS-posix_fallocate.o): Likewise.
+ [$(subdir) = io] (CFLAGS-posix_fallocate.os): Likewise.
+ [$(subdir) = io] (CFLAGS-posix_fallocate64.o): Likewise.
+ [$(subdir) = io] (CFLAGS-posix_fallocate64.os): Likewise.
+ [$(subdir) = io] (CFLAGS-sync_file_range.o): Likewise.
+ [$(subdir) = io] (CFLAGS-sync_file_range.os): Likewise.
+ [$(subdir) = io] (CFLAGS-fallocate.o): Likewise.
+ [$(subdir) = io] (CFLAGS-fallocate.os): Likewise.
+ [$(subdir) = io] (CFLAGS-fallocate64.o): Likewise.
+ [$(subdir) = io] (CFLAGS-fallocate64.os): Likewise.
+ [$(subdir) = nptl] (CFLAGS-pthread_rwlock_timedrdlock.o):
+ Likewise.
+ [$(subdir) = nptl] (CFLAGS-pthread_rwlock_timedrdlock.os):
+ Likewise.
+ [$(subdir) = nptl] (CFLAGS-pthread_rwlock_timedrwlock.o):
+ Likewise.
+ [$(subdir) = nptl] (CFLAGS-pthread_rwlock_timedrwlock.os):
+ Likewise.
+ [$(subdir) = nptl] (CFLAGS-sem_wait.o): Likewise.
+ [$(subdir) = nptl] (CFLAGS-sem_wait.os): Likewise.
+ [$(subdir) = nptl] (CFLAGS-sem_timedwait.o): Likewise.
+ [$(subdir) = nptl] (CFLAGS-sem_timedwait.os): Likewise.
+ * sysdeps/unix/sysv/linux/i386/configure.ac: Add check if compiler allows
+ ebp on inline assembly.
+ * sysdeps/unix/sysv/linux/i386/configure: Regenerate.
+ * sysdeps/unix/sysv/linux/i386/sysdep.h (OPTIMIZE_FOR_GCC_5):
+ Set if CAN_USE_REGISTER_ASM_EBP is set.
+ (check_consistency): Likewise.
+
+Upstream-Status: Backport
+
+ https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=3b33d6ed6096c1d20d05a650b06026d673f7399a
+
+Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
+---
+ config.h.in | 4 ++++
+ sysdeps/unix/sysv/linux/i386/Makefile | 39 +------------------------------
+ sysdeps/unix/sysv/linux/i386/configure | 39 +++++++++++++++++++++++++++++++
+ sysdeps/unix/sysv/linux/i386/configure.ac | 17 ++++++++++++++
+ sysdeps/unix/sysv/linux/i386/sysdep.h | 6 ++---
+ 5 files changed, 64 insertions(+), 41 deletions(-)
+
+diff --git a/config.h.in b/config.h.in
+index 7bfe923..fb2cc51 100644
+--- a/config.h.in
++++ b/config.h.in
+@@ -259,4 +259,8 @@
+ /* Build glibc with tunables support. */
+ #define HAVE_TUNABLES 0
+
++/* Some compiler options may now allow to use ebp in __asm__ (used mainly
++ in i386 6 argument syscall issue). */
++#define CAN_USE_REGISTER_ASM_EBP 0
++
+ #endif
+diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
+index 9609752..6aac0df 100644
+--- a/sysdeps/unix/sysv/linux/i386/Makefile
++++ b/sysdeps/unix/sysv/linux/i386/Makefile
+@@ -1,47 +1,18 @@
+ # The default ABI is 32.
+ default-abi := 32
+
+-# %ebp is used to pass the 6th argument to system calls, so these
+-# system calls are incompatible with a frame pointer.
+-uses-6-syscall-arguments = -fomit-frame-pointer
+-
+ ifeq ($(subdir),misc)
+ sysdep_routines += ioperm iopl vm86
+-CFLAGS-epoll_pwait.o += $(uses-6-syscall-arguments)
+-CFLAGS-epoll_pwait.os += $(uses-6-syscall-arguments)
+-CFLAGS-mmap.o += $(uses-6-syscall-arguments)
+-CFLAGS-mmap.os += $(uses-6-syscall-arguments)
+-CFLAGS-mmap64.o += $(uses-6-syscall-arguments)
+-CFLAGS-mmap64.os += $(uses-6-syscall-arguments)
+-CFLAGS-pselect.o += $(uses-6-syscall-arguments)
+-CFLAGS-pselect.os += $(uses-6-syscall-arguments)
+-CFLAGS-rtld-mmap.os += $(uses-6-syscall-arguments)
+-endif
+-
+-ifeq ($(subdir),sysvipc)
+-CFLAGS-semtimedop.o += $(uses-6-syscall-arguments)
+-CFLAGS-semtimedop.os += $(uses-6-syscall-arguments)
+ endif
+
+ ifeq ($(subdir),elf)
++sysdep-dl-routines += libc-do-syscall
+ sysdep-others += lddlibc4
+ install-bin += lddlibc4
+ endif
+
+ ifeq ($(subdir),io)
+ sysdep_routines += libc-do-syscall
+-CFLAGS-posix_fadvise64.o += $(uses-6-syscall-arguments)
+-CFLAGS-posix_fadvise64.os += $(uses-6-syscall-arguments)
+-CFLAGS-posix_fallocate.o += $(uses-6-syscall-arguments)
+-CFLAGS-posix_fallocate.os += $(uses-6-syscall-arguments)
+-CFLAGS-posix_fallocate64.o += $(uses-6-syscall-arguments)
+-CFLAGS-posix_fallocate64.os += $(uses-6-syscall-arguments)
+-CFLAGS-sync_file_range.o += $(uses-6-syscall-arguments)
+-CFLAGS-sync_file_range.os += $(uses-6-syscall-arguments)
+-CFLAGS-fallocate.o += $(uses-6-syscall-arguments)
+-CFLAGS-fallocate.os += $(uses-6-syscall-arguments)
+-CFLAGS-fallocate64.o += $(uses-6-syscall-arguments)
+-CFLAGS-fallocate64.os += $(uses-6-syscall-arguments)
+ endif
+
+ ifeq ($(subdir),nptl)
+@@ -61,14 +32,6 @@ ifeq ($(subdir),nptl)
+ # pull in __syscall_error routine
+ libpthread-routines += sysdep
+ libpthread-shared-only-routines += sysdep
+-CFLAGS-pthread_rwlock_timedrdlock.o += $(uses-6-syscall-arguments)
+-CFLAGS-pthread_rwlock_timedrdlock.os += $(uses-6-syscall-arguments)
+-CFLAGS-pthread_rwlock_timedwrlock.o += $(uses-6-syscall-arguments)
+-CFLAGS-pthread_rwlock_timedwrlock.os += $(uses-6-syscall-arguments)
+-CFLAGS-sem_wait.o += $(uses-6-syscall-arguments)
+-CFLAGS-sem_wait.os += $(uses-6-syscall-arguments)
+-CFLAGS-sem_timedwait.o += $(uses-6-syscall-arguments)
+-CFLAGS-sem_timedwait.os += $(uses-6-syscall-arguments)
+ endif
+
+ ifeq ($(subdir),rt)
+diff --git a/sysdeps/unix/sysv/linux/i386/configure b/sysdeps/unix/sysv/linux/i386/configure
+index eb72659..ae2c356 100644
+--- a/sysdeps/unix/sysv/linux/i386/configure
++++ b/sysdeps/unix/sysv/linux/i386/configure
+@@ -3,5 +3,44 @@
+
+ arch_minimum_kernel=2.6.32
+
++# Check if CFLAGS allows compiler to use ebp register in inline assembly.
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler flags allows ebp in inline assembly" >&5
++$as_echo_n "checking if compiler flags allows ebp in inline assembly... " >&6; }
++if ${libc_cv_can_use_register_asm_ebp+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++
++ void foo (int i)
++ {
++ register int reg asm ("ebp") = i;
++ asm ("# %0" : : "r" (reg));
++ }
++int
++main ()
++{
++
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++ libc_cv_can_use_register_asm_ebp=yes
++else
++ libc_cv_can_use_register_asm_ebp=no
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_can_use_register_asm_ebp" >&5
++$as_echo "$libc_cv_can_use_register_asm_ebp" >&6; }
++if test $libc_cv_can_use_register_asm_ebp = yes; then
++ $as_echo "#define CAN_USE_REGISTER_ASM_EBP 1" >>confdefs.h
++
++fi
++
+ libc_cv_gcc_unwind_find_fde=yes
+ ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
+diff --git a/sysdeps/unix/sysv/linux/i386/configure.ac b/sysdeps/unix/sysv/linux/i386/configure.ac
+index 1a11da6..1cd632e 100644
+--- a/sysdeps/unix/sysv/linux/i386/configure.ac
++++ b/sysdeps/unix/sysv/linux/i386/configure.ac
+@@ -3,5 +3,22 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+
+ arch_minimum_kernel=2.6.32
+
++# Check if CFLAGS allows compiler to use ebp register in inline assembly.
++AC_CACHE_CHECK([if compiler flags allows ebp in inline assembly],
++ libc_cv_can_use_register_asm_ebp, [
++AC_COMPILE_IFELSE(
++ [AC_LANG_PROGRAM([
++ void foo (int i)
++ {
++ register int reg asm ("ebp") = i;
++ asm ("# %0" : : "r" (reg));
++ }])],
++ [libc_cv_can_use_register_asm_ebp=yes],
++ [libc_cv_can_use_register_asm_ebp=no])
++])
++if test $libc_cv_can_use_register_asm_ebp = yes; then
++ AC_DEFINE(CAN_USE_REGISTER_ASM_EBP)
++fi
++
+ libc_cv_gcc_unwind_find_fde=yes
+ ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
+diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
+index baf4642..449b23e 100644
+--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
++++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
+@@ -44,9 +44,9 @@
+ /* Since GCC 5 and above can properly spill %ebx with PIC when needed,
+ we can inline syscalls with 6 arguments if GCC 5 or above is used
+ to compile glibc. Disable GCC 5 optimization when compiling for
+- profiling since asm ("ebp") can't be used to put the 6th argument
+- in %ebp for syscall. */
+-#if __GNUC_PREREQ (5,0) && !defined PROF
++ profiling or when -fno-omit-frame-pointer is used since asm ("ebp")
++ can't be used to put the 6th argument in %ebp for syscall. */
++#if __GNUC_PREREQ (5,0) && !defined PROF && CAN_USE_REGISTER_ASM_EBP
+ # define OPTIMIZE_FOR_GCC_5
+ #endif
+
+--
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/CVE-2016-6323.patch b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/CVE-2016-6323.patch
deleted file mode 100644
index f9b9fa50d..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc/CVE-2016-6323.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-glibc-2.24: Fix CVE-2016-6323
-
-[No upstream tracking] -- https://sourceware.org/bugzilla/show_bug.cgi?id=20435
-
-arm: mark __startcontext as .cantunwind, GNU
-
-Glibc bug where the makecontext function would create
-an execution context which is incompatible with the unwinder,
-causing it to hang when the generation of a backtrace is attempted.
-
-Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9e2ff6c9cc54c0b4402b8d49e4abe7000fde7617]
-CVE: CVE-2016-6323
-Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
-Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
-
-diff --git a/sysdeps/unix/sysv/linux/arm/setcontext.S b/sysdeps/unix/sysv/linux/arm/setcontext.S
-index 603e508..d1f168f 100644
---- a/sysdeps/unix/sysv/linux/arm/setcontext.S
-+++ b/sysdeps/unix/sysv/linux/arm/setcontext.S
-@@ -86,12 +86,19 @@ weak_alias(__setcontext, setcontext)
-
- /* Called when a makecontext() context returns. Start the
- context in R4 or fall through to exit(). */
-+ /* Unwind descriptors are looked up based on PC - 2, so we have to
-+ make sure to mark the instruction preceding the __startcontext
-+ label as .cantunwind. */
-+ .fnstart
-+ .cantunwind
-+ nop
- ENTRY(__startcontext)
- movs r0, r4
- bne PLTJMP(__setcontext)
-
- @ New context was 0 - exit
- b PLTJMP(HIDDEN_JUMPTARGET(exit))
-+ .fnend
- END(__startcontext)
-
- #ifdef PIC
diff --git a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc_2.24.bb b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc_2.25.bb
index e723e03dc..0f1ec0c14 100644
--- a/import-layers/yocto-poky/meta/recipes-core/glibc/glibc_2.24.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/glibc/glibc_2.25.bb
@@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://LICENSES;md5=e9a558e243b36d3209f380deb394b213 \
DEPENDS += "gperf-native"
-SRCREV ?= "ea23815a795f72035262953dad5beb03e09c17dd"
+SRCREV ?= "db0242e3023436757bbc7c488a779e6e3343db04"
SRCBRANCH ?= "release/${PV}/master"
@@ -15,6 +15,10 @@ GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+\.\d+(\.\d+)*)"
SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
+ file://etc/ld.so.conf \
+ file://generate-supported.mk \
+ \
+ ${NATIVESDKFIXES} \
file://0005-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch \
file://0006-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \
file://0007-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch \
@@ -36,24 +40,13 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
file://0023-eglibc-Install-PIC-archives.patch \
file://0024-eglibc-Forward-port-cross-locale-generation-support.patch \
file://0025-Define-DUMMY_LOCALE_T-if-not-defined.patch \
- file://0026-build_local_scope.patch \
- file://0028-Bug-20116-Fix-use-after-free-in-pthread_create.patch \
- file://CVE-2016-6323.patch \
- file://0001-Add-atomic_exchange_relaxed.patch \
- file://0002-Add-atomic-operations-required-by-the-new-condition-.patch \
- file://0003-Add-pretty-printers-for-the-NPTL-lock-types.patch \
- file://0004-New-condvar-implementation-that-provides-stronger-or.patch \
- file://0005-Remove-__ASSUME_REQUEUE_PI.patch \
- file://0006-Fix-atomic_fetch_xor_release.patch \
+ file://0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \
+ file://0027-locale-fix-hard-coded-reference-to-gcc-E.patch \
+ file://0028-Rework-fno-omit-frame-pointer-support-on-i386.patch \
"
-SRC_URI += "\
- file://etc/ld.so.conf \
- file://generate-supported.mk \
- file://0001-locale-fix-hard-coded-reference-to-gcc-E.patch \
- "
-
-SRC_URI_append_class-nativesdk = "\
+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 \
diff --git a/import-layers/yocto-poky/meta/recipes-core/ifupdown/files/inet-6-.defn-fix-inverted-checks-for-loopback.patch b/import-layers/yocto-poky/meta/recipes-core/ifupdown/files/inet-6-.defn-fix-inverted-checks-for-loopback.patch
index bff352e3a..2013933b6 100644
--- a/import-layers/yocto-poky/meta/recipes-core/ifupdown/files/inet-6-.defn-fix-inverted-checks-for-loopback.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/ifupdown/files/inet-6-.defn-fix-inverted-checks-for-loopback.patch
@@ -1,7 +1,7 @@
-From 74152ac74a3e1ea0f3be292aa1eeca5ad1fe69c0 Mon Sep 17 00:00:00 2001
-From: Paul Gortmaker <paul.gortmaker@windriver.com>
-Date: Wed, 6 Aug 2014 15:12:11 -0400
-Subject: [PATCH 2/2] inet[6].defn: fix inverted checks for loopback
+From d88af5aa0312ea18aac791d66661da79b7bcd032 Mon Sep 17 00:00:00 2001
+From: "Maxin B. John" <maxin.john@intel.com>
+Date: Wed, 21 Dec 2016 15:32:07 +0200
+Subject: [PATCH] inet[6].defn: fix inverted checks for loopback
Compared to the hurd link.defn for loopback, we see these
are inverted, meaning that you would only be able to configure
@@ -11,60 +11,335 @@ The result was that we'd update /run/network/ifstate for "lo"
but never actually do anything for up/down, as shown below:
root@localhost:~# ifconfig -s
-Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
-eth0 1500 0 7736329 0 2016 0 5289422 0 0 0 BMRU
-lo 65536 0 18 0 0 0 18 0 0 0 LRU
+Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
+eth0 1500 0 7736329 0 2016 0 5289422 0 0 0 BMRU
+lo 65536 0 18 0 0 0 18 0 0 0 LRU
root@localhost:~# ifdown lo
root@localhost:~# echo $?
0
root@localhost:~# ifconfig -s
-Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
-eth0 1500 0 7736406 0 2016 0 5289455 0 0 0 BMRU
-lo 65536 0 18 0 0 0 18 0 0 0 LRU
+Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
+eth0 1500 0 7736406 0 2016 0 5289455 0 0 0 BMRU
+lo 65536 0 18 0 0 0 18 0 0 0 LRU
root@localhost:~# ifconfig lo down
root@localhost:~# ifconfig -s
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
-eth0 1500 0 7736474 0 2016 0 5289481 0 0 0 BMRU
+eth0 1500 0 7736474 0 2016 0 5289481 0 0 0 BMRU
root@localhost:~#
+Also reverted the commit:
+commit 80b878497663dae08f70b4d3cffe127b57a3cfc
+which uses absolute paths to binaries called by ifup/ifdown.
+
+Upstream-Status: Inappropriate [OE specific]
+
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
+Signed-off-by: Maxin B. John <maxin.john@intel.com>
---
- inet.defn | 12 ++++++------
- inet6.defn | 8 ++++----
- 2 files changed, 10 insertions(+), 10 deletions(-)
+ inet.defn | 148 +++++++++++++++++++++++++++++++-------------------------------
+ 1 file changed, 74 insertions(+), 74 deletions(-)
diff --git a/inet.defn b/inet.defn
-index b176ab4ed03e..5fdfb14a0e1c 100644
+index 75e6744..b5f5da2 100644
--- a/inet.defn
+++ b/inet.defn
@@ -6,10 +6,10 @@ method loopback
This method may be used to define the IPv4 loopback interface.
up
-- ip link set dev %iface% up if (!iface_is_lo())
+- /bin/ip link set dev %iface% up if (!iface_is_lo())
+ ip link set dev %iface% up if (iface_is_lo())
down
-- ip link set dev %iface% down if (!iface_is_lo())
+- /bin/ip link set dev %iface% down if (!iface_is_lo())
+ ip link set dev %iface% down if (iface_is_lo())
method static
description
-@@ -212,11 +212,11 @@ method loopback
+@@ -36,17 +36,17 @@ method static
+ broadcast compute_v4_broadcast
+
+ up
+- /bin/ip addr add %address%[[/%netmask%]] [[broadcast %broadcast%]] \
++ ip addr add %address%[[/%netmask%]] [[broadcast %broadcast%]] \
+ [[peer %pointopoint%]] [[scope %scope%]] dev %iface% label %iface%
+- /bin/ip link set dev %iface% [[mtu %mtu%]] [[address %hwaddress%]] up
++ ip link set dev %iface% [[mtu %mtu%]] [[address %hwaddress%]] up
+
+- [[ /bin/ip route add default via %gateway% [[metric %metric%]] dev %iface% onlink ]]
++ [[ ip route add default via %gateway% [[metric %metric%]] dev %iface% onlink ]]
+
+ down
+- [[ /bin/ip route del default via %gateway% [[metric %metric%]] dev %iface% 2>&1 1>/dev/null || true ]]
+- /bin/ip addr del %address%[[/%netmask%]] [[broadcast %broadcast%]] \
++ [[ ip route del default via %gateway% [[metric %metric%]] dev %iface% 2>&1 1>/dev/null || true ]]
++ ip addr del %address%[[/%netmask%]] [[broadcast %broadcast%]] \
+ [[peer %pointopoint%]] [[scope %scope%]] dev %iface% label %iface%
+- /bin/ip link set dev %iface% down \
++ ip link set dev %iface% down \
+ if (iface_is_link())
+
+ method manual
+@@ -63,12 +63,12 @@ method manual
+ hwaddress cleanup_hwaddress
+
+ up
+- [[/bin/ip link set dev %iface% mtu %mtu%]]
+- [[/bin/ip link set dev %iface% address %hwaddress%]]
+- /bin/ip link set dev %iface% up 2>/dev/null || true
++ [[ip link set dev %iface% mtu %mtu%]]
++ [[ip link set dev %iface% address %hwaddress%]]
++ ip link set dev %iface% up 2>/dev/null || true
+
+ down
+- /bin/ip link set dev %iface% down 2>/dev/null || true \
++ ip link set dev %iface% down 2>/dev/null || true \
+ if (iface_is_link() && !do_all)
+
+ method dhcp
+@@ -93,33 +93,33 @@ method dhcp
+ hwaddress cleanup_hwaddress
+
+ up
+- [[/bin/ip link set dev %iface% address %hwaddress%]]
+- /sbin/dhclient -v -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
++ [[ip link set dev %iface% address %hwaddress%]]
++ dhclient -v -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
+ [[-e IF_METRIC=%metric%]] \
+ if (execable("/sbin/dhclient"))
+- /sbin/pump -i %iface% [[-h %hostname%]] [[-l %leasehours%]] \
++ pump -i %iface% [[-h %hostname%]] [[-l %leasehours%]] \
+ elsif (execable("/sbin/pump"))
+- /sbin/udhcpc -n -p /run/udhcpc.%iface%.pid -i %iface% [[-x hostname:%hostname%]] \
++ udhcpc -n -p /run/udhcpc.%iface%.pid -i %iface% [[-x hostname:%hostname%]] \
+ elsif (execable("/sbin/udhcpc"))
+- /sbin/dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \
++ dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \
+ [[-l %leasetime%]] [[-m %metric%]] %iface% \
+ elsif (execable("/sbin/dhcpcd"))
+ echo 'No DHCP client software found!' >/dev/stderr; false \
+ elsif (1)
+
+ down
+- /sbin/dhclient -v -r -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
++ dhclient -v -r -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
+ if (execable("/sbin/dhclient"))
+- /sbin/pump -i %iface% -r \
++ pump -i %iface% -r \
+ elsif (execable("/sbin/pump"))
+- if test -f /run/udhcpc.%iface%.pid; then kill -USR2 $(/bin/cat /run/udhcpc.%iface%.pid); kill -TERM $(/bin/cat /run/udhcpc.%iface%.pid); fi \
++ if test -f /run/udhcpc.%iface%.pid; then kill -USR2 $(cat /run/udhcpc.%iface%.pid); kill -TERM $(cat /run/udhcpc.%iface%.pid); fi \
+ elsif (execable("/sbin/udhcpc"))
+- /sbin/dhcpcd -k %iface% \
++ dhcpcd -k %iface% \
+ elsif (execable("/sbin/dhcpcd"))
+ echo 'No DHCP client software found!' >/dev/stderr; false \
+ elsif (1)
+
+- /bin/ip link set dev %iface% down \
++ ip link set dev %iface% down \
+ if (iface_is_link())
+
+ method bootp
+@@ -134,11 +134,11 @@ method bootp
+ whatever it really is.
+
+ up
+- /sbin/bootpc [[--bootfile %bootfile%]] --dev %iface% [[--server %server%]] \
++ bootpc [[--bootfile %bootfile%]] --dev %iface% [[--server %server%]] \
+ [[--hwaddr %hwaddr%]] --returniffail --serverbcast
+
+ down
+- /bin/ip link set dev %iface% down \
++ ip link set dev %iface% down \
+ if (iface_is_link())
+
+ method tunnel
+@@ -158,13 +158,13 @@ method tunnel
+ ttl time -- TTL setting
+ mtu size -- MTU size
+ up
+- /bin/ip tunnel add %iface% mode %mode% remote %endpoint% [[local %local%]] \
++ ip tunnel add %iface% mode %mode% remote %endpoint% [[local %local%]] \
+ [[ttl %ttl%]]
+- /bin/ip link set %iface% up [[mtu %mtu%]]
+- /bin/ip addr add %address%/%netmask% dev %iface% [[peer %dstaddr%]]
+- [[ /bin/ip route add default via %gateway% [[metric %metric%]] dev %iface% onlink ]]
++ ip link set %iface% up [[mtu %mtu%]]
++ ip addr add %address%/%netmask% dev %iface% [[peer %dstaddr%]]
++ [[ ip route add default via %gateway% [[metric %metric%]] dev %iface% onlink ]]
+ down
+- /bin/ip tunnel del %iface%
++ ip tunnel del %iface%
+
+ method ppp
+ description
+@@ -175,9 +175,9 @@ method ppp
+ unit number -- Use /number/ as the ppp unit number.
+ options string -- Pass /string/ as additional options to pon.
+ up
+- /usr/bin/pon [[%provider%]] [[unit %unit%]] [[%options%]]
++ pon [[%provider%]] [[unit %unit%]] [[%options%]]
+ down
+- /usr/bin/poff [[%provider%]]
++ poff [[%provider%]]
+
+ method wvdial
+ description
+@@ -186,10 +186,10 @@ method wvdial
+ options
+ provider name -- Use /name/ as the provider (from /etc/wvdial.conf).
+ up
+- /sbin/start-stop-daemon --start -x /usr/bin/wvdial \
++ start-stop-daemon --start -x /usr/bin/wvdial \
+ -p /run/wvdial.%iface%.pid -b -m -- [[ %provider% ]]
+ down
+- /sbin/start-stop-daemon --stop -x /usr/bin/wvdial \
++ start-stop-daemon --stop -x /usr/bin/wvdial \
+ -p /run/wvdial.%iface%.pid -s 2
+
+
+@@ -200,9 +200,9 @@ method ipv4ll
+ known as APIPA or IPAC, and often colloquially referred to
+ as "Zeroconf address".
+ up
+- /usr/sbin/avahi-autoipd -D %iface%
++ avahi-autoipd -D %iface%
+ down
+- /usr/sbin/avahi-autoipd --kill %iface%
++ avahi-autoipd --kill %iface%
+
+ architecture kfreebsd
+
+@@ -211,12 +211,12 @@ method loopback
+ This method may be used to define the IPv4 loopback interface.
up
- ifconfig %iface% 127.0.0.1 up \
+- /sbin/ifconfig %iface% 127.0.0.1 up \
- if (!iface_is_lo())
++ ifconfig %iface% 127.0.0.1 up \
+ if (iface_is_lo())
down
- ifconfig %iface% down \
+- /sbin/ifconfig %iface% down \
- if (!iface_is_lo())
++ ifconfig %iface% down \
+ if (iface_is_lo())
method static
description
-@@ -371,11 +371,11 @@ method loopback
+@@ -238,15 +238,15 @@ method static
+ hwaddress cleanup_hwaddress
+
+ up
+- [[ /sbin/ifconfig %iface% link %hwaddress%]]
+- /sbin/ifconfig %iface% %address% [[netmask %netmask%]] [[broadcast %broadcast%]] \
++ [[ ifconfig %iface% link %hwaddress%]]
++ ifconfig %iface% %address% [[netmask %netmask%]] [[broadcast %broadcast%]] \
+ [[pointopoint %pointopoint%]] [[media %media%]] [[mtu %mtu%]] \
+ up
+- [[ /sbin/route add default %gateway% ]]
++ [[ route add default %gateway% ]]
+
+ down
+- [[ /sbin/route del default %gateway% 2>&1 1>/dev/null || true ]]
+- /sbin/ifconfig %iface% down
++ [[ route del default %gateway% 2>&1 1>/dev/null || true ]]
++ ifconfig %iface% down
+
+ method manual
+ description
+@@ -279,30 +279,30 @@ method dhcp
+ hwaddress cleanup_hwaddress
+
+ up
+- [[/sbin/ifconfig %iface% link %hwaddress%]]
+- /sbin/dhclient -v -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
++ [[ifconfig %iface% link %hwaddress%]]
++ dhclient -v -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
+ [[-e IF_METRIC=%metric%]] \
+ if (execable("/sbin/dhclient"))
+- /sbin/udhcpc -n -p /run/udhcpc.%iface%.pid -i %iface% [[-H %hostname%]] \
++ udhcpc -n -p /run/udhcpc.%iface%.pid -i %iface% [[-H %hostname%]] \
+ [[-c %client%]] \
+ elsif (execable("/sbin/udhcpc"))
+- /sbin/dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \
++ dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \
+ [[-l %leasetime%]] %iface% \
+ elsif (execable("/sbin/dhcpcd"))
+ echo 'No DHCP client software found!' >/dev/stderr; false \
+ elsif (1)
+
+ down
+- /sbin/dhclient -v -r -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
++ dhclient -v -r -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
+ if (execable("/sbin/dhclient"))
+- if test -f /run/udhcpc.%iface%.pid; then kill -USR2 $(/bin/cat /run/udhcpc.%iface%.pid); kill -TERM $(/bin/cat /run/udhcpc.%iface%.pid); fi \
++ if test -f /run/udhcpc.%iface%.pid; then kill -USR2 $(cat /run/udhcpc.%iface%.pid); kill -TERM $(cat /run/udhcpc.%iface%.pid); fi \
+ elsif (execable("/sbin/udhcpc"))
+- /sbin/dhcpcd -k %iface% \
++ dhcpcd -k %iface% \
+ elsif (execable("/sbin/dhcpcd"))
+ echo 'No DHCP client software found!' >/dev/stderr; false \
+ elsif (1)
+
+- /sbin/ifconfig %iface% down
++ ifconfig %iface% down
+
+ method bootp
+ description
+@@ -316,11 +316,11 @@ method bootp
+ whatever it really is.
+
+ up
+- /sbin/bootpc [[--bootfile %bootfile%]] --dev %iface% [[--server %server%]] \
++ bootpc [[--bootfile %bootfile%]] --dev %iface% [[--server %server%]] \
+ [[--hwaddr %hwaddr%]] --returniffail --serverbcast
+
+ down
+- /sbin/ifconfig %iface% down
++ ifconfig %iface% down
+
+ method ppp
+ description
+@@ -331,9 +331,9 @@ method ppp
+ unit number -- Use /number/ as the ppp unit number.
+ options string -- Pass /string/ as additional options to pon.
+ up
+- /usr/bin/pon [[%provider%]] [[unit %unit%]] [[%options%]]
++ pon [[%provider%]] [[unit %unit%]] [[%options%]]
+ down
+- /usr/bin/poff [[%provider%]]
++ poff [[%provider%]]
+
+ method wvdial
+ description
+@@ -342,10 +342,10 @@ method wvdial
+ options
+ provider name -- Use /name/ as the provider (from /etc/wvdial.conf).
+ up
+- /sbin/start-stop-daemon --start -x /usr/bin/wvdial \
++ start-stop-daemon --start -x /usr/bin/wvdial \
+ -p /run/wvdial.%iface%.pid -b -m -- [[ %provider% ]]
+ down
+- /sbin/start-stop-daemon --stop -x /usr/bin/wvdial \
++ start-stop-daemon --stop -x /usr/bin/wvdial \
+ -p /run/wvdial.%iface%.pid -s 2
+
+
+@@ -356,9 +356,9 @@ method ipv4ll
+ known as APIPA or IPAC, and often colloquially referred to
+ as "Zeroconf address".
+ up
+- /usr/sbin/avahi-autoipd -D %iface%
++ avahi-autoipd -D %iface%
+ down
+- /usr/sbin/avahi-autoipd --kill %iface%
++ avahi-autoipd --kill %iface%
+ architecture hurd
+
+ method loopback
+@@ -367,11 +367,11 @@ method loopback
up
inetutils-ifconfig --interface %iface% --address 127.0.0.1 --up \
@@ -78,26 +353,70 @@ index b176ab4ed03e..5fdfb14a0e1c 100644
method static
description
-diff --git a/inet6.defn b/inet6.defn
-index 09325539cd01..4df64aff38cc 100644
---- a/inet6.defn
-+++ b/inet6.defn
-@@ -33,11 +33,11 @@ method loopback
- description
- This method may be used to define the IPv6 loopback interface.
+@@ -432,23 +432,23 @@ method dhcp
+
up
-- -ip link set dev %iface% up 2>/dev/null if (!iface_is_lo())
-- -ip addr add dev %iface% ::1 2>/dev/null if (!iface_is_lo())
-+ -ip link set dev %iface% up 2>/dev/null if (iface_is_lo())
-+ -ip addr add dev %iface% ::1 2>/dev/null if (iface_is_lo())
+ [[Warning: Option hwaddress: %hwaddress% not yet supported]]
+- /sbin/dhclient -v -pf /run/dhclient.%iface///.%.pid -lf /var/lib/dhcp/dhclient.%iface///.%.leases -I -df /var/lib/dhcp/dhclient6.%iface///.%.leases %iface% \
++ dhclient -v -pf /run/dhclient.%iface///.%.pid -lf /var/lib/dhcp/dhclient.%iface///.%.leases -I -df /var/lib/dhcp/dhclient6.%iface///.%.leases %iface% \
+ if (execable("/sbin/dhclient"))
+- /sbin/udhcpc -n -p /run/udhcpc.%iface///.%.pid -i %iface% [[-H %hostname%]] \
++ udhcpc -n -p /run/udhcpc.%iface///.%.pid -i %iface% [[-H %hostname%]] \
+ [[-c %client%]] \
+ elsif (execable("/sbin/udhcpc"))
+- /sbin/dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \
++ dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \
+ [[-l %leasetime%]] %iface% \
+ elsif (execable("/sbin/dhcpcd"))
+ echo 'No DHCP client software found!' >/dev/stderr; false \
+ elsif (1)
+
+ down
+- /sbin/dhclient -v -r -pf /run/dhclient.%iface///.%.pid -lf /var/lib/dhcp/dhclient.%iface///.%.leases -I -df /var/lib/dhcp/dhclient6.%iface///.%.leases %iface% \
++ dhclient -v -r -pf /run/dhclient.%iface///.%.pid -lf /var/lib/dhcp/dhclient.%iface///.%.leases -I -df /var/lib/dhcp/dhclient6.%iface///.%.leases %iface% \
+ if (execable("/sbin/dhclient"))
+- if test -f /run/udhcpc.%iface///.%.pid; then kill -USR2 $(/bin/cat /run/udhcpc.%iface///.%.pid); kill -TERM $(/bin/cat /run/udhcpc.%iface///.%.pid); fi \
++ if test -f /run/udhcpc.%iface///.%.pid; then kill -USR2 $(cat /run/udhcpc.%iface///.%.pid); kill -TERM $(cat /run/udhcpc.%iface///.%.pid); fi \
+ elsif (execable("/sbin/udhcpc"))
+- /sbin/dhcpcd -k %iface% \
++ dhcpcd -k %iface% \
+ elsif (execable("/sbin/dhcpcd"))
+ echo 'No DHCP client software found!' >/dev/stderr; false \
+ elsif (1)
+@@ -482,9 +482,9 @@ method ppp
+ unit number -- Use /number/ as the ppp unit number.
+ options string -- Pass /string/ as additional options to pon.
+ up
+- /usr/bin/pon [[%provider%]] [[unit %unit%]] [[%options%]]
++ pon [[%provider%]] [[unit %unit%]] [[%options%]]
down
-- -ip addr del dev %iface% ::1 2>/dev/null if (!iface_is_lo())
-- -ip link set dev %iface% down 2>/dev/null if (!iface_is_lo())
-+ -ip addr del dev %iface% ::1 2>/dev/null if (iface_is_lo())
-+ -ip link set dev %iface% down 2>/dev/null if (iface_is_lo())
+- /usr/bin/poff [[%provider%]]
++ poff [[%provider%]]
- method static
+ method wvdial
description
+@@ -493,10 +493,10 @@ method wvdial
+ options
+ provider name -- Use /name/ as the provider (from /etc/wvdial.conf).
+ up
+- /sbin/start-stop-daemon --start -x /usr/bin/wvdial \
++ start-stop-daemon --start -x /usr/bin/wvdial \
+ -p /run/wvdial.%iface///.%.pid -b -m -- [[ %provider% ]]
+ down
+- /sbin/start-stop-daemon --stop -x /usr/bin/wvdial \
++ start-stop-daemon --stop -x /usr/bin/wvdial \
+ -p /run/wvdial.%iface///.%.pid -s 2
+
+
+@@ -507,6 +507,6 @@ method ipv4ll
+ known as APIPA or IPAC, and often colloquially referred to
+ as "Zeroconf address".
+ up
+- /usr/sbin/avahi-autoipd -D %iface%
++ avahi-autoipd -D %iface%
+ down
+- /usr/sbin/avahi-autoipd --kill %iface%
++ avahi-autoipd --kill %iface%
--
-1.9.1
+2.4.0
diff --git a/import-layers/yocto-poky/meta/recipes-core/ifupdown/ifupdown_0.8.2.bb b/import-layers/yocto-poky/meta/recipes-core/ifupdown/ifupdown_0.8.16.bb
index 9de01f961..5654528ae 100644
--- a/import-layers/yocto-poky/meta/recipes-core/ifupdown/ifupdown_0.8.2.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/ifupdown/ifupdown_0.8.16.bb
@@ -6,17 +6,17 @@ the file /etc/network/interfaces."
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
-SRC_URI = "git://anonscm.debian.org/git/collab-maint/ifupdown.git;protocol=https \
+SRC_URI = "git://anonscm.debian.org/git/collab-maint/ifupdown.git \
file://defn2-c-man-don-t-rely-on-dpkg-architecture-to-set-a.patch \
file://inet-6-.defn-fix-inverted-checks-for-loopback.patch \
file://99_network \
"
-SRCREV = "05ea2fd4f49bb1201aeef2a42efbcff8f336112f"
+SRCREV = "11b9f99f7ecc7052497e6786156cfed531f11823"
S = "${WORKDIR}/git"
-inherit update-rc.d update-alternatives
+inherit update-alternatives
do_compile () {
chmod a+rx *.pl *.sh
@@ -44,6 +44,3 @@ ALTERNATIVE_${PN} = "ifup ifdown"
ALTERNATIVE_LINK_NAME[ifup] = "${base_sbindir}/ifup"
ALTERNATIVE_LINK_NAME[ifdown] = "${base_sbindir}/ifdown"
-
-INITSCRIPT_NAME = "ifup"
-INITSCRIPT_PARAMS = "start 39 S . stop 39 0 6 1 ."
diff --git a/import-layers/yocto-poky/meta/recipes-core/images/build-appliance-image/README_VirtualBox_Toaster.txt b/import-layers/yocto-poky/meta/recipes-core/images/build-appliance-image/README_VirtualBox_Toaster.txt
new file mode 100644
index 000000000..a0aede2fb
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/images/build-appliance-image/README_VirtualBox_Toaster.txt
@@ -0,0 +1,78 @@
+
+Running Toaster in VirtualBox
+=============================
+
+Toaster is launched via the command in VM:
+
+ $ source toaster start webport=<IPADDR:PORT>
+
+The interaction with Toaster web server is done via a host internet
+browser.
+The particular steps depend on the actual networking being used
+by the VirtualBox.
+
+
+Bridged Network
+===============
+
+Find out your VM network IP address:
+
+ $ ifconfig
+
+IP address is listed under eth0 inet addr.
+It should be something like:
+ inet addr:192.168.1.18
+
+Launch the Toaster web server in VM:
+
+ $ source toaster start webport=192.168.1.18:8000
+
+Interact with the Toaster web server with your host browser using URL:
+
+ http://192.168.1.18:8000
+
+
+NAT Network
+===========
+Find out your VM network IP address:
+
+ $ ifconfig
+
+IP address is listed under eth0 inet addr.
+For NAT network it should be something like:
+ inet addr:10.0.2.15
+
+When using NAT network, the VM web server can be accessed using
+Port Forwarding.
+
+Using the VirtualBox GUI, navigate to:
+ Settings->Network->Adapter1
+
+You should set:
+ Attached to: NAT
+
+Select "Advanced", click on "Port Forwarding"
+
+This will open a new dialog box "Port Forwarding Rules".
+Create a new rule that looks like this:
+
+| Name | Protocol | Host IP | Host Port | Guest IP | Guest Port |
++-------+----------+---------+-----------+----------+------------+
+| Rule1 | TCP | | 8000 | | 8000 |
+------------------------------------------------------------------
+
+Now we can launch the Toaster web server in VM:
+
+ $ source toaster start webport=10.0.2.15:8000
+
+Interact with the Toaster web server with your host browser using URL:
+
+ http://127.0.0.1:8000
+
+
+
+
+
+
+
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/images/build-appliance-image_15.0.0.bb b/import-layers/yocto-poky/meta/recipes-core/images/build-appliance-image_15.0.0.bb
index 0803ddb65..045781c21 100644
--- a/import-layers/yocto-poky/meta/recipes-core/images/build-appliance-image_15.0.0.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/images/build-appliance-image_15.0.0.bb
@@ -1,5 +1,5 @@
SUMMARY = "An image containing the build system itself"
-DESCRIPTION = "An image containing the build system that you can boot and run using either VMware Player or VMware Workstation."
+DESCRIPTION = "An image containing the build system that you can boot and run using either VirtualBox, VMware Player or VMware Workstation."
HOMEPAGE = "http://www.yoctoproject.org/documentation/build-appliance"
LICENSE = "MIT"
@@ -7,7 +7,8 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d
file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
IMAGE_INSTALL = "packagegroup-core-boot packagegroup-core-ssh-openssh packagegroup-self-hosted \
- kernel-dev kernel-devsrc connman connman-plugin-ethernet dhcp-client"
+ kernel-dev kernel-devsrc connman connman-plugin-ethernet dhcp-client \
+ tzdata python3-pip perl-misc"
IMAGE_FEATURES += "x11-base package-management splash"
@@ -17,16 +18,17 @@ IMAGE_ROOTFS_EXTRA_SPACE = "41943040"
# Do a quiet boot with limited console messages
APPEND += "rootfstype=ext4 quiet"
-DEPENDS = "zip-native"
+DEPENDS = "zip-native python3-pip-native"
IMAGE_FSTYPES = "vmdk"
-inherit core-image module-base
+inherit core-image module-base setuptools3
-SRCREV ?= "e92165f5cea1c345672dd866df6a44d1cd8b97ce"
-SRC_URI = "git://git.yoctoproject.org/poky;branch=morty \
+SRCREV ?= "b859272ad4053185d4980cac05481b430e05345f"
+SRC_URI = "git://git.yoctoproject.org/poky;branch=pyro \
file://Yocto_Build_Appliance.vmx \
file://Yocto_Build_Appliance.vmxf \
file://README_VirtualBox_Guest_Additions.txt \
+ file://README_VirtualBox_Toaster.txt \
"
BA_INCLUDE_SOURCES ??= "0"
@@ -54,7 +56,11 @@ fakeroot do_populate_poky_src () {
# Place the README_VirtualBox_Guest_Additions file in builders home folder.
cp ${WORKDIR}/README_VirtualBox_Guest_Additions.txt ${IMAGE_ROOTFS}/home/builder/
+ # Place the README_VirtualBox_Toaster file in builders home folder.
+ cp ${WORKDIR}/README_VirtualBox_Toaster.txt ${IMAGE_ROOTFS}/home/builder/
+
# Create a symlink, needed for out-of-tree kernel modules build
+ rm -f ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/build
lnr ${IMAGE_ROOTFS}${KERNEL_SRC_PATH} ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/build
echo "INHERIT += \"rm_work\"" >> ${IMAGE_ROOTFS}/home/builder/poky/build/conf/auto.conf
@@ -82,12 +88,22 @@ fakeroot do_populate_poky_src () {
echo "builder ALL=(ALL) NOPASSWD: ALL" >> ${IMAGE_ROOTFS}/etc/sudoers
# Load tap/tun at startup
+ rm -f ${IMAGE_ROOTFS}/sbin/iptables
lnr ${IMAGE_ROOTFS}/usr/sbin/iptables ${IMAGE_ROOTFS}/sbin/iptables
echo "tun" >> ${IMAGE_ROOTFS}/etc/modules
# Use Clearlooks GTK+ theme
mkdir -p ${IMAGE_ROOTFS}/etc/gtk-2.0
echo 'gtk-theme-name = "Clearlooks"' > ${IMAGE_ROOTFS}/etc/gtk-2.0/gtkrc
+
+ # Install modules needed for toaster
+ export STAGING_LIBDIR=${STAGING_LIBDIR_NATIVE}
+ export STAGING_INCDIR=${STAGING_INCDIR_NATIVE}
+ export HOME=${IMAGE_ROOTFS}/home/builder
+ mkdir -p ${IMAGE_ROOTFS}/home/builder/.cache/pip
+ pip3 install --user -I -U -v -r ${IMAGE_ROOTFS}/home/builder/poky/bitbake/toaster-requirements.txt
+ chown -R builder.builder ${IMAGE_ROOTFS}/home/builder/.local
+ chown -R builder.builder ${IMAGE_ROOTFS}/home/builder/.cache
}
IMAGE_PREPROCESS_COMMAND += "do_populate_poky_src; "
diff --git a/import-layers/yocto-poky/meta/recipes-core/images/core-image-minimal.bb b/import-layers/yocto-poky/meta/recipes-core/images/core-image-minimal.bb
index 8dd77b347..4630026aa 100644
--- a/import-layers/yocto-poky/meta/recipes-core/images/core-image-minimal.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/images/core-image-minimal.bb
@@ -1,6 +1,6 @@
SUMMARY = "A small image just capable of allowing a device to boot."
-IMAGE_INSTALL = "packagegroup-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL}"
+IMAGE_INSTALL = "packagegroup-core-boot ${CORE_IMAGE_EXTRA_INSTALL}"
IMAGE_LINGUAS = " "
diff --git a/import-layers/yocto-poky/meta/recipes-core/images/core-image-tiny-initramfs.bb b/import-layers/yocto-poky/meta/recipes-core/images/core-image-tiny-initramfs.bb
new file mode 100644
index 000000000..184727ddf
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/images/core-image-tiny-initramfs.bb
@@ -0,0 +1,42 @@
+# Simple initramfs image artifact generation for tiny images.
+DESCRIPTION = "Tiny image capable of booting a device. The kernel includes \
+the Minimal RAM-based Initial Root Filesystem (initramfs), which finds the \
+first 'init' program more efficiently. core-image-tiny-initramfs doesn't \
+actually generate an image but rather generates boot and rootfs artifacts \
+into a common location that can subsequently be picked up by external image \
+generation tools such as wic."
+
+PACKAGE_INSTALL = "initramfs-live-boot packagegroup-core-boot dropbear ${VIRTUAL-RUNTIME_base-utils} udev base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}"
+
+# Do not pollute the initrd image with rootfs features
+IMAGE_FEATURES = ""
+
+export IMAGE_BASENAME = "core-image-tiny-initramfs"
+IMAGE_LINGUAS = ""
+
+LICENSE = "MIT"
+
+# don't actually generate an image, just the artifacts needed for one
+IMAGE_FSTYPES = "${INITRAMFS_FSTYPES} wic"
+
+inherit core-image
+
+IMAGE_ROOTFS_SIZE = "8192"
+IMAGE_ROOTFS_EXTRA_SPACE = "0"
+
+BAD_RECOMMENDATIONS += "busybox-syslog"
+
+# Use the same restriction as initramfs-live-install
+COMPATIBLE_HOST = "(i.86|x86_64).*-linux"
+
+python tinyinitrd () {
+ # Modify our init file so the user knows we drop to shell prompt on purpose
+ newinit = None
+ with open(d.expand('${IMAGE_ROOTFS}/init'), 'r') as init:
+ newinit = init.read()
+ newinit = newinit.replace('Cannot find $ROOT_IMAGE file in /run/media/* , dropping to a shell ', 'Poky Tiny Reference Distribution:')
+ with open(d.expand('${IMAGE_ROOTFS}/init'), 'w') as init:
+ init.write(newinit)
+}
+
+IMAGE_PREPROCESS_COMMAND += "tinyinitrd;"
diff --git a/import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh b/import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh
index b56210915..9c4b263d5 100644
--- a/import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh
+++ b/import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh
@@ -171,19 +171,19 @@ if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
fi
if [ -d /run/media/$1/loader ]; then
- GUMMIBOOT_CFGS="/ssd/loader/entries/*.conf"
- # copy config files for gummiboot
+ SYSTEMDBOOT_CFGS="/ssd/loader/entries/*.conf"
+ # copy config files for systemd-boot
cp -dr /run/media/$1/loader /ssd
# delete the install entry
rm -f /ssd/loader/entries/install.conf
# delete the initrd lines
- sed -i "/initrd /d" $GUMMIBOOT_CFGS
+ sed -i "/initrd /d" $SYSTEMDBOOT_CFGS
# delete any LABEL= strings
- sed -i "s/ LABEL=[^ ]*/ /" $GUMMIBOOT_CFGS
+ sed -i "s/ LABEL=[^ ]*/ /" $SYSTEMDBOOT_CFGS
# delete any root= strings
- sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS
+ sed -i "s/ root=[^ ]*/ /" $SYSTEMDBOOT_CFGS
# add the root= and other standard boot options
- sed -i "s@options *@options root=$rootfs rw $rootwait quiet @" $GUMMIBOOT_CFGS
+ sed -i "s@options *@options root=$rootfs rw $rootwait quiet @" $SYSTEMDBOOT_CFGS
# Add the test label
echo -ne "title test\nlinux /test-kernel\noptions root=$testfs rw $rootwait quiet\n" > /ssd/loader/entries/test.conf
fi
diff --git a/import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index 441e25238..5ad3a60c0 100644
--- a/import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -22,6 +22,8 @@ live_dev_name=${live_dev_name#\/dev/}
case $live_dev_name in
mmcblk*)
;;
+ nvme*)
+ ;;
*)
live_dev_name=${live_dev_name%%[0-9]*}
;;
@@ -146,7 +148,8 @@ swap_start=$((rootfs_end))
# 2) they are detected asynchronously (need rootwait)
rootwait=""
part_prefix=""
-if [ ! "${device#/dev/mmcblk}" = "${device}" ]; then
+if [ ! "${device#/dev/mmcblk}" = "${device}" ] || \
+ [ ! "${device#/dev/nvme}" = "${device}" ]; then
part_prefix="p"
rootwait="rootwait"
fi
@@ -242,19 +245,19 @@ fi
if [ -d /run/media/$1/loader ]; then
rootuuid=$(blkid -o value -s PARTUUID ${rootfs})
- GUMMIBOOT_CFGS="/boot/loader/entries/*.conf"
- # copy config files for gummiboot
+ SYSTEMDBOOT_CFGS="/boot/loader/entries/*.conf"
+ # copy config files for systemd-boot
cp -dr /run/media/$1/loader /boot
# delete the install entry
rm -f /boot/loader/entries/install.conf
# delete the initrd lines
- sed -i "/initrd /d" $GUMMIBOOT_CFGS
+ sed -i "/initrd /d" $SYSTEMDBOOT_CFGS
# delete any LABEL= strings
- sed -i "s/ LABEL=[^ ]*/ /" $GUMMIBOOT_CFGS
+ sed -i "s/ LABEL=[^ ]*/ /" $SYSTEMDBOOT_CFGS
# delete any root= strings
- sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS
+ sed -i "s/ root=[^ ]*/ /" $SYSTEMDBOOT_CFGS
# add the root= and other standard boot options
- sed -i "s@options *@options root=PARTUUID=$rootuuid rw $rootwait quiet @" $GUMMIBOOT_CFGS
+ sed -i "s@options *@options root=PARTUUID=$rootuuid rw $rootwait quiet @" $SYSTEMDBOOT_CFGS
fi
umount /tgt_root
diff --git a/import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install.sh b/import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install.sh
index 04ce5fb4b..572613ecd 100644
--- a/import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -21,6 +21,8 @@ live_dev_name=${live_dev_name#\/dev/}
case $live_dev_name in
mmcblk*)
;;
+ nvme*)
+ ;;
*)
live_dev_name=${live_dev_name%%[0-9]*}
;;
@@ -153,7 +155,8 @@ swap_start=$((rootfs_end))
# 2) they are detected asynchronously (need rootwait)
rootwait=""
part_prefix=""
-if [ ! "${device#/dev/mmcblk}" = "${device}" ]; then
+if [ ! "${device#/dev/mmcblk}" = "${device}" ] || \
+ [ ! "${device#/dev/nvme}" = "${device}" ]; then
part_prefix="p"
rootwait="rootwait"
fi
diff --git a/import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh b/import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
index ce4622a5e..22a71ecaa 100755
--- a/import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
+++ b/import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
@@ -36,7 +36,7 @@ create_file() {
[ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
} || {
if [ -z "$ROOT_DIR" ]; then
- eval $EXEC &
+ eval $EXEC
else
# Creating some files at rootfs time may fail and should fail,
# but these failures should not be logged to make sure the do_rootfs
@@ -70,7 +70,7 @@ mk_dir() {
link_file() {
EXEC="
if [ -L \"$2\" ]; then
- [ \"\$(readlink -f \"$2\")\" != \"\$(readlink -f \"$1\")\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; };
+ [ \"\$(readlink -f \"$2\")\" != \"$1\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; };
elif [ -d \"$2\" ]; then
if awk '\$2 == \"$2\" {exit 1}' /proc/mounts; then
cp -a $2/* $1 2>/dev/null;
@@ -86,7 +86,7 @@ link_file() {
test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache.build
if [ -z "$ROOT_DIR" ]; then
- eval $EXEC &
+ eval $EXEC
else
# For the same reason with create_file(), failures should
# not be logged.
@@ -150,9 +150,9 @@ apply_cfgfile() {
return 1
}
- cat ${CFGFILE} | grep -v "^#" | \
- while read LINE; do
- eval `echo "$LINE" | sed -n "s/\(.*\)\ \(.*\) \(.*\)\ \(.*\)\ \(.*\)\ \(.*\)/TTYPE=\1 ; TUSER=\2; TGROUP=\3; TMODE=\4; TNAME=\5 TLTARGET=\6/p"`
+ cat ${CFGFILE} | sed 's/#.*//' | \
+ while read TTYPE TUSER TGROUP TMODE TNAME TLTARGET; do
+ test -z "${TLTARGET}" && continue
TNAME=${ROOT_DIR}${TNAME}
[ "${VERBOSE}" != "no" ] && echo "Checking for -${TNAME}-."
@@ -187,7 +187,7 @@ apply_cfgfile() {
case "${TTYPE}" in
"f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-."
- create_file "${TNAME}" &
+ create_file "${TNAME}"
;;
"d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-."
mk_dir "${TNAME}"
diff --git a/import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh b/import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh
index 0a52c90da..f5b5b9904 100644
--- a/import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh
+++ b/import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh
@@ -22,6 +22,10 @@ if [ -e /sys/kernel/debug ] && grep -q debugfs /proc/filesystems; then
mount -t debugfs debugfs /sys/kernel/debug
fi
+if [ -e /sys/kernel/config ] && grep -q configfs /proc/filesystems; then
+ mount -t configfs configfs /sys/kernel/config
+fi
+
if ! [ -e /dev/zero ] && [ -e /dev ] && grep -q devtmpfs /proc/filesystems; then
mount -n -t devtmpfs devtmpfs /dev
fi
diff --git a/import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts-1.0/volatiles b/import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts-1.0/volatiles
index 297245d0e..bc17c4553 100644
--- a/import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts-1.0/volatiles
+++ b/import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts-1.0/volatiles
@@ -1,11 +1,13 @@
# This configuration file lists filesystem objects that should get verified
# during startup and be created if missing.
#
-# Every line must either be a comment starting with #
-# or a definition of format:
+# Entries have the following format:
# <type> <owner> <group> <mode> <path> <linksource>
# where the items are separated by whitespace !
#
+# The # character introduces a comment lasting until end of line.
+# Blank lines are ignored.
+#
# <type> : d|f|l : (d)irectory|(f)ile|(l)ink
#
# A linking example:
diff --git a/import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts_1.0.bb b/import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts_1.0.bb
index 8f110b005..2e4f7e466 100644
--- a/import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts_1.0.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/initscripts/initscripts_1.0.bb
@@ -44,7 +44,7 @@ KERNEL_VERSION = ""
inherit update-alternatives
DEPENDS_append = " update-rc.d-native"
-DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
+PACKAGE_WRITE_DEPS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
PACKAGES =+ "${PN}-functions"
RDEPENDS_${PN} = "${PN}-functions \
diff --git a/import-layers/yocto-poky/meta/recipes-core/kbd/kbd_2.0.3.bb b/import-layers/yocto-poky/meta/recipes-core/kbd/kbd_2.0.4.bb
index 54d16835f..65325c0ea 100644
--- a/import-layers/yocto-poky/meta/recipes-core/kbd/kbd_2.0.3.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/kbd/kbd_2.0.4.bb
@@ -15,10 +15,10 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'file://set-proper-path-of-resources.patch', '', d)} \
"
-SRC_URI[md5sum] = "231b46e7142eb41ea3ae06d2ded3c208"
-SRC_URI[sha256sum] = "7a899de1c0eb75f3aea737095a736f2375e1cbfbe693fc14a3fe0bfb4649fb5e"
+SRC_URI[md5sum] = "c1635a5a83b63aca7f97a3eab39ebaa6"
+SRC_URI[sha256sum] = "5fd90af6beb225a9bb9b9fb414c090fba53c9a55793e172f508cd43652e59a88"
-PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
+PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
PACKAGECONFIG[pam] = "--enable-vlock, --disable-vlock, libpam,"
do_compile_ptest() {
diff --git a/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch
new file mode 100644
index 000000000..d1ad55116
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch
@@ -0,0 +1,99 @@
+From 78dbd4c09d617a9cb730d796f94ee4d93840d3cc Mon Sep 17 00:00:00 2001
+From: Peter Kjellerstedt <pkj@axis.com>
+Date: Fri, 9 Jun 2017 17:50:46 +0200
+Subject: [PATCH] Make ptest run the python tests if python is enabled
+
+One of the tests (tstLastError.py) needed a minor correction. It might
+be due to the fact that the tests are forced to run with Python 3.
+
+Upstream-Status: Inappropriate [OE specific]
+Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
+---
+ Makefile.am | 2 +-
+ python/Makefile.am | 9 +++++++++
+ python/tests/Makefile.am | 12 ++++++++++--
+ python/tests/tstLastError.py | 2 +-
+ 4 files changed, 21 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index e181ee0..7960e7d 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -207,9 +207,9 @@ install-ptest:
+ install $(noinst_PROGRAMS) $(DESTDIR))
+ cp -r $(srcdir)/test $(DESTDIR)
+ cp -r $(srcdir)/result $(DESTDIR)
+- cp -r $(srcdir)/python $(DESTDIR)
+ cp Makefile $(DESTDIR)
+ sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile
++ $(MAKE) -C python install-ptest
+
+ runtests:
+ [ -d test ] || $(LN_S) $(srcdir)/test .
+diff --git a/python/Makefile.am b/python/Makefile.am
+index 34aed96..ba3ec6a 100644
+--- a/python/Makefile.am
++++ b/python/Makefile.am
+@@ -48,7 +48,16 @@ GENERATED = libxml2class.py libxml2class.txt $(BUILT_SOURCES)
+
+ $(GENERATED): $(srcdir)/generator.py $(API_DESC)
+ $(PYTHON) $(srcdir)/generator.py $(srcdir)
++
++install-ptest:
++ cp -r $(srcdir) $(DESTDIR)
++ sed -e 's|^Makefile:|_Makefile:|' \
++ -e 's|^\(tests test:\) all|\1|' Makefile >$(DESTDIR)/python/Makefile
++ $(MAKE) -C tests install-ptest
++else
++install-ptest:
+ endif
+
++.PHONY: tests test
+ tests test: all
+ cd tests && $(MAKE) tests
+diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am
+index 95ebead..418e21e 100644
+--- a/python/tests/Makefile.am
++++ b/python/tests/Makefile.am
+@@ -59,6 +59,11 @@ XMLS= \
+ CLEANFILES = core tmp.xml *.pyc
+
+ if WITH_PYTHON
++install-ptest:
++ cp -r $(srcdir) $(DESTDIR)/python
++ sed -e 's|^Makefile:|_Makefile:|' \
++ -e 's|^\(srcdir = \).*|\1.|' Makefile >$(DESTDIR)/python/tests/Makefile
++
+ tests: $(PYTESTS)
+ @for f in $(XMLS) ; do test -f $$f || $(LN_S) $(srcdir)/$$f . ; done
+ @echo "## running Python regression tests"
+@@ -68,8 +73,11 @@ tests: $(PYTESTS)
+ export LD_LIBRARY_PATH; \
+ for test in $(PYTESTS) ; \
+ do log=`$(PYTHON) $(srcdir)/$$test` ; \
+- if [ "`echo $$log | grep OK`" = "" ] ; then \
+- echo "-- $$test" ; echo "$$log" ; fi ; done)
++ if [ "`echo $$log | grep OK`" ]; then \
++ echo "PASS: $$test"; else \
++ echo "$$log"; echo "FAIL: $$test"; fi; done)
+ else
++install-ptest:
++
+ tests:
+ endif
+diff --git a/python/tests/tstLastError.py b/python/tests/tstLastError.py
+index d5f9be7..3e5bef8 100755
+--- a/python/tests/tstLastError.py
++++ b/python/tests/tstLastError.py
+@@ -25,7 +25,7 @@ class TestCase(unittest.TestCase):
+ when the exception is raised, check the libxml2.lastError for
+ expected values."""
+ # disable the default error handler
+- libxml2.registerErrorHandler(None,None)
++ libxml2.registerErrorHandler(lambda ctx,str: None,None)
+ try:
+ f(*args)
+ except exc:
+--
+2.12.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/CVE-2016-9318.patch b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/CVE-2016-9318.patch
deleted file mode 100644
index 3581ab83d..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/CVE-2016-9318.patch
+++ /dev/null
@@ -1,207 +0,0 @@
-From 7fa1cd31552d52d50a9101f07c816ff6dd2d9f19 Mon Sep 17 00:00:00 2001
-From: Doran Moppert <dmoppert@redhat.com>
-Date: Fri, 7 Apr 2017 16:45:56 +0200
-Subject: [PATCH] Add an XML_PARSE_NOXXE flag to block all entities loading
- even local
-
-For https://bugzilla.gnome.org/show_bug.cgi?id=772726
-
-* include/libxml/parser.h: Add a new parser flag XML_PARSE_NOXXE
-* elfgcchack.h, xmlIO.h, xmlIO.c: associated loading routine
-* include/libxml/xmlerror.h: new error raised
-* xmllint.c: adds --noxxe flag to activate the option
-
-Upstream-Status: Backport
-CVE: CVE-2016-9318
-
-Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
----
- elfgcchack.h | 10 ++++++++++
- include/libxml/parser.h | 3 ++-
- include/libxml/xmlIO.h | 8 ++++++++
- include/libxml/xmlerror.h | 1 +
- parser.c | 4 ++++
- xmlIO.c | 40 +++++++++++++++++++++++++++++++++++-----
- xmllint.c | 5 +++++
- 7 files changed, 65 insertions(+), 6 deletions(-)
-
-diff --git a/elfgcchack.h b/elfgcchack.h
-index 8c52884..1b81dcd 100644
---- a/elfgcchack.h
-+++ b/elfgcchack.h
-@@ -6547,6 +6547,16 @@ extern __typeof (xmlNoNetExternalEntityLoader) xmlNoNetExternalEntityLoader__int
- #endif
- #endif
-
-+#ifdef bottom_xmlIO
-+#undef xmlNoXxeExternalEntityLoader
-+extern __typeof (xmlNoXxeExternalEntityLoader) xmlNoXxeExternalEntityLoader __attribute((alias("xmlNoXxeExternalEntityLoader__internal_alias")));
-+#else
-+#ifndef xmlNoXxeExternalEntityLoader
-+extern __typeof (xmlNoXxeExternalEntityLoader) xmlNoXxeExternalEntityLoader__internal_alias __attribute((visibility("hidden")));
-+#define xmlNoXxeExternalEntityLoader xmlNoXxeExternalEntityLoader__internal_alias
-+#endif
-+#endif
-+
- #ifdef bottom_tree
- #undef xmlNodeAddContent
- extern __typeof (xmlNodeAddContent) xmlNodeAddContent __attribute((alias("xmlNodeAddContent__internal_alias")));
-diff --git a/include/libxml/parser.h b/include/libxml/parser.h
-index 47fbec0..63ca1b9 100644
---- a/include/libxml/parser.h
-+++ b/include/libxml/parser.h
-@@ -1111,7 +1111,8 @@ typedef enum {
- XML_PARSE_HUGE = 1<<19,/* relax any hardcoded limit from the parser */
- XML_PARSE_OLDSAX = 1<<20,/* parse using SAX2 interface before 2.7.0 */
- XML_PARSE_IGNORE_ENC= 1<<21,/* ignore internal document encoding hint */
-- XML_PARSE_BIG_LINES = 1<<22 /* Store big lines numbers in text PSVI field */
-+ XML_PARSE_BIG_LINES = 1<<22,/* Store big lines numbers in text PSVI field */
-+ XML_PARSE_NOXXE = 1<<23 /* Forbid any external entity loading */
- } xmlParserOption;
-
- XMLPUBFUN void XMLCALL
-diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h
-index 3e41744..8d3fdef 100644
---- a/include/libxml/xmlIO.h
-+++ b/include/libxml/xmlIO.h
-@@ -300,6 +300,14 @@ XMLPUBFUN xmlParserInputPtr XMLCALL
- xmlParserCtxtPtr ctxt);
-
- /*
-+ * A predefined entity loader external entity expansion
-+ */
-+XMLPUBFUN xmlParserInputPtr XMLCALL
-+ xmlNoXxeExternalEntityLoader (const char *URL,
-+ const char *ID,
-+ xmlParserCtxtPtr ctxt);
-+
-+/*
- * xmlNormalizeWindowsPath is obsolete, don't use it.
- * Check xmlCanonicPath in uri.h for a better alternative.
- */
-diff --git a/include/libxml/xmlerror.h b/include/libxml/xmlerror.h
-index 037c16d..3036062 100644
---- a/include/libxml/xmlerror.h
-+++ b/include/libxml/xmlerror.h
-@@ -470,6 +470,7 @@ typedef enum {
- XML_IO_EADDRINUSE, /* 1554 */
- XML_IO_EALREADY, /* 1555 */
- XML_IO_EAFNOSUPPORT, /* 1556 */
-+ XML_IO_ILLEGAL_XXE, /* 1557 */
- XML_XINCLUDE_RECURSION=1600,
- XML_XINCLUDE_PARSE_VALUE, /* 1601 */
- XML_XINCLUDE_ENTITY_DEF_MISMATCH, /* 1602 */
-diff --git a/parser.c b/parser.c
-index 53a6b7f..609a270 100644
---- a/parser.c
-+++ b/parser.c
-@@ -15350,6 +15350,10 @@ xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options, const char *encodi
- ctxt->options |= XML_PARSE_NONET;
- options -= XML_PARSE_NONET;
- }
-+ if (options & XML_PARSE_NOXXE) {
-+ ctxt->options |= XML_PARSE_NOXXE;
-+ options -= XML_PARSE_NOXXE;
-+ }
- if (options & XML_PARSE_COMPACT) {
- ctxt->options |= XML_PARSE_COMPACT;
- options -= XML_PARSE_COMPACT;
-diff --git a/xmlIO.c b/xmlIO.c
-index 1a79c09..304f822 100644
---- a/xmlIO.c
-+++ b/xmlIO.c
-@@ -210,6 +210,7 @@ static const char *IOerr[] = {
- "adddress in use", /* EADDRINUSE */
- "already in use", /* EALREADY */
- "unknown address familly", /* EAFNOSUPPORT */
-+ "Attempt to load external entity %s", /* XML_IO_ILLEGAL_XXE */
- };
-
- #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
-@@ -4053,13 +4054,22 @@ xmlDefaultExternalEntityLoader(const char *URL, const char *ID,
- xmlGenericError(xmlGenericErrorContext,
- "xmlDefaultExternalEntityLoader(%s, xxx)\n", URL);
- #endif
-- if ((ctxt != NULL) && (ctxt->options & XML_PARSE_NONET)) {
-+ if (ctxt != NULL) {
- int options = ctxt->options;
-
-- ctxt->options -= XML_PARSE_NONET;
-- ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt);
-- ctxt->options = options;
-- return(ret);
-+ if (options & XML_PARSE_NOXXE) {
-+ ctxt->options -= XML_PARSE_NOXXE;
-+ ret = xmlNoXxeExternalEntityLoader(URL, ID, ctxt);
-+ ctxt->options = options;
-+ return(ret);
-+ }
-+
-+ if (options & XML_PARSE_NONET) {
-+ ctxt->options -= XML_PARSE_NONET;
-+ ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt);
-+ ctxt->options = options;
-+ return(ret);
-+ }
- }
- #ifdef LIBXML_CATALOG_ENABLED
- resource = xmlResolveResourceFromCatalog(URL, ID, ctxt);
-@@ -4160,6 +4170,13 @@ xmlNoNetExternalEntityLoader(const char *URL, const char *ID,
- xmlParserInputPtr input = NULL;
- xmlChar *resource = NULL;
-
-+ if (ctxt == NULL) {
-+ return(NULL);
-+ }
-+ if (ctxt->input_id == 1) {
-+ return xmlDefaultExternalEntityLoader((const char *) URL, ID, ctxt);
-+ }
-+
- #ifdef LIBXML_CATALOG_ENABLED
- resource = xmlResolveResourceFromCatalog(URL, ID, ctxt);
- #endif
-@@ -4182,5 +4199,18 @@ xmlNoNetExternalEntityLoader(const char *URL, const char *ID,
- return(input);
- }
-
-+xmlParserInputPtr
-+xmlNoXxeExternalEntityLoader(const char *URL, const char *ID,
-+ xmlParserCtxtPtr ctxt) {
-+ if (ctxt == NULL) {
-+ return(NULL);
-+ }
-+ if (ctxt->input_id == 1) {
-+ return xmlDefaultExternalEntityLoader((const char *) URL, ID, ctxt);
-+ }
-+ xmlIOErr(XML_IO_ILLEGAL_XXE, (const char *) URL);
-+ return(NULL);
-+}
-+
- #define bottom_xmlIO
- #include "elfgcchack.h"
-diff --git a/xmllint.c b/xmllint.c
-index 67f7adb..d9368c1 100644
---- a/xmllint.c
-+++ b/xmllint.c
-@@ -3019,6 +3019,7 @@ static void usage(const char *name) {
- printf("\t--path 'paths': provide a set of paths for resources\n");
- printf("\t--load-trace : print trace of all external entities loaded\n");
- printf("\t--nonet : refuse to fetch DTDs or entities over network\n");
-+ printf("\t--noxxe : forbid any external entity loading\n");
- printf("\t--nocompact : do not generate compact text nodes\n");
- printf("\t--htmlout : output results as HTML\n");
- printf("\t--nowrap : do not put HTML doc wrapper\n");
-@@ -3461,6 +3462,10 @@ main(int argc, char **argv) {
- (!strcmp(argv[i], "--nonet"))) {
- options |= XML_PARSE_NONET;
- xmlSetExternalEntityLoader(xmlNoNetExternalEntityLoader);
-+ } else if ((!strcmp(argv[i], "-noxxe")) ||
-+ (!strcmp(argv[i], "--noxxe"))) {
-+ options |= XML_PARSE_NOXXE;
-+ xmlSetExternalEntityLoader(xmlNoXxeExternalEntityLoader);
- } else if ((!strcmp(argv[i], "-nocompact")) ||
- (!strcmp(argv[i], "--nocompact"))) {
- options &= ~XML_PARSE_COMPACT;
---
-2.10.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-0663.patch b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-0663.patch
new file mode 100644
index 000000000..010826585
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-0663.patch
@@ -0,0 +1,40 @@
+libxml2: Fix CVE-2017-0663
+
+[No upstream tracking] -- https://bugzilla.gnome.org/show_bug.cgi?id=780228
+
+valid: Fix type confusion in xmlValidateOneNamespace
+
+Comment out code that casts xmlNsPtr to xmlAttrPtr. ID types
+on namespace declarations make no practical sense anyway.
+
+Fixes bug 780228
+
+Upstream-Status: Backport [https://git.gnome.org/browse/libxml2/commit/?id=92b9e8c8b3787068565a1820ba575d042f9eec66]
+CVE: CVE-2017-0663
+Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
+
+diff --git a/valid.c b/valid.c
+index 19f84b8..e03d35e 100644
+--- a/valid.c
++++ b/valid.c
+@@ -4621,6 +4621,12 @@ xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) {
+ }
+ }
+
++ /*
++ * Casting ns to xmlAttrPtr is wrong. We'd need separate functions
++ * xmlAddID and xmlAddRef for namespace declarations, but it makes
++ * no practical sense to use ID types anyway.
++ */
++#if 0
+ /* Validity Constraint: ID uniqueness */
+ if (attrDecl->atype == XML_ATTRIBUTE_ID) {
+ if (xmlAddID(ctxt, doc, value, (xmlAttrPtr) ns) == NULL)
+@@ -4632,6 +4638,7 @@ xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) {
+ if (xmlAddRef(ctxt, doc, value, (xmlAttrPtr) ns) == NULL)
+ ret = 0;
+ }
++#endif
+
+ /* Validity Constraint: Notation Attributes */
+ if (attrDecl->atype == XML_ATTRIBUTE_NOTATION) {
diff --git a/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-5969.patch b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-5969.patch
new file mode 100644
index 000000000..571b05c08
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-5969.patch
@@ -0,0 +1,62 @@
+libxml2-2.9.4: Fix CVE-2017-5969
+
+[No upstream tracking] -- https://bugzilla.gnome.org/show_bug.cgi?id=758422
+
+valid: Fix NULL pointer deref in xmlDumpElementContent
+
+Can only be triggered in recovery mode.
+
+Fixes bug 758422
+
+Upstream-Status: Backport - [https://git.gnome.org/browse/libxml2/commit/?id=94691dc884d1a8ada39f073408b4bb92fe7fe882]
+CVE: CVE-2017-5969
+Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
+
+diff --git a/valid.c b/valid.c
+index 19f84b8..0a8e58a 100644
+--- a/valid.c
++++ b/valid.c
+@@ -1172,29 +1172,33 @@ xmlDumpElementContent(xmlBufferPtr buf, xmlElementContentPtr content, int glob)
+ xmlBufferWriteCHAR(buf, content->name);
+ break;
+ case XML_ELEMENT_CONTENT_SEQ:
+- if ((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
+- (content->c1->type == XML_ELEMENT_CONTENT_SEQ))
++ if ((content->c1 != NULL) &&
++ ((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
++ (content->c1->type == XML_ELEMENT_CONTENT_SEQ)))
+ xmlDumpElementContent(buf, content->c1, 1);
+ else
+ xmlDumpElementContent(buf, content->c1, 0);
+ xmlBufferWriteChar(buf, " , ");
+- if ((content->c2->type == XML_ELEMENT_CONTENT_OR) ||
+- ((content->c2->type == XML_ELEMENT_CONTENT_SEQ) &&
+- (content->c2->ocur != XML_ELEMENT_CONTENT_ONCE)))
++ if ((content->c2 != NULL) &&
++ ((content->c2->type == XML_ELEMENT_CONTENT_OR) ||
++ ((content->c2->type == XML_ELEMENT_CONTENT_SEQ) &&
++ (content->c2->ocur != XML_ELEMENT_CONTENT_ONCE))))
+ xmlDumpElementContent(buf, content->c2, 1);
+ else
+ xmlDumpElementContent(buf, content->c2, 0);
+ break;
+ case XML_ELEMENT_CONTENT_OR:
+- if ((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
+- (content->c1->type == XML_ELEMENT_CONTENT_SEQ))
++ if ((content->c1 != NULL) &&
++ ((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
++ (content->c1->type == XML_ELEMENT_CONTENT_SEQ)))
+ xmlDumpElementContent(buf, content->c1, 1);
+ else
+ xmlDumpElementContent(buf, content->c1, 0);
+ xmlBufferWriteChar(buf, " | ");
+- if ((content->c2->type == XML_ELEMENT_CONTENT_SEQ) ||
+- ((content->c2->type == XML_ELEMENT_CONTENT_OR) &&
+- (content->c2->ocur != XML_ELEMENT_CONTENT_ONCE)))
++ if ((content->c2 != NULL) &&
++ ((content->c2->type == XML_ELEMENT_CONTENT_SEQ) ||
++ ((content->c2->type == XML_ELEMENT_CONTENT_OR) &&
++ (content->c2->ocur != XML_ELEMENT_CONTENT_ONCE))))
+ xmlDumpElementContent(buf, content->c2, 1);
+ else
+ xmlDumpElementContent(buf, content->c2, 0);
diff --git a/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-8872.patch b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-8872.patch
new file mode 100644
index 000000000..26779aa57
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-8872.patch
@@ -0,0 +1,37 @@
+From d2f873a541c72b0f67e15562819bf98b884b30b7 Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Wed, 23 Aug 2017 16:04:49 +0800
+Subject: [PATCH] fix CVE-2017-8872
+
+this makes xmlHaltParser "empty" the buffer, as it resets cur and ava
+il too here.
+
+this seems to cure this specific issue, and also passes the testsuite
+
+Signed-off-by: Marcus Meissner <meissner@suse.de>
+
+https://bugzilla.gnome.org/show_bug.cgi?id=775200
+Upstream-Status: Backport [https://bugzilla.gnome.org/attachment.cgi?id=355527&action=diff]
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ parser.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/parser.c b/parser.c
+index 9506ead..6c07ffd 100644
+--- a/parser.c
++++ b/parser.c
+@@ -12664,6 +12664,10 @@ xmlHaltParser(xmlParserCtxtPtr ctxt) {
+ }
+ ctxt->input->cur = BAD_CAST"";
+ ctxt->input->base = ctxt->input->cur;
++ if (ctxt->input->buf) {
++ xmlBufEmpty (ctxt->input->buf->buffer);
++ } else
++ ctxt->input->length = 0;
+ }
+ }
+
+--
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-9047_CVE-2017-9048.patch b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-9047_CVE-2017-9048.patch
new file mode 100644
index 000000000..8b034560f
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-9047_CVE-2017-9048.patch
@@ -0,0 +1,103 @@
+libxml2-2.9.4: Fix CVE-2017-9047 and CVE-2017-9048
+
+[No upstream tracking] -- https://bugzilla.gnome.org/show_bug.cgi?id=781333
+ -- https://bugzilla.gnome.org/show_bug.cgi?id=781701
+
+valid: Fix buffer size checks in xmlSnprintfElementContent
+
+xmlSnprintfElementContent failed to correctly check the available
+buffer space in two locations.
+
+Fixes bug 781333 and bug 781701
+
+Upstream-Status: Backport [https://git.gnome.org/browse/libxml2/commit/?id=932cc9896ab41475d4aa429c27d9afd175959d74]
+CVE: CVE-2017-9047 CVE-2017-9048
+Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
+
+diff --git a/result/valid/781333.xml b/result/valid/781333.xml
+new file mode 100644
+index 0000000..01baf11
+--- /dev/null
++++ b/result/valid/781333.xml
+@@ -0,0 +1,5 @@
++<?xml version="1.0"?>
++<!DOCTYPE a [
++<!ELEMENT a (pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp:llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll)>
++]>
++<a/>
+diff --git a/result/valid/781333.xml.err b/result/valid/781333.xml.err
+new file mode 100644
+index 0000000..2176200
+--- /dev/null
++++ b/result/valid/781333.xml.err
+@@ -0,0 +1,3 @@
++./test/valid/781333.xml:4: element a: validity error : Element a content does not follow the DTD, expecting ( ..., got
++<a/>
++ ^
+diff --git a/result/valid/781333.xml.err.rdr b/result/valid/781333.xml.err.rdr
+new file mode 100644
+index 0000000..1195a04
+--- /dev/null
++++ b/result/valid/781333.xml.err.rdr
+@@ -0,0 +1,6 @@
++./test/valid/781333.xml:4: element a: validity error : Element a content does not follow the DTD, expecting ( ..., got
++<a/>
++ ^
++./test/valid/781333.xml:5: element a: validity error : Element a content does not follow the DTD, Expecting more child
++
++^
+diff --git a/test/valid/781333.xml b/test/valid/781333.xml
+new file mode 100644
+index 0000000..bceac9c
+--- /dev/null
++++ b/test/valid/781333.xml
+@@ -0,0 +1,4 @@
++<!DOCTYPE a [
++ <!ELEMENT a (pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp:llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll)>
++]>
++<a/>
+diff --git a/valid.c b/valid.c
+index 19f84b8..aaa30f6 100644
+--- a/valid.c
++++ b/valid.c
+@@ -1262,22 +1262,23 @@ xmlSnprintfElementContent(char *buf, int size, xmlElementContentPtr content, int
+ case XML_ELEMENT_CONTENT_PCDATA:
+ strcat(buf, "#PCDATA");
+ break;
+- case XML_ELEMENT_CONTENT_ELEMENT:
++ case XML_ELEMENT_CONTENT_ELEMENT: {
++ int qnameLen = xmlStrlen(content->name);
++
++ if (content->prefix != NULL)
++ qnameLen += xmlStrlen(content->prefix) + 1;
++ if (size - len < qnameLen + 10) {
++ strcat(buf, " ...");
++ return;
++ }
+ if (content->prefix != NULL) {
+- if (size - len < xmlStrlen(content->prefix) + 10) {
+- strcat(buf, " ...");
+- return;
+- }
+ strcat(buf, (char *) content->prefix);
+ strcat(buf, ":");
+ }
+- if (size - len < xmlStrlen(content->name) + 10) {
+- strcat(buf, " ...");
+- return;
+- }
+ if (content->name != NULL)
+ strcat(buf, (char *) content->name);
+ break;
++ }
+ case XML_ELEMENT_CONTENT_SEQ:
+ if ((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
+ (content->c1->type == XML_ELEMENT_CONTENT_SEQ))
+@@ -1319,6 +1320,7 @@ xmlSnprintfElementContent(char *buf, int size, xmlElementContentPtr content, int
+ xmlSnprintfElementContent(buf, size, content->c2, 0);
+ break;
+ }
++ if (size - strlen(buf) <= 2) return;
+ if (englob)
+ strcat(buf, ")");
+ switch (content->ocur) {
diff --git a/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-9049_CVE-2017-9050.patch b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-9049_CVE-2017-9050.patch
new file mode 100644
index 000000000..591075de3
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-CVE-2017-9049_CVE-2017-9050.patch
@@ -0,0 +1,291 @@
+libxml2-2.9.4: Fix CVE-2017-9049 and CVE-2017-9050
+
+[No upstream tracking] -- https://bugzilla.gnome.org/show_bug.cgi?id=781205
+ -- https://bugzilla.gnome.org/show_bug.cgi?id=781361
+
+parser: Fix handling of parameter-entity references
+
+There were two bugs where parameter-entity references could lead to an
+unexpected change of the input buffer in xmlParseNameComplex and
+xmlDictLookup being called with an invalid pointer.
+
+Percent sign in DTD Names
+=========================
+
+The NEXTL macro used to call xmlParserHandlePEReference. When parsing
+"complex" names inside the DTD, this could result in entity expansion
+which created a new input buffer. The fix is to simply remove the call
+to xmlParserHandlePEReference from the NEXTL macro. This is safe because
+no users of the macro require expansion of parameter entities.
+
+- xmlParseNameComplex
+- xmlParseNCNameComplex
+- xmlParseNmtoken
+
+The percent sign is not allowed in names, which are grammatical tokens.
+
+- xmlParseEntityValue
+
+Parameter-entity references in entity values are expanded but this
+happens in a separate step in this function.
+
+- xmlParseSystemLiteral
+
+Parameter-entity references are ignored in the system literal.
+
+- xmlParseAttValueComplex
+- xmlParseCharDataComplex
+- xmlParseCommentComplex
+- xmlParsePI
+- xmlParseCDSect
+
+Parameter-entity references are ignored outside the DTD.
+
+- xmlLoadEntityContent
+
+This function is only called from xmlStringLenDecodeEntities and
+entities are replaced in a separate step immediately after the function
+call.
+
+This bug could also be triggered with an internal subset and double
+entity expansion.
+
+This fixes bug 766956 initially reported by Wei Lei and independently by
+Chromium's ClusterFuzz, Hanno Böck, and Marco Grassi. Thanks to everyone
+involved.
+
+xmlParseNameComplex with XML_PARSE_OLD10
+========================================
+
+When parsing Names inside an expanded parameter entity with the
+XML_PARSE_OLD10 option, xmlParseNameComplex would call xmlGROW via the
+GROW macro if the input buffer was exhausted. At the end of the
+parameter entity's replacement text, this function would then call
+xmlPopInput which invalidated the input buffer.
+
+There should be no need to invoke GROW in this situation because the
+buffer is grown periodically every XML_PARSER_CHUNK_SIZE characters and,
+at least for UTF-8, in xmlCurrentChar. This also matches the code path
+executed when XML_PARSE_OLD10 is not set.
+
+This fixes bugs 781205 (CVE-2017-9049) and 781361 (CVE-2017-9050).
+Thanks to Marcel Böhme and Thuan Pham for the report.
+
+Additional hardening
+====================
+
+A separate check was added in xmlParseNameComplex to validate the
+buffer size.
+
+Fixes bug 781205 and bug 781361
+
+Upstream-Status: Backport [https://git.gnome.org/browse/libxml2/commit/?id=932cc9896ab41475d4aa429c27d9afd175959d74]
+CVE: CVE-2017-9049 CVE-2017-9050
+Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
+
+diff --git a/Makefile.am b/Makefile.am
+index 9f988b0..dab15a4 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -422,6 +422,24 @@ Errtests : xmllint$(EXEEXT)
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
+ rm result.$$name error.$$name ; \
+ fi ; fi ; done)
++ @echo "## Error cases regression tests (old 1.0)"
++ -@(for i in $(srcdir)/test/errors10/*.xml ; do \
++ name=`basename $$i`; \
++ if [ ! -d $$i ] ; then \
++ if [ ! -f $(srcdir)/result/errors10/$$name ] ; then \
++ echo New test file $$name ; \
++ $(CHECKER) $(top_builddir)/xmllint --oldxml10 $$i \
++ 2> $(srcdir)/result/errors10/$$name.err \
++ > $(srcdir)/result/errors10/$$name ; \
++ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
++ else \
++ log=`$(CHECKER) $(top_builddir)/xmllint --oldxml10 $$i 2> error.$$name > result.$$name ; \
++ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
++ diff $(srcdir)/result/errors10/$$name result.$$name ; \
++ diff $(srcdir)/result/errors10/$$name.err error.$$name` ; \
++ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
++ rm result.$$name error.$$name ; \
++ fi ; fi ; done)
+ @echo "## Error cases stream regression tests"
+ -@(for i in $(srcdir)/test/errors/*.xml ; do \
+ name=`basename $$i`; \
+diff --git a/parser.c b/parser.c
+index 609a270..8e11c12 100644
+--- a/parser.c
++++ b/parser.c
+@@ -2115,7 +2115,6 @@ static void xmlGROW (xmlParserCtxtPtr ctxt) {
+ ctxt->input->line++; ctxt->input->col = 1; \
+ } else ctxt->input->col++; \
+ ctxt->input->cur += l; \
+- if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \
+ } while (0)
+
+ #define CUR_CHAR(l) xmlCurrentChar(ctxt, &l)
+@@ -3406,13 +3405,6 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
+ len += l;
+ NEXTL(l);
+ c = CUR_CHAR(l);
+- if (c == 0) {
+- count = 0;
+- GROW;
+- if (ctxt->instate == XML_PARSER_EOF)
+- return(NULL);
+- c = CUR_CHAR(l);
+- }
+ }
+ }
+ if ((len > XML_MAX_NAME_LENGTH) &&
+@@ -3420,6 +3412,16 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
+ xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Name");
+ return(NULL);
+ }
++ if (ctxt->input->cur - ctxt->input->base < len) {
++ /*
++ * There were a couple of bugs where PERefs lead to to a change
++ * of the buffer. Check the buffer size to avoid passing an invalid
++ * pointer to xmlDictLookup.
++ */
++ xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
++ "unexpected change of input buffer");
++ return (NULL);
++ }
+ if ((*ctxt->input->cur == '\n') && (ctxt->input->cur[-1] == '\r'))
+ return(xmlDictLookup(ctxt->dict, ctxt->input->cur - (len + 1), len));
+ return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len));
+diff --git a/result/errors10/781205.xml b/result/errors10/781205.xml
+new file mode 100644
+index 0000000..e69de29
+diff --git a/result/errors10/781205.xml.err b/result/errors10/781205.xml.err
+new file mode 100644
+index 0000000..da15c3f
+--- /dev/null
++++ b/result/errors10/781205.xml.err
+@@ -0,0 +1,21 @@
++Entity: line 1: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
++
++ %a;
++ ^
++Entity: line 1:
++<:0000
++^
++Entity: line 1: parser error : DOCTYPE improperly terminated
++ %a;
++ ^
++Entity: line 1:
++<:0000
++^
++namespace error : Failed to parse QName ':0000'
++ %a;
++ ^
++<:0000
++ ^
++./test/errors10/781205.xml:4: parser error : Couldn't find end of Start Tag :0000 line 1
++
++^
+diff --git a/result/errors10/781361.xml b/result/errors10/781361.xml
+new file mode 100644
+index 0000000..e69de29
+diff --git a/result/errors10/781361.xml.err b/result/errors10/781361.xml.err
+new file mode 100644
+index 0000000..655f41a
+--- /dev/null
++++ b/result/errors10/781361.xml.err
+@@ -0,0 +1,13 @@
++./test/errors10/781361.xml:4: parser error : xmlParseElementDecl: 'EMPTY', 'ANY' or '(' expected
++
++^
++./test/errors10/781361.xml:4: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
++
++
++^
++./test/errors10/781361.xml:4: parser error : DOCTYPE improperly terminated
++
++^
++./test/errors10/781361.xml:4: parser error : Start tag expected, '<' not found
++
++^
+diff --git a/result/valid/766956.xml b/result/valid/766956.xml
+new file mode 100644
+index 0000000..e69de29
+diff --git a/result/valid/766956.xml.err b/result/valid/766956.xml.err
+new file mode 100644
+index 0000000..34b1dae
+--- /dev/null
++++ b/result/valid/766956.xml.err
+@@ -0,0 +1,9 @@
++test/valid/dtds/766956.dtd:2: parser error : PEReference: expecting ';'
++%ä%ent;
++ ^
++Entity: line 1: parser error : Content error in the external subset
++ %ent;
++ ^
++Entity: line 1:
++value
++^
+diff --git a/result/valid/766956.xml.err.rdr b/result/valid/766956.xml.err.rdr
+new file mode 100644
+index 0000000..7760346
+--- /dev/null
++++ b/result/valid/766956.xml.err.rdr
+@@ -0,0 +1,10 @@
++test/valid/dtds/766956.dtd:2: parser error : PEReference: expecting ';'
++%ä%ent;
++ ^
++Entity: line 1: parser error : Content error in the external subset
++ %ent;
++ ^
++Entity: line 1:
++value
++^
++./test/valid/766956.xml : failed to parse
+diff --git a/runtest.c b/runtest.c
+index bb74d2a..63e8c20 100644
+--- a/runtest.c
++++ b/runtest.c
+@@ -4202,6 +4202,9 @@ testDesc testDescriptions[] = {
+ { "Error cases regression tests",
+ errParseTest, "./test/errors/*.xml", "result/errors/", "", ".err",
+ 0 },
++ { "Error cases regression tests (old 1.0)",
++ errParseTest, "./test/errors10/*.xml", "result/errors10/", "", ".err",
++ XML_PARSE_OLD10 },
+ #ifdef LIBXML_READER_ENABLED
+ { "Error cases stream regression tests",
+ streamParseTest, "./test/errors/*.xml", "result/errors/", NULL, ".str",
+diff --git a/test/errors10/781205.xml b/test/errors10/781205.xml
+new file mode 100644
+index 0000000..d9e9e83
+--- /dev/null
++++ b/test/errors10/781205.xml
+@@ -0,0 +1,3 @@
++<!DOCTYPE D [
++ <!ENTITY % a "<:0000">
++ %a;
+diff --git a/test/errors10/781361.xml b/test/errors10/781361.xml
+new file mode 100644
+index 0000000..67476bc
+--- /dev/null
++++ b/test/errors10/781361.xml
+@@ -0,0 +1,3 @@
++<!DOCTYPE doc [
++ <!ENTITY % elem "<!ELEMENT e0000000000">
++ %elem;
+diff --git a/test/valid/766956.xml b/test/valid/766956.xml
+new file mode 100644
+index 0000000..19a95a0
+--- /dev/null
++++ b/test/valid/766956.xml
+@@ -0,0 +1,2 @@
++<!DOCTYPE test SYSTEM "dtds/766956.dtd">
++<test/>
+diff --git a/test/valid/dtds/766956.dtd b/test/valid/dtds/766956.dtd
+new file mode 100644
+index 0000000..dddde68
+--- /dev/null
++++ b/test/valid/dtds/766956.dtd
+@@ -0,0 +1,2 @@
++<!ENTITY % ent "value">
++%ä%ent;
diff --git a/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-fix_and_simplify_xmlParseStartTag2.patch b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-fix_and_simplify_xmlParseStartTag2.patch
new file mode 100644
index 000000000..faa57701f
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/libxml2-fix_and_simplify_xmlParseStartTag2.patch
@@ -0,0 +1,590 @@
+libxml2-2.9.4: Avoid reparsing and simplify control flow in xmlParseStartTag2
+
+[No upstream tracking]
+
+parser: Avoid reparsing in xmlParseStartTag2
+
+The code in xmlParseStartTag2 must handle the case that the input
+buffer was grown and reallocated which can invalidate pointers to
+attribute values. Before, this was handled by detecting changes of
+the input buffer "base" pointer and, in case of a change, jumping
+back to the beginning of the function and reparsing the start tag.
+
+The major problem of this approach is that whether an input buffer is
+reallocated is nondeterministic, resulting in seemingly random test
+failures. See the mailing list thread "runtest mystery bug: name2.xml
+error case regression test" from 2012, for example.
+
+If a reallocation was detected, the code also made no attempts to
+continue parsing in case of errors which makes a difference in
+the lax "recover" mode.
+
+Now we store the current input buffer "base" pointer for each (not
+separately allocated) attribute in the namespace URI field, which isn't
+used until later. After the whole start tag was parsed, the pointers to
+the attribute values are reconstructed using the offset between the
+new and the old input buffer. This relies on arithmetic on dangling
+pointers which is technically undefined behavior. But it seems like
+the easiest and most efficient fix and a similar approach is used in
+xmlParserInputGrow.
+
+This changes the error output of several tests, typically making it
+more verbose because we try harder to continue parsing in case of errors.
+
+(Another possible solution is to check not only the "base" pointer
+but the size of the input buffer as well. But this would result in
+even more reparsing.)
+
+Remove some goto labels and deduplicate a bit of code after handling
+namespaces.
+
+There were two bugs where parameter-entity references could lead to an
+unexpected change of the input buffer in xmlParseNameComplex and
+xmlDictLookup being called with an invalid pointer.
+
+
+Upstream-Status: Backport
+ - [https://git.gnome.org/browse/libxml2/commit/?id=07b7428b69c368611d215a140fe630b2d1e61349]
+ - [https://git.gnome.org/browse/libxml2/commit/?id=855c19efb7cd30d927d673b3658563c4959ca6f0]
+Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
+
+diff --git a/parser.c b/parser.c
+index 609a270..74016e3 100644
+--- a/parser.c
++++ b/parser.c
+@@ -43,6 +43,7 @@
+ #include <limits.h>
+ #include <string.h>
+ #include <stdarg.h>
++#include <stddef.h>
+ #include <libxml/xmlmemory.h>
+ #include <libxml/threads.h>
+ #include <libxml/globals.h>
+@@ -9377,8 +9378,7 @@ xmlParseStartTag2(xmlParserCtxtPtr ctxt, const xmlChar **pref,
+ const xmlChar **atts = ctxt->atts;
+ int maxatts = ctxt->maxatts;
+ int nratts, nbatts, nbdef;
+- int i, j, nbNs, attval, oldline, oldcol, inputNr;
+- const xmlChar *base;
++ int i, j, nbNs, attval;
+ unsigned long cur;
+ int nsNr = ctxt->nsNr;
+
+@@ -9392,13 +9392,8 @@ xmlParseStartTag2(xmlParserCtxtPtr ctxt, const xmlChar **pref,
+ * The Shrinking is only possible once the full set of attribute
+ * callbacks have been done.
+ */
+-reparse:
+ SHRINK;
+- base = ctxt->input->base;
+ cur = ctxt->input->cur - ctxt->input->base;
+- inputNr = ctxt->inputNr;
+- oldline = ctxt->input->line;
+- oldcol = ctxt->input->col;
+ nbatts = 0;
+ nratts = 0;
+ nbdef = 0;
+@@ -9422,8 +9417,6 @@ reparse:
+ */
+ SKIP_BLANKS;
+ GROW;
+- if ((ctxt->input->base != base) || (inputNr != ctxt->inputNr))
+- goto base_changed;
+
+ while (((RAW != '>') &&
+ ((RAW != '/') || (NXT(1) != '>')) &&
+@@ -9434,203 +9427,174 @@ reparse:
+
+ attname = xmlParseAttribute2(ctxt, prefix, localname,
+ &aprefix, &attvalue, &len, &alloc);
+- if ((ctxt->input->base != base) || (inputNr != ctxt->inputNr)) {
+- if ((attvalue != NULL) && (alloc != 0))
+- xmlFree(attvalue);
+- attvalue = NULL;
+- goto base_changed;
+- }
+- if ((attname != NULL) && (attvalue != NULL)) {
+- if (len < 0) len = xmlStrlen(attvalue);
+- if ((attname == ctxt->str_xmlns) && (aprefix == NULL)) {
+- const xmlChar *URL = xmlDictLookup(ctxt->dict, attvalue, len);
+- xmlURIPtr uri;
+-
+- if (URL == NULL) {
+- xmlErrMemory(ctxt, "dictionary allocation failure");
+- if ((attvalue != NULL) && (alloc != 0))
+- xmlFree(attvalue);
+- return(NULL);
+- }
+- if (*URL != 0) {
+- uri = xmlParseURI((const char *) URL);
+- if (uri == NULL) {
+- xmlNsErr(ctxt, XML_WAR_NS_URI,
+- "xmlns: '%s' is not a valid URI\n",
+- URL, NULL, NULL);
+- } else {
+- if (uri->scheme == NULL) {
+- xmlNsWarn(ctxt, XML_WAR_NS_URI_RELATIVE,
+- "xmlns: URI %s is not absolute\n",
+- URL, NULL, NULL);
+- }
+- xmlFreeURI(uri);
+- }
+- if (URL == ctxt->str_xml_ns) {
+- if (attname != ctxt->str_xml) {
+- xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
+- "xml namespace URI cannot be the default namespace\n",
+- NULL, NULL, NULL);
+- }
+- goto skip_default_ns;
+- }
+- if ((len == 29) &&
+- (xmlStrEqual(URL,
+- BAD_CAST "http://www.w3.org/2000/xmlns/"))) {
+- xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
+- "reuse of the xmlns namespace name is forbidden\n",
+- NULL, NULL, NULL);
+- goto skip_default_ns;
+- }
+- }
+- /*
+- * check that it's not a defined namespace
+- */
+- for (j = 1;j <= nbNs;j++)
+- if (ctxt->nsTab[ctxt->nsNr - 2 * j] == NULL)
+- break;
+- if (j <= nbNs)
+- xmlErrAttributeDup(ctxt, NULL, attname);
+- else
+- if (nsPush(ctxt, NULL, URL) > 0) nbNs++;
+-skip_default_ns:
+- if ((attvalue != NULL) && (alloc != 0)) {
+- xmlFree(attvalue);
+- attvalue = NULL;
+- }
+- if ((RAW == '>') || (((RAW == '/') && (NXT(1) == '>'))))
+- break;
+- if (!IS_BLANK_CH(RAW)) {
+- xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
+- "attributes construct error\n");
+- break;
+- }
+- SKIP_BLANKS;
+- if ((ctxt->input->base != base) || (inputNr != ctxt->inputNr))
+- goto base_changed;
+- continue;
+- }
+- if (aprefix == ctxt->str_xmlns) {
+- const xmlChar *URL = xmlDictLookup(ctxt->dict, attvalue, len);
+- xmlURIPtr uri;
+-
+- if (attname == ctxt->str_xml) {
+- if (URL != ctxt->str_xml_ns) {
+- xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
+- "xml namespace prefix mapped to wrong URI\n",
+- NULL, NULL, NULL);
+- }
+- /*
+- * Do not keep a namespace definition node
+- */
+- goto skip_ns;
+- }
++ if ((attname == NULL) || (attvalue == NULL))
++ goto next_attr;
++ if (len < 0) len = xmlStrlen(attvalue);
++
++ if ((attname == ctxt->str_xmlns) && (aprefix == NULL)) {
++ const xmlChar *URL = xmlDictLookup(ctxt->dict, attvalue, len);
++ xmlURIPtr uri;
++
++ if (URL == NULL) {
++ xmlErrMemory(ctxt, "dictionary allocation failure");
++ if ((attvalue != NULL) && (alloc != 0))
++ xmlFree(attvalue);
++ return(NULL);
++ }
++ if (*URL != 0) {
++ uri = xmlParseURI((const char *) URL);
++ if (uri == NULL) {
++ xmlNsErr(ctxt, XML_WAR_NS_URI,
++ "xmlns: '%s' is not a valid URI\n",
++ URL, NULL, NULL);
++ } else {
++ if (uri->scheme == NULL) {
++ xmlNsWarn(ctxt, XML_WAR_NS_URI_RELATIVE,
++ "xmlns: URI %s is not absolute\n",
++ URL, NULL, NULL);
++ }
++ xmlFreeURI(uri);
++ }
+ if (URL == ctxt->str_xml_ns) {
+- if (attname != ctxt->str_xml) {
+- xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
+- "xml namespace URI mapped to wrong prefix\n",
+- NULL, NULL, NULL);
+- }
+- goto skip_ns;
+- }
+- if (attname == ctxt->str_xmlns) {
+- xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
+- "redefinition of the xmlns prefix is forbidden\n",
+- NULL, NULL, NULL);
+- goto skip_ns;
+- }
+- if ((len == 29) &&
+- (xmlStrEqual(URL,
+- BAD_CAST "http://www.w3.org/2000/xmlns/"))) {
+- xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
+- "reuse of the xmlns namespace name is forbidden\n",
+- NULL, NULL, NULL);
+- goto skip_ns;
+- }
+- if ((URL == NULL) || (URL[0] == 0)) {
+- xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
+- "xmlns:%s: Empty XML namespace is not allowed\n",
+- attname, NULL, NULL);
+- goto skip_ns;
+- } else {
+- uri = xmlParseURI((const char *) URL);
+- if (uri == NULL) {
+- xmlNsErr(ctxt, XML_WAR_NS_URI,
+- "xmlns:%s: '%s' is not a valid URI\n",
+- attname, URL, NULL);
+- } else {
+- if ((ctxt->pedantic) && (uri->scheme == NULL)) {
+- xmlNsWarn(ctxt, XML_WAR_NS_URI_RELATIVE,
+- "xmlns:%s: URI %s is not absolute\n",
+- attname, URL, NULL);
+- }
+- xmlFreeURI(uri);
+- }
+- }
+-
+- /*
+- * check that it's not a defined namespace
+- */
+- for (j = 1;j <= nbNs;j++)
+- if (ctxt->nsTab[ctxt->nsNr - 2 * j] == attname)
+- break;
+- if (j <= nbNs)
+- xmlErrAttributeDup(ctxt, aprefix, attname);
+- else
+- if (nsPush(ctxt, attname, URL) > 0) nbNs++;
+-skip_ns:
+- if ((attvalue != NULL) && (alloc != 0)) {
+- xmlFree(attvalue);
+- attvalue = NULL;
+- }
+- if ((RAW == '>') || (((RAW == '/') && (NXT(1) == '>'))))
+- break;
+- if (!IS_BLANK_CH(RAW)) {
+- xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
+- "attributes construct error\n");
+- break;
+- }
+- SKIP_BLANKS;
+- if ((ctxt->input->base != base) || (inputNr != ctxt->inputNr))
+- goto base_changed;
+- continue;
+- }
++ if (attname != ctxt->str_xml) {
++ xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
++ "xml namespace URI cannot be the default namespace\n",
++ NULL, NULL, NULL);
++ }
++ goto next_attr;
++ }
++ if ((len == 29) &&
++ (xmlStrEqual(URL,
++ BAD_CAST "http://www.w3.org/2000/xmlns/"))) {
++ xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
++ "reuse of the xmlns namespace name is forbidden\n",
++ NULL, NULL, NULL);
++ goto next_attr;
++ }
++ }
++ /*
++ * check that it's not a defined namespace
++ */
++ for (j = 1;j <= nbNs;j++)
++ if (ctxt->nsTab[ctxt->nsNr - 2 * j] == NULL)
++ break;
++ if (j <= nbNs)
++ xmlErrAttributeDup(ctxt, NULL, attname);
++ else
++ if (nsPush(ctxt, NULL, URL) > 0) nbNs++;
++
++ } else if (aprefix == ctxt->str_xmlns) {
++ const xmlChar *URL = xmlDictLookup(ctxt->dict, attvalue, len);
++ xmlURIPtr uri;
++
++ if (attname == ctxt->str_xml) {
++ if (URL != ctxt->str_xml_ns) {
++ xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
++ "xml namespace prefix mapped to wrong URI\n",
++ NULL, NULL, NULL);
++ }
++ /*
++ * Do not keep a namespace definition node
++ */
++ goto next_attr;
++ }
++ if (URL == ctxt->str_xml_ns) {
++ if (attname != ctxt->str_xml) {
++ xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
++ "xml namespace URI mapped to wrong prefix\n",
++ NULL, NULL, NULL);
++ }
++ goto next_attr;
++ }
++ if (attname == ctxt->str_xmlns) {
++ xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
++ "redefinition of the xmlns prefix is forbidden\n",
++ NULL, NULL, NULL);
++ goto next_attr;
++ }
++ if ((len == 29) &&
++ (xmlStrEqual(URL,
++ BAD_CAST "http://www.w3.org/2000/xmlns/"))) {
++ xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
++ "reuse of the xmlns namespace name is forbidden\n",
++ NULL, NULL, NULL);
++ goto next_attr;
++ }
++ if ((URL == NULL) || (URL[0] == 0)) {
++ xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
++ "xmlns:%s: Empty XML namespace is not allowed\n",
++ attname, NULL, NULL);
++ goto next_attr;
++ } else {
++ uri = xmlParseURI((const char *) URL);
++ if (uri == NULL) {
++ xmlNsErr(ctxt, XML_WAR_NS_URI,
++ "xmlns:%s: '%s' is not a valid URI\n",
++ attname, URL, NULL);
++ } else {
++ if ((ctxt->pedantic) && (uri->scheme == NULL)) {
++ xmlNsWarn(ctxt, XML_WAR_NS_URI_RELATIVE,
++ "xmlns:%s: URI %s is not absolute\n",
++ attname, URL, NULL);
++ }
++ xmlFreeURI(uri);
++ }
++ }
+
+- /*
+- * Add the pair to atts
+- */
+- if ((atts == NULL) || (nbatts + 5 > maxatts)) {
+- if (xmlCtxtGrowAttrs(ctxt, nbatts + 5) < 0) {
+- if (attvalue[len] == 0)
+- xmlFree(attvalue);
+- goto failed;
+- }
+- maxatts = ctxt->maxatts;
+- atts = ctxt->atts;
+- }
+- ctxt->attallocs[nratts++] = alloc;
+- atts[nbatts++] = attname;
+- atts[nbatts++] = aprefix;
+- atts[nbatts++] = NULL; /* the URI will be fetched later */
+- atts[nbatts++] = attvalue;
+- attvalue += len;
+- atts[nbatts++] = attvalue;
+- /*
+- * tag if some deallocation is needed
+- */
+- if (alloc != 0) attval = 1;
+- } else {
+- if ((attvalue != NULL) && (attvalue[len] == 0))
+- xmlFree(attvalue);
+- }
++ /*
++ * check that it's not a defined namespace
++ */
++ for (j = 1;j <= nbNs;j++)
++ if (ctxt->nsTab[ctxt->nsNr - 2 * j] == attname)
++ break;
++ if (j <= nbNs)
++ xmlErrAttributeDup(ctxt, aprefix, attname);
++ else
++ if (nsPush(ctxt, attname, URL) > 0) nbNs++;
++
++ } else {
++ /*
++ * Add the pair to atts
++ */
++ if ((atts == NULL) || (nbatts + 5 > maxatts)) {
++ if (xmlCtxtGrowAttrs(ctxt, nbatts + 5) < 0) {
++ goto next_attr;
++ }
++ maxatts = ctxt->maxatts;
++ atts = ctxt->atts;
++ }
++ ctxt->attallocs[nratts++] = alloc;
++ atts[nbatts++] = attname;
++ atts[nbatts++] = aprefix;
++ /*
++ * The namespace URI field is used temporarily to point at the
++ * base of the current input buffer for non-alloced attributes.
++ * When the input buffer is reallocated, all the pointers become
++ * invalid, but they can be reconstructed later.
++ */
++ if (alloc)
++ atts[nbatts++] = NULL;
++ else
++ atts[nbatts++] = ctxt->input->base;
++ atts[nbatts++] = attvalue;
++ attvalue += len;
++ atts[nbatts++] = attvalue;
++ /*
++ * tag if some deallocation is needed
++ */
++ if (alloc != 0) attval = 1;
++ attvalue = NULL; /* moved into atts */
++ }
+
+-failed:
++next_attr:
++ if ((attvalue != NULL) && (alloc != 0)) {
++ xmlFree(attvalue);
++ attvalue = NULL;
++ }
+
+ GROW
+ if (ctxt->instate == XML_PARSER_EOF)
+ break;
+- if ((ctxt->input->base != base) || (inputNr != ctxt->inputNr))
+- goto base_changed;
+ if ((RAW == '>') || (((RAW == '/') && (NXT(1) == '>'))))
+ break;
+ if (!IS_BLANK_CH(RAW)) {
+@@ -9646,8 +9610,20 @@ failed:
+ break;
+ }
+ GROW;
+- if ((ctxt->input->base != base) || (inputNr != ctxt->inputNr))
+- goto base_changed;
++ }
++
++ /* Reconstruct attribute value pointers. */
++ for (i = 0, j = 0; j < nratts; i += 5, j++) {
++ if (atts[i+2] != NULL) {
++ /*
++ * Arithmetic on dangling pointers is technically undefined
++ * behavior, but well...
++ */
++ ptrdiff_t offset = ctxt->input->base - atts[i+2];
++ atts[i+2] = NULL; /* Reset repurposed namespace URI */
++ atts[i+3] += offset; /* value */
++ atts[i+4] += offset; /* valuend */
++ }
+ }
+
+ /*
+@@ -9804,34 +9780,6 @@ failed:
+ }
+
+ return(localname);
+-
+-base_changed:
+- /*
+- * the attribute strings are valid iif the base didn't changed
+- */
+- if (attval != 0) {
+- for (i = 3,j = 0; j < nratts;i += 5,j++)
+- if ((ctxt->attallocs[j] != 0) && (atts[i] != NULL))
+- xmlFree((xmlChar *) atts[i]);
+- }
+-
+- /*
+- * We can't switch from one entity to another in the middle
+- * of a start tag
+- */
+- if (inputNr != ctxt->inputNr) {
+- xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
+- "Start tag doesn't start and stop in the same entity\n");
+- return(NULL);
+- }
+-
+- ctxt->input->cur = ctxt->input->base + cur;
+- ctxt->input->line = oldline;
+- ctxt->input->col = oldcol;
+- if (ctxt->wellFormed == 1) {
+- goto reparse;
+- }
+- return(NULL);
+ }
+
+ /**
+diff --git a/result/errors/759398.xml.err b/result/errors/759398.xml.err
+index e08d9bf..f6036a3 100644
+--- a/result/errors/759398.xml.err
++++ b/result/errors/759398.xml.err
+@@ -1,9 +1,12 @@
+ ./test/errors/759398.xml:210: parser error : StartTag: invalid element name
+ need to worry about parsers whi<! don't expand PErefs finding
+ ^
+-./test/errors/759398.xml:309: parser error : Opening and ending tag mismatch: spec line 50 and termdef
++./test/errors/759398.xml:309: parser error : Opening and ending tag mismatch: №№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№№m line 308 and termdef
+ and provide access to their content and structure.</termdef> <termdef
+ ^
+-./test/errors/759398.xml:309: parser error : Extra content at the end of the document
+-and provide access to their content and structure.</termdef> <termdef
+- ^
++./test/errors/759398.xml:314: parser error : Opening and ending tag mismatch: spec line 50 and p
++data and the information it must provide to the application.</p>
++ ^
++./test/errors/759398.xml:316: parser error : Extra content at the end of the document
++<div2 id='sec-origin-goals'>
++^
+diff --git a/result/errors/attr1.xml.err b/result/errors/attr1.xml.err
+index 4f08538..c4c4fc8 100644
+--- a/result/errors/attr1.xml.err
++++ b/result/errors/attr1.xml.err
+@@ -1,6 +1,9 @@
+ ./test/errors/attr1.xml:2: parser error : AttValue: ' expected
+
+ ^
+-./test/errors/attr1.xml:1: parser error : Extra content at the end of the document
+-<foo foo="oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
+- ^
++./test/errors/attr1.xml:2: parser error : attributes construct error
++
++^
++./test/errors/attr1.xml:2: parser error : Couldn't find end of Start Tag foo line 1
++
++^
+diff --git a/result/errors/attr2.xml.err b/result/errors/attr2.xml.err
+index c8a9c7d..77e342e 100644
+--- a/result/errors/attr2.xml.err
++++ b/result/errors/attr2.xml.err
+@@ -1,6 +1,9 @@
+ ./test/errors/attr2.xml:2: parser error : AttValue: ' expected
+
+ ^
+-./test/errors/attr2.xml:1: parser error : Extra content at the end of the document
+-<foo foo=">ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
+- ^
++./test/errors/attr2.xml:2: parser error : attributes construct error
++
++^
++./test/errors/attr2.xml:2: parser error : Couldn't find end of Start Tag foo line 1
++
++^
+diff --git a/result/errors/name2.xml.err b/result/errors/name2.xml.err
+index a6649a1..8a6acee 100644
+--- a/result/errors/name2.xml.err
++++ b/result/errors/name2.xml.err
+@@ -1,6 +1,9 @@
+ ./test/errors/name2.xml:2: parser error : Specification mandate value for attribute foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
+
+ ^
+-./test/errors/name2.xml:1: parser error : Extra content at the end of the document
+-<foo foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
+- ^
++./test/errors/name2.xml:2: parser error : attributes construct error
++
++^
++./test/errors/name2.xml:2: parser error : Couldn't find end of Start Tag foo line 1
++
++^
diff --git a/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/runtest.patch b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/runtest.patch
index 397ab20c3..6e56857ca 100644
--- a/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/runtest.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2/runtest.patch
@@ -2,12 +2,13 @@ Add 'install-ptest' rule.
Print a standard result line for each test.
Signed-off-by: Mihaela Sendrea <mihaela.sendrea@enea.com>
-Upstream-Status: Pending
+Signed-off-by: Andrej Valek <andrej.valek@enea.com>
+Upstream-Status: Backport
diff -uNr a/Makefile.am b/Makefile.am
---- a/Makefile.am 2013-04-17 14:51:42.633386477 +0200
-+++ b/Makefile.am 2013-04-19 14:47:51.544720568 +0200
-@@ -202,10 +202,19 @@
+--- a/Makefile.am 2016-05-22 03:49:02.000000000 +0200
++++ b/Makefile.am 2017-06-14 10:38:43.381305385 +0200
+@@ -202,10 +202,24 @@
#testOOM_DEPENDENCIES = $(DEPS)
#testOOM_LDADD= $(LDADDS)
@@ -24,10 +25,24 @@ diff -uNr a/Makefile.am b/Makefile.am
[ -d test ] || $(LN_S) $(srcdir)/test .
[ -d result ] || $(LN_S) $(srcdir)/result .
- $(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testrecurse$(EXEEXT) &&$(CHECKER) ./testapi$(EXEEXT) && $(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT)
-+ ./runtest$(EXEEXT) ; ./testrecurse$(EXEEXT) ; ./testapi$(EXEEXT) ; ./testchar$(EXEEXT) ; ./testdict$(EXEEXT) ; ./runxmlconf$(EXEEXT)
++ $(CHECKER) ./runtest$(EXEEXT) && \
++ $(CHECKER) ./testrecurse$(EXEEXT) && \
++ ASAN_OPTIONS="$$ASAN_OPTIONS:detect_leaks=0" $(CHECKER) ./testapi$(EXEEXT) && \
++ $(CHECKER) ./testchar$(EXEEXT) && \
++ $(CHECKER) ./testdict$(EXEEXT) && \
++ $(CHECKER) ./runxmlconf$(EXEEXT)
@(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \
$(MAKE) tests ; fi)
+@@ -229,7 +243,7 @@
+
+ APItests: testapi$(EXEEXT)
+ @echo "## Running the API regression tests this may take a little while"
+- -@($(CHECKER) $(top_builddir)/testapi -q)
++ -@(ASAN_OPTIONS="$$ASAN_OPTIONS:detect_leaks=0" $(CHECKER) $(top_builddir)/testapi -q)
+
+ HTMLtests : testHTML$(EXEEXT)
+ @(echo > .memdump)
diff -uNr a/runsuite.c b/runsuite.c
--- a/runsuite.c 2013-04-12 16:17:11.462823238 +0200
+++ b/runsuite.c 2013-04-17 14:07:24.352693211 +0200
diff --git a/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2_2.9.4.bb b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2_2.9.4.bb
index c2c3c9326..107539b50 100644
--- a/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2_2.9.4.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/libxml/libxml2_2.9.4.bb
@@ -23,8 +23,14 @@ SRC_URI = "ftp://xmlsoft.org/libxml2/libxml2-${PV}.tar.gz;name=libtar \
file://libxml2-CVE-2016-5131.patch \
file://libxml2-CVE-2016-4658.patch \
file://libxml2-fix_NULL_pointer_derefs.patch \
- file://CVE-2016-9318.patch \
- "
+ file://libxml2-fix_and_simplify_xmlParseStartTag2.patch \
+ file://libxml2-CVE-2017-9047_CVE-2017-9048.patch \
+ file://libxml2-CVE-2017-9049_CVE-2017-9050.patch \
+ file://libxml2-CVE-2017-5969.patch \
+ file://libxml2-CVE-2017-0663.patch \
+ file://libxml2-CVE-2017-8872.patch \
+ file://0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch \
+ "
SRC_URI[libtar.md5sum] = "ae249165c173b1ff386ee8ad676815f5"
SRC_URI[libtar.sha256sum] = "ffb911191e509b966deb55de705387f14156e1a56b21824357cdf0053233633c"
@@ -33,22 +39,24 @@ SRC_URI[testtar.sha256sum] = "96151685cec997e1f9f3387e3626d61e6284d4d6e66e0e440c
BINCONFIG = "${bindir}/xml2-config"
-inherit autotools pkgconfig binconfig-disabled pythonnative ptest
+PACKAGECONFIG ??= "python \
+ ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \
+"
+PACKAGECONFIG[python] = "--with-python=${PYTHON},--without-python,python3"
+PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
-RDEPENDS_${PN}-ptest += "python-core"
+inherit autotools pkgconfig binconfig-disabled ptest
-RDEPENDS_${PN}-python += "python-core"
+inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3native', '', d)}
+
+RDEPENDS_${PN}-ptest += "make ${@bb.utils.contains('PACKAGECONFIG', 'python', 'libgcc python3-core python3-argparse python3-logging python3-shell python3-signal python3-stringold python3-threading python3-unittest ${PN}-python', '', d)}"
+
+RDEPENDS_${PN}-python += "${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3-core', '', d)}"
RDEPENDS_${PN}-ptest_append_libc-glibc = " glibc-gconv-ebcdic-us glibc-gconv-ibm1141"
export PYTHON_SITE_PACKAGES="${PYTHON_SITEPACKAGES_DIR}"
-PACKAGECONFIG ??= "python \
- ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'ipv6', '', d)} \
-"
-PACKAGECONFIG[python] = "--with-python=${PYTHON},--without-python,python"
-PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
-
# WARNING: zlib is require for RPM use
EXTRA_OECONF = "--without-debug --without-legacy --with-catalog --without-docbook --with-c14n --without-lzma --with-fexceptions"
EXTRA_OECONF_class-native = "--without-legacy --without-docbook --with-c14n --without-lzma --with-zlib"
@@ -57,7 +65,7 @@ EXTRA_OECONF_linuxstdbase = "--with-debug --with-legacy --with-docbook --with-c1
python populate_packages_prepend () {
# autonamer would call this libxml2-2, but we don't want that
- if d.getVar('DEBIAN_NAMES', True):
+ if d.getVar('DEBIAN_NAMES'):
d.setVar('PKG_libxml2', '${MLPREFIX}libxml2')
}
@@ -75,6 +83,17 @@ do_configure_prepend () {
do_install_ptest () {
cp -r ${WORKDIR}/xmlconf ${D}${PTEST_PATH}
+ if [ "${@bb.utils.filter('PACKAGECONFIG', 'python', d)}" ]; then
+ sed -i -e 's|^\(PYTHON = \).*|\1${USRBINPATH}/${PYTHON_PN}|' \
+ ${D}${PTEST_PATH}/python/tests/Makefile
+ grep -lrZ '#!/usr/bin/python' ${D}${PTEST_PATH}/python |
+ xargs -0 sed -i -e 's|/usr/bin/python|${USRBINPATH}/${PYTHON_PN}|'
+ fi
+}
+
+do_install_append_class-native () {
+ # Docs are not needed in the native case
+ rm ${D}${datadir}/gtk-doc -rf
}
BBCLASSEXTEND = "native nativesdk"
diff --git a/import-layers/yocto-poky/meta/recipes-core/meta/build-sysroots.bb b/import-layers/yocto-poky/meta/recipes-core/meta/build-sysroots.bb
new file mode 100644
index 000000000..7a712e2f3
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/meta/build-sysroots.bb
@@ -0,0 +1,38 @@
+INHIBIT_DEFAULT_DEPS = "1"
+LICENSE = "MIT"
+
+STANDALONE_SYSROOT = "${STAGING_DIR}/${MACHINE}"
+STANDALONE_SYSROOT_NATIVE = "${STAGING_DIR}/${BUILD_ARCH}"
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+EXCLUDE_FROM_WORLD = "1"
+
+inherit nopackages
+deltask fetch
+deltask unpack
+deltask patch
+deltask prepare_recipe_sysroot
+deltask populate_lic
+deltask configure
+deltask compile
+deltask install
+deltask populate_sysroot
+
+python do_build_native_sysroot () {
+ targetsysroot = d.getVar("STANDALONE_SYSROOT")
+ nativesysroot = d.getVar("STANDALONE_SYSROOT_NATIVE")
+ staging_populate_sysroot_dir(targetsysroot, nativesysroot, True, d)
+}
+do_build_native_sysroot[cleandirs] = "${STANDALONE_SYSROOT_NATIVE}"
+do_build_native_sysroot[nostamp] = "1"
+addtask do_build_native_sysroot before do_build
+
+python do_build_target_sysroot () {
+ targetsysroot = d.getVar("STANDALONE_SYSROOT")
+ nativesysroot = d.getVar("STANDALONE_SYSROOT_NATIVE")
+ staging_populate_sysroot_dir(targetsysroot, nativesysroot, False, d)
+}
+do_build_target_sysroot[cleandirs] = "${STANDALONE_SYSROOT}"
+do_build_target_sysroot[nostamp] = "1"
+addtask do_build_target_sysroot before do_build
+
+do_clean[cleandirs] += "${STANDALONE_SYSROOT} ${STANDALONE_SYSROOT_NATIVE}"
diff --git a/import-layers/yocto-poky/meta/recipes-core/meta/buildtools-tarball.bb b/import-layers/yocto-poky/meta/recipes-core/meta/buildtools-tarball.bb
index 5808c95d8..abdc7feeb 100644
--- a/import-layers/yocto-poky/meta/recipes-core/meta/buildtools-tarball.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/meta/buildtools-tarball.bb
@@ -2,8 +2,6 @@ DESCRIPTION = "SDK type target for building a standalone tarball containing pyth
tarball can be used to run bitbake builds on systems which don't meet the usual version requirements."
SUMMARY = "Standalone tarball for running builds on systems with inadequate software"
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
- file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
TOOLCHAIN_TARGET_TASK ?= ""
diff --git a/import-layers/yocto-poky/meta/recipes-core/meta/meta-environment-extsdk.bb b/import-layers/yocto-poky/meta/recipes-core/meta/meta-environment-extsdk.bb
index d9e596143..2076b56f2 100644
--- a/import-layers/yocto-poky/meta/recipes-core/meta/meta-environment-extsdk.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/meta/meta-environment-extsdk.bb
@@ -5,8 +5,8 @@ require meta-environment.bb
PN = "meta-environment-extsdk-${MACHINE}"
create_sdk_files_append() {
- local sysroot=${SDKPATH}/${@os.path.relpath(d.getVar('STAGING_DIR_TARGET', True), d.getVar('TOPDIR', True))}
- local sdkpathnative=${SDKPATH}/${@os.path.relpath(d.getVar('STAGING_DIR_NATIVE',True), d.getVar('TOPDIR', True))}
+ local sysroot=${SDKPATH}/tmp/${@os.path.relpath(d.getVar('STAGING_DIR'), d.getVar('TMPDIR'))}/${MACHINE}
+ local sdkpathnative=${SDKPATH}/tmp/${@os.path.relpath(d.getVar('STAGING_DIR'), d.getVar('TMPDIR'))}/${BUILD_ARCH}
toolchain_create_sdk_env_script '' '' $sysroot '' ${bindir_native} ${prefix_native} $sdkpathnative
}
diff --git a/import-layers/yocto-poky/meta/recipes-core/meta/meta-environment.bb b/import-layers/yocto-poky/meta/recipes-core/meta/meta-environment.bb
index d9e045f04..29da121a3 100644
--- a/import-layers/yocto-poky/meta/recipes-core/meta/meta-environment.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/meta/meta-environment.bb
@@ -1,6 +1,4 @@
SUMMARY = "Package of environment files for SDK"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
- file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
LICENSE = "MIT"
PR = "r8"
@@ -23,27 +21,28 @@ inherit cross-canadian
do_generate_content[cleandirs] = "${SDK_OUTPUT}"
do_generate_content[dirs] = "${SDK_OUTPUT}/${SDKPATH}"
+# Need to ensure we have the virtual mappings and site files for all multtilib variants
+do_generate_content[depends] = "${@oe.utils.build_depends_string(all_multilib_tune_values(d, 'TOOLCHAIN_NEED_CONFIGSITE_CACHE'), 'do_populate_sysroot')}"
python do_generate_content() {
# Handle multilibs in the SDK environment, siteconfig, etc files...
localdata = bb.data.createCopy(d)
# make sure we only use the WORKDIR value from 'd', or it can change
- localdata.setVar('WORKDIR', d.getVar('WORKDIR', True))
+ localdata.setVar('WORKDIR', d.getVar('WORKDIR'))
# make sure we only use the SDKTARGETSYSROOT value from 'd'
- localdata.setVar('SDKTARGETSYSROOT', d.getVar('SDKTARGETSYSROOT', True))
+ localdata.setVar('SDKTARGETSYSROOT', d.getVar('SDKTARGETSYSROOT'))
localdata.setVar('libdir', d.getVar('target_libdir', False))
# Process DEFAULTTUNE
bb.build.exec_func("create_sdk_files", localdata)
- variants = d.getVar("MULTILIB_VARIANTS", True) or ""
+ variants = d.getVar("MULTILIB_VARIANTS") or ""
for item in variants.split():
# Load overrides from 'd' to avoid having to reset the value...
overrides = d.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item
localdata.setVar("OVERRIDES", overrides)
localdata.setVar("MLPREFIX", item + "-")
- bb.data.update_data(localdata)
bb.build.exec_func("create_sdk_files", localdata)
}
addtask generate_content before do_install after do_compile
@@ -69,9 +68,9 @@ FILES_${PN}= " \
${SDKPATH}/* \
"
-do_fetch[noexec] = "1"
-do_unpack[noexec] = "1"
-do_patch[noexec] = "1"
-do_configure[noexec] = "1"
-do_compile[noexec] = "1"
-do_populate_sysroot[noexec] = "1"
+deltask do_fetch
+deltask do_unpack
+deltask do_patch
+deltask do_configure
+deltask do_compile
+deltask do_populate_sysroot
diff --git a/import-layers/yocto-poky/meta/recipes-core/meta/meta-extsdk-toolchain.bb b/import-layers/yocto-poky/meta/recipes-core/meta/meta-extsdk-toolchain.bb
index 2bd9a5b32..235d6ecc0 100644
--- a/import-layers/yocto-poky/meta/recipes-core/meta/meta-extsdk-toolchain.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/meta/meta-extsdk-toolchain.bb
@@ -1,8 +1,6 @@
SUMMARY = "Extensible SDK toolchain meta-recipe"
DESCRIPTION = "Meta-recipe for ensuring the build directory contains all appropriate toolchain packages for using an IDE"
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
- file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
DEPENDS = "virtual/libc gdb-cross-${TARGET_ARCH} qemu-native qemu-helper-native unfs3-native"
@@ -12,16 +10,16 @@ do_populate_sysroot[deptask] = "do_populate_sysroot"
# within sstate.bbclass, so if you copy or rename this and expect the same
# functionality you'll need to modify that as well.
-LOCKED_SIGS_INDIR = "${D}/locked-sigs"
+LOCKED_SIGS_INDIR = "${WORKDIR}/locked-sigs"
addtask do_locked_sigs after do_populate_sysroot
SSTATETASKS += "do_locked_sigs"
do_locked_sigs[sstate-inputdirs] = "${LOCKED_SIGS_INDIR}"
-do_locked_sigs[sstate-outputdirs] = "${STAGING_DIR_HOST}/locked-sigs"
+do_locked_sigs[sstate-outputdirs] = "${STAGING_DIR}/${PACKAGE_ARCH}/${PN}/locked-sigs"
python do_locked_sigs() {
import oe.copy_buildsystem
- outdir = os.path.join(d.getVar('LOCKED_SIGS_INDIR', True))
+ outdir = os.path.join(d.getVar('LOCKED_SIGS_INDIR'))
bb.utils.mkdirhier(outdir)
sigfile = os.path.join(outdir, 'locked-sigs-extsdk-toolchain.inc')
oe.copy_buildsystem.generate_locked_sigs(sigfile, d)
diff --git a/import-layers/yocto-poky/meta/recipes-core/meta/meta-ide-support.bb b/import-layers/yocto-poky/meta/recipes-core/meta/meta-ide-support.bb
index c4ddcfcb4..0692ec8b9 100644
--- a/import-layers/yocto-poky/meta/recipes-core/meta/meta-ide-support.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/meta/meta-ide-support.bb
@@ -1,11 +1,10 @@
SUMMARY = "Integrated Development Environment support"
DESCRIPTION = "Meta package for ensuring the build directory contains all appropriate toolchain packages for using an IDE"
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
- file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
DEPENDS = "virtual/libc gdb-cross-${TARGET_ARCH} qemu-native qemu-helper-native unfs3-native"
PR = "r3"
+RM_WORK_EXCLUDE += "${PN}"
inherit meta toolchain-scripts nopackages
diff --git a/import-layers/yocto-poky/meta/recipes-core/meta/meta-toolchain.bb b/import-layers/yocto-poky/meta/recipes-core/meta/meta-toolchain.bb
index ba9fd8880..b02b0665e 100644
--- a/import-layers/yocto-poky/meta/recipes-core/meta/meta-toolchain.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/meta/meta-toolchain.bb
@@ -3,7 +3,4 @@ LICENSE = "MIT"
PR = "r7"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
- file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
-
inherit populate_sdk
diff --git a/import-layers/yocto-poky/meta/recipes-core/meta/meta-world-pkgdata.bb b/import-layers/yocto-poky/meta/recipes-core/meta/meta-world-pkgdata.bb
index 81c8647fa..02abd8aff 100644
--- a/import-layers/yocto-poky/meta/recipes-core/meta/meta-world-pkgdata.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/meta/meta-world-pkgdata.bb
@@ -19,20 +19,20 @@ do_collect_packagedata[sstate-outputdirs] = "${STAGING_DIR_HOST}/world-pkgdata"
python do_collect_packagedata() {
import oe.copy_buildsystem
- outdir = os.path.join(d.getVar('WORLD_PKGDATADIR', True))
+ outdir = os.path.join(d.getVar('WORLD_PKGDATADIR'))
bb.utils.mkdirhier(outdir)
sigfile = os.path.join(outdir, 'locked-sigs-pkgdata.inc')
oe.copy_buildsystem.generate_locked_sigs(sigfile, d)
}
-do_fetch[noexec] = "1"
-do_unpack[noexec] = "1"
-do_patch[noexec] = "1"
-do_configure[noexec] = "1"
-do_compile[noexec] = "1"
-do_install[noexec] = "1"
+deltask do_fetch
+deltask do_unpack
+deltask do_patch
+deltask do_configure
+deltask do_compile
+deltask do_install
-do_configure[deptask] = ""
+do_prepare_recipe_sysroot[deptask] = ""
WORLD_PKGDATA_EXCLUDE ?= ""
diff --git a/import-layers/yocto-poky/meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb b/import-layers/yocto-poky/meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb
index 2b9611160..0b58a027f 100644
--- a/import-layers/yocto-poky/meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb
@@ -1,6 +1,5 @@
SUMMARY = "Dummy package which ensures perl is excluded from buildtools"
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
inherit allarch
diff --git a/import-layers/yocto-poky/meta/recipes-core/meta/package-index.bb b/import-layers/yocto-poky/meta/recipes-core/meta/package-index.bb
index 3c46b4997..fe022ffeb 100644
--- a/import-layers/yocto-poky/meta/recipes-core/meta/package-index.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/meta/package-index.bb
@@ -4,18 +4,18 @@ LICENSE = "MIT"
INHIBIT_DEFAULT_DEPS = "1"
PACKAGES = ""
-do_fetch[noexec] = "1"
-do_unpack[noexec] = "1"
-do_patch[noexec] = "1"
-do_configure[noexec] = "1"
-do_compile[noexec] = "1"
-do_install[noexec] = "1"
-do_package[noexec] = "1"
-do_packagedata[noexec] = "1"
-do_package_write_ipk[noexec] = "1"
-do_package_write_rpm[noexec] = "1"
-do_package_write_deb[noexec] = "1"
-do_populate_sysroot[noexec] = "1"
+deltask do_fetch
+deltask do_unpack
+deltask do_patch
+deltask do_configure
+deltask do_compile
+deltask do_install
+deltask do_package
+deltask do_packagedata
+deltask do_package_write_ipk
+deltask do_package_write_rpm
+deltask do_package_write_deb
+deltask do_populate_sysroot
do_package_index[nostamp] = "1"
do_package_index[depends] += "${PACKAGEINDEXDEPS}"
diff --git a/import-layers/yocto-poky/meta/recipes-core/meta/signing-keys.bb b/import-layers/yocto-poky/meta/recipes-core/meta/signing-keys.bb
index 37790373a..aaa01d0c3 100644
--- a/import-layers/yocto-poky/meta/recipes-core/meta/signing-keys.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/meta/signing-keys.bb
@@ -3,8 +3,6 @@
SUMMARY = "Makes public keys of the signing keys available"
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
- file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
inherit allarch deploy
@@ -23,23 +21,23 @@ FILES_${PN}-packagefeed = "${sysconfdir}/pki/packagefeed-gpg"
python do_get_public_keys () {
from oe.gpg_sign import get_signer
- if d.getVar("RPM_SIGN_PACKAGES", True):
+ if d.getVar("RPM_SIGN_PACKAGES"):
# Export public key of the rpm signing key
- signer = get_signer(d, d.getVar('RPM_GPG_BACKEND', True))
+ signer = get_signer(d, d.getVar('RPM_GPG_BACKEND'))
signer.export_pubkey(os.path.join(d.expand('${B}'), 'rpm-key'),
- d.getVar('RPM_GPG_NAME', True))
+ d.getVar('RPM_GPG_NAME'))
- if d.getVar("IPK_SIGN_PACKAGES", True):
+ if d.getVar("IPK_SIGN_PACKAGES"):
# Export public key of the ipk signing key
- signer = get_signer(d, d.getVar('IPK_GPG_BACKEND', True))
+ signer = get_signer(d, d.getVar('IPK_GPG_BACKEND'))
signer.export_pubkey(os.path.join(d.expand('${B}'), 'ipk-key'),
- d.getVar('IPK_GPG_NAME', True))
+ d.getVar('IPK_GPG_NAME'))
- if d.getVar('PACKAGE_FEED_SIGN', True) == '1':
+ if d.getVar('PACKAGE_FEED_SIGN') == '1':
# Export public key of the feed signing key
- signer = get_signer(d, d.getVar('PACKAGE_FEED_GPG_BACKEND', True))
+ signer = get_signer(d, d.getVar('PACKAGE_FEED_GPG_BACKEND'))
signer.export_pubkey(os.path.join(d.expand('${B}'), 'pf-key'),
- d.getVar('PACKAGE_FEED_GPG_NAME', True))
+ d.getVar('PACKAGE_FEED_GPG_NAME'))
}
do_get_public_keys[cleandirs] = "${B}"
addtask get_public_keys before do_install
diff --git a/import-layers/yocto-poky/meta/recipes-core/meta/testexport-tarball.bb b/import-layers/yocto-poky/meta/recipes-core/meta/testexport-tarball.bb
index d9861c4da..72f5531c5 100644
--- a/import-layers/yocto-poky/meta/recipes-core/meta/testexport-tarball.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/meta/testexport-tarball.bb
@@ -3,8 +3,6 @@ DESCRIPTION = "SDK type target for standalone tarball containing packages define
This recipe is almost the same as buildtools-tarball"
SUMMARY = "Standalone tarball for test systems with missing software"
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
- file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
TEST_EXPORT_SDK_PACKAGES ??= ""
diff --git a/import-layers/yocto-poky/meta/recipes-core/meta/uninative-tarball.bb b/import-layers/yocto-poky/meta/recipes-core/meta/uninative-tarball.bb
index e203a8322..f3fc1ebe6 100644
--- a/import-layers/yocto-poky/meta/recipes-core/meta/uninative-tarball.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/meta/uninative-tarball.bb
@@ -1,16 +1,17 @@
SUMMARY = "libc and patchelf tarball for use with uninative.bbclass"
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
- file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
TOOLCHAIN_TARGET_TASK = ""
# ibm850 - mcopy from mtools
# iso8859-1 - guile
+# utf-16, cp1252 - binutils-windres
TOOLCHAIN_HOST_TASK = "\
nativesdk-glibc \
nativesdk-glibc-gconv-ibm850 \
nativesdk-glibc-gconv-iso8859-1 \
+ nativesdk-glibc-gconv-utf-16 \
+ nativesdk-glibc-gconv-cp1252 \
nativesdk-patchelf \
"
diff --git a/import-layers/yocto-poky/meta/recipes-core/meta/wic-tools.bb b/import-layers/yocto-poky/meta/recipes-core/meta/wic-tools.bb
new file mode 100644
index 000000000..cd494ec23
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/meta/wic-tools.bb
@@ -0,0 +1,32 @@
+SUMMARY = "A meta recipe to build native tools used by wic."
+
+LICENSE = "MIT"
+
+DEPENDS = "\
+ parted-native syslinux-native gptfdisk-native dosfstools-native \
+ mtools-native bmap-tools-native grub-efi-native cdrtools-native \
+ btrfs-tools-native squashfs-tools-native \
+ "
+DEPENDS_append_x86 = " syslinux grub-efi systemd-boot"
+DEPENDS_append_x86-64 = " syslinux grub-efi systemd-boot"
+
+INHIBIT_DEFAULT_DEPS = "1"
+inherit nopackages
+
+# The sysroot of wic-tools is needed for wic, but if rm_work is enabled, it will
+# be removed before wic has a chance to use it, hence the exclusion below.
+RM_WORK_EXCLUDE += "${PN}"
+
+python do_build_sysroot () {
+ bb.build.exec_func("extend_recipe_sysroot", d)
+
+ # Write environment variables used by wic
+ # to tmp/sysroots/<machine>/imgdata/wictools.env
+ outdir = os.path.join(d.getVar('STAGING_DIR'), d.getVar('MACHINE'), 'imgdata')
+ bb.utils.mkdirhier(outdir)
+ with open(os.path.join(outdir, "wic-tools.env"), 'w') as envf:
+ for var in ('RECIPE_SYSROOT_NATIVE', 'STAGING_DATADIR', 'STAGING_LIBDIR'):
+ envf.write('%s="%s"\n' % (var, d.getVar(var).strip()))
+
+}
+addtask do_build_sysroot after do_prepare_recipe_sysroot before do_build
diff --git a/import-layers/yocto-poky/meta/recipes-core/musl/files/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch b/import-layers/yocto-poky/meta/recipes-core/musl/files/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch
index 5490b1cba..462d338b9 100644
--- a/import-layers/yocto-poky/meta/recipes-core/musl/files/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/musl/files/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch
@@ -1,6 +1,6 @@
-From 94c0b97b62125d8bbc92dce0694e387d5b2ad181 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sun, 10 Jan 2016 12:14:02 -0800
+From 0ec74744a4cba7c5fdfaa2685995119a4fca0260 Mon Sep 17 00:00:00 2001
+From: Amarnath Valluri <amarnath.valluri@intel.com>
+Date: Wed, 18 Jan 2017 16:14:37 +0200
Subject: [PATCH] Make dynamic linker a relative symlink to libc
absolute symlink into $(libdir) fails to load in a cross build
@@ -9,26 +9,68 @@ applications, which cross build systems often do, since not everything
can be computed during cross builds, qemu in usermode often comes to aid
in such situations to feed into cross builds.
+V2:
+ Make use of 'ln -r' to create relative symlinks, as most fo the distros
+ shipping coreutils 8.16+
+
Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
---
Upstream-Status: Pending
-
- Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
+---
+ Makefile | 2 +-
+ tools/install.sh | 8 +++++---
+ 2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
-index b2226fa..0d71f7f 100644
+index 8246b78..d1dbe39 100644
--- a/Makefile
+++ b/Makefile
-@@ -189,7 +189,7 @@ $(DESTDIR)$(includedir)/%: include/%
+@@ -215,7 +215,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/include/%
$(INSTALL) -D -m 644 $< $@
$(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so
- $(INSTALL) -D -l $(libdir)/libc.so $@ || true
-+ $(INSTALL) -D -l ..$(libdir)/libc.so $@ || true
++ $(INSTALL) -D -r $(DESTDIR)$(libdir)/libc.so $@ || true
install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
+diff --git a/tools/install.sh b/tools/install.sh
+index d913b60..b6a7f79 100755
+--- a/tools/install.sh
++++ b/tools/install.sh
+@@ -6,18 +6,20 @@
+ #
+
+ usage() {
+-printf "usage: %s [-D] [-l] [-m mode] src dest\n" "$0" 1>&2
++printf "usage: %s [-D] [-l] [-r] [-m mode] src dest\n" "$0" 1>&2
+ exit 1
+ }
+
+ mkdirp=
+ symlink=
++symlinkflags="-s"
+ mode=755
+
+-while getopts Dlm: name ; do
++while getopts Dlrm: name ; do
+ case "$name" in
+ D) mkdirp=yes ;;
+ l) symlink=yes ;;
++r) symlink=yes; symlinkflags="$symlinkflags -r" ;;
+ m) mode=$OPTARG ;;
+ ?) usage ;;
+ esac
+@@ -48,7 +50,7 @@ trap 'rm -f "$tmp"' EXIT INT QUIT TERM HUP
+ umask 077
+
+ if test "$symlink" ; then
+-ln -s "$1" "$tmp"
++ln $symlinkflags "$1" "$tmp"
+ else
+ cat < "$1" > "$tmp"
+ chmod "$mode" "$tmp"
--
-2.7.0
+2.7.4
diff --git a/import-layers/yocto-poky/meta/recipes-core/musl/musl.inc b/import-layers/yocto-poky/meta/recipes-core/musl/musl.inc
index 7ed931c6d..56c9d7fe1 100644
--- a/import-layers/yocto-poky/meta/recipes-core/musl/musl.inc
+++ b/import-layers/yocto-poky/meta/recipes-core/musl/musl.inc
@@ -12,7 +12,6 @@ SECTION = "libs"
LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=7928b7ad32ceda04932478e330e52f7f"
PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
-TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
INHIBIT_DEFAULT_DEPS = "1"
diff --git a/import-layers/yocto-poky/meta/recipes-core/musl/musl_git.bb b/import-layers/yocto-poky/meta/recipes-core/musl/musl_git.bb
index c07101b74..a88bc4d42 100644
--- a/import-layers/yocto-poky/meta/recipes-core/musl/musl_git.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/musl/musl_git.bb
@@ -3,9 +3,9 @@
require musl.inc
-SRCREV = "39494a273eaa6b714e0fa0c59ce7a1f5fbc80a1e"
+SRCREV = "54807d47acecab778498ced88ce8f62bfa16e379"
-PV = "1.1.15+git${SRCPV}"
+PV = "1.1.16+git${SRCPV}"
# mirror is at git://github.com/kraj/musl.git
@@ -49,7 +49,7 @@ do_install() {
oe_runmake install DESTDIR='${D}'
install -d ${D}${bindir}
- ln -s ../../${libdir}/libc.so ${D}${bindir}/ldd
+ lnr ${D}${libdir}/libc.so ${D}${bindir}/ldd
for l in crypt dl m pthread resolv rt util xnet
do
ln -s libc.so ${D}${libdir}/lib$l.so
diff --git a/import-layers/yocto-poky/meta/recipes-core/ncurses/files/configure-reproducible.patch b/import-layers/yocto-poky/meta/recipes-core/ncurses/files/configure-reproducible.patch
new file mode 100644
index 000000000..54a8bdc6b
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/ncurses/files/configure-reproducible.patch
@@ -0,0 +1,20 @@
+"configure" enforces -U for ar flags, breaking deterministic builds.
+The flag was added to fix some vaguely specified "recent POSIX binutil
+build problems" in 2015.
+
+Upstream-Status: Pending
+Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
+
+diff --git a/configure b/configure
+index 7f31208..aa80911 100755
+--- a/configure
++++ b/configure
+@@ -4428,7 +4428,7 @@ if test "${cf_cv_ar_flags+set}" = set; then
+ else
+
+ cf_cv_ar_flags=unknown
+- for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv
++ for cf_ar_flags in -curv curv -crv crv -cqv cqv -rv rv
+ do
+
+ # check if $ARFLAGS already contains this choice
diff --git a/import-layers/yocto-poky/meta/recipes-core/ncurses/files/fix-cflags-mangle.patch b/import-layers/yocto-poky/meta/recipes-core/ncurses/files/fix-cflags-mangle.patch
new file mode 100644
index 000000000..e9447c5b8
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/ncurses/files/fix-cflags-mangle.patch
@@ -0,0 +1,18 @@
+configure has a piece of logic to detect users "abusing" CC to hold compiler
+flags (which we do). It also has logic to "correct" this by moving the flags
+from CC to CFLAGS, but the sed only handles a single argument in CC.
+
+Replace the sed with awk to filter out all words that start with a hyphen.
+
+Upstream-Status: Pending
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+diff --git a/configure b/configure
+index 7f31208..1a29cfc 100755
+--- a/configure
++++ b/configure
+@@ -2191,2 +2191,2 @@ echo "$as_me: WARNING: your environment misuses the CC variable to hold CFLAGS/C
+- cf_flags=`echo "$CC" | sed -e 's/^.*[ ]\(-[^ ]\)/\1/'`
+- CC=`echo "$CC " | sed -e 's/[ ]-[^ ].*$//' -e 's/[ ]*$//'`
++ cf_flags=`echo "$CC" | awk 'BEGIN{ORS=" ";RS=" "} /^-.+/ {print $1}'`
++ CC=`echo "$CC " | awk 'BEGIN{ORS=" ";RS=" "} /^[^-].+/ {print $1}'`
diff --git a/import-layers/yocto-poky/meta/recipes-core/ncurses/ncurses.inc b/import-layers/yocto-poky/meta/recipes-core/ncurses/ncurses.inc
index ff0117b82..1f21cd413 100644
--- a/import-layers/yocto-poky/meta/recipes-core/ncurses/ncurses.inc
+++ b/import-layers/yocto-poky/meta/recipes-core/ncurses/ncurses.inc
@@ -7,7 +7,8 @@ SECTION = "libs"
DEPENDS = "ncurses-native"
DEPENDS_class-native = ""
-BINCONFIG = "${bindir}/ncurses5-config ${bindir}/ncursesw5-config"
+BINCONFIG = "${bindir}/ncurses5-config ${bindir}/ncursesw5-config \
+ ${bindir}/ncurses6-config ${bindir}/ncursesw6-config"
inherit autotools binconfig-disabled multilib_header pkgconfig
@@ -17,6 +18,8 @@ SRC_URI = "git://anonscm.debian.org/collab-maint/ncurses.git"
EXTRA_AUTORECONF = "-I m4"
CONFIG_SITE =+ "${WORKDIR}/config.cache"
+EXTRASITECONFIG = "CFLAGS='${CFLAGS} -I${SYSROOT_DESTDIR}${includedir}'"
+
# Whether to enable separate widec libraries; must be 'true' or 'false'
#
# TODO: remove this variable when widec is supported in every setup?
@@ -65,7 +68,6 @@ ncurses_configure() {
cd $1
shift
oe_runconf \
- --disable-static \
--without-debug \
--without-ada \
--without-gpm \
@@ -278,6 +280,8 @@ FILES_${PN} = "\
${bindir}/tset \
${bindir}/ncurses5-config \
${bindir}/ncursesw5-config \
+ ${bindir}/ncurses6-config \
+ ${bindir}/ncursesw6-config \
${datadir}/tabset \
"
diff --git a/import-layers/yocto-poky/meta/recipes-core/ncurses/ncurses_6.0+20160625.bb b/import-layers/yocto-poky/meta/recipes-core/ncurses/ncurses_6.0+20161126.bb
index 6514613fe..ace310800 100644
--- a/import-layers/yocto-poky/meta/recipes-core/ncurses/ncurses_6.0+20160625.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/ncurses/ncurses_6.0+20161126.bb
@@ -1,10 +1,12 @@
require ncurses.inc
SRC_URI += "file://tic-hang.patch \
+ file://fix-cflags-mangle.patch \
file://config.cache \
+ file://configure-reproducible.patch \
"
# commit id corresponds to the revision in package version
-SRCREV = "63dd558cb8e888d6fab5f00bbf7842736a2356b9"
+SRCREV = "3db0bd19cb50e3d9b4f2cf15b7a102fe11302068"
S = "${WORKDIR}/git"
EXTRA_OECONF += "--with-abi-version=5"
UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+(\+\d+)*)"
diff --git a/import-layers/yocto-poky/meta/recipes-core/netbase/netbase/netbase-add-rpcbind-as-an-alias-to-sunrpc.patch b/import-layers/yocto-poky/meta/recipes-core/netbase/netbase/netbase-add-rpcbind-as-an-alias-to-sunrpc.patch
index 35ce21e36..56c8d5b5c 100644
--- a/import-layers/yocto-poky/meta/recipes-core/netbase/netbase/netbase-add-rpcbind-as-an-alias-to-sunrpc.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/netbase/netbase/netbase-add-rpcbind-as-an-alias-to-sunrpc.patch
@@ -1,4 +1,7 @@
-netbase: add rpcbind as an alias to sunrpc
+From 76989205a1411f16d7ab09ff9d279539a73dc259 Mon Sep 17 00:00:00 2001
+From: "Maxin B. John" <maxin.john@intel.com>
+Date: Thu, 12 Jan 2017 16:50:58 +0200
+Subject: [PATCH] netbase: add rpcbind as an alias to sunrpc
the patch comes from:
https://bugs.archlinux.org/task/20273
@@ -6,9 +9,10 @@ https://bugs.archlinux.org/task/20273
Upstream-Status: Pending
Signed-off-by: Li Wang <li.wang@windriver.com>
+Signed-off-by: Maxin B. John <maxin.john@intel.com>
---
- etc-rpc | 2 +-
- etc-services | 4 ++--
+ etc-rpc | 2 +-
+ etc-services | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/etc-rpc b/etc-rpc
@@ -25,20 +29,20 @@ index 1b30625..9a9a81a 100644
rusersd 100002 rusers
nfs 100003 nfsprog
diff --git a/etc-services b/etc-services
-index 9d64a52..a19f7c8 100644
+index e3202ec..a039d7e 100644
--- a/etc-services
+++ b/etc-services
-@@ -72,8 +72,8 @@ pop2 109/tcp postoffice pop-2 # POP version 2
- pop2 109/udp pop-2
+@@ -64,8 +64,8 @@ csnet-ns 105/udp cso-ns
+ rtelnet 107/tcp # Remote Telnet
+ rtelnet 107/udp
pop3 110/tcp pop-3 # POP version 3
- pop3 110/udp pop-3
-sunrpc 111/tcp portmapper # RPC 4.0 portmapper
-sunrpc 111/udp portmapper
-+sunrpc 111/tcp portmapper rpcbind # RPC 4.0 portmapper
++sunrpc 111/tcp portmapper rpcbind # RPC 4.0 portmapper
+sunrpc 111/udp portmapper rpcbind
auth 113/tcp authentication tap ident
sftp 115/tcp
- uucp-path 117/tcp
+ nntp 119/tcp readnews untp # USENET News Transfer Protocol
--
-1.7.9.5
+2.4.0
diff --git a/import-layers/yocto-poky/meta/recipes-core/netbase/netbase_5.3.bb b/import-layers/yocto-poky/meta/recipes-core/netbase/netbase_5.4.bb
index 543596a3d..5ab0c58f8 100644
--- a/import-layers/yocto-poky/meta/recipes-core/netbase/netbase_5.3.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/netbase/netbase_5.4.bb
@@ -6,12 +6,12 @@ LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://debian/copyright;md5=3dd6192d306f582dee7687da3d8748ab"
PE = "1"
-SRC_URI = "http://snapshot.debian.org/archive/debian/20160728T043443Z/pool/main/n/${BPN}/${BPN}_${PV}.tar.xz \
+SRC_URI = "http://snapshot.debian.org/archive/debian/20170112T093812Z/pool/main/n/${BPN}/${BPN}_${PV}.tar.xz \
file://netbase-add-rpcbind-as-an-alias-to-sunrpc.patch \
file://hosts"
-SRC_URI[md5sum] = "2637a27fd3de02a278d2b5be7e6558c1"
-SRC_URI[sha256sum] = "81f6c69795044d62b8ad959cf9daf049d0545fd466c52860ad3f933b1e97b88b"
+SRC_URI[md5sum] = "117cb70c55ef3c1c002f127812b114c1"
+SRC_URI[sha256sum] = "66ff73d2d162e2d49db43988d8b8cd328cf7fffca042db73397f14c71825e80d"
UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/n/netbase/"
do_install () {
diff --git a/import-layers/yocto-poky/meta/recipes-core/os-release/os-release.bb b/import-layers/yocto-poky/meta/recipes-core/os-release/os-release.bb
index f519addd8..f98870475 100644
--- a/import-layers/yocto-poky/meta/recipes-core/os-release/os-release.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/os-release/os-release.bb
@@ -3,7 +3,6 @@ inherit allarch
SUMMARY = "Operating system identification"
DESCRIPTION = "The /etc/os-release file contains operating system identification data."
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
INHIBIT_DEFAULT_DEPS = "1"
do_fetch[noexec] = "1"
@@ -33,8 +32,8 @@ def sanitise_version(ver):
python do_compile () {
import shutil
with open(d.expand('${B}/os-release'), 'w') as f:
- for field in d.getVar('OS_RELEASE_FIELDS', True).split():
- value = d.getVar(field, True)
+ for field in d.getVar('OS_RELEASE_FIELDS').split():
+ value = d.getVar(field)
if value and field == 'VERSION_ID':
value = sanitise_version(value)
if value:
diff --git a/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf-shell-image.bb b/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf-shell-image.bb
new file mode 100644
index 000000000..029547b94
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf-shell-image.bb
@@ -0,0 +1,17 @@
+DESCRIPTION = "boot image with UEFI shell and tools"
+
+# For this image recipe, only the wic format with a
+# single vfat partition makes sense.
+IMAGE_FSTYPES_forcevariable = 'wic'
+
+WKS_FILE = "ovmf/ovmf-shell-image.wks"
+inherit image
+
+# We want a minimal image with just ovmf-shell-efi unpacked in it. We
+# avoid installing unnecessary stuff as much as possible, but some
+# things still get through and need to be removed.
+PACKAGE_INSTALL = "ovmf-shell-efi"
+LINGUAS_INSTALL = ""
+do_image () {
+ rm -rf `ls -d ${IMAGE_ROOTFS}/* | grep -v efi`
+}
diff --git a/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/0001-MdeModulePkg-UefiHiiLib-Fix-incorrect-comparison-exp.patch b/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/0001-MdeModulePkg-UefiHiiLib-Fix-incorrect-comparison-exp.patch
new file mode 100644
index 000000000..fcd7a4690
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/0001-MdeModulePkg-UefiHiiLib-Fix-incorrect-comparison-exp.patch
@@ -0,0 +1,39 @@
+From 73692710d50da1f421b0e6ddff784ca3135389b3 Mon Sep 17 00:00:00 2001
+From: Dandan Bi <dandan.bi@intel.com>
+Date: Sat, 1 Apr 2017 10:31:14 +0800
+Subject: [PATCH] MdeModulePkg/UefiHiiLib:Fix incorrect comparison expression
+
+Fix the incorrect comparison between pointer and constant zero character.
+
+https://bugzilla.tianocore.org/show_bug.cgi?id=416
+
+V2: The pointer StringPtr points to a string returned
+by ExtractConfig/ExportConfig, if it is NULL, function
+InternalHiiIfrValueAction will return FALSE. So in
+current usage model, the StringPtr can not be NULL before
+using it, so we can add ASSERT here.
+
+Cc: Eric Dong <eric.dong@intel.com>
+Cc: Liming Gao <liming.gao@intel.com>
+Contributed-under: TianoCore Contribution Agreement 1.0
+Signed-off-by: Dandan Bi <dandan.bi@intel.com>
+Reviewed-by: Eric Dong <eric.dong@intel.com>
+---
+Upstream-Status: Backport
+
+ MdeModulePkg/Library/UefiHiiLib/HiiLib.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+Index: git/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
+===================================================================
+--- git.orig/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
++++ git/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
+@@ -2180,6 +2180,8 @@ InternalHiiIfrValueAction (
+ }
+
+ StringPtr = ConfigAltResp;
++
++ ASSERT (StringPtr != NULL);
+
+ while (StringPtr != L'\0') {
+ //
diff --git a/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/0002-ovmf-update-path-to-native-BaseTools.patch b/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/0002-ovmf-update-path-to-native-BaseTools.patch
new file mode 100644
index 000000000..94029a562
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/0002-ovmf-update-path-to-native-BaseTools.patch
@@ -0,0 +1,32 @@
+From 9e632e3f9edd09632cc877dff6ea57608f979aab Mon Sep 17 00:00:00 2001
+From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
+Date: Thu, 9 Jun 2016 02:23:01 -0700
+Subject: [PATCH] ovmf: update path to native BaseTools
+
+BaseTools is a set of utilities to build EDK-based firmware. These utilities
+are used during the build process. Thus, they need to be built natively.
+When cross-compiling, we need to provide a path to the location of these
+tools. The BBAKE_EDK_TOOLS_PATH string is used as a pattern to be replaced
+with the appropriate location before building.
+
+Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
+---
+ OvmfPkg/build.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/OvmfPkg/build.sh b/OvmfPkg/build.sh
+index eb5eb73..9058fca 100755
+--- a/OvmfPkg/build.sh
++++ b/OvmfPkg/build.sh
+@@ -30,7 +30,7 @@ then
+ # this assumes svn pulls have the same root dir
+ # export EDK_TOOLS_PATH=`pwd`/../BaseTools
+ # This version is for the tools source in edk2
+- export EDK_TOOLS_PATH=`pwd`/BaseTools
++ export EDK_TOOLS_PATH=BBAKE_EDK_TOOLS_PATH/BaseTools
+ echo $EDK_TOOLS_PATH
+ source edksetup.sh BaseTools
+ else
+--
+2.8.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/0003-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch b/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/0003-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch
new file mode 100644
index 000000000..0fdc278ce
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/0003-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch
@@ -0,0 +1,39 @@
+From 2320650c6d381b914fe91b2dedaa5870279a8bcf Mon Sep 17 00:00:00 2001
+From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
+Date: Sun, 27 Nov 2016 18:42:55 -0800
+Subject: [PATCH] BaseTools: makefile: adjust to build in under bitbake
+
+Prepend the build flags with those of bitbake. This is to build
+using the bitbake native sysroot include and library directories.
+
+Signed-off-by: Ricardo Neri <ricardo.neri@linux.intel.com>
+---
+ BaseTools/Source/C/Makefiles/header.makefile | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Source/C/Makefiles/header.makefile
+index 821d114..fe0f08b 100644
+--- a/BaseTools/Source/C/Makefiles/header.makefile
++++ b/BaseTools/Source/C/Makefiles/header.makefile
+@@ -44,14 +44,14 @@ ARCH_INCLUDE = -I $(MAKEROOT)/Include/AArch64/
+ endif
+
+ INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE)
+-BUILD_CPPFLAGS = $(INCLUDE) -O2
++BUILD_CPPFLAGS := $(BUILD_CPPFLAGS) $(INCLUDE) -O2
+ ifeq ($(DARWIN),Darwin)
+ # assume clang or clang compatible flags on OS X
+-BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -c -g
++BUILD_CFLAGS := $(BUILD_CFLAGS) -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -c -g
+ else
+-BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-unused-result -nostdlib -c -g
++BUILD_CFLAGS := $(BUILD_CFLAGS) -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-unused-result -nostdlib -c -g
+ endif
+-BUILD_LFLAGS =
++BUILD_LFLAGS := $(LDFLAGS)
+ BUILD_CXXFLAGS =
+
+ ifeq ($(ARCH), IA32)
+--
+2.9.3
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/0007-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch b/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/0007-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch
new file mode 100644
index 000000000..3aa6cc4ac
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/0007-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch
@@ -0,0 +1,1124 @@
+From: Laszlo Ersek <lersek@redhat.com>
+Date: Mon, 6 Jul 2015 20:22:02 +0200
+Subject: [PATCH] OvmfPkg: EnrollDefaultKeys: application for enrolling default
+ keys
+
+(A port of the <https://bugzilla.redhat.com/show_bug.cgi?id=1148296> patch
+to Gerd's public RPMs.)
+
+This application is meant to be invoked by the management layer, after
+booting the UEFI shell and getting a shell prompt on the serial console.
+The app enrolls a number of certificates (see below), and then reports
+status to the serial console as well. The expected output is "info:
+success":
+
+> Shell> EnrollDefaultKeys.efi
+> info: SetupMode=1 SecureBoot=0 SecureBootEnable=0 CustomMode=0 VendorKeys=1
+> info: SetupMode=0 SecureBoot=1 SecureBootEnable=1 CustomMode=0 VendorKeys=0
+> info: success
+> Shell>
+
+In case of success, the management layer can force off or reboot the VM
+(for example with the "reset -s" or "reset -c" UEFI shell commands,
+respectively), and start the guest installation with SecureBoot enabled.
+
+PK:
+- A unique, static, ad-hoc certificate whose private half has been
+ destroyed (more precisely, never saved) and is therefore unusable for
+ signing. (The command for creating this certificate is saved in the
+ source code.)
+
+KEK:
+- same ad-hoc certificate as used for the PK,
+- "Microsoft Corporation KEK CA 2011" -- the dbx data in Fedora's dbxtool
+ package is signed (indirectly, through a chain) with this; enrolling
+ such a KEK should allow guests to install those updates.
+
+DB:
+- "Microsoft Windows Production PCA 2011" -- to load Windows 8 and Windows
+ Server 2012 R2,
+- "Microsoft Corporation UEFI CA 2011" -- to load Linux and signed PCI
+ oproms.
+
+Contributed-under: TianoCore Contribution Agreement 1.0
+Signed-off-by: Laszlo Ersek <lersek@redhat.com>
+Upstream-Status: Inappropriate [not author]
+Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
+---
+ OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c | 960 ++++++++++++++++++++++++
+ OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf | 51 ++
+ OvmfPkg/OvmfPkgIa32.dsc | 4 +
+ OvmfPkg/OvmfPkgIa32X64.dsc | 4 +
+ OvmfPkg/OvmfPkgX64.dsc | 4 +
+ 5 files changed, 1023 insertions(+)
+ create mode 100644 OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c
+ create mode 100644 OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf
+
+diff --git a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c
+new file mode 100644
+index 0000000..081212b
+--- /dev/null
++++ b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c
+@@ -0,0 +1,960 @@
++/** @file
++ Enroll default PK, KEK, DB.
++
++ Copyright (C) 2014, Red Hat, Inc.
++
++ This program and the accompanying materials are licensed and made available
++ under the terms and conditions of the BSD License which accompanies this
++ distribution. The full text of the license may be found at
++ http://opensource.org/licenses/bsd-license.
++
++ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
++ WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
++**/
++#include <Guid/AuthenticatedVariableFormat.h> // gEfiCustomModeEnableGuid
++#include <Guid/GlobalVariable.h> // EFI_SETUP_MODE_NAME
++#include <Guid/ImageAuthentication.h> // EFI_IMAGE_SECURITY_DATABASE
++#include <Library/BaseMemoryLib.h> // CopyGuid()
++#include <Library/DebugLib.h> // ASSERT()
++#include <Library/MemoryAllocationLib.h> // FreePool()
++#include <Library/ShellCEntryLib.h> // ShellAppMain()
++#include <Library/UefiLib.h> // AsciiPrint()
++#include <Library/UefiRuntimeServicesTableLib.h> // gRT
++
++//
++// The example self-signed certificate below, which we'll use for both Platform
++// Key, and first Key Exchange Key, has been generated with the following
++// non-interactive openssl command. The passphrase is read from /dev/urandom,
++// and not saved, and the private key is written to /dev/null. In other words,
++// we can't sign anything else against this certificate, which is our purpose.
++//
++/*
++ openssl req \
++ -passout file:<(head -c 16 /dev/urandom) \
++ -x509 \
++ -newkey rsa:2048 \
++ -keyout /dev/null \
++ -outform DER \
++ -subj $(
++ printf /C=US
++ printf /ST=TestStateOrProvince
++ printf /L=TestLocality
++ printf /O=TestOrganization
++ printf /OU=TestOrganizationalUnit
++ printf /CN=TestCommonName
++ printf /emailAddress=test@example.com
++ ) \
++ 2>/dev/null \
++ | xxd -i
++*/
++STATIC CONST UINT8 ExampleCert[] = {
++ 0x30, 0x82, 0x04, 0x45, 0x30, 0x82, 0x03, 0x2d, 0xa0, 0x03, 0x02, 0x01, 0x02,
++ 0x02, 0x09, 0x00, 0xcf, 0x9f, 0x51, 0xa3, 0x07, 0xdb, 0x54, 0xa1, 0x30, 0x0d,
++ 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00,
++ 0x30, 0x81, 0xb8, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
++ 0x02, 0x55, 0x53, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c,
++ 0x13, 0x54, 0x65, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x50,
++ 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03,
++ 0x55, 0x04, 0x07, 0x0c, 0x0c, 0x54, 0x65, 0x73, 0x74, 0x4c, 0x6f, 0x63, 0x61,
++ 0x6c, 0x69, 0x74, 0x79, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x0a,
++ 0x0c, 0x10, 0x54, 0x65, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a,
++ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x04,
++ 0x0b, 0x0c, 0x16, 0x54, 0x65, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69,
++ 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x31,
++ 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0e, 0x54, 0x65, 0x73,
++ 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x31, 0x1f,
++ 0x30, 0x1d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01,
++ 0x16, 0x10, 0x74, 0x65, 0x73, 0x74, 0x40, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c,
++ 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x34, 0x31, 0x30,
++ 0x30, 0x39, 0x31, 0x33, 0x32, 0x38, 0x32, 0x32, 0x5a, 0x17, 0x0d, 0x31, 0x34,
++ 0x31, 0x31, 0x30, 0x38, 0x31, 0x33, 0x32, 0x38, 0x32, 0x32, 0x5a, 0x30, 0x81,
++ 0xb8, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55,
++ 0x53, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x13, 0x54,
++ 0x65, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x50, 0x72, 0x6f,
++ 0x76, 0x69, 0x6e, 0x63, 0x65, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04,
++ 0x07, 0x0c, 0x0c, 0x54, 0x65, 0x73, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69,
++ 0x74, 0x79, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x10,
++ 0x54, 0x65, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74,
++ 0x69, 0x6f, 0x6e, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c,
++ 0x16, 0x54, 0x65, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61,
++ 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x31, 0x17, 0x30,
++ 0x15, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0e, 0x54, 0x65, 0x73, 0x74, 0x43,
++ 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x31, 0x1f, 0x30, 0x1d,
++ 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, 0x10,
++ 0x74, 0x65, 0x73, 0x74, 0x40, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e,
++ 0x63, 0x6f, 0x6d, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86,
++ 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f,
++ 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xbf, 0xf1, 0xce,
++ 0x17, 0x32, 0xac, 0xc4, 0x4b, 0xb2, 0xed, 0x84, 0x76, 0xe5, 0xd0, 0xf8, 0x21,
++ 0xac, 0x10, 0xf8, 0x18, 0x09, 0x0e, 0x07, 0x13, 0x76, 0x21, 0x5c, 0xc4, 0xcc,
++ 0xd5, 0xe6, 0x25, 0xa7, 0x26, 0x53, 0x79, 0x2f, 0x16, 0x4b, 0x85, 0xbd, 0xae,
++ 0x42, 0x64, 0x58, 0xcb, 0x5e, 0xe8, 0x6e, 0x5a, 0xd0, 0xc4, 0x0f, 0x38, 0x16,
++ 0xbe, 0xd3, 0x22, 0xa7, 0x3c, 0x9b, 0x8b, 0x5e, 0xcb, 0x62, 0x35, 0xc5, 0x9b,
++ 0xe2, 0x8e, 0x4c, 0x65, 0x57, 0x4f, 0xcb, 0x27, 0xad, 0xe7, 0x63, 0xa7, 0x77,
++ 0x2b, 0xd5, 0x02, 0x42, 0x70, 0x46, 0xac, 0xba, 0xb6, 0x60, 0x57, 0xd9, 0xce,
++ 0x31, 0xc5, 0x12, 0x03, 0x4a, 0xf7, 0x2a, 0x2b, 0x40, 0x06, 0xb4, 0xdb, 0x31,
++ 0xb7, 0x83, 0x6c, 0x67, 0x87, 0x98, 0x8b, 0xce, 0x1b, 0x30, 0x7a, 0xfa, 0x35,
++ 0x6c, 0x86, 0x20, 0x74, 0xc5, 0x7d, 0x32, 0x31, 0x18, 0xeb, 0x69, 0xf7, 0x2d,
++ 0x20, 0xc4, 0xf0, 0xd2, 0xfa, 0x67, 0x81, 0xc1, 0xbb, 0x23, 0xbb, 0x75, 0x1a,
++ 0xe4, 0xb4, 0x49, 0x99, 0xdf, 0x12, 0x4c, 0xe3, 0x6d, 0x76, 0x24, 0x85, 0x24,
++ 0xae, 0x5a, 0x9e, 0xbd, 0x54, 0x1c, 0xf9, 0x0e, 0xed, 0x96, 0xb5, 0xd8, 0xa2,
++ 0x0d, 0x2a, 0x38, 0x5d, 0x12, 0x97, 0xb0, 0x4d, 0x75, 0x85, 0x1e, 0x47, 0x6d,
++ 0xe1, 0x25, 0x59, 0xcb, 0xe9, 0x33, 0x86, 0x6a, 0xef, 0x98, 0x24, 0xa0, 0x2b,
++ 0x02, 0x7b, 0xc0, 0x9f, 0x88, 0x03, 0xb0, 0xbe, 0x22, 0x65, 0x83, 0x77, 0xb3,
++ 0x30, 0xba, 0xe0, 0x3b, 0x54, 0x31, 0x3a, 0x45, 0x81, 0x9c, 0x48, 0xaf, 0xc1,
++ 0x11, 0x5b, 0xf2, 0x3a, 0x1e, 0x33, 0x1b, 0x8f, 0x0e, 0x04, 0xa4, 0x16, 0xd4,
++ 0x6b, 0x57, 0xee, 0xe7, 0xba, 0xf5, 0xee, 0xaf, 0xe2, 0x4c, 0x50, 0xf8, 0x68,
++ 0x57, 0x88, 0xfb, 0x7f, 0xa3, 0xcf, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x50,
++ 0x30, 0x4e, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14,
++ 0x1e, 0x44, 0xe5, 0xef, 0xcd, 0x6e, 0x1f, 0xdb, 0xcb, 0x4f, 0x94, 0x8f, 0xe3,
++ 0x3b, 0x1a, 0x8c, 0xe6, 0x95, 0x29, 0x61, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d,
++ 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x1e, 0x44, 0xe5, 0xef, 0xcd, 0x6e,
++ 0x1f, 0xdb, 0xcb, 0x4f, 0x94, 0x8f, 0xe3, 0x3b, 0x1a, 0x8c, 0xe6, 0x95, 0x29,
++ 0x61, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01,
++ 0x01, 0xff, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01,
++ 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x12, 0x9c, 0x3e, 0x38,
++ 0xfc, 0x26, 0xea, 0x6d, 0xb7, 0x5c, 0x29, 0x3c, 0x76, 0x20, 0x0c, 0xb2, 0xa9,
++ 0x0f, 0xdf, 0xc0, 0x85, 0xfe, 0xeb, 0xec, 0x1d, 0x5d, 0x73, 0x84, 0xac, 0x8a,
++ 0xb4, 0x2a, 0x86, 0x38, 0x30, 0xaf, 0xd2, 0x2d, 0x2a, 0xde, 0x54, 0xc8, 0x5c,
++ 0x29, 0x90, 0x24, 0xf2, 0x39, 0xc1, 0xa5, 0x00, 0xb4, 0xb7, 0xd8, 0xdc, 0x59,
++ 0x64, 0x50, 0x62, 0x5f, 0x54, 0xf1, 0x73, 0x02, 0x4d, 0x43, 0xc5, 0xc3, 0xc4,
++ 0x0e, 0x62, 0x60, 0x8c, 0x53, 0x66, 0x57, 0x77, 0xb5, 0x81, 0xda, 0x1f, 0x81,
++ 0xda, 0xe9, 0xd6, 0x5e, 0x82, 0xce, 0xa7, 0x5c, 0xc0, 0xa6, 0xbe, 0x9c, 0x5c,
++ 0x7b, 0xa5, 0x15, 0xc8, 0xd7, 0x14, 0x53, 0xd3, 0x5c, 0x1c, 0x9f, 0x8a, 0x9f,
++ 0x66, 0x15, 0xd5, 0xd3, 0x2a, 0x27, 0x0c, 0xee, 0x9f, 0x80, 0x39, 0x88, 0x7b,
++ 0x24, 0xde, 0x0c, 0x61, 0xa3, 0x44, 0xd8, 0x8d, 0x2e, 0x79, 0xf8, 0x1e, 0x04,
++ 0x5a, 0xcb, 0xd6, 0x9c, 0xa3, 0x22, 0x8f, 0x09, 0x32, 0x1e, 0xe1, 0x65, 0x8f,
++ 0x10, 0x5f, 0xd8, 0x52, 0x56, 0xd5, 0x77, 0xac, 0x58, 0x46, 0x60, 0xba, 0x2e,
++ 0xe2, 0x3f, 0x58, 0x7d, 0x60, 0xfc, 0x31, 0x4a, 0x3a, 0xaf, 0x61, 0x55, 0x5f,
++ 0xfb, 0x68, 0x14, 0x74, 0xda, 0xdc, 0x42, 0x78, 0xcc, 0xee, 0xff, 0x5c, 0x03,
++ 0x24, 0x26, 0x2c, 0xb8, 0x3a, 0x81, 0xad, 0xdb, 0xe7, 0xed, 0xe1, 0x62, 0x84,
++ 0x07, 0x1a, 0xc8, 0xa4, 0x4e, 0xb0, 0x87, 0xf7, 0x96, 0xd8, 0x33, 0x9b, 0x0d,
++ 0xa7, 0x77, 0xae, 0x5b, 0xaf, 0xad, 0xe6, 0x5a, 0xc9, 0xfa, 0xa4, 0xe4, 0xe5,
++ 0x57, 0xbb, 0x97, 0xdd, 0x92, 0x85, 0xd8, 0x03, 0x45, 0xfe, 0xd8, 0x6b, 0xb1,
++ 0xdb, 0x85, 0x36, 0xb9, 0xd9, 0x28, 0xbf, 0x17, 0xae, 0x11, 0xde, 0x10, 0x19,
++ 0x26, 0x5b, 0xc0, 0x3d, 0xc7
++};
++
++//
++// Second KEK: "Microsoft Corporation KEK CA 2011".
++// SHA1: 31:59:0b:fd:89:c9:d7:4e:d0:87:df:ac:66:33:4b:39:31:25:4b:30
++//
++// "dbx" updates in "dbxtool" are signed with a key derived from this KEK.
++//
++STATIC CONST UINT8 MicrosoftKEK[] = {
++ 0x30, 0x82, 0x05, 0xe8, 0x30, 0x82, 0x03, 0xd0, 0xa0, 0x03, 0x02, 0x01, 0x02,
++ 0x02, 0x0a, 0x61, 0x0a, 0xd1, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x30,
++ 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05,
++ 0x00, 0x30, 0x81, 0x91, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06,
++ 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08,
++ 0x13, 0x0a, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x74, 0x6f, 0x6e, 0x31,
++ 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64,
++ 0x6d, 0x6f, 0x6e, 0x64, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a,
++ 0x13, 0x15, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x43,
++ 0x6f, 0x72, 0x70, 0x6f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x3b, 0x30,
++ 0x39, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x32, 0x4d, 0x69, 0x63, 0x72, 0x6f,
++ 0x73, 0x6f, 0x66, 0x74, 0x20, 0x43, 0x6f, 0x72, 0x70, 0x6f, 0x72, 0x61, 0x74,
++ 0x69, 0x6f, 0x6e, 0x20, 0x54, 0x68, 0x69, 0x72, 0x64, 0x20, 0x50, 0x61, 0x72,
++ 0x74, 0x79, 0x20, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63,
++ 0x65, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x31, 0x30,
++ 0x36, 0x32, 0x34, 0x32, 0x30, 0x34, 0x31, 0x32, 0x39, 0x5a, 0x17, 0x0d, 0x32,
++ 0x36, 0x30, 0x36, 0x32, 0x34, 0x32, 0x30, 0x35, 0x31, 0x32, 0x39, 0x5a, 0x30,
++ 0x81, 0x80, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
++ 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a,
++ 0x57, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x74, 0x6f, 0x6e, 0x31, 0x10, 0x30,
++ 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64, 0x6d, 0x6f,
++ 0x6e, 0x64, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x15,
++ 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x43, 0x6f, 0x72,
++ 0x70, 0x6f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x2a, 0x30, 0x28, 0x06,
++ 0x03, 0x55, 0x04, 0x03, 0x13, 0x21, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f,
++ 0x66, 0x74, 0x20, 0x43, 0x6f, 0x72, 0x70, 0x6f, 0x72, 0x61, 0x74, 0x69, 0x6f,
++ 0x6e, 0x20, 0x4b, 0x45, 0x4b, 0x20, 0x43, 0x41, 0x20, 0x32, 0x30, 0x31, 0x31,
++ 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
++ 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82,
++ 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xc4, 0xe8, 0xb5, 0x8a, 0xbf, 0xad,
++ 0x57, 0x26, 0xb0, 0x26, 0xc3, 0xea, 0xe7, 0xfb, 0x57, 0x7a, 0x44, 0x02, 0x5d,
++ 0x07, 0x0d, 0xda, 0x4a, 0xe5, 0x74, 0x2a, 0xe6, 0xb0, 0x0f, 0xec, 0x6d, 0xeb,
++ 0xec, 0x7f, 0xb9, 0xe3, 0x5a, 0x63, 0x32, 0x7c, 0x11, 0x17, 0x4f, 0x0e, 0xe3,
++ 0x0b, 0xa7, 0x38, 0x15, 0x93, 0x8e, 0xc6, 0xf5, 0xe0, 0x84, 0xb1, 0x9a, 0x9b,
++ 0x2c, 0xe7, 0xf5, 0xb7, 0x91, 0xd6, 0x09, 0xe1, 0xe2, 0xc0, 0x04, 0xa8, 0xac,
++ 0x30, 0x1c, 0xdf, 0x48, 0xf3, 0x06, 0x50, 0x9a, 0x64, 0xa7, 0x51, 0x7f, 0xc8,
++ 0x85, 0x4f, 0x8f, 0x20, 0x86, 0xce, 0xfe, 0x2f, 0xe1, 0x9f, 0xff, 0x82, 0xc0,
++ 0xed, 0xe9, 0xcd, 0xce, 0xf4, 0x53, 0x6a, 0x62, 0x3a, 0x0b, 0x43, 0xb9, 0xe2,
++ 0x25, 0xfd, 0xfe, 0x05, 0xf9, 0xd4, 0xc4, 0x14, 0xab, 0x11, 0xe2, 0x23, 0x89,
++ 0x8d, 0x70, 0xb7, 0xa4, 0x1d, 0x4d, 0xec, 0xae, 0xe5, 0x9c, 0xfa, 0x16, 0xc2,
++ 0xd7, 0xc1, 0xcb, 0xd4, 0xe8, 0xc4, 0x2f, 0xe5, 0x99, 0xee, 0x24, 0x8b, 0x03,
++ 0xec, 0x8d, 0xf2, 0x8b, 0xea, 0xc3, 0x4a, 0xfb, 0x43, 0x11, 0x12, 0x0b, 0x7e,
++ 0xb5, 0x47, 0x92, 0x6c, 0xdc, 0xe6, 0x04, 0x89, 0xeb, 0xf5, 0x33, 0x04, 0xeb,
++ 0x10, 0x01, 0x2a, 0x71, 0xe5, 0xf9, 0x83, 0x13, 0x3c, 0xff, 0x25, 0x09, 0x2f,
++ 0x68, 0x76, 0x46, 0xff, 0xba, 0x4f, 0xbe, 0xdc, 0xad, 0x71, 0x2a, 0x58, 0xaa,
++ 0xfb, 0x0e, 0xd2, 0x79, 0x3d, 0xe4, 0x9b, 0x65, 0x3b, 0xcc, 0x29, 0x2a, 0x9f,
++ 0xfc, 0x72, 0x59, 0xa2, 0xeb, 0xae, 0x92, 0xef, 0xf6, 0x35, 0x13, 0x80, 0xc6,
++ 0x02, 0xec, 0xe4, 0x5f, 0xcc, 0x9d, 0x76, 0xcd, 0xef, 0x63, 0x92, 0xc1, 0xaf,
++ 0x79, 0x40, 0x84, 0x79, 0x87, 0x7f, 0xe3, 0x52, 0xa8, 0xe8, 0x9d, 0x7b, 0x07,
++ 0x69, 0x8f, 0x15, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x82, 0x01, 0x4f, 0x30,
++ 0x82, 0x01, 0x4b, 0x30, 0x10, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82,
++ 0x37, 0x15, 0x01, 0x04, 0x03, 0x02, 0x01, 0x00, 0x30, 0x1d, 0x06, 0x03, 0x55,
++ 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x62, 0xfc, 0x43, 0xcd, 0xa0, 0x3e, 0xa4,
++ 0xcb, 0x67, 0x12, 0xd2, 0x5b, 0xd9, 0x55, 0xac, 0x7b, 0xcc, 0xb6, 0x8a, 0x5f,
++ 0x30, 0x19, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x14, 0x02,
++ 0x04, 0x0c, 0x1e, 0x0a, 0x00, 0x53, 0x00, 0x75, 0x00, 0x62, 0x00, 0x43, 0x00,
++ 0x41, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x01,
++ 0x86, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x05,
++ 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04,
++ 0x18, 0x30, 0x16, 0x80, 0x14, 0x45, 0x66, 0x52, 0x43, 0xe1, 0x7e, 0x58, 0x11,
++ 0xbf, 0xd6, 0x4e, 0x9e, 0x23, 0x55, 0x08, 0x3b, 0x3a, 0x22, 0x6a, 0xa8, 0x30,
++ 0x5c, 0x06, 0x03, 0x55, 0x1d, 0x1f, 0x04, 0x55, 0x30, 0x53, 0x30, 0x51, 0xa0,
++ 0x4f, 0xa0, 0x4d, 0x86, 0x4b, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63,
++ 0x72, 0x6c, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x2e,
++ 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6b, 0x69, 0x2f, 0x63, 0x72, 0x6c, 0x2f, 0x70,
++ 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2f, 0x4d, 0x69, 0x63, 0x43, 0x6f,
++ 0x72, 0x54, 0x68, 0x69, 0x50, 0x61, 0x72, 0x4d, 0x61, 0x72, 0x52, 0x6f, 0x6f,
++ 0x5f, 0x32, 0x30, 0x31, 0x30, 0x2d, 0x31, 0x30, 0x2d, 0x30, 0x35, 0x2e, 0x63,
++ 0x72, 0x6c, 0x30, 0x60, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x01,
++ 0x01, 0x04, 0x54, 0x30, 0x52, 0x30, 0x50, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05,
++ 0x05, 0x07, 0x30, 0x02, 0x86, 0x44, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f,
++ 0x77, 0x77, 0x77, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74,
++ 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6b, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x74,
++ 0x73, 0x2f, 0x4d, 0x69, 0x63, 0x43, 0x6f, 0x72, 0x54, 0x68, 0x69, 0x50, 0x61,
++ 0x72, 0x4d, 0x61, 0x72, 0x52, 0x6f, 0x6f, 0x5f, 0x32, 0x30, 0x31, 0x30, 0x2d,
++ 0x31, 0x30, 0x2d, 0x30, 0x35, 0x2e, 0x63, 0x72, 0x74, 0x30, 0x0d, 0x06, 0x09,
++ 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82,
++ 0x02, 0x01, 0x00, 0xd4, 0x84, 0x88, 0xf5, 0x14, 0x94, 0x18, 0x02, 0xca, 0x2a,
++ 0x3c, 0xfb, 0x2a, 0x92, 0x1c, 0x0c, 0xd7, 0xa0, 0xd1, 0xf1, 0xe8, 0x52, 0x66,
++ 0xa8, 0xee, 0xa2, 0xb5, 0x75, 0x7a, 0x90, 0x00, 0xaa, 0x2d, 0xa4, 0x76, 0x5a,
++ 0xea, 0x79, 0xb7, 0xb9, 0x37, 0x6a, 0x51, 0x7b, 0x10, 0x64, 0xf6, 0xe1, 0x64,
++ 0xf2, 0x02, 0x67, 0xbe, 0xf7, 0xa8, 0x1b, 0x78, 0xbd, 0xba, 0xce, 0x88, 0x58,
++ 0x64, 0x0c, 0xd6, 0x57, 0xc8, 0x19, 0xa3, 0x5f, 0x05, 0xd6, 0xdb, 0xc6, 0xd0,
++ 0x69, 0xce, 0x48, 0x4b, 0x32, 0xb7, 0xeb, 0x5d, 0xd2, 0x30, 0xf5, 0xc0, 0xf5,
++ 0xb8, 0xba, 0x78, 0x07, 0xa3, 0x2b, 0xfe, 0x9b, 0xdb, 0x34, 0x56, 0x84, 0xec,
++ 0x82, 0xca, 0xae, 0x41, 0x25, 0x70, 0x9c, 0x6b, 0xe9, 0xfe, 0x90, 0x0f, 0xd7,
++ 0x96, 0x1f, 0xe5, 0xe7, 0x94, 0x1f, 0xb2, 0x2a, 0x0c, 0x8d, 0x4b, 0xff, 0x28,
++ 0x29, 0x10, 0x7b, 0xf7, 0xd7, 0x7c, 0xa5, 0xd1, 0x76, 0xb9, 0x05, 0xc8, 0x79,
++ 0xed, 0x0f, 0x90, 0x92, 0x9c, 0xc2, 0xfe, 0xdf, 0x6f, 0x7e, 0x6c, 0x0f, 0x7b,
++ 0xd4, 0xc1, 0x45, 0xdd, 0x34, 0x51, 0x96, 0x39, 0x0f, 0xe5, 0x5e, 0x56, 0xd8,
++ 0x18, 0x05, 0x96, 0xf4, 0x07, 0xa6, 0x42, 0xb3, 0xa0, 0x77, 0xfd, 0x08, 0x19,
++ 0xf2, 0x71, 0x56, 0xcc, 0x9f, 0x86, 0x23, 0xa4, 0x87, 0xcb, 0xa6, 0xfd, 0x58,
++ 0x7e, 0xd4, 0x69, 0x67, 0x15, 0x91, 0x7e, 0x81, 0xf2, 0x7f, 0x13, 0xe5, 0x0d,
++ 0x8b, 0x8a, 0x3c, 0x87, 0x84, 0xeb, 0xe3, 0xce, 0xbd, 0x43, 0xe5, 0xad, 0x2d,
++ 0x84, 0x93, 0x8e, 0x6a, 0x2b, 0x5a, 0x7c, 0x44, 0xfa, 0x52, 0xaa, 0x81, 0xc8,
++ 0x2d, 0x1c, 0xbb, 0xe0, 0x52, 0xdf, 0x00, 0x11, 0xf8, 0x9a, 0x3d, 0xc1, 0x60,
++ 0xb0, 0xe1, 0x33, 0xb5, 0xa3, 0x88, 0xd1, 0x65, 0x19, 0x0a, 0x1a, 0xe7, 0xac,
++ 0x7c, 0xa4, 0xc1, 0x82, 0x87, 0x4e, 0x38, 0xb1, 0x2f, 0x0d, 0xc5, 0x14, 0x87,
++ 0x6f, 0xfd, 0x8d, 0x2e, 0xbc, 0x39, 0xb6, 0xe7, 0xe6, 0xc3, 0xe0, 0xe4, 0xcd,
++ 0x27, 0x84, 0xef, 0x94, 0x42, 0xef, 0x29, 0x8b, 0x90, 0x46, 0x41, 0x3b, 0x81,
++ 0x1b, 0x67, 0xd8, 0xf9, 0x43, 0x59, 0x65, 0xcb, 0x0d, 0xbc, 0xfd, 0x00, 0x92,
++ 0x4f, 0xf4, 0x75, 0x3b, 0xa7, 0xa9, 0x24, 0xfc, 0x50, 0x41, 0x40, 0x79, 0xe0,
++ 0x2d, 0x4f, 0x0a, 0x6a, 0x27, 0x76, 0x6e, 0x52, 0xed, 0x96, 0x69, 0x7b, 0xaf,
++ 0x0f, 0xf7, 0x87, 0x05, 0xd0, 0x45, 0xc2, 0xad, 0x53, 0x14, 0x81, 0x1f, 0xfb,
++ 0x30, 0x04, 0xaa, 0x37, 0x36, 0x61, 0xda, 0x4a, 0x69, 0x1b, 0x34, 0xd8, 0x68,
++ 0xed, 0xd6, 0x02, 0xcf, 0x6c, 0x94, 0x0c, 0xd3, 0xcf, 0x6c, 0x22, 0x79, 0xad,
++ 0xb1, 0xf0, 0xbc, 0x03, 0xa2, 0x46, 0x60, 0xa9, 0xc4, 0x07, 0xc2, 0x21, 0x82,
++ 0xf1, 0xfd, 0xf2, 0xe8, 0x79, 0x32, 0x60, 0xbf, 0xd8, 0xac, 0xa5, 0x22, 0x14,
++ 0x4b, 0xca, 0xc1, 0xd8, 0x4b, 0xeb, 0x7d, 0x3f, 0x57, 0x35, 0xb2, 0xe6, 0x4f,
++ 0x75, 0xb4, 0xb0, 0x60, 0x03, 0x22, 0x53, 0xae, 0x91, 0x79, 0x1d, 0xd6, 0x9b,
++ 0x41, 0x1f, 0x15, 0x86, 0x54, 0x70, 0xb2, 0xde, 0x0d, 0x35, 0x0f, 0x7c, 0xb0,
++ 0x34, 0x72, 0xba, 0x97, 0x60, 0x3b, 0xf0, 0x79, 0xeb, 0xa2, 0xb2, 0x1c, 0x5d,
++ 0xa2, 0x16, 0xb8, 0x87, 0xc5, 0xe9, 0x1b, 0xf6, 0xb5, 0x97, 0x25, 0x6f, 0x38,
++ 0x9f, 0xe3, 0x91, 0xfa, 0x8a, 0x79, 0x98, 0xc3, 0x69, 0x0e, 0xb7, 0xa3, 0x1c,
++ 0x20, 0x05, 0x97, 0xf8, 0xca, 0x14, 0xae, 0x00, 0xd7, 0xc4, 0xf3, 0xc0, 0x14,
++ 0x10, 0x75, 0x6b, 0x34, 0xa0, 0x1b, 0xb5, 0x99, 0x60, 0xf3, 0x5c, 0xb0, 0xc5,
++ 0x57, 0x4e, 0x36, 0xd2, 0x32, 0x84, 0xbf, 0x9e
++};
++
++//
++// First DB entry: "Microsoft Windows Production PCA 2011"
++// SHA1: 58:0a:6f:4c:c4:e4:b6:69:b9:eb:dc:1b:2b:3e:08:7b:80:d0:67:8d
++//
++// Windows 8 and Windows Server 2012 R2 boot loaders are signed with a chain
++// rooted in this certificate.
++//
++STATIC CONST UINT8 MicrosoftPCA[] = {
++ 0x30, 0x82, 0x05, 0xd7, 0x30, 0x82, 0x03, 0xbf, 0xa0, 0x03, 0x02, 0x01, 0x02,
++ 0x02, 0x0a, 0x61, 0x07, 0x76, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x30,
++ 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05,
++ 0x00, 0x30, 0x81, 0x88, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06,
++ 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08,
++ 0x13, 0x0a, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x74, 0x6f, 0x6e, 0x31,
++ 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64,
++ 0x6d, 0x6f, 0x6e, 0x64, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a,
++ 0x13, 0x15, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x43,
++ 0x6f, 0x72, 0x70, 0x6f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x32, 0x30,
++ 0x30, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x29, 0x4d, 0x69, 0x63, 0x72, 0x6f,
++ 0x73, 0x6f, 0x66, 0x74, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x65, 0x72,
++ 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x41, 0x75, 0x74, 0x68,
++ 0x6f, 0x72, 0x69, 0x74, 0x79, 0x20, 0x32, 0x30, 0x31, 0x30, 0x30, 0x1e, 0x17,
++ 0x0d, 0x31, 0x31, 0x31, 0x30, 0x31, 0x39, 0x31, 0x38, 0x34, 0x31, 0x34, 0x32,
++ 0x5a, 0x17, 0x0d, 0x32, 0x36, 0x31, 0x30, 0x31, 0x39, 0x31, 0x38, 0x35, 0x31,
++ 0x34, 0x32, 0x5a, 0x30, 0x81, 0x84, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
++ 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55,
++ 0x04, 0x08, 0x13, 0x0a, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x74, 0x6f,
++ 0x6e, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52,
++ 0x65, 0x64, 0x6d, 0x6f, 0x6e, 0x64, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55,
++ 0x04, 0x0a, 0x13, 0x15, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74,
++ 0x20, 0x43, 0x6f, 0x72, 0x70, 0x6f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x31,
++ 0x2e, 0x30, 0x2c, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x25, 0x4d, 0x69, 0x63,
++ 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77,
++ 0x73, 0x20, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20,
++ 0x50, 0x43, 0x41, 0x20, 0x32, 0x30, 0x31, 0x31, 0x30, 0x82, 0x01, 0x22, 0x30,
++ 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05,
++ 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01,
++ 0x01, 0x00, 0xdd, 0x0c, 0xbb, 0xa2, 0xe4, 0x2e, 0x09, 0xe3, 0xe7, 0xc5, 0xf7,
++ 0x96, 0x69, 0xbc, 0x00, 0x21, 0xbd, 0x69, 0x33, 0x33, 0xef, 0xad, 0x04, 0xcb,
++ 0x54, 0x80, 0xee, 0x06, 0x83, 0xbb, 0xc5, 0x20, 0x84, 0xd9, 0xf7, 0xd2, 0x8b,
++ 0xf3, 0x38, 0xb0, 0xab, 0xa4, 0xad, 0x2d, 0x7c, 0x62, 0x79, 0x05, 0xff, 0xe3,
++ 0x4a, 0x3f, 0x04, 0x35, 0x20, 0x70, 0xe3, 0xc4, 0xe7, 0x6b, 0xe0, 0x9c, 0xc0,
++ 0x36, 0x75, 0xe9, 0x8a, 0x31, 0xdd, 0x8d, 0x70, 0xe5, 0xdc, 0x37, 0xb5, 0x74,
++ 0x46, 0x96, 0x28, 0x5b, 0x87, 0x60, 0x23, 0x2c, 0xbf, 0xdc, 0x47, 0xa5, 0x67,
++ 0xf7, 0x51, 0x27, 0x9e, 0x72, 0xeb, 0x07, 0xa6, 0xc9, 0xb9, 0x1e, 0x3b, 0x53,
++ 0x35, 0x7c, 0xe5, 0xd3, 0xec, 0x27, 0xb9, 0x87, 0x1c, 0xfe, 0xb9, 0xc9, 0x23,
++ 0x09, 0x6f, 0xa8, 0x46, 0x91, 0xc1, 0x6e, 0x96, 0x3c, 0x41, 0xd3, 0xcb, 0xa3,
++ 0x3f, 0x5d, 0x02, 0x6a, 0x4d, 0xec, 0x69, 0x1f, 0x25, 0x28, 0x5c, 0x36, 0xff,
++ 0xfd, 0x43, 0x15, 0x0a, 0x94, 0xe0, 0x19, 0xb4, 0xcf, 0xdf, 0xc2, 0x12, 0xe2,
++ 0xc2, 0x5b, 0x27, 0xee, 0x27, 0x78, 0x30, 0x8b, 0x5b, 0x2a, 0x09, 0x6b, 0x22,
++ 0x89, 0x53, 0x60, 0x16, 0x2c, 0xc0, 0x68, 0x1d, 0x53, 0xba, 0xec, 0x49, 0xf3,
++ 0x9d, 0x61, 0x8c, 0x85, 0x68, 0x09, 0x73, 0x44, 0x5d, 0x7d, 0xa2, 0x54, 0x2b,
++ 0xdd, 0x79, 0xf7, 0x15, 0xcf, 0x35, 0x5d, 0x6c, 0x1c, 0x2b, 0x5c, 0xce, 0xbc,
++ 0x9c, 0x23, 0x8b, 0x6f, 0x6e, 0xb5, 0x26, 0xd9, 0x36, 0x13, 0xc3, 0x4f, 0xd6,
++ 0x27, 0xae, 0xb9, 0x32, 0x3b, 0x41, 0x92, 0x2c, 0xe1, 0xc7, 0xcd, 0x77, 0xe8,
++ 0xaa, 0x54, 0x4e, 0xf7, 0x5c, 0x0b, 0x04, 0x87, 0x65, 0xb4, 0x43, 0x18, 0xa8,
++ 0xb2, 0xe0, 0x6d, 0x19, 0x77, 0xec, 0x5a, 0x24, 0xfa, 0x48, 0x03, 0x02, 0x03,
++ 0x01, 0x00, 0x01, 0xa3, 0x82, 0x01, 0x43, 0x30, 0x82, 0x01, 0x3f, 0x30, 0x10,
++ 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x15, 0x01, 0x04, 0x03,
++ 0x02, 0x01, 0x00, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04,
++ 0x14, 0xa9, 0x29, 0x02, 0x39, 0x8e, 0x16, 0xc4, 0x97, 0x78, 0xcd, 0x90, 0xf9,
++ 0x9e, 0x4f, 0x9a, 0xe1, 0x7c, 0x55, 0xaf, 0x53, 0x30, 0x19, 0x06, 0x09, 0x2b,
++ 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x14, 0x02, 0x04, 0x0c, 0x1e, 0x0a, 0x00,
++ 0x53, 0x00, 0x75, 0x00, 0x62, 0x00, 0x43, 0x00, 0x41, 0x30, 0x0b, 0x06, 0x03,
++ 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x01, 0x86, 0x30, 0x0f, 0x06, 0x03,
++ 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff,
++ 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14,
++ 0xd5, 0xf6, 0x56, 0xcb, 0x8f, 0xe8, 0xa2, 0x5c, 0x62, 0x68, 0xd1, 0x3d, 0x94,
++ 0x90, 0x5b, 0xd7, 0xce, 0x9a, 0x18, 0xc4, 0x30, 0x56, 0x06, 0x03, 0x55, 0x1d,
++ 0x1f, 0x04, 0x4f, 0x30, 0x4d, 0x30, 0x4b, 0xa0, 0x49, 0xa0, 0x47, 0x86, 0x45,
++ 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x6c, 0x2e, 0x6d, 0x69,
++ 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70,
++ 0x6b, 0x69, 0x2f, 0x63, 0x72, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63,
++ 0x74, 0x73, 0x2f, 0x4d, 0x69, 0x63, 0x52, 0x6f, 0x6f, 0x43, 0x65, 0x72, 0x41,
++ 0x75, 0x74, 0x5f, 0x32, 0x30, 0x31, 0x30, 0x2d, 0x30, 0x36, 0x2d, 0x32, 0x33,
++ 0x2e, 0x63, 0x72, 0x6c, 0x30, 0x5a, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05,
++ 0x07, 0x01, 0x01, 0x04, 0x4e, 0x30, 0x4c, 0x30, 0x4a, 0x06, 0x08, 0x2b, 0x06,
++ 0x01, 0x05, 0x05, 0x07, 0x30, 0x02, 0x86, 0x3e, 0x68, 0x74, 0x74, 0x70, 0x3a,
++ 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f,
++ 0x66, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6b, 0x69, 0x2f, 0x63, 0x65,
++ 0x72, 0x74, 0x73, 0x2f, 0x4d, 0x69, 0x63, 0x52, 0x6f, 0x6f, 0x43, 0x65, 0x72,
++ 0x41, 0x75, 0x74, 0x5f, 0x32, 0x30, 0x31, 0x30, 0x2d, 0x30, 0x36, 0x2d, 0x32,
++ 0x33, 0x2e, 0x63, 0x72, 0x74, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
++ 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x02, 0x01, 0x00, 0x14,
++ 0xfc, 0x7c, 0x71, 0x51, 0xa5, 0x79, 0xc2, 0x6e, 0xb2, 0xef, 0x39, 0x3e, 0xbc,
++ 0x3c, 0x52, 0x0f, 0x6e, 0x2b, 0x3f, 0x10, 0x13, 0x73, 0xfe, 0xa8, 0x68, 0xd0,
++ 0x48, 0xa6, 0x34, 0x4d, 0x8a, 0x96, 0x05, 0x26, 0xee, 0x31, 0x46, 0x90, 0x61,
++ 0x79, 0xd6, 0xff, 0x38, 0x2e, 0x45, 0x6b, 0xf4, 0xc0, 0xe5, 0x28, 0xb8, 0xda,
++ 0x1d, 0x8f, 0x8a, 0xdb, 0x09, 0xd7, 0x1a, 0xc7, 0x4c, 0x0a, 0x36, 0x66, 0x6a,
++ 0x8c, 0xec, 0x1b, 0xd7, 0x04, 0x90, 0xa8, 0x18, 0x17, 0xa4, 0x9b, 0xb9, 0xe2,
++ 0x40, 0x32, 0x36, 0x76, 0xc4, 0xc1, 0x5a, 0xc6, 0xbf, 0xe4, 0x04, 0xc0, 0xea,
++ 0x16, 0xd3, 0xac, 0xc3, 0x68, 0xef, 0x62, 0xac, 0xdd, 0x54, 0x6c, 0x50, 0x30,
++ 0x58, 0xa6, 0xeb, 0x7c, 0xfe, 0x94, 0xa7, 0x4e, 0x8e, 0xf4, 0xec, 0x7c, 0x86,
++ 0x73, 0x57, 0xc2, 0x52, 0x21, 0x73, 0x34, 0x5a, 0xf3, 0xa3, 0x8a, 0x56, 0xc8,
++ 0x04, 0xda, 0x07, 0x09, 0xed, 0xf8, 0x8b, 0xe3, 0xce, 0xf4, 0x7e, 0x8e, 0xae,
++ 0xf0, 0xf6, 0x0b, 0x8a, 0x08, 0xfb, 0x3f, 0xc9, 0x1d, 0x72, 0x7f, 0x53, 0xb8,
++ 0xeb, 0xbe, 0x63, 0xe0, 0xe3, 0x3d, 0x31, 0x65, 0xb0, 0x81, 0xe5, 0xf2, 0xac,
++ 0xcd, 0x16, 0xa4, 0x9f, 0x3d, 0xa8, 0xb1, 0x9b, 0xc2, 0x42, 0xd0, 0x90, 0x84,
++ 0x5f, 0x54, 0x1d, 0xff, 0x89, 0xea, 0xba, 0x1d, 0x47, 0x90, 0x6f, 0xb0, 0x73,
++ 0x4e, 0x41, 0x9f, 0x40, 0x9f, 0x5f, 0xe5, 0xa1, 0x2a, 0xb2, 0x11, 0x91, 0x73,
++ 0x8a, 0x21, 0x28, 0xf0, 0xce, 0xde, 0x73, 0x39, 0x5f, 0x3e, 0xab, 0x5c, 0x60,
++ 0xec, 0xdf, 0x03, 0x10, 0xa8, 0xd3, 0x09, 0xe9, 0xf4, 0xf6, 0x96, 0x85, 0xb6,
++ 0x7f, 0x51, 0x88, 0x66, 0x47, 0x19, 0x8d, 0xa2, 0xb0, 0x12, 0x3d, 0x81, 0x2a,
++ 0x68, 0x05, 0x77, 0xbb, 0x91, 0x4c, 0x62, 0x7b, 0xb6, 0xc1, 0x07, 0xc7, 0xba,
++ 0x7a, 0x87, 0x34, 0x03, 0x0e, 0x4b, 0x62, 0x7a, 0x99, 0xe9, 0xca, 0xfc, 0xce,
++ 0x4a, 0x37, 0xc9, 0x2d, 0xa4, 0x57, 0x7c, 0x1c, 0xfe, 0x3d, 0xdc, 0xb8, 0x0f,
++ 0x5a, 0xfa, 0xd6, 0xc4, 0xb3, 0x02, 0x85, 0x02, 0x3a, 0xea, 0xb3, 0xd9, 0x6e,
++ 0xe4, 0x69, 0x21, 0x37, 0xde, 0x81, 0xd1, 0xf6, 0x75, 0x19, 0x05, 0x67, 0xd3,
++ 0x93, 0x57, 0x5e, 0x29, 0x1b, 0x39, 0xc8, 0xee, 0x2d, 0xe1, 0xcd, 0xe4, 0x45,
++ 0x73, 0x5b, 0xd0, 0xd2, 0xce, 0x7a, 0xab, 0x16, 0x19, 0x82, 0x46, 0x58, 0xd0,
++ 0x5e, 0x9d, 0x81, 0xb3, 0x67, 0xaf, 0x6c, 0x35, 0xf2, 0xbc, 0xe5, 0x3f, 0x24,
++ 0xe2, 0x35, 0xa2, 0x0a, 0x75, 0x06, 0xf6, 0x18, 0x56, 0x99, 0xd4, 0x78, 0x2c,
++ 0xd1, 0x05, 0x1b, 0xeb, 0xd0, 0x88, 0x01, 0x9d, 0xaa, 0x10, 0xf1, 0x05, 0xdf,
++ 0xba, 0x7e, 0x2c, 0x63, 0xb7, 0x06, 0x9b, 0x23, 0x21, 0xc4, 0xf9, 0x78, 0x6c,
++ 0xe2, 0x58, 0x17, 0x06, 0x36, 0x2b, 0x91, 0x12, 0x03, 0xcc, 0xa4, 0xd9, 0xf2,
++ 0x2d, 0xba, 0xf9, 0x94, 0x9d, 0x40, 0xed, 0x18, 0x45, 0xf1, 0xce, 0x8a, 0x5c,
++ 0x6b, 0x3e, 0xab, 0x03, 0xd3, 0x70, 0x18, 0x2a, 0x0a, 0x6a, 0xe0, 0x5f, 0x47,
++ 0xd1, 0xd5, 0x63, 0x0a, 0x32, 0xf2, 0xaf, 0xd7, 0x36, 0x1f, 0x2a, 0x70, 0x5a,
++ 0xe5, 0x42, 0x59, 0x08, 0x71, 0x4b, 0x57, 0xba, 0x7e, 0x83, 0x81, 0xf0, 0x21,
++ 0x3c, 0xf4, 0x1c, 0xc1, 0xc5, 0xb9, 0x90, 0x93, 0x0e, 0x88, 0x45, 0x93, 0x86,
++ 0xe9, 0xb1, 0x20, 0x99, 0xbe, 0x98, 0xcb, 0xc5, 0x95, 0xa4, 0x5d, 0x62, 0xd6,
++ 0xa0, 0x63, 0x08, 0x20, 0xbd, 0x75, 0x10, 0x77, 0x7d, 0x3d, 0xf3, 0x45, 0xb9,
++ 0x9f, 0x97, 0x9f, 0xcb, 0x57, 0x80, 0x6f, 0x33, 0xa9, 0x04, 0xcf, 0x77, 0xa4,
++ 0x62, 0x1c, 0x59, 0x7e
++};
++
++//
++// Second DB entry: "Microsoft Corporation UEFI CA 2011"
++// SHA1: 46:de:f6:3b:5c:e6:1c:f8:ba:0d:e2:e6:63:9c:10:19:d0:ed:14:f3
++//
++// To verify the "shim" binary and PCI expansion ROMs with.
++//
++STATIC CONST UINT8 MicrosoftUefiCA[] = {
++ 0x30, 0x82, 0x06, 0x10, 0x30, 0x82, 0x03, 0xf8, 0xa0, 0x03, 0x02, 0x01, 0x02,
++ 0x02, 0x0a, 0x61, 0x08, 0xd3, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x30,
++ 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05,
++ 0x00, 0x30, 0x81, 0x91, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06,
++ 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08,
++ 0x13, 0x0a, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x74, 0x6f, 0x6e, 0x31,
++ 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64,
++ 0x6d, 0x6f, 0x6e, 0x64, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a,
++ 0x13, 0x15, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x43,
++ 0x6f, 0x72, 0x70, 0x6f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x3b, 0x30,
++ 0x39, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x32, 0x4d, 0x69, 0x63, 0x72, 0x6f,
++ 0x73, 0x6f, 0x66, 0x74, 0x20, 0x43, 0x6f, 0x72, 0x70, 0x6f, 0x72, 0x61, 0x74,
++ 0x69, 0x6f, 0x6e, 0x20, 0x54, 0x68, 0x69, 0x72, 0x64, 0x20, 0x50, 0x61, 0x72,
++ 0x74, 0x79, 0x20, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63,
++ 0x65, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x31, 0x30,
++ 0x36, 0x32, 0x37, 0x32, 0x31, 0x32, 0x32, 0x34, 0x35, 0x5a, 0x17, 0x0d, 0x32,
++ 0x36, 0x30, 0x36, 0x32, 0x37, 0x32, 0x31, 0x33, 0x32, 0x34, 0x35, 0x5a, 0x30,
++ 0x81, 0x81, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
++ 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a,
++ 0x57, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x74, 0x6f, 0x6e, 0x31, 0x10, 0x30,
++ 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64, 0x6d, 0x6f,
++ 0x6e, 0x64, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x15,
++ 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x43, 0x6f, 0x72,
++ 0x70, 0x6f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x2b, 0x30, 0x29, 0x06,
++ 0x03, 0x55, 0x04, 0x03, 0x13, 0x22, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f,
++ 0x66, 0x74, 0x20, 0x43, 0x6f, 0x72, 0x70, 0x6f, 0x72, 0x61, 0x74, 0x69, 0x6f,
++ 0x6e, 0x20, 0x55, 0x45, 0x46, 0x49, 0x20, 0x43, 0x41, 0x20, 0x32, 0x30, 0x31,
++ 0x31, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
++ 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30,
++ 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xa5, 0x08, 0x6c, 0x4c, 0xc7,
++ 0x45, 0x09, 0x6a, 0x4b, 0x0c, 0xa4, 0xc0, 0x87, 0x7f, 0x06, 0x75, 0x0c, 0x43,
++ 0x01, 0x54, 0x64, 0xe0, 0x16, 0x7f, 0x07, 0xed, 0x92, 0x7d, 0x0b, 0xb2, 0x73,
++ 0xbf, 0x0c, 0x0a, 0xc6, 0x4a, 0x45, 0x61, 0xa0, 0xc5, 0x16, 0x2d, 0x96, 0xd3,
++ 0xf5, 0x2b, 0xa0, 0xfb, 0x4d, 0x49, 0x9b, 0x41, 0x80, 0x90, 0x3c, 0xb9, 0x54,
++ 0xfd, 0xe6, 0xbc, 0xd1, 0x9d, 0xc4, 0xa4, 0x18, 0x8a, 0x7f, 0x41, 0x8a, 0x5c,
++ 0x59, 0x83, 0x68, 0x32, 0xbb, 0x8c, 0x47, 0xc9, 0xee, 0x71, 0xbc, 0x21, 0x4f,
++ 0x9a, 0x8a, 0x7c, 0xff, 0x44, 0x3f, 0x8d, 0x8f, 0x32, 0xb2, 0x26, 0x48, 0xae,
++ 0x75, 0xb5, 0xee, 0xc9, 0x4c, 0x1e, 0x4a, 0x19, 0x7e, 0xe4, 0x82, 0x9a, 0x1d,
++ 0x78, 0x77, 0x4d, 0x0c, 0xb0, 0xbd, 0xf6, 0x0f, 0xd3, 0x16, 0xd3, 0xbc, 0xfa,
++ 0x2b, 0xa5, 0x51, 0x38, 0x5d, 0xf5, 0xfb, 0xba, 0xdb, 0x78, 0x02, 0xdb, 0xff,
++ 0xec, 0x0a, 0x1b, 0x96, 0xd5, 0x83, 0xb8, 0x19, 0x13, 0xe9, 0xb6, 0xc0, 0x7b,
++ 0x40, 0x7b, 0xe1, 0x1f, 0x28, 0x27, 0xc9, 0xfa, 0xef, 0x56, 0x5e, 0x1c, 0xe6,
++ 0x7e, 0x94, 0x7e, 0xc0, 0xf0, 0x44, 0xb2, 0x79, 0x39, 0xe5, 0xda, 0xb2, 0x62,
++ 0x8b, 0x4d, 0xbf, 0x38, 0x70, 0xe2, 0x68, 0x24, 0x14, 0xc9, 0x33, 0xa4, 0x08,
++ 0x37, 0xd5, 0x58, 0x69, 0x5e, 0xd3, 0x7c, 0xed, 0xc1, 0x04, 0x53, 0x08, 0xe7,
++ 0x4e, 0xb0, 0x2a, 0x87, 0x63, 0x08, 0x61, 0x6f, 0x63, 0x15, 0x59, 0xea, 0xb2,
++ 0x2b, 0x79, 0xd7, 0x0c, 0x61, 0x67, 0x8a, 0x5b, 0xfd, 0x5e, 0xad, 0x87, 0x7f,
++ 0xba, 0x86, 0x67, 0x4f, 0x71, 0x58, 0x12, 0x22, 0x04, 0x22, 0x22, 0xce, 0x8b,
++ 0xef, 0x54, 0x71, 0x00, 0xce, 0x50, 0x35, 0x58, 0x76, 0x95, 0x08, 0xee, 0x6a,
++ 0xb1, 0xa2, 0x01, 0xd5, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x82, 0x01, 0x76,
++ 0x30, 0x82, 0x01, 0x72, 0x30, 0x12, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01,
++ 0x82, 0x37, 0x15, 0x01, 0x04, 0x05, 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x23,
++ 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x15, 0x02, 0x04, 0x16,
++ 0x04, 0x14, 0xf8, 0xc1, 0x6b, 0xb7, 0x7f, 0x77, 0x53, 0x4a, 0xf3, 0x25, 0x37,
++ 0x1d, 0x4e, 0xa1, 0x26, 0x7b, 0x0f, 0x20, 0x70, 0x80, 0x30, 0x1d, 0x06, 0x03,
++ 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x13, 0xad, 0xbf, 0x43, 0x09, 0xbd,
++ 0x82, 0x70, 0x9c, 0x8c, 0xd5, 0x4f, 0x31, 0x6e, 0xd5, 0x22, 0x98, 0x8a, 0x1b,
++ 0xd4, 0x30, 0x19, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x14,
++ 0x02, 0x04, 0x0c, 0x1e, 0x0a, 0x00, 0x53, 0x00, 0x75, 0x00, 0x62, 0x00, 0x43,
++ 0x00, 0x41, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02,
++ 0x01, 0x86, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04,
++ 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23,
++ 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x45, 0x66, 0x52, 0x43, 0xe1, 0x7e, 0x58,
++ 0x11, 0xbf, 0xd6, 0x4e, 0x9e, 0x23, 0x55, 0x08, 0x3b, 0x3a, 0x22, 0x6a, 0xa8,
++ 0x30, 0x5c, 0x06, 0x03, 0x55, 0x1d, 0x1f, 0x04, 0x55, 0x30, 0x53, 0x30, 0x51,
++ 0xa0, 0x4f, 0xa0, 0x4d, 0x86, 0x4b, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f,
++ 0x63, 0x72, 0x6c, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74,
++ 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6b, 0x69, 0x2f, 0x63, 0x72, 0x6c, 0x2f,
++ 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2f, 0x4d, 0x69, 0x63, 0x43,
++ 0x6f, 0x72, 0x54, 0x68, 0x69, 0x50, 0x61, 0x72, 0x4d, 0x61, 0x72, 0x52, 0x6f,
++ 0x6f, 0x5f, 0x32, 0x30, 0x31, 0x30, 0x2d, 0x31, 0x30, 0x2d, 0x30, 0x35, 0x2e,
++ 0x63, 0x72, 0x6c, 0x30, 0x60, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07,
++ 0x01, 0x01, 0x04, 0x54, 0x30, 0x52, 0x30, 0x50, 0x06, 0x08, 0x2b, 0x06, 0x01,
++ 0x05, 0x05, 0x07, 0x30, 0x02, 0x86, 0x44, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
++ 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66,
++ 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6b, 0x69, 0x2f, 0x63, 0x65, 0x72,
++ 0x74, 0x73, 0x2f, 0x4d, 0x69, 0x63, 0x43, 0x6f, 0x72, 0x54, 0x68, 0x69, 0x50,
++ 0x61, 0x72, 0x4d, 0x61, 0x72, 0x52, 0x6f, 0x6f, 0x5f, 0x32, 0x30, 0x31, 0x30,
++ 0x2d, 0x31, 0x30, 0x2d, 0x30, 0x35, 0x2e, 0x63, 0x72, 0x74, 0x30, 0x0d, 0x06,
++ 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03,
++ 0x82, 0x02, 0x01, 0x00, 0x35, 0x08, 0x42, 0xff, 0x30, 0xcc, 0xce, 0xf7, 0x76,
++ 0x0c, 0xad, 0x10, 0x68, 0x58, 0x35, 0x29, 0x46, 0x32, 0x76, 0x27, 0x7c, 0xef,
++ 0x12, 0x41, 0x27, 0x42, 0x1b, 0x4a, 0xaa, 0x6d, 0x81, 0x38, 0x48, 0x59, 0x13,
++ 0x55, 0xf3, 0xe9, 0x58, 0x34, 0xa6, 0x16, 0x0b, 0x82, 0xaa, 0x5d, 0xad, 0x82,
++ 0xda, 0x80, 0x83, 0x41, 0x06, 0x8f, 0xb4, 0x1d, 0xf2, 0x03, 0xb9, 0xf3, 0x1a,
++ 0x5d, 0x1b, 0xf1, 0x50, 0x90, 0xf9, 0xb3, 0x55, 0x84, 0x42, 0x28, 0x1c, 0x20,
++ 0xbd, 0xb2, 0xae, 0x51, 0x14, 0xc5, 0xc0, 0xac, 0x97, 0x95, 0x21, 0x1c, 0x90,
++ 0xdb, 0x0f, 0xfc, 0x77, 0x9e, 0x95, 0x73, 0x91, 0x88, 0xca, 0xbd, 0xbd, 0x52,
++ 0xb9, 0x05, 0x50, 0x0d, 0xdf, 0x57, 0x9e, 0xa0, 0x61, 0xed, 0x0d, 0xe5, 0x6d,
++ 0x25, 0xd9, 0x40, 0x0f, 0x17, 0x40, 0xc8, 0xce, 0xa3, 0x4a, 0xc2, 0x4d, 0xaf,
++ 0x9a, 0x12, 0x1d, 0x08, 0x54, 0x8f, 0xbd, 0xc7, 0xbc, 0xb9, 0x2b, 0x3d, 0x49,
++ 0x2b, 0x1f, 0x32, 0xfc, 0x6a, 0x21, 0x69, 0x4f, 0x9b, 0xc8, 0x7e, 0x42, 0x34,
++ 0xfc, 0x36, 0x06, 0x17, 0x8b, 0x8f, 0x20, 0x40, 0xc0, 0xb3, 0x9a, 0x25, 0x75,
++ 0x27, 0xcd, 0xc9, 0x03, 0xa3, 0xf6, 0x5d, 0xd1, 0xe7, 0x36, 0x54, 0x7a, 0xb9,
++ 0x50, 0xb5, 0xd3, 0x12, 0xd1, 0x07, 0xbf, 0xbb, 0x74, 0xdf, 0xdc, 0x1e, 0x8f,
++ 0x80, 0xd5, 0xed, 0x18, 0xf4, 0x2f, 0x14, 0x16, 0x6b, 0x2f, 0xde, 0x66, 0x8c,
++ 0xb0, 0x23, 0xe5, 0xc7, 0x84, 0xd8, 0xed, 0xea, 0xc1, 0x33, 0x82, 0xad, 0x56,
++ 0x4b, 0x18, 0x2d, 0xf1, 0x68, 0x95, 0x07, 0xcd, 0xcf, 0xf0, 0x72, 0xf0, 0xae,
++ 0xbb, 0xdd, 0x86, 0x85, 0x98, 0x2c, 0x21, 0x4c, 0x33, 0x2b, 0xf0, 0x0f, 0x4a,
++ 0xf0, 0x68, 0x87, 0xb5, 0x92, 0x55, 0x32, 0x75, 0xa1, 0x6a, 0x82, 0x6a, 0x3c,
++ 0xa3, 0x25, 0x11, 0xa4, 0xed, 0xad, 0xd7, 0x04, 0xae, 0xcb, 0xd8, 0x40, 0x59,
++ 0xa0, 0x84, 0xd1, 0x95, 0x4c, 0x62, 0x91, 0x22, 0x1a, 0x74, 0x1d, 0x8c, 0x3d,
++ 0x47, 0x0e, 0x44, 0xa6, 0xe4, 0xb0, 0x9b, 0x34, 0x35, 0xb1, 0xfa, 0xb6, 0x53,
++ 0xa8, 0x2c, 0x81, 0xec, 0xa4, 0x05, 0x71, 0xc8, 0x9d, 0xb8, 0xba, 0xe8, 0x1b,
++ 0x44, 0x66, 0xe4, 0x47, 0x54, 0x0e, 0x8e, 0x56, 0x7f, 0xb3, 0x9f, 0x16, 0x98,
++ 0xb2, 0x86, 0xd0, 0x68, 0x3e, 0x90, 0x23, 0xb5, 0x2f, 0x5e, 0x8f, 0x50, 0x85,
++ 0x8d, 0xc6, 0x8d, 0x82, 0x5f, 0x41, 0xa1, 0xf4, 0x2e, 0x0d, 0xe0, 0x99, 0xd2,
++ 0x6c, 0x75, 0xe4, 0xb6, 0x69, 0xb5, 0x21, 0x86, 0xfa, 0x07, 0xd1, 0xf6, 0xe2,
++ 0x4d, 0xd1, 0xda, 0xad, 0x2c, 0x77, 0x53, 0x1e, 0x25, 0x32, 0x37, 0xc7, 0x6c,
++ 0x52, 0x72, 0x95, 0x86, 0xb0, 0xf1, 0x35, 0x61, 0x6a, 0x19, 0xf5, 0xb2, 0x3b,
++ 0x81, 0x50, 0x56, 0xa6, 0x32, 0x2d, 0xfe, 0xa2, 0x89, 0xf9, 0x42, 0x86, 0x27,
++ 0x18, 0x55, 0xa1, 0x82, 0xca, 0x5a, 0x9b, 0xf8, 0x30, 0x98, 0x54, 0x14, 0xa6,
++ 0x47, 0x96, 0x25, 0x2f, 0xc8, 0x26, 0xe4, 0x41, 0x94, 0x1a, 0x5c, 0x02, 0x3f,
++ 0xe5, 0x96, 0xe3, 0x85, 0x5b, 0x3c, 0x3e, 0x3f, 0xbb, 0x47, 0x16, 0x72, 0x55,
++ 0xe2, 0x25, 0x22, 0xb1, 0xd9, 0x7b, 0xe7, 0x03, 0x06, 0x2a, 0xa3, 0xf7, 0x1e,
++ 0x90, 0x46, 0xc3, 0x00, 0x0d, 0xd6, 0x19, 0x89, 0xe3, 0x0e, 0x35, 0x27, 0x62,
++ 0x03, 0x71, 0x15, 0xa6, 0xef, 0xd0, 0x27, 0xa0, 0xa0, 0x59, 0x37, 0x60, 0xf8,
++ 0x38, 0x94, 0xb8, 0xe0, 0x78, 0x70, 0xf8, 0xba, 0x4c, 0x86, 0x87, 0x94, 0xf6,
++ 0xe0, 0xae, 0x02, 0x45, 0xee, 0x65, 0xc2, 0xb6, 0xa3, 0x7e, 0x69, 0x16, 0x75,
++ 0x07, 0x92, 0x9b, 0xf5, 0xa6, 0xbc, 0x59, 0x83, 0x58
++};
++
++//
++// The most important thing about the variable payload is that it is a list of
++// lists, where the element size of any given *inner* list is constant.
++//
++// Since X509 certificates vary in size, each of our *inner* lists will contain
++// one element only (one X.509 certificate). This is explicitly mentioned in
++// the UEFI specification, in "28.4.1 Signature Database", in a Note.
++//
++// The list structure looks as follows:
++//
++// struct EFI_VARIABLE_AUTHENTICATION_2 { |
++// struct EFI_TIME { |
++// UINT16 Year; |
++// UINT8 Month; |
++// UINT8 Day; |
++// UINT8 Hour; |
++// UINT8 Minute; |
++// UINT8 Second; |
++// UINT8 Pad1; |
++// UINT32 Nanosecond; |
++// INT16 TimeZone; |
++// UINT8 Daylight; |
++// UINT8 Pad2; |
++// } TimeStamp; |
++// |
++// struct WIN_CERTIFICATE_UEFI_GUID { | |
++// struct WIN_CERTIFICATE { | |
++// UINT32 dwLength; ----------------------------------------+ |
++// UINT16 wRevision; | |
++// UINT16 wCertificateType; | |
++// } Hdr; | +- DataSize
++// | |
++// EFI_GUID CertType; | |
++// UINT8 CertData[1] = { <--- "struct hack" | |
++// struct EFI_SIGNATURE_LIST { | | |
++// EFI_GUID SignatureType; | | |
++// UINT32 SignatureListSize; -------------------------+ | |
++// UINT32 SignatureHeaderSize; | | |
++// UINT32 SignatureSize; ---------------------------+ | | |
++// UINT8 SignatureHeader[SignatureHeaderSize]; | | | |
++// v | | |
++// struct EFI_SIGNATURE_DATA { | | | |
++// EFI_GUID SignatureOwner; | | | |
++// UINT8 SignatureData[1] = { <--- "struct hack" | | | |
++// X.509 payload | | | |
++// } | | | |
++// } Signatures[]; | | |
++// } SigLists[]; | |
++// }; | |
++// } AuthInfo; | |
++// }; |
++//
++// Given that the "struct hack" invokes undefined behavior (which is why C99
++// introduced the flexible array member), and because subtracting those pesky
++// sizes of 1 is annoying, and because the format is fully specified in the
++// UEFI specification, we'll introduce two matching convenience structures that
++// are customized for our X.509 purposes.
++//
++#pragma pack(1)
++typedef struct {
++ EFI_TIME TimeStamp;
++
++ //
++ // dwLength covers data below
++ //
++ UINT32 dwLength;
++ UINT16 wRevision;
++ UINT16 wCertificateType;
++ EFI_GUID CertType;
++} SINGLE_HEADER;
++
++typedef struct {
++ //
++ // SignatureListSize covers data below
++ //
++ EFI_GUID SignatureType;
++ UINT32 SignatureListSize;
++ UINT32 SignatureHeaderSize; // constant 0
++ UINT32 SignatureSize;
++
++ //
++ // SignatureSize covers data below
++ //
++ EFI_GUID SignatureOwner;
++
++ //
++ // X.509 certificate follows
++ //
++} REPEATING_HEADER;
++#pragma pack()
++
++/**
++ Enroll a set of DER-formatted X.509 certificates in a global variable,
++ overwriting it.
++
++ The variable will be rewritten with NV+BS+RT+AT attributes.
++
++ @param[in] VariableName The name of the variable to overwrite.
++
++ @param[in] VendorGuid The namespace (ie. vendor GUID) of the variable to
++ overwrite.
++
++ @param[in] ... A list of
++
++ IN CONST UINT8 *Cert,
++ IN UINTN CertSize,
++ IN CONST EFI_GUID *OwnerGuid
++
++ triplets. If the first component of a triplet is
++ NULL, then the other two components are not
++ accessed, and processing is terminated. The list of
++ X.509 certificates is enrolled in the variable
++ specified, overwriting it. The OwnerGuid component
++ identifies the agent installing the certificate.
++
++ @retval EFI_INVALID_PARAMETER The triplet list is empty (ie. the first Cert
++ value is NULL), or one of the CertSize values
++ is 0, or one of the CertSize values would
++ overflow the accumulated UINT32 data size.
++
++ @retval EFI_OUT_OF_RESOURCES Out of memory while formatting variable
++ payload.
++
++ @retval EFI_SUCCESS Enrollment successful; the variable has been
++ overwritten (or created).
++
++ @return Error codes from gRT->GetTime() and
++ gRT->SetVariable().
++**/
++STATIC
++EFI_STATUS
++EFIAPI
++EnrollListOfX509Certs (
++ IN CHAR16 *VariableName,
++ IN EFI_GUID *VendorGuid,
++ ...
++ )
++{
++ UINTN DataSize;
++ SINGLE_HEADER *SingleHeader;
++ REPEATING_HEADER *RepeatingHeader;
++ VA_LIST Marker;
++ CONST UINT8 *Cert;
++ EFI_STATUS Status = EFI_SUCCESS;
++ UINT8 *Data;
++ UINT8 *Position;
++
++ //
++ // compute total size first, for UINT32 range check, and allocation
++ //
++ DataSize = sizeof *SingleHeader;
++ VA_START (Marker, VendorGuid);
++ for (Cert = VA_ARG (Marker, CONST UINT8 *);
++ Cert != NULL;
++ Cert = VA_ARG (Marker, CONST UINT8 *)) {
++ UINTN CertSize;
++
++ CertSize = VA_ARG (Marker, UINTN);
++ (VOID)VA_ARG (Marker, CONST EFI_GUID *);
++
++ if (CertSize == 0 ||
++ CertSize > MAX_UINT32 - sizeof *RepeatingHeader ||
++ DataSize > MAX_UINT32 - sizeof *RepeatingHeader - CertSize) {
++ Status = EFI_INVALID_PARAMETER;
++ break;
++ }
++ DataSize += sizeof *RepeatingHeader + CertSize;
++ }
++ VA_END (Marker);
++
++ if (DataSize == sizeof *SingleHeader) {
++ Status = EFI_INVALID_PARAMETER;
++ }
++ if (EFI_ERROR (Status)) {
++ goto Out;
++ }
++
++ Data = AllocatePool (DataSize);
++ if (Data == NULL) {
++ Status = EFI_OUT_OF_RESOURCES;
++ goto Out;
++ }
++
++ Position = Data;
++
++ SingleHeader = (SINGLE_HEADER *)Position;
++ Status = gRT->GetTime (&SingleHeader->TimeStamp, NULL);
++ if (EFI_ERROR (Status)) {
++ goto FreeData;
++ }
++ SingleHeader->TimeStamp.Pad1 = 0;
++ SingleHeader->TimeStamp.Nanosecond = 0;
++ SingleHeader->TimeStamp.TimeZone = 0;
++ SingleHeader->TimeStamp.Daylight = 0;
++ SingleHeader->TimeStamp.Pad2 = 0;
++#if 0
++ SingleHeader->dwLength = DataSize - sizeof SingleHeader->TimeStamp;
++#else
++ //
++ // This looks like a bug in edk2. According to the UEFI specification,
++ // dwLength is "The length of the entire certificate, including the length of
++ // the header, in bytes". That shouldn't stop right after CertType -- it
++ // should include everything below it.
++ //
++ SingleHeader->dwLength = sizeof *SingleHeader
++ - sizeof SingleHeader->TimeStamp;
++#endif
++ SingleHeader->wRevision = 0x0200;
++ SingleHeader->wCertificateType = WIN_CERT_TYPE_EFI_GUID;
++ CopyGuid (&SingleHeader->CertType, &gEfiCertPkcs7Guid);
++ Position += sizeof *SingleHeader;
++
++ VA_START (Marker, VendorGuid);
++ for (Cert = VA_ARG (Marker, CONST UINT8 *);
++ Cert != NULL;
++ Cert = VA_ARG (Marker, CONST UINT8 *)) {
++ UINTN CertSize;
++ CONST EFI_GUID *OwnerGuid;
++
++ CertSize = VA_ARG (Marker, UINTN);
++ OwnerGuid = VA_ARG (Marker, CONST EFI_GUID *);
++
++ RepeatingHeader = (REPEATING_HEADER *)Position;
++ CopyGuid (&RepeatingHeader->SignatureType, &gEfiCertX509Guid);
++ RepeatingHeader->SignatureListSize = sizeof *RepeatingHeader + CertSize;
++ RepeatingHeader->SignatureHeaderSize = 0;
++ RepeatingHeader->SignatureSize =
++ sizeof RepeatingHeader->SignatureOwner + CertSize;
++ CopyGuid (&RepeatingHeader->SignatureOwner, OwnerGuid);
++ Position += sizeof *RepeatingHeader;
++
++ CopyMem (Position, Cert, CertSize);
++ Position += CertSize;
++ }
++ VA_END (Marker);
++
++ ASSERT (Data + DataSize == Position);
++
++ Status = gRT->SetVariable (VariableName, VendorGuid,
++ (EFI_VARIABLE_NON_VOLATILE |
++ EFI_VARIABLE_BOOTSERVICE_ACCESS |
++ EFI_VARIABLE_RUNTIME_ACCESS |
++ EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS),
++ DataSize, Data);
++
++FreeData:
++ FreePool (Data);
++
++Out:
++ if (EFI_ERROR (Status)) {
++ AsciiPrint ("error: %a(\"%s\", %g): %r\n", __FUNCTION__, VariableName,
++ VendorGuid, Status);
++ }
++ return Status;
++}
++
++
++STATIC
++EFI_STATUS
++EFIAPI
++GetExact (
++ IN CHAR16 *VariableName,
++ IN EFI_GUID *VendorGuid,
++ OUT VOID *Data,
++ IN UINTN DataSize,
++ IN BOOLEAN AllowMissing
++ )
++{
++ UINTN Size;
++ EFI_STATUS Status;
++
++ Size = DataSize;
++ Status = gRT->GetVariable (VariableName, VendorGuid, NULL, &Size, Data);
++ if (EFI_ERROR (Status)) {
++ if (Status == EFI_NOT_FOUND && AllowMissing) {
++ ZeroMem (Data, DataSize);
++ return EFI_SUCCESS;
++ }
++
++ AsciiPrint ("error: GetVariable(\"%s\", %g): %r\n", VariableName,
++ VendorGuid, Status);
++ return Status;
++ }
++
++ if (Size != DataSize) {
++ AsciiPrint ("error: GetVariable(\"%s\", %g): expected size 0x%Lx, "
++ "got 0x%Lx\n", VariableName, VendorGuid, (UINT64)DataSize, (UINT64)Size);
++ return EFI_PROTOCOL_ERROR;
++ }
++
++ return EFI_SUCCESS;
++}
++
++typedef struct {
++ UINT8 SetupMode;
++ UINT8 SecureBoot;
++ UINT8 SecureBootEnable;
++ UINT8 CustomMode;
++ UINT8 VendorKeys;
++} SETTINGS;
++
++STATIC
++EFI_STATUS
++EFIAPI
++GetSettings (
++ OUT SETTINGS *Settings
++ )
++{
++ EFI_STATUS Status;
++
++ Status = GetExact (EFI_SETUP_MODE_NAME, &gEfiGlobalVariableGuid,
++ &Settings->SetupMode, sizeof Settings->SetupMode, FALSE);
++ if (EFI_ERROR (Status)) {
++ return Status;
++ }
++
++ Status = GetExact (EFI_SECURE_BOOT_MODE_NAME, &gEfiGlobalVariableGuid,
++ &Settings->SecureBoot, sizeof Settings->SecureBoot, FALSE);
++ if (EFI_ERROR (Status)) {
++ return Status;
++ }
++
++ Status = GetExact (EFI_SECURE_BOOT_ENABLE_NAME,
++ &gEfiSecureBootEnableDisableGuid, &Settings->SecureBootEnable,
++ sizeof Settings->SecureBootEnable, TRUE);
++ if (EFI_ERROR (Status)) {
++ return Status;
++ }
++
++ Status = GetExact (EFI_CUSTOM_MODE_NAME, &gEfiCustomModeEnableGuid,
++ &Settings->CustomMode, sizeof Settings->CustomMode, FALSE);
++ if (EFI_ERROR (Status)) {
++ return Status;
++ }
++
++ Status = GetExact (EFI_VENDOR_KEYS_VARIABLE_NAME, &gEfiGlobalVariableGuid,
++ &Settings->VendorKeys, sizeof Settings->VendorKeys, FALSE);
++ return Status;
++}
++
++STATIC
++VOID
++EFIAPI
++PrintSettings (
++ IN CONST SETTINGS *Settings
++ )
++{
++ AsciiPrint ("info: SetupMode=%d SecureBoot=%d SecureBootEnable=%d "
++ "CustomMode=%d VendorKeys=%d\n", Settings->SetupMode, Settings->SecureBoot,
++ Settings->SecureBootEnable, Settings->CustomMode, Settings->VendorKeys);
++}
++
++
++INTN
++EFIAPI
++ShellAppMain (
++ IN UINTN Argc,
++ IN CHAR16 **Argv
++ )
++{
++ EFI_STATUS Status;
++ SETTINGS Settings;
++
++ Status = GetSettings (&Settings);
++ if (EFI_ERROR (Status)) {
++ return 1;
++ }
++ PrintSettings (&Settings);
++
++ if (Settings.SetupMode != 1) {
++ AsciiPrint ("error: already in User Mode\n");
++ return 1;
++ }
++
++ if (Settings.CustomMode != CUSTOM_SECURE_BOOT_MODE) {
++ Settings.CustomMode = CUSTOM_SECURE_BOOT_MODE;
++ Status = gRT->SetVariable (EFI_CUSTOM_MODE_NAME, &gEfiCustomModeEnableGuid,
++ (EFI_VARIABLE_NON_VOLATILE |
++ EFI_VARIABLE_BOOTSERVICE_ACCESS),
++ sizeof Settings.CustomMode, &Settings.CustomMode);
++ if (EFI_ERROR (Status)) {
++ AsciiPrint ("error: SetVariable(\"%s\", %g): %r\n", EFI_CUSTOM_MODE_NAME,
++ &gEfiCustomModeEnableGuid, Status);
++ return 1;
++ }
++ }
++
++ Status = EnrollListOfX509Certs (
++ EFI_IMAGE_SECURITY_DATABASE,
++ &gEfiImageSecurityDatabaseGuid,
++ MicrosoftPCA, sizeof MicrosoftPCA, &gEfiCallerIdGuid,
++ MicrosoftUefiCA, sizeof MicrosoftUefiCA, &gEfiCallerIdGuid,
++ NULL);
++ if (EFI_ERROR (Status)) {
++ return 1;
++ }
++
++ Status = EnrollListOfX509Certs (
++ EFI_KEY_EXCHANGE_KEY_NAME,
++ &gEfiGlobalVariableGuid,
++ ExampleCert, sizeof ExampleCert, &gEfiCallerIdGuid,
++ MicrosoftKEK, sizeof MicrosoftKEK, &gEfiCallerIdGuid,
++ NULL);
++ if (EFI_ERROR (Status)) {
++ return 1;
++ }
++
++ Status = EnrollListOfX509Certs (
++ EFI_PLATFORM_KEY_NAME,
++ &gEfiGlobalVariableGuid,
++ ExampleCert, sizeof ExampleCert, &gEfiGlobalVariableGuid,
++ NULL);
++ if (EFI_ERROR (Status)) {
++ return 1;
++ }
++
++ Settings.CustomMode = STANDARD_SECURE_BOOT_MODE;
++ Status = gRT->SetVariable (EFI_CUSTOM_MODE_NAME, &gEfiCustomModeEnableGuid,
++ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
++ sizeof Settings.CustomMode, &Settings.CustomMode);
++ if (EFI_ERROR (Status)) {
++ AsciiPrint ("error: SetVariable(\"%s\", %g): %r\n", EFI_CUSTOM_MODE_NAME,
++ &gEfiCustomModeEnableGuid, Status);
++ return 1;
++ }
++
++ Status = GetSettings (&Settings);
++ if (EFI_ERROR (Status)) {
++ return 1;
++ }
++ PrintSettings (&Settings);
++
++ if (Settings.SetupMode != 0 || Settings.SecureBoot != 1 ||
++ Settings.SecureBootEnable != 1 || Settings.CustomMode != 0 ||
++ Settings.VendorKeys != 0) {
++ AsciiPrint ("error: unexpected\n");
++ return 1;
++ }
++
++ AsciiPrint ("info: success\n");
++ return 0;
++}
+diff --git a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf
+new file mode 100644
+index 0000000..ac919bb
+--- /dev/null
++++ b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf
+@@ -0,0 +1,51 @@
++## @file
++# Enroll default PK, KEK, DB.
++#
++# Copyright (C) 2014, Red Hat, Inc.
++#
++# This program and the accompanying materials are licensed and made available
++# under the terms and conditions of the BSD License which accompanies this
++# distribution. The full text of the license may be found at
++# http://opensource.org/licenses/bsd-license.
++#
++# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
++# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
++# IMPLIED.
++##
++
++[Defines]
++ INF_VERSION = 0x00010006
++ BASE_NAME = EnrollDefaultKeys
++ FILE_GUID = D5C1DF0B-1BAC-4EDF-BA48-08834009CA5A
++ MODULE_TYPE = UEFI_APPLICATION
++ VERSION_STRING = 0.1
++ ENTRY_POINT = ShellCEntryLib
++
++#
++# VALID_ARCHITECTURES = IA32 X64
++#
++
++[Sources]
++ EnrollDefaultKeys.c
++
++[Packages]
++ MdePkg/MdePkg.dec
++ MdeModulePkg/MdeModulePkg.dec
++ SecurityPkg/SecurityPkg.dec
++ ShellPkg/ShellPkg.dec
++
++[Guids]
++ gEfiCertPkcs7Guid
++ gEfiCertX509Guid
++ gEfiCustomModeEnableGuid
++ gEfiGlobalVariableGuid
++ gEfiImageSecurityDatabaseGuid
++ gEfiSecureBootEnableDisableGuid
++
++[LibraryClasses]
++ BaseMemoryLib
++ DebugLib
++ MemoryAllocationLib
++ ShellCEntryLib
++ UefiLib
++ UefiRuntimeServicesTableLib
+diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
+index fa9661c..e2e6ba3 100644
+--- a/OvmfPkg/OvmfPkgIa32.dsc
++++ b/OvmfPkg/OvmfPkgIa32.dsc
+@@ -764,6 +764,10 @@
+
+ !if $(SECURE_BOOT_ENABLE) == TRUE
+ SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
++ OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf {
++ <LibraryClasses>
++ ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
++ }
+ !endif
+
+ OvmfPkg/PlatformDxe/Platform.inf
+diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
+index 667584a..a0ae1aa 100644
+--- a/OvmfPkg/OvmfPkgIa32X64.dsc
++++ b/OvmfPkg/OvmfPkgIa32X64.dsc
+@@ -773,6 +773,10 @@
+
+ !if $(SECURE_BOOT_ENABLE) == TRUE
+ SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
++ OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf {
++ <LibraryClasses>
++ ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
++ }
+ !endif
+
+ OvmfPkg/PlatformDxe/Platform.inf
+diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
+index 5ae8469..87cee52 100644
+--- a/OvmfPkg/OvmfPkgX64.dsc
++++ b/OvmfPkg/OvmfPkgX64.dsc
+@@ -771,6 +771,10 @@
+
+ !if $(SECURE_BOOT_ENABLE) == TRUE
+ SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
++ OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf {
++ <LibraryClasses>
++ ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
++ }
+ !endif
+
+ OvmfPkg/PlatformDxe/Platform.inf
diff --git a/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/VfrCompile-increase-path-length-limit.patch b/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/VfrCompile-increase-path-length-limit.patch
new file mode 100644
index 000000000..bb12d8beb
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/VfrCompile-increase-path-length-limit.patch
@@ -0,0 +1,33 @@
+From c7722d10c7bcf6be0adcf54abb1d406599dd7914 Mon Sep 17 00:00:00 2001
+From: Patrick Ohly <patrick.ohly@intel.com>
+Date: Fri, 24 Feb 2017 01:40:02 +0100
+Subject: [PATCH] VfrCompile: increase path length limit
+
+The VfrCompile tool has a hard-coded maximum length for path names
+which turned out to be too small by around 20 characters in the Yocto
+autobuilder setup. Increasing the maximum by a factor of 4 is
+relatively easy and makes the problem less likely.
+
+Upstream-Status: Inappropriate [configuration]
+
+Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
+---
+ BaseTools/Source/C/VfrCompile/EfiVfr.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/BaseTools/Source/C/VfrCompile/EfiVfr.h b/BaseTools/Source/C/VfrCompile/EfiVfr.h
+index d187902..9ad4a7b 100644
+--- a/BaseTools/Source/C/VfrCompile/EfiVfr.h
++++ b/BaseTools/Source/C/VfrCompile/EfiVfr.h
+@@ -19,7 +19,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+ #include "Common/UefiInternalFormRepresentation.h"
+ #include "Common/MdeModuleHii.h"
+
+-#define MAX_PATH 255
++#define MAX_PATH 1023
+ #define MAX_VFR_LINE_LEN 4096
+
+ #define EFI_IFR_MAX_LENGTH 0xFF
+--
+2.1.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/ovmf-shell-image.wks b/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/ovmf-shell-image.wks
new file mode 100644
index 000000000..1d2f16bd3
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf/ovmf-shell-image.wks
@@ -0,0 +1,4 @@
+# short-description: Create an EFI disk image with just the EFI system partition
+
+part / --source rootfs --ondisk sda --fstype=vfat --align 1024
+bootloader --ptable gpt --timeout=5
diff --git a/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf_git.bb b/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf_git.bb
new file mode 100644
index 000000000..9d988e9d4
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/ovmf/ovmf_git.bb
@@ -0,0 +1,243 @@
+DESCRIPTION = "OVMF - UEFI firmware for Qemu and KVM"
+HOMEPAGE = "http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF"
+LICENSE = "BSD"
+LICENSE_class-target = "${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'BSD & OpenSSL', 'BSD', d)}"
+LIC_FILES_CHKSUM = "file://OvmfPkg/License.txt;md5=343dc88e82ff33d042074f62050c3496"
+
+# Enabling Secure Boot adds a dependency on OpenSSL and implies
+# compiling OVMF twice, so it is disabled by default. Distros
+# may change that default.
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[secureboot] = ",,,"
+
+SRC_URI = "git://github.com/tianocore/edk2.git;branch=master \
+ file://0002-ovmf-update-path-to-native-BaseTools.patch \
+ file://0003-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch \
+ file://VfrCompile-increase-path-length-limit.patch \
+ file://0001-MdeModulePkg-UefiHiiLib-Fix-incorrect-comparison-exp.patch \
+ "
+
+SRC_URI_append_class-target = " \
+ ${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'http://www.openssl.org/source/openssl-1.0.2j.tar.gz;name=openssl;subdir=${S}/CryptoPkg/Library/OpensslLib', '', d)} \
+ file://0007-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch \
+"
+
+SRCREV="4575a602ca6072ee9d04150b38bfb143cbff8588"
+SRC_URI[openssl.md5sum] = "96322138f0b69e61b7212bc53d5e912b"
+SRC_URI[openssl.sha256sum] = "e7aff292be21c259c6af26469c7a9b3ba26e9abaaffd325e3dccc9785256c431"
+
+inherit deploy
+
+PARALLEL_MAKE_class-native = ""
+
+S = "${WORKDIR}/git"
+
+DEPENDS_class-native="util-linux-native iasl-native ossp-uuid-native qemu-native"
+
+DEPENDS_class-target="ovmf-native"
+
+DEPENDS_append = " nasm-native"
+
+EDK_TOOLS_DIR="edk2_basetools"
+
+# OVMF has trouble building with the default optimization of -O2.
+BUILD_OPTIMIZATION="-pipe"
+
+# OVMF supports IA only, although it could conceivably support ARM someday.
+COMPATIBLE_HOST='(i.86|x86_64).*'
+
+# Additional build flags for OVMF with Secure Boot.
+# Fedora also uses "-D SMM_REQUIRE -D EXCLUDE_SHELL_FROM_FD".
+OVMF_SECURE_BOOT_EXTRA_FLAGS ??= ""
+OVMF_SECURE_BOOT_FLAGS = "-DSECURE_BOOT_ENABLE=TRUE ${OVMF_SECURE_BOOT_EXTRA_FLAGS}"
+
+do_patch[postfuncs] += "fix_basetools_location"
+fix_basetools_location () {
+}
+fix_basetools_location_class-target() {
+ # Replaces the fake path inserted by 0002-ovmf-update-path-to-native-BaseTools.patch.
+ # Necessary for finding the actual BaseTools from ovmf-native.
+ sed -i -e 's#BBAKE_EDK_TOOLS_PATH#${STAGING_BINDIR_NATIVE}/${EDK_TOOLS_DIR}#' ${S}/OvmfPkg/build.sh
+}
+
+do_patch[postfuncs] += "fix_iasl"
+fix_iasl() {
+}
+fix_iasl_class-native() {
+ # iasl is not installed under /usr/bin when building with OE.
+ sed -i -e 's#/usr/bin/iasl#${STAGING_BINDIR_NATIVE}/iasl#' ${S}/BaseTools/Conf/tools_def.template
+}
+
+# Inject CC and friends into the build. LINKER already is in GNUmakefile.
+# Must be idempotent and thus remove old assignments that were inserted
+# earlier.
+do_patch[postfuncs] += "fix_toolchain"
+fix_toolchain() {
+ sed -i \
+ -e '/^\(CC\|CXX\|AS\|AR\|LD\|LINKER\) =/d' \
+ -e '/^APPLICATION/a CC = ${CC}\nCXX = ${CXX}\nAS = ${AS}\nAR = ${AR}\nLD = ${LD}\nLINKER = $(CC)' \
+ ${S}/BaseTools/Source/C/Makefiles/app.makefile
+ sed -i \
+ -e '/^\(CC\|CXX\|AS\|AR\|LD\)/d' \
+ -e '/^VFR_CPPFLAGS/a CC = ${CC}\nCXX = ${CXX}\nAS = ${AS}\nAR = ${AR}\nLD = ${LD}' \
+ ${S}/BaseTools/Source/C/VfrCompile/GNUmakefile
+}
+fix_toolchain_append_class-native() {
+ # This tools_def.template is going to be used by the target ovmf and
+ # defines which compilers to use. For the GCC toolchain definitions,
+ # that will be ${HOST_PREFIX}gcc. However, "make" doesn't need that
+ # prefix.
+ #
+ # Injecting ENV(HOST_PREFIX) matches exporting that value as env
+ # variable in do_compile_class-target.
+ sed -i \
+ -e 's#\(ENV\|DEF\)(GCC.*_PREFIX)#ENV(HOST_PREFIX)#' \
+ -e 's#ENV(HOST_PREFIX)make#make#' \
+ ${S}/BaseTools/Conf/tools_def.template
+ sed -i \
+ -e '/^\(LFLAGS\|CFLAGS\) +=/d' \
+ -e '/^LINKER/a LFLAGS += ${BUILD_LDFLAGS}\nCFLAGS += ${BUILD_CFLAGS}' \
+ ${S}/BaseTools/Source/C/Makefiles/app.makefile \
+ ${S}/BaseTools/Source/C/VfrCompile/GNUmakefile
+ # Linking with gold fails:
+ # internal error in do_layout, at ../../gold/object.cc:1821
+ # make: *** [.../OUTPUT/Facs.acpi] Error 1
+ # We intentionally hard-code the use of ld.bfd regardless of DISTRO_FEATURES
+ # to make ovmf-native reusable across distros.
+ sed -i \
+ -e 's#^\(DEFINE GCC.*DLINK.*FLAGS *=\)#\1 -fuse-ld=bfd#' \
+ ${S}/BaseTools/Conf/tools_def.template
+}
+
+GCC_VER="$(${CC} -v 2>&1 | tail -n1 | awk '{print $3}')"
+
+fixup_target_tools() {
+ case ${1} in
+ 4.4.*)
+ FIXED_GCCVER=GCC44
+ ;;
+ 4.5.*)
+ FIXED_GCCVER=GCC45
+ ;;
+ 4.6.*)
+ FIXED_GCCVER=GCC46
+ ;;
+ 4.7.*)
+ FIXED_GCCVER=GCC47
+ ;;
+ 4.8.*)
+ FIXED_GCCVER=GCC48
+ ;;
+ 4.9.*)
+ FIXED_GCCVER=GCC49
+ ;;
+ *)
+ FIXED_GCCVER=GCC5
+ ;;
+ esac
+ echo ${FIXED_GCCVER}
+}
+
+do_compile_class-native() {
+ oe_runmake -C ${S}/BaseTools
+}
+
+do_compile_class-target() {
+ export LFLAGS="${LDFLAGS}"
+ PARALLEL_JOBS="${@ '${PARALLEL_MAKE}'.replace('-j', '-n')}"
+ OVMF_ARCH="X64"
+ if [ "${TARGET_ARCH}" != "x86_64" ] ; then
+ OVMF_ARCH="IA32"
+ fi
+
+ # The build for the target uses BaseTools/Conf/tools_def.template
+ # from ovmf-native to find the compiler, which depends on
+ # exporting HOST_PREFIX.
+ export HOST_PREFIX="${HOST_PREFIX}"
+
+ # BaseTools/Conf gets copied to Conf, but only if that does not
+ # exist yet. To ensure that an updated template gets used during
+ # incremental builds, we need to remove the copy before we start.
+ rm -f `ls ${S}/Conf/*.txt | grep -v ReadMe.txt`
+
+ # ${WORKDIR}/ovmf is a well-known location where do_install and
+ # do_deploy will be able to find the files.
+ rm -rf ${WORKDIR}/ovmf
+ mkdir ${WORKDIR}/ovmf
+ OVMF_DIR_SUFFIX="X64"
+ if [ "${TARGET_ARCH}" != "x86_64" ] ; then
+ OVMF_DIR_SUFFIX="Ia32" # Note the different capitalization
+ fi
+ FIXED_GCCVER=$(fixup_target_tools ${GCC_VER})
+ bbnote FIXED_GCCVER is ${FIXED_GCCVER}
+ build_dir="${S}/Build/Ovmf$OVMF_DIR_SUFFIX/RELEASE_${FIXED_GCCVER}"
+
+ bbnote "Building without Secure Boot."
+ rm -rf ${S}/Build/Ovmf$OVMF_DIR_SUFFIX
+ ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER}
+ ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/ovmf.fd
+ ln ${build_dir}/FV/OVMF_CODE.fd ${WORKDIR}/ovmf/ovmf.code.fd
+ ln ${build_dir}/FV/OVMF_VARS.fd ${WORKDIR}/ovmf/ovmf.vars.fd
+ ln ${build_dir}/${OVMF_ARCH}/Shell.efi ${WORKDIR}/ovmf/
+
+ if ${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'true', 'false', d)}; then
+ # See CryptoPkg/Library/OpensslLib/Patch-HOWTO.txt and
+ # https://src.fedoraproject.org/cgit/rpms/edk2.git/tree/ for
+ # building with Secure Boot enabled.
+ bbnote "Building with Secure Boot."
+ rm -rf ${S}/Build/Ovmf$OVMF_DIR_SUFFIX
+ if ! [ -f ${S}/CryptoPkg/Library/OpensslLib/openssl-*/edk2-patch-applied ]; then
+ ( cd ${S}/CryptoPkg/Library/OpensslLib/openssl-* && patch -p1 <$(echo ../EDKII_openssl-*.patch) && touch edk2-patch-applied )
+ fi
+ ( cd ${S}/CryptoPkg/Library/OpensslLib/ && ./Install.sh )
+ ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER} ${OVMF_SECURE_BOOT_FLAGS}
+ ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/ovmf.secboot.fd
+ ln ${build_dir}/FV/OVMF_CODE.fd ${WORKDIR}/ovmf/ovmf.secboot.code.fd
+ ln ${build_dir}/${OVMF_ARCH}/EnrollDefaultKeys.efi ${WORKDIR}/ovmf/
+ fi
+}
+
+do_install_class-native() {
+ install -d ${D}/${bindir}/edk2_basetools
+ cp -r ${S}/BaseTools ${D}/${bindir}/${EDK_TOOLS_DIR}
+}
+
+do_install_class-target() {
+ # Content for UEFI shell iso. We install the EFI shell as
+ # bootx64/ia32.efi because then it can be started even when the
+ # firmware itself does not contain it.
+ install -d ${D}/efi/boot
+ install ${WORKDIR}/ovmf/Shell.efi ${D}/efi/boot/boot${@ "ia32" if "${TARGET_ARCH}" != "x86_64" else "x64"}.efi
+ if ${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'true', 'false', d)}; then
+ install ${WORKDIR}/ovmf/EnrollDefaultKeys.efi ${D}
+ fi
+}
+
+# This always gets packaged because ovmf-shell-image depends on it.
+# This allows testing that recipe in all configurations because it
+# can always be part of a world build.
+#
+# However, EnrollDefaultKeys.efi is only included when Secure Boot is enabled.
+PACKAGES =+ "ovmf-shell-efi"
+FILES_ovmf-shell-efi = " \
+ EnrollDefaultKeys.efi \
+ efi/ \
+"
+
+do_deploy() {
+}
+do_deploy[cleandirs] = "${DEPLOYDIR}"
+do_deploy_class-target() {
+ # For use with "runqemu ovmf".
+ for i in \
+ ovmf \
+ ovmf.code \
+ ovmf.vars \
+ ${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'ovmf.secboot ovmf.secboot.code', '', d)} \
+ ; do
+ qemu-img convert -f raw -O qcow2 ${WORKDIR}/ovmf/$i.fd ${DEPLOYDIR}/$i.qcow2
+ done
+}
+addtask do_deploy after do_compile before do_build
+
+BBCLASSEXTEND = "native"
diff --git a/import-layers/yocto-poky/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb b/import-layers/yocto-poky/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb
index 2c2abed33..2ca639294 100644
--- a/import-layers/yocto-poky/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb
@@ -22,7 +22,8 @@ RDEPENDS_${PN} = "\
nativesdk-automake \
nativesdk-shadow \
nativesdk-makedevs \
- nativesdk-smartpm \
+ nativesdk-dnf \
+ nativesdk-cmake \
nativesdk-postinst-intercept \
${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'nativesdk-wayland', '', d)} \
"
diff --git a/import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-base.bb b/import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-base.bb
index 2e94fdefb..0069e3e0f 100644
--- a/import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-base.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-base.bb
@@ -110,8 +110,8 @@ python __anonymous () {
# If Distro want wifi and machine feature wifi/pci/pcmcia/usbhost (one of them)
# then include packagegroup-base-wifi in packagegroup-base
- distro_features = set(d.getVar("DISTRO_FEATURES", True).split())
- machine_features= set(d.getVar("MACHINE_FEATURES", True).split())
+ distro_features = set(d.getVar("DISTRO_FEATURES").split())
+ machine_features= set(d.getVar("MACHINE_FEATURES").split())
if "bluetooth" in distro_features and not "bluetooth" in machine_features and ("pcmcia" in machine_features or "pci" in machine_features or "usbhost" in machine_features):
d.setVar("ADD_BT", "packagegroup-base-bluetooth")
diff --git a/import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb b/import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
index aceba78de..7d6d41473 100644
--- a/import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
@@ -28,10 +28,7 @@ RDEPENDS_packagegroup-core-sdk = "\
SANITIZERS = "libasan-dev libubsan-dev"
SANITIZERS_aarch64 = ""
-SANITIZERS_mips = ""
-SANITIZERS_mipsel = ""
-SANITIZERS_mips64 = ""
-SANITIZERS_mips64n32 = ""
+SANITIZERS_mipsarch = ""
SANITIZERS_nios2 = ""
SANITIZERS_powerpc64 = ""
SANITIZERS_sparc = ""
@@ -45,7 +42,7 @@ RRECOMMENDS_packagegroup-core-sdk = "\
#python generate_sdk_pkgs () {
# poky_pkgs = read_pkgdata('packagegroup-core', d)['PACKAGES']
-# pkgs = d.getVar('PACKAGES', True).split()
+# pkgs = d.getVar('PACKAGES').split()
# for pkg in poky_pkgs.split():
# newpkg = pkg.replace('packagegroup-core', 'packagegroup-core-sdk')
#
diff --git a/import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb b/import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb
index dd9844504..946c947c8 100644
--- a/import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb
@@ -36,10 +36,7 @@ PERF_libc-musl = ""
SYSTEMTAP = "systemtap"
SYSTEMTAP_libc-uclibc = ""
SYSTEMTAP_libc-musl = ""
-SYSTEMTAP_mips = ""
-SYSTEMTAP_mipsel = ""
-SYSTEMTAP_mips64 = ""
-SYSTEMTAP_mips64n32 = ""
+SYSTEMTAP_mipsarch = ""
SYSTEMTAP_nios2 = ""
SYSTEMTAP_aarch64 = ""
@@ -65,15 +62,13 @@ BABELTRACE = "babeltrace"
VALGRIND = "valgrind"
VALGRIND_libc-uclibc = ""
VALGRIND_libc-musl = ""
-VALGRIND_mips = ""
-VALGRIND_mipsel = ""
-VALGRIND_mips64 = ""
-VALGRIND_mips64n32 = ""
+VALGRIND_mipsarch = ""
VALGRIND_nios2 = ""
VALGRIND_armv4 = ""
VALGRIND_armv5 = ""
VALGRIND_armv6 = ""
VALGRIND_aarch64 = ""
+VALGRIND_linux-gnux32 = ""
RDEPENDS_${PN} = "\
${PROFILETOOLS} \
diff --git a/import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb b/import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb
index 73430b86c..c1bbdfcf3 100644
--- a/import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb
@@ -10,6 +10,9 @@ inherit packagegroup distro_features_check
# rdepends on libx11-dev
REQUIRED_DISTRO_FEATURES = "x11"
+# rdepends on libgl
+REQUIRED_DISTRO_FEATURES += "opengl"
+
PACKAGES = "\
packagegroup-self-hosted \
packagegroup-self-hosted-debug \
diff --git a/import-layers/yocto-poky/meta/recipes-core/psplash/psplash_git.bb b/import-layers/yocto-poky/meta/recipes-core/psplash/psplash_git.bb
index 053742651..44297e1a6 100644
--- a/import-layers/yocto-poky/meta/recipes-core/psplash/psplash_git.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/psplash/psplash_git.bb
@@ -16,8 +16,8 @@ SRC_URI = "git://git.yoctoproject.org/${BPN} \
SPLASH_IMAGES = "file://psplash-poky-img.h;outsuffix=default"
python __anonymous() {
- oldpkgs = d.getVar("PACKAGES", True).split()
- splashfiles = d.getVar('SPLASH_IMAGES', True).split()
+ oldpkgs = d.getVar("PACKAGES").split()
+ splashfiles = d.getVar('SPLASH_IMAGES').split()
pkgs = []
localpaths = []
haspng = False
@@ -50,8 +50,8 @@ python __anonymous() {
d.appendVar("DEPENDS", " gdk-pixbuf-native")
d.prependVar("PACKAGES", "%s " % (" ".join(pkgs)))
- mlprefix = d.getVar('MLPREFIX', True) or ''
- pn = d.getVar('PN', True) or ''
+ mlprefix = d.getVar('MLPREFIX') or ''
+ pn = d.getVar('PN') or ''
for p in pkgs:
ep = '%s%s' % (mlprefix, p)
epsplash = '%s%s' % (mlprefix, 'psplash')
@@ -74,11 +74,11 @@ python do_compile () {
import shutil
# Build a separate executable for each splash image
- workdir = d.getVar('WORKDIR', True)
- convertscript = "%s/make-image-header.sh" % d.getVar('S', True)
- destfile = "%s/psplash-poky-img.h" % d.getVar('S', True)
- localfiles = d.getVar('SPLASH_LOCALPATHS', True).split()
- outputfiles = d.getVar('SPLASH_INSTALL', True).split()
+ workdir = d.getVar('WORKDIR')
+ convertscript = "%s/make-image-header.sh" % d.getVar('S')
+ destfile = "%s/psplash-poky-img.h" % d.getVar('S')
+ localfiles = d.getVar('SPLASH_LOCALPATHS').split()
+ outputfiles = d.getVar('SPLASH_INSTALL').split()
for localfile, outputfile in zip(localfiles, outputfiles):
if localfile.endswith(".png"):
outp = oe.utils.getstatusoutput('%s %s POKY' % (convertscript, os.path.join(workdir, localfile)))
@@ -89,7 +89,7 @@ python do_compile () {
shutil.copyfile(os.path.join(workdir, localfile), destfile)
# For some reason just updating the header is not enough, we have to touch the .c
# file in order to get it to rebuild
- os.utime("%s/psplash.c" % d.getVar('S', True), None)
+ os.utime("%s/psplash.c" % d.getVar('S'), None)
bb.build.exec_func("oe_runmake", d)
shutil.copyfile("psplash", outputfile)
}
@@ -110,7 +110,7 @@ FILES_${PN} += "/mnt/.psplash"
INITSCRIPT_NAME = "psplash.sh"
INITSCRIPT_PARAMS = "start 0 S . stop 20 0 1 6 ."
-DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
+PACKAGE_WRITE_DEPS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
pkg_postinst_${PN} () {
if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
if [ -n "$D" ]; then
diff --git a/import-layers/yocto-poky/meta/recipes-core/readline/files/config-dirent-symbols.patch b/import-layers/yocto-poky/meta/recipes-core/readline/files/config-dirent-symbols.patch
deleted file mode 100644
index cfff03c0f..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/readline/files/config-dirent-symbols.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-Fix the names of the STRUCT_DIRENT_D symbols to match the names used by both
-configure and the source code.
-
-Upstream-Status: Submitted (http://lists.gnu.org/archive/html/bug-readline/2014-05/msg00008.html)
-Signed-off-by: Ross Burton <ross.burton@intel.com>
-
-From e48656811550774892fd4e0f4b3c7d418422da52 Mon Sep 17 00:00:00 2001
-From: Ross Burton <ross.burton@intel.com>
-Date: Tue, 27 May 2014 22:32:31 +0100
-Subject: [PATCH] config.h.in: fix names of STRUCT_DIRENT_D symbols
-
----
- config.h.in | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/config.h.in b/config.h.in
-index a67e43e..a42acc5 100644
---- a/config.h.in
-+++ b/config.h.in
-@@ -244,9 +244,9 @@
-
- #undef HAVE_GETPW_DECLS
-
--#undef STRUCT_DIRENT_HAS_D_INO
-+#undef HAVE_STRUCT_DIRENT_D_INO
-
--#undef STRUCT_DIRENT_HAS_D_FILENO
-+#undef HAVE_STRUCT_DIRENT_D_FILENO
-
- #undef HAVE_BSD_SIGNALS
-
---
-1.7.10.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-core/readline/readline-5.2/configure-fix.patch b/import-layers/yocto-poky/meta/recipes-core/readline/readline-5.2/configure-fix.patch
deleted file mode 100644
index be60a9861..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/readline/readline-5.2/configure-fix.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-Upstream-Status: Pending
-
-Without this it fails to link against libtermcap causing various missing symbols
-issues.
-
-RP - 8/10/08
-
-Index: readline-5.2/configure.in
-===================================================================
---- readline-5.2.orig/configure.in 2008-10-08 09:58:52.000000000 +0100
-+++ readline-5.2/configure.in 2008-10-08 09:59:03.000000000 +0100
-@@ -211,10 +211,10 @@
- AC_MSG_CHECKING(configuration for building shared libraries)
- eval `TERMCAP_LIB=$TERMCAP_LIB ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
-
--# case "$SHLIB_LIBS" in
--# *curses*|*termcap*|*termlib*) ;;
--# *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
--# esac
-+ case "$SHLIB_LIBS" in
-+ *curses*|*termcap*|*termlib*) ;;
-+ *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
-+ esac
-
- AC_SUBST(SHOBJ_CC)
- AC_SUBST(SHOBJ_CFLAGS)
diff --git a/import-layers/yocto-poky/meta/recipes-core/readline/readline-5.2/fix-redundant-rpath.patch b/import-layers/yocto-poky/meta/recipes-core/readline/readline-5.2/fix-redundant-rpath.patch
deleted file mode 100644
index 3166b470f..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/readline/readline-5.2/fix-redundant-rpath.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-This support script ends up hardcoding unnecessary rpaths into the libraries. We
-will search $libdir automatically so this is just wastes space. There may be some
-cases this is necessary but our use cases aren't one of them.
-
-Upstream-Status: Inappropriate
-
-Signed-off-by: Saul Wold <sgw@linux.intel.com>
-
-Index: readline-5.2/support/shobj-conf
-===================================================================
---- readline-5.2.orig/support/shobj-conf
-+++ readline-5.2/support/shobj-conf
-@@ -110,7 +110,7 @@ linux*-*|gnu*-*|k*bsd*-gnu-*)
- SHOBJ_LD='${CC}'
- SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
-
-- SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
-+ SHLIB_XLDFLAGS='-Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
- SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
- ;;
-
diff --git a/import-layers/yocto-poky/meta/recipes-core/readline/readline-6.3/configure-fix.patch b/import-layers/yocto-poky/meta/recipes-core/readline/readline-7.0/configure-fix.patch
index ef3104f8a..ef3104f8a 100644
--- a/import-layers/yocto-poky/meta/recipes-core/readline/readline-6.3/configure-fix.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/readline/readline-7.0/configure-fix.patch
diff --git a/import-layers/yocto-poky/meta/recipes-core/readline/readline-6.3/norpath.patch b/import-layers/yocto-poky/meta/recipes-core/readline/readline-7.0/norpath.patch
index 5d71582b7..5d71582b7 100644
--- a/import-layers/yocto-poky/meta/recipes-core/readline/readline-6.3/norpath.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/readline/readline-7.0/norpath.patch
diff --git a/import-layers/yocto-poky/meta/recipes-core/readline/readline_5.2.bb b/import-layers/yocto-poky/meta/recipes-core/readline/readline_5.2.bb
deleted file mode 100644
index c1007a231..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/readline/readline_5.2.bb
+++ /dev/null
@@ -1,84 +0,0 @@
-SUMMARY = "Library for editing typed command lines"
-DESCRIPTION = "The GNU Readline library provides a set of functions for use by applications that allow users to edit \
-command lines as they are typed in. Both Emacs and vi editing modes are available. The Readline library includes \
-additional functions to maintain a list of previously-entered command lines, to recall and perhaps reedit those \
-lines, and perform csh-like history expansion on previous commands."
-SECTION = "libs"
-
-LICENSE = "GPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=03b36fdd84f74b8d8189a202b980b67f"
-
-DEPENDS += "ncurses"
-
-PR = "r9"
-
-SRC_URI = "${GNU_MIRROR}/readline/${BPN}-${PV}.tar.gz;name=archive \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-001;name=patch1;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-002;name=patch2;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-003;name=patch3;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-004;name=patch4;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-005;name=patch5;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-006;name=patch6;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-007;name=patch7;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-008;name=patch8;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-009;name=patch9;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-010;name=patch10;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-011;name=patch11;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-012;name=patch12;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-013;name=patch13;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-014;name=patch14;apply=yes;striplevel=0 \
- file://configure-fix.patch \
- file://config-dirent-symbols.patch \
- file://fix-redundant-rpath.patch"
-
-SRC_URI[archive.md5sum] = "e39331f32ad14009b9ff49cc10c5e751"
-SRC_URI[archive.sha256sum] = "12e88d96aee2cd1192500356f0535540db499282ca7f76339fb4228c31249f45"
-
-SRC_URI[patch1.md5sum] = "9d4d41622aa9b230c57f68548ce87d8f"
-SRC_URI[patch1.sha256sum] = "eac304c369154059f93049ada328739faaf40338d3cb1fb4b544c93d5ce3f8d5"
-SRC_URI[patch2.md5sum] = "f03e512d14206e37f7d6a748b56b9476"
-SRC_URI[patch2.sha256sum] = "9deacaef25507a0c2ae0b661bf9342559b59a2954d66ea3c5f5bcd900fdfcf78"
-SRC_URI[patch3.md5sum] = "252b42d8750f1a94b6bdf086612dceb2"
-SRC_URI[patch3.sha256sum] = "2a55d2ecb1c9b0147aeb193a6323616ab31c1c525a83b2db3a994b15594ba934"
-SRC_URI[patch4.md5sum] = "a32333c2e603a3ed250514e91050e552"
-SRC_URI[patch4.sha256sum] = "a03b65633781efa7c3aae5d57162985e7b7a3c10acf0f2621be610e16f27e5f2"
-SRC_URI[patch5.md5sum] = "8106796c09b789523a3a78ab69c04b6d"
-SRC_URI[patch5.sha256sum] = "06001896514148a757ea6edbbd40c4fc4331dc653847244386c37b138b150f64"
-SRC_URI[patch6.md5sum] = "512188e2bf0837f7eca19dbf71f182ae"
-SRC_URI[patch6.sha256sum] = "dfef3e982c0adf8bb5a9b7d0468ec8f5f18138b325e28759437464de5be71013"
-SRC_URI[patch7.md5sum] = "ac17aca62eb6fb398c9f2fe9de540aff"
-SRC_URI[patch7.sha256sum] = "775b028c7b761397ac6ae1bdfbac7e896dc3b9b3adc2f91312499180ca13bdd1"
-SRC_URI[patch8.md5sum] = "2484c392db021905f112cf97a94dfd4c"
-SRC_URI[patch8.sha256sum] = "a21b4e0bf0530b878bad24d5be23d18a9e03a75a31ae30844dc0933bb3d77ecd"
-SRC_URI[patch9.md5sum] = "fc6eb35d07914fae5c57d49c12483ff7"
-SRC_URI[patch9.sha256sum] = "138d5e0f0709a47a2d1621295a3dd5e3cc73b63b5cc28dab03abc4e94fe95ecf"
-SRC_URI[patch10.md5sum] = "7a2bf3dc7ac7680b1461a5701100e91b"
-SRC_URI[patch10.sha256sum] = "83f8c1aadb86b1a2fad8821a9c6be72a8de5afd7fd9fde58a30b3b57d939693e"
-SRC_URI[patch11.md5sum] = "ef6cef6822663470f6ac8c517c5a7ec6"
-SRC_URI[patch11.sha256sum] = "08ad3384ab0906e6fa4cc417eb8c43ff59375bcead15fd5c8e31730f0413b3d6"
-SRC_URI[patch12.md5sum] = "e3e9f441c8111589855bc363e5640f6c"
-SRC_URI[patch12.sha256sum] = "20f0243be2299c23213492cc2c19cfd15cc528d2b566a76a2de58306bb9e4c9e"
-SRC_URI[patch13.md5sum] = "3e2e5f543ed268a68fd1fa839faade1a"
-SRC_URI[patch13.sha256sum] = "0cc649516a5bdfa61c5e56937407570288b6972d75aa1bd060ad30ebe98144d5"
-SRC_URI[patch14.md5sum] = "a1be30e1c6f1099bb5fcef00a2631fb8"
-SRC_URI[patch14.sha256sum] = "6f1a68320d01522ca1ea5a737124ecc8739f3dcbfea2dee21e3ccf839a21a817"
-
-inherit autotools
-
-EXTRA_AUTORECONF += "--exclude=autoheader"
-
-LEAD_SONAME = "libreadline.so"
-
-do_configure_prepend () {
- if [ ! -e ${S}/acinclude.m4 ]; then
- cat ${S}/aclocal.m4 > ${S}/acinclude.m4
- fi
-}
-
-do_install_append () {
- # Make install doesn't properly install these
- oe_libinstall -so -C shlib libhistory ${D}${libdir}
- oe_libinstall -so -C shlib libreadline ${D}${libdir}
-}
-
-BBCLASSEXTEND = "native nativesdk"
diff --git a/import-layers/yocto-poky/meta/recipes-core/readline/readline_6.3.bb b/import-layers/yocto-poky/meta/recipes-core/readline/readline_6.3.bb
deleted file mode 100644
index 8ec7c4ada..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/readline/readline_6.3.bb
+++ /dev/null
@@ -1,34 +0,0 @@
-require readline.inc
-
-SRC_URI += "${GNU_MIRROR}/readline/readline-6.3-patches/readline63-001;name=patch1;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-6.3-patches/readline63-002;name=patch2;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-6.3-patches/readline63-003;name=patch3;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-6.3-patches/readline63-004;name=patch4;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-6.3-patches/readline63-005;name=patch5;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-6.3-patches/readline63-006;name=patch6;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-6.3-patches/readline63-007;name=patch7;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-6.3-patches/readline63-008;name=patch8;apply=yes;striplevel=0 \
- file://configure-fix.patch \
- file://config-dirent-symbols.patch \
- file://norpath.patch"
-
-SRC_URI[archive.md5sum] = "33c8fb279e981274f485fd91da77e94a"
-SRC_URI[archive.sha256sum] = "56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43"
-
-SRC_URI[patch1.md5sum] = "4343f5ea9b0f42447f102fb61576b398"
-SRC_URI[patch1.sha256sum] = "1a79bbb6eaee750e0d6f7f3d059b30a45fc54e8e388a8e05e9c3ae598590146f"
-SRC_URI[patch2.md5sum] = "700295212f7e2978577feaee584afddb"
-SRC_URI[patch2.sha256sum] = "39e304c7a526888f9e112e733848215736fb7b9d540729b9e31f3347b7a1e0a5"
-SRC_URI[patch3.md5sum] = "af4963862f5156fbf9111c2c6fa86ed7"
-SRC_URI[patch3.sha256sum] = "ec41bdd8b00fd884e847708513df41d51b1243cecb680189e31b7173d01ca52f"
-SRC_URI[patch4.md5sum] = "11f9def89803a5052db3ba72394ce14f"
-SRC_URI[patch4.sha256sum] = "4547b906fb2570866c21887807de5dee19838a60a1afb66385b272155e4355cc"
-SRC_URI[patch5.md5sum] = "93721c31cd225393f80cb3aadb165544"
-SRC_URI[patch5.sha256sum] = "877788f9228d1a9907a4bcfe3d6dd0439c08d728949458b41208d9bf9060274b"
-SRC_URI[patch6.md5sum] = "71dc6ecce66d1489b96595f55d142a52"
-SRC_URI[patch6.sha256sum] = "5c237ab3c6c97c23cf52b2a118adc265b7fb411b57c93a5f7c221d50fafbe556"
-SRC_URI[patch7.md5sum] = "062a08ed60679d3c4878710b3d595b65"
-SRC_URI[patch7.sha256sum] = "4d79b5a2adec3c2e8114cbd3d63c1771f7c6cf64035368624903d257014f5bea"
-SRC_URI[patch8.md5sum] = "ee1c04072154826870848d8b218d7b04"
-SRC_URI[patch8.sha256sum] = "3bc093cf526ceac23eb80256b0ec87fa1735540d659742107b6284d635c43787"
-
diff --git a/import-layers/yocto-poky/meta/recipes-core/readline/readline_7.0.bb b/import-layers/yocto-poky/meta/recipes-core/readline/readline_7.0.bb
new file mode 100644
index 000000000..85dfaa629
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/readline/readline_7.0.bb
@@ -0,0 +1,7 @@
+require readline.inc
+
+SRC_URI += "file://configure-fix.patch \
+ file://norpath.patch"
+
+SRC_URI[archive.md5sum] = "205b03a87fc83dab653b628c59b9fc91"
+SRC_URI[archive.sha256sum] = "750d437185286f40a369e1e4f4764eda932b9459b5ec9a731628393dd3d32334"
diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-compat-units.bb b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-compat-units.bb
index 421fc06df..fe9a521d7 100644
--- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-compat-units.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-compat-units.bb
@@ -1,11 +1,10 @@
SUMMARY = "Enhances systemd compatilibity with existing SysVinit scripts"
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"
PR = "r29"
-DEPENDS = "systemd-systemctl-native"
+PACKAGE_WRITE_DEPS += "systemd-systemctl-native"
S = "${WORKDIR}"
diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-systemctl-native.bb b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-systemctl-native.bb
index fbdc9c0a1..fadc8433d 100644
--- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-systemctl-native.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-systemctl-native.bb
@@ -1,7 +1,7 @@
SUMMARY = "Wrapper for enabling systemd services"
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
PR = "r6"
diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-core-load-fragment-refuse-units-with-errors-in-certa.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-core-load-fragment-refuse-units-with-errors-in-certa.patch
new file mode 100644
index 000000000..80948b2ce
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-core-load-fragment-refuse-units-with-errors-in-certa.patch
@@ -0,0 +1,329 @@
+If a user is created with a strictly-speaking invalid name such as '0day' and a
+unit created to run as that user, systemd rejects the username and runs the unit
+as root.
+
+CVE: CVE-2017-1000082
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+From d8e1310e1ed7b6f122bc7eb8ba061fbd088783c0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
+Date: Thu, 6 Jul 2017 13:28:19 -0400
+Subject: [PATCH] core/load-fragment: refuse units with errors in certain
+ directives
+
+If an error is encountered in any of the Exec* lines, WorkingDirectory,
+SELinuxContext, ApparmorProfile, SmackProcessLabel, Service (in .socket
+units), User, or Group, refuse to load the unit. If the config stanza
+has support, ignore the failure if '-' is present.
+
+For those configuration directives, even if we started the unit, it's
+pretty likely that it'll do something unexpected (like write files
+in a wrong place, or with a wrong context, or run with wrong permissions,
+etc). It seems better to refuse to start the unit and have the admin
+clean up the configuration without giving the service a chance to mess
+up stuff.
+
+Note that all "security" options that restrict what the unit can do
+(Capabilities, AmbientCapabilities, Restrict*, SystemCallFilter, Limit*,
+PrivateDevices, Protect*, etc) are _not_ treated like this. Such options are
+only supplementary, and are not always available depending on the architecture
+and compilation options, so unit authors have to make sure that the service
+runs correctly without them anyway.
+
+Fixes #6237, #6277.
+
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+---
+ src/core/load-fragment.c | 104 ++++++++++++++++++++++++++++------------------
+ src/test/test-unit-file.c | 14 +++----
+ 2 files changed, 70 insertions(+), 48 deletions(-)
+
+diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
+index cbc826809..2047974f4 100644
+--- a/src/core/load-fragment.c
++++ b/src/core/load-fragment.c
+@@ -630,20 +630,28 @@ int config_parse_exec(
+
+ if (isempty(f)) {
+ /* First word is either "-" or "@" with no command. */
+- log_syntax(unit, LOG_ERR, filename, line, 0, "Empty path in command line, ignoring: \"%s\"", rvalue);
+- return 0;
++ log_syntax(unit, LOG_ERR, filename, line, 0,
++ "Empty path in command line%s: \"%s\"",
++ ignore ? ", ignoring" : "", rvalue);
++ return ignore ? 0 : -ENOEXEC;
+ }
+ if (!string_is_safe(f)) {
+- log_syntax(unit, LOG_ERR, filename, line, 0, "Executable path contains special characters, ignoring: %s", rvalue);
+- return 0;
++ log_syntax(unit, LOG_ERR, filename, line, 0,
++ "Executable path contains special characters%s: %s",
++ ignore ? ", ignoring" : "", rvalue);
++ return ignore ? 0 : -ENOEXEC;
+ }
+ if (!path_is_absolute(f)) {
+- log_syntax(unit, LOG_ERR, filename, line, 0, "Executable path is not absolute, ignoring: %s", rvalue);
+- return 0;
++ log_syntax(unit, LOG_ERR, filename, line, 0,
++ "Executable path is not absolute%s: %s",
++ ignore ? ", ignoring" : "", rvalue);
++ return ignore ? 0 : -ENOEXEC;
+ }
+ if (endswith(f, "/")) {
+- log_syntax(unit, LOG_ERR, filename, line, 0, "Executable path specifies a directory, ignoring: %s", rvalue);
+- return 0;
++ log_syntax(unit, LOG_ERR, filename, line, 0,
++ "Executable path specifies a directory%s: %s",
++ ignore ? ", ignoring" : "", rvalue);
++ return ignore ? 0 : -ENOEXEC;
+ }
+
+ if (f == firstword) {
+@@ -699,7 +707,7 @@ int config_parse_exec(
+ if (r == 0)
+ break;
+ else if (r < 0)
+- return 0;
++ return ignore ? 0 : -ENOEXEC;
+
+ if (!GREEDY_REALLOC(n, nbufsize, nlen + 2))
+ return log_oom();
+@@ -709,8 +717,10 @@ int config_parse_exec(
+ }
+
+ if (!n || !n[0]) {
+- log_syntax(unit, LOG_ERR, filename, line, 0, "Empty executable name or zeroeth argument, ignoring: %s", rvalue);
+- return 0;
++ log_syntax(unit, LOG_ERR, filename, line, 0,
++ "Empty executable name or zeroeth argument%s: %s",
++ ignore ? ", ignoring" : "", rvalue);
++ return ignore ? 0 : -ENOEXEC;
+ }
+
+ nce = new0(ExecCommand, 1);
+@@ -1315,8 +1325,10 @@ int config_parse_exec_selinux_context(
+
+ r = unit_name_printf(u, rvalue, &k);
+ if (r < 0) {
+- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %m");
+- return 0;
++ log_syntax(unit, LOG_ERR, filename, line, r,
++ "Failed to resolve specifiers%s: %m",
++ ignore ? ", ignoring" : "");
++ return ignore ? 0 : -ENOEXEC;
+ }
+
+ free(c->selinux_context);
+@@ -1363,8 +1375,10 @@ int config_parse_exec_apparmor_profile(
+
+ r = unit_name_printf(u, rvalue, &k);
+ if (r < 0) {
+- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %m");
+- return 0;
++ log_syntax(unit, LOG_ERR, filename, line, r,
++ "Failed to resolve specifiers%s: %m",
++ ignore ? ", ignoring" : "");
++ return ignore ? 0 : -ENOEXEC;
+ }
+
+ free(c->apparmor_profile);
+@@ -1411,8 +1425,10 @@ int config_parse_exec_smack_process_label(
+
+ r = unit_name_printf(u, rvalue, &k);
+ if (r < 0) {
+- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %m");
+- return 0;
++ log_syntax(unit, LOG_ERR, filename, line, r,
++ "Failed to resolve specifiers%s: %m",
++ ignore ? ", ignoring" : "");
++ return ignore ? 0 : -ENOEXEC;
+ }
+
+ free(c->smack_process_label);
+@@ -1630,19 +1646,19 @@ int config_parse_socket_service(
+
+ r = unit_name_printf(UNIT(s), rvalue, &p);
+ if (r < 0) {
+- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %s", rvalue);
+- return 0;
++ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers: %s", rvalue);
++ return -ENOEXEC;
+ }
+
+ if (!endswith(p, ".service")) {
+- log_syntax(unit, LOG_ERR, filename, line, 0, "Unit must be of type service, ignoring: %s", rvalue);
+- return 0;
++ log_syntax(unit, LOG_ERR, filename, line, 0, "Unit must be of type service: %s", rvalue);
++ return -ENOEXEC;
+ }
+
+ r = manager_load_unit(UNIT(s)->manager, p, NULL, &error, &x);
+ if (r < 0) {
+- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to load unit %s, ignoring: %s", rvalue, bus_error_message(&error, r));
+- return 0;
++ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to load unit %s: %s", rvalue, bus_error_message(&error, r));
++ return -ENOEXEC;
+ }
+
+ unit_ref_set(&s->service, x);
+@@ -1893,13 +1909,13 @@ int config_parse_user_group(
+
+ r = unit_full_printf(u, rvalue, &k);
+ if (r < 0) {
+- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s, ignoring: %m", rvalue);
+- return 0;
++ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s: %m", rvalue);
++ return -ENOEXEC;
+ }
+
+ if (!valid_user_group_name_or_id(k)) {
+- log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID, ignoring: %s", k);
+- return 0;
++ log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID: %s", k);
++ return -ENOEXEC;
+ }
+
+ n = k;
+@@ -1957,19 +1973,19 @@ int config_parse_user_group_strv(
+ if (r == -ENOMEM)
+ return log_oom();
+ if (r < 0) {
+- log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax, ignoring: %s", rvalue);
+- break;
++ log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax: %s", rvalue);
++ return -ENOEXEC;
+ }
+
+ r = unit_full_printf(u, word, &k);
+ if (r < 0) {
+- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s, ignoring: %m", word);
+- continue;
++ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s: %m", word);
++ return -ENOEXEC;
+ }
+
+ if (!valid_user_group_name_or_id(k)) {
+- log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID, ignoring: %s", k);
+- continue;
++ log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID: %s", k);
++ return -ENOEXEC;
+ }
+
+ r = strv_push(users, k);
+@@ -2128,25 +2144,28 @@ int config_parse_working_directory(
+
+ r = unit_full_printf(u, rvalue, &k);
+ if (r < 0) {
+- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in working directory path '%s', ignoring: %m", rvalue);
+- return 0;
++ log_syntax(unit, LOG_ERR, filename, line, r,
++ "Failed to resolve unit specifiers in working directory path '%s'%s: %m",
++ rvalue, missing_ok ? ", ignoring" : "");
++ return missing_ok ? 0 : -ENOEXEC;
+ }
+
+ path_kill_slashes(k);
+
+ if (!utf8_is_valid(k)) {
+ log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, rvalue);
+- return 0;
++ return missing_ok ? 0 : -ENOEXEC;
+ }
+
+ if (!path_is_absolute(k)) {
+- log_syntax(unit, LOG_ERR, filename, line, 0, "Working directory path '%s' is not absolute, ignoring.", rvalue);
+- return 0;
++ log_syntax(unit, LOG_ERR, filename, line, 0,
++ "Working directory path '%s' is not absolute%s.",
++ rvalue, missing_ok ? ", ignoring" : "");
++ return missing_ok ? 0 : -ENOEXEC;
+ }
+
+- free_and_replace(c->working_directory, k);
+-
+ c->working_directory_home = false;
++ free_and_replace(c->working_directory, k);
+ }
+
+ c->working_directory_missing_ok = missing_ok;
+@@ -4228,8 +4247,11 @@ int unit_load_fragment(Unit *u) {
+ return r;
+
+ r = load_from_path(u, k);
+- if (r < 0)
++ if (r < 0) {
++ if (r == -ENOEXEC)
++ log_unit_notice(u, "Unit configuration has fatal error, unit will not be started.");
+ return r;
++ }
+
+ if (u->load_state == UNIT_STUB) {
+ SET_FOREACH(t, u->names, i) {
+diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c
+index 12f48bf43..fd797b587 100644
+--- a/src/test/test-unit-file.c
++++ b/src/test/test-unit-file.c
+@@ -146,7 +146,7 @@ static void test_config_parse_exec(void) {
+ r = config_parse_exec(NULL, "fake", 4, "section", 1,
+ "LValue", 0, "/RValue/ argv0 r1",
+ &c, u);
+- assert_se(r == 0);
++ assert_se(r == -ENOEXEC);
+ assert_se(c1->command_next == NULL);
+
+ log_info("/* honour_argv0 */");
+@@ -161,7 +161,7 @@ static void test_config_parse_exec(void) {
+ r = config_parse_exec(NULL, "fake", 3, "section", 1,
+ "LValue", 0, "@/RValue",
+ &c, u);
+- assert_se(r == 0);
++ assert_se(r == -ENOEXEC);
+ assert_se(c1->command_next == NULL);
+
+ log_info("/* no command, whitespace only, reset */");
+@@ -220,7 +220,7 @@ static void test_config_parse_exec(void) {
+ "-@/RValue argv0 r1 ; ; "
+ "/goo/goo boo",
+ &c, u);
+- assert_se(r >= 0);
++ assert_se(r == -ENOEXEC);
+ c1 = c1->command_next;
+ check_execcommand(c1, "/RValue", "argv0", "r1", NULL, true);
+
+@@ -374,7 +374,7 @@ static void test_config_parse_exec(void) {
+ r = config_parse_exec(NULL, "fake", 4, "section", 1,
+ "LValue", 0, path,
+ &c, u);
+- assert_se(r == 0);
++ assert_se(r == -ENOEXEC);
+ assert_se(c1->command_next == NULL);
+ }
+
+@@ -401,21 +401,21 @@ static void test_config_parse_exec(void) {
+ r = config_parse_exec(NULL, "fake", 4, "section", 1,
+ "LValue", 0, "/path\\",
+ &c, u);
+- assert_se(r == 0);
++ assert_se(r == -ENOEXEC);
+ assert_se(c1->command_next == NULL);
+
+ log_info("/* missing ending ' */");
+ r = config_parse_exec(NULL, "fake", 4, "section", 1,
+ "LValue", 0, "/path 'foo",
+ &c, u);
+- assert_se(r == 0);
++ assert_se(r == -ENOEXEC);
+ assert_se(c1->command_next == NULL);
+
+ log_info("/* missing ending ' with trailing backslash */");
+ r = config_parse_exec(NULL, "fake", 4, "section", 1,
+ "LValue", 0, "/path 'foo\\",
+ &c, u);
+- assert_se(r == 0);
++ assert_se(r == -ENOEXEC);
+ assert_se(c1->command_next == NULL);
+
+ log_info("/* invalid space between modifiers */");
+--
+2.11.0
diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/validate-user.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/validate-user.patch
deleted file mode 100644
index 8e0e0c1b9..000000000
--- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/validate-user.patch
+++ /dev/null
@@ -1,856 +0,0 @@
-If a user is created with a strictly-speaking invalid name such as '0day' and a
-unit created to run as that user, systemd rejects the username and runs the unit
-as root.
-
-CVE: CVE-2017-1000082
-Upstream-Status: Backport
-Signed-off-by: Ross Burton <ross.burton@intel.com>
-
-From e0c4eb1435d50cb3797cf94100d4886dc2022bce Mon Sep 17 00:00:00 2001
-From: Lennart Poettering <lennart@poettering.net>
-Date: Thu, 14 Jul 2016 12:23:39 +0200
-Subject: [PATCH 1/3] sysusers: move various user credential validity checks to
- src/basic/
-
-This way we can reuse them for validating User=/Group= settings in unit files
-(to be added in a later commit).
-
-Also, add some tests for them.
----
- src/basic/user-util.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++
- src/basic/user-util.h | 5 +++
- src/sysusers/sysusers.c | 75 --------------------------------------
- src/test/test-user-util.c | 87 ++++++++++++++++++++++++++++++++++++++++++++
- 4 files changed, 185 insertions(+), 75 deletions(-)
-
-diff --git a/src/basic/user-util.c b/src/basic/user-util.c
-index f65ca3eda..c85b5c6a8 100644
---- a/src/basic/user-util.c
-+++ b/src/basic/user-util.c
-@@ -29,6 +29,7 @@
- #include <string.h>
- #include <sys/stat.h>
- #include <unistd.h>
-+#include <utmp.h>
-
- #include "missing.h"
- #include "alloc-util.h"
-@@ -39,6 +40,7 @@
- #include "path-util.h"
- #include "string-util.h"
- #include "user-util.h"
-+#include "utf8.h"
-
- bool uid_is_valid(uid_t uid) {
-
-@@ -479,3 +481,94 @@ int take_etc_passwd_lock(const char *root) {
-
- return fd;
- }
-+
-+bool valid_user_group_name(const char *u) {
-+ const char *i;
-+ long sz;
-+
-+ /* Checks if the specified name is a valid user/group name. */
-+
-+ if (isempty(u))
-+ return false;
-+
-+ if (!(u[0] >= 'a' && u[0] <= 'z') &&
-+ !(u[0] >= 'A' && u[0] <= 'Z') &&
-+ u[0] != '_')
-+ return false;
-+
-+ for (i = u+1; *i; i++) {
-+ if (!(*i >= 'a' && *i <= 'z') &&
-+ !(*i >= 'A' && *i <= 'Z') &&
-+ !(*i >= '0' && *i <= '9') &&
-+ *i != '_' &&
-+ *i != '-')
-+ return false;
-+ }
-+
-+ sz = sysconf(_SC_LOGIN_NAME_MAX);
-+ assert_se(sz > 0);
-+
-+ if ((size_t) (i-u) > (size_t) sz)
-+ return false;
-+
-+ if ((size_t) (i-u) > UT_NAMESIZE - 1)
-+ return false;
-+
-+ return true;
-+}
-+
-+bool valid_user_group_name_or_id(const char *u) {
-+
-+ /* Similar as above, but is also fine with numeric UID/GID specifications, as long as they are in the right
-+ * range, and not the invalid user ids. */
-+
-+ if (isempty(u))
-+ return false;
-+
-+ if (valid_user_group_name(u))
-+ return true;
-+
-+ return parse_uid(u, NULL) >= 0;
-+}
-+
-+bool valid_gecos(const char *d) {
-+
-+ if (!d)
-+ return false;
-+
-+ if (!utf8_is_valid(d))
-+ return false;
-+
-+ if (string_has_cc(d, NULL))
-+ return false;
-+
-+ /* Colons are used as field separators, and hence not OK */
-+ if (strchr(d, ':'))
-+ return false;
-+
-+ return true;
-+}
-+
-+bool valid_home(const char *p) {
-+
-+ if (isempty(p))
-+ return false;
-+
-+ if (!utf8_is_valid(p))
-+ return false;
-+
-+ if (string_has_cc(p, NULL))
-+ return false;
-+
-+ if (!path_is_absolute(p))
-+ return false;
-+
-+ if (!path_is_safe(p))
-+ return false;
-+
-+ /* Colons are used as field separators, and hence not OK */
-+ if (strchr(p, ':'))
-+ return false;
-+
-+ return true;
-+}
-diff --git a/src/basic/user-util.h b/src/basic/user-util.h
-index 8026eca3f..36f71fb00 100644
---- a/src/basic/user-util.h
-+++ b/src/basic/user-util.h
-@@ -68,3 +68,8 @@ int take_etc_passwd_lock(const char *root);
- static inline bool userns_supported(void) {
- return access("/proc/self/uid_map", F_OK) >= 0;
- }
-+
-+bool valid_user_group_name(const char *u);
-+bool valid_user_group_name_or_id(const char *u);
-+bool valid_gecos(const char *d);
-+bool valid_home(const char *p);
-diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
-index 4377f1b91..df3b7de30 100644
---- a/src/sysusers/sysusers.c
-+++ b/src/sysusers/sysusers.c
-@@ -1299,81 +1299,6 @@ static bool item_equal(Item *a, Item *b) {
- return true;
- }
-
--static bool valid_user_group_name(const char *u) {
-- const char *i;
-- long sz;
--
-- if (isempty(u))
-- return false;
--
-- if (!(u[0] >= 'a' && u[0] <= 'z') &&
-- !(u[0] >= 'A' && u[0] <= 'Z') &&
-- u[0] != '_')
-- return false;
--
-- for (i = u+1; *i; i++) {
-- if (!(*i >= 'a' && *i <= 'z') &&
-- !(*i >= 'A' && *i <= 'Z') &&
-- !(*i >= '0' && *i <= '9') &&
-- *i != '_' &&
-- *i != '-')
-- return false;
-- }
--
-- sz = sysconf(_SC_LOGIN_NAME_MAX);
-- assert_se(sz > 0);
--
-- if ((size_t) (i-u) > (size_t) sz)
-- return false;
--
-- if ((size_t) (i-u) > UT_NAMESIZE - 1)
-- return false;
--
-- return true;
--}
--
--static bool valid_gecos(const char *d) {
--
-- if (!d)
-- return false;
--
-- if (!utf8_is_valid(d))
-- return false;
--
-- if (string_has_cc(d, NULL))
-- return false;
--
-- /* Colons are used as field separators, and hence not OK */
-- if (strchr(d, ':'))
-- return false;
--
-- return true;
--}
--
--static bool valid_home(const char *p) {
--
-- if (isempty(p))
-- return false;
--
-- if (!utf8_is_valid(p))
-- return false;
--
-- if (string_has_cc(p, NULL))
-- return false;
--
-- if (!path_is_absolute(p))
-- return false;
--
-- if (!path_is_safe(p))
-- return false;
--
-- /* Colons are used as field separators, and hence not OK */
-- if (strchr(p, ':'))
-- return false;
--
-- return true;
--}
--
- static int parse_line(const char *fname, unsigned line, const char *buffer) {
-
- static const Specifier specifier_table[] = {
-diff --git a/src/test/test-user-util.c b/src/test/test-user-util.c
-index 8d1ec19f1..2a344a9f9 100644
---- a/src/test/test-user-util.c
-+++ b/src/test/test-user-util.c
-@@ -61,6 +61,88 @@ static void test_uid_ptr(void) {
- assert_se(PTR_TO_UID(UID_TO_PTR(1000)) == 1000);
- }
-
-+static void test_valid_user_group_name(void) {
-+ assert_se(!valid_user_group_name(NULL));
-+ assert_se(!valid_user_group_name(""));
-+ assert_se(!valid_user_group_name("1"));
-+ assert_se(!valid_user_group_name("65535"));
-+ assert_se(!valid_user_group_name("-1"));
-+ assert_se(!valid_user_group_name("-kkk"));
-+ assert_se(!valid_user_group_name("rööt"));
-+ assert_se(!valid_user_group_name("."));
-+ assert_se(!valid_user_group_name("eff.eff"));
-+ assert_se(!valid_user_group_name("foo\nbar"));
-+ assert_se(!valid_user_group_name("0123456789012345678901234567890123456789"));
-+ assert_se(!valid_user_group_name_or_id("aaa:bbb"));
-+
-+ assert_se(valid_user_group_name("root"));
-+ assert_se(valid_user_group_name("lennart"));
-+ assert_se(valid_user_group_name("LENNART"));
-+ assert_se(valid_user_group_name("_kkk"));
-+ assert_se(valid_user_group_name("kkk-"));
-+ assert_se(valid_user_group_name("kk-k"));
-+
-+ assert_se(valid_user_group_name("some5"));
-+ assert_se(!valid_user_group_name("5some"));
-+ assert_se(valid_user_group_name("INNER5NUMBER"));
-+}
-+
-+static void test_valid_user_group_name_or_id(void) {
-+ assert_se(!valid_user_group_name_or_id(NULL));
-+ assert_se(!valid_user_group_name_or_id(""));
-+ assert_se(valid_user_group_name_or_id("0"));
-+ assert_se(valid_user_group_name_or_id("1"));
-+ assert_se(valid_user_group_name_or_id("65534"));
-+ assert_se(!valid_user_group_name_or_id("65535"));
-+ assert_se(valid_user_group_name_or_id("65536"));
-+ assert_se(!valid_user_group_name_or_id("-1"));
-+ assert_se(!valid_user_group_name_or_id("-kkk"));
-+ assert_se(!valid_user_group_name_or_id("rööt"));
-+ assert_se(!valid_user_group_name_or_id("."));
-+ assert_se(!valid_user_group_name_or_id("eff.eff"));
-+ assert_se(!valid_user_group_name_or_id("foo\nbar"));
-+ assert_se(!valid_user_group_name_or_id("0123456789012345678901234567890123456789"));
-+ assert_se(!valid_user_group_name_or_id("aaa:bbb"));
-+
-+ assert_se(valid_user_group_name_or_id("root"));
-+ assert_se(valid_user_group_name_or_id("lennart"));
-+ assert_se(valid_user_group_name_or_id("LENNART"));
-+ assert_se(valid_user_group_name_or_id("_kkk"));
-+ assert_se(valid_user_group_name_or_id("kkk-"));
-+ assert_se(valid_user_group_name_or_id("kk-k"));
-+
-+ assert_se(valid_user_group_name_or_id("some5"));
-+ assert_se(!valid_user_group_name_or_id("5some"));
-+ assert_se(valid_user_group_name_or_id("INNER5NUMBER"));
-+}
-+
-+static void test_valid_gecos(void) {
-+
-+ assert_se(!valid_gecos(NULL));
-+ assert_se(valid_gecos(""));
-+ assert_se(valid_gecos("test"));
-+ assert_se(valid_gecos("Ümläüt"));
-+ assert_se(!valid_gecos("In\nvalid"));
-+ assert_se(!valid_gecos("In:valid"));
-+}
-+
-+static void test_valid_home(void) {
-+
-+ assert_se(!valid_home(NULL));
-+ assert_se(!valid_home(""));
-+ assert_se(!valid_home("."));
-+ assert_se(!valid_home("/home/.."));
-+ assert_se(!valid_home("/home/../"));
-+ assert_se(!valid_home("/home\n/foo"));
-+ assert_se(!valid_home("./piep"));
-+ assert_se(!valid_home("piep"));
-+ assert_se(!valid_home("/home/user:lennart"));
-+
-+ assert_se(valid_home("/"));
-+ assert_se(valid_home("/home"));
-+ assert_se(valid_home("/home/foo"));
-+}
-+
- int main(int argc, char*argv[]) {
-
- test_uid_to_name_one(0, "root");
-@@ -75,5 +157,10 @@ int main(int argc, char*argv[]) {
- test_parse_uid();
- test_uid_ptr();
-
-+ test_valid_user_group_name();
-+ test_valid_user_group_name_or_id();
-+ test_valid_gecos();
-+ test_valid_home();
-+
- return 0;
- }
---
-2.11.0
-
-
-From 1affacaaf6eff93e53563a644567cc5c3930cb28 Mon Sep 17 00:00:00 2001
-From: Lennart Poettering <lennart@poettering.net>
-Date: Thu, 14 Jul 2016 12:28:06 +0200
-Subject: [PATCH 2/3] core: be stricter when parsing User=/Group= fields
-
-Let's verify the validity of the syntax of the user/group names set.
----
- src/core/load-fragment-gperf.gperf.m4 | 10 +--
- src/core/load-fragment.c | 118 ++++++++++++++++++++++++++++++++++
- src/core/load-fragment.h | 2 +
- 3 files changed, 125 insertions(+), 5 deletions(-)
-
-diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4
-index 819341898..110089696 100644
---- a/src/core/load-fragment-gperf.gperf.m4
-+++ b/src/core/load-fragment-gperf.gperf.m4
-@@ -19,9 +19,9 @@ m4_dnl Define the context options only once
- m4_define(`EXEC_CONTEXT_CONFIG_ITEMS',
- `$1.WorkingDirectory, config_parse_working_directory, 0, offsetof($1, exec_context)
- $1.RootDirectory, config_parse_unit_path_printf, 0, offsetof($1, exec_context.root_directory)
--$1.User, config_parse_unit_string_printf, 0, offsetof($1, exec_context.user)
--$1.Group, config_parse_unit_string_printf, 0, offsetof($1, exec_context.group)
--$1.SupplementaryGroups, config_parse_strv, 0, offsetof($1, exec_context.supplementary_groups)
-+$1.User, config_parse_user_group, 0, offsetof($1, exec_context.user)
-+$1.Group, config_parse_user_group, 0, offsetof($1, exec_context.group)
-+$1.SupplementaryGroups, config_parse_user_group_strv, 0, offsetof($1, exec_context.supplementary_groups)
- $1.Nice, config_parse_exec_nice, 0, offsetof($1, exec_context)
- $1.OOMScoreAdjust, config_parse_exec_oom_score_adjust, 0, offsetof($1, exec_context)
- $1.IOSchedulingClass, config_parse_exec_io_class, 0, offsetof($1, exec_context)
-@@ -275,8 +275,8 @@ Socket.ExecStartPost, config_parse_exec, SOCKET_EXEC
- Socket.ExecStopPre, config_parse_exec, SOCKET_EXEC_STOP_PRE, offsetof(Socket, exec_command)
- Socket.ExecStopPost, config_parse_exec, SOCKET_EXEC_STOP_POST, offsetof(Socket, exec_command)
- Socket.TimeoutSec, config_parse_sec, 0, offsetof(Socket, timeout_usec)
--Socket.SocketUser, config_parse_unit_string_printf, 0, offsetof(Socket, user)
--Socket.SocketGroup, config_parse_unit_string_printf, 0, offsetof(Socket, group)
-+Socket.SocketUser, config_parse_user_group, 0, offsetof(Socket, user)
-+Socket.SocketGroup, config_parse_user_group, 0, offsetof(Socket, group)
- Socket.SocketMode, config_parse_mode, 0, offsetof(Socket, socket_mode)
- Socket.DirectoryMode, config_parse_mode, 0, offsetof(Socket, directory_mode)
- Socket.Accept, config_parse_bool, 0, offsetof(Socket, accept)
-diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
-index 86b4fb071..f43781803 100644
---- a/src/core/load-fragment.c
-+++ b/src/core/load-fragment.c
-@@ -64,6 +64,7 @@
- #include "unit-name.h"
- #include "unit-printf.h"
- #include "unit.h"
-+#include "user-util.h"
- #include "utf8.h"
- #include "web-util.h"
-
-@@ -1758,6 +1759,123 @@ int config_parse_sec_fix_0(
- return 0;
- }
-
-+int config_parse_user_group(
-+ const char *unit,
-+ const char *filename,
-+ unsigned line,
-+ const char *section,
-+ unsigned section_line,
-+ const char *lvalue,
-+ int ltype,
-+ const char *rvalue,
-+ void *data,
-+ void *userdata) {
-+
-+ char **user = data, *n;
-+ Unit *u = userdata;
-+ int r;
-+
-+ assert(filename);
-+ assert(lvalue);
-+ assert(rvalue);
-+ assert(u);
-+
-+ if (isempty(rvalue))
-+ n = NULL;
-+ else {
-+ _cleanup_free_ char *k = NULL;
-+
-+ r = unit_full_printf(u, rvalue, &k);
-+ if (r < 0) {
-+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s, ignoring: %m", rvalue);
-+ return 0;
-+ }
-+
-+ if (!valid_user_group_name_or_id(k)) {
-+ log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID, ignoring: %s", k);
-+ return 0;
-+ }
-+
-+ n = k;
-+ k = NULL;
-+ }
-+
-+ free(*user);
-+ *user = n;
-+
-+ return 0;
-+}
-+
-+int config_parse_user_group_strv(
-+ const char *unit,
-+ const char *filename,
-+ unsigned line,
-+ const char *section,
-+ unsigned section_line,
-+ const char *lvalue,
-+ int ltype,
-+ const char *rvalue,
-+ void *data,
-+ void *userdata) {
-+
-+ char ***users = data;
-+ Unit *u = userdata;
-+ const char *p;
-+ int r;
-+
-+ assert(filename);
-+ assert(lvalue);
-+ assert(rvalue);
-+ assert(u);
-+
-+ if (isempty(rvalue)) {
-+ char **empty;
-+
-+ empty = new0(char*, 1);
-+ if (!empty)
-+ return log_oom();
-+
-+ strv_free(*users);
-+ *users = empty;
-+
-+ return 0;
-+ }
-+
-+ p = rvalue;
-+ for (;;) {
-+ _cleanup_free_ char *word = NULL, *k = NULL;
-+
-+ r = extract_first_word(&p, &word, WHITESPACE, 0);
-+ if (r == 0)
-+ break;
-+ if (r == -ENOMEM)
-+ return log_oom();
-+ if (r < 0) {
-+ log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax, ignoring: %s", rvalue);
-+ break;
-+ }
-+
-+ r = unit_full_printf(u, word, &k);
-+ if (r < 0) {
-+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s, ignoring: %m", word);
-+ continue;
-+ }
-+
-+ if (!valid_user_group_name_or_id(k)) {
-+ log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID, ignoring: %s", k);
-+ continue;
-+ }
-+
-+ r = strv_push(users, k);
-+ if (r < 0)
-+ return log_oom();
-+
-+ k = NULL;
-+ }
-+
-+ return 0;
-+}
-+
- int config_parse_busname_service(
- const char *unit,
- const char *filename,
-diff --git a/src/core/load-fragment.h b/src/core/load-fragment.h
-index b36a2e3a0..213bce55a 100644
---- a/src/core/load-fragment.h
-+++ b/src/core/load-fragment.h
-@@ -111,6 +111,8 @@ int config_parse_exec_utmp_mode(const char *unit, const char *filename, unsigned
- int config_parse_working_directory(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
- int config_parse_fdname(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
- int config_parse_sec_fix_0(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-+int config_parse_user_group(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-+int config_parse_user_group_strv(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-
- /* gperf prototypes */
- const struct ConfigPerfItem* load_fragment_gperf_lookup(const char *key, unsigned length);
---
-2.11.0
-
-
-From 97e0456384ed5c930394062d340237ea6130ece0 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
-Date: Thu, 6 Jul 2017 13:28:19 -0400
-Subject: [PATCH 3/3] core/load-fragment: refuse units with errors in certain
- directives
-
-If an error is encountered in any of the Exec* lines, WorkingDirectory,
-SELinuxContext, ApparmorProfile, SmackProcessLabel, Service (in .socket
-units), User, or Group, refuse to load the unit. If the config stanza
-has support, ignore the failure if '-' is present.
-
-For those configuration directives, even if we started the unit, it's
-pretty likely that it'll do something unexpected (like write files
-in a wrong place, or with a wrong context, or run with wrong permissions,
-etc). It seems better to refuse to start the unit and have the admin
-clean up the configuration without giving the service a chance to mess
-up stuff.
-
-Note that all "security" options that restrict what the unit can do
-(Capabilities, AmbientCapabilities, Restrict*, SystemCallFilter, Limit*,
-PrivateDevices, Protect*, etc) are _not_ treated like this. Such options are
-only supplementary, and are not always available depending on the architecture
-and compilation options, so unit authors have to make sure that the service
-runs correctly without them anyway.
-
-Fixes #6237, #6277.
-
-Signed-off-by: Ross Burton <ross.burton@intel.com>
----
- src/core/load-fragment.c | 101 ++++++++++++++++++++++++++++------------------
- src/test/test-unit-file.c | 14 +++----
- 2 files changed, 69 insertions(+), 46 deletions(-)
-
-diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
-index f43781803..b1fb1d407 100644
---- a/src/core/load-fragment.c
-+++ b/src/core/load-fragment.c
-@@ -626,20 +626,28 @@ int config_parse_exec(
-
- if (isempty(f)) {
- /* First word is either "-" or "@" with no command. */
-- log_syntax(unit, LOG_ERR, filename, line, 0, "Empty path in command line, ignoring: \"%s\"", rvalue);
-- return 0;
-+ log_syntax(unit, LOG_ERR, filename, line, 0,
-+ "Empty path in command line%s: \"%s\"",
-+ ignore ? ", ignoring" : "", rvalue);
-+ return ignore ? 0 : -ENOEXEC;
- }
- if (!string_is_safe(f)) {
-- log_syntax(unit, LOG_ERR, filename, line, 0, "Executable path contains special characters, ignoring: %s", rvalue);
-- return 0;
-+ log_syntax(unit, LOG_ERR, filename, line, 0,
-+ "Executable path contains special characters%s: %s",
-+ ignore ? ", ignoring" : "", rvalue);
-+ return ignore ? 0 : -ENOEXEC;
- }
- if (!path_is_absolute(f)) {
-- log_syntax(unit, LOG_ERR, filename, line, 0, "Executable path is not absolute, ignoring: %s", rvalue);
-- return 0;
-+ log_syntax(unit, LOG_ERR, filename, line, 0,
-+ "Executable path is not absolute%s: %s",
-+ ignore ? ", ignoring" : "", rvalue);
-+ return ignore ? 0 : -ENOEXEC;
- }
- if (endswith(f, "/")) {
-- log_syntax(unit, LOG_ERR, filename, line, 0, "Executable path specifies a directory, ignoring: %s", rvalue);
-- return 0;
-+ log_syntax(unit, LOG_ERR, filename, line, 0,
-+ "Executable path specifies a directory%s: %s",
-+ ignore ? ", ignoring" : "", rvalue);
-+ return ignore ? 0 : -ENOEXEC;
- }
-
- if (f == firstword) {
-@@ -695,7 +703,7 @@ int config_parse_exec(
- if (r == 0)
- break;
- else if (r < 0)
-- return 0;
-+ return ignore ? 0 : -ENOEXEC;
-
- if (!GREEDY_REALLOC(n, nbufsize, nlen + 2))
- return log_oom();
-@@ -705,8 +713,10 @@ int config_parse_exec(
- }
-
- if (!n || !n[0]) {
-- log_syntax(unit, LOG_ERR, filename, line, 0, "Empty executable name or zeroeth argument, ignoring: %s", rvalue);
-- return 0;
-+ log_syntax(unit, LOG_ERR, filename, line, 0,
-+ "Empty executable name or zeroeth argument%s: %s",
-+ ignore ? ", ignoring" : "", rvalue);
-+ return ignore ? 0 : -ENOEXEC;
- }
-
- nce = new0(ExecCommand, 1);
-@@ -1214,8 +1224,10 @@ int config_parse_exec_selinux_context(
-
- r = unit_name_printf(u, rvalue, &k);
- if (r < 0) {
-- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %m");
-- return 0;
-+ log_syntax(unit, LOG_ERR, filename, line, r,
-+ "Failed to resolve specifiers%s: %m",
-+ ignore ? ", ignoring" : "");
-+ return ignore ? 0 : -ENOEXEC;
- }
-
- free(c->selinux_context);
-@@ -1262,8 +1274,10 @@ int config_parse_exec_apparmor_profile(
-
- r = unit_name_printf(u, rvalue, &k);
- if (r < 0) {
-- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %m");
-- return 0;
-+ log_syntax(unit, LOG_ERR, filename, line, r,
-+ "Failed to resolve specifiers%s: %m",
-+ ignore ? ", ignoring" : "");
-+ return ignore ? 0 : -ENOEXEC;
- }
-
- free(c->apparmor_profile);
-@@ -1310,8 +1324,10 @@ int config_parse_exec_smack_process_label(
-
- r = unit_name_printf(u, rvalue, &k);
- if (r < 0) {
-- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %m");
-- return 0;
-+ log_syntax(unit, LOG_ERR, filename, line, r,
-+ "Failed to resolve specifiers%s: %m",
-+ ignore ? ", ignoring" : "");
-+ return ignore ? 0 : -ENOEXEC;
- }
-
- free(c->smack_process_label);
-@@ -1520,19 +1536,19 @@ int config_parse_socket_service(
-
- r = unit_name_printf(UNIT(s), rvalue, &p);
- if (r < 0) {
-- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %s", rvalue);
-- return 0;
-+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers: %s", rvalue);
-+ return -ENOEXEC;
- }
-
- if (!endswith(p, ".service")) {
-- log_syntax(unit, LOG_ERR, filename, line, 0, "Unit must be of type service, ignoring: %s", rvalue);
-- return 0;
-+ log_syntax(unit, LOG_ERR, filename, line, 0, "Unit must be of type service: %s", rvalue);
-+ return -ENOEXEC;
- }
-
- r = manager_load_unit(UNIT(s)->manager, p, NULL, &error, &x);
- if (r < 0) {
-- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to load unit %s, ignoring: %s", rvalue, bus_error_message(&error, r));
-- return 0;
-+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to load unit %s: %s", rvalue, bus_error_message(&error, r));
-+ return -ENOEXEC;
- }
-
- unit_ref_set(&s->service, x);
-@@ -1787,13 +1803,13 @@ int config_parse_user_group(
-
- r = unit_full_printf(u, rvalue, &k);
- if (r < 0) {
-- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s, ignoring: %m", rvalue);
-- return 0;
-+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s: %m", rvalue);
-+ return -ENOEXEC;
- }
-
- if (!valid_user_group_name_or_id(k)) {
-- log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID, ignoring: %s", k);
-- return 0;
-+ log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID: %s", k);
-+ return -ENOEXEC;
- }
-
- n = k;
-@@ -1851,19 +1867,19 @@ int config_parse_user_group_strv(
- if (r == -ENOMEM)
- return log_oom();
- if (r < 0) {
-- log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax, ignoring: %s", rvalue);
-- break;
-+ log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax: %s", rvalue);
-+ return -ENOEXEC;
- }
-
- r = unit_full_printf(u, word, &k);
- if (r < 0) {
-- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s, ignoring: %m", word);
-- continue;
-+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s: %m", word);
-+ return -ENOEXEC;
- }
-
- if (!valid_user_group_name_or_id(k)) {
-- log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID, ignoring: %s", k);
-- continue;
-+ log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID: %s", k);
-+ return -ENOEXEC;
- }
-
- r = strv_push(users, k);
-@@ -2022,20 +2038,24 @@ int config_parse_working_directory(
-
- r = unit_full_printf(u, rvalue, &k);
- if (r < 0) {
-- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in working directory path '%s', ignoring: %m", rvalue);
-- return 0;
-+ log_syntax(unit, LOG_ERR, filename, line, r,
-+ "Failed to resolve unit specifiers in working directory path '%s'%s: %m",
-+ rvalue, missing_ok ? ", ignoring" : "");
-+ return missing_ok ? 0 : -ENOEXEC;
- }
-
- path_kill_slashes(k);
-
- if (!utf8_is_valid(k)) {
- log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, rvalue);
-- return 0;
-+ return missing_ok ? 0 : -ENOEXEC;
- }
-
- if (!path_is_absolute(k)) {
-- log_syntax(unit, LOG_ERR, filename, line, 0, "Working directory path '%s' is not absolute, ignoring.", rvalue);
-- return 0;
-+ log_syntax(unit, LOG_ERR, filename, line, 0,
-+ "Working directory path '%s' is not absolute%s.",
-+ rvalue, missing_ok ? ", ignoring" : "");
-+ return missing_ok ? 0 : -ENOEXEC;
- }
-
- free(c->working_directory);
-@@ -4043,8 +4063,11 @@ int unit_load_fragment(Unit *u) {
- return r;
-
- r = load_from_path(u, k);
-- if (r < 0)
-+ if (r < 0) {
-+ if (r == -ENOEXEC)
-+ log_unit_notice(u, "Unit configuration has fatal error, unit will not be started.");
- return r;
-+ }
-
- if (u->load_state == UNIT_STUB) {
- SET_FOREACH(t, u->names, i) {
-diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c
-index ade0ff2a6..fe1969570 100644
---- a/src/test/test-unit-file.c
-+++ b/src/test/test-unit-file.c
-@@ -146,7 +146,7 @@ static void test_config_parse_exec(void) {
- r = config_parse_exec(NULL, "fake", 4, "section", 1,
- "LValue", 0, "/RValue/ argv0 r1",
- &c, u);
-- assert_se(r == 0);
-+ assert_se(r == -ENOEXEC);
- assert_se(c1->command_next == NULL);
-
- log_info("/* honour_argv0 */");
-@@ -161,7 +161,7 @@ static void test_config_parse_exec(void) {
- r = config_parse_exec(NULL, "fake", 3, "section", 1,
- "LValue", 0, "@/RValue",
- &c, u);
-- assert_se(r == 0);
-+ assert_se(r == -ENOEXEC);
- assert_se(c1->command_next == NULL);
-
- log_info("/* no command, whitespace only, reset */");
-@@ -220,7 +220,7 @@ static void test_config_parse_exec(void) {
- "-@/RValue argv0 r1 ; ; "
- "/goo/goo boo",
- &c, u);
-- assert_se(r >= 0);
-+ assert_se(r == -ENOEXEC);
- c1 = c1->command_next;
- check_execcommand(c1, "/RValue", "argv0", "r1", NULL, true);
-
-@@ -374,7 +374,7 @@ static void test_config_parse_exec(void) {
- r = config_parse_exec(NULL, "fake", 4, "section", 1,
- "LValue", 0, path,
- &c, u);
-- assert_se(r == 0);
-+ assert_se(r == -ENOEXEC);
- assert_se(c1->command_next == NULL);
- }
-
-@@ -401,21 +401,21 @@ static void test_config_parse_exec(void) {
- r = config_parse_exec(NULL, "fake", 4, "section", 1,
- "LValue", 0, "/path\\",
- &c, u);
-- assert_se(r == 0);
-+ assert_se(r == -ENOEXEC);
- assert_se(c1->command_next == NULL);
-
- log_info("/* missing ending ' */");
- r = config_parse_exec(NULL, "fake", 4, "section", 1,
- "LValue", 0, "/path 'foo",
- &c, u);
-- assert_se(r == 0);
-+ assert_se(r == -ENOEXEC);
- assert_se(c1->command_next == NULL);
-
- log_info("/* missing ending ' with trailing backslash */");
- r = config_parse_exec(NULL, "fake", 4, "section", 1,
- "LValue", 0, "/path 'foo\\",
- &c, u);
-- assert_se(r == 0);
-+ assert_se(r == -ENOEXEC);
- assert_se(c1->command_next == NULL);
-
- log_info("/* invalid space between modifiers */");
---
-2.11.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd_232.bb b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd_232.bb
index df1d9e137..25fe49641 100644
--- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd_232.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd_232.bb
@@ -4,11 +4,11 @@ PROVIDES = "udev"
PE = "1"
-DEPENDS = "kmod docbook-sgml-dtd-4.1-native intltool-native gperf-native acl readline libcap libcgroup qemu-native util-linux"
+DEPENDS = "kmod intltool-native gperf-native acl readline libcap libcgroup util-linux"
SECTION = "base/shell"
-inherit useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu systemd ptest gettext bash-completion
+inherit useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu systemd ptest gettext bash-completion manpages
SRC_URI += " \
file://touchscreen.rules \
@@ -33,6 +33,7 @@ SRC_URI += " \
file://0018-check-for-uchar.h-in-configure.patch \
file://0019-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch \
file://0020-back-port-233-don-t-use-the-unified-hierarchy-for-the-systemd.patch \
+ file://0001-core-load-fragment-refuse-units-with-errors-in-certa.patch \
"
SRC_URI_append_libc-uclibc = "\
file://0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch \
@@ -40,16 +41,14 @@ SRC_URI_append_libc-uclibc = "\
SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
PACKAGECONFIG ??= "xz \
- ldconfig \
- ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} \
+ ${@bb.utils.filter('DISTRO_FEATURES', 'efi pam selinux ldconfig', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
- ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \
- ${@bb.utils.contains('MACHINE_FEATURES', 'efi', 'efi', '', d)} \
binfmt \
randomseed \
machined \
backlight \
+ vconsole \
quotacheck \
hostnamed \
${@bb.utils.contains('TCLIBC', 'glibc', 'myhostname sysusers', '', d)} \
@@ -82,6 +81,7 @@ PACKAGECONFIG[resolved] = "--enable-resolved,--disable-resolved"
PACKAGECONFIG[networkd] = "--enable-networkd,--disable-networkd"
PACKAGECONFIG[machined] = "--enable-machined,--disable-machined"
PACKAGECONFIG[backlight] = "--enable-backlight,--disable-backlight"
+PACKAGECONFIG[vconsole] = "--enable-vconsole,--disable-vconsole,,${PN}-vconsole-setup"
PACKAGECONFIG[quotacheck] = "--enable-quotacheck,--disable-quotacheck"
PACKAGECONFIG[hostnamed] = "--enable-hostnamed,--disable-hostnamed"
PACKAGECONFIG[myhostname] = "--enable-myhostname,--disable-myhostname"
@@ -161,6 +161,9 @@ CFLAGS .= "${@bb.utils.contains('PACKAGECONFIG', 'valgrind', ' -DVALGRIND=1', ''
# disable problematic GCC 5.2 optimizations [YOCTO #8291]
FULL_OPTIMIZATION_append_arm = " -fno-schedule-insns -fno-schedule-insns2"
+# Avoid login failure on qemumips64 when pam is enabled
+FULL_OPTIMIZATION_append_mips64 = " -fno-tree-switch-conversion -fno-tree-tail-merge"
+
do_configure_prepend() {
export NM="${HOST_PREFIX}gcc-nm"
export AR="${HOST_PREFIX}gcc-ar"
@@ -274,7 +277,7 @@ do_install_ptest () {
}
python populate_packages_prepend (){
- systemdlibdir = d.getVar("rootlibdir", True)
+ systemdlibdir = d.getVar("rootlibdir")
do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True)
}
PACKAGES_DYNAMIC += "^lib(udev|systemd|nss).*"
@@ -365,6 +368,7 @@ FILES_${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.c
${systemd_system_unitdir}/org.freedesktop.machine1.busname \
${systemd_system_unitdir}/systemd-importd.service \
${systemd_system_unitdir}/systemd-machined.service \
+ ${systemd_system_unitdir}/dbus-org.freedesktop.machine1.service \
${systemd_system_unitdir}/var-lib-machines.mount \
${rootlibexecdir}/systemd/systemd-import \
${rootlibexecdir}/systemd/systemd-importd \
@@ -450,7 +454,6 @@ FILES_${PN} = " ${base_bindir}/* \
${rootlibexecdir}/systemd/* \
${systemd_unitdir}/* \
${base_libdir}/security/*.so \
- ${libdir}/libnss_* \
/cgroup \
${bindir}/systemd* \
${bindir}/busctl \
@@ -478,7 +481,6 @@ RDEPENDS_${PN} += "kmod dbus util-linux-mount udev (= ${EXTENDPKGV})"
RDEPENDS_${PN} += "volatile-binds update-rc.d"
RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)} \
- systemd-vconsole-setup \
systemd-extra-utils \
systemd-compat-units udev-hwdb \
util-linux-agetty util-linux-fsck e2fsprogs-e2fsck \
@@ -570,6 +572,7 @@ pkg_prerm_${PN} () {
-i $D${sysconfdir}/nsswitch.conf
}
+PACKAGE_WRITE_DEPS += "qemu-native"
pkg_postinst_udev-hwdb () {
if test -n "$D"; then
${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
@@ -591,6 +594,6 @@ python () {
raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES")
import re
- if re.match('.*musl*', d.getVar('TARGET_OS', True)) != None:
+ if re.match('.*musl*', d.getVar('TARGET_OS')) != None:
raise bb.parse.SkipPackage("Not _yet_ supported on musl based targets")
}
diff --git a/import-layers/yocto-poky/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty b/import-layers/yocto-poky/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
index 6eaeb7a2b..e3d052a84 100644
--- a/import-layers/yocto-poky/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
+++ b/import-layers/yocto-poky/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
@@ -1,5 +1,5 @@
#!/bin/sh
if [ -c /dev/$2 ]
then
- /sbin/getty -L $1 $2
+ /sbin/getty -L $1 $2 $3
fi
diff --git a/import-layers/yocto-poky/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb b/import-layers/yocto-poky/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
index f136ad821..5b9c422ca 100644
--- a/import-layers/yocto-poky/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
@@ -28,7 +28,7 @@ do_install() {
j=`echo ${i} | sed s/\;/\ /g`
l=`echo ${i} | sed -e 's/tty//' -e 's/^.*;//' -e 's/;.*//'`
label=`echo $l | sed 's/.*\(....\)/\1/'`
- echo "$label:12345:respawn:${base_bindir}/start_getty ${j}" >> ${D}${sysconfdir}/inittab
+ echo "$label:12345:respawn:${base_bindir}/start_getty ${j} vt102" >> ${D}${sysconfdir}/inittab
done
if [ "${USE_VT}" = "1" ]; then
@@ -62,7 +62,7 @@ if [ "x$D" = "x" ] && [ -e /proc/consoles ]; then
k=`echo ${i} | sed s/^.*\://g`
if [ -z "`grep ${j} /proc/consoles`" ]; then
if [ -z "${k}" ] || [ -z "`grep ${k} /proc/consoles`" ] || [ ! -e /dev/${j} ]; then
- sed -i /^.*${j}$/d /etc/inittab
+ sed -i -e /^.*${j}\ /d -e /^.*${j}$/d /etc/inittab
fi
fi
done
diff --git a/import-layers/yocto-poky/meta/recipes-core/udev/eudev/0014-Revert-rules-remove-firmware-loading-rules.patch b/import-layers/yocto-poky/meta/recipes-core/udev/eudev/0014-Revert-rules-remove-firmware-loading-rules.patch
new file mode 100644
index 000000000..fe2ba5328
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/udev/eudev/0014-Revert-rules-remove-firmware-loading-rules.patch
@@ -0,0 +1,28 @@
+From 4f0a722489154da99e7f6b3051afde984eed2f74 Mon Sep 17 00:00:00 2001
+From: Jonathan Liu <net147@gmail.com>
+Date: Thu, 19 Mar 2015 15:01:29 +1100
+Subject: [PATCH] Revert "rules: remove firmware loading rules"
+
+This reverts commit 70e7d754ddb356fb1a2942b262f8cee9650e2a19.
+Userspace firmware loading support is needed for Linux < 3.7.
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Jonathan Liu <net147@gmail.com>
+---
+ rules/50-firmware.rules | 3 +++
+ 1 file changed, 3 insertions(+)
+ create mode 100644 rules/50-firmware.rules
+
+diff --git a/rules/50-firmware.rules b/rules/50-firmware.rules
+new file mode 100644
+index 0000000..f0ae684
+--- /dev/null
++++ b/rules/50-firmware.rules
+@@ -0,0 +1,3 @@
++# do not edit this file, it will be overwritten on update
++
++SUBSYSTEM=="firmware", ACTION=="add", RUN{builtin}="firmware"
+--
+2.3.3
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/udev/eudev/Revert-udev-remove-userspace-firmware-loading-suppor.patch b/import-layers/yocto-poky/meta/recipes-core/udev/eudev/Revert-udev-remove-userspace-firmware-loading-suppor.patch
new file mode 100644
index 000000000..db333e937
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/udev/eudev/Revert-udev-remove-userspace-firmware-loading-suppor.patch
@@ -0,0 +1,364 @@
+From e415372cc7a2f52e70e1cfa8c6c1f633b411355d Mon Sep 17 00:00:00 2001
+From: Lauren Post <lauren.post@nxp.com>
+Date: Wed, 8 Jun 2016 06:51:56 -0500
+Subject: [PATCH] Revert "udev: remove userspace firmware loading support"
+
+This reverts commit 3b717594600fa717cdf9bcfd0c7c1b703b245482.
+
+Conflicts:
+ configure.ac
+ src/udev/udevd.c
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Lauren Post <lauren.post@nxp.com>
+---
+ configure.ac | 39 +++++++++-
+ rules/Makefile.am | 5 ++
+ src/udev/Makefile.am | 10 +++
+ src/udev/udev-builtin-firmware.c | 154 +++++++++++++++++++++++++++++++++++++++
+ src/udev/udev-builtin.c | 3 +
+ src/udev/udev.h | 6 ++
+ src/udev/udevd.c | 13 ++++
+ 7 files changed, 227 insertions(+), 3 deletions(-)
+ create mode 100644 src/udev/udev-builtin-firmware.c
+
+diff --git a/configure.ac b/configure.ac
+index 8691891..65028c2 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -238,9 +238,42 @@ AC_CHECK_DECL([unshare],
+ [#include <sched.h>])
+
+ # ------------------------------------------------------------------------------
+-AC_PATH_TOOL(GPERF, gperf)
+-if test -z "$GPERF" ; then
+- AC_MSG_ERROR([*** gperf not found])
++AC_ARG_WITH(firmware-path,
++ AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
++ [Firmware search path (default=ROOTPREFIX/lib/firmware/updates:ROOTPREFIX/lib/firmware)]),
++ [], [with_firmware_path="$rootprefix/lib/firmware/updates:$rootprefix/lib/firmware"])
++OLD_IFS=$IFS
++IFS=:
++for i in $with_firmware_path; do
++ if test "x${FIRMWARE_PATH}" = "x"; then
++ FIRMWARE_PATH="\\\"${i}/\\\""
++ else
++ FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
++ fi
++done
++IFS=$OLD_IFS
++AC_SUBST(FIRMWARE_PATH)
++AS_IF([test "x${FIRMWARE_PATH}" != "x"], [ AC_DEFINE(HAVE_FIRMWARE, 1, [Define if FIRMWARE is available]) ])
++AM_CONDITIONAL(ENABLE_FIRMWARE, [test "x${FIRMWARE_PATH}" != "x"])
++
++# ------------------------------------------------------------------------------
++AC_ARG_ENABLE([gudev],
++ AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support @<:@default=enabled@:>@]),
++ [], [enable_gudev=yes])
++AS_IF([test "x$enable_gudev" = "xyes"], [ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) ])
++AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = "xyes"])
++
++# ------------------------------------------------------------------------------
++AC_ARG_ENABLE([keymap],
++ AS_HELP_STRING([--disable-keymap], [disable keymap fixup support @<:@default=enabled@:>@]),
++ [], [enable_keymap=yes])
++
++if test "x$enable_keymap" = "xyes"; then
++ AC_PATH_TOOL(GPERF, gperf)
++ if test -z "$GPERF" ; then
++ AC_MSG_ERROR([*** gperf not found])
++ fi
++ AC_DEFINE([ENABLE_KEYMAP], [1], [Define if we are enabling rule generator])
+ fi
+
+ # ------------------------------------------------------------------------------
+diff --git a/rules/Makefile.am b/rules/Makefile.am
+index 24c099c..d714ae3 100644
+--- a/rules/Makefile.am
++++ b/rules/Makefile.am
+@@ -22,6 +22,11 @@ dist_udevrules_DATA += \
+ 80-net-name-slot.rules
+ endif
+
++if ENABLE_FIRMWARE
++dist_udevrules_DATA += \
++ 50-firmware.rules
++endif
++
+ if HAVE_BLKID
+ dist_udevrules_DATA += \
+ 60-persistent-storage.rules
+diff --git a/src/udev/Makefile.am b/src/udev/Makefile.am
+index 401af01..742fbc8 100644
+--- a/src/udev/Makefile.am
++++ b/src/udev/Makefile.am
+@@ -53,12 +53,18 @@ libudev_core_la_SOURCES = \
+ udev-ctrl.c \
+ udev-builtin.c \
+ udev-builtin-btrfs.c \
++ udev-builtin-firmware.c \
+ udev-builtin-hwdb.c \
+ udev-builtin-input_id.c \
+ udev-builtin-net_id.c \
+ udev-builtin-path_id.c \
+ udev-builtin-usb_id.c
+
++if ENABLE_FIRMWARE
++libudev_core_la_SOURCES += \
++ udev-builtin-firmware.c
++endif
++
+ include_HEADERS = \
+ udev.h
+
+@@ -86,6 +92,10 @@ libudev_core_la_LIBADD += \
+ $(KMOD_LIBS)
+ endif
+
++libudev_core_la_CPPFLAGS = \
++ $(AM_CPPFLAGS) \
++ -DFIRMWARE_PATH="$(FIRMWARE_PATH)"
++
+ #
+ # Extras
+ #
+diff --git a/src/udev/udev-builtin-firmware.c b/src/udev/udev-builtin-firmware.c
+new file mode 100644
+index 0000000..bd8c2fb
+--- /dev/null
++++ b/src/udev/udev-builtin-firmware.c
+@@ -0,0 +1,154 @@
++/*
++ * firmware - Kernel firmware loader
++ *
++ * Copyright (C) 2009 Piter Punk <piterpunk@slackware.com>
++ * Copyright (C) 2009-2011 Kay Sievers <kay@vrfy.org>
++ *
++ * 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 will 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:*
++ */
++
++#include <unistd.h>
++#include <stdlib.h>
++#include <string.h>
++#include <stdio.h>
++#include <getopt.h>
++#include <errno.h>
++#include <stdbool.h>
++#include <sys/utsname.h>
++#include <sys/stat.h>
++
++#include "udev.h"
++
++static bool set_loading(struct udev *udev, char *loadpath, const char *state) {
++ FILE *ldfile;
++
++ ldfile = fopen(loadpath, "we");
++ if (ldfile == NULL) {
++ log_error("error: can not open '%s'", loadpath);
++ return false;
++ };
++ fprintf(ldfile, "%s\n", state);
++ fclose(ldfile);
++ return true;
++}
++
++static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size) {
++ char *buf;
++ FILE *fsource = NULL, *ftarget = NULL;
++ bool ret = false;
++
++ buf = malloc(size);
++ if (buf == NULL) {
++ log_error("No memory available to load firmware file");
++ return false;
++ }
++
++ log_debug("writing '%s' (%zi) to '%s'", source, size, target);
++
++ fsource = fopen(source, "re");
++ if (fsource == NULL)
++ goto exit;
++ ftarget = fopen(target, "we");
++ if (ftarget == NULL)
++ goto exit;
++ if (fread(buf, size, 1, fsource) != 1)
++ goto exit;
++ if (fwrite(buf, size, 1, ftarget) == 1)
++ ret = true;
++exit:
++ if (ftarget != NULL)
++ fclose(ftarget);
++ if (fsource != NULL)
++ fclose(fsource);
++ free(buf);
++ return ret;
++}
++
++static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], bool test) {
++ struct udev *udev = udev_device_get_udev(dev);
++ static const char *searchpath[] = { FIRMWARE_PATH };
++ char loadpath[UTIL_PATH_SIZE];
++ char datapath[UTIL_PATH_SIZE];
++ char fwpath[UTIL_PATH_SIZE];
++ const char *firmware;
++ FILE *fwfile = NULL;
++ struct utsname kernel;
++ struct stat statbuf;
++ unsigned int i;
++ int rc = EXIT_SUCCESS;
++
++ firmware = udev_device_get_property_value(dev, "FIRMWARE");
++ if (firmware == NULL) {
++ log_error("firmware parameter missing");
++ rc = EXIT_FAILURE;
++ goto exit;
++ }
++
++ /* lookup firmware file */
++ uname(&kernel);
++ for (i = 0; i < ELEMENTSOF(searchpath); i++) {
++ strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL);
++ fwfile = fopen(fwpath, "re");
++ if (fwfile != NULL)
++ break;
++
++ strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL);
++ fwfile = fopen(fwpath, "re");
++ if (fwfile != NULL)
++ break;
++ }
++
++ strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL);
++
++ if (fwfile == NULL) {
++ log_debug("did not find firmware file '%s'", firmware);
++ rc = EXIT_FAILURE;
++ /*
++ * Do not cancel the request in the initrd, the real root might have
++ * the firmware file and the 'coldplug' run in the real root will find
++ * this pending request and fulfill or cancel it.
++ * */
++ if (!in_initrd())
++ set_loading(udev, loadpath, "-1");
++ goto exit;
++ }
++
++ if (stat(fwpath, &statbuf) < 0 || statbuf.st_size == 0) {
++ if (!in_initrd())
++ set_loading(udev, loadpath, "-1");
++ rc = EXIT_FAILURE;
++ goto exit;
++ }
++
++ if (!set_loading(udev, loadpath, "1"))
++ goto exit;
++
++ strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL);
++ if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) {
++ log_error("error sending firmware '%s' to device", firmware);
++ set_loading(udev, loadpath, "-1");
++ rc = EXIT_FAILURE;
++ goto exit;
++ };
++
++ set_loading(udev, loadpath, "0");
++exit:
++ if (fwfile)
++ fclose(fwfile);
++ return rc;
++}
++
++const struct udev_builtin udev_builtin_firmware = {
++ .name = "firmware",
++ .cmd = builtin_firmware,
++ .help = "kernel firmware loader",
++ .run_once = true,
++};
+diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c
+index 74b3bdc..3657106 100644
+--- a/src/udev/udev-builtin.c
++++ b/src/udev/udev-builtin.c
+@@ -34,6 +34,9 @@ static const struct udev_builtin *builtins[] = {
+ [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid,
+ #endif
+ [UDEV_BUILTIN_BTRFS] = &udev_builtin_btrfs,
++#ifdef HAVE_FIRMWARE
++ [UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware,
++#endif
+ [UDEV_BUILTIN_HWDB] = &udev_builtin_hwdb,
+ [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id,
+ [UDEV_BUILTIN_KEYBOARD] = &udev_builtin_keyboard,
+diff --git a/src/udev/udev.h b/src/udev/udev.h
+index 198cb2c..01a1e9c 100644
+--- a/src/udev/udev.h
++++ b/src/udev/udev.h
+@@ -149,6 +149,9 @@ enum udev_builtin_cmd {
+ UDEV_BUILTIN_BLKID,
+ #endif
+ UDEV_BUILTIN_BTRFS,
++#ifdef HAVE_FIRMWARE
++ UDEV_BUILTIN_FIRMWARE,
++#endif
+ UDEV_BUILTIN_HWDB,
+ UDEV_BUILTIN_INPUT_ID,
+ UDEV_BUILTIN_KEYBOARD,
+@@ -173,6 +176,9 @@ struct udev_builtin {
+ extern const struct udev_builtin udev_builtin_blkid;
+ #endif
+ extern const struct udev_builtin udev_builtin_btrfs;
++#ifdef HAVE_FIRMWARE
++extern const struct udev_builtin udev_builtin_firmware;
++#endif
+ extern const struct udev_builtin udev_builtin_hwdb;
+ extern const struct udev_builtin udev_builtin_input_id;
+ extern const struct udev_builtin udev_builtin_keyboard;
+diff --git a/src/udev/udevd.c b/src/udev/udevd.c
+index b1de97a..35655d8 100644
+--- a/src/udev/udevd.c
++++ b/src/udev/udevd.c
+@@ -101,6 +101,9 @@ struct event {
+ bool is_block;
+ usec_t start_usec;
+ bool warned;
++#ifdef HAVE_FIRMWARE
++ bool nodelay;
++#endif
+ };
+
+ static inline struct event *node_to_event(struct udev_list_node *node) {
+@@ -491,6 +494,10 @@ static int event_queue_insert(struct udev_device *dev) {
+ event->devnum = udev_device_get_devnum(dev);
+ event->is_block = streq("block", udev_device_get_subsystem(dev));
+ event->ifindex = udev_device_get_ifindex(dev);
++#ifdef HAVE_FIRMWARE
++ if (streq(udev_device_get_subsystem(dev), "firmware"))
++ event->nodelay = true;
++#endif
+
+ log_debug("seq %llu queued, '%s' '%s'", udev_device_get_seqnum(dev),
+ udev_device_get_action(dev), udev_device_get_subsystem(dev));
+@@ -566,6 +573,12 @@ static bool is_devpath_busy(struct event *event) {
+ return true;
+ }
+
++#ifdef HAVE_FIRMWARE
++ /* allow to bypass the dependency tracking */
++ if (event->nodelay)
++ continue;
++#endif
++
+ /* parent device event found */
+ if (event->devpath[common] == '/') {
+ event->delaying_seqnum = loop_event->seqnum;
+--
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/udev/eudev_3.2.bb b/import-layers/yocto-poky/meta/recipes-core/udev/eudev_3.2.1.bb
index 857d20db7..bdfb5441a 100644
--- a/import-layers/yocto-poky/meta/recipes-core/udev/eudev_3.2.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/udev/eudev_3.2.1.bb
@@ -8,7 +8,9 @@ DEPENDS = "glib-2.0 glib-2.0-native gperf-native kmod libxslt-native util-linux"
PROVIDES = "udev"
-SRC_URI = "https://github.com/gentoo/${BPN}/archive/v${PV}.tar.gz \
+SRC_URI = "https://github.com/gentoo/${BPN}/archive/v${PV}.tar.gz;downloadfilename=${BP}.tar.gz \
+ file://0014-Revert-rules-remove-firmware-loading-rules.patch \
+ file://Revert-udev-remove-userspace-firmware-loading-suppor.patch \
file://devfs-udev.rules \
file://init \
file://links.conf \
@@ -21,8 +23,8 @@ SRC_URI = "https://github.com/gentoo/${BPN}/archive/v${PV}.tar.gz \
"
UPSTREAM_CHECK_URI = "https://github.com/gentoo/eudev/releases"
-SRC_URI[md5sum] = "9eb477cc8718db272b5d24dff1126b04"
-SRC_URI[sha256sum] = "37829d37f4beb7e358ca33abc1ad0907d87f917ce157777aeaeebeacae24efdc"
+SRC_URI[md5sum] = "a2aae16bc432eac0e71c1267c384e295"
+SRC_URI[sha256sum] = "88f530c1540750e6daa91b5eaeebf88e761e6f0c86515c1c28eedfd871f027c6"
inherit autotools update-rc.d qemu pkgconfig
@@ -82,12 +84,14 @@ RDEPENDS_eudev-hwdb += "eudev"
RRECOMMENDS_${PN} += "udev-cache"
RPROVIDES_${PN} = "hotplug udev"
+RPROVIDES_eudev-hwdb += "udev-hwdb"
python () {
if bb.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d):
raise bb.parse.SkipPackage("'systemd' in DISTRO_FEATURES")
}
+PACKAGE_WRITE_DEPS += "qemu-native"
pkg_postinst_eudev-hwdb () {
if test -n "$D"; then
${@qemu_run_binary(d, '$D', '${bindir}/udevadm')} hwdb --update --root $D
diff --git a/import-layers/yocto-poky/meta/recipes-core/udev/udev-extraconf_1.1.bb b/import-layers/yocto-poky/meta/recipes-core/udev/udev-extraconf_1.1.bb
index ecd4a8aab..ae125507b 100644
--- a/import-layers/yocto-poky/meta/recipes-core/udev/udev-extraconf_1.1.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/udev/udev-extraconf_1.1.bb
@@ -1,8 +1,7 @@
SUMMARY = "Extra machine specific configuration files"
DESCRIPTION = "Extra machine specific configuration files for udev, specifically blacklist information."
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
- file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
SRC_URI = " \
file://automount.rules \
diff --git a/import-layers/yocto-poky/meta/recipes-core/util-linux/util-linux.inc b/import-layers/yocto-poky/meta/recipes-core/util-linux/util-linux.inc
index 70cba6b59..63302a9fe 100644
--- a/import-layers/yocto-poky/meta/recipes-core/util-linux/util-linux.inc
+++ b/import-layers/yocto-poky/meta/recipes-core/util-linux/util-linux.inc
@@ -29,9 +29,9 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin
PACKAGES =+ "util-linux-agetty util-linux-fdisk util-linux-cfdisk util-linux-sfdisk \
util-linux-swaponoff util-linux-losetup util-linux-umount \
util-linux-mount util-linux-readprofile util-linux-uuidd \
- util-linux-uuidgen util-linux-lscpu util-linux-fsck util-linux-blkid \
- util-linux-mkfs util-linux-mcookie util-linux-reset \
- util-linux-mkfs.cramfs util-linux-fsck.cramfs util-linux-fstrim \
+ util-linux-uuidgen util-linux-lscpu util-linux-fsck.cramfs util-linux-fsck \
+ util-linux-blkid util-linux-mkfs util-linux-mcookie util-linux-reset \
+ util-linux-lsblk util-linux-mkfs.cramfs util-linux-fstrim \
util-linux-partx util-linux-hwclock util-linux-mountpoint \
util-linux-findfs util-linux-getopt util-linux-sulogin util-linux-prlimit"
PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', 'util-linux-pylibmount', '', d)}"
@@ -52,7 +52,7 @@ SHARED_EXTRA_OECONF = "--disable-use-tty-group \
EXTRA_OECONF = "${SHARED_EXTRA_OECONF} --libdir=${base_libdir}"
-PACKAGECONFIG_class-target ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
+PACKAGECONFIG_class-target ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam,"
# Respect the systemd feature for uuidd
@@ -84,7 +84,7 @@ FILES_util-linux-umount = "${base_bindir}/umount.${BPN}"
FILES_util-linux-readprofile = "${sbindir}/readprofile.${BPN}"
FILES_util-linux-uuidgen = "${bindir}/uuidgen"
FILES_util-linux-uuidd = "${sbindir}/uuidd"
-FILES_util-linux-reset = "${base_bindir}/reset"
+FILES_util-linux-reset = "${base_bindir}/reset*"
FILES_util-linux-partx = "${sbindir}/partx"
FILES_util-linux-hwclock = "${base_sbindir}/hwclock.${BPN}"
FILES_util-linux-findfs = "${sbindir}/findfs"
@@ -95,6 +95,7 @@ FILES_util-linux-prlimit = "${bindir}/prlimit"
FILES_util-linux-pylibmount = "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.so \
${PYTHON_SITEPACKAGES_DIR}/libmount/__init__.* \
${PYTHON_SITEPACKAGES_DIR}/libmount/__pycache__/*"
+FILES_util-linux-lsblk = "${bindir}/lsblk"
FILES_util-linux-lscpu = "${bindir}/lscpu"
FILES_util-linux-fsck = "${base_sbindir}/fsck*"
@@ -116,7 +117,7 @@ RDEPENDS_util-linux-reset += "ncurses"
RDEPENDS_util-linux-runuser += "libpam"
-RDEPENDS_${PN} = "util-linux-umount util-linux-swaponoff util-linux-losetup util-linux-sulogin"
+RDEPENDS_${PN} = "util-linux-umount util-linux-swaponoff util-linux-losetup util-linux-sulogin util-linux-lsblk"
RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'util-linux-runuser', '', d)}"
RRECOMMENDS_${PN} = "util-linux-fdisk util-linux-cfdisk util-linux-sfdisk util-linux-mount util-linux-readprofile util-linux-mkfs util-linux-mountpoint util-linux-prlimit"
@@ -150,7 +151,7 @@ do_install () {
mkdir -p ${D}${base_bindir}
sbinprogs="agetty ctrlaltdel cfdisk vipw vigr"
- sbinprogs_a="pivot_root hwclock mkswap mkfs.minix fsck.minix losetup swapon swapoff fdisk fsck blkid blockdev fstrim sulogin switch_root"
+ sbinprogs_a="pivot_root hwclock mkswap mkfs.minix fsck.minix losetup swapon swapoff fdisk fsck blkid blockdev fstrim sulogin switch_root nologin"
binprogs_a="dmesg getopt kill more umount mount login reset su mountpoint"
if [ "${base_sbindir}" != "${sbindir}" ]; then
@@ -176,7 +177,7 @@ do_install () {
rm -f ${D}${bindir}/chkdupexe
- if [ "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" = "pam" ]; then
+ if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
install -d ${D}${sysconfdir}/pam.d
install -m 0644 ${WORKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser
install -m 0644 ${WORKDIR}/runuser-l.pamd ${D}${sysconfdir}/pam.d/runuser-l
@@ -193,7 +194,7 @@ ALTERNATIVE_PRIORITY = "80"
ALTERNATIVE_${PN} = "dmesg kill more mkswap blockdev pivot_root switch_root"
ALTERNATIVE_${PN} += "hexdump last lastb logger mesg renice wall"
-ALTERNATIVE_${PN} += "setsid chrt flock utmpdump eject"
+ALTERNATIVE_${PN} += "setsid chrt flock utmpdump eject nologin"
ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg"
ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill"
@@ -203,8 +204,9 @@ ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev"
ALTERNATIVE_LINK_NAME[pivot_root] = "${base_sbindir}/pivot_root"
ALTERNATIVE_LINK_NAME[switch_root] = "${base_sbindir}/switch_root"
ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject"
+ALTERNATIVE_LINK_NAME[nologin] = "${base_sbindir}/nologin"
-ALTERNATIVE_${PN}-doc = "mountpoint.1 last.1 lastb.1 mesg.1 wall.1 nologin.8 sulogin.8 utmpdump.1 reset.1 kill.1 libblkid.3 blkid.8 findfs.8 fsck.8 uuid.3"
+ALTERNATIVE_${PN}-doc = "mountpoint.1 last.1 lastb.1 mesg.1 wall.1 nologin.8 sulogin.8 utmpdump.1 reset.1 kill.1 libblkid.3 blkid.8 findfs.8 fsck.8 uuid.3 eject.1 logger.1"
ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1"
ALTERNATIVE_LINK_NAME[lastb.1] = "${mandir}/man1/lastb.1"
@@ -221,6 +223,8 @@ ALTERNATIVE_LINK_NAME[blkid.8] = "${mandir}/man8/blkid.8"
ALTERNATIVE_LINK_NAME[findfs.8] = "${mandir}/man8/findfs.8"
ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8"
ALTERNATIVE_LINK_NAME[uuid.3] = "${mandir}/man3/uuid.3"
+ALTERNATIVE_LINK_NAME[eject.1] = "${mandir}/man1/eject.1"
+ALTERNATIVE_LINK_NAME[logger.1] = "${mandir}/man1/logger.1"
ALTERNATIVE_util-linux-hwclock = "hwclock"
ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock"
@@ -270,7 +274,7 @@ ALTERNATIVE_LINK_NAME[mountpoint] = "${base_bindir}/mountpoint"
BBCLASSEXTEND = "native nativesdk"
python do_package_prepend () {
- if '--enable-su' in d.getVar('EXTRA_OECONF', True).split():
+ if '--enable-su' in d.getVar('EXTRA_OECONF').split():
d.appendVar(d.expand('ALTERNATIVE_${PN}'), ' su')
d.appendVar(d.expand('ALTERNATIVE_${PN}-doc'), ' su.1')
@@ -285,6 +289,7 @@ python populate_packages_prepend() {
extra_depends='', prepend=True, allow_links=True)
}
+RDEPENDS_${PN}-bash-completion += "util-linux-lsblk"
RDEPENDS_${PN}-ptest = "bash grep coreutils"
do_compile_ptest() {
diff --git a/import-layers/yocto-poky/meta/recipes-core/util-linux/util-linux_2.28.1.bb b/import-layers/yocto-poky/meta/recipes-core/util-linux/util-linux_2.29.1.bb
index f232cb9f3..1395b473f 100644
--- a/import-layers/yocto-poky/meta/recipes-core/util-linux/util-linux_2.28.1.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/util-linux/util-linux_2.29.1.bb
@@ -1,4 +1,4 @@
-MAJOR_VERSION = "2.28"
+MAJOR_VERSION = "2.29"
require util-linux.inc
# To support older hosts, we need to patch and/or revert
@@ -16,8 +16,8 @@ SRC_URI += "file://configure-sbindir.patch \
file://avoid_parallel_tests.patch \
file://uuid-test-error-api.patch \
"
-SRC_URI[md5sum] = "e2d863efaf4fd330a42c5efe9f1b02b4"
-SRC_URI[sha256sum] = "3ece4ea4a34ef786b68f5c415e848390424232abd1ee00f7ee5bddc30657b60f"
+SRC_URI[md5sum] = "0cbb6d16ab9c5736e5649ef1264bee6e"
+SRC_URI[sha256sum] = "0ce40600b934ec2fecfa6bfc4efe6982d051ba96c2832b05201347aec582f54f"
CACHED_CONFIGUREVARS += "scanf_cv_alloc_modifier=ms"
diff --git a/import-layers/yocto-poky/meta/recipes-core/volatile-binds/volatile-binds.bb b/import-layers/yocto-poky/meta/recipes-core/volatile-binds/volatile-binds.bb
index 130ab55f0..a6e325493 100644
--- a/import-layers/yocto-poky/meta/recipes-core/volatile-binds/volatile-binds.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/volatile-binds/volatile-binds.bb
@@ -49,7 +49,7 @@ do_compile () {
-e "s#@whatparent@#${spec%/*}#g; s#@whereparent@#${mountpoint%/*}#g" \
volatile-binds.service.in >$servicefile
done <<END
-${@d.getVar('VOLATILE_BINDS', True).replace("\\n", "\n")}
+${@d.getVar('VOLATILE_BINDS').replace("\\n", "\n")}
END
if [ -e var-volatile-lib.service ]; then
diff --git a/import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.8/Makefile-runtests.patch b/import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.11/Makefile-runtests.patch
index 61eea8238..61eea8238 100644
--- a/import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.8/Makefile-runtests.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.11/Makefile-runtests.patch
diff --git a/import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.8/ldflags-tests.patch b/import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.11/ldflags-tests.patch
index 19c40b745..19c40b745 100644
--- a/import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.8/ldflags-tests.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.11/ldflags-tests.patch
diff --git a/import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.8/remove.ldconfig.call.patch b/import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.11/remove.ldconfig.call.patch
index 403b4825c..403b4825c 100644
--- a/import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.8/remove.ldconfig.call.patch
+++ b/import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.11/remove.ldconfig.call.patch
diff --git a/import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.8/run-ptest b/import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.11/run-ptest
index 884d9dc69..884d9dc69 100644
--- a/import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.8/run-ptest
+++ b/import-layers/yocto-poky/meta/recipes-core/zlib/zlib-1.2.11/run-ptest
diff --git a/import-layers/yocto-poky/meta/recipes-core/zlib/zlib_1.2.8.bb b/import-layers/yocto-poky/meta/recipes-core/zlib/zlib_1.2.11.bb
index 913c7033d..ba216f679 100644
--- a/import-layers/yocto-poky/meta/recipes-core/zlib/zlib_1.2.8.bb
+++ b/import-layers/yocto-poky/meta/recipes-core/zlib/zlib_1.2.11.bb
@@ -4,7 +4,7 @@ library which is used by many different programs."
HOMEPAGE = "http://zlib.net/"
SECTION = "libs"
LICENSE = "Zlib"
-LIC_FILES_CHKSUM = "file://zlib.h;beginline=4;endline=23;md5=fde612df1e5933c428b73844a0c494fd"
+LIC_FILES_CHKSUM = "file://zlib.h;beginline=6;endline=23;md5=5377232268e952e9ef63bc555f7aa6c0"
SRC_URI = "${SOURCEFORGE_MIRROR}/libpng/${BPN}/${PV}/${BPN}-${PV}.tar.xz \
file://remove.ldconfig.call.patch \
@@ -12,24 +12,27 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/libpng/${BPN}/${PV}/${BPN}-${PV}.tar.xz \
file://ldflags-tests.patch \
file://run-ptest \
"
+UPSTREAM_CHECK_URI = "http://zlib.net/"
-SRC_URI[md5sum] = "28f1205d8dd2001f26fec1e8c2cebe37"
-SRC_URI[sha256sum] = "831df043236df8e9a7667b9e3bb37e1fcb1220a0f163b6de2626774b9590d057"
+SRC_URI[md5sum] = "85adef240c5f370b308da8c938951a68"
+SRC_URI[sha256sum] = "4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066"
+
+CFLAGS += "-D_REENTRANT"
RDEPENDS_${PN}-ptest += "make"
inherit ptest
-do_configure (){
- ./configure --prefix=${prefix} --shared --libdir=${libdir}
+do_configure() {
+ uname=GNU ./configure --prefix=${prefix} --shared --libdir=${libdir}
}
-do_compile (){
- oe_runmake
+do_compile() {
+ oe_runmake shared
}
do_compile_ptest() {
- oe_runmake static shared
+ oe_runmake test
}
do_install() {
OpenPOWER on IntegriCloud