summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/base-files/base-files/profile8
-rw-r--r--meta/recipes-core/base-files/base-files_3.0.14.bb48
-rw-r--r--meta/recipes-core/base-passwd/base-passwd_3.5.29.bb15
-rw-r--r--meta/recipes-core/busybox/busybox.inc5
-rw-r--r--meta/recipes-core/busybox/busybox/0001-build-system-Specify-nostldlib-when-linking-to-.o-fi.patch40
-rw-r--r--meta/recipes-core/busybox/busybox/CVE-2014-9645_busybox_reject_module_names_with_slashes.patch41
-rw-r--r--meta/recipes-core/busybox/busybox/busybox-cross-menuconfig.patch71
-rw-r--r--meta/recipes-core/busybox/busybox/defconfig8
-rw-r--r--meta/recipes-core/busybox/busybox/recognize_connmand.patch21
-rw-r--r--meta/recipes-core/busybox/busybox_1.23.1.bb (renamed from meta/recipes-core/busybox/busybox_1.22.1.bb)11
-rw-r--r--meta/recipes-core/busybox/busybox_git.bb5
-rw-r--r--meta/recipes-core/busybox/files/find-touchscreen.sh7
-rwxr-xr-xmeta/recipes-core/busybox/files/mdev12
-rw-r--r--meta/recipes-core/busybox/files/mdev-mount.sh63
-rw-r--r--meta/recipes-core/busybox/files/mdev.conf5
-rw-r--r--meta/recipes-core/busybox/files/simple.script8
-rw-r--r--meta/recipes-core/busybox/files/syslog2
-rw-r--r--meta/recipes-core/coreutils/coreutils-8.22/dummy_help2man.patch22
-rw-r--r--meta/recipes-core/coreutils/coreutils-8.22/fix-for-dummy-man-usage.patch31
-rw-r--r--meta/recipes-core/coreutils/coreutils-8.23/fix-selinux-flask.patch39
-rw-r--r--meta/recipes-core/coreutils/coreutils-8.23/man-decouple-manpages-from-build.patch27
-rw-r--r--meta/recipes-core/coreutils/coreutils-8.23/remove-usr-local-lib-from-m4.patch (renamed from meta/recipes-core/coreutils/coreutils-8.22/remove-usr-local-lib-from-m4.patch)0
-rw-r--r--meta/recipes-core/coreutils/coreutils_6.9.bb14
-rw-r--r--meta/recipes-core/coreutils/coreutils_8.23.bb (renamed from meta/recipes-core/coreutils/coreutils_8.22.bb)32
-rw-r--r--meta/recipes-core/dbus/dbus-glib-0.100.2/obsolete_automake_macros.patch15
-rw-r--r--meta/recipes-core/dbus/dbus-glib.inc1
-rw-r--r--meta/recipes-core/dbus/dbus-glib/no-examples.patch (renamed from meta/recipes-core/dbus/dbus-glib-0.100.2/no-examples.patch)0
-rw-r--r--meta/recipes-core/dbus/dbus-glib/test-install-makefile.patch (renamed from meta/recipes-core/dbus/dbus-glib-0.100.2/test-install-makefile.patch)57
-rw-r--r--meta/recipes-core/dbus/dbus-glib_0.100.2.bb5
-rw-r--r--meta/recipes-core/dbus/dbus-glib_0.102.bb5
-rw-r--r--meta/recipes-core/dbus/dbus-test_1.8.10.bb (renamed from meta/recipes-core/dbus/dbus-test_1.8.2.bb)5
-rw-r--r--meta/recipes-core/dbus/dbus.inc2
-rw-r--r--meta/recipes-core/dbus/dbus_1.8.10.bb4
-rw-r--r--meta/recipes-core/dbus/dbus_1.8.2.bb4
-rw-r--r--meta/recipes-core/dropbear/dropbear.inc9
-rw-r--r--meta/recipes-core/dropbear/dropbear/0001-urandom-xauth-changes-to-options.h.patch2
-rw-r--r--meta/recipes-core/dropbear/dropbear_2014.63.bb4
-rw-r--r--meta/recipes-core/dropbear/dropbear_2014.66.bb4
-rw-r--r--meta/recipes-core/eglibc/cross-localedef-native_2.19.bb48
-rw-r--r--meta/recipes-core/eglibc/eglibc-2.19/0001-eglibc-menuconfig-support.patch912
-rw-r--r--meta/recipes-core/eglibc/eglibc-2.19/0002-eglibc-menuconfig-hex-string-options.patch169
-rw-r--r--meta/recipes-core/eglibc/eglibc-2.19/0003-eglibc-menuconfig-build-instructions.patch176
-rw-r--r--meta/recipes-core/eglibc/eglibc-2.19/GLRO_dl_debug_mask.patch143
-rw-r--r--meta/recipes-core/eglibc/eglibc-2.19/eglibc-svn-arm-lowlevellock-include-tls.patch21
-rw-r--r--meta/recipes-core/eglibc/eglibc-2.19/eglibc_fix_findidx_parameters.patch38
-rw-r--r--meta/recipes-core/eglibc/eglibc-2.19/fileops-without-wchar-io.patch22
-rw-r--r--meta/recipes-core/eglibc/eglibc-2.19/fsl-ppc-no-fsqrt.patch100
-rw-r--r--meta/recipes-core/eglibc/eglibc-collateral.inc12
-rw-r--r--meta/recipes-core/eglibc/eglibc-common.inc9
-rw-r--r--meta/recipes-core/eglibc/eglibc-initial_2.19.bb11
-rw-r--r--meta/recipes-core/eglibc/eglibc-locale_2.19.bb1
-rw-r--r--meta/recipes-core/eglibc/eglibc-mtrace.inc13
-rw-r--r--meta/recipes-core/eglibc/eglibc-mtrace_2.19.bb1
-rw-r--r--meta/recipes-core/eglibc/eglibc-scripts.inc16
-rw-r--r--meta/recipes-core/eglibc/eglibc-scripts_2.19.bb1
-rw-r--r--meta/recipes-core/feed-config/poky-feed-config-opkg_1.0.bb44
-rw-r--r--meta/recipes-core/gettext/gettext-0.19.4/parallel.patch (renamed from meta/recipes-core/gettext/gettext-0.18.3.2/parallel.patch)13
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.18.3.2/Makevars.template53
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.18.3.2/aclocal.tgzbin37591 -> 0 bytes
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.18.3.2/iconv-m4-remove-the-test-to-convert-euc-jp.patch43
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.19.4/COPYING (renamed from meta/recipes-core/gettext/gettext-minimal-0.18.3.2/COPYING)2
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.19.4/Makefile.in.in (renamed from meta/recipes-core/gettext/gettext-minimal-0.18.3.2/Makefile.in.in)47
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.19.4/aclocal.tgzbin0 -> 39744 bytes
-rwxr-xr-xmeta/recipes-core/gettext/gettext-minimal-0.19.4/config.rpath (renamed from meta/recipes-core/gettext/gettext-minimal-0.18.3.2/config.rpath)18
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.19.4/remove-potcdate.sin (renamed from meta/recipes-core/gettext/gettext-minimal-0.18.3.2/remove-potcdate.sin)0
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-native_0.19.4.bb (renamed from meta/recipes-core/gettext/gettext-minimal-native_0.18.3.2.bb)3
-rw-r--r--meta/recipes-core/gettext/gettext_0.19.4.bb (renamed from meta/recipes-core/gettext/gettext_0.18.3.2.bb)4
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/allow-run-media-sdX-drive-mount-if-username-root.patch39
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0_2.42.1.bb (renamed from meta/recipes-core/glib-2.0/glib-2.0_2.40.0.bb)5
-rw-r--r--meta/recipes-core/glib-2.0/glib.inc42
-rw-r--r--meta/recipes-core/glib-networking/glib-networking_2.38.0.bb2
-rw-r--r--meta/recipes-core/glibc/cross-localedef-native/fix_for_centos_5.8.patch (renamed from meta/recipes-core/eglibc/cross-localedef-native-2.19/fix_for_centos_5.8.patch)6
-rw-r--r--meta/recipes-core/glibc/cross-localedef-native_2.21.bb56
-rw-r--r--meta/recipes-core/glibc/glibc-collateral.inc19
-rw-r--r--meta/recipes-core/glibc/glibc-common.inc9
-rw-r--r--meta/recipes-core/glibc/glibc-initial.inc (renamed from meta/recipes-core/eglibc/eglibc-initial.inc)46
-rw-r--r--meta/recipes-core/glibc/glibc-initial_2.21.bb11
-rw-r--r--meta/recipes-core/glibc/glibc-ld.inc (renamed from meta/recipes-core/eglibc/eglibc-ld.inc)6
-rw-r--r--meta/recipes-core/glibc/glibc-locale.inc (renamed from meta/recipes-core/eglibc/eglibc-locale.inc)48
-rw-r--r--meta/recipes-core/glibc/glibc-locale_2.21.bb1
-rw-r--r--meta/recipes-core/glibc/glibc-mtrace.inc13
-rw-r--r--meta/recipes-core/glibc/glibc-mtrace_2.21.bb1
-rw-r--r--meta/recipes-core/glibc/glibc-options.inc (renamed from meta/recipes-core/eglibc/eglibc-options.inc)82
-rw-r--r--meta/recipes-core/glibc/glibc-package.inc (renamed from meta/recipes-core/eglibc/eglibc-package.inc)85
-rw-r--r--meta/recipes-core/glibc/glibc-scripts.inc16
-rw-r--r--meta/recipes-core/glibc/glibc-scripts_2.21.bb1
-rw-r--r--meta/recipes-core/glibc/glibc-testing.inc (renamed from meta/recipes-core/eglibc/eglibc-testing.inc)72
-rw-r--r--meta/recipes-core/glibc/glibc.inc (renamed from meta/recipes-core/eglibc/eglibc.inc)50
-rw-r--r--meta/recipes-core/glibc/glibc/0001-Add-unused-attribute.patch36
-rw-r--r--meta/recipes-core/glibc/glibc/0001-R_ARM_TLS_DTPOFF32.patch (renamed from meta/recipes-core/eglibc/eglibc-2.19/0001-R_ARM_TLS_DTPOFF32.patch)10
-rw-r--r--meta/recipes-core/glibc/glibc/0001-When-disabling-SSE-also-make-sure-that-fpmath-is-not.patch32
-rw-r--r--meta/recipes-core/glibc/glibc/0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch (renamed from meta/recipes-core/eglibc/eglibc-2.19/0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch)13
-rw-r--r--meta/recipes-core/glibc/glibc/0001-yes-within-the-path-sets-wrong-config-variables.patch245
-rw-r--r--meta/recipes-core/glibc/glibc/GLRO_dl_debug_mask.patch529
-rw-r--r--meta/recipes-core/glibc/glibc/IO-acquire-lock-fix.patch (renamed from meta/recipes-core/eglibc/eglibc-2.19/IO-acquire-lock-fix.patch)8
-rw-r--r--meta/recipes-core/glibc/glibc/add_resource_h_to_wait_h.patch (renamed from meta/recipes-core/eglibc/eglibc-2.19/add_resource_h_to_wait_h.patch)8
-rw-r--r--meta/recipes-core/glibc/glibc/eglibc-header-bootstrap.patch85
-rw-r--r--meta/recipes-core/glibc/glibc/eglibc-install-pic-archives.patch109
-rw-r--r--meta/recipes-core/glibc/glibc/eglibc-ppc8xx-cache-line-workaround.patch68
-rw-r--r--meta/recipes-core/glibc/glibc/eglibc-resolv-dynamic.patch54
-rw-r--r--meta/recipes-core/glibc/glibc/eglibc-sh4-fpscr_values.patch42
-rw-r--r--meta/recipes-core/glibc/glibc/eglibc-use-option-groups.patch16651
-rw-r--r--meta/recipes-core/glibc/glibc/eglibc.patch602
-rw-r--r--meta/recipes-core/glibc/glibc/etc/ld.so.conf (renamed from meta/recipes-core/eglibc/eglibc-2.19/etc/ld.so.conf)0
-rw-r--r--meta/recipes-core/glibc/glibc/fix-tibetian-locales.patch (renamed from meta/recipes-core/eglibc/eglibc-2.19/fix-tibetian-locales.patch)16
-rw-r--r--meta/recipes-core/glibc/glibc/fix_am_rootsbindir.patch29
-rw-r--r--meta/recipes-core/glibc/glibc/generate-supported.mk (renamed from meta/recipes-core/eglibc/eglibc-2.19/generate-supported.mk)0
-rw-r--r--meta/recipes-core/glibc/glibc/glibc.fix_sqrt2.patch (renamed from meta/recipes-core/eglibc/eglibc-2.19/glibc.fix_sqrt2.patch)114
-rw-r--r--meta/recipes-core/glibc/glibc/grok_gold.patch (renamed from meta/recipes-core/eglibc/eglibc-2.19/grok_gold.patch)26
-rw-r--r--meta/recipes-core/glibc/glibc/initgroups_keys.patch (renamed from meta/recipes-core/eglibc/eglibc-2.19/initgroups_keys.patch)14
-rw-r--r--meta/recipes-core/glibc/glibc/ld-search-order.patch (renamed from meta/recipes-core/eglibc/eglibc-2.19/ld-search-order.patch)20
-rw-r--r--meta/recipes-core/glibc/glibc/mips-rld-map-check.patch (renamed from meta/recipes-core/eglibc/eglibc-2.19/mips-rld-map-check.patch)7
-rw-r--r--meta/recipes-core/glibc/glibc/multilib_readlib.patch (renamed from meta/recipes-core/eglibc/eglibc-2.19/multilib_readlib.patch)8
-rw-r--r--meta/recipes-core/glibc/glibc/option-groups.patch1397
-rw-r--r--meta/recipes-core/glibc/glibc/ppc-sqrt_finite.patch (renamed from meta/recipes-core/eglibc/eglibc-2.19/ppc-sqrt_finite.patch)0
-rw-r--r--meta/recipes-core/glibc/glibc/ppc_slow_ieee754_sqrt.patch (renamed from meta/recipes-core/eglibc/eglibc-2.19/ppc_slow_ieee754_sqrt.patch)136
-rw-r--r--meta/recipes-core/glibc/glibc/ppce6500-32b_slow_ieee754_sqrt.patch (renamed from meta/recipes-core/eglibc/eglibc-2.19/ppce6500-32b_slow_ieee754_sqrt.patch)0
-rw-r--r--meta/recipes-core/glibc/glibc/relocatable_sdk.patch (renamed from meta/recipes-core/eglibc/eglibc-2.19/relocatable_sdk.patch)0
-rw-r--r--meta/recipes-core/glibc/glibc/relocatable_sdk_fix_openpath.patch (renamed from meta/recipes-core/eglibc/eglibc-2.19/relocatable_sdk_fix_openpath.patch)0
-rw-r--r--meta/recipes-core/glibc/glibc/timezone-re-written-tzselect-as-posix-sh.patch38
-rw-r--r--meta/recipes-core/glibc/glibc_2.21.bb (renamed from meta/recipes-core/eglibc/eglibc_2.19.bb)61
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/32and64bit.patch (renamed from meta/recipes-core/eglibc/ldconfig-native-2.12.1/32and64bit.patch)0
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/README (renamed from meta/recipes-core/eglibc/ldconfig-native-2.12.1/README)0
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling.patch (renamed from meta/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch)0
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling_fix.patch47
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/endianess-header.patch (renamed from meta/recipes-core/eglibc/ldconfig-native-2.12.1/endianess-header.patch)0
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/flag_fix.patch (renamed from meta/recipes-core/eglibc/ldconfig-native-2.12.1/flag_fix.patch)0
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch (renamed from meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch)0
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2 (renamed from meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2)bin21491 -> 21491 bytes
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig.patch (renamed from meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig.patch)0
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch (renamed from meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch)0
-rw-r--r--meta/recipes-core/glibc/ldconfig-native_2.12.1.bb (renamed from meta/recipes-core/eglibc/ldconfig-native_2.12.1.bb)1
-rw-r--r--meta/recipes-core/glibc/site_config/funcs (renamed from meta/recipes-core/eglibc/site_config/funcs)0
-rw-r--r--meta/recipes-core/glibc/site_config/headers (renamed from meta/recipes-core/eglibc/site_config/headers)0
-rw-r--r--meta/recipes-core/glibc/site_config/types (renamed from meta/recipes-core/eglibc/site_config/types)0
-rw-r--r--meta/recipes-core/images/build-appliance-image/Yocto_Build_Appliance.vmx58
-rw-r--r--meta/recipes-core/images/build-appliance-image/Yocto_Build_Appliance.vmxf2
-rw-r--r--meta/recipes-core/images/build-appliance-image_12.0.1.bb (renamed from meta/recipes-core/images/build-appliance-image_8.0.bb)2
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarm64/interfaces5
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb2
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install-efi.sh141
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install-testfs.sh2
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install.sh15
-rw-r--r--meta/recipes-core/initrdscripts/files/init-live.sh14
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb2
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb4
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb6
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-install-efi-testfs_1.0.bb2
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb2
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-install-testfs_1.0.bb2
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb2
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh16
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/hostname.sh2
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh10
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh2
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/urandom21
-rw-r--r--meta/recipes-core/initscripts/initscripts_1.0.bb8
-rw-r--r--meta/recipes-core/kbd/kbd_2.0.2.bb (renamed from meta/recipes-core/kbd/kbd_2.0.1.bb)6
-rw-r--r--meta/recipes-core/libcgroup/libcgroup_0.41.bb3
-rw-r--r--meta/recipes-core/libxml/libxml2.inc19
-rw-r--r--meta/recipes-core/libxml/libxml2/72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch30
-rw-r--r--meta/recipes-core/libxml/libxml2/configure.ac-fix-cross-compiling-warning.patch45
-rw-r--r--meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch204
-rw-r--r--meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-3660.patch147
-rw-r--r--meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch17
-rw-r--r--meta/recipes-core/libxml/libxml2_2.9.2.bb (renamed from meta/recipes-core/libxml/libxml2_2.9.1.bb)7
-rw-r--r--meta/recipes-core/meta/buildtools-tarball.bb33
-rw-r--r--meta/recipes-core/meta/meta-environment-extsdk.bb12
-rw-r--r--meta/recipes-core/meta/meta-environment.bb46
-rw-r--r--meta/recipes-core/meta/meta-ide-support.bb1
-rw-r--r--meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb19
-rw-r--r--meta/recipes-core/meta/package-index.bb1
-rw-r--r--meta/recipes-core/meta/uninative-tarball.bb48
-rw-r--r--meta/recipes-core/ncurses/ncurses.inc2
-rw-r--r--meta/recipes-core/netbase/netbase_5.3.bb (renamed from meta/recipes-core/netbase/netbase_5.2.bb)6
-rw-r--r--meta/recipes-core/os-release/os-release.bb36
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-base.bb24
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-boot.bb11
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-nfs.bb5
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-sdk.bb18
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-ssh-dropbear.bb5
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-ssh-openssh.bb5
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bb9
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-tools-debug.bb9
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb12
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-tools-testapps.bb9
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-self-hosted.bb50
-rw-r--r--meta/recipes-core/psplash/psplash_git.bb12
-rw-r--r--meta/recipes-core/readline/readline-6.3/readline-dispatch-multikey.patch32
-rw-r--r--meta/recipes-core/readline/readline-6.3/readline63-00343
-rw-r--r--meta/recipes-core/readline/readline.inc2
-rw-r--r--meta/recipes-core/readline/readline_5.2.bb2
-rw-r--r--meta/recipes-core/readline/readline_6.3.bb3
-rw-r--r--meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service2
-rw-r--r--meta/recipes-core/systemd/systemd-systemctl-native.bb2
-rwxr-xr-xmeta/recipes-core/systemd/systemd-systemctl/systemctl47
-rw-r--r--meta/recipes-core/systemd/systemd/00-create-volatile.conf2
-rw-r--r--meta/recipes-core/systemd/systemd/0001-tmpfiles-avoid-creating-duplicate-acl-entries.patch134
-rw-r--r--meta/recipes-core/systemd/systemd/0001-uClibc-doesn-t-implement-pwritev-preadv.patch34
-rw-r--r--meta/recipes-core/systemd/systemd/0001-units-Prefer-getty-to-agetty-in-console-setup-system.patch44
-rw-r--r--meta/recipes-core/systemd/systemd/0002-shared-missing.h-fall-back-to-insecure-getenv.patch25
-rw-r--r--meta/recipes-core/systemd/systemd/0002-tmpfiles-quietly-ignore-ACLs-on-unsupported-filesyst.patch86
-rw-r--r--meta/recipes-core/systemd/systemd/0003-binfmt-Don-t-install-dependency-links-at-install-tim.patch (renamed from meta/recipes-core/systemd/systemd/binfmt-install.patch)40
-rw-r--r--meta/recipes-core/systemd/systemd/0004-configure-Check-for-additional-features-that-uclibc-.patch (renamed from meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch)26
-rw-r--r--meta/recipes-core/systemd/systemd/0005-nspawn-Use-execvpe-only-when-libc-supports-it.patch (renamed from meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch)32
-rw-r--r--meta/recipes-core/systemd/systemd/0006-journal-Use-posix-fallocate-only-if-available.patch (renamed from meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch)58
-rw-r--r--meta/recipes-core/systemd/systemd/0007-util-Use-mkostemp-only-if-libc-supports-it.patch42
-rw-r--r--meta/recipes-core/systemd/systemd/0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch (renamed from meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch)29
-rw-r--r--meta/recipes-core/systemd/systemd/0009-sysv-generator-add-support-for-executing-scripts-und.patch143
-rw-r--r--meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch181
-rw-r--r--meta/recipes-core/systemd/systemd/0011-systemd-user-avoid-using-system-auth.patch31
-rw-r--r--meta/recipes-core/systemd/systemd/0012-systemd-tmpfiles.c-Honor-ordering-within-files-as-th.patch185
-rw-r--r--meta/recipes-core/systemd/systemd/0013-journal-fix-Inappropriate-ioctl-for-device-on-ext4.patch37
-rw-r--r--meta/recipes-core/systemd/systemd/journald-volatile.conf6
-rw-r--r--meta/recipes-core/systemd/systemd/optional_secure_getenv.patch19
-rw-r--r--meta/recipes-core/systemd/systemd/run-ptest2
-rw-r--r--meta/recipes-core/systemd/systemd/systemd-older-kernel.patch56
-rw-r--r--meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch35
-rw-r--r--meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch30
-rw-r--r--meta/recipes-core/systemd/systemd/tmpfiles-pam.patch30
-rw-r--r--meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch19
-rw-r--r--meta/recipes-core/systemd/systemd_219.bb (renamed from meta/recipes-core/systemd/systemd_213.bb)153
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb4
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/01_bootlogd1
-rwxr-xr-xmeta/recipes-core/sysvinit/sysvinit/bootlogd.init14
-rwxr-xr-xmeta/recipes-core/sysvinit/sysvinit/rc3
-rw-r--r--meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb7
-rw-r--r--meta/recipes-core/uclibc/uclibc-git.inc6
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-Define-IPTOS_CLASS_-macros-according-to-RFC-2474.patch75
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-timex-Sync-with-glibc.patch33
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0003-fcntl.h-Define-F_SETPIPE_SZ-and-F_GETPIPE_SZ.patch377
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0004-Add-clock_adjtime-syscall.patch75
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/remove_attribute_optimize_Os.patch125
-rw-r--r--meta/recipes-core/uclibc/uclibc.inc6
-rw-r--r--meta/recipes-core/udev/udev-extraconf/automount.rules2
-rw-r--r--meta/recipes-core/udev/udev-extraconf/mount.sh3
-rw-r--r--meta/recipes-core/udev/udev-extraconf_1.1.bb2
-rw-r--r--meta/recipes-core/udev/udev.inc13
-rw-r--r--meta/recipes-core/udev/udev/add-install-ptest.patch19
-rw-r--r--meta/recipes-core/udev/udev/fix_rule-syntax-regex-ptest.patch59
-rw-r--r--meta/recipes-core/udev/udev/init73
-rw-r--r--meta/recipes-core/udev/udev/run-ptest4
-rw-r--r--meta/recipes-core/udev/udev/udev-cache45
-rw-r--r--meta/recipes-core/udev/udev/udev-cache.default3
-rw-r--r--meta/recipes-core/util-linux/util-linux.inc75
-rw-r--r--meta/recipes-core/util-linux/util-linux/CVE-2014-9114.patch174
-rw-r--r--meta/recipes-core/util-linux/util-linux/MCONFIG223
-rw-r--r--meta/recipes-core/util-linux/util-linux/defines.h10
-rw-r--r--meta/recipes-core/util-linux/util-linux/fix-configure.patch20
-rw-r--r--meta/recipes-core/util-linux/util-linux/make_include17
-rw-r--r--meta/recipes-core/util-linux/util-linux/swapargs.h3
-rw-r--r--meta/recipes-core/util-linux/util-linux/util-linux-ensure-the-existence-of-directory-for-PAT.patch34
-rw-r--r--meta/recipes-core/util-linux/util-linux/util-linux-native.patch54
-rw-r--r--meta/recipes-core/util-linux/util-linux/util-linux-ng-replace-siginterrupt.patch24
-rw-r--r--meta/recipes-core/util-linux/util-linux_2.25.2.bb (renamed from meta/recipes-core/util-linux/util-linux_2.24.2.bb)9
-rw-r--r--meta/recipes-core/volatile-binds/files/COPYING.MIT17
-rwxr-xr-xmeta/recipes-core/volatile-binds/files/mount-copybind34
-rw-r--r--meta/recipes-core/volatile-binds/files/volatile-binds.service.in19
-rw-r--r--meta/recipes-core/volatile-binds/volatile-binds.bb69
-rw-r--r--meta/recipes-core/zlib/zlib-1.2.8/ldflags-tests.patch45
-rw-r--r--meta/recipes-core/zlib/zlib_1.2.8.bb1
261 files changed, 24003 insertions, 4145 deletions
diff --git a/meta/recipes-core/base-files/base-files/profile b/meta/recipes-core/base-files/base-files/profile
index 8eeaac3693..53c2680409 100644
--- a/meta/recipes-core/base-files/base-files/profile
+++ b/meta/recipes-core/base-files/base-files/profile
@@ -2,10 +2,10 @@
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
PATH="/usr/local/bin:/usr/bin:/bin"
-EDITOR="/bin/vi" # needed for packages like cron
+EDITOR="vi" # needed for packages like cron, git-commit
test -z "$TERM" && TERM="vt100" # Basic terminal capab. For screen etc.
-if [ ! -e /etc/localtime ]; then
+if [ ! -e /etc/localtime -a ! -e /etc/TZ ]; then
TZ="UTC" # Time Zone. Look at http://theory.uwinnipeg.ca/gnu/glibc/libc_303.html
# for an explanation of how to set this to your local timezone.
export TZ
@@ -26,6 +26,10 @@ if [ -d /etc/profile.d ]; then
unset i
fi
+if [ -x /usr/bin/resize ];then
+ /usr/bin/resize >/dev/null
+fi
+
export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM
umask 022
diff --git a/meta/recipes-core/base-files/base-files_3.0.14.bb b/meta/recipes-core/base-files/base-files_3.0.14.bb
index 6d76a2b0db..f2d254e6bd 100644
--- a/meta/recipes-core/base-files/base-files_3.0.14.bb
+++ b/meta/recipes-core/base-files/base-files_3.0.14.bb
@@ -32,7 +32,7 @@ INHIBIT_DEFAULT_DEPS = "1"
docdir_append = "/${P}"
dirs1777 = "/tmp ${localstatedir}/volatile/tmp"
-dirs2775 = "/home ${prefix}/src ${localstatedir}/local"
+dirs2775 = ""
dirs755 = "/bin /boot /dev ${sysconfdir} ${sysconfdir}/default \
${sysconfdir}/skel /lib /mnt /proc ${ROOT_HOME} /run /sbin \
${prefix} ${bindir} ${docdir} /usr/games ${includedir} \
@@ -43,13 +43,15 @@ dirs755 = "/bin /boot /dev ${sysconfdir} ${sysconfdir}/default \
/sys ${localstatedir}/lib/misc ${localstatedir}/spool \
${localstatedir}/volatile \
${localstatedir}/volatile/log \
+ /home ${prefix}/src ${localstatedir}/local \
/media"
-dirs3755 = "/srv \
- ${prefix}/local ${prefix}/local/bin ${prefix}/local/games \
- ${prefix}/local/include ${prefix}/local/lib ${prefix}/local/sbin \
- ${prefix}/local/share ${prefix}/local/src \
- ${prefix}/lib/locale"
-dirs4775 = "/var/mail"
+
+dirs755-lsb = "/srv \
+ ${prefix}/local ${prefix}/local/bin ${prefix}/local/games \
+ ${prefix}/local/include ${prefix}/local/lib ${prefix}/local/sbin \
+ ${prefix}/local/share ${prefix}/local/src \
+ ${prefix}/lib/locale"
+dirs2775-lsb = "/var/mail"
volatiles = "log tmp"
conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
@@ -57,10 +59,13 @@ conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
${sysconfdir}/nsswitch.conf ${sysconfdir}/profile \
${sysconfdir}/default"
+# By default the hostname is the machine name. If the hostname is unset then a
+# /etc/hostname file isn't written, suitable for environments with dynamic
+# hostnames.
#
-# set standard hostname, might be a candidate for a DISTRO variable? :M:
-#
-hostname = "openembedded"
+# The hostname can be changed outside of this recipe by using
+# hostname_pn-base-files = "my-host-name".
+hostname = "${MACHINE}"
BASEFILESISSUEINSTALL ?= "do_install_basefilesissue"
@@ -72,7 +77,7 @@ do_install () {
install -m 1777 -d ${D}$d
done
for d in ${dirs2775}; do
- install -m 2755 -d ${D}$d
+ install -m 2775 -d ${D}$d
done
for d in ${volatiles}; do
ln -sf volatile/$d ${D}${localstatedir}/$d
@@ -100,20 +105,20 @@ 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
}
DISTRO_VERSION[vardepsexclude] += "DATE"
do_install_basefilesissue () {
- if [ "${hostname}" != "" ]; then
- if [ -n "${MACHINE}" -a "${hostname}" = "openembedded" ]; then
- echo ${MACHINE} > ${D}${sysconfdir}/hostname
- else
- echo ${hostname} > ${D}${sysconfdir}/hostname
- fi
+ if [ "${hostname}" ]; then
+ echo ${hostname} > ${D}${sysconfdir}/hostname
fi
- install -m 644 ${WORKDIR}/issue* ${D}${sysconfdir}
+ install -m 644 ${WORKDIR}/issue* ${D}${sysconfdir}
if [ -n "${DISTRO_NAME}" ]; then
printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
@@ -129,12 +134,12 @@ do_install_basefilesissue () {
}
do_install_append_linuxstdbase() {
- for d in ${dirs3755}; do
+ for d in ${dirs755-lsb}; do
install -m 0755 -d ${D}$d
done
- for d in ${dirs4775}; do
- install -m 2755 -d ${D}$d
+ for d in ${dirs2775-lsb}; do
+ install -m 2775 -d ${D}$d
done
}
@@ -145,4 +150,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}/motd ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile"
diff --git a/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb b/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
index 59bd413b49..a8bd7c4e3f 100644
--- a/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
+++ b/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
@@ -4,7 +4,7 @@ SECTION = "base"
LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a"
-SRC_URI = "${DEBIAN_MIRROR}/main/b/base-passwd/base-passwd_${PV}.tar.gz \
+SRC_URI = "https://launchpad.net/debian/+archive/primary/+files/${BPN}_${PV}.tar.gz \
file://add_shutdown.patch \
file://nobash.patch \
file://noshadow.patch \
@@ -47,9 +47,14 @@ base_passwd_sstate_postinst() {
# 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}
- install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/passwd.master ${STAGING_DIR_TARGET}${sysconfdir}/passwd
- install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/group.master ${STAGING_DIR_TARGET}${sysconfdir}/group
+ 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
fi
}
@@ -70,11 +75,11 @@ python populate_packages_prepend() {
preinst = """#!/bin/sh
mkdir -p $D${sysconfdir}
if [ ! -e $D${sysconfdir}/passwd ]; then
-\tcat << EOF > $D${sysconfdir}/passwd
+\tcat << 'EOF' > $D${sysconfdir}/passwd
""" + passwd + """EOF
fi
if [ ! -e $D${sysconfdir}/group ]; then
-\tcat << EOF > $D${sysconfdir}/group
+\tcat << 'EOF' > $D${sysconfdir}/group
""" + group + """EOF
fi
"""
diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index bd66e4f148..0769d92c50 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -23,7 +23,7 @@ PACKAGES =+ "${PN}-httpd ${PN}-udhcpd ${PN}-udhcpc ${PN}-syslog ${PN}-mdev ${PN}
FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
FILES_${PN}-syslog = "${sysconfdir}/init.d/syslog* ${sysconfdir}/syslog-startup.conf* ${sysconfdir}/syslog.conf* ${systemd_unitdir}/system/syslog.service ${sysconfdir}/default/busybox-syslog"
-FILES_${PN}-mdev = "${sysconfdir}/init.d/mdev ${sysconfdir}/mdev.conf"
+FILES_${PN}-mdev = "${sysconfdir}/init.d/mdev ${sysconfdir}/mdev.conf ${sysconfdir}/mdev/*"
FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
FILES_${PN}-udhcpc = "${sysconfdir}/udhcpc.d ${datadir}/udhcpc"
FILES_${PN}-hwclock = "${sysconfdir}/init.d/hwclock.sh"
@@ -268,6 +268,9 @@ do_install () {
install -m 0755 ${WORKDIR}/mdev ${D}${sysconfdir}/init.d/mdev
if grep "CONFIG_FEATURE_MDEV_CONF=y" ${B}/.config; then
install -m 644 ${WORKDIR}/mdev.conf ${D}${sysconfdir}/mdev.conf
+ install -d ${D}${sysconfdir}/mdev
+ install -m 0755 ${WORKDIR}/find-touchscreen.sh ${D}${sysconfdir}/mdev
+ install -m 0755 ${WORKDIR}/mdev-mount.sh ${D}${sysconfdir}/mdev
fi
fi
diff --git a/meta/recipes-core/busybox/busybox/0001-build-system-Specify-nostldlib-when-linking-to-.o-fi.patch b/meta/recipes-core/busybox/busybox/0001-build-system-Specify-nostldlib-when-linking-to-.o-fi.patch
deleted file mode 100644
index 3da38bb4ca..0000000000
--- a/meta/recipes-core/busybox/busybox/0001-build-system-Specify-nostldlib-when-linking-to-.o-fi.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 28389e59701c2408e87e886c358f8e1766c677f7 Mon Sep 17 00:00:00 2001
-From: Drew Moseley <drew_moseley@mentor.com>
-Date: Sat, 29 Mar 2014 11:13:16 -0400
-Subject: [PATCH] build system: Specify '-nostldlib' when linking to .o files.
-
-For certain cross build scenarios the LD variable is overridden
-to use the gcc executive to ensure all the target tuning parameters
-are used. In these cases, the executive errors out as shown below
-but since this step is only linking to a .o file the standard libs
-are not needed.
-
- $ make LD=gcc applets/built-in.o
- LD applets/built-in.o
- /usr/bin/ld: cannot find -lgcc_s
- /usr/bin/ld: cannot find -lgcc_s
- collect2: ld returned 1 exit status
- make[1]: *** [applets/built-in.o] Error 1
- make: *** [applets_dir] Error 2
-
-Signed-off-by: Drew Moseley <drew_moseley@mentor.com>
----
- scripts/Makefile.build | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/scripts/Makefile.build b/scripts/Makefile.build
-index 5685b5b..eba69f6 100644
---- a/scripts/Makefile.build
-+++ b/scripts/Makefile.build
-@@ -256,7 +256,7 @@ ifdef builtin-target
- quiet_cmd_link_o_target = LD $@
- # If the list of objects to link is empty, just create an empty built-in.o
- cmd_link_o_target = $(if $(strip $(obj-y)),\
-- $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\
-+ $(LD) -nostdlib $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\
- rm -f $@; $(AR) rcs $@)
-
- $(builtin-target): $(obj-y) FORCE
---
-1.7.9.5
-
diff --git a/meta/recipes-core/busybox/busybox/CVE-2014-9645_busybox_reject_module_names_with_slashes.patch b/meta/recipes-core/busybox/busybox/CVE-2014-9645_busybox_reject_module_names_with_slashes.patch
new file mode 100644
index 0000000000..4e76067b3c
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/CVE-2014-9645_busybox_reject_module_names_with_slashes.patch
@@ -0,0 +1,41 @@
+Upstream-status: Backport
+http://git.busybox.net/busybox/commit/?id=4e314faa0aecb66717418e9a47a4451aec59262b
+
+CVE-2014-9645 fix.
+
+[YOCTO #7257]
+
+Signed-off-by: Armin Kuster <akuster@mvista.com>
+
+From 4e314faa0aecb66717418e9a47a4451aec59262b Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Thu, 20 Nov 2014 17:24:33 +0000
+Subject: modprobe,rmmod: reject module names with slashes
+
+function old new delta
+add_probe 86 113 +27
+
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+---
+Index: busybox-1.22.1/modutils/modprobe.c
+===================================================================
+--- busybox-1.22.1.orig/modutils/modprobe.c
++++ busybox-1.22.1/modutils/modprobe.c
+@@ -238,6 +238,17 @@ static void add_probe(const char *name)
+ {
+ struct module_entry *m;
+
++ /*
++ * get_or_add_modentry() strips path from name and works
++ * on remaining basename.
++ * This would make "rmmod dir/name" and "modprobe dir/name"
++ * to work like "rmmod name" and "modprobe name",
++ * which is wrong, and can be abused via implicit modprobing:
++ * "ifconfig /usbserial up" tries to modprobe netdev-/usbserial.
++ */
++ if (strchr(name, '/'))
++ bb_error_msg_and_die("malformed module name '%s'", name);
++
+ m = get_or_add_modentry(name);
+ if (!(option_mask32 & (OPT_REMOVE | OPT_SHOW_DEPS))
+ && (m->flags & MODULE_FLAG_LOADED)
diff --git a/meta/recipes-core/busybox/busybox/busybox-cross-menuconfig.patch b/meta/recipes-core/busybox/busybox/busybox-cross-menuconfig.patch
new file mode 100644
index 0000000000..781f5af14a
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/busybox-cross-menuconfig.patch
@@ -0,0 +1,71 @@
+From: Jason Wessel <jason.wessel@windriver.com>
+Date: Sun, 3 Mar 2013 12:31:40 -0600
+Subject: [PATCH] menuconfig,check-lxdiaglog.sh: Allow specification of ncurses location
+
+Upstream-status: Submitted
+
+[ based on: https://lkml.org/lkml/2013/3/3/103 ]
+
+This patch syncs up with the way the menuconfig ncurses / curses
+is detected and the HOST_EXTRACFLAGS works in the Linux kernel
+and it allows the menuconfig to work with a sysroot version
+of the curses libraries.
+
+---
+
+In some cross build environments such as the Yocto Project build
+environment it provides an ncurses library that is compiled
+differently than the host's version. This causes display corruption
+problems when the host's curses includes are used instead of the
+includes from the provided compiler are overridden. There is a second
+case where there is no curses libraries at all on the host system and
+menuconfig will just fail entirely.
+
+The solution is simply to allow an override variable in
+check-lxdialog.sh for environments such as the Yocto Project. Adding
+a CROSS_CURSES_LIB and CROSS_CURSES_INC solves the issue and allowing
+compiling and linking against the right headers and libraries.
+
+Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
+cc: Michal Marek <mmarek@suse.cz>
+cc: linux-kbuild@vger.kernel.org
+---
+ scripts/kconfig/lxdialog/Makefile | 2 +-
+ scripts/kconfig/lxdialog/check-lxdialog.sh | 8 ++++++++
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
++++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
+@@ -4,6 +4,10 @@
+ # What library to link
+ ldflags()
+ {
++ if [ x"$CROSS_CURSES_LIB" != x ]; then
++ echo "$CROSS_CURSES_LIB"
++ exit
++ fi
+ for ext in so a dylib ; do
+ for lib in ncursesw ncurses curses ; do
+ $cc -print-file-name=lib${lib}.${ext} | grep -q /
+@@ -19,6 +23,10 @@ ldflags()
+ # Where is ncurses.h?
+ ccflags()
+ {
++ if [ x"$CROSS_CURSES_INC" != x ]; then
++ echo "$CROSS_CURSES_INC"
++ exit
++ fi
+ if [ -f /usr/include/ncursesw/ncurses.h ]; then
+ echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncurses.h>"'
+ elif [ -f /usr/include/ncursesw/curses.h ]; then
+--- a/scripts/kconfig/lxdialog/Makefile
++++ b/scripts/kconfig/lxdialog/Makefile
+@@ -5,7 +5,7 @@ check-lxdialog := $(srctree)/$(src)/che
+
+ # Use reursively expanded variables so we do not call gcc unless
+ # we really need to do so. (Do not call gcc as part of make mrproper)
+-HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
++HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
+ HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
+
+ HOST_EXTRACFLAGS += -DLOCALE
diff --git a/meta/recipes-core/busybox/busybox/defconfig b/meta/recipes-core/busybox/busybox/defconfig
index 47eca212db..c200ee074d 100644
--- a/meta/recipes-core/busybox/busybox/defconfig
+++ b/meta/recipes-core/busybox/busybox/defconfig
@@ -159,7 +159,7 @@ CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set
# CONFIG_FEATURE_TAR_TO_COMMAND is not set
# CONFIG_FEATURE_TAR_UNAME_GNAME is not set
-# CONFIG_FEATURE_TAR_NOPRESERVE_TIME is not set
+CONFIG_FEATURE_TAR_NOPRESERVE_TIME=y
# CONFIG_FEATURE_TAR_SELINUX is not set
# CONFIG_UNCOMPRESS is not set
# CONFIG_UNLZMA is not set
@@ -377,7 +377,7 @@ CONFIG_FEATURE_VI_WIN_RESIZE=y
# CONFIG_FEATURE_VI_ASK_TERMINAL is not set
CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y
CONFIG_AWK=y
-# CONFIG_FEATURE_AWK_LIBM is not set
+CONFIG_FEATURE_AWK_LIBM=y
CONFIG_CMP=y
CONFIG_DIFF=y
# CONFIG_FEATURE_DIFF_LONG_OPTIONS is not set
@@ -441,7 +441,7 @@ CONFIG_FEATURE_KILL_DELAY=0
# CONFIG_FEATURE_INIT_COREDUMPS is not set
# CONFIG_FEATURE_INITRD is not set
CONFIG_INIT_TERMINAL_TYPE=""
-# CONFIG_MESG is not set
+CONFIG_MESG=y
# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set
#
@@ -781,7 +781,7 @@ CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN=y
CONFIG_FEATURE_IFUPDOWN_IPV4=y
CONFIG_FEATURE_IFUPDOWN_IPV6=y
CONFIG_FEATURE_IFUPDOWN_MAPPING=y
-# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
+CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP=y
# CONFIG_INETD is not set
# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set
diff --git a/meta/recipes-core/busybox/busybox/recognize_connmand.patch b/meta/recipes-core/busybox/busybox/recognize_connmand.patch
new file mode 100644
index 0000000000..f42c74caad
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/recognize_connmand.patch
@@ -0,0 +1,21 @@
+This adds connmand to the list of know dhcp clients
+
+Upstream-Status: Inappropriate [OE-Core]
+
+Signed-off-by: Saul Wold <sgw@linux.intel.com>
+
+Index: busybox-1.22.1/networking/ifupdown.c
+===================================================================
+--- busybox-1.22.1.orig/networking/ifupdown.c
++++ busybox-1.22.1/networking/ifupdown.c
+@@ -521,6 +521,10 @@ struct dhcp_client_t {
+ };
+
+ static const struct dhcp_client_t ext_dhcp_clients[] = {
++ { "connmand",
++ "true",
++ "true",
++ },
+ { "dhcpcd",
+ "dhcpcd[[ -h %hostname%]][[ -i %vendor%]][[ -I %client%]][[ -l %leasetime%]] %iface%",
+ "dhcpcd -k %iface%",
diff --git a/meta/recipes-core/busybox/busybox_1.22.1.bb b/meta/recipes-core/busybox/busybox_1.23.1.bb
index 46641e19fa..1742390ed9 100644
--- a/meta/recipes-core/busybox/busybox_1.22.1.bb
+++ b/meta/recipes-core/busybox/busybox_1.23.1.bb
@@ -1,7 +1,5 @@
require busybox.inc
-PR = "r32"
-
SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
file://get_header_tar.patch \
file://busybox-appletlib-dependency.patch \
@@ -20,6 +18,7 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
file://busybox-syslog.default \
file://mdev \
file://mdev.conf \
+ file://mdev-mount.sh \
file://umount.busybox \
file://defconfig \
file://busybox-syslog.service.in \
@@ -29,11 +28,13 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
file://inetd.conf \
file://inetd \
file://login-utilities.cfg \
- file://0001-build-system-Specify-nostldlib-when-linking-to-.o-fi.patch \
+ file://recognize_connmand.patch \
+ file://busybox-cross-menuconfig.patch \
+ file://CVE-2014-9645_busybox_reject_module_names_with_slashes.patch \
"
-SRC_URI[tarball.md5sum] = "337d1a15ab1cb1d4ed423168b1eb7d7e"
-SRC_URI[tarball.sha256sum] = "ae0b029d0a9e4dd71a077a790840e496dd838998e4571b87b60fed7462b6678b"
+SRC_URI[tarball.md5sum] = "5c94d6301a964cd91619bd4d74605245"
+SRC_URI[tarball.sha256sum] = "300f1db0a7ca4ecee8f8d8027aba250b903372e8339b7d9123d37c1e900473bf"
EXTRA_OEMAKE += "V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y"
diff --git a/meta/recipes-core/busybox/busybox_git.bb b/meta/recipes-core/busybox/busybox_git.bb
index f2cc119400..529ed5b318 100644
--- a/meta/recipes-core/busybox/busybox_git.bb
+++ b/meta/recipes-core/busybox/busybox_git.bb
@@ -1,8 +1,8 @@
require busybox.inc
-SRCREV = "d9e0c438e10e2155513e5d26498af472c5137d65"
+SRCREV = "1ecfe811fe2f70380170ef7d820e8150054e88ca"
# Lookout for PV bump too when SRCREV is changed
-PV = "1.22.1+git${SRCPV}"
+PV = "1.23.1+git${SRCPV}"
S = "${WORKDIR}/git"
@@ -24,6 +24,7 @@ SRC_URI = "git://busybox.net/busybox.git \
file://busybox-syslog.default \
file://mdev \
file://mdev.conf \
+ file://mdev-mount.sh \
file://umount.busybox \
file://defconfig \
file://busybox-syslog.service.in \
diff --git a/meta/recipes-core/busybox/files/find-touchscreen.sh b/meta/recipes-core/busybox/files/find-touchscreen.sh
index 1582ea891c..52c5e7a096 100644
--- a/meta/recipes-core/busybox/files/find-touchscreen.sh
+++ b/meta/recipes-core/busybox/files/find-touchscreen.sh
@@ -1,9 +1,6 @@
#!/bin/sh
-if [ `egrep "input:.*-e0.*,3,.*a0,1,.*18,.*" /sys/class/input/$MDEV/device/modalias|wc -l` -gt 0 ]; then
- ln -sf /dev/input/$MDEV /dev/input/touchscreen0
+if grep -q "input:.*-e0.*,3,.*a0,1,\|ads7846" /sys/class/$MDEV/device/modalias ; then
+ ln -sf /dev/$MDEV /dev/input/touchscreen0
fi
-if [ `egrep "ads7846" /sys/class/input/$MDEV/device/modalias|wc -l` -gt 0 ]; then
- ln -sf /dev/input/$MDEV /dev/input/touchscreen0
-fi
diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
index 4eba6190c7..96252477e0 100755
--- a/meta/recipes-core/busybox/files/mdev
+++ b/meta/recipes-core/busybox/files/mdev
@@ -2,6 +2,18 @@
mount -t tmpfs tmpfs /dev -o size=64k,mode=0755
mkdir /dev/pts /dev/shm
+chmod 777 /dev/shm
mount -t devpts devpts /dev/pts
+touch /dev/mdev.seq
echo "/sbin/mdev" > /proc/sys/kernel/hotplug
mdev -s
+
+#
+# We might have mounted something over /dev, see if /dev/initctl is there.
+#
+if test ! -p /dev/initctl
+then
+ rm -f /dev/initctl
+ mknod -m 600 /dev/initctl p
+fi
+
diff --git a/meta/recipes-core/busybox/files/mdev-mount.sh b/meta/recipes-core/busybox/files/mdev-mount.sh
new file mode 100644
index 0000000000..d5d66d66fb
--- /dev/null
+++ b/meta/recipes-core/busybox/files/mdev-mount.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+MDEV_AUTOMOUNT=y
+MDEV_AUTOMOUNT_ROOT=/run/media
+[ -f /etc/default/mdev ] && . /etc/default/mdev
+if [ "${MDEV_AUTOMOUNT}" = "n" ] ; then
+ exit 0
+fi
+
+case "$ACTION" in
+ add|"")
+ ACTION="add"
+ # check if already mounted
+ if grep -q "^/dev/${MDEV} " /proc/mounts ; then
+ # Already mounted
+ exit 0
+ fi
+ DEVBASE=`expr substr $MDEV 1 3`
+ if [ "${DEVBASE}" == "mmc" ] ; then
+ DEVBASE=`expr substr $MDEV 1 7`
+ fi
+ # check for "please don't mount it" file
+ if [ -f "/dev/nomount.${DEVBASE}" ] ; then
+ # blocked
+ exit 0
+ fi
+ # check for full-disk partition
+ if [ "${DEVBASE}" == "${MDEV}" ] ; then
+ if [ -d /sys/block/${DEVBASE}/${DEVBASE}*1 ] ; then
+ # Partition detected, just quit
+ exit 0
+ fi
+ if [ ! -f /sys/block/${DEVBASE}/size ] ; then
+ # No size at all
+ exit 0
+ fi
+ if [ `cat /sys/block/${DEVBASE}/size` == 0 ] ; then
+ # empty device, bail out
+ exit 0
+ fi
+ fi
+ # first allow fstab to determine the mountpoint
+ if ! mount /dev/$MDEV > /dev/null 2>&1
+ then
+ MOUNTPOINT="${MDEV_AUTOMOUNT_ROOT}/$MDEV"
+ mkdir "$MOUNTPOINT"
+ mount -t auto /dev/$MDEV "$MOUNTPOINT"
+ fi
+ ;;
+ remove)
+ MOUNTPOINT=`grep "^/dev/$MDEV\s" /proc/mounts | cut -d' ' -f 2`
+ if [ ! -z "$MOUNTPOINT" ]
+ then
+ umount "$MOUNTPOINT"
+ rmdir "$MOUNTPOINT"
+ else
+ umount /dev/$MDEV
+ fi
+ ;;
+ *)
+ # Unexpected keyword
+ exit 1
+ ;;
+esac
diff --git a/meta/recipes-core/busybox/files/mdev.conf b/meta/recipes-core/busybox/files/mdev.conf
index e688911ff1..17e93da7c3 100644
--- a/meta/recipes-core/busybox/files/mdev.conf
+++ b/meta/recipes-core/busybox/files/mdev.conf
@@ -1,3 +1,5 @@
+$MODALIAS=.* 0:0 660 @modprobe "$MODALIAS"
+
console 0:0 0600
cpu_dma_latency 0:0 0660
fb0:0 44 0660
@@ -35,3 +37,6 @@ input/mice 0:0 0660
input/mouse.* 0:0 0660
tun[0-9]* 0:0 0660 =net/
+
+[hs]d[a-z][0-9]? 0:0 660 */etc/mdev/mdev-mount.sh
+mmcblk[0-9].* 0:0 660 */etc/mdev/mdev-mount.sh
diff --git a/meta/recipes-core/busybox/files/simple.script b/meta/recipes-core/busybox/files/simple.script
index 78ac4242a8..22168b07e6 100644
--- a/meta/recipes-core/busybox/files/simple.script
+++ b/meta/recipes-core/busybox/files/simple.script
@@ -5,7 +5,6 @@
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
RESOLV_CONF="/etc/resolv.conf"
-[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
# return 0 if root is mounted on a network filesystem
@@ -17,8 +16,11 @@ root_is_nfs() {
have_bin_ip=0
if [ -x /sbin/ip ]; then
have_bin_ip=1
+ BROADCAST="broadcast +"
fi
+[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
+
case "$1" in
deconfig)
if [ -x /sbin/resolvconf ]; then
@@ -44,7 +46,7 @@ case "$1" in
if [ -n "$router" ] ; then
if ! root_is_nfs ; then
if [ $have_bin_ip -eq 1 ]; then
- while ip route del default 2>/dev/null ; do
+ while ip route del default dev $interface 2>/dev/null ; do
:
done
else
@@ -54,7 +56,7 @@ case "$1" in
fi
fi
- metric=0
+ metric=10
for i in $router ; do
if [ $have_bin_ip -eq 1 ]; then
ip route add default via $i metric $metric
diff --git a/meta/recipes-core/busybox/files/syslog b/meta/recipes-core/busybox/files/syslog
index 2944d3d06c..89c4d12e9c 100644
--- a/meta/recipes-core/busybox/files/syslog
+++ b/meta/recipes-core/busybox/files/syslog
@@ -28,7 +28,7 @@ if [ -f /etc/syslog-startup.conf ]; then
if [ -n "$ROTATEGENS" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -b $ROTATEGENS"
fi
- LOCAL=0
+ LOG_LOCAL=1
elif [ "$D" = "remote" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -R $REMOTE"
LOG_REMOTE=1
diff --git a/meta/recipes-core/coreutils/coreutils-8.22/dummy_help2man.patch b/meta/recipes-core/coreutils/coreutils-8.22/dummy_help2man.patch
deleted file mode 100644
index 4757f52aa0..0000000000
--- a/meta/recipes-core/coreutils/coreutils-8.22/dummy_help2man.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-Upstream-Status: Inappropriate [disable feature]
-
-Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
-diff -Nurd coreutils-8.21/man/local.mk coreutils-8.21/man/local.mk
---- coreutils-8.21/man/local.mk 2013-02-05 16:01:21.000000000 +0200
-+++ coreutils-8.21/man/local.mk 2013-03-23 09:12:53.360470192 +0200
-@@ -19,11 +19,11 @@
- EXTRA_DIST += man/help2man man/dummy-man
-
- ## Graceful degradation for systems lacking perl.
--if HAVE_PERL
--run_help2man = $(PERL) -- $(srcdir)/man/help2man
--else
-+#if HAVE_PERL
-+#run_help2man = $(PERL) -- $(srcdir)/man/help2man
-+#else
- run_help2man = $(SHELL) $(srcdir)/man/dummy-man
--endif
-+#endif
-
- man1_MANS = @man1_MANS@
- EXTRA_DIST += $(man1_MANS:.1=.x)
diff --git a/meta/recipes-core/coreutils/coreutils-8.22/fix-for-dummy-man-usage.patch b/meta/recipes-core/coreutils/coreutils-8.22/fix-for-dummy-man-usage.patch
deleted file mode 100644
index b7e82609bd..0000000000
--- a/meta/recipes-core/coreutils/coreutils-8.22/fix-for-dummy-man-usage.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-Upstream-Status: Pending
-
-coreutils: fix for dummy-man usage
-
-The options should be before the final argument, otherwise, the following error
-would appear when compiling.
-
-"dummy-man: too many non-option arguments"
-
-Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
----
- man/local.mk | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/man/local.mk b/man/local.mk
-index 7cef5e3..dc0865f 100644
---- a/man/local.mk
-+++ b/man/local.mk
-@@ -189,8 +189,8 @@ man/yes.1: src/yes
- && $(run_help2man) \
- --source='$(PACKAGE_STRING)' \
- --include=$(srcdir)/man/$$name.x \
-- --output=$$t/$$name.1 $$t/$$name \
- --info-page='coreutils \(aq'$$name' invocation\(aq' \
-+ --output=$$t/$$name.1 $$t/$$name \
- && sed \
- -e 's|$*\.td/||g' \
- -e '/For complete documentation/d' \
---
-1.7.9.5
-
diff --git a/meta/recipes-core/coreutils/coreutils-8.23/fix-selinux-flask.patch b/meta/recipes-core/coreutils/coreutils-8.23/fix-selinux-flask.patch
new file mode 100644
index 0000000000..9d1ae55d47
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-8.23/fix-selinux-flask.patch
@@ -0,0 +1,39 @@
+From a1d360509fa3a4aff57eedcd528cc0347a87531d Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Tue, 16 Sep 2014 01:59:08 -0700
+Subject: [PATCH] gnulib-comp.m4: selinux/flask.h should respect to
+ with_selinux
+
+Fixed when build with meta-selinux even when --without-selinux:
+runcon.c:49:28: fatal error: selinux/flask.h: No such file or directory
+ # include <selinux/flask.h>
+ ^
+compilation terminated.
+
+Upstream-Status: Pending
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+ m4/gnulib-comp.m4 | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
+index 472d3a0..5f09734 100644
+--- a/m4/gnulib-comp.m4
++++ b/m4/gnulib-comp.m4
+@@ -1730,11 +1730,11 @@ AC_DEFUN([gl_INIT],
+ AC_LIBOBJ([select])
+ fi
+ gl_SYS_SELECT_MODULE_INDICATOR([select])
+- AC_CHECK_HEADERS([selinux/flask.h])
+ AC_LIBOBJ([selinux-at])
+ gl_HEADERS_SELINUX_SELINUX_H
+ gl_HEADERS_SELINUX_CONTEXT_H
+ if test "$with_selinux" != no && test "$ac_cv_header_selinux_selinux_h" = yes; then
++ AC_CHECK_HEADERS([selinux/flask.h])
+ AC_LIBOBJ([getfilecon])
+ fi
+ gl_SERVENT
+--
+1.7.9.5
+
diff --git a/meta/recipes-core/coreutils/coreutils-8.23/man-decouple-manpages-from-build.patch b/meta/recipes-core/coreutils/coreutils-8.23/man-decouple-manpages-from-build.patch
new file mode 100644
index 0000000000..3c896a11bf
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-8.23/man-decouple-manpages-from-build.patch
@@ -0,0 +1,27 @@
+From b4d258629f090066783c3b4c91b40f63b9d0a296 Mon Sep 17 00:00:00 2001
+From: Paul Gortmaker <paul.gortmaker@windriver.com>
+Date: Sun, 8 Feb 2015 16:51:57 -0500
+Subject: [PATCH] man: decouple manpages from build
+
+The use of "help2man" doesn't work at all for cross compile, in
+addition to the extra requirement of perl it adds.
+
+Just decouple the manpages from the build in order to pave the way for
+importing prebuilt manpages that can be used in a cross build situation.
+
+Upstream-Status: Inappropriate [upstream doesn't care about x-compile case.]
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
+
+diff --git a/Makefile.am b/Makefile.am
+index fb4af27..7576b2c 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -214,5 +214,4 @@ AM_CPPFLAGS = -Ilib -I$(top_srcdir)/lib -Isrc -I$(top_srcdir)/src
+ include $(top_srcdir)/lib/local.mk
+ include $(top_srcdir)/src/local.mk
+ include $(top_srcdir)/doc/local.mk
+-include $(top_srcdir)/man/local.mk
+ include $(top_srcdir)/tests/local.mk
+--
+2.2.2
+
diff --git a/meta/recipes-core/coreutils/coreutils-8.22/remove-usr-local-lib-from-m4.patch b/meta/recipes-core/coreutils/coreutils-8.23/remove-usr-local-lib-from-m4.patch
index 2ef8a548ac..2ef8a548ac 100644
--- a/meta/recipes-core/coreutils/coreutils-8.22/remove-usr-local-lib-from-m4.patch
+++ b/meta/recipes-core/coreutils/coreutils-8.23/remove-usr-local-lib-from-m4.patch
diff --git a/meta/recipes-core/coreutils/coreutils_6.9.bb b/meta/recipes-core/coreutils/coreutils_6.9.bb
index debd2a123b..9189426315 100644
--- a/meta/recipes-core/coreutils/coreutils_6.9.bb
+++ b/meta/recipes-core/coreutils/coreutils_6.9.bb
@@ -9,11 +9,10 @@ LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
file://src/ls.c;beginline=4;endline=16;md5=15ed60f67b1db5fedd5dbc37cf8a9543"
PR = "r5"
-DEPENDS_class-native = "gettext-native"
inherit autotools gettext texinfo
-SRC_URI_BASE = "${GNU_MIRROR}/coreutils/${BP}.tar.bz2 \
+SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.bz2 \
file://gnulib_m4.patch \
file://futimens.patch \
file://coreutils-ls-x.patch \
@@ -25,23 +24,20 @@ SRC_URI_BASE = "${GNU_MIRROR}/coreutils/${BP}.tar.bz2 \
file://coreutils_fix_for_automake-1.12.patch \
file://coreutils-build-with-acl.patch \
file://coreutils-fix-texinfo.patch \
+ file://fix_for_manpage_building.patch \
"
-SRC_URI = "${SRC_URI_BASE} file://fix_for_manpage_building.patch"
-SRC_URI_class-native = "${SRC_URI_BASE}"
-
SRC_URI[md5sum] = "c9607d8495f16e98906e7ed2d9751a06"
SRC_URI[sha256sum] = "89c2895ad157de50e53298b22d91db116ee4e1dd3fdf4019260254e2e31497b0"
# acl is not a default feature
#
-PACKAGECONFIG_class-target ??= "${@bb.utils.contains('DISTRO_FEATURES', 'acl', 'acl', '', d)}"
-PACKAGECONFIG_class-native ??= ""
+PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'acl', 'acl', '', d)}"
# with, without, depends, rdepends
#
-PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl,"
+PACKAGECONFIG[acl] = "ac_cv_header_sys_acl_h=yes,ac_cv_header_sys_acl_h=no,acl,"
# [ gets a special treatment and is not included in this
@@ -102,5 +98,3 @@ python __anonymous() {
for prog in d.getVar('sbindir_progs', True).split():
d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir', True), prog))
}
-
-BBCLASSEXTEND = "native"
diff --git a/meta/recipes-core/coreutils/coreutils_8.22.bb b/meta/recipes-core/coreutils/coreutils_8.23.bb
index d5373ae9d6..63df75e7ba 100644
--- a/meta/recipes-core/coreutils/coreutils_8.22.bb
+++ b/meta/recipes-core/coreutils/coreutils_8.23.bb
@@ -12,14 +12,17 @@ DEPENDS_class-native = ""
inherit autotools gettext texinfo
-SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz \
+SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz;name=tarball \
+ http://distfiles.gentoo.org/distfiles/${BP}-man.tar.xz;name=manpages \
+ file://man-decouple-manpages-from-build.patch \
file://remove-usr-local-lib-from-m4.patch \
- file://dummy_help2man.patch \
- file://fix-for-dummy-man-usage.patch \
+ file://fix-selinux-flask.patch \
"
-SRC_URI[md5sum] = "8fb0ae2267aa6e728958adc38f8163a2"
-SRC_URI[sha256sum] = "5b3e94998152c017e6c75d56b9b994188eb71bf46d4038a642cb9141f6ff1212"
+SRC_URI[tarball.md5sum] = "abed135279f87ad6762ce57ff6d89c41"
+SRC_URI[tarball.sha256sum] = "ec43ca5bcfc62242accb46b7f121f6b684ee21ecd7d075059bf650ff9e37b82d"
+SRC_URI[manpages.md5sum] = "ce49bc8360e16afe67581d136606efc7"
+SRC_URI[manpages.sha256sum] = "d1b16e74b3dba4f313aeebae2c69da205f7d2e6e1c2aa8d39026c860d314ecca"
EXTRA_OECONF_class-native = "--without-gmp"
EXTRA_OECONF_class-target = "--enable-install-program=arch --libexecdir=${libdir}"
@@ -71,24 +74,41 @@ do_install_append() {
# in update-alternatives to fail, therefore use lbracket - the name used
# for the actual source file.
mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${BPN}
+
+ # prebuilt man pages
+ install -d ${D}/${mandir}/man1
+ install -t ${D}/${mandir}/man1 ${S}/man/*.1
+ # prebuilt man pages don't do a separate man page for [ vs test.
+ # see comment above r.e. sed and update-alternatives
+ cp -a ${D}${mandir}/man1/test.1 ${D}${mandir}/man1/lbracket.1.${BPN}
+}
+
+do_install_append_class-native(){
+ # remove groups to fix conflict with shadow-native
+ rm -f ${D}${STAGING_BINDIR_NATIVE}/groups
}
inherit update-alternatives
ALTERNATIVE_PRIORITY = "100"
ALTERNATIVE_${PN} = "lbracket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs} base64 mktemp df"
+ALTERNATIVE_${PN}-doc = "base64.1 mktemp.1 df.1 lbracket.1"
ALTERNATIVE_LINK_NAME[base64] = "${base_bindir}/base64"
ALTERNATIVE_TARGET[base64] = "${bindir}/base64.${BPN}"
+ALTERNATIVE_LINK_NAME[base64.1] = "${mandir}/man1/base64.1"
ALTERNATIVE_LINK_NAME[mktemp] = "${base_bindir}/mktemp"
ALTERNATIVE_TARGET[mktemp] = "${bindir}/mktemp.${BPN}"
+ALTERNATIVE_LINK_NAME[mktemp.1] = "${mandir}/man1/mktemp.1"
ALTERNATIVE_LINK_NAME[df] = "${base_bindir}/df"
ALTERNATIVE_TARGET[df] = "${bindir}/df.${BPN}"
+ALTERNATIVE_LINK_NAME[df.1] = "${mandir}/man1/df.1"
ALTERNATIVE_LINK_NAME[lbracket] = "${bindir}/["
ALTERNATIVE_TARGET[lbracket] = "${bindir}/lbracket.${BPN}"
+ALTERNATIVE_LINK_NAME[lbracket.1] = "${mandir}/man1/lbracket.1"
python __anonymous() {
for prog in d.getVar('base_bindir_progs', True).split():
@@ -98,4 +118,4 @@ python __anonymous() {
d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir', True), prog))
}
-BBCLASSEXTEND = "native"
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/dbus/dbus-glib-0.100.2/obsolete_automake_macros.patch b/meta/recipes-core/dbus/dbus-glib-0.100.2/obsolete_automake_macros.patch
deleted file mode 100644
index 40e3b12b5d..0000000000
--- a/meta/recipes-core/dbus/dbus-glib-0.100.2/obsolete_automake_macros.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Upstream-Status: Submitted [https://bugs.freedesktop.org/show_bug.cgi?id=59003]
-
-Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
-diff -Nurd dbus-glib-0.100/configure.ac dbus-glib-0.100/configure.ac
---- dbus-glib-0.100/configure.ac 2012-06-25 19:26:39.000000000 +0300
-+++ dbus-glib-0.100/configure.ac 2013-01-03 04:53:22.314976758 +0200
-@@ -8,7 +8,7 @@
-
- AM_INIT_AUTOMAKE([1.9])
-
--AM_CONFIG_HEADER(config.h)
-+AC_CONFIG_HEADERS(config.h)
-
- # Honor aclocal flags
- ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
diff --git a/meta/recipes-core/dbus/dbus-glib.inc b/meta/recipes-core/dbus/dbus-glib.inc
index 6c60d9e408..abd013247c 100644
--- a/meta/recipes-core/dbus/dbus-glib.inc
+++ b/meta/recipes-core/dbus/dbus-glib.inc
@@ -13,7 +13,6 @@ DEPENDS_class-native = "glib-2.0-native dbus-native"
SRC_URI = "http://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-${PV}.tar.gz \
file://no-examples.patch \
file://test-install-makefile.patch \
- file://obsolete_automake_macros.patch \
"
inherit autotools pkgconfig gettext
diff --git a/meta/recipes-core/dbus/dbus-glib-0.100.2/no-examples.patch b/meta/recipes-core/dbus/dbus-glib/no-examples.patch
index fbb4967828..fbb4967828 100644
--- a/meta/recipes-core/dbus/dbus-glib-0.100.2/no-examples.patch
+++ b/meta/recipes-core/dbus/dbus-glib/no-examples.patch
diff --git a/meta/recipes-core/dbus/dbus-glib-0.100.2/test-install-makefile.patch b/meta/recipes-core/dbus/dbus-glib/test-install-makefile.patch
index 2e8e178bb7..027c82b27e 100644
--- a/meta/recipes-core/dbus/dbus-glib-0.100.2/test-install-makefile.patch
+++ b/meta/recipes-core/dbus/dbus-glib/test-install-makefile.patch
@@ -3,26 +3,46 @@ Change Makefile.am to install regression tests for test package purpose.
Upstream-Status: Inappropriate [test not install is for purpose from upstream]
Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
+Signed-off-by: Chong Lu <Chong.Lu@windriver.com>
+---
+ test/Makefile.am | 3 ++-
+ test/core/Makefile.am | 3 ++-
+ test/interfaces/Makefile.am | 3 ++-
+ 3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/test/Makefile.am b/test/Makefile.am
-index 7ba11a8..249f0e7 100644
+index 379c8c3..6580927 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
-@@ -13,7 +13,8 @@ else
- TEST_BINARIES=
- endif
+@@ -48,7 +48,8 @@ TESTS = \
+ $(test_scripts) \
+ $(NULL)
--noinst_PROGRAMS= $(TEST_BINARIES)
+-noinst_PROGRAMS = \
+testdir = $(datadir)/@PACKAGE@/tests
-+test_PROGRAMS= $(TEST_BINARIES)
++test_PROGRAMS = \
+ $(test_programs) \
+ $(test_related_programs) \
+ $(NULL)
+diff --git a/test/core/Makefile.am b/test/core/Makefile.am
+index e4bceb4..54b077d 100644
+--- a/test/core/Makefile.am
++++ b/test/core/Makefile.am
+@@ -64,7 +64,8 @@ endif
- test_service_SOURCES= \
- test-service.c
+ ## we use noinst_PROGRAMS not check_PROGRAMS for TESTS so that we
+ ## build even when not doing "make check"
+-noinst_PROGRAMS = \
++testdir = $(datadir)/@PACKAGE@/tests/core
++test_PROGRAMS = \
+ test-dbus-glib \
+ test-error-mapping \
+ test-service-glib \
diff --git a/test/interfaces/Makefile.am b/test/interfaces/Makefile.am
-index 3cb2c39..e6de67d 100644
+index a94d08d..707dcac 100644
--- a/test/interfaces/Makefile.am
+++ b/test/interfaces/Makefile.am
-@@ -39,7 +39,8 @@ if DBUS_BUILD_TESTS
+@@ -57,7 +57,8 @@ if DBUS_BUILD_TESTS
## we use noinst_PROGRAMS not check_PROGRAMS for TESTS so that we
## build even when not doing "make check"
@@ -32,17 +52,6 @@ index 3cb2c39..e6de67d 100644
test_service_SOURCES = \
test-interfaces.c \
-diff --git a/test/core/Makefile.am b/test/core/Makefile.am
-index ef6cb26..9786c3a 100644
---- a/test/core/Makefile.am
-+++ b/test/core/Makefile.am
-@@ -46,7 +46,8 @@ endif
-
- ## we use noinst_PROGRAMS not check_PROGRAMS for TESTS so that we
- ## build even when not doing "make check"
--noinst_PROGRAMS = \
-+testdir = $(datadir)/@PACKAGE@/tests/core
-+test_PROGRAMS = \
- test-dbus-glib \
- test-service-glib \
- $(THREAD_APPS) \
+--
+1.9.1
+
diff --git a/meta/recipes-core/dbus/dbus-glib_0.100.2.bb b/meta/recipes-core/dbus/dbus-glib_0.100.2.bb
deleted file mode 100644
index c1bb06a1b4..0000000000
--- a/meta/recipes-core/dbus/dbus-glib_0.100.2.bb
+++ /dev/null
@@ -1,5 +0,0 @@
-require dbus-glib.inc
-
-
-SRC_URI[md5sum] = "ad0920c7e3aad669163bb59171cf138e"
-SRC_URI[sha256sum] = "a5bb42da921f51c28161e0e54a5a8241d94a1c0499a14007150e9ce743da6ac5"
diff --git a/meta/recipes-core/dbus/dbus-glib_0.102.bb b/meta/recipes-core/dbus/dbus-glib_0.102.bb
new file mode 100644
index 0000000000..d798ebfac0
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus-glib_0.102.bb
@@ -0,0 +1,5 @@
+require dbus-glib.inc
+
+
+SRC_URI[md5sum] = "f76b8558fd575d0106c3a556eaa49184"
+SRC_URI[sha256sum] = "6964ed585bb8149a14ab744b5ded5e77cf71ec5446e6dcc5fcf5eebcc52df29c"
diff --git a/meta/recipes-core/dbus/dbus-test_1.8.2.bb b/meta/recipes-core/dbus/dbus-test_1.8.10.bb
index e19d2e9d1e..719c1f9621 100644
--- a/meta/recipes-core/dbus/dbus-test_1.8.2.bb
+++ b/meta/recipes-core/dbus/dbus-test_1.8.10.bb
@@ -18,8 +18,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] = "d6f709bbec0a022a1847c7caec9d6068"
-SRC_URI[sha256sum] = "5689f7411165adc953f37974e276a3028db94447c76e8dd92efe910c6d3bae08"
+SRC_URI[md5sum] = "6be5ef99ae784de9d04589eb067fe038"
+SRC_URI[sha256sum] = "10bf87fdb68815edd01d53885101dbcdd80dacad7198912cca61a4fa22dfaf8e"
S="${WORKDIR}/dbus-${PV}"
FILESEXTRAPATHS =. "${FILE_DIRNAME}/dbus:"
@@ -44,6 +44,7 @@ EXTRA_OECONF = "--enable-tests \
${EXTRA_OECONF_X}"
do_install() {
+ :
}
do_install_ptest() {
diff --git a/meta/recipes-core/dbus/dbus.inc b/meta/recipes-core/dbus/dbus.inc
index d38ba7e1d2..fb5d017856 100644
--- a/meta/recipes-core/dbus/dbus.inc
+++ b/meta/recipes-core/dbus/dbus.inc
@@ -8,7 +8,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=10dded3b58148f3f1fd804b26354af3e \
DEPENDS = "expat virtual/libintl"
RDEPENDS_dbus_class-native = ""
RDEPENDS_dbus_class-nativesdk = ""
-PACKAGES += "${@bb.utils.contains('PTEST_ENABLED', '1', 'dbus-ptest', '', d)}"
+PACKAGES += "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '${PN}-ptest', '', d)}"
ALLOW_EMPTY_dbus-ptest = "1"
RDEPENDS_dbus-ptest_class-target = "dbus-test-ptest"
diff --git a/meta/recipes-core/dbus/dbus_1.8.10.bb b/meta/recipes-core/dbus/dbus_1.8.10.bb
new file mode 100644
index 0000000000..250ea21ddc
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus_1.8.10.bb
@@ -0,0 +1,4 @@
+include dbus.inc
+
+SRC_URI[md5sum] = "6be5ef99ae784de9d04589eb067fe038"
+SRC_URI[sha256sum] = "10bf87fdb68815edd01d53885101dbcdd80dacad7198912cca61a4fa22dfaf8e"
diff --git a/meta/recipes-core/dbus/dbus_1.8.2.bb b/meta/recipes-core/dbus/dbus_1.8.2.bb
deleted file mode 100644
index 37ebed2bd6..0000000000
--- a/meta/recipes-core/dbus/dbus_1.8.2.bb
+++ /dev/null
@@ -1,4 +0,0 @@
-include dbus.inc
-
-SRC_URI[md5sum] = "d6f709bbec0a022a1847c7caec9d6068"
-SRC_URI[sha256sum] = "5689f7411165adc953f37974e276a3028db94447c76e8dd92efe910c6d3bae08"
diff --git a/meta/recipes-core/dropbear/dropbear.inc b/meta/recipes-core/dropbear/dropbear.inc
index 9fec09e919..e187d04339 100644
--- a/meta/recipes-core/dropbear/dropbear.inc
+++ b/meta/recipes-core/dropbear/dropbear.inc
@@ -5,7 +5,7 @@ SECTION = "console/network"
# some files are from other projects and have others license terms:
# public domain, OpenSSH 3.5p1, OpenSSH3.6.1p2, PuTTY
LICENSE = "MIT & BSD-3-Clause & BSD-2-Clause & PD"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=4d290ce0ac102c828dfc9ce836784688"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=e3a1b9604afd1648b28b0c6f1709e9f4"
DEPENDS = "zlib"
RPROVIDES_${PN} = "ssh sshd"
@@ -27,6 +27,13 @@ PAM_SRC_URI = "file://0005-dropbear-enable-pam.patch \
file://0006-dropbear-configuration-file.patch \
file://dropbear"
+PAM_PLUGINS = "libpam-runtime \
+ pam-plugin-deny \
+ pam-plugin-permit \
+ pam-plugin-unix \
+ "
+RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_PLUGINS}', '', d)}"
+
inherit autotools update-rc.d systemd
INITSCRIPT_NAME = "dropbear"
diff --git a/meta/recipes-core/dropbear/dropbear/0001-urandom-xauth-changes-to-options.h.patch b/meta/recipes-core/dropbear/dropbear/0001-urandom-xauth-changes-to-options.h.patch
index 71a4666b5c..dc9d5782e8 100644
--- a/meta/recipes-core/dropbear/dropbear/0001-urandom-xauth-changes-to-options.h.patch
+++ b/meta/recipes-core/dropbear/dropbear/0001-urandom-xauth-changes-to-options.h.patch
@@ -13,7 +13,7 @@ index 7d06322..71a21c2 100644
/* The command to invoke for xauth when using X11 forwarding.
* "-q" for quiet */
#ifndef XAUTH_COMMAND
--#define XAUTH_COMMAND "/usr/bin/X11/xauth -q"
+-#define XAUTH_COMMAND "/usr/bin/xauth -q"
+#define XAUTH_COMMAND "xauth -q"
#endif
diff --git a/meta/recipes-core/dropbear/dropbear_2014.63.bb b/meta/recipes-core/dropbear/dropbear_2014.63.bb
deleted file mode 100644
index bb7e6178bc..0000000000
--- a/meta/recipes-core/dropbear/dropbear_2014.63.bb
+++ /dev/null
@@ -1,4 +0,0 @@
-require dropbear.inc
-
-SRC_URI[md5sum] = "7066bb9a2da708f3ed06314fdc9c47fd"
-SRC_URI[sha256sum] = "595992de432ba586a0e7e191bbb1ad587727678bb3e345b018c395b8c55b57ae"
diff --git a/meta/recipes-core/dropbear/dropbear_2014.66.bb b/meta/recipes-core/dropbear/dropbear_2014.66.bb
new file mode 100644
index 0000000000..8931eb75b2
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear_2014.66.bb
@@ -0,0 +1,4 @@
+require dropbear.inc
+
+SRC_URI[md5sum] = "c21a01111aa5015db038c6efdb85717d"
+SRC_URI[sha256sum] = "ab3fe2670a517cc0bbe398ff5d15e9ca12cd14f2fc18930a8111ae2baa64ab76"
diff --git a/meta/recipes-core/eglibc/cross-localedef-native_2.19.bb b/meta/recipes-core/eglibc/cross-localedef-native_2.19.bb
deleted file mode 100644
index 1c13eb824a..0000000000
--- a/meta/recipes-core/eglibc/cross-localedef-native_2.19.bb
+++ /dev/null
@@ -1,48 +0,0 @@
-SUMMARY = "Cross locale generation tool for eglibc"
-HOMEPAGE = "http://www.eglibc.org/home"
-SECTION = "libs"
-LICENSE = "LGPL-2.1"
-
-LIC_DIR = "${WORKDIR}/eglibc-${PV}/libc"
-LIC_FILES_CHKSUM = "file://${LIC_DIR}/LICENSES;md5=e9a558e243b36d3209f380deb394b213 \
- file://${LIC_DIR}/COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
- file://${LIC_DIR}/posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
- file://${LIC_DIR}/COPYING.LIB;md5=4fbd65380cdd255951079008b364516c"
-
-
-inherit native
-inherit autotools
-
-FILESEXTRAPATHS =. "${FILE_DIRNAME}/${P}:"
-
-SRC_URI = "http://downloads.yoctoproject.org/releases/eglibc/eglibc-${PV}-svnr25243.tar.bz2 \
- file://fix_for_centos_5.8.patch;patchdir=.. \
- "
-SRC_URI[md5sum] = "197836c2ba42fb146e971222647198dd"
-SRC_URI[sha256sum] = "baaa030531fc308f7820c46acdf8e1b2f8e3c1f40bcd28b6e440d1c95d170d4c"
-
-S = "${WORKDIR}/eglibc-${PV}/localedef"
-
-do_unpack_append() {
- bb.build.exec_func('do_move_ports', d)
-}
-
-do_move_ports() {
- if test -d ${WORKDIR}/eglibc-${PV}/ports ; then
- rm -rf ${WORKDIR}/libc/ports
- mv ${WORKDIR}/eglibc-${PV}/ports ${WORKDIR}/libc/
- fi
-}
-
-EXTRA_OECONF = "--with-glibc=${WORKDIR}/eglibc-${PV}/libc"
-CFLAGS += "-DNOT_IN_libc=1"
-
-do_configure () {
- ${S}/configure ${EXTRA_OECONF}
-}
-
-
-do_install() {
- install -d ${D}${bindir}
- install -m 0755 ${B}/localedef ${D}${bindir}/cross-localedef
-}
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/0001-eglibc-menuconfig-support.patch b/meta/recipes-core/eglibc/eglibc-2.19/0001-eglibc-menuconfig-support.patch
deleted file mode 100644
index 4559a110fb..0000000000
--- a/meta/recipes-core/eglibc/eglibc-2.19/0001-eglibc-menuconfig-support.patch
+++ /dev/null
@@ -1,912 +0,0 @@
-Pulled from
-http://www.eglibc.org/archives/patches/msg01042.html
-
-Upstream-Status: Pending
-Signed-off-by: Khem
-
-Hi,
-
-This patch adds 'make menuconfig' support to EGLIBC.
-
-
-EGLIBC can re-use the Linux kernel kconfig host tools ('conf' and 'mconf') unmodified, by passing appropriate environment variables and with some pre- and post-processing on the input/output config files.
-
-There are three new make targets supported, which all are defined in the new libc/options-config/Makefile, which is included by the top-level libc/Makefile:
-
-- 'make defconfig'. This passes 'libc/option-groups.defaults' to 'conf' as a default config, and outputs 'option-groups.config' to the top-level build directory, which will be the same as the default config.
-
-- 'make config'. This is the same line-oriented interface as in the Linux kernel. Input and output is 'option-groups.config' in the top-level build directory.
-
-- 'make menuconfig'. This is the same menu-based interface as in the Linux kernel. Input and output is 'option-groups.config' in the top-level build directory.
-
-
-Pre-Processing:
-
-
-The Linux kernel kconfig tools expect a prefix of "CONFIG_" on all config option names, but EGLIBC expects a prefix of "OPTION_". The pre-processing script, libc/options-config/config-preproc.pl, simply replaces "CONFIG_ with "OPTION_" in the given config file. The libc/options-config/Makefile passes the script output to a temporary config file, which is then passed to 'conf' or 'mconf'.
-
-Post-Processing (libc/options-config/config-postproc.pl):
-
-
-- Disabled options are output as a comment line of the form "# CONFIG_FOO is not set". This needs to be changed to an explicit "CONFIG_FOO=n" in order to be compatible with 'option-groups.awk' which generates the option-groups.h header.
-
-- "CONFIG_" prefix is changed back to "OPTION_".
-
-
-- The kconfig tools will not output anything for options that depend on a parent option, when the parent option is disabled. This implicit disable must be converted to an explicit "CONFIG_FOO=n" in order to be compatible with the way EGLIBC overrides the default option settings in 'libc/option-groups.defaults' with those in 'option-groups.config'.
-
-
-A new configure option, '--with-kconfig=<PATH>', tells EGLIBC where to find the pre-built 'conf' and 'mconf' host tools from Linux kernel builds.
-
-libc/EGLIBC.cross-building is updated to include instructions for using '--with-kconfig' for the final EGLIBC build, and shows how and when to run 'make *config'.
-
-libc/EGLIBC.option-groups is updated to include new information on the menuconfig support.
-
-Thanks,
-
-attached is the updated patch to address above issues.
-
-Steve
-
---
-Steve Longerbeam | Senior Embedded Engineer, ESD Services
-Mentor Embedded(tm) | 46871 Bayside Parkway, Fremont, CA 94538
-P 510.354.5838 | M 408.410.2735
-Nucleus(r) | Linux(r) | Android(tm) | Services | UI | Multi-OS
-
-
-Index: libc/EGLIBC.cross-building
-===================================================================
---- libc.orig/EGLIBC.cross-building
-+++ libc/EGLIBC.cross-building
-@@ -243,9 +243,29 @@ full EGLIBC build:
- > $src/libc/configure \
- > --prefix=/usr \
- > --with-headers=$sysroot/usr/include \
-+ > --with-kconfig=$obj/linux/scripts/kconfig \
- > --build=$build \
- > --host=$target \
- > --disable-profile --without-gd --without-cvs --enable-add-ons
-+
-+Note the additional '--with-kconfig' option. This tells EGLIBC where to
-+find the host config tools used by the kernel 'make config' and 'make
-+menuconfig'. These tools can be re-used by EGLIBC for its own 'make
-+*config' support, which will create 'option-groups.config' for you.
-+But first make sure those tools have been built by running some
-+dummy 'make *config' calls in the kernel directory:
-+
-+ $ cd $obj/linux
-+ $ PATH=$tools/bin:$PATH make config \
-+ > ARCH=$linux_arch CROSS_COMPILE=$target- \
-+ $ PATH=$tools/bin:$PATH make menuconfig \
-+ > ARCH=$linux_arch CROSS_COMPILE=$target- \
-+
-+Now we can configure and build the full EGLIBC:
-+
-+ $ cd $obj/eglibc
-+ $ PATH=$tools/bin:$PATH make defconfig
-+ $ PATH=$tools/bin:$PATH make menuconfig
- $ PATH=$tools/bin:$PATH make
- $ PATH=$tools/bin:$PATH make install install_root=$sysroot
-
-Index: libc/configure.ac
-===================================================================
---- libc.orig/configure.ac
-+++ libc/configure.ac
-@@ -127,6 +127,16 @@ AC_ARG_WITH([headers],
- [sysheaders=''])
- AC_SUBST(sysheaders)
-
-+AC_ARG_WITH([kconfig],
-+ AC_HELP_STRING([--with-kconfig=PATH],
-+ [location of kconfig tools to use (from Linux
-+ kernel builds) to re-use for configuring EGLIBC
-+ option groups]),
-+ [KCONFIG_TOOLS=$withval],
-+ [KCONFIG_TOOLS=''])
-+AC_SUBST(KCONFIG_TOOLS)
-+
-+
- AC_SUBST(use_default_link)
- AC_ARG_WITH([default-link],
- AC_HELP_STRING([--with-default-link],
-Index: libc/config.make.in
-===================================================================
---- libc.orig/config.make.in
-+++ libc/config.make.in
-@@ -45,6 +45,8 @@ sysincludes = @SYSINCLUDES@
- c++-sysincludes = @CXX_SYSINCLUDES@
- all-warnings = @all_warnings@
-
-+kconfig_tools = @KCONFIG_TOOLS@
-+
- have-z-combreloc = @libc_cv_z_combreloc@
- have-z-execstack = @libc_cv_z_execstack@
- have-Bgroup = @libc_cv_Bgroup@
-Index: libc/options-config/config-postproc.pl
-===================================================================
---- /dev/null
-+++ libc/options-config/config-postproc.pl
-@@ -0,0 +1,54 @@
-+#!/usr/bin/perl
-+
-+$usage = "usage: $0 <default config file> <config file>\n";
-+
-+die "$usage" unless @ARGV;
-+$defaults = shift @ARGV;
-+die "$usage" unless @ARGV;
-+die "Could not open $ARGV[0]" unless -T $ARGV[0];
-+
-+sub yank {
-+ @option = grep($_ ne $_[0], @option);
-+}
-+
-+open(DEFAULTS, $defaults) || die "Could not open $defaults\n";
-+
-+# get the full list of available options using the default config file
-+$i = 0;
-+while (<DEFAULTS>) {
-+ if (/^\s*OPTION_(\w+)\s*=/) {
-+ $option[$i++] = $1;
-+ }
-+}
-+
-+# now go through the config file, making the necessary changes
-+while (<>) {
-+ if (/Linux Kernel Configuration/) {
-+ # change title
-+ s/Linux Kernel/Option Groups/;
-+ print;
-+ } elsif (/^\s*CONFIG_(\w+)\s*=/) {
-+ # this is an explicit option set line, change CONFIG_ to OPTION_
-+ # before printing and remove this option from option list
-+ $opt = $1;
-+ yank($opt);
-+ s/CONFIG_/OPTION_/g;
-+ print;
-+ } elsif (/^\s*#\s+CONFIG_(\w+) is not set/) {
-+ # this is a comment line, change CONFIG_ to OPTION_, remove this
-+ # option from option list, and convert to explicit OPTION_FOO=n
-+ $opt = $1;
-+ yank($opt);
-+ s/CONFIG_/OPTION_/g;
-+ print "OPTION_$opt=n\n";
-+ } else {
-+ print;
-+ }
-+}
-+
-+# any options left in @options, are options that were not mentioned in
-+# the config file, and implicitly that means the option must be set =n,
-+# so do that here.
-+foreach $opt (@option) {
-+ print "OPTION_$opt=n\n";
-+}
-Index: libc/options-config/config-preproc.pl
-===================================================================
---- /dev/null
-+++ libc/options-config/config-preproc.pl
-@@ -0,0 +1,8 @@
-+#!/usr/bin/perl
-+
-+if (@ARGV) {
-+ while (<>) {
-+ s/OPTION_/CONFIG_/g;
-+ print;
-+ }
-+}
-Index: libc/options-config/Makefile
-===================================================================
---- /dev/null
-+++ libc/options-config/Makefile
-@@ -0,0 +1,55 @@
-+# ===========================================================================
-+# EGLIBC option-groups configuration targets
-+# These targets are included from top-level makefile
-+
-+ifneq ($(kconfig_tools),)
-+ifneq (no,$(PERL))
-+
-+ocdir := options-config
-+
-+OconfigDefaults := option-groups.defaults
-+OconfigDefaults_tmp := $(common-objpfx).tmp.defconfig
-+OconfigDef := option-groups.def
-+Oconfig := $(common-objpfx)option-groups.config
-+Oconfig_tmp := $(common-objpfx).tmp.config
-+
-+conf := $(kconfig_tools)/conf
-+mconf := $(kconfig_tools)/mconf
-+
-+preproc := $(PERL) $(ocdir)/config-preproc.pl
-+postproc := $(PERL) $(ocdir)/config-postproc.pl
-+
-+PHONY += defconfig config menuconfig
-+
-+defconfig: $(conf) $(OconfigDefaults) $(OconfigDef)
-+ rm -f $(OconfigDefaults_tmp)
-+ rm -f $(Oconfig_tmp)
-+ $(preproc) $(OconfigDefaults) > $(OconfigDefaults_tmp)
-+ KCONFIG_CONFIG=$(Oconfig_tmp) $< --defconfig=$(OconfigDefaults_tmp) \
-+ $(OconfigDef)
-+ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig)
-+ rm $(Oconfig_tmp)
-+ rm $(OconfigDefaults_tmp)
-+
-+config: $(conf) $(OconfigDefaults) $(OconfigDef)
-+ rm -f $(Oconfig_tmp)
-+ $(preproc) $(wildcard $(Oconfig)) > $(Oconfig_tmp)
-+ KCONFIG_CONFIG=$(Oconfig_tmp) $< --oldaskconfig $(OconfigDef)
-+ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig)
-+ rm $(Oconfig_tmp)
-+
-+menuconfig: $(mconf) $(OconfigDefaults) $(OconfigDef)
-+ rm -f $(Oconfig_tmp)
-+ $(preproc) $(wildcard $(Oconfig)) > $(Oconfig_tmp)
-+ KCONFIG_CONFIG=$(Oconfig_tmp) $< $(OconfigDef)
-+ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig)
-+ rm $(Oconfig_tmp)
-+
-+# Help text used by make help
-+help:
-+ @echo ' defconfig - New config with default from default config'
-+ @echo ' config - Update current config utilising a line-oriented program'
-+ @echo ' menuconfig - Update current config utilising a menu based program'
-+
-+endif
-+endif
-Index: libc/option-groups.def
-===================================================================
---- libc.orig/option-groups.def
-+++ libc/option-groups.def
-@@ -4,19 +4,19 @@
- #
- # An entry of the form:
- #
--# config OPTION_GROUP_NAME
-+# config GROUP_NAME
- # bool "one-line explanation of what this option group controls"
- # help
- # Multi-line help explaining the option group's meaning in
- # some detail, terminated by indentation level.
- #
--# defines an option group whose variable is OPTION_GROUP_NAME, with
-+# defines an option group whose variable is GROUP_NAME, with
- # meaningful values 'y' (enabled) and 'n' (disabled). The
- # documentation is formatted to be consumed by some sort of
- # interactive configuration interface, but EGLIBC doesn't have such an
- # interface yet.
- #
--# An option may have a 'depends' line, indicating which other options
-+# An option may have a 'depends on' line, indicating which other options
- # must also be enabled if this option is. At present, EGLIBC doesn't
- # check that these dependencies are satisfied.
- #
-@@ -41,9 +41,9 @@
- # although this simply reestablishes the value already set by
- # 'option-groups.defaults'.
-
--config OPTION_EGLIBC_ADVANCED_INET6
-+config EGLIBC_ADVANCED_INET6
- bool "IPv6 Advanced Sockets API support (RFC3542)"
-- depends OPTION_EGLIBC_INET
-+ depends on EGLIBC_INET
- help
- This option group includes the functions specified by RFC 3542,
- "Advanced Sockets Application Program Interface (API) for
-@@ -71,7 +71,7 @@ config OPTION_EGLIBC_ADVANCED_INET6
- inet6_rth_segments
- inet6_rth_space
-
--config OPTION_EGLIBC_BACKTRACE
-+config EGLIBC_BACKTRACE
- bool "Functions for producing backtraces"
- help
- This option group includes functions for producing a list of
-@@ -85,7 +85,7 @@ config OPTION_EGLIBC_BACKTRACE
- backtrace_symbols
- backtrace_symbols_fd
-
--config OPTION_EGLIBC_BIG_MACROS
-+config EGLIBC_BIG_MACROS
- bool "Use extensive inline code"
- help
- This option group specifies whether certain pieces of code
-@@ -93,7 +93,7 @@ config OPTION_EGLIBC_BIG_MACROS
- group is not selected, function calls will be used instead,
- hence reducing the library footprint.
-
--config OPTION_EGLIBC_BSD
-+config EGLIBC_BSD
- bool "BSD-specific functions, and their compatibility stubs"
- help
- This option group includes functions specific to BSD kernels.
-@@ -109,10 +109,9 @@ config OPTION_EGLIBC_BSD
- revoke
- setlogin
-
--config OPTION_EGLIBC_CXX_TESTS
-+config EGLIBC_CXX_TESTS
- bool "Tests that link against the standard C++ library."
-- depends OPTION_POSIX_WIDE_CHAR_DEVICE_IO
-- depends OPTION_EGLIBC_LIBM
-+ depends on POSIX_WIDE_CHAR_DEVICE_IO && EGLIBC_LIBM
- help
- This option group does not include any C library functions;
- instead, it controls which EGLIBC tests an ordinary 'make
-@@ -121,23 +120,22 @@ config OPTION_EGLIBC_CXX_TESTS
- run.
-
- The standard C++ library depends on the math library 'libm' and
-- the wide character I/O functions included in EGLIBC. If those
-- option groups are disabled, this test must also be disabled.
-+ the wide character I/O functions included in EGLIBC. So those
-+ option groups must be enabled if this test is enabled.
-
--config OPTION_EGLIBC_CATGETS
-+config EGLIBC_CATGETS
- bool "Functions for accessing message catalogs"
-- depends OPTION_EGLIBC_LOCALE_CODE
-+ depends on EGLIBC_LOCALE_CODE
- help
- This option group includes functions for accessing message
- catalogs: catopen, catclose, and catgets.
-
-- This option group depends on the OPTION_EGLIBC_LOCALE_CODE
-- option group; if you disable that, you must also disable this.
-+ This option group depends on the EGLIBC_LOCALE_CODE
-+ option group.
-
--config OPTION_EGLIBC_CHARSETS
-+config EGLIBC_CHARSETS
- bool "iconv/gconv character set conversion libraries"
- help
--
- This option group includes support for character sets other
- than ASCII (ANSI_X3.4-1968) and Unicode and ISO-10646 in their
- various encodings. This affects both the character sets
-@@ -198,16 +196,16 @@ config OPTION_EGLIBC_CHARSETS
- WCHAR_T - EGLIBC's internal form (target-endian,
- 32-bit ISO 10646)
-
--config OPTION_EGLIBC_CRYPT
-+config EGLIBC_CRYPT
- bool "Encryption library"
- help
- This option group includes the `libcrypt' library which
- provides functions for one-way encryption. Supported
- encryption algorithms include MD5, SHA-256, SHA-512 and DES.
-
--config OPTION_EGLIBC_CRYPT_UFC
-+config EGLIBC_CRYPT_UFC
- bool "Ultra fast `crypt' implementation"
-- depends OPTION_EGLIBC_CRYPT
-+ depends on EGLIBC_CRYPT
- help
- This option group provides ultra fast DES-based implementation of
- the `crypt' function. When this option group is disabled,
-@@ -216,7 +214,7 @@ config OPTION_EGLIBC_CRYPT_UFC
- errno to ENOSYS if /salt/ passed does not correspond to either MD5,
- SHA-256 or SHA-512 algorithm.
-
--config OPTION_EGLIBC_DB_ALIASES
-+config EGLIBC_DB_ALIASES
- bool "Functions for accessing the mail aliases database"
- help
- This option group includues functions for looking up mail
-@@ -233,7 +231,7 @@ config OPTION_EGLIBC_DB_ALIASES
- When this option group is disabled, the NSS service libraries
- also lack support for querying their mail alias tables.
-
--config OPTION_EGLIBC_ENVZ
-+config EGLIBC_ENVZ
- bool "Functions for handling envz-style environment vectors."
- help
- This option group contains functions for creating and operating
-@@ -248,7 +246,7 @@ config OPTION_EGLIBC_ENVZ
- envz_entry envz_remove
- envz_get envz_strip
-
--config OPTION_EGLIBC_FCVT
-+config EGLIBC_FCVT
- bool "Functions for converting floating-point numbers to strings"
- help
- This option group includes functions for converting
-@@ -262,14 +260,14 @@ config OPTION_EGLIBC_FCVT
- fcvt_r qfcvt_r
- gcvt qgcvt
-
--config OPTION_EGLIBC_FMTMSG
-+config EGLIBC_FMTMSG
- bool "Functions for formatting messages"
- help
- This option group includes the following functions:
-
- addseverity fmtmsg
-
--config OPTION_EGLIBC_FSTAB
-+config EGLIBC_FSTAB
- bool "Access functions for 'fstab'"
- help
- This option group includes functions for reading the mount
-@@ -283,7 +281,7 @@ config OPTION_EGLIBC_FSTAB
- getfsent setfsent
- getfsfile
-
--config OPTION_EGLIBC_FTRAVERSE
-+config EGLIBC_FTRAVERSE
- bool "Functions for traversing file hierarchies"
- help
- This option group includes functions for traversing file
-@@ -297,9 +295,9 @@ config OPTION_EGLIBC_FTRAVERSE
- fts_set nftw64
- fts_close
-
--config OPTION_EGLIBC_GETLOGIN
-+config EGLIBC_GETLOGIN
- bool "The getlogin function"
-- depends OPTION_EGLIBC_UTMP
-+ depends on EGLIBC_UTMP
- help
- This function group includes the 'getlogin' and 'getlogin_r'
- functions, which return the user name associated by the login
-@@ -309,17 +307,17 @@ config OPTION_EGLIBC_GETLOGIN
- fall back on 'getlogin' to find the user's login name for tilde
- expansion when the 'HOME' environment variable is not set.
-
--config OPTION_EGLIBC_IDN
-+config EGLIBC_IDN
- bool "International domain names support"
- help
- This option group includes the `libcidn' library which
- provides support for international domain names.
-
--config OPTION_EGLIBC_INET
-+config EGLIBC_INET
- bool "Networking support"
- help
- This option group includes networking-specific functions and
-- data. With OPTION_EGLIBC_INET disabled, the EGLIBC
-+ data. With EGLIBC_INET disabled, the EGLIBC
- installation and API changes as follows:
-
- - The following libraries are not installed:
-@@ -439,14 +437,14 @@ config OPTION_EGLIBC_INET
- use Unix-domain sockets to communicate with the syslog daemon;
- syslog is valuable in non-networked contexts.
-
--config OPTION_EGLIBC_INET_ANL
-+config EGLIBC_INET_ANL
- bool "Asynchronous name lookup"
-- depends OPTION_EGLIBC_INET
-+ depends on EGLIBC_INET
- help
- This option group includes the `libanl' library which
- provides support for asynchronous name lookup.
-
--config OPTION_EGLIBC_LIBM
-+config EGLIBC_LIBM
- bool "libm (math library)"
- help
- This option group includes the 'libm' library, containing
-@@ -464,7 +462,7 @@ config OPTION_EGLIBC_LIBM
- group, you will not be able to build 'libstdc++' against the
- resulting EGLIBC installation.
-
--config OPTION_EGLIBC_LOCALES
-+config EGLIBC_LOCALES
- bool "Locale definitions"
- help
- This option group includes all locale definitions other than
-@@ -472,17 +470,17 @@ config OPTION_EGLIBC_LOCALES
- only the "C" locale is supported.
-
-
--config OPTION_EGLIBC_LOCALE_CODE
-+config EGLIBC_LOCALE_CODE
- bool "Locale functions"
-- depends OPTION_POSIX_C_LANG_WIDE_CHAR
-+ depends on POSIX_C_LANG_WIDE_CHAR
- help
- This option group includes locale support functions, programs,
-- and libraries. With OPTION_EGLIBC_LOCALE_FUNCTIONS disabled,
-+ and libraries. With EGLIBC_LOCALE_CODE disabled,
- EGLIBC supports only the 'C' locale (also known as 'POSIX'),
- and ignores the settings of the 'LANG' and 'LC_*' environment
- variables.
-
-- With OPTION_EGLIBC_LOCALE_CODE disabled, the following
-+ With EGLIBC_LOCALE_CODE disabled, the following
- functions are omitted from libc:
-
- duplocale localeconv nl_langinfo rpmatch strfmon_l
-@@ -491,46 +489,43 @@ config OPTION_EGLIBC_LOCALE_CODE
- Furthermore, only the LC_CTYPE and LC_TIME categories of the
- standard "C" locale are available.
-
-- The OPTION_EGLIBC_CATGETS option group depends on this option
-- group; if you disable OPTION_EGLIBC_LOCALE_CODE, you must also
-- disable OPTION_EGLIBC_CATGETS.
-+ The EGLIBC_CATGETS option group depends on this option group.
-+
-
--config OPTION_EGLIBC_MEMUSAGE
-+config EGLIBC_MEMUSAGE
- bool "Memory profiling library"
- help
- This option group includes the `libmemusage' library and
- the `memusage' and `memusagestat' utilities.
- These components provide memory profiling functions.
-
-- OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
-+ EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
-
- Libmemusage library buffers the profiling data in memory
- before writing it out to disk. By default, the library
- allocates 1.5M buffer, which can be substantial for some
-- systems. OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE option
-+ systems. EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE option
- allows to change the default buffer size. It specifies
- the number of entries the buffer should have.
- On most architectures one buffer entry amounts to 48 bytes,
- so setting this option to the value of 512 will reduce the size of
- the memory buffer to 24K.
-
--config OPTION_EGLIBC_NIS
-+config EGLIBC_NIS
- bool "Support for NIS, NIS+, and the special 'compat' services."
-- depends OPTION_EGLIBC_INET
-- depends OPTION_EGLIBC_SUNRPC
-+ depends on EGLIBC_INET && EGLIBC_SUNRPC
- help
- This option group includes the NIS, NIS+, and 'compat' Name
- Service Switch service libraries. When it is disabled, those
- services libraries are not installed; you should remove any
- references to them from your 'nsswitch.conf' file.
-
-- This option group depends on the OPTION_EGLIBC_INET option
-+ This option group depends on the EGLIBC_INET option
- group; you must enable that to enable this option group.
-
--config OPTION_EGLIBC_NSSWITCH
-+config EGLIBC_NSSWITCH
- bool "Name service switch (nsswitch) support"
- help
--
- This option group includes support for the 'nsswitch' facility.
- With this option group enabled, all EGLIBC functions for
- accessing various system databases (passwords and groups;
-@@ -544,12 +539,12 @@ config OPTION_EGLIBC_NSSWITCH
- 'option-groups.config' file must set the following two
- variables:
-
-- OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG
-+ EGLIBC_NSSWITCH_FIXED_CONFIG
-
- Set this to the name of a file whose contents observe the
- same syntax as an ordinary '/etc/nsswitch.conf' file. The
- EGLIBC build process parses this file just as EGLIBC would
-- at run time if OPTION_EGLIBC_NSSWITCH were enabled, and
-+ at run time if EGLIBC_NSSWITCH were enabled, and
- produces a C library that uses the nsswitch service
- libraries to search for database entries as this file
- specifies, instead of consulting '/etc/nsswitch.conf' at run
-@@ -567,7 +562,7 @@ config OPTION_EGLIBC_NSSWITCH
- you will probably want to delete references to databases not
- needed on your system.
-
-- OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS
-+ EGLIBC_NSSWITCH_FIXED_FUNCTIONS
-
- The EGLIBC build process uses this file to decide which
- functions to make available from which service libraries.
-@@ -585,28 +580,28 @@ config OPTION_EGLIBC_NSSWITCH
- Be sure to mention each function in each service you wish to
- use. If you do not mention a service's function here, the
- EGLIBC database access functions will not find it, even if
-- it is listed in the OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG
-+ it is listed in the EGLIBC_NSSWITCH_FIXED_CONFIG
- file.
-
-- In this arrangement, EGLIBC will not use the 'dlopen' and
-- 'dlsym' functions to find database access functions. Instead,
-- libc hard-codes references to the service libraries' database
-- access functions. You must explicitly link your program
-- against the name service libraries (those whose names start
-- with 'libnss_', in the sysroot's '/lib' directory) whose
-- functions you intend to use. This arrangement helps
-- system-wide static analysis tools decide which functions a
-- system actually uses.
--
-- Note that some nsswitch service libraries require other option
-- groups to be enabled; for example, the OPTION_EGLIBC_INET
-- option group must be enabled to use the 'libnss_dns.so.2'
-- service library, which uses the Domain Name System network
-- protocol to answer queries.
-+ In this arrangement, EGLIBC will not use the 'dlopen' and
-+ 'dlsym' functions to find database access functions. Instead,
-+ libc hard-codes references to the service libraries' database
-+ access functions. You must explicitly link your program
-+ against the name service libraries (those whose names start
-+ with 'libnss_', in the sysroot's '/lib' directory) whose
-+ functions you intend to use. This arrangement helps
-+ system-wide static analysis tools decide which functions a
-+ system actually uses.
-+
-+ Note that some nsswitch service libraries require other option
-+ groups to be enabled; for example, the EGLIBC_INET
-+ option group must be enabled to use the 'libnss_dns.so.2'
-+ service library, which uses the Domain Name System network
-+ protocol to answer queries.
-
--config OPTION_EGLIBC_RCMD
-+config EGLIBC_RCMD
- bool "Support for 'rcmd' and related library functions"
-- depends OPTION_EGLIBC_INET
-+ depends on EGLIBC_INET
- help
- This option group includes functions for running commands on
- remote machines via the 'rsh' protocol, and doing authentication
-@@ -622,7 +617,7 @@ config OPTION_EGLIBC_RCMD
- rresvport ruserpass
- rresvport_af
-
--config OPTION_EGLIBC_RTLD_DEBUG
-+config EGLIBC_RTLD_DEBUG
- bool "Runtime linker debug print outs"
- help
- This option group enables debug output of the runtime linker
-@@ -633,7 +628,7 @@ config OPTION_EGLIBC_RTLD_DEBUG
- the `ldd' utility which may also be used by the prelinker.
- In particular, the `--unused' ldd option will not work correctly.
-
--config OPTION_EGLIBC_SPAWN
-+config EGLIBC_SPAWN
- bool "Support for POSIX posix_spawn functions"
- help
- This option group includes the POSIX functions for executing
-@@ -669,7 +664,7 @@ config OPTION_EGLIBC_SPAWN
- disabled, those programs will only operate on uncompressed
- charmap files.
-
--config OPTION_EGLIBC_STREAMS
-+config EGLIBC_STREAMS
- bool "Support for accessing STREAMS."
- help
- This option group includes functions for reading and writing
-@@ -685,14 +680,14 @@ config OPTION_EGLIBC_STREAMS
- isastream fdetach
- putmsg
-
--config OPTION_EGLIBC_SUNRPC
-+config EGLIBC_SUNRPC
- bool "Support for the Sun 'RPC' protocol."
-- depends OPTION_EGLIBC_INET
-+ depends on EGLIBC_INET
- help
- This option group includes support for the Sun RPC protocols,
- including the 'rpcgen' and 'rpcinfo' programs.
-
--config OPTION_EGLIBC_UTMP
-+config EGLIBC_UTMP
- bool "Older access functions for 'utmp' login records"
- help
- This option group includes the older 'utent' family of
-@@ -719,9 +714,9 @@ config OPTION_EGLIBC_UTMP
-
- libutil.so (and libutil.a)
-
--config OPTION_EGLIBC_UTMPX
-+config EGLIBC_UTMPX
- bool "POSIX access functions for 'utmp' login records"
-- depends OPTION_EGLIBC_UTMP
-+ depends on EGLIBC_UTMP
- help
- This option group includes the POSIX functions for reading and
- writing user login records in the 'utmp' file (usually
-@@ -742,21 +737,21 @@ config OPTION_EGLIBC_UTMPX
- updwtmpx
- utmpxname
-
--config OPTION_EGLIBC_WORDEXP
-+config EGLIBC_WORDEXP
- bool "Shell-style word expansion"
- help
- This option group includes the 'wordexp' function for
- performing word expansion in the manner of the shell, and the
- accompanying 'wordfree' function.
-
--config OPTION_POSIX_C_LANG_WIDE_CHAR
-+config POSIX_C_LANG_WIDE_CHAR
- bool "ISO C library wide character functions, excluding I/O"
- help
- This option group includes the functions defined by the ISO C
- standard for working with wide and multibyte characters in
- memory. Functions for reading and writing wide and multibyte
- characters from and to files call in the
-- OPTION_POSIX_WIDE_CHAR_DEVICE_IO option group.
-+ POSIX_WIDE_CHAR_DEVICE_IO option group.
-
- This option group includes the following functions:
-
-@@ -778,14 +773,14 @@ config OPTION_POSIX_C_LANG_WIDE_CHAR
- mbrlen wcscoll wcstol
- mbrtowc wcscpy wcstold
-
--config OPTION_POSIX_REGEXP
-+config POSIX_REGEXP
- bool "Regular expressions"
- help
- This option group includes the POSIX regular expression
- functions, and the associated non-POSIX extensions and
- compatibility functions.
-
-- With OPTION_POSIX_REGEXP disabled, the following functions are
-+ With POSIX_REGEXP disabled, the following functions are
- omitted from libc:
-
- re_comp re_max_failures regcomp
-@@ -799,9 +794,9 @@ config OPTION_POSIX_REGEXP
- <regexp.h> header file, 'compile', 'step', and 'advance', is
- omitted.
-
--config OPTION_POSIX_REGEXP_GLIBC
-+config POSIX_REGEXP_GLIBC
- bool "Regular expressions from GLIBC"
-- depends OPTION_POSIX_REGEXP
-+ depends on POSIX_REGEXP
- help
- This option group specifies which regular expression
- library to use. The choice is between regex
-@@ -810,9 +805,9 @@ config OPTION_POSIX_REGEXP_GLIBC
- optimized for speed; regex from libiberty is more than twice
- as small while still is enough for most practical purposes.
-
--config OPTION_POSIX_WIDE_CHAR_DEVICE_IO
-+config POSIX_WIDE_CHAR_DEVICE_IO
- bool "Input and output functions for wide characters"
-- depends OPTION_POSIX_C_LANG_WIDE_CHAR
-+ depends on POSIX_C_LANG_WIDE_CHAR
- help
- This option group includes functions for reading and writing
- wide characters to and from <stdio.h> streams.
-Index: libc/Makefile
-===================================================================
---- libc.orig/Makefile
-+++ libc/Makefile
-@@ -24,6 +24,7 @@ endif
-
- include Makeconfig
-
-+include options-config/Makefile
-
- # This is the default target; it makes everything except the tests.
- .PHONY: all
-Index: libc/configure
-===================================================================
---- libc.orig/configure
-+++ libc/configure
-@@ -621,6 +621,7 @@ KSH
- libc_cv_have_bash2
- BASH_SHELL
- libc_cv_gcc_static_libgcc
-+KCONFIG_TOOLS
- CXX_SYSINCLUDES
- SYSINCLUDES
- AUTOCONF
-@@ -734,6 +735,7 @@ with_fp
- with_binutils
- with_selinux
- with_headers
-+with_kconfig
- with_default_link
- enable_sanity_checks
- enable_shared
-@@ -1438,6 +1440,9 @@ Optional Packages:
- --with-selinux if building with SELinux support
- --with-headers=PATH location of system headers to use (for example
- /usr/src/linux/include) [default=compiler default]
-+ --with-kconfig=PATH location of kconfig tools to use (from Linux kernel
-+ builds) to re-use for configuring EGLIBC option
-+ groups
- --with-default-link do not use explicit linker scripts
- --with-cpu=CPU select code for CPU variant
-
-@@ -3401,6 +3406,14 @@ fi
-
-
-
-+# Check whether --with-kconfig was given.
-+if test "${with_kconfig+set}" = set; then
-+ withval=$with_kconfig; KCONFIG_TOOLS=$withval
-+else
-+ KCONFIG_TOOLS=''
-+fi
-+
-+
-
- # Check whether --with-default-link was given.
- if test "${with_default_link+set}" = set; then :
-Index: libc/EGLIBC.option-groups
-===================================================================
---- libc.orig/EGLIBC.option-groups
-+++ libc/EGLIBC.option-groups
-@@ -56,33 +56,9 @@ disable option groups one by one, until
-
- The Option Groups
-
--EGLIBC currently implements the following option groups, also
--documented in the file 'option-groups.def':
--
--OPTION_EGLIBC_CATGETS
-- This option group includes functions for accessing message
-- catalogs: catopen, catclose, and catgets.
--
--OPTION_EGLIBC_LOCALES
-- This option group includes all locale definitions other than
-- those for the "C" locale. If this option group is omitted, then
-- only the "C" locale is supported.
--
--OPTION_EGLIBC_LIBM
-- This option group includes the 'libm' library, containing
-- mathematical functions. If this option group is omitted, then
-- an EGLIBC installation does not include shared or unshared versions
-- of the math library.
--
-- Note that this does not remove all floating-point related
-- functionality from EGLIBC; for example, 'printf' and 'scanf'
-- can still print and read floating-point values with this option
-- group disabled.
--
-- Note that the ISO Standard C++ library 'libstdc++' depends on
-- EGLIBC's math library 'libm'. If you disable this option
-- group, you will not be able to build 'libstdc++' against the
-- resulting EGLIBC installation.
-+To see the current full list of implemented option groups, refer to the
-+file 'option-groups.def' at the top of the source tree, or run
-+'make menuconfig' from the top-level build directory.
-
- The POSIX.1-2001 specification includes a suggested partition of all
- the functions in the POSIX C API into option groups: math functions
-@@ -110,6 +86,18 @@ data, but include mathematical functions
- OPTION_EGLIBC_LOCALES = n
- OPTION_EGLIBC_LIBM = y
-
-+Like the Linux kernel, EGLIBC supports a similar set of '*config' make
-+targets to make it easier to create 'option-groups.config', with all
-+dependencies between option groups automatically satisfied. Run
-+'make help' to see the list of supported make config targets. For
-+example, 'make menuconfig' will update the current config utilising a
-+menu based program.
-+
-+The option group names and their type (boolean, int, hex, string), help
-+description, and dependencies with other option groups, are described by
-+'option-groups.def' at the top of the source tree, analogous to the
-+'Kconfig' files in the Linux kernel.
-+
- In general, each option group variable controls whether a given set of
- object files in EGLIBC is compiled and included in the final
- libraries, or omitted from the build.
-@@ -132,22 +120,3 @@ under development.
-
- We have used the system to subset some portions of EGLIBC's
- functionality. It needs to be extended to cover more of the library.
--
--At the moment, EGLIBC performs no sanity checks on the contents of
--'option-groups.config'; if an option group's name is mistyped, the
--option group is silently included in the build. EGLIBC should check
--that all variables set in 'option-groups.config' are proper option
--group names, and that their values are appropriate.
--
--Some portions of EGLIBC depend on others; for example, the Sun Remote
--Procedure Call functions in 'sunrpc' depend on the networking
--functions in 'inet'. The sanity checking described above should check
--that the selection configuration satisfies dependencies within EGLIBC,
--and produce a legible error message if it does not. At the moment,
--inconsistent configurations produce link errors late in the build
--process.
--
--The Linux kernel's configuration system provides interactive
--interfaces for creating and modifying configuration files (which also
--perform the sanity checking and dependency tracking described above).
--EGLIBC should provide similar interfaces.
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/0002-eglibc-menuconfig-hex-string-options.patch b/meta/recipes-core/eglibc/eglibc-2.19/0002-eglibc-menuconfig-hex-string-options.patch
deleted file mode 100644
index 7caba48112..0000000000
--- a/meta/recipes-core/eglibc/eglibc-2.19/0002-eglibc-menuconfig-hex-string-options.patch
+++ /dev/null
@@ -1,169 +0,0 @@
-pulled from
-
-http://www.eglibc.org/archives/patches/msg01043.html
-
-
-Upstream-Status: Pending
-Signed-off-by: Khem
-
-
-This patch builds on the menuconfig patch for EGLIBC.
-
-
-There are a few options that have non-boolean types, that would benefit from the new 'make *config' support:
-
-EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE (int)
-EGLIBC_NSSWITCH_FIXED_CONFIG (string)
-EGLIBC_NSSWITCH_FIXED_FUNCTIONS (string)
-
-
-The patch converts these to real options in libc/option-groups.def. Also, libc/scripts/option-groups.awk is modified to output a '#define' line for int, hex, or string options encountered in the config file.
-
-In the post-processing script config-postproc.pl, a small change is needed: for any boolean option FOO that is implicitly disabled in the kconfig output, make sure that option is indeed a boolean before printing the explicit OPTION_FOO=n.
-
-Finally, libc/malloc/Makefile passes __OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE as a CPPFLAGS, which is not necessary anymore because this macro will now be present in the generated header.
-
-attached is the updated patch to address above issues.
-
-Steve
-
---
-Steve Longerbeam | Senior Embedded Engineer, ESD Services
-Mentor Embedded(tm) | 46871 Bayside Parkway, Fremont, CA 94538
-P 510.354.5838 | M 408.410.2735
-Nucleus(r) | Linux(r) | Android(tm) | Services | UI | Multi-OS
-
-
-Index: libc/malloc/Makefile
-===================================================================
---- libc.orig/malloc/Makefile 2012-01-04 22:06:18.000000000 -0800
-+++ libc/malloc/Makefile 2012-05-09 19:35:28.598682105 -0700
-@@ -48,10 +48,6 @@
- ifeq ($(OPTION_EGLIBC_MEMUSAGE),y)
- extra-libs = libmemusage
- extra-libs-others = $(extra-libs)
--
--ifdef OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
--CPPFLAGS-memusage += -D__OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE=$(OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE)
--endif
- endif
-
- libmemusage-routines = memusage
-Index: libc/option-groups.def
-===================================================================
---- libc.orig/option-groups.def 2012-05-09 19:33:48.398677256 -0700
-+++ libc/option-groups.def 2012-05-09 19:35:28.610682107 -0700
-@@ -513,8 +513,11 @@
- the `memusage' and `memusagestat' utilities.
- These components provide memory profiling functions.
-
-- EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
--
-+config EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
-+ int "Memory profiling library buffer size"
-+ depends on EGLIBC_MEMUSAGE
-+ default "32768"
-+ help
- Libmemusage library buffers the profiling data in memory
- before writing it out to disk. By default, the library
- allocates 1.5M buffer, which can be substantial for some
-@@ -553,8 +556,11 @@
- 'option-groups.config' file must set the following two
- variables:
-
-- EGLIBC_NSSWITCH_FIXED_CONFIG
--
-+config EGLIBC_NSSWITCH_FIXED_CONFIG
-+ string "Nsswitch fixed config filename"
-+ depends on !EGLIBC_NSSWITCH
-+ default ""
-+ help
- Set this to the name of a file whose contents observe the
- same syntax as an ordinary '/etc/nsswitch.conf' file. The
- EGLIBC build process parses this file just as EGLIBC would
-@@ -576,8 +582,11 @@
- you will probably want to delete references to databases not
- needed on your system.
-
-- EGLIBC_NSSWITCH_FIXED_FUNCTIONS
--
-+config EGLIBC_NSSWITCH_FIXED_FUNCTIONS
-+ string "Nsswitch fixed functions filename"
-+ depends on !EGLIBC_NSSWITCH
-+ default ""
-+ help
- The EGLIBC build process uses this file to decide which
- functions to make available from which service libraries.
- The file 'nss/fixed-nsswitch.functions' serves as a sample
-Index: libc/options-config/config-postproc.pl
-===================================================================
---- libc.orig/options-config/config-postproc.pl 2012-05-09 19:33:36.530676681 -0700
-+++ libc/options-config/config-postproc.pl 2012-05-09 19:35:28.610682107 -0700
-@@ -8,7 +8,7 @@
- die "Could not open $ARGV[0]" unless -T $ARGV[0];
-
- sub yank {
-- @option = grep($_ ne $_[0], @option);
-+ @option = grep(!($_ =~ /$_[0]\s*=/), @option);
- }
-
- open(DEFAULTS, $defaults) || die "Could not open $defaults\n";
-@@ -16,7 +16,7 @@
- # get the full list of available options using the default config file
- $i = 0;
- while (<DEFAULTS>) {
-- if (/^\s*OPTION_(\w+)\s*=/) {
-+ if (/^\s*OPTION_(\w+\s*=.*$)/) {
- $option[$i++] = $1;
- }
- }
-@@ -35,8 +35,9 @@
- s/CONFIG_/OPTION_/g;
- print;
- } elsif (/^\s*#\s+CONFIG_(\w+) is not set/) {
-- # this is a comment line, change CONFIG_ to OPTION_, remove this
-- # option from option list, and convert to explicit OPTION_FOO=n
-+ # this is a comment line for an unset boolean option, change CONFIG_
-+ # to OPTION_, remove this option from option list, and convert to
-+ # explicit OPTION_FOO=n
- $opt = $1;
- yank($opt);
- s/CONFIG_/OPTION_/g;
-@@ -46,9 +47,12 @@
- }
- }
-
--# any options left in @options, are options that were not mentioned in
-+# any boolean options left in @options, are options that were not mentioned in
- # the config file, and implicitly that means the option must be set =n,
- # so do that here.
- foreach $opt (@option) {
-- print "OPTION_$opt=n\n";
-+ if ($opt =~ /=\s*[yn]/) {
-+ $opt =~ s/=\s*[yn]/=n/;
-+ print "OPTION_$opt\n";
-+ }
- }
-Index: libc/scripts/option-groups.awk
-===================================================================
---- libc.orig/scripts/option-groups.awk 2012-01-04 22:06:00.000000000 -0800
-+++ libc/scripts/option-groups.awk 2012-05-09 19:35:28.610682107 -0700
-@@ -46,9 +46,15 @@
- print "#define __" var " 1"
- else if (vars[var] == "n")
- print "/* #undef __" var " */"
-- # Ignore variables that don't have boolean values.
-- # Ideally, this would be driven by the types given in
-- # option-groups.def.
-+ else if (vars[var] ~ /^[0-9]+/ ||
-+ vars[var] ~ /^0x[0-9aAbBcCdDeEfF]+/ ||
-+ vars[var] ~ /^\"/)
-+ print "#define __" var " " vars[var]
-+ else
-+ print "/* #undef __" var " */"
-+ # Ignore variables that don't have boolean, int, hex, or
-+ # string values. Ideally, this would be driven by the types
-+ # given in option-groups.def.
- }
- }
-
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/0003-eglibc-menuconfig-build-instructions.patch b/meta/recipes-core/eglibc/eglibc-2.19/0003-eglibc-menuconfig-build-instructions.patch
deleted file mode 100644
index d137f5b318..0000000000
--- a/meta/recipes-core/eglibc/eglibc-2.19/0003-eglibc-menuconfig-build-instructions.patch
+++ /dev/null
@@ -1,176 +0,0 @@
-Pulled from
-
-http://www.eglibc.org/archives/patches/msg01035.html
-
-Upstream-Status: Pending
-Signed-off-by: Khem
-
-As part of the menuconfig development, I encountered some outdated information in the cross-build instructions, libc/EGLIBC.cross-building. This patch updates the file with new (and tested) instructions. It is unrelated to the menuconfig support, but applies after.
-
-My testing was done with an ARM target, and an x86_64 Linux host, so I converted the instructions to use those host/target types from the original i686/powerpc. Hope that's ok.
-
-
-Thanks,
-
---
-Steve Longerbeam | Senior Embedded Engineer, ESD Services
-Mentor Embedded(tm) | 46871 Bayside Parkway, Fremont, CA 94538
-P 510.354.5838 | M 408.410.2735
-Nucleus(r) | Linux(r) | Android(tm) | Services | UI | Multi-OS
-
-
- EGLIBC.cross-building | 59 +++++++++++++++++++++++++++++---------------------
- 1 file changed, 35 insertions(+), 24 deletions(-)
-
-Index: libc/EGLIBC.cross-building
-===================================================================
---- libc.orig/EGLIBC.cross-building 2012-05-09 19:33:36.522676681 -0700
-+++ libc/EGLIBC.cross-building 2012-05-09 19:36:13.918684298 -0700
-@@ -47,31 +47,34 @@
- EGLIBC requires recent versions of the GNU binutils, GCC, and the
- Linux kernel. The web page <http://www.eglibc.org/prerequisites>
- documents the current requirements, and lists patches needed for
--certain target architectures. As of this writing, EGLIBC required
--binutils 2.17, GCC 4.1, and Linux 2.6.19.1.
-+certain target architectures. As of this writing, these build
-+instructions have been tested with binutils 2.22.51, GCC 4.6.2,
-+and Linux 3.1.
-
- First, let's set some variables, to simplify later commands. We'll
--build EGLIBC and GCC for a PowerPC target, known to the Linux kernel
--as 'powerpc', and we'll do the build on an Intel Linux box:
-+build EGLIBC and GCC for an ARM target, known to the Linux kernel
-+as 'arm', and we'll do the build on an Intel x86_64 Linux box:
-
-- $ build=i686-pc-linux-gnu
-+ $ build=x86_64-pc-linux-gnu
- $ host=$build
-- $ target=powerpc-none-linux-gnu
-- $ linux_arch=powerpc
-+ $ target=arm-none-linux-gnueabi
-+ $ linux_arch=arm
-
- We're using the aforementioned versions of Binutils, GCC, and Linux:
-
-- $ binutilsv=binutils-2.17
-- $ gccv=gcc-4.1.1
-- $ linuxv=linux-2.6.20
-+ $ binutilsv=binutils-2.22.51
-+ $ gccv=gcc-4.6.2
-+ $ linuxv=linux-3.1
-
- We're carrying out the entire process under '~/cross-build', which
--contains unpacked source trees:
-+contains unpacked source trees for binutils, gcc, and linux kernel,
-+along with EGLIBC svn trunk (which can be checked-out with
-+'svn co http://www.eglibc.org/svn/trunk eglibc'):
-
-- $ top=$HOME/cross-build/ppc
-+ $ top=$HOME/cross-build/$target
- $ src=$HOME/cross-build/src
- $ ls $src
-- binutils-2.17 gcc-4.1.1 libc linux-2.6.20
-+ binutils-2.22.51 eglibc gcc-4.6.2 linux-3.1
-
- We're going to place our build directories in a subdirectory 'obj',
- we'll install the cross-development toolchain in 'tools', and we'll
-@@ -99,7 +102,7 @@
-
- The First GCC
-
--For our work, we need a cross-compiler targeting a PowerPC Linux
-+For our work, we need a cross-compiler targeting an ARM Linux
- system. However, that configuration includes the shared library
- 'libgcc_s.so', which is compiled against the EGLIBC headers (which we
- haven't installed yet) and linked against 'libc.so' (which we haven't
-@@ -125,7 +128,8 @@
- > --prefix=$tools \
- > --without-headers --with-newlib \
- > --disable-shared --disable-threads --disable-libssp \
-- > --disable-libgomp --disable-libmudflap \
-+ > --disable-libgomp --disable-libmudflap --disable-libquadmath \
-+ > --disable-decimal-float --disable-libffi \
- > --enable-languages=c
- $ PATH=$tools/bin:$PATH make
- $ PATH=$tools/bin:$PATH make install
-@@ -162,12 +166,13 @@
- > CXX=$tools/bin/$target-g++ \
- > AR=$tools/bin/$target-ar \
- > RANLIB=$tools/bin/$target-ranlib \
-- > $src/libc/configure \
-+ > $src/eglibc/libc/configure \
- > --prefix=/usr \
- > --with-headers=$sysroot/usr/include \
- > --build=$build \
- > --host=$target \
-- > --disable-profile --without-gd --without-cvs --enable-add-ons
-+ > --disable-profile --without-gd --without-cvs \
-+ > --enable-add-ons=nptl,libidn,../ports
-
- The option '--prefix=/usr' may look strange, but you should never
- configure EGLIBC with a prefix other than '/usr': in various places,
-@@ -181,6 +186,11 @@
- The '--with-headers' option tells EGLIBC where the Linux headers have
- been installed.
-
-+The '--enable-add-ons=nptl,libidn,../ports' option tells EGLIBC to look
-+for the listed glibc add-ons. Most notably the ports add-on (located
-+just above the libc sources in the EGLIBC svn tree) is required to
-+support ARM targets.
-+
- We can now use the 'install-headers' makefile target to install the
- headers:
-
-@@ -223,6 +233,7 @@
- > --prefix=$tools \
- > --with-sysroot=$sysroot \
- > --disable-libssp --disable-libgomp --disable-libmudflap \
-+ > --disable-libffi --disable-libquadmath \
- > --enable-languages=c
- $ PATH=$tools/bin:$PATH make
- $ PATH=$tools/bin:$PATH make install
-@@ -240,13 +251,14 @@
- > CXX=$tools/bin/$target-g++ \
- > AR=$tools/bin/$target-ar \
- > RANLIB=$tools/bin/$target-ranlib \
-- > $src/libc/configure \
-+ > $src/eglibc/libc/configure \
- > --prefix=/usr \
- > --with-headers=$sysroot/usr/include \
- > --with-kconfig=$obj/linux/scripts/kconfig \
- > --build=$build \
- > --host=$target \
-- > --disable-profile --without-gd --without-cvs --enable-add-ons
-+ > --disable-profile --without-gd --without-cvs \
-+ > --enable-add-ons=nptl,libidn,../ports
-
- Note the additional '--with-kconfig' option. This tells EGLIBC where to
- find the host config tools used by the kernel 'make config' and 'make
-@@ -337,15 +349,15 @@
- ELF Header:
- ...
- Type: EXEC (Executable file)
-- Machine: PowerPC
-+ Machine: ARM
-
- ...
- Program Headers:
- Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
- PHDR 0x000034 0x10000034 0x10000034 0x00100 0x00100 R E 0x4
-- INTERP 0x000134 0x10000134 0x10000134 0x0000d 0x0000d R 0x1
-- [Requesting program interpreter: /lib/ld.so.1]
-- LOAD 0x000000 0x10000000 0x10000000 0x008f0 0x008f0 R E 0x10000
-+ INTERP 0x000134 0x00008134 0x00008134 0x00013 0x00013 R 0x1
-+ [Requesting program interpreter: /lib/ld-linux.so.3]
-+ LOAD 0x000000 0x00008000 0x00008000 0x0042c 0x0042c R E 0x8000
- ...
-
- Looking at the dynamic section of the installed 'libgcc_s.so', we see
-@@ -357,7 +369,6 @@
- Dynamic section at offset 0x1083c contains 24 entries:
- Tag Type Name/Value
- 0x00000001 (NEEDED) Shared library: [libc.so.6]
-- 0x00000001 (NEEDED) Shared library: [ld.so.1]
- 0x0000000e (SONAME) Library soname: [libgcc_s.so.1]
- ...
-
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/GLRO_dl_debug_mask.patch b/meta/recipes-core/eglibc/eglibc-2.19/GLRO_dl_debug_mask.patch
deleted file mode 100644
index 7258c82418..0000000000
--- a/meta/recipes-core/eglibc/eglibc-2.19/GLRO_dl_debug_mask.patch
+++ /dev/null
@@ -1,143 +0,0 @@
-Its controlled by __OPTION_EGLIBC_RTLD_DEBUG
-so we should use GLRO_dl_debug_mask
-
-Singed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Pending
-Index: libc/elf/dl-open.c
-===================================================================
---- libc.orig/elf/dl-open.c 2012-10-25 10:18:12.000000000 -0700
-+++ libc/elf/dl-open.c 2013-01-09 11:49:02.635577870 -0800
-@@ -155,7 +155,7 @@
- ns->_ns_main_searchlist->r_list[new_nlist++] = map;
-
- /* We modify the global scope. Report this. */
-- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0))
-+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_SCOPES, 0))
- _dl_debug_printf ("\nadd %s [%lu] to global scope\n",
- map->l_name, map->l_ns);
- }
-@@ -298,7 +298,7 @@
- LIBC_PROBE (map_complete, 3, args->nsid, r, new);
-
- /* Print scope information. */
-- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0))
-+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_SCOPES, 0))
- _dl_show_scope (new, 0);
-
- /* Only do lazy relocation if `LD_BIND_NOW' is not set. */
-@@ -515,7 +515,7 @@
- }
-
- /* Print scope information. */
-- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0))
-+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_SCOPES, 0))
- _dl_show_scope (imap, from_scope);
- }
-
-Index: libc/ports/sysdeps/mips/dl-lookup.c
-===================================================================
---- libc.orig/ports/sysdeps/mips/dl-lookup.c 2012-08-17 12:39:53.000000000 -0700
-+++ libc/ports/sysdeps/mips/dl-lookup.c 2013-01-09 11:49:02.635577870 -0800
-@@ -111,7 +111,7 @@
- continue;
-
- /* Print some debugging info if wanted. */
-- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SYMBOLS, 0))
-+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_SYMBOLS, 0))
- _dl_debug_printf ("symbol=%s; lookup in file=%s [%lu]\n",
- undef_name,
- map->l_name[0] ? map->l_name : rtld_progname,
-@@ -432,7 +432,7 @@
- hash table. */
- if (__builtin_expect (tab->size, 0))
- {
-- assert (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK);
-+ assert (GLRO_dl_debug_mask & DL_DEBUG_PRELINK);
- __rtld_lock_unlock_recursive (tab->lock);
- goto success;
- }
-@@ -681,7 +681,7 @@
- }
-
- /* Display information if we are debugging. */
-- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
-+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0))
- _dl_debug_printf ("\
- \nfile=%s [%lu]; needed by %s [%lu] (relocation dependency)\n\n",
- map->l_name[0] ? map->l_name : rtld_progname,
-@@ -788,7 +788,7 @@
- {
- if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
- && skip_map == NULL
-- && !(GLRO(dl_debug_mask) & DL_DEBUG_UNUSED))
-+ && !(GLRO_dl_debug_mask & DL_DEBUG_UNUSED))
- {
- /* We could find no value for a strong reference. */
- const char *reference_name = undef_map ? undef_map->l_name : "";
-@@ -861,7 +861,7 @@
- if (__builtin_expect (current_value.m->l_used == 0, 0))
- current_value.m->l_used = 1;
-
-- if (__builtin_expect (GLRO(dl_debug_mask)
-+ if (__builtin_expect (GLRO_dl_debug_mask
- & (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK), 0))
- _dl_debug_bindings (undef_name, undef_map, ref,
- &current_value, version, type_class, protected);
-@@ -926,7 +926,7 @@
- {
- const char *reference_name = undef_map->l_name;
-
-- if (GLRO(dl_debug_mask) & DL_DEBUG_BINDINGS)
-+ if (GLRO_dl_debug_mask & DL_DEBUG_BINDINGS)
- {
- _dl_debug_printf ("binding file %s [%lu] to %s [%lu]: %s symbol `%s'",
- (reference_name[0]
-@@ -942,7 +942,7 @@
- _dl_debug_printf_c ("\n");
- }
- #ifdef SHARED
-- if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
-+ if (GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
- {
- int conflict = 0;
- struct sym_val val = { NULL, NULL };
-Index: libc/elf/rtld.c
-===================================================================
---- libc.orig/elf/rtld.c 2012-10-10 08:35:46.000000000 -0700
-+++ libc/elf/rtld.c 2013-01-09 11:49:02.635577870 -0800
-@@ -2118,7 +2118,7 @@
- GLRO(dl_init_all_dirs) = GL(dl_all_dirs);
-
- /* Print scope information. */
-- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0))
-+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_SCOPES, 0))
- {
- _dl_debug_printf ("\nInitial object scopes\n");
-
-Index: libc/elf/dl-lookup.c
-===================================================================
---- libc.orig/elf/dl-lookup.c 2012-08-17 12:39:53.000000000 -0700
-+++ libc/elf/dl-lookup.c 2013-01-09 11:49:02.635577870 -0800
-@@ -771,7 +771,7 @@
- {
- if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
- && skip_map == NULL
-- && !(GLRO(dl_debug_mask) & DL_DEBUG_UNUSED))
-+ && !(GLRO_dl_debug_mask & DL_DEBUG_UNUSED))
- {
- /* We could find no value for a strong reference. */
- const char *reference_name = undef_map ? undef_map->l_name : "";
-Index: libc/elf/get-dynamic-info.h
-===================================================================
---- libc.orig/elf/get-dynamic-info.h 2012-12-02 13:11:45.000000000 -0800
-+++ libc/elf/get-dynamic-info.h 2013-01-09 12:53:51.015657653 -0800
-@@ -157,7 +157,7 @@
- them. Therefore to avoid breaking existing applications the
- best we can do is add a warning during debugging with the
- intent of notifying the user of the problem. */
-- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0)
-+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0)
- && l->l_flags_1 & ~DT_1_SUPPORTED_MASK)
- _dl_debug_printf ("\nWARNING: Unsupported flag value(s) of 0x%x in DT_FLAGS_1.\n",
- l->l_flags_1 & ~DT_1_SUPPORTED_MASK);
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/eglibc-svn-arm-lowlevellock-include-tls.patch b/meta/recipes-core/eglibc/eglibc-2.19/eglibc-svn-arm-lowlevellock-include-tls.patch
deleted file mode 100644
index 4313aa5197..0000000000
--- a/meta/recipes-core/eglibc/eglibc-2.19/eglibc-svn-arm-lowlevellock-include-tls.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-In file included from ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c:21:
-../nptl/sysdeps/unix/sysv/linux/lowlevellock.c: In function '__lll_lock_wait_private':
-../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: warning: implicit declaration of function 'THREAD_GETMEM'
-../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: 'THREAD_SELF' undeclared (first use in this function)
-../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: (Each undeclared identifier is reported only once
-../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: for each function it appears in.)
-../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: 'header' undeclared (first use in this function)
-make[4]: *** [/var/tmp/portage/sys-libs/glibc-2.7-r1/work/build-default-armv4l-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os] Error 1
-
-Upstream-Status: Pending
-
---- libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h.orig
-+++ libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
-@@ -25,6 +25,7 @@
- #include <atomic.h>
- #include <sysdep.h>
- #include <kernel-features.h>
-+#include <tls.h>
-
- #define FUTEX_WAIT 0
- #define FUTEX_WAKE 1
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/eglibc_fix_findidx_parameters.patch b/meta/recipes-core/eglibc/eglibc-2.19/eglibc_fix_findidx_parameters.patch
deleted file mode 100644
index bbf4605505..0000000000
--- a/meta/recipes-core/eglibc/eglibc-2.19/eglibc_fix_findidx_parameters.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-Upstream-Status: backport
-
-Imported patch from: http://www.eglibc.org/archives/patches/msg01124.html
-
-Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
-2012/05/09
-
-Index: libc/posix/xregex.c
-===================================================================
---- libc.orig/posix/xregex.c
-+++ libc/posix/xregex.c
-@@ -2943,7 +2943,7 @@ PREFIX(regex_compile) (const char *ARG_P
- _NL_CURRENT (LC_COLLATE,
- _NL_COLLATE_INDIRECTWC);
-
-- idx = findidx ((const wint_t**)&cp);
-+ idx = findidx ((const wint_t**)&cp, -1);
- if (idx == 0 || cp < (wint_t*) str + c1)
- /* This is no valid character. */
- FREE_STACK_RETURN (REG_ECOLLATE);
-@@ -3392,7 +3392,7 @@ PREFIX(regex_compile) (const char *ARG_P
- indirect = (const int32_t *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
-
-- idx = findidx (&cp);
-+ idx = findidx (&cp, -1);
- if (idx == 0 || cp < str + c1)
- /* This is no valid character. */
- FREE_STACK_RETURN (REG_ECOLLATE);
-@@ -6363,7 +6363,7 @@ byte_re_match_2_internal (struct re_patt
- }
- str_buf[i] = TRANSLATE(*(d+i));
- str_buf[i+1] = '\0'; /* sentinel */
-- idx2 = findidx ((const wint_t**)&cp);
-+ idx2 = findidx ((const wint_t**)&cp, -1);
- }
-
- /* Update d, however d will be incremented at
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/fileops-without-wchar-io.patch b/meta/recipes-core/eglibc/eglibc-2.19/fileops-without-wchar-io.patch
deleted file mode 100644
index 2ca0bca248..0000000000
--- a/meta/recipes-core/eglibc/eglibc-2.19/fileops-without-wchar-io.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-Fix error like
-
-/home/kraj/work/angstrom/sources/openembedded-core/build/tmp-eglibc/work/mips64-oe-linux/eglibc-2.16-r2+svnr19383/build-mips64-oe-linux/libc_pic.os: In function `_IO_new_file_fopen':
-/home/kraj/work/angstrom/sources/openembedded-core/build/tmp-eglibc/work/mips64-oe-linux/eglibc-2.16-r2+svnr19383/eglibc-2_16/libc/libio/fileops.c:431: undefined reference to `_IO_file_close_it_internal'
-collect2: error: ld returned 1 exit status
-
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
-Index: libc/libio/fileops.c
-===================================================================
---- libc.orig/libio/fileops.c 2012-07-04 18:25:47.000000000 -0700
-+++ libc/libio/fileops.c 2012-07-24 00:21:17.220322557 -0700
-@@ -428,7 +428,7 @@
- result->_mode = 1;
- #else
- /* Treat this as if we couldn't find the given character set. */
-- (void) INTUSE(_IO_file_close_it) (fp);
-+ (void) _IO_file_close_it (fp);
- __set_errno (EINVAL);
- return NULL;
- #endif
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/fsl-ppc-no-fsqrt.patch b/meta/recipes-core/eglibc/eglibc-2.19/fsl-ppc-no-fsqrt.patch
deleted file mode 100644
index 511ee9d19e..0000000000
--- a/meta/recipes-core/eglibc/eglibc-2.19/fsl-ppc-no-fsqrt.patch
+++ /dev/null
@@ -1,100 +0,0 @@
-Create e5500 specific math_private.h and let it include when compiling for e5500/64bit core
-We prefefine __CPU_HAS_FSQRT to 0 and then in general ppc64 math_private.h we check if its
-already defined before redefining it. This way we can ensure that on e5500 builds it wont
-emit fsqrt intructions
-
--Khem
-
-Upstream-Status: Pending
-
-Index: libc/sysdeps/powerpc/fpu/math_private.h
-===================================================================
---- libc.orig/sysdeps/powerpc/fpu/math_private.h
-+++ libc/sysdeps/powerpc/fpu/math_private.h
-@@ -25,10 +25,12 @@
- #include <dl-procinfo.h>
- #include_next <math_private.h>
-
--# if __WORDSIZE == 64 || defined _ARCH_PWR4
--# define __CPU_HAS_FSQRT 1
--# else
--# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
-+# ifndef __CPU_HAS_FSQRT
-+# if __WORDSIZE == 64 || defined _ARCH_PWR4
-+# define __CPU_HAS_FSQRT 1
-+# else
-+# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
-+# endif
- # endif
-
- extern double __slow_ieee754_sqrt (double);
-Index: libc/ports/sysdeps/powerpc/powerpc64/e5500/fpu/math_private.h
-===================================================================
---- /dev/null
-+++ libc/ports/sysdeps/powerpc/powerpc64/e5500/fpu/math_private.h
-@@ -0,0 +1,9 @@
-+#ifndef _E5500_MATH_PRIVATE_H_
-+#define _E5500_MATH_PRIVATE_H_ 1
-+/* E5500 core FPU does not implement
-+ fsqrt */
-+
-+#define __CPU_HAS_FSQRT 0
-+#include_next <math_private.h>
-+
-+#endif /* _E5500_MATH_PRIVATE_H_ */
-Index: libc/ports/sysdeps/powerpc/powerpc64/e6500/fpu/math_private.h
-===================================================================
---- /dev/null
-+++ libc/ports/sysdeps/powerpc/powerpc64/e6500/fpu/math_private.h
-@@ -0,0 +1,9 @@
-+#ifndef _E6500_MATH_PRIVATE_H_
-+#define _E6500_MATH_PRIVATE_H_ 1
-+/* E6500 core FPU does not implement
-+ fsqrt */
-+
-+#define __CPU_HAS_FSQRT 0
-+#include_next <math_private.h>
-+
-+#endif /* _E6500_MATH_PRIVATE_H_ */
-Index: libc/ports/sysdeps/powerpc/powerpc32/e500mc/fpu/math_private.h
-===================================================================
---- /dev/null
-+++ libc/ports/sysdeps/powerpc/powerpc32/e500mc/fpu/math_private.h
-@@ -0,0 +1,9 @@
-+#ifndef _E500MC_MATH_PRIVATE_H_
-+#define _E500MC_MATH_PRIVATE_H_ 1
-+/* E500MC core FPU does not implement
-+ fsqrt */
-+
-+#define __CPU_HAS_FSQRT 0
-+#include_next <math_private.h>
-+
-+#endif /* _E500MC_MATH_PRIVATE_H_ */
-Index: libc/ports/sysdeps/powerpc/powerpc32/e5500/fpu/math_private.h
-===================================================================
---- /dev/null
-+++ libc/ports/sysdeps/powerpc/powerpc32/e5500/fpu/math_private.h
-@@ -0,0 +1,9 @@
-+#ifndef _E5500_MATH_PRIVATE_H_
-+#define _E5500_MATH_PRIVATE_H_ 1
-+/* E5500 core FPU does not implement
-+ fsqrt */
-+
-+#define __CPU_HAS_FSQRT 0
-+#include_next <math_private.h>
-+
-+#endif /* _E5500_MATH_PRIVATE_H_ */
-Index: libc/ports/sysdeps/powerpc/powerpc32/e6500/fpu/math_private.h
-===================================================================
---- /dev/null
-+++ libc/ports/sysdeps/powerpc/powerpc32/e6500/fpu/math_private.h
-@@ -0,0 +1,9 @@
-+#ifndef _E6500_MATH_PRIVATE_H_
-+#define _E6500_MATH_PRIVATE_H_ 1
-+/* E6500 core FPU does not implement
-+ fsqrt */
-+
-+#define __CPU_HAS_FSQRT 0
-+#include_next <math_private.h>
-+
-+#endif /* _E6500_MATH_PRIVATE_H_ */
diff --git a/meta/recipes-core/eglibc/eglibc-collateral.inc b/meta/recipes-core/eglibc/eglibc-collateral.inc
deleted file mode 100644
index 8feca09f2e..0000000000
--- a/meta/recipes-core/eglibc/eglibc-collateral.inc
+++ /dev/null
@@ -1,12 +0,0 @@
-INHIBIT_DEFAULT_DEPS = "1"
-LICENSE = "GPLv2 & LGPLv2.1"
-HOMEPAGE = "http://www.eglibc.org/"
-
-do_fetch[noexec] = "1"
-do_unpack[noexec] = "1"
-do_patch[noexec] = "1"
-do_configure[noexec] = "1"
-do_compile[noexec] = "1"
-
-do_install[depends] += "virtual/${MLPREFIX}libc:do_populate_sysroot"
-
diff --git a/meta/recipes-core/eglibc/eglibc-common.inc b/meta/recipes-core/eglibc/eglibc-common.inc
deleted file mode 100644
index d18786ab93..0000000000
--- a/meta/recipes-core/eglibc/eglibc-common.inc
+++ /dev/null
@@ -1,9 +0,0 @@
-SUMMARY = "Embedded GLIBC (GNU C Library)"
-DESCRIPTION = "Embedded GLIBC (EGLIBC) is a variant of the GNU C Library (GLIBC) that is designed to work well on embedded systems. EGLIBC strives to be source and binary compatible with GLIBC. EGLIBC's goals include reduced footprint, configurable components, better support for cross-compilation and cross-testing."
-HOMEPAGE = "http://www.eglibc.org/home"
-SECTION = "libs"
-LICENSE = "GPLv2 & LGPLv2.1"
-LIC_FILES_CHKSUM ?= "file://LICENSES;md5=07a394b26e0902b9ffdec03765209770 \
- file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \
- file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
- file://COPYING.LIB;md5=bbb461211a33b134d42ed5ee802b37ff "
diff --git a/meta/recipes-core/eglibc/eglibc-initial_2.19.bb b/meta/recipes-core/eglibc/eglibc-initial_2.19.bb
deleted file mode 100644
index de45079603..0000000000
--- a/meta/recipes-core/eglibc/eglibc-initial_2.19.bb
+++ /dev/null
@@ -1,11 +0,0 @@
-require eglibc_${PV}.bb
-require eglibc-initial.inc
-
-DEPENDS += "kconfig-frontends-native"
-
-# main eglibc recipes muck with TARGET_CPPFLAGS to point into
-# final target sysroot but we
-# are not there when building eglibc-initial
-# so reset it here
-
-TARGET_CPPFLAGS = ""
diff --git a/meta/recipes-core/eglibc/eglibc-locale_2.19.bb b/meta/recipes-core/eglibc/eglibc-locale_2.19.bb
deleted file mode 100644
index ce6c1d2320..0000000000
--- a/meta/recipes-core/eglibc/eglibc-locale_2.19.bb
+++ /dev/null
@@ -1 +0,0 @@
-require eglibc-locale.inc
diff --git a/meta/recipes-core/eglibc/eglibc-mtrace.inc b/meta/recipes-core/eglibc/eglibc-mtrace.inc
deleted file mode 100644
index d68783e439..0000000000
--- a/meta/recipes-core/eglibc/eglibc-mtrace.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-include eglibc-collateral.inc
-
-SUMMARY = "mtrace utility provided by eglibc"
-DESCRIPTION = "mtrace utility provided by eglibc"
-RDEPENDS_${PN} = "perl"
-RPROVIDES_${PN} = "libc-mtrace"
-
-SRC = "${STAGING_INCDIR}/eglibc-scripts-internal-${MULTIMACH_TARGET_SYS}"
-
-do_install() {
- install -d -m 0755 ${D}${bindir}
- install -m 0755 ${SRC}/mtrace ${D}${bindir}/
-}
diff --git a/meta/recipes-core/eglibc/eglibc-mtrace_2.19.bb b/meta/recipes-core/eglibc/eglibc-mtrace_2.19.bb
deleted file mode 100644
index 6fa2be9cc9..0000000000
--- a/meta/recipes-core/eglibc/eglibc-mtrace_2.19.bb
+++ /dev/null
@@ -1 +0,0 @@
-require eglibc-mtrace.inc
diff --git a/meta/recipes-core/eglibc/eglibc-scripts.inc b/meta/recipes-core/eglibc/eglibc-scripts.inc
deleted file mode 100644
index 9ca6673404..0000000000
--- a/meta/recipes-core/eglibc/eglibc-scripts.inc
+++ /dev/null
@@ -1,16 +0,0 @@
-include eglibc-collateral.inc
-
-SUMMARY = "utility scripts provided by eglibc"
-DESCRIPTION = "utility scripts provided by eglibc"
-RDEPENDS_${PN} = "bash eglibc-mtrace"
-
-SRC = "${STAGING_INCDIR}/eglibc-scripts-internal-${MULTIMACH_TARGET_SYS}"
-
-bashscripts = "sotruss xtrace"
-
-do_install() {
- install -d -m 0755 ${D}${bindir}
- for i in ${bashscripts}; do
- install -m 0755 ${SRC}/$i ${D}${bindir}/
- done
-}
diff --git a/meta/recipes-core/eglibc/eglibc-scripts_2.19.bb b/meta/recipes-core/eglibc/eglibc-scripts_2.19.bb
deleted file mode 100644
index 31133621d1..0000000000
--- a/meta/recipes-core/eglibc/eglibc-scripts_2.19.bb
+++ /dev/null
@@ -1 +0,0 @@
-require eglibc-scripts.inc
diff --git a/meta/recipes-core/feed-config/poky-feed-config-opkg_1.0.bb b/meta/recipes-core/feed-config/poky-feed-config-opkg_1.0.bb
deleted file mode 100644
index fb312f8151..0000000000
--- a/meta/recipes-core/feed-config/poky-feed-config-opkg_1.0.bb
+++ /dev/null
@@ -1,44 +0,0 @@
-SUMMARY = "Poky example feed configuration"
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
-PR = "r2"
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-INHIBIT_DEFAULT_DEPS = "1"
-
-#FEEDNAMEPREFIX ?= "INVALID"
-#FEEDURIPREFIX ?= "INVALID"
-
-do_compile() {
- mkdir -p ${S}/${sysconfdir}/opkg/
-
- archconf=${S}/${sysconfdir}/opkg/arch.conf
-
- rm -f $archconf
- ipkgarchs="${ALL_MULTILIB_PACKAGE_ARCHS}"
- priority=1
- for arch in $ipkgarchs; do
- echo "arch $arch $priority" >> $archconf
- priority=$(expr $priority + 5)
- done
-
- basefeedconf=${S}/${sysconfdir}/opkg/base-feeds.conf
-
- rm -f $basefeedconf
- touch $basefeedconf
-
- #for arch in $ipkgarchs; do
- # echo "src/gz ${FEEDNAMEPREFIX}-$arch http://pokylinux.org/${FEEDURIPREFIX}$arch" >> $basefeedconf
- #done
-}
-
-
-do_install () {
- install -d ${D}${sysconfdir}/opkg
- install -m 0644 ${S}/${sysconfdir}/opkg/* ${D}${sysconfdir}/opkg/
-}
-
-FILES_${PN} = "${sysconfdir}/opkg/ "
-
-CONFFILES_${PN} += "${sysconfdir}/opkg/base-feeds.conf \
- ${sysconfdir}/opkg/arch.conf"
-
diff --git a/meta/recipes-core/gettext/gettext-0.18.3.2/parallel.patch b/meta/recipes-core/gettext/gettext-0.19.4/parallel.patch
index f2c567d188..c8e2c94af0 100644
--- a/meta/recipes-core/gettext/gettext-0.18.3.2/parallel.patch
+++ b/meta/recipes-core/gettext/gettext-0.19.4/parallel.patch
@@ -21,16 +21,3 @@ Signed-off-by: Joe Slater <jslater@windriver.com>
# Which classes to export from the shared library.
MOOPPFLAGS += --dllexport=styled_ostream
---- a/gettext-tools/src/Makefile.am
-+++ b/gettext-tools/src/Makefile.am
-@@ -229,8 +229,8 @@ libgettextsrc_la_LDFLAGS += -Wl,--export
- endif
-
- # No need to install libgettextsrc.a, except on AIX.
--install-exec-local: install-libLTLIBRARIES install-exec-clean
--install-exec-clean:
-+install-exec-local: install-exec-clean
-+install-exec-clean: install-libLTLIBRARIES
- case "@host_os@" in \
- aix*) ;; \
- *) $(RM) $(DESTDIR)$(libdir)/libgettextsrc.a ;; \
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/Makevars.template b/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/Makevars.template
deleted file mode 100644
index 4a9ff7d231..0000000000
--- a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/Makevars.template
+++ /dev/null
@@ -1,53 +0,0 @@
-# Makefile variables for PO directory in any package using GNU gettext.
-
-# Usually the message domain is the same as the package name.
-DOMAIN = $(PACKAGE)
-
-# These two variables depend on the location of this directory.
-subdir = po
-top_builddir = ..
-
-# These options get passed to xgettext.
-XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
-
-# This is the copyright holder that gets inserted into the header of the
-# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
-# package. (Note that the msgstr strings, extracted from the package's
-# sources, belong to the copyright holder of the package.) Translators are
-# expected to transfer the copyright for their translations to this person
-# or entity, or to disclaim their copyright. The empty string stands for
-# the public domain; in this case the translators are expected to disclaim
-# their copyright.
-COPYRIGHT_HOLDER = Free Software Foundation, Inc.
-
-# This is the email address or URL to which the translators shall report
-# bugs in the untranslated strings:
-# - Strings which are not entire sentences, see the maintainer guidelines
-# in the GNU gettext documentation, section 'Preparing Strings'.
-# - Strings which use unclear terms or require additional context to be
-# understood.
-# - Strings which make invalid assumptions about notation of date, time or
-# money.
-# - Pluralisation problems.
-# - Incorrect English spelling.
-# - Incorrect formatting.
-# It can be your email address, or a mailing list address where translators
-# can write to without being subscribed, or the URL of a web page through
-# which the translators can contact you.
-MSGID_BUGS_ADDRESS =
-
-# This is the list of locale categories, beyond LC_MESSAGES, for which the
-# message catalogs shall be used. It is usually empty.
-EXTRA_LOCALE_CATEGORIES =
-
-# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
-# context. Possible values are "yes" and "no". Set this to yes if the
-# package uses functions taking also a message context, like pgettext(), or
-# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
-USE_MSGCTXT = no
-
-# These options get passed to msgmerge.
-# Useful options are in particular:
-# --previous to keep previous msgids of translated messages,
-# --quiet to reduce the verbosity.
-MSGMERGE_OPTIONS =
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/aclocal.tgz b/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/aclocal.tgz
deleted file mode 100644
index e0335a3d1c..0000000000
--- a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/aclocal.tgz
+++ /dev/null
Binary files differ
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/iconv-m4-remove-the-test-to-convert-euc-jp.patch b/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/iconv-m4-remove-the-test-to-convert-euc-jp.patch
deleted file mode 100644
index d453a74b51..0000000000
--- a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/iconv-m4-remove-the-test-to-convert-euc-jp.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 0bfade685783ccd193b2e1b94d0e4ef5ce449432 Mon Sep 17 00:00:00 2001
-From: Jackie Huang <jackie.huang@windriver.com>
-Date: Wed, 20 Nov 2013 17:52:50 +0800
-Subject: [PATCH] remove the test to convert euc-jp
-
-Remove the test "Test against HP-UX 11.11 bug:
-No converter from EUC-JP to UTF-8 is provided"
-since we don't support HP-UX and it causes
-guile-native compile failure if the euc-jp is not
-installed on the host
-
-Upstream-Status: Inappropriate [OE specific]
-
-Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
----
- iconv.m4 | 11 -----------
- 1 file changed, 11 deletions(-)
-
-diff --git a/iconv.m4 b/iconv.m4
-index a503646..dbe7ca1 100644
---- a/iconv.m4
-+++ b/iconv.m4
-@@ -159,17 +159,6 @@ int main ()
- }
- }
- #endif
-- /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
-- provided. */
-- if (/* Try standardized names. */
-- iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
-- /* Try IRIX, OSF/1 names. */
-- && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
-- /* Try AIX names. */
-- && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
-- /* Try HP-UX names. */
-- && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
-- result |= 16;
- return result;
- }]])],
- [am_cv_func_iconv_works=yes],
---
-1.8.3
-
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/COPYING b/meta/recipes-core/gettext/gettext-minimal-0.19.4/COPYING
index 3485c5a2cb..8d11d1d8e9 100644
--- a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/COPYING
+++ b/meta/recipes-core/gettext/gettext-minimal-0.19.4/COPYING
@@ -1,4 +1,4 @@
-dnl Copyright (C) 1997-2010 Free Software Foundation, Inc.
+dnl Copyright (C) 1995-2014 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/Makefile.in.in b/meta/recipes-core/gettext/gettext-minimal-0.19.4/Makefile.in.in
index fabdc76c9c..65184f65c7 100644
--- a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/Makefile.in.in
+++ b/meta/recipes-core/gettext/gettext-minimal-0.19.4/Makefile.in.in
@@ -8,8 +8,8 @@
# Please note that the actual code of GNU gettext is covered by the GNU
# General Public License and is *not* in the public domain.
#
-# Origin: gettext-0.18.3
-GETTEXT_MACRO_VERSION = 0.18
+# Origin: gettext-0.19
+GETTEXT_MACRO_VERSION = 0.19
PACKAGE = @PACKAGE@
VERSION = @VERSION@
@@ -77,6 +77,16 @@ POTFILES = \
CATALOGS = @CATALOGS@
+POFILESDEPS_ = $(srcdir)/$(DOMAIN).pot
+POFILESDEPS_yes = $(POFILESDEPS_)
+POFILESDEPS_no =
+POFILESDEPS = $(POFILESDEPS_$(PO_DEPENDS_ON_POT))
+
+DISTFILESDEPS_ = update-po
+DISTFILESDEPS_yes = $(DISTFILESDEPS_)
+DISTFILESDEPS_no =
+DISTFILESDEPS = $(DISTFILESDEPS_$(DIST_DEPENDS_ON_UPDATE_PO))
+
# Makevars gets inserted here. (Don't remove this line!)
.SUFFIXES:
@@ -143,15 +153,25 @@ stamp-po: $(srcdir)/$(DOMAIN).pot
# heuristic whether some file in the top level directory mentions "GNU xyz".
# If GNU 'find' is available, we avoid grepping through monster files.
$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
- if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \
- LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f -size -10000000c -exec grep 'GNU @PACKAGE@' /dev/null '{}' ';' 2>/dev/null; \
- else \
- LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \
- fi; \
- } | grep -v 'libtool:' >/dev/null; then \
- package_gnu='GNU '; \
+ package_gnu="$(PACKAGE_GNU)"; \
+ test -n "$$package_gnu" || { \
+ if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \
+ LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f \
+ -size -10000000c -exec grep 'GNU @PACKAGE@' \
+ /dev/null '{}' ';' 2>/dev/null; \
+ else \
+ LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \
+ fi; \
+ } | grep -v 'libtool:' >/dev/null; then \
+ package_gnu=yes; \
+ else \
+ package_gnu=no; \
+ fi; \
+ }; \
+ if test "$$package_gnu" = "yes"; then \
+ package_prefix='GNU '; \
else \
- package_gnu=''; \
+ package_prefix=''; \
fi; \
if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
@@ -171,7 +191,7 @@ $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
--add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
--files-from=$(srcdir)/POTFILES.in \
--copyright-holder='$(COPYRIGHT_HOLDER)' \
- --package-name="$${package_gnu}@PACKAGE@" \
+ --package-name="$${package_prefix}@PACKAGE@" \
--package-version='@VERSION@' \
--msgid-bugs-address="$$msgid_bugs_address" \
;; \
@@ -199,9 +219,10 @@ $(srcdir)/$(DOMAIN).pot:
# This target rebuilds a PO file if $(DOMAIN).pot has changed.
# Note that a PO file is not touched if it doesn't need to be changed.
-$(POFILES): $(srcdir)/$(DOMAIN).pot
+$(POFILES): $(POFILESDEPS)
@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
if test -f "$(srcdir)/$${lang}.po"; then \
+ test -f $(srcdir)/$(DOMAIN).pot || $(MAKE) $(srcdir)/$(DOMAIN).pot; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
cd $(srcdir) \
@@ -362,7 +383,7 @@ maintainer-clean: distclean
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
dist distdir:
- $(MAKE) update-po
+ test -z "$(DISTFILESDEPS)" || $(MAKE) $(DISTFILESDEPS)
@$(MAKE) dist2
# This is a separate target because 'update-po' must be executed before.
dist2: stamp-po $(DISTFILES)
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.19.4/aclocal.tgz b/meta/recipes-core/gettext/gettext-minimal-0.19.4/aclocal.tgz
new file mode 100644
index 0000000000..b04ba55032
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-0.19.4/aclocal.tgz
Binary files differ
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/config.rpath b/meta/recipes-core/gettext/gettext-minimal-0.19.4/config.rpath
index c38b914d6b..b625621fac 100755
--- a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/config.rpath
+++ b/meta/recipes-core/gettext/gettext-minimal-0.19.4/config.rpath
@@ -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-2013 Free Software Foundation, Inc.
+# Copyright 1996-2014 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
@@ -367,11 +367,7 @@ else
dgux*)
hardcode_libdir_flag_spec='-L$libdir'
;;
- freebsd2.2*)
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- ;;
- freebsd2*)
+ freebsd2.[01]*)
hardcode_direct=yes
hardcode_minus_L=yes
;;
@@ -548,13 +544,11 @@ case "$host_os" in
dgux*)
library_names_spec='$libname$shrext'
;;
+ freebsd[23].*)
+ library_names_spec='$libname$shrext$versuffix'
+ ;;
freebsd* | dragonfly*)
- case "$host_os" in
- freebsd[123]*)
- library_names_spec='$libname$shrext$versuffix' ;;
- *)
- library_names_spec='$libname$shrext' ;;
- esac
+ library_names_spec='$libname$shrext'
;;
gnu*)
library_names_spec='$libname$shrext'
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/remove-potcdate.sin b/meta/recipes-core/gettext/gettext-minimal-0.19.4/remove-potcdate.sin
index 2436c49e78..2436c49e78 100644
--- a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/remove-potcdate.sin
+++ b/meta/recipes-core/gettext/gettext-minimal-0.19.4/remove-potcdate.sin
diff --git a/meta/recipes-core/gettext/gettext-minimal-native_0.18.3.2.bb b/meta/recipes-core/gettext/gettext-minimal-native_0.19.4.bb
index 2b43b97022..ca97315a85 100644
--- a/meta/recipes-core/gettext/gettext-minimal-native_0.18.3.2.bb
+++ b/meta/recipes-core/gettext/gettext-minimal-native_0.19.4.bb
@@ -8,14 +8,13 @@ SRC_URI = "file://aclocal.tgz \
file://Makefile.in.in \
file://remove-potcdate.sin \
file://COPYING \
- file://iconv-m4-remove-the-test-to-convert-euc-jp.patch \
"
INHIBIT_DEFAULT_DEPS = "1"
INHIBIT_AUTOTOOLS_DEPS = "1"
LICENSE = "FSF-Unlimited"
-LIC_FILES_CHKSUM = "file://COPYING;md5=0854da868a929923087141d9d7aba7d5"
+LIC_FILES_CHKSUM = "file://COPYING;md5=1b20675cd5158442f6007d022f46b35b"
inherit native
diff --git a/meta/recipes-core/gettext/gettext_0.18.3.2.bb b/meta/recipes-core/gettext/gettext_0.19.4.bb
index 65d4103a97..cebf6c78c6 100644
--- a/meta/recipes-core/gettext/gettext_0.18.3.2.bb
+++ b/meta/recipes-core/gettext/gettext_0.19.4.bb
@@ -18,8 +18,8 @@ PACKAGECONFIG[msgcat-curses] = "--with-libncurses-prefix=${STAGING_LIBDIR}/..,--
LDFLAGS_prepend_libc-uclibc = " -lrt -lpthread "
-SRC_URI[md5sum] = "241aba309d07aa428252c74b40a818ef"
-SRC_URI[sha256sum] = "d1a4e452d60eb407ab0305976529a45c18124bd518d976971ac6dc7aa8b4c5d7"
+SRC_URI[md5sum] = "d3511af1e604a3478900d2c2b4a4a48e"
+SRC_URI[sha256sum] = "8ac9f1ed1a5f8c4e656a2f37f5ba6b9ee04c4df79a575e876b0b6946aa417f3f"
inherit autotools texinfo
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/allow-run-media-sdX-drive-mount-if-username-root.patch b/meta/recipes-core/glib-2.0/glib-2.0/allow-run-media-sdX-drive-mount-if-username-root.patch
new file mode 100644
index 0000000000..3d0c008bbe
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/allow-run-media-sdX-drive-mount-if-username-root.patch
@@ -0,0 +1,39 @@
+From c53e94a520b573aa0dcf12903e9563fe8badc34c Mon Sep 17 00:00:00 2001
+From: Marius Avram <marius.avram@intel.com>
+Date: Wed, 27 Aug 2014 12:10:41 +0300
+Subject: [PATCH] Allow /run/media/sdX drive mount if username root
+
+In case that the username logged in the system is root
+the drives are directly mounted in /run/media/sdX and
+not /run/media/<username>/sdX as the function
+g_unix_mount_guess_should_display() expects.
+
+Without this change USB stick mounts are not accesible from
+graphical applications such as the File Manager (pcmanfm).
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Marius Avram <marius.avram@intel.com>
+---
+ gio/gunixmounts.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c
+index 4999354..f6c1472 100644
+--- a/gio/gunixmounts.c
++++ b/gio/gunixmounts.c
+@@ -2136,6 +2136,11 @@ g_unix_mount_guess_should_display (GUnixMountEntry *mount_entry)
+ mount_path[sizeof ("/run/media/") - 1 + user_name_len] == '/')
+ is_in_runtime_dir = TRUE;
+
++ /* Allow no username in path in /run/media if current user is root */
++ if (strcmp(user_name, "root") == 0 &&
++ strncmp (mount_path, "/run/media/", sizeof("run/media")) == 0)
++ is_in_runtime_dir = TRUE;
++
+ if (is_in_runtime_dir || g_str_has_prefix (mount_path, "/media/"))
+ {
+ char *path;
+--
+1.7.9.5
+
diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.40.0.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.42.1.bb
index ff1fb87a38..69b3ef8e37 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0_2.40.0.bb
+++ b/meta/recipes-core/glib-2.0/glib-2.0_2.42.1.bb
@@ -13,9 +13,10 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
file://ptest-paths.patch \
file://uclibc.patch \
file://0001-configure.ac-Do-not-use-readlink-when-cross-compilin.patch \
+ file://allow-run-media-sdX-drive-mount-if-username-root.patch \
"
SRC_URI_append_class-native = " file://glib-gettextize-dir.patch"
-SRC_URI[md5sum] = "05fb7cb17eacbc718e90366a1eae60d9"
-SRC_URI[sha256sum] = "0d27f195966ecb1995dcce0754129fd66ebe820c7cd29200d264b02af1aa28b5"
+SRC_URI[md5sum] = "89c4119e50e767d3532158605ee9121a"
+SRC_URI[sha256sum] = "8f3f0865280e45b8ce840e176ef83bcfd511148918cc8d39df2ee89b67dcf89a"
diff --git a/meta/recipes-core/glib-2.0/glib.inc b/meta/recipes-core/glib-2.0/glib.inc
index e2b130b6b5..072f790111 100644
--- a/meta/recipes-core/glib-2.0/glib.inc
+++ b/meta/recipes-core/glib-2.0/glib.inc
@@ -1,5 +1,7 @@
SUMMARY = "A general-purpose utility library"
DESCRIPTION = "GLib is a general-purpose utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a main loop abstraction, and so on."
+HOMEPAGE = "https://developer.gnome.org/glib/"
+
# pcre is under BSD;
# docs/reference/COPYING is with a 'public domai'-like license!
LICENSE = "LGPLv2+ & BSD & PD"
@@ -18,21 +20,23 @@ BBCLASSEXTEND = "native nativesdk"
DEPENDS = "glib-2.0-native virtual/libiconv libffi zlib"
DEPENDS_append_class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', ' dbus', '', d)}"
DEPENDS_class-native = "pkgconfig-native gettext-native libffi-native zlib-native"
-DEPENDS_class-nativesdk = "nativesdk-libtool nativesdk-libffi nativesdk-zlib ${BPN}-native"
+DEPENDS_class-nativesdk = "nativesdk-libtool nativesdk-gettext nativesdk-libffi nativesdk-zlib ${BPN}-native"
PACKAGES =+ "${PN}-utils ${PN}-bash-completion ${PN}-codegen"
LEAD_SONAME = "libglib-2.0.*"
FILES_${PN}-utils = "${bindir}/* ${datadir}/glib-2.0/gettext"
-inherit autotools gettext gtk-doc pkgconfig ptest
+inherit autotools gettext gtk-doc pkgconfig ptest-gnome
S = "${WORKDIR}/glib-${PV}"
CORECONF = "--disable-dtrace --disable-fam --disable-libelf --disable-systemtap --disable-man"
-PTEST_CONF = "${@bb.utils.contains('PTEST_ENABLED', '1', '--enable-installed-tests', '--disable-installed-tests', d)}"
-EXTRA_OECONF = "--enable-included-printf=no ${CORECONF} ${PTEST_CONF}"
+PRINTF = "--enable-included-printf=no"
+PRINTF_darwin = "--enable-included-printf=yes"
+PRINTF_mingw32 = "--enable-included-printf=yes"
+EXTRA_OECONF = "${PRINTF} ${CORECONF}"
EXTRA_OECONF_class-native = "${CORECONF} --disable-selinux"
EXTRA_OECONF_append_libc-uclibc = " --with-libiconv=gnu"
@@ -51,14 +55,14 @@ FILES_${PN}-dbg += "${datadir}/glib-2.0/gdb ${datadir}/gdb \
FILES_${PN}-codegen = "${datadir}/glib-2.0/codegen/*.py"
FILES_${PN}-bash-completion = "${sysconfdir}/bash_completion.d \
${datadir}/bash-completion"
-FILES_${PN}-ptest += "${libexecdir}/installed-tests \
- ${datadir}/installed-tests/glib"
ARM_INSTRUCTION_SET = "arm"
USE_NLS = "yes"
do_install_append () {
- sed ${D}${bindir}/gtester-report -i -e '1s|^#!.*|#!/usr/bin/env python|'
+ if [ -f ${D}${bindir}/gtester-report ]; then
+ sed ${D}${bindir}/gtester-report -i -e '1s|^#!.*|#!/usr/bin/env python|'
+ fi
# Remove some unpackaged files
rm -f ${D}${datadir}/glib-2.0/codegen/*.pyc
@@ -84,15 +88,17 @@ RDEPENDS_${PN}-ptest += "\
"
RDEPENDS_${PN}-ptest_append_libc-glibc = "\
- eglibc-gconv-utf-16 \
- eglibc-charmap-utf-8 \
- eglibc-gconv-cp1255 \
- eglibc-charmap-cp1255 \
- eglibc-gconv-utf-32 \
- eglibc-gconv-utf-7 \
- eglibc-gconv-euc-jp \
- eglibc-gconv-iso8859-1 \
- eglibc-gconv-iso8859-15 \
- eglibc-charmap-invariant \
- eglibc-localedata-translit-cjk-variants \
+ glibc-gconv-utf-16 \
+ glibc-charmap-utf-8 \
+ glibc-gconv-cp1255 \
+ glibc-charmap-cp1255 \
+ glibc-gconv-utf-32 \
+ glibc-gconv-utf-7 \
+ glibc-gconv-euc-jp \
+ glibc-gconv-iso8859-1 \
+ glibc-gconv-iso8859-15 \
+ glibc-charmap-invariant \
+ glibc-localedata-translit-cjk-variants \
"
+
+INSANE_SKIP_${PN}-ptest += "libdir"
diff --git a/meta/recipes-core/glib-networking/glib-networking_2.38.0.bb b/meta/recipes-core/glib-networking/glib-networking_2.38.0.bb
index a9c1a4129a..b9ba2d6217 100644
--- a/meta/recipes-core/glib-networking/glib-networking_2.38.0.bb
+++ b/meta/recipes-core/glib-networking/glib-networking_2.38.0.bb
@@ -24,7 +24,7 @@ PACKAGECONFIG[pkcs11] = "--with-pkcs11,--without-pkcs11,p11-kit"
EXTRA_OECONF = "--without-gnome-proxy"
-inherit gnomebase
+inherit gnomebase gettext
FILES_${PN} += "${libdir}/gio/modules/libgio*.so ${datadir}/dbus-1/services/"
FILES_${PN}-dbg += "${libdir}/gio/modules/.debug/"
diff --git a/meta/recipes-core/eglibc/cross-localedef-native-2.19/fix_for_centos_5.8.patch b/meta/recipes-core/glibc/cross-localedef-native/fix_for_centos_5.8.patch
index 7618c99534..186a480458 100644
--- a/meta/recipes-core/eglibc/cross-localedef-native-2.19/fix_for_centos_5.8.patch
+++ b/meta/recipes-core/glibc/cross-localedef-native/fix_for_centos_5.8.patch
@@ -3,10 +3,10 @@ Upstream-Status: Inappropriate [other]
This is a hack to fix building the locale bits on an older
CentOs 5.X machine
-Index: eglibc-2_16/libc/locale/programs/config.h
+Index: git/locale/programs/config.h
===================================================================
---- eglibc-2_16.orig/libc/locale/programs/config.h
-+++ eglibc-2_16/libc/locale/programs/config.h
+--- git/locale/programs/config.h
++++ git.orig/locale/programs/config.h
@@ -19,6 +19,8 @@
#ifndef _LD_CONFIG_H
#define _LD_CONFIG_H 1
diff --git a/meta/recipes-core/glibc/cross-localedef-native_2.21.bb b/meta/recipes-core/glibc/cross-localedef-native_2.21.bb
new file mode 100644
index 0000000000..4e15f02140
--- /dev/null
+++ b/meta/recipes-core/glibc/cross-localedef-native_2.21.bb
@@ -0,0 +1,56 @@
+SUMMARY = "Cross locale generation tool for glibc"
+HOMEPAGE = "http://www.gnu.org/software/libc/libc.html"
+SECTION = "libs"
+LICENSE = "LGPL-2.1"
+
+LIC_FILES_CHKSUM = "file://LICENSES;md5=e9a558e243b36d3209f380deb394b213 \
+ file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
+ file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
+ file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c"
+
+
+inherit native
+inherit autotools
+
+FILESEXTRAPATHS =. "${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/glibc:"
+
+BRANCH = "release/${PV}/master"
+
+SRC_URI = "git://sourceware.org/git/glibc.git;branch=${BRANCH};name=glibc \
+ git://github.com/kraj/localedef;branch=master;name=localedef;destsuffix=git/localedef \
+ file://fix_for_centos_5.8.patch \
+ ${EGLIBCPATCHES} \
+ "
+EGLIBCPATCHES = "\
+ file://timezone-re-written-tzselect-as-posix-sh.patch \
+ file://eglibc.patch \
+ file://option-groups.patch \
+ file://GLRO_dl_debug_mask.patch \
+ file://eglibc-header-bootstrap.patch \
+ file://eglibc-resolv-dynamic.patch \
+ file://eglibc-ppc8xx-cache-line-workaround.patch \
+ file://eglibc-sh4-fpscr_values.patch \
+ file://eglibc-use-option-groups.patch \
+ "
+
+SRCREV_glibc = "4e42b5b8f89f0e288e68be7ad70f9525aebc2cff"
+SRCREV_localedef = "c833367348d39dad7ba018990bfdaffaec8e9ed3"
+
+# Makes for a rather long rev (22 characters), but...
+#
+SRCREV_FORMAT = "glibc_localedef"
+
+S = "${WORKDIR}/git"
+
+EXTRA_OECONF = "--with-glibc=${S}"
+CFLAGS += "-fgnu89-inline -std=gnu99 -DIS_IN\(x\)='0'"
+
+do_configure () {
+ ${S}/localedef/configure ${EXTRA_OECONF}
+}
+
+
+do_install() {
+ install -d ${D}${bindir}
+ install -m 0755 ${B}/localedef ${D}${bindir}/cross-localedef
+}
diff --git a/meta/recipes-core/glibc/glibc-collateral.inc b/meta/recipes-core/glibc/glibc-collateral.inc
new file mode 100644
index 0000000000..f82db06cb9
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-collateral.inc
@@ -0,0 +1,19 @@
+INHIBIT_DEFAULT_DEPS = "1"
+LICENSE = "GPLv2 & LGPLv2.1"
+LIC_FILES_CHKSUM ?= "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6 \
+ file://${COMMON_LICENSE_DIR}/LGPL-2.1;md5=1a6d268fd218675ffea8be556788b780"
+HOMEPAGE = "http://www.gnu.org/software/libc/index.html"
+
+# This needs to match with glibc.inc, otherwise glibc-scripts and glibc-locale
+# will fail to find main glibc, for details see
+# http://lists.openembedded.org/pipermail/openembedded-core/2015-January/100679.html
+ARM_INSTRUCTION_SET = "arm"
+
+do_fetch[noexec] = "1"
+do_unpack[noexec] = "1"
+do_patch[noexec] = "1"
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+
+do_install[depends] += "virtual/${MLPREFIX}libc:do_populate_sysroot"
+
diff --git a/meta/recipes-core/glibc/glibc-common.inc b/meta/recipes-core/glibc/glibc-common.inc
new file mode 100644
index 0000000000..bba1568baf
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-common.inc
@@ -0,0 +1,9 @@
+SUMMARY = "GLIBC (GNU C Library)"
+DESCRIPTION = "The GNU C Library is used as the system C library in most systems with the Linux kernel."
+HOMEPAGE = "http://www.gnu.org/software/libc/libc.html"
+SECTION = "libs"
+LICENSE = "GPLv2 & LGPLv2.1"
+LIC_FILES_CHKSUM ?= "file://LICENSES;md5=07a394b26e0902b9ffdec03765209770 \
+ file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \
+ file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
+ file://COPYING.LIB;md5=bbb461211a33b134d42ed5ee802b37ff "
diff --git a/meta/recipes-core/eglibc/eglibc-initial.inc b/meta/recipes-core/glibc/glibc-initial.inc
index 92402f8ff5..7db3deac1b 100644
--- a/meta/recipes-core/eglibc/eglibc-initial.inc
+++ b/meta/recipes-core/glibc/glibc-initial.inc
@@ -11,8 +11,8 @@ TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
do_configure () {
sed -ie 's,{ (exit 1); exit 1; }; },{ (exit 0); }; },g' ${S}/configure
chmod +x ${S}/configure
- (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
- find ${S} -name "configure" | xargs touch
+ (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
+ find ${S} -name "configure" | xargs touch
${S}/configure --host=${TARGET_SYS} --build=${BUILD_SYS} \
--prefix=/usr \
--without-cvs --disable-sanity-checks \
@@ -26,28 +26,28 @@ do_compile () {
}
do_install () {
- oe_runmake cross-compiling=yes install_root=${D} \
- includedir='${includedir}' prefix='${prefix}' \
- install-bootstrap-headers=yes install-headers
+ oe_runmake cross-compiling=yes install_root=${D} \
+ includedir='${includedir}' prefix='${prefix}' \
+ install-bootstrap-headers=yes install-headers
- oe_runmake csu/subdir_lib
- mkdir -p ${D}${libdir}/
- install -m 644 csu/crt[1in].o ${D}${libdir}
+ oe_runmake csu/subdir_lib
+ mkdir -p ${D}${libdir}/
+ install -m 644 csu/crt[1in].o ${D}${libdir}
- # Two headers -- stubs.h and features.h -- aren't installed by install-headers,
- # so do them by hand. We can tolerate an empty stubs.h for the moment.
- # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html
- mkdir -p ${D}${includedir}/gnu/
- touch ${D}${includedir}/gnu/stubs.h
- cp ${S}/include/features.h ${D}${includedir}/features.h
+ # Two headers -- stubs.h and features.h -- aren't installed by install-headers,
+ # so do them by hand. We can tolerate an empty stubs.h for the moment.
+ # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html
+ mkdir -p ${D}${includedir}/gnu/
+ touch ${D}${includedir}/gnu/stubs.h
+ cp ${S}/include/features.h ${D}${includedir}/features.h
- if [ -e ${B}/bits/stdio_lim.h ]; then
- cp ${B}/bits/stdio_lim.h ${D}${includedir}/bits/
- fi
- # add links to linux-libc-headers: final eglibc build need this.
- for t in linux asm asm-generic; do
- ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/
- done
+ 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() {
@@ -58,8 +58,8 @@ do_siteconfig () {
:
}
-SSTATEPOSTINSTFUNCS += "eglibcinitial_sstate_postinst"
-eglibcinitial_sstate_postinst() {
+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
diff --git a/meta/recipes-core/glibc/glibc-initial_2.21.bb b/meta/recipes-core/glibc/glibc-initial_2.21.bb
new file mode 100644
index 0000000000..8ab01dc79d
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-initial_2.21.bb
@@ -0,0 +1,11 @@
+require glibc_${PV}.bb
+require glibc-initial.inc
+
+DEPENDS += "kconfig-frontends-native"
+
+# main glibc recipes muck with TARGET_CPPFLAGS to point into
+# final target sysroot but we
+# are not there when building glibc-initial
+# so reset it here
+
+TARGET_CPPFLAGS = ""
diff --git a/meta/recipes-core/eglibc/eglibc-ld.inc b/meta/recipes-core/glibc/glibc-ld.inc
index 6261ae3419..962d666885 100644
--- a/meta/recipes-core/eglibc/eglibc-ld.inc
+++ b/meta/recipes-core/glibc/glibc-ld.inc
@@ -5,7 +5,7 @@ def ld_append_if_tune_exists(d, infos, dict):
infos['ldconfig'].add('{"' + libdir + '/' + dict[tune][0] + '",' + dict[tune][1] + ' }')
infos['lddrewrite'].add(libdir+'/'+dict[tune][0])
-def eglibc_dl_info(d):
+def glibc_dl_info(d):
ld_info_all = {
"mips": ["ld.so.1", "FLAG_ELF_LIBC6"],
"mips64-n32": ["ld.so.1", "FLAG_ELF_LIBC6"],
@@ -52,5 +52,5 @@ def eglibc_dl_info(d):
infos['lddrewrite'] = ' '.join(infos['lddrewrite'])
return infos
-EGLIBC_KNOWN_INTERPRETER_NAMES = "${@eglibc_dl_info(d)['ldconfig']}"
-RTLDLIST = "${@eglibc_dl_info(d)['lddrewrite']}"
+EGLIBC_KNOWN_INTERPRETER_NAMES = "${@glibc_dl_info(d)['ldconfig']}"
+RTLDLIST = "${@glibc_dl_info(d)['lddrewrite']}"
diff --git a/meta/recipes-core/eglibc/eglibc-locale.inc b/meta/recipes-core/glibc/glibc-locale.inc
index 4da5abd778..df6d073436 100644
--- a/meta/recipes-core/eglibc/eglibc-locale.inc
+++ b/meta/recipes-core/glibc/glibc-locale.inc
@@ -1,12 +1,12 @@
-include eglibc-collateral.inc
+include glibc-collateral.inc
-SUMMARY = "Locale data from eglibc"
+SUMMARY = "Locale data from glibc"
-BPN = "eglibc"
-LOCALEBASEPN = "${MLPREFIX}eglibc"
+BPN = "glibc"
+LOCALEBASEPN = "${MLPREFIX}glibc"
-# eglibc-collateral.inc inhibits all default deps, but do_package needs objcopy
-# ERROR: objcopy failed with exit code 127 (cmd was 'i586-webos-linux-objcopy' --only-keep-debug 'eglibc-locale/2.17-r0/package/usr/lib/gconv/IBM1166.so' 'eglibc-locale/2.17-r0/package/usr/lib/gconv/.debug/IBM1166.so')
+# glibc-collateral.inc inhibits all default deps, but do_package needs objcopy
+# ERROR: objcopy failed with exit code 127 (cmd was 'i586-webos-linux-objcopy' --only-keep-debug 'glibc-locale/2.17-r0/package/usr/lib/gconv/IBM1166.so' 'glibc-locale/2.17-r0/package/usr/lib/gconv/.debug/IBM1166.so')
# ERROR: Function failed: split_and_strip_files
BINUTILSDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}binutils:do_populate_sysroot"
BINUTILSDEP_class-nativesdk = "virtual/${TARGET_PREFIX}binutils-crosssdk:do_populate_sysroot"
@@ -19,11 +19,11 @@ do_package[depends] += "${BINUTILSDEP}"
# default to disabled
ENABLE_BINARY_LOCALE_GENERATION ?= "0"
-ENABLE_BINARY_LOCALE_GENERATION_pn-nativesdk-eglibc-locale = "0"
+ENABLE_BINARY_LOCALE_GENERATION_pn-nativesdk-glibc-locale = "0"
#enable locale generation on these arches
# BINARY_LOCALE_ARCHES is a space separated list of regular expressions
-BINARY_LOCALE_ARCHES ?= "arm.* i[3-6]86 x86_64 powerpc mips mips64"
+BINARY_LOCALE_ARCHES ?= "arm.* aarch64 i[3-6]86 x86_64 powerpc mips mips64"
# set "1" to use cross-localedef for locale generation
# set "0" for qemu emulation of native localedef for locale generation
@@ -34,40 +34,40 @@ PROVIDES = "virtual/libc-locale"
PACKAGES = "localedef ${PN}-dbg"
PACKAGES_DYNAMIC = "^locale-base-.* \
- ^eglibc-gconv-.* ^eglibc-charmap-.* ^eglibc-localedata-.* ^eglibc-binary-localedata-.* \
+ ^glibc-gconv-.* ^glibc-charmap-.* ^glibc-localedata-.* ^glibc-binary-localedata-.* \
^glibc-gconv-.* ^glibc-charmap-.* ^glibc-localedata-.* ^glibc-binary-localedata-.* \
- ^${MLPREFIX}eglibc-gconv$"
+ ^${MLPREFIX}glibc-gconv$"
-# Create a eglibc-binaries package
+# 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("eglibc-binary") != -1])}"
+RRECOMMENDS_${BPN}-binaries = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("glibc-binary") != -1])}"
-# Create a eglibc-charmaps package
+# 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("eglibc-charmap") != -1])}"
+RRECOMMENDS_${BPN}-charmaps = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("glibc-charmap") != -1])}"
-# Create a eglibc-gconvs package
+# 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("eglibc-gconv") != -1])}"
+RRECOMMENDS_${BPN}-gconvs = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("glibc-gconv") != -1])}"
-# Create a eglibc-localedatas package
+# 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("eglibc-localedata") != -1])}"
+RRECOMMENDS_${BPN}-localedatas = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("glibc-localedata") != -1])}"
-DESCRIPTION_localedef = "eglibc: compile locale definition files"
+DESCRIPTION_localedef = "glibc: compile locale definition files"
-# eglibc-gconv is dynamically added into PACKAGES, thus
-# FILES_eglibc-gconv will not be automatically extended in multilib.
-# Explicitly add ${MLPREFIX} for FILES_eglibc-gconv.
-FILES_${MLPREFIX}eglibc-gconv = "${libdir}/gconv/*"
+# glibc-gconv is dynamically added into PACKAGES, thus
+# FILES_glibc-gconv will not be automatically extended in multilib.
+# Explicitly add ${MLPREFIX} for FILES_glibc-gconv.
+FILES_${MLPREFIX}glibc-gconv = "${libdir}/gconv/*"
FILES_${PN}-dbg += "${libdir}/gconv/.debug/*"
FILES_localedef = "${bindir}/localedef"
-LOCALETREESRC = "${STAGING_INCDIR}/eglibc-locale-internal-${MULTIMACH_TARGET_SYS}"
+LOCALETREESRC = "${STAGING_INCDIR}/glibc-locale-internal-${MULTIMACH_TARGET_SYS}"
do_install () {
mkdir -p ${D}${bindir} ${D}${datadir} ${D}${libdir}
diff --git a/meta/recipes-core/glibc/glibc-locale_2.21.bb b/meta/recipes-core/glibc/glibc-locale_2.21.bb
new file mode 100644
index 0000000000..f7702e0358
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-locale_2.21.bb
@@ -0,0 +1 @@
+require glibc-locale.inc
diff --git a/meta/recipes-core/glibc/glibc-mtrace.inc b/meta/recipes-core/glibc/glibc-mtrace.inc
new file mode 100644
index 0000000000..e12b079e06
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-mtrace.inc
@@ -0,0 +1,13 @@
+include 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}"
+
+do_install() {
+ install -d -m 0755 ${D}${bindir}
+ install -m 0755 ${SRC}/mtrace ${D}${bindir}/
+}
diff --git a/meta/recipes-core/glibc/glibc-mtrace_2.21.bb b/meta/recipes-core/glibc/glibc-mtrace_2.21.bb
new file mode 100644
index 0000000000..0b69bad46a
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-mtrace_2.21.bb
@@ -0,0 +1 @@
+require glibc-mtrace.inc
diff --git a/meta/recipes-core/eglibc/eglibc-options.inc b/meta/recipes-core/glibc/glibc-options.inc
index 259e752858..9fd27f32f9 100644
--- a/meta/recipes-core/eglibc/eglibc-options.inc
+++ b/meta/recipes-core/glibc/glibc-options.inc
@@ -1,4 +1,4 @@
-def eglibc_cfg(feature, tokens, cnf):
+def glibc_cfg(feature, tokens, cnf):
if type(tokens) == type(""):
tokens = [tokens]
if feature:
@@ -10,8 +10,8 @@ def eglibc_cfg(feature, tokens, cnf):
cnf.extend(["OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG=\"${S}/nss/nsswitch.conf\""])
cnf.extend(["OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS=\"${S}/nss/fixed-nsswitch.functions\""])
-# Map distro features to eglibc options settings
-def features_to_eglibc_settings(d):
+# Map distro features to glibc options settings
+def features_to_glibc_settings(d):
cnf = ([])
ipv4 = bb.utils.contains('DISTRO_FEATURES', 'ipv4', True, False, d)
@@ -52,7 +52,7 @@ def features_to_eglibc_settings(d):
libc_posix_regexp_glibc = bb.utils.contains('DISTRO_FEATURES', 'libc-posix-regexp-glibc', True, False, d)
libc_posix_wchar_io = bb.utils.contains('DISTRO_FEATURES', 'libc-posix-wchar-io', True, False, d)
- # arrange the dependencies among eglibc configuable options according to file option-groups.def from eglibc source code
+ # arrange the dependencies among glibc configuable options according to file option-groups.def from glibc source code
new_dep = True
while new_dep:
new_dep = False
@@ -121,42 +121,42 @@ def features_to_eglibc_settings(d):
new_dep = True
libc_posix_clang_wchar = True
- eglibc_cfg(ipv6, 'OPTION_EGLIBC_ADVANCED_INET6', cnf)
- eglibc_cfg(libc_backtrace, 'OPTION_EGLIBC_BACKTRACE', cnf)
- eglibc_cfg(libc_big_macros, 'OPTION_EGLIBC_BIG_MACROS', cnf)
- eglibc_cfg(libc_bsd, 'OPTION_EGLIBC_BSD', cnf)
- eglibc_cfg(libc_cxx_tests, 'OPTION_EGLIBC_CXX_TESTS', cnf)
- eglibc_cfg(libc_catgets, 'OPTION_EGLIBC_CATGETS', cnf)
- eglibc_cfg(libc_charsets, 'OPTION_EGLIBC_CHARSETS', cnf)
- eglibc_cfg(libc_crypt, 'OPTION_EGLIBC_CRYPT', cnf)
- eglibc_cfg(libc_crypt_ufc, 'OPTION_EGLIBC_CRYPT_UFC', cnf)
- eglibc_cfg(libc_db_aliases, 'OPTION_EGLIBC_DB_ALIASES', cnf)
- eglibc_cfg(libc_envz, 'OPTION_EGLIBC_ENVZ', cnf)
- eglibc_cfg(libc_fcvt, 'OPTION_EGLIBC_FCVT', cnf)
- eglibc_cfg(libc_fmtmsg, 'OPTION_EGLIBC_FMTMSG', cnf)
- eglibc_cfg(libc_fstab, 'OPTION_EGLIBC_FSTAB', cnf)
- eglibc_cfg(libc_ftraverse, 'OPTION_EGLIBC_FTRAVERSE', cnf)
- eglibc_cfg(libc_getlogin, 'OPTION_EGLIBC_GETLOGIN', cnf)
- eglibc_cfg(libc_idn, 'OPTION_EGLIBC_IDN', cnf)
- eglibc_cfg(ipv4, 'OPTION_EGLIBC_INET', cnf)
- eglibc_cfg(libc_inet_anl, 'OPTION_EGLIBC_INET_ANL', cnf)
- eglibc_cfg(libc_libm, 'OPTION_EGLIBC_LIBM', cnf)
- eglibc_cfg(libc_locales, 'OPTION_EGLIBC_LOCALES', cnf)
- eglibc_cfg(libc_locale_code, 'OPTION_EGLIBC_LOCALE_CODE', cnf)
- eglibc_cfg(libc_memusage, 'OPTION_EGLIBC_MEMUSAGE', cnf)
- eglibc_cfg(libc_nis, 'OPTION_EGLIBC_NIS', cnf)
- eglibc_cfg(libc_nsswitch, 'OPTION_EGLIBC_NSSWITCH', cnf)
- eglibc_cfg(libc_rcmd, 'OPTION_EGLIBC_RCMD', cnf)
- eglibc_cfg(libc_rtld_debug, 'OPTION_EGLIBC_RTLD_DEBUG', cnf)
- eglibc_cfg(libc_spawn, 'OPTION_EGLIBC_SPAWN', cnf)
- eglibc_cfg(libc_streams, 'OPTION_EGLIBC_STREAMS', cnf)
- eglibc_cfg(libc_sunrpc, 'OPTION_EGLIBC_SUNRPC', cnf)
- eglibc_cfg(libc_utmp, 'OPTION_EGLIBC_UTMP', cnf)
- eglibc_cfg(libc_utmpx, 'OPTION_EGLIBC_UTMPX', cnf)
- eglibc_cfg(libc_wordexp, 'OPTION_EGLIBC_WORDEXP', cnf)
- eglibc_cfg(libc_posix_clang_wchar, 'OPTION_POSIX_C_LANG_WIDE_CHAR', cnf)
- eglibc_cfg(libc_posix_regexp, 'OPTION_POSIX_REGEXP', cnf)
- eglibc_cfg(libc_posix_regexp_glibc, 'OPTION_POSIX_REGEXP_GLIBC', cnf)
- eglibc_cfg(libc_posix_wchar_io, 'OPTION_POSIX_WIDE_CHAR_DEVICE_IO', cnf)
+ glibc_cfg(ipv6, 'OPTION_EGLIBC_ADVANCED_INET6', cnf)
+ glibc_cfg(libc_backtrace, 'OPTION_EGLIBC_BACKTRACE', cnf)
+ glibc_cfg(libc_big_macros, 'OPTION_EGLIBC_BIG_MACROS', cnf)
+ glibc_cfg(libc_bsd, 'OPTION_EGLIBC_BSD', cnf)
+ glibc_cfg(libc_cxx_tests, 'OPTION_EGLIBC_CXX_TESTS', cnf)
+ glibc_cfg(libc_catgets, 'OPTION_EGLIBC_CATGETS', cnf)
+ glibc_cfg(libc_charsets, 'OPTION_EGLIBC_CHARSETS', cnf)
+ glibc_cfg(libc_crypt, 'OPTION_EGLIBC_CRYPT', cnf)
+ glibc_cfg(libc_crypt_ufc, 'OPTION_EGLIBC_CRYPT_UFC', cnf)
+ glibc_cfg(libc_db_aliases, 'OPTION_EGLIBC_DB_ALIASES', cnf)
+ glibc_cfg(libc_envz, 'OPTION_EGLIBC_ENVZ', cnf)
+ glibc_cfg(libc_fcvt, 'OPTION_EGLIBC_FCVT', cnf)
+ glibc_cfg(libc_fmtmsg, 'OPTION_EGLIBC_FMTMSG', cnf)
+ glibc_cfg(libc_fstab, 'OPTION_EGLIBC_FSTAB', cnf)
+ glibc_cfg(libc_ftraverse, 'OPTION_EGLIBC_FTRAVERSE', cnf)
+ glibc_cfg(libc_getlogin, 'OPTION_EGLIBC_GETLOGIN', cnf)
+ glibc_cfg(libc_idn, 'OPTION_EGLIBC_IDN', cnf)
+ glibc_cfg(ipv4, 'OPTION_EGLIBC_INET', cnf)
+ glibc_cfg(libc_inet_anl, 'OPTION_EGLIBC_INET_ANL', cnf)
+ glibc_cfg(libc_libm, 'OPTION_EGLIBC_LIBM', cnf)
+ glibc_cfg(libc_locales, 'OPTION_EGLIBC_LOCALES', cnf)
+ glibc_cfg(libc_locale_code, 'OPTION_EGLIBC_LOCALE_CODE', cnf)
+ glibc_cfg(libc_memusage, 'OPTION_EGLIBC_MEMUSAGE', cnf)
+ glibc_cfg(libc_nis, 'OPTION_EGLIBC_NIS', cnf)
+ glibc_cfg(libc_nsswitch, 'OPTION_EGLIBC_NSSWITCH', cnf)
+ glibc_cfg(libc_rcmd, 'OPTION_EGLIBC_RCMD', cnf)
+ glibc_cfg(libc_rtld_debug, 'OPTION_EGLIBC_RTLD_DEBUG', cnf)
+ glibc_cfg(libc_spawn, 'OPTION_EGLIBC_SPAWN', cnf)
+ glibc_cfg(libc_streams, 'OPTION_EGLIBC_STREAMS', cnf)
+ glibc_cfg(libc_sunrpc, 'OPTION_EGLIBC_SUNRPC', cnf)
+ glibc_cfg(libc_utmp, 'OPTION_EGLIBC_UTMP', cnf)
+ glibc_cfg(libc_utmpx, 'OPTION_EGLIBC_UTMPX', cnf)
+ glibc_cfg(libc_wordexp, 'OPTION_EGLIBC_WORDEXP', cnf)
+ glibc_cfg(libc_posix_clang_wchar, 'OPTION_POSIX_C_LANG_WIDE_CHAR', cnf)
+ glibc_cfg(libc_posix_regexp, 'OPTION_POSIX_REGEXP', cnf)
+ glibc_cfg(libc_posix_regexp_glibc, 'OPTION_POSIX_REGEXP_GLIBC', cnf)
+ glibc_cfg(libc_posix_wchar_io, 'OPTION_POSIX_WIDE_CHAR_DEVICE_IO', cnf)
return "\n".join(cnf)
diff --git a/meta/recipes-core/eglibc/eglibc-package.inc b/meta/recipes-core/glibc/glibc-package.inc
index 6721819d2e..984362e3ce 100644
--- a/meta/recipes-core/eglibc/eglibc-package.inc
+++ b/meta/recipes-core/glibc/glibc-package.inc
@@ -1,6 +1,6 @@
#
# For now, we will skip building of a gcc package if it is a uclibc one
-# and our build is not a uclibc one, and we skip a eglibc one if our build
+# and our build is not a uclibc one, and we skip a glibc one if our build
# is a uclibc build.
#
# See the note in gcc/gcc_3.4.0.oe
@@ -17,29 +17,31 @@ python __anonymous () {
# Set this to zero if you don't want ldconfig in the output package
USE_LDCONFIG ?= "1"
-PACKAGES = "${PN}-dbg catchsegv sln nscd ldd ${PN}-utils eglibc-thread-db ${PN}-pic libcidn libmemusage libsegfault ${PN}-pcprofile libsotruss ${PN} eglibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc"
-
-# The ld.so in this eglibc supports the GNU_HASH
-RPROVIDES_${PN} = "glibc rtld(GNU_HASH)"
-RPROVIDES_${PN}-utils = "glibc-utils"
-RPROVIDES_${PN}-mtrace = "glibc-mtrace libc-mtrace"
-RPROVIDES_${PN}-pic = "glibc-pic"
-RPROVIDES_${PN}-dev = "glibc-dev libc6-dev virtual-libc-dev"
-RPROVIDES_${PN}-staticdev = "glibc-staticdev"
-RPROVIDES_${PN}-doc = "glibc-doc"
-RPROVIDES_eglibc-extra-nss = "glibc-extra-nss"
-RPROVIDES_eglibc-thread-db = "glibc-thread-db"
-RPROVIDES_${PN}-pcprofile = "glibc-pcprofile"
-RPROVIDES_${PN}-dbg = "glibc-dbg"
+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"
+
+# The ld.so in this glibc supports the GNU_HASH
+RPROVIDES_${PN} = "eglibc rtld(GNU_HASH)"
+RPROVIDES_${PN}-utils = "eglibc-utils"
+RPROVIDES_${PN}-mtrace = "eglibc-mtrace libc-mtrace"
+RPROVIDES_${PN}-pic = "eglibc-pic"
+RPROVIDES_${PN}-dev = "eglibc-dev libc6-dev virtual-libc-dev"
+RPROVIDES_${PN}-staticdev = "eglibc-staticdev"
+RPROVIDES_${PN}-doc = "eglibc-doc"
+RPROVIDES_glibc-extra-nss = "eglibc-extra-nss"
+RPROVIDES_glibc-thread-db = "eglibc-thread-db"
+RPROVIDES_${PN}-pcprofile = "eglibc-pcprofile"
+RPROVIDES_${PN}-dbg = "eglibc-dbg"
libc_baselibs = "${base_libdir}/libcrypt*.so.* ${base_libdir}/libcrypt-*.so ${base_libdir}/libc.so.* ${base_libdir}/libc-*.so ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so ${base_libdir}/ld*.so.* ${base_libdir}/ld-*.so ${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so ${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so ${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so ${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so ${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so ${base_libdir}/libnss_files*.so.* ${base_libdir}/libnss_files-*.so ${base_libdir}/libnss_compat*.so.* ${base_libdir}/libnss_compat-*.so ${base_libdir}/libnss_dns*.so.* ${base_libdir}/libnss_dns-*.so ${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so ${base_libdir}/libanl*.so.* ${base_libdir}/libanl-*.so ${base_libdir}/libBrokenLocale*.so.* ${base_libdir}/libBrokenLocale-*.so"
+libc_baselibs_append_aarch64 = " /lib/ld-linux-aarch64*.so.1"
+INSANE_SKIP_glibc_append_aarch64 = " libdir"
FILES_${PN} = "${libc_baselibs} ${libexecdir}/* ${@base_conditional('USE_LDCONFIG', '1', '${base_sbindir}/ldconfig ${sysconfdir}/ld.so.conf', '', d)}"
FILES_ldd = "${bindir}/ldd"
FILES_libsegfault = "${base_libdir}/libSegFault*"
FILES_libcidn = "${base_libdir}/libcidn-*.so ${base_libdir}/libcidn.so.*"
FILES_libmemusage = "${base_libdir}/libmemusage.so"
-FILES_eglibc-extra-nss = "${base_libdir}/libnss_*-*.so ${base_libdir}/libnss_*.so.*"
-FILES_sln = "/sbin/sln"
+FILES_glibc-extra-nss = "${base_libdir}/libnss_*-*.so ${base_libdir}/libnss_*.so.*"
+FILES_sln = "${base_sbindir}/sln"
FILES_${PN}-pic = "${libdir}/*_pic.a ${libdir}/*_pic.map ${libdir}/libc_pic/*.o"
FILES_libsotruss = "${libdir}/audit/sotruss-lib.so"
FILES_SOLIBSDEV = "${libdir}/lib*${SOLIBSDEV}"
@@ -47,12 +49,13 @@ FILES_${PN}-dev += "${bindir}/rpcgen ${libdir}/*_nonshared.a ${base_libdir}/*_no
FILES_${PN}-staticdev += "${libdir}/*.a ${base_libdir}/*.a"
FILES_nscd = "${sbindir}/nscd*"
FILES_${PN}-mtrace = "${bindir}/mtrace"
+FILES_tzcode = "${bindir}/tzselect ${sbindir}/zic ${sbindir}/zdump"
FILES_${PN}-utils = "${bindir}/* ${sbindir}/*"
FILES_${PN}-dbg += "${libexecdir}/*/.debug ${libdir}/audit/.debug"
FILES_catchsegv = "${bindir}/catchsegv"
RDEPENDS_catchsegv = "libsegfault"
FILES_${PN}-pcprofile = "${base_libdir}/libpcprofile.so"
-FILES_eglibc-thread-db = "${base_libdir}/libthread_db.so.* ${base_libdir}/libthread_db-*.so"
+FILES_glibc-thread-db = "${base_libdir}/libthread_db.so.* ${base_libdir}/libthread_db-*.so"
RPROVIDES_${PN}-dev += "libc-dev"
RPROVIDES_${PN}-staticdev += "libc-staticdev"
@@ -60,13 +63,14 @@ SUMMARY_sln = "The static ln"
DESCRIPTION_sln = "Similar to the 'ln' utility, but statically linked. sln is useful to make symbolic links to dynamic libraries if the dynamic linking system, for some reason, is not functional."
SUMMARY_nscd = "Name service cache daemon"
DESCRIPTION_nscd = "nscd, name service cache daemon, caches name service lookups for the passwd, group and hosts information. It can damatically improvide performance with remote, such as NIS or NIS+, name services."
-SUMMARY_eglibc-extra-nss = "hesiod, NIS and NIS+ nss libraries"
-DESCRIPTION_eglibc-extra-nss = "eglibc: nis, nisplus and hesiod search services."
+SUMMARY_glibc-extra-nss = "hesiod, NIS and NIS+ nss libraries"
+DESCRIPTION_glibc-extra-nss = "glibc: nis, nisplus and hesiod search services."
SUMMARY_ldd = "print shared library dependencies"
DESCRIPTION_ldd = "${bindir}/ldd prints shared library dependencies for each program or shared library specified on the command line."
-SUMMARY_${PN}-utils = "Miscellaneous utilities provided by eglibc"
-DESCRIPTION_${PN}-utils = "Miscellaneous utilities including getconf, iconf, locale, gencat, tzselect, zic, rpcinfo, ..."
+SUMMARY_${PN}-utils = "Miscellaneous utilities provided by glibc"
+DESCRIPTION_${PN}-utils = "Miscellaneous utilities including getconf, iconv, locale, gencat, rpcgen, ..."
DESCRIPTION_libsotruss = "Library to support sotruss which traces calls through PLTs"
+DESCRIPTION_tzcode = "tzcode, timezone zoneinfo utils -- zic, zdump, tzselect"
inherit libc-common multilib_header
@@ -74,9 +78,9 @@ do_install_append () {
rm -f ${D}${sysconfdir}/localtime
rm -rf ${D}${localstatedir}
- # remove empty eglibc dir
- if [ -d ${D}${libdir}/eglibc -a ! -e ${D}${libdir}/eglibc/pt_chown ]; then
- rmdir ${D}${libdir}/eglibc
+ # remove empty glibc dir
+ if [ -d ${D}${libdir}/glibc -a ! -e ${D}${libdir}/glibc/pt_chown ]; then
+ rmdir ${D}${libdir}/glibc
fi
oe_multilib_header bits/syscall.h
@@ -90,18 +94,33 @@ do_install_append () {
fi
if [ "${USE_LDCONFIG}" != "1" ]; then
- # We won't ship this file (see FILES above) so let's not install it
+ # We won't ship these files (see FILES above) so let's not install them
rm -f ${D}${sysconfdir}/ld.so.conf
+ rm -f ${D}${base_sbindir}/ldconfig
# This directory will be empty now so remove it too.
- # But check whether it exists first, since it won't for eglibc-initial.
+ # But check whether it exists first, since it won't for glibc-initial.
if [ -d ${D}${sysconfdir} ]; then
rmdir ${D}${sysconfdir}
fi
fi
}
+do_install_append_aarch64 () {
+ if [ "${base_libdir}" != "/lib" ] ; then
+ # The aarch64 ABI says the dynamic linker -must- be /lib/ld-linux-aarch64[_be].so.1
+ install -d ${D}/lib
+ if [ -e ${D}${base_libdir}/ld-linux-aarch64.so.1 ]; then
+ ln -s ${@base_path_relative('/lib', '${base_libdir}')}/ld-linux-aarch64.so.1 \
+ ${D}/lib/ld-linux-aarch64.so.1
+ elif [ -e ${D}${base_libdir}/ld-linux-aarch64_be.so.1 ]; then
+ ln -s ${@base_path_relative('/lib', '${base_libdir}')}/ld-linux-aarch64_be.so.1 \
+ ${D}/lib/ld-linux-aarch64_be.so.1
+ fi
+ fi
+}
+
do_install_locale () {
- dest=${D}/${includedir}/eglibc-locale-internal-${MULTIMACH_TARGET_SYS}
+ dest=${D}/${includedir}/glibc-locale-internal-${MULTIMACH_TARGET_SYS}
install -d ${dest}${base_libdir} ${dest}${bindir} ${dest}${libdir} ${dest}${datadir}
if [ "${base_libdir}" != "${libdir}" ]; then
cp -fpPR ${D}${base_libdir}/* ${dest}${base_libdir}
@@ -128,7 +147,7 @@ addtask do_install_locale after do_install before do_populate_sysroot do_package
bashscripts = "mtrace sotruss xtrace"
do_evacuate_scripts () {
- target=${D}${includedir}/eglibc-scripts-internal-${MULTIMACH_TARGET_SYS}
+ target=${D}${includedir}/glibc-scripts-internal-${MULTIMACH_TARGET_SYS}
mkdir -p $target
for i in ${bashscripts}; do
if [ -f ${D}${bindir}/$i ]; then
@@ -139,11 +158,11 @@ do_evacuate_scripts () {
addtask evacuate_scripts after do_install before do_populate_sysroot do_package
-PACKAGE_PREPROCESS_FUNCS += "eglibc_package_preprocess"
+PACKAGE_PREPROCESS_FUNCS += "glibc_package_preprocess"
-eglibc_package_preprocess () {
- rm -rf ${PKGD}/${includedir}/eglibc-locale-internal-${MULTIMACH_TARGET_SYS}
- rm -rf ${PKGD}/${includedir}/eglibc-scripts-internal-${MULTIMACH_TARGET_SYS}
+glibc_package_preprocess () {
+ rm -rf ${PKGD}/${includedir}/glibc-locale-internal-${MULTIMACH_TARGET_SYS}
+ rm -rf ${PKGD}/${includedir}/glibc-scripts-internal-${MULTIMACH_TARGET_SYS}
for i in ${bashscripts}; do
rm -f ${PKGD}${bindir}/$i
done
diff --git a/meta/recipes-core/glibc/glibc-scripts.inc b/meta/recipes-core/glibc/glibc-scripts.inc
new file mode 100644
index 0000000000..3a06773d66
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-scripts.inc
@@ -0,0 +1,16 @@
+include 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}"
+
+bashscripts = "sotruss xtrace"
+
+do_install() {
+ install -d -m 0755 ${D}${bindir}
+ for i in ${bashscripts}; do
+ install -m 0755 ${SRC}/$i ${D}${bindir}/
+ done
+}
diff --git a/meta/recipes-core/glibc/glibc-scripts_2.21.bb b/meta/recipes-core/glibc/glibc-scripts_2.21.bb
new file mode 100644
index 0000000000..5a89bd8022
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-scripts_2.21.bb
@@ -0,0 +1 @@
+require glibc-scripts.inc
diff --git a/meta/recipes-core/eglibc/eglibc-testing.inc b/meta/recipes-core/glibc/glibc-testing.inc
index ab3ec1555f..ec16fe1fde 100644
--- a/meta/recipes-core/eglibc/eglibc-testing.inc
+++ b/meta/recipes-core/glibc/glibc-testing.inc
@@ -1,46 +1,46 @@
do_compile_append () {
# now generate script to drive testing
- echo "#!/usr/bin/env sh" >${B}/${HOST_PREFIX}testeglibc
- set >> ${B}/${HOST_PREFIX}testeglibc
+ echo "#!/usr/bin/env sh" >${B}/${HOST_PREFIX}testglibc
+ set >> ${B}/${HOST_PREFIX}testglibc
# prune out the unneeded vars
- sed -i -e "/^BASH/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^USER/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^OPT/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^DIRSTACK/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^EUID/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^FUNCNAME/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^GROUPS/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^HOST/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^HOME/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^IFS/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^LC_ALL/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^LOGNAME/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^MACHTYPE/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^OSTYPE/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^PIPE/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^SHELL/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^'/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^UID/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^TERM/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^PATCH_GET/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^PKG_/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^POSIXLY_/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^PPID/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^PS4/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^Q/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^SHLVL/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^STAGING/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^LD_LIBRARY_PATH/d" ${B}/${HOST_PREFIX}testeglibc
- sed -i -e "/^PSEUDO/d" ${B}/${HOST_PREFIX}testeglibc
+ sed -i -e "/^BASH/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^USER/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^OPT/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^DIRSTACK/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^EUID/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^FUNCNAME/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^GROUPS/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^HOST/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^HOME/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^IFS/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^LC_ALL/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^LOGNAME/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^MACHTYPE/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^OSTYPE/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^PIPE/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^SHELL/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^'/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^UID/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^TERM/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^PATCH_GET/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^PKG_/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^POSIXLY_/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^PPID/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^PS4/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^Q/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^SHLVL/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^STAGING/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^LD_LIBRARY_PATH/d" ${B}/${HOST_PREFIX}testglibc
+ sed -i -e "/^PSEUDO/d" ${B}/${HOST_PREFIX}testglibc
# point to real sysroot not the toolchain bootstrap sysroot
- sed -i -e "s/\-tcbootstrap//g" ${B}/${HOST_PREFIX}testeglibc
+ sed -i -e "s/\-tcbootstrap//g" ${B}/${HOST_PREFIX}testglibc
# use the final cross-gcc to test since some tests need libstdc++
- sed -i -e "s/^PATH=.*\.gcc-cross-initial\:/PATH=/g" ${B}/${HOST_PREFIX}testeglibc
+ sed -i -e "s/^PATH=.*\.gcc-cross-initial\:/PATH=/g" ${B}/${HOST_PREFIX}testglibc
# append execution part script
-cat >> ${B}/${HOST_PREFIX}testeglibc << STOP
+cat >> ${B}/${HOST_PREFIX}testglibc << STOP
target="\$1"
if [ "x\$target" = "x" ]
then
@@ -59,7 +59,7 @@ then
echo " Please make sure that you have 'no_root_squash' added in /etc/exports if you want"
echo " to test as root user on target (usually its recommended to create a non"
echo " root user."
- echo " As a sanity check make sure that target can read/write to the eglibc build tree"
+ echo " As a sanity check make sure that target can read/write to the glibc build tree"
echo " Please refer to ${S}/EGLIBC.cross-testing for further instructions on setup"
exit 1
fi
@@ -75,5 +75,5 @@ make cross-localedef="\$localedef" cross-test-wrapper="\$wrapper" -k check
rm -rf ${B}/configparms
STOP
- chmod +x ${B}/${HOST_PREFIX}testeglibc
+ chmod +x ${B}/${HOST_PREFIX}testglibc
}
diff --git a/meta/recipes-core/eglibc/eglibc.inc b/meta/recipes-core/glibc/glibc.inc
index 3a623bb8c7..e33f596b72 100644
--- a/meta/recipes-core/eglibc/eglibc.inc
+++ b/meta/recipes-core/glibc/glibc.inc
@@ -1,6 +1,6 @@
-require eglibc-common.inc
-require eglibc-ld.inc
-require eglibc-testing.inc
+require glibc-common.inc
+require glibc-ld.inc
+require glibc-testing.inc
STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${TARGET_ARCH}"
@@ -8,19 +8,22 @@ PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
-# eglibc can't be built without optimization, if someone tries to compile an
+# glibc can't be built without optimization, if someone tries to compile an
# entire image as -O0, we override it with -O2 here and give a note about it.
def get_optimization(d):
selected_optimization = d.getVar("SELECTED_OPTIMIZATION", True)
if bb.utils.contains("SELECTED_OPTIMIZATION", "-O0", "x", "", d) == "x":
- bb.note("eglibc can't be built with -O0, -O2 will be used instead.")
+ bb.note("glibc can't be built with -O0, -O2 will be used instead.")
return selected_optimization.replace("-O0", "-O2")
+ elif bb.utils.contains("SELECTED_OPTIMIZATION", "-Os", "x", "", d) == "x":
+ bb.note("glibc can't be built with -Os, -Os -Wno-error will be used instead.")
+ return selected_optimization.replace("-Os", "-Os -Wno-error")
return selected_optimization
SELECTED_OPTIMIZATION := "${@get_optimization(d)}"
# siteconfig.bbclass runs configure which needs a working compiler
-# For the compiler to work we need a working libc yet libc isn't
+# For the compiler to work we need a working libc yet libc isn't
# in the sysroots directory at this point. This means the libc.so
# linker script won't work as the --sysroot setting isn't correct.
# Here we create a hacked up libc linker script and pass in the right
@@ -38,36 +41,47 @@ DEPENDS = "virtual/${TARGET_PREFIX}gcc-initial libgcc-initial linux-libc-headers
#RDEPENDS_${PN} += "${@['','libgcc']['nptl' in '${GLIBC_ADDONS}']}"
PROVIDES = "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc"
PROVIDES += "virtual/libintl virtual/libiconv"
-inherit autotools texinfo
-require eglibc-options.inc
+inherit autotools texinfo distro_features_check
+require glibc-options.inc
+
+# The main purpose of setting this variable is to prevent users from accidently
+# overriding DISTRO_FEATRUES, causing obscure build failures because of lack
+# of libc functions.
+REQUIRED_DISTRO_FEATURES = "${DISTRO_FEATURES_LIBC}"
LEAD_SONAME = "libc.so"
-CACHED_CONFIGUREVARS += "ac_cv_path_KSH=${base_bindir}/bash \
- ac_cv_path_BASH_SHELL=${base_bindir}/bash \
- libc_cv_localedir=${localedir} \
- libc_cv_ssp=no \
- "
+CACHED_CONFIGUREVARS += " \
+ ac_cv_path_KSH=${base_bindir}/bash \
+ ac_cv_path_BASH_SHELL=${base_bindir}/bash \
+ libc_cv_slibdir=${base_libdir} \
+ libc_cv_rootsbindir=${base_sbindir} \
+ libc_cv_localedir=${localedir} \
+ libc_cv_ssp=no \
+"
GLIBC_EXTRA_OECONF ?= ""
GLIBC_EXTRA_OECONF_class-nativesdk = ""
INHIBIT_DEFAULT_DEPS = "1"
+# This needs to match with glibc-collateral.inc, otherwise glibc-scripts and glibc-locale
+# will fail to find main glibc, for details see
+# http://lists.openembedded.org/pipermail/openembedded-core/2015-January/100679.html
ARM_INSTRUCTION_SET = "arm"
-# eglibc uses PARALLELMFLAGS variable to pass parallel build info so transfer
+# glibc uses PARALLELMFLAGS variable to pass parallel build info so transfer
# PARALLEL_MAKE into PARALLELMFLAGS and empty out PARALLEL_MAKE
EGLIBCPARALLELISM := "PARALLELMFLAGS="${PARALLEL_MAKE}""
EXTRA_OEMAKE[vardepsexclude] += "EGLIBCPARALLELISM"
EXTRA_OEMAKE += "${EGLIBCPARALLELISM}"
PARALLEL_MAKE = ""
-# eglibc make-syscalls.sh has a number of issues with /bin/dash and
-# it's output which make calls via the SHELL also has issues, so
+# glibc make-syscalls.sh has a number of issues with /bin/dash and
+# it's output which make calls via the SHELL also has issues, so
# ensure make uses /bin/bash
EXTRA_OEMAKE += "SHELL=/bin/bash"
-OE_FEATURES = "${@features_to_eglibc_settings(d)}"
+OE_FEATURES = "${@features_to_glibc_settings(d)}"
do_configure_prepend() {
sed -e "s#@BASH@#/bin/sh#" -i ${S}/elf/ldd.bash.in
echo '${OE_FEATURES}' > ${B}/option-groups.config
@@ -81,4 +95,4 @@ do_configure_append() {
sed -i 's/^OPTION_EGLIBC_NSSWITCH_FIXED_\(.*\)="\(.*\)"$/OPTION_EGLIBC_NSSWITCH_FIXED_\1=\2/' option-groups.config
}
-GLIBC_ADDONS ?= "ports,nptl,libidn"
+GLIBC_ADDONS ?= "nptl,libidn"
diff --git a/meta/recipes-core/glibc/glibc/0001-Add-unused-attribute.patch b/meta/recipes-core/glibc/glibc/0001-Add-unused-attribute.patch
new file mode 100644
index 0000000000..f51a0ccb22
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0001-Add-unused-attribute.patch
@@ -0,0 +1,36 @@
+2015-02-18 Khem Raj <raj.khem@gmail.com>>
+
+ * iconv/gconv_charset.h (strip):
+ Add unused attribute.
+
+From 9c4a91cb331ff1e8cde2314dadee74559d8cb0dd Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 18 Feb 2015 19:45:31 +0000
+Subject: [PATCH] Add unused attribute
+
+Helps in avoiding gcc warning when header is is included in
+a source file which does not use both functions
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Pending
+---
+ iconv/gconv_charset.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/iconv/gconv_charset.h b/iconv/gconv_charset.h
+index 80290bc..7890a8e 100644
+--- a/iconv/gconv_charset.h
++++ b/iconv/gconv_charset.h
+@@ -21,7 +21,7 @@
+ #include <locale.h>
+
+
+-static void
++static void __attribute__ ((unused))
+ strip (char *wp, const char *s)
+ {
+ int slash_count = 0;
+--
+2.1.4
+
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/0001-R_ARM_TLS_DTPOFF32.patch b/meta/recipes-core/glibc/glibc/0001-R_ARM_TLS_DTPOFF32.patch
index b4489e9ae9..3922cb818f 100644
--- a/meta/recipes-core/eglibc/eglibc-2.19/0001-R_ARM_TLS_DTPOFF32.patch
+++ b/meta/recipes-core/glibc/glibc/0001-R_ARM_TLS_DTPOFF32.patch
@@ -41,9 +41,11 @@ Signed-off-by: Andrei Dinu <andrei.adrianx.dinu@intel.com>
1 file changed, 1 insertion(+), 1 deletion(-)
ndex 8d905e8..dcfa71e 100644
---- libc.orig/ports/sysdeps/arm/dl-machine.h
-+++ libc/ports/sysdeps/arm/dl-machine.h
-@@ -503,7 +503,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
+Index: git/sysdeps/arm/dl-machine.h
+===================================================================
+--- git.orig/sysdeps/arm/dl-machine.h 2014-08-27 05:30:47.748070587 +0000
++++ git/sysdeps/arm/dl-machine.h 2014-08-27 05:30:47.740070587 +0000
+@@ -495,7 +495,7 @@
case R_ARM_TLS_DTPOFF32:
if (sym != NULL)
@@ -52,5 +54,3 @@ ndex 8d905e8..dcfa71e 100644
break;
case R_ARM_TLS_TPOFF32:
---
-
diff --git a/meta/recipes-core/glibc/glibc/0001-When-disabling-SSE-also-make-sure-that-fpmath-is-not.patch b/meta/recipes-core/glibc/glibc/0001-When-disabling-SSE-also-make-sure-that-fpmath-is-not.patch
new file mode 100644
index 0000000000..a6395b77bc
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0001-When-disabling-SSE-also-make-sure-that-fpmath-is-not.patch
@@ -0,0 +1,32 @@
+From 6f5639f6405ff9a42e4f71e7b0f18bddb68d992a Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 19 Feb 2015 03:23:45 +0000
+Subject: [PATCH] When disabling SSE also make sure that fpmath is not set to
+ use SSE as well
+
+This fixes errors when we inject sse options through CFLAGS and now
+that we have -Werror turned on by default this warning turns to become
+error on x86
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Pending
+---
+ sysdeps/x86/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
+index 19f5eca..827ea71 100644
+--- a/sysdeps/x86/Makefile
++++ b/sysdeps/x86/Makefile
+@@ -1,6 +1,6 @@
+ ifeq ($(subdir),elf)
+ CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
+- -mno-sse -mno-mmx)
++ -mno-sse -mno-mmx -mfpmath=387)
+
+ tests-special += $(objpfx)tst-ld-sse-use.out
+ $(objpfx)tst-ld-sse-use.out: ../sysdeps/x86/tst-ld-sse-use.sh $(objpfx)ld.so
+--
+2.1.4
+
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch b/meta/recipes-core/glibc/glibc/0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch
index a8463ea915..f341282ffb 100644
--- a/meta/recipes-core/eglibc/eglibc-2.19/0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch
+++ b/meta/recipes-core/glibc/glibc/0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch
@@ -17,11 +17,11 @@ Signed-off-by: Ting Liu <b28495@freescale.com>
manual/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
-diff --git a/manual/Makefile b/manual/Makefile
-index 6fddff0..7af242e 100644
---- a/manual/Makefile
-+++ b/manual/Makefile
-@@ -109,7 +109,8 @@ $(objpfx)libm-err.texi: $(objpfx)stamp-libm-err
+Index: git/manual/Makefile
+===================================================================
+--- git.orig/manual/Makefile 2014-08-29 10:35:18.728070587 -0700
++++ git/manual/Makefile 2014-08-29 10:35:18.720070587 -0700
+@@ -105,7 +105,8 @@
$(objpfx)stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
$(dir)/libm-test-ulps))
pwd=`pwd`; \
@@ -31,6 +31,3 @@ index 6fddff0..7af242e 100644
$(move-if-change) $(objpfx)libm-err-tmp $(objpfx)libm-err.texi
touch $@
---
-1.7.9.7
-
diff --git a/meta/recipes-core/glibc/glibc/0001-yes-within-the-path-sets-wrong-config-variables.patch b/meta/recipes-core/glibc/glibc/0001-yes-within-the-path-sets-wrong-config-variables.patch
new file mode 100644
index 0000000000..827e980332
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0001-yes-within-the-path-sets-wrong-config-variables.patch
@@ -0,0 +1,245 @@
+'yes' within the path sets wrong config variables
+
+It seems that the 'AC_EGREP_CPP(yes...' example is quite popular
+but being such a short word to grep it is likely to produce
+false-positive matches with the path it is configured into.
+
+The change is to use a more elaborated string to grep for.
+
+Upstream-Status: Submitted [libc-alpha@sourceware.org]
+
+Signed-off-by: Benjamin Esquivel <benjamin.esquivel@linux.intel.com>
+---
+diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure
+index 5bd355a..3bc5537 100644
+--- a/sysdeps/aarch64/configure
++++ b/sysdeps/aarch64/configure
+@@ -148,12 +148,12 @@ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+ #ifdef __AARCH64EB__
+- yes
++ is_aarch64_be
+ #endif
+
+ _ACEOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+- $EGREP "yes" >/dev/null 2>&1; then :
++ $EGREP "is_aarch64_be" >/dev/null 2>&1; then :
+ libc_cv_aarch64_be=yes
+ else
+ libc_cv_aarch64_be=no
+diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac
+index 7851dd4..6e92381 100644
+--- a/sysdeps/aarch64/configure.ac
++++ b/sysdeps/aarch64/configure.ac
+@@ -10,8 +10,8 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+ # the dynamic linker via %ifdef.
+ AC_CACHE_CHECK([for big endian],
+ [libc_cv_aarch64_be],
+- [AC_EGREP_CPP(yes,[#ifdef __AARCH64EB__
+- yes
++ [AC_EGREP_CPP(is_aarch64_be,[#ifdef __AARCH64EB__
++ is_aarch64_be
+ #endif
+ ], libc_cv_aarch64_be=yes, libc_cv_aarch64_be=no)])
+ if test $libc_cv_aarch64_be = yes; then
+diff --git a/sysdeps/arm/configure b/sysdeps/arm/configure
+index 45667cc..0b2ef11 100644
+--- a/sysdeps/arm/configure
++++ b/sysdeps/arm/configure
+@@ -150,12 +150,12 @@ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+ #ifdef __ARM_PCS_VFP
+- yes
++ use_arm_pcs_vfp
+ #endif
+
+ _ACEOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+- $EGREP "yes" >/dev/null 2>&1; then :
++ $EGREP "use_arm_pcs_vfp" >/dev/null 2>&1; then :
+ libc_cv_arm_pcs_vfp=yes
+ else
+ libc_cv_arm_pcs_vfp=no
+diff --git a/sysdeps/arm/configure.ac b/sysdeps/arm/configure.ac
+index 002b8ef..e1746a7 100644
+--- a/sysdeps/arm/configure.ac
++++ b/sysdeps/arm/configure.ac
+@@ -16,8 +16,8 @@ dnl it. Until we do, don't define it.
+ # the dynamic linker via %ifdef.
+ AC_CACHE_CHECK([whether the compiler is using the ARM hard-float ABI],
+ [libc_cv_arm_pcs_vfp],
+- [AC_EGREP_CPP(yes,[#ifdef __ARM_PCS_VFP
+- yes
++ [AC_EGREP_CPP(use_arm_pcs_vfp,[#ifdef __ARM_PCS_VFP
++ use_arm_pcs_vfp
+ #endif
+ ], libc_cv_arm_pcs_vfp=yes, libc_cv_arm_pcs_vfp=no)])
+ if test $libc_cv_arm_pcs_vfp = yes; then
+diff --git a/sysdeps/mips/configure b/sysdeps/mips/configure
+index 4e13248..f14af95 100644
+--- a/sysdeps/mips/configure
++++ b/sysdeps/mips/configure
+@@ -143,11 +143,11 @@ else
+ /* end confdefs.h. */
+ dnl
+ #ifdef __mips_nan2008
+-yes
++use_mips_nan2008
+ #endif
+ _ACEOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+- $EGREP "yes" >/dev/null 2>&1; then :
++ $EGREP "use_mips_nan2008" >/dev/null 2>&1; then :
+ libc_cv_mips_nan2008=yes
+ else
+ libc_cv_mips_nan2008=no
+diff --git a/sysdeps/mips/configure.ac b/sysdeps/mips/configure.ac
+index bcbdaff..ad3057f 100644
+--- a/sysdeps/mips/configure.ac
++++ b/sysdeps/mips/configure.ac
+@@ -6,9 +6,9 @@ dnl position independent way.
+ dnl AC_DEFINE(PI_STATIC_AND_HIDDEN)
+
+ AC_CACHE_CHECK([whether the compiler is using the 2008 NaN encoding],
+- libc_cv_mips_nan2008, [AC_EGREP_CPP(yes, [dnl
++ libc_cv_mips_nan2008, [AC_EGREP_CPP(use_mips_nan2008, [dnl
+ #ifdef __mips_nan2008
+-yes
++use_mips_nan2008
+ #endif], libc_cv_mips_nan2008=yes, libc_cv_mips_nan2008=no)])
+ if test x$libc_cv_mips_nan2008 = xyes; then
+ AC_DEFINE(HAVE_MIPS_NAN2008)
+diff --git a/sysdeps/nios2/configure b/sysdeps/nios2/configure
+index 14c8a3a..dde3814 100644
+--- a/sysdeps/nios2/configure
++++ b/sysdeps/nios2/configure
+@@ -142,12 +142,12 @@ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+ #ifdef __nios2_big_endian__
+- yes
++ is_nios2_be
+ #endif
+
+ _ACEOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+- $EGREP "yes" >/dev/null 2>&1; then :
++ $EGREP "is_nios2_be" >/dev/null 2>&1; then :
+ libc_cv_nios2_be=yes
+ else
+ libc_cv_nios2_be=no
+diff --git a/sysdeps/nios2/configure.ac b/sysdeps/nios2/configure.ac
+index f05f438..dc86399 100644
+--- a/sysdeps/nios2/configure.ac
++++ b/sysdeps/nios2/configure.ac
+@@ -4,8 +4,8 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+ # Nios II big endian is not yet supported.
+ AC_CACHE_CHECK([for big endian],
+ [libc_cv_nios2_be],
+- [AC_EGREP_CPP(yes,[#ifdef __nios2_big_endian__
+- yes
++ [AC_EGREP_CPP(is_nios2_be,[#ifdef __nios2_big_endian__
++ is_nios2_be
+ #endif
+ ], libc_cv_nios2_be=yes, libc_cv_nios2_be=no)])
+ if test $libc_cv_nios2_be = yes; then
+diff --git a/sysdeps/unix/sysv/linux/mips/configure b/sysdeps/unix/sysv/linux/mips/configure
+index 83f8b13..2b6cbee 100644
+--- a/sysdeps/unix/sysv/linux/mips/configure
++++ b/sysdeps/unix/sysv/linux/mips/configure
+@@ -387,11 +387,11 @@ else
+ /* end confdefs.h. */
+ dnl
+ #ifdef __mips_nan2008
+-yes
++use_mips_nan2008
+ #endif
+ _ACEOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+- $EGREP "yes" >/dev/null 2>&1; then :
++ $EGREP "use_mips_nan2008" >/dev/null 2>&1; then :
+ libc_cv_mips_nan2008=yes
+ else
+ libc_cv_mips_nan2008=no
+diff --git a/sysdeps/unix/sysv/linux/mips/configure.ac b/sysdeps/unix/sysv/linux/mips/configure.ac
+index 5039ec9..1035f76 100644
+--- a/sysdeps/unix/sysv/linux/mips/configure.ac
++++ b/sysdeps/unix/sysv/linux/mips/configure.ac
+@@ -98,9 +98,9 @@ AC_COMPILE_IFELSE(
+ LIBC_CONFIG_VAR([mips-mode-switch],[${libc_mips_mode_switch}])
+
+ AC_CACHE_CHECK([whether the compiler is using the 2008 NaN encoding],
+- libc_cv_mips_nan2008, [AC_EGREP_CPP(yes, [dnl
++ libc_cv_mips_nan2008, [AC_EGREP_CPP(use_mips_nan2008, [dnl
+ #ifdef __mips_nan2008
+-yes
++use_mips_nan2008
+ #endif], libc_cv_mips_nan2008=yes, libc_cv_mips_nan2008=no)])
+
+ libc_mips_nan=
+diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure
+index 70bb18a..ffd9e3e 100644
+--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure
++++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure
+@@ -155,12 +155,12 @@ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+ #if _CALL_ELF == 2
+- yes
++ use_ppc_elfv2_abi
+ #endif
+
+ _ACEOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+- $EGREP "yes" >/dev/null 2>&1; then :
++ $EGREP "use_ppc_elfv2_abi" >/dev/null 2>&1; then :
+ libc_cv_ppc64_elfv2_abi=yes
+ else
+ libc_cv_ppc64_elfv2_abi=no
+@@ -188,12 +188,12 @@ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+ #ifdef _CALL_ELF
+- yes
++ is_def_call_elf
+ #endif
+
+ _ACEOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+- $EGREP "yes" >/dev/null 2>&1; then :
++ $EGREP "is_def_call_elf" >/dev/null 2>&1; then :
+ libc_cv_ppc64_def_call_elf=yes
+ else
+ libc_cv_ppc64_def_call_elf=no
+diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac
+index 0822915..9a32fdd 100644
+--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac
++++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac
+@@ -6,8 +6,8 @@ LIBC_SLIBDIR_RTLDDIR([lib64], [lib64])
+ # Define default-abi according to compiler flags.
+ AC_CACHE_CHECK([whether the compiler is using the PowerPC64 ELFv2 ABI],
+ [libc_cv_ppc64_elfv2_abi],
+- [AC_EGREP_CPP(yes,[#if _CALL_ELF == 2
+- yes
++ [AC_EGREP_CPP(use_ppc_elfv2_abi,[#if _CALL_ELF == 2
++ use_ppc_elfv2_abi
+ #endif
+ ], libc_cv_ppc64_elfv2_abi=yes, libc_cv_ppc64_elfv2_abi=no)])
+ if test $libc_cv_ppc64_elfv2_abi = yes; then
+@@ -19,8 +19,8 @@ else
+ # Compiler that do not support ELFv2 ABI does not define _CALL_ELF
+ AC_CACHE_CHECK([whether the compiler defines _CALL_ELF],
+ [libc_cv_ppc64_def_call_elf],
+- [AC_EGREP_CPP(yes,[#ifdef _CALL_ELF
+- yes
++ [AC_EGREP_CPP(is_def_call_elf,[#ifdef _CALL_ELF
++ is_def_call_elf
+ #endif
+ ], libc_cv_ppc64_def_call_elf=yes, libc_cv_ppc64_def_call_elf=no)])
+ if test $libc_cv_ppc64_def_call_elf = no; then
+--
+1.8.4.5
+
diff --git a/meta/recipes-core/glibc/glibc/GLRO_dl_debug_mask.patch b/meta/recipes-core/glibc/glibc/GLRO_dl_debug_mask.patch
new file mode 100644
index 0000000000..e858bfaeda
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/GLRO_dl_debug_mask.patch
@@ -0,0 +1,529 @@
+Its controlled by __OPTION_EGLIBC_RTLD_DEBUG
+so we should use GLRO_dl_debug_mask
+
+Singed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Pending
+Index: git/elf/dl-open.c
+===================================================================
+--- git.orig/elf/dl-open.c 2014-08-27 05:03:59.732070587 +0000
++++ git/elf/dl-open.c 2014-08-27 05:05:25.656070587 +0000
+@@ -147,7 +147,7 @@
+ ns->_ns_main_searchlist->r_list[new_nlist++] = map;
+
+ /* We modify the global scope. Report this. */
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
+ _dl_debug_printf ("\nadd %s [%lu] to global scope\n",
+ map->l_name, map->l_ns);
+ }
+@@ -243,7 +243,7 @@
+ if (__glibc_unlikely (new->l_searchlist.r_list != NULL))
+ {
+ /* Let the user know about the opencount. */
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
+ _dl_debug_printf ("opening file=%s [%lu]; direct_opencount=%u\n\n",
+ new->l_name, new->l_ns, new->l_direct_opencount);
+
+@@ -294,7 +294,7 @@
+ LIBC_PROBE (map_complete, 3, args->nsid, r, new);
+
+ /* Print scope information. */
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
+ _dl_show_scope (new, 0);
+
+ /* Only do lazy relocation if `LD_BIND_NOW' is not set. */
+@@ -511,7 +511,7 @@
+ }
+
+ /* Print scope information. */
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
+ _dl_show_scope (imap, from_scope);
+ }
+
+@@ -584,7 +584,7 @@
+ #endif
+
+ /* Let the user know about the opencount. */
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
+ _dl_debug_printf ("opening file=%s [%lu]; direct_opencount=%u\n\n",
+ new->l_name, new->l_ns, new->l_direct_opencount);
+ }
+Index: git/elf/rtld.c
+===================================================================
+--- git.orig/elf/rtld.c 2014-08-27 05:03:59.732070587 +0000
++++ git/elf/rtld.c 2014-08-27 05:12:33.812070587 +0000
+@@ -321,7 +321,7 @@
+ }
+ #endif
+
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_STATISTICS))
+ {
+ #ifndef HP_TIMING_NONAVAIL
+ print_statistics (&rtld_total_time);
+@@ -1699,7 +1699,7 @@
+ after relocation. */
+ struct link_map *l;
+
+- if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
++ if (GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
+ {
+ struct r_scope_elem *scope = &main_map->l_searchlist;
+
+@@ -1729,7 +1729,7 @@
+ _dl_printf ("\n");
+ }
+ }
+- else if (GLRO(dl_debug_mask) & DL_DEBUG_UNUSED)
++ else if (GLRO_dl_debug_mask & DL_DEBUG_UNUSED)
+ {
+ /* Look through the dependencies of the main executable
+ and determine which of them is not actually
+@@ -1837,7 +1837,7 @@
+ }
+ }
+
+- if ((GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
++ if ((GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
+ && rtld_multiple_ref)
+ {
+ /* Mark the link map as not yet relocated again. */
+@@ -1970,7 +1970,7 @@
+ if (r_list == r_listend && liblist == liblistend)
+ prelinked = true;
+
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
+ _dl_debug_printf ("\nprelink checking: %s\n",
+ prelinked ? "ok" : "failed");
+ }
+@@ -1988,7 +1988,7 @@
+ GLRO(dl_init_all_dirs) = GL(dl_all_dirs);
+
+ /* Print scope information. */
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
+ {
+ _dl_debug_printf ("\nInitial object scopes\n");
+
+@@ -2262,7 +2262,7 @@
+ if (debopts[cnt].len == len
+ && memcmp (dl_debug, debopts[cnt].name, len) == 0)
+ {
+- GLRO(dl_debug_mask) |= debopts[cnt].mask;
++ GLRO_dl_debug_mask |= debopts[cnt].mask;
+ any_debug = 1;
+ break;
+ }
+@@ -2283,7 +2283,7 @@
+ ++dl_debug;
+ }
+
+- if (GLRO(dl_debug_mask) & DL_DEBUG_UNUSED)
++ if (GLRO_dl_debug_mask & DL_DEBUG_UNUSED)
+ {
+ /* In order to get an accurate picture of whether a particular
+ DT_NEEDED entry is actually used we have to process both
+@@ -2291,7 +2291,7 @@
+ GLRO(dl_lazy) = 0;
+ }
+
+- if (GLRO(dl_debug_mask) & DL_DEBUG_HELP)
++ if (GLRO_dl_debug_mask & DL_DEBUG_HELP)
+ {
+ size_t cnt;
+
+@@ -2490,7 +2490,7 @@
+ {
+ mode = trace;
+ GLRO(dl_verbose) = 1;
+- GLRO(dl_debug_mask) |= DL_DEBUG_PRELINK;
++ GLRO_dl_debug_mask |= DL_DEBUG_PRELINK;
+ GLRO(dl_trace_prelink) = &envline[17];
+ }
+ break;
+@@ -2537,7 +2537,7 @@
+ if (__access ("/etc/suid-debug", F_OK) != 0)
+ {
+ unsetenv ("MALLOC_CHECK_");
+- GLRO(dl_debug_mask) = 0;
++ GLRO_dl_debug_mask = 0;
+ }
+
+ if (mode != normal)
+Index: git/elf/dl-lookup.c
+===================================================================
+--- git.orig/elf/dl-lookup.c 2014-08-27 05:03:59.732070587 +0000
++++ git/elf/dl-lookup.c 2014-08-27 05:13:07.644070587 +0000
+@@ -300,7 +300,7 @@
+ hash table. */
+ if (__glibc_unlikely (tab->size))
+ {
+- assert (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK);
++ assert (GLRO_dl_debug_mask & DL_DEBUG_PRELINK);
+ goto success;
+ }
+ #endif
+@@ -375,7 +375,7 @@
+ continue;
+
+ /* Print some debugging info if wanted. */
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SYMBOLS))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SYMBOLS))
+ _dl_debug_printf ("symbol=%s; lookup in file=%s [%lu]\n",
+ undef_name, DSO_FILENAME (map->l_name),
+ map->l_ns);
+@@ -698,7 +698,7 @@
+ }
+
+ /* Display information if we are debugging. */
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
+ _dl_debug_printf ("\
+ \nfile=%s [%lu]; needed by %s [%lu] (relocation dependency)\n\n",
+ DSO_FILENAME (map->l_name),
+@@ -802,7 +802,7 @@
+ {
+ if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
+ && skip_map == NULL
+- && !(GLRO(dl_debug_mask) & DL_DEBUG_UNUSED))
++ && !(GLRO_dl_debug_mask & DL_DEBUG_UNUSED))
+ {
+ /* We could find no value for a strong reference. */
+ const char *reference_name = undef_map ? undef_map->l_name : "";
+@@ -873,7 +873,7 @@
+ if (__glibc_unlikely (current_value.m->l_used == 0))
+ current_value.m->l_used = 1;
+
+- if (__glibc_unlikely (GLRO(dl_debug_mask)
++ if (__glibc_unlikely (GLRO_dl_debug_mask
+ & (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK)))
+ _dl_debug_bindings (undef_name, undef_map, ref,
+ &current_value, version, type_class, protected);
+@@ -938,7 +938,7 @@
+ {
+ const char *reference_name = undef_map->l_name;
+
+- if (GLRO(dl_debug_mask) & DL_DEBUG_BINDINGS)
++ if (GLRO_dl_debug_mask & DL_DEBUG_BINDINGS)
+ {
+ _dl_debug_printf ("binding file %s [%lu] to %s [%lu]: %s symbol `%s'",
+ DSO_FILENAME (reference_name),
+@@ -952,7 +952,7 @@
+ _dl_debug_printf_c ("\n");
+ }
+ #ifdef SHARED
+- if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
++ if (GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
+ {
+ int conflict = 0;
+ struct sym_val val = { NULL, NULL };
+Index: git/elf/get-dynamic-info.h
+===================================================================
+--- git.orig/elf/get-dynamic-info.h 2014-08-27 05:03:59.732070587 +0000
++++ git/elf/get-dynamic-info.h 2014-08-27 05:03:59.728070587 +0000
+@@ -157,7 +157,7 @@
+ them. Therefore to avoid breaking existing applications the
+ best we can do is add a warning during debugging with the
+ intent of notifying the user of the problem. */
+- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0)
++ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0)
+ && l->l_flags_1 & ~DT_1_SUPPORTED_MASK)
+ _dl_debug_printf ("\nWARNING: Unsupported flag value(s) of 0x%x in DT_FLAGS_1.\n",
+ l->l_flags_1 & ~DT_1_SUPPORTED_MASK);
+Index: git/csu/libc-start.c
+===================================================================
+--- git.orig/csu/libc-start.c 2014-08-27 04:59:01.412070587 +0000
++++ git/csu/libc-start.c 2014-08-27 05:09:28.936070587 +0000
+@@ -238,7 +238,7 @@
+
+ /* Call the initializer of the program, if any. */
+ #ifdef SHARED
+- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
++ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
+ GLRO(dl_debug_printf) ("\ninitialize program: %s\n\n", argv[0]);
+ #endif
+ if (init)
+@@ -261,7 +261,7 @@
+ #endif
+
+ #ifdef SHARED
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS))
+ GLRO(dl_debug_printf) ("\ntransferring control: %s\n\n", argv[0]);
+ #endif
+
+Index: git/elf/dl-cache.c
+===================================================================
+--- git.orig/elf/dl-cache.c 2014-08-27 04:59:01.568070587 +0000
++++ git/elf/dl-cache.c 2014-08-27 05:10:14.384070587 +0000
+@@ -187,7 +187,7 @@
+ const char *best;
+
+ /* Print a message if the loading of libs is traced. */
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
+ _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE);
+
+ if (cache == NULL)
+@@ -285,7 +285,7 @@
+ }
+
+ /* Print our result if wanted. */
+- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0)
++ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0)
+ && best != NULL)
+ _dl_debug_printf (" trying file=%s\n", best);
+
+Index: git/elf/dl-close.c
+===================================================================
+--- git.orig/elf/dl-close.c 2014-08-27 04:59:01.568070587 +0000
++++ git/elf/dl-close.c 2014-08-27 05:10:26.456070587 +0000
+@@ -125,7 +125,7 @@
+ dl_close_state = rerun;
+
+ /* There are still references to this object. Do nothing more. */
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
+ _dl_debug_printf ("\nclosing file=%s; direct_opencount=%u\n",
+ map->l_name, map->l_direct_opencount);
+
+@@ -257,7 +257,7 @@
+ if (imap->l_init_called)
+ {
+ /* When debugging print a message first. */
+- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS,
++ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS,
+ 0))
+ _dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
+ imap->l_name, nsid);
+@@ -664,7 +664,7 @@
+ free (imap->l_reldeps);
+
+ /* Print debugging message. */
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
+ _dl_debug_printf ("\nfile=%s [%lu]; destroying link map\n",
+ imap->l_name, imap->l_ns);
+
+Index: git/elf/dl-conflict.c
+===================================================================
+--- git.orig/elf/dl-conflict.c 2014-08-27 04:59:01.568070587 +0000
++++ git/elf/dl-conflict.c 2014-08-27 05:10:37.652070587 +0000
+@@ -32,7 +32,7 @@
+ ElfW(Rela) *conflictend)
+ {
+ #if ! ELF_MACHINE_NO_RELA
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_RELOC))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_RELOC))
+ _dl_debug_printf ("\nconflict processing: %s\n", DSO_FILENAME (l->l_name));
+
+ {
+Index: git/elf/dl-deps.c
+===================================================================
+--- git.orig/elf/dl-deps.c 2014-08-27 04:59:01.568070587 +0000
++++ git/elf/dl-deps.c 2014-08-27 05:10:48.260070587 +0000
+@@ -127,7 +127,7 @@
+ else \
+ { \
+ /* This is for DT_AUXILIARY. */ \
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS)) \
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS)) \
+ _dl_debug_printf (N_("\
+ cannot load auxiliary `%s' because of empty dynamic string token " \
+ "substitution\n"), __str); \
+@@ -303,7 +303,7 @@
+ args.name = name;
+
+ /* Say that we are about to load an auxiliary library. */
+- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS,
++ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS,
+ 0))
+ _dl_debug_printf ("load auxiliary object=%s"
+ " requested by file=%s\n",
+@@ -520,7 +520,7 @@
+ runp->map->l_reserved = 0;
+ }
+
+- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK, 0) != 0
++ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_PRELINK, 0) != 0
+ && map == GL(dl_ns)[LM_ID_BASE]._ns_loaded)
+ {
+ /* If we are to compute conflicts, we have to build local scope
+Index: git/elf/dl-error.c
+===================================================================
+--- git.orig/elf/dl-error.c 2014-08-27 04:59:01.568070587 +0000
++++ git/elf/dl-error.c 2014-08-27 05:11:06.752070587 +0000
+@@ -139,7 +139,7 @@
+ _dl_signal_cerror (int errcode, const char *objname, const char *occation,
+ const char *errstring)
+ {
+- if (__builtin_expect (GLRO(dl_debug_mask)
++ if (__builtin_expect (GLRO_dl_debug_mask
+ & ~(DL_DEBUG_STATISTICS|DL_DEBUG_PRELINK), 0))
+ _dl_debug_printf ("%s: error: %s: %s (%s)\n", objname, occation,
+ errstring, receiver ? "continued" : "fatal");
+Index: git/elf/dl-fini.c
+===================================================================
+--- git.orig/elf/dl-fini.c 2014-08-27 04:59:01.568070587 +0000
++++ git/elf/dl-fini.c 2014-08-27 05:11:17.544070587 +0000
+@@ -234,7 +234,7 @@
+ || l->l_info[DT_FINI] != NULL)
+ {
+ /* When debugging print a message first. */
+- if (__builtin_expect (GLRO(dl_debug_mask)
++ if (__builtin_expect (GLRO_dl_debug_mask
+ & DL_DEBUG_IMPCALLS, 0))
+ _dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
+ DSO_FILENAME (l->l_name),
+@@ -286,7 +286,7 @@
+ goto again;
+ }
+
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_STATISTICS))
+ _dl_debug_printf ("\nruntime linker statistics:\n"
+ " final number of relocations: %lu\n"
+ "final number of relocations from cache: %lu\n",
+Index: git/elf/dl-init.c
+===================================================================
+--- git.orig/elf/dl-init.c 2014-08-27 04:59:01.568070587 +0000
++++ git/elf/dl-init.c 2014-08-27 05:11:28.372070587 +0000
+@@ -52,7 +52,7 @@
+ return;
+
+ /* Print a debug message if wanted. */
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS))
+ _dl_debug_printf ("\ncalling init: %s\n\n",
+ DSO_FILENAME (l->l_name));
+
+@@ -102,7 +102,7 @@
+ ElfW(Addr) *addrs;
+ unsigned int cnt;
+
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS))
+ _dl_debug_printf ("\ncalling preinit: %s\n\n",
+ DSO_FILENAME (main_map->l_name));
+
+Index: git/elf/dl-load.c
+===================================================================
+--- git.orig/elf/dl-load.c 2014-08-27 04:59:01.572070587 +0000
++++ git/elf/dl-load.c 2014-08-27 05:11:41.156070587 +0000
+@@ -957,7 +957,7 @@
+ }
+
+ /* Print debugging message. */
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
+ _dl_debug_printf ("file=%s [%lu]; generating link map\n", name, nsid);
+
+ /* This is the ELF header. We read it in `open_verify'. */
+@@ -1361,7 +1361,7 @@
+
+ l->l_entry += l->l_addr;
+
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
+ _dl_debug_printf ("\
+ dynamic: 0x%0*lx base: 0x%0*lx size: 0x%0*Zx\n\
+ entry: 0x%0*lx phdr: 0x%0*lx phnum: %*u\n\n",
+@@ -1787,7 +1787,7 @@
+
+ /* If we are debugging the search for libraries print the path
+ now if it hasn't happened now. */
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS)
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS)
+ && current_what != this_dir->what)
+ {
+ current_what = this_dir->what;
+@@ -1808,7 +1808,7 @@
+ - buf);
+
+ /* Print name we try if this is wanted. */
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
+ _dl_debug_printf (" trying file=%s\n", buf);
+
+ fd = open_verify (buf, fbp, loader, whatcode, mode,
+@@ -1953,7 +1953,7 @@
+ }
+
+ /* Display information if we are debugging. */
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES)
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES)
+ && loader != NULL)
+ _dl_debug_printf ((mode & __RTLD_CALLMAP) == 0
+ ? "\nfile=%s [%lu]; needed by %s [%lu]\n"
+@@ -1995,7 +1995,7 @@
+
+ size_t namelen = strlen (name) + 1;
+
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
+ _dl_debug_printf ("find library=%s [%lu]; searching\n", name, nsid);
+
+ fd = -1;
+@@ -2122,7 +2122,7 @@
+ &realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
+
+ /* Add another newline when we are tracing the library loading. */
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
+ _dl_debug_printf ("\n");
+ }
+ else
+@@ -2155,7 +2155,7 @@
+ if (__glibc_unlikely (fd == -1))
+ {
+ if (trace_mode
+- && __glibc_likely ((GLRO(dl_debug_mask) & DL_DEBUG_PRELINK) == 0))
++ && __glibc_likely ((GLRO_dl_debug_mask & DL_DEBUG_PRELINK) == 0))
+ {
+ /* We haven't found an appropriate library. But since we
+ are only interested in the list of libraries this isn't
+Index: git/elf/dl-object.c
+===================================================================
+--- git.orig/elf/dl-object.c 2014-08-27 04:59:01.572070587 +0000
++++ git/elf/dl-object.c 2014-08-27 05:11:51.756070587 +0000
+@@ -98,7 +98,7 @@
+ new->l_type = type;
+ /* If we set the bit now since we know it is never used we avoid
+ dirtying the cache line later. */
+- if ((GLRO(dl_debug_mask) & DL_DEBUG_UNUSED) == 0)
++ if ((GLRO_dl_debug_mask & DL_DEBUG_UNUSED) == 0)
+ new->l_used = 1;
+ new->l_loader = loader;
+ #if NO_TLS_OFFSET != 0
+Index: git/elf/dl-reloc.c
+===================================================================
+--- git.orig/elf/dl-reloc.c 2014-08-27 04:59:01.572070587 +0000
++++ git/elf/dl-reloc.c 2014-08-27 05:12:07.056070587 +0000
+@@ -183,7 +183,7 @@
+ && __builtin_expect (l->l_info[DT_BIND_NOW] != NULL, 0))
+ lazy = 0;
+
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_RELOC))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_RELOC))
+ _dl_debug_printf ("\nrelocation processing: %s%s\n",
+ DSO_FILENAME (l->l_name), lazy ? " (lazy)" : "");
+
+Index: git/elf/dl-version.c
+===================================================================
+--- git.orig/elf/dl-version.c 2014-08-27 04:59:01.608070587 +0000
++++ git/elf/dl-version.c 2014-08-27 05:12:19.568070587 +0000
+@@ -82,7 +82,7 @@
+ int result = 0;
+
+ /* Display information about what we are doing while debugging. */
+- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_VERSIONS))
++ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_VERSIONS))
+ _dl_debug_printf ("\
+ checking for version `%s' in file %s [%lu] required by file %s [%lu]\n",
+ string, DSO_FILENAME (map->l_name),
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/IO-acquire-lock-fix.patch b/meta/recipes-core/glibc/glibc/IO-acquire-lock-fix.patch
index cf5803585c..ffbaba14a2 100644
--- a/meta/recipes-core/eglibc/eglibc-2.19/IO-acquire-lock-fix.patch
+++ b/meta/recipes-core/glibc/glibc/IO-acquire-lock-fix.patch
@@ -2,11 +2,11 @@ import http://sourceware.org/ml/libc-ports/2007-12/msg00000.html
Upstream-Status: Pending
-Index: libc/bits/stdio-lock.h
+Index: git/bits/stdio-lock.h
===================================================================
---- libc.orig/bits/stdio-lock.h 2009-10-28 14:34:19.000000000 -0700
-+++ libc/bits/stdio-lock.h 2009-10-28 14:34:54.000000000 -0700
-@@ -50,6 +50,8 @@ __libc_lock_define_recursive (typedef, _
+--- git.orig/bits/stdio-lock.h 2014-08-29 10:33:57.960070587 -0700
++++ git/bits/stdio-lock.h 2014-08-29 10:33:57.952070587 -0700
+@@ -49,6 +49,8 @@
_IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, (_fp)); \
_IO_flockfile (_fp)
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/add_resource_h_to_wait_h.patch b/meta/recipes-core/glibc/glibc/add_resource_h_to_wait_h.patch
index f5023c08d4..4559de7bc1 100644
--- a/meta/recipes-core/eglibc/eglibc-2.19/add_resource_h_to_wait_h.patch
+++ b/meta/recipes-core/glibc/glibc/add_resource_h_to_wait_h.patch
@@ -6,11 +6,11 @@ Upstream-Status: Inapproriate [older kernel/perf specific]
Signed-off-by: Saul Wold <sgw@linux.intel.com>
-Index: libc/posix/sys/wait.h
+Index: git/posix/sys/wait.h
===================================================================
---- libc.orig/posix/sys/wait.h
-+++ libc/posix/sys/wait.h
-@@ -28,6 +28,7 @@
+--- git.orig/posix/sys/wait.h 2014-08-29 10:35:10.432070587 -0700
++++ git/posix/sys/wait.h 2014-08-29 10:35:10.424070587 -0700
+@@ -27,6 +27,7 @@
__BEGIN_DECLS
#include <signal.h>
diff --git a/meta/recipes-core/glibc/glibc/eglibc-header-bootstrap.patch b/meta/recipes-core/glibc/glibc/eglibc-header-bootstrap.patch
new file mode 100644
index 0000000000..e1aa13926a
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/eglibc-header-bootstrap.patch
@@ -0,0 +1,85 @@
+Taken from EGLIBC, r1484 + r1525
+
+ 2007-02-20 Jim Blandy <jimb@codesourcery.com>
+
+ * Makefile (install-headers): Preserve old behavior: depend on
+ $(inst_includedir)/gnu/stubs.h only if install-bootstrap-headers
+ is set; otherwise, place gnu/stubs.h on the 'install-others' list.
+
+ 2007-02-16 Jim Blandy <jimb@codesourcery.com>
+
+ * Makefile: Amend make install-headers to install everything
+ necessary for building a cross-compiler. Install gnu/stubs.h as
+ part of 'install-headers', not 'install-others'.
+ If install-bootstrap-headers is 'yes', install a dummy copy of
+ gnu/stubs.h, instead of computing the real thing.
+ * include/stubs-bootstrap.h: New file.
+
+Upstream-Status: Pending
+
+Index: git/Makefile
+===================================================================
+--- git.orig/Makefile 2014-08-27 18:35:18.908070587 +0000
++++ git/Makefile 2014-08-27 18:35:19.340070587 +0000
+@@ -69,9 +69,18 @@
+ vpath %.h $(subdir-dirs)
+
+ # What to install.
+-install-others = $(inst_includedir)/gnu/stubs.h
+ install-bin-script =
+
++# If we're bootstrapping, install a dummy gnu/stubs.h along with the
++# other headers, so 'make install-headers' produces a useable include
++# tree. Otherwise, install gnu/stubs.h later, after the rest of the
++# build is done.
++ifeq ($(install-bootstrap-headers),yes)
++install-headers: $(inst_includedir)/gnu/stubs.h
++else
++install-others = $(inst_includedir)/gnu/stubs.h
++endif
++
+ ifeq (yes,$(build-shared))
+ headers += gnu/lib-names.h
+ endif
+@@ -151,6 +160,16 @@
+
+ subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
+
++# gnu/stubs.h depends (via the subdir 'stubs' targets) on all the .o
++# files in EGLIBC. For bootstrapping a GCC/EGLIBC pair, an empty
++# gnu/stubs.h is good enough.
++ifeq ($(install-bootstrap-headers),yes)
++$(inst_includedir)/gnu/stubs.h: include/stubs-bootstrap.h $(+force)
++ $(make-target-directory)
++ $(INSTALL_DATA) $< $@
++
++installed-stubs =
++else
+ ifndef abi-variants
+ installed-stubs = $(inst_includedir)/gnu/stubs.h
+ else
+@@ -177,6 +196,7 @@
+
+ install-others-nosubdir: $(installed-stubs)
+ endif
++endif
+
+
+ # Since stubs.h is never needed when building the library, we simplify the
+Index: git/include/stubs-bootstrap.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/include/stubs-bootstrap.h 2014-08-27 18:35:19.340070587 +0000
+@@ -0,0 +1,12 @@
++/* Placeholder stubs.h file for bootstrapping.
++
++ When bootstrapping a GCC/EGLIBC pair, GCC requires that the EGLIBC
++ headers be installed, but we can't fully build EGLIBC without that
++ GCC. So we run the command:
++
++ make install-headers install-bootstrap-headers=yes
++
++ to install the headers GCC needs, but avoid building certain
++ difficult headers. The <gnu/stubs.h> header depends, via the
++ EGLIBC subdir 'stubs' make targets, on every .o file in EGLIBC, but
++ an empty stubs.h like this will do fine for GCC. */
diff --git a/meta/recipes-core/glibc/glibc/eglibc-install-pic-archives.patch b/meta/recipes-core/glibc/glibc/eglibc-install-pic-archives.patch
new file mode 100644
index 0000000000..9a31255b09
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/eglibc-install-pic-archives.patch
@@ -0,0 +1,109 @@
+2008-02-07 Joseph Myers <joseph@codesourcery.com>
+
+ * Makerules (install-extras, install-map): New variables.
+ (installed-libcs): Add libc_pic.a.
+ (install-lib): Include _pic.a files for versioned shared
+ libraries.
+ (install-map-nosubdir, install-extras-nosubdir): Add rules for
+ installing extra files.
+ (install-no-libc.a-nosubdir): Depend on install-map-nosubdir and
+ install-extras-nosubdir.
+
+
+2008-04-01 Maxim Kuvyrkov <maxim@codesourcery.com>
+
+ * Makerules (install-lib): Don't install libpthread_pic.a.
+ (install-map): Don't install libpthread_pic.map.
+
+Upstream-Status: Pending
+
+Index: git/Makerules
+===================================================================
+--- git.orig/Makerules 2014-08-27 18:49:22.552070587 +0000
++++ git/Makerules 2014-08-27 18:49:27.308070587 +0000
+@@ -612,6 +631,9 @@
+ $(common-objpfx)libc.so: $(common-objpfx)libc.map
+ endif
+ common-generated += libc.so libc_pic.os
++ifndef subdir
++install-extras := soinit.o sofini.o
++endif
+ ifdef libc.so-version
+ $(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
+ $(make-link)
+@@ -834,6 +856,7 @@
+ installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
+ $(inst_libdir)/$(patsubst %,$(libtype$o),\
+ $(libprefix)$(libc-name)))
++installed-libcs := $(installed-libcs) $(inst_libdir)/libc_pic.a
+ install: $(installed-libcs)
+ $(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
+ $(make-target-directory)
+@@ -862,6 +885,22 @@
+ install-lib.so-versioned := $(filter $(versioned), $(install-lib.so))
+ install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))
+
++# Install the _pic.a files for versioned libraries, and corresponding
++# .map files.
++# libpthread_pic.a breaks mklibs, so don't install it and its map.
++install-lib := $(install-lib) $(install-lib.so-versioned:%.so=%_pic.a)
++install-lib := $(filter-out libpthread_pic.a,$(install-lib))
++# Despite having a soname libhurduser and libmachuser do not use symbol
++# versioning, so don't install the corresponding .map files.
++ifeq ($(build-shared),yes)
++install-map := $(patsubst %.so,%.map,\
++ $(foreach L,$(install-lib.so-versioned),$(notdir $L)))
++install-map := $(filter-out libhurduser.map libmachuser.map libpthread.map,$(install-map))
++ifndef subdir
++install-map := $(install-map) libc.map
++endif
++endif
++
+ # 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
+@@ -1103,9 +1142,22 @@
+ endif # headers-nonh
+ endif # headers
+
++ifdef install-map
++$(addprefix $(inst_libdir)/,$(patsubst lib%.map,lib%_pic.map,$(install-map))): \
++ $(inst_libdir)/lib%_pic.map: $(common-objpfx)lib%.map $(+force)
++ $(do-install)
++endif
++
++ifdef install-extras
++$(addprefix $(inst_libdir)/libc_pic/,$(install-extras)): \
++ $(inst_libdir)/libc_pic/%.o: $(elfobjdir)/%.os $(+force)
++ $(do-install)
++endif
++
+ .PHONY: install-bin-nosubdir install-bin-script-nosubdir \
+ install-rootsbin-nosubdir install-sbin-nosubdir install-lib-nosubdir \
+- install-data-nosubdir install-headers-nosubdir
++ install-data-nosubdir install-headers-nosubdir install-map-nosubdir \
++ install-extras-nosubdir
+ install-bin-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin))
+ install-bin-script-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin-script))
+ install-rootsbin-nosubdir: \
+@@ -1118,6 +1170,10 @@
+ install-headers-nosubdir: $(addprefix $(inst_includedir)/,$(headers))
+ install-others-nosubdir: $(install-others)
+ install-others-programs-nosubdir: $(install-others-programs)
++install-map-nosubdir: $(addprefix $(inst_libdir)/,\
++ $(patsubst lib%.map,lib%_pic.map,$(install-map)))
++install-extras-nosubdir: $(addprefix $(inst_libdir)/libc_pic/,\
++ $(install-extras))
+
+ # We need all the `-nosubdir' targets so that `install' in the parent
+ # doesn't depend on several things which each iterate over the subdirs.
+@@ -1127,7 +1183,8 @@
+
+ .PHONY: install install-no-libc.a-nosubdir
+ install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir \
+- install-lib-nosubdir install-others-nosubdir
++ install-lib-nosubdir install-others-nosubdir \
++ install-map-nosubdir install-extras-nosubdir
+ ifeq ($(build-programs),yes)
+ install-no-libc.a-nosubdir: install-bin-nosubdir install-bin-script-nosubdir \
+ install-rootsbin-nosubdir install-sbin-nosubdir \
diff --git a/meta/recipes-core/glibc/glibc/eglibc-ppc8xx-cache-line-workaround.patch b/meta/recipes-core/glibc/glibc/eglibc-ppc8xx-cache-line-workaround.patch
new file mode 100644
index 0000000000..bb83d6d36e
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/eglibc-ppc8xx-cache-line-workaround.patch
@@ -0,0 +1,68 @@
+2007-06-13 Nathan Sidwell <nathan@codesourcery.com>
+ Mark Shinwell <shinwell@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/powerpc/libc-start.c
+ (__libc_start_main): Detect 8xx parts and clear
+ __cache_line_size if detected.
+ * sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
+ (DL_PLATFORM_AUXV): Likewise.
+
+Upstream-Status: Pending
+
+Index: git/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
+===================================================================
+--- git.orig/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c 2014-08-27 18:49:23.996070587 +0000
++++ git/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c 2014-08-27 18:49:27.332070587 +0000
+@@ -24,9 +24,21 @@
+ /* Scan the Aux Vector for the "Data Cache Block Size" entry. If found
+ verify that the static extern __cache_line_size is defined by checking
+ for not NULL. If it is defined then assign the cache block size
+- value to __cache_line_size. */
++ value to __cache_line_size. This is used by memset to
++ optimize setting to zero. We have to detect 8xx processors, which
++ have buggy dcbz implementations that cannot report page faults
++ correctly. That requires reading SPR, which is a privileged
++ operation. Fortunately 2.2.18 and later emulates PowerPC mfspr
++ reads from the PVR register. */
+ #define DL_PLATFORM_AUXV \
+ case AT_DCACHEBSIZE: \
++ if (__LINUX_KERNEL_VERSION >= 0x020218) \
++ { \
++ unsigned pvr = 0; \
++ asm ("mfspr %0, 287" : "=r" (pvr)); \
++ if ((pvr & 0xffff0000) == 0x00500000) \
++ break; \
++ } \
+ __cache_line_size = av->a_un.a_val; \
+ break;
+
+Index: git/sysdeps/unix/sysv/linux/powerpc/libc-start.c
+===================================================================
+--- git.orig/sysdeps/unix/sysv/linux/powerpc/libc-start.c 2014-08-27 18:49:23.996070587 +0000
++++ git/sysdeps/unix/sysv/linux/powerpc/libc-start.c 2014-08-27 18:49:27.332070587 +0000
+@@ -68,11 +68,24 @@
+ rtld_fini = NULL;
+ }
+
+- /* Initialize the __cache_line_size variable from the aux vector. */
++ /* Initialize the __cache_line_size variable from the aux vector.
++ This is used by memset to optimize setting to zero. We have to
++ detect 8xx processors, which have buggy dcbz implementations that
++ cannot report page faults correctly. That requires reading SPR,
++ which is a privileged operation. Fortunately 2.2.18 and later
++ emulates PowerPC mfspr reads from the PVR register. */
+ for (ElfW (auxv_t) * av = auxvec; av->a_type != AT_NULL; ++av)
+ switch (av->a_type)
+ {
+ case AT_DCACHEBSIZE:
++ if (__LINUX_KERNEL_VERSION >= 0x020218)
++ {
++ unsigned pvr = 0;
++
++ asm ("mfspr %0, 287" : "=r" (pvr) :);
++ if ((pvr & 0xffff0000) == 0x00500000)
++ break;
++ }
+ __cache_line_size = av->a_un.a_val;
+ break;
+ }
diff --git a/meta/recipes-core/glibc/glibc/eglibc-resolv-dynamic.patch b/meta/recipes-core/glibc/glibc/eglibc-resolv-dynamic.patch
new file mode 100644
index 0000000000..a73bcebe34
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/eglibc-resolv-dynamic.patch
@@ -0,0 +1,54 @@
+cherry-picked from http://www.eglibc.org/archives/patches/msg00772.html
+
+It hasnt yet been merged into glibc
+
+Signed-off-by: Khem Raj
+
+Upstream-Status: Pending
+
+Index: git/resolv/res_libc.c
+===================================================================
+--- git.orig/resolv/res_libc.c 2014-08-27 18:35:15.492070587 +0000
++++ git/resolv/res_libc.c 2014-08-27 18:35:19.204070587 +0000
+@@ -22,12 +22,13 @@
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+ #include <bits/libc-lock.h>
+-
++#include <sys/stat.h>
+
+ /* The following bit is copied from res_data.c (where it is #ifdef'ed
+ out) since res_init() should go into libc.so but the rest of that
+ file should not. */
+
++__libc_lock_define_initialized (static, lock);
+ extern unsigned long long int __res_initstamp attribute_hidden;
+ /* We have atomic increment operations on 64-bit platforms. */
+ #if __WORDSIZE == 64
+@@ -35,7 +36,6 @@
+ # define atomicincunlock(lock) (void) 0
+ # define atomicinc(var) catomic_increment (&(var))
+ #else
+-__libc_lock_define_initialized (static, lock);
+ # define atomicinclock(lock) __libc_lock_lock (lock)
+ # define atomicincunlock(lock) __libc_lock_unlock (lock)
+ # define atomicinc(var) ++var
+@@ -94,7 +94,18 @@
+ int
+ __res_maybe_init (res_state resp, int preinit)
+ {
++ static time_t last_mtime;
++ struct stat statbuf;
++ int ret;
++
+ if (resp->options & RES_INIT) {
++ ret = stat (_PATH_RESCONF, &statbuf);
++ __libc_lock_lock (lock);
++ if ((ret == 0) && (last_mtime != statbuf.st_mtime)) {
++ last_mtime = statbuf.st_mtime;
++ atomicinc (__res_initstamp);
++ }
++ __libc_lock_unlock (lock);
+ if (__res_initstamp != resp->_u._ext.initstamp) {
+ if (resp->nscount > 0)
+ __res_iclose (resp, true);
diff --git a/meta/recipes-core/glibc/glibc/eglibc-sh4-fpscr_values.patch b/meta/recipes-core/glibc/glibc/eglibc-sh4-fpscr_values.patch
new file mode 100644
index 0000000000..bfb813eb7c
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/eglibc-sh4-fpscr_values.patch
@@ -0,0 +1,42 @@
+2010-09-29 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ Andrew Stubbs <ams@codesourcery.com>
+
+ Resolve SH's __fpscr_values to symbol in libc.so.
+
+ * sysdeps/sh/sh4/fpu/fpu_control.h: Add C++ __set_fpscr prototype.
+ * sysdeps/unix/sysv/linux/sh/Versions (GLIBC_2.2): Add __fpscr_values.
+ * sysdeps/unix/sysv/linux/sh/sysdep.S (___fpscr_values): New constant.
+
+Upstream-Status: Pending
+
+Index: git/sysdeps/unix/sysv/linux/sh/sysdep.S
+===================================================================
+--- git.orig/sysdeps/unix/sysv/linux/sh/sysdep.S 2014-08-27 18:49:24.036070587 +0000
++++ git/sysdeps/unix/sysv/linux/sh/sysdep.S 2014-08-27 18:49:27.332070587 +0000
+@@ -30,3 +30,14 @@
+
+ #define __syscall_error __syscall_error_1
+ #include <sysdeps/unix/sh/sysdep.S>
++
++ .data
++ .align 3
++ .globl ___fpscr_values
++ .type ___fpscr_values, @object
++ .size ___fpscr_values, 8
++___fpscr_values:
++ .long 0
++ .long 0x80000
++weak_alias (___fpscr_values, __fpscr_values)
++
+Index: git/sysdeps/unix/sysv/linux/sh/Versions
+===================================================================
+--- git.orig/sysdeps/unix/sysv/linux/sh/Versions 2014-08-27 18:49:24.028070587 +0000
++++ git/sysdeps/unix/sysv/linux/sh/Versions 2014-08-27 18:49:27.332070587 +0000
+@@ -2,6 +2,7 @@
+ GLIBC_2.2 {
+ # functions used in other libraries
+ __xstat64; __fxstat64; __lxstat64;
++ __fpscr_values;
+
+ # a*
+ alphasort64;
diff --git a/meta/recipes-core/glibc/glibc/eglibc-use-option-groups.patch b/meta/recipes-core/glibc/glibc/eglibc-use-option-groups.patch
new file mode 100644
index 0000000000..439b4a95f6
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/eglibc-use-option-groups.patch
@@ -0,0 +1,16651 @@
+Forward port eglibc options groups support
+
+Upstream-Status: Pending
+
+Index: git/argp/argp-fmtstream.c
+===================================================================
+--- git.orig/argp/argp-fmtstream.c
++++ git/argp/argp-fmtstream.c
+@@ -42,6 +42,7 @@
+ #ifdef _LIBC
+ # include <wchar.h>
+ # include <libio/libioP.h>
++# include <gnu/option-groups.h>
+ # define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a)
+ #endif
+
+@@ -100,7 +101,11 @@ __argp_fmtstream_free (argp_fmtstream_t
+ __argp_fmtstream_update (fs);
+ if (fs->p > fs->buf)
+ {
++#ifdef _LIBC
+ __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
++#else
++ fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
++#endif
+ }
+ free (fs->buf);
+ free (fs);
+@@ -145,9 +150,17 @@ __argp_fmtstream_update (argp_fmtstream_
+ size_t i;
+ for (i = 0; i < pad; i++)
+ {
++#ifdef _LIBC
+ if (_IO_fwide (fs->stream, 0) > 0)
+- putwc_unlocked (L' ', fs->stream);
++ {
++#if ! _LIBC || __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
++ putwc_unlocked (L' ', fs->stream);
++#else
++ abort ();
++#endif
++ }
+ else
++#endif
+ putc_unlocked (' ', fs->stream);
+ }
+ }
+@@ -308,9 +321,17 @@ __argp_fmtstream_update (argp_fmtstream_
+ *nl++ = ' ';
+ else
+ for (i = 0; i < fs->wmargin; ++i)
++#ifdef _LIBC
+ if (_IO_fwide (fs->stream, 0) > 0)
+- putwc_unlocked (L' ', fs->stream);
++ {
++#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
++ putwc_unlocked (L' ', fs->stream);
++#else
++ abort ();
++#endif
++ }
+ else
++#endif
+ putc_unlocked (' ', fs->stream);
+
+ /* Copy the tail of the original buffer into the current buffer
+Index: git/argp/argp-help.c
+===================================================================
+--- git.orig/argp/argp-help.c
++++ git/argp/argp-help.c
+@@ -51,6 +51,7 @@ char *alloca ();
+ #ifdef _LIBC
+ # include <../libio/libioP.h>
+ # include <wchar.h>
++# include <gnu/option-groups.h>
+ #endif
+
+ #ifndef _
+@@ -1702,7 +1703,7 @@ char *__argp_basename (char *name)
+ }
+
+ char *
+-__argp_short_program_name (void)
++(__argp_short_program_name) (void)
+ {
+ # if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
+ return program_invocation_short_name;
+@@ -1873,9 +1874,17 @@ __argp_failure (const struct argp_state
+ #endif
+ }
+
++#ifdef _LIBC
+ if (_IO_fwide (stream, 0) > 0)
+- putwc_unlocked (L'\n', stream);
++ {
++#if ! _LIBC || __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
++ putwc_unlocked (L'\n', stream);
++#else
++ abort ();
++#endif
++ }
+ else
++#endif
+ putc_unlocked ('\n', stream);
+
+ #if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
+Index: git/argp/argp-namefrob.h
+===================================================================
+--- git.orig/argp/argp-namefrob.h
++++ git/argp/argp-namefrob.h
+@@ -76,10 +76,12 @@
+ #undef __argp_fmtstream_wmargin
+ #define __argp_fmtstream_wmargin argp_fmtstream_wmargin
+
++#if 0
+ #include "mempcpy.h"
+ #include "strcase.h"
+ #include "strchrnul.h"
+ #include "strndup.h"
++#endif
+
+ /* normal libc functions we call */
+ #undef __flockfile
+Index: git/argp/Makefile
+===================================================================
+--- git.orig/argp/Makefile
++++ git/argp/Makefile
+@@ -18,6 +18,8 @@
+ #
+ # Makefile for argp.
+ #
++include ../option-groups.mak
++
+ subdir := argp
+
+ include ../Makeconfig
+Index: git/catgets/Makefile
+===================================================================
+--- git.orig/catgets/Makefile
++++ git/catgets/Makefile
+@@ -22,20 +22,23 @@ subdir := catgets
+
+ include ../Makeconfig
+
++include ../option-groups.mak
++
+ headers = nl_types.h
+-routines = catgets open_catalog
+-others = gencat
+-install-bin = gencat
+-extra-objs = $(gencat-modules:=.o)
++routines-$(OPTION_EGLIBC_CATGETS) := catgets open_catalog
++others-$(OPTION_EGLIBC_CATGETS) := gencat
++install-bin-$(OPTION_EGLIBC_CATGETS) := gencat
++extra-objs-$(OPTION_EGLIBC_CATGETS) := $(gencat-modules:=.o)
+
+-tests = tst-catgets
+-test-srcs = test-gencat
++tests-$(OPTION_EGLIBC_CATGETS) := tst-catgets
++test-srcs-$(OPTION_EGLIBC_CATGETS) := test-gencat
+
++ifeq (y,$(OPTION_EGLIBC_CATGETS))
+ ifeq ($(run-built-tests),yes)
+ tests-special += $(objpfx)de/libc.cat $(objpfx)test1.cat $(objpfx)test2.cat \
+ $(objpfx)sample.SJIS.cat $(objpfx)test-gencat.out
+ endif
+-
++endif
+ gencat-modules = xmalloc
+
+ # To find xmalloc.c
+Index: git/crypt/crypt-entry.c
+===================================================================
+--- git.orig/crypt/crypt-entry.c
++++ git/crypt/crypt-entry.c
+@@ -27,6 +27,7 @@
+ #include <stdio.h>
+ #endif
+ #include <string.h>
++#include <gnu/option-groups.h>
+ #include <errno.h>
+ #include <fips-private.h>
+
+@@ -76,9 +77,11 @@ __crypt_r (key, salt, data)
+ const char *salt;
+ struct crypt_data * __restrict data;
+ {
++#if __OPTION_EGLIBC_CRYPT_UFC
+ ufc_long res[4];
+ char ktab[9];
+ ufc_long xx = 25; /* to cope with GCC long long compiler bugs */
++#endif /*__OPTION_EGLIBC_CRYPT_UFC*/
+
+ #ifdef _LIBC
+ /* Try to find out whether we have to use MD5 encryption replacement. */
+@@ -105,6 +108,7 @@ __crypt_r (key, salt, data)
+ sizeof (struct crypt_data));
+ #endif
+
++#if __OPTION_EGLIBC_CRYPT_UFC
+ /*
+ * Hack DES tables according to salt
+ */
+@@ -144,6 +148,10 @@ __crypt_r (key, salt, data)
+ */
+ _ufc_output_conversion_r (res[0], res[1], salt, data);
+ return data->crypt_3_buf;
++#else /* __OPTION_EGLIBC_CRYPT_UFC */
++ __set_errno (ENOSYS);
++ return NULL;
++#endif /* __OPTION_EGLIBC_CRYPT_UFC */
+ }
+ weak_alias (__crypt_r, crypt_r)
+
+@@ -168,7 +176,12 @@ crypt (key, salt)
+ return __sha512_crypt (key, salt);
+ #endif
+
++#if __OPTION_EGLIBC_CRYPT_UFC
+ return __crypt_r (key, salt, &_ufc_foobar);
++#else /* __OPTION_EGLIBC_CRYPT_UFC */
++ __set_errno (ENOSYS);
++ return NULL;
++#endif /* __OPTION_EGLIBC_CRYPT_UFC */
+ }
+
+
+Index: git/crypt/Makefile
+===================================================================
+--- git.orig/crypt/Makefile
++++ git/crypt/Makefile
+@@ -18,21 +18,25 @@
+ #
+ # Sub-makefile for crypt() portion of the library.
+ #
++include ../option-groups.mak
++
+ subdir := crypt
+
+ include ../Makeconfig
+
+ headers := crypt.h
+
+-extra-libs := libcrypt
+-extra-libs-others := $(extra-libs)
++extra-libs-$(OPTION_EGLIBC_CRYPT) := libcrypt
++extra-libs-others-y := $(extra-libs-y)
+
+-libcrypt-routines := crypt-entry md5-crypt sha256-crypt sha512-crypt crypt \
+- crypt_util
++libcrypt-routines :=crypt-entry md5-crypt sha256-crypt sha512-crypt crypt_common
++libcrypt-routines-$(OPTION_EGLIBC_CRYPT_UFC) := crypt crypt_util
++libcrypt-routines += $(libcrypt-routines-y)
+
+-tests := cert md5c-test sha256c-test sha512c-test badsalttest
++tests-$(OPTION_EGLIBC_CRYPT) := md5c-test sha256c-test sha512c-test badsalttest
++tests-$(OPTION_EGLIBC_CRYPT_UFC) += cert
+
+-ifeq ($(crypt-in-libc),yes)
++ifeq ($(crypt-in-libc)$(OPTION_EGLIBC_CRYPT),yesy)
+ routines += $(libcrypt-routines)
+ endif
+
+@@ -44,7 +48,7 @@ LDLIBS-crypt.so = -lfreebl3
+ else
+ libcrypt-routines += md5 sha256 sha512
+
+-tests += md5test sha256test sha512test
++tests-$(OPTION_EGLIBC_CRYPT) += md5test sha256test sha512test
+
+ # The test md5test-giant uses up to 400 MB of RSS and runs on a fast
+ # machine over a minute.
+@@ -64,8 +68,10 @@ $(objpfx)sha256test: $(patsubst %, $(obj
+ $(objpfx)sha512test: $(patsubst %, $(objpfx)%.o,$(sha512-routines))
+ endif
+
++ifeq ($(OPTION_EGLIBC_CRYPT),y)
+ ifeq (yes,$(build-shared))
+ $(addprefix $(objpfx),$(tests)): $(objpfx)libcrypt.so
+ else
+ $(addprefix $(objpfx),$(tests)): $(objpfx)libcrypt.a
+ endif
++endif # eglibc: OPTION_EGLIBC_CRYPT
+Index: git/csu/Makefile
+===================================================================
+--- git.orig/csu/Makefile
++++ git/csu/Makefile
+@@ -22,6 +22,8 @@
+ # crtn.o, special "initializer" and "finalizer" files used in the link
+ # to make the .init and .fini sections work right.
+
++include ../option-groups.mak
++
+ subdir := csu
+
+ include ../Makeconfig
+Index: git/debug/Makefile
+===================================================================
+--- git.orig/debug/Makefile
++++ git/debug/Makefile
+@@ -18,6 +18,8 @@
+ #
+ # Sub-makefile for debug portion of the library.
+ #
++include ../option-groups.mak
++
+ subdir := debug
+
+ include ../Makeconfig
+@@ -27,7 +29,7 @@ headers := execinfo.h
+ # Note that ptsname_r_chk and getlogin_r are not here, but in
+ # login/Makefile instead. If that subdir is omitted from the
+ # build, its _FORTIFY_SOURCE support will be too.
+-routines = backtrace backtracesyms backtracesymsfd noophooks \
++routines = noophooks \
+ memcpy_chk memmove_chk mempcpy_chk memset_chk stpcpy_chk \
+ strcat_chk strcpy_chk strncat_chk strncpy_chk stpncpy_chk \
+ sprintf_chk vsprintf_chk snprintf_chk vsnprintf_chk \
+@@ -36,20 +38,27 @@ routines = backtrace backtracesyms back
+ read_chk pread_chk pread64_chk recv_chk recvfrom_chk \
+ readlink_chk readlinkat_chk getwd_chk getcwd_chk \
+ realpath_chk fread_chk fread_u_chk \
+- wctomb_chk wcscpy_chk wmemcpy_chk wmemmove_chk wmempcpy_chk \
+- wcpcpy_chk wcsncpy_chk wcscat_chk wcsncat_chk wmemset_chk \
+- wcpncpy_chk \
+- swprintf_chk vswprintf_chk wprintf_chk fwprintf_chk \
+- vwprintf_chk vfwprintf_chk fgetws_chk fgetws_u_chk \
+ confstr_chk getgroups_chk ttyname_r_chk \
+- gethostname_chk getdomainname_chk wcrtomb_chk mbsnrtowcs_chk \
+- wcsnrtombs_chk mbsrtowcs_chk wcsrtombs_chk mbstowcs_chk \
+- wcstombs_chk asprintf_chk vasprintf_chk dprintf_chk \
++ gethostname_chk getdomainname_chk \
++ asprintf_chk vasprintf_chk dprintf_chk \
+ vdprintf_chk obprintf_chk \
+ longjmp_chk ____longjmp_chk \
+ fdelt_chk poll_chk ppoll_chk \
+ stack_chk_fail fortify_fail \
+ $(static-only-routines)
++routines-$(OPTION_EGLIBC_BACKTRACE) += backtrace backtracesyms backtracesymsfd
++routines-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
++ += wprintf_chk fwprintf_chk \
++ vwprintf_chk vfwprintf_chk fgetws_chk fgetws_u_chk
++routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
++ += wctomb_chk wcscpy_chk wmemcpy_chk wmemmove_chk wmempcpy_chk \
++ wcpcpy_chk wcsncpy_chk wcscat_chk wcsncat_chk wmemset_chk \
++ wcpncpy_chk \
++ swprintf_chk vswprintf_chk \
++ wcrtomb_chk mbsnrtowcs_chk \
++ wcsnrtombs_chk mbsrtowcs_chk wcsrtombs_chk mbstowcs_chk \
++ wcstombs_chk
++
+ static-only-routines := warning-nop stack_chk_fail_local
+
+ CFLAGS-backtrace.c = -fno-omit-frame-pointer
+@@ -131,11 +140,15 @@ LDFLAGS-tst-backtrace4 = -rdynamic
+ LDFLAGS-tst-backtrace5 = -rdynamic
+ LDFLAGS-tst-backtrace6 = -rdynamic
+
+-tests = backtrace-tst tst-longjmp_chk tst-chk1 tst-chk2 tst-chk3 \
+- tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk \
+- tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6 \
+- tst-longjmp_chk2 tst-backtrace2 tst-backtrace3 tst-backtrace4 \
+- tst-backtrace5 tst-backtrace6
++tests = tst-longjmp_chk test-strcpy_chk test-stpcpy_chk tst-longjmp_chk2
++tests-$(OPTION_EGLIBC_LOCALE_CODE) \
++ += tst-chk1 tst-chk2 tst-chk3 tst-lfschk1 tst-lfschk2 tst-lfschk3
++tests-$(OPTION_EGLIBC_BACKTRACE) \
++ += backtrace-tst tst-backtrace2 tst-backtrace3 tst-backtrace4 \
++ tst-backtrace5 tst-backtrace6
++ifeq (yy,$(OPTION_EGLIBC_LOCALE_CODE)$(OPTION_EGLIBC_CXX_TESTS))
++tests += tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6
++endif
+
+ extra-libs = libSegFault libpcprofile
+ extra-libs-others = $(extra-libs)
+Index: git/debug/segfault.c
+===================================================================
+--- git.orig/debug/segfault.c
++++ git/debug/segfault.c
+@@ -30,6 +30,7 @@
+ #include <unistd.h>
+ #include <_itoa.h>
+ #include <ldsodefs.h>
++#include <gnu/option-groups.h>
+
+ /* This file defines macros to access the content of the sigcontext element
+ passed up by the signal handler. */
+@@ -68,11 +69,13 @@ write_strsignal (int fd, int signal)
+ static void
+ catch_segfault (int signal, SIGCONTEXT ctx)
+ {
+- int fd, cnt, i;
+- void **arr;
++ int fd;
+ struct sigaction sa;
++#if __OPTION_EGLIBC_BACKTRACE
++ int cnt, i;
++ void **arr;
+ uintptr_t pc;
+-
++#endif
+ /* This is the name of the file we are writing to. If none is given
+ or we cannot write to this file write to stderr. */
+ fd = 2;
+@@ -91,6 +94,7 @@ catch_segfault (int signal, SIGCONTEXT c
+ REGISTER_DUMP;
+ #endif
+
++#if __OPTION_EGLIBC_BACKTRACE
+ WRITE_STRING ("\nBacktrace:\n");
+
+ /* Get the backtrace. */
+@@ -113,6 +117,7 @@ catch_segfault (int signal, SIGCONTEXT c
+
+ /* Now generate nicely formatted output. */
+ __backtrace_symbols_fd (arr + i, cnt - i, fd);
++#endif
+
+ #ifdef HAVE_PROC_SELF
+ /* Now the link map. */
+Index: git/debug/tst-chk1.c
+===================================================================
+--- git.orig/debug/tst-chk1.c
++++ git/debug/tst-chk1.c
+@@ -31,6 +31,7 @@
+ #include <sys/select.h>
+ #include <sys/socket.h>
+ #include <sys/un.h>
++#include <gnu/option-groups.h>
+
+
+ #define obstack_chunk_alloc malloc
+@@ -307,6 +308,7 @@ do_test (void)
+ snprintf (buf + 8, l0 + 3, "%d", num2);
+ CHK_FAIL_END
+
++#if __OPTION_POSIX_C_LANG_WIDE_CHAR
+ CHK_FAIL_START
+ swprintf (wbuf + 8, 3, L"%d", num1);
+ CHK_FAIL_END
+@@ -314,6 +316,7 @@ do_test (void)
+ CHK_FAIL_START
+ swprintf (wbuf + 8, l0 + 3, L"%d", num1);
+ CHK_FAIL_END
++#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
+ # endif
+
+ memcpy (buf, str1 + 2, l0 + 9);
+@@ -381,6 +384,7 @@ do_test (void)
+ CHK_FAIL_END
+ #endif
+
++#if __OPTION_POSIX_C_LANG_WIDE_CHAR
+
+ /* These ops can be done without runtime checking of object size. */
+ wmemcpy (wbuf, L"abcdefghij", 10);
+@@ -605,6 +609,7 @@ do_test (void)
+ CHK_FAIL_END
+ #endif
+
++#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
+
+ /* Now checks for %n protection. */
+
+@@ -1192,6 +1197,7 @@ do_test (void)
+ # endif
+ #endif
+
++#if __OPTION_POSIX_C_LANG_WIDE_CHAR
+ if (setlocale (LC_ALL, "de_DE.UTF-8") != NULL)
+ {
+ assert (MB_CUR_MAX <= 10);
+@@ -1348,6 +1354,7 @@ do_test (void)
+ puts ("cannot set locale");
+ ret = 1;
+ }
++#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
+
+ int fd = posix_openpt (O_RDWR);
+ if (fd != -1)
+Index: git/dlfcn/Makefile
+===================================================================
+--- git.orig/dlfcn/Makefile
++++ git/dlfcn/Makefile
+@@ -15,6 +15,8 @@
+ # License along with the GNU C Library; if not, see
+ # <http://www.gnu.org/licenses/>.
+
++include ../option-groups.mak
++
+ subdir := dlfcn
+
+ include ../Makeconfig
+@@ -36,8 +38,11 @@ endif
+ ifeq (yes,$(build-shared))
+ tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
+ bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \
+- bug-atexit3 tstatexit bug-dl-leaf tst-rec-dlopen
++ tstatexit bug-dl-leaf tst-rec-dlopen
+ endif
++
++tests-$(OPTION_EGLIBC_CXX_TESTS) += bug-atexit3
++
+ modules-names = glreflib1 glreflib2 glreflib3 failtestmod defaultmod1 \
+ defaultmod2 errmsg1mod modatexit modcxaatexit \
+ bug-dlsym1-lib1 bug-dlsym1-lib2 bug-atexit1-lib \
+Index: git/elf/dl-support.c
+===================================================================
+--- git.orig/elf/dl-support.c
++++ git/elf/dl-support.c
+@@ -19,6 +19,7 @@
+ /* This file defines some things that for the dynamic linker are defined in
+ rtld.c and dl-sysdep.c in ways appropriate to bootstrap dynamic linking. */
+
++#include <gnu/option-groups.h>
+ #include <errno.h>
+ #include <libintl.h>
+ #include <stdlib.h>
+@@ -42,7 +43,9 @@ char **_dl_argv = &__progname; /* This i
+ const char *_dl_platform;
+ size_t _dl_platformlen;
+
++#if __OPTION_EGLIBC_RTLD_DEBUG
+ int _dl_debug_mask;
++#endif
+ int _dl_lazy;
+ ElfW(Addr) _dl_use_load_bias = -2;
+ int _dl_dynamic_weak;
+Index: git/elf/rtld.c
+===================================================================
+--- git.orig/elf/rtld.c
++++ git/elf/rtld.c
+@@ -16,6 +16,7 @@
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
++#include <gnu/option-groups.h>
+ #include <errno.h>
+ #include <dlfcn.h>
+ #include <fcntl.h>
+@@ -2200,6 +2201,7 @@ print_missing_version (int errcode __att
+ objname, errstring);
+ }
+
++#if __OPTION_EGLIBC_RTLD_DEBUG
+ /* Nonzero if any of the debugging options is enabled. */
+ static int any_debug attribute_relro;
+
+@@ -2309,6 +2311,7 @@ a filename can be specified using the LD
+ _exit (0);
+ }
+ }
++#endif /* __OPTION_EGLIBC_RTLD_DEBUG */
+
+ static void
+ process_dl_audit (char *str)
+@@ -2348,8 +2351,9 @@ process_envvars (enum mode *modep)
+ char **runp = _environ;
+ char *envline;
+ enum mode mode = normal;
++#if __OPTION_EGLIBC_RTLD_DEBUG
+ char *debug_output = NULL;
+-
++#endif
+ /* This is the default place for profiling data file. */
+ GLRO(dl_profile_output)
+ = &"/var/tmp\0/var/profile"[__libc_enable_secure ? 9 : 0];
+@@ -2376,12 +2380,14 @@ process_envvars (enum mode *modep)
+ break;
+
+ case 5:
++#if __OPTION_EGLIBC_RTLD_DEBUG
+ /* Debugging of the dynamic linker? */
+ if (memcmp (envline, "DEBUG", 5) == 0)
+ {
+ process_dl_debug (&envline[6]);
+ break;
+ }
++#endif
+ if (memcmp (envline, "AUDIT", 5) == 0)
+ process_dl_audit (&envline[6]);
+ break;
+@@ -2447,13 +2453,14 @@ process_envvars (enum mode *modep)
+ break;
+ }
+
++#if __OPTION_EGLIBC_RTLD_DEBUG
+ /* Where to place the profiling data file. */
+ if (memcmp (envline, "DEBUG_OUTPUT", 12) == 0)
+ {
+ debug_output = &envline[13];
+ break;
+ }
+-
++#endif
+ if (!__libc_enable_secure
+ && memcmp (envline, "DYNAMIC_WEAK", 12) == 0)
+ GLRO(dl_dynamic_weak) = 1;
+@@ -2490,7 +2497,9 @@ process_envvars (enum mode *modep)
+ {
+ mode = trace;
+ GLRO(dl_verbose) = 1;
++#if __OPTION_EGLIBC_RTLD_DEBUG
+ GLRO_dl_debug_mask |= DL_DEBUG_PRELINK;
++#endif
+ GLRO(dl_trace_prelink) = &envline[17];
+ }
+ break;
+@@ -2537,12 +2546,15 @@ process_envvars (enum mode *modep)
+ if (__access ("/etc/suid-debug", F_OK) != 0)
+ {
+ unsetenv ("MALLOC_CHECK_");
++#if __OPTION_EGLIBC_RTLD_DEBUG
+ GLRO_dl_debug_mask = 0;
++#endif
+ }
+
+ if (mode != normal)
+ _exit (5);
+ }
++#if __OPTION_EGLIBC_RTLD_DEBUG
+ /* If we have to run the dynamic linker in debugging mode and the
+ LD_DEBUG_OUTPUT environment variable is given, we write the debug
+ messages to this file. */
+@@ -2567,6 +2579,7 @@ process_envvars (enum mode *modep)
+ /* We use standard output if opening the file failed. */
+ GLRO(dl_debug_fd) = STDOUT_FILENO;
+ }
++#endif /* __OPTION_EGLIBC_RTLD_DEBUG */
+ }
+
+
+Index: git/extra-lib.mk
+===================================================================
+--- git.orig/extra-lib.mk
++++ git/extra-lib.mk
+@@ -25,7 +25,9 @@ install-lib := $(install-lib)
+ extra-objs := $(extra-objs)
+
+ # The modules that go in $(lib).
+-all-$(lib)-routines := $($(lib)-routines) $($(lib)-sysdep_routines)
++all-$(lib)-routines := $($(lib)-routines) \
++ $($(lib)-routines-y) \
++ $($(lib)-sysdep_routines)
+
+ # Add each flavor of library to the lists of things to build and install.
+ install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o)))
+@@ -101,7 +103,7 @@ endif
+ endif
+
+ # This will define `libof-ROUTINE := LIB' for each of the routines.
+-cpp-srcs-left := $($(lib)-routines) $($(lib)-sysdep_routines)
++cpp-srcs-left := $(all-$(lib)-routines)
+ ifneq (,$(cpp-srcs-left))
+ include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+ endif
+Index: git/grp/Makefile
+===================================================================
+--- git.orig/grp/Makefile
++++ git/grp/Makefile
+@@ -18,6 +18,8 @@
+ #
+ # Sub-makefile for grp portion of the library.
+ #
++include ../option-groups.mak
++
+ subdir := grp
+
+ include ../Makeconfig
+@@ -29,6 +31,9 @@ routines := fgetgrent initgroups setgrou
+ getgrent_r getgrgid_r getgrnam_r fgetgrent_r
+
+ tests := testgrp
++ifneq (y,$(OPTION_EGLIBC_NSSWITCH))
++LDLIBS-testgrp += $(shell cat $(common-objpfx)nss/fixed-nsswitch-libs)
++endif
+
+ ifeq (yes,$(build-shared))
+ test-srcs := tst_fgetgrent
+Index: git/hesiod/Makefile
+===================================================================
+--- git.orig/hesiod/Makefile
++++ git/hesiod/Makefile
+@@ -18,12 +18,14 @@
+ #
+ # Sub-makefile for hesiod portion of the library.
+ #
++include ../option-groups.mak
++
+ subdir := hesiod
+
+ include ../Makeconfig
+
+-extra-libs := libnss_hesiod
+-extra-libs-others = $(extra-libs)
++extra-libs-$(OPTION_EGLIBC_INET) += libnss_hesiod
++extra-libs-others-y += $(extra-libs-y)
+
+ subdir-dirs = nss_hesiod
+ vpath %.c nss_hesiod
+Index: git/iconv/gconv_db.c
+===================================================================
+--- git.orig/iconv/gconv_db.c
++++ git/iconv/gconv_db.c
+@@ -25,6 +25,7 @@
+ #include <sys/param.h>
+ #include <bits/libc-lock.h>
+ #include <locale/localeinfo.h>
++#include <gnu/option-groups.h>
+
+ #include <dlfcn.h>
+ #include <gconv_int.h>
+@@ -828,9 +829,11 @@ free_modules_db (struct gconv_module *no
+ /* Free all resources if necessary. */
+ libc_freeres_fn (free_mem)
+ {
++#if __OPTION_EGLIBC_LOCALE_CODE
+ /* First free locale memory. This needs to be done before freeing derivations,
+ as ctype cleanup functions dereference steps arrays which we free below. */
+ _nl_locale_subfreeres ();
++#endif
+
+ /* finddomain.c has similar problem. */
+ extern void _nl_finddomain_subfreeres (void) attribute_hidden;
+Index: git/iconv/gconv_trans.c
+===================================================================
+--- git.orig/iconv/gconv_trans.c
++++ git/iconv/gconv_trans.c
+@@ -23,6 +23,7 @@
+ #include <stdint.h>
+ #include <string.h>
+ #include <stdlib.h>
++#include <gnu/option-groups.h>
+
+ #include <bits/libc-lock.h>
+ #include "gconv_int.h"
+@@ -38,15 +39,19 @@ __gconv_transliterate (struct __gconv_st
+ unsigned char **outbufstart, size_t *irreversible)
+ {
+ /* Find out about the locale's transliteration. */
++#if __OPTION_EGLIBC_LOCALE_CODE
+ uint_fast32_t size;
+ const uint32_t *from_idx;
+ const uint32_t *from_tbl;
+ const uint32_t *to_idx;
+ const uint32_t *to_tbl;
++#endif
+ const uint32_t *winbuf;
+ const uint32_t *winbufend;
++#if __OPTION_EGLIBC_LOCALE_CODE
+ uint_fast32_t low;
+ uint_fast32_t high;
++#endif
+
+ /* The input buffer. There are actually 4-byte values. */
+ winbuf = (const uint32_t *) *inbufp;
+@@ -58,6 +63,7 @@ __gconv_transliterate (struct __gconv_st
+ PTR_DEMANGLE (fct);
+ #endif
+
++#if __OPTION_EGLIBC_LOCALE_CODE
+ /* If there is no transliteration information in the locale don't do
+ anything and return the error. */
+ size = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_TRANSLIT_TAB_SIZE);
+@@ -193,6 +199,7 @@ __gconv_transliterate (struct __gconv_st
+ sorted. */
+ break;
+ }
++#endif
+
+ /* One last chance: use the default replacement. */
+ if (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN) != 0)
+Index: git/iconv/iconv_prog.c
+===================================================================
+--- git.orig/iconv/iconv_prog.c
++++ git/iconv/iconv_prog.c
+@@ -35,6 +35,7 @@
+ #ifdef _POSIX_MAPPED_FILES
+ # include <sys/mman.h>
+ #endif
++#include <gnu/option-groups.h>
+ #include <charmap.h>
+ #include <gconv_int.h>
+ #include "iconv_prog.h"
+@@ -221,10 +222,17 @@ main (int argc, char *argv[])
+ bool to_wrong =
+ (iconv_open (to_code, "UTF-8") == (iconv_t) -1
+ && errno == EINVAL);
++#if __OPTION_EGLIBC_LOCALE_CODE
+ const char *from_pretty =
+ (from_code[0] ? from_code : nl_langinfo (CODESET));
+ const char *to_pretty =
+ (orig_to_code[0] ? orig_to_code : nl_langinfo (CODESET));
++#else
++ const char *from_pretty =
++ (from_code[0] ? from_code : "ANSI_X3.4-1968");
++ const char *to_pretty =
++ (orig_to_code[0] ? orig_to_code : "ANSI_X3.4-1968");
++#endif
+
+ if (from_wrong)
+ {
+Index: git/iconv/Makefile
+===================================================================
+--- git.orig/iconv/Makefile
++++ git/iconv/Makefile
+@@ -18,6 +18,8 @@
+ #
+ # Makefile for iconv.
+ #
++include ../option-groups.mak
++
+ subdir := iconv
+
+ include ../Makeconfig
+@@ -39,6 +41,11 @@ CFLAGS-iconv_charmap.c = -I../locale/pro
+ CFLAGS-dummy-repertoire.c = -I../locale/programs
+ CFLAGS-charmap.c = -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
+ -DDEFAULT_CHARMAP=null_pointer -DNEED_NULL_POINTER
++
++ifneq (y,$(OPTION_EGLIBC_SPAWN))
++CFLAGS-charmap-dir.c += -DNO_UNCOMPRESS
++endif
++
+ CFLAGS-linereader.c = -DNO_TRANSLITERATION
+ CFLAGS-simple-hash.c = -I../locale
+
+Index: git/iconvdata/Makefile
+===================================================================
+--- git.orig/iconvdata/Makefile
++++ git/iconvdata/Makefile
+@@ -18,12 +18,15 @@
+ #
+ # Makefile for iconv data and code.
+ #
++include ../option-groups.mak
++
+ subdir := iconvdata
+
+ include ../Makeconfig
+
+ # Names of all the shared objects which implement the transformations.
+-modules := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \
++modules-$(OPTION_EGLIBC_CHARSETS) \
++ := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \
+ ISO8859-6 ISO8859-7 ISO8859-8 ISO8859-9 ISO8859-10 \
+ ISO8859-11 ISO8859-13 ISO8859-14 ISO8859-15 ISO8859-16 \
+ T.61 ISO_6937 SJIS KOI-8 HP-ROMAN8 HP-ROMAN9 EBCDIC-AT-DE \
+@@ -63,11 +66,13 @@ modules := ISO8859-1 ISO8859-2 ISO8859-3
+ MAC-CENTRALEUROPE KOI8-RU ISO8859-9E \
+ CP770 CP771 CP772 CP773 CP774
+
+-modules.so := $(addsuffix .so, $(modules))
++modules.so := $(addsuffix .so, $(modules-y))
+
+ ifeq (yes,$(build-shared))
+ tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
+- tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9
++ tst-iconv6 bug-iconv5 bug-iconv8 bug-iconv9
++tests-$(OPTION_EGLIBC_LOCALE_CODE) += bug-iconv6 tst-iconv7
++
+ ifeq ($(have-thread-library),yes)
+ tests += bug-iconv3
+ endif
+@@ -127,13 +132,13 @@ ifeq (yes,$(build-shared))
+ # Rule to generate the shared objects.
+ charmaps = ../localedata/charmaps
+ -include $(objpfx)iconv-rules
+-extra-modules-left := $(modules)
++extra-modules-left := $(modules-y)
+ include extra-module.mk
+
+
+ extra-objs += $(modules.so)
+-install-others = $(addprefix $(inst_gconvdir)/, $(modules.so)) \
+- $(inst_gconvdir)/gconv-modules
++install-others-y += $(addprefix $(inst_gconvdir)/, $(modules.so))
++install-others-$(OPTION_EGLIBC_CHARSETS) += $(inst_gconvdir)/gconv-modules
+
+ # We can build the conversion tables for numerous charsets automatically.
+
+@@ -201,7 +206,7 @@ before-compile += $(addprefix $(objpfx),
+ ifndef avoid-generated
+ $(objpfx)iconv-rules: Makefile
+ $(make-target-directory)
+- { echo $(filter-out lib%, $(modules)); \
++ { echo $(filter-out lib%, $(modules-y)); \
+ echo 8bit $(gen-8bit-modules); \
+ echo 8bit-gap $(gen-8bit-gap-modules); } | \
+ LC_ALL=C \
+@@ -245,7 +250,7 @@ $(addprefix $(inst_gconvdir)/, $(modules
+ $(do-install-program)
+ $(inst_gconvdir)/gconv-modules: gconv-modules $(+force)
+ $(do-install)
+-ifeq (no,$(cross-compiling))
++# eglibc: ifeq (no,$(cross-compiling))
+ # Update the $(prefix)/lib/gconv/gconv-modules.cache file. This is necessary
+ # if this libc has more gconv modules than the previously installed one.
+ if test -f "$(inst_gconvdir)/gconv-modules.cache"; then \
+@@ -254,9 +259,9 @@ ifeq (no,$(cross-compiling))
+ $(common-objpfx)iconv/iconvconfig \
+ $(addprefix --prefix=,$(install_root)); \
+ fi
+-else
+- @echo '*@*@*@ You should recreate $(inst_gconvdir)/gconv-modules.cache'
+-endif
++# eglibc: else
++# eglibc: @echo '*@*@*@ You should recreate $(inst_gconvdir)/gconv-modules.cache'
++# eglibc: endif
+
+ endif # build-shared = yes
+
+Index: git/include/netdb.h
+===================================================================
+--- git.orig/include/netdb.h
++++ git/include/netdb.h
+@@ -232,6 +232,10 @@ extern enum nss_status _nss_ ## service
+ (const char *name, int af, struct hostent *host, \
+ char *buffer, size_t buflen, int *errnop, \
+ int *h_errnop); \
++extern enum nss_status _nss_ ## service ## _gethostbyname3_r \
++ (const char *name, int af, struct hostent *result, \
++ char *buffer, size_t buflen, int *errnop, \
++ int *h_errnop, int32_t *ttlp, char **canonp); \
+ extern enum nss_status _nss_ ## service ## _gethostbyname_r \
+ (const char *name, struct hostent *host, char *buffer, \
+ size_t buflen, int *errnop, int *h_errnop); \
+Index: git/inet/Makefile
+===================================================================
+--- git.orig/inet/Makefile
++++ git/inet/Makefile
+@@ -18,6 +18,8 @@
+ #
+ # Sub-makefile for inet portion of the library.
+ #
++include ../option-groups.mak
++
+ subdir := inet
+
+ include ../Makeconfig
+@@ -27,7 +29,8 @@ headers := netinet/ether.h netinet/in.h
+ netinet/tcp.h netinet/ip.h $(wildcard arpa/*.h protocols/*.h) \
+ aliases.h ifaddrs.h netinet/ip6.h netinet/icmp6.h bits/in.h
+
+-routines := htonl htons \
++routines-$(OPTION_EGLIBC_INET) \
++ += htonl htons \
+ inet_lnaof inet_mkadr \
+ inet_netof inet_ntoa inet_net herrno herrno-loc \
+ gethstbyad gethstbyad_r gethstbynm gethstbynm2 gethstbynm2_r \
+@@ -41,18 +44,23 @@ routines := htonl htons \
+ getrpcent_r getrpcbyname_r getrpcbynumber_r \
+ ether_aton ether_aton_r ether_hton ether_line \
+ ether_ntoa ether_ntoa_r ether_ntoh \
+- rcmd rexec ruserpass \
+ getnetgrent_r getnetgrent \
+- getaliasent_r getaliasent getaliasname getaliasname_r \
+- in6_addr getnameinfo if_index ifaddrs inet6_option \
++ in6_addr getnameinfo if_index ifaddrs \
+ getipv4sourcefilter setipv4sourcefilter \
+- getsourcefilter setsourcefilter inet6_opt inet6_rth
++ getsourcefilter setsourcefilter
++routines-$(OPTION_EGLIBC_RCMD) \
++ += rcmd rexec ruserpass
++routines-$(OPTION_EGLIBC_DB_ALIASES) \
++ += getaliasent_r getaliasent getaliasname getaliasname_r
++routines-$(OPTION_EGLIBC_ADVANCED_INET6) \
++ += inet6_option inet6_opt inet6_rth
+
+-aux := check_pf check_native ifreq
++aux-$(OPTION_EGLIBC_INET) += check_pf check_native ifreq
+
+ tests := htontest test_ifindex tst-ntoa tst-ether_aton tst-network \
+- tst-gethnm test-ifaddrs bug-if1 test-inet6_opt tst-ether_line \
++ tst-gethnm test-ifaddrs bug-if1 tst-ether_line \
+ tst-getni1 tst-getni2 tst-inet6_rth tst-checks
++tests-$(OPTION_EGLIBC_ADVANCED_INET6) += test-inet6_opt
+
+ include ../Rules
+
+Index: git/intl/dcigettext.c
+===================================================================
+--- git.orig/intl/dcigettext.c
++++ git/intl/dcigettext.c
+@@ -100,11 +100,15 @@ extern int errno;
+ # include "libgnuintl.h"
+ #endif
+ #include "hash-string.h"
++#ifdef _LIBC
++# include <gnu/option-groups.h>
++#endif
+
+ /* Handle multi-threaded applications. */
+ #ifdef _LIBC
+ # include <bits/libc-lock.h>
+ # define gl_rwlock_define_initialized __libc_rwlock_define_initialized
++# define gl_rwlock_define __libc_rwlock_define
+ # define gl_rwlock_rdlock __libc_rwlock_rdlock
+ # define gl_rwlock_wrlock __libc_rwlock_wrlock
+ # define gl_rwlock_unlock __libc_rwlock_unlock
+@@ -523,8 +527,10 @@ DCIGETTEXT (const char *domainname, cons
+ saved_errno = errno;
+
+ #ifdef _LIBC
+- __libc_rwlock_define (extern, __libc_setlocale_lock attribute_hidden)
+- __libc_rwlock_rdlock (__libc_setlocale_lock);
++# if __OPTION_EGLIBC_LOCALE_CODE
++ gl_rwlock_define (extern, __libc_setlocale_lock attribute_hidden)
++ gl_rwlock_rdlock (__libc_setlocale_lock);
++# endif
+ #endif
+
+ gl_rwlock_rdlock (_nl_state_lock);
+@@ -550,7 +556,11 @@ DCIGETTEXT (const char *domainname, cons
+ #ifdef HAVE_PER_THREAD_LOCALE
+ # ifndef IN_LIBGLOCALE
+ # ifdef _LIBC
+- localename = strdupa (__current_locale_name (category));
++# if __OPTION_EGLIBC_LOCALE_CODE
++ localename = strdupa (__current_locale_name (category));
++# else
++ localename = "C";
++# endif
+ # else
+ categoryname = category_to_name (category);
+ # define CATEGORYNAME_INITIALIZED
+@@ -581,10 +591,12 @@ DCIGETTEXT (const char *domainname, cons
+ else
+ retval = (char *) (*foundp)->translation;
+
+- gl_rwlock_unlock (_nl_state_lock);
+ # ifdef _LIBC
+- __libc_rwlock_unlock (__libc_setlocale_lock);
++# if __OPTION_EGLIBC_LOCALE_CODE
++ gl_rwlock_unlock (__libc_setlocale_lock);
++# endif
+ # endif
++ gl_rwlock_unlock (_nl_state_lock);
+ __set_errno (saved_errno);
+ return retval;
+ }
+@@ -838,10 +850,13 @@ DCIGETTEXT (const char *domainname, cons
+ if (plural)
+ retval = plural_lookup (domain, n, retval, retlen);
+
+- gl_rwlock_unlock (_nl_state_lock);
+ #ifdef _LIBC
+- __libc_rwlock_unlock (__libc_setlocale_lock);
++# if __OPTION_EGLIBC_LOCALE_CODE
++
++ gl_rwlock_unlock (__libc_setlocale_lock);
++# endif
+ #endif
++ gl_rwlock_unlock (_nl_state_lock);
+ return retval;
+ }
+ }
+@@ -850,10 +865,12 @@ DCIGETTEXT (const char *domainname, cons
+ return_untranslated:
+ /* Return the untranslated MSGID. */
+ FREE_BLOCKS (block_list);
+- gl_rwlock_unlock (_nl_state_lock);
+ #ifdef _LIBC
+- __libc_rwlock_unlock (__libc_setlocale_lock);
++# if __OPTION_EGLIBC_LOCALE_CODE
++ gl_rwlock_unlock (__libc_setlocale_lock);
++# endif
+ #endif
++ gl_rwlock_unlock (_nl_state_lock);
+ #ifndef _LIBC
+ if (!ENABLE_SECURE)
+ {
+@@ -1550,7 +1567,11 @@ guess_category_value (int category, cons
+ `LC_xxx', and `LANG'. On some systems this can be done by the
+ `setlocale' function itself. */
+ # ifdef _LIBC
++# if __OPTION_EGLIBC_LOCALE_CODE
+ locale = __current_locale_name (category);
++# else
++ locale = "C";
++# endif
+ # else
+ locale_defaulted = 0;
+ # if HAVE_USELOCALE
+Index: git/intl/Makefile
+===================================================================
+--- git.orig/intl/Makefile
++++ git/intl/Makefile
+@@ -16,6 +16,7 @@
+ # <http://www.gnu.org/licenses/>.
+
+ # Makefile for intl subdirectory: message handling code from GNU gettext.
++include ../option-groups.mak
+
+ subdir = intl
+
+@@ -48,7 +49,7 @@ endif
+ $(objpfx)plural.o: plural.c
+
+ ifeq ($(run-built-tests),yes)
+-ifeq (yes,$(build-shared))
++ifeq (yyyes,$(OPTION_EGLIBC_LOCALES)$(OPTION_EGLIBC_LOCALE_CODE)$(build-shared))
+ ifneq ($(strip $(MSGFMT)),:)
+ tests-special += $(objpfx)tst-translit.out $(objpfx)tst-gettext.out \
+ $(objpfx)tst-gettext2.out $(objpfx)tst-codeset.out \
+Index: git/io/Makefile
+===================================================================
+--- git.orig/io/Makefile
++++ git/io/Makefile
+@@ -18,6 +18,8 @@
+ #
+ # Sub-makefile for I/O portion of the library.
+ #
++include ../option-groups.mak
++
+ subdir := io
+
+ include ../Makeconfig
+@@ -36,7 +38,7 @@ routines := \
+ fxstatat fxstatat64 \
+ statfs fstatfs statfs64 fstatfs64 \
+ statvfs fstatvfs statvfs64 fstatvfs64 \
+- umask chmod fchmod lchmod fchmodat \
++ umask chmod fchmod fchmodat \
+ mkdir mkdirat \
+ open open_2 open64 open64_2 openat openat_2 openat64 openat64_2 \
+ read write lseek lseek64 access euidaccess faccessat \
+@@ -49,11 +51,13 @@ routines := \
+ ttyname ttyname_r isatty \
+ link linkat symlink symlinkat readlink readlinkat \
+ unlink unlinkat rmdir \
+- ftw ftw64 fts poll ppoll \
++ poll ppoll \
+ posix_fadvise posix_fadvise64 \
+ posix_fallocate posix_fallocate64 \
+ sendfile sendfile64 \
+ utimensat futimens
++routines-$(OPTION_EGLIBC_BSD) += lchmod
++routines-$(OPTION_EGLIBC_FTRAVERSE) += ftw ftw64 fts
+
+ aux := have_o_cloexec
+
+@@ -64,18 +68,22 @@ static-only-routines = stat fstat lstat
+ fstatat fstatat64 mknod mknodat
+
+ others := pwd
+-test-srcs := ftwtest
++test-srcs-$(OPTION_EGLIBC_FTRAVERSE) := ftwtest
+ tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
+- tst-fcntl bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 tst-statvfs \
++ tst-fcntl tst-statvfs \
+ tst-openat tst-unlinkat tst-fstatat tst-futimesat \
+ tst-renameat tst-fchownat tst-fchmodat tst-faccessat \
+ tst-symlinkat tst-linkat tst-readlinkat tst-mkdirat \
+- tst-mknodat tst-mkfifoat tst-ttyname_r bug-ftw5 \
++ tst-mknodat tst-mkfifoat tst-ttyname_r \
+ tst-posix_fallocate
++tests-$(OPTION_EGLIBC_FTRAVERSE) += bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 \
++ bug-ftw5
+
+ ifeq ($(run-built-tests),yes)
++ifeq (y,$(OPTION_EGLIBC_FTRAVERSE))
+ tests-special += $(objpfx)ftwtest.out
+ endif
++endif
+
+ include ../Rules
+
+Index: git/libidn/Makefile
+===================================================================
+--- git.orig/libidn/Makefile
++++ git/libidn/Makefile
+@@ -16,6 +16,7 @@
+ # <http://www.gnu.org/licenses/>.
+
+ # Makefile for libidn subdirectory of GNU C Library.
++include ../option-groups.mak
+
+ subdir := libidn
+
+@@ -23,8 +24,8 @@ include ../Makeconfig
+
+ routines = idn-stub
+
+-extra-libs = libcidn
+-extra-libs-others = $(extra-libs)
++extra-libs-$(OPTION_EGLIBC_IDN) = libcidn
++extra-libs-others-y = $(extra-libs-y)
+
+ libcidn-routines := punycode toutf8 nfkc stringprep rfc3454 profiles idna \
+ iconvme
+Index: git/libidn/toutf8.c
+===================================================================
+--- git.orig/libidn/toutf8.c
++++ git/libidn/toutf8.c
+@@ -33,6 +33,11 @@
+ /* Get strlen. */
+ #include <string.h>
+
++/* Get __OPTION_EGLIBC_LOCALE_CODE. */
++#ifdef _LIBC
++# include <gnu/option-groups.h>
++#endif
++
+ /* Get iconv_string. */
+ #include "iconvme.h"
+
+@@ -47,7 +52,11 @@
+ #endif
+
+ #ifdef _LIBC
+-# define stringprep_locale_charset() nl_langinfo (CODESET)
++# if __OPTION_EGLIBC_LOCALE_CODE
++# define stringprep_locale_charset() nl_langinfo (CODESET)
++# else
++# define stringprep_locale_charset() "ANSI_X3.4-1968"
++# endif
+ #else
+ /**
+ * stringprep_locale_charset - return charset used in current locale
+Index: git/libio/fileops.c
+===================================================================
+--- git.orig/libio/fileops.c
++++ git/libio/fileops.c
+@@ -38,6 +38,7 @@
+ #include <string.h>
+ #include <errno.h>
+ #include <unistd.h>
++#include <gnu/option-groups.h>
+ #include <stdlib.h>
+ #if _LIBC
+ # include "../wcsmbs/wcsmbsload.h"
+@@ -172,7 +173,7 @@ _IO_new_file_close_it (_IO_FILE *fp)
+
+ /* Free buffer. */
+ #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+- if (fp->_mode > 0)
++ if (_IO_is_wide (fp))
+ {
+ if (_IO_have_wbackup (fp))
+ _IO_free_wbackup_area (fp);
+@@ -347,6 +348,7 @@ _IO_new_file_fopen (_IO_FILE *fp, const
+ cs = strstr (last_recognized + 1, ",ccs=");
+ if (cs != NULL)
+ {
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ /* Yep. Load the appropriate conversions and set the orientation
+ to wide. */
+ struct gconv_fcts fcts;
+@@ -406,6 +408,12 @@ _IO_new_file_fopen (_IO_FILE *fp, const
+
+ /* Set the mode now. */
+ result->_mode = 1;
++#else
++ /* Treat this as if we couldn't find the given character set. */
++ (void) _IO_file_close_it (fp);
++ __set_errno (EINVAL);
++ return NULL;
++#endif
+ }
+ }
+
+Index: git/libio/__fpurge.c
+===================================================================
+--- git.orig/libio/__fpurge.c
++++ git/libio/__fpurge.c
+@@ -21,7 +21,7 @@
+ void
+ __fpurge (FILE *fp)
+ {
+- if (fp->_mode > 0)
++ if (_IO_is_wide (fp))
+ {
+ /* Wide-char stream. */
+ if (_IO_in_backup (fp))
+Index: git/libio/iofwide.c
+===================================================================
+--- git.orig/libio/iofwide.c
++++ git/libio/iofwide.c
+@@ -26,6 +26,7 @@
+
+ #include <libioP.h>
+ #ifdef _LIBC
++# include <gnu/option-groups.h>
+ # include <dlfcn.h>
+ # include <wchar.h>
+ #endif
+@@ -43,6 +44,8 @@
+ #endif
+
+
++#if ! defined _LIBC || __OPTION_POSIX_C_LANG_WIDE_CHAR
++
+ /* Prototypes of libio's codecvt functions. */
+ static enum __codecvt_result do_out (struct _IO_codecvt *codecvt,
+ __mbstate_t *statep,
+@@ -499,3 +502,26 @@ do_max_length (struct _IO_codecvt *codec
+ return MB_CUR_MAX;
+ #endif
+ }
++
++#else
++/* OPTION_POSIX_C_LANG_WIDE_CHAR is disabled. */
++
++#undef _IO_fwide
++int
++_IO_fwide (fp, mode)
++ _IO_FILE *fp;
++ int mode;
++{
++ /* Die helpfully if the user tries to create a wide stream; I
++ disbelieve that most users check the return value from
++ 'fwide (fp, 1)'. */
++ assert (mode <= 0);
++
++ /* We can only make streams byte-oriented, which is trivial. */
++ if (mode < 0)
++ fp->_mode = -1;
++
++ return fp->_mode;
++}
++
++#endif
+Index: git/libio/ioseekoff.c
+===================================================================
+--- git.orig/libio/ioseekoff.c
++++ git/libio/ioseekoff.c
+@@ -60,7 +60,7 @@ _IO_seekoff_unlocked (fp, offset, dir, m
+ else
+ abort ();
+ }
+- if (_IO_fwide (fp, 0) < 0)
++ if (! _IO_is_wide (fp))
+ _IO_free_backup_area (fp);
+ else
+ _IO_free_wbackup_area (fp);
+Index: git/libio/ioseekpos.c
+===================================================================
+--- git.orig/libio/ioseekpos.c
++++ git/libio/ioseekpos.c
+@@ -35,7 +35,7 @@ _IO_seekpos_unlocked (fp, pos, mode)
+ /* If we have a backup buffer, get rid of it, since the __seekoff
+ callback may not know to do the right thing about it.
+ This may be over-kill, but it'll do for now. TODO */
+- if (_IO_fwide (fp, 0) <= 0)
++ if (! _IO_is_wide (fp))
+ {
+ if (_IO_have_backup (fp))
+ _IO_free_backup_area (fp);
+Index: git/libio/iosetbuffer.c
+===================================================================
+--- git.orig/libio/iosetbuffer.c
++++ git/libio/iosetbuffer.c
+@@ -24,6 +24,8 @@
+ This exception applies to code released by its copyright holders
+ in files containing the exception. */
+
++#include <gnu/option-groups.h>
++
+ #include "libioP.h"
+
+ void
+@@ -38,9 +40,11 @@ _IO_setbuffer (fp, buf, size)
+ if (!buf)
+ size = 0;
+ (void) _IO_SETBUF (fp, buf, size);
++#if __OPTION_POSIX_C_LANG_WIDE_CHAR
+ if (_IO_vtable_offset (fp) == 0 && fp->_mode == 0 && _IO_CHECK_WIDE (fp))
+ /* We also have to set the buffer using the wide char function. */
+ (void) _IO_WSETBUF (fp, buf, size);
++#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
+ _IO_release_lock (fp);
+ }
+ libc_hidden_def (_IO_setbuffer)
+Index: git/libio/libioP.h
+===================================================================
+--- git.orig/libio/libioP.h
++++ git/libio/libioP.h
+@@ -42,6 +42,10 @@
+ /*# include <comthread.h>*/
+ #endif
+
++#if defined _LIBC
++# include <gnu/option-groups.h>
++#endif
++
+ #include <math_ldbl_opt.h>
+
+ #include "iolibio.h"
+@@ -508,8 +512,20 @@ extern void _IO_old_init (_IO_FILE *fp,
+
+
+ #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
++
++/* _IO_is_wide (fp) is roughly equivalent to '_IO_fwide (fp, 0) > 0',
++ except that when OPTION_POSIX_C_LANG_WIDE_CHAR is disabled, it
++ expands to a constant, allowing the compiler to realize that it can
++ eliminate code that references wide stream handling functions.
++ This, in turn, allows us to omit them. */
++#if __OPTION_POSIX_C_LANG_WIDE_CHAR
++# define _IO_is_wide(_f) ((_f)->_mode > 0)
++#else
++# define _IO_is_wide(_f) (0)
++#endif
++
+ # define _IO_do_flush(_f) \
+- ((_f)->_mode <= 0 \
++ (! _IO_is_wide (_f) \
+ ? _IO_do_write(_f, (_f)->_IO_write_base, \
+ (_f)->_IO_write_ptr-(_f)->_IO_write_base) \
+ : _IO_wdo_write(_f, (_f)->_wide_data->_IO_write_base, \
+Index: git/libio/Makefile
+===================================================================
+--- git.orig/libio/Makefile
++++ git/libio/Makefile
+@@ -18,6 +18,8 @@
+ #
+ # Specific makefile for libio.
+ #
++include ../option-groups.mak
++
+ subdir := libio
+
+ include ../Makeconfig
+@@ -27,16 +29,13 @@ headers := stdio.h libio.h _G_config.h b
+
+ routines := \
+ filedoalloc iofclose iofdopen iofflush iofgetpos iofgets iofopen \
+- iofopncook iofputs iofread iofsetpos ioftell wfiledoalloc \
++ iofopncook iofputs iofread iofsetpos ioftell \
+ iofwrite iogetdelim iogetline iogets iopadn iopopen ioputs \
+ ioseekoff ioseekpos iosetbuffer iosetvbuf ioungetc \
+ iovsprintf iovsscanf \
+ iofgetpos64 iofopen64 iofsetpos64 \
+- fputwc fputwc_u getwc getwc_u getwchar getwchar_u iofgetws iofgetws_u \
+- iofputws iofputws_u iogetwline iowpadn ioungetwc putwc putwc_u \
+- putwchar putwchar_u putchar putchar_u fwprintf swprintf vwprintf \
+- wprintf wscanf fwscanf vwscanf vswprintf iovswscanf swscanf wgenops \
+- wstrops wfileops iofwide fwide wmemstream \
++ putchar putchar_u \
++ iofwide \
+ \
+ clearerr feof ferror fileno fputc freopen fseek getc getchar \
+ memstream pclose putc putchar rewind setbuf setlinebuf vasprintf \
+@@ -48,24 +47,49 @@ routines := \
+ \
+ libc_fatal fmemopen
+
+-tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc \
+- tst_wprintf2 tst-widetext test-fmemopen tst-ext tst-ext2 \
+- tst-fgetws tst-ungetwc1 tst-ungetwc2 tst-swscanf tst-sscanf \
+- tst-mmap-setvbuf bug-ungetwc1 bug-ungetwc2 tst-atime tst-eof \
+- tst-freopen bug-rewind bug-rewind2 bug-ungetc bug-fseek \
++routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) += \
++ wfiledoalloc \
++ iowpadn \
++ swprintf \
++ vswprintf iovswscanf swscanf wgenops \
++ wstrops wfileops wmemstream
++routines-$(call option-disabled, OPTION_POSIX_C_LANG_WIDE_CHAR) += \
++ wdummyfileops
++routines-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) += \
++ fputwc fputwc_u getwc getwc_u getwchar getwchar_u iofgetws iofgetws_u \
++ iofputws iofputws_u iogetwline ioungetwc putwc putwc_u \
++ putwchar putwchar_u fwprintf vwprintf \
++ wprintf wscanf fwscanf vwscanf \
++ fwide
++
++tests = test-fmemopen tst-ext tst-ext2 \
++ tst-mmap-setvbuf tst-atime tst-eof \
++ tst-freopen bug-ungetc bug-fseek \
+ tst-mmap-eofsync tst-mmap-fflushsync bug-mmap-fflush \
+- tst-mmap2-eofsync tst-mmap-offend bug-fopena+ bug-wfflush \
+- bug-ungetc2 bug-ftell bug-ungetc3 bug-ungetc4 tst-fopenloc2 \
++ tst-mmap2-eofsync tst-mmap-offend bug-fopena+ \
++ bug-ungetc2 bug-ungetc3 bug-ungetc4 \
+ tst-memstream1 tst-memstream2 \
+- tst-wmemstream1 tst-wmemstream2 \
+- bug-memstream1 bug-wmemstream1 \
+- tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos tst-fseek \
+- tst-fwrite-error tst-ftell-partial-wide tst-ftell-active-handler \
+- tst-ftell-append tst-fputws
++ bug-memstream1 tst-popen1 tst-fwrite-error \
++ tst-ftell-active-handler tst-ftell-append
++tests-$(OPTION_EGLIBC_LOCALE_CODE) \
++ += tst-swscanf tst-fgetws tst-setvbuf1 \
++ tst-ungetwc1 tst-ungetwc2 bug-ftell bug-ungetwc2 \
++ tst-widetext tst-fputws
++tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
++ += bug-rewind bug-rewind2 bug-ungetwc1 \
++ bug-wfflush bug-wmemstream1 tst-fopenloc2 \
++ tst_getwc \
++ tst_putwc tst_wprintf tst_wprintf2 tst_wscanf \
++ tst-fgetwc bug-wsetpos tst-fseek tst-ftell-partial-wide
++tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
++ += tst_swprintf tst_swscanf \
++ tst-sscanf \
++ tst-wmemstream1 tst-wmemstream2
++
+ ifeq (yes,$(build-shared))
+ # Add test-fopenloc only if shared library is enabled since it depends on
+ # shared localedata objects.
+-tests += tst-fopenloc
++tests-$(OPTION_EGLIBC_LOCALE_CODE) += tst-fopenloc
+ endif
+ test-srcs = test-freopen
+
+@@ -164,13 +188,17 @@ shared-only-routines = oldiofopen oldiof
+ oldiofsetpos64
+
+ ifeq ($(run-built-tests),yes)
++ifeq (y,$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO))
+ tests-special += $(objpfx)test-freopen.out
++endif
++ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
+ ifeq (yes,$(build-shared))
+ # Run tst-fopenloc-cmp.out and tst-openloc-mem.out only if shared
+ # library is enabled since they depend on tst-fopenloc.out.
+ tests-special += $(objpfx)tst-fopenloc-cmp.out $(objpfx)tst-fopenloc-mem.out
+ endif
+ endif
++endif
+
+ include ../Rules
+
+Index: git/libio/wdummyfileops.c
+===================================================================
+--- /dev/null
++++ git/libio/wdummyfileops.c
+@@ -0,0 +1,161 @@
++/* Copyright (C) 2007 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA.
++
++ As a special exception, if you link the code in this file with
++ files compiled with a GNU compiler to produce an executable,
++ that does not cause the resulting executable to be covered by
++ the GNU Lesser General Public License. This exception does not
++ however invalidate any other reasons why the executable file
++ might be covered by the GNU Lesser General Public License.
++ This exception applies to code released by its copyright holders
++ in files containing the exception. */
++
++#include <assert.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <libioP.h>
++
++static void __THROW __attribute__ ((__noreturn__))
++_IO_wfile_wide_char_support_disabled (void)
++{
++ static const char errstr[]
++ = ("The application tried to use wide character I/O, but libc.so"
++ " was compiled\n"
++ "with the OPTION_POSIX_C_LANG_WIDE_CHAR option group disabled.\n");
++ __libc_write (STDERR_FILENO, errstr, sizeof (errstr) - 1);
++ abort ();
++}
++
++static void
++_IO_wfile_disabled_void_int (_IO_FILE *fp, int x)
++{
++ _IO_wfile_wide_char_support_disabled ();
++}
++
++static int
++_IO_wfile_disabled_int_int (_IO_FILE *fp, int x)
++{
++ _IO_wfile_wide_char_support_disabled ();
++}
++
++static int
++_IO_wfile_disabled_int_none (_IO_FILE *fp)
++{
++ _IO_wfile_wide_char_support_disabled ();
++}
++
++static _IO_size_t
++_IO_wfile_disabled_xsputn (_IO_FILE *fp, const void *data, _IO_size_t n)
++{
++ _IO_wfile_wide_char_support_disabled ();
++}
++
++static _IO_size_t
++_IO_wfile_disabled_xsgetn (_IO_FILE *fp, void *data, _IO_size_t n)
++{
++ _IO_wfile_wide_char_support_disabled ();
++}
++
++static _IO_off64_t
++_IO_wfile_disabled_seekoff (_IO_FILE *fp, _IO_off64_t off, int dir, int mode)
++{
++ _IO_wfile_wide_char_support_disabled ();
++}
++
++static _IO_off64_t
++_IO_wfile_disabled_seekpos (_IO_FILE *fp, _IO_off64_t pos, int flags)
++{
++ _IO_wfile_wide_char_support_disabled ();
++}
++
++static _IO_FILE *
++_IO_wfile_disabled_setbuf (_IO_FILE *fp, char *buffer, _IO_ssize_t length)
++{
++ _IO_wfile_wide_char_support_disabled ();
++}
++
++static _IO_ssize_t
++_IO_wfile_disabled_read (_IO_FILE *fp, void *buffer, _IO_ssize_t length)
++{
++ _IO_wfile_wide_char_support_disabled ();
++}
++
++static _IO_ssize_t
++_IO_wfile_disabled_write (_IO_FILE *fp, const void *buffer, _IO_ssize_t length)
++{
++ _IO_wfile_wide_char_support_disabled ();
++}
++
++static _IO_off64_t
++_IO_wfile_disabled_seek (_IO_FILE *fp, _IO_off64_t offset, int mode)
++{
++ _IO_wfile_wide_char_support_disabled ();
++}
++
++static int
++_IO_wfile_disabled_close (_IO_FILE *fp)
++{
++ _IO_wfile_wide_char_support_disabled ();
++}
++
++static int
++_IO_wfile_disabled_stat (_IO_FILE *fp, void *buf)
++{
++ _IO_wfile_wide_char_support_disabled ();
++}
++
++static int
++_IO_wfile_disabled_showmanyc (_IO_FILE *fp)
++{
++ _IO_wfile_wide_char_support_disabled ();
++}
++
++static void
++_IO_wfile_disabled_imbue (_IO_FILE *fp, void *locale)
++{
++ _IO_wfile_wide_char_support_disabled ();
++}
++
++static const struct _IO_jump_t _IO_wfile_jumps_disabled =
++{
++ JUMP_INIT_DUMMY,
++ JUMP_INIT(finish, _IO_wfile_disabled_void_int),
++ JUMP_INIT(overflow, _IO_wfile_disabled_int_int),
++ JUMP_INIT(underflow, _IO_wfile_disabled_int_none),
++ JUMP_INIT(uflow, _IO_wfile_disabled_int_none),
++ JUMP_INIT(pbackfail, _IO_wfile_disabled_int_int),
++ JUMP_INIT(xsputn, _IO_wfile_disabled_xsputn),
++ JUMP_INIT(xsgetn, _IO_wfile_disabled_xsgetn),
++ JUMP_INIT(seekoff, _IO_wfile_disabled_seekoff),
++ JUMP_INIT(seekpos, _IO_wfile_disabled_seekpos),
++ JUMP_INIT(setbuf, _IO_wfile_disabled_setbuf),
++ JUMP_INIT(sync, _IO_wfile_disabled_int_none),
++ JUMP_INIT(doallocate, _IO_wfile_disabled_int_none),
++ JUMP_INIT(read, _IO_wfile_disabled_read),
++ JUMP_INIT(write, _IO_wfile_disabled_write),
++ JUMP_INIT(seek, _IO_wfile_disabled_seek),
++ JUMP_INIT(close, _IO_wfile_disabled_close),
++ JUMP_INIT(stat, _IO_wfile_disabled_stat),
++ JUMP_INIT(showmanyc, _IO_wfile_disabled_showmanyc),
++ JUMP_INIT(imbue, _IO_wfile_disabled_imbue)
++};
++
++strong_alias (_IO_wfile_jumps_disabled, _IO_wfile_jumps)
++libc_hidden_data_def (_IO_wfile_jumps)
++strong_alias (_IO_wfile_jumps_disabled, _IO_wfile_jumps_mmap)
++strong_alias (_IO_wfile_jumps_disabled, _IO_wfile_jumps_maybe_mmap)
+Index: git/locale/catnames.c
+===================================================================
+--- /dev/null
++++ git/locale/catnames.c
+@@ -0,0 +1,48 @@
++/* Copyright (C) 2006 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#include "localeinfo.h"
++
++/* Define an array of category names (also the environment variable names). */
++const union catnamestr_t _nl_category_names attribute_hidden =
++ {
++ {
++#define DEFINE_CATEGORY(category, category_name, items, a) \
++ category_name,
++#include "categories.def"
++#undef DEFINE_CATEGORY
++ }
++ };
++
++const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden =
++ {
++#define DEFINE_CATEGORY(category, category_name, items, a) \
++ [category] = offsetof (union catnamestr_t, CATNAMEMF (__LINE__)),
++#include "categories.def"
++#undef DEFINE_CATEGORY
++ };
++
++/* An array of their lengths, for convenience. */
++const uint8_t _nl_category_name_sizes[] attribute_hidden =
++ {
++#define DEFINE_CATEGORY(category, category_name, items, a) \
++ [category] = sizeof (category_name) - 1,
++#include "categories.def"
++#undef DEFINE_CATEGORY
++ [LC_ALL] = sizeof ("LC_ALL") - 1
++ };
+Index: git/locale/C-ctype.c
+===================================================================
+--- git.orig/locale/C-ctype.c
++++ git/locale/C-ctype.c
+@@ -19,8 +19,11 @@
+ #include "localeinfo.h"
+ #include <endian.h>
+ #include <stdint.h>
++#include <gnu/option-groups.h>
+
++#if __OPTION_EGLIBC_LOCALE_CODE
+ #include "C-translit.h"
++#endif
+
+ /* This table's entries are taken from POSIX.2 Table 2-6
+ ``LC_CTYPE Category Definition in the POSIX Locale''.
+@@ -647,6 +650,7 @@ const struct __locale_data _nl_C_LC_CTYP
+ { .word = L'7' },
+ { .word = L'8' },
+ { .word = L'9' },
++#if __OPTION_EGLIBC_LOCALE_CODE
+ /* _NL_CTYPE_TRANSLIT_TAB_SIZE */
+ { .word = NTRANSLIT },
+ /* _NL_CTYPE_TRANSLIT_FROM_IDX */
+@@ -657,6 +661,22 @@ const struct __locale_data _nl_C_LC_CTYP
+ { .wstr = translit_to_idx },
+ /* _NL_CTYPE_TRANSLIT_TO_TBL */
+ { .wstr = (uint32_t *) translit_to_tbl },
++#else
++ /* If the locale code isn't enabled, we don't have the
++ transliteration code in iconv/gconv_trans.c anyway, so there's
++ no need for the transliteration tables here. We'll fall back
++ on the default missing replacement, '?'. */
++ /* _NL_CTYPE_TRANSLIT_TAB_SIZE */
++ { .word = 0 },
++ /* _NL_CTYPE_TRANSLIT_FROM_IDX */
++ { .wstr = NULL },
++ /* _NL_CTYPE_TRANSLIT_FROM_TBL */
++ { .wstr = NULL },
++ /* _NL_CTYPE_TRANSLIT_TO_IDX */
++ { .wstr = NULL },
++ /* _NL_CTYPE_TRANSLIT_TO_TBL */
++ { .wstr = NULL },
++#endif
+ /* _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN */
+ { .word = 1 },
+ /* _NL_CTYPE_TRANSLIT_DEFAULT_MISSING */
+Index: git/locale/dummy-setlocale.c
+===================================================================
+--- /dev/null
++++ git/locale/dummy-setlocale.c
+@@ -0,0 +1,33 @@
++/* Copyright (C) 2006 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#include <string.h>
++#include <locale.h>
++
++char *
++setlocale (int category, const char *locale)
++{
++ if (! locale
++ || locale[0] == '\0'
++ || strcmp (locale, "C") == 0
++ || strcmp (locale, "POSIX") == 0)
++ return (char *) "C";
++ else
++ return NULL;
++}
++libc_hidden_def (setlocale)
+Index: git/locale/localeinfo.h
+===================================================================
+--- git.orig/locale/localeinfo.h
++++ git/locale/localeinfo.h
+@@ -224,7 +224,7 @@ __libc_tsd_define (extern, __locale_t, L
+ unused. We can manage this playing some tricks with weak references.
+ But with thread-local locale settings, it becomes quite ungainly unless
+ we can use __thread variables. So only in that case do we attempt this. */
+-#ifndef SHARED
++#if !defined SHARED && !defined IN_GLIBC_LOCALEDEF
+ # include <tls.h>
+ # define NL_CURRENT_INDIRECT 1
+ #endif
+Index: git/locale/Makefile
+===================================================================
+--- git.orig/locale/Makefile
++++ git/locale/Makefile
+@@ -18,27 +18,43 @@
+ #
+ # Makefile for locales.
+ #
++include ../option-groups.mak
++
+ subdir := locale
+
+ include ../Makeconfig
+
+ headers = locale.h bits/locale.h langinfo.h xlocale.h
+-routines = setlocale findlocale loadlocale loadarchive \
+- localeconv nl_langinfo nl_langinfo_l mb_cur_max \
+- newlocale duplocale freelocale uselocale
+-tests = tst-C-locale tst-locname tst-duplocale
++# catnames is needed by OPTION_EGLIBC_LOCALE_CODE and by the 'intl' code.
++# If we put the latter in an option group, too, we can omit catnames
++# when both option groups are disabled. libstdc++-v3 needs mb_cur_max.
++routines-y := catnames mb_cur_max
++routines-$(OPTION_EGLIBC_LOCALE_CODE) \
++ += setlocale findlocale loadlocale loadarchive \
++ localeconv nl_langinfo nl_langinfo_l \
++ newlocale duplocale freelocale uselocale
++ifneq (y,$(OPTION_EGLIBC_LOCALE_CODE))
++routines-y += dummy-setlocale
++endif
++tests-$(OPTION_EGLIBC_LOCALE_CODE) += tst-C-locale tst-locname tst-duplocale
+ categories = ctype messages monetary numeric time paper name \
+ address telephone measurement identification collate
+-aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name \
+- xlocale localename global-locale coll-lookup
+-others = localedef locale
++# C-messages belongs in an intl option group.
++aux-y := C-ctype C-time \
++ SYS_libc C_name xlocale global-locale coll-lookup
++aux-$(OPTION_EGLIBC_LOCALE_CODE) \
++ += $(filter-out $(aux-y), \
++ $(categories:%=lc-%) $(categories:%=C-%)) \
++ localename
++others-$(OPTION_EGLIBC_LOCALE_CODE) = localedef locale
+ #others-static = localedef locale
+-install-bin = localedef locale
+-extra-objs = $(localedef-modules:=.o) $(localedef-aux:=.o) \
++install-bin = $(others-y)
++extra-objs-$(OPTION_EGLIBC_LOCALE_CODE) \
++ = $(localedef-modules:=.o) $(localedef-aux:=.o) \
+ $(locale-modules:=.o) $(lib-modules:=.o)
+
+-extra-libs = libBrokenLocale
+-extra-libs-others = $(extra-libs)
++extra-libs-$(OPTION_EGLIBC_LOCALE_CODE) = libBrokenLocale
++extra-libs-others = $(extra-libs-y)
+
+ libBrokenLocale-routines = broken_cur_max
+
+@@ -93,6 +109,9 @@ CPPFLAGS-locale-programs = -DLOCALE_PATH
+ CFLAGS-charmap.c = -Wno-write-strings -Wno-char-subscripts
+ CFLAGS-locfile.c = -Wno-write-strings -Wno-char-subscripts
+ CFLAGS-charmap-dir.c = -Wno-write-strings
++ifneq (y,$(OPTION_EGLIBC_SPAWN))
++CFLAGS-charmap-dir.c += -DNO_UNCOMPRESS
++endif
+
+ # Set libof-* for each routine.
+ cpp-srcs-left := $(localedef-modules) $(localedef-aux) $(locale-modules) \
+Index: git/locale/programs/charmap-dir.c
+===================================================================
+--- git.orig/locale/programs/charmap-dir.c
++++ git/locale/programs/charmap-dir.c
+@@ -19,7 +19,9 @@
+ #include <error.h>
+ #include <fcntl.h>
+ #include <libintl.h>
++#ifndef NO_UNCOMPRESS
+ #include <spawn.h>
++#endif
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -156,6 +158,7 @@ charmap_closedir (CHARMAP_DIR *cdir)
+ return closedir (dir);
+ }
+
++#ifndef NO_UNCOMPRESS
+ /* Creates a subprocess decompressing the given pathname, and returns
+ a stream reading its output (the decompressed data). */
+ static
+@@ -204,6 +207,7 @@ fopen_uncompressed (const char *pathname
+ }
+ return NULL;
+ }
++#endif
+
+ /* Opens a charmap for reading, given its name (not an alias name). */
+ FILE *
+@@ -226,6 +230,7 @@ charmap_open (const char *directory, con
+ if (stream != NULL)
+ return stream;
+
++#ifndef NO_UNCOMPRESS
+ memcpy (p, ".gz", 4);
+ stream = fopen_uncompressed (pathname, "gzip");
+ if (stream != NULL)
+@@ -235,6 +240,7 @@ charmap_open (const char *directory, con
+ stream = fopen_uncompressed (pathname, "bzip2");
+ if (stream != NULL)
+ return stream;
++#endif
+
+ return NULL;
+ }
+Index: git/locale/programs/ld-collate.c
+===================================================================
+--- git.orig/locale/programs/ld-collate.c
++++ git/locale/programs/ld-collate.c
+@@ -350,7 +350,7 @@ new_element (struct locale_collate_t *co
+ }
+ if (wcs != NULL)
+ {
+- size_t nwcs = wcslen ((wchar_t *) wcs);
++ size_t nwcs = wcslen_uint32 (wcs);
+ uint32_t zero = 0;
+ /* Handle <U0000> as a single character. */
+ if (nwcs == 0)
+@@ -1776,8 +1776,7 @@ symbol `%s' has the same encoding as"),
+
+ if ((*eptr)->nwcs == runp->nwcs)
+ {
+- int c = wmemcmp ((wchar_t *) (*eptr)->wcs,
+- (wchar_t *) runp->wcs, runp->nwcs);
++ int c = wmemcmp_uint32 ((*eptr)->wcs, runp->wcs, runp->nwcs);
+
+ if (c == 0)
+ {
+@@ -2010,9 +2009,9 @@ add_to_tablewc (uint32_t ch, struct elem
+ one consecutive entry. */
+ if (runp->wcnext != NULL
+ && runp->nwcs == runp->wcnext->nwcs
+- && wmemcmp ((wchar_t *) runp->wcs,
+- (wchar_t *)runp->wcnext->wcs,
+- runp->nwcs - 1) == 0
++ && wmemcmp_uint32 (runp->wcs,
++ runp->wcnext->wcs,
++ runp->nwcs - 1) == 0
+ && (runp->wcs[runp->nwcs - 1]
+ == runp->wcnext->wcs[runp->nwcs - 1] + 1))
+ {
+@@ -2036,9 +2035,9 @@ add_to_tablewc (uint32_t ch, struct elem
+ runp = runp->wcnext;
+ while (runp->wcnext != NULL
+ && runp->nwcs == runp->wcnext->nwcs
+- && wmemcmp ((wchar_t *) runp->wcs,
+- (wchar_t *)runp->wcnext->wcs,
+- runp->nwcs - 1) == 0
++ && wmemcmp_uint32 (runp->wcs,
++ runp->wcnext->wcs,
++ runp->nwcs - 1) == 0
+ && (runp->wcs[runp->nwcs - 1]
+ == runp->wcnext->wcs[runp->nwcs - 1] + 1));
+
+Index: git/locale/programs/ld-ctype.c
+===================================================================
+--- git.orig/locale/programs/ld-ctype.c
++++ git/locale/programs/ld-ctype.c
+@@ -960,7 +960,7 @@ ctype_output (struct localedef_t *locale
+ allocate_arrays (ctype, charmap, ctype->repertoire);
+
+ default_missing_len = (ctype->default_missing
+- ? wcslen ((wchar_t *) ctype->default_missing)
++ ? wcslen_uint32 (ctype->default_missing)
+ : 0);
+
+ init_locale_data (&file, nelems);
+@@ -1971,7 +1971,7 @@ read_translit_entry (struct linereader *
+ ignore = 1;
+ else
+ /* This value is usable. */
+- obstack_grow (ob, to_wstr, wcslen ((wchar_t *) to_wstr) * 4);
++ obstack_grow (ob, to_wstr, wcslen_uint32 (to_wstr) * 4);
+
+ first = 0;
+ }
+@@ -2519,8 +2519,8 @@ with character code range values one mus
+ }
+
+ handle_tok_digit:
+- class_bit = _ISwdigit;
+- class256_bit = _ISdigit;
++ class_bit = BITw (tok_digit);
++ class256_bit = BIT (tok_digit);
+ handle_digits = 1;
+ goto read_charclass;
+
+@@ -4002,8 +4002,7 @@ allocate_arrays (struct locale_ctype_t *
+
+ while (idx < number)
+ {
+- int res = wcscmp ((const wchar_t *) sorted[idx]->from,
+- (const wchar_t *) runp->from);
++ int res = wcscmp_uint32 (sorted[idx]->from, runp->from);
+ if (res == 0)
+ {
+ replace = 1;
+@@ -4040,11 +4039,11 @@ allocate_arrays (struct locale_ctype_t *
+ for (size_t cnt = 0; cnt < number; ++cnt)
+ {
+ struct translit_to_t *srunp;
+- from_len += wcslen ((const wchar_t *) sorted[cnt]->from) + 1;
++ from_len += wcslen_uint32 (sorted[cnt]->from) + 1;
+ srunp = sorted[cnt]->to;
+ while (srunp != NULL)
+ {
+- to_len += wcslen ((const wchar_t *) srunp->str) + 1;
++ to_len += wcslen_uint32 (srunp->str) + 1;
+ srunp = srunp->next;
+ }
+ /* Plus one for the extra NUL character marking the end of
+@@ -4068,18 +4067,18 @@ allocate_arrays (struct locale_ctype_t *
+ ctype->translit_from_idx[cnt] = from_len;
+ ctype->translit_to_idx[cnt] = to_len;
+
+- len = wcslen ((const wchar_t *) sorted[cnt]->from) + 1;
+- wmemcpy ((wchar_t *) &ctype->translit_from_tbl[from_len],
+- (const wchar_t *) sorted[cnt]->from, len);
++ len = wcslen_uint32 (sorted[cnt]->from) + 1;
++ wmemcpy_uint32 (&ctype->translit_from_tbl[from_len],
++ sorted[cnt]->from, len);
+ from_len += len;
+
+ ctype->translit_to_idx[cnt] = to_len;
+ srunp = sorted[cnt]->to;
+ while (srunp != NULL)
+ {
+- len = wcslen ((const wchar_t *) srunp->str) + 1;
+- wmemcpy ((wchar_t *) &ctype->translit_to_tbl[to_len],
+- (const wchar_t *) srunp->str, len);
++ len = wcslen_uint32 (srunp->str) + 1;
++ wmemcpy_uint32 (&ctype->translit_to_tbl[to_len],
++ srunp->str, len);
+ to_len += len;
+ srunp = srunp->next;
+ }
+Index: git/locale/programs/ld-messages.c
+===================================================================
+--- git.orig/locale/programs/ld-messages.c
++++ git/locale/programs/ld-messages.c
+@@ -25,6 +25,7 @@
+ #include <string.h>
+ #include <stdint.h>
+ #include <sys/uio.h>
++#include <gnu/option-groups.h>
+
+ #include <assert.h>
+
+@@ -124,6 +125,7 @@ No definition for %s category found"), "
+ }
+ else
+ {
++#if __OPTION_POSIX_REGEXP
+ int result;
+ regex_t re;
+
+@@ -140,6 +142,7 @@ No definition for %s category found"), "
+ }
+ else if (result != 0)
+ regfree (&re);
++#endif
+ }
+
+ if (messages->noexpr == NULL)
+@@ -158,6 +161,7 @@ No definition for %s category found"), "
+ }
+ else
+ {
++#if __OPTION_POSIX_REGEXP
+ int result;
+ regex_t re;
+
+@@ -174,6 +178,7 @@ No definition for %s category found"), "
+ }
+ else if (result != 0)
+ regfree (&re);
++#endif
+ }
+ }
+
+Index: git/locale/programs/ld-time.c
+===================================================================
+--- git.orig/locale/programs/ld-time.c
++++ git/locale/programs/ld-time.c
+@@ -215,8 +215,10 @@ No definition for %s category found"), "
+ }
+ else
+ {
++ static const uint32_t wt_fmt_ampm[]
++ = { '%','I',':','%','M',':','%','S',' ','%','p',0 };
+ time->t_fmt_ampm = "%I:%M:%S %p";
+- time->wt_fmt_ampm = (const uint32_t *) L"%I:%M:%S %p";
++ time->wt_fmt_ampm = wt_fmt_ampm;
+ }
+ }
+
+@@ -226,7 +228,7 @@ No definition for %s category found"), "
+ const int days_per_month[12] = { 31, 29, 31, 30, 31, 30,
+ 31, 31, 30, 31 ,30, 31 };
+ size_t idx;
+- wchar_t *wstr;
++ uint32_t *wstr;
+
+ time->era_entries =
+ (struct era_data *) xmalloc (time->num_era
+@@ -464,18 +466,18 @@ No definition for %s category found"), "
+ }
+
+ /* Now generate the wide character name and format. */
+- wstr = wcschr ((wchar_t *) time->wera[idx], L':');/* end direction */
+- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end offset */
+- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end start */
+- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end end */
++ wstr = wcschr_uint32 (time->wera[idx], L':'); /* end direction */
++ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end offset */
++ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end start */
++ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end end */
+ if (wstr != NULL)
+ {
+- time->era_entries[idx].wname = (uint32_t *) wstr + 1;
+- wstr = wcschr (wstr + 1, L':'); /* end name */
++ time->era_entries[idx].wname = wstr + 1;
++ wstr = wcschr_uint32 (wstr + 1, L':'); /* end name */
+ if (wstr != NULL)
+ {
+ *wstr = L'\0';
+- time->era_entries[idx].wformat = (uint32_t *) wstr + 1;
++ time->era_entries[idx].wformat = wstr + 1;
+ }
+ else
+ time->era_entries[idx].wname =
+@@ -530,7 +532,16 @@ No definition for %s category found"), "
+ if (time->date_fmt == NULL)
+ time->date_fmt = "%a %b %e %H:%M:%S %Z %Y";
+ if (time->wdate_fmt == NULL)
+- time->wdate_fmt = (const uint32_t *) L"%a %b %e %H:%M:%S %Z %Y";
++ {
++ static const uint32_t wdate_fmt[] =
++ { '%','a',' ',
++ '%','b',' ',
++ '%','e',' ',
++ '%','H',':','%','M',':','%','S',' ',
++ '%','Z',' ',
++ '%','Y',0 };
++ time->wdate_fmt = wdate_fmt;
++ }
+ }
+
+
+Index: git/locale/programs/linereader.c
+===================================================================
+--- git.orig/locale/programs/linereader.c
++++ git/locale/programs/linereader.c
+@@ -595,7 +595,7 @@ get_string (struct linereader *lr, const
+ {
+ int return_widestr = lr->return_widestr;
+ char *buf;
+- wchar_t *buf2 = NULL;
++ uint32_t *buf2 = NULL;
+ size_t bufact;
+ size_t bufmax = 56;
+
+Index: git/locale/programs/localedef.c
+===================================================================
+--- git.orig/locale/programs/localedef.c
++++ git/locale/programs/localedef.c
+@@ -114,6 +114,7 @@ void (*argp_program_version_hook) (FILE
+ #define OPT_LIST_ARCHIVE 309
+ #define OPT_LITTLE_ENDIAN 400
+ #define OPT_BIG_ENDIAN 401
++#define OPT_UINT32_ALIGN 402
+
+ /* Definitions of arguments for argp functions. */
+ static const struct argp_option options[] =
+@@ -150,6 +151,8 @@ static const struct argp_option options[
+ N_("Generate little-endian output") },
+ { "big-endian", OPT_BIG_ENDIAN, NULL, 0,
+ N_("Generate big-endian output") },
++ { "uint32-align", OPT_UINT32_ALIGN, "ALIGNMENT", 0,
++ N_("Set the target's uint32_t alignment in bytes (default 4)") },
+ { NULL, 0, NULL, 0, NULL }
+ };
+
+@@ -239,12 +242,14 @@ main (int argc, char *argv[])
+ ctype locale. (P1003.2 4.35.5.2) */
+ setlocale (LC_CTYPE, "POSIX");
+
++#ifndef NO_SYSCONF
+ /* Look whether the system really allows locale definitions. POSIX
+ defines error code 3 for this situation so I think it must be
+ a fatal error (see P1003.2 4.35.8). */
+ if (sysconf (_SC_2_LOCALEDEF) < 0)
+ WITH_CUR_LOCALE (error (3, 0, _("\
+ FATAL: system does not define `_POSIX2_LOCALEDEF'")));
++#endif
+
+ /* Process charmap file. */
+ charmap = charmap_read (charmap_file, verbose, 1, be_quiet, 1);
+@@ -338,6 +343,9 @@ parse_opt (int key, char *arg, struct ar
+ case OPT_BIG_ENDIAN:
+ set_big_endian (true);
+ break;
++ case OPT_UINT32_ALIGN:
++ uint32_align_mask = strtol (arg, NULL, 0) - 1;
++ break;
+ case 'c':
+ force_output = 1;
+ break;
+Index: git/locale/programs/locfile.c
+===================================================================
+--- git.orig/locale/programs/locfile.c
++++ git/locale/programs/locfile.c
+@@ -544,6 +544,9 @@ compare_files (const char *filename1, co
+ machine running localedef. */
+ bool swap_endianness_p;
+
++/* The target's value of __align__(uint32_t) - 1. */
++unsigned int uint32_align_mask = 3;
++
+ /* When called outside a start_locale_structure/end_locale_structure
+ or start_locale_prelude/end_locale_prelude block, record that the
+ next byte in FILE's obstack will be the first byte of a new element.
+@@ -621,7 +624,7 @@ add_locale_string (struct locale_file *f
+ void
+ add_locale_wstring (struct locale_file *file, const uint32_t *string)
+ {
+- add_locale_uint32_array (file, string, wcslen ((const wchar_t *) string) + 1);
++ add_locale_uint32_array (file, string, wcslen_uint32 (string) + 1);
+ }
+
+ /* Record that FILE's next element is the 32-bit integer VALUE. */
+Index: git/locale/programs/locfile.h
+===================================================================
+--- git.orig/locale/programs/locfile.h
++++ git/locale/programs/locfile.h
+@@ -71,6 +71,8 @@ extern void write_all_categories (struct
+
+ extern bool swap_endianness_p;
+
++extern unsigned int uint32_align_mask;
++
+ /* Change the output to be big-endian if BIG_ENDIAN is true and
+ little-endian otherwise. */
+ static inline void
+@@ -89,7 +91,8 @@ maybe_swap_uint32 (uint32_t value)
+ }
+
+ /* Likewise, but munge an array of N uint32_ts starting at ARRAY. */
+-static inline void
++static void
++__attribute__ ((unused))
+ maybe_swap_uint32_array (uint32_t *array, size_t n)
+ {
+ if (swap_endianness_p)
+@@ -99,7 +102,8 @@ maybe_swap_uint32_array (uint32_t *array
+
+ /* Like maybe_swap_uint32_array, but the array of N elements is at
+ the end of OBSTACK's current object. */
+-static inline void
++static void
++__attribute__ ((unused))
+ maybe_swap_uint32_obstack (struct obstack *obstack, size_t n)
+ {
+ maybe_swap_uint32_array ((uint32_t *) obstack_next_free (obstack) - n, n);
+@@ -276,4 +280,55 @@ extern void identification_output (struc
+ const struct charmap_t *charmap,
+ const char *output_path);
+
++static size_t wcslen_uint32 (const uint32_t *str) __attribute__ ((unused));
++static uint32_t * wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n) __attribute__ ((unused));
++static uint32_t * wcschr_uint32 (const uint32_t *s, uint32_t ch) __attribute__ ((unused));
++static int wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2) __attribute__ ((unused));
++static int wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n) __attribute__ ((unused));
++
++static size_t
++wcslen_uint32 (const uint32_t *str)
++{
++ size_t len = 0;
++ while (str[len] != 0)
++ len++;
++ return len;
++}
++
++static int
++wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n)
++{
++ while (n-- != 0)
++ {
++ int diff = *s1++ - *s2++;
++ if (diff != 0)
++ return diff;
++ }
++ return 0;
++}
++
++static int
++wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2)
++{
++ while (*s1 != 0 && *s1 == *s2)
++ s1++, s2++;
++ return *s1 - *s2;
++}
++
++static uint32_t *
++wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n)
++{
++ return memcpy (s1, s2, n * sizeof (uint32_t));
++}
++
++static uint32_t *
++wcschr_uint32 (const uint32_t *s, uint32_t ch)
++{
++ do
++ if (*s == ch)
++ return (uint32_t *) s;
++ while (*s++ != 0);
++ return 0;
++}
++
+ #endif /* locfile.h */
+Index: git/locale/setlocale.c
+===================================================================
+--- git.orig/locale/setlocale.c
++++ git/locale/setlocale.c
+@@ -64,36 +64,6 @@ static char *const _nl_current_used[] =
+ #endif
+
+
+-/* Define an array of category names (also the environment variable names). */
+-const union catnamestr_t _nl_category_names attribute_hidden =
+- {
+- {
+-#define DEFINE_CATEGORY(category, category_name, items, a) \
+- category_name,
+-#include "categories.def"
+-#undef DEFINE_CATEGORY
+- }
+- };
+-
+-const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden =
+- {
+-#define DEFINE_CATEGORY(category, category_name, items, a) \
+- [category] = offsetof (union catnamestr_t, CATNAMEMF (__LINE__)),
+-#include "categories.def"
+-#undef DEFINE_CATEGORY
+- };
+-
+-/* An array of their lengths, for convenience. */
+-const uint8_t _nl_category_name_sizes[] attribute_hidden =
+- {
+-#define DEFINE_CATEGORY(category, category_name, items, a) \
+- [category] = sizeof (category_name) - 1,
+-#include "categories.def"
+-#undef DEFINE_CATEGORY
+- [LC_ALL] = sizeof ("LC_ALL") - 1
+- };
+-
+-
+ #ifdef NL_CURRENT_INDIRECT
+ # define WEAK_POSTLOAD(postload) weak_extern (postload)
+ #else
+Index: git/locale/xlocale.c
+===================================================================
+--- git.orig/locale/xlocale.c
++++ git/locale/xlocale.c
+@@ -18,6 +18,7 @@
+ <http://www.gnu.org/licenses/>. */
+
+ #include <locale.h>
++#include <gnu/option-groups.h>
+ #include "localeinfo.h"
+
+ #define DEFINE_CATEGORY(category, category_name, items, a) \
+@@ -25,6 +26,19 @@ extern struct __locale_data _nl_C_##cate
+ #include "categories.def"
+ #undef DEFINE_CATEGORY
+
++/* If the locale support code isn't enabled, don't generate strong
++ reference to the C locale_data structures here; let the Makefile
++ decide which ones to include. (In the static linking case, the
++ strong reference to the 'class', 'toupper', and 'tolower' tables
++ will cause C-ctype.o to be brought in, as it should be, even when
++ the reference to _nl_C_LC_CTYPE will be weak.) */
++#if ! __OPTION_EGLIBC_LOCALE_CODE
++# define DEFINE_CATEGORY(category, category_name, items, a) \
++ weak_extern (_nl_C_##category)
++# include "categories.def"
++# undef DEFINE_CATEGORY
++#endif
++
+ /* Defined in locale/C-ctype.c. */
+ extern const char _nl_C_LC_CTYPE_class[] attribute_hidden;
+ extern const char _nl_C_LC_CTYPE_toupper[] attribute_hidden;
+@@ -52,3 +66,26 @@ const struct __locale_struct _nl_C_locob
+ .__ctype_tolower = (const int *) _nl_C_LC_CTYPE_tolower + 128,
+ .__ctype_toupper = (const int *) _nl_C_LC_CTYPE_toupper + 128
+ };
++
++
++#if ! __OPTION_EGLIBC_LOCALE_CODE
++/* When locale code is enabled, these are each defined in the
++ appropriate lc-CATEGORY.c file, so that static links (when __thread
++ is supported) bring in only those lc-CATEGORY.o files for
++ categories the program actually uses; look for NL_CURRENT_INDIRECT
++ in localeinfo.h.
++
++ When locale code is disabled, the _nl_C_CATEGORY objects are the
++ only possible referents. At the moment, there isn't a way to get
++ __OPTION_EGLIBC_LOCALE_CODE defined in every compilation unit that
++ #includes localeinfo.h, so we can't just turn off
++ NL_CURRENT_INDIRECT. So we'll define the _nl_current_CATEGORY
++ pointers here. */
++#if defined (NL_CURRENT_INDIRECT)
++#define DEFINE_CATEGORY(category, category_name, items, a) \
++ __thread struct __locale_data * const *_nl_current_##category \
++ attribute_hidden = &_nl_C_locobj.__locales[category];
++#include "categories.def"
++#undef DEFINE_CATEGORY
++#endif
++#endif /* __OPTION_EGLIBC_LOCALE_CODE */
+Index: git/localedata/Makefile
+===================================================================
+--- git.orig/localedata/Makefile
++++ git/localedata/Makefile
+@@ -21,12 +21,22 @@ subdir := localedata
+
+ include ../Makeconfig
+
+-# List with all available character set descriptions.
+-charmaps := $(wildcard charmaps/[A-I]*) $(wildcard charmaps/[J-Z]*)
++include ../option-groups.mak
+
+ # List with all available character set descriptions.
+-locales := $(wildcard locales/*)
++all-charmaps := $(wildcard charmaps/[A-I]*) $(wildcard charmaps/[J-Z]*)
++
++all-locales := $(wildcard locales/*)
+
++# If the EGLIBC_LOCALES option group is not enabled, trim the
++# list of charmap and locale source files.
++ifeq ($(OPTION_EGLIBC_LOCALES),y)
++charmaps := $(all-charmaps)
++locales := $(all-locales)
++else
++charmaps :=
++locales := locales/POSIX
++endif
+
+ subdir-dirs = tests-mbwc
+ vpath %.c tests-mbwc
+@@ -71,14 +81,20 @@ locale_test_suite := tst_iswalnum tst_is
+ tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \
+ tst_wctype tst_wcwidth
+
+-tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
++# Since these tests build their own locale files, they're not
++# dependent on the OPTION_EGLIBC_LOCALES option group. But they do
++# need the locale functions to be present.
++tests-$(OPTION_EGLIBC_LOCALE_CODE) \
++ += $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
+ tst-leaks tst-mbswcs1 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 \
+ tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
+ tst-strfmon1 tst-sscanf bug-setlocale1 tst-setlocale2 tst-setlocale3 \
+ tst-wctype
++ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
+ tests-static = bug-setlocale1-static
+ tests += $(tests-static)
+-ifeq (yes,$(build-shared))
++endif
++ifeq (yesy,$(build-shared)$(OPTION_EGLIBC_LOCALE_CODE))
+ ifneq (no,$(PERL))
+ tests-special += $(objpfx)mtrace-tst-leaks.out
+ endif
+@@ -95,6 +111,7 @@ tests: $(objdir)/iconvdata/gconv-modules
+ tests-static += tst-langinfo-static
+
+ ifeq ($(run-built-tests),yes)
++ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
+ tests-special += $(objpfx)sort-test.out $(objpfx)tst-fmon.out \
+ $(objpfx)tst-locale.out $(objpfx)tst-rpmatch.out \
+ $(objpfx)tst-trans.out $(objpfx)tst-ctype.out \
+@@ -113,6 +130,7 @@ CHARMAPS := $(shell echo "$(LOCALES)" |
+ CTYPE_FILES = $(addsuffix /LC_CTYPE,$(LOCALES))
+ tests-special += $(addprefix $(objpfx),$(CTYPE_FILES))
+ endif
++endif
+
+ include ../Rules
+
+@@ -205,6 +223,11 @@ endif
+
+ include SUPPORTED
+
++# Only install locale data if OPTION_EGLIBC_LOCALES is selected.
++ifneq ($(OPTION_EGLIBC_LOCALES),y)
++SUPPORTED-LOCALES :=
++endif
++
+ INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES))
+
+ # Sometimes the whole collection of locale files should be installed.
+Index: git/login/Makefile
+===================================================================
+--- git.orig/login/Makefile
++++ git/login/Makefile
+@@ -18,6 +18,7 @@
+ #
+ # Sub-makefile for login portion of the library.
+ #
++include ../option-groups.mak
+
+ subdir := login
+
+@@ -25,14 +26,16 @@ include ../Makeconfig
+
+ headers := utmp.h bits/utmp.h lastlog.h pty.h
+
+-routines := getlogin getlogin_r setlogin getlogin_r_chk \
+- getutent getutent_r getutid getutline getutid_r getutline_r \
+- utmp_file utmpname updwtmp getpt grantpt unlockpt ptsname \
+- ptsname_r_chk
++routines := getpt grantpt unlockpt ptsname ptsname_r_chk
++routines-$(OPTION_EGLIBC_UTMP) \
++ += getutent getutent_r getutid getutline getutid_r getutline_r \
++ utmp_file utmpname updwtmp
++routines-$(OPTION_EGLIBC_GETLOGIN) += getlogin getlogin_r getlogin_r_chk
++routines-$(OPTION_EGLIBC_BSD) += setlogin
+
+ CFLAGS-grantpt.c = -DLIBEXECDIR='"$(libexecdir)"'
+
+-others = utmpdump
++others-$(OPTION_EGLIBC_UTMP) += utmpdump
+
+ ifeq (yes,$(build-pt-chown))
+ others += pt_chown
+@@ -46,8 +49,8 @@ vpath %.c programs
+ tests := tst-utmp tst-utmpx tst-grantpt tst-ptsname
+
+ # Build the -lutil library with these extra functions.
+-extra-libs := libutil
+-extra-libs-others := $(extra-libs)
++extra-libs-$(OPTION_EGLIBC_UTMP) := libutil
++extra-libs-others := $(extra-libs-y)
+
+ libutil-routines:= login login_tty logout logwtmp openpty forkpty
+
+Index: git/Makeconfig
+===================================================================
+--- git.orig/Makeconfig
++++ git/Makeconfig
+@@ -582,7 +582,7 @@ elf-objpfx = $(common-objpfx)elf/
+ # and run on the build system, causes that program with those
+ # arguments to be run on the host for which the library is built.
+ ifndef test-wrapper
+-test-wrapper =
++test-wrapper = $(cross-test-wrapper)
+ endif
+ # Likewise, but the name of the program is preceded by
+ # <variable>=<value> assignments for environment variables.
+@@ -1055,6 +1055,24 @@ else
+ libm = $(common-objpfx)math/libm.a
+ endif
+
++# Generate a header file that #defines preprocessor symbols indicating
++# which option groups are enabled. Note that the option-groups.config file
++# may not exist at all.
++before-compile += $(common-objpfx)gnu/option-groups.h
++common-generated += gnu/option-groups.h gnu/option-groups.stmp
++headers += gnu/option-groups.h
++$(common-objpfx)gnu/option-groups.h: $(common-objpfx)gnu/option-groups.stmp; @:
++$(common-objpfx)gnu/option-groups.stmp: \
++ $(..)scripts/option-groups.awk \
++ $(..)option-groups.defaults \
++ $(wildcard $(common-objpfx)option-groups.config)
++ $(make-target-directory)
++ @rm -f ${@:stmp=T} $@
++ LC_ALL=C $(AWK) -f $^ > ${@:stmp=T}
++ $(move-if-change) ${@:stmp=T} ${@:stmp=h}
++ touch $@
++
++
+ # These are the subdirectories containing the library source. The order
+ # is more or less arbitrary. The sorting step will take care of the
+ # dependencies.
+Index: git/Makerules
+===================================================================
+--- git.orig/Makerules
++++ git/Makerules
+@@ -446,6 +446,25 @@ define sed-remove-objpfx
+ endef
+ endif
+
++# Include targets in the selected option groups.
++aux += $(aux-y)
++extra-libs += $(extra-libs-y)
++extra-libs-others += $(extra-libs-others-y)
++extra-objs += $(extra-objs-y)
++install-bin += $(install-bin-y)
++install-others += $(install-others-y)
++install-sbin += $(install-sbin-y)
++modules += $(modules-y)
++others += $(others-y)
++others-pie += $(others-pie-y)
++routines += $(routines-y)
++static-only-routines += $(static-only-routines-y)
++sysdep_routines += $(sysdep_routines-y)
++test-srcs += $(test-srcs-y)
++tests += $(tests-y)
++xtests += $(xtests-y)
++
++
+ # Modify the list of routines we build for different targets
+
+ ifeq (yes,$(build-shared))
+Index: git/malloc/Makefile
+===================================================================
+--- git.orig/malloc/Makefile
++++ git/malloc/Makefile
+@@ -18,6 +18,8 @@
+ #
+ # Makefile for malloc routines
+ #
++include ../option-groups.mak
++
+ subdir := malloc
+
+ include ../Makeconfig
+@@ -36,9 +38,15 @@ install-lib := libmcheck.a
+ non-lib.a := libmcheck.a
+
+ # Additional library.
++ifeq ($(OPTION_EGLIBC_MEMUSAGE),y)
+ extra-libs = libmemusage
+ extra-libs-others = $(extra-libs)
+
++ifdef OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
++CPPFLAGS-memusage += -D__OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE=$(OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE)
++endif
++endif
++
+ libmemusage-routines = memusage
+ libmemusage-inhibit-o = $(filter-out .os,$(object-suffixes))
+
+@@ -65,7 +73,7 @@ endif
+ # Unless we get a test for the availability of libgd which also works
+ # for cross-compiling we disable the memusagestat generation in this
+ # situation.
+-ifneq ($(cross-compiling),yes)
++ifeq ($(cross-compiling)$(OPTION_EGLIBC_MEMUSAGE),noy)
+ # If the gd library is available we build the `memusagestat' program.
+ ifneq ($(LIBGD),no)
+ others: $(objpfx)memusage
+Index: git/malloc/memusage.c
+===================================================================
+--- git.orig/malloc/memusage.c
++++ git/malloc/memusage.c
+@@ -33,6 +33,7 @@
+ #include <stdint.h>
+ #include <sys/mman.h>
+ #include <sys/time.h>
++#include <gnu/option-groups.h>
+
+ #include <memusage.h>
+
+@@ -93,7 +94,11 @@ static __thread uintptr_t start_sp;
+ #define peak_stack peak_use[1]
+ #define peak_total peak_use[2]
+
+-#define DEFAULT_BUFFER_SIZE 32768
++#ifndef __OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
++# define DEFAULT_BUFFER_SIZE 32768
++#else
++# define DEFAULT_BUFFER_SIZE __OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
++#endif
+ static size_t buffer_size;
+
+ static int fd = -1;
+Index: git/malloc/memusage.sh
+===================================================================
+--- git.orig/malloc/memusage.sh
++++ git/malloc/memusage.sh
+@@ -35,7 +35,7 @@ do_missing_arg() {
+
+ # Print help message
+ do_help() {
+- echo $"Usage: memusage [OPTION]... PROGRAM [PROGRAMOPTION]...
++ printf $"Usage: memusage [OPTION]... PROGRAM [PROGRAMOPTION]...
+ Profile memory usage of PROGRAM.
+
+ -n,--progname=NAME Name of the program file to profile
+Index: git/math/Makefile
+===================================================================
+--- git.orig/math/Makefile
++++ git/math/Makefile
+@@ -21,6 +21,8 @@ subdir := math
+
+ include ../Makeconfig
+
++include ../option-groups.mak
++
+ # Installed header files.
+ headers := math.h bits/mathcalls.h bits/mathinline.h bits/huge_val.h \
+ bits/huge_valf.h bits/huge_vall.h bits/inf.h bits/nan.h \
+@@ -33,8 +35,8 @@ aux := setfpucw fpu_control
+
+ # Build the -lm library.
+
+-extra-libs := libm
+-extra-libs-others = $(extra-libs)
++extra-libs-$(OPTION_EGLIBC_LIBM) := libm
++extra-libs-others-$(OPTION_EGLIBC_LIBM) = $(extra-libs-$(OPTION_EGLIBC_LIBM))
+
+ libm-support = s_lib_version s_matherr s_signgam \
+ fclrexcpt fgetexcptflg fraiseexcpt fsetexcptflg \
+Index: git/misc/err.c
+===================================================================
+--- git.orig/misc/err.c
++++ git/misc/err.c
+@@ -22,6 +22,7 @@
+ #include <errno.h>
+ #include <string.h>
+ #include <stdio.h>
++#include <gnu/option-groups.h>
+
+ #include <wchar.h>
+ #define flockfile(s) _IO_flockfile (s)
+@@ -37,6 +38,7 @@ extern char *__progname;
+ va_end (ap); \
+ }
+
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ static void
+ convert_and_print (const char *format, __gnuc_va_list ap)
+ {
+@@ -81,6 +83,7 @@ convert_and_print (const char *format, _
+
+ __vfwprintf (stderr, wformat, ap);
+ }
++#endif
+
+ void
+ vwarnx (const char *format, __gnuc_va_list ap)
+@@ -88,9 +91,13 @@ vwarnx (const char *format, __gnuc_va_li
+ flockfile (stderr);
+ if (_IO_fwide (stderr, 0) > 0)
+ {
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ __fwprintf (stderr, L"%s: ", __progname);
+ convert_and_print (format, ap);
+ putwc_unlocked (L'\n', stderr);
++#else
++ abort ();
++#endif
+ }
+ else
+ {
+@@ -111,6 +118,7 @@ vwarn (const char *format, __gnuc_va_lis
+ flockfile (stderr);
+ if (_IO_fwide (stderr, 0) > 0)
+ {
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ __fwprintf (stderr, L"%s: ", __progname);
+ if (format)
+ {
+@@ -119,6 +127,9 @@ vwarn (const char *format, __gnuc_va_lis
+ }
+ __set_errno (error);
+ __fwprintf (stderr, L"%m\n");
++#else
++ abort ();
++#endif
+ }
+ else
+ {
+Index: git/misc/error.c
+===================================================================
+--- git.orig/misc/error.c
++++ git/misc/error.c
+@@ -35,6 +35,7 @@
+ #endif
+
+ #ifdef _LIBC
++# include <gnu/option-groups.h>
+ # include <libintl.h>
+ # include <stdbool.h>
+ # include <stdint.h>
+@@ -205,6 +206,7 @@ error_tail (int status, int errnum, cons
+ #if _LIBC
+ if (_IO_fwide (stderr, 0) > 0)
+ {
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ size_t len = strlen (message) + 1;
+ wchar_t *wmessage = NULL;
+ mbstate_t st;
+@@ -265,6 +267,9 @@ error_tail (int status, int errnum, cons
+
+ if (use_malloc)
+ free (wmessage);
++#else
++ abort ();
++#endif
+ }
+ else
+ #endif
+Index: git/misc/Makefile
+===================================================================
+--- git.orig/misc/Makefile
++++ git/misc/Makefile
+@@ -19,6 +19,10 @@
+ # Sub-makefile for misc portion of the library.
+ #
+
++# Some system-dependent implementations of these functions use option
++# groups (see sysdeps/unix/sysv/linux/Makefile, for example).
++include ../option-groups.mak
++
+ subdir := misc
+
+ include ../Makeconfig
+@@ -46,40 +50,47 @@ routines := brk sbrk sstk ioctl \
+ select pselect \
+ acct chroot fsync sync fdatasync syncfs reboot \
+ gethostid sethostid \
+- revoke vhangup \
++ vhangup \
+ swapon swapoff mktemp mkstemp mkstemp64 mkdtemp \
+ mkostemp mkostemp64 mkstemps mkstemps64 mkostemps mkostemps64 \
+ ualarm usleep \
+ gtty stty \
+ ptrace \
+- fstab mntent mntent_r \
++ mntent mntent_r \
+ utimes lutimes futimes futimesat \
+ truncate ftruncate truncate64 ftruncate64 \
+- chflags fchflags \
+ insremque getttyent getusershell getpass ttyslot \
+ syslog syscall daemon \
+ mmap mmap64 munmap mprotect msync madvise mincore remap_file_pages\
+ mlock munlock mlockall munlockall \
+- efgcvt efgcvt_r qefgcvt qefgcvt_r \
+ hsearch hsearch_r tsearch lsearch \
+ err error ustat \
+- getsysstats dirname regexp \
++ getsysstats dirname \
+ getloadavg getclktck \
+ fgetxattr flistxattr fremovexattr fsetxattr getxattr \
+ listxattr lgetxattr llistxattr lremovexattr lsetxattr \
+ removexattr setxattr getauxval ifunc-impl-list
+
++routines-$(OPTION_POSIX_REGEXP) += regexp
++routines-$(OPTION_EGLIBC_FSTAB) += fstab
++routines-$(OPTION_EGLIBC_BSD) += chflags fchflags revoke
++routines-$(OPTION_EGLIBC_FCVT) += efgcvt efgcvt_r qefgcvt qefgcvt_r
++
+ generated += tst-error1.mtrace tst-error1-mem.out
+
+ aux := init-misc
+ install-lib := libg.a
+ gpl2lgpl := error.c error.h
+
+-tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
+- tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1
++tests := tst-dirname tst-tsearch tst-fdset tst-mntent tst-hsearch \
++ tst-pselect tst-insremque tst-mntent2 bug-hsearch1
++tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) += tst-error1
++tests-$(OPTION_EGLIBC_FCVT) += tst-efgcvt
+ ifeq ($(run-built-tests),yes)
++ifeq (y,$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO))
+ tests-special += $(objpfx)tst-error1-mem.out
+ endif
++endif
+
+ CFLAGS-select.c = -fexceptions -fasynchronous-unwind-tables
+ CFLAGS-tsearch.c = $(uses-callbacks)
+Index: git/misc/tst-efgcvt.c
+===================================================================
+--- git.orig/misc/tst-efgcvt.c
++++ git/misc/tst-efgcvt.c
+@@ -59,7 +59,7 @@ static testcase ecvt_tests[] =
+ { 123.01, -4, 3, "" },
+ { 126.71, -4, 3, "" },
+ { 0.0, 4, 1, "0000" },
+-#if DBL_MANT_DIG == 53
++#if DBL_MANT_DIG == 53 && !(defined __powerpc__ && defined __NO_FPRS__ && !defined _SOFT_FLOAT && !defined _SOFT_DOUBLE)
+ { 0x1p-1074, 3, -323, "494" },
+ { -0x1p-1074, 3, -323, "494" },
+ #endif
+Index: git/nis/Makefile
+===================================================================
+--- git.orig/nis/Makefile
++++ git/nis/Makefile
+@@ -18,6 +18,8 @@
+ #
+ # Makefile for NIS/NIS+ part.
+ #
++include ../option-groups.mak
++
+ subdir := nis
+
+ include ../Makeconfig
+@@ -30,19 +32,26 @@ endif
+
+ # These are the databases available for the nis (and perhaps later nisplus)
+ # service. This must be a superset of the services in nss.
+-databases = proto service hosts network grp pwd rpc ethers \
+- spwd netgrp alias publickey
++databases-y := proto service hosts network grp pwd rpc ethers \
++ spwd netgrp publickey
++databases-$(OPTION_EGLIBC_DB_ALIASES) += alias
+
+ # Specify rules for the nss_* modules.
+-services := nis nisplus compat
++# The 'compat' module includes nis support, and the 'nss' directory
++# includes a bare-bones "files" library, so we'll include 'compat' in
++# OPTION_EGLIBC_NIS.
++services-y :=
++services-$(OPTION_EGLIBC_NIS) += nis nisplus compat
++
++extra-libs-$(OPTION_EGLIBC_NIS) += libnsl
++extra-libs-y += $(services-y:%=libnss_%)
+
+-extra-libs = libnsl $(services:%=libnss_%)
+ # These libraries will be built in the `others' pass rather than
+ # the `lib' pass, because they depend on libc.so being built already.
+-extra-libs-others = $(extra-libs)
++extra-libs-others-y += $(extra-libs-y)
+
+ # The sources are found in the appropriate subdir.
+-subdir-dirs = $(services:%=nss_%)
++subdir-dirs = $(services-y:%=nss_%)
+ vpath %.c $(subdir-dirs)
+
+ libnsl-routines = yp_xdr ypclnt ypupdate_xdr \
+@@ -60,11 +69,11 @@ libnsl-routines = yp_xdr ypclnt ypupdate
+ libnss_compat-routines := $(addprefix compat-,grp pwd spwd initgroups)
+ libnss_compat-inhibit-o = $(filter-out .os,$(object-suffixes))
+
+-libnss_nis-routines := $(addprefix nis-,$(databases)) nis-initgroups \
++libnss_nis-routines := $(addprefix nis-,$(databases-y)) nis-initgroups \
+ nss-nis
+ libnss_nis-inhibit-o = $(filter-out .os,$(object-suffixes))
+
+-libnss_nisplus-routines := $(addprefix nisplus-,$(databases)) nisplus-parser \
++libnss_nisplus-routines := $(addprefix nisplus-,$(databases-y)) nisplus-parser \
+ nss-nisplus nisplus-initgroups
+ libnss_nisplus-inhibit-o = $(filter-out .os,$(object-suffixes))
+
+@@ -80,12 +89,12 @@ libnsl-libc = $(common-objpfx)linkobj/li
+ # Target-specific variable setting to link objects using deprecated
+ # RPC interfaces with the version of libc.so that makes them available
+ # for new links:
+-$(services:%=$(objpfx)libnss_%.so) $(objpfx)libnsl.so: \
++$(services-y:%=$(objpfx)libnss_%.so) $(objpfx)libnsl.so: \
+ libc-for-link = $(libnsl-libc)
+
+
+ ifeq ($(build-shared),yes)
+-$(others:%=$(objpfx)%): $(objpfx)libnsl.so$(libnsl.so-version)
++$(others-y:%=$(objpfx)%): $(objpfx)libnsl.so$(libnsl.so-version)
+ else
+-$(others:%=$(objpfx)%): $(objpfx)libnsl.a
++$(others-y:%=$(objpfx)%): $(objpfx)libnsl.a
+ endif
+Index: git/nptl/Makefile
+===================================================================
+--- git.orig/nptl/Makefile
++++ git/nptl/Makefile
+@@ -18,6 +18,8 @@
+ #
+ # Sub-makefile for NPTL portion of the library.
+ #
++include ../option-groups.mak
++
+ subdir := nptl
+
+ include ../Makeconfig
+@@ -117,7 +119,7 @@ libpthread-routines = nptl-init vars eve
+ pt-raise pt-system \
+ flockfile ftrylockfile funlockfile \
+ sigaction \
+- herrno res pt-allocrtsig \
++ pt-allocrtsig \
+ pthread_kill_other_threads \
+ pthread_getaffinity pthread_setaffinity \
+ pthread_attr_getaffinity pthread_attr_setaffinity \
+@@ -137,6 +139,8 @@ libpthread-routines = nptl-init vars eve
+ # pthread_setgid pthread_setegid pthread_setregid \
+ # pthread_setresgid
+
++libpthread-routines-$(OPTION_EGLIBC_INET) := herrno res
++
+ libpthread-shared-only-routines = version pt-allocrtsig unwind-forcedunwind
+ libpthread-static-only-routines = pthread_atfork
+
+@@ -211,7 +215,7 @@ tests = tst-typesizes \
+ tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 tst-mutexpi5 \
+ tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a tst-mutexpi8 \
+ tst-mutexpi9 \
+- tst-spin1 tst-spin2 tst-spin3 tst-spin4 \
++ tst-spin1 tst-spin2 tst-spin3 \
+ tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 \
+ tst-cond8 tst-cond9 tst-cond10 tst-cond11 tst-cond12 tst-cond13 \
+ tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18 tst-cond19 \
+@@ -245,14 +249,14 @@ tests = tst-typesizes \
+ tst-cancel6 tst-cancel7 tst-cancel8 tst-cancel9 tst-cancel10 \
+ tst-cancel11 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 \
+ tst-cancel16 tst-cancel17 tst-cancel18 tst-cancel19 tst-cancel20 \
+- tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel24 tst-cancel25 \
++ tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel25 \
+ tst-cancel-self tst-cancel-self-cancelstate \
+ tst-cancel-self-canceltype tst-cancel-self-testcancel \
+ tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \
+ tst-flock1 tst-flock2 \
+ tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \
+ tst-signal6 tst-signal7 \
+- tst-exec1 tst-exec2 tst-exec3 tst-exec4 \
++ tst-exec2 tst-exec3 tst-exec4 \
+ tst-exit1 tst-exit2 tst-exit3 \
+ tst-stdio1 tst-stdio2 \
+ tst-stack1 tst-stack2 tst-stack3 tst-stack4 tst-pthread-getattr \
+@@ -260,13 +264,12 @@ tests = tst-typesizes \
+ tst-unload \
+ tst-dlsym1 \
+ tst-sysconf \
+- tst-locale1 tst-locale2 \
++ tst-locale2 \
+ tst-umask1 \
+ tst-popen1 \
+ tst-clock1 \
+ tst-context1 \
+ tst-sched1 \
+- tst-backtrace1 \
+ tst-abstime \
+ tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x \
+ tst-getpid1 tst-getpid2 tst-getpid3 \
+@@ -277,6 +280,17 @@ xtests = tst-setuid1 tst-setuid1-static
+ tst-mutexpp1 tst-mutexpp6 tst-mutexpp10
+ test-srcs = tst-oddstacklimit
+
++# This test uses the posix_spawn functions.
++tests-$(OPTION_EGLIBC_SPAWN) += tst-exec1
++
++# This test uses the 'backtrace' functions.
++tests-$(OPTION_EGLIBC_BACKTRACE) += tst-backtrace1
++
++# This test is written in C++.
++tests-$(OPTION_EGLIBC_CXX_TESTS) += tst-cancel24
++
++tests-$(OPTION_EGLIBC_LOCALE_CODE) += tst-locale1
++
+ # Files which must not be linked with libpthread.
+ tests-nolibpthread = tst-unload
+
+Index: git/nptl/pthread_create.c
+===================================================================
+--- git.orig/nptl/pthread_create.c
++++ git/nptl/pthread_create.c
+@@ -32,6 +32,7 @@
+ #include <exit-thread.h>
+ #include <default-sched.h>
+
++#include <gnu/option-groups.h>
+ #include <shlib-compat.h>
+
+ #include <stap-probe.h>
+@@ -261,8 +262,10 @@ START_THREAD_DEFN
+ THREAD_SETMEM (pd, cpuclock_offset, now);
+ #endif
+
++#if __OPTION_EGLIBC_INET
+ /* Initialize resolver state pointer. */
+ __resp = &pd->res;
++#endif
+
+ /* Initialize pointers to locale data. */
+ __ctype_init ();
+@@ -345,8 +348,10 @@ START_THREAD_DEFN
+ /* Run the destructor for the thread-local data. */
+ __nptl_deallocate_tsd ();
+
++#if __OPTION_EGLIBC_INET
+ /* Clean up any state libc stored in thread-local variables. */
+ __libc_thread_freeres ();
++#endif
+
+ /* If this is the last thread we terminate the process now. We
+ do not notify the debugger, it might just irritate it if there
+Index: git/nscd/Makefile
+===================================================================
+--- git.orig/nscd/Makefile
++++ git/nscd/Makefile
+@@ -18,14 +18,17 @@
+ #
+ # Sub-makefile for nscd portion of the library.
+ #
++include ../option-groups.mak
++
+ subdir := nscd
+
+ include ../Makeconfig
+
+ ifneq ($(use-nscd),no)
+-routines := nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai \
++routines-$(OPTION_EGLIBC_INET) += \
++ nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai \
+ nscd_initgroups nscd_getserv_r nscd_netgroup
+-aux := nscd_helper
++aux-$(OPTION_EGLIBC_INET) += nscd_helper
+ endif
+
+ # To find xmalloc.c
+@@ -37,14 +40,18 @@ nscd-modules := nscd connections pwdcach
+ dbg_log nscd_conf nscd_stat cache mem nscd_setup_thread \
+ xmalloc xstrdup aicache initgrcache gai res_hconf \
+ netgroupcache
+-
++ifneq (y,$(OPTION_EGLIBC_NIS))
++# If we haven't build libnsl.so, then we'll need to include our
++# own copy of nis_hash.
++nscd-modules += nis_hash
++endif
+ ifeq ($(build-nscd)$(have-thread-library),yesyes)
+
+-others += nscd
+-others-pie += nscd
+-install-sbin := nscd
++others-$(OPTION_EGLIBC_INET) += nscd
++others-pie-$(OPTION_EGLIBC_INET) += nscd
++install-sbin-$(OPTION_EGLIBC_INET) += nscd
+
+-extra-objs = $(nscd-modules:=.o)
++extra-objs-$(OPTION_EGLIBC_INET) += $(nscd-modules:=.o)
+
+ endif
+
+@@ -100,7 +107,15 @@ include $(patsubst %,$(..)cppflags-itera
+ $(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o)
+
+ ifeq ($(build-shared),yes)
+-$(objpfx)nscd: $(shared-thread-library) $(common-objpfx)nis/libnsl.so
++$(objpfx)nscd: $(shared-thread-library)
++else
++$(objpfx)nscd: $(static-thread-library)
++endif
++
++ifeq (y,$(OPTION_EGLIBC_NIS))
++ifeq ($(build-shared),yes)
++$(objpfx)nscd: $(common-objpfx)nis/libnsl.so
+ else
+-$(objpfx)nscd: $(static-thread-library) $(common-objpfx)nis/libnsl.a
++$(objpfx)nscd: $(common-objpfx)nis/libnsl.a
++endif
+ endif
+Index: git/nscd/nis_hash.c
+===================================================================
+--- /dev/null
++++ git/nscd/nis_hash.c
+@@ -0,0 +1,3 @@
++/* If OPTION_EGLIBC_NIS is disabled, nscd can't get this from libnsl.so;
++ we need our own copy. */
++#include "../nis/nis_hash.c"
+Index: git/nss/fixed-nsswitch.conf
+===================================================================
+--- /dev/null
++++ git/nss/fixed-nsswitch.conf
+@@ -0,0 +1,22 @@
++# /etc/nsswitch.conf
++#
++# Example configuration for fixed name service.
++# See the description of OPTION_EGLIBC_NSSWITCH in option-groups.def
++# for details.
++#
++
++aliases: files
++
++passwd: files
++group: files
++shadow: files
++
++hosts: files dns
++networks: files dns
++
++protocols: files
++services: files
++ethers: files
++rpc: files
++
++netgroup: files
+Index: git/nss/fixed-nsswitch.functions
+===================================================================
+--- /dev/null
++++ git/nss/fixed-nsswitch.functions
+@@ -0,0 +1,121 @@
++/* List of functions defined for fixed NSS in GNU C Library.
++ Copyright (C) 1996, 1997, 1998, 2005 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++/* When OPTION_EGLIBC_NSSWITCH is disabled (see option-groups.def),
++ EGLIBC does not use the 'dlopen' and 'dlsym' functions to look for
++ database query functions in the individual name service libraries.
++ Instead, it uses a set of functions chosen at compile time, as
++ directed by the OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS file. This
++ file is a sample of what you might use there.
++
++ This file is C source code; it should only contain invocations of
++ the following macros:
++
++ - DEFINE_ENT (DATABASE, SERVICE, X)
++
++ Declare the 'setXent', 'getXent_r', and 'endXent' functions that
++ query DATABASE using the service library 'libnss_SERVICE.so.2'.
++ DATABASE should be the full name of the database as it appears in
++ 'nsswitch.conf', like 'passwd' or 'aliases'.
++
++ (The non-reentrant 'getXent' functions are implemented in terms
++ of the reentrant 'getXent_r' functions, so there is no need to
++ refer to them explicitly here.)
++
++ - DEFINE_GETBY (DATABASE, SERVICE, X, KEY)
++
++ Declare the 'getXbyKEY_r' functions that query DATABASE using
++ SERVICE. DATABASE and SERVICE are as described above.
++
++ (The non-reentrant 'getXbyKEY' functions are implemented in terms
++ of the reentrant 'getXbyKEY_r' functions, so there is no need to
++ refer to them explicitly here.)
++
++ Use the special key 'name3' for the service library function that
++ implements the 'getaddrinfo' function.
++
++ - DEFINE_GET (DATABASE, SERVICE, QUERY)
++
++ Declare the 'getQUERY_r' functions that query DATABASE using
++ SERVICE. This is used for functions like 'getpwnam'.
++
++ (The non-reentrant 'getQUERY' functions are implemented in terms
++ of the reentrant 'getQUERY_r' functions, so there is no need to
++ refer to them explicitly here.)
++
++ This sample file only includes functions that consult the files in
++ '/etc', and the Domain Name System (DNS). */
++
++/* aliases */
++DEFINE_ENT (aliases, files, alias)
++DEFINE_GETBY (aliases, files, alias, name)
++
++/* ethers */
++DEFINE_ENT (ethers, files, ether)
++
++/* group */
++DEFINE_ENT (group, files, gr)
++DEFINE_GET (group, files, grgid)
++DEFINE_GET (group, files, grnam)
++
++/* hosts */
++DEFINE_ENT (hosts, files, host)
++DEFINE_GETBY (hosts, files, host, addr)
++DEFINE_GETBY (hosts, files, host, name)
++DEFINE_GETBY (hosts, files, host, name2)
++DEFINE_GET (hosts, files, hostton)
++DEFINE_GET (hosts, files, ntohost)
++DEFINE_GETBY (hosts, dns, host, addr)
++DEFINE_GETBY (hosts, dns, host, name)
++DEFINE_GETBY (hosts, dns, host, name2)
++DEFINE_GETBY (hosts, dns, host, name3)
++
++/* netgroup */
++DEFINE_ENT (netgroup, files, netgr)
++
++/* networks */
++DEFINE_ENT (networks, files, net)
++DEFINE_GETBY (networks, files, net, name)
++DEFINE_GETBY (networks, files, net, addr)
++DEFINE_GETBY (networks, dns, net, name)
++DEFINE_GETBY (networks, dns, net, addr)
++
++/* protocols */
++DEFINE_ENT (protocols, files, proto)
++DEFINE_GETBY (protocols, files, proto, name)
++DEFINE_GETBY (protocols, files, proto, number)
++
++/* passwd */
++DEFINE_ENT (passwd, files, pw)
++DEFINE_GET (passwd, files, pwnam)
++DEFINE_GET (passwd, files, pwuid)
++
++/* rpc */
++DEFINE_ENT (rpc, files, rpc)
++DEFINE_GETBY (rpc, files, rpc, name)
++DEFINE_GETBY (rpc, files, rpc, number)
++
++/* services */
++DEFINE_ENT (services, files, serv)
++DEFINE_GETBY (services, files, serv, name)
++DEFINE_GETBY (services, files, serv, port)
++
++/* shadow */
++DEFINE_ENT (shadow, files, sp)
++DEFINE_GET (shadow, files, spnam)
+Index: git/nss/gen-fixed-nsswitch.c
+===================================================================
+--- /dev/null
++++ git/nss/gen-fixed-nsswitch.c
+@@ -0,0 +1,803 @@
++/* gen-fixed-nsswitch.c --- generate fixed name service data structures
++ Copyright (C) 1996-1999, 2001-2006, 2007 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#define _GNU_SOURCE
++
++#include <stdlib.h>
++#include <stdio.h>
++#include <errno.h>
++#include <string.h>
++#include <stdarg.h>
++#include <assert.h>
++#include <ctype.h>
++
++#include "gnu/lib-names.h"
++#include "nss.h"
++
++/* Provide a fallback definition to allow this file to be compiled outside
++ libc. */
++#ifndef internal_function
++# define internal_function
++#endif
++
++
++/* Simple utilities. */
++
++void __attribute__ ((noreturn))
++error (const char *message)
++{
++ fprintf (stderr, "%s\n", message);
++ exit (1);
++}
++
++
++void *
++check_alloc (void *p)
++{
++ if (p)
++ return p;
++ else
++ error ("out of memory");
++}
++
++void *
++xmalloc (size_t size)
++{
++ return check_alloc (malloc (size));
++}
++
++
++/* Format ARGS according to FORMAT, and return the result as a
++ malloc'ed string. */
++char *
++saprintf (const char *format, ...)
++{
++ va_list args;
++ size_t len;
++ char *buf;
++
++ va_start (args, format);
++ len = vsnprintf (NULL, 0, format, args);
++ va_end (args);
++
++ buf = xmalloc (len + 1);
++ va_start (args, format);
++ assert (len == vsnprintf (buf, len + 1, format, args));
++ va_end (args);
++
++ return buf;
++}
++
++
++
++/* Data structures representing the configuration file in memory. */
++
++/* These are copied from nsswitch.h.
++
++ We could simply #include that file, but this program runs on the
++ build machine and links against the build machine's libraries,
++ whereas that header is meant for use by target code; it uses
++ 'libc_hidden_proto', 'internal_function', and related hair. Since
++ we've copied the parsing code, we might as well copy the data
++ structure definitions as well. */
++
++/* Actions performed after lookup finished. */
++typedef enum
++{
++ NSS_ACTION_CONTINUE,
++ NSS_ACTION_RETURN
++} lookup_actions;
++
++
++typedef struct service_library
++{
++ /* Name of service (`files', `dns', `nis', ...). */
++ const char *name;
++ /* Pointer to the loaded shared library. */
++ void *lib_handle;
++ /* And the link to the next entry. */
++ struct service_library *next;
++} service_library;
++
++
++/* For mapping a function name to a function pointer. It is known in
++ nsswitch.c:nss_lookup_function that a string pointer for the lookup key
++ is the first member. */
++typedef struct
++{
++ const char *fct_name;
++ void *fct_ptr;
++} known_function;
++
++
++typedef struct service_user
++{
++ /* And the link to the next entry. */
++ struct service_user *next;
++ /* Action according to result. */
++ lookup_actions actions[5];
++ /* Link to the underlying library object. */
++ service_library *library;
++ /* Collection of known functions.
++
++ With OPTION_EGLIBC_NSSWITCH enabled, this is the root of a
++ 'tsearch'-style tree.
++
++ With OPTION_EGLIBC_NSSWITCH disabled, this is an array of
++ pointers to known_function structures, NULL-terminated. */
++ union
++ {
++ void *tree;
++ const known_function **array;
++ } known;
++ /* Name of the service (`files', `dns', `nis', ...). */
++ const char *name;
++} service_user;
++
++/* To access the action based on the status value use this macro. */
++#define nss_next_action(ni, status) ((ni)->actions[2 + status])
++
++
++typedef struct name_database_entry
++{
++ /* And the link to the next entry. */
++ struct name_database_entry *next;
++ /* List of service to be used. */
++ service_user *service;
++ /* Name of the database. */
++ const char *name;
++} name_database_entry;
++
++
++typedef struct name_database
++{
++ /* List of all known databases. */
++ name_database_entry *entry;
++ /* List of libraries with service implementation. */
++ service_library *library;
++} name_database;
++
++
++
++/* Gathering the contents of the FIXED_FUNCTIONS file. */
++
++/* It should be possible to generate this list automatically by
++ looking at the services and databases used in the nsswitch.conf
++ file, and having a hard-coded set of queries supported on each
++ database. */
++
++/* We #include the FIXED_FUNCTIONS file several times to build an
++ array of function structures holding its data. */
++enum function_kind {
++ fk_end = 0, /* Last entry. */
++ fk_setent, /* Like setpwent. */
++ fk_getent, /* Like getpwent. */
++ fk_endent, /* Like endpwent. */
++ fk_getby, /* Like gethostbyname. */
++ fk_get /* Like getpwnam. */
++};
++
++
++struct function {
++ /* What kind of function this is. */
++ enum function_kind kind;
++
++ /* The database and service of the function being hardwired in. */
++ char *database, *service;
++
++ /* The kind of entry being queried, for 'fk_setent', 'fk_getent',
++ 'fk_endent', and 'fk_getby' functions. */
++ char *entry;
++
++ /* The key, for 'fk_getby' entries. */
++ char *key;
++
++ /* The value and key, for 'fk_get' entries. */
++ char *value_and_key;
++};
++
++
++const struct function functions[] =
++ {
++
++#define DEFINE_ENT(database, service, entry) \
++ { fk_setent, #database, #service, #entry }, \
++ { fk_getent, #database, #service, #entry }, \
++ { fk_endent, #database, #service, #entry },
++#define DEFINE_GETBY(database, service, entry, key) \
++ { fk_getby, #database, #service, #entry, #key },
++#define DEFINE_GET(database, service, value_and_key) \
++ { fk_get, #database, #service, NULL, NULL, #value_and_key },
++
++#include FIXED_FUNCTIONS
++
++#undef DEFINE_ENT
++#undef DEFINE_GETBY
++#undef DEFINE_GET
++
++ { fk_end }
++ };
++
++
++/* Parsing the config file. Functions copied from nsswitch.c. */
++
++#define __strchrnul strchrnul
++#define __getline getline
++#define __strncasecmp strncasecmp
++
++/* Prototypes for the local functions. */
++static name_database *nss_parse_file (const char *fname) internal_function;
++static name_database_entry *nss_getline (char *line) internal_function;
++static service_user *nss_parse_service_list (const char *line)
++ internal_function;
++
++static name_database *
++internal_function
++nss_parse_file (const char *fname)
++{
++ FILE *fp;
++ name_database *result;
++ name_database_entry *last;
++ char *line;
++ size_t len;
++
++ /* Open the configuration file. */
++ fp = fopen (fname, "rc");
++ if (fp == NULL)
++ return NULL;
++
++ // /* No threads use this stream. */
++ // __fsetlocking (fp, FSETLOCKING_BYCALLER);
++
++ result = (name_database *) xmalloc (sizeof (name_database));
++
++ result->entry = NULL;
++ result->library = NULL;
++ last = NULL;
++ line = NULL;
++ len = 0;
++ do
++ {
++ name_database_entry *this;
++ ssize_t n;
++
++ n = __getline (&line, &len, fp);
++ if (n < 0)
++ break;
++ if (line[n - 1] == '\n')
++ line[n - 1] = '\0';
++
++ /* Because the file format does not know any form of quoting we
++ can search forward for the next '#' character and if found
++ make it terminating the line. */
++ *__strchrnul (line, '#') = '\0';
++
++ /* If the line is blank it is ignored. */
++ if (line[0] == '\0')
++ continue;
++
++ /* Each line completely specifies the actions for a database. */
++ this = nss_getline (line);
++ if (this != NULL)
++ {
++ if (last != NULL)
++ last->next = this;
++ else
++ result->entry = this;
++
++ last = this;
++ }
++ }
++ while (!feof_unlocked (fp));
++
++ /* Free the buffer. */
++ free (line);
++ /* Close configuration file. */
++ fclose (fp);
++
++ return result;
++}
++
++
++/* Read the source names:
++ `( <source> ( "[" "!"? (<status> "=" <action> )+ "]" )? )*'
++ */
++static service_user *
++internal_function
++nss_parse_service_list (const char *line)
++{
++ service_user *result = NULL, **nextp = &result;
++
++ while (1)
++ {
++ service_user *new_service;
++ const char *name;
++
++ while (isspace (line[0]))
++ ++line;
++ if (line[0] == '\0')
++ /* No source specified. */
++ return result;
++
++ /* Read <source> identifier. */
++ name = line;
++ while (line[0] != '\0' && !isspace (line[0]) && line[0] != '[')
++ ++line;
++ if (name == line)
++ return result;
++
++
++ new_service = (service_user *) xmalloc (sizeof (*new_service));
++ new_service->name = (char *) xmalloc (line - name + 1);
++
++ *((char *) __mempcpy ((char *) new_service->name, name, line - name))
++ = '\0';
++
++ /* Set default actions. */
++ new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE;
++ new_service->actions[2 + NSS_STATUS_UNAVAIL] = NSS_ACTION_CONTINUE;
++ new_service->actions[2 + NSS_STATUS_NOTFOUND] = NSS_ACTION_CONTINUE;
++ new_service->actions[2 + NSS_STATUS_SUCCESS] = NSS_ACTION_RETURN;
++ new_service->actions[2 + NSS_STATUS_RETURN] = NSS_ACTION_RETURN;
++ new_service->library = NULL;
++ new_service->known.tree = NULL;
++ new_service->next = NULL;
++
++ while (isspace (line[0]))
++ ++line;
++
++ if (line[0] == '[')
++ {
++ /* Read criterions. */
++ do
++ ++line;
++ while (line[0] != '\0' && isspace (line[0]));
++
++ do
++ {
++ int not;
++ enum nss_status status;
++ lookup_actions action;
++
++ /* Grok ! before name to mean all statii but that one. */
++ not = line[0] == '!';
++ if (not)
++ ++line;
++
++ /* Read status name. */
++ name = line;
++ while (line[0] != '\0' && !isspace (line[0]) && line[0] != '='
++ && line[0] != ']')
++ ++line;
++
++ /* Compare with known statii. */
++ if (line - name == 7)
++ {
++ if (__strncasecmp (name, "SUCCESS", 7) == 0)
++ status = NSS_STATUS_SUCCESS;
++ else if (__strncasecmp (name, "UNAVAIL", 7) == 0)
++ status = NSS_STATUS_UNAVAIL;
++ else
++ return result;
++ }
++ else if (line - name == 8)
++ {
++ if (__strncasecmp (name, "NOTFOUND", 8) == 0)
++ status = NSS_STATUS_NOTFOUND;
++ else if (__strncasecmp (name, "TRYAGAIN", 8) == 0)
++ status = NSS_STATUS_TRYAGAIN;
++ else
++ return result;
++ }
++ else
++ return result;
++
++ while (isspace (line[0]))
++ ++line;
++ if (line[0] != '=')
++ return result;
++ do
++ ++line;
++ while (isspace (line[0]));
++
++ name = line;
++ while (line[0] != '\0' && !isspace (line[0]) && line[0] != '='
++ && line[0] != ']')
++ ++line;
++
++ if (line - name == 6 && __strncasecmp (name, "RETURN", 6) == 0)
++ action = NSS_ACTION_RETURN;
++ else if (line - name == 8
++ && __strncasecmp (name, "CONTINUE", 8) == 0)
++ action = NSS_ACTION_CONTINUE;
++ else
++ return result;
++
++ if (not)
++ {
++ /* Save the current action setting for this status,
++ set them all to the given action, and reset this one. */
++ const lookup_actions save = new_service->actions[2 + status];
++ new_service->actions[2 + NSS_STATUS_TRYAGAIN] = action;
++ new_service->actions[2 + NSS_STATUS_UNAVAIL] = action;
++ new_service->actions[2 + NSS_STATUS_NOTFOUND] = action;
++ new_service->actions[2 + NSS_STATUS_SUCCESS] = action;
++ new_service->actions[2 + status] = save;
++ }
++ else
++ new_service->actions[2 + status] = action;
++
++ /* Skip white spaces. */
++ while (isspace (line[0]))
++ ++line;
++ }
++ while (line[0] != ']');
++
++ /* Skip the ']'. */
++ ++line;
++ }
++
++ *nextp = new_service;
++ nextp = &new_service->next;
++ }
++}
++
++static name_database_entry *
++internal_function
++nss_getline (char *line)
++{
++ const char *name;
++ name_database_entry *result;
++ size_t len;
++
++ /* Ignore leading white spaces. ATTENTION: this is different from
++ what is implemented in Solaris. The Solaris man page says a line
++ beginning with a white space character is ignored. We regard
++ this as just another misfeature in Solaris. */
++ while (isspace (line[0]))
++ ++line;
++
++ /* Recognize `<database> ":"'. */
++ name = line;
++ while (line[0] != '\0' && !isspace (line[0]) && line[0] != ':')
++ ++line;
++ if (line[0] == '\0' || name == line)
++ /* Syntax error. */
++ return NULL;
++ *line++ = '\0';
++
++ len = strlen (name) + 1;
++
++ result = (name_database_entry *) xmalloc (sizeof (*result));
++ result->name = (char *) xmalloc (len);
++
++ /* Save the database name. */
++ memcpy ((char *) result->name, name, len);
++
++ /* Parse the list of services. */
++ result->service = nss_parse_service_list (line);
++
++ result->next = NULL;
++ return result;
++}
++
++
++
++/* Generating code for statically initialized nsswitch structures. */
++
++
++/* Return the service-neutral suffix of the name of the service
++ library function referred to by the function F. The result is
++ allocated with malloc. */
++char *
++known_function_suffix (const struct function *f)
++{
++ switch (f->kind)
++ {
++ case fk_setent:
++ return saprintf ("set%sent", f->entry);
++
++ case fk_getent:
++ return saprintf ("get%sent_r", f->entry);
++
++ case fk_endent:
++ return saprintf ("end%sent", f->entry);
++
++ case fk_getby:
++ return saprintf ("get%sby%s_r", f->entry, f->key);
++
++ case fk_get:
++ return saprintf ("get%s_r", f->value_and_key);
++
++ default:
++ abort ();
++ }
++}
++
++
++/* Return the name of the service library function referred to by the
++ function F. The result is allocated with malloc. */
++char *
++known_function_name (const struct function *f)
++{
++ return saprintf ("_nss_%s_%s", f->service, known_function_suffix (f));
++}
++
++
++/* Write initialized known_function structures to OUT for
++ all the functions we'll use. */
++void
++generate_known_functions (FILE *out)
++{
++ int i;
++
++ /* First, generate weak references to the functions. The service
++ libraries depend on libc, and if these references weren't weak,
++ we'd be making libc depend circularly on the service
++ libraries. */
++ for (i = 0; functions[i].kind; i++)
++ {
++ char *name = known_function_name (&functions[i]);
++ fprintf (out, "typeof (%s) %s __attribute__ ((weak));\n",
++ name, name);
++ }
++ fputs ("\n", out);
++
++ /* Then, a table mapping names to functions. */
++ fputs ("static const known_function fixed_known_functions[] = {\n",
++ out);
++ for (i = 0; functions[i].kind; i++)
++ {
++ const struct function *f = &functions[i];
++ char *suffix = known_function_suffix (f);
++
++ fprintf (out, " /* %2d */ { \"%s\", _nss_%s_%s },\n",
++ i, suffix, f->service, suffix);
++ }
++ fputs ("};\n", out);
++ fputs ("\n", out);
++}
++
++
++/* Print code to OUT for an initialized array of pointers to the
++ 'known_function' structures needed for USER, which is for
++ DATABASE. Return its name, allocated with malloc. */
++char *
++generate_known_function_list (FILE *out,
++ const name_database_entry *database,
++ const service_user *user)
++{
++ char *list_name = saprintf ("fixed_%s_%s_known_funcs",
++ database->name, user->name);
++ fprintf (out, "static const known_function *%s[] = {\n",
++ list_name);
++ int i;
++ for (i = 0; functions[i].kind; i++)
++ if (strcmp (functions[i].database, database->name) == 0
++ && strcmp (functions[i].service, user->name) == 0)
++ fprintf (out, " &fixed_known_functions[%d], /* %s */\n",
++ i, known_function_name (&functions[i]));
++ fputs (" NULL\n", out);
++ fputs ("};\n", out);
++ fputs ("\n", out);
++
++ return list_name;
++}
++
++
++/* Return the name of the status value STATUS, as a statically
++ allocated string. */
++const char *
++lookup_status_name (enum nss_status status)
++{
++ switch (status)
++ {
++ case NSS_STATUS_TRYAGAIN: return "NSS_STATUS_TRYAGAIN";
++ case NSS_STATUS_UNAVAIL: return "NSS_STATUS_UNAVAIL";
++ case NSS_STATUS_NOTFOUND: return "NSS_STATUS_NOTFOUND";
++ case NSS_STATUS_SUCCESS: return "NSS_STATUS_SUCCESS";
++ case NSS_STATUS_RETURN: return "NSS_STATUS_RETURN";
++ default: abort ();
++ };
++}
++
++
++/* Return the name of ACTION as a statically allocated string. */
++const char *
++lookup_action_name (lookup_actions action)
++{
++ switch (action)
++ {
++ case NSS_ACTION_CONTINUE: return "NSS_ACTION_CONTINUE";
++ case NSS_ACTION_RETURN: return "NSS_ACTION_RETURN";
++ default: abort ();
++ }
++}
++
++
++/* Print code to OUT for the list of service_user structures starting
++ with USER, which are all for DATABASE. Return the name of the
++ first structure in that list, or zero if USER is NULL. */
++char *
++generate_service_user_list (FILE *out,
++ name_database_entry *database,
++ service_user *user)
++{
++ if (user)
++ {
++ /* Generate the tail of the list. */
++ char *next_name = generate_service_user_list (out, database, user->next);
++ /* Generate our known function list. */
++ char *known_function_list_name =
++ generate_known_function_list (out, database, user);
++
++ char *name = saprintf ("fixed_%s_%s_user", database->name, user->name);
++
++ fprintf (out, "static const service_user %s = {\n", name);
++ if (next_name)
++ fprintf (out, " (service_user *) &%s,\n", next_name);
++ else
++ fprintf (out, " NULL, /* no next entry */\n");
++ fputs (" {\n", out);
++ int i;
++ for (i = 0; i < sizeof (user->actions) / sizeof (user->actions[0]); i++)
++ fprintf (out, " %s, /* %s */\n",
++ lookup_action_name (user->actions[i]),
++ lookup_status_name (i - 2));
++ fputs (" },\n", out);
++ fprintf (out, " NULL, /* we never need the service library */\n");
++ fprintf (out, " { .array = %s },\n", known_function_list_name);
++ fprintf (out, " \"%s\"\n", user->name);
++ fputs ("};\n", out);
++ fputs ("\n", out);
++
++ return name;
++ }
++ else
++ return NULL;
++}
++
++
++/* Print code to OUT for the list of name_database_entry structures
++ starting with DATABASE. Return the name of the first structure
++ in that list, or zero if DATABASE is NULL. */
++char *
++generate_name_database_entries (FILE *out, name_database_entry *database)
++{
++ if (database)
++ {
++ char *next_name = generate_name_database_entries (out, database->next);
++ char *service_user_name
++ = generate_service_user_list (out, database, database->service);
++ char *name = saprintf ("fixed_%s_name_database", database->name);
++
++ fprintf (out, "static const name_database_entry %s = {\n", name);
++
++ if (next_name)
++ fprintf (out, " (name_database_entry *) &%s,\n", next_name);
++ else
++ fprintf (out, " NULL,\n");
++
++ if (service_user_name)
++ fprintf (out, " (service_user *) &%s,\n", service_user_name);
++ else
++ fprintf (out, " NULL,\n");
++
++ fprintf (out, " \"%s\"\n", database->name);
++ fprintf (out, "};\n");
++ fputs ("\n", out);
++
++ return name;
++ }
++ else
++ return NULL;
++}
++
++
++void
++generate_name_database (FILE *out, name_database *service_table)
++{
++ /* Produce a linked list of the known name_database_entry
++ structures. */
++ char *entries = generate_name_database_entries (out, service_table->entry);
++
++ /* Now produce the main structure that points to them all. */
++ fprintf (out, "static const name_database fixed_name_database = {\n");
++ if (entries)
++ fprintf (out, " (name_database_entry *) &%s,\n", entries);
++ else
++ fprintf (out, " NULL,\n");
++ fputs (" NULL /* we don't need the libraries */\n"
++ "};\n",
++ out);
++}
++
++
++
++/* Generating the list of service libraries we generate references to. */
++
++/* String with revision number of the shared object files. */
++static const char *const nss_shlib_revision = LIBNSS_FILES_SO + 15;
++
++void
++generate_service_lib_list (FILE *out, name_database *service_table)
++{
++ int i, j;
++ int printed_any = 0;
++
++ for (i = 0; functions[i].kind; i++)
++ {
++ /* Mention each service library only once. */
++ for (j = 0; j < i; j++)
++ if (strcmp (functions[i].service, functions[j].service) == 0)
++ break;
++
++ if (j >= i)
++ {
++ if (printed_any)
++ putc (' ', out);
++ fprintf (out, "-lnss_%s",
++ functions[i].service,
++ nss_shlib_revision);
++ printed_any = 1;
++ }
++ }
++}
++
++
++/* Main. */
++
++int
++main (int argc, char **argv)
++{
++ if (argc != 4)
++ {
++ fprintf (stderr, "usage: gen-fixed-nsswitch HEADER SERVLIBS CONFIG\n");
++ exit (1);
++ }
++
++ name_database *service_table = nss_parse_file (argv[3]);
++
++ FILE *header = fopen (argv[1], "w");
++ if (! header)
++ {
++ fprintf (stderr,
++ "gen-fixed-nsswitch: couldn't open output file %s: %s\n",
++ argv[1], strerror (errno));
++ exit (1);
++ }
++ fputs ("/* Generated by nss/gen-fixed-nsswitch.c. */\n", header);
++ fputs ("\n", header);
++ generate_known_functions (header);
++ generate_name_database (header, service_table);
++ fclose (header);
++
++ FILE *service_lib_list = fopen (argv[2], "w");
++ if (! service_lib_list)
++ {
++ fprintf (stderr,
++ "gen-fixed-nsswitch: couldn't open output file %s: %s\n",
++ argv[2], strerror (errno));
++ exit (1);
++ }
++ generate_service_lib_list (service_lib_list, service_table);
++ fclose (service_lib_list);
++
++ return 0;
++}
+Index: git/nss/getent.c
+===================================================================
+--- git.orig/nss/getent.c
++++ git/nss/getent.c
+@@ -39,6 +39,7 @@
+ #include <netinet/ether.h>
+ #include <netinet/in.h>
+ #include <sys/socket.h>
++#include <gnu/option-groups.h>
+
+ /* Get libc version number. */
+ #include <version.h>
+@@ -91,6 +92,7 @@ warranty; not even for MERCHANTABILITY o
+ fprintf (stream, gettext ("Written by %s.\n"), "Thorsten Kukuk");
+ }
+
++#if __OPTION_EGLIBC_DB_ALIASES
+ /* This is for aliases */
+ static void
+ print_aliases (struct aliasent *alias)
+@@ -135,7 +137,9 @@ aliases_keys (int number, char *key[])
+
+ return result;
+ }
++#endif /* __OPTION_EGLIBC_DB_ALIASES */
+
++#if __OPTION_EGLIBC_INET
+ /* This is for ethers */
+ static int
+ ethers_keys (int number, char *key[])
+@@ -179,6 +183,7 @@ ethers_keys (int number, char *key[])
+
+ return result;
+ }
++#endif /* __OPTION_EGLIBC_INET */
+
+ /* This is for group */
+ static void
+@@ -301,6 +306,7 @@ gshadow_keys (int number, char *key[])
+ return result;
+ }
+
++#if __OPTION_EGLIBC_INET
+ /* This is for hosts */
+ static void
+ print_hosts (struct hostent *host)
+@@ -598,6 +604,7 @@ networks_keys (int number, char *key[])
+
+ return result;
+ }
++#endif /* __OPTION_EGLIBC_INET */
+
+ /* Now is all for passwd */
+ static void
+@@ -650,6 +657,7 @@ passwd_keys (int number, char *key[])
+ return result;
+ }
+
++#if __OPTION_EGLIBC_INET
+ /* This is for protocols */
+ static void
+ print_protocols (struct protoent *proto)
+@@ -805,6 +813,7 @@ services_keys (int number, char *key[])
+
+ return result;
+ }
++#endif /* __OPTION_EGLIBC_INET */
+
+ /* This is for shadow */
+ static void
+@@ -871,21 +880,34 @@ struct
+ } databases[] =
+ {
+ #define D(name) { #name, name ## _keys },
+-D(ahosts)
+-D(ahostsv4)
+-D(ahostsv6)
+-D(aliases)
+-D(ethers)
++
++#if __OPTION_EGLIBC_INET
++#define DN(name) D(name)
++#else
++#define DN(name)
++#endif
++
++#if __OPTION_EGLIBC_DB_ALIASES
++#define DA(name) D(name)
++#else
++#define DA(name)
++#endif
++
++DN(ahosts)
++DN(ahostsv4)
++DN(ahostsv6)
++DA(aliases)
++DN(ethers)
+ D(group)
+ D(gshadow)
+-D(hosts)
+-D(initgroups)
+-D(netgroup)
+-D(networks)
++DN(hosts)
++DN(initgroups)
++DN(netgroup)
++DN(networks)
+ D(passwd)
+-D(protocols)
+-D(rpc)
+-D(services)
++DN(protocols)
++DN(rpc)
++DN(services)
+ D(shadow)
+ #undef D
+ { NULL, NULL }
+Index: git/nss/getnssent_r.c
+===================================================================
+--- git.orig/nss/getnssent_r.c
++++ git/nss/getnssent_r.c
+@@ -16,6 +16,7 @@
+ <http://www.gnu.org/licenses/>. */
+
+ #include <errno.h>
++#include <gnu/option-groups.h>
+ #include <netdb.h>
+ #include "nsswitch.h"
+
+@@ -59,11 +60,13 @@ __nss_setent (const char *func_name, db_
+ } fct;
+ int no_more;
+
++#if __OPTION_EGLIBC_INET
+ if (res && __res_maybe_init (&_res, 0) == -1)
+ {
+ __set_h_errno (NETDB_INTERNAL);
+ return;
+ }
++#endif /* __OPTION_EGLIBC_INET */
+
+ /* Cycle through the services and run their `setXXent' functions until
+ we find an available service. */
+@@ -101,11 +104,13 @@ __nss_endent (const char *func_name, db_
+ } fct;
+ int no_more;
+
++#if __OPTION_EGLIBC_INET
+ if (res && __res_maybe_init (&_res, 0) == -1)
+ {
+ __set_h_errno (NETDB_INTERNAL);
+ return;
+ }
++#endif /* __OPTION_EGLIBC_INET */
+
+ /* Cycle through all the services and run their endXXent functions. */
+ no_more = setup (func_name, lookup_fct, &fct.ptr, nip, startp, 1);
+@@ -141,12 +146,14 @@ __nss_getent_r (const char *getent_func_
+ int no_more;
+ enum nss_status status;
+
++#if __OPTION_EGLIBC_INET
+ if (res && __res_maybe_init (&_res, 0) == -1)
+ {
+ *h_errnop = NETDB_INTERNAL;
+ *result = NULL;
+ return errno;
+ }
++#endif /* __OPTION_EGLIBC_INET */
+
+ /* Initialize status to return if no more functions are found. */
+ status = NSS_STATUS_NOTFOUND;
+@@ -161,7 +168,7 @@ __nss_getent_r (const char *getent_func_
+ int is_last_nip = *nip == *last_nip;
+
+ status = DL_CALL_FCT (fct.f,
+- (resbuf, buffer, buflen, &errno, &h_errno));
++ (resbuf, buffer, buflen, &errno, h_errnop));
+
+ /* The status is NSS_STATUS_TRYAGAIN and errno is ERANGE the
+ provided buffer is too small. In this case we should give
+Index: git/nss/Makefile
+===================================================================
+--- git.orig/nss/Makefile
++++ git/nss/Makefile
+@@ -18,29 +18,36 @@
+ #
+ # Makefile for name service switch.
+ #
++include ../option-groups.mak
++
+ subdir := nss
+
+ include ../Makeconfig
+
+ headers := nss.h
+
+-# This is the trivial part which goes into libc itself.
+-routines = nsswitch getnssent getnssent_r digits_dots \
+- $(addsuffix -lookup,$(databases))
+-
+ # These are the databases that go through nss dispatch.
+ # Caution: if you add a database here, you must add its real name
+ # in databases.def, too.
+-databases = proto service hosts network grp pwd rpc ethers \
+- spwd netgrp key alias sgrp
++databases-y = grp pwd spwd sgrp
++databases-$(OPTION_EGLIBC_INET) \
++ += proto service hosts network rpc ethers \
++ netgrp key
++databases-$(OPTION_EGLIBC_DB_ALIASES) += alias
++
++# This is the trivial part which goes into libc itself.
++routines-y += nsswitch getnssent getnssent_r \
++ $(addsuffix -lookup,$(databases-y))
++routines-$(OPTION_EGLIBC_INET) += digits_dots
+
+ others := getent makedb
+ install-bin := getent makedb
+ makedb-modules = xmalloc hash-string
+ extra-objs += $(makedb-modules:=.o)
+
+-tests = test-netdb tst-nss-test1 test-digits-dots
+-xtests = bug-erange
++tests = tst-nss-test1
++tests-$(OPTION_EGLIBC_INET) += test-netdb test-digits-dots
++xtests-$(OPTION_EGLIBC_INET) += bug-erange
+
+ # Specify rules for the nss_* modules. We have some services.
+ services := files db
+@@ -55,7 +62,7 @@ subdir-dirs = $(services:%=nss_%)
+ vpath %.c $(subdir-dirs) ../locale/programs ../intl
+
+
+-libnss_files-routines := $(addprefix files-,$(databases)) \
++libnss_files-routines := $(addprefix files-,$(databases-y)) \
+ files-initgroups files-have_o_cloexec files-init
+
+ libnss_db-dbs := $(addprefix db-,\
+@@ -78,6 +85,45 @@ tests-static = tst-nss-static
+ tests += $(tests-static)
+ endif
+
++ifneq ($(OPTION_EGLIBC_NSSWITCH),y)
++
++ifndef OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG
++$(error OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG variable left unset)
++endif
++
++ifndef OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS
++$(error OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS variable left unset)
++endif
++
++ifeq (,$(wildcard $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG)))
++$(warning OPTION_EGLIBC_NSSWITCH is disabled, but fixed config file)
++$(error does not exist: $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG))
++endif
++
++ifeq (,$(wildcard $(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS)))
++$(warning OPTION_EGLIBC_NSSWITCH is disabled, but fixed functions file)
++$(error does not exist: $(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS))
++endif
++
++before-compile := $(objpfx)fixed-nsswitch.h
++generated := fixed-nsswitch.h
++$(objpfx)fixed-nsswitch.h $(objfpx)fixed-nsswitch-libs: \
++ $(objpfx)gen-fixed-nsswitch \
++ $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG)
++ $< $(objpfx)fixed-nsswitch.h \
++ $(objpfx)fixed-nsswitch-libs \
++ $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG)
++
++$(objpfx)gen-fixed-nsswitch: gen-fixed-nsswitch.c \
++ $(common-objpfx)option-groups.config \
++ $(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS)
++ $(native-compile)
++gen-fixed-nsswitch-CFLAGS = \
++ -g3 -O -Wall \
++ -I $(objpfx) \
++ -DFIXED_FUNCTIONS='"$(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS)"'
++endif
++
+ include ../Rules
+
+ ifeq (yes,$(have-selinux))
+Index: git/nss/nsswitch.c
+===================================================================
+--- git.orig/nss/nsswitch.c
++++ git/nss/nsswitch.c
+@@ -26,6 +26,7 @@
+ #include <stdio_ext.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <gnu/option-groups.h>
+
+ #include <aliases.h>
+ #include <grp.h>
+@@ -41,6 +42,15 @@
+ #include "../nscd/nscd_proto.h"
+ #include <sysdep.h>
+
++/* When OPTION_EGLIBC_NSSWITCH is disabled, we use fixed tables of
++ databases and services, generated at library build time. Thus:
++ - We can't reconfigure individual databases, so we don't need a
++ name-to-database map.
++ - We never add databases or service libraries, or look up functions
++ at runtime, so there's no need for a lock to protect our tables.
++ See ../option-groups.def for the details. */
++#if __OPTION_EGLIBC_NSSWITCH
++
+ /* Prototypes for the local functions. */
+ static name_database *nss_parse_file (const char *fname) internal_function;
+ static name_database_entry *nss_getline (char *line) internal_function;
+@@ -79,6 +89,9 @@ bool __nss_database_custom[NSS_DBSIDX_ma
+
+ __libc_lock_define_initialized (static, lock)
+
++#define lock_nsswitch __libc_lock_lock (lock)
++#define unlock_nsswitch __libc_lock_unlock (lock)
++
+ #if !defined DO_STATIC_NSS || defined SHARED
+ /* String with revision number of the shared object files. */
+ static const char *const __nss_shlib_revision = LIBNSS_FILES_SO + 15;
+@@ -93,6 +106,20 @@ static name_database *service_table;
+ __libc_freeres. */
+ static name_database_entry *defconfig_entries;
+
++#else /* __OPTION_EGLIBC_NSSWITCH */
++
++/* Bring in the statically initialized service table we generated at
++ build time. */
++#include "fixed-nsswitch.h"
++
++const static name_database *service_table = &fixed_name_database;
++
++/* Nothing ever changes, so there's no need to lock anything. */
++#define lock_nsswitch (0)
++#define unlock_nsswitch (0)
++
++#endif /* __OPTION_EGLIBC_NSSWITCH */
++
+
+ #ifdef USE_NSCD
+ /* Nonzero if this is the nscd process. */
+@@ -109,20 +136,22 @@ __nss_database_lookup (const char *datab
+ const char *defconfig, service_user **ni)
+ {
+ /* Prevent multiple threads to change the service table. */
+- __libc_lock_lock (lock);
++ lock_nsswitch;
+
+ /* Reconsider database variable in case some other thread called
+ `__nss_configure_lookup' while we waited for the lock. */
+ if (*ni != NULL)
+ {
+- __libc_lock_unlock (lock);
++ unlock_nsswitch;
+ return 0;
+ }
+
++#if __OPTION_EGLIBC_NSSWITCH
+ /* Are we initialized yet? */
+ if (service_table == NULL)
+ /* Read config file. */
+ service_table = nss_parse_file (_PATH_NSSWITCH_CONF);
++#endif
+
+ /* Test whether configuration data is available. */
+ if (service_table != NULL)
+@@ -144,6 +173,7 @@ __nss_database_lookup (const char *datab
+ *ni = entry->service;
+ }
+
++#if __OPTION_EGLIBC_NSSWITCH
+ /* No configuration data is available, either because nsswitch.conf
+ doesn't exist or because it doesn't have a line for this database.
+
+@@ -166,13 +196,23 @@ __nss_database_lookup (const char *datab
+ {
+ entry->next = defconfig_entries;
+ entry->service = *ni;
+- entry->name[0] = '\0';
++ entry->name = "";
+ defconfig_entries = entry;
+ }
+ }
+ }
++#else
++ /* Without the dynamic behavior, we can't process defconfig. The
++ databases the user specified at library build time are all you
++ get. */
++ if (*ni == NULL)
++ {
++ unlock_nsswitch;
++ return -1;
++ }
++#endif
+
+- __libc_lock_unlock (lock);
++ unlock_nsswitch;
+
+ return *ni != NULL ? 0 : -1;
+ }
+@@ -252,6 +292,7 @@ __nss_next2 (service_user **ni, const ch
+ libc_hidden_def (__nss_next2)
+
+
++#if __OPTION_EGLIBC_NSSWITCH
+ int
+ attribute_compat_text_section
+ __nss_next (service_user **ni, const char *fct_name, void **fctp, int status,
+@@ -300,13 +341,13 @@ __nss_configure_lookup (const char *dbna
+ }
+
+ /* Prevent multiple threads to change the service table. */
+- __libc_lock_lock (lock);
++ lock_nsswitch;
+
+ /* Install new rules. */
+ *databases[cnt].dbp = new_db;
+ __nss_database_custom[cnt] = true;
+
+- __libc_lock_unlock (lock);
++ unlock_nsswitch;
+
+ return 0;
+ }
+@@ -402,7 +443,7 @@ __nss_lookup_function (service_user *ni,
+ void **found, *result;
+
+ /* We now modify global data. Protect it. */
+- __libc_lock_lock (lock);
++ lock_nsswitch;
+
+ /* Search the tree of functions previously requested. Data in the
+ tree are `known_function' structures, whose first member is a
+@@ -413,7 +454,7 @@ __nss_lookup_function (service_user *ni,
+ enough to a pointer to our structure to use as a lookup key that
+ will be passed to `known_compare' (above). */
+
+- found = __tsearch (&fct_name, &ni->known, &known_compare);
++ found = __tsearch (&fct_name, &ni->known.tree, &known_compare);
+ if (found == NULL)
+ /* This means out-of-memory. */
+ result = NULL;
+@@ -440,7 +481,7 @@ __nss_lookup_function (service_user *ni,
+ #endif
+ /* Oops. We can't instantiate this node properly.
+ Remove it from the tree. */
+- __tdelete (&fct_name, &ni->known, &known_compare);
++ __tdelete (&fct_name, &ni->known.tree, &known_compare);
+ free (known);
+ result = NULL;
+ }
+@@ -520,13 +561,43 @@ __nss_lookup_function (service_user *ni,
+ }
+
+ /* Remove the lock. */
+- __libc_lock_unlock (lock);
++ unlock_nsswitch;
+
+ return result;
+ }
+ libc_hidden_def (__nss_lookup_function)
+
+
++#else /* below if ! __OPTION_EGLIBC_NSSWITCH */
++
++
++int
++__nss_configure_lookup (const char *dbname, const char *service_line)
++{
++ /* We can't dynamically configure lookup without
++ OPTION_EGLIBC_NSSWITCH. */
++ __set_errno (EINVAL);
++ return -1;
++}
++
++
++void *
++__nss_lookup_function (service_user *ni, const char *fct_name)
++{
++ int i;
++ const known_function **known = ni->known.array;
++
++ for (i = 0; known[i]; i++)
++ if (strcmp (fct_name, known[i]->fct_name) == 0)
++ return known[i]->fct_ptr;
++
++ return NULL;
++}
++libc_hidden_def (__nss_lookup_function)
++#endif
++
++
++#if __OPTION_EGLIBC_NSSWITCH
+ static name_database *
+ internal_function
+ nss_parse_file (const char *fname)
+@@ -632,8 +703,10 @@ nss_parse_service_list (const char *line
+ + (line - name + 1));
+ if (new_service == NULL)
+ return result;
++ new_service->name = (char *) (new_service + 1);
+
+- *((char *) __mempcpy (new_service->name, name, line - name)) = '\0';
++ *((char *) __mempcpy ((char *) new_service->name, name, line - name))
++ = '\0';
+
+ /* Set default actions. */
+ new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE;
+@@ -642,7 +715,7 @@ nss_parse_service_list (const char *line
+ new_service->actions[2 + NSS_STATUS_SUCCESS] = NSS_ACTION_RETURN;
+ new_service->actions[2 + NSS_STATUS_RETURN] = NSS_ACTION_RETURN;
+ new_service->library = NULL;
+- new_service->known = NULL;
++ new_service->known.tree = NULL;
+ new_service->next = NULL;
+
+ while (isspace (line[0]))
+@@ -778,9 +851,10 @@ nss_getline (char *line)
+ result = (name_database_entry *) malloc (sizeof (name_database_entry) + len);
+ if (result == NULL)
+ return NULL;
++ result->name = (char *) (result + 1);
+
+ /* Save the database name. */
+- memcpy (result->name, name, len);
++ memcpy ((char *) result->name, name, len);
+
+ /* Parse the list of services. */
+ result->service = nss_parse_service_list (line);
+@@ -816,6 +890,7 @@ nss_new_service (name_database *database
+ return *currentp;
+ }
+ #endif
++#endif /* __OPTION_EGLIBC_NSSWITCH */
+
+
+ #if defined SHARED && defined USE_NSCD
+@@ -834,6 +909,7 @@ nss_load_all_libraries (const char *serv
+ }
+
+
++#if __OPTION_EGLIBC_INET
+ /* Called by nscd and nscd alone. */
+ void
+ __nss_disable_nscd (void (*cb) (size_t, struct traced_file *))
+@@ -857,8 +933,10 @@ __nss_disable_nscd (void (*cb) (size_t,
+ __nss_not_use_nscd_services = -1;
+ __nss_not_use_nscd_netgroup = -1;
+ }
++#endif /* __OPTION_EGLIBC_INET */
+ #endif
+
++#if __OPTION_EGLIBC_NSSWITCH
+ static void
+ free_database_entries (name_database_entry *entry)
+ {
+@@ -871,8 +949,8 @@ free_database_entries (name_database_ent
+ {
+ service_user *olds = service;
+
+- if (service->known != NULL)
+- __tdestroy (service->known, free);
++ if (service->known.tree != NULL)
++ __tdestroy (service->known.tree, free);
+
+ service = service->next;
+ free (olds);
+@@ -926,3 +1004,4 @@ libc_freeres_fn (free_mem)
+
+ free (top);
+ }
++#endif /* __OPTION_EGLIBC_NSSWITCH */
+Index: git/nss/nsswitch.h
+===================================================================
+--- git.orig/nss/nsswitch.h
++++ git/nss/nsswitch.h
+@@ -65,10 +65,20 @@ typedef struct service_user
+ lookup_actions actions[5];
+ /* Link to the underlying library object. */
+ service_library *library;
+- /* Collection of known functions. */
+- void *known;
++ /* Collection of known functions.
++
++ With OPTION_EGLIBC_NSSWITCH enabled, this is the root of a
++ 'tsearch'-style tree.
++
++ With OPTION_EGLIBC_NSSWITCH disabled, this is an array of
++ pointers to known_function structures, NULL-terminated. */
++ union
++ {
++ void *tree;
++ const known_function **array;
++ } known;
+ /* Name of the service (`files', `dns', `nis', ...). */
+- char name[0];
++ const char *name;
+ } service_user;
+
+ /* To access the action based on the status value use this macro. */
+@@ -82,7 +92,7 @@ typedef struct name_database_entry
+ /* List of service to be used. */
+ service_user *service;
+ /* Name of the database. */
+- char name[0];
++ const char *name;
+ } name_database_entry;
+
+
+Index: git/posix/bug-regex1.c
+===================================================================
+--- git.orig/posix/bug-regex1.c
++++ git/posix/bug-regex1.c
+@@ -4,6 +4,7 @@
+ #include <string.h>
+ #include <regex.h>
+ #include <wchar.h>
++#include <gnu/option-groups.h>
+
+ int
+ main (void)
+@@ -17,7 +18,9 @@ main (void)
+ memset (&regex, '\0', sizeof (regex));
+
+ setlocale (LC_ALL, "de_DE.ISO-8859-1");
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ fwide (stdout, -1);
++#endif
+
+ re_set_syntax (RE_SYNTAX_POSIX_EGREP | RE_DEBUG);
+
+Index: git/posix/bug-regex6.c
+===================================================================
+--- git.orig/posix/bug-regex6.c
++++ git/posix/bug-regex6.c
+@@ -22,6 +22,7 @@
+ #include <string.h>
+ #include <sys/types.h>
+ #include <regex.h>
++#include <gnu/option-groups.h>
+
+
+ int
+@@ -30,7 +31,12 @@ main (int argc, char *argv[])
+ regex_t re;
+ regmatch_t mat[10];
+ int i, j, ret = 0;
+- const char *locales[] = { "C", "de_DE.UTF-8" };
++ const char *locales[] = {
++ "C",
++#if __OPTION_EGLIBC_LOCALE_CODE
++ "de_DE.UTF-8"
++#endif
++ };
+ const char *string = "http://www.regex.com/pattern/matching.html#intro";
+ regmatch_t expect[10] = {
+ { 0, 48 }, { 0, 5 }, { 0, 4 }, { 5, 20 }, { 7, 20 }, { 20, 42 },
+Index: git/posix/fnmatch.c
+===================================================================
+--- git.orig/posix/fnmatch.c
++++ git/posix/fnmatch.c
+@@ -30,6 +30,10 @@
+ #include <ctype.h>
+ #include <string.h>
+
++#if defined _LIBC
++# include <gnu/option-groups.h>
++#endif
++
+ #if defined STDC_HEADERS || defined _LIBC
+ # include <stdlib.h>
+ #endif
+@@ -131,7 +135,7 @@ extern int fnmatch (const char *pattern,
+ # define ISWCTYPE(WC, WT) iswctype (WC, WT)
+ # endif
+
+-# if (HAVE_MBSTATE_T && HAVE_MBSRTOWCS) || _LIBC
++# if (HAVE_MBSTATE_T && HAVE_MBSRTOWCS && _LIBC && __OPTION_EGLIBC_LOCALE_CODE)
+ /* In this case we are implementing the multibyte character handling. */
+ # define HANDLE_MULTIBYTE 1
+ # endif
+Index: git/posix/fnmatch_loop.c
+===================================================================
+--- git.orig/posix/fnmatch_loop.c
++++ git/posix/fnmatch_loop.c
+@@ -15,6 +15,8 @@
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
++#include <gnu/option-groups.h>
++
+ #include <stdint.h>
+
+ struct STRUCT
+@@ -54,10 +56,15 @@ FCT (pattern, string, string_end, no_lea
+ const char *collseq = (const char *)
+ _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQWC);
+ # else
++# if __OPTION_EGLIBC_LOCALE_CODE
+ const UCHAR *collseq = (const UCHAR *)
+ _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQMB);
+-# endif
+-#endif
++# define COLLSEQ_BYTE_LOOKUP(ix) (collseq[(ix)])
++# else
++# define COLLSEQ_BYTE_LOOKUP(ix) (ix)
++# endif /* __OPTION_EGLIBC_LOCALE_CODE */
++# endif /* WIDE_CHAR_VERSION */
++#endif /* _LIBC */
+
+ while ((c = *p++) != L('\0'))
+ {
+@@ -277,7 +284,7 @@ FCT (pattern, string, string_end, no_lea
+ /* Leave room for the null. */
+ CHAR str[CHAR_CLASS_MAX_LENGTH + 1];
+ size_t c1 = 0;
+-#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
++#if defined _LIBC ? __OPTION_POSIX_C_LANG_WIDE_CHAR : (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
+ wctype_t wt;
+ #endif
+ const CHAR *startp = p;
+@@ -307,7 +314,7 @@ FCT (pattern, string, string_end, no_lea
+ }
+ str[c1] = L('\0');
+
+-#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
++#if defined _LIBC ? __OPTION_POSIX_C_LANG_WIDE_CHAR : (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
+ wt = IS_CHAR_CLASS (str);
+ if (wt == 0)
+ /* Invalid character class name. */
+@@ -680,8 +687,10 @@ FCT (pattern, string, string_end, no_lea
+ else
+ lcollseq = __collseq_table_lookup (collseq, cold);
+ # else
+- fcollseq = collseq[fn];
+- lcollseq = is_seqval ? cold : collseq[(UCHAR) cold];
++ fcollseq = COLLSEQ_BYTE_LOOKUP (fn);
++ lcollseq = (is_seqval
++ ? cold
++ : COLLSEQ_BYTE_LOOKUP ((UCHAR) cold));
+ # endif
+
+ is_seqval = 0;
+@@ -857,7 +866,7 @@ FCT (pattern, string, string_end, no_lea
+ goto matched;
+ }
+ # else
+- hcollseq = collseq[cend];
++ hcollseq = COLLSEQ_BYTE_LOOKUP (cend);
+ # endif
+ }
+
+Index: git/posix/glob.c
+===================================================================
+--- git.orig/posix/glob.c
++++ git/posix/glob.c
+@@ -25,6 +25,9 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <stddef.h>
++#ifdef _LIBC
++# include <gnu/option-groups.h>
++#endif
+
+ /* Outcomment the following line for production quality code. */
+ /* #define NDEBUG 1 */
+@@ -607,6 +610,7 @@ glob (pattern, flags, errfunc, pglob)
+ if (home_dir == NULL || home_dir[0] == '\0')
+ home_dir = "c:/users/default"; /* poor default */
+ # else
++# if ! _LIBC || __OPTION_EGLIBC_GETLOGIN
+ if (home_dir == NULL || home_dir[0] == '\0')
+ {
+ int success;
+@@ -623,19 +627,19 @@ glob (pattern, flags, errfunc, pglob)
+ if (success)
+ {
+ struct passwd *p;
+-# if defined HAVE_GETPWNAM_R || defined _LIBC
++# if defined HAVE_GETPWNAM_R || defined _LIBC
+ long int pwbuflen = GETPW_R_SIZE_MAX ();
+ char *pwtmpbuf;
+ struct passwd pwbuf;
+ int malloc_pwtmpbuf = 0;
+ int save = errno;
+
+-# ifndef _LIBC
++# ifndef _LIBC
+ if (pwbuflen == -1)
+ /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX.
+ Try a moderate value. */
+ pwbuflen = 1024;
+-# endif
++# endif
+ if (__libc_use_alloca (alloca_used + pwbuflen))
+ pwtmpbuf = alloca_account (pwbuflen, alloca_used);
+ else
+@@ -682,9 +686,9 @@ glob (pattern, flags, errfunc, pglob)
+ }
+ __set_errno (save);
+ }
+-# else
++# else
+ p = getpwnam (name);
+-# endif
++# endif
+ if (p != NULL)
+ {
+ if (!malloc_pwtmpbuf)
+@@ -713,6 +717,7 @@ glob (pattern, flags, errfunc, pglob)
+ }
+ }
+ }
++# endif /* ! _LIBC || __OPTION_EGLIBC_GETLOGIN */
+ if (home_dir == NULL || home_dir[0] == '\0')
+ {
+ if (flags & GLOB_TILDE_CHECK)
+Index: git/posix/Makefile
+===================================================================
+--- git.orig/posix/Makefile
++++ git/posix/Makefile
+@@ -18,6 +18,8 @@
+ #
+ # Sub-makefile for POSIX portion of the library.
+ #
++include ../option-groups.mak
++
+ subdir := posix
+
+ include ../Makeconfig
+@@ -43,13 +45,24 @@ routines := \
+ getpgid setpgid getpgrp bsd-getpgrp setpgrp getsid setsid \
+ getresuid getresgid setresuid setresgid \
+ pathconf sysconf fpathconf \
+- glob glob64 fnmatch regex \
++ glob glob64 fnmatch \
+ confstr \
+ getopt getopt1 getopt_init \
+ sched_setp sched_getp sched_sets sched_gets sched_yield sched_primax \
+ sched_primin sched_rr_gi sched_getaffinity sched_setaffinity \
+- getaddrinfo gai_strerror wordexp \
+ pread pwrite pread64 pwrite64 \
++ posix_madvise \
++ get_child_max sched_cpucount sched_cpualloc sched_cpufree
++
++routines-$(OPTION_EGLIBC_INET) += getaddrinfo gai_strerror
++
++ifeq (y,$(OPTION_POSIX_REGEXP_GLIBC))
++routines-$(OPTION_POSIX_REGEXP) += regex
++else
++routines-$(OPTION_POSIX_REGEXP) += xregex
++endif
++
++routines-$(OPTION_EGLIBC_SPAWN) += \
+ spawn_faction_init spawn_faction_destroy spawn_faction_addclose \
+ spawn_faction_addopen spawn_faction_adddup2 \
+ spawnattr_init spawnattr_destroy \
+@@ -61,37 +74,53 @@ routines := \
+ posix_madvise \
+ get_child_max sched_cpucount sched_cpualloc sched_cpufree
+
++routines-$(OPTION_EGLIBC_WORDEXP) += wordexp
++
+ aux := init-posix environ
+-tests := tstgetopt testfnm runtests runptests \
++tests := tstgetopt testfnm runtests \
+ tst-preadwrite tst-preadwrite64 test-vfork regexbug1 \
+- tst-getlogin tst-mmap tst-getaddrinfo tst-truncate \
+- tst-truncate64 tst-fork tst-fnmatch tst-regexloc tst-dir \
+- tst-chmod bug-regex1 bug-regex2 bug-regex3 bug-regex4 \
+- tst-gnuglob tst-regex bug-regex5 bug-regex6 bug-regex7 \
+- bug-regex8 bug-regex9 bug-regex10 bug-regex11 bug-regex12 \
+- bug-regex13 bug-regex14 bug-regex15 bug-regex16 \
+- bug-regex17 bug-regex18 bug-regex19 bug-regex20 \
+- bug-regex21 bug-regex22 bug-regex23 bug-regex24 \
+- bug-regex25 bug-regex26 bug-regex27 bug-regex28 \
+- bug-regex29 bug-regex30 bug-regex31 bug-regex32 \
+- bug-regex33 tst-nice tst-nanosleep tst-regex2 \
+- transbug tst-rxspencer tst-pcre tst-boost \
+- bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
+- tst-getaddrinfo2 bug-glob1 bug-glob2 bug-glob3 tst-sysconf \
++ tst-getlogin tst-mmap tst-truncate \
++ tst-truncate64 tst-fork tst-dir \
++ tst-chmod bug-regex2 bug-regex3 bug-regex4 \
++ tst-gnuglob bug-regex6 bug-regex7 \
++ bug-regex8 bug-regex9 bug-regex10 bug-regex12 \
++ bug-regex14 bug-regex15 \
++ bug-regex21 bug-regex24 \
++ bug-regex27 bug-regex28 \
++ bug-regex29 bug-regex30 bug-regex31 \
++ tst-nice tst-nanosleep \
++ transbug \
++ tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
++ bug-glob1 bug-glob2 bug-glob3 tst-sysconf \
+ tst-execvp1 tst-execvp2 tst-execlp1 tst-execlp2 \
+ tst-execv1 tst-execv2 tst-execl1 tst-execl2 \
+ tst-execve1 tst-execve2 tst-execle1 tst-execle2 \
+- tst-execvp3 tst-execvp4 tst-rfc3484 tst-rfc3484-2 \
+- tst-rfc3484-3 \
+- tst-getaddrinfo3 tst-fnmatch2 tst-cpucount tst-cpuset \
++ tst-execvp3 tst-execvp4 \
++ tst-fnmatch2 tst-cpucount tst-cpuset \
+ bug-getopt1 bug-getopt2 bug-getopt3 bug-getopt4 \
+ bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \
+ tst-pathconf tst-getaddrinfo4 tst-rxspencer-no-utf8 \
+ tst-fnmatch3 bug-regex36 tst-getaddrinfo5
+-xtests := bug-ga2
++tests-$(OPTION_EGLIBC_LOCALE_CODE) \
++ += tst-fnmatch tst-regexloc bug-regex1 bug-regex5 \
++ bug-regex23 bug-regex25 bug-regex32 bug-regex33
++tests-$(OPTION_EGLIBC_INET) \
++ += tst-getaddrinfo bug-ga1 tst-getaddrinfo2 \
++ tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3 tst-getaddrinfo3
++tests-$(OPTION_POSIX_REGEXP_GLIBC) \
++ += runptests bug-regex11 bug-regex13 bug-regex16 \
++ tst-regex2 tst-rxspencer tst-pcre tst-boost
++ifeq (yy,$(OPTION_EGLIBC_LOCALE_CODE)$(OPTION_POSIX_REGEXP_GLIBC))
++tests += tst-regex bug-regex17 bug-regex18 bug-regex19 bug-regex20 \
++ bug-regex22 bug-regex26
++endif
++xtests-$(OPTION_EGLIBC_INET) += bug-ga2
++
+ ifeq (yes,$(build-shared))
+ test-srcs := globtest
+-tests += wordexp-test tst-exec tst-spawn
++tests += tst-exec
++tests-$(OPTION_EGLIBC_SPAWN) += tst-spawn
++tests-$(OPTION_EGLIBC_WORDEXP) += wordexp-test
+ endif
+ tests-static = tst-exec-static tst-spawn-static
+ tests += $(tests-static)
+@@ -117,7 +146,10 @@ generated += $(addprefix wordexp-test-re
+
+ ifeq ($(run-built-tests),yes)
+ ifeq (yes,$(build-shared))
+-tests-special += $(objpfx)globtest.out $(objpfx)wordexp-tst.out
++tests-special += $(objpfx)globtest.out
++ifeq (y,$(OPTION_EGLIBC_WORDEXP))
++tests-special += $(objpfx)wordexp-tst.out
++endif
+ endif
+ endif
+
+@@ -125,12 +157,16 @@ endif
+ # XXX Please note that for now we ignore the result of this test.
+ tests-special += $(objpfx)annexc.out
+ ifeq ($(run-built-tests),yes)
+-tests-special += $(objpfx)bug-regex2-mem.out $(objpfx)bug-regex14-mem.out \
++tests-special += $(objpfx)bug-regex2-mem.out \
+ $(objpfx)bug-regex21-mem.out $(objpfx)bug-regex31-mem.out \
+- $(objpfx)tst-rxspencer-no-utf8-mem.out $(objpfx)tst-pcre-mem.out \
+- $(objpfx)tst-boost-mem.out $(objpfx)tst-getconf.out \
++ $(objpfx)tst-getconf.out \
+ $(objpfx)bug-glob2-mem.out $(objpfx)tst-vfork3-mem.out \
+ $(objpfx)tst-fnmatch-mem.out $(objpfx)bug-regex36-mem.out
++ifeq (y,$(OPTION_POSIX_REGEXP_GLIBC))
++tests-special += $(objpfx)bug-regex14-mem.out $(objpfx)tst-rxspencer-no-utf8-mem.out \
++ $(objpfx)tst-pcre-mem.out $(objpfx)tst-boost-mem.out
++endif
++
+ xtests-special += $(objpfx)bug-ga2-mem.out
+ endif
+
+@@ -143,6 +179,8 @@ $(objpfx)globtest.out: globtest.sh $(obj
+ $(SHELL) $< $(common-objpfx) '$(test-via-rtld-prefix)' \
+ '$(test-program-prefix)' '$(test-wrapper-env)'; \
+ $(evaluate-test)
++LDLIBS-globtest += $(shell cat $(common-objpfx)nss/fixed-nsswitch-libs)
++
+ $(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
+ '$(run-program-env)' '$(test-program-prefix-after-env)'; \
+@@ -205,7 +243,10 @@ tst-dir-ARGS = `pwd` `cd $(common-objdir
+ tst-chmod-ARGS = $(objdir)
+ tst-vfork3-ARGS = --test-dir=$(objpfx)
+
+-tst-rxspencer-ARGS = --utf8 rxspencer/tests
++tst-rxspencer-ARGS = rxspencer/tests
++ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
++tst-rxspencer-ARGS += --utf8
++endif
+ tst-rxspencer-no-utf8-ARGS = rxspencer/tests
+ tst-pcre-ARGS = PCRE.tests
+ tst-boost-ARGS = BOOST.tests
+Index: git/posix/regcomp.c
+===================================================================
+--- git.orig/posix/regcomp.c
++++ git/posix/regcomp.c
+@@ -18,6 +18,7 @@
+ <http://www.gnu.org/licenses/>. */
+
+ #include <stdint.h>
++#include <gnu/option-groups.h>
+
+ #ifdef _LIBC
+ # include <locale/weight.h>
+@@ -309,7 +310,7 @@ re_compile_fastmap_iter (regex_t *bufp,
+ {
+ re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
+ int node_cnt;
+- int icase = (dfa->mb_cur_max == 1 && (bufp->syntax & RE_ICASE));
++ int icase = (dfa_mb_cur_max (dfa) == 1 && (bufp->syntax & RE_ICASE));
+ for (node_cnt = 0; node_cnt < init_state->nodes.nelem; ++node_cnt)
+ {
+ int node = init_state->nodes.elems[node_cnt];
+@@ -319,9 +320,9 @@ re_compile_fastmap_iter (regex_t *bufp,
+ {
+ re_set_fastmap (fastmap, icase, dfa->nodes[node].opr.c);
+ #ifdef RE_ENABLE_I18N
+- if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
++ if ((bufp->syntax & RE_ICASE) && dfa_mb_cur_max (dfa) > 1)
+ {
+- unsigned char *buf = alloca (dfa->mb_cur_max), *p;
++ unsigned char *buf = alloca (dfa_mb_cur_max (dfa)), *p;
+ wchar_t wc;
+ mbstate_t state;
+
+@@ -352,7 +353,11 @@ re_compile_fastmap_iter (regex_t *bufp,
+ re_set_fastmap (fastmap, icase, ch);
+ }
+ }
+-#ifdef RE_ENABLE_I18N
++
++ /* When OPTION_EGLIBC_LOCALE_CODE is disabled, the current
++ locale is always C, which has no rules and no multi-byte
++ characters. */
++#if defined RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE
+ else if (type == COMPLEX_BRACKET)
+ {
+ re_charset_t *cset = dfa->nodes[node].opr.mbcset;
+@@ -380,7 +385,7 @@ re_compile_fastmap_iter (regex_t *bufp,
+ i.e. where we would not find an invalid sequence. This only
+ applies to multibyte character sets; for single byte character
+ sets, the SIMPLE_BRACKET again suffices. */
+- if (dfa->mb_cur_max > 1
++ if (dfa_mb_cur_max (dfa) > 1
+ && (cset->nchar_classes || cset->non_match || cset->nranges
+ # ifdef _LIBC
+ || cset->nequiv_classes
+@@ -408,7 +413,7 @@ re_compile_fastmap_iter (regex_t *bufp,
+ memset (&state, '\0', sizeof (state));
+ if (__wcrtomb (buf, cset->mbchars[i], &state) != (size_t) -1)
+ re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
+- if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
++ if ((bufp->syntax & RE_ICASE) && dfa_mb_cur_max (dfa) > 1)
+ {
+ if (__wcrtomb (buf, towlower (cset->mbchars[i]), &state)
+ != (size_t) -1)
+@@ -417,7 +422,7 @@ re_compile_fastmap_iter (regex_t *bufp,
+ }
+ }
+ }
+-#endif /* RE_ENABLE_I18N */
++#endif /* RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE */
+ else if (type == OP_PERIOD
+ #ifdef RE_ENABLE_I18N
+ || type == OP_UTF8_PERIOD
+@@ -860,11 +865,15 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
+
+ dfa->mb_cur_max = MB_CUR_MAX;
+ #ifdef _LIBC
+- if (dfa->mb_cur_max == 6
++ if (dfa_mb_cur_max (dfa) == 6
+ && strcmp (_NL_CURRENT (LC_CTYPE, _NL_CTYPE_CODESET_NAME), "UTF-8") == 0)
+ dfa->is_utf8 = 1;
++# if __OPTION_EGLIBC_LOCALE_CODE
+ dfa->map_notascii = (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_TO_NONASCII)
+ != 0);
++# else
++ dfa->map_notascii = 0;
++# endif
+ #else
+ # ifdef HAVE_LANGINFO_CODESET
+ codeset_name = nl_langinfo (CODESET);
+@@ -890,7 +899,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
+ #endif
+
+ #ifdef RE_ENABLE_I18N
+- if (dfa->mb_cur_max > 1)
++ if (dfa_mb_cur_max (dfa) > 1)
+ {
+ if (dfa->is_utf8)
+ dfa->sb_char = (re_bitset_ptr_t) utf8_sb_map;
+@@ -1788,7 +1797,7 @@ peek_token (re_token_t *token, re_string
+ token->word_char = 0;
+ #ifdef RE_ENABLE_I18N
+ token->mb_partial = 0;
+- if (input->mb_cur_max > 1 &&
++ if (string_mb_cur_max (input) > 1 &&
+ !re_string_first_byte (input, re_string_cur_idx (input)))
+ {
+ token->type = CHARACTER;
+@@ -1809,7 +1818,7 @@ peek_token (re_token_t *token, re_string
+ token->opr.c = c2;
+ token->type = CHARACTER;
+ #ifdef RE_ENABLE_I18N
+- if (input->mb_cur_max > 1)
++ if (string_mb_cur_max (input) > 1)
+ {
+ wint_t wc = re_string_wchar_at (input,
+ re_string_cur_idx (input) + 1);
+@@ -1923,7 +1932,7 @@ peek_token (re_token_t *token, re_string
+
+ token->type = CHARACTER;
+ #ifdef RE_ENABLE_I18N
+- if (input->mb_cur_max > 1)
++ if (string_mb_cur_max (input) > 1)
+ {
+ wint_t wc = re_string_wchar_at (input, re_string_cur_idx (input));
+ token->word_char = IS_WIDE_WORD_CHAR (wc) != 0;
+@@ -2023,7 +2032,7 @@ peek_token_bracket (re_token_t *token, r
+ token->opr.c = c;
+
+ #ifdef RE_ENABLE_I18N
+- if (input->mb_cur_max > 1 &&
++ if (string_mb_cur_max (input) > 1 &&
+ !re_string_first_byte (input, re_string_cur_idx (input)))
+ {
+ token->type = CHARACTER;
+@@ -2246,7 +2255,7 @@ parse_expression (re_string_t *regexp, r
+ return NULL;
+ }
+ #ifdef RE_ENABLE_I18N
+- if (dfa->mb_cur_max > 1)
++ if (dfa_mb_cur_max (dfa) > 1)
+ {
+ while (!re_string_eoi (regexp)
+ && !re_string_first_byte (regexp, re_string_cur_idx (regexp)))
+@@ -2384,7 +2393,7 @@ parse_expression (re_string_t *regexp, r
+ *err = REG_ESPACE;
+ return NULL;
+ }
+- if (dfa->mb_cur_max > 1)
++ if (dfa_mb_cur_max (dfa) > 1)
+ dfa->has_mb_node = 1;
+ break;
+ case OP_WORD:
+@@ -2690,7 +2699,7 @@ build_range_exp (bitset_t sbcset, bracke
+ However, for !_LIBC we have no collation elements: if the
+ character set is single byte, the single byte character set
+ that we build below suffices. parse_bracket_exp passes
+- no MBCSET if dfa->mb_cur_max == 1. */
++ no MBCSET if dfa_mb_cur_max (dfa) == 1. */
+ if (mbcset)
+ {
+ /* Check the space of the arrays. */
+@@ -2786,7 +2795,13 @@ parse_bracket_exp (re_string_t *regexp,
+ reg_syntax_t syntax, reg_errcode_t *err)
+ {
+ #ifdef _LIBC
++#if __OPTION_EGLIBC_LOCALE_CODE
+ const unsigned char *collseqmb;
++# define COLLSEQMB_LOOKUP(ix) (collseqmb[(ix)])
++#else
++# define COLLSEQMB_LOOKUP(ix) (ix)
++#endif
++
+ const char *collseqwc;
+ uint32_t nrules;
+ int32_t table_size;
+@@ -2834,18 +2849,20 @@ parse_bracket_exp (re_string_t *regexp,
+ if (MB_CUR_MAX == 1)
+ */
+ if (nrules == 0)
+- return collseqmb[br_elem->opr.ch];
++ return COLLSEQMB_LOOKUP (br_elem->opr.ch);
+ else
+ {
+ wint_t wc = __btowc (br_elem->opr.ch);
+ return __collseq_table_lookup (collseqwc, wc);
+ }
+ }
++#if __OPTION_EGLIBC_LOCALE_CODE
+ else if (br_elem->type == MB_CHAR)
+ {
+ if (nrules != 0)
+ return __collseq_table_lookup (collseqwc, br_elem->opr.wch);
+ }
++#endif
+ else if (br_elem->type == COLL_SYM)
+ {
+ size_t sym_name_len = strlen ((char *) br_elem->opr.name);
+@@ -2876,11 +2893,11 @@ parse_bracket_exp (re_string_t *regexp,
+ {
+ /* No valid character. Match it as a single byte
+ character. */
+- return collseqmb[br_elem->opr.name[0]];
++ return COLLSEQMB_LOOKUP (br_elem->opr.name[0]);
+ }
+ }
+ else if (sym_name_len == 1)
+- return collseqmb[br_elem->opr.name[0]];
++ return COLLSEQMB_LOOKUP (br_elem->opr.name[0]);
+ }
+ return UINT_MAX;
+ }
+@@ -2920,7 +2937,7 @@ parse_bracket_exp (re_string_t *regexp,
+ However, if we have no collation elements, and the character set
+ is single byte, the single byte character set that we
+ build below suffices. */
+- if (nrules > 0 || dfa->mb_cur_max > 1)
++ if (nrules > 0 || dfa_mb_cur_max (dfa) > 1)
+ {
+ /* Check the space of the arrays. */
+ if (BE (*range_alloc == mbcset->nranges, 0))
+@@ -2957,7 +2974,7 @@ parse_bracket_exp (re_string_t *regexp,
+ if (MB_CUR_MAX == 1)
+ */
+ if (nrules == 0)
+- ch_collseq = collseqmb[ch];
++ ch_collseq = COLLSEQMB_LOOKUP (ch);
+ else
+ ch_collseq = __collseq_table_lookup (collseqwc, __btowc (ch));
+ if (start_collseq <= ch_collseq && ch_collseq <= end_collseq)
+@@ -3035,7 +3052,10 @@ parse_bracket_exp (re_string_t *regexp,
+ re_bitset_ptr_t sbcset;
+ #ifdef RE_ENABLE_I18N
+ re_charset_t *mbcset;
+- int coll_sym_alloc = 0, range_alloc = 0, mbchar_alloc = 0;
++ int coll_sym_alloc = 0, range_alloc = 0;
++#if __OPTION_EGLIBC_LOCALE_CODE
++ int mbchar_alloc = 0;
++#endif
+ int equiv_class_alloc = 0, char_class_alloc = 0;
+ #endif /* not RE_ENABLE_I18N */
+ int non_match = 0;
+@@ -3043,9 +3063,15 @@ parse_bracket_exp (re_string_t *regexp,
+ int token_len;
+ int first_round = 1;
+ #ifdef _LIBC
++#if __OPTION_EGLIBC_LOCALE_CODE
+ collseqmb = (const unsigned char *)
+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQMB);
+ nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
++#else
++ /* This is true when OPTION_EGLIBC_LOCALE_CODE is disabled, but the
++ compiler can't figure that out. */
++ nrules = 0;
++#endif
+ if (nrules)
+ {
+ /*
+@@ -3175,7 +3201,7 @@ parse_bracket_exp (re_string_t *regexp,
+ #else
+ # ifdef RE_ENABLE_I18N
+ *err = build_range_exp (sbcset,
+- dfa->mb_cur_max > 1 ? mbcset : NULL,
++ dfa_mb_cur_max (dfa) > 1 ? mbcset : NULL,
+ &range_alloc, &start_elem, &end_elem);
+ # else
+ *err = build_range_exp (sbcset, &start_elem, &end_elem);
+@@ -3191,7 +3217,7 @@ parse_bracket_exp (re_string_t *regexp,
+ case SB_CHAR:
+ bitset_set (sbcset, start_elem.opr.ch);
+ break;
+-#ifdef RE_ENABLE_I18N
++#if defined RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE
+ case MB_CHAR:
+ /* Check whether the array has enough space. */
+ if (BE (mbchar_alloc == mbcset->nmbchars, 0))
+@@ -3209,7 +3235,7 @@ parse_bracket_exp (re_string_t *regexp,
+ }
+ mbcset->mbchars[mbcset->nmbchars++] = start_elem.opr.wch;
+ break;
+-#endif /* RE_ENABLE_I18N */
++#endif /* RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE */
+ case EQUIV_CLASS:
+ *err = build_equiv_class (sbcset,
+ #ifdef RE_ENABLE_I18N
+@@ -3259,11 +3285,11 @@ parse_bracket_exp (re_string_t *regexp,
+
+ #ifdef RE_ENABLE_I18N
+ /* Ensure only single byte characters are set. */
+- if (dfa->mb_cur_max > 1)
++ if (dfa_mb_cur_max (dfa) > 1)
+ bitset_mask (sbcset, dfa->sb_char);
+
+ if (mbcset->nmbchars || mbcset->ncoll_syms || mbcset->nequiv_classes
+- || mbcset->nranges || (dfa->mb_cur_max > 1 && (mbcset->nchar_classes
++ || mbcset->nranges || (dfa_mb_cur_max (dfa) > 1 && (mbcset->nchar_classes
+ || mbcset->non_match)))
+ {
+ bin_tree_t *mbc_tree;
+@@ -3332,7 +3358,7 @@ parse_bracket_element (bracket_elem_t *e
+ re_token_t *token, int token_len, re_dfa_t *dfa,
+ reg_syntax_t syntax, int accept_hyphen)
+ {
+-#ifdef RE_ENABLE_I18N
++#if defined RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE
+ int cur_char_size;
+ cur_char_size = re_string_char_size_at (regexp, re_string_cur_idx (regexp));
+ if (cur_char_size > 1)
+@@ -3342,7 +3368,7 @@ parse_bracket_element (bracket_elem_t *e
+ re_string_skip_bytes (regexp, cur_char_size);
+ return REG_NOERROR;
+ }
+-#endif /* RE_ENABLE_I18N */
++#endif /* RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE */
+ re_string_skip_bytes (regexp, token_len); /* Skip a token. */
+ if (token->type == OP_OPEN_COLL_ELEM || token->type == OP_OPEN_CHAR_CLASS
+ || token->type == OP_OPEN_EQUIV_CLASS)
+@@ -3422,7 +3448,9 @@ build_equiv_class (bitset_t sbcset, re_c
+ build_equiv_class (bitset_t sbcset, const unsigned char *name)
+ #endif /* not RE_ENABLE_I18N */
+ {
+-#ifdef _LIBC
++ /* When __OPTION_EGLIBC_LOCALE_CODE is disabled, only the C locale
++ is supported; it has no collation rules. */
++#if defined _LIBC && __OPTION_EGLIBC_LOCALE_CODE
+ uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
+ if (nrules != 0)
+ {
+@@ -3492,7 +3520,7 @@ build_equiv_class (bitset_t sbcset, cons
+ mbcset->equiv_classes[mbcset->nequiv_classes++] = idx1;
+ }
+ else
+-#endif /* _LIBC */
++#endif /* _LIBC && __OPTION_EGLIBC_LOCALE_CODE */
+ {
+ if (BE (strlen ((const char *) name) != 1, 0))
+ return REG_ECOLLATE;
+@@ -3526,7 +3554,7 @@ build_charclass (RE_TRANSLATE_TYPE trans
+ && (strcmp (name, "upper") == 0 || strcmp (name, "lower") == 0))
+ name = "alpha";
+
+-#ifdef RE_ENABLE_I18N
++#if defined RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE
+ /* Check the space of the arrays. */
+ if (BE (*char_class_alloc == mbcset->nchar_classes, 0))
+ {
+@@ -3542,7 +3570,7 @@ build_charclass (RE_TRANSLATE_TYPE trans
+ *char_class_alloc = new_char_class_alloc;
+ }
+ mbcset->char_classes[mbcset->nchar_classes++] = __wctype (name);
+-#endif /* RE_ENABLE_I18N */
++#endif /* RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE */
+
+ #define BUILD_CHARCLASS_LOOP(ctype_func) \
+ do { \
+@@ -3653,7 +3681,7 @@ build_charclass_op (re_dfa_t *dfa, RE_TR
+
+ #ifdef RE_ENABLE_I18N
+ /* Ensure only single byte characters are set. */
+- if (dfa->mb_cur_max > 1)
++ if (dfa_mb_cur_max (dfa) > 1)
+ bitset_mask (sbcset, dfa->sb_char);
+ #endif
+
+@@ -3665,7 +3693,7 @@ build_charclass_op (re_dfa_t *dfa, RE_TR
+ goto build_word_op_espace;
+
+ #ifdef RE_ENABLE_I18N
+- if (dfa->mb_cur_max > 1)
++ if (dfa_mb_cur_max (dfa) > 1)
+ {
+ bin_tree_t *mbc_tree;
+ /* Build a tree for complex bracket. */
+Index: git/posix/regexec.c
+===================================================================
+--- git.orig/posix/regexec.c
++++ git/posix/regexec.c
+@@ -18,6 +18,7 @@
+ <http://www.gnu.org/licenses/>. */
+
+ #include <stdint.h>
++#include <gnu/option-groups.h>
+
+ static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags,
+ int n) internal_function;
+@@ -186,11 +187,11 @@ static int build_trtable (const re_dfa_t
+ static int check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
+ const re_string_t *input, int idx)
+ internal_function;
+-# ifdef _LIBC
++# if defined _LIBC && __OPTION_EGLIBC_LOCALE_CODE
+ static unsigned int find_collation_sequence_value (const unsigned char *mbs,
+ size_t name_len)
+ internal_function;
+-# endif /* _LIBC */
++# endif /* _LIBC && __OPTION_EGLIBC_LOCALE_CODE */
+ #endif /* RE_ENABLE_I18N */
+ static int group_nodes_into_DFAstates (const re_dfa_t *dfa,
+ const re_dfastate_t *state,
+@@ -255,25 +256,9 @@ regexec (preg, string, nmatch, pmatch, e
+ return err != REG_NOERROR;
+ }
+
+-#ifdef _LIBC
+-# include <shlib-compat.h>
+-versioned_symbol (libc, __regexec, regexec, GLIBC_2_3_4);
+-
+-# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
+-__typeof__ (__regexec) __compat_regexec;
+-
+-int
+-attribute_compat_text_section
+-__compat_regexec (const regex_t *__restrict preg,
+- const char *__restrict string, size_t nmatch,
+- regmatch_t pmatch[], int eflags)
+-{
+- return regexec (preg, string, nmatch, pmatch,
+- eflags & (REG_NOTBOL | REG_NOTEOL));
+-}
+-compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0);
+-# endif
+-#endif
++/* EGLIBC: The code that used to be here was move to a separate file
++ so that it can be shared with xregex.c. */
++#include "regexec-compat.c"
+
+ /* Entry points for GNU code. */
+
+@@ -728,7 +713,7 @@ re_search_internal (preg, string, length
+ incr = (range < 0) ? -1 : 1;
+ left_lim = (range < 0) ? start + range : start;
+ right_lim = (range < 0) ? start : start + range;
+- sb = dfa->mb_cur_max == 1;
++ sb = dfa_mb_cur_max (dfa) == 1;
+ match_kind =
+ (fastmap
+ ? ((sb || !(preg->syntax & RE_ICASE || t) ? 4 : 0)
+@@ -3448,7 +3433,7 @@ out_free:
+ if (BE (dest_states_word[i] == NULL && err != REG_NOERROR, 0))
+ goto out_free;
+
+- if (dest_states[i] != dest_states_word[i] && dfa->mb_cur_max > 1)
++ if (dest_states[i] != dest_states_word[i] && dfa_mb_cur_max (dfa) > 1)
+ need_word_trtable = 1;
+
+ dest_states_nl[i] = re_acquire_state_context (&err, dfa, &follows,
+@@ -3590,7 +3575,7 @@ group_nodes_into_DFAstates (const re_dfa
+ else if (type == OP_PERIOD)
+ {
+ #ifdef RE_ENABLE_I18N
+- if (dfa->mb_cur_max > 1)
++ if (dfa_mb_cur_max (dfa) > 1)
+ bitset_merge (accepts, dfa->sb_char);
+ else
+ #endif
+@@ -3641,7 +3626,7 @@ group_nodes_into_DFAstates (const re_dfa
+ continue;
+ }
+ #ifdef RE_ENABLE_I18N
+- if (dfa->mb_cur_max > 1)
++ if (dfa_mb_cur_max (dfa) > 1)
+ for (j = 0; j < BITSET_WORDS; ++j)
+ any_set |= (accepts[j] &= (dfa->word_char[j] | ~dfa->sb_char[j]));
+ else
+@@ -3660,7 +3645,7 @@ group_nodes_into_DFAstates (const re_dfa
+ continue;
+ }
+ #ifdef RE_ENABLE_I18N
+- if (dfa->mb_cur_max > 1)
++ if (dfa_mb_cur_max (dfa) > 1)
+ for (j = 0; j < BITSET_WORDS; ++j)
+ any_set |= (accepts[j] &= ~(dfa->word_char[j] & dfa->sb_char[j]));
+ else
+@@ -3836,12 +3821,6 @@ check_node_accept_bytes (const re_dfa_t
+ if (node->type == COMPLEX_BRACKET)
+ {
+ const re_charset_t *cset = node->opr.mbcset;
+-# ifdef _LIBC
+- const unsigned char *pin
+- = ((const unsigned char *) re_string_get_buffer (input) + str_idx);
+- int j;
+- uint32_t nrules;
+-# endif /* _LIBC */
+ int match_len = 0;
+ wchar_t wc = ((cset->nranges || cset->nchar_classes || cset->nmbchars)
+ ? re_string_wchar_at (input, str_idx) : 0);
+@@ -3853,6 +3832,7 @@ check_node_accept_bytes (const re_dfa_t
+ match_len = char_len;
+ goto check_node_accept_bytes_match;
+ }
++#if __OPTION_EGLIBC_LOCALE_CODE
+ /* match with character_class? */
+ for (i = 0; i < cset->nchar_classes; ++i)
+ {
+@@ -3863,14 +3843,22 @@ check_node_accept_bytes (const re_dfa_t
+ goto check_node_accept_bytes_match;
+ }
+ }
++#endif
++
++ /* When __OPTION_EGLIBC_LOCALE_CODE is disabled, only the C
++ locale is supported; it has no collation rules. */
++# if defined _LIBC && __OPTION_EGLIBC_LOCALE_CODE
++ const unsigned char *pin
++ = ((const unsigned char *) re_string_get_buffer (input) + str_idx);
++ int j;
++ uint32_t nrules;
+
+-# ifdef _LIBC
+ nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
+ if (nrules != 0)
+ {
+ unsigned int in_collseq = 0;
+ const int32_t *table, *indirect;
+- const unsigned char *weights, *extra;
++ const unsigned char *weights, *extra = NULL;
+ const char *collseqwc;
+
+ /* match with collating_symbol? */
+@@ -3955,8 +3943,12 @@ check_node_accept_bytes (const re_dfa_t
+ }
+ }
+ else
+-# endif /* _LIBC */
++# endif /* _LIBC && __OPTION_EGLIBC_LOCALE_CODE */
+ {
++ /* In the _LIBC version, if OPTION_EGLIBC_LOCALE_CODE is
++ disabled, there can be no multibyte range endpoints, and
++ cset->nranges is always zero. */
++#if __OPTION_EGLIBC_LOCALE_CODE
+ /* match with range expression? */
+ #if __GNUC__ >= 2
+ wchar_t cmp_buf[] = {L'\0', L'\0', wc, L'\0', L'\0', L'\0'};
+@@ -3975,6 +3967,7 @@ check_node_accept_bytes (const re_dfa_t
+ goto check_node_accept_bytes_match;
+ }
+ }
++#endif /* __OPTION_EGLIBC_LOCALE_CODE */
+ }
+ check_node_accept_bytes_match:
+ if (!cset->non_match)
+@@ -3990,7 +3983,7 @@ check_node_accept_bytes (const re_dfa_t
+ return 0;
+ }
+
+-# ifdef _LIBC
++# if defined _LIBC && __OPTION_EGLIBC_LOCALE_CODE
+ static unsigned int
+ internal_function
+ find_collation_sequence_value (const unsigned char *mbs, size_t mbs_len)
+@@ -4048,7 +4041,7 @@ find_collation_sequence_value (const uns
+ return UINT_MAX;
+ }
+ }
+-# endif /* _LIBC */
++# endif /* _LIBC && __OPTION_EGLIBC_LOCALE_CODE */
+ #endif /* RE_ENABLE_I18N */
+
+ /* Check whether the node accepts the byte which is IDX-th
+@@ -4139,7 +4132,7 @@ extend_buffers (re_match_context_t *mctx
+ if (pstr->icase)
+ {
+ #ifdef RE_ENABLE_I18N
+- if (pstr->mb_cur_max > 1)
++ if (string_mb_cur_max (pstr) > 1)
+ {
+ ret = build_wcs_upper_buffer (pstr);
+ if (BE (ret != REG_NOERROR, 0))
+@@ -4152,7 +4145,7 @@ extend_buffers (re_match_context_t *mctx
+ else
+ {
+ #ifdef RE_ENABLE_I18N
+- if (pstr->mb_cur_max > 1)
++ if (string_mb_cur_max (pstr) > 1)
+ build_wcs_buffer (pstr);
+ else
+ #endif /* RE_ENABLE_I18N */
+Index: git/posix/regexec-compat.c
+===================================================================
+--- /dev/null
++++ git/posix/regexec-compat.c
+@@ -0,0 +1,39 @@
++/* Extended regular expression matching and search library.
++ Copyright (C) 2008 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifdef _LIBC
++# include <shlib-compat.h>
++versioned_symbol (libc, __regexec, regexec, GLIBC_2_3_4);
++
++# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
++__typeof__ (__regexec) __compat_regexec;
++
++int
++attribute_compat_text_section
++__compat_regexec (const regex_t *__restrict preg,
++ const char *__restrict string, size_t nmatch,
++ regmatch_t pmatch[], int eflags)
++{
++ return regexec (preg, string, nmatch, pmatch,
++ eflags & (REG_NOTBOL | REG_NOTEOL));
++}
++compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0);
++# endif
++#endif
+Index: git/posix/regex.h
+===================================================================
+--- git.orig/posix/regex.h
++++ git/posix/regex.h
+@@ -21,6 +21,7 @@
+ #define _REGEX_H 1
+
+ #include <sys/types.h>
++#include <gnu/option-groups.h>
+
+ /* Allow the use in C++ code. */
+ #ifdef __cplusplus
+@@ -156,6 +157,8 @@ typedef unsigned long int reg_syntax_t;
+ treated as 'a\{1'. */
+ # define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
+
++/* EGLIBC: Old regex implementation does not support these. */
++# if __OPTION_POSIX_REGEXP_GLIBC
+ /* If this bit is set, then ignore case when matching.
+ If not set, then case is significant. */
+ # define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
+@@ -172,6 +175,7 @@ typedef unsigned long int reg_syntax_t;
+ /* If this bit is set, then no_sub will be set to 1 during
+ re_compile_pattern. */
+ # define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
++# endif /* __OPTION_POSIX_REGEXP_GLIBC */
+ #endif
+
+ /* This global variable defines the particular regexp syntax to use (for
+@@ -231,8 +235,13 @@ extern reg_syntax_t re_syntax_options;
+ (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
+ | RE_INTERVALS | RE_NO_EMPTY_RANGES)
+
++#if __OPTION_POSIX_REGEXP_GLIBC
+ #define RE_SYNTAX_POSIX_BASIC \
+ (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP)
++#else
++#define RE_SYNTAX_POSIX_BASIC \
++ (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
++#endif
+
+ /* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
+ RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
+@@ -298,9 +307,11 @@ extern reg_syntax_t re_syntax_options;
+ /* Like REG_NOTBOL, except for the end-of-line. */
+ #define REG_NOTEOL (1 << 1)
+
++#if __OPTION_POSIX_REGEXP_GLIBC
+ /* Use PMATCH[0] to delimit the start and end of the search in the
+ buffer. */
+ #define REG_STARTEND (1 << 2)
++#endif
+
+
+ /* If any error codes are removed, changed, or added, update the
+Index: git/posix/regex_internal.c
+===================================================================
+--- git.orig/posix/regex_internal.c
++++ git/posix/regex_internal.c
+@@ -43,8 +43,8 @@ re_string_allocate (re_string_t *pstr, c
+ int init_buf_len;
+
+ /* Ensure at least one character fits into the buffers. */
+- if (init_len < dfa->mb_cur_max)
+- init_len = dfa->mb_cur_max;
++ if (init_len < dfa_mb_cur_max (dfa))
++ init_len = dfa_mb_cur_max (dfa);
+ init_buf_len = (len + 1 < init_len) ? len + 1: init_len;
+ re_string_construct_common (str, len, pstr, trans, icase, dfa);
+
+@@ -55,7 +55,7 @@ re_string_allocate (re_string_t *pstr, c
+ pstr->word_char = dfa->word_char;
+ pstr->word_ops_used = dfa->word_ops_used;
+ pstr->mbs = pstr->mbs_allocated ? pstr->mbs : (unsigned char *) str;
+- pstr->valid_len = (pstr->mbs_allocated || dfa->mb_cur_max > 1) ? 0 : len;
++ pstr->valid_len = (pstr->mbs_allocated || dfa_mb_cur_max (dfa) > 1) ? 0 : len;
+ pstr->valid_raw_len = pstr->valid_len;
+ return REG_NOERROR;
+ }
+@@ -82,7 +82,7 @@ re_string_construct (re_string_t *pstr,
+ if (icase)
+ {
+ #ifdef RE_ENABLE_I18N
+- if (dfa->mb_cur_max > 1)
++ if (dfa_mb_cur_max (dfa) > 1)
+ {
+ while (1)
+ {
+@@ -91,7 +91,7 @@ re_string_construct (re_string_t *pstr,
+ return ret;
+ if (pstr->valid_raw_len >= len)
+ break;
+- if (pstr->bufs_len > pstr->valid_len + dfa->mb_cur_max)
++ if (pstr->bufs_len > pstr->valid_len + dfa_mb_cur_max (dfa))
+ break;
+ ret = re_string_realloc_buffers (pstr, pstr->bufs_len * 2);
+ if (BE (ret != REG_NOERROR, 0))
+@@ -105,7 +105,7 @@ re_string_construct (re_string_t *pstr,
+ else
+ {
+ #ifdef RE_ENABLE_I18N
+- if (dfa->mb_cur_max > 1)
++ if (dfa_mb_cur_max (dfa) > 1)
+ build_wcs_buffer (pstr);
+ else
+ #endif /* RE_ENABLE_I18N */
+@@ -130,7 +130,7 @@ internal_function __attribute_warn_unuse
+ re_string_realloc_buffers (re_string_t *pstr, int new_buf_len)
+ {
+ #ifdef RE_ENABLE_I18N
+- if (pstr->mb_cur_max > 1)
++ if (string_mb_cur_max (pstr) > 1)
+ {
+ wint_t *new_wcs;
+
+@@ -177,7 +177,7 @@ re_string_construct_common (const char *
+ pstr->trans = trans;
+ pstr->icase = icase ? 1 : 0;
+ pstr->mbs_allocated = (trans != NULL || icase);
+- pstr->mb_cur_max = dfa->mb_cur_max;
++ pstr->mb_cur_max = dfa_mb_cur_max (dfa);
+ pstr->is_utf8 = dfa->is_utf8;
+ pstr->map_notascii = dfa->map_notascii;
+ pstr->stop = pstr->len;
+@@ -203,7 +203,7 @@ build_wcs_buffer (re_string_t *pstr)
+ {
+ #ifdef _LIBC
+ unsigned char buf[MB_LEN_MAX];
+- assert (MB_LEN_MAX >= pstr->mb_cur_max);
++ assert (MB_LEN_MAX >= string_mb_cur_max (pstr));
+ #else
+ unsigned char buf[64];
+ #endif
+@@ -226,7 +226,7 @@ build_wcs_buffer (re_string_t *pstr)
+ {
+ int i, ch;
+
+- for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i)
++ for (i = 0; i < string_mb_cur_max (pstr) && i < remain_len; ++i)
+ {
+ ch = pstr->raw_mbs [pstr->raw_mbs_idx + byte_idx + i];
+ buf[i] = pstr->mbs[byte_idx + i] = pstr->trans[ch];
+@@ -275,7 +275,7 @@ build_wcs_upper_buffer (re_string_t *pst
+ size_t mbclen;
+ #ifdef _LIBC
+ char buf[MB_LEN_MAX];
+- assert (MB_LEN_MAX >= pstr->mb_cur_max);
++ assert (MB_LEN_MAX >= string_mb_cur_max (pstr));
+ #else
+ char buf[64];
+ #endif
+@@ -369,7 +369,7 @@ build_wcs_upper_buffer (re_string_t *pst
+ {
+ int i, ch;
+
+- for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i)
++ for (i = 0; i < string_mb_cur_max (pstr) && i < remain_len; ++i)
+ {
+ ch = pstr->raw_mbs [pstr->raw_mbs_idx + src_idx + i];
+ buf[i] = pstr->trans[ch];
+@@ -567,8 +567,9 @@ re_string_translate_buffer (re_string_t
+ }
+
+ /* This function re-construct the buffers.
+- Concretely, convert to wide character in case of pstr->mb_cur_max > 1,
+- convert to upper case in case of REG_ICASE, apply translation. */
++ Concretely, convert to wide character in case of
++ string_mb_cur_max (pstr) > 1, convert to upper case in case of
++ REG_ICASE, apply translation. */
+
+ static reg_errcode_t
+ internal_function __attribute_warn_unused_result__
+@@ -579,7 +580,7 @@ re_string_reconstruct (re_string_t *pstr
+ {
+ /* Reset buffer. */
+ #ifdef RE_ENABLE_I18N
+- if (pstr->mb_cur_max > 1)
++ if (string_mb_cur_max (pstr) > 1)
+ memset (&pstr->cur_state, '\0', sizeof (mbstate_t));
+ #endif /* RE_ENABLE_I18N */
+ pstr->len = pstr->raw_len;
+@@ -670,7 +671,7 @@ re_string_reconstruct (re_string_t *pstr
+ pstr->tip_context = re_string_context_at (pstr, offset - 1,
+ eflags);
+ #ifdef RE_ENABLE_I18N
+- if (pstr->mb_cur_max > 1)
++ if (string_mb_cur_max (pstr) > 1)
+ memmove (pstr->wcs, pstr->wcs + offset,
+ (pstr->valid_len - offset) * sizeof (wint_t));
+ #endif /* RE_ENABLE_I18N */
+@@ -699,7 +700,7 @@ re_string_reconstruct (re_string_t *pstr
+ #endif
+ pstr->valid_len = 0;
+ #ifdef RE_ENABLE_I18N
+- if (pstr->mb_cur_max > 1)
++ if (string_mb_cur_max (pstr) > 1)
+ {
+ int wcs_idx;
+ wint_t wc = WEOF;
+@@ -711,7 +712,7 @@ re_string_reconstruct (re_string_t *pstr
+ /* Special case UTF-8. Multi-byte chars start with any
+ byte other than 0x80 - 0xbf. */
+ raw = pstr->raw_mbs + pstr->raw_mbs_idx;
+- end = raw + (offset - pstr->mb_cur_max);
++ end = raw + (offset - string_mb_cur_max (pstr));
+ if (end < pstr->raw_mbs)
+ end = pstr->raw_mbs;
+ p = raw + offset - 1;
+@@ -803,7 +804,7 @@ re_string_reconstruct (re_string_t *pstr
+
+ /* Then build the buffers. */
+ #ifdef RE_ENABLE_I18N
+- if (pstr->mb_cur_max > 1)
++ if (string_mb_cur_max (pstr) > 1)
+ {
+ if (pstr->icase)
+ {
+@@ -841,7 +842,7 @@ re_string_peek_byte_case (const re_strin
+ return re_string_peek_byte (pstr, idx);
+
+ #ifdef RE_ENABLE_I18N
+- if (pstr->mb_cur_max > 1
++ if (string_mb_cur_max (pstr) > 1
+ && ! re_string_is_single_byte_char (pstr, pstr->cur_idx + idx))
+ return re_string_peek_byte (pstr, idx);
+ #endif
+@@ -930,7 +931,7 @@ re_string_context_at (const re_string_t
+ return ((eflags & REG_NOTEOL) ? CONTEXT_ENDBUF
+ : CONTEXT_NEWLINE | CONTEXT_ENDBUF);
+ #ifdef RE_ENABLE_I18N
+- if (input->mb_cur_max > 1)
++ if (string_mb_cur_max (input) > 1)
+ {
+ wint_t wc;
+ int wc_idx = idx;
+@@ -1444,7 +1445,7 @@ re_dfa_add_node (re_dfa_t *dfa, re_token
+ dfa->nodes[dfa->nodes_len].constraint = 0;
+ #ifdef RE_ENABLE_I18N
+ dfa->nodes[dfa->nodes_len].accept_mb =
+- (type == OP_PERIOD && dfa->mb_cur_max > 1) || type == COMPLEX_BRACKET;
++ (type == OP_PERIOD && dfa_mb_cur_max (dfa) > 1) || type == COMPLEX_BRACKET;
+ #endif
+ dfa->nexts[dfa->nodes_len] = -1;
+ re_node_set_init_empty (dfa->edests + dfa->nodes_len);
+Index: git/posix/regex_internal.h
+===================================================================
+--- git.orig/posix/regex_internal.h
++++ git/posix/regex_internal.h
+@@ -26,6 +26,10 @@
+ #include <stdlib.h>
+ #include <string.h>
+
++#if defined _LIBC
++# include <gnu/option-groups.h>
++#endif
++
+ #if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET || defined _LIBC
+ # include <langinfo.h>
+ #endif
+@@ -369,6 +373,13 @@ struct re_string_t
+ };
+ typedef struct re_string_t re_string_t;
+
++/* When OPTION_EGLIBC_LOCALE_CODE is disabled, this is always 1;
++ help the compiler make use of that fact. */
++#if __OPTION_EGLIBC_LOCALE_CODE
++# define string_mb_cur_max(str) ((str)->mb_cur_max + 0)
++#else
++# define string_mb_cur_max(str) (1)
++#endif
+
+ struct re_dfa_t;
+ typedef struct re_dfa_t re_dfa_t;
+@@ -654,6 +665,14 @@ struct re_dfa_t
+ __libc_lock_define (, lock)
+ };
+
++/* When OPTION_EGLIBC_LOCALE_CODE is disabled, this is always 1;
++ help the compiler make use of that fact. */
++#if __OPTION_EGLIBC_LOCALE_CODE
++# define dfa_mb_cur_max(dfa) ((dfa)->mb_cur_max + 0)
++#else
++# define dfa_mb_cur_max(dfa) (1)
++#endif
++
+ #define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set))
+ #define re_node_set_remove(set,id) \
+ (re_node_set_remove_at (set, re_node_set_contains (set, id) - 1))
+@@ -714,7 +733,7 @@ internal_function __attribute__ ((pure,
+ re_string_char_size_at (const re_string_t *pstr, int idx)
+ {
+ int byte_idx;
+- if (pstr->mb_cur_max == 1)
++ if (string_mb_cur_max (pstr) == 1)
+ return 1;
+ for (byte_idx = 1; idx + byte_idx < pstr->valid_len; ++byte_idx)
+ if (pstr->wcs[idx + byte_idx] != WEOF)
+@@ -726,7 +745,7 @@ static wint_t
+ internal_function __attribute__ ((pure, unused))
+ re_string_wchar_at (const re_string_t *pstr, int idx)
+ {
+- if (pstr->mb_cur_max == 1)
++ if (string_mb_cur_max (pstr) == 1)
+ return (wint_t) pstr->mbs[idx];
+ return (wint_t) pstr->wcs[idx];
+ }
+Index: git/posix/xregex.c
+===================================================================
+--- /dev/null
++++ git/posix/xregex.c
+@@ -0,0 +1,8215 @@
++/* Extended regular expression matching and search library,
++ version 0.12.
++ (Implements POSIX draft P1003.2/D11.2, except for some of the
++ internationalization features.)
++
++ Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
++ 2002, 2005 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ 02110-1301 USA. */
++
++/* AIX requires this to be the first thing in the file. */
++#if defined _AIX && !defined __GNUC__ && !defined REGEX_MALLOC
++ #pragma alloca
++#endif
++
++#undef _GNU_SOURCE
++#define _GNU_SOURCE
++
++#ifndef INSIDE_RECURSION
++# ifdef HAVE_CONFIG_H
++# include <config.h>
++# endif
++#endif
++
++/*#include <ansidecl.h>*/
++
++
++#ifndef INSIDE_RECURSION
++
++# if defined STDC_HEADERS && !defined emacs
++# include <stddef.h>
++# else
++/* We need this for `regex.h', and perhaps for the Emacs include files. */
++# include <sys/types.h>
++# endif
++
++# if (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_BTOWC)
++# define WIDE_CHAR_SUPPORT (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC)
++# else
++# define WIDE_CHAR_SUPPORT 0
++# endif
++/* For platform which support the ISO C amendement 1 functionality we
++ support user defined character classes. */
++# if WIDE_CHAR_SUPPORT
++/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
++# include <wchar.h>
++# include <wctype.h>
++# endif
++
++# ifdef _LIBC
++/* We have to keep the namespace clean. */
++# define regfree(preg) __regfree (preg)
++# define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef)
++# define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags)
++# define regerror(errcode, preg, errbuf, errbuf_size) \
++ __regerror(errcode, preg, errbuf, errbuf_size)
++# define re_set_registers(bu, re, nu, st, en) \
++ __re_set_registers (bu, re, nu, st, en)
++# define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \
++ __re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
++# define re_match(bufp, string, size, pos, regs) \
++ __re_match (bufp, string, size, pos, regs)
++# define re_search(bufp, string, size, startpos, range, regs) \
++ __re_search (bufp, string, size, startpos, range, regs)
++# define re_compile_pattern(pattern, length, bufp) \
++ __re_compile_pattern (pattern, length, bufp)
++# define re_set_syntax(syntax) __re_set_syntax (syntax)
++# define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \
++ __re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)
++# define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
++
++# define btowc __btowc
++
++/* We are also using some library internals. */
++# include <locale/localeinfo.h>
++# include <locale/elem-hash.h>
++# include <langinfo.h>
++# include <locale/coll-lookup.h>
++# endif
++
++/* This is for other GNU distributions with internationalized messages. */
++# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
++# include <libintl.h>
++# ifdef _LIBC
++# undef gettext
++# define gettext(msgid) __dcgettext ("libc", msgid, LC_MESSAGES)
++# endif
++# else
++# define gettext(msgid) (msgid)
++# endif
++
++# ifndef gettext_noop
++/* This define is so xgettext can find the internationalizable
++ strings. */
++# define gettext_noop(String) String
++# endif
++
++/* The `emacs' switch turns on certain matching commands
++ that make sense only in Emacs. */
++# ifdef emacs
++
++# include "lisp.h"
++# include "buffer.h"
++# include "syntax.h"
++
++# else /* not emacs */
++
++/* If we are not linking with Emacs proper,
++ we can't use the relocating allocator
++ even if config.h says that we can. */
++# undef REL_ALLOC
++
++# if defined STDC_HEADERS || defined _LIBC
++# include <stdlib.h>
++# else
++char *malloc ();
++char *realloc ();
++# endif
++
++/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow.
++ If nothing else has been done, use the method below. */
++# ifdef INHIBIT_STRING_HEADER
++# if !(defined HAVE_BZERO && defined HAVE_BCOPY)
++# if !defined bzero && !defined bcopy
++# undef INHIBIT_STRING_HEADER
++# endif
++# endif
++# endif
++
++/* This is the normal way of making sure we have a bcopy and a bzero.
++ This is used in most programs--a few other programs avoid this
++ by defining INHIBIT_STRING_HEADER. */
++# ifndef INHIBIT_STRING_HEADER
++# if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC
++# include <string.h>
++# ifndef bzero
++# ifndef _LIBC
++# define bzero(s, n) (memset (s, '\0', n), (s))
++# else
++# define bzero(s, n) __bzero (s, n)
++# endif
++# endif
++# else
++# include <strings.h>
++# ifndef memcmp
++# define memcmp(s1, s2, n) bcmp (s1, s2, n)
++# endif
++# ifndef memcpy
++# define memcpy(d, s, n) (bcopy (s, d, n), (d))
++# endif
++# endif
++# endif
++
++/* Define the syntax stuff for \<, \>, etc. */
++
++/* This must be nonzero for the wordchar and notwordchar pattern
++ commands in re_match_2. */
++# ifndef Sword
++# define Sword 1
++# endif
++
++# ifdef SWITCH_ENUM_BUG
++# define SWITCH_ENUM_CAST(x) ((int)(x))
++# else
++# define SWITCH_ENUM_CAST(x) (x)
++# endif
++
++# endif /* not emacs */
++
++# if defined _LIBC || HAVE_LIMITS_H
++# include <limits.h>
++# endif
++
++# ifndef MB_LEN_MAX
++# define MB_LEN_MAX 1
++# endif
++
++/* Get the interface, including the syntax bits. */
++# include "regex.h"
++
++/* isalpha etc. are used for the character classes. */
++# include <ctype.h>
++
++/* Jim Meyering writes:
++
++ "... Some ctype macros are valid only for character codes that
++ isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
++ using /bin/cc or gcc but without giving an ansi option). So, all
++ ctype uses should be through macros like ISPRINT... If
++ STDC_HEADERS is defined, then autoconf has verified that the ctype
++ macros don't need to be guarded with references to isascii. ...
++ Defining isascii to 1 should let any compiler worth its salt
++ eliminate the && through constant folding."
++ Solaris defines some of these symbols so we must undefine them first. */
++
++# undef ISASCII
++# if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII)
++# define ISASCII(c) 1
++# else
++# define ISASCII(c) isascii(c)
++# endif
++
++# ifdef isblank
++# define ISBLANK(c) (ISASCII (c) && isblank (c))
++# else
++# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
++# endif
++# ifdef isgraph
++# define ISGRAPH(c) (ISASCII (c) && isgraph (c))
++# else
++# define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
++# endif
++
++# undef ISPRINT
++# define ISPRINT(c) (ISASCII (c) && isprint (c))
++# define ISDIGIT(c) (ISASCII (c) && isdigit (c))
++# define ISALNUM(c) (ISASCII (c) && isalnum (c))
++# define ISALPHA(c) (ISASCII (c) && isalpha (c))
++# define ISCNTRL(c) (ISASCII (c) && iscntrl (c))
++# define ISLOWER(c) (ISASCII (c) && islower (c))
++# define ISPUNCT(c) (ISASCII (c) && ispunct (c))
++# define ISSPACE(c) (ISASCII (c) && isspace (c))
++# define ISUPPER(c) (ISASCII (c) && isupper (c))
++# define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
++
++# ifdef _tolower
++# define TOLOWER(c) _tolower(c)
++# else
++# define TOLOWER(c) tolower(c)
++# endif
++
++# ifndef NULL
++# define NULL (void *)0
++# endif
++
++/* We remove any previous definition of `SIGN_EXTEND_CHAR',
++ since ours (we hope) works properly with all combinations of
++ machines, compilers, `char' and `unsigned char' argument types.
++ (Per Bothner suggested the basic approach.) */
++# undef SIGN_EXTEND_CHAR
++# if __STDC__
++# define SIGN_EXTEND_CHAR(c) ((signed char) (c))
++# else /* not __STDC__ */
++/* As in Harbison and Steele. */
++# define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
++# endif
++
++# ifndef emacs
++/* How many characters in the character set. */
++# define CHAR_SET_SIZE 256
++
++# ifdef SYNTAX_TABLE
++
++extern char *re_syntax_table;
++
++# else /* not SYNTAX_TABLE */
++
++static char re_syntax_table[CHAR_SET_SIZE];
++
++static void init_syntax_once (void);
++
++static void
++init_syntax_once (void)
++{
++ register int c;
++ static int done = 0;
++
++ if (done)
++ return;
++ bzero (re_syntax_table, sizeof re_syntax_table);
++
++ for (c = 0; c < CHAR_SET_SIZE; ++c)
++ if (ISALNUM (c))
++ re_syntax_table[c] = Sword;
++
++ re_syntax_table['_'] = Sword;
++
++ done = 1;
++}
++
++# endif /* not SYNTAX_TABLE */
++
++# define SYNTAX(c) re_syntax_table[(unsigned char) (c)]
++
++# endif /* emacs */
++
++/* Integer type for pointers. */
++# if !defined _LIBC && !defined HAVE_UINTPTR_T
++typedef unsigned long int uintptr_t;
++# endif
++
++/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we
++ use `alloca' instead of `malloc'. This is because using malloc in
++ re_search* or re_match* could cause memory leaks when C-g is used in
++ Emacs; also, malloc is slower and causes storage fragmentation. On
++ the other hand, malloc is more portable, and easier to debug.
++
++ Because we sometimes use alloca, some routines have to be macros,
++ not functions -- `alloca'-allocated space disappears at the end of the
++ function it is called in. */
++
++# ifdef REGEX_MALLOC
++
++# define REGEX_ALLOCATE malloc
++# define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize)
++# define REGEX_FREE free
++
++# else /* not REGEX_MALLOC */
++
++/* Emacs already defines alloca, sometimes. */
++# ifndef alloca
++
++/* Make alloca work the best possible way. */
++# ifdef __GNUC__
++# define alloca __builtin_alloca
++# else /* not __GNUC__ */
++# if HAVE_ALLOCA_H
++# include <alloca.h>
++# endif /* HAVE_ALLOCA_H */
++# endif /* not __GNUC__ */
++
++# endif /* not alloca */
++
++# define REGEX_ALLOCATE alloca
++
++/* Assumes a `char *destination' variable. */
++# define REGEX_REALLOCATE(source, osize, nsize) \
++ (destination = (char *) alloca (nsize), \
++ memcpy (destination, source, osize))
++
++/* No need to do anything to free, after alloca. */
++# define REGEX_FREE(arg) ((void)0) /* Do nothing! But inhibit gcc warning. */
++
++# endif /* not REGEX_MALLOC */
++
++/* Define how to allocate the failure stack. */
++
++# if defined REL_ALLOC && defined REGEX_MALLOC
++
++# define REGEX_ALLOCATE_STACK(size) \
++ r_alloc (&failure_stack_ptr, (size))
++# define REGEX_REALLOCATE_STACK(source, osize, nsize) \
++ r_re_alloc (&failure_stack_ptr, (nsize))
++# define REGEX_FREE_STACK(ptr) \
++ r_alloc_free (&failure_stack_ptr)
++
++# else /* not using relocating allocator */
++
++# ifdef REGEX_MALLOC
++
++# define REGEX_ALLOCATE_STACK malloc
++# define REGEX_REALLOCATE_STACK(source, osize, nsize) realloc (source, nsize)
++# define REGEX_FREE_STACK free
++
++# else /* not REGEX_MALLOC */
++
++# define REGEX_ALLOCATE_STACK alloca
++
++# define REGEX_REALLOCATE_STACK(source, osize, nsize) \
++ REGEX_REALLOCATE (source, osize, nsize)
++/* No need to explicitly free anything. */
++# define REGEX_FREE_STACK(arg)
++
++# endif /* not REGEX_MALLOC */
++# endif /* not using relocating allocator */
++
++
++/* True if `size1' is non-NULL and PTR is pointing anywhere inside
++ `string1' or just past its end. This works if PTR is NULL, which is
++ a good thing. */
++# define FIRST_STRING_P(ptr) \
++ (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
++
++/* (Re)Allocate N items of type T using malloc, or fail. */
++# define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t)))
++# define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t)))
++# define RETALLOC_IF(addr, n, t) \
++ if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t)
++# define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))
++
++# define BYTEWIDTH 8 /* In bits. */
++
++# define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
++
++# undef MAX
++# undef MIN
++# define MAX(a, b) ((a) > (b) ? (a) : (b))
++# define MIN(a, b) ((a) < (b) ? (a) : (b))
++
++typedef char boolean;
++# define false 0
++# define true 1
++
++static reg_errcode_t byte_regex_compile (const char *pattern, size_t size,
++ reg_syntax_t syntax,
++ struct re_pattern_buffer *bufp);
++
++static int byte_re_match_2_internal (struct re_pattern_buffer *bufp,
++ const char *string1, int size1,
++ const char *string2, int size2,
++ int pos,
++ struct re_registers *regs,
++ int stop);
++static int byte_re_search_2 (struct re_pattern_buffer *bufp,
++ const char *string1, int size1,
++ const char *string2, int size2,
++ int startpos, int range,
++ struct re_registers *regs, int stop);
++static int byte_re_compile_fastmap (struct re_pattern_buffer *bufp);
++
++#ifdef MBS_SUPPORT
++static reg_errcode_t wcs_regex_compile (const char *pattern, size_t size,
++ reg_syntax_t syntax,
++ struct re_pattern_buffer *bufp);
++
++
++static int wcs_re_match_2_internal (struct re_pattern_buffer *bufp,
++ const char *cstring1, int csize1,
++ const char *cstring2, int csize2,
++ int pos,
++ struct re_registers *regs,
++ int stop,
++ wchar_t *string1, int size1,
++ wchar_t *string2, int size2,
++ int *mbs_offset1, int *mbs_offset2);
++static int wcs_re_search_2 (struct re_pattern_buffer *bufp,
++ const char *string1, int size1,
++ const char *string2, int size2,
++ int startpos, int range,
++ struct re_registers *regs, int stop);
++static int wcs_re_compile_fastmap (struct re_pattern_buffer *bufp);
++#endif
++
++/* These are the command codes that appear in compiled regular
++ expressions. Some opcodes are followed by argument bytes. A
++ command code can specify any interpretation whatsoever for its
++ arguments. Zero bytes may appear in the compiled regular expression. */
++
++typedef enum
++{
++ no_op = 0,
++
++ /* Succeed right away--no more backtracking. */
++ succeed,
++
++ /* Followed by one byte giving n, then by n literal bytes. */
++ exactn,
++
++# ifdef MBS_SUPPORT
++ /* Same as exactn, but contains binary data. */
++ exactn_bin,
++# endif
++
++ /* Matches any (more or less) character. */
++ anychar,
++
++ /* Matches any one char belonging to specified set. First
++ following byte is number of bitmap bytes. Then come bytes
++ for a bitmap saying which chars are in. Bits in each byte
++ are ordered low-bit-first. A character is in the set if its
++ bit is 1. A character too large to have a bit in the map is
++ automatically not in the set. */
++ /* ifdef MBS_SUPPORT, following element is length of character
++ classes, length of collating symbols, length of equivalence
++ classes, length of character ranges, and length of characters.
++ Next, character class element, collating symbols elements,
++ equivalence class elements, range elements, and character
++ elements follow.
++ See regex_compile function. */
++ charset,
++
++ /* Same parameters as charset, but match any character that is
++ not one of those specified. */
++ charset_not,
++
++ /* Start remembering the text that is matched, for storing in a
++ register. Followed by one byte with the register number, in
++ the range 0 to one less than the pattern buffer's re_nsub
++ field. Then followed by one byte with the number of groups
++ inner to this one. (This last has to be part of the
++ start_memory only because we need it in the on_failure_jump
++ of re_match_2.) */
++ start_memory,
++
++ /* Stop remembering the text that is matched and store it in a
++ memory register. Followed by one byte with the register
++ number, in the range 0 to one less than `re_nsub' in the
++ pattern buffer, and one byte with the number of inner groups,
++ just like `start_memory'. (We need the number of inner
++ groups here because we don't have any easy way of finding the
++ corresponding start_memory when we're at a stop_memory.) */
++ stop_memory,
++
++ /* Match a duplicate of something remembered. Followed by one
++ byte containing the register number. */
++ duplicate,
++
++ /* Fail unless at beginning of line. */
++ begline,
++
++ /* Fail unless at end of line. */
++ endline,
++
++ /* Succeeds if at beginning of buffer (if emacs) or at beginning
++ of string to be matched (if not). */
++ begbuf,
++
++ /* Analogously, for end of buffer/string. */
++ endbuf,
++
++ /* Followed by two byte relative address to which to jump. */
++ jump,
++
++ /* Same as jump, but marks the end of an alternative. */
++ jump_past_alt,
++
++ /* Followed by two-byte relative address of place to resume at
++ in case of failure. */
++ /* ifdef MBS_SUPPORT, the size of address is 1. */
++ on_failure_jump,
++
++ /* Like on_failure_jump, but pushes a placeholder instead of the
++ current string position when executed. */
++ on_failure_keep_string_jump,
++
++ /* Throw away latest failure point and then jump to following
++ two-byte relative address. */
++ /* ifdef MBS_SUPPORT, the size of address is 1. */
++ pop_failure_jump,
++
++ /* Change to pop_failure_jump if know won't have to backtrack to
++ match; otherwise change to jump. This is used to jump
++ back to the beginning of a repeat. If what follows this jump
++ clearly won't match what the repeat does, such that we can be
++ sure that there is no use backtracking out of repetitions
++ already matched, then we change it to a pop_failure_jump.
++ Followed by two-byte address. */
++ /* ifdef MBS_SUPPORT, the size of address is 1. */
++ maybe_pop_jump,
++
++ /* Jump to following two-byte address, and push a dummy failure
++ point. This failure point will be thrown away if an attempt
++ is made to use it for a failure. A `+' construct makes this
++ before the first repeat. Also used as an intermediary kind
++ of jump when compiling an alternative. */
++ /* ifdef MBS_SUPPORT, the size of address is 1. */
++ dummy_failure_jump,
++
++ /* Push a dummy failure point and continue. Used at the end of
++ alternatives. */
++ push_dummy_failure,
++
++ /* Followed by two-byte relative address and two-byte number n.
++ After matching N times, jump to the address upon failure. */
++ /* ifdef MBS_SUPPORT, the size of address is 1. */
++ succeed_n,
++
++ /* Followed by two-byte relative address, and two-byte number n.
++ Jump to the address N times, then fail. */
++ /* ifdef MBS_SUPPORT, the size of address is 1. */
++ jump_n,
++
++ /* Set the following two-byte relative address to the
++ subsequent two-byte number. The address *includes* the two
++ bytes of number. */
++ /* ifdef MBS_SUPPORT, the size of address is 1. */
++ set_number_at,
++
++ wordchar, /* Matches any word-constituent character. */
++ notwordchar, /* Matches any char that is not a word-constituent. */
++
++ wordbeg, /* Succeeds if at word beginning. */
++ wordend, /* Succeeds if at word end. */
++
++ wordbound, /* Succeeds if at a word boundary. */
++ notwordbound /* Succeeds if not at a word boundary. */
++
++# ifdef emacs
++ ,before_dot, /* Succeeds if before point. */
++ at_dot, /* Succeeds if at point. */
++ after_dot, /* Succeeds if after point. */
++
++ /* Matches any character whose syntax is specified. Followed by
++ a byte which contains a syntax code, e.g., Sword. */
++ syntaxspec,
++
++ /* Matches any character whose syntax is not that specified. */
++ notsyntaxspec
++# endif /* emacs */
++} re_opcode_t;
++#endif /* not INSIDE_RECURSION */
++
++
++#ifdef BYTE
++# define CHAR_T char
++# define UCHAR_T unsigned char
++# define COMPILED_BUFFER_VAR bufp->buffer
++# define OFFSET_ADDRESS_SIZE 2
++# define PREFIX(name) byte_##name
++# define ARG_PREFIX(name) name
++# define PUT_CHAR(c) putchar (c)
++# include <locale/weight.h>
++# define FINDIDX findidx
++#else
++# ifdef WCHAR
++# define CHAR_T wchar_t
++# define UCHAR_T wchar_t
++# define COMPILED_BUFFER_VAR wc_buffer
++# define OFFSET_ADDRESS_SIZE 1 /* the size which STORE_NUMBER macro use */
++# define CHAR_CLASS_SIZE ((__alignof__(wctype_t)+sizeof(wctype_t))/sizeof(CHAR_T)+1)
++# define PREFIX(name) wcs_##name
++# define ARG_PREFIX(name) c##name
++/* Should we use wide stream?? */
++# define PUT_CHAR(c) printf ("%C", c);
++# define TRUE 1
++# define FALSE 0
++# define findidx findidxwc
++# include <locale/weightwc.h>
++# undef findidx
++# define FINDIDX findidxwc
++# else
++# ifdef MBS_SUPPORT
++# define WCHAR
++# define INSIDE_RECURSION
++# include "xregex.c"
++# undef INSIDE_RECURSION
++# endif
++# define BYTE
++# define INSIDE_RECURSION
++# include "xregex.c"
++# undef INSIDE_RECURSION
++# endif
++#endif
++
++#ifdef INSIDE_RECURSION
++/* Common operations on the compiled pattern. */
++
++/* Store NUMBER in two contiguous bytes starting at DESTINATION. */
++/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
++
++# ifdef WCHAR
++# define STORE_NUMBER(destination, number) \
++ do { \
++ *(destination) = (UCHAR_T)(number); \
++ } while (0)
++# else /* BYTE */
++# define STORE_NUMBER(destination, number) \
++ do { \
++ (destination)[0] = (number) & 0377; \
++ (destination)[1] = (number) >> 8; \
++ } while (0)
++# endif /* WCHAR */
++
++/* Same as STORE_NUMBER, except increment DESTINATION to
++ the byte after where the number is stored. Therefore, DESTINATION
++ must be an lvalue. */
++/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
++
++# define STORE_NUMBER_AND_INCR(destination, number) \
++ do { \
++ STORE_NUMBER (destination, number); \
++ (destination) += OFFSET_ADDRESS_SIZE; \
++ } while (0)
++
++/* Put into DESTINATION a number stored in two contiguous bytes starting
++ at SOURCE. */
++/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
++
++# ifdef WCHAR
++# define EXTRACT_NUMBER(destination, source) \
++ do { \
++ (destination) = *(source); \
++ } while (0)
++# else /* BYTE */
++# define EXTRACT_NUMBER(destination, source) \
++ do { \
++ (destination) = *(source) & 0377; \
++ (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \
++ } while (0)
++# endif
++
++# ifdef DEBUG
++static void PREFIX(extract_number) (int *dest, UCHAR_T *source);
++static void
++PREFIX(extract_number) (int *dest, UCHAR_T *source)
++{
++# ifdef WCHAR
++ *dest = *source;
++# else /* BYTE */
++ int temp = SIGN_EXTEND_CHAR (*(source + 1));
++ *dest = *source & 0377;
++ *dest += temp << 8;
++# endif
++}
++
++# ifndef EXTRACT_MACROS /* To debug the macros. */
++# undef EXTRACT_NUMBER
++# define EXTRACT_NUMBER(dest, src) PREFIX(extract_number) (&dest, src)
++# endif /* not EXTRACT_MACROS */
++
++# endif /* DEBUG */
++
++/* Same as EXTRACT_NUMBER, except increment SOURCE to after the number.
++ SOURCE must be an lvalue. */
++
++# define EXTRACT_NUMBER_AND_INCR(destination, source) \
++ do { \
++ EXTRACT_NUMBER (destination, source); \
++ (source) += OFFSET_ADDRESS_SIZE; \
++ } while (0)
++
++# ifdef DEBUG
++static void PREFIX(extract_number_and_incr) (int *destination,
++ UCHAR_T **source);
++static void
++PREFIX(extract_number_and_incr) (int *destination, UCHAR_T **source)
++{
++ PREFIX(extract_number) (destination, *source);
++ *source += OFFSET_ADDRESS_SIZE;
++}
++
++# ifndef EXTRACT_MACROS
++# undef EXTRACT_NUMBER_AND_INCR
++# define EXTRACT_NUMBER_AND_INCR(dest, src) \
++ PREFIX(extract_number_and_incr) (&dest, &src)
++# endif /* not EXTRACT_MACROS */
++
++# endif /* DEBUG */
++
++
++
++/* If DEBUG is defined, Regex prints many voluminous messages about what
++ it is doing (if the variable `debug' is nonzero). If linked with the
++ main program in `iregex.c', you can enter patterns and strings
++ interactively. And if linked with the main program in `main.c' and
++ the other test files, you can run the already-written tests. */
++
++# ifdef DEBUG
++
++# ifndef DEFINED_ONCE
++
++/* We use standard I/O for debugging. */
++# include <stdio.h>
++
++/* It is useful to test things that ``must'' be true when debugging. */
++# include <assert.h>
++
++static int debug;
++
++# define DEBUG_STATEMENT(e) e
++# define DEBUG_PRINT1(x) if (debug) printf (x)
++# define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2)
++# define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3)
++# define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4)
++# endif /* not DEFINED_ONCE */
++
++# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \
++ if (debug) PREFIX(print_partial_compiled_pattern) (s, e)
++# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \
++ if (debug) PREFIX(print_double_string) (w, s1, sz1, s2, sz2)
++
++
++/* Print the fastmap in human-readable form. */
++
++# ifndef DEFINED_ONCE
++void
++print_fastmap (char *fastmap)
++{
++ unsigned was_a_range = 0;
++ unsigned i = 0;
++
++ while (i < (1 << BYTEWIDTH))
++ {
++ if (fastmap[i++])
++ {
++ was_a_range = 0;
++ putchar (i - 1);
++ while (i < (1 << BYTEWIDTH) && fastmap[i])
++ {
++ was_a_range = 1;
++ i++;
++ }
++ if (was_a_range)
++ {
++ printf ("-");
++ putchar (i - 1);
++ }
++ }
++ }
++ putchar ('\n');
++}
++# endif /* not DEFINED_ONCE */
++
++
++/* Print a compiled pattern string in human-readable form, starting at
++ the START pointer into it and ending just before the pointer END. */
++
++void
++PREFIX(print_partial_compiled_pattern) (UCHAR_T *start, UCHAR_T *end)
++{
++ int mcnt, mcnt2;
++ UCHAR_T *p1;
++ UCHAR_T *p = start;
++ UCHAR_T *pend = end;
++
++ if (start == NULL)
++ {
++ printf ("(null)\n");
++ return;
++ }
++
++ /* Loop over pattern commands. */
++ while (p < pend)
++ {
++# ifdef _LIBC
++ printf ("%td:\t", p - start);
++# else
++ printf ("%ld:\t", (long int) (p - start));
++# endif
++
++ switch ((re_opcode_t) *p++)
++ {
++ case no_op:
++ printf ("/no_op");
++ break;
++
++ case exactn:
++ mcnt = *p++;
++ printf ("/exactn/%d", mcnt);
++ do
++ {
++ putchar ('/');
++ PUT_CHAR (*p++);
++ }
++ while (--mcnt);
++ break;
++
++# ifdef MBS_SUPPORT
++ case exactn_bin:
++ mcnt = *p++;
++ printf ("/exactn_bin/%d", mcnt);
++ do
++ {
++ printf("/%lx", (long int) *p++);
++ }
++ while (--mcnt);
++ break;
++# endif /* MBS_SUPPORT */
++
++ case start_memory:
++ mcnt = *p++;
++ printf ("/start_memory/%d/%ld", mcnt, (long int) *p++);
++ break;
++
++ case stop_memory:
++ mcnt = *p++;
++ printf ("/stop_memory/%d/%ld", mcnt, (long int) *p++);
++ break;
++
++ case duplicate:
++ printf ("/duplicate/%ld", (long int) *p++);
++ break;
++
++ case anychar:
++ printf ("/anychar");
++ break;
++
++ case charset:
++ case charset_not:
++ {
++# ifdef WCHAR
++ int i, length;
++ wchar_t *workp = p;
++ printf ("/charset [%s",
++ (re_opcode_t) *(workp - 1) == charset_not ? "^" : "");
++ p += 5;
++ length = *workp++; /* the length of char_classes */
++ for (i=0 ; i<length ; i++)
++ printf("[:%lx:]", (long int) *p++);
++ length = *workp++; /* the length of collating_symbol */
++ for (i=0 ; i<length ;)
++ {
++ printf("[.");
++ while(*p != 0)
++ PUT_CHAR((i++,*p++));
++ i++,p++;
++ printf(".]");
++ }
++ length = *workp++; /* the length of equivalence_class */
++ for (i=0 ; i<length ;)
++ {
++ printf("[=");
++ while(*p != 0)
++ PUT_CHAR((i++,*p++));
++ i++,p++;
++ printf("=]");
++ }
++ length = *workp++; /* the length of char_range */
++ for (i=0 ; i<length ; i++)
++ {
++ wchar_t range_start = *p++;
++ wchar_t range_end = *p++;
++ printf("%C-%C", range_start, range_end);
++ }
++ length = *workp++; /* the length of char */
++ for (i=0 ; i<length ; i++)
++ printf("%C", *p++);
++ putchar (']');
++# else
++ register int c, last = -100;
++ register int in_range = 0;
++
++ printf ("/charset [%s",
++ (re_opcode_t) *(p - 1) == charset_not ? "^" : "");
++
++ assert (p + *p < pend);
++
++ for (c = 0; c < 256; c++)
++ if (c / 8 < *p
++ && (p[1 + (c/8)] & (1 << (c % 8))))
++ {
++ /* Are we starting a range? */
++ if (last + 1 == c && ! in_range)
++ {
++ putchar ('-');
++ in_range = 1;
++ }
++ /* Have we broken a range? */
++ else if (last + 1 != c && in_range)
++ {
++ putchar (last);
++ in_range = 0;
++ }
++
++ if (! in_range)
++ putchar (c);
++
++ last = c;
++ }
++
++ if (in_range)
++ putchar (last);
++
++ putchar (']');
++
++ p += 1 + *p;
++# endif /* WCHAR */
++ }
++ break;
++
++ case begline:
++ printf ("/begline");
++ break;
++
++ case endline:
++ printf ("/endline");
++ break;
++
++ case on_failure_jump:
++ PREFIX(extract_number_and_incr) (&mcnt, &p);
++# ifdef _LIBC
++ printf ("/on_failure_jump to %td", p + mcnt - start);
++# else
++ printf ("/on_failure_jump to %ld", (long int) (p + mcnt - start));
++# endif
++ break;
++
++ case on_failure_keep_string_jump:
++ PREFIX(extract_number_and_incr) (&mcnt, &p);
++# ifdef _LIBC
++ printf ("/on_failure_keep_string_jump to %td", p + mcnt - start);
++# else
++ printf ("/on_failure_keep_string_jump to %ld",
++ (long int) (p + mcnt - start));
++# endif
++ break;
++
++ case dummy_failure_jump:
++ PREFIX(extract_number_and_incr) (&mcnt, &p);
++# ifdef _LIBC
++ printf ("/dummy_failure_jump to %td", p + mcnt - start);
++# else
++ printf ("/dummy_failure_jump to %ld", (long int) (p + mcnt - start));
++# endif
++ break;
++
++ case push_dummy_failure:
++ printf ("/push_dummy_failure");
++ break;
++
++ case maybe_pop_jump:
++ PREFIX(extract_number_and_incr) (&mcnt, &p);
++# ifdef _LIBC
++ printf ("/maybe_pop_jump to %td", p + mcnt - start);
++# else
++ printf ("/maybe_pop_jump to %ld", (long int) (p + mcnt - start));
++# endif
++ break;
++
++ case pop_failure_jump:
++ PREFIX(extract_number_and_incr) (&mcnt, &p);
++# ifdef _LIBC
++ printf ("/pop_failure_jump to %td", p + mcnt - start);
++# else
++ printf ("/pop_failure_jump to %ld", (long int) (p + mcnt - start));
++# endif
++ break;
++
++ case jump_past_alt:
++ PREFIX(extract_number_and_incr) (&mcnt, &p);
++# ifdef _LIBC
++ printf ("/jump_past_alt to %td", p + mcnt - start);
++# else
++ printf ("/jump_past_alt to %ld", (long int) (p + mcnt - start));
++# endif
++ break;
++
++ case jump:
++ PREFIX(extract_number_and_incr) (&mcnt, &p);
++# ifdef _LIBC
++ printf ("/jump to %td", p + mcnt - start);
++# else
++ printf ("/jump to %ld", (long int) (p + mcnt - start));
++# endif
++ break;
++
++ case succeed_n:
++ PREFIX(extract_number_and_incr) (&mcnt, &p);
++ p1 = p + mcnt;
++ PREFIX(extract_number_and_incr) (&mcnt2, &p);
++# ifdef _LIBC
++ printf ("/succeed_n to %td, %d times", p1 - start, mcnt2);
++# else
++ printf ("/succeed_n to %ld, %d times",
++ (long int) (p1 - start), mcnt2);
++# endif
++ break;
++
++ case jump_n:
++ PREFIX(extract_number_and_incr) (&mcnt, &p);
++ p1 = p + mcnt;
++ PREFIX(extract_number_and_incr) (&mcnt2, &p);
++ printf ("/jump_n to %d, %d times", p1 - start, mcnt2);
++ break;
++
++ case set_number_at:
++ PREFIX(extract_number_and_incr) (&mcnt, &p);
++ p1 = p + mcnt;
++ PREFIX(extract_number_and_incr) (&mcnt2, &p);
++# ifdef _LIBC
++ printf ("/set_number_at location %td to %d", p1 - start, mcnt2);
++# else
++ printf ("/set_number_at location %ld to %d",
++ (long int) (p1 - start), mcnt2);
++# endif
++ break;
++
++ case wordbound:
++ printf ("/wordbound");
++ break;
++
++ case notwordbound:
++ printf ("/notwordbound");
++ break;
++
++ case wordbeg:
++ printf ("/wordbeg");
++ break;
++
++ case wordend:
++ printf ("/wordend");
++ break;
++
++# ifdef emacs
++ case before_dot:
++ printf ("/before_dot");
++ break;
++
++ case at_dot:
++ printf ("/at_dot");
++ break;
++
++ case after_dot:
++ printf ("/after_dot");
++ break;
++
++ case syntaxspec:
++ printf ("/syntaxspec");
++ mcnt = *p++;
++ printf ("/%d", mcnt);
++ break;
++
++ case notsyntaxspec:
++ printf ("/notsyntaxspec");
++ mcnt = *p++;
++ printf ("/%d", mcnt);
++ break;
++# endif /* emacs */
++
++ case wordchar:
++ printf ("/wordchar");
++ break;
++
++ case notwordchar:
++ printf ("/notwordchar");
++ break;
++
++ case begbuf:
++ printf ("/begbuf");
++ break;
++
++ case endbuf:
++ printf ("/endbuf");
++ break;
++
++ default:
++ printf ("?%ld", (long int) *(p-1));
++ }
++
++ putchar ('\n');
++ }
++
++# ifdef _LIBC
++ printf ("%td:\tend of pattern.\n", p - start);
++# else
++ printf ("%ld:\tend of pattern.\n", (long int) (p - start));
++# endif
++}
++
++
++void
++PREFIX(print_compiled_pattern) (struct re_pattern_buffer *bufp)
++{
++ UCHAR_T *buffer = (UCHAR_T*) bufp->buffer;
++
++ PREFIX(print_partial_compiled_pattern) (buffer, buffer
++ + bufp->used / sizeof(UCHAR_T));
++ printf ("%ld bytes used/%ld bytes allocated.\n",
++ bufp->used, bufp->allocated);
++
++ if (bufp->fastmap_accurate && bufp->fastmap)
++ {
++ printf ("fastmap: ");
++ print_fastmap (bufp->fastmap);
++ }
++
++# ifdef _LIBC
++ printf ("re_nsub: %Zd\t", bufp->re_nsub);
++# else
++ printf ("re_nsub: %ld\t", (long int) bufp->re_nsub);
++# endif
++ printf ("regs_alloc: %d\t", bufp->regs_allocated);
++ printf ("can_be_null: %d\t", bufp->can_be_null);
++ printf ("newline_anchor: %d\n", bufp->newline_anchor);
++ printf ("no_sub: %d\t", bufp->no_sub);
++ printf ("not_bol: %d\t", bufp->not_bol);
++ printf ("not_eol: %d\t", bufp->not_eol);
++ printf ("syntax: %lx\n", bufp->syntax);
++ /* Perhaps we should print the translate table? */
++}
++
++
++void
++PREFIX(print_double_string) (const CHAR_T *where, const CHAR_T *string1,
++ int size1, const CHAR_T *string2, int size2)
++{
++ int this_char;
++
++ if (where == NULL)
++ printf ("(null)");
++ else
++ {
++ int cnt;
++
++ if (FIRST_STRING_P (where))
++ {
++ for (this_char = where - string1; this_char < size1; this_char++)
++ PUT_CHAR (string1[this_char]);
++
++ where = string2;
++ }
++
++ cnt = 0;
++ for (this_char = where - string2; this_char < size2; this_char++)
++ {
++ PUT_CHAR (string2[this_char]);
++ if (++cnt > 100)
++ {
++ fputs ("...", stdout);
++ break;
++ }
++ }
++ }
++}
++
++# ifndef DEFINED_ONCE
++void
++printchar (int c)
++{
++ putc (c, stderr);
++}
++# endif
++
++# else /* not DEBUG */
++
++# ifndef DEFINED_ONCE
++# undef assert
++# define assert(e)
++
++# define DEBUG_STATEMENT(e)
++# define DEBUG_PRINT1(x)
++# define DEBUG_PRINT2(x1, x2)
++# define DEBUG_PRINT3(x1, x2, x3)
++# define DEBUG_PRINT4(x1, x2, x3, x4)
++# endif /* not DEFINED_ONCE */
++# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e)
++# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)
++
++# endif /* not DEBUG */
++
++
++
++# ifdef WCHAR
++/* This convert a multibyte string to a wide character string.
++ And write their correspondances to offset_buffer(see below)
++ and write whether each wchar_t is binary data to is_binary.
++ This assume invalid multibyte sequences as binary data.
++ We assume offset_buffer and is_binary is already allocated
++ enough space. */
++
++static size_t convert_mbs_to_wcs (CHAR_T *dest, const unsigned char* src,
++ size_t len, int *offset_buffer,
++ char *is_binary);
++static size_t
++convert_mbs_to_wcs (CHAR_T *dest, const unsigned char*src, size_t len,
++ int *offset_buffer, char *is_binary)
++ /* It hold correspondances between src(char string) and
++ dest(wchar_t string) for optimization.
++ e.g. src = "xxxyzz"
++ dest = {'X', 'Y', 'Z'}
++ (each "xxx", "y" and "zz" represent one multibyte character
++ corresponding to 'X', 'Y' and 'Z'.)
++ offset_buffer = {0, 0+3("xxx"), 0+3+1("y"), 0+3+1+2("zz")}
++ = {0, 3, 4, 6}
++ */
++{
++ wchar_t *pdest = dest;
++ const unsigned char *psrc = src;
++ size_t wc_count = 0;
++
++ mbstate_t mbs;
++ int i, consumed;
++ size_t mb_remain = len;
++ size_t mb_count = 0;
++
++ /* Initialize the conversion state. */
++ memset (&mbs, 0, sizeof (mbstate_t));
++
++ offset_buffer[0] = 0;
++ for( ; mb_remain > 0 ; ++wc_count, ++pdest, mb_remain -= consumed,
++ psrc += consumed)
++ {
++#ifdef _LIBC
++ consumed = __mbrtowc (pdest, psrc, mb_remain, &mbs);
++#else
++ consumed = mbrtowc (pdest, psrc, mb_remain, &mbs);
++#endif
++
++ if (consumed <= 0)
++ /* failed to convert. maybe src contains binary data.
++ So we consume 1 byte manualy. */
++ {
++ *pdest = *psrc;
++ consumed = 1;
++ is_binary[wc_count] = TRUE;
++ }
++ else
++ is_binary[wc_count] = FALSE;
++ /* In sjis encoding, we use yen sign as escape character in
++ place of reverse solidus. So we convert 0x5c(yen sign in
++ sjis) to not 0xa5(yen sign in UCS2) but 0x5c(reverse
++ solidus in UCS2). */
++ if (consumed == 1 && (int) *psrc == 0x5c && (int) *pdest == 0xa5)
++ *pdest = (wchar_t) *psrc;
++
++ offset_buffer[wc_count + 1] = mb_count += consumed;
++ }
++
++ /* Fill remain of the buffer with sentinel. */
++ for (i = wc_count + 1 ; i <= len ; i++)
++ offset_buffer[i] = mb_count + 1;
++
++ return wc_count;
++}
++
++# endif /* WCHAR */
++
++#else /* not INSIDE_RECURSION */
++
++/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can
++ also be assigned to arbitrarily: each pattern buffer stores its own
++ syntax, so it can be changed between regex compilations. */
++/* This has no initializer because initialized variables in Emacs
++ become read-only after dumping. */
++reg_syntax_t re_syntax_options;
++
++
++/* Specify the precise syntax of regexps for compilation. This provides
++ for compatibility for various utilities which historically have
++ different, incompatible syntaxes.
++
++ The argument SYNTAX is a bit mask comprised of the various bits
++ defined in regex.h. We return the old syntax. */
++
++reg_syntax_t
++re_set_syntax (reg_syntax_t syntax)
++{
++ reg_syntax_t ret = re_syntax_options;
++
++ re_syntax_options = syntax;
++# ifdef DEBUG
++ if (syntax & RE_DEBUG)
++ debug = 1;
++ else if (debug) /* was on but now is not */
++ debug = 0;
++# endif /* DEBUG */
++ return ret;
++}
++# ifdef _LIBC
++weak_alias (__re_set_syntax, re_set_syntax)
++# endif
++
++/* This table gives an error message for each of the error codes listed
++ in regex.h. Obviously the order here has to be same as there.
++ POSIX doesn't require that we do anything for REG_NOERROR,
++ but why not be nice? */
++
++static const char *re_error_msgid[] =
++ {
++ gettext_noop ("Success"), /* REG_NOERROR */
++ gettext_noop ("No match"), /* REG_NOMATCH */
++ gettext_noop ("Invalid regular expression"), /* REG_BADPAT */
++ gettext_noop ("Invalid collation character"), /* REG_ECOLLATE */
++ gettext_noop ("Invalid character class name"), /* REG_ECTYPE */
++ gettext_noop ("Trailing backslash"), /* REG_EESCAPE */
++ gettext_noop ("Invalid back reference"), /* REG_ESUBREG */
++ gettext_noop ("Unmatched [ or [^"), /* REG_EBRACK */
++ gettext_noop ("Unmatched ( or \\("), /* REG_EPAREN */
++ gettext_noop ("Unmatched \\{"), /* REG_EBRACE */
++ gettext_noop ("Invalid content of \\{\\}"), /* REG_BADBR */
++ gettext_noop ("Invalid range end"), /* REG_ERANGE */
++ gettext_noop ("Memory exhausted"), /* REG_ESPACE */
++ gettext_noop ("Invalid preceding regular expression"), /* REG_BADRPT */
++ gettext_noop ("Premature end of regular expression"), /* REG_EEND */
++ gettext_noop ("Regular expression too big"), /* REG_ESIZE */
++ gettext_noop ("Unmatched ) or \\)") /* REG_ERPAREN */
++ };
++
++#endif /* INSIDE_RECURSION */
++
++#ifndef DEFINED_ONCE
++/* Avoiding alloca during matching, to placate r_alloc. */
++
++/* Define MATCH_MAY_ALLOCATE unless we need to make sure that the
++ searching and matching functions should not call alloca. On some
++ systems, alloca is implemented in terms of malloc, and if we're
++ using the relocating allocator routines, then malloc could cause a
++ relocation, which might (if the strings being searched are in the
++ ralloc heap) shift the data out from underneath the regexp
++ routines.
++
++ Here's another reason to avoid allocation: Emacs
++ processes input from X in a signal handler; processing X input may
++ call malloc; if input arrives while a matching routine is calling
++ malloc, then we're scrod. But Emacs can't just block input while
++ calling matching routines; then we don't notice interrupts when
++ they come in. So, Emacs blocks input around all regexp calls
++ except the matching calls, which it leaves unprotected, in the
++ faith that they will not malloc. */
++
++/* Normally, this is fine. */
++# define MATCH_MAY_ALLOCATE
++
++/* When using GNU C, we are not REALLY using the C alloca, no matter
++ what config.h may say. So don't take precautions for it. */
++# ifdef __GNUC__
++# undef C_ALLOCA
++# endif
++
++/* The match routines may not allocate if (1) they would do it with malloc
++ and (2) it's not safe for them to use malloc.
++ Note that if REL_ALLOC is defined, matching would not use malloc for the
++ failure stack, but we would still use it for the register vectors;
++ so REL_ALLOC should not affect this. */
++# if (defined C_ALLOCA || defined REGEX_MALLOC) && defined emacs
++# undef MATCH_MAY_ALLOCATE
++# endif
++#endif /* not DEFINED_ONCE */
++
++#ifdef INSIDE_RECURSION
++/* Failure stack declarations and macros; both re_compile_fastmap and
++ re_match_2 use a failure stack. These have to be macros because of
++ REGEX_ALLOCATE_STACK. */
++
++
++/* Number of failure points for which to initially allocate space
++ when matching. If this number is exceeded, we allocate more
++ space, so it is not a hard limit. */
++# ifndef INIT_FAILURE_ALLOC
++# define INIT_FAILURE_ALLOC 5
++# endif
++
++/* Roughly the maximum number of failure points on the stack. Would be
++ exactly that if always used MAX_FAILURE_ITEMS items each time we failed.
++ This is a variable only so users of regex can assign to it; we never
++ change it ourselves. */
++
++
++# ifndef DEFINED_ONCE
++
++# ifdef INT_IS_16BIT
++# define RE_M_F_TYPE long int
++# else
++# define RE_M_F_TYPE int
++# endif /* INT_IS_16BIT */
++
++# ifdef MATCH_MAY_ALLOCATE
++/* 4400 was enough to cause a crash on Alpha OSF/1,
++ whose default stack limit is 2mb. */
++# define RE_M_F_DEFAULT 4000
++# else
++# define RE_M_F_DEFAULT 2000
++# endif /* MATCH_MAY_ALLOCATE */
++
++# include <shlib-compat.h>
++
++# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
++link_warning (re_max_failures, "the 're_max_failures' variable is obsolete and will go away.")
++RE_M_F_TYPE re_max_failures = RE_M_F_DEFAULT;
++# else
++RE_M_F_TYPE re_max_failures attribute_hidden = RE_M_F_DEFAULT;
++# endif /* SHLIB_COMPAT */
++
++# undef RE_M_F_TYPE
++# undef RE_M_F_DEFAULT
++
++# endif /* DEFINED_ONCE */
++
++# ifdef INT_IS_16BIT
++
++union PREFIX(fail_stack_elt)
++{
++ UCHAR_T *pointer;
++ long int integer;
++};
++
++typedef union PREFIX(fail_stack_elt) PREFIX(fail_stack_elt_t);
++
++typedef struct
++{
++ PREFIX(fail_stack_elt_t) *stack;
++ unsigned long int size;
++ unsigned long int avail; /* Offset of next open position. */
++} PREFIX(fail_stack_type);
++
++# else /* not INT_IS_16BIT */
++
++union PREFIX(fail_stack_elt)
++{
++ UCHAR_T *pointer;
++ int integer;
++};
++
++typedef union PREFIX(fail_stack_elt) PREFIX(fail_stack_elt_t);
++
++typedef struct
++{
++ PREFIX(fail_stack_elt_t) *stack;
++ unsigned size;
++ unsigned avail; /* Offset of next open position. */
++} PREFIX(fail_stack_type);
++
++# endif /* INT_IS_16BIT */
++
++# ifndef DEFINED_ONCE
++# define FAIL_STACK_EMPTY() (fail_stack.avail == 0)
++# define FAIL_STACK_PTR_EMPTY() (fail_stack_ptr->avail == 0)
++# define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size)
++# endif
++
++
++/* Define macros to initialize and free the failure stack.
++ Do `return -2' if the alloc fails. */
++
++# ifdef MATCH_MAY_ALLOCATE
++# define INIT_FAIL_STACK() \
++ do { \
++ fail_stack.stack = (PREFIX(fail_stack_elt_t) *) \
++ REGEX_ALLOCATE_STACK (INIT_FAILURE_ALLOC * sizeof (PREFIX(fail_stack_elt_t))); \
++ \
++ if (fail_stack.stack == NULL) \
++ return -2; \
++ \
++ fail_stack.size = INIT_FAILURE_ALLOC; \
++ fail_stack.avail = 0; \
++ } while (0)
++
++# define RESET_FAIL_STACK() REGEX_FREE_STACK (fail_stack.stack)
++# else
++# define INIT_FAIL_STACK() \
++ do { \
++ fail_stack.avail = 0; \
++ } while (0)
++
++# define RESET_FAIL_STACK()
++# endif
++
++
++/* Double the size of FAIL_STACK, up to approximately `re_max_failures' items.
++
++ Return 1 if succeeds, and 0 if either ran out of memory
++ allocating space for it or it was already too large.
++
++ REGEX_REALLOCATE_STACK requires `destination' be declared. */
++
++# define DOUBLE_FAIL_STACK(fail_stack) \
++ ((fail_stack).size > (unsigned) (re_max_failures * MAX_FAILURE_ITEMS) \
++ ? 0 \
++ : ((fail_stack).stack = (PREFIX(fail_stack_elt_t) *) \
++ REGEX_REALLOCATE_STACK ((fail_stack).stack, \
++ (fail_stack).size * sizeof (PREFIX(fail_stack_elt_t)), \
++ ((fail_stack).size << 1) * sizeof (PREFIX(fail_stack_elt_t))),\
++ \
++ (fail_stack).stack == NULL \
++ ? 0 \
++ : ((fail_stack).size <<= 1, \
++ 1)))
++
++
++/* Push pointer POINTER on FAIL_STACK.
++ Return 1 if was able to do so and 0 if ran out of memory allocating
++ space to do so. */
++# define PUSH_PATTERN_OP(POINTER, FAIL_STACK) \
++ ((FAIL_STACK_FULL () \
++ && !DOUBLE_FAIL_STACK (FAIL_STACK)) \
++ ? 0 \
++ : ((FAIL_STACK).stack[(FAIL_STACK).avail++].pointer = POINTER, \
++ 1))
++
++/* Push a pointer value onto the failure stack.
++ Assumes the variable `fail_stack'. Probably should only
++ be called from within `PUSH_FAILURE_POINT'. */
++# define PUSH_FAILURE_POINTER(item) \
++ fail_stack.stack[fail_stack.avail++].pointer = (UCHAR_T *) (item)
++
++/* This pushes an integer-valued item onto the failure stack.
++ Assumes the variable `fail_stack'. Probably should only
++ be called from within `PUSH_FAILURE_POINT'. */
++# define PUSH_FAILURE_INT(item) \
++ fail_stack.stack[fail_stack.avail++].integer = (item)
++
++/* Push a fail_stack_elt_t value onto the failure stack.
++ Assumes the variable `fail_stack'. Probably should only
++ be called from within `PUSH_FAILURE_POINT'. */
++# define PUSH_FAILURE_ELT(item) \
++ fail_stack.stack[fail_stack.avail++] = (item)
++
++/* These three POP... operations complement the three PUSH... operations.
++ All assume that `fail_stack' is nonempty. */
++# define POP_FAILURE_POINTER() fail_stack.stack[--fail_stack.avail].pointer
++# define POP_FAILURE_INT() fail_stack.stack[--fail_stack.avail].integer
++# define POP_FAILURE_ELT() fail_stack.stack[--fail_stack.avail]
++
++/* Used to omit pushing failure point id's when we're not debugging. */
++# ifdef DEBUG
++# define DEBUG_PUSH PUSH_FAILURE_INT
++# define DEBUG_POP(item_addr) *(item_addr) = POP_FAILURE_INT ()
++# else
++# define DEBUG_PUSH(item)
++# define DEBUG_POP(item_addr)
++# endif
++
++
++/* Push the information about the state we will need
++ if we ever fail back to it.
++
++ Requires variables fail_stack, regstart, regend, reg_info, and
++ num_regs_pushed be declared. DOUBLE_FAIL_STACK requires `destination'
++ be declared.
++
++ Does `return FAILURE_CODE' if runs out of memory. */
++
++# define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \
++ do { \
++ char *destination; \
++ /* Must be int, so when we don't save any registers, the arithmetic \
++ of 0 + -1 isn't done as unsigned. */ \
++ /* Can't be int, since there is not a shred of a guarantee that int \
++ is wide enough to hold a value of something to which pointer can \
++ be assigned */ \
++ active_reg_t this_reg; \
++ \
++ DEBUG_STATEMENT (failure_id++); \
++ DEBUG_STATEMENT (nfailure_points_pushed++); \
++ DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \
++ DEBUG_PRINT2 (" Before push, next avail: %d\n", (fail_stack).avail);\
++ DEBUG_PRINT2 (" size: %d\n", (fail_stack).size);\
++ \
++ DEBUG_PRINT2 (" slots needed: %ld\n", NUM_FAILURE_ITEMS); \
++ DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \
++ \
++ /* Ensure we have enough space allocated for what we will push. */ \
++ while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \
++ { \
++ if (!DOUBLE_FAIL_STACK (fail_stack)) \
++ return failure_code; \
++ \
++ DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \
++ (fail_stack).size); \
++ DEBUG_PRINT2 (" slots available: %d\n", REMAINING_AVAIL_SLOTS);\
++ } \
++ \
++ /* Push the info, starting with the registers. */ \
++ DEBUG_PRINT1 ("\n"); \
++ \
++ if (1) \
++ for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \
++ this_reg++) \
++ { \
++ DEBUG_PRINT2 (" Pushing reg: %lu\n", this_reg); \
++ DEBUG_STATEMENT (num_regs_pushed++); \
++ \
++ DEBUG_PRINT2 (" start: %p\n", regstart[this_reg]); \
++ PUSH_FAILURE_POINTER (regstart[this_reg]); \
++ \
++ DEBUG_PRINT2 (" end: %p\n", regend[this_reg]); \
++ PUSH_FAILURE_POINTER (regend[this_reg]); \
++ \
++ DEBUG_PRINT2 (" info: %p\n ", \
++ reg_info[this_reg].word.pointer); \
++ DEBUG_PRINT2 (" match_null=%d", \
++ REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \
++ DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \
++ DEBUG_PRINT2 (" matched_something=%d", \
++ MATCHED_SOMETHING (reg_info[this_reg])); \
++ DEBUG_PRINT2 (" ever_matched=%d", \
++ EVER_MATCHED_SOMETHING (reg_info[this_reg])); \
++ DEBUG_PRINT1 ("\n"); \
++ PUSH_FAILURE_ELT (reg_info[this_reg].word); \
++ } \
++ \
++ DEBUG_PRINT2 (" Pushing low active reg: %ld\n", lowest_active_reg);\
++ PUSH_FAILURE_INT (lowest_active_reg); \
++ \
++ DEBUG_PRINT2 (" Pushing high active reg: %ld\n", highest_active_reg);\
++ PUSH_FAILURE_INT (highest_active_reg); \
++ \
++ DEBUG_PRINT2 (" Pushing pattern %p:\n", pattern_place); \
++ DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \
++ PUSH_FAILURE_POINTER (pattern_place); \
++ \
++ DEBUG_PRINT2 (" Pushing string %p: `", string_place); \
++ DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \
++ size2); \
++ DEBUG_PRINT1 ("'\n"); \
++ PUSH_FAILURE_POINTER (string_place); \
++ \
++ DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \
++ DEBUG_PUSH (failure_id); \
++ } while (0)
++
++# ifndef DEFINED_ONCE
++/* This is the number of items that are pushed and popped on the stack
++ for each register. */
++# define NUM_REG_ITEMS 3
++
++/* Individual items aside from the registers. */
++# ifdef DEBUG
++# define NUM_NONREG_ITEMS 5 /* Includes failure point id. */
++# else
++# define NUM_NONREG_ITEMS 4
++# endif
++
++/* We push at most this many items on the stack. */
++/* We used to use (num_regs - 1), which is the number of registers
++ this regexp will save; but that was changed to 5
++ to avoid stack overflow for a regexp with lots of parens. */
++# define MAX_FAILURE_ITEMS (5 * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
++
++/* We actually push this many items. */
++# define NUM_FAILURE_ITEMS \
++ (((0 \
++ ? 0 : highest_active_reg - lowest_active_reg + 1) \
++ * NUM_REG_ITEMS) \
++ + NUM_NONREG_ITEMS)
++
++/* How many items can still be added to the stack without overflowing it. */
++# define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail)
++# endif /* not DEFINED_ONCE */
++
++
++/* Pops what PUSH_FAIL_STACK pushes.
++
++ We restore into the parameters, all of which should be lvalues:
++ STR -- the saved data position.
++ PAT -- the saved pattern position.
++ LOW_REG, HIGH_REG -- the highest and lowest active registers.
++ REGSTART, REGEND -- arrays of string positions.
++ REG_INFO -- array of information about each subexpression.
++
++ Also assumes the variables `fail_stack' and (if debugging), `bufp',
++ `pend', `string1', `size1', `string2', and `size2'. */
++# define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\
++{ \
++ DEBUG_STATEMENT (unsigned failure_id;) \
++ active_reg_t this_reg; \
++ const UCHAR_T *string_temp; \
++ \
++ assert (!FAIL_STACK_EMPTY ()); \
++ \
++ /* Remove failure points and point to how many regs pushed. */ \
++ DEBUG_PRINT1 ("POP_FAILURE_POINT:\n"); \
++ DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \
++ DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \
++ \
++ assert (fail_stack.avail >= NUM_NONREG_ITEMS); \
++ \
++ DEBUG_POP (&failure_id); \
++ DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \
++ \
++ /* If the saved string location is NULL, it came from an \
++ on_failure_keep_string_jump opcode, and we want to throw away the \
++ saved NULL, thus retaining our current position in the string. */ \
++ string_temp = POP_FAILURE_POINTER (); \
++ if (string_temp != NULL) \
++ str = (const CHAR_T *) string_temp; \
++ \
++ DEBUG_PRINT2 (" Popping string %p: `", str); \
++ DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \
++ DEBUG_PRINT1 ("'\n"); \
++ \
++ pat = (UCHAR_T *) POP_FAILURE_POINTER (); \
++ DEBUG_PRINT2 (" Popping pattern %p:\n", pat); \
++ DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \
++ \
++ /* Restore register info. */ \
++ high_reg = (active_reg_t) POP_FAILURE_INT (); \
++ DEBUG_PRINT2 (" Popping high active reg: %ld\n", high_reg); \
++ \
++ low_reg = (active_reg_t) POP_FAILURE_INT (); \
++ DEBUG_PRINT2 (" Popping low active reg: %ld\n", low_reg); \
++ \
++ if (1) \
++ for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \
++ { \
++ DEBUG_PRINT2 (" Popping reg: %ld\n", this_reg); \
++ \
++ reg_info[this_reg].word = POP_FAILURE_ELT (); \
++ DEBUG_PRINT2 (" info: %p\n", \
++ reg_info[this_reg].word.pointer); \
++ \
++ regend[this_reg] = (const CHAR_T *) POP_FAILURE_POINTER (); \
++ DEBUG_PRINT2 (" end: %p\n", regend[this_reg]); \
++ \
++ regstart[this_reg] = (const CHAR_T *) POP_FAILURE_POINTER (); \
++ DEBUG_PRINT2 (" start: %p\n", regstart[this_reg]); \
++ } \
++ else \
++ { \
++ for (this_reg = highest_active_reg; this_reg > high_reg; this_reg--) \
++ { \
++ reg_info[this_reg].word.integer = 0; \
++ regend[this_reg] = 0; \
++ regstart[this_reg] = 0; \
++ } \
++ highest_active_reg = high_reg; \
++ } \
++ \
++ set_regs_matched_done = 0; \
++ DEBUG_STATEMENT (nfailure_points_popped++); \
++} /* POP_FAILURE_POINT */
++
++/* Structure for per-register (a.k.a. per-group) information.
++ Other register information, such as the
++ starting and ending positions (which are addresses), and the list of
++ inner groups (which is a bits list) are maintained in separate
++ variables.
++
++ We are making a (strictly speaking) nonportable assumption here: that
++ the compiler will pack our bit fields into something that fits into
++ the type of `word', i.e., is something that fits into one item on the
++ failure stack. */
++
++
++/* Declarations and macros for re_match_2. */
++
++typedef union
++{
++ PREFIX(fail_stack_elt_t) word;
++ struct
++ {
++ /* This field is one if this group can match the empty string,
++ zero if not. If not yet determined, `MATCH_NULL_UNSET_VALUE'. */
++# define MATCH_NULL_UNSET_VALUE 3
++ unsigned match_null_string_p : 2;
++ unsigned is_active : 1;
++ unsigned matched_something : 1;
++ unsigned ever_matched_something : 1;
++ } bits;
++} PREFIX(register_info_type);
++
++# ifndef DEFINED_ONCE
++# define REG_MATCH_NULL_STRING_P(R) ((R).bits.match_null_string_p)
++# define IS_ACTIVE(R) ((R).bits.is_active)
++# define MATCHED_SOMETHING(R) ((R).bits.matched_something)
++# define EVER_MATCHED_SOMETHING(R) ((R).bits.ever_matched_something)
++
++
++/* Call this when have matched a real character; it sets `matched' flags
++ for the subexpressions which we are currently inside. Also records
++ that those subexprs have matched. */
++# define SET_REGS_MATCHED() \
++ do \
++ { \
++ if (!set_regs_matched_done) \
++ { \
++ active_reg_t r; \
++ set_regs_matched_done = 1; \
++ for (r = lowest_active_reg; r <= highest_active_reg; r++) \
++ { \
++ MATCHED_SOMETHING (reg_info[r]) \
++ = EVER_MATCHED_SOMETHING (reg_info[r]) \
++ = 1; \
++ } \
++ } \
++ } \
++ while (0)
++# endif /* not DEFINED_ONCE */
++
++/* Registers are set to a sentinel when they haven't yet matched. */
++static CHAR_T PREFIX(reg_unset_dummy);
++# define REG_UNSET_VALUE (&PREFIX(reg_unset_dummy))
++# define REG_UNSET(e) ((e) == REG_UNSET_VALUE)
++
++/* Subroutine declarations and macros for regex_compile. */
++static void PREFIX(store_op1) (re_opcode_t op, UCHAR_T *loc, int arg);
++static void PREFIX(store_op2) (re_opcode_t op, UCHAR_T *loc,
++ int arg1, int arg2);
++static void PREFIX(insert_op1) (re_opcode_t op, UCHAR_T *loc,
++ int arg, UCHAR_T *end);
++static void PREFIX(insert_op2) (re_opcode_t op, UCHAR_T *loc,
++ int arg1, int arg2, UCHAR_T *end);
++static boolean PREFIX(at_begline_loc_p) (const CHAR_T *pattern,
++ const CHAR_T *p,
++ reg_syntax_t syntax);
++static boolean PREFIX(at_endline_loc_p) (const CHAR_T *p,
++ const CHAR_T *pend,
++ reg_syntax_t syntax);
++# ifdef WCHAR
++static reg_errcode_t wcs_compile_range (CHAR_T range_start,
++ const CHAR_T **p_ptr,
++ const CHAR_T *pend,
++ char *translate,
++ reg_syntax_t syntax,
++ UCHAR_T *b,
++ CHAR_T *char_set);
++static void insert_space (int num, CHAR_T *loc, CHAR_T *end);
++# else /* BYTE */
++static reg_errcode_t byte_compile_range (unsigned int range_start,
++ const char **p_ptr,
++ const char *pend,
++ RE_TRANSLATE_TYPE translate,
++ reg_syntax_t syntax,
++ unsigned char *b);
++# endif /* WCHAR */
++
++/* Fetch the next character in the uncompiled pattern---translating it
++ if necessary. Also cast from a signed character in the constant
++ string passed to us by the user to an unsigned char that we can use
++ as an array index (in, e.g., `translate'). */
++/* ifdef MBS_SUPPORT, we translate only if character <= 0xff,
++ because it is impossible to allocate 4GB array for some encodings
++ which have 4 byte character_set like UCS4. */
++# ifndef PATFETCH
++# ifdef WCHAR
++# define PATFETCH(c) \
++ do {if (p == pend) return REG_EEND; \
++ c = (UCHAR_T) *p++; \
++ if (translate && (c <= 0xff)) c = (UCHAR_T) translate[c]; \
++ } while (0)
++# else /* BYTE */
++# define PATFETCH(c) \
++ do {if (p == pend) return REG_EEND; \
++ c = (unsigned char) *p++; \
++ if (translate) c = (unsigned char) translate[c]; \
++ } while (0)
++# endif /* WCHAR */
++# endif
++
++/* Fetch the next character in the uncompiled pattern, with no
++ translation. */
++# define PATFETCH_RAW(c) \
++ do {if (p == pend) return REG_EEND; \
++ c = (UCHAR_T) *p++; \
++ } while (0)
++
++/* Go backwards one character in the pattern. */
++# define PATUNFETCH p--
++
++
++/* If `translate' is non-null, return translate[D], else just D. We
++ cast the subscript to translate because some data is declared as
++ `char *', to avoid warnings when a string constant is passed. But
++ when we use a character as a subscript we must make it unsigned. */
++/* ifdef MBS_SUPPORT, we translate only if character <= 0xff,
++ because it is impossible to allocate 4GB array for some encodings
++ which have 4 byte character_set like UCS4. */
++
++# ifndef TRANSLATE
++# ifdef WCHAR
++# define TRANSLATE(d) \
++ ((translate && ((UCHAR_T) (d)) <= 0xff) \
++ ? (char) translate[(unsigned char) (d)] : (d))
++# else /* BYTE */
++# define TRANSLATE(d) \
++ (translate ? (char) translate[(unsigned char) (d)] : (char) (d))
++# endif /* WCHAR */
++# endif
++
++
++/* Macros for outputting the compiled pattern into `buffer'. */
++
++/* If the buffer isn't allocated when it comes in, use this. */
++# define INIT_BUF_SIZE (32 * sizeof(UCHAR_T))
++
++/* Make sure we have at least N more bytes of space in buffer. */
++# ifdef WCHAR
++# define GET_BUFFER_SPACE(n) \
++ while (((unsigned long)b - (unsigned long)COMPILED_BUFFER_VAR \
++ + (n)*sizeof(CHAR_T)) > bufp->allocated) \
++ EXTEND_BUFFER ()
++# else /* BYTE */
++# define GET_BUFFER_SPACE(n) \
++ while ((unsigned long) (b - bufp->buffer + (n)) > bufp->allocated) \
++ EXTEND_BUFFER ()
++# endif /* WCHAR */
++
++/* Make sure we have one more byte of buffer space and then add C to it. */
++# define BUF_PUSH(c) \
++ do { \
++ GET_BUFFER_SPACE (1); \
++ *b++ = (UCHAR_T) (c); \
++ } while (0)
++
++
++/* Ensure we have two more bytes of buffer space and then append C1 and C2. */
++# define BUF_PUSH_2(c1, c2) \
++ do { \
++ GET_BUFFER_SPACE (2); \
++ *b++ = (UCHAR_T) (c1); \
++ *b++ = (UCHAR_T) (c2); \
++ } while (0)
++
++
++/* As with BUF_PUSH_2, except for three bytes. */
++# define BUF_PUSH_3(c1, c2, c3) \
++ do { \
++ GET_BUFFER_SPACE (3); \
++ *b++ = (UCHAR_T) (c1); \
++ *b++ = (UCHAR_T) (c2); \
++ *b++ = (UCHAR_T) (c3); \
++ } while (0)
++
++/* Store a jump with opcode OP at LOC to location TO. We store a
++ relative address offset by the three bytes the jump itself occupies. */
++# define STORE_JUMP(op, loc, to) \
++ PREFIX(store_op1) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)))
++
++/* Likewise, for a two-argument jump. */
++# define STORE_JUMP2(op, loc, to, arg) \
++ PREFIX(store_op2) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)), arg)
++
++/* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */
++# define INSERT_JUMP(op, loc, to) \
++ PREFIX(insert_op1) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)), b)
++
++/* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */
++# define INSERT_JUMP2(op, loc, to, arg) \
++ PREFIX(insert_op2) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)),\
++ arg, b)
++
++/* This is not an arbitrary limit: the arguments which represent offsets
++ into the pattern are two bytes long. So if 2^16 bytes turns out to
++ be too small, many things would have to change. */
++/* Any other compiler which, like MSC, has allocation limit below 2^16
++ bytes will have to use approach similar to what was done below for
++ MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up
++ reallocating to 0 bytes. Such thing is not going to work too well.
++ You have been warned!! */
++# ifndef DEFINED_ONCE
++# if defined _MSC_VER && !defined WIN32
++/* Microsoft C 16-bit versions limit malloc to approx 65512 bytes.
++ The REALLOC define eliminates a flurry of conversion warnings,
++ but is not required. */
++# define MAX_BUF_SIZE 65500L
++# define REALLOC(p,s) realloc ((p), (size_t) (s))
++# else
++# define MAX_BUF_SIZE (1L << 16)
++# define REALLOC(p,s) realloc ((p), (s))
++# endif
++
++/* Extend the buffer by twice its current size via realloc and
++ reset the pointers that pointed into the old block to point to the
++ correct places in the new one. If extending the buffer results in it
++ being larger than MAX_BUF_SIZE, then flag memory exhausted. */
++# ifndef __BOUNDED_POINTERS__
++# define __BOUNDED_POINTERS__ 0
++# endif
++# if __BOUNDED_POINTERS__
++# define SET_HIGH_BOUND(P) (__ptrhigh (P) = __ptrlow (P) + bufp->allocated)
++# define MOVE_BUFFER_POINTER(P) \
++ (__ptrlow (P) += incr, SET_HIGH_BOUND (P), __ptrvalue (P) += incr)
++# define ELSE_EXTEND_BUFFER_HIGH_BOUND \
++ else \
++ { \
++ SET_HIGH_BOUND (b); \
++ SET_HIGH_BOUND (begalt); \
++ if (fixup_alt_jump) \
++ SET_HIGH_BOUND (fixup_alt_jump); \
++ if (laststart) \
++ SET_HIGH_BOUND (laststart); \
++ if (pending_exact) \
++ SET_HIGH_BOUND (pending_exact); \
++ }
++# else
++# define MOVE_BUFFER_POINTER(P) (P) += incr
++# define ELSE_EXTEND_BUFFER_HIGH_BOUND
++# endif
++# endif /* not DEFINED_ONCE */
++
++# ifdef WCHAR
++# define EXTEND_BUFFER() \
++ do { \
++ UCHAR_T *old_buffer = COMPILED_BUFFER_VAR; \
++ int wchar_count; \
++ if (bufp->allocated + sizeof(UCHAR_T) > MAX_BUF_SIZE) \
++ return REG_ESIZE; \
++ bufp->allocated <<= 1; \
++ if (bufp->allocated > MAX_BUF_SIZE) \
++ bufp->allocated = MAX_BUF_SIZE; \
++ /* How many characters the new buffer can have? */ \
++ wchar_count = bufp->allocated / sizeof(UCHAR_T); \
++ if (wchar_count == 0) wchar_count = 1; \
++ /* Truncate the buffer to CHAR_T align. */ \
++ bufp->allocated = wchar_count * sizeof(UCHAR_T); \
++ RETALLOC (COMPILED_BUFFER_VAR, wchar_count, UCHAR_T); \
++ bufp->buffer = (char*)COMPILED_BUFFER_VAR; \
++ if (COMPILED_BUFFER_VAR == NULL) \
++ return REG_ESPACE; \
++ /* If the buffer moved, move all the pointers into it. */ \
++ if (old_buffer != COMPILED_BUFFER_VAR) \
++ { \
++ int incr = COMPILED_BUFFER_VAR - old_buffer; \
++ MOVE_BUFFER_POINTER (b); \
++ MOVE_BUFFER_POINTER (begalt); \
++ if (fixup_alt_jump) \
++ MOVE_BUFFER_POINTER (fixup_alt_jump); \
++ if (laststart) \
++ MOVE_BUFFER_POINTER (laststart); \
++ if (pending_exact) \
++ MOVE_BUFFER_POINTER (pending_exact); \
++ } \
++ ELSE_EXTEND_BUFFER_HIGH_BOUND \
++ } while (0)
++# else /* BYTE */
++# define EXTEND_BUFFER() \
++ do { \
++ UCHAR_T *old_buffer = COMPILED_BUFFER_VAR; \
++ if (bufp->allocated == MAX_BUF_SIZE) \
++ return REG_ESIZE; \
++ bufp->allocated <<= 1; \
++ if (bufp->allocated > MAX_BUF_SIZE) \
++ bufp->allocated = MAX_BUF_SIZE; \
++ bufp->buffer = (UCHAR_T *) REALLOC (COMPILED_BUFFER_VAR, \
++ bufp->allocated); \
++ if (COMPILED_BUFFER_VAR == NULL) \
++ return REG_ESPACE; \
++ /* If the buffer moved, move all the pointers into it. */ \
++ if (old_buffer != COMPILED_BUFFER_VAR) \
++ { \
++ int incr = COMPILED_BUFFER_VAR - old_buffer; \
++ MOVE_BUFFER_POINTER (b); \
++ MOVE_BUFFER_POINTER (begalt); \
++ if (fixup_alt_jump) \
++ MOVE_BUFFER_POINTER (fixup_alt_jump); \
++ if (laststart) \
++ MOVE_BUFFER_POINTER (laststart); \
++ if (pending_exact) \
++ MOVE_BUFFER_POINTER (pending_exact); \
++ } \
++ ELSE_EXTEND_BUFFER_HIGH_BOUND \
++ } while (0)
++# endif /* WCHAR */
++
++# ifndef DEFINED_ONCE
++/* Since we have one byte reserved for the register number argument to
++ {start,stop}_memory, the maximum number of groups we can report
++ things about is what fits in that byte. */
++# define MAX_REGNUM 255
++
++/* But patterns can have more than `MAX_REGNUM' registers. We just
++ ignore the excess. */
++typedef unsigned regnum_t;
++
++
++/* Macros for the compile stack. */
++
++/* Since offsets can go either forwards or backwards, this type needs to
++ be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */
++/* int may be not enough when sizeof(int) == 2. */
++typedef long pattern_offset_t;
++
++typedef struct
++{
++ pattern_offset_t begalt_offset;
++ pattern_offset_t fixup_alt_jump;
++ pattern_offset_t inner_group_offset;
++ pattern_offset_t laststart_offset;
++ regnum_t regnum;
++} compile_stack_elt_t;
++
++
++typedef struct
++{
++ compile_stack_elt_t *stack;
++ unsigned size;
++ unsigned avail; /* Offset of next open position. */
++} compile_stack_type;
++
++
++# define INIT_COMPILE_STACK_SIZE 32
++
++# define COMPILE_STACK_EMPTY (compile_stack.avail == 0)
++# define COMPILE_STACK_FULL (compile_stack.avail == compile_stack.size)
++
++/* The next available element. */
++# define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail])
++
++# endif /* not DEFINED_ONCE */
++
++/* Set the bit for character C in a list. */
++# ifndef DEFINED_ONCE
++# define SET_LIST_BIT(c) \
++ (b[((unsigned char) (c)) / BYTEWIDTH] \
++ |= 1 << (((unsigned char) c) % BYTEWIDTH))
++# endif /* DEFINED_ONCE */
++
++/* Get the next unsigned number in the uncompiled pattern. */
++# define GET_UNSIGNED_NUMBER(num) \
++ { \
++ while (p != pend) \
++ { \
++ PATFETCH (c); \
++ if (c < '0' || c > '9') \
++ break; \
++ if (num <= RE_DUP_MAX) \
++ { \
++ if (num < 0) \
++ num = 0; \
++ num = num * 10 + c - '0'; \
++ } \
++ } \
++ }
++
++# ifndef DEFINED_ONCE
++# if WIDE_CHAR_SUPPORT
++/* The GNU C library provides support for user-defined character classes
++ and the functions from ISO C amendement 1. */
++# ifdef CHARCLASS_NAME_MAX
++# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX
++# else
++/* This shouldn't happen but some implementation might still have this
++ problem. Use a reasonable default value. */
++# define CHAR_CLASS_MAX_LENGTH 256
++# endif
++
++# ifdef _LIBC
++# define IS_CHAR_CLASS(string) __wctype (string)
++# else
++# define IS_CHAR_CLASS(string) wctype (string)
++# endif
++# else
++# define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */
++
++# define IS_CHAR_CLASS(string) \
++ (STREQ (string, "alpha") || STREQ (string, "upper") \
++ || STREQ (string, "lower") || STREQ (string, "digit") \
++ || STREQ (string, "alnum") || STREQ (string, "xdigit") \
++ || STREQ (string, "space") || STREQ (string, "print") \
++ || STREQ (string, "punct") || STREQ (string, "graph") \
++ || STREQ (string, "cntrl") || STREQ (string, "blank"))
++# endif
++# endif /* DEFINED_ONCE */
++
++# ifndef MATCH_MAY_ALLOCATE
++
++/* If we cannot allocate large objects within re_match_2_internal,
++ we make the fail stack and register vectors global.
++ The fail stack, we grow to the maximum size when a regexp
++ is compiled.
++ The register vectors, we adjust in size each time we
++ compile a regexp, according to the number of registers it needs. */
++
++static PREFIX(fail_stack_type) fail_stack;
++
++/* Size with which the following vectors are currently allocated.
++ That is so we can make them bigger as needed,
++ but never make them smaller. */
++# ifdef DEFINED_ONCE
++static int regs_allocated_size;
++
++static const char ** regstart, ** regend;
++static const char ** old_regstart, ** old_regend;
++static const char **best_regstart, **best_regend;
++static const char **reg_dummy;
++# endif /* DEFINED_ONCE */
++
++static PREFIX(register_info_type) *PREFIX(reg_info);
++static PREFIX(register_info_type) *PREFIX(reg_info_dummy);
++
++/* Make the register vectors big enough for NUM_REGS registers,
++ but don't make them smaller. */
++
++static void
++PREFIX(regex_grow_registers) (int num_regs)
++{
++ if (num_regs > regs_allocated_size)
++ {
++ RETALLOC_IF (regstart, num_regs, const char *);
++ RETALLOC_IF (regend, num_regs, const char *);
++ RETALLOC_IF (old_regstart, num_regs, const char *);
++ RETALLOC_IF (old_regend, num_regs, const char *);
++ RETALLOC_IF (best_regstart, num_regs, const char *);
++ RETALLOC_IF (best_regend, num_regs, const char *);
++ RETALLOC_IF (PREFIX(reg_info), num_regs, PREFIX(register_info_type));
++ RETALLOC_IF (reg_dummy, num_regs, const char *);
++ RETALLOC_IF (PREFIX(reg_info_dummy), num_regs, PREFIX(register_info_type));
++
++ regs_allocated_size = num_regs;
++ }
++}
++
++# endif /* not MATCH_MAY_ALLOCATE */
++
++# ifndef DEFINED_ONCE
++static boolean group_in_compile_stack (compile_stack_type compile_stack,
++ regnum_t regnum);
++# endif /* not DEFINED_ONCE */
++
++/* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX.
++ Returns one of error codes defined in `regex.h', or zero for success.
++
++ Assumes the `allocated' (and perhaps `buffer') and `translate'
++ fields are set in BUFP on entry.
++
++ If it succeeds, results are put in BUFP (if it returns an error, the
++ contents of BUFP are undefined):
++ `buffer' is the compiled pattern;
++ `syntax' is set to SYNTAX;
++ `used' is set to the length of the compiled pattern;
++ `fastmap_accurate' is zero;
++ `re_nsub' is the number of subexpressions in PATTERN;
++ `not_bol' and `not_eol' are zero;
++
++ The `fastmap' and `newline_anchor' fields are neither
++ examined nor set. */
++
++/* Return, freeing storage we allocated. */
++# ifdef WCHAR
++# define FREE_STACK_RETURN(value) \
++ return (free(pattern), free(mbs_offset), free(is_binary), free (compile_stack.stack), value)
++# else
++# define FREE_STACK_RETURN(value) \
++ return (free (compile_stack.stack), value)
++# endif /* WCHAR */
++
++static reg_errcode_t
++PREFIX(regex_compile) (const char *ARG_PREFIX(pattern),
++ size_t ARG_PREFIX(size), reg_syntax_t syntax,
++ struct re_pattern_buffer *bufp)
++{
++ /* We fetch characters from PATTERN here. Even though PATTERN is
++ `char *' (i.e., signed), we declare these variables as unsigned, so
++ they can be reliably used as array indices. */
++ register UCHAR_T c, c1;
++
++#ifdef WCHAR
++ /* A temporary space to keep wchar_t pattern and compiled pattern. */
++ CHAR_T *pattern, *COMPILED_BUFFER_VAR;
++ size_t size;
++ /* offset buffer for optimization. See convert_mbs_to_wc. */
++ int *mbs_offset = NULL;
++ /* It hold whether each wchar_t is binary data or not. */
++ char *is_binary = NULL;
++ /* A flag whether exactn is handling binary data or not. */
++ char is_exactn_bin = FALSE;
++#endif /* WCHAR */
++
++ /* A random temporary spot in PATTERN. */
++ const CHAR_T *p1;
++
++ /* Points to the end of the buffer, where we should append. */
++ register UCHAR_T *b;
++
++ /* Keeps track of unclosed groups. */
++ compile_stack_type compile_stack;
++
++ /* Points to the current (ending) position in the pattern. */
++#ifdef WCHAR
++ const CHAR_T *p;
++ const CHAR_T *pend;
++#else /* BYTE */
++ const CHAR_T *p = pattern;
++ const CHAR_T *pend = pattern + size;
++#endif /* WCHAR */
++
++ /* How to translate the characters in the pattern. */
++ RE_TRANSLATE_TYPE translate = bufp->translate;
++
++ /* Address of the count-byte of the most recently inserted `exactn'
++ command. This makes it possible to tell if a new exact-match
++ character can be added to that command or if the character requires
++ a new `exactn' command. */
++ UCHAR_T *pending_exact = 0;
++
++ /* Address of start of the most recently finished expression.
++ This tells, e.g., postfix * where to find the start of its
++ operand. Reset at the beginning of groups and alternatives. */
++ UCHAR_T *laststart = 0;
++
++ /* Address of beginning of regexp, or inside of last group. */
++ UCHAR_T *begalt;
++
++ /* Address of the place where a forward jump should go to the end of
++ the containing expression. Each alternative of an `or' -- except the
++ last -- ends with a forward jump of this sort. */
++ UCHAR_T *fixup_alt_jump = 0;
++
++ /* Counts open-groups as they are encountered. Remembered for the
++ matching close-group on the compile stack, so the same register
++ number is put in the stop_memory as the start_memory. */
++ regnum_t regnum = 0;
++
++#ifdef WCHAR
++ /* Initialize the wchar_t PATTERN and offset_buffer. */
++ p = pend = pattern = TALLOC(csize + 1, CHAR_T);
++ mbs_offset = TALLOC(csize + 1, int);
++ is_binary = TALLOC(csize + 1, char);
++ if (pattern == NULL || mbs_offset == NULL || is_binary == NULL)
++ {
++ free(pattern);
++ free(mbs_offset);
++ free(is_binary);
++ return REG_ESPACE;
++ }
++ pattern[csize] = L'\0'; /* sentinel */
++ size = convert_mbs_to_wcs(pattern, cpattern, csize, mbs_offset, is_binary);
++ pend = p + size;
++ if (size < 0)
++ {
++ free(pattern);
++ free(mbs_offset);
++ free(is_binary);
++ return REG_BADPAT;
++ }
++#endif
++
++#ifdef DEBUG
++ DEBUG_PRINT1 ("\nCompiling pattern: ");
++ if (debug)
++ {
++ unsigned debug_count;
++
++ for (debug_count = 0; debug_count < size; debug_count++)
++ PUT_CHAR (pattern[debug_count]);
++ putchar ('\n');
++ }
++#endif /* DEBUG */
++
++ /* Initialize the compile stack. */
++ compile_stack.stack = TALLOC (INIT_COMPILE_STACK_SIZE, compile_stack_elt_t);
++ if (compile_stack.stack == NULL)
++ {
++#ifdef WCHAR
++ free(pattern);
++ free(mbs_offset);
++ free(is_binary);
++#endif
++ return REG_ESPACE;
++ }
++
++ compile_stack.size = INIT_COMPILE_STACK_SIZE;
++ compile_stack.avail = 0;
++
++ /* Initialize the pattern buffer. */
++ bufp->syntax = syntax;
++ bufp->fastmap_accurate = 0;
++ bufp->not_bol = bufp->not_eol = 0;
++
++ /* Set `used' to zero, so that if we return an error, the pattern
++ printer (for debugging) will think there's no pattern. We reset it
++ at the end. */
++ bufp->used = 0;
++
++ /* Always count groups, whether or not bufp->no_sub is set. */
++ bufp->re_nsub = 0;
++
++#if !defined emacs && !defined SYNTAX_TABLE
++ /* Initialize the syntax table. */
++ init_syntax_once ();
++#endif
++
++ if (bufp->allocated == 0)
++ {
++ if (bufp->buffer)
++ { /* If zero allocated, but buffer is non-null, try to realloc
++ enough space. This loses if buffer's address is bogus, but
++ that is the user's responsibility. */
++#ifdef WCHAR
++ /* Free bufp->buffer and allocate an array for wchar_t pattern
++ buffer. */
++ free(bufp->buffer);
++ COMPILED_BUFFER_VAR = TALLOC (INIT_BUF_SIZE/sizeof(UCHAR_T),
++ UCHAR_T);
++#else
++ RETALLOC (COMPILED_BUFFER_VAR, INIT_BUF_SIZE, UCHAR_T);
++#endif /* WCHAR */
++ }
++ else
++ { /* Caller did not allocate a buffer. Do it for them. */
++ COMPILED_BUFFER_VAR = TALLOC (INIT_BUF_SIZE / sizeof(UCHAR_T),
++ UCHAR_T);
++ }
++
++ if (!COMPILED_BUFFER_VAR) FREE_STACK_RETURN (REG_ESPACE);
++#ifdef WCHAR
++ bufp->buffer = (char*)COMPILED_BUFFER_VAR;
++#endif /* WCHAR */
++ bufp->allocated = INIT_BUF_SIZE;
++ }
++#ifdef WCHAR
++ else
++ COMPILED_BUFFER_VAR = (UCHAR_T*) bufp->buffer;
++#endif
++
++ begalt = b = COMPILED_BUFFER_VAR;
++
++ /* Loop through the uncompiled pattern until we're at the end. */
++ while (p != pend)
++ {
++ PATFETCH (c);
++
++ switch (c)
++ {
++ case '^':
++ {
++ if ( /* If at start of pattern, it's an operator. */
++ p == pattern + 1
++ /* If context independent, it's an operator. */
++ || syntax & RE_CONTEXT_INDEP_ANCHORS
++ /* Otherwise, depends on what's come before. */
++ || PREFIX(at_begline_loc_p) (pattern, p, syntax))
++ BUF_PUSH (begline);
++ else
++ goto normal_char;
++ }
++ break;
++
++
++ case '$':
++ {
++ if ( /* If at end of pattern, it's an operator. */
++ p == pend
++ /* If context independent, it's an operator. */
++ || syntax & RE_CONTEXT_INDEP_ANCHORS
++ /* Otherwise, depends on what's next. */
++ || PREFIX(at_endline_loc_p) (p, pend, syntax))
++ BUF_PUSH (endline);
++ else
++ goto normal_char;
++ }
++ break;
++
++
++ case '+':
++ case '?':
++ if ((syntax & RE_BK_PLUS_QM)
++ || (syntax & RE_LIMITED_OPS))
++ goto normal_char;
++ handle_plus:
++ case '*':
++ /* If there is no previous pattern... */
++ if (!laststart)
++ {
++ if (syntax & RE_CONTEXT_INVALID_OPS)
++ FREE_STACK_RETURN (REG_BADRPT);
++ else if (!(syntax & RE_CONTEXT_INDEP_OPS))
++ goto normal_char;
++ }
++
++ {
++ /* Are we optimizing this jump? */
++ boolean keep_string_p = false;
++
++ /* 1 means zero (many) matches is allowed. */
++ char zero_times_ok = 0, many_times_ok = 0;
++
++ /* If there is a sequence of repetition chars, collapse it
++ down to just one (the right one). We can't combine
++ interval operators with these because of, e.g., `a{2}*',
++ which should only match an even number of `a's. */
++
++ for (;;)
++ {
++ zero_times_ok |= c != '+';
++ many_times_ok |= c != '?';
++
++ if (p == pend)
++ break;
++
++ PATFETCH (c);
++
++ if (c == '*'
++ || (!(syntax & RE_BK_PLUS_QM) && (c == '+' || c == '?')))
++ ;
++
++ else if (syntax & RE_BK_PLUS_QM && c == '\\')
++ {
++ if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
++
++ PATFETCH (c1);
++ if (!(c1 == '+' || c1 == '?'))
++ {
++ PATUNFETCH;
++ PATUNFETCH;
++ break;
++ }
++
++ c = c1;
++ }
++ else
++ {
++ PATUNFETCH;
++ break;
++ }
++
++ /* If we get here, we found another repeat character. */
++ }
++
++ /* Star, etc. applied to an empty pattern is equivalent
++ to an empty pattern. */
++ if (!laststart)
++ break;
++
++ /* Now we know whether or not zero matches is allowed
++ and also whether or not two or more matches is allowed. */
++ if (many_times_ok)
++ { /* More than one repetition is allowed, so put in at the
++ end a backward relative jump from `b' to before the next
++ jump we're going to put in below (which jumps from
++ laststart to after this jump).
++
++ But if we are at the `*' in the exact sequence `.*\n',
++ insert an unconditional jump backwards to the .,
++ instead of the beginning of the loop. This way we only
++ push a failure point once, instead of every time
++ through the loop. */
++ assert (p - 1 > pattern);
++
++ /* Allocate the space for the jump. */
++ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
++
++ /* We know we are not at the first character of the pattern,
++ because laststart was nonzero. And we've already
++ incremented `p', by the way, to be the character after
++ the `*'. Do we have to do something analogous here
++ for null bytes, because of RE_DOT_NOT_NULL? */
++ if (TRANSLATE (*(p - 2)) == TRANSLATE ('.')
++ && zero_times_ok
++ && p < pend && TRANSLATE (*p) == TRANSLATE ('\n')
++ && !(syntax & RE_DOT_NEWLINE))
++ { /* We have .*\n. */
++ STORE_JUMP (jump, b, laststart);
++ keep_string_p = true;
++ }
++ else
++ /* Anything else. */
++ STORE_JUMP (maybe_pop_jump, b, laststart -
++ (1 + OFFSET_ADDRESS_SIZE));
++
++ /* We've added more stuff to the buffer. */
++ b += 1 + OFFSET_ADDRESS_SIZE;
++ }
++
++ /* On failure, jump from laststart to b + 3, which will be the
++ end of the buffer after this jump is inserted. */
++ /* ifdef WCHAR, 'b + 1 + OFFSET_ADDRESS_SIZE' instead of
++ 'b + 3'. */
++ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
++ INSERT_JUMP (keep_string_p ? on_failure_keep_string_jump
++ : on_failure_jump,
++ laststart, b + 1 + OFFSET_ADDRESS_SIZE);
++ pending_exact = 0;
++ b += 1 + OFFSET_ADDRESS_SIZE;
++
++ if (!zero_times_ok)
++ {
++ /* At least one repetition is required, so insert a
++ `dummy_failure_jump' before the initial
++ `on_failure_jump' instruction of the loop. This
++ effects a skip over that instruction the first time
++ we hit that loop. */
++ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
++ INSERT_JUMP (dummy_failure_jump, laststart, laststart +
++ 2 + 2 * OFFSET_ADDRESS_SIZE);
++ b += 1 + OFFSET_ADDRESS_SIZE;
++ }
++ }
++ break;
++
++
++ case '.':
++ laststart = b;
++ BUF_PUSH (anychar);
++ break;
++
++
++ case '[':
++ {
++ boolean had_char_class = false;
++#ifdef WCHAR
++ CHAR_T range_start = 0xffffffff;
++#else
++ unsigned int range_start = 0xffffffff;
++#endif
++ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
++
++#ifdef WCHAR
++ /* We assume a charset(_not) structure as a wchar_t array.
++ charset[0] = (re_opcode_t) charset(_not)
++ charset[1] = l (= length of char_classes)
++ charset[2] = m (= length of collating_symbols)
++ charset[3] = n (= length of equivalence_classes)
++ charset[4] = o (= length of char_ranges)
++ charset[5] = p (= length of chars)
++
++ charset[6] = char_class (wctype_t)
++ charset[6+CHAR_CLASS_SIZE] = char_class (wctype_t)
++ ...
++ charset[l+5] = char_class (wctype_t)
++
++ charset[l+6] = collating_symbol (wchar_t)
++ ...
++ charset[l+m+5] = collating_symbol (wchar_t)
++ ifdef _LIBC we use the index if
++ _NL_COLLATE_SYMB_EXTRAMB instead of
++ wchar_t string.
++
++ charset[l+m+6] = equivalence_classes (wchar_t)
++ ...
++ charset[l+m+n+5] = equivalence_classes (wchar_t)
++ ifdef _LIBC we use the index in
++ _NL_COLLATE_WEIGHT instead of
++ wchar_t string.
++
++ charset[l+m+n+6] = range_start
++ charset[l+m+n+7] = range_end
++ ...
++ charset[l+m+n+2o+4] = range_start
++ charset[l+m+n+2o+5] = range_end
++ ifdef _LIBC we use the value looked up
++ in _NL_COLLATE_COLLSEQ instead of
++ wchar_t character.
++
++ charset[l+m+n+2o+6] = char
++ ...
++ charset[l+m+n+2o+p+5] = char
++
++ */
++
++ /* We need at least 6 spaces: the opcode, the length of
++ char_classes, the length of collating_symbols, the length of
++ equivalence_classes, the length of char_ranges, the length of
++ chars. */
++ GET_BUFFER_SPACE (6);
++
++ /* Save b as laststart. And We use laststart as the pointer
++ to the first element of the charset here.
++ In other words, laststart[i] indicates charset[i]. */
++ laststart = b;
++
++ /* We test `*p == '^' twice, instead of using an if
++ statement, so we only need one BUF_PUSH. */
++ BUF_PUSH (*p == '^' ? charset_not : charset);
++ if (*p == '^')
++ p++;
++
++ /* Push the length of char_classes, the length of
++ collating_symbols, the length of equivalence_classes, the
++ length of char_ranges and the length of chars. */
++ BUF_PUSH_3 (0, 0, 0);
++ BUF_PUSH_2 (0, 0);
++
++ /* Remember the first position in the bracket expression. */
++ p1 = p;
++
++ /* charset_not matches newline according to a syntax bit. */
++ if ((re_opcode_t) b[-6] == charset_not
++ && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
++ {
++ BUF_PUSH('\n');
++ laststart[5]++; /* Update the length of characters */
++ }
++
++ /* Read in characters and ranges, setting map bits. */
++ for (;;)
++ {
++ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
++
++ PATFETCH (c);
++
++ /* \ might escape characters inside [...] and [^...]. */
++ if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\')
++ {
++ if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
++
++ PATFETCH (c1);
++ BUF_PUSH(c1);
++ laststart[5]++; /* Update the length of chars */
++ range_start = c1;
++ continue;
++ }
++
++ /* Could be the end of the bracket expression. If it's
++ not (i.e., when the bracket expression is `[]' so
++ far), the ']' character bit gets set way below. */
++ if (c == ']' && p != p1 + 1)
++ break;
++
++ /* Look ahead to see if it's a range when the last thing
++ was a character class. */
++ if (had_char_class && c == '-' && *p != ']')
++ FREE_STACK_RETURN (REG_ERANGE);
++
++ /* Look ahead to see if it's a range when the last thing
++ was a character: if this is a hyphen not at the
++ beginning or the end of a list, then it's the range
++ operator. */
++ if (c == '-'
++ && !(p - 2 >= pattern && p[-2] == '[')
++ && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^')
++ && *p != ']')
++ {
++ reg_errcode_t ret;
++ /* Allocate the space for range_start and range_end. */
++ GET_BUFFER_SPACE (2);
++ /* Update the pointer to indicate end of buffer. */
++ b += 2;
++ ret = wcs_compile_range (range_start, &p, pend, translate,
++ syntax, b, laststart);
++ if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
++ range_start = 0xffffffff;
++ }
++ else if (p[0] == '-' && p[1] != ']')
++ { /* This handles ranges made up of characters only. */
++ reg_errcode_t ret;
++
++ /* Move past the `-'. */
++ PATFETCH (c1);
++ /* Allocate the space for range_start and range_end. */
++ GET_BUFFER_SPACE (2);
++ /* Update the pointer to indicate end of buffer. */
++ b += 2;
++ ret = wcs_compile_range (c, &p, pend, translate, syntax, b,
++ laststart);
++ if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
++ range_start = 0xffffffff;
++ }
++
++ /* See if we're at the beginning of a possible character
++ class. */
++ else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
++ { /* Leave room for the null. */
++ char str[CHAR_CLASS_MAX_LENGTH + 1];
++
++ PATFETCH (c);
++ c1 = 0;
++
++ /* If pattern is `[[:'. */
++ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
++
++ for (;;)
++ {
++ PATFETCH (c);
++ if ((c == ':' && *p == ']') || p == pend)
++ break;
++ if (c1 < CHAR_CLASS_MAX_LENGTH)
++ str[c1++] = c;
++ else
++ /* This is in any case an invalid class name. */
++ str[0] = '\0';
++ }
++ str[c1] = '\0';
++
++ /* If isn't a word bracketed by `[:' and `:]':
++ undo the ending character, the letters, and leave
++ the leading `:' and `[' (but store them as character). */
++ if (c == ':' && *p == ']')
++ {
++ wctype_t wt;
++ uintptr_t alignedp;
++
++ /* Query the character class as wctype_t. */
++ wt = IS_CHAR_CLASS (str);
++ if (wt == 0)
++ FREE_STACK_RETURN (REG_ECTYPE);
++
++ /* Throw away the ] at the end of the character
++ class. */
++ PATFETCH (c);
++
++ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
++
++ /* Allocate the space for character class. */
++ GET_BUFFER_SPACE(CHAR_CLASS_SIZE);
++ /* Update the pointer to indicate end of buffer. */
++ b += CHAR_CLASS_SIZE;
++ /* Move data which follow character classes
++ not to violate the data. */
++ insert_space(CHAR_CLASS_SIZE,
++ laststart + 6 + laststart[1],
++ b - 1);
++ alignedp = ((uintptr_t)(laststart + 6 + laststart[1])
++ + __alignof__(wctype_t) - 1)
++ & ~(uintptr_t)(__alignof__(wctype_t) - 1);
++ /* Store the character class. */
++ *((wctype_t*)alignedp) = wt;
++ /* Update length of char_classes */
++ laststart[1] += CHAR_CLASS_SIZE;
++
++ had_char_class = true;
++ }
++ else
++ {
++ c1++;
++ while (c1--)
++ PATUNFETCH;
++ BUF_PUSH ('[');
++ BUF_PUSH (':');
++ laststart[5] += 2; /* Update the length of characters */
++ range_start = ':';
++ had_char_class = false;
++ }
++ }
++ else if (syntax & RE_CHAR_CLASSES && c == '[' && (*p == '='
++ || *p == '.'))
++ {
++ CHAR_T str[128]; /* Should be large enough. */
++ CHAR_T delim = *p; /* '=' or '.' */
++# ifdef _LIBC
++ uint32_t nrules =
++ _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
++# endif
++ PATFETCH (c);
++ c1 = 0;
++
++ /* If pattern is `[[=' or '[[.'. */
++ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
++
++ for (;;)
++ {
++ PATFETCH (c);
++ if ((c == delim && *p == ']') || p == pend)
++ break;
++ if (c1 < sizeof (str) - 1)
++ str[c1++] = c;
++ else
++ /* This is in any case an invalid class name. */
++ str[0] = '\0';
++ }
++ str[c1] = '\0';
++
++ if (c == delim && *p == ']' && str[0] != '\0')
++ {
++ unsigned int i, offset;
++ /* If we have no collation data we use the default
++ collation in which each character is in a class
++ by itself. It also means that ASCII is the
++ character set and therefore we cannot have character
++ with more than one byte in the multibyte
++ representation. */
++
++ /* If not defined _LIBC, we push the name and
++ `\0' for the sake of matching performance. */
++ int datasize = c1 + 1;
++
++# ifdef _LIBC
++ int32_t idx = 0;
++ if (nrules == 0)
++# endif
++ {
++ if (c1 != 1)
++ FREE_STACK_RETURN (REG_ECOLLATE);
++ }
++# ifdef _LIBC
++ else
++ {
++ const int32_t *table;
++ const int32_t *weights;
++ const int32_t *extra;
++ const int32_t *indirect;
++ wint_t *cp;
++
++ if(delim == '=')
++ {
++ /* We push the index for equivalence class. */
++ cp = (wint_t*)str;
++
++ table = (const int32_t *)
++ _NL_CURRENT (LC_COLLATE,
++ _NL_COLLATE_TABLEWC);
++ weights = (const int32_t *)
++ _NL_CURRENT (LC_COLLATE,
++ _NL_COLLATE_WEIGHTWC);
++ extra = (const wint_t *)
++ _NL_CURRENT (LC_COLLATE,
++ _NL_COLLATE_EXTRAWC);
++ indirect = (const int32_t *)
++ _NL_CURRENT (LC_COLLATE,
++ _NL_COLLATE_INDIRECTWC);
++
++ idx = FINDIDX (table, indirect, extra, &cp, 1);
++ if (idx == 0 || cp < (wint_t*) str + c1)
++ /* This is no valid character. */
++ FREE_STACK_RETURN (REG_ECOLLATE);
++
++ str[0] = (wchar_t)idx;
++ }
++ else /* delim == '.' */
++ {
++ /* We push collation sequence value
++ for collating symbol. */
++ int32_t table_size;
++ const int32_t *symb_table;
++ const unsigned char *extra;
++ int32_t idx;
++ int32_t elem;
++ int32_t second;
++ int32_t hash;
++ char char_str[c1];
++
++ /* We have to convert the name to a single-byte
++ string. This is possible since the names
++ consist of ASCII characters and the internal
++ representation is UCS4. */
++ for (i = 0; i < c1; ++i)
++ char_str[i] = str[i];
++
++ table_size =
++ _NL_CURRENT_WORD (LC_COLLATE,
++ _NL_COLLATE_SYMB_HASH_SIZEMB);
++ symb_table = (const int32_t *)
++ _NL_CURRENT (LC_COLLATE,
++ _NL_COLLATE_SYMB_TABLEMB);
++ extra = (const unsigned char *)
++ _NL_CURRENT (LC_COLLATE,
++ _NL_COLLATE_SYMB_EXTRAMB);
++
++ /* Locate the character in the hashing table. */
++ hash = elem_hash (char_str, c1);
++
++ idx = 0;
++ elem = hash % table_size;
++ second = hash % (table_size - 2);
++ while (symb_table[2 * elem] != 0)
++ {
++ /* First compare the hashing value. */
++ if (symb_table[2 * elem] == hash
++ && c1 == extra[symb_table[2 * elem + 1]]
++ && memcmp (char_str,
++ &extra[symb_table[2 * elem + 1]
++ + 1], c1) == 0)
++ {
++ /* Yep, this is the entry. */
++ idx = symb_table[2 * elem + 1];
++ idx += 1 + extra[idx];
++ break;
++ }
++
++ /* Next entry. */
++ elem += second;
++ }
++
++ if (symb_table[2 * elem] != 0)
++ {
++ /* Compute the index of the byte sequence
++ in the table. */
++ idx += 1 + extra[idx];
++ /* Adjust for the alignment. */
++ idx = (idx + 3) & ~3;
++
++ str[0] = (wchar_t) idx + 4;
++ }
++ else if (symb_table[2 * elem] == 0 && c1 == 1)
++ {
++ /* No valid character. Match it as a
++ single byte character. */
++ had_char_class = false;
++ BUF_PUSH(str[0]);
++ /* Update the length of characters */
++ laststart[5]++;
++ range_start = str[0];
++
++ /* Throw away the ] at the end of the
++ collating symbol. */
++ PATFETCH (c);
++ /* exit from the switch block. */
++ continue;
++ }
++ else
++ FREE_STACK_RETURN (REG_ECOLLATE);
++ }
++ datasize = 1;
++ }
++# endif
++ /* Throw away the ] at the end of the equivalence
++ class (or collating symbol). */
++ PATFETCH (c);
++
++ /* Allocate the space for the equivalence class
++ (or collating symbol) (and '\0' if needed). */
++ GET_BUFFER_SPACE(datasize);
++ /* Update the pointer to indicate end of buffer. */
++ b += datasize;
++
++ if (delim == '=')
++ { /* equivalence class */
++ /* Calculate the offset of char_ranges,
++ which is next to equivalence_classes. */
++ offset = laststart[1] + laststart[2]
++ + laststart[3] +6;
++ /* Insert space. */
++ insert_space(datasize, laststart + offset, b - 1);
++
++ /* Write the equivalence_class and \0. */
++ for (i = 0 ; i < datasize ; i++)
++ laststart[offset + i] = str[i];
++
++ /* Update the length of equivalence_classes. */
++ laststart[3] += datasize;
++ had_char_class = true;
++ }
++ else /* delim == '.' */
++ { /* collating symbol */
++ /* Calculate the offset of the equivalence_classes,
++ which is next to collating_symbols. */
++ offset = laststart[1] + laststart[2] + 6;
++ /* Insert space and write the collationg_symbol
++ and \0. */
++ insert_space(datasize, laststart + offset, b-1);
++ for (i = 0 ; i < datasize ; i++)
++ laststart[offset + i] = str[i];
++
++ /* In re_match_2_internal if range_start < -1, we
++ assume -range_start is the offset of the
++ collating symbol which is specified as
++ the character of the range start. So we assign
++ -(laststart[1] + laststart[2] + 6) to
++ range_start. */
++ range_start = -(laststart[1] + laststart[2] + 6);
++ /* Update the length of collating_symbol. */
++ laststart[2] += datasize;
++ had_char_class = false;
++ }
++ }
++ else
++ {
++ c1++;
++ while (c1--)
++ PATUNFETCH;
++ BUF_PUSH ('[');
++ BUF_PUSH (delim);
++ laststart[5] += 2; /* Update the length of characters */
++ range_start = delim;
++ had_char_class = false;
++ }
++ }
++ else
++ {
++ had_char_class = false;
++ BUF_PUSH(c);
++ laststart[5]++; /* Update the length of characters */
++ range_start = c;
++ }
++ }
++
++#else /* BYTE */
++ /* Ensure that we have enough space to push a charset: the
++ opcode, the length count, and the bitset; 34 bytes in all. */
++ GET_BUFFER_SPACE (34);
++
++ laststart = b;
++
++ /* We test `*p == '^' twice, instead of using an if
++ statement, so we only need one BUF_PUSH. */
++ BUF_PUSH (*p == '^' ? charset_not : charset);
++ if (*p == '^')
++ p++;
++
++ /* Remember the first position in the bracket expression. */
++ p1 = p;
++
++ /* Push the number of bytes in the bitmap. */
++ BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
++
++ /* Clear the whole map. */
++ bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH);
++
++ /* charset_not matches newline according to a syntax bit. */
++ if ((re_opcode_t) b[-2] == charset_not
++ && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
++ SET_LIST_BIT ('\n');
++
++ /* Read in characters and ranges, setting map bits. */
++ for (;;)
++ {
++ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
++
++ PATFETCH (c);
++
++ /* \ might escape characters inside [...] and [^...]. */
++ if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\')
++ {
++ if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
++
++ PATFETCH (c1);
++ SET_LIST_BIT (c1);
++ range_start = c1;
++ continue;
++ }
++
++ /* Could be the end of the bracket expression. If it's
++ not (i.e., when the bracket expression is `[]' so
++ far), the ']' character bit gets set way below. */
++ if (c == ']' && p != p1 + 1)
++ break;
++
++ /* Look ahead to see if it's a range when the last thing
++ was a character class. */
++ if (had_char_class && c == '-' && *p != ']')
++ FREE_STACK_RETURN (REG_ERANGE);
++
++ /* Look ahead to see if it's a range when the last thing
++ was a character: if this is a hyphen not at the
++ beginning or the end of a list, then it's the range
++ operator. */
++ if (c == '-'
++ && !(p - 2 >= pattern && p[-2] == '[')
++ && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^')
++ && *p != ']')
++ {
++ reg_errcode_t ret
++ = byte_compile_range (range_start, &p, pend, translate,
++ syntax, b);
++ if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
++ range_start = 0xffffffff;
++ }
++
++ else if (p[0] == '-' && p[1] != ']')
++ { /* This handles ranges made up of characters only. */
++ reg_errcode_t ret;
++
++ /* Move past the `-'. */
++ PATFETCH (c1);
++
++ ret = byte_compile_range (c, &p, pend, translate, syntax, b);
++ if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
++ range_start = 0xffffffff;
++ }
++
++ /* See if we're at the beginning of a possible character
++ class. */
++
++ else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
++ { /* Leave room for the null. */
++ char str[CHAR_CLASS_MAX_LENGTH + 1];
++
++ PATFETCH (c);
++ c1 = 0;
++
++ /* If pattern is `[[:'. */
++ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
++
++ for (;;)
++ {
++ PATFETCH (c);
++ if ((c == ':' && *p == ']') || p == pend)
++ break;
++ if (((int) c1) < CHAR_CLASS_MAX_LENGTH)
++ str[c1++] = c;
++ else
++ /* This is in any case an invalid class name. */
++ str[0] = '\0';
++ }
++ str[c1] = '\0';
++
++ /* If isn't a word bracketed by `[:' and `:]':
++ undo the ending character, the letters, and leave
++ the leading `:' and `[' (but set bits for them). */
++ if (c == ':' && *p == ']')
++ {
++# if WIDE_CHAR_SUPPORT
++ boolean is_lower = STREQ (str, "lower");
++ boolean is_upper = STREQ (str, "upper");
++ wctype_t wt;
++ int ch;
++
++ wt = IS_CHAR_CLASS (str);
++ if (wt == 0)
++ FREE_STACK_RETURN (REG_ECTYPE);
++
++ /* Throw away the ] at the end of the character
++ class. */
++ PATFETCH (c);
++
++ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
++
++ for (ch = 0; ch < 1 << BYTEWIDTH; ++ch)
++ {
++# ifdef _LIBC
++ if (__iswctype (__btowc (ch), wt))
++ SET_LIST_BIT (ch);
++# else
++ if (iswctype (btowc (ch), wt))
++ SET_LIST_BIT (ch);
++# endif
++
++ if (translate && (is_upper || is_lower)
++ && (ISUPPER (ch) || ISLOWER (ch)))
++ SET_LIST_BIT (ch);
++ }
++
++ had_char_class = true;
++# else
++ int ch;
++ boolean is_alnum = STREQ (str, "alnum");
++ boolean is_alpha = STREQ (str, "alpha");
++ boolean is_blank = STREQ (str, "blank");
++ boolean is_cntrl = STREQ (str, "cntrl");
++ boolean is_digit = STREQ (str, "digit");
++ boolean is_graph = STREQ (str, "graph");
++ boolean is_lower = STREQ (str, "lower");
++ boolean is_print = STREQ (str, "print");
++ boolean is_punct = STREQ (str, "punct");
++ boolean is_space = STREQ (str, "space");
++ boolean is_upper = STREQ (str, "upper");
++ boolean is_xdigit = STREQ (str, "xdigit");
++
++ if (!IS_CHAR_CLASS (str))
++ FREE_STACK_RETURN (REG_ECTYPE);
++
++ /* Throw away the ] at the end of the character
++ class. */
++ PATFETCH (c);
++
++ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
++
++ for (ch = 0; ch < 1 << BYTEWIDTH; ch++)
++ {
++ /* This was split into 3 if's to
++ avoid an arbitrary limit in some compiler. */
++ if ( (is_alnum && ISALNUM (ch))
++ || (is_alpha && ISALPHA (ch))
++ || (is_blank && ISBLANK (ch))
++ || (is_cntrl && ISCNTRL (ch)))
++ SET_LIST_BIT (ch);
++ if ( (is_digit && ISDIGIT (ch))
++ || (is_graph && ISGRAPH (ch))
++ || (is_lower && ISLOWER (ch))
++ || (is_print && ISPRINT (ch)))
++ SET_LIST_BIT (ch);
++ if ( (is_punct && ISPUNCT (ch))
++ || (is_space && ISSPACE (ch))
++ || (is_upper && ISUPPER (ch))
++ || (is_xdigit && ISXDIGIT (ch)))
++ SET_LIST_BIT (ch);
++ if ( translate && (is_upper || is_lower)
++ && (ISUPPER (ch) || ISLOWER (ch)))
++ SET_LIST_BIT (ch);
++ }
++ had_char_class = true;
++# endif /* libc || wctype.h */
++ }
++ else
++ {
++ c1++;
++ while (c1--)
++ PATUNFETCH;
++ SET_LIST_BIT ('[');
++ SET_LIST_BIT (':');
++ range_start = ':';
++ had_char_class = false;
++ }
++ }
++ else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == '=')
++ {
++ unsigned char str[MB_LEN_MAX + 1];
++# ifdef _LIBC
++ uint32_t nrules =
++ _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
++# endif
++
++ PATFETCH (c);
++ c1 = 0;
++
++ /* If pattern is `[[='. */
++ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
++
++ for (;;)
++ {
++ PATFETCH (c);
++ if ((c == '=' && *p == ']') || p == pend)
++ break;
++ if (c1 < MB_LEN_MAX)
++ str[c1++] = c;
++ else
++ /* This is in any case an invalid class name. */
++ str[0] = '\0';
++ }
++ str[c1] = '\0';
++
++ if (c == '=' && *p == ']' && str[0] != '\0')
++ {
++ /* If we have no collation data we use the default
++ collation in which each character is in a class
++ by itself. It also means that ASCII is the
++ character set and therefore we cannot have character
++ with more than one byte in the multibyte
++ representation. */
++# ifdef _LIBC
++ if (nrules == 0)
++# endif
++ {
++ if (c1 != 1)
++ FREE_STACK_RETURN (REG_ECOLLATE);
++
++ /* Throw away the ] at the end of the equivalence
++ class. */
++ PATFETCH (c);
++
++ /* Set the bit for the character. */
++ SET_LIST_BIT (str[0]);
++ }
++# ifdef _LIBC
++ else
++ {
++ /* Try to match the byte sequence in `str' against
++ those known to the collate implementation.
++ First find out whether the bytes in `str' are
++ actually from exactly one character. */
++ const int32_t *table;
++ const unsigned char *weights;
++ const unsigned char *extra;
++ const int32_t *indirect;
++ int32_t idx;
++ const unsigned char *cp = str;
++ int ch;
++
++ table = (const int32_t *)
++ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
++ weights = (const unsigned char *)
++ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTMB);
++ extra = (const unsigned char *)
++ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
++ indirect = (const int32_t *)
++ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
++ idx = FINDIDX (table, indirect, extra, &cp, 1);
++ if (idx == 0 || cp < str + c1)
++ /* This is no valid character. */
++ FREE_STACK_RETURN (REG_ECOLLATE);
++
++ /* Throw away the ] at the end of the equivalence
++ class. */
++ PATFETCH (c);
++
++ /* Now we have to go throught the whole table
++ and find all characters which have the same
++ first level weight.
++
++ XXX Note that this is not entirely correct.
++ we would have to match multibyte sequences
++ but this is not possible with the current
++ implementation. */
++ for (ch = 1; ch < 256; ++ch)
++ /* XXX This test would have to be changed if we
++ would allow matching multibyte sequences. */
++ if (table[ch] > 0)
++ {
++ int32_t idx2 = table[ch];
++ size_t len = weights[idx2];
++
++ /* Test whether the lenghts match. */
++ if (weights[idx] == len)
++ {
++ /* They do. New compare the bytes of
++ the weight. */
++ size_t cnt = 0;
++
++ while (cnt < len
++ && (weights[idx + 1 + cnt]
++ == weights[idx2 + 1 + cnt]))
++ ++cnt;
++
++ if (cnt == len)
++ /* They match. Mark the character as
++ acceptable. */
++ SET_LIST_BIT (ch);
++ }
++ }
++ }
++# endif
++ had_char_class = true;
++ }
++ else
++ {
++ c1++;
++ while (c1--)
++ PATUNFETCH;
++ SET_LIST_BIT ('[');
++ SET_LIST_BIT ('=');
++ range_start = '=';
++ had_char_class = false;
++ }
++ }
++ else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == '.')
++ {
++ unsigned char str[128]; /* Should be large enough. */
++# ifdef _LIBC
++ uint32_t nrules =
++ _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
++# endif
++
++ PATFETCH (c);
++ c1 = 0;
++
++ /* If pattern is `[[.'. */
++ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
++
++ for (;;)
++ {
++ PATFETCH (c);
++ if ((c == '.' && *p == ']') || p == pend)
++ break;
++ if (c1 < sizeof (str))
++ str[c1++] = c;
++ else
++ /* This is in any case an invalid class name. */
++ str[0] = '\0';
++ }
++ str[c1] = '\0';
++
++ if (c == '.' && *p == ']' && str[0] != '\0')
++ {
++ /* If we have no collation data we use the default
++ collation in which each character is the name
++ for its own class which contains only the one
++ character. It also means that ASCII is the
++ character set and therefore we cannot have character
++ with more than one byte in the multibyte
++ representation. */
++# ifdef _LIBC
++ if (nrules == 0)
++# endif
++ {
++ if (c1 != 1)
++ FREE_STACK_RETURN (REG_ECOLLATE);
++
++ /* Throw away the ] at the end of the equivalence
++ class. */
++ PATFETCH (c);
++
++ /* Set the bit for the character. */
++ SET_LIST_BIT (str[0]);
++ range_start = ((const unsigned char *) str)[0];
++ }
++# ifdef _LIBC
++ else
++ {
++ /* Try to match the byte sequence in `str' against
++ those known to the collate implementation.
++ First find out whether the bytes in `str' are
++ actually from exactly one character. */
++ int32_t table_size;
++ const int32_t *symb_table;
++ const unsigned char *extra;
++ int32_t idx;
++ int32_t elem;
++ int32_t second;
++ int32_t hash;
++
++ table_size =
++ _NL_CURRENT_WORD (LC_COLLATE,
++ _NL_COLLATE_SYMB_HASH_SIZEMB);
++ symb_table = (const int32_t *)
++ _NL_CURRENT (LC_COLLATE,
++ _NL_COLLATE_SYMB_TABLEMB);
++ extra = (const unsigned char *)
++ _NL_CURRENT (LC_COLLATE,
++ _NL_COLLATE_SYMB_EXTRAMB);
++
++ /* Locate the character in the hashing table. */
++ hash = elem_hash ((const char *) str, c1);
++
++ idx = 0;
++ elem = hash % table_size;
++ second = hash % (table_size - 2);
++ while (symb_table[2 * elem] != 0)
++ {
++ /* First compare the hashing value. */
++ if (symb_table[2 * elem] == hash
++ && c1 == extra[symb_table[2 * elem + 1]]
++ && memcmp (str,
++ &extra[symb_table[2 * elem + 1]
++ + 1],
++ c1) == 0)
++ {
++ /* Yep, this is the entry. */
++ idx = symb_table[2 * elem + 1];
++ idx += 1 + extra[idx];
++ break;
++ }
++
++ /* Next entry. */
++ elem += second;
++ }
++
++ if (symb_table[2 * elem] == 0)
++ /* This is no valid character. */
++ FREE_STACK_RETURN (REG_ECOLLATE);
++
++ /* Throw away the ] at the end of the equivalence
++ class. */
++ PATFETCH (c);
++
++ /* Now add the multibyte character(s) we found
++ to the accept list.
++
++ XXX Note that this is not entirely correct.
++ we would have to match multibyte sequences
++ but this is not possible with the current
++ implementation. Also, we have to match
++ collating symbols, which expand to more than
++ one file, as a whole and not allow the
++ individual bytes. */
++ c1 = extra[idx++];
++ if (c1 == 1)
++ range_start = extra[idx];
++ while (c1-- > 0)
++ {
++ SET_LIST_BIT (extra[idx]);
++ ++idx;
++ }
++ }
++# endif
++ had_char_class = false;
++ }
++ else
++ {
++ c1++;
++ while (c1--)
++ PATUNFETCH;
++ SET_LIST_BIT ('[');
++ SET_LIST_BIT ('.');
++ range_start = '.';
++ had_char_class = false;
++ }
++ }
++ else
++ {
++ had_char_class = false;
++ SET_LIST_BIT (c);
++ range_start = c;
++ }
++ }
++
++ /* Discard any (non)matching list bytes that are all 0 at the
++ end of the map. Decrease the map-length byte too. */
++ while ((int) b[-1] > 0 && b[b[-1] - 1] == 0)
++ b[-1]--;
++ b += b[-1];
++#endif /* WCHAR */
++ }
++ break;
++
++
++ case '(':
++ if (syntax & RE_NO_BK_PARENS)
++ goto handle_open;
++ else
++ goto normal_char;
++
++
++ case ')':
++ if (syntax & RE_NO_BK_PARENS)
++ goto handle_close;
++ else
++ goto normal_char;
++
++
++ case '\n':
++ if (syntax & RE_NEWLINE_ALT)
++ goto handle_alt;
++ else
++ goto normal_char;
++
++
++ case '|':
++ if (syntax & RE_NO_BK_VBAR)
++ goto handle_alt;
++ else
++ goto normal_char;
++
++
++ case '{':
++ if (syntax & RE_INTERVALS && syntax & RE_NO_BK_BRACES)
++ goto handle_interval;
++ else
++ goto normal_char;
++
++
++ case '\\':
++ if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
++
++ /* Do not translate the character after the \, so that we can
++ distinguish, e.g., \B from \b, even if we normally would
++ translate, e.g., B to b. */
++ PATFETCH_RAW (c);
++
++ switch (c)
++ {
++ case '(':
++ if (syntax & RE_NO_BK_PARENS)
++ goto normal_backslash;
++
++ handle_open:
++ bufp->re_nsub++;
++ regnum++;
++
++ if (COMPILE_STACK_FULL)
++ {
++ RETALLOC (compile_stack.stack, compile_stack.size << 1,
++ compile_stack_elt_t);
++ if (compile_stack.stack == NULL) return REG_ESPACE;
++
++ compile_stack.size <<= 1;
++ }
++
++ /* These are the values to restore when we hit end of this
++ group. They are all relative offsets, so that if the
++ whole pattern moves because of realloc, they will still
++ be valid. */
++ COMPILE_STACK_TOP.begalt_offset = begalt - COMPILED_BUFFER_VAR;
++ COMPILE_STACK_TOP.fixup_alt_jump
++ = fixup_alt_jump ? fixup_alt_jump - COMPILED_BUFFER_VAR + 1 : 0;
++ COMPILE_STACK_TOP.laststart_offset = b - COMPILED_BUFFER_VAR;
++ COMPILE_STACK_TOP.regnum = regnum;
++
++ /* We will eventually replace the 0 with the number of
++ groups inner to this one. But do not push a
++ start_memory for groups beyond the last one we can
++ represent in the compiled pattern. */
++ if (regnum <= MAX_REGNUM)
++ {
++ COMPILE_STACK_TOP.inner_group_offset = b
++ - COMPILED_BUFFER_VAR + 2;
++ BUF_PUSH_3 (start_memory, regnum, 0);
++ }
++
++ compile_stack.avail++;
++
++ fixup_alt_jump = 0;
++ laststart = 0;
++ begalt = b;
++ /* If we've reached MAX_REGNUM groups, then this open
++ won't actually generate any code, so we'll have to
++ clear pending_exact explicitly. */
++ pending_exact = 0;
++ break;
++
++
++ case ')':
++ if (syntax & RE_NO_BK_PARENS) goto normal_backslash;
++
++ if (COMPILE_STACK_EMPTY)
++ {
++ if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
++ goto normal_backslash;
++ else
++ FREE_STACK_RETURN (REG_ERPAREN);
++ }
++
++ handle_close:
++ if (fixup_alt_jump)
++ { /* Push a dummy failure point at the end of the
++ alternative for a possible future
++ `pop_failure_jump' to pop. See comments at
++ `push_dummy_failure' in `re_match_2'. */
++ BUF_PUSH (push_dummy_failure);
++
++ /* We allocated space for this jump when we assigned
++ to `fixup_alt_jump', in the `handle_alt' case below. */
++ STORE_JUMP (jump_past_alt, fixup_alt_jump, b - 1);
++ }
++
++ /* See similar code for backslashed left paren above. */
++ if (COMPILE_STACK_EMPTY)
++ {
++ if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
++ goto normal_char;
++ else
++ FREE_STACK_RETURN (REG_ERPAREN);
++ }
++
++ /* Since we just checked for an empty stack above, this
++ ``can't happen''. */
++ assert (compile_stack.avail != 0);
++ {
++ /* We don't just want to restore into `regnum', because
++ later groups should continue to be numbered higher,
++ as in `(ab)c(de)' -- the second group is #2. */
++ regnum_t this_group_regnum;
++
++ compile_stack.avail--;
++ begalt = COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.begalt_offset;
++ fixup_alt_jump
++ = COMPILE_STACK_TOP.fixup_alt_jump
++ ? COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.fixup_alt_jump - 1
++ : 0;
++ laststart = COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.laststart_offset;
++ this_group_regnum = COMPILE_STACK_TOP.regnum;
++ /* If we've reached MAX_REGNUM groups, then this open
++ won't actually generate any code, so we'll have to
++ clear pending_exact explicitly. */
++ pending_exact = 0;
++
++ /* We're at the end of the group, so now we know how many
++ groups were inside this one. */
++ if (this_group_regnum <= MAX_REGNUM)
++ {
++ UCHAR_T *inner_group_loc
++ = COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.inner_group_offset;
++
++ *inner_group_loc = regnum - this_group_regnum;
++ BUF_PUSH_3 (stop_memory, this_group_regnum,
++ regnum - this_group_regnum);
++ }
++ }
++ break;
++
++
++ case '|': /* `\|'. */
++ if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR)
++ goto normal_backslash;
++ handle_alt:
++ if (syntax & RE_LIMITED_OPS)
++ goto normal_char;
++
++ /* Insert before the previous alternative a jump which
++ jumps to this alternative if the former fails. */
++ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
++ INSERT_JUMP (on_failure_jump, begalt,
++ b + 2 + 2 * OFFSET_ADDRESS_SIZE);
++ pending_exact = 0;
++ b += 1 + OFFSET_ADDRESS_SIZE;
++
++ /* The alternative before this one has a jump after it
++ which gets executed if it gets matched. Adjust that
++ jump so it will jump to this alternative's analogous
++ jump (put in below, which in turn will jump to the next
++ (if any) alternative's such jump, etc.). The last such
++ jump jumps to the correct final destination. A picture:
++ _____ _____
++ | | | |
++ | v | v
++ a | b | c
++
++ If we are at `b', then fixup_alt_jump right now points to a
++ three-byte space after `a'. We'll put in the jump, set
++ fixup_alt_jump to right after `b', and leave behind three
++ bytes which we'll fill in when we get to after `c'. */
++
++ if (fixup_alt_jump)
++ STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
++
++ /* Mark and leave space for a jump after this alternative,
++ to be filled in later either by next alternative or
++ when know we're at the end of a series of alternatives. */
++ fixup_alt_jump = b;
++ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
++ b += 1 + OFFSET_ADDRESS_SIZE;
++
++ laststart = 0;
++ begalt = b;
++ break;
++
++
++ case '{':
++ /* If \{ is a literal. */
++ if (!(syntax & RE_INTERVALS)
++ /* If we're at `\{' and it's not the open-interval
++ operator. */
++ || (syntax & RE_NO_BK_BRACES))
++ goto normal_backslash;
++
++ handle_interval:
++ {
++ /* If got here, then the syntax allows intervals. */
++
++ /* At least (most) this many matches must be made. */
++ int lower_bound = -1, upper_bound = -1;
++
++ /* Place in the uncompiled pattern (i.e., just after
++ the '{') to go back to if the interval is invalid. */
++ const CHAR_T *beg_interval = p;
++
++ if (p == pend)
++ goto invalid_interval;
++
++ GET_UNSIGNED_NUMBER (lower_bound);
++
++ if (c == ',')
++ {
++ GET_UNSIGNED_NUMBER (upper_bound);
++ if (upper_bound < 0)
++ upper_bound = RE_DUP_MAX;
++ }
++ else
++ /* Interval such as `{1}' => match exactly once. */
++ upper_bound = lower_bound;
++
++ if (! (0 <= lower_bound && lower_bound <= upper_bound))
++ goto invalid_interval;
++
++ if (!(syntax & RE_NO_BK_BRACES))
++ {
++ if (c != '\\' || p == pend)
++ goto invalid_interval;
++ PATFETCH (c);
++ }
++
++ if (c != '}')
++ goto invalid_interval;
++
++ /* If it's invalid to have no preceding re. */
++ if (!laststart)
++ {
++ if (syntax & RE_CONTEXT_INVALID_OPS
++ && !(syntax & RE_INVALID_INTERVAL_ORD))
++ FREE_STACK_RETURN (REG_BADRPT);
++ else if (syntax & RE_CONTEXT_INDEP_OPS)
++ laststart = b;
++ else
++ goto unfetch_interval;
++ }
++
++ /* We just parsed a valid interval. */
++
++ if (RE_DUP_MAX < upper_bound)
++ FREE_STACK_RETURN (REG_BADBR);
++
++ /* If the upper bound is zero, don't want to succeed at
++ all; jump from `laststart' to `b + 3', which will be
++ the end of the buffer after we insert the jump. */
++ /* ifdef WCHAR, 'b + 1 + OFFSET_ADDRESS_SIZE'
++ instead of 'b + 3'. */
++ if (upper_bound == 0)
++ {
++ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
++ INSERT_JUMP (jump, laststart, b + 1
++ + OFFSET_ADDRESS_SIZE);
++ b += 1 + OFFSET_ADDRESS_SIZE;
++ }
++
++ /* Otherwise, we have a nontrivial interval. When
++ we're all done, the pattern will look like:
++ set_number_at <jump count> <upper bound>
++ set_number_at <succeed_n count> <lower bound>
++ succeed_n <after jump addr> <succeed_n count>
++ <body of loop>
++ jump_n <succeed_n addr> <jump count>
++ (The upper bound and `jump_n' are omitted if
++ `upper_bound' is 1, though.) */
++ else
++ { /* If the upper bound is > 1, we need to insert
++ more at the end of the loop. */
++ unsigned nbytes = 2 + 4 * OFFSET_ADDRESS_SIZE +
++ (upper_bound > 1) * (2 + 4 * OFFSET_ADDRESS_SIZE);
++
++ GET_BUFFER_SPACE (nbytes);
++
++ /* Initialize lower bound of the `succeed_n', even
++ though it will be set during matching by its
++ attendant `set_number_at' (inserted next),
++ because `re_compile_fastmap' needs to know.
++ Jump to the `jump_n' we might insert below. */
++ INSERT_JUMP2 (succeed_n, laststart,
++ b + 1 + 2 * OFFSET_ADDRESS_SIZE
++ + (upper_bound > 1) * (1 + 2 * OFFSET_ADDRESS_SIZE)
++ , lower_bound);
++ b += 1 + 2 * OFFSET_ADDRESS_SIZE;
++
++ /* Code to initialize the lower bound. Insert
++ before the `succeed_n'. The `5' is the last two
++ bytes of this `set_number_at', plus 3 bytes of
++ the following `succeed_n'. */
++ /* ifdef WCHAR, The '1+2*OFFSET_ADDRESS_SIZE'
++ is the 'set_number_at', plus '1+OFFSET_ADDRESS_SIZE'
++ of the following `succeed_n'. */
++ PREFIX(insert_op2) (set_number_at, laststart, 1
++ + 2 * OFFSET_ADDRESS_SIZE, lower_bound, b);
++ b += 1 + 2 * OFFSET_ADDRESS_SIZE;
++
++ if (upper_bound > 1)
++ { /* More than one repetition is allowed, so
++ append a backward jump to the `succeed_n'
++ that starts this interval.
++
++ When we've reached this during matching,
++ we'll have matched the interval once, so
++ jump back only `upper_bound - 1' times. */
++ STORE_JUMP2 (jump_n, b, laststart
++ + 2 * OFFSET_ADDRESS_SIZE + 1,
++ upper_bound - 1);
++ b += 1 + 2 * OFFSET_ADDRESS_SIZE;
++
++ /* The location we want to set is the second
++ parameter of the `jump_n'; that is `b-2' as
++ an absolute address. `laststart' will be
++ the `set_number_at' we're about to insert;
++ `laststart+3' the number to set, the source
++ for the relative address. But we are
++ inserting into the middle of the pattern --
++ so everything is getting moved up by 5.
++ Conclusion: (b - 2) - (laststart + 3) + 5,
++ i.e., b - laststart.
++
++ We insert this at the beginning of the loop
++ so that if we fail during matching, we'll
++ reinitialize the bounds. */
++ PREFIX(insert_op2) (set_number_at, laststart,
++ b - laststart,
++ upper_bound - 1, b);
++ b += 1 + 2 * OFFSET_ADDRESS_SIZE;
++ }
++ }
++ pending_exact = 0;
++ break;
++
++ invalid_interval:
++ if (!(syntax & RE_INVALID_INTERVAL_ORD))
++ FREE_STACK_RETURN (p == pend ? REG_EBRACE : REG_BADBR);
++ unfetch_interval:
++ /* Match the characters as literals. */
++ p = beg_interval;
++ c = '{';
++ if (syntax & RE_NO_BK_BRACES)
++ goto normal_char;
++ else
++ goto normal_backslash;
++ }
++
++#ifdef emacs
++ /* There is no way to specify the before_dot and after_dot
++ operators. rms says this is ok. --karl */
++ case '=':
++ BUF_PUSH (at_dot);
++ break;
++
++ case 's':
++ laststart = b;
++ PATFETCH (c);
++ BUF_PUSH_2 (syntaxspec, syntax_spec_code[c]);
++ break;
++
++ case 'S':
++ laststart = b;
++ PATFETCH (c);
++ BUF_PUSH_2 (notsyntaxspec, syntax_spec_code[c]);
++ break;
++#endif /* emacs */
++
++
++ case 'w':
++ if (syntax & RE_NO_GNU_OPS)
++ goto normal_char;
++ laststart = b;
++ BUF_PUSH (wordchar);
++ break;
++
++
++ case 'W':
++ if (syntax & RE_NO_GNU_OPS)
++ goto normal_char;
++ laststart = b;
++ BUF_PUSH (notwordchar);
++ break;
++
++
++ case '<':
++ if (syntax & RE_NO_GNU_OPS)
++ goto normal_char;
++ BUF_PUSH (wordbeg);
++ break;
++
++ case '>':
++ if (syntax & RE_NO_GNU_OPS)
++ goto normal_char;
++ BUF_PUSH (wordend);
++ break;
++
++ case 'b':
++ if (syntax & RE_NO_GNU_OPS)
++ goto normal_char;
++ BUF_PUSH (wordbound);
++ break;
++
++ case 'B':
++ if (syntax & RE_NO_GNU_OPS)
++ goto normal_char;
++ BUF_PUSH (notwordbound);
++ break;
++
++ case '`':
++ if (syntax & RE_NO_GNU_OPS)
++ goto normal_char;
++ BUF_PUSH (begbuf);
++ break;
++
++ case '\'':
++ if (syntax & RE_NO_GNU_OPS)
++ goto normal_char;
++ BUF_PUSH (endbuf);
++ break;
++
++ case '1': case '2': case '3': case '4': case '5':
++ case '6': case '7': case '8': case '9':
++ if (syntax & RE_NO_BK_REFS)
++ goto normal_char;
++
++ c1 = c - '0';
++
++ if (c1 > regnum)
++ FREE_STACK_RETURN (REG_ESUBREG);
++
++ /* Can't back reference to a subexpression if inside of it. */
++ if (group_in_compile_stack (compile_stack, (regnum_t) c1))
++ goto normal_char;
++
++ laststart = b;
++ BUF_PUSH_2 (duplicate, c1);
++ break;
++
++
++ case '+':
++ case '?':
++ if (syntax & RE_BK_PLUS_QM)
++ goto handle_plus;
++ else
++ goto normal_backslash;
++
++ default:
++ normal_backslash:
++ /* You might think it would be useful for \ to mean
++ not to translate; but if we don't translate it
++ it will never match anything. */
++ c = TRANSLATE (c);
++ goto normal_char;
++ }
++ break;
++
++
++ default:
++ /* Expects the character in `c'. */
++ normal_char:
++ /* If no exactn currently being built. */
++ if (!pending_exact
++#ifdef WCHAR
++ /* If last exactn handle binary(or character) and
++ new exactn handle character(or binary). */
++ || is_exactn_bin != is_binary[p - 1 - pattern]
++#endif /* WCHAR */
++
++ /* If last exactn not at current position. */
++ || pending_exact + *pending_exact + 1 != b
++
++ /* We have only one byte following the exactn for the count. */
++ || *pending_exact == (1 << BYTEWIDTH) - 1
++
++ /* If followed by a repetition operator. */
++ || *p == '*' || *p == '^'
++ || ((syntax & RE_BK_PLUS_QM)
++ ? *p == '\\' && (p[1] == '+' || p[1] == '?')
++ : (*p == '+' || *p == '?'))
++ || ((syntax & RE_INTERVALS)
++ && ((syntax & RE_NO_BK_BRACES)
++ ? *p == '{'
++ : (p[0] == '\\' && p[1] == '{'))))
++ {
++ /* Start building a new exactn. */
++
++ laststart = b;
++
++#ifdef WCHAR
++ /* Is this exactn binary data or character? */
++ is_exactn_bin = is_binary[p - 1 - pattern];
++ if (is_exactn_bin)
++ BUF_PUSH_2 (exactn_bin, 0);
++ else
++ BUF_PUSH_2 (exactn, 0);
++#else
++ BUF_PUSH_2 (exactn, 0);
++#endif /* WCHAR */
++ pending_exact = b - 1;
++ }
++
++ BUF_PUSH (c);
++ (*pending_exact)++;
++ break;
++ } /* switch (c) */
++ } /* while p != pend */
++
++
++ /* Through the pattern now. */
++
++ if (fixup_alt_jump)
++ STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
++
++ if (!COMPILE_STACK_EMPTY)
++ FREE_STACK_RETURN (REG_EPAREN);
++
++ /* If we don't want backtracking, force success
++ the first time we reach the end of the compiled pattern. */
++ if (syntax & RE_NO_POSIX_BACKTRACKING)
++ BUF_PUSH (succeed);
++
++#ifdef WCHAR
++ free (pattern);
++ free (mbs_offset);
++ free (is_binary);
++#endif
++ free (compile_stack.stack);
++
++ /* We have succeeded; set the length of the buffer. */
++#ifdef WCHAR
++ bufp->used = (uintptr_t) b - (uintptr_t) COMPILED_BUFFER_VAR;
++#else
++ bufp->used = b - bufp->buffer;
++#endif
++
++#ifdef DEBUG
++ if (debug)
++ {
++ DEBUG_PRINT1 ("\nCompiled pattern: \n");
++ PREFIX(print_compiled_pattern) (bufp);
++ }
++#endif /* DEBUG */
++
++#ifndef MATCH_MAY_ALLOCATE
++ /* Initialize the failure stack to the largest possible stack. This
++ isn't necessary unless we're trying to avoid calling alloca in
++ the search and match routines. */
++ {
++ int num_regs = bufp->re_nsub + 1;
++
++ /* Since DOUBLE_FAIL_STACK refuses to double only if the current size
++ is strictly greater than re_max_failures, the largest possible stack
++ is 2 * re_max_failures failure points. */
++ if (fail_stack.size < (2 * re_max_failures * MAX_FAILURE_ITEMS))
++ {
++ fail_stack.size = (2 * re_max_failures * MAX_FAILURE_ITEMS);
++
++# ifdef emacs
++ if (! fail_stack.stack)
++ fail_stack.stack
++ = (PREFIX(fail_stack_elt_t) *) xmalloc (fail_stack.size
++ * sizeof (PREFIX(fail_stack_elt_t)));
++ else
++ fail_stack.stack
++ = (PREFIX(fail_stack_elt_t) *) xrealloc (fail_stack.stack,
++ (fail_stack.size
++ * sizeof (PREFIX(fail_stack_elt_t))));
++# else /* not emacs */
++ if (! fail_stack.stack)
++ fail_stack.stack
++ = (PREFIX(fail_stack_elt_t) *) malloc (fail_stack.size
++ * sizeof (PREFIX(fail_stack_elt_t)));
++ else
++ fail_stack.stack
++ = (PREFIX(fail_stack_elt_t) *) realloc (fail_stack.stack,
++ (fail_stack.size
++ * sizeof (PREFIX(fail_stack_elt_t))));
++# endif /* not emacs */
++ }
++
++ PREFIX(regex_grow_registers) (num_regs);
++ }
++#endif /* not MATCH_MAY_ALLOCATE */
++
++ return REG_NOERROR;
++} /* regex_compile */
++
++/* Subroutines for `regex_compile'. */
++
++/* Store OP at LOC followed by two-byte integer parameter ARG. */
++/* ifdef WCHAR, integer parameter is 1 wchar_t. */
++
++static void
++PREFIX(store_op1) (re_opcode_t op, UCHAR_T *loc, int arg)
++{
++ *loc = (UCHAR_T) op;
++ STORE_NUMBER (loc + 1, arg);
++}
++
++
++/* Like `store_op1', but for two two-byte parameters ARG1 and ARG2. */
++/* ifdef WCHAR, integer parameter is 1 wchar_t. */
++
++static void
++PREFIX(store_op2) (re_opcode_t op, UCHAR_T *loc, int arg1, int arg2)
++{
++ *loc = (UCHAR_T) op;
++ STORE_NUMBER (loc + 1, arg1);
++ STORE_NUMBER (loc + 1 + OFFSET_ADDRESS_SIZE, arg2);
++}
++
++
++/* Copy the bytes from LOC to END to open up three bytes of space at LOC
++ for OP followed by two-byte integer parameter ARG. */
++/* ifdef WCHAR, integer parameter is 1 wchar_t. */
++
++static void
++PREFIX(insert_op1) (re_opcode_t op, UCHAR_T *loc, int arg, UCHAR_T *end)
++{
++ register UCHAR_T *pfrom = end;
++ register UCHAR_T *pto = end + 1 + OFFSET_ADDRESS_SIZE;
++
++ while (pfrom != loc)
++ *--pto = *--pfrom;
++
++ PREFIX(store_op1) (op, loc, arg);
++}
++
++
++/* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2. */
++/* ifdef WCHAR, integer parameter is 1 wchar_t. */
++
++static void
++PREFIX(insert_op2) (re_opcode_t op, UCHAR_T *loc, int arg1,
++ int arg2, UCHAR_T *end)
++{
++ register UCHAR_T *pfrom = end;
++ register UCHAR_T *pto = end + 1 + 2 * OFFSET_ADDRESS_SIZE;
++
++ while (pfrom != loc)
++ *--pto = *--pfrom;
++
++ PREFIX(store_op2) (op, loc, arg1, arg2);
++}
++
++
++/* P points to just after a ^ in PATTERN. Return true if that ^ comes
++ after an alternative or a begin-subexpression. We assume there is at
++ least one character before the ^. */
++
++static boolean
++PREFIX(at_begline_loc_p) (const CHAR_T *pattern, const CHAR_T *p,
++ reg_syntax_t syntax)
++{
++ const CHAR_T *prev = p - 2;
++ boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\';
++
++ return
++ /* After a subexpression? */
++ (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash))
++ /* After an alternative? */
++ || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash));
++}
++
++
++/* The dual of at_begline_loc_p. This one is for $. We assume there is
++ at least one character after the $, i.e., `P < PEND'. */
++
++static boolean
++PREFIX(at_endline_loc_p) (const CHAR_T *p, const CHAR_T *pend,
++ reg_syntax_t syntax)
++{
++ const CHAR_T *next = p;
++ boolean next_backslash = *next == '\\';
++ const CHAR_T *next_next = p + 1 < pend ? p + 1 : 0;
++
++ return
++ /* Before a subexpression? */
++ (syntax & RE_NO_BK_PARENS ? *next == ')'
++ : next_backslash && next_next && *next_next == ')')
++ /* Before an alternative? */
++ || (syntax & RE_NO_BK_VBAR ? *next == '|'
++ : next_backslash && next_next && *next_next == '|');
++}
++
++#else /* not INSIDE_RECURSION */
++
++/* Returns true if REGNUM is in one of COMPILE_STACK's elements and
++ false if it's not. */
++
++static boolean
++group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum)
++{
++ int this_element;
++
++ for (this_element = compile_stack.avail - 1;
++ this_element >= 0;
++ this_element--)
++ if (compile_stack.stack[this_element].regnum == regnum)
++ return true;
++
++ return false;
++}
++#endif /* not INSIDE_RECURSION */
++
++#ifdef INSIDE_RECURSION
++
++#ifdef WCHAR
++/* This insert space, which size is "num", into the pattern at "loc".
++ "end" must point the end of the allocated buffer. */
++static void
++insert_space (int num, CHAR_T *loc, CHAR_T *end)
++{
++ register CHAR_T *pto = end;
++ register CHAR_T *pfrom = end - num;
++
++ while (pfrom >= loc)
++ *pto-- = *pfrom--;
++}
++#endif /* WCHAR */
++
++#ifdef WCHAR
++static reg_errcode_t
++wcs_compile_range (CHAR_T range_start_char, const CHAR_T **p_ptr,
++ const CHAR_T *pend, RE_TRANSLATE_TYPE translate,
++ reg_syntax_t syntax, CHAR_T *b, CHAR_T *char_set)
++{
++ const CHAR_T *p = *p_ptr;
++ CHAR_T range_start, range_end;
++ reg_errcode_t ret;
++# ifdef _LIBC
++ uint32_t nrules;
++ uint32_t start_val, end_val;
++# endif
++ if (p == pend)
++ return REG_ERANGE;
++
++# ifdef _LIBC
++ nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
++ if (nrules != 0)
++ {
++ const char *collseq = (const char *) _NL_CURRENT(LC_COLLATE,
++ _NL_COLLATE_COLLSEQWC);
++ const unsigned char *extra = (const unsigned char *)
++ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
++
++ if (range_start_char < -1)
++ {
++ /* range_start is a collating symbol. */
++ int32_t *wextra;
++ /* Retreive the index and get collation sequence value. */
++ wextra = (int32_t*)(extra + char_set[-range_start_char]);
++ start_val = wextra[1 + *wextra];
++ }
++ else
++ start_val = collseq_table_lookup(collseq, TRANSLATE(range_start_char));
++
++ end_val = collseq_table_lookup (collseq, TRANSLATE (p[0]));
++
++ /* Report an error if the range is empty and the syntax prohibits
++ this. */
++ ret = ((syntax & RE_NO_EMPTY_RANGES)
++ && (start_val > end_val))? REG_ERANGE : REG_NOERROR;
++
++ /* Insert space to the end of the char_ranges. */
++ insert_space(2, b - char_set[5] - 2, b - 1);
++ *(b - char_set[5] - 2) = (wchar_t)start_val;
++ *(b - char_set[5] - 1) = (wchar_t)end_val;
++ char_set[4]++; /* ranges_index */
++ }
++ else
++# endif
++ {
++ range_start = (range_start_char >= 0)? TRANSLATE (range_start_char):
++ range_start_char;
++ range_end = TRANSLATE (p[0]);
++ /* Report an error if the range is empty and the syntax prohibits
++ this. */
++ ret = ((syntax & RE_NO_EMPTY_RANGES)
++ && (range_start > range_end))? REG_ERANGE : REG_NOERROR;
++
++ /* Insert space to the end of the char_ranges. */
++ insert_space(2, b - char_set[5] - 2, b - 1);
++ *(b - char_set[5] - 2) = range_start;
++ *(b - char_set[5] - 1) = range_end;
++ char_set[4]++; /* ranges_index */
++ }
++ /* Have to increment the pointer into the pattern string, so the
++ caller isn't still at the ending character. */
++ (*p_ptr)++;
++
++ return ret;
++}
++#else /* BYTE */
++/* Read the ending character of a range (in a bracket expression) from the
++ uncompiled pattern *P_PTR (which ends at PEND). We assume the
++ starting character is in `P[-2]'. (`P[-1]' is the character `-'.)
++ Then we set the translation of all bits between the starting and
++ ending characters (inclusive) in the compiled pattern B.
++
++ Return an error code.
++
++ We use these short variable names so we can use the same macros as
++ `regex_compile' itself. */
++
++static reg_errcode_t
++byte_compile_range (unsigned int range_start_char, const char **p_ptr,
++ const char *pend, RE_TRANSLATE_TYPE translate,
++ reg_syntax_t syntax, unsigned char *b)
++{
++ unsigned this_char;
++ const char *p = *p_ptr;
++ reg_errcode_t ret;
++# if _LIBC
++ const unsigned char *collseq;
++ unsigned int start_colseq;
++ unsigned int end_colseq;
++# else
++ unsigned end_char;
++# endif
++
++ if (p == pend)
++ return REG_ERANGE;
++
++ /* Have to increment the pointer into the pattern string, so the
++ caller isn't still at the ending character. */
++ (*p_ptr)++;
++
++ /* Report an error if the range is empty and the syntax prohibits this. */
++ ret = syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR;
++
++# if _LIBC
++ collseq = (const unsigned char *) _NL_CURRENT (LC_COLLATE,
++ _NL_COLLATE_COLLSEQMB);
++
++ start_colseq = collseq[(unsigned char) TRANSLATE (range_start_char)];
++ end_colseq = collseq[(unsigned char) TRANSLATE (p[0])];
++ for (this_char = 0; this_char <= (unsigned char) -1; ++this_char)
++ {
++ unsigned int this_colseq = collseq[(unsigned char) TRANSLATE (this_char)];
++
++ if (start_colseq <= this_colseq && this_colseq <= end_colseq)
++ {
++ SET_LIST_BIT (TRANSLATE (this_char));
++ ret = REG_NOERROR;
++ }
++ }
++# else
++ /* Here we see why `this_char' has to be larger than an `unsigned
++ char' -- we would otherwise go into an infinite loop, since all
++ characters <= 0xff. */
++ range_start_char = TRANSLATE (range_start_char);
++ /* TRANSLATE(p[0]) is casted to char (not unsigned char) in TRANSLATE,
++ and some compilers cast it to int implicitly, so following for_loop
++ may fall to (almost) infinite loop.
++ e.g. If translate[p[0]] = 0xff, end_char may equals to 0xffffffff.
++ To avoid this, we cast p[0] to unsigned int and truncate it. */
++ end_char = ((unsigned)TRANSLATE(p[0]) & ((1 << BYTEWIDTH) - 1));
++
++ for (this_char = range_start_char; this_char <= end_char; ++this_char)
++ {
++ SET_LIST_BIT (TRANSLATE (this_char));
++ ret = REG_NOERROR;
++ }
++# endif
++
++ return ret;
++}
++#endif /* WCHAR */
++
++/* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in
++ BUFP. A fastmap records which of the (1 << BYTEWIDTH) possible
++ characters can start a string that matches the pattern. This fastmap
++ is used by re_search to skip quickly over impossible starting points.
++
++ The caller must supply the address of a (1 << BYTEWIDTH)-byte data
++ area as BUFP->fastmap.
++
++ We set the `fastmap', `fastmap_accurate', and `can_be_null' fields in
++ the pattern buffer.
++
++ Returns 0 if we succeed, -2 if an internal error. */
++
++#ifdef WCHAR
++/* local function for re_compile_fastmap.
++ truncate wchar_t character to char. */
++static unsigned char truncate_wchar (CHAR_T c);
++
++static unsigned char
++truncate_wchar (CHAR_T c)
++{
++ unsigned char buf[MB_CUR_MAX];
++ mbstate_t state;
++ int retval;
++ memset (&state, '\0', sizeof (state));
++# ifdef _LIBC
++ retval = __wcrtomb (buf, c, &state);
++# else
++ retval = wcrtomb (buf, c, &state);
++# endif
++ return retval > 0 ? buf[0] : (unsigned char) c;
++}
++#endif /* WCHAR */
++
++static int
++PREFIX(re_compile_fastmap) (struct re_pattern_buffer *bufp)
++{
++ int j, k;
++#ifdef MATCH_MAY_ALLOCATE
++ PREFIX(fail_stack_type) fail_stack;
++#endif
++#ifndef REGEX_MALLOC
++ char *destination;
++#endif
++
++ register char *fastmap = bufp->fastmap;
++
++#ifdef WCHAR
++ /* We need to cast pattern to (wchar_t*), because we casted this compiled
++ pattern to (char*) in regex_compile. */
++ UCHAR_T *pattern = (UCHAR_T*)bufp->buffer;
++ register UCHAR_T *pend = (UCHAR_T*) (bufp->buffer + bufp->used);
++#else /* BYTE */
++ UCHAR_T *pattern = bufp->buffer;
++ register UCHAR_T *pend = pattern + bufp->used;
++#endif /* WCHAR */
++ UCHAR_T *p = pattern;
++
++#ifdef REL_ALLOC
++ /* This holds the pointer to the failure stack, when
++ it is allocated relocatably. */
++ fail_stack_elt_t *failure_stack_ptr;
++#endif
++
++ /* Assume that each path through the pattern can be null until
++ proven otherwise. We set this false at the bottom of switch
++ statement, to which we get only if a particular path doesn't
++ match the empty string. */
++ boolean path_can_be_null = true;
++
++ /* We aren't doing a `succeed_n' to begin with. */
++ boolean succeed_n_p = false;
++
++ assert (fastmap != NULL && p != NULL);
++
++ INIT_FAIL_STACK ();
++ bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */
++ bufp->fastmap_accurate = 1; /* It will be when we're done. */
++ bufp->can_be_null = 0;
++
++ while (1)
++ {
++ if (p == pend || *p == (UCHAR_T) succeed)
++ {
++ /* We have reached the (effective) end of pattern. */
++ if (!FAIL_STACK_EMPTY ())
++ {
++ bufp->can_be_null |= path_can_be_null;
++
++ /* Reset for next path. */
++ path_can_be_null = true;
++
++ p = fail_stack.stack[--fail_stack.avail].pointer;
++
++ continue;
++ }
++ else
++ break;
++ }
++
++ /* We should never be about to go beyond the end of the pattern. */
++ assert (p < pend);
++
++ switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++))
++ {
++
++ /* I guess the idea here is to simply not bother with a fastmap
++ if a backreference is used, since it's too hard to figure out
++ the fastmap for the corresponding group. Setting
++ `can_be_null' stops `re_search_2' from using the fastmap, so
++ that is all we do. */
++ case duplicate:
++ bufp->can_be_null = 1;
++ goto done;
++
++
++ /* Following are the cases which match a character. These end
++ with `break'. */
++
++#ifdef WCHAR
++ case exactn:
++ fastmap[truncate_wchar(p[1])] = 1;
++ break;
++#else /* BYTE */
++ case exactn:
++ fastmap[p[1]] = 1;
++ break;
++#endif /* WCHAR */
++#ifdef MBS_SUPPORT
++ case exactn_bin:
++ fastmap[p[1]] = 1;
++ break;
++#endif
++
++#ifdef WCHAR
++ /* It is hard to distinguish fastmap from (multi byte) characters
++ which depends on current locale. */
++ case charset:
++ case charset_not:
++ case wordchar:
++ case notwordchar:
++ bufp->can_be_null = 1;
++ goto done;
++#else /* BYTE */
++ case charset:
++ for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
++ if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
++ fastmap[j] = 1;
++ break;
++
++
++ case charset_not:
++ /* Chars beyond end of map must be allowed. */
++ for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++)
++ fastmap[j] = 1;
++
++ for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
++ if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
++ fastmap[j] = 1;
++ break;
++
++
++ case wordchar:
++ for (j = 0; j < (1 << BYTEWIDTH); j++)
++ if (SYNTAX (j) == Sword)
++ fastmap[j] = 1;
++ break;
++
++
++ case notwordchar:
++ for (j = 0; j < (1 << BYTEWIDTH); j++)
++ if (SYNTAX (j) != Sword)
++ fastmap[j] = 1;
++ break;
++#endif /* WCHAR */
++
++ case anychar:
++ {
++ int fastmap_newline = fastmap['\n'];
++
++ /* `.' matches anything ... */
++ for (j = 0; j < (1 << BYTEWIDTH); j++)
++ fastmap[j] = 1;
++
++ /* ... except perhaps newline. */
++ if (!(bufp->syntax & RE_DOT_NEWLINE))
++ fastmap['\n'] = fastmap_newline;
++
++ /* Return if we have already set `can_be_null'; if we have,
++ then the fastmap is irrelevant. Something's wrong here. */
++ else if (bufp->can_be_null)
++ goto done;
++
++ /* Otherwise, have to check alternative paths. */
++ break;
++ }
++
++#ifdef emacs
++ case syntaxspec:
++ k = *p++;
++ for (j = 0; j < (1 << BYTEWIDTH); j++)
++ if (SYNTAX (j) == (enum syntaxcode) k)
++ fastmap[j] = 1;
++ break;
++
++
++ case notsyntaxspec:
++ k = *p++;
++ for (j = 0; j < (1 << BYTEWIDTH); j++)
++ if (SYNTAX (j) != (enum syntaxcode) k)
++ fastmap[j] = 1;
++ break;
++
++
++ /* All cases after this match the empty string. These end with
++ `continue'. */
++
++
++ case before_dot:
++ case at_dot:
++ case after_dot:
++ continue;
++#endif /* emacs */
++
++
++ case no_op:
++ case begline:
++ case endline:
++ case begbuf:
++ case endbuf:
++ case wordbound:
++ case notwordbound:
++ case wordbeg:
++ case wordend:
++ case push_dummy_failure:
++ continue;
++
++
++ case jump_n:
++ case pop_failure_jump:
++ case maybe_pop_jump:
++ case jump:
++ case jump_past_alt:
++ case dummy_failure_jump:
++ EXTRACT_NUMBER_AND_INCR (j, p);
++ p += j;
++ if (j > 0)
++ continue;
++
++ /* Jump backward implies we just went through the body of a
++ loop and matched nothing. Opcode jumped to should be
++ `on_failure_jump' or `succeed_n'. Just treat it like an
++ ordinary jump. For a * loop, it has pushed its failure
++ point already; if so, discard that as redundant. */
++ if ((re_opcode_t) *p != on_failure_jump
++ && (re_opcode_t) *p != succeed_n)
++ continue;
++
++ p++;
++ EXTRACT_NUMBER_AND_INCR (j, p);
++ p += j;
++
++ /* If what's on the stack is where we are now, pop it. */
++ if (!FAIL_STACK_EMPTY ()
++ && fail_stack.stack[fail_stack.avail - 1].pointer == p)
++ fail_stack.avail--;
++
++ continue;
++
++
++ case on_failure_jump:
++ case on_failure_keep_string_jump:
++ handle_on_failure_jump:
++ EXTRACT_NUMBER_AND_INCR (j, p);
++
++ /* For some patterns, e.g., `(a?)?', `p+j' here points to the
++ end of the pattern. We don't want to push such a point,
++ since when we restore it above, entering the switch will
++ increment `p' past the end of the pattern. We don't need
++ to push such a point since we obviously won't find any more
++ fastmap entries beyond `pend'. Such a pattern can match
++ the null string, though. */
++ if (p + j < pend)
++ {
++ if (!PUSH_PATTERN_OP (p + j, fail_stack))
++ {
++ RESET_FAIL_STACK ();
++ return -2;
++ }
++ }
++ else
++ bufp->can_be_null = 1;
++
++ if (succeed_n_p)
++ {
++ EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */
++ succeed_n_p = false;
++ }
++
++ continue;
++
++
++ case succeed_n:
++ /* Get to the number of times to succeed. */
++ p += OFFSET_ADDRESS_SIZE;
++
++ /* Increment p past the n for when k != 0. */
++ EXTRACT_NUMBER_AND_INCR (k, p);
++ if (k == 0)
++ {
++ p -= 2 * OFFSET_ADDRESS_SIZE;
++ succeed_n_p = true; /* Spaghetti code alert. */
++ goto handle_on_failure_jump;
++ }
++ continue;
++
++
++ case set_number_at:
++ p += 2 * OFFSET_ADDRESS_SIZE;
++ continue;
++
++
++ case start_memory:
++ case stop_memory:
++ p += 2;
++ continue;
++
++
++ default:
++ abort (); /* We have listed all the cases. */
++ } /* switch *p++ */
++
++ /* Getting here means we have found the possible starting
++ characters for one path of the pattern -- and that the empty
++ string does not match. We need not follow this path further.
++ Instead, look at the next alternative (remembered on the
++ stack), or quit if no more. The test at the top of the loop
++ does these things. */
++ path_can_be_null = false;
++ p = pend;
++ } /* while p */
++
++ /* Set `can_be_null' for the last path (also the first path, if the
++ pattern is empty). */
++ bufp->can_be_null |= path_can_be_null;
++
++ done:
++ RESET_FAIL_STACK ();
++ return 0;
++}
++
++#else /* not INSIDE_RECURSION */
++
++int
++re_compile_fastmap (struct re_pattern_buffer *bufp)
++{
++# ifdef MBS_SUPPORT
++ if (MB_CUR_MAX != 1)
++ return wcs_re_compile_fastmap(bufp);
++ else
++# endif
++ return byte_re_compile_fastmap(bufp);
++} /* re_compile_fastmap */
++#ifdef _LIBC
++weak_alias (__re_compile_fastmap, re_compile_fastmap)
++#endif
++
++
++/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
++ ENDS. Subsequent matches using PATTERN_BUFFER and REGS will use
++ this memory for recording register information. STARTS and ENDS
++ must be allocated using the malloc library routine, and must each
++ be at least NUM_REGS * sizeof (regoff_t) bytes long.
++
++ If NUM_REGS == 0, then subsequent matches should allocate their own
++ register data.
++
++ Unless this function is called, the first search or match using
++ PATTERN_BUFFER will allocate its own register data, without
++ freeing the old data. */
++
++void
++re_set_registers (struct re_pattern_buffer *bufp,
++ struct re_registers *regs, unsigned num_regs,
++ regoff_t *starts, regoff_t *ends)
++{
++ if (num_regs)
++ {
++ bufp->regs_allocated = REGS_REALLOCATE;
++ regs->num_regs = num_regs;
++ regs->start = starts;
++ regs->end = ends;
++ }
++ else
++ {
++ bufp->regs_allocated = REGS_UNALLOCATED;
++ regs->num_regs = 0;
++ regs->start = regs->end = (regoff_t *) 0;
++ }
++}
++#ifdef _LIBC
++weak_alias (__re_set_registers, re_set_registers)
++#endif
++
++/* Searching routines. */
++
++/* Like re_search_2, below, but only one string is specified, and
++ doesn't let you say where to stop matching. */
++
++int
++re_search (struct re_pattern_buffer *bufp, const char *string, int size,
++ int startpos, int range, struct re_registers *regs)
++{
++ return re_search_2 (bufp, NULL, 0, string, size, startpos, range,
++ regs, size);
++}
++#ifdef _LIBC
++weak_alias (__re_search, re_search)
++#endif
++
++
++/* Using the compiled pattern in BUFP->buffer, first tries to match the
++ virtual concatenation of STRING1 and STRING2, starting first at index
++ STARTPOS, then at STARTPOS + 1, and so on.
++
++ STRING1 and STRING2 have length SIZE1 and SIZE2, respectively.
++
++ RANGE is how far to scan while trying to match. RANGE = 0 means try
++ only at STARTPOS; in general, the last start tried is STARTPOS +
++ RANGE.
++
++ In REGS, return the indices of the virtual concatenation of STRING1
++ and STRING2 that matched the entire BUFP->buffer and its contained
++ subexpressions.
++
++ Do not consider matching one past the index STOP in the virtual
++ concatenation of STRING1 and STRING2.
++
++ We return either the position in the strings at which the match was
++ found, -1 if no match, or -2 if error (such as failure
++ stack overflow). */
++
++int
++re_search_2 (struct re_pattern_buffer *bufp, const char *string1, int size1,
++ const char *string2, int size2, int startpos, int range,
++ struct re_registers *regs, int stop)
++{
++# ifdef MBS_SUPPORT
++ if (MB_CUR_MAX != 1)
++ return wcs_re_search_2 (bufp, string1, size1, string2, size2, startpos,
++ range, regs, stop);
++ else
++# endif
++ return byte_re_search_2 (bufp, string1, size1, string2, size2, startpos,
++ range, regs, stop);
++} /* re_search_2 */
++#ifdef _LIBC
++weak_alias (__re_search_2, re_search_2)
++#endif
++
++#endif /* not INSIDE_RECURSION */
++
++#ifdef INSIDE_RECURSION
++
++#ifdef MATCH_MAY_ALLOCATE
++# define FREE_VAR(var) if (var) REGEX_FREE (var); var = NULL
++#else
++# define FREE_VAR(var) if (var) free (var); var = NULL
++#endif
++
++#ifdef WCHAR
++# define MAX_ALLOCA_SIZE 2000
++
++# define FREE_WCS_BUFFERS() \
++ do { \
++ if (size1 > MAX_ALLOCA_SIZE) \
++ { \
++ free (wcs_string1); \
++ free (mbs_offset1); \
++ } \
++ else \
++ { \
++ FREE_VAR (wcs_string1); \
++ FREE_VAR (mbs_offset1); \
++ } \
++ if (size2 > MAX_ALLOCA_SIZE) \
++ { \
++ free (wcs_string2); \
++ free (mbs_offset2); \
++ } \
++ else \
++ { \
++ FREE_VAR (wcs_string2); \
++ FREE_VAR (mbs_offset2); \
++ } \
++ } while (0)
++
++#endif
++
++
++static int
++PREFIX(re_search_2) (struct re_pattern_buffer *bufp, const char *string1,
++ int size1, const char *string2, int size2,
++ int startpos, int range,
++ struct re_registers *regs, int stop)
++{
++ int val;
++ register char *fastmap = bufp->fastmap;
++ register RE_TRANSLATE_TYPE translate = bufp->translate;
++ int total_size = size1 + size2;
++ int endpos = startpos + range;
++#ifdef WCHAR
++ /* We need wchar_t* buffers correspond to cstring1, cstring2. */
++ wchar_t *wcs_string1 = NULL, *wcs_string2 = NULL;
++ /* We need the size of wchar_t buffers correspond to csize1, csize2. */
++ int wcs_size1 = 0, wcs_size2 = 0;
++ /* offset buffer for optimizatoin. See convert_mbs_to_wc. */
++ int *mbs_offset1 = NULL, *mbs_offset2 = NULL;
++ /* They hold whether each wchar_t is binary data or not. */
++ char *is_binary = NULL;
++#endif /* WCHAR */
++
++ /* Check for out-of-range STARTPOS. */
++ if (startpos < 0 || startpos > total_size)
++ return -1;
++
++ /* Fix up RANGE if it might eventually take us outside
++ the virtual concatenation of STRING1 and STRING2.
++ Make sure we won't move STARTPOS below 0 or above TOTAL_SIZE. */
++ if (endpos < 0)
++ range = 0 - startpos;
++ else if (endpos > total_size)
++ range = total_size - startpos;
++
++ /* If the search isn't to be a backwards one, don't waste time in a
++ search for a pattern that must be anchored. */
++ if (bufp->used > 0 && range > 0
++ && ((re_opcode_t) bufp->buffer[0] == begbuf
++ /* `begline' is like `begbuf' if it cannot match at newlines. */
++ || ((re_opcode_t) bufp->buffer[0] == begline
++ && !bufp->newline_anchor)))
++ {
++ if (startpos > 0)
++ return -1;
++ else
++ range = 1;
++ }
++
++#ifdef emacs
++ /* In a forward search for something that starts with \=.
++ don't keep searching past point. */
++ if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == at_dot && range > 0)
++ {
++ range = PT - startpos;
++ if (range <= 0)
++ return -1;
++ }
++#endif /* emacs */
++
++ /* Update the fastmap now if not correct already. */
++ if (fastmap && !bufp->fastmap_accurate)
++ if (re_compile_fastmap (bufp) == -2)
++ return -2;
++
++#ifdef WCHAR
++ /* Allocate wchar_t array for wcs_string1 and wcs_string2 and
++ fill them with converted string. */
++ if (size1 != 0)
++ {
++ if (size1 > MAX_ALLOCA_SIZE)
++ {
++ wcs_string1 = TALLOC (size1 + 1, CHAR_T);
++ mbs_offset1 = TALLOC (size1 + 1, int);
++ is_binary = TALLOC (size1 + 1, char);
++ }
++ else
++ {
++ wcs_string1 = REGEX_TALLOC (size1 + 1, CHAR_T);
++ mbs_offset1 = REGEX_TALLOC (size1 + 1, int);
++ is_binary = REGEX_TALLOC (size1 + 1, char);
++ }
++ if (!wcs_string1 || !mbs_offset1 || !is_binary)
++ {
++ if (size1 > MAX_ALLOCA_SIZE)
++ {
++ free (wcs_string1);
++ free (mbs_offset1);
++ free (is_binary);
++ }
++ else
++ {
++ FREE_VAR (wcs_string1);
++ FREE_VAR (mbs_offset1);
++ FREE_VAR (is_binary);
++ }
++ return -2;
++ }
++ wcs_size1 = convert_mbs_to_wcs(wcs_string1, string1, size1,
++ mbs_offset1, is_binary);
++ wcs_string1[wcs_size1] = L'\0'; /* for a sentinel */
++ if (size1 > MAX_ALLOCA_SIZE)
++ free (is_binary);
++ else
++ FREE_VAR (is_binary);
++ }
++ if (size2 != 0)
++ {
++ if (size2 > MAX_ALLOCA_SIZE)
++ {
++ wcs_string2 = TALLOC (size2 + 1, CHAR_T);
++ mbs_offset2 = TALLOC (size2 + 1, int);
++ is_binary = TALLOC (size2 + 1, char);
++ }
++ else
++ {
++ wcs_string2 = REGEX_TALLOC (size2 + 1, CHAR_T);
++ mbs_offset2 = REGEX_TALLOC (size2 + 1, int);
++ is_binary = REGEX_TALLOC (size2 + 1, char);
++ }
++ if (!wcs_string2 || !mbs_offset2 || !is_binary)
++ {
++ FREE_WCS_BUFFERS ();
++ if (size2 > MAX_ALLOCA_SIZE)
++ free (is_binary);
++ else
++ FREE_VAR (is_binary);
++ return -2;
++ }
++ wcs_size2 = convert_mbs_to_wcs(wcs_string2, string2, size2,
++ mbs_offset2, is_binary);
++ wcs_string2[wcs_size2] = L'\0'; /* for a sentinel */
++ if (size2 > MAX_ALLOCA_SIZE)
++ free (is_binary);
++ else
++ FREE_VAR (is_binary);
++ }
++#endif /* WCHAR */
++
++
++ /* Loop through the string, looking for a place to start matching. */
++ for (;;)
++ {
++ /* If a fastmap is supplied, skip quickly over characters that
++ cannot be the start of a match. If the pattern can match the
++ null string, however, we don't need to skip characters; we want
++ the first null string. */
++ if (fastmap && startpos < total_size && !bufp->can_be_null)
++ {
++ if (range > 0) /* Searching forwards. */
++ {
++ register const char *d;
++ register int lim = 0;
++ int irange = range;
++
++ if (startpos < size1 && startpos + range >= size1)
++ lim = range - (size1 - startpos);
++
++ d = (startpos >= size1 ? string2 - size1 : string1) + startpos;
++
++ /* Written out as an if-else to avoid testing `translate'
++ inside the loop. */
++ if (translate)
++ while (range > lim
++ && !fastmap[(unsigned char)
++ translate[(unsigned char) *d++]])
++ range--;
++ else
++ while (range > lim && !fastmap[(unsigned char) *d++])
++ range--;
++
++ startpos += irange - range;
++ }
++ else /* Searching backwards. */
++ {
++ register CHAR_T c = (size1 == 0 || startpos >= size1
++ ? string2[startpos - size1]
++ : string1[startpos]);
++
++ if (!fastmap[(unsigned char) TRANSLATE (c)])
++ goto advance;
++ }
++ }
++
++ /* If can't match the null string, and that's all we have left, fail. */
++ if (range >= 0 && startpos == total_size && fastmap
++ && !bufp->can_be_null)
++ {
++#ifdef WCHAR
++ FREE_WCS_BUFFERS ();
++#endif
++ return -1;
++ }
++
++#ifdef WCHAR
++ val = wcs_re_match_2_internal (bufp, string1, size1, string2,
++ size2, startpos, regs, stop,
++ wcs_string1, wcs_size1,
++ wcs_string2, wcs_size2,
++ mbs_offset1, mbs_offset2);
++#else /* BYTE */
++ val = byte_re_match_2_internal (bufp, string1, size1, string2,
++ size2, startpos, regs, stop);
++#endif /* BYTE */
++
++#ifndef REGEX_MALLOC
++# ifdef C_ALLOCA
++ alloca (0);
++# endif
++#endif
++
++ if (val >= 0)
++ {
++#ifdef WCHAR
++ FREE_WCS_BUFFERS ();
++#endif
++ return startpos;
++ }
++
++ if (val == -2)
++ {
++#ifdef WCHAR
++ FREE_WCS_BUFFERS ();
++#endif
++ return -2;
++ }
++
++ advance:
++ if (!range)
++ break;
++ else if (range > 0)
++ {
++ range--;
++ startpos++;
++ }
++ else
++ {
++ range++;
++ startpos--;
++ }
++ }
++#ifdef WCHAR
++ FREE_WCS_BUFFERS ();
++#endif
++ return -1;
++}
++
++#ifdef WCHAR
++/* This converts PTR, a pointer into one of the search wchar_t strings
++ `string1' and `string2' into an multibyte string offset from the
++ beginning of that string. We use mbs_offset to optimize.
++ See convert_mbs_to_wcs. */
++# define POINTER_TO_OFFSET(ptr) \
++ (FIRST_STRING_P (ptr) \
++ ? ((regoff_t)(mbs_offset1 != NULL? mbs_offset1[(ptr)-string1] : 0)) \
++ : ((regoff_t)((mbs_offset2 != NULL? mbs_offset2[(ptr)-string2] : 0) \
++ + csize1)))
++#else /* BYTE */
++/* This converts PTR, a pointer into one of the search strings `string1'
++ and `string2' into an offset from the beginning of that string. */
++# define POINTER_TO_OFFSET(ptr) \
++ (FIRST_STRING_P (ptr) \
++ ? ((regoff_t) ((ptr) - string1)) \
++ : ((regoff_t) ((ptr) - string2 + size1)))
++#endif /* WCHAR */
++
++/* Macros for dealing with the split strings in re_match_2. */
++
++#define MATCHING_IN_FIRST_STRING (dend == end_match_1)
++
++/* Call before fetching a character with *d. This switches over to
++ string2 if necessary. */
++#define PREFETCH() \
++ while (d == dend) \
++ { \
++ /* End of string2 => fail. */ \
++ if (dend == end_match_2) \
++ goto fail; \
++ /* End of string1 => advance to string2. */ \
++ d = string2; \
++ dend = end_match_2; \
++ }
++
++/* Test if at very beginning or at very end of the virtual concatenation
++ of `string1' and `string2'. If only one string, it's `string2'. */
++#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2)
++#define AT_STRINGS_END(d) ((d) == end2)
++
++
++/* Test if D points to a character which is word-constituent. We have
++ two special cases to check for: if past the end of string1, look at
++ the first character in string2; and if before the beginning of
++ string2, look at the last character in string1. */
++#ifdef WCHAR
++/* Use internationalized API instead of SYNTAX. */
++# define WORDCHAR_P(d) \
++ (iswalnum ((wint_t)((d) == end1 ? *string2 \
++ : (d) == string2 - 1 ? *(end1 - 1) : *(d))) != 0 \
++ || ((d) == end1 ? *string2 \
++ : (d) == string2 - 1 ? *(end1 - 1) : *(d)) == L'_')
++#else /* BYTE */
++# define WORDCHAR_P(d) \
++ (SYNTAX ((d) == end1 ? *string2 \
++ : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \
++ == Sword)
++#endif /* WCHAR */
++
++/* Disabled due to a compiler bug -- see comment at case wordbound */
++#if 0
++/* Test if the character before D and the one at D differ with respect
++ to being word-constituent. */
++#define AT_WORD_BOUNDARY(d) \
++ (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \
++ || WORDCHAR_P (d - 1) != WORDCHAR_P (d))
++#endif
++
++/* Free everything we malloc. */
++#ifdef MATCH_MAY_ALLOCATE
++# ifdef WCHAR
++# define FREE_VARIABLES() \
++ do { \
++ REGEX_FREE_STACK (fail_stack.stack); \
++ FREE_VAR (regstart); \
++ FREE_VAR (regend); \
++ FREE_VAR (old_regstart); \
++ FREE_VAR (old_regend); \
++ FREE_VAR (best_regstart); \
++ FREE_VAR (best_regend); \
++ FREE_VAR (reg_info); \
++ FREE_VAR (reg_dummy); \
++ FREE_VAR (reg_info_dummy); \
++ if (!cant_free_wcs_buf) \
++ { \
++ FREE_VAR (string1); \
++ FREE_VAR (string2); \
++ FREE_VAR (mbs_offset1); \
++ FREE_VAR (mbs_offset2); \
++ } \
++ } while (0)
++# else /* BYTE */
++# define FREE_VARIABLES() \
++ do { \
++ REGEX_FREE_STACK (fail_stack.stack); \
++ FREE_VAR (regstart); \
++ FREE_VAR (regend); \
++ FREE_VAR (old_regstart); \
++ FREE_VAR (old_regend); \
++ FREE_VAR (best_regstart); \
++ FREE_VAR (best_regend); \
++ FREE_VAR (reg_info); \
++ FREE_VAR (reg_dummy); \
++ FREE_VAR (reg_info_dummy); \
++ } while (0)
++# endif /* WCHAR */
++#else
++# ifdef WCHAR
++# define FREE_VARIABLES() \
++ do { \
++ if (!cant_free_wcs_buf) \
++ { \
++ FREE_VAR (string1); \
++ FREE_VAR (string2); \
++ FREE_VAR (mbs_offset1); \
++ FREE_VAR (mbs_offset2); \
++ } \
++ } while (0)
++# else /* BYTE */
++# define FREE_VARIABLES() ((void)0) /* Do nothing! But inhibit gcc warning. */
++# endif /* WCHAR */
++#endif /* not MATCH_MAY_ALLOCATE */
++
++/* These values must meet several constraints. They must not be valid
++ register values; since we have a limit of 255 registers (because
++ we use only one byte in the pattern for the register number), we can
++ use numbers larger than 255. They must differ by 1, because of
++ NUM_FAILURE_ITEMS above. And the value for the lowest register must
++ be larger than the value for the highest register, so we do not try
++ to actually save any registers when none are active. */
++#define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH)
++#define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1)
++
++#else /* not INSIDE_RECURSION */
++/* Matching routines. */
++
++#ifndef emacs /* Emacs never uses this. */
++/* re_match is like re_match_2 except it takes only a single string. */
++
++int
++re_match (struct re_pattern_buffer *bufp, const char *string,
++ int size, int pos, struct re_registers *regs)
++{
++ int result;
++# ifdef MBS_SUPPORT
++ if (MB_CUR_MAX != 1)
++ result = wcs_re_match_2_internal (bufp, NULL, 0, string, size,
++ pos, regs, size,
++ NULL, 0, NULL, 0, NULL, NULL);
++ else
++# endif
++ result = byte_re_match_2_internal (bufp, NULL, 0, string, size,
++ pos, regs, size);
++# ifndef REGEX_MALLOC
++# ifdef C_ALLOCA
++ alloca (0);
++# endif
++# endif
++ return result;
++}
++# ifdef _LIBC
++weak_alias (__re_match, re_match)
++# endif
++#endif /* not emacs */
++
++#endif /* not INSIDE_RECURSION */
++
++#ifdef INSIDE_RECURSION
++static boolean PREFIX(group_match_null_string_p) (UCHAR_T **p,
++ UCHAR_T *end,
++ PREFIX(register_info_type) *reg_info);
++static boolean PREFIX(alt_match_null_string_p) (UCHAR_T *p,
++ UCHAR_T *end,
++ PREFIX(register_info_type) *reg_info);
++static boolean PREFIX(common_op_match_null_string_p) (UCHAR_T **p,
++ UCHAR_T *end,
++ PREFIX(register_info_type) *reg_info);
++static int PREFIX(bcmp_translate) (const CHAR_T *s1, const CHAR_T *s2,
++ register int len,
++ RE_TRANSLATE_TYPE translate);
++#else /* not INSIDE_RECURSION */
++
++/* re_match_2 matches the compiled pattern in BUFP against the
++ the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1
++ and SIZE2, respectively). We start matching at POS, and stop
++ matching at STOP.
++
++ If REGS is non-null and the `no_sub' field of BUFP is nonzero, we
++ store offsets for the substring each group matched in REGS. See the
++ documentation for exactly how many groups we fill.
++
++ We return -1 if no match, -2 if an internal error (such as the
++ failure stack overflowing). Otherwise, we return the length of the
++ matched substring. */
++
++int
++re_match_2 (struct re_pattern_buffer *bufp, const char *string1, int size1,
++ const char *string2, int size2, int pos,
++ struct re_registers *regs, int stop)
++{
++ int result;
++# ifdef MBS_SUPPORT
++ if (MB_CUR_MAX != 1)
++ result = wcs_re_match_2_internal (bufp, string1, size1, string2, size2,
++ pos, regs, stop,
++ NULL, 0, NULL, 0, NULL, NULL);
++ else
++# endif
++ result = byte_re_match_2_internal (bufp, string1, size1, string2, size2,
++ pos, regs, stop);
++
++#ifndef REGEX_MALLOC
++# ifdef C_ALLOCA
++ alloca (0);
++# endif
++#endif
++ return result;
++}
++#ifdef _LIBC
++weak_alias (__re_match_2, re_match_2)
++#endif
++
++#endif /* not INSIDE_RECURSION */
++
++#ifdef INSIDE_RECURSION
++
++#ifdef WCHAR
++static int count_mbs_length (int *, int);
++
++/* This check the substring (from 0, to length) of the multibyte string,
++ to which offset_buffer correspond. And count how many wchar_t_characters
++ the substring occupy. We use offset_buffer to optimization.
++ See convert_mbs_to_wcs. */
++
++static int
++count_mbs_length(int *offset_buffer, int length)
++{
++ int upper, lower;
++
++ /* Check whether the size is valid. */
++ if (length < 0)
++ return -1;
++
++ if (offset_buffer == NULL)
++ return 0;
++
++ /* If there are no multibyte character, offset_buffer[i] == i.
++ Optmize for this case. */
++ if (offset_buffer[length] == length)
++ return length;
++
++ /* Set up upper with length. (because for all i, offset_buffer[i] >= i) */
++ upper = length;
++ lower = 0;
++
++ while (true)
++ {
++ int middle = (lower + upper) / 2;
++ if (middle == lower || middle == upper)
++ break;
++ if (offset_buffer[middle] > length)
++ upper = middle;
++ else if (offset_buffer[middle] < length)
++ lower = middle;
++ else
++ return middle;
++ }
++
++ return -1;
++}
++#endif /* WCHAR */
++
++/* This is a separate function so that we can force an alloca cleanup
++ afterwards. */
++#ifdef WCHAR
++static int
++wcs_re_match_2_internal (struct re_pattern_buffer *bufp,
++ const char *cstring1, int csize1,
++ const char *cstring2, int csize2,
++ int pos,
++ struct re_registers *regs,
++ int stop,
++ /* string1 == string2 == NULL means string1/2, size1/2 and
++ mbs_offset1/2 need seting up in this function. */
++ /* We need wchar_t* buffers correspond to cstring1, cstring2. */
++ wchar_t *string1, int size1,
++ wchar_t *string2, int size2,
++ /* offset buffer for optimizatoin. See convert_mbs_to_wc. */
++ int *mbs_offset1, int *mbs_offset2)
++#else /* BYTE */
++static int
++byte_re_match_2_internal (struct re_pattern_buffer *bufp,
++ const char *string1, int size1,
++ const char *string2, int size2,
++ int pos,
++ struct re_registers *regs, int stop)
++#endif /* BYTE */
++{
++ /* General temporaries. */
++ int mcnt;
++ UCHAR_T *p1;
++#ifdef WCHAR
++ /* They hold whether each wchar_t is binary data or not. */
++ char *is_binary = NULL;
++ /* If true, we can't free string1/2, mbs_offset1/2. */
++ int cant_free_wcs_buf = 1;
++#endif /* WCHAR */
++
++ /* Just past the end of the corresponding string. */
++ const CHAR_T *end1, *end2;
++
++ /* Pointers into string1 and string2, just past the last characters in
++ each to consider matching. */
++ const CHAR_T *end_match_1, *end_match_2;
++
++ /* Where we are in the data, and the end of the current string. */
++ const CHAR_T *d, *dend;
++
++ /* Where we are in the pattern, and the end of the pattern. */
++#ifdef WCHAR
++ UCHAR_T *pattern, *p;
++ register UCHAR_T *pend;
++#else /* BYTE */
++ UCHAR_T *p = bufp->buffer;
++ register UCHAR_T *pend = p + bufp->used;
++#endif /* WCHAR */
++
++ /* Mark the opcode just after a start_memory, so we can test for an
++ empty subpattern when we get to the stop_memory. */
++ UCHAR_T *just_past_start_mem = 0;
++
++ /* We use this to map every character in the string. */
++ RE_TRANSLATE_TYPE translate = bufp->translate;
++
++ /* Failure point stack. Each place that can handle a failure further
++ down the line pushes a failure point on this stack. It consists of
++ restart, regend, and reg_info for all registers corresponding to
++ the subexpressions we're currently inside, plus the number of such
++ registers, and, finally, two char *'s. The first char * is where
++ to resume scanning the pattern; the second one is where to resume
++ scanning the strings. If the latter is zero, the failure point is
++ a ``dummy''; if a failure happens and the failure point is a dummy,
++ it gets discarded and the next next one is tried. */
++#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */
++ PREFIX(fail_stack_type) fail_stack;
++#endif
++#ifdef DEBUG
++ static unsigned failure_id;
++ unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0;
++#endif
++
++#ifdef REL_ALLOC
++ /* This holds the pointer to the failure stack, when
++ it is allocated relocatably. */
++ fail_stack_elt_t *failure_stack_ptr;
++#endif
++
++ /* We fill all the registers internally, independent of what we
++ return, for use in backreferences. The number here includes
++ an element for register zero. */
++ size_t num_regs = bufp->re_nsub + 1;
++
++ /* The currently active registers. */
++ active_reg_t lowest_active_reg = NO_LOWEST_ACTIVE_REG;
++ active_reg_t highest_active_reg = NO_HIGHEST_ACTIVE_REG;
++
++ /* Information on the contents of registers. These are pointers into
++ the input strings; they record just what was matched (on this
++ attempt) by a subexpression part of the pattern, that is, the
++ regnum-th regstart pointer points to where in the pattern we began
++ matching and the regnum-th regend points to right after where we
++ stopped matching the regnum-th subexpression. (The zeroth register
++ keeps track of what the whole pattern matches.) */
++#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
++ const CHAR_T **regstart, **regend;
++#endif
++
++ /* If a group that's operated upon by a repetition operator fails to
++ match anything, then the register for its start will need to be
++ restored because it will have been set to wherever in the string we
++ are when we last see its open-group operator. Similarly for a
++ register's end. */
++#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
++ const CHAR_T **old_regstart, **old_regend;
++#endif
++
++ /* The is_active field of reg_info helps us keep track of which (possibly
++ nested) subexpressions we are currently in. The matched_something
++ field of reg_info[reg_num] helps us tell whether or not we have
++ matched any of the pattern so far this time through the reg_num-th
++ subexpression. These two fields get reset each time through any
++ loop their register is in. */
++#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */
++ PREFIX(register_info_type) *reg_info;
++#endif
++
++ /* The following record the register info as found in the above
++ variables when we find a match better than any we've seen before.
++ This happens as we backtrack through the failure points, which in
++ turn happens only if we have not yet matched the entire string. */
++ unsigned best_regs_set = false;
++#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
++ const CHAR_T **best_regstart, **best_regend;
++#endif
++
++ /* Logically, this is `best_regend[0]'. But we don't want to have to
++ allocate space for that if we're not allocating space for anything
++ else (see below). Also, we never need info about register 0 for
++ any of the other register vectors, and it seems rather a kludge to
++ treat `best_regend' differently than the rest. So we keep track of
++ the end of the best match so far in a separate variable. We
++ initialize this to NULL so that when we backtrack the first time
++ and need to test it, it's not garbage. */
++ const CHAR_T *match_end = NULL;
++
++ /* This helps SET_REGS_MATCHED avoid doing redundant work. */
++ int set_regs_matched_done = 0;
++
++ /* Used when we pop values we don't care about. */
++#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
++ const CHAR_T **reg_dummy;
++ PREFIX(register_info_type) *reg_info_dummy;
++#endif
++
++#ifdef DEBUG
++ /* Counts the total number of registers pushed. */
++ unsigned num_regs_pushed = 0;
++#endif
++
++ DEBUG_PRINT1 ("\n\nEntering re_match_2.\n");
++
++ INIT_FAIL_STACK ();
++
++#ifdef MATCH_MAY_ALLOCATE
++ /* Do not bother to initialize all the register variables if there are
++ no groups in the pattern, as it takes a fair amount of time. If
++ there are groups, we include space for register 0 (the whole
++ pattern), even though we never use it, since it simplifies the
++ array indexing. We should fix this. */
++ if (bufp->re_nsub)
++ {
++ regstart = REGEX_TALLOC (num_regs, const CHAR_T *);
++ regend = REGEX_TALLOC (num_regs, const CHAR_T *);
++ old_regstart = REGEX_TALLOC (num_regs, const CHAR_T *);
++ old_regend = REGEX_TALLOC (num_regs, const CHAR_T *);
++ best_regstart = REGEX_TALLOC (num_regs, const CHAR_T *);
++ best_regend = REGEX_TALLOC (num_regs, const CHAR_T *);
++ reg_info = REGEX_TALLOC (num_regs, PREFIX(register_info_type));
++ reg_dummy = REGEX_TALLOC (num_regs, const CHAR_T *);
++ reg_info_dummy = REGEX_TALLOC (num_regs, PREFIX(register_info_type));
++
++ if (!(regstart && regend && old_regstart && old_regend && reg_info
++ && best_regstart && best_regend && reg_dummy && reg_info_dummy))
++ {
++ FREE_VARIABLES ();
++ return -2;
++ }
++ }
++ else
++ {
++ /* We must initialize all our variables to NULL, so that
++ `FREE_VARIABLES' doesn't try to free them. */
++ regstart = regend = old_regstart = old_regend = best_regstart
++ = best_regend = reg_dummy = NULL;
++ reg_info = reg_info_dummy = (PREFIX(register_info_type) *) NULL;
++ }
++#endif /* MATCH_MAY_ALLOCATE */
++
++ /* The starting position is bogus. */
++#ifdef WCHAR
++ if (pos < 0 || pos > csize1 + csize2)
++#else /* BYTE */
++ if (pos < 0 || pos > size1 + size2)
++#endif
++ {
++ FREE_VARIABLES ();
++ return -1;
++ }
++
++#ifdef WCHAR
++ /* Allocate wchar_t array for string1 and string2 and
++ fill them with converted string. */
++ if (string1 == NULL && string2 == NULL)
++ {
++ /* We need seting up buffers here. */
++
++ /* We must free wcs buffers in this function. */
++ cant_free_wcs_buf = 0;
++
++ if (csize1 != 0)
++ {
++ string1 = REGEX_TALLOC (csize1 + 1, CHAR_T);
++ mbs_offset1 = REGEX_TALLOC (csize1 + 1, int);
++ is_binary = REGEX_TALLOC (csize1 + 1, char);
++ if (!string1 || !mbs_offset1 || !is_binary)
++ {
++ FREE_VAR (string1);
++ FREE_VAR (mbs_offset1);
++ FREE_VAR (is_binary);
++ return -2;
++ }
++ }
++ if (csize2 != 0)
++ {
++ string2 = REGEX_TALLOC (csize2 + 1, CHAR_T);
++ mbs_offset2 = REGEX_TALLOC (csize2 + 1, int);
++ is_binary = REGEX_TALLOC (csize2 + 1, char);
++ if (!string2 || !mbs_offset2 || !is_binary)
++ {
++ FREE_VAR (string1);
++ FREE_VAR (mbs_offset1);
++ FREE_VAR (string2);
++ FREE_VAR (mbs_offset2);
++ FREE_VAR (is_binary);
++ return -2;
++ }
++ size2 = convert_mbs_to_wcs(string2, cstring2, csize2,
++ mbs_offset2, is_binary);
++ string2[size2] = L'\0'; /* for a sentinel */
++ FREE_VAR (is_binary);
++ }
++ }
++
++ /* We need to cast pattern to (wchar_t*), because we casted this compiled
++ pattern to (char*) in regex_compile. */
++ p = pattern = (CHAR_T*)bufp->buffer;
++ pend = (CHAR_T*)(bufp->buffer + bufp->used);
++
++#endif /* WCHAR */
++
++ /* Initialize subexpression text positions to -1 to mark ones that no
++ start_memory/stop_memory has been seen for. Also initialize the
++ register information struct. */
++ for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++)
++ {
++ regstart[mcnt] = regend[mcnt]
++ = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE;
++
++ REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE;
++ IS_ACTIVE (reg_info[mcnt]) = 0;
++ MATCHED_SOMETHING (reg_info[mcnt]) = 0;
++ EVER_MATCHED_SOMETHING (reg_info[mcnt]) = 0;
++ }
++
++ /* We move `string1' into `string2' if the latter's empty -- but not if
++ `string1' is null. */
++ if (size2 == 0 && string1 != NULL)
++ {
++ string2 = string1;
++ size2 = size1;
++ string1 = 0;
++ size1 = 0;
++#ifdef WCHAR
++ mbs_offset2 = mbs_offset1;
++ csize2 = csize1;
++ mbs_offset1 = NULL;
++ csize1 = 0;
++#endif
++ }
++ end1 = string1 + size1;
++ end2 = string2 + size2;
++
++ /* Compute where to stop matching, within the two strings. */
++#ifdef WCHAR
++ if (stop <= csize1)
++ {
++ mcnt = count_mbs_length(mbs_offset1, stop);
++ end_match_1 = string1 + mcnt;
++ end_match_2 = string2;
++ }
++ else
++ {
++ if (stop > csize1 + csize2)
++ stop = csize1 + csize2;
++ end_match_1 = end1;
++ mcnt = count_mbs_length(mbs_offset2, stop-csize1);
++ end_match_2 = string2 + mcnt;
++ }
++ if (mcnt < 0)
++ { /* count_mbs_length return error. */
++ FREE_VARIABLES ();
++ return -1;
++ }
++#else
++ if (stop <= size1)
++ {
++ end_match_1 = string1 + stop;
++ end_match_2 = string2;
++ }
++ else
++ {
++ end_match_1 = end1;
++ end_match_2 = string2 + stop - size1;
++ }
++#endif /* WCHAR */
++
++ /* `p' scans through the pattern as `d' scans through the data.
++ `dend' is the end of the input string that `d' points within. `d'
++ is advanced into the following input string whenever necessary, but
++ this happens before fetching; therefore, at the beginning of the
++ loop, `d' can be pointing at the end of a string, but it cannot
++ equal `string2'. */
++#ifdef WCHAR
++ if (size1 > 0 && pos <= csize1)
++ {
++ mcnt = count_mbs_length(mbs_offset1, pos);
++ d = string1 + mcnt;
++ dend = end_match_1;
++ }
++ else
++ {
++ mcnt = count_mbs_length(mbs_offset2, pos-csize1);
++ d = string2 + mcnt;
++ dend = end_match_2;
++ }
++
++ if (mcnt < 0)
++ { /* count_mbs_length return error. */
++ FREE_VARIABLES ();
++ return -1;
++ }
++#else
++ if (size1 > 0 && pos <= size1)
++ {
++ d = string1 + pos;
++ dend = end_match_1;
++ }
++ else
++ {
++ d = string2 + pos - size1;
++ dend = end_match_2;
++ }
++#endif /* WCHAR */
++
++ DEBUG_PRINT1 ("The compiled pattern is:\n");
++ DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend);
++ DEBUG_PRINT1 ("The string to match is: `");
++ DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2);
++ DEBUG_PRINT1 ("'\n");
++
++ /* This loops over pattern commands. It exits by returning from the
++ function if the match is complete, or it drops through if the match
++ fails at this starting point in the input data. */
++ for (;;)
++ {
++#ifdef _LIBC
++ DEBUG_PRINT2 ("\n%p: ", p);
++#else
++ DEBUG_PRINT2 ("\n0x%x: ", p);
++#endif
++
++ if (p == pend)
++ { /* End of pattern means we might have succeeded. */
++ DEBUG_PRINT1 ("end of pattern ... ");
++
++ /* If we haven't matched the entire string, and we want the
++ longest match, try backtracking. */
++ if (d != end_match_2)
++ {
++ /* 1 if this match ends in the same string (string1 or string2)
++ as the best previous match. */
++ boolean same_str_p = (FIRST_STRING_P (match_end)
++ == MATCHING_IN_FIRST_STRING);
++ /* 1 if this match is the best seen so far. */
++ boolean best_match_p;
++
++ /* AIX compiler got confused when this was combined
++ with the previous declaration. */
++ if (same_str_p)
++ best_match_p = d > match_end;
++ else
++ best_match_p = !MATCHING_IN_FIRST_STRING;
++
++ DEBUG_PRINT1 ("backtracking.\n");
++
++ if (!FAIL_STACK_EMPTY ())
++ { /* More failure points to try. */
++
++ /* If exceeds best match so far, save it. */
++ if (!best_regs_set || best_match_p)
++ {
++ best_regs_set = true;
++ match_end = d;
++
++ DEBUG_PRINT1 ("\nSAVING match as best so far.\n");
++
++ for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++)
++ {
++ best_regstart[mcnt] = regstart[mcnt];
++ best_regend[mcnt] = regend[mcnt];
++ }
++ }
++ goto fail;
++ }
++
++ /* If no failure points, don't restore garbage. And if
++ last match is real best match, don't restore second
++ best one. */
++ else if (best_regs_set && !best_match_p)
++ {
++ restore_best_regs:
++ /* Restore best match. It may happen that `dend ==
++ end_match_1' while the restored d is in string2.
++ For example, the pattern `x.*y.*z' against the
++ strings `x-' and `y-z-', if the two strings are
++ not consecutive in memory. */
++ DEBUG_PRINT1 ("Restoring best registers.\n");
++
++ d = match_end;
++ dend = ((d >= string1 && d <= end1)
++ ? end_match_1 : end_match_2);
++
++ for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++)
++ {
++ regstart[mcnt] = best_regstart[mcnt];
++ regend[mcnt] = best_regend[mcnt];
++ }
++ }
++ } /* d != end_match_2 */
++
++ succeed_label:
++ DEBUG_PRINT1 ("Accepting match.\n");
++ /* If caller wants register contents data back, do it. */
++ if (regs && !bufp->no_sub)
++ {
++ /* Have the register data arrays been allocated? */
++ if (bufp->regs_allocated == REGS_UNALLOCATED)
++ { /* No. So allocate them with malloc. We need one
++ extra element beyond `num_regs' for the `-1' marker
++ GNU code uses. */
++ regs->num_regs = MAX (RE_NREGS, num_regs + 1);
++ regs->start = TALLOC (regs->num_regs, regoff_t);
++ regs->end = TALLOC (regs->num_regs, regoff_t);
++ if (regs->start == NULL || regs->end == NULL)
++ {
++ FREE_VARIABLES ();
++ return -2;
++ }
++ bufp->regs_allocated = REGS_REALLOCATE;
++ }
++ else if (bufp->regs_allocated == REGS_REALLOCATE)
++ { /* Yes. If we need more elements than were already
++ allocated, reallocate them. If we need fewer, just
++ leave it alone. */
++ if (regs->num_regs < num_regs + 1)
++ {
++ regs->num_regs = num_regs + 1;
++ RETALLOC (regs->start, regs->num_regs, regoff_t);
++ RETALLOC (regs->end, regs->num_regs, regoff_t);
++ if (regs->start == NULL || regs->end == NULL)
++ {
++ FREE_VARIABLES ();
++ return -2;
++ }
++ }
++ }
++ else
++ {
++ /* These braces fend off a "empty body in an else-statement"
++ warning under GCC when assert expands to nothing. */
++ assert (bufp->regs_allocated == REGS_FIXED);
++ }
++
++ /* Convert the pointer data in `regstart' and `regend' to
++ indices. Register zero has to be set differently,
++ since we haven't kept track of any info for it. */
++ if (regs->num_regs > 0)
++ {
++ regs->start[0] = pos;
++#ifdef WCHAR
++ if (MATCHING_IN_FIRST_STRING)
++ regs->end[0] = mbs_offset1 != NULL ?
++ mbs_offset1[d-string1] : 0;
++ else
++ regs->end[0] = csize1 + (mbs_offset2 != NULL ?
++ mbs_offset2[d-string2] : 0);
++#else
++ regs->end[0] = (MATCHING_IN_FIRST_STRING
++ ? ((regoff_t) (d - string1))
++ : ((regoff_t) (d - string2 + size1)));
++#endif /* WCHAR */
++ }
++
++ /* Go through the first `min (num_regs, regs->num_regs)'
++ registers, since that is all we initialized. */
++ for (mcnt = 1; (unsigned) mcnt < MIN (num_regs, regs->num_regs);
++ mcnt++)
++ {
++ if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt]))
++ regs->start[mcnt] = regs->end[mcnt] = -1;
++ else
++ {
++ regs->start[mcnt]
++ = (regoff_t) POINTER_TO_OFFSET (regstart[mcnt]);
++ regs->end[mcnt]
++ = (regoff_t) POINTER_TO_OFFSET (regend[mcnt]);
++ }
++ }
++
++ /* If the regs structure we return has more elements than
++ were in the pattern, set the extra elements to -1. If
++ we (re)allocated the registers, this is the case,
++ because we always allocate enough to have at least one
++ -1 at the end. */
++ for (mcnt = num_regs; (unsigned) mcnt < regs->num_regs; mcnt++)
++ regs->start[mcnt] = regs->end[mcnt] = -1;
++ } /* regs && !bufp->no_sub */
++
++ DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n",
++ nfailure_points_pushed, nfailure_points_popped,
++ nfailure_points_pushed - nfailure_points_popped);
++ DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed);
++
++#ifdef WCHAR
++ if (MATCHING_IN_FIRST_STRING)
++ mcnt = mbs_offset1 != NULL ? mbs_offset1[d-string1] : 0;
++ else
++ mcnt = (mbs_offset2 != NULL ? mbs_offset2[d-string2] : 0) +
++ csize1;
++ mcnt -= pos;
++#else
++ mcnt = d - pos - (MATCHING_IN_FIRST_STRING
++ ? string1
++ : string2 - size1);
++#endif /* WCHAR */
++
++ DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt);
++
++ FREE_VARIABLES ();
++ return mcnt;
++ }
++
++ /* Otherwise match next pattern command. */
++ switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++))
++ {
++ /* Ignore these. Used to ignore the n of succeed_n's which
++ currently have n == 0. */
++ case no_op:
++ DEBUG_PRINT1 ("EXECUTING no_op.\n");
++ break;
++
++ case succeed:
++ DEBUG_PRINT1 ("EXECUTING succeed.\n");
++ goto succeed_label;
++
++ /* Match the next n pattern characters exactly. The following
++ byte in the pattern defines n, and the n bytes after that
++ are the characters to match. */
++ case exactn:
++#ifdef MBS_SUPPORT
++ case exactn_bin:
++#endif
++ mcnt = *p++;
++ DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt);
++
++ /* This is written out as an if-else so we don't waste time
++ testing `translate' inside the loop. */
++ if (translate)
++ {
++ do
++ {
++ PREFETCH ();
++#ifdef WCHAR
++ if (*d <= 0xff)
++ {
++ if ((UCHAR_T) translate[(unsigned char) *d++]
++ != (UCHAR_T) *p++)
++ goto fail;
++ }
++ else
++ {
++ if (*d++ != (CHAR_T) *p++)
++ goto fail;
++ }
++#else
++ if ((UCHAR_T) translate[(unsigned char) *d++]
++ != (UCHAR_T) *p++)
++ goto fail;
++#endif /* WCHAR */
++ }
++ while (--mcnt);
++ }
++ else
++ {
++ do
++ {
++ PREFETCH ();
++ if (*d++ != (CHAR_T) *p++) goto fail;
++ }
++ while (--mcnt);
++ }
++ SET_REGS_MATCHED ();
++ break;
++
++
++ /* Match any character except possibly a newline or a null. */
++ case anychar:
++ DEBUG_PRINT1 ("EXECUTING anychar.\n");
++
++ PREFETCH ();
++
++ if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n')
++ || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000'))
++ goto fail;
++
++ SET_REGS_MATCHED ();
++ DEBUG_PRINT2 (" Matched `%ld'.\n", (long int) *d);
++ d++;
++ break;
++
++
++ case charset:
++ case charset_not:
++ {
++ register UCHAR_T c;
++#ifdef WCHAR
++ unsigned int i, char_class_length, coll_symbol_length,
++ equiv_class_length, ranges_length, chars_length, length;
++ CHAR_T *workp, *workp2, *charset_top;
++#define WORK_BUFFER_SIZE 128
++ CHAR_T str_buf[WORK_BUFFER_SIZE];
++# ifdef _LIBC
++ uint32_t nrules;
++# endif /* _LIBC */
++#endif /* WCHAR */
++ boolean negate = (re_opcode_t) *(p - 1) == charset_not;
++
++ DEBUG_PRINT2 ("EXECUTING charset%s.\n", negate ? "_not" : "");
++ PREFETCH ();
++ c = TRANSLATE (*d); /* The character to match. */
++#ifdef WCHAR
++# ifdef _LIBC
++ nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
++# endif /* _LIBC */
++ charset_top = p - 1;
++ char_class_length = *p++;
++ coll_symbol_length = *p++;
++ equiv_class_length = *p++;
++ ranges_length = *p++;
++ chars_length = *p++;
++ /* p points charset[6], so the address of the next instruction
++ (charset[l+m+n+2o+k+p']) equals p[l+m+n+2*o+p'],
++ where l=length of char_classes, m=length of collating_symbol,
++ n=equivalence_class, o=length of char_range,
++ p'=length of character. */
++ workp = p;
++ /* Update p to indicate the next instruction. */
++ p += char_class_length + coll_symbol_length+ equiv_class_length +
++ 2*ranges_length + chars_length;
++
++ /* match with char_class? */
++ for (i = 0; i < char_class_length ; i += CHAR_CLASS_SIZE)
++ {
++ wctype_t wctype;
++ uintptr_t alignedp = ((uintptr_t)workp
++ + __alignof__(wctype_t) - 1)
++ & ~(uintptr_t)(__alignof__(wctype_t) - 1);
++ wctype = *((wctype_t*)alignedp);
++ workp += CHAR_CLASS_SIZE;
++# ifdef _LIBC
++ if (__iswctype((wint_t)c, wctype))
++ goto char_set_matched;
++# else
++ if (iswctype((wint_t)c, wctype))
++ goto char_set_matched;
++# endif
++ }
++
++ /* match with collating_symbol? */
++# ifdef _LIBC
++ if (nrules != 0)
++ {
++ const unsigned char *extra = (const unsigned char *)
++ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
++
++ for (workp2 = workp + coll_symbol_length ; workp < workp2 ;
++ workp++)
++ {
++ int32_t *wextra;
++ wextra = (int32_t*)(extra + *workp++);
++ for (i = 0; i < *wextra; ++i)
++ if (TRANSLATE(d[i]) != wextra[1 + i])
++ break;
++
++ if (i == *wextra)
++ {
++ /* Update d, however d will be incremented at
++ char_set_matched:, we decrement d here. */
++ d += i - 1;
++ goto char_set_matched;
++ }
++ }
++ }
++ else /* (nrules == 0) */
++# endif
++ /* If we can't look up collation data, we use wcscoll
++ instead. */
++ {
++ for (workp2 = workp + coll_symbol_length ; workp < workp2 ;)
++ {
++ const CHAR_T *backup_d = d, *backup_dend = dend;
++# ifdef _LIBC
++ length = __wcslen (workp);
++# else
++ length = wcslen (workp);
++# endif
++
++ /* If wcscoll(the collating symbol, whole string) > 0,
++ any substring of the string never match with the
++ collating symbol. */
++# ifdef _LIBC
++ if (__wcscoll (workp, d) > 0)
++# else
++ if (wcscoll (workp, d) > 0)
++# endif
++ {
++ workp += length + 1;
++ continue;
++ }
++
++ /* First, we compare the collating symbol with
++ the first character of the string.
++ If it don't match, we add the next character to
++ the compare buffer in turn. */
++ for (i = 0 ; i < WORK_BUFFER_SIZE-1 ; i++, d++)
++ {
++ int match;
++ if (d == dend)
++ {
++ if (dend == end_match_2)
++ break;
++ d = string2;
++ dend = end_match_2;
++ }
++
++ /* add next character to the compare buffer. */
++ str_buf[i] = TRANSLATE(*d);
++ str_buf[i+1] = '\0';
++
++# ifdef _LIBC
++ match = __wcscoll (workp, str_buf);
++# else
++ match = wcscoll (workp, str_buf);
++# endif
++ if (match == 0)
++ goto char_set_matched;
++
++ if (match < 0)
++ /* (str_buf > workp) indicate (str_buf + X > workp),
++ because for all X (str_buf + X > str_buf).
++ So we don't need continue this loop. */
++ break;
++
++ /* Otherwise(str_buf < workp),
++ (str_buf+next_character) may equals (workp).
++ So we continue this loop. */
++ }
++ /* not matched */
++ d = backup_d;
++ dend = backup_dend;
++ workp += length + 1;
++ }
++ }
++ /* match with equivalence_class? */
++# ifdef _LIBC
++ if (nrules != 0)
++ {
++ const CHAR_T *backup_d = d, *backup_dend = dend;
++ /* Try to match the equivalence class against
++ those known to the collate implementation. */
++ const int32_t *table;
++ const int32_t *weights;
++ const int32_t *extra;
++ const int32_t *indirect;
++ int32_t idx, idx2;
++ wint_t *cp;
++ size_t len;
++
++ table = (const int32_t *)
++ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEWC);
++ weights = (const wint_t *)
++ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTWC);
++ extra = (const wint_t *)
++ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAWC);
++ indirect = (const int32_t *)
++ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTWC);
++
++ /* Write 1 collating element to str_buf, and
++ get its index. */
++ idx2 = 0;
++
++ for (i = 0 ; idx2 == 0 && i < WORK_BUFFER_SIZE - 1; i++)
++ {
++ cp = (wint_t*)str_buf;
++ if (d == dend)
++ {
++ if (dend == end_match_2)
++ break;
++ d = string2;
++ dend = end_match_2;
++ }
++ str_buf[i] = TRANSLATE(*(d+i));
++ str_buf[i+1] = '\0'; /* sentinel */
++ idx2 = FINDIDX (table, indirect, extra, &cp, 1);
++ }
++
++ /* Update d, however d will be incremented at
++ char_set_matched:, we decrement d here. */
++ d = backup_d + ((wchar_t*)cp - (wchar_t*)str_buf - 1);
++ if (d >= dend)
++ {
++ if (dend == end_match_2)
++ d = dend;
++ else
++ {
++ d = string2;
++ dend = end_match_2;
++ }
++ }
++
++ len = weights[idx2];
++
++ for (workp2 = workp + equiv_class_length ; workp < workp2 ;
++ workp++)
++ {
++ idx = (int32_t)*workp;
++ /* We already checked idx != 0 in regex_compile. */
++
++ if (idx2 != 0 && len == weights[idx])
++ {
++ int cnt = 0;
++ while (cnt < len && (weights[idx + 1 + cnt]
++ == weights[idx2 + 1 + cnt]))
++ ++cnt;
++
++ if (cnt == len)
++ goto char_set_matched;
++ }
++ }
++ /* not matched */
++ d = backup_d;
++ dend = backup_dend;
++ }
++ else /* (nrules == 0) */
++# endif
++ /* If we can't look up collation data, we use wcscoll
++ instead. */
++ {
++ for (workp2 = workp + equiv_class_length ; workp < workp2 ;)
++ {
++ const CHAR_T *backup_d = d, *backup_dend = dend;
++# ifdef _LIBC
++ length = __wcslen (workp);
++# else
++ length = wcslen (workp);
++# endif
++
++ /* If wcscoll(the collating symbol, whole string) > 0,
++ any substring of the string never match with the
++ collating symbol. */
++# ifdef _LIBC
++ if (__wcscoll (workp, d) > 0)
++# else
++ if (wcscoll (workp, d) > 0)
++# endif
++ {
++ workp += length + 1;
++ break;
++ }
++
++ /* First, we compare the equivalence class with
++ the first character of the string.
++ If it don't match, we add the next character to
++ the compare buffer in turn. */
++ for (i = 0 ; i < WORK_BUFFER_SIZE - 1 ; i++, d++)
++ {
++ int match;
++ if (d == dend)
++ {
++ if (dend == end_match_2)
++ break;
++ d = string2;
++ dend = end_match_2;
++ }
++
++ /* add next character to the compare buffer. */
++ str_buf[i] = TRANSLATE(*d);
++ str_buf[i+1] = '\0';
++
++# ifdef _LIBC
++ match = __wcscoll (workp, str_buf);
++# else
++ match = wcscoll (workp, str_buf);
++# endif
++
++ if (match == 0)
++ goto char_set_matched;
++
++ if (match < 0)
++ /* (str_buf > workp) indicate (str_buf + X > workp),
++ because for all X (str_buf + X > str_buf).
++ So we don't need continue this loop. */
++ break;
++
++ /* Otherwise(str_buf < workp),
++ (str_buf+next_character) may equals (workp).
++ So we continue this loop. */
++ }
++ /* not matched */
++ d = backup_d;
++ dend = backup_dend;
++ workp += length + 1;
++ }
++ }
++
++ /* match with char_range? */
++# ifdef _LIBC
++ if (nrules != 0)
++ {
++ uint32_t collseqval;
++ const char *collseq = (const char *)
++ _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQWC);
++
++ collseqval = collseq_table_lookup (collseq, c);
++
++ for (; workp < p - chars_length ;)
++ {
++ uint32_t start_val, end_val;
++
++ /* We already compute the collation sequence value
++ of the characters (or collating symbols). */
++ start_val = (uint32_t) *workp++; /* range_start */
++ end_val = (uint32_t) *workp++; /* range_end */
++
++ if (start_val <= collseqval && collseqval <= end_val)
++ goto char_set_matched;
++ }
++ }
++ else
++# endif
++ {
++ /* We set range_start_char at str_buf[0], range_end_char
++ at str_buf[4], and compared char at str_buf[2]. */
++ str_buf[1] = 0;
++ str_buf[2] = c;
++ str_buf[3] = 0;
++ str_buf[5] = 0;
++ for (; workp < p - chars_length ;)
++ {
++ wchar_t *range_start_char, *range_end_char;
++
++ /* match if (range_start_char <= c <= range_end_char). */
++
++ /* If range_start(or end) < 0, we assume -range_start(end)
++ is the offset of the collating symbol which is specified
++ as the character of the range start(end). */
++
++ /* range_start */
++ if (*workp < 0)
++ range_start_char = charset_top - (*workp++);
++ else
++ {
++ str_buf[0] = *workp++;
++ range_start_char = str_buf;
++ }
++
++ /* range_end */
++ if (*workp < 0)
++ range_end_char = charset_top - (*workp++);
++ else
++ {
++ str_buf[4] = *workp++;
++ range_end_char = str_buf + 4;
++ }
++
++# ifdef _LIBC
++ if (__wcscoll (range_start_char, str_buf+2) <= 0
++ && __wcscoll (str_buf+2, range_end_char) <= 0)
++# else
++ if (wcscoll (range_start_char, str_buf+2) <= 0
++ && wcscoll (str_buf+2, range_end_char) <= 0)
++# endif
++ goto char_set_matched;
++ }
++ }
++
++ /* match with char? */
++ for (; workp < p ; workp++)
++ if (c == *workp)
++ goto char_set_matched;
++
++ negate = !negate;
++
++ char_set_matched:
++ if (negate) goto fail;
++#else
++ /* Cast to `unsigned' instead of `unsigned char' in case the
++ bit list is a full 32 bytes long. */
++ if (c < (unsigned) (*p * BYTEWIDTH)
++ && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
++ negate = !negate;
++
++ p += 1 + *p;
++
++ if (!negate) goto fail;
++#undef WORK_BUFFER_SIZE
++#endif /* WCHAR */
++ SET_REGS_MATCHED ();
++ d++;
++ break;
++ }
++
++
++ /* The beginning of a group is represented by start_memory.
++ The arguments are the register number in the next byte, and the
++ number of groups inner to this one in the next. The text
++ matched within the group is recorded (in the internal
++ registers data structure) under the register number. */
++ case start_memory:
++ DEBUG_PRINT3 ("EXECUTING start_memory %ld (%ld):\n",
++ (long int) *p, (long int) p[1]);
++
++ /* Find out if this group can match the empty string. */
++ p1 = p; /* To send to group_match_null_string_p. */
++
++ if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE)
++ REG_MATCH_NULL_STRING_P (reg_info[*p])
++ = PREFIX(group_match_null_string_p) (&p1, pend, reg_info);
++
++ /* Save the position in the string where we were the last time
++ we were at this open-group operator in case the group is
++ operated upon by a repetition operator, e.g., with `(a*)*b'
++ against `ab'; then we want to ignore where we are now in
++ the string in case this attempt to match fails. */
++ old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
++ ? REG_UNSET (regstart[*p]) ? d : regstart[*p]
++ : regstart[*p];
++ DEBUG_PRINT2 (" old_regstart: %d\n",
++ POINTER_TO_OFFSET (old_regstart[*p]));
++
++ regstart[*p] = d;
++ DEBUG_PRINT2 (" regstart: %d\n", POINTER_TO_OFFSET (regstart[*p]));
++
++ IS_ACTIVE (reg_info[*p]) = 1;
++ MATCHED_SOMETHING (reg_info[*p]) = 0;
++
++ /* Clear this whenever we change the register activity status. */
++ set_regs_matched_done = 0;
++
++ /* This is the new highest active register. */
++ highest_active_reg = *p;
++
++ /* If nothing was active before, this is the new lowest active
++ register. */
++ if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
++ lowest_active_reg = *p;
++
++ /* Move past the register number and inner group count. */
++ p += 2;
++ just_past_start_mem = p;
++
++ break;
++
++
++ /* The stop_memory opcode represents the end of a group. Its
++ arguments are the same as start_memory's: the register
++ number, and the number of inner groups. */
++ case stop_memory:
++ DEBUG_PRINT3 ("EXECUTING stop_memory %ld (%ld):\n",
++ (long int) *p, (long int) p[1]);
++
++ /* We need to save the string position the last time we were at
++ this close-group operator in case the group is operated
++ upon by a repetition operator, e.g., with `((a*)*(b*)*)*'
++ against `aba'; then we want to ignore where we are now in
++ the string in case this attempt to match fails. */
++ old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
++ ? REG_UNSET (regend[*p]) ? d : regend[*p]
++ : regend[*p];
++ DEBUG_PRINT2 (" old_regend: %d\n",
++ POINTER_TO_OFFSET (old_regend[*p]));
++
++ regend[*p] = d;
++ DEBUG_PRINT2 (" regend: %d\n", POINTER_TO_OFFSET (regend[*p]));
++
++ /* This register isn't active anymore. */
++ IS_ACTIVE (reg_info[*p]) = 0;
++
++ /* Clear this whenever we change the register activity status. */
++ set_regs_matched_done = 0;
++
++ /* If this was the only register active, nothing is active
++ anymore. */
++ if (lowest_active_reg == highest_active_reg)
++ {
++ lowest_active_reg = NO_LOWEST_ACTIVE_REG;
++ highest_active_reg = NO_HIGHEST_ACTIVE_REG;
++ }
++ else
++ { /* We must scan for the new highest active register, since
++ it isn't necessarily one less than now: consider
++ (a(b)c(d(e)f)g). When group 3 ends, after the f), the
++ new highest active register is 1. */
++ UCHAR_T r = *p - 1;
++ while (r > 0 && !IS_ACTIVE (reg_info[r]))
++ r--;
++
++ /* If we end up at register zero, that means that we saved
++ the registers as the result of an `on_failure_jump', not
++ a `start_memory', and we jumped to past the innermost
++ `stop_memory'. For example, in ((.)*) we save
++ registers 1 and 2 as a result of the *, but when we pop
++ back to the second ), we are at the stop_memory 1.
++ Thus, nothing is active. */
++ if (r == 0)
++ {
++ lowest_active_reg = NO_LOWEST_ACTIVE_REG;
++ highest_active_reg = NO_HIGHEST_ACTIVE_REG;
++ }
++ else
++ highest_active_reg = r;
++ }
++
++ /* If just failed to match something this time around with a
++ group that's operated on by a repetition operator, try to
++ force exit from the ``loop'', and restore the register
++ information for this group that we had before trying this
++ last match. */
++ if ((!MATCHED_SOMETHING (reg_info[*p])
++ || just_past_start_mem == p - 1)
++ && (p + 2) < pend)
++ {
++ boolean is_a_jump_n = false;
++
++ p1 = p + 2;
++ mcnt = 0;
++ switch ((re_opcode_t) *p1++)
++ {
++ case jump_n:
++ is_a_jump_n = true;
++ case pop_failure_jump:
++ case maybe_pop_jump:
++ case jump:
++ case dummy_failure_jump:
++ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
++ if (is_a_jump_n)
++ p1 += OFFSET_ADDRESS_SIZE;
++ break;
++
++ default:
++ /* do nothing */ ;
++ }
++ p1 += mcnt;
++
++ /* If the next operation is a jump backwards in the pattern
++ to an on_failure_jump right before the start_memory
++ corresponding to this stop_memory, exit from the loop
++ by forcing a failure after pushing on the stack the
++ on_failure_jump's jump in the pattern, and d. */
++ if (mcnt < 0 && (re_opcode_t) *p1 == on_failure_jump
++ && (re_opcode_t) p1[1+OFFSET_ADDRESS_SIZE] == start_memory
++ && p1[2+OFFSET_ADDRESS_SIZE] == *p)
++ {
++ /* If this group ever matched anything, then restore
++ what its registers were before trying this last
++ failed match, e.g., with `(a*)*b' against `ab' for
++ regstart[1], and, e.g., with `((a*)*(b*)*)*'
++ against `aba' for regend[3].
++
++ Also restore the registers for inner groups for,
++ e.g., `((a*)(b*))*' against `aba' (register 3 would
++ otherwise get trashed). */
++
++ if (EVER_MATCHED_SOMETHING (reg_info[*p]))
++ {
++ unsigned r;
++
++ EVER_MATCHED_SOMETHING (reg_info[*p]) = 0;
++
++ /* Restore this and inner groups' (if any) registers. */
++ for (r = *p; r < (unsigned) *p + (unsigned) *(p + 1);
++ r++)
++ {
++ regstart[r] = old_regstart[r];
++
++ /* xx why this test? */
++ if (old_regend[r] >= regstart[r])
++ regend[r] = old_regend[r];
++ }
++ }
++ p1++;
++ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
++ PUSH_FAILURE_POINT (p1 + mcnt, d, -2);
++
++ goto fail;
++ }
++ }
++
++ /* Move past the register number and the inner group count. */
++ p += 2;
++ break;
++
++
++ /* \<digit> has been turned into a `duplicate' command which is
++ followed by the numeric value of <digit> as the register number. */
++ case duplicate:
++ {
++ register const CHAR_T *d2, *dend2;
++ int regno = *p++; /* Get which register to match against. */
++ DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno);
++
++ /* Can't back reference a group which we've never matched. */
++ if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno]))
++ goto fail;
++
++ /* Where in input to try to start matching. */
++ d2 = regstart[regno];
++
++ /* Where to stop matching; if both the place to start and
++ the place to stop matching are in the same string, then
++ set to the place to stop, otherwise, for now have to use
++ the end of the first string. */
++
++ dend2 = ((FIRST_STRING_P (regstart[regno])
++ == FIRST_STRING_P (regend[regno]))
++ ? regend[regno] : end_match_1);
++ for (;;)
++ {
++ /* If necessary, advance to next segment in register
++ contents. */
++ while (d2 == dend2)
++ {
++ if (dend2 == end_match_2) break;
++ if (dend2 == regend[regno]) break;
++
++ /* End of string1 => advance to string2. */
++ d2 = string2;
++ dend2 = regend[regno];
++ }
++ /* At end of register contents => success */
++ if (d2 == dend2) break;
++
++ /* If necessary, advance to next segment in data. */
++ PREFETCH ();
++
++ /* How many characters left in this segment to match. */
++ mcnt = dend - d;
++
++ /* Want how many consecutive characters we can match in
++ one shot, so, if necessary, adjust the count. */
++ if (mcnt > dend2 - d2)
++ mcnt = dend2 - d2;
++
++ /* Compare that many; failure if mismatch, else move
++ past them. */
++ if (translate
++ ? PREFIX(bcmp_translate) (d, d2, mcnt, translate)
++ : memcmp (d, d2, mcnt*sizeof(UCHAR_T)))
++ goto fail;
++ d += mcnt, d2 += mcnt;
++
++ /* Do this because we've match some characters. */
++ SET_REGS_MATCHED ();
++ }
++ }
++ break;
++
++
++ /* begline matches the empty string at the beginning of the string
++ (unless `not_bol' is set in `bufp'), and, if
++ `newline_anchor' is set, after newlines. */
++ case begline:
++ DEBUG_PRINT1 ("EXECUTING begline.\n");
++
++ if (AT_STRINGS_BEG (d))
++ {
++ if (!bufp->not_bol) break;
++ }
++ else if (d[-1] == '\n' && bufp->newline_anchor)
++ {
++ break;
++ }
++ /* In all other cases, we fail. */
++ goto fail;
++
++
++ /* endline is the dual of begline. */
++ case endline:
++ DEBUG_PRINT1 ("EXECUTING endline.\n");
++
++ if (AT_STRINGS_END (d))
++ {
++ if (!bufp->not_eol) break;
++ }
++
++ /* We have to ``prefetch'' the next character. */
++ else if ((d == end1 ? *string2 : *d) == '\n'
++ && bufp->newline_anchor)
++ {
++ break;
++ }
++ goto fail;
++
++
++ /* Match at the very beginning of the data. */
++ case begbuf:
++ DEBUG_PRINT1 ("EXECUTING begbuf.\n");
++ if (AT_STRINGS_BEG (d))
++ break;
++ goto fail;
++
++
++ /* Match at the very end of the data. */
++ case endbuf:
++ DEBUG_PRINT1 ("EXECUTING endbuf.\n");
++ if (AT_STRINGS_END (d))
++ break;
++ goto fail;
++
++
++ /* on_failure_keep_string_jump is used to optimize `.*\n'. It
++ pushes NULL as the value for the string on the stack. Then
++ `pop_failure_point' will keep the current value for the
++ string, instead of restoring it. To see why, consider
++ matching `foo\nbar' against `.*\n'. The .* matches the foo;
++ then the . fails against the \n. But the next thing we want
++ to do is match the \n against the \n; if we restored the
++ string value, we would be back at the foo.
++
++ Because this is used only in specific cases, we don't need to
++ check all the things that `on_failure_jump' does, to make
++ sure the right things get saved on the stack. Hence we don't
++ share its code. The only reason to push anything on the
++ stack at all is that otherwise we would have to change
++ `anychar's code to do something besides goto fail in this
++ case; that seems worse than this. */
++ case on_failure_keep_string_jump:
++ DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump");
++
++ EXTRACT_NUMBER_AND_INCR (mcnt, p);
++#ifdef _LIBC
++ DEBUG_PRINT3 (" %d (to %p):\n", mcnt, p + mcnt);
++#else
++ DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt);
++#endif
++
++ PUSH_FAILURE_POINT (p + mcnt, NULL, -2);
++ break;
++
++
++ /* Uses of on_failure_jump:
++
++ Each alternative starts with an on_failure_jump that points
++ to the beginning of the next alternative. Each alternative
++ except the last ends with a jump that in effect jumps past
++ the rest of the alternatives. (They really jump to the
++ ending jump of the following alternative, because tensioning
++ these jumps is a hassle.)
++
++ Repeats start with an on_failure_jump that points past both
++ the repetition text and either the following jump or
++ pop_failure_jump back to this on_failure_jump. */
++ case on_failure_jump:
++ on_failure:
++ DEBUG_PRINT1 ("EXECUTING on_failure_jump");
++
++ EXTRACT_NUMBER_AND_INCR (mcnt, p);
++#ifdef _LIBC
++ DEBUG_PRINT3 (" %d (to %p)", mcnt, p + mcnt);
++#else
++ DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt);
++#endif
++
++ /* If this on_failure_jump comes right before a group (i.e.,
++ the original * applied to a group), save the information
++ for that group and all inner ones, so that if we fail back
++ to this point, the group's information will be correct.
++ For example, in \(a*\)*\1, we need the preceding group,
++ and in \(zz\(a*\)b*\)\2, we need the inner group. */
++
++ /* We can't use `p' to check ahead because we push
++ a failure point to `p + mcnt' after we do this. */
++ p1 = p;
++
++ /* We need to skip no_op's before we look for the
++ start_memory in case this on_failure_jump is happening as
++ the result of a completed succeed_n, as in \(a\)\{1,3\}b\1
++ against aba. */
++ while (p1 < pend && (re_opcode_t) *p1 == no_op)
++ p1++;
++
++ if (p1 < pend && (re_opcode_t) *p1 == start_memory)
++ {
++ /* We have a new highest active register now. This will
++ get reset at the start_memory we are about to get to,
++ but we will have saved all the registers relevant to
++ this repetition op, as described above. */
++ highest_active_reg = *(p1 + 1) + *(p1 + 2);
++ if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
++ lowest_active_reg = *(p1 + 1);
++ }
++
++ DEBUG_PRINT1 (":\n");
++ PUSH_FAILURE_POINT (p + mcnt, d, -2);
++ break;
++
++
++ /* A smart repeat ends with `maybe_pop_jump'.
++ We change it to either `pop_failure_jump' or `jump'. */
++ case maybe_pop_jump:
++ EXTRACT_NUMBER_AND_INCR (mcnt, p);
++ DEBUG_PRINT2 ("EXECUTING maybe_pop_jump %d.\n", mcnt);
++ {
++ register UCHAR_T *p2 = p;
++
++ /* Compare the beginning of the repeat with what in the
++ pattern follows its end. If we can establish that there
++ is nothing that they would both match, i.e., that we
++ would have to backtrack because of (as in, e.g., `a*a')
++ then we can change to pop_failure_jump, because we'll
++ never have to backtrack.
++
++ This is not true in the case of alternatives: in
++ `(a|ab)*' we do need to backtrack to the `ab' alternative
++ (e.g., if the string was `ab'). But instead of trying to
++ detect that here, the alternative has put on a dummy
++ failure point which is what we will end up popping. */
++
++ /* Skip over open/close-group commands.
++ If what follows this loop is a ...+ construct,
++ look at what begins its body, since we will have to
++ match at least one of that. */
++ while (1)
++ {
++ if (p2 + 2 < pend
++ && ((re_opcode_t) *p2 == stop_memory
++ || (re_opcode_t) *p2 == start_memory))
++ p2 += 3;
++ else if (p2 + 2 + 2 * OFFSET_ADDRESS_SIZE < pend
++ && (re_opcode_t) *p2 == dummy_failure_jump)
++ p2 += 2 + 2 * OFFSET_ADDRESS_SIZE;
++ else
++ break;
++ }
++
++ p1 = p + mcnt;
++ /* p1[0] ... p1[2] are the `on_failure_jump' corresponding
++ to the `maybe_finalize_jump' of this case. Examine what
++ follows. */
++
++ /* If we're at the end of the pattern, we can change. */
++ if (p2 == pend)
++ {
++ /* Consider what happens when matching ":\(.*\)"
++ against ":/". I don't really understand this code
++ yet. */
++ p[-(1+OFFSET_ADDRESS_SIZE)] = (UCHAR_T)
++ pop_failure_jump;
++ DEBUG_PRINT1
++ (" End of pattern: change to `pop_failure_jump'.\n");
++ }
++
++ else if ((re_opcode_t) *p2 == exactn
++#ifdef MBS_SUPPORT
++ || (re_opcode_t) *p2 == exactn_bin
++#endif
++ || (bufp->newline_anchor && (re_opcode_t) *p2 == endline))
++ {
++ register UCHAR_T c
++ = *p2 == (UCHAR_T) endline ? '\n' : p2[2];
++
++ if (((re_opcode_t) p1[1+OFFSET_ADDRESS_SIZE] == exactn
++#ifdef MBS_SUPPORT
++ || (re_opcode_t) p1[1+OFFSET_ADDRESS_SIZE] == exactn_bin
++#endif
++ ) && p1[3+OFFSET_ADDRESS_SIZE] != c)
++ {
++ p[-(1+OFFSET_ADDRESS_SIZE)] = (UCHAR_T)
++ pop_failure_jump;
++#ifdef WCHAR
++ DEBUG_PRINT3 (" %C != %C => pop_failure_jump.\n",
++ (wint_t) c,
++ (wint_t) p1[3+OFFSET_ADDRESS_SIZE]);
++#else
++ DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n",
++ (char) c,
++ (char) p1[3+OFFSET_ADDRESS_SIZE]);
++#endif
++ }
++
++#ifndef WCHAR
++ else if ((re_opcode_t) p1[3] == charset
++ || (re_opcode_t) p1[3] == charset_not)
++ {
++ int negate = (re_opcode_t) p1[3] == charset_not;
++
++ if (c < (unsigned) (p1[4] * BYTEWIDTH)
++ && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
++ negate = !negate;
++
++ /* `negate' is equal to 1 if c would match, which means
++ that we can't change to pop_failure_jump. */
++ if (!negate)
++ {
++ p[-3] = (unsigned char) pop_failure_jump;
++ DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
++ }
++ }
++#endif /* not WCHAR */
++ }
++#ifndef WCHAR
++ else if ((re_opcode_t) *p2 == charset)
++ {
++ /* We win if the first character of the loop is not part
++ of the charset. */
++ if ((re_opcode_t) p1[3] == exactn
++ && ! ((int) p2[1] * BYTEWIDTH > (int) p1[5]
++ && (p2[2 + p1[5] / BYTEWIDTH]
++ & (1 << (p1[5] % BYTEWIDTH)))))
++ {
++ p[-3] = (unsigned char) pop_failure_jump;
++ DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
++ }
++
++ else if ((re_opcode_t) p1[3] == charset_not)
++ {
++ int idx;
++ /* We win if the charset_not inside the loop
++ lists every character listed in the charset after. */
++ for (idx = 0; idx < (int) p2[1]; idx++)
++ if (! (p2[2 + idx] == 0
++ || (idx < (int) p1[4]
++ && ((p2[2 + idx] & ~ p1[5 + idx]) == 0))))
++ break;
++
++ if (idx == p2[1])
++ {
++ p[-3] = (unsigned char) pop_failure_jump;
++ DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
++ }
++ }
++ else if ((re_opcode_t) p1[3] == charset)
++ {
++ int idx;
++ /* We win if the charset inside the loop
++ has no overlap with the one after the loop. */
++ for (idx = 0;
++ idx < (int) p2[1] && idx < (int) p1[4];
++ idx++)
++ if ((p2[2 + idx] & p1[5 + idx]) != 0)
++ break;
++
++ if (idx == p2[1] || idx == p1[4])
++ {
++ p[-3] = (unsigned char) pop_failure_jump;
++ DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
++ }
++ }
++ }
++#endif /* not WCHAR */
++ }
++ p -= OFFSET_ADDRESS_SIZE; /* Point at relative address again. */
++ if ((re_opcode_t) p[-1] != pop_failure_jump)
++ {
++ p[-1] = (UCHAR_T) jump;
++ DEBUG_PRINT1 (" Match => jump.\n");
++ goto unconditional_jump;
++ }
++ /* Note fall through. */
++
++
++ /* The end of a simple repeat has a pop_failure_jump back to
++ its matching on_failure_jump, where the latter will push a
++ failure point. The pop_failure_jump takes off failure
++ points put on by this pop_failure_jump's matching
++ on_failure_jump; we got through the pattern to here from the
++ matching on_failure_jump, so didn't fail. */
++ case pop_failure_jump:
++ {
++ /* We need to pass separate storage for the lowest and
++ highest registers, even though we don't care about the
++ actual values. Otherwise, we will restore only one
++ register from the stack, since lowest will == highest in
++ `pop_failure_point'. */
++ active_reg_t dummy_low_reg, dummy_high_reg;
++ UCHAR_T *pdummy __attribute__ ((unused)) = NULL;
++ const CHAR_T *sdummy __attribute__ ((unused)) = NULL;
++
++ DEBUG_PRINT1 ("EXECUTING pop_failure_jump.\n");
++ POP_FAILURE_POINT (sdummy, pdummy,
++ dummy_low_reg, dummy_high_reg,
++ reg_dummy, reg_dummy, reg_info_dummy);
++ }
++ /* Note fall through. */
++
++ unconditional_jump:
++#ifdef _LIBC
++ DEBUG_PRINT2 ("\n%p: ", p);
++#else
++ DEBUG_PRINT2 ("\n0x%x: ", p);
++#endif
++ /* Note fall through. */
++
++ /* Unconditionally jump (without popping any failure points). */
++ case jump:
++ EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */
++ DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt);
++ p += mcnt; /* Do the jump. */
++#ifdef _LIBC
++ DEBUG_PRINT2 ("(to %p).\n", p);
++#else
++ DEBUG_PRINT2 ("(to 0x%x).\n", p);
++#endif
++ break;
++
++
++ /* We need this opcode so we can detect where alternatives end
++ in `group_match_null_string_p' et al. */
++ case jump_past_alt:
++ DEBUG_PRINT1 ("EXECUTING jump_past_alt.\n");
++ goto unconditional_jump;
++
++
++ /* Normally, the on_failure_jump pushes a failure point, which
++ then gets popped at pop_failure_jump. We will end up at
++ pop_failure_jump, also, and with a pattern of, say, `a+', we
++ are skipping over the on_failure_jump, so we have to push
++ something meaningless for pop_failure_jump to pop. */
++ case dummy_failure_jump:
++ DEBUG_PRINT1 ("EXECUTING dummy_failure_jump.\n");
++ /* It doesn't matter what we push for the string here. What
++ the code at `fail' tests is the value for the pattern. */
++ PUSH_FAILURE_POINT (NULL, NULL, -2);
++ goto unconditional_jump;
++
++
++ /* At the end of an alternative, we need to push a dummy failure
++ point in case we are followed by a `pop_failure_jump', because
++ we don't want the failure point for the alternative to be
++ popped. For example, matching `(a|ab)*' against `aab'
++ requires that we match the `ab' alternative. */
++ case push_dummy_failure:
++ DEBUG_PRINT1 ("EXECUTING push_dummy_failure.\n");
++ /* See comments just above at `dummy_failure_jump' about the
++ two zeroes. */
++ PUSH_FAILURE_POINT (NULL, NULL, -2);
++ break;
++
++ /* Have to succeed matching what follows at least n times.
++ After that, handle like `on_failure_jump'. */
++ case succeed_n:
++ EXTRACT_NUMBER (mcnt, p + OFFSET_ADDRESS_SIZE);
++ DEBUG_PRINT2 ("EXECUTING succeed_n %d.\n", mcnt);
++
++ assert (mcnt >= 0);
++ /* Originally, this is how many times we HAVE to succeed. */
++ if (mcnt > 0)
++ {
++ mcnt--;
++ p += OFFSET_ADDRESS_SIZE;
++ STORE_NUMBER_AND_INCR (p, mcnt);
++#ifdef _LIBC
++ DEBUG_PRINT3 (" Setting %p to %d.\n", p - OFFSET_ADDRESS_SIZE
++ , mcnt);
++#else
++ DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p - OFFSET_ADDRESS_SIZE
++ , mcnt);
++#endif
++ }
++ else if (mcnt == 0)
++ {
++#ifdef _LIBC
++ DEBUG_PRINT2 (" Setting two bytes from %p to no_op.\n",
++ p + OFFSET_ADDRESS_SIZE);
++#else
++ DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n",
++ p + OFFSET_ADDRESS_SIZE);
++#endif /* _LIBC */
++
++#ifdef WCHAR
++ p[1] = (UCHAR_T) no_op;
++#else
++ p[2] = (UCHAR_T) no_op;
++ p[3] = (UCHAR_T) no_op;
++#endif /* WCHAR */
++ goto on_failure;
++ }
++ break;
++
++ case jump_n:
++ EXTRACT_NUMBER (mcnt, p + OFFSET_ADDRESS_SIZE);
++ DEBUG_PRINT2 ("EXECUTING jump_n %d.\n", mcnt);
++
++ /* Originally, this is how many times we CAN jump. */
++ if (mcnt)
++ {
++ mcnt--;
++ STORE_NUMBER (p + OFFSET_ADDRESS_SIZE, mcnt);
++
++#ifdef _LIBC
++ DEBUG_PRINT3 (" Setting %p to %d.\n", p + OFFSET_ADDRESS_SIZE,
++ mcnt);
++#else
++ DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p + OFFSET_ADDRESS_SIZE,
++ mcnt);
++#endif /* _LIBC */
++ goto unconditional_jump;
++ }
++ /* If don't have to jump any more, skip over the rest of command. */
++ else
++ p += 2 * OFFSET_ADDRESS_SIZE;
++ break;
++
++ case set_number_at:
++ {
++ DEBUG_PRINT1 ("EXECUTING set_number_at.\n");
++
++ EXTRACT_NUMBER_AND_INCR (mcnt, p);
++ p1 = p + mcnt;
++ EXTRACT_NUMBER_AND_INCR (mcnt, p);
++#ifdef _LIBC
++ DEBUG_PRINT3 (" Setting %p to %d.\n", p1, mcnt);
++#else
++ DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt);
++#endif
++ STORE_NUMBER (p1, mcnt);
++ break;
++ }
++
++#if 0
++ /* The DEC Alpha C compiler 3.x generates incorrect code for the
++ test WORDCHAR_P (d - 1) != WORDCHAR_P (d) in the expansion of
++ AT_WORD_BOUNDARY, so this code is disabled. Expanding the
++ macro and introducing temporary variables works around the bug. */
++
++ case wordbound:
++ DEBUG_PRINT1 ("EXECUTING wordbound.\n");
++ if (AT_WORD_BOUNDARY (d))
++ break;
++ goto fail;
++
++ case notwordbound:
++ DEBUG_PRINT1 ("EXECUTING notwordbound.\n");
++ if (AT_WORD_BOUNDARY (d))
++ goto fail;
++ break;
++#else
++ case wordbound:
++ {
++ boolean prevchar, thischar;
++
++ DEBUG_PRINT1 ("EXECUTING wordbound.\n");
++ if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d))
++ break;
++
++ prevchar = WORDCHAR_P (d - 1);
++ thischar = WORDCHAR_P (d);
++ if (prevchar != thischar)
++ break;
++ goto fail;
++ }
++
++ case notwordbound:
++ {
++ boolean prevchar, thischar;
++
++ DEBUG_PRINT1 ("EXECUTING notwordbound.\n");
++ if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d))
++ goto fail;
++
++ prevchar = WORDCHAR_P (d - 1);
++ thischar = WORDCHAR_P (d);
++ if (prevchar != thischar)
++ goto fail;
++ break;
++ }
++#endif
++
++ case wordbeg:
++ DEBUG_PRINT1 ("EXECUTING wordbeg.\n");
++ if (!AT_STRINGS_END (d) && WORDCHAR_P (d)
++ && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1)))
++ break;
++ goto fail;
++
++ case wordend:
++ DEBUG_PRINT1 ("EXECUTING wordend.\n");
++ if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1)
++ && (AT_STRINGS_END (d) || !WORDCHAR_P (d)))
++ break;
++ goto fail;
++
++#ifdef emacs
++ case before_dot:
++ DEBUG_PRINT1 ("EXECUTING before_dot.\n");
++ if (PTR_CHAR_POS ((unsigned char *) d) >= point)
++ goto fail;
++ break;
++
++ case at_dot:
++ DEBUG_PRINT1 ("EXECUTING at_dot.\n");
++ if (PTR_CHAR_POS ((unsigned char *) d) != point)
++ goto fail;
++ break;
++
++ case after_dot:
++ DEBUG_PRINT1 ("EXECUTING after_dot.\n");
++ if (PTR_CHAR_POS ((unsigned char *) d) <= point)
++ goto fail;
++ break;
++
++ case syntaxspec:
++ DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt);
++ mcnt = *p++;
++ goto matchsyntax;
++
++ case wordchar:
++ DEBUG_PRINT1 ("EXECUTING Emacs wordchar.\n");
++ mcnt = (int) Sword;
++ matchsyntax:
++ PREFETCH ();
++ /* Can't use *d++ here; SYNTAX may be an unsafe macro. */
++ d++;
++ if (SYNTAX (d[-1]) != (enum syntaxcode) mcnt)
++ goto fail;
++ SET_REGS_MATCHED ();
++ break;
++
++ case notsyntaxspec:
++ DEBUG_PRINT2 ("EXECUTING notsyntaxspec %d.\n", mcnt);
++ mcnt = *p++;
++ goto matchnotsyntax;
++
++ case notwordchar:
++ DEBUG_PRINT1 ("EXECUTING Emacs notwordchar.\n");
++ mcnt = (int) Sword;
++ matchnotsyntax:
++ PREFETCH ();
++ /* Can't use *d++ here; SYNTAX may be an unsafe macro. */
++ d++;
++ if (SYNTAX (d[-1]) == (enum syntaxcode) mcnt)
++ goto fail;
++ SET_REGS_MATCHED ();
++ break;
++
++#else /* not emacs */
++ case wordchar:
++ DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n");
++ PREFETCH ();
++ if (!WORDCHAR_P (d))
++ goto fail;
++ SET_REGS_MATCHED ();
++ d++;
++ break;
++
++ case notwordchar:
++ DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n");
++ PREFETCH ();
++ if (WORDCHAR_P (d))
++ goto fail;
++ SET_REGS_MATCHED ();
++ d++;
++ break;
++#endif /* not emacs */
++
++ default:
++ abort ();
++ }
++ continue; /* Successfully executed one pattern command; keep going. */
++
++
++ /* We goto here if a matching operation fails. */
++ fail:
++ if (!FAIL_STACK_EMPTY ())
++ { /* A restart point is known. Restore to that state. */
++ DEBUG_PRINT1 ("\nFAIL:\n");
++ POP_FAILURE_POINT (d, p,
++ lowest_active_reg, highest_active_reg,
++ regstart, regend, reg_info);
++
++ /* If this failure point is a dummy, try the next one. */
++ if (!p)
++ goto fail;
++
++ /* If we failed to the end of the pattern, don't examine *p. */
++ assert (p <= pend);
++ if (p < pend)
++ {
++ boolean is_a_jump_n = false;
++
++ /* If failed to a backwards jump that's part of a repetition
++ loop, need to pop this failure point and use the next one. */
++ switch ((re_opcode_t) *p)
++ {
++ case jump_n:
++ is_a_jump_n = true;
++ case maybe_pop_jump:
++ case pop_failure_jump:
++ case jump:
++ p1 = p + 1;
++ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
++ p1 += mcnt;
++
++ if ((is_a_jump_n && (re_opcode_t) *p1 == succeed_n)
++ || (!is_a_jump_n
++ && (re_opcode_t) *p1 == on_failure_jump))
++ goto fail;
++ break;
++ default:
++ /* do nothing */ ;
++ }
++ }
++
++ if (d >= string1 && d <= end1)
++ dend = end_match_1;
++ }
++ else
++ break; /* Matching at this starting point really fails. */
++ } /* for (;;) */
++
++ if (best_regs_set)
++ goto restore_best_regs;
++
++ FREE_VARIABLES ();
++
++ return -1; /* Failure to match. */
++} /* re_match_2 */
++
++/* Subroutine definitions for re_match_2. */
++
++
++/* We are passed P pointing to a register number after a start_memory.
++
++ Return true if the pattern up to the corresponding stop_memory can
++ match the empty string, and false otherwise.
++
++ If we find the matching stop_memory, sets P to point to one past its number.
++ Otherwise, sets P to an undefined byte less than or equal to END.
++
++ We don't handle duplicates properly (yet). */
++
++static boolean
++PREFIX(group_match_null_string_p) (UCHAR_T **p, UCHAR_T *end,
++ PREFIX(register_info_type) *reg_info)
++{
++ int mcnt;
++ /* Point to after the args to the start_memory. */
++ UCHAR_T *p1 = *p + 2;
++
++ while (p1 < end)
++ {
++ /* Skip over opcodes that can match nothing, and return true or
++ false, as appropriate, when we get to one that can't, or to the
++ matching stop_memory. */
++
++ switch ((re_opcode_t) *p1)
++ {
++ /* Could be either a loop or a series of alternatives. */
++ case on_failure_jump:
++ p1++;
++ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
++
++ /* If the next operation is not a jump backwards in the
++ pattern. */
++
++ if (mcnt >= 0)
++ {
++ /* Go through the on_failure_jumps of the alternatives,
++ seeing if any of the alternatives cannot match nothing.
++ The last alternative starts with only a jump,
++ whereas the rest start with on_failure_jump and end
++ with a jump, e.g., here is the pattern for `a|b|c':
++
++ /on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6
++ /on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3
++ /exactn/1/c
++
++ So, we have to first go through the first (n-1)
++ alternatives and then deal with the last one separately. */
++
++
++ /* Deal with the first (n-1) alternatives, which start
++ with an on_failure_jump (see above) that jumps to right
++ past a jump_past_alt. */
++
++ while ((re_opcode_t) p1[mcnt-(1+OFFSET_ADDRESS_SIZE)] ==
++ jump_past_alt)
++ {
++ /* `mcnt' holds how many bytes long the alternative
++ is, including the ending `jump_past_alt' and
++ its number. */
++
++ if (!PREFIX(alt_match_null_string_p) (p1, p1 + mcnt -
++ (1 + OFFSET_ADDRESS_SIZE),
++ reg_info))
++ return false;
++
++ /* Move to right after this alternative, including the
++ jump_past_alt. */
++ p1 += mcnt;
++
++ /* Break if it's the beginning of an n-th alternative
++ that doesn't begin with an on_failure_jump. */
++ if ((re_opcode_t) *p1 != on_failure_jump)
++ break;
++
++ /* Still have to check that it's not an n-th
++ alternative that starts with an on_failure_jump. */
++ p1++;
++ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
++ if ((re_opcode_t) p1[mcnt-(1+OFFSET_ADDRESS_SIZE)] !=
++ jump_past_alt)
++ {
++ /* Get to the beginning of the n-th alternative. */
++ p1 -= 1 + OFFSET_ADDRESS_SIZE;
++ break;
++ }
++ }
++
++ /* Deal with the last alternative: go back and get number
++ of the `jump_past_alt' just before it. `mcnt' contains
++ the length of the alternative. */
++ EXTRACT_NUMBER (mcnt, p1 - OFFSET_ADDRESS_SIZE);
++
++ if (!PREFIX(alt_match_null_string_p) (p1, p1 + mcnt, reg_info))
++ return false;
++
++ p1 += mcnt; /* Get past the n-th alternative. */
++ } /* if mcnt > 0 */
++ break;
++
++
++ case stop_memory:
++ assert (p1[1] == **p);
++ *p = p1 + 2;
++ return true;
++
++
++ default:
++ if (!PREFIX(common_op_match_null_string_p) (&p1, end, reg_info))
++ return false;
++ }
++ } /* while p1 < end */
++
++ return false;
++} /* group_match_null_string_p */
++
++
++/* Similar to group_match_null_string_p, but doesn't deal with alternatives:
++ It expects P to be the first byte of a single alternative and END one
++ byte past the last. The alternative can contain groups. */
++
++static boolean
++PREFIX(alt_match_null_string_p) (UCHAR_T *p, UCHAR_T *end,
++ PREFIX(register_info_type) *reg_info)
++{
++ int mcnt;
++ UCHAR_T *p1 = p;
++
++ while (p1 < end)
++ {
++ /* Skip over opcodes that can match nothing, and break when we get
++ to one that can't. */
++
++ switch ((re_opcode_t) *p1)
++ {
++ /* It's a loop. */
++ case on_failure_jump:
++ p1++;
++ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
++ p1 += mcnt;
++ break;
++
++ default:
++ if (!PREFIX(common_op_match_null_string_p) (&p1, end, reg_info))
++ return false;
++ }
++ } /* while p1 < end */
++
++ return true;
++} /* alt_match_null_string_p */
++
++
++/* Deals with the ops common to group_match_null_string_p and
++ alt_match_null_string_p.
++
++ Sets P to one after the op and its arguments, if any. */
++
++static boolean
++PREFIX(common_op_match_null_string_p) (UCHAR_T **p, UCHAR_T *end,
++ PREFIX(register_info_type) *reg_info)
++{
++ int mcnt;
++ boolean ret;
++ int reg_no;
++ UCHAR_T *p1 = *p;
++
++ switch ((re_opcode_t) *p1++)
++ {
++ case no_op:
++ case begline:
++ case endline:
++ case begbuf:
++ case endbuf:
++ case wordbeg:
++ case wordend:
++ case wordbound:
++ case notwordbound:
++#ifdef emacs
++ case before_dot:
++ case at_dot:
++ case after_dot:
++#endif
++ break;
++
++ case start_memory:
++ reg_no = *p1;
++ assert (reg_no > 0 && reg_no <= MAX_REGNUM);
++ ret = PREFIX(group_match_null_string_p) (&p1, end, reg_info);
++
++ /* Have to set this here in case we're checking a group which
++ contains a group and a back reference to it. */
++
++ if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE)
++ REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret;
++
++ if (!ret)
++ return false;
++ break;
++
++ /* If this is an optimized succeed_n for zero times, make the jump. */
++ case jump:
++ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
++ if (mcnt >= 0)
++ p1 += mcnt;
++ else
++ return false;
++ break;
++
++ case succeed_n:
++ /* Get to the number of times to succeed. */
++ p1 += OFFSET_ADDRESS_SIZE;
++ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
++
++ if (mcnt == 0)
++ {
++ p1 -= 2 * OFFSET_ADDRESS_SIZE;
++ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
++ p1 += mcnt;
++ }
++ else
++ return false;
++ break;
++
++ case duplicate:
++ if (!REG_MATCH_NULL_STRING_P (reg_info[*p1]))
++ return false;
++ break;
++
++ case set_number_at:
++ p1 += 2 * OFFSET_ADDRESS_SIZE;
++
++ default:
++ /* All other opcodes mean we cannot match the empty string. */
++ return false;
++ }
++
++ *p = p1;
++ return true;
++} /* common_op_match_null_string_p */
++
++
++/* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN
++ bytes; nonzero otherwise. */
++
++static int
++PREFIX(bcmp_translate) (const CHAR_T *s1, const CHAR_T *s2, register int len,
++ RE_TRANSLATE_TYPE translate)
++{
++ register const UCHAR_T *p1 = (const UCHAR_T *) s1;
++ register const UCHAR_T *p2 = (const UCHAR_T *) s2;
++ while (len)
++ {
++#ifdef WCHAR
++ if (((*p1<=0xff)?translate[*p1++]:*p1++)
++ != ((*p2<=0xff)?translate[*p2++]:*p2++))
++ return 1;
++#else /* BYTE */
++ if (translate[*p1++] != translate[*p2++]) return 1;
++#endif /* WCHAR */
++ len--;
++ }
++ return 0;
++}
++
++
++#else /* not INSIDE_RECURSION */
++
++/* Entry points for GNU code. */
++
++/* re_compile_pattern is the GNU regular expression compiler: it
++ compiles PATTERN (of length SIZE) and puts the result in BUFP.
++ Returns 0 if the pattern was valid, otherwise an error string.
++
++ Assumes the `allocated' (and perhaps `buffer') and `translate' fields
++ are set in BUFP on entry.
++
++ We call regex_compile to do the actual compilation. */
++
++const char *
++re_compile_pattern (const char *pattern, size_t length,
++ struct re_pattern_buffer *bufp)
++{
++ reg_errcode_t ret;
++
++ /* GNU code is written to assume at least RE_NREGS registers will be set
++ (and at least one extra will be -1). */
++ bufp->regs_allocated = REGS_UNALLOCATED;
++
++ /* And GNU code determines whether or not to get register information
++ by passing null for the REGS argument to re_match, etc., not by
++ setting no_sub. */
++ bufp->no_sub = 0;
++
++ /* Match anchors at newline. */
++ bufp->newline_anchor = 1;
++
++# ifdef MBS_SUPPORT
++ if (MB_CUR_MAX != 1)
++ ret = wcs_regex_compile (pattern, length, re_syntax_options, bufp);
++ else
++# endif
++ ret = byte_regex_compile (pattern, length, re_syntax_options, bufp);
++
++ if (!ret)
++ return NULL;
++ return gettext (re_error_msgid[(int) ret]);
++}
++#ifdef _LIBC
++weak_alias (__re_compile_pattern, re_compile_pattern)
++#endif
++
++/* Entry points compatible with 4.2 BSD regex library. We don't define
++ them unless specifically requested. */
++
++#if defined _REGEX_RE_COMP || defined _LIBC
++
++/* BSD has one and only one pattern buffer. */
++static struct re_pattern_buffer re_comp_buf;
++
++char *
++#ifdef _LIBC
++/* Make these definitions weak in libc, so POSIX programs can redefine
++ these names if they don't use our functions, and still use
++ regcomp/regexec below without link errors. */
++weak_function
++#endif
++re_comp (const char *s)
++{
++ reg_errcode_t ret;
++
++ if (!s)
++ {
++ if (!re_comp_buf.buffer)
++ return (char *) gettext ("No previous regular expression");
++ return 0;
++ }
++
++ if (!re_comp_buf.buffer)
++ {
++ re_comp_buf.buffer = (unsigned char *) malloc (200);
++ if (re_comp_buf.buffer == NULL)
++ return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
++ re_comp_buf.allocated = 200;
++
++ re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH);
++ if (re_comp_buf.fastmap == NULL)
++ return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
++ }
++
++ /* Since `re_exec' always passes NULL for the `regs' argument, we
++ don't need to initialize the pattern buffer fields which affect it. */
++
++ /* Match anchors at newlines. */
++ re_comp_buf.newline_anchor = 1;
++
++# ifdef MBS_SUPPORT
++ if (MB_CUR_MAX != 1)
++ ret = wcs_regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf);
++ else
++# endif
++ ret = byte_regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf);
++
++ if (!ret)
++ return NULL;
++
++ /* Yes, we're discarding `const' here if !HAVE_LIBINTL. */
++ return (char *) gettext (re_error_msgid[(int) ret]);
++}
++
++
++int
++#ifdef _LIBC
++weak_function
++#endif
++re_exec (const char *s)
++{
++ const int len = strlen (s);
++ return
++ 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0);
++}
++
++#endif /* _REGEX_RE_COMP */
++
++/* POSIX.2 functions. Don't define these for Emacs. */
++
++#ifndef emacs
++
++/* regcomp takes a regular expression as a string and compiles it.
++
++ PREG is a regex_t *. We do not expect any fields to be initialized,
++ since POSIX says we shouldn't. Thus, we set
++
++ `buffer' to the compiled pattern;
++ `used' to the length of the compiled pattern;
++ `syntax' to RE_SYNTAX_POSIX_EXTENDED if the
++ REG_EXTENDED bit in CFLAGS is set; otherwise, to
++ RE_SYNTAX_POSIX_BASIC;
++ `newline_anchor' to REG_NEWLINE being set in CFLAGS;
++ `fastmap' to an allocated space for the fastmap;
++ `fastmap_accurate' to zero;
++ `re_nsub' to the number of subexpressions in PATTERN.
++
++ PATTERN is the address of the pattern string.
++
++ CFLAGS is a series of bits which affect compilation.
++
++ If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we
++ use POSIX basic syntax.
++
++ If REG_NEWLINE is set, then . and [^...] don't match newline.
++ Also, regexec will try a match beginning after every newline.
++
++ If REG_ICASE is set, then we considers upper- and lowercase
++ versions of letters to be equivalent when matching.
++
++ If REG_NOSUB is set, then when PREG is passed to regexec, that
++ routine will report only success or failure, and nothing about the
++ registers.
++
++ It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for
++ the return codes and their meanings.) */
++
++int
++regcomp (regex_t *preg, const char *pattern, int cflags)
++{
++ reg_errcode_t ret;
++ reg_syntax_t syntax
++ = (cflags & REG_EXTENDED) ?
++ RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC;
++
++ /* regex_compile will allocate the space for the compiled pattern. */
++ preg->buffer = 0;
++ preg->allocated = 0;
++ preg->used = 0;
++
++ /* Try to allocate space for the fastmap. */
++ preg->fastmap = (char *) malloc (1 << BYTEWIDTH);
++
++ if (cflags & REG_ICASE)
++ {
++ int i;
++
++ preg->translate
++ = (RE_TRANSLATE_TYPE) malloc (CHAR_SET_SIZE
++ * sizeof (*(RE_TRANSLATE_TYPE)0));
++ if (preg->translate == NULL)
++ return (int) REG_ESPACE;
++
++ /* Map uppercase characters to corresponding lowercase ones. */
++ for (i = 0; i < CHAR_SET_SIZE; i++)
++ preg->translate[i] = ISUPPER (i) ? TOLOWER (i) : i;
++ }
++ else
++ preg->translate = NULL;
++
++ /* If REG_NEWLINE is set, newlines are treated differently. */
++ if (cflags & REG_NEWLINE)
++ { /* REG_NEWLINE implies neither . nor [^...] match newline. */
++ syntax &= ~RE_DOT_NEWLINE;
++ syntax |= RE_HAT_LISTS_NOT_NEWLINE;
++ /* It also changes the matching behavior. */
++ preg->newline_anchor = 1;
++ }
++ else
++ preg->newline_anchor = 0;
++
++ preg->no_sub = !!(cflags & REG_NOSUB);
++
++ /* POSIX says a null character in the pattern terminates it, so we
++ can use strlen here in compiling the pattern. */
++# ifdef MBS_SUPPORT
++ if (MB_CUR_MAX != 1)
++ ret = wcs_regex_compile (pattern, strlen (pattern), syntax, preg);
++ else
++# endif
++ ret = byte_regex_compile (pattern, strlen (pattern), syntax, preg);
++
++ /* POSIX doesn't distinguish between an unmatched open-group and an
++ unmatched close-group: both are REG_EPAREN. */
++ if (ret == REG_ERPAREN) ret = REG_EPAREN;
++
++ if (ret == REG_NOERROR && preg->fastmap)
++ {
++ /* Compute the fastmap now, since regexec cannot modify the pattern
++ buffer. */
++ if (re_compile_fastmap (preg) == -2)
++ {
++ /* Some error occurred while computing the fastmap, just forget
++ about it. */
++ free (preg->fastmap);
++ preg->fastmap = NULL;
++ }
++ }
++
++ return (int) ret;
++}
++#ifdef _LIBC
++weak_alias (__regcomp, regcomp)
++#endif
++
++
++/* regexec searches for a given pattern, specified by PREG, in the
++ string STRING.
++
++ If NMATCH is zero or REG_NOSUB was set in the cflags argument to
++ `regcomp', we ignore PMATCH. Otherwise, we assume PMATCH has at
++ least NMATCH elements, and we set them to the offsets of the
++ corresponding matched substrings.
++
++ EFLAGS specifies `execution flags' which affect matching: if
++ REG_NOTBOL is set, then ^ does not match at the beginning of the
++ string; if REG_NOTEOL is set, then $ does not match at the end.
++
++ We return 0 if we find a match and REG_NOMATCH if not. */
++
++int
++regexec (const regex_t *preg, const char *string, size_t nmatch,
++ regmatch_t pmatch[], int eflags)
++{
++ int ret;
++ struct re_registers regs;
++ regex_t private_preg;
++ int len = strlen (string);
++ boolean want_reg_info = !preg->no_sub && nmatch > 0;
++
++ private_preg = *preg;
++
++ private_preg.not_bol = !!(eflags & REG_NOTBOL);
++ private_preg.not_eol = !!(eflags & REG_NOTEOL);
++
++ /* The user has told us exactly how many registers to return
++ information about, via `nmatch'. We have to pass that on to the
++ matching routines. */
++ private_preg.regs_allocated = REGS_FIXED;
++
++ if (want_reg_info)
++ {
++ regs.num_regs = nmatch;
++ regs.start = TALLOC (nmatch * 2, regoff_t);
++ if (regs.start == NULL)
++ return (int) REG_NOMATCH;
++ regs.end = regs.start + nmatch;
++ }
++
++ /* Perform the searching operation. */
++ ret = re_search (&private_preg, string, len,
++ /* start: */ 0, /* range: */ len,
++ want_reg_info ? &regs : (struct re_registers *) 0);
++
++ /* Copy the register information to the POSIX structure. */
++ if (want_reg_info)
++ {
++ if (ret >= 0)
++ {
++ unsigned r;
++
++ for (r = 0; r < nmatch; r++)
++ {
++ pmatch[r].rm_so = regs.start[r];
++ pmatch[r].rm_eo = regs.end[r];
++ }
++ }
++
++ /* If we needed the temporary register info, free the space now. */
++ free (regs.start);
++ }
++
++ /* We want zero return to mean success, unlike `re_search'. */
++ return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH;
++}
++#ifdef _LIBC
++/* EGLIBC: This is handled in regexec-compat.c. */
++/*weak_alias (__regexec, regexec)*/
++#include "regexec-compat.c"
++#endif
++
++
++/* Returns a message corresponding to an error code, ERRCODE, returned
++ from either regcomp or regexec. We don't use PREG here. */
++
++size_t
++regerror (int errcode, const regex_t *preg __attribute__ ((unused)),
++ char *errbuf, size_t errbuf_size)
++{
++ const char *msg;
++ size_t msg_size;
++
++ if (errcode < 0
++ || errcode >= (int) (sizeof (re_error_msgid)
++ / sizeof (re_error_msgid[0])))
++ /* Only error codes returned by the rest of the code should be passed
++ to this routine. If we are given anything else, or if other regex
++ code generates an invalid error code, then the program has a bug.
++ Dump core so we can fix it. */
++ abort ();
++
++ msg = gettext (re_error_msgid[errcode]);
++
++ msg_size = strlen (msg) + 1; /* Includes the null. */
++
++ if (errbuf_size != 0)
++ {
++ if (msg_size > errbuf_size)
++ {
++#if defined HAVE_MEMPCPY || defined _LIBC
++ *((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
++#else
++ memcpy (errbuf, msg, errbuf_size - 1);
++ errbuf[errbuf_size - 1] = 0;
++#endif
++ }
++ else
++ memcpy (errbuf, msg, msg_size);
++ }
++
++ return msg_size;
++}
++#ifdef _LIBC
++weak_alias (__regerror, regerror)
++#endif
++
++
++/* Free dynamically allocated space used by PREG. */
++
++void
++regfree (regex_t *preg)
++{
++ if (preg->buffer != NULL)
++ free (preg->buffer);
++ preg->buffer = NULL;
++
++ preg->allocated = 0;
++ preg->used = 0;
++
++ if (preg->fastmap != NULL)
++ free (preg->fastmap);
++ preg->fastmap = NULL;
++ preg->fastmap_accurate = 0;
++
++ if (preg->translate != NULL)
++ free (preg->translate);
++ preg->translate = NULL;
++}
++#ifdef _LIBC
++weak_alias (__regfree, regfree)
++#endif
++
++#endif /* not emacs */
++
++#endif /* not INSIDE_RECURSION */
++
++
++#undef STORE_NUMBER
++#undef STORE_NUMBER_AND_INCR
++#undef EXTRACT_NUMBER
++#undef EXTRACT_NUMBER_AND_INCR
++
++#undef DEBUG_PRINT_COMPILED_PATTERN
++#undef DEBUG_PRINT_DOUBLE_STRING
++
++#undef INIT_FAIL_STACK
++#undef RESET_FAIL_STACK
++#undef DOUBLE_FAIL_STACK
++#undef PUSH_PATTERN_OP
++#undef PUSH_FAILURE_POINTER
++#undef PUSH_FAILURE_INT
++#undef PUSH_FAILURE_ELT
++#undef POP_FAILURE_POINTER
++#undef POP_FAILURE_INT
++#undef POP_FAILURE_ELT
++#undef DEBUG_PUSH
++#undef DEBUG_POP
++#undef PUSH_FAILURE_POINT
++#undef POP_FAILURE_POINT
++
++#undef REG_UNSET_VALUE
++#undef REG_UNSET
++
++#undef PATFETCH
++#undef PATFETCH_RAW
++#undef PATUNFETCH
++#undef TRANSLATE
++
++#undef INIT_BUF_SIZE
++#undef GET_BUFFER_SPACE
++#undef BUF_PUSH
++#undef BUF_PUSH_2
++#undef BUF_PUSH_3
++#undef STORE_JUMP
++#undef STORE_JUMP2
++#undef INSERT_JUMP
++#undef INSERT_JUMP2
++#undef EXTEND_BUFFER
++#undef GET_UNSIGNED_NUMBER
++#undef FREE_STACK_RETURN
++
++# undef POINTER_TO_OFFSET
++# undef MATCHING_IN_FRST_STRING
++# undef PREFETCH
++# undef AT_STRINGS_BEG
++# undef AT_STRINGS_END
++# undef WORDCHAR_P
++# undef FREE_VAR
++# undef FREE_VARIABLES
++# undef NO_HIGHEST_ACTIVE_REG
++# undef NO_LOWEST_ACTIVE_REG
++
++# undef CHAR_T
++# undef UCHAR_T
++# undef COMPILED_BUFFER_VAR
++# undef OFFSET_ADDRESS_SIZE
++# undef CHAR_CLASS_SIZE
++# undef PREFIX
++# undef ARG_PREFIX
++# undef PUT_CHAR
++# undef BYTE
++# undef WCHAR
++
++# define DEFINED_ONCE
+Index: git/pwd/Makefile
+===================================================================
+--- git.orig/pwd/Makefile
++++ git/pwd/Makefile
+@@ -18,6 +18,8 @@
+ #
+ # Sub-makefile for pwd portion of the library.
+ #
++include ../option-groups.mak
++
+ subdir := pwd
+
+ include ../Makeconfig
+Index: git/resolv/Makefile
+===================================================================
+--- git.orig/resolv/Makefile
++++ git/resolv/Makefile
+@@ -18,6 +18,8 @@
+ #
+ # Sub-makefile for resolv portion of the library.
+ #
++include ../option-groups.mak
++
+ subdir := resolv
+
+ include ../Makeconfig
+@@ -27,20 +29,21 @@ headers := resolv.h \
+ arpa/nameser.h arpa/nameser_compat.h \
+ sys/bitypes.h
+
+-routines := herror inet_addr inet_ntop inet_pton nsap_addr res_init \
+- res_hconf res_libc res-state
++routines-$(OPTION_EGLIBC_INET) \
++ += herror inet_addr inet_ntop inet_pton nsap_addr res_init \
++ res_hconf res_libc res-state
+
+-tests = tst-aton tst-leaks tst-inet_ntop
+-xtests = tst-leaks2
++tests-$(OPTION_EGLIBC_INET) += tst-aton tst-leaks tst-inet_ntop
++xtests-$(OPTION_EGLIBC_INET) += tst-leaks2
+
+ generate := mtrace-tst-leaks.out tst-leaks.mtrace tst-leaks2.mtrace
+
+-extra-libs := libresolv libnss_dns
++extra-libs-$(OPTION_EGLIBC_INET) += libresolv libnss_dns
+ ifeq ($(have-thread-library),yes)
+-extra-libs += libanl
+-routines += gai_sigqueue
++extra-libs-$(OPTION_EGLIBC_INET_ANL) += libanl
++routines-$(OPTION_EGLIBC_INET) += gai_sigqueue
+ endif
+-extra-libs-others = $(extra-libs)
++extra-libs-others-y += $(extra-libs-y)
+ libresolv-routines := gethnamaddr res_comp res_debug \
+ res_data res_mkquery res_query res_send \
+ inet_net_ntop inet_net_pton inet_neta base64 \
+@@ -60,7 +63,7 @@ routines += $(libnss_dns-
+ static-only-routines += $(libnss_dns-routines) $(libresolv-routines)
+ endif
+
+-ifeq (yesyes,$(build-shared)$(have-thread-library))
++ifeq (yesyesy,$(build-shared)$(have-thread-library)$(OPTION_EGLIBC_INET_ANL))
+ tests: $(objpfx)ga_test
+ endif
+
+Index: git/stdio-common/fxprintf.c
+===================================================================
+--- git.orig/stdio-common/fxprintf.c
++++ git/stdio-common/fxprintf.c
+@@ -23,6 +23,7 @@
+ #include <wchar.h>
+ #include <string.h>
+ #include <libioP.h>
++#include <gnu/option-groups.h>
+
+
+ int
+@@ -37,6 +38,7 @@ __fxprintf (FILE *fp, const char *fmt, .
+ int res;
+ if (_IO_fwide (fp, 0) > 0)
+ {
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ size_t len = strlen (fmt) + 1;
+ wchar_t wfmt[len];
+ for (size_t i = 0; i < len; ++i)
+@@ -45,6 +47,9 @@ __fxprintf (FILE *fp, const char *fmt, .
+ wfmt[i] = fmt[i];
+ }
+ res = __vfwprintf (fp, wfmt, ap);
++#else
++ abort();
++#endif
+ }
+ else
+ res = _IO_vfprintf (fp, fmt, ap);
+Index: git/stdio-common/_i18n_number.h
+===================================================================
+--- git.orig/stdio-common/_i18n_number.h
++++ git/stdio-common/_i18n_number.h
+@@ -19,10 +19,13 @@
+ #include <stdbool.h>
+ #include <wchar.h>
+ #include <wctype.h>
++#include <gnu/option-groups.h>
+
+ #include "../locale/outdigits.h"
+ #include "../locale/outdigitswc.h"
+
++#if __OPTION_EGLIBC_LOCALE_CODE
++
+ static CHAR_T *
+ _i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end)
+ {
+@@ -115,3 +118,13 @@ _i18n_number_rewrite (CHAR_T *w, CHAR_T
+
+ return w;
+ }
++
++#else
++
++static CHAR_T *
++_i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end)
++{
++ return w;
++}
++
++#endif
+Index: git/stdio-common/Makefile
+===================================================================
+--- git.orig/stdio-common/Makefile
++++ git/stdio-common/Makefile
+@@ -18,6 +18,8 @@
+ #
+ # Specific makefile for stdio-common.
+ #
++include ../option-groups.mak
++
+ subdir := stdio-common
+
+ include ../Makeconfig
+@@ -30,7 +32,7 @@ routines := \
+ vfprintf vprintf printf_fp reg-printf printf-prs printf_fphex \
+ reg-modifier reg-type \
+ printf_size fprintf printf snprintf sprintf asprintf dprintf \
+- vfwprintf vfscanf vfwscanf \
++ vfscanf \
+ fscanf scanf sscanf \
+ perror psignal \
+ tmpfile tmpfile64 tmpnam tmpnam_r tempnam tempname \
+@@ -41,23 +43,36 @@ routines := \
+ isoc99_vsscanf \
+ psiginfo
+
+-aux := errlist siglist printf-parsemb printf-parsewc fxprintf
++# Ideally, _itowa and itowa-digits would be in this option group as
++# well, but it is used unconditionally by printf_fp and printf_fphex,
++# and it didn't seem straightforward to disentangle it.
++routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
++ += vfwprintf vfwscanf
++
++aux := errlist siglist printf-parsemb fxprintf
++aux-$(OPTION_POSIX_C_LANG_WIDE_CHAR) += printf-parsewc
+
+ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
+ temptest tst-fileno test-fwrite tst-ungetc tst-ferror \
+ xbug errnobug \
+ bug1 bug2 bug3 bug4 bug5 bug6 bug7 bug8 bug9 bug10 bug11 bug12 bug13 \
+- tfformat tiformat tllformat tstdiomisc tst-printfsz tst-wc-printf \
++ tfformat tiformat tllformat tstdiomisc tst-printfsz \
+ scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10 \
+- scanf11 scanf12 tst-tmpnam tst-cookie tst-obprintf tst-sscanf \
+- tst-swprintf tst-fseek tst-fmemopen test-vfprintf tst-gets \
+- tst-perror tst-sprintf tst-rndseek tst-fdopen tst-fphex bug14 \
++ scanf11 scanf12 tst-tmpnam tst-cookie tst-obprintf \
++ tst-fseek tst-fmemopen tst-gets \
++ tst-sprintf tst-rndseek tst-fdopen tst-fphex \
+ tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
+- tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \
+- bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \
+- scanf16 scanf17 tst-setvbuf1 tst-grouping bug23 bug24 \
+- bug-vfprintf-nargs tst-long-dbl-fphex tst-fphex-wide tst-sprintf3 \
++ tst-fwrite bug16 bug17 tst-sprintf2 bug18 \
++ bug19 tst-popen2 scanf14 scanf15 bug21 bug22 \
++ scanf16 scanf17 tst-setvbuf1 bug23 bug24 \
++ bug-vfprintf-nargs tst-sprintf3 \
+ bug25 tst-printf-round bug23-2 bug23-3 bug23-4 bug26
++tests-$(OPTION_EGLIBC_LOCALE_CODE) \
++ += tst-sscanf tst-swprintf test-vfprintf bug14 scanf13 tst-grouping
++tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
++ += tst-perror bug19a bug20 tst-long-dbl-fphex tst-fphex-wide
++tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
++ += bug18a tst-swscanf tst-wc-printf
+
+ test-srcs = tst-unbputc tst-printf
+
+Index: git/stdio-common/printf_fp.c
+===================================================================
+--- git.orig/stdio-common/printf_fp.c
++++ git/stdio-common/printf_fp.c
+@@ -39,6 +39,7 @@
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <wchar.h>
++#include <gnu/option-groups.h>
+ #include <stdbool.h>
+ #include <rounding-mode.h>
+
+@@ -142,6 +143,10 @@ extern mp_size_t __mpn_extract_long_doub
+ extern unsigned int __guess_grouping (unsigned int intdig_max,
+ const char *grouping);
+
++/* Ideally, when OPTION_EGLIBC_LOCALE_CODE is disabled, this should do
++ all its work in ordinary characters, rather than doing it in wide
++ characters and then converting at the end. But that is a challenge
++ for another day. */
+
+ static wchar_t *group_number (wchar_t *buf, wchar_t *bufend,
+ unsigned int intdig_no, const char *grouping,
+@@ -251,7 +256,14 @@ ___printf_fp (FILE *fp,
+ mp_limb_t cy;
+
+ /* Nonzero if this is output on a wide character stream. */
++#if __OPTION_POSIX_C_LANG_WIDE_CHAR
+ int wide = info->wide;
++#else
++ /* This should never be called on a wide-oriented stream when
++ OPTION_POSIX_C_LANG_WIDE_CHAR is disabled, but the compiler can't
++ be trusted to figure that out. */
++ const int wide = 0;
++#endif
+
+ /* Buffer in which we produce the output. */
+ wchar_t *wbuffer = NULL;
+@@ -261,6 +273,7 @@ ___printf_fp (FILE *fp,
+ p.expsign = 0;
+
+ /* Figure out the decimal point character. */
++#if __OPTION_EGLIBC_LOCALE_CODE
+ if (info->extra == 0)
+ {
+ decimal = _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
+@@ -280,7 +293,13 @@ ___printf_fp (FILE *fp,
+ /* The decimal point character must not be zero. */
+ assert (*decimal != '\0');
+ assert (decimalwc != L'\0');
++#else
++ /* Hard-code values from 'C' locale. */
++ decimal = ".";
++ decimalwc = L'.';
++#endif
+
++#if __OPTION_EGLIBC_LOCALE_CODE
+ if (info->group)
+ {
+ if (info->extra == 0)
+@@ -324,6 +343,9 @@ ___printf_fp (FILE *fp,
+ }
+ else
+ grouping = NULL;
++#else
++ grouping = NULL;
++#endif
+
+ /* Fetch the argument value. */
+ #ifndef __NO_LONG_DOUBLE_MATH
+Index: git/stdio-common/printf_fphex.c
+===================================================================
+--- git.orig/stdio-common/printf_fphex.c
++++ git/stdio-common/printf_fphex.c
+@@ -28,6 +28,7 @@
+ #include <_itoa.h>
+ #include <_itowa.h>
+ #include <locale/localeinfo.h>
++#include <gnu/option-groups.h>
+ #include <stdbool.h>
+ #include <rounding-mode.h>
+
+@@ -139,10 +140,18 @@ __printf_fphex (FILE *fp,
+ int done = 0;
+
+ /* Nonzero if this is output on a wide character stream. */
++#if __OPTION_POSIX_C_LANG_WIDE_CHAR
+ int wide = info->wide;
++#else
++ /* This should never be called on a wide-oriented stream when
++ OPTION_POSIX_C_LANG_WIDE_CHAR is disabled, but the compiler can't
++ be trusted to figure that out. */
++ const int wide = 0;
++#endif
+
+
+ /* Figure out the decimal point character. */
++#if __OPTION_EGLIBC_LOCALE_CODE
+ if (info->extra == 0)
+ {
+ decimal = _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
+@@ -156,6 +165,10 @@ __printf_fphex (FILE *fp,
+ }
+ /* The decimal point character must never be zero. */
+ assert (*decimal != '\0' && decimalwc != L'\0');
++#else
++ decimal = ".";
++ decimalwc = L'.';
++#endif
+
+
+ /* Fetch the argument value. */
+Index: git/stdio-common/printf_size.c
+===================================================================
+--- git.orig/stdio-common/printf_size.c
++++ git/stdio-common/printf_size.c
+@@ -23,6 +23,7 @@
+ #include <math.h>
+ #include <printf.h>
+ #include <libioP.h>
++#include <gnu/option-groups.h>
+
+
+ /* This defines make it possible to use the same code for GNU C library and
+@@ -116,7 +117,14 @@ __printf_size (FILE *fp, const struct pr
+
+ struct printf_info fp_info;
+ int done = 0;
++#if __OPTION_POSIX_C_LANG_WIDE_CHAR
+ int wide = info->wide;
++#else
++ /* This should never be called on a wide-oriented stream when
++ OPTION_POSIX_C_LANG_WIDE_CHAR is disabled, but the compiler can't
++ be trusted to figure that out. */
++ const int wide = 0;
++#endif
+ int res;
+
+ /* Fetch the argument value. */
+Index: git/stdio-common/scanf14.c
+===================================================================
+--- git.orig/stdio-common/scanf14.c
++++ git/stdio-common/scanf14.c
+@@ -3,6 +3,7 @@
+ #include <string.h>
+ #include <wchar.h>
+ #include <libc-internal.h>
++#include <gnu/option-groups.h>
+
+ #define FAIL() \
+ do { \
+@@ -48,6 +49,7 @@ main (void)
+ /* See explanation above. */
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat");
++#if __OPTION_EGLIBC_LOCALE_CODE
+ if (sscanf (" 3.25S x", "%4aS%3c", &lsp, c) != 2)
+ FAIL ();
+ else
+@@ -57,6 +59,7 @@ main (void)
+ memset (lsp, 'x', sizeof L"3.25");
+ free (lsp);
+ }
++#endif
+ if (sscanf ("4.25[0-9.] x", "%a[0-9.]%8c", &sp, c) != 2)
+ FAIL ();
+ else
+Index: git/stdio-common/tstdiomisc.c
+===================================================================
+--- git.orig/stdio-common/tstdiomisc.c
++++ git/stdio-common/tstdiomisc.c
+@@ -4,6 +4,7 @@
+ #include <string.h>
+ #include <wchar.h>
+ #include <libc-internal.h>
++#include <gnu/option-groups.h>
+
+ static int
+ t1 (void)
+@@ -134,6 +135,7 @@ F (void)
+ printf ("expected \"-inf -INF -inf -INF -inf -INF -inf -INF\", got \"%s\"\n",
+ buf);
+
++#if __OPTION_POSIX_C_LANG_WIDE_CHAR
+ swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G",
+ qnanval, qnanval, qnanval, qnanval,
+ qnanval, qnanval, qnanval, qnanval);
+@@ -171,6 +173,7 @@ F (void)
+ result |= wcscmp (wbuf, L"-inf -INF -inf -INF -inf -INF -inf -INF") != 0;
+ printf ("expected L\"-inf -INF -inf -INF -inf -INF -inf -INF\", got L\"%S\"\n",
+ wbuf);
++#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
+
+ lqnanval = NAN;
+
+@@ -215,6 +218,7 @@ F (void)
+ printf ("expected \"-inf -INF -inf -INF -inf -INF -inf -INF\", got \"%s\"\n",
+ buf);
+
++#if __OPTION_POSIX_C_LANG_WIDE_CHAR
+ swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]),
+ L"%La %LA %Le %LE %Lf %LF %Lg %LG",
+ lqnanval, lqnanval, lqnanval, lqnanval,
+@@ -259,6 +263,7 @@ F (void)
+ result |= wcscmp (wbuf, L"-inf -INF -inf -INF -inf -INF -inf -INF") != 0;
+ printf ("expected L\"-inf -INF -inf -INF -inf -INF -inf -INF\", got L\"%S\"\n",
+ wbuf);
++#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
+
+ return result;
+ }
+Index: git/stdio-common/tst-popen.c
+===================================================================
+--- git.orig/stdio-common/tst-popen.c
++++ git/stdio-common/tst-popen.c
+@@ -19,6 +19,7 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <wchar.h>
++#include <gnu/option-groups.h>
+
+ static int
+ do_test (void)
+@@ -34,12 +35,14 @@ do_test (void)
+ return 1;
+ }
+
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ /* POSIX says that pipe streams are byte-oriented. */
+ if (fwide (f, 0) >= 0)
+ {
+ puts ("popen did not return byte-oriented stream");
+ result = 1;
+ }
++#endif
+
+ if (getline (&line, &len, f) != 5)
+ {
+Index: git/stdio-common/tst-sprintf.c
+===================================================================
+--- git.orig/stdio-common/tst-sprintf.c
++++ git/stdio-common/tst-sprintf.c
+@@ -3,7 +3,7 @@
+ #include <locale.h>
+ #include <string.h>
+ #include <libc-internal.h>
+-
++#include <gnu/option-groups.h>
+
+ static int
+ do_test (void)
+@@ -11,12 +11,14 @@ do_test (void)
+ char buf[100];
+ int result = 0;
+
++#if __OPTION_POSIX_C_LANG_WIDE_CHAR
+ if (sprintf (buf, "%.0ls", L"foo") != 0
+ || strlen (buf) != 0)
+ {
+ puts ("sprintf (buf, \"%.0ls\", L\"foo\") produced some output");
+ result = 1;
+ }
++#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
+
+ #define SIZE (1024*70000)
+ #define STR(x) #x
+Index: git/stdio-common/vfprintf.c
+===================================================================
+--- git.orig/stdio-common/vfprintf.c
++++ git/stdio-common/vfprintf.c
+@@ -29,6 +29,7 @@
+ #include <_itoa.h>
+ #include <locale/localeinfo.h>
+ #include <stdio.h>
++#include <gnu/option-groups.h>
+
+ /* This code is shared between the standard stdio implementation found
+ in GNU C library and the libio implementation originally found in
+@@ -138,6 +139,18 @@
+ # define EOF WEOF
+ #endif
+
++#if __OPTION_POSIX_C_LANG_WIDE_CHAR
++# define MULTIBYTE_SUPPORT (1)
++#else
++# define MULTIBYTE_SUPPORT (0)
++#endif
++
++#if __OPTION_EGLIBC_LOCALE_CODE
++# define LOCALE_SUPPORT (1)
++#else
++# define LOCALE_SUPPORT (0)
++#endif
++
+ #include "_i18n_number.h"
+
+ /* Include the shared code for parsing the format string. */
+@@ -1129,8 +1142,11 @@ vfprintf (FILE *s, const CHAR_T *format,
+ # define process_string_arg(fspec) \
+ LABEL (form_character): \
+ /* Character. */ \
+- if (is_long) \
+- goto LABEL (form_wcharacter); \
++ if (is_long) \
++ { \
++ assert (MULTIBYTE_SUPPORT); \
++ goto LABEL (form_wcharacter); \
++ } \
+ --width; /* Account for the character itself. */ \
+ if (!left) \
+ PAD (' '); \
+@@ -1143,6 +1159,7 @@ vfprintf (FILE *s, const CHAR_T *format,
+ break; \
+ \
+ LABEL (form_wcharacter): \
++ assert (MULTIBYTE_SUPPORT); \
+ { \
+ /* Wide character. */ \
+ char buf[MB_CUR_MAX]; \
+@@ -1209,6 +1226,7 @@ vfprintf (FILE *s, const CHAR_T *format,
+ } \
+ else \
+ { \
++ assert (MULTIBYTE_SUPPORT); \
+ const wchar_t *s2 = (const wchar_t *) string; \
+ mbstate_t mbstate; \
+ \
+@@ -1409,7 +1427,9 @@ vfprintf (FILE *s, const CHAR_T *format,
+ LABEL (flag_quote):
+ group = 1;
+
+- if (grouping == (const char *) -1)
++ if (! LOCALE_SUPPORT)
++ grouping = NULL;
++ else if (grouping == (const char *) -1)
+ {
+ #ifdef COMPILE_WPRINTF
+ thousands_sep = _NL_CURRENT_WORD (LC_NUMERIC,
+@@ -1708,7 +1728,9 @@ do_positional:
+ free (workstart);
+ workstart = NULL;
+
+- if (grouping == (const char *) -1)
++ if (! LOCALE_SUPPORT)
++ grouping = NULL;
++ else if (grouping == (const char *) -1)
+ {
+ #ifdef COMPILE_WPRINTF
+ thousands_sep = _NL_CURRENT_WORD (LC_NUMERIC,
+Index: git/stdio-common/vfscanf.c
+===================================================================
+--- git.orig/stdio-common/vfscanf.c
++++ git/stdio-common/vfscanf.c
+@@ -29,6 +29,7 @@
+ #include <wctype.h>
+ #include <bits/libc-lock.h>
+ #include <locale/localeinfo.h>
++#include <gnu/option-groups.h>
+
+ #ifdef __GNUC__
+ # define HAVE_LONGLONG
+@@ -133,6 +134,12 @@
+ # define WINT_T int
+ #endif
+
++#if __OPTION_POSIX_C_LANG_WIDE_CHAR
++# define MULTIBYTE_SUPPORT (1)
++#else
++# define MULTIBYTE_SUPPORT (0)
++#endif
++
+ #define encode_error() do { \
+ errval = 4; \
+ __set_errno (EILSEQ); \
+@@ -316,24 +323,35 @@ _IO_vfscanf_internal (_IO_FILE *s, const
+ ARGCHECK (s, format);
+
+ {
+-#ifndef COMPILE_WSCANF
++#if __OPTION_EGLIBC_LOCALE_CODE && !defined (COMPILE_WSCANF)
+ struct __locale_data *const curnumeric = loc->__locales[LC_NUMERIC];
+ #endif
+
++#if __OPTION_EGLIBC_LOCALE_CODE
+ /* Figure out the decimal point character. */
+-#ifdef COMPILE_WSCANF
++# ifdef COMPILE_WSCANF
+ decimal = _NL_CURRENT_WORD (LC_NUMERIC, _NL_NUMERIC_DECIMAL_POINT_WC);
+-#else
++# else
+ decimal = curnumeric->values[_NL_ITEM_INDEX (DECIMAL_POINT)].string;
+-#endif
++# endif
+ /* Figure out the thousands separator character. */
+-#ifdef COMPILE_WSCANF
++# ifdef COMPILE_WSCANF
+ thousands = _NL_CURRENT_WORD (LC_NUMERIC, _NL_NUMERIC_THOUSANDS_SEP_WC);
+-#else
++# else
+ thousands = curnumeric->values[_NL_ITEM_INDEX (THOUSANDS_SEP)].string;
+ if (*thousands == '\0')
+ thousands = NULL;
+-#endif
++# endif
++#else /* if ! __OPTION_EGLIBC_LOCALE_CODE */
++ /* Hard-code values from the C locale. */
++# ifdef COMPILE_WSCANF
++ decimal = L'.';
++ thousands = L'\0';
++# else
++ decimal = ".";
++ thousands = NULL;
++# endif
++#endif /* __OPTION_EGLIBC_LOCALE_CODE */
+ }
+
+ /* Lock the stream. */
+@@ -385,6 +403,8 @@ _IO_vfscanf_internal (_IO_FILE *s, const
+ #ifndef COMPILE_WSCANF
+ if (!isascii ((unsigned char) *f))
+ {
++ assert (MULTIBYTE_SUPPORT);
++
+ /* Non-ASCII, may be a multibyte. */
+ int len = __mbrlen (f, strlen (f), &state);
+ if (len > 0)
+@@ -830,6 +850,8 @@ _IO_vfscanf_internal (_IO_FILE *s, const
+ }
+ /* FALLTHROUGH */
+ case L_('C'):
++ assert (MULTIBYTE_SUPPORT);
++
+ if (width == -1)
+ width = 1;
+
+@@ -1172,6 +1194,8 @@ _IO_vfscanf_internal (_IO_FILE *s, const
+ /* FALLTHROUGH */
+
+ case L_('S'):
++ assert (MULTIBYTE_SUPPORT);
++
+ {
+ #ifndef COMPILE_WSCANF
+ mbstate_t cstate;
+@@ -1419,10 +1443,17 @@ _IO_vfscanf_internal (_IO_FILE *s, const
+ const char *mbdigits[10];
+ const char *mbdigits_extended[10];
+ #endif
++#if __OPTION_EGLIBC_LOCALE_CODE
+ /* "to_inpunct" is a map from ASCII digits to their
+ equivalent in locale. This is defined for locales
+ which use an extra digits set. */
+ wctrans_t map = __wctrans ("to_inpunct");
++#else
++ /* This will always be the case when
++ OPTION_EGLIBC_LOCALE_CODE is disabled, but the
++ compiler can't figure that out. */
++ wctrans_t map = NULL;
++#endif
+ int n;
+
+ from_level = 0;
+@@ -2088,6 +2119,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const
+ --width;
+ }
+
++#if __OPTION_EGLIBC_LOCALE_CODE
+ wctrans_t map;
+ if (__builtin_expect ((flags & I18N) != 0, 0)
+ /* Hexadecimal floats make no sense, fixing localized
+@@ -2304,6 +2336,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const
+ ;
+ #endif
+ }
++#endif /* __OPTION_EGLIBC_LOCALE_CODE */
+
+ /* Have we read any character? If we try to read a number
+ in hexadecimal notation and we have read only the `0x'
+@@ -2343,7 +2376,10 @@ _IO_vfscanf_internal (_IO_FILE *s, const
+
+ case L_('['): /* Character class. */
+ if (flags & LONG)
+- STRING_ARG (wstr, wchar_t, 100);
++ {
++ assert (MULTIBYTE_SUPPORT);
++ STRING_ARG (wstr, wchar_t, 100);
++ }
+ else
+ STRING_ARG (str, char, 100);
+
+@@ -2417,6 +2453,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const
+ if (flags & LONG)
+ {
+ size_t now = read_in;
++ assert (MULTIBYTE_SUPPORT);
+ #ifdef COMPILE_WSCANF
+ if (__glibc_unlikely (inchar () == WEOF))
+ input_error ();
+Index: git/stdlib/Makefile
+===================================================================
+--- git.orig/stdlib/Makefile
++++ git/stdlib/Makefile
+@@ -18,6 +18,8 @@
+ #
+ # Makefile for stdlib routines
+ #
++include ../option-groups.mak
++
+ subdir := stdlib
+
+ include ../Makeconfig
+@@ -30,7 +32,7 @@ headers := stdlib.h bits/stdlib.h bits/s
+ alloca.h fmtmsg.h \
+ bits/stdlib-bsearch.h
+
+-routines := \
++routines-y := \
+ atof atoi atol atoll \
+ abort \
+ bsearch qsort msort \
+@@ -39,7 +41,6 @@ routines := \
+ quick_exit at_quick_exit cxa_at_quick_exit cxa_thread_atexit_impl \
+ abs labs llabs \
+ div ldiv lldiv \
+- mblen mbstowcs mbtowc wcstombs wctomb \
+ random random_r rand rand_r \
+ drand48 erand48 lrand48 nrand48 mrand48 jrand48 \
+ srand48 seed48 lcong48 \
+@@ -52,9 +53,18 @@ routines := \
+ strtof_l strtod_l strtold_l \
+ system canonicalize \
+ a64l l64a \
+- rpmatch strfmon strfmon_l getsubopt xpg_basename fmtmsg \
+- strtoimax strtoumax wcstoimax wcstoumax \
++ getsubopt xpg_basename \
++ strtoimax strtoumax \
+ getcontext setcontext makecontext swapcontext
++routines-$(OPTION_EGLIBC_LOCALE_CODE) += \
++ strfmon strfmon_l
++routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) += \
++ mblen mbstowcs mbtowc wcstombs wctomb \
++ wcstoimax wcstoumax
++ifeq (yy,$(OPTION_EGLIBC_LOCALE_CODE)$(OPTION_POSIX_REGEXP))
++routines-y += rpmatch
++endif
++routines-$(OPTION_EGLIBC_FMTMSG) += fmtmsg
+ aux = grouping groupingwc tens_in_limb
+
+ # These routines will be omitted from the libc shared object.
+@@ -62,20 +72,22 @@ aux = grouping groupingwc tens_in_limb
+ # linked against when the shared library will be used.
+ static-only-routines = atexit at_quick_exit
+
+-test-srcs := tst-fmtmsg
+-tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
++test-srcs-$(OPTION_EGLIBC_FMTMSG) := tst-fmtmsg
++tests := tst-strtol tst-strtod testrand testsort testdiv \
+ test-canon test-canon2 tst-strtoll tst-environ \
+ tst-xpg-basename tst-random tst-random2 tst-bsearch \
+ tst-limits tst-rand48 bug-strtod tst-setcontext \
+- test-a64l tst-qsort tst-system testmb2 bug-strtod2 \
+- tst-atof1 tst-atof2 tst-strtod2 tst-strtod3 tst-rand48-2 \
+- tst-makecontext tst-strtod4 tst-strtod5 tst-qsort2 \
+- tst-makecontext2 tst-strtod6 tst-unsetenv1 \
+- tst-makecontext3 bug-getcontext bug-fmtmsg1 \
++ test-a64l tst-qsort tst-system bug-strtod2 \
++ tst-atof1 tst-atof2 tst-strtod2 tst-rand48-2 \
++ tst-makecontext tst-qsort2 tst-makecontext2 tst-strtod6 \
++ tst-unsetenv1 tst-makecontext3 bug-getcontext bug-fmtmsg1 \
+ tst-secure-getenv tst-strtod-overflow tst-strtod-round \
+ tst-tininess tst-strtod-underflow tst-tls-atexit
+ tests-static := tst-secure-getenv
+-
++tests-$(OPTION_EGLIBC_LOCALE_CODE) \
++ += tst-strtod3 tst-strtod4 tst-strtod5 testmb2
++tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
++ += testmb
+ modules-names = tst-tls-atexit-lib
+
+ ifeq ($(build-shared),yes)
+@@ -115,8 +127,10 @@ CFLAGS-tst-makecontext2.c = $(stack-alig
+ tests-special += $(objpfx)isomac.out
+
+ ifeq ($(run-built-tests),yes)
++ifeq (y,$(OPTION_EGLIBC_FMTMSG))
+ tests-special += $(objpfx)tst-fmtmsg.out
+ endif
++endif
+
+ include ../Rules
+
+Index: git/stdlib/strtod_l.c
+===================================================================
+--- git.orig/stdlib/strtod_l.c
++++ git/stdlib/strtod_l.c
+@@ -17,6 +17,7 @@
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
++#include <gnu/option-groups.h>
+ #include <xlocale.h>
+
+ extern double ____strtod_l_internal (const char *, char **, int, __locale_t);
+@@ -548,6 +549,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group
+ /* Used in several places. */
+ int cnt;
+
++#if __OPTION_EGLIBC_LOCALE_CODE
+ struct __locale_data *current = loc->__locales[LC_NUMERIC];
+
+ if (__glibc_unlikely (group))
+@@ -586,6 +588,17 @@ ____STRTOF_INTERNAL (nptr, endptr, group
+ decimal_len = strlen (decimal);
+ assert (decimal_len > 0);
+ #endif
++#else /* if ! __OPTION_EGLIBC_LOCALE_CODE */
++ /* Hard-code values from the 'C' locale. */
++ grouping = NULL;
++#ifdef USE_WIDE_CHAR
++ decimal = L'.';
++# define decimal_len 1
++#else
++ decimal = ".";
++ decimal_len = 1;
++#endif
++#endif /* __OPTION_EGLIBC_LOCALE_CODE */
+
+ /* Prepare number representation. */
+ exponent = 0;
+Index: git/stdlib/tst-strtod.c
+===================================================================
+--- git.orig/stdlib/tst-strtod.c
++++ git/stdlib/tst-strtod.c
+@@ -23,6 +23,7 @@
+ #include <errno.h>
+ #include <string.h>
+ #include <math.h>
++#include <gnu/option-groups.h>
+
+ struct ltest
+ {
+@@ -176,7 +177,9 @@ main (int argc, char ** argv)
+
+ status |= long_dbl ();
+
++#if __OPTION_EGLIBC_LOCALE_CODE
+ status |= locale_test ();
++#endif
+
+ return status ? EXIT_FAILURE : EXIT_SUCCESS;
+ }
+@@ -219,6 +222,7 @@ long_dbl (void)
+ return 0;
+ }
+
++#if __OPTION_EGLIBC_LOCALE_CODE
+ /* Perform a few tests in a locale with thousands separators. */
+ static int
+ locale_test (void)
+@@ -276,3 +280,4 @@ locale_test (void)
+
+ return result;
+ }
++#endif /* __OPTION_EGLIBC_LOCALE_CODE */
+Index: git/streams/Makefile
+===================================================================
+--- git.orig/streams/Makefile
++++ git/streams/Makefile
+@@ -18,11 +18,14 @@
+ #
+ # Makefile for streams.
+ #
++include ../option-groups.mak
++
+ subdir := streams
+
+ include ../Makeconfig
+
+ headers = stropts.h sys/stropts.h bits/stropts.h bits/xtitypes.h
+-routines = isastream getmsg getpmsg putmsg putpmsg fattach fdetach
++routines-$(OPTION_EGLIBC_STREAMS) \
++ += isastream getmsg getpmsg putmsg putpmsg fattach fdetach
+
+ include ../Rules
+Index: git/string/Makefile
+===================================================================
+--- git.orig/string/Makefile
++++ git/string/Makefile
+@@ -18,6 +18,8 @@
+ #
+ # Sub-makefile for string portion of library.
+ #
++include ../option-groups.mak
++
+ subdir := string
+
+ include ../Makeconfig
+@@ -39,10 +41,12 @@ routines := strcat strchr strcmp strcoll
+ $(addprefix argz-,append count create ctsep next \
+ delete extract insert stringify \
+ addsep replace) \
+- envz basename \
++ basename \
+ strcoll_l strxfrm_l string-inlines memrchr \
+ xpg-strerror strerror_l
+
++routines-$(OPTION_EGLIBC_ENVZ) += envz
++
+ strop-tests := memchr memcmp memcpy memmove mempcpy memset memccpy \
+ stpcpy stpncpy strcat strchr strcmp strcpy strcspn \
+ strlen strncmp strncpy strpbrk strrchr strspn memmem \
+@@ -51,10 +55,12 @@ strop-tests := memchr memcmp memcpy memm
+ tests := tester inl-tester noinl-tester testcopy test-ffs \
+ tst-strlen stratcliff tst-svc tst-inlcall \
+ bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap \
+- tst-strtok tst-strxfrm bug-strcoll1 tst-strfry \
++ tst-strtok tst-strfry \
+ bug-strtok1 $(addprefix test-,$(strop-tests)) \
+- bug-envz1 tst-strxfrm2 tst-endian tst-svc2 \
+- tst-strtok_r
++ tst-strxfrm2 tst-endian tst-svc2 tst-strtok_r
++tests-$(OPTION_EGLIBC_ENVZ) += bug-envz1
++tests-$(OPTION_EGLIBC_LOCALE_CODE) \
++ += tst-strxfrm bug-strcoll1
+
+ xtests = tst-strcoll-overflow
+
+Index: git/string/strcoll_l.c
+===================================================================
+--- git.orig/string/strcoll_l.c
++++ git/string/strcoll_l.c
+@@ -24,6 +24,7 @@
+ #include <stdint.h>
+ #include <string.h>
+ #include <sys/param.h>
++#include <gnu/option-groups.h>
+
+ #ifndef STRING_TYPE
+ # define STRING_TYPE char
+@@ -247,7 +248,11 @@ int
+ STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2, __locale_t l)
+ {
+ struct __locale_data *current = l->__locales[LC_COLLATE];
++#if __OPTION_EGLIBC_LOCALE_CODE
+ uint_fast32_t nrules = current->values[_NL_ITEM_INDEX (_NL_COLLATE_NRULES)].word;
++#else
++ const uint_fast32_t nrules = 0;
++#endif
+ /* We don't assign the following values right away since it might be
+ unnecessary in case there are no rules. */
+ const unsigned char *rulesets;
+Index: git/string/strerror_l.c
+===================================================================
+--- git.orig/string/strerror_l.c
++++ git/string/strerror_l.c
+@@ -21,6 +21,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <sys/param.h>
++#include <gnu/option-groups.h>
+
+
+ static __thread char *last_value;
+@@ -29,10 +30,14 @@ static __thread char *last_value;
+ static const char *
+ translate (const char *str, locale_t loc)
+ {
++#if __OPTION_EGLIBC_LOCALE_CODE
+ locale_t oldloc = __uselocale (loc);
+ const char *res = _(str);
+ __uselocale (oldloc);
+ return res;
++#else
++ return str;
++#endif
+ }
+
+
+Index: git/string/strxfrm_l.c
+===================================================================
+--- git.orig/string/strxfrm_l.c
++++ git/string/strxfrm_l.c
+@@ -24,6 +24,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <sys/param.h>
++#include <gnu/option-groups.h>
+
+ #ifndef STRING_TYPE
+ # define STRING_TYPE char
+@@ -670,7 +671,11 @@ STRXFRM (STRING_TYPE *dest, const STRING
+ {
+ locale_data_t l_data;
+ struct __locale_data *current = l->__locales[LC_COLLATE];
++#if __OPTION_EGLIBC_LOCALE_CODE
+ l_data.nrules = current->values[_NL_ITEM_INDEX (_NL_COLLATE_NRULES)].word;
++#else
++ l_data.nrules = 0;
++#endif
+
+ /* Handle byte comparison case. */
+ if (l_data.nrules == 0)
+Index: git/string/test-strcmp.c
+===================================================================
+--- git.orig/string/test-strcmp.c
++++ git/string/test-strcmp.c
+@@ -329,34 +329,6 @@ check (void)
+ FOR_EACH_IMPL (impl, 0)
+ check_result (impl, s1 + i1, s2 + i2, exp_result);
+ }
+-
+- /* Test cases where there are multiple zero bytes after the first. */
+-
+- for (size_t i = 0; i < 16 + 1; i++)
+- {
+- s1[i] = 0x00;
+- s2[i] = 0x00;
+- }
+-
+- for (size_t i = 0; i < 16; i++)
+- {
+- int exp_result;
+-
+- for (int val = 0x01; val < 0x100; val++)
+- {
+- for (size_t j = 0; j < i; j++)
+- {
+- s1[j] = val;
+- s2[j] = val;
+- }
+-
+- s2[i] = val;
+-
+- exp_result = SIMPLE_STRCMP (s1, s2);
+- FOR_EACH_IMPL (impl, 0)
+- check_result (impl, s1, s2, exp_result);
+- }
+- }
+ }
+
+
+Index: git/string/tst-strxfrm2.c
+===================================================================
+--- git.orig/string/tst-strxfrm2.c
++++ git/string/tst-strxfrm2.c
+@@ -1,6 +1,7 @@
+ #include <locale.h>
+ #include <stdio.h>
+ #include <string.h>
++#include <gnu/option-groups.h>
+
+ static int
+ do_test (void)
+@@ -38,6 +39,7 @@ do_test (void)
+ res = 1;
+ }
+
++#if __OPTION_EGLIBC_LOCALE_CODE
+ if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
+ {
+ puts ("setlocale failed");
+@@ -75,6 +77,7 @@ do_test (void)
+ res = 1;
+ }
+ }
++#endif
+
+ return res;
+ }
+Index: git/string/tst-strxfrm.c
+===================================================================
+--- git.orig/string/tst-strxfrm.c
++++ git/string/tst-strxfrm.c
+@@ -3,6 +3,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <gnu/option-groups.h>
+
+
+ char const string[] = "";
+@@ -64,8 +65,10 @@ do_test (void)
+ int result = 0;
+
+ result |= test ("C");
++#if __OPTION_EGLIBC_LOCALE_CODE
+ result |= test ("en_US.ISO-8859-1");
+ result |= test ("de_DE.UTF-8");
++#endif
+
+ return result;
+ }
+Index: git/sunrpc/Makefile
+===================================================================
+--- git.orig/sunrpc/Makefile
++++ git/sunrpc/Makefile
+@@ -18,6 +18,8 @@
+ #
+ # Sub-makefile for sunrpc portion of the library.
+ #
++include ../option-groups.mak
++
+ subdir := sunrpc
+
+ include ../Makeconfig
+@@ -55,7 +57,6 @@ headers-in-tirpc = $(addprefix rpc/,auth
+ headers-not-in-tirpc = $(addprefix rpc/,key_prot.h rpc_des.h) \
+ $(rpcsvc:%=rpcsvc/%) rpcsvc/bootparam.h
+ headers = rpc/netdb.h
+-install-others = $(inst_sysconfdir)/rpc
+ generated += $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) $(rpcsvc:%.x=x%.stmp) \
+ $(rpcsvc:%.x=rpcsvc/%.stmp) rpcgen
+ generated-dirs += rpcsvc
+@@ -65,18 +66,28 @@ headers += $(headers-in-tirpc) $(headers
+ endif
+
+ ifeq ($(build-shared),yes)
+-need-export-routines := auth_des auth_unix clnt_gen clnt_perr clnt_tcp \
++need-export-routines-$(OPTION_EGLIBC_SUNRPC) += \
++ auth_des auth_unix clnt_gen clnt_perr clnt_tcp \
+ clnt_udp get_myaddr key_call netname pm_getport \
+- rpc_thread svc svc_tcp svc_udp xcrypt xdr_array xdr \
++ rpc_thread svc svc_tcp svc_udp xdr_array xdr \
+ xdr_intXX_t xdr_mem xdr_ref xdr_sizeof xdr_stdio \
+ svc_run
+
+-routines := auth_none authuxprot bindrsvprt clnt_raw clnt_simp \
++need-export-routines-y += xcrypt
++
++need-export-routines := $(need-export-routines-y)
++
++routines-$(OPTION_EGLIBC_SUNRPC) \
++ += auth_none authuxprot bindrsvprt clnt_raw clnt_simp \
+ rpc_dtable getrpcport pmap_clnt pm_getmaps pmap_prot pmap_prot2 \
+ pmap_rmt rpc_prot rpc_common rpc_cmsg svc_auth svc_authux svc_raw \
+ svc_simple xdr_float xdr_rec publickey authdes_prot \
+- des_crypt des_impl des_soft key_prot openchild rtime svcauth_des \
+- clnt_unix svc_unix create_xid $(need-export-routines)
++ key_prot openchild rtime svcauth_des \
++ clnt_unix svc_unix create_xid
++
++# xdecrypt is also used by nss/nss_files/files-key.c.
++routines-y += des_crypt des_impl des_soft $(need-export-routines)
++
+ ifneq ($(link-obsolete-rpc),yes)
+ # We only add the RPC for compatibility to libc.so.
+ shared-only-routines = $(routines)
+@@ -85,25 +96,28 @@ endif
+
+ # We do not build rpcinfo anymore. It is not needed for a bootstrap
+ # and not wanted on complete systems.
+-# others := rpcinfo
+-# install-sbin := rpcinfo
+-install-bin := rpcgen
++# others-$(OPTION_EGLIBC_SUNRPC) += rpcinfo
++# install-sbin-$(OPTION_EGLIBC_SUNRPC) += rpcinfo
++install-bin-$(OPTION_EGLIBC_SUNRPC) += rpcgen
+ rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \
+ rpc_scan.o rpc_util.o rpc_svcout.o rpc_clntout.o \
+ rpc_tblout.o rpc_sample.o
+-extra-objs = $(rpcgen-objs) $(addprefix cross-,$(rpcgen-objs))
+-others += rpcgen
++extra-objs-$(OPTION_EGLIBC_SUNRPC) = $(rpcgen-objs) $(addprefix cross-,$(rpcgen-objs))
++others-$(OPTION_EGLIBC_SUNRPC) += rpcgen
++
++install-others-$(OPTION_EGLIBC_SUNRPC) += $(inst_sysconfdir)/rpc
+
+-tests = tst-xdrmem tst-xdrmem2
+-xtests := tst-getmyaddr
++tests-$(OPTION_EGLIBC_SUNRPC) = tst-xdrmem tst-xdrmem2
++xtests-$(OPTION_EGLIBC_SUNRPC) := tst-getmyaddr
+
+ ifeq ($(have-thread-library),yes)
+-xtests += thrsvc
++xtests-$(OPTION_EGLIBC_SUNRPC) += thrsvc
+ endif
+
+ headers += $(rpcsvc:%.x=rpcsvc/%.h)
+-extra-libs := librpcsvc
+-extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass.
++extra-libs-$(OPTION_EGLIBC_SUNRPC) += librpcsvc
++# Make it in `others' pass, not `lib' pass.
++extra-libs-others-y += $(extra-libs-y)
+ librpcsvc-routines = $(rpcsvc:%.x=x%)
+ librpcsvc-inhibit-o = .os # Build no shared rpcsvc library.
+ omit-deps = $(librpcsvc-routines)
+Index: git/sysdeps/generic/ldsodefs.h
+===================================================================
+--- git.orig/sysdeps/generic/ldsodefs.h
++++ git/sysdeps/generic/ldsodefs.h
+@@ -425,6 +425,12 @@ extern struct rtld_global _rtld_global _
+ # undef __rtld_global_attribute__
+ #endif
+
++#if __OPTION_EGLIBC_RTLD_DEBUG
++# define GLRO_dl_debug_mask GLRO(dl_debug_mask)
++#else
++# define GLRO_dl_debug_mask 0
++#endif
++
+ #ifndef SHARED
+ # define GLRO(name) _##name
+ #else
+@@ -437,8 +443,10 @@ struct rtld_global_ro
+ {
+ #endif
+
++#if __OPTION_EGLIBC_RTLD_DEBUG
+ /* If nonzero the appropriate debug information is printed. */
+ EXTERN int _dl_debug_mask;
++#endif
+ #define DL_DEBUG_LIBS (1 << 0)
+ #define DL_DEBUG_IMPCALLS (1 << 1)
+ #define DL_DEBUG_BINDINGS (1 << 2)
+Index: git/sysdeps/gnu/Makefile
+===================================================================
+--- git.orig/sysdeps/gnu/Makefile
++++ git/sysdeps/gnu/Makefile
+@@ -59,7 +59,8 @@ $(foreach o,$(object-suffixes) $(object-
+ endif
+
+ ifeq ($(subdir),login)
+-sysdep_routines += setutxent getutxent endutxent getutxid getutxline \
++sysdep_routines-$(OPTION_EGLIBC_UTMPX) \
++ += setutxent getutxent endutxent getutxid getutxline \
+ pututxline utmpxname updwtmpx getutmpx getutmp
+
+ sysdep_headers += utmpx.h bits/utmpx.h
+Index: git/sysdeps/ieee754/ldbl-opt/Makefile
+===================================================================
+--- git.orig/sysdeps/ieee754/ldbl-opt/Makefile
++++ git/sysdeps/ieee754/ldbl-opt/Makefile
+@@ -11,19 +11,18 @@ libm-routines += s_nexttowardfd
+ routines += math_ldbl_opt nldbl-compat
+
+ extra-libs += libnldbl
+-libnldbl-calls = asprintf dprintf fprintf fscanf fwprintf fwscanf iovfscanf \
++libnldbl-calls = asprintf dprintf fprintf fscanf iovfscanf \
+ obstack_printf obstack_vprintf printf scanf snprintf \
+- sprintf sscanf swprintf swscanf vasprintf vdprintf vfprintf \
+- vfscanf vfwprintf vfwscanf vprintf vscanf vsnprintf \
+- vsprintf vsscanf vswprintf vswscanf vwprintf vwscanf \
+- wprintf wscanf printf_fp printf_size \
+- fprintf_chk fwprintf_chk printf_chk snprintf_chk sprintf_chk \
+- swprintf_chk vfprintf_chk vfwprintf_chk vprintf_chk \
+- vsnprintf_chk vsprintf_chk vswprintf_chk vwprintf_chk \
+- wprintf_chk asprintf_chk vasprintf_chk dprintf_chk \
++ sprintf sscanf vasprintf vdprintf vfprintf \
++ vfscanf vprintf vscanf vsnprintf \
++ vsprintf vsscanf \
++ printf_fp printf_size \
++ fprintf_chk printf_chk snprintf_chk sprintf_chk \
++ vfprintf_chk vprintf_chk \
++ vsnprintf_chk vsprintf_chk \
++ asprintf_chk vasprintf_chk dprintf_chk \
+ vdprintf_chk obstack_printf_chk obstack_vprintf_chk \
+ syslog syslog_chk vsyslog vsyslog_chk \
+- strfmon strfmon_l \
+ strtold strtold_l strtoldint wcstold wcstold_l wcstoldint \
+ qecvt qfcvt qgcvt qecvt_r qfcvt_r \
+ isinf isnan finite signbit scalb log2 lgamma_r ceil \
+@@ -38,9 +37,15 @@ libnldbl-calls = asprintf dprintf fprint
+ casinh cexp clog cproj csin csinh csqrt ctan ctanh cpow \
+ cabs carg cimag creal clog10 \
+ isoc99_scanf isoc99_fscanf isoc99_sscanf \
+- isoc99_vscanf isoc99_vfscanf isoc99_vsscanf \
++ isoc99_vscanf isoc99_vfscanf isoc99_vsscanf
++libnldbl-calls-$(OPTION_EGLIBC_LOCALE_CODE) += strfmon strfmon_l
++libnldbl-calls-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) += fwprintf fwscanf \
++ swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
++ vwprintf vwscanf wprintf wscanf fwprintf_chk swprintf_chk \
++ vfwprintf_chk vswprintf_chk vwprintf_chk wprintf_chk \
+ isoc99_wscanf isoc99_fwscanf isoc99_swscanf \
+ isoc99_vwscanf isoc99_vfwscanf isoc99_vswscanf
++libnldbl-calls += $(libnldbl-calls-y)
+ libnldbl-routines = $(libnldbl-calls:%=nldbl-%)
+ libnldbl-inhibit-o = $(object-suffixes)
+ libnldbl-static-only-routines = $(libnldbl-routines)
+Index: git/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
+===================================================================
+--- git.orig/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
++++ git/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
+@@ -26,6 +26,7 @@
+ #include <locale/localeinfo.h>
+ #include <sys/syslog.h>
+ #include <bits/libc-lock.h>
++#include <gnu/option-groups.h>
+
+ #include "nldbl-compat.h"
+
+@@ -33,20 +34,14 @@ libc_hidden_proto (__nldbl_vfprintf)
+ libc_hidden_proto (__nldbl_vsscanf)
+ libc_hidden_proto (__nldbl_vsprintf)
+ libc_hidden_proto (__nldbl_vfscanf)
+-libc_hidden_proto (__nldbl_vfwscanf)
+ libc_hidden_proto (__nldbl_vdprintf)
+-libc_hidden_proto (__nldbl_vswscanf)
+-libc_hidden_proto (__nldbl_vfwprintf)
+-libc_hidden_proto (__nldbl_vswprintf)
+ libc_hidden_proto (__nldbl_vsnprintf)
+ libc_hidden_proto (__nldbl_vasprintf)
+ libc_hidden_proto (__nldbl_obstack_vprintf)
+-libc_hidden_proto (__nldbl___vfwprintf_chk)
+ libc_hidden_proto (__nldbl___vsnprintf_chk)
+ libc_hidden_proto (__nldbl___vfprintf_chk)
+ libc_hidden_proto (__nldbl___vsyslog_chk)
+ libc_hidden_proto (__nldbl___vsprintf_chk)
+-libc_hidden_proto (__nldbl___vswprintf_chk)
+ libc_hidden_proto (__nldbl___vasprintf_chk)
+ libc_hidden_proto (__nldbl___vdprintf_chk)
+ libc_hidden_proto (__nldbl___obstack_vprintf_chk)
+@@ -54,8 +49,17 @@ libc_hidden_proto (__nldbl___vstrfmon)
+ libc_hidden_proto (__nldbl___vstrfmon_l)
+ libc_hidden_proto (__nldbl___isoc99_vsscanf)
+ libc_hidden_proto (__nldbl___isoc99_vfscanf)
++
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
++libc_hidden_proto (__nldbl_vfwscanf)
++libc_hidden_proto (__nldbl_vswscanf)
++libc_hidden_proto (__nldbl_vfwprintf)
++libc_hidden_proto (__nldbl_vswprintf)
++libc_hidden_proto (__nldbl___vfwprintf_chk)
++libc_hidden_proto (__nldbl___vswprintf_chk)
+ libc_hidden_proto (__nldbl___isoc99_vswscanf)
+ libc_hidden_proto (__nldbl___isoc99_vfwscanf)
++#endif
+
+ static void
+ __nldbl_cleanup (void *arg)
+@@ -117,6 +121,7 @@ __nldbl_fprintf (FILE *stream, const cha
+ }
+ weak_alias (__nldbl_fprintf, __nldbl__IO_fprintf)
+
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ int
+ attribute_compat_text_section weak_function
+ __nldbl_fwprintf (FILE *stream, const wchar_t *fmt, ...)
+@@ -130,6 +135,7 @@ __nldbl_fwprintf (FILE *stream, const wc
+
+ return done;
+ }
++#endif
+
+ int
+ attribute_compat_text_section
+@@ -226,6 +232,7 @@ __nldbl_snprintf (char *s, size_t maxlen
+ return done;
+ }
+
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ int
+ attribute_compat_text_section
+ __nldbl_swprintf (wchar_t *s, size_t n, const wchar_t *fmt, ...)
+@@ -239,6 +246,7 @@ __nldbl_swprintf (wchar_t *s, size_t n,
+
+ return done;
+ }
++#endif
+
+ int
+ attribute_compat_text_section weak_function
+@@ -264,6 +272,7 @@ __nldbl_vdprintf (int d, const char *fmt
+ }
+ libc_hidden_def (__nldbl_vdprintf)
+
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ int
+ attribute_compat_text_section weak_function
+ __nldbl_vfwprintf (FILE *s, const wchar_t *fmt, va_list ap)
+@@ -275,6 +284,7 @@ __nldbl_vfwprintf (FILE *s, const wchar_
+ return res;
+ }
+ libc_hidden_def (__nldbl_vfwprintf)
++#endif
+
+ int
+ attribute_compat_text_section
+@@ -297,6 +307,7 @@ __nldbl_vsnprintf (char *string, size_t
+ libc_hidden_def (__nldbl_vsnprintf)
+ weak_alias (__nldbl_vsnprintf, __nldbl___vsnprintf)
+
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ int
+ attribute_compat_text_section weak_function
+ __nldbl_vswprintf (wchar_t *string, size_t maxlen, const wchar_t *fmt,
+@@ -330,6 +341,7 @@ __nldbl_wprintf (const wchar_t *fmt, ...
+
+ return done;
+ }
++#endif
+
+ int
+ attribute_compat_text_section
+@@ -419,6 +431,7 @@ __nldbl_scanf (const char *fmt, ...)
+ return done;
+ }
+
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ int
+ attribute_compat_text_section
+ __nldbl_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
+@@ -491,6 +504,7 @@ __nldbl_wscanf (const wchar_t *fmt, ...)
+
+ return done;
+ }
++#endif
+
+ int
+ attribute_compat_text_section
+@@ -506,6 +520,7 @@ __nldbl___fprintf_chk (FILE *stream, int
+ return done;
+ }
+
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ int
+ attribute_compat_text_section
+ __nldbl___fwprintf_chk (FILE *stream, int flag, const wchar_t *fmt, ...)
+@@ -519,6 +534,7 @@ __nldbl___fwprintf_chk (FILE *stream, in
+
+ return done;
+ }
++#endif
+
+ int
+ attribute_compat_text_section
+@@ -563,6 +579,7 @@ __nldbl___sprintf_chk (char *s, int flag
+ return done;
+ }
+
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ int
+ attribute_compat_text_section
+ __nldbl___swprintf_chk (wchar_t *s, size_t n, int flag, size_t slen,
+@@ -577,6 +594,7 @@ __nldbl___swprintf_chk (wchar_t *s, size
+
+ return done;
+ }
++#endif
+
+ int
+ attribute_compat_text_section
+@@ -590,6 +608,7 @@ __nldbl___vfprintf_chk (FILE *s, int fla
+ }
+ libc_hidden_def (__nldbl___vfprintf_chk)
+
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ int
+ attribute_compat_text_section
+ __nldbl___vfwprintf_chk (FILE *s, int flag, const wchar_t *fmt, va_list ap)
+@@ -601,6 +620,7 @@ __nldbl___vfwprintf_chk (FILE *s, int fl
+ return res;
+ }
+ libc_hidden_def (__nldbl___vfwprintf_chk)
++#endif
+
+ int
+ attribute_compat_text_section
+@@ -635,6 +655,7 @@ __nldbl___vsprintf_chk (char *string, in
+ }
+ libc_hidden_def (__nldbl___vsprintf_chk)
+
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ int
+ attribute_compat_text_section
+ __nldbl___vswprintf_chk (wchar_t *string, size_t maxlen, int flag, size_t slen,
+@@ -668,6 +689,7 @@ __nldbl___wprintf_chk (int flag, const w
+
+ return done;
+ }
++#endif
+
+ int
+ attribute_compat_text_section
+@@ -775,6 +797,7 @@ __nldbl___printf_fp (FILE *fp, const str
+ return ___printf_fp (fp, &info_no_ldbl, args);
+ }
+
++#if __OPTION_EGLIBC_LOCALE_CODE
+ ssize_t
+ attribute_compat_text_section
+ __nldbl_strfmon (char *s, size_t maxsize, const char *format, ...)
+@@ -829,6 +852,7 @@ __nldbl___vstrfmon_l (char *s, size_t ma
+ return res;
+ }
+ libc_hidden_def (__nldbl___vstrfmon_l)
++#endif
+
+ void
+ attribute_compat_text_section
+@@ -941,6 +965,7 @@ __nldbl___isoc99_scanf (const char *fmt,
+ return done;
+ }
+
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ int
+ attribute_compat_text_section
+ __nldbl___isoc99_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
+@@ -1014,6 +1039,7 @@ __nldbl___isoc99_wscanf (const wchar_t *
+
+ return done;
+ }
++#endif
+
+ #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+ compat_symbol (libc, __nldbl__IO_printf, _IO_printf, GLIBC_2_0);
+@@ -1057,6 +1083,7 @@ compat_symbol (libc, __nldbl_printf_size
+ compat_symbol (libc, __nldbl___strfmon_l, __strfmon_l, GLIBC_2_1);
+ #endif
+ #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_2)
++# if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ compat_symbol (libc, __nldbl_swprintf, swprintf, GLIBC_2_2);
+ compat_symbol (libc, __nldbl_vwprintf, vwprintf, GLIBC_2_2);
+ compat_symbol (libc, __nldbl_wprintf, wprintf, GLIBC_2_2);
+@@ -1069,6 +1096,7 @@ compat_symbol (libc, __nldbl_vfwscanf, v
+ compat_symbol (libc, __nldbl_vswscanf, vswscanf, GLIBC_2_2);
+ compat_symbol (libc, __nldbl_vwscanf, vwscanf, GLIBC_2_2);
+ compat_symbol (libc, __nldbl_wscanf, wscanf, GLIBC_2_2);
++# endif
+ #endif
+ #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3)
+ compat_symbol (libc, __nldbl_strfmon_l, strfmon_l, GLIBC_2_3);
+Index: git/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
+===================================================================
+--- git.orig/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
++++ git/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
+@@ -30,6 +30,7 @@
+ #include <math.h>
+ #include <monetary.h>
+ #include <sys/syslog.h>
++#include <gnu/option-groups.h>
+
+
+ /* Declare the __nldbl_NAME function the wrappers call that's in libc.so. */
+@@ -37,19 +38,15 @@
+
+ NLDBL_DECL (_IO_vfscanf);
+ NLDBL_DECL (vfscanf);
+-NLDBL_DECL (vfwscanf);
+ NLDBL_DECL (obstack_vprintf);
+ NLDBL_DECL (vasprintf);
+ NLDBL_DECL (dprintf);
+ NLDBL_DECL (vdprintf);
+ NLDBL_DECL (fprintf);
+ NLDBL_DECL (vfprintf);
+-NLDBL_DECL (vfwprintf);
+ NLDBL_DECL (vsnprintf);
+ NLDBL_DECL (vsprintf);
+ NLDBL_DECL (vsscanf);
+-NLDBL_DECL (vswprintf);
+-NLDBL_DECL (vswscanf);
+ NLDBL_DECL (__asprintf);
+ NLDBL_DECL (asprintf);
+ NLDBL_DECL (__printf_fp);
+@@ -66,12 +63,18 @@ NLDBL_DECL (__isoc99_sscanf);
+ NLDBL_DECL (__isoc99_vscanf);
+ NLDBL_DECL (__isoc99_vfscanf);
+ NLDBL_DECL (__isoc99_vsscanf);
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
++NLDBL_DECL (vfwscanf);
++NLDBL_DECL (vfwprintf);
++NLDBL_DECL (vswprintf);
++NLDBL_DECL (vswscanf);
+ NLDBL_DECL (__isoc99_wscanf);
+ NLDBL_DECL (__isoc99_fwscanf);
+ NLDBL_DECL (__isoc99_swscanf);
+ NLDBL_DECL (__isoc99_vwscanf);
+ NLDBL_DECL (__isoc99_vfwscanf);
+ NLDBL_DECL (__isoc99_vswscanf);
++#endif
+
+ /* This one does not exist in the normal interface, only
+ __nldbl___vstrfmon really exists. */
+@@ -82,22 +85,23 @@ extern ssize_t __nldbl___vstrfmon (char
+ since we don't compile with _FORTIFY_SOURCE. */
+ extern int __nldbl___vfprintf_chk (FILE *__restrict, int,
+ const char *__restrict, _G_va_list);
+-extern int __nldbl___vfwprintf_chk (FILE *__restrict, int,
+- const wchar_t *__restrict, __gnuc_va_list);
+ extern int __nldbl___vsprintf_chk (char *__restrict, int, size_t,
+ const char *__restrict, _G_va_list) __THROW;
+ extern int __nldbl___vsnprintf_chk (char *__restrict, size_t, int, size_t,
+ const char *__restrict, _G_va_list)
+ __THROW;
+-extern int __nldbl___vswprintf_chk (wchar_t *__restrict, size_t, int, size_t,
+- const wchar_t *__restrict, __gnuc_va_list)
+- __THROW;
+ extern int __nldbl___vasprintf_chk (char **, int, const char *, _G_va_list)
+ __THROW;
+ extern int __nldbl___vdprintf_chk (int, int, const char *, _G_va_list);
+ extern int __nldbl___obstack_vprintf_chk (struct obstack *, int, const char *,
+ _G_va_list) __THROW;
+ extern void __nldbl___vsyslog_chk (int, int, const char *, va_list);
+-
++#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
++extern int __nldbl___vfwprintf_chk (FILE *__restrict, int,
++ const wchar_t *__restrict, __gnuc_va_list);
++extern int __nldbl___vswprintf_chk (wchar_t *__restrict, size_t, int, size_t,
++ const wchar_t *__restrict, __gnuc_va_list)
++ __THROW;
++#endif
+
+ #endif /* __NLDBL_COMPAT_H */
+Index: git/sysdeps/unix/sysv/linux/gethostid.c
+===================================================================
+--- git.orig/sysdeps/unix/sysv/linux/gethostid.c
++++ git/sysdeps/unix/sysv/linux/gethostid.c
+@@ -21,6 +21,7 @@
+ #include <unistd.h>
+ #include <netdb.h>
+ #include <not-cancel.h>
++#include <gnu/option-groups.h>
+
+ #define HOSTIDFILE "/etc/hostid"
+
+@@ -89,6 +90,7 @@ gethostid (void)
+ return id;
+ }
+
++#if __OPTION_EGLIBC_INET
+ /* Getting from the file was not successful. An intelligent guess for
+ a unique number of a host is its IP address. Return this. */
+ if (__gethostname (hostname, MAXHOSTNAMELEN) < 0 || hostname[0] == '\0')
+@@ -115,5 +117,9 @@ gethostid (void)
+ /* For the return value to be not exactly the IP address we do some
+ bit fiddling. */
+ return (int32_t) (in.s_addr << 16 | in.s_addr >> 16);
++#else
++ /* Return an arbitrary value. */
++ return 0;
++#endif
+ }
+ #endif
+Index: git/sysdeps/unix/sysv/linux/libc_fatal.c
+===================================================================
+--- git.orig/sysdeps/unix/sysv/linux/libc_fatal.c
++++ git/sysdeps/unix/sysv/linux/libc_fatal.c
+@@ -23,6 +23,7 @@
+ #include <string.h>
+ #include <sys/mman.h>
+ #include <sys/uio.h>
++#include <gnu/option-groups.h>
+
+ static bool
+ writev_for_fatal (int fd, const struct iovec *iov, size_t niov, size_t total)
+@@ -40,6 +41,7 @@ writev_for_fatal (int fd, const struct i
+ static void
+ backtrace_and_maps (int do_abort, bool written, int fd)
+ {
++#if __OPTION_EGLIBC_BACKTRACE
+ if (do_abort > 1 && written)
+ {
+ void *addrs[64];
+@@ -62,6 +64,7 @@ backtrace_and_maps (int do_abort, bool w
+ close_not_cancel_no_status (fd2);
+ }
+ }
++#endif /* __OPTION_EGLIBC_BACKTRACE */
+ }
+ #define BEFORE_ABORT backtrace_and_maps
+
+Index: git/time/Makefile
+===================================================================
+--- git.orig/time/Makefile
++++ git/time/Makefile
+@@ -18,6 +18,8 @@
+ #
+ # Makefile for time routines
+ #
++include ../option-groups.mak
++
+ subdir := time
+
+ include ../Makeconfig
+@@ -30,15 +32,23 @@ routines := offtime asctime clock ctime
+ tzfile getitimer setitimer \
+ stime dysize timegm ftime \
+ getdate strptime strptime_l \
+- strftime wcsftime strftime_l wcsftime_l \
++ strftime strftime_l \
+ timespec_get
+-aux := era alt_digit lc-time-cleanup
+
+-tests := test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
+- tst-getdate tst-mktime tst-mktime2 tst-ftime_l tst-strftime \
++routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
++ := wcsftime wcsftime_l
++aux-$(OPTION_EGLIBC_LOCALE_CODE) += alt_digit era lc-time-cleanup
++
++tests := test_time clocktest tst-posixtz \
++ tst-getdate tst-mktime tst-mktime2 tst-strftime \
+ tst-mktime3 tst-strptime2 bug-asctime bug-asctime_r bug-mktime1 \
+ tst-strptime3 bug-getdate1 tst-strptime-whitespace tst-ftime
+
++tests-$(OPTION_EGLIBC_LOCALE_CODE) \
++ += tst-strptime tst-ftime_l
++tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
++ += tst_wcsftime
++
+ include ../Rules
+
+ tz-cflags = -DTZDIR='"$(zonedir)"' \
+Index: git/time/strftime_l.c
+===================================================================
+--- git.orig/time/strftime_l.c
++++ git/time/strftime_l.c
+@@ -35,6 +35,10 @@
+ # include "../locale/localeinfo.h"
+ #endif
+
++#ifdef _LIBC
++# include <gnu/option-groups.h>
++#endif
++
+ #if defined emacs && !defined HAVE_BCOPY
+ # define HAVE_MEMCPY 1
+ #endif
+@@ -882,7 +886,7 @@ __strftime_internal (s, maxsize, format,
+ case L_('C'):
+ if (modifier == L_('E'))
+ {
+-#if HAVE_STRUCT_ERA_ENTRY
++#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && HAVE_STRUCT_ERA_ENTRY
+ struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
+ if (era)
+ {
+@@ -955,7 +959,7 @@ __strftime_internal (s, maxsize, format,
+
+ if (modifier == L_('O') && 0 <= number_value)
+ {
+-#ifdef _NL_CURRENT
++#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && defined (_NL_CURRENT)
+ /* Get the locale specific alternate representation of
+ the number NUMBER_VALUE. If none exist NULL is returned. */
+ const CHAR_T *cp = nl_get_alt_digit (number_value
+@@ -1260,7 +1264,7 @@ __strftime_internal (s, maxsize, format,
+ case L_('Y'):
+ if (modifier == 'E')
+ {
+-#if HAVE_STRUCT_ERA_ENTRY
++#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && HAVE_STRUCT_ERA_ENTRY
+ struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
+ if (era)
+ {
+@@ -1285,7 +1289,7 @@ __strftime_internal (s, maxsize, format,
+ case L_('y'):
+ if (modifier == L_('E'))
+ {
+-#if HAVE_STRUCT_ERA_ENTRY
++#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && HAVE_STRUCT_ERA_ENTRY
+ struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
+ if (era)
+ {
+Index: git/time/strptime_l.c
+===================================================================
+--- git.orig/time/strptime_l.c
++++ git/time/strptime_l.c
+@@ -29,6 +29,7 @@
+
+ #ifdef _LIBC
+ # define HAVE_LOCALTIME_R 0
++# include <gnu/option-groups.h>
+ # include "../locale/localeinfo.h"
+ #endif
+
+@@ -84,7 +85,7 @@ localtime_r (t, tp)
+ if (val < from || val > to) \
+ return NULL; \
+ } while (0)
+-#ifdef _NL_CURRENT
++#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && defined (_NL_CURRENT)
+ # define get_alt_number(from, to, n) \
+ ({ \
+ __label__ do_normal; \
+@@ -257,8 +258,10 @@ __strptime_internal (rp, fmt, tmp, state
+ int cnt;
+ int cnt_longest;
+ size_t val;
++#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
+ size_t num_eras;
+ struct era_entry *era = NULL;
++#endif
+ enum ptime_locale_status { not, loc, raw } decided_longest;
+ struct __strptime_state
+ {
+@@ -820,6 +823,7 @@ __strptime_internal (rp, fmt, tmp, state
+ s.want_xday = 1;
+ break;
+ case 'C':
++#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
+ if (s.decided != raw)
+ {
+ if (s.era_cnt >= 0)
+@@ -856,10 +860,12 @@ __strptime_internal (rp, fmt, tmp, state
+
+ s.decided = raw;
+ }
++#endif
+ /* The C locale has no era information, so use the
+ normal representation. */
+ goto match_century;
+ case 'y':
++#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
+ if (s.decided != raw)
+ {
+ get_number(0, 9999, 4);
+@@ -918,9 +924,10 @@ __strptime_internal (rp, fmt, tmp, state
+
+ s.decided = raw;
+ }
+-
++#endif
+ goto match_year_in_century;
+ case 'Y':
++#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
+ if (s.decided != raw)
+ {
+ num_eras = _NL_CURRENT_WORD (LC_TIME,
+@@ -948,6 +955,7 @@ __strptime_internal (rp, fmt, tmp, state
+
+ s.decided = raw;
+ }
++#endif
+ get_number (0, 9999, 4);
+ tm->tm_year = val - 1900;
+ s.want_century = 0;
+@@ -1118,6 +1126,7 @@ __strptime_internal (rp, fmt, tmp, state
+ tm->tm_year = (s.century - 19) * 100;
+ }
+
++#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
+ if (s.era_cnt != -1)
+ {
+ era = _nl_select_era_entry (s.era_cnt HELPER_LOCALE_ARG);
+@@ -1132,6 +1141,7 @@ __strptime_internal (rp, fmt, tmp, state
+ tm->tm_year = era->start_date[0];
+ }
+ else
++#endif
+ if (s.want_era)
+ {
+ /* No era found but we have seen an E modifier. Rectify some
+Index: git/timezone/Makefile
+===================================================================
+--- git.orig/timezone/Makefile
++++ git/timezone/Makefile
+@@ -117,7 +117,7 @@ $(testdata)/Asia/Tokyo: asia $(zic-deps)
+
+ $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
+ sed -e 's|/bin/bash|/bin/sh|' \
+- -e 's|TZDIR=[^}]*|TZDIR=$(zonedir)|' \
++ -e '/TZDIR=/s|\$$(pwd)|$(zonedir)|' \
+ -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \
+ -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \
+ -e '/REPORT_BUGS_TO=/s|=.*|="$(REPORT_BUGS_TO)"|' \
+Index: git/wcsmbs/Makefile
+===================================================================
+--- git.orig/wcsmbs/Makefile
++++ git/wcsmbs/Makefile
+@@ -18,15 +18,21 @@
+ #
+ # Sub-makefile for wcsmbs portion of the library.
+ #
++include ../option-groups.mak
++
+ subdir := wcsmbs
+
+ include ../Makeconfig
+
+ headers := wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h
+
+-routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
++# These functions are used by printf_fp.c, even in the plain case; see
++# comments there for OPTION_EGLIBC_LOCALE_CODE.
++routines := wmemcpy wmemset
++routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
++ := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
+ wcsncmp wcsncpy wcspbrk wcsrchr wcsspn wcstok wcsstr wmemchr \
+- wmemcmp wmemcpy wmemmove wmemset wcpcpy wcpncpy wmempcpy \
++ wmemcmp wmemmove wcpcpy wcpncpy wmempcpy \
+ btowc wctob mbsinit \
+ mbrlen mbrtowc wcrtomb mbsrtowcs wcsrtombs \
+ mbsnrtowcs wcsnrtombs wcsnlen wcschrnul \
+@@ -38,14 +44,21 @@ routines := wcscat wcschr wcscmp wcscpy
+ wcscoll_l wcsxfrm_l \
+ wcscasecmp wcsncase wcscasecmp_l wcsncase_l \
+ wcsmbsload mbsrtowcs_l \
+- isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf \
+ isoc99_swscanf isoc99_vswscanf \
+ mbrtoc16 c16rtomb
+
++routines-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
++ += isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf
++
+ strop-tests := wcscmp wmemcmp wcslen wcschr wcsrchr wcscpy
+-tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen tst-btowc tst-mbrtowc \
+- tst-wcrtomb tst-wcpncpy tst-mbsrtowcs tst-wchar-h tst-mbrtowc2 \
+- tst-c16c32-1 wcsatcliff $(addprefix test-,$(strop-tests))
++
++tests := tst-wchar-h
++tests-$(OPTION_EGLIBC_LOCALE_CODE) \
++ += tst-btowc tst-mbrtowc tst-mbrtowc2 tst-wcrtomb tst-c16c32-1
++tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
++ += tst-wcstof wcsmbs-tst1 tst-wcsnlen \
++ tst-wcpncpy tst-mbsrtowcs \
++ wcsatcliff $(addprefix test-,$(strop-tests))
+
+ include ../Rules
+
+Index: git/wcsmbs/wcsmbsload.c
+===================================================================
+--- git.orig/wcsmbs/wcsmbsload.c
++++ git/wcsmbs/wcsmbsload.c
+@@ -21,6 +21,7 @@
+ #include <limits.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <gnu/option-groups.h>
+
+ #include <locale/localeinfo.h>
+ #include <wcsmbsload.h>
+@@ -143,6 +144,7 @@ __wcsmbs_getfct (const char *to, const c
+ })
+
+
++#if __OPTION_EGLIBC_LOCALE_CODE
+ /* Some of the functions here must not be used while setlocale is called. */
+ __libc_rwlock_define (extern, __libc_setlocale_lock attribute_hidden)
+
+@@ -211,6 +213,17 @@ __wcsmbs_load_conv (struct __locale_data
+
+ __libc_rwlock_unlock (__libc_setlocale_lock);
+ }
++#else
++void
++internal_function
++__wcsmbs_load_conv (struct __locale_data *new_category)
++{
++ /* When OPTION_EGLIBC_LOCALE_CODE is disabled, we should never reach
++ this point: there is no way to change locales, so every locale
++ passed to get_gconv_fcts should be _nl_C_LC_CTYPE. */
++ abort ();
++}
++#endif
+
+
+ /* Clone the current conversion function set. */
+Index: git/wctype/Makefile
+===================================================================
+--- git.orig/wctype/Makefile
++++ git/wctype/Makefile
+@@ -18,14 +18,20 @@
+ #
+ # Sub-makefile for wctype portion of the library.
+ #
++include ../option-groups.mak
++
+ subdir := wctype
+
+ include ../Makeconfig
+
+ headers := wctype.h
+-routines := wcfuncs wctype iswctype wctrans towctrans \
+- wcfuncs_l wctype_l iswctype_l wctrans_l towctrans_l
++routines := wctrans towctrans towctrans_l
++routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
++ := wcfuncs wctype iswctype \
++ wcfuncs_l wctype_l iswctype_l wctrans_l
+
+-tests := test_wctype test_wcfuncs bug-wctypeh
++tests :=
++tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
++ += test_wctype test_wcfuncs bug-wctypeh
+
+ include ../Rules
+Index: git/sysdeps/nptl/Makefile
+===================================================================
+--- git.orig/sysdeps/nptl/Makefile
++++ git/sysdeps/nptl/Makefile
+@@ -18,6 +18,9 @@
+
+ ifeq ($(subdir),nptl)
+ libpthread-sysdep_routines += errno-loc
++ifeq ($(OPTION_EGLIBC_BIG_MACROS),n)
++sysdep_routines += small-macros-fns
++endif
+ endif
+
+ ifeq ($(subdir),rt)
+Index: git/sysdeps/nptl/bits/libc-lock.h
+===================================================================
+--- git.orig/sysdeps/nptl/bits/libc-lock.h
++++ git/sysdeps/nptl/bits/libc-lock.h
+@@ -24,6 +24,14 @@
+ #include <stddef.h>
+
+
++#ifdef _LIBC
++# include <lowlevellock.h>
++# include <tls.h>
++# include <pthread-functions.h>
++# include <errno.h> /* For EBUSY. */
++# include <gnu/option-groups.h> /* For __OPTION_EGLIBC_BIG_MACROS. */
++#endif
++
+ /* Mutex type. */
+ #if defined _LIBC || defined _IO_MTSAFE_IO
+ # if (!IS_IN (libc) && !IS_IN (libpthread)) || !defined _LIBC
+@@ -87,6 +95,15 @@ typedef struct __libc_lock_recursive_opa
+
+ /* Lock the recursive named lock variable. */
+ #if defined _LIBC && (IS_IN (libc) || IS_IN (libpthread))
++# if __OPTION_EGLIBC_BIG_MACROS != 1
++/* EGLIBC: Declare wrapper function for a big macro if either
++ !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from
++ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
++extern void __libc_lock_lock_recursive_fn (__libc_lock_recursive_t *);
++libc_hidden_proto (__libc_lock_lock_recursive_fn);
++# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
++# if __OPTION_EGLIBC_BIG_MACROS
++
+ # define __libc_lock_lock_recursive(NAME) \
+ do { \
+ void *self = THREAD_SELF; \
+@@ -97,6 +114,10 @@ typedef struct __libc_lock_recursive_opa
+ } \
+ ++(NAME).cnt; \
+ } while (0)
++# else
++# define __libc_lock_lock_recursive(NAME) \
++ __libc_lock_lock_recursive_fn (&(NAME))
++# endif /* __OPTION_EGLIBC_BIG_MACROS */
+ #else
+ # define __libc_lock_lock_recursive(NAME) \
+ __libc_maybe_call (__pthread_mutex_lock, (&(NAME).mutex), 0)
+@@ -104,6 +125,14 @@ typedef struct __libc_lock_recursive_opa
+
+ /* Try to lock the recursive named lock variable. */
+ #if defined _LIBC && (IS_IN (libc) || IS_IN (libpthread))
++# if __OPTION_EGLIBC_BIG_MACROS != 1
++/* EGLIBC: Declare wrapper function for a big macro if either
++ !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from
++ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
++extern int __libc_lock_trylock_recursive_fn (__libc_lock_recursive_t *);
++libc_hidden_proto (__libc_lock_trylock_recursive_fn);
++# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
++# if __OPTION_EGLIBC_BIG_MACROS
+ # define __libc_lock_trylock_recursive(NAME) \
+ ({ \
+ int result = 0; \
+@@ -122,6 +151,10 @@ typedef struct __libc_lock_recursive_opa
+ ++(NAME).cnt; \
+ result; \
+ })
++# else
++# define __libc_lock_trylock_recursive(NAME) \
++ __libc_lock_trylock_recursive_fn (&(NAME))
++# endif /* __OPTION_EGLIBC_BIG_MACROS */
+ #else
+ # define __libc_lock_trylock_recursive(NAME) \
+ __libc_maybe_call (__pthread_mutex_trylock, (&(NAME).mutex), 0)
+@@ -129,6 +162,14 @@ typedef struct __libc_lock_recursive_opa
+
+ /* Unlock the recursive named lock variable. */
+ #if defined _LIBC && (IS_IN (libc) || IS_IN (libpthread))
++# if __OPTION_EGLIBC_BIG_MACROS != 1
++/* EGLIBC: Declare wrapper function for a big macro if either
++ !__OPTION_EGLIBC_BIG_MACROS, or we are using a back door from
++ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
++extern void __libc_lock_unlock_recursive_fn (__libc_lock_recursive_t *);
++libc_hidden_proto (__libc_lock_unlock_recursive_fn);
++# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
++# if __OPTION_EGLIBC_BIG_MACROS
+ /* We do no error checking here. */
+ # define __libc_lock_unlock_recursive(NAME) \
+ do { \
+@@ -138,6 +179,10 @@ typedef struct __libc_lock_recursive_opa
+ lll_unlock ((NAME).lock, LLL_PRIVATE); \
+ } \
+ } while (0)
++# else
++# define __libc_lock_unlock_recursive(NAME) \
++ __libc_lock_unlock_recursive_fn (&(NAME))
++# endif /* __OPTION_EGLIBC_BIG_MACROS */
+ #else
+ # define __libc_lock_unlock_recursive(NAME) \
+ __libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0)
+Index: git/sysdeps/nptl/bits/libc-lockP.h
+===================================================================
+--- git.orig/sysdeps/nptl/bits/libc-lockP.h
++++ git/sysdeps/nptl/bits/libc-lockP.h
+@@ -33,6 +33,8 @@
+ #include <lowlevellock.h>
+ #include <tls.h>
+ #include <pthread-functions.h>
++#include <errno.h> /* For EBUSY. */
++#include <gnu/option-groups.h> /* For __OPTION_EGLIBC_BIG_MACROS. */
+
+ #if IS_IN (libpthread)
+ /* This gets us the declarations of the __pthread_* internal names,
+@@ -171,10 +173,22 @@ typedef pthread_key_t __libc_key_t;
+
+ /* Lock the named lock variable. */
+ #if IS_IN (libc) || IS_IN (libpthread)
+-# ifndef __libc_lock_lock
+-# define __libc_lock_lock(NAME) \
++# if __OPTION_EGLIBC_BIG_MACROS != 1
++/* EGLIBC: Declare wrapper function for a big macro if either
++ !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from
++ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
++extern void __libc_lock_lock_fn (__libc_lock_t *);
++libc_hidden_proto (__libc_lock_lock_fn);
++# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
++# if __OPTION_EGLIBC_BIG_MACROS
++# ifndef __libc_lock_lock
++# define __libc_lock_lock(NAME) \
+ ({ lll_lock (NAME, LLL_PRIVATE); 0; })
+-# endif
++# endif
++# else
++# define __libc_lock_lock(NAME) \
++ __libc_lock_lock_fn (&(NAME))
++# endif /* __OPTION_EGLIBC_BIG_MACROS */
+ #else
+ # undef __libc_lock_lock
+ # define __libc_lock_lock(NAME) \
+@@ -187,10 +201,22 @@ typedef pthread_key_t __libc_key_t;
+
+ /* Try to lock the named lock variable. */
+ #if IS_IN (libc) || IS_IN (libpthread)
+-# ifndef __libc_lock_trylock
+-# define __libc_lock_trylock(NAME) \
++# if __OPTION_EGLIBC_BIG_MACROS != 1
++/* EGLIBC: Declare wrapper function for a big macro if either
++ !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from
++ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
++extern int __libc_lock_trylock_fn (__libc_lock_t *);
++libc_hidden_proto (__libc_lock_trylock_fn);
++# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
++# if __OPTION_EGLIBC_BIG_MACROS
++# ifndef __libc_lock_trylock
++# define __libc_lock_trylock(NAME) \
+ lll_trylock (NAME)
+-# endif
++# endif
++# else
++# define __libc_lock_trylock(NAME) \
++ __libc_lock_trylock_fn (&(NAME))
++# endif /* __OPTION_EGLIBC_BIG_MACROS */
+ #else
+ # undef __libc_lock_trylock
+ # define __libc_lock_trylock(NAME) \
+@@ -206,8 +232,20 @@ typedef pthread_key_t __libc_key_t;
+
+ /* Unlock the named lock variable. */
+ #if IS_IN (libc) || IS_IN (libpthread)
++# if __OPTION_EGLIBC_BIG_MACROS != 1
++/* EGLIBC: Declare wrapper function for a big macro if either
++ !__OPTION_EGLIBC_BIG_MACROS, or we are using a back door from
++ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
++extern void __libc_lock_unlock_fn (__libc_lock_t *);
++libc_hidden_proto (__libc_lock_unlock_fn);
++# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
++# if __OPTION_EGLIBC_BIG_MACROS
+ # define __libc_lock_unlock(NAME) \
+ lll_unlock (NAME, LLL_PRIVATE)
++# else
++# define __libc_lock_unlock(NAME) \
++ __libc_lock_unlock_fn (&(NAME))
++# endif /* __OPTION_EGLIBC_BIG_MACROS */
+ #else
+ # define __libc_lock_unlock(NAME) \
+ __libc_maybe_call (__pthread_mutex_unlock, (&(NAME)), 0)
+Index: git/sysdeps/nptl/small-macros-fns.c
+===================================================================
+--- /dev/null
++++ git/sysdeps/nptl/small-macros-fns.c
+@@ -0,0 +1,72 @@
++/* EGLIBC: function wrappers for big macros.
++ Copyright (C) 2009 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,
++ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ Boston, MA 02111-1307, USA. */
++
++#include <gnu/option-groups.h>
++
++/* Handle macros from ./bits/libc-lock.h. */
++#if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread)
++
++/* Get the macros for function bodies through a back door. */
++# undef __OPTION_EGLIBC_BIG_MACROS
++# define __OPTION_EGLIBC_BIG_MACROS 2
++# include <bits/libc-lock.h>
++
++void
++__libc_lock_lock_fn (__libc_lock_t *name)
++{
++ __libc_lock_lock (*name);
++}
++libc_hidden_def (__libc_lock_lock_fn);
++
++void
++__libc_lock_lock_recursive_fn (__libc_lock_recursive_t *name)
++{
++ __libc_lock_lock_recursive (*name);
++}
++libc_hidden_def (__libc_lock_lock_recursive_fn);
++
++int
++__libc_lock_trylock_fn (__libc_lock_t *name)
++{
++ return __libc_lock_trylock (*name);
++}
++libc_hidden_def (__libc_lock_trylock_fn);
++
++int
++__libc_lock_trylock_recursive_fn (__libc_lock_recursive_t *name)
++{
++ return __libc_lock_trylock_recursive (*name);
++}
++libc_hidden_def (__libc_lock_trylock_recursive_fn);
++
++void
++__libc_lock_unlock_fn (__libc_lock_t *name)
++{
++ __libc_lock_unlock (*name);
++}
++libc_hidden_def (__libc_lock_unlock_fn);
++
++void
++__libc_lock_unlock_recursive_fn (__libc_lock_recursive_t *name)
++{
++ __libc_lock_unlock_recursive (*name);
++}
++libc_hidden_def (__libc_lock_unlock_recursive_fn);
++
++#endif /*defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread)*/
+Index: git/crypt/crypt_common.c
+===================================================================
+--- /dev/null
++++ git/crypt/crypt_common.c
+@@ -0,0 +1,42 @@
++/*
++ * crypt: crypt(3) implementation
++ *
++ * Copyright (C) 1991-2014 Free Software Foundation, Inc.
++ *
++ * This 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.
++ *
++ * This 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 this library; see the file COPYING.LIB. If not,
++ * see <http://www.gnu.org/licenses/>.
++ *
++ * General Support routines
++ *
++ */
++
++#include "crypt-private.h"
++
++/* Table with characters for base64 transformation. */
++static const char b64t[64] =
++"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
++
++void
++__b64_from_24bit (char **cp, int *buflen,
++ unsigned int b2, unsigned int b1, unsigned int b0,
++ int n)
++{
++ unsigned int w = (b2 << 16) | (b1 << 8) | b0;
++ while (n-- > 0 && (*buflen) > 0)
++ {
++ *(*cp)++ = b64t[w & 0x3f];
++ --(*buflen);
++ w >>= 6;
++ }
++}
+Index: git/crypt/crypt_util.c
+===================================================================
+--- git.orig/crypt/crypt_util.c
++++ git/crypt/crypt_util.c
+@@ -242,10 +242,6 @@ static ufc_long eperm32tab[4][256][2];
+ */
+ static ufc_long efp[16][64][2];
+
+-/* Table with characters for base64 transformation. */
+-static const char b64t[64] =
+-"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+-
+ /*
+ * For use by the old, non-reentrant routines
+ * (crypt/encrypt/setkey)
+@@ -949,17 +945,3 @@ setkey(__key)
+ {
+ __setkey_r(__key, &_ufc_foobar);
+ }
+-
+-void
+-__b64_from_24bit (char **cp, int *buflen,
+- unsigned int b2, unsigned int b1, unsigned int b0,
+- int n)
+-{
+- unsigned int w = (b2 << 16) | (b1 << 8) | b0;
+- while (n-- > 0 && (*buflen) > 0)
+- {
+- *(*cp)++ = b64t[w & 0x3f];
+- --(*buflen);
+- w >>= 6;
+- }
+-}
+Index: git/sysdeps/arm/Makefile
+===================================================================
+--- git.orig/sysdeps/arm/Makefile
++++ git/sysdeps/arm/Makefile
+@@ -37,10 +37,13 @@ ifeq ($(subdir),csu)
+ # get offset to rtld_global._dl_hwcap
+ gen-as-const-headers += rtld-global-offsets.sym tlsdesc.sym
+ aeabi_constants = aeabi_lcsts aeabi_sighandlers aeabi_math
+-aeabi_routines = aeabi_assert aeabi_localeconv aeabi_errno_addr \
++aeabi_routines = aeabi_assert aeabi_errno_addr \
+ aeabi_mb_cur_max aeabi_atexit aeabi_memclr aeabi_memcpy \
+ aeabi_memmove aeabi_memset \
+ aeabi_read_tp libc-aeabi_read_tp
++ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
++aeabi_routines += aeabi_localeconv
++endif
+
+ sysdep_routines += $(aeabi_constants) $(aeabi_routines)
+ static-only-routines += $(aeabi_constants) aeabi_read_tp
diff --git a/meta/recipes-core/glibc/glibc/eglibc.patch b/meta/recipes-core/glibc/glibc/eglibc.patch
new file mode 100644
index 0000000000..fdfabc3a06
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/eglibc.patch
@@ -0,0 +1,602 @@
+Instruction documents from eglibc
+
+Upstream-Status: Pending
+
+Index: git/EGLIBC.cross-building
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/EGLIBC.cross-building 2014-08-27 07:27:25.580070587 +0000
+@@ -0,0 +1,383 @@
++ -*- mode: text -*-
++
++ Cross-Compiling EGLIBC
++ Jim Blandy <jimb@codesourcery.com>
++
++
++Introduction
++
++Most GNU tools have a simple build procedure: you run their
++'configure' script, and then you run 'make'. Unfortunately, the
++process of cross-compiling the GNU C library is quite a bit more
++involved:
++
++1) Build a cross-compiler, with certain facilities disabled.
++
++2) Configure the C library using the compiler you built in step 1).
++ Build a few of the C run-time object files, but not the rest of the
++ library. Install the library's header files and the run-time
++ object files, and create a dummy libc.so.
++
++3) Build a second cross-compiler, using the header files and object
++ files you installed in step 2.
++
++4) Configure, build, and install a fresh C library, using the compiler
++ built in step 3.
++
++5) Build a third cross-compiler, based on the C library built in step 4.
++
++The reason for this complexity is that, although GCC and the GNU C
++library are distributed separately, they are not actually independent
++of each other: GCC requires the C library's headers and some object
++files to compile its own libraries, while the C library depends on
++GCC's libraries. EGLIBC includes features and bug fixes to the stock
++GNU C library that simplify this process, but the fundamental
++interdependency stands.
++
++In this document, we explain how to cross-compile an EGLIBC/GCC pair
++from source. Our intended audience is developers who are already
++familiar with the GNU toolchain and comfortable working with
++cross-development tools. While we do present a worked example to
++accompany the explanation, for clarity's sake we do not cover many of
++the options available to cross-toolchain users.
++
++
++Preparation
++
++EGLIBC requires recent versions of the GNU binutils, GCC, and the
++Linux kernel. The web page <http://www.eglibc.org/prerequisites>
++documents the current requirements, and lists patches needed for
++certain target architectures. As of this writing, these build
++instructions have been tested with binutils 2.22.51, GCC 4.6.2,
++and Linux 3.1.
++
++First, let's set some variables, to simplify later commands. We'll
++build EGLIBC and GCC for an ARM target, known to the Linux kernel
++as 'arm', and we'll do the build on an Intel x86_64 Linux box:
++
++ $ build=x86_64-pc-linux-gnu
++ $ host=$build
++ $ target=arm-none-linux-gnueabi
++ $ linux_arch=arm
++
++We're using the aforementioned versions of Binutils, GCC, and Linux:
++
++ $ binutilsv=binutils-2.22.51
++ $ gccv=gcc-4.6.2
++ $ linuxv=linux-3.1
++
++We're carrying out the entire process under '~/cross-build', which
++contains unpacked source trees for binutils, gcc, and linux kernel,
++along with EGLIBC svn trunk (which can be checked-out with
++'svn co http://www.eglibc.org/svn/trunk eglibc'):
++
++ $ top=$HOME/cross-build/$target
++ $ src=$HOME/cross-build/src
++ $ ls $src
++ binutils-2.22.51 eglibc gcc-4.6.2 linux-3.1
++
++We're going to place our build directories in a subdirectory 'obj',
++we'll install the cross-development toolchain in 'tools', and we'll
++place our sysroot (containing files to be installed on the target
++system) in 'sysroot':
++
++ $ obj=$top/obj
++ $ tools=$top/tools
++ $ sysroot=$top/sysroot
++
++
++Binutils
++
++Configuring and building binutils for the target is straightforward:
++
++ $ mkdir -p $obj/binutils
++ $ cd $obj/binutils
++ $ $src/$binutilsv/configure \
++ > --target=$target \
++ > --prefix=$tools \
++ > --with-sysroot=$sysroot
++ $ make
++ $ make install
++
++
++The First GCC
++
++For our work, we need a cross-compiler targeting an ARM Linux
++system. However, that configuration includes the shared library
++'libgcc_s.so', which is compiled against the EGLIBC headers (which we
++haven't installed yet) and linked against 'libc.so' (which we haven't
++built yet).
++
++Fortunately, there are configuration options for GCC which tell it not
++to build 'libgcc_s.so'. The '--without-headers' option is supposed to
++take care of this, but its implementation is incomplete, so you must
++also configure with the '--with-newlib' option. While '--with-newlib'
++appears to mean "Use the Newlib C library", its effect is to tell the
++GCC build machinery, "Don't assume there is a C library available."
++
++We also need to disable some of the libraries that would normally be
++built along with GCC, and specify that only the compiler for the C
++language is needed.
++
++So, we create a build directory, configure, make, and install.
++
++ $ mkdir -p $obj/gcc1
++ $ cd $obj/gcc1
++ $ $src/$gccv/configure \
++ > --target=$target \
++ > --prefix=$tools \
++ > --without-headers --with-newlib \
++ > --disable-shared --disable-threads --disable-libssp \
++ > --disable-libgomp --disable-libmudflap --disable-libquadmath \
++ > --disable-decimal-float --disable-libffi \
++ > --enable-languages=c
++ $ PATH=$tools/bin:$PATH make
++ $ PATH=$tools/bin:$PATH make install
++
++
++Linux Kernel Headers
++
++To configure EGLIBC, we also need Linux kernel headers in place.
++Fortunately, the Linux makefiles have a target that installs them for
++us. Since the process does modify the source tree a bit, we make a
++copy first:
++
++ $ cp -r $src/$linuxv $obj/linux
++ $ cd $obj/linux
++
++Now we're ready to install the headers into the sysroot:
++
++ $ PATH=$tools/bin:$PATH \
++ > make headers_install \
++ > ARCH=$linux_arch CROSS_COMPILE=$target- \
++ > INSTALL_HDR_PATH=$sysroot/usr
++
++
++EGLIBC Headers and Preliminary Objects
++
++Using the cross-compiler we've just built, we can now configure EGLIBC
++well enough to install the headers and build the object files that the
++full cross-compiler will need:
++
++ $ mkdir -p $obj/eglibc-headers
++ $ cd $obj/eglibc-headers
++ $ BUILD_CC=gcc \
++ > CC=$tools/bin/$target-gcc \
++ > CXX=$tools/bin/$target-g++ \
++ > AR=$tools/bin/$target-ar \
++ > RANLIB=$tools/bin/$target-ranlib \
++ > $src/eglibc/libc/configure \
++ > --prefix=/usr \
++ > --with-headers=$sysroot/usr/include \
++ > --build=$build \
++ > --host=$target \
++ > --disable-profile --without-gd --without-cvs \
++ > --enable-add-ons=nptl,libidn,../ports
++
++The option '--prefix=/usr' may look strange, but you should never
++configure EGLIBC with a prefix other than '/usr': in various places,
++EGLIBC's build system checks whether the prefix is '/usr', and does
++special handling only if that is the case. Unless you use this
++prefix, you will get a sysroot that does not use the standard Linux
++directory layouts and cannot be used as a basis for the root
++filesystem on your target system compatibly with normal GLIBC
++installations.
++
++The '--with-headers' option tells EGLIBC where the Linux headers have
++been installed.
++
++The '--enable-add-ons=nptl,libidn,../ports' option tells EGLIBC to look
++for the listed glibc add-ons. Most notably the ports add-on (located
++just above the libc sources in the EGLIBC svn tree) is required to
++support ARM targets.
++
++We can now use the 'install-headers' makefile target to install the
++headers:
++
++ $ make install-headers install_root=$sysroot \
++ > install-bootstrap-headers=yes
++
++The 'install_root' variable indicates where the files should actually
++be installed; its value is treated as the parent of the '--prefix'
++directory we passed to the configure script, so the headers will go in
++'$sysroot/usr/include'. The 'install-bootstrap-headers' variable
++requests special handling for certain tricky header files.
++
++Next, there are a few object files needed to link shared libraries,
++which we build and install by hand:
++
++ $ mkdir -p $sysroot/usr/lib
++ $ make csu/subdir_lib
++ $ cp csu/crt1.o csu/crti.o csu/crtn.o $sysroot/usr/lib
++
++Finally, 'libgcc_s.so' requires a 'libc.so' to link against. However,
++since we will never actually execute its code, it doesn't matter what
++it contains. So, treating '/dev/null' as a C source file, we produce
++a dummy 'libc.so' in one step:
++
++ $ $tools/bin/$target-gcc -nostdlib -nostartfiles -shared -x c /dev/null \
++ > -o $sysroot/usr/lib/libc.so
++
++
++The Second GCC
++
++With the EGLIBC headers and selected object files installed, we can
++now build a GCC that is capable of compiling EGLIBC. We configure,
++build, and install the second GCC, again building only the C compiler,
++and avoiding libraries we won't use:
++
++ $ mkdir -p $obj/gcc2
++ $ cd $obj/gcc2
++ $ $src/$gccv/configure \
++ > --target=$target \
++ > --prefix=$tools \
++ > --with-sysroot=$sysroot \
++ > --disable-libssp --disable-libgomp --disable-libmudflap \
++ > --disable-libffi --disable-libquadmath \
++ > --enable-languages=c
++ $ PATH=$tools/bin:$PATH make
++ $ PATH=$tools/bin:$PATH make install
++
++
++EGLIBC, Complete
++
++With the second compiler built and installed, we're now ready for the
++full EGLIBC build:
++
++ $ mkdir -p $obj/eglibc
++ $ cd $obj/eglibc
++ $ BUILD_CC=gcc \
++ > CC=$tools/bin/$target-gcc \
++ > CXX=$tools/bin/$target-g++ \
++ > AR=$tools/bin/$target-ar \
++ > RANLIB=$tools/bin/$target-ranlib \
++ > $src/eglibc/libc/configure \
++ > --prefix=/usr \
++ > --with-headers=$sysroot/usr/include \
++ > --with-kconfig=$obj/linux/scripts/kconfig \
++ > --build=$build \
++ > --host=$target \
++ > --disable-profile --without-gd --without-cvs \
++ > --enable-add-ons=nptl,libidn,../ports
++
++Note the additional '--with-kconfig' option. This tells EGLIBC where to
++find the host config tools used by the kernel 'make config' and 'make
++menuconfig'. These tools can be re-used by EGLIBC for its own 'make
++*config' support, which will create 'option-groups.config' for you.
++But first make sure those tools have been built by running some
++dummy 'make *config' calls in the kernel directory:
++
++ $ cd $obj/linux
++ $ PATH=$tools/bin:$PATH make config \
++ > ARCH=$linux_arch CROSS_COMPILE=$target- \
++ $ PATH=$tools/bin:$PATH make menuconfig \
++ > ARCH=$linux_arch CROSS_COMPILE=$target- \
++
++Now we can configure and build the full EGLIBC:
++
++ $ cd $obj/eglibc
++ $ PATH=$tools/bin:$PATH make defconfig
++ $ PATH=$tools/bin:$PATH make menuconfig
++ $ PATH=$tools/bin:$PATH make
++ $ PATH=$tools/bin:$PATH make install install_root=$sysroot
++
++At this point, we have a complete EGLIBC installation in '$sysroot',
++with header files, library files, and most of the C runtime startup
++files in place.
++
++
++The Third GCC
++
++Finally, we recompile GCC against this full installation, enabling
++whatever languages and libraries we would like to use:
++
++ $ mkdir -p $obj/gcc3
++ $ cd $obj/gcc3
++ $ $src/$gccv/configure \
++ > --target=$target \
++ > --prefix=$tools \
++ > --with-sysroot=$sysroot \
++ > --enable-__cxa_atexit \
++ > --disable-libssp --disable-libgomp --disable-libmudflap \
++ > --enable-languages=c,c++
++ $ PATH=$tools/bin:$PATH make
++ $ PATH=$tools/bin:$PATH make install
++
++The '--enable-__cxa_atexit' option tells GCC what sort of C++
++destructor support to expect from the C library; it's required with
++EGLIBC.
++
++And since GCC's installation process isn't designed to help construct
++sysroot trees, we must manually copy certain libraries into place in
++the sysroot.
++
++ $ cp -d $tools/$target/lib/libgcc_s.so* $sysroot/lib
++ $ cp -d $tools/$target/lib/libstdc++.so* $sysroot/usr/lib
++
++
++Trying Things Out
++
++At this point, '$tools' contains a cross toolchain ready to use
++the EGLIBC installation in '$sysroot':
++
++ $ cat > hello.c <<EOF
++ > #include <stdio.h>
++ > int
++ > main (int argc, char **argv)
++ > {
++ > puts ("Hello, world!");
++ > return 0;
++ > }
++ > EOF
++ $ $tools/bin/$target-gcc -Wall hello.c -o hello
++ $ cat > c++-hello.cc <<EOF
++ > #include <iostream>
++ > int
++ > main (int argc, char **argv)
++ > {
++ > std::cout << "Hello, C++ world!" << std::endl;
++ > return 0;
++ > }
++ > EOF
++ $ $tools/bin/$target-g++ -Wall c++-hello.cc -o c++-hello
++
++
++We can use 'readelf' to verify that these are indeed executables for
++our target, using our dynamic linker:
++
++ $ $tools/bin/$target-readelf -hl hello
++ ELF Header:
++ ...
++ Type: EXEC (Executable file)
++ Machine: ARM
++
++ ...
++ Program Headers:
++ Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
++ PHDR 0x000034 0x10000034 0x10000034 0x00100 0x00100 R E 0x4
++ INTERP 0x000134 0x00008134 0x00008134 0x00013 0x00013 R 0x1
++ [Requesting program interpreter: /lib/ld-linux.so.3]
++ LOAD 0x000000 0x00008000 0x00008000 0x0042c 0x0042c R E 0x8000
++ ...
++
++Looking at the dynamic section of the installed 'libgcc_s.so', we see
++that the 'NEEDED' entry for the C library does include the '.6'
++suffix, indicating that was linked against our fully build EGLIBC, and
++not our dummy 'libc.so':
++
++ $ $tools/bin/$target-readelf -d $sysroot/lib/libgcc_s.so.1
++ Dynamic section at offset 0x1083c contains 24 entries:
++ Tag Type Name/Value
++ 0x00000001 (NEEDED) Shared library: [libc.so.6]
++ 0x0000000e (SONAME) Library soname: [libgcc_s.so.1]
++ ...
++
++
++And on the target machine, we can run our programs:
++
++ $ $sysroot/lib/ld.so.1 --library-path $sysroot/lib:$sysroot/usr/lib \
++ > ./hello
++ Hello, world!
++ $ $sysroot/lib/ld.so.1 --library-path $sysroot/lib:$sysroot/usr/lib \
++ > ./c++-hello
++ Hello, C++ world!
+Index: git/EGLIBC.cross-testing
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/EGLIBC.cross-testing 2014-08-27 07:24:41.532070587 +0000
+@@ -0,0 +1,205 @@
++ -*- mode: text -*-
++
++ Cross-Testing With EGLIBC
++ Jim Blandy <jimb@codesourcery.com>
++
++
++Introduction
++
++Developers writing software for embedded systems often use a desktop
++or other similarly capable computer for development, but need to run
++tests on the embedded system, or perhaps on a simulator. When
++configured for cross-compilation, the stock GNU C library simply
++disables running tests altogether: the command 'make tests' builds
++test programs, but does not run them. EGLIBC, however, provides
++facilities for compiling tests and generating data files on the build
++system, but running the test programs themselves on a remote system or
++simulator.
++
++
++Test environment requirements
++
++The test environment must meet certain conditions for EGLIBC's
++cross-testing facilities to work:
++
++- Shared filesystems. The 'build' system, on which you configure and
++ compile EGLIBC, and the 'host' system, on which you intend to run
++ EGLIBC, must share a filesystem containing the EGLIBC build and
++ source trees. Files must appear at the same paths on both systems.
++
++- Remote-shell like invocation. There must be a way to run a program
++ on the host system from the build system, passing it properly quoted
++ command-line arguments, setting environment variables, and
++ inheriting the caller's standard input and output.
++
++
++Usage
++
++To use EGLIBC's cross-testing support, provide values for the
++following Make variables when you invoke 'make':
++
++- cross-test-wrapper
++
++ This should be the name of the cross-testing wrapper command, along
++ with any arguments.
++
++- cross-localedef
++
++ This should be the name of a cross-capable localedef program, like
++ that included in the EGLIBC 'localedef' module, along with any
++ arguments needed.
++
++These are each explained in detail below.
++
++
++The Cross-Testing Wrapper
++
++To run test programs reliably, the stock GNU C library takes care to
++ensure that test programs use the newly compiled dynamic linker and
++shared libraries, and never the host system's installed libraries. To
++accomplish this, it runs the tests by explicitly invoking the dynamic
++linker from the build tree, passing it a list of build tree
++directories to search for shared libraries, followed by the name of
++the executable to run and its arguments.
++
++For example, where one might normally run a test program like this:
++
++ $ ./tst-foo arg1 arg2
++
++the GNU C library might run that program like this:
++
++ $ $objdir/elf/ld-linux.so.3 --library-path $objdir \
++ ./tst-foo arg1 arg2
++
++(where $objdir is the path to the top of the build tree, and the
++trailing backslash indicates a continuation of the command). In other
++words, each test program invocation is 'wrapped up' inside an explicit
++invocation of the dynamic linker, which must itself execute the test
++program, having loaded shared libraries from the appropriate
++directories.
++
++To support cross-testing, EGLIBC allows the developer to optionally
++set the 'cross-test-wrapper' Make variable to another wrapper command,
++to which it passes the entire dynamic linker invocation shown above as
++arguments. For example, if the developer supplies a wrapper of
++'my-wrapper hostname', then EGLIBC would run the test above as
++follows:
++
++ $ my-wrapper hostname \
++ $objdir/elf/ld-linux.so.3 --library-path $objdir \
++ ./tst-foo arg1 arg2
++
++The 'my-wrapper' command is responsible for executing the command
++given on the host system.
++
++Since tests are run in varying directories, the wrapper should either
++be in your command search path, or 'cross-test-wrapper' should give an
++absolute path for the wrapper.
++
++The wrapper must meet several requirements:
++
++- It must preserve the current directory. As explained above, the
++ build directory tree must be visible on both the build and host
++ systems, at the same path. The test wrapper must ensure that the
++ current directory it inherits is also inherited by the dynamic
++ linker (and thus the test program itself).
++
++- It must preserve environment variables' values. Many EGLIBC tests
++ set environment variables for test runs; in native testing, it
++ invokes programs like this:
++
++ $ GCONV_PATH=$objdir/iconvdata \
++ $objdir/elf/ld-linux.so.3 --library-path $objdir \
++ ./tst-foo arg1 arg2
++
++ With the cross-testing wrapper, that invocation becomes:
++
++ $ GCONV_PATH=$objdir/iconvdata \
++ my-wrapper hostname \
++ $objdir/elf/ld-linux.so.3 --library-path $objdir \
++ ./tst-foo arg1 arg2
++
++ Here, 'my-wrapper' must ensure that the value it sees for
++ 'GCONV_PATH' will be seen by the dynamic linker, and thus 'tst-foo'
++ itself. (The wrapper supplied with GLIBC simply preserves the
++ values of *all* enviroment variables, with a fixed set of
++ exceptions.)
++
++ If your wrapper is a shell script, take care to correctly propagate
++ environment variables whose values contain spaces and shell
++ metacharacters.
++
++- It must pass the command's arguments, unmodified. The arguments
++ seen by the test program should be exactly those seen by the wrapper
++ (after whatever arguments are given to the wrapper itself). The
++ EGLIBC test framework performs all needed shell word splitting and
++ expansion (wildcard expansion, parameter substitution, and so on)
++ before invoking the wrapper; further expansion may break the tests.
++
++
++The 'cross-test-ssh.sh' script
++
++If you want to use 'ssh' (or something sufficiently similar) to run
++test programs on your host system, EGLIBC includes a shell script,
++'scripts/cross-test-ssh.sh', which you can use as your wrapper
++command. This script takes care of setting the test command's current
++directory, propagating environment variable values, and carrying
++command-line arguments, all across an 'ssh' connection. You may even
++supply an alternative to 'ssh' on the command line, if needed.
++
++For more details, pass 'cross-test-ssh.sh' the '--help' option.
++
++
++The Cross-Compiling Locale Definition Command
++
++Some EGLIBC tests rely on locales generated especially for the test
++process. In a native configuration, these tests simply run the
++'localedef' command built by the normal EGLIBC build process,
++'locale/localedef', to process and install their locales. However, in
++a cross-compiling configuration, this 'localedef' is built for the
++host system, not the build system, and since it requires quite a bit
++of memory to run (we have seen it fail on systems with 64MiB of
++memory), it may not be practical to run it on the host system.
++
++If set, EGLIBC uses the 'cross-localedef' Make variable as the command
++to run on the build system to process and install locales. The
++localedef program built from the EGLIBC 'localedef' module is
++suitable.
++
++The value of 'cross-localedef' may also include command-line arguments
++to be passed to the program; if you are using EGLIBC's 'localedef',
++you may include endianness and 'uint32_t' alignment arguments here.
++
++
++Example
++
++In developing EGLIBC's cross-testing facility, we invoked 'make' with
++the following script:
++
++ #!/bin/sh
++
++ srcdir=...
++ test_hostname=...
++ localedefdir=...
++ cross_gxx=...-g++
++
++ wrapper="$srcdir/scripts/cross-test-ssh.sh $test_hostname"
++ localedef="$localedefdir/localedef --little-endian --uint32-align=4"
++
++ make cross-test-wrapper="$wrapper" \
++ cross-localedef="$localedef" \
++ CXX="$cross_gxx" \
++ "$@"
++
++
++Other Cross-Testing Concerns
++
++Here are notes on some other issues which you may encounter in running
++the EGLIBC tests in a cross-compiling environment:
++
++- Some tests require a C++ cross-compiler; you should set the 'CXX'
++ Make variable to the name of an appropriate cross-compiler.
++
++- Some tests require access to libstdc++.so.6 and libgcc_s.so.1; we
++ simply place copies of these libraries in the top EGLIBC build
++ directory.
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/etc/ld.so.conf b/meta/recipes-core/glibc/glibc/etc/ld.so.conf
index e69de29bb2..e69de29bb2 100644
--- a/meta/recipes-core/eglibc/eglibc-2.19/etc/ld.so.conf
+++ b/meta/recipes-core/glibc/glibc/etc/ld.so.conf
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/fix-tibetian-locales.patch b/meta/recipes-core/glibc/glibc/fix-tibetian-locales.patch
index 25c43a9fe6..9ab9fdcf12 100644
--- a/meta/recipes-core/eglibc/eglibc-2.19/fix-tibetian-locales.patch
+++ b/meta/recipes-core/glibc/glibc/fix-tibetian-locales.patch
@@ -10,11 +10,11 @@ Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Index: libc/localedata/locales/bo_CN
+Index: git/localedata/locales/bo_CN
===================================================================
---- libc.orig/localedata/locales/bo_CN 2012-11-17 09:50:14.000000000 -0800
-+++ libc/localedata/locales/bo_CN 2013-01-04 08:55:15.593612288 -0800
-@@ -145,7 +145,7 @@
+--- git.orig/localedata/locales/bo_CN 2014-08-29 10:35:22.464070587 -0700
++++ git/localedata/locales/bo_CN 2014-08-29 10:35:22.456070587 -0700
+@@ -146,7 +146,7 @@
LC_NAME
% FIXME
@@ -23,11 +23,11 @@ Index: libc/localedata/locales/bo_CN
% name_gen "FIXME"
% name_miss "FIXME"
% name_mr "FIXME"
-Index: libc/localedata/locales/bo_IN
+Index: git/localedata/locales/bo_IN
===================================================================
---- libc.orig/localedata/locales/bo_IN 2012-11-17 09:50:14.000000000 -0800
-+++ libc/localedata/locales/bo_IN 2013-01-04 08:54:12.345609028 -0800
-@@ -70,7 +70,7 @@
+--- git.orig/localedata/locales/bo_IN 2014-08-29 10:35:22.464070587 -0700
++++ git/localedata/locales/bo_IN 2014-08-29 10:35:22.456070587 -0700
+@@ -71,7 +71,7 @@
LC_NAME
% FIXME
diff --git a/meta/recipes-core/glibc/glibc/fix_am_rootsbindir.patch b/meta/recipes-core/glibc/glibc/fix_am_rootsbindir.patch
new file mode 100644
index 0000000000..668e8bf678
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/fix_am_rootsbindir.patch
@@ -0,0 +1,29 @@
+sysdeps/gnu/configure.ac: handle correctly $libc_cv_rootsbindir
+
+Upstream-Status:Pending
+Signed-off-by: Matthieu Crapet <Matthieu.Crapet@ingenico.com>
+
+Index: git/sysdeps/gnu/configure
+===================================================================
+--- git.orig/sysdeps/gnu/configure 2014-08-27 07:24:38.572070587 +0000
++++ git/sysdeps/gnu/configure 2014-08-27 07:24:41.308070587 +0000
+@@ -32,6 +32,6 @@
+ else
+ libc_cv_localstatedir=$localstatedir
+ fi
+- libc_cv_rootsbindir=/sbin
++ test -n "$libc_cv_rootsbindir" || libc_cv_rootsbindir=/sbin
+ ;;
+ esac
+Index: git/sysdeps/gnu/configure.ac
+===================================================================
+--- git.orig/sysdeps/gnu/configure.ac 2014-08-27 07:24:38.572070587 +0000
++++ git/sysdeps/gnu/configure.ac 2014-08-27 07:24:41.308070587 +0000
+@@ -21,6 +21,6 @@
+ else
+ libc_cv_localstatedir=$localstatedir
+ fi
+- libc_cv_rootsbindir=/sbin
++ test -n "$libc_cv_rootsbindir" || libc_cv_rootsbindir=/sbin
+ ;;
+ esac
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/generate-supported.mk b/meta/recipes-core/glibc/glibc/generate-supported.mk
index d2a28c2dc6..d2a28c2dc6 100644
--- a/meta/recipes-core/eglibc/eglibc-2.19/generate-supported.mk
+++ b/meta/recipes-core/glibc/glibc/generate-supported.mk
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/glibc.fix_sqrt2.patch b/meta/recipes-core/glibc/glibc/glibc.fix_sqrt2.patch
index 689b79c61c..f5ed1bfeef 100644
--- a/meta/recipes-core/eglibc/eglibc-2.19/glibc.fix_sqrt2.patch
+++ b/meta/recipes-core/glibc/glibc/glibc.fix_sqrt2.patch
@@ -1,10 +1,10 @@
Signed-of-by: Edmar Wienskoski <edmar@freescale.com>
Upstream-Status: Pending
-Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
+Index: git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
===================================================================
---- /dev/null
-+++ libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c 2014-08-29 10:34:07.768070587 -0700
@@ -0,0 +1,134 @@
+/* Double-precision floating point square root.
+ Copyright (C) 2010 Free Software Foundation, Inc.
@@ -140,10 +140,10 @@ Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
+ }
+ return f_wash (b);
+}
-Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
+Index: git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
===================================================================
---- /dev/null
-+++ libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c 2014-08-29 10:34:07.768070587 -0700
@@ -0,0 +1,101 @@
+/* Single-precision floating point square root.
+ Copyright (C) 2010 Free Software Foundation, Inc.
@@ -246,10 +246,10 @@ Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
+ }
+ return f_washf (b);
+}
-Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
+Index: git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
===================================================================
---- /dev/null
-+++ libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c 2014-08-29 10:34:07.768070587 -0700
@@ -0,0 +1,134 @@
+/* Double-precision floating point square root.
+ Copyright (C) 2010 Free Software Foundation, Inc.
@@ -385,10 +385,10 @@ Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
+ }
+ return f_wash (b);
+}
-Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
+Index: git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
===================================================================
---- /dev/null
-+++ libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c 2014-08-29 10:34:07.772070587 -0700
@@ -0,0 +1,101 @@
+/* Single-precision floating point square root.
+ Copyright (C) 2010 Free Software Foundation, Inc.
@@ -491,10 +491,10 @@ Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
+ }
+ return f_washf (b);
+}
-Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
+Index: git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
===================================================================
---- /dev/null
-+++ libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c 2014-08-29 10:34:07.772070587 -0700
@@ -0,0 +1,134 @@
+/* Double-precision floating point square root.
+ Copyright (C) 2010 Free Software Foundation, Inc.
@@ -630,10 +630,10 @@ Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
+ }
+ return f_wash (b);
+}
-Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
+Index: git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
===================================================================
---- /dev/null
-+++ libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c 2014-08-29 10:34:07.772070587 -0700
@@ -0,0 +1,101 @@
+/* Single-precision floating point square root.
+ Copyright (C) 2010 Free Software Foundation, Inc.
@@ -736,10 +736,10 @@ Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
+ }
+ return f_washf (b);
+}
-Index: libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
+Index: git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
===================================================================
---- /dev/null
-+++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c 2014-08-29 10:34:07.772070587 -0700
@@ -0,0 +1,134 @@
+/* Double-precision floating point square root.
+ Copyright (C) 2010 Free Software Foundation, Inc.
@@ -875,10 +875,10 @@ Index: libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
+ }
+ return f_wash (b);
+}
-Index: libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
+Index: git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
===================================================================
---- /dev/null
-+++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c 2014-08-29 10:34:07.772070587 -0700
@@ -0,0 +1,101 @@
+/* Single-precision floating point square root.
+ Copyright (C) 2010 Free Software Foundation, Inc.
@@ -981,10 +981,10 @@ Index: libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
+ }
+ return f_washf (b);
+}
-Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
+Index: git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
===================================================================
---- /dev/null
-+++ libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c 2014-08-29 10:34:07.772070587 -0700
@@ -0,0 +1,134 @@
+/* Double-precision floating point square root.
+ Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1120,10 +1120,10 @@ Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
+ }
+ return f_wash (b);
+}
-Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
+Index: git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
===================================================================
---- /dev/null
-+++ libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c 2014-08-29 10:34:07.772070587 -0700
@@ -0,0 +1,101 @@
+/* Single-precision floating point square root.
+ Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1226,10 +1226,10 @@ Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
+ }
+ return f_washf (b);
+}
-Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
+Index: git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
===================================================================
---- /dev/null
-+++ libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c 2014-08-29 10:34:07.772070587 -0700
@@ -0,0 +1,134 @@
+/* Double-precision floating point square root.
+ Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1365,10 +1365,10 @@ Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
+ }
+ return f_wash (b);
+}
-Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
+Index: git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
===================================================================
---- /dev/null
-+++ libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c 2014-08-29 10:34:07.776070587 -0700
@@ -0,0 +1,101 @@
+/* Single-precision floating point square root.
+ Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1471,46 +1471,46 @@ Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
+ }
+ return f_washf (b);
+}
-Index: libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies
+Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies
===================================================================
---- /dev/null
-+++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies 2014-08-29 10:34:07.776070587 -0700
@@ -0,0 +1 @@
+powerpc/powerpc32/603e/fpu
-Index: libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies
+Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies
===================================================================
---- /dev/null
-+++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies 2014-08-29 10:34:07.776070587 -0700
@@ -0,0 +1,2 @@
+# e300c3 is a variant of 603e so use the same optimizations for sqrt
+powerpc/powerpc32/603e/fpu
-Index: libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies
+Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies
===================================================================
---- /dev/null
-+++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies 2014-08-29 10:34:07.776070587 -0700
@@ -0,0 +1 @@
+powerpc/powerpc32/e500mc/fpu
-Index: libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies
+Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies
===================================================================
---- /dev/null
-+++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies 2014-08-29 10:34:07.776070587 -0700
@@ -0,0 +1 @@
+powerpc/powerpc32/e5500/fpu
-Index: libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies
+Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies
===================================================================
---- /dev/null
-+++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies 2014-08-29 10:34:07.776070587 -0700
@@ -0,0 +1 @@
+powerpc/powerpc32/e6500/fpu
-Index: libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies
+Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies
===================================================================
---- /dev/null
-+++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies 2014-08-29 10:34:07.780070587 -0700
@@ -0,0 +1 @@
+powerpc/powerpc64/e5500/fpu
-Index: libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies
+Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies
===================================================================
---- /dev/null
-+++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies 2014-08-29 10:34:07.780070587 -0700
@@ -0,0 +1 @@
+powerpc/powerpc64/e6500/fpu
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/grok_gold.patch b/meta/recipes-core/glibc/glibc/grok_gold.patch
index d46737af98..5151802ecf 100644
--- a/meta/recipes-core/eglibc/eglibc-2.19/grok_gold.patch
+++ b/meta/recipes-core/glibc/glibc/grok_gold.patch
@@ -6,11 +6,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Backport
-Index: libc/configure
+Index: git/configure
===================================================================
---- libc.orig/configure
-+++ libc/configure
-@@ -4654,7 +4654,7 @@ else
+--- git.orig/configure
++++ git/configure
+@@ -4593,7 +4593,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; }
@@ -18,17 +18,17 @@ Index: libc/configure
+ ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU [Bbinutilsd][^.]* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*)
-Index: libc/configure.ac
+ 2.1[0-9][0-9]*|2.2[2-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*)
+Index: git/configure.ac
===================================================================
---- libc.orig/configure.ac
-+++ libc/configure.ac
-@@ -990,7 +990,7 @@ AC_CHECK_PROG_VER(AS, $AS, --version,
- [GNU assembler.* \([0-9]*\.[0-9.]*\)],
- [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], AS=: critic_missing="$critic_missing as")
+--- git.orig/configure.ac
++++ git/configure.ac
+@@ -913,7 +913,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,
- [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
+ [GNU [Bbinutilsd][^.]* \([0-9][0-9]*\.[0-9.]*\)],
- [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], LD=: critic_missing="$critic_missing ld")
+ [2.1[0-9][0-9]*|2.2[2-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
+ LD=: critic_missing="$critic_missing ld")
- # These programs are version sensitive.
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/initgroups_keys.patch b/meta/recipes-core/glibc/glibc/initgroups_keys.patch
index be29856b03..32aa15a533 100644
--- a/meta/recipes-core/eglibc/eglibc-2.19/initgroups_keys.patch
+++ b/meta/recipes-core/glibc/glibc/initgroups_keys.patch
@@ -5,16 +5,16 @@ as undefined symbol
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Pending
-Index: libc/nss/getent.c
+Index: git/nss/getent.c
===================================================================
---- libc.orig/nss/getent.c 2012-03-09 09:41:57.099581559 -0800
-+++ libc/nss/getent.c 2012-03-09 09:42:13.095582334 -0800
-@@ -898,7 +898,7 @@
+--- git.orig/nss/getent.c 2014-08-27 05:15:25.996070587 +0000
++++ git/nss/getent.c 2014-08-27 05:16:00.048070587 +0000
+@@ -879,7 +879,7 @@
D(group)
D(gshadow)
- DN(hosts)
+ D(hosts)
-D(initgroups)
+DN(initgroups)
- DN(netgroup)
- DN(networks)
+ D(netgroup)
+ D(networks)
D(passwd)
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/ld-search-order.patch b/meta/recipes-core/glibc/glibc/ld-search-order.patch
index e83a0ad6d2..f518bc7642 100644
--- a/meta/recipes-core/eglibc/eglibc-2.19/ld-search-order.patch
+++ b/meta/recipes-core/glibc/glibc/ld-search-order.patch
@@ -19,12 +19,12 @@ means we need to switch the order of 3 and 4 above to make this work effectively
RP 14/10/2010
-Index: libc/elf/dl-load.c
+Index: git/elf/dl-load.c
===================================================================
---- libc.orig/elf/dl-load.c 2012-12-02 13:11:45.000000000 -0800
-+++ libc/elf/dl-load.c 2013-01-09 07:00:59.135223084 -0800
-@@ -2215,7 +2215,14 @@
- fd = open_path (name, namelen, mode & __RTLD_SECURE,
+--- git.orig/elf/dl-load.c 2014-08-28 17:32:46.292070587 -0700
++++ git/elf/dl-load.c 2014-08-28 17:33:56.048070587 -0700
+@@ -2050,7 +2050,14 @@
+ fd = open_path (name, namelen, mode,
&loader->l_runpath_dirs, &realname, &fb, loader,
LA_SER_RUNPATH, &found_other_class);
-
@@ -38,19 +38,19 @@ Index: libc/elf/dl-load.c
+ /* Finally try ld.so.cache */
#ifdef USE_LDCONFIG
if (fd == -1
- && (__builtin_expect (! (mode & __RTLD_SECURE), 1)
-@@ -2283,14 +2290,6 @@
+ && (__glibc_likely ((mode & __RTLD_SECURE) == 0)
+@@ -2113,14 +2120,6 @@
}
#endif
- /* Finally, try the default path. */
- if (fd == -1
- && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
-- || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1))
+- || __glibc_likely (!(l->l_flags_1 & DF_1_NODEFLIB)))
- && rtld_search_dirs.dirs != (void *) -1)
-- fd = open_path (name, namelen, mode & __RTLD_SECURE, &rtld_search_dirs,
+- fd = open_path (name, namelen, mode, &rtld_search_dirs,
- &realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
-
/* Add another newline when we are tracing the library loading. */
- if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
_dl_debug_printf ("\n");
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/mips-rld-map-check.patch b/meta/recipes-core/glibc/glibc/mips-rld-map-check.patch
index 9b646fea95..9f593d6359 100644
--- a/meta/recipes-core/eglibc/eglibc-2.19/mips-rld-map-check.patch
+++ b/meta/recipes-core/glibc/glibc/mips-rld-map-check.patch
@@ -11,9 +11,10 @@ Upstream-Status: Pending
---
-diff -ru glibc-2.10.1.orig/ports/sysdeps/mips/dl-machine.h glibc-2.10.1/ports/sysdeps/mips/dl-machine.h
---- glibc-2.10.1.orig/ports/sysdeps/mips/dl-machine.h 2009-05-16 16:36:20.000000000 +0800
-+++ glibc-2.10.1/ports/sysdeps/mips/dl-machine.h 2010-09-19 09:11:53.000000000 +0800
+Index: git/sysdeps/mips/dl-machine.h
+===================================================================
+--- git.orig/sysdeps/mips/dl-machine.h 2014-08-27 04:58:11.840070587 +0000
++++ git/sysdeps/mips/dl-machine.h 2014-08-27 04:58:11.832070587 +0000
@@ -70,7 +70,8 @@
/* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in
with the run-time address of the r_debug structure */
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/multilib_readlib.patch b/meta/recipes-core/glibc/glibc/multilib_readlib.patch
index 1542b1b519..13ffc46f91 100644
--- a/meta/recipes-core/eglibc/eglibc-2.19/multilib_readlib.patch
+++ b/meta/recipes-core/glibc/glibc/multilib_readlib.patch
@@ -5,9 +5,11 @@ variable EGLIBC_KNOWN_INTERPRETER_NAMES.
Lianhao Lu, 08/01/2011
---- libc/elf/readlib.c.orig 2011-08-12 17:05:51.864470837 +0800
-+++ libc/elf/readlib.c 2011-08-12 17:06:39.346942074 +0800
-@@ -52,6 +52,7 @@
+Index: git/elf/readlib.c
+===================================================================
+--- git.orig/elf/readlib.c 2014-08-29 10:34:16.824070587 -0700
++++ git/elf/readlib.c 2014-08-29 10:34:16.816070587 -0700
+@@ -51,6 +51,7 @@
#ifdef SYSDEP_KNOWN_INTERPRETER_NAMES
SYSDEP_KNOWN_INTERPRETER_NAMES
#endif
diff --git a/meta/recipes-core/glibc/glibc/option-groups.patch b/meta/recipes-core/glibc/glibc/option-groups.patch
new file mode 100644
index 0000000000..198be73524
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/option-groups.patch
@@ -0,0 +1,1397 @@
+Eglibc option group infrastructure
+
+Upstream-Status: Pending
+
+Index: git/option-groups.def
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/option-groups.def 2014-08-27 07:26:51.652070587 +0000
+@@ -0,0 +1,868 @@
++# This file documents the option groups EGLIBC currently supports, in
++# a format akin to the Linux Kconfig system's. The syntax may change
++# over time.
++#
++# An entry of the form:
++#
++# config GROUP_NAME
++# bool "one-line explanation of what this option group controls"
++# help
++# Multi-line help explaining the option group's meaning in
++# some detail, terminated by indentation level.
++#
++# defines an option group whose variable is GROUP_NAME, with
++# meaningful values 'y' (enabled) and 'n' (disabled). The
++# documentation is formatted to be consumed by some sort of
++# interactive configuration interface, but EGLIBC doesn't have such an
++# interface yet.
++#
++# An option may have a 'depends on' line, indicating which other options
++# must also be enabled if this option is. At present, EGLIBC doesn't
++# check that these dependencies are satisfied.
++#
++# Option group variables get their default values from the file
++# 'option-groups.defaults', in the top directory of the EGLIBC source
++# tree. By default, all EGLIBC option groups are enabled --- their
++# variables are set to 'y'.
++#
++# After including 'option-groups.defaults', the EGLIBC make machinery
++# includes the file 'option-groups.config' from the top of the build
++# tree, if it is present. Developers can place assignments to option
++# group variables in that file to override the defaults. For example,
++# to disable an option group, place a line of the form:
++#
++# OPTION_GROUP_NAME = n
++#
++# in 'option-groups.config' at the top of your build tree. To
++# explicitly enable an option group, you may also write:
++#
++# OPTION_GROUP_NAME = y
++#
++# although this simply reestablishes the value already set by
++# 'option-groups.defaults'.
++
++config EGLIBC_ADVANCED_INET6
++ bool "IPv6 Advanced Sockets API support (RFC3542)"
++ depends on EGLIBC_INET
++ help
++ This option group includes the functions specified by RFC 3542,
++ "Advanced Sockets Application Program Interface (API) for
++ IPv6".
++
++ This option group includes the following functions:
++
++ inet6_opt_append
++ inet6_opt_find
++ inet6_opt_finish
++ inet6_opt_get_val
++ inet6_opt_init
++ inet6_option_alloc
++ inet6_option_append
++ inet6_option_find
++ inet6_option_init
++ inet6_option_next
++ inet6_option_space
++ inet6_opt_next
++ inet6_opt_set_val
++ inet6_rth_add
++ inet6_rth_getaddr
++ inet6_rth_init
++ inet6_rth_reverse
++ inet6_rth_segments
++ inet6_rth_space
++
++config EGLIBC_BACKTRACE
++ bool "Functions for producing backtraces"
++ help
++ This option group includes functions for producing a list of
++ the function calls that are currently active in a thread, from
++ within the thread itself. These functions are often used
++ within signal handlers, to produce diagnostic output.
++
++ This option group includes the following functions:
++
++ backtrace
++ backtrace_symbols
++ backtrace_symbols_fd
++
++config EGLIBC_BIG_MACROS
++ bool "Use extensive inline code"
++ help
++ This option group specifies whether certain pieces of code
++ should be inlined to achieve maximum speed. If this option
++ group is not selected, function calls will be used instead,
++ hence reducing the library footprint.
++
++config EGLIBC_BSD
++ bool "BSD-specific functions, and their compatibility stubs"
++ help
++ This option group includes functions specific to BSD kernels.
++ A number of these functions have stub versions that are also
++ included in libraries built for non-BSD systems for
++ compatibility.
++
++ This option group includes the following functions:
++
++ chflags
++ fchflags
++ lchmod
++ revoke
++ setlogin
++
++config EGLIBC_CXX_TESTS
++ bool "Tests that link against the standard C++ library."
++ depends on POSIX_WIDE_CHAR_DEVICE_IO && EGLIBC_LIBM
++ help
++ This option group does not include any C library functions;
++ instead, it controls which EGLIBC tests an ordinary 'make
++ tests' runs. With this group disabled, tests that would
++ normally link against the standard C++ library are not
++ run.
++
++ The standard C++ library depends on the math library 'libm' and
++ the wide character I/O functions included in EGLIBC. So those
++ option groups must be enabled if this test is enabled.
++
++config EGLIBC_CATGETS
++ bool "Functions for accessing message catalogs"
++ depends on EGLIBC_LOCALE_CODE
++ help
++ This option group includes functions for accessing message
++ catalogs: catopen, catclose, and catgets.
++
++ This option group depends on the EGLIBC_LOCALE_CODE
++ option group.
++
++config EGLIBC_CHARSETS
++ bool "iconv/gconv character set conversion libraries"
++ help
++ This option group includes support for character sets other
++ than ASCII (ANSI_X3.4-1968) and Unicode and ISO-10646 in their
++ various encodings. This affects both the character sets
++ supported by the wide and multibyte character functions, and
++ those supported by the 'iconv' functions.
++
++ With this option group disabled, EGLIBC supports only the
++ following character sets:
++
++ ANSI_X3.4 - ASCII
++ ANSI_X3.4-1968
++ ANSI_X3.4-1986
++ ASCII
++ CP367
++ CSASCII
++ IBM367
++ ISO-IR-6
++ ISO646-US
++ ISO_646.IRV:1991
++ OSF00010020
++ US
++ US-ASCII
++
++ 10646-1:1993 - ISO 10646, in big-endian UCS4 form
++ 10646-1:1993/UCS4
++ CSUCS4
++ ISO-10646
++ ISO-10646/UCS4
++ OSF00010104
++ OSF00010105
++ OSF00010106
++ UCS-4
++ UCS-4BE
++ UCS4
++
++ UCS-4LE - ISO 10646, in little-endian UCS4 form
++
++ ISO-10646/UTF-8 - ISO 10646, in UTF-8 form
++ ISO-10646/UTF8
++ ISO-IR-193
++ OSF05010001
++ UTF-8
++ UTF8
++
++ ISO-10646/UCS2 - ISO 10646, in target-endian UCS2 form
++ OSF00010100
++ OSF00010101
++ OSF00010102
++ UCS-2
++ UCS2
++
++ UCS-2BE - ISO 10646, in big-endian UCS2 form
++ UNICODEBIG
++
++ UCS-2LE - ISO 10646, in little-endian UCS2 form
++ UNICODELITTLE
++
++ WCHAR_T - EGLIBC's internal form (target-endian,
++ 32-bit ISO 10646)
++
++config EGLIBC_CRYPT
++ bool "Encryption library"
++ help
++ This option group includes the `libcrypt' library which
++ provides functions for one-way encryption. Supported
++ encryption algorithms include MD5, SHA-256, SHA-512 and DES.
++
++config EGLIBC_CRYPT_UFC
++ bool "Ultra fast `crypt' implementation"
++ depends on EGLIBC_CRYPT
++ help
++ This option group provides ultra fast DES-based implementation of
++ the `crypt' function. When this option group is disabled,
++ (a) the library will not provide the setkey[_r] and encrypt[_r]
++ functions and (b) the crypt[_r] function will return NULL and set the
++ errno to ENOSYS if /salt/ passed does not correspond to either MD5,
++ SHA-256 or SHA-512 algorithm.
++
++config EGLIBC_DB_ALIASES
++ bool "Functions for accessing the mail aliases database"
++ help
++ This option group includues functions for looking up mail
++ aliases in '/etc/aliases' or using nsswitch. It includes the
++ following functions:
++
++ endaliasent
++ getaliasbyname
++ getaliasbyname_r
++ getaliasent
++ getaliasent_r
++ setaliasent
++
++ When this option group is disabled, the NSS service libraries
++ also lack support for querying their mail alias tables.
++
++config EGLIBC_ENVZ
++ bool "Functions for handling envz-style environment vectors."
++ help
++ This option group contains functions for creating and operating
++ on envz vectors. An "envz vector" is a vector of strings in a
++ contiguous block of memory, where each element is a name-value
++ pair, and elements are separated from their neighbors by null
++ characters.
++
++ This option group includes the following functions:
++
++ envz_add envz_merge
++ envz_entry envz_remove
++ envz_get envz_strip
++
++config EGLIBC_FCVT
++ bool "Functions for converting floating-point numbers to strings"
++ help
++ This option group includes functions for converting
++ floating-point numbers to strings.
++
++ This option group includes the following functions:
++
++ ecvt qecvt
++ ecvt_r qecvt_r
++ fcvt qfcvt
++ fcvt_r qfcvt_r
++ gcvt qgcvt
++
++config EGLIBC_FMTMSG
++ bool "Functions for formatting messages"
++ help
++ This option group includes the following functions:
++
++ addseverity fmtmsg
++
++config EGLIBC_FSTAB
++ bool "Access functions for 'fstab'"
++ help
++ This option group includes functions for reading the mount
++ point specification table, '/etc/fstab'. These functions are
++ not included in the POSIX standard, which provides the
++ 'getmntent' family of functions instead.
++
++ This option group includes the following functions:
++
++ endfsent getfsspec
++ getfsent setfsent
++ getfsfile
++
++config EGLIBC_FTRAVERSE
++ bool "Functions for traversing file hierarchies"
++ help
++ This option group includes functions for traversing file
++ UNIX file hierachies.
++
++ This option group includes the following functions:
++
++ fts_open ftw
++ fts_read nftw
++ fts_children ftw64
++ fts_set nftw64
++ fts_close
++
++config EGLIBC_GETLOGIN
++ bool "The getlogin function"
++ depends on EGLIBC_UTMP
++ help
++ This function group includes the 'getlogin' and 'getlogin_r'
++ functions, which return the user name associated by the login
++ activity with the current process's controlling terminal.
++
++ With this option group disabled, the 'glob' function will not
++ fall back on 'getlogin' to find the user's login name for tilde
++ expansion when the 'HOME' environment variable is not set.
++
++config EGLIBC_IDN
++ bool "International domain names support"
++ help
++ This option group includes the `libcidn' library which
++ provides support for international domain names.
++
++config EGLIBC_INET
++ bool "Networking support"
++ help
++ This option group includes networking-specific functions and
++ data. With EGLIBC_INET disabled, the EGLIBC
++ installation and API changes as follows:
++
++ - The following libraries are not installed:
++
++ libnsl
++ libnss_compat
++ libnss_dns
++ libnss_hesiod
++ libnss_nis
++ libnss_nisplus
++ libresolv
++
++ - The following functions and variables are omitted from libc:
++
++ authdes_create hstrerror svc_fdset
++ authdes_getucred htonl svc_getreq
++ authdes_pk_create htons svc_getreq_common
++ authnone_create if_freenameindex svc_getreq_poll
++ authunix_create if_indextoname svc_getreqset
++ authunix_create_default if_nameindex svc_max_pollfd
++ bindresvport if_nametoindex svc_pollfd
++ callrpc in6addr_any svcraw_create
++ cbc_crypt in6addr_loopback svc_register
++ clnt_broadcast inet6_opt_append svc_run
++ clnt_create inet6_opt_find svc_sendreply
++ clnt_pcreateerror inet6_opt_finish svctcp_create
++ clnt_perrno inet6_opt_get_val svcudp_bufcreate
++ clnt_perror inet6_opt_init svcudp_create
++ clntraw_create inet6_option_alloc svcudp_enablecache
++ clnt_spcreateerror inet6_option_append svcunix_create
++ clnt_sperrno inet6_option_find svcunixfd_create
++ clnt_sperror inet6_option_init svc_unregister
++ clnttcp_create inet6_option_next user2netname
++ clntudp_bufcreate inet6_option_space xdecrypt
++ clntudp_create inet6_opt_next xdr_accepted_reply
++ clntunix_create inet6_opt_set_val xdr_array
++ des_setparity inet6_rth_add xdr_authdes_cred
++ ecb_crypt inet6_rth_getaddr xdr_authdes_verf
++ endaliasent inet6_rth_init xdr_authunix_parms
++ endhostent inet6_rth_reverse xdr_bool
++ endnetent inet6_rth_segments xdr_bytes
++ endnetgrent inet6_rth_space xdr_callhdr
++ endprotoent inet_addr xdr_callmsg
++ endrpcent inet_aton xdr_char
++ endservent inet_lnaof xdr_cryptkeyarg
++ ether_aton inet_makeaddr xdr_cryptkeyarg2
++ ether_aton_r inet_netof xdr_cryptkeyres
++ ether_hostton inet_network xdr_des_block
++ ether_line inet_nsap_addr xdr_double
++ ether_ntoa inet_nsap_ntoa xdr_enum
++ ether_ntoa_r inet_ntoa xdr_float
++ ether_ntohost inet_ntop xdr_free
++ freeaddrinfo inet_pton xdr_getcredres
++ freeifaddrs innetgr xdr_hyper
++ gai_strerror iruserok xdr_int
++ getaddrinfo iruserok_af xdr_int16_t
++ getaliasbyname key_decryptsession xdr_int32_t
++ getaliasbyname_r key_decryptsession_pk xdr_int64_t
++ getaliasent key_encryptsession xdr_int8_t
++ getaliasent_r key_encryptsession_pk xdr_keybuf
++ gethostbyaddr key_gendes xdr_key_netstarg
++ gethostbyaddr_r key_get_conv xdr_key_netstres
++ gethostbyname key_secretkey_is_set xdr_keystatus
++ gethostbyname2 key_setnet xdr_long
++ gethostbyname2_r key_setsecret xdr_longlong_t
++ gethostbyname_r netname2host xdrmem_create
++ gethostent netname2user xdr_netnamestr
++ gethostent_r ntohl xdr_netobj
++ getifaddrs ntohs xdr_opaque
++ getipv4sourcefilter passwd2des xdr_opaque_auth
++ get_myaddress pmap_getmaps xdr_pmap
++ getnameinfo pmap_getport xdr_pmaplist
++ getnetbyaddr pmap_rmtcall xdr_pointer
++ getnetbyaddr_r pmap_set xdr_quad_t
++ getnetbyname pmap_unset xdrrec_create
++ getnetbyname_r rcmd xdrrec_endofrecord
++ getnetent rcmd_af xdrrec_eof
++ getnetent_r registerrpc xdrrec_skiprecord
++ getnetgrent res_init xdr_reference
++ getnetgrent_r rexec xdr_rejected_reply
++ getnetname rexec_af xdr_replymsg
++ getprotobyname rexecoptions xdr_rmtcall_args
++ getprotobyname_r rpc_createerr xdr_rmtcallres
++ getprotobynumber rresvport xdr_short
++ getprotobynumber_r rresvport_af xdr_sizeof
++ getprotoent rtime xdrstdio_create
++ getprotoent_r ruserok xdr_string
++ getpublickey ruserok_af xdr_u_char
++ getrpcbyname ruserpass xdr_u_hyper
++ getrpcbyname_r setaliasent xdr_u_int
++ getrpcbynumber sethostent xdr_uint16_t
++ getrpcbynumber_r setipv4sourcefilter xdr_uint32_t
++ getrpcent setnetent xdr_uint64_t
++ getrpcent_r setnetgrent xdr_uint8_t
++ getrpcport setprotoent xdr_u_long
++ getsecretkey setrpcent xdr_u_longlong_t
++ getservbyname setservent xdr_union
++ getservbyname_r setsourcefilter xdr_unixcred
++ getservbyport svcauthdes_stats xdr_u_quad_t
++ getservbyport_r svcerr_auth xdr_u_short
++ getservent svcerr_decode xdr_vector
++ getservent_r svcerr_noproc xdr_void
++ getsourcefilter svcerr_noprog xdr_wrapstring
++ h_errlist svcerr_progvers xencrypt
++ h_errno svcerr_systemerr xprt_register
++ herror svcerr_weakauth xprt_unregister
++ h_nerr svc_exit
++ host2netname svcfd_create
++
++ - The rpcgen, nscd, and rpcinfo commands are not installed.
++
++ - The 'rpc' file (a text file listing RPC services) is not installed.
++
++ Socket-related system calls do not fall in this option group,
++ because many are also used for other inter-process
++ communication mechanisms. For example, the 'syslog' routines
++ use Unix-domain sockets to communicate with the syslog daemon;
++ syslog is valuable in non-networked contexts.
++
++config EGLIBC_INET_ANL
++ bool "Asynchronous name lookup"
++ depends on EGLIBC_INET
++ help
++ This option group includes the `libanl' library which
++ provides support for asynchronous name lookup.
++
++config EGLIBC_LIBM
++ bool "libm (math library)"
++ help
++ This option group includes the 'libm' library, containing
++ mathematical functions. If this option group is omitted, then
++ an EGLIBC installation does not include shared or unshared versions
++ of the math library.
++
++ Note that this does not remove all floating-point related
++ functionality from EGLIBC; for example, 'printf' and 'scanf'
++ can still print and read floating-point values with this option
++ group disabled.
++
++ Note that the ISO Standard C++ library 'libstdc++' depends on
++ EGLIBC's math library 'libm'. If you disable this option
++ group, you will not be able to build 'libstdc++' against the
++ resulting EGLIBC installation.
++
++config EGLIBC_LOCALES
++ bool "Locale definitions"
++ help
++ This option group includes all locale definitions other than
++ that for the "C" locale. If this option group is omitted, then
++ only the "C" locale is supported.
++
++
++config EGLIBC_LOCALE_CODE
++ bool "Locale functions"
++ depends on POSIX_C_LANG_WIDE_CHAR
++ help
++ This option group includes locale support functions, programs,
++ and libraries. With EGLIBC_LOCALE_CODE disabled,
++ EGLIBC supports only the 'C' locale (also known as 'POSIX'),
++ and ignores the settings of the 'LANG' and 'LC_*' environment
++ variables.
++
++ With EGLIBC_LOCALE_CODE disabled, the following
++ functions are omitted from libc:
++
++ duplocale localeconv nl_langinfo rpmatch strfmon_l
++ freelocale newlocale nl_langinfo_l strfmon uselocale
++
++ Furthermore, only the LC_CTYPE and LC_TIME categories of the
++ standard "C" locale are available.
++
++ The EGLIBC_CATGETS option group depends on this option group.
++
++
++config EGLIBC_MEMUSAGE
++ bool "Memory profiling library"
++ help
++ This option group includes the `libmemusage' library and
++ the `memusage' and `memusagestat' utilities.
++ These components provide memory profiling functions.
++
++config EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
++ int "Memory profiling library buffer size"
++ depends on EGLIBC_MEMUSAGE
++ default "32768"
++ help
++ Libmemusage library buffers the profiling data in memory
++ before writing it out to disk. By default, the library
++ allocates 1.5M buffer, which can be substantial for some
++ systems. EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE option
++ allows to change the default buffer size. It specifies
++ the number of entries the buffer should have.
++ On most architectures one buffer entry amounts to 48 bytes,
++ so setting this option to the value of 512 will reduce the size of
++ the memory buffer to 24K.
++
++config EGLIBC_NIS
++ bool "Support for NIS, NIS+, and the special 'compat' services."
++ depends on EGLIBC_INET && EGLIBC_SUNRPC
++ help
++ This option group includes the NIS, NIS+, and 'compat' Name
++ Service Switch service libraries. When it is disabled, those
++ services libraries are not installed; you should remove any
++ references to them from your 'nsswitch.conf' file.
++
++ This option group depends on the EGLIBC_INET option
++ group; you must enable that to enable this option group.
++
++config EGLIBC_NSSWITCH
++ bool "Name service switch (nsswitch) support"
++ help
++ This option group includes support for the 'nsswitch' facility.
++ With this option group enabled, all EGLIBC functions for
++ accessing various system databases (passwords and groups;
++ networking; aliases; public keys; and so on) consult the
++ '/etc/nsswitch.conf' configuration file to decide how to handle
++ queries.
++
++ With this option group disabled, EGLIBC uses a fixed list of
++ services to satisfy queries on each database, as requested by
++ configuration files specified when EGLIBC is built. Your
++ 'option-groups.config' file must set the following two
++ variables:
++
++config EGLIBC_NSSWITCH_FIXED_CONFIG
++ string "Nsswitch fixed config filename"
++ depends on !EGLIBC_NSSWITCH
++ default ""
++ help
++ Set this to the name of a file whose contents observe the
++ same syntax as an ordinary '/etc/nsswitch.conf' file. The
++ EGLIBC build process parses this file just as EGLIBC would
++ at run time if EGLIBC_NSSWITCH were enabled, and
++ produces a C library that uses the nsswitch service
++ libraries to search for database entries as this file
++ specifies, instead of consulting '/etc/nsswitch.conf' at run
++ time.
++
++ This should be an absolute filename. The EGLIBC build
++ process may use it from several different working
++ directories. It may include references to Makefile
++ variables like 'common-objpfx' (the top of the build tree,
++ with a trailing slash), or '..' (the top of the source tree,
++ with a trailing slash).
++
++ The EGLIBC source tree includes a sample configuration file
++ named 'nss/fixed-nsswitch.conf'; for simple configurations,
++ you will probably want to delete references to databases not
++ needed on your system.
++
++config EGLIBC_NSSWITCH_FIXED_FUNCTIONS
++ string "Nsswitch fixed functions filename"
++ depends on !EGLIBC_NSSWITCH
++ default ""
++ help
++ The EGLIBC build process uses this file to decide which
++ functions to make available from which service libraries.
++ The file 'nss/fixed-nsswitch.functions' serves as a sample
++ configuration file for this setting, and explains its syntax
++ and meaning in more detail.
++
++ This should be an absolute file name. The EGLIBC build
++ process may use it from several different working
++ directories. It may include references to Makefile
++ variables like 'common-objpfx' (the top of the build tree,
++ with a trailing slash), or '..' (the top of the source tree,
++ with a trailing slash).
++
++ Be sure to mention each function in each service you wish to
++ use. If you do not mention a service's function here, the
++ EGLIBC database access functions will not find it, even if
++ it is listed in the EGLIBC_NSSWITCH_FIXED_CONFIG
++ file.
++
++ In this arrangement, EGLIBC will not use the 'dlopen' and
++ 'dlsym' functions to find database access functions. Instead,
++ libc hard-codes references to the service libraries' database
++ access functions. You must explicitly link your program
++ against the name service libraries (those whose names start
++ with 'libnss_', in the sysroot's '/lib' directory) whose
++ functions you intend to use. This arrangement helps
++ system-wide static analysis tools decide which functions a
++ system actually uses.
++
++ Note that some nsswitch service libraries require other option
++ groups to be enabled; for example, the EGLIBC_INET
++ option group must be enabled to use the 'libnss_dns.so.2'
++ service library, which uses the Domain Name System network
++ protocol to answer queries.
++
++config EGLIBC_RCMD
++ bool "Support for 'rcmd' and related library functions"
++ depends on EGLIBC_INET
++ help
++ This option group includes functions for running commands on
++ remote machines via the 'rsh' protocol, and doing authentication
++ related to those functions. This also includes functions that
++ use the 'rexec' protocol.
++
++ This option group includes the following functions:
++
++ rcmd ruserok
++ rcmd_af ruserok_af
++ rexec iruserok
++ rexec_af iruserok_af
++ rresvport ruserpass
++ rresvport_af
++
++config EGLIBC_RTLD_DEBUG
++ bool "Runtime linker debug print outs"
++ help
++ This option group enables debug output of the runtime linker
++ which is activated via LD_DEBUG and LD_TRACE_PRELINKING
++ environment variables. Disabling this option group yields
++ a smaller runtime linker binary.
++ BEWARE: Disabling this option group is likely to break
++ the `ldd' utility which may also be used by the prelinker.
++ In particular, the `--unused' ldd option will not work correctly.
++
++config EGLIBC_SPAWN
++ bool "Support for POSIX posix_spawn functions"
++ help
++ This option group includes the POSIX functions for executing
++ programs in child processes without using 'fork' or 'vfork'.
++
++ This option group includes the following functions:
++
++ posix_spawn
++ posix_spawnattr_destroy
++ posix_spawnattr_getflags
++ posix_spawnattr_getpgroup
++ posix_spawnattr_getschedparam
++ posix_spawnattr_getschedpolicy
++ posix_spawnattr_getsigdefault
++ posix_spawnattr_getsigmask
++ posix_spawnattr_init
++ posix_spawnattr_setflags
++ posix_spawnattr_setpgroup
++ posix_spawnattr_setschedparam
++ posix_spawnattr_setschedpolicy
++ posix_spawnattr_setsigdefault
++ posix_spawnattr_setsigmask
++ posix_spawn_file_actions_addclose
++ posix_spawn_file_actions_adddup2
++ posix_spawn_file_actions_addopen
++ posix_spawn_file_actions_destroy
++ posix_spawn_file_actions_init
++ posix_spawnp
++
++ This option group also provides the ability for the iconv,
++ localedef, and locale programs to operate transparently on
++ compressed charset definitions. When this option group is
++ disabled, those programs will only operate on uncompressed
++ charmap files.
++
++config EGLIBC_STREAMS
++ bool "Support for accessing STREAMS."
++ help
++ This option group includes functions for reading and writing
++ messages to and from STREAMS. The STREAMS interface provides a
++ uniform mechanism for implementing networking services and other
++ character-based I/O. (STREAMS are not to be confused with
++ <stdio.h> FILE objects, also called 'streams'.)
++
++ This option group includes the following functions:
++
++ getmsg putpmsg
++ getpmsg fattach
++ isastream fdetach
++ putmsg
++
++config EGLIBC_SUNRPC
++ bool "Support for the Sun 'RPC' protocol."
++ depends on EGLIBC_INET
++ help
++ This option group includes support for the Sun RPC protocols,
++ including the 'rpcgen' and 'rpcinfo' programs.
++
++config EGLIBC_UTMP
++ bool "Older access functions for 'utmp' login records"
++ help
++ This option group includes the older 'utent' family of
++ functions for accessing user login records in the 'utmp' file.
++ POSIX omits these functions in favor of the 'utxent' family,
++ and they are obsolete on systems other than Linux.
++
++ This option group includes the following functions:
++
++ endutent
++ getutent
++ getutent_r
++ getutid
++ getutid_r
++ getutline
++ getutline_r
++ logwtmp
++ pututline
++ setutent
++ updwtmp
++ utmpname
++
++ This option group includes the following libraries:
++
++ libutil.so (and libutil.a)
++
++config EGLIBC_UTMPX
++ bool "POSIX access functions for 'utmp' login records"
++ depends on EGLIBC_UTMP
++ help
++ This option group includes the POSIX functions for reading and
++ writing user login records in the 'utmp' file (usually
++ '/var/run/utmp'). The POSIX functions operate on 'struct
++ utmpx' structures, as opposed to the family of older 'utent'
++ functions, which operate on 'struct utmp' structures.
++
++ This option group includes the following functions:
++
++ endutxent
++ getutmp
++ getutmpx
++ getutxent
++ getutxid
++ getutxline
++ pututxline
++ setutxent
++ updwtmpx
++ utmpxname
++
++config EGLIBC_WORDEXP
++ bool "Shell-style word expansion"
++ help
++ This option group includes the 'wordexp' function for
++ performing word expansion in the manner of the shell, and the
++ accompanying 'wordfree' function.
++
++config POSIX_C_LANG_WIDE_CHAR
++ bool "ISO C library wide character functions, excluding I/O"
++ help
++ This option group includes the functions defined by the ISO C
++ standard for working with wide and multibyte characters in
++ memory. Functions for reading and writing wide and multibyte
++ characters from and to files call in the
++ POSIX_WIDE_CHAR_DEVICE_IO option group.
++
++ This option group includes the following functions:
++
++ btowc mbsinit wcscspn wcstoll
++ iswalnum mbsrtowcs wcsftime wcstombs
++ iswalpha mbstowcs wcslen wcstoul
++ iswblank mbtowc wcsncat wcstoull
++ iswcntrl swprintf wcsncmp wcstoumax
++ iswctype swscanf wcsncpy wcsxfrm
++ iswdigit towctrans wcspbrk wctob
++ iswgraph towlower wcsrchr wctomb
++ iswlower towupper wcsrtombs wctrans
++ iswprint vswprintf wcsspn wctype
++ iswpunct vswscanf wcsstr wmemchr
++ iswspace wcrtomb wcstod wmemcmp
++ iswupper wcscat wcstof wmemcpy
++ iswxdigit wcschr wcstoimax wmemmove
++ mblen wcscmp wcstok wmemset
++ mbrlen wcscoll wcstol
++ mbrtowc wcscpy wcstold
++
++config POSIX_REGEXP
++ bool "Regular expressions"
++ help
++ This option group includes the POSIX regular expression
++ functions, and the associated non-POSIX extensions and
++ compatibility functions.
++
++ With POSIX_REGEXP disabled, the following functions are
++ omitted from libc:
++
++ re_comp re_max_failures regcomp
++ re_compile_fastmap re_search regerror
++ re_compile_pattern re_search_2 regexec
++ re_exec re_set_registers regfree
++ re_match re_set_syntax rpmatch
++ re_match_2 re_syntax_options
++
++ Furthermore, the compatibility regexp interface defined in the
++ <regexp.h> header file, 'compile', 'step', and 'advance', is
++ omitted.
++
++config POSIX_REGEXP_GLIBC
++ bool "Regular expressions from GLIBC"
++ depends on POSIX_REGEXP
++ help
++ This option group specifies which regular expression
++ library to use. The choice is between regex
++ implementation from GLIBC and regex implementation from
++ libiberty. The GLIBC variant is fully POSIX conformant and
++ optimized for speed; regex from libiberty is more than twice
++ as small while still is enough for most practical purposes.
++
++config POSIX_WIDE_CHAR_DEVICE_IO
++ bool "Input and output functions for wide characters"
++ depends on POSIX_C_LANG_WIDE_CHAR
++ help
++ This option group includes functions for reading and writing
++ wide characters to and from <stdio.h> streams.
++
++ This option group includes the following functions:
++
++ fgetwc fwprintf putwchar vwscanf
++ fgetws fwscanf ungetwc wprintf
++ fputwc getwc vfwprintf wscanf
++ fputws getwchar vfwscanf
++ fwide putwc vwprintf
++
++ This option group further includes the following unlocked
++ variants of the above functions:
++
++ fgetwc_unlocked getwc_unlocked
++ fgetws_unlocked getwchar_unlocked
++ fputwc_unlocked putwc_unlocked
++ fputws_unlocked putwchar_unlocked
++
++ Note that the GNU standard C++ library, 'libstdc++.so', uses
++ some of these functions; you will not be able to link or run
++ C++ programs if you disable this option group.
++
++ This option group also affects the behavior of the following
++ functions:
++
++ fdopen
++ fopen
++ fopen64
++ freopen
++ freopen64
++
++ These functions all take an OPENTYPE parameter which may
++ contain a string of the form ",ccs=CHARSET", indicating that
++ the underlying file uses the character set named CHARSET.
++ This produces a wide-oriented stream, which is only useful
++ when the functions included in this option group are present.
++ If the user attempts to open a file specifying a character set
++ in the OPENTYPE parameter, and EGLIBC was built with this
++ option group disabled, the function returns NULL, and sets
++ errno to EINVAL.
++
++
++# This helps Emacs users browse this file using the page motion commands
++# and commands like 'pages-directory'.
++# Local Variables:
++# page-delimiter: "^config\\s-"
++# End:
+Index: git/option-groups.mak
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/option-groups.mak 2014-08-27 07:26:51.652070587 +0000
+@@ -0,0 +1,41 @@
++# Setup file for subdirectory Makefiles that define EGLIBC option groups.
++
++# EGLIBC shouldn't need to override this. However, the
++# cross-build-friendly localedef includes this makefile to get option
++# group variable definitions; it uses a single build tree for all the
++# multilibs, and needs to be able to specify a different option group
++# configuration file for each multilib.
++option_group_config_file ?= $(objdir)/option-groups.config
++
++# Read the default settings for all options.
++# We're included before ../Rules, so we can't assume $(..) is set.
++include $(firstword $(..) ../)option-groups.defaults
++
++# Read the developer's option group selections, overriding the
++# defaults from option-groups.defaults.
++-include $(option_group_config_file)
++
++# $(call option-disabled, VAR) is 'y' if VAR is not 'y', or 'n' otherwise.
++# VAR should be a variable name, not a variable reference; this is
++# less general, but more terse for the intended use.
++# You can use it to add a file to a list if an option group is
++# disabled, like this:
++# routines-$(call option-disabled, OPTION_POSIX_C_LANG_WIDE_CHAR) += ...
++define option-disabled
++$(firstword $(subst y,n,$(filter y,$($(strip $(1))))) y)
++endef
++
++# Establish 'routines-y', etc. as simply-expanded variables.
++aux-y :=
++extra-libs-others-y :=
++extra-libs-y :=
++extra-objs-y :=
++install-bin-y :=
++install-others-y :=
++install-sbin-y :=
++others-y :=
++others-pie-y :=
++routines-y :=
++test-srcs-y :=
++tests-y :=
++xtests-y :=
+Index: git/option-groups.defaults
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/option-groups.defaults 2014-08-27 07:24:41.652070587 +0000
+@@ -0,0 +1,47 @@
++# This file sets default values for all option group variables
++# mentioned in option-groups.def; see that file for a description of
++# each option group.
++#
++# Subdirectory makefiles include this file before including the user's
++# settings from option-groups.config at the top of the build tree;
++# that file need only refer to those options whose default settings
++# are to be changed.
++#
++# By default, all option groups are enabled.
++OPTION_EGLIBC_ADVANCED_INET6 = y
++OPTION_EGLIBC_BACKTRACE = y
++OPTION_EGLIBC_BIG_MACROS = y
++OPTION_EGLIBC_BSD = y
++OPTION_EGLIBC_CXX_TESTS = y
++OPTION_EGLIBC_CATGETS = y
++OPTION_EGLIBC_CHARSETS = y
++OPTION_EGLIBC_CRYPT = y
++OPTION_EGLIBC_CRYPT_UFC = y
++OPTION_EGLIBC_DB_ALIASES = y
++OPTION_EGLIBC_ENVZ = y
++OPTION_EGLIBC_FCVT = y
++OPTION_EGLIBC_FMTMSG = y
++OPTION_EGLIBC_FSTAB = y
++OPTION_EGLIBC_FTRAVERSE = y
++OPTION_EGLIBC_GETLOGIN = y
++OPTION_EGLIBC_IDN = y
++OPTION_EGLIBC_INET = y
++OPTION_EGLIBC_INET_ANL = y
++OPTION_EGLIBC_LIBM = y
++OPTION_EGLIBC_LOCALES = y
++OPTION_EGLIBC_LOCALE_CODE = y
++OPTION_EGLIBC_MEMUSAGE = y
++OPTION_EGLIBC_NIS = y
++OPTION_EGLIBC_NSSWITCH = y
++OPTION_EGLIBC_RCMD = y
++OPTION_EGLIBC_RTLD_DEBUG = y
++OPTION_EGLIBC_SPAWN = y
++OPTION_EGLIBC_STREAMS = y
++OPTION_EGLIBC_SUNRPC = y
++OPTION_EGLIBC_UTMP = y
++OPTION_EGLIBC_UTMPX = y
++OPTION_EGLIBC_WORDEXP = y
++OPTION_POSIX_C_LANG_WIDE_CHAR = y
++OPTION_POSIX_REGEXP = y
++OPTION_POSIX_REGEXP_GLIBC = y
++OPTION_POSIX_WIDE_CHAR_DEVICE_IO = y
+Index: git/Makefile
+===================================================================
+--- git.orig/Makefile 2014-08-27 07:24:37.540070587 +0000
++++ git/Makefile 2014-08-27 07:24:41.656070587 +0000
+@@ -24,6 +24,7 @@
+
+ include Makeconfig
+
++include options-config/Makefile
+
+ # This is the default target; it makes everything except the tests.
+ .PHONY: all
+Index: git/EGLIBC.option-groups
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/EGLIBC.option-groups 2014-08-27 07:24:41.656070587 +0000
+@@ -0,0 +1,122 @@
++ -*- mode: text -*-
++
++ The EGLIBC Component Configuration System
++ Jim Blandy <jimb@codesourcery.com>
++
++Introduction
++
++The GNU C library (GLIBC) provides a broad range of functionality,
++ranging from internationalization support to transcendental
++mathematical functions. Its website boasts that "nearly all known and
++useful functions from any other C library are available." This
++exhaustive approach has been one of GLIBC's strengths on desktop and
++server systems, but it has also given GLIBC a large footprint, both in
++memory and on disk, making it a challenge to use in embedded systems
++with limited resources.
++
++The Embedded GNU C library (EGLIBC) is a variant of the GNU C library
++designed to work well on embedded systems. In particular, EGLIBC's
++component configuration system allows embedded developers to build
++customized versions of the library that include only the features
++their application uses, reducing its space requirements.
++
++EGLIBC's component configuration system categorizes the library's
++functions into "option groups", and allows you to include or exclude
++option groups individually. Some option groups depend on others;
++EGLIBC tracks these relationships, and ensures that the selected
++configuration yields a functioning library.
++
++
++Consistent and Predictable Behavior
++
++A flexible configuration system is a mixed blessing: if the options
++offered are poorly designed, it can be hard to see which choices will
++have the desired effects, and choices with obscure consequences can
++make debugging difficult. EGLIBC's configuration follows some general
++principles to reduce these risks:
++
++- EGLIBC has a single default configuration for each target
++ architecture.
++
++- In the default configuration, all option groups are enabled, and
++ EGLIBC is upwardly API- and ABI-compatible with GLIBC.
++
++- As much as possible, configurations only affect what functions are
++ present, not how they behave. If the system works with an option
++ group disabled, it will still work with it enabled.
++
++- As much as possible, configurations only select option groups ---
++ they do not describe characteristics of the target architecture.
++
++These rules mean that you have a simple debugging strategy available
++if you suspect that your EGLIBC configuration might be the source of a
++problem: fall back to the default configuration, re-test, and then
++disable option groups one by one, until the problem reappears.
++
++
++The Option Groups
++
++To see the current full list of implemented option groups, refer to the
++file 'option-groups.def' at the top of the source tree, or run
++'make menuconfig' from the top-level build directory.
++
++The POSIX.1-2001 specification includes a suggested partition of all
++the functions in the POSIX C API into option groups: math functions
++like 'sin' and 'cos'; networking functions like 'socket' and
++'connect'; and so on. EGLIBC could use this partitioning as the basis
++for future option groups.
++
++
++Implementation
++
++The EGLIBC component configuration system resembles the approach used
++by the Linux kernel to select device drivers, network protocols, and
++other features. A file named 'option-groups.config' in the top-level
++build directory contains assignments to Make variables, each of which
++enables or disables a particular option group. If the variable's
++value is set to 'y', then the option group is enabled; if it set to
++anything else, the option group is omitted. The file
++'option-groups.defaults', at the top of the source tree, establishes
++default values for all variables; all option groups are enabled by
++default.
++
++For example, the following 'option-groups.config' would omit locale
++data, but include mathematical functions, and everything else:
++
++ OPTION_EGLIBC_LOCALES = n
++ OPTION_EGLIBC_LIBM = y
++
++Like the Linux kernel, EGLIBC supports a similar set of '*config' make
++targets to make it easier to create 'option-groups.config', with all
++dependencies between option groups automatically satisfied. Run
++'make help' to see the list of supported make config targets. For
++example, 'make menuconfig' will update the current config utilising a
++menu based program.
++
++The option group names and their type (boolean, int, hex, string), help
++description, and dependencies with other option groups, are described by
++'option-groups.def' at the top of the source tree, analogous to the
++'Kconfig' files in the Linux kernel.
++
++In general, each option group variable controls whether a given set of
++object files in EGLIBC is compiled and included in the final
++libraries, or omitted from the build.
++
++Each subdirectory's Makefile categorizes its routines, libraries, and
++executables by option group. For example, EGLIBC's 'math/Makefile'
++places the 'libm' library in the OPTION_EGLIBC_LIBM group as follows:
++
++ extra-libs-$(OPTION_EGLIBC_LIBM) := libm
++
++Finally, common code in 'Makerules' cites the value of the variable
++'extra-libs-y', selecting only those libraries that belong to enabled
++option groups to be built.
++
++
++Current Status and Future Directions
++
++The EGLIBC component configuration system described here is still
++under development.
++
++We have used the system to subset some portions of EGLIBC's
++Index: libc/configure.ac
+Index: git/configure.ac
+===================================================================
+--- git.orig/configure.ac 2014-08-27 07:24:41.196070587 +0000
++++ git/configure.ac 2014-08-27 07:24:41.656070587 +0000
+@@ -127,6 +127,16 @@
+ [sysheaders=''])
+ AC_SUBST(sysheaders)
+
++AC_ARG_WITH([kconfig],
++ AC_HELP_STRING([--with-kconfig=PATH],
++ [location of kconfig tools to use (from Linux
++ kernel builds) to re-use for configuring EGLIBC
++ option groups]),
++ [KCONFIG_TOOLS=$withval],
++ [KCONFIG_TOOLS=''])
++AC_SUBST(KCONFIG_TOOLS)
++
++
+ AC_SUBST(use_default_link)
+ AC_ARG_WITH([default-link],
+ AC_HELP_STRING([--with-default-link],
+Index: git/config.make.in
+===================================================================
+--- git.orig/config.make.in 2014-08-27 07:24:37.560070587 +0000
++++ git/config.make.in 2014-08-27 07:24:41.656070587 +0000
+@@ -46,6 +46,8 @@
+ c++-sysincludes = @CXX_SYSINCLUDES@
+ all-warnings = @all_warnings@
+
++kconfig_tools = @KCONFIG_TOOLS@
++
+ have-z-combreloc = @libc_cv_z_combreloc@
+ have-z-execstack = @libc_cv_z_execstack@
+ have-Bgroup = @libc_cv_Bgroup@
+Index: git/configure
+===================================================================
+--- git.orig/configure 2014-08-27 07:24:41.192070587 +0000
++++ git/configure 2014-08-27 07:24:41.660070587 +0000
+@@ -619,6 +619,7 @@
+ PERL
+ BASH_SHELL
+ libc_cv_gcc_static_libgcc
++KCONFIG_TOOLS
+ CXX_SYSINCLUDES
+ SYSINCLUDES
+ AUTOCONF
+@@ -733,6 +734,7 @@
+ with_binutils
+ with_selinux
+ with_headers
++with_kconfig
+ with_default_link
+ enable_sanity_checks
+ enable_shared
+@@ -1437,6 +1439,9 @@
+ --with-selinux if building with SELinux support
+ --with-headers=PATH location of system headers to use (for example
+ /usr/src/linux/include) [default=compiler default]
++ --with-kconfig=PATH location of kconfig tools to use (from Linux kernel
++ builds) to re-use for configuring EGLIBC option
++ groups
+ --with-default-link do not use explicit linker scripts
+ --with-cpu=CPU select code for CPU variant
+
+@@ -3400,6 +3405,14 @@
+
+
+
++# Check whether --with-kconfig was given.
++if test "${with_kconfig+set}" = set; then
++ withval=$with_kconfig; KCONFIG_TOOLS=$withval
++else
++ KCONFIG_TOOLS=''
++fi
++
++
+
+ # Check whether --with-default-link was given.
+ if test "${with_default_link+set}" = set; then :
+Index: git/options-config/Makefile
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/options-config/Makefile 2014-08-27 07:24:41.652070587 +0000
+@@ -0,0 +1,55 @@
++# ===========================================================================
++# EGLIBC option-groups configuration targets
++# These targets are included from top-level makefile
++
++ifneq ($(kconfig_tools),)
++ifneq (no,$(PERL))
++
++ocdir := options-config
++
++OconfigDefaults := option-groups.defaults
++OconfigDefaults_tmp := $(common-objpfx).tmp.defconfig
++OconfigDef := option-groups.def
++Oconfig := $(common-objpfx)option-groups.config
++Oconfig_tmp := $(common-objpfx).tmp.config
++
++conf := $(kconfig_tools)/conf
++mconf := $(kconfig_tools)/mconf
++
++preproc := $(PERL) $(ocdir)/config-preproc.pl
++postproc := $(PERL) $(ocdir)/config-postproc.pl
++
++PHONY += defconfig config menuconfig
++
++defconfig: $(conf) $(OconfigDefaults) $(OconfigDef)
++ rm -f $(OconfigDefaults_tmp)
++ rm -f $(Oconfig_tmp)
++ $(preproc) $(OconfigDefaults) > $(OconfigDefaults_tmp)
++ KCONFIG_CONFIG=$(Oconfig_tmp) $< --defconfig=$(OconfigDefaults_tmp) \
++ $(OconfigDef)
++ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig)
++ rm $(Oconfig_tmp)
++ rm $(OconfigDefaults_tmp)
++
++config: $(conf) $(OconfigDefaults) $(OconfigDef)
++ rm -f $(Oconfig_tmp)
++ $(preproc) $(wildcard $(Oconfig)) > $(Oconfig_tmp)
++ KCONFIG_CONFIG=$(Oconfig_tmp) $< --oldaskconfig $(OconfigDef)
++ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig)
++ rm $(Oconfig_tmp)
++
++menuconfig: $(mconf) $(OconfigDefaults) $(OconfigDef)
++ rm -f $(Oconfig_tmp)
++ $(preproc) $(wildcard $(Oconfig)) > $(Oconfig_tmp)
++ KCONFIG_CONFIG=$(Oconfig_tmp) $< $(OconfigDef)
++ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig)
++ rm $(Oconfig_tmp)
++
++# Help text used by make help
++help:
++ @echo ' defconfig - New config with default from default config'
++ @echo ' config - Update current config utilising a line-oriented program'
++ @echo ' menuconfig - Update current config utilising a menu based program'
++
++endif
++endif
+Index: git/options-config/config-postproc.pl
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/options-config/config-postproc.pl 2014-08-27 07:24:41.652070587 +0000
+@@ -0,0 +1,58 @@
++#!/usr/bin/perl
++
++$usage = "usage: $0 <default config file> <config file>\n";
++
++die "$usage" unless @ARGV;
++$defaults = shift @ARGV;
++die "$usage" unless @ARGV;
++die "Could not open $ARGV[0]" unless -T $ARGV[0];
++
++sub yank {
++ @option = grep(!($_ =~ /$_[0]\s*=/), @option);
++}
++
++open(DEFAULTS, $defaults) || die "Could not open $defaults\n";
++
++# get the full list of available options using the default config file
++$i = 0;
++while (<DEFAULTS>) {
++ if (/^\s*OPTION_(\w+\s*=.*$)/) {
++ $option[$i++] = $1;
++ }
++}
++
++# now go through the config file, making the necessary changes
++while (<>) {
++ if (/Linux Kernel Configuration/) {
++ # change title
++ s/Linux Kernel/Option Groups/;
++ print;
++ } elsif (/^\s*CONFIG_(\w+)\s*=/) {
++ # this is an explicit option set line, change CONFIG_ to OPTION_
++ # before printing and remove this option from option list
++ $opt = $1;
++ yank($opt);
++ s/CONFIG_/OPTION_/g;
++ print;
++ } elsif (/^\s*#\s+CONFIG_(\w+) is not set/) {
++ # this is a comment line for an unset boolean option, change CONFIG_
++ # to OPTION_, remove this option from option list, and convert to
++ # explicit OPTION_FOO=n
++ $opt = $1;
++ yank($opt);
++ s/CONFIG_/OPTION_/g;
++ print "OPTION_$opt=n\n";
++ } else {
++ print;
++ }
++}
++
++# any boolean options left in @options, are options that were not mentioned in
++# the config file, and implicitly that means the option must be set =n,
++# so do that here.
++foreach $opt (@option) {
++ if ($opt =~ /=\s*[yn]/) {
++ $opt =~ s/=\s*[yn]/=n/;
++ print "OPTION_$opt\n";
++ }
++}
+Index: git/options-config/config-preproc.pl
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/options-config/config-preproc.pl 2014-08-27 07:24:41.652070587 +0000
+@@ -0,0 +1,8 @@
++#!/usr/bin/perl
++
++if (@ARGV) {
++ while (<>) {
++ s/OPTION_/CONFIG_/g;
++ print;
++ }
++}
+Index: git/scripts/option-groups.awk
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/scripts/option-groups.awk 2014-08-27 07:26:51.652070587 +0000
+@@ -0,0 +1,63 @@
++# option-groups.awk --- generate option group header file
++# Given input files containing makefile-style assignments to variables,
++# print out a header file that #defines an appropriate preprocessor
++# symbol for each variable left set to 'y'.
++
++BEGIN { FS="=" }
++
++# Trim spaces.
++{ gsub (/[[:blank:]]/, "") }
++
++# Skip comments.
++/^#/ { next }
++
++# Process assignments.
++NF == 2 {
++ vars[$1] = $2
++}
++
++# Print final values.
++END {
++ print "/* This file is automatically generated by scripts/option-groups.awk"
++ print " in the EGLIBC source tree."
++ print ""
++ print " It defines macros that indicate which EGLIBC option groups were"
++ print " configured in 'option-groups.config' when this C library was"
++ print " built. For each option group named OPTION_foo, it #defines"
++ print " __OPTION_foo to be 1 if the group is enabled, or #defines that"
++ print " symbol to be 0 if the group is disabled. */"
++ print ""
++ print "#ifndef __GNU_OPTION_GROUPS_H"
++ print "#define __GNU_OPTION_GROUPS_H"
++ print ""
++
++ # Produce a sorted list of variable names.
++ i=0
++ for (var in vars)
++ names[i++] = var
++ n = asort (names)
++
++ for (i = 1; i <= n; i++)
++ {
++ var = names[i]
++ if (var ~ /^OPTION_/)
++ {
++ if (vars[var] == "y")
++ print "#define __" var " 1"
++ else if (vars[var] == "n")
++ print "#define __" var " 0"
++ else if (vars[var] ~ /^[0-9]+/ ||
++ vars[var] ~ /^0x[0-9aAbBcCdDeEfF]+/ ||
++ vars[var] ~ /^\"/)
++ print "#define __" var " " vars[var]
++ else
++ print "/* #undef __" var " */"
++ # Ignore variables that don't have boolean, int, hex, or
++ # string values. Ideally, this would be driven by the types
++ # given in option-groups.def.
++ }
++ }
++
++ print ""
++ print "#endif /* __GNU_OPTION_GROUPS_H */"
++}
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/ppc-sqrt_finite.patch b/meta/recipes-core/glibc/glibc/ppc-sqrt_finite.patch
index 6ea666b1d6..6ea666b1d6 100644
--- a/meta/recipes-core/eglibc/eglibc-2.19/ppc-sqrt_finite.patch
+++ b/meta/recipes-core/glibc/glibc/ppc-sqrt_finite.patch
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/ppc_slow_ieee754_sqrt.patch b/meta/recipes-core/glibc/glibc/ppc_slow_ieee754_sqrt.patch
index 60532cbd03..5b819bc458 100644
--- a/meta/recipes-core/eglibc/eglibc-2.19/ppc_slow_ieee754_sqrt.patch
+++ b/meta/recipes-core/glibc/glibc/ppc_slow_ieee754_sqrt.patch
@@ -3,11 +3,11 @@
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Pending
-Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
+Index: git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
===================================================================
---- libc.orig/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
-+++ libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
-@@ -40,7 +40,7 @@ static const float half = 0.5;
+--- git.orig/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c 2014-08-29 10:35:02.616070587 -0700
++++ git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c 2014-08-29 10:35:02.604070587 -0700
+@@ -40,7 +40,7 @@
simultaneously. */
double
@@ -16,8 +16,8 @@ Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
{
if (__builtin_expect (b > 0, 1))
{
-@@ -77,7 +77,7 @@ __ieee754_sqrt (double b)
-
+@@ -77,7 +77,7 @@
+
/* Handle small numbers by scaling. */
if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
- return __ieee754_sqrt (b * two108) * twom54;
@@ -25,7 +25,7 @@ Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
#define FMADD(a_, c_, b_) \
({ double __r; \
-@@ -126,4 +126,12 @@ __ieee754_sqrt (double b)
+@@ -126,4 +126,12 @@
}
return f_wash (b);
}
@@ -38,11 +38,11 @@ Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
+}
+
strong_alias (__ieee754_sqrt, __sqrt_finite)
-Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
+Index: git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
===================================================================
---- libc.orig/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
-+++ libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
-@@ -38,7 +38,7 @@ static const float threehalf = 1.5;
+--- git.orig/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c 2014-08-29 10:35:02.616070587 -0700
++++ git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c 2014-08-29 10:35:02.604070587 -0700
+@@ -38,7 +38,7 @@
square root. */
float
@@ -51,7 +51,7 @@ Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
{
if (__builtin_expect (b > 0, 1))
{
-@@ -93,4 +93,10 @@ __ieee754_sqrtf (float b)
+@@ -93,4 +93,10 @@
}
return f_washf (b);
}
@@ -62,11 +62,11 @@ Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
+ return __slow_ieee754_sqrtf (x);
+}
strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
+Index: git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
===================================================================
---- libc.orig/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
-+++ libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
-@@ -40,7 +40,7 @@ static const float half = 0.5;
+--- git.orig/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c 2014-08-29 10:35:02.616070587 -0700
++++ git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c 2014-08-29 10:35:02.604070587 -0700
+@@ -40,7 +40,7 @@
simultaneously. */
double
@@ -75,8 +75,8 @@ Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
{
if (__builtin_expect (b > 0, 1))
{
-@@ -77,7 +77,7 @@ __ieee754_sqrt (double b)
-
+@@ -77,7 +77,7 @@
+
/* Handle small numbers by scaling. */
if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
- return __ieee754_sqrt (b * two108) * twom54;
@@ -84,7 +84,7 @@ Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
#define FMADD(a_, c_, b_) \
({ double __r; \
-@@ -126,4 +126,12 @@ __ieee754_sqrt (double b)
+@@ -126,4 +126,12 @@
}
return f_wash (b);
}
@@ -97,11 +97,11 @@ Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
+}
+
strong_alias (__ieee754_sqrt, __sqrt_finite)
-Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
+Index: git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
===================================================================
---- libc.orig/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
-+++ libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
-@@ -38,7 +38,7 @@ static const float threehalf = 1.5;
+--- git.orig/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c 2014-08-29 10:35:02.616070587 -0700
++++ git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c 2014-08-29 10:35:02.604070587 -0700
+@@ -38,7 +38,7 @@
square root. */
float
@@ -110,7 +110,7 @@ Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
{
if (__builtin_expect (b > 0, 1))
{
-@@ -93,4 +93,11 @@ __ieee754_sqrtf (float b)
+@@ -93,4 +93,11 @@
}
return f_washf (b);
}
@@ -122,11 +122,11 @@ Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
+}
+
strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
+Index: git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
===================================================================
---- libc.orig/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
-+++ libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
-@@ -41,10 +41,10 @@ static const float half = 0.5;
+--- git.orig/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c 2014-08-29 10:35:02.616070587 -0700
++++ git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c 2014-08-29 10:35:02.604070587 -0700
+@@ -41,10 +41,10 @@
#ifdef __STDC__
double
@@ -139,8 +139,8 @@ Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
double b;
#endif
{
-@@ -83,7 +83,7 @@ __ieee754_sqrt (b)
-
+@@ -83,7 +83,7 @@
+
/* Handle small numbers by scaling. */
if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
- return __ieee754_sqrt (b * two108) * twom54;
@@ -148,7 +148,7 @@ Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
#define FMADD(a_, c_, b_) \
({ double __r; \
-@@ -132,4 +132,12 @@ __ieee754_sqrt (b)
+@@ -132,4 +132,12 @@
}
return f_wash (b);
}
@@ -161,11 +161,11 @@ Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
+}
+
strong_alias (__ieee754_sqrt, __sqrt_finite)
-Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
+Index: git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
===================================================================
---- libc.orig/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
-+++ libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
-@@ -39,10 +39,10 @@ static const float threehalf = 1.5;
+--- git.orig/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c 2014-08-29 10:35:02.616070587 -0700
++++ git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c 2014-08-29 10:35:02.604070587 -0700
+@@ -39,10 +39,10 @@
#ifdef __STDC__
float
@@ -178,7 +178,7 @@ Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
float b;
#endif
{
-@@ -99,4 +99,12 @@ __ieee754_sqrtf (b)
+@@ -99,4 +99,12 @@
}
return f_washf (b);
}
@@ -191,11 +191,11 @@ Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
+}
+
strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
+Index: git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
===================================================================
---- libc.orig/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
-+++ libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
-@@ -41,10 +41,10 @@ static const float half = 0.5;
+--- git.orig/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c 2014-08-29 10:35:02.616070587 -0700
++++ git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c 2014-08-29 10:35:02.608070587 -0700
+@@ -41,10 +41,10 @@
#ifdef __STDC__
double
@@ -208,8 +208,8 @@ Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
double b;
#endif
{
-@@ -83,7 +83,7 @@ __ieee754_sqrt (b)
-
+@@ -83,7 +83,7 @@
+
/* Handle small numbers by scaling. */
if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
- return __ieee754_sqrt (b * two108) * twom54;
@@ -217,7 +217,7 @@ Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
#define FMADD(a_, c_, b_) \
({ double __r; \
-@@ -132,4 +132,12 @@ __ieee754_sqrt (b)
+@@ -132,4 +132,12 @@
}
return f_wash (b);
}
@@ -230,11 +230,11 @@ Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
+}
+
strong_alias (__ieee754_sqrt, __sqrt_finite)
-Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
+Index: git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
===================================================================
---- libc.orig/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
-+++ libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
-@@ -39,10 +39,10 @@ static const float threehalf = 1.5;
+--- git.orig/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c 2014-08-29 10:35:02.616070587 -0700
++++ git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c 2014-08-29 10:35:02.608070587 -0700
+@@ -39,10 +39,10 @@
#ifdef __STDC__
float
@@ -247,7 +247,7 @@ Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
float b;
#endif
{
-@@ -99,4 +99,12 @@ __ieee754_sqrtf (b)
+@@ -99,4 +99,12 @@
}
return f_washf (b);
}
@@ -260,11 +260,11 @@ Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
+}
+
strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
+Index: git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
===================================================================
---- libc.orig/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
-+++ libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
-@@ -41,10 +41,10 @@ static const float half = 0.5;
+--- git.orig/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c 2014-08-29 10:35:02.616070587 -0700
++++ git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c 2014-08-29 10:35:02.608070587 -0700
+@@ -41,10 +41,10 @@
#ifdef __STDC__
double
@@ -277,8 +277,8 @@ Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
double b;
#endif
{
-@@ -83,7 +83,7 @@ __ieee754_sqrt (b)
-
+@@ -83,7 +83,7 @@
+
/* Handle small numbers by scaling. */
if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
- return __ieee754_sqrt (b * two108) * twom54;
@@ -286,7 +286,7 @@ Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
#define FMADD(a_, c_, b_) \
({ double __r; \
-@@ -132,4 +132,12 @@ __ieee754_sqrt (b)
+@@ -132,4 +132,12 @@
}
return f_wash (b);
}
@@ -299,11 +299,11 @@ Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
+}
+
strong_alias (__ieee754_sqrt, __sqrt_finite)
-Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
+Index: git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
===================================================================
---- libc.orig/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
-+++ libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
-@@ -39,10 +39,10 @@ static const float threehalf = 1.5;
+--- git.orig/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c 2014-08-29 10:35:02.616070587 -0700
++++ git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c 2014-08-29 10:35:02.608070587 -0700
+@@ -39,10 +39,10 @@
#ifdef __STDC__
float
@@ -316,7 +316,7 @@ Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
float b;
#endif
{
-@@ -99,4 +99,12 @@ __ieee754_sqrtf (b)
+@@ -99,4 +99,12 @@
}
return f_washf (b);
}
@@ -329,11 +329,11 @@ Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
+}
+
strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-Index: libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
+Index: git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
===================================================================
---- libc.orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-+++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-@@ -132,4 +132,12 @@ __ieee754_sqrt (b)
+--- git.orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c 2014-08-29 10:35:02.616070587 -0700
++++ git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c 2014-08-29 10:35:02.608070587 -0700
+@@ -132,4 +132,12 @@
}
return f_wash (b);
}
@@ -346,11 +346,11 @@ Index: libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
+}
+
strong_alias (__ieee754_sqrt, __sqrt_finite)
-Index: libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
+Index: git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
===================================================================
---- libc.orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
-+++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
-@@ -99,4 +99,12 @@ __ieee754_sqrtf (b)
+--- git.orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c 2014-08-29 10:35:02.616070587 -0700
++++ git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c 2014-08-29 10:35:02.608070587 -0700
+@@ -99,4 +99,12 @@
}
return f_washf (b);
}
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/ppce6500-32b_slow_ieee754_sqrt.patch b/meta/recipes-core/glibc/glibc/ppce6500-32b_slow_ieee754_sqrt.patch
index 4c6c1070c3..4c6c1070c3 100644
--- a/meta/recipes-core/eglibc/eglibc-2.19/ppce6500-32b_slow_ieee754_sqrt.patch
+++ b/meta/recipes-core/glibc/glibc/ppce6500-32b_slow_ieee754_sqrt.patch
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/relocatable_sdk.patch b/meta/recipes-core/glibc/glibc/relocatable_sdk.patch
index ca5f17ba58..ca5f17ba58 100644
--- a/meta/recipes-core/eglibc/eglibc-2.19/relocatable_sdk.patch
+++ b/meta/recipes-core/glibc/glibc/relocatable_sdk.patch
diff --git a/meta/recipes-core/eglibc/eglibc-2.19/relocatable_sdk_fix_openpath.patch b/meta/recipes-core/glibc/glibc/relocatable_sdk_fix_openpath.patch
index f164f8f9ae..f164f8f9ae 100644
--- a/meta/recipes-core/eglibc/eglibc-2.19/relocatable_sdk_fix_openpath.patch
+++ b/meta/recipes-core/glibc/glibc/relocatable_sdk_fix_openpath.patch
diff --git a/meta/recipes-core/glibc/glibc/timezone-re-written-tzselect-as-posix-sh.patch b/meta/recipes-core/glibc/glibc/timezone-re-written-tzselect-as-posix-sh.patch
new file mode 100644
index 0000000000..55547deae7
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/timezone-re-written-tzselect-as-posix-sh.patch
@@ -0,0 +1,38 @@
+timezone: re-written tzselect as posix sh
+
+To avoid the bash dependency.
+
+Upstream-Status: Pending
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ timezone/Makefile | 2 +-
+ timezone/tzselect.ksh | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+Index: git/timezone/Makefile
+===================================================================
+--- git.orig/timezone/Makefile 2014-08-27 05:35:58.008070587 +0000
++++ git/timezone/Makefile 2014-08-27 05:36:37.908070587 +0000
+@@ -114,7 +114,7 @@
+
+
+ $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
+- sed -e 's|/bin/bash|$(BASH)|' \
++ sed -e 's|/bin/bash|/bin/sh|' \
+ -e 's|TZDIR=[^}]*|TZDIR=$(zonedir)|' \
+ -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \
+ -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \
+Index: git/timezone/tzselect.ksh
+===================================================================
+--- git.orig/timezone/tzselect.ksh 2014-08-27 05:35:58.008070587 +0000
++++ git/timezone/tzselect.ksh 2014-08-27 05:35:58.000070587 +0000
+@@ -35,7 +35,7 @@
+
+ # Specify default values for environment variables if they are unset.
+ : ${AWK=awk}
+-: ${TZDIR=`pwd`}
++: ${TZDIR=$(pwd)}
+
+ # Check for awk Posix compliance.
+ ($AWK -v x=y 'BEGIN { exit 123 }') </dev/null >/dev/null 2>&1
diff --git a/meta/recipes-core/eglibc/eglibc_2.19.bb b/meta/recipes-core/glibc/glibc_2.21.bb
index 10b4bb1a7f..91feff58ce 100644
--- a/meta/recipes-core/eglibc/eglibc_2.19.bb
+++ b/meta/recipes-core/glibc/glibc_2.21.bb
@@ -1,9 +1,12 @@
-require eglibc.inc
+require glibc.inc
DEPENDS += "gperf-native kconfig-frontends-native"
-SRC_URI = "http://downloads.yoctoproject.org/releases/eglibc/eglibc-${PV}-svnr25243.tar.bz2 \
- file://eglibc-svn-arm-lowlevellock-include-tls.patch \
+SRCREV = "4e42b5b8f89f0e288e68be7ad70f9525aebc2cff"
+
+BRANCH = "release/${PV}/master"
+
+SRC_URI = "git://sourceware.org/git/glibc.git;branch=${BRANCH} \
file://IO-acquire-lock-fix.patch \
file://mips-rld-map-check.patch \
file://etc/ld.so.conf \
@@ -11,24 +14,33 @@ SRC_URI = "http://downloads.yoctoproject.org/releases/eglibc/eglibc-${PV}-svnr25
file://glibc.fix_sqrt2.patch \
file://multilib_readlib.patch \
file://ppc-sqrt_finite.patch \
- file://GLRO_dl_debug_mask.patch \
- file://initgroups_keys.patch \
- file://eglibc_fix_findidx_parameters.patch \
file://ppc_slow_ieee754_sqrt.patch \
- file://fileops-without-wchar-io.patch \
file://add_resource_h_to_wait_h.patch \
- file://0001-eglibc-menuconfig-support.patch \
- file://0002-eglibc-menuconfig-hex-string-options.patch \
- file://0003-eglibc-menuconfig-build-instructions.patch \
- file://fsl-ppc-no-fsqrt.patch \
file://0001-R_ARM_TLS_DTPOFF32.patch \
file://0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch \
file://fix-tibetian-locales.patch \
file://ppce6500-32b_slow_ieee754_sqrt.patch \
file://grok_gold.patch \
+ file://fix_am_rootsbindir.patch \
+ file://0001-Add-unused-attribute.patch \
+ file://0001-When-disabling-SSE-also-make-sure-that-fpmath-is-not.patch \
+ file://0001-yes-within-the-path-sets-wrong-config-variables.patch \
+ ${EGLIBCPATCHES} \
+ "
+EGLIBCPATCHES = "\
+ file://timezone-re-written-tzselect-as-posix-sh.patch \
+ file://eglibc.patch \
+ file://option-groups.patch \
+ file://GLRO_dl_debug_mask.patch \
+ file://eglibc-header-bootstrap.patch \
+ file://eglibc-resolv-dynamic.patch \
+ file://eglibc-ppc8xx-cache-line-workaround.patch \
+ file://eglibc-sh4-fpscr_values.patch \
+ file://eglibc-use-option-groups.patch \
"
-SRC_URI[md5sum] = "197836c2ba42fb146e971222647198dd"
-SRC_URI[sha256sum] = "baaa030531fc308f7820c46acdf8e1b2f8e3c1f40bcd28b6e440d1c95d170d4c"
+# file://eglibc-install-pic-archives.patch \
+# file://initgroups_keys.patch \
+#
LIC_FILES_CHKSUM = "file://LICENSES;md5=e9a558e243b36d3209f380deb394b213 \
file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
@@ -39,7 +51,7 @@ SRC_URI_append_class-nativesdk = " file://ld-search-order.patch \
file://relocatable_sdk.patch \
file://relocatable_sdk_fix_openpath.patch \
"
-S = "${WORKDIR}/eglibc-${PV}/libc"
+S = "${WORKDIR}/git"
B = "${WORKDIR}/build-${TARGET_SYS}"
PACKAGES_DYNAMIC = ""
@@ -51,23 +63,17 @@ TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}"
GLIBC_BROKEN_LOCALES = " _ER _ET so_ET yn_ER sid_ET tr_TR mn_MN gez_ET gez_ER bn_BD te_IN es_CR.ISO-8859-1"
#
-# For now, we will skip building of a gcc package if it is a uclibc one
-# and our build is not a uclibc one, and we skip a glibc one if our build
-# is a uclibc build.
-#
-# See the note in gcc/gcc_3.4.0.oe
+# We will skip parsing glibc when system C library selection is not glibc
+# this helps in easing out parsing for non-glibc system libraries
#
-
python __anonymous () {
import re
- uc_os = (re.match('.*uclibc$', d.getVar('TARGET_OS', True)) != None)
- if uc_os:
+ notglibc = (re.match('.*uclibc$', d.getVar('TARGET_OS', True)) != None) or (re.match('.*musl$', d.getVar('TARGET_OS', True)) != None)
+ if notglibc:
raise bb.parse.SkipPackage("incompatible with target %s" %
d.getVar('TARGET_OS', True))
}
-export libc_cv_slibdir = "${base_libdir}"
-
EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \
--without-cvs --disable-profile \
--disable-debug --without-gd \
@@ -77,15 +83,18 @@ EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \
--without-selinux \
--enable-obsolete-rpc \
--with-kconfig=${STAGING_BINDIR_NATIVE} \
+ --disable-nscd \
${GLIBC_EXTRA_OECONF}"
EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}"
+EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'libc-inet-anl', '--enable-nscd', '--disable-nscd', d)}"
+
do_patch_append() {
bb.build.exec_func('do_fix_readlib_c', d)
}
-# for mips eglibc now builds syscall tables for all abi's
+# for mips glibc now builds syscall tables for all abi's
# so we make sure that we choose right march option which is
# compatible with o32,n32 and n64 abi's
# e.g. -march=mips32 is not compatible with n32 and n64 therefore
@@ -140,6 +149,6 @@ do_compile () {
}
-require eglibc-package.inc
+require glibc-package.inc
BBCLASSEXTEND = "nativesdk"
diff --git a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/32and64bit.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/32and64bit.patch
index cdfeaeadd8..cdfeaeadd8 100644
--- a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/32and64bit.patch
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/32and64bit.patch
diff --git a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/README b/meta/recipes-core/glibc/ldconfig-native-2.12.1/README
index 43fb983729..43fb983729 100644
--- a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/README
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/README
diff --git a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling.patch
index 7f8e4db78a..7f8e4db78a 100644
--- a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling.patch
diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling_fix.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling_fix.patch
new file mode 100644
index 0000000000..6aecfe5268
--- /dev/null
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling_fix.patch
@@ -0,0 +1,47 @@
+Upstream-Status: Inappropriate [embedded specific]
+
+Fix problem during parsing of ELF headers for 64bit on big-endian.
+Some header fields were read with wrong size.
+
+2014/10/24
+Par Olsson <Par.Olsson@windriver.com>
+Shan Hai <shan.hai@windriver.com>
+
+diff --git a/readelflib.c b/readelflib.c
+index 3f5b25b..0bf0de3 100644
+--- a/readelflib.c
++++ b/readelflib.c
+@@ -261,8 +261,8 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag,
+ int i;
+ unsigned int j;
+ Elf64_Addr loadaddr;
+- unsigned int dynamic_addr;
+- size_t dynamic_size;
++ Elf64_Addr dynamic_addr;
++ Elf64_Xword dynamic_size;
+ char *program_interpreter;
+
+ Elf64_Ehdr *elf_header;
+@@ -311,7 +311,7 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag,
+ error (0, 0, _("more than one dynamic segment\n"));
+
+ dynamic_addr = read64(segment->p_offset, be);
+- dynamic_size = read32(segment->p_filesz, be);
++ dynamic_size = read64(segment->p_filesz, be);
+ break;
+
+ case PT_INTERP:
+@@ -329,11 +329,11 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag,
+ break;
+
+ case PT_NOTE:
+- if (!*osversion && read32(segment->p_filesz, be) >= 32 && read32(segment->p_align, be) >= 4)
++ if (!*osversion && read64(segment->p_filesz, be) >= 32 && read64(segment->p_align, be) >= 4)
+ {
+ Elf64_Word *abi_note = (Elf64_Word *) (file_contents
+ + read64(segment->p_offset, be));
+- Elf64_Addr size = read32(segment->p_filesz, be);
++ Elf64_Xword size = read64(segment->p_filesz, be);
+
+ while (read32(abi_note [0], be) != 4 || read32(abi_note [1], be) != 16
+ || read32(abi_note [2], be) != 1
diff --git a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/endianess-header.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/endianess-header.patch
index a18b2c20de..a18b2c20de 100644
--- a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/endianess-header.patch
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/endianess-header.patch
diff --git a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/flag_fix.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/flag_fix.patch
index 4e9aab9416..4e9aab9416 100644
--- a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/flag_fix.patch
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/flag_fix.patch
diff --git a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch
index 5ed4f6ff69..5ed4f6ff69 100644
--- a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch
diff --git a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2 b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2
index dc1e79888e..dc1e79888e 100644
--- a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2
Binary files differ
diff --git a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig.patch
index 52986e61c7..52986e61c7 100644
--- a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig.patch
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig.patch
diff --git a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch
index 27bc411078..27bc411078 100644
--- a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch
diff --git a/meta/recipes-core/eglibc/ldconfig-native_2.12.1.bb b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
index 7c3463589b..1debf8ee2f 100644
--- a/meta/recipes-core/eglibc/ldconfig-native_2.12.1.bb
+++ b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
@@ -12,6 +12,7 @@ SRC_URI = "file://ldconfig-native-2.12.1.tar.bz2 \
file://flag_fix.patch \
file://endianess-header.patch \
file://ldconfig-default-to-all-multilib-dirs.patch \
+ file://endian-ness_handling_fix.patch \
"
PR = "r2"
diff --git a/meta/recipes-core/eglibc/site_config/funcs b/meta/recipes-core/glibc/site_config/funcs
index ccc85392d7..ccc85392d7 100644
--- a/meta/recipes-core/eglibc/site_config/funcs
+++ b/meta/recipes-core/glibc/site_config/funcs
diff --git a/meta/recipes-core/eglibc/site_config/headers b/meta/recipes-core/glibc/site_config/headers
index 609ab53797..609ab53797 100644
--- a/meta/recipes-core/eglibc/site_config/headers
+++ b/meta/recipes-core/glibc/site_config/headers
diff --git a/meta/recipes-core/eglibc/site_config/types b/meta/recipes-core/glibc/site_config/types
index 178bd85a00..178bd85a00 100644
--- a/meta/recipes-core/eglibc/site_config/types
+++ b/meta/recipes-core/glibc/site_config/types
diff --git a/meta/recipes-core/images/build-appliance-image/Yocto_Build_Appliance.vmx b/meta/recipes-core/images/build-appliance-image/Yocto_Build_Appliance.vmx
index b04a1b6a73..6472e87509 100644
--- a/meta/recipes-core/images/build-appliance-image/Yocto_Build_Appliance.vmx
+++ b/meta/recipes-core/images/build-appliance-image/Yocto_Build_Appliance.vmx
@@ -1,17 +1,23 @@
.encoding = "UTF-8"
-displayname = "Yocto Build Appliance"
-guestos = "other"
-tools.syncTime = "FALSE"
-virtualhw.version = "8"
config.version = "8"
+virtualHW.version = "10"
numvcpus = "2"
-cpuid.coresPerSocket = "1"
vcpu.hotadd = "TRUE"
-mem.hotadd = "TRUE"
memsize = "4096"
-svga.autodetect = "TRUE"
+mem.hotadd = "TRUE"
+sata0.present = "TRUE"
+sata0:0.present = "TRUE"
+sata0:0.fileName = "Yocto_Build_Appliance.vmdk"
+ethernet0.present = "TRUE"
+ethernet0.virtualDev = "e1000"
+ethernet0.wakeOnPcktRcv = "FALSE"
+ethernet0.addressType = "generated"
+usb.present = "TRUE"
+ehci.pciSlotNumber = "0"
+sound.present = "TRUE"
+sound.fileName = "-1"
+sound.autodetect = "TRUE"
pciBridge0.present = "TRUE"
-mks.enable3d = "TRUE"
pciBridge4.present = "TRUE"
pciBridge4.virtualDev = "pcieRootPort"
pciBridge4.functions = "8"
@@ -25,28 +31,16 @@ pciBridge7.present = "TRUE"
pciBridge7.virtualDev = "pcieRootPort"
pciBridge7.functions = "8"
vmci0.present = "TRUE"
-floppy0.present = "TRUE"
-floppy0.fileType = "device"
-floppy0.autodetect = "FALSE"
-floppy0.startConnected = "FALSE"
-ide1:0.present = "TRUE"
-ide1:0.deviceType = "atapi-cdrom"
-ide1:0.autodetect = "TRUE"
-ide1:0.startConnected = "FALSE"
-ide0:0.present = "TRUE"
-ide0:0.deviceType = "disk"
-ide0:0.fileName = "Yocto_Build_Appliance.vmdk"
-usb.present = "TRUE"
-scsi0.virtualDev = "lsilogic"
-scsi0.present = "TRUE"
-ethernet0.present = "TRUE"
-ethernet0.virtualDev = "e1000"
-ethernet0.connectionType = "bridged"
-ethernet0.startConnected = "TRUE"
-ethernet0.addressType = "generated"
-sound.present = "TRUE"
-sound.virtualDev = "es1371"
-sound.autodetect = "TRUE"
-extendedConfigFile = "Yocto_Build_Appliance.vmxf"
-sound.fileName = "-1"
+hpet0.present = "TRUE"
+usb.vbluetooth.startConnected = "TRUE"
+displayName = "Yocto Build Appliance"
+guestOS = "other3xlinux-64"
virtualHW.productCompatibility = "hosted"
+gui.exitOnCLIHLT = "FALSE"
+powerType.powerOff = "soft"
+powerType.powerOn = "soft"
+powerType.suspend = "soft"
+powerType.reset = "soft"
+extendedConfigFile = "Yocto_Build_Appliance.vmxf"
+scsi0:0.present = "FALSE"
+floppy0.present = "FALSE"
diff --git a/meta/recipes-core/images/build-appliance-image/Yocto_Build_Appliance.vmxf b/meta/recipes-core/images/build-appliance-image/Yocto_Build_Appliance.vmxf
index ca3f0264d6..9e941ff2f3 100644
--- a/meta/recipes-core/images/build-appliance-image/Yocto_Build_Appliance.vmxf
+++ b/meta/recipes-core/images/build-appliance-image/Yocto_Build_Appliance.vmxf
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<Foundry>
<VM>
-<VMId type="string">52 e4 0b df 7b 70 21 f8-88 56 a7 26 47 43 95 93</VMId>
+<VMId type="string">52 a5 d8 cb ed 6c 85 48-cd 99 68 af cc 30 a0 98</VMId>
<ClientMetaData>
<clientMetaDataAttributes/>
<HistoryEventList/></ClientMetaData>
diff --git a/meta/recipes-core/images/build-appliance-image_8.0.bb b/meta/recipes-core/images/build-appliance-image_12.0.1.bb
index 2259027136..6d48a65e23 100644
--- a/meta/recipes-core/images/build-appliance-image_8.0.bb
+++ b/meta/recipes-core/images/build-appliance-image_12.0.1.bb
@@ -21,7 +21,7 @@ IMAGE_FSTYPES = "vmdk"
inherit core-image
-SRCREV ?= "68ef727cdcef439e9bfc57996f3cebfc0e07789e"
+SRCREV ?= "d01cd53429b1c20f01dac97f1b9b659cb9dc9812"
SRC_URI = "git://git.yoctoproject.org/poky \
file://Yocto_Build_Appliance.vmx \
file://Yocto_Build_Appliance.vmxf \
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarm64/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarm64/interfaces
new file mode 100644
index 0000000000..16967763e5
--- /dev/null
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarm64/interfaces
@@ -0,0 +1,5 @@
+# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
+
+# The loopback interface
+auto lo
+iface lo inet loopback
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb b/meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb
index 3d88506c05..733ae41f20 100644
--- a/meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb
@@ -16,6 +16,8 @@ SRC_URI = "file://copyright \
file://interfaces \
file://nfsroot"
+S = "${WORKDIR}"
+
do_install () {
install -d ${D}${sysconfdir}/init.d \
${D}${sysconfdir}/network/if-pre-up.d \
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index 8bd70251cd..89d0750b09 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -14,46 +14,76 @@ boot_size=20
# 5% for swap
swap_ratio=5
-found="no"
-
-echo "Searching for a hard drive..."
-for device in 'hda' 'hdb' 'sda' 'sdb' 'mmcblk0' 'mmcblk1'
-do
- if [ -e /sys/block/${device}/removable ]; then
- if [ "$(cat /sys/block/${device}/removable)" = "0" ]; then
- found="yes"
-
- while true; do
- # Try sleeping here to avoid getting kernel messages
- # obscuring/confusing user
- sleep 5
- echo "Found drive at /dev/${device}. Do you want to install this image there ? [y/n]"
- read answer
- if [ "$answer" = "y" ] ; then
- break
- fi
-
- if [ "$answer" = "n" ] ; then
- found=no
- break
- fi
-
- echo "Please answer y or n"
- done
- fi
- fi
+# Get a list of hard drives
+hdnamelist=""
+live_dev_name=${1%%/*}
+live_dev_name=${live_dev_name%%[0-9]*}
+
+echo "Searching for hard drives ..."
+
+for device in `ls /sys/block/`; do
+ case $device in
+ loop*)
+ # skip loop device
+ ;;
+ sr*)
+ # skip CDROM device
+ ;;
+ ram*)
+ # skip ram device
+ ;;
+ *)
+ # skip the device LiveOS is on
+ # Add valid hard drive name to the list
+ if [ $device != $live_dev_name -a -e /dev/$device ]; then
+ hdnamelist="$hdnamelist $device"
+ fi
+ ;;
+ esac
+done
- if [ "$found" = "yes" ]; then
- break;
+TARGET_DEVICE_NAME=""
+for hdname in $hdnamelist; do
+ # Display found hard drives and their basic info
+ echo "-------------------------------"
+ echo /dev/$hdname
+ if [ -r /sys/block/$hdname/device/vendor ]; then
+ echo -n "VENDOR="
+ cat /sys/block/$hdname/device/vendor
+ fi
+ if [ -r /sys/block/$hdname/device/model ]; then
+ echo -n "MODEL="
+ cat /sys/block/$hdname/device/model
+ fi
+ if [ -r /sys/block/$hdname/device/uevent ]; then
+ echo -n "UEVENT="
+ cat /sys/block/$hdname/device/uevent
+ fi
+ echo
+ # Get user choice
+ while true; do
+ echo -n "Do you want to install this image there? [y/n] "
+ read answer
+ if [ "$answer" = "y" -o "$answer" = "n" ]; then
+ break
+ fi
+ echo "Please answer y or n"
+ done
+ if [ "$answer" = "y" ]; then
+ TARGET_DEVICE_NAME=$hdname
+ break
fi
done
-if [ "$found" = "no" ]; then
+if [ -n "$TARGET_DEVICE_NAME" ]; then
+ echo "Installing image on /dev/$TARGET_DEVICE_NAME ..."
+else
+ echo "No hard drive selected. Installation aborted."
exit 1
fi
-echo "Installing image on /dev/${device}"
+device=$TARGET_DEVICE_NAME
#
# The udev automounter can cause pain here, kill it
@@ -123,34 +153,32 @@ mkfs.ext3 $rootfs
echo "Formatting swap partition...($swap)"
mkswap $swap
-mkdir /ssd
-mkdir /rootmnt
-mkdir /bootmnt
-
-mount $rootfs /ssd
-mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /rootmnt
+mkdir /tgt_root
+mkdir /src_root
+mkdir -p /boot
+# Handling of the target root partition
+mount $rootfs /tgt_root
+mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /src_root
echo "Copying rootfs files..."
-cp -a /rootmnt/* /ssd
-
-if [ -d /ssd/etc/ ] ; then
- echo "$swap swap swap defaults 0 0" >> /ssd/etc/fstab
-
+cp -a /src_root/* /tgt_root
+if [ -d /tgt_root/etc/ ] ; then
+ echo "$swap swap swap defaults 0 0" >> /tgt_root/etc/fstab
+ echo "$bootfs /boot vfat defaults 1 2" >> /tgt_root/etc/fstab
# We dont want udev to mount our root device while we're booting...
- if [ -d /ssd/etc/udev/ ] ; then
- echo "/dev/${device}" >> /ssd/etc/udev/mount.blacklist
+ if [ -d /tgt_root/etc/udev/ ] ; then
+ echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist
fi
fi
-umount /ssd
-umount /rootmnt
+umount /src_root
+# Handling of the target boot partition
+mount $bootfs /boot
echo "Preparing boot partition..."
-mount $bootfs /ssd
-EFIDIR="/ssd/EFI/BOOT"
+EFIDIR="/boot/EFI/BOOT"
mkdir -p $EFIDIR
-cp /run/media/$1/vmlinuz /ssd
# Copy the efi loader
cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR
@@ -171,11 +199,11 @@ if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
fi
if [ -d /run/media/$1/loader ]; then
- GUMMIBOOT_CFGS="/ssd/loader/entries/*.conf"
+ GUMMIBOOT_CFGS="/tgt_root/loader/entries/*.conf"
# copy config files for gummiboot
- cp -dr /run/media/$1/loader /ssd
+ cp -dr /run/media/$1/loader /tgt_root
# delete the install entry
- rm -f /ssd/loader/entries/install.conf
+ rm -f /tgt_root/loader/entries/install.conf
# delete the initrd lines
sed -i "/initrd /d" $GUMMIBOOT_CFGS
# delete any LABEL= strings
@@ -186,7 +214,12 @@ if [ -d /run/media/$1/loader ]; then
sed -i "s@options *@options root=$rootfs rw $rootwait quiet @" $GUMMIBOOT_CFGS
fi
-umount /ssd
+umount /tgt_root
+
+cp /run/media/$1/vmlinuz /boot
+
+umount /boot
+
sync
echo "Remove your installation media, and press ENTER"
diff --git a/meta/recipes-core/initrdscripts/files/init-install-testfs.sh b/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
index 618a53d436..ac62160528 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
@@ -189,7 +189,7 @@ menuentry "Linux" {
}
_EOF
# Add the test label
- echo -ne "\nmenuentry 'test' {\nlinux /test-kernel root=$testfs rw $rootwait quiet\n}\n" >> $GRUBCFG
+ echo -ne "\nmenuentry 'test' --hotkey x {\nlinux /test-kernel root=$testfs rw $rootwait quiet\n}\n" >> $GRUBCFG
chmod 0444 $GRUBCFG
fi
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index 0a1141a6f5..fb537ee310 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -16,6 +16,7 @@ swap_ratio=5
# Get a list of hard drives
hdnamelist=""
live_dev_name=${1%%/*}
+live_dev_name=${live_dev_name%%[0-9]*}
echo "Searching for hard drives ..."
@@ -24,6 +25,9 @@ for device in `ls /sys/block/`; do
loop*)
# skip loop device
;;
+ sr*)
+ # skip CDROM device
+ ;;
ram*)
# skip ram device
;;
@@ -46,9 +50,14 @@ for hdname in $hdnamelist; do
echo -n "VENDOR="
cat /sys/block/$hdname/device/vendor
fi
- echo -n "MODEL="
- cat /sys/block/$hdname/device/model
- cat /sys/block/$hdname/device/uevent
+ if [ -r /sys/block/$hdname/device/model ]; then
+ echo -n "MODEL="
+ cat /sys/block/$hdname/device/model
+ fi
+ if [ -r /sys/block/$hdname/device/uevent ]; then
+ echo -n "UEVENT="
+ cat /sys/block/$hdname/device/uevent
+ fi
echo
# Get user choice
while true; do
diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index 0be9b6fb48..d852c5737f 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -8,6 +8,8 @@ MOUNT="/bin/mount"
UMOUNT="/bin/umount"
ISOLINUX=""
+ROOT_DISK=""
+
# Copied from initramfs-framework. The core of this script probably should be
# turned into initramfs-framework modules to reduce duplication.
udev_daemon() {
@@ -80,6 +82,10 @@ boot_live_root() {
udevadm settle --timeout=3 --quiet
killall "${_UDEV_DAEMON##*/}" 2>/dev/null
+ # Allow for identification of the real root even after boot
+ mkdir -p ${ROOT_MOUNT}/media/realroot
+ mount -n --move "/run/media/${ROOT_DISK}" ${ROOT_MOUNT}/media/realroot
+
# Move the mount points of some filesystems over to
# the corresponding directories under the real root filesystem.
for dir in `awk '/\/dev.* \/run\/media/{print $2}' /proc/mounts`; do
@@ -116,10 +122,12 @@ do
for i in `ls /run/media 2>/dev/null`; do
if [ -f /run/media/$i/$ROOT_IMAGE ] ; then
found="yes"
+ ROOT_DISK="$i"
break
elif [ -f /run/media/$i/isolinux/$ROOT_IMAGE ]; then
found="yes"
ISOLINUX="isolinux"
+ ROOT_DISK="$i"
break
fi
done
@@ -150,7 +158,7 @@ mount_and_boot() {
mkdir $ROOT_MOUNT
mknod /dev/loop0 b 7 0 2>/dev/null
- if ! mount -o rw,loop,noatime,nodiratime /run/media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
+ if ! mount -o rw,loop,noatime,nodiratime /run/media/$ROOT_DISK/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
fatal "Could not mount rootfs image"
fi
@@ -220,4 +228,8 @@ case $label in
# If we're getting here, we failed...
fatal "Installation image failed"
;;
+ *)
+ # Not sure what boot label is provided. Try to boot to avoid locking up.
+ mount_and_boot
+ ;;
esac
diff --git a/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb
index 0ede20b15d..7ae7969f5e 100644
--- a/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb
@@ -5,6 +5,8 @@ SRC_URI = "file://init-boot.sh"
PR = "r2"
+S = "${WORKDIR}"
+
do_install() {
install -m 0755 ${WORKDIR}/init-boot.sh ${D}/init
}
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
index 861bec363f..89b900dba9 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
@@ -14,6 +14,8 @@ SRC_URI = "file://init \
file://e2fs \
file://debug"
+S = "${WORKDIR}"
+
do_install() {
install -d ${D}/init.d
@@ -47,7 +49,7 @@ RDEPENDS_initramfs-module-mdev = "${PN}-base"
FILES_initramfs-module-mdev = "/init.d/01-mdev"
SUMMARY_initramfs-module-udev = "initramfs support for udev"
-RDEPENDS_initramfs-module-udev = "${PN}-base udev udev-utils"
+RDEPENDS_initramfs-module-udev = "${PN}-base udev"
FILES_initramfs-module-udev = "/init.d/01-udev"
SUMMARY_initramfs-module-e2fs = "initramfs support for ext4/ext3/ext2 filesystems"
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb
index 2d378e2101..b54cb619f1 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb
@@ -5,7 +5,9 @@ DEPENDS = "virtual/kernel"
RDEPENDS_${PN} = "udev udev-extraconf"
SRC_URI = "file://init-live.sh"
-PR = "r11"
+PR = "r12"
+
+S = "${WORKDIR}"
do_install() {
install -m 0755 ${WORKDIR}/init-live.sh ${D}/init
@@ -13,5 +15,5 @@ do_install() {
FILES_${PN} += " /init "
-# Due to kernel depdendency
+# Due to kernel dependency
PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-install-efi-testfs_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-install-efi-testfs_1.0.bb
index a54960c596..c03bd2d765 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-install-efi-testfs_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install-efi-testfs_1.0.bb
@@ -5,6 +5,8 @@ SRC_URI = "file://init-install-efi-testfs.sh"
RDEPENDS_${PN} = "parted e2fsprogs-mke2fs dosfstools"
+S = "${WORKDIR}"
+
do_install() {
install -m 0755 ${WORKDIR}/init-install-efi-testfs.sh ${D}/install-efi.sh
}
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb
index 7195dc2718..b0994d78c3 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb
@@ -7,6 +7,8 @@ PR = "r1"
RDEPENDS_${PN} = "parted e2fsprogs-mke2fs dosfstools"
+S = "${WORKDIR}"
+
do_install() {
install -m 0755 ${WORKDIR}/init-install-efi.sh ${D}/install-efi.sh
}
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-install-testfs_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-install-testfs_1.0.bb
index db4cf544e8..937bfd4d38 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-install-testfs_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install-testfs_1.0.bb
@@ -5,6 +5,8 @@ SRC_URI = "file://init-install-testfs.sh"
RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs"
+S = "${WORKDIR}"
+
do_install() {
install -m 0755 ${WORKDIR}/init-install-testfs.sh ${D}/install.sh
}
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
index 7bf31c9cf8..6241a90e20 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
@@ -5,6 +5,8 @@ SRC_URI = "file://init-install.sh"
PR = "r9"
+S = "${WORKDIR}"
+
RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs"
do_install() {
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
index 3b5a47fcdd..df553bc079 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
@@ -36,7 +36,12 @@ if [ -f "${SYSCTL_CONF}" ]
then
if [ -x "/sbin/sysctl" ]
then
- /sbin/sysctl -p "${SYSCTL_CONF}"
+ # busybox sysctl does not support -q
+ VERBOSE_REDIR="1>/dev/null"
+ if [ "${VERBOSE}" != "no" ]; then
+ VERBOSE_REDIR="1>&1"
+ fi
+ eval /sbin/sysctl -p "${SYSCTL_CONF}" $VERBOSE_REDIR
else
echo "To have ${SYSCTL_CONF} applied during boot, install package <procps>."
fi
@@ -61,10 +66,15 @@ fi
test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh start
if test -e /etc/timestamp
then
- SYSTEMDATE=`date -u +%4Y%2m%2d%2H%2M`
+ SYSTEMDATE=`date -u +%4Y%2m%2d%2H%2M%2S`
read TIMESTAMP < /etc/timestamp
if [ ${TIMESTAMP} -gt $SYSTEMDATE ]; then
- date -u ${TIMESTAMP#????}${TIMESTAMP%????????}
+ # format the timestamp as date expects it (2m2d2H2M4Y.2S)
+ TS_YR=${TIMESTAMP%??????????}
+ TS_SEC=${TIMESTAMP#????????????}
+ TS_FIRST12=${TIMESTAMP%??}
+ TS_MIDDLE8=${TS_FIRST12#????}
+ date -u ${TS_MIDDLE8}${TS_YR}.${TS_SEC}
test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh stop
fi
fi
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh b/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh
index 78fb91c409..95287cc139 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh
@@ -16,7 +16,7 @@ fi
# Busybox hostname doesn't support -b so we need implement it on our own
if [ -f /etc/hostname ];then
- hostname -F /etc/hostname
+ hostname `cat /etc/hostname`
elif [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" -o ! -z "`echo $HOSTNAME | sed -n '/^[0-9]*\.[0-9].*/p'`" ] ; then
hostname localhost
fi
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
index e707b20049..904037eeaa 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
@@ -72,10 +72,12 @@ link_file() {
if [ -L \"$2\" ]; then
[ \"\$(readlink -f \"$2\")\" != \"\$(readlink -f \"$1\")\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; };
elif [ -d \"$2\" ]; then
- cp -a $2/* $1 2>/dev/null;
- cp -a $2/.[!.]* $1 2>/dev/null;
- rm -rf \"$2\";
- ln -sf \"$1\" \"$2\";
+ if awk '\$2 == \"$2\" {exit 1}' /proc/mounts; then
+ cp -a $2/* $1 2>/dev/null;
+ cp -a $2/.[!.]* $1 2>/dev/null;
+ rm -rf \"$2\";
+ ln -sf \"$1\" \"$2\";
+ fi
else
ln -sf \"$1\" \"$2\";
fi
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh b/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh
index 1f804e2374..b038fc59d4 100644
--- a/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh
@@ -10,4 +10,4 @@
### END INIT INFO
# Update the timestamp
-date -u +%4Y%2m%2d%2H%2M > /etc/timestamp
+date -u +%4Y%2m%2d%2H%2M%2S > /etc/timestamp
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/urandom b/meta/recipes-core/initscripts/initscripts-1.0/urandom
index eb3a7c3359..af1625b5fd 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/urandom
+++ b/meta/recipes-core/initscripts/initscripts-1.0/urandom
@@ -12,20 +12,23 @@
### END INIT INFO
test -c /dev/urandom || exit 0
+
+RANDOM_SEED_FILE=/var/lib/urandom/random-seed
+
. /etc/default/rcS
+[ -f /etc/default/urandom ] && . /etc/default/urandom
case "$1" in
start|"")
test "$VERBOSE" != no && echo "Initializing random number generator..."
- # Load and then save 512 bytes,
- # which is the size of the entropy pool
- if test -f /var/lib/urandom/random-seed
- then
- cat /var/lib/urandom/random-seed >/dev/urandom
- fi
- rm -f /var/lib/urandom/random-seed
+ # Load and then save 512 bytes, which is the size of the entropy
+ # pool. Also load the current date, in case the seed file is
+ # empty.
+ ( date +%s.%N; [ -f "$RANDOM_SEED_FILE" ] && cat "$RANDOM_SEED_FILE" ) \
+ >/dev/urandom
+ rm -f "$RANDOM_SEED_FILE"
umask 077
- dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 \
+ dd if=/dev/urandom of=$RANDOM_SEED_FILE count=1 \
>/dev/null 2>&1 || echo "urandom start: failed."
umask 022
;;
@@ -34,7 +37,7 @@ case "$1" in
# see documentation in linux/drivers/char/random.c
test "$VERBOSE" != no && echo "Saving random seed..."
umask 077
- dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 \
+ dd if=/dev/urandom of=$RANDOM_SEED_FILE count=1 \
>/dev/null 2>&1 || echo "urandom stop: failed."
;;
*)
diff --git a/meta/recipes-core/initscripts/initscripts_1.0.bb b/meta/recipes-core/initscripts/initscripts_1.0.bb
index 7273a82367..dfb75b261b 100644
--- a/meta/recipes-core/initscripts/initscripts_1.0.bb
+++ b/meta/recipes-core/initscripts/initscripts_1.0.bb
@@ -35,6 +35,8 @@ SRC_URI = "file://functions \
file://logrotate-dmesg.conf \
"
+S = "${WORKDIR}"
+
SRC_URI_append_arm = " file://alignment.sh"
KERNEL_VERSION = ""
@@ -139,11 +141,15 @@ do_install () {
MASKED_SCRIPTS = " \
banner \
bootmisc \
+ checkfs \
checkroot \
devpts \
+ dmesg \
hostname \
mountall \
mountnfs \
+ populate-volatile \
+ read-only-rootfs-hook \
rmnologin \
sysfs \
urandom"
@@ -158,3 +164,5 @@ pkg_postinst_${PN} () {
done
fi
}
+
+CONFFILES_${PN} += "${sysconfdir}/init.d/checkroot.sh"
diff --git a/meta/recipes-core/kbd/kbd_2.0.1.bb b/meta/recipes-core/kbd/kbd_2.0.2.bb
index 9c6eabbfb6..0aa976a46b 100644
--- a/meta/recipes-core/kbd/kbd_2.0.1.bb
+++ b/meta/recipes-core/kbd/kbd_2.0.2.bb
@@ -10,12 +10,12 @@ RREPLACES_${PN} = "console-tools"
RPROVIDES_${PN} = "console-tools"
RCONFLICTS_${PN} = "console-tools"
-SRC_URI = "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.bz2 \
+SRC_URI = "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
file://uclibc-stdarg.patch \
"
-SRC_URI[md5sum] = "f80b93a6abddb6cc2a3652daaf7562ba"
-SRC_URI[sha256sum] = "223d60bb6882323cca161aeb5965590768b2f590fd7cddbf27511ad0ba7a429e"
+SRC_URI[md5sum] = "87475eb78b1d6e6ab06686dd323ad4ba"
+SRC_URI[sha256sum] = "9dfddabf96012e329c4bebb96a21aeef7c3872f624e96e8156ba542b82aeb912"
PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
PACKAGECONFIG[pam] = "--enable-vlock, --disable-vlock, libpam,"
diff --git a/meta/recipes-core/libcgroup/libcgroup_0.41.bb b/meta/recipes-core/libcgroup/libcgroup_0.41.bb
index 69f85666aa..52ba1d760f 100644
--- a/meta/recipes-core/libcgroup/libcgroup_0.41.bb
+++ b/meta/recipes-core/libcgroup/libcgroup_0.41.bb
@@ -17,9 +17,6 @@ SRC_URI[sha256sum] = "e4e38bdc7ef70645ce33740ddcca051248d56b53283c0dc6d404e17706
EXTRA_OECONF = "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam-module-dir=${base_libdir}/security --enable-pam=yes', '--enable-pam=no', d)}"
-# http://www.mail-archive.com/openembedded-devel@lists.openembedded.org/msg21444.html
-PARALLEL_MAKE = ""
-
PACKAGES =+ "cgroups-pam-plugin"
FILES_cgroups-pam-plugin = "${base_libdir}/security/pam_cgroup.so*"
FILES_${PN}-dbg += "${base_libdir}/security/.debug"
diff --git a/meta/recipes-core/libxml/libxml2.inc b/meta/recipes-core/libxml/libxml2.inc
index e0b50cf207..1314bbfb8d 100644
--- a/meta/recipes-core/libxml/libxml2.inc
+++ b/meta/recipes-core/libxml/libxml2.inc
@@ -20,17 +20,21 @@ SRC_URI = "ftp://xmlsoft.org/libxml2/libxml2-${PV}.tar.gz;name=libtar \
file://run-ptest \
file://libxml2-CVE-2014-0191-fix.patch \
file://python-sitepackages-dir.patch \
+ file://libxml-m4-use-pkgconfig.patch \
+ file://configure.ac-fix-cross-compiling-warning.patch \
"
BINCONFIG = "${bindir}/xml2-config"
inherit autotools pkgconfig binconfig-disabled pythonnative ptest
-RDEPENDS_${PN}-ptest_append_libc-glibc += "eglibc-gconv-ebcdic-us eglibc-gconv-ibm1141"
+RDEPENDS_${PN}-ptest += "python-core"
+
+RDEPENDS_${PN}-ptest_append_libc-glibc += "glibc-gconv-ebcdic-us glibc-gconv-ibm1141"
# We don't DEPEND on binutils for ansidecl.h so ensure we don't use the header
do_configure_prepend () {
- sed -i -e '/.*ansidecl.h.*/d' ${S}/configure.in
+ sed -i -e '/.*ansidecl.h.*/d' ${S}/configure.ac
}
do_configure_prepend_class-nativesdk () {
@@ -38,10 +42,11 @@ do_configure_prepend_class-nativesdk () {
export PYTHON_SITE_PACKAGES="${PYTHON_SITEPACKAGES_DIR}"
}
-EXTRA_OECONF = "--without-python --without-debug --without-legacy --without-catalog --without-docbook --with-c14n --without-lzma --with-fexceptions"
-EXTRA_OECONF_class-native = "--with-python=${STAGING_BINDIR}/python --without-legacy --with-catalog --without-docbook --with-c14n --without-lzma"
-EXTRA_OECONF_class-nativesdk = "--with-python=${STAGING_BINDIR}/python --without-legacy --with-catalog --without-docbook --with-c14n --without-lzma"
-EXTRA_OECONF_linuxstdbase = "--without-python --with-debug --with-legacy --with-catalog --with-docbook --with-c14n --without-lzma"
+# WARNING: zlib is require for RPM use
+EXTRA_OECONF = "--without-python --without-debug --without-legacy --with-catalog --without-docbook --with-c14n --without-lzma --with-fexceptions"
+EXTRA_OECONF_class-native = "--with-python=${STAGING_BINDIR}/python --without-legacy --without-docbook --with-c14n --without-lzma --with-zlib"
+EXTRA_OECONF_class-nativesdk = "--with-python=${STAGING_BINDIR}/python --without-legacy --without-docbook --with-c14n --without-lzma --with-zlib"
+EXTRA_OECONF_linuxstdbase = "--without-python --with-debug --with-legacy --with-docbook --with-c14n --without-lzma --with-zlib"
# required for pythong binding
export HOST_SYS
@@ -61,7 +66,7 @@ PACKAGES += "${PN}-utils ${PN}-python"
FILES_${PN}-dbg += "${PYTHON_SITEPACKAGES_DIR}/.debug"
FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
-FILES_${PN}-dev += "${libdir}/xml2Conf.sh"
+FILES_${PN}-dev += "${libdir}/xml2Conf.sh ${libdir}/cmake/*"
FILES_${PN}-utils += "${bindir}/*"
FILES_${PN}-python += "${PYTHON_SITEPACKAGES_DIR}"
diff --git a/meta/recipes-core/libxml/libxml2/72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch b/meta/recipes-core/libxml/libxml2/72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch
new file mode 100644
index 0000000000..10a8112b58
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch
@@ -0,0 +1,30 @@
+From 72a46a519ce7326d9a00f0b6a7f2a8e958cd1675 Mon Sep 17 00:00:00 2001
+From: Daniel Veillard <veillard@redhat.com>
+Date: Thu, 23 Oct 2014 11:35:36 +0800
+Subject: Fix missing entities after CVE-2014-3660 fix
+
+For https://bugzilla.gnome.org/show_bug.cgi?id=738805
+
+The fix for CVE-2014-3660 introduced a regression in some case
+where entity substitution is required and the entity is used
+first in anotther entity referenced from an attribute value
+
+Upstream-Status: Backport
+
+diff --git a/parser.c b/parser.c
+index 67c9dfd..a8d1b67 100644
+--- a/parser.c
++++ b/parser.c
+@@ -7235,7 +7235,8 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
+ * far more secure as the parser will only process data coming from
+ * the document entity by default.
+ */
+- if ((ent->checked == 0) &&
++ if (((ent->checked == 0) ||
++ ((ent->children == NULL) && (ctxt->options & XML_PARSE_NOENT))) &&
+ ((ent->etype != XML_EXTERNAL_GENERAL_PARSED_ENTITY) ||
+ (ctxt->options & (XML_PARSE_NOENT | XML_PARSE_DTDVALID)))) {
+ unsigned long oldnbent = ctxt->nbentities;
+--
+cgit v0.10.1
+
diff --git a/meta/recipes-core/libxml/libxml2/configure.ac-fix-cross-compiling-warning.patch b/meta/recipes-core/libxml/libxml2/configure.ac-fix-cross-compiling-warning.patch
new file mode 100644
index 0000000000..2f8079b052
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/configure.ac-fix-cross-compiling-warning.patch
@@ -0,0 +1,45 @@
+configure.ac: fix cross compiling warning
+
+There is a warning while cross compiling which triggered a
+failure by do_qa_configure
+...
+|configure:12652: checking for gzread in -lz
+|configure:12677: mips-poky-linux-gcc -meb -mabi=32 -mhard-float
+ -L/lib conftest.c -lz >&5
+|ld: warning: library search path "/lib" is unsafe for cross-compilation
+...
+
+While do the lib checking, do not add '-L${Z_DIR}/lib' to LDFLAGS could fix it.
+
+Upstream-Status: Inappropriate [oe specific]
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ configure.ac | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 9a90600..0bac8a4 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -391,8 +391,6 @@ if test "$with_zlib" = "no"; then
+ echo "Disabling compression support"
+ else
+ AC_CHECK_HEADERS(zlib.h,
+- [SAVE_LDFLAGS="${LDFLAGS}"
+- LDFLAGS="-L${Z_DIR}/lib"
+ AC_CHECK_LIB(z, gzread,[
+ AC_DEFINE([HAVE_LIBZ], [1], [Have compression library])
+ WITH_ZLIB=1
+@@ -406,8 +404,7 @@ else
+ esac]
+ else
+ Z_LIBS="-lz"
+- fi])
+- LDFLAGS="${SAVE_LDFLAGS}"])
++ fi]))
+ fi
+
+ AC_SUBST(Z_CFLAGS)
+--
+1.9.1
+
diff --git a/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch b/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch
new file mode 100644
index 0000000000..0fc84070ed
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch
@@ -0,0 +1,204 @@
+AM_PATH_XML2 uses xml-config which we disable through
+binconfig-disabled.bbclass, so port it to use pkg-config instead.
+
+Upstream-Status: Pending
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+diff --git a/libxml.m4 b/libxml.m4
+index 68cd824..5fa0a9b 100644
+--- a/libxml.m4
++++ b/libxml.m4
+@@ -1,188 +1,12 @@
+-# Configure paths for LIBXML2
+-# Mike Hommey 2004-06-19
+-# use CPPFLAGS instead of CFLAGS
+-# Toshio Kuratomi 2001-04-21
+-# Adapted from:
+-# Configure paths for GLIB
+-# Owen Taylor 97-11-3
+-
+ dnl AM_PATH_XML2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+ dnl Test for XML, and define XML_CPPFLAGS and XML_LIBS
+ dnl
+-AC_DEFUN([AM_PATH_XML2],[
+-AC_ARG_WITH(xml-prefix,
+- [ --with-xml-prefix=PFX Prefix where libxml is installed (optional)],
+- xml_config_prefix="$withval", xml_config_prefix="")
+-AC_ARG_WITH(xml-exec-prefix,
+- [ --with-xml-exec-prefix=PFX Exec prefix where libxml is installed (optional)],
+- xml_config_exec_prefix="$withval", xml_config_exec_prefix="")
+-AC_ARG_ENABLE(xmltest,
+- [ --disable-xmltest Do not try to compile and run a test LIBXML program],,
+- enable_xmltest=yes)
+-
+- if test x$xml_config_exec_prefix != x ; then
+- xml_config_args="$xml_config_args"
+- if test x${XML2_CONFIG+set} != xset ; then
+- XML2_CONFIG=$xml_config_exec_prefix/bin/xml2-config
+- fi
+- fi
+- if test x$xml_config_prefix != x ; then
+- xml_config_args="$xml_config_args --prefix=$xml_config_prefix"
+- if test x${XML2_CONFIG+set} != xset ; then
+- XML2_CONFIG=$xml_config_prefix/bin/xml2-config
+- fi
+- fi
+-
+- AC_PATH_PROG(XML2_CONFIG, xml2-config, no)
+- min_xml_version=ifelse([$1], ,2.0.0,[$1])
+- AC_MSG_CHECKING(for libxml - version >= $min_xml_version)
+- no_xml=""
+- if test "$XML2_CONFIG" = "no" ; then
+- no_xml=yes
+- else
+- XML_CPPFLAGS=`$XML2_CONFIG $xml_config_args --cflags`
+- XML_LIBS=`$XML2_CONFIG $xml_config_args --libs`
+- xml_config_major_version=`$XML2_CONFIG $xml_config_args --version | \
+- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+- xml_config_minor_version=`$XML2_CONFIG $xml_config_args --version | \
+- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+- xml_config_micro_version=`$XML2_CONFIG $xml_config_args --version | \
+- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+- if test "x$enable_xmltest" = "xyes" ; then
+- ac_save_CPPFLAGS="$CPPFLAGS"
+- ac_save_LIBS="$LIBS"
+- CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
+- LIBS="$XML_LIBS $LIBS"
+-dnl
+-dnl Now check if the installed libxml is sufficiently new.
+-dnl (Also sanity checks the results of xml2-config to some extent)
+-dnl
+- rm -f conf.xmltest
+- AC_TRY_RUN([
+-#include <stdlib.h>
+-#include <stdio.h>
+-#include <string.h>
+-#include <libxml/xmlversion.h>
+-
+-int
+-main()
+-{
+- int xml_major_version, xml_minor_version, xml_micro_version;
+- int major, minor, micro;
+- char *tmp_version;
+-
+- system("touch conf.xmltest");
+-
+- /* Capture xml2-config output via autoconf/configure variables */
+- /* HP/UX 9 (%@#!) writes to sscanf strings */
+- tmp_version = (char *)strdup("$min_xml_version");
+- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+- printf("%s, bad version string from xml2-config\n", "$min_xml_version");
+- exit(1);
+- }
+- free(tmp_version);
+-
+- /* Capture the version information from the header files */
+- tmp_version = (char *)strdup(LIBXML_DOTTED_VERSION);
+- if (sscanf(tmp_version, "%d.%d.%d", &xml_major_version, &xml_minor_version, &xml_micro_version) != 3) {
+- printf("%s, bad version string from libxml includes\n", "LIBXML_DOTTED_VERSION");
+- exit(1);
+- }
+- free(tmp_version);
+-
+- /* Compare xml2-config output to the libxml headers */
+- if ((xml_major_version != $xml_config_major_version) ||
+- (xml_minor_version != $xml_config_minor_version) ||
+- (xml_micro_version != $xml_config_micro_version))
+- {
+- printf("*** libxml header files (version %d.%d.%d) do not match\n",
+- xml_major_version, xml_minor_version, xml_micro_version);
+- printf("*** xml2-config (version %d.%d.%d)\n",
+- $xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version);
+- return 1;
+- }
+-/* Compare the headers to the library to make sure we match */
+- /* Less than ideal -- doesn't provide us with return value feedback,
+- * only exits if there's a serious mismatch between header and library.
+- */
+- LIBXML_TEST_VERSION;
+-
+- /* Test that the library is greater than our minimum version */
+- if ((xml_major_version > major) ||
+- ((xml_major_version == major) && (xml_minor_version > minor)) ||
+- ((xml_major_version == major) && (xml_minor_version == minor) &&
+- (xml_micro_version >= micro)))
+- {
+- return 0;
+- }
+- else
+- {
+- printf("\n*** An old version of libxml (%d.%d.%d) was found.\n",
+- xml_major_version, xml_minor_version, xml_micro_version);
+- printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n",
+- major, minor, micro);
+- printf("*** libxml is always available from ftp://ftp.xmlsoft.org.\n");
+- printf("***\n");
+- printf("*** If you have already installed a sufficiently new version, this error\n");
+- printf("*** probably means that the wrong copy of the xml2-config shell script is\n");
+- printf("*** being found. The easiest way to fix this is to remove the old version\n");
+- printf("*** of LIBXML, but you can also set the XML2_CONFIG environment to point to the\n");
+- printf("*** correct copy of xml2-config. (In this case, you will have to\n");
+- printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+- printf("*** so that the correct libraries are found at run-time))\n");
+- }
+- return 1;
+-}
+-],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+- CPPFLAGS="$ac_save_CPPFLAGS"
+- LIBS="$ac_save_LIBS"
+- fi
+- fi
++AC_DEFUN([AM_PATH_XML2],[
++ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+
+- if test "x$no_xml" = x ; then
+- AC_MSG_RESULT(yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version))
+- ifelse([$2], , :, [$2])
+- else
+- AC_MSG_RESULT(no)
+- if test "$XML2_CONFIG" = "no" ; then
+- echo "*** The xml2-config script installed by LIBXML could not be found"
+- echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in"
+- echo "*** your path, or set the XML2_CONFIG environment variable to the"
+- echo "*** full path to xml2-config."
+- else
+- if test -f conf.xmltest ; then
+- :
+- else
+- echo "*** Could not run libxml test program, checking why..."
+- CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
+- LIBS="$LIBS $XML_LIBS"
+- AC_TRY_LINK([
+-#include <libxml/xmlversion.h>
+-#include <stdio.h>
+-], [ LIBXML_TEST_VERSION; return 0;],
+- [ echo "*** The test program compiled, but did not run. This usually means"
+- echo "*** that the run-time linker is not finding LIBXML or finding the wrong"
+- echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your"
+- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+- echo "*** to the installed location Also, make sure you have run ldconfig if that"
+- echo "*** is required on your system"
+- echo "***"
+- echo "*** If you have an old version installed, it is best to remove it, although"
+- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
+- [ echo "*** The test program failed to compile or link. See the file config.log for the"
+- echo "*** exact error that occured. This usually means LIBXML was incorrectly installed"
+- echo "*** or that you have moved LIBXML since it was installed. In the latter case, you"
+- echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ])
+- CPPFLAGS="$ac_save_CPPFLAGS"
+- LIBS="$ac_save_LIBS"
+- fi
+- fi
++ verdep=ifelse([$1], [], [], [>= $1])
++ PKG_CHECK_MODULES(XML, [libxml-2.0 $verdep], [$2], [$3])
+
+- XML_CPPFLAGS=""
+- XML_LIBS=""
+- ifelse([$3], , :, [$3])
+- fi
++ XML_CPPFLAGS=$XML_CFLAGS
+ AC_SUBST(XML_CPPFLAGS)
+- AC_SUBST(XML_LIBS)
+- rm -f conf.xmltest
+ ])
diff --git a/meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-3660.patch b/meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-3660.patch
new file mode 100644
index 0000000000..b9621c93eb
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-3660.patch
@@ -0,0 +1,147 @@
+From be2a7edaf289c5da74a4f9ed3a0b6c733e775230 Mon Sep 17 00:00:00 2001
+From: Daniel Veillard <veillard@redhat.com>
+Date: Thu, 16 Oct 2014 13:59:47 +0800
+Subject: Fix for CVE-2014-3660
+
+Issues related to the billion laugh entity expansion which happened to
+escape the initial set of fixes
+
+Upstream-status: Backport
+Reference: https://git.gnome.org/browse/libxml2/commit/?id=be2a7edaf289c5da74a4f9ed3a0b6c733e775230&context=3&ignorews=0&ss=0
+
+Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
+
+diff --git a/parser.c b/parser.c
+index f51e8d2..1d93967 100644
+--- a/parser.c
++++ b/parser.c
+@@ -130,6 +130,29 @@ xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size,
+ return (0);
+ if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP)
+ return (1);
++
++ /*
++ * This may look absurd but is needed to detect
++ * entities problems
++ */
++ if ((ent != NULL) && (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) &&
++ (ent->content != NULL) && (ent->checked == 0)) {
++ unsigned long oldnbent = ctxt->nbentities;
++ xmlChar *rep;
++
++ ent->checked = 1;
++
++ rep = xmlStringDecodeEntities(ctxt, ent->content,
++ XML_SUBSTITUTE_REF, 0, 0, 0);
++
++ ent->checked = (ctxt->nbentities - oldnbent + 1) * 2;
++ if (rep != NULL) {
++ if (xmlStrchr(rep, '<'))
++ ent->checked |= 1;
++ xmlFree(rep);
++ rep = NULL;
++ }
++ }
+ if (replacement != 0) {
+ if (replacement < XML_MAX_TEXT_LENGTH)
+ return(0);
+@@ -189,9 +212,12 @@ xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size,
+ return (0);
+ } else {
+ /*
+- * strange we got no data for checking just return
++ * strange we got no data for checking
+ */
+- return (0);
++ if (((ctxt->lastError.code != XML_ERR_UNDECLARED_ENTITY) &&
++ (ctxt->lastError.code != XML_WAR_UNDECLARED_ENTITY)) ||
++ (ctxt->nbentities <= 10000))
++ return (0);
+ }
+ xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
+ return (1);
+@@ -2589,6 +2615,7 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
+ name, NULL);
+ ctxt->valid = 0;
+ }
++ xmlParserEntityCheck(ctxt, 0, NULL, 0);
+ } else if (ctxt->input->free != deallocblankswrapper) {
+ input = xmlNewBlanksWrapperInputStream(ctxt, entity);
+ if (xmlPushInput(ctxt, input) < 0)
+@@ -2759,6 +2786,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
+ if ((ctxt->lastError.code == XML_ERR_ENTITY_LOOP) ||
+ (ctxt->lastError.code == XML_ERR_INTERNAL_ERROR))
+ goto int_error;
++ xmlParserEntityCheck(ctxt, 0, ent, 0);
+ if (ent != NULL)
+ ctxt->nbentities += ent->checked / 2;
+ if ((ent != NULL) &&
+@@ -2810,6 +2838,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
+ ent = xmlParseStringPEReference(ctxt, &str);
+ if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP)
+ goto int_error;
++ xmlParserEntityCheck(ctxt, 0, ent, 0);
+ if (ent != NULL)
+ ctxt->nbentities += ent->checked / 2;
+ if (ent != NULL) {
+@@ -7312,6 +7341,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
+ (ret != XML_WAR_UNDECLARED_ENTITY)) {
+ xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY,
+ "Entity '%s' failed to parse\n", ent->name);
++ xmlParserEntityCheck(ctxt, 0, ent, 0);
+ } else if (list != NULL) {
+ xmlFreeNodeList(list);
+ list = NULL;
+@@ -7418,7 +7448,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
+ /*
+ * We are copying here, make sure there is no abuse
+ */
+- ctxt->sizeentcopy += ent->length;
++ ctxt->sizeentcopy += ent->length + 5;
+ if (xmlParserEntityCheck(ctxt, 0, ent, ctxt->sizeentcopy))
+ return;
+
+@@ -7466,7 +7496,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
+ /*
+ * We are copying here, make sure there is no abuse
+ */
+- ctxt->sizeentcopy += ent->length;
++ ctxt->sizeentcopy += ent->length + 5;
+ if (xmlParserEntityCheck(ctxt, 0, ent, ctxt->sizeentcopy))
+ return;
+
+@@ -7652,6 +7682,7 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
+ ctxt->sax->reference(ctxt->userData, name);
+ }
+ }
++ xmlParserEntityCheck(ctxt, 0, ent, 0);
+ ctxt->valid = 0;
+ }
+
+@@ -7845,6 +7876,7 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
+ "Entity '%s' not defined\n",
+ name);
+ }
++ xmlParserEntityCheck(ctxt, 0, ent, 0);
+ /* TODO ? check regressions ctxt->valid = 0; */
+ }
+
+@@ -8004,6 +8036,7 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt)
+ name, NULL);
+ ctxt->valid = 0;
+ }
++ xmlParserEntityCheck(ctxt, 0, NULL, 0);
+ } else {
+ /*
+ * Internal checking in case the entity quest barfed
+@@ -8243,6 +8276,7 @@ xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) {
+ name, NULL);
+ ctxt->valid = 0;
+ }
++ xmlParserEntityCheck(ctxt, 0, NULL, 0);
+ } else {
+ /*
+ * Internal checking in case the entity quest barfed
+--
+cgit v0.10.1
+
diff --git a/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch b/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch
index a697ddf873..e83c8325e5 100644
--- a/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch
+++ b/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch
@@ -4,12 +4,18 @@ The python binary used when building for nativesdk doesn't give us the
correct path here so we need to be able to specify it ourselves.
Upstream-Status: Inappropriate [config]
-
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---- a/configure.in
-+++ b/configure.in
-@@ -743,7 +743,8 @@ dnl
+Rebase to 2.9.2
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ configure.ac | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+--- a/configure.ac
++++ b/configure.ac
+@@ -813,7 +813,8 @@ dnl
PYTHON_VERSION=
PYTHON_INCLUDES=
@@ -19,3 +25,6 @@ Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
PYTHON_TESTS=
pythondir=
if test "$with_python" != "no" ; then
+--
+1.9.1
+
diff --git a/meta/recipes-core/libxml/libxml2_2.9.1.bb b/meta/recipes-core/libxml/libxml2_2.9.2.bb
index 0b6ac5d5c6..1affff12ae 100644
--- a/meta/recipes-core/libxml/libxml2_2.9.1.bb
+++ b/meta/recipes-core/libxml/libxml2_2.9.2.bb
@@ -1,8 +1,9 @@
require libxml2.inc
-SRC_URI += "http://www.w3.org/XML/Test/xmlts20080827.tar.gz;name=testtar"
+SRC_URI += "http://www.w3.org/XML/Test/xmlts20080827.tar.gz;name=testtar \
+ file://72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch"
-SRC_URI[libtar.md5sum] = "9c0cfef285d5c4a5c80d00904ddab380"
-SRC_URI[libtar.sha256sum] = "fd3c64cb66f2c4ea27e934d275904d92cec494a8e8405613780cbc8a71680fdb"
+SRC_URI[libtar.md5sum] = "9e6a9aca9d155737868b3dc5fd82f788"
+SRC_URI[libtar.sha256sum] = "5178c30b151d044aefb1b08bf54c3003a0ac55c59c866763997529d60770d5bc"
SRC_URI[testtar.md5sum] = "ae3d1ebe000a3972afa104ca7f0e1b4a"
SRC_URI[testtar.sha256sum] = "96151685cec997e1f9f3387e3626d61e6284d4d6e66e0e440c209286c03e9cc7"
diff --git a/meta/recipes-core/meta/buildtools-tarball.bb b/meta/recipes-core/meta/buildtools-tarball.bb
index 62e1e0bbef..302510c798 100644
--- a/meta/recipes-core/meta/buildtools-tarball.bb
+++ b/meta/recipes-core/meta/buildtools-tarball.bb
@@ -9,40 +9,23 @@ TOOLCHAIN_TARGET_TASK ?= ""
TOOLCHAIN_HOST_TASK ?= "\
nativesdk-python-core \
- nativesdk-python-textutils \
- nativesdk-python-sqlite3 \
- nativesdk-python-pickle \
- nativesdk-python-logging \
- nativesdk-python-elementtree \
- nativesdk-python-curses \
- nativesdk-python-compile \
- nativesdk-python-compiler \
- nativesdk-python-fcntl \
- nativesdk-python-shell \
+ nativesdk-python-modules \
nativesdk-python-misc \
- nativesdk-python-multiprocessing \
- nativesdk-python-subprocess \
- nativesdk-python-xmlrpc \
- nativesdk-python-netclient \
- nativesdk-python-netserver \
- nativesdk-python-distutils \
- nativesdk-python-unixadmin \
- nativesdk-python-compression \
- nativesdk-python-json \
- nativesdk-python-unittest \
- nativesdk-python-mmap \
- nativesdk-python-difflib \
- nativesdk-python-pprint \
nativesdk-python-git \
- nativesdk-python-pkgutil \
nativesdk-ncurses-terminfo-base \
nativesdk-chrpath \
nativesdk-tar \
+ nativesdk-buildtools-perl-dummy \
nativesdk-git \
+ nativesdk-git-perltools \
nativesdk-pigz \
nativesdk-make \
+ nativesdk-wget \
+ nativesdk-ca-certificates \
"
+SDK_PACKAGE_ARCHS =+ "buildtools-dummy-${SDKPKGSUFFIX}"
+
TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-buildtools-nativesdk-standalone-${DISTRO_VERSION}"
RDEPENDS = "${TOOLCHAIN_HOST_TASK}"
@@ -67,4 +50,6 @@ create_sdk_files_append () {
# so instead of exporting the variable, we use a comment here.
echo '#OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script
toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${SDK_SYS}
+
+ echo 'export GIT_SSL_CAINFO="${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt"' >>$script
}
diff --git a/meta/recipes-core/meta/meta-environment-extsdk.bb b/meta/recipes-core/meta/meta-environment-extsdk.bb
new file mode 100644
index 0000000000..d9e596143f
--- /dev/null
+++ b/meta/recipes-core/meta/meta-environment-extsdk.bb
@@ -0,0 +1,12 @@
+# meta-environment for extensible SDK
+
+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))}
+
+ toolchain_create_sdk_env_script '' '' $sysroot '' ${bindir_native} ${prefix_native} $sdkpathnative
+}
diff --git a/meta/recipes-core/meta/meta-environment.bb b/meta/recipes-core/meta/meta-environment.bb
index cf142ef5ca..5d72e38e91 100644
--- a/meta/recipes-core/meta/meta-environment.bb
+++ b/meta/recipes-core/meta/meta-environment.bb
@@ -6,32 +6,56 @@ PR = "r8"
EXCLUDE_FROM_WORLD = "1"
+MODIFYTOS = "0"
+
+REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}"
+
inherit toolchain-scripts
TOOLCHAIN_NEED_CONFIGSITE_CACHE += "zlib"
-REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}"
SDK_DIR = "${WORKDIR}/sdk"
SDK_OUTPUT = "${SDK_DIR}/image"
-SDKTARGETSYSROOT = "${SDKPATH}/sysroots/${TARGET_SYS}"
+SDKTARGETSYSROOT = "${SDKPATH}/sysroots/${REAL_MULTIMACH_TARGET_SYS}"
inherit cross-canadian
-do_generate_content[nostamp] = "1"
-do_generate_content() {
+do_generate_content[cleandirs] = "${SDK_OUTPUT}"
+do_generate_content[dirs] = "${SDK_OUTPUT}/${SDKPATH}"
+python do_generate_content() {
+ # Handle multilibs in the SDK environment, siteconfig, etc files...
+ localdata = bb.data.createCopy(d)
- rm -rf ${SDK_OUTPUT}
- mkdir -p ${SDK_OUTPUT}/${SDKPATH}
+ # make sure we only use the WORKDIR value from 'd', or it can change
+ localdata.setVar('WORKDIR', d.getVar('WORKDIR', True))
- toolchain_create_sdk_siteconfig ${SDK_OUTPUT}/${SDKPATH}/site-config-${REAL_MULTIMACH_TARGET_SYS}
+ # make sure we only use the SDKTARGETSYSROOT value from 'd'
+ localdata.setVar('SDKTARGETSYSROOT', d.getVar('SDKTARGETSYSROOT', True))
+ localdata.setVar('libdir', d.getVar('target_libdir', False))
- toolchain_create_sdk_env_script ${SDK_OUTPUT}/${SDKPATH}/environment-setup-${REAL_MULTIMACH_TARGET_SYS} ${REAL_MULTIMACH_TARGET_SYS} '##SDKTARGETSYSROOT##' ${target_libdir}
+ # Process DEFAULTTUNE
+ bb.build.exec_func("create_sdk_files", localdata)
- # Add version information
- toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${REAL_MULTIMACH_TARGET_SYS}
+ variants = d.getVar("MULTILIB_VARIANTS", True) 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
-do_install[nostamp] = "1"
+create_sdk_files() {
+ # Setup site file for external use
+ toolchain_create_sdk_siteconfig ${SDK_OUTPUT}/${SDKPATH}/site-config-${REAL_MULTIMACH_TARGET_SYS}
+
+ toolchain_create_sdk_env_script ${SDK_OUTPUT}/${SDKPATH}/environment-setup-${REAL_MULTIMACH_TARGET_SYS}
+
+ # Add version information
+ toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${REAL_MULTIMACH_TARGET_SYS}
+}
+
do_install() {
install -d ${D}/${SDKPATH}
install -m 0644 -t ${D}/${SDKPATH} ${SDK_OUTPUT}/${SDKPATH}/*
diff --git a/meta/recipes-core/meta/meta-ide-support.bb b/meta/recipes-core/meta/meta-ide-support.bb
index 03cad6ed69..2f92912816 100644
--- a/meta/recipes-core/meta/meta-ide-support.bb
+++ b/meta/recipes-core/meta/meta-ide-support.bb
@@ -14,5 +14,4 @@ do_populate_ide_support () {
}
do_populate_ide_support[nostamp] = "1"
-do_populate_ide_support[recrdeptask] = "do_package_write"
addtask populate_ide_support before do_build after do_install
diff --git a/meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb b/meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb
new file mode 100644
index 0000000000..d971c3ca3d
--- /dev/null
+++ b/meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb
@@ -0,0 +1,19 @@
+SUMMARY = "Dummy package which ensures perl is excluded from buildtools"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+inherit nativesdk
+
+# Put it somewhere separate to ensure it's never used except when we want it
+PACKAGE_ARCH = "buildtools-dummy-${SDKPKGSUFFIX}"
+
+PERLPACKAGES = "nativesdk-perl \
+ nativesdk-perl-module-file-path"
+
+ALLOW_EMPTY_${PN} = "1"
+
+python populate_packages_prepend() {
+ d.appendVar('RPROVIDES_${PN}', '${PERLPACKAGES}')
+ d.appendVar('RCONFLICTS_${PN}', '${PERLPACKAGES}')
+}
+
diff --git a/meta/recipes-core/meta/package-index.bb b/meta/recipes-core/meta/package-index.bb
index 27b6d8ea9f..3c46b49977 100644
--- a/meta/recipes-core/meta/package-index.bb
+++ b/meta/recipes-core/meta/package-index.bb
@@ -12,7 +12,6 @@ do_compile[noexec] = "1"
do_install[noexec] = "1"
do_package[noexec] = "1"
do_packagedata[noexec] = "1"
-do_package_write[noexec] = "1"
do_package_write_ipk[noexec] = "1"
do_package_write_rpm[noexec] = "1"
do_package_write_deb[noexec] = "1"
diff --git a/meta/recipes-core/meta/uninative-tarball.bb b/meta/recipes-core/meta/uninative-tarball.bb
new file mode 100644
index 0000000000..53435f22ae
--- /dev/null
+++ b/meta/recipes-core/meta/uninative-tarball.bb
@@ -0,0 +1,48 @@
+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 = ""
+
+TOOLCHAIN_HOST_TASK = "\
+ nativesdk-glibc \
+ nativesdk-patchelf \
+ "
+
+INHIBIT_DEFAULT_DEPS = "1"
+DEPENDS += "patchelf-native"
+
+TOOLCHAIN_OUTPUTNAME ?= "${BUILD_ARCH}-nativesdk-libc"
+
+RDEPENDS = "${TOOLCHAIN_HOST_TASK}"
+
+EXCLUDE_FROM_WORLD = "1"
+
+inherit meta
+inherit populate_sdk
+
+deltask install
+deltask package
+
+SDK_PACKAGING_FUNC = ""
+
+fakeroot create_sdk_files() {
+ cp ${COREBASE}/scripts/relocate_sdk.py ${SDK_OUTPUT}/${SDKPATH}/
+
+ # Replace the ##DEFAULT_INSTALL_DIR## with the correct pattern.
+ # Escape special characters like '+' and '.' in the SDKPATH
+ escaped_sdkpath=$(echo ${SDKPATH}/sysroots/${SDK_SYS} |sed -e "s:[\+\.]:\\\\\\\\\0:g")
+ sed -i -e "s:##DEFAULT_INSTALL_DIR##:$escaped_sdkpath:" ${SDK_OUTPUT}/${SDKPATH}/relocate_sdk.py
+}
+
+
+fakeroot tar_sdk() {
+ mkdir -p ${SDK_DEPLOY}
+ cd ${SDK_OUTPUT}/${SDKPATH}
+ mv sysroots/${SDK_SYS} ./${BUILD_SYS}
+ rm sysroots -rf
+ patchelf --set-interpreter ${@''.join('a' for n in xrange(1024))} ./${BUILD_SYS}/usr/bin/patchelf
+ mv ./${BUILD_SYS}/usr/bin/patchelf ./${BUILD_SYS}/usr/bin/patchelf-uninative
+ tar ${SDKTAROPTS} -c -j --file=${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.tar.bz2 .
+}
diff --git a/meta/recipes-core/ncurses/ncurses.inc b/meta/recipes-core/ncurses/ncurses.inc
index 521d0e435c..10f7dd175d 100644
--- a/meta/recipes-core/ncurses/ncurses.inc
+++ b/meta/recipes-core/ncurses/ncurses.inc
@@ -98,6 +98,8 @@ do_configure() {
# not the case for /dev/null redirections)
export cf_cv_working_poll=yes
+ # The --enable-pc-files requires PKG_CONFIG_LIBDIR existed
+ mkdir -p ${PKG_CONFIG_LIBDIR}
( cd ${S}; gnu-configize --force )
ncurses_configure "narrowc" || \
return 1
diff --git a/meta/recipes-core/netbase/netbase_5.2.bb b/meta/recipes-core/netbase/netbase_5.3.bb
index ab7ae6527c..4ac0221c9e 100644
--- a/meta/recipes-core/netbase/netbase_5.2.bb
+++ b/meta/recipes-core/netbase/netbase_5.3.bb
@@ -6,11 +6,11 @@ LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://debian/copyright;md5=3dd6192d306f582dee7687da3d8748ab"
PE = "1"
-SRC_URI = "${DEBIAN_MIRROR}/main/n/netbase/netbase_${PV}.tar.gz \
+SRC_URI = "${DEBIAN_MIRROR}/main/n/netbase/netbase_${PV}.tar.xz \
file://hosts"
-SRC_URI[md5sum] = "3a01bfce6a28e1743412198abd241262"
-SRC_URI[sha256sum] = "d62ba56d62b9b121664828175c2a237a7014ef32df8a4116ea33cff332de3307"
+SRC_URI[md5sum] = "2637a27fd3de02a278d2b5be7e6558c1"
+SRC_URI[sha256sum] = "81f6c69795044d62b8ad959cf9daf049d0545fd466c52860ad3f933b1e97b88b"
do_install () {
install -d ${D}/${mandir}/man8 ${D}${sysconfdir}
diff --git a/meta/recipes-core/os-release/os-release.bb b/meta/recipes-core/os-release/os-release.bb
new file mode 100644
index 0000000000..33e958137f
--- /dev/null
+++ b/meta/recipes-core/os-release/os-release.bb
@@ -0,0 +1,36 @@
+inherit allarch
+
+SUMMARY = "Operating system identification"
+DESCRIPTION = "The /etc/os-release file contains operating system identification data."
+LICENSE = "MIT"
+INHIBIT_DEFAULT_DEPS = "1"
+
+do_fetch[noexec] = "1"
+do_unpack[noexec] = "1"
+do_patch[noexec] = "1"
+do_configure[noexec] = "1"
+
+# Other valid fields: BUILD_ID ID_LIKE ANSI_COLOR CPE_NAME
+# HOME_URL SUPPORT_URL BUG_REPORT_URL
+OS_RELEASE_FIELDS = "ID ID_LIKE NAME VERSION VERSION_ID PRETTY_NAME"
+
+ID = "${DISTRO}"
+NAME = "${DISTRO_NAME}"
+VERSION = "${DISTRO_VERSION}${@' (%s)' % DISTRO_CODENAME if 'DISTRO_CODENAME' in d else ''}"
+VERSION_ID = "${DISTRO_VERSION}"
+PRETTY_NAME = "${DISTRO_NAME} ${VERSION}"
+BUILD_ID ?= "${DATETIME}"
+
+python do_compile () {
+ 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)
+ if value:
+ f.write('{0}={1}\n'.format(field, value))
+}
+do_compile[vardeps] += "${OS_RELEASE_FIELDS}"
+
+do_install () {
+ install -d ${D}${sysconfdir}
+ install -m 0644 os-release ${D}${sysconfdir}/
+}
diff --git a/meta/recipes-core/packagegroups/packagegroup-base.bb b/meta/recipes-core/packagegroups/packagegroup-base.bb
index 16f3a510d8..262d65f5dc 100644
--- a/meta/recipes-core/packagegroups/packagegroup-base.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-base.bb
@@ -2,7 +2,13 @@ SUMMARY = "Merge machine and distro options to create a basic machine task/packa
LICENSE = "MIT"
PR = "r83"
+#
+# packages which content depend on MACHINE_FEATURES need to be MACHINE_ARCH
+#
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
inherit packagegroup
+inherit bluetooth
PROVIDES = "${PACKAGES}"
PACKAGES = ' \
@@ -39,11 +45,6 @@ PACKAGES = ' \
\
'
-#
-# packages which content depend on MACHINE_FEATURES need to be MACHINE_ARCH
-#
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
# Override by distro if needed
VIRTUAL-RUNTIME_keymaps ?= "keymaps"
@@ -124,13 +125,6 @@ python __anonymous () {
if "nfc" in distro_features and not "nfc" in machine_features and ("usbhost" in machine_features):
d.setVar("ADD_NFC", "packagegroup-base-nfc")
-
- # For backwards compatibility after rename
- packages = d.getVar("PACKAGES", True).split()
- for pkg in packages:
- d.appendVar("RPROVIDES_%s" % pkg, pkg.replace("packagegroup-", "task-"))
- d.appendVar("RREPLACES_%s" % pkg, pkg.replace("packagegroup-", "task-"))
- d.appendVar("RCONFLICTS_%s" % pkg, pkg.replace("packagegroup-", "task-"))
}
#
@@ -210,7 +204,7 @@ RRECOMMENDS_packagegroup-base-pcmcia = "\
SUMMARY_packagegroup-base-bluetooth = "Bluetooth support"
RDEPENDS_packagegroup-base-bluetooth = "\
- bluez4 \
+ ${BLUEZ} \
${@bb.utils.contains('COMBINED_FEATURES', 'alsa', 'libasound-module-bluez', '',d)} \
"
@@ -353,8 +347,10 @@ RRECOMMENDS_packagegroup-base-nfs = "\
SUMMARY_packagegroup-base-zeroconf = "Zeroconf support"
RDEPENDS_packagegroup-base-zeroconf = "\
- libnss-mdns \
avahi-daemon"
+RDEPENDS_packagegroup-base-zeroconf_append_libc-glibc = "\
+ libnss-mdns \
+ "
SUMMARY_packagegroup-base-ipv6 = "IPv6 support"
RDEPENDS_packagegroup-base-ipv6 = "\
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-boot.bb b/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
index c8bc362242..09f537372e 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
@@ -7,21 +7,16 @@ DESCRIPTION = "The minimal set of packages required to boot the system"
LICENSE = "MIT"
PR = "r17"
-inherit packagegroup
-
PACKAGE_ARCH = "${MACHINE_ARCH}"
+inherit packagegroup
+
#
# Set by the machine configuration with packages essential for device bootup
#
MACHINE_ESSENTIAL_EXTRA_RDEPENDS ?= ""
MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS ?= ""
-# For backwards compatibility after rename
-RPROVIDES_${PN} = "task-core-boot"
-RREPLACES_${PN} = "task-core-boot"
-RCONFLICTS_${PN} = "task-core-boot"
-
# Distro can override the following VIRTUAL-RUNTIME providers:
VIRTUAL-RUNTIME_dev_manager ?= "udev"
VIRTUAL-RUNTIME_login_manager ?= "busybox"
@@ -32,6 +27,7 @@ VIRTUAL-RUNTIME_keymaps ?= "keymaps"
SYSVINIT_SCRIPTS = "${@bb.utils.contains('MACHINE_FEATURES', 'rtc', 'busybox-hwclock', '', d)} \
modutils-initscripts \
init-ifupdown \
+ ${VIRTUAL-RUNTIME_initscripts} \
"
RDEPENDS_${PN} = "\
@@ -43,7 +39,6 @@ RDEPENDS_${PN} = "\
netbase \
${VIRTUAL-RUNTIME_login_manager} \
${VIRTUAL-RUNTIME_init_manager} \
- ${VIRTUAL-RUNTIME_initscripts} \
${VIRTUAL-RUNTIME_dev_manager} \
${VIRTUAL-RUNTIME_update-alternatives} \
${MACHINE_ESSENTIAL_EXTRA_RDEPENDS}"
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-nfs.bb b/meta/recipes-core/packagegroups/packagegroup-core-nfs.bb
index 24c98c4938..247a30e063 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-nfs.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-nfs.bb
@@ -10,11 +10,6 @@ inherit packagegroup
PACKAGES = "${PN}-server"
-# For backwards compatibility after rename
-RPROVIDES_${PN}-server = "task-core-nfs-server"
-RREPLACES_${PN}-server = "task-core-nfs-server"
-RCONFLICTS_${PN}-server = "task-core-nfs-server"
-
SUMMARY_${PN}-server = "NFS server"
RDEPENDS_${PN}-server = "\
nfs-utils \
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb b/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
index 172398929c..a41eada5af 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
@@ -6,15 +6,12 @@ SUMMARY = "Software development tools"
LICENSE = "MIT"
PR = "r9"
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
inherit packagegroup
#PACKAGEFUNCS =+ 'generate_sdk_pkgs'
-# For backwards compatibility after rename
-RPROVIDES_packagegroup-core-sdk = "task-core-sdk"
-RREPLACES_packagegroup-core-sdk = "task-core-sdk"
-RCONFLICTS_packagegroup-core-sdk = "task-core-sdk"
-
RDEPENDS_packagegroup-core-sdk = "\
packagegroup-core-buildessential \
coreutils \
@@ -31,9 +28,18 @@ RDEPENDS_packagegroup-core-sdk = "\
file \
tcl"
+SANITIZERS = "libasan-dev libubsan-dev"
+SANITIZERS_aarch64 = ""
+SANITIZERS_mips = ""
+SANITIZERS_mips64 = ""
+SANITIZERS_mips64n32 = ""
+SANITIZERS_powerpc64 = ""
+SANITIZERS_sparc = ""
+
RRECOMMENDS_packagegroup-core-sdk = "\
libgomp \
- libgomp-dev"
+ libgomp-dev \
+ ${SANITIZERS}"
#python generate_sdk_pkgs () {
# poky_pkgs = read_pkgdata('packagegroup-core', d)['PACKAGES']
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-ssh-dropbear.bb b/meta/recipes-core/packagegroups/packagegroup-core-ssh-dropbear.bb
index 458d8fa036..e99946f0a7 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-ssh-dropbear.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-ssh-dropbear.bb
@@ -4,9 +4,4 @@ PR = "r1"
inherit packagegroup
-# For backwards compatibility after rename
-RPROVIDES_${PN} = "task-core-ssh-dropbear"
-RREPLACES_${PN} = "task-core-ssh-dropbear"
-RCONFLICTS_${PN} = "task-core-ssh-dropbear"
-
RDEPENDS_${PN} = "dropbear"
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-ssh-openssh.bb b/meta/recipes-core/packagegroups/packagegroup-core-ssh-openssh.bb
index df70962912..32d20e6214 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-ssh-openssh.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-ssh-openssh.bb
@@ -4,9 +4,4 @@ PR = "r1"
inherit packagegroup
-# For backwards compatibility after rename
-RPROVIDES_${PN} = "task-core-ssh-openssh"
-RREPLACES_${PN} = "task-core-ssh-openssh"
-RCONFLICTS_${PN} = "task-core-ssh-openssh"
-
RDEPENDS_${PN} = "openssh"
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bb b/meta/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bb
index 3325ef672e..154a55cea2 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bb
@@ -4,17 +4,10 @@ LICENSE = "MIT"
inherit packagegroup
-# For backwards compatibility after rename
-RPROVIDES_${PN} = "task-core-standalone-sdk-target"
-RREPLACES_${PN} = "task-core-standalone-sdk-target"
-RCONFLICTS_${PN} = "task-core-standalone-sdk-target"
-RPROVIDES_${PN}-dbg = "task-core-standalone-sdk-target-dbg"
-RREPLACES_${PN}-dbg = "task-core-standalone-sdk-target-dbg"
-RCONFLICTS_${PN}-dbg = "task-core-standalone-sdk-target-dbg"
-
RDEPENDS_${PN} = "\
libgcc \
libgcc-dev \
+ libgcov-dev \
libstdc++ \
libstdc++-dev \
${LIBC_DEPENDENCIES} \
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-tools-debug.bb b/meta/recipes-core/packagegroups/packagegroup-core-tools-debug.bb
index f72aae4c9d..82347b975d 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-tools-debug.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-tools-debug.bb
@@ -7,14 +7,7 @@ LICENSE = "MIT"
inherit packagegroup
-PR = "r2"
-
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
-# For backwards compatibility after rename
-RPROVIDES_${PN} = "task-core-tools-debug"
-RREPLACES_${PN} = "task-core-tools-debug"
-RCONFLICTS_${PN} = "task-core-tools-debug"
+PR = "r3"
MTRACE = ""
MTRACE_libc-glibc = "libc-mtrace"
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb b/meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb
index 7832c89d23..6f4842f182 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb
@@ -7,16 +7,13 @@ LICENSE = "MIT"
PR = "r3"
-inherit packagegroup
-
PACKAGE_ARCH = "${MACHINE_ARCH}"
-# For backwards compatibility after rename
-RPROVIDES_${PN} = "task-core-tools-profile"
-RREPLACES_${PN} = "task-core-tools-profile"
-RCONFLICTS_${PN} = "task-core-tools-profile"
+inherit packagegroup
PROFILE_TOOLS_X = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'sysprof', '', d)}"
+# sysprof doesn't support aarch64
+PROFILE_TOOLS_X_aarch64 = ""
PROFILE_TOOLS_SYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-analyze', '', d)}"
RRECOMMENDS_${PN} = "\
@@ -41,6 +38,7 @@ SYSTEMTAP = "systemtap"
SYSTEMTAP_libc-uclibc = ""
SYSTEMTAP_mips = ""
SYSTEMTAP_mips64 = ""
+SYSTEMTAP_mips64n32 = ""
SYSTEMTAP_aarch64 = ""
# lttng-ust uses sched_getcpu() which is not there on uclibc
@@ -58,7 +56,6 @@ LTTNGTOOLS_aarch64 = ""
LTTNGMODULES = "lttng-modules"
LTTNGMODULES_aarch64 = ""
-LTTNGMODULES_arm = ""
BABELTRACE = "babeltrace"
BABELTRACE_aarch64 = ""
@@ -69,6 +66,7 @@ VALGRIND = "valgrind"
VALGRIND_libc-uclibc = ""
VALGRIND_mips = ""
VALGRIND_mips64 = ""
+VALGRIND_mips64n32 = ""
VALGRIND_arm = ""
VALGRIND_aarch64 = ""
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-tools-testapps.bb b/meta/recipes-core/packagegroups/packagegroup-core-tools-testapps.bb
index c7667540c9..4177c450aa 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-tools-testapps.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-tools-testapps.bb
@@ -7,14 +7,9 @@ LICENSE = "MIT"
PR = "r2"
-inherit packagegroup
-
PACKAGE_ARCH = "${MACHINE_ARCH}"
-# For backwards compatibility after rename
-RPROVIDES_${PN} = "task-core-tools-testapps"
-RREPLACES_${PN} = "task-core-tools-testapps"
-RCONFLICTS_${PN} = "task-core-tools-testapps"
+inherit packagegroup
# kexec-tools doesn't work on Mips
KEXECTOOLS ?= "kexec"
@@ -35,7 +30,7 @@ X11GLTOOLS = "\
X11TOOLS = "\
fstests \
- owl-video \
+ gst-player-bin \
x11perf \
xrestop \
xwininfo \
diff --git a/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb b/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb
index 8e3b917c75..47589b6ad6 100644
--- a/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb
@@ -7,7 +7,9 @@ DESCRIPTION = "Packages required to run the build system"
PR = "r13"
LICENSE = "MIT"
-inherit packagegroup
+inherit packagegroup distro_features_check
+# rdepends on libx11-dev
+REQUIRED_DISTRO_FEATURES = "x11"
PACKAGES = "\
packagegroup-self-hosted \
@@ -29,6 +31,7 @@ RDEPENDS_packagegroup-self-hosted = "\
# midori depends on webkit-gtk which could not build for mips64
MIDORI = "midori"
MIDORI_mips64 = ""
+MIDORI_mips64n32 = ""
RDEPENDS_packagegroup-self-hosted-host-tools = "\
connman \
@@ -41,19 +44,14 @@ RDEPENDS_packagegroup-self-hosted-host-tools = "\
hdparm \
iptables \
lsb \
- xdg-utils \
mc \
mc-fish \
mc-helpers \
mc-helpers-perl \
mc-helpers-python \
- leafpad \
- ${MIDORI} \
- pcmanfm \
parted \
pseudo \
screen \
- vte \
"
RRECOMMENDS_packagegroup-self-hosted-host-tools = "\
@@ -64,7 +62,7 @@ RRECOMMENDS_packagegroup-self-hosted-host-tools = "\
kernel-module-iptable-filter \
"
-# eglibc-utils: for rpcgen
+# glibc-utils: for rpcgen
RDEPENDS_packagegroup-self-hosted-sdk = "\
autoconf \
automake \
@@ -75,8 +73,8 @@ RDEPENDS_packagegroup-self-hosted-sdk = "\
cpp \
cpp-symlinks \
distcc \
- eglibc-utils \
- eglibc-gconv-ibm850 \
+ glibc-utils \
+ glibc-gconv-ibm850 \
file \
findutils \
g++ \
@@ -125,6 +123,7 @@ RDEPENDS_packagegroup-self-hosted-extended = "\
gettext \
gettext-runtime \
git \
+ git-perltools \
grep \
groff \
gzip \
@@ -158,37 +157,11 @@ RDEPENDS_packagegroup-self-hosted-extended = "\
perl-pod \
${PTH} \
python \
- python-compile \
python-compiler \
- python-compression \
- python-core \
- python-curses \
- python-datetime \
- python-difflib \
- python-distutils \
- python-elementtree \
- python-email \
- python-fcntl \
python-git \
- python-json \
- python-logging \
python-misc \
- python-mmap \
- python-multiprocessing \
- python-netclient \
- python-netserver \
- python-pickle \
- python-pkgutil \
- python-pprint \
- python-re \
+ python-modules \
python-rpm \
- python-shell \
- python-sqlite3 \
- python-subprocess \
- python-textutils \
- python-unittest \
- python-unixadmin \
- python-xmlrpc \
quota \
readline \
rpm \
@@ -224,6 +197,11 @@ RDEPENDS_packagegroup-self-hosted-graphics = "\
libx11-dev \
python-pygtk \
gtk-theme-clearlooks \
+ xdg-utils \
+ ${MIDORI} \
+ leafpad \
+ pcmanfm \
+ vte \
"
PTH = "pth"
PTH_libc-uclibc = ""
diff --git a/meta/recipes-core/psplash/psplash_git.bb b/meta/recipes-core/psplash/psplash_git.bb
index 628ced4d49..7f0dc7859f 100644
--- a/meta/recipes-core/psplash/psplash_git.bb
+++ b/meta/recipes-core/psplash/psplash_git.bb
@@ -5,7 +5,7 @@ SECTION = "base"
LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://psplash.h;beginline=1;endline=16;md5=840fb2356b10a85bed78dd09dc7745c6"
-SRCREV = "afd4e228c606a9998feae44a3fed4474803240b7"
+SRCREV = "14c8f7b705de944beb4de3f296506d80871e410f"
PV = "0.1+git${SRCPV}"
PR = "r15"
@@ -109,3 +109,13 @@ 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)}"
+pkg_postinst_${PN} () {
+ if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+ if [ -n "$D" ]; then
+ OPTS="--root=$D"
+ fi
+ systemctl $OPTS mask psplash.service
+ fi
+}
diff --git a/meta/recipes-core/readline/readline-6.3/readline-dispatch-multikey.patch b/meta/recipes-core/readline/readline-6.3/readline-dispatch-multikey.patch
new file mode 100644
index 0000000000..54d1ac6eb9
--- /dev/null
+++ b/meta/recipes-core/readline/readline-6.3/readline-dispatch-multikey.patch
@@ -0,0 +1,32 @@
+From 8ef852a5be72c75e17f2510bea52455f809b56ce Mon Sep 17 00:00:00 2001
+From: Chet Ramey <chet.ramey@case.edu>
+Date: Fri, 28 Mar 2014 14:07:42 -0400
+Subject: [PATCH 04/10] Readline-6.3 patch 2
+
+Fixes multi-key issue identified in this thread:
+http://lists.gnu.org/archive/html/bug-readline/2014-03/msg00010.html
+
+Upstream-Status: Backport
+
+Signed-off-by: Saul Wold <sgw@linux.intel.com>
+---
+ readline.c | 3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+diff --git a/readline.c b/readline.c
+index eb4eae3..abb29a0 100644
+--- a/readline.c
++++ b/readline.c
+@@ -744,7 +744,8 @@ _rl_dispatch_callback (cxt)
+ r = _rl_subseq_result (r, cxt->oldmap, cxt->okey, (cxt->flags & KSEQ_SUBSEQ));
+
+ RL_CHECK_SIGNALS ();
+- if (r == 0) /* success! */
++ /* We only treat values < 0 specially to simulate recursion. */
++ if (r >= 0 || (r == -1 && (cxt->flags & KSEQ_SUBSEQ) == 0)) /* success! or failure! */
+ {
+ _rl_keyseq_chain_dispose ();
+ RL_UNSETSTATE (RL_STATE_MULTIKEY);
+--
+1.8.3.1
+
diff --git a/meta/recipes-core/readline/readline-6.3/readline63-003 b/meta/recipes-core/readline/readline-6.3/readline63-003
new file mode 100644
index 0000000000..98a9d810b6
--- /dev/null
+++ b/meta/recipes-core/readline/readline-6.3/readline63-003
@@ -0,0 +1,43 @@
+readline: Security Advisory - readline - CVE-2014-2524
+
+Upstream-Status: Backport
+
+Signed-off-by: Yue Tao <yue.tao@windriver.com>
+
+ READLINE PATCH REPORT
+ =====================
+
+Readline-Release: 6.3
+Patch-ID: readline63-003
+
+Bug-Reported-by:
+Bug-Reference-ID:
+Bug-Reference-URL:
+
+Bug-Description:
+
+There are debugging functions in the readline release that are theoretically
+exploitable as security problems. They are not public functions, but have
+global linkage.
+
+Patch (apply with `patch -p0'):
+
+*** ../readline-6.3/util.c 2013-09-02 13:36:12.000000000 -0400
+--- util.c 2014-03-20 10:25:53.000000000 -0400
+***************
+*** 477,480 ****
+--- 479,483 ----
+ }
+
++ #if defined (DEBUG)
+ #if defined (USE_VARARGS)
+ static FILE *_rl_tracefp;
+***************
+*** 539,542 ****
+--- 542,546 ----
+ }
+ #endif
++ #endif /* DEBUG */
+
+
+
diff --git a/meta/recipes-core/readline/readline.inc b/meta/recipes-core/readline/readline.inc
index 0ce3b519e6..3f662c3070 100644
--- a/meta/recipes-core/readline/readline.inc
+++ b/meta/recipes-core/readline/readline.inc
@@ -16,8 +16,6 @@ SRC_URI = "${GNU_MIRROR}/readline/${BPN}-${PV}.tar.gz;name=archive \
file://config-dirent-symbols.patch \
file://norpath.patch"
-S = "${WORKDIR}/${BPN}-${PV}"
-
inherit autotools texinfo
EXTRA_AUTORECONF += "--exclude=autoheader"
diff --git a/meta/recipes-core/readline/readline_5.2.bb b/meta/recipes-core/readline/readline_5.2.bb
index fe610e3964..c1007a2311 100644
--- a/meta/recipes-core/readline/readline_5.2.bb
+++ b/meta/recipes-core/readline/readline_5.2.bb
@@ -63,8 +63,6 @@ SRC_URI[patch13.sha256sum] = "0cc649516a5bdfa61c5e56937407570288b6972d75aa1bd060
SRC_URI[patch14.md5sum] = "a1be30e1c6f1099bb5fcef00a2631fb8"
SRC_URI[patch14.sha256sum] = "6f1a68320d01522ca1ea5a737124ecc8739f3dcbfea2dee21e3ccf839a21a817"
-S = "${WORKDIR}/${BPN}-${PV}"
-
inherit autotools
EXTRA_AUTORECONF += "--exclude=autoheader"
diff --git a/meta/recipes-core/readline/readline_6.3.bb b/meta/recipes-core/readline/readline_6.3.bb
index aa30f668b4..55964a6cf8 100644
--- a/meta/recipes-core/readline/readline_6.3.bb
+++ b/meta/recipes-core/readline/readline_6.3.bb
@@ -1,5 +1,8 @@
require readline.inc
+SRC_URI += "file://readline63-003 \
+ file://readline-dispatch-multikey.patch"
+
SRC_URI[archive.md5sum] = "33c8fb279e981274f485fd91da77e94a"
SRC_URI[archive.sha256sum] = "56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43"
diff --git a/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service b/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service
index 6dd335c0bc..182167befe 100644
--- a/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service
+++ b/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service
@@ -21,7 +21,7 @@ IgnoreOnIsolate=yes
[Service]
Environment="TERM=xterm"
-ExecStart=-/sbin/agetty -8 --keep-baud %I @BAUDRATE@ $TERM
+ExecStart=-/sbin/agetty -8 -L --keep-baud %I @BAUDRATE@ $TERM
Type=idle
Restart=always
RestartSec=0
diff --git a/meta/recipes-core/systemd/systemd-systemctl-native.bb b/meta/recipes-core/systemd/systemd-systemctl-native.bb
index 72bc77df4f..fbdc9c0a18 100644
--- a/meta/recipes-core/systemd/systemd-systemctl-native.bb
+++ b/meta/recipes-core/systemd/systemd-systemctl-native.bb
@@ -9,6 +9,8 @@ inherit native
SRC_URI = "file://systemctl"
+S = "${WORKDIR}"
+
do_install() {
install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/systemctl ${D}${bindir}
diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl
index b37f27abfb..6e163bd5c2 100755
--- a/meta/recipes-core/systemd/systemd-systemctl/systemctl
+++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl
@@ -77,18 +77,31 @@ for service in $services; do
exit 0
fi
- echo "Try to find location of $service..."
+ service_base_file=`echo $service | sed 's/\(@\).*\(\.[^.]\+\)/\1\2/'`
+ if [ -z `echo $service | sed '/@/p;d'` ]; then
+ echo "Try to find location of $service..."
+ service_template=false
+ else
+ echo "Try to find location of template $service_base_file of instance $service..."
+ service_template=true
+ if [ -z `echo $service | sed 's/^.\+@\(.*\)\.[^.]\+/\1/'` ]; then
+ instance_specified=false
+ else
+ instance_specified=true
+ fi
+ fi
+
# find service file
for p in $ROOT/etc/systemd/system \
$ROOT/lib/systemd/system \
$ROOT/usr/lib/systemd/system; do
- if [ -e $p/$service ]; then
- service_file=$p/$service
+ if [ -e $p/$service_base_file ]; then
+ service_file=$p/$service_base_file
service_file=${service_file##$ROOT}
fi
done
if [ -z "$service_file" ]; then
- echo "'$service' couldn't be found; exiting with error"
+ echo "'$service_base_file' couldn't be found; exiting with error"
exit 1
fi
echo "Found $service in $service_file"
@@ -115,13 +128,29 @@ for service in $services; do
for r in $wanted_by; do
echo "WantedBy=$r found in $service"
if [ "$action" = "enable" ]; then
+ enable_service=$service
+ if [ "$service_template" = true -a "$instance_specified" = false ]; then
+ default_instance=$(sed '/^DefaultInstance[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file")
+ if [ -z $default_instance ]; then
+ echo "Template unit without instance or DefaultInstance directive, nothing to enable"
+ continue
+ else
+ echo "Found DefaultInstance $default_instance, enabling it"
+ enable_service=$(echo $service | sed "s/@/@$default_instance/")
+ fi
+ fi
mkdir -p $ROOT/etc/systemd/system/$r.wants
- ln -s $service_file $ROOT/etc/systemd/system/$r.wants
- echo "Enabled $service for $wanted_by."
+ ln -s $service_file $ROOT/etc/systemd/system/$r.wants/$enable_service
+ echo "Enabled $enable_service for $wanted_by."
else
- rm -f $ROOT/etc/systemd/system/$r.wants/$service
- rmdir --ignore-fail-on-non-empty -p $ROOT/etc/systemd/system/$r.wants
- echo "Disabled $service for $wanted_by."
+ if [ "$service_template" = true -a "$instance_specified" = false ]; then
+ disable_service="$ROOT/etc/systemd/system/$r.wants/`echo $service | sed 's/@/@*/'`"
+ else
+ disable_service="$ROOT/etc/systemd/system/$r.wants/$service"
+ fi
+ rm -f $disable_service
+ [ -d $ROOT/etc/systemd/system/$r.wants ] && rmdir --ignore-fail-on-non-empty -p $ROOT/etc/systemd/system/$r.wants
+ echo "Disabled ${disable_service##$ROOT/etc/systemd/system/$r.wants/} for $wanted_by."
fi
done
diff --git a/meta/recipes-core/systemd/systemd/00-create-volatile.conf b/meta/recipes-core/systemd/systemd/00-create-volatile.conf
index 9ffa88e464..87cbe1e7d3 100644
--- a/meta/recipes-core/systemd/systemd/00-create-volatile.conf
+++ b/meta/recipes-core/systemd/systemd/00-create-volatile.conf
@@ -4,4 +4,4 @@
d /var/volatile/log - - - -
-d /var/volatile/tmp - - - -
+d /var/volatile/tmp 1777 - -
diff --git a/meta/recipes-core/systemd/systemd/0001-tmpfiles-avoid-creating-duplicate-acl-entries.patch b/meta/recipes-core/systemd/systemd/0001-tmpfiles-avoid-creating-duplicate-acl-entries.patch
new file mode 100644
index 0000000000..6652e28e23
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-tmpfiles-avoid-creating-duplicate-acl-entries.patch
@@ -0,0 +1,134 @@
+Upstream-Status: Backport
+Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca>
+
+From 33d36e28b0a23fb7ac33435a1329d65bff1ba4ec Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
+Date: Mon, 23 Feb 2015 23:19:54 -0500
+Subject: [PATCH] tmpfiles: avoid creating duplicate acl entries
+
+https://bugs.freedesktop.org/show_bug.cgi?id=89202
+https://bugs.debian.org/778656
+
+Status quo ante can be restored with:
+ getfacl -p /var/log/journal/`cat /etc/machine-id`|grep -v '^#'|sort -u|sudo setfacl --set-file=- /var/log/journal/`cat /etc/machine-id`
+
+(cherry picked from commit 1c73f3bc29111a00738569c9d40a989b161a0624)
+---
+ src/shared/acl-util.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++--
+ src/shared/acl-util.h | 4 +++
+ 2 files changed, 81 insertions(+), 2 deletions(-)
+
+diff --git a/src/shared/acl-util.c b/src/shared/acl-util.c
+index a4ff1ab..cbe09d7 100644
+--- a/src/shared/acl-util.c
++++ b/src/shared/acl-util.c
+@@ -282,6 +282,77 @@ int parse_acl(char *text, acl_t *acl_access, acl_t *acl_default, bool want_mask)
+ return 0;
+ }
+
++static int acl_entry_equal(acl_entry_t a, acl_entry_t b) {
++ acl_tag_t tag_a, tag_b;
++
++ if (acl_get_tag_type(a, &tag_a) < 0)
++ return -errno;
++
++ if (acl_get_tag_type(b, &tag_b) < 0)
++ return -errno;
++
++ if (tag_a != tag_b)
++ return false;
++
++ switch (tag_a) {
++ case ACL_USER_OBJ:
++ case ACL_GROUP_OBJ:
++ case ACL_MASK:
++ case ACL_OTHER:
++ /* can have only one of those */
++ return true;
++ case ACL_USER: {
++ _cleanup_(acl_free_uid_tpp) uid_t *uid_a, *uid_b;
++
++ uid_a = acl_get_qualifier(a);
++ if (!uid_a)
++ return -errno;
++
++ uid_b = acl_get_qualifier(b);
++ if (!uid_b)
++ return -errno;
++
++ return *uid_a == *uid_b;
++ }
++ case ACL_GROUP: {
++ _cleanup_(acl_free_gid_tpp) gid_t *gid_a, *gid_b;
++
++ gid_a = acl_get_qualifier(a);
++ if (!gid_a)
++ return -errno;
++
++ gid_b = acl_get_qualifier(b);
++ if (!gid_b)
++ return -errno;
++
++ return *gid_a == *gid_b;
++ }
++ default:
++ assert_not_reached("Unknown acl tag type");
++ }
++}
++
++static int find_acl_entry(acl_t acl, acl_entry_t entry, acl_entry_t *out) {
++ acl_entry_t i;
++ int r;
++
++ for (r = acl_get_entry(acl, ACL_FIRST_ENTRY, &i);
++ r > 0;
++ r = acl_get_entry(acl, ACL_NEXT_ENTRY, &i)) {
++
++ r = acl_entry_equal(i, entry);
++ if (r < 0)
++ return r;
++ if (r > 0) {
++ *out = i;
++ return 1;
++ }
++ }
++ if (r < 0)
++ return -errno;
++ return 0;
++}
++
+ int acls_for_file(const char *path, acl_type_t type, acl_t new, acl_t *acl) {
+ _cleanup_(acl_freep) acl_t old;
+ acl_entry_t i;
+@@ -297,8 +368,12 @@ int acls_for_file(const char *path, acl_type_t type, acl_t new, acl_t *acl) {
+
+ acl_entry_t j;
+
+- if (acl_create_entry(&old, &j) < 0)
+- return -errno;
++ r = find_acl_entry(old, i, &j);
++ if (r < 0)
++ return r;
++ if (r == 0)
++ if (acl_create_entry(&old, &j) < 0)
++ return -errno;
+
+ if (acl_copy_entry(j, i) < 0)
+ return -errno;
+diff --git a/src/shared/acl-util.h b/src/shared/acl-util.h
+index 90e88ff..fdb9006 100644
+--- a/src/shared/acl-util.h
++++ b/src/shared/acl-util.h
+@@ -41,5 +41,9 @@ int acls_for_file(const char *path, acl_type_t type, acl_t new, acl_t *acl);
+ DEFINE_TRIVIAL_CLEANUP_FUNC(acl_t, acl_free);
+ #define acl_free_charp acl_free
+ DEFINE_TRIVIAL_CLEANUP_FUNC(char*, acl_free_charp);
++#define acl_free_uid_tp acl_free
++DEFINE_TRIVIAL_CLEANUP_FUNC(uid_t*, acl_free_uid_tp);
++#define acl_free_gid_tp acl_free
++DEFINE_TRIVIAL_CLEANUP_FUNC(gid_t*, acl_free_gid_tp);
+
+ #endif
+--
+2.3.1
+
diff --git a/meta/recipes-core/systemd/systemd/0001-uClibc-doesn-t-implement-pwritev-preadv.patch b/meta/recipes-core/systemd/systemd/0001-uClibc-doesn-t-implement-pwritev-preadv.patch
deleted file mode 100644
index 9fdb3c9ab3..0000000000
--- a/meta/recipes-core/systemd/systemd/0001-uClibc-doesn-t-implement-pwritev-preadv.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-Upstream-Status: Inappropriate [uclibc specific]
-
-From 7be9273548bcb1f57d011fc252965e45dd2a058c Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 21 Aug 2013 19:09:27 -0700
-Subject: [PATCH] uClibc doesn't implement pwritev/preadv
-
-Lets stub out the testcase for building.
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- src/libsystemd-bus/test-bus-memfd.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-Index: systemd-209/src/libsystemd/sd-bus/test-bus-memfd.c
-===================================================================
---- systemd-209.orig/src/libsystemd/sd-bus/test-bus-memfd.c 2014-02-19 15:03:09.983254602 -0800
-+++ systemd-209/src/libsystemd/sd-bus/test-bus-memfd.c 2014-02-19 23:42:10.636652864 -0800
-@@ -151,6 +151,7 @@
- /* check content */
- assert_se(memcmp(buf, "ll", 2) == 0);
-
-+#ifndef __UCLIBC__
- /* writev it out*/
- iov[0].iov_base = (char *)"ABC";
- iov[0].iov_len = 3;
-@@ -173,6 +174,7 @@
- assert_se(memcmp(bufv[0], "ABC", 3) == 0);
- assert_se(memcmp(bufv[1], "DEF", 3) == 0);
- assert_se(memcmp(bufv[2], "GHI", 3) == 0);
-+#endif /* __UCLIBC__ */
-
- sd_memfd_free(m);
-
diff --git a/meta/recipes-core/systemd/systemd/0001-units-Prefer-getty-to-agetty-in-console-setup-system.patch b/meta/recipes-core/systemd/systemd/0001-units-Prefer-getty-to-agetty-in-console-setup-system.patch
new file mode 100644
index 0000000000..b6ab5effc2
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-units-Prefer-getty-to-agetty-in-console-setup-system.patch
@@ -0,0 +1,44 @@
+From 100e50604efc4032001a2de6a6b47853c0003817 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 20 Feb 2015 05:29:15 +0000
+Subject: [PATCH 01/11] units: Prefer getty to agetty in console setup systemd
+ units
+
+Upstream-Status: Inappropriate [configuration specific]
+
+Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ units/getty@.service.m4 | 2 +-
+ units/serial-getty@.service.m4 | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/units/getty@.service.m4 b/units/getty@.service.m4
+index 46164ab..bdf6ec8 100644
+--- a/units/getty@.service.m4
++++ b/units/getty@.service.m4
+@@ -27,7 +27,7 @@ ConditionPathExists=/dev/tty0
+
+ [Service]
+ # the VT is cleared by TTYVTDisallocate
+-ExecStart=-/sbin/agetty --noclear %I $TERM
++ExecStart=-/sbin/getty -L %I $TERM
+ Type=idle
+ Restart=always
+ RestartSec=0
+diff --git a/units/serial-getty@.service.m4 b/units/serial-getty@.service.m4
+index 4522d0d..e6d499d 100644
+--- a/units/serial-getty@.service.m4
++++ b/units/serial-getty@.service.m4
+@@ -22,7 +22,7 @@ Before=getty.target
+ IgnoreOnIsolate=yes
+
+ [Service]
+-ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
++ExecStart=-/sbin/getty -L 115200 %I $TERM
+ Type=idle
+ Restart=always
+ UtmpIdentifier=%I
+--
+2.1.4
+
diff --git a/meta/recipes-core/systemd/systemd/0002-shared-missing.h-fall-back-to-insecure-getenv.patch b/meta/recipes-core/systemd/systemd/0002-shared-missing.h-fall-back-to-insecure-getenv.patch
new file mode 100644
index 0000000000..1cf7840976
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0002-shared-missing.h-fall-back-to-insecure-getenv.patch
@@ -0,0 +1,25 @@
+From 03baade6db2cf83b44a157818ba827d725449bb0 Mon Sep 17 00:00:00 2001
+From: Emil Renner Berthing <systemd@esmil.dk>
+Date: Thu, 18 Sep 2014 15:24:47 +0200
+Subject: [PATCH 02/11] shared/missing.h: fall back to insecure getenv
+
+---
+ src/shared/missing.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/shared/missing.h b/src/shared/missing.h
+index b33a70c..11cca04 100644
+--- a/src/shared/missing.h
++++ b/src/shared/missing.h
+@@ -366,7 +366,7 @@ static inline int name_to_handle_at(int fd, const char *name, struct file_handle
+ # ifdef HAVE___SECURE_GETENV
+ # define secure_getenv __secure_getenv
+ # else
+-# error "neither secure_getenv nor __secure_getenv are available"
++# define secure_getenv getenv
+ # endif
+ #endif
+
+--
+2.1.4
+
diff --git a/meta/recipes-core/systemd/systemd/0002-tmpfiles-quietly-ignore-ACLs-on-unsupported-filesyst.patch b/meta/recipes-core/systemd/systemd/0002-tmpfiles-quietly-ignore-ACLs-on-unsupported-filesyst.patch
new file mode 100644
index 0000000000..c195437ba0
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0002-tmpfiles-quietly-ignore-ACLs-on-unsupported-filesyst.patch
@@ -0,0 +1,86 @@
+Upstream-Status: Backport
+Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca>
+
+From 31d05181e3a34c5c0ff6314d8eca1c3b4bb29423 Mon Sep 17 00:00:00 2001
+From: Hans-Peter Deifel <hpd@hpdeifel.de>
+Date: Tue, 3 Mar 2015 00:35:08 +0100
+Subject: [PATCH 2/2] tmpfiles: quietly ignore ACLs on unsupported filesystems
+
+A warning is printed if ACLs cannot be retrieved for any reason other
+than -ENOSYS. For -ENOSYS, debug log is printed.
+
+(cherry picked from commit d873e8778c92014c02a9122852758b436fa95c0e)
+---
+ src/tmpfiles/tmpfiles.c | 36 ++++++++++++++++++++----------------
+ 1 file changed, 20 insertions(+), 16 deletions(-)
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 88ba7e4..187997e 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -704,6 +704,9 @@ static int path_set_acl(const char *path, acl_type_t type, acl_t acl, bool modif
+ int r;
+ _cleanup_(acl_free_charpp) char *t = NULL;
+
++ /* Returns 0 for success, positive error if already warned,
++ * negative error otherwise. */
++
+ if (modify) {
+ r = acls_for_file(path, type, acl, &dup);
+ if (r < 0)
+@@ -731,35 +734,36 @@ static int path_set_acl(const char *path, acl_type_t type, acl_t acl, bool modif
+
+ r = acl_set_file(path, type, dup);
+ if (r < 0)
+- return log_error_errno(-errno,
+- "Setting %s ACL \"%s\" on %s failed: %m",
+- type == ACL_TYPE_ACCESS ? "access" : "default",
+- strna(t), path);
++ return -log_error_errno(errno,
++ "Setting %s ACL \"%s\" on %s failed: %m",
++ type == ACL_TYPE_ACCESS ? "access" : "default",
++ strna(t), path);
++
+ return 0;
+ }
+ #endif
+
+ static int path_set_acls(Item *item, const char *path) {
++ int r = 0;
+ #ifdef HAVE_ACL
+- int r;
+-
+ assert(item);
+ assert(path);
+
+- if (item->acl_access) {
++ if (item->acl_access)
+ r = path_set_acl(path, ACL_TYPE_ACCESS, item->acl_access, item->force);
+- if (r < 0)
+- return r;
+- }
+
+- if (item->acl_default) {
++ if (r == 0 && item->acl_default)
+ r = path_set_acl(path, ACL_TYPE_DEFAULT, item->acl_default, item->force);
+- if (r < 0)
+- return r;
+- }
+-#endif
+
+- return 0;
++ if (r > 0)
++ return -r; /* already warned */
++ else if (r == -ENOTSUP) {
++ log_debug_errno(r, "ACLs not supported by file system at %s", path);
++ return 0;
++ } else if (r < 0)
++ log_error_errno(r, "ACL operation on \"%s\" failed: %m", path);
++#endif
++ return r;
+ }
+
+ static int write_one_file(Item *i, const char *path) {
+--
+2.3.1
+
diff --git a/meta/recipes-core/systemd/systemd/binfmt-install.patch b/meta/recipes-core/systemd/systemd/0003-binfmt-Don-t-install-dependency-links-at-install-tim.patch
index c2d5099f24..c14cc6fdd6 100644
--- a/meta/recipes-core/systemd/systemd/binfmt-install.patch
+++ b/meta/recipes-core/systemd/systemd/0003-binfmt-Don-t-install-dependency-links-at-install-tim.patch
@@ -1,19 +1,33 @@
-Don't install dependency links at install time for the binfmt services, use
-[Install] blocks so that they get created when the service is enabled like a
-traditional service.
+From 184a89caacfa00f07e7275bca592bd7dda1b541e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 20 Feb 2015 05:03:44 +0000
+Subject: [PATCH 03/11] binfmt: Don't install dependency links at install time
+ for the binfmt services
-The [Install] blocks were rejected upstream as they don't have a way to "enable"
-it on install without static symlinks which can't be disabled, only masked. We
+use [Install] blocks so that they get created when the service is enabled
+like a traditional service.
+
+The [Install] blocks were rejected upstream as they don't have a way to
+"enable"
+it on install without static symlinks which can't be disabled, only
+masked. We
however can do that in a postinst.
Upstream-Status: Denied
+
Signed-off-by: Ross Burton <ross.burton@intel.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Makefile.am | 4 ----
+ units/proc-sys-fs-binfmt_misc.automount | 3 +++
+ units/systemd-binfmt.service.in | 5 +++++
+ 3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/Makefile.am b/Makefile.am
-index 7933de6..78acb6f 100644
+index ba63f68..0fb3f9f 100644
--- a/Makefile.am
+++ b/Makefile.am
-@@ -3133,10 +3133,6 @@ INSTALL_DIRS += \
+@@ -4838,10 +4838,6 @@ INSTALL_DIRS += \
$(prefix)/lib/binfmt.d \
$(sysconfdir)/binfmt.d
@@ -36,21 +50,25 @@ index 6be3893..709adef 100644
+[Install]
+WantedBy=sysinit.target
diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
-index 02dfe77..86d3481 100644
+index 34a5d52..617462b 100644
--- a/units/systemd-binfmt.service.in
+++ b/units/systemd-binfmt.service.in
-@@ -11,6 +11,7 @@ Documentation=man:systemd-binfmt.service(8) man:binfmt.d(5)
+@@ -11,6 +11,8 @@ Documentation=man:systemd-binfmt.service(8) man:binfmt.d(5)
Documentation=https://www.kernel.org/doc/Documentation/binfmt_misc.txt
DefaultDependencies=no
Conflicts=shutdown.target
+Wants=proc-sys-fs-binfmt_misc.automount
- After=systemd-readahead-collect.service systemd-readahead-replay.service proc-sys-fs-binfmt_misc.automount
++
+ After=proc-sys-fs-binfmt_misc.automount
Before=sysinit.target shutdown.target
ConditionPathIsReadWrite=/proc/sys/
-@@ -24,3 +25,6 @@ ConditionDirectoryNotEmpty=|/run/binfmt.d
+@@ -24,3 +26,6 @@ ConditionDirectoryNotEmpty=|/run/binfmt.d
Type=oneshot
RemainAfterExit=yes
ExecStart=@rootlibexecdir@/systemd-binfmt
+
+[Install]
+WantedBy=sysinit.target
+--
+2.1.4
+
diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch b/meta/recipes-core/systemd/systemd/0004-configure-Check-for-additional-features-that-uclibc-.patch
index 4639532236..dddb7da690 100644
--- a/meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch
+++ b/meta/recipes-core/systemd/systemd/0004-configure-Check-for-additional-features-that-uclibc-.patch
@@ -1,11 +1,24 @@
+From 4e2e8dbf3f23ab7dca32286cc0f37bff6ac49e22 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 20 Feb 2015 05:05:45 +0000
+Subject: [PATCH 04/11] configure: Check for additional features that uclibc
+ doesnt support
+
+This helps in supporting uclibc which does not have all features that
+glibc might have
+
Upstream-Status: Denied [no desire for uclibc support]
+
Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ configure.ac | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
-Index: git/configure.ac
-===================================================================
---- git.orig/configure.ac 2014-03-15 17:53:51.756340454 -0700
-+++ git/configure.ac 2014-03-15 18:07:34.888355897 -0700
-@@ -78,6 +78,24 @@
+diff --git a/configure.ac b/configure.ac
+index 9a2235b..a5b2e6e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -103,6 +103,24 @@ AS_IF([! ln --relative --help > /dev/null 2>&1], [AC_MSG_ERROR([*** ln doesn't s
M4_DEFINES=
@@ -30,3 +43,6 @@ Index: git/configure.ac
# gtkdocize greps for '^GTK_DOC_CHECK', so it needs to be on its own line
m4_ifdef([GTK_DOC_CHECK], [
GTK_DOC_CHECK([1.18],[--flavour no-tmpl])],
+--
+2.1.4
+
diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch b/meta/recipes-core/systemd/systemd/0005-nspawn-Use-execvpe-only-when-libc-supports-it.patch
index 7170a38af3..85279d68c2 100644
--- a/meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch
+++ b/meta/recipes-core/systemd/systemd/0005-nspawn-Use-execvpe-only-when-libc-supports-it.patch
@@ -1,20 +1,29 @@
+From a7417c2e6950d55c22c1b0d15783898b8ff229ef Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 20 Feb 2015 05:10:37 +0000
+Subject: [PATCH 05/11] nspawn: Use execvpe only when libc supports it
+
Upstream-Status: Denied [no desire for uclibc support]
+
Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/nspawn/nspawn.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
-Index: systemd-209/src/nspawn/nspawn.c
-===================================================================
---- systemd-209.orig/src/nspawn/nspawn.c 2014-02-19 15:03:09.000000000 -0800
-+++ systemd-209/src/nspawn/nspawn.c 2014-02-19 23:20:38.720628627 -0800
-@@ -91,6 +91,8 @@
- LINK_GUEST
- } LinkJournal;
+diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
+index 0d8d199..b597edb 100644
+--- a/src/nspawn/nspawn.c
++++ b/src/nspawn/nspawn.c
+@@ -129,6 +129,8 @@ typedef enum Volatile {
+ VOLATILE_STATE,
+ } Volatile;
+#include "config.h"
+
static char *arg_directory = NULL;
+ static char *arg_template = NULL;
static char *arg_user = NULL;
- static sd_id128_t arg_uuid = {};
-@@ -2045,7 +2047,12 @@
+@@ -4257,7 +4259,12 @@ int main(int argc, char *argv[]) {
a[0] = (char*) "/sbin/init";
execve(a[0], a, env_use);
} else if (argc > optind)
@@ -23,7 +32,10 @@ Index: systemd-209/src/nspawn/nspawn.c
+#else
+ environ = env_use;
+ execvp(argv[optind], argv + optind);
-+#endif /* HAVE_EXECVPE */
++#endif /* HAVE_EXECVPE */
else {
chdir(home ? home : "/root");
execle("/bin/bash", "-bash", NULL, env_use);
+--
+2.1.4
+
diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch b/meta/recipes-core/systemd/systemd/0006-journal-Use-posix-fallocate-only-if-available.patch
index f8e19ce172..631dd77465 100644
--- a/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch
+++ b/meta/recipes-core/systemd/systemd/0006-journal-Use-posix-fallocate-only-if-available.patch
@@ -1,19 +1,24 @@
-Upstream-Status: Denied [no desire for uclibc support]
+From 34a61b6c9eed3fad360066fb63132ebc7e0aaaa6 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 20 Feb 2015 05:12:48 +0000
+Subject: [PATCH 06/11] journal: Use posix fallocate only if available
+
+Some architecture ports in uclibc did not support it in past
-This patch is uclibc specific, thus not suitable for upstream.
+Upstream-Status: Denied [no desire for uclibc support]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
- src/journal/journal-file.c | 16 +++++++++++++++-
- src/journal/journald-kmsg.c | 16 ++++++++++++++--
- 2 files changed, 29 insertions(+), 3 deletions(-)
+ src/journal/journal-file.c | 16 +++++++++++++++-
+ src/journal/journald-kmsg.c | 15 ++++++++++++++-
+ 2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
-index f2f1f35..092f87b 100644
+index 2845e05..9431171 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
-@@ -38,6 +38,8 @@
+@@ -36,6 +36,8 @@
#include "compress.h"
#include "fsprg.h"
@@ -22,7 +27,7 @@ index f2f1f35..092f87b 100644
#define DEFAULT_DATA_HASH_TABLE_SIZE (2047ULL*sizeof(HashItem))
#define DEFAULT_FIELD_HASH_TABLE_SIZE (333ULL*sizeof(HashItem))
-@@ -314,7 +316,7 @@ static int journal_file_verify_header(JournalFile *f) {
+@@ -354,7 +356,7 @@ static int journal_file_fstat(JournalFile *f) {
static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size) {
uint64_t old_size, new_size;
@@ -31,7 +36,7 @@ index f2f1f35..092f87b 100644
assert(f);
-@@ -362,9 +364,21 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
+@@ -418,9 +420,21 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
/* Note that the glibc fallocate() fallback is very
inefficient, hence we try to minimize the allocation area
as we can. */
@@ -51,13 +56,13 @@ index f2f1f35..092f87b 100644
+
+#endif /* HAVE_POSIX_FALLOCATE */
- if (fstat(f->fd, &f->last_stat) < 0)
- return -errno;
+ f->header->arena_size = htole64(new_size - le64toh(f->header->header_size));
+
diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
-index 12992e7..dc4fa93 100644
+index c4216c4..a998ed5 100644
--- a/src/journal/journald-kmsg.c
+++ b/src/journal/journald-kmsg.c
-@@ -437,6 +437,7 @@ fail:
+@@ -436,6 +436,7 @@ fail:
int server_open_kernel_seqnum(Server *s) {
_cleanup_close_ int fd;
uint64_t *p;
@@ -65,28 +70,27 @@ index 12992e7..dc4fa93 100644
assert(s);
-@@ -449,8 +450,19 @@ int server_open_kernel_seqnum(Server *s) {
- log_error("Failed to open /run/systemd/journal/kernel-seqnum, ignoring: %m");
+@@ -449,7 +450,19 @@ int server_open_kernel_seqnum(Server *s) {
return 0;
}
--
+
- if (posix_fallocate(fd, 0, sizeof(uint64_t)) < 0) {
+#ifdef HAVE_POSIX_FALLOCATE
+ r = posix_fallocate(fd, 0, sizeof(uint64_t));
+#else
-+ /* Use good old method to write zeros into the journal file
-+ perhaps very inefficient yet working. */
-+ char *buf = alloca(sizeof(uint64_t));
-+ off_t oldpos = lseek(fd, 0, SEEK_CUR);
-+ bzero(buf, sizeof(uint64_t));
-+ lseek(fd, 0, SEEK_SET);
-+ r = write(fd, buf, sizeof(uint64_t));
-+ lseek(fd, oldpos, SEEK_SET);
++ /* Use good old method to write zeros into the journal file
++ perhaps very inefficient yet working. */
++ char *buf = alloca(sizeof(uint64_t));
++ off_t oldpos = lseek(fd, 0, SEEK_CUR);
++ bzero(buf, sizeof(uint64_t));
++ lseek(fd, 0, SEEK_SET);
++ r = write(fd, buf, sizeof(uint64_t));
++ lseek(fd, oldpos, SEEK_SET);
+#endif /* HAVE_POSIX_FALLOCATE */
-+ if (r < 0) {
- log_error("Failed to allocate sequential number file, ignoring: %m");
++ if (r < 0) {
+ log_error_errno(errno, "Failed to allocate sequential number file, ignoring: %m");
return 0;
}
--
-1.7.9.5
+2.1.4
diff --git a/meta/recipes-core/systemd/systemd/0007-util-Use-mkostemp-only-if-libc-supports-it.patch b/meta/recipes-core/systemd/systemd/0007-util-Use-mkostemp-only-if-libc-supports-it.patch
new file mode 100644
index 0000000000..29c20c010f
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0007-util-Use-mkostemp-only-if-libc-supports-it.patch
@@ -0,0 +1,42 @@
+From f771407d3e0288ca0c06a894194d3ddad69b9a8e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 20 Feb 2015 05:17:05 +0000
+Subject: [PATCH 07/11] util: Use mkostemp only if libc supports it
+
+Upstream-Status: Denied [no desire for uclibc support]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/util.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/src/shared/util.c b/src/shared/util.c
+index dc65280..72f4665 100644
+--- a/src/shared/util.c
++++ b/src/shared/util.c
+@@ -97,6 +97,8 @@
+ #include "def.h"
+ #include "sparse-endian.h"
+
++#include "config.h"
++
+ int saved_argc = 0;
+ char **saved_argv = NULL;
+
+@@ -6682,7 +6684,13 @@ int mkostemp_safe(char *pattern, int flags) {
+
+ u = umask(077);
+
++#ifdef HAVE_MKOSTEMP
+ fd = mkostemp(pattern, flags);
++#else
++ fd = mkstemp(pattern);
++ if (fd >= 0) fcntl(fd, F_SETFD, flags);
++#endif /* HAVE_MKOSTEMP */
++
+ if (fd < 0)
+ return -errno;
+
+--
+2.1.4
+
diff --git a/meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch b/meta/recipes-core/systemd/systemd/0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch
index 39dfc9e2ea..5297625c93 100644
--- a/meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch
+++ b/meta/recipes-core/systemd/systemd/0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch
@@ -1,18 +1,24 @@
-bypass unimplemented _SC_PHYS_PAGES system configuration API in uclibc
+From b45ea3bfd6635744c8a6b74d0ac701b44bb1d294 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 20 Feb 2015 05:19:37 +0000
+Subject: [PATCH 08/11] util: bypass unimplemented _SC_PHYS_PAGES system
+ configuration API on uclibc
Upstream-Status: Inappropriate [uclibc-specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/util.c | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
-Index: git/src/shared/util.c
-===================================================================
---- git.orig/src/shared/util.c 2014-03-15 18:09:34.796358146 -0700
-+++ git/src/shared/util.c 2014-03-15 20:16:33.836501084 -0700
-@@ -6332,11 +6332,24 @@
-
+diff --git a/src/shared/util.c b/src/shared/util.c
+index 72f4665..cbbe3b1 100644
+--- a/src/shared/util.c
++++ b/src/shared/util.c
+@@ -6793,10 +6793,25 @@ uint64_t physical_memory(void) {
/* We return this as uint64_t in case we are running as 32bit
* process on a 64bit kernel with huge amounts of memory */
--
+
+#ifdef __UCLIBC__
+ char line[128];
+ FILE *f = fopen("/proc/meminfo", "r");
@@ -29,9 +35,12 @@ Index: git/src/shared/util.c
+#else
mem = sysconf(_SC_PHYS_PAGES);
assert(mem > 0);
--
+
return (uint64_t) mem * (uint64_t) page_size();
+#endif
}
- char* mount_test_option(const char *haystack, const char *needle) {
+ void hexdump(FILE *f, const void *p, size_t s) {
+--
+2.1.4
+
diff --git a/meta/recipes-core/systemd/systemd/0009-sysv-generator-add-support-for-executing-scripts-und.patch b/meta/recipes-core/systemd/systemd/0009-sysv-generator-add-support-for-executing-scripts-und.patch
new file mode 100644
index 0000000000..9ea3e83e52
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0009-sysv-generator-add-support-for-executing-scripts-und.patch
@@ -0,0 +1,143 @@
+From 8791b5b3934c55694872b6915a67340683ead91b Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 20 Feb 2015 05:22:52 +0000
+Subject: [PATCH 09/11] sysv-generator: add support for executing scripts under
+ /etc/rcS.d/
+
+To be compatible, all services translated from scripts under /etc/rcS.d would
+run before services translated from scripts under /etc/rcN.d.
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/sysv-generator/sysv-generator.c | 50 ++++++++++++++++++++++++++++---------
+ 1 file changed, 38 insertions(+), 12 deletions(-)
+
+diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
+index bd67f32..6756cc6 100644
+--- a/src/sysv-generator/sysv-generator.c
++++ b/src/sysv-generator/sysv-generator.c
+@@ -42,7 +42,8 @@
+
+ typedef enum RunlevelType {
+ RUNLEVEL_UP,
+- RUNLEVEL_DOWN
++ RUNLEVEL_DOWN,
++ RUNLEVEL_SYSINIT
+ } RunlevelType;
+
+ static const struct {
+@@ -57,6 +58,9 @@ static const struct {
+ { "rc4.d", SPECIAL_MULTI_USER_TARGET, RUNLEVEL_UP },
+ { "rc5.d", SPECIAL_GRAPHICAL_TARGET, RUNLEVEL_UP },
+
++ /* Debian style rcS.d, also adopted by OE */
++ { "rcS.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT},
++
+ /* Standard SysV runlevels for shutdown */
+ { "rc0.d", SPECIAL_POWEROFF_TARGET, RUNLEVEL_DOWN },
+ { "rc6.d", SPECIAL_REBOOT_TARGET, RUNLEVEL_DOWN }
+@@ -65,7 +69,7 @@ static const struct {
+ directories in this order, and we want to make sure that
+ sysv_start_priority is known when we first load the
+ unit. And that value we only know from S links. Hence
+- UP must be read before DOWN */
++ UP/SYSINIT must be read before DOWN */
+ };
+
+ typedef struct SysvStub {
+@@ -81,6 +85,8 @@ typedef struct SysvStub {
+ char **conflicts;
+ bool has_lsb;
+ bool reload;
++ bool default_dependencies;
++ bool from_rcsd;
+ } SysvStub;
+
+ const char *arg_dest = "/tmp";
+@@ -183,6 +189,9 @@ static int generate_unit_file(SysvStub *s) {
+ "Description=%s\n",
+ s->path, s->description);
+
++ if (!s->default_dependencies)
++ fprintf(f, "DefaultDependencies=no\n");
++
+ if (!isempty(before))
+ fprintf(f, "Before=%s\n", before);
+ if (!isempty(after))
+@@ -704,18 +713,30 @@ static int fix_order(SysvStub *s, Hashmap *all_services) {
+ if (s->has_lsb && other->has_lsb)
+ continue;
+
+- if (other->sysv_start_priority < s->sysv_start_priority) {
+- r = strv_extend(&s->after, other->name);
++ /* All scripts under /etc/rcS.d should execute before scripts under
++ * /etc/rcN.d */
++ if (!other->from_rcsd && s->from_rcsd) {
++ r = strv_extend(&s->before, other->name);
+ if (r < 0)
+ return log_oom();
+- }
+- else if (other->sysv_start_priority > s->sysv_start_priority) {
+- r = strv_extend(&s->before, other->name);
++ } else if (other->from_rcsd && !s->from_rcsd) {
++ r = strv_extend(&s->after, other->name);
+ if (r < 0)
+ return log_oom();
+- }
+- else
+- continue;
++ } else {
++ if (other->sysv_start_priority < s->sysv_start_priority) {
++ r = strv_extend(&s->after, other->name);
++ if (r < 0)
++ return log_oom();
++ }
++ else if (other->sysv_start_priority > s->sysv_start_priority) {
++ r = strv_extend(&s->before, other->name);
++ if (r < 0)
++ return log_oom();
++ }
++ else
++ continue;
++ }
+
+ /* FIXME: Maybe we should compare the name here lexicographically? */
+ }
+@@ -778,6 +799,8 @@ static int enumerate_sysv(LookupPaths lp, Hashmap *all_services) {
+ return log_oom();
+
+ service->sysv_start_priority = -1;
++ service->default_dependencies = true;
++ service->from_rcsd = false;
+ service->name = name;
+ service->path = fpath;
+
+@@ -864,9 +887,11 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) {
+
+ if (de->d_name[0] == 'S') {
+
+- if (rcnd_table[i].type == RUNLEVEL_UP) {
++ if (rcnd_table[i].type == RUNLEVEL_UP || rcnd_table[i].type == RUNLEVEL_SYSINIT) {
+ service->sysv_start_priority =
+ MAX(a*10 + b, service->sysv_start_priority);
++ service->default_dependencies = (rcnd_table[i].type == RUNLEVEL_SYSINIT)?false:true;
++ service->from_rcsd = (rcnd_table[i].type == RUNLEVEL_SYSINIT)?true:false;
+ }
+
+ r = set_ensure_allocated(&runlevel_services[i], NULL);
+@@ -878,7 +903,8 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) {
+ goto finish;
+
+ } else if (de->d_name[0] == 'K' &&
+- (rcnd_table[i].type == RUNLEVEL_DOWN)) {
++ (rcnd_table[i].type == RUNLEVEL_DOWN ||
++ rcnd_table[i].type == RUNLEVEL_SYSINIT)) {
+
+ r = set_ensure_allocated(&shutdown_services, NULL);
+ if (r < 0)
+--
+2.1.4
+
diff --git a/meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch b/meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch
new file mode 100644
index 0000000000..41b903951e
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch
@@ -0,0 +1,181 @@
+From 3dc731c1d270e2e143de621db9bd898299fd849d Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 20 Feb 2015 05:24:49 +0000
+Subject: [PATCH 10/11] Make root's home directory configurable
+
+OpenEmbedded has a configurable home directory for root. Allow
+systemd to be built using its idea of what root's home directory
+should be.
+
+Upstream-Status: Pending
+
+Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Makefile.am | 2 ++
+ configure.ac | 7 +++++++
+ src/core/unit-printf.c | 2 +-
+ src/nspawn/nspawn.c | 4 ++--
+ src/shared/util.c | 4 ++--
+ units/console-shell.service.m4.in | 4 ++--
+ units/emergency.service.in | 4 ++--
+ units/rescue.service.in | 4 ++--
+ 8 files changed, 20 insertions(+), 11 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 0fb3f9f..4623963 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -199,6 +199,7 @@ AM_CPPFLAGS = \
+ -DKEXEC=\"$(KEXEC)\" \
+ -DLIBDIR=\"$(libdir)\" \
+ -DROOTLIBDIR=\"$(rootlibdir)\" \
++ -DROOTHOMEDIR=\"$(roothomedir)\" \
+ -DTEST_DIR=\"$(abs_top_srcdir)/test\" \
+ -I $(top_srcdir)/src \
+ -I $(top_builddir)/src/shared \
+@@ -6342,6 +6343,7 @@ EXTRA_DIST += \
+ substitutions = \
+ '|rootlibexecdir=$(rootlibexecdir)|' \
+ '|rootbindir=$(rootbindir)|' \
++ '|roothomedir=$(roothomedir)|' \
+ '|bindir=$(bindir)|' \
+ '|SYSTEMCTL=$(rootbindir)/systemctl|' \
+ '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \
+diff --git a/configure.ac b/configure.ac
+index a5b2e6e..55bb7d8 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1428,6 +1428,11 @@ AC_ARG_WITH([rootlibdir],
+ [],
+ [with_rootlibdir=${libdir}])
+
++AC_ARG_WITH([roothomedir],
++ AS_HELP_STRING([--with-roothomedir=DIR], [Home directory for the root user]),
++ [],
++ [with_roothomedir=/root])
++
+ AC_ARG_WITH([pamlibdir],
+ AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]),
+ [],
+@@ -1518,6 +1523,7 @@ AC_SUBST([pamlibdir], [$with_pamlibdir])
+ AC_SUBST([pamconfdir], [$with_pamconfdir])
+ AC_SUBST([rootprefix], [$with_rootprefix])
+ AC_SUBST([rootlibdir], [$with_rootlibdir])
++AC_SUBST([roothomedir], [$with_roothomedir])
+
+ AC_CONFIG_FILES([
+ Makefile po/Makefile.in
+@@ -1617,6 +1623,7 @@ AC_MSG_RESULT([
+ include_prefix: ${INCLUDE_PREFIX}
+ lib dir: ${libdir}
+ rootlib dir: ${with_rootlibdir}
++ root home dir: ${with_roothomedir}
+ SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
+ SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
+ Build Python: ${PYTHON}
+diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c
+index 97135db..14d12f1 100644
+--- a/src/core/unit-printf.c
++++ b/src/core/unit-printf.c
+@@ -259,7 +259,7 @@ static int specifier_user_home(char specifier, void *data, void *userdata, char
+ * best of it if we can, but fail if we can't */
+
+ if (!c->user || streq(c->user, "root") || streq(c->user, "0"))
+- n = strdup("/root");
++ n = strdup(ROOTHOMEDIR);
+ else
+ return -ENOTSUP;
+
+diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
+index b597edb..0b32673 100644
+--- a/src/nspawn/nspawn.c
++++ b/src/nspawn/nspawn.c
+@@ -4192,7 +4192,7 @@ int main(int argc, char *argv[]) {
+ if (r < 0)
+ _exit(EXIT_FAILURE);
+
+- if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: "/root") < 0) ||
++ if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: ROOTHOMEDIR) < 0) ||
+ (asprintf((char**)(envp + n_env++), "USER=%s", arg_user ? arg_user : "root") < 0) ||
+ (asprintf((char**)(envp + n_env++), "LOGNAME=%s", arg_user ? arg_user : "root") < 0)) {
+ log_oom();
+@@ -4266,7 +4266,7 @@ int main(int argc, char *argv[]) {
+ execvp(argv[optind], argv + optind);
+ #endif /* HAVE_EXECVPE */
+ else {
+- chdir(home ? home : "/root");
++ chdir(home ? home : ROOTHOMEDIR);
+ execle("/bin/bash", "-bash", NULL, env_use);
+ execle("/bin/sh", "-sh", NULL, env_use);
+ }
+diff --git a/src/shared/util.c b/src/shared/util.c
+index cbbe3b1..a0e3cc5 100644
+--- a/src/shared/util.c
++++ b/src/shared/util.c
+@@ -4609,7 +4609,7 @@ int get_user_creds(
+ *gid = 0;
+
+ if (home)
+- *home = "/root";
++ *home = ROOTHOMEDIR;
+
+ if (shell)
+ *shell = "/bin/sh";
+@@ -5611,7 +5611,7 @@ int get_home_dir(char **_h) {
+ /* Hardcode home directory for root to avoid NSS */
+ u = getuid();
+ if (u == 0) {
+- h = strdup("/root");
++ h = strdup(ROOTHOMEDIR);
+ if (!h)
+ return -ENOMEM;
+
+diff --git a/units/console-shell.service.m4.in b/units/console-shell.service.m4.in
+index 5c80722..efde5f0 100644
+--- a/units/console-shell.service.m4.in
++++ b/units/console-shell.service.m4.in
+@@ -15,8 +15,8 @@ After=rc-local.service
+ Before=getty.target
+
+ [Service]
+-Environment=HOME=/root
+-WorkingDirectory=/root
++Environment=HOME=@roothomedir@
++WorkingDirectory=@roothomedir@
+ ExecStart=-@SULOGIN@
+ ExecStopPost=-@SYSTEMCTL@ poweroff
+ Type=idle
+diff --git a/units/emergency.service.in b/units/emergency.service.in
+index 2695d7b..7f47b73 100644
+--- a/units/emergency.service.in
++++ b/units/emergency.service.in
+@@ -14,8 +14,8 @@ Conflicts=rescue.service
+ Before=shutdown.target
+
+ [Service]
+-Environment=HOME=/root
+-WorkingDirectory=/root
++Environment=HOME=@roothomedir@
++WorkingDirectory=@roothomedir@
+ ExecStartPre=-/bin/plymouth quit
+ ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\ntry again to boot into default mode.'
+ ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --fail --no-block default"
+diff --git a/units/rescue.service.in b/units/rescue.service.in
+index de73fee..47f3593 100644
+--- a/units/rescue.service.in
++++ b/units/rescue.service.in
+@@ -14,8 +14,8 @@ After=sysinit.target plymouth-start.service
+ Before=shutdown.target
+
+ [Service]
+-Environment=HOME=/root
+-WorkingDirectory=/root
++Environment=HOME=@roothomedir@
++WorkingDirectory=@roothomedir@
+ ExecStartPre=-/bin/plymouth quit
+ ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\nboot into default mode.'
+ ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --fail --no-block default"
+--
+2.1.4
+
diff --git a/meta/recipes-core/systemd/systemd/0011-systemd-user-avoid-using-system-auth.patch b/meta/recipes-core/systemd/systemd/0011-systemd-user-avoid-using-system-auth.patch
new file mode 100644
index 0000000000..e562bca100
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0011-systemd-user-avoid-using-system-auth.patch
@@ -0,0 +1,31 @@
+From 7e202f71785bf5a67c8a4f6b58d3585608fbfdc4 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 20 Feb 2015 05:26:25 +0000
+Subject: [PATCH 11/11] systemd-user: avoid using system-auth
+
+In OE, we don't provide system-auth, instead, we use common-* files.
+So modify systemd-user file to use common-* files.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/login/systemd-user | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/login/systemd-user b/src/login/systemd-user
+index 8112d74..99635af 100644
+--- a/src/login/systemd-user
++++ b/src/login/systemd-user
+@@ -2,5 +2,5 @@
+ #
+ # Used by systemd --user instances.
+
+-account include system-auth
+-session include system-auth
++account include common-account
++session include common-session
+--
+2.1.4
+
diff --git a/meta/recipes-core/systemd/systemd/0012-systemd-tmpfiles.c-Honor-ordering-within-files-as-th.patch b/meta/recipes-core/systemd/systemd/0012-systemd-tmpfiles.c-Honor-ordering-within-files-as-th.patch
new file mode 100644
index 0000000000..ccd675798c
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0012-systemd-tmpfiles.c-Honor-ordering-within-files-as-th.patch
@@ -0,0 +1,185 @@
+From 2abf886295b979bce6d3f0a240f6f5ecfd70ba37 Mon Sep 17 00:00:00 2001
+From: Randy Witt <randy.e.witt@linux.intel.com>
+Date: Wed, 4 Mar 2015 18:32:40 -0800
+Subject: [PATCH] tmpfiles.c: Honor ordering within files as the docs say.
+
+Previously, globs would always get processed first followed by any other
+items in arbitrary order. This is contrary to the documentation which
+states "Otherwise, the files/directories are processed in the order they
+are listed."
+
+To fix this, remove the separate "globs" hashmap, and instead use only one
+marking each entry as a glob or not. There should be little overhead
+from doing this, considering the only time nested processing will occur
+is for processing of globs which are not of type "X".
+
+Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
+---
+ src/tmpfiles/tmpfiles.c | 53 ++++++++++++++++++++++---------------------------
+ 1 file changed, 24 insertions(+), 29 deletions(-)
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 917bb3c..0b6d226 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -116,6 +116,7 @@ typedef struct Item {
+ bool force:1;
+
+ bool done:1;
++ bool glob:1;
+ } Item;
+
+ typedef struct ItemArray {
+@@ -137,7 +138,7 @@ static const char conf_file_dirs[] = CONF_DIRS_NULSTR("tmpfiles");
+
+ #define MAX_DEPTH 256
+
+-static Hashmap *items = NULL, *globs = NULL;
++static OrderedHashmap *items = NULL;
+ static Set *unix_sockets = NULL;
+
+ static bool needs_glob(ItemType t) {
+@@ -176,17 +177,17 @@ static bool takes_ownership(ItemType t) {
+ RECURSIVE_REMOVE_PATH);
+ }
+
+-static struct Item* find_glob(Hashmap *h, const char *match) {
++static struct Item* find_glob(OrderedHashmap *h, const char *match) {
+ ItemArray *j;
+ Iterator i;
+
+- HASHMAP_FOREACH(j, h, i) {
++ ORDERED_HASHMAP_FOREACH(j, h, i) {
+ unsigned n;
+
+ for (n = 0; n < j->count; n++) {
+ Item *item = j->items + n;
+
+- if (fnmatch(item->path, match, FNM_PATHNAME|FNM_PERIOD) == 0)
++ if (item->glob && fnmatch(item->path, match, FNM_PATHNAME|FNM_PERIOD) == 0)
+ return item;
+ }
+ }
+@@ -391,12 +392,12 @@ static int dir_cleanup(
+ }
+
+ /* Is there an item configured for this path? */
+- if (hashmap_get(items, sub_path)) {
++ if (ordered_hashmap_get(items, sub_path)) {
+ log_debug("Ignoring \"%s\": a separate entry exists.", sub_path);
+ continue;
+ }
+
+- if (find_glob(globs, sub_path)) {
++ if (find_glob(items, sub_path)) {
+ log_debug("Ignoring \"%s\": a separate glob exists.", sub_path);
+ continue;
+ }
+@@ -1378,7 +1379,7 @@ static int process_item(Item *i) {
+ PATH_FOREACH_PREFIX(prefix, i->path) {
+ ItemArray *j;
+
+- j = hashmap_get(items, prefix);
++ j = ordered_hashmap_get(items, prefix);
+ if (j) {
+ int s;
+
+@@ -1505,7 +1506,6 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
+ _cleanup_free_ char *action = NULL, *mode = NULL, *user = NULL, *group = NULL, *age = NULL, *path = NULL;
+ _cleanup_(item_free_contents) Item i = {};
+ ItemArray *existing;
+- Hashmap *h;
+ int r, c = -1, pos;
+ bool force = false, boot = false;
+
+@@ -1739,9 +1739,9 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
+ i.age_set = true;
+ }
+
+- h = needs_glob(i.type) ? globs : items;
++ i.glob = needs_glob(i.type);
+
+- existing = hashmap_get(h, i.path);
++ existing = ordered_hashmap_get(items, i.path);
+ if (existing) {
+ unsigned n;
+
+@@ -1752,7 +1752,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
+ }
+ } else {
+ existing = new0(ItemArray, 1);
+- r = hashmap_put(h, i.path, existing);
++ r = ordered_hashmap_put(items, i.path, existing);
+ if (r < 0)
+ return log_oom();
+ }
+@@ -1911,14 +1911,20 @@ static int read_config_file(const char *fn, bool ignore_enoent) {
+ }
+
+ /* we have to determine age parameter for each entry of type X */
+- HASHMAP_FOREACH(i, globs, iterator) {
++ ORDERED_HASHMAP_FOREACH(i, items, iterator) {
+ Iterator iter;
+ Item *j, *candidate_item = NULL;
++ int number = 0;
+
++ if (!i->glob)
++ continue;
+ if (i->type != IGNORE_DIRECTORY_PATH)
+ continue;
+
+- HASHMAP_FOREACH(j, items, iter) {
++ ORDERED_HASHMAP_FOREACH(j, items, iter) {
++ number++;
++ if (j == i)
++ continue;
+ if (j->type != CREATE_DIRECTORY && j->type != TRUNCATE_DIRECTORY && j->type != CREATE_SUBVOLUME)
+ continue;
+
+@@ -1964,10 +1970,9 @@ int main(int argc, char *argv[]) {
+
+ mac_selinux_init(NULL);
+
+- items = hashmap_new(&string_hash_ops);
+- globs = hashmap_new(&string_hash_ops);
++ items = ordered_hashmap_new(&string_hash_ops);
+
+- if (!items || !globs) {
++ if (!items) {
+ r = log_oom();
+ goto finish;
+ }
+@@ -2000,27 +2005,17 @@ int main(int argc, char *argv[]) {
+ }
+ }
+
+- HASHMAP_FOREACH(a, globs, iterator) {
+- k = process_item_array(a);
+- if (k < 0 && r == 0)
+- r = k;
+- }
+-
+- HASHMAP_FOREACH(a, items, iterator) {
++ ORDERED_HASHMAP_FOREACH(a, items, iterator) {
+ k = process_item_array(a);
+ if (k < 0 && r == 0)
+ r = k;
+ }
+
+ finish:
+- while ((a = hashmap_steal_first(items)))
+- item_array_free(a);
+-
+- while ((a = hashmap_steal_first(globs)))
++ while ((a = ordered_hashmap_steal_first(items)))
+ item_array_free(a);
+
+- hashmap_free(items);
+- hashmap_free(globs);
++ ordered_hashmap_free(items);
+
+ free(arg_include_prefixes);
+ free(arg_exclude_prefixes);
+--
+1.9.3
+
diff --git a/meta/recipes-core/systemd/systemd/0013-journal-fix-Inappropriate-ioctl-for-device-on-ext4.patch b/meta/recipes-core/systemd/systemd/0013-journal-fix-Inappropriate-ioctl-for-device-on-ext4.patch
new file mode 100644
index 0000000000..a49d626824
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0013-journal-fix-Inappropriate-ioctl-for-device-on-ext4.patch
@@ -0,0 +1,37 @@
+From 65eae3b76243d2dfd869f8c43b787575f7b4b994 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org>
+Date: Sun, 1 Mar 2015 21:13:10 -0300
+Subject: [PATCH] journal: fix Inappropriate ioctl for device on ext4
+
+Logs constantly show
+
+systemd-journald[395]: Failed to set file attributes: Inappropriate ioctl for device
+
+This is because ext4 does not support FS_NOCOW_FL.
+
+[zj: fold into one conditional as suggested on the ML and
+ fix (preexisting) r/errno confusion in error message.]
+
+Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
+---
+ src/journal/journal-file.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
+index 9c9a548..0e33a0f 100644
+--- a/src/journal/journal-file.c
++++ b/src/journal/journal-file.c
+@@ -2609,8 +2609,8 @@ int journal_file_open(
+ * shouldn't be too bad, given that we do our own
+ * checksumming). */
+ r = chattr_fd(f->fd, true, FS_NOCOW_FL);
+- if (r < 0)
+- log_warning_errno(errno, "Failed to set file attributes: %m");
++ if (r < 0 && r != -ENOTTY)
++ log_warning_errno(r, "Failed to set file attributes: %m");
+
+ /* Let's attach the creation time to the journal file,
+ * so that the vacuuming code knows the age of this
+--
+1.9.3
+
diff --git a/meta/recipes-core/systemd/systemd/journald-volatile.conf b/meta/recipes-core/systemd/systemd/journald-volatile.conf
new file mode 100644
index 0000000000..b11e1606b5
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/journald-volatile.conf
@@ -0,0 +1,6 @@
+# If /var/volatile is a mount point then make sure to mount it before
+# the journal starts. This is because base-files creates a symlink
+# /var/log -> /var/volatile/log. And if the journal starts before the mount
+# happens, the journal will appear empty until restarted.
+[Unit]
+After=var-volatile.mount
diff --git a/meta/recipes-core/systemd/systemd/optional_secure_getenv.patch b/meta/recipes-core/systemd/systemd/optional_secure_getenv.patch
deleted file mode 100644
index 2063268246..0000000000
--- a/meta/recipes-core/systemd/systemd/optional_secure_getenv.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-on uclibc secure_getenv is not available
-therefore default to using getenv instead
-
-Upstream-Status: Denied [no desire for uclibc support]
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Index: git/src/shared/missing.h
-===================================================================
---- git.orig/src/shared/missing.h 2012-09-22 18:46:44.141282145 -0700
-+++ git/src/shared/missing.h 2012-09-22 18:48:44.081276570 -0700
-@@ -233,6 +233,8 @@
- #ifndef HAVE_SECURE_GETENV
- # ifdef HAVE___SECURE_GETENV
- # define secure_getenv __secure_getenv
-+# elif defined __UCLIBC__
-+# define secure_getenv getenv
- # else
- # error neither secure_getenv nor __secure_getenv are available
- # endif
diff --git a/meta/recipes-core/systemd/systemd/run-ptest b/meta/recipes-core/systemd/systemd/run-ptest
index 2f6bd93a5b..a2d61c2894 100644
--- a/meta/recipes-core/systemd/systemd/run-ptest
+++ b/meta/recipes-core/systemd/systemd/run-ptest
@@ -1,3 +1,5 @@
+#!/bin/sh
+
tar -C test -xJf test/sys.tar.xz
make test/rules-test.sh.log
make test/udev-test.pl.log
diff --git a/meta/recipes-core/systemd/systemd/systemd-older-kernel.patch b/meta/recipes-core/systemd/systemd/systemd-older-kernel.patch
deleted file mode 100644
index 18b50e797a..0000000000
--- a/meta/recipes-core/systemd/systemd/systemd-older-kernel.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 6109f02dcc4f2d7a461c5772bab494f5753a2203 Mon Sep 17 00:00:00 2001
-From: Robert Yang <liezhi.yang@windriver.com>
-Date: Thu, 29 May 2014 08:09:07 +0000
-Subject: [PATCH] rtnl-types.c: check IFLA_VLAN_PROTOCOL
-
-The older kernel's linux/if_link.h doesn't have IFLA_VLAN_PROTOCOL, we need
-check whether it has been defined or not.
-
-The maintainer said that he would fix it:
-
-http://thread.gmane.org/gmane.comp.sysutils.systemd.devel/18200
-
-Also we need redefine IFLA_MAX from 34 to 35 when define IFLA_CARRIER,
-otherwise there would be error:
-
-| src/libsystemd/sd-rtnl/rtnl-types.c:233:9: error: array index in initializer exceeds array bounds
-| [IFLA_CARRIER] = { .type = NLA_U8 },
-
-Upstream-Status: Pending
-
-Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
----
- src/libsystemd/sd-rtnl/rtnl-types.c | 2 ++
- src/shared/missing.h | 2 ++
- 2 files changed, 4 insertions(+)
-
-diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c
-index 44ac5ec..ab6161f 100644
---- a/src/libsystemd/sd-rtnl/rtnl-types.c
-+++ b/src/libsystemd/sd-rtnl/rtnl-types.c
-@@ -67,7 +67,9 @@ static const NLType rtnl_link_info_data_vlan_types[IFLA_VLAN_MAX + 1] = {
- [IFLA_VLAN_EGRESS_QOS] = { .type = NLA_NESTED },
- [IFLA_VLAN_INGRESS_QOS] = { .type = NLA_NESTED },
- */
-+#ifdef IFLA_VLAN_PROTOCOL
- [IFLA_VLAN_PROTOCOL] = { .type = NLA_U16 },
-+#endif
- };
-
- static const NLType rtnl_link_info_data_bond_types[IFLA_BOND_MAX + 1] = {
-diff --git a/src/shared/missing.h b/src/shared/missing.h
-index d5ec2f8..732853f 100644
---- a/src/shared/missing.h
-+++ b/src/shared/missing.h
-@@ -94,6 +94,8 @@
-
- #ifndef IFLA_CARRIER
- #define IFLA_CARRIER 33
-+ #undef IFLA_MAX
-+ #define IFLA_MAX 35
- #ifndef IFLA_NUM_RX_QUEUES
- #define IFLA_NUM_RX_QUEUES 32
- #ifndef IFLA_NUM_TX_QUEUES
---
-1.8.3.4
-
diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch
deleted file mode 100644
index 9b4c940984..0000000000
--- a/meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-Prefer getty to agetty in console setup systemd units
-
-Upstream-Status: Inappropriate [configuration specific]
-Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
----
- units/getty@.service.m4 | 2 +-
- units/serial-getty@.service.m4 | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-Index: git/units/getty@.service.m4
-===================================================================
---- git.orig/units/getty@.service.m4 2014-03-15 08:16:17.000000000 -0700
-+++ git/units/getty@.service.m4 2014-03-15 08:21:11.007695825 -0700
-@@ -27,7 +27,7 @@
-
- [Service]
- # the VT is cleared by TTYVTDisallocate
--ExecStart=-/sbin/agetty --noclear %I $TERM
-+ExecStart=-/sbin/getty -L %I $TERM
- Type=idle
- Restart=always
- RestartSec=0
-Index: git/units/serial-getty@.service.m4
-===================================================================
---- git.orig/units/serial-getty@.service.m4 2014-03-15 08:16:17.000000000 -0700
-+++ git/units/serial-getty@.service.m4 2014-03-15 08:22:31.291697331 -0700
-@@ -22,7 +22,7 @@
- IgnoreOnIsolate=yes
-
- [Service]
--ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
-+ExecStart=-/sbin/getty -L 115200 %I $TERM
- Type=idle
- Restart=always
- RestartSec=0
diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch
deleted file mode 100644
index 8c7aa072da..0000000000
--- a/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-Upstream-Status: Denied [no desire for uclibc support]
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Index: git/src/shared/util.c
-===================================================================
---- git.orig/src/shared/util.c 2014-03-15 15:14:21.368160908 -0700
-+++ git/src/shared/util.c 2014-03-15 15:44:21.988194688 -0700
-@@ -85,6 +85,8 @@
- #include "def.h"
- #include "missing.h"
-
-+#include "config.h"
-+
- int saved_argc = 0;
- char **saved_argv = NULL;
-
-@@ -6222,7 +6224,13 @@
-
- u = umask(077);
-
-+#ifdef HAVE_MKOSTEMP
- fd = mkostemp(pattern, flags);
-+#else
-+ fd = mkstemp(pattern);
-+ if (fd >= 0) fcntl(fd, F_SETFD, flags);
-+#endif /* HAVE_MKOSTEMP */
-+
- if (fd < 0)
- return -errno;
-
diff --git a/meta/recipes-core/systemd/systemd/tmpfiles-pam.patch b/meta/recipes-core/systemd/systemd/tmpfiles-pam.patch
new file mode 100644
index 0000000000..a40b1b9d3f
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/tmpfiles-pam.patch
@@ -0,0 +1,30 @@
+Upstream-Status: Submitted
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+From 0802aaaa9784813d318d045c79533a044eedf542 Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@intel.com>
+Date: Tue, 3 Mar 2015 11:32:29 +0000
+Subject: [PATCH] tmpfiles.d: only copy /etc/pam.d if PAM is present
+
+If HAVE_PAM isn't set then don't attempt to copy /etc/pam.d from the factory, as
+it doesn't get installed.
+
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+---
+ tmpfiles.d/etc.conf.m4 | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/tmpfiles.d/etc.conf.m4 b/tmpfiles.d/etc.conf.m4
+index 9b0e080..ab5cd16 100644
+--- a/tmpfiles.d/etc.conf.m4
++++ b/tmpfiles.d/etc.conf.m4
+@@ -14,4 +14,6 @@ m4_ifdef(`ENABLE_RESOLVED',
+ L /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf
+ )m4_dnl
+ C /etc/nsswitch.conf - - - -
++m4_ifdef(`HAVE_PAM',
+ C /etc/pam.d - - - -
++)m4_dnl
+--
+1.7.10.4
+
diff --git a/meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch b/meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch
deleted file mode 100644
index 15645dee11..0000000000
--- a/meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-Dont include sys/sysinfo.h on uclibc it conflicts with linux/sysinfo.h
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Inappropriate [uclibc specific]
-
-Index: systemd-209/src/readahead/readahead-common.c
-===================================================================
---- systemd-209.orig/src/readahead/readahead-common.c 2014-02-12 18:42:33.810685053 -0800
-+++ systemd-209/src/readahead/readahead-common.c 2014-02-19 23:49:31.856661142 -0800
-@@ -22,7 +22,9 @@
- #include <errno.h>
- #include <stdlib.h>
- #include <string.h>
-+#ifndef __UCLIBC__
- #include <sys/sysinfo.h>
-+#endif
- #include <sys/inotify.h>
- #include <fcntl.h>
- #include <sys/mman.h>
diff --git a/meta/recipes-core/systemd/systemd_213.bb b/meta/recipes-core/systemd/systemd_219.bb
index 279cf23097..117a529492 100644
--- a/meta/recipes-core/systemd/systemd_213.bb
+++ b/meta/recipes-core/systemd/systemd_219.bb
@@ -1,6 +1,15 @@
-SUMMARY = "System and service manager for Linux, replacing SysVinit"
+SUMMARY = "A System and service manager"
HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd"
+DESCRIPTION = "systemd is a system and service manager for Linux, compatible with \
+SysV and LSB init scripts. systemd provides aggressive parallelization \
+capabilities, uses socket and D-Bus activation for starting services, \
+offers on-demand starting of daemons, keeps track of processes using \
+Linux cgroups, supports snapshotting and restoring of the system \
+state, maintains mount and automount points and implements an \
+elaborate transactional dependency-based service control logic. It can \
+work as a drop-in replacement for sysvinit."
+
LICENSE = "GPLv2 & LGPLv2.1 & MIT"
LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c \
@@ -11,43 +20,52 @@ PROVIDES = "udev"
PE = "1"
DEPENDS = "kmod docbook-sgml-dtd-4.1-native intltool-native gperf-native acl readline dbus libcap libcgroup glib-2.0 qemu-native util-linux"
-DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
SECTION = "base/shell"
-inherit gtk-doc useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu systemd ptest
-
-SRCREV = "c9679c652b3c31f2510e8805d81630680ebc7e95"
-
-PV = "213+git${SRCPV}"
-
-SRC_URI = "git://anongit.freedesktop.org/systemd/systemd;branch=master;protocol=git \
- file://binfmt-install.patch \
- file://systemd-pam-configure-check-uclibc.patch \
- file://systemd-pam-fix-execvpe.patch \
- file://systemd-pam-fix-fallocate.patch \
- file://systemd-pam-fix-mkostemp.patch \
- file://optional_secure_getenv.patch \
- file://0001-uClibc-doesn-t-implement-pwritev-preadv.patch \
- file://uclibc-sysinfo_h.patch \
- file://uclibc-get-physmem.patch \
+inherit gtk-doc useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu systemd ptest gettext
+
+SRCREV = "a88abde72169ddc2df77df3fa5bed30725022253"
+
+PV = "219+git${SRCPV}"
+
+SRC_URI = "git://anongit.freedesktop.org/systemd/systemd;branch=master \
+ file://0002-shared-missing.h-fall-back-to-insecure-getenv.patch \
+ file://0003-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
+ file://0004-configure-Check-for-additional-features-that-uclibc-.patch \
+ file://0005-nspawn-Use-execvpe-only-when-libc-supports-it.patch \
+ file://0006-journal-Use-posix-fallocate-only-if-available.patch \
+ file://0007-util-Use-mkostemp-only-if-libc-supports-it.patch \
+ file://0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch \
+ file://0009-sysv-generator-add-support-for-executing-scripts-und.patch \
+ file://0010-Make-root-s-home-directory-configurable.patch \
+ file://0011-systemd-user-avoid-using-system-auth.patch \
+ file://0001-tmpfiles-avoid-creating-duplicate-acl-entries.patch \
+ file://0002-tmpfiles-quietly-ignore-ACLs-on-unsupported-filesyst.patch \
+ file://0012-systemd-tmpfiles.c-Honor-ordering-within-files-as-th.patch \
+ file://0013-journal-fix-Inappropriate-ioctl-for-device-on-ext4.patch \
+ file://tmpfiles-pam.patch \
file://touchscreen.rules \
file://00-create-volatile.conf \
file://init \
file://run-ptest \
- file://systemd-older-kernel.patch \
+ file://journald-volatile.conf \
"
S = "${WORKDIR}/git"
SRC_URI_append_libc-uclibc = "\
- file://systemd-pam-fix-getty-unit.patch \
- "
+ file://0001-units-Prefer-getty-to-agetty-in-console-setup-system.patch \
+ "
LDFLAGS_append_libc-uclibc = " -lrt"
GTKDOC_DOCDIR = "${S}/docs/"
-PACKAGECONFIG ??= "xz"
+PACKAGECONFIG ??= "xz ldconfig \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)}"
+
+PACKAGECONFIG[journal-upload] = "--enable-libcurl,--disable-libcurl,curl"
# Sign the journal for anti-tampering
PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt"
# regardless of PACKAGECONFIG, libgcrypt is always required to expand
@@ -57,6 +75,18 @@ DEPENDS += "libgcrypt"
PACKAGECONFIG[xz] = "--enable-xz,--disable-xz,xz"
PACKAGECONFIG[cryptsetup] = "--enable-libcryptsetup,--disable-libcryptsetup,cryptsetup"
PACKAGECONFIG[microhttpd] = "--enable-microhttpd,--disable-microhttpd,libmicrohttpd"
+PACKAGECONFIG[elfutils] = "--enable-elfutils,--disable-elfutils,elfutils"
+PACKAGECONFIG[resolved] = "--enable-resolved,--disable-resolved"
+PACKAGECONFIG[networkd] = "--enable-networkd,--disable-networkd"
+PACKAGECONFIG[libidn] = "--enable-libidn,--disable-libidn,libidn"
+PACKAGECONFIG[audit] = "--enable-audit,--disable-audit,audit"
+PACKAGECONFIG[manpages] = "--enable-manpages,--disable-manpages,libxslt-native xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native"
+PACKAGECONFIG[pam] = "--enable-pam,--disable-pam,libpam"
+# Verify keymaps on locale change
+PACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon"
+# Update NAT firewall rules
+PACKAGECONFIG[iptc] = "--enable-libiptc,--disable-libiptc,iptables"
+PACKAGECONFIG[ldconfig] = "--enable-ldconfig,--disable-ldconfig,,"
CACHED_CONFIGUREVARS = "ac_cv_path_KILL=${base_bindir}/kill"
@@ -69,16 +99,13 @@ rootlibexecdir = "${rootprefix}/lib"
# The gtk+ tools should get built as a separate recipe e.g. systemd-tools
EXTRA_OECONF = " --with-rootprefix=${rootprefix} \
--with-rootlibdir=${rootlibdir} \
- ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)} \
- --disable-manpages \
+ --with-roothomedir=${ROOT_HOME} \
--disable-coredump \
--disable-introspection \
--disable-kdbus \
--enable-split-usr \
--without-python \
--with-sysvrcnd-path=${sysconfdir} \
- --with-firmware-path=/lib/firmware \
- ac_cv_path_KILL=${base_bindir}/kill \
"
# uclibc does not have NSS
EXTRA_OECONF_append_libc-uclibc = " --disable-myhostname "
@@ -94,7 +121,6 @@ do_configure_prepend() {
else
cp -r ${S}/units ${S}/units.pre_sed
fi
- sed -i -e 's:=/root:=${ROOT_HOME}:g' ${S}/units/*.service*
sed -i '/ln --relative --help/d' ${S}/configure.ac
sed -i -e 's:\$(LN_S) --relative -f:lnr:g' ${S}/Makefile.am
sed -i -e 's:\$(LN_S) --relative:lnr:g' ${S}/Makefile.am
@@ -114,9 +140,13 @@ do_install() {
# 20:12 < mezcalero> koen: you have three options: a) run systemd-machine-id-setup at install time, b) have / read-only and an empty file there (for stateless) and c) boot with / writable
touch ${D}${sysconfdir}/machine-id
+
+ install -d ${D}${sysconfdir}/udev/rules.d/
+ install -d ${D}${sysconfdir}/tmpfiles.d
install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d/
install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
+ install -D -m 0644 ${WORKDIR}/journald-volatile.conf ${D}${systemd_unitdir}/system/systemd-journald.service.d/journald-volatile.conf
if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
install -d ${D}${sysconfdir}/init.d
@@ -124,8 +154,33 @@ do_install() {
sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd
fi
+ chown root:systemd-journal ${D}/${localstatedir}/log/journal
+
# Delete journal README, as log can be symlinked inside volatile.
rm -f ${D}/${localstatedir}/log/README
+
+ # Create symlinks for systemd-update-utmp-runlevel.service
+ install -d ${D}${systemd_unitdir}/system/graphical.target.wants
+ install -d ${D}${systemd_unitdir}/system/multi-user.target.wants
+ install -d ${D}${systemd_unitdir}/system/poweroff.target.wants
+ install -d ${D}${systemd_unitdir}/system/reboot.target.wants
+ install -d ${D}${systemd_unitdir}/system/rescue.target.wants
+ ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/graphical.target.wants/systemd-update-utmp-runlevel.service
+ ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/multi-user.target.wants/systemd-update-utmp-runlevel.service
+ ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/poweroff.target.wants/systemd-update-utmp-runlevel.service
+ ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/reboot.target.wants/systemd-update-utmp-runlevel.service
+ ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/rescue.target.wants/systemd-update-utmp-runlevel.service
+
+ # Enable journal to forward message to syslog daemon
+ sed -i -e 's/.*ForwardToSyslog.*/ForwardToSyslog=yes/' ${D}${sysconfdir}/systemd/journald.conf
+ # its needed in 216 upstream has fixed it with 919699ec301ea507edce4a619141ed22e789ac0d
+ # don't order journal flushing afte remote-fs.target
+ sed -i -e 's/ remote-fs.target$//' ${D}${systemd_unitdir}/system/systemd-journal-flush.service
+ # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it
+ # for existence else it fails
+ if [ -s ${D}${libdir}/tmpfiles.d/systemd.conf ]; then
+ ${@bb.utils.contains('PACKAGECONFIG', 'networkd', ':', 'sed -i -e "\$ad /run/systemd/netif/links 0755 root root -" ${D}${libdir}/tmpfiles.d/systemd.conf', d)}
+ fi
}
do_install_ptest () {
@@ -148,16 +203,16 @@ python populate_packages_prepend (){
systemdlibdir = d.getVar("rootlibdir", True)
do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True)
}
-PACKAGES_DYNAMIC += "^lib(udev|gudev|systemd).*"
+PACKAGES_DYNAMIC += "^lib(udev|systemd).*"
PACKAGES =+ "${PN}-gui ${PN}-vconsole-setup ${PN}-initramfs ${PN}-analyze ${PN}-kernel-install \
- ${PN}-rpm-macros ${PN}-binfmt ${PN}-pam ${PN}-zsh"
+ ${PN}-rpm-macros ${PN}-binfmt ${PN}-pam ${PN}-zsh libgudev"
SYSTEMD_PACKAGES = "${PN}-binfmt"
SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service"
USERADD_PACKAGES = "${PN}"
-USERADD_PARAM_${PN} += "--system systemd-journal-gateway"
+USERADD_PARAM_${PN} += "--system systemd-journal-gateway; --system systemd-timesync"
GROUPADD_PARAM_${PN} = "-r lock; -r systemd-journal"
FILES_${PN}-analyze = "${bindir}/systemd-analyze"
@@ -165,8 +220,9 @@ FILES_${PN}-analyze = "${bindir}/systemd-analyze"
FILES_${PN}-initramfs = "/init"
RDEPENDS_${PN}-initramfs = "${PN}"
-# The test cases need perl and bash to run correctly.
-RDEPENDS_${PN}-ptest += "perl bash"
+FILES_libgudev = "${libdir}/libgudev*${SOLIBS}"
+
+RDEPENDS_${PN}-ptest += "perl python bash"
FILES_${PN}-ptest += "${libdir}/udev/rules.d"
FILES_${PN}-dbg += "${libdir}/systemd/ptest/.debug"
@@ -177,6 +233,7 @@ FILES_${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \
${systemd_unitdir}/system/systemd-vconsole-setup.service \
${systemd_unitdir}/system/sysinit.target.wants/systemd-vconsole-setup.service"
+RDEPENDS_${PN}-kernel-install += "bash"
FILES_${PN}-kernel-install = "${bindir}/kernel-install \
${sysconfdir}/kernel/ \
${exec_prefix}/lib/kernel \
@@ -193,7 +250,7 @@ FILES_${PN}-binfmt = "${sysconfdir}/binfmt.d/ \
${systemd_unitdir}/system/systemd-binfmt.service"
RRECOMMENDS_${PN}-binfmt = "kernel-module-binfmt-misc"
-RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts"
+RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts kbd-keymaps"
CONFFILES_${PN} = "${sysconfdir}/systemd/journald.conf \
${sysconfdir}/systemd/logind.conf \
@@ -206,10 +263,12 @@ FILES_${PN} = " ${base_bindir}/* \
${datadir}/dbus-1/system-services \
${datadir}/polkit-1 \
${datadir}/${BPN} \
+ ${datadir}/factory \
${sysconfdir}/bash_completion.d/ \
${sysconfdir}/dbus-1/ \
${sysconfdir}/machine-id \
${sysconfdir}/modules-load.d/ \
+ ${sysconfdir}/pam.d/ \
${sysconfdir}/sysctl.d/ \
${sysconfdir}/systemd/ \
${sysconfdir}/tmpfiles.d/ \
@@ -218,7 +277,7 @@ FILES_${PN} = " ${base_bindir}/* \
${rootlibexecdir}/systemd/* \
${systemd_unitdir}/* \
${base_libdir}/security/*.so \
- ${libdir}/libnss_myhostname.so.2 \
+ ${libdir}/libnss_* \
/cgroup \
${bindir}/systemd* \
${bindir}/busctl \
@@ -231,34 +290,33 @@ FILES_${PN} = " ${base_bindir}/* \
${exec_prefix}/lib/systemd \
${exec_prefix}/lib/modules-load.d \
${exec_prefix}/lib/sysctl.d \
+ ${exec_prefix}/lib/sysusers.d \
${localstatedir} \
/lib/udev/rules.d/70-uaccess.rules \
/lib/udev/rules.d/71-seat.rules \
/lib/udev/rules.d/73-seat-late.rules \
/lib/udev/rules.d/99-systemd.rules \
- ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${sysconfdir}/pam.d', '', d)} \
"
FILES_${PN}-dbg += "${rootlibdir}/.debug ${systemd_unitdir}/.debug ${systemd_unitdir}/*/.debug ${base_libdir}/security/.debug/"
FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd"
RDEPENDS_${PN} += "kmod dbus util-linux-mount udev (= ${EXTENDPKGV})"
+RDEPENDS_${PN} += "volatile-binds"
-RRECOMMENDS_${PN} += "systemd-serialgetty systemd-compat-units \
+RRECOMMENDS_${PN} += "systemd-serialgetty systemd-compat-units udev-hwdb\
util-linux-agetty \
util-linux-fsck e2fsprogs-e2fsck \
- kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 \
+ kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 os-release \
"
-PACKAGES =+ "udev-dbg udev udev-utils udev-hwdb"
+PACKAGES =+ "udev-dbg udev udev-hwdb"
FILES_udev-dbg += "/lib/udev/.debug"
-RDEPENDS_udev += "udev-utils"
RPROVIDES_udev = "hotplug"
-RRECOMMENDS_udev += "udev-hwdb"
-RDEPENDS_udev-hwdb += "udev-utils"
+RDEPENDS_udev-hwdb += "udev"
FILES_udev += "${base_sbindir}/udevd \
${rootlibexecdir}/systemd/systemd-udevd \
@@ -273,22 +331,15 @@ FILES_udev += "${base_sbindir}/udevd \
${rootlibexecdir}/udev/scsi_id \
${rootlibexecdir}/udev/v4l_id \
${rootlibexecdir}/udev/keymaps \
- ${rootlibexecdir}/udev/rules.d/4*.rules \
- ${rootlibexecdir}/udev/rules.d/5*.rules \
- ${rootlibexecdir}/udev/rules.d/6*.rules \
- ${rootlibexecdir}/udev/rules.d/70-power-switch.rules \
- ${rootlibexecdir}/udev/rules.d/75*.rules \
- ${rootlibexecdir}/udev/rules.d/78*.rules \
- ${rootlibexecdir}/udev/rules.d/8*.rules \
- ${rootlibexecdir}/udev/rules.d/95*.rules \
+ ${rootlibexecdir}/udev/rules.d/*.rules \
${sysconfdir}/udev \
${sysconfdir}/init.d/systemd-udevd \
${systemd_unitdir}/system/*udev* \
${systemd_unitdir}/system/*.wants/*udev* \
+ ${base_bindir}/udevadm \
+ ${datadir}/bash-completion/completions/udevadm \
"
-FILES_udev-utils = "${base_bindir}/udevadm ${datadir}/bash-completion/completions/udevadm"
-
FILES_udev-hwdb = "${rootlibexecdir}/udev/hwdb.d"
INITSCRIPT_PACKAGES = "udev"
diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
index c3244b4602..eed2104f65 100644
--- a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
+++ b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
@@ -6,7 +6,7 @@ PR = "r10"
SRC_URI = "file://inittab"
-S = "${WORKDIR}/sysvinit-${PV}"
+S = "${WORKDIR}"
INHIBIT_DEFAULT_DEPS = "1"
@@ -23,7 +23,7 @@ do_install() {
do
j=`echo ${i} | sed s/\;/\ /g`
label=`echo ${i} | sed -e 's/^.*;tty//' -e 's/;.*//'`
- echo "$label:12345:respawn:${base_sbindir}/getty ${j}" >> ${D}${sysconfdir}/inittab
+ echo "$label:12345:respawn:${base_sbindir}/getty -L ${j}" >> ${D}${sysconfdir}/inittab
done
if [ "${USE_VT}" = "1" ]; then
diff --git a/meta/recipes-core/sysvinit/sysvinit/01_bootlogd b/meta/recipes-core/sysvinit/sysvinit/01_bootlogd
new file mode 100644
index 0000000000..a689d92d63
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/01_bootlogd
@@ -0,0 +1 @@
+f root root 0644 /var/log/boot none
diff --git a/meta/recipes-core/sysvinit/sysvinit/bootlogd.init b/meta/recipes-core/sysvinit/sysvinit/bootlogd.init
index 7d6518d981..df5aa430cf 100755
--- a/meta/recipes-core/sysvinit/sysvinit/bootlogd.init
+++ b/meta/recipes-core/sysvinit/sysvinit/bootlogd.init
@@ -46,7 +46,7 @@ esac
case "$ACTION" in
start)
- echo -n "Starting $DESC: "
+ [ "${VERBOSE}" != "no" ] && echo -n "Starting $DESC: "
if [ -d /proc/1/. ]
then
umask 027
@@ -55,14 +55,16 @@ case "$ACTION" in
else
$DAEMON -r -c
fi
- echo "$NAME."
+ [ "${VERBOSE}" != "no" ] && echo "$NAME."
;;
stop)
- echo -n "Stopping $DESC: "
+ # stop may get called during bootup, so let it honor
+ # rcS VERBOSE setting
+ [ "${VERBOSE}" != "no" ] && echo -n "Stopping $DESC: "
start-stop-daemon --stop --quiet --exec $DAEMON
- if [ "$STOPPER" ] && [ -f /var/log/boot ] && \
- [ -f /var/log/boot~ ]
+ if [ "$STOPPER" ] && [ "$(which savelog 2>/dev/null)" ] && \
+ [ -f /var/log/boot ] && [ -f /var/log/boot~ ]
then
cd /var/log
chgrp adm boot
@@ -71,7 +73,7 @@ case "$ACTION" in
mv boot~ boot.0
fi
- echo "$NAME."
+ [ "${VERBOSE}" != "no" ] && echo "$NAME."
;;
restart|force-reload)
echo -n "Restarting $DESC: "
diff --git a/meta/recipes-core/sysvinit/sysvinit/rc b/meta/recipes-core/sysvinit/sysvinit/rc
index 1f400d9e55..7ca41ae1ae 100755
--- a/meta/recipes-core/sysvinit/sysvinit/rc
+++ b/meta/recipes-core/sysvinit/sysvinit/rc
@@ -65,6 +65,9 @@ startup() {
# Set onlcr to avoid staircase effect.
stty onlcr 0>&1
+ # Limit stack size for startup scripts
+ [ "$STACK_SIZE" == "" ] || ulimit -S -s $STACK_SIZE
+
# Now find out what the current and what the previous runlevel are.
runlevel=$RUNLEVEL
diff --git a/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
index 448d0216be..00d333323e 100644
--- a/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
+++ b/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
@@ -16,7 +16,9 @@ SRC_URI = "${SAVANNAH_GNU_MIRROR}/sysvinit/sysvinit-${PV}.tar.bz2 \
file://rcS-default \
file://rc \
file://rcS \
- file://bootlogd.init"
+ file://bootlogd.init \
+ file://01_bootlogd \
+"
SRC_URI[md5sum] = "6eda8a97b86e0a6f59dabbf25202aa6f"
SRC_URI[sha256sum] = "60bbc8c1e1792056e23761d22960b30bb13eccc2cabff8c7310a01f4d5df1519"
@@ -92,6 +94,9 @@ do_install () {
update-rc.d -r ${D} bootlogd start 07 S .
update-rc.d -r ${D} stop-bootlogd start 99 2 3 4 5 .
+ install -d ${D}${sysconfdir}/default/volatiles
+ install -m 0644 ${WORKDIR}/01_bootlogd ${D}${sysconfdir}/default/volatiles
+
chown root.shutdown ${D}${base_sbindir}/halt ${D}${base_sbindir}/shutdown
chmod o-x,u+s ${D}${base_sbindir}/halt ${D}${base_sbindir}/shutdown
}
diff --git a/meta/recipes-core/uclibc/uclibc-git.inc b/meta/recipes-core/uclibc/uclibc-git.inc
index 69e834d6d1..a2b2353c5a 100644
--- a/meta/recipes-core/uclibc/uclibc-git.inc
+++ b/meta/recipes-core/uclibc/uclibc-git.inc
@@ -1,4 +1,4 @@
-SRCREV="5eddde8f094ef52dca06695cc598e3b2556dcccb"
+SRCREV = "48a0006012679ff0eda6f256da958d73a924fb57"
PV = "0.9.33+git${SRCPV}"
@@ -23,7 +23,7 @@ SRC_URI = "git://uclibc.org/uClibc.git;branch=master \
file://0001-Revert-utent.c-wtent.c-move-functions-from-utxent.c.patch \
file://0001-Add-eventfd_read-and-eventfd_write.patch \
file://0002-wire-setns-syscall.patch \
- file://0003-fcntl.h-Define-F_SETPIPE_SZ-and-F_GETPIPE_SZ.patch \
- file://0004-Add-clock_adjtime-syscall.patch \
+ file://0001-Define-IPTOS_CLASS_-macros-according-to-RFC-2474.patch \
+ file://0001-timex-Sync-with-glibc.patch \
"
S = "${WORKDIR}/git"
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-Define-IPTOS_CLASS_-macros-according-to-RFC-2474.patch b/meta/recipes-core/uclibc/uclibc-git/0001-Define-IPTOS_CLASS_-macros-according-to-RFC-2474.patch
new file mode 100644
index 0000000000..d613823695
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/0001-Define-IPTOS_CLASS_-macros-according-to-RFC-2474.patch
@@ -0,0 +1,75 @@
+From be8ed13a90c528adfbe3c8543946bb2c5a2ad713 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 25 Aug 2014 15:50:36 -0700
+Subject: [PATCH] Define IPTOS_CLASS_* macros according to RFC 2474
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-status: Pending
+---
+ include/netinet/ip.h | 42 ++++++++++++++++++++++++++++++------------
+ 1 file changed, 30 insertions(+), 12 deletions(-)
+
+diff --git a/include/netinet/ip.h b/include/netinet/ip.h
+index 19e1249..3fe58b9 100644
+--- a/include/netinet/ip.h
++++ b/include/netinet/ip.h
+@@ -188,7 +188,25 @@ struct ip_timestamp
+ #define IPTOS_DSCP_EF 0xb8
+
+ /*
+- * Definitions for IP type of service (ip_tos)
++ * In RFC 2474, Section 4.2.2.1, the Class Selector Codepoints subsume
++ * the old ToS Precedence values.
++ */
++#define IPTOS_CLASS_MASK 0xe0
++#define IPTOS_CLASS(class) ((class) & IPTOS_CLASS_MASK)
++#define IPTOS_CLASS_CS0 0x00
++#define IPTOS_CLASS_CS1 0x20
++#define IPTOS_CLASS_CS2 0x40
++#define IPTOS_CLASS_CS3 0x60
++#define IPTOS_CLASS_CS4 0x80
++#define IPTOS_CLASS_CS5 0xa0
++#define IPTOS_CLASS_CS6 0xc0
++#define IPTOS_CLASS_CS7 0xe0
++
++#define IPTOS_CLASS_DEFAULT IPTOS_CLASS_CS0
++
++/*
++ * Definitions for IP type of service (ip_tos) [deprecated; use DSCP
++ * and CS definitions above instead.]
+ */
+ #define IPTOS_TOS_MASK 0x1E
+ #define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK)
+@@ -199,18 +217,18 @@ struct ip_timestamp
+ #define IPTOS_MINCOST IPTOS_LOWCOST
+
+ /*
+- * Definitions for IP precedence (also in ip_tos) (hopefully unused)
++ * Definitions for IP precedence (also in ip_tos) [also deprecated.]
+ */
+-#define IPTOS_PREC_MASK 0xe0
+-#define IPTOS_PREC(tos) ((tos) & IPTOS_PREC_MASK)
+-#define IPTOS_PREC_NETCONTROL 0xe0
+-#define IPTOS_PREC_INTERNETCONTROL 0xc0
+-#define IPTOS_PREC_CRITIC_ECP 0xa0
+-#define IPTOS_PREC_FLASHOVERRIDE 0x80
+-#define IPTOS_PREC_FLASH 0x60
+-#define IPTOS_PREC_IMMEDIATE 0x40
+-#define IPTOS_PREC_PRIORITY 0x20
+-#define IPTOS_PREC_ROUTINE 0x00
++#define IPTOS_PREC_MASK IPTOS_CLASS_MASK
++#define IPTOS_PREC(tos) IPTOS_CLASS(tos)
++#define IPTOS_PREC_NETCONTROL IPTOS_CLASS_CS7
++#define IPTOS_PREC_INTERNETCONTROL IPTOS_CLASS_CS6
++#define IPTOS_PREC_CRITIC_ECP IPTOS_CLASS_CS5
++#define IPTOS_PREC_FLASHOVERRIDE IPTOS_CLASS_CS4
++#define IPTOS_PREC_FLASH IPTOS_CLASS_CS3
++#define IPTOS_PREC_IMMEDIATE IPTOS_CLASS_CS2
++#define IPTOS_PREC_PRIORITY IPTOS_CLASS_CS1
++#define IPTOS_PREC_ROUTINE IPTOS_CLASS_CS0
+
+ /*
+ * Definitions for options.
+--
+2.1.0
+
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-timex-Sync-with-glibc.patch b/meta/recipes-core/uclibc/uclibc-git/0001-timex-Sync-with-glibc.patch
new file mode 100644
index 0000000000..5d6a0a5366
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/0001-timex-Sync-with-glibc.patch
@@ -0,0 +1,33 @@
+From f489cc44a209f6c4370e94c9c788fc9cc4820be1 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 25 Aug 2014 16:22:57 -0700
+Subject: [PATCH] timex: Sync with glibc
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-status: Pending
+---
+ include/sys/timex.h | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/include/sys/timex.h b/include/sys/timex.h
+index 9082a28..57059bd 100644
+--- a/include/sys/timex.h
++++ b/include/sys/timex.h
+@@ -67,8 +67,12 @@ struct timex
+ #define ADJ_ESTERROR 0x0008 /* estimated time error */
+ #define ADJ_STATUS 0x0010 /* clock status */
+ #define ADJ_TIMECONST 0x0020 /* pll time constant */
+-#define ADJ_TICK 0x4000 /* tick value */
+-#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
++#define ADJ_TAI 0x0080 /* set TAI offset */
++#define ADJ_MICRO 0x1000 /* select microsecond resolution */
++#define ADJ_NANO 0x2000 /* select nanosecond resolution */
++#define ADJ_TICK 0x4000 /* tick value */
++#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
++#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */
+
+ /* xntp 3.4 compatibility names */
+ #define MOD_OFFSET ADJ_OFFSET
+--
+2.1.0
+
diff --git a/meta/recipes-core/uclibc/uclibc-git/0003-fcntl.h-Define-F_SETPIPE_SZ-and-F_GETPIPE_SZ.patch b/meta/recipes-core/uclibc/uclibc-git/0003-fcntl.h-Define-F_SETPIPE_SZ-and-F_GETPIPE_SZ.patch
deleted file mode 100644
index f4387db9c7..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/0003-fcntl.h-Define-F_SETPIPE_SZ-and-F_GETPIPE_SZ.patch
+++ /dev/null
@@ -1,377 +0,0 @@
-From 7791d129d777e481a1e429815edcd05978438840 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 20 Feb 2014 01:12:14 -0800
-Subject: [PATCH 3/3] fcntl.h: Define F_SETPIPE_SZ and F_GETPIPE_SZ
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
----
- libc/sysdeps/linux/alpha/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/arc/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/arm/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/bfin/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/cris/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/e1/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/frv/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/h8300/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/hppa/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/i386/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/i960/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/ia64/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/m68k/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/metag/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/microblaze/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/mips/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/nios/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/nios2/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/powerpc/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/sh/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/sh64/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/sparc/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/v850/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/vax/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/x86_64/bits/fcntl.h | 2 ++
- libc/sysdeps/linux/xtensa/bits/fcntl.h | 2 ++
- 26 files changed, 52 insertions(+)
-
-diff --git a/libc/sysdeps/linux/alpha/bits/fcntl.h b/libc/sysdeps/linux/alpha/bits/fcntl.h
-index dd32529..a44be9e 100644
---- a/libc/sysdeps/linux/alpha/bits/fcntl.h
-+++ b/libc/sysdeps/linux/alpha/bits/fcntl.h
-@@ -94,6 +94,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* for F_[GET|SET]FD */
-diff --git a/libc/sysdeps/linux/arc/bits/fcntl.h b/libc/sysdeps/linux/arc/bits/fcntl.h
-index 71136da..1cb9600 100755
---- a/libc/sysdeps/linux/arc/bits/fcntl.h
-+++ b/libc/sysdeps/linux/arc/bits/fcntl.h
-@@ -87,6 +87,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FL. */
-diff --git a/libc/sysdeps/linux/arm/bits/fcntl.h b/libc/sysdeps/linux/arm/bits/fcntl.h
-index f1a54f0..aedc154 100644
---- a/libc/sysdeps/linux/arm/bits/fcntl.h
-+++ b/libc/sysdeps/linux/arm/bits/fcntl.h
-@@ -99,6 +99,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FD. */
-diff --git a/libc/sysdeps/linux/bfin/bits/fcntl.h b/libc/sysdeps/linux/bfin/bits/fcntl.h
-index c6cba56..e987824 100644
---- a/libc/sysdeps/linux/bfin/bits/fcntl.h
-+++ b/libc/sysdeps/linux/bfin/bits/fcntl.h
-@@ -98,6 +98,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FL. */
-diff --git a/libc/sysdeps/linux/cris/bits/fcntl.h b/libc/sysdeps/linux/cris/bits/fcntl.h
-index acc5e25..029bb80 100644
---- a/libc/sysdeps/linux/cris/bits/fcntl.h
-+++ b/libc/sysdeps/linux/cris/bits/fcntl.h
-@@ -99,6 +99,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FL. */
-diff --git a/libc/sysdeps/linux/e1/bits/fcntl.h b/libc/sysdeps/linux/e1/bits/fcntl.h
-index da699c8..2e0e6ba 100644
---- a/libc/sysdeps/linux/e1/bits/fcntl.h
-+++ b/libc/sysdeps/linux/e1/bits/fcntl.h
-@@ -93,6 +93,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FL. */
-diff --git a/libc/sysdeps/linux/frv/bits/fcntl.h b/libc/sysdeps/linux/frv/bits/fcntl.h
-index 3aacc9d..5a7d9ef 100644
---- a/libc/sysdeps/linux/frv/bits/fcntl.h
-+++ b/libc/sysdeps/linux/frv/bits/fcntl.h
-@@ -95,6 +95,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FL. */
-diff --git a/libc/sysdeps/linux/h8300/bits/fcntl.h b/libc/sysdeps/linux/h8300/bits/fcntl.h
-index d0b8310..45deec4 100644
---- a/libc/sysdeps/linux/h8300/bits/fcntl.h
-+++ b/libc/sysdeps/linux/h8300/bits/fcntl.h
-@@ -93,6 +93,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FL. */
-diff --git a/libc/sysdeps/linux/hppa/bits/fcntl.h b/libc/sysdeps/linux/hppa/bits/fcntl.h
-index 1bb41ce..abb3372 100644
---- a/libc/sysdeps/linux/hppa/bits/fcntl.h
-+++ b/libc/sysdeps/linux/hppa/bits/fcntl.h
-@@ -96,6 +96,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* for F_[GET|SET]FL */
-diff --git a/libc/sysdeps/linux/i386/bits/fcntl.h b/libc/sysdeps/linux/i386/bits/fcntl.h
-index d48e62a..79b69d4 100644
---- a/libc/sysdeps/linux/i386/bits/fcntl.h
-+++ b/libc/sysdeps/linux/i386/bits/fcntl.h
-@@ -99,6 +99,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FD. */
-diff --git a/libc/sysdeps/linux/i960/bits/fcntl.h b/libc/sysdeps/linux/i960/bits/fcntl.h
-index e2fcbe6..f6e145d 100644
---- a/libc/sysdeps/linux/i960/bits/fcntl.h
-+++ b/libc/sysdeps/linux/i960/bits/fcntl.h
-@@ -93,6 +93,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FL. */
-diff --git a/libc/sysdeps/linux/ia64/bits/fcntl.h b/libc/sysdeps/linux/ia64/bits/fcntl.h
-index 1ff0ed5..fedefb6 100644
---- a/libc/sysdeps/linux/ia64/bits/fcntl.h
-+++ b/libc/sysdeps/linux/ia64/bits/fcntl.h
-@@ -95,6 +95,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FD. */
-diff --git a/libc/sysdeps/linux/m68k/bits/fcntl.h b/libc/sysdeps/linux/m68k/bits/fcntl.h
-index d7beb6c..66df337 100644
---- a/libc/sysdeps/linux/m68k/bits/fcntl.h
-+++ b/libc/sysdeps/linux/m68k/bits/fcntl.h
-@@ -98,6 +98,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FL. */
-diff --git a/libc/sysdeps/linux/metag/bits/fcntl.h b/libc/sysdeps/linux/metag/bits/fcntl.h
-index c4f641b..e10abd7 100644
---- a/libc/sysdeps/linux/metag/bits/fcntl.h
-+++ b/libc/sysdeps/linux/metag/bits/fcntl.h
-@@ -100,6 +100,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FD. */
-diff --git a/libc/sysdeps/linux/microblaze/bits/fcntl.h b/libc/sysdeps/linux/microblaze/bits/fcntl.h
-index a2e3573..20b7597 100644
---- a/libc/sysdeps/linux/microblaze/bits/fcntl.h
-+++ b/libc/sysdeps/linux/microblaze/bits/fcntl.h
-@@ -98,6 +98,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- # define F_SETPIPE_SZ 1031 /* Set of pipe page size array */
- # define F_GETPIPE_SZ 1032 /* Get of pipe page size array */
- #endif
-diff --git a/libc/sysdeps/linux/mips/bits/fcntl.h b/libc/sysdeps/linux/mips/bits/fcntl.h
-index 4291f6e..8c4c115 100644
---- a/libc/sysdeps/linux/mips/bits/fcntl.h
-+++ b/libc/sysdeps/linux/mips/bits/fcntl.h
-@@ -111,6 +111,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FL. */
-diff --git a/libc/sysdeps/linux/nios/bits/fcntl.h b/libc/sysdeps/linux/nios/bits/fcntl.h
-index 5854c18..36ca766 100644
---- a/libc/sysdeps/linux/nios/bits/fcntl.h
-+++ b/libc/sysdeps/linux/nios/bits/fcntl.h
-@@ -96,6 +96,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FL. */
-diff --git a/libc/sysdeps/linux/nios2/bits/fcntl.h b/libc/sysdeps/linux/nios2/bits/fcntl.h
-index d7beb6c..66df337 100644
---- a/libc/sysdeps/linux/nios2/bits/fcntl.h
-+++ b/libc/sysdeps/linux/nios2/bits/fcntl.h
-@@ -98,6 +98,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FL. */
-diff --git a/libc/sysdeps/linux/powerpc/bits/fcntl.h b/libc/sysdeps/linux/powerpc/bits/fcntl.h
-index 217f54a..d150a31 100644
---- a/libc/sysdeps/linux/powerpc/bits/fcntl.h
-+++ b/libc/sysdeps/linux/powerpc/bits/fcntl.h
-@@ -99,6 +99,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FD. */
-diff --git a/libc/sysdeps/linux/sh/bits/fcntl.h b/libc/sysdeps/linux/sh/bits/fcntl.h
-index 5c9f047..aceaec6 100644
---- a/libc/sysdeps/linux/sh/bits/fcntl.h
-+++ b/libc/sysdeps/linux/sh/bits/fcntl.h
-@@ -99,6 +99,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FD. */
-diff --git a/libc/sysdeps/linux/sh64/bits/fcntl.h b/libc/sysdeps/linux/sh64/bits/fcntl.h
-index ff741cb..b319e8b 100644
---- a/libc/sysdeps/linux/sh64/bits/fcntl.h
-+++ b/libc/sysdeps/linux/sh64/bits/fcntl.h
-@@ -95,6 +95,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FL. */
-diff --git a/libc/sysdeps/linux/sparc/bits/fcntl.h b/libc/sysdeps/linux/sparc/bits/fcntl.h
-index 235d2ad..7e80d9e 100644
---- a/libc/sysdeps/linux/sparc/bits/fcntl.h
-+++ b/libc/sysdeps/linux/sparc/bits/fcntl.h
-@@ -106,6 +106,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- #if __WORDSIZE == 64
-diff --git a/libc/sysdeps/linux/v850/bits/fcntl.h b/libc/sysdeps/linux/v850/bits/fcntl.h
-index d0b8310..45deec4 100644
---- a/libc/sysdeps/linux/v850/bits/fcntl.h
-+++ b/libc/sysdeps/linux/v850/bits/fcntl.h
-@@ -93,6 +93,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FL. */
-diff --git a/libc/sysdeps/linux/vax/bits/fcntl.h b/libc/sysdeps/linux/vax/bits/fcntl.h
-index ff5bff3..a30d5e1 100644
---- a/libc/sysdeps/linux/vax/bits/fcntl.h
-+++ b/libc/sysdeps/linux/vax/bits/fcntl.h
-@@ -92,6 +92,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FL. */
-diff --git a/libc/sysdeps/linux/x86_64/bits/fcntl.h b/libc/sysdeps/linux/x86_64/bits/fcntl.h
-index a899dcf..02e011d 100644
---- a/libc/sysdeps/linux/x86_64/bits/fcntl.h
-+++ b/libc/sysdeps/linux/x86_64/bits/fcntl.h
-@@ -113,6 +113,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FD. */
-diff --git a/libc/sysdeps/linux/xtensa/bits/fcntl.h b/libc/sysdeps/linux/xtensa/bits/fcntl.h
-index 5d28547..4e9aa7e 100644
---- a/libc/sysdeps/linux/xtensa/bits/fcntl.h
-+++ b/libc/sysdeps/linux/xtensa/bits/fcntl.h
-@@ -99,6 +99,8 @@
- # define F_NOTIFY 1026 /* Request notfications on a directory. */
- # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-+# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-+# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
- #endif
-
- /* For F_[GET|SET]FD. */
---
-1.9.0
-
diff --git a/meta/recipes-core/uclibc/uclibc-git/0004-Add-clock_adjtime-syscall.patch b/meta/recipes-core/uclibc/uclibc-git/0004-Add-clock_adjtime-syscall.patch
deleted file mode 100644
index c596db67b1..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/0004-Add-clock_adjtime-syscall.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-Upstream-Status: Pending
-
-From 8e19e651145554fbcb90179f3dfbc7ea8a07c900 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 15 Mar 2014 09:32:20 -0700
-Subject: [PATCH 4/4] Add clock_adjtime syscall
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- include/sys/timex.h | 5 ++++-
- libc/sysdeps/linux/common/Makefile.in | 2 +-
- libc/sysdeps/linux/common/clock_adjtime.c | 15 +++++++++++++++
- 3 files changed, 20 insertions(+), 2 deletions(-)
- create mode 100644 libc/sysdeps/linux/common/clock_adjtime.c
-
-diff --git a/include/sys/timex.h b/include/sys/timex.h
-index 621afce..9082a28 100644
---- a/include/sys/timex.h
-+++ b/include/sys/timex.h
-@@ -20,6 +20,7 @@
-
- #include <features.h>
- #include <sys/time.h>
-+#include <time.h>
-
- /* These definitions from linux/timex.h as of 2.2.0. */
-
-@@ -125,7 +126,9 @@ libc_hidden_proto(adjtimex)
- extern int ntp_gettime (struct ntptimeval *__ntv) __THROW;
- extern int ntp_adjtime (struct timex *__tntx) __THROW;
- #endif
--
-+#if defined __UCLIBC_HAS_REALTIME__
-+extern int clock_adjtime (clockid_t __clock_id, struct timex *__ntx) __THROW;
-+#endif
- __END_DECLS
-
- #endif /* sys/timex.h */
-diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
-index 10d9884..bb985b6 100644
---- a/libc/sysdeps/linux/common/Makefile.in
-+++ b/libc/sysdeps/linux/common/Makefile.in
-@@ -84,7 +84,7 @@ CSRC-$(ARCH_USE_MMU) += msync.c
- CSRC-$(UCLIBC_BSD_SPECIFIC) += mincore.c setdomainname.c
- CSRC-$(UCLIBC_NTP_LEGACY) += ntp_gettime.c
- # aio_cancel|aio_error|aio_fsync|aio_read|aio_return|aio_suspend|aio_write|clock_getres|clock_gettime|clock_settime|clock_settime|fdatasync|lio_listio|mlockall|munlockall|mlock|munlock|mq_close|mq_getattr|mq_notify|mq_open|mq_receive|mq_timedreceive|mq_send|mq_timedsend|mq_setattr|mq_unlink|nanosleep|sched_getparam|sched_get_priority_max|sched_get_priority_min|sched_getscheduler|sched_rr_get_interval|sched_setparam|sched_setscheduler|sem_close|sem_destroy|sem_getvalue|sem_init|sem_open|sem_post|sem_trywait|sem_wait|sem_unlink|sem_wait|shm_open|shm_unlink|sigqueue|sigtimedwait|sigwaitinfo|timer_create|timer_delete|timer_getoverrun|timer_gettime|timer_settime
--CSRC-$(UCLIBC_HAS_REALTIME) += clock_getres.c clock_gettime.c clock_settime.c \
-+CSRC-$(UCLIBC_HAS_REALTIME) += clock_adjtime.c clock_getres.c clock_gettime.c clock_settime.c \
- fdatasync.c mlockall.c mlock.c munlockall.c munlock.c \
- nanosleep.c __rt_sigtimedwait.c __rt_sigwaitinfo.c sched_getparam.c \
- sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \
-diff --git a/libc/sysdeps/linux/common/clock_adjtime.c b/libc/sysdeps/linux/common/clock_adjtime.c
-new file mode 100644
-index 0000000..968ec27
---- /dev/null
-+++ b/libc/sysdeps/linux/common/clock_adjtime.c
-@@ -0,0 +1,15 @@
-+/*
-+ * clock_adjtime() for uClibc
-+ *
-+ * Copyright (C) 2005 by Peter Kjellerstedt <pkj@axis.com>
-+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
-+ *
-+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+ */
-+
-+#include <sys/syscall.h>
-+#include <sys/timex.h>
-+
-+#ifdef __NR_clock_adjtime
-+_syscall2(int, clock_adjtime, clockid_t, clock_id, struct timex*, ntx)
-+#endif
---
-1.9.0
-
diff --git a/meta/recipes-core/uclibc/uclibc-git/remove_attribute_optimize_Os.patch b/meta/recipes-core/uclibc/uclibc-git/remove_attribute_optimize_Os.patch
index d2a8a81b94..fb52faa7a0 100644
--- a/meta/recipes-core/uclibc/uclibc-git/remove_attribute_optimize_Os.patch
+++ b/meta/recipes-core/uclibc/uclibc-git/remove_attribute_optimize_Os.patch
@@ -5,8 +5,8 @@ Upstream-Status: Pending
Index: git/libpthread/nptl/pthread_mutex_timedlock.c
===================================================================
---- git.orig/libpthread/nptl/pthread_mutex_timedlock.c 2013-01-21 16:22:20.000000000 -0800
-+++ git/libpthread/nptl/pthread_mutex_timedlock.c 2013-01-21 16:24:12.275557670 -0800
+--- git.orig/libpthread/nptl/pthread_mutex_timedlock.c 2014-08-25 10:58:06.000000000 -0700
++++ git/libpthread/nptl/pthread_mutex_timedlock.c 2014-08-25 11:00:42.078242266 -0700
@@ -28,7 +28,9 @@
* error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
*/
@@ -17,124 +17,3 @@ Index: git/libpthread/nptl/pthread_mutex_timedlock.c
pthread_mutex_timedlock (
pthread_mutex_t *mutex,
const struct timespec *abstime)
-Index: git/libc/sysdeps/linux/powerpc/bits/mathinline.h
-===================================================================
---- git.orig/libc/sysdeps/linux/powerpc/bits/mathinline.h 2013-01-21 16:22:20.000000000 -0800
-+++ git/libc/sysdeps/linux/powerpc/bits/mathinline.h 2013-01-21 16:24:12.275557670 -0800
-@@ -26,7 +26,7 @@
- #ifdef __cplusplus
- # define __MATH_INLINE __inline
- #else
--# define __MATH_INLINE extern __inline
-+# define __MATH_INLINE __extern_inline
- #endif /* __cplusplus */
-
- #if defined __GNUC__ && !defined _SOFT_FLOAT
-Index: git/libc/sysdeps/linux/alpha/bits/mathinline.h
-===================================================================
---- git.orig/libc/sysdeps/linux/alpha/bits/mathinline.h 2013-01-21 16:22:20.000000000 -0800
-+++ git/libc/sysdeps/linux/alpha/bits/mathinline.h 2013-01-21 16:24:12.275557670 -0800
-@@ -24,7 +24,7 @@
- #ifdef __cplusplus
- # define __MATH_INLINE __inline
- #else
--# define __MATH_INLINE extern __inline
-+# define __MATH_INLINE __extern_inline
- #endif
-
- #if defined __USE_ISOC99 && defined __GNUC__ && !__GNUC_PREREQ(3,0)
-Index: git/libc/sysdeps/linux/i386/bits/mathinline.h
-===================================================================
---- git.orig/libc/sysdeps/linux/i386/bits/mathinline.h 2013-01-21 16:22:20.000000000 -0800
-+++ git/libc/sysdeps/linux/i386/bits/mathinline.h 2013-01-21 16:24:12.275557670 -0800
-@@ -25,7 +25,7 @@
- #ifdef __cplusplus
- # define __MATH_INLINE __inline
- #else
--# define __MATH_INLINE extern __inline
-+# define __MATH_INLINE __extern_inline
- #endif
-
-
-Index: git/libc/sysdeps/linux/ia64/bits/mathinline.h
-===================================================================
---- git.orig/libc/sysdeps/linux/ia64/bits/mathinline.h 2013-01-21 16:22:20.000000000 -0800
-+++ git/libc/sysdeps/linux/ia64/bits/mathinline.h 2013-01-21 16:24:12.275557670 -0800
-@@ -23,7 +23,7 @@
- #ifdef __cplusplus
- # define __MATH_INLINE __inline
- #else
--# define __MATH_INLINE extern __inline
-+# define __MATH_INLINE __extern_inline
- #endif
-
- #if defined __USE_ISOC99 && defined __GNUC__ && __GNUC__ >= 2
-Index: git/libc/sysdeps/linux/m68k/bits/mathinline.h
-===================================================================
---- git.orig/libc/sysdeps/linux/m68k/bits/mathinline.h 2013-01-21 16:22:20.000000000 -0800
-+++ git/libc/sysdeps/linux/m68k/bits/mathinline.h 2013-01-21 16:24:12.275557670 -0800
-@@ -91,7 +91,7 @@
- # ifdef __cplusplus
- # define __m81_inline __inline
- # else
--# define __m81_inline extern __inline
-+# define __m81_inline __extern_inline
- # endif
- # define __M81_MATH_INLINES 1
- #endif
-@@ -350,14 +350,14 @@
- /* Note that there must be no whitespace before the argument passed for
- NAME, to make token pasting work correctly with -traditional. */
- # define __inline_forward_c(rettype, name, args1, args2) \
--extern __inline rettype __attribute__((__const__)) \
-+__extern_inline rettype __attribute__((__const__)) \
- name args1 \
- { \
- return __CONCAT(__,name) args2; \
- }
-
- # define __inline_forward(rettype, name, args1, args2) \
--extern __inline rettype name args1 \
-+__extern_inline rettype name args1 \
- { \
- return __CONCAT(__,name) args2; \
- }
-Index: git/libc/sysdeps/linux/mips/sys/tas.h
-===================================================================
---- git.orig/libc/sysdeps/linux/mips/sys/tas.h 2013-01-21 16:22:20.000000000 -0800
-+++ git/libc/sysdeps/linux/mips/sys/tas.h 2013-01-21 16:24:12.275557670 -0800
-@@ -29,7 +29,7 @@
- #ifdef __USE_EXTERN_INLINES
-
- # ifndef _EXTERN_INLINE
--# define _EXTERN_INLINE extern __inline
-+# define _EXTERN_INLINE __extern_inline
- # endif
-
- _EXTERN_INLINE int
-Index: git/libc/sysdeps/linux/sparc/bits/mathinline.h
-===================================================================
---- git.orig/libc/sysdeps/linux/sparc/bits/mathinline.h 2013-01-21 16:22:20.000000000 -0800
-+++ git/libc/sysdeps/linux/sparc/bits/mathinline.h 2013-01-21 16:24:12.279557671 -0800
-@@ -130,7 +130,7 @@
- # ifdef __cplusplus
- # define __MATH_INLINE __inline
- # else
--# define __MATH_INLINE extern __inline
-+# define __MATH_INLINE __extern_inline
- # endif /* __cplusplus */
-
- /* The gcc, version 2.7 or below, has problems with all this inlining
-Index: git/libc/sysdeps/linux/x86_64/bits/mathinline.h
-===================================================================
---- git.orig/libc/sysdeps/linux/x86_64/bits/mathinline.h 2013-01-21 16:22:20.000000000 -0800
-+++ git/libc/sysdeps/linux/x86_64/bits/mathinline.h 2013-01-21 16:24:12.279557671 -0800
-@@ -24,7 +24,7 @@
- #ifdef __cplusplus
- # define __MATH_INLINE __inline
- #else
--# define __MATH_INLINE extern __inline
-+# define __MATH_INLINE __extern_inline
- #endif
-
-
diff --git a/meta/recipes-core/uclibc/uclibc.inc b/meta/recipes-core/uclibc/uclibc.inc
index a86ac3ddf7..18587ca273 100644
--- a/meta/recipes-core/uclibc/uclibc.inc
+++ b/meta/recipes-core/uclibc/uclibc.inc
@@ -93,10 +93,10 @@ python () {
# if we use TARGET_CC_ARCH="-march=mips32" we end up
# with conflicting march options to gcc. Here we
# ask for MIPS32 ISA to match the chosen arch
-
- if "mips32" in d.getVar("TUNE_FEATURES",True):
+ tune = d.getVar("DEFAULTTUNE", True)
+ if tune in ['mips32', 'mips32r2']:
d.setVar('configmangle_append',
- "/^### MIPS32_CHECK$/a\\\nCONFIG_MIPS_ISA_MIPS32=y\n\n")
+ "/^### MIPS32_CHECK$/a\\\nCONFIG_MIPS_ISA_%s=y\n\n" % (tune.upper()))
if "${OE_FEATURES}":
d.setVar('configmangle_append',
"/^### DISTRO FEATURES$/a\\\n%s\n\n" %
diff --git a/meta/recipes-core/udev/udev-extraconf/automount.rules b/meta/recipes-core/udev/udev-extraconf/automount.rules
index 7e844c31bd..62578ea631 100644
--- a/meta/recipes-core/udev/udev-extraconf/automount.rules
+++ b/meta/recipes-core/udev/udev-extraconf/automount.rules
@@ -16,4 +16,4 @@
# Media automounting
SUBSYSTEM=="block", ACTION=="add" RUN+="/etc/udev/scripts/mount.sh"
SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh"
-
+SUBSYSTEM=="block", ACTION=="change", ENV{DISK_MEDIA_CHANGE}=="1" RUN+="/etc/udev/scripts/mount.sh"
diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh
index 7df1b6e3e7..3eea910854 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -78,8 +78,7 @@ if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n "$ID_FS_TYPE" -o "$media_t
fi
-
-if [ "$ACTION" = "remove" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then
+if [ "$ACTION" = "remove" ] || [ "$ACTION" = "change" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then
for mnt in `cat /proc/mounts | grep "$DEVNAME" | cut -f 2 -d " " `
do
$UMOUNT $mnt
diff --git a/meta/recipes-core/udev/udev-extraconf_1.1.bb b/meta/recipes-core/udev/udev-extraconf_1.1.bb
index d69056dd76..6fbd92548a 100644
--- a/meta/recipes-core/udev/udev-extraconf_1.1.bb
+++ b/meta/recipes-core/udev/udev-extraconf_1.1.bb
@@ -13,6 +13,8 @@ SRC_URI = " \
file://localextra.rules \
"
+S = "${WORKDIR}"
+
do_install() {
install -d ${D}${sysconfdir}/udev/rules.d
diff --git a/meta/recipes-core/udev/udev.inc b/meta/recipes-core/udev/udev.inc
index f9d544e86a..19e0e86506 100644
--- a/meta/recipes-core/udev/udev.inc
+++ b/meta/recipes-core/udev/udev.inc
@@ -12,7 +12,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
LDFLAGS += "-lrt"
-DEPENDS = "acl glib-2.0 libusb usbutils pciutils gperf-native libxslt-native util-linux"
+DEPENDS = "glib-2.0 libusb usbutils pciutils glib-2.0-native gperf-native libxslt-native util-linux"
RPROVIDES_${PN} = "hotplug"
SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \
@@ -27,11 +27,12 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \
file://udev-cache \
file://udev-cache.default \
file://add-install-ptest.patch \
+ file://fix_rule-syntax-regex-ptest.patch \
file://run-ptest \
file://init"
inherit autotools pkgconfig update-rc.d ptest
-RDEPENDS_${PN}-ptest += "make"
+RDEPENDS_${PN}-ptest += "make perl python"
libexecdir = "${base_libdir}"
EXTRA_OECONF = "--disable-introspection \
@@ -47,7 +48,7 @@ EXTRA_OECONF = "--disable-introspection \
--without-systemdsystemunitdir \
"
-PACKAGES =+ "udev-utils udev-cache"
+PACKAGES =+ "udev-cache"
PACKAGES =+ "libudev"
PACKAGES =+ "libgudev"
@@ -57,8 +58,8 @@ INITSCRIPT_PARAMS_udev = "start 04 S ."
INITSCRIPT_NAME_udev-cache = "udev-cache"
INITSCRIPT_PARAMS_udev-cache = "start 36 S ."
-FILES_${PN} += "${libexecdir} ${libdir}/ConsoleKit ${nonarch_base_libdir}/udev"
-RRECOMMENDS_${PN} += "udev-utils udev-cache"
+FILES_${PN} += "${libexecdir} ${libdir}/ConsoleKit ${nonarch_base_libdir}/udev ${bindir}/udevadm"
+RRECOMMENDS_${PN} += "udev-cache"
FILES_${PN}-dbg += "${libexecdir}/.debug"
FILES_${PN}-dbg += "${base_libdir}/udev/.debug/"
@@ -73,8 +74,6 @@ FILES_libudev = "${base_libdir}/libudev.so.*"
FILES_libgudev = "${base_libdir}/libgudev*.so.* ${libdir}/libgudev*.so.*"
FILES_udev-cache = "${sysconfdir}/init.d/udev-cache ${sysconfdir}/default/udev-cache"
-FILES_udev-utils = "${bindir}/udevadm"
-
do_install_append () {
install -d ${D}${sysconfdir}/init.d
install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev
diff --git a/meta/recipes-core/udev/udev/add-install-ptest.patch b/meta/recipes-core/udev/udev/add-install-ptest.patch
index 0f8e9b6588..bfc2e9409d 100644
--- a/meta/recipes-core/udev/udev/add-install-ptest.patch
+++ b/meta/recipes-core/udev/udev/add-install-ptest.patch
@@ -8,20 +8,33 @@ Signed-off-by: Björn Stenberg <bjst@enea.com>
Signed-off-by: Alexandra Safta <alst@enea.com>
Upstream-Status: Pending
+Add missing files for rule-syntax-check
+- Add rule-syntax-check.py
+- Add the deployed udev rules to the testdata
+
+Signed-off-by: Max Krummenacher <max.oss.09@gmail.com>
+Upstream-Status: Pending
--- a/Makefile.am 2012-03-18 16:28:14.000000000 +0100
+++ b/Makefile.am 2013-02-18 10:03:36.531101244 +0100
-@@ -708,3 +708,11 @@
+@@ -708,3 +708,18 @@
for i in src/docs/html/*.{html,css,png}; do echo $$i; kup put $$i $$i.sign /pub/linux/utils/kernel/hotplug/libudev/; done
for i in src/gudev/docs/html/*.{html,css,png}; do rm -f $$i.sign; gpg --armor --detach-sign --output=$$i.sign $$i; done
for i in src/gudev/docs/html/*.{html,css,png}; do echo $$i; kup put $$i $$i.sign /pub/linux/utils/kernel/hotplug/gudev/; done
+
++RULES = rules/* src/accelerometer/61-accelerometer.rules \
++ src/cdrom_id/60-cdrom_id.rules \
++ src/keymap/95-keyboard-force-release.rules src/keymap/95-keymap.rules \
++ src/mtd_probe/75-probe_mtd.rules src/v4l_id/60-persistent-v4l.rules
++
+install-ptest:
+ install test-udev $(DESTDIR)
+ cp Makefile $(DESTDIR)
+ sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile
-+ $(MKDIR_P) $(DESTDIR)/test
++ install -d $(DESTDIR)/test $(DESTDIR)/rules
+ (cd $(top_srcdir) && install $(TESTS) $(DESTDIR)/test)
-+ tar -C $(DESTDIR)/test/ -xJf $(top_srcdir)/test/sys.tar.xz
++ (cd $(top_srcdir) && install test/rule-syntax-check.py $(DESTDIR)/test)
++ (cd $(top_srcdir) && install $(RULES) $(DESTDIR)/rules)
++ cp $(top_srcdir)/test/sys.tar.xz $(DESTDIR)/test/
--- a/test/udev-test.pl 2012-03-18 16:43:36.000000000 +0100
+++ b/test/udev-test.pl 2013-02-18 10:31:29.706357321 +0100
@@ -1459,11 +1459,13 @@
diff --git a/meta/recipes-core/udev/udev/fix_rule-syntax-regex-ptest.patch b/meta/recipes-core/udev/udev/fix_rule-syntax-regex-ptest.patch
new file mode 100644
index 0000000000..548a241d8a
--- /dev/null
+++ b/meta/recipes-core/udev/udev/fix_rule-syntax-regex-ptest.patch
@@ -0,0 +1,59 @@
+The rule-syntax-check script fails with errors like this:
+
+Invalid line /lib/udev/rules.d/95-keymap.rules:49: ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Asus Extra Buttons", ATTR{[dmi/id]product_name}=="W3J", RUN+="keymap $name module-asus-w3j"
+(' clause:', 'ATTR{[dmi/id]product_name}=="W3J"')
+()
+
+
+Move line comment from end of rules file to its own line, the regex used to
+test correct syntax choke on it.
+
+The rule-syntax-check.py uses regex which errournessly complains on ATTR rules
+of the form ATTR{[dmi/id]board_name}=="30B7"
+Use the regex from systemd's script which allow [] characters and additional
+compare operators
+
+The Makefile passes rules-test.sh script a build host path to the testdata.
+Ignore the argument and use a relative path instead.
+
+
+Signed-off-by: Max Krummenacher <max.oss.09@gmail.com>
+Upstream status pending
+Upstream status Inappropriate (cross environment path)
+
+diff -Naur udev-182.orig/src/keymap/95-keymap.rules udev-182/src/keymap/95-keymap.rules
+--- udev-182.orig/src/keymap/95-keymap.rules 2012-02-07 00:01:55.154640792 +0100
++++ udev-182/src/keymap/95-keymap.rules 2015-01-24 20:58:40.156930520 +0100
+@@ -94,7 +94,8 @@
+ ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP G62 Notebook PC", RUN+="keymap $name 0xB2 www"
+ ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP ProBook*", RUN+="keymap $name 0xF8 rfkill"
+ # HP Pavillion dv6315ea has empty DMI_VENDOR
+-ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media" # "quick play
++# "quick play"
++ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media"
+
+ # Gateway clone of Acer Aspire One AOA110/AOA150
+ ENV{DMI_VENDOR}=="Gateway*", ATTR{[dmi/id]product_name}=="*AOA1*", RUN+="keymap $name acer"
+diff -Naur udev-182.orig/test/rule-syntax-check.py udev-182/test/rule-syntax-check.py
+--- udev-182.orig/test/rule-syntax-check.py 2012-02-15 20:10:12.872333342 +0100
++++ udev-182/test/rule-syntax-check.py 2015-01-24 21:08:00.496049600 +0100
+@@ -28,7 +28,7 @@
+ no_args_tests = re.compile('(ACTION|DEVPATH|KERNELS?|NAME|SYMLINK|SUBSYSTEMS?|DRIVERS?|TAG|RESULT|TEST)\s*(?:=|!)=\s*"([^"]*)"$')
+ args_tests = re.compile('(ATTRS?|ENV|TEST){([a-zA-Z0-9/_.*%-]+)}\s*(?:=|!)=\s*"([^"]*)"$')
+ no_args_assign = re.compile('(NAME|SYMLINK|OWNER|GROUP|MODE|TAG|PROGRAM|RUN|LABEL|GOTO|WAIT_FOR|OPTIONS|IMPORT)\s*(?:\+=|:=|=)\s*"([^"]*)"$')
+-args_assign = re.compile('(ATTR|ENV|IMPORT){([a-zA-Z0-9/_.*%-]+)}\s*=\s*"([^"]*)"$')
++args_assign = re.compile('(ATTR|ENV|IMPORT|RUN){([][a-zA-Z0-9/_.*%-]+)}\s*(=|==|\+=)\s*"([^"]*)"$')
+
+ result = 0
+ buffer = ''
+--- udev-182.orig/test/rules-test.sh 2012-01-29 01:15:46.000000000 +0100
++++ udev-182/test/rules-test.sh 2015-01-24 17:53:51.201858658 +0100
+@@ -4,7 +4,7 @@
+ # (C) 2010 Canonical Ltd.
+ # Author: Martin Pitt <martin.pitt@ubuntu.com>
+
+-[ -n "$srcdir" ] || srcdir=`dirname $0`/..
++srcdir=`dirname $0`/..
+
+ # skip if we don't have python
+ type python >/dev/null 2>&1 || {
diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init
index 410a650bd1..0ab028b391 100644
--- a/meta/recipes-core/udev/udev/init
+++ b/meta/recipes-core/udev/udev/init
@@ -14,21 +14,28 @@ export TZ=/etc/localtime
[ -d /sys/class ] || exit 1
[ -r /proc/mounts ] || exit 1
[ -x @UDEVD@ ] || exit 1
+SYSCONF_CACHED="/etc/udev/cache.data"
+SYSCONF_TMP="/dev/shm/udev.cache"
+DEVCACHE_REGEN="/dev/shm/udev-regen" # create to request cache regen
+
+# A list of files which are used as a criteria to judge whether the udev cache could be reused.
+CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices"
+[ -f /proc/atags ] && CMP_FILE_LIST="$CMP_FILE_LIST /proc/atags"
+
+# List of files whose metadata (size/mtime/name) will be included in cached
+# system state.
+META_FILE_LIST="lib/udev/rules.d/* etc/udev/rules.d/*"
+
+# Command to compute system configuration.
+sysconf_cmd () {
+ cat -- $CMP_FILE_LIST
+ stat -c '%s %Y %n' -- $META_FILE_LIST | awk -F/ '{print $1 " " $NF;}'
+}
+
[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
[ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
[ -f /etc/default/rcS ] && . /etc/default/rcS
-readfiles () {
- READDATA=""
- for filename in $@; do
- if [ -r $filename ]; then
- while read line; do
- READDATA="$READDATA$line"
- done < $filename
- fi
- done
-}
-
kill_udevd () {
pid=`pidof -x udevd`
[ -n "$pid" ] && kill $pid
@@ -57,38 +64,35 @@ case "$1" in
# the automount rule for udev needs /tmp directory available, as /tmp is a symlink
# to /var/tmp which in turn is a symlink to /var/volatile/tmp, we need to make sure
# /var/volatile/tmp directory to be available.
- mkdir -p /var/volatile/tmp
+ mkdir -m 1777 -p /var/volatile/tmp
# Cache handling.
- # A list of files which are used as a criteria to judge whether the udev cache could be reused.
- CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices /proc/atags"
if [ "$DEVCACHE" != "" ]; then
if [ -e $DEVCACHE ]; then
- readfiles $CMP_FILE_LIST
- NEWDATA="$READDATA"
- readfiles /etc/udev/cache.data
- OLDDATA="$READDATA"
- if [ "$OLDDATA" = "$NEWDATA" ]; then
- (cd /; tar xf $DEVCACHE > /dev/null 2>&1)
+ sysconf_cmd > "$SYSCONF_TMP"
+ if cmp $SYSCONF_CACHED $SYSCONF_TMP >/dev/null; then
+ tar xmf $DEVCACHE -C / -m
not_first_boot=1
[ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
- [ -e /dev/shm/udev.cache ] && rm -f /dev/shm/udev.cache
+ [ -e $SYSCONF_TMP ] && rm -f "$SYSCONF_TMP"
+ [ -e "$DEVCACHE_REGEN" ] && rm -f "$DEVCACHE_REGEN"
else
# Output detailed reason why the cached /dev is not used
- if [ "$VERBOSE" != "no" ]; then
- echo "udev: udev cache not used"
- echo "udev: we use $CMP_FILE_LIST as criteria to judge whether the cache /dev could be resued"
- echo "udev: olddata: $OLDDATA"
- echo "udev: newdata: $NEWDATA"
- fi
- echo "$NEWDATA" > /dev/shm/udev.cache
+ cat <<EOF
+udev: Not using udev cache because of changes detected in the following files:
+udev: $CMP_FILE_LIST
+udev: $META_FILE_LIST
+udev: The udev cache will be regenerated. To identify the detected changes,
+udev: compare the cached sysconf at $SYSCONF_CACHED
+udev: against the current sysconf at $SYSCONF_TMP
+EOF
+ touch "$DEVCACHE_REGEN"
fi
else
if [ "$ROOTFS_READ_ONLY" != "yes" ]; then
# If rootfs is not read-only, it's possible that a new udev cache would be generated;
# otherwise, we do not bother to read files.
- readfiles $CMP_FILE_LIST
- echo "$READDATA" > /dev/shm/udev.cache
+ touch "$DEVCACHE_REGEN"
fi
fi
fi
@@ -97,12 +101,17 @@ case "$1" in
kill_udevd > "/dev/null" 2>&1
# trigger the sorted events
- echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
+ [ -e /proc/sys/kernel/hotplug ] && echo -e '\000' >/proc/sys/kernel/hotplug
@UDEVD@ -d
udevadm control --env=STARTUP=1
if [ "$not_first_boot" != "" ];then
- udevadm trigger --action=add --subsystem-nomatch=tty --subsystem-nomatch=mem --subsystem-nomatch=vc --subsystem-nomatch=vtconsole --subsystem-nomatch=misc --subsystem-nomatch=dcon --subsystem-nomatch=pci_bus --subsystem-nomatch=graphics --subsystem-nomatch=backlight --subsystem-nomatch=video4linux --subsystem-nomatch=platform
+ if [ "$PROBE_PLATFORM_BUS" != "yes" ]; then
+ PLATFORM_BUS_NOMATCH="--subsystem-nomatch=platform"
+ else
+ PLATFORM_BUS_NOMATCH=""
+ fi
+ udevadm trigger --action=add --subsystem-nomatch=tty --subsystem-nomatch=mem --subsystem-nomatch=vc --subsystem-nomatch=vtconsole --subsystem-nomatch=misc --subsystem-nomatch=dcon --subsystem-nomatch=pci_bus --subsystem-nomatch=graphics --subsystem-nomatch=backlight --subsystem-nomatch=video4linux $PLATFORM_BUS_NOMATCH
(udevadm settle --timeout=3; udevadm control --env=STARTUP=)&
else
udevadm trigger --action=add
diff --git a/meta/recipes-core/udev/udev/run-ptest b/meta/recipes-core/udev/udev/run-ptest
index 6817ef70e6..0e39806b01 100644
--- a/meta/recipes-core/udev/udev/run-ptest
+++ b/meta/recipes-core/udev/udev/run-ptest
@@ -1,3 +1,5 @@
#!/bin/sh
-make -k check-TESTS \ No newline at end of file
+tar -C test/ -xJf test/sys.tar.xz
+make -k check-TESTS
+make test-sys-distclean
diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
index db5a513e14..df97000dde 100644
--- a/meta/recipes-core/udev/udev/udev-cache
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -16,6 +16,25 @@ export TZ=/etc/localtime
[ -d /sys/class ] || exit 1
[ -f /etc/default/rcS ] && . /etc/default/rcS
+DEVCACHE_TMP="/dev/shm/udev-cache-tmp.tar"
+SYSCONF_CACHED="/etc/udev/cache.data"
+SYSCONF_TMP="/dev/shm/udev.cache"
+DEVCACHE_REGEN="/dev/shm/udev-regen" # create to request cache regen
+
+# A list of files which are used as a criteria to judge whether the udev cache could be reused.
+CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices"
+[ -f /proc/atags ] && CMP_FILE_LIST="$CMP_FILE_LIST /proc/atags"
+
+# List of files whose metadata (size/mtime/name) will be included in cached
+# system state.
+META_FILE_LIST="lib/udev/rules.d/* etc/udev/rules.d/*"
+
+# Command to compute system configuration.
+sysconf_cmd () {
+ cat -- $CMP_FILE_LIST
+ stat -c '%s %Y %n' -- $META_FILE_LIST | awk -F/ '{print $1 " " $NF;}'
+}
+
[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
@@ -23,10 +42,28 @@ if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
exit 0
fi
-if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
- echo "Populating dev cache"
- (cd /; tar cf "$DEVCACHE" dev)
- mv /dev/shm/udev.cache /etc/udev/cache.data
+[ "$DEVCACHE" != "" ] || exit 0
+[ "${VERBOSE}" == "no" ] || echo -n "udev-cache: checking for ${DEVCACHE_REGEN}... "
+if ! [ -e "$DEVCACHE_REGEN" ]; then
+ [ "${VERBOSE}" == "no" ] || echo "not found."
+ exit 0
fi
+[ "${VERBOSE}" == "no" ] || echo "found."
+echo "Populating dev cache"
+
+(
+ set -e
+ trap 'echo "udev-cache: update failed!"' EXIT
+ udevadm control --stop-exec-queue
+ sysconf_cmd > "$SYSCONF_TMP"
+ find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \
+ | xargs tar cf "${DEVCACHE_TMP}" -T-
+ gzip < "${DEVCACHE_TMP}" > "$DEVCACHE"
+ rm -f "${DEVCACHE_TMP}"
+ mv "$SYSCONF_TMP" "$SYSCONF_CACHED"
+ udevadm control --start-exec-queue
+ rm -f "$DEVCACHE_REGEN"
+ trap - EXIT
+) &
exit 0
diff --git a/meta/recipes-core/udev/udev/udev-cache.default b/meta/recipes-core/udev/udev/udev-cache.default
index 5c4937a9a0..a3b732698d 100644
--- a/meta/recipes-core/udev/udev/udev-cache.default
+++ b/meta/recipes-core/udev/udev/udev-cache.default
@@ -1,4 +1,5 @@
# Default for /etc/init.d/udev
# Comment this out to disable device cache
-DEVCACHE="/etc/dev.tar"
+DEVCACHE="/etc/udev-cache.tar.gz"
+PROBE_PLATFORM_BUS="yes"
diff --git a/meta/recipes-core/util-linux/util-linux.inc b/meta/recipes-core/util-linux/util-linux.inc
index 83bb4a66b9..4cca897b60 100644
--- a/meta/recipes-core/util-linux/util-linux.inc
+++ b/meta/recipes-core/util-linux/util-linux.inc
@@ -17,26 +17,25 @@ LIC_FILES_CHKSUM = "file://README.licensing;md5=1715f5ee3e01203ca1e1e0b9ee65918c
file://libmount/COPYING;md5=fb93f01d4361069c5616327705373b16 \
file://libblkid/COPYING;md5=fb93f01d4361069c5616327705373b16"
-inherit autotools gettext pkgconfig systemd
+inherit autotools gettext pkgconfig systemd update-alternatives python-dir
DEPENDS = "zlib ncurses"
DEPENDS_append_class-native = " lzo-native"
DEPENDS_append_class-nativesdk = " lzo-native"
SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-linux-${PV}.tar.xz \
- file://MCONFIG \
- file://defines.h \
- file://make_include \
- file://swapargs.h \
"
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-libblkid \
- util-linux-libmount util-linux-libuuid util-linux-uuidd \
+ 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-partx ${PN}-bash-completion"
+ util-linux-partx ${PN}-bash-completion util-linux-hwclock \
+ util-linux-findfs util-linux-getopt"
+PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', 'util-linux-pylibmount', '', d)}"
+
+PACKAGES_DYNAMIC = "^util-linux-lib.*"
SHARED_EXTRA_OECONF = "--disable-use-tty-group \
--disable-makeinstall-chown \
@@ -50,19 +49,24 @@ 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)} \
- ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} "
+PACKAGECONFIG_class-target ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam,"
# Respect the systemd feature for uuidd
-PACKAGECONFIG[systemd] = "--enable-socket-activation --with-systemdsystemunitdir=${systemd_unitdir}/system/, --disable-socket-activation --without-systemdsystemunitdir"
+PACKAGECONFIG[systemd] = "--with-systemd --with-systemdsystemunitdir=${systemd_unitdir}/system/, --without-systemd --without-systemdsystemunitdir,systemd"
# Build setpriv requires libcap-ng
PACKAGECONFIG[libcap-ng] = "--enable-setpriv,--disable-setpriv,libcap-ng,"
+# Build python bindings for libmount
+PACKAGECONFIG[pylibmount] = "--with-python --enable-pylibmount,--without-python --disable-pylibmount,python"
+
FILES_${PN}-bash-completion += "${datadir}/bash-completion"
FILES_${PN}-doc += "${datadir}/getopt/getopt-*.*"
+FILES_${PN}-dev += "${libdir}/${PYTHON_DIR}/dist-packages/libmount/pylibmount.la"
+FILES_${PN}-dbg += "${libdir}/${PYTHON_DIR}/dist-packages/libmount/.debug/"
+
FILES_util-linux-agetty = "${base_sbindir}/agetty"
FILES_util-linux-fdisk = "${base_sbindir}/fdisk.${BPN}"
FILES_util-linux-fstrim = "${base_sbindir}/fstrim"
@@ -73,15 +77,17 @@ FILES_util-linux-losetup = "${base_sbindir}/losetup.${BPN}"
FILES_util-linux-mount = "${base_bindir}/mount.${BPN}"
FILES_util-linux-mcookie = "${bindir}/mcookie"
FILES_util-linux-umount = "${base_bindir}/umount.${BPN}"
-FILES_util-linux-readprofile = "${base_sbindir}/readprofile.${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-partx = "${sbindir}/partx"
+FILES_util-linux-hwclock = "${base_sbindir}/hwclock.${BPN}"
+FILES_util-linux-findfs = "${sbindir}/findfs"
+FILES_util-linux-getopt = "${base_bindir}/getopt.${BPN}"
-FILES_util-linux-libblkid = "${base_libdir}/libblkid.so.*"
-FILES_util-linux-libmount = "${base_libdir}/libmount.so.*"
-FILES_util-linux-libuuid = "${base_libdir}/libuuid.so.*"
+FILES_util-linux-pylibmount = "${libdir}/${PYTHON_DIR}/dist-packages/libmount/pylibmount.so \
+ ${libdir}/${PYTHON_DIR}/dist-packages/libmount/__init__.*"
FILES_util-linux-lscpu = "${bindir}/lscpu"
FILES_util-linux-fsck = "${base_sbindir}/fsck*"
@@ -90,7 +96,6 @@ FILES_util-linux-mkfs = "${sbindir}/mkfs"
FILES_util-linux-fsck.cramfs = "${sbindir}/fsck.cramfs"
FILES_util-linux-mkfs.cramfs = "${sbindir}/mkfs.cramfs"
-
# Util-linux' blkid replaces the e2fsprogs one
FILES_util-linux-blkid = "${base_sbindir}/blkid*"
RCONFLICTS_util-linux-blkid = "e2fsprogs-blkid"
@@ -109,15 +114,14 @@ RDEPENDS_${PN}_class-nativesdk = ""
RPROVIDES_${PN}-dev = "util-linux-libblkid-dev util-linux-libmount-dev util-linux-libuuid-dev"
-SYSTEMD_PACKAGES = "${PN}-uuidd"
-SYSTEMD_SERVICE_${PN}-uuidd = "uuidd.service"
+#SYSTEMD_PACKAGES = "${PN}-uuidd ${PN}-fstrim"
+SYSTEMD_SERVICE_${PN}-uuidd = "uuidd.socket uuidd.service"
+SYSTEMD_AUTO_ENABLE_${PN}-uuidd = "disable"
+SYSTEMD_SERVICE_${PN}-fstrim = "fstrim.timer fstrim.service"
+SYSTEMD_AUTO_ENABLE_${PN}-fstrim = "disable"
do_compile () {
set -e
- install ${WORKDIR}/MCONFIG ${S}/MCONFIG
- install ${WORKDIR}/make_include ${S}/make_include
- install ${WORKDIR}/swapargs.h ${S}/mount-deprecated/swapargs.h
- install ${WORKDIR}/defines.h ${S}/defines.h
oe_runmake ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'
}
@@ -132,9 +136,8 @@ 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 readprofile fsck blkid blockdev fstrim sulogin"
- usrbinprogs_a="chfn chsh hexdump last logger mesg newgrp renice utmpdump wall setsid chrt flock getopt"
- binprogs_a="dmesg kill more umount mount login reset su"
+ sbinprogs_a="pivot_root hwclock mkswap mkfs.minix fsck.minix losetup swapon swapoff fdisk fsck blkid blockdev fstrim sulogin switch_root"
+ binprogs_a="dmesg getopt kill more umount mount login reset su"
if [ "${base_sbindir}" != "${sbindir}" ]; then
mkdir -p ${D}${base_sbindir}
@@ -160,13 +163,11 @@ do_install () {
rm -f ${D}${bindir}/chkdupexe
}
-inherit update-alternatives
-
ALTERNATIVE_PRIORITY = "100"
-ALTERNATIVE_${PN} = "dmesg kill more mkswap blockdev pivot_root"
+ALTERNATIVE_${PN} = "dmesg kill more mkswap blockdev pivot_root switch_root"
ALTERNATIVE_${PN} += "mkfs.minix hexdump last logger mesg renice wall"
-ALTERNATIVE_${PN} += "setsid chrt flock hwclock utmpdump eject getopt sulogin"
+ALTERNATIVE_${PN} += "setsid chrt flock utmpdump eject sulogin"
ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg"
ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill"
@@ -174,11 +175,10 @@ ALTERNATIVE_LINK_NAME[more] = "${base_bindir}/more"
ALTERNATIVE_LINK_NAME[mkswap] = "${base_sbindir}/mkswap"
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[mkfs.minix] = "${base_sbindir}/mkfs.minix"
ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject"
-ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt"
ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin"
-ALTERNATIVE_TARGET[getopt] = "${bindir}/getopt"
ALTERNATIVE_${PN}-doc = "mountpoint.1 last.1 mesg.1 wall.1 sulogin.8 utmpdump.1 reset.1"
@@ -190,6 +190,7 @@ ALTERNATIVE_LINK_NAME[sulogin.8] = "${mandir}/man8/sulogin.8"
ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1"
ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1"
+ALTERNATIVE_util-linux-hwclock = "hwclock"
# There seems to be problem, atleast on nslu2, with these, untill they are
# fixed the busybox ones have higher priority
ALTERNATIVE_PRIORITY[hwclock] = "10"
@@ -209,7 +210,7 @@ ALTERNATIVE_util-linux-umount = "umount"
ALTERNATIVE_LINK_NAME[umount] = "${base_bindir}/umount"
ALTERNATIVE_util-linux-readprofile = "readprofile"
-ALTERNATIVE_LINK_NAME[readprofile] = "${base_sbindir}/readprofile"
+ALTERNATIVE_LINK_NAME[readprofile] = "${sbindir}/readprofile"
ALTERNATIVE_util-linux-losetup = "losetup"
ALTERNATIVE_LINK_NAME[losetup] = "${base_sbindir}/losetup"
@@ -229,6 +230,9 @@ ALTERNATIVE_util-linux-reset = "reset"
ALTERNATIVE_LINK_NAME[reset] = "${bindir}/reset"
ALTERNATIVE_TARGET[reset] = "${base_bindir}/reset"
+ALTERNATIVE_util-linux-getopt = "getopt"
+ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt"
+
BBCLASSEXTEND = "native nativesdk"
python do_package_prepend () {
@@ -237,3 +241,10 @@ python do_package_prepend () {
d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, '%s/%s' % (d.getVar('base_bindir', True), alt_name))
d.appendVar('ALTERNATIVE_%s' % (d.getVar('PN', True)), ' ' + alt_name)
}
+
+python populate_packages_prepend() {
+ do_split_packages(d, '${base_libdir}', '^lib(.*)\.so\..*$',
+ output_pattern='util-linux-lib%s',
+ description='util-linux lib%s',
+ extra_depends='', prepend=True, allow_links=True)
+}
diff --git a/meta/recipes-core/util-linux/util-linux/CVE-2014-9114.patch b/meta/recipes-core/util-linux/util-linux/CVE-2014-9114.patch
new file mode 100644
index 0000000000..5eaa08df63
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/CVE-2014-9114.patch
@@ -0,0 +1,174 @@
+Upstream-Status: Backport
+
+This patch is for CVE-2014-9114.
+This patch should be removed once util-linux is upgraded to 2.26.
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+From 89e90ae7b2826110ea28c1c0eb8e7c56c3907bdc Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak@redhat.com>
+Date: Thu, 27 Nov 2014 13:39:35 +0100
+Subject: [PATCH] libblkid: care about unsafe chars in cache
+
+The high-level libblkid API uses /run/blkid/blkid.tab cache to
+store probing results. The cache format is
+
+ <device NAME="value" ...>devname</device>
+
+and unfortunately the cache code does not escape quotation marks:
+
+ # mkfs.ext4 -L 'AAA"BBB'
+
+ # cat /run/blkid/blkid.tab
+ ...
+ <device ... LABEL="AAA"BBB" ...>/dev/sdb1</device>
+
+such string is later incorrectly parsed and blkid(8) returns
+nonsenses. And for use-cases like
+
+ # eval $(blkid -o export /dev/sdb1)
+
+it's also insecure.
+
+Note that mount, udevd and blkid -p are based on low-level libblkid
+API, it bypass the cache and directly read data from the devices.
+
+The current udevd upstream does not depend on blkid(8) output at all,
+it's directly linked with the library and all unsafe chars are encoded by
+\x<hex> notation.
+
+ # mkfs.ext4 -L 'X"`/tmp/foo` "' /dev/sdb1
+ # udevadm info --export-db | grep LABEL
+ ...
+ E: ID_FS_LABEL=X__/tmp/foo___
+ E: ID_FS_LABEL_ENC=X\x22\x60\x2ftmp\x2ffoo\x60\x20\x22
+
+Signed-off-by: Karel Zak <kzak@redhat.com>
+---
+ libblkid/src/read.c | 21 ++++++++++++++++++---
+ libblkid/src/save.c | 22 +++++++++++++++++++++-
+ misc-utils/blkid.8 | 5 ++++-
+ misc-utils/blkid.c | 4 ++--
+ 4 files changed, 45 insertions(+), 7 deletions(-)
+
+diff --git a/libblkid/src/read.c b/libblkid/src/read.c
+index 0e91c9c..81ab0df 100644
+--- a/libblkid/src/read.c
++++ b/libblkid/src/read.c
+@@ -252,15 +252,30 @@ static int parse_token(char **name, char **value, char **cp)
+ *value = skip_over_blank(*value + 1);
+
+ if (**value == '"') {
+- end = strchr(*value + 1, '"');
+- if (!end) {
++ char *p = end = *value + 1;
++
++ /* convert 'foo\"bar' to 'foo"bar' */
++ while (*p) {
++ if (*p == '\\') {
++ p++;
++ *end = *p;
++ } else {
++ *end = *p;
++ if (*p == '"')
++ break;
++ }
++ p++;
++ end++;
++ }
++
++ if (*end != '"') {
+ DBG(READ, ul_debug("unbalanced quotes at: %s", *value));
+ *cp = *value;
+ return -BLKID_ERR_CACHE;
+ }
+ (*value)++;
+ *end = '\0';
+- end++;
++ end = ++p;
+ } else {
+ end = skip_over_word(*value);
+ if (*end) {
+diff --git a/libblkid/src/save.c b/libblkid/src/save.c
+index 8216f09..5e8bbee 100644
+--- a/libblkid/src/save.c
++++ b/libblkid/src/save.c
+@@ -26,6 +26,21 @@
+
+ #include "blkidP.h"
+
++
++static void save_quoted(const char *data, FILE *file)
++{
++ const char *p;
++
++ fputc('"', file);
++ for (p = data; p && *p; p++) {
++ if ((unsigned char) *p == 0x22 || /* " */
++ (unsigned char) *p == 0x5c) /* \ */
++ fputc('\\', file);
++
++ fputc(*p, file);
++ }
++ fputc('"', file);
++}
+ static int save_dev(blkid_dev dev, FILE *file)
+ {
+ struct list_head *p;
+@@ -43,9 +58,14 @@ static int save_dev(blkid_dev dev, FILE *file)
+
+ if (dev->bid_pri)
+ fprintf(file, " PRI=\"%d\"", dev->bid_pri);
++
+ list_for_each(p, &dev->bid_tags) {
+ blkid_tag tag = list_entry(p, struct blkid_struct_tag, bit_tags);
+- fprintf(file, " %s=\"%s\"", tag->bit_name,tag->bit_val);
++
++ fputc(' ', file); /* space between tags */
++ fputs(tag->bit_name, file); /* tag NAME */
++ fputc('=', file); /* separator between NAME and VALUE */
++ save_quoted(tag->bit_val, file); /* tag "VALUE" */
+ }
+ fprintf(file, ">%s</device>\n", dev->bid_name);
+
+diff --git a/misc-utils/blkid.8 b/misc-utils/blkid.8
+index 156a14b..c95b833 100644
+--- a/misc-utils/blkid.8
++++ b/misc-utils/blkid.8
+@@ -200,7 +200,10 @@ partitions. This output format is \fBDEPRECATED\fR.
+ .TP
+ .B export
+ print key=value pairs for easy import into the environment; this output format
+-is automatically enabled when I/O Limits (\fB-i\fR option) are requested
++is automatically enabled when I/O Limits (\fB-i\fR option) are requested.
++
++The non-printing characters are encoded by ^ and M- notation and all
++potentially unsafe characters are escaped.
+ .RE
+ .TP
+ .BI \-O " offset"
+diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c
+index a6ca660..1bd8646 100644
+--- a/misc-utils/blkid.c
++++ b/misc-utils/blkid.c
+@@ -306,7 +306,7 @@ static void print_value(int output, int num, const char *devname,
+ printf("DEVNAME=%s\n", devname);
+ fputs(name, stdout);
+ fputs("=", stdout);
+- safe_print(value, valsz, NULL);
++ safe_print(value, valsz, " \\\"'$`<>");
+ fputs("\n", stdout);
+
+ } else {
+@@ -315,7 +315,7 @@ static void print_value(int output, int num, const char *devname,
+ fputs(" ", stdout);
+ fputs(name, stdout);
+ fputs("=\"", stdout);
+- safe_print(value, valsz, "\"");
++ safe_print(value, valsz, "\"\\");
+ fputs("\"", stdout);
+ }
+ }
+--
+1.9.1
+
diff --git a/meta/recipes-core/util-linux/util-linux/MCONFIG b/meta/recipes-core/util-linux/util-linux/MCONFIG
deleted file mode 100644
index 3fea2c02d7..0000000000
--- a/meta/recipes-core/util-linux/util-linux/MCONFIG
+++ /dev/null
@@ -1,223 +0,0 @@
-# MCONFIG -- Configuration stuff for util-linux
-# Created: Sat Feb 4 15:50:30 1995
-# Copyright 1995 Rickard E. Faith (faith@cs.unc.edu)
-
-# For a user-mode install, make (at least) three changes:
-# - remove the `-o root' part in INSTALLSUID
-# - set USE_TTY_GROUP=no
-# - define DESTDIR
-
-# Select for ARCH one of intel, alpha, sparc, arm, m68k, mips
-# Select for CPU i386 if the binaries must be able to run on an intel 386
-# (by default i486 code is generated, see below)
-CPU=$(shell uname -m)
-ARCH=$(shell echo $(CPU) | sed 's/i.86/intel/;s/arm.*/arm/')
-
-# If HAVE_PAM is set to "yes", then login, chfn, chsh, and newgrp
-# will use PAM for authentication. Additionally, passwd will not be
-# installed as it is not PAM aware.
-HAVE_PAM=no
-
-# If HAVE_SHADOW is set to "yes", then login, chfn, chsh, newgrp, passwd,
-# and vipw will not be built or installed from the login-utils
-# subdirectory.
-HAVE_SHADOW=yes
-
-# If HAVE_PASSWD is set to "yes", then passwd will not be built or
-# installed from the login-utils subdirectory (but login, chfn, chsh,
-# newgrp, and vipw *will* be installed).
-HAVE_PASSWD=no
-
-# If you use chfn and chsh from this package, REQUIRE_PASSWORD will require
-# non-root users to enter the account password before updating /etc/passwd.
-REQUIRE_PASSWORD=yes
-#REQUIRE_PASSWORD=no
-
-# If you use chsh from this package, ONLY_LISTED_SHELLS will require that
-# the selected shell be listed in /etc/shells -- otherwise only a warning is
-# printed. This prevents someone from setting their shell to /bin/false.
-ONLY_LISTED_SHELLS=yes
-#ONLY_LISTED_SHELLS=no
-
-
-# If HAVE_SYSVINIT is set to "yes", then simpleinit and shutdown will not
-# be built or installed from the login-utils subdirectory. (The shutdown
-# and halt that come with the SysVinit package should be used with the init
-# found in that package.)
-HAVE_SYSVINIT=no
-
-# If HAVE_SYSVINIT_UTILS is set to "yes", then last, mesg, and wall will
-# not be built or installed from the login-utils subdirectory. (The
-# shutdown and init from the SysVinit package do not depend on the last,
-# mesg, and wall from that package.)
-HAVE_SYSVINIT_UTILS=no
-
-# If HAVE_WRITE is set to "yes", then write will not be built or
-# installed from the misc-utils subdirectory.
-# (There is a network aware write in netwrite from NetKit 0.16 or later.)
-HAVE_WRITE=no
-
-# If HAVE_GETTY is set to "yes", then agetty will not be built or
-# installed from the login-utils subdirectory. Note that agetty can
-# co-exist with other gettys, so this option should never be used.
-HAVE_GETTY=no
-
-# If USE_TTY_GROUP is set to "yes", then wall and write will be installed
-# setgid to the "tty" group, and mesg will only set the group write bit.
-# Note that this is only useful if login/xterm/etc. change the group of the
-# user's tty to "tty" [The login in util-linux does this correctly, and
-# xterm will do it correctly if X is compiled with USE_TTY_GROUP set
-# properly.]
-USE_TTY_GROUP=no
-
-# If HAVE_KILL is set to "yes", then kill will not be built or
-# installed from the misc-utils subdirectory.
-# (There is also a kill in the procps package.)
-HAVE_KILL=no
-
-# If ALLOW_VCS_USE is set to "yes", then login will chown /dev/vcsN
-# to the current user, allowing her to make a screendump and do other
-# nifty things on the console, but also allowing him to keep an open
-# file descriptor after logging out to trick the next user.
-ALLOW_VCS_USE=yes
-
-# If HAVE_RESET is set to "yes", then reset won't be installed. The version
-# of reset that comes with the ncurses package is less aggressive.
-HAVE_RESET=yes
-
-# If HAVE_SLN is set to "yes", then sln won't be installed
-# (but the man page sln.8 will be installed anyway).
-# sln also comes with libc and glibc.
-HAVE_SLN=no
-
-# If HAVE_FDUTILS is set to "yes", then setfdprm won't be installed.
-HAVE_FDUTILS=no
-
-# If SILENT_PG is set to "yes", then pg will not ring the bell
-# when an invalid key is pressed
-SILENT_PG=no
-
-# If configure decides that Native Language Support (NLS) is available,
-# it sets MAY_ENABLE_NLS in defines.h. If you don't want NLS, set
-# DISABLE_NLS to "yes".
-DISABLE_NLS=no
-
-# Different optimizations for different cpus.
-# gcc 3.0 likes options -mcpu=i486 instead of -m486
-ifeq "$(ARCH)" "intel"
- ifeq "$(HAVE_OLD_GCC)" "yes"
- CPUHEAD=-m
- else
- CPUHEAD=-mcpu=i
- endif
- ifeq "$(CPU)" "i386"
- CPUTAIL=386
- else
- CPUTAIL=486
- endif
- CPUOPT= $(CPUHEAD)$(CPUTAIL)
- OPT= -pipe -O2 $(CPUOPT) -fomit-frame-pointer
-else
- ifeq "$(ARCH)" "arm"
- OPT= -pipe -O2 -fsigned-char -fomit-frame-pointer
- else
- OPT= -O2 -fomit-frame-pointer
- endif
-endif
-
-WARNFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes
-
-LIB=../lib
-
-ERR_O=$(LIB)/err.o
-
-# Set HAVE_SLANG to yes if you have slang (and prefer to use that for cfdisk)
-# (If neither HAVE_NCURSES nor HAVE_SLANG is defined, cfdisk is not made.)
-# HAVE_SLANG=yes
-# There is a subdirectory /usr/include/slang containing slcurses.h
-# SLANGFLAGS=-I/usr/include/slang
-# No such subdirectory - slcurses.h lives in /usr/include
-# (no extra definition required).
-LIBSLANG=-lslang
-
-#
-# Paths used for compilation (not all are actually used, see CFLAGS below)
-#
-DEV_DIR= /dev
-ETC_DIR= /etc
-SBIN_DIR= /sbin
-USRSBIN_DIR= /usr/sbin
-USRLIB_DIR= /usr/lib
-USRBIN_DIR= /usr/bin
-USRGAMES_DIR= /usr/games
-USRSHAREMISC_DIR=/usr/share/misc
-LOCALE_DIR= /usr/share/locale
-BIN_DIR= /bin
-VAR_PATH= /var
-LOG_DIR= /var/log
-MAN_DIR= /usr/share/man
-INFO_DIR= /usr/share/info
-
-#
-# Paths used for install
-#
-DEVDIR= $(DESTDIR)$(DEV_DIR)
-ETCDIR= $(DESTDIR)$(ETC_DIR)
-SBINDIR= $(DESTDIR)$(SBIN_DIR)
-USRSBINDIR= $(DESTDIR)$(USRSBIN_DIR)
-USRLIBDIR= $(DESTDIR)$(USRLIB_DIR)
-USRBINDIR= $(DESTDIR)$(USRBIN_DIR)
-USRGAMESDIR= $(DESTDIR)$(USRGAMES_DIR)
-USRSHAREMISCDIR=$(DESTDIR)$(USRSHAREMISC_DIR)
-LOCALEDIR= $(DESTDIR)$(LOCALE_DIR)
-BINDIR= $(DESTDIR)$(BIN_DIR)
-VARPATH= $(DESTDIR)$(VAR_PATH)
-LOGDIR= $(DESTDIR)$(LOG_DIR)
-MANDIR= $(DESTDIR)$(MAN_DIR)
-MAN1DIR= $(MANDIR)/man1
-MAN3DIR= $(MANDIR)/man3
-MAN5DIR= $(MANDIR)/man5
-MAN6DIR= $(MANDIR)/man6
-MAN8DIR= $(MANDIR)/man8
-INFODIR= $(DESTDIR)$(INFO_DIR)
-
-# Directory for shutdown, halt, reboot, etc.
-SHUTDOWNDIR= $(SBINDIR)
-
-# Modes
-DIRMODE= 755
-BINMODE= 755
-MANMODE= 644
-DATMODE= 644
-INFOMODE= 644
-SUIDMODE= 4755
-
-CHMOD= chmod
-INSTALL= install
-INSTALLDIR= $(INSTALL) -d -m $(DIRMODE)
-INSTALLBIN= $(INSTALL) -m $(BINMODE)
-INSTALLMAN= $(INSTALL) -m $(MANMODE)
-INSTALLDAT= $(INSTALL) -m $(DATMODE)
-INSTALLSUID= $(INSTALL) -m $(SUIDMODE)
-
-ifeq "$(DISABLE_NLS)" "yes"
-NLSFLAGS = -DDISABLE_NLS
-endif
-
-CFLAGS := $(OPT) -I$(LIB) $(WARNFLAGS) \
- $(CURSESFLAGS) $(SLANGFLAGS) $(NLSFLAGS) \
- -D_FILE_OFFSET_BITS=64 \
- -DSBINDIR=\"$(SBIN_DIR)\" \
- -DUSRSBINDIR=\"$(USRSBIN_DIR)\" \
- -DLOGDIR=\"$(LOG_DIR)\" \
- -DVARPATH=\"$(VAR_PATH)\" \
- -DLOCALEDIR=\"$(LOCALE_DIR)\" \
- $(CFLAGS)
-
-
-%.o: %.c
- $(CC) -c $(CFLAGS) $< -o $@
-
-%: %.cc
- $(CXX) $(CFLAGS) $< -o $@
-
diff --git a/meta/recipes-core/util-linux/util-linux/defines.h b/meta/recipes-core/util-linux/util-linux/defines.h
deleted file mode 100644
index 6ce6b86df5..0000000000
--- a/meta/recipes-core/util-linux/util-linux/defines.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#define UTIL_LINUX_VERSION "2.12"
-#define util_linux_version "util-linux-2.12"
-
-#define HAVE_blkpg_h
-#define HAVE_kd_h
-#define HAVE_locale_h
-#define HAVE_langinfo_h
-#define HAVE_sys_user_h
-#define HAVE_asm_types_h
-//#define NEED_tqueue_h
diff --git a/meta/recipes-core/util-linux/util-linux/fix-configure.patch b/meta/recipes-core/util-linux/util-linux/fix-configure.patch
deleted file mode 100644
index cefae97e9c..0000000000
--- a/meta/recipes-core/util-linux/util-linux/fix-configure.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-The userlib_execdir was not getting set correctly, the quoting
-was wrong as these quoted items were not getting expanded correctly.
-
-Upstream-Status: Pending
-
-Signed-off-by: Saul Wold <sgw@linux.intel.com>
-
-Index: util-linux-2.24.1/configure.ac
-===================================================================
---- util-linux-2.24.1.orig/configure.ac
-+++ util-linux-2.24.1/configure.ac
-@@ -76,7 +76,7 @@ fi
- AC_SUBST([usrsbin_execdir])
-
- AS_CASE([$libdir],
-- ['${exec_prefix}/'* | '${prefix}/'* | /usr/*],
-+ [${exec_prefix}/* | ${prefix}/* | /usr/*],
- [usrlib_execdir=$libdir],
- [usrlib_execdir='${exec_prefix}'$libdir]
- )
diff --git a/meta/recipes-core/util-linux/util-linux/make_include b/meta/recipes-core/util-linux/util-linux/make_include
deleted file mode 100644
index e6abcd91f7..0000000000
--- a/meta/recipes-core/util-linux/util-linux/make_include
+++ /dev/null
@@ -1,17 +0,0 @@
-VERSION=2.12
-CC=gcc
-CFLAGS=
-LDFLAGS=
-HAVE_OLD_GCC=yes
-HAVE_RAW_H=yes
-HAVE_NCURSES=yes
-CURSESFLAGS=-DNCH=1
-LIBCURSES=-lncurses
-HAVE_TERMCAP=no
-NEED_LIBCRYPT=yes
-FOREIGN = --foreign-user
-HAVE_XGETTEXT=yes
-HAVE_OPENPTY=yes
-HAVE_PIVOT_ROOT=yes
-HAVE_GOOD_RPC=yes
-HAVE_ZLIB=yes
diff --git a/meta/recipes-core/util-linux/util-linux/swapargs.h b/meta/recipes-core/util-linux/util-linux/swapargs.h
deleted file mode 100644
index e960eef05f..0000000000
--- a/meta/recipes-core/util-linux/util-linux/swapargs.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SWAPON_HAS_TWO_ARGS
-#include <asm/page.h>
-#include <sys/swap.h>
diff --git a/meta/recipes-core/util-linux/util-linux/util-linux-ensure-the-existence-of-directory-for-PAT.patch b/meta/recipes-core/util-linux/util-linux/util-linux-ensure-the-existence-of-directory-for-PAT.patch
deleted file mode 100644
index 8f26451aa8..0000000000
--- a/meta/recipes-core/util-linux/util-linux/util-linux-ensure-the-existence-of-directory-for-PAT.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-Upstream-Status: Pending
-
-util-linux: ensure the existence of directory for PATHFILES
-
-When compiling util-linux, it's possible to encounter the following error.
- /bin/sh: line 2:: misc-utils/uuidd.8.tmp: No such file or directory
-
-This is because that the misc-utils directory doesn't exist when trying to write to
-misc-utils/uuidd.8.tmp.
-
-When generating misc-utils/uuidd.8 (or anything in PATHFILES), its directory
-may not have been created yet. So we need to ensure the existence of the directory
-to avoid the compilation error.
-
-Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
----
- Makefile.am | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/Makefile.am b/Makefile.am
-index 17f4c33..ca3dc0f 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -123,6 +123,7 @@ EXTRA_DIST += $(PATHFILES:=.in)
-
- $(PATHFILES): Makefile
- @ rm -f $@ $@.tmp
-+ @ mkdir -p `dirname $@`
- $(AM_V_GEN) srcdir=''; \
- test -f ./$@.in || srcdir=$(srcdir)/; \
- $(edit_cmd) $${srcdir}$@.in >$@.tmp
---
-1.7.9.5
-
diff --git a/meta/recipes-core/util-linux/util-linux/util-linux-native.patch b/meta/recipes-core/util-linux/util-linux/util-linux-native.patch
index afe543c6e8..1f496dee21 100644
--- a/meta/recipes-core/util-linux/util-linux/util-linux-native.patch
+++ b/meta/recipes-core/util-linux/util-linux/util-linux-native.patch
@@ -16,24 +16,29 @@ Patches revert upstream changes in order to support older
machines.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ configure.ac | 1 +
+ include/c.h | 7 +++++++
+ 2 files changed, 8 insertions(+)
-Index: util-linux-2.24.1/configure.ac
-===================================================================
---- util-linux-2.24.1.orig/configure.ac
-+++ util-linux-2.24.1/configure.ac
-@@ -302,6 +302,7 @@ AC_CHECK_FUNCS([ \
+diff --git a/configure.ac b/configure.ac
+index eb3680b..93e015f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -318,6 +318,7 @@ AC_CHECK_FUNCS([ \
llseek \
lseek64 \
mempcpy \
+ mkostemp \
nanosleep \
+ open_memstream \
personality \
- posix_fadvise \
-Index: util-linux-2.24.1/include/c.h
-===================================================================
---- util-linux-2.24.1.orig/include/c.h
-+++ util-linux-2.24.1/include/c.h
-@@ -236,6 +236,13 @@ static inline int dirfd(DIR *d)
+diff --git a/include/c.h b/include/c.h
+index e423e8b..cf33b94 100644
+--- a/include/c.h
++++ b/include/c.h
+@@ -233,6 +233,13 @@ static inline int dirfd(DIR *d)
#endif
/*
@@ -47,27 +52,6 @@ Index: util-linux-2.24.1/include/c.h
* MAXHOSTNAMELEN replacement
*/
static inline size_t get_hostname_max(void)
-Index: util-linux-2.24.1/lib/randutils.c
-===================================================================
---- util-linux-2.24.1.orig/lib/randutils.c
-+++ util-linux-2.24.1/lib/randutils.c
-@@ -16,6 +16,7 @@
- #include <sys/syscall.h>
-
- #include "randutils.h"
-+#include "c.h"
-
- #ifdef HAVE_TLS
- #define THREAD_LOCAL static __thread
-Index: util-linux-2.24.1/lib/wholedisk.c
-===================================================================
---- util-linux-2.24.1.orig/lib/wholedisk.c
-+++ util-linux-2.24.1/lib/wholedisk.c
-@@ -10,6 +10,7 @@
-
- #include "blkdev.h"
- #include "wholedisk.h"
-+#include "c.h"
-
- int is_whole_disk_fd(int fd, const char *name)
- {
+--
+1.9.1
+
diff --git a/meta/recipes-core/util-linux/util-linux/util-linux-ng-replace-siginterrupt.patch b/meta/recipes-core/util-linux/util-linux/util-linux-ng-replace-siginterrupt.patch
index f131b763ca..6717a75a90 100644
--- a/meta/recipes-core/util-linux/util-linux/util-linux-ng-replace-siginterrupt.patch
+++ b/meta/recipes-core/util-linux/util-linux/util-linux-ng-replace-siginterrupt.patch
@@ -1,27 +1,33 @@
Upstream-Status: Pending
-Index: util-linux-2.22.1/login-utils/login.c
-===================================================================
---- util-linux-2.22.1.orig/login-utils/login.c
-+++ util-linux-2.22.1/login-utils/login.c
-@@ -1239,6 +1239,8 @@ int main(int argc, char **argv)
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ login-utils/login.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/login-utils/login.c b/login-utils/login.c
+index ebb76f5..38c881b 100644
+--- a/login-utils/login.c
++++ b/login-utils/login.c
+@@ -1110,6 +1110,7 @@ int main(int argc, char **argv)
char *buff;
int childArgc = 0;
int retcode;
+ struct sigaction act;
-+
char *pwdbuf = NULL;
struct passwd *pwd = NULL, _pwd;
-@@ -1252,7 +1254,10 @@ int main(int argc, char **argv)
+@@ -1123,7 +1124,9 @@ int main(int argc, char **argv)
timeout = (unsigned int)getlogindefs_num("LOGIN_TIMEOUT", LOGIN_TIMEOUT);
signal(SIGALRM, timedout);
-- siginterrupt(SIGALRM, 1); /* we have to interrupt syscalls like ioclt() */
+- siginterrupt(SIGALRM, 1); /* we have to interrupt syscalls like ioctl() */
+ (void) sigaction(SIGALRM, NULL, &act);
+ act.sa_flags &= ~SA_RESTART;
+ sigaction(SIGALRM, &act, NULL);
-+
alarm(timeout);
signal(SIGQUIT, SIG_IGN);
signal(SIGINT, SIG_IGN);
+--
+1.9.1
+
diff --git a/meta/recipes-core/util-linux/util-linux_2.24.2.bb b/meta/recipes-core/util-linux/util-linux_2.25.2.bb
index ed753e48b3..0ff1e7cc64 100644
--- a/meta/recipes-core/util-linux/util-linux_2.24.2.bb
+++ b/meta/recipes-core/util-linux/util-linux_2.25.2.bb
@@ -1,4 +1,4 @@
-MAJOR_VERSION = "2.24"
+MAJOR_VERSION = "2.25"
require util-linux.inc
PR = "r1"
@@ -13,14 +13,13 @@ SRC_URI += "file://util-linux-ng-replace-siginterrupt.patch \
file://util-linux-ng-2.16-mount_lock_path.patch \
file://uclibc-__progname-conflict.patch \
file://configure-sbindir.patch \
- file://fix-configure.patch \
file://fix-parallel-build.patch \
- file://util-linux-ensure-the-existence-of-directory-for-PAT.patch \
+ file://CVE-2014-9114.patch \
${OLDHOST} \
"
-SRC_URI[md5sum] = "3f191727a0d28f7204b755cf1b6ea0aa"
-SRC_URI[sha256sum] = "1243d6c07f1c5b38aa4c3814c81a71c24cba7dafe08942916bf216a90a460ff0"
+SRC_URI[md5sum] = "cab3d7be354000f629bc601238b629b3"
+SRC_URI[sha256sum] = "e0457f715b73f4a349e1acb08cb410bf0edc9a74a3f75c357070f31f70e33cd6"
CACHED_CONFIGUREVARS += "scanf_cv_alloc_modifier=ms"
diff --git a/meta/recipes-core/volatile-binds/files/COPYING.MIT b/meta/recipes-core/volatile-binds/files/COPYING.MIT
new file mode 100644
index 0000000000..7e7d57413d
--- /dev/null
+++ b/meta/recipes-core/volatile-binds/files/COPYING.MIT
@@ -0,0 +1,17 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/meta/recipes-core/volatile-binds/files/mount-copybind b/meta/recipes-core/volatile-binds/files/mount-copybind
new file mode 100755
index 0000000000..2aeaf84ddb
--- /dev/null
+++ b/meta/recipes-core/volatile-binds/files/mount-copybind
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# Perform a bind mount, copying existing files as we do so to ensure the
+# overlaid path has the necessary content.
+
+if [ $# -lt 2 ]; then
+ echo >&2 "Usage: $0 spec mountpoint [OPTIONS]"
+ exit 1
+fi
+
+spec=$1
+mountpoint=$2
+
+if [ $# -gt 2 ]; then
+ options=$3
+else
+ options=
+fi
+
+[ -n "$options" ] && options=",$options"
+
+mkdir -p "${spec%/*}"
+if [ -d "$mountpoint" ]; then
+ if [ ! -d "$spec" ]; then
+ mkdir "$spec"
+ cp -pPR "$mountpoint"/. "$spec/"
+ fi
+elif [ -f "$mountpoint" ]; then
+ if [ ! -f "$spec" ]; then
+ cp -pP "$mountpoint" "$spec"
+ fi
+fi
+
+mount -o "bind$options" "$spec" "$mountpoint"
diff --git a/meta/recipes-core/volatile-binds/files/volatile-binds.service.in b/meta/recipes-core/volatile-binds/files/volatile-binds.service.in
new file mode 100644
index 0000000000..32be5b4425
--- /dev/null
+++ b/meta/recipes-core/volatile-binds/files/volatile-binds.service.in
@@ -0,0 +1,19 @@
+[Unit]
+Description=Bind mount volatile @where@
+DefaultDependencies=false
+Before=local-fs.target
+RequiresMountsFor=@whatparent@ @whereparent@
+ConditionPathIsReadWrite=@whatparent@
+ConditionPathExists=@where@
+ConditionPathIsReadWrite=!@where@
+
+[Service]
+Type=oneshot
+RemainAfterExit=Yes
+StandardOutput=syslog
+TimeoutSec=0
+ExecStart=/sbin/mount-copybind @what@ @where@
+ExecStop=/sbin/umount @where@
+
+[Install]
+WantedBy=local-fs.target
diff --git a/meta/recipes-core/volatile-binds/volatile-binds.bb b/meta/recipes-core/volatile-binds/volatile-binds.bb
new file mode 100644
index 0000000000..694ba1e487
--- /dev/null
+++ b/meta/recipes-core/volatile-binds/volatile-binds.bb
@@ -0,0 +1,69 @@
+SUMMARY = "Volatile bind mount setup and configuration for read-only-rootfs"
+DESCRIPTION = "${SUMMARY}"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://../COPYING.MIT;md5=5750f3aa4ea2b00c2bf21b2b2a7b714d"
+
+SRC_URI = "\
+ file://mount-copybind \
+ file://COPYING.MIT \
+ file://volatile-binds.service.in \
+"
+
+inherit allarch systemd distro_features_check
+
+REQUIRED_DISTRO_FEATURES = "systemd"
+
+VOLATILE_BINDS ?= "\
+ /var/volatile/lib /var/lib\n\
+"
+VOLATILE_BINDS[type] = "list"
+VOLATILE_BINDS[separator] = "\n"
+
+def volatile_systemd_services(d):
+ services = []
+ for line in oe.data.typed_value("VOLATILE_BINDS", d):
+ if not line:
+ continue
+ what, where = line.split(None, 1)
+ services.append("%s.service" % what[1:].replace("/", "-"))
+ return " ".join(services)
+
+SYSTEMD_SERVICE_${PN} = "${@volatile_systemd_services(d)}"
+
+FILES_${PN} += "${systemd_unitdir}/system/*.service"
+
+do_compile () {
+ while read spec mountpoint; do
+ if [ -z "$spec" ]; then
+ continue
+ fi
+
+ servicefile="${spec#/}"
+ servicefile="$(echo "$servicefile" | tr / -).service"
+ sed -e "s#@what@#$spec#g; s#@where@#$mountpoint#g" \
+ -e "s#@whatparent@#${spec%/*}#g; s#@whereparent@#${mountpoint%/*}#g" \
+ volatile-binds.service.in >$servicefile
+ done <<END
+${@d.getVar('VOLATILE_BINDS', True).replace("\\n", "\n")}
+END
+
+ if [ -e var-volatile-lib.service ]; then
+ # As the seed is stored under /var/lib, ensure that this service runs
+ # after the volatile /var/lib is mounted.
+ sed -i -e "/^Before=/s/\$/ systemd-random-seed.service/" \
+ -e "/^WantedBy=/s/\$/ systemd-random-seed.service/" \
+ var-volatile-lib.service
+ fi
+}
+do_compile[dirs] = "${WORKDIR}"
+
+do_install () {
+ install -d ${D}${base_sbindir}
+ install -m 0755 mount-copybind ${D}${base_sbindir}/
+
+ install -d ${D}${systemd_unitdir}/system
+ for service in ${SYSTEMD_SERVICE_volatile-binds}; do
+ install -m 0644 $service ${D}${systemd_unitdir}/system/
+ done
+}
+do_install[dirs] = "${WORKDIR}"
diff --git a/meta/recipes-core/zlib/zlib-1.2.8/ldflags-tests.patch b/meta/recipes-core/zlib/zlib-1.2.8/ldflags-tests.patch
new file mode 100644
index 0000000000..650794f504
--- /dev/null
+++ b/meta/recipes-core/zlib/zlib-1.2.8/ldflags-tests.patch
@@ -0,0 +1,45 @@
+Obey LDFLAGS for tests
+
+Signed-off-by: Christopher Larson <chris_larson@mentor.com>
+Upstream-status: Pending
+
+--- zlib-1.2.8.orig/Makefile.in
++++ zlib-1.2.8/Makefile.in
+@@ -26,7 +26,7 @@ CFLAGS=-O
+
+ SFLAGS=-O
+ LDFLAGS=
+-TEST_LDFLAGS=-L. libz.a
++TEST_LDFLAGS=-L. $(LDFLAGS)
+ LDSHARED=$(CC)
+ CPP=$(CC) -E
+
+@@ -176,22 +176,22 @@ placebo $(SHAREDLIBV): $(PIC_OBJS) libz.
+ -@rmdir objs
+
+ example$(EXE): example.o $(STATICLIB)
+- $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
++ $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS) $(STATICLIB)
+
+ minigzip$(EXE): minigzip.o $(STATICLIB)
+- $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
++ $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS) $(STATICLIB)
+
+ examplesh$(EXE): example.o $(SHAREDLIBV)
+- $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
++ $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS) $(SHAREDLIBV)
+
+ minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
+- $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
++ $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS) $(SHAREDLIBV)
+
+ example64$(EXE): example64.o $(STATICLIB)
+- $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
++ $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS) $(STATICLIB)
+
+ minigzip64$(EXE): minigzip64.o $(STATICLIB)
+- $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS)
++ $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS) $(STATICLIB)
+
+ install-libs: $(LIBS)
+ -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
diff --git a/meta/recipes-core/zlib/zlib_1.2.8.bb b/meta/recipes-core/zlib/zlib_1.2.8.bb
index bdfa045b7b..ca0ba3ff6e 100644
--- a/meta/recipes-core/zlib/zlib_1.2.8.bb
+++ b/meta/recipes-core/zlib/zlib_1.2.8.bb
@@ -10,6 +10,7 @@ LIC_FILES_CHKSUM = "file://zlib.h;beginline=4;endline=23;md5=fde612df1e5933c428b
SRC_URI = "http://www.zlib.net/${BPN}-${PV}.tar.xz \
file://remove.ldconfig.call.patch \
file://Makefile-runtests.patch \
+ file://ldflags-tests.patch \
file://run-ptest \
"