summaryrefslogtreecommitdiffstats
path: root/meta-linaro-toolchain
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2015-10-08 22:46:13 +0200
committerTudor Florea <tudor.florea@enea.com>2015-10-08 22:46:13 +0200
commit8d89651ef729e560ad96dcfc002fcde6ff7f923b (patch)
treeeb5be01c25f735d12fe9881ee6327c9b7e8bbe39 /meta-linaro-toolchain
downloadmeta-linaro-dizzy-enea.tar.gz
initial commit for Enea Linux 5.0 armdizzy-enea
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta-linaro-toolchain')
-rw-r--r--meta-linaro-toolchain/conf/distro/include/external-linaro-toolchain-versions.inc111
-rw-r--r--meta-linaro-toolchain/conf/distro/include/tcmode-external-linaro.inc101
-rw-r--r--meta-linaro-toolchain/conf/layer.conf13
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-initial_linaro-2.20.bb11
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0001-R_ARM_TLS_DTPOFF32.patch56
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch33
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/GLRO_dl_debug_mask.patch529
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/IO-acquire-lock-fix.patch17
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/add_resource_h_to_wait_h.patch20
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-header-bootstrap.patch85
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-install-pic-archives.patch109
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-ppc8xx-cache-line-workaround.patch68
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-resolv-dynamic.patch54
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-sh4-fpscr_values.patch42
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-use-option-groups.patch16577
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc.patch602
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/etc/ld.so.conf0
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/fix-tibetian-locales.patch38
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/fix_am_rootsbindir.patch29
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/fsl-ppc-no-fsqrt.patch100
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/generate-supported.mk11
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/glibc.fix_sqrt2.patch1516
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/grok_gold.patch34
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/initgroups_keys.patch20
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/ld-search-order.patch56
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/mips-rld-map-check.patch27
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/multilib_readlib.patch19
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/option-groups.patch1397
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/ppc-sqrt_finite.patch184
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/ppc_slow_ieee754_sqrt.patch365
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/ppce6500-32b_slow_ieee754_sqrt.patch47
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/relocatable_sdk.patch108
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/relocatable_sdk_fix_openpath.patch41
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/timezone-re-written-tzselect-as-posix-sh.patch38
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-locale_linaro-2.20.bb1
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-mtrace_linaro-2.20.bb1
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-scripts_linaro-2.20.bb1
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc_linaro-2.20.bb173
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/32and64bit.patch331
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/README8
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling.patch454
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/endianess-header.patch113
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/flag_fix.patch24
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch37
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2bin0 -> 21491 bytes
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig.patch471
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch36
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/ldconfig-native_2.12.1.bb32
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/site_config/funcs474
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/site_config/headers156
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/site_config/types21
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-cross-canadian_linaro-2.24.bb3
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-cross_linaro-2.24.bb3
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-crosssdk_linaro-2.24.bb13
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24.inc47
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/0001-AArch64-Define-LP64-BE-linker-name.patch18
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/0001-AArch64-Define-LP64-LE-loader-name.patch20
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/0001-Fix-MMIX-build-breakage-from-bfd_set_section_vma-cha.patch31
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-armv5e.patch25
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-poison.patch259
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-100-uclibc-conf.patch40
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-300-001_ld_makefile_patch.patch55
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-300-006_better_file_error.patch45
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-300-012_check_ldrunpath_length.patch49
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-gas-needs-libm.patch38
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uninitialised-warning.patch50
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-xlp-support.patch402
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/fix-pr15815.patch36
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/fix-pr16428.patch123
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/fix-pr16476.patch220
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/fix-pr2404.patch76
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/libiberty_path_fix.patch22
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/libtool-2.4-update.patch19317
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/libtool-rpath-fix.patch39
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/mips64-default-ld-emulation.patch54
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/relocatable_sdk.patch49
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/replace_macros_with_static_inline.patch188
-rw-r--r--meta-linaro-toolchain/recipes-devtools/binutils/binutils_linaro-2.24.bb39
-rw-r--r--meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/external-linaro-toolchain.bb376
-rw-r--r--meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/files/SUPPORTED1
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross-canadian_linaro-4.8.bb2
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross-canadian_linaro-4.9.bb2
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross-initial_linaro-4.8.bb3
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross-initial_linaro-4.9.bb3
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross_linaro-4.8.bb3
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross_linaro-4.9.bb3
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-crosssdk-initial_linaro-4.8.bb4
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-crosssdk-initial_linaro-4.9.bb4
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-crosssdk_linaro-4.8.bb2
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-crosssdk_linaro-4.9.bb2
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8.inc73
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0001-AArch64-Define-BE-loader-name.patch42
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch39
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0002-uclibc-conf.patch53
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0003-gcc-uclibc-locale-ctype_touplow_t.patch87
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0004-uclibc-locale.patch2862
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0005-uclibc-locale-no__x.patch257
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0006-uclibc-locale-wchar_fix.patch68
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0007-uclibc-locale-update.patch542
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0008-missing-execinfo_h.patch28
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0009-c99-snprintf.patch28
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0010-c99-complex-ugly-hack.patch29
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0011-index_macro.patch44
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0012-libmudflap-susv3-legacy.patch64
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0013-libstdc-namespace.patch54
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0014-sh-pr24836.patch29
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch29
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0016-gcc-poison-system-directories.patch224
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0017-gcc-poison-dir-extend.patch39
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch73
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0019-64-bit-multilib-hack.patch82
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0020-optional-libstdc.patch102
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch59
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0022-COLLECT_GCC_OPTIONS.patch38
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch88
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0024-PR-target-32219.patch67
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0025-fortran-cross-compile-hack.patch46
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0026-libgcc-sjlj-check.patch74
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0027-cpp-honor-sysroot.patch54
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0028-MIPS64-Default-to-N64-ABI.patch31
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch190
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0030-gcc-Fix-argument-list-too-long-error.patch40
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0031-Disable-sdt.patch45
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0032-libtool.patch42
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch43
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch102
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0035-wcast-qual-PR-55383.patch55
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0037-gcc-4.8-PR56797.patch66
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0038-gcc-4.8-build-args.patch41
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0039-gcc-4.8-PR57717.patch23
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0040-fix-g++-sysroot.patch40
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0041-libtool-avoid-libdir.patch19
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0042-pr57748.patch78
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0043-cpp.patch40
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0044-gengtypes.patch97
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0045-gcc-4.8-PR57717-PowerPC-E500v2.patch21
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0046-libatomic-deptracking.patch41
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0047-repomembug.patch53
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0048-PR58854_fix_arm_apcs_epilogue.patch23
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch42
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0050-PR-target-58595.patch101
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/AArch64-Define-BE-loader-name-default-be.patch38
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/gcc-4.8-PR56797.patch66
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/use-lib-for-aarch64.patch14
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9.inc73
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch42
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0002-uclibc-conf.patch53
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0003-gcc-uclibc-locale-ctype_touplow_t.patch87
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0004-uclibc-locale.patch2862
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0005-uclibc-locale-no__x.patch257
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0006-uclibc-locale-wchar_fix.patch68
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0007-uclibc-locale-update.patch542
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0008-missing-execinfo_h.patch28
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0009-c99-snprintf.patch28
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0010-c99-complex-ugly-hack.patch29
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0011-index_macro.patch44
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0013-libstdc-namespace.patch54
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0014-sh-pr24836.patch45
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch39
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0016-gcc-poison-system-directories.patch190
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0017-gcc-poison-dir-extend.patch39
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch73
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0019-64-bit-multilib-hack.patch82
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0020-optional-libstdc.patch98
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch59
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0022-COLLECT_GCC_OPTIONS.patch38
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch88
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0024-PR-target-32219.patch62
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0025-fortran-cross-compile-hack.patch46
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0026-libgcc-sjlj-check.patch74
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0027-cpp-honor-sysroot.patch54
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0028-MIPS64-Default-to-N64-ABI.patch31
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch228
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0030-gcc-Fix-argument-list-too-long-error.patch40
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0031-Disable-sdt.patch113
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0032-libtool.patch42
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch40
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch102
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0037-gcc-4.8-PR56797.patch66
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0040-fix-g++-sysroot.patch40
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0041-libtool-avoid-libdir.patch19
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0043-cpp.patch40
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0044-gengtypes.patch97
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0046-libatomic-deptracking.patch41
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0047-repomembug.patch53
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch42
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0050-Revert-Use-dbx_reg_number-for-spanning-registers.patch80
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0051-eabispe.patch23
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0052-Fix-GCC-targeting-E500-SPE-errors-with-the-_Decimal64-type.patch98
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch66
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0054-gcc-Makefile.in-fix-parallel-building-failure.patch61
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0055-PR-rtl-optimization-61801.patch36
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0056-top-level-reorder_gcc-bug-61144.patch31
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0058-gcc-r212171.patch113
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0059-gcc-PR-rtl-optimization-63348.patch59
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/AArch64-Define-BE-loader-name-default-be.patch38
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/use-lib-for-aarch64.patch13
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-common-4.8.inc2
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-common-4.9.inc2
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-runtime_linaro-4.8.bb2
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-runtime_linaro-4.9.bb2
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-source_linaro-4.8.bb3
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-source_linaro-4.9.bb3
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc_linaro-4.8.bb4
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc_linaro-4.9.bb4
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/libgcc-initial_linaro-4.8.bb3
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/libgcc-initial_linaro-4.9.bb3
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/libgcc_linaro-4.8.bb2
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/libgcc_linaro-4.9.bb2
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/libgfortran_linaro-4.8.bb4
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/libgfortran_linaro-4.9.bb4
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gdb/gdb-7.8/sim-install-6.6.patch14
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gdb/gdb-cross-canadian_linaro-7.8.bb3
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gdb/gdb-cross_linaro-7.8.bb4
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gdb/gdb-linaro-7.8.inc20
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gdb/gdb_linaro-7.8.bb23
216 files changed, 59952 insertions, 0 deletions
diff --git a/meta-linaro-toolchain/conf/distro/include/external-linaro-toolchain-versions.inc b/meta-linaro-toolchain/conf/distro/include/external-linaro-toolchain-versions.inc
new file mode 100644
index 0000000..6165520
--- /dev/null
+++ b/meta-linaro-toolchain/conf/distro/include/external-linaro-toolchain-versions.inc
@@ -0,0 +1,111 @@
1def elt_run(d, cmd, *args):
2 import bb.process
3 import subprocess
4
5 topdir = d.getVar('TOPDIR', True)
6 toolchain_path = d.getVar('EXTERNAL_TOOLCHAIN', True)
7 if not toolchain_path:
8 return 'UNKNOWN', 'UNKNOWN'
9
10 target_prefix = d.getVar('TARGET_PREFIX', True)
11 path = os.path.join(toolchain_path, 'bin', target_prefix + cmd)
12 args = [path] + list(args)
13
14 return bb.process.run(args, cwd=topdir, stderr=subprocess.PIPE)
15
16def elt_get_version(d):
17 try:
18 stdout, stderr = elt_run(d, 'gcc', '-v')
19 except bb.process.CmdError as exc:
20 bb.error('Failed to obtain external Linaro toolchain version: %s' % exc)
21 return 'UNKNOWN'
22 else:
23 last_line = stderr.splitlines()[-1]
24 return last_line
25
26def elt_get_main_version(d):
27 version = elt_get_version(d)
28 if version != 'UNKNOWN':
29 if version.split()[5] != '(crosstool-NG':
30 return version.split()[7].split(')')[0]
31 else:
32 return version.split()[6].split('-')[3]
33 else:
34 return version
35
36def elt_get_gcc_version(d):
37 version = elt_get_version(d)
38 if version != 'UNKNOWN':
39 return version.split()[2]
40 else:
41 return version
42
43def elt_get_libc_version(d):
44 import os,bb
45 syspath = bb.data.expand('${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}', d)
46 if not syspath:
47 return 'UNKNOWN'
48
49 libpath = syspath + '/libc/lib/' + bb.data.expand('${ELT_TARGET_SYS}/', d)
50
51 if os.path.exists(libpath):
52 for file in os.listdir(libpath):
53 if file.find('libc-') == 0:
54 return file[5:-3]
55
56 libpath = syspath + '/libc/lib/'
57
58 if os.path.exists(libpath):
59 for file in os.listdir(libpath):
60 if file.find('libc-') == 0:
61 return file[5:-3]
62 return 'UNKNOWN'
63
64def elt_get_kernel_version(d):
65 import os,bb
66 syspath = bb.data.expand('${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}', d)
67 if not syspath:
68 return 'UNKNOWN'
69
70 vf = syspath + '/libc/usr/include/linux/version.h'
71
72 try:
73 f = open(vf, 'r')
74 except (OSError, IOError):
75 return 'UNKNOWN'
76
77 l = f.readlines();
78 f.close();
79 for s in l:
80 if s.find('LINUX_VERSION_CODE') > 0:
81 ver = int(s.split()[2])
82 maj = ver / 65536
83 ver = ver % 65536
84 min = ver / 256
85 ver = ver % 256
86 return str(maj)+'.'+str(min)+'.'+str(ver)
87 return 'UNKNOWN'
88
89def elt_get_gdb_version(d):
90 try:
91 stdout, stderr = elt_run(d, 'gdb', '-v')
92 except bb.process.CmdError:
93 return 'UNKNOWN'
94 else:
95 first_line = stdout.splitlines()[0]
96 return first_line.split()[-1]
97
98python external_linaro_toolchain_version_handler () {
99 if not isinstance(e, bb.event.ConfigParsed):
100 return
101 d = e.data
102 ld = d.createCopy()
103 ld.finalize()
104
105 d.setVar('ELT_VER_MAIN', elt_get_main_version(ld))
106 d.setVar('ELT_VER_GCC', elt_get_gcc_version(ld))
107 d.setVar('ELT_VER_LIBC', elt_get_libc_version(ld))
108 d.setVar('ELT_VER_KERNEL', elt_get_kernel_version(ld))
109 d.setVar('ELT_VER_GDB', elt_get_gdb_version(ld))
110}
111addhandler external_linaro_toolchain_version_handler
diff --git a/meta-linaro-toolchain/conf/distro/include/tcmode-external-linaro.inc b/meta-linaro-toolchain/conf/distro/include/tcmode-external-linaro.inc
new file mode 100644
index 0000000..19be8af
--- /dev/null
+++ b/meta-linaro-toolchain/conf/distro/include/tcmode-external-linaro.inc
@@ -0,0 +1,101 @@
1#
2# Configuration to use an external Linaro binary toolchain
3#
4
5EXTERNAL_TOOLCHAIN ?= "/usr/local/linaro-binary-toolchain/${TARGET_ARCH}"
6
7TOOLCHAIN_PATH_ADD = "${EXTERNAL_TOOLCHAIN}/bin:"
8PATH =. "${TOOLCHAIN_PATH_ADD}"
9
10ELT_TARGET_SYS_arm ?= "arm-linux-gnueabihf"
11ELT_TARGET_SYS_aarch64 ?= "aarch64-linux-gnu"
12ELT_TARGET_SYS = "${TARGET_SYS}"
13TARGET_PREFIX = "${ELT_TARGET_SYS}-"
14
15GCCMULTILIB_forcevariable = "--disable-multilib"
16IMAGE_LINGUAS_forcevariable = ""
17
18PREFERRED_PROVIDER_linux-libc-headers = "external-linaro-toolchain"
19PREFERRED_PROVIDER_linux-libc-headers-dev = "external-linaro-toolchain"
20PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc = "external-linaro-toolchain"
21PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-initial = "external-linaro-toolchain"
22PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++ = "external-linaro-toolchain"
23PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}binutils = "external-linaro-toolchain"
24PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}libc-for-gcc = "external-linaro-toolchain"
25PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs = "external-linaro-toolchain"
26PREFERRED_PROVIDER_glibc = "external-linaro-toolchain"
27PREFERRED_PROVIDER_libgcc = "external-linaro-toolchain"
28PREFERRED_PROVIDER_virtual/libc = "external-linaro-toolchain"
29PREFERRED_PROVIDER_virtual/libintl = "external-linaro-toolchain"
30PREFERRED_PROVIDER_virtual/libiconv = "external-linaro-toolchain"
31PREFERRED_PROVIDER_glibc-thread-db = "external-linaro-toolchain"
32PREFERRED_PROVIDER_virtual/linux-libc-headers = "external-linaro-toolchain"
33
34TARGET_CPPFLAGS_prepend = " -isystem${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/include "
35TARGET_LDFLAGS_prepend = " -L${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/lib -Wl,-rpath-link,${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/lib "
36
37TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_HOST}"
38
39DISTRO_FEATURES_LIBC = "ipv4 ipv6 libc-backtrace libc-big-macros libc-bsd libc-cxx-tests libc-catgets libc-crypt \
40 libc-crypt-ufc libc-db-aliases libc-envz libc-fcvt libc-fmtmsg libc-fstab libc-ftraverse \
41 libc-getlogin libc-idn libc-inet-anl libc-libm libc-libm-big \
42 libc-memusage libc-nis libc-nsswitch libc-rcmd libc-rtld-debug libc-spawn libc-streams libc-sunrpc \
43 libc-utmp libc-utmpx libc-wordexp libc-posix-clang-wchar libc-posix-regexp libc-posix-regexp-glibc \
44 libc-posix-wchar-io"
45
46ENABLE_BINARY_LOCALE_GENERATION = "0"
47GLIBC_INTERNAL_USE_BINARY_LOCALE = "precompiled"
48
49ERROR_QA[type] ?= "list"
50python toolchain_metadata_setup () {
51 import subprocess
52 if not isinstance(e, bb.event.ConfigParsed):
53 return
54
55 d = e.data
56 l = d.createCopy()
57 l.finalize()
58 oe_import(l)
59
60 external_toolchain = l.getVar('EXTERNAL_TOOLCHAIN', True)
61 if not external_toolchain or external_toolchain == 'UNDEFINED':
62 bb.fatal("Error: EXTERNAL_TOOLCHAIN must be set to the path to your linaro toolchain")
63
64 if not os.path.exists(external_toolchain):
65 bb.fatal("Error: EXTERNAL_TOOLCHAIN path '%s' does not exist" % external_toolchain)
66
67 # The external toolchain may not have been built with the oe-core preferred
68 # gnu hash setting, so ensure that the corresponding sanity check is not an error.
69 error_qa = oe.data.typed_value('ERROR_QA', l)
70 if 'ldflags' in error_qa:
71 error_qa.remove('ldflags')
72 d.setVar('ERROR_QA', ' '.join(error_qa))
73}
74addhandler toolchain_metadata_setup
75
76def populate_toolchain_links(d):
77 import errno
78 import os
79 from glob import glob
80
81 d = d.createCopy()
82 d.finalize()
83
84 pattern = bb.data.expand('${EXTERNAL_TOOLCHAIN}/bin/${TARGET_PREFIX}*', d)
85 files = glob(pattern)
86 if not files:
87 bb.fatal("Unable to populate toolchain binary symlinks")
88
89 bindir = d.getVar('STAGING_BINDIR_TOOLCHAIN', True)
90 bb.mkdirhier(bindir)
91 for f in files:
92 base = os.path.basename(f)
93 newpath = os.path.join(bindir, base)
94 try:
95 os.symlink(f, newpath)
96 except OSError as exc:
97 if exc.errno == errno.EEXIST:
98 break
99 bb.fatal("Unable to populate toolchain binary symlink for %s: %s" % (newpath, exc))
100
101require conf/distro/include/external-linaro-toolchain-versions.inc
diff --git a/meta-linaro-toolchain/conf/layer.conf b/meta-linaro-toolchain/conf/layer.conf
new file mode 100644
index 0000000..7e96dcd
--- /dev/null
+++ b/meta-linaro-toolchain/conf/layer.conf
@@ -0,0 +1,13 @@
1BBPATH .= ":${LAYERDIR}"
2BBFILES += "\
3 ${LAYERDIR}/recipes-*/*/*.bb \
4 ${LAYERDIR}/recipes-*/*/*.bbappend \
5 "
6
7BBFILE_COLLECTIONS += "linaro-toolchain"
8BBFILE_PATTERN_linaro-toolchain := "^${LAYERDIR}/"
9BBFILE_PRIORITY_linaro-toolchain = "30"
10
11# do not error out on bbappends for missing recipes
12BB_DANGLINGAPPENDS_WARNONLY = "true"
13
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-initial_linaro-2.20.bb b/meta-linaro-toolchain/recipes-core/glibc/glibc-initial_linaro-2.20.bb
new file mode 100644
index 0000000..a31ba68
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-initial_linaro-2.20.bb
@@ -0,0 +1,11 @@
1require glibc_${PV}.bb
2require recipes-core/glibc/glibc-initial.inc
3
4DEPENDS += "kconfig-frontends-native"
5
6# main glibc recipes muck with TARGET_CPPFLAGS to point into
7# final target sysroot but we
8# are not there when building glibc-initial
9# so reset it here
10
11TARGET_CPPFLAGS = ""
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0001-R_ARM_TLS_DTPOFF32.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0001-R_ARM_TLS_DTPOFF32.patch
new file mode 100644
index 0000000..3922cb8
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0001-R_ARM_TLS_DTPOFF32.patch
@@ -0,0 +1,56 @@
1
2Quote from bug 1443 which explains what the patch does :
3
4 We build some random program and link it with -lust. When we run it,
5 it dies with a SIGSEGV before reaching main().
6
7 Libust.so depends on liburcu-bp.so from the usermode-rcu package.
8 Although libust.so is not prelinked, liburcu-bp.so IS prelinked; this
9 is critical.
10
11 Libust.so uses a TLS / __thread variable that is defined in liburcu-
12 bp.so. There are special ARM-specific relocation types that allow two
13 shared libraries to share thread-specific data. This is critical too.
14
15 One more critical issue: although liburcu-bp.so is prelinked, we can't
16 load it at its prelinked address, because we also link against
17 librt.so, and librt.so uses that address.
18
19 The dynamic linker is forced to relink liburcu-bp.so at a different
20 address. In the course of relinking, it processes the special ARM
21 relocation record mentioned above. The prelinker has already filled
22 in the information, which is a short offset into a table of thread-
23 specific data that is allocated per-thread for each library that uses
24 TLS. Because the normal behavior of a relocation is to add the symbol
25 value to an addend stored at the address being relocated, we end up
26 adding the short offset to itself, doubling it.
27
28 Now we have an awkward situation. The libust.so library doesn't know
29 about the addend, so its TLS data for this element is correct. The
30 liburcu-bp.so library has a different offset for the element. When we
31 go to initialize the element for the first time in liburcu-bp.so, we
32 write the address of the result at the doubled (broken) offset.
33 Later, when we refer to the address from libust.so, we check the value
34 at the correct offset, but it's NULL, so we eat hot SIGSEGV.
35
36Upstream-Status: Pending
37
38Signed-off-by: Andrei Dinu <andrei.adrianx.dinu@intel.com>
39---
40 .../libc/ports/sysdeps/arm/dl-machine.h | 2 +-
41 1 file changed, 1 insertion(+), 1 deletion(-)
42
43ndex 8d905e8..dcfa71e 100644
44Index: git/sysdeps/arm/dl-machine.h
45===================================================================
46--- git.orig/sysdeps/arm/dl-machine.h 2014-08-27 05:30:47.748070587 +0000
47+++ git/sysdeps/arm/dl-machine.h 2014-08-27 05:30:47.740070587 +0000
48@@ -495,7 +495,7 @@
49
50 case R_ARM_TLS_DTPOFF32:
51 if (sym != NULL)
52- *reloc_addr += sym->st_value;
53+ *reloc_addr = sym->st_value;
54 break;
55
56 case R_ARM_TLS_TPOFF32:
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch
new file mode 100644
index 0000000..f341282
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch
@@ -0,0 +1,33 @@
1From 713d822908d1b2ae8403af7f9375c7054ed3dd49 Mon Sep 17 00:00:00 2001
2From: Ting Liu <b28495@freescale.com>
3Date: Wed, 19 Dec 2012 04:39:57 -0600
4Subject: [PATCH] eglibc: run libm-err-tab.pl with specific dirs in ${S}
5
6libm-err-tab.pl will parse all the files named "libm-test-ulps"
7in the given dir recursively. To avoid parsing the one in
8${S}/.pc/ (it does exist after eglibc adds aarch64 support,
9${S}/.pc/aarch64-0001-glibc-fsf-v1-eaf6f205.patch/ports/sysdeps/
10aarch64/libm-test-ulps), run libm-err-tab.pl with specific dirs
11in ${S}.
12
13Upstream-Status: inappropriate [OE specific]
14
15Signed-off-by: Ting Liu <b28495@freescale.com>
16---
17 manual/Makefile | 3 ++-
18 1 file changed, 2 insertions(+), 1 deletion(-)
19
20Index: git/manual/Makefile
21===================================================================
22--- git.orig/manual/Makefile 2014-08-29 10:35:18.728070587 -0700
23+++ git/manual/Makefile 2014-08-29 10:35:18.720070587 -0700
24@@ -105,7 +105,8 @@
25 $(objpfx)stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
26 $(dir)/libm-test-ulps))
27 pwd=`pwd`; \
28- $(PERL) $< $$pwd/.. > $(objpfx)libm-err-tmp
29+ $(PERL) $< $$pwd/../ports > $(objpfx)libm-err-tmp
30+ $(PERL) $< $$pwd/../sysdeps >> $(objpfx)libm-err-tmp
31 $(move-if-change) $(objpfx)libm-err-tmp $(objpfx)libm-err.texi
32 touch $@
33
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/GLRO_dl_debug_mask.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/GLRO_dl_debug_mask.patch
new file mode 100644
index 0000000..e858bfa
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/GLRO_dl_debug_mask.patch
@@ -0,0 +1,529 @@
1Its controlled by __OPTION_EGLIBC_RTLD_DEBUG
2so we should use GLRO_dl_debug_mask
3
4Singed-off-by: Khem Raj <raj.khem@gmail.com>
5
6Upstream-Status: Pending
7Index: git/elf/dl-open.c
8===================================================================
9--- git.orig/elf/dl-open.c 2014-08-27 05:03:59.732070587 +0000
10+++ git/elf/dl-open.c 2014-08-27 05:05:25.656070587 +0000
11@@ -147,7 +147,7 @@
12 ns->_ns_main_searchlist->r_list[new_nlist++] = map;
13
14 /* We modify the global scope. Report this. */
15- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
16+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
17 _dl_debug_printf ("\nadd %s [%lu] to global scope\n",
18 map->l_name, map->l_ns);
19 }
20@@ -243,7 +243,7 @@
21 if (__glibc_unlikely (new->l_searchlist.r_list != NULL))
22 {
23 /* Let the user know about the opencount. */
24- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
25+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
26 _dl_debug_printf ("opening file=%s [%lu]; direct_opencount=%u\n\n",
27 new->l_name, new->l_ns, new->l_direct_opencount);
28
29@@ -294,7 +294,7 @@
30 LIBC_PROBE (map_complete, 3, args->nsid, r, new);
31
32 /* Print scope information. */
33- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
34+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
35 _dl_show_scope (new, 0);
36
37 /* Only do lazy relocation if `LD_BIND_NOW' is not set. */
38@@ -511,7 +511,7 @@
39 }
40
41 /* Print scope information. */
42- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
43+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
44 _dl_show_scope (imap, from_scope);
45 }
46
47@@ -584,7 +584,7 @@
48 #endif
49
50 /* Let the user know about the opencount. */
51- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
52+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
53 _dl_debug_printf ("opening file=%s [%lu]; direct_opencount=%u\n\n",
54 new->l_name, new->l_ns, new->l_direct_opencount);
55 }
56Index: git/elf/rtld.c
57===================================================================
58--- git.orig/elf/rtld.c 2014-08-27 05:03:59.732070587 +0000
59+++ git/elf/rtld.c 2014-08-27 05:12:33.812070587 +0000
60@@ -321,7 +321,7 @@
61 }
62 #endif
63
64- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS))
65+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_STATISTICS))
66 {
67 #ifndef HP_TIMING_NONAVAIL
68 print_statistics (&rtld_total_time);
69@@ -1699,7 +1699,7 @@
70 after relocation. */
71 struct link_map *l;
72
73- if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
74+ if (GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
75 {
76 struct r_scope_elem *scope = &main_map->l_searchlist;
77
78@@ -1729,7 +1729,7 @@
79 _dl_printf ("\n");
80 }
81 }
82- else if (GLRO(dl_debug_mask) & DL_DEBUG_UNUSED)
83+ else if (GLRO_dl_debug_mask & DL_DEBUG_UNUSED)
84 {
85 /* Look through the dependencies of the main executable
86 and determine which of them is not actually
87@@ -1837,7 +1837,7 @@
88 }
89 }
90
91- if ((GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
92+ if ((GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
93 && rtld_multiple_ref)
94 {
95 /* Mark the link map as not yet relocated again. */
96@@ -1970,7 +1970,7 @@
97 if (r_list == r_listend && liblist == liblistend)
98 prelinked = true;
99
100- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
101+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
102 _dl_debug_printf ("\nprelink checking: %s\n",
103 prelinked ? "ok" : "failed");
104 }
105@@ -1988,7 +1988,7 @@
106 GLRO(dl_init_all_dirs) = GL(dl_all_dirs);
107
108 /* Print scope information. */
109- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
110+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
111 {
112 _dl_debug_printf ("\nInitial object scopes\n");
113
114@@ -2262,7 +2262,7 @@
115 if (debopts[cnt].len == len
116 && memcmp (dl_debug, debopts[cnt].name, len) == 0)
117 {
118- GLRO(dl_debug_mask) |= debopts[cnt].mask;
119+ GLRO_dl_debug_mask |= debopts[cnt].mask;
120 any_debug = 1;
121 break;
122 }
123@@ -2283,7 +2283,7 @@
124 ++dl_debug;
125 }
126
127- if (GLRO(dl_debug_mask) & DL_DEBUG_UNUSED)
128+ if (GLRO_dl_debug_mask & DL_DEBUG_UNUSED)
129 {
130 /* In order to get an accurate picture of whether a particular
131 DT_NEEDED entry is actually used we have to process both
132@@ -2291,7 +2291,7 @@
133 GLRO(dl_lazy) = 0;
134 }
135
136- if (GLRO(dl_debug_mask) & DL_DEBUG_HELP)
137+ if (GLRO_dl_debug_mask & DL_DEBUG_HELP)
138 {
139 size_t cnt;
140
141@@ -2490,7 +2490,7 @@
142 {
143 mode = trace;
144 GLRO(dl_verbose) = 1;
145- GLRO(dl_debug_mask) |= DL_DEBUG_PRELINK;
146+ GLRO_dl_debug_mask |= DL_DEBUG_PRELINK;
147 GLRO(dl_trace_prelink) = &envline[17];
148 }
149 break;
150@@ -2537,7 +2537,7 @@
151 if (__access ("/etc/suid-debug", F_OK) != 0)
152 {
153 unsetenv ("MALLOC_CHECK_");
154- GLRO(dl_debug_mask) = 0;
155+ GLRO_dl_debug_mask = 0;
156 }
157
158 if (mode != normal)
159Index: git/elf/dl-lookup.c
160===================================================================
161--- git.orig/elf/dl-lookup.c 2014-08-27 05:03:59.732070587 +0000
162+++ git/elf/dl-lookup.c 2014-08-27 05:13:07.644070587 +0000
163@@ -300,7 +300,7 @@
164 hash table. */
165 if (__glibc_unlikely (tab->size))
166 {
167- assert (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK);
168+ assert (GLRO_dl_debug_mask & DL_DEBUG_PRELINK);
169 goto success;
170 }
171 #endif
172@@ -375,7 +375,7 @@
173 continue;
174
175 /* Print some debugging info if wanted. */
176- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SYMBOLS))
177+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SYMBOLS))
178 _dl_debug_printf ("symbol=%s; lookup in file=%s [%lu]\n",
179 undef_name, DSO_FILENAME (map->l_name),
180 map->l_ns);
181@@ -698,7 +698,7 @@
182 }
183
184 /* Display information if we are debugging. */
185- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
186+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
187 _dl_debug_printf ("\
188 \nfile=%s [%lu]; needed by %s [%lu] (relocation dependency)\n\n",
189 DSO_FILENAME (map->l_name),
190@@ -802,7 +802,7 @@
191 {
192 if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
193 && skip_map == NULL
194- && !(GLRO(dl_debug_mask) & DL_DEBUG_UNUSED))
195+ && !(GLRO_dl_debug_mask & DL_DEBUG_UNUSED))
196 {
197 /* We could find no value for a strong reference. */
198 const char *reference_name = undef_map ? undef_map->l_name : "";
199@@ -873,7 +873,7 @@
200 if (__glibc_unlikely (current_value.m->l_used == 0))
201 current_value.m->l_used = 1;
202
203- if (__glibc_unlikely (GLRO(dl_debug_mask)
204+ if (__glibc_unlikely (GLRO_dl_debug_mask
205 & (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK)))
206 _dl_debug_bindings (undef_name, undef_map, ref,
207 &current_value, version, type_class, protected);
208@@ -938,7 +938,7 @@
209 {
210 const char *reference_name = undef_map->l_name;
211
212- if (GLRO(dl_debug_mask) & DL_DEBUG_BINDINGS)
213+ if (GLRO_dl_debug_mask & DL_DEBUG_BINDINGS)
214 {
215 _dl_debug_printf ("binding file %s [%lu] to %s [%lu]: %s symbol `%s'",
216 DSO_FILENAME (reference_name),
217@@ -952,7 +952,7 @@
218 _dl_debug_printf_c ("\n");
219 }
220 #ifdef SHARED
221- if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
222+ if (GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
223 {
224 int conflict = 0;
225 struct sym_val val = { NULL, NULL };
226Index: git/elf/get-dynamic-info.h
227===================================================================
228--- git.orig/elf/get-dynamic-info.h 2014-08-27 05:03:59.732070587 +0000
229+++ git/elf/get-dynamic-info.h 2014-08-27 05:03:59.728070587 +0000
230@@ -157,7 +157,7 @@
231 them. Therefore to avoid breaking existing applications the
232 best we can do is add a warning during debugging with the
233 intent of notifying the user of the problem. */
234- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0)
235+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0)
236 && l->l_flags_1 & ~DT_1_SUPPORTED_MASK)
237 _dl_debug_printf ("\nWARNING: Unsupported flag value(s) of 0x%x in DT_FLAGS_1.\n",
238 l->l_flags_1 & ~DT_1_SUPPORTED_MASK);
239Index: git/csu/libc-start.c
240===================================================================
241--- git.orig/csu/libc-start.c 2014-08-27 04:59:01.412070587 +0000
242+++ git/csu/libc-start.c 2014-08-27 05:09:28.936070587 +0000
243@@ -238,7 +238,7 @@
244
245 /* Call the initializer of the program, if any. */
246 #ifdef SHARED
247- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
248+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
249 GLRO(dl_debug_printf) ("\ninitialize program: %s\n\n", argv[0]);
250 #endif
251 if (init)
252@@ -261,7 +261,7 @@
253 #endif
254
255 #ifdef SHARED
256- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS))
257+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS))
258 GLRO(dl_debug_printf) ("\ntransferring control: %s\n\n", argv[0]);
259 #endif
260
261Index: git/elf/dl-cache.c
262===================================================================
263--- git.orig/elf/dl-cache.c 2014-08-27 04:59:01.568070587 +0000
264+++ git/elf/dl-cache.c 2014-08-27 05:10:14.384070587 +0000
265@@ -187,7 +187,7 @@
266 const char *best;
267
268 /* Print a message if the loading of libs is traced. */
269- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
270+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
271 _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE);
272
273 if (cache == NULL)
274@@ -285,7 +285,7 @@
275 }
276
277 /* Print our result if wanted. */
278- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0)
279+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0)
280 && best != NULL)
281 _dl_debug_printf (" trying file=%s\n", best);
282
283Index: git/elf/dl-close.c
284===================================================================
285--- git.orig/elf/dl-close.c 2014-08-27 04:59:01.568070587 +0000
286+++ git/elf/dl-close.c 2014-08-27 05:10:26.456070587 +0000
287@@ -125,7 +125,7 @@
288 dl_close_state = rerun;
289
290 /* There are still references to this object. Do nothing more. */
291- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
292+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
293 _dl_debug_printf ("\nclosing file=%s; direct_opencount=%u\n",
294 map->l_name, map->l_direct_opencount);
295
296@@ -257,7 +257,7 @@
297 if (imap->l_init_called)
298 {
299 /* When debugging print a message first. */
300- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS,
301+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS,
302 0))
303 _dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
304 imap->l_name, nsid);
305@@ -664,7 +664,7 @@
306 free (imap->l_reldeps);
307
308 /* Print debugging message. */
309- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
310+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
311 _dl_debug_printf ("\nfile=%s [%lu]; destroying link map\n",
312 imap->l_name, imap->l_ns);
313
314Index: git/elf/dl-conflict.c
315===================================================================
316--- git.orig/elf/dl-conflict.c 2014-08-27 04:59:01.568070587 +0000
317+++ git/elf/dl-conflict.c 2014-08-27 05:10:37.652070587 +0000
318@@ -32,7 +32,7 @@
319 ElfW(Rela) *conflictend)
320 {
321 #if ! ELF_MACHINE_NO_RELA
322- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_RELOC))
323+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_RELOC))
324 _dl_debug_printf ("\nconflict processing: %s\n", DSO_FILENAME (l->l_name));
325
326 {
327Index: git/elf/dl-deps.c
328===================================================================
329--- git.orig/elf/dl-deps.c 2014-08-27 04:59:01.568070587 +0000
330+++ git/elf/dl-deps.c 2014-08-27 05:10:48.260070587 +0000
331@@ -127,7 +127,7 @@
332 else \
333 { \
334 /* This is for DT_AUXILIARY. */ \
335- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS)) \
336+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS)) \
337 _dl_debug_printf (N_("\
338 cannot load auxiliary `%s' because of empty dynamic string token " \
339 "substitution\n"), __str); \
340@@ -303,7 +303,7 @@
341 args.name = name;
342
343 /* Say that we are about to load an auxiliary library. */
344- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS,
345+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS,
346 0))
347 _dl_debug_printf ("load auxiliary object=%s"
348 " requested by file=%s\n",
349@@ -520,7 +520,7 @@
350 runp->map->l_reserved = 0;
351 }
352
353- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK, 0) != 0
354+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_PRELINK, 0) != 0
355 && map == GL(dl_ns)[LM_ID_BASE]._ns_loaded)
356 {
357 /* If we are to compute conflicts, we have to build local scope
358Index: git/elf/dl-error.c
359===================================================================
360--- git.orig/elf/dl-error.c 2014-08-27 04:59:01.568070587 +0000
361+++ git/elf/dl-error.c 2014-08-27 05:11:06.752070587 +0000
362@@ -139,7 +139,7 @@
363 _dl_signal_cerror (int errcode, const char *objname, const char *occation,
364 const char *errstring)
365 {
366- if (__builtin_expect (GLRO(dl_debug_mask)
367+ if (__builtin_expect (GLRO_dl_debug_mask
368 & ~(DL_DEBUG_STATISTICS|DL_DEBUG_PRELINK), 0))
369 _dl_debug_printf ("%s: error: %s: %s (%s)\n", objname, occation,
370 errstring, receiver ? "continued" : "fatal");
371Index: git/elf/dl-fini.c
372===================================================================
373--- git.orig/elf/dl-fini.c 2014-08-27 04:59:01.568070587 +0000
374+++ git/elf/dl-fini.c 2014-08-27 05:11:17.544070587 +0000
375@@ -234,7 +234,7 @@
376 || l->l_info[DT_FINI] != NULL)
377 {
378 /* When debugging print a message first. */
379- if (__builtin_expect (GLRO(dl_debug_mask)
380+ if (__builtin_expect (GLRO_dl_debug_mask
381 & DL_DEBUG_IMPCALLS, 0))
382 _dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
383 DSO_FILENAME (l->l_name),
384@@ -286,7 +286,7 @@
385 goto again;
386 }
387
388- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS))
389+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_STATISTICS))
390 _dl_debug_printf ("\nruntime linker statistics:\n"
391 " final number of relocations: %lu\n"
392 "final number of relocations from cache: %lu\n",
393Index: git/elf/dl-init.c
394===================================================================
395--- git.orig/elf/dl-init.c 2014-08-27 04:59:01.568070587 +0000
396+++ git/elf/dl-init.c 2014-08-27 05:11:28.372070587 +0000
397@@ -52,7 +52,7 @@
398 return;
399
400 /* Print a debug message if wanted. */
401- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS))
402+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS))
403 _dl_debug_printf ("\ncalling init: %s\n\n",
404 DSO_FILENAME (l->l_name));
405
406@@ -102,7 +102,7 @@
407 ElfW(Addr) *addrs;
408 unsigned int cnt;
409
410- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS))
411+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS))
412 _dl_debug_printf ("\ncalling preinit: %s\n\n",
413 DSO_FILENAME (main_map->l_name));
414
415Index: git/elf/dl-load.c
416===================================================================
417--- git.orig/elf/dl-load.c 2014-08-27 04:59:01.572070587 +0000
418+++ git/elf/dl-load.c 2014-08-27 05:11:41.156070587 +0000
419@@ -957,7 +957,7 @@
420 }
421
422 /* Print debugging message. */
423- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
424+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
425 _dl_debug_printf ("file=%s [%lu]; generating link map\n", name, nsid);
426
427 /* This is the ELF header. We read it in `open_verify'. */
428@@ -1361,7 +1361,7 @@
429
430 l->l_entry += l->l_addr;
431
432- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
433+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
434 _dl_debug_printf ("\
435 dynamic: 0x%0*lx base: 0x%0*lx size: 0x%0*Zx\n\
436 entry: 0x%0*lx phdr: 0x%0*lx phnum: %*u\n\n",
437@@ -1787,7 +1787,7 @@
438
439 /* If we are debugging the search for libraries print the path
440 now if it hasn't happened now. */
441- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS)
442+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS)
443 && current_what != this_dir->what)
444 {
445 current_what = this_dir->what;
446@@ -1808,7 +1808,7 @@
447 - buf);
448
449 /* Print name we try if this is wanted. */
450- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
451+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
452 _dl_debug_printf (" trying file=%s\n", buf);
453
454 fd = open_verify (buf, fbp, loader, whatcode, mode,
455@@ -1953,7 +1953,7 @@
456 }
457
458 /* Display information if we are debugging. */
459- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES)
460+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES)
461 && loader != NULL)
462 _dl_debug_printf ((mode & __RTLD_CALLMAP) == 0
463 ? "\nfile=%s [%lu]; needed by %s [%lu]\n"
464@@ -1995,7 +1995,7 @@
465
466 size_t namelen = strlen (name) + 1;
467
468- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
469+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
470 _dl_debug_printf ("find library=%s [%lu]; searching\n", name, nsid);
471
472 fd = -1;
473@@ -2122,7 +2122,7 @@
474 &realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
475
476 /* Add another newline when we are tracing the library loading. */
477- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
478+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
479 _dl_debug_printf ("\n");
480 }
481 else
482@@ -2155,7 +2155,7 @@
483 if (__glibc_unlikely (fd == -1))
484 {
485 if (trace_mode
486- && __glibc_likely ((GLRO(dl_debug_mask) & DL_DEBUG_PRELINK) == 0))
487+ && __glibc_likely ((GLRO_dl_debug_mask & DL_DEBUG_PRELINK) == 0))
488 {
489 /* We haven't found an appropriate library. But since we
490 are only interested in the list of libraries this isn't
491Index: git/elf/dl-object.c
492===================================================================
493--- git.orig/elf/dl-object.c 2014-08-27 04:59:01.572070587 +0000
494+++ git/elf/dl-object.c 2014-08-27 05:11:51.756070587 +0000
495@@ -98,7 +98,7 @@
496 new->l_type = type;
497 /* If we set the bit now since we know it is never used we avoid
498 dirtying the cache line later. */
499- if ((GLRO(dl_debug_mask) & DL_DEBUG_UNUSED) == 0)
500+ if ((GLRO_dl_debug_mask & DL_DEBUG_UNUSED) == 0)
501 new->l_used = 1;
502 new->l_loader = loader;
503 #if NO_TLS_OFFSET != 0
504Index: git/elf/dl-reloc.c
505===================================================================
506--- git.orig/elf/dl-reloc.c 2014-08-27 04:59:01.572070587 +0000
507+++ git/elf/dl-reloc.c 2014-08-27 05:12:07.056070587 +0000
508@@ -183,7 +183,7 @@
509 && __builtin_expect (l->l_info[DT_BIND_NOW] != NULL, 0))
510 lazy = 0;
511
512- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_RELOC))
513+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_RELOC))
514 _dl_debug_printf ("\nrelocation processing: %s%s\n",
515 DSO_FILENAME (l->l_name), lazy ? " (lazy)" : "");
516
517Index: git/elf/dl-version.c
518===================================================================
519--- git.orig/elf/dl-version.c 2014-08-27 04:59:01.608070587 +0000
520+++ git/elf/dl-version.c 2014-08-27 05:12:19.568070587 +0000
521@@ -82,7 +82,7 @@
522 int result = 0;
523
524 /* Display information about what we are doing while debugging. */
525- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_VERSIONS))
526+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_VERSIONS))
527 _dl_debug_printf ("\
528 checking for version `%s' in file %s [%lu] required by file %s [%lu]\n",
529 string, DSO_FILENAME (map->l_name),
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/IO-acquire-lock-fix.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/IO-acquire-lock-fix.patch
new file mode 100644
index 0000000..ffbaba1
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/IO-acquire-lock-fix.patch
@@ -0,0 +1,17 @@
1import http://sourceware.org/ml/libc-ports/2007-12/msg00000.html
2
3Upstream-Status: Pending
4
5Index: git/bits/stdio-lock.h
6===================================================================
7--- git.orig/bits/stdio-lock.h 2014-08-29 10:33:57.960070587 -0700
8+++ git/bits/stdio-lock.h 2014-08-29 10:33:57.952070587 -0700
9@@ -49,6 +49,8 @@
10 _IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, (_fp)); \
11 _IO_flockfile (_fp)
12
13+# define _IO_acquire_lock_clear_flags2(_fp) _IO_acquire_lock (_fp)
14+
15 # define _IO_release_lock(_fp) \
16 _IO_funlockfile (_fp); \
17 _IO_cleanup_region_end (0)
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/add_resource_h_to_wait_h.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/add_resource_h_to_wait_h.patch
new file mode 100644
index 0000000..4559de7
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/add_resource_h_to_wait_h.patch
@@ -0,0 +1,20 @@
1The older versions of perf still require sys/resource.h to be
2present in this header, the newer version of perf in 3.2 and
3beyond directly include sys/resource.h
4
5Upstream-Status: Inapproriate [older kernel/perf specific]
6
7Signed-off-by: Saul Wold <sgw@linux.intel.com>
8
9Index: git/posix/sys/wait.h
10===================================================================
11--- git.orig/posix/sys/wait.h 2014-08-29 10:35:10.432070587 -0700
12+++ git/posix/sys/wait.h 2014-08-29 10:35:10.424070587 -0700
13@@ -27,6 +27,7 @@
14 __BEGIN_DECLS
15
16 #include <signal.h>
17+#include <sys/resource.h>
18
19 /* These macros could also be defined in <stdlib.h>. */
20 #if !defined _STDLIB_H || (!defined __USE_XOPEN && !defined __USE_XOPEN2K8)
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-header-bootstrap.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-header-bootstrap.patch
new file mode 100644
index 0000000..e1aa139
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-header-bootstrap.patch
@@ -0,0 +1,85 @@
1Taken from EGLIBC, r1484 + r1525
2
3 2007-02-20 Jim Blandy <jimb@codesourcery.com>
4
5 * Makefile (install-headers): Preserve old behavior: depend on
6 $(inst_includedir)/gnu/stubs.h only if install-bootstrap-headers
7 is set; otherwise, place gnu/stubs.h on the 'install-others' list.
8
9 2007-02-16 Jim Blandy <jimb@codesourcery.com>
10
11 * Makefile: Amend make install-headers to install everything
12 necessary for building a cross-compiler. Install gnu/stubs.h as
13 part of 'install-headers', not 'install-others'.
14 If install-bootstrap-headers is 'yes', install a dummy copy of
15 gnu/stubs.h, instead of computing the real thing.
16 * include/stubs-bootstrap.h: New file.
17
18Upstream-Status: Pending
19
20Index: git/Makefile
21===================================================================
22--- git.orig/Makefile 2014-08-27 18:35:18.908070587 +0000
23+++ git/Makefile 2014-08-27 18:35:19.340070587 +0000
24@@ -69,9 +69,18 @@
25 vpath %.h $(subdir-dirs)
26
27 # What to install.
28-install-others = $(inst_includedir)/gnu/stubs.h
29 install-bin-script =
30
31+# If we're bootstrapping, install a dummy gnu/stubs.h along with the
32+# other headers, so 'make install-headers' produces a useable include
33+# tree. Otherwise, install gnu/stubs.h later, after the rest of the
34+# build is done.
35+ifeq ($(install-bootstrap-headers),yes)
36+install-headers: $(inst_includedir)/gnu/stubs.h
37+else
38+install-others = $(inst_includedir)/gnu/stubs.h
39+endif
40+
41 ifeq (yes,$(build-shared))
42 headers += gnu/lib-names.h
43 endif
44@@ -151,6 +160,16 @@
45
46 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
47
48+# gnu/stubs.h depends (via the subdir 'stubs' targets) on all the .o
49+# files in EGLIBC. For bootstrapping a GCC/EGLIBC pair, an empty
50+# gnu/stubs.h is good enough.
51+ifeq ($(install-bootstrap-headers),yes)
52+$(inst_includedir)/gnu/stubs.h: include/stubs-bootstrap.h $(+force)
53+ $(make-target-directory)
54+ $(INSTALL_DATA) $< $@
55+
56+installed-stubs =
57+else
58 ifndef abi-variants
59 installed-stubs = $(inst_includedir)/gnu/stubs.h
60 else
61@@ -177,6 +196,7 @@
62
63 install-others-nosubdir: $(installed-stubs)
64 endif
65+endif
66
67
68 # Since stubs.h is never needed when building the library, we simplify the
69Index: git/include/stubs-bootstrap.h
70===================================================================
71--- /dev/null 1970-01-01 00:00:00.000000000 +0000
72+++ git/include/stubs-bootstrap.h 2014-08-27 18:35:19.340070587 +0000
73@@ -0,0 +1,12 @@
74+/* Placeholder stubs.h file for bootstrapping.
75+
76+ When bootstrapping a GCC/EGLIBC pair, GCC requires that the EGLIBC
77+ headers be installed, but we can't fully build EGLIBC without that
78+ GCC. So we run the command:
79+
80+ make install-headers install-bootstrap-headers=yes
81+
82+ to install the headers GCC needs, but avoid building certain
83+ difficult headers. The <gnu/stubs.h> header depends, via the
84+ EGLIBC subdir 'stubs' make targets, on every .o file in EGLIBC, but
85+ an empty stubs.h like this will do fine for GCC. */
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-install-pic-archives.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-install-pic-archives.patch
new file mode 100644
index 0000000..9a31255
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-install-pic-archives.patch
@@ -0,0 +1,109 @@
12008-02-07 Joseph Myers <joseph@codesourcery.com>
2
3 * Makerules (install-extras, install-map): New variables.
4 (installed-libcs): Add libc_pic.a.
5 (install-lib): Include _pic.a files for versioned shared
6 libraries.
7 (install-map-nosubdir, install-extras-nosubdir): Add rules for
8 installing extra files.
9 (install-no-libc.a-nosubdir): Depend on install-map-nosubdir and
10 install-extras-nosubdir.
11
12
132008-04-01 Maxim Kuvyrkov <maxim@codesourcery.com>
14
15 * Makerules (install-lib): Don't install libpthread_pic.a.
16 (install-map): Don't install libpthread_pic.map.
17
18Upstream-Status: Pending
19
20Index: git/Makerules
21===================================================================
22--- git.orig/Makerules 2014-08-27 18:49:22.552070587 +0000
23+++ git/Makerules 2014-08-27 18:49:27.308070587 +0000
24@@ -612,6 +631,9 @@
25 $(common-objpfx)libc.so: $(common-objpfx)libc.map
26 endif
27 common-generated += libc.so libc_pic.os
28+ifndef subdir
29+install-extras := soinit.o sofini.o
30+endif
31 ifdef libc.so-version
32 $(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
33 $(make-link)
34@@ -834,6 +856,7 @@
35 installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
36 $(inst_libdir)/$(patsubst %,$(libtype$o),\
37 $(libprefix)$(libc-name)))
38+installed-libcs := $(installed-libcs) $(inst_libdir)/libc_pic.a
39 install: $(installed-libcs)
40 $(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
41 $(make-target-directory)
42@@ -862,6 +885,22 @@
43 install-lib.so-versioned := $(filter $(versioned), $(install-lib.so))
44 install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))
45
46+# Install the _pic.a files for versioned libraries, and corresponding
47+# .map files.
48+# libpthread_pic.a breaks mklibs, so don't install it and its map.
49+install-lib := $(install-lib) $(install-lib.so-versioned:%.so=%_pic.a)
50+install-lib := $(filter-out libpthread_pic.a,$(install-lib))
51+# Despite having a soname libhurduser and libmachuser do not use symbol
52+# versioning, so don't install the corresponding .map files.
53+ifeq ($(build-shared),yes)
54+install-map := $(patsubst %.so,%.map,\
55+ $(foreach L,$(install-lib.so-versioned),$(notdir $L)))
56+install-map := $(filter-out libhurduser.map libmachuser.map libpthread.map,$(install-map))
57+ifndef subdir
58+install-map := $(install-map) libc.map
59+endif
60+endif
61+
62 # For versioned libraries, we install three files:
63 # $(inst_libdir)/libfoo.so -- for linking, symlink or ld script
64 # $(inst_slibdir)/libfoo.so.NN -- for loading by SONAME, symlink
65@@ -1103,9 +1142,22 @@
66 endif # headers-nonh
67 endif # headers
68
69+ifdef install-map
70+$(addprefix $(inst_libdir)/,$(patsubst lib%.map,lib%_pic.map,$(install-map))): \
71+ $(inst_libdir)/lib%_pic.map: $(common-objpfx)lib%.map $(+force)
72+ $(do-install)
73+endif
74+
75+ifdef install-extras
76+$(addprefix $(inst_libdir)/libc_pic/,$(install-extras)): \
77+ $(inst_libdir)/libc_pic/%.o: $(elfobjdir)/%.os $(+force)
78+ $(do-install)
79+endif
80+
81 .PHONY: install-bin-nosubdir install-bin-script-nosubdir \
82 install-rootsbin-nosubdir install-sbin-nosubdir install-lib-nosubdir \
83- install-data-nosubdir install-headers-nosubdir
84+ install-data-nosubdir install-headers-nosubdir install-map-nosubdir \
85+ install-extras-nosubdir
86 install-bin-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin))
87 install-bin-script-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin-script))
88 install-rootsbin-nosubdir: \
89@@ -1118,6 +1170,10 @@
90 install-headers-nosubdir: $(addprefix $(inst_includedir)/,$(headers))
91 install-others-nosubdir: $(install-others)
92 install-others-programs-nosubdir: $(install-others-programs)
93+install-map-nosubdir: $(addprefix $(inst_libdir)/,\
94+ $(patsubst lib%.map,lib%_pic.map,$(install-map)))
95+install-extras-nosubdir: $(addprefix $(inst_libdir)/libc_pic/,\
96+ $(install-extras))
97
98 # We need all the `-nosubdir' targets so that `install' in the parent
99 # doesn't depend on several things which each iterate over the subdirs.
100@@ -1127,7 +1183,8 @@
101
102 .PHONY: install install-no-libc.a-nosubdir
103 install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir \
104- install-lib-nosubdir install-others-nosubdir
105+ install-lib-nosubdir install-others-nosubdir \
106+ install-map-nosubdir install-extras-nosubdir
107 ifeq ($(build-programs),yes)
108 install-no-libc.a-nosubdir: install-bin-nosubdir install-bin-script-nosubdir \
109 install-rootsbin-nosubdir install-sbin-nosubdir \
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-ppc8xx-cache-line-workaround.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-ppc8xx-cache-line-workaround.patch
new file mode 100644
index 0000000..bb83d6d
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-ppc8xx-cache-line-workaround.patch
@@ -0,0 +1,68 @@
12007-06-13 Nathan Sidwell <nathan@codesourcery.com>
2 Mark Shinwell <shinwell@codesourcery.com>
3
4 * sysdeps/unix/sysv/linux/powerpc/libc-start.c
5 (__libc_start_main): Detect 8xx parts and clear
6 __cache_line_size if detected.
7 * sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
8 (DL_PLATFORM_AUXV): Likewise.
9
10Upstream-Status: Pending
11
12Index: git/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
13===================================================================
14--- git.orig/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c 2014-08-27 18:49:23.996070587 +0000
15+++ git/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c 2014-08-27 18:49:27.332070587 +0000
16@@ -24,9 +24,21 @@
17 /* Scan the Aux Vector for the "Data Cache Block Size" entry. If found
18 verify that the static extern __cache_line_size is defined by checking
19 for not NULL. If it is defined then assign the cache block size
20- value to __cache_line_size. */
21+ value to __cache_line_size. This is used by memset to
22+ optimize setting to zero. We have to detect 8xx processors, which
23+ have buggy dcbz implementations that cannot report page faults
24+ correctly. That requires reading SPR, which is a privileged
25+ operation. Fortunately 2.2.18 and later emulates PowerPC mfspr
26+ reads from the PVR register. */
27 #define DL_PLATFORM_AUXV \
28 case AT_DCACHEBSIZE: \
29+ if (__LINUX_KERNEL_VERSION >= 0x020218) \
30+ { \
31+ unsigned pvr = 0; \
32+ asm ("mfspr %0, 287" : "=r" (pvr)); \
33+ if ((pvr & 0xffff0000) == 0x00500000) \
34+ break; \
35+ } \
36 __cache_line_size = av->a_un.a_val; \
37 break;
38
39Index: git/sysdeps/unix/sysv/linux/powerpc/libc-start.c
40===================================================================
41--- git.orig/sysdeps/unix/sysv/linux/powerpc/libc-start.c 2014-08-27 18:49:23.996070587 +0000
42+++ git/sysdeps/unix/sysv/linux/powerpc/libc-start.c 2014-08-27 18:49:27.332070587 +0000
43@@ -68,11 +68,24 @@
44 rtld_fini = NULL;
45 }
46
47- /* Initialize the __cache_line_size variable from the aux vector. */
48+ /* Initialize the __cache_line_size variable from the aux vector.
49+ This is used by memset to optimize setting to zero. We have to
50+ detect 8xx processors, which have buggy dcbz implementations that
51+ cannot report page faults correctly. That requires reading SPR,
52+ which is a privileged operation. Fortunately 2.2.18 and later
53+ emulates PowerPC mfspr reads from the PVR register. */
54 for (ElfW (auxv_t) * av = auxvec; av->a_type != AT_NULL; ++av)
55 switch (av->a_type)
56 {
57 case AT_DCACHEBSIZE:
58+ if (__LINUX_KERNEL_VERSION >= 0x020218)
59+ {
60+ unsigned pvr = 0;
61+
62+ asm ("mfspr %0, 287" : "=r" (pvr) :);
63+ if ((pvr & 0xffff0000) == 0x00500000)
64+ break;
65+ }
66 __cache_line_size = av->a_un.a_val;
67 break;
68 }
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-resolv-dynamic.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-resolv-dynamic.patch
new file mode 100644
index 0000000..a73bceb
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-resolv-dynamic.patch
@@ -0,0 +1,54 @@
1cherry-picked from http://www.eglibc.org/archives/patches/msg00772.html
2
3It hasnt yet been merged into glibc
4
5Signed-off-by: Khem Raj
6
7Upstream-Status: Pending
8
9Index: git/resolv/res_libc.c
10===================================================================
11--- git.orig/resolv/res_libc.c 2014-08-27 18:35:15.492070587 +0000
12+++ git/resolv/res_libc.c 2014-08-27 18:35:19.204070587 +0000
13@@ -22,12 +22,13 @@
14 #include <arpa/nameser.h>
15 #include <resolv.h>
16 #include <bits/libc-lock.h>
17-
18+#include <sys/stat.h>
19
20 /* The following bit is copied from res_data.c (where it is #ifdef'ed
21 out) since res_init() should go into libc.so but the rest of that
22 file should not. */
23
24+__libc_lock_define_initialized (static, lock);
25 extern unsigned long long int __res_initstamp attribute_hidden;
26 /* We have atomic increment operations on 64-bit platforms. */
27 #if __WORDSIZE == 64
28@@ -35,7 +36,6 @@
29 # define atomicincunlock(lock) (void) 0
30 # define atomicinc(var) catomic_increment (&(var))
31 #else
32-__libc_lock_define_initialized (static, lock);
33 # define atomicinclock(lock) __libc_lock_lock (lock)
34 # define atomicincunlock(lock) __libc_lock_unlock (lock)
35 # define atomicinc(var) ++var
36@@ -94,7 +94,18 @@
37 int
38 __res_maybe_init (res_state resp, int preinit)
39 {
40+ static time_t last_mtime;
41+ struct stat statbuf;
42+ int ret;
43+
44 if (resp->options & RES_INIT) {
45+ ret = stat (_PATH_RESCONF, &statbuf);
46+ __libc_lock_lock (lock);
47+ if ((ret == 0) && (last_mtime != statbuf.st_mtime)) {
48+ last_mtime = statbuf.st_mtime;
49+ atomicinc (__res_initstamp);
50+ }
51+ __libc_lock_unlock (lock);
52 if (__res_initstamp != resp->_u._ext.initstamp) {
53 if (resp->nscount > 0)
54 __res_iclose (resp, true);
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-sh4-fpscr_values.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-sh4-fpscr_values.patch
new file mode 100644
index 0000000..bfb813e
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-sh4-fpscr_values.patch
@@ -0,0 +1,42 @@
12010-09-29 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2 Andrew Stubbs <ams@codesourcery.com>
3
4 Resolve SH's __fpscr_values to symbol in libc.so.
5
6 * sysdeps/sh/sh4/fpu/fpu_control.h: Add C++ __set_fpscr prototype.
7 * sysdeps/unix/sysv/linux/sh/Versions (GLIBC_2.2): Add __fpscr_values.
8 * sysdeps/unix/sysv/linux/sh/sysdep.S (___fpscr_values): New constant.
9
10Upstream-Status: Pending
11
12Index: git/sysdeps/unix/sysv/linux/sh/sysdep.S
13===================================================================
14--- git.orig/sysdeps/unix/sysv/linux/sh/sysdep.S 2014-08-27 18:49:24.036070587 +0000
15+++ git/sysdeps/unix/sysv/linux/sh/sysdep.S 2014-08-27 18:49:27.332070587 +0000
16@@ -30,3 +30,14 @@
17
18 #define __syscall_error __syscall_error_1
19 #include <sysdeps/unix/sh/sysdep.S>
20+
21+ .data
22+ .align 3
23+ .globl ___fpscr_values
24+ .type ___fpscr_values, @object
25+ .size ___fpscr_values, 8
26+___fpscr_values:
27+ .long 0
28+ .long 0x80000
29+weak_alias (___fpscr_values, __fpscr_values)
30+
31Index: git/sysdeps/unix/sysv/linux/sh/Versions
32===================================================================
33--- git.orig/sysdeps/unix/sysv/linux/sh/Versions 2014-08-27 18:49:24.028070587 +0000
34+++ git/sysdeps/unix/sysv/linux/sh/Versions 2014-08-27 18:49:27.332070587 +0000
35@@ -2,6 +2,7 @@
36 GLIBC_2.2 {
37 # functions used in other libraries
38 __xstat64; __fxstat64; __lxstat64;
39+ __fpscr_values;
40
41 # a*
42 alphasort64;
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-use-option-groups.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-use-option-groups.patch
new file mode 100644
index 0000000..40c7832
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc-use-option-groups.patch
@@ -0,0 +1,16577 @@
1Forward port eglibc options groups support
2
3Upstream-Status: Pending
4
5Index: git/argp/argp-fmtstream.c
6===================================================================
7--- git.orig/argp/argp-fmtstream.c 2014-08-29 20:00:42.976070587 -0700
8+++ git/argp/argp-fmtstream.c 2014-08-29 20:01:15.188070587 -0700
9@@ -42,6 +42,7 @@
10 #ifdef _LIBC
11 # include <wchar.h>
12 # include <libio/libioP.h>
13+# include <gnu/option-groups.h>
14 # define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a)
15 #endif
16
17@@ -100,7 +101,11 @@
18 __argp_fmtstream_update (fs);
19 if (fs->p > fs->buf)
20 {
21+#ifdef _LIBC
22 __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
23+#else
24+ fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
25+#endif
26 }
27 free (fs->buf);
28 free (fs);
29@@ -145,9 +150,17 @@
30 size_t i;
31 for (i = 0; i < pad; i++)
32 {
33+#ifdef _LIBC
34 if (_IO_fwide (fs->stream, 0) > 0)
35- putwc_unlocked (L' ', fs->stream);
36+ {
37+#if ! _LIBC || __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
38+ putwc_unlocked (L' ', fs->stream);
39+#else
40+ abort ();
41+#endif
42+ }
43 else
44+#endif
45 putc_unlocked (' ', fs->stream);
46 }
47 }
48@@ -308,9 +321,17 @@
49 *nl++ = ' ';
50 else
51 for (i = 0; i < fs->wmargin; ++i)
52+#ifdef _LIBC
53 if (_IO_fwide (fs->stream, 0) > 0)
54- putwc_unlocked (L' ', fs->stream);
55+ {
56+#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
57+ putwc_unlocked (L' ', fs->stream);
58+#else
59+ abort ();
60+#endif
61+ }
62 else
63+#endif
64 putc_unlocked (' ', fs->stream);
65
66 /* Copy the tail of the original buffer into the current buffer
67Index: git/argp/argp-help.c
68===================================================================
69--- git.orig/argp/argp-help.c 2014-08-29 20:00:42.976070587 -0700
70+++ git/argp/argp-help.c 2014-08-29 20:01:15.188070587 -0700
71@@ -51,6 +51,7 @@
72 #ifdef _LIBC
73 # include <../libio/libioP.h>
74 # include <wchar.h>
75+# include <gnu/option-groups.h>
76 #endif
77
78 #ifndef _
79@@ -1702,7 +1703,7 @@
80 }
81
82 char *
83-__argp_short_program_name (void)
84+(__argp_short_program_name) (void)
85 {
86 # if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
87 return program_invocation_short_name;
88@@ -1873,9 +1874,17 @@
89 #endif
90 }
91
92+#ifdef _LIBC
93 if (_IO_fwide (stream, 0) > 0)
94- putwc_unlocked (L'\n', stream);
95+ {
96+#if ! _LIBC || __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
97+ putwc_unlocked (L'\n', stream);
98+#else
99+ abort ();
100+#endif
101+ }
102 else
103+#endif
104 putc_unlocked ('\n', stream);
105
106 #if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
107Index: git/argp/argp-namefrob.h
108===================================================================
109--- git.orig/argp/argp-namefrob.h 2014-08-29 20:00:42.976070587 -0700
110+++ git/argp/argp-namefrob.h 2014-08-29 20:01:15.192070587 -0700
111@@ -76,10 +76,12 @@
112 #undef __argp_fmtstream_wmargin
113 #define __argp_fmtstream_wmargin argp_fmtstream_wmargin
114
115+#if 0
116 #include "mempcpy.h"
117 #include "strcase.h"
118 #include "strchrnul.h"
119 #include "strndup.h"
120+#endif
121
122 /* normal libc functions we call */
123 #undef __flockfile
124Index: git/argp/Makefile
125===================================================================
126--- git.orig/argp/Makefile 2014-08-29 20:00:42.976070587 -0700
127+++ git/argp/Makefile 2014-08-29 20:01:15.192070587 -0700
128@@ -18,6 +18,8 @@
129 #
130 # Makefile for argp.
131 #
132+include ../option-groups.mak
133+
134 subdir := argp
135
136 include ../Makeconfig
137Index: git/catgets/Makefile
138===================================================================
139--- git.orig/catgets/Makefile 2014-08-29 20:00:43.008070587 -0700
140+++ git/catgets/Makefile 2014-08-29 20:01:15.192070587 -0700
141@@ -22,20 +22,23 @@
142
143 include ../Makeconfig
144
145+include ../option-groups.mak
146+
147 headers = nl_types.h
148-routines = catgets open_catalog
149-others = gencat
150-install-bin = gencat
151-extra-objs = $(gencat-modules:=.o)
152+routines-$(OPTION_EGLIBC_CATGETS) := catgets open_catalog
153+others-$(OPTION_EGLIBC_CATGETS) := gencat
154+install-bin-$(OPTION_EGLIBC_CATGETS) := gencat
155+extra-objs-$(OPTION_EGLIBC_CATGETS) := $(gencat-modules:=.o)
156
157-tests = tst-catgets
158-test-srcs = test-gencat
159+tests-$(OPTION_EGLIBC_CATGETS) := tst-catgets
160+test-srcs-$(OPTION_EGLIBC_CATGETS) := test-gencat
161
162+ifeq (y,$(OPTION_EGLIBC_CATGETS))
163 ifeq ($(run-built-tests),yes)
164 tests-special += $(objpfx)de/libc.cat $(objpfx)test1.cat $(objpfx)test2.cat \
165 $(objpfx)sample.SJIS.cat $(objpfx)test-gencat.out
166 endif
167-
168+endif
169 gencat-modules = xmalloc
170
171 # To find xmalloc.c
172Index: git/crypt/crypt-entry.c
173===================================================================
174--- git.orig/crypt/crypt-entry.c 2014-08-29 20:00:43.028070587 -0700
175+++ git/crypt/crypt-entry.c 2014-08-29 20:01:15.192070587 -0700
176@@ -27,6 +27,7 @@
177 #include <stdio.h>
178 #endif
179 #include <string.h>
180+#include <gnu/option-groups.h>
181 #include <errno.h>
182 #include <fips-private.h>
183
184@@ -76,9 +77,11 @@
185 const char *salt;
186 struct crypt_data * __restrict data;
187 {
188+#if __OPTION_EGLIBC_CRYPT_UFC
189 ufc_long res[4];
190 char ktab[9];
191 ufc_long xx = 25; /* to cope with GCC long long compiler bugs */
192+#endif /*__OPTION_EGLIBC_CRYPT_UFC*/
193
194 #ifdef _LIBC
195 /* Try to find out whether we have to use MD5 encryption replacement. */
196@@ -105,6 +108,7 @@
197 sizeof (struct crypt_data));
198 #endif
199
200+#if __OPTION_EGLIBC_CRYPT_UFC
201 /*
202 * Hack DES tables according to salt
203 */
204@@ -144,6 +148,10 @@
205 */
206 _ufc_output_conversion_r (res[0], res[1], salt, data);
207 return data->crypt_3_buf;
208+#else /* __OPTION_EGLIBC_CRYPT_UFC */
209+ __set_errno (ENOSYS);
210+ return NULL;
211+#endif /* __OPTION_EGLIBC_CRYPT_UFC */
212 }
213 weak_alias (__crypt_r, crypt_r)
214
215@@ -168,7 +176,12 @@
216 return __sha512_crypt (key, salt);
217 #endif
218
219+#if __OPTION_EGLIBC_CRYPT_UFC
220 return __crypt_r (key, salt, &_ufc_foobar);
221+#else /* __OPTION_EGLIBC_CRYPT_UFC */
222+ __set_errno (ENOSYS);
223+ return NULL;
224+#endif /* __OPTION_EGLIBC_CRYPT_UFC */
225 }
226
227
228Index: git/crypt/Makefile
229===================================================================
230--- git.orig/crypt/Makefile 2014-08-29 20:00:43.024070587 -0700
231+++ git/crypt/Makefile 2014-08-29 20:01:15.192070587 -0700
232@@ -18,21 +18,25 @@
233 #
234 # Sub-makefile for crypt() portion of the library.
235 #
236+include ../option-groups.mak
237+
238 subdir := crypt
239
240 include ../Makeconfig
241
242 headers := crypt.h
243
244-extra-libs := libcrypt
245-extra-libs-others := $(extra-libs)
246+extra-libs-$(OPTION_EGLIBC_CRYPT) := libcrypt
247+extra-libs-others-y := $(extra-libs-y)
248
249-libcrypt-routines := crypt-entry md5-crypt sha256-crypt sha512-crypt crypt \
250- crypt_util
251+libcrypt-routines :=crypt-entry md5-crypt sha256-crypt sha512-crypt crypt_common
252+libcrypt-routines-$(OPTION_EGLIBC_CRYPT_UFC) := crypt crypt_util
253+libcrypt-routines += $(libcrypt-routines-y)
254
255-tests := cert md5c-test sha256c-test sha512c-test badsalttest
256+tests-$(OPTION_EGLIBC_CRYPT) := md5c-test sha256c-test sha512c-test badsalttest
257+tests-$(OPTION_EGLIBC_CRYPT_UFC) += cert
258
259-ifeq ($(crypt-in-libc),yes)
260+ifeq ($(crypt-in-libc)$(OPTION_EGLIBC_CRYPT),yesy)
261 routines += $(libcrypt-routines)
262 endif
263
264@@ -44,7 +48,7 @@
265 else
266 libcrypt-routines += md5 sha256 sha512
267
268-tests += md5test sha256test sha512test
269+tests-$(OPTION_EGLIBC_CRYPT) += md5test sha256test sha512test
270
271 # The test md5test-giant uses up to 400 MB of RSS and runs on a fast
272 # machine over a minute.
273@@ -64,8 +68,10 @@
274 $(objpfx)sha512test: $(patsubst %, $(objpfx)%.o,$(sha512-routines))
275 endif
276
277+ifeq ($(OPTION_EGLIBC_CRYPT),y)
278 ifeq (yes,$(build-shared))
279 $(addprefix $(objpfx),$(tests)): $(objpfx)libcrypt.so
280 else
281 $(addprefix $(objpfx),$(tests)): $(objpfx)libcrypt.a
282 endif
283+endif # eglibc: OPTION_EGLIBC_CRYPT
284Index: git/csu/Makefile
285===================================================================
286--- git.orig/csu/Makefile 2014-08-29 20:00:43.032070587 -0700
287+++ git/csu/Makefile 2014-08-29 20:01:15.192070587 -0700
288@@ -22,6 +22,8 @@
289 # crtn.o, special "initializer" and "finalizer" files used in the link
290 # to make the .init and .fini sections work right.
291
292+include ../option-groups.mak
293+
294 subdir := csu
295
296 include ../Makeconfig
297Index: git/debug/Makefile
298===================================================================
299--- git.orig/debug/Makefile 2014-08-29 20:00:43.036070587 -0700
300+++ git/debug/Makefile 2014-08-29 20:01:15.192070587 -0700
301@@ -18,6 +18,8 @@
302 #
303 # Sub-makefile for debug portion of the library.
304 #
305+include ../option-groups.mak
306+
307 subdir := debug
308
309 include ../Makeconfig
310@@ -27,7 +29,7 @@
311 # Note that ptsname_r_chk and getlogin_r are not here, but in
312 # login/Makefile instead. If that subdir is omitted from the
313 # build, its _FORTIFY_SOURCE support will be too.
314-routines = backtrace backtracesyms backtracesymsfd noophooks \
315+routines = noophooks \
316 memcpy_chk memmove_chk mempcpy_chk memset_chk stpcpy_chk \
317 strcat_chk strcpy_chk strncat_chk strncpy_chk stpncpy_chk \
318 sprintf_chk vsprintf_chk snprintf_chk vsnprintf_chk \
319@@ -36,20 +38,27 @@
320 read_chk pread_chk pread64_chk recv_chk recvfrom_chk \
321 readlink_chk readlinkat_chk getwd_chk getcwd_chk \
322 realpath_chk fread_chk fread_u_chk \
323- wctomb_chk wcscpy_chk wmemcpy_chk wmemmove_chk wmempcpy_chk \
324- wcpcpy_chk wcsncpy_chk wcscat_chk wcsncat_chk wmemset_chk \
325- wcpncpy_chk \
326- swprintf_chk vswprintf_chk wprintf_chk fwprintf_chk \
327- vwprintf_chk vfwprintf_chk fgetws_chk fgetws_u_chk \
328 confstr_chk getgroups_chk ttyname_r_chk \
329- gethostname_chk getdomainname_chk wcrtomb_chk mbsnrtowcs_chk \
330- wcsnrtombs_chk mbsrtowcs_chk wcsrtombs_chk mbstowcs_chk \
331- wcstombs_chk asprintf_chk vasprintf_chk dprintf_chk \
332+ gethostname_chk getdomainname_chk \
333+ asprintf_chk vasprintf_chk dprintf_chk \
334 vdprintf_chk obprintf_chk \
335 longjmp_chk ____longjmp_chk \
336 fdelt_chk poll_chk ppoll_chk \
337 stack_chk_fail fortify_fail \
338 $(static-only-routines)
339+routines-$(OPTION_EGLIBC_BACKTRACE) += backtrace backtracesyms backtracesymsfd
340+routines-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
341+ += wprintf_chk fwprintf_chk \
342+ vwprintf_chk vfwprintf_chk fgetws_chk fgetws_u_chk
343+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
344+ += wctomb_chk wcscpy_chk wmemcpy_chk wmemmove_chk wmempcpy_chk \
345+ wcpcpy_chk wcsncpy_chk wcscat_chk wcsncat_chk wmemset_chk \
346+ wcpncpy_chk \
347+ swprintf_chk vswprintf_chk \
348+ wcrtomb_chk mbsnrtowcs_chk \
349+ wcsnrtombs_chk mbsrtowcs_chk wcsrtombs_chk mbstowcs_chk \
350+ wcstombs_chk
351+
352 static-only-routines := warning-nop stack_chk_fail_local
353
354 CFLAGS-backtrace.c = -fno-omit-frame-pointer
355@@ -129,11 +138,15 @@
356 LDFLAGS-tst-backtrace5 = -rdynamic
357 LDFLAGS-tst-backtrace6 = -rdynamic
358
359-tests = backtrace-tst tst-longjmp_chk tst-chk1 tst-chk2 tst-chk3 \
360- tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk \
361- tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6 \
362- tst-longjmp_chk2 tst-backtrace2 tst-backtrace3 tst-backtrace4 \
363- tst-backtrace5 tst-backtrace6
364+tests = tst-longjmp_chk test-strcpy_chk test-stpcpy_chk tst-longjmp_chk2
365+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
366+ += tst-chk1 tst-chk2 tst-chk3 tst-lfschk1 tst-lfschk2 tst-lfschk3
367+tests-$(OPTION_EGLIBC_BACKTRACE) \
368+ += backtrace-tst tst-backtrace2 tst-backtrace3 tst-backtrace4 \
369+ tst-backtrace5 tst-backtrace6
370+ifeq (yy,$(OPTION_EGLIBC_LOCALE_CODE)$(OPTION_EGLIBC_CXX_TESTS))
371+tests += tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6
372+endif
373
374 tests-ifunc := $(stpcpy_chk strcpy_chk:%=test-%-ifunc)
375 tests += $(tests-ifunc)
376Index: git/debug/segfault.c
377===================================================================
378--- git.orig/debug/segfault.c 2014-08-29 20:00:46.280070587 -0700
379+++ git/debug/segfault.c 2014-08-29 20:01:15.192070587 -0700
380@@ -30,6 +30,7 @@
381 #include <unistd.h>
382 #include <_itoa.h>
383 #include <ldsodefs.h>
384+#include <gnu/option-groups.h>
385
386 /* This file defines macros to access the content of the sigcontext element
387 passed up by the signal handler. */
388@@ -91,6 +92,7 @@
389 REGISTER_DUMP;
390 #endif
391
392+#if __OPTION_EGLIBC_BACKTRACE
393 WRITE_STRING ("\nBacktrace:\n");
394
395 /* Get the backtrace. */
396@@ -113,6 +115,7 @@
397
398 /* Now generate nicely formatted output. */
399 __backtrace_symbols_fd (arr + i, cnt - i, fd);
400+#endif
401
402 #ifdef HAVE_PROC_SELF
403 /* Now the link map. */
404Index: git/debug/tst-chk1.c
405===================================================================
406--- git.orig/debug/tst-chk1.c 2014-08-29 20:00:46.288070587 -0700
407+++ git/debug/tst-chk1.c 2014-08-29 20:01:15.192070587 -0700
408@@ -31,6 +31,7 @@
409 #include <sys/select.h>
410 #include <sys/socket.h>
411 #include <sys/un.h>
412+#include <gnu/option-groups.h>
413
414
415 #define obstack_chunk_alloc malloc
416@@ -307,6 +308,7 @@
417 snprintf (buf + 8, l0 + 3, "%d", num2);
418 CHK_FAIL_END
419
420+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
421 CHK_FAIL_START
422 swprintf (wbuf + 8, 3, L"%d", num1);
423 CHK_FAIL_END
424@@ -314,6 +316,7 @@
425 CHK_FAIL_START
426 swprintf (wbuf + 8, l0 + 3, L"%d", num1);
427 CHK_FAIL_END
428+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
429 # endif
430
431 memcpy (buf, str1 + 2, l0 + 9);
432@@ -381,6 +384,7 @@
433 CHK_FAIL_END
434 #endif
435
436+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
437
438 /* These ops can be done without runtime checking of object size. */
439 wmemcpy (wbuf, L"abcdefghij", 10);
440@@ -605,6 +609,7 @@
441 CHK_FAIL_END
442 #endif
443
444+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
445
446 /* Now checks for %n protection. */
447
448@@ -1192,6 +1197,7 @@
449 # endif
450 #endif
451
452+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
453 if (setlocale (LC_ALL, "de_DE.UTF-8") != NULL)
454 {
455 assert (MB_CUR_MAX <= 10);
456@@ -1348,6 +1354,7 @@
457 puts ("cannot set locale");
458 ret = 1;
459 }
460+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
461
462 int fd = posix_openpt (O_RDWR);
463 if (fd != -1)
464Index: git/dlfcn/Makefile
465===================================================================
466--- git.orig/dlfcn/Makefile 2014-08-29 20:00:46.312070587 -0700
467+++ git/dlfcn/Makefile 2014-08-29 20:01:15.192070587 -0700
468@@ -15,6 +15,8 @@
469 # License along with the GNU C Library; if not, see
470 # <http://www.gnu.org/licenses/>.
471
472+include ../option-groups.mak
473+
474 subdir := dlfcn
475
476 include ../Makeconfig
477@@ -36,7 +38,9 @@
478 ifeq (yes,$(build-shared))
479 tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
480 bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \
481- bug-atexit3 tstatexit bug-dl-leaf
482+ tstatexit bug-dl-leaf
483+
484+tests-$(OPTION_EGLIBC_CXX_TESTS) += bug-atexit3
485 endif
486 modules-names = glreflib1 glreflib2 glreflib3 failtestmod defaultmod1 \
487 defaultmod2 errmsg1mod modatexit modcxaatexit \
488Index: git/elf/dl-support.c
489===================================================================
490--- git.orig/elf/dl-support.c 2014-08-29 20:00:46.384070587 -0700
491+++ git/elf/dl-support.c 2014-08-29 20:01:15.192070587 -0700
492@@ -19,6 +19,7 @@
493 /* This file defines some things that for the dynamic linker are defined in
494 rtld.c and dl-sysdep.c in ways appropriate to bootstrap dynamic linking. */
495
496+#include <gnu/option-groups.h>
497 #include <errno.h>
498 #include <libintl.h>
499 #include <stdlib.h>
500@@ -42,7 +43,9 @@
501 const char *_dl_platform;
502 size_t _dl_platformlen;
503
504+#if __OPTION_EGLIBC_RTLD_DEBUG
505 int _dl_debug_mask;
506+#endif
507 int _dl_lazy;
508 ElfW(Addr) _dl_use_load_bias = -2;
509 int _dl_dynamic_weak;
510Index: git/elf/rtld.c
511===================================================================
512--- git.orig/elf/rtld.c 2014-08-29 20:01:14.708070587 -0700
513+++ git/elf/rtld.c 2014-08-29 20:01:15.196070587 -0700
514@@ -16,6 +16,7 @@
515 License along with the GNU C Library; if not, see
516 <http://www.gnu.org/licenses/>. */
517
518+#include <gnu/option-groups.h>
519 #include <errno.h>
520 #include <dlfcn.h>
521 #include <fcntl.h>
522@@ -2200,6 +2201,7 @@
523 objname, errstring);
524 }
525
526+#if __OPTION_EGLIBC_RTLD_DEBUG
527 /* Nonzero if any of the debugging options is enabled. */
528 static int any_debug attribute_relro;
529
530@@ -2309,6 +2311,7 @@
531 _exit (0);
532 }
533 }
534+#endif /* __OPTION_EGLIBC_RTLD_DEBUG */
535
536 static void
537 process_dl_audit (char *str)
538@@ -2376,12 +2379,14 @@
539 break;
540
541 case 5:
542+#if __OPTION_EGLIBC_RTLD_DEBUG
543 /* Debugging of the dynamic linker? */
544 if (memcmp (envline, "DEBUG", 5) == 0)
545 {
546 process_dl_debug (&envline[6]);
547 break;
548 }
549+#endif
550 if (memcmp (envline, "AUDIT", 5) == 0)
551 process_dl_audit (&envline[6]);
552 break;
553@@ -2490,7 +2495,9 @@
554 {
555 mode = trace;
556 GLRO(dl_verbose) = 1;
557+#if __OPTION_EGLIBC_RTLD_DEBUG
558 GLRO_dl_debug_mask |= DL_DEBUG_PRELINK;
559+#endif
560 GLRO(dl_trace_prelink) = &envline[17];
561 }
562 break;
563@@ -2537,12 +2544,15 @@
564 if (__access ("/etc/suid-debug", F_OK) != 0)
565 {
566 unsetenv ("MALLOC_CHECK_");
567+#if __OPTION_EGLIBC_RTLD_DEBUG
568 GLRO_dl_debug_mask = 0;
569+#endif
570 }
571
572 if (mode != normal)
573 _exit (5);
574 }
575+#if __OPTION_EGLIBC_RTLD_DEBUG
576 /* If we have to run the dynamic linker in debugging mode and the
577 LD_DEBUG_OUTPUT environment variable is given, we write the debug
578 messages to this file. */
579@@ -2567,6 +2577,7 @@
580 /* We use standard output if opening the file failed. */
581 GLRO(dl_debug_fd) = STDOUT_FILENO;
582 }
583+#endif /* __OPTION_EGLIBC_RTLD_DEBUG */
584 }
585
586
587Index: git/extra-lib.mk
588===================================================================
589--- git.orig/extra-lib.mk 2014-08-29 20:00:46.544070587 -0700
590+++ git/extra-lib.mk 2014-08-29 20:01:15.196070587 -0700
591@@ -25,7 +25,9 @@
592 extra-objs := $(extra-objs)
593
594 # The modules that go in $(lib).
595-all-$(lib)-routines := $($(lib)-routines) $($(lib)-sysdep_routines)
596+all-$(lib)-routines := $($(lib)-routines) \
597+ $($(lib)-routines-y) \
598+ $($(lib)-sysdep_routines)
599
600 # Add each flavor of library to the lists of things to build and install.
601 install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o)))
602@@ -101,7 +103,7 @@
603 endif
604
605 # This will define `libof-ROUTINE := LIB' for each of the routines.
606-cpp-srcs-left := $($(lib)-routines) $($(lib)-sysdep_routines)
607+cpp-srcs-left := $(all-$(lib)-routines)
608 ifneq (,$(cpp-srcs-left))
609 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
610 endif
611Index: git/grp/Makefile
612===================================================================
613--- git.orig/grp/Makefile 2014-08-29 20:00:46.556070587 -0700
614+++ git/grp/Makefile 2014-08-29 20:01:15.196070587 -0700
615@@ -18,6 +18,8 @@
616 #
617 # Sub-makefile for grp portion of the library.
618 #
619+include ../option-groups.mak
620+
621 subdir := grp
622
623 include ../Makeconfig
624@@ -29,6 +31,9 @@
625 getgrent_r getgrgid_r getgrnam_r fgetgrent_r
626
627 tests := testgrp
628+ifneq (y,$(OPTION_EGLIBC_NSSWITCH))
629+LDLIBS-testgrp += $(shell cat $(common-objpfx)nss/fixed-nsswitch-libs)
630+endif
631
632 ifeq (yes,$(build-shared))
633 test-srcs := tst_fgetgrent
634Index: git/hesiod/Makefile
635===================================================================
636--- git.orig/hesiod/Makefile 2014-08-29 20:00:46.580070587 -0700
637+++ git/hesiod/Makefile 2014-08-29 20:01:15.196070587 -0700
638@@ -18,12 +18,14 @@
639 #
640 # Sub-makefile for hesiod portion of the library.
641 #
642+include ../option-groups.mak
643+
644 subdir := hesiod
645
646 include ../Makeconfig
647
648-extra-libs := libnss_hesiod
649-extra-libs-others = $(extra-libs)
650+extra-libs-$(OPTION_EGLIBC_INET) += libnss_hesiod
651+extra-libs-others-y += $(extra-libs-y)
652
653 subdir-dirs = nss_hesiod
654 vpath %.c nss_hesiod
655Index: git/iconv/gconv_db.c
656===================================================================
657--- git.orig/iconv/gconv_db.c 2014-08-29 20:00:46.604070587 -0700
658+++ git/iconv/gconv_db.c 2014-08-29 20:01:15.196070587 -0700
659@@ -25,6 +25,7 @@
660 #include <sys/param.h>
661 #include <bits/libc-lock.h>
662 #include <locale/localeinfo.h>
663+#include <gnu/option-groups.h>
664
665 #include <dlfcn.h>
666 #include <gconv_int.h>
667@@ -828,9 +829,11 @@
668 /* Free all resources if necessary. */
669 libc_freeres_fn (free_mem)
670 {
671+#if __OPTION_EGLIBC_LOCALE_CODE
672 /* First free locale memory. This needs to be done before freeing derivations,
673 as ctype cleanup functions dereference steps arrays which we free below. */
674 _nl_locale_subfreeres ();
675+#endif
676
677 /* finddomain.c has similar problem. */
678 extern void _nl_finddomain_subfreeres (void) attribute_hidden;
679Index: git/iconv/gconv_trans.c
680===================================================================
681--- git.orig/iconv/gconv_trans.c 2014-08-29 20:00:46.612070587 -0700
682+++ git/iconv/gconv_trans.c 2014-08-29 20:01:15.196070587 -0700
683@@ -23,6 +23,7 @@
684 #include <stdint.h>
685 #include <string.h>
686 #include <stdlib.h>
687+#include <gnu/option-groups.h>
688
689 #include <bits/libc-lock.h>
690 #include "gconv_int.h"
691@@ -59,6 +60,7 @@
692 PTR_DEMANGLE (fct);
693 #endif
694
695+#if __OPTION_EGLIBC_LOCALE_CODE
696 /* If there is no transliteration information in the locale don't do
697 anything and return the error. */
698 size = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_TRANSLIT_TAB_SIZE);
699@@ -194,6 +196,7 @@
700 sorted. */
701 break;
702 }
703+#endif
704
705 /* One last chance: use the default replacement. */
706 if (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN) != 0)
707Index: git/iconv/iconv_prog.c
708===================================================================
709--- git.orig/iconv/iconv_prog.c 2014-08-29 20:00:46.612070587 -0700
710+++ git/iconv/iconv_prog.c 2014-08-29 20:01:15.196070587 -0700
711@@ -35,6 +35,7 @@
712 #ifdef _POSIX_MAPPED_FILES
713 # include <sys/mman.h>
714 #endif
715+#include <gnu/option-groups.h>
716 #include <charmap.h>
717 #include <gconv_int.h>
718 #include "iconv_prog.h"
719@@ -221,10 +222,17 @@
720 bool to_wrong =
721 (iconv_open (to_code, "UTF-8") == (iconv_t) -1
722 && errno == EINVAL);
723+#if __OPTION_EGLIBC_LOCALE_CODE
724 const char *from_pretty =
725 (from_code[0] ? from_code : nl_langinfo (CODESET));
726 const char *to_pretty =
727 (orig_to_code[0] ? orig_to_code : nl_langinfo (CODESET));
728+#else
729+ const char *from_pretty =
730+ (from_code[0] ? from_code : "ANSI_X3.4-1968");
731+ const char *to_pretty =
732+ (orig_to_code[0] ? orig_to_code : "ANSI_X3.4-1968");
733+#endif
734
735 if (from_wrong)
736 {
737Index: git/iconv/Makefile
738===================================================================
739--- git.orig/iconv/Makefile 2014-08-29 20:00:46.600070587 -0700
740+++ git/iconv/Makefile 2014-08-29 20:01:15.196070587 -0700
741@@ -18,6 +18,8 @@
742 #
743 # Makefile for iconv.
744 #
745+include ../option-groups.mak
746+
747 subdir := iconv
748
749 include ../Makeconfig
750@@ -57,6 +59,9 @@
751 CPPFLAGS-strtab = -DNOT_IN_libc
752 CPPFLAGS-charmap = -DNOT_IN_libc
753 CPPFLAGS-charmap-dir = -DNOT_IN_libc
754+ifneq (y,$(OPTION_EGLIBC_SPAWN))
755+CPPFLAGS-charmap-dir.c += -DNO_UNCOMPRESS
756+endif
757
758 ifeq ($(run-built-tests),yes)
759 xtests-special += $(objpfx)test-iconvconfig.out
760Index: git/iconvdata/Makefile
761===================================================================
762--- git.orig/iconvdata/Makefile 2014-08-29 20:00:46.628070587 -0700
763+++ git/iconvdata/Makefile 2014-08-29 20:01:15.196070587 -0700
764@@ -18,12 +18,15 @@
765 #
766 # Makefile for iconv data and code.
767 #
768+include ../option-groups.mak
769+
770 subdir := iconvdata
771
772 include ../Makeconfig
773
774 # Names of all the shared objects which implement the transformations.
775-modules := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \
776+modules-$(OPTION_EGLIBC_CHARSETS) \
777+ := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \
778 ISO8859-6 ISO8859-7 ISO8859-8 ISO8859-9 ISO8859-10 \
779 ISO8859-11 ISO8859-13 ISO8859-14 ISO8859-15 ISO8859-16 \
780 T.61 ISO_6937 SJIS KOI-8 HP-ROMAN8 HP-ROMAN9 EBCDIC-AT-DE \
781@@ -63,11 +66,13 @@
782 MAC-CENTRALEUROPE KOI8-RU ISO8859-9E \
783 CP770 CP771 CP772 CP773 CP774
784
785-modules.so := $(addsuffix .so, $(modules))
786+modules.so := $(addsuffix .so, $(modules-y))
787
788 ifeq (yes,$(build-shared))
789 tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
790- tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9
791+ tst-iconv6 bug-iconv5 bug-iconv8 bug-iconv9
792+tests-$(OPTION_EGLIBC_LOCALE_CODE) += bug-iconv6 tst-iconv7
793+
794 ifeq ($(have-thread-library),yes)
795 tests += bug-iconv3
796 endif
797@@ -130,13 +135,13 @@
798 # Rule to generate the shared objects.
799 charmaps = ../localedata/charmaps
800 -include $(objpfx)iconv-rules
801-extra-modules-left := $(modules)
802+extra-modules-left := $(modules-y)
803 include extra-module.mk
804
805
806 extra-objs += $(modules.so)
807-install-others = $(addprefix $(inst_gconvdir)/, $(modules.so)) \
808- $(inst_gconvdir)/gconv-modules
809+install-others-y += $(addprefix $(inst_gconvdir)/, $(modules.so))
810+install-others-$(OPTION_EGLIBC_CHARSETS) += $(inst_gconvdir)/gconv-modules
811
812 # We can build the conversion tables for numerous charsets automatically.
813
814@@ -204,7 +209,7 @@
815 ifndef avoid-generated
816 $(objpfx)iconv-rules: Makefile
817 $(make-target-directory)
818- { echo $(filter-out lib%, $(modules)); \
819+ { echo $(filter-out lib%, $(modules-y)); \
820 echo 8bit $(gen-8bit-modules); \
821 echo 8bit-gap $(gen-8bit-gap-modules); } | \
822 LC_ALL=C \
823@@ -247,7 +252,7 @@
824 $(do-install-program)
825 $(inst_gconvdir)/gconv-modules: gconv-modules $(+force)
826 $(do-install)
827-ifeq (no,$(cross-compiling))
828+# eglibc: ifeq (no,$(cross-compiling))
829 # Update the $(prefix)/lib/gconv/gconv-modules.cache file. This is necessary
830 # if this libc has more gconv modules than the previously installed one.
831 if test -f "$(inst_gconvdir)/gconv-modules.cache"; then \
832@@ -256,9 +261,9 @@
833 $(common-objpfx)iconv/iconvconfig \
834 $(addprefix --prefix=,$(install_root)); \
835 fi
836-else
837- @echo '*@*@*@ You should recreate $(inst_gconvdir)/gconv-modules.cache'
838-endif
839+# eglibc: else
840+# eglibc: @echo '*@*@*@ You should recreate $(inst_gconvdir)/gconv-modules.cache'
841+# eglibc: endif
842
843 endif # build-shared = yes
844
845Index: git/include/netdb.h
846===================================================================
847--- git.orig/include/netdb.h 2014-08-29 20:00:47.152070587 -0700
848+++ git/include/netdb.h 2014-08-29 20:01:15.196070587 -0700
849@@ -232,6 +232,10 @@
850 (const char *name, int af, struct hostent *host, \
851 char *buffer, size_t buflen, int *errnop, \
852 int *h_errnop); \
853+extern enum nss_status _nss_ ## service ## _gethostbyname3_r \
854+ (const char *name, int af, struct hostent *result, \
855+ char *buffer, size_t buflen, int *errnop, \
856+ int *h_errnop, int32_t *ttlp, char **canonp); \
857 extern enum nss_status _nss_ ## service ## _gethostbyname_r \
858 (const char *name, struct hostent *host, char *buffer, \
859 size_t buflen, int *errnop, int *h_errnop); \
860Index: git/inet/Makefile
861===================================================================
862--- git.orig/inet/Makefile 2014-08-29 20:00:47.176070587 -0700
863+++ git/inet/Makefile 2014-08-29 20:01:15.200070587 -0700
864@@ -18,6 +18,8 @@
865 #
866 # Sub-makefile for inet portion of the library.
867 #
868+include ../option-groups.mak
869+
870 subdir := inet
871
872 include ../Makeconfig
873@@ -27,7 +29,8 @@
874 netinet/tcp.h netinet/ip.h $(wildcard arpa/*.h protocols/*.h) \
875 aliases.h ifaddrs.h netinet/ip6.h netinet/icmp6.h bits/in.h
876
877-routines := htonl htons \
878+routines-$(OPTION_EGLIBC_INET) \
879+ += htonl htons \
880 inet_lnaof inet_mkadr \
881 inet_netof inet_ntoa inet_net herrno herrno-loc \
882 gethstbyad gethstbyad_r gethstbynm gethstbynm2 gethstbynm2_r \
883@@ -41,18 +44,23 @@
884 getrpcent_r getrpcbyname_r getrpcbynumber_r \
885 ether_aton ether_aton_r ether_hton ether_line \
886 ether_ntoa ether_ntoa_r ether_ntoh \
887- rcmd rexec ruserpass \
888 getnetgrent_r getnetgrent \
889- getaliasent_r getaliasent getaliasname getaliasname_r \
890- in6_addr getnameinfo if_index ifaddrs inet6_option \
891+ in6_addr getnameinfo if_index ifaddrs \
892 getipv4sourcefilter setipv4sourcefilter \
893- getsourcefilter setsourcefilter inet6_opt inet6_rth
894+ getsourcefilter setsourcefilter
895+routines-$(OPTION_EGLIBC_RCMD) \
896+ += rcmd rexec ruserpass
897+routines-$(OPTION_EGLIBC_DB_ALIASES) \
898+ += getaliasent_r getaliasent getaliasname getaliasname_r
899+routines-$(OPTION_EGLIBC_ADVANCED_INET6) \
900+ += inet6_option inet6_opt inet6_rth
901
902-aux := check_pf check_native ifreq
903+aux-$(OPTION_EGLIBC_INET) += check_pf check_native ifreq
904
905 tests := htontest test_ifindex tst-ntoa tst-ether_aton tst-network \
906- tst-gethnm test-ifaddrs bug-if1 test-inet6_opt tst-ether_line \
907+ tst-gethnm test-ifaddrs bug-if1 tst-ether_line \
908 tst-getni1 tst-getni2 tst-inet6_rth tst-checks
909+tests-$(OPTION_EGLIBC_ADVANCED_INET6) += test-inet6_opt
910
911 include ../Rules
912
913Index: git/intl/dcigettext.c
914===================================================================
915--- git.orig/intl/dcigettext.c 2014-08-29 20:00:47.224070587 -0700
916+++ git/intl/dcigettext.c 2014-08-29 20:01:15.200070587 -0700
917@@ -77,6 +77,10 @@
918 #endif
919 #include "hash-string.h"
920
921+#ifdef _LIBC
922+# include <gnu/option-groups.h>
923+#endif
924+
925 /* Thread safetyness. */
926 #ifdef _LIBC
927 # include <bits/libc-lock.h>
928@@ -449,9 +453,11 @@
929 #endif
930
931 #ifdef _LIBC
932+#if __OPTION_EGLIBC_LOCALE_CODE
933 __libc_rwlock_define (extern, __libc_setlocale_lock attribute_hidden)
934 __libc_rwlock_rdlock (__libc_setlocale_lock);
935 #endif
936+#endif
937
938 __libc_rwlock_rdlock (_nl_state_lock);
939
940@@ -470,7 +476,11 @@
941 search.category = category;
942 # ifdef HAVE_PER_THREAD_LOCALE
943 # ifdef _LIBC
944+# if __OPTION_EGLIBC_LOCALE_CODE
945 localename = strdupa (__current_locale_name (category));
946+# else
947+ localename = "C";
948+# endif
949 # endif
950 search.localename = localename;
951 # endif
952@@ -494,7 +504,9 @@
953 retval = (char *) (*foundp)->translation;
954
955 # ifdef _LIBC
956+#if __OPTION_EGLIBC_LOCALE_CODE
957 __libc_rwlock_unlock (__libc_setlocale_lock);
958+#endif
959 # endif
960 __libc_rwlock_unlock (_nl_state_lock);
961 return retval;
962@@ -611,7 +623,9 @@
963 {
964 no_translation:
965 FREE_BLOCKS (block_list);
966+#if __OPTION_EGLIBC_LOCALE_CODE
967 __libc_rwlock_unlock (__libc_setlocale_lock);
968+#endif
969 __libc_rwlock_unlock (_nl_state_lock);
970 __set_errno (saved_errno);
971 return (plural == 0
972@@ -730,7 +744,9 @@
973 if (plural)
974 retval = plural_lookup (domain, n, retval, retlen);
975
976+#if __OPTION_EGLIBC_LOCALE_CODE
977 __libc_rwlock_unlock (__libc_setlocale_lock);
978+#endif
979 __libc_rwlock_unlock (_nl_state_lock);
980 return retval;
981 }
982@@ -1361,7 +1377,11 @@
983 `LC_xxx', and `LANG'. On some systems this can be done by the
984 `setlocale' function itself. */
985 #ifdef _LIBC
986+# if __OPTION_EGLIBC_LOCALE_CODE
987 retval = __current_locale_name (category);
988+# else
989+ retval = "C";
990+# endif
991 #else
992 retval = _nl_locale_name (category, categoryname);
993 #endif
994Index: git/intl/Makefile
995===================================================================
996--- git.orig/intl/Makefile 2014-08-29 20:00:47.220070587 -0700
997+++ git/intl/Makefile 2014-08-29 20:01:15.200070587 -0700
998@@ -16,6 +16,7 @@
999 # <http://www.gnu.org/licenses/>.
1000
1001 # Makefile for intl subdirectory: message handling code from GNU gettext.
1002+include ../option-groups.mak
1003
1004 subdir = intl
1005
1006@@ -48,7 +49,7 @@
1007 $(objpfx)plural.o: plural.c
1008
1009 ifeq ($(run-built-tests),yes)
1010-ifeq (yes,$(build-shared))
1011+ifeq (yyyes,$(OPTION_EGLIBC_LOCALES)$(OPTION_EGLIBC_LOCALE_CODE)$(build-shared))
1012 ifneq ($(strip $(MSGFMT)),:)
1013 tests-special += $(objpfx)tst-translit.out $(objpfx)tst-gettext.out \
1014 $(objpfx)tst-gettext2.out $(objpfx)tst-codeset.out \
1015Index: git/io/Makefile
1016===================================================================
1017--- git.orig/io/Makefile 2014-08-29 20:00:47.244070587 -0700
1018+++ git/io/Makefile 2014-08-29 20:01:15.200070587 -0700
1019@@ -18,6 +18,8 @@
1020 #
1021 # Sub-makefile for I/O portion of the library.
1022 #
1023+include ../option-groups.mak
1024+
1025 subdir := io
1026
1027 include ../Makeconfig
1028@@ -36,7 +38,7 @@
1029 fxstatat fxstatat64 \
1030 statfs fstatfs statfs64 fstatfs64 \
1031 statvfs fstatvfs statvfs64 fstatvfs64 \
1032- umask chmod fchmod lchmod fchmodat \
1033+ umask chmod fchmod fchmodat \
1034 mkdir mkdirat \
1035 open open_2 open64 open64_2 openat openat_2 openat64 openat64_2 \
1036 read write lseek lseek64 access euidaccess faccessat \
1037@@ -49,11 +51,13 @@
1038 ttyname ttyname_r isatty \
1039 link linkat symlink symlinkat readlink readlinkat \
1040 unlink unlinkat rmdir \
1041- ftw ftw64 fts poll ppoll \
1042+ poll ppoll \
1043 posix_fadvise posix_fadvise64 \
1044 posix_fallocate posix_fallocate64 \
1045 sendfile sendfile64 \
1046 utimensat futimens
1047+routines-$(OPTION_EGLIBC_BSD) += lchmod
1048+routines-$(OPTION_EGLIBC_FTRAVERSE) += ftw ftw64 fts
1049
1050 aux := have_o_cloexec
1051
1052@@ -64,18 +68,22 @@
1053 fstatat fstatat64 mknod mknodat
1054
1055 others := pwd
1056-test-srcs := ftwtest
1057+test-srcs-$(OPTION_EGLIBC_FTRAVERSE) := ftwtest
1058 tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
1059- tst-fcntl bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 tst-statvfs \
1060+ tst-fcntl tst-statvfs \
1061 tst-openat tst-unlinkat tst-fstatat tst-futimesat \
1062 tst-renameat tst-fchownat tst-fchmodat tst-faccessat \
1063 tst-symlinkat tst-linkat tst-readlinkat tst-mkdirat \
1064- tst-mknodat tst-mkfifoat tst-ttyname_r bug-ftw5 \
1065+ tst-mknodat tst-mkfifoat tst-ttyname_r \
1066 tst-posix_fallocate
1067+tests-$(OPTION_EGLIBC_FTRAVERSE) += bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 \
1068+ bug-ftw5
1069
1070 ifeq ($(run-built-tests),yes)
1071+ifeq (y,$(OPTION_EGLIBC_FTRAVERSE))
1072 tests-special += $(objpfx)ftwtest.out
1073 endif
1074+endif
1075
1076 include ../Rules
1077
1078Index: git/libidn/Makefile
1079===================================================================
1080--- git.orig/libidn/Makefile 2014-08-29 20:00:47.316070587 -0700
1081+++ git/libidn/Makefile 2014-08-29 20:01:15.200070587 -0700
1082@@ -16,6 +16,7 @@
1083 # <http://www.gnu.org/licenses/>.
1084
1085 # Makefile for libidn subdirectory of GNU C Library.
1086+include ../option-groups.mak
1087
1088 subdir := libidn
1089
1090@@ -23,8 +24,8 @@
1091
1092 routines = idn-stub
1093
1094-extra-libs = libcidn
1095-extra-libs-others = $(extra-libs)
1096+extra-libs-$(OPTION_EGLIBC_IDN) = libcidn
1097+extra-libs-others-y = $(extra-libs-y)
1098
1099 libcidn-routines := punycode toutf8 nfkc stringprep rfc3454 profiles idna \
1100 iconvme
1101Index: git/libidn/toutf8.c
1102===================================================================
1103--- git.orig/libidn/toutf8.c 2014-08-29 20:00:47.332070587 -0700
1104+++ git/libidn/toutf8.c 2014-08-29 20:01:15.200070587 -0700
1105@@ -33,6 +33,11 @@
1106 /* Get strlen. */
1107 #include <string.h>
1108
1109+/* Get __OPTION_EGLIBC_LOCALE_CODE. */
1110+#ifdef _LIBC
1111+# include <gnu/option-groups.h>
1112+#endif
1113+
1114 /* Get iconv_string. */
1115 #include "iconvme.h"
1116
1117@@ -47,7 +52,11 @@
1118 #endif
1119
1120 #ifdef _LIBC
1121-# define stringprep_locale_charset() nl_langinfo (CODESET)
1122+# if __OPTION_EGLIBC_LOCALE_CODE
1123+# define stringprep_locale_charset() nl_langinfo (CODESET)
1124+# else
1125+# define stringprep_locale_charset() "ANSI_X3.4-1968"
1126+# endif
1127 #else
1128 /**
1129 * stringprep_locale_charset - return charset used in current locale
1130Index: git/libio/fileops.c
1131===================================================================
1132--- git.orig/libio/fileops.c 2014-08-29 20:00:47.352070587 -0700
1133+++ git/libio/fileops.c 2014-08-29 20:01:15.200070587 -0700
1134@@ -38,6 +38,7 @@
1135 #include <string.h>
1136 #include <errno.h>
1137 #include <unistd.h>
1138+#include <gnu/option-groups.h>
1139 #include <stdlib.h>
1140 #if _LIBC
1141 # include "../wcsmbs/wcsmbsload.h"
1142@@ -174,7 +175,7 @@
1143
1144 /* Free buffer. */
1145 #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
1146- if (fp->_mode > 0)
1147+ if (_IO_is_wide (fp))
1148 {
1149 if (_IO_have_wbackup (fp))
1150 _IO_free_wbackup_area (fp);
1151@@ -359,6 +360,7 @@
1152 cs = strstr (last_recognized + 1, ",ccs=");
1153 if (cs != NULL)
1154 {
1155+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
1156 /* Yep. Load the appropriate conversions and set the orientation
1157 to wide. */
1158 struct gconv_fcts fcts;
1159@@ -423,6 +425,12 @@
1160
1161 /* Set the mode now. */
1162 result->_mode = 1;
1163+#else
1164+ /* Treat this as if we couldn't find the given character set. */
1165+ (void) _IO_file_close_it (fp);
1166+ __set_errno (EINVAL);
1167+ return NULL;
1168+#endif
1169 }
1170 }
1171
1172Index: git/libio/__fpurge.c
1173===================================================================
1174--- git.orig/libio/__fpurge.c 2014-08-29 20:00:47.336070587 -0700
1175+++ git/libio/__fpurge.c 2014-08-29 20:01:15.200070587 -0700
1176@@ -21,7 +21,7 @@
1177 void
1178 __fpurge (FILE *fp)
1179 {
1180- if (fp->_mode > 0)
1181+ if (_IO_is_wide (fp))
1182 {
1183 /* Wide-char stream. */
1184 if (_IO_in_backup (fp))
1185Index: git/libio/iofwide.c
1186===================================================================
1187--- git.orig/libio/iofwide.c 2014-08-29 20:00:47.360070587 -0700
1188+++ git/libio/iofwide.c 2014-08-29 20:01:15.200070587 -0700
1189@@ -26,6 +26,7 @@
1190
1191 #include <libioP.h>
1192 #ifdef _LIBC
1193+# include <gnu/option-groups.h>
1194 # include <dlfcn.h>
1195 # include <wchar.h>
1196 #endif
1197@@ -43,6 +44,8 @@
1198 #endif
1199
1200
1201+#if ! defined _LIBC || __OPTION_POSIX_C_LANG_WIDE_CHAR
1202+
1203 /* Prototypes of libio's codecvt functions. */
1204 static enum __codecvt_result do_out (struct _IO_codecvt *codecvt,
1205 __mbstate_t *statep,
1206@@ -513,3 +516,26 @@
1207 return MB_CUR_MAX;
1208 #endif
1209 }
1210+
1211+#else
1212+/* OPTION_POSIX_C_LANG_WIDE_CHAR is disabled. */
1213+
1214+#undef _IO_fwide
1215+int
1216+_IO_fwide (fp, mode)
1217+ _IO_FILE *fp;
1218+ int mode;
1219+{
1220+ /* Die helpfully if the user tries to create a wide stream; I
1221+ disbelieve that most users check the return value from
1222+ 'fwide (fp, 1)'. */
1223+ assert (mode <= 0);
1224+
1225+ /* We can only make streams byte-oriented, which is trivial. */
1226+ if (mode < 0)
1227+ fp->_mode = -1;
1228+
1229+ return fp->_mode;
1230+}
1231+
1232+#endif
1233Index: git/libio/ioseekoff.c
1234===================================================================
1235--- git.orig/libio/ioseekoff.c 2014-08-29 20:00:47.364070587 -0700
1236+++ git/libio/ioseekoff.c 2014-08-29 20:01:15.200070587 -0700
1237@@ -60,7 +60,7 @@
1238 else
1239 abort ();
1240 }
1241- if (_IO_fwide (fp, 0) < 0)
1242+ if (! _IO_is_wide (fp))
1243 _IO_free_backup_area (fp);
1244 else
1245 _IO_free_wbackup_area (fp);
1246Index: git/libio/ioseekpos.c
1247===================================================================
1248--- git.orig/libio/ioseekpos.c 2014-08-29 20:00:47.364070587 -0700
1249+++ git/libio/ioseekpos.c 2014-08-29 20:01:15.200070587 -0700
1250@@ -35,7 +35,7 @@
1251 /* If we have a backup buffer, get rid of it, since the __seekoff
1252 callback may not know to do the right thing about it.
1253 This may be over-kill, but it'll do for now. TODO */
1254- if (_IO_fwide (fp, 0) <= 0)
1255+ if (! _IO_is_wide (fp))
1256 {
1257 if (_IO_have_backup (fp))
1258 _IO_free_backup_area (fp);
1259Index: git/libio/iosetbuffer.c
1260===================================================================
1261--- git.orig/libio/iosetbuffer.c 2014-08-29 20:00:47.364070587 -0700
1262+++ git/libio/iosetbuffer.c 2014-08-29 20:01:15.204070587 -0700
1263@@ -24,6 +24,8 @@
1264 This exception applies to code released by its copyright holders
1265 in files containing the exception. */
1266
1267+#include <gnu/option-groups.h>
1268+
1269 #include "libioP.h"
1270
1271 void
1272@@ -38,9 +40,11 @@
1273 if (!buf)
1274 size = 0;
1275 (void) _IO_SETBUF (fp, buf, size);
1276+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
1277 if (_IO_vtable_offset (fp) == 0 && fp->_mode == 0 && _IO_CHECK_WIDE (fp))
1278 /* We also have to set the buffer using the wide char function. */
1279 (void) _IO_WSETBUF (fp, buf, size);
1280+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
1281 _IO_release_lock (fp);
1282 }
1283 libc_hidden_def (_IO_setbuffer)
1284Index: git/libio/libioP.h
1285===================================================================
1286--- git.orig/libio/libioP.h 2014-08-29 20:00:47.372070587 -0700
1287+++ git/libio/libioP.h 2014-08-29 20:01:15.204070587 -0700
1288@@ -42,6 +42,10 @@
1289 /*# include <comthread.h>*/
1290 #endif
1291
1292+#if defined _LIBC
1293+# include <gnu/option-groups.h>
1294+#endif
1295+
1296 #include <math_ldbl_opt.h>
1297
1298 #include "iolibio.h"
1299@@ -508,8 +512,20 @@
1300
1301
1302 #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
1303+
1304+/* _IO_is_wide (fp) is roughly equivalent to '_IO_fwide (fp, 0) > 0',
1305+ except that when OPTION_POSIX_C_LANG_WIDE_CHAR is disabled, it
1306+ expands to a constant, allowing the compiler to realize that it can
1307+ eliminate code that references wide stream handling functions.
1308+ This, in turn, allows us to omit them. */
1309+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
1310+# define _IO_is_wide(_f) ((_f)->_mode > 0)
1311+#else
1312+# define _IO_is_wide(_f) (0)
1313+#endif
1314+
1315 # define _IO_do_flush(_f) \
1316- ((_f)->_mode <= 0 \
1317+ (! _IO_is_wide (_f) \
1318 ? _IO_do_write(_f, (_f)->_IO_write_base, \
1319 (_f)->_IO_write_ptr-(_f)->_IO_write_base) \
1320 : _IO_wdo_write(_f, (_f)->_wide_data->_IO_write_base, \
1321Index: git/libio/Makefile
1322===================================================================
1323--- git.orig/libio/Makefile 2014-08-29 20:00:47.332070587 -0700
1324+++ git/libio/Makefile 2014-08-29 20:01:15.204070587 -0700
1325@@ -18,6 +18,8 @@
1326 #
1327 # Specific makefile for libio.
1328 #
1329+include ../option-groups.mak
1330+
1331 subdir := libio
1332
1333 include ../Makeconfig
1334@@ -27,16 +29,13 @@
1335
1336 routines := \
1337 filedoalloc iofclose iofdopen iofflush iofgetpos iofgets iofopen \
1338- iofopncook iofputs iofread iofsetpos ioftell wfiledoalloc \
1339+ iofopncook iofputs iofread iofsetpos ioftell \
1340 iofwrite iogetdelim iogetline iogets iopadn iopopen ioputs \
1341 ioseekoff ioseekpos iosetbuffer iosetvbuf ioungetc \
1342 iovsprintf iovsscanf \
1343 iofgetpos64 iofopen64 iofsetpos64 \
1344- fputwc fputwc_u getwc getwc_u getwchar getwchar_u iofgetws iofgetws_u \
1345- iofputws iofputws_u iogetwline iowpadn ioungetwc putwc putwc_u \
1346- putwchar putwchar_u putchar putchar_u fwprintf swprintf vwprintf \
1347- wprintf wscanf fwscanf vwscanf vswprintf iovswscanf swscanf wgenops \
1348- wstrops wfileops iofwide fwide wmemstream \
1349+ putchar putchar_u \
1350+ iofwide \
1351 \
1352 clearerr feof ferror fileno fputc freopen fseek getc getchar \
1353 memstream pclose putc putchar rewind setbuf setlinebuf vasprintf \
1354@@ -47,25 +46,48 @@
1355 __fpurge __fpending __fsetlocking \
1356 \
1357 libc_fatal fmemopen
1358-
1359-tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc \
1360- tst_wprintf2 tst-widetext test-fmemopen tst-ext tst-ext2 \
1361- tst-fgetws tst-ungetwc1 tst-ungetwc2 tst-swscanf tst-sscanf \
1362- tst-mmap-setvbuf bug-ungetwc1 bug-ungetwc2 tst-atime tst-eof \
1363- tst-freopen bug-rewind bug-rewind2 bug-ungetc bug-fseek \
1364- tst-mmap-eofsync tst-mmap-fflushsync bug-mmap-fflush \
1365- tst-mmap2-eofsync tst-mmap-offend bug-fopena+ bug-wfflush \
1366- bug-ungetc2 bug-ftell bug-ungetc3 bug-ungetc4 tst-fopenloc2 \
1367- tst-memstream1 tst-memstream2 \
1368- tst-wmemstream1 tst-wmemstream2 \
1369- bug-memstream1 bug-wmemstream1 \
1370- tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos tst-fseek \
1371- tst-fwrite-error tst-ftell-partial-wide tst-ftell-active-handler \
1372- tst-ftell-append
1373+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) += \
1374+ wfiledoalloc \
1375+ iowpadn \
1376+ swprintf \
1377+ vswprintf iovswscanf swscanf wgenops \
1378+ wstrops wfileops wmemstream
1379+routines-$(call option-disabled, OPTION_POSIX_C_LANG_WIDE_CHAR) += \
1380+ wdummyfileops
1381+routines-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) += \
1382+ fputwc fputwc_u getwc getwc_u getwchar getwchar_u iofgetws iofgetws_u \
1383+ iofputws iofputws_u iogetwline ioungetwc putwc putwc_u \
1384+ putwchar putwchar_u fwprintf vwprintf \
1385+ wprintf wscanf fwscanf vwscanf \
1386+ fwide
1387+
1388+tests = test-fmemopen tst-ext tst-ext2 \
1389+ tst-mmap-setvbuf tst-atime tst-eof \
1390+ tst-freopen bug-ungetc bug-fseek \
1391+ tst-mmap-eofsync tst-mmap-fflushsync bug-mmap-fflush \
1392+ tst-mmap2-eofsync tst-mmap-offend bug-fopena+ \
1393+ bug-ungetc2 bug-ungetc3 bug-ungetc4 \
1394+ tst-memstream1 tst-memstream2 \
1395+ bug-memstream1 tst-popen1 tst-fwrite-error \
1396+ tst-ftell-active-handler tst-ftell-append
1397+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
1398+ += tst-swscanf tst-fgetws tst-setvbuf1 \
1399+ tst-ungetwc1 tst-ungetwc2 bug-ftell bug-ungetwc2 \
1400+ tst-widetext
1401+tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
1402+ += bug-rewind bug-rewind2 bug-ungetwc1 \
1403+ bug-wfflush bug-wmemstream1 tst-fopenloc2 \
1404+ tst_getwc \
1405+ tst_putwc tst_wprintf tst_wprintf2 tst_wscanf \
1406+ tst-fgetwc bug-wsetpos tst-fseek tst-ftell-partial-wide
1407+tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
1408+ += tst_swprintf tst_swscanf \
1409+ tst-sscanf \
1410+ tst-wmemstream1 tst-wmemstream2
1411 ifeq (yes,$(build-shared))
1412 # Add test-fopenloc only if shared library is enabled since it depends on
1413 # shared localedata objects.
1414-tests += tst-fopenloc
1415+tests-$(OPTION_EGLIBC_LOCALE_CODE) += tst-fopenloc
1416 endif
1417 test-srcs = test-freopen
1418
1419@@ -164,13 +186,17 @@
1420 oldiofsetpos64
1421
1422 ifeq ($(run-built-tests),yes)
1423+ifeq (y,$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO))
1424 tests-special += $(objpfx)test-freopen.out
1425+endif
1426+ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
1427 ifeq (yes,$(build-shared))
1428 # Run tst-fopenloc-cmp.out and tst-openloc-mem.out only if shared
1429 # library is enabled since they depend on tst-fopenloc.out.
1430 tests-special += $(objpfx)tst-fopenloc-cmp.out $(objpfx)tst-fopenloc-mem.out
1431 endif
1432 endif
1433+endif
1434
1435 include ../Rules
1436
1437Index: git/libio/wdummyfileops.c
1438===================================================================
1439--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1440+++ git/libio/wdummyfileops.c 2014-08-29 20:01:15.204070587 -0700
1441@@ -0,0 +1,161 @@
1442+/* Copyright (C) 2007 Free Software Foundation, Inc.
1443+ This file is part of the GNU C Library.
1444+
1445+ The GNU C Library is free software; you can redistribute it and/or
1446+ modify it under the terms of the GNU Lesser General Public
1447+ License as published by the Free Software Foundation; either
1448+ version 2.1 of the License, or (at your option) any later version.
1449+
1450+ The GNU C Library is distributed in the hope that it will be useful,
1451+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1452+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1453+ Lesser General Public License for more details.
1454+
1455+ You should have received a copy of the GNU Lesser General Public
1456+ License along with the GNU C Library; if not, write to the Free
1457+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1458+ 02111-1307 USA.
1459+
1460+ As a special exception, if you link the code in this file with
1461+ files compiled with a GNU compiler to produce an executable,
1462+ that does not cause the resulting executable to be covered by
1463+ the GNU Lesser General Public License. This exception does not
1464+ however invalidate any other reasons why the executable file
1465+ might be covered by the GNU Lesser General Public License.
1466+ This exception applies to code released by its copyright holders
1467+ in files containing the exception. */
1468+
1469+#include <assert.h>
1470+#include <stdio.h>
1471+#include <stdlib.h>
1472+#include <libioP.h>
1473+
1474+static void __THROW __attribute__ ((__noreturn__))
1475+_IO_wfile_wide_char_support_disabled (void)
1476+{
1477+ static const char errstr[]
1478+ = ("The application tried to use wide character I/O, but libc.so"
1479+ " was compiled\n"
1480+ "with the OPTION_POSIX_C_LANG_WIDE_CHAR option group disabled.\n");
1481+ __libc_write (STDERR_FILENO, errstr, sizeof (errstr) - 1);
1482+ abort ();
1483+}
1484+
1485+static void
1486+_IO_wfile_disabled_void_int (_IO_FILE *fp, int x)
1487+{
1488+ _IO_wfile_wide_char_support_disabled ();
1489+}
1490+
1491+static int
1492+_IO_wfile_disabled_int_int (_IO_FILE *fp, int x)
1493+{
1494+ _IO_wfile_wide_char_support_disabled ();
1495+}
1496+
1497+static int
1498+_IO_wfile_disabled_int_none (_IO_FILE *fp)
1499+{
1500+ _IO_wfile_wide_char_support_disabled ();
1501+}
1502+
1503+static _IO_size_t
1504+_IO_wfile_disabled_xsputn (_IO_FILE *fp, const void *data, _IO_size_t n)
1505+{
1506+ _IO_wfile_wide_char_support_disabled ();
1507+}
1508+
1509+static _IO_size_t
1510+_IO_wfile_disabled_xsgetn (_IO_FILE *fp, void *data, _IO_size_t n)
1511+{
1512+ _IO_wfile_wide_char_support_disabled ();
1513+}
1514+
1515+static _IO_off64_t
1516+_IO_wfile_disabled_seekoff (_IO_FILE *fp, _IO_off64_t off, int dir, int mode)
1517+{
1518+ _IO_wfile_wide_char_support_disabled ();
1519+}
1520+
1521+static _IO_off64_t
1522+_IO_wfile_disabled_seekpos (_IO_FILE *fp, _IO_off64_t pos, int flags)
1523+{
1524+ _IO_wfile_wide_char_support_disabled ();
1525+}
1526+
1527+static _IO_FILE *
1528+_IO_wfile_disabled_setbuf (_IO_FILE *fp, char *buffer, _IO_ssize_t length)
1529+{
1530+ _IO_wfile_wide_char_support_disabled ();
1531+}
1532+
1533+static _IO_ssize_t
1534+_IO_wfile_disabled_read (_IO_FILE *fp, void *buffer, _IO_ssize_t length)
1535+{
1536+ _IO_wfile_wide_char_support_disabled ();
1537+}
1538+
1539+static _IO_ssize_t
1540+_IO_wfile_disabled_write (_IO_FILE *fp, const void *buffer, _IO_ssize_t length)
1541+{
1542+ _IO_wfile_wide_char_support_disabled ();
1543+}
1544+
1545+static _IO_off64_t
1546+_IO_wfile_disabled_seek (_IO_FILE *fp, _IO_off64_t offset, int mode)
1547+{
1548+ _IO_wfile_wide_char_support_disabled ();
1549+}
1550+
1551+static int
1552+_IO_wfile_disabled_close (_IO_FILE *fp)
1553+{
1554+ _IO_wfile_wide_char_support_disabled ();
1555+}
1556+
1557+static int
1558+_IO_wfile_disabled_stat (_IO_FILE *fp, void *buf)
1559+{
1560+ _IO_wfile_wide_char_support_disabled ();
1561+}
1562+
1563+static int
1564+_IO_wfile_disabled_showmanyc (_IO_FILE *fp)
1565+{
1566+ _IO_wfile_wide_char_support_disabled ();
1567+}
1568+
1569+static void
1570+_IO_wfile_disabled_imbue (_IO_FILE *fp, void *locale)
1571+{
1572+ _IO_wfile_wide_char_support_disabled ();
1573+}
1574+
1575+static const struct _IO_jump_t _IO_wfile_jumps_disabled =
1576+{
1577+ JUMP_INIT_DUMMY,
1578+ JUMP_INIT(finish, _IO_wfile_disabled_void_int),
1579+ JUMP_INIT(overflow, _IO_wfile_disabled_int_int),
1580+ JUMP_INIT(underflow, _IO_wfile_disabled_int_none),
1581+ JUMP_INIT(uflow, _IO_wfile_disabled_int_none),
1582+ JUMP_INIT(pbackfail, _IO_wfile_disabled_int_int),
1583+ JUMP_INIT(xsputn, _IO_wfile_disabled_xsputn),
1584+ JUMP_INIT(xsgetn, _IO_wfile_disabled_xsgetn),
1585+ JUMP_INIT(seekoff, _IO_wfile_disabled_seekoff),
1586+ JUMP_INIT(seekpos, _IO_wfile_disabled_seekpos),
1587+ JUMP_INIT(setbuf, _IO_wfile_disabled_setbuf),
1588+ JUMP_INIT(sync, _IO_wfile_disabled_int_none),
1589+ JUMP_INIT(doallocate, _IO_wfile_disabled_int_none),
1590+ JUMP_INIT(read, _IO_wfile_disabled_read),
1591+ JUMP_INIT(write, _IO_wfile_disabled_write),
1592+ JUMP_INIT(seek, _IO_wfile_disabled_seek),
1593+ JUMP_INIT(close, _IO_wfile_disabled_close),
1594+ JUMP_INIT(stat, _IO_wfile_disabled_stat),
1595+ JUMP_INIT(showmanyc, _IO_wfile_disabled_showmanyc),
1596+ JUMP_INIT(imbue, _IO_wfile_disabled_imbue)
1597+};
1598+
1599+strong_alias (_IO_wfile_jumps_disabled, _IO_wfile_jumps)
1600+libc_hidden_data_def (_IO_wfile_jumps)
1601+strong_alias (_IO_wfile_jumps_disabled, _IO_wfile_jumps_mmap)
1602+strong_alias (_IO_wfile_jumps_disabled, _IO_wfile_jumps_maybe_mmap)
1603Index: git/locale/catnames.c
1604===================================================================
1605--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1606+++ git/locale/catnames.c 2014-08-29 20:01:15.204070587 -0700
1607@@ -0,0 +1,48 @@
1608+/* Copyright (C) 2006 Free Software Foundation, Inc.
1609+ This file is part of the GNU C Library.
1610+
1611+ The GNU C Library is free software; you can redistribute it and/or
1612+ modify it under the terms of the GNU Lesser General Public
1613+ License as published by the Free Software Foundation; either
1614+ version 2.1 of the License, or (at your option) any later version.
1615+
1616+ The GNU C Library is distributed in the hope that it will be useful,
1617+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1618+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1619+ Lesser General Public License for more details.
1620+
1621+ You should have received a copy of the GNU Lesser General Public
1622+ License along with the GNU C Library; if not, write to the Free
1623+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1624+ 02111-1307 USA. */
1625+
1626+#include "localeinfo.h"
1627+
1628+/* Define an array of category names (also the environment variable names). */
1629+const union catnamestr_t _nl_category_names attribute_hidden =
1630+ {
1631+ {
1632+#define DEFINE_CATEGORY(category, category_name, items, a) \
1633+ category_name,
1634+#include "categories.def"
1635+#undef DEFINE_CATEGORY
1636+ }
1637+ };
1638+
1639+const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden =
1640+ {
1641+#define DEFINE_CATEGORY(category, category_name, items, a) \
1642+ [category] = offsetof (union catnamestr_t, CATNAMEMF (__LINE__)),
1643+#include "categories.def"
1644+#undef DEFINE_CATEGORY
1645+ };
1646+
1647+/* An array of their lengths, for convenience. */
1648+const uint8_t _nl_category_name_sizes[] attribute_hidden =
1649+ {
1650+#define DEFINE_CATEGORY(category, category_name, items, a) \
1651+ [category] = sizeof (category_name) - 1,
1652+#include "categories.def"
1653+#undef DEFINE_CATEGORY
1654+ [LC_ALL] = sizeof ("LC_ALL") - 1
1655+ };
1656Index: git/locale/C-ctype.c
1657===================================================================
1658--- git.orig/locale/C-ctype.c 2014-08-29 20:00:47.396070587 -0700
1659+++ git/locale/C-ctype.c 2014-08-29 20:01:15.204070587 -0700
1660@@ -19,8 +19,11 @@
1661 #include "localeinfo.h"
1662 #include <endian.h>
1663 #include <stdint.h>
1664+#include <gnu/option-groups.h>
1665
1666+#if __OPTION_EGLIBC_LOCALE_CODE
1667 #include "C-translit.h"
1668+#endif
1669
1670 /* This table's entries are taken from POSIX.2 Table 2-6
1671 ``LC_CTYPE Category Definition in the POSIX Locale''.
1672@@ -647,6 +650,7 @@
1673 { .word = L'7' },
1674 { .word = L'8' },
1675 { .word = L'9' },
1676+#if __OPTION_EGLIBC_LOCALE_CODE
1677 /* _NL_CTYPE_TRANSLIT_TAB_SIZE */
1678 { .word = NTRANSLIT },
1679 /* _NL_CTYPE_TRANSLIT_FROM_IDX */
1680@@ -657,6 +661,22 @@
1681 { .wstr = translit_to_idx },
1682 /* _NL_CTYPE_TRANSLIT_TO_TBL */
1683 { .wstr = (uint32_t *) translit_to_tbl },
1684+#else
1685+ /* If the locale code isn't enabled, we don't have the
1686+ transliteration code in iconv/gconv_trans.c anyway, so there's
1687+ no need for the transliteration tables here. We'll fall back
1688+ on the default missing replacement, '?'. */
1689+ /* _NL_CTYPE_TRANSLIT_TAB_SIZE */
1690+ { .word = 0 },
1691+ /* _NL_CTYPE_TRANSLIT_FROM_IDX */
1692+ { .wstr = NULL },
1693+ /* _NL_CTYPE_TRANSLIT_FROM_TBL */
1694+ { .wstr = NULL },
1695+ /* _NL_CTYPE_TRANSLIT_TO_IDX */
1696+ { .wstr = NULL },
1697+ /* _NL_CTYPE_TRANSLIT_TO_TBL */
1698+ { .wstr = NULL },
1699+#endif
1700 /* _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN */
1701 { .word = 1 },
1702 /* _NL_CTYPE_TRANSLIT_DEFAULT_MISSING */
1703Index: git/locale/dummy-setlocale.c
1704===================================================================
1705--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1706+++ git/locale/dummy-setlocale.c 2014-08-29 20:01:15.204070587 -0700
1707@@ -0,0 +1,33 @@
1708+/* Copyright (C) 2006 Free Software Foundation, Inc.
1709+ This file is part of the GNU C Library.
1710+
1711+ The GNU C Library is free software; you can redistribute it and/or
1712+ modify it under the terms of the GNU Lesser General Public
1713+ License as published by the Free Software Foundation; either
1714+ version 2.1 of the License, or (at your option) any later version.
1715+
1716+ The GNU C Library is distributed in the hope that it will be useful,
1717+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1718+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1719+ Lesser General Public License for more details.
1720+
1721+ You should have received a copy of the GNU Lesser General Public
1722+ License along with the GNU C Library; if not, write to the Free
1723+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1724+ 02111-1307 USA. */
1725+
1726+#include <string.h>
1727+#include <locale.h>
1728+
1729+char *
1730+setlocale (int category, const char *locale)
1731+{
1732+ if (! locale
1733+ || locale[0] == '\0'
1734+ || strcmp (locale, "C") == 0
1735+ || strcmp (locale, "POSIX") == 0)
1736+ return (char *) "C";
1737+ else
1738+ return NULL;
1739+}
1740+libc_hidden_def (setlocale)
1741Index: git/locale/localeinfo.h
1742===================================================================
1743--- git.orig/locale/localeinfo.h 2014-08-29 20:00:47.404070587 -0700
1744+++ git/locale/localeinfo.h 2014-08-29 20:01:15.204070587 -0700
1745@@ -224,7 +224,7 @@
1746 unused. We can manage this playing some tricks with weak references.
1747 But with thread-local locale settings, it becomes quite ungainly unless
1748 we can use __thread variables. So only in that case do we attempt this. */
1749-#ifndef SHARED
1750+#if !defined SHARED && !defined IN_GLIBC_LOCALEDEF
1751 # include <tls.h>
1752 # define NL_CURRENT_INDIRECT 1
1753 #endif
1754Index: git/locale/Makefile
1755===================================================================
1756--- git.orig/locale/Makefile 2014-08-29 20:00:47.400070587 -0700
1757+++ git/locale/Makefile 2014-08-29 20:01:15.204070587 -0700
1758@@ -18,27 +18,43 @@
1759 #
1760 # Makefile for locales.
1761 #
1762+include ../option-groups.mak
1763+
1764 subdir := locale
1765
1766 include ../Makeconfig
1767
1768 headers = locale.h bits/locale.h langinfo.h xlocale.h
1769-routines = setlocale findlocale loadlocale loadarchive \
1770- localeconv nl_langinfo nl_langinfo_l mb_cur_max \
1771- newlocale duplocale freelocale uselocale
1772-tests = tst-C-locale tst-locname tst-duplocale
1773+# catnames is needed by OPTION_EGLIBC_LOCALE_CODE and by the 'intl' code.
1774+# If we put the latter in an option group, too, we can omit catnames
1775+# when both option groups are disabled. libstdc++-v3 needs mb_cur_max.
1776+routines-y := catnames mb_cur_max
1777+routines-$(OPTION_EGLIBC_LOCALE_CODE) \
1778+ += setlocale findlocale loadlocale loadarchive \
1779+ localeconv nl_langinfo nl_langinfo_l \
1780+ newlocale duplocale freelocale uselocale
1781+ifneq (y,$(OPTION_EGLIBC_LOCALE_CODE))
1782+routines-y += dummy-setlocale
1783+endif
1784+tests-$(OPTION_EGLIBC_LOCALE_CODE) += tst-C-locale tst-locname tst-duplocale
1785 categories = ctype messages monetary numeric time paper name \
1786 address telephone measurement identification collate
1787-aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name \
1788- xlocale localename global-locale coll-lookup
1789-others = localedef locale
1790+# C-messages belongs in an intl option group.
1791+aux-y := C-ctype C-time \
1792+ SYS_libc C_name xlocale global-locale coll-lookup
1793+aux-$(OPTION_EGLIBC_LOCALE_CODE) \
1794+ += $(filter-out $(aux-y), \
1795+ $(categories:%=lc-%) $(categories:%=C-%)) \
1796+ localename
1797+others-$(OPTION_EGLIBC_LOCALE_CODE) = localedef locale
1798 #others-static = localedef locale
1799-install-bin = localedef locale
1800-extra-objs = $(localedef-modules:=.o) $(localedef-aux:=.o) \
1801+install-bin = $(others-y)
1802+extra-objs-$(OPTION_EGLIBC_LOCALE_CODE) \
1803+ = $(localedef-modules:=.o) $(localedef-aux:=.o) \
1804 $(locale-modules:=.o) $(lib-modules:=.o)
1805
1806-extra-libs = libBrokenLocale
1807-extra-libs-others = $(extra-libs)
1808+extra-libs-$(OPTION_EGLIBC_LOCALE_CODE) = libBrokenLocale
1809+extra-libs-others = $(extra-libs-y)
1810
1811 libBrokenLocale-routines = broken_cur_max
1812
1813@@ -94,6 +110,9 @@
1814 CFLAGS-charmap.c = -Wno-write-strings -Wno-char-subscripts
1815 CFLAGS-locfile.c = -Wno-write-strings -Wno-char-subscripts
1816 CFLAGS-charmap-dir.c = -Wno-write-strings
1817+ifneq (y,$(OPTION_EGLIBC_SPAWN))
1818+CFLAGS-charmap-dir.c += -DNO_UNCOMPRESS
1819+endif
1820
1821 # This makes sure -DNOT_IN_libc et al are passed for all these modules.
1822 cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \
1823Index: git/locale/programs/charmap-dir.c
1824===================================================================
1825--- git.orig/locale/programs/charmap-dir.c 2014-08-29 20:00:47.408070587 -0700
1826+++ git/locale/programs/charmap-dir.c 2014-08-29 20:01:15.204070587 -0700
1827@@ -19,7 +19,9 @@
1828 #include <error.h>
1829 #include <fcntl.h>
1830 #include <libintl.h>
1831+#ifndef NO_UNCOMPRESS
1832 #include <spawn.h>
1833+#endif
1834 #include <stdio.h>
1835 #include <stdlib.h>
1836 #include <string.h>
1837@@ -156,6 +158,7 @@
1838 return closedir (dir);
1839 }
1840
1841+#ifndef NO_UNCOMPRESS
1842 /* Creates a subprocess decompressing the given pathname, and returns
1843 a stream reading its output (the decompressed data). */
1844 static
1845@@ -204,6 +207,7 @@
1846 }
1847 return NULL;
1848 }
1849+#endif
1850
1851 /* Opens a charmap for reading, given its name (not an alias name). */
1852 FILE *
1853@@ -226,6 +230,7 @@
1854 if (stream != NULL)
1855 return stream;
1856
1857+#ifndef NO_UNCOMPRESS
1858 memcpy (p, ".gz", 4);
1859 stream = fopen_uncompressed (pathname, "gzip");
1860 if (stream != NULL)
1861@@ -235,6 +240,7 @@
1862 stream = fopen_uncompressed (pathname, "bzip2");
1863 if (stream != NULL)
1864 return stream;
1865+#endif
1866
1867 return NULL;
1868 }
1869@@ -263,8 +269,8 @@
1870 char *alias = NULL;
1871 char junk[BUFSIZ];
1872
1873- if (fscanf (stream, " <code_set_name> %ms", &alias) == 1
1874- || fscanf (stream, "%% alias %ms", &alias) == 1)
1875+ if (fscanf (stream, " <code_set_name> %as", &alias) == 1
1876+ || fscanf (stream, "%% alias %as", &alias) == 1)
1877 {
1878 aliases = (char **) xrealloc (aliases,
1879 (naliases + 2) * sizeof (char *));
1880Index: git/locale/programs/ld-collate.c
1881===================================================================
1882--- git.orig/locale/programs/ld-collate.c 2014-08-29 20:00:47.408070587 -0700
1883+++ git/locale/programs/ld-collate.c 2014-08-29 20:01:15.208070587 -0700
1884@@ -350,7 +350,7 @@
1885 }
1886 if (wcs != NULL)
1887 {
1888- size_t nwcs = wcslen ((wchar_t *) wcs);
1889+ size_t nwcs = wcslen_uint32 (wcs);
1890 uint32_t zero = 0;
1891 /* Handle <U0000> as a single character. */
1892 if (nwcs == 0)
1893@@ -1776,8 +1776,7 @@
1894
1895 if ((*eptr)->nwcs == runp->nwcs)
1896 {
1897- int c = wmemcmp ((wchar_t *) (*eptr)->wcs,
1898- (wchar_t *) runp->wcs, runp->nwcs);
1899+ int c = wmemcmp_uint32 ((*eptr)->wcs, runp->wcs, runp->nwcs);
1900
1901 if (c == 0)
1902 {
1903@@ -2010,9 +2009,9 @@
1904 one consecutive entry. */
1905 if (runp->wcnext != NULL
1906 && runp->nwcs == runp->wcnext->nwcs
1907- && wmemcmp ((wchar_t *) runp->wcs,
1908- (wchar_t *)runp->wcnext->wcs,
1909- runp->nwcs - 1) == 0
1910+ && wmemcmp_uint32 (runp->wcs,
1911+ runp->wcnext->wcs,
1912+ runp->nwcs - 1) == 0
1913 && (runp->wcs[runp->nwcs - 1]
1914 == runp->wcnext->wcs[runp->nwcs - 1] + 1))
1915 {
1916@@ -2036,9 +2035,9 @@
1917 runp = runp->wcnext;
1918 while (runp->wcnext != NULL
1919 && runp->nwcs == runp->wcnext->nwcs
1920- && wmemcmp ((wchar_t *) runp->wcs,
1921- (wchar_t *)runp->wcnext->wcs,
1922- runp->nwcs - 1) == 0
1923+ && wmemcmp_uint32 (runp->wcs,
1924+ runp->wcnext->wcs,
1925+ runp->nwcs - 1) == 0
1926 && (runp->wcs[runp->nwcs - 1]
1927 == runp->wcnext->wcs[runp->nwcs - 1] + 1));
1928
1929Index: git/locale/programs/ld-ctype.c
1930===================================================================
1931--- git.orig/locale/programs/ld-ctype.c 2014-08-29 20:00:47.408070587 -0700
1932+++ git/locale/programs/ld-ctype.c 2014-08-29 20:01:15.208070587 -0700
1933@@ -957,7 +957,7 @@
1934 allocate_arrays (ctype, charmap, ctype->repertoire);
1935
1936 default_missing_len = (ctype->default_missing
1937- ? wcslen ((wchar_t *) ctype->default_missing)
1938+ ? wcslen_uint32 (ctype->default_missing)
1939 : 0);
1940
1941 init_locale_data (&file, nelems);
1942@@ -1968,7 +1968,7 @@
1943 ignore = 1;
1944 else
1945 /* This value is usable. */
1946- obstack_grow (ob, to_wstr, wcslen ((wchar_t *) to_wstr) * 4);
1947+ obstack_grow (ob, to_wstr, wcslen_uint32 (to_wstr) * 4);
1948
1949 first = 0;
1950 }
1951@@ -2516,8 +2516,8 @@
1952 }
1953
1954 handle_tok_digit:
1955- class_bit = _ISwdigit;
1956- class256_bit = _ISdigit;
1957+ class_bit = BITw (tok_digit);
1958+ class256_bit = BIT (tok_digit);
1959 handle_digits = 1;
1960 goto read_charclass;
1961
1962@@ -4001,8 +4001,7 @@
1963
1964 while (idx < number)
1965 {
1966- int res = wcscmp ((const wchar_t *) sorted[idx]->from,
1967- (const wchar_t *) runp->from);
1968+ int res = wcscmp_uint32 (sorted[idx]->from, runp->from);
1969 if (res == 0)
1970 {
1971 replace = 1;
1972@@ -4039,11 +4038,11 @@
1973 for (cnt = 0; cnt < number; ++cnt)
1974 {
1975 struct translit_to_t *srunp;
1976- from_len += wcslen ((const wchar_t *) sorted[cnt]->from) + 1;
1977+ from_len += wcslen_uint32 (sorted[cnt]->from) + 1;
1978 srunp = sorted[cnt]->to;
1979 while (srunp != NULL)
1980 {
1981- to_len += wcslen ((const wchar_t *) srunp->str) + 1;
1982+ to_len += wcslen_uint32 (srunp->str) + 1;
1983 srunp = srunp->next;
1984 }
1985 /* Plus one for the extra NUL character marking the end of
1986@@ -4067,18 +4066,18 @@
1987 ctype->translit_from_idx[cnt] = from_len;
1988 ctype->translit_to_idx[cnt] = to_len;
1989
1990- len = wcslen ((const wchar_t *) sorted[cnt]->from) + 1;
1991- wmemcpy ((wchar_t *) &ctype->translit_from_tbl[from_len],
1992- (const wchar_t *) sorted[cnt]->from, len);
1993+ len = wcslen_uint32 (sorted[cnt]->from) + 1;
1994+ wmemcpy_uint32 (&ctype->translit_from_tbl[from_len],
1995+ sorted[cnt]->from, len);
1996 from_len += len;
1997
1998 ctype->translit_to_idx[cnt] = to_len;
1999 srunp = sorted[cnt]->to;
2000 while (srunp != NULL)
2001 {
2002- len = wcslen ((const wchar_t *) srunp->str) + 1;
2003- wmemcpy ((wchar_t *) &ctype->translit_to_tbl[to_len],
2004- (const wchar_t *) srunp->str, len);
2005+ len = wcslen_uint32 (srunp->str) + 1;
2006+ wmemcpy_uint32 (&ctype->translit_to_tbl[to_len],
2007+ srunp->str, len);
2008 to_len += len;
2009 srunp = srunp->next;
2010 }
2011Index: git/locale/programs/ld-messages.c
2012===================================================================
2013--- git.orig/locale/programs/ld-messages.c 2014-08-29 20:00:47.412070587 -0700
2014+++ git/locale/programs/ld-messages.c 2014-08-29 20:01:15.208070587 -0700
2015@@ -25,6 +25,7 @@
2016 #include <string.h>
2017 #include <stdint.h>
2018 #include <sys/uio.h>
2019+#include <gnu/option-groups.h>
2020
2021 #include <assert.h>
2022
2023@@ -124,6 +125,7 @@
2024 }
2025 else
2026 {
2027+#if __OPTION_POSIX_REGEXP
2028 int result;
2029 regex_t re;
2030
2031@@ -140,6 +142,7 @@
2032 }
2033 else if (result != 0)
2034 regfree (&re);
2035+#endif
2036 }
2037
2038 if (messages->noexpr == NULL)
2039@@ -158,6 +161,7 @@
2040 }
2041 else
2042 {
2043+#if __OPTION_POSIX_REGEXP
2044 int result;
2045 regex_t re;
2046
2047@@ -174,6 +178,7 @@
2048 }
2049 else if (result != 0)
2050 regfree (&re);
2051+#endif
2052 }
2053 }
2054
2055Index: git/locale/programs/ld-time.c
2056===================================================================
2057--- git.orig/locale/programs/ld-time.c 2014-08-29 20:00:47.412070587 -0700
2058+++ git/locale/programs/ld-time.c 2014-08-29 20:01:15.208070587 -0700
2059@@ -215,8 +215,10 @@
2060 }
2061 else
2062 {
2063+ static const uint32_t wt_fmt_ampm[]
2064+ = { '%','I',':','%','M',':','%','S',' ','%','p',0 };
2065 time->t_fmt_ampm = "%I:%M:%S %p";
2066- time->wt_fmt_ampm = (const uint32_t *) L"%I:%M:%S %p";
2067+ time->wt_fmt_ampm = wt_fmt_ampm;
2068 }
2069 }
2070
2071@@ -226,7 +228,7 @@
2072 const int days_per_month[12] = { 31, 29, 31, 30, 31, 30,
2073 31, 31, 30, 31 ,30, 31 };
2074 size_t idx;
2075- wchar_t *wstr;
2076+ uint32_t *wstr;
2077
2078 time->era_entries =
2079 (struct era_data *) xmalloc (time->num_era
2080@@ -464,18 +466,18 @@
2081 }
2082
2083 /* Now generate the wide character name and format. */
2084- wstr = wcschr ((wchar_t *) time->wera[idx], L':');/* end direction */
2085- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end offset */
2086- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end start */
2087- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end end */
2088+ wstr = wcschr_uint32 (time->wera[idx], L':'); /* end direction */
2089+ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end offset */
2090+ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end start */
2091+ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end end */
2092 if (wstr != NULL)
2093 {
2094- time->era_entries[idx].wname = (uint32_t *) wstr + 1;
2095- wstr = wcschr (wstr + 1, L':'); /* end name */
2096+ time->era_entries[idx].wname = wstr + 1;
2097+ wstr = wcschr_uint32 (wstr + 1, L':'); /* end name */
2098 if (wstr != NULL)
2099 {
2100 *wstr = L'\0';
2101- time->era_entries[idx].wformat = (uint32_t *) wstr + 1;
2102+ time->era_entries[idx].wformat = wstr + 1;
2103 }
2104 else
2105 time->era_entries[idx].wname =
2106@@ -530,7 +532,16 @@
2107 if (time->date_fmt == NULL)
2108 time->date_fmt = "%a %b %e %H:%M:%S %Z %Y";
2109 if (time->wdate_fmt == NULL)
2110- time->wdate_fmt = (const uint32_t *) L"%a %b %e %H:%M:%S %Z %Y";
2111+ {
2112+ static const uint32_t wdate_fmt[] =
2113+ { '%','a',' ',
2114+ '%','b',' ',
2115+ '%','e',' ',
2116+ '%','H',':','%','M',':','%','S',' ',
2117+ '%','Z',' ',
2118+ '%','Y',0 };
2119+ time->wdate_fmt = wdate_fmt;
2120+ }
2121 }
2122
2123
2124Index: git/locale/programs/linereader.c
2125===================================================================
2126--- git.orig/locale/programs/linereader.c 2014-08-29 20:00:47.412070587 -0700
2127+++ git/locale/programs/linereader.c 2014-08-29 20:01:15.208070587 -0700
2128@@ -595,7 +595,7 @@
2129 {
2130 int return_widestr = lr->return_widestr;
2131 char *buf;
2132- wchar_t *buf2 = NULL;
2133+ uint32_t *buf2 = NULL;
2134 size_t bufact;
2135 size_t bufmax = 56;
2136
2137Index: git/locale/programs/localedef.c
2138===================================================================
2139--- git.orig/locale/programs/localedef.c 2014-08-29 20:00:47.416070587 -0700
2140+++ git/locale/programs/localedef.c 2014-08-29 20:01:15.208070587 -0700
2141@@ -114,6 +114,7 @@
2142 #define OPT_LIST_ARCHIVE 309
2143 #define OPT_LITTLE_ENDIAN 400
2144 #define OPT_BIG_ENDIAN 401
2145+#define OPT_UINT32_ALIGN 402
2146
2147 /* Definitions of arguments for argp functions. */
2148 static const struct argp_option options[] =
2149@@ -150,6 +151,8 @@
2150 N_("Generate little-endian output") },
2151 { "big-endian", OPT_BIG_ENDIAN, NULL, 0,
2152 N_("Generate big-endian output") },
2153+ { "uint32-align", OPT_UINT32_ALIGN, "ALIGNMENT", 0,
2154+ N_("Set the target's uint32_t alignment in bytes (default 4)") },
2155 { NULL, 0, NULL, 0, NULL }
2156 };
2157
2158@@ -239,12 +242,14 @@
2159 ctype locale. (P1003.2 4.35.5.2) */
2160 setlocale (LC_CTYPE, "POSIX");
2161
2162+#ifndef NO_SYSCONF
2163 /* Look whether the system really allows locale definitions. POSIX
2164 defines error code 3 for this situation so I think it must be
2165 a fatal error (see P1003.2 4.35.8). */
2166 if (sysconf (_SC_2_LOCALEDEF) < 0)
2167 WITH_CUR_LOCALE (error (3, 0, _("\
2168 FATAL: system does not define `_POSIX2_LOCALEDEF'")));
2169+#endif
2170
2171 /* Process charmap file. */
2172 charmap = charmap_read (charmap_file, verbose, 1, be_quiet, 1);
2173@@ -338,6 +343,9 @@
2174 case OPT_BIG_ENDIAN:
2175 set_big_endian (true);
2176 break;
2177+ case OPT_UINT32_ALIGN:
2178+ uint32_align_mask = strtol (arg, NULL, 0) - 1;
2179+ break;
2180 case 'c':
2181 force_output = 1;
2182 break;
2183Index: git/locale/programs/locfile.c
2184===================================================================
2185--- git.orig/locale/programs/locfile.c 2014-08-29 20:00:47.432070587 -0700
2186+++ git/locale/programs/locfile.c 2014-08-29 20:01:15.208070587 -0700
2187@@ -544,6 +544,9 @@
2188 machine running localedef. */
2189 bool swap_endianness_p;
2190
2191+/* The target's value of __align__(uint32_t) - 1. */
2192+unsigned int uint32_align_mask = 3;
2193+
2194 /* When called outside a start_locale_structure/end_locale_structure
2195 or start_locale_prelude/end_locale_prelude block, record that the
2196 next byte in FILE's obstack will be the first byte of a new element.
2197@@ -621,7 +624,7 @@
2198 void
2199 add_locale_wstring (struct locale_file *file, const uint32_t *string)
2200 {
2201- add_locale_uint32_array (file, string, wcslen ((const wchar_t *) string) + 1);
2202+ add_locale_uint32_array (file, string, wcslen_uint32 (string) + 1);
2203 }
2204
2205 /* Record that FILE's next element is the 32-bit integer VALUE. */
2206Index: git/locale/programs/locfile.h
2207===================================================================
2208--- git.orig/locale/programs/locfile.h 2014-08-29 20:00:47.432070587 -0700
2209+++ git/locale/programs/locfile.h 2014-08-29 20:01:15.208070587 -0700
2210@@ -71,6 +71,8 @@
2211
2212 extern bool swap_endianness_p;
2213
2214+extern unsigned int uint32_align_mask;
2215+
2216 /* Change the output to be big-endian if BIG_ENDIAN is true and
2217 little-endian otherwise. */
2218 static inline void
2219@@ -275,4 +277,49 @@
2220 const struct charmap_t *charmap,
2221 const char *output_path);
2222
2223+static inline size_t
2224+wcslen_uint32 (const uint32_t *str)
2225+{
2226+ size_t len = 0;
2227+ while (str[len] != 0)
2228+ len++;
2229+ return len;
2230+}
2231+
2232+static inline int
2233+wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n)
2234+{
2235+ while (n-- != 0)
2236+ {
2237+ int diff = *s1++ - *s2++;
2238+ if (diff != 0)
2239+ return diff;
2240+ }
2241+ return 0;
2242+}
2243+
2244+static inline int
2245+wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2)
2246+{
2247+ while (*s1 != 0 && *s1 == *s2)
2248+ s1++, s2++;
2249+ return *s1 - *s2;
2250+}
2251+
2252+static inline uint32_t *
2253+wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n)
2254+{
2255+ return memcpy (s1, s2, n * sizeof (uint32_t));
2256+}
2257+
2258+static inline uint32_t *
2259+wcschr_uint32 (const uint32_t *s, uint32_t ch)
2260+{
2261+ do
2262+ if (*s == ch)
2263+ return (uint32_t *) s;
2264+ while (*s++ != 0);
2265+ return 0;
2266+}
2267+
2268 #endif /* locfile.h */
2269Index: git/locale/setlocale.c
2270===================================================================
2271--- git.orig/locale/setlocale.c 2014-08-29 20:00:47.432070587 -0700
2272+++ git/locale/setlocale.c 2014-08-29 20:01:15.208070587 -0700
2273@@ -64,36 +64,6 @@
2274 #endif
2275
2276
2277-/* Define an array of category names (also the environment variable names). */
2278-const union catnamestr_t _nl_category_names attribute_hidden =
2279- {
2280- {
2281-#define DEFINE_CATEGORY(category, category_name, items, a) \
2282- category_name,
2283-#include "categories.def"
2284-#undef DEFINE_CATEGORY
2285- }
2286- };
2287-
2288-const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden =
2289- {
2290-#define DEFINE_CATEGORY(category, category_name, items, a) \
2291- [category] = offsetof (union catnamestr_t, CATNAMEMF (__LINE__)),
2292-#include "categories.def"
2293-#undef DEFINE_CATEGORY
2294- };
2295-
2296-/* An array of their lengths, for convenience. */
2297-const uint8_t _nl_category_name_sizes[] attribute_hidden =
2298- {
2299-#define DEFINE_CATEGORY(category, category_name, items, a) \
2300- [category] = sizeof (category_name) - 1,
2301-#include "categories.def"
2302-#undef DEFINE_CATEGORY
2303- [LC_ALL] = sizeof ("LC_ALL") - 1
2304- };
2305-
2306-
2307 #ifdef NL_CURRENT_INDIRECT
2308 # define WEAK_POSTLOAD(postload) weak_extern (postload)
2309 #else
2310Index: git/locale/xlocale.c
2311===================================================================
2312--- git.orig/locale/xlocale.c 2014-08-29 20:00:47.436070587 -0700
2313+++ git/locale/xlocale.c 2014-08-29 20:01:15.208070587 -0700
2314@@ -18,6 +18,7 @@
2315 <http://www.gnu.org/licenses/>. */
2316
2317 #include <locale.h>
2318+#include <gnu/option-groups.h>
2319 #include "localeinfo.h"
2320
2321 #define DEFINE_CATEGORY(category, category_name, items, a) \
2322@@ -25,6 +26,19 @@
2323 #include "categories.def"
2324 #undef DEFINE_CATEGORY
2325
2326+/* If the locale support code isn't enabled, don't generate strong
2327+ reference to the C locale_data structures here; let the Makefile
2328+ decide which ones to include. (In the static linking case, the
2329+ strong reference to the 'class', 'toupper', and 'tolower' tables
2330+ will cause C-ctype.o to be brought in, as it should be, even when
2331+ the reference to _nl_C_LC_CTYPE will be weak.) */
2332+#if ! __OPTION_EGLIBC_LOCALE_CODE
2333+# define DEFINE_CATEGORY(category, category_name, items, a) \
2334+ weak_extern (_nl_C_##category)
2335+# include "categories.def"
2336+# undef DEFINE_CATEGORY
2337+#endif
2338+
2339 /* Defined in locale/C-ctype.c. */
2340 extern const char _nl_C_LC_CTYPE_class[] attribute_hidden;
2341 extern const char _nl_C_LC_CTYPE_toupper[] attribute_hidden;
2342@@ -52,3 +66,26 @@
2343 .__ctype_tolower = (const int *) _nl_C_LC_CTYPE_tolower + 128,
2344 .__ctype_toupper = (const int *) _nl_C_LC_CTYPE_toupper + 128
2345 };
2346+
2347+
2348+#if ! __OPTION_EGLIBC_LOCALE_CODE
2349+/* When locale code is enabled, these are each defined in the
2350+ appropriate lc-CATEGORY.c file, so that static links (when __thread
2351+ is supported) bring in only those lc-CATEGORY.o files for
2352+ categories the program actually uses; look for NL_CURRENT_INDIRECT
2353+ in localeinfo.h.
2354+
2355+ When locale code is disabled, the _nl_C_CATEGORY objects are the
2356+ only possible referents. At the moment, there isn't a way to get
2357+ __OPTION_EGLIBC_LOCALE_CODE defined in every compilation unit that
2358+ #includes localeinfo.h, so we can't just turn off
2359+ NL_CURRENT_INDIRECT. So we'll define the _nl_current_CATEGORY
2360+ pointers here. */
2361+#if defined (NL_CURRENT_INDIRECT)
2362+#define DEFINE_CATEGORY(category, category_name, items, a) \
2363+ __thread struct __locale_data * const *_nl_current_##category \
2364+ attribute_hidden = &_nl_C_locobj.__locales[category];
2365+#include "categories.def"
2366+#undef DEFINE_CATEGORY
2367+#endif
2368+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
2369Index: git/localedata/Makefile
2370===================================================================
2371--- git.orig/localedata/Makefile 2014-08-29 20:00:47.444070587 -0700
2372+++ git/localedata/Makefile 2014-08-29 20:01:15.212070587 -0700
2373@@ -21,12 +21,22 @@
2374
2375 include ../Makeconfig
2376
2377-# List with all available character set descriptions.
2378-charmaps := $(wildcard charmaps/[A-I]*) $(wildcard charmaps/[J-Z]*)
2379+include ../option-groups.mak
2380
2381 # List with all available character set descriptions.
2382-locales := $(wildcard locales/*)
2383+all-charmaps := $(wildcard charmaps/[A-I]*) $(wildcard charmaps/[J-Z]*)
2384+
2385+all-locales := $(wildcard locales/*)
2386
2387+# If the EGLIBC_LOCALES option group is not enabled, trim the
2388+# list of charmap and locale source files.
2389+ifeq ($(OPTION_EGLIBC_LOCALES),y)
2390+charmaps := $(all-charmaps)
2391+locales := $(all-locales)
2392+else
2393+charmaps :=
2394+locales := locales/POSIX
2395+endif
2396
2397 subdir-dirs = tests-mbwc
2398 vpath %.c tests-mbwc
2399@@ -71,14 +81,20 @@
2400 tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \
2401 tst_wctype tst_wcwidth
2402
2403-tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
2404+# Since these tests build their own locale files, they're not
2405+# dependent on the OPTION_EGLIBC_LOCALES option group. But they do
2406+# need the locale functions to be present.
2407+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
2408+ += $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
2409 tst-leaks tst-mbswcs1 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 \
2410 tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
2411 tst-strfmon1 tst-sscanf bug-setlocale1 tst-setlocale2 tst-setlocale3 \
2412 tst-wctype
2413+ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
2414 tests-static = bug-setlocale1-static
2415 tests += $(tests-static)
2416-ifeq (yes,$(build-shared))
2417+endif
2418+ifeq (yesy,$(build-shared)$(OPTION_EGLIBC_LOCALE_CODE))
2419 ifneq (no,$(PERL))
2420 tests-special += $(objpfx)mtrace-tst-leaks.out
2421 endif
2422@@ -92,12 +108,14 @@
2423
2424 tests: $(objdir)/iconvdata/gconv-modules
2425
2426+ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
2427 tests-special += $(objpfx)sort-test.out $(objpfx)tst-fmon.out \
2428 $(objpfx)tst-locale.out $(objpfx)tst-rpmatch.out \
2429 $(objpfx)tst-trans.out $(objpfx)tst-ctype.out \
2430 $(objpfx)tst-langinfo.out $(objpfx)tst-langinfo-static.out \
2431 $(objpfx)tst-numeric.out
2432 tests-static += tst-langinfo-static
2433+endif
2434
2435 ifeq ($(run-built-tests),yes)
2436 # We have to generate locales
2437@@ -143,9 +161,13 @@
2438 $(addprefix $(objpfx),$(CTYPE_FILES)): %: \
2439 gen-locale.sh $(common-objpfx)locale/localedef Makefile \
2440 $(addprefix charmaps/,$(CHARMAPS)) $(addprefix locales/,$(LOCALE_SRCS))
2441- @$(SHELL) gen-locale.sh $(common-objpfx) \
2442- '$(built-program-cmd-before-env)' '$(run-program-env)' \
2443- '$(built-program-cmd-after-env)' $@; \
2444+ @$(SHELL) gen-locale.sh $(common-objpfx) \
2445+ '$(if $(cross-localedef), \
2446+ $(cross-localedef), \
2447+ $(built-program-cmd-before-env) \
2448+ $(run-program-env) \
2449+ $(built-program-cmd-after-env))' \
2450+ $@; \
2451 $(evaluate-test)
2452
2453 $(addsuffix .out,$(addprefix $(objpfx),$(tests))): %: \
2454@@ -213,6 +235,11 @@
2455
2456 include SUPPORTED
2457
2458+# Only install locale data if OPTION_EGLIBC_LOCALES is selected.
2459+ifneq ($(OPTION_EGLIBC_LOCALES),y)
2460+SUPPORTED-LOCALES :=
2461+endif
2462+
2463 INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES))
2464
2465 # Sometimes the whole collection of locale files should be installed.
2466Index: git/login/Makefile
2467===================================================================
2468--- git.orig/login/Makefile 2014-08-29 20:00:47.736070587 -0700
2469+++ git/login/Makefile 2014-08-29 20:01:15.212070587 -0700
2470@@ -18,6 +18,7 @@
2471 #
2472 # Sub-makefile for login portion of the library.
2473 #
2474+include ../option-groups.mak
2475
2476 subdir := login
2477
2478@@ -25,14 +26,16 @@
2479
2480 headers := utmp.h bits/utmp.h lastlog.h pty.h
2481
2482-routines := getlogin getlogin_r setlogin getlogin_r_chk \
2483- getutent getutent_r getutid getutline getutid_r getutline_r \
2484- utmp_file utmpname updwtmp getpt grantpt unlockpt ptsname \
2485- ptsname_r_chk
2486+routines := getpt grantpt unlockpt ptsname ptsname_r_chk
2487+routines-$(OPTION_EGLIBC_UTMP) \
2488+ += getutent getutent_r getutid getutline getutid_r getutline_r \
2489+ utmp_file utmpname updwtmp
2490+routines-$(OPTION_EGLIBC_GETLOGIN) += getlogin getlogin_r getlogin_r_chk
2491+routines-$(OPTION_EGLIBC_BSD) += setlogin
2492
2493 CFLAGS-grantpt.c = -DLIBEXECDIR='"$(libexecdir)"'
2494
2495-others = utmpdump
2496+others-$(OPTION_EGLIBC_UTMP) += utmpdump
2497
2498 ifeq (yes,$(build-pt-chown))
2499 others += pt_chown
2500@@ -46,8 +49,8 @@
2501 tests := tst-utmp tst-utmpx tst-grantpt tst-ptsname
2502
2503 # Build the -lutil library with these extra functions.
2504-extra-libs := libutil
2505-extra-libs-others := $(extra-libs)
2506+extra-libs-$(OPTION_EGLIBC_UTMP) := libutil
2507+extra-libs-others := $(extra-libs-y)
2508
2509 libutil-routines:= login login_tty logout logwtmp openpty forkpty
2510
2511Index: git/Makeconfig
2512===================================================================
2513--- git.orig/Makeconfig 2014-08-29 20:00:42.956070587 -0700
2514+++ git/Makeconfig 2014-08-29 20:01:15.212070587 -0700
2515@@ -582,7 +582,7 @@
2516 # and run on the build system, causes that program with those
2517 # arguments to be run on the host for which the library is built.
2518 ifndef test-wrapper
2519-test-wrapper =
2520+test-wrapper = $(cross-test-wrapper)
2521 endif
2522 # Likewise, but the name of the program is preceded by
2523 # <variable>=<value> assignments for environment variables.
2524@@ -1057,6 +1057,24 @@
2525 libm = $(common-objpfx)math/libm.a
2526 endif
2527
2528+# Generate a header file that #defines preprocessor symbols indicating
2529+# which option groups are enabled. Note that the option-groups.config file
2530+# may not exist at all.
2531+before-compile += $(common-objpfx)gnu/option-groups.h
2532+common-generated += gnu/option-groups.h gnu/option-groups.stmp
2533+headers += gnu/option-groups.h
2534+$(common-objpfx)gnu/option-groups.h: $(common-objpfx)gnu/option-groups.stmp; @:
2535+$(common-objpfx)gnu/option-groups.stmp: \
2536+ $(..)scripts/option-groups.awk \
2537+ $(..)option-groups.defaults \
2538+ $(wildcard $(common-objpfx)option-groups.config)
2539+ $(make-target-directory)
2540+ @rm -f ${@:stmp=T} $@
2541+ LC_ALL=C $(AWK) -f $^ > ${@:stmp=T}
2542+ $(move-if-change) ${@:stmp=T} ${@:stmp=h}
2543+ touch $@
2544+
2545+
2546 # These are the subdirectories containing the library source. The order
2547 # is more or less arbitrary. The sorting step will take care of the
2548 # dependencies.
2549Index: git/Makerules
2550===================================================================
2551--- git.orig/Makerules 2014-08-29 20:00:42.960070587 -0700
2552+++ git/Makerules 2014-08-29 20:01:15.212070587 -0700
2553@@ -379,6 +379,25 @@
2554 endef
2555 endif
2556
2557+# Include targets in the selected option groups.
2558+aux += $(aux-y)
2559+extra-libs += $(extra-libs-y)
2560+extra-libs-others += $(extra-libs-others-y)
2561+extra-objs += $(extra-objs-y)
2562+install-bin += $(install-bin-y)
2563+install-others += $(install-others-y)
2564+install-sbin += $(install-sbin-y)
2565+modules += $(modules-y)
2566+others += $(others-y)
2567+others-pie += $(others-pie-y)
2568+routines += $(routines-y)
2569+static-only-routines += $(static-only-routines-y)
2570+sysdep_routines += $(sysdep_routines-y)
2571+test-srcs += $(test-srcs-y)
2572+tests += $(tests-y)
2573+xtests += $(xtests-y)
2574+
2575+
2576 # Modify the list of routines we build for different targets
2577
2578 ifeq (yes,$(build-shared))
2579Index: git/malloc/Makefile
2580===================================================================
2581--- git.orig/malloc/Makefile 2014-08-29 20:00:47.760070587 -0700
2582+++ git/malloc/Makefile 2014-08-29 20:01:15.212070587 -0700
2583@@ -18,6 +18,8 @@
2584 #
2585 # Makefile for malloc routines
2586 #
2587+include ../option-groups.mak
2588+
2589 subdir := malloc
2590
2591 include ../Makeconfig
2592@@ -36,9 +38,15 @@
2593 non-lib.a := libmcheck.a
2594
2595 # Additional library.
2596+ifeq ($(OPTION_EGLIBC_MEMUSAGE),y)
2597 extra-libs = libmemusage
2598 extra-libs-others = $(extra-libs)
2599
2600+ifdef OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
2601+CPPFLAGS-memusage += -D__OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE=$(OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE)
2602+endif
2603+endif
2604+
2605 libmemusage-routines = memusage
2606 libmemusage-inhibit-o = $(filter-out .os,$(object-suffixes))
2607
2608@@ -67,7 +75,7 @@
2609 # Unless we get a test for the availability of libgd which also works
2610 # for cross-compiling we disable the memusagestat generation in this
2611 # situation.
2612-ifneq ($(cross-compiling),yes)
2613+ifeq ($(cross-compiling)$(OPTION_EGLIBC_MEMUSAGE),noy)
2614 # If the gd library is available we build the `memusagestat' program.
2615 ifneq ($(LIBGD),no)
2616 others: $(objpfx)memusage
2617Index: git/malloc/memusage.c
2618===================================================================
2619--- git.orig/malloc/memusage.c 2014-08-29 20:00:47.768070587 -0700
2620+++ git/malloc/memusage.c 2014-08-29 20:01:15.212070587 -0700
2621@@ -33,6 +33,7 @@
2622 #include <stdint.h>
2623 #include <sys/mman.h>
2624 #include <sys/time.h>
2625+#include <gnu/option-groups.h>
2626
2627 #include <memusage.h>
2628
2629@@ -93,7 +94,11 @@
2630 #define peak_stack peak_use[1]
2631 #define peak_total peak_use[2]
2632
2633-#define DEFAULT_BUFFER_SIZE 32768
2634+#ifndef __OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
2635+# define DEFAULT_BUFFER_SIZE 32768
2636+#else
2637+# define DEFAULT_BUFFER_SIZE __OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
2638+#endif
2639 static size_t buffer_size;
2640
2641 static int fd = -1;
2642Index: git/malloc/memusage.sh
2643===================================================================
2644--- git.orig/malloc/memusage.sh 2014-08-29 20:00:47.768070587 -0700
2645+++ git/malloc/memusage.sh 2014-08-29 20:01:15.212070587 -0700
2646@@ -35,7 +35,7 @@
2647
2648 # Print help message
2649 do_help() {
2650- echo $"Usage: memusage [OPTION]... PROGRAM [PROGRAMOPTION]...
2651+ printf $"Usage: memusage [OPTION]... PROGRAM [PROGRAMOPTION]...
2652 Profile memory usage of PROGRAM.
2653
2654 -n,--progname=NAME Name of the program file to profile
2655Index: git/math/Makefile
2656===================================================================
2657--- git.orig/math/Makefile 2014-08-29 20:00:47.836070587 -0700
2658+++ git/math/Makefile 2014-08-29 20:01:15.212070587 -0700
2659@@ -21,6 +21,8 @@
2660
2661 include ../Makeconfig
2662
2663+include ../option-groups.mak
2664+
2665 # Installed header files.
2666 headers := math.h bits/mathcalls.h bits/mathinline.h bits/huge_val.h \
2667 bits/huge_valf.h bits/huge_vall.h bits/inf.h bits/nan.h \
2668@@ -33,8 +35,8 @@
2669
2670 # Build the -lm library.
2671
2672-extra-libs := libm
2673-extra-libs-others = $(extra-libs)
2674+extra-libs-$(OPTION_EGLIBC_LIBM) := libm
2675+extra-libs-others-$(OPTION_EGLIBC_LIBM) = $(extra-libs-$(OPTION_EGLIBC_LIBM))
2676
2677 libm-support = k_standard s_lib_version s_matherr s_signgam \
2678 fclrexcpt fgetexcptflg fraiseexcpt fsetexcptflg \
2679Index: git/misc/err.c
2680===================================================================
2681--- git.orig/misc/err.c 2014-08-29 20:00:48.232070587 -0700
2682+++ git/misc/err.c 2014-08-29 20:01:15.212070587 -0700
2683@@ -22,6 +22,7 @@
2684 #include <errno.h>
2685 #include <string.h>
2686 #include <stdio.h>
2687+#include <gnu/option-groups.h>
2688
2689 #include <wchar.h>
2690 #define flockfile(s) _IO_flockfile (s)
2691@@ -37,6 +38,7 @@
2692 va_end (ap); \
2693 }
2694
2695+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
2696 static void
2697 convert_and_print (const char *format, __gnuc_va_list ap)
2698 {
2699@@ -81,6 +83,7 @@
2700
2701 __vfwprintf (stderr, wformat, ap);
2702 }
2703+#endif
2704
2705 void
2706 vwarnx (const char *format, __gnuc_va_list ap)
2707@@ -88,9 +91,13 @@
2708 flockfile (stderr);
2709 if (_IO_fwide (stderr, 0) > 0)
2710 {
2711+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
2712 __fwprintf (stderr, L"%s: ", __progname);
2713 convert_and_print (format, ap);
2714 putwc_unlocked (L'\n', stderr);
2715+#else
2716+ abort ();
2717+#endif
2718 }
2719 else
2720 {
2721@@ -111,6 +118,7 @@
2722 flockfile (stderr);
2723 if (_IO_fwide (stderr, 0) > 0)
2724 {
2725+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
2726 __fwprintf (stderr, L"%s: ", __progname);
2727 if (format)
2728 {
2729@@ -119,6 +127,9 @@
2730 }
2731 __set_errno (error);
2732 __fwprintf (stderr, L"%m\n");
2733+#else
2734+ abort ();
2735+#endif
2736 }
2737 else
2738 {
2739Index: git/misc/error.c
2740===================================================================
2741--- git.orig/misc/error.c 2014-08-29 20:00:48.232070587 -0700
2742+++ git/misc/error.c 2014-08-29 20:01:15.212070587 -0700
2743@@ -35,6 +35,7 @@
2744 #endif
2745
2746 #ifdef _LIBC
2747+# include <gnu/option-groups.h>
2748 # include <libintl.h>
2749 # include <stdbool.h>
2750 # include <stdint.h>
2751@@ -205,6 +206,7 @@
2752 #if _LIBC
2753 if (_IO_fwide (stderr, 0) > 0)
2754 {
2755+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
2756 size_t len = strlen (message) + 1;
2757 wchar_t *wmessage = NULL;
2758 mbstate_t st;
2759@@ -265,6 +267,9 @@
2760
2761 if (use_malloc)
2762 free (wmessage);
2763+#else
2764+ abort ();
2765+#endif
2766 }
2767 else
2768 #endif
2769Index: git/misc/Makefile
2770===================================================================
2771--- git.orig/misc/Makefile 2014-08-29 20:00:48.232070587 -0700
2772+++ git/misc/Makefile 2014-08-29 20:01:15.212070587 -0700
2773@@ -19,6 +19,10 @@
2774 # Sub-makefile for misc portion of the library.
2775 #
2776
2777+# Some system-dependent implementations of these functions use option
2778+# groups (see sysdeps/unix/sysv/linux/Makefile, for example).
2779+include ../option-groups.mak
2780+
2781 subdir := misc
2782
2783 include ../Makeconfig
2784@@ -46,40 +50,47 @@
2785 select pselect \
2786 acct chroot fsync sync fdatasync syncfs reboot \
2787 gethostid sethostid \
2788- revoke vhangup \
2789+ vhangup \
2790 swapon swapoff mktemp mkstemp mkstemp64 mkdtemp \
2791 mkostemp mkostemp64 mkstemps mkstemps64 mkostemps mkostemps64 \
2792 ualarm usleep \
2793 gtty stty \
2794 ptrace \
2795- fstab mntent mntent_r \
2796+ mntent mntent_r \
2797 utimes lutimes futimes futimesat \
2798 truncate ftruncate truncate64 ftruncate64 \
2799- chflags fchflags \
2800 insremque getttyent getusershell getpass ttyslot \
2801 syslog syscall daemon \
2802 mmap mmap64 munmap mprotect msync madvise mincore remap_file_pages\
2803 mlock munlock mlockall munlockall \
2804- efgcvt efgcvt_r qefgcvt qefgcvt_r \
2805 hsearch hsearch_r tsearch lsearch \
2806 err error ustat \
2807- getsysstats dirname regexp \
2808+ getsysstats dirname \
2809 getloadavg getclktck \
2810 fgetxattr flistxattr fremovexattr fsetxattr getxattr \
2811 listxattr lgetxattr llistxattr lremovexattr lsetxattr \
2812 removexattr setxattr getauxval ifunc-impl-list
2813
2814+routines-$(OPTION_POSIX_REGEXP) += regexp
2815+routines-$(OPTION_EGLIBC_FSTAB) += fstab
2816+routines-$(OPTION_EGLIBC_BSD) += chflags fchflags revoke
2817+routines-$(OPTION_EGLIBC_FCVT) += efgcvt efgcvt_r qefgcvt qefgcvt_r
2818+
2819 generated += tst-error1.mtrace tst-error1-mem.out
2820
2821 aux := init-misc
2822 install-lib := libg.a
2823 gpl2lgpl := error.c error.h
2824
2825-tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
2826- tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1
2827+tests := tst-dirname tst-tsearch tst-fdset tst-mntent tst-hsearch \
2828+ tst-pselect tst-insremque tst-mntent2 bug-hsearch1
2829+tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) += tst-error1
2830+tests-$(OPTION_EGLIBC_FCVT) += tst-efgcvt
2831 ifeq ($(run-built-tests),yes)
2832+ifeq (y,$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO))
2833 tests-special += $(objpfx)tst-error1-mem.out
2834 endif
2835+endif
2836
2837 CFLAGS-select.c = -fexceptions -fasynchronous-unwind-tables
2838 CFLAGS-tsearch.c = $(uses-callbacks)
2839Index: git/misc/sys/xattr.h
2840===================================================================
2841--- git.orig/misc/sys/xattr.h 2014-08-29 20:00:52.644070587 -0700
2842+++ git/misc/sys/xattr.h 2014-08-29 20:01:15.216070587 -0700
2843@@ -26,7 +26,6 @@
2844
2845 /* The following constants should be used for the fifth parameter of
2846 `*setxattr'. */
2847-#ifndef __USE_KERNEL_XATTR_DEFS
2848 enum
2849 {
2850 XATTR_CREATE = 1, /* set value, fail if attr already exists. */
2851@@ -34,7 +33,6 @@
2852 XATTR_REPLACE = 2 /* set value, fail if attr does not exist. */
2853 #define XATTR_REPLACE XATTR_REPLACE
2854 };
2855-#endif
2856
2857 /* Set the attribute NAME of the file pointed to by PATH to VALUE (which
2858 is SIZE bytes long). Return 0 on success, -1 for errors. */
2859Index: git/misc/tst-efgcvt.c
2860===================================================================
2861--- git.orig/misc/tst-efgcvt.c 2014-08-29 20:00:52.652070587 -0700
2862+++ git/misc/tst-efgcvt.c 2014-08-29 20:01:15.216070587 -0700
2863@@ -59,7 +59,7 @@
2864 { 123.01, -4, 3, "" },
2865 { 126.71, -4, 3, "" },
2866 { 0.0, 4, 1, "0000" },
2867-#if DBL_MANT_DIG == 53
2868+#if DBL_MANT_DIG == 53 && !(defined __powerpc__ && defined __NO_FPRS__ && !defined _SOFT_FLOAT && !defined _SOFT_DOUBLE)
2869 { 0x1p-1074, 3, -323, "494" },
2870 { -0x1p-1074, 3, -323, "494" },
2871 #endif
2872Index: git/nis/Makefile
2873===================================================================
2874--- git.orig/nis/Makefile 2014-08-29 20:00:52.660070587 -0700
2875+++ git/nis/Makefile 2014-08-29 20:01:15.216070587 -0700
2876@@ -18,6 +18,8 @@
2877 #
2878 # Makefile for NIS/NIS+ part.
2879 #
2880+include ../option-groups.mak
2881+
2882 subdir := nis
2883
2884 include ../Makeconfig
2885@@ -30,19 +32,26 @@
2886
2887 # These are the databases available for the nis (and perhaps later nisplus)
2888 # service. This must be a superset of the services in nss.
2889-databases = proto service hosts network grp pwd rpc ethers \
2890- spwd netgrp alias publickey
2891+databases-y := proto service hosts network grp pwd rpc ethers \
2892+ spwd netgrp publickey
2893+databases-$(OPTION_EGLIBC_DB_ALIASES) += alias
2894
2895 # Specify rules for the nss_* modules.
2896-services := nis nisplus compat
2897+# The 'compat' module includes nis support, and the 'nss' directory
2898+# includes a bare-bones "files" library, so we'll include 'compat' in
2899+# OPTION_EGLIBC_NIS.
2900+services-y :=
2901+services-$(OPTION_EGLIBC_NIS) += nis nisplus compat
2902+
2903+extra-libs-$(OPTION_EGLIBC_NIS) += libnsl
2904+extra-libs-y += $(services-y:%=libnss_%)
2905
2906-extra-libs = libnsl $(services:%=libnss_%)
2907 # These libraries will be built in the `others' pass rather than
2908 # the `lib' pass, because they depend on libc.so being built already.
2909-extra-libs-others = $(extra-libs)
2910+extra-libs-others-y += $(extra-libs-y)
2911
2912 # The sources are found in the appropriate subdir.
2913-subdir-dirs = $(services:%=nss_%)
2914+subdir-dirs = $(services-y:%=nss_%)
2915 vpath %.c $(subdir-dirs)
2916
2917 libnsl-routines = yp_xdr ypclnt ypupdate_xdr \
2918@@ -60,11 +69,11 @@
2919 libnss_compat-routines := $(addprefix compat-,grp pwd spwd initgroups)
2920 libnss_compat-inhibit-o = $(filter-out .os,$(object-suffixes))
2921
2922-libnss_nis-routines := $(addprefix nis-,$(databases)) nis-initgroups \
2923+libnss_nis-routines := $(addprefix nis-,$(databases-y)) nis-initgroups \
2924 nss-nis
2925 libnss_nis-inhibit-o = $(filter-out .os,$(object-suffixes))
2926
2927-libnss_nisplus-routines := $(addprefix nisplus-,$(databases)) nisplus-parser \
2928+libnss_nisplus-routines := $(addprefix nisplus-,$(databases-y)) nisplus-parser \
2929 nss-nisplus nisplus-initgroups
2930 libnss_nisplus-inhibit-o = $(filter-out .os,$(object-suffixes))
2931
2932@@ -80,12 +89,12 @@
2933 # Target-specific variable setting to link objects using deprecated
2934 # RPC interfaces with the version of libc.so that makes them available
2935 # for new links:
2936-$(services:%=$(objpfx)libnss_%.so) $(objpfx)libnsl.so: \
2937+$(services-y:%=$(objpfx)libnss_%.so) $(objpfx)libnsl.so: \
2938 libc-for-link = $(libnsl-libc)
2939
2940
2941 ifeq ($(build-shared),yes)
2942-$(others:%=$(objpfx)%): $(objpfx)libnsl.so$(libnsl.so-version)
2943+$(others-y:%=$(objpfx)%): $(objpfx)libnsl.so$(libnsl.so-version)
2944 else
2945-$(others:%=$(objpfx)%): $(objpfx)libnsl.a
2946+$(others-y:%=$(objpfx)%): $(objpfx)libnsl.a
2947 endif
2948Index: git/nptl/Makefile
2949===================================================================
2950--- git.orig/nptl/Makefile 2014-08-29 20:00:52.704070587 -0700
2951+++ git/nptl/Makefile 2014-08-29 20:01:15.216070587 -0700
2952@@ -18,6 +18,8 @@
2953 #
2954 # Sub-makefile for NPTL portion of the library.
2955 #
2956+include ../option-groups.mak
2957+
2958 subdir := nptl
2959
2960 include ../Makeconfig
2961@@ -116,7 +118,7 @@
2962 pt-raise pt-system \
2963 flockfile ftrylockfile funlockfile \
2964 sigaction \
2965- herrno res pt-allocrtsig \
2966+ pt-allocrtsig \
2967 pthread_kill_other_threads \
2968 pthread_getaffinity pthread_setaffinity \
2969 pthread_attr_getaffinity pthread_attr_setaffinity \
2970@@ -136,6 +138,8 @@
2971 # pthread_setgid pthread_setegid pthread_setregid \
2972 # pthread_setresgid
2973
2974+libpthread-routines-$(OPTION_EGLIBC_INET) := herrno res
2975+
2976 libpthread-shared-only-routines = version pt-allocrtsig unwind-forcedunwind
2977 libpthread-static-only-routines = pthread_atfork
2978
2979@@ -210,7 +214,7 @@
2980 tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 tst-mutexpi5 \
2981 tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a tst-mutexpi8 \
2982 tst-mutexpi9 \
2983- tst-spin1 tst-spin2 tst-spin3 tst-spin4 \
2984+ tst-spin1 tst-spin2 tst-spin3 \
2985 tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 \
2986 tst-cond8 tst-cond9 tst-cond10 tst-cond11 tst-cond12 tst-cond13 \
2987 tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18 tst-cond19 \
2988@@ -244,14 +248,14 @@
2989 tst-cancel6 tst-cancel7 tst-cancel8 tst-cancel9 tst-cancel10 \
2990 tst-cancel11 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 \
2991 tst-cancel16 tst-cancel17 tst-cancel18 tst-cancel19 tst-cancel20 \
2992- tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel24 tst-cancel25 \
2993+ tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel25 \
2994 tst-cancel-self tst-cancel-self-cancelstate \
2995 tst-cancel-self-canceltype tst-cancel-self-testcancel \
2996 tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \
2997 tst-flock1 tst-flock2 \
2998 tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \
2999 tst-signal6 tst-signal7 \
3000- tst-exec1 tst-exec2 tst-exec3 tst-exec4 \
3001+ tst-exec2 tst-exec3 tst-exec4 \
3002 tst-exit1 tst-exit2 tst-exit3 \
3003 tst-stdio1 tst-stdio2 \
3004 tst-stack1 tst-stack2 tst-stack3 tst-pthread-getattr \
3005@@ -259,13 +263,12 @@
3006 tst-unload \
3007 tst-dlsym1 \
3008 tst-sysconf \
3009- tst-locale1 tst-locale2 \
3010+ tst-locale2 \
3011 tst-umask1 \
3012 tst-popen1 \
3013 tst-clock1 \
3014 tst-context1 \
3015 tst-sched1 \
3016- tst-backtrace1 \
3017 tst-abstime \
3018 tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x \
3019 tst-getpid1 tst-getpid2 tst-getpid3 \
3020@@ -275,6 +278,17 @@
3021 tst-mutexpp1 tst-mutexpp6 tst-mutexpp10
3022 test-srcs = tst-oddstacklimit
3023
3024+# This test uses the posix_spawn functions.
3025+tests-$(OPTION_EGLIBC_SPAWN) += tst-exec1
3026+
3027+# This test uses the 'backtrace' functions.
3028+tests-$(OPTION_EGLIBC_BACKTRACE) += tst-backtrace1
3029+
3030+# This test is written in C++.
3031+tests-$(OPTION_EGLIBC_CXX_TESTS) += tst-cancel24
3032+
3033+tests-$(OPTION_EGLIBC_LOCALE_CODE) += tst-locale1
3034+
3035 # Files which must not be linked with libpthread.
3036 tests-nolibpthread = tst-unload
3037
3038Index: git/nptl/pthread_create.c
3039===================================================================
3040--- git.orig/nptl/pthread_create.c 2014-08-29 20:00:52.764070587 -0700
3041+++ git/nptl/pthread_create.c 2014-08-29 20:01:15.216070587 -0700
3042@@ -31,6 +31,7 @@
3043 #include <kernel-features.h>
3044 #include <exit-thread.h>
3045
3046+#include <gnu/option-groups.h>
3047 #include <shlib-compat.h>
3048
3049 #include <stap-probe.h>
3050@@ -240,8 +241,10 @@
3051 THREAD_SETMEM (pd, cpuclock_offset, now);
3052 #endif
3053
3054+#if __OPTION_EGLIBC_INET
3055 /* Initialize resolver state pointer. */
3056 __resp = &pd->res;
3057+#endif
3058
3059 /* Initialize pointers to locale data. */
3060 __ctype_init ();
3061@@ -322,8 +325,10 @@
3062 /* Run the destructor for the thread-local data. */
3063 __nptl_deallocate_tsd ();
3064
3065+#if __OPTION_EGLIBC_INET
3066 /* Clean up any state libc stored in thread-local variables. */
3067 __libc_thread_freeres ();
3068+#endif
3069
3070 /* If this is the last thread we terminate the process now. We
3071 do not notify the debugger, it might just irritate it if there
3072Index: git/nscd/Makefile
3073===================================================================
3074--- git.orig/nscd/Makefile 2014-08-29 20:00:52.948070587 -0700
3075+++ git/nscd/Makefile 2014-08-29 20:01:15.216070587 -0700
3076@@ -18,14 +18,17 @@
3077 #
3078 # Sub-makefile for nscd portion of the library.
3079 #
3080+include ../option-groups.mak
3081+
3082 subdir := nscd
3083
3084 include ../Makeconfig
3085
3086 ifneq ($(use-nscd),no)
3087-routines := nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai \
3088+routines-$(OPTION_EGLIBC_INET) += \
3089+ nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai \
3090 nscd_initgroups nscd_getserv_r nscd_netgroup
3091-aux := nscd_helper
3092+aux-$(OPTION_EGLIBC_INET) += nscd_helper
3093 endif
3094
3095 # To find xmalloc.c
3096@@ -37,14 +40,18 @@
3097 dbg_log nscd_conf nscd_stat cache mem nscd_setup_thread \
3098 xmalloc xstrdup aicache initgrcache gai res_hconf \
3099 netgroupcache
3100-
3101+ifneq (y,$(OPTION_EGLIBC_NIS))
3102+# If we haven't build libnsl.so, then we'll need to include our
3103+# own copy of nis_hash.
3104+nscd-modules += nis_hash
3105+endif
3106 ifeq ($(build-nscd)$(have-thread-library),yesyes)
3107
3108-others += nscd
3109-others-pie += nscd
3110-install-sbin := nscd
3111+others-$(OPTION_EGLIBC_INET) += nscd
3112+others-pie-$(OPTION_EGLIBC_INET) += nscd
3113+install-sbin-$(OPTION_EGLIBC_INET) += nscd
3114
3115-extra-objs = $(nscd-modules:=.o)
3116+extra-objs-$(OPTION_EGLIBC_INET) += $(nscd-modules:=.o)
3117
3118 endif
3119
3120@@ -101,7 +108,15 @@
3121 $(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o)
3122
3123 ifeq ($(build-shared),yes)
3124-$(objpfx)nscd: $(shared-thread-library) $(common-objpfx)nis/libnsl.so
3125+$(objpfx)nscd: $(shared-thread-library)
3126+else
3127+$(objpfx)nscd: $(static-thread-library)
3128+endif
3129+
3130+ifeq (y,$(OPTION_EGLIBC_NIS))
3131+ifeq ($(build-shared),yes)
3132+$(objpfx)nscd: $(common-objpfx)nis/libnsl.so
3133 else
3134-$(objpfx)nscd: $(static-thread-library) $(common-objpfx)nis/libnsl.a
3135+$(objpfx)nscd: $(common-objpfx)nis/libnsl.a
3136+endif
3137 endif
3138Index: git/nscd/nis_hash.c
3139===================================================================
3140--- /dev/null 1970-01-01 00:00:00.000000000 +0000
3141+++ git/nscd/nis_hash.c 2014-08-29 20:01:15.216070587 -0700
3142@@ -0,0 +1,3 @@
3143+/* If OPTION_EGLIBC_NIS is disabled, nscd can't get this from libnsl.so;
3144+ we need our own copy. */
3145+#include "../nis/nis_hash.c"
3146Index: git/nss/fixed-nsswitch.conf
3147===================================================================
3148--- /dev/null 1970-01-01 00:00:00.000000000 +0000
3149+++ git/nss/fixed-nsswitch.conf 2014-08-29 20:01:15.216070587 -0700
3150@@ -0,0 +1,22 @@
3151+# /etc/nsswitch.conf
3152+#
3153+# Example configuration for fixed name service.
3154+# See the description of OPTION_EGLIBC_NSSWITCH in option-groups.def
3155+# for details.
3156+#
3157+
3158+aliases: files
3159+
3160+passwd: files
3161+group: files
3162+shadow: files
3163+
3164+hosts: files dns
3165+networks: files dns
3166+
3167+protocols: files
3168+services: files
3169+ethers: files
3170+rpc: files
3171+
3172+netgroup: files
3173Index: git/nss/fixed-nsswitch.functions
3174===================================================================
3175--- /dev/null 1970-01-01 00:00:00.000000000 +0000
3176+++ git/nss/fixed-nsswitch.functions 2014-08-29 20:01:15.216070587 -0700
3177@@ -0,0 +1,121 @@
3178+/* List of functions defined for fixed NSS in GNU C Library.
3179+ Copyright (C) 1996, 1997, 1998, 2005 Free Software Foundation, Inc.
3180+ This file is part of the GNU C Library.
3181+
3182+ The GNU C Library is free software; you can redistribute it and/or
3183+ modify it under the terms of the GNU Lesser General Public
3184+ License as published by the Free Software Foundation; either
3185+ version 2.1 of the License, or (at your option) any later version.
3186+
3187+ The GNU C Library is distributed in the hope that it will be useful,
3188+ but WITHOUT ANY WARRANTY; without even the implied warranty of
3189+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3190+ Lesser General Public License for more details.
3191+
3192+ You should have received a copy of the GNU Lesser General Public
3193+ License along with the GNU C Library; if not, write to the Free
3194+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3195+ 02111-1307 USA. */
3196+
3197+/* When OPTION_EGLIBC_NSSWITCH is disabled (see option-groups.def),
3198+ EGLIBC does not use the 'dlopen' and 'dlsym' functions to look for
3199+ database query functions in the individual name service libraries.
3200+ Instead, it uses a set of functions chosen at compile time, as
3201+ directed by the OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS file. This
3202+ file is a sample of what you might use there.
3203+
3204+ This file is C source code; it should only contain invocations of
3205+ the following macros:
3206+
3207+ - DEFINE_ENT (DATABASE, SERVICE, X)
3208+
3209+ Declare the 'setXent', 'getXent_r', and 'endXent' functions that
3210+ query DATABASE using the service library 'libnss_SERVICE.so.2'.
3211+ DATABASE should be the full name of the database as it appears in
3212+ 'nsswitch.conf', like 'passwd' or 'aliases'.
3213+
3214+ (The non-reentrant 'getXent' functions are implemented in terms
3215+ of the reentrant 'getXent_r' functions, so there is no need to
3216+ refer to them explicitly here.)
3217+
3218+ - DEFINE_GETBY (DATABASE, SERVICE, X, KEY)
3219+
3220+ Declare the 'getXbyKEY_r' functions that query DATABASE using
3221+ SERVICE. DATABASE and SERVICE are as described above.
3222+
3223+ (The non-reentrant 'getXbyKEY' functions are implemented in terms
3224+ of the reentrant 'getXbyKEY_r' functions, so there is no need to
3225+ refer to them explicitly here.)
3226+
3227+ Use the special key 'name3' for the service library function that
3228+ implements the 'getaddrinfo' function.
3229+
3230+ - DEFINE_GET (DATABASE, SERVICE, QUERY)
3231+
3232+ Declare the 'getQUERY_r' functions that query DATABASE using
3233+ SERVICE. This is used for functions like 'getpwnam'.
3234+
3235+ (The non-reentrant 'getQUERY' functions are implemented in terms
3236+ of the reentrant 'getQUERY_r' functions, so there is no need to
3237+ refer to them explicitly here.)
3238+
3239+ This sample file only includes functions that consult the files in
3240+ '/etc', and the Domain Name System (DNS). */
3241+
3242+/* aliases */
3243+DEFINE_ENT (aliases, files, alias)
3244+DEFINE_GETBY (aliases, files, alias, name)
3245+
3246+/* ethers */
3247+DEFINE_ENT (ethers, files, ether)
3248+
3249+/* group */
3250+DEFINE_ENT (group, files, gr)
3251+DEFINE_GET (group, files, grgid)
3252+DEFINE_GET (group, files, grnam)
3253+
3254+/* hosts */
3255+DEFINE_ENT (hosts, files, host)
3256+DEFINE_GETBY (hosts, files, host, addr)
3257+DEFINE_GETBY (hosts, files, host, name)
3258+DEFINE_GETBY (hosts, files, host, name2)
3259+DEFINE_GET (hosts, files, hostton)
3260+DEFINE_GET (hosts, files, ntohost)
3261+DEFINE_GETBY (hosts, dns, host, addr)
3262+DEFINE_GETBY (hosts, dns, host, name)
3263+DEFINE_GETBY (hosts, dns, host, name2)
3264+DEFINE_GETBY (hosts, dns, host, name3)
3265+
3266+/* netgroup */
3267+DEFINE_ENT (netgroup, files, netgr)
3268+
3269+/* networks */
3270+DEFINE_ENT (networks, files, net)
3271+DEFINE_GETBY (networks, files, net, name)
3272+DEFINE_GETBY (networks, files, net, addr)
3273+DEFINE_GETBY (networks, dns, net, name)
3274+DEFINE_GETBY (networks, dns, net, addr)
3275+
3276+/* protocols */
3277+DEFINE_ENT (protocols, files, proto)
3278+DEFINE_GETBY (protocols, files, proto, name)
3279+DEFINE_GETBY (protocols, files, proto, number)
3280+
3281+/* passwd */
3282+DEFINE_ENT (passwd, files, pw)
3283+DEFINE_GET (passwd, files, pwnam)
3284+DEFINE_GET (passwd, files, pwuid)
3285+
3286+/* rpc */
3287+DEFINE_ENT (rpc, files, rpc)
3288+DEFINE_GETBY (rpc, files, rpc, name)
3289+DEFINE_GETBY (rpc, files, rpc, number)
3290+
3291+/* services */
3292+DEFINE_ENT (services, files, serv)
3293+DEFINE_GETBY (services, files, serv, name)
3294+DEFINE_GETBY (services, files, serv, port)
3295+
3296+/* shadow */
3297+DEFINE_ENT (shadow, files, sp)
3298+DEFINE_GET (shadow, files, spnam)
3299Index: git/nss/gen-fixed-nsswitch.c
3300===================================================================
3301--- /dev/null 1970-01-01 00:00:00.000000000 +0000
3302+++ git/nss/gen-fixed-nsswitch.c 2014-08-29 20:01:15.216070587 -0700
3303@@ -0,0 +1,803 @@
3304+/* gen-fixed-nsswitch.c --- generate fixed name service data structures
3305+ Copyright (C) 1996-1999, 2001-2006, 2007 Free Software Foundation, Inc.
3306+ This file is part of the GNU C Library.
3307+
3308+ The GNU C Library is free software; you can redistribute it and/or
3309+ modify it under the terms of the GNU Lesser General Public
3310+ License as published by the Free Software Foundation; either
3311+ version 2.1 of the License, or (at your option) any later version.
3312+
3313+ The GNU C Library is distributed in the hope that it will be useful,
3314+ but WITHOUT ANY WARRANTY; without even the implied warranty of
3315+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3316+ Lesser General Public License for more details.
3317+
3318+ You should have received a copy of the GNU Lesser General Public
3319+ License along with the GNU C Library; if not, write to the Free
3320+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3321+ 02111-1307 USA. */
3322+
3323+#define _GNU_SOURCE
3324+
3325+#include <stdlib.h>
3326+#include <stdio.h>
3327+#include <errno.h>
3328+#include <string.h>
3329+#include <stdarg.h>
3330+#include <assert.h>
3331+#include <ctype.h>
3332+
3333+#include "gnu/lib-names.h"
3334+#include "nss.h"
3335+
3336+/* Provide a fallback definition to allow this file to be compiled outside
3337+ libc. */
3338+#ifndef internal_function
3339+# define internal_function
3340+#endif
3341+
3342+
3343+/* Simple utilities. */
3344+
3345+void __attribute__ ((noreturn))
3346+error (const char *message)
3347+{
3348+ fprintf (stderr, "%s\n", message);
3349+ exit (1);
3350+}
3351+
3352+
3353+void *
3354+check_alloc (void *p)
3355+{
3356+ if (p)
3357+ return p;
3358+ else
3359+ error ("out of memory");
3360+}
3361+
3362+void *
3363+xmalloc (size_t size)
3364+{
3365+ return check_alloc (malloc (size));
3366+}
3367+
3368+
3369+/* Format ARGS according to FORMAT, and return the result as a
3370+ malloc'ed string. */
3371+char *
3372+saprintf (const char *format, ...)
3373+{
3374+ va_list args;
3375+ size_t len;
3376+ char *buf;
3377+
3378+ va_start (args, format);
3379+ len = vsnprintf (NULL, 0, format, args);
3380+ va_end (args);
3381+
3382+ buf = xmalloc (len + 1);
3383+ va_start (args, format);
3384+ assert (len == vsnprintf (buf, len + 1, format, args));
3385+ va_end (args);
3386+
3387+ return buf;
3388+}
3389+
3390+
3391+
3392+/* Data structures representing the configuration file in memory. */
3393+
3394+/* These are copied from nsswitch.h.
3395+
3396+ We could simply #include that file, but this program runs on the
3397+ build machine and links against the build machine's libraries,
3398+ whereas that header is meant for use by target code; it uses
3399+ 'libc_hidden_proto', 'internal_function', and related hair. Since
3400+ we've copied the parsing code, we might as well copy the data
3401+ structure definitions as well. */
3402+
3403+/* Actions performed after lookup finished. */
3404+typedef enum
3405+{
3406+ NSS_ACTION_CONTINUE,
3407+ NSS_ACTION_RETURN
3408+} lookup_actions;
3409+
3410+
3411+typedef struct service_library
3412+{
3413+ /* Name of service (`files', `dns', `nis', ...). */
3414+ const char *name;
3415+ /* Pointer to the loaded shared library. */
3416+ void *lib_handle;
3417+ /* And the link to the next entry. */
3418+ struct service_library *next;
3419+} service_library;
3420+
3421+
3422+/* For mapping a function name to a function pointer. It is known in
3423+ nsswitch.c:nss_lookup_function that a string pointer for the lookup key
3424+ is the first member. */
3425+typedef struct
3426+{
3427+ const char *fct_name;
3428+ void *fct_ptr;
3429+} known_function;
3430+
3431+
3432+typedef struct service_user
3433+{
3434+ /* And the link to the next entry. */
3435+ struct service_user *next;
3436+ /* Action according to result. */
3437+ lookup_actions actions[5];
3438+ /* Link to the underlying library object. */
3439+ service_library *library;
3440+ /* Collection of known functions.
3441+
3442+ With OPTION_EGLIBC_NSSWITCH enabled, this is the root of a
3443+ 'tsearch'-style tree.
3444+
3445+ With OPTION_EGLIBC_NSSWITCH disabled, this is an array of
3446+ pointers to known_function structures, NULL-terminated. */
3447+ union
3448+ {
3449+ void *tree;
3450+ const known_function **array;
3451+ } known;
3452+ /* Name of the service (`files', `dns', `nis', ...). */
3453+ const char *name;
3454+} service_user;
3455+
3456+/* To access the action based on the status value use this macro. */
3457+#define nss_next_action(ni, status) ((ni)->actions[2 + status])
3458+
3459+
3460+typedef struct name_database_entry
3461+{
3462+ /* And the link to the next entry. */
3463+ struct name_database_entry *next;
3464+ /* List of service to be used. */
3465+ service_user *service;
3466+ /* Name of the database. */
3467+ const char *name;
3468+} name_database_entry;
3469+
3470+
3471+typedef struct name_database
3472+{
3473+ /* List of all known databases. */
3474+ name_database_entry *entry;
3475+ /* List of libraries with service implementation. */
3476+ service_library *library;
3477+} name_database;
3478+
3479+
3480+
3481+/* Gathering the contents of the FIXED_FUNCTIONS file. */
3482+
3483+/* It should be possible to generate this list automatically by
3484+ looking at the services and databases used in the nsswitch.conf
3485+ file, and having a hard-coded set of queries supported on each
3486+ database. */
3487+
3488+/* We #include the FIXED_FUNCTIONS file several times to build an
3489+ array of function structures holding its data. */
3490+enum function_kind {
3491+ fk_end = 0, /* Last entry. */
3492+ fk_setent, /* Like setpwent. */
3493+ fk_getent, /* Like getpwent. */
3494+ fk_endent, /* Like endpwent. */
3495+ fk_getby, /* Like gethostbyname. */
3496+ fk_get /* Like getpwnam. */
3497+};
3498+
3499+
3500+struct function {
3501+ /* What kind of function this is. */
3502+ enum function_kind kind;
3503+
3504+ /* The database and service of the function being hardwired in. */
3505+ char *database, *service;
3506+
3507+ /* The kind of entry being queried, for 'fk_setent', 'fk_getent',
3508+ 'fk_endent', and 'fk_getby' functions. */
3509+ char *entry;
3510+
3511+ /* The key, for 'fk_getby' entries. */
3512+ char *key;
3513+
3514+ /* The value and key, for 'fk_get' entries. */
3515+ char *value_and_key;
3516+};
3517+
3518+
3519+const struct function functions[] =
3520+ {
3521+
3522+#define DEFINE_ENT(database, service, entry) \
3523+ { fk_setent, #database, #service, #entry }, \
3524+ { fk_getent, #database, #service, #entry }, \
3525+ { fk_endent, #database, #service, #entry },
3526+#define DEFINE_GETBY(database, service, entry, key) \
3527+ { fk_getby, #database, #service, #entry, #key },
3528+#define DEFINE_GET(database, service, value_and_key) \
3529+ { fk_get, #database, #service, NULL, NULL, #value_and_key },
3530+
3531+#include FIXED_FUNCTIONS
3532+
3533+#undef DEFINE_ENT
3534+#undef DEFINE_GETBY
3535+#undef DEFINE_GET
3536+
3537+ { fk_end }
3538+ };
3539+
3540+
3541+/* Parsing the config file. Functions copied from nsswitch.c. */
3542+
3543+#define __strchrnul strchrnul
3544+#define __getline getline
3545+#define __strncasecmp strncasecmp
3546+
3547+/* Prototypes for the local functions. */
3548+static name_database *nss_parse_file (const char *fname) internal_function;
3549+static name_database_entry *nss_getline (char *line) internal_function;
3550+static service_user *nss_parse_service_list (const char *line)
3551+ internal_function;
3552+
3553+static name_database *
3554+internal_function
3555+nss_parse_file (const char *fname)
3556+{
3557+ FILE *fp;
3558+ name_database *result;
3559+ name_database_entry *last;
3560+ char *line;
3561+ size_t len;
3562+
3563+ /* Open the configuration file. */
3564+ fp = fopen (fname, "rc");
3565+ if (fp == NULL)
3566+ return NULL;
3567+
3568+ // /* No threads use this stream. */
3569+ // __fsetlocking (fp, FSETLOCKING_BYCALLER);
3570+
3571+ result = (name_database *) xmalloc (sizeof (name_database));
3572+
3573+ result->entry = NULL;
3574+ result->library = NULL;
3575+ last = NULL;
3576+ line = NULL;
3577+ len = 0;
3578+ do
3579+ {
3580+ name_database_entry *this;
3581+ ssize_t n;
3582+
3583+ n = __getline (&line, &len, fp);
3584+ if (n < 0)
3585+ break;
3586+ if (line[n - 1] == '\n')
3587+ line[n - 1] = '\0';
3588+
3589+ /* Because the file format does not know any form of quoting we
3590+ can search forward for the next '#' character and if found
3591+ make it terminating the line. */
3592+ *__strchrnul (line, '#') = '\0';
3593+
3594+ /* If the line is blank it is ignored. */
3595+ if (line[0] == '\0')
3596+ continue;
3597+
3598+ /* Each line completely specifies the actions for a database. */
3599+ this = nss_getline (line);
3600+ if (this != NULL)
3601+ {
3602+ if (last != NULL)
3603+ last->next = this;
3604+ else
3605+ result->entry = this;
3606+
3607+ last = this;
3608+ }
3609+ }
3610+ while (!feof_unlocked (fp));
3611+
3612+ /* Free the buffer. */
3613+ free (line);
3614+ /* Close configuration file. */
3615+ fclose (fp);
3616+
3617+ return result;
3618+}
3619+
3620+
3621+/* Read the source names:
3622+ `( <source> ( "[" "!"? (<status> "=" <action> )+ "]" )? )*'
3623+ */
3624+static service_user *
3625+internal_function
3626+nss_parse_service_list (const char *line)
3627+{
3628+ service_user *result = NULL, **nextp = &result;
3629+
3630+ while (1)
3631+ {
3632+ service_user *new_service;
3633+ const char *name;
3634+
3635+ while (isspace (line[0]))
3636+ ++line;
3637+ if (line[0] == '\0')
3638+ /* No source specified. */
3639+ return result;
3640+
3641+ /* Read <source> identifier. */
3642+ name = line;
3643+ while (line[0] != '\0' && !isspace (line[0]) && line[0] != '[')
3644+ ++line;
3645+ if (name == line)
3646+ return result;
3647+
3648+
3649+ new_service = (service_user *) xmalloc (sizeof (*new_service));
3650+ new_service->name = (char *) xmalloc (line - name + 1);
3651+
3652+ *((char *) __mempcpy ((char *) new_service->name, name, line - name))
3653+ = '\0';
3654+
3655+ /* Set default actions. */
3656+ new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE;
3657+ new_service->actions[2 + NSS_STATUS_UNAVAIL] = NSS_ACTION_CONTINUE;
3658+ new_service->actions[2 + NSS_STATUS_NOTFOUND] = NSS_ACTION_CONTINUE;
3659+ new_service->actions[2 + NSS_STATUS_SUCCESS] = NSS_ACTION_RETURN;
3660+ new_service->actions[2 + NSS_STATUS_RETURN] = NSS_ACTION_RETURN;
3661+ new_service->library = NULL;
3662+ new_service->known.tree = NULL;
3663+ new_service->next = NULL;
3664+
3665+ while (isspace (line[0]))
3666+ ++line;
3667+
3668+ if (line[0] == '[')
3669+ {
3670+ /* Read criterions. */
3671+ do
3672+ ++line;
3673+ while (line[0] != '\0' && isspace (line[0]));
3674+
3675+ do
3676+ {
3677+ int not;
3678+ enum nss_status status;
3679+ lookup_actions action;
3680+
3681+ /* Grok ! before name to mean all statii but that one. */
3682+ not = line[0] == '!';
3683+ if (not)
3684+ ++line;
3685+
3686+ /* Read status name. */
3687+ name = line;
3688+ while (line[0] != '\0' && !isspace (line[0]) && line[0] != '='
3689+ && line[0] != ']')
3690+ ++line;
3691+
3692+ /* Compare with known statii. */
3693+ if (line - name == 7)
3694+ {
3695+ if (__strncasecmp (name, "SUCCESS", 7) == 0)
3696+ status = NSS_STATUS_SUCCESS;
3697+ else if (__strncasecmp (name, "UNAVAIL", 7) == 0)
3698+ status = NSS_STATUS_UNAVAIL;
3699+ else
3700+ return result;
3701+ }
3702+ else if (line - name == 8)
3703+ {
3704+ if (__strncasecmp (name, "NOTFOUND", 8) == 0)
3705+ status = NSS_STATUS_NOTFOUND;
3706+ else if (__strncasecmp (name, "TRYAGAIN", 8) == 0)
3707+ status = NSS_STATUS_TRYAGAIN;
3708+ else
3709+ return result;
3710+ }
3711+ else
3712+ return result;
3713+
3714+ while (isspace (line[0]))
3715+ ++line;
3716+ if (line[0] != '=')
3717+ return result;
3718+ do
3719+ ++line;
3720+ while (isspace (line[0]));
3721+
3722+ name = line;
3723+ while (line[0] != '\0' && !isspace (line[0]) && line[0] != '='
3724+ && line[0] != ']')
3725+ ++line;
3726+
3727+ if (line - name == 6 && __strncasecmp (name, "RETURN", 6) == 0)
3728+ action = NSS_ACTION_RETURN;
3729+ else if (line - name == 8
3730+ && __strncasecmp (name, "CONTINUE", 8) == 0)
3731+ action = NSS_ACTION_CONTINUE;
3732+ else
3733+ return result;
3734+
3735+ if (not)
3736+ {
3737+ /* Save the current action setting for this status,
3738+ set them all to the given action, and reset this one. */
3739+ const lookup_actions save = new_service->actions[2 + status];
3740+ new_service->actions[2 + NSS_STATUS_TRYAGAIN] = action;
3741+ new_service->actions[2 + NSS_STATUS_UNAVAIL] = action;
3742+ new_service->actions[2 + NSS_STATUS_NOTFOUND] = action;
3743+ new_service->actions[2 + NSS_STATUS_SUCCESS] = action;
3744+ new_service->actions[2 + status] = save;
3745+ }
3746+ else
3747+ new_service->actions[2 + status] = action;
3748+
3749+ /* Skip white spaces. */
3750+ while (isspace (line[0]))
3751+ ++line;
3752+ }
3753+ while (line[0] != ']');
3754+
3755+ /* Skip the ']'. */
3756+ ++line;
3757+ }
3758+
3759+ *nextp = new_service;
3760+ nextp = &new_service->next;
3761+ }
3762+}
3763+
3764+static name_database_entry *
3765+internal_function
3766+nss_getline (char *line)
3767+{
3768+ const char *name;
3769+ name_database_entry *result;
3770+ size_t len;
3771+
3772+ /* Ignore leading white spaces. ATTENTION: this is different from
3773+ what is implemented in Solaris. The Solaris man page says a line
3774+ beginning with a white space character is ignored. We regard
3775+ this as just another misfeature in Solaris. */
3776+ while (isspace (line[0]))
3777+ ++line;
3778+
3779+ /* Recognize `<database> ":"'. */
3780+ name = line;
3781+ while (line[0] != '\0' && !isspace (line[0]) && line[0] != ':')
3782+ ++line;
3783+ if (line[0] == '\0' || name == line)
3784+ /* Syntax error. */
3785+ return NULL;
3786+ *line++ = '\0';
3787+
3788+ len = strlen (name) + 1;
3789+
3790+ result = (name_database_entry *) xmalloc (sizeof (*result));
3791+ result->name = (char *) xmalloc (len);
3792+
3793+ /* Save the database name. */
3794+ memcpy ((char *) result->name, name, len);
3795+
3796+ /* Parse the list of services. */
3797+ result->service = nss_parse_service_list (line);
3798+
3799+ result->next = NULL;
3800+ return result;
3801+}
3802+
3803+
3804+
3805+/* Generating code for statically initialized nsswitch structures. */
3806+
3807+
3808+/* Return the service-neutral suffix of the name of the service
3809+ library function referred to by the function F. The result is
3810+ allocated with malloc. */
3811+char *
3812+known_function_suffix (const struct function *f)
3813+{
3814+ switch (f->kind)
3815+ {
3816+ case fk_setent:
3817+ return saprintf ("set%sent", f->entry);
3818+
3819+ case fk_getent:
3820+ return saprintf ("get%sent_r", f->entry);
3821+
3822+ case fk_endent:
3823+ return saprintf ("end%sent", f->entry);
3824+
3825+ case fk_getby:
3826+ return saprintf ("get%sby%s_r", f->entry, f->key);
3827+
3828+ case fk_get:
3829+ return saprintf ("get%s_r", f->value_and_key);
3830+
3831+ default:
3832+ abort ();
3833+ }
3834+}
3835+
3836+
3837+/* Return the name of the service library function referred to by the
3838+ function F. The result is allocated with malloc. */
3839+char *
3840+known_function_name (const struct function *f)
3841+{
3842+ return saprintf ("_nss_%s_%s", f->service, known_function_suffix (f));
3843+}
3844+
3845+
3846+/* Write initialized known_function structures to OUT for
3847+ all the functions we'll use. */
3848+void
3849+generate_known_functions (FILE *out)
3850+{
3851+ int i;
3852+
3853+ /* First, generate weak references to the functions. The service
3854+ libraries depend on libc, and if these references weren't weak,
3855+ we'd be making libc depend circularly on the service
3856+ libraries. */
3857+ for (i = 0; functions[i].kind; i++)
3858+ {
3859+ char *name = known_function_name (&functions[i]);
3860+ fprintf (out, "typeof (%s) %s __attribute__ ((weak));\n",
3861+ name, name);
3862+ }
3863+ fputs ("\n", out);
3864+
3865+ /* Then, a table mapping names to functions. */
3866+ fputs ("static const known_function fixed_known_functions[] = {\n",
3867+ out);
3868+ for (i = 0; functions[i].kind; i++)
3869+ {
3870+ const struct function *f = &functions[i];
3871+ char *suffix = known_function_suffix (f);
3872+
3873+ fprintf (out, " /* %2d */ { \"%s\", _nss_%s_%s },\n",
3874+ i, suffix, f->service, suffix);
3875+ }
3876+ fputs ("};\n", out);
3877+ fputs ("\n", out);
3878+}
3879+
3880+
3881+/* Print code to OUT for an initialized array of pointers to the
3882+ 'known_function' structures needed for USER, which is for
3883+ DATABASE. Return its name, allocated with malloc. */
3884+char *
3885+generate_known_function_list (FILE *out,
3886+ const name_database_entry *database,
3887+ const service_user *user)
3888+{
3889+ char *list_name = saprintf ("fixed_%s_%s_known_funcs",
3890+ database->name, user->name);
3891+ fprintf (out, "static const known_function *%s[] = {\n",
3892+ list_name);
3893+ int i;
3894+ for (i = 0; functions[i].kind; i++)
3895+ if (strcmp (functions[i].database, database->name) == 0
3896+ && strcmp (functions[i].service, user->name) == 0)
3897+ fprintf (out, " &fixed_known_functions[%d], /* %s */\n",
3898+ i, known_function_name (&functions[i]));
3899+ fputs (" NULL\n", out);
3900+ fputs ("};\n", out);
3901+ fputs ("\n", out);
3902+
3903+ return list_name;
3904+}
3905+
3906+
3907+/* Return the name of the status value STATUS, as a statically
3908+ allocated string. */
3909+const char *
3910+lookup_status_name (enum nss_status status)
3911+{
3912+ switch (status)
3913+ {
3914+ case NSS_STATUS_TRYAGAIN: return "NSS_STATUS_TRYAGAIN";
3915+ case NSS_STATUS_UNAVAIL: return "NSS_STATUS_UNAVAIL";
3916+ case NSS_STATUS_NOTFOUND: return "NSS_STATUS_NOTFOUND";
3917+ case NSS_STATUS_SUCCESS: return "NSS_STATUS_SUCCESS";
3918+ case NSS_STATUS_RETURN: return "NSS_STATUS_RETURN";
3919+ default: abort ();
3920+ };
3921+}
3922+
3923+
3924+/* Return the name of ACTION as a statically allocated string. */
3925+const char *
3926+lookup_action_name (lookup_actions action)
3927+{
3928+ switch (action)
3929+ {
3930+ case NSS_ACTION_CONTINUE: return "NSS_ACTION_CONTINUE";
3931+ case NSS_ACTION_RETURN: return "NSS_ACTION_RETURN";
3932+ default: abort ();
3933+ }
3934+}
3935+
3936+
3937+/* Print code to OUT for the list of service_user structures starting
3938+ with USER, which are all for DATABASE. Return the name of the
3939+ first structure in that list, or zero if USER is NULL. */
3940+char *
3941+generate_service_user_list (FILE *out,
3942+ name_database_entry *database,
3943+ service_user *user)
3944+{
3945+ if (user)
3946+ {
3947+ /* Generate the tail of the list. */
3948+ char *next_name = generate_service_user_list (out, database, user->next);
3949+ /* Generate our known function list. */
3950+ char *known_function_list_name =
3951+ generate_known_function_list (out, database, user);
3952+
3953+ char *name = saprintf ("fixed_%s_%s_user", database->name, user->name);
3954+
3955+ fprintf (out, "static const service_user %s = {\n", name);
3956+ if (next_name)
3957+ fprintf (out, " (service_user *) &%s,\n", next_name);
3958+ else
3959+ fprintf (out, " NULL, /* no next entry */\n");
3960+ fputs (" {\n", out);
3961+ int i;
3962+ for (i = 0; i < sizeof (user->actions) / sizeof (user->actions[0]); i++)
3963+ fprintf (out, " %s, /* %s */\n",
3964+ lookup_action_name (user->actions[i]),
3965+ lookup_status_name (i - 2));
3966+ fputs (" },\n", out);
3967+ fprintf (out, " NULL, /* we never need the service library */\n");
3968+ fprintf (out, " { .array = %s },\n", known_function_list_name);
3969+ fprintf (out, " \"%s\"\n", user->name);
3970+ fputs ("};\n", out);
3971+ fputs ("\n", out);
3972+
3973+ return name;
3974+ }
3975+ else
3976+ return NULL;
3977+}
3978+
3979+
3980+/* Print code to OUT for the list of name_database_entry structures
3981+ starting with DATABASE. Return the name of the first structure
3982+ in that list, or zero if DATABASE is NULL. */
3983+char *
3984+generate_name_database_entries (FILE *out, name_database_entry *database)
3985+{
3986+ if (database)
3987+ {
3988+ char *next_name = generate_name_database_entries (out, database->next);
3989+ char *service_user_name
3990+ = generate_service_user_list (out, database, database->service);
3991+ char *name = saprintf ("fixed_%s_name_database", database->name);
3992+
3993+ fprintf (out, "static const name_database_entry %s = {\n", name);
3994+
3995+ if (next_name)
3996+ fprintf (out, " (name_database_entry *) &%s,\n", next_name);
3997+ else
3998+ fprintf (out, " NULL,\n");
3999+
4000+ if (service_user_name)
4001+ fprintf (out, " (service_user *) &%s,\n", service_user_name);
4002+ else
4003+ fprintf (out, " NULL,\n");
4004+
4005+ fprintf (out, " \"%s\"\n", database->name);
4006+ fprintf (out, "};\n");
4007+ fputs ("\n", out);
4008+
4009+ return name;
4010+ }
4011+ else
4012+ return NULL;
4013+}
4014+
4015+
4016+void
4017+generate_name_database (FILE *out, name_database *service_table)
4018+{
4019+ /* Produce a linked list of the known name_database_entry
4020+ structures. */
4021+ char *entries = generate_name_database_entries (out, service_table->entry);
4022+
4023+ /* Now produce the main structure that points to them all. */
4024+ fprintf (out, "static const name_database fixed_name_database = {\n");
4025+ if (entries)
4026+ fprintf (out, " (name_database_entry *) &%s,\n", entries);
4027+ else
4028+ fprintf (out, " NULL,\n");
4029+ fputs (" NULL /* we don't need the libraries */\n"
4030+ "};\n",
4031+ out);
4032+}
4033+
4034+
4035+
4036+/* Generating the list of service libraries we generate references to. */
4037+
4038+/* String with revision number of the shared object files. */
4039+static const char *const nss_shlib_revision = LIBNSS_FILES_SO + 15;
4040+
4041+void
4042+generate_service_lib_list (FILE *out, name_database *service_table)
4043+{
4044+ int i, j;
4045+ int printed_any = 0;
4046+
4047+ for (i = 0; functions[i].kind; i++)
4048+ {
4049+ /* Mention each service library only once. */
4050+ for (j = 0; j < i; j++)
4051+ if (strcmp (functions[i].service, functions[j].service) == 0)
4052+ break;
4053+
4054+ if (j >= i)
4055+ {
4056+ if (printed_any)
4057+ putc (' ', out);
4058+ fprintf (out, "-lnss_%s",
4059+ functions[i].service,
4060+ nss_shlib_revision);
4061+ printed_any = 1;
4062+ }
4063+ }
4064+}
4065+
4066+
4067+/* Main. */
4068+
4069+int
4070+main (int argc, char **argv)
4071+{
4072+ if (argc != 4)
4073+ {
4074+ fprintf (stderr, "usage: gen-fixed-nsswitch HEADER SERVLIBS CONFIG\n");
4075+ exit (1);
4076+ }
4077+
4078+ name_database *service_table = nss_parse_file (argv[3]);
4079+
4080+ FILE *header = fopen (argv[1], "w");
4081+ if (! header)
4082+ {
4083+ fprintf (stderr,
4084+ "gen-fixed-nsswitch: couldn't open output file %s: %s\n",
4085+ argv[1], strerror (errno));
4086+ exit (1);
4087+ }
4088+ fputs ("/* Generated by nss/gen-fixed-nsswitch.c. */\n", header);
4089+ fputs ("\n", header);
4090+ generate_known_functions (header);
4091+ generate_name_database (header, service_table);
4092+ fclose (header);
4093+
4094+ FILE *service_lib_list = fopen (argv[2], "w");
4095+ if (! service_lib_list)
4096+ {
4097+ fprintf (stderr,
4098+ "gen-fixed-nsswitch: couldn't open output file %s: %s\n",
4099+ argv[2], strerror (errno));
4100+ exit (1);
4101+ }
4102+ generate_service_lib_list (service_lib_list, service_table);
4103+ fclose (service_lib_list);
4104+
4105+ return 0;
4106+}
4107Index: git/nss/getent.c
4108===================================================================
4109--- git.orig/nss/getent.c 2014-08-29 20:00:52.976070587 -0700
4110+++ git/nss/getent.c 2014-08-29 20:01:15.216070587 -0700
4111@@ -39,6 +39,7 @@
4112 #include <netinet/ether.h>
4113 #include <netinet/in.h>
4114 #include <sys/socket.h>
4115+#include <gnu/option-groups.h>
4116
4117 /* Get libc version number. */
4118 #include <version.h>
4119@@ -91,6 +92,7 @@
4120 fprintf (stream, gettext ("Written by %s.\n"), "Thorsten Kukuk");
4121 }
4122
4123+#if __OPTION_EGLIBC_DB_ALIASES
4124 /* This is for aliases */
4125 static void
4126 print_aliases (struct aliasent *alias)
4127@@ -135,7 +137,9 @@
4128
4129 return result;
4130 }
4131+#endif /* __OPTION_EGLIBC_DB_ALIASES */
4132
4133+#if __OPTION_EGLIBC_INET
4134 /* This is for ethers */
4135 static int
4136 ethers_keys (int number, char *key[])
4137@@ -179,6 +183,7 @@
4138
4139 return result;
4140 }
4141+#endif /* __OPTION_EGLIBC_INET */
4142
4143 /* This is for group */
4144 static void
4145@@ -301,6 +306,7 @@
4146 return result;
4147 }
4148
4149+#if __OPTION_EGLIBC_INET
4150 /* This is for hosts */
4151 static void
4152 print_hosts (struct hostent *host)
4153@@ -598,6 +604,7 @@
4154
4155 return result;
4156 }
4157+#endif /* __OPTION_EGLIBC_INET */
4158
4159 /* Now is all for passwd */
4160 static void
4161@@ -650,6 +657,7 @@
4162 return result;
4163 }
4164
4165+#if __OPTION_EGLIBC_INET
4166 /* This is for protocols */
4167 static void
4168 print_protocols (struct protoent *proto)
4169@@ -805,6 +813,7 @@
4170
4171 return result;
4172 }
4173+#endif /* __OPTION_EGLIBC_INET */
4174
4175 /* This is for shadow */
4176 static void
4177@@ -871,21 +880,34 @@
4178 } databases[] =
4179 {
4180 #define D(name) { #name, name ## _keys },
4181-D(ahosts)
4182-D(ahostsv4)
4183-D(ahostsv6)
4184-D(aliases)
4185-D(ethers)
4186+
4187+#if __OPTION_EGLIBC_INET
4188+#define DN(name) D(name)
4189+#else
4190+#define DN(name)
4191+#endif
4192+
4193+#if __OPTION_EGLIBC_DB_ALIASES
4194+#define DA(name) D(name)
4195+#else
4196+#define DA(name)
4197+#endif
4198+
4199+DN(ahosts)
4200+DN(ahostsv4)
4201+DN(ahostsv6)
4202+DA(aliases)
4203+DN(ethers)
4204 D(group)
4205 D(gshadow)
4206-D(hosts)
4207+DN(hosts)
4208 D(initgroups)
4209-D(netgroup)
4210-D(networks)
4211+DN(netgroup)
4212+DN(networks)
4213 D(passwd)
4214-D(protocols)
4215-D(rpc)
4216-D(services)
4217+DN(protocols)
4218+DN(rpc)
4219+DN(services)
4220 D(shadow)
4221 #undef D
4222 { NULL, NULL }
4223Index: git/nss/getnssent_r.c
4224===================================================================
4225--- git.orig/nss/getnssent_r.c 2014-08-29 20:00:52.976070587 -0700
4226+++ git/nss/getnssent_r.c 2014-08-29 20:01:15.220070587 -0700
4227@@ -16,6 +16,7 @@
4228 <http://www.gnu.org/licenses/>. */
4229
4230 #include <errno.h>
4231+#include <gnu/option-groups.h>
4232 #include <netdb.h>
4233 #include "nsswitch.h"
4234
4235@@ -59,11 +60,13 @@
4236 } fct;
4237 int no_more;
4238
4239+#if __OPTION_EGLIBC_INET
4240 if (res && __res_maybe_init (&_res, 0) == -1)
4241 {
4242 __set_h_errno (NETDB_INTERNAL);
4243 return;
4244 }
4245+#endif /* __OPTION_EGLIBC_INET */
4246
4247 /* Cycle through the services and run their `setXXent' functions until
4248 we find an available service. */
4249@@ -101,11 +104,13 @@
4250 } fct;
4251 int no_more;
4252
4253+#if __OPTION_EGLIBC_INET
4254 if (res && __res_maybe_init (&_res, 0) == -1)
4255 {
4256 __set_h_errno (NETDB_INTERNAL);
4257 return;
4258 }
4259+#endif /* __OPTION_EGLIBC_INET */
4260
4261 /* Cycle through all the services and run their endXXent functions. */
4262 no_more = setup (func_name, lookup_fct, &fct.ptr, nip, startp, 1);
4263@@ -141,12 +146,14 @@
4264 int no_more;
4265 enum nss_status status;
4266
4267+#if __OPTION_EGLIBC_INET
4268 if (res && __res_maybe_init (&_res, 0) == -1)
4269 {
4270 *h_errnop = NETDB_INTERNAL;
4271 *result = NULL;
4272 return errno;
4273 }
4274+#endif /* __OPTION_EGLIBC_INET */
4275
4276 /* Initialize status to return if no more functions are found. */
4277 status = NSS_STATUS_NOTFOUND;
4278@@ -161,7 +168,7 @@
4279 int is_last_nip = *nip == *last_nip;
4280
4281 status = DL_CALL_FCT (fct.f,
4282- (resbuf, buffer, buflen, &errno, &h_errno));
4283+ (resbuf, buffer, buflen, &errno, h_errnop));
4284
4285 /* The status is NSS_STATUS_TRYAGAIN and errno is ERANGE the
4286 provided buffer is too small. In this case we should give
4287Index: git/nss/Makefile
4288===================================================================
4289--- git.orig/nss/Makefile 2014-08-29 20:00:52.972070587 -0700
4290+++ git/nss/Makefile 2014-08-29 20:01:15.220070587 -0700
4291@@ -18,29 +18,36 @@
4292 #
4293 # Makefile for name service switch.
4294 #
4295+include ../option-groups.mak
4296+
4297 subdir := nss
4298
4299 include ../Makeconfig
4300
4301 headers := nss.h
4302
4303-# This is the trivial part which goes into libc itself.
4304-routines = nsswitch getnssent getnssent_r digits_dots \
4305- $(addsuffix -lookup,$(databases))
4306-
4307 # These are the databases that go through nss dispatch.
4308 # Caution: if you add a database here, you must add its real name
4309 # in databases.def, too.
4310-databases = proto service hosts network grp pwd rpc ethers \
4311- spwd netgrp key alias sgrp
4312+databases-y = grp pwd spwd sgrp
4313+databases-$(OPTION_EGLIBC_INET) \
4314+ += proto service hosts network rpc ethers \
4315+ netgrp key
4316+databases-$(OPTION_EGLIBC_DB_ALIASES) += alias
4317+
4318+# This is the trivial part which goes into libc itself.
4319+routines-y += nsswitch getnssent getnssent_r \
4320+ $(addsuffix -lookup,$(databases-y))
4321+routines-$(OPTION_EGLIBC_INET) += digits_dots
4322
4323 others := getent makedb
4324 install-bin := getent makedb
4325 makedb-modules = xmalloc hash-string
4326 extra-objs += $(makedb-modules:=.o)
4327
4328-tests = test-netdb tst-nss-test1 test-digits-dots
4329-xtests = bug-erange
4330+tests = tst-nss-test1
4331+tests-$(OPTION_EGLIBC_INET) += test-netdb test-digits-dots
4332+xtests-$(OPTION_EGLIBC_INET) += bug-erange
4333
4334 # Specify rules for the nss_* modules. We have some services.
4335 services := files db
4336@@ -55,7 +62,7 @@
4337 vpath %.c $(subdir-dirs) ../locale/programs ../intl
4338
4339
4340-libnss_files-routines := $(addprefix files-,$(databases)) \
4341+libnss_files-routines := $(addprefix files-,$(databases-y)) \
4342 files-initgroups files-have_o_cloexec files-init
4343
4344 libnss_db-dbs := $(addprefix db-,\
4345@@ -78,6 +85,45 @@
4346 tests += $(tests-static)
4347 endif
4348
4349+ifneq ($(OPTION_EGLIBC_NSSWITCH),y)
4350+
4351+ifndef OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG
4352+$(error OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG variable left unset)
4353+endif
4354+
4355+ifndef OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS
4356+$(error OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS variable left unset)
4357+endif
4358+
4359+ifeq (,$(wildcard $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG)))
4360+$(warning OPTION_EGLIBC_NSSWITCH is disabled, but fixed config file)
4361+$(error does not exist: $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG))
4362+endif
4363+
4364+ifeq (,$(wildcard $(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS)))
4365+$(warning OPTION_EGLIBC_NSSWITCH is disabled, but fixed functions file)
4366+$(error does not exist: $(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS))
4367+endif
4368+
4369+before-compile := $(objpfx)fixed-nsswitch.h
4370+generated := fixed-nsswitch.h
4371+$(objpfx)fixed-nsswitch.h $(objfpx)fixed-nsswitch-libs: \
4372+ $(objpfx)gen-fixed-nsswitch \
4373+ $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG)
4374+ $< $(objpfx)fixed-nsswitch.h \
4375+ $(objpfx)fixed-nsswitch-libs \
4376+ $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG)
4377+
4378+$(objpfx)gen-fixed-nsswitch: gen-fixed-nsswitch.c \
4379+ $(common-objpfx)option-groups.config \
4380+ $(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS)
4381+ $(native-compile)
4382+gen-fixed-nsswitch-CFLAGS = \
4383+ -g3 -O -Wall \
4384+ -I $(objpfx) \
4385+ -DFIXED_FUNCTIONS='"$(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS)"'
4386+endif
4387+
4388 include ../Rules
4389
4390 ifeq (yes,$(have-selinux))
4391Index: git/nss/nsswitch.c
4392===================================================================
4393--- git.orig/nss/nsswitch.c 2014-08-29 20:00:53.004070587 -0700
4394+++ git/nss/nsswitch.c 2014-08-29 20:01:15.220070587 -0700
4395@@ -26,6 +26,7 @@
4396 #include <stdio_ext.h>
4397 #include <stdlib.h>
4398 #include <string.h>
4399+#include <gnu/option-groups.h>
4400
4401 #include <aliases.h>
4402 #include <grp.h>
4403@@ -41,6 +42,15 @@
4404 #include "../nscd/nscd_proto.h"
4405 #include <sysdep.h>
4406
4407+/* When OPTION_EGLIBC_NSSWITCH is disabled, we use fixed tables of
4408+ databases and services, generated at library build time. Thus:
4409+ - We can't reconfigure individual databases, so we don't need a
4410+ name-to-database map.
4411+ - We never add databases or service libraries, or look up functions
4412+ at runtime, so there's no need for a lock to protect our tables.
4413+ See ../option-groups.def for the details. */
4414+#if __OPTION_EGLIBC_NSSWITCH
4415+
4416 /* Prototypes for the local functions. */
4417 static name_database *nss_parse_file (const char *fname) internal_function;
4418 static name_database_entry *nss_getline (char *line) internal_function;
4419@@ -79,6 +89,9 @@
4420
4421 __libc_lock_define_initialized (static, lock)
4422
4423+#define lock_nsswitch __libc_lock_lock (lock)
4424+#define unlock_nsswitch __libc_lock_unlock (lock)
4425+
4426 #if !defined DO_STATIC_NSS || defined SHARED
4427 /* String with revision number of the shared object files. */
4428 static const char *const __nss_shlib_revision = LIBNSS_FILES_SO + 15;
4429@@ -93,6 +106,20 @@
4430 __libc_freeres. */
4431 static name_database_entry *defconfig_entries;
4432
4433+#else /* __OPTION_EGLIBC_NSSWITCH */
4434+
4435+/* Bring in the statically initialized service table we generated at
4436+ build time. */
4437+#include "fixed-nsswitch.h"
4438+
4439+const static name_database *service_table = &fixed_name_database;
4440+
4441+/* Nothing ever changes, so there's no need to lock anything. */
4442+#define lock_nsswitch (0)
4443+#define unlock_nsswitch (0)
4444+
4445+#endif /* __OPTION_EGLIBC_NSSWITCH */
4446+
4447
4448 #ifdef USE_NSCD
4449 /* Nonzero if this is the nscd process. */
4450@@ -109,20 +136,22 @@
4451 const char *defconfig, service_user **ni)
4452 {
4453 /* Prevent multiple threads to change the service table. */
4454- __libc_lock_lock (lock);
4455+ lock_nsswitch;
4456
4457 /* Reconsider database variable in case some other thread called
4458 `__nss_configure_lookup' while we waited for the lock. */
4459 if (*ni != NULL)
4460 {
4461- __libc_lock_unlock (lock);
4462+ unlock_nsswitch;
4463 return 0;
4464 }
4465
4466+#if __OPTION_EGLIBC_NSSWITCH
4467 /* Are we initialized yet? */
4468 if (service_table == NULL)
4469 /* Read config file. */
4470 service_table = nss_parse_file (_PATH_NSSWITCH_CONF);
4471+#endif
4472
4473 /* Test whether configuration data is available. */
4474 if (service_table != NULL)
4475@@ -144,6 +173,7 @@
4476 *ni = entry->service;
4477 }
4478
4479+#if __OPTION_EGLIBC_NSSWITCH
4480 /* No configuration data is available, either because nsswitch.conf
4481 doesn't exist or because it doesn't have a line for this database.
4482
4483@@ -166,13 +196,23 @@
4484 {
4485 entry->next = defconfig_entries;
4486 entry->service = *ni;
4487- entry->name[0] = '\0';
4488+ entry->name = "";
4489 defconfig_entries = entry;
4490 }
4491 }
4492 }
4493+#else
4494+ /* Without the dynamic behavior, we can't process defconfig. The
4495+ databases the user specified at library build time are all you
4496+ get. */
4497+ if (*ni == NULL)
4498+ {
4499+ unlock_nsswitch;
4500+ return -1;
4501+ }
4502+#endif
4503
4504- __libc_lock_unlock (lock);
4505+ unlock_nsswitch;
4506
4507 return *ni != NULL ? 0 : -1;
4508 }
4509@@ -252,6 +292,7 @@
4510 libc_hidden_def (__nss_next2)
4511
4512
4513+#if __OPTION_EGLIBC_NSSWITCH
4514 int
4515 attribute_compat_text_section
4516 __nss_next (service_user **ni, const char *fct_name, void **fctp, int status,
4517@@ -300,13 +341,13 @@
4518 }
4519
4520 /* Prevent multiple threads to change the service table. */
4521- __libc_lock_lock (lock);
4522+ lock_nsswitch;
4523
4524 /* Install new rules. */
4525 *databases[cnt].dbp = new_db;
4526 __nss_database_custom[cnt] = true;
4527
4528- __libc_lock_unlock (lock);
4529+ unlock_nsswitch;
4530
4531 return 0;
4532 }
4533@@ -402,7 +443,7 @@
4534 void **found, *result;
4535
4536 /* We now modify global data. Protect it. */
4537- __libc_lock_lock (lock);
4538+ lock_nsswitch;
4539
4540 /* Search the tree of functions previously requested. Data in the
4541 tree are `known_function' structures, whose first member is a
4542@@ -413,7 +454,7 @@
4543 enough to a pointer to our structure to use as a lookup key that
4544 will be passed to `known_compare' (above). */
4545
4546- found = __tsearch (&fct_name, &ni->known, &known_compare);
4547+ found = __tsearch (&fct_name, &ni->known.tree, &known_compare);
4548 if (found == NULL)
4549 /* This means out-of-memory. */
4550 result = NULL;
4551@@ -440,7 +481,7 @@
4552 #endif
4553 /* Oops. We can't instantiate this node properly.
4554 Remove it from the tree. */
4555- __tdelete (&fct_name, &ni->known, &known_compare);
4556+ __tdelete (&fct_name, &ni->known.tree, &known_compare);
4557 free (known);
4558 result = NULL;
4559 }
4560@@ -520,13 +561,43 @@
4561 }
4562
4563 /* Remove the lock. */
4564- __libc_lock_unlock (lock);
4565+ unlock_nsswitch;
4566
4567 return result;
4568 }
4569 libc_hidden_def (__nss_lookup_function)
4570
4571
4572+#else /* below if ! __OPTION_EGLIBC_NSSWITCH */
4573+
4574+
4575+int
4576+__nss_configure_lookup (const char *dbname, const char *service_line)
4577+{
4578+ /* We can't dynamically configure lookup without
4579+ OPTION_EGLIBC_NSSWITCH. */
4580+ __set_errno (EINVAL);
4581+ return -1;
4582+}
4583+
4584+
4585+void *
4586+__nss_lookup_function (service_user *ni, const char *fct_name)
4587+{
4588+ int i;
4589+ const known_function **known = ni->known.array;
4590+
4591+ for (i = 0; known[i]; i++)
4592+ if (strcmp (fct_name, known[i]->fct_name) == 0)
4593+ return known[i]->fct_ptr;
4594+
4595+ return NULL;
4596+}
4597+libc_hidden_def (__nss_lookup_function)
4598+#endif
4599+
4600+
4601+#if __OPTION_EGLIBC_NSSWITCH
4602 static name_database *
4603 internal_function
4604 nss_parse_file (const char *fname)
4605@@ -632,8 +703,10 @@
4606 + (line - name + 1));
4607 if (new_service == NULL)
4608 return result;
4609+ new_service->name = (char *) (new_service + 1);
4610
4611- *((char *) __mempcpy (new_service->name, name, line - name)) = '\0';
4612+ *((char *) __mempcpy ((char *) new_service->name, name, line - name))
4613+ = '\0';
4614
4615 /* Set default actions. */
4616 new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE;
4617@@ -642,7 +715,7 @@
4618 new_service->actions[2 + NSS_STATUS_SUCCESS] = NSS_ACTION_RETURN;
4619 new_service->actions[2 + NSS_STATUS_RETURN] = NSS_ACTION_RETURN;
4620 new_service->library = NULL;
4621- new_service->known = NULL;
4622+ new_service->known.tree = NULL;
4623 new_service->next = NULL;
4624
4625 while (isspace (line[0]))
4626@@ -778,9 +851,10 @@
4627 result = (name_database_entry *) malloc (sizeof (name_database_entry) + len);
4628 if (result == NULL)
4629 return NULL;
4630+ result->name = (char *) (result + 1);
4631
4632 /* Save the database name. */
4633- memcpy (result->name, name, len);
4634+ memcpy ((char *) result->name, name, len);
4635
4636 /* Parse the list of services. */
4637 result->service = nss_parse_service_list (line);
4638@@ -816,6 +890,7 @@
4639 return *currentp;
4640 }
4641 #endif
4642+#endif /* __OPTION_EGLIBC_NSSWITCH */
4643
4644
4645 #if defined SHARED && defined USE_NSCD
4646@@ -834,6 +909,7 @@
4647 }
4648
4649
4650+#if __OPTION_EGLIBC_INET
4651 /* Called by nscd and nscd alone. */
4652 void
4653 __nss_disable_nscd (void (*cb) (size_t, struct traced_file *))
4654@@ -857,8 +933,10 @@
4655 __nss_not_use_nscd_services = -1;
4656 __nss_not_use_nscd_netgroup = -1;
4657 }
4658+#endif /* __OPTION_EGLIBC_INET */
4659 #endif
4660
4661+#if __OPTION_EGLIBC_NSSWITCH
4662 static void
4663 free_database_entries (name_database_entry *entry)
4664 {
4665@@ -871,8 +949,8 @@
4666 {
4667 service_user *olds = service;
4668
4669- if (service->known != NULL)
4670- __tdestroy (service->known, free);
4671+ if (service->known.tree != NULL)
4672+ __tdestroy (service->known.tree, free);
4673
4674 service = service->next;
4675 free (olds);
4676@@ -926,3 +1004,4 @@
4677
4678 free (top);
4679 }
4680+#endif /* __OPTION_EGLIBC_NSSWITCH */
4681Index: git/nss/nsswitch.h
4682===================================================================
4683--- git.orig/nss/nsswitch.h 2014-08-29 20:00:53.012070587 -0700
4684+++ git/nss/nsswitch.h 2014-08-29 20:01:15.220070587 -0700
4685@@ -65,10 +65,20 @@
4686 lookup_actions actions[5];
4687 /* Link to the underlying library object. */
4688 service_library *library;
4689- /* Collection of known functions. */
4690- void *known;
4691+ /* Collection of known functions.
4692+
4693+ With OPTION_EGLIBC_NSSWITCH enabled, this is the root of a
4694+ 'tsearch'-style tree.
4695+
4696+ With OPTION_EGLIBC_NSSWITCH disabled, this is an array of
4697+ pointers to known_function structures, NULL-terminated. */
4698+ union
4699+ {
4700+ void *tree;
4701+ const known_function **array;
4702+ } known;
4703 /* Name of the service (`files', `dns', `nis', ...). */
4704- char name[0];
4705+ const char *name;
4706 } service_user;
4707
4708 /* To access the action based on the status value use this macro. */
4709@@ -82,7 +92,7 @@
4710 /* List of service to be used. */
4711 service_user *service;
4712 /* Name of the database. */
4713- char name[0];
4714+ const char *name;
4715 } name_database_entry;
4716
4717
4718Index: git/posix/bug-regex1.c
4719===================================================================
4720--- git.orig/posix/bug-regex1.c 2014-08-29 20:00:53.184070587 -0700
4721+++ git/posix/bug-regex1.c 2014-08-29 20:01:15.220070587 -0700
4722@@ -4,6 +4,7 @@
4723 #include <string.h>
4724 #include <regex.h>
4725 #include <wchar.h>
4726+#include <gnu/option-groups.h>
4727
4728 int
4729 main (void)
4730@@ -17,7 +18,9 @@
4731 memset (&regex, '\0', sizeof (regex));
4732
4733 setlocale (LC_ALL, "de_DE.ISO-8859-1");
4734+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
4735 fwide (stdout, -1);
4736+#endif
4737
4738 re_set_syntax (RE_SYNTAX_POSIX_EGREP | RE_DEBUG);
4739
4740Index: git/posix/bug-regex6.c
4741===================================================================
4742--- git.orig/posix/bug-regex6.c 2014-08-29 20:00:53.204070587 -0700
4743+++ git/posix/bug-regex6.c 2014-08-29 20:01:15.220070587 -0700
4744@@ -22,6 +22,7 @@
4745 #include <string.h>
4746 #include <sys/types.h>
4747 #include <regex.h>
4748+#include <gnu/option-groups.h>
4749
4750
4751 int
4752@@ -30,7 +31,12 @@
4753 regex_t re;
4754 regmatch_t mat[10];
4755 int i, j, ret = 0;
4756- const char *locales[] = { "C", "de_DE.UTF-8" };
4757+ const char *locales[] = {
4758+ "C",
4759+#if __OPTION_EGLIBC_LOCALE_CODE
4760+ "de_DE.UTF-8"
4761+#endif
4762+ };
4763 const char *string = "http://www.regex.com/pattern/matching.html#intro";
4764 regmatch_t expect[10] = {
4765 { 0, 48 }, { 0, 5 }, { 0, 4 }, { 5, 20 }, { 7, 20 }, { 20, 42 },
4766Index: git/posix/fnmatch.c
4767===================================================================
4768--- git.orig/posix/fnmatch.c 2014-08-29 20:00:53.208070587 -0700
4769+++ git/posix/fnmatch.c 2014-08-29 20:01:15.220070587 -0700
4770@@ -30,6 +30,10 @@
4771 #include <ctype.h>
4772 #include <string.h>
4773
4774+#if defined _LIBC
4775+# include <gnu/option-groups.h>
4776+#endif
4777+
4778 #if defined STDC_HEADERS || defined _LIBC
4779 # include <stdlib.h>
4780 #endif
4781@@ -131,7 +135,7 @@
4782 # define ISWCTYPE(WC, WT) iswctype (WC, WT)
4783 # endif
4784
4785-# if (HAVE_MBSTATE_T && HAVE_MBSRTOWCS) || _LIBC
4786+# if (HAVE_MBSTATE_T && HAVE_MBSRTOWCS) || (_LIBC && __OPTION_EGLIBC_LOCALE_CODE)
4787 /* In this case we are implementing the multibyte character handling. */
4788 # define HANDLE_MULTIBYTE 1
4789 # endif
4790Index: git/posix/fnmatch_loop.c
4791===================================================================
4792--- git.orig/posix/fnmatch_loop.c 2014-08-29 20:00:53.220070587 -0700
4793+++ git/posix/fnmatch_loop.c 2014-08-29 20:01:15.220070587 -0700
4794@@ -15,6 +15,8 @@
4795 License along with the GNU C Library; if not, see
4796 <http://www.gnu.org/licenses/>. */
4797
4798+#include <gnu/option-groups.h>
4799+
4800 #include <stdint.h>
4801
4802 struct STRUCT
4803@@ -54,10 +56,15 @@
4804 const char *collseq = (const char *)
4805 _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQWC);
4806 # else
4807+# if __OPTION_EGLIBC_LOCALE_CODE
4808 const UCHAR *collseq = (const UCHAR *)
4809 _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQMB);
4810-# endif
4811-#endif
4812+# define COLLSEQ_BYTE_LOOKUP(ix) (collseq[(ix)])
4813+# else
4814+# define COLLSEQ_BYTE_LOOKUP(ix) (ix)
4815+# endif /* __OPTION_EGLIBC_LOCALE_CODE */
4816+# endif /* WIDE_CHAR_VERSION */
4817+#endif /* _LIBC */
4818
4819 while ((c = *p++) != L('\0'))
4820 {
4821@@ -277,7 +284,7 @@
4822 /* Leave room for the null. */
4823 CHAR str[CHAR_CLASS_MAX_LENGTH + 1];
4824 size_t c1 = 0;
4825-#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
4826+#if defined _LIBC ? __OPTION_POSIX_C_LANG_WIDE_CHAR : (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
4827 wctype_t wt;
4828 #endif
4829 const CHAR *startp = p;
4830@@ -307,7 +314,7 @@
4831 }
4832 str[c1] = L('\0');
4833
4834-#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
4835+#if defined _LIBC ? __OPTION_POSIX_C_LANG_WIDE_CHAR : (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
4836 wt = IS_CHAR_CLASS (str);
4837 if (wt == 0)
4838 /* Invalid character class name. */
4839@@ -681,8 +688,10 @@
4840 else
4841 lcollseq = __collseq_table_lookup (collseq, cold);
4842 # else
4843- fcollseq = collseq[fn];
4844- lcollseq = is_seqval ? cold : collseq[(UCHAR) cold];
4845+ fcollseq = COLLSEQ_BYTE_LOOKUP (fn);
4846+ lcollseq = (is_seqval
4847+ ? cold
4848+ : COLLSEQ_BYTE_LOOKUP ((UCHAR) cold));
4849 # endif
4850
4851 is_seqval = 0;
4852@@ -858,7 +867,7 @@
4853 goto matched;
4854 }
4855 # else
4856- hcollseq = collseq[cend];
4857+ hcollseq = COLLSEQ_BYTE_LOOKUP (cend);
4858 # endif
4859 }
4860
4861Index: git/posix/glob.c
4862===================================================================
4863--- git.orig/posix/glob.c 2014-08-29 20:00:53.232070587 -0700
4864+++ git/posix/glob.c 2014-08-29 20:01:15.220070587 -0700
4865@@ -25,6 +25,9 @@
4866 #include <sys/types.h>
4867 #include <sys/stat.h>
4868 #include <stddef.h>
4869+#ifdef _LIBC
4870+# include <gnu/option-groups.h>
4871+#endif
4872
4873 /* Outcomment the following line for production quality code. */
4874 /* #define NDEBUG 1 */
4875@@ -607,6 +610,7 @@
4876 if (home_dir == NULL || home_dir[0] == '\0')
4877 home_dir = "c:/users/default"; /* poor default */
4878 # else
4879+# if ! _LIBC || __OPTION_EGLIBC_GETLOGIN
4880 if (home_dir == NULL || home_dir[0] == '\0')
4881 {
4882 int success;
4883@@ -623,19 +627,19 @@
4884 if (success)
4885 {
4886 struct passwd *p;
4887-# if defined HAVE_GETPWNAM_R || defined _LIBC
4888+# if defined HAVE_GETPWNAM_R || defined _LIBC
4889 long int pwbuflen = GETPW_R_SIZE_MAX ();
4890 char *pwtmpbuf;
4891 struct passwd pwbuf;
4892 int malloc_pwtmpbuf = 0;
4893 int save = errno;
4894
4895-# ifndef _LIBC
4896+# ifndef _LIBC
4897 if (pwbuflen == -1)
4898 /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX.
4899 Try a moderate value. */
4900 pwbuflen = 1024;
4901-# endif
4902+# endif
4903 if (__libc_use_alloca (alloca_used + pwbuflen))
4904 pwtmpbuf = alloca_account (pwbuflen, alloca_used);
4905 else
4906@@ -682,9 +686,9 @@
4907 }
4908 __set_errno (save);
4909 }
4910-# else
4911+# else
4912 p = getpwnam (name);
4913-# endif
4914+# endif
4915 if (p != NULL)
4916 {
4917 if (!malloc_pwtmpbuf)
4918@@ -713,6 +717,7 @@
4919 }
4920 }
4921 }
4922+# endif /* ! _LIBC || __OPTION_EGLIBC_GETLOGIN */
4923 if (home_dir == NULL || home_dir[0] == '\0')
4924 {
4925 if (flags & GLOB_TILDE_CHECK)
4926Index: git/posix/Makefile
4927===================================================================
4928--- git.orig/posix/Makefile 2014-08-29 20:00:53.160070587 -0700
4929+++ git/posix/Makefile 2014-08-29 20:01:15.220070587 -0700
4930@@ -18,6 +18,8 @@
4931 #
4932 # Sub-makefile for POSIX portion of the library.
4933 #
4934+include ../option-groups.mak
4935+
4936 subdir := posix
4937
4938 include ../Makeconfig
4939@@ -43,13 +45,24 @@
4940 getpgid setpgid getpgrp bsd-getpgrp setpgrp getsid setsid \
4941 getresuid getresgid setresuid setresgid \
4942 pathconf sysconf fpathconf \
4943- glob glob64 fnmatch regex \
4944+ glob glob64 fnmatch \
4945 confstr \
4946 getopt getopt1 getopt_init \
4947 sched_setp sched_getp sched_sets sched_gets sched_yield sched_primax \
4948 sched_primin sched_rr_gi sched_getaffinity sched_setaffinity \
4949- getaddrinfo gai_strerror wordexp \
4950 pread pwrite pread64 pwrite64 \
4951+ posix_madvise \
4952+ get_child_max sched_cpucount sched_cpualloc sched_cpufree
4953+
4954+routines-$(OPTION_EGLIBC_INET) += getaddrinfo gai_strerror
4955+
4956+ifeq (y,$(OPTION_POSIX_REGEXP_GLIBC))
4957+routines-$(OPTION_POSIX_REGEXP) += regex
4958+else
4959+routines-$(OPTION_POSIX_REGEXP) += xregex
4960+endif
4961+
4962+routines-$(OPTION_EGLIBC_SPAWN) += \
4963 spawn_faction_init spawn_faction_destroy spawn_faction_addclose \
4964 spawn_faction_addopen spawn_faction_adddup2 \
4965 spawnattr_init spawnattr_destroy \
4966@@ -57,41 +70,53 @@
4967 spawnattr_getflags spawnattr_setflags \
4968 spawnattr_getpgroup spawnattr_setpgroup spawn spawnp spawni \
4969 spawnattr_getsigmask spawnattr_getschedpolicy spawnattr_getschedparam \
4970- spawnattr_setsigmask spawnattr_setschedpolicy spawnattr_setschedparam \
4971- posix_madvise \
4972- get_child_max sched_cpucount sched_cpualloc sched_cpufree
4973+ spawnattr_setsigmask spawnattr_setschedpolicy spawnattr_setschedparam
4974+routines-$(OPTION_EGLIBC_WORDEXP) += wordexp
4975
4976 aux := init-posix environ
4977-tests := tstgetopt testfnm runtests runptests \
4978+tests := tstgetopt testfnm runtests \
4979 tst-preadwrite tst-preadwrite64 test-vfork regexbug1 \
4980- tst-getlogin tst-mmap tst-getaddrinfo tst-truncate \
4981- tst-truncate64 tst-fork tst-fnmatch tst-regexloc tst-dir \
4982- tst-chmod bug-regex1 bug-regex2 bug-regex3 bug-regex4 \
4983- tst-gnuglob tst-regex bug-regex5 bug-regex6 bug-regex7 \
4984- bug-regex8 bug-regex9 bug-regex10 bug-regex11 bug-regex12 \
4985- bug-regex13 bug-regex14 bug-regex15 bug-regex16 \
4986- bug-regex17 bug-regex18 bug-regex19 bug-regex20 \
4987- bug-regex21 bug-regex22 bug-regex23 bug-regex24 \
4988- bug-regex25 bug-regex26 bug-regex27 bug-regex28 \
4989- bug-regex29 bug-regex30 bug-regex31 bug-regex32 \
4990- bug-regex33 tst-nice tst-nanosleep tst-regex2 \
4991- transbug tst-rxspencer tst-pcre tst-boost \
4992- bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
4993- tst-getaddrinfo2 bug-glob1 bug-glob2 bug-glob3 tst-sysconf \
4994+ tst-getlogin tst-mmap tst-truncate \
4995+ tst-truncate64 tst-fork tst-dir \
4996+ tst-chmod bug-regex2 bug-regex3 bug-regex4 \
4997+ tst-gnuglob bug-regex6 bug-regex7 \
4998+ bug-regex8 bug-regex9 bug-regex10 bug-regex12 \
4999+ bug-regex14 bug-regex15 \
5000+ bug-regex21 bug-regex24 \
5001+ bug-regex27 bug-regex28 bug-regex29 bug-regex30 \
5002+ bug-regex31 \
5003+ tst-nice tst-nanosleep \
5004+ transbug \
5005+ tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
5006+ bug-glob1 bug-glob2 bug-glob3 tst-sysconf \
5007 tst-execvp1 tst-execvp2 tst-execlp1 tst-execlp2 \
5008 tst-execv1 tst-execv2 tst-execl1 tst-execl2 \
5009 tst-execve1 tst-execve2 tst-execle1 tst-execle2 \
5010- tst-execvp3 tst-execvp4 tst-rfc3484 tst-rfc3484-2 \
5011- tst-rfc3484-3 \
5012- tst-getaddrinfo3 tst-fnmatch2 tst-cpucount tst-cpuset \
5013+ tst-execvp3 tst-execvp4 \
5014+ tst-fnmatch2 tst-cpucount tst-cpuset \
5015 bug-getopt1 bug-getopt2 bug-getopt3 bug-getopt4 \
5016 bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \
5017 tst-pathconf tst-getaddrinfo4 tst-rxspencer-no-utf8 \
5018 tst-fnmatch3 bug-regex36
5019-xtests := bug-ga2
5020+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
5021+ += tst-fnmatch tst-regexloc bug-regex1 bug-regex5 \
5022+ bug-regex23 bug-regex25 bug-regex32 bug-regex33
5023+tests-$(OPTION_EGLIBC_INET) \
5024+ += tst-getaddrinfo bug-ga1 tst-getaddrinfo2 \
5025+ tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3 tst-getaddrinfo3
5026+tests-$(OPTION_POSIX_REGEXP_GLIBC) \
5027+ += runptests bug-regex11 bug-regex13 bug-regex16 \
5028+ tst-regex2 tst-rxspencer tst-pcre tst-boost
5029+ifeq (yy,$(OPTION_EGLIBC_LOCALE_CODE)$(OPTION_POSIX_REGEXP_GLIBC))
5030+tests += tst-regex bug-regex17 bug-regex18 bug-regex19 bug-regex20 \
5031+ bug-regex22 bug-regex26
5032+endif
5033+xtests-$(OPTION_EGLIBC_INET) += bug-ga2
5034 ifeq (yes,$(build-shared))
5035 test-srcs := globtest
5036-tests += wordexp-test tst-exec tst-spawn
5037+tests += tst-exec
5038+tests-$(OPTION_EGLIBC_SPAWN) += tst-spawn
5039+tests-$(OPTION_EGLIBC_WORDEXP) += wordexp-test
5040 endif
5041 tests-static = tst-exec-static tst-spawn-static
5042 tests += $(tests-static)
5043@@ -117,7 +142,10 @@
5044
5045 ifeq ($(run-built-tests),yes)
5046 ifeq (yes,$(build-shared))
5047-tests-special += $(objpfx)globtest.out $(objpfx)wordexp-tst.out
5048+tests-special += $(objpfx)globtest.out
5049+ifeq (y,$(OPTION_EGLIBC_WORDEXP))
5050+tests-special += $(objpfx)wordexp-tst.out
5051+endif
5052 endif
5053 endif
5054
5055@@ -125,12 +153,16 @@
5056 # XXX Please note that for now we ignore the result of this test.
5057 tests-special += $(objpfx)annexc.out
5058 ifeq ($(run-built-tests),yes)
5059-tests-special += $(objpfx)bug-regex2-mem.out $(objpfx)bug-regex14-mem.out \
5060+tests-special += $(objpfx)bug-regex2-mem.out \
5061 $(objpfx)bug-regex21-mem.out $(objpfx)bug-regex31-mem.out \
5062- $(objpfx)tst-rxspencer-no-utf8-mem.out $(objpfx)tst-pcre-mem.out \
5063- $(objpfx)tst-boost-mem.out $(objpfx)tst-getconf.out \
5064+ $(objpfx)tst-getconf.out \
5065 $(objpfx)bug-glob2-mem.out $(objpfx)tst-vfork3-mem.out \
5066 $(objpfx)tst-fnmatch-mem.out $(objpfx)bug-regex36-mem.out
5067+ifeq (y,$(OPTION_POSIX_REGEXP_GLIBC))
5068+tests-special += $(objpfx)bug-regex14-mem $(objpfx)tst-rxspencer-no-utf8-mem \
5069+ $(objpfx)tst-pcre-mem $(objpfx)tst-boost-mem
5070+endif
5071+
5072 xtests-special += $(objpfx)bug-ga2-mem.out
5073 endif
5074
5075@@ -143,6 +175,8 @@
5076 $(SHELL) $< $(common-objpfx) '$(test-via-rtld-prefix)' \
5077 '$(test-program-prefix)' '$(test-wrapper-env)'; \
5078 $(evaluate-test)
5079+LDLIBS-globtest += $(shell cat $(common-objpfx)nss/fixed-nsswitch-libs)
5080+
5081 $(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
5082 $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
5083 '$(run-program-env)' '$(test-program-prefix-after-env)'; \
5084@@ -205,7 +239,10 @@
5085 tst-chmod-ARGS = $(objdir)
5086 tst-vfork3-ARGS = --test-dir=$(objpfx)
5087
5088-tst-rxspencer-ARGS = --utf8 rxspencer/tests
5089+tst-rxspencer-ARGS = rxspencer/tests
5090+ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
5091+tst-rxspencer-ARGS += --utf8
5092+endif
5093 tst-rxspencer-no-utf8-ARGS = rxspencer/tests
5094 tst-pcre-ARGS = PCRE.tests
5095 tst-boost-ARGS = BOOST.tests
5096Index: git/posix/regcomp.c
5097===================================================================
5098--- git.orig/posix/regcomp.c 2014-08-29 20:00:53.264070587 -0700
5099+++ git/posix/regcomp.c 2014-08-29 20:01:15.224070587 -0700
5100@@ -18,6 +18,7 @@
5101 <http://www.gnu.org/licenses/>. */
5102
5103 #include <stdint.h>
5104+#include <gnu/option-groups.h>
5105
5106 static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern,
5107 size_t length, reg_syntax_t syntax);
5108@@ -305,7 +306,7 @@
5109 {
5110 re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
5111 int node_cnt;
5112- int icase = (dfa->mb_cur_max == 1 && (bufp->syntax & RE_ICASE));
5113+ int icase = (dfa_mb_cur_max (dfa) == 1 && (bufp->syntax & RE_ICASE));
5114 for (node_cnt = 0; node_cnt < init_state->nodes.nelem; ++node_cnt)
5115 {
5116 int node = init_state->nodes.elems[node_cnt];
5117@@ -315,9 +316,9 @@
5118 {
5119 re_set_fastmap (fastmap, icase, dfa->nodes[node].opr.c);
5120 #ifdef RE_ENABLE_I18N
5121- if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
5122+ if ((bufp->syntax & RE_ICASE) && dfa_mb_cur_max (dfa) > 1)
5123 {
5124- unsigned char *buf = alloca (dfa->mb_cur_max), *p;
5125+ unsigned char *buf = alloca (dfa_mb_cur_max (dfa)), *p;
5126 wchar_t wc;
5127 mbstate_t state;
5128
5129@@ -348,7 +349,11 @@
5130 re_set_fastmap (fastmap, icase, ch);
5131 }
5132 }
5133-#ifdef RE_ENABLE_I18N
5134+
5135+ /* When OPTION_EGLIBC_LOCALE_CODE is disabled, the current
5136+ locale is always C, which has no rules and no multi-byte
5137+ characters. */
5138+#if defined RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE
5139 else if (type == COMPLEX_BRACKET)
5140 {
5141 re_charset_t *cset = dfa->nodes[node].opr.mbcset;
5142@@ -376,7 +381,7 @@
5143 i.e. where we would not find an invalid sequence. This only
5144 applies to multibyte character sets; for single byte character
5145 sets, the SIMPLE_BRACKET again suffices. */
5146- if (dfa->mb_cur_max > 1
5147+ if (dfa_mb_cur_max (dfa) > 1
5148 && (cset->nchar_classes || cset->non_match || cset->nranges
5149 # ifdef _LIBC
5150 || cset->nequiv_classes
5151@@ -404,7 +409,7 @@
5152 memset (&state, '\0', sizeof (state));
5153 if (__wcrtomb (buf, cset->mbchars[i], &state) != (size_t) -1)
5154 re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
5155- if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
5156+ if ((bufp->syntax & RE_ICASE) && dfa_mb_cur_max (dfa) > 1)
5157 {
5158 if (__wcrtomb (buf, towlower (cset->mbchars[i]), &state)
5159 != (size_t) -1)
5160@@ -413,7 +418,7 @@
5161 }
5162 }
5163 }
5164-#endif /* RE_ENABLE_I18N */
5165+#endif /* RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE */
5166 else if (type == OP_PERIOD
5167 #ifdef RE_ENABLE_I18N
5168 || type == OP_UTF8_PERIOD
5169@@ -856,11 +861,15 @@
5170
5171 dfa->mb_cur_max = MB_CUR_MAX;
5172 #ifdef _LIBC
5173- if (dfa->mb_cur_max == 6
5174+ if (dfa_mb_cur_max (dfa) == 6
5175 && strcmp (_NL_CURRENT (LC_CTYPE, _NL_CTYPE_CODESET_NAME), "UTF-8") == 0)
5176 dfa->is_utf8 = 1;
5177+# if __OPTION_EGLIBC_LOCALE_CODE
5178 dfa->map_notascii = (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_TO_NONASCII)
5179 != 0);
5180+# else
5181+ dfa->map_notascii = 0;
5182+# endif
5183 #else
5184 # ifdef HAVE_LANGINFO_CODESET
5185 codeset_name = nl_langinfo (CODESET);
5186@@ -886,7 +895,7 @@
5187 #endif
5188
5189 #ifdef RE_ENABLE_I18N
5190- if (dfa->mb_cur_max > 1)
5191+ if (dfa_mb_cur_max (dfa) > 1)
5192 {
5193 if (dfa->is_utf8)
5194 dfa->sb_char = (re_bitset_ptr_t) utf8_sb_map;
5195@@ -1784,7 +1793,7 @@
5196 token->word_char = 0;
5197 #ifdef RE_ENABLE_I18N
5198 token->mb_partial = 0;
5199- if (input->mb_cur_max > 1 &&
5200+ if (string_mb_cur_max (input) > 1 &&
5201 !re_string_first_byte (input, re_string_cur_idx (input)))
5202 {
5203 token->type = CHARACTER;
5204@@ -1805,7 +1814,7 @@
5205 token->opr.c = c2;
5206 token->type = CHARACTER;
5207 #ifdef RE_ENABLE_I18N
5208- if (input->mb_cur_max > 1)
5209+ if (string_mb_cur_max (input) > 1)
5210 {
5211 wint_t wc = re_string_wchar_at (input,
5212 re_string_cur_idx (input) + 1);
5213@@ -1919,7 +1928,7 @@
5214
5215 token->type = CHARACTER;
5216 #ifdef RE_ENABLE_I18N
5217- if (input->mb_cur_max > 1)
5218+ if (string_mb_cur_max (input) > 1)
5219 {
5220 wint_t wc = re_string_wchar_at (input, re_string_cur_idx (input));
5221 token->word_char = IS_WIDE_WORD_CHAR (wc) != 0;
5222@@ -2019,7 +2028,7 @@
5223 token->opr.c = c;
5224
5225 #ifdef RE_ENABLE_I18N
5226- if (input->mb_cur_max > 1 &&
5227+ if (string_mb_cur_max (input) > 1 &&
5228 !re_string_first_byte (input, re_string_cur_idx (input)))
5229 {
5230 token->type = CHARACTER;
5231@@ -2242,7 +2251,7 @@
5232 return NULL;
5233 }
5234 #ifdef RE_ENABLE_I18N
5235- if (dfa->mb_cur_max > 1)
5236+ if (dfa_mb_cur_max (dfa) > 1)
5237 {
5238 while (!re_string_eoi (regexp)
5239 && !re_string_first_byte (regexp, re_string_cur_idx (regexp)))
5240@@ -2380,7 +2389,7 @@
5241 *err = REG_ESPACE;
5242 return NULL;
5243 }
5244- if (dfa->mb_cur_max > 1)
5245+ if (dfa_mb_cur_max (dfa) > 1)
5246 dfa->has_mb_node = 1;
5247 break;
5248 case OP_WORD:
5249@@ -2686,7 +2695,7 @@
5250 However, for !_LIBC we have no collation elements: if the
5251 character set is single byte, the single byte character set
5252 that we build below suffices. parse_bracket_exp passes
5253- no MBCSET if dfa->mb_cur_max == 1. */
5254+ no MBCSET if dfa_mb_cur_max (dfa) == 1. */
5255 if (mbcset)
5256 {
5257 /* Check the space of the arrays. */
5258@@ -2782,7 +2791,13 @@
5259 reg_syntax_t syntax, reg_errcode_t *err)
5260 {
5261 #ifdef _LIBC
5262+#if __OPTION_EGLIBC_LOCALE_CODE
5263 const unsigned char *collseqmb;
5264+# define COLLSEQMB_LOOKUP(ix) (collseqmb[(ix)])
5265+#else
5266+# define COLLSEQMB_LOOKUP(ix) (ix)
5267+#endif
5268+
5269 const char *collseqwc;
5270 uint32_t nrules;
5271 int32_t table_size;
5272@@ -2830,18 +2845,20 @@
5273 if (MB_CUR_MAX == 1)
5274 */
5275 if (nrules == 0)
5276- return collseqmb[br_elem->opr.ch];
5277+ return COLLSEQMB_LOOKUP (br_elem->opr.ch);
5278 else
5279 {
5280 wint_t wc = __btowc (br_elem->opr.ch);
5281 return __collseq_table_lookup (collseqwc, wc);
5282 }
5283 }
5284+#if __OPTION_EGLIBC_LOCALE_CODE
5285 else if (br_elem->type == MB_CHAR)
5286 {
5287 if (nrules != 0)
5288 return __collseq_table_lookup (collseqwc, br_elem->opr.wch);
5289 }
5290+#endif
5291 else if (br_elem->type == COLL_SYM)
5292 {
5293 size_t sym_name_len = strlen ((char *) br_elem->opr.name);
5294@@ -2872,11 +2889,11 @@
5295 {
5296 /* No valid character. Match it as a single byte
5297 character. */
5298- return collseqmb[br_elem->opr.name[0]];
5299+ return COLLSEQMB_LOOKUP (br_elem->opr.name[0]);
5300 }
5301 }
5302 else if (sym_name_len == 1)
5303- return collseqmb[br_elem->opr.name[0]];
5304+ return COLLSEQMB_LOOKUP (br_elem->opr.name[0]);
5305 }
5306 return UINT_MAX;
5307 }
5308@@ -2916,7 +2933,7 @@
5309 However, if we have no collation elements, and the character set
5310 is single byte, the single byte character set that we
5311 build below suffices. */
5312- if (nrules > 0 || dfa->mb_cur_max > 1)
5313+ if (nrules > 0 || dfa_mb_cur_max (dfa) > 1)
5314 {
5315 /* Check the space of the arrays. */
5316 if (BE (*range_alloc == mbcset->nranges, 0))
5317@@ -2953,7 +2970,7 @@
5318 if (MB_CUR_MAX == 1)
5319 */
5320 if (nrules == 0)
5321- ch_collseq = collseqmb[ch];
5322+ ch_collseq = COLLSEQMB_LOOKUP (ch);
5323 else
5324 ch_collseq = __collseq_table_lookup (collseqwc, __btowc (ch));
5325 if (start_collseq <= ch_collseq && ch_collseq <= end_collseq)
5326@@ -3031,7 +3048,10 @@
5327 re_bitset_ptr_t sbcset;
5328 #ifdef RE_ENABLE_I18N
5329 re_charset_t *mbcset;
5330- int coll_sym_alloc = 0, range_alloc = 0, mbchar_alloc = 0;
5331+ int coll_sym_alloc = 0, range_alloc = 0;
5332+#if __OPTION_EGLIBC_LOCALE_CODE
5333+ int mbchar_alloc = 0;
5334+#endif
5335 int equiv_class_alloc = 0, char_class_alloc = 0;
5336 #endif /* not RE_ENABLE_I18N */
5337 int non_match = 0;
5338@@ -3039,9 +3059,15 @@
5339 int token_len;
5340 int first_round = 1;
5341 #ifdef _LIBC
5342+#if __OPTION_EGLIBC_LOCALE_CODE
5343 collseqmb = (const unsigned char *)
5344 _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQMB);
5345 nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
5346+#else
5347+ /* This is true when OPTION_EGLIBC_LOCALE_CODE is disabled, but the
5348+ compiler can't figure that out. */
5349+ nrules = 0;
5350+#endif
5351 if (nrules)
5352 {
5353 /*
5354@@ -3169,7 +3195,7 @@
5355 #else
5356 # ifdef RE_ENABLE_I18N
5357 *err = build_range_exp (sbcset,
5358- dfa->mb_cur_max > 1 ? mbcset : NULL,
5359+ dfa_mb_cur_max (dfa) > 1 ? mbcset : NULL,
5360 &range_alloc, &start_elem, &end_elem);
5361 # else
5362 *err = build_range_exp (sbcset, &start_elem, &end_elem);
5363@@ -3185,7 +3211,7 @@
5364 case SB_CHAR:
5365 bitset_set (sbcset, start_elem.opr.ch);
5366 break;
5367-#ifdef RE_ENABLE_I18N
5368+#if defined RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE
5369 case MB_CHAR:
5370 /* Check whether the array has enough space. */
5371 if (BE (mbchar_alloc == mbcset->nmbchars, 0))
5372@@ -3203,7 +3229,7 @@
5373 }
5374 mbcset->mbchars[mbcset->nmbchars++] = start_elem.opr.wch;
5375 break;
5376-#endif /* RE_ENABLE_I18N */
5377+#endif /* RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE */
5378 case EQUIV_CLASS:
5379 *err = build_equiv_class (sbcset,
5380 #ifdef RE_ENABLE_I18N
5381@@ -3253,11 +3279,11 @@
5382
5383 #ifdef RE_ENABLE_I18N
5384 /* Ensure only single byte characters are set. */
5385- if (dfa->mb_cur_max > 1)
5386+ if (dfa_mb_cur_max (dfa) > 1)
5387 bitset_mask (sbcset, dfa->sb_char);
5388
5389 if (mbcset->nmbchars || mbcset->ncoll_syms || mbcset->nequiv_classes
5390- || mbcset->nranges || (dfa->mb_cur_max > 1 && (mbcset->nchar_classes
5391+ || mbcset->nranges || (dfa_mb_cur_max (dfa) > 1 && (mbcset->nchar_classes
5392 || mbcset->non_match)))
5393 {
5394 bin_tree_t *mbc_tree;
5395@@ -3326,7 +3352,7 @@
5396 re_token_t *token, int token_len, re_dfa_t *dfa,
5397 reg_syntax_t syntax, int accept_hyphen)
5398 {
5399-#ifdef RE_ENABLE_I18N
5400+#if defined RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE
5401 int cur_char_size;
5402 cur_char_size = re_string_char_size_at (regexp, re_string_cur_idx (regexp));
5403 if (cur_char_size > 1)
5404@@ -3336,7 +3362,7 @@
5405 re_string_skip_bytes (regexp, cur_char_size);
5406 return REG_NOERROR;
5407 }
5408-#endif /* RE_ENABLE_I18N */
5409+#endif /* RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE */
5410 re_string_skip_bytes (regexp, token_len); /* Skip a token. */
5411 if (token->type == OP_OPEN_COLL_ELEM || token->type == OP_OPEN_CHAR_CLASS
5412 || token->type == OP_OPEN_EQUIV_CLASS)
5413@@ -3416,7 +3442,9 @@
5414 build_equiv_class (bitset_t sbcset, const unsigned char *name)
5415 #endif /* not RE_ENABLE_I18N */
5416 {
5417-#ifdef _LIBC
5418+ /* When __OPTION_EGLIBC_LOCALE_CODE is disabled, only the C locale
5419+ is supported; it has no collation rules. */
5420+#if defined _LIBC && __OPTION_EGLIBC_LOCALE_CODE
5421 uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
5422 if (nrules != 0)
5423 {
5424@@ -3488,7 +3516,7 @@
5425 mbcset->equiv_classes[mbcset->nequiv_classes++] = idx1;
5426 }
5427 else
5428-#endif /* _LIBC */
5429+#endif /* _LIBC && __OPTION_EGLIBC_LOCALE_CODE */
5430 {
5431 if (BE (strlen ((const char *) name) != 1, 0))
5432 return REG_ECOLLATE;
5433@@ -3522,7 +3550,7 @@
5434 && (strcmp (name, "upper") == 0 || strcmp (name, "lower") == 0))
5435 name = "alpha";
5436
5437-#ifdef RE_ENABLE_I18N
5438+#if defined RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE
5439 /* Check the space of the arrays. */
5440 if (BE (*char_class_alloc == mbcset->nchar_classes, 0))
5441 {
5442@@ -3538,7 +3566,7 @@
5443 *char_class_alloc = new_char_class_alloc;
5444 }
5445 mbcset->char_classes[mbcset->nchar_classes++] = __wctype (name);
5446-#endif /* RE_ENABLE_I18N */
5447+#endif /* RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE */
5448
5449 #define BUILD_CHARCLASS_LOOP(ctype_func) \
5450 do { \
5451@@ -3649,7 +3677,7 @@
5452
5453 #ifdef RE_ENABLE_I18N
5454 /* Ensure only single byte characters are set. */
5455- if (dfa->mb_cur_max > 1)
5456+ if (dfa_mb_cur_max (dfa) > 1)
5457 bitset_mask (sbcset, dfa->sb_char);
5458 #endif
5459
5460@@ -3661,7 +3689,7 @@
5461 goto build_word_op_espace;
5462
5463 #ifdef RE_ENABLE_I18N
5464- if (dfa->mb_cur_max > 1)
5465+ if (dfa_mb_cur_max (dfa) > 1)
5466 {
5467 bin_tree_t *mbc_tree;
5468 /* Build a tree for complex bracket. */
5469Index: git/posix/regexec.c
5470===================================================================
5471--- git.orig/posix/regexec.c 2014-08-29 20:00:53.268070587 -0700
5472+++ git/posix/regexec.c 2014-08-29 20:01:15.224070587 -0700
5473@@ -18,6 +18,7 @@
5474 <http://www.gnu.org/licenses/>. */
5475
5476 #include <stdint.h>
5477+#include <gnu/option-groups.h>
5478
5479 static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags,
5480 int n) internal_function;
5481@@ -186,11 +187,11 @@
5482 static int check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
5483 const re_string_t *input, int idx)
5484 internal_function;
5485-# ifdef _LIBC
5486+# if defined _LIBC && __OPTION_EGLIBC_LOCALE_CODE
5487 static unsigned int find_collation_sequence_value (const unsigned char *mbs,
5488 size_t name_len)
5489 internal_function;
5490-# endif /* _LIBC */
5491+# endif /* _LIBC && __OPTION_EGLIBC_LOCALE_CODE */
5492 #endif /* RE_ENABLE_I18N */
5493 static int group_nodes_into_DFAstates (const re_dfa_t *dfa,
5494 const re_dfastate_t *state,
5495@@ -255,25 +256,9 @@
5496 return err != REG_NOERROR;
5497 }
5498
5499-#ifdef _LIBC
5500-# include <shlib-compat.h>
5501-versioned_symbol (libc, __regexec, regexec, GLIBC_2_3_4);
5502-
5503-# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
5504-__typeof__ (__regexec) __compat_regexec;
5505-
5506-int
5507-attribute_compat_text_section
5508-__compat_regexec (const regex_t *__restrict preg,
5509- const char *__restrict string, size_t nmatch,
5510- regmatch_t pmatch[], int eflags)
5511-{
5512- return regexec (preg, string, nmatch, pmatch,
5513- eflags & (REG_NOTBOL | REG_NOTEOL));
5514-}
5515-compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0);
5516-# endif
5517-#endif
5518+/* EGLIBC: The code that used to be here was move to a separate file
5519+ so that it can be shared with xregex.c. */
5520+#include "regexec-compat.c"
5521
5522 /* Entry points for GNU code. */
5523
5524@@ -728,7 +713,7 @@
5525 incr = (range < 0) ? -1 : 1;
5526 left_lim = (range < 0) ? start + range : start;
5527 right_lim = (range < 0) ? start : start + range;
5528- sb = dfa->mb_cur_max == 1;
5529+ sb = dfa_mb_cur_max (dfa) == 1;
5530 match_kind =
5531 (fastmap
5532 ? ((sb || !(preg->syntax & RE_ICASE || t) ? 4 : 0)
5533@@ -3448,7 +3433,7 @@
5534 if (BE (dest_states_word[i] == NULL && err != REG_NOERROR, 0))
5535 goto out_free;
5536
5537- if (dest_states[i] != dest_states_word[i] && dfa->mb_cur_max > 1)
5538+ if (dest_states[i] != dest_states_word[i] && dfa_mb_cur_max (dfa) > 1)
5539 need_word_trtable = 1;
5540
5541 dest_states_nl[i] = re_acquire_state_context (&err, dfa, &follows,
5542@@ -3590,7 +3575,7 @@
5543 else if (type == OP_PERIOD)
5544 {
5545 #ifdef RE_ENABLE_I18N
5546- if (dfa->mb_cur_max > 1)
5547+ if (dfa_mb_cur_max (dfa) > 1)
5548 bitset_merge (accepts, dfa->sb_char);
5549 else
5550 #endif
5551@@ -3641,7 +3626,7 @@
5552 continue;
5553 }
5554 #ifdef RE_ENABLE_I18N
5555- if (dfa->mb_cur_max > 1)
5556+ if (dfa_mb_cur_max (dfa) > 1)
5557 for (j = 0; j < BITSET_WORDS; ++j)
5558 any_set |= (accepts[j] &= (dfa->word_char[j] | ~dfa->sb_char[j]));
5559 else
5560@@ -3660,7 +3645,7 @@
5561 continue;
5562 }
5563 #ifdef RE_ENABLE_I18N
5564- if (dfa->mb_cur_max > 1)
5565+ if (dfa_mb_cur_max (dfa) > 1)
5566 for (j = 0; j < BITSET_WORDS; ++j)
5567 any_set |= (accepts[j] &= ~(dfa->word_char[j] & dfa->sb_char[j]));
5568 else
5569@@ -3832,12 +3817,6 @@
5570 if (node->type == COMPLEX_BRACKET)
5571 {
5572 const re_charset_t *cset = node->opr.mbcset;
5573-# ifdef _LIBC
5574- const unsigned char *pin
5575- = ((const unsigned char *) re_string_get_buffer (input) + str_idx);
5576- int j;
5577- uint32_t nrules;
5578-# endif /* _LIBC */
5579 int match_len = 0;
5580 wchar_t wc = ((cset->nranges || cset->nchar_classes || cset->nmbchars)
5581 ? re_string_wchar_at (input, str_idx) : 0);
5582@@ -3849,6 +3828,7 @@
5583 match_len = char_len;
5584 goto check_node_accept_bytes_match;
5585 }
5586+#if __OPTION_EGLIBC_LOCALE_CODE
5587 /* match with character_class? */
5588 for (i = 0; i < cset->nchar_classes; ++i)
5589 {
5590@@ -3859,8 +3839,16 @@
5591 goto check_node_accept_bytes_match;
5592 }
5593 }
5594+#endif
5595+
5596+ /* When __OPTION_EGLIBC_LOCALE_CODE is disabled, only the C
5597+ locale is supported; it has no collation rules. */
5598+# if defined _LIBC && __OPTION_EGLIBC_LOCALE_CODE
5599+ const unsigned char *pin
5600+ = ((const unsigned char *) re_string_get_buffer (input) + str_idx);
5601+ int j;
5602+ uint32_t nrules;
5603
5604-# ifdef _LIBC
5605 nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
5606 if (nrules != 0)
5607 {
5608@@ -3953,8 +3941,12 @@
5609 }
5610 }
5611 else
5612-# endif /* _LIBC */
5613+# endif /* _LIBC && __OPTION_EGLIBC_LOCALE_CODE */
5614 {
5615+ /* In the _LIBC version, if OPTION_EGLIBC_LOCALE_CODE is
5616+ disabled, there can be no multibyte range endpoints, and
5617+ cset->nranges is always zero. */
5618+#if __OPTION_EGLIBC_LOCALE_CODE
5619 /* match with range expression? */
5620 #if __GNUC__ >= 2
5621 wchar_t cmp_buf[] = {L'\0', L'\0', wc, L'\0', L'\0', L'\0'};
5622@@ -3973,6 +3965,7 @@
5623 goto check_node_accept_bytes_match;
5624 }
5625 }
5626+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
5627 }
5628 check_node_accept_bytes_match:
5629 if (!cset->non_match)
5630@@ -3988,7 +3981,7 @@
5631 return 0;
5632 }
5633
5634-# ifdef _LIBC
5635+# if defined _LIBC && __OPTION_EGLIBC_LOCALE_CODE
5636 static unsigned int
5637 internal_function
5638 find_collation_sequence_value (const unsigned char *mbs, size_t mbs_len)
5639@@ -4046,7 +4039,7 @@
5640 return UINT_MAX;
5641 }
5642 }
5643-# endif /* _LIBC */
5644+# endif /* _LIBC && __OPTION_EGLIBC_LOCALE_CODE */
5645 #endif /* RE_ENABLE_I18N */
5646
5647 /* Check whether the node accepts the byte which is IDX-th
5648@@ -4137,7 +4130,7 @@
5649 if (pstr->icase)
5650 {
5651 #ifdef RE_ENABLE_I18N
5652- if (pstr->mb_cur_max > 1)
5653+ if (string_mb_cur_max (pstr) > 1)
5654 {
5655 ret = build_wcs_upper_buffer (pstr);
5656 if (BE (ret != REG_NOERROR, 0))
5657@@ -4150,7 +4143,7 @@
5658 else
5659 {
5660 #ifdef RE_ENABLE_I18N
5661- if (pstr->mb_cur_max > 1)
5662+ if (string_mb_cur_max (pstr) > 1)
5663 build_wcs_buffer (pstr);
5664 else
5665 #endif /* RE_ENABLE_I18N */
5666Index: git/posix/regexec-compat.c
5667===================================================================
5668--- /dev/null 1970-01-01 00:00:00.000000000 +0000
5669+++ git/posix/regexec-compat.c 2014-08-29 20:01:15.224070587 -0700
5670@@ -0,0 +1,39 @@
5671+/* Extended regular expression matching and search library.
5672+ Copyright (C) 2008 Free Software Foundation, Inc.
5673+ This file is part of the GNU C Library.
5674+ Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
5675+
5676+ The GNU C Library is free software; you can redistribute it and/or
5677+ modify it under the terms of the GNU Lesser General Public
5678+ License as published by the Free Software Foundation; either
5679+ version 2.1 of the License, or (at your option) any later version.
5680+
5681+ The GNU C Library is distributed in the hope that it will be useful,
5682+ but WITHOUT ANY WARRANTY; without even the implied warranty of
5683+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5684+ Lesser General Public License for more details.
5685+
5686+ You should have received a copy of the GNU Lesser General Public
5687+ License along with the GNU C Library; if not, write to the Free
5688+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
5689+ 02111-1307 USA. */
5690+
5691+#ifdef _LIBC
5692+# include <shlib-compat.h>
5693+versioned_symbol (libc, __regexec, regexec, GLIBC_2_3_4);
5694+
5695+# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
5696+__typeof__ (__regexec) __compat_regexec;
5697+
5698+int
5699+attribute_compat_text_section
5700+__compat_regexec (const regex_t *__restrict preg,
5701+ const char *__restrict string, size_t nmatch,
5702+ regmatch_t pmatch[], int eflags)
5703+{
5704+ return regexec (preg, string, nmatch, pmatch,
5705+ eflags & (REG_NOTBOL | REG_NOTEOL));
5706+}
5707+compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0);
5708+# endif
5709+#endif
5710Index: git/posix/regex.h
5711===================================================================
5712--- git.orig/posix/regex.h 2014-08-29 20:00:53.264070587 -0700
5713+++ git/posix/regex.h 2014-08-29 20:01:15.224070587 -0700
5714@@ -21,6 +21,7 @@
5715 #define _REGEX_H 1
5716
5717 #include <sys/types.h>
5718+#include <gnu/option-groups.h>
5719
5720 /* Allow the use in C++ code. */
5721 #ifdef __cplusplus
5722@@ -156,6 +157,8 @@
5723 treated as 'a\{1'. */
5724 # define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
5725
5726+/* EGLIBC: Old regex implementation does not support these. */
5727+# ifdef __OPTION_POSIX_REGEXP_GLIBC
5728 /* If this bit is set, then ignore case when matching.
5729 If not set, then case is significant. */
5730 # define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
5731@@ -172,6 +175,7 @@
5732 /* If this bit is set, then no_sub will be set to 1 during
5733 re_compile_pattern. */
5734 # define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
5735+# endif /* __OPTION_POSIX_REGEXP_GLIBC */
5736 #endif
5737
5738 /* This global variable defines the particular regexp syntax to use (for
5739@@ -231,8 +235,13 @@
5740 (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
5741 | RE_INTERVALS | RE_NO_EMPTY_RANGES)
5742
5743+#ifdef __OPTION_POSIX_REGEXP_GLIBC
5744 #define RE_SYNTAX_POSIX_BASIC \
5745 (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP)
5746+#else
5747+#define RE_SYNTAX_POSIX_BASIC \
5748+ (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
5749+#endif
5750
5751 /* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
5752 RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
5753@@ -298,9 +307,11 @@
5754 /* Like REG_NOTBOL, except for the end-of-line. */
5755 #define REG_NOTEOL (1 << 1)
5756
5757+#ifdef __OPTION_POSIX_REGEXP_GLIBC
5758 /* Use PMATCH[0] to delimit the start and end of the search in the
5759 buffer. */
5760 #define REG_STARTEND (1 << 2)
5761+#endif
5762
5763
5764 /* If any error codes are removed, changed, or added, update the
5765Index: git/posix/regex_internal.c
5766===================================================================
5767--- git.orig/posix/regex_internal.c 2014-08-29 20:00:53.264070587 -0700
5768+++ git/posix/regex_internal.c 2014-08-29 20:01:15.224070587 -0700
5769@@ -43,8 +43,8 @@
5770 int init_buf_len;
5771
5772 /* Ensure at least one character fits into the buffers. */
5773- if (init_len < dfa->mb_cur_max)
5774- init_len = dfa->mb_cur_max;
5775+ if (init_len < dfa_mb_cur_max (dfa))
5776+ init_len = dfa_mb_cur_max (dfa);
5777 init_buf_len = (len + 1 < init_len) ? len + 1: init_len;
5778 re_string_construct_common (str, len, pstr, trans, icase, dfa);
5779
5780@@ -55,7 +55,7 @@
5781 pstr->word_char = dfa->word_char;
5782 pstr->word_ops_used = dfa->word_ops_used;
5783 pstr->mbs = pstr->mbs_allocated ? pstr->mbs : (unsigned char *) str;
5784- pstr->valid_len = (pstr->mbs_allocated || dfa->mb_cur_max > 1) ? 0 : len;
5785+ pstr->valid_len = (pstr->mbs_allocated || dfa_mb_cur_max (dfa) > 1) ? 0 : len;
5786 pstr->valid_raw_len = pstr->valid_len;
5787 return REG_NOERROR;
5788 }
5789@@ -82,7 +82,7 @@
5790 if (icase)
5791 {
5792 #ifdef RE_ENABLE_I18N
5793- if (dfa->mb_cur_max > 1)
5794+ if (dfa_mb_cur_max (dfa) > 1)
5795 {
5796 while (1)
5797 {
5798@@ -91,7 +91,7 @@
5799 return ret;
5800 if (pstr->valid_raw_len >= len)
5801 break;
5802- if (pstr->bufs_len > pstr->valid_len + dfa->mb_cur_max)
5803+ if (pstr->bufs_len > pstr->valid_len + dfa_mb_cur_max (dfa))
5804 break;
5805 ret = re_string_realloc_buffers (pstr, pstr->bufs_len * 2);
5806 if (BE (ret != REG_NOERROR, 0))
5807@@ -105,7 +105,7 @@
5808 else
5809 {
5810 #ifdef RE_ENABLE_I18N
5811- if (dfa->mb_cur_max > 1)
5812+ if (dfa_mb_cur_max (dfa) > 1)
5813 build_wcs_buffer (pstr);
5814 else
5815 #endif /* RE_ENABLE_I18N */
5816@@ -130,7 +130,7 @@
5817 re_string_realloc_buffers (re_string_t *pstr, int new_buf_len)
5818 {
5819 #ifdef RE_ENABLE_I18N
5820- if (pstr->mb_cur_max > 1)
5821+ if (string_mb_cur_max (pstr) > 1)
5822 {
5823 wint_t *new_wcs;
5824
5825@@ -177,7 +177,7 @@
5826 pstr->trans = trans;
5827 pstr->icase = icase ? 1 : 0;
5828 pstr->mbs_allocated = (trans != NULL || icase);
5829- pstr->mb_cur_max = dfa->mb_cur_max;
5830+ pstr->mb_cur_max = dfa_mb_cur_max (dfa);
5831 pstr->is_utf8 = dfa->is_utf8;
5832 pstr->map_notascii = dfa->map_notascii;
5833 pstr->stop = pstr->len;
5834@@ -203,7 +203,7 @@
5835 {
5836 #ifdef _LIBC
5837 unsigned char buf[MB_LEN_MAX];
5838- assert (MB_LEN_MAX >= pstr->mb_cur_max);
5839+ assert (MB_LEN_MAX >= string_mb_cur_max (pstr));
5840 #else
5841 unsigned char buf[64];
5842 #endif
5843@@ -226,7 +226,7 @@
5844 {
5845 int i, ch;
5846
5847- for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i)
5848+ for (i = 0; i < string_mb_cur_max (pstr) && i < remain_len; ++i)
5849 {
5850 ch = pstr->raw_mbs [pstr->raw_mbs_idx + byte_idx + i];
5851 buf[i] = pstr->mbs[byte_idx + i] = pstr->trans[ch];
5852@@ -275,7 +275,7 @@
5853 size_t mbclen;
5854 #ifdef _LIBC
5855 char buf[MB_LEN_MAX];
5856- assert (MB_LEN_MAX >= pstr->mb_cur_max);
5857+ assert (MB_LEN_MAX >= string_mb_cur_max (pstr));
5858 #else
5859 char buf[64];
5860 #endif
5861@@ -369,7 +369,7 @@
5862 {
5863 int i, ch;
5864
5865- for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i)
5866+ for (i = 0; i < string_mb_cur_max (pstr) && i < remain_len; ++i)
5867 {
5868 ch = pstr->raw_mbs [pstr->raw_mbs_idx + src_idx + i];
5869 buf[i] = pstr->trans[ch];
5870@@ -567,8 +567,9 @@
5871 }
5872
5873 /* This function re-construct the buffers.
5874- Concretely, convert to wide character in case of pstr->mb_cur_max > 1,
5875- convert to upper case in case of REG_ICASE, apply translation. */
5876+ Concretely, convert to wide character in case of
5877+ string_mb_cur_max (pstr) > 1, convert to upper case in case of
5878+ REG_ICASE, apply translation. */
5879
5880 static reg_errcode_t
5881 internal_function __attribute_warn_unused_result__
5882@@ -579,7 +580,7 @@
5883 {
5884 /* Reset buffer. */
5885 #ifdef RE_ENABLE_I18N
5886- if (pstr->mb_cur_max > 1)
5887+ if (string_mb_cur_max (pstr) > 1)
5888 memset (&pstr->cur_state, '\0', sizeof (mbstate_t));
5889 #endif /* RE_ENABLE_I18N */
5890 pstr->len = pstr->raw_len;
5891@@ -670,7 +671,7 @@
5892 pstr->tip_context = re_string_context_at (pstr, offset - 1,
5893 eflags);
5894 #ifdef RE_ENABLE_I18N
5895- if (pstr->mb_cur_max > 1)
5896+ if (string_mb_cur_max (pstr) > 1)
5897 memmove (pstr->wcs, pstr->wcs + offset,
5898 (pstr->valid_len - offset) * sizeof (wint_t));
5899 #endif /* RE_ENABLE_I18N */
5900@@ -699,7 +700,7 @@
5901 #endif
5902 pstr->valid_len = 0;
5903 #ifdef RE_ENABLE_I18N
5904- if (pstr->mb_cur_max > 1)
5905+ if (string_mb_cur_max (pstr) > 1)
5906 {
5907 int wcs_idx;
5908 wint_t wc = WEOF;
5909@@ -711,7 +712,7 @@
5910 /* Special case UTF-8. Multi-byte chars start with any
5911 byte other than 0x80 - 0xbf. */
5912 raw = pstr->raw_mbs + pstr->raw_mbs_idx;
5913- end = raw + (offset - pstr->mb_cur_max);
5914+ end = raw + (offset - string_mb_cur_max (pstr));
5915 if (end < pstr->raw_mbs)
5916 end = pstr->raw_mbs;
5917 p = raw + offset - 1;
5918@@ -803,7 +804,7 @@
5919
5920 /* Then build the buffers. */
5921 #ifdef RE_ENABLE_I18N
5922- if (pstr->mb_cur_max > 1)
5923+ if (string_mb_cur_max (pstr) > 1)
5924 {
5925 if (pstr->icase)
5926 {
5927@@ -841,7 +842,7 @@
5928 return re_string_peek_byte (pstr, idx);
5929
5930 #ifdef RE_ENABLE_I18N
5931- if (pstr->mb_cur_max > 1
5932+ if (string_mb_cur_max (pstr) > 1
5933 && ! re_string_is_single_byte_char (pstr, pstr->cur_idx + idx))
5934 return re_string_peek_byte (pstr, idx);
5935 #endif
5936@@ -930,7 +931,7 @@
5937 return ((eflags & REG_NOTEOL) ? CONTEXT_ENDBUF
5938 : CONTEXT_NEWLINE | CONTEXT_ENDBUF);
5939 #ifdef RE_ENABLE_I18N
5940- if (input->mb_cur_max > 1)
5941+ if (string_mb_cur_max (input) > 1)
5942 {
5943 wint_t wc;
5944 int wc_idx = idx;
5945@@ -1444,7 +1445,7 @@
5946 dfa->nodes[dfa->nodes_len].constraint = 0;
5947 #ifdef RE_ENABLE_I18N
5948 dfa->nodes[dfa->nodes_len].accept_mb =
5949- (type == OP_PERIOD && dfa->mb_cur_max > 1) || type == COMPLEX_BRACKET;
5950+ (type == OP_PERIOD && dfa_mb_cur_max (dfa) > 1) || type == COMPLEX_BRACKET;
5951 #endif
5952 dfa->nexts[dfa->nodes_len] = -1;
5953 re_node_set_init_empty (dfa->edests + dfa->nodes_len);
5954Index: git/posix/regex_internal.h
5955===================================================================
5956--- git.orig/posix/regex_internal.h 2014-08-29 20:00:53.264070587 -0700
5957+++ git/posix/regex_internal.h 2014-08-29 20:01:15.224070587 -0700
5958@@ -26,6 +26,10 @@
5959 #include <stdlib.h>
5960 #include <string.h>
5961
5962+#if defined _LIBC
5963+# include <gnu/option-groups.h>
5964+#endif
5965+
5966 #if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET || defined _LIBC
5967 # include <langinfo.h>
5968 #endif
5969@@ -370,6 +374,13 @@
5970 };
5971 typedef struct re_string_t re_string_t;
5972
5973+/* When OPTION_EGLIBC_LOCALE_CODE is disabled, this is always 1;
5974+ help the compiler make use of that fact. */
5975+#if __OPTION_EGLIBC_LOCALE_CODE
5976+# define string_mb_cur_max(str) ((str)->mb_cur_max + 0)
5977+#else
5978+# define string_mb_cur_max(str) (1)
5979+#endif
5980
5981 struct re_dfa_t;
5982 typedef struct re_dfa_t re_dfa_t;
5983@@ -655,6 +666,14 @@
5984 __libc_lock_define (, lock)
5985 };
5986
5987+/* When OPTION_EGLIBC_LOCALE_CODE is disabled, this is always 1;
5988+ help the compiler make use of that fact. */
5989+#if __OPTION_EGLIBC_LOCALE_CODE
5990+# define dfa_mb_cur_max(dfa) ((dfa)->mb_cur_max + 0)
5991+#else
5992+# define dfa_mb_cur_max(dfa) (1)
5993+#endif
5994+
5995 #define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set))
5996 #define re_node_set_remove(set,id) \
5997 (re_node_set_remove_at (set, re_node_set_contains (set, id) - 1))
5998@@ -715,7 +734,7 @@
5999 re_string_char_size_at (const re_string_t *pstr, int idx)
6000 {
6001 int byte_idx;
6002- if (pstr->mb_cur_max == 1)
6003+ if (string_mb_cur_max (pstr) == 1)
6004 return 1;
6005 for (byte_idx = 1; idx + byte_idx < pstr->valid_len; ++byte_idx)
6006 if (pstr->wcs[idx + byte_idx] != WEOF)
6007@@ -727,7 +746,7 @@
6008 internal_function __attribute__ ((pure, unused))
6009 re_string_wchar_at (const re_string_t *pstr, int idx)
6010 {
6011- if (pstr->mb_cur_max == 1)
6012+ if (string_mb_cur_max (pstr) == 1)
6013 return (wint_t) pstr->mbs[idx];
6014 return (wint_t) pstr->wcs[idx];
6015 }
6016Index: git/posix/xregex.c
6017===================================================================
6018--- /dev/null 1970-01-01 00:00:00.000000000 +0000
6019+++ git/posix/xregex.c 2014-08-29 20:01:15.228070587 -0700
6020@@ -0,0 +1,8212 @@
6021+/* Extended regular expression matching and search library,
6022+ version 0.12.
6023+ (Implements POSIX draft P1003.2/D11.2, except for some of the
6024+ internationalization features.)
6025+
6026+ Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
6027+ 2002, 2005 Free Software Foundation, Inc.
6028+ This file is part of the GNU C Library.
6029+
6030+ The GNU C Library is free software; you can redistribute it and/or
6031+ modify it under the terms of the GNU Lesser General Public
6032+ License as published by the Free Software Foundation; either
6033+ version 2.1 of the License, or (at your option) any later version.
6034+
6035+ The GNU C Library is distributed in the hope that it will be useful,
6036+ but WITHOUT ANY WARRANTY; without even the implied warranty of
6037+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6038+ Lesser General Public License for more details.
6039+
6040+ You should have received a copy of the GNU Lesser General Public
6041+ License along with the GNU C Library; if not, write to the Free
6042+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
6043+ 02110-1301 USA. */
6044+
6045+/* AIX requires this to be the first thing in the file. */
6046+#if defined _AIX && !defined __GNUC__ && !defined REGEX_MALLOC
6047+ #pragma alloca
6048+#endif
6049+
6050+#undef _GNU_SOURCE
6051+#define _GNU_SOURCE
6052+
6053+#ifndef INSIDE_RECURSION
6054+# ifdef HAVE_CONFIG_H
6055+# include <config.h>
6056+# endif
6057+#endif
6058+
6059+/*#include <ansidecl.h>*/
6060+
6061+#ifndef INSIDE_RECURSION
6062+
6063+# if defined STDC_HEADERS && !defined emacs
6064+# include <stddef.h>
6065+# else
6066+/* We need this for `regex.h', and perhaps for the Emacs include files. */
6067+# include <sys/types.h>
6068+# endif
6069+
6070+# define WIDE_CHAR_SUPPORT (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC)
6071+
6072+/* For platform which support the ISO C amendement 1 functionality we
6073+ support user defined character classes. */
6074+# if WIDE_CHAR_SUPPORT
6075+/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
6076+# include <wchar.h>
6077+# include <wctype.h>
6078+# endif
6079+
6080+# ifdef _LIBC
6081+/* We have to keep the namespace clean. */
6082+# define regfree(preg) __regfree (preg)
6083+# define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef)
6084+# define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags)
6085+# define regerror(errcode, preg, errbuf, errbuf_size) \
6086+ __regerror(errcode, preg, errbuf, errbuf_size)
6087+# define re_set_registers(bu, re, nu, st, en) \
6088+ __re_set_registers (bu, re, nu, st, en)
6089+# define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \
6090+ __re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
6091+# define re_match(bufp, string, size, pos, regs) \
6092+ __re_match (bufp, string, size, pos, regs)
6093+# define re_search(bufp, string, size, startpos, range, regs) \
6094+ __re_search (bufp, string, size, startpos, range, regs)
6095+# define re_compile_pattern(pattern, length, bufp) \
6096+ __re_compile_pattern (pattern, length, bufp)
6097+# define re_set_syntax(syntax) __re_set_syntax (syntax)
6098+# define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \
6099+ __re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)
6100+# define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
6101+
6102+# define btowc __btowc
6103+
6104+/* We are also using some library internals. */
6105+# include <locale/localeinfo.h>
6106+# include <locale/elem-hash.h>
6107+# include <langinfo.h>
6108+# include <locale/coll-lookup.h>
6109+# endif
6110+
6111+/* This is for other GNU distributions with internationalized messages. */
6112+# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
6113+# include <libintl.h>
6114+# ifdef _LIBC
6115+# undef gettext
6116+# define gettext(msgid) __dcgettext ("libc", msgid, LC_MESSAGES)
6117+# endif
6118+# else
6119+# define gettext(msgid) (msgid)
6120+# endif
6121+
6122+# ifndef gettext_noop
6123+/* This define is so xgettext can find the internationalizable
6124+ strings. */
6125+# define gettext_noop(String) String
6126+# endif
6127+
6128+/* The `emacs' switch turns on certain matching commands
6129+ that make sense only in Emacs. */
6130+# ifdef emacs
6131+
6132+# include "lisp.h"
6133+# include "buffer.h"
6134+# include "syntax.h"
6135+
6136+# else /* not emacs */
6137+
6138+/* If we are not linking with Emacs proper,
6139+ we can't use the relocating allocator
6140+ even if config.h says that we can. */
6141+# undef REL_ALLOC
6142+
6143+# if defined STDC_HEADERS || defined _LIBC
6144+# include <stdlib.h>
6145+# else
6146+char *malloc ();
6147+char *realloc ();
6148+# endif
6149+
6150+/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow.
6151+ If nothing else has been done, use the method below. */
6152+# ifdef INHIBIT_STRING_HEADER
6153+# if !(defined HAVE_BZERO && defined HAVE_BCOPY)
6154+# if !defined bzero && !defined bcopy
6155+# undef INHIBIT_STRING_HEADER
6156+# endif
6157+# endif
6158+# endif
6159+
6160+/* This is the normal way of making sure we have a bcopy and a bzero.
6161+ This is used in most programs--a few other programs avoid this
6162+ by defining INHIBIT_STRING_HEADER. */
6163+# ifndef INHIBIT_STRING_HEADER
6164+# if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC
6165+# include <string.h>
6166+# ifndef bzero
6167+# ifndef _LIBC
6168+# define bzero(s, n) (memset (s, '\0', n), (s))
6169+# else
6170+# define bzero(s, n) __bzero (s, n)
6171+# endif
6172+# endif
6173+# else
6174+# include <strings.h>
6175+# ifndef memcmp
6176+# define memcmp(s1, s2, n) bcmp (s1, s2, n)
6177+# endif
6178+# ifndef memcpy
6179+# define memcpy(d, s, n) (bcopy (s, d, n), (d))
6180+# endif
6181+# endif
6182+# endif
6183+
6184+/* Define the syntax stuff for \<, \>, etc. */
6185+
6186+/* This must be nonzero for the wordchar and notwordchar pattern
6187+ commands in re_match_2. */
6188+# ifndef Sword
6189+# define Sword 1
6190+# endif
6191+
6192+# ifdef SWITCH_ENUM_BUG
6193+# define SWITCH_ENUM_CAST(x) ((int)(x))
6194+# else
6195+# define SWITCH_ENUM_CAST(x) (x)
6196+# endif
6197+
6198+# endif /* not emacs */
6199+
6200+# if defined _LIBC || HAVE_LIMITS_H
6201+# include <limits.h>
6202+# endif
6203+
6204+# ifndef MB_LEN_MAX
6205+# define MB_LEN_MAX 1
6206+# endif
6207+
6208+/* Get the interface, including the syntax bits. */
6209+# include "regex.h"
6210+
6211+/* isalpha etc. are used for the character classes. */
6212+# include <ctype.h>
6213+
6214+/* Jim Meyering writes:
6215+
6216+ "... Some ctype macros are valid only for character codes that
6217+ isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
6218+ using /bin/cc or gcc but without giving an ansi option). So, all
6219+ ctype uses should be through macros like ISPRINT... If
6220+ STDC_HEADERS is defined, then autoconf has verified that the ctype
6221+ macros don't need to be guarded with references to isascii. ...
6222+ Defining isascii to 1 should let any compiler worth its salt
6223+ eliminate the && through constant folding."
6224+ Solaris defines some of these symbols so we must undefine them first. */
6225+
6226+# undef ISASCII
6227+# if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII)
6228+# define ISASCII(c) 1
6229+# else
6230+# define ISASCII(c) isascii(c)
6231+# endif
6232+
6233+# ifdef isblank
6234+# define ISBLANK(c) (ISASCII (c) && isblank (c))
6235+# else
6236+# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
6237+# endif
6238+# ifdef isgraph
6239+# define ISGRAPH(c) (ISASCII (c) && isgraph (c))
6240+# else
6241+# define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
6242+# endif
6243+
6244+# undef ISPRINT
6245+# define ISPRINT(c) (ISASCII (c) && isprint (c))
6246+# define ISDIGIT(c) (ISASCII (c) && isdigit (c))
6247+# define ISALNUM(c) (ISASCII (c) && isalnum (c))
6248+# define ISALPHA(c) (ISASCII (c) && isalpha (c))
6249+# define ISCNTRL(c) (ISASCII (c) && iscntrl (c))
6250+# define ISLOWER(c) (ISASCII (c) && islower (c))
6251+# define ISPUNCT(c) (ISASCII (c) && ispunct (c))
6252+# define ISSPACE(c) (ISASCII (c) && isspace (c))
6253+# define ISUPPER(c) (ISASCII (c) && isupper (c))
6254+# define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
6255+
6256+# ifdef _tolower
6257+# define TOLOWER(c) _tolower(c)
6258+# else
6259+# define TOLOWER(c) tolower(c)
6260+# endif
6261+
6262+# ifndef NULL
6263+# define NULL (void *)0
6264+# endif
6265+
6266+/* We remove any previous definition of `SIGN_EXTEND_CHAR',
6267+ since ours (we hope) works properly with all combinations of
6268+ machines, compilers, `char' and `unsigned char' argument types.
6269+ (Per Bothner suggested the basic approach.) */
6270+# undef SIGN_EXTEND_CHAR
6271+# if __STDC__
6272+# define SIGN_EXTEND_CHAR(c) ((signed char) (c))
6273+# else /* not __STDC__ */
6274+/* As in Harbison and Steele. */
6275+# define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
6276+# endif
6277+
6278+# ifndef emacs
6279+/* How many characters in the character set. */
6280+# define CHAR_SET_SIZE 256
6281+
6282+# ifdef SYNTAX_TABLE
6283+
6284+extern char *re_syntax_table;
6285+
6286+# else /* not SYNTAX_TABLE */
6287+
6288+static char re_syntax_table[CHAR_SET_SIZE];
6289+
6290+static void init_syntax_once (void);
6291+
6292+static void
6293+init_syntax_once (void)
6294+{
6295+ register int c;
6296+ static int done = 0;
6297+
6298+ if (done)
6299+ return;
6300+ bzero (re_syntax_table, sizeof re_syntax_table);
6301+
6302+ for (c = 0; c < CHAR_SET_SIZE; ++c)
6303+ if (ISALNUM (c))
6304+ re_syntax_table[c] = Sword;
6305+
6306+ re_syntax_table['_'] = Sword;
6307+
6308+ done = 1;
6309+}
6310+
6311+# endif /* not SYNTAX_TABLE */
6312+
6313+# define SYNTAX(c) re_syntax_table[(unsigned char) (c)]
6314+
6315+# endif /* emacs */
6316+
6317+/* Integer type for pointers. */
6318+# if !defined _LIBC && !defined HAVE_UINTPTR_T
6319+typedef unsigned long int uintptr_t;
6320+# endif
6321+
6322+/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we
6323+ use `alloca' instead of `malloc'. This is because using malloc in
6324+ re_search* or re_match* could cause memory leaks when C-g is used in
6325+ Emacs; also, malloc is slower and causes storage fragmentation. On
6326+ the other hand, malloc is more portable, and easier to debug.
6327+
6328+ Because we sometimes use alloca, some routines have to be macros,
6329+ not functions -- `alloca'-allocated space disappears at the end of the
6330+ function it is called in. */
6331+
6332+# ifdef REGEX_MALLOC
6333+
6334+# define REGEX_ALLOCATE malloc
6335+# define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize)
6336+# define REGEX_FREE free
6337+
6338+# else /* not REGEX_MALLOC */
6339+
6340+/* Emacs already defines alloca, sometimes. */
6341+# ifndef alloca
6342+
6343+/* Make alloca work the best possible way. */
6344+# ifdef __GNUC__
6345+# define alloca __builtin_alloca
6346+# else /* not __GNUC__ */
6347+# if HAVE_ALLOCA_H
6348+# include <alloca.h>
6349+# endif /* HAVE_ALLOCA_H */
6350+# endif /* not __GNUC__ */
6351+
6352+# endif /* not alloca */
6353+
6354+# define REGEX_ALLOCATE alloca
6355+
6356+/* Assumes a `char *destination' variable. */
6357+# define REGEX_REALLOCATE(source, osize, nsize) \
6358+ (destination = (char *) alloca (nsize), \
6359+ memcpy (destination, source, osize))
6360+
6361+/* No need to do anything to free, after alloca. */
6362+# define REGEX_FREE(arg) ((void)0) /* Do nothing! But inhibit gcc warning. */
6363+
6364+# endif /* not REGEX_MALLOC */
6365+
6366+/* Define how to allocate the failure stack. */
6367+
6368+# if defined REL_ALLOC && defined REGEX_MALLOC
6369+
6370+# define REGEX_ALLOCATE_STACK(size) \
6371+ r_alloc (&failure_stack_ptr, (size))
6372+# define REGEX_REALLOCATE_STACK(source, osize, nsize) \
6373+ r_re_alloc (&failure_stack_ptr, (nsize))
6374+# define REGEX_FREE_STACK(ptr) \
6375+ r_alloc_free (&failure_stack_ptr)
6376+
6377+# else /* not using relocating allocator */
6378+
6379+# ifdef REGEX_MALLOC
6380+
6381+# define REGEX_ALLOCATE_STACK malloc
6382+# define REGEX_REALLOCATE_STACK(source, osize, nsize) realloc (source, nsize)
6383+# define REGEX_FREE_STACK free
6384+
6385+# else /* not REGEX_MALLOC */
6386+
6387+# define REGEX_ALLOCATE_STACK alloca
6388+
6389+# define REGEX_REALLOCATE_STACK(source, osize, nsize) \
6390+ REGEX_REALLOCATE (source, osize, nsize)
6391+/* No need to explicitly free anything. */
6392+# define REGEX_FREE_STACK(arg)
6393+
6394+# endif /* not REGEX_MALLOC */
6395+# endif /* not using relocating allocator */
6396+
6397+
6398+/* True if `size1' is non-NULL and PTR is pointing anywhere inside
6399+ `string1' or just past its end. This works if PTR is NULL, which is
6400+ a good thing. */
6401+# define FIRST_STRING_P(ptr) \
6402+ (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
6403+
6404+/* (Re)Allocate N items of type T using malloc, or fail. */
6405+# define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t)))
6406+# define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t)))
6407+# define RETALLOC_IF(addr, n, t) \
6408+ if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t)
6409+# define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))
6410+
6411+# define BYTEWIDTH 8 /* In bits. */
6412+
6413+# define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
6414+
6415+# undef MAX
6416+# undef MIN
6417+# define MAX(a, b) ((a) > (b) ? (a) : (b))
6418+# define MIN(a, b) ((a) < (b) ? (a) : (b))
6419+
6420+typedef char boolean;
6421+# define false 0
6422+# define true 1
6423+
6424+static reg_errcode_t byte_regex_compile (const char *pattern, size_t size,
6425+ reg_syntax_t syntax,
6426+ struct re_pattern_buffer *bufp);
6427+
6428+static int byte_re_match_2_internal (struct re_pattern_buffer *bufp,
6429+ const char *string1, int size1,
6430+ const char *string2, int size2,
6431+ int pos,
6432+ struct re_registers *regs,
6433+ int stop);
6434+static int byte_re_search_2 (struct re_pattern_buffer *bufp,
6435+ const char *string1, int size1,
6436+ const char *string2, int size2,
6437+ int startpos, int range,
6438+ struct re_registers *regs, int stop);
6439+static int byte_re_compile_fastmap (struct re_pattern_buffer *bufp);
6440+
6441+#ifdef MBS_SUPPORT
6442+static reg_errcode_t wcs_regex_compile (const char *pattern, size_t size,
6443+ reg_syntax_t syntax,
6444+ struct re_pattern_buffer *bufp);
6445+
6446+
6447+static int wcs_re_match_2_internal (struct re_pattern_buffer *bufp,
6448+ const char *cstring1, int csize1,
6449+ const char *cstring2, int csize2,
6450+ int pos,
6451+ struct re_registers *regs,
6452+ int stop,
6453+ wchar_t *string1, int size1,
6454+ wchar_t *string2, int size2,
6455+ int *mbs_offset1, int *mbs_offset2);
6456+static int wcs_re_search_2 (struct re_pattern_buffer *bufp,
6457+ const char *string1, int size1,
6458+ const char *string2, int size2,
6459+ int startpos, int range,
6460+ struct re_registers *regs, int stop);
6461+static int wcs_re_compile_fastmap (struct re_pattern_buffer *bufp);
6462+#endif
6463+
6464+/* These are the command codes that appear in compiled regular
6465+ expressions. Some opcodes are followed by argument bytes. A
6466+ command code can specify any interpretation whatsoever for its
6467+ arguments. Zero bytes may appear in the compiled regular expression. */
6468+
6469+typedef enum
6470+{
6471+ no_op = 0,
6472+
6473+ /* Succeed right away--no more backtracking. */
6474+ succeed,
6475+
6476+ /* Followed by one byte giving n, then by n literal bytes. */
6477+ exactn,
6478+
6479+# ifdef MBS_SUPPORT
6480+ /* Same as exactn, but contains binary data. */
6481+ exactn_bin,
6482+# endif
6483+
6484+ /* Matches any (more or less) character. */
6485+ anychar,
6486+
6487+ /* Matches any one char belonging to specified set. First
6488+ following byte is number of bitmap bytes. Then come bytes
6489+ for a bitmap saying which chars are in. Bits in each byte
6490+ are ordered low-bit-first. A character is in the set if its
6491+ bit is 1. A character too large to have a bit in the map is
6492+ automatically not in the set. */
6493+ /* ifdef MBS_SUPPORT, following element is length of character
6494+ classes, length of collating symbols, length of equivalence
6495+ classes, length of character ranges, and length of characters.
6496+ Next, character class element, collating symbols elements,
6497+ equivalence class elements, range elements, and character
6498+ elements follow.
6499+ See regex_compile function. */
6500+ charset,
6501+
6502+ /* Same parameters as charset, but match any character that is
6503+ not one of those specified. */
6504+ charset_not,
6505+
6506+ /* Start remembering the text that is matched, for storing in a
6507+ register. Followed by one byte with the register number, in
6508+ the range 0 to one less than the pattern buffer's re_nsub
6509+ field. Then followed by one byte with the number of groups
6510+ inner to this one. (This last has to be part of the
6511+ start_memory only because we need it in the on_failure_jump
6512+ of re_match_2.) */
6513+ start_memory,
6514+
6515+ /* Stop remembering the text that is matched and store it in a
6516+ memory register. Followed by one byte with the register
6517+ number, in the range 0 to one less than `re_nsub' in the
6518+ pattern buffer, and one byte with the number of inner groups,
6519+ just like `start_memory'. (We need the number of inner
6520+ groups here because we don't have any easy way of finding the
6521+ corresponding start_memory when we're at a stop_memory.) */
6522+ stop_memory,
6523+
6524+ /* Match a duplicate of something remembered. Followed by one
6525+ byte containing the register number. */
6526+ duplicate,
6527+
6528+ /* Fail unless at beginning of line. */
6529+ begline,
6530+
6531+ /* Fail unless at end of line. */
6532+ endline,
6533+
6534+ /* Succeeds if at beginning of buffer (if emacs) or at beginning
6535+ of string to be matched (if not). */
6536+ begbuf,
6537+
6538+ /* Analogously, for end of buffer/string. */
6539+ endbuf,
6540+
6541+ /* Followed by two byte relative address to which to jump. */
6542+ jump,
6543+
6544+ /* Same as jump, but marks the end of an alternative. */
6545+ jump_past_alt,
6546+
6547+ /* Followed by two-byte relative address of place to resume at
6548+ in case of failure. */
6549+ /* ifdef MBS_SUPPORT, the size of address is 1. */
6550+ on_failure_jump,
6551+
6552+ /* Like on_failure_jump, but pushes a placeholder instead of the
6553+ current string position when executed. */
6554+ on_failure_keep_string_jump,
6555+
6556+ /* Throw away latest failure point and then jump to following
6557+ two-byte relative address. */
6558+ /* ifdef MBS_SUPPORT, the size of address is 1. */
6559+ pop_failure_jump,
6560+
6561+ /* Change to pop_failure_jump if know won't have to backtrack to
6562+ match; otherwise change to jump. This is used to jump
6563+ back to the beginning of a repeat. If what follows this jump
6564+ clearly won't match what the repeat does, such that we can be
6565+ sure that there is no use backtracking out of repetitions
6566+ already matched, then we change it to a pop_failure_jump.
6567+ Followed by two-byte address. */
6568+ /* ifdef MBS_SUPPORT, the size of address is 1. */
6569+ maybe_pop_jump,
6570+
6571+ /* Jump to following two-byte address, and push a dummy failure
6572+ point. This failure point will be thrown away if an attempt
6573+ is made to use it for a failure. A `+' construct makes this
6574+ before the first repeat. Also used as an intermediary kind
6575+ of jump when compiling an alternative. */
6576+ /* ifdef MBS_SUPPORT, the size of address is 1. */
6577+ dummy_failure_jump,
6578+
6579+ /* Push a dummy failure point and continue. Used at the end of
6580+ alternatives. */
6581+ push_dummy_failure,
6582+
6583+ /* Followed by two-byte relative address and two-byte number n.
6584+ After matching N times, jump to the address upon failure. */
6585+ /* ifdef MBS_SUPPORT, the size of address is 1. */
6586+ succeed_n,
6587+
6588+ /* Followed by two-byte relative address, and two-byte number n.
6589+ Jump to the address N times, then fail. */
6590+ /* ifdef MBS_SUPPORT, the size of address is 1. */
6591+ jump_n,
6592+
6593+ /* Set the following two-byte relative address to the
6594+ subsequent two-byte number. The address *includes* the two
6595+ bytes of number. */
6596+ /* ifdef MBS_SUPPORT, the size of address is 1. */
6597+ set_number_at,
6598+
6599+ wordchar, /* Matches any word-constituent character. */
6600+ notwordchar, /* Matches any char that is not a word-constituent. */
6601+
6602+ wordbeg, /* Succeeds if at word beginning. */
6603+ wordend, /* Succeeds if at word end. */
6604+
6605+ wordbound, /* Succeeds if at a word boundary. */
6606+ notwordbound /* Succeeds if not at a word boundary. */
6607+
6608+# ifdef emacs
6609+ ,before_dot, /* Succeeds if before point. */
6610+ at_dot, /* Succeeds if at point. */
6611+ after_dot, /* Succeeds if after point. */
6612+
6613+ /* Matches any character whose syntax is specified. Followed by
6614+ a byte which contains a syntax code, e.g., Sword. */
6615+ syntaxspec,
6616+
6617+ /* Matches any character whose syntax is not that specified. */
6618+ notsyntaxspec
6619+# endif /* emacs */
6620+} re_opcode_t;
6621+#endif /* not INSIDE_RECURSION */
6622+
6623+
6624+#ifdef BYTE
6625+# define CHAR_T char
6626+# define UCHAR_T unsigned char
6627+# define COMPILED_BUFFER_VAR bufp->buffer
6628+# define OFFSET_ADDRESS_SIZE 2
6629+# define PREFIX(name) byte_##name
6630+# define ARG_PREFIX(name) name
6631+# define PUT_CHAR(c) putchar (c)
6632+#else
6633+# ifdef WCHAR
6634+# define CHAR_T wchar_t
6635+# define UCHAR_T wchar_t
6636+# define COMPILED_BUFFER_VAR wc_buffer
6637+# define OFFSET_ADDRESS_SIZE 1 /* the size which STORE_NUMBER macro use */
6638+# define CHAR_CLASS_SIZE ((__alignof__(wctype_t)+sizeof(wctype_t))/sizeof(CHAR_T)+1)
6639+# define PREFIX(name) wcs_##name
6640+# define ARG_PREFIX(name) c##name
6641+/* Should we use wide stream?? */
6642+# define PUT_CHAR(c) printf ("%C", c);
6643+# define TRUE 1
6644+# define FALSE 0
6645+# else
6646+# ifdef MBS_SUPPORT
6647+# define WCHAR
6648+# define INSIDE_RECURSION
6649+# include "xregex.c"
6650+# undef INSIDE_RECURSION
6651+# endif
6652+# define BYTE
6653+# define INSIDE_RECURSION
6654+# include "xregex.c"
6655+# undef INSIDE_RECURSION
6656+# endif
6657+#endif
6658+
6659+#ifdef INSIDE_RECURSION
6660+/* Common operations on the compiled pattern. */
6661+
6662+/* Store NUMBER in two contiguous bytes starting at DESTINATION. */
6663+/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
6664+
6665+# ifdef WCHAR
6666+# define STORE_NUMBER(destination, number) \
6667+ do { \
6668+ *(destination) = (UCHAR_T)(number); \
6669+ } while (0)
6670+# else /* BYTE */
6671+# define STORE_NUMBER(destination, number) \
6672+ do { \
6673+ (destination)[0] = (number) & 0377; \
6674+ (destination)[1] = (number) >> 8; \
6675+ } while (0)
6676+# endif /* WCHAR */
6677+
6678+/* Same as STORE_NUMBER, except increment DESTINATION to
6679+ the byte after where the number is stored. Therefore, DESTINATION
6680+ must be an lvalue. */
6681+/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
6682+
6683+# define STORE_NUMBER_AND_INCR(destination, number) \
6684+ do { \
6685+ STORE_NUMBER (destination, number); \
6686+ (destination) += OFFSET_ADDRESS_SIZE; \
6687+ } while (0)
6688+
6689+/* Put into DESTINATION a number stored in two contiguous bytes starting
6690+ at SOURCE. */
6691+/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
6692+
6693+# ifdef WCHAR
6694+# define EXTRACT_NUMBER(destination, source) \
6695+ do { \
6696+ (destination) = *(source); \
6697+ } while (0)
6698+# else /* BYTE */
6699+# define EXTRACT_NUMBER(destination, source) \
6700+ do { \
6701+ (destination) = *(source) & 0377; \
6702+ (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \
6703+ } while (0)
6704+# endif
6705+
6706+# ifdef DEBUG
6707+static void PREFIX(extract_number) (int *dest, UCHAR_T *source);
6708+static void
6709+PREFIX(extract_number) (int *dest, UCHAR_T *source)
6710+{
6711+# ifdef WCHAR
6712+ *dest = *source;
6713+# else /* BYTE */
6714+ int temp = SIGN_EXTEND_CHAR (*(source + 1));
6715+ *dest = *source & 0377;
6716+ *dest += temp << 8;
6717+# endif
6718+}
6719+
6720+# ifndef EXTRACT_MACROS /* To debug the macros. */
6721+# undef EXTRACT_NUMBER
6722+# define EXTRACT_NUMBER(dest, src) PREFIX(extract_number) (&dest, src)
6723+# endif /* not EXTRACT_MACROS */
6724+
6725+# endif /* DEBUG */
6726+
6727+/* Same as EXTRACT_NUMBER, except increment SOURCE to after the number.
6728+ SOURCE must be an lvalue. */
6729+
6730+# define EXTRACT_NUMBER_AND_INCR(destination, source) \
6731+ do { \
6732+ EXTRACT_NUMBER (destination, source); \
6733+ (source) += OFFSET_ADDRESS_SIZE; \
6734+ } while (0)
6735+
6736+# ifdef DEBUG
6737+static void PREFIX(extract_number_and_incr) (int *destination,
6738+ UCHAR_T **source);
6739+static void
6740+PREFIX(extract_number_and_incr) (int *destination, UCHAR_T **source)
6741+{
6742+ PREFIX(extract_number) (destination, *source);
6743+ *source += OFFSET_ADDRESS_SIZE;
6744+}
6745+
6746+# ifndef EXTRACT_MACROS
6747+# undef EXTRACT_NUMBER_AND_INCR
6748+# define EXTRACT_NUMBER_AND_INCR(dest, src) \
6749+ PREFIX(extract_number_and_incr) (&dest, &src)
6750+# endif /* not EXTRACT_MACROS */
6751+
6752+# endif /* DEBUG */
6753+
6754+
6755+
6756+/* If DEBUG is defined, Regex prints many voluminous messages about what
6757+ it is doing (if the variable `debug' is nonzero). If linked with the
6758+ main program in `iregex.c', you can enter patterns and strings
6759+ interactively. And if linked with the main program in `main.c' and
6760+ the other test files, you can run the already-written tests. */
6761+
6762+# ifdef DEBUG
6763+
6764+# ifndef DEFINED_ONCE
6765+
6766+/* We use standard I/O for debugging. */
6767+# include <stdio.h>
6768+
6769+/* It is useful to test things that ``must'' be true when debugging. */
6770+# include <assert.h>
6771+
6772+static int debug;
6773+
6774+# define DEBUG_STATEMENT(e) e
6775+# define DEBUG_PRINT1(x) if (debug) printf (x)
6776+# define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2)
6777+# define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3)
6778+# define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4)
6779+# endif /* not DEFINED_ONCE */
6780+
6781+# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \
6782+ if (debug) PREFIX(print_partial_compiled_pattern) (s, e)
6783+# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \
6784+ if (debug) PREFIX(print_double_string) (w, s1, sz1, s2, sz2)
6785+
6786+
6787+/* Print the fastmap in human-readable form. */
6788+
6789+# ifndef DEFINED_ONCE
6790+void
6791+print_fastmap (char *fastmap)
6792+{
6793+ unsigned was_a_range = 0;
6794+ unsigned i = 0;
6795+
6796+ while (i < (1 << BYTEWIDTH))
6797+ {
6798+ if (fastmap[i++])
6799+ {
6800+ was_a_range = 0;
6801+ putchar (i - 1);
6802+ while (i < (1 << BYTEWIDTH) && fastmap[i])
6803+ {
6804+ was_a_range = 1;
6805+ i++;
6806+ }
6807+ if (was_a_range)
6808+ {
6809+ printf ("-");
6810+ putchar (i - 1);
6811+ }
6812+ }
6813+ }
6814+ putchar ('\n');
6815+}
6816+# endif /* not DEFINED_ONCE */
6817+
6818+
6819+/* Print a compiled pattern string in human-readable form, starting at
6820+ the START pointer into it and ending just before the pointer END. */
6821+
6822+void
6823+PREFIX(print_partial_compiled_pattern) (UCHAR_T *start, UCHAR_T *end)
6824+{
6825+ int mcnt, mcnt2;
6826+ UCHAR_T *p1;
6827+ UCHAR_T *p = start;
6828+ UCHAR_T *pend = end;
6829+
6830+ if (start == NULL)
6831+ {
6832+ printf ("(null)\n");
6833+ return;
6834+ }
6835+
6836+ /* Loop over pattern commands. */
6837+ while (p < pend)
6838+ {
6839+# ifdef _LIBC
6840+ printf ("%td:\t", p - start);
6841+# else
6842+ printf ("%ld:\t", (long int) (p - start));
6843+# endif
6844+
6845+ switch ((re_opcode_t) *p++)
6846+ {
6847+ case no_op:
6848+ printf ("/no_op");
6849+ break;
6850+
6851+ case exactn:
6852+ mcnt = *p++;
6853+ printf ("/exactn/%d", mcnt);
6854+ do
6855+ {
6856+ putchar ('/');
6857+ PUT_CHAR (*p++);
6858+ }
6859+ while (--mcnt);
6860+ break;
6861+
6862+# ifdef MBS_SUPPORT
6863+ case exactn_bin:
6864+ mcnt = *p++;
6865+ printf ("/exactn_bin/%d", mcnt);
6866+ do
6867+ {
6868+ printf("/%lx", (long int) *p++);
6869+ }
6870+ while (--mcnt);
6871+ break;
6872+# endif /* MBS_SUPPORT */
6873+
6874+ case start_memory:
6875+ mcnt = *p++;
6876+ printf ("/start_memory/%d/%ld", mcnt, (long int) *p++);
6877+ break;
6878+
6879+ case stop_memory:
6880+ mcnt = *p++;
6881+ printf ("/stop_memory/%d/%ld", mcnt, (long int) *p++);
6882+ break;
6883+
6884+ case duplicate:
6885+ printf ("/duplicate/%ld", (long int) *p++);
6886+ break;
6887+
6888+ case anychar:
6889+ printf ("/anychar");
6890+ break;
6891+
6892+ case charset:
6893+ case charset_not:
6894+ {
6895+# ifdef WCHAR
6896+ int i, length;
6897+ wchar_t *workp = p;
6898+ printf ("/charset [%s",
6899+ (re_opcode_t) *(workp - 1) == charset_not ? "^" : "");
6900+ p += 5;
6901+ length = *workp++; /* the length of char_classes */
6902+ for (i=0 ; i<length ; i++)
6903+ printf("[:%lx:]", (long int) *p++);
6904+ length = *workp++; /* the length of collating_symbol */
6905+ for (i=0 ; i<length ;)
6906+ {
6907+ printf("[.");
6908+ while(*p != 0)
6909+ PUT_CHAR((i++,*p++));
6910+ i++,p++;
6911+ printf(".]");
6912+ }
6913+ length = *workp++; /* the length of equivalence_class */
6914+ for (i=0 ; i<length ;)
6915+ {
6916+ printf("[=");
6917+ while(*p != 0)
6918+ PUT_CHAR((i++,*p++));
6919+ i++,p++;
6920+ printf("=]");
6921+ }
6922+ length = *workp++; /* the length of char_range */
6923+ for (i=0 ; i<length ; i++)
6924+ {
6925+ wchar_t range_start = *p++;
6926+ wchar_t range_end = *p++;
6927+ printf("%C-%C", range_start, range_end);
6928+ }
6929+ length = *workp++; /* the length of char */
6930+ for (i=0 ; i<length ; i++)
6931+ printf("%C", *p++);
6932+ putchar (']');
6933+# else
6934+ register int c, last = -100;
6935+ register int in_range = 0;
6936+
6937+ printf ("/charset [%s",
6938+ (re_opcode_t) *(p - 1) == charset_not ? "^" : "");
6939+
6940+ assert (p + *p < pend);
6941+
6942+ for (c = 0; c < 256; c++)
6943+ if (c / 8 < *p
6944+ && (p[1 + (c/8)] & (1 << (c % 8))))
6945+ {
6946+ /* Are we starting a range? */
6947+ if (last + 1 == c && ! in_range)
6948+ {
6949+ putchar ('-');
6950+ in_range = 1;
6951+ }
6952+ /* Have we broken a range? */
6953+ else if (last + 1 != c && in_range)
6954+ {
6955+ putchar (last);
6956+ in_range = 0;
6957+ }
6958+
6959+ if (! in_range)
6960+ putchar (c);
6961+
6962+ last = c;
6963+ }
6964+
6965+ if (in_range)
6966+ putchar (last);
6967+
6968+ putchar (']');
6969+
6970+ p += 1 + *p;
6971+# endif /* WCHAR */
6972+ }
6973+ break;
6974+
6975+ case begline:
6976+ printf ("/begline");
6977+ break;
6978+
6979+ case endline:
6980+ printf ("/endline");
6981+ break;
6982+
6983+ case on_failure_jump:
6984+ PREFIX(extract_number_and_incr) (&mcnt, &p);
6985+# ifdef _LIBC
6986+ printf ("/on_failure_jump to %td", p + mcnt - start);
6987+# else
6988+ printf ("/on_failure_jump to %ld", (long int) (p + mcnt - start));
6989+# endif
6990+ break;
6991+
6992+ case on_failure_keep_string_jump:
6993+ PREFIX(extract_number_and_incr) (&mcnt, &p);
6994+# ifdef _LIBC
6995+ printf ("/on_failure_keep_string_jump to %td", p + mcnt - start);
6996+# else
6997+ printf ("/on_failure_keep_string_jump to %ld",
6998+ (long int) (p + mcnt - start));
6999+# endif
7000+ break;
7001+
7002+ case dummy_failure_jump:
7003+ PREFIX(extract_number_and_incr) (&mcnt, &p);
7004+# ifdef _LIBC
7005+ printf ("/dummy_failure_jump to %td", p + mcnt - start);
7006+# else
7007+ printf ("/dummy_failure_jump to %ld", (long int) (p + mcnt - start));
7008+# endif
7009+ break;
7010+
7011+ case push_dummy_failure:
7012+ printf ("/push_dummy_failure");
7013+ break;
7014+
7015+ case maybe_pop_jump:
7016+ PREFIX(extract_number_and_incr) (&mcnt, &p);
7017+# ifdef _LIBC
7018+ printf ("/maybe_pop_jump to %td", p + mcnt - start);
7019+# else
7020+ printf ("/maybe_pop_jump to %ld", (long int) (p + mcnt - start));
7021+# endif
7022+ break;
7023+
7024+ case pop_failure_jump:
7025+ PREFIX(extract_number_and_incr) (&mcnt, &p);
7026+# ifdef _LIBC
7027+ printf ("/pop_failure_jump to %td", p + mcnt - start);
7028+# else
7029+ printf ("/pop_failure_jump to %ld", (long int) (p + mcnt - start));
7030+# endif
7031+ break;
7032+
7033+ case jump_past_alt:
7034+ PREFIX(extract_number_and_incr) (&mcnt, &p);
7035+# ifdef _LIBC
7036+ printf ("/jump_past_alt to %td", p + mcnt - start);
7037+# else
7038+ printf ("/jump_past_alt to %ld", (long int) (p + mcnt - start));
7039+# endif
7040+ break;
7041+
7042+ case jump:
7043+ PREFIX(extract_number_and_incr) (&mcnt, &p);
7044+# ifdef _LIBC
7045+ printf ("/jump to %td", p + mcnt - start);
7046+# else
7047+ printf ("/jump to %ld", (long int) (p + mcnt - start));
7048+# endif
7049+ break;
7050+
7051+ case succeed_n:
7052+ PREFIX(extract_number_and_incr) (&mcnt, &p);
7053+ p1 = p + mcnt;
7054+ PREFIX(extract_number_and_incr) (&mcnt2, &p);
7055+# ifdef _LIBC
7056+ printf ("/succeed_n to %td, %d times", p1 - start, mcnt2);
7057+# else
7058+ printf ("/succeed_n to %ld, %d times",
7059+ (long int) (p1 - start), mcnt2);
7060+# endif
7061+ break;
7062+
7063+ case jump_n:
7064+ PREFIX(extract_number_and_incr) (&mcnt, &p);
7065+ p1 = p + mcnt;
7066+ PREFIX(extract_number_and_incr) (&mcnt2, &p);
7067+ printf ("/jump_n to %d, %d times", p1 - start, mcnt2);
7068+ break;
7069+
7070+ case set_number_at:
7071+ PREFIX(extract_number_and_incr) (&mcnt, &p);
7072+ p1 = p + mcnt;
7073+ PREFIX(extract_number_and_incr) (&mcnt2, &p);
7074+# ifdef _LIBC
7075+ printf ("/set_number_at location %td to %d", p1 - start, mcnt2);
7076+# else
7077+ printf ("/set_number_at location %ld to %d",
7078+ (long int) (p1 - start), mcnt2);
7079+# endif
7080+ break;
7081+
7082+ case wordbound:
7083+ printf ("/wordbound");
7084+ break;
7085+
7086+ case notwordbound:
7087+ printf ("/notwordbound");
7088+ break;
7089+
7090+ case wordbeg:
7091+ printf ("/wordbeg");
7092+ break;
7093+
7094+ case wordend:
7095+ printf ("/wordend");
7096+ break;
7097+
7098+# ifdef emacs
7099+ case before_dot:
7100+ printf ("/before_dot");
7101+ break;
7102+
7103+ case at_dot:
7104+ printf ("/at_dot");
7105+ break;
7106+
7107+ case after_dot:
7108+ printf ("/after_dot");
7109+ break;
7110+
7111+ case syntaxspec:
7112+ printf ("/syntaxspec");
7113+ mcnt = *p++;
7114+ printf ("/%d", mcnt);
7115+ break;
7116+
7117+ case notsyntaxspec:
7118+ printf ("/notsyntaxspec");
7119+ mcnt = *p++;
7120+ printf ("/%d", mcnt);
7121+ break;
7122+# endif /* emacs */
7123+
7124+ case wordchar:
7125+ printf ("/wordchar");
7126+ break;
7127+
7128+ case notwordchar:
7129+ printf ("/notwordchar");
7130+ break;
7131+
7132+ case begbuf:
7133+ printf ("/begbuf");
7134+ break;
7135+
7136+ case endbuf:
7137+ printf ("/endbuf");
7138+ break;
7139+
7140+ default:
7141+ printf ("?%ld", (long int) *(p-1));
7142+ }
7143+
7144+ putchar ('\n');
7145+ }
7146+
7147+# ifdef _LIBC
7148+ printf ("%td:\tend of pattern.\n", p - start);
7149+# else
7150+ printf ("%ld:\tend of pattern.\n", (long int) (p - start));
7151+# endif
7152+}
7153+
7154+
7155+void
7156+PREFIX(print_compiled_pattern) (struct re_pattern_buffer *bufp)
7157+{
7158+ UCHAR_T *buffer = (UCHAR_T*) bufp->buffer;
7159+
7160+ PREFIX(print_partial_compiled_pattern) (buffer, buffer
7161+ + bufp->used / sizeof(UCHAR_T));
7162+ printf ("%ld bytes used/%ld bytes allocated.\n",
7163+ bufp->used, bufp->allocated);
7164+
7165+ if (bufp->fastmap_accurate && bufp->fastmap)
7166+ {
7167+ printf ("fastmap: ");
7168+ print_fastmap (bufp->fastmap);
7169+ }
7170+
7171+# ifdef _LIBC
7172+ printf ("re_nsub: %Zd\t", bufp->re_nsub);
7173+# else
7174+ printf ("re_nsub: %ld\t", (long int) bufp->re_nsub);
7175+# endif
7176+ printf ("regs_alloc: %d\t", bufp->regs_allocated);
7177+ printf ("can_be_null: %d\t", bufp->can_be_null);
7178+ printf ("newline_anchor: %d\n", bufp->newline_anchor);
7179+ printf ("no_sub: %d\t", bufp->no_sub);
7180+ printf ("not_bol: %d\t", bufp->not_bol);
7181+ printf ("not_eol: %d\t", bufp->not_eol);
7182+ printf ("syntax: %lx\n", bufp->syntax);
7183+ /* Perhaps we should print the translate table? */
7184+}
7185+
7186+
7187+void
7188+PREFIX(print_double_string) (const CHAR_T *where, const CHAR_T *string1,
7189+ int size1, const CHAR_T *string2, int size2)
7190+{
7191+ int this_char;
7192+
7193+ if (where == NULL)
7194+ printf ("(null)");
7195+ else
7196+ {
7197+ int cnt;
7198+
7199+ if (FIRST_STRING_P (where))
7200+ {
7201+ for (this_char = where - string1; this_char < size1; this_char++)
7202+ PUT_CHAR (string1[this_char]);
7203+
7204+ where = string2;
7205+ }
7206+
7207+ cnt = 0;
7208+ for (this_char = where - string2; this_char < size2; this_char++)
7209+ {
7210+ PUT_CHAR (string2[this_char]);
7211+ if (++cnt > 100)
7212+ {
7213+ fputs ("...", stdout);
7214+ break;
7215+ }
7216+ }
7217+ }
7218+}
7219+
7220+# ifndef DEFINED_ONCE
7221+void
7222+printchar (int c)
7223+{
7224+ putc (c, stderr);
7225+}
7226+# endif
7227+
7228+# else /* not DEBUG */
7229+
7230+# ifndef DEFINED_ONCE
7231+# undef assert
7232+# define assert(e)
7233+
7234+# define DEBUG_STATEMENT(e)
7235+# define DEBUG_PRINT1(x)
7236+# define DEBUG_PRINT2(x1, x2)
7237+# define DEBUG_PRINT3(x1, x2, x3)
7238+# define DEBUG_PRINT4(x1, x2, x3, x4)
7239+# endif /* not DEFINED_ONCE */
7240+# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e)
7241+# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)
7242+
7243+# endif /* not DEBUG */
7244+
7245+
7246+
7247+# ifdef WCHAR
7248+/* This convert a multibyte string to a wide character string.
7249+ And write their correspondances to offset_buffer(see below)
7250+ and write whether each wchar_t is binary data to is_binary.
7251+ This assume invalid multibyte sequences as binary data.
7252+ We assume offset_buffer and is_binary is already allocated
7253+ enough space. */
7254+
7255+static size_t convert_mbs_to_wcs (CHAR_T *dest, const unsigned char* src,
7256+ size_t len, int *offset_buffer,
7257+ char *is_binary);
7258+static size_t
7259+convert_mbs_to_wcs (CHAR_T *dest, const unsigned char*src, size_t len,
7260+ int *offset_buffer, char *is_binary)
7261+ /* It hold correspondances between src(char string) and
7262+ dest(wchar_t string) for optimization.
7263+ e.g. src = "xxxyzz"
7264+ dest = {'X', 'Y', 'Z'}
7265+ (each "xxx", "y" and "zz" represent one multibyte character
7266+ corresponding to 'X', 'Y' and 'Z'.)
7267+ offset_buffer = {0, 0+3("xxx"), 0+3+1("y"), 0+3+1+2("zz")}
7268+ = {0, 3, 4, 6}
7269+ */
7270+{
7271+ wchar_t *pdest = dest;
7272+ const unsigned char *psrc = src;
7273+ size_t wc_count = 0;
7274+
7275+ mbstate_t mbs;
7276+ int i, consumed;
7277+ size_t mb_remain = len;
7278+ size_t mb_count = 0;
7279+
7280+ /* Initialize the conversion state. */
7281+ memset (&mbs, 0, sizeof (mbstate_t));
7282+
7283+ offset_buffer[0] = 0;
7284+ for( ; mb_remain > 0 ; ++wc_count, ++pdest, mb_remain -= consumed,
7285+ psrc += consumed)
7286+ {
7287+#ifdef _LIBC
7288+ consumed = __mbrtowc (pdest, psrc, mb_remain, &mbs);
7289+#else
7290+ consumed = mbrtowc (pdest, psrc, mb_remain, &mbs);
7291+#endif
7292+
7293+ if (consumed <= 0)
7294+ /* failed to convert. maybe src contains binary data.
7295+ So we consume 1 byte manualy. */
7296+ {
7297+ *pdest = *psrc;
7298+ consumed = 1;
7299+ is_binary[wc_count] = TRUE;
7300+ }
7301+ else
7302+ is_binary[wc_count] = FALSE;
7303+ /* In sjis encoding, we use yen sign as escape character in
7304+ place of reverse solidus. So we convert 0x5c(yen sign in
7305+ sjis) to not 0xa5(yen sign in UCS2) but 0x5c(reverse
7306+ solidus in UCS2). */
7307+ if (consumed == 1 && (int) *psrc == 0x5c && (int) *pdest == 0xa5)
7308+ *pdest = (wchar_t) *psrc;
7309+
7310+ offset_buffer[wc_count + 1] = mb_count += consumed;
7311+ }
7312+
7313+ /* Fill remain of the buffer with sentinel. */
7314+ for (i = wc_count + 1 ; i <= len ; i++)
7315+ offset_buffer[i] = mb_count + 1;
7316+
7317+ return wc_count;
7318+}
7319+
7320+# endif /* WCHAR */
7321+
7322+#else /* not INSIDE_RECURSION */
7323+
7324+/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can
7325+ also be assigned to arbitrarily: each pattern buffer stores its own
7326+ syntax, so it can be changed between regex compilations. */
7327+/* This has no initializer because initialized variables in Emacs
7328+ become read-only after dumping. */
7329+reg_syntax_t re_syntax_options;
7330+
7331+
7332+/* Specify the precise syntax of regexps for compilation. This provides
7333+ for compatibility for various utilities which historically have
7334+ different, incompatible syntaxes.
7335+
7336+ The argument SYNTAX is a bit mask comprised of the various bits
7337+ defined in regex.h. We return the old syntax. */
7338+
7339+reg_syntax_t
7340+re_set_syntax (reg_syntax_t syntax)
7341+{
7342+ reg_syntax_t ret = re_syntax_options;
7343+
7344+ re_syntax_options = syntax;
7345+# ifdef DEBUG
7346+ if (syntax & RE_DEBUG)
7347+ debug = 1;
7348+ else if (debug) /* was on but now is not */
7349+ debug = 0;
7350+# endif /* DEBUG */
7351+ return ret;
7352+}
7353+# ifdef _LIBC
7354+weak_alias (__re_set_syntax, re_set_syntax)
7355+# endif
7356+
7357+/* This table gives an error message for each of the error codes listed
7358+ in regex.h. Obviously the order here has to be same as there.
7359+ POSIX doesn't require that we do anything for REG_NOERROR,
7360+ but why not be nice? */
7361+
7362+static const char *re_error_msgid[] =
7363+ {
7364+ gettext_noop ("Success"), /* REG_NOERROR */
7365+ gettext_noop ("No match"), /* REG_NOMATCH */
7366+ gettext_noop ("Invalid regular expression"), /* REG_BADPAT */
7367+ gettext_noop ("Invalid collation character"), /* REG_ECOLLATE */
7368+ gettext_noop ("Invalid character class name"), /* REG_ECTYPE */
7369+ gettext_noop ("Trailing backslash"), /* REG_EESCAPE */
7370+ gettext_noop ("Invalid back reference"), /* REG_ESUBREG */
7371+ gettext_noop ("Unmatched [ or [^"), /* REG_EBRACK */
7372+ gettext_noop ("Unmatched ( or \\("), /* REG_EPAREN */
7373+ gettext_noop ("Unmatched \\{"), /* REG_EBRACE */
7374+ gettext_noop ("Invalid content of \\{\\}"), /* REG_BADBR */
7375+ gettext_noop ("Invalid range end"), /* REG_ERANGE */
7376+ gettext_noop ("Memory exhausted"), /* REG_ESPACE */
7377+ gettext_noop ("Invalid preceding regular expression"), /* REG_BADRPT */
7378+ gettext_noop ("Premature end of regular expression"), /* REG_EEND */
7379+ gettext_noop ("Regular expression too big"), /* REG_ESIZE */
7380+ gettext_noop ("Unmatched ) or \\)") /* REG_ERPAREN */
7381+ };
7382+
7383+#endif /* INSIDE_RECURSION */
7384+
7385+#ifndef DEFINED_ONCE
7386+/* Avoiding alloca during matching, to placate r_alloc. */
7387+
7388+/* Define MATCH_MAY_ALLOCATE unless we need to make sure that the
7389+ searching and matching functions should not call alloca. On some
7390+ systems, alloca is implemented in terms of malloc, and if we're
7391+ using the relocating allocator routines, then malloc could cause a
7392+ relocation, which might (if the strings being searched are in the
7393+ ralloc heap) shift the data out from underneath the regexp
7394+ routines.
7395+
7396+ Here's another reason to avoid allocation: Emacs
7397+ processes input from X in a signal handler; processing X input may
7398+ call malloc; if input arrives while a matching routine is calling
7399+ malloc, then we're scrod. But Emacs can't just block input while
7400+ calling matching routines; then we don't notice interrupts when
7401+ they come in. So, Emacs blocks input around all regexp calls
7402+ except the matching calls, which it leaves unprotected, in the
7403+ faith that they will not malloc. */
7404+
7405+/* Normally, this is fine. */
7406+# define MATCH_MAY_ALLOCATE
7407+
7408+/* When using GNU C, we are not REALLY using the C alloca, no matter
7409+ what config.h may say. So don't take precautions for it. */
7410+# ifdef __GNUC__
7411+# undef C_ALLOCA
7412+# endif
7413+
7414+/* The match routines may not allocate if (1) they would do it with malloc
7415+ and (2) it's not safe for them to use malloc.
7416+ Note that if REL_ALLOC is defined, matching would not use malloc for the
7417+ failure stack, but we would still use it for the register vectors;
7418+ so REL_ALLOC should not affect this. */
7419+# if (defined C_ALLOCA || defined REGEX_MALLOC) && defined emacs
7420+# undef MATCH_MAY_ALLOCATE
7421+# endif
7422+#endif /* not DEFINED_ONCE */
7423+
7424+#ifdef INSIDE_RECURSION
7425+/* Failure stack declarations and macros; both re_compile_fastmap and
7426+ re_match_2 use a failure stack. These have to be macros because of
7427+ REGEX_ALLOCATE_STACK. */
7428+
7429+
7430+/* Number of failure points for which to initially allocate space
7431+ when matching. If this number is exceeded, we allocate more
7432+ space, so it is not a hard limit. */
7433+# ifndef INIT_FAILURE_ALLOC
7434+# define INIT_FAILURE_ALLOC 5
7435+# endif
7436+
7437+/* Roughly the maximum number of failure points on the stack. Would be
7438+ exactly that if always used MAX_FAILURE_ITEMS items each time we failed.
7439+ This is a variable only so users of regex can assign to it; we never
7440+ change it ourselves. */
7441+
7442+
7443+# ifndef DEFINED_ONCE
7444+
7445+# ifdef INT_IS_16BIT
7446+# define RE_M_F_TYPE long int
7447+# else
7448+# define RE_M_F_TYPE int
7449+# endif /* INT_IS_16BIT */
7450+
7451+# ifdef MATCH_MAY_ALLOCATE
7452+/* 4400 was enough to cause a crash on Alpha OSF/1,
7453+ whose default stack limit is 2mb. */
7454+# define RE_M_F_DEFAULT 4000
7455+# else
7456+# define RE_M_F_DEFAULT 2000
7457+# endif /* MATCH_MAY_ALLOCATE */
7458+
7459+# include <shlib-compat.h>
7460+
7461+# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
7462+link_warning (re_max_failures, "the 're_max_failures' variable is obsolete and will go away.")
7463+RE_M_F_TYPE re_max_failures = RE_M_F_DEFAULT;
7464+# else
7465+RE_M_F_TYPE re_max_failures attribute_hidden = RE_M_F_DEFAULT;
7466+# endif /* SHLIB_COMPAT */
7467+
7468+# undef RE_M_F_TYPE
7469+# undef RE_M_F_DEFAULT
7470+
7471+# endif /* DEFINED_ONCE */
7472+
7473+# ifdef INT_IS_16BIT
7474+
7475+union PREFIX(fail_stack_elt)
7476+{
7477+ UCHAR_T *pointer;
7478+ long int integer;
7479+};
7480+
7481+typedef union PREFIX(fail_stack_elt) PREFIX(fail_stack_elt_t);
7482+
7483+typedef struct
7484+{
7485+ PREFIX(fail_stack_elt_t) *stack;
7486+ unsigned long int size;
7487+ unsigned long int avail; /* Offset of next open position. */
7488+} PREFIX(fail_stack_type);
7489+
7490+# else /* not INT_IS_16BIT */
7491+
7492+union PREFIX(fail_stack_elt)
7493+{
7494+ UCHAR_T *pointer;
7495+ int integer;
7496+};
7497+
7498+typedef union PREFIX(fail_stack_elt) PREFIX(fail_stack_elt_t);
7499+
7500+typedef struct
7501+{
7502+ PREFIX(fail_stack_elt_t) *stack;
7503+ unsigned size;
7504+ unsigned avail; /* Offset of next open position. */
7505+} PREFIX(fail_stack_type);
7506+
7507+# endif /* INT_IS_16BIT */
7508+
7509+# ifndef DEFINED_ONCE
7510+# define FAIL_STACK_EMPTY() (fail_stack.avail == 0)
7511+# define FAIL_STACK_PTR_EMPTY() (fail_stack_ptr->avail == 0)
7512+# define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size)
7513+# endif
7514+
7515+
7516+/* Define macros to initialize and free the failure stack.
7517+ Do `return -2' if the alloc fails. */
7518+
7519+# ifdef MATCH_MAY_ALLOCATE
7520+# define INIT_FAIL_STACK() \
7521+ do { \
7522+ fail_stack.stack = (PREFIX(fail_stack_elt_t) *) \
7523+ REGEX_ALLOCATE_STACK (INIT_FAILURE_ALLOC * sizeof (PREFIX(fail_stack_elt_t))); \
7524+ \
7525+ if (fail_stack.stack == NULL) \
7526+ return -2; \
7527+ \
7528+ fail_stack.size = INIT_FAILURE_ALLOC; \
7529+ fail_stack.avail = 0; \
7530+ } while (0)
7531+
7532+# define RESET_FAIL_STACK() REGEX_FREE_STACK (fail_stack.stack)
7533+# else
7534+# define INIT_FAIL_STACK() \
7535+ do { \
7536+ fail_stack.avail = 0; \
7537+ } while (0)
7538+
7539+# define RESET_FAIL_STACK()
7540+# endif
7541+
7542+
7543+/* Double the size of FAIL_STACK, up to approximately `re_max_failures' items.
7544+
7545+ Return 1 if succeeds, and 0 if either ran out of memory
7546+ allocating space for it or it was already too large.
7547+
7548+ REGEX_REALLOCATE_STACK requires `destination' be declared. */
7549+
7550+# define DOUBLE_FAIL_STACK(fail_stack) \
7551+ ((fail_stack).size > (unsigned) (re_max_failures * MAX_FAILURE_ITEMS) \
7552+ ? 0 \
7553+ : ((fail_stack).stack = (PREFIX(fail_stack_elt_t) *) \
7554+ REGEX_REALLOCATE_STACK ((fail_stack).stack, \
7555+ (fail_stack).size * sizeof (PREFIX(fail_stack_elt_t)), \
7556+ ((fail_stack).size << 1) * sizeof (PREFIX(fail_stack_elt_t))),\
7557+ \
7558+ (fail_stack).stack == NULL \
7559+ ? 0 \
7560+ : ((fail_stack).size <<= 1, \
7561+ 1)))
7562+
7563+
7564+/* Push pointer POINTER on FAIL_STACK.
7565+ Return 1 if was able to do so and 0 if ran out of memory allocating
7566+ space to do so. */
7567+# define PUSH_PATTERN_OP(POINTER, FAIL_STACK) \
7568+ ((FAIL_STACK_FULL () \
7569+ && !DOUBLE_FAIL_STACK (FAIL_STACK)) \
7570+ ? 0 \
7571+ : ((FAIL_STACK).stack[(FAIL_STACK).avail++].pointer = POINTER, \
7572+ 1))
7573+
7574+/* Push a pointer value onto the failure stack.
7575+ Assumes the variable `fail_stack'. Probably should only
7576+ be called from within `PUSH_FAILURE_POINT'. */
7577+# define PUSH_FAILURE_POINTER(item) \
7578+ fail_stack.stack[fail_stack.avail++].pointer = (UCHAR_T *) (item)
7579+
7580+/* This pushes an integer-valued item onto the failure stack.
7581+ Assumes the variable `fail_stack'. Probably should only
7582+ be called from within `PUSH_FAILURE_POINT'. */
7583+# define PUSH_FAILURE_INT(item) \
7584+ fail_stack.stack[fail_stack.avail++].integer = (item)
7585+
7586+/* Push a fail_stack_elt_t value onto the failure stack.
7587+ Assumes the variable `fail_stack'. Probably should only
7588+ be called from within `PUSH_FAILURE_POINT'. */
7589+# define PUSH_FAILURE_ELT(item) \
7590+ fail_stack.stack[fail_stack.avail++] = (item)
7591+
7592+/* These three POP... operations complement the three PUSH... operations.
7593+ All assume that `fail_stack' is nonempty. */
7594+# define POP_FAILURE_POINTER() fail_stack.stack[--fail_stack.avail].pointer
7595+# define POP_FAILURE_INT() fail_stack.stack[--fail_stack.avail].integer
7596+# define POP_FAILURE_ELT() fail_stack.stack[--fail_stack.avail]
7597+
7598+/* Used to omit pushing failure point id's when we're not debugging. */
7599+# ifdef DEBUG
7600+# define DEBUG_PUSH PUSH_FAILURE_INT
7601+# define DEBUG_POP(item_addr) *(item_addr) = POP_FAILURE_INT ()
7602+# else
7603+# define DEBUG_PUSH(item)
7604+# define DEBUG_POP(item_addr)
7605+# endif
7606+
7607+
7608+/* Push the information about the state we will need
7609+ if we ever fail back to it.
7610+
7611+ Requires variables fail_stack, regstart, regend, reg_info, and
7612+ num_regs_pushed be declared. DOUBLE_FAIL_STACK requires `destination'
7613+ be declared.
7614+
7615+ Does `return FAILURE_CODE' if runs out of memory. */
7616+
7617+# define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \
7618+ do { \
7619+ char *destination; \
7620+ /* Must be int, so when we don't save any registers, the arithmetic \
7621+ of 0 + -1 isn't done as unsigned. */ \
7622+ /* Can't be int, since there is not a shred of a guarantee that int \
7623+ is wide enough to hold a value of something to which pointer can \
7624+ be assigned */ \
7625+ active_reg_t this_reg; \
7626+ \
7627+ DEBUG_STATEMENT (failure_id++); \
7628+ DEBUG_STATEMENT (nfailure_points_pushed++); \
7629+ DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \
7630+ DEBUG_PRINT2 (" Before push, next avail: %d\n", (fail_stack).avail);\
7631+ DEBUG_PRINT2 (" size: %d\n", (fail_stack).size);\
7632+ \
7633+ DEBUG_PRINT2 (" slots needed: %ld\n", NUM_FAILURE_ITEMS); \
7634+ DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \
7635+ \
7636+ /* Ensure we have enough space allocated for what we will push. */ \
7637+ while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \
7638+ { \
7639+ if (!DOUBLE_FAIL_STACK (fail_stack)) \
7640+ return failure_code; \
7641+ \
7642+ DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \
7643+ (fail_stack).size); \
7644+ DEBUG_PRINT2 (" slots available: %d\n", REMAINING_AVAIL_SLOTS);\
7645+ } \
7646+ \
7647+ /* Push the info, starting with the registers. */ \
7648+ DEBUG_PRINT1 ("\n"); \
7649+ \
7650+ if (1) \
7651+ for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \
7652+ this_reg++) \
7653+ { \
7654+ DEBUG_PRINT2 (" Pushing reg: %lu\n", this_reg); \
7655+ DEBUG_STATEMENT (num_regs_pushed++); \
7656+ \
7657+ DEBUG_PRINT2 (" start: %p\n", regstart[this_reg]); \
7658+ PUSH_FAILURE_POINTER (regstart[this_reg]); \
7659+ \
7660+ DEBUG_PRINT2 (" end: %p\n", regend[this_reg]); \
7661+ PUSH_FAILURE_POINTER (regend[this_reg]); \
7662+ \
7663+ DEBUG_PRINT2 (" info: %p\n ", \
7664+ reg_info[this_reg].word.pointer); \
7665+ DEBUG_PRINT2 (" match_null=%d", \
7666+ REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \
7667+ DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \
7668+ DEBUG_PRINT2 (" matched_something=%d", \
7669+ MATCHED_SOMETHING (reg_info[this_reg])); \
7670+ DEBUG_PRINT2 (" ever_matched=%d", \
7671+ EVER_MATCHED_SOMETHING (reg_info[this_reg])); \
7672+ DEBUG_PRINT1 ("\n"); \
7673+ PUSH_FAILURE_ELT (reg_info[this_reg].word); \
7674+ } \
7675+ \
7676+ DEBUG_PRINT2 (" Pushing low active reg: %ld\n", lowest_active_reg);\
7677+ PUSH_FAILURE_INT (lowest_active_reg); \
7678+ \
7679+ DEBUG_PRINT2 (" Pushing high active reg: %ld\n", highest_active_reg);\
7680+ PUSH_FAILURE_INT (highest_active_reg); \
7681+ \
7682+ DEBUG_PRINT2 (" Pushing pattern %p:\n", pattern_place); \
7683+ DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \
7684+ PUSH_FAILURE_POINTER (pattern_place); \
7685+ \
7686+ DEBUG_PRINT2 (" Pushing string %p: `", string_place); \
7687+ DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \
7688+ size2); \
7689+ DEBUG_PRINT1 ("'\n"); \
7690+ PUSH_FAILURE_POINTER (string_place); \
7691+ \
7692+ DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \
7693+ DEBUG_PUSH (failure_id); \
7694+ } while (0)
7695+
7696+# ifndef DEFINED_ONCE
7697+/* This is the number of items that are pushed and popped on the stack
7698+ for each register. */
7699+# define NUM_REG_ITEMS 3
7700+
7701+/* Individual items aside from the registers. */
7702+# ifdef DEBUG
7703+# define NUM_NONREG_ITEMS 5 /* Includes failure point id. */
7704+# else
7705+# define NUM_NONREG_ITEMS 4
7706+# endif
7707+
7708+/* We push at most this many items on the stack. */
7709+/* We used to use (num_regs - 1), which is the number of registers
7710+ this regexp will save; but that was changed to 5
7711+ to avoid stack overflow for a regexp with lots of parens. */
7712+# define MAX_FAILURE_ITEMS (5 * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
7713+
7714+/* We actually push this many items. */
7715+# define NUM_FAILURE_ITEMS \
7716+ (((0 \
7717+ ? 0 : highest_active_reg - lowest_active_reg + 1) \
7718+ * NUM_REG_ITEMS) \
7719+ + NUM_NONREG_ITEMS)
7720+
7721+/* How many items can still be added to the stack without overflowing it. */
7722+# define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail)
7723+# endif /* not DEFINED_ONCE */
7724+
7725+
7726+/* Pops what PUSH_FAIL_STACK pushes.
7727+
7728+ We restore into the parameters, all of which should be lvalues:
7729+ STR -- the saved data position.
7730+ PAT -- the saved pattern position.
7731+ LOW_REG, HIGH_REG -- the highest and lowest active registers.
7732+ REGSTART, REGEND -- arrays of string positions.
7733+ REG_INFO -- array of information about each subexpression.
7734+
7735+ Also assumes the variables `fail_stack' and (if debugging), `bufp',
7736+ `pend', `string1', `size1', `string2', and `size2'. */
7737+# define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\
7738+{ \
7739+ DEBUG_STATEMENT (unsigned failure_id;) \
7740+ active_reg_t this_reg; \
7741+ const UCHAR_T *string_temp; \
7742+ \
7743+ assert (!FAIL_STACK_EMPTY ()); \
7744+ \
7745+ /* Remove failure points and point to how many regs pushed. */ \
7746+ DEBUG_PRINT1 ("POP_FAILURE_POINT:\n"); \
7747+ DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \
7748+ DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \
7749+ \
7750+ assert (fail_stack.avail >= NUM_NONREG_ITEMS); \
7751+ \
7752+ DEBUG_POP (&failure_id); \
7753+ DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \
7754+ \
7755+ /* If the saved string location is NULL, it came from an \
7756+ on_failure_keep_string_jump opcode, and we want to throw away the \
7757+ saved NULL, thus retaining our current position in the string. */ \
7758+ string_temp = POP_FAILURE_POINTER (); \
7759+ if (string_temp != NULL) \
7760+ str = (const CHAR_T *) string_temp; \
7761+ \
7762+ DEBUG_PRINT2 (" Popping string %p: `", str); \
7763+ DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \
7764+ DEBUG_PRINT1 ("'\n"); \
7765+ \
7766+ pat = (UCHAR_T *) POP_FAILURE_POINTER (); \
7767+ DEBUG_PRINT2 (" Popping pattern %p:\n", pat); \
7768+ DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \
7769+ \
7770+ /* Restore register info. */ \
7771+ high_reg = (active_reg_t) POP_FAILURE_INT (); \
7772+ DEBUG_PRINT2 (" Popping high active reg: %ld\n", high_reg); \
7773+ \
7774+ low_reg = (active_reg_t) POP_FAILURE_INT (); \
7775+ DEBUG_PRINT2 (" Popping low active reg: %ld\n", low_reg); \
7776+ \
7777+ if (1) \
7778+ for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \
7779+ { \
7780+ DEBUG_PRINT2 (" Popping reg: %ld\n", this_reg); \
7781+ \
7782+ reg_info[this_reg].word = POP_FAILURE_ELT (); \
7783+ DEBUG_PRINT2 (" info: %p\n", \
7784+ reg_info[this_reg].word.pointer); \
7785+ \
7786+ regend[this_reg] = (const CHAR_T *) POP_FAILURE_POINTER (); \
7787+ DEBUG_PRINT2 (" end: %p\n", regend[this_reg]); \
7788+ \
7789+ regstart[this_reg] = (const CHAR_T *) POP_FAILURE_POINTER (); \
7790+ DEBUG_PRINT2 (" start: %p\n", regstart[this_reg]); \
7791+ } \
7792+ else \
7793+ { \
7794+ for (this_reg = highest_active_reg; this_reg > high_reg; this_reg--) \
7795+ { \
7796+ reg_info[this_reg].word.integer = 0; \
7797+ regend[this_reg] = 0; \
7798+ regstart[this_reg] = 0; \
7799+ } \
7800+ highest_active_reg = high_reg; \
7801+ } \
7802+ \
7803+ set_regs_matched_done = 0; \
7804+ DEBUG_STATEMENT (nfailure_points_popped++); \
7805+} /* POP_FAILURE_POINT */
7806+
7807+/* Structure for per-register (a.k.a. per-group) information.
7808+ Other register information, such as the
7809+ starting and ending positions (which are addresses), and the list of
7810+ inner groups (which is a bits list) are maintained in separate
7811+ variables.
7812+
7813+ We are making a (strictly speaking) nonportable assumption here: that
7814+ the compiler will pack our bit fields into something that fits into
7815+ the type of `word', i.e., is something that fits into one item on the
7816+ failure stack. */
7817+
7818+
7819+/* Declarations and macros for re_match_2. */
7820+
7821+typedef union
7822+{
7823+ PREFIX(fail_stack_elt_t) word;
7824+ struct
7825+ {
7826+ /* This field is one if this group can match the empty string,
7827+ zero if not. If not yet determined, `MATCH_NULL_UNSET_VALUE'. */
7828+# define MATCH_NULL_UNSET_VALUE 3
7829+ unsigned match_null_string_p : 2;
7830+ unsigned is_active : 1;
7831+ unsigned matched_something : 1;
7832+ unsigned ever_matched_something : 1;
7833+ } bits;
7834+} PREFIX(register_info_type);
7835+
7836+# ifndef DEFINED_ONCE
7837+# define REG_MATCH_NULL_STRING_P(R) ((R).bits.match_null_string_p)
7838+# define IS_ACTIVE(R) ((R).bits.is_active)
7839+# define MATCHED_SOMETHING(R) ((R).bits.matched_something)
7840+# define EVER_MATCHED_SOMETHING(R) ((R).bits.ever_matched_something)
7841+
7842+
7843+/* Call this when have matched a real character; it sets `matched' flags
7844+ for the subexpressions which we are currently inside. Also records
7845+ that those subexprs have matched. */
7846+# define SET_REGS_MATCHED() \
7847+ do \
7848+ { \
7849+ if (!set_regs_matched_done) \
7850+ { \
7851+ active_reg_t r; \
7852+ set_regs_matched_done = 1; \
7853+ for (r = lowest_active_reg; r <= highest_active_reg; r++) \
7854+ { \
7855+ MATCHED_SOMETHING (reg_info[r]) \
7856+ = EVER_MATCHED_SOMETHING (reg_info[r]) \
7857+ = 1; \
7858+ } \
7859+ } \
7860+ } \
7861+ while (0)
7862+# endif /* not DEFINED_ONCE */
7863+
7864+/* Registers are set to a sentinel when they haven't yet matched. */
7865+static CHAR_T PREFIX(reg_unset_dummy);
7866+# define REG_UNSET_VALUE (&PREFIX(reg_unset_dummy))
7867+# define REG_UNSET(e) ((e) == REG_UNSET_VALUE)
7868+
7869+/* Subroutine declarations and macros for regex_compile. */
7870+static void PREFIX(store_op1) (re_opcode_t op, UCHAR_T *loc, int arg);
7871+static void PREFIX(store_op2) (re_opcode_t op, UCHAR_T *loc,
7872+ int arg1, int arg2);
7873+static void PREFIX(insert_op1) (re_opcode_t op, UCHAR_T *loc,
7874+ int arg, UCHAR_T *end);
7875+static void PREFIX(insert_op2) (re_opcode_t op, UCHAR_T *loc,
7876+ int arg1, int arg2, UCHAR_T *end);
7877+static boolean PREFIX(at_begline_loc_p) (const CHAR_T *pattern,
7878+ const CHAR_T *p,
7879+ reg_syntax_t syntax);
7880+static boolean PREFIX(at_endline_loc_p) (const CHAR_T *p,
7881+ const CHAR_T *pend,
7882+ reg_syntax_t syntax);
7883+# ifdef WCHAR
7884+static reg_errcode_t wcs_compile_range (CHAR_T range_start,
7885+ const CHAR_T **p_ptr,
7886+ const CHAR_T *pend,
7887+ char *translate,
7888+ reg_syntax_t syntax,
7889+ UCHAR_T *b,
7890+ CHAR_T *char_set);
7891+static void insert_space (int num, CHAR_T *loc, CHAR_T *end);
7892+# else /* BYTE */
7893+static reg_errcode_t byte_compile_range (unsigned int range_start,
7894+ const char **p_ptr,
7895+ const char *pend,
7896+ RE_TRANSLATE_TYPE translate,
7897+ reg_syntax_t syntax,
7898+ unsigned char *b);
7899+# endif /* WCHAR */
7900+
7901+/* Fetch the next character in the uncompiled pattern---translating it
7902+ if necessary. Also cast from a signed character in the constant
7903+ string passed to us by the user to an unsigned char that we can use
7904+ as an array index (in, e.g., `translate'). */
7905+/* ifdef MBS_SUPPORT, we translate only if character <= 0xff,
7906+ because it is impossible to allocate 4GB array for some encodings
7907+ which have 4 byte character_set like UCS4. */
7908+# ifndef PATFETCH
7909+# ifdef WCHAR
7910+# define PATFETCH(c) \
7911+ do {if (p == pend) return REG_EEND; \
7912+ c = (UCHAR_T) *p++; \
7913+ if (translate && (c <= 0xff)) c = (UCHAR_T) translate[c]; \
7914+ } while (0)
7915+# else /* BYTE */
7916+# define PATFETCH(c) \
7917+ do {if (p == pend) return REG_EEND; \
7918+ c = (unsigned char) *p++; \
7919+ if (translate) c = (unsigned char) translate[c]; \
7920+ } while (0)
7921+# endif /* WCHAR */
7922+# endif
7923+
7924+/* Fetch the next character in the uncompiled pattern, with no
7925+ translation. */
7926+# define PATFETCH_RAW(c) \
7927+ do {if (p == pend) return REG_EEND; \
7928+ c = (UCHAR_T) *p++; \
7929+ } while (0)
7930+
7931+/* Go backwards one character in the pattern. */
7932+# define PATUNFETCH p--
7933+
7934+
7935+/* If `translate' is non-null, return translate[D], else just D. We
7936+ cast the subscript to translate because some data is declared as
7937+ `char *', to avoid warnings when a string constant is passed. But
7938+ when we use a character as a subscript we must make it unsigned. */
7939+/* ifdef MBS_SUPPORT, we translate only if character <= 0xff,
7940+ because it is impossible to allocate 4GB array for some encodings
7941+ which have 4 byte character_set like UCS4. */
7942+
7943+# ifndef TRANSLATE
7944+# ifdef WCHAR
7945+# define TRANSLATE(d) \
7946+ ((translate && ((UCHAR_T) (d)) <= 0xff) \
7947+ ? (char) translate[(unsigned char) (d)] : (d))
7948+# else /* BYTE */
7949+# define TRANSLATE(d) \
7950+ (translate ? (char) translate[(unsigned char) (d)] : (char) (d))
7951+# endif /* WCHAR */
7952+# endif
7953+
7954+
7955+/* Macros for outputting the compiled pattern into `buffer'. */
7956+
7957+/* If the buffer isn't allocated when it comes in, use this. */
7958+# define INIT_BUF_SIZE (32 * sizeof(UCHAR_T))
7959+
7960+/* Make sure we have at least N more bytes of space in buffer. */
7961+# ifdef WCHAR
7962+# define GET_BUFFER_SPACE(n) \
7963+ while (((unsigned long)b - (unsigned long)COMPILED_BUFFER_VAR \
7964+ + (n)*sizeof(CHAR_T)) > bufp->allocated) \
7965+ EXTEND_BUFFER ()
7966+# else /* BYTE */
7967+# define GET_BUFFER_SPACE(n) \
7968+ while ((unsigned long) (b - bufp->buffer + (n)) > bufp->allocated) \
7969+ EXTEND_BUFFER ()
7970+# endif /* WCHAR */
7971+
7972+/* Make sure we have one more byte of buffer space and then add C to it. */
7973+# define BUF_PUSH(c) \
7974+ do { \
7975+ GET_BUFFER_SPACE (1); \
7976+ *b++ = (UCHAR_T) (c); \
7977+ } while (0)
7978+
7979+
7980+/* Ensure we have two more bytes of buffer space and then append C1 and C2. */
7981+# define BUF_PUSH_2(c1, c2) \
7982+ do { \
7983+ GET_BUFFER_SPACE (2); \
7984+ *b++ = (UCHAR_T) (c1); \
7985+ *b++ = (UCHAR_T) (c2); \
7986+ } while (0)
7987+
7988+
7989+/* As with BUF_PUSH_2, except for three bytes. */
7990+# define BUF_PUSH_3(c1, c2, c3) \
7991+ do { \
7992+ GET_BUFFER_SPACE (3); \
7993+ *b++ = (UCHAR_T) (c1); \
7994+ *b++ = (UCHAR_T) (c2); \
7995+ *b++ = (UCHAR_T) (c3); \
7996+ } while (0)
7997+
7998+/* Store a jump with opcode OP at LOC to location TO. We store a
7999+ relative address offset by the three bytes the jump itself occupies. */
8000+# define STORE_JUMP(op, loc, to) \
8001+ PREFIX(store_op1) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)))
8002+
8003+/* Likewise, for a two-argument jump. */
8004+# define STORE_JUMP2(op, loc, to, arg) \
8005+ PREFIX(store_op2) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)), arg)
8006+
8007+/* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */
8008+# define INSERT_JUMP(op, loc, to) \
8009+ PREFIX(insert_op1) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)), b)
8010+
8011+/* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */
8012+# define INSERT_JUMP2(op, loc, to, arg) \
8013+ PREFIX(insert_op2) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)),\
8014+ arg, b)
8015+
8016+/* This is not an arbitrary limit: the arguments which represent offsets
8017+ into the pattern are two bytes long. So if 2^16 bytes turns out to
8018+ be too small, many things would have to change. */
8019+/* Any other compiler which, like MSC, has allocation limit below 2^16
8020+ bytes will have to use approach similar to what was done below for
8021+ MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up
8022+ reallocating to 0 bytes. Such thing is not going to work too well.
8023+ You have been warned!! */
8024+# ifndef DEFINED_ONCE
8025+# if defined _MSC_VER && !defined WIN32
8026+/* Microsoft C 16-bit versions limit malloc to approx 65512 bytes.
8027+ The REALLOC define eliminates a flurry of conversion warnings,
8028+ but is not required. */
8029+# define MAX_BUF_SIZE 65500L
8030+# define REALLOC(p,s) realloc ((p), (size_t) (s))
8031+# else
8032+# define MAX_BUF_SIZE (1L << 16)
8033+# define REALLOC(p,s) realloc ((p), (s))
8034+# endif
8035+
8036+/* Extend the buffer by twice its current size via realloc and
8037+ reset the pointers that pointed into the old block to point to the
8038+ correct places in the new one. If extending the buffer results in it
8039+ being larger than MAX_BUF_SIZE, then flag memory exhausted. */
8040+# if __BOUNDED_POINTERS__
8041+# define SET_HIGH_BOUND(P) (__ptrhigh (P) = __ptrlow (P) + bufp->allocated)
8042+# define MOVE_BUFFER_POINTER(P) \
8043+ (__ptrlow (P) += incr, SET_HIGH_BOUND (P), __ptrvalue (P) += incr)
8044+# define ELSE_EXTEND_BUFFER_HIGH_BOUND \
8045+ else \
8046+ { \
8047+ SET_HIGH_BOUND (b); \
8048+ SET_HIGH_BOUND (begalt); \
8049+ if (fixup_alt_jump) \
8050+ SET_HIGH_BOUND (fixup_alt_jump); \
8051+ if (laststart) \
8052+ SET_HIGH_BOUND (laststart); \
8053+ if (pending_exact) \
8054+ SET_HIGH_BOUND (pending_exact); \
8055+ }
8056+# else
8057+# define MOVE_BUFFER_POINTER(P) (P) += incr
8058+# define ELSE_EXTEND_BUFFER_HIGH_BOUND
8059+# endif
8060+# endif /* not DEFINED_ONCE */
8061+
8062+# ifdef WCHAR
8063+# define EXTEND_BUFFER() \
8064+ do { \
8065+ UCHAR_T *old_buffer = COMPILED_BUFFER_VAR; \
8066+ int wchar_count; \
8067+ if (bufp->allocated + sizeof(UCHAR_T) > MAX_BUF_SIZE) \
8068+ return REG_ESIZE; \
8069+ bufp->allocated <<= 1; \
8070+ if (bufp->allocated > MAX_BUF_SIZE) \
8071+ bufp->allocated = MAX_BUF_SIZE; \
8072+ /* How many characters the new buffer can have? */ \
8073+ wchar_count = bufp->allocated / sizeof(UCHAR_T); \
8074+ if (wchar_count == 0) wchar_count = 1; \
8075+ /* Truncate the buffer to CHAR_T align. */ \
8076+ bufp->allocated = wchar_count * sizeof(UCHAR_T); \
8077+ RETALLOC (COMPILED_BUFFER_VAR, wchar_count, UCHAR_T); \
8078+ bufp->buffer = (char*)COMPILED_BUFFER_VAR; \
8079+ if (COMPILED_BUFFER_VAR == NULL) \
8080+ return REG_ESPACE; \
8081+ /* If the buffer moved, move all the pointers into it. */ \
8082+ if (old_buffer != COMPILED_BUFFER_VAR) \
8083+ { \
8084+ int incr = COMPILED_BUFFER_VAR - old_buffer; \
8085+ MOVE_BUFFER_POINTER (b); \
8086+ MOVE_BUFFER_POINTER (begalt); \
8087+ if (fixup_alt_jump) \
8088+ MOVE_BUFFER_POINTER (fixup_alt_jump); \
8089+ if (laststart) \
8090+ MOVE_BUFFER_POINTER (laststart); \
8091+ if (pending_exact) \
8092+ MOVE_BUFFER_POINTER (pending_exact); \
8093+ } \
8094+ ELSE_EXTEND_BUFFER_HIGH_BOUND \
8095+ } while (0)
8096+# else /* BYTE */
8097+# define EXTEND_BUFFER() \
8098+ do { \
8099+ UCHAR_T *old_buffer = COMPILED_BUFFER_VAR; \
8100+ if (bufp->allocated == MAX_BUF_SIZE) \
8101+ return REG_ESIZE; \
8102+ bufp->allocated <<= 1; \
8103+ if (bufp->allocated > MAX_BUF_SIZE) \
8104+ bufp->allocated = MAX_BUF_SIZE; \
8105+ bufp->buffer = (UCHAR_T *) REALLOC (COMPILED_BUFFER_VAR, \
8106+ bufp->allocated); \
8107+ if (COMPILED_BUFFER_VAR == NULL) \
8108+ return REG_ESPACE; \
8109+ /* If the buffer moved, move all the pointers into it. */ \
8110+ if (old_buffer != COMPILED_BUFFER_VAR) \
8111+ { \
8112+ int incr = COMPILED_BUFFER_VAR - old_buffer; \
8113+ MOVE_BUFFER_POINTER (b); \
8114+ MOVE_BUFFER_POINTER (begalt); \
8115+ if (fixup_alt_jump) \
8116+ MOVE_BUFFER_POINTER (fixup_alt_jump); \
8117+ if (laststart) \
8118+ MOVE_BUFFER_POINTER (laststart); \
8119+ if (pending_exact) \
8120+ MOVE_BUFFER_POINTER (pending_exact); \
8121+ } \
8122+ ELSE_EXTEND_BUFFER_HIGH_BOUND \
8123+ } while (0)
8124+# endif /* WCHAR */
8125+
8126+# ifndef DEFINED_ONCE
8127+/* Since we have one byte reserved for the register number argument to
8128+ {start,stop}_memory, the maximum number of groups we can report
8129+ things about is what fits in that byte. */
8130+# define MAX_REGNUM 255
8131+
8132+/* But patterns can have more than `MAX_REGNUM' registers. We just
8133+ ignore the excess. */
8134+typedef unsigned regnum_t;
8135+
8136+
8137+/* Macros for the compile stack. */
8138+
8139+/* Since offsets can go either forwards or backwards, this type needs to
8140+ be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */
8141+/* int may be not enough when sizeof(int) == 2. */
8142+typedef long pattern_offset_t;
8143+
8144+typedef struct
8145+{
8146+ pattern_offset_t begalt_offset;
8147+ pattern_offset_t fixup_alt_jump;
8148+ pattern_offset_t inner_group_offset;
8149+ pattern_offset_t laststart_offset;
8150+ regnum_t regnum;
8151+} compile_stack_elt_t;
8152+
8153+
8154+typedef struct
8155+{
8156+ compile_stack_elt_t *stack;
8157+ unsigned size;
8158+ unsigned avail; /* Offset of next open position. */
8159+} compile_stack_type;
8160+
8161+
8162+# define INIT_COMPILE_STACK_SIZE 32
8163+
8164+# define COMPILE_STACK_EMPTY (compile_stack.avail == 0)
8165+# define COMPILE_STACK_FULL (compile_stack.avail == compile_stack.size)
8166+
8167+/* The next available element. */
8168+# define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail])
8169+
8170+# endif /* not DEFINED_ONCE */
8171+
8172+/* Set the bit for character C in a list. */
8173+# ifndef DEFINED_ONCE
8174+# define SET_LIST_BIT(c) \
8175+ (b[((unsigned char) (c)) / BYTEWIDTH] \
8176+ |= 1 << (((unsigned char) c) % BYTEWIDTH))
8177+# endif /* DEFINED_ONCE */
8178+
8179+/* Get the next unsigned number in the uncompiled pattern. */
8180+# define GET_UNSIGNED_NUMBER(num) \
8181+ { \
8182+ while (p != pend) \
8183+ { \
8184+ PATFETCH (c); \
8185+ if (c < '0' || c > '9') \
8186+ break; \
8187+ if (num <= RE_DUP_MAX) \
8188+ { \
8189+ if (num < 0) \
8190+ num = 0; \
8191+ num = num * 10 + c - '0'; \
8192+ } \
8193+ } \
8194+ }
8195+
8196+# ifndef DEFINED_ONCE
8197+# if WIDE_CHAR_SUPPORT
8198+/* The GNU C library provides support for user-defined character classes
8199+ and the functions from ISO C amendement 1. */
8200+# ifdef CHARCLASS_NAME_MAX
8201+# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX
8202+# else
8203+/* This shouldn't happen but some implementation might still have this
8204+ problem. Use a reasonable default value. */
8205+# define CHAR_CLASS_MAX_LENGTH 256
8206+# endif
8207+
8208+# ifdef _LIBC
8209+# define IS_CHAR_CLASS(string) __wctype (string)
8210+# else
8211+# define IS_CHAR_CLASS(string) wctype (string)
8212+# endif
8213+# else
8214+# define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */
8215+
8216+# define IS_CHAR_CLASS(string) \
8217+ (STREQ (string, "alpha") || STREQ (string, "upper") \
8218+ || STREQ (string, "lower") || STREQ (string, "digit") \
8219+ || STREQ (string, "alnum") || STREQ (string, "xdigit") \
8220+ || STREQ (string, "space") || STREQ (string, "print") \
8221+ || STREQ (string, "punct") || STREQ (string, "graph") \
8222+ || STREQ (string, "cntrl") || STREQ (string, "blank"))
8223+# endif
8224+# endif /* DEFINED_ONCE */
8225+
8226+# ifndef MATCH_MAY_ALLOCATE
8227+
8228+/* If we cannot allocate large objects within re_match_2_internal,
8229+ we make the fail stack and register vectors global.
8230+ The fail stack, we grow to the maximum size when a regexp
8231+ is compiled.
8232+ The register vectors, we adjust in size each time we
8233+ compile a regexp, according to the number of registers it needs. */
8234+
8235+static PREFIX(fail_stack_type) fail_stack;
8236+
8237+/* Size with which the following vectors are currently allocated.
8238+ That is so we can make them bigger as needed,
8239+ but never make them smaller. */
8240+# ifdef DEFINED_ONCE
8241+static int regs_allocated_size;
8242+
8243+static const char ** regstart, ** regend;
8244+static const char ** old_regstart, ** old_regend;
8245+static const char **best_regstart, **best_regend;
8246+static const char **reg_dummy;
8247+# endif /* DEFINED_ONCE */
8248+
8249+static PREFIX(register_info_type) *PREFIX(reg_info);
8250+static PREFIX(register_info_type) *PREFIX(reg_info_dummy);
8251+
8252+/* Make the register vectors big enough for NUM_REGS registers,
8253+ but don't make them smaller. */
8254+
8255+static void
8256+PREFIX(regex_grow_registers) (int num_regs)
8257+{
8258+ if (num_regs > regs_allocated_size)
8259+ {
8260+ RETALLOC_IF (regstart, num_regs, const char *);
8261+ RETALLOC_IF (regend, num_regs, const char *);
8262+ RETALLOC_IF (old_regstart, num_regs, const char *);
8263+ RETALLOC_IF (old_regend, num_regs, const char *);
8264+ RETALLOC_IF (best_regstart, num_regs, const char *);
8265+ RETALLOC_IF (best_regend, num_regs, const char *);
8266+ RETALLOC_IF (PREFIX(reg_info), num_regs, PREFIX(register_info_type));
8267+ RETALLOC_IF (reg_dummy, num_regs, const char *);
8268+ RETALLOC_IF (PREFIX(reg_info_dummy), num_regs, PREFIX(register_info_type));
8269+
8270+ regs_allocated_size = num_regs;
8271+ }
8272+}
8273+
8274+# endif /* not MATCH_MAY_ALLOCATE */
8275+
8276+# ifndef DEFINED_ONCE
8277+static boolean group_in_compile_stack (compile_stack_type compile_stack,
8278+ regnum_t regnum);
8279+# endif /* not DEFINED_ONCE */
8280+
8281+/* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX.
8282+ Returns one of error codes defined in `regex.h', or zero for success.
8283+
8284+ Assumes the `allocated' (and perhaps `buffer') and `translate'
8285+ fields are set in BUFP on entry.
8286+
8287+ If it succeeds, results are put in BUFP (if it returns an error, the
8288+ contents of BUFP are undefined):
8289+ `buffer' is the compiled pattern;
8290+ `syntax' is set to SYNTAX;
8291+ `used' is set to the length of the compiled pattern;
8292+ `fastmap_accurate' is zero;
8293+ `re_nsub' is the number of subexpressions in PATTERN;
8294+ `not_bol' and `not_eol' are zero;
8295+
8296+ The `fastmap' and `newline_anchor' fields are neither
8297+ examined nor set. */
8298+
8299+/* Return, freeing storage we allocated. */
8300+# ifdef WCHAR
8301+# define FREE_STACK_RETURN(value) \
8302+ return (free(pattern), free(mbs_offset), free(is_binary), free (compile_stack.stack), value)
8303+# else
8304+# define FREE_STACK_RETURN(value) \
8305+ return (free (compile_stack.stack), value)
8306+# endif /* WCHAR */
8307+
8308+static reg_errcode_t
8309+PREFIX(regex_compile) (const char *ARG_PREFIX(pattern),
8310+ size_t ARG_PREFIX(size), reg_syntax_t syntax,
8311+ struct re_pattern_buffer *bufp)
8312+{
8313+ /* We fetch characters from PATTERN here. Even though PATTERN is
8314+ `char *' (i.e., signed), we declare these variables as unsigned, so
8315+ they can be reliably used as array indices. */
8316+ register UCHAR_T c, c1;
8317+
8318+#ifdef WCHAR
8319+ /* A temporary space to keep wchar_t pattern and compiled pattern. */
8320+ CHAR_T *pattern, *COMPILED_BUFFER_VAR;
8321+ size_t size;
8322+ /* offset buffer for optimization. See convert_mbs_to_wc. */
8323+ int *mbs_offset = NULL;
8324+ /* It hold whether each wchar_t is binary data or not. */
8325+ char *is_binary = NULL;
8326+ /* A flag whether exactn is handling binary data or not. */
8327+ char is_exactn_bin = FALSE;
8328+#endif /* WCHAR */
8329+
8330+ /* A random temporary spot in PATTERN. */
8331+ const CHAR_T *p1;
8332+
8333+ /* Points to the end of the buffer, where we should append. */
8334+ register UCHAR_T *b;
8335+
8336+ /* Keeps track of unclosed groups. */
8337+ compile_stack_type compile_stack;
8338+
8339+ /* Points to the current (ending) position in the pattern. */
8340+#ifdef WCHAR
8341+ const CHAR_T *p;
8342+ const CHAR_T *pend;
8343+#else /* BYTE */
8344+ const CHAR_T *p = pattern;
8345+ const CHAR_T *pend = pattern + size;
8346+#endif /* WCHAR */
8347+
8348+ /* How to translate the characters in the pattern. */
8349+ RE_TRANSLATE_TYPE translate = bufp->translate;
8350+
8351+ /* Address of the count-byte of the most recently inserted `exactn'
8352+ command. This makes it possible to tell if a new exact-match
8353+ character can be added to that command or if the character requires
8354+ a new `exactn' command. */
8355+ UCHAR_T *pending_exact = 0;
8356+
8357+ /* Address of start of the most recently finished expression.
8358+ This tells, e.g., postfix * where to find the start of its
8359+ operand. Reset at the beginning of groups and alternatives. */
8360+ UCHAR_T *laststart = 0;
8361+
8362+ /* Address of beginning of regexp, or inside of last group. */
8363+ UCHAR_T *begalt;
8364+
8365+ /* Address of the place where a forward jump should go to the end of
8366+ the containing expression. Each alternative of an `or' -- except the
8367+ last -- ends with a forward jump of this sort. */
8368+ UCHAR_T *fixup_alt_jump = 0;
8369+
8370+ /* Counts open-groups as they are encountered. Remembered for the
8371+ matching close-group on the compile stack, so the same register
8372+ number is put in the stop_memory as the start_memory. */
8373+ regnum_t regnum = 0;
8374+
8375+#ifdef WCHAR
8376+ /* Initialize the wchar_t PATTERN and offset_buffer. */
8377+ p = pend = pattern = TALLOC(csize + 1, CHAR_T);
8378+ mbs_offset = TALLOC(csize + 1, int);
8379+ is_binary = TALLOC(csize + 1, char);
8380+ if (pattern == NULL || mbs_offset == NULL || is_binary == NULL)
8381+ {
8382+ free(pattern);
8383+ free(mbs_offset);
8384+ free(is_binary);
8385+ return REG_ESPACE;
8386+ }
8387+ pattern[csize] = L'\0'; /* sentinel */
8388+ size = convert_mbs_to_wcs(pattern, cpattern, csize, mbs_offset, is_binary);
8389+ pend = p + size;
8390+ if (size < 0)
8391+ {
8392+ free(pattern);
8393+ free(mbs_offset);
8394+ free(is_binary);
8395+ return REG_BADPAT;
8396+ }
8397+#endif
8398+
8399+#ifdef DEBUG
8400+ DEBUG_PRINT1 ("\nCompiling pattern: ");
8401+ if (debug)
8402+ {
8403+ unsigned debug_count;
8404+
8405+ for (debug_count = 0; debug_count < size; debug_count++)
8406+ PUT_CHAR (pattern[debug_count]);
8407+ putchar ('\n');
8408+ }
8409+#endif /* DEBUG */
8410+
8411+ /* Initialize the compile stack. */
8412+ compile_stack.stack = TALLOC (INIT_COMPILE_STACK_SIZE, compile_stack_elt_t);
8413+ if (compile_stack.stack == NULL)
8414+ {
8415+#ifdef WCHAR
8416+ free(pattern);
8417+ free(mbs_offset);
8418+ free(is_binary);
8419+#endif
8420+ return REG_ESPACE;
8421+ }
8422+
8423+ compile_stack.size = INIT_COMPILE_STACK_SIZE;
8424+ compile_stack.avail = 0;
8425+
8426+ /* Initialize the pattern buffer. */
8427+ bufp->syntax = syntax;
8428+ bufp->fastmap_accurate = 0;
8429+ bufp->not_bol = bufp->not_eol = 0;
8430+
8431+ /* Set `used' to zero, so that if we return an error, the pattern
8432+ printer (for debugging) will think there's no pattern. We reset it
8433+ at the end. */
8434+ bufp->used = 0;
8435+
8436+ /* Always count groups, whether or not bufp->no_sub is set. */
8437+ bufp->re_nsub = 0;
8438+
8439+#if !defined emacs && !defined SYNTAX_TABLE
8440+ /* Initialize the syntax table. */
8441+ init_syntax_once ();
8442+#endif
8443+
8444+ if (bufp->allocated == 0)
8445+ {
8446+ if (bufp->buffer)
8447+ { /* If zero allocated, but buffer is non-null, try to realloc
8448+ enough space. This loses if buffer's address is bogus, but
8449+ that is the user's responsibility. */
8450+#ifdef WCHAR
8451+ /* Free bufp->buffer and allocate an array for wchar_t pattern
8452+ buffer. */
8453+ free(bufp->buffer);
8454+ COMPILED_BUFFER_VAR = TALLOC (INIT_BUF_SIZE/sizeof(UCHAR_T),
8455+ UCHAR_T);
8456+#else
8457+ RETALLOC (COMPILED_BUFFER_VAR, INIT_BUF_SIZE, UCHAR_T);
8458+#endif /* WCHAR */
8459+ }
8460+ else
8461+ { /* Caller did not allocate a buffer. Do it for them. */
8462+ COMPILED_BUFFER_VAR = TALLOC (INIT_BUF_SIZE / sizeof(UCHAR_T),
8463+ UCHAR_T);
8464+ }
8465+
8466+ if (!COMPILED_BUFFER_VAR) FREE_STACK_RETURN (REG_ESPACE);
8467+#ifdef WCHAR
8468+ bufp->buffer = (char*)COMPILED_BUFFER_VAR;
8469+#endif /* WCHAR */
8470+ bufp->allocated = INIT_BUF_SIZE;
8471+ }
8472+#ifdef WCHAR
8473+ else
8474+ COMPILED_BUFFER_VAR = (UCHAR_T*) bufp->buffer;
8475+#endif
8476+
8477+ begalt = b = COMPILED_BUFFER_VAR;
8478+
8479+ /* Loop through the uncompiled pattern until we're at the end. */
8480+ while (p != pend)
8481+ {
8482+ PATFETCH (c);
8483+
8484+ switch (c)
8485+ {
8486+ case '^':
8487+ {
8488+ if ( /* If at start of pattern, it's an operator. */
8489+ p == pattern + 1
8490+ /* If context independent, it's an operator. */
8491+ || syntax & RE_CONTEXT_INDEP_ANCHORS
8492+ /* Otherwise, depends on what's come before. */
8493+ || PREFIX(at_begline_loc_p) (pattern, p, syntax))
8494+ BUF_PUSH (begline);
8495+ else
8496+ goto normal_char;
8497+ }
8498+ break;
8499+
8500+
8501+ case '$':
8502+ {
8503+ if ( /* If at end of pattern, it's an operator. */
8504+ p == pend
8505+ /* If context independent, it's an operator. */
8506+ || syntax & RE_CONTEXT_INDEP_ANCHORS
8507+ /* Otherwise, depends on what's next. */
8508+ || PREFIX(at_endline_loc_p) (p, pend, syntax))
8509+ BUF_PUSH (endline);
8510+ else
8511+ goto normal_char;
8512+ }
8513+ break;
8514+
8515+
8516+ case '+':
8517+ case '?':
8518+ if ((syntax & RE_BK_PLUS_QM)
8519+ || (syntax & RE_LIMITED_OPS))
8520+ goto normal_char;
8521+ handle_plus:
8522+ case '*':
8523+ /* If there is no previous pattern... */
8524+ if (!laststart)
8525+ {
8526+ if (syntax & RE_CONTEXT_INVALID_OPS)
8527+ FREE_STACK_RETURN (REG_BADRPT);
8528+ else if (!(syntax & RE_CONTEXT_INDEP_OPS))
8529+ goto normal_char;
8530+ }
8531+
8532+ {
8533+ /* Are we optimizing this jump? */
8534+ boolean keep_string_p = false;
8535+
8536+ /* 1 means zero (many) matches is allowed. */
8537+ char zero_times_ok = 0, many_times_ok = 0;
8538+
8539+ /* If there is a sequence of repetition chars, collapse it
8540+ down to just one (the right one). We can't combine
8541+ interval operators with these because of, e.g., `a{2}*',
8542+ which should only match an even number of `a's. */
8543+
8544+ for (;;)
8545+ {
8546+ zero_times_ok |= c != '+';
8547+ many_times_ok |= c != '?';
8548+
8549+ if (p == pend)
8550+ break;
8551+
8552+ PATFETCH (c);
8553+
8554+ if (c == '*'
8555+ || (!(syntax & RE_BK_PLUS_QM) && (c == '+' || c == '?')))
8556+ ;
8557+
8558+ else if (syntax & RE_BK_PLUS_QM && c == '\\')
8559+ {
8560+ if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
8561+
8562+ PATFETCH (c1);
8563+ if (!(c1 == '+' || c1 == '?'))
8564+ {
8565+ PATUNFETCH;
8566+ PATUNFETCH;
8567+ break;
8568+ }
8569+
8570+ c = c1;
8571+ }
8572+ else
8573+ {
8574+ PATUNFETCH;
8575+ break;
8576+ }
8577+
8578+ /* If we get here, we found another repeat character. */
8579+ }
8580+
8581+ /* Star, etc. applied to an empty pattern is equivalent
8582+ to an empty pattern. */
8583+ if (!laststart)
8584+ break;
8585+
8586+ /* Now we know whether or not zero matches is allowed
8587+ and also whether or not two or more matches is allowed. */
8588+ if (many_times_ok)
8589+ { /* More than one repetition is allowed, so put in at the
8590+ end a backward relative jump from `b' to before the next
8591+ jump we're going to put in below (which jumps from
8592+ laststart to after this jump).
8593+
8594+ But if we are at the `*' in the exact sequence `.*\n',
8595+ insert an unconditional jump backwards to the .,
8596+ instead of the beginning of the loop. This way we only
8597+ push a failure point once, instead of every time
8598+ through the loop. */
8599+ assert (p - 1 > pattern);
8600+
8601+ /* Allocate the space for the jump. */
8602+ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
8603+
8604+ /* We know we are not at the first character of the pattern,
8605+ because laststart was nonzero. And we've already
8606+ incremented `p', by the way, to be the character after
8607+ the `*'. Do we have to do something analogous here
8608+ for null bytes, because of RE_DOT_NOT_NULL? */
8609+ if (TRANSLATE (*(p - 2)) == TRANSLATE ('.')
8610+ && zero_times_ok
8611+ && p < pend && TRANSLATE (*p) == TRANSLATE ('\n')
8612+ && !(syntax & RE_DOT_NEWLINE))
8613+ { /* We have .*\n. */
8614+ STORE_JUMP (jump, b, laststart);
8615+ keep_string_p = true;
8616+ }
8617+ else
8618+ /* Anything else. */
8619+ STORE_JUMP (maybe_pop_jump, b, laststart -
8620+ (1 + OFFSET_ADDRESS_SIZE));
8621+
8622+ /* We've added more stuff to the buffer. */
8623+ b += 1 + OFFSET_ADDRESS_SIZE;
8624+ }
8625+
8626+ /* On failure, jump from laststart to b + 3, which will be the
8627+ end of the buffer after this jump is inserted. */
8628+ /* ifdef WCHAR, 'b + 1 + OFFSET_ADDRESS_SIZE' instead of
8629+ 'b + 3'. */
8630+ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
8631+ INSERT_JUMP (keep_string_p ? on_failure_keep_string_jump
8632+ : on_failure_jump,
8633+ laststart, b + 1 + OFFSET_ADDRESS_SIZE);
8634+ pending_exact = 0;
8635+ b += 1 + OFFSET_ADDRESS_SIZE;
8636+
8637+ if (!zero_times_ok)
8638+ {
8639+ /* At least one repetition is required, so insert a
8640+ `dummy_failure_jump' before the initial
8641+ `on_failure_jump' instruction of the loop. This
8642+ effects a skip over that instruction the first time
8643+ we hit that loop. */
8644+ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
8645+ INSERT_JUMP (dummy_failure_jump, laststart, laststart +
8646+ 2 + 2 * OFFSET_ADDRESS_SIZE);
8647+ b += 1 + OFFSET_ADDRESS_SIZE;
8648+ }
8649+ }
8650+ break;
8651+
8652+
8653+ case '.':
8654+ laststart = b;
8655+ BUF_PUSH (anychar);
8656+ break;
8657+
8658+
8659+ case '[':
8660+ {
8661+ boolean had_char_class = false;
8662+#ifdef WCHAR
8663+ CHAR_T range_start = 0xffffffff;
8664+#else
8665+ unsigned int range_start = 0xffffffff;
8666+#endif
8667+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
8668+
8669+#ifdef WCHAR
8670+ /* We assume a charset(_not) structure as a wchar_t array.
8671+ charset[0] = (re_opcode_t) charset(_not)
8672+ charset[1] = l (= length of char_classes)
8673+ charset[2] = m (= length of collating_symbols)
8674+ charset[3] = n (= length of equivalence_classes)
8675+ charset[4] = o (= length of char_ranges)
8676+ charset[5] = p (= length of chars)
8677+
8678+ charset[6] = char_class (wctype_t)
8679+ charset[6+CHAR_CLASS_SIZE] = char_class (wctype_t)
8680+ ...
8681+ charset[l+5] = char_class (wctype_t)
8682+
8683+ charset[l+6] = collating_symbol (wchar_t)
8684+ ...
8685+ charset[l+m+5] = collating_symbol (wchar_t)
8686+ ifdef _LIBC we use the index if
8687+ _NL_COLLATE_SYMB_EXTRAMB instead of
8688+ wchar_t string.
8689+
8690+ charset[l+m+6] = equivalence_classes (wchar_t)
8691+ ...
8692+ charset[l+m+n+5] = equivalence_classes (wchar_t)
8693+ ifdef _LIBC we use the index in
8694+ _NL_COLLATE_WEIGHT instead of
8695+ wchar_t string.
8696+
8697+ charset[l+m+n+6] = range_start
8698+ charset[l+m+n+7] = range_end
8699+ ...
8700+ charset[l+m+n+2o+4] = range_start
8701+ charset[l+m+n+2o+5] = range_end
8702+ ifdef _LIBC we use the value looked up
8703+ in _NL_COLLATE_COLLSEQ instead of
8704+ wchar_t character.
8705+
8706+ charset[l+m+n+2o+6] = char
8707+ ...
8708+ charset[l+m+n+2o+p+5] = char
8709+
8710+ */
8711+
8712+ /* We need at least 6 spaces: the opcode, the length of
8713+ char_classes, the length of collating_symbols, the length of
8714+ equivalence_classes, the length of char_ranges, the length of
8715+ chars. */
8716+ GET_BUFFER_SPACE (6);
8717+
8718+ /* Save b as laststart. And We use laststart as the pointer
8719+ to the first element of the charset here.
8720+ In other words, laststart[i] indicates charset[i]. */
8721+ laststart = b;
8722+
8723+ /* We test `*p == '^' twice, instead of using an if
8724+ statement, so we only need one BUF_PUSH. */
8725+ BUF_PUSH (*p == '^' ? charset_not : charset);
8726+ if (*p == '^')
8727+ p++;
8728+
8729+ /* Push the length of char_classes, the length of
8730+ collating_symbols, the length of equivalence_classes, the
8731+ length of char_ranges and the length of chars. */
8732+ BUF_PUSH_3 (0, 0, 0);
8733+ BUF_PUSH_2 (0, 0);
8734+
8735+ /* Remember the first position in the bracket expression. */
8736+ p1 = p;
8737+
8738+ /* charset_not matches newline according to a syntax bit. */
8739+ if ((re_opcode_t) b[-6] == charset_not
8740+ && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
8741+ {
8742+ BUF_PUSH('\n');
8743+ laststart[5]++; /* Update the length of characters */
8744+ }
8745+
8746+ /* Read in characters and ranges, setting map bits. */
8747+ for (;;)
8748+ {
8749+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
8750+
8751+ PATFETCH (c);
8752+
8753+ /* \ might escape characters inside [...] and [^...]. */
8754+ if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\')
8755+ {
8756+ if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
8757+
8758+ PATFETCH (c1);
8759+ BUF_PUSH(c1);
8760+ laststart[5]++; /* Update the length of chars */
8761+ range_start = c1;
8762+ continue;
8763+ }
8764+
8765+ /* Could be the end of the bracket expression. If it's
8766+ not (i.e., when the bracket expression is `[]' so
8767+ far), the ']' character bit gets set way below. */
8768+ if (c == ']' && p != p1 + 1)
8769+ break;
8770+
8771+ /* Look ahead to see if it's a range when the last thing
8772+ was a character class. */
8773+ if (had_char_class && c == '-' && *p != ']')
8774+ FREE_STACK_RETURN (REG_ERANGE);
8775+
8776+ /* Look ahead to see if it's a range when the last thing
8777+ was a character: if this is a hyphen not at the
8778+ beginning or the end of a list, then it's the range
8779+ operator. */
8780+ if (c == '-'
8781+ && !(p - 2 >= pattern && p[-2] == '[')
8782+ && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^')
8783+ && *p != ']')
8784+ {
8785+ reg_errcode_t ret;
8786+ /* Allocate the space for range_start and range_end. */
8787+ GET_BUFFER_SPACE (2);
8788+ /* Update the pointer to indicate end of buffer. */
8789+ b += 2;
8790+ ret = wcs_compile_range (range_start, &p, pend, translate,
8791+ syntax, b, laststart);
8792+ if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
8793+ range_start = 0xffffffff;
8794+ }
8795+ else if (p[0] == '-' && p[1] != ']')
8796+ { /* This handles ranges made up of characters only. */
8797+ reg_errcode_t ret;
8798+
8799+ /* Move past the `-'. */
8800+ PATFETCH (c1);
8801+ /* Allocate the space for range_start and range_end. */
8802+ GET_BUFFER_SPACE (2);
8803+ /* Update the pointer to indicate end of buffer. */
8804+ b += 2;
8805+ ret = wcs_compile_range (c, &p, pend, translate, syntax, b,
8806+ laststart);
8807+ if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
8808+ range_start = 0xffffffff;
8809+ }
8810+
8811+ /* See if we're at the beginning of a possible character
8812+ class. */
8813+ else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
8814+ { /* Leave room for the null. */
8815+ char str[CHAR_CLASS_MAX_LENGTH + 1];
8816+
8817+ PATFETCH (c);
8818+ c1 = 0;
8819+
8820+ /* If pattern is `[[:'. */
8821+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
8822+
8823+ for (;;)
8824+ {
8825+ PATFETCH (c);
8826+ if ((c == ':' && *p == ']') || p == pend)
8827+ break;
8828+ if (c1 < CHAR_CLASS_MAX_LENGTH)
8829+ str[c1++] = c;
8830+ else
8831+ /* This is in any case an invalid class name. */
8832+ str[0] = '\0';
8833+ }
8834+ str[c1] = '\0';
8835+
8836+ /* If isn't a word bracketed by `[:' and `:]':
8837+ undo the ending character, the letters, and leave
8838+ the leading `:' and `[' (but store them as character). */
8839+ if (c == ':' && *p == ']')
8840+ {
8841+ wctype_t wt;
8842+ uintptr_t alignedp;
8843+
8844+ /* Query the character class as wctype_t. */
8845+ wt = IS_CHAR_CLASS (str);
8846+ if (wt == 0)
8847+ FREE_STACK_RETURN (REG_ECTYPE);
8848+
8849+ /* Throw away the ] at the end of the character
8850+ class. */
8851+ PATFETCH (c);
8852+
8853+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
8854+
8855+ /* Allocate the space for character class. */
8856+ GET_BUFFER_SPACE(CHAR_CLASS_SIZE);
8857+ /* Update the pointer to indicate end of buffer. */
8858+ b += CHAR_CLASS_SIZE;
8859+ /* Move data which follow character classes
8860+ not to violate the data. */
8861+ insert_space(CHAR_CLASS_SIZE,
8862+ laststart + 6 + laststart[1],
8863+ b - 1);
8864+ alignedp = ((uintptr_t)(laststart + 6 + laststart[1])
8865+ + __alignof__(wctype_t) - 1)
8866+ & ~(uintptr_t)(__alignof__(wctype_t) - 1);
8867+ /* Store the character class. */
8868+ *((wctype_t*)alignedp) = wt;
8869+ /* Update length of char_classes */
8870+ laststart[1] += CHAR_CLASS_SIZE;
8871+
8872+ had_char_class = true;
8873+ }
8874+ else
8875+ {
8876+ c1++;
8877+ while (c1--)
8878+ PATUNFETCH;
8879+ BUF_PUSH ('[');
8880+ BUF_PUSH (':');
8881+ laststart[5] += 2; /* Update the length of characters */
8882+ range_start = ':';
8883+ had_char_class = false;
8884+ }
8885+ }
8886+ else if (syntax & RE_CHAR_CLASSES && c == '[' && (*p == '='
8887+ || *p == '.'))
8888+ {
8889+ CHAR_T str[128]; /* Should be large enough. */
8890+ CHAR_T delim = *p; /* '=' or '.' */
8891+# ifdef _LIBC
8892+ uint32_t nrules =
8893+ _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
8894+# endif
8895+ PATFETCH (c);
8896+ c1 = 0;
8897+
8898+ /* If pattern is `[[=' or '[[.'. */
8899+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
8900+
8901+ for (;;)
8902+ {
8903+ PATFETCH (c);
8904+ if ((c == delim && *p == ']') || p == pend)
8905+ break;
8906+ if (c1 < sizeof (str) - 1)
8907+ str[c1++] = c;
8908+ else
8909+ /* This is in any case an invalid class name. */
8910+ str[0] = '\0';
8911+ }
8912+ str[c1] = '\0';
8913+
8914+ if (c == delim && *p == ']' && str[0] != '\0')
8915+ {
8916+ unsigned int i, offset;
8917+ /* If we have no collation data we use the default
8918+ collation in which each character is in a class
8919+ by itself. It also means that ASCII is the
8920+ character set and therefore we cannot have character
8921+ with more than one byte in the multibyte
8922+ representation. */
8923+
8924+ /* If not defined _LIBC, we push the name and
8925+ `\0' for the sake of matching performance. */
8926+ int datasize = c1 + 1;
8927+
8928+# ifdef _LIBC
8929+ int32_t idx = 0;
8930+ if (nrules == 0)
8931+# endif
8932+ {
8933+ if (c1 != 1)
8934+ FREE_STACK_RETURN (REG_ECOLLATE);
8935+ }
8936+# ifdef _LIBC
8937+ else
8938+ {
8939+ const int32_t *table;
8940+ const int32_t *weights;
8941+ const int32_t *extra;
8942+ const int32_t *indirect;
8943+ wint_t *cp;
8944+
8945+ /* This #include defines a local function! */
8946+# include <locale/weightwc.h>
8947+
8948+ if(delim == '=')
8949+ {
8950+ /* We push the index for equivalence class. */
8951+ cp = (wint_t*)str;
8952+
8953+ table = (const int32_t *)
8954+ _NL_CURRENT (LC_COLLATE,
8955+ _NL_COLLATE_TABLEWC);
8956+ weights = (const int32_t *)
8957+ _NL_CURRENT (LC_COLLATE,
8958+ _NL_COLLATE_WEIGHTWC);
8959+ extra = (const int32_t *)
8960+ _NL_CURRENT (LC_COLLATE,
8961+ _NL_COLLATE_EXTRAWC);
8962+ indirect = (const int32_t *)
8963+ _NL_CURRENT (LC_COLLATE,
8964+ _NL_COLLATE_INDIRECTWC);
8965+
8966+ idx = findidx ((const wint_t**)&cp, c1);
8967+ if (idx == 0 || cp < (wint_t*) str + c1)
8968+ /* This is no valid character. */
8969+ FREE_STACK_RETURN (REG_ECOLLATE);
8970+
8971+ str[0] = (wchar_t)idx;
8972+ }
8973+ else /* delim == '.' */
8974+ {
8975+ /* We push collation sequence value
8976+ for collating symbol. */
8977+ int32_t table_size;
8978+ const int32_t *symb_table;
8979+ const unsigned char *extra;
8980+ int32_t idx;
8981+ int32_t elem;
8982+ int32_t second;
8983+ int32_t hash;
8984+ char char_str[c1];
8985+
8986+ /* We have to convert the name to a single-byte
8987+ string. This is possible since the names
8988+ consist of ASCII characters and the internal
8989+ representation is UCS4. */
8990+ for (i = 0; i < c1; ++i)
8991+ char_str[i] = str[i];
8992+
8993+ table_size =
8994+ _NL_CURRENT_WORD (LC_COLLATE,
8995+ _NL_COLLATE_SYMB_HASH_SIZEMB);
8996+ symb_table = (const int32_t *)
8997+ _NL_CURRENT (LC_COLLATE,
8998+ _NL_COLLATE_SYMB_TABLEMB);
8999+ extra = (const unsigned char *)
9000+ _NL_CURRENT (LC_COLLATE,
9001+ _NL_COLLATE_SYMB_EXTRAMB);
9002+
9003+ /* Locate the character in the hashing table. */
9004+ hash = elem_hash (char_str, c1);
9005+
9006+ idx = 0;
9007+ elem = hash % table_size;
9008+ second = hash % (table_size - 2);
9009+ while (symb_table[2 * elem] != 0)
9010+ {
9011+ /* First compare the hashing value. */
9012+ if (symb_table[2 * elem] == hash
9013+ && c1 == extra[symb_table[2 * elem + 1]]
9014+ && memcmp (char_str,
9015+ &extra[symb_table[2 * elem + 1]
9016+ + 1], c1) == 0)
9017+ {
9018+ /* Yep, this is the entry. */
9019+ idx = symb_table[2 * elem + 1];
9020+ idx += 1 + extra[idx];
9021+ break;
9022+ }
9023+
9024+ /* Next entry. */
9025+ elem += second;
9026+ }
9027+
9028+ if (symb_table[2 * elem] != 0)
9029+ {
9030+ /* Compute the index of the byte sequence
9031+ in the table. */
9032+ idx += 1 + extra[idx];
9033+ /* Adjust for the alignment. */
9034+ idx = (idx + 3) & ~3;
9035+
9036+ str[0] = (wchar_t) idx + 4;
9037+ }
9038+ else if (symb_table[2 * elem] == 0 && c1 == 1)
9039+ {
9040+ /* No valid character. Match it as a
9041+ single byte character. */
9042+ had_char_class = false;
9043+ BUF_PUSH(str[0]);
9044+ /* Update the length of characters */
9045+ laststart[5]++;
9046+ range_start = str[0];
9047+
9048+ /* Throw away the ] at the end of the
9049+ collating symbol. */
9050+ PATFETCH (c);
9051+ /* exit from the switch block. */
9052+ continue;
9053+ }
9054+ else
9055+ FREE_STACK_RETURN (REG_ECOLLATE);
9056+ }
9057+ datasize = 1;
9058+ }
9059+# endif
9060+ /* Throw away the ] at the end of the equivalence
9061+ class (or collating symbol). */
9062+ PATFETCH (c);
9063+
9064+ /* Allocate the space for the equivalence class
9065+ (or collating symbol) (and '\0' if needed). */
9066+ GET_BUFFER_SPACE(datasize);
9067+ /* Update the pointer to indicate end of buffer. */
9068+ b += datasize;
9069+
9070+ if (delim == '=')
9071+ { /* equivalence class */
9072+ /* Calculate the offset of char_ranges,
9073+ which is next to equivalence_classes. */
9074+ offset = laststart[1] + laststart[2]
9075+ + laststart[3] +6;
9076+ /* Insert space. */
9077+ insert_space(datasize, laststart + offset, b - 1);
9078+
9079+ /* Write the equivalence_class and \0. */
9080+ for (i = 0 ; i < datasize ; i++)
9081+ laststart[offset + i] = str[i];
9082+
9083+ /* Update the length of equivalence_classes. */
9084+ laststart[3] += datasize;
9085+ had_char_class = true;
9086+ }
9087+ else /* delim == '.' */
9088+ { /* collating symbol */
9089+ /* Calculate the offset of the equivalence_classes,
9090+ which is next to collating_symbols. */
9091+ offset = laststart[1] + laststart[2] + 6;
9092+ /* Insert space and write the collationg_symbol
9093+ and \0. */
9094+ insert_space(datasize, laststart + offset, b-1);
9095+ for (i = 0 ; i < datasize ; i++)
9096+ laststart[offset + i] = str[i];
9097+
9098+ /* In re_match_2_internal if range_start < -1, we
9099+ assume -range_start is the offset of the
9100+ collating symbol which is specified as
9101+ the character of the range start. So we assign
9102+ -(laststart[1] + laststart[2] + 6) to
9103+ range_start. */
9104+ range_start = -(laststart[1] + laststart[2] + 6);
9105+ /* Update the length of collating_symbol. */
9106+ laststart[2] += datasize;
9107+ had_char_class = false;
9108+ }
9109+ }
9110+ else
9111+ {
9112+ c1++;
9113+ while (c1--)
9114+ PATUNFETCH;
9115+ BUF_PUSH ('[');
9116+ BUF_PUSH (delim);
9117+ laststart[5] += 2; /* Update the length of characters */
9118+ range_start = delim;
9119+ had_char_class = false;
9120+ }
9121+ }
9122+ else
9123+ {
9124+ had_char_class = false;
9125+ BUF_PUSH(c);
9126+ laststart[5]++; /* Update the length of characters */
9127+ range_start = c;
9128+ }
9129+ }
9130+
9131+#else /* BYTE */
9132+ /* Ensure that we have enough space to push a charset: the
9133+ opcode, the length count, and the bitset; 34 bytes in all. */
9134+ GET_BUFFER_SPACE (34);
9135+
9136+ laststart = b;
9137+
9138+ /* We test `*p == '^' twice, instead of using an if
9139+ statement, so we only need one BUF_PUSH. */
9140+ BUF_PUSH (*p == '^' ? charset_not : charset);
9141+ if (*p == '^')
9142+ p++;
9143+
9144+ /* Remember the first position in the bracket expression. */
9145+ p1 = p;
9146+
9147+ /* Push the number of bytes in the bitmap. */
9148+ BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
9149+
9150+ /* Clear the whole map. */
9151+ bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH);
9152+
9153+ /* charset_not matches newline according to a syntax bit. */
9154+ if ((re_opcode_t) b[-2] == charset_not
9155+ && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
9156+ SET_LIST_BIT ('\n');
9157+
9158+ /* Read in characters and ranges, setting map bits. */
9159+ for (;;)
9160+ {
9161+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
9162+
9163+ PATFETCH (c);
9164+
9165+ /* \ might escape characters inside [...] and [^...]. */
9166+ if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\')
9167+ {
9168+ if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
9169+
9170+ PATFETCH (c1);
9171+ SET_LIST_BIT (c1);
9172+ range_start = c1;
9173+ continue;
9174+ }
9175+
9176+ /* Could be the end of the bracket expression. If it's
9177+ not (i.e., when the bracket expression is `[]' so
9178+ far), the ']' character bit gets set way below. */
9179+ if (c == ']' && p != p1 + 1)
9180+ break;
9181+
9182+ /* Look ahead to see if it's a range when the last thing
9183+ was a character class. */
9184+ if (had_char_class && c == '-' && *p != ']')
9185+ FREE_STACK_RETURN (REG_ERANGE);
9186+
9187+ /* Look ahead to see if it's a range when the last thing
9188+ was a character: if this is a hyphen not at the
9189+ beginning or the end of a list, then it's the range
9190+ operator. */
9191+ if (c == '-'
9192+ && !(p - 2 >= pattern && p[-2] == '[')
9193+ && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^')
9194+ && *p != ']')
9195+ {
9196+ reg_errcode_t ret
9197+ = byte_compile_range (range_start, &p, pend, translate,
9198+ syntax, b);
9199+ if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
9200+ range_start = 0xffffffff;
9201+ }
9202+
9203+ else if (p[0] == '-' && p[1] != ']')
9204+ { /* This handles ranges made up of characters only. */
9205+ reg_errcode_t ret;
9206+
9207+ /* Move past the `-'. */
9208+ PATFETCH (c1);
9209+
9210+ ret = byte_compile_range (c, &p, pend, translate, syntax, b);
9211+ if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
9212+ range_start = 0xffffffff;
9213+ }
9214+
9215+ /* See if we're at the beginning of a possible character
9216+ class. */
9217+
9218+ else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
9219+ { /* Leave room for the null. */
9220+ char str[CHAR_CLASS_MAX_LENGTH + 1];
9221+
9222+ PATFETCH (c);
9223+ c1 = 0;
9224+
9225+ /* If pattern is `[[:'. */
9226+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
9227+
9228+ for (;;)
9229+ {
9230+ PATFETCH (c);
9231+ if ((c == ':' && *p == ']') || p == pend)
9232+ break;
9233+ if (((int) c1) < CHAR_CLASS_MAX_LENGTH)
9234+ str[c1++] = c;
9235+ else
9236+ /* This is in any case an invalid class name. */
9237+ str[0] = '\0';
9238+ }
9239+ str[c1] = '\0';
9240+
9241+ /* If isn't a word bracketed by `[:' and `:]':
9242+ undo the ending character, the letters, and leave
9243+ the leading `:' and `[' (but set bits for them). */
9244+ if (c == ':' && *p == ']')
9245+ {
9246+# if WIDE_CHAR_SUPPORT
9247+ boolean is_lower = STREQ (str, "lower");
9248+ boolean is_upper = STREQ (str, "upper");
9249+ wctype_t wt;
9250+ int ch;
9251+
9252+ wt = IS_CHAR_CLASS (str);
9253+ if (wt == 0)
9254+ FREE_STACK_RETURN (REG_ECTYPE);
9255+
9256+ /* Throw away the ] at the end of the character
9257+ class. */
9258+ PATFETCH (c);
9259+
9260+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
9261+
9262+ for (ch = 0; ch < 1 << BYTEWIDTH; ++ch)
9263+ {
9264+# ifdef _LIBC
9265+ if (__iswctype (__btowc (ch), wt))
9266+ SET_LIST_BIT (ch);
9267+# else
9268+ if (iswctype (btowc (ch), wt))
9269+ SET_LIST_BIT (ch);
9270+# endif
9271+
9272+ if (translate && (is_upper || is_lower)
9273+ && (ISUPPER (ch) || ISLOWER (ch)))
9274+ SET_LIST_BIT (ch);
9275+ }
9276+
9277+ had_char_class = true;
9278+# else
9279+ int ch;
9280+ boolean is_alnum = STREQ (str, "alnum");
9281+ boolean is_alpha = STREQ (str, "alpha");
9282+ boolean is_blank = STREQ (str, "blank");
9283+ boolean is_cntrl = STREQ (str, "cntrl");
9284+ boolean is_digit = STREQ (str, "digit");
9285+ boolean is_graph = STREQ (str, "graph");
9286+ boolean is_lower = STREQ (str, "lower");
9287+ boolean is_print = STREQ (str, "print");
9288+ boolean is_punct = STREQ (str, "punct");
9289+ boolean is_space = STREQ (str, "space");
9290+ boolean is_upper = STREQ (str, "upper");
9291+ boolean is_xdigit = STREQ (str, "xdigit");
9292+
9293+ if (!IS_CHAR_CLASS (str))
9294+ FREE_STACK_RETURN (REG_ECTYPE);
9295+
9296+ /* Throw away the ] at the end of the character
9297+ class. */
9298+ PATFETCH (c);
9299+
9300+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
9301+
9302+ for (ch = 0; ch < 1 << BYTEWIDTH; ch++)
9303+ {
9304+ /* This was split into 3 if's to
9305+ avoid an arbitrary limit in some compiler. */
9306+ if ( (is_alnum && ISALNUM (ch))
9307+ || (is_alpha && ISALPHA (ch))
9308+ || (is_blank && ISBLANK (ch))
9309+ || (is_cntrl && ISCNTRL (ch)))
9310+ SET_LIST_BIT (ch);
9311+ if ( (is_digit && ISDIGIT (ch))
9312+ || (is_graph && ISGRAPH (ch))
9313+ || (is_lower && ISLOWER (ch))
9314+ || (is_print && ISPRINT (ch)))
9315+ SET_LIST_BIT (ch);
9316+ if ( (is_punct && ISPUNCT (ch))
9317+ || (is_space && ISSPACE (ch))
9318+ || (is_upper && ISUPPER (ch))
9319+ || (is_xdigit && ISXDIGIT (ch)))
9320+ SET_LIST_BIT (ch);
9321+ if ( translate && (is_upper || is_lower)
9322+ && (ISUPPER (ch) || ISLOWER (ch)))
9323+ SET_LIST_BIT (ch);
9324+ }
9325+ had_char_class = true;
9326+# endif /* libc || wctype.h */
9327+ }
9328+ else
9329+ {
9330+ c1++;
9331+ while (c1--)
9332+ PATUNFETCH;
9333+ SET_LIST_BIT ('[');
9334+ SET_LIST_BIT (':');
9335+ range_start = ':';
9336+ had_char_class = false;
9337+ }
9338+ }
9339+ else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == '=')
9340+ {
9341+ unsigned char str[MB_LEN_MAX + 1];
9342+# ifdef _LIBC
9343+ uint32_t nrules =
9344+ _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
9345+# endif
9346+
9347+ PATFETCH (c);
9348+ c1 = 0;
9349+
9350+ /* If pattern is `[[='. */
9351+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
9352+
9353+ for (;;)
9354+ {
9355+ PATFETCH (c);
9356+ if ((c == '=' && *p == ']') || p == pend)
9357+ break;
9358+ if (c1 < MB_LEN_MAX)
9359+ str[c1++] = c;
9360+ else
9361+ /* This is in any case an invalid class name. */
9362+ str[0] = '\0';
9363+ }
9364+ str[c1] = '\0';
9365+
9366+ if (c == '=' && *p == ']' && str[0] != '\0')
9367+ {
9368+ /* If we have no collation data we use the default
9369+ collation in which each character is in a class
9370+ by itself. It also means that ASCII is the
9371+ character set and therefore we cannot have character
9372+ with more than one byte in the multibyte
9373+ representation. */
9374+# ifdef _LIBC
9375+ if (nrules == 0)
9376+# endif
9377+ {
9378+ if (c1 != 1)
9379+ FREE_STACK_RETURN (REG_ECOLLATE);
9380+
9381+ /* Throw away the ] at the end of the equivalence
9382+ class. */
9383+ PATFETCH (c);
9384+
9385+ /* Set the bit for the character. */
9386+ SET_LIST_BIT (str[0]);
9387+ }
9388+# ifdef _LIBC
9389+ else
9390+ {
9391+ /* Try to match the byte sequence in `str' against
9392+ those known to the collate implementation.
9393+ First find out whether the bytes in `str' are
9394+ actually from exactly one character. */
9395+ const int32_t *table;
9396+ const unsigned char *weights;
9397+ const unsigned char *extra;
9398+ const int32_t *indirect;
9399+ int32_t idx;
9400+ const unsigned char *cp = str;
9401+ int ch;
9402+
9403+ /* This #include defines a local function! */
9404+# include <locale/weight.h>
9405+
9406+ table = (const int32_t *)
9407+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
9408+ weights = (const unsigned char *)
9409+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTMB);
9410+ extra = (const unsigned char *)
9411+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
9412+ indirect = (const int32_t *)
9413+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
9414+
9415+ idx = findidx (&cp, c1);
9416+ if (idx == 0 || cp < str + c1)
9417+ /* This is no valid character. */
9418+ FREE_STACK_RETURN (REG_ECOLLATE);
9419+
9420+ /* Throw away the ] at the end of the equivalence
9421+ class. */
9422+ PATFETCH (c);
9423+
9424+ /* Now we have to go throught the whole table
9425+ and find all characters which have the same
9426+ first level weight.
9427+
9428+ XXX Note that this is not entirely correct.
9429+ we would have to match multibyte sequences
9430+ but this is not possible with the current
9431+ implementation. */
9432+ for (ch = 1; ch < 256; ++ch)
9433+ /* XXX This test would have to be changed if we
9434+ would allow matching multibyte sequences. */
9435+ if (table[ch] > 0)
9436+ {
9437+ int32_t idx2 = table[ch];
9438+ size_t len = weights[idx2];
9439+
9440+ /* Test whether the lenghts match. */
9441+ if (weights[idx] == len)
9442+ {
9443+ /* They do. New compare the bytes of
9444+ the weight. */
9445+ size_t cnt = 0;
9446+
9447+ while (cnt < len
9448+ && (weights[idx + 1 + cnt]
9449+ == weights[idx2 + 1 + cnt]))
9450+ ++cnt;
9451+
9452+ if (cnt == len)
9453+ /* They match. Mark the character as
9454+ acceptable. */
9455+ SET_LIST_BIT (ch);
9456+ }
9457+ }
9458+ }
9459+# endif
9460+ had_char_class = true;
9461+ }
9462+ else
9463+ {
9464+ c1++;
9465+ while (c1--)
9466+ PATUNFETCH;
9467+ SET_LIST_BIT ('[');
9468+ SET_LIST_BIT ('=');
9469+ range_start = '=';
9470+ had_char_class = false;
9471+ }
9472+ }
9473+ else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == '.')
9474+ {
9475+ unsigned char str[128]; /* Should be large enough. */
9476+# ifdef _LIBC
9477+ uint32_t nrules =
9478+ _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
9479+# endif
9480+
9481+ PATFETCH (c);
9482+ c1 = 0;
9483+
9484+ /* If pattern is `[[.'. */
9485+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
9486+
9487+ for (;;)
9488+ {
9489+ PATFETCH (c);
9490+ if ((c == '.' && *p == ']') || p == pend)
9491+ break;
9492+ if (c1 < sizeof (str))
9493+ str[c1++] = c;
9494+ else
9495+ /* This is in any case an invalid class name. */
9496+ str[0] = '\0';
9497+ }
9498+ str[c1] = '\0';
9499+
9500+ if (c == '.' && *p == ']' && str[0] != '\0')
9501+ {
9502+ /* If we have no collation data we use the default
9503+ collation in which each character is the name
9504+ for its own class which contains only the one
9505+ character. It also means that ASCII is the
9506+ character set and therefore we cannot have character
9507+ with more than one byte in the multibyte
9508+ representation. */
9509+# ifdef _LIBC
9510+ if (nrules == 0)
9511+# endif
9512+ {
9513+ if (c1 != 1)
9514+ FREE_STACK_RETURN (REG_ECOLLATE);
9515+
9516+ /* Throw away the ] at the end of the equivalence
9517+ class. */
9518+ PATFETCH (c);
9519+
9520+ /* Set the bit for the character. */
9521+ SET_LIST_BIT (str[0]);
9522+ range_start = ((const unsigned char *) str)[0];
9523+ }
9524+# ifdef _LIBC
9525+ else
9526+ {
9527+ /* Try to match the byte sequence in `str' against
9528+ those known to the collate implementation.
9529+ First find out whether the bytes in `str' are
9530+ actually from exactly one character. */
9531+ int32_t table_size;
9532+ const int32_t *symb_table;
9533+ const unsigned char *extra;
9534+ int32_t idx;
9535+ int32_t elem;
9536+ int32_t second;
9537+ int32_t hash;
9538+
9539+ table_size =
9540+ _NL_CURRENT_WORD (LC_COLLATE,
9541+ _NL_COLLATE_SYMB_HASH_SIZEMB);
9542+ symb_table = (const int32_t *)
9543+ _NL_CURRENT (LC_COLLATE,
9544+ _NL_COLLATE_SYMB_TABLEMB);
9545+ extra = (const unsigned char *)
9546+ _NL_CURRENT (LC_COLLATE,
9547+ _NL_COLLATE_SYMB_EXTRAMB);
9548+
9549+ /* Locate the character in the hashing table. */
9550+ hash = elem_hash ((const char *) str, c1);
9551+
9552+ idx = 0;
9553+ elem = hash % table_size;
9554+ second = hash % (table_size - 2);
9555+ while (symb_table[2 * elem] != 0)
9556+ {
9557+ /* First compare the hashing value. */
9558+ if (symb_table[2 * elem] == hash
9559+ && c1 == extra[symb_table[2 * elem + 1]]
9560+ && memcmp (str,
9561+ &extra[symb_table[2 * elem + 1]
9562+ + 1],
9563+ c1) == 0)
9564+ {
9565+ /* Yep, this is the entry. */
9566+ idx = symb_table[2 * elem + 1];
9567+ idx += 1 + extra[idx];
9568+ break;
9569+ }
9570+
9571+ /* Next entry. */
9572+ elem += second;
9573+ }
9574+
9575+ if (symb_table[2 * elem] == 0)
9576+ /* This is no valid character. */
9577+ FREE_STACK_RETURN (REG_ECOLLATE);
9578+
9579+ /* Throw away the ] at the end of the equivalence
9580+ class. */
9581+ PATFETCH (c);
9582+
9583+ /* Now add the multibyte character(s) we found
9584+ to the accept list.
9585+
9586+ XXX Note that this is not entirely correct.
9587+ we would have to match multibyte sequences
9588+ but this is not possible with the current
9589+ implementation. Also, we have to match
9590+ collating symbols, which expand to more than
9591+ one file, as a whole and not allow the
9592+ individual bytes. */
9593+ c1 = extra[idx++];
9594+ if (c1 == 1)
9595+ range_start = extra[idx];
9596+ while (c1-- > 0)
9597+ {
9598+ SET_LIST_BIT (extra[idx]);
9599+ ++idx;
9600+ }
9601+ }
9602+# endif
9603+ had_char_class = false;
9604+ }
9605+ else
9606+ {
9607+ c1++;
9608+ while (c1--)
9609+ PATUNFETCH;
9610+ SET_LIST_BIT ('[');
9611+ SET_LIST_BIT ('.');
9612+ range_start = '.';
9613+ had_char_class = false;
9614+ }
9615+ }
9616+ else
9617+ {
9618+ had_char_class = false;
9619+ SET_LIST_BIT (c);
9620+ range_start = c;
9621+ }
9622+ }
9623+
9624+ /* Discard any (non)matching list bytes that are all 0 at the
9625+ end of the map. Decrease the map-length byte too. */
9626+ while ((int) b[-1] > 0 && b[b[-1] - 1] == 0)
9627+ b[-1]--;
9628+ b += b[-1];
9629+#endif /* WCHAR */
9630+ }
9631+ break;
9632+
9633+
9634+ case '(':
9635+ if (syntax & RE_NO_BK_PARENS)
9636+ goto handle_open;
9637+ else
9638+ goto normal_char;
9639+
9640+
9641+ case ')':
9642+ if (syntax & RE_NO_BK_PARENS)
9643+ goto handle_close;
9644+ else
9645+ goto normal_char;
9646+
9647+
9648+ case '\n':
9649+ if (syntax & RE_NEWLINE_ALT)
9650+ goto handle_alt;
9651+ else
9652+ goto normal_char;
9653+
9654+
9655+ case '|':
9656+ if (syntax & RE_NO_BK_VBAR)
9657+ goto handle_alt;
9658+ else
9659+ goto normal_char;
9660+
9661+
9662+ case '{':
9663+ if (syntax & RE_INTERVALS && syntax & RE_NO_BK_BRACES)
9664+ goto handle_interval;
9665+ else
9666+ goto normal_char;
9667+
9668+
9669+ case '\\':
9670+ if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
9671+
9672+ /* Do not translate the character after the \, so that we can
9673+ distinguish, e.g., \B from \b, even if we normally would
9674+ translate, e.g., B to b. */
9675+ PATFETCH_RAW (c);
9676+
9677+ switch (c)
9678+ {
9679+ case '(':
9680+ if (syntax & RE_NO_BK_PARENS)
9681+ goto normal_backslash;
9682+
9683+ handle_open:
9684+ bufp->re_nsub++;
9685+ regnum++;
9686+
9687+ if (COMPILE_STACK_FULL)
9688+ {
9689+ RETALLOC (compile_stack.stack, compile_stack.size << 1,
9690+ compile_stack_elt_t);
9691+ if (compile_stack.stack == NULL) return REG_ESPACE;
9692+
9693+ compile_stack.size <<= 1;
9694+ }
9695+
9696+ /* These are the values to restore when we hit end of this
9697+ group. They are all relative offsets, so that if the
9698+ whole pattern moves because of realloc, they will still
9699+ be valid. */
9700+ COMPILE_STACK_TOP.begalt_offset = begalt - COMPILED_BUFFER_VAR;
9701+ COMPILE_STACK_TOP.fixup_alt_jump
9702+ = fixup_alt_jump ? fixup_alt_jump - COMPILED_BUFFER_VAR + 1 : 0;
9703+ COMPILE_STACK_TOP.laststart_offset = b - COMPILED_BUFFER_VAR;
9704+ COMPILE_STACK_TOP.regnum = regnum;
9705+
9706+ /* We will eventually replace the 0 with the number of
9707+ groups inner to this one. But do not push a
9708+ start_memory for groups beyond the last one we can
9709+ represent in the compiled pattern. */
9710+ if (regnum <= MAX_REGNUM)
9711+ {
9712+ COMPILE_STACK_TOP.inner_group_offset = b
9713+ - COMPILED_BUFFER_VAR + 2;
9714+ BUF_PUSH_3 (start_memory, regnum, 0);
9715+ }
9716+
9717+ compile_stack.avail++;
9718+
9719+ fixup_alt_jump = 0;
9720+ laststart = 0;
9721+ begalt = b;
9722+ /* If we've reached MAX_REGNUM groups, then this open
9723+ won't actually generate any code, so we'll have to
9724+ clear pending_exact explicitly. */
9725+ pending_exact = 0;
9726+ break;
9727+
9728+
9729+ case ')':
9730+ if (syntax & RE_NO_BK_PARENS) goto normal_backslash;
9731+
9732+ if (COMPILE_STACK_EMPTY)
9733+ {
9734+ if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
9735+ goto normal_backslash;
9736+ else
9737+ FREE_STACK_RETURN (REG_ERPAREN);
9738+ }
9739+
9740+ handle_close:
9741+ if (fixup_alt_jump)
9742+ { /* Push a dummy failure point at the end of the
9743+ alternative for a possible future
9744+ `pop_failure_jump' to pop. See comments at
9745+ `push_dummy_failure' in `re_match_2'. */
9746+ BUF_PUSH (push_dummy_failure);
9747+
9748+ /* We allocated space for this jump when we assigned
9749+ to `fixup_alt_jump', in the `handle_alt' case below. */
9750+ STORE_JUMP (jump_past_alt, fixup_alt_jump, b - 1);
9751+ }
9752+
9753+ /* See similar code for backslashed left paren above. */
9754+ if (COMPILE_STACK_EMPTY)
9755+ {
9756+ if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
9757+ goto normal_char;
9758+ else
9759+ FREE_STACK_RETURN (REG_ERPAREN);
9760+ }
9761+
9762+ /* Since we just checked for an empty stack above, this
9763+ ``can't happen''. */
9764+ assert (compile_stack.avail != 0);
9765+ {
9766+ /* We don't just want to restore into `regnum', because
9767+ later groups should continue to be numbered higher,
9768+ as in `(ab)c(de)' -- the second group is #2. */
9769+ regnum_t this_group_regnum;
9770+
9771+ compile_stack.avail--;
9772+ begalt = COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.begalt_offset;
9773+ fixup_alt_jump
9774+ = COMPILE_STACK_TOP.fixup_alt_jump
9775+ ? COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.fixup_alt_jump - 1
9776+ : 0;
9777+ laststart = COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.laststart_offset;
9778+ this_group_regnum = COMPILE_STACK_TOP.regnum;
9779+ /* If we've reached MAX_REGNUM groups, then this open
9780+ won't actually generate any code, so we'll have to
9781+ clear pending_exact explicitly. */
9782+ pending_exact = 0;
9783+
9784+ /* We're at the end of the group, so now we know how many
9785+ groups were inside this one. */
9786+ if (this_group_regnum <= MAX_REGNUM)
9787+ {
9788+ UCHAR_T *inner_group_loc
9789+ = COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.inner_group_offset;
9790+
9791+ *inner_group_loc = regnum - this_group_regnum;
9792+ BUF_PUSH_3 (stop_memory, this_group_regnum,
9793+ regnum - this_group_regnum);
9794+ }
9795+ }
9796+ break;
9797+
9798+
9799+ case '|': /* `\|'. */
9800+ if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR)
9801+ goto normal_backslash;
9802+ handle_alt:
9803+ if (syntax & RE_LIMITED_OPS)
9804+ goto normal_char;
9805+
9806+ /* Insert before the previous alternative a jump which
9807+ jumps to this alternative if the former fails. */
9808+ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
9809+ INSERT_JUMP (on_failure_jump, begalt,
9810+ b + 2 + 2 * OFFSET_ADDRESS_SIZE);
9811+ pending_exact = 0;
9812+ b += 1 + OFFSET_ADDRESS_SIZE;
9813+
9814+ /* The alternative before this one has a jump after it
9815+ which gets executed if it gets matched. Adjust that
9816+ jump so it will jump to this alternative's analogous
9817+ jump (put in below, which in turn will jump to the next
9818+ (if any) alternative's such jump, etc.). The last such
9819+ jump jumps to the correct final destination. A picture:
9820+ _____ _____
9821+ | | | |
9822+ | v | v
9823+ a | b | c
9824+
9825+ If we are at `b', then fixup_alt_jump right now points to a
9826+ three-byte space after `a'. We'll put in the jump, set
9827+ fixup_alt_jump to right after `b', and leave behind three
9828+ bytes which we'll fill in when we get to after `c'. */
9829+
9830+ if (fixup_alt_jump)
9831+ STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
9832+
9833+ /* Mark and leave space for a jump after this alternative,
9834+ to be filled in later either by next alternative or
9835+ when know we're at the end of a series of alternatives. */
9836+ fixup_alt_jump = b;
9837+ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
9838+ b += 1 + OFFSET_ADDRESS_SIZE;
9839+
9840+ laststart = 0;
9841+ begalt = b;
9842+ break;
9843+
9844+
9845+ case '{':
9846+ /* If \{ is a literal. */
9847+ if (!(syntax & RE_INTERVALS)
9848+ /* If we're at `\{' and it's not the open-interval
9849+ operator. */
9850+ || (syntax & RE_NO_BK_BRACES))
9851+ goto normal_backslash;
9852+
9853+ handle_interval:
9854+ {
9855+ /* If got here, then the syntax allows intervals. */
9856+
9857+ /* At least (most) this many matches must be made. */
9858+ int lower_bound = -1, upper_bound = -1;
9859+
9860+ /* Place in the uncompiled pattern (i.e., just after
9861+ the '{') to go back to if the interval is invalid. */
9862+ const CHAR_T *beg_interval = p;
9863+
9864+ if (p == pend)
9865+ goto invalid_interval;
9866+
9867+ GET_UNSIGNED_NUMBER (lower_bound);
9868+
9869+ if (c == ',')
9870+ {
9871+ GET_UNSIGNED_NUMBER (upper_bound);
9872+ if (upper_bound < 0)
9873+ upper_bound = RE_DUP_MAX;
9874+ }
9875+ else
9876+ /* Interval such as `{1}' => match exactly once. */
9877+ upper_bound = lower_bound;
9878+
9879+ if (! (0 <= lower_bound && lower_bound <= upper_bound))
9880+ goto invalid_interval;
9881+
9882+ if (!(syntax & RE_NO_BK_BRACES))
9883+ {
9884+ if (c != '\\' || p == pend)
9885+ goto invalid_interval;
9886+ PATFETCH (c);
9887+ }
9888+
9889+ if (c != '}')
9890+ goto invalid_interval;
9891+
9892+ /* If it's invalid to have no preceding re. */
9893+ if (!laststart)
9894+ {
9895+ if (syntax & RE_CONTEXT_INVALID_OPS
9896+ && !(syntax & RE_INVALID_INTERVAL_ORD))
9897+ FREE_STACK_RETURN (REG_BADRPT);
9898+ else if (syntax & RE_CONTEXT_INDEP_OPS)
9899+ laststart = b;
9900+ else
9901+ goto unfetch_interval;
9902+ }
9903+
9904+ /* We just parsed a valid interval. */
9905+
9906+ if (RE_DUP_MAX < upper_bound)
9907+ FREE_STACK_RETURN (REG_BADBR);
9908+
9909+ /* If the upper bound is zero, don't want to succeed at
9910+ all; jump from `laststart' to `b + 3', which will be
9911+ the end of the buffer after we insert the jump. */
9912+ /* ifdef WCHAR, 'b + 1 + OFFSET_ADDRESS_SIZE'
9913+ instead of 'b + 3'. */
9914+ if (upper_bound == 0)
9915+ {
9916+ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
9917+ INSERT_JUMP (jump, laststart, b + 1
9918+ + OFFSET_ADDRESS_SIZE);
9919+ b += 1 + OFFSET_ADDRESS_SIZE;
9920+ }
9921+
9922+ /* Otherwise, we have a nontrivial interval. When
9923+ we're all done, the pattern will look like:
9924+ set_number_at <jump count> <upper bound>
9925+ set_number_at <succeed_n count> <lower bound>
9926+ succeed_n <after jump addr> <succeed_n count>
9927+ <body of loop>
9928+ jump_n <succeed_n addr> <jump count>
9929+ (The upper bound and `jump_n' are omitted if
9930+ `upper_bound' is 1, though.) */
9931+ else
9932+ { /* If the upper bound is > 1, we need to insert
9933+ more at the end of the loop. */
9934+ unsigned nbytes = 2 + 4 * OFFSET_ADDRESS_SIZE +
9935+ (upper_bound > 1) * (2 + 4 * OFFSET_ADDRESS_SIZE);
9936+
9937+ GET_BUFFER_SPACE (nbytes);
9938+
9939+ /* Initialize lower bound of the `succeed_n', even
9940+ though it will be set during matching by its
9941+ attendant `set_number_at' (inserted next),
9942+ because `re_compile_fastmap' needs to know.
9943+ Jump to the `jump_n' we might insert below. */
9944+ INSERT_JUMP2 (succeed_n, laststart,
9945+ b + 1 + 2 * OFFSET_ADDRESS_SIZE
9946+ + (upper_bound > 1) * (1 + 2 * OFFSET_ADDRESS_SIZE)
9947+ , lower_bound);
9948+ b += 1 + 2 * OFFSET_ADDRESS_SIZE;
9949+
9950+ /* Code to initialize the lower bound. Insert
9951+ before the `succeed_n'. The `5' is the last two
9952+ bytes of this `set_number_at', plus 3 bytes of
9953+ the following `succeed_n'. */
9954+ /* ifdef WCHAR, The '1+2*OFFSET_ADDRESS_SIZE'
9955+ is the 'set_number_at', plus '1+OFFSET_ADDRESS_SIZE'
9956+ of the following `succeed_n'. */
9957+ PREFIX(insert_op2) (set_number_at, laststart, 1
9958+ + 2 * OFFSET_ADDRESS_SIZE, lower_bound, b);
9959+ b += 1 + 2 * OFFSET_ADDRESS_SIZE;
9960+
9961+ if (upper_bound > 1)
9962+ { /* More than one repetition is allowed, so
9963+ append a backward jump to the `succeed_n'
9964+ that starts this interval.
9965+
9966+ When we've reached this during matching,
9967+ we'll have matched the interval once, so
9968+ jump back only `upper_bound - 1' times. */
9969+ STORE_JUMP2 (jump_n, b, laststart
9970+ + 2 * OFFSET_ADDRESS_SIZE + 1,
9971+ upper_bound - 1);
9972+ b += 1 + 2 * OFFSET_ADDRESS_SIZE;
9973+
9974+ /* The location we want to set is the second
9975+ parameter of the `jump_n'; that is `b-2' as
9976+ an absolute address. `laststart' will be
9977+ the `set_number_at' we're about to insert;
9978+ `laststart+3' the number to set, the source
9979+ for the relative address. But we are
9980+ inserting into the middle of the pattern --
9981+ so everything is getting moved up by 5.
9982+ Conclusion: (b - 2) - (laststart + 3) + 5,
9983+ i.e., b - laststart.
9984+
9985+ We insert this at the beginning of the loop
9986+ so that if we fail during matching, we'll
9987+ reinitialize the bounds. */
9988+ PREFIX(insert_op2) (set_number_at, laststart,
9989+ b - laststart,
9990+ upper_bound - 1, b);
9991+ b += 1 + 2 * OFFSET_ADDRESS_SIZE;
9992+ }
9993+ }
9994+ pending_exact = 0;
9995+ break;
9996+
9997+ invalid_interval:
9998+ if (!(syntax & RE_INVALID_INTERVAL_ORD))
9999+ FREE_STACK_RETURN (p == pend ? REG_EBRACE : REG_BADBR);
10000+ unfetch_interval:
10001+ /* Match the characters as literals. */
10002+ p = beg_interval;
10003+ c = '{';
10004+ if (syntax & RE_NO_BK_BRACES)
10005+ goto normal_char;
10006+ else
10007+ goto normal_backslash;
10008+ }
10009+
10010+#ifdef emacs
10011+ /* There is no way to specify the before_dot and after_dot
10012+ operators. rms says this is ok. --karl */
10013+ case '=':
10014+ BUF_PUSH (at_dot);
10015+ break;
10016+
10017+ case 's':
10018+ laststart = b;
10019+ PATFETCH (c);
10020+ BUF_PUSH_2 (syntaxspec, syntax_spec_code[c]);
10021+ break;
10022+
10023+ case 'S':
10024+ laststart = b;
10025+ PATFETCH (c);
10026+ BUF_PUSH_2 (notsyntaxspec, syntax_spec_code[c]);
10027+ break;
10028+#endif /* emacs */
10029+
10030+
10031+ case 'w':
10032+ if (syntax & RE_NO_GNU_OPS)
10033+ goto normal_char;
10034+ laststart = b;
10035+ BUF_PUSH (wordchar);
10036+ break;
10037+
10038+
10039+ case 'W':
10040+ if (syntax & RE_NO_GNU_OPS)
10041+ goto normal_char;
10042+ laststart = b;
10043+ BUF_PUSH (notwordchar);
10044+ break;
10045+
10046+
10047+ case '<':
10048+ if (syntax & RE_NO_GNU_OPS)
10049+ goto normal_char;
10050+ BUF_PUSH (wordbeg);
10051+ break;
10052+
10053+ case '>':
10054+ if (syntax & RE_NO_GNU_OPS)
10055+ goto normal_char;
10056+ BUF_PUSH (wordend);
10057+ break;
10058+
10059+ case 'b':
10060+ if (syntax & RE_NO_GNU_OPS)
10061+ goto normal_char;
10062+ BUF_PUSH (wordbound);
10063+ break;
10064+
10065+ case 'B':
10066+ if (syntax & RE_NO_GNU_OPS)
10067+ goto normal_char;
10068+ BUF_PUSH (notwordbound);
10069+ break;
10070+
10071+ case '`':
10072+ if (syntax & RE_NO_GNU_OPS)
10073+ goto normal_char;
10074+ BUF_PUSH (begbuf);
10075+ break;
10076+
10077+ case '\'':
10078+ if (syntax & RE_NO_GNU_OPS)
10079+ goto normal_char;
10080+ BUF_PUSH (endbuf);
10081+ break;
10082+
10083+ case '1': case '2': case '3': case '4': case '5':
10084+ case '6': case '7': case '8': case '9':
10085+ if (syntax & RE_NO_BK_REFS)
10086+ goto normal_char;
10087+
10088+ c1 = c - '0';
10089+
10090+ if (c1 > regnum)
10091+ FREE_STACK_RETURN (REG_ESUBREG);
10092+
10093+ /* Can't back reference to a subexpression if inside of it. */
10094+ if (group_in_compile_stack (compile_stack, (regnum_t) c1))
10095+ goto normal_char;
10096+
10097+ laststart = b;
10098+ BUF_PUSH_2 (duplicate, c1);
10099+ break;
10100+
10101+
10102+ case '+':
10103+ case '?':
10104+ if (syntax & RE_BK_PLUS_QM)
10105+ goto handle_plus;
10106+ else
10107+ goto normal_backslash;
10108+
10109+ default:
10110+ normal_backslash:
10111+ /* You might think it would be useful for \ to mean
10112+ not to translate; but if we don't translate it
10113+ it will never match anything. */
10114+ c = TRANSLATE (c);
10115+ goto normal_char;
10116+ }
10117+ break;
10118+
10119+
10120+ default:
10121+ /* Expects the character in `c'. */
10122+ normal_char:
10123+ /* If no exactn currently being built. */
10124+ if (!pending_exact
10125+#ifdef WCHAR
10126+ /* If last exactn handle binary(or character) and
10127+ new exactn handle character(or binary). */
10128+ || is_exactn_bin != is_binary[p - 1 - pattern]
10129+#endif /* WCHAR */
10130+
10131+ /* If last exactn not at current position. */
10132+ || pending_exact + *pending_exact + 1 != b
10133+
10134+ /* We have only one byte following the exactn for the count. */
10135+ || *pending_exact == (1 << BYTEWIDTH) - 1
10136+
10137+ /* If followed by a repetition operator. */
10138+ || *p == '*' || *p == '^'
10139+ || ((syntax & RE_BK_PLUS_QM)
10140+ ? *p == '\\' && (p[1] == '+' || p[1] == '?')
10141+ : (*p == '+' || *p == '?'))
10142+ || ((syntax & RE_INTERVALS)
10143+ && ((syntax & RE_NO_BK_BRACES)
10144+ ? *p == '{'
10145+ : (p[0] == '\\' && p[1] == '{'))))
10146+ {
10147+ /* Start building a new exactn. */
10148+
10149+ laststart = b;
10150+
10151+#ifdef WCHAR
10152+ /* Is this exactn binary data or character? */
10153+ is_exactn_bin = is_binary[p - 1 - pattern];
10154+ if (is_exactn_bin)
10155+ BUF_PUSH_2 (exactn_bin, 0);
10156+ else
10157+ BUF_PUSH_2 (exactn, 0);
10158+#else
10159+ BUF_PUSH_2 (exactn, 0);
10160+#endif /* WCHAR */
10161+ pending_exact = b - 1;
10162+ }
10163+
10164+ BUF_PUSH (c);
10165+ (*pending_exact)++;
10166+ break;
10167+ } /* switch (c) */
10168+ } /* while p != pend */
10169+
10170+
10171+ /* Through the pattern now. */
10172+
10173+ if (fixup_alt_jump)
10174+ STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
10175+
10176+ if (!COMPILE_STACK_EMPTY)
10177+ FREE_STACK_RETURN (REG_EPAREN);
10178+
10179+ /* If we don't want backtracking, force success
10180+ the first time we reach the end of the compiled pattern. */
10181+ if (syntax & RE_NO_POSIX_BACKTRACKING)
10182+ BUF_PUSH (succeed);
10183+
10184+#ifdef WCHAR
10185+ free (pattern);
10186+ free (mbs_offset);
10187+ free (is_binary);
10188+#endif
10189+ free (compile_stack.stack);
10190+
10191+ /* We have succeeded; set the length of the buffer. */
10192+#ifdef WCHAR
10193+ bufp->used = (uintptr_t) b - (uintptr_t) COMPILED_BUFFER_VAR;
10194+#else
10195+ bufp->used = b - bufp->buffer;
10196+#endif
10197+
10198+#ifdef DEBUG
10199+ if (debug)
10200+ {
10201+ DEBUG_PRINT1 ("\nCompiled pattern: \n");
10202+ PREFIX(print_compiled_pattern) (bufp);
10203+ }
10204+#endif /* DEBUG */
10205+
10206+#ifndef MATCH_MAY_ALLOCATE
10207+ /* Initialize the failure stack to the largest possible stack. This
10208+ isn't necessary unless we're trying to avoid calling alloca in
10209+ the search and match routines. */
10210+ {
10211+ int num_regs = bufp->re_nsub + 1;
10212+
10213+ /* Since DOUBLE_FAIL_STACK refuses to double only if the current size
10214+ is strictly greater than re_max_failures, the largest possible stack
10215+ is 2 * re_max_failures failure points. */
10216+ if (fail_stack.size < (2 * re_max_failures * MAX_FAILURE_ITEMS))
10217+ {
10218+ fail_stack.size = (2 * re_max_failures * MAX_FAILURE_ITEMS);
10219+
10220+# ifdef emacs
10221+ if (! fail_stack.stack)
10222+ fail_stack.stack
10223+ = (PREFIX(fail_stack_elt_t) *) xmalloc (fail_stack.size
10224+ * sizeof (PREFIX(fail_stack_elt_t)));
10225+ else
10226+ fail_stack.stack
10227+ = (PREFIX(fail_stack_elt_t) *) xrealloc (fail_stack.stack,
10228+ (fail_stack.size
10229+ * sizeof (PREFIX(fail_stack_elt_t))));
10230+# else /* not emacs */
10231+ if (! fail_stack.stack)
10232+ fail_stack.stack
10233+ = (PREFIX(fail_stack_elt_t) *) malloc (fail_stack.size
10234+ * sizeof (PREFIX(fail_stack_elt_t)));
10235+ else
10236+ fail_stack.stack
10237+ = (PREFIX(fail_stack_elt_t) *) realloc (fail_stack.stack,
10238+ (fail_stack.size
10239+ * sizeof (PREFIX(fail_stack_elt_t))));
10240+# endif /* not emacs */
10241+ }
10242+
10243+ PREFIX(regex_grow_registers) (num_regs);
10244+ }
10245+#endif /* not MATCH_MAY_ALLOCATE */
10246+
10247+ return REG_NOERROR;
10248+} /* regex_compile */
10249+
10250+/* Subroutines for `regex_compile'. */
10251+
10252+/* Store OP at LOC followed by two-byte integer parameter ARG. */
10253+/* ifdef WCHAR, integer parameter is 1 wchar_t. */
10254+
10255+static void
10256+PREFIX(store_op1) (re_opcode_t op, UCHAR_T *loc, int arg)
10257+{
10258+ *loc = (UCHAR_T) op;
10259+ STORE_NUMBER (loc + 1, arg);
10260+}
10261+
10262+
10263+/* Like `store_op1', but for two two-byte parameters ARG1 and ARG2. */
10264+/* ifdef WCHAR, integer parameter is 1 wchar_t. */
10265+
10266+static void
10267+PREFIX(store_op2) (re_opcode_t op, UCHAR_T *loc, int arg1, int arg2)
10268+{
10269+ *loc = (UCHAR_T) op;
10270+ STORE_NUMBER (loc + 1, arg1);
10271+ STORE_NUMBER (loc + 1 + OFFSET_ADDRESS_SIZE, arg2);
10272+}
10273+
10274+
10275+/* Copy the bytes from LOC to END to open up three bytes of space at LOC
10276+ for OP followed by two-byte integer parameter ARG. */
10277+/* ifdef WCHAR, integer parameter is 1 wchar_t. */
10278+
10279+static void
10280+PREFIX(insert_op1) (re_opcode_t op, UCHAR_T *loc, int arg, UCHAR_T *end)
10281+{
10282+ register UCHAR_T *pfrom = end;
10283+ register UCHAR_T *pto = end + 1 + OFFSET_ADDRESS_SIZE;
10284+
10285+ while (pfrom != loc)
10286+ *--pto = *--pfrom;
10287+
10288+ PREFIX(store_op1) (op, loc, arg);
10289+}
10290+
10291+
10292+/* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2. */
10293+/* ifdef WCHAR, integer parameter is 1 wchar_t. */
10294+
10295+static void
10296+PREFIX(insert_op2) (re_opcode_t op, UCHAR_T *loc, int arg1,
10297+ int arg2, UCHAR_T *end)
10298+{
10299+ register UCHAR_T *pfrom = end;
10300+ register UCHAR_T *pto = end + 1 + 2 * OFFSET_ADDRESS_SIZE;
10301+
10302+ while (pfrom != loc)
10303+ *--pto = *--pfrom;
10304+
10305+ PREFIX(store_op2) (op, loc, arg1, arg2);
10306+}
10307+
10308+
10309+/* P points to just after a ^ in PATTERN. Return true if that ^ comes
10310+ after an alternative or a begin-subexpression. We assume there is at
10311+ least one character before the ^. */
10312+
10313+static boolean
10314+PREFIX(at_begline_loc_p) (const CHAR_T *pattern, const CHAR_T *p,
10315+ reg_syntax_t syntax)
10316+{
10317+ const CHAR_T *prev = p - 2;
10318+ boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\';
10319+
10320+ return
10321+ /* After a subexpression? */
10322+ (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash))
10323+ /* After an alternative? */
10324+ || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash));
10325+}
10326+
10327+
10328+/* The dual of at_begline_loc_p. This one is for $. We assume there is
10329+ at least one character after the $, i.e., `P < PEND'. */
10330+
10331+static boolean
10332+PREFIX(at_endline_loc_p) (const CHAR_T *p, const CHAR_T *pend,
10333+ reg_syntax_t syntax)
10334+{
10335+ const CHAR_T *next = p;
10336+ boolean next_backslash = *next == '\\';
10337+ const CHAR_T *next_next = p + 1 < pend ? p + 1 : 0;
10338+
10339+ return
10340+ /* Before a subexpression? */
10341+ (syntax & RE_NO_BK_PARENS ? *next == ')'
10342+ : next_backslash && next_next && *next_next == ')')
10343+ /* Before an alternative? */
10344+ || (syntax & RE_NO_BK_VBAR ? *next == '|'
10345+ : next_backslash && next_next && *next_next == '|');
10346+}
10347+
10348+#else /* not INSIDE_RECURSION */
10349+
10350+/* Returns true if REGNUM is in one of COMPILE_STACK's elements and
10351+ false if it's not. */
10352+
10353+static boolean
10354+group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum)
10355+{
10356+ int this_element;
10357+
10358+ for (this_element = compile_stack.avail - 1;
10359+ this_element >= 0;
10360+ this_element--)
10361+ if (compile_stack.stack[this_element].regnum == regnum)
10362+ return true;
10363+
10364+ return false;
10365+}
10366+#endif /* not INSIDE_RECURSION */
10367+
10368+#ifdef INSIDE_RECURSION
10369+
10370+#ifdef WCHAR
10371+/* This insert space, which size is "num", into the pattern at "loc".
10372+ "end" must point the end of the allocated buffer. */
10373+static void
10374+insert_space (int num, CHAR_T *loc, CHAR_T *end)
10375+{
10376+ register CHAR_T *pto = end;
10377+ register CHAR_T *pfrom = end - num;
10378+
10379+ while (pfrom >= loc)
10380+ *pto-- = *pfrom--;
10381+}
10382+#endif /* WCHAR */
10383+
10384+#ifdef WCHAR
10385+static reg_errcode_t
10386+wcs_compile_range (CHAR_T range_start_char, const CHAR_T **p_ptr,
10387+ const CHAR_T *pend, RE_TRANSLATE_TYPE translate,
10388+ reg_syntax_t syntax, CHAR_T *b, CHAR_T *char_set)
10389+{
10390+ const CHAR_T *p = *p_ptr;
10391+ CHAR_T range_start, range_end;
10392+ reg_errcode_t ret;
10393+# ifdef _LIBC
10394+ uint32_t nrules;
10395+ uint32_t start_val, end_val;
10396+# endif
10397+ if (p == pend)
10398+ return REG_ERANGE;
10399+
10400+# ifdef _LIBC
10401+ nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
10402+ if (nrules != 0)
10403+ {
10404+ const char *collseq = (const char *) _NL_CURRENT(LC_COLLATE,
10405+ _NL_COLLATE_COLLSEQWC);
10406+ const unsigned char *extra = (const unsigned char *)
10407+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
10408+
10409+ if (range_start_char < -1)
10410+ {
10411+ /* range_start is a collating symbol. */
10412+ int32_t *wextra;
10413+ /* Retreive the index and get collation sequence value. */
10414+ wextra = (int32_t*)(extra + char_set[-range_start_char]);
10415+ start_val = wextra[1 + *wextra];
10416+ }
10417+ else
10418+ start_val = collseq_table_lookup(collseq, TRANSLATE(range_start_char));
10419+
10420+ end_val = collseq_table_lookup (collseq, TRANSLATE (p[0]));
10421+
10422+ /* Report an error if the range is empty and the syntax prohibits
10423+ this. */
10424+ ret = ((syntax & RE_NO_EMPTY_RANGES)
10425+ && (start_val > end_val))? REG_ERANGE : REG_NOERROR;
10426+
10427+ /* Insert space to the end of the char_ranges. */
10428+ insert_space(2, b - char_set[5] - 2, b - 1);
10429+ *(b - char_set[5] - 2) = (wchar_t)start_val;
10430+ *(b - char_set[5] - 1) = (wchar_t)end_val;
10431+ char_set[4]++; /* ranges_index */
10432+ }
10433+ else
10434+# endif
10435+ {
10436+ range_start = (range_start_char >= 0)? TRANSLATE (range_start_char):
10437+ range_start_char;
10438+ range_end = TRANSLATE (p[0]);
10439+ /* Report an error if the range is empty and the syntax prohibits
10440+ this. */
10441+ ret = ((syntax & RE_NO_EMPTY_RANGES)
10442+ && (range_start > range_end))? REG_ERANGE : REG_NOERROR;
10443+
10444+ /* Insert space to the end of the char_ranges. */
10445+ insert_space(2, b - char_set[5] - 2, b - 1);
10446+ *(b - char_set[5] - 2) = range_start;
10447+ *(b - char_set[5] - 1) = range_end;
10448+ char_set[4]++; /* ranges_index */
10449+ }
10450+ /* Have to increment the pointer into the pattern string, so the
10451+ caller isn't still at the ending character. */
10452+ (*p_ptr)++;
10453+
10454+ return ret;
10455+}
10456+#else /* BYTE */
10457+/* Read the ending character of a range (in a bracket expression) from the
10458+ uncompiled pattern *P_PTR (which ends at PEND). We assume the
10459+ starting character is in `P[-2]'. (`P[-1]' is the character `-'.)
10460+ Then we set the translation of all bits between the starting and
10461+ ending characters (inclusive) in the compiled pattern B.
10462+
10463+ Return an error code.
10464+
10465+ We use these short variable names so we can use the same macros as
10466+ `regex_compile' itself. */
10467+
10468+static reg_errcode_t
10469+byte_compile_range (unsigned int range_start_char, const char **p_ptr,
10470+ const char *pend, RE_TRANSLATE_TYPE translate,
10471+ reg_syntax_t syntax, unsigned char *b)
10472+{
10473+ unsigned this_char;
10474+ const char *p = *p_ptr;
10475+ reg_errcode_t ret;
10476+# if _LIBC
10477+ const unsigned char *collseq;
10478+ unsigned int start_colseq;
10479+ unsigned int end_colseq;
10480+# else
10481+ unsigned end_char;
10482+# endif
10483+
10484+ if (p == pend)
10485+ return REG_ERANGE;
10486+
10487+ /* Have to increment the pointer into the pattern string, so the
10488+ caller isn't still at the ending character. */
10489+ (*p_ptr)++;
10490+
10491+ /* Report an error if the range is empty and the syntax prohibits this. */
10492+ ret = syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR;
10493+
10494+# if _LIBC
10495+ collseq = (const unsigned char *) _NL_CURRENT (LC_COLLATE,
10496+ _NL_COLLATE_COLLSEQMB);
10497+
10498+ start_colseq = collseq[(unsigned char) TRANSLATE (range_start_char)];
10499+ end_colseq = collseq[(unsigned char) TRANSLATE (p[0])];
10500+ for (this_char = 0; this_char <= (unsigned char) -1; ++this_char)
10501+ {
10502+ unsigned int this_colseq = collseq[(unsigned char) TRANSLATE (this_char)];
10503+
10504+ if (start_colseq <= this_colseq && this_colseq <= end_colseq)
10505+ {
10506+ SET_LIST_BIT (TRANSLATE (this_char));
10507+ ret = REG_NOERROR;
10508+ }
10509+ }
10510+# else
10511+ /* Here we see why `this_char' has to be larger than an `unsigned
10512+ char' -- we would otherwise go into an infinite loop, since all
10513+ characters <= 0xff. */
10514+ range_start_char = TRANSLATE (range_start_char);
10515+ /* TRANSLATE(p[0]) is casted to char (not unsigned char) in TRANSLATE,
10516+ and some compilers cast it to int implicitly, so following for_loop
10517+ may fall to (almost) infinite loop.
10518+ e.g. If translate[p[0]] = 0xff, end_char may equals to 0xffffffff.
10519+ To avoid this, we cast p[0] to unsigned int and truncate it. */
10520+ end_char = ((unsigned)TRANSLATE(p[0]) & ((1 << BYTEWIDTH) - 1));
10521+
10522+ for (this_char = range_start_char; this_char <= end_char; ++this_char)
10523+ {
10524+ SET_LIST_BIT (TRANSLATE (this_char));
10525+ ret = REG_NOERROR;
10526+ }
10527+# endif
10528+
10529+ return ret;
10530+}
10531+#endif /* WCHAR */
10532+
10533+/* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in
10534+ BUFP. A fastmap records which of the (1 << BYTEWIDTH) possible
10535+ characters can start a string that matches the pattern. This fastmap
10536+ is used by re_search to skip quickly over impossible starting points.
10537+
10538+ The caller must supply the address of a (1 << BYTEWIDTH)-byte data
10539+ area as BUFP->fastmap.
10540+
10541+ We set the `fastmap', `fastmap_accurate', and `can_be_null' fields in
10542+ the pattern buffer.
10543+
10544+ Returns 0 if we succeed, -2 if an internal error. */
10545+
10546+#ifdef WCHAR
10547+/* local function for re_compile_fastmap.
10548+ truncate wchar_t character to char. */
10549+static unsigned char truncate_wchar (CHAR_T c);
10550+
10551+static unsigned char
10552+truncate_wchar (CHAR_T c)
10553+{
10554+ unsigned char buf[MB_CUR_MAX];
10555+ mbstate_t state;
10556+ int retval;
10557+ memset (&state, '\0', sizeof (state));
10558+# ifdef _LIBC
10559+ retval = __wcrtomb (buf, c, &state);
10560+# else
10561+ retval = wcrtomb (buf, c, &state);
10562+# endif
10563+ return retval > 0 ? buf[0] : (unsigned char) c;
10564+}
10565+#endif /* WCHAR */
10566+
10567+static int
10568+PREFIX(re_compile_fastmap) (struct re_pattern_buffer *bufp)
10569+{
10570+ int j, k;
10571+#ifdef MATCH_MAY_ALLOCATE
10572+ PREFIX(fail_stack_type) fail_stack;
10573+#endif
10574+#ifndef REGEX_MALLOC
10575+ char *destination;
10576+#endif
10577+
10578+ register char *fastmap = bufp->fastmap;
10579+
10580+#ifdef WCHAR
10581+ /* We need to cast pattern to (wchar_t*), because we casted this compiled
10582+ pattern to (char*) in regex_compile. */
10583+ UCHAR_T *pattern = (UCHAR_T*)bufp->buffer;
10584+ register UCHAR_T *pend = (UCHAR_T*) (bufp->buffer + bufp->used);
10585+#else /* BYTE */
10586+ UCHAR_T *pattern = bufp->buffer;
10587+ register UCHAR_T *pend = pattern + bufp->used;
10588+#endif /* WCHAR */
10589+ UCHAR_T *p = pattern;
10590+
10591+#ifdef REL_ALLOC
10592+ /* This holds the pointer to the failure stack, when
10593+ it is allocated relocatably. */
10594+ fail_stack_elt_t *failure_stack_ptr;
10595+#endif
10596+
10597+ /* Assume that each path through the pattern can be null until
10598+ proven otherwise. We set this false at the bottom of switch
10599+ statement, to which we get only if a particular path doesn't
10600+ match the empty string. */
10601+ boolean path_can_be_null = true;
10602+
10603+ /* We aren't doing a `succeed_n' to begin with. */
10604+ boolean succeed_n_p = false;
10605+
10606+ assert (fastmap != NULL && p != NULL);
10607+
10608+ INIT_FAIL_STACK ();
10609+ bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */
10610+ bufp->fastmap_accurate = 1; /* It will be when we're done. */
10611+ bufp->can_be_null = 0;
10612+
10613+ while (1)
10614+ {
10615+ if (p == pend || *p == (UCHAR_T) succeed)
10616+ {
10617+ /* We have reached the (effective) end of pattern. */
10618+ if (!FAIL_STACK_EMPTY ())
10619+ {
10620+ bufp->can_be_null |= path_can_be_null;
10621+
10622+ /* Reset for next path. */
10623+ path_can_be_null = true;
10624+
10625+ p = fail_stack.stack[--fail_stack.avail].pointer;
10626+
10627+ continue;
10628+ }
10629+ else
10630+ break;
10631+ }
10632+
10633+ /* We should never be about to go beyond the end of the pattern. */
10634+ assert (p < pend);
10635+
10636+ switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++))
10637+ {
10638+
10639+ /* I guess the idea here is to simply not bother with a fastmap
10640+ if a backreference is used, since it's too hard to figure out
10641+ the fastmap for the corresponding group. Setting
10642+ `can_be_null' stops `re_search_2' from using the fastmap, so
10643+ that is all we do. */
10644+ case duplicate:
10645+ bufp->can_be_null = 1;
10646+ goto done;
10647+
10648+
10649+ /* Following are the cases which match a character. These end
10650+ with `break'. */
10651+
10652+#ifdef WCHAR
10653+ case exactn:
10654+ fastmap[truncate_wchar(p[1])] = 1;
10655+ break;
10656+#else /* BYTE */
10657+ case exactn:
10658+ fastmap[p[1]] = 1;
10659+ break;
10660+#endif /* WCHAR */
10661+#ifdef MBS_SUPPORT
10662+ case exactn_bin:
10663+ fastmap[p[1]] = 1;
10664+ break;
10665+#endif
10666+
10667+#ifdef WCHAR
10668+ /* It is hard to distinguish fastmap from (multi byte) characters
10669+ which depends on current locale. */
10670+ case charset:
10671+ case charset_not:
10672+ case wordchar:
10673+ case notwordchar:
10674+ bufp->can_be_null = 1;
10675+ goto done;
10676+#else /* BYTE */
10677+ case charset:
10678+ for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
10679+ if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
10680+ fastmap[j] = 1;
10681+ break;
10682+
10683+
10684+ case charset_not:
10685+ /* Chars beyond end of map must be allowed. */
10686+ for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++)
10687+ fastmap[j] = 1;
10688+
10689+ for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
10690+ if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
10691+ fastmap[j] = 1;
10692+ break;
10693+
10694+
10695+ case wordchar:
10696+ for (j = 0; j < (1 << BYTEWIDTH); j++)
10697+ if (SYNTAX (j) == Sword)
10698+ fastmap[j] = 1;
10699+ break;
10700+
10701+
10702+ case notwordchar:
10703+ for (j = 0; j < (1 << BYTEWIDTH); j++)
10704+ if (SYNTAX (j) != Sword)
10705+ fastmap[j] = 1;
10706+ break;
10707+#endif /* WCHAR */
10708+
10709+ case anychar:
10710+ {
10711+ int fastmap_newline = fastmap['\n'];
10712+
10713+ /* `.' matches anything ... */
10714+ for (j = 0; j < (1 << BYTEWIDTH); j++)
10715+ fastmap[j] = 1;
10716+
10717+ /* ... except perhaps newline. */
10718+ if (!(bufp->syntax & RE_DOT_NEWLINE))
10719+ fastmap['\n'] = fastmap_newline;
10720+
10721+ /* Return if we have already set `can_be_null'; if we have,
10722+ then the fastmap is irrelevant. Something's wrong here. */
10723+ else if (bufp->can_be_null)
10724+ goto done;
10725+
10726+ /* Otherwise, have to check alternative paths. */
10727+ break;
10728+ }
10729+
10730+#ifdef emacs
10731+ case syntaxspec:
10732+ k = *p++;
10733+ for (j = 0; j < (1 << BYTEWIDTH); j++)
10734+ if (SYNTAX (j) == (enum syntaxcode) k)
10735+ fastmap[j] = 1;
10736+ break;
10737+
10738+
10739+ case notsyntaxspec:
10740+ k = *p++;
10741+ for (j = 0; j < (1 << BYTEWIDTH); j++)
10742+ if (SYNTAX (j) != (enum syntaxcode) k)
10743+ fastmap[j] = 1;
10744+ break;
10745+
10746+
10747+ /* All cases after this match the empty string. These end with
10748+ `continue'. */
10749+
10750+
10751+ case before_dot:
10752+ case at_dot:
10753+ case after_dot:
10754+ continue;
10755+#endif /* emacs */
10756+
10757+
10758+ case no_op:
10759+ case begline:
10760+ case endline:
10761+ case begbuf:
10762+ case endbuf:
10763+ case wordbound:
10764+ case notwordbound:
10765+ case wordbeg:
10766+ case wordend:
10767+ case push_dummy_failure:
10768+ continue;
10769+
10770+
10771+ case jump_n:
10772+ case pop_failure_jump:
10773+ case maybe_pop_jump:
10774+ case jump:
10775+ case jump_past_alt:
10776+ case dummy_failure_jump:
10777+ EXTRACT_NUMBER_AND_INCR (j, p);
10778+ p += j;
10779+ if (j > 0)
10780+ continue;
10781+
10782+ /* Jump backward implies we just went through the body of a
10783+ loop and matched nothing. Opcode jumped to should be
10784+ `on_failure_jump' or `succeed_n'. Just treat it like an
10785+ ordinary jump. For a * loop, it has pushed its failure
10786+ point already; if so, discard that as redundant. */
10787+ if ((re_opcode_t) *p != on_failure_jump
10788+ && (re_opcode_t) *p != succeed_n)
10789+ continue;
10790+
10791+ p++;
10792+ EXTRACT_NUMBER_AND_INCR (j, p);
10793+ p += j;
10794+
10795+ /* If what's on the stack is where we are now, pop it. */
10796+ if (!FAIL_STACK_EMPTY ()
10797+ && fail_stack.stack[fail_stack.avail - 1].pointer == p)
10798+ fail_stack.avail--;
10799+
10800+ continue;
10801+
10802+
10803+ case on_failure_jump:
10804+ case on_failure_keep_string_jump:
10805+ handle_on_failure_jump:
10806+ EXTRACT_NUMBER_AND_INCR (j, p);
10807+
10808+ /* For some patterns, e.g., `(a?)?', `p+j' here points to the
10809+ end of the pattern. We don't want to push such a point,
10810+ since when we restore it above, entering the switch will
10811+ increment `p' past the end of the pattern. We don't need
10812+ to push such a point since we obviously won't find any more
10813+ fastmap entries beyond `pend'. Such a pattern can match
10814+ the null string, though. */
10815+ if (p + j < pend)
10816+ {
10817+ if (!PUSH_PATTERN_OP (p + j, fail_stack))
10818+ {
10819+ RESET_FAIL_STACK ();
10820+ return -2;
10821+ }
10822+ }
10823+ else
10824+ bufp->can_be_null = 1;
10825+
10826+ if (succeed_n_p)
10827+ {
10828+ EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */
10829+ succeed_n_p = false;
10830+ }
10831+
10832+ continue;
10833+
10834+
10835+ case succeed_n:
10836+ /* Get to the number of times to succeed. */
10837+ p += OFFSET_ADDRESS_SIZE;
10838+
10839+ /* Increment p past the n for when k != 0. */
10840+ EXTRACT_NUMBER_AND_INCR (k, p);
10841+ if (k == 0)
10842+ {
10843+ p -= 2 * OFFSET_ADDRESS_SIZE;
10844+ succeed_n_p = true; /* Spaghetti code alert. */
10845+ goto handle_on_failure_jump;
10846+ }
10847+ continue;
10848+
10849+
10850+ case set_number_at:
10851+ p += 2 * OFFSET_ADDRESS_SIZE;
10852+ continue;
10853+
10854+
10855+ case start_memory:
10856+ case stop_memory:
10857+ p += 2;
10858+ continue;
10859+
10860+
10861+ default:
10862+ abort (); /* We have listed all the cases. */
10863+ } /* switch *p++ */
10864+
10865+ /* Getting here means we have found the possible starting
10866+ characters for one path of the pattern -- and that the empty
10867+ string does not match. We need not follow this path further.
10868+ Instead, look at the next alternative (remembered on the
10869+ stack), or quit if no more. The test at the top of the loop
10870+ does these things. */
10871+ path_can_be_null = false;
10872+ p = pend;
10873+ } /* while p */
10874+
10875+ /* Set `can_be_null' for the last path (also the first path, if the
10876+ pattern is empty). */
10877+ bufp->can_be_null |= path_can_be_null;
10878+
10879+ done:
10880+ RESET_FAIL_STACK ();
10881+ return 0;
10882+}
10883+
10884+#else /* not INSIDE_RECURSION */
10885+
10886+int
10887+re_compile_fastmap (struct re_pattern_buffer *bufp)
10888+{
10889+# ifdef MBS_SUPPORT
10890+ if (MB_CUR_MAX != 1)
10891+ return wcs_re_compile_fastmap(bufp);
10892+ else
10893+# endif
10894+ return byte_re_compile_fastmap(bufp);
10895+} /* re_compile_fastmap */
10896+#ifdef _LIBC
10897+weak_alias (__re_compile_fastmap, re_compile_fastmap)
10898+#endif
10899+
10900+
10901+/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
10902+ ENDS. Subsequent matches using PATTERN_BUFFER and REGS will use
10903+ this memory for recording register information. STARTS and ENDS
10904+ must be allocated using the malloc library routine, and must each
10905+ be at least NUM_REGS * sizeof (regoff_t) bytes long.
10906+
10907+ If NUM_REGS == 0, then subsequent matches should allocate their own
10908+ register data.
10909+
10910+ Unless this function is called, the first search or match using
10911+ PATTERN_BUFFER will allocate its own register data, without
10912+ freeing the old data. */
10913+
10914+void
10915+re_set_registers (struct re_pattern_buffer *bufp,
10916+ struct re_registers *regs, unsigned num_regs,
10917+ regoff_t *starts, regoff_t *ends)
10918+{
10919+ if (num_regs)
10920+ {
10921+ bufp->regs_allocated = REGS_REALLOCATE;
10922+ regs->num_regs = num_regs;
10923+ regs->start = starts;
10924+ regs->end = ends;
10925+ }
10926+ else
10927+ {
10928+ bufp->regs_allocated = REGS_UNALLOCATED;
10929+ regs->num_regs = 0;
10930+ regs->start = regs->end = (regoff_t *) 0;
10931+ }
10932+}
10933+#ifdef _LIBC
10934+weak_alias (__re_set_registers, re_set_registers)
10935+#endif
10936+
10937+/* Searching routines. */
10938+
10939+/* Like re_search_2, below, but only one string is specified, and
10940+ doesn't let you say where to stop matching. */
10941+
10942+int
10943+re_search (struct re_pattern_buffer *bufp, const char *string, int size,
10944+ int startpos, int range, struct re_registers *regs)
10945+{
10946+ return re_search_2 (bufp, NULL, 0, string, size, startpos, range,
10947+ regs, size);
10948+}
10949+#ifdef _LIBC
10950+weak_alias (__re_search, re_search)
10951+#endif
10952+
10953+
10954+/* Using the compiled pattern in BUFP->buffer, first tries to match the
10955+ virtual concatenation of STRING1 and STRING2, starting first at index
10956+ STARTPOS, then at STARTPOS + 1, and so on.
10957+
10958+ STRING1 and STRING2 have length SIZE1 and SIZE2, respectively.
10959+
10960+ RANGE is how far to scan while trying to match. RANGE = 0 means try
10961+ only at STARTPOS; in general, the last start tried is STARTPOS +
10962+ RANGE.
10963+
10964+ In REGS, return the indices of the virtual concatenation of STRING1
10965+ and STRING2 that matched the entire BUFP->buffer and its contained
10966+ subexpressions.
10967+
10968+ Do not consider matching one past the index STOP in the virtual
10969+ concatenation of STRING1 and STRING2.
10970+
10971+ We return either the position in the strings at which the match was
10972+ found, -1 if no match, or -2 if error (such as failure
10973+ stack overflow). */
10974+
10975+int
10976+re_search_2 (struct re_pattern_buffer *bufp, const char *string1, int size1,
10977+ const char *string2, int size2, int startpos, int range,
10978+ struct re_registers *regs, int stop)
10979+{
10980+# ifdef MBS_SUPPORT
10981+ if (MB_CUR_MAX != 1)
10982+ return wcs_re_search_2 (bufp, string1, size1, string2, size2, startpos,
10983+ range, regs, stop);
10984+ else
10985+# endif
10986+ return byte_re_search_2 (bufp, string1, size1, string2, size2, startpos,
10987+ range, regs, stop);
10988+} /* re_search_2 */
10989+#ifdef _LIBC
10990+weak_alias (__re_search_2, re_search_2)
10991+#endif
10992+
10993+#endif /* not INSIDE_RECURSION */
10994+
10995+#ifdef INSIDE_RECURSION
10996+
10997+#ifdef MATCH_MAY_ALLOCATE
10998+# define FREE_VAR(var) if (var) REGEX_FREE (var); var = NULL
10999+#else
11000+# define FREE_VAR(var) if (var) free (var); var = NULL
11001+#endif
11002+
11003+#ifdef WCHAR
11004+# define MAX_ALLOCA_SIZE 2000
11005+
11006+# define FREE_WCS_BUFFERS() \
11007+ do { \
11008+ if (size1 > MAX_ALLOCA_SIZE) \
11009+ { \
11010+ free (wcs_string1); \
11011+ free (mbs_offset1); \
11012+ } \
11013+ else \
11014+ { \
11015+ FREE_VAR (wcs_string1); \
11016+ FREE_VAR (mbs_offset1); \
11017+ } \
11018+ if (size2 > MAX_ALLOCA_SIZE) \
11019+ { \
11020+ free (wcs_string2); \
11021+ free (mbs_offset2); \
11022+ } \
11023+ else \
11024+ { \
11025+ FREE_VAR (wcs_string2); \
11026+ FREE_VAR (mbs_offset2); \
11027+ } \
11028+ } while (0)
11029+
11030+#endif
11031+
11032+
11033+static int
11034+PREFIX(re_search_2) (struct re_pattern_buffer *bufp, const char *string1,
11035+ int size1, const char *string2, int size2,
11036+ int startpos, int range,
11037+ struct re_registers *regs, int stop)
11038+{
11039+ int val;
11040+ register char *fastmap = bufp->fastmap;
11041+ register RE_TRANSLATE_TYPE translate = bufp->translate;
11042+ int total_size = size1 + size2;
11043+ int endpos = startpos + range;
11044+#ifdef WCHAR
11045+ /* We need wchar_t* buffers correspond to cstring1, cstring2. */
11046+ wchar_t *wcs_string1 = NULL, *wcs_string2 = NULL;
11047+ /* We need the size of wchar_t buffers correspond to csize1, csize2. */
11048+ int wcs_size1 = 0, wcs_size2 = 0;
11049+ /* offset buffer for optimizatoin. See convert_mbs_to_wc. */
11050+ int *mbs_offset1 = NULL, *mbs_offset2 = NULL;
11051+ /* They hold whether each wchar_t is binary data or not. */
11052+ char *is_binary = NULL;
11053+#endif /* WCHAR */
11054+
11055+ /* Check for out-of-range STARTPOS. */
11056+ if (startpos < 0 || startpos > total_size)
11057+ return -1;
11058+
11059+ /* Fix up RANGE if it might eventually take us outside
11060+ the virtual concatenation of STRING1 and STRING2.
11061+ Make sure we won't move STARTPOS below 0 or above TOTAL_SIZE. */
11062+ if (endpos < 0)
11063+ range = 0 - startpos;
11064+ else if (endpos > total_size)
11065+ range = total_size - startpos;
11066+
11067+ /* If the search isn't to be a backwards one, don't waste time in a
11068+ search for a pattern that must be anchored. */
11069+ if (bufp->used > 0 && range > 0
11070+ && ((re_opcode_t) bufp->buffer[0] == begbuf
11071+ /* `begline' is like `begbuf' if it cannot match at newlines. */
11072+ || ((re_opcode_t) bufp->buffer[0] == begline
11073+ && !bufp->newline_anchor)))
11074+ {
11075+ if (startpos > 0)
11076+ return -1;
11077+ else
11078+ range = 1;
11079+ }
11080+
11081+#ifdef emacs
11082+ /* In a forward search for something that starts with \=.
11083+ don't keep searching past point. */
11084+ if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == at_dot && range > 0)
11085+ {
11086+ range = PT - startpos;
11087+ if (range <= 0)
11088+ return -1;
11089+ }
11090+#endif /* emacs */
11091+
11092+ /* Update the fastmap now if not correct already. */
11093+ if (fastmap && !bufp->fastmap_accurate)
11094+ if (re_compile_fastmap (bufp) == -2)
11095+ return -2;
11096+
11097+#ifdef WCHAR
11098+ /* Allocate wchar_t array for wcs_string1 and wcs_string2 and
11099+ fill them with converted string. */
11100+ if (size1 != 0)
11101+ {
11102+ if (size1 > MAX_ALLOCA_SIZE)
11103+ {
11104+ wcs_string1 = TALLOC (size1 + 1, CHAR_T);
11105+ mbs_offset1 = TALLOC (size1 + 1, int);
11106+ is_binary = TALLOC (size1 + 1, char);
11107+ }
11108+ else
11109+ {
11110+ wcs_string1 = REGEX_TALLOC (size1 + 1, CHAR_T);
11111+ mbs_offset1 = REGEX_TALLOC (size1 + 1, int);
11112+ is_binary = REGEX_TALLOC (size1 + 1, char);
11113+ }
11114+ if (!wcs_string1 || !mbs_offset1 || !is_binary)
11115+ {
11116+ if (size1 > MAX_ALLOCA_SIZE)
11117+ {
11118+ free (wcs_string1);
11119+ free (mbs_offset1);
11120+ free (is_binary);
11121+ }
11122+ else
11123+ {
11124+ FREE_VAR (wcs_string1);
11125+ FREE_VAR (mbs_offset1);
11126+ FREE_VAR (is_binary);
11127+ }
11128+ return -2;
11129+ }
11130+ wcs_size1 = convert_mbs_to_wcs(wcs_string1, string1, size1,
11131+ mbs_offset1, is_binary);
11132+ wcs_string1[wcs_size1] = L'\0'; /* for a sentinel */
11133+ if (size1 > MAX_ALLOCA_SIZE)
11134+ free (is_binary);
11135+ else
11136+ FREE_VAR (is_binary);
11137+ }
11138+ if (size2 != 0)
11139+ {
11140+ if (size2 > MAX_ALLOCA_SIZE)
11141+ {
11142+ wcs_string2 = TALLOC (size2 + 1, CHAR_T);
11143+ mbs_offset2 = TALLOC (size2 + 1, int);
11144+ is_binary = TALLOC (size2 + 1, char);
11145+ }
11146+ else
11147+ {
11148+ wcs_string2 = REGEX_TALLOC (size2 + 1, CHAR_T);
11149+ mbs_offset2 = REGEX_TALLOC (size2 + 1, int);
11150+ is_binary = REGEX_TALLOC (size2 + 1, char);
11151+ }
11152+ if (!wcs_string2 || !mbs_offset2 || !is_binary)
11153+ {
11154+ FREE_WCS_BUFFERS ();
11155+ if (size2 > MAX_ALLOCA_SIZE)
11156+ free (is_binary);
11157+ else
11158+ FREE_VAR (is_binary);
11159+ return -2;
11160+ }
11161+ wcs_size2 = convert_mbs_to_wcs(wcs_string2, string2, size2,
11162+ mbs_offset2, is_binary);
11163+ wcs_string2[wcs_size2] = L'\0'; /* for a sentinel */
11164+ if (size2 > MAX_ALLOCA_SIZE)
11165+ free (is_binary);
11166+ else
11167+ FREE_VAR (is_binary);
11168+ }
11169+#endif /* WCHAR */
11170+
11171+
11172+ /* Loop through the string, looking for a place to start matching. */
11173+ for (;;)
11174+ {
11175+ /* If a fastmap is supplied, skip quickly over characters that
11176+ cannot be the start of a match. If the pattern can match the
11177+ null string, however, we don't need to skip characters; we want
11178+ the first null string. */
11179+ if (fastmap && startpos < total_size && !bufp->can_be_null)
11180+ {
11181+ if (range > 0) /* Searching forwards. */
11182+ {
11183+ register const char *d;
11184+ register int lim = 0;
11185+ int irange = range;
11186+
11187+ if (startpos < size1 && startpos + range >= size1)
11188+ lim = range - (size1 - startpos);
11189+
11190+ d = (startpos >= size1 ? string2 - size1 : string1) + startpos;
11191+
11192+ /* Written out as an if-else to avoid testing `translate'
11193+ inside the loop. */
11194+ if (translate)
11195+ while (range > lim
11196+ && !fastmap[(unsigned char)
11197+ translate[(unsigned char) *d++]])
11198+ range--;
11199+ else
11200+ while (range > lim && !fastmap[(unsigned char) *d++])
11201+ range--;
11202+
11203+ startpos += irange - range;
11204+ }
11205+ else /* Searching backwards. */
11206+ {
11207+ register CHAR_T c = (size1 == 0 || startpos >= size1
11208+ ? string2[startpos - size1]
11209+ : string1[startpos]);
11210+
11211+ if (!fastmap[(unsigned char) TRANSLATE (c)])
11212+ goto advance;
11213+ }
11214+ }
11215+
11216+ /* If can't match the null string, and that's all we have left, fail. */
11217+ if (range >= 0 && startpos == total_size && fastmap
11218+ && !bufp->can_be_null)
11219+ {
11220+#ifdef WCHAR
11221+ FREE_WCS_BUFFERS ();
11222+#endif
11223+ return -1;
11224+ }
11225+
11226+#ifdef WCHAR
11227+ val = wcs_re_match_2_internal (bufp, string1, size1, string2,
11228+ size2, startpos, regs, stop,
11229+ wcs_string1, wcs_size1,
11230+ wcs_string2, wcs_size2,
11231+ mbs_offset1, mbs_offset2);
11232+#else /* BYTE */
11233+ val = byte_re_match_2_internal (bufp, string1, size1, string2,
11234+ size2, startpos, regs, stop);
11235+#endif /* BYTE */
11236+
11237+#ifndef REGEX_MALLOC
11238+# ifdef C_ALLOCA
11239+ alloca (0);
11240+# endif
11241+#endif
11242+
11243+ if (val >= 0)
11244+ {
11245+#ifdef WCHAR
11246+ FREE_WCS_BUFFERS ();
11247+#endif
11248+ return startpos;
11249+ }
11250+
11251+ if (val == -2)
11252+ {
11253+#ifdef WCHAR
11254+ FREE_WCS_BUFFERS ();
11255+#endif
11256+ return -2;
11257+ }
11258+
11259+ advance:
11260+ if (!range)
11261+ break;
11262+ else if (range > 0)
11263+ {
11264+ range--;
11265+ startpos++;
11266+ }
11267+ else
11268+ {
11269+ range++;
11270+ startpos--;
11271+ }
11272+ }
11273+#ifdef WCHAR
11274+ FREE_WCS_BUFFERS ();
11275+#endif
11276+ return -1;
11277+}
11278+
11279+#ifdef WCHAR
11280+/* This converts PTR, a pointer into one of the search wchar_t strings
11281+ `string1' and `string2' into an multibyte string offset from the
11282+ beginning of that string. We use mbs_offset to optimize.
11283+ See convert_mbs_to_wcs. */
11284+# define POINTER_TO_OFFSET(ptr) \
11285+ (FIRST_STRING_P (ptr) \
11286+ ? ((regoff_t)(mbs_offset1 != NULL? mbs_offset1[(ptr)-string1] : 0)) \
11287+ : ((regoff_t)((mbs_offset2 != NULL? mbs_offset2[(ptr)-string2] : 0) \
11288+ + csize1)))
11289+#else /* BYTE */
11290+/* This converts PTR, a pointer into one of the search strings `string1'
11291+ and `string2' into an offset from the beginning of that string. */
11292+# define POINTER_TO_OFFSET(ptr) \
11293+ (FIRST_STRING_P (ptr) \
11294+ ? ((regoff_t) ((ptr) - string1)) \
11295+ : ((regoff_t) ((ptr) - string2 + size1)))
11296+#endif /* WCHAR */
11297+
11298+/* Macros for dealing with the split strings in re_match_2. */
11299+
11300+#define MATCHING_IN_FIRST_STRING (dend == end_match_1)
11301+
11302+/* Call before fetching a character with *d. This switches over to
11303+ string2 if necessary. */
11304+#define PREFETCH() \
11305+ while (d == dend) \
11306+ { \
11307+ /* End of string2 => fail. */ \
11308+ if (dend == end_match_2) \
11309+ goto fail; \
11310+ /* End of string1 => advance to string2. */ \
11311+ d = string2; \
11312+ dend = end_match_2; \
11313+ }
11314+
11315+/* Test if at very beginning or at very end of the virtual concatenation
11316+ of `string1' and `string2'. If only one string, it's `string2'. */
11317+#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2)
11318+#define AT_STRINGS_END(d) ((d) == end2)
11319+
11320+
11321+/* Test if D points to a character which is word-constituent. We have
11322+ two special cases to check for: if past the end of string1, look at
11323+ the first character in string2; and if before the beginning of
11324+ string2, look at the last character in string1. */
11325+#ifdef WCHAR
11326+/* Use internationalized API instead of SYNTAX. */
11327+# define WORDCHAR_P(d) \
11328+ (iswalnum ((wint_t)((d) == end1 ? *string2 \
11329+ : (d) == string2 - 1 ? *(end1 - 1) : *(d))) != 0 \
11330+ || ((d) == end1 ? *string2 \
11331+ : (d) == string2 - 1 ? *(end1 - 1) : *(d)) == L'_')
11332+#else /* BYTE */
11333+# define WORDCHAR_P(d) \
11334+ (SYNTAX ((d) == end1 ? *string2 \
11335+ : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \
11336+ == Sword)
11337+#endif /* WCHAR */
11338+
11339+/* Disabled due to a compiler bug -- see comment at case wordbound */
11340+#if 0
11341+/* Test if the character before D and the one at D differ with respect
11342+ to being word-constituent. */
11343+#define AT_WORD_BOUNDARY(d) \
11344+ (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \
11345+ || WORDCHAR_P (d - 1) != WORDCHAR_P (d))
11346+#endif
11347+
11348+/* Free everything we malloc. */
11349+#ifdef MATCH_MAY_ALLOCATE
11350+# ifdef WCHAR
11351+# define FREE_VARIABLES() \
11352+ do { \
11353+ REGEX_FREE_STACK (fail_stack.stack); \
11354+ FREE_VAR (regstart); \
11355+ FREE_VAR (regend); \
11356+ FREE_VAR (old_regstart); \
11357+ FREE_VAR (old_regend); \
11358+ FREE_VAR (best_regstart); \
11359+ FREE_VAR (best_regend); \
11360+ FREE_VAR (reg_info); \
11361+ FREE_VAR (reg_dummy); \
11362+ FREE_VAR (reg_info_dummy); \
11363+ if (!cant_free_wcs_buf) \
11364+ { \
11365+ FREE_VAR (string1); \
11366+ FREE_VAR (string2); \
11367+ FREE_VAR (mbs_offset1); \
11368+ FREE_VAR (mbs_offset2); \
11369+ } \
11370+ } while (0)
11371+# else /* BYTE */
11372+# define FREE_VARIABLES() \
11373+ do { \
11374+ REGEX_FREE_STACK (fail_stack.stack); \
11375+ FREE_VAR (regstart); \
11376+ FREE_VAR (regend); \
11377+ FREE_VAR (old_regstart); \
11378+ FREE_VAR (old_regend); \
11379+ FREE_VAR (best_regstart); \
11380+ FREE_VAR (best_regend); \
11381+ FREE_VAR (reg_info); \
11382+ FREE_VAR (reg_dummy); \
11383+ FREE_VAR (reg_info_dummy); \
11384+ } while (0)
11385+# endif /* WCHAR */
11386+#else
11387+# ifdef WCHAR
11388+# define FREE_VARIABLES() \
11389+ do { \
11390+ if (!cant_free_wcs_buf) \
11391+ { \
11392+ FREE_VAR (string1); \
11393+ FREE_VAR (string2); \
11394+ FREE_VAR (mbs_offset1); \
11395+ FREE_VAR (mbs_offset2); \
11396+ } \
11397+ } while (0)
11398+# else /* BYTE */
11399+# define FREE_VARIABLES() ((void)0) /* Do nothing! But inhibit gcc warning. */
11400+# endif /* WCHAR */
11401+#endif /* not MATCH_MAY_ALLOCATE */
11402+
11403+/* These values must meet several constraints. They must not be valid
11404+ register values; since we have a limit of 255 registers (because
11405+ we use only one byte in the pattern for the register number), we can
11406+ use numbers larger than 255. They must differ by 1, because of
11407+ NUM_FAILURE_ITEMS above. And the value for the lowest register must
11408+ be larger than the value for the highest register, so we do not try
11409+ to actually save any registers when none are active. */
11410+#define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH)
11411+#define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1)
11412+
11413+#else /* not INSIDE_RECURSION */
11414+/* Matching routines. */
11415+
11416+#ifndef emacs /* Emacs never uses this. */
11417+/* re_match is like re_match_2 except it takes only a single string. */
11418+
11419+int
11420+re_match (struct re_pattern_buffer *bufp, const char *string,
11421+ int size, int pos, struct re_registers *regs)
11422+{
11423+ int result;
11424+# ifdef MBS_SUPPORT
11425+ if (MB_CUR_MAX != 1)
11426+ result = wcs_re_match_2_internal (bufp, NULL, 0, string, size,
11427+ pos, regs, size,
11428+ NULL, 0, NULL, 0, NULL, NULL);
11429+ else
11430+# endif
11431+ result = byte_re_match_2_internal (bufp, NULL, 0, string, size,
11432+ pos, regs, size);
11433+# ifndef REGEX_MALLOC
11434+# ifdef C_ALLOCA
11435+ alloca (0);
11436+# endif
11437+# endif
11438+ return result;
11439+}
11440+# ifdef _LIBC
11441+weak_alias (__re_match, re_match)
11442+# endif
11443+#endif /* not emacs */
11444+
11445+#endif /* not INSIDE_RECURSION */
11446+
11447+#ifdef INSIDE_RECURSION
11448+static boolean PREFIX(group_match_null_string_p) (UCHAR_T **p,
11449+ UCHAR_T *end,
11450+ PREFIX(register_info_type) *reg_info);
11451+static boolean PREFIX(alt_match_null_string_p) (UCHAR_T *p,
11452+ UCHAR_T *end,
11453+ PREFIX(register_info_type) *reg_info);
11454+static boolean PREFIX(common_op_match_null_string_p) (UCHAR_T **p,
11455+ UCHAR_T *end,
11456+ PREFIX(register_info_type) *reg_info);
11457+static int PREFIX(bcmp_translate) (const CHAR_T *s1, const CHAR_T *s2,
11458+ register int len,
11459+ RE_TRANSLATE_TYPE translate);
11460+#else /* not INSIDE_RECURSION */
11461+
11462+/* re_match_2 matches the compiled pattern in BUFP against the
11463+ the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1
11464+ and SIZE2, respectively). We start matching at POS, and stop
11465+ matching at STOP.
11466+
11467+ If REGS is non-null and the `no_sub' field of BUFP is nonzero, we
11468+ store offsets for the substring each group matched in REGS. See the
11469+ documentation for exactly how many groups we fill.
11470+
11471+ We return -1 if no match, -2 if an internal error (such as the
11472+ failure stack overflowing). Otherwise, we return the length of the
11473+ matched substring. */
11474+
11475+int
11476+re_match_2 (struct re_pattern_buffer *bufp, const char *string1, int size1,
11477+ const char *string2, int size2, int pos,
11478+ struct re_registers *regs, int stop)
11479+{
11480+ int result;
11481+# ifdef MBS_SUPPORT
11482+ if (MB_CUR_MAX != 1)
11483+ result = wcs_re_match_2_internal (bufp, string1, size1, string2, size2,
11484+ pos, regs, stop,
11485+ NULL, 0, NULL, 0, NULL, NULL);
11486+ else
11487+# endif
11488+ result = byte_re_match_2_internal (bufp, string1, size1, string2, size2,
11489+ pos, regs, stop);
11490+
11491+#ifndef REGEX_MALLOC
11492+# ifdef C_ALLOCA
11493+ alloca (0);
11494+# endif
11495+#endif
11496+ return result;
11497+}
11498+#ifdef _LIBC
11499+weak_alias (__re_match_2, re_match_2)
11500+#endif
11501+
11502+#endif /* not INSIDE_RECURSION */
11503+
11504+#ifdef INSIDE_RECURSION
11505+
11506+#ifdef WCHAR
11507+static int count_mbs_length (int *, int);
11508+
11509+/* This check the substring (from 0, to length) of the multibyte string,
11510+ to which offset_buffer correspond. And count how many wchar_t_characters
11511+ the substring occupy. We use offset_buffer to optimization.
11512+ See convert_mbs_to_wcs. */
11513+
11514+static int
11515+count_mbs_length(int *offset_buffer, int length)
11516+{
11517+ int upper, lower;
11518+
11519+ /* Check whether the size is valid. */
11520+ if (length < 0)
11521+ return -1;
11522+
11523+ if (offset_buffer == NULL)
11524+ return 0;
11525+
11526+ /* If there are no multibyte character, offset_buffer[i] == i.
11527+ Optmize for this case. */
11528+ if (offset_buffer[length] == length)
11529+ return length;
11530+
11531+ /* Set up upper with length. (because for all i, offset_buffer[i] >= i) */
11532+ upper = length;
11533+ lower = 0;
11534+
11535+ while (true)
11536+ {
11537+ int middle = (lower + upper) / 2;
11538+ if (middle == lower || middle == upper)
11539+ break;
11540+ if (offset_buffer[middle] > length)
11541+ upper = middle;
11542+ else if (offset_buffer[middle] < length)
11543+ lower = middle;
11544+ else
11545+ return middle;
11546+ }
11547+
11548+ return -1;
11549+}
11550+#endif /* WCHAR */
11551+
11552+/* This is a separate function so that we can force an alloca cleanup
11553+ afterwards. */
11554+#ifdef WCHAR
11555+static int
11556+wcs_re_match_2_internal (struct re_pattern_buffer *bufp,
11557+ const char *cstring1, int csize1,
11558+ const char *cstring2, int csize2,
11559+ int pos,
11560+ struct re_registers *regs,
11561+ int stop,
11562+ /* string1 == string2 == NULL means string1/2, size1/2 and
11563+ mbs_offset1/2 need seting up in this function. */
11564+ /* We need wchar_t* buffers correspond to cstring1, cstring2. */
11565+ wchar_t *string1, int size1,
11566+ wchar_t *string2, int size2,
11567+ /* offset buffer for optimizatoin. See convert_mbs_to_wc. */
11568+ int *mbs_offset1, int *mbs_offset2)
11569+#else /* BYTE */
11570+static int
11571+byte_re_match_2_internal (struct re_pattern_buffer *bufp,
11572+ const char *string1, int size1,
11573+ const char *string2, int size2,
11574+ int pos,
11575+ struct re_registers *regs, int stop)
11576+#endif /* BYTE */
11577+{
11578+ /* General temporaries. */
11579+ int mcnt;
11580+ UCHAR_T *p1;
11581+#ifdef WCHAR
11582+ /* They hold whether each wchar_t is binary data or not. */
11583+ char *is_binary = NULL;
11584+ /* If true, we can't free string1/2, mbs_offset1/2. */
11585+ int cant_free_wcs_buf = 1;
11586+#endif /* WCHAR */
11587+
11588+ /* Just past the end of the corresponding string. */
11589+ const CHAR_T *end1, *end2;
11590+
11591+ /* Pointers into string1 and string2, just past the last characters in
11592+ each to consider matching. */
11593+ const CHAR_T *end_match_1, *end_match_2;
11594+
11595+ /* Where we are in the data, and the end of the current string. */
11596+ const CHAR_T *d, *dend;
11597+
11598+ /* Where we are in the pattern, and the end of the pattern. */
11599+#ifdef WCHAR
11600+ UCHAR_T *pattern, *p;
11601+ register UCHAR_T *pend;
11602+#else /* BYTE */
11603+ UCHAR_T *p = bufp->buffer;
11604+ register UCHAR_T *pend = p + bufp->used;
11605+#endif /* WCHAR */
11606+
11607+ /* Mark the opcode just after a start_memory, so we can test for an
11608+ empty subpattern when we get to the stop_memory. */
11609+ UCHAR_T *just_past_start_mem = 0;
11610+
11611+ /* We use this to map every character in the string. */
11612+ RE_TRANSLATE_TYPE translate = bufp->translate;
11613+
11614+ /* Failure point stack. Each place that can handle a failure further
11615+ down the line pushes a failure point on this stack. It consists of
11616+ restart, regend, and reg_info for all registers corresponding to
11617+ the subexpressions we're currently inside, plus the number of such
11618+ registers, and, finally, two char *'s. The first char * is where
11619+ to resume scanning the pattern; the second one is where to resume
11620+ scanning the strings. If the latter is zero, the failure point is
11621+ a ``dummy''; if a failure happens and the failure point is a dummy,
11622+ it gets discarded and the next next one is tried. */
11623+#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */
11624+ PREFIX(fail_stack_type) fail_stack;
11625+#endif
11626+#ifdef DEBUG
11627+ static unsigned failure_id;
11628+ unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0;
11629+#endif
11630+
11631+#ifdef REL_ALLOC
11632+ /* This holds the pointer to the failure stack, when
11633+ it is allocated relocatably. */
11634+ fail_stack_elt_t *failure_stack_ptr;
11635+#endif
11636+
11637+ /* We fill all the registers internally, independent of what we
11638+ return, for use in backreferences. The number here includes
11639+ an element for register zero. */
11640+ size_t num_regs = bufp->re_nsub + 1;
11641+
11642+ /* The currently active registers. */
11643+ active_reg_t lowest_active_reg = NO_LOWEST_ACTIVE_REG;
11644+ active_reg_t highest_active_reg = NO_HIGHEST_ACTIVE_REG;
11645+
11646+ /* Information on the contents of registers. These are pointers into
11647+ the input strings; they record just what was matched (on this
11648+ attempt) by a subexpression part of the pattern, that is, the
11649+ regnum-th regstart pointer points to where in the pattern we began
11650+ matching and the regnum-th regend points to right after where we
11651+ stopped matching the regnum-th subexpression. (The zeroth register
11652+ keeps track of what the whole pattern matches.) */
11653+#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
11654+ const CHAR_T **regstart, **regend;
11655+#endif
11656+
11657+ /* If a group that's operated upon by a repetition operator fails to
11658+ match anything, then the register for its start will need to be
11659+ restored because it will have been set to wherever in the string we
11660+ are when we last see its open-group operator. Similarly for a
11661+ register's end. */
11662+#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
11663+ const CHAR_T **old_regstart, **old_regend;
11664+#endif
11665+
11666+ /* The is_active field of reg_info helps us keep track of which (possibly
11667+ nested) subexpressions we are currently in. The matched_something
11668+ field of reg_info[reg_num] helps us tell whether or not we have
11669+ matched any of the pattern so far this time through the reg_num-th
11670+ subexpression. These two fields get reset each time through any
11671+ loop their register is in. */
11672+#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */
11673+ PREFIX(register_info_type) *reg_info;
11674+#endif
11675+
11676+ /* The following record the register info as found in the above
11677+ variables when we find a match better than any we've seen before.
11678+ This happens as we backtrack through the failure points, which in
11679+ turn happens only if we have not yet matched the entire string. */
11680+ unsigned best_regs_set = false;
11681+#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
11682+ const CHAR_T **best_regstart, **best_regend;
11683+#endif
11684+
11685+ /* Logically, this is `best_regend[0]'. But we don't want to have to
11686+ allocate space for that if we're not allocating space for anything
11687+ else (see below). Also, we never need info about register 0 for
11688+ any of the other register vectors, and it seems rather a kludge to
11689+ treat `best_regend' differently than the rest. So we keep track of
11690+ the end of the best match so far in a separate variable. We
11691+ initialize this to NULL so that when we backtrack the first time
11692+ and need to test it, it's not garbage. */
11693+ const CHAR_T *match_end = NULL;
11694+
11695+ /* This helps SET_REGS_MATCHED avoid doing redundant work. */
11696+ int set_regs_matched_done = 0;
11697+
11698+ /* Used when we pop values we don't care about. */
11699+#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
11700+ const CHAR_T **reg_dummy;
11701+ PREFIX(register_info_type) *reg_info_dummy;
11702+#endif
11703+
11704+#ifdef DEBUG
11705+ /* Counts the total number of registers pushed. */
11706+ unsigned num_regs_pushed = 0;
11707+#endif
11708+
11709+ DEBUG_PRINT1 ("\n\nEntering re_match_2.\n");
11710+
11711+ INIT_FAIL_STACK ();
11712+
11713+#ifdef MATCH_MAY_ALLOCATE
11714+ /* Do not bother to initialize all the register variables if there are
11715+ no groups in the pattern, as it takes a fair amount of time. If
11716+ there are groups, we include space for register 0 (the whole
11717+ pattern), even though we never use it, since it simplifies the
11718+ array indexing. We should fix this. */
11719+ if (bufp->re_nsub)
11720+ {
11721+ regstart = REGEX_TALLOC (num_regs, const CHAR_T *);
11722+ regend = REGEX_TALLOC (num_regs, const CHAR_T *);
11723+ old_regstart = REGEX_TALLOC (num_regs, const CHAR_T *);
11724+ old_regend = REGEX_TALLOC (num_regs, const CHAR_T *);
11725+ best_regstart = REGEX_TALLOC (num_regs, const CHAR_T *);
11726+ best_regend = REGEX_TALLOC (num_regs, const CHAR_T *);
11727+ reg_info = REGEX_TALLOC (num_regs, PREFIX(register_info_type));
11728+ reg_dummy = REGEX_TALLOC (num_regs, const CHAR_T *);
11729+ reg_info_dummy = REGEX_TALLOC (num_regs, PREFIX(register_info_type));
11730+
11731+ if (!(regstart && regend && old_regstart && old_regend && reg_info
11732+ && best_regstart && best_regend && reg_dummy && reg_info_dummy))
11733+ {
11734+ FREE_VARIABLES ();
11735+ return -2;
11736+ }
11737+ }
11738+ else
11739+ {
11740+ /* We must initialize all our variables to NULL, so that
11741+ `FREE_VARIABLES' doesn't try to free them. */
11742+ regstart = regend = old_regstart = old_regend = best_regstart
11743+ = best_regend = reg_dummy = NULL;
11744+ reg_info = reg_info_dummy = (PREFIX(register_info_type) *) NULL;
11745+ }
11746+#endif /* MATCH_MAY_ALLOCATE */
11747+
11748+ /* The starting position is bogus. */
11749+#ifdef WCHAR
11750+ if (pos < 0 || pos > csize1 + csize2)
11751+#else /* BYTE */
11752+ if (pos < 0 || pos > size1 + size2)
11753+#endif
11754+ {
11755+ FREE_VARIABLES ();
11756+ return -1;
11757+ }
11758+
11759+#ifdef WCHAR
11760+ /* Allocate wchar_t array for string1 and string2 and
11761+ fill them with converted string. */
11762+ if (string1 == NULL && string2 == NULL)
11763+ {
11764+ /* We need seting up buffers here. */
11765+
11766+ /* We must free wcs buffers in this function. */
11767+ cant_free_wcs_buf = 0;
11768+
11769+ if (csize1 != 0)
11770+ {
11771+ string1 = REGEX_TALLOC (csize1 + 1, CHAR_T);
11772+ mbs_offset1 = REGEX_TALLOC (csize1 + 1, int);
11773+ is_binary = REGEX_TALLOC (csize1 + 1, char);
11774+ if (!string1 || !mbs_offset1 || !is_binary)
11775+ {
11776+ FREE_VAR (string1);
11777+ FREE_VAR (mbs_offset1);
11778+ FREE_VAR (is_binary);
11779+ return -2;
11780+ }
11781+ }
11782+ if (csize2 != 0)
11783+ {
11784+ string2 = REGEX_TALLOC (csize2 + 1, CHAR_T);
11785+ mbs_offset2 = REGEX_TALLOC (csize2 + 1, int);
11786+ is_binary = REGEX_TALLOC (csize2 + 1, char);
11787+ if (!string2 || !mbs_offset2 || !is_binary)
11788+ {
11789+ FREE_VAR (string1);
11790+ FREE_VAR (mbs_offset1);
11791+ FREE_VAR (string2);
11792+ FREE_VAR (mbs_offset2);
11793+ FREE_VAR (is_binary);
11794+ return -2;
11795+ }
11796+ size2 = convert_mbs_to_wcs(string2, cstring2, csize2,
11797+ mbs_offset2, is_binary);
11798+ string2[size2] = L'\0'; /* for a sentinel */
11799+ FREE_VAR (is_binary);
11800+ }
11801+ }
11802+
11803+ /* We need to cast pattern to (wchar_t*), because we casted this compiled
11804+ pattern to (char*) in regex_compile. */
11805+ p = pattern = (CHAR_T*)bufp->buffer;
11806+ pend = (CHAR_T*)(bufp->buffer + bufp->used);
11807+
11808+#endif /* WCHAR */
11809+
11810+ /* Initialize subexpression text positions to -1 to mark ones that no
11811+ start_memory/stop_memory has been seen for. Also initialize the
11812+ register information struct. */
11813+ for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++)
11814+ {
11815+ regstart[mcnt] = regend[mcnt]
11816+ = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE;
11817+
11818+ REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE;
11819+ IS_ACTIVE (reg_info[mcnt]) = 0;
11820+ MATCHED_SOMETHING (reg_info[mcnt]) = 0;
11821+ EVER_MATCHED_SOMETHING (reg_info[mcnt]) = 0;
11822+ }
11823+
11824+ /* We move `string1' into `string2' if the latter's empty -- but not if
11825+ `string1' is null. */
11826+ if (size2 == 0 && string1 != NULL)
11827+ {
11828+ string2 = string1;
11829+ size2 = size1;
11830+ string1 = 0;
11831+ size1 = 0;
11832+#ifdef WCHAR
11833+ mbs_offset2 = mbs_offset1;
11834+ csize2 = csize1;
11835+ mbs_offset1 = NULL;
11836+ csize1 = 0;
11837+#endif
11838+ }
11839+ end1 = string1 + size1;
11840+ end2 = string2 + size2;
11841+
11842+ /* Compute where to stop matching, within the two strings. */
11843+#ifdef WCHAR
11844+ if (stop <= csize1)
11845+ {
11846+ mcnt = count_mbs_length(mbs_offset1, stop);
11847+ end_match_1 = string1 + mcnt;
11848+ end_match_2 = string2;
11849+ }
11850+ else
11851+ {
11852+ if (stop > csize1 + csize2)
11853+ stop = csize1 + csize2;
11854+ end_match_1 = end1;
11855+ mcnt = count_mbs_length(mbs_offset2, stop-csize1);
11856+ end_match_2 = string2 + mcnt;
11857+ }
11858+ if (mcnt < 0)
11859+ { /* count_mbs_length return error. */
11860+ FREE_VARIABLES ();
11861+ return -1;
11862+ }
11863+#else
11864+ if (stop <= size1)
11865+ {
11866+ end_match_1 = string1 + stop;
11867+ end_match_2 = string2;
11868+ }
11869+ else
11870+ {
11871+ end_match_1 = end1;
11872+ end_match_2 = string2 + stop - size1;
11873+ }
11874+#endif /* WCHAR */
11875+
11876+ /* `p' scans through the pattern as `d' scans through the data.
11877+ `dend' is the end of the input string that `d' points within. `d'
11878+ is advanced into the following input string whenever necessary, but
11879+ this happens before fetching; therefore, at the beginning of the
11880+ loop, `d' can be pointing at the end of a string, but it cannot
11881+ equal `string2'. */
11882+#ifdef WCHAR
11883+ if (size1 > 0 && pos <= csize1)
11884+ {
11885+ mcnt = count_mbs_length(mbs_offset1, pos);
11886+ d = string1 + mcnt;
11887+ dend = end_match_1;
11888+ }
11889+ else
11890+ {
11891+ mcnt = count_mbs_length(mbs_offset2, pos-csize1);
11892+ d = string2 + mcnt;
11893+ dend = end_match_2;
11894+ }
11895+
11896+ if (mcnt < 0)
11897+ { /* count_mbs_length return error. */
11898+ FREE_VARIABLES ();
11899+ return -1;
11900+ }
11901+#else
11902+ if (size1 > 0 && pos <= size1)
11903+ {
11904+ d = string1 + pos;
11905+ dend = end_match_1;
11906+ }
11907+ else
11908+ {
11909+ d = string2 + pos - size1;
11910+ dend = end_match_2;
11911+ }
11912+#endif /* WCHAR */
11913+
11914+ DEBUG_PRINT1 ("The compiled pattern is:\n");
11915+ DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend);
11916+ DEBUG_PRINT1 ("The string to match is: `");
11917+ DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2);
11918+ DEBUG_PRINT1 ("'\n");
11919+
11920+ /* This loops over pattern commands. It exits by returning from the
11921+ function if the match is complete, or it drops through if the match
11922+ fails at this starting point in the input data. */
11923+ for (;;)
11924+ {
11925+#ifdef _LIBC
11926+ DEBUG_PRINT2 ("\n%p: ", p);
11927+#else
11928+ DEBUG_PRINT2 ("\n0x%x: ", p);
11929+#endif
11930+
11931+ if (p == pend)
11932+ { /* End of pattern means we might have succeeded. */
11933+ DEBUG_PRINT1 ("end of pattern ... ");
11934+
11935+ /* If we haven't matched the entire string, and we want the
11936+ longest match, try backtracking. */
11937+ if (d != end_match_2)
11938+ {
11939+ /* 1 if this match ends in the same string (string1 or string2)
11940+ as the best previous match. */
11941+ boolean same_str_p = (FIRST_STRING_P (match_end)
11942+ == MATCHING_IN_FIRST_STRING);
11943+ /* 1 if this match is the best seen so far. */
11944+ boolean best_match_p;
11945+
11946+ /* AIX compiler got confused when this was combined
11947+ with the previous declaration. */
11948+ if (same_str_p)
11949+ best_match_p = d > match_end;
11950+ else
11951+ best_match_p = !MATCHING_IN_FIRST_STRING;
11952+
11953+ DEBUG_PRINT1 ("backtracking.\n");
11954+
11955+ if (!FAIL_STACK_EMPTY ())
11956+ { /* More failure points to try. */
11957+
11958+ /* If exceeds best match so far, save it. */
11959+ if (!best_regs_set || best_match_p)
11960+ {
11961+ best_regs_set = true;
11962+ match_end = d;
11963+
11964+ DEBUG_PRINT1 ("\nSAVING match as best so far.\n");
11965+
11966+ for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++)
11967+ {
11968+ best_regstart[mcnt] = regstart[mcnt];
11969+ best_regend[mcnt] = regend[mcnt];
11970+ }
11971+ }
11972+ goto fail;
11973+ }
11974+
11975+ /* If no failure points, don't restore garbage. And if
11976+ last match is real best match, don't restore second
11977+ best one. */
11978+ else if (best_regs_set && !best_match_p)
11979+ {
11980+ restore_best_regs:
11981+ /* Restore best match. It may happen that `dend ==
11982+ end_match_1' while the restored d is in string2.
11983+ For example, the pattern `x.*y.*z' against the
11984+ strings `x-' and `y-z-', if the two strings are
11985+ not consecutive in memory. */
11986+ DEBUG_PRINT1 ("Restoring best registers.\n");
11987+
11988+ d = match_end;
11989+ dend = ((d >= string1 && d <= end1)
11990+ ? end_match_1 : end_match_2);
11991+
11992+ for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++)
11993+ {
11994+ regstart[mcnt] = best_regstart[mcnt];
11995+ regend[mcnt] = best_regend[mcnt];
11996+ }
11997+ }
11998+ } /* d != end_match_2 */
11999+
12000+ succeed_label:
12001+ DEBUG_PRINT1 ("Accepting match.\n");
12002+ /* If caller wants register contents data back, do it. */
12003+ if (regs && !bufp->no_sub)
12004+ {
12005+ /* Have the register data arrays been allocated? */
12006+ if (bufp->regs_allocated == REGS_UNALLOCATED)
12007+ { /* No. So allocate them with malloc. We need one
12008+ extra element beyond `num_regs' for the `-1' marker
12009+ GNU code uses. */
12010+ regs->num_regs = MAX (RE_NREGS, num_regs + 1);
12011+ regs->start = TALLOC (regs->num_regs, regoff_t);
12012+ regs->end = TALLOC (regs->num_regs, regoff_t);
12013+ if (regs->start == NULL || regs->end == NULL)
12014+ {
12015+ FREE_VARIABLES ();
12016+ return -2;
12017+ }
12018+ bufp->regs_allocated = REGS_REALLOCATE;
12019+ }
12020+ else if (bufp->regs_allocated == REGS_REALLOCATE)
12021+ { /* Yes. If we need more elements than were already
12022+ allocated, reallocate them. If we need fewer, just
12023+ leave it alone. */
12024+ if (regs->num_regs < num_regs + 1)
12025+ {
12026+ regs->num_regs = num_regs + 1;
12027+ RETALLOC (regs->start, regs->num_regs, regoff_t);
12028+ RETALLOC (regs->end, regs->num_regs, regoff_t);
12029+ if (regs->start == NULL || regs->end == NULL)
12030+ {
12031+ FREE_VARIABLES ();
12032+ return -2;
12033+ }
12034+ }
12035+ }
12036+ else
12037+ {
12038+ /* These braces fend off a "empty body in an else-statement"
12039+ warning under GCC when assert expands to nothing. */
12040+ assert (bufp->regs_allocated == REGS_FIXED);
12041+ }
12042+
12043+ /* Convert the pointer data in `regstart' and `regend' to
12044+ indices. Register zero has to be set differently,
12045+ since we haven't kept track of any info for it. */
12046+ if (regs->num_regs > 0)
12047+ {
12048+ regs->start[0] = pos;
12049+#ifdef WCHAR
12050+ if (MATCHING_IN_FIRST_STRING)
12051+ regs->end[0] = mbs_offset1 != NULL ?
12052+ mbs_offset1[d-string1] : 0;
12053+ else
12054+ regs->end[0] = csize1 + (mbs_offset2 != NULL ?
12055+ mbs_offset2[d-string2] : 0);
12056+#else
12057+ regs->end[0] = (MATCHING_IN_FIRST_STRING
12058+ ? ((regoff_t) (d - string1))
12059+ : ((regoff_t) (d - string2 + size1)));
12060+#endif /* WCHAR */
12061+ }
12062+
12063+ /* Go through the first `min (num_regs, regs->num_regs)'
12064+ registers, since that is all we initialized. */
12065+ for (mcnt = 1; (unsigned) mcnt < MIN (num_regs, regs->num_regs);
12066+ mcnt++)
12067+ {
12068+ if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt]))
12069+ regs->start[mcnt] = regs->end[mcnt] = -1;
12070+ else
12071+ {
12072+ regs->start[mcnt]
12073+ = (regoff_t) POINTER_TO_OFFSET (regstart[mcnt]);
12074+ regs->end[mcnt]
12075+ = (regoff_t) POINTER_TO_OFFSET (regend[mcnt]);
12076+ }
12077+ }
12078+
12079+ /* If the regs structure we return has more elements than
12080+ were in the pattern, set the extra elements to -1. If
12081+ we (re)allocated the registers, this is the case,
12082+ because we always allocate enough to have at least one
12083+ -1 at the end. */
12084+ for (mcnt = num_regs; (unsigned) mcnt < regs->num_regs; mcnt++)
12085+ regs->start[mcnt] = regs->end[mcnt] = -1;
12086+ } /* regs && !bufp->no_sub */
12087+
12088+ DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n",
12089+ nfailure_points_pushed, nfailure_points_popped,
12090+ nfailure_points_pushed - nfailure_points_popped);
12091+ DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed);
12092+
12093+#ifdef WCHAR
12094+ if (MATCHING_IN_FIRST_STRING)
12095+ mcnt = mbs_offset1 != NULL ? mbs_offset1[d-string1] : 0;
12096+ else
12097+ mcnt = (mbs_offset2 != NULL ? mbs_offset2[d-string2] : 0) +
12098+ csize1;
12099+ mcnt -= pos;
12100+#else
12101+ mcnt = d - pos - (MATCHING_IN_FIRST_STRING
12102+ ? string1
12103+ : string2 - size1);
12104+#endif /* WCHAR */
12105+
12106+ DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt);
12107+
12108+ FREE_VARIABLES ();
12109+ return mcnt;
12110+ }
12111+
12112+ /* Otherwise match next pattern command. */
12113+ switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++))
12114+ {
12115+ /* Ignore these. Used to ignore the n of succeed_n's which
12116+ currently have n == 0. */
12117+ case no_op:
12118+ DEBUG_PRINT1 ("EXECUTING no_op.\n");
12119+ break;
12120+
12121+ case succeed:
12122+ DEBUG_PRINT1 ("EXECUTING succeed.\n");
12123+ goto succeed_label;
12124+
12125+ /* Match the next n pattern characters exactly. The following
12126+ byte in the pattern defines n, and the n bytes after that
12127+ are the characters to match. */
12128+ case exactn:
12129+#ifdef MBS_SUPPORT
12130+ case exactn_bin:
12131+#endif
12132+ mcnt = *p++;
12133+ DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt);
12134+
12135+ /* This is written out as an if-else so we don't waste time
12136+ testing `translate' inside the loop. */
12137+ if (translate)
12138+ {
12139+ do
12140+ {
12141+ PREFETCH ();
12142+#ifdef WCHAR
12143+ if (*d <= 0xff)
12144+ {
12145+ if ((UCHAR_T) translate[(unsigned char) *d++]
12146+ != (UCHAR_T) *p++)
12147+ goto fail;
12148+ }
12149+ else
12150+ {
12151+ if (*d++ != (CHAR_T) *p++)
12152+ goto fail;
12153+ }
12154+#else
12155+ if ((UCHAR_T) translate[(unsigned char) *d++]
12156+ != (UCHAR_T) *p++)
12157+ goto fail;
12158+#endif /* WCHAR */
12159+ }
12160+ while (--mcnt);
12161+ }
12162+ else
12163+ {
12164+ do
12165+ {
12166+ PREFETCH ();
12167+ if (*d++ != (CHAR_T) *p++) goto fail;
12168+ }
12169+ while (--mcnt);
12170+ }
12171+ SET_REGS_MATCHED ();
12172+ break;
12173+
12174+
12175+ /* Match any character except possibly a newline or a null. */
12176+ case anychar:
12177+ DEBUG_PRINT1 ("EXECUTING anychar.\n");
12178+
12179+ PREFETCH ();
12180+
12181+ if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n')
12182+ || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000'))
12183+ goto fail;
12184+
12185+ SET_REGS_MATCHED ();
12186+ DEBUG_PRINT2 (" Matched `%ld'.\n", (long int) *d);
12187+ d++;
12188+ break;
12189+
12190+
12191+ case charset:
12192+ case charset_not:
12193+ {
12194+ register UCHAR_T c;
12195+#ifdef WCHAR
12196+ unsigned int i, char_class_length, coll_symbol_length,
12197+ equiv_class_length, ranges_length, chars_length, length;
12198+ CHAR_T *workp, *workp2, *charset_top;
12199+#define WORK_BUFFER_SIZE 128
12200+ CHAR_T str_buf[WORK_BUFFER_SIZE];
12201+# ifdef _LIBC
12202+ uint32_t nrules;
12203+# endif /* _LIBC */
12204+#endif /* WCHAR */
12205+ boolean negate = (re_opcode_t) *(p - 1) == charset_not;
12206+
12207+ DEBUG_PRINT2 ("EXECUTING charset%s.\n", negate ? "_not" : "");
12208+ PREFETCH ();
12209+ c = TRANSLATE (*d); /* The character to match. */
12210+#ifdef WCHAR
12211+# ifdef _LIBC
12212+ nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
12213+# endif /* _LIBC */
12214+ charset_top = p - 1;
12215+ char_class_length = *p++;
12216+ coll_symbol_length = *p++;
12217+ equiv_class_length = *p++;
12218+ ranges_length = *p++;
12219+ chars_length = *p++;
12220+ /* p points charset[6], so the address of the next instruction
12221+ (charset[l+m+n+2o+k+p']) equals p[l+m+n+2*o+p'],
12222+ where l=length of char_classes, m=length of collating_symbol,
12223+ n=equivalence_class, o=length of char_range,
12224+ p'=length of character. */
12225+ workp = p;
12226+ /* Update p to indicate the next instruction. */
12227+ p += char_class_length + coll_symbol_length+ equiv_class_length +
12228+ 2*ranges_length + chars_length;
12229+
12230+ /* match with char_class? */
12231+ for (i = 0; i < char_class_length ; i += CHAR_CLASS_SIZE)
12232+ {
12233+ wctype_t wctype;
12234+ uintptr_t alignedp = ((uintptr_t)workp
12235+ + __alignof__(wctype_t) - 1)
12236+ & ~(uintptr_t)(__alignof__(wctype_t) - 1);
12237+ wctype = *((wctype_t*)alignedp);
12238+ workp += CHAR_CLASS_SIZE;
12239+# ifdef _LIBC
12240+ if (__iswctype((wint_t)c, wctype))
12241+ goto char_set_matched;
12242+# else
12243+ if (iswctype((wint_t)c, wctype))
12244+ goto char_set_matched;
12245+# endif
12246+ }
12247+
12248+ /* match with collating_symbol? */
12249+# ifdef _LIBC
12250+ if (nrules != 0)
12251+ {
12252+ const unsigned char *extra = (const unsigned char *)
12253+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
12254+
12255+ for (workp2 = workp + coll_symbol_length ; workp < workp2 ;
12256+ workp++)
12257+ {
12258+ int32_t *wextra;
12259+ wextra = (int32_t*)(extra + *workp++);
12260+ for (i = 0; i < *wextra; ++i)
12261+ if (TRANSLATE(d[i]) != wextra[1 + i])
12262+ break;
12263+
12264+ if (i == *wextra)
12265+ {
12266+ /* Update d, however d will be incremented at
12267+ char_set_matched:, we decrement d here. */
12268+ d += i - 1;
12269+ goto char_set_matched;
12270+ }
12271+ }
12272+ }
12273+ else /* (nrules == 0) */
12274+# endif
12275+ /* If we can't look up collation data, we use wcscoll
12276+ instead. */
12277+ {
12278+ for (workp2 = workp + coll_symbol_length ; workp < workp2 ;)
12279+ {
12280+ const CHAR_T *backup_d = d, *backup_dend = dend;
12281+# ifdef _LIBC
12282+ length = __wcslen (workp);
12283+# else
12284+ length = wcslen (workp);
12285+# endif
12286+
12287+ /* If wcscoll(the collating symbol, whole string) > 0,
12288+ any substring of the string never match with the
12289+ collating symbol. */
12290+# ifdef _LIBC
12291+ if (__wcscoll (workp, d) > 0)
12292+# else
12293+ if (wcscoll (workp, d) > 0)
12294+# endif
12295+ {
12296+ workp += length + 1;
12297+ continue;
12298+ }
12299+
12300+ /* First, we compare the collating symbol with
12301+ the first character of the string.
12302+ If it don't match, we add the next character to
12303+ the compare buffer in turn. */
12304+ for (i = 0 ; i < WORK_BUFFER_SIZE-1 ; i++, d++)
12305+ {
12306+ int match;
12307+ if (d == dend)
12308+ {
12309+ if (dend == end_match_2)
12310+ break;
12311+ d = string2;
12312+ dend = end_match_2;
12313+ }
12314+
12315+ /* add next character to the compare buffer. */
12316+ str_buf[i] = TRANSLATE(*d);
12317+ str_buf[i+1] = '\0';
12318+
12319+# ifdef _LIBC
12320+ match = __wcscoll (workp, str_buf);
12321+# else
12322+ match = wcscoll (workp, str_buf);
12323+# endif
12324+ if (match == 0)
12325+ goto char_set_matched;
12326+
12327+ if (match < 0)
12328+ /* (str_buf > workp) indicate (str_buf + X > workp),
12329+ because for all X (str_buf + X > str_buf).
12330+ So we don't need continue this loop. */
12331+ break;
12332+
12333+ /* Otherwise(str_buf < workp),
12334+ (str_buf+next_character) may equals (workp).
12335+ So we continue this loop. */
12336+ }
12337+ /* not matched */
12338+ d = backup_d;
12339+ dend = backup_dend;
12340+ workp += length + 1;
12341+ }
12342+ }
12343+ /* match with equivalence_class? */
12344+# ifdef _LIBC
12345+ if (nrules != 0)
12346+ {
12347+ const CHAR_T *backup_d = d, *backup_dend = dend;
12348+ /* Try to match the equivalence class against
12349+ those known to the collate implementation. */
12350+ const int32_t *table;
12351+ const int32_t *weights;
12352+ const int32_t *extra;
12353+ const int32_t *indirect;
12354+ int32_t idx, idx2;
12355+ wint_t *cp;
12356+ size_t len;
12357+
12358+ /* This #include defines a local function! */
12359+# include <locale/weightwc.h>
12360+
12361+ table = (const int32_t *)
12362+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEWC);
12363+ weights = (const wint_t *)
12364+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTWC);
12365+ extra = (const wint_t *)
12366+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAWC);
12367+ indirect = (const int32_t *)
12368+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTWC);
12369+
12370+ /* Write 1 collating element to str_buf, and
12371+ get its index. */
12372+ idx2 = 0;
12373+
12374+ for (i = 0 ; idx2 == 0 && i < WORK_BUFFER_SIZE - 1; i++)
12375+ {
12376+ cp = (wint_t*)str_buf;
12377+ if (d == dend)
12378+ {
12379+ if (dend == end_match_2)
12380+ break;
12381+ d = string2;
12382+ dend = end_match_2;
12383+ }
12384+ str_buf[i] = TRANSLATE(*(d+i));
12385+ str_buf[i+1] = '\0'; /* sentinel */
12386+ idx2 = findidx ((const wint_t**)&cp, i);
12387+ }
12388+
12389+ /* Update d, however d will be incremented at
12390+ char_set_matched:, we decrement d here. */
12391+ d = backup_d + ((wchar_t*)cp - (wchar_t*)str_buf - 1);
12392+ if (d >= dend)
12393+ {
12394+ if (dend == end_match_2)
12395+ d = dend;
12396+ else
12397+ {
12398+ d = string2;
12399+ dend = end_match_2;
12400+ }
12401+ }
12402+
12403+ len = weights[idx2];
12404+
12405+ for (workp2 = workp + equiv_class_length ; workp < workp2 ;
12406+ workp++)
12407+ {
12408+ idx = (int32_t)*workp;
12409+ /* We already checked idx != 0 in regex_compile. */
12410+
12411+ if (idx2 != 0 && len == weights[idx])
12412+ {
12413+ int cnt = 0;
12414+ while (cnt < len && (weights[idx + 1 + cnt]
12415+ == weights[idx2 + 1 + cnt]))
12416+ ++cnt;
12417+
12418+ if (cnt == len)
12419+ goto char_set_matched;
12420+ }
12421+ }
12422+ /* not matched */
12423+ d = backup_d;
12424+ dend = backup_dend;
12425+ }
12426+ else /* (nrules == 0) */
12427+# endif
12428+ /* If we can't look up collation data, we use wcscoll
12429+ instead. */
12430+ {
12431+ for (workp2 = workp + equiv_class_length ; workp < workp2 ;)
12432+ {
12433+ const CHAR_T *backup_d = d, *backup_dend = dend;
12434+# ifdef _LIBC
12435+ length = __wcslen (workp);
12436+# else
12437+ length = wcslen (workp);
12438+# endif
12439+
12440+ /* If wcscoll(the collating symbol, whole string) > 0,
12441+ any substring of the string never match with the
12442+ collating symbol. */
12443+# ifdef _LIBC
12444+ if (__wcscoll (workp, d) > 0)
12445+# else
12446+ if (wcscoll (workp, d) > 0)
12447+# endif
12448+ {
12449+ workp += length + 1;
12450+ break;
12451+ }
12452+
12453+ /* First, we compare the equivalence class with
12454+ the first character of the string.
12455+ If it don't match, we add the next character to
12456+ the compare buffer in turn. */
12457+ for (i = 0 ; i < WORK_BUFFER_SIZE - 1 ; i++, d++)
12458+ {
12459+ int match;
12460+ if (d == dend)
12461+ {
12462+ if (dend == end_match_2)
12463+ break;
12464+ d = string2;
12465+ dend = end_match_2;
12466+ }
12467+
12468+ /* add next character to the compare buffer. */
12469+ str_buf[i] = TRANSLATE(*d);
12470+ str_buf[i+1] = '\0';
12471+
12472+# ifdef _LIBC
12473+ match = __wcscoll (workp, str_buf);
12474+# else
12475+ match = wcscoll (workp, str_buf);
12476+# endif
12477+
12478+ if (match == 0)
12479+ goto char_set_matched;
12480+
12481+ if (match < 0)
12482+ /* (str_buf > workp) indicate (str_buf + X > workp),
12483+ because for all X (str_buf + X > str_buf).
12484+ So we don't need continue this loop. */
12485+ break;
12486+
12487+ /* Otherwise(str_buf < workp),
12488+ (str_buf+next_character) may equals (workp).
12489+ So we continue this loop. */
12490+ }
12491+ /* not matched */
12492+ d = backup_d;
12493+ dend = backup_dend;
12494+ workp += length + 1;
12495+ }
12496+ }
12497+
12498+ /* match with char_range? */
12499+# ifdef _LIBC
12500+ if (nrules != 0)
12501+ {
12502+ uint32_t collseqval;
12503+ const char *collseq = (const char *)
12504+ _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQWC);
12505+
12506+ collseqval = collseq_table_lookup (collseq, c);
12507+
12508+ for (; workp < p - chars_length ;)
12509+ {
12510+ uint32_t start_val, end_val;
12511+
12512+ /* We already compute the collation sequence value
12513+ of the characters (or collating symbols). */
12514+ start_val = (uint32_t) *workp++; /* range_start */
12515+ end_val = (uint32_t) *workp++; /* range_end */
12516+
12517+ if (start_val <= collseqval && collseqval <= end_val)
12518+ goto char_set_matched;
12519+ }
12520+ }
12521+ else
12522+# endif
12523+ {
12524+ /* We set range_start_char at str_buf[0], range_end_char
12525+ at str_buf[4], and compared char at str_buf[2]. */
12526+ str_buf[1] = 0;
12527+ str_buf[2] = c;
12528+ str_buf[3] = 0;
12529+ str_buf[5] = 0;
12530+ for (; workp < p - chars_length ;)
12531+ {
12532+ wchar_t *range_start_char, *range_end_char;
12533+
12534+ /* match if (range_start_char <= c <= range_end_char). */
12535+
12536+ /* If range_start(or end) < 0, we assume -range_start(end)
12537+ is the offset of the collating symbol which is specified
12538+ as the character of the range start(end). */
12539+
12540+ /* range_start */
12541+ if (*workp < 0)
12542+ range_start_char = charset_top - (*workp++);
12543+ else
12544+ {
12545+ str_buf[0] = *workp++;
12546+ range_start_char = str_buf;
12547+ }
12548+
12549+ /* range_end */
12550+ if (*workp < 0)
12551+ range_end_char = charset_top - (*workp++);
12552+ else
12553+ {
12554+ str_buf[4] = *workp++;
12555+ range_end_char = str_buf + 4;
12556+ }
12557+
12558+# ifdef _LIBC
12559+ if (__wcscoll (range_start_char, str_buf+2) <= 0
12560+ && __wcscoll (str_buf+2, range_end_char) <= 0)
12561+# else
12562+ if (wcscoll (range_start_char, str_buf+2) <= 0
12563+ && wcscoll (str_buf+2, range_end_char) <= 0)
12564+# endif
12565+ goto char_set_matched;
12566+ }
12567+ }
12568+
12569+ /* match with char? */
12570+ for (; workp < p ; workp++)
12571+ if (c == *workp)
12572+ goto char_set_matched;
12573+
12574+ negate = !negate;
12575+
12576+ char_set_matched:
12577+ if (negate) goto fail;
12578+#else
12579+ /* Cast to `unsigned' instead of `unsigned char' in case the
12580+ bit list is a full 32 bytes long. */
12581+ if (c < (unsigned) (*p * BYTEWIDTH)
12582+ && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
12583+ negate = !negate;
12584+
12585+ p += 1 + *p;
12586+
12587+ if (!negate) goto fail;
12588+#undef WORK_BUFFER_SIZE
12589+#endif /* WCHAR */
12590+ SET_REGS_MATCHED ();
12591+ d++;
12592+ break;
12593+ }
12594+
12595+
12596+ /* The beginning of a group is represented by start_memory.
12597+ The arguments are the register number in the next byte, and the
12598+ number of groups inner to this one in the next. The text
12599+ matched within the group is recorded (in the internal
12600+ registers data structure) under the register number. */
12601+ case start_memory:
12602+ DEBUG_PRINT3 ("EXECUTING start_memory %ld (%ld):\n",
12603+ (long int) *p, (long int) p[1]);
12604+
12605+ /* Find out if this group can match the empty string. */
12606+ p1 = p; /* To send to group_match_null_string_p. */
12607+
12608+ if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE)
12609+ REG_MATCH_NULL_STRING_P (reg_info[*p])
12610+ = PREFIX(group_match_null_string_p) (&p1, pend, reg_info);
12611+
12612+ /* Save the position in the string where we were the last time
12613+ we were at this open-group operator in case the group is
12614+ operated upon by a repetition operator, e.g., with `(a*)*b'
12615+ against `ab'; then we want to ignore where we are now in
12616+ the string in case this attempt to match fails. */
12617+ old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
12618+ ? REG_UNSET (regstart[*p]) ? d : regstart[*p]
12619+ : regstart[*p];
12620+ DEBUG_PRINT2 (" old_regstart: %d\n",
12621+ POINTER_TO_OFFSET (old_regstart[*p]));
12622+
12623+ regstart[*p] = d;
12624+ DEBUG_PRINT2 (" regstart: %d\n", POINTER_TO_OFFSET (regstart[*p]));
12625+
12626+ IS_ACTIVE (reg_info[*p]) = 1;
12627+ MATCHED_SOMETHING (reg_info[*p]) = 0;
12628+
12629+ /* Clear this whenever we change the register activity status. */
12630+ set_regs_matched_done = 0;
12631+
12632+ /* This is the new highest active register. */
12633+ highest_active_reg = *p;
12634+
12635+ /* If nothing was active before, this is the new lowest active
12636+ register. */
12637+ if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
12638+ lowest_active_reg = *p;
12639+
12640+ /* Move past the register number and inner group count. */
12641+ p += 2;
12642+ just_past_start_mem = p;
12643+
12644+ break;
12645+
12646+
12647+ /* The stop_memory opcode represents the end of a group. Its
12648+ arguments are the same as start_memory's: the register
12649+ number, and the number of inner groups. */
12650+ case stop_memory:
12651+ DEBUG_PRINT3 ("EXECUTING stop_memory %ld (%ld):\n",
12652+ (long int) *p, (long int) p[1]);
12653+
12654+ /* We need to save the string position the last time we were at
12655+ this close-group operator in case the group is operated
12656+ upon by a repetition operator, e.g., with `((a*)*(b*)*)*'
12657+ against `aba'; then we want to ignore where we are now in
12658+ the string in case this attempt to match fails. */
12659+ old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
12660+ ? REG_UNSET (regend[*p]) ? d : regend[*p]
12661+ : regend[*p];
12662+ DEBUG_PRINT2 (" old_regend: %d\n",
12663+ POINTER_TO_OFFSET (old_regend[*p]));
12664+
12665+ regend[*p] = d;
12666+ DEBUG_PRINT2 (" regend: %d\n", POINTER_TO_OFFSET (regend[*p]));
12667+
12668+ /* This register isn't active anymore. */
12669+ IS_ACTIVE (reg_info[*p]) = 0;
12670+
12671+ /* Clear this whenever we change the register activity status. */
12672+ set_regs_matched_done = 0;
12673+
12674+ /* If this was the only register active, nothing is active
12675+ anymore. */
12676+ if (lowest_active_reg == highest_active_reg)
12677+ {
12678+ lowest_active_reg = NO_LOWEST_ACTIVE_REG;
12679+ highest_active_reg = NO_HIGHEST_ACTIVE_REG;
12680+ }
12681+ else
12682+ { /* We must scan for the new highest active register, since
12683+ it isn't necessarily one less than now: consider
12684+ (a(b)c(d(e)f)g). When group 3 ends, after the f), the
12685+ new highest active register is 1. */
12686+ UCHAR_T r = *p - 1;
12687+ while (r > 0 && !IS_ACTIVE (reg_info[r]))
12688+ r--;
12689+
12690+ /* If we end up at register zero, that means that we saved
12691+ the registers as the result of an `on_failure_jump', not
12692+ a `start_memory', and we jumped to past the innermost
12693+ `stop_memory'. For example, in ((.)*) we save
12694+ registers 1 and 2 as a result of the *, but when we pop
12695+ back to the second ), we are at the stop_memory 1.
12696+ Thus, nothing is active. */
12697+ if (r == 0)
12698+ {
12699+ lowest_active_reg = NO_LOWEST_ACTIVE_REG;
12700+ highest_active_reg = NO_HIGHEST_ACTIVE_REG;
12701+ }
12702+ else
12703+ highest_active_reg = r;
12704+ }
12705+
12706+ /* If just failed to match something this time around with a
12707+ group that's operated on by a repetition operator, try to
12708+ force exit from the ``loop'', and restore the register
12709+ information for this group that we had before trying this
12710+ last match. */
12711+ if ((!MATCHED_SOMETHING (reg_info[*p])
12712+ || just_past_start_mem == p - 1)
12713+ && (p + 2) < pend)
12714+ {
12715+ boolean is_a_jump_n = false;
12716+
12717+ p1 = p + 2;
12718+ mcnt = 0;
12719+ switch ((re_opcode_t) *p1++)
12720+ {
12721+ case jump_n:
12722+ is_a_jump_n = true;
12723+ case pop_failure_jump:
12724+ case maybe_pop_jump:
12725+ case jump:
12726+ case dummy_failure_jump:
12727+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
12728+ if (is_a_jump_n)
12729+ p1 += OFFSET_ADDRESS_SIZE;
12730+ break;
12731+
12732+ default:
12733+ /* do nothing */ ;
12734+ }
12735+ p1 += mcnt;
12736+
12737+ /* If the next operation is a jump backwards in the pattern
12738+ to an on_failure_jump right before the start_memory
12739+ corresponding to this stop_memory, exit from the loop
12740+ by forcing a failure after pushing on the stack the
12741+ on_failure_jump's jump in the pattern, and d. */
12742+ if (mcnt < 0 && (re_opcode_t) *p1 == on_failure_jump
12743+ && (re_opcode_t) p1[1+OFFSET_ADDRESS_SIZE] == start_memory
12744+ && p1[2+OFFSET_ADDRESS_SIZE] == *p)
12745+ {
12746+ /* If this group ever matched anything, then restore
12747+ what its registers were before trying this last
12748+ failed match, e.g., with `(a*)*b' against `ab' for
12749+ regstart[1], and, e.g., with `((a*)*(b*)*)*'
12750+ against `aba' for regend[3].
12751+
12752+ Also restore the registers for inner groups for,
12753+ e.g., `((a*)(b*))*' against `aba' (register 3 would
12754+ otherwise get trashed). */
12755+
12756+ if (EVER_MATCHED_SOMETHING (reg_info[*p]))
12757+ {
12758+ unsigned r;
12759+
12760+ EVER_MATCHED_SOMETHING (reg_info[*p]) = 0;
12761+
12762+ /* Restore this and inner groups' (if any) registers. */
12763+ for (r = *p; r < (unsigned) *p + (unsigned) *(p + 1);
12764+ r++)
12765+ {
12766+ regstart[r] = old_regstart[r];
12767+
12768+ /* xx why this test? */
12769+ if (old_regend[r] >= regstart[r])
12770+ regend[r] = old_regend[r];
12771+ }
12772+ }
12773+ p1++;
12774+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
12775+ PUSH_FAILURE_POINT (p1 + mcnt, d, -2);
12776+
12777+ goto fail;
12778+ }
12779+ }
12780+
12781+ /* Move past the register number and the inner group count. */
12782+ p += 2;
12783+ break;
12784+
12785+
12786+ /* \<digit> has been turned into a `duplicate' command which is
12787+ followed by the numeric value of <digit> as the register number. */
12788+ case duplicate:
12789+ {
12790+ register const CHAR_T *d2, *dend2;
12791+ int regno = *p++; /* Get which register to match against. */
12792+ DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno);
12793+
12794+ /* Can't back reference a group which we've never matched. */
12795+ if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno]))
12796+ goto fail;
12797+
12798+ /* Where in input to try to start matching. */
12799+ d2 = regstart[regno];
12800+
12801+ /* Where to stop matching; if both the place to start and
12802+ the place to stop matching are in the same string, then
12803+ set to the place to stop, otherwise, for now have to use
12804+ the end of the first string. */
12805+
12806+ dend2 = ((FIRST_STRING_P (regstart[regno])
12807+ == FIRST_STRING_P (regend[regno]))
12808+ ? regend[regno] : end_match_1);
12809+ for (;;)
12810+ {
12811+ /* If necessary, advance to next segment in register
12812+ contents. */
12813+ while (d2 == dend2)
12814+ {
12815+ if (dend2 == end_match_2) break;
12816+ if (dend2 == regend[regno]) break;
12817+
12818+ /* End of string1 => advance to string2. */
12819+ d2 = string2;
12820+ dend2 = regend[regno];
12821+ }
12822+ /* At end of register contents => success */
12823+ if (d2 == dend2) break;
12824+
12825+ /* If necessary, advance to next segment in data. */
12826+ PREFETCH ();
12827+
12828+ /* How many characters left in this segment to match. */
12829+ mcnt = dend - d;
12830+
12831+ /* Want how many consecutive characters we can match in
12832+ one shot, so, if necessary, adjust the count. */
12833+ if (mcnt > dend2 - d2)
12834+ mcnt = dend2 - d2;
12835+
12836+ /* Compare that many; failure if mismatch, else move
12837+ past them. */
12838+ if (translate
12839+ ? PREFIX(bcmp_translate) (d, d2, mcnt, translate)
12840+ : memcmp (d, d2, mcnt*sizeof(UCHAR_T)))
12841+ goto fail;
12842+ d += mcnt, d2 += mcnt;
12843+
12844+ /* Do this because we've match some characters. */
12845+ SET_REGS_MATCHED ();
12846+ }
12847+ }
12848+ break;
12849+
12850+
12851+ /* begline matches the empty string at the beginning of the string
12852+ (unless `not_bol' is set in `bufp'), and, if
12853+ `newline_anchor' is set, after newlines. */
12854+ case begline:
12855+ DEBUG_PRINT1 ("EXECUTING begline.\n");
12856+
12857+ if (AT_STRINGS_BEG (d))
12858+ {
12859+ if (!bufp->not_bol) break;
12860+ }
12861+ else if (d[-1] == '\n' && bufp->newline_anchor)
12862+ {
12863+ break;
12864+ }
12865+ /* In all other cases, we fail. */
12866+ goto fail;
12867+
12868+
12869+ /* endline is the dual of begline. */
12870+ case endline:
12871+ DEBUG_PRINT1 ("EXECUTING endline.\n");
12872+
12873+ if (AT_STRINGS_END (d))
12874+ {
12875+ if (!bufp->not_eol) break;
12876+ }
12877+
12878+ /* We have to ``prefetch'' the next character. */
12879+ else if ((d == end1 ? *string2 : *d) == '\n'
12880+ && bufp->newline_anchor)
12881+ {
12882+ break;
12883+ }
12884+ goto fail;
12885+
12886+
12887+ /* Match at the very beginning of the data. */
12888+ case begbuf:
12889+ DEBUG_PRINT1 ("EXECUTING begbuf.\n");
12890+ if (AT_STRINGS_BEG (d))
12891+ break;
12892+ goto fail;
12893+
12894+
12895+ /* Match at the very end of the data. */
12896+ case endbuf:
12897+ DEBUG_PRINT1 ("EXECUTING endbuf.\n");
12898+ if (AT_STRINGS_END (d))
12899+ break;
12900+ goto fail;
12901+
12902+
12903+ /* on_failure_keep_string_jump is used to optimize `.*\n'. It
12904+ pushes NULL as the value for the string on the stack. Then
12905+ `pop_failure_point' will keep the current value for the
12906+ string, instead of restoring it. To see why, consider
12907+ matching `foo\nbar' against `.*\n'. The .* matches the foo;
12908+ then the . fails against the \n. But the next thing we want
12909+ to do is match the \n against the \n; if we restored the
12910+ string value, we would be back at the foo.
12911+
12912+ Because this is used only in specific cases, we don't need to
12913+ check all the things that `on_failure_jump' does, to make
12914+ sure the right things get saved on the stack. Hence we don't
12915+ share its code. The only reason to push anything on the
12916+ stack at all is that otherwise we would have to change
12917+ `anychar's code to do something besides goto fail in this
12918+ case; that seems worse than this. */
12919+ case on_failure_keep_string_jump:
12920+ DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump");
12921+
12922+ EXTRACT_NUMBER_AND_INCR (mcnt, p);
12923+#ifdef _LIBC
12924+ DEBUG_PRINT3 (" %d (to %p):\n", mcnt, p + mcnt);
12925+#else
12926+ DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt);
12927+#endif
12928+
12929+ PUSH_FAILURE_POINT (p + mcnt, NULL, -2);
12930+ break;
12931+
12932+
12933+ /* Uses of on_failure_jump:
12934+
12935+ Each alternative starts with an on_failure_jump that points
12936+ to the beginning of the next alternative. Each alternative
12937+ except the last ends with a jump that in effect jumps past
12938+ the rest of the alternatives. (They really jump to the
12939+ ending jump of the following alternative, because tensioning
12940+ these jumps is a hassle.)
12941+
12942+ Repeats start with an on_failure_jump that points past both
12943+ the repetition text and either the following jump or
12944+ pop_failure_jump back to this on_failure_jump. */
12945+ case on_failure_jump:
12946+ on_failure:
12947+ DEBUG_PRINT1 ("EXECUTING on_failure_jump");
12948+
12949+ EXTRACT_NUMBER_AND_INCR (mcnt, p);
12950+#ifdef _LIBC
12951+ DEBUG_PRINT3 (" %d (to %p)", mcnt, p + mcnt);
12952+#else
12953+ DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt);
12954+#endif
12955+
12956+ /* If this on_failure_jump comes right before a group (i.e.,
12957+ the original * applied to a group), save the information
12958+ for that group and all inner ones, so that if we fail back
12959+ to this point, the group's information will be correct.
12960+ For example, in \(a*\)*\1, we need the preceding group,
12961+ and in \(zz\(a*\)b*\)\2, we need the inner group. */
12962+
12963+ /* We can't use `p' to check ahead because we push
12964+ a failure point to `p + mcnt' after we do this. */
12965+ p1 = p;
12966+
12967+ /* We need to skip no_op's before we look for the
12968+ start_memory in case this on_failure_jump is happening as
12969+ the result of a completed succeed_n, as in \(a\)\{1,3\}b\1
12970+ against aba. */
12971+ while (p1 < pend && (re_opcode_t) *p1 == no_op)
12972+ p1++;
12973+
12974+ if (p1 < pend && (re_opcode_t) *p1 == start_memory)
12975+ {
12976+ /* We have a new highest active register now. This will
12977+ get reset at the start_memory we are about to get to,
12978+ but we will have saved all the registers relevant to
12979+ this repetition op, as described above. */
12980+ highest_active_reg = *(p1 + 1) + *(p1 + 2);
12981+ if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
12982+ lowest_active_reg = *(p1 + 1);
12983+ }
12984+
12985+ DEBUG_PRINT1 (":\n");
12986+ PUSH_FAILURE_POINT (p + mcnt, d, -2);
12987+ break;
12988+
12989+
12990+ /* A smart repeat ends with `maybe_pop_jump'.
12991+ We change it to either `pop_failure_jump' or `jump'. */
12992+ case maybe_pop_jump:
12993+ EXTRACT_NUMBER_AND_INCR (mcnt, p);
12994+ DEBUG_PRINT2 ("EXECUTING maybe_pop_jump %d.\n", mcnt);
12995+ {
12996+ register UCHAR_T *p2 = p;
12997+
12998+ /* Compare the beginning of the repeat with what in the
12999+ pattern follows its end. If we can establish that there
13000+ is nothing that they would both match, i.e., that we
13001+ would have to backtrack because of (as in, e.g., `a*a')
13002+ then we can change to pop_failure_jump, because we'll
13003+ never have to backtrack.
13004+
13005+ This is not true in the case of alternatives: in
13006+ `(a|ab)*' we do need to backtrack to the `ab' alternative
13007+ (e.g., if the string was `ab'). But instead of trying to
13008+ detect that here, the alternative has put on a dummy
13009+ failure point which is what we will end up popping. */
13010+
13011+ /* Skip over open/close-group commands.
13012+ If what follows this loop is a ...+ construct,
13013+ look at what begins its body, since we will have to
13014+ match at least one of that. */
13015+ while (1)
13016+ {
13017+ if (p2 + 2 < pend
13018+ && ((re_opcode_t) *p2 == stop_memory
13019+ || (re_opcode_t) *p2 == start_memory))
13020+ p2 += 3;
13021+ else if (p2 + 2 + 2 * OFFSET_ADDRESS_SIZE < pend
13022+ && (re_opcode_t) *p2 == dummy_failure_jump)
13023+ p2 += 2 + 2 * OFFSET_ADDRESS_SIZE;
13024+ else
13025+ break;
13026+ }
13027+
13028+ p1 = p + mcnt;
13029+ /* p1[0] ... p1[2] are the `on_failure_jump' corresponding
13030+ to the `maybe_finalize_jump' of this case. Examine what
13031+ follows. */
13032+
13033+ /* If we're at the end of the pattern, we can change. */
13034+ if (p2 == pend)
13035+ {
13036+ /* Consider what happens when matching ":\(.*\)"
13037+ against ":/". I don't really understand this code
13038+ yet. */
13039+ p[-(1+OFFSET_ADDRESS_SIZE)] = (UCHAR_T)
13040+ pop_failure_jump;
13041+ DEBUG_PRINT1
13042+ (" End of pattern: change to `pop_failure_jump'.\n");
13043+ }
13044+
13045+ else if ((re_opcode_t) *p2 == exactn
13046+#ifdef MBS_SUPPORT
13047+ || (re_opcode_t) *p2 == exactn_bin
13048+#endif
13049+ || (bufp->newline_anchor && (re_opcode_t) *p2 == endline))
13050+ {
13051+ register UCHAR_T c
13052+ = *p2 == (UCHAR_T) endline ? '\n' : p2[2];
13053+
13054+ if (((re_opcode_t) p1[1+OFFSET_ADDRESS_SIZE] == exactn
13055+#ifdef MBS_SUPPORT
13056+ || (re_opcode_t) p1[1+OFFSET_ADDRESS_SIZE] == exactn_bin
13057+#endif
13058+ ) && p1[3+OFFSET_ADDRESS_SIZE] != c)
13059+ {
13060+ p[-(1+OFFSET_ADDRESS_SIZE)] = (UCHAR_T)
13061+ pop_failure_jump;
13062+#ifdef WCHAR
13063+ DEBUG_PRINT3 (" %C != %C => pop_failure_jump.\n",
13064+ (wint_t) c,
13065+ (wint_t) p1[3+OFFSET_ADDRESS_SIZE]);
13066+#else
13067+ DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n",
13068+ (char) c,
13069+ (char) p1[3+OFFSET_ADDRESS_SIZE]);
13070+#endif
13071+ }
13072+
13073+#ifndef WCHAR
13074+ else if ((re_opcode_t) p1[3] == charset
13075+ || (re_opcode_t) p1[3] == charset_not)
13076+ {
13077+ int negate = (re_opcode_t) p1[3] == charset_not;
13078+
13079+ if (c < (unsigned) (p1[4] * BYTEWIDTH)
13080+ && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
13081+ negate = !negate;
13082+
13083+ /* `negate' is equal to 1 if c would match, which means
13084+ that we can't change to pop_failure_jump. */
13085+ if (!negate)
13086+ {
13087+ p[-3] = (unsigned char) pop_failure_jump;
13088+ DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
13089+ }
13090+ }
13091+#endif /* not WCHAR */
13092+ }
13093+#ifndef WCHAR
13094+ else if ((re_opcode_t) *p2 == charset)
13095+ {
13096+ /* We win if the first character of the loop is not part
13097+ of the charset. */
13098+ if ((re_opcode_t) p1[3] == exactn
13099+ && ! ((int) p2[1] * BYTEWIDTH > (int) p1[5]
13100+ && (p2[2 + p1[5] / BYTEWIDTH]
13101+ & (1 << (p1[5] % BYTEWIDTH)))))
13102+ {
13103+ p[-3] = (unsigned char) pop_failure_jump;
13104+ DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
13105+ }
13106+
13107+ else if ((re_opcode_t) p1[3] == charset_not)
13108+ {
13109+ int idx;
13110+ /* We win if the charset_not inside the loop
13111+ lists every character listed in the charset after. */
13112+ for (idx = 0; idx < (int) p2[1]; idx++)
13113+ if (! (p2[2 + idx] == 0
13114+ || (idx < (int) p1[4]
13115+ && ((p2[2 + idx] & ~ p1[5 + idx]) == 0))))
13116+ break;
13117+
13118+ if (idx == p2[1])
13119+ {
13120+ p[-3] = (unsigned char) pop_failure_jump;
13121+ DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
13122+ }
13123+ }
13124+ else if ((re_opcode_t) p1[3] == charset)
13125+ {
13126+ int idx;
13127+ /* We win if the charset inside the loop
13128+ has no overlap with the one after the loop. */
13129+ for (idx = 0;
13130+ idx < (int) p2[1] && idx < (int) p1[4];
13131+ idx++)
13132+ if ((p2[2 + idx] & p1[5 + idx]) != 0)
13133+ break;
13134+
13135+ if (idx == p2[1] || idx == p1[4])
13136+ {
13137+ p[-3] = (unsigned char) pop_failure_jump;
13138+ DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
13139+ }
13140+ }
13141+ }
13142+#endif /* not WCHAR */
13143+ }
13144+ p -= OFFSET_ADDRESS_SIZE; /* Point at relative address again. */
13145+ if ((re_opcode_t) p[-1] != pop_failure_jump)
13146+ {
13147+ p[-1] = (UCHAR_T) jump;
13148+ DEBUG_PRINT1 (" Match => jump.\n");
13149+ goto unconditional_jump;
13150+ }
13151+ /* Note fall through. */
13152+
13153+
13154+ /* The end of a simple repeat has a pop_failure_jump back to
13155+ its matching on_failure_jump, where the latter will push a
13156+ failure point. The pop_failure_jump takes off failure
13157+ points put on by this pop_failure_jump's matching
13158+ on_failure_jump; we got through the pattern to here from the
13159+ matching on_failure_jump, so didn't fail. */
13160+ case pop_failure_jump:
13161+ {
13162+ /* We need to pass separate storage for the lowest and
13163+ highest registers, even though we don't care about the
13164+ actual values. Otherwise, we will restore only one
13165+ register from the stack, since lowest will == highest in
13166+ `pop_failure_point'. */
13167+ active_reg_t dummy_low_reg, dummy_high_reg;
13168+ UCHAR_T *pdummy = NULL;
13169+ const CHAR_T *sdummy = NULL;
13170+
13171+ DEBUG_PRINT1 ("EXECUTING pop_failure_jump.\n");
13172+ POP_FAILURE_POINT (sdummy, pdummy,
13173+ dummy_low_reg, dummy_high_reg,
13174+ reg_dummy, reg_dummy, reg_info_dummy);
13175+ }
13176+ /* Note fall through. */
13177+
13178+ unconditional_jump:
13179+#ifdef _LIBC
13180+ DEBUG_PRINT2 ("\n%p: ", p);
13181+#else
13182+ DEBUG_PRINT2 ("\n0x%x: ", p);
13183+#endif
13184+ /* Note fall through. */
13185+
13186+ /* Unconditionally jump (without popping any failure points). */
13187+ case jump:
13188+ EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */
13189+ DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt);
13190+ p += mcnt; /* Do the jump. */
13191+#ifdef _LIBC
13192+ DEBUG_PRINT2 ("(to %p).\n", p);
13193+#else
13194+ DEBUG_PRINT2 ("(to 0x%x).\n", p);
13195+#endif
13196+ break;
13197+
13198+
13199+ /* We need this opcode so we can detect where alternatives end
13200+ in `group_match_null_string_p' et al. */
13201+ case jump_past_alt:
13202+ DEBUG_PRINT1 ("EXECUTING jump_past_alt.\n");
13203+ goto unconditional_jump;
13204+
13205+
13206+ /* Normally, the on_failure_jump pushes a failure point, which
13207+ then gets popped at pop_failure_jump. We will end up at
13208+ pop_failure_jump, also, and with a pattern of, say, `a+', we
13209+ are skipping over the on_failure_jump, so we have to push
13210+ something meaningless for pop_failure_jump to pop. */
13211+ case dummy_failure_jump:
13212+ DEBUG_PRINT1 ("EXECUTING dummy_failure_jump.\n");
13213+ /* It doesn't matter what we push for the string here. What
13214+ the code at `fail' tests is the value for the pattern. */
13215+ PUSH_FAILURE_POINT (NULL, NULL, -2);
13216+ goto unconditional_jump;
13217+
13218+
13219+ /* At the end of an alternative, we need to push a dummy failure
13220+ point in case we are followed by a `pop_failure_jump', because
13221+ we don't want the failure point for the alternative to be
13222+ popped. For example, matching `(a|ab)*' against `aab'
13223+ requires that we match the `ab' alternative. */
13224+ case push_dummy_failure:
13225+ DEBUG_PRINT1 ("EXECUTING push_dummy_failure.\n");
13226+ /* See comments just above at `dummy_failure_jump' about the
13227+ two zeroes. */
13228+ PUSH_FAILURE_POINT (NULL, NULL, -2);
13229+ break;
13230+
13231+ /* Have to succeed matching what follows at least n times.
13232+ After that, handle like `on_failure_jump'. */
13233+ case succeed_n:
13234+ EXTRACT_NUMBER (mcnt, p + OFFSET_ADDRESS_SIZE);
13235+ DEBUG_PRINT2 ("EXECUTING succeed_n %d.\n", mcnt);
13236+
13237+ assert (mcnt >= 0);
13238+ /* Originally, this is how many times we HAVE to succeed. */
13239+ if (mcnt > 0)
13240+ {
13241+ mcnt--;
13242+ p += OFFSET_ADDRESS_SIZE;
13243+ STORE_NUMBER_AND_INCR (p, mcnt);
13244+#ifdef _LIBC
13245+ DEBUG_PRINT3 (" Setting %p to %d.\n", p - OFFSET_ADDRESS_SIZE
13246+ , mcnt);
13247+#else
13248+ DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p - OFFSET_ADDRESS_SIZE
13249+ , mcnt);
13250+#endif
13251+ }
13252+ else if (mcnt == 0)
13253+ {
13254+#ifdef _LIBC
13255+ DEBUG_PRINT2 (" Setting two bytes from %p to no_op.\n",
13256+ p + OFFSET_ADDRESS_SIZE);
13257+#else
13258+ DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n",
13259+ p + OFFSET_ADDRESS_SIZE);
13260+#endif /* _LIBC */
13261+
13262+#ifdef WCHAR
13263+ p[1] = (UCHAR_T) no_op;
13264+#else
13265+ p[2] = (UCHAR_T) no_op;
13266+ p[3] = (UCHAR_T) no_op;
13267+#endif /* WCHAR */
13268+ goto on_failure;
13269+ }
13270+ break;
13271+
13272+ case jump_n:
13273+ EXTRACT_NUMBER (mcnt, p + OFFSET_ADDRESS_SIZE);
13274+ DEBUG_PRINT2 ("EXECUTING jump_n %d.\n", mcnt);
13275+
13276+ /* Originally, this is how many times we CAN jump. */
13277+ if (mcnt)
13278+ {
13279+ mcnt--;
13280+ STORE_NUMBER (p + OFFSET_ADDRESS_SIZE, mcnt);
13281+
13282+#ifdef _LIBC
13283+ DEBUG_PRINT3 (" Setting %p to %d.\n", p + OFFSET_ADDRESS_SIZE,
13284+ mcnt);
13285+#else
13286+ DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p + OFFSET_ADDRESS_SIZE,
13287+ mcnt);
13288+#endif /* _LIBC */
13289+ goto unconditional_jump;
13290+ }
13291+ /* If don't have to jump any more, skip over the rest of command. */
13292+ else
13293+ p += 2 * OFFSET_ADDRESS_SIZE;
13294+ break;
13295+
13296+ case set_number_at:
13297+ {
13298+ DEBUG_PRINT1 ("EXECUTING set_number_at.\n");
13299+
13300+ EXTRACT_NUMBER_AND_INCR (mcnt, p);
13301+ p1 = p + mcnt;
13302+ EXTRACT_NUMBER_AND_INCR (mcnt, p);
13303+#ifdef _LIBC
13304+ DEBUG_PRINT3 (" Setting %p to %d.\n", p1, mcnt);
13305+#else
13306+ DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt);
13307+#endif
13308+ STORE_NUMBER (p1, mcnt);
13309+ break;
13310+ }
13311+
13312+#if 0
13313+ /* The DEC Alpha C compiler 3.x generates incorrect code for the
13314+ test WORDCHAR_P (d - 1) != WORDCHAR_P (d) in the expansion of
13315+ AT_WORD_BOUNDARY, so this code is disabled. Expanding the
13316+ macro and introducing temporary variables works around the bug. */
13317+
13318+ case wordbound:
13319+ DEBUG_PRINT1 ("EXECUTING wordbound.\n");
13320+ if (AT_WORD_BOUNDARY (d))
13321+ break;
13322+ goto fail;
13323+
13324+ case notwordbound:
13325+ DEBUG_PRINT1 ("EXECUTING notwordbound.\n");
13326+ if (AT_WORD_BOUNDARY (d))
13327+ goto fail;
13328+ break;
13329+#else
13330+ case wordbound:
13331+ {
13332+ boolean prevchar, thischar;
13333+
13334+ DEBUG_PRINT1 ("EXECUTING wordbound.\n");
13335+ if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d))
13336+ break;
13337+
13338+ prevchar = WORDCHAR_P (d - 1);
13339+ thischar = WORDCHAR_P (d);
13340+ if (prevchar != thischar)
13341+ break;
13342+ goto fail;
13343+ }
13344+
13345+ case notwordbound:
13346+ {
13347+ boolean prevchar, thischar;
13348+
13349+ DEBUG_PRINT1 ("EXECUTING notwordbound.\n");
13350+ if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d))
13351+ goto fail;
13352+
13353+ prevchar = WORDCHAR_P (d - 1);
13354+ thischar = WORDCHAR_P (d);
13355+ if (prevchar != thischar)
13356+ goto fail;
13357+ break;
13358+ }
13359+#endif
13360+
13361+ case wordbeg:
13362+ DEBUG_PRINT1 ("EXECUTING wordbeg.\n");
13363+ if (!AT_STRINGS_END (d) && WORDCHAR_P (d)
13364+ && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1)))
13365+ break;
13366+ goto fail;
13367+
13368+ case wordend:
13369+ DEBUG_PRINT1 ("EXECUTING wordend.\n");
13370+ if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1)
13371+ && (AT_STRINGS_END (d) || !WORDCHAR_P (d)))
13372+ break;
13373+ goto fail;
13374+
13375+#ifdef emacs
13376+ case before_dot:
13377+ DEBUG_PRINT1 ("EXECUTING before_dot.\n");
13378+ if (PTR_CHAR_POS ((unsigned char *) d) >= point)
13379+ goto fail;
13380+ break;
13381+
13382+ case at_dot:
13383+ DEBUG_PRINT1 ("EXECUTING at_dot.\n");
13384+ if (PTR_CHAR_POS ((unsigned char *) d) != point)
13385+ goto fail;
13386+ break;
13387+
13388+ case after_dot:
13389+ DEBUG_PRINT1 ("EXECUTING after_dot.\n");
13390+ if (PTR_CHAR_POS ((unsigned char *) d) <= point)
13391+ goto fail;
13392+ break;
13393+
13394+ case syntaxspec:
13395+ DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt);
13396+ mcnt = *p++;
13397+ goto matchsyntax;
13398+
13399+ case wordchar:
13400+ DEBUG_PRINT1 ("EXECUTING Emacs wordchar.\n");
13401+ mcnt = (int) Sword;
13402+ matchsyntax:
13403+ PREFETCH ();
13404+ /* Can't use *d++ here; SYNTAX may be an unsafe macro. */
13405+ d++;
13406+ if (SYNTAX (d[-1]) != (enum syntaxcode) mcnt)
13407+ goto fail;
13408+ SET_REGS_MATCHED ();
13409+ break;
13410+
13411+ case notsyntaxspec:
13412+ DEBUG_PRINT2 ("EXECUTING notsyntaxspec %d.\n", mcnt);
13413+ mcnt = *p++;
13414+ goto matchnotsyntax;
13415+
13416+ case notwordchar:
13417+ DEBUG_PRINT1 ("EXECUTING Emacs notwordchar.\n");
13418+ mcnt = (int) Sword;
13419+ matchnotsyntax:
13420+ PREFETCH ();
13421+ /* Can't use *d++ here; SYNTAX may be an unsafe macro. */
13422+ d++;
13423+ if (SYNTAX (d[-1]) == (enum syntaxcode) mcnt)
13424+ goto fail;
13425+ SET_REGS_MATCHED ();
13426+ break;
13427+
13428+#else /* not emacs */
13429+ case wordchar:
13430+ DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n");
13431+ PREFETCH ();
13432+ if (!WORDCHAR_P (d))
13433+ goto fail;
13434+ SET_REGS_MATCHED ();
13435+ d++;
13436+ break;
13437+
13438+ case notwordchar:
13439+ DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n");
13440+ PREFETCH ();
13441+ if (WORDCHAR_P (d))
13442+ goto fail;
13443+ SET_REGS_MATCHED ();
13444+ d++;
13445+ break;
13446+#endif /* not emacs */
13447+
13448+ default:
13449+ abort ();
13450+ }
13451+ continue; /* Successfully executed one pattern command; keep going. */
13452+
13453+
13454+ /* We goto here if a matching operation fails. */
13455+ fail:
13456+ if (!FAIL_STACK_EMPTY ())
13457+ { /* A restart point is known. Restore to that state. */
13458+ DEBUG_PRINT1 ("\nFAIL:\n");
13459+ POP_FAILURE_POINT (d, p,
13460+ lowest_active_reg, highest_active_reg,
13461+ regstart, regend, reg_info);
13462+
13463+ /* If this failure point is a dummy, try the next one. */
13464+ if (!p)
13465+ goto fail;
13466+
13467+ /* If we failed to the end of the pattern, don't examine *p. */
13468+ assert (p <= pend);
13469+ if (p < pend)
13470+ {
13471+ boolean is_a_jump_n = false;
13472+
13473+ /* If failed to a backwards jump that's part of a repetition
13474+ loop, need to pop this failure point and use the next one. */
13475+ switch ((re_opcode_t) *p)
13476+ {
13477+ case jump_n:
13478+ is_a_jump_n = true;
13479+ case maybe_pop_jump:
13480+ case pop_failure_jump:
13481+ case jump:
13482+ p1 = p + 1;
13483+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
13484+ p1 += mcnt;
13485+
13486+ if ((is_a_jump_n && (re_opcode_t) *p1 == succeed_n)
13487+ || (!is_a_jump_n
13488+ && (re_opcode_t) *p1 == on_failure_jump))
13489+ goto fail;
13490+ break;
13491+ default:
13492+ /* do nothing */ ;
13493+ }
13494+ }
13495+
13496+ if (d >= string1 && d <= end1)
13497+ dend = end_match_1;
13498+ }
13499+ else
13500+ break; /* Matching at this starting point really fails. */
13501+ } /* for (;;) */
13502+
13503+ if (best_regs_set)
13504+ goto restore_best_regs;
13505+
13506+ FREE_VARIABLES ();
13507+
13508+ return -1; /* Failure to match. */
13509+} /* re_match_2 */
13510+
13511+/* Subroutine definitions for re_match_2. */
13512+
13513+
13514+/* We are passed P pointing to a register number after a start_memory.
13515+
13516+ Return true if the pattern up to the corresponding stop_memory can
13517+ match the empty string, and false otherwise.
13518+
13519+ If we find the matching stop_memory, sets P to point to one past its number.
13520+ Otherwise, sets P to an undefined byte less than or equal to END.
13521+
13522+ We don't handle duplicates properly (yet). */
13523+
13524+static boolean
13525+PREFIX(group_match_null_string_p) (UCHAR_T **p, UCHAR_T *end,
13526+ PREFIX(register_info_type) *reg_info)
13527+{
13528+ int mcnt;
13529+ /* Point to after the args to the start_memory. */
13530+ UCHAR_T *p1 = *p + 2;
13531+
13532+ while (p1 < end)
13533+ {
13534+ /* Skip over opcodes that can match nothing, and return true or
13535+ false, as appropriate, when we get to one that can't, or to the
13536+ matching stop_memory. */
13537+
13538+ switch ((re_opcode_t) *p1)
13539+ {
13540+ /* Could be either a loop or a series of alternatives. */
13541+ case on_failure_jump:
13542+ p1++;
13543+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
13544+
13545+ /* If the next operation is not a jump backwards in the
13546+ pattern. */
13547+
13548+ if (mcnt >= 0)
13549+ {
13550+ /* Go through the on_failure_jumps of the alternatives,
13551+ seeing if any of the alternatives cannot match nothing.
13552+ The last alternative starts with only a jump,
13553+ whereas the rest start with on_failure_jump and end
13554+ with a jump, e.g., here is the pattern for `a|b|c':
13555+
13556+ /on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6
13557+ /on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3
13558+ /exactn/1/c
13559+
13560+ So, we have to first go through the first (n-1)
13561+ alternatives and then deal with the last one separately. */
13562+
13563+
13564+ /* Deal with the first (n-1) alternatives, which start
13565+ with an on_failure_jump (see above) that jumps to right
13566+ past a jump_past_alt. */
13567+
13568+ while ((re_opcode_t) p1[mcnt-(1+OFFSET_ADDRESS_SIZE)] ==
13569+ jump_past_alt)
13570+ {
13571+ /* `mcnt' holds how many bytes long the alternative
13572+ is, including the ending `jump_past_alt' and
13573+ its number. */
13574+
13575+ if (!PREFIX(alt_match_null_string_p) (p1, p1 + mcnt -
13576+ (1 + OFFSET_ADDRESS_SIZE),
13577+ reg_info))
13578+ return false;
13579+
13580+ /* Move to right after this alternative, including the
13581+ jump_past_alt. */
13582+ p1 += mcnt;
13583+
13584+ /* Break if it's the beginning of an n-th alternative
13585+ that doesn't begin with an on_failure_jump. */
13586+ if ((re_opcode_t) *p1 != on_failure_jump)
13587+ break;
13588+
13589+ /* Still have to check that it's not an n-th
13590+ alternative that starts with an on_failure_jump. */
13591+ p1++;
13592+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
13593+ if ((re_opcode_t) p1[mcnt-(1+OFFSET_ADDRESS_SIZE)] !=
13594+ jump_past_alt)
13595+ {
13596+ /* Get to the beginning of the n-th alternative. */
13597+ p1 -= 1 + OFFSET_ADDRESS_SIZE;
13598+ break;
13599+ }
13600+ }
13601+
13602+ /* Deal with the last alternative: go back and get number
13603+ of the `jump_past_alt' just before it. `mcnt' contains
13604+ the length of the alternative. */
13605+ EXTRACT_NUMBER (mcnt, p1 - OFFSET_ADDRESS_SIZE);
13606+
13607+ if (!PREFIX(alt_match_null_string_p) (p1, p1 + mcnt, reg_info))
13608+ return false;
13609+
13610+ p1 += mcnt; /* Get past the n-th alternative. */
13611+ } /* if mcnt > 0 */
13612+ break;
13613+
13614+
13615+ case stop_memory:
13616+ assert (p1[1] == **p);
13617+ *p = p1 + 2;
13618+ return true;
13619+
13620+
13621+ default:
13622+ if (!PREFIX(common_op_match_null_string_p) (&p1, end, reg_info))
13623+ return false;
13624+ }
13625+ } /* while p1 < end */
13626+
13627+ return false;
13628+} /* group_match_null_string_p */
13629+
13630+
13631+/* Similar to group_match_null_string_p, but doesn't deal with alternatives:
13632+ It expects P to be the first byte of a single alternative and END one
13633+ byte past the last. The alternative can contain groups. */
13634+
13635+static boolean
13636+PREFIX(alt_match_null_string_p) (UCHAR_T *p, UCHAR_T *end,
13637+ PREFIX(register_info_type) *reg_info)
13638+{
13639+ int mcnt;
13640+ UCHAR_T *p1 = p;
13641+
13642+ while (p1 < end)
13643+ {
13644+ /* Skip over opcodes that can match nothing, and break when we get
13645+ to one that can't. */
13646+
13647+ switch ((re_opcode_t) *p1)
13648+ {
13649+ /* It's a loop. */
13650+ case on_failure_jump:
13651+ p1++;
13652+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
13653+ p1 += mcnt;
13654+ break;
13655+
13656+ default:
13657+ if (!PREFIX(common_op_match_null_string_p) (&p1, end, reg_info))
13658+ return false;
13659+ }
13660+ } /* while p1 < end */
13661+
13662+ return true;
13663+} /* alt_match_null_string_p */
13664+
13665+
13666+/* Deals with the ops common to group_match_null_string_p and
13667+ alt_match_null_string_p.
13668+
13669+ Sets P to one after the op and its arguments, if any. */
13670+
13671+static boolean
13672+PREFIX(common_op_match_null_string_p) (UCHAR_T **p, UCHAR_T *end,
13673+ PREFIX(register_info_type) *reg_info)
13674+{
13675+ int mcnt;
13676+ boolean ret;
13677+ int reg_no;
13678+ UCHAR_T *p1 = *p;
13679+
13680+ switch ((re_opcode_t) *p1++)
13681+ {
13682+ case no_op:
13683+ case begline:
13684+ case endline:
13685+ case begbuf:
13686+ case endbuf:
13687+ case wordbeg:
13688+ case wordend:
13689+ case wordbound:
13690+ case notwordbound:
13691+#ifdef emacs
13692+ case before_dot:
13693+ case at_dot:
13694+ case after_dot:
13695+#endif
13696+ break;
13697+
13698+ case start_memory:
13699+ reg_no = *p1;
13700+ assert (reg_no > 0 && reg_no <= MAX_REGNUM);
13701+ ret = PREFIX(group_match_null_string_p) (&p1, end, reg_info);
13702+
13703+ /* Have to set this here in case we're checking a group which
13704+ contains a group and a back reference to it. */
13705+
13706+ if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE)
13707+ REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret;
13708+
13709+ if (!ret)
13710+ return false;
13711+ break;
13712+
13713+ /* If this is an optimized succeed_n for zero times, make the jump. */
13714+ case jump:
13715+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
13716+ if (mcnt >= 0)
13717+ p1 += mcnt;
13718+ else
13719+ return false;
13720+ break;
13721+
13722+ case succeed_n:
13723+ /* Get to the number of times to succeed. */
13724+ p1 += OFFSET_ADDRESS_SIZE;
13725+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
13726+
13727+ if (mcnt == 0)
13728+ {
13729+ p1 -= 2 * OFFSET_ADDRESS_SIZE;
13730+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
13731+ p1 += mcnt;
13732+ }
13733+ else
13734+ return false;
13735+ break;
13736+
13737+ case duplicate:
13738+ if (!REG_MATCH_NULL_STRING_P (reg_info[*p1]))
13739+ return false;
13740+ break;
13741+
13742+ case set_number_at:
13743+ p1 += 2 * OFFSET_ADDRESS_SIZE;
13744+
13745+ default:
13746+ /* All other opcodes mean we cannot match the empty string. */
13747+ return false;
13748+ }
13749+
13750+ *p = p1;
13751+ return true;
13752+} /* common_op_match_null_string_p */
13753+
13754+
13755+/* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN
13756+ bytes; nonzero otherwise. */
13757+
13758+static int
13759+PREFIX(bcmp_translate) (const CHAR_T *s1, const CHAR_T *s2, register int len,
13760+ RE_TRANSLATE_TYPE translate)
13761+{
13762+ register const UCHAR_T *p1 = (const UCHAR_T *) s1;
13763+ register const UCHAR_T *p2 = (const UCHAR_T *) s2;
13764+ while (len)
13765+ {
13766+#ifdef WCHAR
13767+ if (((*p1<=0xff)?translate[*p1++]:*p1++)
13768+ != ((*p2<=0xff)?translate[*p2++]:*p2++))
13769+ return 1;
13770+#else /* BYTE */
13771+ if (translate[*p1++] != translate[*p2++]) return 1;
13772+#endif /* WCHAR */
13773+ len--;
13774+ }
13775+ return 0;
13776+}
13777+
13778+
13779+#else /* not INSIDE_RECURSION */
13780+
13781+/* Entry points for GNU code. */
13782+
13783+/* re_compile_pattern is the GNU regular expression compiler: it
13784+ compiles PATTERN (of length SIZE) and puts the result in BUFP.
13785+ Returns 0 if the pattern was valid, otherwise an error string.
13786+
13787+ Assumes the `allocated' (and perhaps `buffer') and `translate' fields
13788+ are set in BUFP on entry.
13789+
13790+ We call regex_compile to do the actual compilation. */
13791+
13792+const char *
13793+re_compile_pattern (const char *pattern, size_t length,
13794+ struct re_pattern_buffer *bufp)
13795+{
13796+ reg_errcode_t ret;
13797+
13798+ /* GNU code is written to assume at least RE_NREGS registers will be set
13799+ (and at least one extra will be -1). */
13800+ bufp->regs_allocated = REGS_UNALLOCATED;
13801+
13802+ /* And GNU code determines whether or not to get register information
13803+ by passing null for the REGS argument to re_match, etc., not by
13804+ setting no_sub. */
13805+ bufp->no_sub = 0;
13806+
13807+ /* Match anchors at newline. */
13808+ bufp->newline_anchor = 1;
13809+
13810+# ifdef MBS_SUPPORT
13811+ if (MB_CUR_MAX != 1)
13812+ ret = wcs_regex_compile (pattern, length, re_syntax_options, bufp);
13813+ else
13814+# endif
13815+ ret = byte_regex_compile (pattern, length, re_syntax_options, bufp);
13816+
13817+ if (!ret)
13818+ return NULL;
13819+ return gettext (re_error_msgid[(int) ret]);
13820+}
13821+#ifdef _LIBC
13822+weak_alias (__re_compile_pattern, re_compile_pattern)
13823+#endif
13824+
13825+/* Entry points compatible with 4.2 BSD regex library. We don't define
13826+ them unless specifically requested. */
13827+
13828+#if defined _REGEX_RE_COMP || defined _LIBC
13829+
13830+/* BSD has one and only one pattern buffer. */
13831+static struct re_pattern_buffer re_comp_buf;
13832+
13833+char *
13834+#ifdef _LIBC
13835+/* Make these definitions weak in libc, so POSIX programs can redefine
13836+ these names if they don't use our functions, and still use
13837+ regcomp/regexec below without link errors. */
13838+weak_function
13839+#endif
13840+re_comp (const char *s)
13841+{
13842+ reg_errcode_t ret;
13843+
13844+ if (!s)
13845+ {
13846+ if (!re_comp_buf.buffer)
13847+ return (char *) gettext ("No previous regular expression");
13848+ return 0;
13849+ }
13850+
13851+ if (!re_comp_buf.buffer)
13852+ {
13853+ re_comp_buf.buffer = (unsigned char *) malloc (200);
13854+ if (re_comp_buf.buffer == NULL)
13855+ return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
13856+ re_comp_buf.allocated = 200;
13857+
13858+ re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH);
13859+ if (re_comp_buf.fastmap == NULL)
13860+ return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
13861+ }
13862+
13863+ /* Since `re_exec' always passes NULL for the `regs' argument, we
13864+ don't need to initialize the pattern buffer fields which affect it. */
13865+
13866+ /* Match anchors at newlines. */
13867+ re_comp_buf.newline_anchor = 1;
13868+
13869+# ifdef MBS_SUPPORT
13870+ if (MB_CUR_MAX != 1)
13871+ ret = wcs_regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf);
13872+ else
13873+# endif
13874+ ret = byte_regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf);
13875+
13876+ if (!ret)
13877+ return NULL;
13878+
13879+ /* Yes, we're discarding `const' here if !HAVE_LIBINTL. */
13880+ return (char *) gettext (re_error_msgid[(int) ret]);
13881+}
13882+
13883+
13884+int
13885+#ifdef _LIBC
13886+weak_function
13887+#endif
13888+re_exec (const char *s)
13889+{
13890+ const int len = strlen (s);
13891+ return
13892+ 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0);
13893+}
13894+
13895+#endif /* _REGEX_RE_COMP */
13896+
13897+/* POSIX.2 functions. Don't define these for Emacs. */
13898+
13899+#ifndef emacs
13900+
13901+/* regcomp takes a regular expression as a string and compiles it.
13902+
13903+ PREG is a regex_t *. We do not expect any fields to be initialized,
13904+ since POSIX says we shouldn't. Thus, we set
13905+
13906+ `buffer' to the compiled pattern;
13907+ `used' to the length of the compiled pattern;
13908+ `syntax' to RE_SYNTAX_POSIX_EXTENDED if the
13909+ REG_EXTENDED bit in CFLAGS is set; otherwise, to
13910+ RE_SYNTAX_POSIX_BASIC;
13911+ `newline_anchor' to REG_NEWLINE being set in CFLAGS;
13912+ `fastmap' to an allocated space for the fastmap;
13913+ `fastmap_accurate' to zero;
13914+ `re_nsub' to the number of subexpressions in PATTERN.
13915+
13916+ PATTERN is the address of the pattern string.
13917+
13918+ CFLAGS is a series of bits which affect compilation.
13919+
13920+ If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we
13921+ use POSIX basic syntax.
13922+
13923+ If REG_NEWLINE is set, then . and [^...] don't match newline.
13924+ Also, regexec will try a match beginning after every newline.
13925+
13926+ If REG_ICASE is set, then we considers upper- and lowercase
13927+ versions of letters to be equivalent when matching.
13928+
13929+ If REG_NOSUB is set, then when PREG is passed to regexec, that
13930+ routine will report only success or failure, and nothing about the
13931+ registers.
13932+
13933+ It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for
13934+ the return codes and their meanings.) */
13935+
13936+int
13937+regcomp (regex_t *preg, const char *pattern, int cflags)
13938+{
13939+ reg_errcode_t ret;
13940+ reg_syntax_t syntax
13941+ = (cflags & REG_EXTENDED) ?
13942+ RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC;
13943+
13944+ /* regex_compile will allocate the space for the compiled pattern. */
13945+ preg->buffer = 0;
13946+ preg->allocated = 0;
13947+ preg->used = 0;
13948+
13949+ /* Try to allocate space for the fastmap. */
13950+ preg->fastmap = (char *) malloc (1 << BYTEWIDTH);
13951+
13952+ if (cflags & REG_ICASE)
13953+ {
13954+ int i;
13955+
13956+ preg->translate
13957+ = (RE_TRANSLATE_TYPE) malloc (CHAR_SET_SIZE
13958+ * sizeof (*(RE_TRANSLATE_TYPE)0));
13959+ if (preg->translate == NULL)
13960+ return (int) REG_ESPACE;
13961+
13962+ /* Map uppercase characters to corresponding lowercase ones. */
13963+ for (i = 0; i < CHAR_SET_SIZE; i++)
13964+ preg->translate[i] = ISUPPER (i) ? TOLOWER (i) : i;
13965+ }
13966+ else
13967+ preg->translate = NULL;
13968+
13969+ /* If REG_NEWLINE is set, newlines are treated differently. */
13970+ if (cflags & REG_NEWLINE)
13971+ { /* REG_NEWLINE implies neither . nor [^...] match newline. */
13972+ syntax &= ~RE_DOT_NEWLINE;
13973+ syntax |= RE_HAT_LISTS_NOT_NEWLINE;
13974+ /* It also changes the matching behavior. */
13975+ preg->newline_anchor = 1;
13976+ }
13977+ else
13978+ preg->newline_anchor = 0;
13979+
13980+ preg->no_sub = !!(cflags & REG_NOSUB);
13981+
13982+ /* POSIX says a null character in the pattern terminates it, so we
13983+ can use strlen here in compiling the pattern. */
13984+# ifdef MBS_SUPPORT
13985+ if (MB_CUR_MAX != 1)
13986+ ret = wcs_regex_compile (pattern, strlen (pattern), syntax, preg);
13987+ else
13988+# endif
13989+ ret = byte_regex_compile (pattern, strlen (pattern), syntax, preg);
13990+
13991+ /* POSIX doesn't distinguish between an unmatched open-group and an
13992+ unmatched close-group: both are REG_EPAREN. */
13993+ if (ret == REG_ERPAREN) ret = REG_EPAREN;
13994+
13995+ if (ret == REG_NOERROR && preg->fastmap)
13996+ {
13997+ /* Compute the fastmap now, since regexec cannot modify the pattern
13998+ buffer. */
13999+ if (re_compile_fastmap (preg) == -2)
14000+ {
14001+ /* Some error occurred while computing the fastmap, just forget
14002+ about it. */
14003+ free (preg->fastmap);
14004+ preg->fastmap = NULL;
14005+ }
14006+ }
14007+
14008+ return (int) ret;
14009+}
14010+#ifdef _LIBC
14011+weak_alias (__regcomp, regcomp)
14012+#endif
14013+
14014+
14015+/* regexec searches for a given pattern, specified by PREG, in the
14016+ string STRING.
14017+
14018+ If NMATCH is zero or REG_NOSUB was set in the cflags argument to
14019+ `regcomp', we ignore PMATCH. Otherwise, we assume PMATCH has at
14020+ least NMATCH elements, and we set them to the offsets of the
14021+ corresponding matched substrings.
14022+
14023+ EFLAGS specifies `execution flags' which affect matching: if
14024+ REG_NOTBOL is set, then ^ does not match at the beginning of the
14025+ string; if REG_NOTEOL is set, then $ does not match at the end.
14026+
14027+ We return 0 if we find a match and REG_NOMATCH if not. */
14028+
14029+int
14030+regexec (const regex_t *preg, const char *string, size_t nmatch,
14031+ regmatch_t pmatch[], int eflags)
14032+{
14033+ int ret;
14034+ struct re_registers regs;
14035+ regex_t private_preg;
14036+ int len = strlen (string);
14037+ boolean want_reg_info = !preg->no_sub && nmatch > 0;
14038+
14039+ private_preg = *preg;
14040+
14041+ private_preg.not_bol = !!(eflags & REG_NOTBOL);
14042+ private_preg.not_eol = !!(eflags & REG_NOTEOL);
14043+
14044+ /* The user has told us exactly how many registers to return
14045+ information about, via `nmatch'. We have to pass that on to the
14046+ matching routines. */
14047+ private_preg.regs_allocated = REGS_FIXED;
14048+
14049+ if (want_reg_info)
14050+ {
14051+ regs.num_regs = nmatch;
14052+ regs.start = TALLOC (nmatch * 2, regoff_t);
14053+ if (regs.start == NULL)
14054+ return (int) REG_NOMATCH;
14055+ regs.end = regs.start + nmatch;
14056+ }
14057+
14058+ /* Perform the searching operation. */
14059+ ret = re_search (&private_preg, string, len,
14060+ /* start: */ 0, /* range: */ len,
14061+ want_reg_info ? &regs : (struct re_registers *) 0);
14062+
14063+ /* Copy the register information to the POSIX structure. */
14064+ if (want_reg_info)
14065+ {
14066+ if (ret >= 0)
14067+ {
14068+ unsigned r;
14069+
14070+ for (r = 0; r < nmatch; r++)
14071+ {
14072+ pmatch[r].rm_so = regs.start[r];
14073+ pmatch[r].rm_eo = regs.end[r];
14074+ }
14075+ }
14076+
14077+ /* If we needed the temporary register info, free the space now. */
14078+ free (regs.start);
14079+ }
14080+
14081+ /* We want zero return to mean success, unlike `re_search'. */
14082+ return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH;
14083+}
14084+#ifdef _LIBC
14085+/* EGLIBC: This is handled in regexec-compat.c. */
14086+/*weak_alias (__regexec, regexec)*/
14087+#include "regexec-compat.c"
14088+#endif
14089+
14090+
14091+/* Returns a message corresponding to an error code, ERRCODE, returned
14092+ from either regcomp or regexec. We don't use PREG here. */
14093+
14094+size_t
14095+regerror (int errcode, const regex_t *preg __attribute__ ((unused)),
14096+ char *errbuf, size_t errbuf_size)
14097+{
14098+ const char *msg;
14099+ size_t msg_size;
14100+
14101+ if (errcode < 0
14102+ || errcode >= (int) (sizeof (re_error_msgid)
14103+ / sizeof (re_error_msgid[0])))
14104+ /* Only error codes returned by the rest of the code should be passed
14105+ to this routine. If we are given anything else, or if other regex
14106+ code generates an invalid error code, then the program has a bug.
14107+ Dump core so we can fix it. */
14108+ abort ();
14109+
14110+ msg = gettext (re_error_msgid[errcode]);
14111+
14112+ msg_size = strlen (msg) + 1; /* Includes the null. */
14113+
14114+ if (errbuf_size != 0)
14115+ {
14116+ if (msg_size > errbuf_size)
14117+ {
14118+#if defined HAVE_MEMPCPY || defined _LIBC
14119+ *((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
14120+#else
14121+ memcpy (errbuf, msg, errbuf_size - 1);
14122+ errbuf[errbuf_size - 1] = 0;
14123+#endif
14124+ }
14125+ else
14126+ memcpy (errbuf, msg, msg_size);
14127+ }
14128+
14129+ return msg_size;
14130+}
14131+#ifdef _LIBC
14132+weak_alias (__regerror, regerror)
14133+#endif
14134+
14135+
14136+/* Free dynamically allocated space used by PREG. */
14137+
14138+void
14139+regfree (regex_t *preg)
14140+{
14141+ if (preg->buffer != NULL)
14142+ free (preg->buffer);
14143+ preg->buffer = NULL;
14144+
14145+ preg->allocated = 0;
14146+ preg->used = 0;
14147+
14148+ if (preg->fastmap != NULL)
14149+ free (preg->fastmap);
14150+ preg->fastmap = NULL;
14151+ preg->fastmap_accurate = 0;
14152+
14153+ if (preg->translate != NULL)
14154+ free (preg->translate);
14155+ preg->translate = NULL;
14156+}
14157+#ifdef _LIBC
14158+weak_alias (__regfree, regfree)
14159+#endif
14160+
14161+#endif /* not emacs */
14162+
14163+#endif /* not INSIDE_RECURSION */
14164+
14165+
14166+#undef STORE_NUMBER
14167+#undef STORE_NUMBER_AND_INCR
14168+#undef EXTRACT_NUMBER
14169+#undef EXTRACT_NUMBER_AND_INCR
14170+
14171+#undef DEBUG_PRINT_COMPILED_PATTERN
14172+#undef DEBUG_PRINT_DOUBLE_STRING
14173+
14174+#undef INIT_FAIL_STACK
14175+#undef RESET_FAIL_STACK
14176+#undef DOUBLE_FAIL_STACK
14177+#undef PUSH_PATTERN_OP
14178+#undef PUSH_FAILURE_POINTER
14179+#undef PUSH_FAILURE_INT
14180+#undef PUSH_FAILURE_ELT
14181+#undef POP_FAILURE_POINTER
14182+#undef POP_FAILURE_INT
14183+#undef POP_FAILURE_ELT
14184+#undef DEBUG_PUSH
14185+#undef DEBUG_POP
14186+#undef PUSH_FAILURE_POINT
14187+#undef POP_FAILURE_POINT
14188+
14189+#undef REG_UNSET_VALUE
14190+#undef REG_UNSET
14191+
14192+#undef PATFETCH
14193+#undef PATFETCH_RAW
14194+#undef PATUNFETCH
14195+#undef TRANSLATE
14196+
14197+#undef INIT_BUF_SIZE
14198+#undef GET_BUFFER_SPACE
14199+#undef BUF_PUSH
14200+#undef BUF_PUSH_2
14201+#undef BUF_PUSH_3
14202+#undef STORE_JUMP
14203+#undef STORE_JUMP2
14204+#undef INSERT_JUMP
14205+#undef INSERT_JUMP2
14206+#undef EXTEND_BUFFER
14207+#undef GET_UNSIGNED_NUMBER
14208+#undef FREE_STACK_RETURN
14209+
14210+# undef POINTER_TO_OFFSET
14211+# undef MATCHING_IN_FRST_STRING
14212+# undef PREFETCH
14213+# undef AT_STRINGS_BEG
14214+# undef AT_STRINGS_END
14215+# undef WORDCHAR_P
14216+# undef FREE_VAR
14217+# undef FREE_VARIABLES
14218+# undef NO_HIGHEST_ACTIVE_REG
14219+# undef NO_LOWEST_ACTIVE_REG
14220+
14221+# undef CHAR_T
14222+# undef UCHAR_T
14223+# undef COMPILED_BUFFER_VAR
14224+# undef OFFSET_ADDRESS_SIZE
14225+# undef CHAR_CLASS_SIZE
14226+# undef PREFIX
14227+# undef ARG_PREFIX
14228+# undef PUT_CHAR
14229+# undef BYTE
14230+# undef WCHAR
14231+
14232+# define DEFINED_ONCE
14233Index: git/pwd/Makefile
14234===================================================================
14235--- git.orig/pwd/Makefile 2014-08-29 20:00:53.316070587 -0700
14236+++ git/pwd/Makefile 2014-08-29 20:01:15.232070587 -0700
14237@@ -18,6 +18,8 @@
14238 #
14239 # Sub-makefile for pwd portion of the library.
14240 #
14241+include ../option-groups.mak
14242+
14243 subdir := pwd
14244
14245 include ../Makeconfig
14246Index: git/resolv/Makefile
14247===================================================================
14248--- git.orig/resolv/Makefile 2014-08-29 20:00:53.320070587 -0700
14249+++ git/resolv/Makefile 2014-08-29 20:01:15.232070587 -0700
14250@@ -18,6 +18,8 @@
14251 #
14252 # Sub-makefile for resolv portion of the library.
14253 #
14254+include ../option-groups.mak
14255+
14256 subdir := resolv
14257
14258 include ../Makeconfig
14259@@ -27,20 +29,21 @@
14260 arpa/nameser.h arpa/nameser_compat.h \
14261 sys/bitypes.h
14262
14263-routines := herror inet_addr inet_ntop inet_pton nsap_addr res_init \
14264- res_hconf res_libc res-state
14265+routines-$(OPTION_EGLIBC_INET) \
14266+ += herror inet_addr inet_ntop inet_pton nsap_addr res_init \
14267+ res_hconf res_libc res-state
14268
14269-tests = tst-aton tst-leaks tst-inet_ntop
14270-xtests = tst-leaks2
14271+tests-$(OPTION_EGLIBC_INET) += tst-aton tst-leaks tst-inet_ntop
14272+xtests-$(OPTION_EGLIBC_INET) += tst-leaks2
14273
14274 generate := mtrace-tst-leaks.out tst-leaks.mtrace tst-leaks2.mtrace
14275
14276-extra-libs := libresolv libnss_dns
14277+extra-libs-$(OPTION_EGLIBC_INET) += libresolv libnss_dns
14278 ifeq ($(have-thread-library),yes)
14279-extra-libs += libanl
14280-routines += gai_sigqueue
14281+extra-libs-$(OPTION_EGLIBC_INET_ANL) += libanl
14282+routines-$(OPTION_EGLIBC_INET) += gai_sigqueue
14283 endif
14284-extra-libs-others = $(extra-libs)
14285+extra-libs-others-y += $(extra-libs-y)
14286 libresolv-routines := gethnamaddr res_comp res_debug \
14287 res_data res_mkquery res_query res_send \
14288 inet_net_ntop inet_net_pton inet_neta base64 \
14289@@ -60,7 +63,7 @@
14290 static-only-routines += $(libnss_dns-routines) $(libresolv-routines)
14291 endif
14292
14293-ifeq (yesyes,$(build-shared)$(have-thread-library))
14294+ifeq (yesyesy,$(build-shared)$(have-thread-library)$(OPTION_EGLIBC_INET_ANL))
14295 tests: $(objpfx)ga_test
14296 endif
14297
14298Index: git/stdio-common/fxprintf.c
14299===================================================================
14300--- git.orig/stdio-common/fxprintf.c 2014-08-29 20:00:53.544070587 -0700
14301+++ git/stdio-common/fxprintf.c 2014-08-29 20:01:15.232070587 -0700
14302@@ -23,6 +23,7 @@
14303 #include <wchar.h>
14304 #include <string.h>
14305 #include <libioP.h>
14306+#include <gnu/option-groups.h>
14307
14308
14309 int
14310@@ -37,6 +38,7 @@
14311 int res;
14312 if (_IO_fwide (fp, 0) > 0)
14313 {
14314+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
14315 size_t len = strlen (fmt) + 1;
14316 wchar_t wfmt[len];
14317 for (size_t i = 0; i < len; ++i)
14318@@ -45,6 +47,9 @@
14319 wfmt[i] = fmt[i];
14320 }
14321 res = __vfwprintf (fp, wfmt, ap);
14322+#else
14323+ abort();
14324+#endif
14325 }
14326 else
14327 res = _IO_vfprintf (fp, fmt, ap);
14328Index: git/stdio-common/_i18n_number.h
14329===================================================================
14330--- git.orig/stdio-common/_i18n_number.h 2014-08-29 20:00:53.500070587 -0700
14331+++ git/stdio-common/_i18n_number.h 2014-08-29 20:01:15.232070587 -0700
14332@@ -19,10 +19,13 @@
14333 #include <stdbool.h>
14334 #include <wchar.h>
14335 #include <wctype.h>
14336+#include <gnu/option-groups.h>
14337
14338 #include "../locale/outdigits.h"
14339 #include "../locale/outdigitswc.h"
14340
14341+#if __OPTION_EGLIBC_LOCALE_CODE
14342+
14343 static CHAR_T *
14344 _i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end)
14345 {
14346@@ -115,3 +118,13 @@
14347
14348 return w;
14349 }
14350+
14351+#else
14352+
14353+static CHAR_T *
14354+_i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end)
14355+{
14356+ return w;
14357+}
14358+
14359+#endif
14360Index: git/stdio-common/Makefile
14361===================================================================
14362--- git.orig/stdio-common/Makefile 2014-08-29 20:00:53.500070587 -0700
14363+++ git/stdio-common/Makefile 2014-08-29 20:01:15.232070587 -0700
14364@@ -18,6 +18,8 @@
14365 #
14366 # Specific makefile for stdio-common.
14367 #
14368+include ../option-groups.mak
14369+
14370 subdir := stdio-common
14371
14372 include ../Makeconfig
14373@@ -30,7 +32,7 @@
14374 vfprintf vprintf printf_fp reg-printf printf-prs printf_fphex \
14375 reg-modifier reg-type \
14376 printf_size fprintf printf snprintf sprintf asprintf dprintf \
14377- vfwprintf vfscanf vfwscanf \
14378+ vfscanf \
14379 fscanf scanf sscanf \
14380 perror psignal \
14381 tmpfile tmpfile64 tmpnam tmpnam_r tempnam tempname \
14382@@ -41,23 +43,37 @@
14383 isoc99_vsscanf \
14384 psiginfo
14385
14386-aux := errlist siglist printf-parsemb printf-parsewc fxprintf
14387+# Ideally, _itowa and itowa-digits would be in this option group as
14388+# well, but it is used unconditionally by printf_fp and printf_fphex,
14389+# and it didn't seem straightforward to disentangle it.
14390+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) += \
14391+ vfwprintf vfwscanf
14392+
14393+aux := errlist siglist printf-parsemb fxprintf
14394+aux-$(OPTION_POSIX_C_LANG_WIDE_CHAR) += printf-parsewc
14395
14396 tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
14397 temptest tst-fileno test-fwrite tst-ungetc tst-ferror \
14398 xbug errnobug \
14399 bug1 bug2 bug3 bug4 bug5 bug6 bug7 bug8 bug9 bug10 bug11 bug12 bug13 \
14400- tfformat tiformat tllformat tstdiomisc tst-printfsz tst-wc-printf \
14401+ tfformat tiformat tllformat tstdiomisc tst-printfsz \
14402 scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10 \
14403- scanf11 scanf12 tst-tmpnam tst-cookie tst-obprintf tst-sscanf \
14404- tst-swprintf tst-fseek tst-fmemopen test-vfprintf tst-gets \
14405- tst-perror tst-sprintf tst-rndseek tst-fdopen tst-fphex bug14 \
14406+ scanf11 scanf12 tst-tmpnam tst-cookie tst-obprintf \
14407+ scanf11 scanf12 tst-tmpnam tst-cookie tst-obprintf \
14408+ tst-fseek tst-fmemopen tst-gets \
14409+ tst-sprintf tst-rndseek tst-fdopen tst-fphex \
14410 tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
14411- tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \
14412- bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \
14413- scanf16 scanf17 tst-setvbuf1 tst-grouping bug23 bug24 \
14414- bug-vfprintf-nargs tst-long-dbl-fphex tst-fphex-wide tst-sprintf3 \
14415- bug25 tst-printf-round bug26
14416+ tst-fwrite bug16 bug17 tst-sprintf2 bug18 \
14417+ bug19 tst-popen2 scanf14 scanf15 bug21 bug22 scanf16 scanf17 \
14418+ tst-setvbuf1 bug23 bug24 bug-vfprintf-nargs tst-sprintf3 bug25 \
14419+ tst-printf-round bug26
14420+
14421+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
14422+ += tst-sscanf tst-swprintf test-vfprintf bug14 scanf13 tst-grouping
14423+tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
14424+ += tst-perror bug19a bug20 tst-long-dbl-fphex tst-fphex-wide
14425+tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
14426+ += bug18a tst-swscanf tst-wc-printf
14427
14428 test-srcs = tst-unbputc tst-printf
14429
14430Index: git/stdio-common/printf_fp.c
14431===================================================================
14432--- git.orig/stdio-common/printf_fp.c 2014-08-29 20:00:53.548070587 -0700
14433+++ git/stdio-common/printf_fp.c 2014-08-29 20:01:15.232070587 -0700
14434@@ -39,6 +39,7 @@
14435 #include <unistd.h>
14436 #include <stdlib.h>
14437 #include <wchar.h>
14438+#include <gnu/option-groups.h>
14439 #include <stdbool.h>
14440 #include <rounding-mode.h>
14441
14442@@ -148,6 +149,10 @@
14443 wchar_t thousands_sep, int ngroups)
14444 internal_function;
14445
14446+/* Ideally, when OPTION_EGLIBC_LOCALE_CODE is disabled, this should do
14447+ all its work in ordinary characters, rather than doing it in wide
14448+ characters and then converting at the end. But that is a challenge
14449+ for another day. */
14450
14451 int
14452 ___printf_fp (FILE *fp,
14453@@ -206,7 +211,14 @@
14454 mp_limb_t cy;
14455
14456 /* Nonzero if this is output on a wide character stream. */
14457+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
14458 int wide = info->wide;
14459+#else
14460+ /* This should never be called on a wide-oriented stream when
14461+ OPTION_POSIX_C_LANG_WIDE_CHAR is disabled, but the compiler can't
14462+ be trusted to figure that out. */
14463+ const int wide = 0;
14464+#endif
14465
14466 /* Buffer in which we produce the output. */
14467 wchar_t *wbuffer = NULL;
14468@@ -258,6 +270,7 @@
14469
14470
14471 /* Figure out the decimal point character. */
14472+#if __OPTION_EGLIBC_LOCALE_CODE
14473 if (info->extra == 0)
14474 {
14475 decimal = _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
14476@@ -277,7 +290,13 @@
14477 /* The decimal point character must not be zero. */
14478 assert (*decimal != '\0');
14479 assert (decimalwc != L'\0');
14480+#else
14481+ /* Hard-code values from 'C' locale. */
14482+ decimal = ".";
14483+ decimalwc = L'.';
14484+#endif
14485
14486+#if __OPTION_EGLIBC_LOCALE_CODE
14487 if (info->group)
14488 {
14489 if (info->extra == 0)
14490@@ -321,6 +340,9 @@
14491 }
14492 else
14493 grouping = NULL;
14494+#else
14495+ grouping = NULL;
14496+#endif
14497
14498 /* Fetch the argument value. */
14499 #ifndef __NO_LONG_DOUBLE_MATH
14500Index: git/stdio-common/printf_fphex.c
14501===================================================================
14502--- git.orig/stdio-common/printf_fphex.c 2014-08-29 20:00:53.548070587 -0700
14503+++ git/stdio-common/printf_fphex.c 2014-08-29 20:01:15.232070587 -0700
14504@@ -28,6 +28,7 @@
14505 #include <_itoa.h>
14506 #include <_itowa.h>
14507 #include <locale/localeinfo.h>
14508+#include <gnu/option-groups.h>
14509 #include <stdbool.h>
14510 #include <rounding-mode.h>
14511
14512@@ -139,10 +140,18 @@
14513 int done = 0;
14514
14515 /* Nonzero if this is output on a wide character stream. */
14516+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
14517 int wide = info->wide;
14518+#else
14519+ /* This should never be called on a wide-oriented stream when
14520+ OPTION_POSIX_C_LANG_WIDE_CHAR is disabled, but the compiler can't
14521+ be trusted to figure that out. */
14522+ const int wide = 0;
14523+#endif
14524
14525
14526 /* Figure out the decimal point character. */
14527+#if __OPTION_EGLIBC_LOCALE_CODE
14528 if (info->extra == 0)
14529 {
14530 decimal = _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
14531@@ -156,6 +165,10 @@
14532 }
14533 /* The decimal point character must never be zero. */
14534 assert (*decimal != '\0' && decimalwc != L'\0');
14535+#else
14536+ decimal = ".";
14537+ decimalwc = L'.';
14538+#endif
14539
14540
14541 /* Fetch the argument value. */
14542Index: git/stdio-common/printf_size.c
14543===================================================================
14544--- git.orig/stdio-common/printf_size.c 2014-08-29 20:00:53.548070587 -0700
14545+++ git/stdio-common/printf_size.c 2014-08-29 20:01:15.232070587 -0700
14546@@ -23,6 +23,7 @@
14547 #include <math.h>
14548 #include <printf.h>
14549 #include <libioP.h>
14550+#include <gnu/option-groups.h>
14551
14552
14553 /* This defines make it possible to use the same code for GNU C library and
14554@@ -116,7 +117,14 @@
14555
14556 struct printf_info fp_info;
14557 int done = 0;
14558+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
14559 int wide = info->wide;
14560+#else
14561+ /* This should never be called on a wide-oriented stream when
14562+ OPTION_POSIX_C_LANG_WIDE_CHAR is disabled, but the compiler can't
14563+ be trusted to figure that out. */
14564+ const int wide = 0;
14565+#endif
14566 int res;
14567
14568 /* Fetch the argument value. */
14569Index: git/stdio-common/scanf14.c
14570===================================================================
14571--- git.orig/stdio-common/scanf14.c 2014-08-29 20:00:53.548070587 -0700
14572+++ git/stdio-common/scanf14.c 2014-08-29 20:01:15.232070587 -0700
14573@@ -2,6 +2,7 @@
14574 #include <stdlib.h>
14575 #include <string.h>
14576 #include <wchar.h>
14577+#include <gnu/option-groups.h>
14578
14579 #define FAIL() \
14580 do { \
14581@@ -36,6 +37,7 @@
14582 FAIL ();
14583 else if (d != 2.25 || memcmp (c, " x", 2) != 0)
14584 FAIL ();
14585+#if __OPTION_EGLIBC_LOCALE_CODE
14586 if (sscanf (" 3.25S x", "%4aS%3c", &lsp, c) != 2)
14587 FAIL ();
14588 else
14589@@ -45,6 +47,7 @@
14590 memset (lsp, 'x', sizeof L"3.25");
14591 free (lsp);
14592 }
14593+#endif
14594 if (sscanf ("4.25[0-9.] x", "%a[0-9.]%8c", &sp, c) != 2)
14595 FAIL ();
14596 else
14597Index: git/stdio-common/tstdiomisc.c
14598===================================================================
14599--- git.orig/stdio-common/tstdiomisc.c 2014-08-29 20:00:53.584070587 -0700
14600+++ git/stdio-common/tstdiomisc.c 2014-08-29 20:01:15.232070587 -0700
14601@@ -3,6 +3,7 @@
14602 #include <stdio.h>
14603 #include <string.h>
14604 #include <wchar.h>
14605+#include <gnu/option-groups.h>
14606
14607 static int
14608 t1 (void)
14609@@ -125,6 +126,7 @@
14610 printf ("expected \"-inf -INF -inf -INF -inf -INF -inf -INF\", got \"%s\"\n",
14611 buf);
14612
14613+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
14614 swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G",
14615 qnanval, qnanval, qnanval, qnanval,
14616 qnanval, qnanval, qnanval, qnanval);
14617@@ -162,6 +164,7 @@
14618 result |= wcscmp (wbuf, L"-inf -INF -inf -INF -inf -INF -inf -INF") != 0;
14619 printf ("expected L\"-inf -INF -inf -INF -inf -INF -inf -INF\", got L\"%S\"\n",
14620 wbuf);
14621+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
14622
14623 lqnanval = NAN;
14624
14625@@ -206,6 +209,7 @@
14626 printf ("expected \"-inf -INF -inf -INF -inf -INF -inf -INF\", got \"%s\"\n",
14627 buf);
14628
14629+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
14630 swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]),
14631 L"%La %LA %Le %LE %Lf %LF %Lg %LG",
14632 lqnanval, lqnanval, lqnanval, lqnanval,
14633@@ -250,6 +254,7 @@
14634 result |= wcscmp (wbuf, L"-inf -INF -inf -INF -inf -INF -inf -INF") != 0;
14635 printf ("expected L\"-inf -INF -inf -INF -inf -INF -inf -INF\", got L\"%S\"\n",
14636 wbuf);
14637+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
14638
14639 return result;
14640 }
14641Index: git/stdio-common/tst-popen.c
14642===================================================================
14643--- git.orig/stdio-common/tst-popen.c 2014-08-29 20:00:53.576070587 -0700
14644+++ git/stdio-common/tst-popen.c 2014-08-29 20:01:15.232070587 -0700
14645@@ -19,6 +19,7 @@
14646 #include <stdio.h>
14647 #include <string.h>
14648 #include <wchar.h>
14649+#include <gnu/option-groups.h>
14650
14651 static int
14652 do_test (void)
14653@@ -34,12 +35,14 @@
14654 return 1;
14655 }
14656
14657+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
14658 /* POSIX says that pipe streams are byte-oriented. */
14659 if (fwide (f, 0) >= 0)
14660 {
14661 puts ("popen did not return byte-oriented stream");
14662 result = 1;
14663 }
14664+#endif
14665
14666 if (getline (&line, &len, f) != 5)
14667 {
14668Index: git/stdio-common/tst-sprintf.c
14669===================================================================
14670--- git.orig/stdio-common/tst-sprintf.c 2014-08-29 20:00:53.580070587 -0700
14671+++ git/stdio-common/tst-sprintf.c 2014-08-29 20:01:15.236070587 -0700
14672@@ -2,6 +2,7 @@
14673 #include <stdlib.h>
14674 #include <locale.h>
14675 #include <string.h>
14676+#include <gnu/option-groups.h>
14677
14678
14679 int
14680@@ -10,12 +11,14 @@
14681 char buf[100];
14682 int result = 0;
14683
14684+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
14685 if (sprintf (buf, "%.0ls", L"foo") != 0
14686 || strlen (buf) != 0)
14687 {
14688 puts ("sprintf (buf, \"%.0ls\", L\"foo\") produced some output");
14689 result = 1;
14690 }
14691+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
14692
14693 #define SIZE (1024*70000)
14694 #define STR(x) #x
14695Index: git/stdio-common/vfprintf.c
14696===================================================================
14697--- git.orig/stdio-common/vfprintf.c 2014-08-29 20:00:53.588070587 -0700
14698+++ git/stdio-common/vfprintf.c 2014-08-29 20:01:15.236070587 -0700
14699@@ -29,6 +29,7 @@
14700 #include <_itoa.h>
14701 #include <locale/localeinfo.h>
14702 #include <stdio.h>
14703+#include <gnu/option-groups.h>
14704
14705 /* This code is shared between the standard stdio implementation found
14706 in GNU C library and the libio implementation originally found in
14707@@ -138,6 +139,18 @@
14708 # define EOF WEOF
14709 #endif
14710
14711+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
14712+# define MULTIBYTE_SUPPORT (1)
14713+#else
14714+# define MULTIBYTE_SUPPORT (0)
14715+#endif
14716+
14717+#if __OPTION_EGLIBC_LOCALE_CODE
14718+# define LOCALE_SUPPORT (1)
14719+#else
14720+# define LOCALE_SUPPORT (0)
14721+#endif
14722+
14723 #include "_i18n_number.h"
14724
14725 /* Include the shared code for parsing the format string. */
14726@@ -1123,8 +1136,11 @@
14727 # define process_string_arg(fspec) \
14728 LABEL (form_character): \
14729 /* Character. */ \
14730- if (is_long) \
14731- goto LABEL (form_wcharacter); \
14732+ if (is_long) \
14733+ { \
14734+ assert (MULTIBYTE_SUPPORT); \
14735+ goto LABEL (form_wcharacter); \
14736+ } \
14737 --width; /* Account for the character itself. */ \
14738 if (!left) \
14739 PAD (' '); \
14740@@ -1137,6 +1153,7 @@
14741 break; \
14742 \
14743 LABEL (form_wcharacter): \
14744+ assert (MULTIBYTE_SUPPORT); \
14745 { \
14746 /* Wide character. */ \
14747 char buf[MB_CUR_MAX]; \
14748@@ -1203,6 +1220,7 @@
14749 } \
14750 else \
14751 { \
14752+ assert (MULTIBYTE_SUPPORT); \
14753 const wchar_t *s2 = (const wchar_t *) string; \
14754 mbstate_t mbstate; \
14755 \
14756@@ -1403,7 +1421,9 @@
14757 LABEL (flag_quote):
14758 group = 1;
14759
14760- if (grouping == (const char *) -1)
14761+ if (! LOCALE_SUPPORT)
14762+ grouping = NULL;
14763+ else if (grouping == (const char *) -1)
14764 {
14765 #ifdef COMPILE_WPRINTF
14766 thousands_sep = _NL_CURRENT_WORD (LC_NUMERIC,
14767@@ -1702,7 +1722,9 @@
14768 free (workstart);
14769 workstart = NULL;
14770
14771- if (grouping == (const char *) -1)
14772+ if (! LOCALE_SUPPORT)
14773+ grouping = NULL;
14774+ else if (grouping == (const char *) -1)
14775 {
14776 #ifdef COMPILE_WPRINTF
14777 thousands_sep = _NL_CURRENT_WORD (LC_NUMERIC,
14778Index: git/stdio-common/vfscanf.c
14779===================================================================
14780--- git.orig/stdio-common/vfscanf.c 2014-08-29 20:00:53.588070587 -0700
14781+++ git/stdio-common/vfscanf.c 2014-08-29 20:01:15.236070587 -0700
14782@@ -29,6 +29,7 @@
14783 #include <wctype.h>
14784 #include <bits/libc-lock.h>
14785 #include <locale/localeinfo.h>
14786+#include <gnu/option-groups.h>
14787
14788 #ifdef __GNUC__
14789 # define HAVE_LONGLONG
14790@@ -133,6 +134,12 @@
14791 # define WINT_T int
14792 #endif
14793
14794+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
14795+# define MULTIBYTE_SUPPORT (1)
14796+#else
14797+# define MULTIBYTE_SUPPORT (0)
14798+#endif
14799+
14800 #define encode_error() do { \
14801 errval = 4; \
14802 __set_errno (EILSEQ); \
14803@@ -316,24 +323,35 @@
14804 ARGCHECK (s, format);
14805
14806 {
14807-#ifndef COMPILE_WSCANF
14808+#if __OPTION_EGLIBC_LOCALE_CODE && !defined (COMPILE_WSCANF)
14809 struct __locale_data *const curnumeric = loc->__locales[LC_NUMERIC];
14810 #endif
14811
14812+#if __OPTION_EGLIBC_LOCALE_CODE
14813 /* Figure out the decimal point character. */
14814-#ifdef COMPILE_WSCANF
14815+# ifdef COMPILE_WSCANF
14816 decimal = _NL_CURRENT_WORD (LC_NUMERIC, _NL_NUMERIC_DECIMAL_POINT_WC);
14817-#else
14818+# else
14819 decimal = curnumeric->values[_NL_ITEM_INDEX (DECIMAL_POINT)].string;
14820-#endif
14821+# endif
14822 /* Figure out the thousands separator character. */
14823-#ifdef COMPILE_WSCANF
14824+# ifdef COMPILE_WSCANF
14825 thousands = _NL_CURRENT_WORD (LC_NUMERIC, _NL_NUMERIC_THOUSANDS_SEP_WC);
14826-#else
14827+# else
14828 thousands = curnumeric->values[_NL_ITEM_INDEX (THOUSANDS_SEP)].string;
14829 if (*thousands == '\0')
14830 thousands = NULL;
14831-#endif
14832+# endif
14833+#else /* if ! __OPTION_EGLIBC_LOCALE_CODE */
14834+ /* Hard-code values from the C locale. */
14835+# ifdef COMPILE_WSCANF
14836+ decimal = L'.';
14837+ thousands = L'\0';
14838+# else
14839+ decimal = ".";
14840+ thousands = NULL;
14841+# endif
14842+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
14843 }
14844
14845 /* Lock the stream. */
14846@@ -385,6 +403,8 @@
14847 #ifndef COMPILE_WSCANF
14848 if (!isascii ((unsigned char) *f))
14849 {
14850+ assert (MULTIBYTE_SUPPORT);
14851+
14852 /* Non-ASCII, may be a multibyte. */
14853 int len = __mbrlen (f, strlen (f), &state);
14854 if (len > 0)
14855@@ -830,6 +850,8 @@
14856 }
14857 /* FALLTHROUGH */
14858 case L_('C'):
14859+ assert (MULTIBYTE_SUPPORT);
14860+
14861 if (width == -1)
14862 width = 1;
14863
14864@@ -1172,6 +1194,8 @@
14865 /* FALLTHROUGH */
14866
14867 case L_('S'):
14868+ assert (MULTIBYTE_SUPPORT);
14869+
14870 {
14871 #ifndef COMPILE_WSCANF
14872 mbstate_t cstate;
14873@@ -1419,10 +1443,17 @@
14874 const char *mbdigits[10];
14875 const char *mbdigits_extended[10];
14876 #endif
14877+#if __OPTION_EGLIBC_LOCALE_CODE
14878 /* "to_inpunct" is a map from ASCII digits to their
14879 equivalent in locale. This is defined for locales
14880 which use an extra digits set. */
14881 wctrans_t map = __wctrans ("to_inpunct");
14882+#else
14883+ /* This will always be the case when
14884+ OPTION_EGLIBC_LOCALE_CODE is disabled, but the
14885+ compiler can't figure that out. */
14886+ wctrans_t map = NULL;
14887+#endif
14888 int n;
14889
14890 from_level = 0;
14891@@ -2088,6 +2119,7 @@
14892 --width;
14893 }
14894
14895+#if __OPTION_EGLIBC_LOCALE_CODE
14896 wctrans_t map;
14897 if (__builtin_expect ((flags & I18N) != 0, 0)
14898 /* Hexadecimal floats make no sense, fixing localized
14899@@ -2304,6 +2336,7 @@
14900 ;
14901 #endif
14902 }
14903+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
14904
14905 /* Have we read any character? If we try to read a number
14906 in hexadecimal notation and we have read only the `0x'
14907@@ -2343,7 +2376,10 @@
14908
14909 case L_('['): /* Character class. */
14910 if (flags & LONG)
14911- STRING_ARG (wstr, wchar_t, 100);
14912+ {
14913+ assert (MULTIBYTE_SUPPORT);
14914+ STRING_ARG (wstr, wchar_t, 100);
14915+ }
14916 else
14917 STRING_ARG (str, char, 100);
14918
14919@@ -2417,6 +2453,7 @@
14920 if (flags & LONG)
14921 {
14922 size_t now = read_in;
14923+ assert (MULTIBYTE_SUPPORT);
14924 #ifdef COMPILE_WSCANF
14925 if (__glibc_unlikely (inchar () == WEOF))
14926 input_error ();
14927Index: git/stdlib/Makefile
14928===================================================================
14929--- git.orig/stdlib/Makefile 2014-08-29 20:00:53.588070587 -0700
14930+++ git/stdlib/Makefile 2014-08-29 20:01:15.236070587 -0700
14931@@ -18,6 +18,8 @@
14932 #
14933 # Makefile for stdlib routines
14934 #
14935+include ../option-groups.mak
14936+
14937 subdir := stdlib
14938
14939 include ../Makeconfig
14940@@ -30,7 +32,7 @@
14941 alloca.h fmtmsg.h \
14942 bits/stdlib-bsearch.h
14943
14944-routines := \
14945+routines-y := \
14946 atof atoi atol atoll \
14947 abort \
14948 bsearch qsort msort \
14949@@ -39,7 +41,6 @@
14950 quick_exit at_quick_exit cxa_at_quick_exit cxa_thread_atexit_impl \
14951 abs labs llabs \
14952 div ldiv lldiv \
14953- mblen mbstowcs mbtowc wcstombs wctomb \
14954 random random_r rand rand_r \
14955 drand48 erand48 lrand48 nrand48 mrand48 jrand48 \
14956 srand48 seed48 lcong48 \
14957@@ -52,9 +53,18 @@
14958 strtof_l strtod_l strtold_l \
14959 system canonicalize \
14960 a64l l64a \
14961- rpmatch strfmon strfmon_l getsubopt xpg_basename fmtmsg \
14962- strtoimax strtoumax wcstoimax wcstoumax \
14963+ getsubopt xpg_basename \
14964+ strtoimax strtoumax \
14965 getcontext setcontext makecontext swapcontext
14966+routines-$(OPTION_EGLIBC_LOCALE_CODE) += \
14967+ strfmon strfmon_l
14968+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) += \
14969+ mblen mbstowcs mbtowc wcstombs wctomb \
14970+ wcstoimax wcstoumax
14971+ifeq (yy,$(OPTION_EGLIBC_LOCALE_CODE)$(OPTION_POSIX_REGEXP))
14972+routines-y += rpmatch
14973+endif
14974+routines-$(OPTION_EGLIBC_FMTMSG) += fmtmsg
14975 aux = grouping groupingwc tens_in_limb
14976
14977 # These routines will be omitted from the libc shared object.
14978@@ -62,20 +72,22 @@
14979 # linked against when the shared library will be used.
14980 static-only-routines = atexit at_quick_exit
14981
14982-test-srcs := tst-fmtmsg
14983-tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
14984+test-srcs-$(OPTION_EGLIBC_FMTMSG) := tst-fmtmsg
14985+tests := tst-strtol tst-strtod testrand testsort testdiv \
14986 test-canon test-canon2 tst-strtoll tst-environ \
14987 tst-xpg-basename tst-random tst-random2 tst-bsearch \
14988 tst-limits tst-rand48 bug-strtod tst-setcontext \
14989- test-a64l tst-qsort tst-system testmb2 bug-strtod2 \
14990- tst-atof1 tst-atof2 tst-strtod2 tst-strtod3 tst-rand48-2 \
14991- tst-makecontext tst-strtod4 tst-strtod5 tst-qsort2 \
14992- tst-makecontext2 tst-strtod6 tst-unsetenv1 \
14993- tst-makecontext3 bug-getcontext bug-fmtmsg1 \
14994+ test-a64l tst-qsort tst-system bug-strtod2 \
14995+ tst-atof1 tst-atof2 tst-strtod2 tst-rand48-2 \
14996+ tst-makecontext tst-qsort2 tst-makecontext2 tst-strtod6 \
14997+ tst-unsetenv1 tst-makecontext3 bug-getcontext bug-fmtmsg1 \
14998 tst-secure-getenv tst-strtod-overflow tst-strtod-round \
14999 tst-tininess tst-strtod-underflow tst-tls-atexit
15000 tests-static := tst-secure-getenv
15001-
15002+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
15003+ += tst-strtod3 tst-strtod4 tst-strtod5 testmb2
15004+tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
15005+ += testmb
15006 modules-names = tst-tls-atexit-lib
15007
15008 ifeq ($(build-shared),yes)
15009@@ -115,8 +127,10 @@
15010 tests-special += $(objpfx)isomac.out
15011
15012 ifeq ($(run-built-tests),yes)
15013+ifeq (y,$(OPTION_EGLIBC_FMTMSG))
15014 tests-special += $(objpfx)tst-fmtmsg.out
15015 endif
15016+endif
15017
15018 include ../Rules
15019
15020Index: git/stdlib/strtod_l.c
15021===================================================================
15022--- git.orig/stdlib/strtod_l.c 2014-08-29 20:00:53.648070587 -0700
15023+++ git/stdlib/strtod_l.c 2014-08-29 20:01:15.236070587 -0700
15024@@ -17,6 +17,7 @@
15025 License along with the GNU C Library; if not, see
15026 <http://www.gnu.org/licenses/>. */
15027
15028+#include <gnu/option-groups.h>
15029 #include <xlocale.h>
15030
15031 extern double ____strtod_l_internal (const char *, char **, int, __locale_t);
15032@@ -548,6 +549,7 @@
15033 /* Used in several places. */
15034 int cnt;
15035
15036+#if __OPTION_EGLIBC_LOCALE_CODE
15037 struct __locale_data *current = loc->__locales[LC_NUMERIC];
15038
15039 if (__glibc_unlikely (group))
15040@@ -586,6 +588,17 @@
15041 decimal_len = strlen (decimal);
15042 assert (decimal_len > 0);
15043 #endif
15044+#else /* if ! __OPTION_EGLIBC_LOCALE_CODE */
15045+ /* Hard-code values from the 'C' locale. */
15046+ grouping = NULL;
15047+#ifdef USE_WIDE_CHAR
15048+ decimal = L'.';
15049+# define decimal_len 1
15050+#else
15051+ decimal = ".";
15052+ decimal_len = 1;
15053+#endif
15054+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
15055
15056 /* Prepare number representation. */
15057 exponent = 0;
15058Index: git/stdlib/tst-strtod.c
15059===================================================================
15060--- git.orig/stdlib/tst-strtod.c 2014-08-29 20:00:53.700070587 -0700
15061+++ git/stdlib/tst-strtod.c 2014-08-29 20:01:15.236070587 -0700
15062@@ -23,6 +23,7 @@
15063 #include <errno.h>
15064 #include <string.h>
15065 #include <math.h>
15066+#include <gnu/option-groups.h>
15067
15068 struct ltest
15069 {
15070@@ -176,7 +177,9 @@
15071
15072 status |= long_dbl ();
15073
15074+#if __OPTION_EGLIBC_LOCALE_CODE
15075 status |= locale_test ();
15076+#endif
15077
15078 return status ? EXIT_FAILURE : EXIT_SUCCESS;
15079 }
15080@@ -219,6 +222,7 @@
15081 return 0;
15082 }
15083
15084+#if __OPTION_EGLIBC_LOCALE_CODE
15085 /* Perform a few tests in a locale with thousands separators. */
15086 static int
15087 locale_test (void)
15088@@ -276,3 +280,4 @@
15089
15090 return result;
15091 }
15092+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
15093Index: git/streams/Makefile
15094===================================================================
15095--- git.orig/streams/Makefile 2014-08-29 20:00:53.712070587 -0700
15096+++ git/streams/Makefile 2014-08-29 20:01:15.236070587 -0700
15097@@ -18,11 +18,14 @@
15098 #
15099 # Makefile for streams.
15100 #
15101+include ../option-groups.mak
15102+
15103 subdir := streams
15104
15105 include ../Makeconfig
15106
15107 headers = stropts.h sys/stropts.h bits/stropts.h bits/xtitypes.h
15108-routines = isastream getmsg getpmsg putmsg putpmsg fattach fdetach
15109+routines-$(OPTION_EGLIBC_STREAMS) \
15110+ += isastream getmsg getpmsg putmsg putpmsg fattach fdetach
15111
15112 include ../Rules
15113Index: git/string/Makefile
15114===================================================================
15115--- git.orig/string/Makefile 2014-08-29 20:00:53.716070587 -0700
15116+++ git/string/Makefile 2014-08-29 20:01:15.236070587 -0700
15117@@ -18,6 +18,8 @@
15118 #
15119 # Sub-makefile for string portion of library.
15120 #
15121+include ../option-groups.mak
15122+
15123 subdir := string
15124
15125 include ../Makeconfig
15126@@ -39,10 +41,12 @@
15127 $(addprefix argz-,append count create ctsep next \
15128 delete extract insert stringify \
15129 addsep replace) \
15130- envz basename \
15131+ basename \
15132 strcoll_l strxfrm_l string-inlines memrchr \
15133 xpg-strerror strerror_l
15134
15135+routines-$(OPTION_EGLIBC_ENVZ) += envz
15136+
15137 strop-tests := memchr memcmp memcpy memmove mempcpy memset memccpy \
15138 stpcpy stpncpy strcat strchr strcmp strcpy strcspn \
15139 strlen strncmp strncpy strpbrk strrchr strspn memmem \
15140@@ -51,10 +55,12 @@
15141 tests := tester inl-tester noinl-tester testcopy test-ffs \
15142 tst-strlen stratcliff tst-svc tst-inlcall \
15143 bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap \
15144- tst-strtok tst-strxfrm bug-strcoll1 tst-strfry \
15145+ tst-strtok tst-strfry \
15146 bug-strtok1 $(addprefix test-,$(strop-tests)) \
15147- bug-envz1 tst-strxfrm2 tst-endian tst-svc2 \
15148- tst-strtok_r
15149+ tst-strxfrm2 tst-endian tst-svc2 tst-strtok_r
15150+tests-$(OPTION_EGLIBC_ENVZ) += bug-envz1
15151+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
15152+ += tst-strxfrm bug-strcoll1
15153
15154 xtests = tst-strcoll-overflow
15155
15156Index: git/string/strcoll_l.c
15157===================================================================
15158--- git.orig/string/strcoll_l.c 2014-08-29 20:00:53.744070587 -0700
15159+++ git/string/strcoll_l.c 2014-08-29 20:01:15.240070587 -0700
15160@@ -25,6 +25,7 @@
15161 #include <stdlib.h>
15162 #include <string.h>
15163 #include <sys/param.h>
15164+#include <gnu/option-groups.h>
15165
15166 #ifndef STRING_TYPE
15167 # define STRING_TYPE char
15168@@ -472,7 +473,11 @@
15169 STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2, __locale_t l)
15170 {
15171 struct __locale_data *current = l->__locales[LC_COLLATE];
15172+#if __OPTION_EGLIBC_LOCALE_CODE
15173 uint_fast32_t nrules = current->values[_NL_ITEM_INDEX (_NL_COLLATE_NRULES)].word;
15174+#else
15175+ const uint_fast32_t nrules = 0;
15176+#endif
15177 /* We don't assign the following values right away since it might be
15178 unnecessary in case there are no rules. */
15179 const unsigned char *rulesets;
15180Index: git/string/strerror_l.c
15181===================================================================
15182--- git.orig/string/strerror_l.c 2014-08-29 20:00:53.744070587 -0700
15183+++ git/string/strerror_l.c 2014-08-29 20:01:15.240070587 -0700
15184@@ -21,6 +21,7 @@
15185 #include <stdlib.h>
15186 #include <string.h>
15187 #include <sys/param.h>
15188+#include <gnu/option-groups.h>
15189
15190
15191 static __thread char *last_value;
15192@@ -29,10 +30,14 @@
15193 static const char *
15194 translate (const char *str, locale_t loc)
15195 {
15196+#if __OPTION_EGLIBC_LOCALE_CODE
15197 locale_t oldloc = __uselocale (loc);
15198 const char *res = _(str);
15199 __uselocale (oldloc);
15200 return res;
15201+#else
15202+ return str;
15203+#endif
15204 }
15205
15206
15207Index: git/string/strxfrm_l.c
15208===================================================================
15209--- git.orig/string/strxfrm_l.c 2014-08-29 20:00:53.748070587 -0700
15210+++ git/string/strxfrm_l.c 2014-08-29 20:01:15.240070587 -0700
15211@@ -24,6 +24,7 @@
15212 #include <stdlib.h>
15213 #include <string.h>
15214 #include <sys/param.h>
15215+#include <gnu/option-groups.h>
15216
15217 #ifndef STRING_TYPE
15218 # define STRING_TYPE char
15219@@ -85,7 +86,11 @@
15220 STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
15221 {
15222 struct __locale_data *current = l->__locales[LC_COLLATE];
15223+#if __OPTION_EGLIBC_LOCALE_CODE
15224 uint_fast32_t nrules = current->values[_NL_ITEM_INDEX (_NL_COLLATE_NRULES)].word;
15225+#else
15226+ const uint_fast32_t nrules = 0;
15227+#endif
15228 /* We don't assign the following values right away since it might be
15229 unnecessary in case there are no rules. */
15230 const unsigned char *rulesets;
15231Index: git/string/test-strcmp.c
15232===================================================================
15233--- git.orig/string/test-strcmp.c 2014-08-29 20:00:53.752070587 -0700
15234+++ git/string/test-strcmp.c 2014-08-29 20:01:15.240070587 -0700
15235@@ -329,34 +329,6 @@
15236 FOR_EACH_IMPL (impl, 0)
15237 check_result (impl, s1 + i1, s2 + i2, exp_result);
15238 }
15239-
15240- /* Test cases where there are multiple zero bytes after the first. */
15241-
15242- for (size_t i = 0; i < 16 + 1; i++)
15243- {
15244- s1[i] = 0x00;
15245- s2[i] = 0x00;
15246- }
15247-
15248- for (size_t i = 0; i < 16; i++)
15249- {
15250- int exp_result;
15251-
15252- for (int val = 0x01; val < 0x100; val++)
15253- {
15254- for (size_t j = 0; j < i; j++)
15255- {
15256- s1[j] = val;
15257- s2[j] = val;
15258- }
15259-
15260- s2[i] = val;
15261-
15262- exp_result = SIMPLE_STRCMP (s1, s2);
15263- FOR_EACH_IMPL (impl, 0)
15264- check_result (impl, s1, s2, exp_result);
15265- }
15266- }
15267 }
15268
15269
15270Index: git/string/tst-strxfrm2.c
15271===================================================================
15272--- git.orig/string/tst-strxfrm2.c 2014-08-29 20:00:53.756070587 -0700
15273+++ git/string/tst-strxfrm2.c 2014-08-29 20:01:15.240070587 -0700
15274@@ -1,6 +1,7 @@
15275 #include <locale.h>
15276 #include <stdio.h>
15277 #include <string.h>
15278+#include <gnu/option-groups.h>
15279
15280 static int
15281 do_test (void)
15282@@ -38,6 +39,7 @@
15283 res = 1;
15284 }
15285
15286+#if __OPTION_EGLIBC_LOCALE_CODE
15287 if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
15288 {
15289 puts ("setlocale failed");
15290@@ -75,6 +77,7 @@
15291 res = 1;
15292 }
15293 }
15294+#endif
15295
15296 return res;
15297 }
15298Index: git/string/tst-strxfrm.c
15299===================================================================
15300--- git.orig/string/tst-strxfrm.c 2014-08-29 20:00:53.756070587 -0700
15301+++ git/string/tst-strxfrm.c 2014-08-29 20:01:15.240070587 -0700
15302@@ -3,6 +3,7 @@
15303 #include <stdio.h>
15304 #include <stdlib.h>
15305 #include <string.h>
15306+#include <gnu/option-groups.h>
15307
15308
15309 char const string[] = "";
15310@@ -64,8 +65,10 @@
15311 int result = 0;
15312
15313 result |= test ("C");
15314+#if __OPTION_EGLIBC_LOCALE_CODE
15315 result |= test ("en_US.ISO-8859-1");
15316 result |= test ("de_DE.UTF-8");
15317+#endif
15318
15319 return result;
15320 }
15321Index: git/sunrpc/Makefile
15322===================================================================
15323--- git.orig/sunrpc/Makefile 2014-08-29 20:00:53.760070587 -0700
15324+++ git/sunrpc/Makefile 2014-08-29 20:01:15.240070587 -0700
15325@@ -18,6 +18,8 @@
15326 #
15327 # Sub-makefile for sunrpc portion of the library.
15328 #
15329+include ../option-groups.mak
15330+
15331 subdir := sunrpc
15332
15333 include ../Makeconfig
15334@@ -55,7 +57,6 @@
15335 headers-not-in-tirpc = $(addprefix rpc/,key_prot.h rpc_des.h) \
15336 $(rpcsvc:%=rpcsvc/%) rpcsvc/bootparam.h
15337 headers = rpc/netdb.h
15338-install-others = $(inst_sysconfdir)/rpc
15339 generated += $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) $(rpcsvc:%.x=x%.stmp) \
15340 $(rpcsvc:%.x=rpcsvc/%.stmp) rpcgen
15341 generated-dirs += rpcsvc
15342@@ -65,18 +66,28 @@
15343 endif
15344
15345 ifeq ($(build-shared),yes)
15346-need-export-routines := auth_des auth_unix clnt_gen clnt_perr clnt_tcp \
15347+need-export-routines-$(OPTION_EGLIBC_SUNRPC) += \
15348+ auth_des auth_unix clnt_gen clnt_perr clnt_tcp \
15349 clnt_udp get_myaddr key_call netname pm_getport \
15350- rpc_thread svc svc_tcp svc_udp xcrypt xdr_array xdr \
15351+ rpc_thread svc svc_tcp svc_udp xdr_array xdr \
15352 xdr_intXX_t xdr_mem xdr_ref xdr_sizeof xdr_stdio \
15353 svc_run
15354
15355-routines := auth_none authuxprot bindrsvprt clnt_raw clnt_simp \
15356+need-export-routines-y += xcrypt
15357+
15358+need-export-routines := $(need-export-routines-y)
15359+
15360+routines-$(OPTION_EGLIBC_SUNRPC) \
15361+ += auth_none authuxprot bindrsvprt clnt_raw clnt_simp \
15362 rpc_dtable getrpcport pmap_clnt pm_getmaps pmap_prot pmap_prot2 \
15363 pmap_rmt rpc_prot rpc_common rpc_cmsg svc_auth svc_authux svc_raw \
15364 svc_simple xdr_float xdr_rec publickey authdes_prot \
15365- des_crypt des_impl des_soft key_prot openchild rtime svcauth_des \
15366- clnt_unix svc_unix create_xid $(need-export-routines)
15367+ key_prot openchild rtime svcauth_des \
15368+ clnt_unix svc_unix create_xid
15369+
15370+# xdecrypt is also used by nss/nss_files/files-key.c.
15371+routines-y += des_crypt des_impl des_soft $(need-export-routines)
15372+
15373 ifneq ($(link-obsolete-rpc),yes)
15374 # We only add the RPC for compatibility to libc.so.
15375 shared-only-routines = $(routines)
15376@@ -85,25 +96,28 @@
15377
15378 # We do not build rpcinfo anymore. It is not needed for a bootstrap
15379 # and not wanted on complete systems.
15380-# others := rpcinfo
15381-# install-sbin := rpcinfo
15382-install-bin := rpcgen
15383+# others-$(OPTION_EGLIBC_SUNRPC) += rpcinfo
15384+# install-sbin-$(OPTION_EGLIBC_SUNRPC) += rpcinfo
15385+install-bin-$(OPTION_EGLIBC_SUNRPC) += rpcgen
15386 rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \
15387 rpc_scan.o rpc_util.o rpc_svcout.o rpc_clntout.o \
15388 rpc_tblout.o rpc_sample.o
15389-extra-objs = $(rpcgen-objs) $(addprefix cross-,$(rpcgen-objs))
15390-others += rpcgen
15391+extra-objs-$(OPTION_EGLIBC_SUNRPC) = $(rpcgen-objs) $(addprefix cross-,$(rpcgen-objs))
15392+others-$(OPTION_EGLIBC_SUNRPC) += rpcgen
15393+
15394+install-others-$(OPTION_EGLIBC_SUNRPC) += $(inst_sysconfdir)/rpc
15395
15396-tests = tst-xdrmem tst-xdrmem2
15397-xtests := tst-getmyaddr
15398+tests-$(OPTION_EGLIBC_SUNRPC) = tst-xdrmem tst-xdrmem2
15399+xtests-$(OPTION_EGLIBC_SUNRPC) := tst-getmyaddr
15400
15401 ifeq ($(have-thread-library),yes)
15402-xtests += thrsvc
15403+xtests-$(OPTION_EGLIBC_SUNRPC) += thrsvc
15404 endif
15405
15406 headers += $(rpcsvc:%.x=rpcsvc/%.h)
15407-extra-libs := librpcsvc
15408-extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass.
15409+extra-libs-$(OPTION_EGLIBC_SUNRPC) += librpcsvc
15410+# Make it in `others' pass, not `lib' pass.
15411+extra-libs-others-y += $(extra-libs-y)
15412 librpcsvc-routines = $(rpcsvc:%.x=x%)
15413 librpcsvc-inhibit-o = .os # Build no shared rpcsvc library.
15414 omit-deps = $(librpcsvc-routines)
15415Index: git/sysdeps/generic/ldsodefs.h
15416===================================================================
15417--- git.orig/sysdeps/generic/ldsodefs.h 2014-08-29 20:00:53.904070587 -0700
15418+++ git/sysdeps/generic/ldsodefs.h 2014-08-29 20:01:15.240070587 -0700
15419@@ -425,6 +425,12 @@
15420 # undef __rtld_global_attribute__
15421 #endif
15422
15423+#if __OPTION_EGLIBC_RTLD_DEBUG
15424+# define GLRO_dl_debug_mask GLRO(dl_debug_mask)
15425+#else
15426+# define GLRO_dl_debug_mask 0
15427+#endif
15428+
15429 #ifndef SHARED
15430 # define GLRO(name) _##name
15431 #else
15432@@ -437,8 +443,10 @@
15433 {
15434 #endif
15435
15436+#if __OPTION_EGLIBC_RTLD_DEBUG
15437 /* If nonzero the appropriate debug information is printed. */
15438 EXTERN int _dl_debug_mask;
15439+#endif
15440 #define DL_DEBUG_LIBS (1 << 0)
15441 #define DL_DEBUG_IMPCALLS (1 << 1)
15442 #define DL_DEBUG_BINDINGS (1 << 2)
15443Index: git/sysdeps/gnu/Makefile
15444===================================================================
15445--- git.orig/sysdeps/gnu/Makefile 2014-08-29 20:00:53.924070587 -0700
15446+++ git/sysdeps/gnu/Makefile 2014-08-29 20:01:15.240070587 -0700
15447@@ -57,7 +57,8 @@
15448 endif
15449
15450 ifeq ($(subdir),login)
15451-sysdep_routines += setutxent getutxent endutxent getutxid getutxline \
15452+sysdep_routines-$(OPTION_EGLIBC_UTMPX) \
15453+ += setutxent getutxent endutxent getutxid getutxline \
15454 pututxline utmpxname updwtmpx getutmpx getutmp
15455
15456 sysdep_headers += utmpx.h bits/utmpx.h
15457Index: git/sysdeps/ieee754/ldbl-opt/Makefile
15458===================================================================
15459--- git.orig/sysdeps/ieee754/ldbl-opt/Makefile 2014-08-29 20:00:54.452070587 -0700
15460+++ git/sysdeps/ieee754/ldbl-opt/Makefile 2014-08-29 20:01:15.244070587 -0700
15461@@ -11,19 +11,18 @@
15462 routines += math_ldbl_opt nldbl-compat
15463
15464 extra-libs += libnldbl
15465-libnldbl-calls = asprintf dprintf fprintf fscanf fwprintf fwscanf iovfscanf \
15466+libnldbl-calls = asprintf dprintf fprintf fscanf iovfscanf \
15467 obstack_printf obstack_vprintf printf scanf snprintf \
15468- sprintf sscanf swprintf swscanf vasprintf vdprintf vfprintf \
15469- vfscanf vfwprintf vfwscanf vprintf vscanf vsnprintf \
15470- vsprintf vsscanf vswprintf vswscanf vwprintf vwscanf \
15471- wprintf wscanf printf_fp printf_size \
15472- fprintf_chk fwprintf_chk printf_chk snprintf_chk sprintf_chk \
15473- swprintf_chk vfprintf_chk vfwprintf_chk vprintf_chk \
15474- vsnprintf_chk vsprintf_chk vswprintf_chk vwprintf_chk \
15475- wprintf_chk asprintf_chk vasprintf_chk dprintf_chk \
15476+ sprintf sscanf vasprintf vdprintf vfprintf \
15477+ vfscanf vprintf vscanf vsnprintf \
15478+ vsprintf vsscanf \
15479+ printf_fp printf_size \
15480+ fprintf_chk printf_chk snprintf_chk sprintf_chk \
15481+ vfprintf_chk vprintf_chk \
15482+ vsnprintf_chk vsprintf_chk \
15483+ asprintf_chk vasprintf_chk dprintf_chk \
15484 vdprintf_chk obstack_printf_chk obstack_vprintf_chk \
15485 syslog syslog_chk vsyslog vsyslog_chk \
15486- strfmon strfmon_l \
15487 strtold strtold_l strtoldint wcstold wcstold_l wcstoldint \
15488 qecvt qfcvt qgcvt qecvt_r qfcvt_r \
15489 isinf isnan finite signbit scalb log2 lgamma_r ceil \
15490@@ -38,9 +37,15 @@
15491 casinh cexp clog cproj csin csinh csqrt ctan ctanh cpow \
15492 cabs carg cimag creal clog10 \
15493 isoc99_scanf isoc99_fscanf isoc99_sscanf \
15494- isoc99_vscanf isoc99_vfscanf isoc99_vsscanf \
15495+ isoc99_vscanf isoc99_vfscanf isoc99_vsscanf
15496+libnldbl-calls-$(OPTION_EGLIBC_LOCALE_CODE) += strfmon strfmon_l
15497+libnldbl-calls-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) += fwprintf fwscanf \
15498+ swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
15499+ vwprintf vwscanf wprintf wscanf fwprintf_chk swprintf_chk \
15500+ vfwprintf_chk vswprintf_chk vwprintf_chk wprintf_chk \
15501 isoc99_wscanf isoc99_fwscanf isoc99_swscanf \
15502 isoc99_vwscanf isoc99_vfwscanf isoc99_vswscanf
15503+libnldbl-calls += $(libnldbl-calls-y)
15504 libnldbl-routines = $(libnldbl-calls:%=nldbl-%)
15505 libnldbl-inhibit-o = $(object-suffixes)
15506 libnldbl-static-only-routines = $(libnldbl-routines)
15507Index: git/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
15508===================================================================
15509--- git.orig/sysdeps/ieee754/ldbl-opt/nldbl-compat.c 2014-08-29 20:00:54.468070587 -0700
15510+++ git/sysdeps/ieee754/ldbl-opt/nldbl-compat.c 2014-08-29 20:01:15.244070587 -0700
15511@@ -26,6 +26,7 @@
15512 #include <locale/localeinfo.h>
15513 #include <sys/syslog.h>
15514 #include <bits/libc-lock.h>
15515+#include <gnu/option-groups.h>
15516
15517 #include "nldbl-compat.h"
15518
15519@@ -33,20 +34,14 @@
15520 libc_hidden_proto (__nldbl_vsscanf)
15521 libc_hidden_proto (__nldbl_vsprintf)
15522 libc_hidden_proto (__nldbl_vfscanf)
15523-libc_hidden_proto (__nldbl_vfwscanf)
15524 libc_hidden_proto (__nldbl_vdprintf)
15525-libc_hidden_proto (__nldbl_vswscanf)
15526-libc_hidden_proto (__nldbl_vfwprintf)
15527-libc_hidden_proto (__nldbl_vswprintf)
15528 libc_hidden_proto (__nldbl_vsnprintf)
15529 libc_hidden_proto (__nldbl_vasprintf)
15530 libc_hidden_proto (__nldbl_obstack_vprintf)
15531-libc_hidden_proto (__nldbl___vfwprintf_chk)
15532 libc_hidden_proto (__nldbl___vsnprintf_chk)
15533 libc_hidden_proto (__nldbl___vfprintf_chk)
15534 libc_hidden_proto (__nldbl___vsyslog_chk)
15535 libc_hidden_proto (__nldbl___vsprintf_chk)
15536-libc_hidden_proto (__nldbl___vswprintf_chk)
15537 libc_hidden_proto (__nldbl___vasprintf_chk)
15538 libc_hidden_proto (__nldbl___vdprintf_chk)
15539 libc_hidden_proto (__nldbl___obstack_vprintf_chk)
15540@@ -54,8 +49,17 @@
15541 libc_hidden_proto (__nldbl___vstrfmon_l)
15542 libc_hidden_proto (__nldbl___isoc99_vsscanf)
15543 libc_hidden_proto (__nldbl___isoc99_vfscanf)
15544+
15545+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15546+libc_hidden_proto (__nldbl_vfwscanf)
15547+libc_hidden_proto (__nldbl_vswscanf)
15548+libc_hidden_proto (__nldbl_vfwprintf)
15549+libc_hidden_proto (__nldbl_vswprintf)
15550+libc_hidden_proto (__nldbl___vfwprintf_chk)
15551+libc_hidden_proto (__nldbl___vswprintf_chk)
15552 libc_hidden_proto (__nldbl___isoc99_vswscanf)
15553 libc_hidden_proto (__nldbl___isoc99_vfwscanf)
15554+#endif
15555
15556 static void
15557 __nldbl_cleanup (void *arg)
15558@@ -117,6 +121,7 @@
15559 }
15560 weak_alias (__nldbl_fprintf, __nldbl__IO_fprintf)
15561
15562+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15563 int
15564 attribute_compat_text_section weak_function
15565 __nldbl_fwprintf (FILE *stream, const wchar_t *fmt, ...)
15566@@ -130,6 +135,7 @@
15567
15568 return done;
15569 }
15570+#endif
15571
15572 int
15573 attribute_compat_text_section
15574@@ -226,6 +232,7 @@
15575 return done;
15576 }
15577
15578+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15579 int
15580 attribute_compat_text_section
15581 __nldbl_swprintf (wchar_t *s, size_t n, const wchar_t *fmt, ...)
15582@@ -239,6 +246,7 @@
15583
15584 return done;
15585 }
15586+#endif
15587
15588 int
15589 attribute_compat_text_section weak_function
15590@@ -264,6 +272,7 @@
15591 }
15592 libc_hidden_def (__nldbl_vdprintf)
15593
15594+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15595 int
15596 attribute_compat_text_section weak_function
15597 __nldbl_vfwprintf (FILE *s, const wchar_t *fmt, va_list ap)
15598@@ -275,6 +284,7 @@
15599 return res;
15600 }
15601 libc_hidden_def (__nldbl_vfwprintf)
15602+#endif
15603
15604 int
15605 attribute_compat_text_section
15606@@ -297,6 +307,7 @@
15607 libc_hidden_def (__nldbl_vsnprintf)
15608 weak_alias (__nldbl_vsnprintf, __nldbl___vsnprintf)
15609
15610+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15611 int
15612 attribute_compat_text_section weak_function
15613 __nldbl_vswprintf (wchar_t *string, size_t maxlen, const wchar_t *fmt,
15614@@ -330,6 +341,7 @@
15615
15616 return done;
15617 }
15618+#endif
15619
15620 int
15621 attribute_compat_text_section
15622@@ -419,6 +431,7 @@
15623 return done;
15624 }
15625
15626+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15627 int
15628 attribute_compat_text_section
15629 __nldbl_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
15630@@ -491,6 +504,7 @@
15631
15632 return done;
15633 }
15634+#endif
15635
15636 int
15637 attribute_compat_text_section
15638@@ -506,6 +520,7 @@
15639 return done;
15640 }
15641
15642+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15643 int
15644 attribute_compat_text_section
15645 __nldbl___fwprintf_chk (FILE *stream, int flag, const wchar_t *fmt, ...)
15646@@ -519,6 +534,7 @@
15647
15648 return done;
15649 }
15650+#endif
15651
15652 int
15653 attribute_compat_text_section
15654@@ -563,6 +579,7 @@
15655 return done;
15656 }
15657
15658+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15659 int
15660 attribute_compat_text_section
15661 __nldbl___swprintf_chk (wchar_t *s, size_t n, int flag, size_t slen,
15662@@ -577,6 +594,7 @@
15663
15664 return done;
15665 }
15666+#endif
15667
15668 int
15669 attribute_compat_text_section
15670@@ -590,6 +608,7 @@
15671 }
15672 libc_hidden_def (__nldbl___vfprintf_chk)
15673
15674+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15675 int
15676 attribute_compat_text_section
15677 __nldbl___vfwprintf_chk (FILE *s, int flag, const wchar_t *fmt, va_list ap)
15678@@ -601,6 +620,7 @@
15679 return res;
15680 }
15681 libc_hidden_def (__nldbl___vfwprintf_chk)
15682+#endif
15683
15684 int
15685 attribute_compat_text_section
15686@@ -635,6 +655,7 @@
15687 }
15688 libc_hidden_def (__nldbl___vsprintf_chk)
15689
15690+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15691 int
15692 attribute_compat_text_section
15693 __nldbl___vswprintf_chk (wchar_t *string, size_t maxlen, int flag, size_t slen,
15694@@ -668,6 +689,7 @@
15695
15696 return done;
15697 }
15698+#endif
15699
15700 int
15701 attribute_compat_text_section
15702@@ -775,6 +797,7 @@
15703 return ___printf_fp (fp, &info_no_ldbl, args);
15704 }
15705
15706+#if __OPTION_EGLIBC_LOCALE_CODE
15707 ssize_t
15708 attribute_compat_text_section
15709 __nldbl_strfmon (char *s, size_t maxsize, const char *format, ...)
15710@@ -829,6 +852,7 @@
15711 return res;
15712 }
15713 libc_hidden_def (__nldbl___vstrfmon_l)
15714+#endif
15715
15716 void
15717 attribute_compat_text_section
15718@@ -941,6 +965,7 @@
15719 return done;
15720 }
15721
15722+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15723 int
15724 attribute_compat_text_section
15725 __nldbl___isoc99_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
15726@@ -1014,6 +1039,7 @@
15727
15728 return done;
15729 }
15730+#endif
15731
15732 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
15733 compat_symbol (libc, __nldbl__IO_printf, _IO_printf, GLIBC_2_0);
15734@@ -1057,6 +1083,7 @@
15735 compat_symbol (libc, __nldbl___strfmon_l, __strfmon_l, GLIBC_2_1);
15736 #endif
15737 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_2)
15738+# ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15739 compat_symbol (libc, __nldbl_swprintf, swprintf, GLIBC_2_2);
15740 compat_symbol (libc, __nldbl_vwprintf, vwprintf, GLIBC_2_2);
15741 compat_symbol (libc, __nldbl_wprintf, wprintf, GLIBC_2_2);
15742@@ -1069,6 +1096,7 @@
15743 compat_symbol (libc, __nldbl_vswscanf, vswscanf, GLIBC_2_2);
15744 compat_symbol (libc, __nldbl_vwscanf, vwscanf, GLIBC_2_2);
15745 compat_symbol (libc, __nldbl_wscanf, wscanf, GLIBC_2_2);
15746+# endif
15747 #endif
15748 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3)
15749 compat_symbol (libc, __nldbl_strfmon_l, strfmon_l, GLIBC_2_3);
15750Index: git/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
15751===================================================================
15752--- git.orig/sysdeps/ieee754/ldbl-opt/nldbl-compat.h 2014-08-29 20:00:54.468070587 -0700
15753+++ git/sysdeps/ieee754/ldbl-opt/nldbl-compat.h 2014-08-29 20:01:15.244070587 -0700
15754@@ -30,6 +30,7 @@
15755 #include <math.h>
15756 #include <monetary.h>
15757 #include <sys/syslog.h>
15758+#include <gnu/option-groups.h>
15759
15760
15761 /* Declare the __nldbl_NAME function the wrappers call that's in libc.so. */
15762@@ -37,19 +38,15 @@
15763
15764 NLDBL_DECL (_IO_vfscanf);
15765 NLDBL_DECL (vfscanf);
15766-NLDBL_DECL (vfwscanf);
15767 NLDBL_DECL (obstack_vprintf);
15768 NLDBL_DECL (vasprintf);
15769 NLDBL_DECL (dprintf);
15770 NLDBL_DECL (vdprintf);
15771 NLDBL_DECL (fprintf);
15772 NLDBL_DECL (vfprintf);
15773-NLDBL_DECL (vfwprintf);
15774 NLDBL_DECL (vsnprintf);
15775 NLDBL_DECL (vsprintf);
15776 NLDBL_DECL (vsscanf);
15777-NLDBL_DECL (vswprintf);
15778-NLDBL_DECL (vswscanf);
15779 NLDBL_DECL (__asprintf);
15780 NLDBL_DECL (asprintf);
15781 NLDBL_DECL (__printf_fp);
15782@@ -66,12 +63,18 @@
15783 NLDBL_DECL (__isoc99_vscanf);
15784 NLDBL_DECL (__isoc99_vfscanf);
15785 NLDBL_DECL (__isoc99_vsscanf);
15786+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15787+NLDBL_DECL (vfwscanf);
15788+NLDBL_DECL (vfwprintf);
15789+NLDBL_DECL (vswprintf);
15790+NLDBL_DECL (vswscanf);
15791 NLDBL_DECL (__isoc99_wscanf);
15792 NLDBL_DECL (__isoc99_fwscanf);
15793 NLDBL_DECL (__isoc99_swscanf);
15794 NLDBL_DECL (__isoc99_vwscanf);
15795 NLDBL_DECL (__isoc99_vfwscanf);
15796 NLDBL_DECL (__isoc99_vswscanf);
15797+#endif
15798
15799 /* This one does not exist in the normal interface, only
15800 __nldbl___vstrfmon really exists. */
15801@@ -82,22 +85,23 @@
15802 since we don't compile with _FORTIFY_SOURCE. */
15803 extern int __nldbl___vfprintf_chk (FILE *__restrict, int,
15804 const char *__restrict, _G_va_list);
15805-extern int __nldbl___vfwprintf_chk (FILE *__restrict, int,
15806- const wchar_t *__restrict, __gnuc_va_list);
15807 extern int __nldbl___vsprintf_chk (char *__restrict, int, size_t,
15808 const char *__restrict, _G_va_list) __THROW;
15809 extern int __nldbl___vsnprintf_chk (char *__restrict, size_t, int, size_t,
15810 const char *__restrict, _G_va_list)
15811 __THROW;
15812-extern int __nldbl___vswprintf_chk (wchar_t *__restrict, size_t, int, size_t,
15813- const wchar_t *__restrict, __gnuc_va_list)
15814- __THROW;
15815 extern int __nldbl___vasprintf_chk (char **, int, const char *, _G_va_list)
15816 __THROW;
15817 extern int __nldbl___vdprintf_chk (int, int, const char *, _G_va_list);
15818 extern int __nldbl___obstack_vprintf_chk (struct obstack *, int, const char *,
15819 _G_va_list) __THROW;
15820 extern void __nldbl___vsyslog_chk (int, int, const char *, va_list);
15821-
15822+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15823+extern int __nldbl___vfwprintf_chk (FILE *__restrict, int,
15824+ const wchar_t *__restrict, __gnuc_va_list);
15825+extern int __nldbl___vswprintf_chk (wchar_t *__restrict, size_t, int, size_t,
15826+ const wchar_t *__restrict, __gnuc_va_list)
15827+ __THROW;
15828+#endif
15829
15830 #endif /* __NLDBL_COMPAT_H */
15831Index: git/sysdeps/unix/sysv/linux/gethostid.c
15832===================================================================
15833--- git.orig/sysdeps/unix/sysv/linux/gethostid.c 2014-08-29 20:00:58.840070587 -0700
15834+++ git/sysdeps/unix/sysv/linux/gethostid.c 2014-08-29 20:01:15.244070587 -0700
15835@@ -21,6 +21,7 @@
15836 #include <unistd.h>
15837 #include <netdb.h>
15838 #include <not-cancel.h>
15839+#include <gnu/option-groups.h>
15840
15841 #define HOSTIDFILE "/etc/hostid"
15842
15843@@ -89,6 +90,7 @@
15844 return id;
15845 }
15846
15847+#if __OPTION_EGLIBC_INET
15848 /* Getting from the file was not successful. An intelligent guess for
15849 a unique number of a host is its IP address. Return this. */
15850 if (__gethostname (hostname, MAXHOSTNAMELEN) < 0 || hostname[0] == '\0')
15851@@ -115,5 +117,9 @@
15852 /* For the return value to be not exactly the IP address we do some
15853 bit fiddling. */
15854 return (int32_t) (in.s_addr << 16 | in.s_addr >> 16);
15855+#else
15856+ /* Return an arbitrary value. */
15857+ return 0;
15858+#endif
15859 }
15860 #endif
15861Index: git/sysdeps/unix/sysv/linux/libc_fatal.c
15862===================================================================
15863--- git.orig/sysdeps/unix/sysv/linux/libc_fatal.c 2014-08-29 20:00:58.980070587 -0700
15864+++ git/sysdeps/unix/sysv/linux/libc_fatal.c 2014-08-29 20:01:15.244070587 -0700
15865@@ -23,6 +23,7 @@
15866 #include <string.h>
15867 #include <sys/mman.h>
15868 #include <sys/uio.h>
15869+#include <gnu/option-groups.h>
15870
15871 static bool
15872 writev_for_fatal (int fd, const struct iovec *iov, size_t niov, size_t total)
15873@@ -40,6 +41,7 @@
15874 static void
15875 backtrace_and_maps (int do_abort, bool written, int fd)
15876 {
15877+#if __OPTION_EGLIBC_BACKTRACE
15878 if (do_abort > 1 && written)
15879 {
15880 void *addrs[64];
15881@@ -62,6 +64,7 @@
15882 close_not_cancel_no_status (fd2);
15883 }
15884 }
15885+#endif /* __OPTION_EGLIBC_BACKTRACE */
15886 }
15887 #define BEFORE_ABORT backtrace_and_maps
15888
15889Index: git/time/Makefile
15890===================================================================
15891--- git.orig/time/Makefile 2014-08-29 20:00:59.504070587 -0700
15892+++ git/time/Makefile 2014-08-29 20:01:15.244070587 -0700
15893@@ -18,6 +18,8 @@
15894 #
15895 # Makefile for time routines
15896 #
15897+include ../option-groups.mak
15898+
15899 subdir := time
15900
15901 include ../Makeconfig
15902@@ -30,14 +32,20 @@
15903 tzfile getitimer setitimer \
15904 stime dysize timegm ftime \
15905 getdate strptime strptime_l \
15906- strftime wcsftime strftime_l wcsftime_l \
15907+ strftime strftime_l \
15908 timespec_get
15909-aux := era alt_digit lc-time-cleanup
15910+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
15911+ := wcsftime wcsftime_l
15912+aux-$(OPTION_EGLIBC_LOCALE_CODE) += alt_digit era lc-time-cleanup
15913
15914-tests := test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
15915- tst-getdate tst-mktime tst-mktime2 tst-ftime_l tst-strftime \
15916+tests := test_time clocktest tst-posixtz \
15917+ tst-getdate tst-mktime tst-mktime2 tst-strftime \
15918 tst-mktime3 tst-strptime2 bug-asctime bug-asctime_r bug-mktime1 \
15919 tst-strptime3 bug-getdate1 tst-strptime-whitespace
15920+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
15921+ += tst-strptime tst-ftime_l
15922+tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
15923+ += tst_wcsftime
15924
15925 include ../Rules
15926
15927Index: git/time/strftime_l.c
15928===================================================================
15929--- git.orig/time/strftime_l.c 2014-08-29 20:00:59.528070587 -0700
15930+++ git/time/strftime_l.c 2014-08-29 20:01:15.244070587 -0700
15931@@ -35,6 +35,10 @@
15932 # include "../locale/localeinfo.h"
15933 #endif
15934
15935+#ifdef _LIBC
15936+# include <gnu/option-groups.h>
15937+#endif
15938+
15939 #if defined emacs && !defined HAVE_BCOPY
15940 # define HAVE_MEMCPY 1
15941 #endif
15942@@ -882,7 +886,7 @@
15943 case L_('C'):
15944 if (modifier == L_('E'))
15945 {
15946-#if HAVE_STRUCT_ERA_ENTRY
15947+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && HAVE_STRUCT_ERA_ENTRY
15948 struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
15949 if (era)
15950 {
15951@@ -955,7 +959,7 @@
15952
15953 if (modifier == L_('O') && 0 <= number_value)
15954 {
15955-#ifdef _NL_CURRENT
15956+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && defined (_NL_CURRENT)
15957 /* Get the locale specific alternate representation of
15958 the number NUMBER_VALUE. If none exist NULL is returned. */
15959 const CHAR_T *cp = nl_get_alt_digit (number_value
15960@@ -1260,7 +1264,7 @@
15961 case L_('Y'):
15962 if (modifier == 'E')
15963 {
15964-#if HAVE_STRUCT_ERA_ENTRY
15965+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && HAVE_STRUCT_ERA_ENTRY
15966 struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
15967 if (era)
15968 {
15969@@ -1285,7 +1289,7 @@
15970 case L_('y'):
15971 if (modifier == L_('E'))
15972 {
15973-#if HAVE_STRUCT_ERA_ENTRY
15974+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && HAVE_STRUCT_ERA_ENTRY
15975 struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
15976 if (era)
15977 {
15978Index: git/time/strptime_l.c
15979===================================================================
15980--- git.orig/time/strptime_l.c 2014-08-29 20:00:59.528070587 -0700
15981+++ git/time/strptime_l.c 2014-08-29 20:01:15.244070587 -0700
15982@@ -29,6 +29,7 @@
15983
15984 #ifdef _LIBC
15985 # define HAVE_LOCALTIME_R 0
15986+# include <gnu/option-groups.h>
15987 # include "../locale/localeinfo.h"
15988 #endif
15989
15990@@ -84,7 +85,7 @@
15991 if (val < from || val > to) \
15992 return NULL; \
15993 } while (0)
15994-#ifdef _NL_CURRENT
15995+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && defined (_NL_CURRENT)
15996 # define get_alt_number(from, to, n) \
15997 ({ \
15998 __label__ do_normal; \
15999@@ -820,6 +821,7 @@
16000 s.want_xday = 1;
16001 break;
16002 case 'C':
16003+#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
16004 if (s.decided != raw)
16005 {
16006 if (s.era_cnt >= 0)
16007@@ -856,10 +858,12 @@
16008
16009 s.decided = raw;
16010 }
16011+#endif
16012 /* The C locale has no era information, so use the
16013 normal representation. */
16014 goto match_century;
16015 case 'y':
16016+#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
16017 if (s.decided != raw)
16018 {
16019 get_number(0, 9999, 4);
16020@@ -918,9 +922,10 @@
16021
16022 s.decided = raw;
16023 }
16024-
16025+#endif
16026 goto match_year_in_century;
16027 case 'Y':
16028+#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
16029 if (s.decided != raw)
16030 {
16031 num_eras = _NL_CURRENT_WORD (LC_TIME,
16032@@ -948,6 +953,7 @@
16033
16034 s.decided = raw;
16035 }
16036+#endif
16037 get_number (0, 9999, 4);
16038 tm->tm_year = val - 1900;
16039 s.want_century = 0;
16040@@ -1118,6 +1124,7 @@
16041 tm->tm_year = (s.century - 19) * 100;
16042 }
16043
16044+#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
16045 if (s.era_cnt != -1)
16046 {
16047 era = _nl_select_era_entry (s.era_cnt HELPER_LOCALE_ARG);
16048@@ -1132,6 +1139,7 @@
16049 tm->tm_year = era->start_date[0];
16050 }
16051 else
16052+#endif
16053 if (s.want_era)
16054 {
16055 /* No era found but we have seen an E modifier. Rectify some
16056Index: git/timezone/Makefile
16057===================================================================
16058--- git.orig/timezone/Makefile 2014-08-29 20:01:14.044070587 -0700
16059+++ git/timezone/Makefile 2014-08-29 20:01:15.244070587 -0700
16060@@ -115,7 +115,7 @@
16061
16062 $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
16063 sed -e 's|/bin/bash|/bin/sh|' \
16064- -e 's|TZDIR=[^}]*|TZDIR=$(zonedir)|' \
16065+ -e '/TZDIR=/s|\$$(pwd)|$(zonedir)|' \
16066 -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \
16067 -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \
16068 -e '/REPORT_BUGS_TO=/s|=.*|="$(REPORT_BUGS_TO)"|' \
16069Index: git/wcsmbs/Makefile
16070===================================================================
16071--- git.orig/wcsmbs/Makefile 2014-08-29 20:00:59.548070587 -0700
16072+++ git/wcsmbs/Makefile 2014-08-29 20:01:15.244070587 -0700
16073@@ -18,15 +18,21 @@
16074 #
16075 # Sub-makefile for wcsmbs portion of the library.
16076 #
16077+include ../option-groups.mak
16078+
16079 subdir := wcsmbs
16080
16081 include ../Makeconfig
16082
16083 headers := wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h
16084
16085-routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
16086+# These functions are used by printf_fp.c, even in the plain case; see
16087+# comments there for OPTION_EGLIBC_LOCALE_CODE.
16088+routines := wmemcpy wmemset
16089+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
16090+ := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
16091 wcsncmp wcsncpy wcspbrk wcsrchr wcsspn wcstok wcsstr wmemchr \
16092- wmemcmp wmemcpy wmemmove wmemset wcpcpy wcpncpy wmempcpy \
16093+ wmemcmp wmemmove wcpcpy wcpncpy wmempcpy \
16094 btowc wctob mbsinit \
16095 mbrlen mbrtowc wcrtomb mbsrtowcs wcsrtombs \
16096 mbsnrtowcs wcsnrtombs wcsnlen wcschrnul \
16097@@ -38,14 +44,19 @@
16098 wcscoll_l wcsxfrm_l \
16099 wcscasecmp wcsncase wcscasecmp_l wcsncase_l \
16100 wcsmbsload mbsrtowcs_l \
16101- isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf \
16102 isoc99_swscanf isoc99_vswscanf \
16103 mbrtoc16 c16rtomb
16104+routines-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
16105+ += isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf
16106
16107 strop-tests := wcscmp wmemcmp wcslen wcschr wcsrchr wcscpy
16108-tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen tst-btowc tst-mbrtowc \
16109- tst-wcrtomb tst-wcpncpy tst-mbsrtowcs tst-wchar-h tst-mbrtowc2 \
16110- tst-c16c32-1 wcsatcliff $(addprefix test-,$(strop-tests))
16111+tests := tst-wchar-h
16112+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
16113+ += tst-btowc tst-mbrtowc tst-mbrtowc2 tst-wcrtomb tst-c16c32-1
16114+tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
16115+ += tst-wcstof wcsmbs-tst1 tst-wcsnlen \
16116+ tst-wcpncpy tst-mbsrtowcs \
16117+ wcsatcliff $(addprefix test-,$(strop-tests))
16118 tests-ifunc := $(strop-tests:%=test-%-ifunc)
16119 tests += $(tests-ifunc)
16120
16121Index: git/wcsmbs/wcsmbsload.c
16122===================================================================
16123--- git.orig/wcsmbs/wcsmbsload.c 2014-08-29 20:00:59.580070587 -0700
16124+++ git/wcsmbs/wcsmbsload.c 2014-08-29 20:01:15.248070587 -0700
16125@@ -21,6 +21,7 @@
16126 #include <limits.h>
16127 #include <stdlib.h>
16128 #include <string.h>
16129+#include <gnu/option-groups.h>
16130
16131 #include <locale/localeinfo.h>
16132 #include <wcsmbsload.h>
16133@@ -143,6 +144,7 @@
16134 })
16135
16136
16137+#if __OPTION_EGLIBC_LOCALE_CODE
16138 /* Some of the functions here must not be used while setlocale is called. */
16139 __libc_rwlock_define (extern, __libc_setlocale_lock attribute_hidden)
16140
16141@@ -211,6 +213,17 @@
16142
16143 __libc_rwlock_unlock (__libc_setlocale_lock);
16144 }
16145+#else
16146+void
16147+internal_function
16148+__wcsmbs_load_conv (struct __locale_data *new_category)
16149+{
16150+ /* When OPTION_EGLIBC_LOCALE_CODE is disabled, we should never reach
16151+ this point: there is no way to change locales, so every locale
16152+ passed to get_gconv_fcts should be _nl_C_LC_CTYPE. */
16153+ abort ();
16154+}
16155+#endif
16156
16157
16158 /* Clone the current conversion function set. */
16159Index: git/wctype/Makefile
16160===================================================================
16161--- git.orig/wctype/Makefile 2014-08-29 20:00:59.584070587 -0700
16162+++ git/wctype/Makefile 2014-08-29 20:01:15.248070587 -0700
16163@@ -18,14 +18,20 @@
16164 #
16165 # Sub-makefile for wctype portion of the library.
16166 #
16167+include ../option-groups.mak
16168+
16169 subdir := wctype
16170
16171 include ../Makeconfig
16172
16173 headers := wctype.h
16174-routines := wcfuncs wctype iswctype wctrans towctrans \
16175- wcfuncs_l wctype_l iswctype_l wctrans_l towctrans_l
16176+routines := wctrans towctrans towctrans_l
16177+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
16178+ := wcfuncs wctype iswctype \
16179+ wcfuncs_l wctype_l iswctype_l wctrans_l
16180
16181-tests := test_wctype test_wcfuncs bug-wctypeh
16182+tests :=
16183+tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
16184+ += test_wctype test_wcfuncs bug-wctypeh
16185
16186 include ../Rules
16187Index: git/sysdeps/nptl/Makefile
16188===================================================================
16189--- git.orig/sysdeps/nptl/Makefile 2014-08-29 20:00:58.036070587 -0700
16190+++ git/sysdeps/nptl/Makefile 2014-08-29 20:01:15.248070587 -0700
16191@@ -18,6 +18,9 @@
16192
16193 ifeq ($(subdir),nptl)
16194 libpthread-sysdep_routines += errno-loc
16195+ifeq ($(OPTION_EGLIBC_BIG_MACROS),n)
16196+sysdep_routines += small-macros-fns
16197+endif
16198 endif
16199
16200 ifeq ($(subdir),rt)
16201Index: git/sysdeps/nptl/bits/libc-lock.h
16202===================================================================
16203--- git.orig/sysdeps/nptl/bits/libc-lock.h 2014-08-29 20:00:58.036070587 -0700
16204+++ git/sysdeps/nptl/bits/libc-lock.h 2014-08-29 20:01:15.248070587 -0700
16205@@ -24,6 +24,14 @@
16206 #include <stddef.h>
16207
16208
16209+#ifdef _LIBC
16210+# include <lowlevellock.h>
16211+# include <tls.h>
16212+# include <pthread-functions.h>
16213+# include <errno.h> /* For EBUSY. */
16214+# include <gnu/option-groups.h> /* For __OPTION_EGLIBC_BIG_MACROS. */
16215+#endif
16216+
16217 /* Mutex type. */
16218 #if defined _LIBC || defined _IO_MTSAFE_IO
16219 # if (defined NOT_IN_libc && !defined IS_IN_libpthread) || !defined _LIBC
16220@@ -87,6 +95,14 @@
16221
16222 /* Lock the recursive named lock variable. */
16223 #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread)
16224+# if __OPTION_EGLIBC_BIG_MACROS != 1
16225+/* EGLIBC: Declare wrapper function for a big macro if either
16226+ !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from
16227+ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
16228+extern void __libc_lock_lock_recursive_fn (__libc_lock_recursive_t *);
16229+libc_hidden_proto (__libc_lock_lock_recursive_fn);
16230+# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
16231+# if __OPTION_EGLIBC_BIG_MACROS
16232 # define __libc_lock_lock_recursive(NAME) \
16233 do { \
16234 void *self = THREAD_SELF; \
16235@@ -97,6 +113,10 @@
16236 } \
16237 ++(NAME).cnt; \
16238 } while (0)
16239+# else
16240+# define __libc_lock_lock_recursive(NAME) \
16241+ __libc_lock_lock_recursive_fn (&(NAME))
16242+# endif /* __OPTION_EGLIBC_BIG_MACROS */
16243 #else
16244 # define __libc_lock_lock_recursive(NAME) \
16245 __libc_maybe_call (__pthread_mutex_lock, (&(NAME).mutex), 0)
16246@@ -104,6 +124,14 @@
16247
16248 /* Try to lock the recursive named lock variable. */
16249 #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread)
16250+# if __OPTION_EGLIBC_BIG_MACROS != 1
16251+/* EGLIBC: Declare wrapper function for a big macro if either
16252+ !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from
16253+ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
16254+extern int __libc_lock_trylock_recursive_fn (__libc_lock_recursive_t *);
16255+libc_hidden_proto (__libc_lock_trylock_recursive_fn);
16256+# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
16257+# if __OPTION_EGLIBC_BIG_MACROS
16258 # define __libc_lock_trylock_recursive(NAME) \
16259 ({ \
16260 int result = 0; \
16261@@ -122,6 +150,10 @@
16262 ++(NAME).cnt; \
16263 result; \
16264 })
16265+# else
16266+# define __libc_lock_trylock_recursive(NAME) \
16267+ __libc_lock_trylock_recursive_fn (&(NAME))
16268+# endif /* __OPTION_EGLIBC_BIG_MACROS */
16269 #else
16270 # define __libc_lock_trylock_recursive(NAME) \
16271 __libc_maybe_call (__pthread_mutex_trylock, (&(NAME).mutex), 0)
16272@@ -129,6 +161,14 @@
16273
16274 /* Unlock the recursive named lock variable. */
16275 #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread)
16276+# if __OPTION_EGLIBC_BIG_MACROS != 1
16277+/* EGLIBC: Declare wrapper function for a big macro if either
16278+ !__OPTION_EGLIBC_BIG_MACROS, or we are using a back door from
16279+ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
16280+extern void __libc_lock_unlock_recursive_fn (__libc_lock_recursive_t *);
16281+libc_hidden_proto (__libc_lock_unlock_recursive_fn);
16282+# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
16283+# if __OPTION_EGLIBC_BIG_MACROS
16284 /* We do no error checking here. */
16285 # define __libc_lock_unlock_recursive(NAME) \
16286 do { \
16287@@ -138,6 +178,10 @@
16288 lll_unlock ((NAME).lock, LLL_PRIVATE); \
16289 } \
16290 } while (0)
16291+# else
16292+# define __libc_lock_unlock_recursive(NAME) \
16293+ __libc_lock_unlock_recursive_fn (&(NAME))
16294+# endif /* __OPTION_EGLIBC_BIG_MACROS */
16295 #else
16296 # define __libc_lock_unlock_recursive(NAME) \
16297 __libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0)
16298Index: git/sysdeps/nptl/bits/libc-lockP.h
16299===================================================================
16300--- git.orig/sysdeps/nptl/bits/libc-lockP.h 2014-08-29 20:00:58.044070587 -0700
16301+++ git/sysdeps/nptl/bits/libc-lockP.h 2014-08-29 20:01:15.248070587 -0700
16302@@ -33,6 +33,8 @@
16303 #include <lowlevellock.h>
16304 #include <tls.h>
16305 #include <pthread-functions.h>
16306+#include <errno.h> /* For EBUSY. */
16307+#include <gnu/option-groups.h> /* For __OPTION_EGLIBC_BIG_MACROS. */
16308
16309 /* Mutex type. */
16310 #if defined NOT_IN_libc && !defined IS_IN_libpthread
16311@@ -159,10 +161,22 @@
16312
16313 /* Lock the named lock variable. */
16314 #if !defined NOT_IN_libc || defined IS_IN_libpthread
16315-# ifndef __libc_lock_lock
16316-# define __libc_lock_lock(NAME) \
16317+# if __OPTION_EGLIBC_BIG_MACROS != 1
16318+/* EGLIBC: Declare wrapper function for a big macro if either
16319+ !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from
16320+ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
16321+extern void __libc_lock_lock_fn (__libc_lock_t *);
16322+libc_hidden_proto (__libc_lock_lock_fn);
16323+# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
16324+# if __OPTION_EGLIBC_BIG_MACROS
16325+# ifndef __libc_lock_lock
16326+# define __libc_lock_lock(NAME) \
16327 ({ lll_lock (NAME, LLL_PRIVATE); 0; })
16328-# endif
16329+# endif
16330+# else
16331+# define __libc_lock_lock(NAME) \
16332+ __libc_lock_lock_fn (&(NAME))
16333+# endif /* __OPTION_EGLIBC_BIG_MACROS */
16334 #else
16335 # undef __libc_lock_lock
16336 # define __libc_lock_lock(NAME) \
16337@@ -175,10 +189,22 @@
16338
16339 /* Try to lock the named lock variable. */
16340 #if !defined NOT_IN_libc || defined IS_IN_libpthread
16341-# ifndef __libc_lock_trylock
16342-# define __libc_lock_trylock(NAME) \
16343+# if __OPTION_EGLIBC_BIG_MACROS != 1
16344+/* EGLIBC: Declare wrapper function for a big macro if either
16345+ !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from
16346+ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
16347+extern int __libc_lock_trylock_fn (__libc_lock_t *);
16348+libc_hidden_proto (__libc_lock_trylock_fn);
16349+# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
16350+# if __OPTION_EGLIBC_BIG_MACROS
16351+# ifndef __libc_lock_trylock
16352+# define __libc_lock_trylock(NAME) \
16353 lll_trylock (NAME)
16354-# endif
16355+# endif
16356+# else
16357+# define __libc_lock_trylock(NAME) \
16358+ __libc_lock_trylock_fn (&(NAME))
16359+# endif /* __OPTION_EGLIBC_BIG_MACROS */
16360 #else
16361 # undef __libc_lock_trylock
16362 # define __libc_lock_trylock(NAME) \
16363@@ -194,8 +220,20 @@
16364
16365 /* Unlock the named lock variable. */
16366 #if !defined NOT_IN_libc || defined IS_IN_libpthread
16367+# if __OPTION_EGLIBC_BIG_MACROS != 1
16368+/* EGLIBC: Declare wrapper function for a big macro if either
16369+ !__OPTION_EGLIBC_BIG_MACROS, or we are using a back door from
16370+ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
16371+extern void __libc_lock_unlock_fn (__libc_lock_t *);
16372+libc_hidden_proto (__libc_lock_unlock_fn);
16373+# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
16374+# if __OPTION_EGLIBC_BIG_MACROS
16375 # define __libc_lock_unlock(NAME) \
16376 lll_unlock (NAME, LLL_PRIVATE)
16377+# else
16378+# define __libc_lock_unlock(NAME) \
16379+ __libc_lock_unlock_fn (&(NAME))
16380+# endif /* __OPTION_EGLIBC_BIG_MACROS */
16381 #else
16382 # define __libc_lock_unlock(NAME) \
16383 __libc_maybe_call (__pthread_mutex_unlock, (&(NAME)), 0)
16384Index: git/sysdeps/nptl/small-macros-fns.c
16385===================================================================
16386--- /dev/null 1970-01-01 00:00:00.000000000 +0000
16387+++ git/sysdeps/nptl/small-macros-fns.c 2014-08-29 20:01:15.248070587 -0700
16388@@ -0,0 +1,72 @@
16389+/* EGLIBC: function wrappers for big macros.
16390+ Copyright (C) 2009 Free Software Foundation, Inc.
16391+ This file is part of the GNU C Library.
16392+
16393+ The GNU C Library is free software; you can redistribute it and/or
16394+ modify it under the terms of the GNU Lesser General Public License as
16395+ published by the Free Software Foundation; either version 2.1 of the
16396+ License, or (at your option) any later version.
16397+
16398+ The GNU C Library is distributed in the hope that it will be useful,
16399+ but WITHOUT ANY WARRANTY; without even the implied warranty of
16400+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16401+ Lesser General Public License for more details.
16402+
16403+ You should have received a copy of the GNU Lesser General Public
16404+ License along with the GNU C Library; see the file COPYING.LIB. If not,
16405+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16406+ Boston, MA 02111-1307, USA. */
16407+
16408+#include <gnu/option-groups.h>
16409+
16410+/* Handle macros from ./bits/libc-lock.h. */
16411+#if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread)
16412+
16413+/* Get the macros for function bodies through a back door. */
16414+# undef __OPTION_EGLIBC_BIG_MACROS
16415+# define __OPTION_EGLIBC_BIG_MACROS 2
16416+# include <bits/libc-lock.h>
16417+
16418+void
16419+__libc_lock_lock_fn (__libc_lock_t *name)
16420+{
16421+ __libc_lock_lock (*name);
16422+}
16423+libc_hidden_def (__libc_lock_lock_fn);
16424+
16425+void
16426+__libc_lock_lock_recursive_fn (__libc_lock_recursive_t *name)
16427+{
16428+ __libc_lock_lock_recursive (*name);
16429+}
16430+libc_hidden_def (__libc_lock_lock_recursive_fn);
16431+
16432+int
16433+__libc_lock_trylock_fn (__libc_lock_t *name)
16434+{
16435+ return __libc_lock_trylock (*name);
16436+}
16437+libc_hidden_def (__libc_lock_trylock_fn);
16438+
16439+int
16440+__libc_lock_trylock_recursive_fn (__libc_lock_recursive_t *name)
16441+{
16442+ return __libc_lock_trylock_recursive (*name);
16443+}
16444+libc_hidden_def (__libc_lock_trylock_recursive_fn);
16445+
16446+void
16447+__libc_lock_unlock_fn (__libc_lock_t *name)
16448+{
16449+ __libc_lock_unlock (*name);
16450+}
16451+libc_hidden_def (__libc_lock_unlock_fn);
16452+
16453+void
16454+__libc_lock_unlock_recursive_fn (__libc_lock_recursive_t *name)
16455+{
16456+ __libc_lock_unlock_recursive (*name);
16457+}
16458+libc_hidden_def (__libc_lock_unlock_recursive_fn);
16459+
16460+#endif /*defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread)*/
16461Index: git/include/libc-symbols.h
16462===================================================================
16463--- git.orig/include/libc-symbols.h 2014-08-29 20:00:47.144070587 -0700
16464+++ git/include/libc-symbols.h 2014-08-29 20:01:15.248070587 -0700
16465@@ -60,8 +60,11 @@
16466 /* Define these macros for the benefit of portable GNU code that wants to check
16467 them. Of course, STDC_HEADERS is never false when building libc! */
16468 #define STDC_HEADERS 1
16469-#define HAVE_MBSTATE_T 1
16470-#define HAVE_MBSRTOWCS 1
16471+
16472+#if __OPTION_EGLIBC_LOCALE_CODE
16473+# define HAVE_MBSTATE_T 1
16474+# define HAVE_MBSRTOWCS 1
16475+#endif
16476 #define HAVE_LIBINTL_H 1
16477 #define HAVE_WCTYPE_H 1
16478 #define HAVE_ISWCTYPE 1
16479Index: git/crypt/crypt_common.c
16480===================================================================
16481--- /dev/null 1970-01-01 00:00:00.000000000 +0000
16482+++ git/crypt/crypt_common.c 2014-08-29 20:01:15.248070587 -0700
16483@@ -0,0 +1,42 @@
16484+/*
16485+ * crypt: crypt(3) implementation
16486+ *
16487+ * Copyright (C) 1991-2014 Free Software Foundation, Inc.
16488+ *
16489+ * This library is free software; you can redistribute it and/or
16490+ * modify it under the terms of the GNU Lesser General Public
16491+ * License as published by the Free Software Foundation; either
16492+ * version 2.1 of the License, or (at your option) any later version.
16493+ *
16494+ * This library is distributed in the hope that it will be useful,
16495+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16496+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16497+ * Lesser General Public License for more details.
16498+ *
16499+ * You should have received a copy of the GNU Lesser General Public
16500+ * License along with this library; see the file COPYING.LIB. If not,
16501+ * see <http://www.gnu.org/licenses/>.
16502+ *
16503+ * General Support routines
16504+ *
16505+ */
16506+
16507+#include "crypt-private.h"
16508+
16509+/* Table with characters for base64 transformation. */
16510+static const char b64t[64] =
16511+"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
16512+
16513+void
16514+__b64_from_24bit (char **cp, int *buflen,
16515+ unsigned int b2, unsigned int b1, unsigned int b0,
16516+ int n)
16517+{
16518+ unsigned int w = (b2 << 16) | (b1 << 8) | b0;
16519+ while (n-- > 0 && (*buflen) > 0)
16520+ {
16521+ *(*cp)++ = b64t[w & 0x3f];
16522+ --(*buflen);
16523+ w >>= 6;
16524+ }
16525+}
16526Index: git/crypt/crypt_util.c
16527===================================================================
16528--- git.orig/crypt/crypt_util.c 2014-08-29 20:00:43.028070587 -0700
16529+++ git/crypt/crypt_util.c 2014-08-29 20:01:15.248070587 -0700
16530@@ -242,10 +242,6 @@
16531 */
16532 static ufc_long efp[16][64][2];
16533
16534-/* Table with characters for base64 transformation. */
16535-static const char b64t[64] =
16536-"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
16537-
16538 /*
16539 * For use by the old, non-reentrant routines
16540 * (crypt/encrypt/setkey)
16541@@ -949,17 +945,3 @@
16542 {
16543 __setkey_r(__key, &_ufc_foobar);
16544 }
16545-
16546-void
16547-__b64_from_24bit (char **cp, int *buflen,
16548- unsigned int b2, unsigned int b1, unsigned int b0,
16549- int n)
16550-{
16551- unsigned int w = (b2 << 16) | (b1 << 8) | b0;
16552- while (n-- > 0 && (*buflen) > 0)
16553- {
16554- *(*cp)++ = b64t[w & 0x3f];
16555- --(*buflen);
16556- w >>= 6;
16557- }
16558-}
16559Index: git/sysdeps/arm/Makefile
16560===================================================================
16561--- git.orig/sysdeps/arm/Makefile 2014-08-29 20:29:37.000000000 -0700
16562+++ git/sysdeps/arm/Makefile 2014-08-29 20:31:09.904070587 -0700
16563@@ -37,10 +37,13 @@
16564 # get offset to rtld_global._dl_hwcap
16565 gen-as-const-headers += rtld-global-offsets.sym tlsdesc.sym
16566 aeabi_constants = aeabi_lcsts aeabi_sighandlers aeabi_math
16567-aeabi_routines = aeabi_assert aeabi_localeconv aeabi_errno_addr \
16568+aeabi_routines = aeabi_assert aeabi_errno_addr \
16569 aeabi_mb_cur_max aeabi_atexit aeabi_memclr aeabi_memcpy \
16570 aeabi_memmove aeabi_memset \
16571 aeabi_read_tp libc-aeabi_read_tp
16572+ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
16573+aeabi_routines += aeabi_localeconv
16574+endif
16575
16576 sysdep_routines += $(aeabi_constants) $(aeabi_routines)
16577 static-only-routines += $(aeabi_constants) aeabi_read_tp
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc.patch
new file mode 100644
index 0000000..fdfabc3
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/eglibc.patch
@@ -0,0 +1,602 @@
1Instruction documents from eglibc
2
3Upstream-Status: Pending
4
5Index: git/EGLIBC.cross-building
6===================================================================
7--- /dev/null 1970-01-01 00:00:00.000000000 +0000
8+++ git/EGLIBC.cross-building 2014-08-27 07:27:25.580070587 +0000
9@@ -0,0 +1,383 @@
10+ -*- mode: text -*-
11+
12+ Cross-Compiling EGLIBC
13+ Jim Blandy <jimb@codesourcery.com>
14+
15+
16+Introduction
17+
18+Most GNU tools have a simple build procedure: you run their
19+'configure' script, and then you run 'make'. Unfortunately, the
20+process of cross-compiling the GNU C library is quite a bit more
21+involved:
22+
23+1) Build a cross-compiler, with certain facilities disabled.
24+
25+2) Configure the C library using the compiler you built in step 1).
26+ Build a few of the C run-time object files, but not the rest of the
27+ library. Install the library's header files and the run-time
28+ object files, and create a dummy libc.so.
29+
30+3) Build a second cross-compiler, using the header files and object
31+ files you installed in step 2.
32+
33+4) Configure, build, and install a fresh C library, using the compiler
34+ built in step 3.
35+
36+5) Build a third cross-compiler, based on the C library built in step 4.
37+
38+The reason for this complexity is that, although GCC and the GNU C
39+library are distributed separately, they are not actually independent
40+of each other: GCC requires the C library's headers and some object
41+files to compile its own libraries, while the C library depends on
42+GCC's libraries. EGLIBC includes features and bug fixes to the stock
43+GNU C library that simplify this process, but the fundamental
44+interdependency stands.
45+
46+In this document, we explain how to cross-compile an EGLIBC/GCC pair
47+from source. Our intended audience is developers who are already
48+familiar with the GNU toolchain and comfortable working with
49+cross-development tools. While we do present a worked example to
50+accompany the explanation, for clarity's sake we do not cover many of
51+the options available to cross-toolchain users.
52+
53+
54+Preparation
55+
56+EGLIBC requires recent versions of the GNU binutils, GCC, and the
57+Linux kernel. The web page <http://www.eglibc.org/prerequisites>
58+documents the current requirements, and lists patches needed for
59+certain target architectures. As of this writing, these build
60+instructions have been tested with binutils 2.22.51, GCC 4.6.2,
61+and Linux 3.1.
62+
63+First, let's set some variables, to simplify later commands. We'll
64+build EGLIBC and GCC for an ARM target, known to the Linux kernel
65+as 'arm', and we'll do the build on an Intel x86_64 Linux box:
66+
67+ $ build=x86_64-pc-linux-gnu
68+ $ host=$build
69+ $ target=arm-none-linux-gnueabi
70+ $ linux_arch=arm
71+
72+We're using the aforementioned versions of Binutils, GCC, and Linux:
73+
74+ $ binutilsv=binutils-2.22.51
75+ $ gccv=gcc-4.6.2
76+ $ linuxv=linux-3.1
77+
78+We're carrying out the entire process under '~/cross-build', which
79+contains unpacked source trees for binutils, gcc, and linux kernel,
80+along with EGLIBC svn trunk (which can be checked-out with
81+'svn co http://www.eglibc.org/svn/trunk eglibc'):
82+
83+ $ top=$HOME/cross-build/$target
84+ $ src=$HOME/cross-build/src
85+ $ ls $src
86+ binutils-2.22.51 eglibc gcc-4.6.2 linux-3.1
87+
88+We're going to place our build directories in a subdirectory 'obj',
89+we'll install the cross-development toolchain in 'tools', and we'll
90+place our sysroot (containing files to be installed on the target
91+system) in 'sysroot':
92+
93+ $ obj=$top/obj
94+ $ tools=$top/tools
95+ $ sysroot=$top/sysroot
96+
97+
98+Binutils
99+
100+Configuring and building binutils for the target is straightforward:
101+
102+ $ mkdir -p $obj/binutils
103+ $ cd $obj/binutils
104+ $ $src/$binutilsv/configure \
105+ > --target=$target \
106+ > --prefix=$tools \
107+ > --with-sysroot=$sysroot
108+ $ make
109+ $ make install
110+
111+
112+The First GCC
113+
114+For our work, we need a cross-compiler targeting an ARM Linux
115+system. However, that configuration includes the shared library
116+'libgcc_s.so', which is compiled against the EGLIBC headers (which we
117+haven't installed yet) and linked against 'libc.so' (which we haven't
118+built yet).
119+
120+Fortunately, there are configuration options for GCC which tell it not
121+to build 'libgcc_s.so'. The '--without-headers' option is supposed to
122+take care of this, but its implementation is incomplete, so you must
123+also configure with the '--with-newlib' option. While '--with-newlib'
124+appears to mean "Use the Newlib C library", its effect is to tell the
125+GCC build machinery, "Don't assume there is a C library available."
126+
127+We also need to disable some of the libraries that would normally be
128+built along with GCC, and specify that only the compiler for the C
129+language is needed.
130+
131+So, we create a build directory, configure, make, and install.
132+
133+ $ mkdir -p $obj/gcc1
134+ $ cd $obj/gcc1
135+ $ $src/$gccv/configure \
136+ > --target=$target \
137+ > --prefix=$tools \
138+ > --without-headers --with-newlib \
139+ > --disable-shared --disable-threads --disable-libssp \
140+ > --disable-libgomp --disable-libmudflap --disable-libquadmath \
141+ > --disable-decimal-float --disable-libffi \
142+ > --enable-languages=c
143+ $ PATH=$tools/bin:$PATH make
144+ $ PATH=$tools/bin:$PATH make install
145+
146+
147+Linux Kernel Headers
148+
149+To configure EGLIBC, we also need Linux kernel headers in place.
150+Fortunately, the Linux makefiles have a target that installs them for
151+us. Since the process does modify the source tree a bit, we make a
152+copy first:
153+
154+ $ cp -r $src/$linuxv $obj/linux
155+ $ cd $obj/linux
156+
157+Now we're ready to install the headers into the sysroot:
158+
159+ $ PATH=$tools/bin:$PATH \
160+ > make headers_install \
161+ > ARCH=$linux_arch CROSS_COMPILE=$target- \
162+ > INSTALL_HDR_PATH=$sysroot/usr
163+
164+
165+EGLIBC Headers and Preliminary Objects
166+
167+Using the cross-compiler we've just built, we can now configure EGLIBC
168+well enough to install the headers and build the object files that the
169+full cross-compiler will need:
170+
171+ $ mkdir -p $obj/eglibc-headers
172+ $ cd $obj/eglibc-headers
173+ $ BUILD_CC=gcc \
174+ > CC=$tools/bin/$target-gcc \
175+ > CXX=$tools/bin/$target-g++ \
176+ > AR=$tools/bin/$target-ar \
177+ > RANLIB=$tools/bin/$target-ranlib \
178+ > $src/eglibc/libc/configure \
179+ > --prefix=/usr \
180+ > --with-headers=$sysroot/usr/include \
181+ > --build=$build \
182+ > --host=$target \
183+ > --disable-profile --without-gd --without-cvs \
184+ > --enable-add-ons=nptl,libidn,../ports
185+
186+The option '--prefix=/usr' may look strange, but you should never
187+configure EGLIBC with a prefix other than '/usr': in various places,
188+EGLIBC's build system checks whether the prefix is '/usr', and does
189+special handling only if that is the case. Unless you use this
190+prefix, you will get a sysroot that does not use the standard Linux
191+directory layouts and cannot be used as a basis for the root
192+filesystem on your target system compatibly with normal GLIBC
193+installations.
194+
195+The '--with-headers' option tells EGLIBC where the Linux headers have
196+been installed.
197+
198+The '--enable-add-ons=nptl,libidn,../ports' option tells EGLIBC to look
199+for the listed glibc add-ons. Most notably the ports add-on (located
200+just above the libc sources in the EGLIBC svn tree) is required to
201+support ARM targets.
202+
203+We can now use the 'install-headers' makefile target to install the
204+headers:
205+
206+ $ make install-headers install_root=$sysroot \
207+ > install-bootstrap-headers=yes
208+
209+The 'install_root' variable indicates where the files should actually
210+be installed; its value is treated as the parent of the '--prefix'
211+directory we passed to the configure script, so the headers will go in
212+'$sysroot/usr/include'. The 'install-bootstrap-headers' variable
213+requests special handling for certain tricky header files.
214+
215+Next, there are a few object files needed to link shared libraries,
216+which we build and install by hand:
217+
218+ $ mkdir -p $sysroot/usr/lib
219+ $ make csu/subdir_lib
220+ $ cp csu/crt1.o csu/crti.o csu/crtn.o $sysroot/usr/lib
221+
222+Finally, 'libgcc_s.so' requires a 'libc.so' to link against. However,
223+since we will never actually execute its code, it doesn't matter what
224+it contains. So, treating '/dev/null' as a C source file, we produce
225+a dummy 'libc.so' in one step:
226+
227+ $ $tools/bin/$target-gcc -nostdlib -nostartfiles -shared -x c /dev/null \
228+ > -o $sysroot/usr/lib/libc.so
229+
230+
231+The Second GCC
232+
233+With the EGLIBC headers and selected object files installed, we can
234+now build a GCC that is capable of compiling EGLIBC. We configure,
235+build, and install the second GCC, again building only the C compiler,
236+and avoiding libraries we won't use:
237+
238+ $ mkdir -p $obj/gcc2
239+ $ cd $obj/gcc2
240+ $ $src/$gccv/configure \
241+ > --target=$target \
242+ > --prefix=$tools \
243+ > --with-sysroot=$sysroot \
244+ > --disable-libssp --disable-libgomp --disable-libmudflap \
245+ > --disable-libffi --disable-libquadmath \
246+ > --enable-languages=c
247+ $ PATH=$tools/bin:$PATH make
248+ $ PATH=$tools/bin:$PATH make install
249+
250+
251+EGLIBC, Complete
252+
253+With the second compiler built and installed, we're now ready for the
254+full EGLIBC build:
255+
256+ $ mkdir -p $obj/eglibc
257+ $ cd $obj/eglibc
258+ $ BUILD_CC=gcc \
259+ > CC=$tools/bin/$target-gcc \
260+ > CXX=$tools/bin/$target-g++ \
261+ > AR=$tools/bin/$target-ar \
262+ > RANLIB=$tools/bin/$target-ranlib \
263+ > $src/eglibc/libc/configure \
264+ > --prefix=/usr \
265+ > --with-headers=$sysroot/usr/include \
266+ > --with-kconfig=$obj/linux/scripts/kconfig \
267+ > --build=$build \
268+ > --host=$target \
269+ > --disable-profile --without-gd --without-cvs \
270+ > --enable-add-ons=nptl,libidn,../ports
271+
272+Note the additional '--with-kconfig' option. This tells EGLIBC where to
273+find the host config tools used by the kernel 'make config' and 'make
274+menuconfig'. These tools can be re-used by EGLIBC for its own 'make
275+*config' support, which will create 'option-groups.config' for you.
276+But first make sure those tools have been built by running some
277+dummy 'make *config' calls in the kernel directory:
278+
279+ $ cd $obj/linux
280+ $ PATH=$tools/bin:$PATH make config \
281+ > ARCH=$linux_arch CROSS_COMPILE=$target- \
282+ $ PATH=$tools/bin:$PATH make menuconfig \
283+ > ARCH=$linux_arch CROSS_COMPILE=$target- \
284+
285+Now we can configure and build the full EGLIBC:
286+
287+ $ cd $obj/eglibc
288+ $ PATH=$tools/bin:$PATH make defconfig
289+ $ PATH=$tools/bin:$PATH make menuconfig
290+ $ PATH=$tools/bin:$PATH make
291+ $ PATH=$tools/bin:$PATH make install install_root=$sysroot
292+
293+At this point, we have a complete EGLIBC installation in '$sysroot',
294+with header files, library files, and most of the C runtime startup
295+files in place.
296+
297+
298+The Third GCC
299+
300+Finally, we recompile GCC against this full installation, enabling
301+whatever languages and libraries we would like to use:
302+
303+ $ mkdir -p $obj/gcc3
304+ $ cd $obj/gcc3
305+ $ $src/$gccv/configure \
306+ > --target=$target \
307+ > --prefix=$tools \
308+ > --with-sysroot=$sysroot \
309+ > --enable-__cxa_atexit \
310+ > --disable-libssp --disable-libgomp --disable-libmudflap \
311+ > --enable-languages=c,c++
312+ $ PATH=$tools/bin:$PATH make
313+ $ PATH=$tools/bin:$PATH make install
314+
315+The '--enable-__cxa_atexit' option tells GCC what sort of C++
316+destructor support to expect from the C library; it's required with
317+EGLIBC.
318+
319+And since GCC's installation process isn't designed to help construct
320+sysroot trees, we must manually copy certain libraries into place in
321+the sysroot.
322+
323+ $ cp -d $tools/$target/lib/libgcc_s.so* $sysroot/lib
324+ $ cp -d $tools/$target/lib/libstdc++.so* $sysroot/usr/lib
325+
326+
327+Trying Things Out
328+
329+At this point, '$tools' contains a cross toolchain ready to use
330+the EGLIBC installation in '$sysroot':
331+
332+ $ cat > hello.c <<EOF
333+ > #include <stdio.h>
334+ > int
335+ > main (int argc, char **argv)
336+ > {
337+ > puts ("Hello, world!");
338+ > return 0;
339+ > }
340+ > EOF
341+ $ $tools/bin/$target-gcc -Wall hello.c -o hello
342+ $ cat > c++-hello.cc <<EOF
343+ > #include <iostream>
344+ > int
345+ > main (int argc, char **argv)
346+ > {
347+ > std::cout << "Hello, C++ world!" << std::endl;
348+ > return 0;
349+ > }
350+ > EOF
351+ $ $tools/bin/$target-g++ -Wall c++-hello.cc -o c++-hello
352+
353+
354+We can use 'readelf' to verify that these are indeed executables for
355+our target, using our dynamic linker:
356+
357+ $ $tools/bin/$target-readelf -hl hello
358+ ELF Header:
359+ ...
360+ Type: EXEC (Executable file)
361+ Machine: ARM
362+
363+ ...
364+ Program Headers:
365+ Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
366+ PHDR 0x000034 0x10000034 0x10000034 0x00100 0x00100 R E 0x4
367+ INTERP 0x000134 0x00008134 0x00008134 0x00013 0x00013 R 0x1
368+ [Requesting program interpreter: /lib/ld-linux.so.3]
369+ LOAD 0x000000 0x00008000 0x00008000 0x0042c 0x0042c R E 0x8000
370+ ...
371+
372+Looking at the dynamic section of the installed 'libgcc_s.so', we see
373+that the 'NEEDED' entry for the C library does include the '.6'
374+suffix, indicating that was linked against our fully build EGLIBC, and
375+not our dummy 'libc.so':
376+
377+ $ $tools/bin/$target-readelf -d $sysroot/lib/libgcc_s.so.1
378+ Dynamic section at offset 0x1083c contains 24 entries:
379+ Tag Type Name/Value
380+ 0x00000001 (NEEDED) Shared library: [libc.so.6]
381+ 0x0000000e (SONAME) Library soname: [libgcc_s.so.1]
382+ ...
383+
384+
385+And on the target machine, we can run our programs:
386+
387+ $ $sysroot/lib/ld.so.1 --library-path $sysroot/lib:$sysroot/usr/lib \
388+ > ./hello
389+ Hello, world!
390+ $ $sysroot/lib/ld.so.1 --library-path $sysroot/lib:$sysroot/usr/lib \
391+ > ./c++-hello
392+ Hello, C++ world!
393Index: git/EGLIBC.cross-testing
394===================================================================
395--- /dev/null 1970-01-01 00:00:00.000000000 +0000
396+++ git/EGLIBC.cross-testing 2014-08-27 07:24:41.532070587 +0000
397@@ -0,0 +1,205 @@
398+ -*- mode: text -*-
399+
400+ Cross-Testing With EGLIBC
401+ Jim Blandy <jimb@codesourcery.com>
402+
403+
404+Introduction
405+
406+Developers writing software for embedded systems often use a desktop
407+or other similarly capable computer for development, but need to run
408+tests on the embedded system, or perhaps on a simulator. When
409+configured for cross-compilation, the stock GNU C library simply
410+disables running tests altogether: the command 'make tests' builds
411+test programs, but does not run them. EGLIBC, however, provides
412+facilities for compiling tests and generating data files on the build
413+system, but running the test programs themselves on a remote system or
414+simulator.
415+
416+
417+Test environment requirements
418+
419+The test environment must meet certain conditions for EGLIBC's
420+cross-testing facilities to work:
421+
422+- Shared filesystems. The 'build' system, on which you configure and
423+ compile EGLIBC, and the 'host' system, on which you intend to run
424+ EGLIBC, must share a filesystem containing the EGLIBC build and
425+ source trees. Files must appear at the same paths on both systems.
426+
427+- Remote-shell like invocation. There must be a way to run a program
428+ on the host system from the build system, passing it properly quoted
429+ command-line arguments, setting environment variables, and
430+ inheriting the caller's standard input and output.
431+
432+
433+Usage
434+
435+To use EGLIBC's cross-testing support, provide values for the
436+following Make variables when you invoke 'make':
437+
438+- cross-test-wrapper
439+
440+ This should be the name of the cross-testing wrapper command, along
441+ with any arguments.
442+
443+- cross-localedef
444+
445+ This should be the name of a cross-capable localedef program, like
446+ that included in the EGLIBC 'localedef' module, along with any
447+ arguments needed.
448+
449+These are each explained in detail below.
450+
451+
452+The Cross-Testing Wrapper
453+
454+To run test programs reliably, the stock GNU C library takes care to
455+ensure that test programs use the newly compiled dynamic linker and
456+shared libraries, and never the host system's installed libraries. To
457+accomplish this, it runs the tests by explicitly invoking the dynamic
458+linker from the build tree, passing it a list of build tree
459+directories to search for shared libraries, followed by the name of
460+the executable to run and its arguments.
461+
462+For example, where one might normally run a test program like this:
463+
464+ $ ./tst-foo arg1 arg2
465+
466+the GNU C library might run that program like this:
467+
468+ $ $objdir/elf/ld-linux.so.3 --library-path $objdir \
469+ ./tst-foo arg1 arg2
470+
471+(where $objdir is the path to the top of the build tree, and the
472+trailing backslash indicates a continuation of the command). In other
473+words, each test program invocation is 'wrapped up' inside an explicit
474+invocation of the dynamic linker, which must itself execute the test
475+program, having loaded shared libraries from the appropriate
476+directories.
477+
478+To support cross-testing, EGLIBC allows the developer to optionally
479+set the 'cross-test-wrapper' Make variable to another wrapper command,
480+to which it passes the entire dynamic linker invocation shown above as
481+arguments. For example, if the developer supplies a wrapper of
482+'my-wrapper hostname', then EGLIBC would run the test above as
483+follows:
484+
485+ $ my-wrapper hostname \
486+ $objdir/elf/ld-linux.so.3 --library-path $objdir \
487+ ./tst-foo arg1 arg2
488+
489+The 'my-wrapper' command is responsible for executing the command
490+given on the host system.
491+
492+Since tests are run in varying directories, the wrapper should either
493+be in your command search path, or 'cross-test-wrapper' should give an
494+absolute path for the wrapper.
495+
496+The wrapper must meet several requirements:
497+
498+- It must preserve the current directory. As explained above, the
499+ build directory tree must be visible on both the build and host
500+ systems, at the same path. The test wrapper must ensure that the
501+ current directory it inherits is also inherited by the dynamic
502+ linker (and thus the test program itself).
503+
504+- It must preserve environment variables' values. Many EGLIBC tests
505+ set environment variables for test runs; in native testing, it
506+ invokes programs like this:
507+
508+ $ GCONV_PATH=$objdir/iconvdata \
509+ $objdir/elf/ld-linux.so.3 --library-path $objdir \
510+ ./tst-foo arg1 arg2
511+
512+ With the cross-testing wrapper, that invocation becomes:
513+
514+ $ GCONV_PATH=$objdir/iconvdata \
515+ my-wrapper hostname \
516+ $objdir/elf/ld-linux.so.3 --library-path $objdir \
517+ ./tst-foo arg1 arg2
518+
519+ Here, 'my-wrapper' must ensure that the value it sees for
520+ 'GCONV_PATH' will be seen by the dynamic linker, and thus 'tst-foo'
521+ itself. (The wrapper supplied with GLIBC simply preserves the
522+ values of *all* enviroment variables, with a fixed set of
523+ exceptions.)
524+
525+ If your wrapper is a shell script, take care to correctly propagate
526+ environment variables whose values contain spaces and shell
527+ metacharacters.
528+
529+- It must pass the command's arguments, unmodified. The arguments
530+ seen by the test program should be exactly those seen by the wrapper
531+ (after whatever arguments are given to the wrapper itself). The
532+ EGLIBC test framework performs all needed shell word splitting and
533+ expansion (wildcard expansion, parameter substitution, and so on)
534+ before invoking the wrapper; further expansion may break the tests.
535+
536+
537+The 'cross-test-ssh.sh' script
538+
539+If you want to use 'ssh' (or something sufficiently similar) to run
540+test programs on your host system, EGLIBC includes a shell script,
541+'scripts/cross-test-ssh.sh', which you can use as your wrapper
542+command. This script takes care of setting the test command's current
543+directory, propagating environment variable values, and carrying
544+command-line arguments, all across an 'ssh' connection. You may even
545+supply an alternative to 'ssh' on the command line, if needed.
546+
547+For more details, pass 'cross-test-ssh.sh' the '--help' option.
548+
549+
550+The Cross-Compiling Locale Definition Command
551+
552+Some EGLIBC tests rely on locales generated especially for the test
553+process. In a native configuration, these tests simply run the
554+'localedef' command built by the normal EGLIBC build process,
555+'locale/localedef', to process and install their locales. However, in
556+a cross-compiling configuration, this 'localedef' is built for the
557+host system, not the build system, and since it requires quite a bit
558+of memory to run (we have seen it fail on systems with 64MiB of
559+memory), it may not be practical to run it on the host system.
560+
561+If set, EGLIBC uses the 'cross-localedef' Make variable as the command
562+to run on the build system to process and install locales. The
563+localedef program built from the EGLIBC 'localedef' module is
564+suitable.
565+
566+The value of 'cross-localedef' may also include command-line arguments
567+to be passed to the program; if you are using EGLIBC's 'localedef',
568+you may include endianness and 'uint32_t' alignment arguments here.
569+
570+
571+Example
572+
573+In developing EGLIBC's cross-testing facility, we invoked 'make' with
574+the following script:
575+
576+ #!/bin/sh
577+
578+ srcdir=...
579+ test_hostname=...
580+ localedefdir=...
581+ cross_gxx=...-g++
582+
583+ wrapper="$srcdir/scripts/cross-test-ssh.sh $test_hostname"
584+ localedef="$localedefdir/localedef --little-endian --uint32-align=4"
585+
586+ make cross-test-wrapper="$wrapper" \
587+ cross-localedef="$localedef" \
588+ CXX="$cross_gxx" \
589+ "$@"
590+
591+
592+Other Cross-Testing Concerns
593+
594+Here are notes on some other issues which you may encounter in running
595+the EGLIBC tests in a cross-compiling environment:
596+
597+- Some tests require a C++ cross-compiler; you should set the 'CXX'
598+ Make variable to the name of an appropriate cross-compiler.
599+
600+- Some tests require access to libstdc++.so.6 and libgcc_s.so.1; we
601+ simply place copies of these libraries in the top EGLIBC build
602+ directory.
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/etc/ld.so.conf b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/etc/ld.so.conf
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/etc/ld.so.conf
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/fix-tibetian-locales.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/fix-tibetian-locales.patch
new file mode 100644
index 0000000..9ab9fdc
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/fix-tibetian-locales.patch
@@ -0,0 +1,38 @@
1cross localedef fails to compile these locales because name_fmt field is empty
2It is not acceptable for cross localedef and it errors out
3
4LC_NAME: field `name_fmt' not defined
5
6We therefore give a dummy string to the format, the real fix needs some native
7tibetian person to define proper name_fmt
8
9Upstream-Status: Pending
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13Index: git/localedata/locales/bo_CN
14===================================================================
15--- git.orig/localedata/locales/bo_CN 2014-08-29 10:35:22.464070587 -0700
16+++ git/localedata/locales/bo_CN 2014-08-29 10:35:22.456070587 -0700
17@@ -146,7 +146,7 @@
18 LC_NAME
19 % FIXME
20
21-name_fmt ""
22+name_fmt "FIXME"
23 % name_gen "FIXME"
24 % name_miss "FIXME"
25 % name_mr "FIXME"
26Index: git/localedata/locales/bo_IN
27===================================================================
28--- git.orig/localedata/locales/bo_IN 2014-08-29 10:35:22.464070587 -0700
29+++ git/localedata/locales/bo_IN 2014-08-29 10:35:22.456070587 -0700
30@@ -71,7 +71,7 @@
31
32 LC_NAME
33 % FIXME
34-name_fmt ""
35+name_fmt "FIXME"
36 % name_gen "FIXME"
37 % name_miss "FIXME"
38 % name_mr "FIXME"
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/fix_am_rootsbindir.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/fix_am_rootsbindir.patch
new file mode 100644
index 0000000..668e8bf
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/fix_am_rootsbindir.patch
@@ -0,0 +1,29 @@
1sysdeps/gnu/configure.ac: handle correctly $libc_cv_rootsbindir
2
3Upstream-Status:Pending
4Signed-off-by: Matthieu Crapet <Matthieu.Crapet@ingenico.com>
5
6Index: git/sysdeps/gnu/configure
7===================================================================
8--- git.orig/sysdeps/gnu/configure 2014-08-27 07:24:38.572070587 +0000
9+++ git/sysdeps/gnu/configure 2014-08-27 07:24:41.308070587 +0000
10@@ -32,6 +32,6 @@
11 else
12 libc_cv_localstatedir=$localstatedir
13 fi
14- libc_cv_rootsbindir=/sbin
15+ test -n "$libc_cv_rootsbindir" || libc_cv_rootsbindir=/sbin
16 ;;
17 esac
18Index: git/sysdeps/gnu/configure.ac
19===================================================================
20--- git.orig/sysdeps/gnu/configure.ac 2014-08-27 07:24:38.572070587 +0000
21+++ git/sysdeps/gnu/configure.ac 2014-08-27 07:24:41.308070587 +0000
22@@ -21,6 +21,6 @@
23 else
24 libc_cv_localstatedir=$localstatedir
25 fi
26- libc_cv_rootsbindir=/sbin
27+ test -n "$libc_cv_rootsbindir" || libc_cv_rootsbindir=/sbin
28 ;;
29 esac
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/fsl-ppc-no-fsqrt.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/fsl-ppc-no-fsqrt.patch
new file mode 100644
index 0000000..f88eaf4
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/fsl-ppc-no-fsqrt.patch
@@ -0,0 +1,100 @@
1Create e5500 specific math_private.h and let it include when compiling for e5500/64bit core
2We prefefine __CPU_HAS_FSQRT to 0 and then in general ppc64 math_private.h we check if its
3already defined before redefining it. This way we can ensure that on e5500 builds it wont
4emit fsqrt intructions
5
6-Khem
7
8Upstream-Status: Pending
9
10Index: git/sysdeps/powerpc/fpu/math_private.h
11===================================================================
12--- git.orig/sysdeps/powerpc/fpu/math_private.h 2014-08-29 10:31:30.224070587 -0700
13+++ git/sysdeps/powerpc/fpu/math_private.h 2014-08-29 10:31:30.212070587 -0700
14@@ -25,10 +25,12 @@
15 #include <fenv_private.h>
16 #include_next <math_private.h>
17
18-# if __WORDSIZE == 64 || defined _ARCH_PWR4
19-# define __CPU_HAS_FSQRT 1
20-# else
21-# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
22+# ifndef __CPU_HAS_FSQRT
23+# if __WORDSIZE == 64 || defined _ARCH_PWR4
24+# define __CPU_HAS_FSQRT 1
25+# else
26+# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
27+# endif
28 # endif
29
30 extern double __slow_ieee754_sqrt (double);
31Index: git/sysdeps/powerpc/powerpc64/e5500/fpu/math_private.h
32===================================================================
33--- /dev/null 1970-01-01 00:00:00.000000000 +0000
34+++ git/sysdeps/powerpc/powerpc64/e5500/fpu/math_private.h 2014-08-29 10:31:30.212070587 -0700
35@@ -0,0 +1,9 @@
36+#ifndef _E5500_MATH_PRIVATE_H_
37+#define _E5500_MATH_PRIVATE_H_ 1
38+/* E5500 core FPU does not implement
39+ fsqrt */
40+
41+#define __CPU_HAS_FSQRT 0
42+#include_next <math_private.h>
43+
44+#endif /* _E5500_MATH_PRIVATE_H_ */
45Index: git/sysdeps/powerpc/powerpc64/e6500/fpu/math_private.h
46===================================================================
47--- /dev/null 1970-01-01 00:00:00.000000000 +0000
48+++ git/sysdeps/powerpc/powerpc64/e6500/fpu/math_private.h 2014-08-29 10:31:30.212070587 -0700
49@@ -0,0 +1,9 @@
50+#ifndef _E6500_MATH_PRIVATE_H_
51+#define _E6500_MATH_PRIVATE_H_ 1
52+/* E6500 core FPU does not implement
53+ fsqrt */
54+
55+#define __CPU_HAS_FSQRT 0
56+#include_next <math_private.h>
57+
58+#endif /* _E6500_MATH_PRIVATE_H_ */
59Index: git/sysdeps/powerpc/powerpc32/e500mc/fpu/math_private.h
60===================================================================
61--- /dev/null 1970-01-01 00:00:00.000000000 +0000
62+++ git/sysdeps/powerpc/powerpc32/e500mc/fpu/math_private.h 2014-08-29 10:31:30.212070587 -0700
63@@ -0,0 +1,9 @@
64+#ifndef _E500MC_MATH_PRIVATE_H_
65+#define _E500MC_MATH_PRIVATE_H_ 1
66+/* E500MC core FPU does not implement
67+ fsqrt */
68+
69+#define __CPU_HAS_FSQRT 0
70+#include_next <math_private.h>
71+
72+#endif /* _E500MC_MATH_PRIVATE_H_ */
73Index: git/sysdeps/powerpc/powerpc32/e5500/fpu/math_private.h
74===================================================================
75--- /dev/null 1970-01-01 00:00:00.000000000 +0000
76+++ git/sysdeps/powerpc/powerpc32/e5500/fpu/math_private.h 2014-08-29 10:31:30.216070587 -0700
77@@ -0,0 +1,9 @@
78+#ifndef _E5500_MATH_PRIVATE_H_
79+#define _E5500_MATH_PRIVATE_H_ 1
80+/* E5500 core FPU does not implement
81+ fsqrt */
82+
83+#define __CPU_HAS_FSQRT 0
84+#include_next <math_private.h>
85+
86+#endif /* _E5500_MATH_PRIVATE_H_ */
87Index: git/sysdeps/powerpc/powerpc32/e6500/fpu/math_private.h
88===================================================================
89--- /dev/null 1970-01-01 00:00:00.000000000 +0000
90+++ git/sysdeps/powerpc/powerpc32/e6500/fpu/math_private.h 2014-08-29 10:31:30.216070587 -0700
91@@ -0,0 +1,9 @@
92+#ifndef _E6500_MATH_PRIVATE_H_
93+#define _E6500_MATH_PRIVATE_H_ 1
94+/* E6500 core FPU does not implement
95+ fsqrt */
96+
97+#define __CPU_HAS_FSQRT 0
98+#include_next <math_private.h>
99+
100+#endif /* _E6500_MATH_PRIVATE_H_ */
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/generate-supported.mk b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/generate-supported.mk
new file mode 100644
index 0000000..d2a28c2
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/generate-supported.mk
@@ -0,0 +1,11 @@
1#!/usr/bin/make
2
3include $(IN)
4
5all:
6 rm -f $(OUT)
7 touch $(OUT)
8 for locale in $(SUPPORTED-LOCALES); do \
9 [ $$locale = true ] && continue; \
10 echo $$locale | sed 's,/, ,' >> $(OUT); \
11 done
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/glibc.fix_sqrt2.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/glibc.fix_sqrt2.patch
new file mode 100644
index 0000000..f5ed1bf
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/glibc.fix_sqrt2.patch
@@ -0,0 +1,1516 @@
1Signed-of-by: Edmar Wienskoski <edmar@freescale.com>
2Upstream-Status: Pending
3
4Index: git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
5===================================================================
6--- /dev/null 1970-01-01 00:00:00.000000000 +0000
7+++ git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c 2014-08-29 10:34:07.768070587 -0700
8@@ -0,0 +1,134 @@
9+/* Double-precision floating point square root.
10+ Copyright (C) 2010 Free Software Foundation, Inc.
11+ This file is part of the GNU C Library.
12+
13+ The GNU C Library is free software; you can redistribute it and/or
14+ modify it under the terms of the GNU Lesser General Public
15+ License as published by the Free Software Foundation; either
16+ version 2.1 of the License, or (at your option) any later version.
17+
18+ The GNU C Library is distributed in the hope that it will be useful,
19+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21+ Lesser General Public License for more details.
22+
23+ You should have received a copy of the GNU Lesser General Public
24+ License along with the GNU C Library; if not, write to the Free
25+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26+ 02111-1307 USA. */
27+
28+#include <math.h>
29+#include <math_private.h>
30+#include <fenv_libc.h>
31+#include <inttypes.h>
32+
33+#include <sysdep.h>
34+#include <ldsodefs.h>
35+
36+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
37+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
38+static const float two108 = 3.245185536584267269e+32;
39+static const float twom54 = 5.551115123125782702e-17;
40+static const float half = 0.5;
41+
42+/* The method is based on the descriptions in:
43+
44+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
45+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
46+
47+ We find the actual square root and half of its reciprocal
48+ simultaneously. */
49+
50+#ifdef __STDC__
51+double
52+__ieee754_sqrt (double b)
53+#else
54+double
55+__ieee754_sqrt (b)
56+ double b;
57+#endif
58+{
59+ if (__builtin_expect (b > 0, 1))
60+ {
61+ double y, g, h, d, r;
62+ ieee_double_shape_type u;
63+
64+ if (__builtin_expect (b != a_inf.value, 1))
65+ {
66+ fenv_t fe;
67+
68+ fe = fegetenv_register ();
69+
70+ u.value = b;
71+
72+ relax_fenv_state ();
73+
74+ __asm__ ("frsqrte %[estimate], %[x]\n"
75+ : [estimate] "=f" (y) : [x] "f" (b));
76+
77+ /* Following Muller et al, page 168, equation 5.20.
78+
79+ h goes to 1/(2*sqrt(b))
80+ g goes to sqrt(b).
81+
82+ We need three iterations to get within 1ulp. */
83+
84+ /* Indicate that these can be performed prior to the branch. GCC
85+ insists on sinking them below the branch, however; it seems like
86+ they'd be better before the branch so that we can cover any latency
87+ from storing the argument and loading its high word. Oh well. */
88+
89+ g = b * y;
90+ h = 0.5 * y;
91+
92+ /* Handle small numbers by scaling. */
93+ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
94+ return __ieee754_sqrt (b * two108) * twom54;
95+
96+#define FMADD(a_, c_, b_) \
97+ ({ double __r; \
98+ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \
99+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
100+ __r;})
101+#define FNMSUB(a_, c_, b_) \
102+ ({ double __r; \
103+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
104+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
105+ __r;})
106+
107+ r = FNMSUB (g, h, half);
108+ g = FMADD (g, r, g);
109+ h = FMADD (h, r, h);
110+
111+ r = FNMSUB (g, h, half);
112+ g = FMADD (g, r, g);
113+ h = FMADD (h, r, h);
114+
115+ r = FNMSUB (g, h, half);
116+ g = FMADD (g, r, g);
117+ h = FMADD (h, r, h);
118+
119+ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */
120+
121+ /* Final refinement. */
122+ d = FNMSUB (g, g, b);
123+
124+ fesetenv_register (fe);
125+ return FMADD (d, h, g);
126+ }
127+ }
128+ else if (b < 0)
129+ {
130+ /* For some reason, some PowerPC32 processors don't implement
131+ FE_INVALID_SQRT. */
132+#ifdef FE_INVALID_SQRT
133+ feraiseexcept (FE_INVALID_SQRT);
134+
135+ fenv_union_t u = { .fenv = fegetenv_register () };
136+ if ((u.l & FE_INVALID) == 0)
137+#endif
138+ feraiseexcept (FE_INVALID);
139+ b = a_nan.value;
140+ }
141+ return f_wash (b);
142+}
143Index: git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
144===================================================================
145--- /dev/null 1970-01-01 00:00:00.000000000 +0000
146+++ git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c 2014-08-29 10:34:07.768070587 -0700
147@@ -0,0 +1,101 @@
148+/* Single-precision floating point square root.
149+ Copyright (C) 2010 Free Software Foundation, Inc.
150+ This file is part of the GNU C Library.
151+
152+ The GNU C Library is free software; you can redistribute it and/or
153+ modify it under the terms of the GNU Lesser General Public
154+ License as published by the Free Software Foundation; either
155+ version 2.1 of the License, or (at your option) any later version.
156+
157+ The GNU C Library is distributed in the hope that it will be useful,
158+ but WITHOUT ANY WARRANTY; without even the implied warranty of
159+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
160+ Lesser General Public License for more details.
161+
162+ You should have received a copy of the GNU Lesser General Public
163+ License along with the GNU C Library; if not, write to the Free
164+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
165+ 02111-1307 USA. */
166+
167+#include <math.h>
168+#include <math_private.h>
169+#include <fenv_libc.h>
170+#include <inttypes.h>
171+
172+#include <sysdep.h>
173+#include <ldsodefs.h>
174+
175+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
176+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
177+static const float threehalf = 1.5;
178+
179+/* The method is based on the descriptions in:
180+
181+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
182+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
183+
184+ We find the reciprocal square root and use that to compute the actual
185+ square root. */
186+
187+#ifdef __STDC__
188+float
189+__ieee754_sqrtf (float b)
190+#else
191+float
192+__ieee754_sqrtf (b)
193+ float b;
194+#endif
195+{
196+ if (__builtin_expect (b > 0, 1))
197+ {
198+#define FMSUB(a_, c_, b_) \
199+ ({ double __r; \
200+ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \
201+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
202+ __r;})
203+#define FNMSUB(a_, c_, b_) \
204+ ({ double __r; \
205+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
206+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
207+ __r;})
208+
209+ if (__builtin_expect (b != a_inf.value, 1))
210+ {
211+ double y, x;
212+ fenv_t fe;
213+
214+ fe = fegetenv_register ();
215+
216+ relax_fenv_state ();
217+
218+ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */
219+ y = FMSUB (threehalf, b, b);
220+
221+ /* Initial estimate. */
222+ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b));
223+
224+ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */
225+ x = x * FNMSUB (y, x * x, threehalf);
226+ x = x * FNMSUB (y, x * x, threehalf);
227+ x = x * FNMSUB (y, x * x, threehalf);
228+
229+ /* All done. */
230+ fesetenv_register (fe);
231+ return x * b;
232+ }
233+ }
234+ else if (b < 0)
235+ {
236+ /* For some reason, some PowerPC32 processors don't implement
237+ FE_INVALID_SQRT. */
238+#ifdef FE_INVALID_SQRT
239+ feraiseexcept (FE_INVALID_SQRT);
240+
241+ fenv_union_t u = { .fenv = fegetenv_register () };
242+ if ((u.l & FE_INVALID) == 0)
243+#endif
244+ feraiseexcept (FE_INVALID);
245+ b = a_nan.value;
246+ }
247+ return f_washf (b);
248+}
249Index: git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
250===================================================================
251--- /dev/null 1970-01-01 00:00:00.000000000 +0000
252+++ git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c 2014-08-29 10:34:07.768070587 -0700
253@@ -0,0 +1,134 @@
254+/* Double-precision floating point square root.
255+ Copyright (C) 2010 Free Software Foundation, Inc.
256+ This file is part of the GNU C Library.
257+
258+ The GNU C Library is free software; you can redistribute it and/or
259+ modify it under the terms of the GNU Lesser General Public
260+ License as published by the Free Software Foundation; either
261+ version 2.1 of the License, or (at your option) any later version.
262+
263+ The GNU C Library is distributed in the hope that it will be useful,
264+ but WITHOUT ANY WARRANTY; without even the implied warranty of
265+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
266+ Lesser General Public License for more details.
267+
268+ You should have received a copy of the GNU Lesser General Public
269+ License along with the GNU C Library; if not, write to the Free
270+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
271+ 02111-1307 USA. */
272+
273+#include <math.h>
274+#include <math_private.h>
275+#include <fenv_libc.h>
276+#include <inttypes.h>
277+
278+#include <sysdep.h>
279+#include <ldsodefs.h>
280+
281+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
282+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
283+static const float two108 = 3.245185536584267269e+32;
284+static const float twom54 = 5.551115123125782702e-17;
285+static const float half = 0.5;
286+
287+/* The method is based on the descriptions in:
288+
289+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
290+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
291+
292+ We find the actual square root and half of its reciprocal
293+ simultaneously. */
294+
295+#ifdef __STDC__
296+double
297+__ieee754_sqrt (double b)
298+#else
299+double
300+__ieee754_sqrt (b)
301+ double b;
302+#endif
303+{
304+ if (__builtin_expect (b > 0, 1))
305+ {
306+ double y, g, h, d, r;
307+ ieee_double_shape_type u;
308+
309+ if (__builtin_expect (b != a_inf.value, 1))
310+ {
311+ fenv_t fe;
312+
313+ fe = fegetenv_register ();
314+
315+ u.value = b;
316+
317+ relax_fenv_state ();
318+
319+ __asm__ ("frsqrte %[estimate], %[x]\n"
320+ : [estimate] "=f" (y) : [x] "f" (b));
321+
322+ /* Following Muller et al, page 168, equation 5.20.
323+
324+ h goes to 1/(2*sqrt(b))
325+ g goes to sqrt(b).
326+
327+ We need three iterations to get within 1ulp. */
328+
329+ /* Indicate that these can be performed prior to the branch. GCC
330+ insists on sinking them below the branch, however; it seems like
331+ they'd be better before the branch so that we can cover any latency
332+ from storing the argument and loading its high word. Oh well. */
333+
334+ g = b * y;
335+ h = 0.5 * y;
336+
337+ /* Handle small numbers by scaling. */
338+ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
339+ return __ieee754_sqrt (b * two108) * twom54;
340+
341+#define FMADD(a_, c_, b_) \
342+ ({ double __r; \
343+ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \
344+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
345+ __r;})
346+#define FNMSUB(a_, c_, b_) \
347+ ({ double __r; \
348+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
349+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
350+ __r;})
351+
352+ r = FNMSUB (g, h, half);
353+ g = FMADD (g, r, g);
354+ h = FMADD (h, r, h);
355+
356+ r = FNMSUB (g, h, half);
357+ g = FMADD (g, r, g);
358+ h = FMADD (h, r, h);
359+
360+ r = FNMSUB (g, h, half);
361+ g = FMADD (g, r, g);
362+ h = FMADD (h, r, h);
363+
364+ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */
365+
366+ /* Final refinement. */
367+ d = FNMSUB (g, g, b);
368+
369+ fesetenv_register (fe);
370+ return FMADD (d, h, g);
371+ }
372+ }
373+ else if (b < 0)
374+ {
375+ /* For some reason, some PowerPC32 processors don't implement
376+ FE_INVALID_SQRT. */
377+#ifdef FE_INVALID_SQRT
378+ feraiseexcept (FE_INVALID_SQRT);
379+
380+ fenv_union_t u = { .fenv = fegetenv_register () };
381+ if ((u.l & FE_INVALID) == 0)
382+#endif
383+ feraiseexcept (FE_INVALID);
384+ b = a_nan.value;
385+ }
386+ return f_wash (b);
387+}
388Index: git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
389===================================================================
390--- /dev/null 1970-01-01 00:00:00.000000000 +0000
391+++ git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c 2014-08-29 10:34:07.772070587 -0700
392@@ -0,0 +1,101 @@
393+/* Single-precision floating point square root.
394+ Copyright (C) 2010 Free Software Foundation, Inc.
395+ This file is part of the GNU C Library.
396+
397+ The GNU C Library is free software; you can redistribute it and/or
398+ modify it under the terms of the GNU Lesser General Public
399+ License as published by the Free Software Foundation; either
400+ version 2.1 of the License, or (at your option) any later version.
401+
402+ The GNU C Library is distributed in the hope that it will be useful,
403+ but WITHOUT ANY WARRANTY; without even the implied warranty of
404+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
405+ Lesser General Public License for more details.
406+
407+ You should have received a copy of the GNU Lesser General Public
408+ License along with the GNU C Library; if not, write to the Free
409+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
410+ 02111-1307 USA. */
411+
412+#include <math.h>
413+#include <math_private.h>
414+#include <fenv_libc.h>
415+#include <inttypes.h>
416+
417+#include <sysdep.h>
418+#include <ldsodefs.h>
419+
420+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
421+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
422+static const float threehalf = 1.5;
423+
424+/* The method is based on the descriptions in:
425+
426+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
427+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
428+
429+ We find the reciprocal square root and use that to compute the actual
430+ square root. */
431+
432+#ifdef __STDC__
433+float
434+__ieee754_sqrtf (float b)
435+#else
436+float
437+__ieee754_sqrtf (b)
438+ float b;
439+#endif
440+{
441+ if (__builtin_expect (b > 0, 1))
442+ {
443+#define FMSUB(a_, c_, b_) \
444+ ({ double __r; \
445+ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \
446+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
447+ __r;})
448+#define FNMSUB(a_, c_, b_) \
449+ ({ double __r; \
450+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
451+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
452+ __r;})
453+
454+ if (__builtin_expect (b != a_inf.value, 1))
455+ {
456+ double y, x;
457+ fenv_t fe;
458+
459+ fe = fegetenv_register ();
460+
461+ relax_fenv_state ();
462+
463+ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */
464+ y = FMSUB (threehalf, b, b);
465+
466+ /* Initial estimate. */
467+ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b));
468+
469+ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */
470+ x = x * FNMSUB (y, x * x, threehalf);
471+ x = x * FNMSUB (y, x * x, threehalf);
472+ x = x * FNMSUB (y, x * x, threehalf);
473+
474+ /* All done. */
475+ fesetenv_register (fe);
476+ return x * b;
477+ }
478+ }
479+ else if (b < 0)
480+ {
481+ /* For some reason, some PowerPC32 processors don't implement
482+ FE_INVALID_SQRT. */
483+#ifdef FE_INVALID_SQRT
484+ feraiseexcept (FE_INVALID_SQRT);
485+
486+ fenv_union_t u = { .fenv = fegetenv_register () };
487+ if ((u.l & FE_INVALID) == 0)
488+#endif
489+ feraiseexcept (FE_INVALID);
490+ b = a_nan.value;
491+ }
492+ return f_washf (b);
493+}
494Index: git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
495===================================================================
496--- /dev/null 1970-01-01 00:00:00.000000000 +0000
497+++ git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c 2014-08-29 10:34:07.772070587 -0700
498@@ -0,0 +1,134 @@
499+/* Double-precision floating point square root.
500+ Copyright (C) 2010 Free Software Foundation, Inc.
501+ This file is part of the GNU C Library.
502+
503+ The GNU C Library is free software; you can redistribute it and/or
504+ modify it under the terms of the GNU Lesser General Public
505+ License as published by the Free Software Foundation; either
506+ version 2.1 of the License, or (at your option) any later version.
507+
508+ The GNU C Library is distributed in the hope that it will be useful,
509+ but WITHOUT ANY WARRANTY; without even the implied warranty of
510+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
511+ Lesser General Public License for more details.
512+
513+ You should have received a copy of the GNU Lesser General Public
514+ License along with the GNU C Library; if not, write to the Free
515+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
516+ 02111-1307 USA. */
517+
518+#include <math.h>
519+#include <math_private.h>
520+#include <fenv_libc.h>
521+#include <inttypes.h>
522+
523+#include <sysdep.h>
524+#include <ldsodefs.h>
525+
526+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
527+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
528+static const float two108 = 3.245185536584267269e+32;
529+static const float twom54 = 5.551115123125782702e-17;
530+static const float half = 0.5;
531+
532+/* The method is based on the descriptions in:
533+
534+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
535+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
536+
537+ We find the actual square root and half of its reciprocal
538+ simultaneously. */
539+
540+#ifdef __STDC__
541+double
542+__ieee754_sqrt (double b)
543+#else
544+double
545+__ieee754_sqrt (b)
546+ double b;
547+#endif
548+{
549+ if (__builtin_expect (b > 0, 1))
550+ {
551+ double y, g, h, d, r;
552+ ieee_double_shape_type u;
553+
554+ if (__builtin_expect (b != a_inf.value, 1))
555+ {
556+ fenv_t fe;
557+
558+ fe = fegetenv_register ();
559+
560+ u.value = b;
561+
562+ relax_fenv_state ();
563+
564+ __asm__ ("frsqrte %[estimate], %[x]\n"
565+ : [estimate] "=f" (y) : [x] "f" (b));
566+
567+ /* Following Muller et al, page 168, equation 5.20.
568+
569+ h goes to 1/(2*sqrt(b))
570+ g goes to sqrt(b).
571+
572+ We need three iterations to get within 1ulp. */
573+
574+ /* Indicate that these can be performed prior to the branch. GCC
575+ insists on sinking them below the branch, however; it seems like
576+ they'd be better before the branch so that we can cover any latency
577+ from storing the argument and loading its high word. Oh well. */
578+
579+ g = b * y;
580+ h = 0.5 * y;
581+
582+ /* Handle small numbers by scaling. */
583+ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
584+ return __ieee754_sqrt (b * two108) * twom54;
585+
586+#define FMADD(a_, c_, b_) \
587+ ({ double __r; \
588+ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \
589+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
590+ __r;})
591+#define FNMSUB(a_, c_, b_) \
592+ ({ double __r; \
593+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
594+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
595+ __r;})
596+
597+ r = FNMSUB (g, h, half);
598+ g = FMADD (g, r, g);
599+ h = FMADD (h, r, h);
600+
601+ r = FNMSUB (g, h, half);
602+ g = FMADD (g, r, g);
603+ h = FMADD (h, r, h);
604+
605+ r = FNMSUB (g, h, half);
606+ g = FMADD (g, r, g);
607+ h = FMADD (h, r, h);
608+
609+ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */
610+
611+ /* Final refinement. */
612+ d = FNMSUB (g, g, b);
613+
614+ fesetenv_register (fe);
615+ return FMADD (d, h, g);
616+ }
617+ }
618+ else if (b < 0)
619+ {
620+ /* For some reason, some PowerPC32 processors don't implement
621+ FE_INVALID_SQRT. */
622+#ifdef FE_INVALID_SQRT
623+ feraiseexcept (FE_INVALID_SQRT);
624+
625+ fenv_union_t u = { .fenv = fegetenv_register () };
626+ if ((u.l & FE_INVALID) == 0)
627+#endif
628+ feraiseexcept (FE_INVALID);
629+ b = a_nan.value;
630+ }
631+ return f_wash (b);
632+}
633Index: git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
634===================================================================
635--- /dev/null 1970-01-01 00:00:00.000000000 +0000
636+++ git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c 2014-08-29 10:34:07.772070587 -0700
637@@ -0,0 +1,101 @@
638+/* Single-precision floating point square root.
639+ Copyright (C) 2010 Free Software Foundation, Inc.
640+ This file is part of the GNU C Library.
641+
642+ The GNU C Library is free software; you can redistribute it and/or
643+ modify it under the terms of the GNU Lesser General Public
644+ License as published by the Free Software Foundation; either
645+ version 2.1 of the License, or (at your option) any later version.
646+
647+ The GNU C Library is distributed in the hope that it will be useful,
648+ but WITHOUT ANY WARRANTY; without even the implied warranty of
649+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
650+ Lesser General Public License for more details.
651+
652+ You should have received a copy of the GNU Lesser General Public
653+ License along with the GNU C Library; if not, write to the Free
654+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
655+ 02111-1307 USA. */
656+
657+#include <math.h>
658+#include <math_private.h>
659+#include <fenv_libc.h>
660+#include <inttypes.h>
661+
662+#include <sysdep.h>
663+#include <ldsodefs.h>
664+
665+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
666+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
667+static const float threehalf = 1.5;
668+
669+/* The method is based on the descriptions in:
670+
671+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
672+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
673+
674+ We find the reciprocal square root and use that to compute the actual
675+ square root. */
676+
677+#ifdef __STDC__
678+float
679+__ieee754_sqrtf (float b)
680+#else
681+float
682+__ieee754_sqrtf (b)
683+ float b;
684+#endif
685+{
686+ if (__builtin_expect (b > 0, 1))
687+ {
688+#define FMSUB(a_, c_, b_) \
689+ ({ double __r; \
690+ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \
691+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
692+ __r;})
693+#define FNMSUB(a_, c_, b_) \
694+ ({ double __r; \
695+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
696+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
697+ __r;})
698+
699+ if (__builtin_expect (b != a_inf.value, 1))
700+ {
701+ double y, x;
702+ fenv_t fe;
703+
704+ fe = fegetenv_register ();
705+
706+ relax_fenv_state ();
707+
708+ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */
709+ y = FMSUB (threehalf, b, b);
710+
711+ /* Initial estimate. */
712+ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b));
713+
714+ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */
715+ x = x * FNMSUB (y, x * x, threehalf);
716+ x = x * FNMSUB (y, x * x, threehalf);
717+ x = x * FNMSUB (y, x * x, threehalf);
718+
719+ /* All done. */
720+ fesetenv_register (fe);
721+ return x * b;
722+ }
723+ }
724+ else if (b < 0)
725+ {
726+ /* For some reason, some PowerPC32 processors don't implement
727+ FE_INVALID_SQRT. */
728+#ifdef FE_INVALID_SQRT
729+ feraiseexcept (FE_INVALID_SQRT);
730+
731+ fenv_union_t u = { .fenv = fegetenv_register () };
732+ if ((u.l & FE_INVALID) == 0)
733+#endif
734+ feraiseexcept (FE_INVALID);
735+ b = a_nan.value;
736+ }
737+ return f_washf (b);
738+}
739Index: git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
740===================================================================
741--- /dev/null 1970-01-01 00:00:00.000000000 +0000
742+++ git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c 2014-08-29 10:34:07.772070587 -0700
743@@ -0,0 +1,134 @@
744+/* Double-precision floating point square root.
745+ Copyright (C) 2010 Free Software Foundation, Inc.
746+ This file is part of the GNU C Library.
747+
748+ The GNU C Library is free software; you can redistribute it and/or
749+ modify it under the terms of the GNU Lesser General Public
750+ License as published by the Free Software Foundation; either
751+ version 2.1 of the License, or (at your option) any later version.
752+
753+ The GNU C Library is distributed in the hope that it will be useful,
754+ but WITHOUT ANY WARRANTY; without even the implied warranty of
755+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
756+ Lesser General Public License for more details.
757+
758+ You should have received a copy of the GNU Lesser General Public
759+ License along with the GNU C Library; if not, write to the Free
760+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
761+ 02111-1307 USA. */
762+
763+#include <math.h>
764+#include <math_private.h>
765+#include <fenv_libc.h>
766+#include <inttypes.h>
767+
768+#include <sysdep.h>
769+#include <ldsodefs.h>
770+
771+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
772+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
773+static const float two108 = 3.245185536584267269e+32;
774+static const float twom54 = 5.551115123125782702e-17;
775+static const float half = 0.5;
776+
777+/* The method is based on the descriptions in:
778+
779+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
780+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
781+
782+ We find the actual square root and half of its reciprocal
783+ simultaneously. */
784+
785+#ifdef __STDC__
786+double
787+__ieee754_sqrt (double b)
788+#else
789+double
790+__ieee754_sqrt (b)
791+ double b;
792+#endif
793+{
794+ if (__builtin_expect (b > 0, 1))
795+ {
796+ double y, g, h, d, r;
797+ ieee_double_shape_type u;
798+
799+ if (__builtin_expect (b != a_inf.value, 1))
800+ {
801+ fenv_t fe;
802+
803+ fe = fegetenv_register ();
804+
805+ u.value = b;
806+
807+ relax_fenv_state ();
808+
809+ __asm__ ("frsqrte %[estimate], %[x]\n"
810+ : [estimate] "=f" (y) : [x] "f" (b));
811+
812+ /* Following Muller et al, page 168, equation 5.20.
813+
814+ h goes to 1/(2*sqrt(b))
815+ g goes to sqrt(b).
816+
817+ We need three iterations to get within 1ulp. */
818+
819+ /* Indicate that these can be performed prior to the branch. GCC
820+ insists on sinking them below the branch, however; it seems like
821+ they'd be better before the branch so that we can cover any latency
822+ from storing the argument and loading its high word. Oh well. */
823+
824+ g = b * y;
825+ h = 0.5 * y;
826+
827+ /* Handle small numbers by scaling. */
828+ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
829+ return __ieee754_sqrt (b * two108) * twom54;
830+
831+#define FMADD(a_, c_, b_) \
832+ ({ double __r; \
833+ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \
834+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
835+ __r;})
836+#define FNMSUB(a_, c_, b_) \
837+ ({ double __r; \
838+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
839+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
840+ __r;})
841+
842+ r = FNMSUB (g, h, half);
843+ g = FMADD (g, r, g);
844+ h = FMADD (h, r, h);
845+
846+ r = FNMSUB (g, h, half);
847+ g = FMADD (g, r, g);
848+ h = FMADD (h, r, h);
849+
850+ r = FNMSUB (g, h, half);
851+ g = FMADD (g, r, g);
852+ h = FMADD (h, r, h);
853+
854+ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */
855+
856+ /* Final refinement. */
857+ d = FNMSUB (g, g, b);
858+
859+ fesetenv_register (fe);
860+ return FMADD (d, h, g);
861+ }
862+ }
863+ else if (b < 0)
864+ {
865+ /* For some reason, some PowerPC32 processors don't implement
866+ FE_INVALID_SQRT. */
867+#ifdef FE_INVALID_SQRT
868+ feraiseexcept (FE_INVALID_SQRT);
869+
870+ fenv_union_t u = { .fenv = fegetenv_register () };
871+ if ((u.l & FE_INVALID) == 0)
872+#endif
873+ feraiseexcept (FE_INVALID);
874+ b = a_nan.value;
875+ }
876+ return f_wash (b);
877+}
878Index: git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
879===================================================================
880--- /dev/null 1970-01-01 00:00:00.000000000 +0000
881+++ git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c 2014-08-29 10:34:07.772070587 -0700
882@@ -0,0 +1,101 @@
883+/* Single-precision floating point square root.
884+ Copyright (C) 2010 Free Software Foundation, Inc.
885+ This file is part of the GNU C Library.
886+
887+ The GNU C Library is free software; you can redistribute it and/or
888+ modify it under the terms of the GNU Lesser General Public
889+ License as published by the Free Software Foundation; either
890+ version 2.1 of the License, or (at your option) any later version.
891+
892+ The GNU C Library is distributed in the hope that it will be useful,
893+ but WITHOUT ANY WARRANTY; without even the implied warranty of
894+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
895+ Lesser General Public License for more details.
896+
897+ You should have received a copy of the GNU Lesser General Public
898+ License along with the GNU C Library; if not, write to the Free
899+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
900+ 02111-1307 USA. */
901+
902+#include <math.h>
903+#include <math_private.h>
904+#include <fenv_libc.h>
905+#include <inttypes.h>
906+
907+#include <sysdep.h>
908+#include <ldsodefs.h>
909+
910+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
911+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
912+static const float threehalf = 1.5;
913+
914+/* The method is based on the descriptions in:
915+
916+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
917+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
918+
919+ We find the reciprocal square root and use that to compute the actual
920+ square root. */
921+
922+#ifdef __STDC__
923+float
924+__ieee754_sqrtf (float b)
925+#else
926+float
927+__ieee754_sqrtf (b)
928+ float b;
929+#endif
930+{
931+ if (__builtin_expect (b > 0, 1))
932+ {
933+#define FMSUB(a_, c_, b_) \
934+ ({ double __r; \
935+ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \
936+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
937+ __r;})
938+#define FNMSUB(a_, c_, b_) \
939+ ({ double __r; \
940+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
941+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
942+ __r;})
943+
944+ if (__builtin_expect (b != a_inf.value, 1))
945+ {
946+ double y, x;
947+ fenv_t fe;
948+
949+ fe = fegetenv_register ();
950+
951+ relax_fenv_state ();
952+
953+ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */
954+ y = FMSUB (threehalf, b, b);
955+
956+ /* Initial estimate. */
957+ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b));
958+
959+ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */
960+ x = x * FNMSUB (y, x * x, threehalf);
961+ x = x * FNMSUB (y, x * x, threehalf);
962+ x = x * FNMSUB (y, x * x, threehalf);
963+
964+ /* All done. */
965+ fesetenv_register (fe);
966+ return x * b;
967+ }
968+ }
969+ else if (b < 0)
970+ {
971+ /* For some reason, some PowerPC32 processors don't implement
972+ FE_INVALID_SQRT. */
973+#ifdef FE_INVALID_SQRT
974+ feraiseexcept (FE_INVALID_SQRT);
975+
976+ fenv_union_t u = { .fenv = fegetenv_register () };
977+ if ((u.l & FE_INVALID) == 0)
978+#endif
979+ feraiseexcept (FE_INVALID);
980+ b = a_nan.value;
981+ }
982+ return f_washf (b);
983+}
984Index: git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
985===================================================================
986--- /dev/null 1970-01-01 00:00:00.000000000 +0000
987+++ git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c 2014-08-29 10:34:07.772070587 -0700
988@@ -0,0 +1,134 @@
989+/* Double-precision floating point square root.
990+ Copyright (C) 2010 Free Software Foundation, Inc.
991+ This file is part of the GNU C Library.
992+
993+ The GNU C Library is free software; you can redistribute it and/or
994+ modify it under the terms of the GNU Lesser General Public
995+ License as published by the Free Software Foundation; either
996+ version 2.1 of the License, or (at your option) any later version.
997+
998+ The GNU C Library is distributed in the hope that it will be useful,
999+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1000+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1001+ Lesser General Public License for more details.
1002+
1003+ You should have received a copy of the GNU Lesser General Public
1004+ License along with the GNU C Library; if not, write to the Free
1005+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1006+ 02111-1307 USA. */
1007+
1008+#include <math.h>
1009+#include <math_private.h>
1010+#include <fenv_libc.h>
1011+#include <inttypes.h>
1012+
1013+#include <sysdep.h>
1014+#include <ldsodefs.h>
1015+
1016+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
1017+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
1018+static const float two108 = 3.245185536584267269e+32;
1019+static const float twom54 = 5.551115123125782702e-17;
1020+static const float half = 0.5;
1021+
1022+/* The method is based on the descriptions in:
1023+
1024+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
1025+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
1026+
1027+ We find the actual square root and half of its reciprocal
1028+ simultaneously. */
1029+
1030+#ifdef __STDC__
1031+double
1032+__ieee754_sqrt (double b)
1033+#else
1034+double
1035+__ieee754_sqrt (b)
1036+ double b;
1037+#endif
1038+{
1039+ if (__builtin_expect (b > 0, 1))
1040+ {
1041+ double y, g, h, d, r;
1042+ ieee_double_shape_type u;
1043+
1044+ if (__builtin_expect (b != a_inf.value, 1))
1045+ {
1046+ fenv_t fe;
1047+
1048+ fe = fegetenv_register ();
1049+
1050+ u.value = b;
1051+
1052+ relax_fenv_state ();
1053+
1054+ __asm__ ("frsqrte %[estimate], %[x]\n"
1055+ : [estimate] "=f" (y) : [x] "f" (b));
1056+
1057+ /* Following Muller et al, page 168, equation 5.20.
1058+
1059+ h goes to 1/(2*sqrt(b))
1060+ g goes to sqrt(b).
1061+
1062+ We need three iterations to get within 1ulp. */
1063+
1064+ /* Indicate that these can be performed prior to the branch. GCC
1065+ insists on sinking them below the branch, however; it seems like
1066+ they'd be better before the branch so that we can cover any latency
1067+ from storing the argument and loading its high word. Oh well. */
1068+
1069+ g = b * y;
1070+ h = 0.5 * y;
1071+
1072+ /* Handle small numbers by scaling. */
1073+ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
1074+ return __ieee754_sqrt (b * two108) * twom54;
1075+
1076+#define FMADD(a_, c_, b_) \
1077+ ({ double __r; \
1078+ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \
1079+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
1080+ __r;})
1081+#define FNMSUB(a_, c_, b_) \
1082+ ({ double __r; \
1083+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
1084+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
1085+ __r;})
1086+
1087+ r = FNMSUB (g, h, half);
1088+ g = FMADD (g, r, g);
1089+ h = FMADD (h, r, h);
1090+
1091+ r = FNMSUB (g, h, half);
1092+ g = FMADD (g, r, g);
1093+ h = FMADD (h, r, h);
1094+
1095+ r = FNMSUB (g, h, half);
1096+ g = FMADD (g, r, g);
1097+ h = FMADD (h, r, h);
1098+
1099+ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */
1100+
1101+ /* Final refinement. */
1102+ d = FNMSUB (g, g, b);
1103+
1104+ fesetenv_register (fe);
1105+ return FMADD (d, h, g);
1106+ }
1107+ }
1108+ else if (b < 0)
1109+ {
1110+ /* For some reason, some PowerPC32 processors don't implement
1111+ FE_INVALID_SQRT. */
1112+#ifdef FE_INVALID_SQRT
1113+ feraiseexcept (FE_INVALID_SQRT);
1114+
1115+ fenv_union_t u = { .fenv = fegetenv_register () };
1116+ if ((u.l & FE_INVALID) == 0)
1117+#endif
1118+ feraiseexcept (FE_INVALID);
1119+ b = a_nan.value;
1120+ }
1121+ return f_wash (b);
1122+}
1123Index: git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
1124===================================================================
1125--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1126+++ git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c 2014-08-29 10:34:07.772070587 -0700
1127@@ -0,0 +1,101 @@
1128+/* Single-precision floating point square root.
1129+ Copyright (C) 2010 Free Software Foundation, Inc.
1130+ This file is part of the GNU C Library.
1131+
1132+ The GNU C Library is free software; you can redistribute it and/or
1133+ modify it under the terms of the GNU Lesser General Public
1134+ License as published by the Free Software Foundation; either
1135+ version 2.1 of the License, or (at your option) any later version.
1136+
1137+ The GNU C Library is distributed in the hope that it will be useful,
1138+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1139+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1140+ Lesser General Public License for more details.
1141+
1142+ You should have received a copy of the GNU Lesser General Public
1143+ License along with the GNU C Library; if not, write to the Free
1144+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1145+ 02111-1307 USA. */
1146+
1147+#include <math.h>
1148+#include <math_private.h>
1149+#include <fenv_libc.h>
1150+#include <inttypes.h>
1151+
1152+#include <sysdep.h>
1153+#include <ldsodefs.h>
1154+
1155+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
1156+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
1157+static const float threehalf = 1.5;
1158+
1159+/* The method is based on the descriptions in:
1160+
1161+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
1162+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
1163+
1164+ We find the reciprocal square root and use that to compute the actual
1165+ square root. */
1166+
1167+#ifdef __STDC__
1168+float
1169+__ieee754_sqrtf (float b)
1170+#else
1171+float
1172+__ieee754_sqrtf (b)
1173+ float b;
1174+#endif
1175+{
1176+ if (__builtin_expect (b > 0, 1))
1177+ {
1178+#define FMSUB(a_, c_, b_) \
1179+ ({ double __r; \
1180+ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \
1181+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
1182+ __r;})
1183+#define FNMSUB(a_, c_, b_) \
1184+ ({ double __r; \
1185+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
1186+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
1187+ __r;})
1188+
1189+ if (__builtin_expect (b != a_inf.value, 1))
1190+ {
1191+ double y, x;
1192+ fenv_t fe;
1193+
1194+ fe = fegetenv_register ();
1195+
1196+ relax_fenv_state ();
1197+
1198+ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */
1199+ y = FMSUB (threehalf, b, b);
1200+
1201+ /* Initial estimate. */
1202+ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b));
1203+
1204+ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */
1205+ x = x * FNMSUB (y, x * x, threehalf);
1206+ x = x * FNMSUB (y, x * x, threehalf);
1207+ x = x * FNMSUB (y, x * x, threehalf);
1208+
1209+ /* All done. */
1210+ fesetenv_register (fe);
1211+ return x * b;
1212+ }
1213+ }
1214+ else if (b < 0)
1215+ {
1216+ /* For some reason, some PowerPC32 processors don't implement
1217+ FE_INVALID_SQRT. */
1218+#ifdef FE_INVALID_SQRT
1219+ feraiseexcept (FE_INVALID_SQRT);
1220+
1221+ fenv_union_t u = { .fenv = fegetenv_register () };
1222+ if ((u.l & FE_INVALID) == 0)
1223+#endif
1224+ feraiseexcept (FE_INVALID);
1225+ b = a_nan.value;
1226+ }
1227+ return f_washf (b);
1228+}
1229Index: git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
1230===================================================================
1231--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1232+++ git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c 2014-08-29 10:34:07.772070587 -0700
1233@@ -0,0 +1,134 @@
1234+/* Double-precision floating point square root.
1235+ Copyright (C) 2010 Free Software Foundation, Inc.
1236+ This file is part of the GNU C Library.
1237+
1238+ The GNU C Library is free software; you can redistribute it and/or
1239+ modify it under the terms of the GNU Lesser General Public
1240+ License as published by the Free Software Foundation; either
1241+ version 2.1 of the License, or (at your option) any later version.
1242+
1243+ The GNU C Library is distributed in the hope that it will be useful,
1244+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1245+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1246+ Lesser General Public License for more details.
1247+
1248+ You should have received a copy of the GNU Lesser General Public
1249+ License along with the GNU C Library; if not, write to the Free
1250+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1251+ 02111-1307 USA. */
1252+
1253+#include <math.h>
1254+#include <math_private.h>
1255+#include <fenv_libc.h>
1256+#include <inttypes.h>
1257+
1258+#include <sysdep.h>
1259+#include <ldsodefs.h>
1260+
1261+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
1262+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
1263+static const float two108 = 3.245185536584267269e+32;
1264+static const float twom54 = 5.551115123125782702e-17;
1265+static const float half = 0.5;
1266+
1267+/* The method is based on the descriptions in:
1268+
1269+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
1270+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
1271+
1272+ We find the actual square root and half of its reciprocal
1273+ simultaneously. */
1274+
1275+#ifdef __STDC__
1276+double
1277+__ieee754_sqrt (double b)
1278+#else
1279+double
1280+__ieee754_sqrt (b)
1281+ double b;
1282+#endif
1283+{
1284+ if (__builtin_expect (b > 0, 1))
1285+ {
1286+ double y, g, h, d, r;
1287+ ieee_double_shape_type u;
1288+
1289+ if (__builtin_expect (b != a_inf.value, 1))
1290+ {
1291+ fenv_t fe;
1292+
1293+ fe = fegetenv_register ();
1294+
1295+ u.value = b;
1296+
1297+ relax_fenv_state ();
1298+
1299+ __asm__ ("frsqrte %[estimate], %[x]\n"
1300+ : [estimate] "=f" (y) : [x] "f" (b));
1301+
1302+ /* Following Muller et al, page 168, equation 5.20.
1303+
1304+ h goes to 1/(2*sqrt(b))
1305+ g goes to sqrt(b).
1306+
1307+ We need three iterations to get within 1ulp. */
1308+
1309+ /* Indicate that these can be performed prior to the branch. GCC
1310+ insists on sinking them below the branch, however; it seems like
1311+ they'd be better before the branch so that we can cover any latency
1312+ from storing the argument and loading its high word. Oh well. */
1313+
1314+ g = b * y;
1315+ h = 0.5 * y;
1316+
1317+ /* Handle small numbers by scaling. */
1318+ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
1319+ return __ieee754_sqrt (b * two108) * twom54;
1320+
1321+#define FMADD(a_, c_, b_) \
1322+ ({ double __r; \
1323+ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \
1324+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
1325+ __r;})
1326+#define FNMSUB(a_, c_, b_) \
1327+ ({ double __r; \
1328+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
1329+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
1330+ __r;})
1331+
1332+ r = FNMSUB (g, h, half);
1333+ g = FMADD (g, r, g);
1334+ h = FMADD (h, r, h);
1335+
1336+ r = FNMSUB (g, h, half);
1337+ g = FMADD (g, r, g);
1338+ h = FMADD (h, r, h);
1339+
1340+ r = FNMSUB (g, h, half);
1341+ g = FMADD (g, r, g);
1342+ h = FMADD (h, r, h);
1343+
1344+ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */
1345+
1346+ /* Final refinement. */
1347+ d = FNMSUB (g, g, b);
1348+
1349+ fesetenv_register (fe);
1350+ return FMADD (d, h, g);
1351+ }
1352+ }
1353+ else if (b < 0)
1354+ {
1355+ /* For some reason, some PowerPC32 processors don't implement
1356+ FE_INVALID_SQRT. */
1357+#ifdef FE_INVALID_SQRT
1358+ feraiseexcept (FE_INVALID_SQRT);
1359+
1360+ fenv_union_t u = { .fenv = fegetenv_register () };
1361+ if ((u.l & FE_INVALID) == 0)
1362+#endif
1363+ feraiseexcept (FE_INVALID);
1364+ b = a_nan.value;
1365+ }
1366+ return f_wash (b);
1367+}
1368Index: git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
1369===================================================================
1370--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1371+++ git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c 2014-08-29 10:34:07.776070587 -0700
1372@@ -0,0 +1,101 @@
1373+/* Single-precision floating point square root.
1374+ Copyright (C) 2010 Free Software Foundation, Inc.
1375+ This file is part of the GNU C Library.
1376+
1377+ The GNU C Library is free software; you can redistribute it and/or
1378+ modify it under the terms of the GNU Lesser General Public
1379+ License as published by the Free Software Foundation; either
1380+ version 2.1 of the License, or (at your option) any later version.
1381+
1382+ The GNU C Library is distributed in the hope that it will be useful,
1383+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1384+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1385+ Lesser General Public License for more details.
1386+
1387+ You should have received a copy of the GNU Lesser General Public
1388+ License along with the GNU C Library; if not, write to the Free
1389+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1390+ 02111-1307 USA. */
1391+
1392+#include <math.h>
1393+#include <math_private.h>
1394+#include <fenv_libc.h>
1395+#include <inttypes.h>
1396+
1397+#include <sysdep.h>
1398+#include <ldsodefs.h>
1399+
1400+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
1401+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
1402+static const float threehalf = 1.5;
1403+
1404+/* The method is based on the descriptions in:
1405+
1406+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
1407+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
1408+
1409+ We find the reciprocal square root and use that to compute the actual
1410+ square root. */
1411+
1412+#ifdef __STDC__
1413+float
1414+__ieee754_sqrtf (float b)
1415+#else
1416+float
1417+__ieee754_sqrtf (b)
1418+ float b;
1419+#endif
1420+{
1421+ if (__builtin_expect (b > 0, 1))
1422+ {
1423+#define FMSUB(a_, c_, b_) \
1424+ ({ double __r; \
1425+ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \
1426+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
1427+ __r;})
1428+#define FNMSUB(a_, c_, b_) \
1429+ ({ double __r; \
1430+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
1431+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
1432+ __r;})
1433+
1434+ if (__builtin_expect (b != a_inf.value, 1))
1435+ {
1436+ double y, x;
1437+ fenv_t fe;
1438+
1439+ fe = fegetenv_register ();
1440+
1441+ relax_fenv_state ();
1442+
1443+ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */
1444+ y = FMSUB (threehalf, b, b);
1445+
1446+ /* Initial estimate. */
1447+ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b));
1448+
1449+ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */
1450+ x = x * FNMSUB (y, x * x, threehalf);
1451+ x = x * FNMSUB (y, x * x, threehalf);
1452+ x = x * FNMSUB (y, x * x, threehalf);
1453+
1454+ /* All done. */
1455+ fesetenv_register (fe);
1456+ return x * b;
1457+ }
1458+ }
1459+ else if (b < 0)
1460+ {
1461+ /* For some reason, some PowerPC32 processors don't implement
1462+ FE_INVALID_SQRT. */
1463+#ifdef FE_INVALID_SQRT
1464+ feraiseexcept (FE_INVALID_SQRT);
1465+
1466+ fenv_union_t u = { .fenv = fegetenv_register () };
1467+ if ((u.l & FE_INVALID) == 0)
1468+#endif
1469+ feraiseexcept (FE_INVALID);
1470+ b = a_nan.value;
1471+ }
1472+ return f_washf (b);
1473+}
1474Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies
1475===================================================================
1476--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1477+++ git/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies 2014-08-29 10:34:07.776070587 -0700
1478@@ -0,0 +1 @@
1479+powerpc/powerpc32/603e/fpu
1480Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies
1481===================================================================
1482--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1483+++ git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies 2014-08-29 10:34:07.776070587 -0700
1484@@ -0,0 +1,2 @@
1485+# e300c3 is a variant of 603e so use the same optimizations for sqrt
1486+powerpc/powerpc32/603e/fpu
1487Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies
1488===================================================================
1489--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1490+++ git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies 2014-08-29 10:34:07.776070587 -0700
1491@@ -0,0 +1 @@
1492+powerpc/powerpc32/e500mc/fpu
1493Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies
1494===================================================================
1495--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1496+++ git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies 2014-08-29 10:34:07.776070587 -0700
1497@@ -0,0 +1 @@
1498+powerpc/powerpc32/e5500/fpu
1499Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies
1500===================================================================
1501--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1502+++ git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies 2014-08-29 10:34:07.776070587 -0700
1503@@ -0,0 +1 @@
1504+powerpc/powerpc32/e6500/fpu
1505Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies
1506===================================================================
1507--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1508+++ git/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies 2014-08-29 10:34:07.780070587 -0700
1509@@ -0,0 +1 @@
1510+powerpc/powerpc64/e5500/fpu
1511Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies
1512===================================================================
1513--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1514+++ git/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies 2014-08-29 10:34:07.780070587 -0700
1515@@ -0,0 +1 @@
1516+powerpc/powerpc64/e6500/fpu
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/grok_gold.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/grok_gold.patch
new file mode 100644
index 0000000..26875c7
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/grok_gold.patch
@@ -0,0 +1,34 @@
1Make ld --version output matching grok gold's output
2
3adapted from from upstream branch roland/gold-vs-libc
4
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6Upstream-Status: Backport
7
8
9Index: git/configure
10===================================================================
11--- git.orig/configure 2014-08-29 10:32:34.464070587 -0700
12+++ git/configure 2014-08-29 10:32:34.456070587 -0700
13@@ -4592,7 +4592,7 @@
14 # Found it, now check the version.
15 { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $LD" >&5
16 $as_echo_n "checking version of $LD... " >&6; }
17- ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
18+ ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU [Bbinutilsd][^.]* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
19 case $ac_prog_version in
20 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
21 2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*)
22Index: git/configure.ac
23===================================================================
24--- git.orig/configure.ac 2014-08-29 10:32:34.464070587 -0700
25+++ git/configure.ac 2014-08-29 10:32:34.460070587 -0700
26@@ -930,7 +930,7 @@
27 [GNU assembler.* \([0-9]*\.[0-9.]*\)],
28 [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], AS=: critic_missing="$critic_missing as")
29 AC_CHECK_PROG_VER(LD, $LD, --version,
30- [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
31+ [GNU [Bbinutilsd][^.]* \([0-9][0-9]*\.[0-9.]*\)],
32 [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], LD=: critic_missing="$critic_missing ld")
33
34 # These programs are version sensitive.
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/initgroups_keys.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/initgroups_keys.patch
new file mode 100644
index 0000000..32aa15a
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/initgroups_keys.patch
@@ -0,0 +1,20 @@
1This is needed since initgroups belongs to NET group
2so when NET is disabled in eglibc build then it reports
3as undefined symbol
4
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6Upstream-Status: Pending
7
8Index: git/nss/getent.c
9===================================================================
10--- git.orig/nss/getent.c 2014-08-27 05:15:25.996070587 +0000
11+++ git/nss/getent.c 2014-08-27 05:16:00.048070587 +0000
12@@ -879,7 +879,7 @@
13 D(group)
14 D(gshadow)
15 D(hosts)
16-D(initgroups)
17+DN(initgroups)
18 D(netgroup)
19 D(networks)
20 D(passwd)
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/ld-search-order.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/ld-search-order.patch
new file mode 100644
index 0000000..f518bc7
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/ld-search-order.patch
@@ -0,0 +1,56 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3The default lib search path order is:
4
5 1) LD_LIBRARY_PATH
6 2) RPATH from the binary
7 3) ld.so.cache
8 4) default search paths embedded in the linker
9
10For nativesdk binaries which are being used alongside binaries on a host system, we
11need the search paths to firstly search the shipped nativesdk libs but then also
12cover the host system. For example we want the host system's libGL and this may be
13in a non-standard location like /usr/lib/mesa. The only place the location is know
14about is in the ld.so.cache of the host system.
15
16Since nativesdk has a simple structure and doesn't need to use a cache itself, we
17repurpose the cache for use as a last resort in finding host system binaries. This
18means we need to switch the order of 3 and 4 above to make this work effectively.
19
20RP 14/10/2010
21
22Index: git/elf/dl-load.c
23===================================================================
24--- git.orig/elf/dl-load.c 2014-08-28 17:32:46.292070587 -0700
25+++ git/elf/dl-load.c 2014-08-28 17:33:56.048070587 -0700
26@@ -2050,7 +2050,14 @@
27 fd = open_path (name, namelen, mode,
28 &loader->l_runpath_dirs, &realname, &fb, loader,
29 LA_SER_RUNPATH, &found_other_class);
30-
31+ /* try the default path. */
32+ if (fd == -1
33+ && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
34+ || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1))
35+ && rtld_search_dirs.dirs != (void *) -1)
36+ fd = open_path (name, namelen, mode & __RTLD_SECURE, &rtld_search_dirs,
37+ &realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
38+ /* Finally try ld.so.cache */
39 #ifdef USE_LDCONFIG
40 if (fd == -1
41 && (__glibc_likely ((mode & __RTLD_SECURE) == 0)
42@@ -2113,14 +2120,6 @@
43 }
44 #endif
45
46- /* Finally, try the default path. */
47- if (fd == -1
48- && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
49- || __glibc_likely (!(l->l_flags_1 & DF_1_NODEFLIB)))
50- && rtld_search_dirs.dirs != (void *) -1)
51- fd = open_path (name, namelen, mode, &rtld_search_dirs,
52- &realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
53-
54 /* Add another newline when we are tracing the library loading. */
55 if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
56 _dl_debug_printf ("\n");
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/mips-rld-map-check.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/mips-rld-map-check.patch
new file mode 100644
index 0000000..9f593d6
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/mips-rld-map-check.patch
@@ -0,0 +1,27 @@
1
2On mips target, binutils currently sets DT_MIPS_RLD_MAP to 0 in dynamic
3section if a --version-script sets _RLD_MAP to local. This is apparently
4a binutils bug, but libc shouldn't segfault in this case.
5
6see also: http://sourceware.org/bugilla/show_bug.cgi?id=11615
7
8Upstream-Status: Pending
9
109/19/2010 - added by Qing He <qing.he@intel.com>
11
12
13---
14Index: git/sysdeps/mips/dl-machine.h
15===================================================================
16--- git.orig/sysdeps/mips/dl-machine.h 2014-08-27 04:58:11.840070587 +0000
17+++ git/sysdeps/mips/dl-machine.h 2014-08-27 04:58:11.832070587 +0000
18@@ -70,7 +70,8 @@
19 /* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in
20 with the run-time address of the r_debug structure */
21 #define ELF_MACHINE_DEBUG_SETUP(l,r) \
22-do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
23+do { if ((l)->l_info[DT_MIPS (RLD_MAP)] && \
24+ (l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) \
25 *(ElfW(Addr) *)((l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) = \
26 (ElfW(Addr)) (r); \
27 } while (0)
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/multilib_readlib.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/multilib_readlib.patch
new file mode 100644
index 0000000..13ffc46
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/multilib_readlib.patch
@@ -0,0 +1,19 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3Replace the OECORE_KNOWN_INTERPRETER_NAMES with the value of
4variable EGLIBC_KNOWN_INTERPRETER_NAMES.
5
6Lianhao Lu, 08/01/2011
7
8Index: git/elf/readlib.c
9===================================================================
10--- git.orig/elf/readlib.c 2014-08-29 10:34:16.824070587 -0700
11+++ git/elf/readlib.c 2014-08-29 10:34:16.816070587 -0700
12@@ -51,6 +51,7 @@
13 #ifdef SYSDEP_KNOWN_INTERPRETER_NAMES
14 SYSDEP_KNOWN_INTERPRETER_NAMES
15 #endif
16+ OECORE_KNOWN_INTERPRETER_NAMES
17 };
18
19 static struct known_names known_libs[] =
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/option-groups.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/option-groups.patch
new file mode 100644
index 0000000..693bd2f
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/option-groups.patch
@@ -0,0 +1,1397 @@
1Eglibc option group infrastructure
2
3Upstream-Status: Pending
4
5Index: git/option-groups.def
6===================================================================
7--- /dev/null 1970-01-01 00:00:00.000000000 +0000
8+++ git/option-groups.def 2014-08-27 07:26:51.652070587 +0000
9@@ -0,0 +1,868 @@
10+# This file documents the option groups EGLIBC currently supports, in
11+# a format akin to the Linux Kconfig system's. The syntax may change
12+# over time.
13+#
14+# An entry of the form:
15+#
16+# config GROUP_NAME
17+# bool "one-line explanation of what this option group controls"
18+# help
19+# Multi-line help explaining the option group's meaning in
20+# some detail, terminated by indentation level.
21+#
22+# defines an option group whose variable is GROUP_NAME, with
23+# meaningful values 'y' (enabled) and 'n' (disabled). The
24+# documentation is formatted to be consumed by some sort of
25+# interactive configuration interface, but EGLIBC doesn't have such an
26+# interface yet.
27+#
28+# An option may have a 'depends on' line, indicating which other options
29+# must also be enabled if this option is. At present, EGLIBC doesn't
30+# check that these dependencies are satisfied.
31+#
32+# Option group variables get their default values from the file
33+# 'option-groups.defaults', in the top directory of the EGLIBC source
34+# tree. By default, all EGLIBC option groups are enabled --- their
35+# variables are set to 'y'.
36+#
37+# After including 'option-groups.defaults', the EGLIBC make machinery
38+# includes the file 'option-groups.config' from the top of the build
39+# tree, if it is present. Developers can place assignments to option
40+# group variables in that file to override the defaults. For example,
41+# to disable an option group, place a line of the form:
42+#
43+# OPTION_GROUP_NAME = n
44+#
45+# in 'option-groups.config' at the top of your build tree. To
46+# explicitly enable an option group, you may also write:
47+#
48+# OPTION_GROUP_NAME = y
49+#
50+# although this simply reestablishes the value already set by
51+# 'option-groups.defaults'.
52+
53+config EGLIBC_ADVANCED_INET6
54+ bool "IPv6 Advanced Sockets API support (RFC3542)"
55+ depends on EGLIBC_INET
56+ help
57+ This option group includes the functions specified by RFC 3542,
58+ "Advanced Sockets Application Program Interface (API) for
59+ IPv6".
60+
61+ This option group includes the following functions:
62+
63+ inet6_opt_append
64+ inet6_opt_find
65+ inet6_opt_finish
66+ inet6_opt_get_val
67+ inet6_opt_init
68+ inet6_option_alloc
69+ inet6_option_append
70+ inet6_option_find
71+ inet6_option_init
72+ inet6_option_next
73+ inet6_option_space
74+ inet6_opt_next
75+ inet6_opt_set_val
76+ inet6_rth_add
77+ inet6_rth_getaddr
78+ inet6_rth_init
79+ inet6_rth_reverse
80+ inet6_rth_segments
81+ inet6_rth_space
82+
83+config EGLIBC_BACKTRACE
84+ bool "Functions for producing backtraces"
85+ help
86+ This option group includes functions for producing a list of
87+ the function calls that are currently active in a thread, from
88+ within the thread itself. These functions are often used
89+ within signal handlers, to produce diagnostic output.
90+
91+ This option group includes the following functions:
92+
93+ backtrace
94+ backtrace_symbols
95+ backtrace_symbols_fd
96+
97+config EGLIBC_BIG_MACROS
98+ bool "Use extensive inline code"
99+ help
100+ This option group specifies whether certain pieces of code
101+ should be inlined to achieve maximum speed. If this option
102+ group is not selected, function calls will be used instead,
103+ hence reducing the library footprint.
104+
105+config EGLIBC_BSD
106+ bool "BSD-specific functions, and their compatibility stubs"
107+ help
108+ This option group includes functions specific to BSD kernels.
109+ A number of these functions have stub versions that are also
110+ included in libraries built for non-BSD systems for
111+ compatibility.
112+
113+ This option group includes the following functions:
114+
115+ chflags
116+ fchflags
117+ lchmod
118+ revoke
119+ setlogin
120+
121+config EGLIBC_CXX_TESTS
122+ bool "Tests that link against the standard C++ library."
123+ depends on POSIX_WIDE_CHAR_DEVICE_IO && EGLIBC_LIBM
124+ help
125+ This option group does not include any C library functions;
126+ instead, it controls which EGLIBC tests an ordinary 'make
127+ tests' runs. With this group disabled, tests that would
128+ normally link against the standard C++ library are not
129+ run.
130+
131+ The standard C++ library depends on the math library 'libm' and
132+ the wide character I/O functions included in EGLIBC. So those
133+ option groups must be enabled if this test is enabled.
134+
135+config EGLIBC_CATGETS
136+ bool "Functions for accessing message catalogs"
137+ depends on EGLIBC_LOCALE_CODE
138+ help
139+ This option group includes functions for accessing message
140+ catalogs: catopen, catclose, and catgets.
141+
142+ This option group depends on the EGLIBC_LOCALE_CODE
143+ option group.
144+
145+config EGLIBC_CHARSETS
146+ bool "iconv/gconv character set conversion libraries"
147+ help
148+ This option group includes support for character sets other
149+ than ASCII (ANSI_X3.4-1968) and Unicode and ISO-10646 in their
150+ various encodings. This affects both the character sets
151+ supported by the wide and multibyte character functions, and
152+ those supported by the 'iconv' functions.
153+
154+ With this option group disabled, EGLIBC supports only the
155+ following character sets:
156+
157+ ANSI_X3.4 - ASCII
158+ ANSI_X3.4-1968
159+ ANSI_X3.4-1986
160+ ASCII
161+ CP367
162+ CSASCII
163+ IBM367
164+ ISO-IR-6
165+ ISO646-US
166+ ISO_646.IRV:1991
167+ OSF00010020
168+ US
169+ US-ASCII
170+
171+ 10646-1:1993 - ISO 10646, in big-endian UCS4 form
172+ 10646-1:1993/UCS4
173+ CSUCS4
174+ ISO-10646
175+ ISO-10646/UCS4
176+ OSF00010104
177+ OSF00010105
178+ OSF00010106
179+ UCS-4
180+ UCS-4BE
181+ UCS4
182+
183+ UCS-4LE - ISO 10646, in little-endian UCS4 form
184+
185+ ISO-10646/UTF-8 - ISO 10646, in UTF-8 form
186+ ISO-10646/UTF8
187+ ISO-IR-193
188+ OSF05010001
189+ UTF-8
190+ UTF8
191+
192+ ISO-10646/UCS2 - ISO 10646, in target-endian UCS2 form
193+ OSF00010100
194+ OSF00010101
195+ OSF00010102
196+ UCS-2
197+ UCS2
198+
199+ UCS-2BE - ISO 10646, in big-endian UCS2 form
200+ UNICODEBIG
201+
202+ UCS-2LE - ISO 10646, in little-endian UCS2 form
203+ UNICODELITTLE
204+
205+ WCHAR_T - EGLIBC's internal form (target-endian,
206+ 32-bit ISO 10646)
207+
208+config EGLIBC_CRYPT
209+ bool "Encryption library"
210+ help
211+ This option group includes the `libcrypt' library which
212+ provides functions for one-way encryption. Supported
213+ encryption algorithms include MD5, SHA-256, SHA-512 and DES.
214+
215+config EGLIBC_CRYPT_UFC
216+ bool "Ultra fast `crypt' implementation"
217+ depends on EGLIBC_CRYPT
218+ help
219+ This option group provides ultra fast DES-based implementation of
220+ the `crypt' function. When this option group is disabled,
221+ (a) the library will not provide the setkey[_r] and encrypt[_r]
222+ functions and (b) the crypt[_r] function will return NULL and set the
223+ errno to ENOSYS if /salt/ passed does not correspond to either MD5,
224+ SHA-256 or SHA-512 algorithm.
225+
226+config EGLIBC_DB_ALIASES
227+ bool "Functions for accessing the mail aliases database"
228+ help
229+ This option group includues functions for looking up mail
230+ aliases in '/etc/aliases' or using nsswitch. It includes the
231+ following functions:
232+
233+ endaliasent
234+ getaliasbyname
235+ getaliasbyname_r
236+ getaliasent
237+ getaliasent_r
238+ setaliasent
239+
240+ When this option group is disabled, the NSS service libraries
241+ also lack support for querying their mail alias tables.
242+
243+config EGLIBC_ENVZ
244+ bool "Functions for handling envz-style environment vectors."
245+ help
246+ This option group contains functions for creating and operating
247+ on envz vectors. An "envz vector" is a vector of strings in a
248+ contiguous block of memory, where each element is a name-value
249+ pair, and elements are separated from their neighbors by null
250+ characters.
251+
252+ This option group includes the following functions:
253+
254+ envz_add envz_merge
255+ envz_entry envz_remove
256+ envz_get envz_strip
257+
258+config EGLIBC_FCVT
259+ bool "Functions for converting floating-point numbers to strings"
260+ help
261+ This option group includes functions for converting
262+ floating-point numbers to strings.
263+
264+ This option group includes the following functions:
265+
266+ ecvt qecvt
267+ ecvt_r qecvt_r
268+ fcvt qfcvt
269+ fcvt_r qfcvt_r
270+ gcvt qgcvt
271+
272+config EGLIBC_FMTMSG
273+ bool "Functions for formatting messages"
274+ help
275+ This option group includes the following functions:
276+
277+ addseverity fmtmsg
278+
279+config EGLIBC_FSTAB
280+ bool "Access functions for 'fstab'"
281+ help
282+ This option group includes functions for reading the mount
283+ point specification table, '/etc/fstab'. These functions are
284+ not included in the POSIX standard, which provides the
285+ 'getmntent' family of functions instead.
286+
287+ This option group includes the following functions:
288+
289+ endfsent getfsspec
290+ getfsent setfsent
291+ getfsfile
292+
293+config EGLIBC_FTRAVERSE
294+ bool "Functions for traversing file hierarchies"
295+ help
296+ This option group includes functions for traversing file
297+ UNIX file hierachies.
298+
299+ This option group includes the following functions:
300+
301+ fts_open ftw
302+ fts_read nftw
303+ fts_children ftw64
304+ fts_set nftw64
305+ fts_close
306+
307+config EGLIBC_GETLOGIN
308+ bool "The getlogin function"
309+ depends on EGLIBC_UTMP
310+ help
311+ This function group includes the 'getlogin' and 'getlogin_r'
312+ functions, which return the user name associated by the login
313+ activity with the current process's controlling terminal.
314+
315+ With this option group disabled, the 'glob' function will not
316+ fall back on 'getlogin' to find the user's login name for tilde
317+ expansion when the 'HOME' environment variable is not set.
318+
319+config EGLIBC_IDN
320+ bool "International domain names support"
321+ help
322+ This option group includes the `libcidn' library which
323+ provides support for international domain names.
324+
325+config EGLIBC_INET
326+ bool "Networking support"
327+ help
328+ This option group includes networking-specific functions and
329+ data. With EGLIBC_INET disabled, the EGLIBC
330+ installation and API changes as follows:
331+
332+ - The following libraries are not installed:
333+
334+ libnsl
335+ libnss_compat
336+ libnss_dns
337+ libnss_hesiod
338+ libnss_nis
339+ libnss_nisplus
340+ libresolv
341+
342+ - The following functions and variables are omitted from libc:
343+
344+ authdes_create hstrerror svc_fdset
345+ authdes_getucred htonl svc_getreq
346+ authdes_pk_create htons svc_getreq_common
347+ authnone_create if_freenameindex svc_getreq_poll
348+ authunix_create if_indextoname svc_getreqset
349+ authunix_create_default if_nameindex svc_max_pollfd
350+ bindresvport if_nametoindex svc_pollfd
351+ callrpc in6addr_any svcraw_create
352+ cbc_crypt in6addr_loopback svc_register
353+ clnt_broadcast inet6_opt_append svc_run
354+ clnt_create inet6_opt_find svc_sendreply
355+ clnt_pcreateerror inet6_opt_finish svctcp_create
356+ clnt_perrno inet6_opt_get_val svcudp_bufcreate
357+ clnt_perror inet6_opt_init svcudp_create
358+ clntraw_create inet6_option_alloc svcudp_enablecache
359+ clnt_spcreateerror inet6_option_append svcunix_create
360+ clnt_sperrno inet6_option_find svcunixfd_create
361+ clnt_sperror inet6_option_init svc_unregister
362+ clnttcp_create inet6_option_next user2netname
363+ clntudp_bufcreate inet6_option_space xdecrypt
364+ clntudp_create inet6_opt_next xdr_accepted_reply
365+ clntunix_create inet6_opt_set_val xdr_array
366+ des_setparity inet6_rth_add xdr_authdes_cred
367+ ecb_crypt inet6_rth_getaddr xdr_authdes_verf
368+ endaliasent inet6_rth_init xdr_authunix_parms
369+ endhostent inet6_rth_reverse xdr_bool
370+ endnetent inet6_rth_segments xdr_bytes
371+ endnetgrent inet6_rth_space xdr_callhdr
372+ endprotoent inet_addr xdr_callmsg
373+ endrpcent inet_aton xdr_char
374+ endservent inet_lnaof xdr_cryptkeyarg
375+ ether_aton inet_makeaddr xdr_cryptkeyarg2
376+ ether_aton_r inet_netof xdr_cryptkeyres
377+ ether_hostton inet_network xdr_des_block
378+ ether_line inet_nsap_addr xdr_double
379+ ether_ntoa inet_nsap_ntoa xdr_enum
380+ ether_ntoa_r inet_ntoa xdr_float
381+ ether_ntohost inet_ntop xdr_free
382+ freeaddrinfo inet_pton xdr_getcredres
383+ freeifaddrs innetgr xdr_hyper
384+ gai_strerror iruserok xdr_int
385+ getaddrinfo iruserok_af xdr_int16_t
386+ getaliasbyname key_decryptsession xdr_int32_t
387+ getaliasbyname_r key_decryptsession_pk xdr_int64_t
388+ getaliasent key_encryptsession xdr_int8_t
389+ getaliasent_r key_encryptsession_pk xdr_keybuf
390+ gethostbyaddr key_gendes xdr_key_netstarg
391+ gethostbyaddr_r key_get_conv xdr_key_netstres
392+ gethostbyname key_secretkey_is_set xdr_keystatus
393+ gethostbyname2 key_setnet xdr_long
394+ gethostbyname2_r key_setsecret xdr_longlong_t
395+ gethostbyname_r netname2host xdrmem_create
396+ gethostent netname2user xdr_netnamestr
397+ gethostent_r ntohl xdr_netobj
398+ getifaddrs ntohs xdr_opaque
399+ getipv4sourcefilter passwd2des xdr_opaque_auth
400+ get_myaddress pmap_getmaps xdr_pmap
401+ getnameinfo pmap_getport xdr_pmaplist
402+ getnetbyaddr pmap_rmtcall xdr_pointer
403+ getnetbyaddr_r pmap_set xdr_quad_t
404+ getnetbyname pmap_unset xdrrec_create
405+ getnetbyname_r rcmd xdrrec_endofrecord
406+ getnetent rcmd_af xdrrec_eof
407+ getnetent_r registerrpc xdrrec_skiprecord
408+ getnetgrent res_init xdr_reference
409+ getnetgrent_r rexec xdr_rejected_reply
410+ getnetname rexec_af xdr_replymsg
411+ getprotobyname rexecoptions xdr_rmtcall_args
412+ getprotobyname_r rpc_createerr xdr_rmtcallres
413+ getprotobynumber rresvport xdr_short
414+ getprotobynumber_r rresvport_af xdr_sizeof
415+ getprotoent rtime xdrstdio_create
416+ getprotoent_r ruserok xdr_string
417+ getpublickey ruserok_af xdr_u_char
418+ getrpcbyname ruserpass xdr_u_hyper
419+ getrpcbyname_r setaliasent xdr_u_int
420+ getrpcbynumber sethostent xdr_uint16_t
421+ getrpcbynumber_r setipv4sourcefilter xdr_uint32_t
422+ getrpcent setnetent xdr_uint64_t
423+ getrpcent_r setnetgrent xdr_uint8_t
424+ getrpcport setprotoent xdr_u_long
425+ getsecretkey setrpcent xdr_u_longlong_t
426+ getservbyname setservent xdr_union
427+ getservbyname_r setsourcefilter xdr_unixcred
428+ getservbyport svcauthdes_stats xdr_u_quad_t
429+ getservbyport_r svcerr_auth xdr_u_short
430+ getservent svcerr_decode xdr_vector
431+ getservent_r svcerr_noproc xdr_void
432+ getsourcefilter svcerr_noprog xdr_wrapstring
433+ h_errlist svcerr_progvers xencrypt
434+ h_errno svcerr_systemerr xprt_register
435+ herror svcerr_weakauth xprt_unregister
436+ h_nerr svc_exit
437+ host2netname svcfd_create
438+
439+ - The rpcgen, nscd, and rpcinfo commands are not installed.
440+
441+ - The 'rpc' file (a text file listing RPC services) is not installed.
442+
443+ Socket-related system calls do not fall in this option group,
444+ because many are also used for other inter-process
445+ communication mechanisms. For example, the 'syslog' routines
446+ use Unix-domain sockets to communicate with the syslog daemon;
447+ syslog is valuable in non-networked contexts.
448+
449+config EGLIBC_INET_ANL
450+ bool "Asynchronous name lookup"
451+ depends on EGLIBC_INET
452+ help
453+ This option group includes the `libanl' library which
454+ provides support for asynchronous name lookup.
455+
456+config EGLIBC_LIBM
457+ bool "libm (math library)"
458+ help
459+ This option group includes the 'libm' library, containing
460+ mathematical functions. If this option group is omitted, then
461+ an EGLIBC installation does not include shared or unshared versions
462+ of the math library.
463+
464+ Note that this does not remove all floating-point related
465+ functionality from EGLIBC; for example, 'printf' and 'scanf'
466+ can still print and read floating-point values with this option
467+ group disabled.
468+
469+ Note that the ISO Standard C++ library 'libstdc++' depends on
470+ EGLIBC's math library 'libm'. If you disable this option
471+ group, you will not be able to build 'libstdc++' against the
472+ resulting EGLIBC installation.
473+
474+config EGLIBC_LOCALES
475+ bool "Locale definitions"
476+ help
477+ This option group includes all locale definitions other than
478+ that for the "C" locale. If this option group is omitted, then
479+ only the "C" locale is supported.
480+
481+
482+config EGLIBC_LOCALE_CODE
483+ bool "Locale functions"
484+ depends on POSIX_C_LANG_WIDE_CHAR
485+ help
486+ This option group includes locale support functions, programs,
487+ and libraries. With EGLIBC_LOCALE_CODE disabled,
488+ EGLIBC supports only the 'C' locale (also known as 'POSIX'),
489+ and ignores the settings of the 'LANG' and 'LC_*' environment
490+ variables.
491+
492+ With EGLIBC_LOCALE_CODE disabled, the following
493+ functions are omitted from libc:
494+
495+ duplocale localeconv nl_langinfo rpmatch strfmon_l
496+ freelocale newlocale nl_langinfo_l strfmon uselocale
497+
498+ Furthermore, only the LC_CTYPE and LC_TIME categories of the
499+ standard "C" locale are available.
500+
501+ The EGLIBC_CATGETS option group depends on this option group.
502+
503+
504+config EGLIBC_MEMUSAGE
505+ bool "Memory profiling library"
506+ help
507+ This option group includes the `libmemusage' library and
508+ the `memusage' and `memusagestat' utilities.
509+ These components provide memory profiling functions.
510+
511+config EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
512+ int "Memory profiling library buffer size"
513+ depends on EGLIBC_MEMUSAGE
514+ default "32768"
515+ help
516+ Libmemusage library buffers the profiling data in memory
517+ before writing it out to disk. By default, the library
518+ allocates 1.5M buffer, which can be substantial for some
519+ systems. EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE option
520+ allows to change the default buffer size. It specifies
521+ the number of entries the buffer should have.
522+ On most architectures one buffer entry amounts to 48 bytes,
523+ so setting this option to the value of 512 will reduce the size of
524+ the memory buffer to 24K.
525+
526+config EGLIBC_NIS
527+ bool "Support for NIS, NIS+, and the special 'compat' services."
528+ depends on EGLIBC_INET && EGLIBC_SUNRPC
529+ help
530+ This option group includes the NIS, NIS+, and 'compat' Name
531+ Service Switch service libraries. When it is disabled, those
532+ services libraries are not installed; you should remove any
533+ references to them from your 'nsswitch.conf' file.
534+
535+ This option group depends on the EGLIBC_INET option
536+ group; you must enable that to enable this option group.
537+
538+config EGLIBC_NSSWITCH
539+ bool "Name service switch (nsswitch) support"
540+ help
541+ This option group includes support for the 'nsswitch' facility.
542+ With this option group enabled, all EGLIBC functions for
543+ accessing various system databases (passwords and groups;
544+ networking; aliases; public keys; and so on) consult the
545+ '/etc/nsswitch.conf' configuration file to decide how to handle
546+ queries.
547+
548+ With this option group disabled, EGLIBC uses a fixed list of
549+ services to satisfy queries on each database, as requested by
550+ configuration files specified when EGLIBC is built. Your
551+ 'option-groups.config' file must set the following two
552+ variables:
553+
554+config EGLIBC_NSSWITCH_FIXED_CONFIG
555+ string "Nsswitch fixed config filename"
556+ depends on !EGLIBC_NSSWITCH
557+ default ""
558+ help
559+ Set this to the name of a file whose contents observe the
560+ same syntax as an ordinary '/etc/nsswitch.conf' file. The
561+ EGLIBC build process parses this file just as EGLIBC would
562+ at run time if EGLIBC_NSSWITCH were enabled, and
563+ produces a C library that uses the nsswitch service
564+ libraries to search for database entries as this file
565+ specifies, instead of consulting '/etc/nsswitch.conf' at run
566+ time.
567+
568+ This should be an absolute filename. The EGLIBC build
569+ process may use it from several different working
570+ directories. It may include references to Makefile
571+ variables like 'common-objpfx' (the top of the build tree,
572+ with a trailing slash), or '..' (the top of the source tree,
573+ with a trailing slash).
574+
575+ The EGLIBC source tree includes a sample configuration file
576+ named 'nss/fixed-nsswitch.conf'; for simple configurations,
577+ you will probably want to delete references to databases not
578+ needed on your system.
579+
580+config EGLIBC_NSSWITCH_FIXED_FUNCTIONS
581+ string "Nsswitch fixed functions filename"
582+ depends on !EGLIBC_NSSWITCH
583+ default ""
584+ help
585+ The EGLIBC build process uses this file to decide which
586+ functions to make available from which service libraries.
587+ The file 'nss/fixed-nsswitch.functions' serves as a sample
588+ configuration file for this setting, and explains its syntax
589+ and meaning in more detail.
590+
591+ This should be an absolute file name. The EGLIBC build
592+ process may use it from several different working
593+ directories. It may include references to Makefile
594+ variables like 'common-objpfx' (the top of the build tree,
595+ with a trailing slash), or '..' (the top of the source tree,
596+ with a trailing slash).
597+
598+ Be sure to mention each function in each service you wish to
599+ use. If you do not mention a service's function here, the
600+ EGLIBC database access functions will not find it, even if
601+ it is listed in the EGLIBC_NSSWITCH_FIXED_CONFIG
602+ file.
603+
604+ In this arrangement, EGLIBC will not use the 'dlopen' and
605+ 'dlsym' functions to find database access functions. Instead,
606+ libc hard-codes references to the service libraries' database
607+ access functions. You must explicitly link your program
608+ against the name service libraries (those whose names start
609+ with 'libnss_', in the sysroot's '/lib' directory) whose
610+ functions you intend to use. This arrangement helps
611+ system-wide static analysis tools decide which functions a
612+ system actually uses.
613+
614+ Note that some nsswitch service libraries require other option
615+ groups to be enabled; for example, the EGLIBC_INET
616+ option group must be enabled to use the 'libnss_dns.so.2'
617+ service library, which uses the Domain Name System network
618+ protocol to answer queries.
619+
620+config EGLIBC_RCMD
621+ bool "Support for 'rcmd' and related library functions"
622+ depends on EGLIBC_INET
623+ help
624+ This option group includes functions for running commands on
625+ remote machines via the 'rsh' protocol, and doing authentication
626+ related to those functions. This also includes functions that
627+ use the 'rexec' protocol.
628+
629+ This option group includes the following functions:
630+
631+ rcmd ruserok
632+ rcmd_af ruserok_af
633+ rexec iruserok
634+ rexec_af iruserok_af
635+ rresvport ruserpass
636+ rresvport_af
637+
638+config EGLIBC_RTLD_DEBUG
639+ bool "Runtime linker debug print outs"
640+ help
641+ This option group enables debug output of the runtime linker
642+ which is activated via LD_DEBUG and LD_TRACE_PRELINKING
643+ environment variables. Disabling this option group yields
644+ a smaller runtime linker binary.
645+ BEWARE: Disabling this option group is likely to break
646+ the `ldd' utility which may also be used by the prelinker.
647+ In particular, the `--unused' ldd option will not work correctly.
648+
649+config EGLIBC_SPAWN
650+ bool "Support for POSIX posix_spawn functions"
651+ help
652+ This option group includes the POSIX functions for executing
653+ programs in child processes without using 'fork' or 'vfork'.
654+
655+ This option group includes the following functions:
656+
657+ posix_spawn
658+ posix_spawnattr_destroy
659+ posix_spawnattr_getflags
660+ posix_spawnattr_getpgroup
661+ posix_spawnattr_getschedparam
662+ posix_spawnattr_getschedpolicy
663+ posix_spawnattr_getsigdefault
664+ posix_spawnattr_getsigmask
665+ posix_spawnattr_init
666+ posix_spawnattr_setflags
667+ posix_spawnattr_setpgroup
668+ posix_spawnattr_setschedparam
669+ posix_spawnattr_setschedpolicy
670+ posix_spawnattr_setsigdefault
671+ posix_spawnattr_setsigmask
672+ posix_spawn_file_actions_addclose
673+ posix_spawn_file_actions_adddup2
674+ posix_spawn_file_actions_addopen
675+ posix_spawn_file_actions_destroy
676+ posix_spawn_file_actions_init
677+ posix_spawnp
678+
679+ This option group also provides the ability for the iconv,
680+ localedef, and locale programs to operate transparently on
681+ compressed charset definitions. When this option group is
682+ disabled, those programs will only operate on uncompressed
683+ charmap files.
684+
685+config EGLIBC_STREAMS
686+ bool "Support for accessing STREAMS."
687+ help
688+ This option group includes functions for reading and writing
689+ messages to and from STREAMS. The STREAMS interface provides a
690+ uniform mechanism for implementing networking services and other
691+ character-based I/O. (STREAMS are not to be confused with
692+ <stdio.h> FILE objects, also called 'streams'.)
693+
694+ This option group includes the following functions:
695+
696+ getmsg putpmsg
697+ getpmsg fattach
698+ isastream fdetach
699+ putmsg
700+
701+config EGLIBC_SUNRPC
702+ bool "Support for the Sun 'RPC' protocol."
703+ depends on EGLIBC_INET
704+ help
705+ This option group includes support for the Sun RPC protocols,
706+ including the 'rpcgen' and 'rpcinfo' programs.
707+
708+config EGLIBC_UTMP
709+ bool "Older access functions for 'utmp' login records"
710+ help
711+ This option group includes the older 'utent' family of
712+ functions for accessing user login records in the 'utmp' file.
713+ POSIX omits these functions in favor of the 'utxent' family,
714+ and they are obsolete on systems other than Linux.
715+
716+ This option group includes the following functions:
717+
718+ endutent
719+ getutent
720+ getutent_r
721+ getutid
722+ getutid_r
723+ getutline
724+ getutline_r
725+ logwtmp
726+ pututline
727+ setutent
728+ updwtmp
729+ utmpname
730+
731+ This option group includes the following libraries:
732+
733+ libutil.so (and libutil.a)
734+
735+config EGLIBC_UTMPX
736+ bool "POSIX access functions for 'utmp' login records"
737+ depends on EGLIBC_UTMP
738+ help
739+ This option group includes the POSIX functions for reading and
740+ writing user login records in the 'utmp' file (usually
741+ '/var/run/utmp'). The POSIX functions operate on 'struct
742+ utmpx' structures, as opposed to the family of older 'utent'
743+ functions, which operate on 'struct utmp' structures.
744+
745+ This option group includes the following functions:
746+
747+ endutxent
748+ getutmp
749+ getutmpx
750+ getutxent
751+ getutxid
752+ getutxline
753+ pututxline
754+ setutxent
755+ updwtmpx
756+ utmpxname
757+
758+config EGLIBC_WORDEXP
759+ bool "Shell-style word expansion"
760+ help
761+ This option group includes the 'wordexp' function for
762+ performing word expansion in the manner of the shell, and the
763+ accompanying 'wordfree' function.
764+
765+config POSIX_C_LANG_WIDE_CHAR
766+ bool "ISO C library wide character functions, excluding I/O"
767+ help
768+ This option group includes the functions defined by the ISO C
769+ standard for working with wide and multibyte characters in
770+ memory. Functions for reading and writing wide and multibyte
771+ characters from and to files call in the
772+ POSIX_WIDE_CHAR_DEVICE_IO option group.
773+
774+ This option group includes the following functions:
775+
776+ btowc mbsinit wcscspn wcstoll
777+ iswalnum mbsrtowcs wcsftime wcstombs
778+ iswalpha mbstowcs wcslen wcstoul
779+ iswblank mbtowc wcsncat wcstoull
780+ iswcntrl swprintf wcsncmp wcstoumax
781+ iswctype swscanf wcsncpy wcsxfrm
782+ iswdigit towctrans wcspbrk wctob
783+ iswgraph towlower wcsrchr wctomb
784+ iswlower towupper wcsrtombs wctrans
785+ iswprint vswprintf wcsspn wctype
786+ iswpunct vswscanf wcsstr wmemchr
787+ iswspace wcrtomb wcstod wmemcmp
788+ iswupper wcscat wcstof wmemcpy
789+ iswxdigit wcschr wcstoimax wmemmove
790+ mblen wcscmp wcstok wmemset
791+ mbrlen wcscoll wcstol
792+ mbrtowc wcscpy wcstold
793+
794+config POSIX_REGEXP
795+ bool "Regular expressions"
796+ help
797+ This option group includes the POSIX regular expression
798+ functions, and the associated non-POSIX extensions and
799+ compatibility functions.
800+
801+ With POSIX_REGEXP disabled, the following functions are
802+ omitted from libc:
803+
804+ re_comp re_max_failures regcomp
805+ re_compile_fastmap re_search regerror
806+ re_compile_pattern re_search_2 regexec
807+ re_exec re_set_registers regfree
808+ re_match re_set_syntax rpmatch
809+ re_match_2 re_syntax_options
810+
811+ Furthermore, the compatibility regexp interface defined in the
812+ <regexp.h> header file, 'compile', 'step', and 'advance', is
813+ omitted.
814+
815+config POSIX_REGEXP_GLIBC
816+ bool "Regular expressions from GLIBC"
817+ depends on POSIX_REGEXP
818+ help
819+ This option group specifies which regular expression
820+ library to use. The choice is between regex
821+ implementation from GLIBC and regex implementation from
822+ libiberty. The GLIBC variant is fully POSIX conformant and
823+ optimized for speed; regex from libiberty is more than twice
824+ as small while still is enough for most practical purposes.
825+
826+config POSIX_WIDE_CHAR_DEVICE_IO
827+ bool "Input and output functions for wide characters"
828+ depends on POSIX_C_LANG_WIDE_CHAR
829+ help
830+ This option group includes functions for reading and writing
831+ wide characters to and from <stdio.h> streams.
832+
833+ This option group includes the following functions:
834+
835+ fgetwc fwprintf putwchar vwscanf
836+ fgetws fwscanf ungetwc wprintf
837+ fputwc getwc vfwprintf wscanf
838+ fputws getwchar vfwscanf
839+ fwide putwc vwprintf
840+
841+ This option group further includes the following unlocked
842+ variants of the above functions:
843+
844+ fgetwc_unlocked getwc_unlocked
845+ fgetws_unlocked getwchar_unlocked
846+ fputwc_unlocked putwc_unlocked
847+ fputws_unlocked putwchar_unlocked
848+
849+ Note that the GNU standard C++ library, 'libstdc++.so', uses
850+ some of these functions; you will not be able to link or run
851+ C++ programs if you disable this option group.
852+
853+ This option group also affects the behavior of the following
854+ functions:
855+
856+ fdopen
857+ fopen
858+ fopen64
859+ freopen
860+ freopen64
861+
862+ These functions all take an OPENTYPE parameter which may
863+ contain a string of the form ",ccs=CHARSET", indicating that
864+ the underlying file uses the character set named CHARSET.
865+ This produces a wide-oriented stream, which is only useful
866+ when the functions included in this option group are present.
867+ If the user attempts to open a file specifying a character set
868+ in the OPENTYPE parameter, and EGLIBC was built with this
869+ option group disabled, the function returns NULL, and sets
870+ errno to EINVAL.
871+
872+
873+# This helps Emacs users browse this file using the page motion commands
874+# and commands like 'pages-directory'.
875+# Local Variables:
876+# page-delimiter: "^config\\s-"
877+# End:
878Index: git/option-groups.mak
879===================================================================
880--- /dev/null 1970-01-01 00:00:00.000000000 +0000
881+++ git/option-groups.mak 2014-08-27 07:26:51.652070587 +0000
882@@ -0,0 +1,41 @@
883+# Setup file for subdirectory Makefiles that define EGLIBC option groups.
884+
885+# EGLIBC shouldn't need to override this. However, the
886+# cross-build-friendly localedef includes this makefile to get option
887+# group variable definitions; it uses a single build tree for all the
888+# multilibs, and needs to be able to specify a different option group
889+# configuration file for each multilib.
890+option_group_config_file ?= $(objdir)/option-groups.config
891+
892+# Read the default settings for all options.
893+# We're included before ../Rules, so we can't assume $(..) is set.
894+include $(firstword $(..) ../)option-groups.defaults
895+
896+# Read the developer's option group selections, overriding the
897+# defaults from option-groups.defaults.
898+-include $(option_group_config_file)
899+
900+# $(call option-disabled, VAR) is 'y' if VAR is not 'y', or 'n' otherwise.
901+# VAR should be a variable name, not a variable reference; this is
902+# less general, but more terse for the intended use.
903+# You can use it to add a file to a list if an option group is
904+# disabled, like this:
905+# routines-$(call option-disabled, OPTION_POSIX_C_LANG_WIDE_CHAR) += ...
906+define option-disabled
907+$(firstword $(subst y,n,$(filter y,$($(strip $(1))))) y)
908+endef
909+
910+# Establish 'routines-y', etc. as simply-expanded variables.
911+aux-y :=
912+extra-libs-others-y :=
913+extra-libs-y :=
914+extra-objs-y :=
915+install-bin-y :=
916+install-others-y :=
917+install-sbin-y :=
918+others-y :=
919+others-pie-y :=
920+routines-y :=
921+test-srcs-y :=
922+tests-y :=
923+xtests-y :=
924Index: git/option-groups.defaults
925===================================================================
926--- /dev/null 1970-01-01 00:00:00.000000000 +0000
927+++ git/option-groups.defaults 2014-08-27 07:24:41.652070587 +0000
928@@ -0,0 +1,47 @@
929+# This file sets default values for all option group variables
930+# mentioned in option-groups.def; see that file for a description of
931+# each option group.
932+#
933+# Subdirectory makefiles include this file before including the user's
934+# settings from option-groups.config at the top of the build tree;
935+# that file need only refer to those options whose default settings
936+# are to be changed.
937+#
938+# By default, all option groups are enabled.
939+OPTION_EGLIBC_ADVANCED_INET6 = y
940+OPTION_EGLIBC_BACKTRACE = y
941+OPTION_EGLIBC_BIG_MACROS = y
942+OPTION_EGLIBC_BSD = y
943+OPTION_EGLIBC_CXX_TESTS = y
944+OPTION_EGLIBC_CATGETS = y
945+OPTION_EGLIBC_CHARSETS = y
946+OPTION_EGLIBC_CRYPT = y
947+OPTION_EGLIBC_CRYPT_UFC = y
948+OPTION_EGLIBC_DB_ALIASES = y
949+OPTION_EGLIBC_ENVZ = y
950+OPTION_EGLIBC_FCVT = y
951+OPTION_EGLIBC_FMTMSG = y
952+OPTION_EGLIBC_FSTAB = y
953+OPTION_EGLIBC_FTRAVERSE = y
954+OPTION_EGLIBC_GETLOGIN = y
955+OPTION_EGLIBC_IDN = y
956+OPTION_EGLIBC_INET = y
957+OPTION_EGLIBC_INET_ANL = y
958+OPTION_EGLIBC_LIBM = y
959+OPTION_EGLIBC_LOCALES = y
960+OPTION_EGLIBC_LOCALE_CODE = y
961+OPTION_EGLIBC_MEMUSAGE = y
962+OPTION_EGLIBC_NIS = y
963+OPTION_EGLIBC_NSSWITCH = y
964+OPTION_EGLIBC_RCMD = y
965+OPTION_EGLIBC_RTLD_DEBUG = y
966+OPTION_EGLIBC_SPAWN = y
967+OPTION_EGLIBC_STREAMS = y
968+OPTION_EGLIBC_SUNRPC = y
969+OPTION_EGLIBC_UTMP = y
970+OPTION_EGLIBC_UTMPX = y
971+OPTION_EGLIBC_WORDEXP = y
972+OPTION_POSIX_C_LANG_WIDE_CHAR = y
973+OPTION_POSIX_REGEXP = y
974+OPTION_POSIX_REGEXP_GLIBC = y
975+OPTION_POSIX_WIDE_CHAR_DEVICE_IO = y
976Index: git/Makefile
977===================================================================
978--- git.orig/Makefile 2014-08-27 07:24:37.540070587 +0000
979+++ git/Makefile 2014-08-27 07:24:41.656070587 +0000
980@@ -24,6 +24,7 @@
981
982 include Makeconfig
983
984+include options-config/Makefile
985
986 # This is the default target; it makes everything except the tests.
987 .PHONY: all
988Index: git/EGLIBC.option-groups
989===================================================================
990--- /dev/null 1970-01-01 00:00:00.000000000 +0000
991+++ git/EGLIBC.option-groups 2014-08-27 07:24:41.656070587 +0000
992@@ -0,0 +1,122 @@
993+ -*- mode: text -*-
994+
995+ The EGLIBC Component Configuration System
996+ Jim Blandy <jimb@codesourcery.com>
997+
998+Introduction
999+
1000+The GNU C library (GLIBC) provides a broad range of functionality,
1001+ranging from internationalization support to transcendental
1002+mathematical functions. Its website boasts that "nearly all known and
1003+useful functions from any other C library are available." This
1004+exhaustive approach has been one of GLIBC's strengths on desktop and
1005+server systems, but it has also given GLIBC a large footprint, both in
1006+memory and on disk, making it a challenge to use in embedded systems
1007+with limited resources.
1008+
1009+The Embedded GNU C library (EGLIBC) is a variant of the GNU C library
1010+designed to work well on embedded systems. In particular, EGLIBC's
1011+component configuration system allows embedded developers to build
1012+customized versions of the library that include only the features
1013+their application uses, reducing its space requirements.
1014+
1015+EGLIBC's component configuration system categorizes the library's
1016+functions into "option groups", and allows you to include or exclude
1017+option groups individually. Some option groups depend on others;
1018+EGLIBC tracks these relationships, and ensures that the selected
1019+configuration yields a functioning library.
1020+
1021+
1022+Consistent and Predictable Behavior
1023+
1024+A flexible configuration system is a mixed blessing: if the options
1025+offered are poorly designed, it can be hard to see which choices will
1026+have the desired effects, and choices with obscure consequences can
1027+make debugging difficult. EGLIBC's configuration follows some general
1028+principles to reduce these risks:
1029+
1030+- EGLIBC has a single default configuration for each target
1031+ architecture.
1032+
1033+- In the default configuration, all option groups are enabled, and
1034+ EGLIBC is upwardly API- and ABI-compatible with GLIBC.
1035+
1036+- As much as possible, configurations only affect what functions are
1037+ present, not how they behave. If the system works with an option
1038+ group disabled, it will still work with it enabled.
1039+
1040+- As much as possible, configurations only select option groups ---
1041+ they do not describe characteristics of the target architecture.
1042+
1043+These rules mean that you have a simple debugging strategy available
1044+if you suspect that your EGLIBC configuration might be the source of a
1045+problem: fall back to the default configuration, re-test, and then
1046+disable option groups one by one, until the problem reappears.
1047+
1048+
1049+The Option Groups
1050+
1051+To see the current full list of implemented option groups, refer to the
1052+file 'option-groups.def' at the top of the source tree, or run
1053+'make menuconfig' from the top-level build directory.
1054+
1055+The POSIX.1-2001 specification includes a suggested partition of all
1056+the functions in the POSIX C API into option groups: math functions
1057+like 'sin' and 'cos'; networking functions like 'socket' and
1058+'connect'; and so on. EGLIBC could use this partitioning as the basis
1059+for future option groups.
1060+
1061+
1062+Implementation
1063+
1064+The EGLIBC component configuration system resembles the approach used
1065+by the Linux kernel to select device drivers, network protocols, and
1066+other features. A file named 'option-groups.config' in the top-level
1067+build directory contains assignments to Make variables, each of which
1068+enables or disables a particular option group. If the variable's
1069+value is set to 'y', then the option group is enabled; if it set to
1070+anything else, the option group is omitted. The file
1071+'option-groups.defaults', at the top of the source tree, establishes
1072+default values for all variables; all option groups are enabled by
1073+default.
1074+
1075+For example, the following 'option-groups.config' would omit locale
1076+data, but include mathematical functions, and everything else:
1077+
1078+ OPTION_EGLIBC_LOCALES = n
1079+ OPTION_EGLIBC_LIBM = y
1080+
1081+Like the Linux kernel, EGLIBC supports a similar set of '*config' make
1082+targets to make it easier to create 'option-groups.config', with all
1083+dependencies between option groups automatically satisfied. Run
1084+'make help' to see the list of supported make config targets. For
1085+example, 'make menuconfig' will update the current config utilising a
1086+menu based program.
1087+
1088+The option group names and their type (boolean, int, hex, string), help
1089+description, and dependencies with other option groups, are described by
1090+'option-groups.def' at the top of the source tree, analogous to the
1091+'Kconfig' files in the Linux kernel.
1092+
1093+In general, each option group variable controls whether a given set of
1094+object files in EGLIBC is compiled and included in the final
1095+libraries, or omitted from the build.
1096+
1097+Each subdirectory's Makefile categorizes its routines, libraries, and
1098+executables by option group. For example, EGLIBC's 'math/Makefile'
1099+places the 'libm' library in the OPTION_EGLIBC_LIBM group as follows:
1100+
1101+ extra-libs-$(OPTION_EGLIBC_LIBM) := libm
1102+
1103+Finally, common code in 'Makerules' cites the value of the variable
1104+'extra-libs-y', selecting only those libraries that belong to enabled
1105+option groups to be built.
1106+
1107+
1108+Current Status and Future Directions
1109+
1110+The EGLIBC component configuration system described here is still
1111+under development.
1112+
1113+We have used the system to subset some portions of EGLIBC's
1114+Index: libc/configure.ac
1115Index: git/configure.ac
1116===================================================================
1117--- git.orig/configure.ac 2014-08-27 07:24:41.196070587 +0000
1118+++ git/configure.ac 2014-08-27 07:24:41.656070587 +0000
1119@@ -127,6 +127,16 @@
1120 [sysheaders=''])
1121 AC_SUBST(sysheaders)
1122
1123+AC_ARG_WITH([kconfig],
1124+ AC_HELP_STRING([--with-kconfig=PATH],
1125+ [location of kconfig tools to use (from Linux
1126+ kernel builds) to re-use for configuring EGLIBC
1127+ option groups]),
1128+ [KCONFIG_TOOLS=$withval],
1129+ [KCONFIG_TOOLS=''])
1130+AC_SUBST(KCONFIG_TOOLS)
1131+
1132+
1133 AC_SUBST(use_default_link)
1134 AC_ARG_WITH([default-link],
1135 AC_HELP_STRING([--with-default-link],
1136Index: git/config.make.in
1137===================================================================
1138--- git.orig/config.make.in 2014-08-27 07:24:37.560070587 +0000
1139+++ git/config.make.in 2014-08-27 07:24:41.656070587 +0000
1140@@ -46,6 +46,8 @@
1141 c++-sysincludes = @CXX_SYSINCLUDES@
1142 all-warnings = @all_warnings@
1143
1144+kconfig_tools = @KCONFIG_TOOLS@
1145+
1146 have-z-combreloc = @libc_cv_z_combreloc@
1147 have-z-execstack = @libc_cv_z_execstack@
1148 have-Bgroup = @libc_cv_Bgroup@
1149Index: git/configure
1150===================================================================
1151--- git.orig/configure 2014-08-27 07:24:41.192070587 +0000
1152+++ git/configure 2014-08-27 07:24:41.660070587 +0000
1153@@ -619,6 +619,7 @@
1154 PERL
1155 BASH_SHELL
1156 libc_cv_gcc_static_libgcc
1157+KCONFIG_TOOLS
1158 CXX_SYSINCLUDES
1159 SYSINCLUDES
1160 AUTOCONF
1161@@ -733,6 +734,7 @@
1162 with_binutils
1163 with_selinux
1164 with_headers
1165+with_kconfig
1166 with_default_link
1167 enable_sanity_checks
1168 enable_shared
1169@@ -1437,6 +1439,9 @@
1170 --with-selinux if building with SELinux support
1171 --with-headers=PATH location of system headers to use (for example
1172 /usr/src/linux/include) [default=compiler default]
1173+ --with-kconfig=PATH location of kconfig tools to use (from Linux kernel
1174+ builds) to re-use for configuring EGLIBC option
1175+ groups
1176 --with-default-link do not use explicit linker scripts
1177 --with-cpu=CPU select code for CPU variant
1178
1179@@ -3400,6 +3405,14 @@
1180
1181
1182
1183+# Check whether --with-kconfig was given.
1184+if test "${with_kconfig+set}" = set; then
1185+ withval=$with_kconfig; KCONFIG_TOOLS=$withval
1186+else
1187+ KCONFIG_TOOLS=''
1188+fi
1189+
1190+
1191
1192 # Check whether --with-default-link was given.
1193 if test "${with_default_link+set}" = set; then :
1194Index: git/options-config/Makefile
1195===================================================================
1196--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1197+++ git/options-config/Makefile 2014-08-27 07:24:41.652070587 +0000
1198@@ -0,0 +1,55 @@
1199+# ===========================================================================
1200+# EGLIBC option-groups configuration targets
1201+# These targets are included from top-level makefile
1202+
1203+ifneq ($(kconfig_tools),)
1204+ifneq (no,$(PERL))
1205+
1206+ocdir := options-config
1207+
1208+OconfigDefaults := option-groups.defaults
1209+OconfigDefaults_tmp := $(common-objpfx).tmp.defconfig
1210+OconfigDef := option-groups.def
1211+Oconfig := $(common-objpfx)option-groups.config
1212+Oconfig_tmp := $(common-objpfx).tmp.config
1213+
1214+conf := $(kconfig_tools)/conf
1215+mconf := $(kconfig_tools)/mconf
1216+
1217+preproc := $(PERL) $(ocdir)/config-preproc.pl
1218+postproc := $(PERL) $(ocdir)/config-postproc.pl
1219+
1220+PHONY += defconfig config menuconfig
1221+
1222+defconfig: $(conf) $(OconfigDefaults) $(OconfigDef)
1223+ rm -f $(OconfigDefaults_tmp)
1224+ rm -f $(Oconfig_tmp)
1225+ $(preproc) $(OconfigDefaults) > $(OconfigDefaults_tmp)
1226+ KCONFIG_CONFIG=$(Oconfig_tmp) $< --defconfig=$(OconfigDefaults_tmp) \
1227+ $(OconfigDef)
1228+ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig)
1229+ rm $(Oconfig_tmp)
1230+ rm $(OconfigDefaults_tmp)
1231+
1232+config: $(conf) $(OconfigDefaults) $(OconfigDef)
1233+ rm -f $(Oconfig_tmp)
1234+ $(preproc) $(wildcard $(Oconfig)) > $(Oconfig_tmp)
1235+ KCONFIG_CONFIG=$(Oconfig_tmp) $< --oldaskconfig $(OconfigDef)
1236+ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig)
1237+ rm $(Oconfig_tmp)
1238+
1239+menuconfig: $(mconf) $(OconfigDefaults) $(OconfigDef)
1240+ rm -f $(Oconfig_tmp)
1241+ $(preproc) $(wildcard $(Oconfig)) > $(Oconfig_tmp)
1242+ KCONFIG_CONFIG=$(Oconfig_tmp) $< $(OconfigDef)
1243+ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig)
1244+ rm $(Oconfig_tmp)
1245+
1246+# Help text used by make help
1247+help:
1248+ @echo ' defconfig - New config with default from default config'
1249+ @echo ' config - Update current config utilising a line-oriented program'
1250+ @echo ' menuconfig - Update current config utilising a menu based program'
1251+
1252+endif
1253+endif
1254Index: git/options-config/config-postproc.pl
1255===================================================================
1256--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1257+++ git/options-config/config-postproc.pl 2014-08-27 07:24:41.652070587 +0000
1258@@ -0,0 +1,58 @@
1259+#!/usr/bin/perl
1260+
1261+$usage = "usage: $0 <default config file> <config file>\n";
1262+
1263+die "$usage" unless @ARGV;
1264+$defaults = shift @ARGV;
1265+die "$usage" unless @ARGV;
1266+die "Could not open $ARGV[0]" unless -T $ARGV[0];
1267+
1268+sub yank {
1269+ @option = grep(!($_ =~ /$_[0]\s*=/), @option);
1270+}
1271+
1272+open(DEFAULTS, $defaults) || die "Could not open $defaults\n";
1273+
1274+# get the full list of available options using the default config file
1275+$i = 0;
1276+while (<DEFAULTS>) {
1277+ if (/^\s*OPTION_(\w+\s*=.*$)/) {
1278+ $option[$i++] = $1;
1279+ }
1280+}
1281+
1282+# now go through the config file, making the necessary changes
1283+while (<>) {
1284+ if (/Linux Kernel Configuration/) {
1285+ # change title
1286+ s/Linux Kernel/Option Groups/;
1287+ print;
1288+ } elsif (/^\s*CONFIG_(\w+)\s*=/) {
1289+ # this is an explicit option set line, change CONFIG_ to OPTION_
1290+ # before printing and remove this option from option list
1291+ $opt = $1;
1292+ yank($opt);
1293+ s/CONFIG_/OPTION_/g;
1294+ print;
1295+ } elsif (/^\s*#\s+CONFIG_(\w+) is not set/) {
1296+ # this is a comment line for an unset boolean option, change CONFIG_
1297+ # to OPTION_, remove this option from option list, and convert to
1298+ # explicit OPTION_FOO=n
1299+ $opt = $1;
1300+ yank($opt);
1301+ s/CONFIG_/OPTION_/g;
1302+ print "OPTION_$opt=n\n";
1303+ } else {
1304+ print;
1305+ }
1306+}
1307+
1308+# any boolean options left in @options, are options that were not mentioned in
1309+# the config file, and implicitly that means the option must be set =n,
1310+# so do that here.
1311+foreach $opt (@option) {
1312+ if ($opt =~ /=\s*[yn]/) {
1313+ $opt =~ s/=\s*[yn]/=n/;
1314+ print "OPTION_$opt\n";
1315+ }
1316+}
1317Index: git/options-config/config-preproc.pl
1318===================================================================
1319--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1320+++ git/options-config/config-preproc.pl 2014-08-27 07:24:41.652070587 +0000
1321@@ -0,0 +1,8 @@
1322+#!/usr/bin/perl
1323+
1324+if (@ARGV) {
1325+ while (<>) {
1326+ s/OPTION_/CONFIG_/g;
1327+ print;
1328+ }
1329+}
1330Index: git/scripts/option-groups.awk
1331===================================================================
1332--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1333+++ git/scripts/option-groups.awk 2014-08-27 07:26:51.652070587 +0000
1334@@ -0,0 +1,63 @@
1335+# option-groups.awk --- generate option group header file
1336+# Given input files containing makefile-style assignments to variables,
1337+# print out a header file that #defines an appropriate preprocessor
1338+# symbol for each variable left set to 'y'.
1339+
1340+BEGIN { FS="=" }
1341+
1342+# Trim spaces.
1343+{ gsub (/[[:blank:]]/, "") }
1344+
1345+# Skip comments.
1346+/^#/ { next }
1347+
1348+# Process assignments.
1349+NF == 2 {
1350+ vars[$1] = $2
1351+}
1352+
1353+# Print final values.
1354+END {
1355+ print "/* This file is automatically generated by scripts/option-groups.awk"
1356+ print " in the EGLIBC source tree."
1357+ print ""
1358+ print " It defines macros that indicate which EGLIBC option groups were"
1359+ print " configured in 'option-groups.config' when this C library was"
1360+ print " built. For each option group named OPTION_foo, it #defines"
1361+ print " __OPTION_foo to be 1 if the group is enabled, or leaves that"
1362+ print " symbol undefined if the group is disabled. */"
1363+ print ""
1364+ print "#ifndef __GNU_OPTION_GROUPS_H"
1365+ print "#define __GNU_OPTION_GROUPS_H"
1366+ print ""
1367+
1368+ # Produce a sorted list of variable names.
1369+ i=0
1370+ for (var in vars)
1371+ names[i++] = var
1372+ n = asort (names)
1373+
1374+ for (i = 1; i <= n; i++)
1375+ {
1376+ var = names[i]
1377+ if (var ~ /^OPTION_/)
1378+ {
1379+ if (vars[var] == "y")
1380+ print "#define __" var " 1"
1381+ else if (vars[var] == "n")
1382+ print "/* #undef __" var " */"
1383+ else if (vars[var] ~ /^[0-9]+/ ||
1384+ vars[var] ~ /^0x[0-9aAbBcCdDeEfF]+/ ||
1385+ vars[var] ~ /^\"/)
1386+ print "#define __" var " " vars[var]
1387+ else
1388+ print "/* #undef __" var " */"
1389+ # Ignore variables that don't have boolean, int, hex, or
1390+ # string values. Ideally, this would be driven by the types
1391+ # given in option-groups.def.
1392+ }
1393+ }
1394+
1395+ print ""
1396+ print "#endif /* __GNU_OPTION_GROUPS_H */"
1397+}
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/ppc-sqrt_finite.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/ppc-sqrt_finite.patch
new file mode 100644
index 0000000..6ea666b
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/ppc-sqrt_finite.patch
@@ -0,0 +1,184 @@
1on ppc fixes the errors like below
2| ./.libs/libpulsecore-1.1.so: undefined reference to `__sqrt_finite'
3| collect2: ld returned 1 exit status
4
5Upstream-Status: Pending
6
7ChangeLog
8
92012-01-06 Khem Raj <raj.khem@gmail.com>
10
11 * sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c: Add __*_finite alias.
12 Remove cruft.
13 * sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c: Ditto.
14 * sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c: Ditto.
15 * sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c: Ditto.
16
17Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
18===================================================================
19--- libc.orig/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
20+++ libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
21@@ -39,14 +39,8 @@ static const float half = 0.5;
22 We find the actual square root and half of its reciprocal
23 simultaneously. */
24
25-#ifdef __STDC__
26 double
27 __ieee754_sqrt (double b)
28-#else
29-double
30-__ieee754_sqrt (b)
31- double b;
32-#endif
33 {
34 if (__builtin_expect (b > 0, 1))
35 {
36@@ -132,3 +126,4 @@ __ieee754_sqrt (b)
37 }
38 return f_wash (b);
39 }
40+strong_alias (__ieee754_sqrt, __sqrt_finite)
41Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
42===================================================================
43--- libc.orig/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
44+++ libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
45@@ -37,14 +37,8 @@ static const float threehalf = 1.5;
46 We find the reciprocal square root and use that to compute the actual
47 square root. */
48
49-#ifdef __STDC__
50 float
51 __ieee754_sqrtf (float b)
52-#else
53-float
54-__ieee754_sqrtf (b)
55- float b;
56-#endif
57 {
58 if (__builtin_expect (b > 0, 1))
59 {
60@@ -99,3 +93,4 @@ __ieee754_sqrtf (b)
61 }
62 return f_washf (b);
63 }
64+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
65Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
66===================================================================
67--- libc.orig/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
68+++ libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
69@@ -39,14 +39,8 @@ static const float half = 0.5;
70 We find the actual square root and half of its reciprocal
71 simultaneously. */
72
73-#ifdef __STDC__
74 double
75 __ieee754_sqrt (double b)
76-#else
77-double
78-__ieee754_sqrt (b)
79- double b;
80-#endif
81 {
82 if (__builtin_expect (b > 0, 1))
83 {
84@@ -132,3 +126,4 @@ __ieee754_sqrt (b)
85 }
86 return f_wash (b);
87 }
88+strong_alias (__ieee754_sqrt, __sqrt_finite)
89Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
90===================================================================
91--- libc.orig/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
92+++ libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
93@@ -37,14 +37,8 @@ static const float threehalf = 1.5;
94 We find the reciprocal square root and use that to compute the actual
95 square root. */
96
97-#ifdef __STDC__
98 float
99 __ieee754_sqrtf (float b)
100-#else
101-float
102-__ieee754_sqrtf (b)
103- float b;
104-#endif
105 {
106 if (__builtin_expect (b > 0, 1))
107 {
108@@ -99,3 +93,4 @@ __ieee754_sqrtf (b)
109 }
110 return f_washf (b);
111 }
112+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
113Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
114===================================================================
115--- libc.orig/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
116+++ libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
117@@ -132,3 +132,4 @@ __ieee754_sqrt (b)
118 }
119 return f_wash (b);
120 }
121+strong_alias (__ieee754_sqrt, __sqrt_finite)
122Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
123===================================================================
124--- libc.orig/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
125+++ libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
126@@ -99,3 +99,4 @@ __ieee754_sqrtf (b)
127 }
128 return f_washf (b);
129 }
130+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
131Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
132===================================================================
133--- libc.orig/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
134+++ libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
135@@ -132,3 +132,4 @@ __ieee754_sqrt (b)
136 }
137 return f_wash (b);
138 }
139+strong_alias (__ieee754_sqrt, __sqrt_finite)
140Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
141===================================================================
142--- libc.orig/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
143+++ libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
144@@ -99,3 +99,4 @@ __ieee754_sqrtf (b)
145 }
146 return f_washf (b);
147 }
148+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
149Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
150===================================================================
151--- libc.orig/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
152+++ libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
153@@ -132,3 +132,4 @@ __ieee754_sqrt (b)
154 }
155 return f_wash (b);
156 }
157+strong_alias (__ieee754_sqrt, __sqrt_finite)
158Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
159===================================================================
160--- libc.orig/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
161+++ libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
162@@ -99,3 +99,4 @@ __ieee754_sqrtf (b)
163 }
164 return f_washf (b);
165 }
166+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
167Index: libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
168===================================================================
169--- libc.orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
170+++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
171@@ -132,3 +132,4 @@ __ieee754_sqrt (b)
172 }
173 return f_wash (b);
174 }
175+strong_alias (__ieee754_sqrt, __sqrt_finite)
176Index: libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
177===================================================================
178--- libc.orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
179+++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
180@@ -99,3 +99,4 @@ __ieee754_sqrtf (b)
181 }
182 return f_washf (b);
183 }
184+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/ppc_slow_ieee754_sqrt.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/ppc_slow_ieee754_sqrt.patch
new file mode 100644
index 0000000..5b819bc
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/ppc_slow_ieee754_sqrt.patch
@@ -0,0 +1,365 @@
1 __ieee754_sqrt{,f} are now inline functions and call out __slow versions
2
3
4Signed-off-by: Khem Raj <raj.khem@gmail.com>
5Upstream-Status: Pending
6Index: git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
7===================================================================
8--- git.orig/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c 2014-08-29 10:35:02.616070587 -0700
9+++ git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c 2014-08-29 10:35:02.604070587 -0700
10@@ -40,7 +40,7 @@
11 simultaneously. */
12
13 double
14-__ieee754_sqrt (double b)
15+__slow_ieee754_sqrt (double b)
16 {
17 if (__builtin_expect (b > 0, 1))
18 {
19@@ -77,7 +77,7 @@
20
21 /* Handle small numbers by scaling. */
22 if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
23- return __ieee754_sqrt (b * two108) * twom54;
24+ return __slow_ieee754_sqrt (b * two108) * twom54;
25
26 #define FMADD(a_, c_, b_) \
27 ({ double __r; \
28@@ -126,4 +126,12 @@
29 }
30 return f_wash (b);
31 }
32+
33+#undef __ieee754_sqrt
34+double
35+__ieee754_sqrt (double x)
36+{
37+ return __slow_ieee754_sqrt (x);
38+}
39+
40 strong_alias (__ieee754_sqrt, __sqrt_finite)
41Index: git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
42===================================================================
43--- git.orig/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c 2014-08-29 10:35:02.616070587 -0700
44+++ git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c 2014-08-29 10:35:02.604070587 -0700
45@@ -38,7 +38,7 @@
46 square root. */
47
48 float
49-__ieee754_sqrtf (float b)
50+__slow_ieee754_sqrtf (float b)
51 {
52 if (__builtin_expect (b > 0, 1))
53 {
54@@ -93,4 +93,10 @@
55 }
56 return f_washf (b);
57 }
58+#undef __ieee754_sqrtf
59+float
60+__ieee754_sqrtf (float x)
61+{
62+ return __slow_ieee754_sqrtf (x);
63+}
64 strong_alias (__ieee754_sqrtf, __sqrtf_finite)
65Index: git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
66===================================================================
67--- git.orig/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c 2014-08-29 10:35:02.616070587 -0700
68+++ git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c 2014-08-29 10:35:02.604070587 -0700
69@@ -40,7 +40,7 @@
70 simultaneously. */
71
72 double
73-__ieee754_sqrt (double b)
74+__slow_ieee754_sqrt (double b)
75 {
76 if (__builtin_expect (b > 0, 1))
77 {
78@@ -77,7 +77,7 @@
79
80 /* Handle small numbers by scaling. */
81 if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
82- return __ieee754_sqrt (b * two108) * twom54;
83+ return __slow_ieee754_sqrt (b * two108) * twom54;
84
85 #define FMADD(a_, c_, b_) \
86 ({ double __r; \
87@@ -126,4 +126,12 @@
88 }
89 return f_wash (b);
90 }
91+
92+#undef __ieee754_sqrt
93+double
94+__ieee754_sqrt (double x)
95+{
96+ return __slow_ieee754_sqrt (x);
97+}
98+
99 strong_alias (__ieee754_sqrt, __sqrt_finite)
100Index: git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
101===================================================================
102--- git.orig/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c 2014-08-29 10:35:02.616070587 -0700
103+++ git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c 2014-08-29 10:35:02.604070587 -0700
104@@ -38,7 +38,7 @@
105 square root. */
106
107 float
108-__ieee754_sqrtf (float b)
109+__slow_ieee754_sqrtf (float b)
110 {
111 if (__builtin_expect (b > 0, 1))
112 {
113@@ -93,4 +93,11 @@
114 }
115 return f_washf (b);
116 }
117+#undef __ieee754_sqrtf
118+float
119+__ieee754_sqrtf (float x)
120+{
121+ return __slow_ieee754_sqrtf (x);
122+}
123+
124 strong_alias (__ieee754_sqrtf, __sqrtf_finite)
125Index: git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
126===================================================================
127--- git.orig/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c 2014-08-29 10:35:02.616070587 -0700
128+++ git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c 2014-08-29 10:35:02.604070587 -0700
129@@ -41,10 +41,10 @@
130
131 #ifdef __STDC__
132 double
133-__ieee754_sqrt (double b)
134+__slow_ieee754_sqrt (double b)
135 #else
136 double
137-__ieee754_sqrt (b)
138+__slow_ieee754_sqrt (b)
139 double b;
140 #endif
141 {
142@@ -83,7 +83,7 @@
143
144 /* Handle small numbers by scaling. */
145 if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
146- return __ieee754_sqrt (b * two108) * twom54;
147+ return __slow_ieee754_sqrt (b * two108) * twom54;
148
149 #define FMADD(a_, c_, b_) \
150 ({ double __r; \
151@@ -132,4 +132,12 @@
152 }
153 return f_wash (b);
154 }
155+
156+#undef __ieee754_sqrt
157+double
158+__ieee754_sqrt (double x)
159+{
160+ return __slow_ieee754_sqrt (x);
161+}
162+
163 strong_alias (__ieee754_sqrt, __sqrt_finite)
164Index: git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
165===================================================================
166--- git.orig/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c 2014-08-29 10:35:02.616070587 -0700
167+++ git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c 2014-08-29 10:35:02.604070587 -0700
168@@ -39,10 +39,10 @@
169
170 #ifdef __STDC__
171 float
172-__ieee754_sqrtf (float b)
173+__slow_ieee754_sqrtf (float b)
174 #else
175 float
176-__ieee754_sqrtf (b)
177+__slow_ieee754_sqrtf (b)
178 float b;
179 #endif
180 {
181@@ -99,4 +99,12 @@
182 }
183 return f_washf (b);
184 }
185+
186+#undef __ieee754_sqrtf
187+float
188+__ieee754_sqrtf (float x)
189+{
190+ return __slow_ieee754_sqrtf (x);
191+}
192+
193 strong_alias (__ieee754_sqrtf, __sqrtf_finite)
194Index: git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
195===================================================================
196--- git.orig/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c 2014-08-29 10:35:02.616070587 -0700
197+++ git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c 2014-08-29 10:35:02.608070587 -0700
198@@ -41,10 +41,10 @@
199
200 #ifdef __STDC__
201 double
202-__ieee754_sqrt (double b)
203+__slow_ieee754_sqrt (double b)
204 #else
205 double
206-__ieee754_sqrt (b)
207+__slow_ieee754_sqrt (b)
208 double b;
209 #endif
210 {
211@@ -83,7 +83,7 @@
212
213 /* Handle small numbers by scaling. */
214 if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
215- return __ieee754_sqrt (b * two108) * twom54;
216+ return __slow_ieee754_sqrt (b * two108) * twom54;
217
218 #define FMADD(a_, c_, b_) \
219 ({ double __r; \
220@@ -132,4 +132,12 @@
221 }
222 return f_wash (b);
223 }
224+
225+#undef __ieee754_sqrt
226+double
227+__ieee754_sqrt (double x)
228+{
229+ return __slow_ieee754_sqrt (x);
230+}
231+
232 strong_alias (__ieee754_sqrt, __sqrt_finite)
233Index: git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
234===================================================================
235--- git.orig/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c 2014-08-29 10:35:02.616070587 -0700
236+++ git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c 2014-08-29 10:35:02.608070587 -0700
237@@ -39,10 +39,10 @@
238
239 #ifdef __STDC__
240 float
241-__ieee754_sqrtf (float b)
242+__slow_ieee754_sqrtf (float b)
243 #else
244 float
245-__ieee754_sqrtf (b)
246+__slow_ieee754_sqrtf (b)
247 float b;
248 #endif
249 {
250@@ -99,4 +99,12 @@
251 }
252 return f_washf (b);
253 }
254+
255+#undef __ieee754_sqrtf
256+float
257+__ieee754_sqrtf (float x)
258+{
259+ return __slow_ieee754_sqrtf (x);
260+}
261+
262 strong_alias (__ieee754_sqrtf, __sqrtf_finite)
263Index: git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
264===================================================================
265--- git.orig/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c 2014-08-29 10:35:02.616070587 -0700
266+++ git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c 2014-08-29 10:35:02.608070587 -0700
267@@ -41,10 +41,10 @@
268
269 #ifdef __STDC__
270 double
271-__ieee754_sqrt (double b)
272+__slow_ieee754_sqrt (double b)
273 #else
274 double
275-__ieee754_sqrt (b)
276+__slow_ieee754_sqrt (b)
277 double b;
278 #endif
279 {
280@@ -83,7 +83,7 @@
281
282 /* Handle small numbers by scaling. */
283 if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
284- return __ieee754_sqrt (b * two108) * twom54;
285+ return __slow_ieee754_sqrt (b * two108) * twom54;
286
287 #define FMADD(a_, c_, b_) \
288 ({ double __r; \
289@@ -132,4 +132,12 @@
290 }
291 return f_wash (b);
292 }
293+
294+#undef __ieee754_sqrt
295+double
296+__ieee754_sqrt (double x)
297+{
298+ return __slow_ieee754_sqrt (x);
299+}
300+
301 strong_alias (__ieee754_sqrt, __sqrt_finite)
302Index: git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
303===================================================================
304--- git.orig/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c 2014-08-29 10:35:02.616070587 -0700
305+++ git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c 2014-08-29 10:35:02.608070587 -0700
306@@ -39,10 +39,10 @@
307
308 #ifdef __STDC__
309 float
310-__ieee754_sqrtf (float b)
311+__slow_ieee754_sqrtf (float b)
312 #else
313 float
314-__ieee754_sqrtf (b)
315+__slow_ieee754_sqrtf (b)
316 float b;
317 #endif
318 {
319@@ -99,4 +99,12 @@
320 }
321 return f_washf (b);
322 }
323+
324+#undef __ieee754_sqrtf
325+float
326+__ieee754_sqrtf (float x)
327+{
328+ return __slow_ieee754_sqrtf (x);
329+}
330+
331 strong_alias (__ieee754_sqrtf, __sqrtf_finite)
332Index: git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
333===================================================================
334--- git.orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c 2014-08-29 10:35:02.616070587 -0700
335+++ git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c 2014-08-29 10:35:02.608070587 -0700
336@@ -132,4 +132,12 @@
337 }
338 return f_wash (b);
339 }
340+
341+#undef __ieee754_sqrt
342+double
343+__ieee754_sqrt (double x)
344+{
345+ return __slow_ieee754_sqrt (x);
346+}
347+
348 strong_alias (__ieee754_sqrt, __sqrt_finite)
349Index: git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
350===================================================================
351--- git.orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c 2014-08-29 10:35:02.616070587 -0700
352+++ git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c 2014-08-29 10:35:02.608070587 -0700
353@@ -99,4 +99,12 @@
354 }
355 return f_washf (b);
356 }
357+
358+#undef __ieee754_sqrtf
359+float
360+__ieee754_sqrtf (float x)
361+{
362+ return __slow_ieee754_sqrtf (x);
363+}
364+
365 strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/ppce6500-32b_slow_ieee754_sqrt.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/ppce6500-32b_slow_ieee754_sqrt.patch
new file mode 100644
index 0000000..4c6c107
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/ppce6500-32b_slow_ieee754_sqrt.patch
@@ -0,0 +1,47 @@
1 __ieee754_sqrt{,f} are now inline functions and call out __slow versions
2
3
4Signed-off-by: chunrong guo <B40290@freescale.com>
5Upstream-Status: Pending
6
7diff -rNu libc-orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
8--- libc-orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c 2014-04-08 04:39:58.487229887 -0500
9+++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c 2014-04-08 04:40:52.643069198 -0500
10@@ -41,10 +41,10 @@
11
12 #ifdef __STDC__
13 double
14-__ieee754_sqrt (double b)
15+__slow_ieee754_sqrt (double b)
16 #else
17 double
18-__ieee754_sqrt (b)
19+__slow_ieee754_sqrt (b)
20 double b;
21 #endif
22 {
23@@ -83,7 +83,7 @@
24
25 /* Handle small numbers by scaling. */
26 if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
27- return __ieee754_sqrt (b * two108) * twom54;
28+ return __slow_ieee754_sqrt (b * two108) * twom54;
29
30 #define FMADD(a_, c_, b_) \
31 ({ double __r; \
32diff -rNu libc-orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
33--- libc-orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c 2014-04-08 04:39:58.487229887 -0500
34+++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c 2014-04-08 04:41:26.017067682 -0500
35@@ -39,10 +39,10 @@
36
37 #ifdef __STDC__
38 float
39-__ieee754_sqrtf (float b)
40+__slow_ieee754_sqrtf (float b)
41 #else
42 float
43-__ieee754_sqrtf (b)
44+__slow_ieee754_sqrtf (b)
45 float b;
46 #endif
47 {
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/relocatable_sdk.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/relocatable_sdk.patch
new file mode 100644
index 0000000..ca5f17b
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/relocatable_sdk.patch
@@ -0,0 +1,108 @@
1Upstream-Status: Inappropriate [SDK specific]
2
3This patch puts the dynamic loader path in the binaries, SYSTEM_DIRS strings
4and lengths as well as ld.so.cache path in the dynamic loader to specific
5sections in memory. The sections that contain paths have been allocated a 4096
6byte section, which is the maximum path length in linux. This will allow the
7relocating script to parse the ELF binary, detect the section and easily replace
8the strings in a certain path.
9
10Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
11
12Index: libc/elf/interp.c
13===================================================================
14--- libc.orig/elf/interp.c
15+++ libc/elf/interp.c
16@@ -16,5 +16,5 @@
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
19
20-const char __invoke_dynamic_linker__[] __attribute__ ((section (".interp")))
21+const char __invoke_dynamic_linker__[4096] __attribute__ ((section (".interp")))
22 = RUNTIME_LINKER;
23Index: libc/elf/dl-load.c
24===================================================================
25--- libc.orig/elf/dl-load.c
26+++ libc/elf/dl-load.c
27@@ -144,8 +144,8 @@ static size_t max_capstrlen attribute_re
28 /* Get the generated information about the trusted directories. */
29 #include "trusted-dirs.h"
30
31-static const char system_dirs[] = SYSTEM_DIRS;
32-static const size_t system_dirs_len[] =
33+static const char system_dirs[4096] __attribute__ ((section (".sysdirs"))) = SYSTEM_DIRS;
34+volatile static const size_t system_dirs_len[] __attribute__ ((section (".sysdirslen"))) =
35 {
36 SYSTEM_DIRS_LEN
37 };
38Index: libc/elf/dl-cache.c
39===================================================================
40--- libc.orig/elf/dl-cache.c
41+++ libc/elf/dl-cache.c
42@@ -133,6 +133,10 @@ do \
43 while (0)
44
45
46+const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache"))) =
47+ SYSCONFDIR "/ld.so.cache";
48+
49+
50 int
51 internal_function
52 _dl_cache_libcmp (const char *p1, const char *p2)
53Index: libc/elf/ldconfig.c
54===================================================================
55--- libc.orig/elf/ldconfig.c
56+++ libc/elf/ldconfig.c
57@@ -166,6 +166,9 @@ static struct argp argp =
58 options, parse_opt, NULL, doc, NULL, more_help, NULL
59 };
60
61+
62+extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache")));
63+
64 /* Check if string corresponds to an important hardware capability or
65 a platform. */
66 static int
67Index: libc/sysdeps/generic/dl-cache.h
68===================================================================
69--- libc.orig/sysdeps/generic/dl-cache.h
70+++ libc/sysdeps/generic/dl-cache.h
71@@ -27,10 +27,6 @@
72 ((flags) == 1 || (flags) == _DL_CACHE_DEFAULT_ID)
73 #endif
74
75-#ifndef LD_SO_CACHE
76-# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache"
77-#endif
78-
79 #ifndef add_system_dir
80 # define add_system_dir(dir) add_dir (dir)
81 #endif
82Index: libc/elf/rtld.c
83===================================================================
84--- libc.orig/elf/rtld.c
85+++ libc/elf/rtld.c
86@@ -99,6 +99,7 @@ uintptr_t __pointer_chk_guard_local
87 strong_alias (__pointer_chk_guard_local, __pointer_chk_guard)
88 #endif
89
90+extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache")));
91
92 /* List of auditing DSOs. */
93 static struct audit_list
94@@ -1031,12 +1032,12 @@ of this helper program; chances are you
95 --list list all dependencies and how they are resolved\n\
96 --verify verify that given object really is a dynamically linked\n\
97 object we can handle\n\
98- --inhibit-cache Do not use " LD_SO_CACHE "\n\
99+ --inhibit-cache Do not use %s\n\
100 --library-path PATH use given PATH instead of content of the environment\n\
101 variable LD_LIBRARY_PATH\n\
102 --inhibit-rpath LIST ignore RUNPATH and RPATH information in object names\n\
103 in LIST\n\
104- --audit LIST use objects named in LIST as auditors\n");
105+ --audit LIST use objects named in LIST as auditors\n", LD_SO_CACHE);
106
107 ++_dl_skip_args;
108 --_dl_argc;
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/relocatable_sdk_fix_openpath.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/relocatable_sdk_fix_openpath.patch
new file mode 100644
index 0000000..f164f8f
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/relocatable_sdk_fix_openpath.patch
@@ -0,0 +1,41 @@
1Upstream-Status: Inappropriate [SDK specific]
2
3eglibc-nativesdk: Fix buffer overrun with a relocated SDK
4
5When ld-linux-*.so.2 is relocated to a path that is longer than the
6original fixed location, the dynamic loader will crash in open_path
7because it implicitly assumes that max_dirnamelen is a fixed size that
8never changes.
9
10The allocated buffer will not be large enough to contain the directory
11path string which is larger than the fixed location provided at build
12time.
13
14Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
15
16---
17 elf/dl-load.c | 12 ++++++++++++
18 1 file changed, 12 insertions(+)
19
20--- a/elf/dl-load.c
21+++ b/elf/dl-load.c
22@@ -1919,7 +1919,19 @@ open_path (const char *name, size_t name
23 given on the command line when rtld is run directly. */
24 return -1;
25
26+ do
27+ {
28+ struct r_search_path_elem *this_dir = *dirs;
29+ if (this_dir->dirnamelen > max_dirnamelen)
30+ {
31+ max_dirnamelen = this_dir->dirnamelen;
32+ }
33+ }
34+ while (*++dirs != NULL);
35+
36 buf = alloca (max_dirnamelen + max_capstrlen + namelen);
37+
38+ dirs = sps->dirs;
39 do
40 {
41 struct r_search_path_elem *this_dir = *dirs;
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/timezone-re-written-tzselect-as-posix-sh.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/timezone-re-written-tzselect-as-posix-sh.patch
new file mode 100644
index 0000000..55547de
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/timezone-re-written-tzselect-as-posix-sh.patch
@@ -0,0 +1,38 @@
1timezone: re-written tzselect as posix sh
2
3To avoid the bash dependency.
4
5Upstream-Status: Pending
6
7Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
8---
9 timezone/Makefile | 2 +-
10 timezone/tzselect.ksh | 2 +-
11 2 files changed, 2 insertions(+), 2 deletions(-)
12
13Index: git/timezone/Makefile
14===================================================================
15--- git.orig/timezone/Makefile 2014-08-27 05:35:58.008070587 +0000
16+++ git/timezone/Makefile 2014-08-27 05:36:37.908070587 +0000
17@@ -114,7 +114,7 @@
18
19
20 $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
21- sed -e 's|/bin/bash|$(BASH)|' \
22+ sed -e 's|/bin/bash|/bin/sh|' \
23 -e 's|TZDIR=[^}]*|TZDIR=$(zonedir)|' \
24 -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \
25 -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \
26Index: git/timezone/tzselect.ksh
27===================================================================
28--- git.orig/timezone/tzselect.ksh 2014-08-27 05:35:58.008070587 +0000
29+++ git/timezone/tzselect.ksh 2014-08-27 05:35:58.000070587 +0000
30@@ -35,7 +35,7 @@
31
32 # Specify default values for environment variables if they are unset.
33 : ${AWK=awk}
34-: ${TZDIR=`pwd`}
35+: ${TZDIR=$(pwd)}
36
37 # Check for awk Posix compliance.
38 ($AWK -v x=y 'BEGIN { exit 123 }') </dev/null >/dev/null 2>&1
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-locale_linaro-2.20.bb b/meta-linaro-toolchain/recipes-core/glibc/glibc-locale_linaro-2.20.bb
new file mode 100644
index 0000000..8d22aff
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-locale_linaro-2.20.bb
@@ -0,0 +1 @@
require recipes-core/glibc/glibc-locale.inc
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-mtrace_linaro-2.20.bb b/meta-linaro-toolchain/recipes-core/glibc/glibc-mtrace_linaro-2.20.bb
new file mode 100644
index 0000000..4849101
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-mtrace_linaro-2.20.bb
@@ -0,0 +1 @@
require recipes-core/glibc/glibc-mtrace.inc
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-scripts_linaro-2.20.bb b/meta-linaro-toolchain/recipes-core/glibc/glibc-scripts_linaro-2.20.bb
new file mode 100644
index 0000000..674cd80
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-scripts_linaro-2.20.bb
@@ -0,0 +1 @@
require recipes-core/glibc/glibc-scripts.inc
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc_linaro-2.20.bb b/meta-linaro-toolchain/recipes-core/glibc/glibc_linaro-2.20.bb
new file mode 100644
index 0000000..b386236
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc_linaro-2.20.bb
@@ -0,0 +1,173 @@
1require recipes-core/glibc/glibc.inc
2
3DEPENDS += "gperf-native kconfig-frontends-native"
4
5MMYY = "14.11"
6RELEASE = "20${MMYY}"
7PR = "r${RELEASE}"
8
9SRC_URI = "http://releases.linaro.org/${MMYY}/components/toolchain/glibc-linaro/glibc-${PV}-${RELEASE}.tar.xz \
10 file://etc/ld.so.conf \
11 file://generate-supported.mk \
12 file://IO-acquire-lock-fix.patch \
13 file://mips-rld-map-check.patch \
14 file://etc/ld.so.conf \
15 file://generate-supported.mk \
16 file://glibc.fix_sqrt2.patch \
17 file://multilib_readlib.patch \
18 file://ppc-sqrt_finite.patch \
19 file://ppc_slow_ieee754_sqrt.patch \
20 file://add_resource_h_to_wait_h.patch \
21 file://fsl-ppc-no-fsqrt.patch \
22 file://0001-R_ARM_TLS_DTPOFF32.patch \
23 file://0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch \
24 file://fix-tibetian-locales.patch \
25 file://ppce6500-32b_slow_ieee754_sqrt.patch \
26 file://grok_gold.patch \
27 file://fix_am_rootsbindir.patch \
28 ${EGLIBCPATCHES} \
29 "
30EGLIBCPATCHES = "\
31 file://timezone-re-written-tzselect-as-posix-sh.patch \
32 file://eglibc.patch \
33 file://option-groups.patch \
34 file://GLRO_dl_debug_mask.patch \
35 file://eglibc-header-bootstrap.patch \
36 file://eglibc-resolv-dynamic.patch \
37 file://eglibc-ppc8xx-cache-line-workaround.patch \
38 file://eglibc-sh4-fpscr_values.patch \
39 file://eglibc-use-option-groups.patch \
40 "
41
42SRC_URI[md5sum] = "ca2035b47d86856ffdd201ce2a12e60e"
43SRC_URI[sha256sum] = "2db756f9f9281f78443cd04fc544fc2d8bce38037d5f75c8284bd8b0ccf9c9ed"
44
45LIC_FILES_CHKSUM = "file://LICENSES;md5=e9a558e243b36d3209f380deb394b213 \
46 file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
47 file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
48 file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c"
49
50SRC_URI_append_class-nativesdk = " file://ld-search-order.patch \
51 file://relocatable_sdk.patch \
52 file://relocatable_sdk_fix_openpath.patch \
53 "
54S = "${WORKDIR}/glibc-${PV}-${RELEASE}"
55B = "${WORKDIR}/build-${TARGET_SYS}"
56
57PACKAGES_DYNAMIC = ""
58
59# the -isystem in bitbake.conf screws up glibc do_stage
60BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}"
61TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}"
62
63GLIBC_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"
64
65FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/glibc-${PV}', '${FILE_DIRNAME}/glibc', '${FILE_DIRNAME}/files', '${FILE_DIRNAME}' ], d)}"
66
67#
68# For now, we will skip building of a gcc package if it is a uclibc one
69# and our build is not a uclibc one, and we skip a glibc one if our build
70# is a uclibc build.
71#
72# See the note in gcc/gcc_3.4.0.oe
73#
74
75python __anonymous () {
76 import re
77 uc_os = (re.match('.*uclibc$', d.getVar('TARGET_OS', True)) != None)
78 if uc_os:
79 raise bb.parse.SkipPackage("incompatible with target %s" %
80 d.getVar('TARGET_OS', True))
81}
82
83export libc_cv_slibdir = "${base_libdir}"
84
85EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \
86 --without-cvs --disable-profile \
87 --disable-debug --without-gd \
88 --enable-clocale=gnu \
89 --enable-add-ons \
90 --with-headers=${STAGING_INCDIR} \
91 --without-selinux \
92 --enable-obsolete-rpc \
93 --with-kconfig=${STAGING_BINDIR_NATIVE} \
94 ${GLIBC_EXTRA_OECONF}"
95
96EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}"
97
98do_patch_append() {
99 bb.build.exec_func('do_fix_readlib_c', d)
100}
101
102# for mips glibc now builds syscall tables for all abi's
103# so we make sure that we choose right march option which is
104# compatible with o32,n32 and n64 abi's
105# e.g. -march=mips32 is not compatible with n32 and n64 therefore
106# we filter it out in such case -march=from-abi which will be
107# mips1 when using o32 and mips3 when using n32/n64
108
109TUNE_CCARGS_mips := "${@oe_filter_out('-march=mips32', '${TUNE_CCARGS}', d)}"
110TUNE_CCARGS_mipsel := "${@oe_filter_out('-march=mips32', '${TUNE_CCARGS}', d)}"
111
112do_fix_readlib_c () {
113 sed -i -e 's#OECORE_KNOWN_INTERPRETER_NAMES#${EGLIBC_KNOWN_INTERPRETER_NAMES}#' ${S}/elf/readlib.c
114}
115
116do_configure () {
117# override this function to avoid the autoconf/automake/aclocal/autoheader
118# calls for now
119# don't pass CPPFLAGS into configure, since it upsets the kernel-headers
120# version check and doesn't really help with anything
121 if [ -z "`which rpcgen`" ]; then
122 echo "rpcgen not found. Install glibc-devel."
123 exit 1
124 fi
125 (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
126 find ${S} -name "configure" | xargs touch
127 CPPFLAGS="" oe_runconf
128}
129
130rpcsvc = "bootparam_prot.x nlm_prot.x rstat.x \
131 yppasswd.x klm_prot.x rex.x sm_inter.x mount.x \
132 rusers.x spray.x nfs_prot.x rquota.x key_prot.x"
133
134do_compile () {
135 # -Wl,-rpath-link <staging>/lib in LDFLAGS can cause breakage if another glibc is in staging
136 unset LDFLAGS
137 base_do_compile
138 (
139 cd ${S}/sunrpc/rpcsvc
140 for r in ${rpcsvc}; do
141 h=`echo $r|sed -e's,\.x$,.h,'`
142 rpcgen -h $r -o $h || bbwarn "unable to generate header for $r"
143 done
144 )
145 echo "Adjust ldd script"
146 if [ -n "${RTLDLIST}" ]
147 then
148 prevrtld=`cat ${B}/elf/ldd | grep "^RTLDLIST=" | sed 's#^RTLDLIST="\?\([^"]*\)"\?$#\1#'`
149 if [ "${prevrtld}" != "${RTLDLIST}" ]
150 then
151 sed -i ${B}/elf/ldd -e "s#^RTLDLIST=.*\$#RTLDLIST=\"${prevrtld} ${RTLDLIST}\"#"
152 fi
153 fi
154
155}
156
157# In case of aarch64_be install symlink to ld-linux-aarch64_be.so.1
158# to enable transition of toolchain and executables that are not yet
159# aware about aarch64_be run-time linker name change.
160#
161# Currently there is no use case that requires both LE and BE glibc
162# installed into the same rootfs, so our transitional symlink should
163# be fine.
164#
165do_install_append_aarch64-be() {
166 if [ -e ${D}${base_libdir}/ld-linux-aarch64_be.so.1 ] ; then
167 ln -sf ld-linux-aarch64_be.so.1 ${D}${base_libdir}/ld-linux-aarch64.so.1
168 fi
169}
170
171require recipes-core/glibc/glibc-package.inc
172
173BBCLASSEXTEND = "nativesdk"
diff --git a/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/32and64bit.patch b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/32and64bit.patch
new file mode 100644
index 0000000..cdfeaea
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/32and64bit.patch
@@ -0,0 +1,331 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3We run the ldconfig in the cross fashion. make the code bitsize aware so that
4we can cross build ldconfig cache for various architectures.
5
6Richard Purdie <richard.purdie@linuxfoundation.org> 2009/05/19
7Nitin A Kamble <nitin.a.kamble@intel.com> 2009/03/29
8
9Index: ldconfig-native-2.12.1/readelflib.c
10===================================================================
11--- ldconfig-native-2.12.1.orig/readelflib.c
12+++ ldconfig-native-2.12.1/readelflib.c
13@@ -40,39 +40,212 @@ do \
14
15 /* Returns 0 if everything is ok, != 0 in case of error. */
16 int
17-process_elf_file (const char *file_name, const char *lib, int *flag,
18+process_elf_file32 (const char *file_name, const char *lib, int *flag,
19 unsigned int *osversion, char **soname, void *file_contents,
20 size_t file_length)
21 {
22 int i;
23 unsigned int j;
24- ElfW(Addr) loadaddr;
25+ Elf32_Addr loadaddr;
26 unsigned int dynamic_addr;
27 size_t dynamic_size;
28 char *program_interpreter;
29
30- ElfW(Ehdr) *elf_header;
31- ElfW(Phdr) *elf_pheader, *segment;
32- ElfW(Dyn) *dynamic_segment, *dyn_entry;
33+ Elf32_Ehdr *elf_header;
34+ Elf32_Phdr *elf_pheader, *segment;
35+ Elf32_Dyn *dynamic_segment, *dyn_entry;
36 char *dynamic_strings;
37
38- elf_header = (ElfW(Ehdr) *) file_contents;
39+ elf_header = (Elf32_Ehdr *) file_contents;
40 *osversion = 0;
41
42- if (elf_header->e_ident [EI_CLASS] != ElfW (CLASS))
43+ if (elf_header->e_type != ET_DYN)
44 {
45- if (opt_verbose)
46+ error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name,
47+ elf_header->e_type);
48+ return 1;
49+ }
50+
51+ /* Get information from elf program header. */
52+ elf_pheader = (Elf32_Phdr *) (elf_header->e_phoff + file_contents);
53+ check_ptr (elf_pheader);
54+
55+ /* The library is an elf library, now search for soname and
56+ libc5/libc6. */
57+ *flag = FLAG_ELF;
58+
59+ loadaddr = -1;
60+ dynamic_addr = 0;
61+ dynamic_size = 0;
62+ program_interpreter = NULL;
63+ for (i = 0, segment = elf_pheader;
64+ i < elf_header->e_phnum; i++, segment++)
65+ {
66+ check_ptr (segment);
67+
68+ switch (segment->p_type)
69 {
70- if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
71- error (0, 0, _("%s is a 32 bit ELF file.\n"), file_name);
72- else if (elf_header->e_ident [EI_CLASS] == ELFCLASS64)
73- error (0, 0, _("%s is a 64 bit ELF file.\n"), file_name);
74- else
75- error (0, 0, _("Unknown ELFCLASS in file %s.\n"), file_name);
76+ case PT_LOAD:
77+ if (loadaddr == (Elf32_Addr) -1)
78+ loadaddr = segment->p_vaddr - segment->p_offset;
79+ break;
80+
81+ case PT_DYNAMIC:
82+ if (dynamic_addr)
83+ error (0, 0, _("more than one dynamic segment\n"));
84+
85+ dynamic_addr = segment->p_offset;
86+ dynamic_size = segment->p_filesz;
87+ break;
88+
89+ case PT_INTERP:
90+ program_interpreter = (char *) (file_contents + segment->p_offset);
91+ check_ptr (program_interpreter);
92+
93+ /* Check if this is enough to classify the binary. */
94+ for (j = 0; j < sizeof (interpreters) / sizeof (interpreters [0]);
95+ ++j)
96+ if (strcmp (program_interpreter, interpreters[j].soname) == 0)
97+ {
98+ *flag = interpreters[j].flag;
99+ break;
100+ }
101+ break;
102+
103+ case PT_NOTE:
104+ if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4)
105+ {
106+ Elf32_Word *abi_note = (Elf32_Word *) (file_contents
107+ + segment->p_offset);
108+ Elf32_Addr size = segment->p_filesz;
109+
110+ while (abi_note [0] != 4 || abi_note [1] != 16
111+ || abi_note [2] != 1
112+ || memcmp (abi_note + 3, "GNU", 4) != 0)
113+ {
114+#define ROUND(len) (((len) + sizeof (Elf32_Word)) - 1) & -sizeof (Elf32_Word)))
115+ Elf32_Addr) note_size = 3 * sizeof (Elf32_Word))
116+ + ROUND (abi_note[0])
117+ + ROUND (abi_note[1]);
118+
119+ if (size - 32 < note_size || note_size == 0)
120+ {
121+ size = 0;
122+ break;
123+ }
124+ size -= note_size;
125+ abi_note = (void *) abi_note + note_size;
126+ }
127+
128+ if (size == 0)
129+ break;
130+
131+ *osversion = (abi_note [4] << 24) |
132+ ((abi_note [5] & 0xff) << 16) |
133+ ((abi_note [6] & 0xff) << 8) |
134+ (abi_note [7] & 0xff);
135+ }
136+ break;
137+
138+ default:
139+ break;
140+ }
141+
142+ }
143+ if (loadaddr == (Elf32_Addr) -1)
144+ {
145+ /* Very strange. */
146+ loadaddr = 0;
147+ }
148+
149+ /* Now we can read the dynamic sections. */
150+ if (dynamic_size == 0)
151+ return 1;
152+
153+ dynamic_segment = (Elf32_Dyn *) (file_contents + dynamic_addr);
154+ check_ptr (dynamic_segment);
155+
156+ /* Find the string table. */
157+ dynamic_strings = NULL;
158+ for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
159+ ++dyn_entry)
160+ {
161+ check_ptr (dyn_entry);
162+ if (dyn_entry->d_tag == DT_STRTAB)
163+ {
164+ dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr);
165+ check_ptr (dynamic_strings);
166+ break;
167 }
168- return 1;
169 }
170
171+ if (dynamic_strings == NULL)
172+ return 1;
173+
174+ /* Now read the DT_NEEDED and DT_SONAME entries. */
175+ for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
176+ ++dyn_entry)
177+ {
178+ if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME)
179+ {
180+ char *name = dynamic_strings + dyn_entry->d_un.d_val;
181+ check_ptr (name);
182+
183+ if (dyn_entry->d_tag == DT_NEEDED)
184+ {
185+
186+ if (*flag == FLAG_ELF)
187+ {
188+ /* Check if this is enough to classify the binary. */
189+ for (j = 0;
190+ j < sizeof (known_libs) / sizeof (known_libs [0]);
191+ ++j)
192+ if (strcmp (name, known_libs [j].soname) == 0)
193+ {
194+ *flag = known_libs [j].flag;
195+ break;
196+ }
197+ }
198+ }
199+
200+ else if (dyn_entry->d_tag == DT_SONAME)
201+ *soname = xstrdup (name);
202+
203+ /* Do we have everything we need? */
204+ if (*soname && *flag != FLAG_ELF)
205+ return 0;
206+ }
207+ }
208+
209+ /* We reach this point only if the file doesn't contain a DT_SONAME
210+ or if we can't classify the library. If it doesn't have a
211+ soname, return the name of the library. */
212+ if (*soname == NULL)
213+ *soname = xstrdup (lib);
214+
215+ return 0;
216+}
217+
218+int
219+process_elf_file64 (const char *file_name, const char *lib, int *flag,
220+ unsigned int *osversion, char **soname, void *file_contents,
221+ size_t file_length)
222+{
223+ int i;
224+ unsigned int j;
225+ Elf64_Addr loadaddr;
226+ unsigned int dynamic_addr;
227+ size_t dynamic_size;
228+ char *program_interpreter;
229+
230+ Elf64_Ehdr *elf_header;
231+ Elf64_Phdr *elf_pheader, *segment;
232+ Elf64_Dyn *dynamic_segment, *dyn_entry;
233+ char *dynamic_strings;
234+
235+ elf_header = (Elf64_Ehdr *) file_contents;
236+ *osversion = 0;
237+
238 if (elf_header->e_type != ET_DYN)
239 {
240 error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name,
241@@ -81,7 +254,7 @@ process_elf_file (const char *file_name,
242 }
243
244 /* Get information from elf program header. */
245- elf_pheader = (ElfW(Phdr) *) (elf_header->e_phoff + file_contents);
246+ elf_pheader = (Elf64_Phdr *) (elf_header->e_phoff + file_contents);
247 check_ptr (elf_pheader);
248
249 /* The library is an elf library, now search for soname and
250@@ -100,7 +273,7 @@ process_elf_file (const char *file_name,
251 switch (segment->p_type)
252 {
253 case PT_LOAD:
254- if (loadaddr == (ElfW(Addr)) -1)
255+ if (loadaddr == (Elf64_Addr) -1)
256 loadaddr = segment->p_vaddr - segment->p_offset;
257 break;
258
259@@ -129,16 +302,16 @@ process_elf_file (const char *file_name,
260 case PT_NOTE:
261 if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4)
262 {
263- ElfW(Word) *abi_note = (ElfW(Word) *) (file_contents
264+ Elf64_Word *abi_note = (Elf64_Word *) (file_contents
265 + segment->p_offset);
266- ElfW(Addr) size = segment->p_filesz;
267+ Elf64_Addr size = segment->p_filesz;
268
269 while (abi_note [0] != 4 || abi_note [1] != 16
270 || abi_note [2] != 1
271 || memcmp (abi_note + 3, "GNU", 4) != 0)
272 {
273-#define ROUND(len) (((len) + sizeof (ElfW(Word)) - 1) & -sizeof (ElfW(Word)))
274- ElfW(Addr) note_size = 3 * sizeof (ElfW(Word))
275+#define ROUND(len) (((len) + sizeof (Elf64_Word) - 1) & -sizeof (Elf64_Word))
276+ Elf64_Addr note_size = 3 * sizeof (Elf64_Word)
277 + ROUND (abi_note[0])
278 + ROUND (abi_note[1]);
279
280@@ -166,7 +339,7 @@ process_elf_file (const char *file_name,
281 }
282
283 }
284- if (loadaddr == (ElfW(Addr)) -1)
285+ if (loadaddr == (Elf64_Addr) -1)
286 {
287 /* Very strange. */
288 loadaddr = 0;
289@@ -176,7 +349,7 @@ process_elf_file (const char *file_name,
290 if (dynamic_size == 0)
291 return 1;
292
293- dynamic_segment = (ElfW(Dyn) *) (file_contents + dynamic_addr);
294+ dynamic_segment = (Elf64_Dyn *) (file_contents + dynamic_addr);
295 check_ptr (dynamic_segment);
296
297 /* Find the string table. */
298@@ -233,3 +406,33 @@ process_elf_file (const char *file_name,
299
300 return 0;
301 }
302+/* Returns 0 if everything is ok, != 0 in case of error. */
303+int
304+process_elf_file (const char *file_name, const char *lib, int *flag,
305+ unsigned int *osversion, char **soname, void *file_contents,
306+ size_t file_length)
307+{
308+ int i;
309+ unsigned int j;
310+ ElfW(Addr) loadaddr;
311+ unsigned int dynamic_addr;
312+ size_t dynamic_size;
313+ char *program_interpreter;
314+
315+ ElfW(Ehdr) *elf_header;
316+ ElfW(Phdr) *elf_pheader, *segment;
317+ ElfW(Dyn) *dynamic_segment, *dyn_entry;
318+ char *dynamic_strings;
319+
320+ elf_header = (ElfW(Ehdr) *) file_contents;
321+ *osversion = 0;
322+
323+ if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
324+ return process_elf_file32(file_name, lib,flag, osversion, soname, file_contents, file_length);
325+ else if (elf_header->e_ident [EI_CLASS] == ELFCLASS64)
326+ return process_elf_file64(file_name, lib,flag, osversion, soname, file_contents, file_length);
327+ error (0, 0, _("Unknown ELFCLASS in file %s.\n"), file_name);
328+ return 1;
329+}
330+
331+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/README b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/README
new file mode 100644
index 0000000..43fb983
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/README
@@ -0,0 +1,8 @@
1The files are pulled verbatim from glibc 2.5 and then patched to allow
2standalone compilation of ldconfig.
3
4Richard Purdie
5OpenedHand Ltd.
6
7Upgraded the ldconfig recipe to eglibc 2.12.1
8Nitin A Kamble <nitin.a.kamble@intel.com> 2011/03/29
diff --git a/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling.patch b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling.patch
new file mode 100644
index 0000000..7f8e4db
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling.patch
@@ -0,0 +1,454 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3Do data input/output handling according to endien-ness of the library file. That
4enables use of ldconfig in the cross fashion for any architecture.
5
62011/04/04
7Richard Purdie <richard.purdie@linuxfoundation.org>
8Nitin Kamble <nitin.a.kamble@intel.com>
9
10Index: ldconfig-native-2.12.1/readelflib.c
11===================================================================
12--- ldconfig-native-2.12.1.orig/readelflib.c
13+++ ldconfig-native-2.12.1/readelflib.c
14@@ -38,6 +38,28 @@ do \
15 } \
16 while (0);
17
18+int be;
19+static uint16_t read16(uint16_t x, int be)
20+{
21+ if (be)
22+ return be16toh(x);
23+ return le16toh(x);
24+}
25+
26+static uint32_t read32(uint32_t x, int be)
27+{
28+ if (be)
29+ return be32toh(x);
30+ return le32toh(x);
31+}
32+
33+static uint64_t read64(uint64_t x, int be)
34+{
35+ if (be)
36+ return be64toh(x);
37+ return le64toh(x);
38+}
39+
40 /* Returns 0 if everything is ok, != 0 in case of error. */
41 int
42 process_elf_file32 (const char *file_name, const char *lib, int *flag,
43@@ -59,15 +81,17 @@ process_elf_file32 (const char *file_nam
44 elf_header = (Elf32_Ehdr *) file_contents;
45 *osversion = 0;
46
47- if (elf_header->e_type != ET_DYN)
48+ be = (elf_header->e_ident[EI_DATA] == ELFDATA2MSB);
49+
50+ if (read16(elf_header->e_type, be) != ET_DYN)
51 {
52 error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name,
53- elf_header->e_type);
54+ read16(elf_header->e_type, be));
55 return 1;
56 }
57
58 /* Get information from elf program header. */
59- elf_pheader = (Elf32_Phdr *) (elf_header->e_phoff + file_contents);
60+ elf_pheader = (Elf32_Phdr *) (read32(elf_header->e_phoff, be) + file_contents);
61 check_ptr (elf_pheader);
62
63 /* The library is an elf library, now search for soname and
64@@ -79,27 +103,27 @@ process_elf_file32 (const char *file_nam
65 dynamic_size = 0;
66 program_interpreter = NULL;
67 for (i = 0, segment = elf_pheader;
68- i < elf_header->e_phnum; i++, segment++)
69+ i < read16(elf_header->e_phnum, be); i++, segment++)
70 {
71 check_ptr (segment);
72
73- switch (segment->p_type)
74+ switch (read32(segment->p_type, be))
75 {
76 case PT_LOAD:
77 if (loadaddr == (Elf32_Addr) -1)
78- loadaddr = segment->p_vaddr - segment->p_offset;
79+ loadaddr = read32(segment->p_vaddr, be) - read32(segment->p_offset, be);
80 break;
81
82 case PT_DYNAMIC:
83 if (dynamic_addr)
84 error (0, 0, _("more than one dynamic segment\n"));
85
86- dynamic_addr = segment->p_offset;
87- dynamic_size = segment->p_filesz;
88+ dynamic_addr = read32(segment->p_offset, be);
89+ dynamic_size = read32(segment->p_filesz, be);
90 break;
91
92 case PT_INTERP:
93- program_interpreter = (char *) (file_contents + segment->p_offset);
94+ program_interpreter = (char *) (file_contents + read32(segment->p_offset, be));
95 check_ptr (program_interpreter);
96
97 /* Check if this is enough to classify the binary. */
98@@ -113,20 +137,20 @@ process_elf_file32 (const char *file_nam
99 break;
100
101 case PT_NOTE:
102- if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4)
103+ if (!*osversion && read32(segment->p_filesz, be) >= 32 && segment->p_align >= 4)
104 {
105 Elf32_Word *abi_note = (Elf32_Word *) (file_contents
106- + segment->p_offset);
107- Elf32_Addr size = segment->p_filesz;
108+ + read32(segment->p_offset, be));
109+ Elf32_Addr size = read32(segment->p_filesz, be);
110
111- while (abi_note [0] != 4 || abi_note [1] != 16
112- || abi_note [2] != 1
113+ while (read32(abi_note [0], be) != 4 || read32(abi_note [1], be) != 16
114+ || read32(abi_note [2], be) != 1
115 || memcmp (abi_note + 3, "GNU", 4) != 0)
116 {
117-#define ROUND(len) (((len) + sizeof (Elf32_Word)) - 1) & -sizeof (Elf32_Word)))
118- Elf32_Addr) note_size = 3 * sizeof (Elf32_Word))
119- + ROUND (abi_note[0])
120- + ROUND (abi_note[1]);
121+#define ROUND(len) (((len) + sizeof (Elf32_Word) - 1) & -sizeof (Elf32_Word))
122+ Elf32_Addr note_size = 3 * sizeof (Elf32_Word)
123+ + ROUND (read32(abi_note[0], be))
124+ + ROUND (read32(abi_note[1], be));
125
126 if (size - 32 < note_size || note_size == 0)
127 {
128@@ -140,10 +164,10 @@ process_elf_file32 (const char *file_nam
129 if (size == 0)
130 break;
131
132- *osversion = (abi_note [4] << 24) |
133- ((abi_note [5] & 0xff) << 16) |
134- ((abi_note [6] & 0xff) << 8) |
135- (abi_note [7] & 0xff);
136+ *osversion = (read32(abi_note [4], be) << 24) |
137+ ((read32(abi_note [5], be) & 0xff) << 16) |
138+ ((read32(abi_note [6], be) & 0xff) << 8) |
139+ (read32(abi_note [7], be) & 0xff);
140 }
141 break;
142
143@@ -167,13 +191,13 @@ process_elf_file32 (const char *file_nam
144
145 /* Find the string table. */
146 dynamic_strings = NULL;
147- for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
148+ for (dyn_entry = dynamic_segment; read32(dyn_entry->d_tag, be) != DT_NULL;
149 ++dyn_entry)
150 {
151 check_ptr (dyn_entry);
152- if (dyn_entry->d_tag == DT_STRTAB)
153+ if (read32(dyn_entry->d_tag, be) == DT_STRTAB)
154 {
155- dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr);
156+ dynamic_strings = (char *) (file_contents + read32(dyn_entry->d_un.d_val, be) - loadaddr);
157 check_ptr (dynamic_strings);
158 break;
159 }
160@@ -183,15 +207,15 @@ process_elf_file32 (const char *file_nam
161 return 1;
162
163 /* Now read the DT_NEEDED and DT_SONAME entries. */
164- for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
165+ for (dyn_entry = dynamic_segment; read32(dyn_entry->d_tag, be) != DT_NULL;
166 ++dyn_entry)
167 {
168- if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME)
169+ if (read32(dyn_entry->d_tag, be) == DT_NEEDED || read32(dyn_entry->d_tag, be) == DT_SONAME)
170 {
171- char *name = dynamic_strings + dyn_entry->d_un.d_val;
172+ char *name = dynamic_strings + read32(dyn_entry->d_un.d_val, be);
173 check_ptr (name);
174
175- if (dyn_entry->d_tag == DT_NEEDED)
176+ if (read32(dyn_entry->d_tag, be) == DT_NEEDED)
177 {
178
179 if (*flag == FLAG_ELF)
180@@ -208,7 +232,7 @@ process_elf_file32 (const char *file_nam
181 }
182 }
183
184- else if (dyn_entry->d_tag == DT_SONAME)
185+ else if (read32(dyn_entry->d_tag, be) == DT_SONAME)
186 *soname = xstrdup (name);
187
188 /* Do we have everything we need? */
189@@ -246,15 +270,17 @@ process_elf_file64 (const char *file_nam
190 elf_header = (Elf64_Ehdr *) file_contents;
191 *osversion = 0;
192
193- if (elf_header->e_type != ET_DYN)
194+ be = (elf_header->e_ident[EI_DATA] == ELFDATA2MSB);
195+
196+ if (read16(elf_header->e_type, be) != ET_DYN)
197 {
198 error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name,
199- elf_header->e_type);
200+ read16(elf_header->e_type, be));
201 return 1;
202 }
203
204 /* Get information from elf program header. */
205- elf_pheader = (Elf64_Phdr *) (elf_header->e_phoff + file_contents);
206+ elf_pheader = (Elf64_Phdr *) (read64(elf_header->e_phoff, be) + file_contents);
207 check_ptr (elf_pheader);
208
209 /* The library is an elf library, now search for soname and
210@@ -266,27 +292,27 @@ process_elf_file64 (const char *file_nam
211 dynamic_size = 0;
212 program_interpreter = NULL;
213 for (i = 0, segment = elf_pheader;
214- i < elf_header->e_phnum; i++, segment++)
215+ i < read16(elf_header->e_phnum, be); i++, segment++)
216 {
217 check_ptr (segment);
218
219- switch (segment->p_type)
220+ switch (read32(segment->p_type, be))
221 {
222 case PT_LOAD:
223 if (loadaddr == (Elf64_Addr) -1)
224- loadaddr = segment->p_vaddr - segment->p_offset;
225+ loadaddr = read64(segment->p_vaddr, be) - read64(segment->p_offset, be);
226 break;
227
228 case PT_DYNAMIC:
229 if (dynamic_addr)
230 error (0, 0, _("more than one dynamic segment\n"));
231
232- dynamic_addr = segment->p_offset;
233- dynamic_size = segment->p_filesz;
234+ dynamic_addr = read64(segment->p_offset, be);
235+ dynamic_size = read32(segment->p_filesz, be);
236 break;
237
238 case PT_INTERP:
239- program_interpreter = (char *) (file_contents + segment->p_offset);
240+ program_interpreter = (char *) (file_contents + read64(segment->p_offset, be));
241 check_ptr (program_interpreter);
242
243 /* Check if this is enough to classify the binary. */
244@@ -300,20 +326,21 @@ process_elf_file64 (const char *file_nam
245 break;
246
247 case PT_NOTE:
248- if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4)
249+ if (!*osversion && read32(segment->p_filesz, be) >= 32 && read32(segment->p_align, be) >= 4)
250 {
251 Elf64_Word *abi_note = (Elf64_Word *) (file_contents
252- + segment->p_offset);
253- Elf64_Addr size = segment->p_filesz;
254+ + read64(segment->p_offset, be));
255+ Elf64_Addr size = read32(segment->p_filesz, be);
256
257- while (abi_note [0] != 4 || abi_note [1] != 16
258- || abi_note [2] != 1
259+ while (read32(abi_note [0], be) != 4 || read32(abi_note [1], be) != 16
260+ || read32(abi_note [2], be) != 1
261 || memcmp (abi_note + 3, "GNU", 4) != 0)
262 {
263+#undef ROUND
264 #define ROUND(len) (((len) + sizeof (Elf64_Word) - 1) & -sizeof (Elf64_Word))
265 Elf64_Addr note_size = 3 * sizeof (Elf64_Word)
266- + ROUND (abi_note[0])
267- + ROUND (abi_note[1]);
268+ + ROUND (read32(abi_note[0], be))
269+ + ROUND (read32(abi_note[1], be));
270
271 if (size - 32 < note_size || note_size == 0)
272 {
273@@ -327,10 +354,10 @@ process_elf_file64 (const char *file_nam
274 if (size == 0)
275 break;
276
277- *osversion = (abi_note [4] << 24) |
278- ((abi_note [5] & 0xff) << 16) |
279- ((abi_note [6] & 0xff) << 8) |
280- (abi_note [7] & 0xff);
281+ *osversion = (read32(abi_note [4], be) << 24) |
282+ ((read32(abi_note [5], be) & 0xff) << 16) |
283+ ((read32(abi_note [6], be) & 0xff) << 8) |
284+ (read32(abi_note [7], be) & 0xff);
285 }
286 break;
287
288@@ -354,13 +381,13 @@ process_elf_file64 (const char *file_nam
289
290 /* Find the string table. */
291 dynamic_strings = NULL;
292- for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
293+ for (dyn_entry = dynamic_segment; read64(dyn_entry->d_tag, be) != DT_NULL;
294 ++dyn_entry)
295 {
296 check_ptr (dyn_entry);
297- if (dyn_entry->d_tag == DT_STRTAB)
298+ if (read64(dyn_entry->d_tag, be) == DT_STRTAB)
299 {
300- dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr);
301+ dynamic_strings = (char *) (file_contents + read64(dyn_entry->d_un.d_val, be) - loadaddr);
302 check_ptr (dynamic_strings);
303 break;
304 }
305@@ -370,15 +397,15 @@ process_elf_file64 (const char *file_nam
306 return 1;
307
308 /* Now read the DT_NEEDED and DT_SONAME entries. */
309- for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
310+ for (dyn_entry = dynamic_segment; read64(dyn_entry->d_tag, be) != DT_NULL;
311 ++dyn_entry)
312 {
313- if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME)
314+ if (read64(dyn_entry->d_tag, be) == DT_NEEDED || read64(dyn_entry->d_tag, be) == DT_SONAME)
315 {
316- char *name = dynamic_strings + dyn_entry->d_un.d_val;
317+ char *name = dynamic_strings + read64(dyn_entry->d_un.d_val, be);
318 check_ptr (name);
319
320- if (dyn_entry->d_tag == DT_NEEDED)
321+ if (read64(dyn_entry->d_tag, be) == DT_NEEDED)
322 {
323
324 if (*flag == FLAG_ELF)
325@@ -395,7 +422,7 @@ process_elf_file64 (const char *file_nam
326 }
327 }
328
329- else if (dyn_entry->d_tag == DT_SONAME)
330+ else if (read64(dyn_entry->d_tag, be) == DT_SONAME)
331 *soname = xstrdup (name);
332
333 /* Do we have everything we need? */
334Index: ldconfig-native-2.12.1/readlib.c
335===================================================================
336--- ldconfig-native-2.12.1.orig/readlib.c
337+++ ldconfig-native-2.12.1/readlib.c
338@@ -169,7 +169,8 @@ process_file (const char *real_file_name
339 ret = 1;
340 }
341 /* Libraries have to be shared object files. */
342- else if (elf_header->e_type != ET_DYN)
343+ else if ((elf_header->e_ident[EI_DATA] == ELFDATA2MSB && be16toh(elf_header->e_type) != ET_DYN) ||
344+ (elf_header->e_ident[EI_DATA] == ELFDATA2LSB && le16toh(elf_header->e_type) != ET_DYN))
345 ret = 1;
346 else if (process_elf_file (file_name, lib, flag, osversion, soname,
347 file_contents, statbuf.st_size))
348Index: ldconfig-native-2.12.1/cache.c
349===================================================================
350--- ldconfig-native-2.12.1.orig/cache.c
351+++ ldconfig-native-2.12.1/cache.c
352@@ -39,6 +39,29 @@
353 # define N_(msgid) msgid
354 #define _(msg) msg
355
356+extern int be;
357+
358+static uint16_t write16(uint16_t x, int be)
359+{
360+ if (be)
361+ return htobe16(x);
362+ return htole16(x);
363+}
364+
365+static uint32_t write32(uint32_t x, int be)
366+{
367+ if (be)
368+ return htobe32(x);
369+ return htole32(x);
370+}
371+
372+static uint64_t write64(uint64_t x, int be)
373+{
374+ if (be)
375+ return htobe64(x);
376+ return htole64(x);
377+}
378+
379 struct cache_entry
380 {
381 char *lib; /* Library name. */
382@@ -279,7 +302,12 @@ save_cache (const char *cache_name)
383 /* Number of normal cache entries. */
384 int cache_entry_old_count = 0;
385
386- for (entry = entries; entry != NULL; entry = entry->next)
387+ if (be)
388+ printf("saving cache in big endian encoding\n");
389+ else
390+ printf("saving cache in little endian encoding\n");
391+
392+ for (entry = entries; entry != NULL; entry = entry->next)
393 {
394 /* Account the final NULs. */
395 total_strlen += strlen (entry->lib) + strlen (entry->path) + 2;
396@@ -310,7 +338,7 @@ save_cache (const char *cache_name)
397 memset (file_entries, '\0', sizeof (struct cache_file));
398 memcpy (file_entries->magic, CACHEMAGIC, sizeof CACHEMAGIC - 1);
399
400- file_entries->nlibs = cache_entry_old_count;
401+ file_entries->nlibs = write32(cache_entry_old_count, be);
402 }
403
404 struct cache_file_new *file_entries_new = NULL;
405@@ -330,8 +358,8 @@ save_cache (const char *cache_name)
406 memcpy (file_entries_new->version, CACHE_VERSION,
407 sizeof CACHE_VERSION - 1);
408
409- file_entries_new->nlibs = cache_entry_count;
410- file_entries_new->len_strings = total_strlen;
411+ file_entries_new->nlibs = write32(cache_entry_count, be);
412+ file_entries_new->len_strings = write32(total_strlen, be);
413 }
414
415 /* Pad for alignment of cache_file_new. */
416@@ -358,9 +386,9 @@ save_cache (const char *cache_name)
417 /* First the library. */
418 if (opt_format != 2 && entry->hwcap == 0)
419 {
420- file_entries->libs[idx_old].flags = entry->flags;
421+ file_entries->libs[idx_old].flags = write32(entry->flags, be);
422 /* XXX: Actually we can optimize here and remove duplicates. */
423- file_entries->libs[idx_old].key = str_offset + pad;
424+ file_entries->libs[idx_old].key = write32(str_offset + pad, be);
425 }
426 if (opt_format != 0)
427 {
428@@ -368,10 +396,10 @@ save_cache (const char *cache_name)
429 not doing so makes the code easier, the string table
430 always begins at the beginning of the the new cache
431 struct. */
432- file_entries_new->libs[idx_new].flags = entry->flags;
433- file_entries_new->libs[idx_new].osversion = entry->osversion;
434- file_entries_new->libs[idx_new].hwcap = entry->hwcap;
435- file_entries_new->libs[idx_new].key = str_offset;
436+ file_entries_new->libs[idx_new].flags = write32(entry->flags, be);
437+ file_entries_new->libs[idx_new].osversion = write32(entry->osversion, be);
438+ file_entries_new->libs[idx_new].hwcap = write64(entry->hwcap, be);
439+ file_entries_new->libs[idx_new].key = write32(str_offset, be);
440 }
441
442 size_t len = strlen (entry->lib) + 1;
443@@ -379,9 +407,9 @@ save_cache (const char *cache_name)
444 str_offset += len;
445 /* Then the path. */
446 if (opt_format != 2 && entry->hwcap == 0)
447- file_entries->libs[idx_old].value = str_offset + pad;
448+ file_entries->libs[idx_old].value = write32(str_offset + pad, be);
449 if (opt_format != 0)
450- file_entries_new->libs[idx_new].value = str_offset;
451+ file_entries_new->libs[idx_new].value = write32(str_offset, be);
452 len = strlen (entry->path) + 1;
453 str = mempcpy (str, entry->path, len);
454 str_offset += len;
diff --git a/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/endianess-header.patch b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/endianess-header.patch
new file mode 100644
index 0000000..a18b2c2
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/endianess-header.patch
@@ -0,0 +1,113 @@
1Upstream-Status: Inappropriate [fix poky patch]
2
3This patch fixes build issues with a previous endian-ness_handling.patch on
4distros that don't have macros referenced
5
67/20/2011
7Matthew McClintock <msm@freescale.com>
8
9diff -purN ldconfig-native-2.12.1.orig/endian_extra.h ldconfig-native-2.12.1/endian_extra.h
10--- ldconfig-native-2.12.1.orig/endian_extra.h 1969-12-31 18:00:00.000000000 -0600
11+++ ldconfig-native-2.12.1/endian_extra.h 2011-07-19 18:09:14.323048417 -0500
12@@ -0,0 +1,64 @@
13+/* Copyright (C) 1992, 1996, 1997, 2000, 2008 Free Software Foundation, Inc.
14+ This file is part of the GNU C Library.
15+
16+ The GNU C Library is free software; you can redistribute it and/or
17+ modify it under the terms of the GNU Lesser General Public
18+ License as published by the Free Software Foundation; either
19+ version 2.1 of the License, or (at your option) any later version.
20+
21+ The GNU C Library is distributed in the hope that it will be useful,
22+ but WITHOUT ANY WARRANTY; without even the implied warranty of
23+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24+ Lesser General Public License for more details.
25+
26+ You should have received a copy of the GNU Lesser General Public
27+ License along with the GNU C Library; if not, write to the Free
28+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
29+ 02111-1307 USA. */
30+
31+#include <endian.h>
32+
33+#ifndef _ENDIAN_EXTRA_H
34+#define _ENDIAN_EXTRA_H 1
35+
36+/* Don't redefine these macros if they already exist */
37+#ifndef htobe16
38+#ifdef __USE_BSD
39+/* Conversion interfaces. */
40+# include <byteswap.h>
41+
42+# if __BYTE_ORDER == __LITTLE_ENDIAN
43+# define htobe16(x) __bswap_16 (x)
44+# define htole16(x) (x)
45+# define be16toh(x) __bswap_16 (x)
46+# define le16toh(x) (x)
47+
48+# define htobe32(x) __bswap_32 (x)
49+# define htole32(x) (x)
50+# define be32toh(x) __bswap_32 (x)
51+# define le32toh(x) (x)
52+
53+# define htobe64(x) __bswap_64 (x)
54+# define htole64(x) (x)
55+# define be64toh(x) __bswap_64 (x)
56+# define le64toh(x) (x)
57+# else
58+# define htobe16(x) (x)
59+# define htole16(x) __bswap_16 (x)
60+# define be16toh(x) (x)
61+# define le16toh(x) __bswap_16 (x)
62+
63+# define htobe32(x) (x)
64+# define htole32(x) __bswap_32 (x)
65+# define be32toh(x) (x)
66+# define le32toh(x) __bswap_32 (x)
67+
68+# define htobe64(x) (x)
69+# define htole64(x) __bswap_64 (x)
70+# define be64toh(x) (x)
71+# define le64toh(x) __bswap_64 (x)
72+# endif
73+#endif
74+#endif
75+
76+#endif /* endian_extra.h */
77diff -purN ldconfig-native-2.12.1.orig/cache.c ldconfig-native-2.12.1/cache.c
78--- ldconfig-native-2.12.1.orig/cache.c 2011-07-19 18:21:28.347041301 -0500
79+++ ldconfig-native-2.12.1/cache.c 2011-07-19 18:22:54.118048064 -0500
80@@ -39,6 +39,8 @@
81 # define N_(msgid) msgid
82 #define _(msg) msg
83
84+#include "endian_extra.h"
85+
86 extern int be;
87
88 static uint16_t write16(uint16_t x, int be)
89diff -purN ldconfig-native-2.12.1.orig/readelflib.c ldconfig-native-2.12.1/readelflib.c
90--- ldconfig-native-2.12.1.orig/readelflib.c 2011-07-19 18:21:28.346041593 -0500
91+++ ldconfig-native-2.12.1/readelflib.c 2011-07-19 18:23:05.324059875 -0500
92@@ -25,6 +25,9 @@
93
94 /* check_ptr checks that a pointer is in the mmaped file and doesn't
95 point outside it. */
96+
97+#include "endian_extra.h"
98+
99 #undef check_ptr
100 #define check_ptr(ptr) \
101 do \
102diff -purN ldconfig-native-2.12.1.orig/readlib.c ldconfig-native-2.12.1/readlib.c
103--- ldconfig-native-2.12.1.orig/readlib.c 2011-07-19 18:21:28.346041593 -0500
104+++ ldconfig-native-2.12.1/readlib.c 2011-07-19 18:23:23.877046210 -0500
105@@ -40,6 +40,8 @@
106
107 #include "ldconfig.h"
108
109+#include "endian_extra.h"
110+
111 #define _(msg) msg
112
113 #define Elf32_CLASS ELFCLASS32
diff --git a/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/flag_fix.patch b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/flag_fix.patch
new file mode 100644
index 0000000..4e9aab9
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/flag_fix.patch
@@ -0,0 +1,24 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3The native version of ldconfig was using native definition of LD_SO (i.e.
4ld-linux-x86-64.so.2 ) which is not correct for doing the cross ldconfig.
5This was causing libc.so on the target marked as ELF lib rather than
6FLAG_ELF_LIBC6 in the ld.so.cache.
7
8Nitin A Kamble <nitin.a.kamble@intel.com> 2011/04/4
9
10Index: ldconfig-native-2.12.1/readlib.c
11===================================================================
12--- ldconfig-native-2.12.1.orig/readlib.c
13+++ ldconfig-native-2.12.1/readlib.c
14@@ -51,6 +51,10 @@ struct known_names
15 int flag;
16 };
17
18+/* don't use host's definition of LD_SO */
19+#undef LD_SO
20+#define LD_SO "ld.so.1"
21+
22 static struct known_names interpreters[] =
23 {
24 { "/lib/" LD_SO, FLAG_ELF_LIBC6 },
diff --git a/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch
new file mode 100644
index 0000000..5ed4f6f
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch
@@ -0,0 +1,37 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3make ldconfig default to both /lib+/usr/lib, /lib32+/usr/lib32 and
4/lib64+/usr/lib64 on bi-ABI architectures.
5
6---
7 ldconfig.c | 10 ++++++++++
8 1 file changed, 10 insertions(+)
9
10diff -urpN a/ldconfig.c b/ldconfig.c
11--- a/ldconfig.c
12+++ b/ldconfig.c
13@@ -52,7 +52,11 @@
14
15 #define SYSCONFDIR "/etc"
16 #define LIBDIR "/usr/lib"
17+#define LIBDIR32 "/usr/lib32"
18+#define LIBDIR64 "/usr/lib64"
19 #define SLIBDIR "/lib"
20+#define SLIBDIR32 "/lib32"
21+#define SLIBDIR64 "/lib64"
22 # define N_(msgid) msgid
23 #define _(msg) msg
24
25@@ -1373,6 +1377,12 @@ main (int argc, char **argv)
26 add_system_dir (SLIBDIR);
27 if (strcmp (SLIBDIR, LIBDIR))
28 add_system_dir (LIBDIR);
29+ add_system_dir (SLIBDIR32);
30+ if (strcmp (SLIBDIR32, LIBDIR32))
31+ add_system_dir (LIBDIR32);
32+ add_system_dir (SLIBDIR64);
33+ if (strcmp (SLIBDIR64, LIBDIR64))
34+ add_system_dir (LIBDIR64);
35 }
36
37 const char *aux_cache_file = _PATH_LDCONFIG_AUX_CACHE;
diff --git a/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2 b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2
new file mode 100644
index 0000000..dc1e798
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2
Binary files differ
diff --git a/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig.patch b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig.patch
new file mode 100644
index 0000000..52986e6
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig.patch
@@ -0,0 +1,471 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3enable standalone building of ldconfig
4
5---
6 cache.c | 11 +-
7 chroot_canon.c | 7 +
8 dl-cache.c | 235 ---------------------------------------------------------
9 dl-cache.h | 3
10 ldconfig.c | 27 ++++--
11 readlib.c | 7 +
12 xstrdup.c | 11 --
13 7 files changed, 45 insertions(+), 256 deletions(-)
14
15Index: ldconfig-native-2.12.1/cache.c
16===================================================================
17--- ldconfig-native-2.12.1.orig/cache.c
18+++ ldconfig-native-2.12.1/cache.c
19@@ -16,6 +16,9 @@
20 along with this program; if not, write to the Free Software Foundation,
21 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
22
23+#define _LARGEFILE64_SOURCE
24+#define _GNU_SOURCE
25+
26 #include <errno.h>
27 #include <error.h>
28 #include <dirent.h>
29@@ -31,8 +34,10 @@
30 #include <sys/stat.h>
31 #include <sys/types.h>
32
33-#include <ldconfig.h>
34-#include <dl-cache.h>
35+#include "ldconfig.h"
36+#include "dl-cache.h"
37+# define N_(msgid) msgid
38+#define _(msg) msg
39
40 struct cache_entry
41 {
42Index: ldconfig-native-2.12.1/chroot_canon.c
43===================================================================
44--- ldconfig-native-2.12.1.orig/chroot_canon.c
45+++ ldconfig-native-2.12.1/chroot_canon.c
46@@ -17,6 +17,9 @@
47 along with this program; if not, write to the Free Software Foundation,
48 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
49
50+#define _LARGEFILE64_SOURCE
51+#define _GNU_SOURCE
52+
53 #include <stdlib.h>
54 #include <string.h>
55 #include <unistd.h>
56@@ -27,7 +30,9 @@
57 #include <stddef.h>
58 #include <stdint.h>
59
60-#include <ldconfig.h>
61+#include "ldconfig.h"
62+
63+#define __set_errno(Val) errno = (Val)
64
65 #ifndef PATH_MAX
66 #define PATH_MAX 1024
67Index: ldconfig-native-2.12.1/dl-cache.c
68===================================================================
69--- ldconfig-native-2.12.1.orig/dl-cache.c
70+++ ldconfig-native-2.12.1/dl-cache.c
71@@ -20,12 +20,12 @@
72
73 #include <assert.h>
74 #include <unistd.h>
75-#include <ldsodefs.h>
76+//#include "ldsodefs.h"
77 #include <sys/mman.h>
78 #include <dl-cache.h>
79 #include <dl-procinfo.h>
80
81-#include <stdio-common/_itoa.h>
82+//#include "_itoa.h"
83
84 #ifndef _DL_PLATFORMS_COUNT
85 # define _DL_PLATFORMS_COUNT 0
86@@ -39,103 +39,7 @@ static size_t cachesize;
87 /* 1 if cache_data + PTR points into the cache. */
88 #define _dl_cache_verify_ptr(ptr) (ptr < cache_data_size)
89
90-#define SEARCH_CACHE(cache) \
91-/* We use binary search since the table is sorted in the cache file. \
92- The first matching entry in the table is returned. \
93- It is important to use the same algorithm as used while generating \
94- the cache file. */ \
95-do \
96- { \
97- left = 0; \
98- right = cache->nlibs - 1; \
99- \
100- while (left <= right) \
101- { \
102- __typeof__ (cache->libs[0].key) key; \
103- \
104- middle = (left + right) / 2; \
105- \
106- key = cache->libs[middle].key; \
107- \
108- /* Make sure string table indices are not bogus before using \
109- them. */ \
110- if (! _dl_cache_verify_ptr (key)) \
111- { \
112- cmpres = 1; \
113- break; \
114- } \
115- \
116- /* Actually compare the entry with the key. */ \
117- cmpres = _dl_cache_libcmp (name, cache_data + key); \
118- if (__builtin_expect (cmpres == 0, 0)) \
119- { \
120- /* Found it. LEFT now marks the last entry for which we \
121- know the name is correct. */ \
122- left = middle; \
123- \
124- /* There might be entries with this name before the one we \
125- found. So we have to find the beginning. */ \
126- while (middle > 0) \
127- { \
128- __typeof__ (cache->libs[0].key) key; \
129- \
130- key = cache->libs[middle - 1].key; \
131- /* Make sure string table indices are not bogus before \
132- using them. */ \
133- if (! _dl_cache_verify_ptr (key) \
134- /* Actually compare the entry. */ \
135- || _dl_cache_libcmp (name, cache_data + key) != 0) \
136- break; \
137- --middle; \
138- } \
139- \
140- do \
141- { \
142- int flags; \
143- __typeof__ (cache->libs[0]) *lib = &cache->libs[middle]; \
144- \
145- /* Only perform the name test if necessary. */ \
146- if (middle > left \
147- /* We haven't seen this string so far. Test whether the \
148- index is ok and whether the name matches. Otherwise \
149- we are done. */ \
150- && (! _dl_cache_verify_ptr (lib->key) \
151- || (_dl_cache_libcmp (name, cache_data + lib->key) \
152- != 0))) \
153- break; \
154- \
155- flags = lib->flags; \
156- if (_dl_cache_check_flags (flags) \
157- && _dl_cache_verify_ptr (lib->value)) \
158- { \
159- if (best == NULL || flags == GLRO(dl_correct_cache_id)) \
160- { \
161- HWCAP_CHECK; \
162- best = cache_data + lib->value; \
163- \
164- if (flags == GLRO(dl_correct_cache_id)) \
165- /* We've found an exact match for the shared \
166- object and no general `ELF' release. Stop \
167- searching. */ \
168- break; \
169- } \
170- } \
171- } \
172- while (++middle <= right); \
173- break; \
174- } \
175- \
176- if (cmpres < 0) \
177- left = middle + 1; \
178- else \
179- right = middle - 1; \
180- } \
181- } \
182-while (0)
183-
184-
185 int
186-internal_function
187 _dl_cache_libcmp (const char *p1, const char *p2)
188 {
189 while (*p1 != '\0')
190@@ -172,139 +76,3 @@ _dl_cache_libcmp (const char *p1, const
191 }
192 return *p1 - *p2;
193 }
194-
195-
196-/* Look up NAME in ld.so.cache and return the file name stored there,
197- or null if none is found. */
198-
199-const char *
200-internal_function
201-_dl_load_cache_lookup (const char *name)
202-{
203- int left, right, middle;
204- int cmpres;
205- const char *cache_data;
206- uint32_t cache_data_size;
207- const char *best;
208-
209- /* Print a message if the loading of libs is traced. */
210- if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0))
211- _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE);
212-
213- if (cache == NULL)
214- {
215- /* Read the contents of the file. */
216- void *file = _dl_sysdep_read_whole_file (LD_SO_CACHE, &cachesize,
217- PROT_READ);
218-
219- /* We can handle three different cache file formats here:
220- - the old libc5/glibc2.0/2.1 format
221- - the old format with the new format in it
222- - only the new format
223- The following checks if the cache contains any of these formats. */
224- if (file != MAP_FAILED && cachesize > sizeof *cache
225- && memcmp (file, CACHEMAGIC, sizeof CACHEMAGIC - 1) == 0)
226- {
227- size_t offset;
228- /* Looks ok. */
229- cache = file;
230-
231- /* Check for new version. */
232- offset = ALIGN_CACHE (sizeof (struct cache_file)
233- + cache->nlibs * sizeof (struct file_entry));
234-
235- cache_new = (struct cache_file_new *) ((void *) cache + offset);
236- if (cachesize < (offset + sizeof (struct cache_file_new))
237- || memcmp (cache_new->magic, CACHEMAGIC_VERSION_NEW,
238- sizeof CACHEMAGIC_VERSION_NEW - 1) != 0)
239- cache_new = (void *) -1;
240- }
241- else if (file != MAP_FAILED && cachesize > sizeof *cache_new
242- && memcmp (file, CACHEMAGIC_VERSION_NEW,
243- sizeof CACHEMAGIC_VERSION_NEW - 1) == 0)
244- {
245- cache_new = file;
246- cache = file;
247- }
248- else
249- {
250- if (file != MAP_FAILED)
251- __munmap (file, cachesize);
252- cache = (void *) -1;
253- }
254-
255- assert (cache != NULL);
256- }
257-
258- if (cache == (void *) -1)
259- /* Previously looked for the cache file and didn't find it. */
260- return NULL;
261-
262- best = NULL;
263-
264- if (cache_new != (void *) -1)
265- {
266- uint64_t platform;
267-
268- /* This is where the strings start. */
269- cache_data = (const char *) cache_new;
270-
271- /* Now we can compute how large the string table is. */
272- cache_data_size = (const char *) cache + cachesize - cache_data;
273-
274- platform = _dl_string_platform (GLRO(dl_platform));
275- if (platform != (uint64_t) -1)
276- platform = 1ULL << platform;
277-
278-#define _DL_HWCAP_TLS_MASK (1LL << 63)
279- uint64_t hwcap_exclude = ~((GLRO(dl_hwcap) & GLRO(dl_hwcap_mask))
280- | _DL_HWCAP_PLATFORM | _DL_HWCAP_TLS_MASK);
281-
282- /* Only accept hwcap if it's for the right platform. */
283-#define HWCAP_CHECK \
284- if (lib->hwcap & hwcap_exclude) \
285- continue; \
286- if (GLRO(dl_osversion) && lib->osversion > GLRO(dl_osversion)) \
287- continue; \
288- if (_DL_PLATFORMS_COUNT \
289- && (lib->hwcap & _DL_HWCAP_PLATFORM) != 0 \
290- && (lib->hwcap & _DL_HWCAP_PLATFORM) != platform) \
291- continue
292- SEARCH_CACHE (cache_new);
293- }
294- else
295- {
296- /* This is where the strings start. */
297- cache_data = (const char *) &cache->libs[cache->nlibs];
298-
299- /* Now we can compute how large the string table is. */
300- cache_data_size = (const char *) cache + cachesize - cache_data;
301-
302-#undef HWCAP_CHECK
303-#define HWCAP_CHECK do {} while (0)
304- SEARCH_CACHE (cache);
305- }
306-
307- /* Print our result if wanted. */
308- if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0)
309- && best != NULL)
310- _dl_debug_printf (" trying file=%s\n", best);
311-
312- return best;
313-}
314-
315-#ifndef MAP_COPY
316-/* If the system does not support MAP_COPY we cannot leave the file open
317- all the time since this would create problems when the file is replaced.
318- Therefore we provide this function to close the file and open it again
319- once needed. */
320-void
321-_dl_unload_cache (void)
322-{
323- if (cache != NULL && cache != (struct cache_file *) -1)
324- {
325- __munmap (cache, cachesize);
326- cache = NULL;
327- }
328-}
329-#endif
330Index: ldconfig-native-2.12.1/dl-cache.h
331===================================================================
332--- ldconfig-native-2.12.1.orig/dl-cache.h
333+++ ldconfig-native-2.12.1/dl-cache.h
334@@ -101,5 +101,4 @@ struct cache_file_new
335 (((addr) + __alignof__ (struct cache_file_new) -1) \
336 & (~(__alignof__ (struct cache_file_new) - 1)))
337
338-extern int _dl_cache_libcmp (const char *p1, const char *p2)
339- internal_function;
340+extern int _dl_cache_libcmp (const char *p1, const char *p2);
341Index: ldconfig-native-2.12.1/ldconfig.c
342===================================================================
343--- ldconfig-native-2.12.1.orig/ldconfig.c
344+++ ldconfig-native-2.12.1/ldconfig.c
345@@ -16,6 +16,9 @@
346 along with this program; if not, write to the Free Software Foundation,
347 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
348
349+#define _LARGEFILE64_SOURCE
350+#define _GNU_SOURCE
351+
352 #define PROCINFO_CLASS static
353 #include <alloca.h>
354 #include <argp.h>
355@@ -39,10 +42,20 @@
356 #include <glob.h>
357 #include <libgen.h>
358
359-#include <ldconfig.h>
360-#include <dl-cache.h>
361+#include "ldconfig.h"
362+#include "dl-cache.h"
363+
364+#include "dl-procinfo.h"
365+
366+#include "argp.h"
367+
368+
369+#define SYSCONFDIR "/etc"
370+#define LIBDIR "/usr/lib"
371+#define SLIBDIR "/lib"
372+# define N_(msgid) msgid
373+#define _(msg) msg
374
375-#include <dl-procinfo.h>
376
377 #ifdef _DL_FIRST_PLATFORM
378 # define _DL_FIRST_EXTRA (_DL_FIRST_PLATFORM + _DL_PLATFORMS_COUNT)
379@@ -55,7 +68,7 @@
380 #endif
381
382 /* Get libc version number. */
383-#include <version.h>
384+#include "version.h"
385
386 #define PACKAGE _libc_intl_domainname
387
388@@ -152,8 +165,8 @@ static const struct argp_option options[
389 { NULL, 0, NULL, 0, NULL, 0 }
390 };
391
392-#define PROCINFO_CLASS static
393-#include <dl-procinfo.c>
394+//#define PROCINFO_CLASS static
395+//#include <dl-procinfo.c>
396
397 /* Short description of program. */
398 static const char doc[] = N_("Configure Dynamic Linker Run Time Bindings.");
399@@ -291,6 +304,7 @@ parse_opt (int key, char *arg, struct ar
400 return 0;
401 }
402
403+#define REPORT_BUGS_TO "mailing list : poky@yoctoproject.org"
404 /* Print bug-reporting information in the help message. */
405 static char *
406 more_help (int key, const char *text, void *input)
407@@ -315,7 +329,7 @@ For bug reporting instructions, please s
408 static void
409 print_version (FILE *stream, struct argp_state *state)
410 {
411- fprintf (stream, "ldconfig %s%s\n", PKGVERSION, VERSION);
412+ fprintf (stream, "ldconfig (Hacked Poky Version)\n");
413 fprintf (stream, gettext ("\
414 Copyright (C) %s Free Software Foundation, Inc.\n\
415 This is free software; see the source for copying conditions. There is NO\n\
416@@ -1233,6 +1247,7 @@ set_hwcap (void)
417 hwcap_mask = strtoul (mask, NULL, 0);
418 }
419
420+const char _libc_intl_domainname[] = "libc";
421
422 int
423 main (int argc, char **argv)
424Index: ldconfig-native-2.12.1/readlib.c
425===================================================================
426--- ldconfig-native-2.12.1.orig/readlib.c
427+++ ldconfig-native-2.12.1/readlib.c
428@@ -22,6 +22,9 @@
429 development version. Besides the simplification, it has also been
430 modified to read some other file formats. */
431
432+#define _LARGEFILE64_SOURCE
433+#define _GNU_SOURCE
434+
435 #include <a.out.h>
436 #include <elf.h>
437 #include <error.h>
438@@ -35,7 +38,9 @@
439 #include <sys/stat.h>
440 #include <gnu/lib-names.h>
441
442-#include <ldconfig.h>
443+#include "ldconfig.h"
444+
445+#define _(msg) msg
446
447 #define Elf32_CLASS ELFCLASS32
448 #define Elf64_CLASS ELFCLASS64
449Index: ldconfig-native-2.12.1/xstrdup.c
450===================================================================
451--- ldconfig-native-2.12.1.orig/xstrdup.c
452+++ ldconfig-native-2.12.1/xstrdup.c
453@@ -16,15 +16,10 @@
454 along with this program; if not, write to the Free Software Foundation,
455 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
456
457-#ifdef HAVE_CONFIG_H
458-# include <config.h>
459-#endif
460+#define _GNU_SOURCE
461+
462+#include <string.h>
463
464-#if defined STDC_HEADERS || defined HAVE_STRING_H || _LIBC
465-# include <string.h>
466-#else
467-# include <strings.h>
468-#endif
469 void *xmalloc (size_t n) __THROW;
470 char *xstrdup (char *string) __THROW;
471
diff --git a/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch
new file mode 100644
index 0000000..27bc411
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch
@@ -0,0 +1,36 @@
1Upstream-Status: Pending
2
3Coming from this bug: http://sourceware.org/bugzilla/show_bug.cgi?id=11149
4
5Nitin A Kamble <nitin.a.kamble@intel.com>2011/03/29
6
7--- ldconfig-native-2.12.1.orig/ldconfig.c
8+++ ldconfig-native-2.12.1/ldconfig.c
9@@ -1359,14 +1359,9 @@ main (int argc, char **argv)
10
11 const char *aux_cache_file = _PATH_LDCONFIG_AUX_CACHE;
12 if (opt_chroot)
13- {
14- aux_cache_file = chroot_canon (opt_chroot, aux_cache_file);
15- if (aux_cache_file == NULL)
16- error (EXIT_FAILURE, errno, _("Can't open cache file %s\n"),
17- _PATH_LDCONFIG_AUX_CACHE);
18- }
19+ aux_cache_file = chroot_canon (opt_chroot, aux_cache_file);
20
21- if (! opt_ignore_aux_cache)
22+ if (! opt_ignore_aux_cache && aux_cache_file)
23 load_aux_cache (aux_cache_file);
24 else
25 init_aux_cache ();
26@@ -1376,7 +1371,8 @@ main (int argc, char **argv)
27 if (opt_build_cache)
28 {
29 save_cache (cache_file);
30- save_aux_cache (aux_cache_file);
31+ if (aux_cache_file)
32+ save_aux_cache (aux_cache_file);
33 }
34
35 return 0;
36
diff --git a/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native_2.12.1.bb b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native_2.12.1.bb
new file mode 100644
index 0000000..7c34635
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/ldconfig-native_2.12.1.bb
@@ -0,0 +1,32 @@
1SUMMARY = "A standalone native ldconfig build"
2
3LICENSE = "GPLv2+"
4
5LIC_FILES_CHKSUM = "file://${S}/ldconfig.c;endline=17;md5=1d15f20937c055cb5de2329a4c054399"
6
7SRC_URI = "file://ldconfig-native-2.12.1.tar.bz2 \
8 file://ldconfig.patch \
9 file://ldconfig_aux-cache_path_fix.patch \
10 file://32and64bit.patch \
11 file://endian-ness_handling.patch \
12 file://flag_fix.patch \
13 file://endianess-header.patch \
14 file://ldconfig-default-to-all-multilib-dirs.patch \
15"
16
17PR = "r2"
18
19FILESEXTRAPATHS =. "${FILE_DIRNAME}/${P}:"
20
21inherit native
22
23S = "${WORKDIR}/${PN}-${PV}"
24
25do_compile () {
26 $CC ldconfig.c -std=gnu99 chroot_canon.c xmalloc.c xstrdup.c cache.c readlib.c -I. dl-cache.c -o ldconfig
27}
28
29do_install () {
30 install -d ${D}/${bindir}/
31 install ldconfig ${D}/${bindir}/
32}
diff --git a/meta-linaro-toolchain/recipes-core/glibc/site_config/funcs b/meta-linaro-toolchain/recipes-core/glibc/site_config/funcs
new file mode 100644
index 0000000..ccc8539
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/site_config/funcs
@@ -0,0 +1,474 @@
1a64l
2abs
3access
4__adjtimex
5alarm
6alphasort
7argz_append
8__argz_count
9argz_create_sep
10argz_insert
11__argz_next
12argz_next
13__argz_stringify
14argz_stringify
15asprintf
16atexit
17atof
18atoi
19bcmp
20bcopy
21bindresvport
22bind_textdomain_codeset
23btowc
24bzero
25calloc
26canonicalize_file_name
27catgets
28cfgetospeed
29cfsetispeed
30cfsetspeed
31chmod
32chown
33chroot
34clock
35close
36closedir
37closelog
38confstr
39connect
40daemon
41dcgettext
42difftime
43dirfd
44dirname
45dngettext
46dup2
47ecvt
48endgrent
49endmntent
50endpwent
51endutent
52endutxent
53epoll_ctl
54err
55ether_hostton
56ether_ntohost
57euidaccess
58execv
59fchdir
60fchmod
61fchmodat
62fchown
63fchownat
64fcntl
65fcvt
66fdatasync
67fdopendir
68feof_unlocked
69fgets_unlocked
70fgetxattr
71finite
72flistxattr
73flock
74flockfile
75fnmatch
76fork
77fpathconf
78__fpending
79fprintf
80free
81freeaddrinfo
82freeifaddrs
83fseeko
84__fsetlocking
85fsetxattr
86fstat64
87fstat
88fstatfs
89fsync
90ftello
91ftime
92ftruncate
93funlockfile
94futimes
95futimesat
96gai_strerror
97gcvt
98getaddrinfo
99getc_unlocked
100getcwd
101getdelim
102getdomainname
103getdtablesize
104getegid
105getenv
106geteuid
107getgid
108getgrent
109getgrent_r
110getgrgid_r
111getgrnam
112getgrnam_r
113getgrouplist
114getgroups
115gethostbyaddr_r
116gethostbyname2
117gethostbyname
118gethostbyname_r
119gethostent
120gethostid
121gethostname
122getifaddrs
123getline
124getloadavg
125getmntent
126getmsg
127getnameinfo
128getnetbyaddr_r
129getnetgrent_r
130getopt
131getopt_long
132getopt_long_only
133getpagesize
134getpass
135getpeername
136getpgrp
137getpid
138getppid
139getprotoent_r
140getpwent
141getpwent_r
142getpwnam
143getpwnam_r
144getpwuid
145getpwuid_r
146getresuid
147getrlimit
148getrusage
149getservbyname
150getservbyname_r
151getservbyport_r
152getservent
153getservent_r
154getspnam
155getspnam_r
156gettimeofday
157getttyent
158getttynam
159getuid
160getusershell
161getutent
162getutid
163getutline
164getutmp
165getutmpx
166getutxent
167getutxid
168getutxline
169getwd
170getxattr
171glob
172gmtime
173gmtime_r
174grantpt
175group_member
176herror
177hstrerror
178iconv
179iconv_open
180if_freenameindex
181if_indextoname
182if_nameindex
183if_nametoindex
184index
185inet_addr
186inet_aton
187inet_ntoa
188inet_ntop
189inet_pton
190initgroups
191innetgr
192iruserok
193isascii
194isatty
195isblank
196isgraph
197isinf
198isnan
199isprint
200isspace
201iswalnum
202iswcntrl
203iswctype
204iswprint
205iswspace
206iswupper
207isxdigit
208kill
209killpg
210lchown
211lckpwdf
212lgetxattr
213link
214listxattr
215llistxattr
216localtime
217localtime_r
218lockf
219lrand48
220lsearch
221lseek64
222lsetxattr
223lstat
224mallinfo
225malloc
226mblen
227mbrlen
228mbrtowc
229mbsinit
230mbsrtowcs
231mbtowc
232memalign
233memchr
234memcmp
235memcpy
236memmove
237mempcpy
238memrchr
239memset
240mkdir
241mkdirat
242mkdtemp
243mkfifo
244mknod
245mkstemp64
246mkstemp
247mktime
248mlock
249mmap
250mtrace
251munlock
252munmap
253nanosleep
254nice
255nl_langinfo
256ntp_adjtime
257ntp_gettime
258_obstack_free
259on_exit
260open64
261open
262openat
263opendir
264openlog
265pathconf
266pipe
267poll
268popen
269posix_memalign
270prctl
271pread
272printf
273__progname
274pselect
275pthread_mutex_lock
276ptsname
277putenv
278putgrent
279putpwent
280putspent
281pututline
282pututxline
283putwc
284pwrite
285qsort
286raise
287rand
288random
289rand_r
290read
291readdir
292readdir_r
293readlink
294realloc
295realpath
296re_comp
297recvmsg
298re_exec
299regcomp
300regexec
301remove
302rename
303re_search
304rmdir
305rpmatch
306rresvport_af
307ruserok
308ruserok_af
309sbrk
310scandir
311sched_setscheduler
312sched_yield
313__secure_getenv
314select
315semctl
316semget
317sendmsg
318setbuf
319setbuffer
320setegid
321setenv
322seteuid
323setgid
324setgroups
325sethostname
326setitimer
327_setjmp
328setjmp
329setlinebuf
330setlocale
331setmntent
332setpgid
333setpgrp
334setpriority
335setregid
336setresgid
337setresuid
338setreuid
339setrlimit
340setsid
341setsockopt
342settimeofday
343setuid
344setutent
345setutxent
346setvbuf
347setxattr
348sgetspent
349shmat
350shmctl
351shmdt
352shmget
353shutdown
354sigaction
355sigaddset
356sigaltstack
357sigblock
358sigemptyset
359sighold
360siginterrupt
361signal
362sigprocmask
363sigset
364sigsetmask
365sigstack
366sigsuspend
367sigvec
368snprintf
369socket
370socketpair
371sprintf
372srand48
373srand
374srandom
375sscanf
376stat
377statfs
378statvfs
379stime
380stpcpy
381strcasecmp
382strcasestr
383strchr
384strchrnul
385strcmp
386strcspn
387strdup
388strerror
389strerror_r
390strftime
391strlen
392strncasecmp
393strncmp
394strndup
395strnlen
396strpbrk
397strptime
398strrchr
399strsep
400strsignal
401strspn
402strstr
403strtod
404strtoimax
405strtok_r
406strtol
407strtoll
408strtoul
409strtoull
410strtoumax
411strverscmp
412strxfrm
413symlink
414sync
415sysconf
416sysctl
417sysinfo
418syslog
419_sys_siglist
420sys_siglist
421system
422tcgetattr
423tcgetpgrp
424tcsetattr
425tcsetpgrp
426time
427timegm
428times
429timezone
430tmpnam
431towlower
432towupper
433truncate
434tsearch
435ttyname
436tzset
437ulimit
438umask
439uname
440unlink
441unsetenv
442unshare
443updwtmp
444updwtmpx
445usleep
446ustat
447utime
448utimes
449utmpname
450utmpxname
451valloc
452vasprintf
453verrx
454vfork
455vfprintf
456vfscanf
457vhangup
458vprintf
459vsnprintf
460vsprintf
461wait3
462wait4
463waitpid
464wcrtomb
465wcscoll
466wcsdup
467wcslen
468wctob
469wctomb
470wctype
471wcwidth
472wmemchr
473wmemcpy
474wmempcpy
diff --git a/meta-linaro-toolchain/recipes-core/glibc/site_config/headers b/meta-linaro-toolchain/recipes-core/glibc/site_config/headers
new file mode 100644
index 0000000..609ab53
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/site_config/headers
@@ -0,0 +1,156 @@
1aio.h
2alloca.h
3argz.h
4arpa/inet.h
5arpa/nameser.h
6asm/byteorder.h
7asm/ioctls.h
8asm/page.h
9asm/types.h
10assert.h
11byteswap.h
12crypt.h
13ctype.h
14dirent.h
15dlfcn.h
16elf.h
17endian.h
18err.h
19errno.h
20execinfo.h
21fcntl.h
22features.h
23float.h
24fstab.h
25ftw.h
26getopt.h
27glob.h
28grp.h
29iconv.h
30ifaddrs.h
31inttypes.h
32langinfo.h
33lastlog.h
34libgen.h
35libintl.h
36limits.h
37linux/capability.h
38linux/fd.h
39linux/fs.h
40linux/hayesesp.h
41linux/hdreg.h
42linux/icmp.h
43linux/in6.h
44linux/joystick.h
45linux/ptrace.h
46linux/serial.h
47linux/sonypi.h
48linux/unistd.h
49linux/utsname.h
50linux/version.h
51locale.h
52malloc.h
53math.h
54mcheck.h
55memory.h
56mntent.h
57mqueue.h
58netdb.h
59net/if.h
60netinet/ether.h
61netinet/in.h
62netinet/ip6.h
63netinet/ip.h
64netinet/tcp.h
65netinet/udp.h
66netipx/ipx.h
67net/route.h
68paths.h
69poll.h
70pthread.h
71pty.h
72pwd.h
73regex.h
74resolv.h
75rpc/rpc.h
76rpc/types.h
77sched.h
78scsi/scsi.h
79search.h
80semaphore.h
81setjmp.h
82sgtty.h
83shadow.h
84signal.h
85stdarg.h
86stdbool.h
87stdc
88stddef.h
89stdint.h
90stdio.h
91stdlib.h
92string.h
93strings.h
94stropts.h
95sys/bitypes.h
96sys/cdefs.h
97sys/dir.h
98sys/epoll.h
99sysexits.h
100sys/fcntl.h
101sys/file.h
102sys/fsuid.h
103sys/ioctl.h
104sys/ipc.h
105syslog.h
106sys/mman.h
107sys/mount.h
108sys/mtio.h
109sys/param.h
110sys/poll.h
111sys/prctl.h
112sys/ptrace.h
113sys/queue.h
114sys/reg.h
115sys/resource.h
116sys/select.h
117sys/sem.h
118sys/shm.h
119sys/signal.h
120sys/socket.h
121sys/socketvar.h
122sys/soundcard.h
123sys/statfs.h
124sys/stat.h
125sys/statvfs.h
126sys/stropts.h
127sys/swap.h
128sys/sysctl.h
129sys/sysinfo.h
130sys/sysmacros.h
131sys/termios.h
132sys/timeb.h
133sys/time.h
134sys/times.h
135sys/timex.h
136sys/types.h
137sys/uio.h
138sys/un.h
139sys/unistd.h
140sys/user.h
141sys/utsname.h
142sys/vfs.h
143sys/wait.h
144termio.h
145termios.h
146time.h
147ttyent.h
148ulimit.h
149unistd.h
150ustat.h
151utime.h
152utmp.h
153utmpx.h
154values.h
155wchar.h
156wctype.h
diff --git a/meta-linaro-toolchain/recipes-core/glibc/site_config/types b/meta-linaro-toolchain/recipes-core/glibc/site_config/types
new file mode 100644
index 0000000..178bd85
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/site_config/types
@@ -0,0 +1,21 @@
1char
2char *
3double
4float
5int
6long
7long double
8long int
9long long
10long long int
11short
12short int
13signed char
14unsigned char
15unsigned int
16unsigned long
17unsigned long int
18unsigned long long int
19unsigned short
20unsigned short int
21void *
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-cross-canadian_linaro-2.24.bb b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-cross-canadian_linaro-2.24.bb
new file mode 100644
index 0000000..76b6277
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-cross-canadian_linaro-2.24.bb
@@ -0,0 +1,3 @@
1require recipes-devtools/binutils/binutils.inc
2require recipes-devtools/binutils/binutils-${PV}.inc
3require recipes-devtools/binutils/binutils-cross-canadian.inc
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-cross_linaro-2.24.bb b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-cross_linaro-2.24.bb
new file mode 100644
index 0000000..a8b918e
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-cross_linaro-2.24.bb
@@ -0,0 +1,3 @@
1require recipes-devtools/binutils/binutils.inc
2require recipes-devtools/binutils/binutils-${PV}.inc
3require recipes-devtools/binutils/binutils-cross.inc
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-crosssdk_linaro-2.24.bb b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-crosssdk_linaro-2.24.bb
new file mode 100644
index 0000000..1c62ed4
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-crosssdk_linaro-2.24.bb
@@ -0,0 +1,13 @@
1require recipes-devtools/binutils/binutils-cross_${PV}.bb
2
3inherit crosssdk
4
5PN = "binutils-crosssdk-${TARGET_ARCH}"
6
7PROVIDES = "virtual/${TARGET_PREFIX}binutils-crosssdk"
8
9SRC_URI += "file://relocatable_sdk.patch"
10
11do_configure_prepend () {
12 sed -i 's#/usr/local/lib /lib /usr/lib#${SDKPATHNATIVE}/lib ${SDKPATHNATIVE}/usr/lib /usr/local/lib /lib /usr/lib#' ${S}/ld/configure.tgt
13}
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24.inc b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24.inc
new file mode 100644
index 0000000..888e0e9
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24.inc
@@ -0,0 +1,47 @@
1BPV = "2.24.0"
2MMYY = "14.11"
3RELEASE = "20${MMYY}"
4LINARORELEASE = "20${MMYY}-2"
5PR = "r${RELEASE}"
6
7LIC_FILES_CHKSUM="\
8 file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\
9 file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674\
10 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504\
11 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6\
12 file://gas/COPYING;md5=d32239bcb673463ab874e80d47fae504\
13 file://include/COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\
14 file://include/COPYING3;md5=d32239bcb673463ab874e80d47fae504\
15 file://libiberty/COPYING.LIB;md5=a916467b91076e631dd8edb7424769c7\
16 file://bfd/COPYING;md5=d32239bcb673463ab874e80d47fae504\
17 "
18
19SRC_URI = "\
20 http://releases.linaro.org/${MMYY}/components/toolchain/binutils-linaro/binutils-linaro-${BPV}-${LINARORELEASE}.tar.xz \
21 file://binutils-uclibc-100-uclibc-conf.patch \
22 file://binutils-uclibc-300-001_ld_makefile_patch.patch \
23 file://binutils-uclibc-300-006_better_file_error.patch \
24 file://binutils-uclibc-300-012_check_ldrunpath_length.patch \
25 file://binutils-uclibc-gas-needs-libm.patch \
26 file://libtool-2.4-update.patch \
27 file://libiberty_path_fix.patch \
28 file://binutils-poison.patch \
29 file://libtool-rpath-fix.patch \
30 file://binutils-armv5e.patch \
31 file://mips64-default-ld-emulation.patch \
32 file://binutils-xlp-support.patch \
33 file://fix-pr15815.patch;apply=no \
34 file://fix-pr2404.patch \
35 file://fix-pr16476.patch \
36 file://fix-pr16428.patch \
37 file://replace_macros_with_static_inline.patch;apply=no \
38 file://0001-Fix-MMIX-build-breakage-from-bfd_set_section_vma-cha.patch;apply=no \
39 file://binutils-uninitialised-warning.patch \
40 file://0001-AArch64-Define-LP64-LE-loader-name.patch \
41 file://0001-AArch64-Define-LP64-BE-linker-name.patch \
42 "
43
44SRC_URI[md5sum] = "05c1d4bc718ec05f6d53785eea10763f"
45SRC_URI[sha256sum] = "9196bb6f53c6f113681f06fc396f615101e5f367a4ea48dbcbe45616d5eb1d06"
46
47S = "${WORKDIR}/binutils-linaro-${BPV}-${LINARORELEASE}"
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/0001-AArch64-Define-LP64-BE-linker-name.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/0001-AArch64-Define-LP64-BE-linker-name.patch
new file mode 100644
index 0000000..7e4923c
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/0001-AArch64-Define-LP64-BE-linker-name.patch
@@ -0,0 +1,18 @@
1From 5a4f233680ecf1132591f8213ff1cc6a2535b1b7 Mon Sep 17 00:00:00 2001
2From: Marcus Shawcroft <marcus.shawcroft@arm.com>
3Date: Mon, 20 Jan 2014 18:20:04 +0000
4Subject: [PATCH] [AArch64] Define LP64 BE linker name.
5
6---
7 ld/ChangeLog | 4 ++++
8 ld/emulparams/aarch64linuxb.sh | 1 +
9 2 files changed, 5 insertions(+)
10
11Index: binutils-linaro-2.24-2014.03/ld/emulparams/aarch64linuxb.sh
12===================================================================
13--- binutils-linaro-2.24-2014.03.orig/ld/emulparams/aarch64linuxb.sh
14+++ binutils-linaro-2.24-2014.03/ld/emulparams/aarch64linuxb.sh
15@@ -1,2 +1,3 @@
16 . ${srcdir}/emulparams/aarch64linux.sh
17 OUTPUT_FORMAT="elf64-bigaarch64"
18+ELF_INTERPRETER_NAME=\"/lib/ld-linux-aarch64_be.so.1\"
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/0001-AArch64-Define-LP64-LE-loader-name.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/0001-AArch64-Define-LP64-LE-loader-name.patch
new file mode 100644
index 0000000..ea22461
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/0001-AArch64-Define-LP64-LE-loader-name.patch
@@ -0,0 +1,20 @@
1From 30feb358161fe68402e0e42deebe71a0c432763b Mon Sep 17 00:00:00 2001
2From: Marcus Shawcroft <marcus.shawcroft@arm.com>
3Date: Mon, 20 Jan 2014 18:18:52 +0000
4Subject: [PATCH] [AArch64] Define LP64 LE loader name.
5
6---
7 ld/ChangeLog | 4 ++++
8 ld/emulparams/aarch64linux.sh | 2 ++
9 2 files changed, 6 insertions(+)
10
11Index: binutils-linaro-2.24-2014.03/ld/emulparams/aarch64linux.sh
12===================================================================
13--- binutils-linaro-2.24-2014.03.orig/ld/emulparams/aarch64linux.sh
14+++ binutils-linaro-2.24-2014.03/ld/emulparams/aarch64linux.sh
15@@ -45,3 +45,5 @@ case "$target" in
16 esac
17 ;;
18 esac
19+
20+ELF_INTERPRETER_NAME=\"/lib/ld-linux-aarch64.so.1\"
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/0001-Fix-MMIX-build-breakage-from-bfd_set_section_vma-cha.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/0001-Fix-MMIX-build-breakage-from-bfd_set_section_vma-cha.patch
new file mode 100644
index 0000000..f786b17
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/0001-Fix-MMIX-build-breakage-from-bfd_set_section_vma-cha.patch
@@ -0,0 +1,31 @@
1Upstream-Status: Backport
2
3From 0a09fb4a09e80c36fa3ef763ae276fd13d272a36 Mon Sep 17 00:00:00 2001
4From: Hans-Peter Nilsson <hp@bitrange.com>
5Date: Sat, 1 Feb 2014 01:11:28 +0100
6Subject: [PATCH] Fix MMIX build breakage from bfd_set_section_vma change.
7
8 * emultempl/mmix-elfnmmo.em (mmix_after_allocation): Fix typo in
9 call to bfd_set_section_vma exposed by recent bfd_set_section_vma
10 change.
11---
12 ld/ChangeLog | 6 ++++++
13 ld/emultempl/mmix-elfnmmo.em | 2 +-
14 2 files changed, 7 insertions(+), 1 deletion(-)
15
16diff --git a/ld/emultempl/mmix-elfnmmo.em b/ld/emultempl/mmix-elfnmmo.em
17index 0059792..5e9781a 100644
18--- a/ld/emultempl/mmix-elfnmmo.em
19+++ b/ld/emultempl/mmix-elfnmmo.em
20@@ -102,7 +102,7 @@ mmix_after_allocation (void)
21 This section is only present when there are register symbols. */
22 sec = bfd_get_section_by_name (link_info.output_bfd, MMIX_REG_SECTION_NAME);
23 if (sec != NULL)
24- bfd_set_section_vma (abfd, sec, 0);
25+ bfd_set_section_vma (sec->owner, sec, 0);
26
27 if (!_bfd_mmix_after_linker_allocation (link_info.output_bfd, &link_info))
28 {
29--
301.7.10.4
31
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-armv5e.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-armv5e.patch
new file mode 100644
index 0000000..97ad6df
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-armv5e.patch
@@ -0,0 +1,25 @@
1Add the armv5e architecture to binutils
2
3Binutils has a comment that indicates it is supposed to match gcc for all of
4the support "-march=" settings, but it was lacking the armv5e setting. This
5was a simple way to add it, as thumb instructions shouldn't be generated by
6the compiler anyway.
7
8Upstream-Status: Denied
9Upstream maintainer indicated that we should not be using armv5e, even though
10it is a legal archicture defined by our gcc.
11
12Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
13
14Index: binutils-2.22.90/gas/config/tc-arm.c
15===================================================================
16--- binutils-2.22.90.orig/gas/config/tc-arm.c 2012-07-24 09:38:32.000000000 -0700
17+++ binutils-2.22.90/gas/config/tc-arm.c 2012-08-07 23:41:59.822564075 -0700
18@@ -23162,6 +23162,7 @@
19 ARM_ARCH_OPT ("armv4t", ARM_ARCH_V4T, FPU_ARCH_FPA),
20 ARM_ARCH_OPT ("armv4txm", ARM_ARCH_V4TxM, FPU_ARCH_FPA),
21 ARM_ARCH_OPT ("armv5", ARM_ARCH_V5, FPU_ARCH_VFP),
22+ ARM_ARCH_OPT ("armv5e", ARM_ARCH_V5TE, FPU_ARCH_VFP),
23 ARM_ARCH_OPT ("armv5t", ARM_ARCH_V5T, FPU_ARCH_VFP),
24 ARM_ARCH_OPT ("armv5txm", ARM_ARCH_V5TxM, FPU_ARCH_VFP),
25 ARM_ARCH_OPT ("armv5te", ARM_ARCH_V5TE, FPU_ARCH_VFP),
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-poison.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-poison.patch
new file mode 100644
index 0000000..996c023
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-poison.patch
@@ -0,0 +1,259 @@
1Upstream-Status: Inappropriate [distribution: codesourcery]
2
3Patch originally created by Mark Hatle, forward-ported to
4binutils 2.21 by Scott Garman.
5
6purpose: warn for uses of system directories when cross linking
7
8Code Merged from Sourcery G++ binutils 2.19 - 4.4-277
9
102008-07-02 Joseph Myers <joseph@codesourcery.com>
11
12 ld/
13 * ld.h (args_type): Add error_poison_system_directories.
14 * ld.texinfo (--error-poison-system-directories): Document.
15 * ldfile.c (ldfile_add_library_path): Check
16 command_line.error_poison_system_directories.
17 * ldmain.c (main): Initialize
18 command_line.error_poison_system_directories.
19 * lexsup.c (enum option_values): Add
20 OPTION_ERROR_POISON_SYSTEM_DIRECTORIES.
21 (ld_options): Add --error-poison-system-directories.
22 (parse_args): Handle new option.
23
242007-06-13 Joseph Myers <joseph@codesourcery.com>
25
26 ld/
27 * config.in: Regenerate.
28 * ld.h (args_type): Add poison_system_directories.
29 * ld.texinfo (--no-poison-system-directories): Document.
30 * ldfile.c (ldfile_add_library_path): Check
31 command_line.poison_system_directories.
32 * ldmain.c (main): Initialize
33 command_line.poison_system_directories.
34 * lexsup.c (enum option_values): Add
35 OPTION_NO_POISON_SYSTEM_DIRECTORIES.
36 (ld_options): Add --no-poison-system-directories.
37 (parse_args): Handle new option.
38
392007-04-20 Joseph Myers <joseph@codesourcery.com>
40
41 Merge from Sourcery G++ binutils 2.17:
42
43 2007-03-20 Joseph Myers <joseph@codesourcery.com>
44 Based on patch by Mark Hatle <mark.hatle@windriver.com>.
45 ld/
46 * configure.in (--enable-poison-system-directories): New option.
47 * configure, config.in: Regenerate.
48 * ldfile.c (ldfile_add_library_path): If
49 ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib,
50 /usr/lib, /usr/local/lib or /usr/X11R6/lib.
51
52Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
53Signed-off-by: Scott Garman <scott.a.garman@intel.com>
54
55Index: binutils-2.24/ld/config.in
56===================================================================
57--- binutils-2.24.orig/ld/config.in 2013-12-15 11:46:17.000000000 -0800
58+++ binutils-2.24/ld/config.in 2013-12-15 11:46:59.810435651 -0800
59@@ -11,6 +11,9 @@
60 language is requested. */
61 #undef ENABLE_NLS
62
63+/* Define to warn for use of native system library directories */
64+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
65+
66 /* Additional extension a shared object might have. */
67 #undef EXTRA_SHLIB_EXTENSION
68
69Index: binutils-2.24/ld/configure
70===================================================================
71--- binutils-2.24.orig/ld/configure 2013-12-15 11:46:17.000000000 -0800
72+++ binutils-2.24/ld/configure 2013-12-15 11:46:59.810435651 -0800
73@@ -777,6 +777,7 @@
74 enable_targets
75 enable_64_bit_bfd
76 with_sysroot
77+enable_poison_system_directories
78 enable_gold
79 enable_got
80 enable_werror
81@@ -1433,6 +1434,8 @@
82 (and sometimes confusing) to the casual installer
83 --enable-targets alternative target configurations
84 --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
85+ --enable-poison-system-directories
86+ warn for use of native system library directories
87 --enable-gold[=ARG] build gold [ARG={default,yes,no}]
88 --enable-got=<type> GOT handling scheme (target, single, negative,
89 multigot)
90@@ -4345,7 +4348,18 @@
91 fi
92
93
94+# Check whether --enable-poison-system-directories was given.
95+if test "${enable_poison_system_directories+set}" = set; then :
96+ enableval=$enable_poison_system_directories;
97+else
98+ enable_poison_system_directories=no
99+fi
100+
101+if test "x${enable_poison_system_directories}" = "xyes"; then
102
103+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
104+
105+fi
106
107 # Check whether --enable-got was given.
108 if test "${enable_got+set}" = set; then :
109Index: binutils-2.24/ld/configure.in
110===================================================================
111--- binutils-2.24.orig/ld/configure.in 2013-12-15 11:46:17.000000000 -0800
112+++ binutils-2.24/ld/configure.in 2013-12-15 11:46:59.810435651 -0800
113@@ -87,6 +87,16 @@
114 AC_SUBST(TARGET_SYSTEM_ROOT)
115 AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
116
117+AC_ARG_ENABLE([poison-system-directories],
118+ AS_HELP_STRING([--enable-poison-system-directories],
119+ [warn for use of native system library directories]),,
120+ [enable_poison_system_directories=no])
121+if test "x${enable_poison_system_directories}" = "xyes"; then
122+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
123+ [1],
124+ [Define to warn for use of native system library directories])
125+fi
126+
127 dnl Use --enable-gold to decide if this linker should be the default.
128 dnl "install_as_default" is set to false if gold is the default linker.
129 dnl "installed_linker" is the installed BFD linker name.
130Index: binutils-2.24/ld/ldfile.c
131===================================================================
132--- binutils-2.24.orig/ld/ldfile.c 2013-12-15 11:46:17.000000000 -0800
133+++ binutils-2.24/ld/ldfile.c 2013-12-15 11:46:59.813768989 -0800
134@@ -116,6 +116,23 @@
135 new_dirs->name = concat (ld_sysroot, name + 1, (const char *) NULL);
136 else
137 new_dirs->name = xstrdup (name);
138+
139+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
140+ if (command_line.poison_system_directories
141+ && ((!strncmp (name, "/lib", 4))
142+ || (!strncmp (name, "/usr/lib", 8))
143+ || (!strncmp (name, "/usr/local/lib", 14))
144+ || (!strncmp (name, "/usr/X11R6/lib", 14))))
145+ {
146+ if (command_line.error_poison_system_directories)
147+ einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
148+ "cross-compilation\n"), name);
149+ else
150+ einfo (_("%P: warning: library search path \"%s\" is unsafe for "
151+ "cross-compilation\n"), name);
152+ }
153+#endif
154+
155 }
156
157 /* Try to open a BFD for a lang_input_statement. */
158Index: binutils-2.24/ld/ld.h
159===================================================================
160--- binutils-2.24.orig/ld/ld.h 2013-12-15 11:46:17.000000000 -0800
161+++ binutils-2.24/ld/ld.h 2013-12-15 11:46:59.813768989 -0800
162@@ -180,6 +180,14 @@
163 /* If TRUE we'll just print the default output on stdout. */
164 bfd_boolean print_output_format;
165
166+ /* If TRUE (the default) warn for uses of system directories when
167+ cross linking. */
168+ bfd_boolean poison_system_directories;
169+
170+ /* If TRUE (default FALSE) give an error for uses of system
171+ directories when cross linking instead of a warning. */
172+ bfd_boolean error_poison_system_directories;
173+
174 /* Big or little endian as set on command line. */
175 enum endian_enum endian;
176
177Index: binutils-2.24/ld/ldmain.c
178===================================================================
179--- binutils-2.24.orig/ld/ldmain.c 2013-12-15 11:46:17.000000000 -0800
180+++ binutils-2.24/ld/ldmain.c 2013-12-15 11:48:12.087101740 -0800
181@@ -266,6 +266,8 @@
182 command_line.warn_mismatch = TRUE;
183 command_line.warn_search_mismatch = TRUE;
184 command_line.check_section_addresses = -1;
185+ command_line.poison_system_directories = TRUE;
186+ command_line.error_poison_system_directories = FALSE;
187
188 /* We initialize DEMANGLING based on the environment variable
189 COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
190Index: binutils-2.24/ld/ld.texinfo
191===================================================================
192--- binutils-2.24.orig/ld/ld.texinfo 2013-12-15 11:46:17.000000000 -0800
193+++ binutils-2.24/ld/ld.texinfo 2013-12-15 11:46:59.813768989 -0800
194@@ -2175,6 +2175,18 @@
195
196 Passing @code{none} for @var{style} disables the setting from any
197 @code{--build-id} options earlier on the command line.
198+
199+@kindex --no-poison-system-directories
200+@item --no-poison-system-directories
201+Do not warn for @option{-L} options using system directories such as
202+@file{/usr/lib} when cross linking. This option is intended for use
203+in chroot environments when such directories contain the correct
204+libraries for the target system rather than the host.
205+
206+@kindex --error-poison-system-directories
207+@item --error-poison-system-directories
208+Give an error instead of a warning for @option{-L} options using
209+system directories when cross linking.
210 @end table
211
212 @c man end
213Index: binutils-2.24/ld/lexsup.c
214===================================================================
215--- binutils-2.24.orig/ld/lexsup.c 2013-12-15 11:46:17.000000000 -0800
216+++ binutils-2.24/ld/lexsup.c 2013-12-15 11:49:28.950434490 -0800
217@@ -507,6 +507,14 @@
218 OPTION_IGNORE_UNRESOLVED_SYMBOL},
219 '\0', N_("SYMBOL"),
220 N_("Unresolved SYMBOL will not cause an error or warning"), TWO_DASHES },
221+ { {"no-poison-system-directories", no_argument, NULL,
222+ OPTION_NO_POISON_SYSTEM_DIRECTORIES},
223+ '\0', NULL, N_("Do not warn for -L options using system directories"),
224+ TWO_DASHES },
225+ { {"error-poison-system-directories", no_argument, NULL,
226+ + OPTION_ERROR_POISON_SYSTEM_DIRECTORIES},
227+ '\0', NULL, N_("Give an error for -L options using system directories"),
228+ TWO_DASHES },
229 };
230
231 #define OPTION_COUNT ARRAY_SIZE (ld_options)
232@@ -1442,6 +1450,14 @@
233 einfo (_("%P%X: --hash-size needs a numeric argument\n"));
234 }
235 break;
236+
237+ case OPTION_NO_POISON_SYSTEM_DIRECTORIES:
238+ command_line.poison_system_directories = FALSE;
239+ break;
240+
241+ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
242+ command_line.error_poison_system_directories = TRUE;
243+ break;
244 }
245 }
246
247Index: binutils-2.24/ld/ldlex.h
248===================================================================
249--- binutils-2.24.orig/ld/ldlex.h 2013-12-15 11:46:17.000000000 -0800
250+++ binutils-2.24/ld/ldlex.h 2013-12-15 11:47:43.230435299 -0800
251@@ -138,6 +138,8 @@
252 OPTION_DEFAULT_SCRIPT,
253 OPTION_PRINT_OUTPUT_FORMAT,
254 OPTION_IGNORE_UNRESOLVED_SYMBOL,
255+ OPTION_NO_POISON_SYSTEM_DIRECTORIES,
256+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
257 };
258
259 /* The initial parser states. */
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-100-uclibc-conf.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-100-uclibc-conf.patch
new file mode 100644
index 0000000..b5a25c2
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-100-uclibc-conf.patch
@@ -0,0 +1,40 @@
1Upstream-Status: Pending
2
3Index: binutils-2.22/configure
4===================================================================
5--- binutils-2.22.orig/configure
6+++ binutils-2.22/configure
7@@ -3130,7 +3130,7 @@ case "${target}" in
8 ;;
9 s390-*-* | s390x-*-*)
10 ;;
11- sh-*-* | sh[34]*-*-*)
12+ sh*-*-* | sh[34]*-*-*)
13 ;;
14 sh64-*-* | sh5*-*-*)
15 ;;
16@@ -3570,7 +3570,7 @@ case "${target}" in
17 mips*-*-*)
18 noconfigdirs="$noconfigdirs gprof"
19 ;;
20- sh-*-* | sh64-*-*)
21+ sh*-*-* | sh64-*-*)
22 case "${target}" in
23 sh*-*-elf)
24 ;;
25Index: binutils-2.22/gprof/configure
26===================================================================
27--- binutils-2.22.orig/gprof/configure
28+++ binutils-2.22/gprof/configure
29@@ -6103,6 +6103,11 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
30 lt_cv_deplibs_check_method=pass_all
31 ;;
32
33+linux-uclibc*)
34+ lt_cv_deplibs_check_method=pass_all
35+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
36+ ;;
37+
38 netbsd*)
39 if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
40 lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-300-001_ld_makefile_patch.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-300-001_ld_makefile_patch.patch
new file mode 100644
index 0000000..c6e1efc
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-300-001_ld_makefile_patch.patch
@@ -0,0 +1,55 @@
1#!/bin/sh -e
2## 001_ld_makefile_patch.dpatch
3##
4## All lines beginning with `## DP:' are a description of the patch.
5## DP: Description: correct where ld scripts are installed
6## DP: Author: Chris Chimelis <chris@debian.org>
7## DP: Upstream status: N/A
8## DP: Date: ??
9
10if [ $# -ne 1 ]; then
11 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
12 exit 1
13fi
14
15[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
16patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
17
18case "$1" in
19 -patch) patch $patch_opts -p1 < $0;;
20 -unpatch) patch $patch_opts -p1 -R < $0;;
21 *)
22 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
23 exit 1;;
24esac
25
26exit 0
27Upstream-Status: Inappropriate [debian patch]
28
29@DPATCH@
30Index: binutils-2.22/ld/Makefile.am
31===================================================================
32--- binutils-2.22.orig/ld/Makefile.am
33+++ binutils-2.22/ld/Makefile.am
34@@ -37,7 +37,7 @@ endif
35 # We put the scripts in the directory $(scriptdir)/ldscripts.
36 # We can't put the scripts in $(datadir) because the SEARCH_DIR
37 # directives need to be different for native and cross linkers.
38-scriptdir = $(tooldir)/lib
39+scriptdir = $(libdir)
40
41 EMUL = @EMUL@
42 EMULATION_OFILES = @EMULATION_OFILES@
43Index: binutils-2.22/ld/Makefile.in
44===================================================================
45--- binutils-2.22.orig/ld/Makefile.in
46+++ binutils-2.22/ld/Makefile.in
47@@ -366,7 +366,7 @@ AM_CFLAGS = $(WARN_CFLAGS)
48 # We put the scripts in the directory $(scriptdir)/ldscripts.
49 # We can't put the scripts in $(datadir) because the SEARCH_DIR
50 # directives need to be different for native and cross linkers.
51-scriptdir = $(tooldir)/lib
52+scriptdir = $(libdir)
53 BASEDIR = $(srcdir)/..
54 BFDDIR = $(BASEDIR)/bfd
55 INCDIR = $(BASEDIR)/include
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-300-006_better_file_error.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-300-006_better_file_error.patch
new file mode 100644
index 0000000..47bd8ff
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-300-006_better_file_error.patch
@@ -0,0 +1,45 @@
1#!/bin/sh -e
2## 006_better_file_error.dpatch by David Kimdon <dwhedon@gordian.com>
3##
4## All lines beginning with `## DP:' are a description of the patch.
5## DP: Specify which filename is causing an error if the filename is a
6## DP: directory. (#45832)
7
8if [ $# -ne 1 ]; then
9 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
10 exit 1
11fi
12
13[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
14patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
15
16case "$1" in
17 -patch) patch $patch_opts -p1 < $0;;
18 -unpatch) patch $patch_opts -p1 -R < $0;;
19 *)
20 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
21 exit 1;;
22esac
23
24exit 0
25Upstream-Status: Inappropriate [debian patch]
26
27@DPATCH@
28Index: binutils-2.22/bfd/opncls.c
29===================================================================
30--- binutils-2.22.orig/bfd/opncls.c
31+++ binutils-2.22/bfd/opncls.c
32@@ -197,6 +197,13 @@ bfd_fopen (const char *filename, const c
33 {
34 bfd *nbfd;
35 const bfd_target *target_vec;
36+ struct stat s;
37+
38+ if (stat (filename, &s) == 0)
39+ if (S_ISDIR(s.st_mode)) {
40+ bfd_set_error (bfd_error_file_not_recognized);
41+ return NULL;
42+ }
43
44 nbfd = _bfd_new_bfd ();
45 if (nbfd == NULL)
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-300-012_check_ldrunpath_length.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-300-012_check_ldrunpath_length.patch
new file mode 100644
index 0000000..d31f80c
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-300-012_check_ldrunpath_length.patch
@@ -0,0 +1,49 @@
1#!/bin/sh -e
2## 012_check_ldrunpath_length.dpatch by Chris Chimelis <chris@debian.org>
3##
4## All lines beginning with `## DP:' are a description of the patch.
5## DP: Only generate an RPATH entry if LD_RUN_PATH is not empty, for
6## DP: cases where -rpath isn't specified. (#151024)
7
8if [ $# -ne 1 ]; then
9 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
10 exit 1
11fi
12
13[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
14patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
15
16case "$1" in
17 -patch) patch $patch_opts -p1 < $0;;
18 -unpatch) patch $patch_opts -p1 -R < $0;;
19 *)
20 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
21 exit 1;;
22esac
23
24exit 0
25Upstream-Status: Inappropriate [debian patch]
26
27@DPATCH@
28Index: binutils-2.22/ld/emultempl/elf32.em
29===================================================================
30--- binutils-2.22.orig/ld/emultempl/elf32.em
31+++ binutils-2.22/ld/emultempl/elf32.em
32@@ -1273,6 +1273,8 @@ fragment <<EOF
33 && command_line.rpath == NULL)
34 {
35 lib_path = (const char *) getenv ("LD_RUN_PATH");
36+ if ((lib_path) && (strlen (lib_path) == 0))
37+ lib_path = NULL;
38 if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
39 force))
40 break;
41@@ -1500,6 +1502,8 @@ gld${EMULATION_NAME}_before_allocation (
42 rpath = command_line.rpath;
43 if (rpath == NULL)
44 rpath = (const char *) getenv ("LD_RUN_PATH");
45+ if ((rpath) && (strlen (rpath) == 0))
46+ rpath = NULL;
47
48 for (abfd = link_info.input_bfds; abfd; abfd = abfd->link_next)
49 if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-gas-needs-libm.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-gas-needs-libm.patch
new file mode 100644
index 0000000..3869faf
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uclibc-gas-needs-libm.patch
@@ -0,0 +1,38 @@
1Source: Khem Raj <raj.khem@gmail.com>
2Disposition: submit upstream.
3Upstream-Status: Pending
4
5Description:
6
7We do not need to have the libtool patch anymore for binutils after
8libtool has been updated upstream it include support for it. However
9for building gas natively on uclibc systems we have to link it with
10-lm so that it picks up missing symbols.
11
12/local/build_area/BUILD/arm_v5t_le_uclibc/binutils-2.17.50/objdir/libiberty/pic/libiberty.a(floatformat.o): In function `floatformat_from_double':
13floatformat.c:(.text+0x1ec): undefined reference to `frexp'
14floatformat.c:(.text+0x2f8): undefined reference to `ldexp'
15/local/build_area/BUILD/arm_v5t_le_uclibc/binutils-2.17.50/objdir/libiberty/pic/libiberty.a(floatformat.o): In function `floatformat_to_double':
16floatformat.c:(.text+0x38a): undefined reference to `ldexp'
17floatformat.c:(.text+0x3d2): undefined reference to `ldexp'
18floatformat.c:(.text+0x43e): undefined reference to `ldexp' floatformat.c:(.text+0x4e2): undefined reference to `ldexp'
19collect2: ld returned 1 exit status
20make[4]: *** [as-new] Error 1
21
22Index: binutils-2.22/gas/configure.tgt
23===================================================================
24--- binutils-2.22.orig/gas/configure.tgt
25+++ binutils-2.22/gas/configure.tgt
26@@ -428,6 +428,12 @@ case ${generic_target} in
27 *-*-netware) fmt=elf em=netware ;;
28 esac
29
30+case ${generic_target} in
31+ arm-*-*uclibc*)
32+ need_libm=yes
33+ ;;
34+esac
35+
36 case ${cpu_type} in
37 alpha | arm | i386 | ia64 | microblaze | mips | ns32k | pdp11 | ppc | sparc | z80 | z8k)
38 bfd_gas=yes
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uninitialised-warning.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uninitialised-warning.patch
new file mode 100644
index 0000000..2feb80c
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-uninitialised-warning.patch
@@ -0,0 +1,50 @@
1From f9c316c4d75be236bbaa8464ef803ed2d3859d6d Mon Sep 17 00:00:00 2001
2From: H.J. Lu <hjl.tools@gmail.com>
3Date: Wed, 15 Jan 2014 07:43:19 -0800
4Subject: [PATCH 1/1] Silence uninitialized warning on ehdr_start_save
5
6Older GCC, like 4.1/4.2, will issue an uninitialized warning on
7ehdr_start_save. This patch silences by using
8
9struct bfd_link_hash_entry ehdr_start_save = ehdr_start_save;
10
11 * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation):
12 Silence uninitialized warning on ehdr_start_save with older
13 GCC.
14
15Upstream-Status: Backport
16---
17 ld/ChangeLog | 6 ++++++
18 ld/emultempl/elf32.em | 2 +-
19 2 files changed, 7 insertions(+), 1 deletions(-)
20
21#diff --git a/ld/ChangeLog b/ld/ChangeLog
22#index eaa6b93..91055de 100644
23#--- a/ld/ChangeLog
24#+++ b/ld/ChangeLog
25#@@ -1,3 +1,9 @@
26#+2014-01-15 H.J. Lu <hongjiu.lu@intel.com>
27#+
28#+ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation):
29#+ Silence uninitialized warning on ehdr_start_save with older
30#+ GCC.
31#+
32# 2014-01-15 Alan Modra <amodra@gmail.com>
33#
34# * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Define
35diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
36index 13f86f0..569c7f7 100644
37--- a/ld/emultempl/elf32.em
38+++ b/ld/emultempl/elf32.em
39@@ -1481,7 +1481,7 @@ gld${EMULATION_NAME}_before_allocation (void)
40 asection *sinterp;
41 bfd *abfd;
42 struct elf_link_hash_entry *ehdr_start = NULL;
43- struct bfd_link_hash_entry ehdr_start_save;
44+ struct bfd_link_hash_entry ehdr_start_save = ehdr_start_save;
45
46 if (is_elf_hash_table (link_info.hash))
47 {
48--
491.7.1
50
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-xlp-support.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-xlp-support.patch
new file mode 100644
index 0000000..a199918
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/binutils-xlp-support.patch
@@ -0,0 +1,402 @@
1Upstream-Status: Unknown
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4From 26adb06ce515aadfec08ce13109b4b98287f677b Mon Sep 17 00:00:00 2001
5From: Nebu Philips <nphilips@netlogicmicro.com>
6Date: Fri, 30 Jul 2010 15:10:03 -0700
7Subject: [PATCH] Add support for Netlogic XLP
8
9Using the mipsisa64r2nlm target, add support for XLP from
10Netlogic. Also, update vendor name to NLM wherever applicable.
11---
12 bfd/aoutx.h | 1 +
13 bfd/archures.c | 1 +
14 bfd/bfd-in2.h | 1 +
15 bfd/config.bfd | 5 +++++
16 bfd/cpu-mips.c | 6 ++++--
17 bfd/elfxx-mips.c | 8 ++++++++
18 binutils/readelf.c | 1 +
19 config.sub | 6 ++++++
20 gas/config/tc-mips.c | 7 ++++++-
21 gas/configure | 3 +++
22 gas/configure.tgt | 2 +-
23 gas/doc/c-mips.texi | 3 ++-
24 include/elf/mips.h | 1 +
25 include/opcode/mips.h | 6 +++++-
26 ld/configure.tgt | 2 ++
27 opcodes/mips-dis.c | 6 ++++++
28 opcodes/mips-opc.c | 31 ++++++++++++++++++++-----------
29 17 files changed, 73 insertions(+), 17 deletions(-)
30
31Index: binutils-2.24/bfd/aoutx.h
32===================================================================
33--- binutils-2.24.orig/bfd/aoutx.h 2013-12-15 13:07:57.180399300 -0800
34+++ binutils-2.24/bfd/aoutx.h 2013-12-15 13:08:03.397065919 -0800
35@@ -798,6 +798,7 @@
36 case bfd_mach_mipsisa64r2:
37 case bfd_mach_mips_sb1:
38 case bfd_mach_mips_xlr:
39+ case bfd_mach_mips_xlp:
40 /* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc. */
41 arch_flags = M_MIPS2;
42 break;
43Index: binutils-2.24/bfd/archures.c
44===================================================================
45--- binutils-2.24.orig/bfd/archures.c 2013-12-15 13:07:57.180399300 -0800
46+++ binutils-2.24/bfd/archures.c 2013-12-15 13:08:03.397065919 -0800
47@@ -178,6 +178,7 @@
48 .#define bfd_mach_mips_octeonp 6601
49 .#define bfd_mach_mips_octeon2 6502
50 .#define bfd_mach_mips_xlr 887682 {* decimal 'XLR' *}
51+.#define bfd_mach_mips_xlp 887680 {* decimal 'XLP' *}
52 .#define bfd_mach_mipsisa32 32
53 .#define bfd_mach_mipsisa32r2 33
54 .#define bfd_mach_mipsisa64 64
55Index: binutils-2.24/bfd/bfd-in2.h
56===================================================================
57--- binutils-2.24.orig/bfd/bfd-in2.h 2013-12-15 13:07:57.180399300 -0800
58+++ binutils-2.24/bfd/bfd-in2.h 2013-12-15 13:08:03.400399254 -0800
59@@ -1933,6 +1933,7 @@
60 #define bfd_mach_mips_octeonp 6601
61 #define bfd_mach_mips_octeon2 6502
62 #define bfd_mach_mips_xlr 887682 /* decimal 'XLR' */
63+#define bfd_mach_mips_xlp 887680 /* decimal 'XLP' */
64 #define bfd_mach_mipsisa32 32
65 #define bfd_mach_mipsisa32r2 33
66 #define bfd_mach_mipsisa64 64
67Index: binutils-2.24/bfd/config.bfd
68===================================================================
69--- binutils-2.24.orig/bfd/config.bfd 2013-12-15 13:08:03.047065922 -0800
70+++ binutils-2.24/bfd/config.bfd 2013-12-15 13:08:03.400399254 -0800
71@@ -1032,6 +1032,11 @@
72 targ_defvec=bfd_elf32_littlemips_vec
73 targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
74 ;;
75+ mipsisa64*-*-elf*)
76+ targ_defvec=bfd_elf32_tradbigmips_vec
77+ targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
78+ want64=true
79+ ;;
80 mips*-*-elf* | mips*-*-rtems* | mips*-*-vxworks | mips*-*-windiss)
81 targ_defvec=bfd_elf32_bigmips_vec
82 targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
83Index: binutils-2.24/bfd/cpu-mips.c
84===================================================================
85--- binutils-2.24.orig/bfd/cpu-mips.c 2013-12-15 13:07:57.180399300 -0800
86+++ binutils-2.24/bfd/cpu-mips.c 2013-12-15 13:08:03.400399254 -0800
87@@ -99,7 +99,8 @@
88 I_mipsocteonp,
89 I_mipsocteon2,
90 I_xlr,
91- I_micromips
92+ I_micromips,
93+ I_xlp
94 };
95
96 #define NN(index) (&arch_info_struct[(index) + 1])
97@@ -143,7 +144,8 @@
98 N (64, 64, bfd_mach_mips_octeonp,"mips:octeon+", FALSE, NN(I_mipsocteonp)),
99 N (64, 64, bfd_mach_mips_octeon2,"mips:octeon2", FALSE, NN(I_mipsocteon2)),
100 N (64, 64, bfd_mach_mips_xlr, "mips:xlr", FALSE, NN(I_xlr)),
101- N (64, 64, bfd_mach_mips_micromips,"mips:micromips",FALSE,0)
102+ N (64, 64, bfd_mach_mips_micromips,"mips:micromips",FALSE,NN(I_micromips)),
103+ N (64, 64, bfd_mach_mips_xlp, "mips:xlp", FALSE, 0)
104 };
105
106 /* The default architecture is mips:3000, but with a machine number of
107Index: binutils-2.24/bfd/elfxx-mips.c
108===================================================================
109--- binutils-2.24.orig/bfd/elfxx-mips.c 2013-12-15 13:07:57.180399300 -0800
110+++ binutils-2.24/bfd/elfxx-mips.c 2013-12-15 13:08:03.400399254 -0800
111@@ -6404,6 +6404,9 @@
112 case E_MIPS_MACH_XLR:
113 return bfd_mach_mips_xlr;
114
115+ case E_MIPS_MACH_XLP:
116+ return bfd_mach_mips_xlp;
117+
118 default:
119 switch (flags & EF_MIPS_ARCH)
120 {
121@@ -11622,6 +11625,10 @@
122 val = E_MIPS_ARCH_64R2 | E_MIPS_MACH_OCTEON2;
123 break;
124
125+ case bfd_mach_mips_xlp:
126+ val = E_MIPS_ARCH_64R2 | E_MIPS_MACH_XLP;
127+ break;
128+
129 case bfd_mach_mipsisa32:
130 val = E_MIPS_ARCH_32;
131 break;
132@@ -14202,6 +14209,7 @@
133 { bfd_mach_mips_octeon2, bfd_mach_mips_octeonp },
134 { bfd_mach_mips_octeonp, bfd_mach_mips_octeon },
135 { bfd_mach_mips_octeon, bfd_mach_mipsisa64r2 },
136+ { bfd_mach_mips_xlp, bfd_mach_mipsisa64r2 },
137
138 /* MIPS64 extensions. */
139 { bfd_mach_mipsisa64r2, bfd_mach_mipsisa64 },
140Index: binutils-2.24/binutils/readelf.c
141===================================================================
142--- binutils-2.24.orig/binutils/readelf.c 2013-12-15 13:07:57.180399300 -0800
143+++ binutils-2.24/binutils/readelf.c 2013-12-15 13:08:03.403732587 -0800
144@@ -2602,6 +2602,7 @@
145 case E_MIPS_MACH_OCTEON: strcat (buf, ", octeon"); break;
146 case E_MIPS_MACH_OCTEON2: strcat (buf, ", octeon2"); break;
147 case E_MIPS_MACH_XLR: strcat (buf, ", xlr"); break;
148+ case E_MIPS_MACH_XLP: strcat (buf, ", xlp"); break;
149 case 0:
150 /* We simply ignore the field in this case to avoid confusion:
151 MIPS ELF does not specify EF_MIPS_MACH, it is a GNU
152Index: binutils-2.24/gas/config/tc-mips.c
153===================================================================
154--- binutils-2.24.orig/gas/config/tc-mips.c 2013-12-15 13:07:57.180399300 -0800
155+++ binutils-2.24/gas/config/tc-mips.c 2013-12-15 13:17:19.943728439 -0800
156@@ -486,6 +486,7 @@
157 || mips_opts.arch == CPU_RM7000 \
158 || mips_opts.arch == CPU_VR5500 \
159 || mips_opts.micromips \
160+ || mips_opts.arch == CPU_XLP \
161 )
162
163 /* Whether the processor uses hardware interlocks to protect reads
164@@ -515,6 +516,7 @@
165 && mips_opts.isa != ISA_MIPS3) \
166 || mips_opts.arch == CPU_R4300 \
167 || mips_opts.micromips \
168+ || mips_opts.arch == CPU_XLP \
169 )
170
171 /* Whether the processor uses hardware interlocks to protect reads
172@@ -17794,7 +17796,7 @@
173 /* Broadcom XLP.
174 XLP is mostly like XLR, with the prominent exception that it is
175 MIPS64R2 rather than MIPS64. */
176- { "xlp", 0, 0, ISA_MIPS64R2, CPU_XLR },
177+ { "xlp", 0, 0, ISA_MIPS64R2, CPU_XLP },
178
179 /* End marker */
180 { NULL, 0, 0, 0, 0 }
181Index: binutils-2.24/gas/configure
182===================================================================
183--- binutils-2.24.orig/gas/configure 2013-12-15 13:08:01.127065936 -0800
184+++ binutils-2.24/gas/configure 2013-12-15 13:08:03.407065920 -0800
185@@ -12697,6 +12697,9 @@
186 mipsisa64r2 | mipsisa64r2el)
187 mips_cpu=mips64r2
188 ;;
189+ mipsisa64r2nlm | mipsisa64r2nlmel)
190+ mips_cpu=xlp
191+ ;;
192 mipstx39 | mipstx39el)
193 mips_cpu=r3900
194 ;;
195Index: binutils-2.24/gas/configure.tgt
196===================================================================
197--- binutils-2.24.orig/gas/configure.tgt 2013-12-15 13:08:00.783732605 -0800
198+++ binutils-2.24/gas/configure.tgt 2013-12-15 13:08:03.407065920 -0800
199@@ -325,7 +325,7 @@
200 fmt=elf em=freebsd ;;
201 mips-*-sysv4*MP* | mips-*-gnu*) fmt=elf em=tmips ;;
202 mips*-sde-elf* | mips*-mti-elf*) fmt=elf em=tmips ;;
203- mips-*-elf* | mips-*-rtems*) fmt=elf ;;
204+ mips-*-elf* | mips-*-rtems*) fmt=elf em=tmips ;;
205 mips-*-netbsd*) fmt=elf em=tmips ;;
206 mips-*-openbsd*) fmt=elf em=tmips ;;
207
208Index: binutils-2.24/include/elf/mips.h
209===================================================================
210--- binutils-2.24.orig/include/elf/mips.h 2013-12-15 13:07:57.180399300 -0800
211+++ binutils-2.24/include/elf/mips.h 2013-12-15 13:08:03.407065920 -0800
212@@ -274,6 +274,7 @@
213 #define E_MIPS_MACH_SB1 0x008a0000
214 #define E_MIPS_MACH_OCTEON 0x008b0000
215 #define E_MIPS_MACH_XLR 0x008c0000
216+#define E_MIPS_MACH_XLP 0x008e0000
217 #define E_MIPS_MACH_OCTEON2 0x008d0000
218 #define E_MIPS_MACH_5400 0x00910000
219 #define E_MIPS_MACH_5900 0x00920000
220Index: binutils-2.24/include/opcode/mips.h
221===================================================================
222--- binutils-2.24.orig/include/opcode/mips.h 2013-12-15 13:07:57.180399300 -0800
223+++ binutils-2.24/include/opcode/mips.h 2013-12-15 13:40:11.130384844 -0800
224@@ -1092,8 +1092,10 @@
225 #define INSN_LOONGSON_2F 0x80000000
226 /* Loongson 3A. */
227 #define INSN_LOONGSON_3A 0x00000400
228-/* RMI Xlr instruction */
229-#define INSN_XLR 0x00000020
230+/* Netlogic Xlr instruction */
231+#define INSN_XLR 0x00000020
232+/* Netlogic XlP instruction */
233+#define INSN_XLP 0x00000040
234
235 /* DSP ASE */
236 #define ASE_DSP 0x00000001
237@@ -1172,6 +1174,7 @@
238 #define CPU_OCTEONP 6601
239 #define CPU_OCTEON2 6502
240 #define CPU_XLR 887682 /* decimal 'XLR' */
241+#define CPU_XLP 887680 /* decimal 'XLP' */
242
243 /* Return true if the given CPU is included in INSN_* mask MASK. */
244
245@@ -1239,6 +1242,9 @@
246 case CPU_XLR:
247 return (mask & INSN_XLR) != 0;
248
249+ case CPU_XLP:
250+ return (mask & INSN_XLP) != 0;
251+
252 default:
253 return FALSE;
254 }
255Index: binutils-2.24/ld/configure.tgt
256===================================================================
257--- binutils-2.24.orig/ld/configure.tgt 2013-12-15 13:08:03.047065922 -0800
258+++ binutils-2.24/ld/configure.tgt 2013-12-15 13:08:03.407065920 -0800
259@@ -457,6 +457,8 @@
260 mips*-sde-elf* | mips*-mti-elf*)
261 targ_emul=elf32btsmip
262 targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip" ;;
263+mipsisa64*-*-elf*) targ_emul=elf32btsmip
264+ targ_extra_emuls="elf32ltsmip elf64btsmip elf64ltsmip" ;;
265 mips64*el-ps2-elf*) targ_emul=elf32lr5900n32
266 targ_extra_emuls="elf32lr5900"
267 targ_extra_libpath=$targ_extra_emuls ;;
268Index: binutils-2.24/opcodes/mips-dis.c
269===================================================================
270--- binutils-2.24.orig/opcodes/mips-dis.c 2013-12-15 13:07:57.180399300 -0800
271+++ binutils-2.24/opcodes/mips-dis.c 2013-12-15 13:39:50.243718329 -0800
272@@ -554,13 +554,11 @@
273 mips_cp0sel_names_xlr, ARRAY_SIZE (mips_cp0sel_names_xlr),
274 mips_hwr_names_numeric },
275
276- /* XLP is mostly like XLR, with the prominent exception it is being
277- MIPS64R2. */
278- { "xlp", 1, bfd_mach_mips_xlr, CPU_XLR,
279- ISA_MIPS64R2 | INSN_XLR, 0,
280- mips_cp0_names_xlr,
281- mips_cp0sel_names_xlr, ARRAY_SIZE (mips_cp0sel_names_xlr),
282- mips_hwr_names_numeric },
283+ { "xlp", 1, bfd_mach_mips_xlp, CPU_XLP,
284+ ISA_MIPS64R2 | INSN_XLP, 0,
285+ mips_cp0_names_mips3264r2,
286+ mips_cp0sel_names_mips3264r2, ARRAY_SIZE (mips_cp0sel_names_mips3264r2),
287+ mips_hwr_names_mips3264r2 },
288
289 /* This entry, mips16, is here only for ISA/processor selection; do
290 not print its name. */
291Index: binutils-2.24/opcodes/mips-opc.c
292===================================================================
293--- binutils-2.24.orig/opcodes/mips-opc.c 2013-12-15 13:07:57.180399300 -0800
294+++ binutils-2.24/opcodes/mips-opc.c 2013-12-15 13:27:30.573724118 -0800
295@@ -262,7 +262,8 @@
296 #define IOCT (INSN_OCTEON | INSN_OCTEONP | INSN_OCTEON2)
297 #define IOCTP (INSN_OCTEONP | INSN_OCTEON2)
298 #define IOCT2 INSN_OCTEON2
299-#define XLR INSN_XLR
300+#define XLR INSN_XLR
301+#define XLP INSN_XLP
302 #define IVIRT ASE_VIRT
303 #define IVIRT64 ASE_VIRT64
304
305@@ -881,6 +882,7 @@
306 {"cins", "t,r,+p,+S", 0x70000032, 0xfc00003f, WR_1|RD_2, 0, IOCT, 0, 0 },
307 {"clo", "U,s", 0x70000021, 0xfc0007ff, WR_1|RD_2, 0, I32|N55, 0, 0 },
308 {"clz", "U,s", 0x70000020, 0xfc0007ff, WR_1|RD_2, 0, I32|N55, 0, 0 },
309+{"crc", "d,s,t", 0x7000001c, 0xfc0007ff, WR_1|RD_2|RD_3, 0, XLP, 0, 0 },
310 {"ctc0", "t,G", 0x40c00000, 0xffe007ff, RD_1|WR_CC|COD, 0, I1, 0, IOCT|IOCTP|IOCT2 },
311 {"ctc1", "t,G", 0x44c00000, 0xffe007ff, RD_1|WR_CC|COD|FP_S, 0, I1, 0, 0 },
312 {"ctc1", "t,S", 0x44c00000, 0xffe007ff, RD_1|WR_CC|COD|FP_S, 0, I1, 0, 0 },
313@@ -913,10 +915,11 @@
314 {"daddiu", "t,r,j", 0x64000000, 0xfc000000, WR_1|RD_2, 0, I3, 0, 0 },
315 {"daddu", "d,v,t", 0x0000002d, 0xfc0007ff, WR_1|RD_2|RD_3, 0, I3, 0, 0 },
316 {"daddu", "t,r,I", 0, (int) M_DADDU_I, INSN_MACRO, 0, I3, 0, 0 },
317-{"daddwc", "d,s,t", 0x70000038, 0xfc0007ff, WR_1|RD_2|RD_3|WR_C0|RD_C0, 0, XLR, 0, 0 },
318+{"daddwc", "d,s,t", 0x70000038, 0xfc0007ff, WR_1|RD_2|RD_3|WR_C0|RD_C0, 0, XLR|XLP, 0, 0 },
319 {"dbreak", "", 0x7000003f, 0xffffffff, 0, 0, N5, 0, 0 },
320 {"dclo", "U,s", 0x70000025, 0xfc0007ff, WR_1|RD_2, 0, I64|N55, 0, 0 },
321 {"dclz", "U,s", 0x70000024, 0xfc0007ff, WR_1|RD_2, 0, I64|N55, 0, 0 },
322+{"dcrc", "d,s,t", 0x7000001d, 0xfc0007ff, WR_1|RD_2|RD_3, 0, XLP, 0, 0 },
323 /* dctr and dctw are used on the r5000. */
324 {"dctr", "o(b)", 0xbc050000, 0xfc1f0000, RD_2, 0, I3, 0, 0 },
325 {"dctw", "o(b)", 0xbc090000, 0xfc1f0000, RD_2, 0, I3, 0, 0 },
326@@ -980,6 +983,7 @@
327 {"dmfc0", "t,G,H", 0x40200000, 0xffe007f8, WR_1|RD_C0|LCD, 0, I64, 0, 0 },
328 {"dmfgc0", "t,G", 0x40600100, 0xffe007ff, WR_1|RD_C0|LCD, 0, 0, IVIRT64, 0 },
329 {"dmfgc0", "t,G,H", 0x40600100, 0xffe007f8, WR_1|RD_C0|LCD, 0, 0, IVIRT64, 0 },
330+{"dmfur", "t,d", 0x7000001e, 0xffe007ff, WR_1, 0, XLP, 0, 0 },
331 {"dmt", "", 0x41600bc1, 0xffffffff, TRAP, 0, 0, MT32, 0 },
332 {"dmt", "t", 0x41600bc1, 0xffe0ffff, WR_1|TRAP, 0, 0, MT32, 0 },
333 {"dmtc0", "t,G", 0x40a00000, 0xffe007ff, RD_1|WR_C0|WR_CC|COD, 0, I3, 0, EE },
334@@ -994,6 +998,8 @@
335 /* dmtc2 is at the bottom of the table. */
336 /* dmfc3 is at the bottom of the table. */
337 /* dmtc3 is at the bottom of the table. */
338+{"dmtur", "t,d", 0x7000001f, 0xffe007ff, RD_1, 0, XLP, 0, 0 },
339+{"dmul", "d,s,t", 0x70000006, 0xfc0007ff, WR_1|RD_2|RD_3, 0, XLP, 0, 0 },
340 {"dmul", "d,v,t", 0x70000003, 0xfc0007ff, WR_1|RD_2|RD_3|WR_HILO, 0, IOCT, 0, 0 },
341 {"dmul", "d,v,t", 0, (int) M_DMUL, INSN_MACRO, 0, I3, 0, M32 },
342 {"dmul", "d,v,I", 0, (int) M_DMUL_I, INSN_MACRO, 0, I3, 0, M32 },
343@@ -1134,9 +1140,9 @@
344 /* The macro has to be first to handle o32 correctly. */
345 {"ld", "t,A(b)", 0, (int) M_LD_AB, INSN_MACRO, 0, I1, 0, 0 },
346 {"ld", "t,o(b)", 0xdc000000, 0xfc000000, WR_1|RD_3, 0, I3, 0, 0 },
347-{"ldaddw", "t,b", 0x70000010, 0xfc00ffff, MOD_1|RD_2|SM, 0, XLR, 0, 0 },
348-{"ldaddwu", "t,b", 0x70000011, 0xfc00ffff, MOD_1|RD_2|SM, 0, XLR, 0, 0 },
349-{"ldaddd", "t,b", 0x70000012, 0xfc00ffff, MOD_1|RD_2|SM, 0, XLR, 0, 0 },
350+{"ldaddw", "t,b", 0x70000010, 0xfc00ffff, MOD_1|RD_2|SM, 0, XLR|XLP, 0, 0 },
351+{"ldaddwu", "t,b", 0x70000011, 0xfc00ffff, MOD_1|RD_2|SM, 0, XLR|XLP, 0, 0 },
352+{"ldaddd", "t,b", 0x70000012, 0xfc00ffff, MOD_1|RD_2|SM, 0, XLR|XLP, 0, 0 },
353 {"ldc1", "T,o(b)", 0xd4000000, 0xfc000000, WR_1|RD_3|CLD|FP_D, 0, I2, 0, SF },
354 {"ldc1", "E,o(b)", 0xd4000000, 0xfc000000, WR_1|RD_3|CLD|FP_D, 0, I2, 0, SF },
355 {"ldc1", "T,A(b)", 0, (int) M_LDC1_AB, INSN_MACRO, INSN2_M_FP_D, I2, 0, SF },
356@@ -1288,7 +1294,7 @@
357 {"mflo", "d,9", 0x00000012, 0xff9f07ff, WR_1|RD_LO, 0, 0, D32, 0 },
358 {"mflo1", "d", 0x70000012, 0xffff07ff, WR_1|RD_LO, 0, EE, 0, 0 },
359 {"mflhxu", "d", 0x00000052, 0xffff07ff, WR_1|MOD_HILO, 0, 0, SMT, 0 },
360-{"mfcr", "t,s", 0x70000018, 0xfc00ffff, WR_1, 0, XLR, 0, 0 },
361+{"mfcr", "t,s", 0x70000018, 0xfc00ffff, WR_1, 0, XLR|XLP, 0, 0 },
362 {"mfsa", "d", 0x00000028, 0xffff07ff, WR_1, 0, EE, 0, 0 },
363 {"min.ob", "X,Y,Q", 0x78000006, 0xfc20003f, WR_1|RD_2|RD_3|FP_D, 0, SB1, MX, 0 },
364 {"min.ob", "D,S,Q", 0x48000006, 0xfc20003f, WR_1|RD_2|RD_3|FP_D, 0, N54, 0, 0 },
365@@ -1332,10 +1338,13 @@
366 /* move is at the top of the table. */
367 {"msgn.qh", "X,Y,Q", 0x78200000, 0xfc20003f, WR_1|RD_2|RD_3|FP_D, 0, 0, MX, 0 },
368 {"msgsnd", "t", 0, (int) M_MSGSND, INSN_MACRO, 0, XLR, 0, 0 },
369+{"msgsnds", "d,t", 0x4a000001, 0xffe007ff, WR_1|RD_2|RD_C0|WR_C0, 0, XLP, 0, 0 },
370 {"msgld", "", 0, (int) M_MSGLD, INSN_MACRO, 0, XLR, 0, 0 },
371 {"msgld", "t", 0, (int) M_MSGLD_T, INSN_MACRO, 0, XLR, 0, 0 },
372-{"msgwait", "", 0, (int) M_MSGWAIT, INSN_MACRO, 0, XLR, 0, 0 },
373-{"msgwait", "t", 0, (int) M_MSGWAIT_T,INSN_MACRO, 0, XLR, 0, 0 },
374+{"msglds", "d,t", 0x4a000002, 0xffe007ff, WR_1|RD_2|RD_C0|WR_C0, 0, XLP, 0, 0 },
375+{"msgwait", "", 0, (int) M_MSGWAIT, INSN_MACRO, 0, XLR|XLP, 0, 0 },
376+{"msgwait", "t", 0, (int) M_MSGWAIT_T,INSN_MACRO, 0, XLR|XLP, 0, 0 },
377+{"msgsync", "", 0x4a000004, 0xffffffff,0, 0, XLP, 0, 0 },
378 {"msub.d", "D,R,S,T", 0x4c000029, 0xfc00003f, WR_1|RD_2|RD_3|RD_4|FP_D, 0, I4_33, 0, 0 },
379 {"msub.d", "D,S,T", 0x46200019, 0xffe0003f, WR_1|RD_2|RD_3|FP_D, 0, IL2E, 0, 0 },
380 {"msub.d", "D,S,T", 0x72200019, 0xffe0003f, WR_1|RD_2|RD_3|FP_D, 0, IL2F, 0, 0 },
381@@ -1381,7 +1390,7 @@
382 {"mtlo", "s,7", 0x00000013, 0xfc1fe7ff, RD_1|WR_LO, 0, 0, D32, 0 },
383 {"mtlo1", "s", 0x70000013, 0xfc1fffff, RD_1|WR_LO, 0, EE, 0, 0 },
384 {"mtlhx", "s", 0x00000053, 0xfc1fffff, RD_1|MOD_HILO, 0, 0, SMT, 0 },
385-{"mtcr", "t,s", 0x70000019, 0xfc00ffff, RD_1, 0, XLR, 0, 0 },
386+{"mtcr", "t,s", 0x70000019, 0xfc00ffff, RD_1, 0, XLR|XLP, 0, 0 },
387 {"mtm0", "s", 0x70000008, 0xfc1fffff, RD_1, 0, IOCT, 0, 0 },
388 {"mtm1", "s", 0x7000000c, 0xfc1fffff, RD_1, 0, IOCT, 0, 0 },
389 {"mtm2", "s", 0x7000000d, 0xfc1fffff, RD_1, 0, IOCT, 0, 0 },
390@@ -1802,9 +1811,9 @@
391 {"suxc1", "S,t(b)", 0x4c00000d, 0xfc0007ff, RD_1|RD_2|RD_3|SM|FP_D, 0, I5_33|N55, 0, 0},
392 {"sw", "t,o(b)", 0xac000000, 0xfc000000, RD_1|RD_3|SM, 0, I1, 0, 0 },
393 {"sw", "t,A(b)", 0, (int) M_SW_AB, INSN_MACRO, 0, I1, 0, 0 },
394-{"swapw", "t,b", 0x70000014, 0xfc00ffff, MOD_1|RD_2|SM, 0, XLR, 0, 0 },
395-{"swapwu", "t,b", 0x70000015, 0xfc00ffff, MOD_1|RD_2|SM, 0, XLR, 0, 0 },
396-{"swapd", "t,b", 0x70000016, 0xfc00ffff, MOD_1|RD_2|SM, 0, XLR, 0, 0 },
397+{"swapw", "t,b", 0x70000014, 0xfc00ffff, MOD_1|RD_2|SM, 0, XLR|XLP, 0, 0 },
398+{"swapwu", "t,b", 0x70000015, 0xfc00ffff, MOD_1|RD_2|SM, 0, XLR|XLP, 0, 0 },
399+{"swapd", "t,b", 0x70000016, 0xfc00ffff, MOD_1|RD_2|SM, 0, XLR|XLP, 0, 0 },
400 {"swc0", "E,o(b)", 0xe0000000, 0xfc000000, RD_3|RD_C0|SM, 0, I1, 0, IOCT|IOCTP|IOCT2 },
401 {"swc0", "E,A(b)", 0, (int) M_SWC0_AB, INSN_MACRO, 0, I1, 0, IOCT|IOCTP|IOCT2 },
402 {"swc1", "T,o(b)", 0xe4000000, 0xfc000000, RD_1|RD_3|SM|FP_S, 0, I1, 0, 0 },
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/fix-pr15815.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/fix-pr15815.patch
new file mode 100644
index 0000000..9f53f41
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/fix-pr15815.patch
@@ -0,0 +1,36 @@
1This patch fixes the problem where libiberty is not installed in spite of
2asking it via --enable-install-libiberty, the problem is that target_header_dir
3is reset explicitly which means libiberty.a will never get installed
4
5also check
6
7https://sourceware.org/bugzilla/show_bug.cgi?id=15815
8
9Upstream-Status: Pending
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13Index: binutils-2.24/libiberty/configure
14===================================================================
15--- binutils-2.24.orig/libiberty/configure 2013-12-16 00:08:09.280103157 -0800
16+++ binutils-2.24/libiberty/configure 2013-12-16 00:08:29.753436339 -0800
17@@ -5507,7 +5507,6 @@
18
19 setobjs=
20 CHECK=
21-target_header_dir=
22 if test -n "${with_target_subdir}"; then
23
24 # We are being configured as a target library. AC_REPLACE_FUNCS
25Index: binutils-2.24/libiberty/configure.ac
26===================================================================
27--- binutils-2.24.orig/libiberty/configure.ac 2013-11-08 02:13:49.000000000 -0800
28+++ binutils-2.24/libiberty/configure.ac 2013-12-16 00:07:45.133436672 -0800
29@@ -405,7 +405,6 @@
30
31 setobjs=
32 CHECK=
33-target_header_dir=
34 if test -n "${with_target_subdir}"; then
35
36 # We are being configured as a target library. AC_REPLACE_FUNCS
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/fix-pr16428.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/fix-pr16428.patch
new file mode 100644
index 0000000..4584748
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/fix-pr16428.patch
@@ -0,0 +1,123 @@
1commit 4199e3b8669d0a36448687850374fdc2ad7240b6
2Author: Alan Modra <amodra@gmail.com>
3Date: Wed Jan 15 21:50:55 2014 +1030
4
5 non-PIC references to __ehdr_start in pie and shared
6
7 Rather than hacking every backend to not discard dynamic relocations
8 against an undefined hidden __ehdr_start, make it appear to be defined
9 early. We want __ehdr_start hidden before size_dynamic_sections so
10 that it isn't put in .dynsym, but we do need the dynamic relocations
11 for a PIE or shared library with a non-PIC reference. Defining it
12 early is wrong if we don't actually define the symbol later to its
13 proper value. (In some cases we want to leave the symbol undefined,
14 for example, when the ELF header isn't loaded, and we don't have this
15 infomation available in before_allocation.)
16
17 ld/
18 * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Define
19 __ehdr_start before size_dynamic_sections and restore afterwards.
20 ld/testsuite/
21 * ld-elf/ehdr_start-shared.d: New.
22 * ld-elf/ehdr_start-userdef.d: xfail frv.
23 * ld-elf/ehdr_start-weak.d: Likewise.
24 * ld-elf/ehdr_start.d: Likewise.
25
26Upstream-Status: Backport
27
28diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
29index 9a2fe89..13f86f0 100644
30--- a/ld/emultempl/elf32.em
31+++ b/ld/emultempl/elf32.em
32@@ -1480,6 +1480,8 @@ gld${EMULATION_NAME}_before_allocation (void)
33 const char *rpath;
34 asection *sinterp;
35 bfd *abfd;
36+ struct elf_link_hash_entry *ehdr_start = NULL;
37+ struct bfd_link_hash_entry ehdr_start_save;
38
39 if (is_elf_hash_table (link_info.hash))
40 {
41@@ -1504,6 +1506,16 @@ gld${EMULATION_NAME}_before_allocation (void)
42 _bfd_elf_link_hash_hide_symbol (&link_info, h, TRUE);
43 if (ELF_ST_VISIBILITY (h->other) != STV_INTERNAL)
44 h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
45+ /* Don't leave the symbol undefined. Undefined hidden
46+ symbols typically won't have dynamic relocations, but
47+ we most likely will need dynamic relocations for
48+ __ehdr_start if we are building a PIE or shared
49+ library. */
50+ ehdr_start = h;
51+ ehdr_start_save = h->root;
52+ h->root.type = bfd_link_hash_defined;
53+ h->root.u.def.section = bfd_abs_section_ptr;
54+ h->root.u.def.value = 0;
55 }
56 }
57
58@@ -1620,6 +1632,14 @@ ${ELF_INTERPRETER_SET_DEFAULT}
59
60 if (!bfd_elf_size_dynsym_hash_dynstr (link_info.output_bfd, &link_info))
61 einfo ("%P%F: failed to set dynamic section sizes: %E\n");
62+
63+ if (ehdr_start != NULL)
64+ {
65+ /* If we twiddled __ehdr_start to defined earlier, put it back
66+ as it was. */
67+ ehdr_start->root.type = ehdr_start_save.type;
68+ ehdr_start->root.u = ehdr_start_save.u;
69+ }
70 }
71
72 EOF
73diff --git a/ld/testsuite/ld-elf/ehdr_start-shared.d b/ld/testsuite/ld-elf/ehdr_start-shared.d
74new file mode 100644
75index 0000000..c17516a
76--- /dev/null
77+++ b/ld/testsuite/ld-elf/ehdr_start-shared.d
78@@ -0,0 +1,9 @@
79+#source: ehdr_start.s
80+#ld: -e _start -shared
81+#nm: -n
82+#target: *-*-linux* *-*-gnu* *-*-nacl*
83+#xfail: cris*-*-* frv-*-*
84+
85+#...
86+[0-9a-f]*000 [Adrt] __ehdr_start
87+#pass
88diff --git a/ld/testsuite/ld-elf/ehdr_start-userdef.d b/ld/testsuite/ld-elf/ehdr_start-userdef.d
89index 2a88e98..b58ae3f 100644
90--- a/ld/testsuite/ld-elf/ehdr_start-userdef.d
91+++ b/ld/testsuite/ld-elf/ehdr_start-userdef.d
92@@ -2,6 +2,7 @@
93 #ld: -e _start -T ehdr_start-userdef.t
94 #readelf: -Ws
95 #target: *-*-linux* *-*-gnu* *-*-nacl*
96+#xfail: frv-*-*
97
98 #...
99 Symbol table '\.symtab' contains [0-9]+ entries:
100diff --git a/ld/testsuite/ld-elf/ehdr_start-weak.d b/ld/testsuite/ld-elf/ehdr_start-weak.d
101index 8bd9035..24ae34c 100644
102--- a/ld/testsuite/ld-elf/ehdr_start-weak.d
103+++ b/ld/testsuite/ld-elf/ehdr_start-weak.d
104@@ -2,6 +2,7 @@
105 #ld: -e _start -T ehdr_start-missing.t
106 #nm: -n
107 #target: *-*-linux* *-*-gnu* *-*-nacl*
108+#xfail: frv-*-*
109
110 #...
111 \s+[wU] __ehdr_start
112diff --git a/ld/testsuite/ld-elf/ehdr_start.d b/ld/testsuite/ld-elf/ehdr_start.d
113index 52e5b54..d538b66 100644
114--- a/ld/testsuite/ld-elf/ehdr_start.d
115+++ b/ld/testsuite/ld-elf/ehdr_start.d
116@@ -2,6 +2,7 @@
117 #ld: -e _start
118 #nm: -n
119 #target: *-*-linux* *-*-gnu* *-*-nacl*
120+#xfail: frv-*-*
121
122 #...
123 [0-9a-f]*000 [Adrt] __ehdr_start
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/fix-pr16476.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/fix-pr16476.patch
new file mode 100644
index 0000000..65d62bc
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/fix-pr16476.patch
@@ -0,0 +1,220 @@
1From: H.J. Lu <hjl.tools@gmail.com>
2Date: Tue, 21 Jan 2014 23:42:43 +0000 (-0800)
3Subject: Check incompatible existing default symbol definition
4X-Git-Tag: hjl/linux/release/2.24.51.0.3~1^2~8^2~16
5X-Git-Url: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff_plain;h=4584ec12076e088cf36965b88ef8710ca85491f9
6
7Check incompatible existing default symbol definition
8
9After resolving a versioned reference, foo@VER1, to a default versioned
10definition, foo@@VER1, from a shared object, we also merge it with
11the existing regular default symbol definition, foo. When foo is IFUNC
12and foo@@VER1 aren't, we will merge 2 incompatible definitions. This
13patch avoids merging foo@@VER1 definition with foo definition if
14one is IFUNC and the other isn't.
15
16Upstream-Status: Backport
17---
18
19#diff --git a/bfd/ChangeLog b/bfd/ChangeLog
20#index 5923bc3..c70a7db 100644
21#--- a/bfd/ChangeLog
22#+++ b/bfd/ChangeLog
23#@@ -1,5 +1,13 @@
24# 2014-01-21 H.J. Lu <hongjiu.lu@intel.com>
25#
26#+ PR ld/16467
27#+ * elflink.c (_bfd_elf_merge_symbol): When types of the existing
28#+ regular default symbol definition and the versioned dynamic
29#+ symbol definition mismatch, skip the default symbol definition
30#+ if one of them is IFUNC.
31#+
32#+2014-01-21 H.J. Lu <hongjiu.lu@intel.com>
33#+
34# PR ld/2404
35# * elflink.c (_bfd_elf_merge_symbol): Don't check info->shared,
36# info->export_dynamic nor h->ref_dynamic for type mismatch when
37diff --git a/bfd/elflink.c b/bfd/elflink.c
38index d0006da..792e14e 100644
39--- a/bfd/elflink.c
40+++ b/bfd/elflink.c
41@@ -1092,11 +1092,14 @@ _bfd_elf_merge_symbol (bfd *abfd,
42 && newdyn
43 && newdef
44 && !olddyn
45- && (olddef || h->root.type == bfd_link_hash_common)
46- && ELF_ST_TYPE (sym->st_info) != h->type
47- && ELF_ST_TYPE (sym->st_info) != STT_NOTYPE
48- && h->type != STT_NOTYPE
49- && !(newfunc && oldfunc))
50+ && (((olddef || h->root.type == bfd_link_hash_common)
51+ && ELF_ST_TYPE (sym->st_info) != h->type
52+ && ELF_ST_TYPE (sym->st_info) != STT_NOTYPE
53+ && h->type != STT_NOTYPE
54+ && !(newfunc && oldfunc))
55+ || (olddef
56+ && ((h->type == STT_GNU_IFUNC)
57+ != (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)))))
58 {
59 *skip = TRUE;
60 return TRUE;
61#diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
62#index ac65a3a..a092428 100644
63#--- a/ld/testsuite/ChangeLog
64#+++ b/ld/testsuite/ChangeLog
65#@@ -1,5 +1,19 @@
66# 2014-01-21 H.J. Lu <hongjiu.lu@intel.com>
67#
68#+ PR ld/16467
69#+ * ld-ifunc/dummy.c: New file.
70#+ * ld-ifunc/pr16467.out: Likewise.
71##+ * ld-ifunc/pr16467a.c: Likewise.
72#+ * ld-ifunc/pr16467a.map: Likewise.
73#+ * ld-ifunc/pr16467b.c: Likewise.
74#+ * ld-ifunc/pr16467b.map: Likewise.
75#+ * ld-ifunc/pr16467c.c: Likewise.
76#+
77#+ * ld-ifunc/ifunc.exp (run_cc_link_tests): New.
78#+ (run_ld_link_exec_tests): Run pr16467.
79#+
80#+2014-01-21 H.J. Lu <hongjiu.lu@intel.com>
81#+
82# PR ld/2404
83# * ld-elf/shared.exp: Add a PIE test for PR ld/2404.
84#
85diff --git a/ld/testsuite/ld-ifunc/dummy.c b/ld/testsuite/ld-ifunc/dummy.c
86new file mode 100644
87index 0000000..5c03287
88--- /dev/null
89+++ b/ld/testsuite/ld-ifunc/dummy.c
90@@ -0,0 +1 @@
91+/* An empty file. */
92diff --git a/ld/testsuite/ld-ifunc/ifunc.exp b/ld/testsuite/ld-ifunc/ifunc.exp
93index fb106c6..d7ff445 100644
94--- a/ld/testsuite/ld-ifunc/ifunc.exp
95+++ b/ld/testsuite/ld-ifunc/ifunc.exp
96@@ -349,6 +349,42 @@ if { $verbose < 1 } {
97 remote_file host delete "tmpdir/static_nonifunc_prog"
98 }
99
100+run_cc_link_tests [list \
101+ [list \
102+ "Build libpr16467a.so" \
103+ "-shared -Wl,--version-script=pr16467a.map" \
104+ "-fPIC" \
105+ { pr16467a.c } \
106+ {} \
107+ "libpr16467a.so" \
108+ ] \
109+ [list \
110+ "Build libpr16467b.a" \
111+ "" \
112+ "-fPIC" \
113+ { pr16467b.c } \
114+ {} \
115+ "libpr16467b.a" \
116+ ] \
117+ [list \
118+ "Build libpr16467b.so" \
119+ "-shared tmpdir/pr16467b.o tmpdir/libpr16467a.so \
120+ -Wl,--version-script=pr16467b.map" \
121+ "-fPIC" \
122+ { dummy.c } \
123+ {} \
124+ "libpr16467b.so" \
125+ ] \
126+ [list \
127+ "Build libpr16467c.a" \
128+ "" \
129+ "" \
130+ { pr16467c.c } \
131+ {} \
132+ "libpr16467c.a" \
133+ ] \
134+]
135+
136 run_ld_link_exec_tests [] [list \
137 [list \
138 "Common symbol override ifunc test 1a" \
139@@ -368,6 +404,15 @@ run_ld_link_exec_tests [] [list \
140 "ifunc-common-1.out" \
141 "-g" \
142 ] \
143+ [list \
144+ "Run pr16467" \
145+ "tmpdir/pr16467c.o tmpdir/libpr16467b.so tmpdir/libpr16467a.so" \
146+ "" \
147+ { dummy.c } \
148+ "pr16467" \
149+ "pr16467.out" \
150+ "" \
151+ ] \
152 ]
153
154 set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
155diff --git a/ld/testsuite/ld-ifunc/pr16467.out b/ld/testsuite/ld-ifunc/pr16467.out
156new file mode 100644
157index 0000000..d86bac9
158--- /dev/null
159+++ b/ld/testsuite/ld-ifunc/pr16467.out
160@@ -0,0 +1 @@
161+OK
162diff --git a/ld/testsuite/ld-ifunc/pr16467a.c b/ld/testsuite/ld-ifunc/pr16467a.c
163new file mode 100644
164index 0000000..ae3f084
165--- /dev/null
166+++ b/ld/testsuite/ld-ifunc/pr16467a.c
167@@ -0,0 +1,5 @@
168+const char *
169+sd_get_seats(void)
170+{
171+ return "OK";
172+}
173diff --git a/ld/testsuite/ld-ifunc/pr16467a.map b/ld/testsuite/ld-ifunc/pr16467a.map
174new file mode 100644
175index 0000000..d677f37
176--- /dev/null
177+++ b/ld/testsuite/ld-ifunc/pr16467a.map
178@@ -0,0 +1,4 @@
179+LIBSYSTEMD_209 {
180+global:
181+ sd_get_seats;
182+};
183diff --git a/ld/testsuite/ld-ifunc/pr16467b.c b/ld/testsuite/ld-ifunc/pr16467b.c
184new file mode 100644
185index 0000000..264f6cf
186--- /dev/null
187+++ b/ld/testsuite/ld-ifunc/pr16467b.c
188@@ -0,0 +1,7 @@
189+void new_sd_get_seats(void);
190+__asm__(".symver new_sd_get_seats,sd_get_seats@LIBSYSTEMD_209");
191+void (*resolve_sd_get_seats(void)) (void) __asm__ ("sd_get_seats");
192+void (*resolve_sd_get_seats(void)) (void) {
193+ return new_sd_get_seats;
194+}
195+__asm__(".type sd_get_seats, %gnu_indirect_function");
196diff --git a/ld/testsuite/ld-ifunc/pr16467b.map b/ld/testsuite/ld-ifunc/pr16467b.map
197new file mode 100644
198index 0000000..1f263de
199--- /dev/null
200+++ b/ld/testsuite/ld-ifunc/pr16467b.map
201@@ -0,0 +1,4 @@
202+LIBSYSTEMD_208 {
203+global:
204+ sd_get_seats;
205+};
206diff --git a/ld/testsuite/ld-ifunc/pr16467c.c b/ld/testsuite/ld-ifunc/pr16467c.c
207new file mode 100644
208index 0000000..e2a901c
209--- /dev/null
210+++ b/ld/testsuite/ld-ifunc/pr16467c.c
211@@ -0,0 +1,9 @@
212+#include <stdio.h>
213+const char* sd_get_seats(void);
214+
215+int
216+main (int argc, char **argv)
217+{
218+ printf("%s\n", sd_get_seats());
219+ return 0;
220+}
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/fix-pr2404.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/fix-pr2404.patch
new file mode 100644
index 0000000..41f3504
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/fix-pr2404.patch
@@ -0,0 +1,76 @@
1From: H.J. Lu <hjl.tools@gmail.com>
2Date: Tue, 21 Jan 2014 13:33:48 +0000 (-0800)
3Subject: Don't check shared/export_dynamic/ref_dynamic for type mismatch
4X-Git-Tag: hjl/linux/release/2.24.51.0.3~1^2~8^2~22
5X-Git-Url: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff_plain;h=22ef172a21663abb477d72284b4d59c8eabcbb82
6
7Don't check shared/export_dynamic/ref_dynamic for type mismatch
8
9There is nothing linker can do when a type mismatched default definition
10are made dynamic by info->shared, info->export_dynamic or h->ref_dynamic.
11But we do want to avoid exporting it when building PIE. Let's remove
12those checks.
13
14bfd/
15
16 PR ld/2404
17 * elflink.c (_bfd_elf_merge_symbol): Don't check info->shared,
18 info->export_dynamic, nor !h->ref_dynamic for type mismatch when
19 adding the default version.
20
21ld/testsuite/
22
23 PR ld/2404
24 * ld-elf/shared.exp: Add a PIE test for PR ld/2404.
25
26Upstream-Status: Backport
27---
28
29Index: binutils-2.24/bfd/elflink.c
30===================================================================
31--- binutils-2.24.orig/bfd/elflink.c 2014-02-08 13:20:08.628378267 +0000
32+++ binutils-2.24/bfd/elflink.c 2014-02-08 13:20:08.624378267 +0000
33@@ -1090,9 +1090,6 @@
34 the type of existing regular definition mismatch. We only do it
35 if the existing regular definition won't be dynamic. */
36 if (pold_alignment == NULL
37- && !info->shared
38- && !info->export_dynamic
39- && !h->ref_dynamic
40 && newdyn
41 && newdef
42 && !olddyn
43Index: binutils-2.24/ld/testsuite/ld-elf/shared.exp
44===================================================================
45--- binutils-2.24.orig/ld/testsuite/ld-elf/shared.exp 2014-02-08 13:20:08.628378267 +0000
46+++ binutils-2.24/ld/testsuite/ld-elf/shared.exp 2014-02-08 13:20:08.624378267 +0000
47@@ -432,3 +432,29 @@
48
49 run_cc_link_tests $build_cxx_tests
50 run_ld_link_exec_tests [] $run_cxx_tests
51+
52+if { [istarget *-*-linux*]
53+ || [istarget *-*-nacl*]
54+ || [istarget *-*-gnu*] } {
55+ run_cc_link_tests [list \
56+ [list \
57+ "Build libpr2404b.a with PIE" \
58+ "" \
59+ "-fPIE" \
60+ { pr2404b.c } \
61+ {} \
62+ "libpr2404b.a" \
63+ ] \
64+ ]
65+ run_ld_link_exec_tests [] [list \
66+ [list \
67+ "Run pr2404 with PIE" \
68+ "-pie tmpdir/pr2404b.o tmpdir/libpr2404a.so" \
69+ "" \
70+ { dummy.c } \
71+ "pr2404pie" \
72+ "pr2404.out" \
73+ "-fPIE" \
74+ ] \
75+ ]
76+}
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/libiberty_path_fix.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/libiberty_path_fix.patch
new file mode 100644
index 0000000..6e732fb
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/libiberty_path_fix.patch
@@ -0,0 +1,22 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3don't let the distro compiler point to the wrong installation location
4
5Thanks to RP for helping find the source code causing the issue.
6
72010/08/13
8Nitin A Kamble <nitin.a.kamble@intel.com>
9Index: binutils-2.22/libiberty/Makefile.in
10===================================================================
11--- binutils-2.22.orig/libiberty/Makefile.in
12+++ binutils-2.22/libiberty/Makefile.in
13@@ -350,7 +350,8 @@ install-strip: install
14 # multilib-specific flags, it's overridden by FLAGS_TO_PASS from the
15 # default multilib, so we have to take CFLAGS into account as well,
16 # since it will be passed the multilib flags.
17-MULTIOSDIR = `$(CC) $(CFLAGS) -print-multi-os-directory`
18+#MULTIOSDIR = `$(CC) $(CFLAGS) -print-multi-os-directory`
19+MULTIOSDIR = ""
20 install_to_libdir: all
21 ${mkinstalldirs} $(DESTDIR)$(libdir)/$(MULTIOSDIR)
22 $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/libtool-2.4-update.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/libtool-2.4-update.patch
new file mode 100644
index 0000000..2e621f1
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/libtool-2.4-update.patch
@@ -0,0 +1,19317 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3Index: binutils-2.24/libtool.m4
4===================================================================
5--- binutils-2.24.orig/libtool.m4 2013-11-04 07:33:40.000000000 -0800
6+++ binutils-2.24/libtool.m4 2013-12-15 11:10:23.863785363 -0800
7@@ -1,7 +1,8 @@
8 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
9 #
10 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
11-# 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
12+# 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
13+# Inc.
14 # Written by Gordon Matzigkeit, 1996
15 #
16 # This file is free software; the Free Software Foundation gives
17@@ -10,7 +11,8 @@
18
19 m4_define([_LT_COPYING], [dnl
20 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
21-# 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
22+# 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
23+# Inc.
24 # Written by Gordon Matzigkeit, 1996
25 #
26 # This file is part of GNU Libtool.
27@@ -37,7 +39,7 @@
28 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 ])
30
31-# serial 56 LT_INIT
32+# serial 57 LT_INIT
33
34
35 # LT_PREREQ(VERSION)
36@@ -92,7 +94,8 @@
37 LIBTOOL_DEPS="$ltmain"
38
39 # Always use our own libtool.
40-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
41+LIBTOOL='$(SHELL) $(top_builddir)'
42+LIBTOOL="$LIBTOOL/${host_alias}-libtool"
43 AC_SUBST(LIBTOOL)dnl
44
45 _LT_SETUP
46@@ -166,10 +169,13 @@
47 dnl
48 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
49 m4_require([_LT_CHECK_SHELL_FEATURES])dnl
50+m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
51 m4_require([_LT_CMD_RELOAD])dnl
52 m4_require([_LT_CHECK_MAGIC_METHOD])dnl
53+m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
54 m4_require([_LT_CMD_OLD_ARCHIVE])dnl
55 m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
56+m4_require([_LT_WITH_SYSROOT])dnl
57
58 _LT_CONFIG_LIBTOOL_INIT([
59 # See if we are running on zsh, and set the options which allow our
60@@ -199,7 +205,7 @@
61 esac
62
63 # Global variables:
64-ofile=libtool
65+ofile=${host_alias}-libtool
66 can_build_shared=yes
67
68 # All known linkers require a `.a' archive for static linking (except MSVC,
69@@ -632,7 +638,7 @@
70 m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
71 configured by $[0], generated by m4_PACKAGE_STRING.
72
73-Copyright (C) 2009 Free Software Foundation, Inc.
74+Copyright (C) 2010 Free Software Foundation, Inc.
75 This config.lt script is free software; the Free Software Foundation
76 gives unlimited permision to copy, distribute and modify it."
77
78@@ -746,15 +752,12 @@
79 # if finds mixed CR/LF and LF-only lines. Since sed operates in
80 # text mode, it properly converts lines to CR/LF. This bash problem
81 # is reportedly fixed, but why not run on old versions too?
82- sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
83- || (rm -f "$cfgfile"; exit 1)
84+ sed '$q' "$ltmain" >> "$cfgfile" \
85+ || (rm -f "$cfgfile"; exit 1)
86
87- _LT_PROG_XSI_SHELLFNS
88+ _LT_PROG_REPLACE_SHELLFNS
89
90- sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
91- || (rm -f "$cfgfile"; exit 1)
92-
93- mv -f "$cfgfile" "$ofile" ||
94+ mv -f "$cfgfile" "$ofile" ||
95 (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
96 chmod +x "$ofile"
97 ],
98@@ -980,6 +983,8 @@
99 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
100 echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
101 $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
102+ echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
103+ $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
104 cat > conftest.c << _LT_EOF
105 int main() { return 0;}
106 _LT_EOF
107@@ -1069,30 +1074,41 @@
108 fi
109 ])
110
111-# _LT_SYS_MODULE_PATH_AIX
112-# -----------------------
113+# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
114+# ----------------------------------
115 # Links a minimal program and checks the executable
116 # for the system default hardcoded library path. In most cases,
117 # this is /usr/lib:/lib, but when the MPI compilers are used
118 # the location of the communication and MPI libs are included too.
119 # If we don't find anything, use the default library path according
120 # to the aix ld manual.
121+# Store the results from the different compilers for each TAGNAME.
122+# Allow to override them for all tags through lt_cv_aix_libpath.
123 m4_defun([_LT_SYS_MODULE_PATH_AIX],
124 [m4_require([_LT_DECL_SED])dnl
125-AC_LINK_IFELSE(AC_LANG_PROGRAM,[
126-lt_aix_libpath_sed='
127- /Import File Strings/,/^$/ {
128- /^0/ {
129- s/^0 *\(.*\)$/\1/
130- p
131- }
132- }'
133-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
134-# Check for a 64-bit object if we didn't find anything.
135-if test -z "$aix_libpath"; then
136- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
137-fi],[])
138-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
139+if test "${lt_cv_aix_libpath+set}" = set; then
140+ aix_libpath=$lt_cv_aix_libpath
141+else
142+ AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
143+ [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
144+ lt_aix_libpath_sed='[
145+ /Import File Strings/,/^$/ {
146+ /^0/ {
147+ s/^0 *\([^ ]*\) *$/\1/
148+ p
149+ }
150+ }]'
151+ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
152+ # Check for a 64-bit object if we didn't find anything.
153+ if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
154+ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
155+ fi],[])
156+ if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
157+ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
158+ fi
159+ ])
160+ aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
161+fi
162 ])# _LT_SYS_MODULE_PATH_AIX
163
164
165@@ -1117,7 +1133,7 @@
166
167 AC_MSG_CHECKING([how to print strings])
168 # Test print first, because it will be a builtin if present.
169-if test "X`print -r -- -n 2>/dev/null`" = X-n && \
170+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
171 test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
172 ECHO='print -r --'
173 elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
174@@ -1161,6 +1177,39 @@
175 ])# _LT_PROG_ECHO_BACKSLASH
176
177
178+# _LT_WITH_SYSROOT
179+# ----------------
180+AC_DEFUN([_LT_WITH_SYSROOT],
181+[AC_MSG_CHECKING([for sysroot])
182+AC_ARG_WITH([libtool-sysroot],
183+[ --with-libtool-sysroot[=DIR] Search for dependent libraries within DIR
184+ (or the compiler's sysroot if not specified).],
185+[], [with_libtool_sysroot=no])
186+
187+dnl lt_sysroot will always be passed unquoted. We quote it here
188+dnl in case the user passed a directory name.
189+lt_sysroot=
190+case ${with_libtool_sysroot} in #(
191+ yes)
192+ if test "$GCC" = yes; then
193+ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
194+ fi
195+ ;; #(
196+ /*)
197+ lt_sysroot=`echo "$with_libtool_sysroot" | sed -e "$sed_quote_subst"`
198+ ;; #(
199+ no|'')
200+ ;; #(
201+ *)
202+ AC_MSG_RESULT([${with_libtool_sysroot}])
203+ AC_MSG_ERROR([The sysroot must be an absolute path.])
204+ ;;
205+esac
206+
207+ AC_MSG_RESULT([${lt_sysroot:-no}])
208+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
209+[dependent libraries, and in which our libraries should be installed.])])
210+
211 # _LT_ENABLE_LOCK
212 # ---------------
213 m4_defun([_LT_ENABLE_LOCK],
214@@ -1320,14 +1369,47 @@
215 ])# _LT_ENABLE_LOCK
216
217
218+# _LT_PROG_AR
219+# -----------
220+m4_defun([_LT_PROG_AR],
221+[AC_CHECK_TOOLS(AR, [ar], false)
222+: ${AR=ar}
223+: ${AR_FLAGS=cru}
224+_LT_DECL([], [AR], [1], [The archiver])
225+_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
226+
227+AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
228+ [lt_cv_ar_at_file=no
229+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
230+ [echo conftest.$ac_objext > conftest.lst
231+ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
232+ AC_TRY_EVAL([lt_ar_try])
233+ if test "$ac_status" -eq 0; then
234+ # Ensure the archiver fails upon bogus file names.
235+ rm -f conftest.$ac_objext libconftest.a
236+ AC_TRY_EVAL([lt_ar_try])
237+ if test "$ac_status" -ne 0; then
238+ lt_cv_ar_at_file=@
239+ fi
240+ fi
241+ rm -f conftest.* libconftest.a
242+ ])
243+ ])
244+
245+if test "x$lt_cv_ar_at_file" = xno; then
246+ archiver_list_spec=
247+else
248+ archiver_list_spec=$lt_cv_ar_at_file
249+fi
250+_LT_DECL([], [archiver_list_spec], [1],
251+ [How to feed a file listing to the archiver])
252+])# _LT_PROG_AR
253+
254+
255 # _LT_CMD_OLD_ARCHIVE
256 # -------------------
257 m4_defun([_LT_CMD_OLD_ARCHIVE],
258-[AC_CHECK_TOOL(AR, ar, false)
259-test -z "$AR" && AR=ar
260-test -z "$AR_FLAGS" && AR_FLAGS=cru
261-_LT_DECL([], [AR], [1], [The archiver])
262-_LT_DECL([], [AR_FLAGS], [1])
263+[_LT_PROG_AR
264
265 AC_CHECK_TOOL(STRIP, strip, :)
266 test -z "$STRIP" && STRIP=:
267@@ -1623,7 +1705,7 @@
268 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
269 lt_status=$lt_dlunknown
270 cat > conftest.$ac_ext <<_LT_EOF
271-[#line __oline__ "configure"
272+[#line $LINENO "configure"
273 #include "confdefs.h"
274
275 #if HAVE_DLFCN_H
276@@ -1667,10 +1749,10 @@
277 /* When -fvisbility=hidden is used, assume the code has been annotated
278 correspondingly for the symbols needed. */
279 #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
280-void fnord () __attribute__((visibility("default")));
281+int fnord () __attribute__((visibility("default")));
282 #endif
283
284-void fnord () { int i=42; }
285+int fnord () { return 42; }
286 int main ()
287 {
288 void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
289@@ -2210,8 +2292,9 @@
290 need_version=no
291 need_lib_prefix=no
292
293- case $GCC,$host_os in
294- yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
295+ case $GCC,$cc_basename in
296+ yes,*)
297+ # gcc
298 library_names_spec='$libname.dll.a'
299 # DLL is installed to $(libdir)/../bin by postinstall_cmds
300 postinstall_cmds='base_file=`basename \${file}`~
301@@ -2244,13 +2327,71 @@
302 library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
303 ;;
304 esac
305+ dynamic_linker='Win32 ld.exe'
306+ ;;
307+
308+ *,cl*)
309+ # Native MSVC
310+ libname_spec='$name'
311+ soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
312+ library_names_spec='${libname}.dll.lib'
313+
314+ case $build_os in
315+ mingw*)
316+ sys_lib_search_path_spec=
317+ lt_save_ifs=$IFS
318+ IFS=';'
319+ for lt_path in $LIB
320+ do
321+ IFS=$lt_save_ifs
322+ # Let DOS variable expansion print the short 8.3 style file name.
323+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
324+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
325+ done
326+ IFS=$lt_save_ifs
327+ # Convert to MSYS style.
328+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
329+ ;;
330+ cygwin*)
331+ # Convert to unix form, then to dos form, then back to unix form
332+ # but this time dos style (no spaces!) so that the unix form looks
333+ # like /cygdrive/c/PROGRA~1:/cygdr...
334+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
335+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
336+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
337+ ;;
338+ *)
339+ sys_lib_search_path_spec="$LIB"
340+ if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
341+ # It is most probably a Windows format PATH.
342+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
343+ else
344+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
345+ fi
346+ # FIXME: find the short name or the path components, as spaces are
347+ # common. (e.g. "Program Files" -> "PROGRA~1")
348+ ;;
349+ esac
350+
351+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
352+ postinstall_cmds='base_file=`basename \${file}`~
353+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
354+ dldir=$destdir/`dirname \$dlpath`~
355+ test -d \$dldir || mkdir -p \$dldir~
356+ $install_prog $dir/$dlname \$dldir/$dlname'
357+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
358+ dlpath=$dir/\$dldll~
359+ $RM \$dlpath'
360+ shlibpath_overrides_runpath=yes
361+ dynamic_linker='Win32 link.exe'
362 ;;
363
364 *)
365+ # Assume MSVC wrapper
366 library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
367+ dynamic_linker='Win32 ld.exe'
368 ;;
369 esac
370- dynamic_linker='Win32 ld.exe'
371 # FIXME: first we should search . and the directory the executable is in
372 shlibpath_var=PATH
373 ;;
374@@ -2342,7 +2483,7 @@
375 soname_spec='${libname}${release}${shared_ext}$major'
376 shlibpath_var=LIBRARY_PATH
377 shlibpath_overrides_runpath=yes
378- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
379+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
380 hardcode_into_libs=yes
381 ;;
382
383@@ -2950,6 +3091,11 @@
384 esac
385 reload_cmds='$LD$reload_flag -o $output$reload_objs'
386 case $host_os in
387+ cygwin* | mingw* | pw32* | cegcc*)
388+ if test "$GCC" != yes; then
389+ reload_cmds=false
390+ fi
391+ ;;
392 darwin*)
393 if test "$GCC" = yes; then
394 reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
395@@ -3016,7 +3162,8 @@
396 lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
397 lt_cv_file_magic_cmd='func_win32_libid'
398 else
399- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
400+ # Keep this pattern in sync with the one in func_win32_libid.
401+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
402 lt_cv_file_magic_cmd='$OBJDUMP -f'
403 fi
404 ;;
405@@ -3167,6 +3314,21 @@
406 ;;
407 esac
408 ])
409+
410+file_magic_glob=
411+want_nocaseglob=no
412+if test "$build" = "$host"; then
413+ case $host_os in
414+ mingw* | pw32*)
415+ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
416+ want_nocaseglob=yes
417+ else
418+ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
419+ fi
420+ ;;
421+ esac
422+fi
423+
424 file_magic_cmd=$lt_cv_file_magic_cmd
425 deplibs_check_method=$lt_cv_deplibs_check_method
426 test -z "$deplibs_check_method" && deplibs_check_method=unknown
427@@ -3174,7 +3336,11 @@
428 _LT_DECL([], [deplibs_check_method], [1],
429 [Method to check whether dependent libraries are shared objects])
430 _LT_DECL([], [file_magic_cmd], [1],
431- [Command to use when deplibs_check_method == "file_magic"])
432+ [Command to use when deplibs_check_method = "file_magic"])
433+_LT_DECL([], [file_magic_glob], [1],
434+ [How to find potential files when deplibs_check_method = "file_magic"])
435+_LT_DECL([], [want_nocaseglob], [1],
436+ [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
437 ])# _LT_CHECK_MAGIC_METHOD
438
439
440@@ -3277,6 +3443,67 @@
441 dnl AC_DEFUN([AM_PROG_NM], [])
442 dnl AC_DEFUN([AC_PROG_NM], [])
443
444+# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
445+# --------------------------------
446+# how to determine the name of the shared library
447+# associated with a specific link library.
448+# -- PORTME fill in with the dynamic library characteristics
449+m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
450+[m4_require([_LT_DECL_EGREP])
451+m4_require([_LT_DECL_OBJDUMP])
452+m4_require([_LT_DECL_DLLTOOL])
453+AC_CACHE_CHECK([how to associate runtime and link libraries],
454+lt_cv_sharedlib_from_linklib_cmd,
455+[lt_cv_sharedlib_from_linklib_cmd='unknown'
456+
457+case $host_os in
458+cygwin* | mingw* | pw32* | cegcc*)
459+ # two different shell functions defined in ltmain.sh
460+ # decide which to use based on capabilities of $DLLTOOL
461+ case `$DLLTOOL --help 2>&1` in
462+ *--identify-strict*)
463+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
464+ ;;
465+ *)
466+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
467+ ;;
468+ esac
469+ ;;
470+*)
471+ # fallback: assume linklib IS sharedlib
472+ lt_cv_sharedlib_from_linklib_cmd="$ECHO"
473+ ;;
474+esac
475+])
476+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
477+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
478+
479+_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
480+ [Command to associate shared and link libraries])
481+])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
482+
483+
484+# _LT_PATH_MANIFEST_TOOL
485+# ----------------------
486+# locate the manifest tool
487+m4_defun([_LT_PATH_MANIFEST_TOOL],
488+[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
489+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
490+AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
491+ [lt_cv_path_mainfest_tool=no
492+ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
493+ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
494+ cat conftest.err >&AS_MESSAGE_LOG_FD
495+ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
496+ lt_cv_path_mainfest_tool=yes
497+ fi
498+ rm -f conftest*])
499+if test "x$lt_cv_path_mainfest_tool" != xyes; then
500+ MANIFEST_TOOL=:
501+fi
502+_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
503+])# _LT_PATH_MANIFEST_TOOL
504+
505
506 # LT_LIB_M
507 # --------
508@@ -3403,8 +3630,8 @@
509 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
510
511 # Transform an extracted symbol line into symbol name and symbol address
512-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'"
513-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
514+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'"
515+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
516
517 # Handle CRLF in mingw tool chain
518 opt_cr=
519@@ -3440,6 +3667,7 @@
520 else
521 lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
522 fi
523+ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
524
525 # Check to see that the pipe works correctly.
526 pipe_works=no
527@@ -3473,6 +3701,18 @@
528 if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
529 if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
530 cat <<_LT_EOF > conftest.$ac_ext
531+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
532+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
533+/* DATA imports from DLLs on WIN32 con't be const, because runtime
534+ relocations are performed -- see ld's documentation on pseudo-relocs. */
535+# define LT@&t@_DLSYM_CONST
536+#elif defined(__osf__)
537+/* This system does not cope well with relocations in const data. */
538+# define LT@&t@_DLSYM_CONST
539+#else
540+# define LT@&t@_DLSYM_CONST const
541+#endif
542+
543 #ifdef __cplusplus
544 extern "C" {
545 #endif
546@@ -3484,7 +3724,7 @@
547 cat <<_LT_EOF >> conftest.$ac_ext
548
549 /* The mapping between symbol names and symbols. */
550-const struct {
551+LT@&t@_DLSYM_CONST struct {
552 const char *name;
553 void *address;
554 }
555@@ -3510,15 +3750,15 @@
556 _LT_EOF
557 # Now try linking the two files.
558 mv conftest.$ac_objext conftstm.$ac_objext
559- lt_save_LIBS="$LIBS"
560- lt_save_CFLAGS="$CFLAGS"
561+ lt_globsym_save_LIBS=$LIBS
562+ lt_globsym_save_CFLAGS=$CFLAGS
563 LIBS="conftstm.$ac_objext"
564 CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
565 if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
566 pipe_works=yes
567 fi
568- LIBS="$lt_save_LIBS"
569- CFLAGS="$lt_save_CFLAGS"
570+ LIBS=$lt_globsym_save_LIBS
571+ CFLAGS=$lt_globsym_save_CFLAGS
572 else
573 echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
574 fi
575@@ -3551,6 +3791,13 @@
576 AC_MSG_RESULT(ok)
577 fi
578
579+# Response file support.
580+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
581+ nm_file_list_spec='@'
582+elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
583+ nm_file_list_spec='@'
584+fi
585+
586 _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
587 [Take the output of nm and produce a listing of raw symbols and C names])
588 _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
589@@ -3561,6 +3808,8 @@
590 _LT_DECL([global_symbol_to_c_name_address_lib_prefix],
591 [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
592 [Transform the output of nm in a C name address pair when lib prefix is needed])
593+_LT_DECL([], [nm_file_list_spec], [1],
594+ [Specify filename containing input files for $NM])
595 ]) # _LT_CMD_GLOBAL_SYMBOLS
596
597
598@@ -3572,7 +3821,6 @@
599 _LT_TAGVAR(lt_prog_compiler_pic, $1)=
600 _LT_TAGVAR(lt_prog_compiler_static, $1)=
601
602-AC_MSG_CHECKING([for $compiler option to produce PIC])
603 m4_if([$1], [CXX], [
604 # C++ specific cases for pic, static, wl, etc.
605 if test "$GXX" = yes; then
606@@ -3678,6 +3926,12 @@
607 ;;
608 esac
609 ;;
610+ mingw* | cygwin* | os2* | pw32* | cegcc*)
611+ # This hack is so that the source file can tell whether it is being
612+ # built for inclusion in a dll (and should export symbols for example).
613+ m4_if([$1], [GCJ], [],
614+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
615+ ;;
616 dgux*)
617 case $cc_basename in
618 ec++*)
619@@ -3830,7 +4084,7 @@
620 ;;
621 solaris*)
622 case $cc_basename in
623- CC*)
624+ CC* | sunCC*)
625 # Sun C++ 4.2, 5.x and Centerline C++
626 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
627 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
628@@ -4053,6 +4307,12 @@
629 _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
630 _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
631 ;;
632+ nagfor*)
633+ # NAG Fortran compiler
634+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
635+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
636+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
637+ ;;
638 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
639 # Portland Group compilers (*not* the Pentium gcc compiler,
640 # which looks to be a dead project)
641@@ -4115,7 +4375,7 @@
642 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
643 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
644 case $cc_basename in
645- f77* | f90* | f95*)
646+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
647 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
648 *)
649 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
650@@ -4172,9 +4432,11 @@
651 _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
652 ;;
653 esac
654-AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
655-_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
656- [How to pass a linker flag through the compiler])
657+
658+AC_CACHE_CHECK([for $compiler option to produce PIC],
659+ [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
660+ [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
661+_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
662
663 #
664 # Check to make sure the PIC flag actually works.
665@@ -4193,6 +4455,8 @@
666 _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
667 [Additional compiler flags for building library objects])
668
669+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
670+ [How to pass a linker flag through the compiler])
671 #
672 # Check to make sure the static flag actually works.
673 #
674@@ -4213,6 +4477,7 @@
675 m4_defun([_LT_LINKER_SHLIBS],
676 [AC_REQUIRE([LT_PATH_LD])dnl
677 AC_REQUIRE([LT_PATH_NM])dnl
678+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
679 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
680 m4_require([_LT_DECL_EGREP])dnl
681 m4_require([_LT_DECL_SED])dnl
682@@ -4221,6 +4486,7 @@
683 AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
684 m4_if([$1], [CXX], [
685 _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
686+ _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
687 case $host_os in
688 aix[[4-9]]*)
689 # If we're using GNU nm, then we don't want the "-C" option.
690@@ -4235,15 +4501,20 @@
691 ;;
692 pw32*)
693 _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
694- ;;
695+ ;;
696 cygwin* | mingw* | cegcc*)
697- _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
698- ;;
699+ case $cc_basename in
700+ cl*) ;;
701+ *)
702+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
703+ _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
704+ ;;
705+ esac
706+ ;;
707 *)
708 _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
709- ;;
710+ ;;
711 esac
712- _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
713 ], [
714 runpath_var=
715 _LT_TAGVAR(allow_undefined_flag, $1)=
716@@ -4411,7 +4682,8 @@
717 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
718 _LT_TAGVAR(always_export_symbols, $1)=no
719 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
720- _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
721+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
722+ _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
723
724 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
725 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
726@@ -4459,7 +4731,7 @@
727 if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
728 && test "$tmp_diet" = no
729 then
730- tmp_addflag=
731+ tmp_addflag=' $pic_flag'
732 tmp_sharedflag='-shared'
733 case $cc_basename,$host_cpu in
734 pgcc*) # Portland Group C compiler
735@@ -4510,12 +4782,12 @@
736 _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
737 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
738 _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
739- _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
740+ _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
741 if test "x$supports_anon_versioning" = xyes; then
742 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
743 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
744 echo "local: *; };" >> $output_objdir/$libname.ver~
745- $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
746+ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
747 fi
748 ;;
749 esac
750@@ -4529,8 +4801,8 @@
751 _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
752 wlarc=
753 else
754- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
755- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
756+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
757+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
758 fi
759 ;;
760
761@@ -4548,8 +4820,8 @@
762
763 _LT_EOF
764 elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
765- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
766- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
767+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
768+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
769 else
770 _LT_TAGVAR(ld_shlibs, $1)=no
771 fi
772@@ -4595,8 +4867,8 @@
773
774 *)
775 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
776- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
777- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
778+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
779+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
780 else
781 _LT_TAGVAR(ld_shlibs, $1)=no
782 fi
783@@ -4726,7 +4998,7 @@
784 _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
785 # Determine the default libpath from the value encoded in an
786 # empty executable.
787- _LT_SYS_MODULE_PATH_AIX
788+ _LT_SYS_MODULE_PATH_AIX([$1])
789 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
790 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
791 else
792@@ -4737,7 +5009,7 @@
793 else
794 # Determine the default libpath from the value encoded in an
795 # empty executable.
796- _LT_SYS_MODULE_PATH_AIX
797+ _LT_SYS_MODULE_PATH_AIX([$1])
798 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
799 # Warning - without using the other run time loading flags,
800 # -berok will link without error, but may produce a broken library.
801@@ -4781,20 +5053,63 @@
802 # Microsoft Visual C++.
803 # hardcode_libdir_flag_spec is actually meaningless, as there is
804 # no search path for DLLs.
805- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
806- _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
807- # Tell ltmain to make .lib files, not .a files.
808- libext=lib
809- # Tell ltmain to make .dll files, not .so files.
810- shrext_cmds=".dll"
811- # FIXME: Setting linknames here is a bad hack.
812- _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
813- # The linker will automatically build a .lib file if we build a DLL.
814- _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
815- # FIXME: Should let the user specify the lib program.
816- _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
817- _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
818- _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
819+ case $cc_basename in
820+ cl*)
821+ # Native MSVC
822+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
823+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
824+ _LT_TAGVAR(always_export_symbols, $1)=yes
825+ _LT_TAGVAR(file_list_spec, $1)='@'
826+ # Tell ltmain to make .lib files, not .a files.
827+ libext=lib
828+ # Tell ltmain to make .dll files, not .so files.
829+ shrext_cmds=".dll"
830+ # FIXME: Setting linknames here is a bad hack.
831+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
832+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
833+ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
834+ else
835+ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
836+ fi~
837+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
838+ linknames='
839+ # The linker will not automatically build a static lib if we build a DLL.
840+ # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
841+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
842+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
843+ # Don't use ranlib
844+ _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
845+ _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
846+ lt_tool_outputfile="@TOOL_OUTPUT@"~
847+ case $lt_outputfile in
848+ *.exe|*.EXE) ;;
849+ *)
850+ lt_outputfile="$lt_outputfile.exe"
851+ lt_tool_outputfile="$lt_tool_outputfile.exe"
852+ ;;
853+ esac~
854+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
855+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
856+ $RM "$lt_outputfile.manifest";
857+ fi'
858+ ;;
859+ *)
860+ # Assume MSVC wrapper
861+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
862+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
863+ # Tell ltmain to make .lib files, not .a files.
864+ libext=lib
865+ # Tell ltmain to make .dll files, not .so files.
866+ shrext_cmds=".dll"
867+ # FIXME: Setting linknames here is a bad hack.
868+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
869+ # The linker will automatically build a .lib file if we build a DLL.
870+ _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
871+ # FIXME: Should let the user specify the lib program.
872+ _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
873+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
874+ ;;
875+ esac
876 ;;
877
878 darwin* | rhapsody*)
879@@ -4828,7 +5143,7 @@
880
881 # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
882 freebsd* | dragonfly*)
883- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
884+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
885 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
886 _LT_TAGVAR(hardcode_direct, $1)=yes
887 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
888@@ -4836,7 +5151,7 @@
889
890 hpux9*)
891 if test "$GCC" = yes; then
892- _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
893+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
894 else
895 _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
896 fi
897@@ -4852,7 +5167,7 @@
898
899 hpux10*)
900 if test "$GCC" = yes && test "$with_gnu_ld" = no; then
901- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
902+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
903 else
904 _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
905 fi
906@@ -4876,10 +5191,10 @@
907 _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
908 ;;
909 ia64*)
910- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
911+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
912 ;;
913 *)
914- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
915+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
916 ;;
917 esac
918 else
919@@ -4926,16 +5241,31 @@
920
921 irix5* | irix6* | nonstopux*)
922 if test "$GCC" = yes; then
923- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
924+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
925 # Try to use the -exported_symbol ld option, if it does not
926 # work, assume that -exports_file does not work either and
927 # implicitly export all symbols.
928- save_LDFLAGS="$LDFLAGS"
929- LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
930- AC_LINK_IFELSE(int foo(void) {},
931- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
932- )
933- LDFLAGS="$save_LDFLAGS"
934+ # This should be the same for all languages, so no per-tag cache variable.
935+ AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
936+ [lt_cv_irix_exported_symbol],
937+ [save_LDFLAGS="$LDFLAGS"
938+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
939+ AC_LINK_IFELSE(
940+ [AC_LANG_SOURCE(
941+ [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
942+ [C++], [[int foo (void) { return 0; }]],
943+ [Fortran 77], [[
944+ subroutine foo
945+ end]],
946+ [Fortran], [[
947+ subroutine foo
948+ end]])])],
949+ [lt_cv_irix_exported_symbol=yes],
950+ [lt_cv_irix_exported_symbol=no])
951+ LDFLAGS="$save_LDFLAGS"])
952+ if test "$lt_cv_irix_exported_symbol" = yes; then
953+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
954+ fi
955 else
956 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
957 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
958@@ -5020,7 +5350,7 @@
959 osf4* | osf5*) # as osf3* with the addition of -msym flag
960 if test "$GCC" = yes; then
961 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
962- _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
963+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
964 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
965 else
966 _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
967@@ -5039,9 +5369,9 @@
968 _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
969 if test "$GCC" = yes; then
970 wlarc='${wl}'
971- _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
972+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
973 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
974- $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
975+ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
976 else
977 case `$CC -V 2>&1` in
978 *"Compilers 5.0"*)
979@@ -5313,8 +5643,6 @@
980 to runtime path list])
981 _LT_TAGDECL([], [link_all_deplibs], [0],
982 [Whether libtool must link a program against all its dependency libraries])
983-_LT_TAGDECL([], [fix_srcfile_path], [1],
984- [Fix the shell variable $srcfile for the compiler])
985 _LT_TAGDECL([], [always_export_symbols], [0],
986 [Set to "yes" if exported symbols are required])
987 _LT_TAGDECL([], [export_symbols_cmds], [2],
988@@ -5325,6 +5653,8 @@
989 [Symbols that must always be exported])
990 _LT_TAGDECL([], [prelink_cmds], [2],
991 [Commands necessary for linking programs (against libraries) with templates])
992+_LT_TAGDECL([], [postlink_cmds], [2],
993+ [Commands necessary for finishing linking programs])
994 _LT_TAGDECL([], [file_list_spec], [1],
995 [Specify filename containing input files])
996 dnl FIXME: Not yet implemented
997@@ -5426,6 +5756,7 @@
998 m4_defun([_LT_LANG_CXX_CONFIG],
999 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
1000 m4_require([_LT_DECL_EGREP])dnl
1001+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
1002 if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
1003 ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
1004 (test "X$CXX" != "Xg++"))) ; then
1005@@ -5487,6 +5818,7 @@
1006
1007 # Allow CC to be a program name with arguments.
1008 lt_save_CC=$CC
1009+ lt_save_CFLAGS=$CFLAGS
1010 lt_save_LD=$LD
1011 lt_save_GCC=$GCC
1012 GCC=$GXX
1013@@ -5504,6 +5836,7 @@
1014 fi
1015 test -z "${LDCXX+set}" || LD=$LDCXX
1016 CC=${CXX-"c++"}
1017+ CFLAGS=$CXXFLAGS
1018 compiler=$CC
1019 _LT_TAGVAR(compiler, $1)=$CC
1020 _LT_CC_BASENAME([$compiler])
1021@@ -5525,8 +5858,8 @@
1022 # Check if GNU C++ uses GNU ld as the underlying linker, since the
1023 # archiving commands below assume that GNU ld is being used.
1024 if test "$with_gnu_ld" = yes; then
1025- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
1026- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
1027+ _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
1028+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
1029
1030 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
1031 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
1032@@ -5667,7 +6000,7 @@
1033 _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
1034 # Determine the default libpath from the value encoded in an empty
1035 # executable.
1036- _LT_SYS_MODULE_PATH_AIX
1037+ _LT_SYS_MODULE_PATH_AIX([$1])
1038 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
1039
1040 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
1041@@ -5679,7 +6012,7 @@
1042 else
1043 # Determine the default libpath from the value encoded in an
1044 # empty executable.
1045- _LT_SYS_MODULE_PATH_AIX
1046+ _LT_SYS_MODULE_PATH_AIX([$1])
1047 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
1048 # Warning - without using the other run time loading flags,
1049 # -berok will link without error, but may produce a broken library.
1050@@ -5721,29 +6054,75 @@
1051 ;;
1052
1053 cygwin* | mingw* | pw32* | cegcc*)
1054- # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
1055- # as there is no search path for DLLs.
1056- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
1057- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
1058- _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
1059- _LT_TAGVAR(always_export_symbols, $1)=no
1060- _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
1061-
1062- if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
1063- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
1064- # If the export-symbols file already is a .def file (1st line
1065- # is EXPORTS), use it as is; otherwise, prepend...
1066- _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
1067- cp $export_symbols $output_objdir/$soname.def;
1068- else
1069- echo EXPORTS > $output_objdir/$soname.def;
1070- cat $export_symbols >> $output_objdir/$soname.def;
1071- fi~
1072- $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
1073- else
1074- _LT_TAGVAR(ld_shlibs, $1)=no
1075- fi
1076- ;;
1077+ case $GXX,$cc_basename in
1078+ ,cl* | no,cl*)
1079+ # Native MSVC
1080+ # hardcode_libdir_flag_spec is actually meaningless, as there is
1081+ # no search path for DLLs.
1082+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
1083+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
1084+ _LT_TAGVAR(always_export_symbols, $1)=yes
1085+ _LT_TAGVAR(file_list_spec, $1)='@'
1086+ # Tell ltmain to make .lib files, not .a files.
1087+ libext=lib
1088+ # Tell ltmain to make .dll files, not .so files.
1089+ shrext_cmds=".dll"
1090+ # FIXME: Setting linknames here is a bad hack.
1091+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
1092+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
1093+ $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
1094+ else
1095+ $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
1096+ fi~
1097+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
1098+ linknames='
1099+ # The linker will not automatically build a static lib if we build a DLL.
1100+ # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
1101+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
1102+ # Don't use ranlib
1103+ _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
1104+ _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
1105+ lt_tool_outputfile="@TOOL_OUTPUT@"~
1106+ case $lt_outputfile in
1107+ *.exe|*.EXE) ;;
1108+ *)
1109+ lt_outputfile="$lt_outputfile.exe"
1110+ lt_tool_outputfile="$lt_tool_outputfile.exe"
1111+ ;;
1112+ esac~
1113+ func_to_tool_file "$lt_outputfile"~
1114+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
1115+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
1116+ $RM "$lt_outputfile.manifest";
1117+ fi'
1118+ ;;
1119+ *)
1120+ # g++
1121+ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
1122+ # as there is no search path for DLLs.
1123+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
1124+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
1125+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
1126+ _LT_TAGVAR(always_export_symbols, $1)=no
1127+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
1128+
1129+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
1130+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
1131+ # If the export-symbols file already is a .def file (1st line
1132+ # is EXPORTS), use it as is; otherwise, prepend...
1133+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
1134+ cp $export_symbols $output_objdir/$soname.def;
1135+ else
1136+ echo EXPORTS > $output_objdir/$soname.def;
1137+ cat $export_symbols >> $output_objdir/$soname.def;
1138+ fi~
1139+ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
1140+ else
1141+ _LT_TAGVAR(ld_shlibs, $1)=no
1142+ fi
1143+ ;;
1144+ esac
1145+ ;;
1146 darwin* | rhapsody*)
1147 _LT_DARWIN_LINKER_FEATURES($1)
1148 ;;
1149@@ -5818,7 +6197,7 @@
1150 ;;
1151 *)
1152 if test "$GXX" = yes; then
1153- _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
1154+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
1155 else
1156 # FIXME: insert proper C++ library support
1157 _LT_TAGVAR(ld_shlibs, $1)=no
1158@@ -5889,10 +6268,10 @@
1159 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
1160 ;;
1161 ia64*)
1162- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
1163+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
1164 ;;
1165 *)
1166- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
1167+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
1168 ;;
1169 esac
1170 fi
1171@@ -5933,9 +6312,9 @@
1172 *)
1173 if test "$GXX" = yes; then
1174 if test "$with_gnu_ld" = no; then
1175- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
1176+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
1177 else
1178- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
1179+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
1180 fi
1181 fi
1182 _LT_TAGVAR(link_all_deplibs, $1)=yes
1183@@ -6005,20 +6384,20 @@
1184 _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
1185 rm -rf $tpldir~
1186 $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
1187- compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
1188+ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
1189 _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
1190 rm -rf $tpldir~
1191 $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
1192- $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
1193+ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
1194 $RANLIB $oldlib'
1195 _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
1196 rm -rf $tpldir~
1197 $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
1198- $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
1199+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
1200 _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
1201 rm -rf $tpldir~
1202 $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
1203- $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
1204+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
1205 ;;
1206 *) # Version 6 and above use weak symbols
1207 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
1208@@ -6213,7 +6592,7 @@
1209 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
1210 ;;
1211 *)
1212- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
1213+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
1214 ;;
1215 esac
1216
1217@@ -6259,7 +6638,7 @@
1218
1219 solaris*)
1220 case $cc_basename in
1221- CC*)
1222+ CC* | sunCC*)
1223 # Sun C++ 4.2, 5.x and Centerline C++
1224 _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
1225 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
1226@@ -6300,9 +6679,9 @@
1227 if test "$GXX" = yes && test "$with_gnu_ld" = no; then
1228 _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
1229 if $CC --version | $GREP -v '^2\.7' > /dev/null; then
1230- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
1231+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
1232 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
1233- $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
1234+ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
1235
1236 # Commands to make compiler produce verbose output that lists
1237 # what "hidden" libraries, object files and flags are used when
1238@@ -6431,6 +6810,7 @@
1239 fi # test -n "$compiler"
1240
1241 CC=$lt_save_CC
1242+ CFLAGS=$lt_save_CFLAGS
1243 LDCXX=$LD
1244 LD=$lt_save_LD
1245 GCC=$lt_save_GCC
1246@@ -6445,6 +6825,29 @@
1247 ])# _LT_LANG_CXX_CONFIG
1248
1249
1250+# _LT_FUNC_STRIPNAME_CNF
1251+# ----------------------
1252+# func_stripname_cnf prefix suffix name
1253+# strip PREFIX and SUFFIX off of NAME.
1254+# PREFIX and SUFFIX must not contain globbing or regex special
1255+# characters, hashes, percent signs, but SUFFIX may contain a leading
1256+# dot (in which case that matches only a dot).
1257+#
1258+# This function is identical to the (non-XSI) version of func_stripname,
1259+# except this one can be used by m4 code that may be executed by configure,
1260+# rather than the libtool script.
1261+m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
1262+AC_REQUIRE([_LT_DECL_SED])
1263+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
1264+func_stripname_cnf ()
1265+{
1266+ case ${2} in
1267+ .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
1268+ *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
1269+ esac
1270+} # func_stripname_cnf
1271+])# _LT_FUNC_STRIPNAME_CNF
1272+
1273 # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
1274 # ---------------------------------
1275 # Figure out "hidden" library dependencies from verbose
1276@@ -6453,6 +6856,7 @@
1277 # objects, libraries and library flags.
1278 m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
1279 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
1280+AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
1281 # Dependencies to place before and after the object being linked:
1282 _LT_TAGVAR(predep_objects, $1)=
1283 _LT_TAGVAR(postdep_objects, $1)=
1284@@ -6503,6 +6907,13 @@
1285 };
1286 _LT_EOF
1287 ])
1288+
1289+_lt_libdeps_save_CFLAGS=$CFLAGS
1290+case "$CC $CFLAGS " in #(
1291+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
1292+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
1293+esac
1294+
1295 dnl Parse the compiler output and extract the necessary
1296 dnl objects, libraries and library flags.
1297 if AC_TRY_EVAL(ac_compile); then
1298@@ -6514,7 +6925,7 @@
1299 pre_test_object_deps_done=no
1300
1301 for p in `eval "$output_verbose_link_cmd"`; do
1302- case $p in
1303+ case ${prev}${p} in
1304
1305 -L* | -R* | -l*)
1306 # Some compilers place space between "-{L,R}" and the path.
1307@@ -6523,13 +6934,22 @@
1308 test $p = "-R"; then
1309 prev=$p
1310 continue
1311- else
1312- prev=
1313 fi
1314
1315+ # Expand the sysroot to ease extracting the directories later.
1316+ if test -z "$prev"; then
1317+ case $p in
1318+ -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
1319+ -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
1320+ -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
1321+ esac
1322+ fi
1323+ case $p in
1324+ =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
1325+ esac
1326 if test "$pre_test_object_deps_done" = no; then
1327- case $p in
1328- -L* | -R*)
1329+ case ${prev} in
1330+ -L | -R)
1331 # Internal compiler library paths should come after those
1332 # provided the user. The postdeps already come after the
1333 # user supplied libs so there is no need to process them.
1334@@ -6549,8 +6969,10 @@
1335 _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
1336 fi
1337 fi
1338+ prev=
1339 ;;
1340
1341+ *.lto.$objext) ;; # Ignore GCC LTO objects
1342 *.$objext)
1343 # This assumes that the test object file only shows up
1344 # once in the compiler output.
1345@@ -6586,6 +7008,7 @@
1346 fi
1347
1348 $RM -f confest.$objext
1349+CFLAGS=$_lt_libdeps_save_CFLAGS
1350
1351 # PORTME: override above test on systems where it is broken
1352 m4_if([$1], [CXX],
1353@@ -6622,7 +7045,7 @@
1354
1355 solaris*)
1356 case $cc_basename in
1357- CC*)
1358+ CC* | sunCC*)
1359 # The more standards-conforming stlport4 library is
1360 # incompatible with the Cstd library. Avoid specifying
1361 # it if it's in CXXFLAGS. Ignore libCrun as
1362@@ -6735,7 +7158,9 @@
1363 # Allow CC to be a program name with arguments.
1364 lt_save_CC="$CC"
1365 lt_save_GCC=$GCC
1366+ lt_save_CFLAGS=$CFLAGS
1367 CC=${F77-"f77"}
1368+ CFLAGS=$FFLAGS
1369 compiler=$CC
1370 _LT_TAGVAR(compiler, $1)=$CC
1371 _LT_CC_BASENAME([$compiler])
1372@@ -6789,6 +7214,7 @@
1373
1374 GCC=$lt_save_GCC
1375 CC="$lt_save_CC"
1376+ CFLAGS="$lt_save_CFLAGS"
1377 fi # test "$_lt_disable_F77" != yes
1378
1379 AC_LANG_POP
1380@@ -6865,7 +7291,9 @@
1381 # Allow CC to be a program name with arguments.
1382 lt_save_CC="$CC"
1383 lt_save_GCC=$GCC
1384+ lt_save_CFLAGS=$CFLAGS
1385 CC=${FC-"f95"}
1386+ CFLAGS=$FCFLAGS
1387 compiler=$CC
1388 GCC=$ac_cv_fc_compiler_gnu
1389
1390@@ -6921,7 +7349,8 @@
1391 fi # test -n "$compiler"
1392
1393 GCC=$lt_save_GCC
1394- CC="$lt_save_CC"
1395+ CC=$lt_save_CC
1396+ CFLAGS=$lt_save_CFLAGS
1397 fi # test "$_lt_disable_FC" != yes
1398
1399 AC_LANG_POP
1400@@ -6958,10 +7387,12 @@
1401 _LT_LINKER_BOILERPLATE
1402
1403 # Allow CC to be a program name with arguments.
1404-lt_save_CC="$CC"
1405+lt_save_CC=$CC
1406+lt_save_CFLAGS=$CFLAGS
1407 lt_save_GCC=$GCC
1408 GCC=yes
1409 CC=${GCJ-"gcj"}
1410+CFLAGS=$GCJFLAGS
1411 compiler=$CC
1412 _LT_TAGVAR(compiler, $1)=$CC
1413 _LT_TAGVAR(LD, $1)="$LD"
1414@@ -6992,7 +7423,8 @@
1415 AC_LANG_RESTORE
1416
1417 GCC=$lt_save_GCC
1418-CC="$lt_save_CC"
1419+CC=$lt_save_CC
1420+CFLAGS=$lt_save_CFLAGS
1421 ])# _LT_LANG_GCJ_CONFIG
1422
1423
1424@@ -7027,9 +7459,11 @@
1425
1426 # Allow CC to be a program name with arguments.
1427 lt_save_CC="$CC"
1428+lt_save_CFLAGS=$CFLAGS
1429 lt_save_GCC=$GCC
1430 GCC=
1431 CC=${RC-"windres"}
1432+CFLAGS=
1433 compiler=$CC
1434 _LT_TAGVAR(compiler, $1)=$CC
1435 _LT_CC_BASENAME([$compiler])
1436@@ -7042,7 +7476,8 @@
1437
1438 GCC=$lt_save_GCC
1439 AC_LANG_RESTORE
1440-CC="$lt_save_CC"
1441+CC=$lt_save_CC
1442+CFLAGS=$lt_save_CFLAGS
1443 ])# _LT_LANG_RC_CONFIG
1444
1445
1446@@ -7101,6 +7536,15 @@
1447 AC_SUBST([OBJDUMP])
1448 ])
1449
1450+# _LT_DECL_DLLTOOL
1451+# ----------------
1452+# Ensure DLLTOOL variable is set.
1453+m4_defun([_LT_DECL_DLLTOOL],
1454+[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
1455+test -z "$DLLTOOL" && DLLTOOL=dlltool
1456+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
1457+AC_SUBST([DLLTOOL])
1458+])
1459
1460 # _LT_DECL_SED
1461 # ------------
1462@@ -7194,8 +7638,8 @@
1463 # Try some XSI features
1464 xsi_shell=no
1465 ( _lt_dummy="a/b/c"
1466- test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
1467- = c,a/b,, \
1468+ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
1469+ = c,a/b,b/c, \
1470 && eval 'test $(( 1 + 1 )) -eq 2 \
1471 && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
1472 && xsi_shell=yes
1473@@ -7234,206 +7678,162 @@
1474 ])# _LT_CHECK_SHELL_FEATURES
1475
1476
1477-# _LT_PROG_XSI_SHELLFNS
1478-# ---------------------
1479-# Bourne and XSI compatible variants of some useful shell functions.
1480-m4_defun([_LT_PROG_XSI_SHELLFNS],
1481-[case $xsi_shell in
1482- yes)
1483- cat << \_LT_EOF >> "$cfgfile"
1484-
1485-# func_dirname file append nondir_replacement
1486-# Compute the dirname of FILE. If nonempty, add APPEND to the result,
1487-# otherwise set result to NONDIR_REPLACEMENT.
1488-func_dirname ()
1489-{
1490- case ${1} in
1491- */*) func_dirname_result="${1%/*}${2}" ;;
1492- * ) func_dirname_result="${3}" ;;
1493- esac
1494-}
1495-
1496-# func_basename file
1497-func_basename ()
1498-{
1499- func_basename_result="${1##*/}"
1500-}
1501-
1502-# func_dirname_and_basename file append nondir_replacement
1503-# perform func_basename and func_dirname in a single function
1504-# call:
1505-# dirname: Compute the dirname of FILE. If nonempty,
1506-# add APPEND to the result, otherwise set result
1507-# to NONDIR_REPLACEMENT.
1508-# value returned in "$func_dirname_result"
1509-# basename: Compute filename of FILE.
1510-# value retuned in "$func_basename_result"
1511-# Implementation must be kept synchronized with func_dirname
1512-# and func_basename. For efficiency, we do not delegate to
1513-# those functions but instead duplicate the functionality here.
1514-func_dirname_and_basename ()
1515-{
1516- case ${1} in
1517- */*) func_dirname_result="${1%/*}${2}" ;;
1518- * ) func_dirname_result="${3}" ;;
1519- esac
1520- func_basename_result="${1##*/}"
1521-}
1522-
1523-# func_stripname prefix suffix name
1524-# strip PREFIX and SUFFIX off of NAME.
1525-# PREFIX and SUFFIX must not contain globbing or regex special
1526-# characters, hashes, percent signs, but SUFFIX may contain a leading
1527-# dot (in which case that matches only a dot).
1528-func_stripname ()
1529-{
1530- # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1531- # positional parameters, so assign one to ordinary parameter first.
1532- func_stripname_result=${3}
1533- func_stripname_result=${func_stripname_result#"${1}"}
1534- func_stripname_result=${func_stripname_result%"${2}"}
1535-}
1536-
1537-# func_opt_split
1538-func_opt_split ()
1539-{
1540- func_opt_split_opt=${1%%=*}
1541- func_opt_split_arg=${1#*=}
1542-}
1543-
1544-# func_lo2o object
1545-func_lo2o ()
1546-{
1547- case ${1} in
1548- *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
1549- *) func_lo2o_result=${1} ;;
1550- esac
1551-}
1552-
1553-# func_xform libobj-or-source
1554-func_xform ()
1555-{
1556- func_xform_result=${1%.*}.lo
1557-}
1558-
1559-# func_arith arithmetic-term...
1560-func_arith ()
1561-{
1562- func_arith_result=$(( $[*] ))
1563-}
1564-
1565-# func_len string
1566-# STRING may not start with a hyphen.
1567-func_len ()
1568-{
1569- func_len_result=${#1}
1570-}
1571-
1572-_LT_EOF
1573- ;;
1574- *) # Bourne compatible functions.
1575- cat << \_LT_EOF >> "$cfgfile"
1576-
1577-# func_dirname file append nondir_replacement
1578-# Compute the dirname of FILE. If nonempty, add APPEND to the result,
1579-# otherwise set result to NONDIR_REPLACEMENT.
1580-func_dirname ()
1581-{
1582- # Extract subdirectory from the argument.
1583- func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
1584- if test "X$func_dirname_result" = "X${1}"; then
1585- func_dirname_result="${3}"
1586- else
1587- func_dirname_result="$func_dirname_result${2}"
1588- fi
1589-}
1590-
1591-# func_basename file
1592-func_basename ()
1593-{
1594- func_basename_result=`$ECHO "${1}" | $SED "$basename"`
1595-}
1596+# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
1597+# ------------------------------------------------------
1598+# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
1599+# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
1600+m4_defun([_LT_PROG_FUNCTION_REPLACE],
1601+[dnl {
1602+sed -e '/^$1 ()$/,/^} # $1 /c\
1603+$1 ()\
1604+{\
1605+m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1])
1606+} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
1607+ && mv -f "$cfgfile.tmp" "$cfgfile" \
1608+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
1609+test 0 -eq $? || _lt_function_replace_fail=:
1610+])
1611
1612-dnl func_dirname_and_basename
1613-dnl A portable version of this function is already defined in general.m4sh
1614-dnl so there is no need for it here.
1615
1616-# func_stripname prefix suffix name
1617-# strip PREFIX and SUFFIX off of NAME.
1618-# PREFIX and SUFFIX must not contain globbing or regex special
1619-# characters, hashes, percent signs, but SUFFIX may contain a leading
1620-# dot (in which case that matches only a dot).
1621-# func_strip_suffix prefix name
1622-func_stripname ()
1623-{
1624- case ${2} in
1625- .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
1626- *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
1627- esac
1628-}
1629+# _LT_PROG_REPLACE_SHELLFNS
1630+# -------------------------
1631+# Replace existing portable implementations of several shell functions with
1632+# equivalent extended shell implementations where those features are available..
1633+m4_defun([_LT_PROG_REPLACE_SHELLFNS],
1634+[if test x"$xsi_shell" = xyes; then
1635+ _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
1636+ case ${1} in
1637+ */*) func_dirname_result="${1%/*}${2}" ;;
1638+ * ) func_dirname_result="${3}" ;;
1639+ esac])
1640+
1641+ _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
1642+ func_basename_result="${1##*/}"])
1643+
1644+ _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
1645+ case ${1} in
1646+ */*) func_dirname_result="${1%/*}${2}" ;;
1647+ * ) func_dirname_result="${3}" ;;
1648+ esac
1649+ func_basename_result="${1##*/}"])
1650
1651-# sed scripts:
1652-my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q'
1653-my_sed_long_arg='1s/^-[[^=]]*=//'
1654+ _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
1655+ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1656+ # positional parameters, so assign one to ordinary parameter first.
1657+ func_stripname_result=${3}
1658+ func_stripname_result=${func_stripname_result#"${1}"}
1659+ func_stripname_result=${func_stripname_result%"${2}"}])
1660+
1661+ _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
1662+ func_split_long_opt_name=${1%%=*}
1663+ func_split_long_opt_arg=${1#*=}])
1664+
1665+ _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
1666+ func_split_short_opt_arg=${1#??}
1667+ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
1668+
1669+ _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
1670+ case ${1} in
1671+ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
1672+ *) func_lo2o_result=${1} ;;
1673+ esac])
1674
1675-# func_opt_split
1676-func_opt_split ()
1677-{
1678- func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"`
1679- func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"`
1680-}
1681+ _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo])
1682
1683-# func_lo2o object
1684-func_lo2o ()
1685-{
1686- func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
1687-}
1688+ _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))])
1689
1690-# func_xform libobj-or-source
1691-func_xform ()
1692-{
1693- func_xform_result=`$ECHO "${1}" | $SED 's/\.[[^.]]*$/.lo/'`
1694-}
1695+ _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}])
1696+fi
1697
1698-# func_arith arithmetic-term...
1699-func_arith ()
1700-{
1701- func_arith_result=`expr "$[@]"`
1702-}
1703+if test x"$lt_shell_append" = xyes; then
1704+ _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"])
1705
1706-# func_len string
1707-# STRING may not start with a hyphen.
1708-func_len ()
1709-{
1710- func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len`
1711-}
1712+ _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
1713+ func_quote_for_eval "${2}"
1714+dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
1715+ eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
1716+
1717+ # Save a `func_append' function call where possible by direct use of '+='
1718+ sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
1719+ && mv -f "$cfgfile.tmp" "$cfgfile" \
1720+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
1721+ test 0 -eq $? || _lt_function_replace_fail=:
1722+else
1723+ # Save a `func_append' function call even when '+=' is not available
1724+ sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
1725+ && mv -f "$cfgfile.tmp" "$cfgfile" \
1726+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
1727+ test 0 -eq $? || _lt_function_replace_fail=:
1728+fi
1729
1730-_LT_EOF
1731-esac
1732+if test x"$_lt_function_replace_fail" = x":"; then
1733+ AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
1734+fi
1735+])
1736
1737-case $lt_shell_append in
1738- yes)
1739- cat << \_LT_EOF >> "$cfgfile"
1740-
1741-# func_append var value
1742-# Append VALUE to the end of shell variable VAR.
1743-func_append ()
1744-{
1745- eval "$[1]+=\$[2]"
1746-}
1747-_LT_EOF
1748+# _LT_PATH_CONVERSION_FUNCTIONS
1749+# -----------------------------
1750+# Determine which file name conversion functions should be used by
1751+# func_to_host_file (and, implicitly, by func_to_host_path). These are needed
1752+# for certain cross-compile configurations and native mingw.
1753+m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
1754+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
1755+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
1756+AC_MSG_CHECKING([how to convert $build file names to $host format])
1757+AC_CACHE_VAL(lt_cv_to_host_file_cmd,
1758+[case $host in
1759+ *-*-mingw* )
1760+ case $build in
1761+ *-*-mingw* ) # actually msys
1762+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
1763+ ;;
1764+ *-*-cygwin* )
1765+ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
1766+ ;;
1767+ * ) # otherwise, assume *nix
1768+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
1769+ ;;
1770+ esac
1771 ;;
1772- *)
1773- cat << \_LT_EOF >> "$cfgfile"
1774-
1775-# func_append var value
1776-# Append VALUE to the end of shell variable VAR.
1777-func_append ()
1778-{
1779- eval "$[1]=\$$[1]\$[2]"
1780-}
1781-
1782-_LT_EOF
1783+ *-*-cygwin* )
1784+ case $build in
1785+ *-*-mingw* ) # actually msys
1786+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
1787+ ;;
1788+ *-*-cygwin* )
1789+ lt_cv_to_host_file_cmd=func_convert_file_noop
1790+ ;;
1791+ * ) # otherwise, assume *nix
1792+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
1793+ ;;
1794+ esac
1795 ;;
1796- esac
1797+ * ) # unhandled hosts (and "normal" native builds)
1798+ lt_cv_to_host_file_cmd=func_convert_file_noop
1799+ ;;
1800+esac
1801+])
1802+to_host_file_cmd=$lt_cv_to_host_file_cmd
1803+AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
1804+_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
1805+ [0], [convert $build file names to $host format])dnl
1806+
1807+AC_MSG_CHECKING([how to convert $build file names to toolchain format])
1808+AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
1809+[#assume ordinary cross tools, or native build.
1810+lt_cv_to_tool_file_cmd=func_convert_file_noop
1811+case $host in
1812+ *-*-mingw* )
1813+ case $build in
1814+ *-*-mingw* ) # actually msys
1815+ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
1816+ ;;
1817+ esac
1818+ ;;
1819+esac
1820 ])
1821+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
1822+AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
1823+_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
1824+ [0], [convert $build files to toolchain format])dnl
1825+])# _LT_PATH_CONVERSION_FUNCTIONS
1826Index: binutils-2.24/ltmain.sh
1827===================================================================
1828--- binutils-2.24.orig/ltmain.sh 2013-11-04 07:33:40.000000000 -0800
1829+++ binutils-2.24/ltmain.sh 2013-12-15 11:10:23.867118697 -0800
1830@@ -1,10 +1,9 @@
1831-# Generated from ltmain.m4sh.
1832
1833-# libtool (GNU libtool 1.3134 2009-11-29) 2.2.7a
1834+# libtool (GNU libtool) 2.4
1835 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
1836
1837 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
1838-# 2007, 2008, 2009 Free Software Foundation, Inc.
1839+# 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
1840 # This is free software; see the source for copying conditions. There is NO
1841 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1842
1843@@ -38,7 +37,6 @@
1844 # -n, --dry-run display commands without modifying any files
1845 # --features display basic configuration information and exit
1846 # --mode=MODE use operation mode MODE
1847-# --no-finish let install mode avoid finish commands
1848 # --preserve-dup-deps don't remove duplicate dependency libraries
1849 # --quiet, --silent don't print informational messages
1850 # --no-quiet, --no-silent
1851@@ -71,17 +69,19 @@
1852 # compiler: $LTCC
1853 # compiler flags: $LTCFLAGS
1854 # linker: $LD (gnu? $with_gnu_ld)
1855-# $progname: (GNU libtool 1.3134 2009-11-29) 2.2.7a
1856+# $progname: (GNU libtool) 2.4
1857 # automake: $automake_version
1858 # autoconf: $autoconf_version
1859 #
1860 # Report bugs to <bug-libtool@gnu.org>.
1861+# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
1862+# General help using GNU software: <http://www.gnu.org/gethelp/>.
1863
1864 PROGRAM=libtool
1865 PACKAGE=libtool
1866-VERSION=2.2.7a
1867-TIMESTAMP=" 1.3134 2009-11-29"
1868-package_revision=1.3134
1869+VERSION=2.4
1870+TIMESTAMP=""
1871+package_revision=1.3293
1872
1873 # Be Bourne compatible
1874 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
1875@@ -106,9 +106,6 @@
1876 }
1877
1878 # NLS nuisances: We save the old values to restore during execute mode.
1879-# Only set LANG and LC_ALL to C if already set.
1880-# These must not be set unconditionally because not all systems understand
1881-# e.g. LANG=C (notably SCO).
1882 lt_user_locale=
1883 lt_safe_locale=
1884 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1885@@ -121,15 +118,13 @@
1886 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
1887 fi"
1888 done
1889+LC_ALL=C
1890+LANGUAGE=C
1891+export LANGUAGE LC_ALL
1892
1893 $lt_unset CDPATH
1894
1895
1896-
1897-
1898-
1899-
1900-
1901 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
1902 # is ksh but when the shell is invoked as "sh" and the current value of
1903 # the _XPG environment variable is not equal to 1 (one), the special
1904@@ -140,7 +135,7 @@
1905
1906
1907 : ${CP="cp -f"}
1908-: ${ECHO=$as_echo}
1909+test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
1910 : ${EGREP="/bin/grep -E"}
1911 : ${FGREP="/bin/grep -F"}
1912 : ${GREP="/bin/grep"}
1913@@ -149,7 +144,7 @@
1914 : ${MKDIR="mkdir"}
1915 : ${MV="mv -f"}
1916 : ${RM="rm -f"}
1917-: ${SED="/mount/endor/wildenhu/local-x86_64/bin/sed"}
1918+: ${SED="/bin/sed"}
1919 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
1920 : ${Xsed="$SED -e 1s/^X//"}
1921
1922@@ -169,6 +164,27 @@
1923 dirname="s,/[^/]*$,,"
1924 basename="s,^.*/,,"
1925
1926+# func_dirname file append nondir_replacement
1927+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
1928+# otherwise set result to NONDIR_REPLACEMENT.
1929+func_dirname ()
1930+{
1931+ func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
1932+ if test "X$func_dirname_result" = "X${1}"; then
1933+ func_dirname_result="${3}"
1934+ else
1935+ func_dirname_result="$func_dirname_result${2}"
1936+ fi
1937+} # func_dirname may be replaced by extended shell implementation
1938+
1939+
1940+# func_basename file
1941+func_basename ()
1942+{
1943+ func_basename_result=`$ECHO "${1}" | $SED "$basename"`
1944+} # func_basename may be replaced by extended shell implementation
1945+
1946+
1947 # func_dirname_and_basename file append nondir_replacement
1948 # perform func_basename and func_dirname in a single function
1949 # call:
1950@@ -183,17 +199,31 @@
1951 # those functions but instead duplicate the functionality here.
1952 func_dirname_and_basename ()
1953 {
1954- # Extract subdirectory from the argument.
1955- func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
1956- if test "X$func_dirname_result" = "X${1}"; then
1957- func_dirname_result="${3}"
1958- else
1959- func_dirname_result="$func_dirname_result${2}"
1960- fi
1961- func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
1962-}
1963+ # Extract subdirectory from the argument.
1964+ func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
1965+ if test "X$func_dirname_result" = "X${1}"; then
1966+ func_dirname_result="${3}"
1967+ else
1968+ func_dirname_result="$func_dirname_result${2}"
1969+ fi
1970+ func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
1971+} # func_dirname_and_basename may be replaced by extended shell implementation
1972+
1973+
1974+# func_stripname prefix suffix name
1975+# strip PREFIX and SUFFIX off of NAME.
1976+# PREFIX and SUFFIX must not contain globbing or regex special
1977+# characters, hashes, percent signs, but SUFFIX may contain a leading
1978+# dot (in which case that matches only a dot).
1979+# func_strip_suffix prefix name
1980+func_stripname ()
1981+{
1982+ case ${2} in
1983+ .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
1984+ *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
1985+ esac
1986+} # func_stripname may be replaced by extended shell implementation
1987
1988-# Generated shell functions inserted here.
1989
1990 # These SED scripts presuppose an absolute path with a trailing slash.
1991 pathcar='s,^/\([^/]*\).*$,\1,'
1992@@ -376,6 +406,15 @@
1993 # Same as above, but do not quote variable references.
1994 double_quote_subst='s/\(["`\\]\)/\\\1/g'
1995
1996+# Sed substitution that turns a string into a regex matching for the
1997+# string literally.
1998+sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
1999+
2000+# Sed substitution that converts a w32 file name or path
2001+# which contains forward slashes, into one that contains
2002+# (escaped) backslashes. A very naive implementation.
2003+lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
2004+
2005 # Re-`\' parameter expansions in output of double_quote_subst that were
2006 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
2007 # in input to double_quote_subst, that '$' was protected from expansion.
2008@@ -404,7 +443,7 @@
2009 # name if it has been set yet.
2010 func_echo ()
2011 {
2012- $ECHO "$progname${mode+: }$mode: $*"
2013+ $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
2014 }
2015
2016 # func_verbose arg...
2017@@ -430,14 +469,14 @@
2018 # Echo program name prefixed message to standard error.
2019 func_error ()
2020 {
2021- $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
2022+ $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
2023 }
2024
2025 # func_warning arg...
2026 # Echo program name prefixed warning message to standard error.
2027 func_warning ()
2028 {
2029- $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
2030+ $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
2031
2032 # bash bug again:
2033 :
2034@@ -656,19 +695,35 @@
2035 fi
2036 }
2037
2038-
2039-
2040+# func_tr_sh
2041+# Turn $1 into a string suitable for a shell variable name.
2042+# Result is stored in $func_tr_sh_result. All characters
2043+# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
2044+# if $1 begins with a digit, a '_' is prepended as well.
2045+func_tr_sh ()
2046+{
2047+ case $1 in
2048+ [0-9]* | *[!a-zA-Z0-9_]*)
2049+ func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
2050+ ;;
2051+ * )
2052+ func_tr_sh_result=$1
2053+ ;;
2054+ esac
2055+}
2056
2057
2058 # func_version
2059 # Echo version message to standard output and exit.
2060 func_version ()
2061 {
2062+ $opt_debug
2063+
2064 $SED -n '/(C)/!b go
2065 :more
2066 /\./!{
2067 N
2068- s/\n# //
2069+ s/\n# / /
2070 b more
2071 }
2072 :go
2073@@ -685,7 +740,9 @@
2074 # Echo short help message to standard output and exit.
2075 func_usage ()
2076 {
2077- $SED -n '/^# Usage:/,/^# *-h/ {
2078+ $opt_debug
2079+
2080+ $SED -n '/^# Usage:/,/^# *.*--help/ {
2081 s/^# //
2082 s/^# *$//
2083 s/\$progname/'$progname'/
2084@@ -701,7 +758,10 @@
2085 # unless 'noexit' is passed as argument.
2086 func_help ()
2087 {
2088+ $opt_debug
2089+
2090 $SED -n '/^# Usage:/,/# Report bugs to/ {
2091+ :print
2092 s/^# //
2093 s/^# *$//
2094 s*\$progname*'$progname'*
2095@@ -714,7 +774,11 @@
2096 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
2097 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
2098 p
2099- }' < "$progpath"
2100+ d
2101+ }
2102+ /^# .* home page:/b print
2103+ /^# General help using/b print
2104+ ' < "$progpath"
2105 ret=$?
2106 if test -z "$1"; then
2107 exit $ret
2108@@ -726,12 +790,39 @@
2109 # exit_cmd.
2110 func_missing_arg ()
2111 {
2112- func_error "missing argument for $1"
2113+ $opt_debug
2114+
2115+ func_error "missing argument for $1."
2116 exit_cmd=exit
2117 }
2118
2119-exit_cmd=:
2120
2121+# func_split_short_opt shortopt
2122+# Set func_split_short_opt_name and func_split_short_opt_arg shell
2123+# variables after splitting SHORTOPT after the 2nd character.
2124+func_split_short_opt ()
2125+{
2126+ my_sed_short_opt='1s/^\(..\).*$/\1/;q'
2127+ my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
2128+
2129+ func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
2130+ func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
2131+} # func_split_short_opt may be replaced by extended shell implementation
2132+
2133+
2134+# func_split_long_opt longopt
2135+# Set func_split_long_opt_name and func_split_long_opt_arg shell
2136+# variables after splitting LONGOPT at the `=' sign.
2137+func_split_long_opt ()
2138+{
2139+ my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
2140+ my_sed_long_arg='1s/^--[^=]*=//'
2141+
2142+ func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
2143+ func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
2144+} # func_split_long_opt may be replaced by extended shell implementation
2145+
2146+exit_cmd=:
2147
2148
2149
2150@@ -741,26 +832,64 @@
2151 magic_exe="%%%MAGIC EXE variable%%%"
2152
2153 # Global variables.
2154-# $mode is unset
2155 nonopt=
2156-execute_dlfiles=
2157 preserve_args=
2158 lo2o="s/\\.lo\$/.${objext}/"
2159 o2lo="s/\\.${objext}\$/.lo/"
2160 extracted_archives=
2161 extracted_serial=0
2162
2163-opt_dry_run=false
2164-opt_finish=:
2165-opt_duplicate_deps=false
2166-opt_silent=false
2167-opt_debug=:
2168-
2169 # If this variable is set in any of the actions, the command in it
2170 # will be execed at the end. This prevents here-documents from being
2171 # left over by shells.
2172 exec_cmd=
2173
2174+# func_append var value
2175+# Append VALUE to the end of shell variable VAR.
2176+func_append ()
2177+{
2178+ eval "${1}=\$${1}\${2}"
2179+} # func_append may be replaced by extended shell implementation
2180+
2181+# func_append_quoted var value
2182+# Quote VALUE and append to the end of shell variable VAR, separated
2183+# by a space.
2184+func_append_quoted ()
2185+{
2186+ func_quote_for_eval "${2}"
2187+ eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
2188+} # func_append_quoted may be replaced by extended shell implementation
2189+
2190+
2191+# func_arith arithmetic-term...
2192+func_arith ()
2193+{
2194+ func_arith_result=`expr "${@}"`
2195+} # func_arith may be replaced by extended shell implementation
2196+
2197+
2198+# func_len string
2199+# STRING may not start with a hyphen.
2200+func_len ()
2201+{
2202+ func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
2203+} # func_len may be replaced by extended shell implementation
2204+
2205+
2206+# func_lo2o object
2207+func_lo2o ()
2208+{
2209+ func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
2210+} # func_lo2o may be replaced by extended shell implementation
2211+
2212+
2213+# func_xform libobj-or-source
2214+func_xform ()
2215+{
2216+ func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
2217+} # func_xform may be replaced by extended shell implementation
2218+
2219+
2220 # func_fatal_configuration arg...
2221 # Echo program name prefixed message to standard error, followed by
2222 # a configuration failure hint, and exit.
2223@@ -850,130 +979,204 @@
2224 esac
2225 }
2226
2227-# Parse options once, thoroughly. This comes as soon as possible in
2228-# the script to make things like `libtool --version' happen quickly.
2229+# func_check_version_match
2230+# Ensure that we are using m4 macros, and libtool script from the same
2231+# release of libtool.
2232+func_check_version_match ()
2233 {
2234+ if test "$package_revision" != "$macro_revision"; then
2235+ if test "$VERSION" != "$macro_version"; then
2236+ if test -z "$macro_version"; then
2237+ cat >&2 <<_LT_EOF
2238+$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2239+$progname: definition of this LT_INIT comes from an older release.
2240+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2241+$progname: and run autoconf again.
2242+_LT_EOF
2243+ else
2244+ cat >&2 <<_LT_EOF
2245+$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2246+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2247+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2248+$progname: and run autoconf again.
2249+_LT_EOF
2250+ fi
2251+ else
2252+ cat >&2 <<_LT_EOF
2253+$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
2254+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
2255+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
2256+$progname: of $PACKAGE $VERSION and run autoconf again.
2257+_LT_EOF
2258+ fi
2259+
2260+ exit $EXIT_MISMATCH
2261+ fi
2262+}
2263+
2264+
2265+# Shorthand for --mode=foo, only valid as the first argument
2266+case $1 in
2267+clean|clea|cle|cl)
2268+ shift; set dummy --mode clean ${1+"$@"}; shift
2269+ ;;
2270+compile|compil|compi|comp|com|co|c)
2271+ shift; set dummy --mode compile ${1+"$@"}; shift
2272+ ;;
2273+execute|execut|execu|exec|exe|ex|e)
2274+ shift; set dummy --mode execute ${1+"$@"}; shift
2275+ ;;
2276+finish|finis|fini|fin|fi|f)
2277+ shift; set dummy --mode finish ${1+"$@"}; shift
2278+ ;;
2279+install|instal|insta|inst|ins|in|i)
2280+ shift; set dummy --mode install ${1+"$@"}; shift
2281+ ;;
2282+link|lin|li|l)
2283+ shift; set dummy --mode link ${1+"$@"}; shift
2284+ ;;
2285+uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
2286+ shift; set dummy --mode uninstall ${1+"$@"}; shift
2287+ ;;
2288+esac
2289
2290- # Shorthand for --mode=foo, only valid as the first argument
2291- case $1 in
2292- clean|clea|cle|cl)
2293- shift; set dummy --mode clean ${1+"$@"}; shift
2294- ;;
2295- compile|compil|compi|comp|com|co|c)
2296- shift; set dummy --mode compile ${1+"$@"}; shift
2297- ;;
2298- execute|execut|execu|exec|exe|ex|e)
2299- shift; set dummy --mode execute ${1+"$@"}; shift
2300- ;;
2301- finish|finis|fini|fin|fi|f)
2302- shift; set dummy --mode finish ${1+"$@"}; shift
2303- ;;
2304- install|instal|insta|inst|ins|in|i)
2305- shift; set dummy --mode install ${1+"$@"}; shift
2306- ;;
2307- link|lin|li|l)
2308- shift; set dummy --mode link ${1+"$@"}; shift
2309- ;;
2310- uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
2311- shift; set dummy --mode uninstall ${1+"$@"}; shift
2312- ;;
2313- esac
2314
2315- # Parse non-mode specific arguments:
2316- while test "$#" -gt 0; do
2317+
2318+# Option defaults:
2319+opt_debug=:
2320+opt_dry_run=false
2321+opt_config=false
2322+opt_preserve_dup_deps=false
2323+opt_features=false
2324+opt_finish=false
2325+opt_help=false
2326+opt_help_all=false
2327+opt_silent=:
2328+opt_verbose=:
2329+opt_silent=false
2330+opt_verbose=false
2331+
2332+
2333+# Parse options once, thoroughly. This comes as soon as possible in the
2334+# script to make things like `--version' happen as quickly as we can.
2335+{
2336+ # this just eases exit handling
2337+ while test $# -gt 0; do
2338 opt="$1"
2339 shift
2340-
2341 case $opt in
2342- --config) func_config ;;
2343-
2344- --debug) preserve_args="$preserve_args $opt"
2345+ --debug|-x) opt_debug='set -x'
2346 func_echo "enabling shell trace mode"
2347- opt_debug='set -x'
2348 $opt_debug
2349 ;;
2350-
2351- -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
2352- execute_dlfiles="$execute_dlfiles $1"
2353- shift
2354+ --dry-run|--dryrun|-n)
2355+ opt_dry_run=:
2356 ;;
2357-
2358- --dry-run | -n) opt_dry_run=: ;;
2359- --features) func_features ;;
2360- --finish) mode="finish" ;;
2361- --no-finish) opt_finish=false ;;
2362-
2363- --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
2364- case $1 in
2365- # Valid mode arguments:
2366- clean) ;;
2367- compile) ;;
2368- execute) ;;
2369- finish) ;;
2370- install) ;;
2371- link) ;;
2372- relink) ;;
2373- uninstall) ;;
2374-
2375- # Catch anything else as an error
2376- *) func_error "invalid argument for $opt"
2377- exit_cmd=exit
2378- break
2379- ;;
2380- esac
2381-
2382- mode="$1"
2383+ --config)
2384+ opt_config=:
2385+func_config
2386+ ;;
2387+ --dlopen|-dlopen)
2388+ optarg="$1"
2389+ opt_dlopen="${opt_dlopen+$opt_dlopen
2390+}$optarg"
2391 shift
2392 ;;
2393-
2394 --preserve-dup-deps)
2395- opt_duplicate_deps=: ;;
2396-
2397- --quiet|--silent) preserve_args="$preserve_args $opt"
2398- opt_silent=:
2399- opt_verbose=false
2400+ opt_preserve_dup_deps=:
2401 ;;
2402-
2403- --no-quiet|--no-silent)
2404- preserve_args="$preserve_args $opt"
2405- opt_silent=false
2406+ --features)
2407+ opt_features=:
2408+func_features
2409 ;;
2410-
2411- --verbose| -v) preserve_args="$preserve_args $opt"
2412+ --finish)
2413+ opt_finish=:
2414+set dummy --mode finish ${1+"$@"}; shift
2415+ ;;
2416+ --help)
2417+ opt_help=:
2418+ ;;
2419+ --help-all)
2420+ opt_help_all=:
2421+opt_help=': help-all'
2422+ ;;
2423+ --mode)
2424+ test $# = 0 && func_missing_arg $opt && break
2425+ optarg="$1"
2426+ opt_mode="$optarg"
2427+case $optarg in
2428+ # Valid mode arguments:
2429+ clean|compile|execute|finish|install|link|relink|uninstall) ;;
2430+
2431+ # Catch anything else as an error
2432+ *) func_error "invalid argument for $opt"
2433+ exit_cmd=exit
2434+ break
2435+ ;;
2436+esac
2437+ shift
2438+ ;;
2439+ --no-silent|--no-quiet)
2440 opt_silent=false
2441- opt_verbose=:
2442+func_append preserve_args " $opt"
2443 ;;
2444-
2445- --no-verbose) preserve_args="$preserve_args $opt"
2446+ --no-verbose)
2447 opt_verbose=false
2448+func_append preserve_args " $opt"
2449 ;;
2450-
2451- --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
2452- preserve_args="$preserve_args $opt $1"
2453- func_enable_tag "$1" # tagname is set here
2454+ --silent|--quiet)
2455+ opt_silent=:
2456+func_append preserve_args " $opt"
2457+ opt_verbose=false
2458+ ;;
2459+ --verbose|-v)
2460+ opt_verbose=:
2461+func_append preserve_args " $opt"
2462+opt_silent=false
2463+ ;;
2464+ --tag)
2465+ test $# = 0 && func_missing_arg $opt && break
2466+ optarg="$1"
2467+ opt_tag="$optarg"
2468+func_append preserve_args " $opt $optarg"
2469+func_enable_tag "$optarg"
2470 shift
2471 ;;
2472
2473+ -\?|-h) func_usage ;;
2474+ --help) func_help ;;
2475+ --version) func_version ;;
2476+
2477 # Separate optargs to long options:
2478- -dlopen=*|--mode=*|--tag=*)
2479- func_opt_split "$opt"
2480- set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
2481+ --*=*)
2482+ func_split_long_opt "$opt"
2483+ set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
2484 shift
2485 ;;
2486
2487- -\?|-h) func_usage ;;
2488- --help) opt_help=: ;;
2489- --help-all) opt_help=': help-all' ;;
2490- --version) func_version ;;
2491-
2492- -*) func_fatal_help "unrecognized option \`$opt'" ;;
2493-
2494- *) nonopt="$opt"
2495- break
2496+ # Separate non-argument short options:
2497+ -\?*|-h*|-n*|-v*)
2498+ func_split_short_opt "$opt"
2499+ set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
2500+ shift
2501 ;;
2502+
2503+ --) break ;;
2504+ -*) func_fatal_help "unrecognized option \`$opt'" ;;
2505+ *) set dummy "$opt" ${1+"$@"}; shift; break ;;
2506 esac
2507 done
2508
2509+ # Validate options:
2510+
2511+ # save first non-option argument
2512+ if test "$#" -gt 0; then
2513+ nonopt="$opt"
2514+ shift
2515+ fi
2516+
2517+ # preserve --debug
2518+ test "$opt_debug" = : || func_append preserve_args " --debug"
2519
2520 case $host in
2521 *cygwin* | *mingw* | *pw32* | *cegcc*)
2522@@ -981,82 +1184,44 @@
2523 opt_duplicate_compiler_generated_deps=:
2524 ;;
2525 *)
2526- opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
2527+ opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
2528 ;;
2529 esac
2530
2531- # Having warned about all mis-specified options, bail out if
2532- # anything was wrong.
2533- $exit_cmd $EXIT_FAILURE
2534-}
2535+ $opt_help || {
2536+ # Sanity checks first:
2537+ func_check_version_match
2538
2539-# func_check_version_match
2540-# Ensure that we are using m4 macros, and libtool script from the same
2541-# release of libtool.
2542-func_check_version_match ()
2543-{
2544- if test "$package_revision" != "$macro_revision"; then
2545- if test "$VERSION" != "$macro_version"; then
2546- if test -z "$macro_version"; then
2547- cat >&2 <<_LT_EOF
2548-$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2549-$progname: definition of this LT_INIT comes from an older release.
2550-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2551-$progname: and run autoconf again.
2552-_LT_EOF
2553- else
2554- cat >&2 <<_LT_EOF
2555-$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2556-$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2557-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2558-$progname: and run autoconf again.
2559-_LT_EOF
2560- fi
2561- else
2562- cat >&2 <<_LT_EOF
2563-$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
2564-$progname: but the definition of this LT_INIT comes from revision $macro_revision.
2565-$progname: You should recreate aclocal.m4 with macros from revision $package_revision
2566-$progname: of $PACKAGE $VERSION and run autoconf again.
2567-_LT_EOF
2568+ if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
2569+ func_fatal_configuration "not configured to build any kind of library"
2570 fi
2571
2572- exit $EXIT_MISMATCH
2573- fi
2574-}
2575-
2576+ # Darwin sucks
2577+ eval std_shrext=\"$shrext_cmds\"
2578
2579-## ----------- ##
2580-## Main. ##
2581-## ----------- ##
2582-
2583-$opt_help || {
2584- # Sanity checks first:
2585- func_check_version_match
2586-
2587- if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
2588- func_fatal_configuration "not configured to build any kind of library"
2589- fi
2590+ # Only execute mode is allowed to have -dlopen flags.
2591+ if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
2592+ func_error "unrecognized option \`-dlopen'"
2593+ $ECHO "$help" 1>&2
2594+ exit $EXIT_FAILURE
2595+ fi
2596
2597- test -z "$mode" && func_fatal_error "error: you must specify a MODE."
2598+ # Change the help message to a mode-specific one.
2599+ generic_help="$help"
2600+ help="Try \`$progname --help --mode=$opt_mode' for more information."
2601+ }
2602
2603
2604- # Darwin sucks
2605- eval "std_shrext=\"$shrext_cmds\""
2606+ # Bail if the options were screwed
2607+ $exit_cmd $EXIT_FAILURE
2608+}
2609
2610
2611- # Only execute mode is allowed to have -dlopen flags.
2612- if test -n "$execute_dlfiles" && test "$mode" != execute; then
2613- func_error "unrecognized option \`-dlopen'"
2614- $ECHO "$help" 1>&2
2615- exit $EXIT_FAILURE
2616- fi
2617
2618- # Change the help message to a mode-specific one.
2619- generic_help="$help"
2620- help="Try \`$progname --help --mode=$mode' for more information."
2621-}
2622
2623+## ----------- ##
2624+## Main. ##
2625+## ----------- ##
2626
2627 # func_lalib_p file
2628 # True iff FILE is a libtool `.la' library or `.lo' object file.
2629@@ -1121,12 +1286,9 @@
2630 # temporary ltwrapper_script.
2631 func_ltwrapper_scriptname ()
2632 {
2633- func_ltwrapper_scriptname_result=""
2634- if func_ltwrapper_executable_p "$1"; then
2635- func_dirname_and_basename "$1" "" "."
2636- func_stripname '' '.exe' "$func_basename_result"
2637- func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
2638- fi
2639+ func_dirname_and_basename "$1" "" "."
2640+ func_stripname '' '.exe' "$func_basename_result"
2641+ func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
2642 }
2643
2644 # func_ltwrapper_p file
2645@@ -1149,7 +1311,7 @@
2646 save_ifs=$IFS; IFS='~'
2647 for cmd in $1; do
2648 IFS=$save_ifs
2649- eval "cmd=\"$cmd\""
2650+ eval cmd=\"$cmd\"
2651 func_show_eval "$cmd" "${2-:}"
2652 done
2653 IFS=$save_ifs
2654@@ -1172,6 +1334,37 @@
2655 }
2656
2657
2658+# func_resolve_sysroot PATH
2659+# Replace a leading = in PATH with a sysroot. Store the result into
2660+# func_resolve_sysroot_result
2661+func_resolve_sysroot ()
2662+{
2663+ func_resolve_sysroot_result=$1
2664+ case $func_resolve_sysroot_result in
2665+ =*)
2666+ func_stripname '=' '' "$func_resolve_sysroot_result"
2667+ func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
2668+ ;;
2669+ esac
2670+}
2671+
2672+# func_replace_sysroot PATH
2673+# If PATH begins with the sysroot, replace it with = and
2674+# store the result into func_replace_sysroot_result.
2675+func_replace_sysroot ()
2676+{
2677+ case "$lt_sysroot:$1" in
2678+ ?*:"$lt_sysroot"*)
2679+ func_stripname "$lt_sysroot" '' "$1"
2680+ func_replace_sysroot_result="=$func_stripname_result"
2681+ ;;
2682+ *)
2683+ # Including no sysroot.
2684+ func_replace_sysroot_result=$1
2685+ ;;
2686+ esac
2687+}
2688+
2689 # func_infer_tag arg
2690 # Infer tagged configuration to use if any are available and
2691 # if one wasn't chosen via the "--tag" command line option.
2692@@ -1184,8 +1377,7 @@
2693 if test -n "$available_tags" && test -z "$tagname"; then
2694 CC_quoted=
2695 for arg in $CC; do
2696- func_quote_for_eval "$arg"
2697- CC_quoted="$CC_quoted $func_quote_for_eval_result"
2698+ func_append_quoted CC_quoted "$arg"
2699 done
2700 CC_expanded=`func_echo_all $CC`
2701 CC_quoted_expanded=`func_echo_all $CC_quoted`
2702@@ -1204,8 +1396,7 @@
2703 CC_quoted=
2704 for arg in $CC; do
2705 # Double-quote args containing other shell metacharacters.
2706- func_quote_for_eval "$arg"
2707- CC_quoted="$CC_quoted $func_quote_for_eval_result"
2708+ func_append_quoted CC_quoted "$arg"
2709 done
2710 CC_expanded=`func_echo_all $CC`
2711 CC_quoted_expanded=`func_echo_all $CC_quoted`
2712@@ -1274,6 +1465,486 @@
2713 }
2714 }
2715
2716+
2717+##################################################
2718+# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
2719+##################################################
2720+
2721+# func_convert_core_file_wine_to_w32 ARG
2722+# Helper function used by file name conversion functions when $build is *nix,
2723+# and $host is mingw, cygwin, or some other w32 environment. Relies on a
2724+# correctly configured wine environment available, with the winepath program
2725+# in $build's $PATH.
2726+#
2727+# ARG is the $build file name to be converted to w32 format.
2728+# Result is available in $func_convert_core_file_wine_to_w32_result, and will
2729+# be empty on error (or when ARG is empty)
2730+func_convert_core_file_wine_to_w32 ()
2731+{
2732+ $opt_debug
2733+ func_convert_core_file_wine_to_w32_result="$1"
2734+ if test -n "$1"; then
2735+ # Unfortunately, winepath does not exit with a non-zero error code, so we
2736+ # are forced to check the contents of stdout. On the other hand, if the
2737+ # command is not found, the shell will set an exit code of 127 and print
2738+ # *an error message* to stdout. So we must check for both error code of
2739+ # zero AND non-empty stdout, which explains the odd construction:
2740+ func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
2741+ if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
2742+ func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
2743+ $SED -e "$lt_sed_naive_backslashify"`
2744+ else
2745+ func_convert_core_file_wine_to_w32_result=
2746+ fi
2747+ fi
2748+}
2749+# end: func_convert_core_file_wine_to_w32
2750+
2751+
2752+# func_convert_core_path_wine_to_w32 ARG
2753+# Helper function used by path conversion functions when $build is *nix, and
2754+# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
2755+# configured wine environment available, with the winepath program in $build's
2756+# $PATH. Assumes ARG has no leading or trailing path separator characters.
2757+#
2758+# ARG is path to be converted from $build format to win32.
2759+# Result is available in $func_convert_core_path_wine_to_w32_result.
2760+# Unconvertible file (directory) names in ARG are skipped; if no directory names
2761+# are convertible, then the result may be empty.
2762+func_convert_core_path_wine_to_w32 ()
2763+{
2764+ $opt_debug
2765+ # unfortunately, winepath doesn't convert paths, only file names
2766+ func_convert_core_path_wine_to_w32_result=""
2767+ if test -n "$1"; then
2768+ oldIFS=$IFS
2769+ IFS=:
2770+ for func_convert_core_path_wine_to_w32_f in $1; do
2771+ IFS=$oldIFS
2772+ func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
2773+ if test -n "$func_convert_core_file_wine_to_w32_result" ; then
2774+ if test -z "$func_convert_core_path_wine_to_w32_result"; then
2775+ func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
2776+ else
2777+ func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
2778+ fi
2779+ fi
2780+ done
2781+ IFS=$oldIFS
2782+ fi
2783+}
2784+# end: func_convert_core_path_wine_to_w32
2785+
2786+
2787+# func_cygpath ARGS...
2788+# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
2789+# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
2790+# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
2791+# (2), returns the Cygwin file name or path in func_cygpath_result (input
2792+# file name or path is assumed to be in w32 format, as previously converted
2793+# from $build's *nix or MSYS format). In case (3), returns the w32 file name
2794+# or path in func_cygpath_result (input file name or path is assumed to be in
2795+# Cygwin format). Returns an empty string on error.
2796+#
2797+# ARGS are passed to cygpath, with the last one being the file name or path to
2798+# be converted.
2799+#
2800+# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
2801+# environment variable; do not put it in $PATH.
2802+func_cygpath ()
2803+{
2804+ $opt_debug
2805+ if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
2806+ func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
2807+ if test "$?" -ne 0; then
2808+ # on failure, ensure result is empty
2809+ func_cygpath_result=
2810+ fi
2811+ else
2812+ func_cygpath_result=
2813+ func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
2814+ fi
2815+}
2816+#end: func_cygpath
2817+
2818+
2819+# func_convert_core_msys_to_w32 ARG
2820+# Convert file name or path ARG from MSYS format to w32 format. Return
2821+# result in func_convert_core_msys_to_w32_result.
2822+func_convert_core_msys_to_w32 ()
2823+{
2824+ $opt_debug
2825+ # awkward: cmd appends spaces to result
2826+ func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
2827+ $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
2828+}
2829+#end: func_convert_core_msys_to_w32
2830+
2831+
2832+# func_convert_file_check ARG1 ARG2
2833+# Verify that ARG1 (a file name in $build format) was converted to $host
2834+# format in ARG2. Otherwise, emit an error message, but continue (resetting
2835+# func_to_host_file_result to ARG1).
2836+func_convert_file_check ()
2837+{
2838+ $opt_debug
2839+ if test -z "$2" && test -n "$1" ; then
2840+ func_error "Could not determine host file name corresponding to"
2841+ func_error " \`$1'"
2842+ func_error "Continuing, but uninstalled executables may not work."
2843+ # Fallback:
2844+ func_to_host_file_result="$1"
2845+ fi
2846+}
2847+# end func_convert_file_check
2848+
2849+
2850+# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
2851+# Verify that FROM_PATH (a path in $build format) was converted to $host
2852+# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
2853+# func_to_host_file_result to a simplistic fallback value (see below).
2854+func_convert_path_check ()
2855+{
2856+ $opt_debug
2857+ if test -z "$4" && test -n "$3"; then
2858+ func_error "Could not determine the host path corresponding to"
2859+ func_error " \`$3'"
2860+ func_error "Continuing, but uninstalled executables may not work."
2861+ # Fallback. This is a deliberately simplistic "conversion" and
2862+ # should not be "improved". See libtool.info.
2863+ if test "x$1" != "x$2"; then
2864+ lt_replace_pathsep_chars="s|$1|$2|g"
2865+ func_to_host_path_result=`echo "$3" |
2866+ $SED -e "$lt_replace_pathsep_chars"`
2867+ else
2868+ func_to_host_path_result="$3"
2869+ fi
2870+ fi
2871+}
2872+# end func_convert_path_check
2873+
2874+
2875+# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
2876+# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
2877+# and appending REPL if ORIG matches BACKPAT.
2878+func_convert_path_front_back_pathsep ()
2879+{
2880+ $opt_debug
2881+ case $4 in
2882+ $1 ) func_to_host_path_result="$3$func_to_host_path_result"
2883+ ;;
2884+ esac
2885+ case $4 in
2886+ $2 ) func_append func_to_host_path_result "$3"
2887+ ;;
2888+ esac
2889+}
2890+# end func_convert_path_front_back_pathsep
2891+
2892+
2893+##################################################
2894+# $build to $host FILE NAME CONVERSION FUNCTIONS #
2895+##################################################
2896+# invoked via `$to_host_file_cmd ARG'
2897+#
2898+# In each case, ARG is the path to be converted from $build to $host format.
2899+# Result will be available in $func_to_host_file_result.
2900+
2901+
2902+# func_to_host_file ARG
2903+# Converts the file name ARG from $build format to $host format. Return result
2904+# in func_to_host_file_result.
2905+func_to_host_file ()
2906+{
2907+ $opt_debug
2908+ $to_host_file_cmd "$1"
2909+}
2910+# end func_to_host_file
2911+
2912+
2913+# func_to_tool_file ARG LAZY
2914+# converts the file name ARG from $build format to toolchain format. Return
2915+# result in func_to_tool_file_result. If the conversion in use is listed
2916+# in (the comma separated) LAZY, no conversion takes place.
2917+func_to_tool_file ()
2918+{
2919+ $opt_debug
2920+ case ,$2, in
2921+ *,"$to_tool_file_cmd",*)
2922+ func_to_tool_file_result=$1
2923+ ;;
2924+ *)
2925+ $to_tool_file_cmd "$1"
2926+ func_to_tool_file_result=$func_to_host_file_result
2927+ ;;
2928+ esac
2929+}
2930+# end func_to_tool_file
2931+
2932+
2933+# func_convert_file_noop ARG
2934+# Copy ARG to func_to_host_file_result.
2935+func_convert_file_noop ()
2936+{
2937+ func_to_host_file_result="$1"
2938+}
2939+# end func_convert_file_noop
2940+
2941+
2942+# func_convert_file_msys_to_w32 ARG
2943+# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
2944+# conversion to w32 is not available inside the cwrapper. Returns result in
2945+# func_to_host_file_result.
2946+func_convert_file_msys_to_w32 ()
2947+{
2948+ $opt_debug
2949+ func_to_host_file_result="$1"
2950+ if test -n "$1"; then
2951+ func_convert_core_msys_to_w32 "$1"
2952+ func_to_host_file_result="$func_convert_core_msys_to_w32_result"
2953+ fi
2954+ func_convert_file_check "$1" "$func_to_host_file_result"
2955+}
2956+# end func_convert_file_msys_to_w32
2957+
2958+
2959+# func_convert_file_cygwin_to_w32 ARG
2960+# Convert file name ARG from Cygwin to w32 format. Returns result in
2961+# func_to_host_file_result.
2962+func_convert_file_cygwin_to_w32 ()
2963+{
2964+ $opt_debug
2965+ func_to_host_file_result="$1"
2966+ if test -n "$1"; then
2967+ # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
2968+ # LT_CYGPATH in this case.
2969+ func_to_host_file_result=`cygpath -m "$1"`
2970+ fi
2971+ func_convert_file_check "$1" "$func_to_host_file_result"
2972+}
2973+# end func_convert_file_cygwin_to_w32
2974+
2975+
2976+# func_convert_file_nix_to_w32 ARG
2977+# Convert file name ARG from *nix to w32 format. Requires a wine environment
2978+# and a working winepath. Returns result in func_to_host_file_result.
2979+func_convert_file_nix_to_w32 ()
2980+{
2981+ $opt_debug
2982+ func_to_host_file_result="$1"
2983+ if test -n "$1"; then
2984+ func_convert_core_file_wine_to_w32 "$1"
2985+ func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
2986+ fi
2987+ func_convert_file_check "$1" "$func_to_host_file_result"
2988+}
2989+# end func_convert_file_nix_to_w32
2990+
2991+
2992+# func_convert_file_msys_to_cygwin ARG
2993+# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
2994+# Returns result in func_to_host_file_result.
2995+func_convert_file_msys_to_cygwin ()
2996+{
2997+ $opt_debug
2998+ func_to_host_file_result="$1"
2999+ if test -n "$1"; then
3000+ func_convert_core_msys_to_w32 "$1"
3001+ func_cygpath -u "$func_convert_core_msys_to_w32_result"
3002+ func_to_host_file_result="$func_cygpath_result"
3003+ fi
3004+ func_convert_file_check "$1" "$func_to_host_file_result"
3005+}
3006+# end func_convert_file_msys_to_cygwin
3007+
3008+
3009+# func_convert_file_nix_to_cygwin ARG
3010+# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
3011+# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
3012+# in func_to_host_file_result.
3013+func_convert_file_nix_to_cygwin ()
3014+{
3015+ $opt_debug
3016+ func_to_host_file_result="$1"
3017+ if test -n "$1"; then
3018+ # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
3019+ func_convert_core_file_wine_to_w32 "$1"
3020+ func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
3021+ func_to_host_file_result="$func_cygpath_result"
3022+ fi
3023+ func_convert_file_check "$1" "$func_to_host_file_result"
3024+}
3025+# end func_convert_file_nix_to_cygwin
3026+
3027+
3028+#############################################
3029+# $build to $host PATH CONVERSION FUNCTIONS #
3030+#############################################
3031+# invoked via `$to_host_path_cmd ARG'
3032+#
3033+# In each case, ARG is the path to be converted from $build to $host format.
3034+# The result will be available in $func_to_host_path_result.
3035+#
3036+# Path separators are also converted from $build format to $host format. If
3037+# ARG begins or ends with a path separator character, it is preserved (but
3038+# converted to $host format) on output.
3039+#
3040+# All path conversion functions are named using the following convention:
3041+# file name conversion function : func_convert_file_X_to_Y ()
3042+# path conversion function : func_convert_path_X_to_Y ()
3043+# where, for any given $build/$host combination the 'X_to_Y' value is the
3044+# same. If conversion functions are added for new $build/$host combinations,
3045+# the two new functions must follow this pattern, or func_init_to_host_path_cmd
3046+# will break.
3047+
3048+
3049+# func_init_to_host_path_cmd
3050+# Ensures that function "pointer" variable $to_host_path_cmd is set to the
3051+# appropriate value, based on the value of $to_host_file_cmd.
3052+to_host_path_cmd=
3053+func_init_to_host_path_cmd ()
3054+{
3055+ $opt_debug
3056+ if test -z "$to_host_path_cmd"; then
3057+ func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
3058+ to_host_path_cmd="func_convert_path_${func_stripname_result}"
3059+ fi
3060+}
3061+
3062+
3063+# func_to_host_path ARG
3064+# Converts the path ARG from $build format to $host format. Return result
3065+# in func_to_host_path_result.
3066+func_to_host_path ()
3067+{
3068+ $opt_debug
3069+ func_init_to_host_path_cmd
3070+ $to_host_path_cmd "$1"
3071+}
3072+# end func_to_host_path
3073+
3074+
3075+# func_convert_path_noop ARG
3076+# Copy ARG to func_to_host_path_result.
3077+func_convert_path_noop ()
3078+{
3079+ func_to_host_path_result="$1"
3080+}
3081+# end func_convert_path_noop
3082+
3083+
3084+# func_convert_path_msys_to_w32 ARG
3085+# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
3086+# conversion to w32 is not available inside the cwrapper. Returns result in
3087+# func_to_host_path_result.
3088+func_convert_path_msys_to_w32 ()
3089+{
3090+ $opt_debug
3091+ func_to_host_path_result="$1"
3092+ if test -n "$1"; then
3093+ # Remove leading and trailing path separator characters from ARG. MSYS
3094+ # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
3095+ # and winepath ignores them completely.
3096+ func_stripname : : "$1"
3097+ func_to_host_path_tmp1=$func_stripname_result
3098+ func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3099+ func_to_host_path_result="$func_convert_core_msys_to_w32_result"
3100+ func_convert_path_check : ";" \
3101+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
3102+ func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3103+ fi
3104+}
3105+# end func_convert_path_msys_to_w32
3106+
3107+
3108+# func_convert_path_cygwin_to_w32 ARG
3109+# Convert path ARG from Cygwin to w32 format. Returns result in
3110+# func_to_host_file_result.
3111+func_convert_path_cygwin_to_w32 ()
3112+{
3113+ $opt_debug
3114+ func_to_host_path_result="$1"
3115+ if test -n "$1"; then
3116+ # See func_convert_path_msys_to_w32:
3117+ func_stripname : : "$1"
3118+ func_to_host_path_tmp1=$func_stripname_result
3119+ func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
3120+ func_convert_path_check : ";" \
3121+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
3122+ func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3123+ fi
3124+}
3125+# end func_convert_path_cygwin_to_w32
3126+
3127+
3128+# func_convert_path_nix_to_w32 ARG
3129+# Convert path ARG from *nix to w32 format. Requires a wine environment and
3130+# a working winepath. Returns result in func_to_host_file_result.
3131+func_convert_path_nix_to_w32 ()
3132+{
3133+ $opt_debug
3134+ func_to_host_path_result="$1"
3135+ if test -n "$1"; then
3136+ # See func_convert_path_msys_to_w32:
3137+ func_stripname : : "$1"
3138+ func_to_host_path_tmp1=$func_stripname_result
3139+ func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3140+ func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
3141+ func_convert_path_check : ";" \
3142+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
3143+ func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3144+ fi
3145+}
3146+# end func_convert_path_nix_to_w32
3147+
3148+
3149+# func_convert_path_msys_to_cygwin ARG
3150+# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3151+# Returns result in func_to_host_file_result.
3152+func_convert_path_msys_to_cygwin ()
3153+{
3154+ $opt_debug
3155+ func_to_host_path_result="$1"
3156+ if test -n "$1"; then
3157+ # See func_convert_path_msys_to_w32:
3158+ func_stripname : : "$1"
3159+ func_to_host_path_tmp1=$func_stripname_result
3160+ func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3161+ func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
3162+ func_to_host_path_result="$func_cygpath_result"
3163+ func_convert_path_check : : \
3164+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
3165+ func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3166+ fi
3167+}
3168+# end func_convert_path_msys_to_cygwin
3169+
3170+
3171+# func_convert_path_nix_to_cygwin ARG
3172+# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
3173+# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
3174+# func_to_host_file_result.
3175+func_convert_path_nix_to_cygwin ()
3176+{
3177+ $opt_debug
3178+ func_to_host_path_result="$1"
3179+ if test -n "$1"; then
3180+ # Remove leading and trailing path separator characters from
3181+ # ARG. msys behavior is inconsistent here, cygpath turns them
3182+ # into '.;' and ';.', and winepath ignores them completely.
3183+ func_stripname : : "$1"
3184+ func_to_host_path_tmp1=$func_stripname_result
3185+ func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3186+ func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
3187+ func_to_host_path_result="$func_cygpath_result"
3188+ func_convert_path_check : : \
3189+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
3190+ func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3191+ fi
3192+}
3193+# end func_convert_path_nix_to_cygwin
3194+
3195+
3196 # func_mode_compile arg...
3197 func_mode_compile ()
3198 {
3199@@ -1314,12 +1985,12 @@
3200 ;;
3201
3202 -pie | -fpie | -fPIE)
3203- pie_flag="$pie_flag $arg"
3204+ func_append pie_flag " $arg"
3205 continue
3206 ;;
3207
3208 -shared | -static | -prefer-pic | -prefer-non-pic)
3209- later="$later $arg"
3210+ func_append later " $arg"
3211 continue
3212 ;;
3213
3214@@ -1340,15 +2011,14 @@
3215 save_ifs="$IFS"; IFS=','
3216 for arg in $args; do
3217 IFS="$save_ifs"
3218- func_quote_for_eval "$arg"
3219- lastarg="$lastarg $func_quote_for_eval_result"
3220+ func_append_quoted lastarg "$arg"
3221 done
3222 IFS="$save_ifs"
3223 func_stripname ' ' '' "$lastarg"
3224 lastarg=$func_stripname_result
3225
3226 # Add the arguments to base_compile.
3227- base_compile="$base_compile $lastarg"
3228+ func_append base_compile " $lastarg"
3229 continue
3230 ;;
3231
3232@@ -1364,8 +2034,7 @@
3233 esac # case $arg_mode
3234
3235 # Aesthetically quote the previous argument.
3236- func_quote_for_eval "$lastarg"
3237- base_compile="$base_compile $func_quote_for_eval_result"
3238+ func_append_quoted base_compile "$lastarg"
3239 done # for arg
3240
3241 case $arg_mode in
3242@@ -1496,17 +2165,16 @@
3243 $opt_dry_run || $RM $removelist
3244 exit $EXIT_FAILURE
3245 fi
3246- removelist="$removelist $output_obj"
3247+ func_append removelist " $output_obj"
3248 $ECHO "$srcfile" > "$lockfile"
3249 fi
3250
3251 $opt_dry_run || $RM $removelist
3252- removelist="$removelist $lockfile"
3253+ func_append removelist " $lockfile"
3254 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
3255
3256- if test -n "$fix_srcfile_path"; then
3257- eval "srcfile=\"$fix_srcfile_path\""
3258- fi
3259+ func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
3260+ srcfile=$func_to_tool_file_result
3261 func_quote_for_eval "$srcfile"
3262 qsrcfile=$func_quote_for_eval_result
3263
3264@@ -1526,7 +2194,7 @@
3265
3266 if test -z "$output_obj"; then
3267 # Place PIC objects in $objdir
3268- command="$command -o $lobj"
3269+ func_append command " -o $lobj"
3270 fi
3271
3272 func_show_eval_locale "$command" \
3273@@ -1573,11 +2241,11 @@
3274 command="$base_compile $qsrcfile $pic_flag"
3275 fi
3276 if test "$compiler_c_o" = yes; then
3277- command="$command -o $obj"
3278+ func_append command " -o $obj"
3279 fi
3280
3281 # Suppress compiler output if we already did a PIC compilation.
3282- command="$command$suppress_output"
3283+ func_append command "$suppress_output"
3284 func_show_eval_locale "$command" \
3285 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
3286
3287@@ -1622,13 +2290,13 @@
3288 }
3289
3290 $opt_help || {
3291- test "$mode" = compile && func_mode_compile ${1+"$@"}
3292+ test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
3293 }
3294
3295 func_mode_help ()
3296 {
3297 # We need to display help for each of the modes.
3298- case $mode in
3299+ case $opt_mode in
3300 "")
3301 # Generic help is extracted from the usage comments
3302 # at the start of this file.
3303@@ -1659,8 +2327,8 @@
3304
3305 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
3306 -no-suppress do not suppress compiler output for multiple passes
3307- -prefer-pic try to building PIC objects only
3308- -prefer-non-pic try to building non-PIC objects only
3309+ -prefer-pic try to build PIC objects only
3310+ -prefer-non-pic try to build non-PIC objects only
3311 -shared do not build a \`.o' file suitable for static linking
3312 -static only build a \`.o' file suitable for static linking
3313 -Wc,FLAG pass FLAG directly to the compiler
3314@@ -1804,7 +2472,7 @@
3315 ;;
3316
3317 *)
3318- func_fatal_help "invalid operation mode \`$mode'"
3319+ func_fatal_help "invalid operation mode \`$opt_mode'"
3320 ;;
3321 esac
3322
3323@@ -1819,13 +2487,13 @@
3324 else
3325 {
3326 func_help noexit
3327- for mode in compile link execute install finish uninstall clean; do
3328+ for opt_mode in compile link execute install finish uninstall clean; do
3329 func_mode_help
3330 done
3331 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
3332 {
3333 func_help noexit
3334- for mode in compile link execute install finish uninstall clean; do
3335+ for opt_mode in compile link execute install finish uninstall clean; do
3336 echo
3337 func_mode_help
3338 done
3339@@ -1854,13 +2522,16 @@
3340 func_fatal_help "you must specify a COMMAND"
3341
3342 # Handle -dlopen flags immediately.
3343- for file in $execute_dlfiles; do
3344+ for file in $opt_dlopen; do
3345 test -f "$file" \
3346 || func_fatal_help "\`$file' is not a file"
3347
3348 dir=
3349 case $file in
3350 *.la)
3351+ func_resolve_sysroot "$file"
3352+ file=$func_resolve_sysroot_result
3353+
3354 # Check to see that this really is a libtool archive.
3355 func_lalib_unsafe_p "$file" \
3356 || func_fatal_help "\`$lib' is not a valid libtool archive"
3357@@ -1882,7 +2553,7 @@
3358 dir="$func_dirname_result"
3359
3360 if test -f "$dir/$objdir/$dlname"; then
3361- dir="$dir/$objdir"
3362+ func_append dir "/$objdir"
3363 else
3364 if test ! -f "$dir/$dlname"; then
3365 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
3366@@ -1907,10 +2578,10 @@
3367 test -n "$absdir" && dir="$absdir"
3368
3369 # Now add the directory to shlibpath_var.
3370- if eval test -z \"\$$shlibpath_var\"; then
3371- eval $shlibpath_var=\$dir
3372+ if eval "test -z \"\$$shlibpath_var\""; then
3373+ eval "$shlibpath_var=\"\$dir\""
3374 else
3375- eval $shlibpath_var=\$dir:\$$shlibpath_var
3376+ eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3377 fi
3378 done
3379
3380@@ -1939,8 +2610,7 @@
3381 ;;
3382 esac
3383 # Quote arguments (to preserve shell metacharacters).
3384- func_quote_for_eval "$file"
3385- args="$args $func_quote_for_eval_result"
3386+ func_append_quoted args "$file"
3387 done
3388
3389 if test "X$opt_dry_run" = Xfalse; then
3390@@ -1972,22 +2642,59 @@
3391 fi
3392 }
3393
3394-test "$mode" = execute && func_mode_execute ${1+"$@"}
3395+test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
3396
3397
3398 # func_mode_finish arg...
3399 func_mode_finish ()
3400 {
3401 $opt_debug
3402- libdirs="$nonopt"
3403+ libs=
3404+ libdirs=
3405 admincmds=
3406
3407- if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3408- for dir
3409- do
3410- libdirs="$libdirs $dir"
3411- done
3412+ for opt in "$nonopt" ${1+"$@"}
3413+ do
3414+ if test -d "$opt"; then
3415+ func_append libdirs " $opt"
3416+
3417+ elif test -f "$opt"; then
3418+ if func_lalib_unsafe_p "$opt"; then
3419+ func_append libs " $opt"
3420+ else
3421+ func_warning "\`$opt' is not a valid libtool archive"
3422+ fi
3423+
3424+ else
3425+ func_fatal_error "invalid argument \`$opt'"
3426+ fi
3427+ done
3428+
3429+ if test -n "$libs"; then
3430+ if test -n "$lt_sysroot"; then
3431+ sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
3432+ sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
3433+ else
3434+ sysroot_cmd=
3435+ fi
3436+
3437+ # Remove sysroot references
3438+ if $opt_dry_run; then
3439+ for lib in $libs; do
3440+ echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
3441+ done
3442+ else
3443+ tmpdir=`func_mktempdir`
3444+ for lib in $libs; do
3445+ sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
3446+ > $tmpdir/tmp-la
3447+ mv -f $tmpdir/tmp-la $lib
3448+ done
3449+ ${RM}r "$tmpdir"
3450+ fi
3451+ fi
3452
3453+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3454 for libdir in $libdirs; do
3455 if test -n "$finish_cmds"; then
3456 # Do each command in the finish commands.
3457@@ -1997,7 +2704,7 @@
3458 if test -n "$finish_eval"; then
3459 # Do the single finish_eval.
3460 eval cmds=\"$finish_eval\"
3461- $opt_dry_run || eval "$cmds" || admincmds="$admincmds
3462+ $opt_dry_run || eval "$cmds" || func_append admincmds "
3463 $cmds"
3464 fi
3465 done
3466@@ -2006,53 +2713,55 @@
3467 # Exit here if they wanted silent mode.
3468 $opt_silent && exit $EXIT_SUCCESS
3469
3470- echo "----------------------------------------------------------------------"
3471- echo "Libraries have been installed in:"
3472- for libdir in $libdirs; do
3473- $ECHO " $libdir"
3474- done
3475- echo
3476- echo "If you ever happen to want to link against installed libraries"
3477- echo "in a given directory, LIBDIR, you must either use libtool, and"
3478- echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
3479- echo "flag during linking and do at least one of the following:"
3480- if test -n "$shlibpath_var"; then
3481- echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
3482- echo " during execution"
3483- fi
3484- if test -n "$runpath_var"; then
3485- echo " - add LIBDIR to the \`$runpath_var' environment variable"
3486- echo " during linking"
3487- fi
3488- if test -n "$hardcode_libdir_flag_spec"; then
3489- libdir=LIBDIR
3490- eval "flag=\"$hardcode_libdir_flag_spec\""
3491+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3492+ echo "----------------------------------------------------------------------"
3493+ echo "Libraries have been installed in:"
3494+ for libdir in $libdirs; do
3495+ $ECHO " $libdir"
3496+ done
3497+ echo
3498+ echo "If you ever happen to want to link against installed libraries"
3499+ echo "in a given directory, LIBDIR, you must either use libtool, and"
3500+ echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
3501+ echo "flag during linking and do at least one of the following:"
3502+ if test -n "$shlibpath_var"; then
3503+ echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
3504+ echo " during execution"
3505+ fi
3506+ if test -n "$runpath_var"; then
3507+ echo " - add LIBDIR to the \`$runpath_var' environment variable"
3508+ echo " during linking"
3509+ fi
3510+ if test -n "$hardcode_libdir_flag_spec"; then
3511+ libdir=LIBDIR
3512+ eval flag=\"$hardcode_libdir_flag_spec\"
3513
3514- $ECHO " - use the \`$flag' linker flag"
3515- fi
3516- if test -n "$admincmds"; then
3517- $ECHO " - have your system administrator run these commands:$admincmds"
3518- fi
3519- if test -f /etc/ld.so.conf; then
3520- echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
3521- fi
3522- echo
3523+ $ECHO " - use the \`$flag' linker flag"
3524+ fi
3525+ if test -n "$admincmds"; then
3526+ $ECHO " - have your system administrator run these commands:$admincmds"
3527+ fi
3528+ if test -f /etc/ld.so.conf; then
3529+ echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
3530+ fi
3531+ echo
3532
3533- echo "See any operating system documentation about shared libraries for"
3534- case $host in
3535- solaris2.[6789]|solaris2.1[0-9])
3536- echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
3537- echo "pages."
3538- ;;
3539- *)
3540- echo "more information, such as the ld(1) and ld.so(8) manual pages."
3541- ;;
3542- esac
3543- echo "----------------------------------------------------------------------"
3544+ echo "See any operating system documentation about shared libraries for"
3545+ case $host in
3546+ solaris2.[6789]|solaris2.1[0-9])
3547+ echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
3548+ echo "pages."
3549+ ;;
3550+ *)
3551+ echo "more information, such as the ld(1) and ld.so(8) manual pages."
3552+ ;;
3553+ esac
3554+ echo "----------------------------------------------------------------------"
3555+ fi
3556 exit $EXIT_SUCCESS
3557 }
3558
3559-test "$mode" = finish && func_mode_finish ${1+"$@"}
3560+test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
3561
3562
3563 # func_mode_install arg...
3564@@ -2077,7 +2786,7 @@
3565 # The real first argument should be the name of the installation program.
3566 # Aesthetically quote it.
3567 func_quote_for_eval "$arg"
3568- install_prog="$install_prog$func_quote_for_eval_result"
3569+ func_append install_prog "$func_quote_for_eval_result"
3570 install_shared_prog=$install_prog
3571 case " $install_prog " in
3572 *[\\\ /]cp\ *) install_cp=: ;;
3573@@ -2097,7 +2806,7 @@
3574 do
3575 arg2=
3576 if test -n "$dest"; then
3577- files="$files $dest"
3578+ func_append files " $dest"
3579 dest=$arg
3580 continue
3581 fi
3582@@ -2135,11 +2844,11 @@
3583
3584 # Aesthetically quote the argument.
3585 func_quote_for_eval "$arg"
3586- install_prog="$install_prog $func_quote_for_eval_result"
3587+ func_append install_prog " $func_quote_for_eval_result"
3588 if test -n "$arg2"; then
3589 func_quote_for_eval "$arg2"
3590 fi
3591- install_shared_prog="$install_shared_prog $func_quote_for_eval_result"
3592+ func_append install_shared_prog " $func_quote_for_eval_result"
3593 done
3594
3595 test -z "$install_prog" && \
3596@@ -2151,7 +2860,7 @@
3597 if test -n "$install_override_mode" && $no_mode; then
3598 if $install_cp; then :; else
3599 func_quote_for_eval "$install_override_mode"
3600- install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result"
3601+ func_append install_shared_prog " -m $func_quote_for_eval_result"
3602 fi
3603 fi
3604
3605@@ -2209,10 +2918,13 @@
3606 case $file in
3607 *.$libext)
3608 # Do the static libraries later.
3609- staticlibs="$staticlibs $file"
3610+ func_append staticlibs " $file"
3611 ;;
3612
3613 *.la)
3614+ func_resolve_sysroot "$file"
3615+ file=$func_resolve_sysroot_result
3616+
3617 # Check to see that this really is a libtool archive.
3618 func_lalib_unsafe_p "$file" \
3619 || func_fatal_help "\`$file' is not a valid libtool archive"
3620@@ -2226,23 +2938,30 @@
3621 if test "X$destdir" = "X$libdir"; then
3622 case "$current_libdirs " in
3623 *" $libdir "*) ;;
3624- *) current_libdirs="$current_libdirs $libdir" ;;
3625+ *) func_append current_libdirs " $libdir" ;;
3626 esac
3627 else
3628 # Note the libdir as a future libdir.
3629 case "$future_libdirs " in
3630 *" $libdir "*) ;;
3631- *) future_libdirs="$future_libdirs $libdir" ;;
3632+ *) func_append future_libdirs " $libdir" ;;
3633 esac
3634 fi
3635
3636 func_dirname "$file" "/" ""
3637 dir="$func_dirname_result"
3638- dir="$dir$objdir"
3639+ func_append dir "$objdir"
3640
3641 if test -n "$relink_command"; then
3642+ # Strip any trailing slash from the destination.
3643+ func_stripname '' '/' "$libdir"
3644+ destlibdir=$func_stripname_result
3645+
3646+ func_stripname '' '/' "$destdir"
3647+ s_destdir=$func_stripname_result
3648+
3649 # Determine the prefix the user has applied to our future dir.
3650- inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
3651+ inst_prefix_dir=`$ECHO "X$s_destdir" | $Xsed -e "s%$destlibdir\$%%"`
3652
3653 # Don't allow the user to place us outside of our expected
3654 # location b/c this prevents finding dependent libraries that
3655@@ -2315,7 +3034,7 @@
3656 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
3657
3658 # Maybe install the static library, too.
3659- test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
3660+ test -n "$old_library" && func_append staticlibs " $dir/$old_library"
3661 ;;
3662
3663 *.lo)
3664@@ -2503,7 +3222,7 @@
3665 test -n "$future_libdirs" && \
3666 func_warning "remember to run \`$progname --finish$future_libdirs'"
3667
3668- if test -n "$current_libdirs" && $opt_finish; then
3669+ if test -n "$current_libdirs"; then
3670 # Maybe just do a dry run.
3671 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3672 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3673@@ -2512,7 +3231,7 @@
3674 fi
3675 }
3676
3677-test "$mode" = install && func_mode_install ${1+"$@"}
3678+test "$opt_mode" = install && func_mode_install ${1+"$@"}
3679
3680
3681 # func_generate_dlsyms outputname originator pic_p
3682@@ -2559,6 +3278,18 @@
3683 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3684 #endif
3685
3686+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3687+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3688+/* DATA imports from DLLs on WIN32 con't be const, because runtime
3689+ relocations are performed -- see ld's documentation on pseudo-relocs. */
3690+# define LT_DLSYM_CONST
3691+#elif defined(__osf__)
3692+/* This system does not cope well with relocations in const data. */
3693+# define LT_DLSYM_CONST
3694+#else
3695+# define LT_DLSYM_CONST const
3696+#endif
3697+
3698 /* External symbol declarations for the compiler. */\
3699 "
3700
3701@@ -2570,21 +3301,22 @@
3702 # Add our own program objects to the symbol list.
3703 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3704 for progfile in $progfiles; do
3705- func_verbose "extracting global C symbols from \`$progfile'"
3706- $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
3707+ func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3708+ func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
3709+ $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
3710 done
3711
3712 if test -n "$exclude_expsyms"; then
3713 $opt_dry_run || {
3714- $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3715- $MV "$nlist"T "$nlist"
3716+ eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3717+ eval '$MV "$nlist"T "$nlist"'
3718 }
3719 fi
3720
3721 if test -n "$export_symbols_regex"; then
3722 $opt_dry_run || {
3723- $EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T
3724- $MV "$nlist"T "$nlist"
3725+ eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3726+ eval '$MV "$nlist"T "$nlist"'
3727 }
3728 fi
3729
3730@@ -2593,23 +3325,23 @@
3731 export_symbols="$output_objdir/$outputname.exp"
3732 $opt_dry_run || {
3733 $RM $export_symbols
3734- ${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' < "$nlist" > "$export_symbols"
3735+ eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3736 case $host in
3737 *cygwin* | *mingw* | *cegcc* )
3738- echo EXPORTS > "$output_objdir/$outputname.def"
3739- cat "$export_symbols" >> "$output_objdir/$outputname.def"
3740+ eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3741+ eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3742 ;;
3743 esac
3744 }
3745 else
3746 $opt_dry_run || {
3747- ${SED} -e 's/\([].[*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/' < "$export_symbols" > "$output_objdir/$outputname.exp"
3748- $GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T
3749- $MV "$nlist"T "$nlist"
3750+ eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3751+ eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3752+ eval '$MV "$nlist"T "$nlist"'
3753 case $host in
3754 *cygwin* | *mingw* | *cegcc* )
3755- echo EXPORTS > "$output_objdir/$outputname.def"
3756- cat "$nlist" >> "$output_objdir/$outputname.def"
3757+ eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3758+ eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3759 ;;
3760 esac
3761 }
3762@@ -2620,10 +3352,52 @@
3763 func_verbose "extracting global C symbols from \`$dlprefile'"
3764 func_basename "$dlprefile"
3765 name="$func_basename_result"
3766- $opt_dry_run || {
3767- $ECHO ": $name " >> "$nlist"
3768- eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3769- }
3770+ case $host in
3771+ *cygwin* | *mingw* | *cegcc* )
3772+ # if an import library, we need to obtain dlname
3773+ if func_win32_import_lib_p "$dlprefile"; then
3774+ func_tr_sh "$dlprefile"
3775+ eval "curr_lafile=\$libfile_$func_tr_sh_result"
3776+ dlprefile_dlbasename=""
3777+ if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3778+ # Use subshell, to avoid clobbering current variable values
3779+ dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3780+ if test -n "$dlprefile_dlname" ; then
3781+ func_basename "$dlprefile_dlname"
3782+ dlprefile_dlbasename="$func_basename_result"
3783+ else
3784+ # no lafile. user explicitly requested -dlpreopen <import library>.
3785+ $sharedlib_from_linklib_cmd "$dlprefile"
3786+ dlprefile_dlbasename=$sharedlib_from_linklib_result
3787+ fi
3788+ fi
3789+ $opt_dry_run || {
3790+ if test -n "$dlprefile_dlbasename" ; then
3791+ eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3792+ else
3793+ func_warning "Could not compute DLL name from $name"
3794+ eval '$ECHO ": $name " >> "$nlist"'
3795+ fi
3796+ func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3797+ eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3798+ $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3799+ }
3800+ else # not an import lib
3801+ $opt_dry_run || {
3802+ eval '$ECHO ": $name " >> "$nlist"'
3803+ func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3804+ eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3805+ }
3806+ fi
3807+ ;;
3808+ *)
3809+ $opt_dry_run || {
3810+ eval '$ECHO ": $name " >> "$nlist"'
3811+ func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3812+ eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3813+ }
3814+ ;;
3815+ esac
3816 done
3817
3818 $opt_dry_run || {
3819@@ -2661,26 +3435,9 @@
3820 const char *name;
3821 void *address;
3822 } lt_dlsymlist;
3823-"
3824- case $host in
3825- *cygwin* | *mingw* | *cegcc* )
3826- echo >> "$output_objdir/$my_dlsyms" "\
3827-/* DATA imports from DLLs on WIN32 con't be const, because
3828- runtime relocations are performed -- see ld's documentation
3829- on pseudo-relocs. */"
3830- lt_dlsym_const= ;;
3831- *osf5*)
3832- echo >> "$output_objdir/$my_dlsyms" "\
3833-/* This system does not cope well with relocations in const data */"
3834- lt_dlsym_const= ;;
3835- *)
3836- lt_dlsym_const=const ;;
3837- esac
3838-
3839- echo >> "$output_objdir/$my_dlsyms" "\
3840-extern $lt_dlsym_const lt_dlsymlist
3841+extern LT_DLSYM_CONST lt_dlsymlist
3842 lt_${my_prefix}_LTX_preloaded_symbols[];
3843-$lt_dlsym_const lt_dlsymlist
3844+LT_DLSYM_CONST lt_dlsymlist
3845 lt_${my_prefix}_LTX_preloaded_symbols[] =
3846 {\
3847 { \"$my_originator\", (void *) 0 },"
3848@@ -2736,7 +3493,7 @@
3849 for arg in $LTCFLAGS; do
3850 case $arg in
3851 -pie | -fpie | -fPIE) ;;
3852- *) symtab_cflags="$symtab_cflags $arg" ;;
3853+ *) func_append symtab_cflags " $arg" ;;
3854 esac
3855 done
3856
3857@@ -2796,9 +3553,11 @@
3858 win32_libid_type="x86 archive import"
3859 ;;
3860 *ar\ archive*) # could be an import, or static
3861- if $OBJDUMP -f "$1" | $SED -e '10q' 2>/dev/null |
3862- $EGREP 'file format (pe-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3863- win32_nmres=`$NM -f posix -A "$1" |
3864+ # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3865+ if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3866+ $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3867+ func_to_tool_file "$1" func_convert_file_msys_to_w32
3868+ win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3869 $SED -n -e '
3870 1,100{
3871 / I /{
3872@@ -2827,6 +3586,131 @@
3873 $ECHO "$win32_libid_type"
3874 }
3875
3876+# func_cygming_dll_for_implib ARG
3877+#
3878+# Platform-specific function to extract the
3879+# name of the DLL associated with the specified
3880+# import library ARG.
3881+# Invoked by eval'ing the libtool variable
3882+# $sharedlib_from_linklib_cmd
3883+# Result is available in the variable
3884+# $sharedlib_from_linklib_result
3885+func_cygming_dll_for_implib ()
3886+{
3887+ $opt_debug
3888+ sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
3889+}
3890+
3891+# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
3892+#
3893+# The is the core of a fallback implementation of a
3894+# platform-specific function to extract the name of the
3895+# DLL associated with the specified import library LIBNAME.
3896+#
3897+# SECTION_NAME is either .idata$6 or .idata$7, depending
3898+# on the platform and compiler that created the implib.
3899+#
3900+# Echos the name of the DLL associated with the
3901+# specified import library.
3902+func_cygming_dll_for_implib_fallback_core ()
3903+{
3904+ $opt_debug
3905+ match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
3906+ $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
3907+ $SED '/^Contents of section '"$match_literal"':/{
3908+ # Place marker at beginning of archive member dllname section
3909+ s/.*/====MARK====/
3910+ p
3911+ d
3912+ }
3913+ # These lines can sometimes be longer than 43 characters, but
3914+ # are always uninteresting
3915+ /:[ ]*file format pe[i]\{,1\}-/d
3916+ /^In archive [^:]*:/d
3917+ # Ensure marker is printed
3918+ /^====MARK====/p
3919+ # Remove all lines with less than 43 characters
3920+ /^.\{43\}/!d
3921+ # From remaining lines, remove first 43 characters
3922+ s/^.\{43\}//' |
3923+ $SED -n '
3924+ # Join marker and all lines until next marker into a single line
3925+ /^====MARK====/ b para
3926+ H
3927+ $ b para
3928+ b
3929+ :para
3930+ x
3931+ s/\n//g
3932+ # Remove the marker
3933+ s/^====MARK====//
3934+ # Remove trailing dots and whitespace
3935+ s/[\. \t]*$//
3936+ # Print
3937+ /./p' |
3938+ # we now have a list, one entry per line, of the stringified
3939+ # contents of the appropriate section of all members of the
3940+ # archive which possess that section. Heuristic: eliminate
3941+ # all those which have a first or second character that is
3942+ # a '.' (that is, objdump's representation of an unprintable
3943+ # character.) This should work for all archives with less than
3944+ # 0x302f exports -- but will fail for DLLs whose name actually
3945+ # begins with a literal '.' or a single character followed by
3946+ # a '.'.
3947+ #
3948+ # Of those that remain, print the first one.
3949+ $SED -e '/^\./d;/^.\./d;q'
3950+}
3951+
3952+# func_cygming_gnu_implib_p ARG
3953+# This predicate returns with zero status (TRUE) if
3954+# ARG is a GNU/binutils-style import library. Returns
3955+# with nonzero status (FALSE) otherwise.
3956+func_cygming_gnu_implib_p ()
3957+{
3958+ $opt_debug
3959+ func_to_tool_file "$1" func_convert_file_msys_to_w32
3960+ func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
3961+ test -n "$func_cygming_gnu_implib_tmp"
3962+}
3963+
3964+# func_cygming_ms_implib_p ARG
3965+# This predicate returns with zero status (TRUE) if
3966+# ARG is an MS-style import library. Returns
3967+# with nonzero status (FALSE) otherwise.
3968+func_cygming_ms_implib_p ()
3969+{
3970+ $opt_debug
3971+ func_to_tool_file "$1" func_convert_file_msys_to_w32
3972+ func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
3973+ test -n "$func_cygming_ms_implib_tmp"
3974+}
3975+
3976+# func_cygming_dll_for_implib_fallback ARG
3977+# Platform-specific function to extract the
3978+# name of the DLL associated with the specified
3979+# import library ARG.
3980+#
3981+# This fallback implementation is for use when $DLLTOOL
3982+# does not support the --identify-strict option.
3983+# Invoked by eval'ing the libtool variable
3984+# $sharedlib_from_linklib_cmd
3985+# Result is available in the variable
3986+# $sharedlib_from_linklib_result
3987+func_cygming_dll_for_implib_fallback ()
3988+{
3989+ $opt_debug
3990+ if func_cygming_gnu_implib_p "$1" ; then
3991+ # binutils import library
3992+ sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
3993+ elif func_cygming_ms_implib_p "$1" ; then
3994+ # ms-generated import library
3995+ sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
3996+ else
3997+ # unknown
3998+ sharedlib_from_linklib_result=""
3999+ fi
4000+}
4001
4002
4003 # func_extract_an_archive dir oldlib
4004@@ -2917,7 +3801,7 @@
4005 darwin_file=
4006 darwin_files=
4007 for darwin_file in $darwin_filelist; do
4008- darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
4009+ darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
4010 $LIPO -create -output "$darwin_file" $darwin_files
4011 done # $darwin_filelist
4012 $RM -rf unfat-$$
4013@@ -2932,7 +3816,7 @@
4014 func_extract_an_archive "$my_xdir" "$my_xabs"
4015 ;;
4016 esac
4017- my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4018+ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
4019 done
4020
4021 func_extract_archives_result="$my_oldobjs"
4022@@ -3014,7 +3898,110 @@
4023 _LTECHO_EOF'
4024 }
4025 ECHO=\"$qECHO\"
4026- fi\
4027+ fi
4028+
4029+# Very basic option parsing. These options are (a) specific to
4030+# the libtool wrapper, (b) are identical between the wrapper
4031+# /script/ and the wrapper /executable/ which is used only on
4032+# windows platforms, and (c) all begin with the string "--lt-"
4033+# (application programs are unlikely to have options which match
4034+# this pattern).
4035+#
4036+# There are only two supported options: --lt-debug and
4037+# --lt-dump-script. There is, deliberately, no --lt-help.
4038+#
4039+# The first argument to this parsing function should be the
4040+# script's $0 value, followed by "$@".
4041+lt_option_debug=
4042+func_parse_lt_options ()
4043+{
4044+ lt_script_arg0=\$0
4045+ shift
4046+ for lt_opt
4047+ do
4048+ case \"\$lt_opt\" in
4049+ --lt-debug) lt_option_debug=1 ;;
4050+ --lt-dump-script)
4051+ lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
4052+ test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
4053+ lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
4054+ cat \"\$lt_dump_D/\$lt_dump_F\"
4055+ exit 0
4056+ ;;
4057+ --lt-*)
4058+ \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
4059+ exit 1
4060+ ;;
4061+ esac
4062+ done
4063+
4064+ # Print the debug banner immediately:
4065+ if test -n \"\$lt_option_debug\"; then
4066+ echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
4067+ fi
4068+}
4069+
4070+# Used when --lt-debug. Prints its arguments to stdout
4071+# (redirection is the responsibility of the caller)
4072+func_lt_dump_args ()
4073+{
4074+ lt_dump_args_N=1;
4075+ for lt_arg
4076+ do
4077+ \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
4078+ lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
4079+ done
4080+}
4081+
4082+# Core function for launching the target application
4083+func_exec_program_core ()
4084+{
4085+"
4086+ case $host in
4087+ # Backslashes separate directories on plain windows
4088+ *-*-mingw | *-*-os2* | *-cegcc*)
4089+ $ECHO "\
4090+ if test -n \"\$lt_option_debug\"; then
4091+ \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
4092+ func_lt_dump_args \${1+\"\$@\"} 1>&2
4093+ fi
4094+ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4095+"
4096+ ;;
4097+
4098+ *)
4099+ $ECHO "\
4100+ if test -n \"\$lt_option_debug\"; then
4101+ \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
4102+ func_lt_dump_args \${1+\"\$@\"} 1>&2
4103+ fi
4104+ exec \"\$progdir/\$program\" \${1+\"\$@\"}
4105+"
4106+ ;;
4107+ esac
4108+ $ECHO "\
4109+ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
4110+ exit 1
4111+}
4112+
4113+# A function to encapsulate launching the target application
4114+# Strips options in the --lt-* namespace from \$@ and
4115+# launches target application with the remaining arguments.
4116+func_exec_program ()
4117+{
4118+ for lt_wr_arg
4119+ do
4120+ case \$lt_wr_arg in
4121+ --lt-*) ;;
4122+ *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
4123+ esac
4124+ shift
4125+ done
4126+ func_exec_program_core \${1+\"\$@\"}
4127+}
4128+
4129+ # Parse options
4130+ func_parse_lt_options \"\$0\" \${1+\"\$@\"}
4131
4132 # Find the directory that this script lives in.
4133 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
4134@@ -3078,7 +4065,7 @@
4135
4136 # relink executable if necessary
4137 if test -n \"\$relink_command\"; then
4138- if relink_command_output=\`eval \"\$relink_command\" 2>&1\`; then :
4139+ if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4140 else
4141 $ECHO \"\$relink_command_output\" >&2
4142 $RM \"\$progdir/\$file\"
4143@@ -3102,6 +4089,18 @@
4144
4145 if test -f \"\$progdir/\$program\"; then"
4146
4147+ # fixup the dll searchpath if we need to.
4148+ #
4149+ # Fix the DLL searchpath if we need to. Do this before prepending
4150+ # to shlibpath, because on Windows, both are PATH and uninstalled
4151+ # libraries must come first.
4152+ if test -n "$dllsearchpath"; then
4153+ $ECHO "\
4154+ # Add the dll search path components to the executable PATH
4155+ PATH=$dllsearchpath:\$PATH
4156+"
4157+ fi
4158+
4159 # Export our shlibpath_var if we have one.
4160 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4161 $ECHO "\
4162@@ -3116,35 +4115,10 @@
4163 "
4164 fi
4165
4166- # fixup the dll searchpath if we need to.
4167- if test -n "$dllsearchpath"; then
4168- $ECHO "\
4169- # Add the dll search path components to the executable PATH
4170- PATH=$dllsearchpath:\$PATH
4171-"
4172- fi
4173-
4174 $ECHO "\
4175 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4176 # Run the actual program with our arguments.
4177-"
4178- case $host in
4179- # Backslashes separate directories on plain windows
4180- *-*-mingw | *-*-os2* | *-cegcc*)
4181- $ECHO "\
4182- exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4183-"
4184- ;;
4185-
4186- *)
4187- $ECHO "\
4188- exec \"\$progdir/\$program\" \${1+\"\$@\"}
4189-"
4190- ;;
4191- esac
4192- $ECHO "\
4193- \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
4194- exit 1
4195+ func_exec_program \${1+\"\$@\"}
4196 fi
4197 else
4198 # The program doesn't exist.
4199@@ -3158,166 +4132,6 @@
4200 }
4201
4202
4203-# func_to_host_path arg
4204-#
4205-# Convert paths to host format when used with build tools.
4206-# Intended for use with "native" mingw (where libtool itself
4207-# is running under the msys shell), or in the following cross-
4208-# build environments:
4209-# $build $host
4210-# mingw (msys) mingw [e.g. native]
4211-# cygwin mingw
4212-# *nix + wine mingw
4213-# where wine is equipped with the `winepath' executable.
4214-# In the native mingw case, the (msys) shell automatically
4215-# converts paths for any non-msys applications it launches,
4216-# but that facility isn't available from inside the cwrapper.
4217-# Similar accommodations are necessary for $host mingw and
4218-# $build cygwin. Calling this function does no harm for other
4219-# $host/$build combinations not listed above.
4220-#
4221-# ARG is the path (on $build) that should be converted to
4222-# the proper representation for $host. The result is stored
4223-# in $func_to_host_path_result.
4224-func_to_host_path ()
4225-{
4226- func_to_host_path_result="$1"
4227- if test -n "$1"; then
4228- case $host in
4229- *mingw* )
4230- lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
4231- case $build in
4232- *mingw* ) # actually, msys
4233- # awkward: cmd appends spaces to result
4234- func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null |
4235- $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
4236- ;;
4237- *cygwin* )
4238- func_to_host_path_result=`cygpath -w "$1" |
4239- $SED -e "$lt_sed_naive_backslashify"`
4240- ;;
4241- * )
4242- # Unfortunately, winepath does not exit with a non-zero
4243- # error code, so we are forced to check the contents of
4244- # stdout. On the other hand, if the command is not
4245- # found, the shell will set an exit code of 127 and print
4246- # *an error message* to stdout. So we must check for both
4247- # error code of zero AND non-empty stdout, which explains
4248- # the odd construction:
4249- func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
4250- if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
4251- func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" |
4252- $SED -e "$lt_sed_naive_backslashify"`
4253- else
4254- # Allow warning below.
4255- func_to_host_path_result=
4256- fi
4257- ;;
4258- esac
4259- if test -z "$func_to_host_path_result" ; then
4260- func_error "Could not determine host path corresponding to"
4261- func_error " \`$1'"
4262- func_error "Continuing, but uninstalled executables may not work."
4263- # Fallback:
4264- func_to_host_path_result="$1"
4265- fi
4266- ;;
4267- esac
4268- fi
4269-}
4270-# end: func_to_host_path
4271-
4272-# func_to_host_pathlist arg
4273-#
4274-# Convert pathlists to host format when used with build tools.
4275-# See func_to_host_path(), above. This function supports the
4276-# following $build/$host combinations (but does no harm for
4277-# combinations not listed here):
4278-# $build $host
4279-# mingw (msys) mingw [e.g. native]
4280-# cygwin mingw
4281-# *nix + wine mingw
4282-#
4283-# Path separators are also converted from $build format to
4284-# $host format. If ARG begins or ends with a path separator
4285-# character, it is preserved (but converted to $host format)
4286-# on output.
4287-#
4288-# ARG is a pathlist (on $build) that should be converted to
4289-# the proper representation on $host. The result is stored
4290-# in $func_to_host_pathlist_result.
4291-func_to_host_pathlist ()
4292-{
4293- func_to_host_pathlist_result="$1"
4294- if test -n "$1"; then
4295- case $host in
4296- *mingw* )
4297- lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
4298- # Remove leading and trailing path separator characters from
4299- # ARG. msys behavior is inconsistent here, cygpath turns them
4300- # into '.;' and ';.', and winepath ignores them completely.
4301- func_stripname : : "$1"
4302- func_to_host_pathlist_tmp1=$func_stripname_result
4303- case $build in
4304- *mingw* ) # Actually, msys.
4305- # Awkward: cmd appends spaces to result.
4306- func_to_host_pathlist_result=`
4307- ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null |
4308- $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
4309- ;;
4310- *cygwin* )
4311- func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" |
4312- $SED -e "$lt_sed_naive_backslashify"`
4313- ;;
4314- * )
4315- # unfortunately, winepath doesn't convert pathlists
4316- func_to_host_pathlist_result=""
4317- func_to_host_pathlist_oldIFS=$IFS
4318- IFS=:
4319- for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
4320- IFS=$func_to_host_pathlist_oldIFS
4321- if test -n "$func_to_host_pathlist_f" ; then
4322- func_to_host_path "$func_to_host_pathlist_f"
4323- if test -n "$func_to_host_path_result" ; then
4324- if test -z "$func_to_host_pathlist_result" ; then
4325- func_to_host_pathlist_result="$func_to_host_path_result"
4326- else
4327- func_append func_to_host_pathlist_result ";$func_to_host_path_result"
4328- fi
4329- fi
4330- fi
4331- done
4332- IFS=$func_to_host_pathlist_oldIFS
4333- ;;
4334- esac
4335- if test -z "$func_to_host_pathlist_result"; then
4336- func_error "Could not determine the host path(s) corresponding to"
4337- func_error " \`$1'"
4338- func_error "Continuing, but uninstalled executables may not work."
4339- # Fallback. This may break if $1 contains DOS-style drive
4340- # specifications. The fix is not to complicate the expression
4341- # below, but for the user to provide a working wine installation
4342- # with winepath so that path translation in the cross-to-mingw
4343- # case works properly.
4344- lt_replace_pathsep_nix_to_dos="s|:|;|g"
4345- func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
4346- $SED -e "$lt_replace_pathsep_nix_to_dos"`
4347- fi
4348- # Now, add the leading and trailing path separators back
4349- case "$1" in
4350- :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
4351- ;;
4352- esac
4353- case "$1" in
4354- *: ) func_append func_to_host_pathlist_result ";"
4355- ;;
4356- esac
4357- ;;
4358- esac
4359- fi
4360-}
4361-# end: func_to_host_pathlist
4362-
4363 # func_emit_cwrapperexe_src
4364 # emit the source code for a wrapper executable on stdout
4365 # Must ONLY be called from within func_mode_link because
4366@@ -3334,10 +4148,6 @@
4367
4368 This wrapper executable should never be moved out of the build directory.
4369 If it is, it will not operate correctly.
4370-
4371- Currently, it simply execs the wrapper *script* "$SHELL $output",
4372- but could eventually absorb all of the scripts functionality and
4373- exec $objdir/$outputname directly.
4374 */
4375 EOF
4376 cat <<"EOF"
4377@@ -3462,22 +4272,13 @@
4378 if (stale) { free ((void *) stale); stale = 0; } \
4379 } while (0)
4380
4381-#undef LTWRAPPER_DEBUGPRINTF
4382-#if defined LT_DEBUGWRAPPER
4383-# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
4384-static void
4385-ltwrapper_debugprintf (const char *fmt, ...)
4386-{
4387- va_list args;
4388- va_start (args, fmt);
4389- (void) vfprintf (stderr, fmt, args);
4390- va_end (args);
4391-}
4392+#if defined(LT_DEBUGWRAPPER)
4393+static int lt_debug = 1;
4394 #else
4395-# define LTWRAPPER_DEBUGPRINTF(args)
4396+static int lt_debug = 0;
4397 #endif
4398
4399-const char *program_name = NULL;
4400+const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4401
4402 void *xmalloc (size_t num);
4403 char *xstrdup (const char *string);
4404@@ -3487,7 +4288,10 @@
4405 int make_executable (const char *path);
4406 int check_executable (const char *path);
4407 char *strendzap (char *str, const char *pat);
4408-void lt_fatal (const char *message, ...);
4409+void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4410+void lt_fatal (const char *file, int line, const char *message, ...);
4411+static const char *nonnull (const char *s);
4412+static const char *nonempty (const char *s);
4413 void lt_setenv (const char *name, const char *value);
4414 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4415 void lt_update_exe_path (const char *name, const char *value);
4416@@ -3497,14 +4301,14 @@
4417 EOF
4418
4419 cat <<EOF
4420-const char * MAGIC_EXE = "$magic_exe";
4421+volatile const char * MAGIC_EXE = "$magic_exe";
4422 const char * LIB_PATH_VARNAME = "$shlibpath_var";
4423 EOF
4424
4425 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4426- func_to_host_pathlist "$temp_rpath"
4427+ func_to_host_path "$temp_rpath"
4428 cat <<EOF
4429-const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
4430+const char * LIB_PATH_VALUE = "$func_to_host_path_result";
4431 EOF
4432 else
4433 cat <<"EOF"
4434@@ -3513,10 +4317,10 @@
4435 fi
4436
4437 if test -n "$dllsearchpath"; then
4438- func_to_host_pathlist "$dllsearchpath:"
4439+ func_to_host_path "$dllsearchpath:"
4440 cat <<EOF
4441 const char * EXE_PATH_VARNAME = "PATH";
4442-const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
4443+const char * EXE_PATH_VALUE = "$func_to_host_path_result";
4444 EOF
4445 else
4446 cat <<"EOF"
4447@@ -3539,12 +4343,10 @@
4448 cat <<"EOF"
4449
4450 #define LTWRAPPER_OPTION_PREFIX "--lt-"
4451-#define LTWRAPPER_OPTION_PREFIX_LENGTH 5
4452
4453-static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
4454 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4455-
4456 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4457+static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
4458
4459 int
4460 main (int argc, char *argv[])
4461@@ -3561,10 +4363,13 @@
4462 int i;
4463
4464 program_name = (char *) xstrdup (base_name (argv[0]));
4465- LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
4466- LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
4467+ newargz = XMALLOC (char *, argc + 1);
4468
4469- /* very simple arg parsing; don't want to rely on getopt */
4470+ /* very simple arg parsing; don't want to rely on getopt
4471+ * also, copy all non cwrapper options to newargz, except
4472+ * argz[0], which is handled differently
4473+ */
4474+ newargc=0;
4475 for (i = 1; i < argc; i++)
4476 {
4477 if (strcmp (argv[i], dumpscript_opt) == 0)
4478@@ -3581,21 +4386,54 @@
4479 lt_dump_script (stdout);
4480 return 0;
4481 }
4482+ if (strcmp (argv[i], debug_opt) == 0)
4483+ {
4484+ lt_debug = 1;
4485+ continue;
4486+ }
4487+ if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4488+ {
4489+ /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4490+ namespace, but it is not one of the ones we know about and
4491+ have already dealt with, above (inluding dump-script), then
4492+ report an error. Otherwise, targets might begin to believe
4493+ they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4494+ namespace. The first time any user complains about this, we'll
4495+ need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4496+ or a configure.ac-settable value.
4497+ */
4498+ lt_fatal (__FILE__, __LINE__,
4499+ "unrecognized %s option: '%s'",
4500+ ltwrapper_option_prefix, argv[i]);
4501+ }
4502+ /* otherwise ... */
4503+ newargz[++newargc] = xstrdup (argv[i]);
4504 }
4505+ newargz[++newargc] = NULL;
4506+
4507+EOF
4508+ cat <<EOF
4509+ /* The GNU banner must be the first non-error debug message */
4510+ lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4511+EOF
4512+ cat <<"EOF"
4513+ lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4514+ lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4515
4516- newargz = XMALLOC (char *, argc + 1);
4517 tmp_pathspec = find_executable (argv[0]);
4518 if (tmp_pathspec == NULL)
4519- lt_fatal ("Couldn't find %s", argv[0]);
4520- LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
4521- tmp_pathspec));
4522+ lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4523+ lt_debugprintf (__FILE__, __LINE__,
4524+ "(main) found exe (before symlink chase) at: %s\n",
4525+ tmp_pathspec);
4526
4527 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4528- LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
4529- actual_cwrapper_path));
4530+ lt_debugprintf (__FILE__, __LINE__,
4531+ "(main) found exe (after symlink chase) at: %s\n",
4532+ actual_cwrapper_path);
4533 XFREE (tmp_pathspec);
4534
4535- actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
4536+ actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4537 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4538
4539 /* wrapper name transforms */
4540@@ -3613,8 +4451,9 @@
4541 target_name = tmp_pathspec;
4542 tmp_pathspec = 0;
4543
4544- LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
4545- target_name));
4546+ lt_debugprintf (__FILE__, __LINE__,
4547+ "(main) libtool target name: %s\n",
4548+ target_name);
4549 EOF
4550
4551 cat <<EOF
4552@@ -3664,35 +4503,19 @@
4553
4554 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4555 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4556- lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4557+ /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4558+ be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4559+ because on Windows, both *_VARNAMEs are PATH but uninstalled
4560+ libraries must come first. */
4561 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4562+ lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4563
4564- newargc=0;
4565- for (i = 1; i < argc; i++)
4566- {
4567- if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
4568- {
4569- /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4570- namespace, but it is not one of the ones we know about and
4571- have already dealt with, above (inluding dump-script), then
4572- report an error. Otherwise, targets might begin to believe
4573- they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4574- namespace. The first time any user complains about this, we'll
4575- need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4576- or a configure.ac-settable value.
4577- */
4578- lt_fatal ("Unrecognized option in %s namespace: '%s'",
4579- ltwrapper_option_prefix, argv[i]);
4580- }
4581- /* otherwise ... */
4582- newargz[++newargc] = xstrdup (argv[i]);
4583- }
4584- newargz[++newargc] = NULL;
4585-
4586- LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
4587+ lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4588+ nonnull (lt_argv_zero));
4589 for (i = 0; i < newargc; i++)
4590 {
4591- LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
4592+ lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4593+ i, nonnull (newargz[i]));
4594 }
4595
4596 EOF
4597@@ -3706,7 +4529,9 @@
4598 if (rval == -1)
4599 {
4600 /* failed to start process */
4601- LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
4602+ lt_debugprintf (__FILE__, __LINE__,
4603+ "(main) failed to launch target \"%s\": %s\n",
4604+ lt_argv_zero, nonnull (strerror (errno)));
4605 return 127;
4606 }
4607 return rval;
4608@@ -3728,7 +4553,7 @@
4609 {
4610 void *p = (void *) malloc (num);
4611 if (!p)
4612- lt_fatal ("Memory exhausted");
4613+ lt_fatal (__FILE__, __LINE__, "memory exhausted");
4614
4615 return p;
4616 }
4617@@ -3762,8 +4587,8 @@
4618 {
4619 struct stat st;
4620
4621- LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
4622- path ? (*path ? path : "EMPTY!") : "NULL!"));
4623+ lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
4624+ nonempty (path));
4625 if ((!path) || (!*path))
4626 return 0;
4627
4628@@ -3780,8 +4605,8 @@
4629 int rval = 0;
4630 struct stat st;
4631
4632- LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
4633- path ? (*path ? path : "EMPTY!") : "NULL!"));
4634+ lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
4635+ nonempty (path));
4636 if ((!path) || (!*path))
4637 return 0;
4638
4639@@ -3807,8 +4632,8 @@
4640 int tmp_len;
4641 char *concat_name;
4642
4643- LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
4644- wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
4645+ lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
4646+ nonempty (wrapper));
4647
4648 if ((wrapper == NULL) || (*wrapper == '\0'))
4649 return NULL;
4650@@ -3861,7 +4686,8 @@
4651 {
4652 /* empty path: current directory */
4653 if (getcwd (tmp, LT_PATHMAX) == NULL)
4654- lt_fatal ("getcwd failed");
4655+ lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4656+ nonnull (strerror (errno)));
4657 tmp_len = strlen (tmp);
4658 concat_name =
4659 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4660@@ -3886,7 +4712,8 @@
4661 }
4662 /* Relative path | not found in path: prepend cwd */
4663 if (getcwd (tmp, LT_PATHMAX) == NULL)
4664- lt_fatal ("getcwd failed");
4665+ lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4666+ nonnull (strerror (errno)));
4667 tmp_len = strlen (tmp);
4668 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4669 memcpy (concat_name, tmp, tmp_len);
4670@@ -3912,8 +4739,9 @@
4671 int has_symlinks = 0;
4672 while (strlen (tmp_pathspec) && !has_symlinks)
4673 {
4674- LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
4675- tmp_pathspec));
4676+ lt_debugprintf (__FILE__, __LINE__,
4677+ "checking path component for symlinks: %s\n",
4678+ tmp_pathspec);
4679 if (lstat (tmp_pathspec, &s) == 0)
4680 {
4681 if (S_ISLNK (s.st_mode) != 0)
4682@@ -3935,8 +4763,9 @@
4683 }
4684 else
4685 {
4686- char *errstr = strerror (errno);
4687- lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
4688+ lt_fatal (__FILE__, __LINE__,
4689+ "error accessing file \"%s\": %s",
4690+ tmp_pathspec, nonnull (strerror (errno)));
4691 }
4692 }
4693 XFREE (tmp_pathspec);
4694@@ -3949,7 +4778,8 @@
4695 tmp_pathspec = realpath (pathspec, buf);
4696 if (tmp_pathspec == 0)
4697 {
4698- lt_fatal ("Could not follow symlinks for %s", pathspec);
4699+ lt_fatal (__FILE__, __LINE__,
4700+ "could not follow symlinks for %s", pathspec);
4701 }
4702 return xstrdup (tmp_pathspec);
4703 #endif
4704@@ -3975,11 +4805,25 @@
4705 return str;
4706 }
4707
4708+void
4709+lt_debugprintf (const char *file, int line, const char *fmt, ...)
4710+{
4711+ va_list args;
4712+ if (lt_debug)
4713+ {
4714+ (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
4715+ va_start (args, fmt);
4716+ (void) vfprintf (stderr, fmt, args);
4717+ va_end (args);
4718+ }
4719+}
4720+
4721 static void
4722-lt_error_core (int exit_status, const char *mode,
4723+lt_error_core (int exit_status, const char *file,
4724+ int line, const char *mode,
4725 const char *message, va_list ap)
4726 {
4727- fprintf (stderr, "%s: %s: ", program_name, mode);
4728+ fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
4729 vfprintf (stderr, message, ap);
4730 fprintf (stderr, ".\n");
4731
4732@@ -3988,20 +4832,32 @@
4733 }
4734
4735 void
4736-lt_fatal (const char *message, ...)
4737+lt_fatal (const char *file, int line, const char *message, ...)
4738 {
4739 va_list ap;
4740 va_start (ap, message);
4741- lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4742+ lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
4743 va_end (ap);
4744 }
4745
4746+static const char *
4747+nonnull (const char *s)
4748+{
4749+ return s ? s : "(null)";
4750+}
4751+
4752+static const char *
4753+nonempty (const char *s)
4754+{
4755+ return (s && !*s) ? "(empty)" : nonnull (s);
4756+}
4757+
4758 void
4759 lt_setenv (const char *name, const char *value)
4760 {
4761- LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
4762- (name ? name : "<NULL>"),
4763- (value ? value : "<NULL>")));
4764+ lt_debugprintf (__FILE__, __LINE__,
4765+ "(lt_setenv) setting '%s' to '%s'\n",
4766+ nonnull (name), nonnull (value));
4767 {
4768 #ifdef HAVE_SETENV
4769 /* always make a copy, for consistency with !HAVE_SETENV */
4770@@ -4049,9 +4905,9 @@
4771 void
4772 lt_update_exe_path (const char *name, const char *value)
4773 {
4774- LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4775- (name ? name : "<NULL>"),
4776- (value ? value : "<NULL>")));
4777+ lt_debugprintf (__FILE__, __LINE__,
4778+ "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4779+ nonnull (name), nonnull (value));
4780
4781 if (name && *name && value && *value)
4782 {
4783@@ -4070,9 +4926,9 @@
4784 void
4785 lt_update_lib_path (const char *name, const char *value)
4786 {
4787- LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4788- (name ? name : "<NULL>"),
4789- (value ? value : "<NULL>")));
4790+ lt_debugprintf (__FILE__, __LINE__,
4791+ "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4792+ nonnull (name), nonnull (value));
4793
4794 if (name && *name && value && *value)
4795 {
4796@@ -4222,7 +5078,7 @@
4797 func_win32_import_lib_p ()
4798 {
4799 $opt_debug
4800- case `eval "$file_magic_cmd \"\$1\" 2>/dev/null" | $SED -e 10q` in
4801+ case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
4802 *import*) : ;;
4803 *) false ;;
4804 esac
4805@@ -4401,9 +5257,9 @@
4806 ;;
4807 *)
4808 if test "$prev" = dlfiles; then
4809- dlfiles="$dlfiles $arg"
4810+ func_append dlfiles " $arg"
4811 else
4812- dlprefiles="$dlprefiles $arg"
4813+ func_append dlprefiles " $arg"
4814 fi
4815 prev=
4816 continue
4817@@ -4427,7 +5283,7 @@
4818 *-*-darwin*)
4819 case "$deplibs " in
4820 *" $qarg.ltframework "*) ;;
4821- *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
4822+ *) func_append deplibs " $qarg.ltframework" # this is fixed later
4823 ;;
4824 esac
4825 ;;
4826@@ -4446,7 +5302,7 @@
4827 moreargs=
4828 for fil in `cat "$save_arg"`
4829 do
4830-# moreargs="$moreargs $fil"
4831+# func_append moreargs " $fil"
4832 arg=$fil
4833 # A libtool-controlled object.
4834
4835@@ -4475,7 +5331,7 @@
4836
4837 if test "$prev" = dlfiles; then
4838 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4839- dlfiles="$dlfiles $pic_object"
4840+ func_append dlfiles " $pic_object"
4841 prev=
4842 continue
4843 else
4844@@ -4487,7 +5343,7 @@
4845 # CHECK ME: I think I busted this. -Ossama
4846 if test "$prev" = dlprefiles; then
4847 # Preload the old-style object.
4848- dlprefiles="$dlprefiles $pic_object"
4849+ func_append dlprefiles " $pic_object"
4850 prev=
4851 fi
4852
4853@@ -4557,12 +5413,12 @@
4854 if test "$prev" = rpath; then
4855 case "$rpath " in
4856 *" $arg "*) ;;
4857- *) rpath="$rpath $arg" ;;
4858+ *) func_append rpath " $arg" ;;
4859 esac
4860 else
4861 case "$xrpath " in
4862 *" $arg "*) ;;
4863- *) xrpath="$xrpath $arg" ;;
4864+ *) func_append xrpath " $arg" ;;
4865 esac
4866 fi
4867 prev=
4868@@ -4574,28 +5430,28 @@
4869 continue
4870 ;;
4871 weak)
4872- weak_libs="$weak_libs $arg"
4873+ func_append weak_libs " $arg"
4874 prev=
4875 continue
4876 ;;
4877 xcclinker)
4878- linker_flags="$linker_flags $qarg"
4879- compiler_flags="$compiler_flags $qarg"
4880+ func_append linker_flags " $qarg"
4881+ func_append compiler_flags " $qarg"
4882 prev=
4883 func_append compile_command " $qarg"
4884 func_append finalize_command " $qarg"
4885 continue
4886 ;;
4887 xcompiler)
4888- compiler_flags="$compiler_flags $qarg"
4889+ func_append compiler_flags " $qarg"
4890 prev=
4891 func_append compile_command " $qarg"
4892 func_append finalize_command " $qarg"
4893 continue
4894 ;;
4895 xlinker)
4896- linker_flags="$linker_flags $qarg"
4897- compiler_flags="$compiler_flags $wl$qarg"
4898+ func_append linker_flags " $qarg"
4899+ func_append compiler_flags " $wl$qarg"
4900 prev=
4901 func_append compile_command " $wl$qarg"
4902 func_append finalize_command " $wl$qarg"
4903@@ -4686,15 +5542,16 @@
4904 ;;
4905
4906 -L*)
4907- func_stripname '-L' '' "$arg"
4908- dir=$func_stripname_result
4909- if test -z "$dir"; then
4910+ func_stripname "-L" '' "$arg"
4911+ if test -z "$func_stripname_result"; then
4912 if test "$#" -gt 0; then
4913 func_fatal_error "require no space between \`-L' and \`$1'"
4914 else
4915 func_fatal_error "need path for \`-L' option"
4916 fi
4917 fi
4918+ func_resolve_sysroot "$func_stripname_result"
4919+ dir=$func_resolve_sysroot_result
4920 # We need an absolute path.
4921 case $dir in
4922 [\\/]* | [A-Za-z]:[\\/]*) ;;
4923@@ -4706,10 +5563,16 @@
4924 ;;
4925 esac
4926 case "$deplibs " in
4927- *" -L$dir "*) ;;
4928+ *" -L$dir "* | *" $arg "*)
4929+ # Will only happen for absolute or sysroot arguments
4930+ ;;
4931 *)
4932- deplibs="$deplibs -L$dir"
4933- lib_search_path="$lib_search_path $dir"
4934+ # Preserve sysroot, but never include relative directories
4935+ case $dir in
4936+ [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
4937+ *) func_append deplibs " -L$dir" ;;
4938+ esac
4939+ func_append lib_search_path " $dir"
4940 ;;
4941 esac
4942 case $host in
4943@@ -4718,12 +5581,12 @@
4944 case :$dllsearchpath: in
4945 *":$dir:"*) ;;
4946 ::) dllsearchpath=$dir;;
4947- *) dllsearchpath="$dllsearchpath:$dir";;
4948+ *) func_append dllsearchpath ":$dir";;
4949 esac
4950 case :$dllsearchpath: in
4951 *":$testbindir:"*) ;;
4952 ::) dllsearchpath=$testbindir;;
4953- *) dllsearchpath="$dllsearchpath:$testbindir";;
4954+ *) func_append dllsearchpath ":$testbindir";;
4955 esac
4956 ;;
4957 esac
4958@@ -4747,7 +5610,7 @@
4959 ;;
4960 *-*-rhapsody* | *-*-darwin1.[012])
4961 # Rhapsody C and math libraries are in the System framework
4962- deplibs="$deplibs System.ltframework"
4963+ func_append deplibs " System.ltframework"
4964 continue
4965 ;;
4966 *-*-sco3.2v5* | *-*-sco5v6*)
4967@@ -4758,9 +5621,6 @@
4968 # Compiler inserts libc in the correct place for threads to work
4969 test "X$arg" = "X-lc" && continue
4970 ;;
4971- *-*-linux*)
4972- test "X$arg" = "X-lc" && continue
4973- ;;
4974 esac
4975 elif test "X$arg" = "X-lc_r"; then
4976 case $host in
4977@@ -4770,7 +5630,7 @@
4978 ;;
4979 esac
4980 fi
4981- deplibs="$deplibs $arg"
4982+ func_append deplibs " $arg"
4983 continue
4984 ;;
4985
4986@@ -4782,8 +5642,8 @@
4987 # Tru64 UNIX uses -model [arg] to determine the layout of C++
4988 # classes, name mangling, and exception handling.
4989 # Darwin uses the -arch flag to determine output architecture.
4990- -model|-arch|-isysroot)
4991- compiler_flags="$compiler_flags $arg"
4992+ -model|-arch|-isysroot|--sysroot)
4993+ func_append compiler_flags " $arg"
4994 func_append compile_command " $arg"
4995 func_append finalize_command " $arg"
4996 prev=xcompiler
4997@@ -4791,12 +5651,12 @@
4998 ;;
4999
5000 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5001- compiler_flags="$compiler_flags $arg"
5002+ func_append compiler_flags " $arg"
5003 func_append compile_command " $arg"
5004 func_append finalize_command " $arg"
5005 case "$new_inherited_linker_flags " in
5006 *" $arg "*) ;;
5007- * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
5008+ * ) func_append new_inherited_linker_flags " $arg" ;;
5009 esac
5010 continue
5011 ;;
5012@@ -4863,13 +5723,17 @@
5013 # We need an absolute path.
5014 case $dir in
5015 [\\/]* | [A-Za-z]:[\\/]*) ;;
5016+ =*)
5017+ func_stripname '=' '' "$dir"
5018+ dir=$lt_sysroot$func_stripname_result
5019+ ;;
5020 *)
5021 func_fatal_error "only absolute run-paths are allowed"
5022 ;;
5023 esac
5024 case "$xrpath " in
5025 *" $dir "*) ;;
5026- *) xrpath="$xrpath $dir" ;;
5027+ *) func_append xrpath " $dir" ;;
5028 esac
5029 continue
5030 ;;
5031@@ -4922,8 +5786,8 @@
5032 for flag in $args; do
5033 IFS="$save_ifs"
5034 func_quote_for_eval "$flag"
5035- arg="$arg $func_quote_for_eval_result"
5036- compiler_flags="$compiler_flags $func_quote_for_eval_result"
5037+ func_append arg " $func_quote_for_eval_result"
5038+ func_append compiler_flags " $func_quote_for_eval_result"
5039 done
5040 IFS="$save_ifs"
5041 func_stripname ' ' '' "$arg"
5042@@ -4938,9 +5802,9 @@
5043 for flag in $args; do
5044 IFS="$save_ifs"
5045 func_quote_for_eval "$flag"
5046- arg="$arg $wl$func_quote_for_eval_result"
5047- compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
5048- linker_flags="$linker_flags $func_quote_for_eval_result"
5049+ func_append arg " $wl$func_quote_for_eval_result"
5050+ func_append compiler_flags " $wl$func_quote_for_eval_result"
5051+ func_append linker_flags " $func_quote_for_eval_result"
5052 done
5053 IFS="$save_ifs"
5054 func_stripname ' ' '' "$arg"
5055@@ -4968,24 +5832,27 @@
5056 arg="$func_quote_for_eval_result"
5057 ;;
5058
5059- # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
5060- # -r[0-9][0-9]* specifies the processor on the SGI compiler
5061- # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
5062- # +DA*, +DD* enable 64-bit mode on the HP compiler
5063- # -q* pass through compiler args for the IBM compiler
5064- # -m*, -t[45]*, -txscale* pass through architecture-specific
5065- # compiler args for GCC
5066- # -F/path gives path to uninstalled frameworks, gcc on darwin
5067- # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
5068- # @file GCC response files
5069- # -tp=* Portland pgcc target processor selection
5070+ # Flags to be passed through unchanged, with rationale:
5071+ # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
5072+ # -r[0-9][0-9]* specify processor for the SGI compiler
5073+ # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
5074+ # +DA*, +DD* enable 64-bit mode for the HP compiler
5075+ # -q* compiler args for the IBM compiler
5076+ # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
5077+ # -F/path path to uninstalled frameworks, gcc on darwin
5078+ # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
5079+ # @file GCC response files
5080+ # -tp=* Portland pgcc target processor selection
5081+ # --sysroot=* for sysroot support
5082+ # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
5083 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5084- -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*)
5085+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
5086+ -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
5087 func_quote_for_eval "$arg"
5088 arg="$func_quote_for_eval_result"
5089 func_append compile_command " $arg"
5090 func_append finalize_command " $arg"
5091- compiler_flags="$compiler_flags $arg"
5092+ func_append compiler_flags " $arg"
5093 continue
5094 ;;
5095
5096@@ -4997,7 +5864,7 @@
5097
5098 *.$objext)
5099 # A standard object.
5100- objs="$objs $arg"
5101+ func_append objs " $arg"
5102 ;;
5103
5104 *.lo)
5105@@ -5028,7 +5895,7 @@
5106
5107 if test "$prev" = dlfiles; then
5108 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5109- dlfiles="$dlfiles $pic_object"
5110+ func_append dlfiles " $pic_object"
5111 prev=
5112 continue
5113 else
5114@@ -5040,7 +5907,7 @@
5115 # CHECK ME: I think I busted this. -Ossama
5116 if test "$prev" = dlprefiles; then
5117 # Preload the old-style object.
5118- dlprefiles="$dlprefiles $pic_object"
5119+ func_append dlprefiles " $pic_object"
5120 prev=
5121 fi
5122
5123@@ -5085,24 +5952,25 @@
5124
5125 *.$libext)
5126 # An archive.
5127- deplibs="$deplibs $arg"
5128- old_deplibs="$old_deplibs $arg"
5129+ func_append deplibs " $arg"
5130+ func_append old_deplibs " $arg"
5131 continue
5132 ;;
5133
5134 *.la)
5135 # A libtool-controlled library.
5136
5137+ func_resolve_sysroot "$arg"
5138 if test "$prev" = dlfiles; then
5139 # This library was specified with -dlopen.
5140- dlfiles="$dlfiles $arg"
5141+ func_append dlfiles " $func_resolve_sysroot_result"
5142 prev=
5143 elif test "$prev" = dlprefiles; then
5144 # The library was specified with -dlpreopen.
5145- dlprefiles="$dlprefiles $arg"
5146+ func_append dlprefiles " $func_resolve_sysroot_result"
5147 prev=
5148 else
5149- deplibs="$deplibs $arg"
5150+ func_append deplibs " $func_resolve_sysroot_result"
5151 fi
5152 continue
5153 ;;
5154@@ -5127,7 +5995,7 @@
5155 func_fatal_help "the \`$prevarg' option requires an argument"
5156
5157 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
5158- eval "arg=\"$export_dynamic_flag_spec\""
5159+ eval arg=\"$export_dynamic_flag_spec\"
5160 func_append compile_command " $arg"
5161 func_append finalize_command " $arg"
5162 fi
5163@@ -5144,11 +6012,13 @@
5164 else
5165 shlib_search_path=
5166 fi
5167- eval "sys_lib_search_path=\"$sys_lib_search_path_spec\""
5168- eval "sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\""
5169+ eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
5170+ eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
5171
5172 func_dirname "$output" "/" ""
5173 output_objdir="$func_dirname_result$objdir"
5174+ func_to_tool_file "$output_objdir/"
5175+ tool_output_objdir=$func_to_tool_file_result
5176 # Create the object directory.
5177 func_mkdir_p "$output_objdir"
5178
5179@@ -5169,12 +6039,12 @@
5180 # Find all interdependent deplibs by searching for libraries
5181 # that are linked more than once (e.g. -la -lb -la)
5182 for deplib in $deplibs; do
5183- if $opt_duplicate_deps ; then
5184+ if $opt_preserve_dup_deps ; then
5185 case "$libs " in
5186- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5187+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
5188 esac
5189 fi
5190- libs="$libs $deplib"
5191+ func_append libs " $deplib"
5192 done
5193
5194 if test "$linkmode" = lib; then
5195@@ -5187,9 +6057,9 @@
5196 if $opt_duplicate_compiler_generated_deps; then
5197 for pre_post_dep in $predeps $postdeps; do
5198 case "$pre_post_deps " in
5199- *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
5200+ *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
5201 esac
5202- pre_post_deps="$pre_post_deps $pre_post_dep"
5203+ func_append pre_post_deps " $pre_post_dep"
5204 done
5205 fi
5206 pre_post_deps=
5207@@ -5256,8 +6126,9 @@
5208 for lib in $dlprefiles; do
5209 # Ignore non-libtool-libs
5210 dependency_libs=
5211+ func_resolve_sysroot "$lib"
5212 case $lib in
5213- *.la) func_source "$lib" ;;
5214+ *.la) func_source "$func_resolve_sysroot_result" ;;
5215 esac
5216
5217 # Collect preopened libtool deplibs, except any this library
5218@@ -5267,7 +6138,7 @@
5219 deplib_base=$func_basename_result
5220 case " $weak_libs " in
5221 *" $deplib_base "*) ;;
5222- *) deplibs="$deplibs $deplib" ;;
5223+ *) func_append deplibs " $deplib" ;;
5224 esac
5225 done
5226 done
5227@@ -5288,11 +6159,11 @@
5228 compile_deplibs="$deplib $compile_deplibs"
5229 finalize_deplibs="$deplib $finalize_deplibs"
5230 else
5231- compiler_flags="$compiler_flags $deplib"
5232+ func_append compiler_flags " $deplib"
5233 if test "$linkmode" = lib ; then
5234 case "$new_inherited_linker_flags " in
5235 *" $deplib "*) ;;
5236- * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5237+ * ) func_append new_inherited_linker_flags " $deplib" ;;
5238 esac
5239 fi
5240 fi
5241@@ -5377,7 +6248,7 @@
5242 if test "$linkmode" = lib ; then
5243 case "$new_inherited_linker_flags " in
5244 *" $deplib "*) ;;
5245- * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5246+ * ) func_append new_inherited_linker_flags " $deplib" ;;
5247 esac
5248 fi
5249 fi
5250@@ -5390,7 +6261,8 @@
5251 test "$pass" = conv && continue
5252 newdependency_libs="$deplib $newdependency_libs"
5253 func_stripname '-L' '' "$deplib"
5254- newlib_search_path="$newlib_search_path $func_stripname_result"
5255+ func_resolve_sysroot "$func_stripname_result"
5256+ func_append newlib_search_path " $func_resolve_sysroot_result"
5257 ;;
5258 prog)
5259 if test "$pass" = conv; then
5260@@ -5404,7 +6276,8 @@
5261 finalize_deplibs="$deplib $finalize_deplibs"
5262 fi
5263 func_stripname '-L' '' "$deplib"
5264- newlib_search_path="$newlib_search_path $func_stripname_result"
5265+ func_resolve_sysroot "$func_stripname_result"
5266+ func_append newlib_search_path " $func_resolve_sysroot_result"
5267 ;;
5268 *)
5269 func_warning "\`-L' is ignored for archives/objects"
5270@@ -5415,17 +6288,21 @@
5271 -R*)
5272 if test "$pass" = link; then
5273 func_stripname '-R' '' "$deplib"
5274- dir=$func_stripname_result
5275+ func_resolve_sysroot "$func_stripname_result"
5276+ dir=$func_resolve_sysroot_result
5277 # Make sure the xrpath contains only unique directories.
5278 case "$xrpath " in
5279 *" $dir "*) ;;
5280- *) xrpath="$xrpath $dir" ;;
5281+ *) func_append xrpath " $dir" ;;
5282 esac
5283 fi
5284 deplibs="$deplib $deplibs"
5285 continue
5286 ;;
5287- *.la) lib="$deplib" ;;
5288+ *.la)
5289+ func_resolve_sysroot "$deplib"
5290+ lib=$func_resolve_sysroot_result
5291+ ;;
5292 *.$libext)
5293 if test "$pass" = conv; then
5294 deplibs="$deplib $deplibs"
5295@@ -5488,11 +6365,11 @@
5296 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
5297 # If there is no dlopen support or we're linking statically,
5298 # we need to preload.
5299- newdlprefiles="$newdlprefiles $deplib"
5300+ func_append newdlprefiles " $deplib"
5301 compile_deplibs="$deplib $compile_deplibs"
5302 finalize_deplibs="$deplib $finalize_deplibs"
5303 else
5304- newdlfiles="$newdlfiles $deplib"
5305+ func_append newdlfiles " $deplib"
5306 fi
5307 fi
5308 continue
5309@@ -5538,7 +6415,7 @@
5310 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
5311 case " $new_inherited_linker_flags " in
5312 *" $tmp_inherited_linker_flag "*) ;;
5313- *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
5314+ *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
5315 esac
5316 done
5317 fi
5318@@ -5546,8 +6423,8 @@
5319 if test "$linkmode,$pass" = "lib,link" ||
5320 test "$linkmode,$pass" = "prog,scan" ||
5321 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
5322- test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
5323- test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
5324+ test -n "$dlopen" && func_append dlfiles " $dlopen"
5325+ test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
5326 fi
5327
5328 if test "$pass" = conv; then
5329@@ -5558,20 +6435,20 @@
5330 func_fatal_error "cannot find name of link library for \`$lib'"
5331 fi
5332 # It is a libtool convenience library, so add in its objects.
5333- convenience="$convenience $ladir/$objdir/$old_library"
5334- old_convenience="$old_convenience $ladir/$objdir/$old_library"
5335+ func_append convenience " $ladir/$objdir/$old_library"
5336+ func_append old_convenience " $ladir/$objdir/$old_library"
5337 elif test "$linkmode" != prog && test "$linkmode" != lib; then
5338 func_fatal_error "\`$lib' is not a convenience library"
5339 fi
5340 tmp_libs=
5341 for deplib in $dependency_libs; do
5342 deplibs="$deplib $deplibs"
5343- if $opt_duplicate_deps ; then
5344+ if $opt_preserve_dup_deps ; then
5345 case "$tmp_libs " in
5346- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5347+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
5348 esac
5349 fi
5350- tmp_libs="$tmp_libs $deplib"
5351+ func_append tmp_libs " $deplib"
5352 done
5353 continue
5354 fi # $pass = conv
5355@@ -5579,9 +6456,15 @@
5356
5357 # Get the name of the library we link against.
5358 linklib=
5359- for l in $old_library $library_names; do
5360- linklib="$l"
5361- done
5362+ if test -n "$old_library" &&
5363+ { test "$prefer_static_libs" = yes ||
5364+ test "$prefer_static_libs,$installed" = "built,no"; }; then
5365+ linklib=$old_library
5366+ else
5367+ for l in $old_library $library_names; do
5368+ linklib="$l"
5369+ done
5370+ fi
5371 if test -z "$linklib"; then
5372 func_fatal_error "cannot find name of link library for \`$lib'"
5373 fi
5374@@ -5598,9 +6481,9 @@
5375 # statically, we need to preload. We also need to preload any
5376 # dependent libraries so libltdl's deplib preloader doesn't
5377 # bomb out in the load deplibs phase.
5378- dlprefiles="$dlprefiles $lib $dependency_libs"
5379+ func_append dlprefiles " $lib $dependency_libs"
5380 else
5381- newdlfiles="$newdlfiles $lib"
5382+ func_append newdlfiles " $lib"
5383 fi
5384 continue
5385 fi # $pass = dlopen
5386@@ -5622,14 +6505,14 @@
5387
5388 # Find the relevant object directory and library name.
5389 if test "X$installed" = Xyes; then
5390- if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5391+ if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5392 func_warning "library \`$lib' was moved."
5393 dir="$ladir"
5394 absdir="$abs_ladir"
5395 libdir="$abs_ladir"
5396 else
5397- dir="$libdir"
5398- absdir="$libdir"
5399+ dir="$lt_sysroot$libdir"
5400+ absdir="$lt_sysroot$libdir"
5401 fi
5402 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
5403 else
5404@@ -5637,12 +6520,12 @@
5405 dir="$ladir"
5406 absdir="$abs_ladir"
5407 # Remove this search path later
5408- notinst_path="$notinst_path $abs_ladir"
5409+ func_append notinst_path " $abs_ladir"
5410 else
5411 dir="$ladir/$objdir"
5412 absdir="$abs_ladir/$objdir"
5413 # Remove this search path later
5414- notinst_path="$notinst_path $abs_ladir"
5415+ func_append notinst_path " $abs_ladir"
5416 fi
5417 fi # $installed = yes
5418 func_stripname 'lib' '.la' "$laname"
5419@@ -5653,20 +6536,46 @@
5420 if test -z "$libdir" && test "$linkmode" = prog; then
5421 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
5422 fi
5423- # Prefer using a static library (so that no silly _DYNAMIC symbols
5424- # are required to link).
5425- if test -n "$old_library"; then
5426- newdlprefiles="$newdlprefiles $dir/$old_library"
5427- # Keep a list of preopened convenience libraries to check
5428- # that they are being used correctly in the link pass.
5429- test -z "$libdir" && \
5430- dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
5431- # Otherwise, use the dlname, so that lt_dlopen finds it.
5432- elif test -n "$dlname"; then
5433- newdlprefiles="$newdlprefiles $dir/$dlname"
5434- else
5435- newdlprefiles="$newdlprefiles $dir/$linklib"
5436- fi
5437+ case "$host" in
5438+ # special handling for platforms with PE-DLLs.
5439+ *cygwin* | *mingw* | *cegcc* )
5440+ # Linker will automatically link against shared library if both
5441+ # static and shared are present. Therefore, ensure we extract
5442+ # symbols from the import library if a shared library is present
5443+ # (otherwise, the dlopen module name will be incorrect). We do
5444+ # this by putting the import library name into $newdlprefiles.
5445+ # We recover the dlopen module name by 'saving' the la file
5446+ # name in a special purpose variable, and (later) extracting the
5447+ # dlname from the la file.
5448+ if test -n "$dlname"; then
5449+ func_tr_sh "$dir/$linklib"
5450+ eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
5451+ func_append newdlprefiles " $dir/$linklib"
5452+ else
5453+ func_append newdlprefiles " $dir/$old_library"
5454+ # Keep a list of preopened convenience libraries to check
5455+ # that they are being used correctly in the link pass.
5456+ test -z "$libdir" && \
5457+ func_append dlpreconveniencelibs " $dir/$old_library"
5458+ fi
5459+ ;;
5460+ * )
5461+ # Prefer using a static library (so that no silly _DYNAMIC symbols
5462+ # are required to link).
5463+ if test -n "$old_library"; then
5464+ func_append newdlprefiles " $dir/$old_library"
5465+ # Keep a list of preopened convenience libraries to check
5466+ # that they are being used correctly in the link pass.
5467+ test -z "$libdir" && \
5468+ func_append dlpreconveniencelibs " $dir/$old_library"
5469+ # Otherwise, use the dlname, so that lt_dlopen finds it.
5470+ elif test -n "$dlname"; then
5471+ func_append newdlprefiles " $dir/$dlname"
5472+ else
5473+ func_append newdlprefiles " $dir/$linklib"
5474+ fi
5475+ ;;
5476+ esac
5477 fi # $pass = dlpreopen
5478
5479 if test -z "$libdir"; then
5480@@ -5684,7 +6593,7 @@
5481
5482
5483 if test "$linkmode" = prog && test "$pass" != link; then
5484- newlib_search_path="$newlib_search_path $ladir"
5485+ func_append newlib_search_path " $ladir"
5486 deplibs="$lib $deplibs"
5487
5488 linkalldeplibs=no
5489@@ -5697,7 +6606,8 @@
5490 for deplib in $dependency_libs; do
5491 case $deplib in
5492 -L*) func_stripname '-L' '' "$deplib"
5493- newlib_search_path="$newlib_search_path $func_stripname_result"
5494+ func_resolve_sysroot "$func_stripname_result"
5495+ func_append newlib_search_path " $func_resolve_sysroot_result"
5496 ;;
5497 esac
5498 # Need to link against all dependency_libs?
5499@@ -5708,12 +6618,12 @@
5500 # or/and link against static libraries
5501 newdependency_libs="$deplib $newdependency_libs"
5502 fi
5503- if $opt_duplicate_deps ; then
5504+ if $opt_preserve_dup_deps ; then
5505 case "$tmp_libs " in
5506- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5507+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
5508 esac
5509 fi
5510- tmp_libs="$tmp_libs $deplib"
5511+ func_append tmp_libs " $deplib"
5512 done # for deplib
5513 continue
5514 fi # $linkmode = prog...
5515@@ -5728,7 +6638,7 @@
5516 # Make sure the rpath contains only unique directories.
5517 case "$temp_rpath:" in
5518 *"$absdir:"*) ;;
5519- *) temp_rpath="$temp_rpath$absdir:" ;;
5520+ *) func_append temp_rpath "$absdir:" ;;
5521 esac
5522 fi
5523
5524@@ -5740,7 +6650,7 @@
5525 *)
5526 case "$compile_rpath " in
5527 *" $absdir "*) ;;
5528- *) compile_rpath="$compile_rpath $absdir"
5529+ *) func_append compile_rpath " $absdir" ;;
5530 esac
5531 ;;
5532 esac
5533@@ -5749,7 +6659,7 @@
5534 *)
5535 case "$finalize_rpath " in
5536 *" $libdir "*) ;;
5537- *) finalize_rpath="$finalize_rpath $libdir"
5538+ *) func_append finalize_rpath " $libdir" ;;
5539 esac
5540 ;;
5541 esac
5542@@ -5774,12 +6684,12 @@
5543 case $host in
5544 *cygwin* | *mingw* | *cegcc*)
5545 # No point in relinking DLLs because paths are not encoded
5546- notinst_deplibs="$notinst_deplibs $lib"
5547+ func_append notinst_deplibs " $lib"
5548 need_relink=no
5549 ;;
5550 *)
5551 if test "$installed" = no; then
5552- notinst_deplibs="$notinst_deplibs $lib"
5553+ func_append notinst_deplibs " $lib"
5554 need_relink=yes
5555 fi
5556 ;;
5557@@ -5814,7 +6724,7 @@
5558 *)
5559 case "$compile_rpath " in
5560 *" $absdir "*) ;;
5561- *) compile_rpath="$compile_rpath $absdir"
5562+ *) func_append compile_rpath " $absdir" ;;
5563 esac
5564 ;;
5565 esac
5566@@ -5823,7 +6733,7 @@
5567 *)
5568 case "$finalize_rpath " in
5569 *" $libdir "*) ;;
5570- *) finalize_rpath="$finalize_rpath $libdir"
5571+ *) func_append finalize_rpath " $libdir" ;;
5572 esac
5573 ;;
5574 esac
5575@@ -5835,7 +6745,7 @@
5576 shift
5577 realname="$1"
5578 shift
5579- eval "libname=\"$libname_spec\""
5580+ libname=`eval "\\$ECHO \"$libname_spec\""`
5581 # use dlname if we got it. it's perfectly good, no?
5582 if test -n "$dlname"; then
5583 soname="$dlname"
5584@@ -5848,7 +6758,7 @@
5585 versuffix="-$major"
5586 ;;
5587 esac
5588- eval "soname=\"$soname_spec\""
5589+ eval soname=\"$soname_spec\"
5590 else
5591 soname="$realname"
5592 fi
5593@@ -5877,7 +6787,7 @@
5594 linklib=$newlib
5595 fi # test -n "$old_archive_from_expsyms_cmds"
5596
5597- if test "$linkmode" = prog || test "$mode" != relink; then
5598+ if test "$linkmode" = prog || test "$opt_mode" != relink; then
5599 add_shlibpath=
5600 add_dir=
5601 add=
5602@@ -5933,7 +6843,7 @@
5603 if test -n "$inst_prefix_dir"; then
5604 case $libdir in
5605 [\\/]*)
5606- add_dir="$add_dir -L$inst_prefix_dir$libdir"
5607+ func_append add_dir " -L$inst_prefix_dir$libdir"
5608 ;;
5609 esac
5610 fi
5611@@ -5955,7 +6865,7 @@
5612 if test -n "$add_shlibpath"; then
5613 case :$compile_shlibpath: in
5614 *":$add_shlibpath:"*) ;;
5615- *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
5616+ *) func_append compile_shlibpath "$add_shlibpath:" ;;
5617 esac
5618 fi
5619 if test "$linkmode" = prog; then
5620@@ -5969,13 +6879,13 @@
5621 test "$hardcode_shlibpath_var" = yes; then
5622 case :$finalize_shlibpath: in
5623 *":$libdir:"*) ;;
5624- *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5625+ *) func_append finalize_shlibpath "$libdir:" ;;
5626 esac
5627 fi
5628 fi
5629 fi
5630
5631- if test "$linkmode" = prog || test "$mode" = relink; then
5632+ if test "$linkmode" = prog || test "$opt_mode" = relink; then
5633 add_shlibpath=
5634 add_dir=
5635 add=
5636@@ -5989,7 +6899,7 @@
5637 elif test "$hardcode_shlibpath_var" = yes; then
5638 case :$finalize_shlibpath: in
5639 *":$libdir:"*) ;;
5640- *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5641+ *) func_append finalize_shlibpath "$libdir:" ;;
5642 esac
5643 add="-l$name"
5644 elif test "$hardcode_automatic" = yes; then
5645@@ -6001,12 +6911,12 @@
5646 fi
5647 else
5648 # We cannot seem to hardcode it, guess we'll fake it.
5649- add_dir="-L$libdir"
5650+ add_dir="-L$lt_sysroot$libdir"
5651 # Try looking first in the location we're being installed to.
5652 if test -n "$inst_prefix_dir"; then
5653 case $libdir in
5654 [\\/]*)
5655- add_dir="$add_dir -L$inst_prefix_dir$libdir"
5656+ func_append add_dir " -L$inst_prefix_dir$libdir"
5657 ;;
5658 esac
5659 fi
5660@@ -6083,27 +6993,33 @@
5661 temp_xrpath=$func_stripname_result
5662 case " $xrpath " in
5663 *" $temp_xrpath "*) ;;
5664- *) xrpath="$xrpath $temp_xrpath";;
5665+ *) func_append xrpath " $temp_xrpath";;
5666 esac;;
5667- *) temp_deplibs="$temp_deplibs $libdir";;
5668+ *) func_append temp_deplibs " $libdir";;
5669 esac
5670 done
5671 dependency_libs="$temp_deplibs"
5672 fi
5673
5674- newlib_search_path="$newlib_search_path $absdir"
5675+ func_append newlib_search_path " $absdir"
5676 # Link against this library
5677 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
5678 # ... and its dependency_libs
5679 tmp_libs=
5680 for deplib in $dependency_libs; do
5681 newdependency_libs="$deplib $newdependency_libs"
5682- if $opt_duplicate_deps ; then
5683+ case $deplib in
5684+ -L*) func_stripname '-L' '' "$deplib"
5685+ func_resolve_sysroot "$func_stripname_result";;
5686+ *) func_resolve_sysroot "$deplib" ;;
5687+ esac
5688+ if $opt_preserve_dup_deps ; then
5689 case "$tmp_libs " in
5690- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5691+ *" $func_resolve_sysroot_result "*)
5692+ func_append specialdeplibs " $func_resolve_sysroot_result" ;;
5693 esac
5694 fi
5695- tmp_libs="$tmp_libs $deplib"
5696+ func_append tmp_libs " $func_resolve_sysroot_result"
5697 done
5698
5699 if test "$link_all_deplibs" != no; then
5700@@ -6113,8 +7029,10 @@
5701 case $deplib in
5702 -L*) path="$deplib" ;;
5703 *.la)
5704+ func_resolve_sysroot "$deplib"
5705+ deplib=$func_resolve_sysroot_result
5706 func_dirname "$deplib" "" "."
5707- dir="$func_dirname_result"
5708+ dir=$func_dirname_result
5709 # We need an absolute path.
5710 case $dir in
5711 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
5712@@ -6130,7 +7048,7 @@
5713 case $host in
5714 *-*-darwin*)
5715 depdepl=
5716- deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
5717+ eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
5718 if test -n "$deplibrary_names" ; then
5719 for tmp in $deplibrary_names ; do
5720 depdepl=$tmp
5721@@ -6141,8 +7059,8 @@
5722 if test -z "$darwin_install_name"; then
5723 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
5724 fi
5725- compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
5726- linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
5727+ func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
5728+ func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
5729 path=
5730 fi
5731 fi
5732@@ -6152,7 +7070,7 @@
5733 ;;
5734 esac
5735 else
5736- libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5737+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5738 test -z "$libdir" && \
5739 func_fatal_error "\`$deplib' is not a valid libtool archive"
5740 test "$absdir" != "$libdir" && \
5741@@ -6192,7 +7110,7 @@
5742 for dir in $newlib_search_path; do
5743 case "$lib_search_path " in
5744 *" $dir "*) ;;
5745- *) lib_search_path="$lib_search_path $dir" ;;
5746+ *) func_append lib_search_path " $dir" ;;
5747 esac
5748 done
5749 newlib_search_path=
5750@@ -6205,7 +7123,7 @@
5751 fi
5752 for var in $vars dependency_libs; do
5753 # Add libraries to $var in reverse order
5754- eval tmp_libs=\$$var
5755+ eval tmp_libs=\"\$$var\"
5756 new_libs=
5757 for deplib in $tmp_libs; do
5758 # FIXME: Pedantically, this is the right thing to do, so
5759@@ -6250,13 +7168,13 @@
5760 -L*)
5761 case " $tmp_libs " in
5762 *" $deplib "*) ;;
5763- *) tmp_libs="$tmp_libs $deplib" ;;
5764+ *) func_append tmp_libs " $deplib" ;;
5765 esac
5766 ;;
5767- *) tmp_libs="$tmp_libs $deplib" ;;
5768+ *) func_append tmp_libs " $deplib" ;;
5769 esac
5770 done
5771- eval $var=\$tmp_libs
5772+ eval $var=\"$tmp_libs\"
5773 done # for var
5774 fi
5775 # Last step: remove runtime libs from dependency_libs
5776@@ -6269,7 +7187,7 @@
5777 ;;
5778 esac
5779 if test -n "$i" ; then
5780- tmp_libs="$tmp_libs $i"
5781+ func_append tmp_libs " $i"
5782 fi
5783 done
5784 dependency_libs=$tmp_libs
5785@@ -6310,7 +7228,7 @@
5786 # Now set the variables for building old libraries.
5787 build_libtool_libs=no
5788 oldlibs="$output"
5789- objs="$objs$old_deplibs"
5790+ func_append objs "$old_deplibs"
5791 ;;
5792
5793 lib)
5794@@ -6319,8 +7237,8 @@
5795 lib*)
5796 func_stripname 'lib' '.la' "$outputname"
5797 name=$func_stripname_result
5798- eval "shared_ext=\"$shrext_cmds\""
5799- eval "libname=\"$libname_spec\""
5800+ eval shared_ext=\"$shrext_cmds\"
5801+ eval libname=\"$libname_spec\"
5802 ;;
5803 *)
5804 test "$module" = no && \
5805@@ -6330,8 +7248,8 @@
5806 # Add the "lib" prefix for modules if required
5807 func_stripname '' '.la' "$outputname"
5808 name=$func_stripname_result
5809- eval "shared_ext=\"$shrext_cmds\""
5810- eval "libname=\"$libname_spec\""
5811+ eval shared_ext=\"$shrext_cmds\"
5812+ eval libname=\"$libname_spec\"
5813 else
5814 func_stripname '' '.la' "$outputname"
5815 libname=$func_stripname_result
5816@@ -6346,7 +7264,7 @@
5817 echo
5818 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
5819 $ECHO "*** objects $objs is not portable!"
5820- libobjs="$libobjs $objs"
5821+ func_append libobjs " $objs"
5822 fi
5823 fi
5824
5825@@ -6544,7 +7462,7 @@
5826 done
5827
5828 # Make executables depend on our current version.
5829- verstring="$verstring:${current}.0"
5830+ func_append verstring ":${current}.0"
5831 ;;
5832
5833 qnx)
5834@@ -6612,10 +7530,10 @@
5835 fi
5836
5837 func_generate_dlsyms "$libname" "$libname" "yes"
5838- libobjs="$libobjs $symfileobj"
5839+ func_append libobjs " $symfileobj"
5840 test "X$libobjs" = "X " && libobjs=
5841
5842- if test "$mode" != relink; then
5843+ if test "$opt_mode" != relink; then
5844 # Remove our outputs, but don't remove object files since they
5845 # may have been created when compiling PIC objects.
5846 removelist=
5847@@ -6631,7 +7549,7 @@
5848 continue
5849 fi
5850 fi
5851- removelist="$removelist $p"
5852+ func_append removelist " $p"
5853 ;;
5854 *) ;;
5855 esac
5856@@ -6642,7 +7560,7 @@
5857
5858 # Now set the variables for building old libraries.
5859 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
5860- oldlibs="$oldlibs $output_objdir/$libname.$libext"
5861+ func_append oldlibs " $output_objdir/$libname.$libext"
5862
5863 # Transform .lo files to .o files.
5864 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
5865@@ -6659,10 +7577,11 @@
5866 # If the user specified any rpath flags, then add them.
5867 temp_xrpath=
5868 for libdir in $xrpath; do
5869- temp_xrpath="$temp_xrpath -R$libdir"
5870+ func_replace_sysroot "$libdir"
5871+ func_append temp_xrpath " -R$func_replace_sysroot_result"
5872 case "$finalize_rpath " in
5873 *" $libdir "*) ;;
5874- *) finalize_rpath="$finalize_rpath $libdir" ;;
5875+ *) func_append finalize_rpath " $libdir" ;;
5876 esac
5877 done
5878 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
5879@@ -6676,7 +7595,7 @@
5880 for lib in $old_dlfiles; do
5881 case " $dlprefiles $dlfiles " in
5882 *" $lib "*) ;;
5883- *) dlfiles="$dlfiles $lib" ;;
5884+ *) func_append dlfiles " $lib" ;;
5885 esac
5886 done
5887
5888@@ -6686,7 +7605,7 @@
5889 for lib in $old_dlprefiles; do
5890 case "$dlprefiles " in
5891 *" $lib "*) ;;
5892- *) dlprefiles="$dlprefiles $lib" ;;
5893+ *) func_append dlprefiles " $lib" ;;
5894 esac
5895 done
5896
5897@@ -6698,7 +7617,7 @@
5898 ;;
5899 *-*-rhapsody* | *-*-darwin1.[012])
5900 # Rhapsody C library is in the System framework
5901- deplibs="$deplibs System.ltframework"
5902+ func_append deplibs " System.ltframework"
5903 ;;
5904 *-*-netbsd*)
5905 # Don't link with libc until the a.out ld.so is fixed.
5906@@ -6715,7 +7634,7 @@
5907 *)
5908 # Add libc to deplibs on all other systems if necessary.
5909 if test "$build_libtool_need_lc" = "yes"; then
5910- deplibs="$deplibs -lc"
5911+ func_append deplibs " -lc"
5912 fi
5913 ;;
5914 esac
5915@@ -6764,18 +7683,18 @@
5916 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5917 case " $predeps $postdeps " in
5918 *" $i "*)
5919- newdeplibs="$newdeplibs $i"
5920+ func_append newdeplibs " $i"
5921 i=""
5922 ;;
5923 esac
5924 fi
5925 if test -n "$i" ; then
5926- eval "libname=\"$libname_spec\""
5927- eval "deplib_matches=\"$library_names_spec\""
5928+ libname=`eval "\\$ECHO \"$libname_spec\""`
5929+ deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
5930 set dummy $deplib_matches; shift
5931 deplib_match=$1
5932 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
5933- newdeplibs="$newdeplibs $i"
5934+ func_append newdeplibs " $i"
5935 else
5936 droppeddeps=yes
5937 echo
5938@@ -6789,7 +7708,7 @@
5939 fi
5940 ;;
5941 *)
5942- newdeplibs="$newdeplibs $i"
5943+ func_append newdeplibs " $i"
5944 ;;
5945 esac
5946 done
5947@@ -6807,18 +7726,18 @@
5948 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5949 case " $predeps $postdeps " in
5950 *" $i "*)
5951- newdeplibs="$newdeplibs $i"
5952+ func_append newdeplibs " $i"
5953 i=""
5954 ;;
5955 esac
5956 fi
5957 if test -n "$i" ; then
5958- eval "libname=\"$libname_spec\""
5959- eval "deplib_matches=\"$library_names_spec\""
5960+ libname=`eval "\\$ECHO \"$libname_spec\""`
5961+ deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
5962 set dummy $deplib_matches; shift
5963 deplib_match=$1
5964 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
5965- newdeplibs="$newdeplibs $i"
5966+ func_append newdeplibs " $i"
5967 else
5968 droppeddeps=yes
5969 echo
5970@@ -6840,7 +7759,7 @@
5971 fi
5972 ;;
5973 *)
5974- newdeplibs="$newdeplibs $i"
5975+ func_append newdeplibs " $i"
5976 ;;
5977 esac
5978 done
5979@@ -6857,15 +7776,27 @@
5980 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5981 case " $predeps $postdeps " in
5982 *" $a_deplib "*)
5983- newdeplibs="$newdeplibs $a_deplib"
5984+ func_append newdeplibs " $a_deplib"
5985 a_deplib=""
5986 ;;
5987 esac
5988 fi
5989 if test -n "$a_deplib" ; then
5990- eval "libname=\"$libname_spec\""
5991+ libname=`eval "\\$ECHO \"$libname_spec\""`
5992+ if test -n "$file_magic_glob"; then
5993+ libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
5994+ else
5995+ libnameglob=$libname
5996+ fi
5997+ test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
5998 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
5999- potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6000+ if test "$want_nocaseglob" = yes; then
6001+ shopt -s nocaseglob
6002+ potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
6003+ $nocaseglob
6004+ else
6005+ potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
6006+ fi
6007 for potent_lib in $potential_libs; do
6008 # Follow soft links.
6009 if ls -lLd "$potent_lib" 2>/dev/null |
6010@@ -6885,10 +7816,10 @@
6011 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
6012 esac
6013 done
6014- if eval "$file_magic_cmd \"\$potlib\"" 2>/dev/null |
6015+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
6016 $SED -e 10q |
6017 $EGREP "$file_magic_regex" > /dev/null; then
6018- newdeplibs="$newdeplibs $a_deplib"
6019+ func_append newdeplibs " $a_deplib"
6020 a_deplib=""
6021 break 2
6022 fi
6023@@ -6913,7 +7844,7 @@
6024 ;;
6025 *)
6026 # Add a -L argument.
6027- newdeplibs="$newdeplibs $a_deplib"
6028+ func_append newdeplibs " $a_deplib"
6029 ;;
6030 esac
6031 done # Gone through all deplibs.
6032@@ -6929,20 +7860,20 @@
6033 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6034 case " $predeps $postdeps " in
6035 *" $a_deplib "*)
6036- newdeplibs="$newdeplibs $a_deplib"
6037+ func_append newdeplibs " $a_deplib"
6038 a_deplib=""
6039 ;;
6040 esac
6041 fi
6042 if test -n "$a_deplib" ; then
6043- eval "libname=\"$libname_spec\""
6044+ libname=`eval "\\$ECHO \"$libname_spec\""`
6045 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6046 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6047 for potent_lib in $potential_libs; do
6048 potlib="$potent_lib" # see symlink-check above in file_magic test
6049 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
6050 $EGREP "$match_pattern_regex" > /dev/null; then
6051- newdeplibs="$newdeplibs $a_deplib"
6052+ func_append newdeplibs " $a_deplib"
6053 a_deplib=""
6054 break 2
6055 fi
6056@@ -6967,7 +7898,7 @@
6057 ;;
6058 *)
6059 # Add a -L argument.
6060- newdeplibs="$newdeplibs $a_deplib"
6061+ func_append newdeplibs " $a_deplib"
6062 ;;
6063 esac
6064 done # Gone through all deplibs.
6065@@ -7071,7 +8002,7 @@
6066 *)
6067 case " $deplibs " in
6068 *" -L$path/$objdir "*)
6069- new_libs="$new_libs -L$path/$objdir" ;;
6070+ func_append new_libs " -L$path/$objdir" ;;
6071 esac
6072 ;;
6073 esac
6074@@ -7081,10 +8012,10 @@
6075 -L*)
6076 case " $new_libs " in
6077 *" $deplib "*) ;;
6078- *) new_libs="$new_libs $deplib" ;;
6079+ *) func_append new_libs " $deplib" ;;
6080 esac
6081 ;;
6082- *) new_libs="$new_libs $deplib" ;;
6083+ *) func_append new_libs " $deplib" ;;
6084 esac
6085 done
6086 deplibs="$new_libs"
6087@@ -7101,10 +8032,12 @@
6088 hardcode_libdirs=
6089 dep_rpath=
6090 rpath="$finalize_rpath"
6091- test "$mode" != relink && rpath="$compile_rpath$rpath"
6092+ test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
6093 for libdir in $rpath; do
6094 if test -n "$hardcode_libdir_flag_spec"; then
6095 if test -n "$hardcode_libdir_separator"; then
6096+ func_replace_sysroot "$libdir"
6097+ libdir=$func_replace_sysroot_result
6098 if test -z "$hardcode_libdirs"; then
6099 hardcode_libdirs="$libdir"
6100 else
6101@@ -7113,18 +8046,18 @@
6102 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6103 ;;
6104 *)
6105- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
6106+ func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
6107 ;;
6108 esac
6109 fi
6110 else
6111- eval "flag=\"$hardcode_libdir_flag_spec\""
6112- dep_rpath="$dep_rpath $flag"
6113+ eval flag=\"$hardcode_libdir_flag_spec\"
6114+ func_append dep_rpath " $flag"
6115 fi
6116 elif test -n "$runpath_var"; then
6117 case "$perm_rpath " in
6118 *" $libdir "*) ;;
6119- *) perm_rpath="$perm_rpath $libdir" ;;
6120+ *) func_apped perm_rpath " $libdir" ;;
6121 esac
6122 fi
6123 done
6124@@ -7133,40 +8066,38 @@
6125 test -n "$hardcode_libdirs"; then
6126 libdir="$hardcode_libdirs"
6127 if test -n "$hardcode_libdir_flag_spec_ld"; then
6128- eval "dep_rpath=\"$hardcode_libdir_flag_spec_ld\""
6129+ eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
6130 else
6131- eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
6132+ eval dep_rpath=\"$hardcode_libdir_flag_spec\"
6133 fi
6134 fi
6135 if test -n "$runpath_var" && test -n "$perm_rpath"; then
6136 # We should set the runpath_var.
6137 rpath=
6138 for dir in $perm_rpath; do
6139- rpath="$rpath$dir:"
6140+ func_append rpath "$dir:"
6141 done
6142- eval $runpath_var=\$rpath\$$runpath_var
6143- export $runpath_var
6144+ eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
6145 fi
6146 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
6147 fi
6148
6149 shlibpath="$finalize_shlibpath"
6150- test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
6151+ test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
6152 if test -n "$shlibpath"; then
6153- eval $shlibpath_var=\$shlibpath\$$shlibpath_var
6154- export $shlibpath_var
6155+ eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
6156 fi
6157
6158 # Get the real and link names of the library.
6159- eval "shared_ext=\"$shrext_cmds\""
6160- eval "library_names=\"$library_names_spec\""
6161+ eval shared_ext=\"$shrext_cmds\"
6162+ eval library_names=\"$library_names_spec\"
6163 set dummy $library_names
6164 shift
6165 realname="$1"
6166 shift
6167
6168 if test -n "$soname_spec"; then
6169- eval "soname=\"$soname_spec\""
6170+ eval soname=\"$soname_spec\"
6171 else
6172 soname="$realname"
6173 fi
6174@@ -7178,7 +8109,7 @@
6175 linknames=
6176 for link
6177 do
6178- linknames="$linknames $link"
6179+ func_append linknames " $link"
6180 done
6181
6182 # Use standard objects if they are pic
6183@@ -7189,7 +8120,7 @@
6184 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6185 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
6186 export_symbols="$output_objdir/$libname.uexp"
6187- delfiles="$delfiles $export_symbols"
6188+ func_append delfiles " $export_symbols"
6189 fi
6190
6191 orig_export_symbols=
6192@@ -7220,13 +8151,45 @@
6193 $opt_dry_run || $RM $export_symbols
6194 cmds=$export_symbols_cmds
6195 save_ifs="$IFS"; IFS='~'
6196- for cmd in $cmds; do
6197+ for cmd1 in $cmds; do
6198 IFS="$save_ifs"
6199- eval "cmd=\"$cmd\""
6200- func_len " $cmd"
6201- len=$func_len_result
6202- if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
6203+ # Take the normal branch if the nm_file_list_spec branch
6204+ # doesn't work or if tool conversion is not needed.
6205+ case $nm_file_list_spec~$to_tool_file_cmd in
6206+ *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
6207+ try_normal_branch=yes
6208+ eval cmd=\"$cmd1\"
6209+ func_len " $cmd"
6210+ len=$func_len_result
6211+ ;;
6212+ *)
6213+ try_normal_branch=no
6214+ ;;
6215+ esac
6216+ if test "$try_normal_branch" = yes \
6217+ && { test "$len" -lt "$max_cmd_len" \
6218+ || test "$max_cmd_len" -le -1; }
6219+ then
6220+ func_show_eval "$cmd" 'exit $?'
6221+ skipped_export=false
6222+ elif test -n "$nm_file_list_spec"; then
6223+ func_basename "$output"
6224+ output_la=$func_basename_result
6225+ save_libobjs=$libobjs
6226+ save_output=$output
6227+ output=${output_objdir}/${output_la}.nm
6228+ func_to_tool_file "$output"
6229+ libobjs=$nm_file_list_spec$func_to_tool_file_result
6230+ func_append delfiles " $output"
6231+ func_verbose "creating $NM input file list: $output"
6232+ for obj in $save_libobjs; do
6233+ func_to_tool_file "$obj"
6234+ $ECHO "$func_to_tool_file_result"
6235+ done > "$output"
6236+ eval cmd=\"$cmd1\"
6237 func_show_eval "$cmd" 'exit $?'
6238+ output=$save_output
6239+ libobjs=$save_libobjs
6240 skipped_export=false
6241 else
6242 # The command line is too long to execute in one step.
6243@@ -7248,7 +8211,7 @@
6244 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6245 tmp_export_symbols="$export_symbols"
6246 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
6247- $opt_dry_run || $ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"
6248+ $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
6249 fi
6250
6251 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
6252@@ -7260,7 +8223,7 @@
6253 # global variables. join(1) would be nice here, but unfortunately
6254 # isn't a blessed tool.
6255 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
6256- delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
6257+ func_append delfiles " $export_symbols $output_objdir/$libname.filter"
6258 export_symbols=$output_objdir/$libname.def
6259 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
6260 fi
6261@@ -7270,7 +8233,7 @@
6262 case " $convenience " in
6263 *" $test_deplib "*) ;;
6264 *)
6265- tmp_deplibs="$tmp_deplibs $test_deplib"
6266+ func_append tmp_deplibs " $test_deplib"
6267 ;;
6268 esac
6269 done
6270@@ -7286,43 +8249,43 @@
6271 fi
6272 if test -n "$whole_archive_flag_spec"; then
6273 save_libobjs=$libobjs
6274- eval "libobjs=\"\$libobjs $whole_archive_flag_spec\""
6275+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
6276 test "X$libobjs" = "X " && libobjs=
6277 else
6278 gentop="$output_objdir/${outputname}x"
6279- generated="$generated $gentop"
6280+ func_append generated " $gentop"
6281
6282 func_extract_archives $gentop $convenience
6283- libobjs="$libobjs $func_extract_archives_result"
6284+ func_append libobjs " $func_extract_archives_result"
6285 test "X$libobjs" = "X " && libobjs=
6286 fi
6287 fi
6288
6289 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
6290- eval "flag=\"$thread_safe_flag_spec\""
6291- linker_flags="$linker_flags $flag"
6292+ eval flag=\"$thread_safe_flag_spec\"
6293+ func_append linker_flags " $flag"
6294 fi
6295
6296 # Make a backup of the uninstalled library when relinking
6297- if test "$mode" = relink; then
6298- $opt_dry_run || (cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U) || exit $?
6299+ if test "$opt_mode" = relink; then
6300+ $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
6301 fi
6302
6303 # Do each of the archive commands.
6304 if test "$module" = yes && test -n "$module_cmds" ; then
6305 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
6306- eval "test_cmds=\"$module_expsym_cmds\""
6307+ eval test_cmds=\"$module_expsym_cmds\"
6308 cmds=$module_expsym_cmds
6309 else
6310- eval "test_cmds=\"$module_cmds\""
6311+ eval test_cmds=\"$module_cmds\"
6312 cmds=$module_cmds
6313 fi
6314 else
6315 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
6316- eval "test_cmds=\"$archive_expsym_cmds\""
6317+ eval test_cmds=\"$archive_expsym_cmds\"
6318 cmds=$archive_expsym_cmds
6319 else
6320- eval "test_cmds=\"$archive_cmds\""
6321+ eval test_cmds=\"$archive_cmds\"
6322 cmds=$archive_cmds
6323 fi
6324 fi
6325@@ -7366,10 +8329,13 @@
6326 echo 'INPUT (' > $output
6327 for obj in $save_libobjs
6328 do
6329- $ECHO "$obj" >> $output
6330+ func_to_tool_file "$obj"
6331+ $ECHO "$func_to_tool_file_result" >> $output
6332 done
6333 echo ')' >> $output
6334- delfiles="$delfiles $output"
6335+ func_append delfiles " $output"
6336+ func_to_tool_file "$output"
6337+ output=$func_to_tool_file_result
6338 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
6339 output=${output_objdir}/${output_la}.lnk
6340 func_verbose "creating linker input file list: $output"
6341@@ -7383,15 +8349,17 @@
6342 fi
6343 for obj
6344 do
6345- $ECHO "$obj" >> $output
6346+ func_to_tool_file "$obj"
6347+ $ECHO "$func_to_tool_file_result" >> $output
6348 done
6349- delfiles="$delfiles $output"
6350- output=$firstobj\"$file_list_spec$output\"
6351+ func_append delfiles " $output"
6352+ func_to_tool_file "$output"
6353+ output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
6354 else
6355 if test -n "$save_libobjs"; then
6356 func_verbose "creating reloadable object files..."
6357 output=$output_objdir/$output_la-${k}.$objext
6358- eval "test_cmds=\"$reload_cmds\""
6359+ eval test_cmds=\"$reload_cmds\"
6360 func_len " $test_cmds"
6361 len0=$func_len_result
6362 len=$len0
6363@@ -7411,12 +8379,12 @@
6364 if test "$k" -eq 1 ; then
6365 # The first file doesn't have a previous command to add.
6366 reload_objs=$objlist
6367- eval "concat_cmds=\"$reload_cmds\""
6368+ eval concat_cmds=\"$reload_cmds\"
6369 else
6370 # All subsequent reloadable object files will link in
6371 # the last one created.
6372 reload_objs="$objlist $last_robj"
6373- eval "concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\""
6374+ eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
6375 fi
6376 last_robj=$output_objdir/$output_la-${k}.$objext
6377 func_arith $k + 1
6378@@ -7433,11 +8401,11 @@
6379 # files will link in the last one created.
6380 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
6381 reload_objs="$objlist $last_robj"
6382- eval "concat_cmds=\"\${concat_cmds}$reload_cmds\""
6383+ eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
6384 if test -n "$last_robj"; then
6385- eval "concat_cmds=\"\${concat_cmds}~\$RM $last_robj\""
6386+ eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
6387 fi
6388- delfiles="$delfiles $output"
6389+ func_append delfiles " $output"
6390
6391 else
6392 output=
6393@@ -7450,9 +8418,9 @@
6394 libobjs=$output
6395 # Append the command to create the export file.
6396 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
6397- eval "concat_cmds=\"\$concat_cmds$export_symbols_cmds\""
6398+ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
6399 if test -n "$last_robj"; then
6400- eval "concat_cmds=\"\$concat_cmds~\$RM $last_robj\""
6401+ eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
6402 fi
6403 fi
6404
6405@@ -7471,7 +8439,7 @@
6406 lt_exit=$?
6407
6408 # Restore the uninstalled library and exit
6409- if test "$mode" = relink; then
6410+ if test "$opt_mode" = relink; then
6411 ( cd "$output_objdir" && \
6412 $RM "${realname}T" && \
6413 $MV "${realname}U" "$realname" )
6414@@ -7492,7 +8460,7 @@
6415 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6416 tmp_export_symbols="$export_symbols"
6417 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
6418- $opt_dry_run || $ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"
6419+ $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
6420 fi
6421
6422 if test -n "$orig_export_symbols"; then
6423@@ -7504,7 +8472,7 @@
6424 # global variables. join(1) would be nice here, but unfortunately
6425 # isn't a blessed tool.
6426 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
6427- delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
6428+ func_append delfiles " $export_symbols $output_objdir/$libname.filter"
6429 export_symbols=$output_objdir/$libname.def
6430 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
6431 fi
6432@@ -7515,7 +8483,7 @@
6433 output=$save_output
6434
6435 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
6436- eval "libobjs=\"\$libobjs $whole_archive_flag_spec\""
6437+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
6438 test "X$libobjs" = "X " && libobjs=
6439 fi
6440 # Expand the library linking commands again to reset the
6441@@ -7539,23 +8507,23 @@
6442
6443 if test -n "$delfiles"; then
6444 # Append the command to remove temporary files to $cmds.
6445- eval "cmds=\"\$cmds~\$RM $delfiles\""
6446+ eval cmds=\"\$cmds~\$RM $delfiles\"
6447 fi
6448
6449 # Add any objects from preloaded convenience libraries
6450 if test -n "$dlprefiles"; then
6451 gentop="$output_objdir/${outputname}x"
6452- generated="$generated $gentop"
6453+ func_append generated " $gentop"
6454
6455 func_extract_archives $gentop $dlprefiles
6456- libobjs="$libobjs $func_extract_archives_result"
6457+ func_append libobjs " $func_extract_archives_result"
6458 test "X$libobjs" = "X " && libobjs=
6459 fi
6460
6461 save_ifs="$IFS"; IFS='~'
6462 for cmd in $cmds; do
6463 IFS="$save_ifs"
6464- eval "cmd=\"$cmd\""
6465+ eval cmd=\"$cmd\"
6466 $opt_silent || {
6467 func_quote_for_expand "$cmd"
6468 eval "func_echo $func_quote_for_expand_result"
6469@@ -7564,7 +8532,7 @@
6470 lt_exit=$?
6471
6472 # Restore the uninstalled library and exit
6473- if test "$mode" = relink; then
6474+ if test "$opt_mode" = relink; then
6475 ( cd "$output_objdir" && \
6476 $RM "${realname}T" && \
6477 $MV "${realname}U" "$realname" )
6478@@ -7576,8 +8544,8 @@
6479 IFS="$save_ifs"
6480
6481 # Restore the uninstalled library and exit
6482- if test "$mode" = relink; then
6483- $opt_dry_run || (cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname) || exit $?
6484+ if test "$opt_mode" = relink; then
6485+ $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
6486
6487 if test -n "$convenience"; then
6488 if test -z "$whole_archive_flag_spec"; then
6489@@ -7656,17 +8624,20 @@
6490
6491 if test -n "$convenience"; then
6492 if test -n "$whole_archive_flag_spec"; then
6493- eval "tmp_whole_archive_flags=\"$whole_archive_flag_spec\""
6494+ eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
6495 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
6496 else
6497 gentop="$output_objdir/${obj}x"
6498- generated="$generated $gentop"
6499+ func_append generated " $gentop"
6500
6501 func_extract_archives $gentop $convenience
6502 reload_conv_objs="$reload_objs $func_extract_archives_result"
6503 fi
6504 fi
6505
6506+ # If we're not building shared, we need to use non_pic_objs
6507+ test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
6508+
6509 # Create the old-style object.
6510 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
6511
6512@@ -7690,7 +8661,7 @@
6513 # Create an invalid libtool object if no PIC, so that we don't
6514 # accidentally link it into a program.
6515 # $show "echo timestamp > $libobj"
6516- # $opt_dry_run || echo timestamp > $libobj || exit $?
6517+ # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
6518 exit $EXIT_SUCCESS
6519 fi
6520
6521@@ -7740,8 +8711,8 @@
6522 if test "$tagname" = CXX ; then
6523 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
6524 10.[0123])
6525- compile_command="$compile_command ${wl}-bind_at_load"
6526- finalize_command="$finalize_command ${wl}-bind_at_load"
6527+ func_append compile_command " ${wl}-bind_at_load"
6528+ func_append finalize_command " ${wl}-bind_at_load"
6529 ;;
6530 esac
6531 fi
6532@@ -7761,7 +8732,7 @@
6533 *)
6534 case " $compile_deplibs " in
6535 *" -L$path/$objdir "*)
6536- new_libs="$new_libs -L$path/$objdir" ;;
6537+ func_append new_libs " -L$path/$objdir" ;;
6538 esac
6539 ;;
6540 esac
6541@@ -7771,17 +8742,17 @@
6542 -L*)
6543 case " $new_libs " in
6544 *" $deplib "*) ;;
6545- *) new_libs="$new_libs $deplib" ;;
6546+ *) func_append new_libs " $deplib" ;;
6547 esac
6548 ;;
6549- *) new_libs="$new_libs $deplib" ;;
6550+ *) func_append new_libs " $deplib" ;;
6551 esac
6552 done
6553 compile_deplibs="$new_libs"
6554
6555
6556- compile_command="$compile_command $compile_deplibs"
6557- finalize_command="$finalize_command $finalize_deplibs"
6558+ func_append compile_command " $compile_deplibs"
6559+ func_append finalize_command " $finalize_deplibs"
6560
6561 if test -n "$rpath$xrpath"; then
6562 # If the user specified any rpath flags, then add them.
6563@@ -7789,7 +8760,7 @@
6564 # This is the magic to use -rpath.
6565 case "$finalize_rpath " in
6566 *" $libdir "*) ;;
6567- *) finalize_rpath="$finalize_rpath $libdir" ;;
6568+ *) func_append finalize_rpath " $libdir" ;;
6569 esac
6570 done
6571 fi
6572@@ -7808,18 +8779,18 @@
6573 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6574 ;;
6575 *)
6576- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
6577+ func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
6578 ;;
6579 esac
6580 fi
6581 else
6582- eval "flag=\"$hardcode_libdir_flag_spec\""
6583- rpath="$rpath $flag"
6584+ eval flag=\"$hardcode_libdir_flag_spec\"
6585+ func_append rpath " $flag"
6586 fi
6587 elif test -n "$runpath_var"; then
6588 case "$perm_rpath " in
6589 *" $libdir "*) ;;
6590- *) perm_rpath="$perm_rpath $libdir" ;;
6591+ *) func_append perm_rpath " $libdir" ;;
6592 esac
6593 fi
6594 case $host in
6595@@ -7828,12 +8799,12 @@
6596 case :$dllsearchpath: in
6597 *":$libdir:"*) ;;
6598 ::) dllsearchpath=$libdir;;
6599- *) dllsearchpath="$dllsearchpath:$libdir";;
6600+ *) func_append dllsearchpath ":$libdir";;
6601 esac
6602 case :$dllsearchpath: in
6603 *":$testbindir:"*) ;;
6604 ::) dllsearchpath=$testbindir;;
6605- *) dllsearchpath="$dllsearchpath:$testbindir";;
6606+ *) func_append dllsearchpath ":$testbindir";;
6607 esac
6608 ;;
6609 esac
6610@@ -7842,7 +8813,7 @@
6611 if test -n "$hardcode_libdir_separator" &&
6612 test -n "$hardcode_libdirs"; then
6613 libdir="$hardcode_libdirs"
6614- eval "rpath=\" $hardcode_libdir_flag_spec\""
6615+ eval rpath=\" $hardcode_libdir_flag_spec\"
6616 fi
6617 compile_rpath="$rpath"
6618
6619@@ -7859,18 +8830,18 @@
6620 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6621 ;;
6622 *)
6623- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
6624+ func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
6625 ;;
6626 esac
6627 fi
6628 else
6629- eval "flag=\"$hardcode_libdir_flag_spec\""
6630- rpath="$rpath $flag"
6631+ eval flag=\"$hardcode_libdir_flag_spec\"
6632+ func_append rpath " $flag"
6633 fi
6634 elif test -n "$runpath_var"; then
6635 case "$finalize_perm_rpath " in
6636 *" $libdir "*) ;;
6637- *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
6638+ *) func_append finalize_perm_rpath " $libdir" ;;
6639 esac
6640 fi
6641 done
6642@@ -7878,7 +8849,7 @@
6643 if test -n "$hardcode_libdir_separator" &&
6644 test -n "$hardcode_libdirs"; then
6645 libdir="$hardcode_libdirs"
6646- eval "rpath=\" $hardcode_libdir_flag_spec\""
6647+ eval rpath=\" $hardcode_libdir_flag_spec\"
6648 fi
6649 finalize_rpath="$rpath"
6650
6651@@ -7921,6 +8892,12 @@
6652 exit_status=0
6653 func_show_eval "$link_command" 'exit_status=$?'
6654
6655+ if test -n "$postlink_cmds"; then
6656+ func_to_tool_file "$output"
6657+ postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
6658+ func_execute_cmds "$postlink_cmds" 'exit $?'
6659+ fi
6660+
6661 # Delete the generated files.
6662 if test -f "$output_objdir/${outputname}S.${objext}"; then
6663 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
6664@@ -7943,7 +8920,7 @@
6665 # We should set the runpath_var.
6666 rpath=
6667 for dir in $perm_rpath; do
6668- rpath="$rpath$dir:"
6669+ func_append rpath "$dir:"
6670 done
6671 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
6672 fi
6673@@ -7951,7 +8928,7 @@
6674 # We should set the runpath_var.
6675 rpath=
6676 for dir in $finalize_perm_rpath; do
6677- rpath="$rpath$dir:"
6678+ func_append rpath "$dir:"
6679 done
6680 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
6681 fi
6682@@ -7966,6 +8943,13 @@
6683 $opt_dry_run || $RM $output
6684 # Link the executable and exit
6685 func_show_eval "$link_command" 'exit $?'
6686+
6687+ if test -n "$postlink_cmds"; then
6688+ func_to_tool_file "$output"
6689+ postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
6690+ func_execute_cmds "$postlink_cmds" 'exit $?'
6691+ fi
6692+
6693 exit $EXIT_SUCCESS
6694 fi
6695
6696@@ -7999,6 +8983,12 @@
6697
6698 func_show_eval "$link_command" 'exit $?'
6699
6700+ if test -n "$postlink_cmds"; then
6701+ func_to_tool_file "$output_objdir/$outputname"
6702+ postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
6703+ func_execute_cmds "$postlink_cmds" 'exit $?'
6704+ fi
6705+
6706 # Now create the wrapper script.
6707 func_verbose "creating $output"
6708
6709@@ -8096,7 +9086,7 @@
6710 else
6711 oldobjs="$old_deplibs $non_pic_objects"
6712 if test "$preload" = yes && test -f "$symfileobj"; then
6713- oldobjs="$oldobjs $symfileobj"
6714+ func_append oldobjs " $symfileobj"
6715 fi
6716 fi
6717 addlibs="$old_convenience"
6718@@ -8104,10 +9094,10 @@
6719
6720 if test -n "$addlibs"; then
6721 gentop="$output_objdir/${outputname}x"
6722- generated="$generated $gentop"
6723+ func_append generated " $gentop"
6724
6725 func_extract_archives $gentop $addlibs
6726- oldobjs="$oldobjs $func_extract_archives_result"
6727+ func_append oldobjs " $func_extract_archives_result"
6728 fi
6729
6730 # Do each command in the archive commands.
6731@@ -8118,10 +9108,10 @@
6732 # Add any objects from preloaded convenience libraries
6733 if test -n "$dlprefiles"; then
6734 gentop="$output_objdir/${outputname}x"
6735- generated="$generated $gentop"
6736+ func_append generated " $gentop"
6737
6738 func_extract_archives $gentop $dlprefiles
6739- oldobjs="$oldobjs $func_extract_archives_result"
6740+ func_append oldobjs " $func_extract_archives_result"
6741 fi
6742
6743 # POSIX demands no paths to be encoded in archives. We have
6744@@ -8139,7 +9129,7 @@
6745 else
6746 echo "copying selected object files to avoid basename conflicts..."
6747 gentop="$output_objdir/${outputname}x"
6748- generated="$generated $gentop"
6749+ func_append generated " $gentop"
6750 func_mkdir_p "$gentop"
6751 save_oldobjs=$oldobjs
6752 oldobjs=
6753@@ -8163,18 +9153,28 @@
6754 esac
6755 done
6756 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
6757- oldobjs="$oldobjs $gentop/$newobj"
6758+ func_append oldobjs " $gentop/$newobj"
6759 ;;
6760- *) oldobjs="$oldobjs $obj" ;;
6761+ *) func_append oldobjs " $obj" ;;
6762 esac
6763 done
6764 fi
6765- eval "cmds=\"$old_archive_cmds\""
6766+ eval cmds=\"$old_archive_cmds\"
6767
6768 func_len " $cmds"
6769 len=$func_len_result
6770 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
6771 cmds=$old_archive_cmds
6772+ elif test -n "$archiver_list_spec"; then
6773+ func_verbose "using command file archive linking..."
6774+ for obj in $oldobjs
6775+ do
6776+ func_to_tool_file "$obj"
6777+ $ECHO "$func_to_tool_file_result"
6778+ done > $output_objdir/$libname.libcmd
6779+ func_to_tool_file "$output_objdir/$libname.libcmd"
6780+ oldobjs=" $archiver_list_spec$func_to_tool_file_result"
6781+ cmds=$old_archive_cmds
6782 else
6783 # the command line is too long to link in one step, link in parts
6784 func_verbose "using piecewise archive linking..."
6785@@ -8189,7 +9189,7 @@
6786 do
6787 last_oldobj=$obj
6788 done
6789- eval "test_cmds=\"$old_archive_cmds\""
6790+ eval test_cmds=\"$old_archive_cmds\"
6791 func_len " $test_cmds"
6792 len0=$func_len_result
6793 len=$len0
6794@@ -8208,7 +9208,7 @@
6795 RANLIB=$save_RANLIB
6796 fi
6797 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
6798- eval "concat_cmds=\"\${concat_cmds}$old_archive_cmds\""
6799+ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
6800 objlist=
6801 len=$len0
6802 fi
6803@@ -8216,9 +9216,9 @@
6804 RANLIB=$save_RANLIB
6805 oldobjs=$objlist
6806 if test "X$oldobjs" = "X" ; then
6807- eval "cmds=\"\$concat_cmds\""
6808+ eval cmds=\"\$concat_cmds\"
6809 else
6810- eval "cmds=\"\$concat_cmds~\$old_archive_cmds\""
6811+ eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
6812 fi
6813 fi
6814 fi
6815@@ -8268,12 +9268,23 @@
6816 *.la)
6817 func_basename "$deplib"
6818 name="$func_basename_result"
6819- libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
6820+ func_resolve_sysroot "$deplib"
6821+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
6822 test -z "$libdir" && \
6823 func_fatal_error "\`$deplib' is not a valid libtool archive"
6824- newdependency_libs="$newdependency_libs $libdir/$name"
6825+ func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
6826+ ;;
6827+ -L*)
6828+ func_stripname -L '' "$deplib"
6829+ func_replace_sysroot "$func_stripname_result"
6830+ func_append newdependency_libs " -L$func_replace_sysroot_result"
6831 ;;
6832- *) newdependency_libs="$newdependency_libs $deplib" ;;
6833+ -R*)
6834+ func_stripname -R '' "$deplib"
6835+ func_replace_sysroot "$func_stripname_result"
6836+ func_append newdependency_libs " -R$func_replace_sysroot_result"
6837+ ;;
6838+ *) func_append newdependency_libs " $deplib" ;;
6839 esac
6840 done
6841 dependency_libs="$newdependency_libs"
6842@@ -8284,12 +9295,14 @@
6843 *.la)
6844 func_basename "$lib"
6845 name="$func_basename_result"
6846- libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
6847+ func_resolve_sysroot "$lib"
6848+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
6849+
6850 test -z "$libdir" && \
6851 func_fatal_error "\`$lib' is not a valid libtool archive"
6852- newdlfiles="$newdlfiles $libdir/$name"
6853+ func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
6854 ;;
6855- *) newdlfiles="$newdlfiles $lib" ;;
6856+ *) func_append newdlfiles " $lib" ;;
6857 esac
6858 done
6859 dlfiles="$newdlfiles"
6860@@ -8303,10 +9316,11 @@
6861 # the library:
6862 func_basename "$lib"
6863 name="$func_basename_result"
6864- libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
6865+ func_resolve_sysroot "$lib"
6866+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
6867 test -z "$libdir" && \
6868 func_fatal_error "\`$lib' is not a valid libtool archive"
6869- newdlprefiles="$newdlprefiles $libdir/$name"
6870+ func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
6871 ;;
6872 esac
6873 done
6874@@ -8318,7 +9332,7 @@
6875 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
6876 *) abs=`pwd`"/$lib" ;;
6877 esac
6878- newdlfiles="$newdlfiles $abs"
6879+ func_append newdlfiles " $abs"
6880 done
6881 dlfiles="$newdlfiles"
6882 newdlprefiles=
6883@@ -8327,7 +9341,7 @@
6884 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
6885 *) abs=`pwd`"/$lib" ;;
6886 esac
6887- newdlprefiles="$newdlprefiles $abs"
6888+ func_append newdlprefiles " $abs"
6889 done
6890 dlprefiles="$newdlprefiles"
6891 fi
6892@@ -8412,7 +9426,7 @@
6893 exit $EXIT_SUCCESS
6894 }
6895
6896-{ test "$mode" = link || test "$mode" = relink; } &&
6897+{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
6898 func_mode_link ${1+"$@"}
6899
6900
6901@@ -8432,9 +9446,9 @@
6902 for arg
6903 do
6904 case $arg in
6905- -f) RM="$RM $arg"; rmforce=yes ;;
6906- -*) RM="$RM $arg" ;;
6907- *) files="$files $arg" ;;
6908+ -f) func_append RM " $arg"; rmforce=yes ;;
6909+ -*) func_append RM " $arg" ;;
6910+ *) func_append files " $arg" ;;
6911 esac
6912 done
6913
6914@@ -8443,24 +9457,23 @@
6915
6916 rmdirs=
6917
6918- origobjdir="$objdir"
6919 for file in $files; do
6920 func_dirname "$file" "" "."
6921 dir="$func_dirname_result"
6922 if test "X$dir" = X.; then
6923- objdir="$origobjdir"
6924+ odir="$objdir"
6925 else
6926- objdir="$dir/$origobjdir"
6927+ odir="$dir/$objdir"
6928 fi
6929 func_basename "$file"
6930 name="$func_basename_result"
6931- test "$mode" = uninstall && objdir="$dir"
6932+ test "$opt_mode" = uninstall && odir="$dir"
6933
6934- # Remember objdir for removal later, being careful to avoid duplicates
6935- if test "$mode" = clean; then
6936+ # Remember odir for removal later, being careful to avoid duplicates
6937+ if test "$opt_mode" = clean; then
6938 case " $rmdirs " in
6939- *" $objdir "*) ;;
6940- *) rmdirs="$rmdirs $objdir" ;;
6941+ *" $odir "*) ;;
6942+ *) func_append rmdirs " $odir" ;;
6943 esac
6944 fi
6945
6946@@ -8486,18 +9499,17 @@
6947
6948 # Delete the libtool libraries and symlinks.
6949 for n in $library_names; do
6950- rmfiles="$rmfiles $objdir/$n"
6951+ func_append rmfiles " $odir/$n"
6952 done
6953- test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6954+ test -n "$old_library" && func_append rmfiles " $odir/$old_library"
6955
6956- case "$mode" in
6957+ case "$opt_mode" in
6958 clean)
6959- case " $library_names " in
6960- # " " in the beginning catches empty $dlname
6961+ case " $library_names " in
6962 *" $dlname "*) ;;
6963- *) rmfiles="$rmfiles $objdir/$dlname" ;;
6964+ *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
6965 esac
6966- test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6967+ test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
6968 ;;
6969 uninstall)
6970 if test -n "$library_names"; then
6971@@ -8525,19 +9537,19 @@
6972 # Add PIC object to the list of files to remove.
6973 if test -n "$pic_object" &&
6974 test "$pic_object" != none; then
6975- rmfiles="$rmfiles $dir/$pic_object"
6976+ func_append rmfiles " $dir/$pic_object"
6977 fi
6978
6979 # Add non-PIC object to the list of files to remove.
6980 if test -n "$non_pic_object" &&
6981 test "$non_pic_object" != none; then
6982- rmfiles="$rmfiles $dir/$non_pic_object"
6983+ func_append rmfiles " $dir/$non_pic_object"
6984 fi
6985 fi
6986 ;;
6987
6988 *)
6989- if test "$mode" = clean ; then
6990+ if test "$opt_mode" = clean ; then
6991 noexename=$name
6992 case $file in
6993 *.exe)
6994@@ -8547,7 +9559,7 @@
6995 noexename=$func_stripname_result
6996 # $file with .exe has already been added to rmfiles,
6997 # add $file without .exe
6998- rmfiles="$rmfiles $file"
6999+ func_append rmfiles " $file"
7000 ;;
7001 esac
7002 # Do a test to see if this is a libtool program.
7003@@ -8556,7 +9568,7 @@
7004 func_ltwrapper_scriptname "$file"
7005 relink_command=
7006 func_source $func_ltwrapper_scriptname_result
7007- rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
7008+ func_append rmfiles " $func_ltwrapper_scriptname_result"
7009 else
7010 relink_command=
7011 func_source $dir/$noexename
7012@@ -8564,12 +9576,12 @@
7013
7014 # note $name still contains .exe if it was in $file originally
7015 # as does the version of $file that was added into $rmfiles
7016- rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
7017+ func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
7018 if test "$fast_install" = yes && test -n "$relink_command"; then
7019- rmfiles="$rmfiles $objdir/lt-$name"
7020+ func_append rmfiles " $odir/lt-$name"
7021 fi
7022 if test "X$noexename" != "X$name" ; then
7023- rmfiles="$rmfiles $objdir/lt-${noexename}.c"
7024+ func_append rmfiles " $odir/lt-${noexename}.c"
7025 fi
7026 fi
7027 fi
7028@@ -8577,7 +9589,6 @@
7029 esac
7030 func_show_eval "$RM $rmfiles" 'exit_status=1'
7031 done
7032- objdir="$origobjdir"
7033
7034 # Try to remove the ${objdir}s in the directories where we deleted files
7035 for dir in $rmdirs; do
7036@@ -8589,16 +9600,16 @@
7037 exit $exit_status
7038 }
7039
7040-{ test "$mode" = uninstall || test "$mode" = clean; } &&
7041+{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
7042 func_mode_uninstall ${1+"$@"}
7043
7044-test -z "$mode" && {
7045+test -z "$opt_mode" && {
7046 help="$generic_help"
7047 func_fatal_help "you must specify a MODE"
7048 }
7049
7050 test -z "$exec_cmd" && \
7051- func_fatal_help "invalid operation mode \`$mode'"
7052+ func_fatal_help "invalid operation mode \`$opt_mode'"
7053
7054 if test -n "$exec_cmd"; then
7055 eval exec "$exec_cmd"
7056Index: binutils-2.24/ltoptions.m4
7057===================================================================
7058--- binutils-2.24.orig/ltoptions.m4 2013-11-04 07:33:40.000000000 -0800
7059+++ binutils-2.24/ltoptions.m4 2013-12-15 11:10:23.867118697 -0800
7060@@ -8,7 +8,7 @@
7061 # unlimited permission to copy and/or distribute it, with or without
7062 # modifications, as long as this notice is preserved.
7063
7064-# serial 6 ltoptions.m4
7065+# serial 7 ltoptions.m4
7066
7067 # This is to help aclocal find these macros, as it can't see m4_define.
7068 AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
7069Index: binutils-2.24/ltversion.m4
7070===================================================================
7071--- binutils-2.24.orig/ltversion.m4 2013-11-04 07:33:40.000000000 -0800
7072+++ binutils-2.24/ltversion.m4 2013-12-15 11:10:23.867118697 -0800
7073@@ -7,17 +7,17 @@
7074 # unlimited permission to copy and/or distribute it, with or without
7075 # modifications, as long as this notice is preserved.
7076
7077-# Generated from ltversion.in.
7078+# @configure_input@
7079
7080-# serial 3134 ltversion.m4
7081+# serial 3293 ltversion.m4
7082 # This file is part of GNU Libtool
7083
7084-m4_define([LT_PACKAGE_VERSION], [2.2.7a])
7085-m4_define([LT_PACKAGE_REVISION], [1.3134])
7086+m4_define([LT_PACKAGE_VERSION], [2.4])
7087+m4_define([LT_PACKAGE_REVISION], [1.3293])
7088
7089 AC_DEFUN([LTVERSION_VERSION],
7090-[macro_version='2.2.7a'
7091-macro_revision='1.3134'
7092+[macro_version='2.4'
7093+macro_revision='1.3293'
7094 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
7095 _LT_DECL(, macro_revision, 0)
7096 ])
7097Index: binutils-2.24/lt~obsolete.m4
7098===================================================================
7099--- binutils-2.24.orig/lt~obsolete.m4 2013-11-04 07:33:40.000000000 -0800
7100+++ binutils-2.24/lt~obsolete.m4 2013-12-15 11:10:23.867118697 -0800
7101@@ -7,7 +7,7 @@
7102 # unlimited permission to copy and/or distribute it, with or without
7103 # modifications, as long as this notice is preserved.
7104
7105-# serial 4 lt~obsolete.m4
7106+# serial 5 lt~obsolete.m4
7107
7108 # These exist entirely to fool aclocal when bootstrapping libtool.
7109 #
7110Index: binutils-2.24/configure
7111===================================================================
7112--- binutils-2.24.orig/configure 2013-12-15 11:09:51.000000000 -0800
7113+++ binutils-2.24/configure 2013-12-15 11:10:23.870452030 -0800
7114@@ -7921,7 +7921,7 @@
7115 # For an installed makeinfo, we require it to be from texinfo 4.7 or
7116 # higher, else we use the "missing" dummy.
7117 if ${MAKEINFO} --version \
7118- | egrep 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
7119+ | egrep 'texinfo[^0-9]*([1-3][0-9]|4.[4-9]|4.[1-9][0-9]+|[5-9])' >/dev/null 2>&1; then
7120 :
7121 else
7122 MAKEINFO="$MISSING makeinfo"
7123Index: binutils-2.24/bfd/configure
7124===================================================================
7125--- binutils-2.24.orig/bfd/configure 2013-12-02 01:30:30.000000000 -0800
7126+++ binutils-2.24/bfd/configure 2013-12-15 11:10:23.870452030 -0800
7127@@ -668,6 +668,9 @@
7128 LIPO
7129 NMEDIT
7130 DSYMUTIL
7131+MANIFEST_TOOL
7132+ac_ct_AR
7133+DLLTOOL
7134 OBJDUMP
7135 LN_S
7136 NM
7137@@ -780,6 +783,7 @@
7138 with_pic
7139 enable_fast_install
7140 with_gnu_ld
7141+with_libtool_sysroot
7142 enable_libtool_lock
7143 enable_plugins
7144 enable_largefile
7145@@ -1456,6 +1460,8 @@
7146 --with-pic try to use only PIC/non-PIC objects [default=use
7147 both]
7148 --with-gnu-ld assume the C compiler uses GNU ld [default=no]
7149+ --with-libtool-sysroot=DIR Search for dependent libraries within DIR
7150+ (or the compiler's sysroot if not specified).
7151 --with-mmap try using mmap for BFD input files if available
7152 --with-separate-debug-dir=DIR
7153 Look for global separate debug info in DIR
7154@@ -5386,8 +5392,8 @@
7155
7156
7157
7158-macro_version='2.2.7a'
7159-macro_revision='1.3134'
7160+macro_version='2.4'
7161+macro_revision='1.3293'
7162
7163
7164
7165@@ -5427,7 +5433,7 @@
7166 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
7167 $as_echo_n "checking how to print strings... " >&6; }
7168 # Test print first, because it will be a builtin if present.
7169-if test "X`print -r -- -n 2>/dev/null`" = X-n && \
7170+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
7171 test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
7172 ECHO='print -r --'
7173 elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
7174@@ -6113,8 +6119,8 @@
7175 # Try some XSI features
7176 xsi_shell=no
7177 ( _lt_dummy="a/b/c"
7178- test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
7179- = c,a/b,, \
7180+ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
7181+ = c,a/b,b/c, \
7182 && eval 'test $(( 1 + 1 )) -eq 2 \
7183 && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
7184 && xsi_shell=yes
7185@@ -6163,6 +6169,80 @@
7186
7187
7188
7189+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
7190+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
7191+if test "${lt_cv_to_host_file_cmd+set}" = set; then :
7192+ $as_echo_n "(cached) " >&6
7193+else
7194+ case $host in
7195+ *-*-mingw* )
7196+ case $build in
7197+ *-*-mingw* ) # actually msys
7198+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
7199+ ;;
7200+ *-*-cygwin* )
7201+ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
7202+ ;;
7203+ * ) # otherwise, assume *nix
7204+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
7205+ ;;
7206+ esac
7207+ ;;
7208+ *-*-cygwin* )
7209+ case $build in
7210+ *-*-mingw* ) # actually msys
7211+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
7212+ ;;
7213+ *-*-cygwin* )
7214+ lt_cv_to_host_file_cmd=func_convert_file_noop
7215+ ;;
7216+ * ) # otherwise, assume *nix
7217+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
7218+ ;;
7219+ esac
7220+ ;;
7221+ * ) # unhandled hosts (and "normal" native builds)
7222+ lt_cv_to_host_file_cmd=func_convert_file_noop
7223+ ;;
7224+esac
7225+
7226+fi
7227+
7228+to_host_file_cmd=$lt_cv_to_host_file_cmd
7229+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
7230+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
7231+
7232+
7233+
7234+
7235+
7236+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
7237+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
7238+if test "${lt_cv_to_tool_file_cmd+set}" = set; then :
7239+ $as_echo_n "(cached) " >&6
7240+else
7241+ #assume ordinary cross tools, or native build.
7242+lt_cv_to_tool_file_cmd=func_convert_file_noop
7243+case $host in
7244+ *-*-mingw* )
7245+ case $build in
7246+ *-*-mingw* ) # actually msys
7247+ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
7248+ ;;
7249+ esac
7250+ ;;
7251+esac
7252+
7253+fi
7254+
7255+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
7256+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
7257+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
7258+
7259+
7260+
7261+
7262+
7263 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
7264 $as_echo_n "checking for $LD option to reload object files... " >&6; }
7265 if test "${lt_cv_ld_reload_flag+set}" = set; then :
7266@@ -6179,6 +6259,11 @@
7267 esac
7268 reload_cmds='$LD$reload_flag -o $output$reload_objs'
7269 case $host_os in
7270+ cygwin* | mingw* | pw32* | cegcc*)
7271+ if test "$GCC" != yes; then
7272+ reload_cmds=false
7273+ fi
7274+ ;;
7275 darwin*)
7276 if test "$GCC" = yes; then
7277 reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
7278@@ -6347,7 +6432,8 @@
7279 lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
7280 lt_cv_file_magic_cmd='func_win32_libid'
7281 else
7282- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
7283+ # Keep this pattern in sync with the one in func_win32_libid.
7284+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
7285 lt_cv_file_magic_cmd='$OBJDUMP -f'
7286 fi
7287 ;;
7288@@ -6501,6 +6587,21 @@
7289 fi
7290 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
7291 $as_echo "$lt_cv_deplibs_check_method" >&6; }
7292+
7293+file_magic_glob=
7294+want_nocaseglob=no
7295+if test "$build" = "$host"; then
7296+ case $host_os in
7297+ mingw* | pw32*)
7298+ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
7299+ want_nocaseglob=yes
7300+ else
7301+ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
7302+ fi
7303+ ;;
7304+ esac
7305+fi
7306+
7307 file_magic_cmd=$lt_cv_file_magic_cmd
7308 deplibs_check_method=$lt_cv_deplibs_check_method
7309 test -z "$deplibs_check_method" && deplibs_check_method=unknown
7310@@ -6516,9 +6617,162 @@
7311
7312
7313
7314+
7315+
7316+
7317+
7318+
7319+
7320+
7321+
7322+
7323+
7324 if test -n "$ac_tool_prefix"; then
7325- # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
7326-set dummy ${ac_tool_prefix}ar; ac_word=$2
7327+ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
7328+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
7329+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
7330+$as_echo_n "checking for $ac_word... " >&6; }
7331+if test "${ac_cv_prog_DLLTOOL+set}" = set; then :
7332+ $as_echo_n "(cached) " >&6
7333+else
7334+ if test -n "$DLLTOOL"; then
7335+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
7336+else
7337+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
7338+for as_dir in $PATH
7339+do
7340+ IFS=$as_save_IFS
7341+ test -z "$as_dir" && as_dir=.
7342+ for ac_exec_ext in '' $ac_executable_extensions; do
7343+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
7344+ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
7345+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
7346+ break 2
7347+ fi
7348+done
7349+ done
7350+IFS=$as_save_IFS
7351+
7352+fi
7353+fi
7354+DLLTOOL=$ac_cv_prog_DLLTOOL
7355+if test -n "$DLLTOOL"; then
7356+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
7357+$as_echo "$DLLTOOL" >&6; }
7358+else
7359+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
7360+$as_echo "no" >&6; }
7361+fi
7362+
7363+
7364+fi
7365+if test -z "$ac_cv_prog_DLLTOOL"; then
7366+ ac_ct_DLLTOOL=$DLLTOOL
7367+ # Extract the first word of "dlltool", so it can be a program name with args.
7368+set dummy dlltool; ac_word=$2
7369+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
7370+$as_echo_n "checking for $ac_word... " >&6; }
7371+if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then :
7372+ $as_echo_n "(cached) " >&6
7373+else
7374+ if test -n "$ac_ct_DLLTOOL"; then
7375+ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
7376+else
7377+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
7378+for as_dir in $PATH
7379+do
7380+ IFS=$as_save_IFS
7381+ test -z "$as_dir" && as_dir=.
7382+ for ac_exec_ext in '' $ac_executable_extensions; do
7383+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
7384+ ac_cv_prog_ac_ct_DLLTOOL="dlltool"
7385+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
7386+ break 2
7387+ fi
7388+done
7389+ done
7390+IFS=$as_save_IFS
7391+
7392+fi
7393+fi
7394+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
7395+if test -n "$ac_ct_DLLTOOL"; then
7396+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
7397+$as_echo "$ac_ct_DLLTOOL" >&6; }
7398+else
7399+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
7400+$as_echo "no" >&6; }
7401+fi
7402+
7403+ if test "x$ac_ct_DLLTOOL" = x; then
7404+ DLLTOOL="false"
7405+ else
7406+ case $cross_compiling:$ac_tool_warned in
7407+yes:)
7408+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
7409+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
7410+ac_tool_warned=yes ;;
7411+esac
7412+ DLLTOOL=$ac_ct_DLLTOOL
7413+ fi
7414+else
7415+ DLLTOOL="$ac_cv_prog_DLLTOOL"
7416+fi
7417+
7418+test -z "$DLLTOOL" && DLLTOOL=dlltool
7419+
7420+
7421+
7422+
7423+
7424+
7425+
7426+
7427+
7428+
7429+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
7430+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
7431+if test "${lt_cv_sharedlib_from_linklib_cmd+set}" = set; then :
7432+ $as_echo_n "(cached) " >&6
7433+else
7434+ lt_cv_sharedlib_from_linklib_cmd='unknown'
7435+
7436+case $host_os in
7437+cygwin* | mingw* | pw32* | cegcc*)
7438+ # two different shell functions defined in ltmain.sh
7439+ # decide which to use based on capabilities of $DLLTOOL
7440+ case `$DLLTOOL --help 2>&1` in
7441+ *--identify-strict*)
7442+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
7443+ ;;
7444+ *)
7445+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
7446+ ;;
7447+ esac
7448+ ;;
7449+*)
7450+ # fallback: assume linklib IS sharedlib
7451+ lt_cv_sharedlib_from_linklib_cmd="$ECHO"
7452+ ;;
7453+esac
7454+
7455+fi
7456+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
7457+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
7458+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
7459+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
7460+
7461+
7462+
7463+
7464+
7465+
7466+
7467+if test -n "$ac_tool_prefix"; then
7468+ for ac_prog in ar
7469+ do
7470+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
7471+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
7472 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
7473 $as_echo_n "checking for $ac_word... " >&6; }
7474 if test "${ac_cv_prog_AR+set}" = set; then :
7475@@ -6534,7 +6788,7 @@
7476 test -z "$as_dir" && as_dir=.
7477 for ac_exec_ext in '' $ac_executable_extensions; do
7478 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
7479- ac_cv_prog_AR="${ac_tool_prefix}ar"
7480+ ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
7481 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
7482 break 2
7483 fi
7484@@ -6554,11 +6808,15 @@
7485 fi
7486
7487
7488+ test -n "$AR" && break
7489+ done
7490 fi
7491-if test -z "$ac_cv_prog_AR"; then
7492+if test -z "$AR"; then
7493 ac_ct_AR=$AR
7494- # Extract the first word of "ar", so it can be a program name with args.
7495-set dummy ar; ac_word=$2
7496+ for ac_prog in ar
7497+do
7498+ # Extract the first word of "$ac_prog", so it can be a program name with args.
7499+set dummy $ac_prog; ac_word=$2
7500 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
7501 $as_echo_n "checking for $ac_word... " >&6; }
7502 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
7503@@ -6574,7 +6832,7 @@
7504 test -z "$as_dir" && as_dir=.
7505 for ac_exec_ext in '' $ac_executable_extensions; do
7506 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
7507- ac_cv_prog_ac_ct_AR="ar"
7508+ ac_cv_prog_ac_ct_AR="$ac_prog"
7509 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
7510 break 2
7511 fi
7512@@ -6593,6 +6851,10 @@
7513 $as_echo "no" >&6; }
7514 fi
7515
7516+
7517+ test -n "$ac_ct_AR" && break
7518+done
7519+
7520 if test "x$ac_ct_AR" = x; then
7521 AR="false"
7522 else
7523@@ -6604,16 +6866,72 @@
7524 esac
7525 AR=$ac_ct_AR
7526 fi
7527-else
7528- AR="$ac_cv_prog_AR"
7529 fi
7530
7531-test -z "$AR" && AR=ar
7532-test -z "$AR_FLAGS" && AR_FLAGS=cru
7533+: ${AR=ar}
7534+: ${AR_FLAGS=cru}
7535+
7536+
7537+
7538+
7539+
7540+
7541+
7542+
7543+
7544+
7545
7546+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
7547+$as_echo_n "checking for archiver @FILE support... " >&6; }
7548+if test "${lt_cv_ar_at_file+set}" = set; then :
7549+ $as_echo_n "(cached) " >&6
7550+else
7551+ lt_cv_ar_at_file=no
7552+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
7553+/* end confdefs.h. */
7554
7555+int
7556+main ()
7557+{
7558
7559+ ;
7560+ return 0;
7561+}
7562+_ACEOF
7563+if ac_fn_c_try_compile "$LINENO"; then :
7564+ echo conftest.$ac_objext > conftest.lst
7565+ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
7566+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
7567+ (eval $lt_ar_try) 2>&5
7568+ ac_status=$?
7569+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
7570+ test $ac_status = 0; }
7571+ if test "$ac_status" -eq 0; then
7572+ # Ensure the archiver fails upon bogus file names.
7573+ rm -f conftest.$ac_objext libconftest.a
7574+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
7575+ (eval $lt_ar_try) 2>&5
7576+ ac_status=$?
7577+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
7578+ test $ac_status = 0; }
7579+ if test "$ac_status" -ne 0; then
7580+ lt_cv_ar_at_file=@
7581+ fi
7582+ fi
7583+ rm -f conftest.* libconftest.a
7584
7585+fi
7586+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7587+
7588+fi
7589+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
7590+$as_echo "$lt_cv_ar_at_file" >&6; }
7591+
7592+if test "x$lt_cv_ar_at_file" = xno; then
7593+ archiver_list_spec=
7594+else
7595+ archiver_list_spec=$lt_cv_ar_at_file
7596+fi
7597
7598
7599
7600@@ -6955,8 +7273,8 @@
7601 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
7602
7603 # Transform an extracted symbol line into symbol name and symbol address
7604-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
7605-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
7606+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
7607+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
7608
7609 # Handle CRLF in mingw tool chain
7610 opt_cr=
7611@@ -6992,6 +7310,7 @@
7612 else
7613 lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
7614 fi
7615+ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
7616
7617 # Check to see that the pipe works correctly.
7618 pipe_works=no
7619@@ -7033,6 +7352,18 @@
7620 if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
7621 if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
7622 cat <<_LT_EOF > conftest.$ac_ext
7623+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
7624+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
7625+/* DATA imports from DLLs on WIN32 con't be const, because runtime
7626+ relocations are performed -- see ld's documentation on pseudo-relocs. */
7627+# define LT_DLSYM_CONST
7628+#elif defined(__osf__)
7629+/* This system does not cope well with relocations in const data. */
7630+# define LT_DLSYM_CONST
7631+#else
7632+# define LT_DLSYM_CONST const
7633+#endif
7634+
7635 #ifdef __cplusplus
7636 extern "C" {
7637 #endif
7638@@ -7044,7 +7375,7 @@
7639 cat <<_LT_EOF >> conftest.$ac_ext
7640
7641 /* The mapping between symbol names and symbols. */
7642-const struct {
7643+LT_DLSYM_CONST struct {
7644 const char *name;
7645 void *address;
7646 }
7647@@ -7070,8 +7401,8 @@
7648 _LT_EOF
7649 # Now try linking the two files.
7650 mv conftest.$ac_objext conftstm.$ac_objext
7651- lt_save_LIBS="$LIBS"
7652- lt_save_CFLAGS="$CFLAGS"
7653+ lt_globsym_save_LIBS=$LIBS
7654+ lt_globsym_save_CFLAGS=$CFLAGS
7655 LIBS="conftstm.$ac_objext"
7656 CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
7657 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
7658@@ -7081,8 +7412,8 @@
7659 test $ac_status = 0; } && test -s conftest${ac_exeext}; then
7660 pipe_works=yes
7661 fi
7662- LIBS="$lt_save_LIBS"
7663- CFLAGS="$lt_save_CFLAGS"
7664+ LIBS=$lt_globsym_save_LIBS
7665+ CFLAGS=$lt_globsym_save_CFLAGS
7666 else
7667 echo "cannot find nm_test_func in $nlist" >&5
7668 fi
7669@@ -7119,6 +7450,20 @@
7670 $as_echo "ok" >&6; }
7671 fi
7672
7673+# Response file support.
7674+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
7675+ nm_file_list_spec='@'
7676+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
7677+ nm_file_list_spec='@'
7678+fi
7679+
7680+
7681+
7682+
7683+
7684+
7685+
7686+
7687
7688
7689
7690@@ -7138,6 +7483,41 @@
7691
7692
7693
7694+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
7695+$as_echo_n "checking for sysroot... " >&6; }
7696+
7697+# Check whether --with-libtool-sysroot was given.
7698+if test "${with_libtool_sysroot+set}" = set; then :
7699+ withval=$with_libtool_sysroot;
7700+else
7701+ with_libtool_sysroot=no
7702+fi
7703+
7704+
7705+lt_sysroot=
7706+case ${with_libtool_sysroot} in #(
7707+ yes)
7708+ if test "$GCC" = yes; then
7709+ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
7710+ fi
7711+ ;; #(
7712+ /*)
7713+ lt_sysroot=`echo "$with_libtool_sysroot" | sed -e "$sed_quote_subst"`
7714+ ;; #(
7715+ no|'')
7716+ ;; #(
7717+ *)
7718+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_libtool_sysroot}" >&5
7719+$as_echo "${with_libtool_sysroot}" >&6; }
7720+ as_fn_error "The sysroot must be an absolute path." "$LINENO" 5
7721+ ;;
7722+esac
7723+
7724+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
7725+$as_echo "${lt_sysroot:-no}" >&6; }
7726+
7727+
7728+
7729
7730
7731 # Check whether --enable-libtool-lock was given.
7732@@ -7346,6 +7726,123 @@
7733
7734 need_locks="$enable_libtool_lock"
7735
7736+if test -n "$ac_tool_prefix"; then
7737+ # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
7738+set dummy ${ac_tool_prefix}mt; ac_word=$2
7739+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
7740+$as_echo_n "checking for $ac_word... " >&6; }
7741+if test "${ac_cv_prog_MANIFEST_TOOL+set}" = set; then :
7742+ $as_echo_n "(cached) " >&6
7743+else
7744+ if test -n "$MANIFEST_TOOL"; then
7745+ ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
7746+else
7747+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
7748+for as_dir in $PATH
7749+do
7750+ IFS=$as_save_IFS
7751+ test -z "$as_dir" && as_dir=.
7752+ for ac_exec_ext in '' $ac_executable_extensions; do
7753+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
7754+ ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
7755+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
7756+ break 2
7757+ fi
7758+done
7759+ done
7760+IFS=$as_save_IFS
7761+
7762+fi
7763+fi
7764+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
7765+if test -n "$MANIFEST_TOOL"; then
7766+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
7767+$as_echo "$MANIFEST_TOOL" >&6; }
7768+else
7769+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
7770+$as_echo "no" >&6; }
7771+fi
7772+
7773+
7774+fi
7775+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
7776+ ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
7777+ # Extract the first word of "mt", so it can be a program name with args.
7778+set dummy mt; ac_word=$2
7779+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
7780+$as_echo_n "checking for $ac_word... " >&6; }
7781+if test "${ac_cv_prog_ac_ct_MANIFEST_TOOL+set}" = set; then :
7782+ $as_echo_n "(cached) " >&6
7783+else
7784+ if test -n "$ac_ct_MANIFEST_TOOL"; then
7785+ ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
7786+else
7787+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
7788+for as_dir in $PATH
7789+do
7790+ IFS=$as_save_IFS
7791+ test -z "$as_dir" && as_dir=.
7792+ for ac_exec_ext in '' $ac_executable_extensions; do
7793+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
7794+ ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
7795+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
7796+ break 2
7797+ fi
7798+done
7799+ done
7800+IFS=$as_save_IFS
7801+
7802+fi
7803+fi
7804+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
7805+if test -n "$ac_ct_MANIFEST_TOOL"; then
7806+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
7807+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
7808+else
7809+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
7810+$as_echo "no" >&6; }
7811+fi
7812+
7813+ if test "x$ac_ct_MANIFEST_TOOL" = x; then
7814+ MANIFEST_TOOL=":"
7815+ else
7816+ case $cross_compiling:$ac_tool_warned in
7817+yes:)
7818+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
7819+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
7820+ac_tool_warned=yes ;;
7821+esac
7822+ MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
7823+ fi
7824+else
7825+ MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
7826+fi
7827+
7828+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
7829+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
7830+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
7831+if test "${lt_cv_path_mainfest_tool+set}" = set; then :
7832+ $as_echo_n "(cached) " >&6
7833+else
7834+ lt_cv_path_mainfest_tool=no
7835+ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
7836+ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
7837+ cat conftest.err >&5
7838+ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
7839+ lt_cv_path_mainfest_tool=yes
7840+ fi
7841+ rm -f conftest*
7842+fi
7843+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
7844+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
7845+if test "x$lt_cv_path_mainfest_tool" != xyes; then
7846+ MANIFEST_TOOL=:
7847+fi
7848+
7849+
7850+
7851+
7852+
7853
7854 case $host_os in
7855 rhapsody* | darwin*)
7856@@ -7909,6 +8406,8 @@
7857 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
7858 echo "$AR cru libconftest.a conftest.o" >&5
7859 $AR cru libconftest.a conftest.o 2>&5
7860+ echo "$RANLIB libconftest.a" >&5
7861+ $RANLIB libconftest.a 2>&5
7862 cat > conftest.c << _LT_EOF
7863 int main() { return 0;}
7864 _LT_EOF
7865@@ -8073,7 +8572,8 @@
7866 LIBTOOL_DEPS="$ltmain"
7867
7868 # Always use our own libtool.
7869-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
7870+LIBTOOL='$(SHELL) $(top_builddir)'
7871+LIBTOOL="$LIBTOOL/${host_alias}-libtool"
7872
7873
7874
7875@@ -8162,7 +8662,7 @@
7876 esac
7877
7878 # Global variables:
7879-ofile=libtool
7880+ofile=${host_alias}-libtool
7881 can_build_shared=yes
7882
7883 # All known linkers require a `.a' archive for static linking (except MSVC,
7884@@ -8460,8 +8960,6 @@
7885 lt_prog_compiler_pic=
7886 lt_prog_compiler_static=
7887
7888-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
7889-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
7890
7891 if test "$GCC" = yes; then
7892 lt_prog_compiler_wl='-Wl,'
7893@@ -8627,6 +9125,12 @@
7894 lt_prog_compiler_pic='--shared'
7895 lt_prog_compiler_static='--static'
7896 ;;
7897+ nagfor*)
7898+ # NAG Fortran compiler
7899+ lt_prog_compiler_wl='-Wl,-Wl,,'
7900+ lt_prog_compiler_pic='-PIC'
7901+ lt_prog_compiler_static='-Bstatic'
7902+ ;;
7903 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
7904 # Portland Group compilers (*not* the Pentium gcc compiler,
7905 # which looks to be a dead project)
7906@@ -8689,7 +9193,7 @@
7907 lt_prog_compiler_pic='-KPIC'
7908 lt_prog_compiler_static='-Bstatic'
7909 case $cc_basename in
7910- f77* | f90* | f95*)
7911+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
7912 lt_prog_compiler_wl='-Qoption ld ';;
7913 *)
7914 lt_prog_compiler_wl='-Wl,';;
7915@@ -8746,13 +9250,17 @@
7916 lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
7917 ;;
7918 esac
7919-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
7920-$as_echo "$lt_prog_compiler_pic" >&6; }
7921-
7922-
7923-
7924-
7925
7926+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
7927+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
7928+if test "${lt_cv_prog_compiler_pic+set}" = set; then :
7929+ $as_echo_n "(cached) " >&6
7930+else
7931+ lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
7932+fi
7933+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
7934+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
7935+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
7936
7937 #
7938 # Check to make sure the PIC flag actually works.
7939@@ -8813,6 +9321,11 @@
7940
7941
7942
7943+
7944+
7945+
7946+
7947+
7948 #
7949 # Check to make sure the static flag actually works.
7950 #
7951@@ -9163,7 +9676,8 @@
7952 allow_undefined_flag=unsupported
7953 always_export_symbols=no
7954 enable_shared_with_static_runtimes=yes
7955- export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
7956+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
7957+ exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
7958
7959 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
7960 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
7961@@ -9211,7 +9725,7 @@
7962 if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
7963 && test "$tmp_diet" = no
7964 then
7965- tmp_addflag=
7966+ tmp_addflag=' $pic_flag'
7967 tmp_sharedflag='-shared'
7968 case $cc_basename,$host_cpu in
7969 pgcc*) # Portland Group C compiler
7970@@ -9262,12 +9776,12 @@
7971 whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
7972 hardcode_libdir_flag_spec=
7973 hardcode_libdir_flag_spec_ld='-rpath $libdir'
7974- archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
7975+ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
7976 if test "x$supports_anon_versioning" = xyes; then
7977 archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
7978 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
7979 echo "local: *; };" >> $output_objdir/$libname.ver~
7980- $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
7981+ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
7982 fi
7983 ;;
7984 esac
7985@@ -9281,8 +9795,8 @@
7986 archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
7987 wlarc=
7988 else
7989- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
7990- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
7991+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
7992+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
7993 fi
7994 ;;
7995
7996@@ -9300,8 +9814,8 @@
7997
7998 _LT_EOF
7999 elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
8000- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
8001- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
8002+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
8003+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
8004 else
8005 ld_shlibs=no
8006 fi
8007@@ -9347,8 +9861,8 @@
8008
8009 *)
8010 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
8011- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
8012- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
8013+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
8014+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
8015 else
8016 ld_shlibs=no
8017 fi
8018@@ -9478,7 +9992,13 @@
8019 allow_undefined_flag='-berok'
8020 # Determine the default libpath from the value encoded in an
8021 # empty executable.
8022- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
8023+ if test "${lt_cv_aix_libpath+set}" = set; then
8024+ aix_libpath=$lt_cv_aix_libpath
8025+else
8026+ if test "${lt_cv_aix_libpath_+set}" = set; then :
8027+ $as_echo_n "(cached) " >&6
8028+else
8029+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
8030 /* end confdefs.h. */
8031
8032 int
8033@@ -9491,22 +10011,29 @@
8034 _ACEOF
8035 if ac_fn_c_try_link "$LINENO"; then :
8036
8037-lt_aix_libpath_sed='
8038- /Import File Strings/,/^$/ {
8039- /^0/ {
8040- s/^0 *\(.*\)$/\1/
8041- p
8042- }
8043- }'
8044-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
8045-# Check for a 64-bit object if we didn't find anything.
8046-if test -z "$aix_libpath"; then
8047- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
8048-fi
8049+ lt_aix_libpath_sed='
8050+ /Import File Strings/,/^$/ {
8051+ /^0/ {
8052+ s/^0 *\([^ ]*\) *$/\1/
8053+ p
8054+ }
8055+ }'
8056+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
8057+ # Check for a 64-bit object if we didn't find anything.
8058+ if test -z "$lt_cv_aix_libpath_"; then
8059+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
8060+ fi
8061 fi
8062 rm -f core conftest.err conftest.$ac_objext \
8063 conftest$ac_exeext conftest.$ac_ext
8064-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
8065+ if test -z "$lt_cv_aix_libpath_"; then
8066+ lt_cv_aix_libpath_="/usr/lib:/lib"
8067+ fi
8068+
8069+fi
8070+
8071+ aix_libpath=$lt_cv_aix_libpath_
8072+fi
8073
8074 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
8075 archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
8076@@ -9518,7 +10045,13 @@
8077 else
8078 # Determine the default libpath from the value encoded in an
8079 # empty executable.
8080- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
8081+ if test "${lt_cv_aix_libpath+set}" = set; then
8082+ aix_libpath=$lt_cv_aix_libpath
8083+else
8084+ if test "${lt_cv_aix_libpath_+set}" = set; then :
8085+ $as_echo_n "(cached) " >&6
8086+else
8087+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
8088 /* end confdefs.h. */
8089
8090 int
8091@@ -9531,22 +10064,29 @@
8092 _ACEOF
8093 if ac_fn_c_try_link "$LINENO"; then :
8094
8095-lt_aix_libpath_sed='
8096- /Import File Strings/,/^$/ {
8097- /^0/ {
8098- s/^0 *\(.*\)$/\1/
8099- p
8100- }
8101- }'
8102-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
8103-# Check for a 64-bit object if we didn't find anything.
8104-if test -z "$aix_libpath"; then
8105- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
8106-fi
8107+ lt_aix_libpath_sed='
8108+ /Import File Strings/,/^$/ {
8109+ /^0/ {
8110+ s/^0 *\([^ ]*\) *$/\1/
8111+ p
8112+ }
8113+ }'
8114+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
8115+ # Check for a 64-bit object if we didn't find anything.
8116+ if test -z "$lt_cv_aix_libpath_"; then
8117+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
8118+ fi
8119 fi
8120 rm -f core conftest.err conftest.$ac_objext \
8121 conftest$ac_exeext conftest.$ac_ext
8122-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
8123+ if test -z "$lt_cv_aix_libpath_"; then
8124+ lt_cv_aix_libpath_="/usr/lib:/lib"
8125+ fi
8126+
8127+fi
8128+
8129+ aix_libpath=$lt_cv_aix_libpath_
8130+fi
8131
8132 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
8133 # Warning - without using the other run time loading flags,
8134@@ -9591,20 +10131,63 @@
8135 # Microsoft Visual C++.
8136 # hardcode_libdir_flag_spec is actually meaningless, as there is
8137 # no search path for DLLs.
8138- hardcode_libdir_flag_spec=' '
8139- allow_undefined_flag=unsupported
8140- # Tell ltmain to make .lib files, not .a files.
8141- libext=lib
8142- # Tell ltmain to make .dll files, not .so files.
8143- shrext_cmds=".dll"
8144- # FIXME: Setting linknames here is a bad hack.
8145- archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
8146- # The linker will automatically build a .lib file if we build a DLL.
8147- old_archive_from_new_cmds='true'
8148- # FIXME: Should let the user specify the lib program.
8149- old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
8150- fix_srcfile_path='`cygpath -w "$srcfile"`'
8151- enable_shared_with_static_runtimes=yes
8152+ case $cc_basename in
8153+ cl*)
8154+ # Native MSVC
8155+ hardcode_libdir_flag_spec=' '
8156+ allow_undefined_flag=unsupported
8157+ always_export_symbols=yes
8158+ file_list_spec='@'
8159+ # Tell ltmain to make .lib files, not .a files.
8160+ libext=lib
8161+ # Tell ltmain to make .dll files, not .so files.
8162+ shrext_cmds=".dll"
8163+ # FIXME: Setting linknames here is a bad hack.
8164+ archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
8165+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
8166+ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
8167+ else
8168+ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
8169+ fi~
8170+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
8171+ linknames='
8172+ # The linker will not automatically build a static lib if we build a DLL.
8173+ # _LT_TAGVAR(old_archive_from_new_cmds, )='true'
8174+ enable_shared_with_static_runtimes=yes
8175+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
8176+ # Don't use ranlib
8177+ old_postinstall_cmds='chmod 644 $oldlib'
8178+ postlink_cmds='lt_outputfile="@OUTPUT@"~
8179+ lt_tool_outputfile="@TOOL_OUTPUT@"~
8180+ case $lt_outputfile in
8181+ *.exe|*.EXE) ;;
8182+ *)
8183+ lt_outputfile="$lt_outputfile.exe"
8184+ lt_tool_outputfile="$lt_tool_outputfile.exe"
8185+ ;;
8186+ esac~
8187+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
8188+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
8189+ $RM "$lt_outputfile.manifest";
8190+ fi'
8191+ ;;
8192+ *)
8193+ # Assume MSVC wrapper
8194+ hardcode_libdir_flag_spec=' '
8195+ allow_undefined_flag=unsupported
8196+ # Tell ltmain to make .lib files, not .a files.
8197+ libext=lib
8198+ # Tell ltmain to make .dll files, not .so files.
8199+ shrext_cmds=".dll"
8200+ # FIXME: Setting linknames here is a bad hack.
8201+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
8202+ # The linker will automatically build a .lib file if we build a DLL.
8203+ old_archive_from_new_cmds='true'
8204+ # FIXME: Should let the user specify the lib program.
8205+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
8206+ enable_shared_with_static_runtimes=yes
8207+ ;;
8208+ esac
8209 ;;
8210
8211 darwin* | rhapsody*)
8212@@ -9665,7 +10248,7 @@
8213
8214 # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
8215 freebsd* | dragonfly*)
8216- archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
8217+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
8218 hardcode_libdir_flag_spec='-R$libdir'
8219 hardcode_direct=yes
8220 hardcode_shlibpath_var=no
8221@@ -9673,7 +10256,7 @@
8222
8223 hpux9*)
8224 if test "$GCC" = yes; then
8225- archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
8226+ archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
8227 else
8228 archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
8229 fi
8230@@ -9689,7 +10272,7 @@
8231
8232 hpux10*)
8233 if test "$GCC" = yes && test "$with_gnu_ld" = no; then
8234- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
8235+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
8236 else
8237 archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
8238 fi
8239@@ -9713,10 +10296,10 @@
8240 archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
8241 ;;
8242 ia64*)
8243- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
8244+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
8245 ;;
8246 *)
8247- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
8248+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
8249 ;;
8250 esac
8251 else
8252@@ -9795,23 +10378,36 @@
8253
8254 irix5* | irix6* | nonstopux*)
8255 if test "$GCC" = yes; then
8256- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
8257+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
8258 # Try to use the -exported_symbol ld option, if it does not
8259 # work, assume that -exports_file does not work either and
8260 # implicitly export all symbols.
8261- save_LDFLAGS="$LDFLAGS"
8262- LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
8263- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
8264+ # This should be the same for all languages, so no per-tag cache variable.
8265+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
8266+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
8267+if test "${lt_cv_irix_exported_symbol+set}" = set; then :
8268+ $as_echo_n "(cached) " >&6
8269+else
8270+ save_LDFLAGS="$LDFLAGS"
8271+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
8272+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
8273 /* end confdefs.h. */
8274-int foo(void) {}
8275+int foo (void) { return 0; }
8276 _ACEOF
8277 if ac_fn_c_try_link "$LINENO"; then :
8278- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
8279-
8280+ lt_cv_irix_exported_symbol=yes
8281+else
8282+ lt_cv_irix_exported_symbol=no
8283 fi
8284 rm -f core conftest.err conftest.$ac_objext \
8285 conftest$ac_exeext conftest.$ac_ext
8286- LDFLAGS="$save_LDFLAGS"
8287+ LDFLAGS="$save_LDFLAGS"
8288+fi
8289+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
8290+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
8291+ if test "$lt_cv_irix_exported_symbol" = yes; then
8292+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
8293+ fi
8294 else
8295 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
8296 archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
8297@@ -9896,7 +10492,7 @@
8298 osf4* | osf5*) # as osf3* with the addition of -msym flag
8299 if test "$GCC" = yes; then
8300 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
8301- archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
8302+ archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
8303 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
8304 else
8305 allow_undefined_flag=' -expect_unresolved \*'
8306@@ -9915,9 +10511,9 @@
8307 no_undefined_flag=' -z defs'
8308 if test "$GCC" = yes; then
8309 wlarc='${wl}'
8310- archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
8311+ archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
8312 archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
8313- $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
8314+ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
8315 else
8316 case `$CC -V 2>&1` in
8317 *"Compilers 5.0"*)
8318@@ -10493,8 +11089,9 @@
8319 need_version=no
8320 need_lib_prefix=no
8321
8322- case $GCC,$host_os in
8323- yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
8324+ case $GCC,$cc_basename in
8325+ yes,*)
8326+ # gcc
8327 library_names_spec='$libname.dll.a'
8328 # DLL is installed to $(libdir)/../bin by postinstall_cmds
8329 postinstall_cmds='base_file=`basename \${file}`~
8330@@ -10527,13 +11124,71 @@
8331 library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
8332 ;;
8333 esac
8334+ dynamic_linker='Win32 ld.exe'
8335+ ;;
8336+
8337+ *,cl*)
8338+ # Native MSVC
8339+ libname_spec='$name'
8340+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
8341+ library_names_spec='${libname}.dll.lib'
8342+
8343+ case $build_os in
8344+ mingw*)
8345+ sys_lib_search_path_spec=
8346+ lt_save_ifs=$IFS
8347+ IFS=';'
8348+ for lt_path in $LIB
8349+ do
8350+ IFS=$lt_save_ifs
8351+ # Let DOS variable expansion print the short 8.3 style file name.
8352+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
8353+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
8354+ done
8355+ IFS=$lt_save_ifs
8356+ # Convert to MSYS style.
8357+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
8358+ ;;
8359+ cygwin*)
8360+ # Convert to unix form, then to dos form, then back to unix form
8361+ # but this time dos style (no spaces!) so that the unix form looks
8362+ # like /cygdrive/c/PROGRA~1:/cygdr...
8363+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
8364+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
8365+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
8366+ ;;
8367+ *)
8368+ sys_lib_search_path_spec="$LIB"
8369+ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
8370+ # It is most probably a Windows format PATH.
8371+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
8372+ else
8373+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
8374+ fi
8375+ # FIXME: find the short name or the path components, as spaces are
8376+ # common. (e.g. "Program Files" -> "PROGRA~1")
8377+ ;;
8378+ esac
8379+
8380+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
8381+ postinstall_cmds='base_file=`basename \${file}`~
8382+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
8383+ dldir=$destdir/`dirname \$dlpath`~
8384+ test -d \$dldir || mkdir -p \$dldir~
8385+ $install_prog $dir/$dlname \$dldir/$dlname'
8386+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
8387+ dlpath=$dir/\$dldll~
8388+ $RM \$dlpath'
8389+ shlibpath_overrides_runpath=yes
8390+ dynamic_linker='Win32 link.exe'
8391 ;;
8392
8393 *)
8394+ # Assume MSVC wrapper
8395 library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
8396+ dynamic_linker='Win32 ld.exe'
8397 ;;
8398 esac
8399- dynamic_linker='Win32 ld.exe'
8400 # FIXME: first we should search . and the directory the executable is in
8401 shlibpath_var=PATH
8402 ;;
8403@@ -10625,7 +11280,7 @@
8404 soname_spec='${libname}${release}${shared_ext}$major'
8405 shlibpath_var=LIBRARY_PATH
8406 shlibpath_overrides_runpath=yes
8407- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
8408+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
8409 hardcode_into_libs=yes
8410 ;;
8411
8412@@ -11465,10 +12120,10 @@
8413 /* When -fvisbility=hidden is used, assume the code has been annotated
8414 correspondingly for the symbols needed. */
8415 #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
8416-void fnord () __attribute__((visibility("default")));
8417+int fnord () __attribute__((visibility("default")));
8418 #endif
8419
8420-void fnord () { int i=42; }
8421+int fnord () { return 42; }
8422 int main ()
8423 {
8424 void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
8425@@ -11571,10 +12226,10 @@
8426 /* When -fvisbility=hidden is used, assume the code has been annotated
8427 correspondingly for the symbols needed. */
8428 #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
8429-void fnord () __attribute__((visibility("default")));
8430+int fnord () __attribute__((visibility("default")));
8431 #endif
8432
8433-void fnord () { int i=42; }
8434+int fnord () { return 42; }
8435 int main ()
8436 {
8437 void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
8438@@ -15079,7 +15734,7 @@
8439 if test "$enable_shared" = "yes"; then
8440 x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
8441 if test -n "$x"; then
8442- SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
8443+ SHARED_LIBADD="`pwd`/../libiberty/pic/libiberty.a"
8444 fi
8445
8446 # More hacks to build DLLs on Windows.
8447@@ -16694,13 +17349,20 @@
8448 lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
8449 lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
8450 lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
8451+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
8452+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
8453 reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
8454 reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
8455 OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
8456 deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
8457 file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
8458+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
8459+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
8460+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
8461+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
8462 AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
8463 AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
8464+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
8465 STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
8466 RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
8467 old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
8468@@ -16715,14 +17377,17 @@
8469 lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
8470 lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
8471 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
8472+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
8473+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
8474 objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
8475 MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
8476 lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
8477-lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
8478 lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
8479+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
8480 lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
8481 lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
8482 need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
8483+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
8484 DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
8485 NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
8486 LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
8487@@ -16755,12 +17420,12 @@
8488 hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
8489 inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
8490 link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
8491-fix_srcfile_path='`$ECHO "$fix_srcfile_path" | $SED "$delay_single_quote_subst"`'
8492 always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
8493 export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
8494 exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
8495 include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
8496 prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
8497+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
8498 file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
8499 variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
8500 need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
8501@@ -16815,8 +17480,13 @@
8502 OBJDUMP \
8503 deplibs_check_method \
8504 file_magic_cmd \
8505+file_magic_glob \
8506+want_nocaseglob \
8507+DLLTOOL \
8508+sharedlib_from_linklib_cmd \
8509 AR \
8510 AR_FLAGS \
8511+archiver_list_spec \
8512 STRIP \
8513 RANLIB \
8514 CC \
8515@@ -16826,12 +17496,14 @@
8516 lt_cv_sys_global_symbol_to_cdecl \
8517 lt_cv_sys_global_symbol_to_c_name_address \
8518 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
8519+nm_file_list_spec \
8520 lt_prog_compiler_no_builtin_flag \
8521-lt_prog_compiler_wl \
8522 lt_prog_compiler_pic \
8523+lt_prog_compiler_wl \
8524 lt_prog_compiler_static \
8525 lt_cv_prog_compiler_c_o \
8526 need_locks \
8527+MANIFEST_TOOL \
8528 DSYMUTIL \
8529 NMEDIT \
8530 LIPO \
8531@@ -16847,7 +17519,6 @@
8532 hardcode_libdir_flag_spec \
8533 hardcode_libdir_flag_spec_ld \
8534 hardcode_libdir_separator \
8535-fix_srcfile_path \
8536 exclude_expsyms \
8537 include_expsyms \
8538 file_list_spec \
8539@@ -16883,6 +17554,7 @@
8540 module_expsym_cmds \
8541 export_symbols_cmds \
8542 prelink_cmds \
8543+postlink_cmds \
8544 postinstall_cmds \
8545 postuninstall_cmds \
8546 finish_cmds \
8547@@ -17662,7 +18334,8 @@
8548 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
8549 #
8550 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
8551-# 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
8552+# 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
8553+# Inc.
8554 # Written by Gordon Matzigkeit, 1996
8555 #
8556 # This file is part of GNU Libtool.
8557@@ -17765,19 +18438,42 @@
8558 # turn newlines into spaces.
8559 NL2SP=$lt_lt_NL2SP
8560
8561+# convert \$build file names to \$host format.
8562+to_host_file_cmd=$lt_cv_to_host_file_cmd
8563+
8564+# convert \$build files to toolchain format.
8565+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
8566+
8567 # An object symbol dumper.
8568 OBJDUMP=$lt_OBJDUMP
8569
8570 # Method to check whether dependent libraries are shared objects.
8571 deplibs_check_method=$lt_deplibs_check_method
8572
8573-# Command to use when deplibs_check_method == "file_magic".
8574+# Command to use when deplibs_check_method = "file_magic".
8575 file_magic_cmd=$lt_file_magic_cmd
8576
8577+# How to find potential files when deplibs_check_method = "file_magic".
8578+file_magic_glob=$lt_file_magic_glob
8579+
8580+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
8581+want_nocaseglob=$lt_want_nocaseglob
8582+
8583+# DLL creation program.
8584+DLLTOOL=$lt_DLLTOOL
8585+
8586+# Command to associate shared and link libraries.
8587+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
8588+
8589 # The archiver.
8590 AR=$lt_AR
8591+
8592+# Flags to create an archive.
8593 AR_FLAGS=$lt_AR_FLAGS
8594
8595+# How to feed a file listing to the archiver.
8596+archiver_list_spec=$lt_archiver_list_spec
8597+
8598 # A symbol stripping program.
8599 STRIP=$lt_STRIP
8600
8601@@ -17807,6 +18503,12 @@
8602 # Transform the output of nm in a C name address pair when lib prefix is needed.
8603 global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
8604
8605+# Specify filename containing input files for \$NM.
8606+nm_file_list_spec=$lt_nm_file_list_spec
8607+
8608+# The root where to search for dependent libraries,and in which our libraries should be installed.
8609+lt_sysroot=$lt_sysroot
8610+
8611 # The name of the directory that contains temporary libtool files.
8612 objdir=$objdir
8613
8614@@ -17816,6 +18518,9 @@
8615 # Must we lock files when doing compilation?
8616 need_locks=$lt_need_locks
8617
8618+# Manifest tool.
8619+MANIFEST_TOOL=$lt_MANIFEST_TOOL
8620+
8621 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
8622 DSYMUTIL=$lt_DSYMUTIL
8623
8624@@ -17930,12 +18635,12 @@
8625 # Compiler flag to turn off builtin functions.
8626 no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
8627
8628-# How to pass a linker flag through the compiler.
8629-wl=$lt_lt_prog_compiler_wl
8630-
8631 # Additional compiler flags for building library objects.
8632 pic_flag=$lt_lt_prog_compiler_pic
8633
8634+# How to pass a linker flag through the compiler.
8635+wl=$lt_lt_prog_compiler_wl
8636+
8637 # Compiler flag to prevent dynamic linking.
8638 link_static_flag=$lt_lt_prog_compiler_static
8639
8640@@ -18022,9 +18727,6 @@
8641 # Whether libtool must link a program against all its dependency libraries.
8642 link_all_deplibs=$link_all_deplibs
8643
8644-# Fix the shell variable \$srcfile for the compiler.
8645-fix_srcfile_path=$lt_fix_srcfile_path
8646-
8647 # Set to "yes" if exported symbols are required.
8648 always_export_symbols=$always_export_symbols
8649
8650@@ -18040,6 +18742,9 @@
8651 # Commands necessary for linking programs (against libraries) with templates.
8652 prelink_cmds=$lt_prelink_cmds
8653
8654+# Commands necessary for finishing linking programs.
8655+postlink_cmds=$lt_postlink_cmds
8656+
8657 # Specify filename containing input files.
8658 file_list_spec=$lt_file_list_spec
8659
8660@@ -18072,210 +18777,169 @@
8661 # if finds mixed CR/LF and LF-only lines. Since sed operates in
8662 # text mode, it properly converts lines to CR/LF. This bash problem
8663 # is reportedly fixed, but why not run on old versions too?
8664- sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
8665- || (rm -f "$cfgfile"; exit 1)
8666-
8667- case $xsi_shell in
8668- yes)
8669- cat << \_LT_EOF >> "$cfgfile"
8670-
8671-# func_dirname file append nondir_replacement
8672-# Compute the dirname of FILE. If nonempty, add APPEND to the result,
8673-# otherwise set result to NONDIR_REPLACEMENT.
8674-func_dirname ()
8675-{
8676- case ${1} in
8677- */*) func_dirname_result="${1%/*}${2}" ;;
8678- * ) func_dirname_result="${3}" ;;
8679- esac
8680-}
8681-
8682-# func_basename file
8683-func_basename ()
8684-{
8685- func_basename_result="${1##*/}"
8686-}
8687-
8688-# func_dirname_and_basename file append nondir_replacement
8689-# perform func_basename and func_dirname in a single function
8690-# call:
8691-# dirname: Compute the dirname of FILE. If nonempty,
8692-# add APPEND to the result, otherwise set result
8693-# to NONDIR_REPLACEMENT.
8694-# value returned in "$func_dirname_result"
8695-# basename: Compute filename of FILE.
8696-# value retuned in "$func_basename_result"
8697-# Implementation must be kept synchronized with func_dirname
8698-# and func_basename. For efficiency, we do not delegate to
8699-# those functions but instead duplicate the functionality here.
8700-func_dirname_and_basename ()
8701-{
8702- case ${1} in
8703- */*) func_dirname_result="${1%/*}${2}" ;;
8704- * ) func_dirname_result="${3}" ;;
8705- esac
8706- func_basename_result="${1##*/}"
8707-}
8708-
8709-# func_stripname prefix suffix name
8710-# strip PREFIX and SUFFIX off of NAME.
8711-# PREFIX and SUFFIX must not contain globbing or regex special
8712-# characters, hashes, percent signs, but SUFFIX may contain a leading
8713-# dot (in which case that matches only a dot).
8714-func_stripname ()
8715-{
8716- # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
8717- # positional parameters, so assign one to ordinary parameter first.
8718- func_stripname_result=${3}
8719- func_stripname_result=${func_stripname_result#"${1}"}
8720- func_stripname_result=${func_stripname_result%"${2}"}
8721-}
8722-
8723-# func_opt_split
8724-func_opt_split ()
8725-{
8726- func_opt_split_opt=${1%%=*}
8727- func_opt_split_arg=${1#*=}
8728-}
8729-
8730-# func_lo2o object
8731-func_lo2o ()
8732-{
8733- case ${1} in
8734- *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
8735- *) func_lo2o_result=${1} ;;
8736- esac
8737-}
8738-
8739-# func_xform libobj-or-source
8740-func_xform ()
8741-{
8742- func_xform_result=${1%.*}.lo
8743-}
8744-
8745-# func_arith arithmetic-term...
8746-func_arith ()
8747-{
8748- func_arith_result=$(( $* ))
8749-}
8750-
8751-# func_len string
8752-# STRING may not start with a hyphen.
8753-func_len ()
8754-{
8755- func_len_result=${#1}
8756-}
8757-
8758-_LT_EOF
8759- ;;
8760- *) # Bourne compatible functions.
8761- cat << \_LT_EOF >> "$cfgfile"
8762-
8763-# func_dirname file append nondir_replacement
8764-# Compute the dirname of FILE. If nonempty, add APPEND to the result,
8765-# otherwise set result to NONDIR_REPLACEMENT.
8766-func_dirname ()
8767-{
8768- # Extract subdirectory from the argument.
8769- func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
8770- if test "X$func_dirname_result" = "X${1}"; then
8771- func_dirname_result="${3}"
8772- else
8773- func_dirname_result="$func_dirname_result${2}"
8774- fi
8775-}
8776-
8777-# func_basename file
8778-func_basename ()
8779-{
8780- func_basename_result=`$ECHO "${1}" | $SED "$basename"`
8781-}
8782-
8783-
8784-# func_stripname prefix suffix name
8785-# strip PREFIX and SUFFIX off of NAME.
8786-# PREFIX and SUFFIX must not contain globbing or regex special
8787-# characters, hashes, percent signs, but SUFFIX may contain a leading
8788-# dot (in which case that matches only a dot).
8789-# func_strip_suffix prefix name
8790-func_stripname ()
8791-{
8792- case ${2} in
8793- .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
8794- *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
8795- esac
8796-}
8797-
8798-# sed scripts:
8799-my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
8800-my_sed_long_arg='1s/^-[^=]*=//'
8801-
8802-# func_opt_split
8803-func_opt_split ()
8804-{
8805- func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"`
8806- func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"`
8807-}
8808-
8809-# func_lo2o object
8810-func_lo2o ()
8811-{
8812- func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
8813-}
8814-
8815-# func_xform libobj-or-source
8816-func_xform ()
8817-{
8818- func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
8819-}
8820-
8821-# func_arith arithmetic-term...
8822-func_arith ()
8823-{
8824- func_arith_result=`expr "$@"`
8825-}
8826-
8827-# func_len string
8828-# STRING may not start with a hyphen.
8829-func_len ()
8830-{
8831- func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
8832-}
8833-
8834-_LT_EOF
8835-esac
8836-
8837-case $lt_shell_append in
8838- yes)
8839- cat << \_LT_EOF >> "$cfgfile"
8840-
8841-# func_append var value
8842-# Append VALUE to the end of shell variable VAR.
8843-func_append ()
8844-{
8845- eval "$1+=\$2"
8846-}
8847-_LT_EOF
8848- ;;
8849- *)
8850- cat << \_LT_EOF >> "$cfgfile"
8851-
8852-# func_append var value
8853-# Append VALUE to the end of shell variable VAR.
8854-func_append ()
8855-{
8856- eval "$1=\$$1\$2"
8857-}
8858-
8859-_LT_EOF
8860- ;;
8861- esac
8862+ sed '$q' "$ltmain" >> "$cfgfile" \
8863+ || (rm -f "$cfgfile"; exit 1)
8864
8865+ if test x"$xsi_shell" = xyes; then
8866+ sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
8867+func_dirname ()\
8868+{\
8869+\ case ${1} in\
8870+\ */*) func_dirname_result="${1%/*}${2}" ;;\
8871+\ * ) func_dirname_result="${3}" ;;\
8872+\ esac\
8873+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
8874+ && mv -f "$cfgfile.tmp" "$cfgfile" \
8875+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
8876+test 0 -eq $? || _lt_function_replace_fail=:
8877+
8878+
8879+ sed -e '/^func_basename ()$/,/^} # func_basename /c\
8880+func_basename ()\
8881+{\
8882+\ func_basename_result="${1##*/}"\
8883+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
8884+ && mv -f "$cfgfile.tmp" "$cfgfile" \
8885+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
8886+test 0 -eq $? || _lt_function_replace_fail=:
8887+
8888+
8889+ sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
8890+func_dirname_and_basename ()\
8891+{\
8892+\ case ${1} in\
8893+\ */*) func_dirname_result="${1%/*}${2}" ;;\
8894+\ * ) func_dirname_result="${3}" ;;\
8895+\ esac\
8896+\ func_basename_result="${1##*/}"\
8897+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
8898+ && mv -f "$cfgfile.tmp" "$cfgfile" \
8899+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
8900+test 0 -eq $? || _lt_function_replace_fail=:
8901+
8902+
8903+ sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
8904+func_stripname ()\
8905+{\
8906+\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
8907+\ # positional parameters, so assign one to ordinary parameter first.\
8908+\ func_stripname_result=${3}\
8909+\ func_stripname_result=${func_stripname_result#"${1}"}\
8910+\ func_stripname_result=${func_stripname_result%"${2}"}\
8911+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
8912+ && mv -f "$cfgfile.tmp" "$cfgfile" \
8913+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
8914+test 0 -eq $? || _lt_function_replace_fail=:
8915+
8916+
8917+ sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
8918+func_split_long_opt ()\
8919+{\
8920+\ func_split_long_opt_name=${1%%=*}\
8921+\ func_split_long_opt_arg=${1#*=}\
8922+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
8923+ && mv -f "$cfgfile.tmp" "$cfgfile" \
8924+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
8925+test 0 -eq $? || _lt_function_replace_fail=:
8926+
8927+
8928+ sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
8929+func_split_short_opt ()\
8930+{\
8931+\ func_split_short_opt_arg=${1#??}\
8932+\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
8933+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
8934+ && mv -f "$cfgfile.tmp" "$cfgfile" \
8935+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
8936+test 0 -eq $? || _lt_function_replace_fail=:
8937+
8938+
8939+ sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
8940+func_lo2o ()\
8941+{\
8942+\ case ${1} in\
8943+\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
8944+\ *) func_lo2o_result=${1} ;;\
8945+\ esac\
8946+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
8947+ && mv -f "$cfgfile.tmp" "$cfgfile" \
8948+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
8949+test 0 -eq $? || _lt_function_replace_fail=:
8950+
8951+
8952+ sed -e '/^func_xform ()$/,/^} # func_xform /c\
8953+func_xform ()\
8954+{\
8955+ func_xform_result=${1%.*}.lo\
8956+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
8957+ && mv -f "$cfgfile.tmp" "$cfgfile" \
8958+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
8959+test 0 -eq $? || _lt_function_replace_fail=:
8960+
8961+
8962+ sed -e '/^func_arith ()$/,/^} # func_arith /c\
8963+func_arith ()\
8964+{\
8965+ func_arith_result=$(( $* ))\
8966+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
8967+ && mv -f "$cfgfile.tmp" "$cfgfile" \
8968+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
8969+test 0 -eq $? || _lt_function_replace_fail=:
8970+
8971+
8972+ sed -e '/^func_len ()$/,/^} # func_len /c\
8973+func_len ()\
8974+{\
8975+ func_len_result=${#1}\
8976+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
8977+ && mv -f "$cfgfile.tmp" "$cfgfile" \
8978+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
8979+test 0 -eq $? || _lt_function_replace_fail=:
8980+
8981+fi
8982+
8983+if test x"$lt_shell_append" = xyes; then
8984+ sed -e '/^func_append ()$/,/^} # func_append /c\
8985+func_append ()\
8986+{\
8987+ eval "${1}+=\\${2}"\
8988+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
8989+ && mv -f "$cfgfile.tmp" "$cfgfile" \
8990+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
8991+test 0 -eq $? || _lt_function_replace_fail=:
8992+
8993+
8994+ sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
8995+func_append_quoted ()\
8996+{\
8997+\ func_quote_for_eval "${2}"\
8998+\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
8999+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
9000+ && mv -f "$cfgfile.tmp" "$cfgfile" \
9001+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
9002+test 0 -eq $? || _lt_function_replace_fail=:
9003+
9004+
9005+ # Save a `func_append' function call where possible by direct use of '+='
9006+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
9007+ && mv -f "$cfgfile.tmp" "$cfgfile" \
9008+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
9009+ test 0 -eq $? || _lt_function_replace_fail=:
9010+else
9011+ # Save a `func_append' function call even when '+=' is not available
9012+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
9013+ && mv -f "$cfgfile.tmp" "$cfgfile" \
9014+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
9015+ test 0 -eq $? || _lt_function_replace_fail=:
9016+fi
9017+
9018+if test x"$_lt_function_replace_fail" = x":"; then
9019+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
9020+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
9021+fi
9022
9023- sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
9024- || (rm -f "$cfgfile"; exit 1)
9025
9026- mv -f "$cfgfile" "$ofile" ||
9027+ mv -f "$cfgfile" "$ofile" ||
9028 (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
9029 chmod +x "$ofile"
9030
9031Index: binutils-2.24/opcodes/configure
9032===================================================================
9033--- binutils-2.24.orig/opcodes/configure 2013-11-04 07:33:40.000000000 -0800
9034+++ binutils-2.24/opcodes/configure 2013-12-15 11:10:23.873785364 -0800
9035@@ -648,6 +648,9 @@
9036 LIPO
9037 NMEDIT
9038 DSYMUTIL
9039+MANIFEST_TOOL
9040+ac_ct_AR
9041+DLLTOOL
9042 OBJDUMP
9043 LN_S
9044 NM
9045@@ -760,6 +763,7 @@
9046 with_pic
9047 enable_fast_install
9048 with_gnu_ld
9049+with_libtool_sysroot
9050 enable_libtool_lock
9051 enable_targets
9052 enable_werror
9053@@ -1418,6 +1422,8 @@
9054 --with-pic try to use only PIC/non-PIC objects [default=use
9055 both]
9056 --with-gnu-ld assume the C compiler uses GNU ld [default=no]
9057+ --with-libtool-sysroot=DIR Search for dependent libraries within DIR
9058+ (or the compiler's sysroot if not specified).
9059
9060 Some influential environment variables:
9061 CC C compiler command
9062@@ -5113,8 +5119,8 @@
9063
9064
9065
9066-macro_version='2.2.7a'
9067-macro_revision='1.3134'
9068+macro_version='2.4'
9069+macro_revision='1.3293'
9070
9071
9072
9073@@ -5154,7 +5160,7 @@
9074 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
9075 $as_echo_n "checking how to print strings... " >&6; }
9076 # Test print first, because it will be a builtin if present.
9077-if test "X`print -r -- -n 2>/dev/null`" = X-n && \
9078+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
9079 test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
9080 ECHO='print -r --'
9081 elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
9082@@ -5840,8 +5846,8 @@
9083 # Try some XSI features
9084 xsi_shell=no
9085 ( _lt_dummy="a/b/c"
9086- test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
9087- = c,a/b,, \
9088+ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
9089+ = c,a/b,b/c, \
9090 && eval 'test $(( 1 + 1 )) -eq 2 \
9091 && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
9092 && xsi_shell=yes
9093@@ -5890,6 +5896,80 @@
9094
9095
9096
9097+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
9098+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
9099+if test "${lt_cv_to_host_file_cmd+set}" = set; then :
9100+ $as_echo_n "(cached) " >&6
9101+else
9102+ case $host in
9103+ *-*-mingw* )
9104+ case $build in
9105+ *-*-mingw* ) # actually msys
9106+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
9107+ ;;
9108+ *-*-cygwin* )
9109+ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
9110+ ;;
9111+ * ) # otherwise, assume *nix
9112+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
9113+ ;;
9114+ esac
9115+ ;;
9116+ *-*-cygwin* )
9117+ case $build in
9118+ *-*-mingw* ) # actually msys
9119+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
9120+ ;;
9121+ *-*-cygwin* )
9122+ lt_cv_to_host_file_cmd=func_convert_file_noop
9123+ ;;
9124+ * ) # otherwise, assume *nix
9125+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
9126+ ;;
9127+ esac
9128+ ;;
9129+ * ) # unhandled hosts (and "normal" native builds)
9130+ lt_cv_to_host_file_cmd=func_convert_file_noop
9131+ ;;
9132+esac
9133+
9134+fi
9135+
9136+to_host_file_cmd=$lt_cv_to_host_file_cmd
9137+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
9138+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
9139+
9140+
9141+
9142+
9143+
9144+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
9145+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
9146+if test "${lt_cv_to_tool_file_cmd+set}" = set; then :
9147+ $as_echo_n "(cached) " >&6
9148+else
9149+ #assume ordinary cross tools, or native build.
9150+lt_cv_to_tool_file_cmd=func_convert_file_noop
9151+case $host in
9152+ *-*-mingw* )
9153+ case $build in
9154+ *-*-mingw* ) # actually msys
9155+ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
9156+ ;;
9157+ esac
9158+ ;;
9159+esac
9160+
9161+fi
9162+
9163+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
9164+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
9165+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
9166+
9167+
9168+
9169+
9170+
9171 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
9172 $as_echo_n "checking for $LD option to reload object files... " >&6; }
9173 if test "${lt_cv_ld_reload_flag+set}" = set; then :
9174@@ -5906,6 +5986,11 @@
9175 esac
9176 reload_cmds='$LD$reload_flag -o $output$reload_objs'
9177 case $host_os in
9178+ cygwin* | mingw* | pw32* | cegcc*)
9179+ if test "$GCC" != yes; then
9180+ reload_cmds=false
9181+ fi
9182+ ;;
9183 darwin*)
9184 if test "$GCC" = yes; then
9185 reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
9186@@ -6074,7 +6159,8 @@
9187 lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
9188 lt_cv_file_magic_cmd='func_win32_libid'
9189 else
9190- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
9191+ # Keep this pattern in sync with the one in func_win32_libid.
9192+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
9193 lt_cv_file_magic_cmd='$OBJDUMP -f'
9194 fi
9195 ;;
9196@@ -6228,6 +6314,21 @@
9197 fi
9198 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
9199 $as_echo "$lt_cv_deplibs_check_method" >&6; }
9200+
9201+file_magic_glob=
9202+want_nocaseglob=no
9203+if test "$build" = "$host"; then
9204+ case $host_os in
9205+ mingw* | pw32*)
9206+ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
9207+ want_nocaseglob=yes
9208+ else
9209+ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
9210+ fi
9211+ ;;
9212+ esac
9213+fi
9214+
9215 file_magic_cmd=$lt_cv_file_magic_cmd
9216 deplibs_check_method=$lt_cv_deplibs_check_method
9217 test -z "$deplibs_check_method" && deplibs_check_method=unknown
9218@@ -6243,9 +6344,162 @@
9219
9220
9221
9222+
9223+
9224+
9225+
9226+
9227+
9228+
9229+
9230+
9231+
9232 if test -n "$ac_tool_prefix"; then
9233- # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
9234-set dummy ${ac_tool_prefix}ar; ac_word=$2
9235+ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
9236+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
9237+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
9238+$as_echo_n "checking for $ac_word... " >&6; }
9239+if test "${ac_cv_prog_DLLTOOL+set}" = set; then :
9240+ $as_echo_n "(cached) " >&6
9241+else
9242+ if test -n "$DLLTOOL"; then
9243+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
9244+else
9245+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
9246+for as_dir in $PATH
9247+do
9248+ IFS=$as_save_IFS
9249+ test -z "$as_dir" && as_dir=.
9250+ for ac_exec_ext in '' $ac_executable_extensions; do
9251+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
9252+ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
9253+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
9254+ break 2
9255+ fi
9256+done
9257+ done
9258+IFS=$as_save_IFS
9259+
9260+fi
9261+fi
9262+DLLTOOL=$ac_cv_prog_DLLTOOL
9263+if test -n "$DLLTOOL"; then
9264+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
9265+$as_echo "$DLLTOOL" >&6; }
9266+else
9267+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
9268+$as_echo "no" >&6; }
9269+fi
9270+
9271+
9272+fi
9273+if test -z "$ac_cv_prog_DLLTOOL"; then
9274+ ac_ct_DLLTOOL=$DLLTOOL
9275+ # Extract the first word of "dlltool", so it can be a program name with args.
9276+set dummy dlltool; ac_word=$2
9277+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
9278+$as_echo_n "checking for $ac_word... " >&6; }
9279+if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then :
9280+ $as_echo_n "(cached) " >&6
9281+else
9282+ if test -n "$ac_ct_DLLTOOL"; then
9283+ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
9284+else
9285+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
9286+for as_dir in $PATH
9287+do
9288+ IFS=$as_save_IFS
9289+ test -z "$as_dir" && as_dir=.
9290+ for ac_exec_ext in '' $ac_executable_extensions; do
9291+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
9292+ ac_cv_prog_ac_ct_DLLTOOL="dlltool"
9293+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
9294+ break 2
9295+ fi
9296+done
9297+ done
9298+IFS=$as_save_IFS
9299+
9300+fi
9301+fi
9302+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
9303+if test -n "$ac_ct_DLLTOOL"; then
9304+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
9305+$as_echo "$ac_ct_DLLTOOL" >&6; }
9306+else
9307+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
9308+$as_echo "no" >&6; }
9309+fi
9310+
9311+ if test "x$ac_ct_DLLTOOL" = x; then
9312+ DLLTOOL="false"
9313+ else
9314+ case $cross_compiling:$ac_tool_warned in
9315+yes:)
9316+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
9317+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
9318+ac_tool_warned=yes ;;
9319+esac
9320+ DLLTOOL=$ac_ct_DLLTOOL
9321+ fi
9322+else
9323+ DLLTOOL="$ac_cv_prog_DLLTOOL"
9324+fi
9325+
9326+test -z "$DLLTOOL" && DLLTOOL=dlltool
9327+
9328+
9329+
9330+
9331+
9332+
9333+
9334+
9335+
9336+
9337+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
9338+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
9339+if test "${lt_cv_sharedlib_from_linklib_cmd+set}" = set; then :
9340+ $as_echo_n "(cached) " >&6
9341+else
9342+ lt_cv_sharedlib_from_linklib_cmd='unknown'
9343+
9344+case $host_os in
9345+cygwin* | mingw* | pw32* | cegcc*)
9346+ # two different shell functions defined in ltmain.sh
9347+ # decide which to use based on capabilities of $DLLTOOL
9348+ case `$DLLTOOL --help 2>&1` in
9349+ *--identify-strict*)
9350+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
9351+ ;;
9352+ *)
9353+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
9354+ ;;
9355+ esac
9356+ ;;
9357+*)
9358+ # fallback: assume linklib IS sharedlib
9359+ lt_cv_sharedlib_from_linklib_cmd="$ECHO"
9360+ ;;
9361+esac
9362+
9363+fi
9364+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
9365+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
9366+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
9367+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
9368+
9369+
9370+
9371+
9372+
9373+
9374+
9375+if test -n "$ac_tool_prefix"; then
9376+ for ac_prog in ar
9377+ do
9378+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
9379+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
9380 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
9381 $as_echo_n "checking for $ac_word... " >&6; }
9382 if test "${ac_cv_prog_AR+set}" = set; then :
9383@@ -6261,7 +6515,7 @@
9384 test -z "$as_dir" && as_dir=.
9385 for ac_exec_ext in '' $ac_executable_extensions; do
9386 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
9387- ac_cv_prog_AR="${ac_tool_prefix}ar"
9388+ ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
9389 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
9390 break 2
9391 fi
9392@@ -6281,11 +6535,15 @@
9393 fi
9394
9395
9396+ test -n "$AR" && break
9397+ done
9398 fi
9399-if test -z "$ac_cv_prog_AR"; then
9400+if test -z "$AR"; then
9401 ac_ct_AR=$AR
9402- # Extract the first word of "ar", so it can be a program name with args.
9403-set dummy ar; ac_word=$2
9404+ for ac_prog in ar
9405+do
9406+ # Extract the first word of "$ac_prog", so it can be a program name with args.
9407+set dummy $ac_prog; ac_word=$2
9408 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
9409 $as_echo_n "checking for $ac_word... " >&6; }
9410 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
9411@@ -6301,7 +6559,7 @@
9412 test -z "$as_dir" && as_dir=.
9413 for ac_exec_ext in '' $ac_executable_extensions; do
9414 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
9415- ac_cv_prog_ac_ct_AR="ar"
9416+ ac_cv_prog_ac_ct_AR="$ac_prog"
9417 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
9418 break 2
9419 fi
9420@@ -6320,6 +6578,10 @@
9421 $as_echo "no" >&6; }
9422 fi
9423
9424+
9425+ test -n "$ac_ct_AR" && break
9426+done
9427+
9428 if test "x$ac_ct_AR" = x; then
9429 AR="false"
9430 else
9431@@ -6331,12 +6593,11 @@
9432 esac
9433 AR=$ac_ct_AR
9434 fi
9435-else
9436- AR="$ac_cv_prog_AR"
9437 fi
9438
9439-test -z "$AR" && AR=ar
9440-test -z "$AR_FLAGS" && AR_FLAGS=cru
9441+: ${AR=ar}
9442+: ${AR_FLAGS=cru}
9443+
9444
9445
9446
9447@@ -6347,6 +6608,63 @@
9448
9449
9450
9451+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
9452+$as_echo_n "checking for archiver @FILE support... " >&6; }
9453+if test "${lt_cv_ar_at_file+set}" = set; then :
9454+ $as_echo_n "(cached) " >&6
9455+else
9456+ lt_cv_ar_at_file=no
9457+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9458+/* end confdefs.h. */
9459+
9460+int
9461+main ()
9462+{
9463+
9464+ ;
9465+ return 0;
9466+}
9467+_ACEOF
9468+if ac_fn_c_try_compile "$LINENO"; then :
9469+ echo conftest.$ac_objext > conftest.lst
9470+ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
9471+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
9472+ (eval $lt_ar_try) 2>&5
9473+ ac_status=$?
9474+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
9475+ test $ac_status = 0; }
9476+ if test "$ac_status" -eq 0; then
9477+ # Ensure the archiver fails upon bogus file names.
9478+ rm -f conftest.$ac_objext libconftest.a
9479+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
9480+ (eval $lt_ar_try) 2>&5
9481+ ac_status=$?
9482+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
9483+ test $ac_status = 0; }
9484+ if test "$ac_status" -ne 0; then
9485+ lt_cv_ar_at_file=@
9486+ fi
9487+ fi
9488+ rm -f conftest.* libconftest.a
9489+
9490+fi
9491+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
9492+
9493+fi
9494+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
9495+$as_echo "$lt_cv_ar_at_file" >&6; }
9496+
9497+if test "x$lt_cv_ar_at_file" = xno; then
9498+ archiver_list_spec=
9499+else
9500+ archiver_list_spec=$lt_cv_ar_at_file
9501+fi
9502+
9503+
9504+
9505+
9506+
9507+
9508
9509 if test -n "$ac_tool_prefix"; then
9510 # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
9511@@ -6682,8 +7000,8 @@
9512 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
9513
9514 # Transform an extracted symbol line into symbol name and symbol address
9515-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
9516-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
9517+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
9518+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
9519
9520 # Handle CRLF in mingw tool chain
9521 opt_cr=
9522@@ -6719,6 +7037,7 @@
9523 else
9524 lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
9525 fi
9526+ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
9527
9528 # Check to see that the pipe works correctly.
9529 pipe_works=no
9530@@ -6760,6 +7079,18 @@
9531 if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
9532 if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
9533 cat <<_LT_EOF > conftest.$ac_ext
9534+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
9535+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
9536+/* DATA imports from DLLs on WIN32 con't be const, because runtime
9537+ relocations are performed -- see ld's documentation on pseudo-relocs. */
9538+# define LT_DLSYM_CONST
9539+#elif defined(__osf__)
9540+/* This system does not cope well with relocations in const data. */
9541+# define LT_DLSYM_CONST
9542+#else
9543+# define LT_DLSYM_CONST const
9544+#endif
9545+
9546 #ifdef __cplusplus
9547 extern "C" {
9548 #endif
9549@@ -6771,7 +7102,7 @@
9550 cat <<_LT_EOF >> conftest.$ac_ext
9551
9552 /* The mapping between symbol names and symbols. */
9553-const struct {
9554+LT_DLSYM_CONST struct {
9555 const char *name;
9556 void *address;
9557 }
9558@@ -6797,8 +7128,8 @@
9559 _LT_EOF
9560 # Now try linking the two files.
9561 mv conftest.$ac_objext conftstm.$ac_objext
9562- lt_save_LIBS="$LIBS"
9563- lt_save_CFLAGS="$CFLAGS"
9564+ lt_globsym_save_LIBS=$LIBS
9565+ lt_globsym_save_CFLAGS=$CFLAGS
9566 LIBS="conftstm.$ac_objext"
9567 CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
9568 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
9569@@ -6808,8 +7139,8 @@
9570 test $ac_status = 0; } && test -s conftest${ac_exeext}; then
9571 pipe_works=yes
9572 fi
9573- LIBS="$lt_save_LIBS"
9574- CFLAGS="$lt_save_CFLAGS"
9575+ LIBS=$lt_globsym_save_LIBS
9576+ CFLAGS=$lt_globsym_save_CFLAGS
9577 else
9578 echo "cannot find nm_test_func in $nlist" >&5
9579 fi
9580@@ -6846,6 +7177,14 @@
9581 $as_echo "ok" >&6; }
9582 fi
9583
9584+# Response file support.
9585+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
9586+ nm_file_list_spec='@'
9587+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
9588+ nm_file_list_spec='@'
9589+fi
9590+
9591+
9592
9593
9594
9595@@ -6867,6 +7206,47 @@
9596
9597
9598
9599+
9600+
9601+
9602+
9603+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
9604+$as_echo_n "checking for sysroot... " >&6; }
9605+
9606+# Check whether --with-libtool-sysroot was given.
9607+if test "${with_libtool_sysroot+set}" = set; then :
9608+ withval=$with_libtool_sysroot;
9609+else
9610+ with_libtool_sysroot=no
9611+fi
9612+
9613+
9614+lt_sysroot=
9615+case ${with_libtool_sysroot} in #(
9616+ yes)
9617+ if test "$GCC" = yes; then
9618+ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
9619+ fi
9620+ ;; #(
9621+ /*)
9622+ lt_sysroot=`echo "$with_libtool_sysroot" | sed -e "$sed_quote_subst"`
9623+ ;; #(
9624+ no|'')
9625+ ;; #(
9626+ *)
9627+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_libtool_sysroot}" >&5
9628+$as_echo "${with_libtool_sysroot}" >&6; }
9629+ as_fn_error "The sysroot must be an absolute path." "$LINENO" 5
9630+ ;;
9631+esac
9632+
9633+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
9634+$as_echo "${lt_sysroot:-no}" >&6; }
9635+
9636+
9637+
9638+
9639+
9640 # Check whether --enable-libtool-lock was given.
9641 if test "${enable_libtool_lock+set}" = set; then :
9642 enableval=$enable_libtool_lock;
9643@@ -7073,6 +7453,123 @@
9644
9645 need_locks="$enable_libtool_lock"
9646
9647+if test -n "$ac_tool_prefix"; then
9648+ # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
9649+set dummy ${ac_tool_prefix}mt; ac_word=$2
9650+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
9651+$as_echo_n "checking for $ac_word... " >&6; }
9652+if test "${ac_cv_prog_MANIFEST_TOOL+set}" = set; then :
9653+ $as_echo_n "(cached) " >&6
9654+else
9655+ if test -n "$MANIFEST_TOOL"; then
9656+ ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
9657+else
9658+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
9659+for as_dir in $PATH
9660+do
9661+ IFS=$as_save_IFS
9662+ test -z "$as_dir" && as_dir=.
9663+ for ac_exec_ext in '' $ac_executable_extensions; do
9664+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
9665+ ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
9666+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
9667+ break 2
9668+ fi
9669+done
9670+ done
9671+IFS=$as_save_IFS
9672+
9673+fi
9674+fi
9675+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
9676+if test -n "$MANIFEST_TOOL"; then
9677+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
9678+$as_echo "$MANIFEST_TOOL" >&6; }
9679+else
9680+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
9681+$as_echo "no" >&6; }
9682+fi
9683+
9684+
9685+fi
9686+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
9687+ ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
9688+ # Extract the first word of "mt", so it can be a program name with args.
9689+set dummy mt; ac_word=$2
9690+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
9691+$as_echo_n "checking for $ac_word... " >&6; }
9692+if test "${ac_cv_prog_ac_ct_MANIFEST_TOOL+set}" = set; then :
9693+ $as_echo_n "(cached) " >&6
9694+else
9695+ if test -n "$ac_ct_MANIFEST_TOOL"; then
9696+ ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
9697+else
9698+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
9699+for as_dir in $PATH
9700+do
9701+ IFS=$as_save_IFS
9702+ test -z "$as_dir" && as_dir=.
9703+ for ac_exec_ext in '' $ac_executable_extensions; do
9704+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
9705+ ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
9706+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
9707+ break 2
9708+ fi
9709+done
9710+ done
9711+IFS=$as_save_IFS
9712+
9713+fi
9714+fi
9715+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
9716+if test -n "$ac_ct_MANIFEST_TOOL"; then
9717+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
9718+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
9719+else
9720+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
9721+$as_echo "no" >&6; }
9722+fi
9723+
9724+ if test "x$ac_ct_MANIFEST_TOOL" = x; then
9725+ MANIFEST_TOOL=":"
9726+ else
9727+ case $cross_compiling:$ac_tool_warned in
9728+yes:)
9729+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
9730+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
9731+ac_tool_warned=yes ;;
9732+esac
9733+ MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
9734+ fi
9735+else
9736+ MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
9737+fi
9738+
9739+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
9740+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
9741+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
9742+if test "${lt_cv_path_mainfest_tool+set}" = set; then :
9743+ $as_echo_n "(cached) " >&6
9744+else
9745+ lt_cv_path_mainfest_tool=no
9746+ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
9747+ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
9748+ cat conftest.err >&5
9749+ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
9750+ lt_cv_path_mainfest_tool=yes
9751+ fi
9752+ rm -f conftest*
9753+fi
9754+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
9755+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
9756+if test "x$lt_cv_path_mainfest_tool" != xyes; then
9757+ MANIFEST_TOOL=:
9758+fi
9759+
9760+
9761+
9762+
9763+
9764
9765 case $host_os in
9766 rhapsody* | darwin*)
9767@@ -7636,6 +8133,8 @@
9768 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
9769 echo "$AR cru libconftest.a conftest.o" >&5
9770 $AR cru libconftest.a conftest.o 2>&5
9771+ echo "$RANLIB libconftest.a" >&5
9772+ $RANLIB libconftest.a 2>&5
9773 cat > conftest.c << _LT_EOF
9774 int main() { return 0;}
9775 _LT_EOF
9776@@ -7801,7 +8300,8 @@
9777 LIBTOOL_DEPS="$ltmain"
9778
9779 # Always use our own libtool.
9780-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
9781+LIBTOOL='$(SHELL) $(top_builddir)'
9782+LIBTOOL="$LIBTOOL/${host_alias}-libtool"
9783
9784
9785
9786@@ -7890,7 +8390,7 @@
9787 esac
9788
9789 # Global variables:
9790-ofile=libtool
9791+ofile=${host_alias}-libtool
9792 can_build_shared=yes
9793
9794 # All known linkers require a `.a' archive for static linking (except MSVC,
9795@@ -8188,8 +8688,6 @@
9796 lt_prog_compiler_pic=
9797 lt_prog_compiler_static=
9798
9799-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
9800-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
9801
9802 if test "$GCC" = yes; then
9803 lt_prog_compiler_wl='-Wl,'
9804@@ -8355,6 +8853,12 @@
9805 lt_prog_compiler_pic='--shared'
9806 lt_prog_compiler_static='--static'
9807 ;;
9808+ nagfor*)
9809+ # NAG Fortran compiler
9810+ lt_prog_compiler_wl='-Wl,-Wl,,'
9811+ lt_prog_compiler_pic='-PIC'
9812+ lt_prog_compiler_static='-Bstatic'
9813+ ;;
9814 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
9815 # Portland Group compilers (*not* the Pentium gcc compiler,
9816 # which looks to be a dead project)
9817@@ -8417,7 +8921,7 @@
9818 lt_prog_compiler_pic='-KPIC'
9819 lt_prog_compiler_static='-Bstatic'
9820 case $cc_basename in
9821- f77* | f90* | f95*)
9822+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
9823 lt_prog_compiler_wl='-Qoption ld ';;
9824 *)
9825 lt_prog_compiler_wl='-Wl,';;
9826@@ -8474,13 +8978,17 @@
9827 lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
9828 ;;
9829 esac
9830-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
9831-$as_echo "$lt_prog_compiler_pic" >&6; }
9832-
9833-
9834-
9835-
9836
9837+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
9838+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
9839+if test "${lt_cv_prog_compiler_pic+set}" = set; then :
9840+ $as_echo_n "(cached) " >&6
9841+else
9842+ lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
9843+fi
9844+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
9845+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
9846+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
9847
9848 #
9849 # Check to make sure the PIC flag actually works.
9850@@ -8541,6 +9049,11 @@
9851
9852
9853
9854+
9855+
9856+
9857+
9858+
9859 #
9860 # Check to make sure the static flag actually works.
9861 #
9862@@ -8891,7 +9404,8 @@
9863 allow_undefined_flag=unsupported
9864 always_export_symbols=no
9865 enable_shared_with_static_runtimes=yes
9866- export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
9867+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
9868+ exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
9869
9870 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
9871 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
9872@@ -8939,7 +9453,7 @@
9873 if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
9874 && test "$tmp_diet" = no
9875 then
9876- tmp_addflag=
9877+ tmp_addflag=' $pic_flag'
9878 tmp_sharedflag='-shared'
9879 case $cc_basename,$host_cpu in
9880 pgcc*) # Portland Group C compiler
9881@@ -8990,12 +9504,12 @@
9882 whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
9883 hardcode_libdir_flag_spec=
9884 hardcode_libdir_flag_spec_ld='-rpath $libdir'
9885- archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
9886+ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
9887 if test "x$supports_anon_versioning" = xyes; then
9888 archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
9889 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
9890 echo "local: *; };" >> $output_objdir/$libname.ver~
9891- $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
9892+ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
9893 fi
9894 ;;
9895 esac
9896@@ -9009,8 +9523,8 @@
9897 archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
9898 wlarc=
9899 else
9900- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
9901- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
9902+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
9903+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
9904 fi
9905 ;;
9906
9907@@ -9028,8 +9542,8 @@
9908
9909 _LT_EOF
9910 elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
9911- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
9912- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
9913+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
9914+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
9915 else
9916 ld_shlibs=no
9917 fi
9918@@ -9075,8 +9589,8 @@
9919
9920 *)
9921 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
9922- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
9923- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
9924+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
9925+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
9926 else
9927 ld_shlibs=no
9928 fi
9929@@ -9206,7 +9720,13 @@
9930 allow_undefined_flag='-berok'
9931 # Determine the default libpath from the value encoded in an
9932 # empty executable.
9933- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9934+ if test "${lt_cv_aix_libpath+set}" = set; then
9935+ aix_libpath=$lt_cv_aix_libpath
9936+else
9937+ if test "${lt_cv_aix_libpath_+set}" = set; then :
9938+ $as_echo_n "(cached) " >&6
9939+else
9940+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9941 /* end confdefs.h. */
9942
9943 int
9944@@ -9219,22 +9739,29 @@
9945 _ACEOF
9946 if ac_fn_c_try_link "$LINENO"; then :
9947
9948-lt_aix_libpath_sed='
9949- /Import File Strings/,/^$/ {
9950- /^0/ {
9951- s/^0 *\(.*\)$/\1/
9952- p
9953- }
9954- }'
9955-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
9956-# Check for a 64-bit object if we didn't find anything.
9957-if test -z "$aix_libpath"; then
9958- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
9959-fi
9960+ lt_aix_libpath_sed='
9961+ /Import File Strings/,/^$/ {
9962+ /^0/ {
9963+ s/^0 *\([^ ]*\) *$/\1/
9964+ p
9965+ }
9966+ }'
9967+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
9968+ # Check for a 64-bit object if we didn't find anything.
9969+ if test -z "$lt_cv_aix_libpath_"; then
9970+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
9971+ fi
9972 fi
9973 rm -f core conftest.err conftest.$ac_objext \
9974 conftest$ac_exeext conftest.$ac_ext
9975-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
9976+ if test -z "$lt_cv_aix_libpath_"; then
9977+ lt_cv_aix_libpath_="/usr/lib:/lib"
9978+ fi
9979+
9980+fi
9981+
9982+ aix_libpath=$lt_cv_aix_libpath_
9983+fi
9984
9985 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
9986 archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
9987@@ -9246,7 +9773,13 @@
9988 else
9989 # Determine the default libpath from the value encoded in an
9990 # empty executable.
9991- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9992+ if test "${lt_cv_aix_libpath+set}" = set; then
9993+ aix_libpath=$lt_cv_aix_libpath
9994+else
9995+ if test "${lt_cv_aix_libpath_+set}" = set; then :
9996+ $as_echo_n "(cached) " >&6
9997+else
9998+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9999 /* end confdefs.h. */
10000
10001 int
10002@@ -9259,22 +9792,29 @@
10003 _ACEOF
10004 if ac_fn_c_try_link "$LINENO"; then :
10005
10006-lt_aix_libpath_sed='
10007- /Import File Strings/,/^$/ {
10008- /^0/ {
10009- s/^0 *\(.*\)$/\1/
10010- p
10011- }
10012- }'
10013-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
10014-# Check for a 64-bit object if we didn't find anything.
10015-if test -z "$aix_libpath"; then
10016- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
10017-fi
10018+ lt_aix_libpath_sed='
10019+ /Import File Strings/,/^$/ {
10020+ /^0/ {
10021+ s/^0 *\([^ ]*\) *$/\1/
10022+ p
10023+ }
10024+ }'
10025+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
10026+ # Check for a 64-bit object if we didn't find anything.
10027+ if test -z "$lt_cv_aix_libpath_"; then
10028+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
10029+ fi
10030 fi
10031 rm -f core conftest.err conftest.$ac_objext \
10032 conftest$ac_exeext conftest.$ac_ext
10033-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
10034+ if test -z "$lt_cv_aix_libpath_"; then
10035+ lt_cv_aix_libpath_="/usr/lib:/lib"
10036+ fi
10037+
10038+fi
10039+
10040+ aix_libpath=$lt_cv_aix_libpath_
10041+fi
10042
10043 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
10044 # Warning - without using the other run time loading flags,
10045@@ -9319,20 +9859,63 @@
10046 # Microsoft Visual C++.
10047 # hardcode_libdir_flag_spec is actually meaningless, as there is
10048 # no search path for DLLs.
10049- hardcode_libdir_flag_spec=' '
10050- allow_undefined_flag=unsupported
10051- # Tell ltmain to make .lib files, not .a files.
10052- libext=lib
10053- # Tell ltmain to make .dll files, not .so files.
10054- shrext_cmds=".dll"
10055- # FIXME: Setting linknames here is a bad hack.
10056- archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
10057- # The linker will automatically build a .lib file if we build a DLL.
10058- old_archive_from_new_cmds='true'
10059- # FIXME: Should let the user specify the lib program.
10060- old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
10061- fix_srcfile_path='`cygpath -w "$srcfile"`'
10062- enable_shared_with_static_runtimes=yes
10063+ case $cc_basename in
10064+ cl*)
10065+ # Native MSVC
10066+ hardcode_libdir_flag_spec=' '
10067+ allow_undefined_flag=unsupported
10068+ always_export_symbols=yes
10069+ file_list_spec='@'
10070+ # Tell ltmain to make .lib files, not .a files.
10071+ libext=lib
10072+ # Tell ltmain to make .dll files, not .so files.
10073+ shrext_cmds=".dll"
10074+ # FIXME: Setting linknames here is a bad hack.
10075+ archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
10076+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
10077+ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
10078+ else
10079+ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
10080+ fi~
10081+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
10082+ linknames='
10083+ # The linker will not automatically build a static lib if we build a DLL.
10084+ # _LT_TAGVAR(old_archive_from_new_cmds, )='true'
10085+ enable_shared_with_static_runtimes=yes
10086+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
10087+ # Don't use ranlib
10088+ old_postinstall_cmds='chmod 644 $oldlib'
10089+ postlink_cmds='lt_outputfile="@OUTPUT@"~
10090+ lt_tool_outputfile="@TOOL_OUTPUT@"~
10091+ case $lt_outputfile in
10092+ *.exe|*.EXE) ;;
10093+ *)
10094+ lt_outputfile="$lt_outputfile.exe"
10095+ lt_tool_outputfile="$lt_tool_outputfile.exe"
10096+ ;;
10097+ esac~
10098+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
10099+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
10100+ $RM "$lt_outputfile.manifest";
10101+ fi'
10102+ ;;
10103+ *)
10104+ # Assume MSVC wrapper
10105+ hardcode_libdir_flag_spec=' '
10106+ allow_undefined_flag=unsupported
10107+ # Tell ltmain to make .lib files, not .a files.
10108+ libext=lib
10109+ # Tell ltmain to make .dll files, not .so files.
10110+ shrext_cmds=".dll"
10111+ # FIXME: Setting linknames here is a bad hack.
10112+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
10113+ # The linker will automatically build a .lib file if we build a DLL.
10114+ old_archive_from_new_cmds='true'
10115+ # FIXME: Should let the user specify the lib program.
10116+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
10117+ enable_shared_with_static_runtimes=yes
10118+ ;;
10119+ esac
10120 ;;
10121
10122 darwin* | rhapsody*)
10123@@ -9393,7 +9976,7 @@
10124
10125 # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
10126 freebsd* | dragonfly*)
10127- archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
10128+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
10129 hardcode_libdir_flag_spec='-R$libdir'
10130 hardcode_direct=yes
10131 hardcode_shlibpath_var=no
10132@@ -9401,7 +9984,7 @@
10133
10134 hpux9*)
10135 if test "$GCC" = yes; then
10136- archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
10137+ archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
10138 else
10139 archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
10140 fi
10141@@ -9417,7 +10000,7 @@
10142
10143 hpux10*)
10144 if test "$GCC" = yes && test "$with_gnu_ld" = no; then
10145- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
10146+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
10147 else
10148 archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
10149 fi
10150@@ -9441,10 +10024,10 @@
10151 archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
10152 ;;
10153 ia64*)
10154- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
10155+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
10156 ;;
10157 *)
10158- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
10159+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
10160 ;;
10161 esac
10162 else
10163@@ -9523,23 +10106,36 @@
10164
10165 irix5* | irix6* | nonstopux*)
10166 if test "$GCC" = yes; then
10167- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
10168+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
10169 # Try to use the -exported_symbol ld option, if it does not
10170 # work, assume that -exports_file does not work either and
10171 # implicitly export all symbols.
10172- save_LDFLAGS="$LDFLAGS"
10173- LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
10174- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
10175+ # This should be the same for all languages, so no per-tag cache variable.
10176+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
10177+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
10178+if test "${lt_cv_irix_exported_symbol+set}" = set; then :
10179+ $as_echo_n "(cached) " >&6
10180+else
10181+ save_LDFLAGS="$LDFLAGS"
10182+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
10183+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
10184 /* end confdefs.h. */
10185-int foo(void) {}
10186+int foo (void) { return 0; }
10187 _ACEOF
10188 if ac_fn_c_try_link "$LINENO"; then :
10189- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
10190-
10191+ lt_cv_irix_exported_symbol=yes
10192+else
10193+ lt_cv_irix_exported_symbol=no
10194 fi
10195 rm -f core conftest.err conftest.$ac_objext \
10196 conftest$ac_exeext conftest.$ac_ext
10197- LDFLAGS="$save_LDFLAGS"
10198+ LDFLAGS="$save_LDFLAGS"
10199+fi
10200+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
10201+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
10202+ if test "$lt_cv_irix_exported_symbol" = yes; then
10203+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
10204+ fi
10205 else
10206 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
10207 archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
10208@@ -9624,7 +10220,7 @@
10209 osf4* | osf5*) # as osf3* with the addition of -msym flag
10210 if test "$GCC" = yes; then
10211 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
10212- archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
10213+ archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
10214 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
10215 else
10216 allow_undefined_flag=' -expect_unresolved \*'
10217@@ -9643,9 +10239,9 @@
10218 no_undefined_flag=' -z defs'
10219 if test "$GCC" = yes; then
10220 wlarc='${wl}'
10221- archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
10222+ archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
10223 archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
10224- $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
10225+ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
10226 else
10227 case `$CC -V 2>&1` in
10228 *"Compilers 5.0"*)
10229@@ -10221,8 +10817,9 @@
10230 need_version=no
10231 need_lib_prefix=no
10232
10233- case $GCC,$host_os in
10234- yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
10235+ case $GCC,$cc_basename in
10236+ yes,*)
10237+ # gcc
10238 library_names_spec='$libname.dll.a'
10239 # DLL is installed to $(libdir)/../bin by postinstall_cmds
10240 postinstall_cmds='base_file=`basename \${file}`~
10241@@ -10255,13 +10852,71 @@
10242 library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
10243 ;;
10244 esac
10245+ dynamic_linker='Win32 ld.exe'
10246+ ;;
10247+
10248+ *,cl*)
10249+ # Native MSVC
10250+ libname_spec='$name'
10251+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
10252+ library_names_spec='${libname}.dll.lib'
10253+
10254+ case $build_os in
10255+ mingw*)
10256+ sys_lib_search_path_spec=
10257+ lt_save_ifs=$IFS
10258+ IFS=';'
10259+ for lt_path in $LIB
10260+ do
10261+ IFS=$lt_save_ifs
10262+ # Let DOS variable expansion print the short 8.3 style file name.
10263+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
10264+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
10265+ done
10266+ IFS=$lt_save_ifs
10267+ # Convert to MSYS style.
10268+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
10269+ ;;
10270+ cygwin*)
10271+ # Convert to unix form, then to dos form, then back to unix form
10272+ # but this time dos style (no spaces!) so that the unix form looks
10273+ # like /cygdrive/c/PROGRA~1:/cygdr...
10274+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
10275+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
10276+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
10277+ ;;
10278+ *)
10279+ sys_lib_search_path_spec="$LIB"
10280+ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
10281+ # It is most probably a Windows format PATH.
10282+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
10283+ else
10284+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
10285+ fi
10286+ # FIXME: find the short name or the path components, as spaces are
10287+ # common. (e.g. "Program Files" -> "PROGRA~1")
10288+ ;;
10289+ esac
10290+
10291+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
10292+ postinstall_cmds='base_file=`basename \${file}`~
10293+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
10294+ dldir=$destdir/`dirname \$dlpath`~
10295+ test -d \$dldir || mkdir -p \$dldir~
10296+ $install_prog $dir/$dlname \$dldir/$dlname'
10297+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
10298+ dlpath=$dir/\$dldll~
10299+ $RM \$dlpath'
10300+ shlibpath_overrides_runpath=yes
10301+ dynamic_linker='Win32 link.exe'
10302 ;;
10303
10304 *)
10305+ # Assume MSVC wrapper
10306 library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
10307+ dynamic_linker='Win32 ld.exe'
10308 ;;
10309 esac
10310- dynamic_linker='Win32 ld.exe'
10311 # FIXME: first we should search . and the directory the executable is in
10312 shlibpath_var=PATH
10313 ;;
10314@@ -10353,7 +11008,7 @@
10315 soname_spec='${libname}${release}${shared_ext}$major'
10316 shlibpath_var=LIBRARY_PATH
10317 shlibpath_overrides_runpath=yes
10318- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
10319+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
10320 hardcode_into_libs=yes
10321 ;;
10322
10323@@ -11193,10 +11848,10 @@
10324 /* When -fvisbility=hidden is used, assume the code has been annotated
10325 correspondingly for the symbols needed. */
10326 #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
10327-void fnord () __attribute__((visibility("default")));
10328+int fnord () __attribute__((visibility("default")));
10329 #endif
10330
10331-void fnord () { int i=42; }
10332+int fnord () { return 42; }
10333 int main ()
10334 {
10335 void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
10336@@ -11299,10 +11954,10 @@
10337 /* When -fvisbility=hidden is used, assume the code has been annotated
10338 correspondingly for the symbols needed. */
10339 #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
10340-void fnord () __attribute__((visibility("default")));
10341+int fnord () __attribute__((visibility("default")));
10342 #endif
10343
10344-void fnord () { int i=42; }
10345+int fnord () { return 42; }
10346 int main ()
10347 {
10348 void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
10349@@ -12415,7 +13070,7 @@
10350 # since libbfd may not pull in the entirety of libiberty.
10351 x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
10352 if test -n "$x"; then
10353- SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
10354+ SHARED_LIBADD="`pwd`/../libiberty/pic/libiberty.a"
10355 fi
10356
10357 case "${host}" in
10358@@ -13387,13 +14042,20 @@
10359 lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
10360 lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
10361 lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
10362+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
10363+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
10364 reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
10365 reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
10366 OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
10367 deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
10368 file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
10369+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
10370+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
10371+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
10372+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
10373 AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
10374 AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
10375+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
10376 STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
10377 RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
10378 old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
10379@@ -13408,14 +14070,17 @@
10380 lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
10381 lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
10382 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
10383+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
10384+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
10385 objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
10386 MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
10387 lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
10388-lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
10389 lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
10390+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
10391 lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
10392 lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
10393 need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
10394+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
10395 DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
10396 NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
10397 LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
10398@@ -13448,12 +14113,12 @@
10399 hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
10400 inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
10401 link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
10402-fix_srcfile_path='`$ECHO "$fix_srcfile_path" | $SED "$delay_single_quote_subst"`'
10403 always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
10404 export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
10405 exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
10406 include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
10407 prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
10408+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
10409 file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
10410 variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
10411 need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
10412@@ -13508,8 +14173,13 @@
10413 OBJDUMP \
10414 deplibs_check_method \
10415 file_magic_cmd \
10416+file_magic_glob \
10417+want_nocaseglob \
10418+DLLTOOL \
10419+sharedlib_from_linklib_cmd \
10420 AR \
10421 AR_FLAGS \
10422+archiver_list_spec \
10423 STRIP \
10424 RANLIB \
10425 CC \
10426@@ -13519,12 +14189,14 @@
10427 lt_cv_sys_global_symbol_to_cdecl \
10428 lt_cv_sys_global_symbol_to_c_name_address \
10429 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
10430+nm_file_list_spec \
10431 lt_prog_compiler_no_builtin_flag \
10432-lt_prog_compiler_wl \
10433 lt_prog_compiler_pic \
10434+lt_prog_compiler_wl \
10435 lt_prog_compiler_static \
10436 lt_cv_prog_compiler_c_o \
10437 need_locks \
10438+MANIFEST_TOOL \
10439 DSYMUTIL \
10440 NMEDIT \
10441 LIPO \
10442@@ -13540,7 +14212,6 @@
10443 hardcode_libdir_flag_spec \
10444 hardcode_libdir_flag_spec_ld \
10445 hardcode_libdir_separator \
10446-fix_srcfile_path \
10447 exclude_expsyms \
10448 include_expsyms \
10449 file_list_spec \
10450@@ -13576,6 +14247,7 @@
10451 module_expsym_cmds \
10452 export_symbols_cmds \
10453 prelink_cmds \
10454+postlink_cmds \
10455 postinstall_cmds \
10456 postuninstall_cmds \
10457 finish_cmds \
10458@@ -14332,7 +15004,8 @@
10459 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
10460 #
10461 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
10462-# 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
10463+# 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
10464+# Inc.
10465 # Written by Gordon Matzigkeit, 1996
10466 #
10467 # This file is part of GNU Libtool.
10468@@ -14435,19 +15108,42 @@
10469 # turn newlines into spaces.
10470 NL2SP=$lt_lt_NL2SP
10471
10472+# convert \$build file names to \$host format.
10473+to_host_file_cmd=$lt_cv_to_host_file_cmd
10474+
10475+# convert \$build files to toolchain format.
10476+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
10477+
10478 # An object symbol dumper.
10479 OBJDUMP=$lt_OBJDUMP
10480
10481 # Method to check whether dependent libraries are shared objects.
10482 deplibs_check_method=$lt_deplibs_check_method
10483
10484-# Command to use when deplibs_check_method == "file_magic".
10485+# Command to use when deplibs_check_method = "file_magic".
10486 file_magic_cmd=$lt_file_magic_cmd
10487
10488+# How to find potential files when deplibs_check_method = "file_magic".
10489+file_magic_glob=$lt_file_magic_glob
10490+
10491+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
10492+want_nocaseglob=$lt_want_nocaseglob
10493+
10494+# DLL creation program.
10495+DLLTOOL=$lt_DLLTOOL
10496+
10497+# Command to associate shared and link libraries.
10498+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
10499+
10500 # The archiver.
10501 AR=$lt_AR
10502+
10503+# Flags to create an archive.
10504 AR_FLAGS=$lt_AR_FLAGS
10505
10506+# How to feed a file listing to the archiver.
10507+archiver_list_spec=$lt_archiver_list_spec
10508+
10509 # A symbol stripping program.
10510 STRIP=$lt_STRIP
10511
10512@@ -14477,6 +15173,12 @@
10513 # Transform the output of nm in a C name address pair when lib prefix is needed.
10514 global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
10515
10516+# Specify filename containing input files for \$NM.
10517+nm_file_list_spec=$lt_nm_file_list_spec
10518+
10519+# The root where to search for dependent libraries,and in which our libraries should be installed.
10520+lt_sysroot=$lt_sysroot
10521+
10522 # The name of the directory that contains temporary libtool files.
10523 objdir=$objdir
10524
10525@@ -14486,6 +15188,9 @@
10526 # Must we lock files when doing compilation?
10527 need_locks=$lt_need_locks
10528
10529+# Manifest tool.
10530+MANIFEST_TOOL=$lt_MANIFEST_TOOL
10531+
10532 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
10533 DSYMUTIL=$lt_DSYMUTIL
10534
10535@@ -14600,12 +15305,12 @@
10536 # Compiler flag to turn off builtin functions.
10537 no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
10538
10539-# How to pass a linker flag through the compiler.
10540-wl=$lt_lt_prog_compiler_wl
10541-
10542 # Additional compiler flags for building library objects.
10543 pic_flag=$lt_lt_prog_compiler_pic
10544
10545+# How to pass a linker flag through the compiler.
10546+wl=$lt_lt_prog_compiler_wl
10547+
10548 # Compiler flag to prevent dynamic linking.
10549 link_static_flag=$lt_lt_prog_compiler_static
10550
10551@@ -14692,9 +15397,6 @@
10552 # Whether libtool must link a program against all its dependency libraries.
10553 link_all_deplibs=$link_all_deplibs
10554
10555-# Fix the shell variable \$srcfile for the compiler.
10556-fix_srcfile_path=$lt_fix_srcfile_path
10557-
10558 # Set to "yes" if exported symbols are required.
10559 always_export_symbols=$always_export_symbols
10560
10561@@ -14710,6 +15412,9 @@
10562 # Commands necessary for linking programs (against libraries) with templates.
10563 prelink_cmds=$lt_prelink_cmds
10564
10565+# Commands necessary for finishing linking programs.
10566+postlink_cmds=$lt_postlink_cmds
10567+
10568 # Specify filename containing input files.
10569 file_list_spec=$lt_file_list_spec
10570
10571@@ -14742,210 +15447,169 @@
10572 # if finds mixed CR/LF and LF-only lines. Since sed operates in
10573 # text mode, it properly converts lines to CR/LF. This bash problem
10574 # is reportedly fixed, but why not run on old versions too?
10575- sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
10576- || (rm -f "$cfgfile"; exit 1)
10577-
10578- case $xsi_shell in
10579- yes)
10580- cat << \_LT_EOF >> "$cfgfile"
10581-
10582-# func_dirname file append nondir_replacement
10583-# Compute the dirname of FILE. If nonempty, add APPEND to the result,
10584-# otherwise set result to NONDIR_REPLACEMENT.
10585-func_dirname ()
10586-{
10587- case ${1} in
10588- */*) func_dirname_result="${1%/*}${2}" ;;
10589- * ) func_dirname_result="${3}" ;;
10590- esac
10591-}
10592-
10593-# func_basename file
10594-func_basename ()
10595-{
10596- func_basename_result="${1##*/}"
10597-}
10598-
10599-# func_dirname_and_basename file append nondir_replacement
10600-# perform func_basename and func_dirname in a single function
10601-# call:
10602-# dirname: Compute the dirname of FILE. If nonempty,
10603-# add APPEND to the result, otherwise set result
10604-# to NONDIR_REPLACEMENT.
10605-# value returned in "$func_dirname_result"
10606-# basename: Compute filename of FILE.
10607-# value retuned in "$func_basename_result"
10608-# Implementation must be kept synchronized with func_dirname
10609-# and func_basename. For efficiency, we do not delegate to
10610-# those functions but instead duplicate the functionality here.
10611-func_dirname_and_basename ()
10612-{
10613- case ${1} in
10614- */*) func_dirname_result="${1%/*}${2}" ;;
10615- * ) func_dirname_result="${3}" ;;
10616- esac
10617- func_basename_result="${1##*/}"
10618-}
10619-
10620-# func_stripname prefix suffix name
10621-# strip PREFIX and SUFFIX off of NAME.
10622-# PREFIX and SUFFIX must not contain globbing or regex special
10623-# characters, hashes, percent signs, but SUFFIX may contain a leading
10624-# dot (in which case that matches only a dot).
10625-func_stripname ()
10626-{
10627- # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
10628- # positional parameters, so assign one to ordinary parameter first.
10629- func_stripname_result=${3}
10630- func_stripname_result=${func_stripname_result#"${1}"}
10631- func_stripname_result=${func_stripname_result%"${2}"}
10632-}
10633-
10634-# func_opt_split
10635-func_opt_split ()
10636-{
10637- func_opt_split_opt=${1%%=*}
10638- func_opt_split_arg=${1#*=}
10639-}
10640-
10641-# func_lo2o object
10642-func_lo2o ()
10643-{
10644- case ${1} in
10645- *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
10646- *) func_lo2o_result=${1} ;;
10647- esac
10648-}
10649-
10650-# func_xform libobj-or-source
10651-func_xform ()
10652-{
10653- func_xform_result=${1%.*}.lo
10654-}
10655-
10656-# func_arith arithmetic-term...
10657-func_arith ()
10658-{
10659- func_arith_result=$(( $* ))
10660-}
10661-
10662-# func_len string
10663-# STRING may not start with a hyphen.
10664-func_len ()
10665-{
10666- func_len_result=${#1}
10667-}
10668-
10669-_LT_EOF
10670- ;;
10671- *) # Bourne compatible functions.
10672- cat << \_LT_EOF >> "$cfgfile"
10673-
10674-# func_dirname file append nondir_replacement
10675-# Compute the dirname of FILE. If nonempty, add APPEND to the result,
10676-# otherwise set result to NONDIR_REPLACEMENT.
10677-func_dirname ()
10678-{
10679- # Extract subdirectory from the argument.
10680- func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
10681- if test "X$func_dirname_result" = "X${1}"; then
10682- func_dirname_result="${3}"
10683- else
10684- func_dirname_result="$func_dirname_result${2}"
10685- fi
10686-}
10687-
10688-# func_basename file
10689-func_basename ()
10690-{
10691- func_basename_result=`$ECHO "${1}" | $SED "$basename"`
10692-}
10693-
10694-
10695-# func_stripname prefix suffix name
10696-# strip PREFIX and SUFFIX off of NAME.
10697-# PREFIX and SUFFIX must not contain globbing or regex special
10698-# characters, hashes, percent signs, but SUFFIX may contain a leading
10699-# dot (in which case that matches only a dot).
10700-# func_strip_suffix prefix name
10701-func_stripname ()
10702-{
10703- case ${2} in
10704- .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
10705- *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
10706- esac
10707-}
10708-
10709-# sed scripts:
10710-my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
10711-my_sed_long_arg='1s/^-[^=]*=//'
10712-
10713-# func_opt_split
10714-func_opt_split ()
10715-{
10716- func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"`
10717- func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"`
10718-}
10719-
10720-# func_lo2o object
10721-func_lo2o ()
10722-{
10723- func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
10724-}
10725-
10726-# func_xform libobj-or-source
10727-func_xform ()
10728-{
10729- func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
10730-}
10731-
10732-# func_arith arithmetic-term...
10733-func_arith ()
10734-{
10735- func_arith_result=`expr "$@"`
10736-}
10737-
10738-# func_len string
10739-# STRING may not start with a hyphen.
10740-func_len ()
10741-{
10742- func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
10743-}
10744-
10745-_LT_EOF
10746-esac
10747-
10748-case $lt_shell_append in
10749- yes)
10750- cat << \_LT_EOF >> "$cfgfile"
10751-
10752-# func_append var value
10753-# Append VALUE to the end of shell variable VAR.
10754-func_append ()
10755-{
10756- eval "$1+=\$2"
10757-}
10758-_LT_EOF
10759- ;;
10760- *)
10761- cat << \_LT_EOF >> "$cfgfile"
10762-
10763-# func_append var value
10764-# Append VALUE to the end of shell variable VAR.
10765-func_append ()
10766-{
10767- eval "$1=\$$1\$2"
10768-}
10769-
10770-_LT_EOF
10771- ;;
10772- esac
10773+ sed '$q' "$ltmain" >> "$cfgfile" \
10774+ || (rm -f "$cfgfile"; exit 1)
10775
10776+ if test x"$xsi_shell" = xyes; then
10777+ sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
10778+func_dirname ()\
10779+{\
10780+\ case ${1} in\
10781+\ */*) func_dirname_result="${1%/*}${2}" ;;\
10782+\ * ) func_dirname_result="${3}" ;;\
10783+\ esac\
10784+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
10785+ && mv -f "$cfgfile.tmp" "$cfgfile" \
10786+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
10787+test 0 -eq $? || _lt_function_replace_fail=:
10788+
10789+
10790+ sed -e '/^func_basename ()$/,/^} # func_basename /c\
10791+func_basename ()\
10792+{\
10793+\ func_basename_result="${1##*/}"\
10794+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
10795+ && mv -f "$cfgfile.tmp" "$cfgfile" \
10796+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
10797+test 0 -eq $? || _lt_function_replace_fail=:
10798+
10799+
10800+ sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
10801+func_dirname_and_basename ()\
10802+{\
10803+\ case ${1} in\
10804+\ */*) func_dirname_result="${1%/*}${2}" ;;\
10805+\ * ) func_dirname_result="${3}" ;;\
10806+\ esac\
10807+\ func_basename_result="${1##*/}"\
10808+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
10809+ && mv -f "$cfgfile.tmp" "$cfgfile" \
10810+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
10811+test 0 -eq $? || _lt_function_replace_fail=:
10812+
10813+
10814+ sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
10815+func_stripname ()\
10816+{\
10817+\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
10818+\ # positional parameters, so assign one to ordinary parameter first.\
10819+\ func_stripname_result=${3}\
10820+\ func_stripname_result=${func_stripname_result#"${1}"}\
10821+\ func_stripname_result=${func_stripname_result%"${2}"}\
10822+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
10823+ && mv -f "$cfgfile.tmp" "$cfgfile" \
10824+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
10825+test 0 -eq $? || _lt_function_replace_fail=:
10826+
10827+
10828+ sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
10829+func_split_long_opt ()\
10830+{\
10831+\ func_split_long_opt_name=${1%%=*}\
10832+\ func_split_long_opt_arg=${1#*=}\
10833+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
10834+ && mv -f "$cfgfile.tmp" "$cfgfile" \
10835+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
10836+test 0 -eq $? || _lt_function_replace_fail=:
10837+
10838+
10839+ sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
10840+func_split_short_opt ()\
10841+{\
10842+\ func_split_short_opt_arg=${1#??}\
10843+\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
10844+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
10845+ && mv -f "$cfgfile.tmp" "$cfgfile" \
10846+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
10847+test 0 -eq $? || _lt_function_replace_fail=:
10848+
10849+
10850+ sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
10851+func_lo2o ()\
10852+{\
10853+\ case ${1} in\
10854+\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
10855+\ *) func_lo2o_result=${1} ;;\
10856+\ esac\
10857+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
10858+ && mv -f "$cfgfile.tmp" "$cfgfile" \
10859+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
10860+test 0 -eq $? || _lt_function_replace_fail=:
10861+
10862+
10863+ sed -e '/^func_xform ()$/,/^} # func_xform /c\
10864+func_xform ()\
10865+{\
10866+ func_xform_result=${1%.*}.lo\
10867+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
10868+ && mv -f "$cfgfile.tmp" "$cfgfile" \
10869+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
10870+test 0 -eq $? || _lt_function_replace_fail=:
10871+
10872+
10873+ sed -e '/^func_arith ()$/,/^} # func_arith /c\
10874+func_arith ()\
10875+{\
10876+ func_arith_result=$(( $* ))\
10877+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
10878+ && mv -f "$cfgfile.tmp" "$cfgfile" \
10879+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
10880+test 0 -eq $? || _lt_function_replace_fail=:
10881+
10882+
10883+ sed -e '/^func_len ()$/,/^} # func_len /c\
10884+func_len ()\
10885+{\
10886+ func_len_result=${#1}\
10887+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
10888+ && mv -f "$cfgfile.tmp" "$cfgfile" \
10889+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
10890+test 0 -eq $? || _lt_function_replace_fail=:
10891+
10892+fi
10893+
10894+if test x"$lt_shell_append" = xyes; then
10895+ sed -e '/^func_append ()$/,/^} # func_append /c\
10896+func_append ()\
10897+{\
10898+ eval "${1}+=\\${2}"\
10899+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
10900+ && mv -f "$cfgfile.tmp" "$cfgfile" \
10901+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
10902+test 0 -eq $? || _lt_function_replace_fail=:
10903+
10904+
10905+ sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
10906+func_append_quoted ()\
10907+{\
10908+\ func_quote_for_eval "${2}"\
10909+\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
10910+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
10911+ && mv -f "$cfgfile.tmp" "$cfgfile" \
10912+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
10913+test 0 -eq $? || _lt_function_replace_fail=:
10914+
10915+
10916+ # Save a `func_append' function call where possible by direct use of '+='
10917+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
10918+ && mv -f "$cfgfile.tmp" "$cfgfile" \
10919+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
10920+ test 0 -eq $? || _lt_function_replace_fail=:
10921+else
10922+ # Save a `func_append' function call even when '+=' is not available
10923+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
10924+ && mv -f "$cfgfile.tmp" "$cfgfile" \
10925+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
10926+ test 0 -eq $? || _lt_function_replace_fail=:
10927+fi
10928+
10929+if test x"$_lt_function_replace_fail" = x":"; then
10930+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
10931+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
10932+fi
10933
10934- sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
10935- || (rm -f "$cfgfile"; exit 1)
10936
10937- mv -f "$cfgfile" "$ofile" ||
10938+ mv -f "$cfgfile" "$ofile" ||
10939 (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
10940 chmod +x "$ofile"
10941
10942Index: binutils-2.24/binutils/configure
10943===================================================================
10944--- binutils-2.24.orig/binutils/configure 2013-11-04 07:33:37.000000000 -0800
10945+++ binutils-2.24/binutils/configure 2013-12-15 11:10:23.877118697 -0800
10946@@ -655,8 +655,11 @@
10947 LIPO
10948 NMEDIT
10949 DSYMUTIL
10950+MANIFEST_TOOL
10951 RANLIB
10952+ac_ct_AR
10953 AR
10954+DLLTOOL
10955 OBJDUMP
10956 LN_S
10957 NM
10958@@ -769,6 +772,7 @@
10959 with_pic
10960 enable_fast_install
10961 with_gnu_ld
10962+with_libtool_sysroot
10963 enable_libtool_lock
10964 enable_targets
10965 enable_deterministic_archives
10966@@ -1434,6 +1438,8 @@
10967 --with-pic try to use only PIC/non-PIC objects [default=use
10968 both]
10969 --with-gnu-ld assume the C compiler uses GNU ld [default=no]
10970+ --with-libtool-sysroot=DIR Search for dependent libraries within DIR
10971+ (or the compiler's sysroot if not specified).
10972 --with-zlib include zlib support (auto/yes/no) default=auto
10973 --with-gnu-ld assume the C compiler uses GNU ld default=no
10974 --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib
10975@@ -5152,8 +5158,8 @@
10976
10977
10978
10979-macro_version='2.2.7a'
10980-macro_revision='1.3134'
10981+macro_version='2.4'
10982+macro_revision='1.3293'
10983
10984
10985
10986@@ -5193,7 +5199,7 @@
10987 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
10988 $as_echo_n "checking how to print strings... " >&6; }
10989 # Test print first, because it will be a builtin if present.
10990-if test "X`print -r -- -n 2>/dev/null`" = X-n && \
10991+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
10992 test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
10993 ECHO='print -r --'
10994 elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
10995@@ -5879,8 +5885,8 @@
10996 # Try some XSI features
10997 xsi_shell=no
10998 ( _lt_dummy="a/b/c"
10999- test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
11000- = c,a/b,, \
11001+ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
11002+ = c,a/b,b/c, \
11003 && eval 'test $(( 1 + 1 )) -eq 2 \
11004 && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
11005 && xsi_shell=yes
11006@@ -5929,6 +5935,80 @@
11007
11008
11009
11010+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
11011+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
11012+if test "${lt_cv_to_host_file_cmd+set}" = set; then :
11013+ $as_echo_n "(cached) " >&6
11014+else
11015+ case $host in
11016+ *-*-mingw* )
11017+ case $build in
11018+ *-*-mingw* ) # actually msys
11019+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
11020+ ;;
11021+ *-*-cygwin* )
11022+ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
11023+ ;;
11024+ * ) # otherwise, assume *nix
11025+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
11026+ ;;
11027+ esac
11028+ ;;
11029+ *-*-cygwin* )
11030+ case $build in
11031+ *-*-mingw* ) # actually msys
11032+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
11033+ ;;
11034+ *-*-cygwin* )
11035+ lt_cv_to_host_file_cmd=func_convert_file_noop
11036+ ;;
11037+ * ) # otherwise, assume *nix
11038+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
11039+ ;;
11040+ esac
11041+ ;;
11042+ * ) # unhandled hosts (and "normal" native builds)
11043+ lt_cv_to_host_file_cmd=func_convert_file_noop
11044+ ;;
11045+esac
11046+
11047+fi
11048+
11049+to_host_file_cmd=$lt_cv_to_host_file_cmd
11050+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
11051+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
11052+
11053+
11054+
11055+
11056+
11057+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
11058+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
11059+if test "${lt_cv_to_tool_file_cmd+set}" = set; then :
11060+ $as_echo_n "(cached) " >&6
11061+else
11062+ #assume ordinary cross tools, or native build.
11063+lt_cv_to_tool_file_cmd=func_convert_file_noop
11064+case $host in
11065+ *-*-mingw* )
11066+ case $build in
11067+ *-*-mingw* ) # actually msys
11068+ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
11069+ ;;
11070+ esac
11071+ ;;
11072+esac
11073+
11074+fi
11075+
11076+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
11077+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
11078+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
11079+
11080+
11081+
11082+
11083+
11084 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
11085 $as_echo_n "checking for $LD option to reload object files... " >&6; }
11086 if test "${lt_cv_ld_reload_flag+set}" = set; then :
11087@@ -5945,6 +6025,11 @@
11088 esac
11089 reload_cmds='$LD$reload_flag -o $output$reload_objs'
11090 case $host_os in
11091+ cygwin* | mingw* | pw32* | cegcc*)
11092+ if test "$GCC" != yes; then
11093+ reload_cmds=false
11094+ fi
11095+ ;;
11096 darwin*)
11097 if test "$GCC" = yes; then
11098 reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
11099@@ -6113,7 +6198,8 @@
11100 lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
11101 lt_cv_file_magic_cmd='func_win32_libid'
11102 else
11103- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
11104+ # Keep this pattern in sync with the one in func_win32_libid.
11105+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
11106 lt_cv_file_magic_cmd='$OBJDUMP -f'
11107 fi
11108 ;;
11109@@ -6267,6 +6353,21 @@
11110 fi
11111 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
11112 $as_echo "$lt_cv_deplibs_check_method" >&6; }
11113+
11114+file_magic_glob=
11115+want_nocaseglob=no
11116+if test "$build" = "$host"; then
11117+ case $host_os in
11118+ mingw* | pw32*)
11119+ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
11120+ want_nocaseglob=yes
11121+ else
11122+ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
11123+ fi
11124+ ;;
11125+ esac
11126+fi
11127+
11128 file_magic_cmd=$lt_cv_file_magic_cmd
11129 deplibs_check_method=$lt_cv_deplibs_check_method
11130 test -z "$deplibs_check_method" && deplibs_check_method=unknown
11131@@ -6282,9 +6383,162 @@
11132
11133
11134
11135+
11136+
11137+
11138+
11139+
11140+
11141+
11142+
11143+
11144+
11145 if test -n "$ac_tool_prefix"; then
11146- # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
11147-set dummy ${ac_tool_prefix}ar; ac_word=$2
11148+ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
11149+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
11150+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
11151+$as_echo_n "checking for $ac_word... " >&6; }
11152+if test "${ac_cv_prog_DLLTOOL+set}" = set; then :
11153+ $as_echo_n "(cached) " >&6
11154+else
11155+ if test -n "$DLLTOOL"; then
11156+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
11157+else
11158+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
11159+for as_dir in $PATH
11160+do
11161+ IFS=$as_save_IFS
11162+ test -z "$as_dir" && as_dir=.
11163+ for ac_exec_ext in '' $ac_executable_extensions; do
11164+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
11165+ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
11166+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
11167+ break 2
11168+ fi
11169+done
11170+ done
11171+IFS=$as_save_IFS
11172+
11173+fi
11174+fi
11175+DLLTOOL=$ac_cv_prog_DLLTOOL
11176+if test -n "$DLLTOOL"; then
11177+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
11178+$as_echo "$DLLTOOL" >&6; }
11179+else
11180+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
11181+$as_echo "no" >&6; }
11182+fi
11183+
11184+
11185+fi
11186+if test -z "$ac_cv_prog_DLLTOOL"; then
11187+ ac_ct_DLLTOOL=$DLLTOOL
11188+ # Extract the first word of "dlltool", so it can be a program name with args.
11189+set dummy dlltool; ac_word=$2
11190+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
11191+$as_echo_n "checking for $ac_word... " >&6; }
11192+if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then :
11193+ $as_echo_n "(cached) " >&6
11194+else
11195+ if test -n "$ac_ct_DLLTOOL"; then
11196+ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
11197+else
11198+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
11199+for as_dir in $PATH
11200+do
11201+ IFS=$as_save_IFS
11202+ test -z "$as_dir" && as_dir=.
11203+ for ac_exec_ext in '' $ac_executable_extensions; do
11204+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
11205+ ac_cv_prog_ac_ct_DLLTOOL="dlltool"
11206+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
11207+ break 2
11208+ fi
11209+done
11210+ done
11211+IFS=$as_save_IFS
11212+
11213+fi
11214+fi
11215+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
11216+if test -n "$ac_ct_DLLTOOL"; then
11217+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
11218+$as_echo "$ac_ct_DLLTOOL" >&6; }
11219+else
11220+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
11221+$as_echo "no" >&6; }
11222+fi
11223+
11224+ if test "x$ac_ct_DLLTOOL" = x; then
11225+ DLLTOOL="false"
11226+ else
11227+ case $cross_compiling:$ac_tool_warned in
11228+yes:)
11229+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
11230+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
11231+ac_tool_warned=yes ;;
11232+esac
11233+ DLLTOOL=$ac_ct_DLLTOOL
11234+ fi
11235+else
11236+ DLLTOOL="$ac_cv_prog_DLLTOOL"
11237+fi
11238+
11239+test -z "$DLLTOOL" && DLLTOOL=dlltool
11240+
11241+
11242+
11243+
11244+
11245+
11246+
11247+
11248+
11249+
11250+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
11251+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
11252+if test "${lt_cv_sharedlib_from_linklib_cmd+set}" = set; then :
11253+ $as_echo_n "(cached) " >&6
11254+else
11255+ lt_cv_sharedlib_from_linklib_cmd='unknown'
11256+
11257+case $host_os in
11258+cygwin* | mingw* | pw32* | cegcc*)
11259+ # two different shell functions defined in ltmain.sh
11260+ # decide which to use based on capabilities of $DLLTOOL
11261+ case `$DLLTOOL --help 2>&1` in
11262+ *--identify-strict*)
11263+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
11264+ ;;
11265+ *)
11266+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
11267+ ;;
11268+ esac
11269+ ;;
11270+*)
11271+ # fallback: assume linklib IS sharedlib
11272+ lt_cv_sharedlib_from_linklib_cmd="$ECHO"
11273+ ;;
11274+esac
11275+
11276+fi
11277+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
11278+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
11279+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
11280+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
11281+
11282+
11283+
11284+
11285+
11286+
11287+
11288+if test -n "$ac_tool_prefix"; then
11289+ for ac_prog in ar
11290+ do
11291+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
11292+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
11293 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
11294 $as_echo_n "checking for $ac_word... " >&6; }
11295 if test "${ac_cv_prog_AR+set}" = set; then :
11296@@ -6300,7 +6554,7 @@
11297 test -z "$as_dir" && as_dir=.
11298 for ac_exec_ext in '' $ac_executable_extensions; do
11299 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
11300- ac_cv_prog_AR="${ac_tool_prefix}ar"
11301+ ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
11302 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
11303 break 2
11304 fi
11305@@ -6320,11 +6574,15 @@
11306 fi
11307
11308
11309+ test -n "$AR" && break
11310+ done
11311 fi
11312-if test -z "$ac_cv_prog_AR"; then
11313+if test -z "$AR"; then
11314 ac_ct_AR=$AR
11315- # Extract the first word of "ar", so it can be a program name with args.
11316-set dummy ar; ac_word=$2
11317+ for ac_prog in ar
11318+do
11319+ # Extract the first word of "$ac_prog", so it can be a program name with args.
11320+set dummy $ac_prog; ac_word=$2
11321 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
11322 $as_echo_n "checking for $ac_word... " >&6; }
11323 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
11324@@ -6340,7 +6598,7 @@
11325 test -z "$as_dir" && as_dir=.
11326 for ac_exec_ext in '' $ac_executable_extensions; do
11327 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
11328- ac_cv_prog_ac_ct_AR="ar"
11329+ ac_cv_prog_ac_ct_AR="$ac_prog"
11330 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
11331 break 2
11332 fi
11333@@ -6359,6 +6617,10 @@
11334 $as_echo "no" >&6; }
11335 fi
11336
11337+
11338+ test -n "$ac_ct_AR" && break
11339+done
11340+
11341 if test "x$ac_ct_AR" = x; then
11342 AR="false"
11343 else
11344@@ -6370,12 +6632,10 @@
11345 esac
11346 AR=$ac_ct_AR
11347 fi
11348-else
11349- AR="$ac_cv_prog_AR"
11350 fi
11351
11352-test -z "$AR" && AR=ar
11353-test -z "$AR_FLAGS" && AR_FLAGS=cru
11354+: ${AR=ar}
11355+: ${AR_FLAGS=cru}
11356
11357
11358
11359@@ -6387,6 +6647,64 @@
11360
11361
11362
11363+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
11364+$as_echo_n "checking for archiver @FILE support... " >&6; }
11365+if test "${lt_cv_ar_at_file+set}" = set; then :
11366+ $as_echo_n "(cached) " >&6
11367+else
11368+ lt_cv_ar_at_file=no
11369+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
11370+/* end confdefs.h. */
11371+
11372+int
11373+main ()
11374+{
11375+
11376+ ;
11377+ return 0;
11378+}
11379+_ACEOF
11380+if ac_fn_c_try_compile "$LINENO"; then :
11381+ echo conftest.$ac_objext > conftest.lst
11382+ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
11383+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
11384+ (eval $lt_ar_try) 2>&5
11385+ ac_status=$?
11386+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
11387+ test $ac_status = 0; }
11388+ if test "$ac_status" -eq 0; then
11389+ # Ensure the archiver fails upon bogus file names.
11390+ rm -f conftest.$ac_objext libconftest.a
11391+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
11392+ (eval $lt_ar_try) 2>&5
11393+ ac_status=$?
11394+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
11395+ test $ac_status = 0; }
11396+ if test "$ac_status" -ne 0; then
11397+ lt_cv_ar_at_file=@
11398+ fi
11399+ fi
11400+ rm -f conftest.* libconftest.a
11401+
11402+fi
11403+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
11404+
11405+fi
11406+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
11407+$as_echo "$lt_cv_ar_at_file" >&6; }
11408+
11409+if test "x$lt_cv_ar_at_file" = xno; then
11410+ archiver_list_spec=
11411+else
11412+ archiver_list_spec=$lt_cv_ar_at_file
11413+fi
11414+
11415+
11416+
11417+
11418+
11419+
11420+
11421 if test -n "$ac_tool_prefix"; then
11422 # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
11423 set dummy ${ac_tool_prefix}strip; ac_word=$2
11424@@ -6721,8 +7039,8 @@
11425 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
11426
11427 # Transform an extracted symbol line into symbol name and symbol address
11428-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
11429-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
11430+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
11431+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
11432
11433 # Handle CRLF in mingw tool chain
11434 opt_cr=
11435@@ -6758,6 +7076,7 @@
11436 else
11437 lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
11438 fi
11439+ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
11440
11441 # Check to see that the pipe works correctly.
11442 pipe_works=no
11443@@ -6799,6 +7118,18 @@
11444 if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
11445 if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
11446 cat <<_LT_EOF > conftest.$ac_ext
11447+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
11448+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
11449+/* DATA imports from DLLs on WIN32 con't be const, because runtime
11450+ relocations are performed -- see ld's documentation on pseudo-relocs. */
11451+# define LT_DLSYM_CONST
11452+#elif defined(__osf__)
11453+/* This system does not cope well with relocations in const data. */
11454+# define LT_DLSYM_CONST
11455+#else
11456+# define LT_DLSYM_CONST const
11457+#endif
11458+
11459 #ifdef __cplusplus
11460 extern "C" {
11461 #endif
11462@@ -6810,7 +7141,7 @@
11463 cat <<_LT_EOF >> conftest.$ac_ext
11464
11465 /* The mapping between symbol names and symbols. */
11466-const struct {
11467+LT_DLSYM_CONST struct {
11468 const char *name;
11469 void *address;
11470 }
11471@@ -6836,8 +7167,8 @@
11472 _LT_EOF
11473 # Now try linking the two files.
11474 mv conftest.$ac_objext conftstm.$ac_objext
11475- lt_save_LIBS="$LIBS"
11476- lt_save_CFLAGS="$CFLAGS"
11477+ lt_globsym_save_LIBS=$LIBS
11478+ lt_globsym_save_CFLAGS=$CFLAGS
11479 LIBS="conftstm.$ac_objext"
11480 CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
11481 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
11482@@ -6847,8 +7178,8 @@
11483 test $ac_status = 0; } && test -s conftest${ac_exeext}; then
11484 pipe_works=yes
11485 fi
11486- LIBS="$lt_save_LIBS"
11487- CFLAGS="$lt_save_CFLAGS"
11488+ LIBS=$lt_globsym_save_LIBS
11489+ CFLAGS=$lt_globsym_save_CFLAGS
11490 else
11491 echo "cannot find nm_test_func in $nlist" >&5
11492 fi
11493@@ -6885,6 +7216,19 @@
11494 $as_echo "ok" >&6; }
11495 fi
11496
11497+# Response file support.
11498+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
11499+ nm_file_list_spec='@'
11500+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
11501+ nm_file_list_spec='@'
11502+fi
11503+
11504+
11505+
11506+
11507+
11508+
11509+
11510
11511
11512
11513@@ -6905,6 +7249,42 @@
11514
11515
11516
11517+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
11518+$as_echo_n "checking for sysroot... " >&6; }
11519+
11520+# Check whether --with-libtool-sysroot was given.
11521+if test "${with_libtool_sysroot+set}" = set; then :
11522+ withval=$with_libtool_sysroot;
11523+else
11524+ with_libtool_sysroot=no
11525+fi
11526+
11527+
11528+lt_sysroot=
11529+case ${with_libtool_sysroot} in #(
11530+ yes)
11531+ if test "$GCC" = yes; then
11532+ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
11533+ fi
11534+ ;; #(
11535+ /*)
11536+ lt_sysroot=`echo "$with_libtool_sysroot" | sed -e "$sed_quote_subst"`
11537+ ;; #(
11538+ no|'')
11539+ ;; #(
11540+ *)
11541+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_libtool_sysroot}" >&5
11542+$as_echo "${with_libtool_sysroot}" >&6; }
11543+ as_fn_error "The sysroot must be an absolute path." "$LINENO" 5
11544+ ;;
11545+esac
11546+
11547+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
11548+$as_echo "${lt_sysroot:-no}" >&6; }
11549+
11550+
11551+
11552+
11553
11554 # Check whether --enable-libtool-lock was given.
11555 if test "${enable_libtool_lock+set}" = set; then :
11556@@ -7112,6 +7492,123 @@
11557
11558 need_locks="$enable_libtool_lock"
11559
11560+if test -n "$ac_tool_prefix"; then
11561+ # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
11562+set dummy ${ac_tool_prefix}mt; ac_word=$2
11563+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
11564+$as_echo_n "checking for $ac_word... " >&6; }
11565+if test "${ac_cv_prog_MANIFEST_TOOL+set}" = set; then :
11566+ $as_echo_n "(cached) " >&6
11567+else
11568+ if test -n "$MANIFEST_TOOL"; then
11569+ ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
11570+else
11571+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
11572+for as_dir in $PATH
11573+do
11574+ IFS=$as_save_IFS
11575+ test -z "$as_dir" && as_dir=.
11576+ for ac_exec_ext in '' $ac_executable_extensions; do
11577+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
11578+ ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
11579+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
11580+ break 2
11581+ fi
11582+done
11583+ done
11584+IFS=$as_save_IFS
11585+
11586+fi
11587+fi
11588+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
11589+if test -n "$MANIFEST_TOOL"; then
11590+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
11591+$as_echo "$MANIFEST_TOOL" >&6; }
11592+else
11593+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
11594+$as_echo "no" >&6; }
11595+fi
11596+
11597+
11598+fi
11599+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
11600+ ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
11601+ # Extract the first word of "mt", so it can be a program name with args.
11602+set dummy mt; ac_word=$2
11603+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
11604+$as_echo_n "checking for $ac_word... " >&6; }
11605+if test "${ac_cv_prog_ac_ct_MANIFEST_TOOL+set}" = set; then :
11606+ $as_echo_n "(cached) " >&6
11607+else
11608+ if test -n "$ac_ct_MANIFEST_TOOL"; then
11609+ ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
11610+else
11611+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
11612+for as_dir in $PATH
11613+do
11614+ IFS=$as_save_IFS
11615+ test -z "$as_dir" && as_dir=.
11616+ for ac_exec_ext in '' $ac_executable_extensions; do
11617+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
11618+ ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
11619+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
11620+ break 2
11621+ fi
11622+done
11623+ done
11624+IFS=$as_save_IFS
11625+
11626+fi
11627+fi
11628+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
11629+if test -n "$ac_ct_MANIFEST_TOOL"; then
11630+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
11631+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
11632+else
11633+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
11634+$as_echo "no" >&6; }
11635+fi
11636+
11637+ if test "x$ac_ct_MANIFEST_TOOL" = x; then
11638+ MANIFEST_TOOL=":"
11639+ else
11640+ case $cross_compiling:$ac_tool_warned in
11641+yes:)
11642+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
11643+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
11644+ac_tool_warned=yes ;;
11645+esac
11646+ MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
11647+ fi
11648+else
11649+ MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
11650+fi
11651+
11652+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
11653+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
11654+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
11655+if test "${lt_cv_path_mainfest_tool+set}" = set; then :
11656+ $as_echo_n "(cached) " >&6
11657+else
11658+ lt_cv_path_mainfest_tool=no
11659+ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
11660+ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
11661+ cat conftest.err >&5
11662+ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
11663+ lt_cv_path_mainfest_tool=yes
11664+ fi
11665+ rm -f conftest*
11666+fi
11667+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
11668+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
11669+if test "x$lt_cv_path_mainfest_tool" != xyes; then
11670+ MANIFEST_TOOL=:
11671+fi
11672+
11673+
11674+
11675+
11676+
11677
11678 case $host_os in
11679 rhapsody* | darwin*)
11680@@ -7675,6 +8172,8 @@
11681 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
11682 echo "$AR cru libconftest.a conftest.o" >&5
11683 $AR cru libconftest.a conftest.o 2>&5
11684+ echo "$RANLIB libconftest.a" >&5
11685+ $RANLIB libconftest.a 2>&5
11686 cat > conftest.c << _LT_EOF
11687 int main() { return 0;}
11688 _LT_EOF
11689@@ -7870,7 +8369,8 @@
11690 LIBTOOL_DEPS="$ltmain"
11691
11692 # Always use our own libtool.
11693-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
11694+LIBTOOL='$(SHELL) $(top_builddir)'
11695+LIBTOOL="$LIBTOOL/${host_alias}-libtool"
11696
11697
11698
11699@@ -7959,7 +8459,7 @@
11700 esac
11701
11702 # Global variables:
11703-ofile=libtool
11704+ofile=${host_alias}-libtool
11705 can_build_shared=yes
11706
11707 # All known linkers require a `.a' archive for static linking (except MSVC,
11708@@ -8257,8 +8757,6 @@
11709 lt_prog_compiler_pic=
11710 lt_prog_compiler_static=
11711
11712-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
11713-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
11714
11715 if test "$GCC" = yes; then
11716 lt_prog_compiler_wl='-Wl,'
11717@@ -8424,6 +8922,12 @@
11718 lt_prog_compiler_pic='--shared'
11719 lt_prog_compiler_static='--static'
11720 ;;
11721+ nagfor*)
11722+ # NAG Fortran compiler
11723+ lt_prog_compiler_wl='-Wl,-Wl,,'
11724+ lt_prog_compiler_pic='-PIC'
11725+ lt_prog_compiler_static='-Bstatic'
11726+ ;;
11727 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
11728 # Portland Group compilers (*not* the Pentium gcc compiler,
11729 # which looks to be a dead project)
11730@@ -8486,7 +8990,7 @@
11731 lt_prog_compiler_pic='-KPIC'
11732 lt_prog_compiler_static='-Bstatic'
11733 case $cc_basename in
11734- f77* | f90* | f95*)
11735+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
11736 lt_prog_compiler_wl='-Qoption ld ';;
11737 *)
11738 lt_prog_compiler_wl='-Wl,';;
11739@@ -8543,13 +9047,17 @@
11740 lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
11741 ;;
11742 esac
11743-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
11744-$as_echo "$lt_prog_compiler_pic" >&6; }
11745-
11746-
11747-
11748-
11749
11750+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
11751+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
11752+if test "${lt_cv_prog_compiler_pic+set}" = set; then :
11753+ $as_echo_n "(cached) " >&6
11754+else
11755+ lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
11756+fi
11757+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
11758+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
11759+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
11760
11761 #
11762 # Check to make sure the PIC flag actually works.
11763@@ -8610,6 +9118,11 @@
11764
11765
11766
11767+
11768+
11769+
11770+
11771+
11772 #
11773 # Check to make sure the static flag actually works.
11774 #
11775@@ -8960,7 +9473,8 @@
11776 allow_undefined_flag=unsupported
11777 always_export_symbols=no
11778 enable_shared_with_static_runtimes=yes
11779- export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
11780+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
11781+ exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
11782
11783 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
11784 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
11785@@ -9008,7 +9522,7 @@
11786 if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
11787 && test "$tmp_diet" = no
11788 then
11789- tmp_addflag=
11790+ tmp_addflag=' $pic_flag'
11791 tmp_sharedflag='-shared'
11792 case $cc_basename,$host_cpu in
11793 pgcc*) # Portland Group C compiler
11794@@ -9059,12 +9573,12 @@
11795 whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
11796 hardcode_libdir_flag_spec=
11797 hardcode_libdir_flag_spec_ld='-rpath $libdir'
11798- archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
11799+ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
11800 if test "x$supports_anon_versioning" = xyes; then
11801 archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
11802 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
11803 echo "local: *; };" >> $output_objdir/$libname.ver~
11804- $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
11805+ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
11806 fi
11807 ;;
11808 esac
11809@@ -9078,8 +9592,8 @@
11810 archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
11811 wlarc=
11812 else
11813- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
11814- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
11815+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
11816+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
11817 fi
11818 ;;
11819
11820@@ -9097,8 +9611,8 @@
11821
11822 _LT_EOF
11823 elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
11824- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
11825- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
11826+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
11827+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
11828 else
11829 ld_shlibs=no
11830 fi
11831@@ -9144,8 +9658,8 @@
11832
11833 *)
11834 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
11835- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
11836- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
11837+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
11838+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
11839 else
11840 ld_shlibs=no
11841 fi
11842@@ -9275,7 +9789,13 @@
11843 allow_undefined_flag='-berok'
11844 # Determine the default libpath from the value encoded in an
11845 # empty executable.
11846- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
11847+ if test "${lt_cv_aix_libpath+set}" = set; then
11848+ aix_libpath=$lt_cv_aix_libpath
11849+else
11850+ if test "${lt_cv_aix_libpath_+set}" = set; then :
11851+ $as_echo_n "(cached) " >&6
11852+else
11853+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
11854 /* end confdefs.h. */
11855
11856 int
11857@@ -9288,22 +9808,29 @@
11858 _ACEOF
11859 if ac_fn_c_try_link "$LINENO"; then :
11860
11861-lt_aix_libpath_sed='
11862- /Import File Strings/,/^$/ {
11863- /^0/ {
11864- s/^0 *\(.*\)$/\1/
11865- p
11866- }
11867- }'
11868-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
11869-# Check for a 64-bit object if we didn't find anything.
11870-if test -z "$aix_libpath"; then
11871- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
11872-fi
11873+ lt_aix_libpath_sed='
11874+ /Import File Strings/,/^$/ {
11875+ /^0/ {
11876+ s/^0 *\([^ ]*\) *$/\1/
11877+ p
11878+ }
11879+ }'
11880+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
11881+ # Check for a 64-bit object if we didn't find anything.
11882+ if test -z "$lt_cv_aix_libpath_"; then
11883+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
11884+ fi
11885 fi
11886 rm -f core conftest.err conftest.$ac_objext \
11887 conftest$ac_exeext conftest.$ac_ext
11888-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
11889+ if test -z "$lt_cv_aix_libpath_"; then
11890+ lt_cv_aix_libpath_="/usr/lib:/lib"
11891+ fi
11892+
11893+fi
11894+
11895+ aix_libpath=$lt_cv_aix_libpath_
11896+fi
11897
11898 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
11899 archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
11900@@ -9315,7 +9842,13 @@
11901 else
11902 # Determine the default libpath from the value encoded in an
11903 # empty executable.
11904- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
11905+ if test "${lt_cv_aix_libpath+set}" = set; then
11906+ aix_libpath=$lt_cv_aix_libpath
11907+else
11908+ if test "${lt_cv_aix_libpath_+set}" = set; then :
11909+ $as_echo_n "(cached) " >&6
11910+else
11911+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
11912 /* end confdefs.h. */
11913
11914 int
11915@@ -9328,22 +9861,29 @@
11916 _ACEOF
11917 if ac_fn_c_try_link "$LINENO"; then :
11918
11919-lt_aix_libpath_sed='
11920- /Import File Strings/,/^$/ {
11921- /^0/ {
11922- s/^0 *\(.*\)$/\1/
11923- p
11924- }
11925- }'
11926-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
11927-# Check for a 64-bit object if we didn't find anything.
11928-if test -z "$aix_libpath"; then
11929- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
11930-fi
11931+ lt_aix_libpath_sed='
11932+ /Import File Strings/,/^$/ {
11933+ /^0/ {
11934+ s/^0 *\([^ ]*\) *$/\1/
11935+ p
11936+ }
11937+ }'
11938+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
11939+ # Check for a 64-bit object if we didn't find anything.
11940+ if test -z "$lt_cv_aix_libpath_"; then
11941+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
11942+ fi
11943 fi
11944 rm -f core conftest.err conftest.$ac_objext \
11945 conftest$ac_exeext conftest.$ac_ext
11946-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
11947+ if test -z "$lt_cv_aix_libpath_"; then
11948+ lt_cv_aix_libpath_="/usr/lib:/lib"
11949+ fi
11950+
11951+fi
11952+
11953+ aix_libpath=$lt_cv_aix_libpath_
11954+fi
11955
11956 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
11957 # Warning - without using the other run time loading flags,
11958@@ -9388,20 +9928,63 @@
11959 # Microsoft Visual C++.
11960 # hardcode_libdir_flag_spec is actually meaningless, as there is
11961 # no search path for DLLs.
11962- hardcode_libdir_flag_spec=' '
11963- allow_undefined_flag=unsupported
11964- # Tell ltmain to make .lib files, not .a files.
11965- libext=lib
11966- # Tell ltmain to make .dll files, not .so files.
11967- shrext_cmds=".dll"
11968- # FIXME: Setting linknames here is a bad hack.
11969- archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
11970- # The linker will automatically build a .lib file if we build a DLL.
11971- old_archive_from_new_cmds='true'
11972- # FIXME: Should let the user specify the lib program.
11973- old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
11974- fix_srcfile_path='`cygpath -w "$srcfile"`'
11975- enable_shared_with_static_runtimes=yes
11976+ case $cc_basename in
11977+ cl*)
11978+ # Native MSVC
11979+ hardcode_libdir_flag_spec=' '
11980+ allow_undefined_flag=unsupported
11981+ always_export_symbols=yes
11982+ file_list_spec='@'
11983+ # Tell ltmain to make .lib files, not .a files.
11984+ libext=lib
11985+ # Tell ltmain to make .dll files, not .so files.
11986+ shrext_cmds=".dll"
11987+ # FIXME: Setting linknames here is a bad hack.
11988+ archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
11989+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
11990+ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
11991+ else
11992+ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
11993+ fi~
11994+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
11995+ linknames='
11996+ # The linker will not automatically build a static lib if we build a DLL.
11997+ # _LT_TAGVAR(old_archive_from_new_cmds, )='true'
11998+ enable_shared_with_static_runtimes=yes
11999+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
12000+ # Don't use ranlib
12001+ old_postinstall_cmds='chmod 644 $oldlib'
12002+ postlink_cmds='lt_outputfile="@OUTPUT@"~
12003+ lt_tool_outputfile="@TOOL_OUTPUT@"~
12004+ case $lt_outputfile in
12005+ *.exe|*.EXE) ;;
12006+ *)
12007+ lt_outputfile="$lt_outputfile.exe"
12008+ lt_tool_outputfile="$lt_tool_outputfile.exe"
12009+ ;;
12010+ esac~
12011+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
12012+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
12013+ $RM "$lt_outputfile.manifest";
12014+ fi'
12015+ ;;
12016+ *)
12017+ # Assume MSVC wrapper
12018+ hardcode_libdir_flag_spec=' '
12019+ allow_undefined_flag=unsupported
12020+ # Tell ltmain to make .lib files, not .a files.
12021+ libext=lib
12022+ # Tell ltmain to make .dll files, not .so files.
12023+ shrext_cmds=".dll"
12024+ # FIXME: Setting linknames here is a bad hack.
12025+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
12026+ # The linker will automatically build a .lib file if we build a DLL.
12027+ old_archive_from_new_cmds='true'
12028+ # FIXME: Should let the user specify the lib program.
12029+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
12030+ enable_shared_with_static_runtimes=yes
12031+ ;;
12032+ esac
12033 ;;
12034
12035 darwin* | rhapsody*)
12036@@ -9462,7 +10045,7 @@
12037
12038 # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
12039 freebsd* | dragonfly*)
12040- archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
12041+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
12042 hardcode_libdir_flag_spec='-R$libdir'
12043 hardcode_direct=yes
12044 hardcode_shlibpath_var=no
12045@@ -9470,7 +10053,7 @@
12046
12047 hpux9*)
12048 if test "$GCC" = yes; then
12049- archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
12050+ archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
12051 else
12052 archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
12053 fi
12054@@ -9486,7 +10069,7 @@
12055
12056 hpux10*)
12057 if test "$GCC" = yes && test "$with_gnu_ld" = no; then
12058- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
12059+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
12060 else
12061 archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
12062 fi
12063@@ -9510,10 +10093,10 @@
12064 archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
12065 ;;
12066 ia64*)
12067- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
12068+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
12069 ;;
12070 *)
12071- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
12072+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
12073 ;;
12074 esac
12075 else
12076@@ -9592,23 +10175,36 @@
12077
12078 irix5* | irix6* | nonstopux*)
12079 if test "$GCC" = yes; then
12080- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
12081+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
12082 # Try to use the -exported_symbol ld option, if it does not
12083 # work, assume that -exports_file does not work either and
12084 # implicitly export all symbols.
12085- save_LDFLAGS="$LDFLAGS"
12086- LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
12087- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
12088+ # This should be the same for all languages, so no per-tag cache variable.
12089+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
12090+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
12091+if test "${lt_cv_irix_exported_symbol+set}" = set; then :
12092+ $as_echo_n "(cached) " >&6
12093+else
12094+ save_LDFLAGS="$LDFLAGS"
12095+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
12096+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
12097 /* end confdefs.h. */
12098-int foo(void) {}
12099+int foo (void) { return 0; }
12100 _ACEOF
12101 if ac_fn_c_try_link "$LINENO"; then :
12102- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
12103-
12104+ lt_cv_irix_exported_symbol=yes
12105+else
12106+ lt_cv_irix_exported_symbol=no
12107 fi
12108 rm -f core conftest.err conftest.$ac_objext \
12109 conftest$ac_exeext conftest.$ac_ext
12110- LDFLAGS="$save_LDFLAGS"
12111+ LDFLAGS="$save_LDFLAGS"
12112+fi
12113+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
12114+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
12115+ if test "$lt_cv_irix_exported_symbol" = yes; then
12116+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
12117+ fi
12118 else
12119 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
12120 archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
12121@@ -9693,7 +10289,7 @@
12122 osf4* | osf5*) # as osf3* with the addition of -msym flag
12123 if test "$GCC" = yes; then
12124 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
12125- archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
12126+ archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
12127 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
12128 else
12129 allow_undefined_flag=' -expect_unresolved \*'
12130@@ -9712,9 +10308,9 @@
12131 no_undefined_flag=' -z defs'
12132 if test "$GCC" = yes; then
12133 wlarc='${wl}'
12134- archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
12135+ archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
12136 archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
12137- $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
12138+ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
12139 else
12140 case `$CC -V 2>&1` in
12141 *"Compilers 5.0"*)
12142@@ -10290,8 +10886,9 @@
12143 need_version=no
12144 need_lib_prefix=no
12145
12146- case $GCC,$host_os in
12147- yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
12148+ case $GCC,$cc_basename in
12149+ yes,*)
12150+ # gcc
12151 library_names_spec='$libname.dll.a'
12152 # DLL is installed to $(libdir)/../bin by postinstall_cmds
12153 postinstall_cmds='base_file=`basename \${file}`~
12154@@ -10324,13 +10921,71 @@
12155 library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
12156 ;;
12157 esac
12158+ dynamic_linker='Win32 ld.exe'
12159+ ;;
12160+
12161+ *,cl*)
12162+ # Native MSVC
12163+ libname_spec='$name'
12164+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
12165+ library_names_spec='${libname}.dll.lib'
12166+
12167+ case $build_os in
12168+ mingw*)
12169+ sys_lib_search_path_spec=
12170+ lt_save_ifs=$IFS
12171+ IFS=';'
12172+ for lt_path in $LIB
12173+ do
12174+ IFS=$lt_save_ifs
12175+ # Let DOS variable expansion print the short 8.3 style file name.
12176+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
12177+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
12178+ done
12179+ IFS=$lt_save_ifs
12180+ # Convert to MSYS style.
12181+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
12182+ ;;
12183+ cygwin*)
12184+ # Convert to unix form, then to dos form, then back to unix form
12185+ # but this time dos style (no spaces!) so that the unix form looks
12186+ # like /cygdrive/c/PROGRA~1:/cygdr...
12187+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
12188+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
12189+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
12190+ ;;
12191+ *)
12192+ sys_lib_search_path_spec="$LIB"
12193+ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
12194+ # It is most probably a Windows format PATH.
12195+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
12196+ else
12197+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
12198+ fi
12199+ # FIXME: find the short name or the path components, as spaces are
12200+ # common. (e.g. "Program Files" -> "PROGRA~1")
12201+ ;;
12202+ esac
12203+
12204+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
12205+ postinstall_cmds='base_file=`basename \${file}`~
12206+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
12207+ dldir=$destdir/`dirname \$dlpath`~
12208+ test -d \$dldir || mkdir -p \$dldir~
12209+ $install_prog $dir/$dlname \$dldir/$dlname'
12210+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
12211+ dlpath=$dir/\$dldll~
12212+ $RM \$dlpath'
12213+ shlibpath_overrides_runpath=yes
12214+ dynamic_linker='Win32 link.exe'
12215 ;;
12216
12217 *)
12218+ # Assume MSVC wrapper
12219 library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
12220+ dynamic_linker='Win32 ld.exe'
12221 ;;
12222 esac
12223- dynamic_linker='Win32 ld.exe'
12224 # FIXME: first we should search . and the directory the executable is in
12225 shlibpath_var=PATH
12226 ;;
12227@@ -10422,7 +11077,7 @@
12228 soname_spec='${libname}${release}${shared_ext}$major'
12229 shlibpath_var=LIBRARY_PATH
12230 shlibpath_overrides_runpath=yes
12231- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
12232+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
12233 hardcode_into_libs=yes
12234 ;;
12235
12236@@ -11262,10 +11917,10 @@
12237 /* When -fvisbility=hidden is used, assume the code has been annotated
12238 correspondingly for the symbols needed. */
12239 #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
12240-void fnord () __attribute__((visibility("default")));
12241+int fnord () __attribute__((visibility("default")));
12242 #endif
12243
12244-void fnord () { int i=42; }
12245+int fnord () { return 42; }
12246 int main ()
12247 {
12248 void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
12249@@ -11368,10 +12023,10 @@
12250 /* When -fvisbility=hidden is used, assume the code has been annotated
12251 correspondingly for the symbols needed. */
12252 #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
12253-void fnord () __attribute__((visibility("default")));
12254+int fnord () __attribute__((visibility("default")));
12255 #endif
12256
12257-void fnord () { int i=42; }
12258+int fnord () { return 42; }
12259 int main ()
12260 {
12261 void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
12262@@ -14948,13 +15603,20 @@
12263 lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
12264 lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
12265 lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
12266+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
12267+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
12268 reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
12269 reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
12270 OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
12271 deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
12272 file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
12273+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
12274+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
12275+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
12276+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
12277 AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
12278 AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
12279+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
12280 STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
12281 RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
12282 old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
12283@@ -14969,14 +15631,17 @@
12284 lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
12285 lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
12286 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
12287+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
12288+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
12289 objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
12290 MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
12291 lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
12292-lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
12293 lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
12294+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
12295 lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
12296 lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
12297 need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
12298+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
12299 DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
12300 NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
12301 LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
12302@@ -15009,12 +15674,12 @@
12303 hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
12304 inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
12305 link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
12306-fix_srcfile_path='`$ECHO "$fix_srcfile_path" | $SED "$delay_single_quote_subst"`'
12307 always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
12308 export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
12309 exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
12310 include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
12311 prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
12312+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
12313 file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
12314 variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
12315 need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
12316@@ -15069,8 +15734,13 @@
12317 OBJDUMP \
12318 deplibs_check_method \
12319 file_magic_cmd \
12320+file_magic_glob \
12321+want_nocaseglob \
12322+DLLTOOL \
12323+sharedlib_from_linklib_cmd \
12324 AR \
12325 AR_FLAGS \
12326+archiver_list_spec \
12327 STRIP \
12328 RANLIB \
12329 CC \
12330@@ -15080,12 +15750,14 @@
12331 lt_cv_sys_global_symbol_to_cdecl \
12332 lt_cv_sys_global_symbol_to_c_name_address \
12333 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
12334+nm_file_list_spec \
12335 lt_prog_compiler_no_builtin_flag \
12336-lt_prog_compiler_wl \
12337 lt_prog_compiler_pic \
12338+lt_prog_compiler_wl \
12339 lt_prog_compiler_static \
12340 lt_cv_prog_compiler_c_o \
12341 need_locks \
12342+MANIFEST_TOOL \
12343 DSYMUTIL \
12344 NMEDIT \
12345 LIPO \
12346@@ -15101,7 +15773,6 @@
12347 hardcode_libdir_flag_spec \
12348 hardcode_libdir_flag_spec_ld \
12349 hardcode_libdir_separator \
12350-fix_srcfile_path \
12351 exclude_expsyms \
12352 include_expsyms \
12353 file_list_spec \
12354@@ -15137,6 +15808,7 @@
12355 module_expsym_cmds \
12356 export_symbols_cmds \
12357 prelink_cmds \
12358+postlink_cmds \
12359 postinstall_cmds \
12360 postuninstall_cmds \
12361 finish_cmds \
12362@@ -15894,7 +16566,8 @@
12363 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
12364 #
12365 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
12366-# 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
12367+# 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
12368+# Inc.
12369 # Written by Gordon Matzigkeit, 1996
12370 #
12371 # This file is part of GNU Libtool.
12372@@ -15997,19 +16670,42 @@
12373 # turn newlines into spaces.
12374 NL2SP=$lt_lt_NL2SP
12375
12376+# convert \$build file names to \$host format.
12377+to_host_file_cmd=$lt_cv_to_host_file_cmd
12378+
12379+# convert \$build files to toolchain format.
12380+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
12381+
12382 # An object symbol dumper.
12383 OBJDUMP=$lt_OBJDUMP
12384
12385 # Method to check whether dependent libraries are shared objects.
12386 deplibs_check_method=$lt_deplibs_check_method
12387
12388-# Command to use when deplibs_check_method == "file_magic".
12389+# Command to use when deplibs_check_method = "file_magic".
12390 file_magic_cmd=$lt_file_magic_cmd
12391
12392+# How to find potential files when deplibs_check_method = "file_magic".
12393+file_magic_glob=$lt_file_magic_glob
12394+
12395+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
12396+want_nocaseglob=$lt_want_nocaseglob
12397+
12398+# DLL creation program.
12399+DLLTOOL=$lt_DLLTOOL
12400+
12401+# Command to associate shared and link libraries.
12402+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
12403+
12404 # The archiver.
12405 AR=$lt_AR
12406+
12407+# Flags to create an archive.
12408 AR_FLAGS=$lt_AR_FLAGS
12409
12410+# How to feed a file listing to the archiver.
12411+archiver_list_spec=$lt_archiver_list_spec
12412+
12413 # A symbol stripping program.
12414 STRIP=$lt_STRIP
12415
12416@@ -16039,6 +16735,12 @@
12417 # Transform the output of nm in a C name address pair when lib prefix is needed.
12418 global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
12419
12420+# Specify filename containing input files for \$NM.
12421+nm_file_list_spec=$lt_nm_file_list_spec
12422+
12423+# The root where to search for dependent libraries,and in which our libraries should be installed.
12424+lt_sysroot=$lt_sysroot
12425+
12426 # The name of the directory that contains temporary libtool files.
12427 objdir=$objdir
12428
12429@@ -16048,6 +16750,9 @@
12430 # Must we lock files when doing compilation?
12431 need_locks=$lt_need_locks
12432
12433+# Manifest tool.
12434+MANIFEST_TOOL=$lt_MANIFEST_TOOL
12435+
12436 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
12437 DSYMUTIL=$lt_DSYMUTIL
12438
12439@@ -16162,12 +16867,12 @@
12440 # Compiler flag to turn off builtin functions.
12441 no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
12442
12443-# How to pass a linker flag through the compiler.
12444-wl=$lt_lt_prog_compiler_wl
12445-
12446 # Additional compiler flags for building library objects.
12447 pic_flag=$lt_lt_prog_compiler_pic
12448
12449+# How to pass a linker flag through the compiler.
12450+wl=$lt_lt_prog_compiler_wl
12451+
12452 # Compiler flag to prevent dynamic linking.
12453 link_static_flag=$lt_lt_prog_compiler_static
12454
12455@@ -16254,9 +16959,6 @@
12456 # Whether libtool must link a program against all its dependency libraries.
12457 link_all_deplibs=$link_all_deplibs
12458
12459-# Fix the shell variable \$srcfile for the compiler.
12460-fix_srcfile_path=$lt_fix_srcfile_path
12461-
12462 # Set to "yes" if exported symbols are required.
12463 always_export_symbols=$always_export_symbols
12464
12465@@ -16272,6 +16974,9 @@
12466 # Commands necessary for linking programs (against libraries) with templates.
12467 prelink_cmds=$lt_prelink_cmds
12468
12469+# Commands necessary for finishing linking programs.
12470+postlink_cmds=$lt_postlink_cmds
12471+
12472 # Specify filename containing input files.
12473 file_list_spec=$lt_file_list_spec
12474
12475@@ -16304,210 +17009,169 @@
12476 # if finds mixed CR/LF and LF-only lines. Since sed operates in
12477 # text mode, it properly converts lines to CR/LF. This bash problem
12478 # is reportedly fixed, but why not run on old versions too?
12479- sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
12480- || (rm -f "$cfgfile"; exit 1)
12481-
12482- case $xsi_shell in
12483- yes)
12484- cat << \_LT_EOF >> "$cfgfile"
12485-
12486-# func_dirname file append nondir_replacement
12487-# Compute the dirname of FILE. If nonempty, add APPEND to the result,
12488-# otherwise set result to NONDIR_REPLACEMENT.
12489-func_dirname ()
12490-{
12491- case ${1} in
12492- */*) func_dirname_result="${1%/*}${2}" ;;
12493- * ) func_dirname_result="${3}" ;;
12494- esac
12495-}
12496-
12497-# func_basename file
12498-func_basename ()
12499-{
12500- func_basename_result="${1##*/}"
12501-}
12502-
12503-# func_dirname_and_basename file append nondir_replacement
12504-# perform func_basename and func_dirname in a single function
12505-# call:
12506-# dirname: Compute the dirname of FILE. If nonempty,
12507-# add APPEND to the result, otherwise set result
12508-# to NONDIR_REPLACEMENT.
12509-# value returned in "$func_dirname_result"
12510-# basename: Compute filename of FILE.
12511-# value retuned in "$func_basename_result"
12512-# Implementation must be kept synchronized with func_dirname
12513-# and func_basename. For efficiency, we do not delegate to
12514-# those functions but instead duplicate the functionality here.
12515-func_dirname_and_basename ()
12516-{
12517- case ${1} in
12518- */*) func_dirname_result="${1%/*}${2}" ;;
12519- * ) func_dirname_result="${3}" ;;
12520- esac
12521- func_basename_result="${1##*/}"
12522-}
12523-
12524-# func_stripname prefix suffix name
12525-# strip PREFIX and SUFFIX off of NAME.
12526-# PREFIX and SUFFIX must not contain globbing or regex special
12527-# characters, hashes, percent signs, but SUFFIX may contain a leading
12528-# dot (in which case that matches only a dot).
12529-func_stripname ()
12530-{
12531- # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
12532- # positional parameters, so assign one to ordinary parameter first.
12533- func_stripname_result=${3}
12534- func_stripname_result=${func_stripname_result#"${1}"}
12535- func_stripname_result=${func_stripname_result%"${2}"}
12536-}
12537-
12538-# func_opt_split
12539-func_opt_split ()
12540-{
12541- func_opt_split_opt=${1%%=*}
12542- func_opt_split_arg=${1#*=}
12543-}
12544-
12545-# func_lo2o object
12546-func_lo2o ()
12547-{
12548- case ${1} in
12549- *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
12550- *) func_lo2o_result=${1} ;;
12551- esac
12552-}
12553-
12554-# func_xform libobj-or-source
12555-func_xform ()
12556-{
12557- func_xform_result=${1%.*}.lo
12558-}
12559-
12560-# func_arith arithmetic-term...
12561-func_arith ()
12562-{
12563- func_arith_result=$(( $* ))
12564-}
12565-
12566-# func_len string
12567-# STRING may not start with a hyphen.
12568-func_len ()
12569-{
12570- func_len_result=${#1}
12571-}
12572-
12573-_LT_EOF
12574- ;;
12575- *) # Bourne compatible functions.
12576- cat << \_LT_EOF >> "$cfgfile"
12577-
12578-# func_dirname file append nondir_replacement
12579-# Compute the dirname of FILE. If nonempty, add APPEND to the result,
12580-# otherwise set result to NONDIR_REPLACEMENT.
12581-func_dirname ()
12582-{
12583- # Extract subdirectory from the argument.
12584- func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
12585- if test "X$func_dirname_result" = "X${1}"; then
12586- func_dirname_result="${3}"
12587- else
12588- func_dirname_result="$func_dirname_result${2}"
12589- fi
12590-}
12591-
12592-# func_basename file
12593-func_basename ()
12594-{
12595- func_basename_result=`$ECHO "${1}" | $SED "$basename"`
12596-}
12597-
12598-
12599-# func_stripname prefix suffix name
12600-# strip PREFIX and SUFFIX off of NAME.
12601-# PREFIX and SUFFIX must not contain globbing or regex special
12602-# characters, hashes, percent signs, but SUFFIX may contain a leading
12603-# dot (in which case that matches only a dot).
12604-# func_strip_suffix prefix name
12605-func_stripname ()
12606-{
12607- case ${2} in
12608- .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
12609- *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
12610- esac
12611-}
12612-
12613-# sed scripts:
12614-my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
12615-my_sed_long_arg='1s/^-[^=]*=//'
12616-
12617-# func_opt_split
12618-func_opt_split ()
12619-{
12620- func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"`
12621- func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"`
12622-}
12623-
12624-# func_lo2o object
12625-func_lo2o ()
12626-{
12627- func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
12628-}
12629-
12630-# func_xform libobj-or-source
12631-func_xform ()
12632-{
12633- func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
12634-}
12635-
12636-# func_arith arithmetic-term...
12637-func_arith ()
12638-{
12639- func_arith_result=`expr "$@"`
12640-}
12641-
12642-# func_len string
12643-# STRING may not start with a hyphen.
12644-func_len ()
12645-{
12646- func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
12647-}
12648-
12649-_LT_EOF
12650-esac
12651-
12652-case $lt_shell_append in
12653- yes)
12654- cat << \_LT_EOF >> "$cfgfile"
12655-
12656-# func_append var value
12657-# Append VALUE to the end of shell variable VAR.
12658-func_append ()
12659-{
12660- eval "$1+=\$2"
12661-}
12662-_LT_EOF
12663- ;;
12664- *)
12665- cat << \_LT_EOF >> "$cfgfile"
12666-
12667-# func_append var value
12668-# Append VALUE to the end of shell variable VAR.
12669-func_append ()
12670-{
12671- eval "$1=\$$1\$2"
12672-}
12673-
12674-_LT_EOF
12675- ;;
12676- esac
12677+ sed '$q' "$ltmain" >> "$cfgfile" \
12678+ || (rm -f "$cfgfile"; exit 1)
12679
12680+ if test x"$xsi_shell" = xyes; then
12681+ sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
12682+func_dirname ()\
12683+{\
12684+\ case ${1} in\
12685+\ */*) func_dirname_result="${1%/*}${2}" ;;\
12686+\ * ) func_dirname_result="${3}" ;;\
12687+\ esac\
12688+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
12689+ && mv -f "$cfgfile.tmp" "$cfgfile" \
12690+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
12691+test 0 -eq $? || _lt_function_replace_fail=:
12692+
12693+
12694+ sed -e '/^func_basename ()$/,/^} # func_basename /c\
12695+func_basename ()\
12696+{\
12697+\ func_basename_result="${1##*/}"\
12698+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
12699+ && mv -f "$cfgfile.tmp" "$cfgfile" \
12700+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
12701+test 0 -eq $? || _lt_function_replace_fail=:
12702+
12703+
12704+ sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
12705+func_dirname_and_basename ()\
12706+{\
12707+\ case ${1} in\
12708+\ */*) func_dirname_result="${1%/*}${2}" ;;\
12709+\ * ) func_dirname_result="${3}" ;;\
12710+\ esac\
12711+\ func_basename_result="${1##*/}"\
12712+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
12713+ && mv -f "$cfgfile.tmp" "$cfgfile" \
12714+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
12715+test 0 -eq $? || _lt_function_replace_fail=:
12716+
12717+
12718+ sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
12719+func_stripname ()\
12720+{\
12721+\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
12722+\ # positional parameters, so assign one to ordinary parameter first.\
12723+\ func_stripname_result=${3}\
12724+\ func_stripname_result=${func_stripname_result#"${1}"}\
12725+\ func_stripname_result=${func_stripname_result%"${2}"}\
12726+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
12727+ && mv -f "$cfgfile.tmp" "$cfgfile" \
12728+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
12729+test 0 -eq $? || _lt_function_replace_fail=:
12730+
12731+
12732+ sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
12733+func_split_long_opt ()\
12734+{\
12735+\ func_split_long_opt_name=${1%%=*}\
12736+\ func_split_long_opt_arg=${1#*=}\
12737+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
12738+ && mv -f "$cfgfile.tmp" "$cfgfile" \
12739+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
12740+test 0 -eq $? || _lt_function_replace_fail=:
12741+
12742+
12743+ sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
12744+func_split_short_opt ()\
12745+{\
12746+\ func_split_short_opt_arg=${1#??}\
12747+\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
12748+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
12749+ && mv -f "$cfgfile.tmp" "$cfgfile" \
12750+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
12751+test 0 -eq $? || _lt_function_replace_fail=:
12752+
12753+
12754+ sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
12755+func_lo2o ()\
12756+{\
12757+\ case ${1} in\
12758+\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
12759+\ *) func_lo2o_result=${1} ;;\
12760+\ esac\
12761+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
12762+ && mv -f "$cfgfile.tmp" "$cfgfile" \
12763+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
12764+test 0 -eq $? || _lt_function_replace_fail=:
12765+
12766+
12767+ sed -e '/^func_xform ()$/,/^} # func_xform /c\
12768+func_xform ()\
12769+{\
12770+ func_xform_result=${1%.*}.lo\
12771+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
12772+ && mv -f "$cfgfile.tmp" "$cfgfile" \
12773+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
12774+test 0 -eq $? || _lt_function_replace_fail=:
12775+
12776+
12777+ sed -e '/^func_arith ()$/,/^} # func_arith /c\
12778+func_arith ()\
12779+{\
12780+ func_arith_result=$(( $* ))\
12781+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
12782+ && mv -f "$cfgfile.tmp" "$cfgfile" \
12783+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
12784+test 0 -eq $? || _lt_function_replace_fail=:
12785+
12786+
12787+ sed -e '/^func_len ()$/,/^} # func_len /c\
12788+func_len ()\
12789+{\
12790+ func_len_result=${#1}\
12791+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
12792+ && mv -f "$cfgfile.tmp" "$cfgfile" \
12793+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
12794+test 0 -eq $? || _lt_function_replace_fail=:
12795+
12796+fi
12797+
12798+if test x"$lt_shell_append" = xyes; then
12799+ sed -e '/^func_append ()$/,/^} # func_append /c\
12800+func_append ()\
12801+{\
12802+ eval "${1}+=\\${2}"\
12803+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
12804+ && mv -f "$cfgfile.tmp" "$cfgfile" \
12805+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
12806+test 0 -eq $? || _lt_function_replace_fail=:
12807+
12808+
12809+ sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
12810+func_append_quoted ()\
12811+{\
12812+\ func_quote_for_eval "${2}"\
12813+\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
12814+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
12815+ && mv -f "$cfgfile.tmp" "$cfgfile" \
12816+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
12817+test 0 -eq $? || _lt_function_replace_fail=:
12818+
12819+
12820+ # Save a `func_append' function call where possible by direct use of '+='
12821+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
12822+ && mv -f "$cfgfile.tmp" "$cfgfile" \
12823+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
12824+ test 0 -eq $? || _lt_function_replace_fail=:
12825+else
12826+ # Save a `func_append' function call even when '+=' is not available
12827+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
12828+ && mv -f "$cfgfile.tmp" "$cfgfile" \
12829+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
12830+ test 0 -eq $? || _lt_function_replace_fail=:
12831+fi
12832+
12833+if test x"$_lt_function_replace_fail" = x":"; then
12834+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
12835+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
12836+fi
12837
12838- sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
12839- || (rm -f "$cfgfile"; exit 1)
12840
12841- mv -f "$cfgfile" "$ofile" ||
12842+ mv -f "$cfgfile" "$ofile" ||
12843 (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
12844 chmod +x "$ofile"
12845
12846Index: binutils-2.24/gas/configure
12847===================================================================
12848--- binutils-2.24.orig/gas/configure 2013-11-04 07:33:37.000000000 -0800
12849+++ binutils-2.24/gas/configure 2013-12-15 11:10:23.880452030 -0800
12850@@ -645,8 +645,11 @@
12851 LIPO
12852 NMEDIT
12853 DSYMUTIL
12854+MANIFEST_TOOL
12855 RANLIB
12856+ac_ct_AR
12857 AR
12858+DLLTOOL
12859 OBJDUMP
12860 LN_S
12861 NM
12862@@ -759,6 +762,7 @@
12863 with_pic
12864 enable_fast_install
12865 with_gnu_ld
12866+with_libtool_sysroot
12867 enable_libtool_lock
12868 enable_targets
12869 enable_checking
12870@@ -1420,6 +1424,8 @@
12871 --with-pic try to use only PIC/non-PIC objects [default=use
12872 both]
12873 --with-gnu-ld assume the C compiler uses GNU ld [default=no]
12874+ --with-libtool-sysroot=DIR Search for dependent libraries within DIR
12875+ (or the compiler's sysroot if not specified).
12876 --with-zlib include zlib support (auto/yes/no) default=auto
12877
12878 Some influential environment variables:
12879@@ -5135,8 +5141,8 @@
12880
12881
12882
12883-macro_version='2.2.7a'
12884-macro_revision='1.3134'
12885+macro_version='2.4'
12886+macro_revision='1.3293'
12887
12888
12889
12890@@ -5176,7 +5182,7 @@
12891 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
12892 $as_echo_n "checking how to print strings... " >&6; }
12893 # Test print first, because it will be a builtin if present.
12894-if test "X`print -r -- -n 2>/dev/null`" = X-n && \
12895+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
12896 test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
12897 ECHO='print -r --'
12898 elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
12899@@ -5862,8 +5868,8 @@
12900 # Try some XSI features
12901 xsi_shell=no
12902 ( _lt_dummy="a/b/c"
12903- test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
12904- = c,a/b,, \
12905+ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
12906+ = c,a/b,b/c, \
12907 && eval 'test $(( 1 + 1 )) -eq 2 \
12908 && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
12909 && xsi_shell=yes
12910@@ -5912,6 +5918,80 @@
12911
12912
12913
12914+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
12915+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
12916+if test "${lt_cv_to_host_file_cmd+set}" = set; then :
12917+ $as_echo_n "(cached) " >&6
12918+else
12919+ case $host in
12920+ *-*-mingw* )
12921+ case $build in
12922+ *-*-mingw* ) # actually msys
12923+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
12924+ ;;
12925+ *-*-cygwin* )
12926+ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
12927+ ;;
12928+ * ) # otherwise, assume *nix
12929+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
12930+ ;;
12931+ esac
12932+ ;;
12933+ *-*-cygwin* )
12934+ case $build in
12935+ *-*-mingw* ) # actually msys
12936+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
12937+ ;;
12938+ *-*-cygwin* )
12939+ lt_cv_to_host_file_cmd=func_convert_file_noop
12940+ ;;
12941+ * ) # otherwise, assume *nix
12942+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
12943+ ;;
12944+ esac
12945+ ;;
12946+ * ) # unhandled hosts (and "normal" native builds)
12947+ lt_cv_to_host_file_cmd=func_convert_file_noop
12948+ ;;
12949+esac
12950+
12951+fi
12952+
12953+to_host_file_cmd=$lt_cv_to_host_file_cmd
12954+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
12955+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
12956+
12957+
12958+
12959+
12960+
12961+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
12962+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
12963+if test "${lt_cv_to_tool_file_cmd+set}" = set; then :
12964+ $as_echo_n "(cached) " >&6
12965+else
12966+ #assume ordinary cross tools, or native build.
12967+lt_cv_to_tool_file_cmd=func_convert_file_noop
12968+case $host in
12969+ *-*-mingw* )
12970+ case $build in
12971+ *-*-mingw* ) # actually msys
12972+ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
12973+ ;;
12974+ esac
12975+ ;;
12976+esac
12977+
12978+fi
12979+
12980+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
12981+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
12982+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
12983+
12984+
12985+
12986+
12987+
12988 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
12989 $as_echo_n "checking for $LD option to reload object files... " >&6; }
12990 if test "${lt_cv_ld_reload_flag+set}" = set; then :
12991@@ -5928,6 +6008,11 @@
12992 esac
12993 reload_cmds='$LD$reload_flag -o $output$reload_objs'
12994 case $host_os in
12995+ cygwin* | mingw* | pw32* | cegcc*)
12996+ if test "$GCC" != yes; then
12997+ reload_cmds=false
12998+ fi
12999+ ;;
13000 darwin*)
13001 if test "$GCC" = yes; then
13002 reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
13003@@ -6096,7 +6181,8 @@
13004 lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
13005 lt_cv_file_magic_cmd='func_win32_libid'
13006 else
13007- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
13008+ # Keep this pattern in sync with the one in func_win32_libid.
13009+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
13010 lt_cv_file_magic_cmd='$OBJDUMP -f'
13011 fi
13012 ;;
13013@@ -6250,6 +6336,21 @@
13014 fi
13015 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
13016 $as_echo "$lt_cv_deplibs_check_method" >&6; }
13017+
13018+file_magic_glob=
13019+want_nocaseglob=no
13020+if test "$build" = "$host"; then
13021+ case $host_os in
13022+ mingw* | pw32*)
13023+ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
13024+ want_nocaseglob=yes
13025+ else
13026+ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
13027+ fi
13028+ ;;
13029+ esac
13030+fi
13031+
13032 file_magic_cmd=$lt_cv_file_magic_cmd
13033 deplibs_check_method=$lt_cv_deplibs_check_method
13034 test -z "$deplibs_check_method" && deplibs_check_method=unknown
13035@@ -6265,9 +6366,162 @@
13036
13037
13038
13039+
13040+
13041+
13042+
13043+
13044+
13045+
13046+
13047+
13048+
13049+if test -n "$ac_tool_prefix"; then
13050+ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
13051+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
13052+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
13053+$as_echo_n "checking for $ac_word... " >&6; }
13054+if test "${ac_cv_prog_DLLTOOL+set}" = set; then :
13055+ $as_echo_n "(cached) " >&6
13056+else
13057+ if test -n "$DLLTOOL"; then
13058+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
13059+else
13060+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
13061+for as_dir in $PATH
13062+do
13063+ IFS=$as_save_IFS
13064+ test -z "$as_dir" && as_dir=.
13065+ for ac_exec_ext in '' $ac_executable_extensions; do
13066+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
13067+ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
13068+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
13069+ break 2
13070+ fi
13071+done
13072+ done
13073+IFS=$as_save_IFS
13074+
13075+fi
13076+fi
13077+DLLTOOL=$ac_cv_prog_DLLTOOL
13078+if test -n "$DLLTOOL"; then
13079+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
13080+$as_echo "$DLLTOOL" >&6; }
13081+else
13082+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
13083+$as_echo "no" >&6; }
13084+fi
13085+
13086+
13087+fi
13088+if test -z "$ac_cv_prog_DLLTOOL"; then
13089+ ac_ct_DLLTOOL=$DLLTOOL
13090+ # Extract the first word of "dlltool", so it can be a program name with args.
13091+set dummy dlltool; ac_word=$2
13092+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
13093+$as_echo_n "checking for $ac_word... " >&6; }
13094+if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then :
13095+ $as_echo_n "(cached) " >&6
13096+else
13097+ if test -n "$ac_ct_DLLTOOL"; then
13098+ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
13099+else
13100+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
13101+for as_dir in $PATH
13102+do
13103+ IFS=$as_save_IFS
13104+ test -z "$as_dir" && as_dir=.
13105+ for ac_exec_ext in '' $ac_executable_extensions; do
13106+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
13107+ ac_cv_prog_ac_ct_DLLTOOL="dlltool"
13108+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
13109+ break 2
13110+ fi
13111+done
13112+ done
13113+IFS=$as_save_IFS
13114+
13115+fi
13116+fi
13117+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
13118+if test -n "$ac_ct_DLLTOOL"; then
13119+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
13120+$as_echo "$ac_ct_DLLTOOL" >&6; }
13121+else
13122+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
13123+$as_echo "no" >&6; }
13124+fi
13125+
13126+ if test "x$ac_ct_DLLTOOL" = x; then
13127+ DLLTOOL="false"
13128+ else
13129+ case $cross_compiling:$ac_tool_warned in
13130+yes:)
13131+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
13132+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
13133+ac_tool_warned=yes ;;
13134+esac
13135+ DLLTOOL=$ac_ct_DLLTOOL
13136+ fi
13137+else
13138+ DLLTOOL="$ac_cv_prog_DLLTOOL"
13139+fi
13140+
13141+test -z "$DLLTOOL" && DLLTOOL=dlltool
13142+
13143+
13144+
13145+
13146+
13147+
13148+
13149+
13150+
13151+
13152+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
13153+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
13154+if test "${lt_cv_sharedlib_from_linklib_cmd+set}" = set; then :
13155+ $as_echo_n "(cached) " >&6
13156+else
13157+ lt_cv_sharedlib_from_linklib_cmd='unknown'
13158+
13159+case $host_os in
13160+cygwin* | mingw* | pw32* | cegcc*)
13161+ # two different shell functions defined in ltmain.sh
13162+ # decide which to use based on capabilities of $DLLTOOL
13163+ case `$DLLTOOL --help 2>&1` in
13164+ *--identify-strict*)
13165+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
13166+ ;;
13167+ *)
13168+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
13169+ ;;
13170+ esac
13171+ ;;
13172+*)
13173+ # fallback: assume linklib IS sharedlib
13174+ lt_cv_sharedlib_from_linklib_cmd="$ECHO"
13175+ ;;
13176+esac
13177+
13178+fi
13179+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
13180+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
13181+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
13182+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
13183+
13184+
13185+
13186+
13187+
13188+
13189+
13190 if test -n "$ac_tool_prefix"; then
13191- # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
13192-set dummy ${ac_tool_prefix}ar; ac_word=$2
13193+ for ac_prog in ar
13194+ do
13195+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
13196+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
13197 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
13198 $as_echo_n "checking for $ac_word... " >&6; }
13199 if test "${ac_cv_prog_AR+set}" = set; then :
13200@@ -6283,7 +6537,7 @@
13201 test -z "$as_dir" && as_dir=.
13202 for ac_exec_ext in '' $ac_executable_extensions; do
13203 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
13204- ac_cv_prog_AR="${ac_tool_prefix}ar"
13205+ ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
13206 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
13207 break 2
13208 fi
13209@@ -6303,11 +6557,15 @@
13210 fi
13211
13212
13213+ test -n "$AR" && break
13214+ done
13215 fi
13216-if test -z "$ac_cv_prog_AR"; then
13217+if test -z "$AR"; then
13218 ac_ct_AR=$AR
13219- # Extract the first word of "ar", so it can be a program name with args.
13220-set dummy ar; ac_word=$2
13221+ for ac_prog in ar
13222+do
13223+ # Extract the first word of "$ac_prog", so it can be a program name with args.
13224+set dummy $ac_prog; ac_word=$2
13225 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
13226 $as_echo_n "checking for $ac_word... " >&6; }
13227 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
13228@@ -6323,7 +6581,7 @@
13229 test -z "$as_dir" && as_dir=.
13230 for ac_exec_ext in '' $ac_executable_extensions; do
13231 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
13232- ac_cv_prog_ac_ct_AR="ar"
13233+ ac_cv_prog_ac_ct_AR="$ac_prog"
13234 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
13235 break 2
13236 fi
13237@@ -6342,6 +6600,10 @@
13238 $as_echo "no" >&6; }
13239 fi
13240
13241+
13242+ test -n "$ac_ct_AR" && break
13243+done
13244+
13245 if test "x$ac_ct_AR" = x; then
13246 AR="false"
13247 else
13248@@ -6353,16 +6615,72 @@
13249 esac
13250 AR=$ac_ct_AR
13251 fi
13252-else
13253- AR="$ac_cv_prog_AR"
13254 fi
13255
13256-test -z "$AR" && AR=ar
13257-test -z "$AR_FLAGS" && AR_FLAGS=cru
13258+: ${AR=ar}
13259+: ${AR_FLAGS=cru}
13260+
13261+
13262+
13263+
13264+
13265+
13266+
13267+
13268+
13269+
13270+
13271+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
13272+$as_echo_n "checking for archiver @FILE support... " >&6; }
13273+if test "${lt_cv_ar_at_file+set}" = set; then :
13274+ $as_echo_n "(cached) " >&6
13275+else
13276+ lt_cv_ar_at_file=no
13277+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13278+/* end confdefs.h. */
13279+
13280+int
13281+main ()
13282+{
13283
13284+ ;
13285+ return 0;
13286+}
13287+_ACEOF
13288+if ac_fn_c_try_compile "$LINENO"; then :
13289+ echo conftest.$ac_objext > conftest.lst
13290+ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
13291+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
13292+ (eval $lt_ar_try) 2>&5
13293+ ac_status=$?
13294+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
13295+ test $ac_status = 0; }
13296+ if test "$ac_status" -eq 0; then
13297+ # Ensure the archiver fails upon bogus file names.
13298+ rm -f conftest.$ac_objext libconftest.a
13299+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
13300+ (eval $lt_ar_try) 2>&5
13301+ ac_status=$?
13302+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
13303+ test $ac_status = 0; }
13304+ if test "$ac_status" -ne 0; then
13305+ lt_cv_ar_at_file=@
13306+ fi
13307+ fi
13308+ rm -f conftest.* libconftest.a
13309
13310+fi
13311+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13312
13313+fi
13314+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
13315+$as_echo "$lt_cv_ar_at_file" >&6; }
13316
13317+if test "x$lt_cv_ar_at_file" = xno; then
13318+ archiver_list_spec=
13319+else
13320+ archiver_list_spec=$lt_cv_ar_at_file
13321+fi
13322
13323
13324
13325@@ -6704,8 +7022,8 @@
13326 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
13327
13328 # Transform an extracted symbol line into symbol name and symbol address
13329-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
13330-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
13331+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
13332+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
13333
13334 # Handle CRLF in mingw tool chain
13335 opt_cr=
13336@@ -6741,6 +7059,7 @@
13337 else
13338 lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
13339 fi
13340+ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
13341
13342 # Check to see that the pipe works correctly.
13343 pipe_works=no
13344@@ -6782,6 +7101,18 @@
13345 if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
13346 if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
13347 cat <<_LT_EOF > conftest.$ac_ext
13348+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
13349+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
13350+/* DATA imports from DLLs on WIN32 con't be const, because runtime
13351+ relocations are performed -- see ld's documentation on pseudo-relocs. */
13352+# define LT_DLSYM_CONST
13353+#elif defined(__osf__)
13354+/* This system does not cope well with relocations in const data. */
13355+# define LT_DLSYM_CONST
13356+#else
13357+# define LT_DLSYM_CONST const
13358+#endif
13359+
13360 #ifdef __cplusplus
13361 extern "C" {
13362 #endif
13363@@ -6793,7 +7124,7 @@
13364 cat <<_LT_EOF >> conftest.$ac_ext
13365
13366 /* The mapping between symbol names and symbols. */
13367-const struct {
13368+LT_DLSYM_CONST struct {
13369 const char *name;
13370 void *address;
13371 }
13372@@ -6819,8 +7150,8 @@
13373 _LT_EOF
13374 # Now try linking the two files.
13375 mv conftest.$ac_objext conftstm.$ac_objext
13376- lt_save_LIBS="$LIBS"
13377- lt_save_CFLAGS="$CFLAGS"
13378+ lt_globsym_save_LIBS=$LIBS
13379+ lt_globsym_save_CFLAGS=$CFLAGS
13380 LIBS="conftstm.$ac_objext"
13381 CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
13382 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
13383@@ -6830,8 +7161,8 @@
13384 test $ac_status = 0; } && test -s conftest${ac_exeext}; then
13385 pipe_works=yes
13386 fi
13387- LIBS="$lt_save_LIBS"
13388- CFLAGS="$lt_save_CFLAGS"
13389+ LIBS=$lt_globsym_save_LIBS
13390+ CFLAGS=$lt_globsym_save_CFLAGS
13391 else
13392 echo "cannot find nm_test_func in $nlist" >&5
13393 fi
13394@@ -6868,6 +7199,19 @@
13395 $as_echo "ok" >&6; }
13396 fi
13397
13398+# Response file support.
13399+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
13400+ nm_file_list_spec='@'
13401+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
13402+ nm_file_list_spec='@'
13403+fi
13404+
13405+
13406+
13407+
13408+
13409+
13410+
13411
13412
13413
13414@@ -6888,6 +7232,42 @@
13415
13416
13417
13418+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
13419+$as_echo_n "checking for sysroot... " >&6; }
13420+
13421+# Check whether --with-libtool-sysroot was given.
13422+if test "${with_libtool_sysroot+set}" = set; then :
13423+ withval=$with_libtool_sysroot;
13424+else
13425+ with_libtool_sysroot=no
13426+fi
13427+
13428+
13429+lt_sysroot=
13430+case ${with_libtool_sysroot} in #(
13431+ yes)
13432+ if test "$GCC" = yes; then
13433+ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
13434+ fi
13435+ ;; #(
13436+ /*)
13437+ lt_sysroot=`echo "$with_libtool_sysroot" | sed -e "$sed_quote_subst"`
13438+ ;; #(
13439+ no|'')
13440+ ;; #(
13441+ *)
13442+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_libtool_sysroot}" >&5
13443+$as_echo "${with_libtool_sysroot}" >&6; }
13444+ as_fn_error "The sysroot must be an absolute path." "$LINENO" 5
13445+ ;;
13446+esac
13447+
13448+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
13449+$as_echo "${lt_sysroot:-no}" >&6; }
13450+
13451+
13452+
13453+
13454
13455 # Check whether --enable-libtool-lock was given.
13456 if test "${enable_libtool_lock+set}" = set; then :
13457@@ -7095,6 +7475,123 @@
13458
13459 need_locks="$enable_libtool_lock"
13460
13461+if test -n "$ac_tool_prefix"; then
13462+ # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
13463+set dummy ${ac_tool_prefix}mt; ac_word=$2
13464+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
13465+$as_echo_n "checking for $ac_word... " >&6; }
13466+if test "${ac_cv_prog_MANIFEST_TOOL+set}" = set; then :
13467+ $as_echo_n "(cached) " >&6
13468+else
13469+ if test -n "$MANIFEST_TOOL"; then
13470+ ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
13471+else
13472+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
13473+for as_dir in $PATH
13474+do
13475+ IFS=$as_save_IFS
13476+ test -z "$as_dir" && as_dir=.
13477+ for ac_exec_ext in '' $ac_executable_extensions; do
13478+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
13479+ ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
13480+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
13481+ break 2
13482+ fi
13483+done
13484+ done
13485+IFS=$as_save_IFS
13486+
13487+fi
13488+fi
13489+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
13490+if test -n "$MANIFEST_TOOL"; then
13491+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
13492+$as_echo "$MANIFEST_TOOL" >&6; }
13493+else
13494+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
13495+$as_echo "no" >&6; }
13496+fi
13497+
13498+
13499+fi
13500+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
13501+ ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
13502+ # Extract the first word of "mt", so it can be a program name with args.
13503+set dummy mt; ac_word=$2
13504+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
13505+$as_echo_n "checking for $ac_word... " >&6; }
13506+if test "${ac_cv_prog_ac_ct_MANIFEST_TOOL+set}" = set; then :
13507+ $as_echo_n "(cached) " >&6
13508+else
13509+ if test -n "$ac_ct_MANIFEST_TOOL"; then
13510+ ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
13511+else
13512+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
13513+for as_dir in $PATH
13514+do
13515+ IFS=$as_save_IFS
13516+ test -z "$as_dir" && as_dir=.
13517+ for ac_exec_ext in '' $ac_executable_extensions; do
13518+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
13519+ ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
13520+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
13521+ break 2
13522+ fi
13523+done
13524+ done
13525+IFS=$as_save_IFS
13526+
13527+fi
13528+fi
13529+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
13530+if test -n "$ac_ct_MANIFEST_TOOL"; then
13531+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
13532+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
13533+else
13534+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
13535+$as_echo "no" >&6; }
13536+fi
13537+
13538+ if test "x$ac_ct_MANIFEST_TOOL" = x; then
13539+ MANIFEST_TOOL=":"
13540+ else
13541+ case $cross_compiling:$ac_tool_warned in
13542+yes:)
13543+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
13544+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
13545+ac_tool_warned=yes ;;
13546+esac
13547+ MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
13548+ fi
13549+else
13550+ MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
13551+fi
13552+
13553+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
13554+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
13555+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
13556+if test "${lt_cv_path_mainfest_tool+set}" = set; then :
13557+ $as_echo_n "(cached) " >&6
13558+else
13559+ lt_cv_path_mainfest_tool=no
13560+ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
13561+ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
13562+ cat conftest.err >&5
13563+ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
13564+ lt_cv_path_mainfest_tool=yes
13565+ fi
13566+ rm -f conftest*
13567+fi
13568+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
13569+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
13570+if test "x$lt_cv_path_mainfest_tool" != xyes; then
13571+ MANIFEST_TOOL=:
13572+fi
13573+
13574+
13575+
13576+
13577+
13578
13579 case $host_os in
13580 rhapsody* | darwin*)
13581@@ -7658,6 +8155,8 @@
13582 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
13583 echo "$AR cru libconftest.a conftest.o" >&5
13584 $AR cru libconftest.a conftest.o 2>&5
13585+ echo "$RANLIB libconftest.a" >&5
13586+ $RANLIB libconftest.a 2>&5
13587 cat > conftest.c << _LT_EOF
13588 int main() { return 0;}
13589 _LT_EOF
13590@@ -7853,7 +8352,8 @@
13591 LIBTOOL_DEPS="$ltmain"
13592
13593 # Always use our own libtool.
13594-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
13595+LIBTOOL='$(SHELL) $(top_builddir)'
13596+LIBTOOL="$LIBTOOL/${host_alias}-libtool"
13597
13598
13599
13600@@ -7942,7 +8442,7 @@
13601 esac
13602
13603 # Global variables:
13604-ofile=libtool
13605+ofile=${host_alias}-libtool
13606 can_build_shared=yes
13607
13608 # All known linkers require a `.a' archive for static linking (except MSVC,
13609@@ -8240,8 +8740,6 @@
13610 lt_prog_compiler_pic=
13611 lt_prog_compiler_static=
13612
13613-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
13614-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
13615
13616 if test "$GCC" = yes; then
13617 lt_prog_compiler_wl='-Wl,'
13618@@ -8407,6 +8905,12 @@
13619 lt_prog_compiler_pic='--shared'
13620 lt_prog_compiler_static='--static'
13621 ;;
13622+ nagfor*)
13623+ # NAG Fortran compiler
13624+ lt_prog_compiler_wl='-Wl,-Wl,,'
13625+ lt_prog_compiler_pic='-PIC'
13626+ lt_prog_compiler_static='-Bstatic'
13627+ ;;
13628 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
13629 # Portland Group compilers (*not* the Pentium gcc compiler,
13630 # which looks to be a dead project)
13631@@ -8469,7 +8973,7 @@
13632 lt_prog_compiler_pic='-KPIC'
13633 lt_prog_compiler_static='-Bstatic'
13634 case $cc_basename in
13635- f77* | f90* | f95*)
13636+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
13637 lt_prog_compiler_wl='-Qoption ld ';;
13638 *)
13639 lt_prog_compiler_wl='-Wl,';;
13640@@ -8526,13 +9030,17 @@
13641 lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
13642 ;;
13643 esac
13644-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
13645-$as_echo "$lt_prog_compiler_pic" >&6; }
13646-
13647-
13648-
13649-
13650
13651+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
13652+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
13653+if test "${lt_cv_prog_compiler_pic+set}" = set; then :
13654+ $as_echo_n "(cached) " >&6
13655+else
13656+ lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
13657+fi
13658+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
13659+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
13660+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
13661
13662 #
13663 # Check to make sure the PIC flag actually works.
13664@@ -8593,6 +9101,11 @@
13665
13666
13667
13668+
13669+
13670+
13671+
13672+
13673 #
13674 # Check to make sure the static flag actually works.
13675 #
13676@@ -8943,7 +9456,8 @@
13677 allow_undefined_flag=unsupported
13678 always_export_symbols=no
13679 enable_shared_with_static_runtimes=yes
13680- export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
13681+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
13682+ exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
13683
13684 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
13685 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
13686@@ -8991,7 +9505,7 @@
13687 if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
13688 && test "$tmp_diet" = no
13689 then
13690- tmp_addflag=
13691+ tmp_addflag=' $pic_flag'
13692 tmp_sharedflag='-shared'
13693 case $cc_basename,$host_cpu in
13694 pgcc*) # Portland Group C compiler
13695@@ -9042,12 +9556,12 @@
13696 whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
13697 hardcode_libdir_flag_spec=
13698 hardcode_libdir_flag_spec_ld='-rpath $libdir'
13699- archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
13700+ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
13701 if test "x$supports_anon_versioning" = xyes; then
13702 archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
13703 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
13704 echo "local: *; };" >> $output_objdir/$libname.ver~
13705- $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
13706+ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
13707 fi
13708 ;;
13709 esac
13710@@ -9061,8 +9575,8 @@
13711 archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
13712 wlarc=
13713 else
13714- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
13715- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
13716+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
13717+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
13718 fi
13719 ;;
13720
13721@@ -9080,8 +9594,8 @@
13722
13723 _LT_EOF
13724 elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
13725- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
13726- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
13727+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
13728+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
13729 else
13730 ld_shlibs=no
13731 fi
13732@@ -9127,8 +9641,8 @@
13733
13734 *)
13735 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
13736- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
13737- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
13738+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
13739+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
13740 else
13741 ld_shlibs=no
13742 fi
13743@@ -9258,7 +9772,13 @@
13744 allow_undefined_flag='-berok'
13745 # Determine the default libpath from the value encoded in an
13746 # empty executable.
13747- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13748+ if test "${lt_cv_aix_libpath+set}" = set; then
13749+ aix_libpath=$lt_cv_aix_libpath
13750+else
13751+ if test "${lt_cv_aix_libpath_+set}" = set; then :
13752+ $as_echo_n "(cached) " >&6
13753+else
13754+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13755 /* end confdefs.h. */
13756
13757 int
13758@@ -9271,22 +9791,29 @@
13759 _ACEOF
13760 if ac_fn_c_try_link "$LINENO"; then :
13761
13762-lt_aix_libpath_sed='
13763- /Import File Strings/,/^$/ {
13764- /^0/ {
13765- s/^0 *\(.*\)$/\1/
13766- p
13767- }
13768- }'
13769-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
13770-# Check for a 64-bit object if we didn't find anything.
13771-if test -z "$aix_libpath"; then
13772- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
13773-fi
13774+ lt_aix_libpath_sed='
13775+ /Import File Strings/,/^$/ {
13776+ /^0/ {
13777+ s/^0 *\([^ ]*\) *$/\1/
13778+ p
13779+ }
13780+ }'
13781+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
13782+ # Check for a 64-bit object if we didn't find anything.
13783+ if test -z "$lt_cv_aix_libpath_"; then
13784+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
13785+ fi
13786 fi
13787 rm -f core conftest.err conftest.$ac_objext \
13788 conftest$ac_exeext conftest.$ac_ext
13789-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
13790+ if test -z "$lt_cv_aix_libpath_"; then
13791+ lt_cv_aix_libpath_="/usr/lib:/lib"
13792+ fi
13793+
13794+fi
13795+
13796+ aix_libpath=$lt_cv_aix_libpath_
13797+fi
13798
13799 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
13800 archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
13801@@ -9298,7 +9825,13 @@
13802 else
13803 # Determine the default libpath from the value encoded in an
13804 # empty executable.
13805- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13806+ if test "${lt_cv_aix_libpath+set}" = set; then
13807+ aix_libpath=$lt_cv_aix_libpath
13808+else
13809+ if test "${lt_cv_aix_libpath_+set}" = set; then :
13810+ $as_echo_n "(cached) " >&6
13811+else
13812+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13813 /* end confdefs.h. */
13814
13815 int
13816@@ -9311,22 +9844,29 @@
13817 _ACEOF
13818 if ac_fn_c_try_link "$LINENO"; then :
13819
13820-lt_aix_libpath_sed='
13821- /Import File Strings/,/^$/ {
13822- /^0/ {
13823- s/^0 *\(.*\)$/\1/
13824- p
13825- }
13826- }'
13827-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
13828-# Check for a 64-bit object if we didn't find anything.
13829-if test -z "$aix_libpath"; then
13830- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
13831-fi
13832+ lt_aix_libpath_sed='
13833+ /Import File Strings/,/^$/ {
13834+ /^0/ {
13835+ s/^0 *\([^ ]*\) *$/\1/
13836+ p
13837+ }
13838+ }'
13839+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
13840+ # Check for a 64-bit object if we didn't find anything.
13841+ if test -z "$lt_cv_aix_libpath_"; then
13842+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
13843+ fi
13844 fi
13845 rm -f core conftest.err conftest.$ac_objext \
13846 conftest$ac_exeext conftest.$ac_ext
13847-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
13848+ if test -z "$lt_cv_aix_libpath_"; then
13849+ lt_cv_aix_libpath_="/usr/lib:/lib"
13850+ fi
13851+
13852+fi
13853+
13854+ aix_libpath=$lt_cv_aix_libpath_
13855+fi
13856
13857 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
13858 # Warning - without using the other run time loading flags,
13859@@ -9371,20 +9911,63 @@
13860 # Microsoft Visual C++.
13861 # hardcode_libdir_flag_spec is actually meaningless, as there is
13862 # no search path for DLLs.
13863- hardcode_libdir_flag_spec=' '
13864- allow_undefined_flag=unsupported
13865- # Tell ltmain to make .lib files, not .a files.
13866- libext=lib
13867- # Tell ltmain to make .dll files, not .so files.
13868- shrext_cmds=".dll"
13869- # FIXME: Setting linknames here is a bad hack.
13870- archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
13871- # The linker will automatically build a .lib file if we build a DLL.
13872- old_archive_from_new_cmds='true'
13873- # FIXME: Should let the user specify the lib program.
13874- old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
13875- fix_srcfile_path='`cygpath -w "$srcfile"`'
13876- enable_shared_with_static_runtimes=yes
13877+ case $cc_basename in
13878+ cl*)
13879+ # Native MSVC
13880+ hardcode_libdir_flag_spec=' '
13881+ allow_undefined_flag=unsupported
13882+ always_export_symbols=yes
13883+ file_list_spec='@'
13884+ # Tell ltmain to make .lib files, not .a files.
13885+ libext=lib
13886+ # Tell ltmain to make .dll files, not .so files.
13887+ shrext_cmds=".dll"
13888+ # FIXME: Setting linknames here is a bad hack.
13889+ archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
13890+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
13891+ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
13892+ else
13893+ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
13894+ fi~
13895+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
13896+ linknames='
13897+ # The linker will not automatically build a static lib if we build a DLL.
13898+ # _LT_TAGVAR(old_archive_from_new_cmds, )='true'
13899+ enable_shared_with_static_runtimes=yes
13900+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
13901+ # Don't use ranlib
13902+ old_postinstall_cmds='chmod 644 $oldlib'
13903+ postlink_cmds='lt_outputfile="@OUTPUT@"~
13904+ lt_tool_outputfile="@TOOL_OUTPUT@"~
13905+ case $lt_outputfile in
13906+ *.exe|*.EXE) ;;
13907+ *)
13908+ lt_outputfile="$lt_outputfile.exe"
13909+ lt_tool_outputfile="$lt_tool_outputfile.exe"
13910+ ;;
13911+ esac~
13912+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
13913+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
13914+ $RM "$lt_outputfile.manifest";
13915+ fi'
13916+ ;;
13917+ *)
13918+ # Assume MSVC wrapper
13919+ hardcode_libdir_flag_spec=' '
13920+ allow_undefined_flag=unsupported
13921+ # Tell ltmain to make .lib files, not .a files.
13922+ libext=lib
13923+ # Tell ltmain to make .dll files, not .so files.
13924+ shrext_cmds=".dll"
13925+ # FIXME: Setting linknames here is a bad hack.
13926+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
13927+ # The linker will automatically build a .lib file if we build a DLL.
13928+ old_archive_from_new_cmds='true'
13929+ # FIXME: Should let the user specify the lib program.
13930+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
13931+ enable_shared_with_static_runtimes=yes
13932+ ;;
13933+ esac
13934 ;;
13935
13936 darwin* | rhapsody*)
13937@@ -9445,7 +10028,7 @@
13938
13939 # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
13940 freebsd* | dragonfly*)
13941- archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
13942+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
13943 hardcode_libdir_flag_spec='-R$libdir'
13944 hardcode_direct=yes
13945 hardcode_shlibpath_var=no
13946@@ -9453,7 +10036,7 @@
13947
13948 hpux9*)
13949 if test "$GCC" = yes; then
13950- archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
13951+ archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
13952 else
13953 archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
13954 fi
13955@@ -9469,7 +10052,7 @@
13956
13957 hpux10*)
13958 if test "$GCC" = yes && test "$with_gnu_ld" = no; then
13959- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
13960+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
13961 else
13962 archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
13963 fi
13964@@ -9493,10 +10076,10 @@
13965 archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
13966 ;;
13967 ia64*)
13968- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
13969+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
13970 ;;
13971 *)
13972- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
13973+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
13974 ;;
13975 esac
13976 else
13977@@ -9575,23 +10158,36 @@
13978
13979 irix5* | irix6* | nonstopux*)
13980 if test "$GCC" = yes; then
13981- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
13982+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
13983 # Try to use the -exported_symbol ld option, if it does not
13984 # work, assume that -exports_file does not work either and
13985 # implicitly export all symbols.
13986- save_LDFLAGS="$LDFLAGS"
13987- LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
13988- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13989+ # This should be the same for all languages, so no per-tag cache variable.
13990+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
13991+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
13992+if test "${lt_cv_irix_exported_symbol+set}" = set; then :
13993+ $as_echo_n "(cached) " >&6
13994+else
13995+ save_LDFLAGS="$LDFLAGS"
13996+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
13997+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13998 /* end confdefs.h. */
13999-int foo(void) {}
14000+int foo (void) { return 0; }
14001 _ACEOF
14002 if ac_fn_c_try_link "$LINENO"; then :
14003- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
14004-
14005+ lt_cv_irix_exported_symbol=yes
14006+else
14007+ lt_cv_irix_exported_symbol=no
14008 fi
14009 rm -f core conftest.err conftest.$ac_objext \
14010 conftest$ac_exeext conftest.$ac_ext
14011- LDFLAGS="$save_LDFLAGS"
14012+ LDFLAGS="$save_LDFLAGS"
14013+fi
14014+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
14015+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
14016+ if test "$lt_cv_irix_exported_symbol" = yes; then
14017+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
14018+ fi
14019 else
14020 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
14021 archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
14022@@ -9676,7 +10272,7 @@
14023 osf4* | osf5*) # as osf3* with the addition of -msym flag
14024 if test "$GCC" = yes; then
14025 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
14026- archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
14027+ archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
14028 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
14029 else
14030 allow_undefined_flag=' -expect_unresolved \*'
14031@@ -9695,9 +10291,9 @@
14032 no_undefined_flag=' -z defs'
14033 if test "$GCC" = yes; then
14034 wlarc='${wl}'
14035- archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
14036+ archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
14037 archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
14038- $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
14039+ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
14040 else
14041 case `$CC -V 2>&1` in
14042 *"Compilers 5.0"*)
14043@@ -10273,8 +10869,9 @@
14044 need_version=no
14045 need_lib_prefix=no
14046
14047- case $GCC,$host_os in
14048- yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
14049+ case $GCC,$cc_basename in
14050+ yes,*)
14051+ # gcc
14052 library_names_spec='$libname.dll.a'
14053 # DLL is installed to $(libdir)/../bin by postinstall_cmds
14054 postinstall_cmds='base_file=`basename \${file}`~
14055@@ -10307,13 +10904,71 @@
14056 library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
14057 ;;
14058 esac
14059+ dynamic_linker='Win32 ld.exe'
14060+ ;;
14061+
14062+ *,cl*)
14063+ # Native MSVC
14064+ libname_spec='$name'
14065+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
14066+ library_names_spec='${libname}.dll.lib'
14067+
14068+ case $build_os in
14069+ mingw*)
14070+ sys_lib_search_path_spec=
14071+ lt_save_ifs=$IFS
14072+ IFS=';'
14073+ for lt_path in $LIB
14074+ do
14075+ IFS=$lt_save_ifs
14076+ # Let DOS variable expansion print the short 8.3 style file name.
14077+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
14078+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
14079+ done
14080+ IFS=$lt_save_ifs
14081+ # Convert to MSYS style.
14082+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
14083+ ;;
14084+ cygwin*)
14085+ # Convert to unix form, then to dos form, then back to unix form
14086+ # but this time dos style (no spaces!) so that the unix form looks
14087+ # like /cygdrive/c/PROGRA~1:/cygdr...
14088+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
14089+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
14090+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
14091+ ;;
14092+ *)
14093+ sys_lib_search_path_spec="$LIB"
14094+ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
14095+ # It is most probably a Windows format PATH.
14096+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
14097+ else
14098+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
14099+ fi
14100+ # FIXME: find the short name or the path components, as spaces are
14101+ # common. (e.g. "Program Files" -> "PROGRA~1")
14102+ ;;
14103+ esac
14104+
14105+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
14106+ postinstall_cmds='base_file=`basename \${file}`~
14107+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
14108+ dldir=$destdir/`dirname \$dlpath`~
14109+ test -d \$dldir || mkdir -p \$dldir~
14110+ $install_prog $dir/$dlname \$dldir/$dlname'
14111+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
14112+ dlpath=$dir/\$dldll~
14113+ $RM \$dlpath'
14114+ shlibpath_overrides_runpath=yes
14115+ dynamic_linker='Win32 link.exe'
14116 ;;
14117
14118 *)
14119+ # Assume MSVC wrapper
14120 library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
14121+ dynamic_linker='Win32 ld.exe'
14122 ;;
14123 esac
14124- dynamic_linker='Win32 ld.exe'
14125 # FIXME: first we should search . and the directory the executable is in
14126 shlibpath_var=PATH
14127 ;;
14128@@ -10405,7 +11060,7 @@
14129 soname_spec='${libname}${release}${shared_ext}$major'
14130 shlibpath_var=LIBRARY_PATH
14131 shlibpath_overrides_runpath=yes
14132- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
14133+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
14134 hardcode_into_libs=yes
14135 ;;
14136
14137@@ -11245,10 +11900,10 @@
14138 /* When -fvisbility=hidden is used, assume the code has been annotated
14139 correspondingly for the symbols needed. */
14140 #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
14141-void fnord () __attribute__((visibility("default")));
14142+int fnord () __attribute__((visibility("default")));
14143 #endif
14144
14145-void fnord () { int i=42; }
14146+int fnord () { return 42; }
14147 int main ()
14148 {
14149 void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
14150@@ -11351,10 +12006,10 @@
14151 /* When -fvisbility=hidden is used, assume the code has been annotated
14152 correspondingly for the symbols needed. */
14153 #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
14154-void fnord () __attribute__((visibility("default")));
14155+int fnord () __attribute__((visibility("default")));
14156 #endif
14157
14158-void fnord () { int i=42; }
14159+int fnord () { return 42; }
14160 int main ()
14161 {
14162 void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
14163@@ -15064,13 +15719,20 @@
14164 lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
14165 lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
14166 lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
14167+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
14168+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
14169 reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
14170 reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
14171 OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
14172 deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
14173 file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
14174+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
14175+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
14176+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
14177+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
14178 AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
14179 AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
14180+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
14181 STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
14182 RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
14183 old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
14184@@ -15085,14 +15747,17 @@
14185 lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
14186 lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
14187 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
14188+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
14189+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
14190 objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
14191 MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
14192 lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
14193-lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
14194 lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
14195+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
14196 lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
14197 lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
14198 need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
14199+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
14200 DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
14201 NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
14202 LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
14203@@ -15125,12 +15790,12 @@
14204 hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
14205 inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
14206 link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
14207-fix_srcfile_path='`$ECHO "$fix_srcfile_path" | $SED "$delay_single_quote_subst"`'
14208 always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
14209 export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
14210 exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
14211 include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
14212 prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
14213+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
14214 file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
14215 variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
14216 need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
14217@@ -15185,8 +15850,13 @@
14218 OBJDUMP \
14219 deplibs_check_method \
14220 file_magic_cmd \
14221+file_magic_glob \
14222+want_nocaseglob \
14223+DLLTOOL \
14224+sharedlib_from_linklib_cmd \
14225 AR \
14226 AR_FLAGS \
14227+archiver_list_spec \
14228 STRIP \
14229 RANLIB \
14230 CC \
14231@@ -15196,12 +15866,14 @@
14232 lt_cv_sys_global_symbol_to_cdecl \
14233 lt_cv_sys_global_symbol_to_c_name_address \
14234 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
14235+nm_file_list_spec \
14236 lt_prog_compiler_no_builtin_flag \
14237-lt_prog_compiler_wl \
14238 lt_prog_compiler_pic \
14239+lt_prog_compiler_wl \
14240 lt_prog_compiler_static \
14241 lt_cv_prog_compiler_c_o \
14242 need_locks \
14243+MANIFEST_TOOL \
14244 DSYMUTIL \
14245 NMEDIT \
14246 LIPO \
14247@@ -15217,7 +15889,6 @@
14248 hardcode_libdir_flag_spec \
14249 hardcode_libdir_flag_spec_ld \
14250 hardcode_libdir_separator \
14251-fix_srcfile_path \
14252 exclude_expsyms \
14253 include_expsyms \
14254 file_list_spec \
14255@@ -15253,6 +15924,7 @@
14256 module_expsym_cmds \
14257 export_symbols_cmds \
14258 prelink_cmds \
14259+postlink_cmds \
14260 postinstall_cmds \
14261 postuninstall_cmds \
14262 finish_cmds \
14263@@ -16017,7 +16689,8 @@
14264 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
14265 #
14266 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
14267-# 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
14268+# 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
14269+# Inc.
14270 # Written by Gordon Matzigkeit, 1996
14271 #
14272 # This file is part of GNU Libtool.
14273@@ -16120,19 +16793,42 @@
14274 # turn newlines into spaces.
14275 NL2SP=$lt_lt_NL2SP
14276
14277+# convert \$build file names to \$host format.
14278+to_host_file_cmd=$lt_cv_to_host_file_cmd
14279+
14280+# convert \$build files to toolchain format.
14281+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
14282+
14283 # An object symbol dumper.
14284 OBJDUMP=$lt_OBJDUMP
14285
14286 # Method to check whether dependent libraries are shared objects.
14287 deplibs_check_method=$lt_deplibs_check_method
14288
14289-# Command to use when deplibs_check_method == "file_magic".
14290+# Command to use when deplibs_check_method = "file_magic".
14291 file_magic_cmd=$lt_file_magic_cmd
14292
14293+# How to find potential files when deplibs_check_method = "file_magic".
14294+file_magic_glob=$lt_file_magic_glob
14295+
14296+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
14297+want_nocaseglob=$lt_want_nocaseglob
14298+
14299+# DLL creation program.
14300+DLLTOOL=$lt_DLLTOOL
14301+
14302+# Command to associate shared and link libraries.
14303+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
14304+
14305 # The archiver.
14306 AR=$lt_AR
14307+
14308+# Flags to create an archive.
14309 AR_FLAGS=$lt_AR_FLAGS
14310
14311+# How to feed a file listing to the archiver.
14312+archiver_list_spec=$lt_archiver_list_spec
14313+
14314 # A symbol stripping program.
14315 STRIP=$lt_STRIP
14316
14317@@ -16162,6 +16858,12 @@
14318 # Transform the output of nm in a C name address pair when lib prefix is needed.
14319 global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
14320
14321+# Specify filename containing input files for \$NM.
14322+nm_file_list_spec=$lt_nm_file_list_spec
14323+
14324+# The root where to search for dependent libraries,and in which our libraries should be installed.
14325+lt_sysroot=$lt_sysroot
14326+
14327 # The name of the directory that contains temporary libtool files.
14328 objdir=$objdir
14329
14330@@ -16171,6 +16873,9 @@
14331 # Must we lock files when doing compilation?
14332 need_locks=$lt_need_locks
14333
14334+# Manifest tool.
14335+MANIFEST_TOOL=$lt_MANIFEST_TOOL
14336+
14337 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
14338 DSYMUTIL=$lt_DSYMUTIL
14339
14340@@ -16285,12 +16990,12 @@
14341 # Compiler flag to turn off builtin functions.
14342 no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
14343
14344-# How to pass a linker flag through the compiler.
14345-wl=$lt_lt_prog_compiler_wl
14346-
14347 # Additional compiler flags for building library objects.
14348 pic_flag=$lt_lt_prog_compiler_pic
14349
14350+# How to pass a linker flag through the compiler.
14351+wl=$lt_lt_prog_compiler_wl
14352+
14353 # Compiler flag to prevent dynamic linking.
14354 link_static_flag=$lt_lt_prog_compiler_static
14355
14356@@ -16377,9 +17082,6 @@
14357 # Whether libtool must link a program against all its dependency libraries.
14358 link_all_deplibs=$link_all_deplibs
14359
14360-# Fix the shell variable \$srcfile for the compiler.
14361-fix_srcfile_path=$lt_fix_srcfile_path
14362-
14363 # Set to "yes" if exported symbols are required.
14364 always_export_symbols=$always_export_symbols
14365
14366@@ -16395,6 +17097,9 @@
14367 # Commands necessary for linking programs (against libraries) with templates.
14368 prelink_cmds=$lt_prelink_cmds
14369
14370+# Commands necessary for finishing linking programs.
14371+postlink_cmds=$lt_postlink_cmds
14372+
14373 # Specify filename containing input files.
14374 file_list_spec=$lt_file_list_spec
14375
14376@@ -16427,210 +17132,169 @@
14377 # if finds mixed CR/LF and LF-only lines. Since sed operates in
14378 # text mode, it properly converts lines to CR/LF. This bash problem
14379 # is reportedly fixed, but why not run on old versions too?
14380- sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
14381- || (rm -f "$cfgfile"; exit 1)
14382-
14383- case $xsi_shell in
14384- yes)
14385- cat << \_LT_EOF >> "$cfgfile"
14386-
14387-# func_dirname file append nondir_replacement
14388-# Compute the dirname of FILE. If nonempty, add APPEND to the result,
14389-# otherwise set result to NONDIR_REPLACEMENT.
14390-func_dirname ()
14391-{
14392- case ${1} in
14393- */*) func_dirname_result="${1%/*}${2}" ;;
14394- * ) func_dirname_result="${3}" ;;
14395- esac
14396-}
14397-
14398-# func_basename file
14399-func_basename ()
14400-{
14401- func_basename_result="${1##*/}"
14402-}
14403-
14404-# func_dirname_and_basename file append nondir_replacement
14405-# perform func_basename and func_dirname in a single function
14406-# call:
14407-# dirname: Compute the dirname of FILE. If nonempty,
14408-# add APPEND to the result, otherwise set result
14409-# to NONDIR_REPLACEMENT.
14410-# value returned in "$func_dirname_result"
14411-# basename: Compute filename of FILE.
14412-# value retuned in "$func_basename_result"
14413-# Implementation must be kept synchronized with func_dirname
14414-# and func_basename. For efficiency, we do not delegate to
14415-# those functions but instead duplicate the functionality here.
14416-func_dirname_and_basename ()
14417-{
14418- case ${1} in
14419- */*) func_dirname_result="${1%/*}${2}" ;;
14420- * ) func_dirname_result="${3}" ;;
14421- esac
14422- func_basename_result="${1##*/}"
14423-}
14424-
14425-# func_stripname prefix suffix name
14426-# strip PREFIX and SUFFIX off of NAME.
14427-# PREFIX and SUFFIX must not contain globbing or regex special
14428-# characters, hashes, percent signs, but SUFFIX may contain a leading
14429-# dot (in which case that matches only a dot).
14430-func_stripname ()
14431-{
14432- # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
14433- # positional parameters, so assign one to ordinary parameter first.
14434- func_stripname_result=${3}
14435- func_stripname_result=${func_stripname_result#"${1}"}
14436- func_stripname_result=${func_stripname_result%"${2}"}
14437-}
14438-
14439-# func_opt_split
14440-func_opt_split ()
14441-{
14442- func_opt_split_opt=${1%%=*}
14443- func_opt_split_arg=${1#*=}
14444-}
14445-
14446-# func_lo2o object
14447-func_lo2o ()
14448-{
14449- case ${1} in
14450- *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
14451- *) func_lo2o_result=${1} ;;
14452- esac
14453-}
14454-
14455-# func_xform libobj-or-source
14456-func_xform ()
14457-{
14458- func_xform_result=${1%.*}.lo
14459-}
14460-
14461-# func_arith arithmetic-term...
14462-func_arith ()
14463-{
14464- func_arith_result=$(( $* ))
14465-}
14466-
14467-# func_len string
14468-# STRING may not start with a hyphen.
14469-func_len ()
14470-{
14471- func_len_result=${#1}
14472-}
14473-
14474-_LT_EOF
14475- ;;
14476- *) # Bourne compatible functions.
14477- cat << \_LT_EOF >> "$cfgfile"
14478-
14479-# func_dirname file append nondir_replacement
14480-# Compute the dirname of FILE. If nonempty, add APPEND to the result,
14481-# otherwise set result to NONDIR_REPLACEMENT.
14482-func_dirname ()
14483-{
14484- # Extract subdirectory from the argument.
14485- func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
14486- if test "X$func_dirname_result" = "X${1}"; then
14487- func_dirname_result="${3}"
14488- else
14489- func_dirname_result="$func_dirname_result${2}"
14490- fi
14491-}
14492-
14493-# func_basename file
14494-func_basename ()
14495-{
14496- func_basename_result=`$ECHO "${1}" | $SED "$basename"`
14497-}
14498-
14499-
14500-# func_stripname prefix suffix name
14501-# strip PREFIX and SUFFIX off of NAME.
14502-# PREFIX and SUFFIX must not contain globbing or regex special
14503-# characters, hashes, percent signs, but SUFFIX may contain a leading
14504-# dot (in which case that matches only a dot).
14505-# func_strip_suffix prefix name
14506-func_stripname ()
14507-{
14508- case ${2} in
14509- .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
14510- *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
14511- esac
14512-}
14513-
14514-# sed scripts:
14515-my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
14516-my_sed_long_arg='1s/^-[^=]*=//'
14517-
14518-# func_opt_split
14519-func_opt_split ()
14520-{
14521- func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"`
14522- func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"`
14523-}
14524-
14525-# func_lo2o object
14526-func_lo2o ()
14527-{
14528- func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
14529-}
14530-
14531-# func_xform libobj-or-source
14532-func_xform ()
14533-{
14534- func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
14535-}
14536-
14537-# func_arith arithmetic-term...
14538-func_arith ()
14539-{
14540- func_arith_result=`expr "$@"`
14541-}
14542-
14543-# func_len string
14544-# STRING may not start with a hyphen.
14545-func_len ()
14546-{
14547- func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
14548-}
14549-
14550-_LT_EOF
14551-esac
14552-
14553-case $lt_shell_append in
14554- yes)
14555- cat << \_LT_EOF >> "$cfgfile"
14556-
14557-# func_append var value
14558-# Append VALUE to the end of shell variable VAR.
14559-func_append ()
14560-{
14561- eval "$1+=\$2"
14562-}
14563-_LT_EOF
14564- ;;
14565- *)
14566- cat << \_LT_EOF >> "$cfgfile"
14567-
14568-# func_append var value
14569-# Append VALUE to the end of shell variable VAR.
14570-func_append ()
14571-{
14572- eval "$1=\$$1\$2"
14573-}
14574-
14575-_LT_EOF
14576- ;;
14577- esac
14578+ sed '$q' "$ltmain" >> "$cfgfile" \
14579+ || (rm -f "$cfgfile"; exit 1)
14580
14581+ if test x"$xsi_shell" = xyes; then
14582+ sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
14583+func_dirname ()\
14584+{\
14585+\ case ${1} in\
14586+\ */*) func_dirname_result="${1%/*}${2}" ;;\
14587+\ * ) func_dirname_result="${3}" ;;\
14588+\ esac\
14589+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
14590+ && mv -f "$cfgfile.tmp" "$cfgfile" \
14591+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
14592+test 0 -eq $? || _lt_function_replace_fail=:
14593+
14594+
14595+ sed -e '/^func_basename ()$/,/^} # func_basename /c\
14596+func_basename ()\
14597+{\
14598+\ func_basename_result="${1##*/}"\
14599+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
14600+ && mv -f "$cfgfile.tmp" "$cfgfile" \
14601+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
14602+test 0 -eq $? || _lt_function_replace_fail=:
14603+
14604+
14605+ sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
14606+func_dirname_and_basename ()\
14607+{\
14608+\ case ${1} in\
14609+\ */*) func_dirname_result="${1%/*}${2}" ;;\
14610+\ * ) func_dirname_result="${3}" ;;\
14611+\ esac\
14612+\ func_basename_result="${1##*/}"\
14613+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
14614+ && mv -f "$cfgfile.tmp" "$cfgfile" \
14615+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
14616+test 0 -eq $? || _lt_function_replace_fail=:
14617+
14618+
14619+ sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
14620+func_stripname ()\
14621+{\
14622+\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
14623+\ # positional parameters, so assign one to ordinary parameter first.\
14624+\ func_stripname_result=${3}\
14625+\ func_stripname_result=${func_stripname_result#"${1}"}\
14626+\ func_stripname_result=${func_stripname_result%"${2}"}\
14627+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
14628+ && mv -f "$cfgfile.tmp" "$cfgfile" \
14629+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
14630+test 0 -eq $? || _lt_function_replace_fail=:
14631+
14632+
14633+ sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
14634+func_split_long_opt ()\
14635+{\
14636+\ func_split_long_opt_name=${1%%=*}\
14637+\ func_split_long_opt_arg=${1#*=}\
14638+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
14639+ && mv -f "$cfgfile.tmp" "$cfgfile" \
14640+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
14641+test 0 -eq $? || _lt_function_replace_fail=:
14642+
14643+
14644+ sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
14645+func_split_short_opt ()\
14646+{\
14647+\ func_split_short_opt_arg=${1#??}\
14648+\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
14649+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
14650+ && mv -f "$cfgfile.tmp" "$cfgfile" \
14651+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
14652+test 0 -eq $? || _lt_function_replace_fail=:
14653+
14654+
14655+ sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
14656+func_lo2o ()\
14657+{\
14658+\ case ${1} in\
14659+\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
14660+\ *) func_lo2o_result=${1} ;;\
14661+\ esac\
14662+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
14663+ && mv -f "$cfgfile.tmp" "$cfgfile" \
14664+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
14665+test 0 -eq $? || _lt_function_replace_fail=:
14666+
14667+
14668+ sed -e '/^func_xform ()$/,/^} # func_xform /c\
14669+func_xform ()\
14670+{\
14671+ func_xform_result=${1%.*}.lo\
14672+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
14673+ && mv -f "$cfgfile.tmp" "$cfgfile" \
14674+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
14675+test 0 -eq $? || _lt_function_replace_fail=:
14676+
14677+
14678+ sed -e '/^func_arith ()$/,/^} # func_arith /c\
14679+func_arith ()\
14680+{\
14681+ func_arith_result=$(( $* ))\
14682+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
14683+ && mv -f "$cfgfile.tmp" "$cfgfile" \
14684+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
14685+test 0 -eq $? || _lt_function_replace_fail=:
14686+
14687+
14688+ sed -e '/^func_len ()$/,/^} # func_len /c\
14689+func_len ()\
14690+{\
14691+ func_len_result=${#1}\
14692+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
14693+ && mv -f "$cfgfile.tmp" "$cfgfile" \
14694+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
14695+test 0 -eq $? || _lt_function_replace_fail=:
14696+
14697+fi
14698+
14699+if test x"$lt_shell_append" = xyes; then
14700+ sed -e '/^func_append ()$/,/^} # func_append /c\
14701+func_append ()\
14702+{\
14703+ eval "${1}+=\\${2}"\
14704+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
14705+ && mv -f "$cfgfile.tmp" "$cfgfile" \
14706+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
14707+test 0 -eq $? || _lt_function_replace_fail=:
14708+
14709+
14710+ sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
14711+func_append_quoted ()\
14712+{\
14713+\ func_quote_for_eval "${2}"\
14714+\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
14715+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
14716+ && mv -f "$cfgfile.tmp" "$cfgfile" \
14717+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
14718+test 0 -eq $? || _lt_function_replace_fail=:
14719+
14720+
14721+ # Save a `func_append' function call where possible by direct use of '+='
14722+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
14723+ && mv -f "$cfgfile.tmp" "$cfgfile" \
14724+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
14725+ test 0 -eq $? || _lt_function_replace_fail=:
14726+else
14727+ # Save a `func_append' function call even when '+=' is not available
14728+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
14729+ && mv -f "$cfgfile.tmp" "$cfgfile" \
14730+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
14731+ test 0 -eq $? || _lt_function_replace_fail=:
14732+fi
14733+
14734+if test x"$_lt_function_replace_fail" = x":"; then
14735+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
14736+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
14737+fi
14738
14739- sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
14740- || (rm -f "$cfgfile"; exit 1)
14741
14742- mv -f "$cfgfile" "$ofile" ||
14743+ mv -f "$cfgfile" "$ofile" ||
14744 (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
14745 chmod +x "$ofile"
14746
14747Index: binutils-2.24/gprof/configure
14748===================================================================
14749--- binutils-2.24.orig/gprof/configure 2013-12-15 11:09:51.443785606 -0800
14750+++ binutils-2.24/gprof/configure 2013-12-15 11:10:23.880452030 -0800
14751@@ -629,8 +629,11 @@
14752 LIPO
14753 NMEDIT
14754 DSYMUTIL
14755+MANIFEST_TOOL
14756 RANLIB
14757+ac_ct_AR
14758 AR
14759+DLLTOOL
14760 OBJDUMP
14761 LN_S
14762 NM
14763@@ -743,6 +746,7 @@
14764 with_pic
14765 enable_fast_install
14766 with_gnu_ld
14767+with_libtool_sysroot
14768 enable_libtool_lock
14769 enable_nls
14770 enable_maintainer_mode
14771@@ -1397,6 +1401,8 @@
14772 --with-pic try to use only PIC/non-PIC objects [default=use
14773 both]
14774 --with-gnu-ld assume the C compiler uses GNU ld [default=no]
14775+ --with-libtool-sysroot=DIR Search for dependent libraries within DIR
14776+ (or the compiler's sysroot if not specified).
14777
14778 Some influential environment variables:
14779 CC C compiler command
14780@@ -5065,8 +5071,8 @@
14781
14782
14783
14784-macro_version='2.2.7a'
14785-macro_revision='1.3134'
14786+macro_version='2.4'
14787+macro_revision='1.3293'
14788
14789
14790
14791@@ -5106,7 +5112,7 @@
14792 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
14793 $as_echo_n "checking how to print strings... " >&6; }
14794 # Test print first, because it will be a builtin if present.
14795-if test "X`print -r -- -n 2>/dev/null`" = X-n && \
14796+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
14797 test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
14798 ECHO='print -r --'
14799 elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
14800@@ -5792,8 +5798,8 @@
14801 # Try some XSI features
14802 xsi_shell=no
14803 ( _lt_dummy="a/b/c"
14804- test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
14805- = c,a/b,, \
14806+ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
14807+ = c,a/b,b/c, \
14808 && eval 'test $(( 1 + 1 )) -eq 2 \
14809 && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
14810 && xsi_shell=yes
14811@@ -5842,6 +5848,80 @@
14812
14813
14814
14815+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
14816+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
14817+if test "${lt_cv_to_host_file_cmd+set}" = set; then :
14818+ $as_echo_n "(cached) " >&6
14819+else
14820+ case $host in
14821+ *-*-mingw* )
14822+ case $build in
14823+ *-*-mingw* ) # actually msys
14824+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
14825+ ;;
14826+ *-*-cygwin* )
14827+ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
14828+ ;;
14829+ * ) # otherwise, assume *nix
14830+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
14831+ ;;
14832+ esac
14833+ ;;
14834+ *-*-cygwin* )
14835+ case $build in
14836+ *-*-mingw* ) # actually msys
14837+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
14838+ ;;
14839+ *-*-cygwin* )
14840+ lt_cv_to_host_file_cmd=func_convert_file_noop
14841+ ;;
14842+ * ) # otherwise, assume *nix
14843+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
14844+ ;;
14845+ esac
14846+ ;;
14847+ * ) # unhandled hosts (and "normal" native builds)
14848+ lt_cv_to_host_file_cmd=func_convert_file_noop
14849+ ;;
14850+esac
14851+
14852+fi
14853+
14854+to_host_file_cmd=$lt_cv_to_host_file_cmd
14855+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
14856+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
14857+
14858+
14859+
14860+
14861+
14862+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
14863+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
14864+if test "${lt_cv_to_tool_file_cmd+set}" = set; then :
14865+ $as_echo_n "(cached) " >&6
14866+else
14867+ #assume ordinary cross tools, or native build.
14868+lt_cv_to_tool_file_cmd=func_convert_file_noop
14869+case $host in
14870+ *-*-mingw* )
14871+ case $build in
14872+ *-*-mingw* ) # actually msys
14873+ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
14874+ ;;
14875+ esac
14876+ ;;
14877+esac
14878+
14879+fi
14880+
14881+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
14882+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
14883+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
14884+
14885+
14886+
14887+
14888+
14889 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
14890 $as_echo_n "checking for $LD option to reload object files... " >&6; }
14891 if test "${lt_cv_ld_reload_flag+set}" = set; then :
14892@@ -5858,6 +5938,11 @@
14893 esac
14894 reload_cmds='$LD$reload_flag -o $output$reload_objs'
14895 case $host_os in
14896+ cygwin* | mingw* | pw32* | cegcc*)
14897+ if test "$GCC" != yes; then
14898+ reload_cmds=false
14899+ fi
14900+ ;;
14901 darwin*)
14902 if test "$GCC" = yes; then
14903 reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
14904@@ -6026,7 +6111,8 @@
14905 lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
14906 lt_cv_file_magic_cmd='func_win32_libid'
14907 else
14908- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
14909+ # Keep this pattern in sync with the one in func_win32_libid.
14910+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
14911 lt_cv_file_magic_cmd='$OBJDUMP -f'
14912 fi
14913 ;;
14914@@ -6103,11 +6189,6 @@
14915 lt_cv_deplibs_check_method=pass_all
14916 ;;
14917
14918-linux-uclibc*)
14919- lt_cv_deplibs_check_method=pass_all
14920- lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
14921- ;;
14922-
14923 netbsd*)
14924 if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
14925 lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
14926@@ -6185,6 +6266,21 @@
14927 fi
14928 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
14929 $as_echo "$lt_cv_deplibs_check_method" >&6; }
14930+
14931+file_magic_glob=
14932+want_nocaseglob=no
14933+if test "$build" = "$host"; then
14934+ case $host_os in
14935+ mingw* | pw32*)
14936+ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
14937+ want_nocaseglob=yes
14938+ else
14939+ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
14940+ fi
14941+ ;;
14942+ esac
14943+fi
14944+
14945 file_magic_cmd=$lt_cv_file_magic_cmd
14946 deplibs_check_method=$lt_cv_deplibs_check_method
14947 test -z "$deplibs_check_method" && deplibs_check_method=unknown
14948@@ -6200,9 +6296,162 @@
14949
14950
14951
14952+
14953+
14954+
14955+
14956+
14957+
14958+
14959+
14960+
14961+
14962 if test -n "$ac_tool_prefix"; then
14963- # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
14964-set dummy ${ac_tool_prefix}ar; ac_word=$2
14965+ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
14966+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
14967+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
14968+$as_echo_n "checking for $ac_word... " >&6; }
14969+if test "${ac_cv_prog_DLLTOOL+set}" = set; then :
14970+ $as_echo_n "(cached) " >&6
14971+else
14972+ if test -n "$DLLTOOL"; then
14973+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
14974+else
14975+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
14976+for as_dir in $PATH
14977+do
14978+ IFS=$as_save_IFS
14979+ test -z "$as_dir" && as_dir=.
14980+ for ac_exec_ext in '' $ac_executable_extensions; do
14981+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
14982+ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
14983+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
14984+ break 2
14985+ fi
14986+done
14987+ done
14988+IFS=$as_save_IFS
14989+
14990+fi
14991+fi
14992+DLLTOOL=$ac_cv_prog_DLLTOOL
14993+if test -n "$DLLTOOL"; then
14994+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
14995+$as_echo "$DLLTOOL" >&6; }
14996+else
14997+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
14998+$as_echo "no" >&6; }
14999+fi
15000+
15001+
15002+fi
15003+if test -z "$ac_cv_prog_DLLTOOL"; then
15004+ ac_ct_DLLTOOL=$DLLTOOL
15005+ # Extract the first word of "dlltool", so it can be a program name with args.
15006+set dummy dlltool; ac_word=$2
15007+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
15008+$as_echo_n "checking for $ac_word... " >&6; }
15009+if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then :
15010+ $as_echo_n "(cached) " >&6
15011+else
15012+ if test -n "$ac_ct_DLLTOOL"; then
15013+ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
15014+else
15015+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
15016+for as_dir in $PATH
15017+do
15018+ IFS=$as_save_IFS
15019+ test -z "$as_dir" && as_dir=.
15020+ for ac_exec_ext in '' $ac_executable_extensions; do
15021+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
15022+ ac_cv_prog_ac_ct_DLLTOOL="dlltool"
15023+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
15024+ break 2
15025+ fi
15026+done
15027+ done
15028+IFS=$as_save_IFS
15029+
15030+fi
15031+fi
15032+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
15033+if test -n "$ac_ct_DLLTOOL"; then
15034+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
15035+$as_echo "$ac_ct_DLLTOOL" >&6; }
15036+else
15037+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
15038+$as_echo "no" >&6; }
15039+fi
15040+
15041+ if test "x$ac_ct_DLLTOOL" = x; then
15042+ DLLTOOL="false"
15043+ else
15044+ case $cross_compiling:$ac_tool_warned in
15045+yes:)
15046+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
15047+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
15048+ac_tool_warned=yes ;;
15049+esac
15050+ DLLTOOL=$ac_ct_DLLTOOL
15051+ fi
15052+else
15053+ DLLTOOL="$ac_cv_prog_DLLTOOL"
15054+fi
15055+
15056+test -z "$DLLTOOL" && DLLTOOL=dlltool
15057+
15058+
15059+
15060+
15061+
15062+
15063+
15064+
15065+
15066+
15067+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
15068+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
15069+if test "${lt_cv_sharedlib_from_linklib_cmd+set}" = set; then :
15070+ $as_echo_n "(cached) " >&6
15071+else
15072+ lt_cv_sharedlib_from_linklib_cmd='unknown'
15073+
15074+case $host_os in
15075+cygwin* | mingw* | pw32* | cegcc*)
15076+ # two different shell functions defined in ltmain.sh
15077+ # decide which to use based on capabilities of $DLLTOOL
15078+ case `$DLLTOOL --help 2>&1` in
15079+ *--identify-strict*)
15080+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
15081+ ;;
15082+ *)
15083+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
15084+ ;;
15085+ esac
15086+ ;;
15087+*)
15088+ # fallback: assume linklib IS sharedlib
15089+ lt_cv_sharedlib_from_linklib_cmd="$ECHO"
15090+ ;;
15091+esac
15092+
15093+fi
15094+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
15095+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
15096+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
15097+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
15098+
15099+
15100+
15101+
15102+
15103+
15104+
15105+if test -n "$ac_tool_prefix"; then
15106+ for ac_prog in ar
15107+ do
15108+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
15109+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
15110 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
15111 $as_echo_n "checking for $ac_word... " >&6; }
15112 if test "${ac_cv_prog_AR+set}" = set; then :
15113@@ -6218,7 +6467,7 @@
15114 test -z "$as_dir" && as_dir=.
15115 for ac_exec_ext in '' $ac_executable_extensions; do
15116 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
15117- ac_cv_prog_AR="${ac_tool_prefix}ar"
15118+ ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
15119 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
15120 break 2
15121 fi
15122@@ -6238,11 +6487,15 @@
15123 fi
15124
15125
15126+ test -n "$AR" && break
15127+ done
15128 fi
15129-if test -z "$ac_cv_prog_AR"; then
15130+if test -z "$AR"; then
15131 ac_ct_AR=$AR
15132- # Extract the first word of "ar", so it can be a program name with args.
15133-set dummy ar; ac_word=$2
15134+ for ac_prog in ar
15135+do
15136+ # Extract the first word of "$ac_prog", so it can be a program name with args.
15137+set dummy $ac_prog; ac_word=$2
15138 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
15139 $as_echo_n "checking for $ac_word... " >&6; }
15140 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
15141@@ -6258,7 +6511,7 @@
15142 test -z "$as_dir" && as_dir=.
15143 for ac_exec_ext in '' $ac_executable_extensions; do
15144 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
15145- ac_cv_prog_ac_ct_AR="ar"
15146+ ac_cv_prog_ac_ct_AR="$ac_prog"
15147 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
15148 break 2
15149 fi
15150@@ -6277,6 +6530,10 @@
15151 $as_echo "no" >&6; }
15152 fi
15153
15154+
15155+ test -n "$ac_ct_AR" && break
15156+done
15157+
15158 if test "x$ac_ct_AR" = x; then
15159 AR="false"
15160 else
15161@@ -6288,16 +6545,72 @@
15162 esac
15163 AR=$ac_ct_AR
15164 fi
15165-else
15166- AR="$ac_cv_prog_AR"
15167 fi
15168
15169-test -z "$AR" && AR=ar
15170-test -z "$AR_FLAGS" && AR_FLAGS=cru
15171+: ${AR=ar}
15172+: ${AR_FLAGS=cru}
15173+
15174+
15175+
15176+
15177+
15178+
15179+
15180+
15181+
15182+
15183+
15184+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
15185+$as_echo_n "checking for archiver @FILE support... " >&6; }
15186+if test "${lt_cv_ar_at_file+set}" = set; then :
15187+ $as_echo_n "(cached) " >&6
15188+else
15189+ lt_cv_ar_at_file=no
15190+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
15191+/* end confdefs.h. */
15192+
15193+int
15194+main ()
15195+{
15196
15197+ ;
15198+ return 0;
15199+}
15200+_ACEOF
15201+if ac_fn_c_try_compile "$LINENO"; then :
15202+ echo conftest.$ac_objext > conftest.lst
15203+ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
15204+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
15205+ (eval $lt_ar_try) 2>&5
15206+ ac_status=$?
15207+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
15208+ test $ac_status = 0; }
15209+ if test "$ac_status" -eq 0; then
15210+ # Ensure the archiver fails upon bogus file names.
15211+ rm -f conftest.$ac_objext libconftest.a
15212+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
15213+ (eval $lt_ar_try) 2>&5
15214+ ac_status=$?
15215+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
15216+ test $ac_status = 0; }
15217+ if test "$ac_status" -ne 0; then
15218+ lt_cv_ar_at_file=@
15219+ fi
15220+ fi
15221+ rm -f conftest.* libconftest.a
15222
15223+fi
15224+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15225
15226+fi
15227+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
15228+$as_echo "$lt_cv_ar_at_file" >&6; }
15229
15230+if test "x$lt_cv_ar_at_file" = xno; then
15231+ archiver_list_spec=
15232+else
15233+ archiver_list_spec=$lt_cv_ar_at_file
15234+fi
15235
15236
15237
15238@@ -6639,8 +6952,8 @@
15239 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
15240
15241 # Transform an extracted symbol line into symbol name and symbol address
15242-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
15243-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
15244+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
15245+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
15246
15247 # Handle CRLF in mingw tool chain
15248 opt_cr=
15249@@ -6676,6 +6989,7 @@
15250 else
15251 lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
15252 fi
15253+ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
15254
15255 # Check to see that the pipe works correctly.
15256 pipe_works=no
15257@@ -6717,6 +7031,18 @@
15258 if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
15259 if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
15260 cat <<_LT_EOF > conftest.$ac_ext
15261+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
15262+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
15263+/* DATA imports from DLLs on WIN32 con't be const, because runtime
15264+ relocations are performed -- see ld's documentation on pseudo-relocs. */
15265+# define LT_DLSYM_CONST
15266+#elif defined(__osf__)
15267+/* This system does not cope well with relocations in const data. */
15268+# define LT_DLSYM_CONST
15269+#else
15270+# define LT_DLSYM_CONST const
15271+#endif
15272+
15273 #ifdef __cplusplus
15274 extern "C" {
15275 #endif
15276@@ -6728,7 +7054,7 @@
15277 cat <<_LT_EOF >> conftest.$ac_ext
15278
15279 /* The mapping between symbol names and symbols. */
15280-const struct {
15281+LT_DLSYM_CONST struct {
15282 const char *name;
15283 void *address;
15284 }
15285@@ -6754,8 +7080,8 @@
15286 _LT_EOF
15287 # Now try linking the two files.
15288 mv conftest.$ac_objext conftstm.$ac_objext
15289- lt_save_LIBS="$LIBS"
15290- lt_save_CFLAGS="$CFLAGS"
15291+ lt_globsym_save_LIBS=$LIBS
15292+ lt_globsym_save_CFLAGS=$CFLAGS
15293 LIBS="conftstm.$ac_objext"
15294 CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
15295 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
15296@@ -6765,8 +7091,8 @@
15297 test $ac_status = 0; } && test -s conftest${ac_exeext}; then
15298 pipe_works=yes
15299 fi
15300- LIBS="$lt_save_LIBS"
15301- CFLAGS="$lt_save_CFLAGS"
15302+ LIBS=$lt_globsym_save_LIBS
15303+ CFLAGS=$lt_globsym_save_CFLAGS
15304 else
15305 echo "cannot find nm_test_func in $nlist" >&5
15306 fi
15307@@ -6803,6 +7129,17 @@
15308 $as_echo "ok" >&6; }
15309 fi
15310
15311+# Response file support.
15312+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
15313+ nm_file_list_spec='@'
15314+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
15315+ nm_file_list_spec='@'
15316+fi
15317+
15318+
15319+
15320+
15321+
15322
15323
15324
15325@@ -6824,6 +7161,44 @@
15326
15327
15328
15329+
15330+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
15331+$as_echo_n "checking for sysroot... " >&6; }
15332+
15333+# Check whether --with-libtool-sysroot was given.
15334+if test "${with_libtool_sysroot+set}" = set; then :
15335+ withval=$with_libtool_sysroot;
15336+else
15337+ with_libtool_sysroot=no
15338+fi
15339+
15340+
15341+lt_sysroot=
15342+case ${with_libtool_sysroot} in #(
15343+ yes)
15344+ if test "$GCC" = yes; then
15345+ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
15346+ fi
15347+ ;; #(
15348+ /*)
15349+ lt_sysroot=`echo "$with_libtool_sysroot" | sed -e "$sed_quote_subst"`
15350+ ;; #(
15351+ no|'')
15352+ ;; #(
15353+ *)
15354+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_libtool_sysroot}" >&5
15355+$as_echo "${with_libtool_sysroot}" >&6; }
15356+ as_fn_error "The sysroot must be an absolute path." "$LINENO" 5
15357+ ;;
15358+esac
15359+
15360+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
15361+$as_echo "${lt_sysroot:-no}" >&6; }
15362+
15363+
15364+
15365+
15366+
15367 # Check whether --enable-libtool-lock was given.
15368 if test "${enable_libtool_lock+set}" = set; then :
15369 enableval=$enable_libtool_lock;
15370@@ -7030,6 +7405,123 @@
15371
15372 need_locks="$enable_libtool_lock"
15373
15374+if test -n "$ac_tool_prefix"; then
15375+ # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
15376+set dummy ${ac_tool_prefix}mt; ac_word=$2
15377+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
15378+$as_echo_n "checking for $ac_word... " >&6; }
15379+if test "${ac_cv_prog_MANIFEST_TOOL+set}" = set; then :
15380+ $as_echo_n "(cached) " >&6
15381+else
15382+ if test -n "$MANIFEST_TOOL"; then
15383+ ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
15384+else
15385+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
15386+for as_dir in $PATH
15387+do
15388+ IFS=$as_save_IFS
15389+ test -z "$as_dir" && as_dir=.
15390+ for ac_exec_ext in '' $ac_executable_extensions; do
15391+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
15392+ ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
15393+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
15394+ break 2
15395+ fi
15396+done
15397+ done
15398+IFS=$as_save_IFS
15399+
15400+fi
15401+fi
15402+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
15403+if test -n "$MANIFEST_TOOL"; then
15404+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
15405+$as_echo "$MANIFEST_TOOL" >&6; }
15406+else
15407+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
15408+$as_echo "no" >&6; }
15409+fi
15410+
15411+
15412+fi
15413+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
15414+ ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
15415+ # Extract the first word of "mt", so it can be a program name with args.
15416+set dummy mt; ac_word=$2
15417+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
15418+$as_echo_n "checking for $ac_word... " >&6; }
15419+if test "${ac_cv_prog_ac_ct_MANIFEST_TOOL+set}" = set; then :
15420+ $as_echo_n "(cached) " >&6
15421+else
15422+ if test -n "$ac_ct_MANIFEST_TOOL"; then
15423+ ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
15424+else
15425+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
15426+for as_dir in $PATH
15427+do
15428+ IFS=$as_save_IFS
15429+ test -z "$as_dir" && as_dir=.
15430+ for ac_exec_ext in '' $ac_executable_extensions; do
15431+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
15432+ ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
15433+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
15434+ break 2
15435+ fi
15436+done
15437+ done
15438+IFS=$as_save_IFS
15439+
15440+fi
15441+fi
15442+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
15443+if test -n "$ac_ct_MANIFEST_TOOL"; then
15444+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
15445+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
15446+else
15447+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
15448+$as_echo "no" >&6; }
15449+fi
15450+
15451+ if test "x$ac_ct_MANIFEST_TOOL" = x; then
15452+ MANIFEST_TOOL=":"
15453+ else
15454+ case $cross_compiling:$ac_tool_warned in
15455+yes:)
15456+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
15457+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
15458+ac_tool_warned=yes ;;
15459+esac
15460+ MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
15461+ fi
15462+else
15463+ MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
15464+fi
15465+
15466+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
15467+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
15468+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
15469+if test "${lt_cv_path_mainfest_tool+set}" = set; then :
15470+ $as_echo_n "(cached) " >&6
15471+else
15472+ lt_cv_path_mainfest_tool=no
15473+ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
15474+ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
15475+ cat conftest.err >&5
15476+ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
15477+ lt_cv_path_mainfest_tool=yes
15478+ fi
15479+ rm -f conftest*
15480+fi
15481+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
15482+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
15483+if test "x$lt_cv_path_mainfest_tool" != xyes; then
15484+ MANIFEST_TOOL=:
15485+fi
15486+
15487+
15488+
15489+
15490+
15491
15492 case $host_os in
15493 rhapsody* | darwin*)
15494@@ -7593,6 +8085,8 @@
15495 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
15496 echo "$AR cru libconftest.a conftest.o" >&5
15497 $AR cru libconftest.a conftest.o 2>&5
15498+ echo "$RANLIB libconftest.a" >&5
15499+ $RANLIB libconftest.a 2>&5
15500 cat > conftest.c << _LT_EOF
15501 int main() { return 0;}
15502 _LT_EOF
15503@@ -7788,7 +8282,8 @@
15504 LIBTOOL_DEPS="$ltmain"
15505
15506 # Always use our own libtool.
15507-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
15508+LIBTOOL='$(SHELL) $(top_builddir)'
15509+LIBTOOL="$LIBTOOL/${host_alias}-libtool"
15510
15511
15512
15513@@ -7877,7 +8372,7 @@
15514 esac
15515
15516 # Global variables:
15517-ofile=libtool
15518+ofile=${host_alias}-libtool
15519 can_build_shared=yes
15520
15521 # All known linkers require a `.a' archive for static linking (except MSVC,
15522@@ -8175,8 +8670,6 @@
15523 lt_prog_compiler_pic=
15524 lt_prog_compiler_static=
15525
15526-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
15527-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
15528
15529 if test "$GCC" = yes; then
15530 lt_prog_compiler_wl='-Wl,'
15531@@ -8342,6 +8835,12 @@
15532 lt_prog_compiler_pic='--shared'
15533 lt_prog_compiler_static='--static'
15534 ;;
15535+ nagfor*)
15536+ # NAG Fortran compiler
15537+ lt_prog_compiler_wl='-Wl,-Wl,,'
15538+ lt_prog_compiler_pic='-PIC'
15539+ lt_prog_compiler_static='-Bstatic'
15540+ ;;
15541 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
15542 # Portland Group compilers (*not* the Pentium gcc compiler,
15543 # which looks to be a dead project)
15544@@ -8404,7 +8903,7 @@
15545 lt_prog_compiler_pic='-KPIC'
15546 lt_prog_compiler_static='-Bstatic'
15547 case $cc_basename in
15548- f77* | f90* | f95*)
15549+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
15550 lt_prog_compiler_wl='-Qoption ld ';;
15551 *)
15552 lt_prog_compiler_wl='-Wl,';;
15553@@ -8461,13 +8960,17 @@
15554 lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
15555 ;;
15556 esac
15557-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
15558-$as_echo "$lt_prog_compiler_pic" >&6; }
15559-
15560-
15561-
15562-
15563
15564+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
15565+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
15566+if test "${lt_cv_prog_compiler_pic+set}" = set; then :
15567+ $as_echo_n "(cached) " >&6
15568+else
15569+ lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
15570+fi
15571+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
15572+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
15573+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
15574
15575 #
15576 # Check to make sure the PIC flag actually works.
15577@@ -8528,6 +9031,11 @@
15578
15579
15580
15581+
15582+
15583+
15584+
15585+
15586 #
15587 # Check to make sure the static flag actually works.
15588 #
15589@@ -8878,7 +9386,8 @@
15590 allow_undefined_flag=unsupported
15591 always_export_symbols=no
15592 enable_shared_with_static_runtimes=yes
15593- export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
15594+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
15595+ exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
15596
15597 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
15598 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
15599@@ -8926,7 +9435,7 @@
15600 if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
15601 && test "$tmp_diet" = no
15602 then
15603- tmp_addflag=
15604+ tmp_addflag=' $pic_flag'
15605 tmp_sharedflag='-shared'
15606 case $cc_basename,$host_cpu in
15607 pgcc*) # Portland Group C compiler
15608@@ -8977,12 +9486,12 @@
15609 whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
15610 hardcode_libdir_flag_spec=
15611 hardcode_libdir_flag_spec_ld='-rpath $libdir'
15612- archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
15613+ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
15614 if test "x$supports_anon_versioning" = xyes; then
15615 archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
15616 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
15617 echo "local: *; };" >> $output_objdir/$libname.ver~
15618- $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
15619+ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
15620 fi
15621 ;;
15622 esac
15623@@ -8996,8 +9505,8 @@
15624 archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
15625 wlarc=
15626 else
15627- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
15628- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
15629+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
15630+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
15631 fi
15632 ;;
15633
15634@@ -9015,8 +9524,8 @@
15635
15636 _LT_EOF
15637 elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
15638- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
15639- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
15640+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
15641+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
15642 else
15643 ld_shlibs=no
15644 fi
15645@@ -9062,8 +9571,8 @@
15646
15647 *)
15648 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
15649- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
15650- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
15651+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
15652+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
15653 else
15654 ld_shlibs=no
15655 fi
15656@@ -9193,7 +9702,13 @@
15657 allow_undefined_flag='-berok'
15658 # Determine the default libpath from the value encoded in an
15659 # empty executable.
15660- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
15661+ if test "${lt_cv_aix_libpath+set}" = set; then
15662+ aix_libpath=$lt_cv_aix_libpath
15663+else
15664+ if test "${lt_cv_aix_libpath_+set}" = set; then :
15665+ $as_echo_n "(cached) " >&6
15666+else
15667+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
15668 /* end confdefs.h. */
15669
15670 int
15671@@ -9206,22 +9721,29 @@
15672 _ACEOF
15673 if ac_fn_c_try_link "$LINENO"; then :
15674
15675-lt_aix_libpath_sed='
15676- /Import File Strings/,/^$/ {
15677- /^0/ {
15678- s/^0 *\(.*\)$/\1/
15679- p
15680- }
15681- }'
15682-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
15683-# Check for a 64-bit object if we didn't find anything.
15684-if test -z "$aix_libpath"; then
15685- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
15686-fi
15687+ lt_aix_libpath_sed='
15688+ /Import File Strings/,/^$/ {
15689+ /^0/ {
15690+ s/^0 *\([^ ]*\) *$/\1/
15691+ p
15692+ }
15693+ }'
15694+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
15695+ # Check for a 64-bit object if we didn't find anything.
15696+ if test -z "$lt_cv_aix_libpath_"; then
15697+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
15698+ fi
15699 fi
15700 rm -f core conftest.err conftest.$ac_objext \
15701 conftest$ac_exeext conftest.$ac_ext
15702-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
15703+ if test -z "$lt_cv_aix_libpath_"; then
15704+ lt_cv_aix_libpath_="/usr/lib:/lib"
15705+ fi
15706+
15707+fi
15708+
15709+ aix_libpath=$lt_cv_aix_libpath_
15710+fi
15711
15712 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
15713 archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
15714@@ -9233,7 +9755,13 @@
15715 else
15716 # Determine the default libpath from the value encoded in an
15717 # empty executable.
15718- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
15719+ if test "${lt_cv_aix_libpath+set}" = set; then
15720+ aix_libpath=$lt_cv_aix_libpath
15721+else
15722+ if test "${lt_cv_aix_libpath_+set}" = set; then :
15723+ $as_echo_n "(cached) " >&6
15724+else
15725+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
15726 /* end confdefs.h. */
15727
15728 int
15729@@ -9246,22 +9774,29 @@
15730 _ACEOF
15731 if ac_fn_c_try_link "$LINENO"; then :
15732
15733-lt_aix_libpath_sed='
15734- /Import File Strings/,/^$/ {
15735- /^0/ {
15736- s/^0 *\(.*\)$/\1/
15737- p
15738- }
15739- }'
15740-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
15741-# Check for a 64-bit object if we didn't find anything.
15742-if test -z "$aix_libpath"; then
15743- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
15744-fi
15745+ lt_aix_libpath_sed='
15746+ /Import File Strings/,/^$/ {
15747+ /^0/ {
15748+ s/^0 *\([^ ]*\) *$/\1/
15749+ p
15750+ }
15751+ }'
15752+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
15753+ # Check for a 64-bit object if we didn't find anything.
15754+ if test -z "$lt_cv_aix_libpath_"; then
15755+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
15756+ fi
15757 fi
15758 rm -f core conftest.err conftest.$ac_objext \
15759 conftest$ac_exeext conftest.$ac_ext
15760-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
15761+ if test -z "$lt_cv_aix_libpath_"; then
15762+ lt_cv_aix_libpath_="/usr/lib:/lib"
15763+ fi
15764+
15765+fi
15766+
15767+ aix_libpath=$lt_cv_aix_libpath_
15768+fi
15769
15770 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
15771 # Warning - without using the other run time loading flags,
15772@@ -9306,20 +9841,63 @@
15773 # Microsoft Visual C++.
15774 # hardcode_libdir_flag_spec is actually meaningless, as there is
15775 # no search path for DLLs.
15776- hardcode_libdir_flag_spec=' '
15777- allow_undefined_flag=unsupported
15778- # Tell ltmain to make .lib files, not .a files.
15779- libext=lib
15780- # Tell ltmain to make .dll files, not .so files.
15781- shrext_cmds=".dll"
15782- # FIXME: Setting linknames here is a bad hack.
15783- archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
15784- # The linker will automatically build a .lib file if we build a DLL.
15785- old_archive_from_new_cmds='true'
15786- # FIXME: Should let the user specify the lib program.
15787- old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
15788- fix_srcfile_path='`cygpath -w "$srcfile"`'
15789- enable_shared_with_static_runtimes=yes
15790+ case $cc_basename in
15791+ cl*)
15792+ # Native MSVC
15793+ hardcode_libdir_flag_spec=' '
15794+ allow_undefined_flag=unsupported
15795+ always_export_symbols=yes
15796+ file_list_spec='@'
15797+ # Tell ltmain to make .lib files, not .a files.
15798+ libext=lib
15799+ # Tell ltmain to make .dll files, not .so files.
15800+ shrext_cmds=".dll"
15801+ # FIXME: Setting linknames here is a bad hack.
15802+ archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
15803+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
15804+ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
15805+ else
15806+ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
15807+ fi~
15808+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
15809+ linknames='
15810+ # The linker will not automatically build a static lib if we build a DLL.
15811+ # _LT_TAGVAR(old_archive_from_new_cmds, )='true'
15812+ enable_shared_with_static_runtimes=yes
15813+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
15814+ # Don't use ranlib
15815+ old_postinstall_cmds='chmod 644 $oldlib'
15816+ postlink_cmds='lt_outputfile="@OUTPUT@"~
15817+ lt_tool_outputfile="@TOOL_OUTPUT@"~
15818+ case $lt_outputfile in
15819+ *.exe|*.EXE) ;;
15820+ *)
15821+ lt_outputfile="$lt_outputfile.exe"
15822+ lt_tool_outputfile="$lt_tool_outputfile.exe"
15823+ ;;
15824+ esac~
15825+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
15826+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
15827+ $RM "$lt_outputfile.manifest";
15828+ fi'
15829+ ;;
15830+ *)
15831+ # Assume MSVC wrapper
15832+ hardcode_libdir_flag_spec=' '
15833+ allow_undefined_flag=unsupported
15834+ # Tell ltmain to make .lib files, not .a files.
15835+ libext=lib
15836+ # Tell ltmain to make .dll files, not .so files.
15837+ shrext_cmds=".dll"
15838+ # FIXME: Setting linknames here is a bad hack.
15839+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
15840+ # The linker will automatically build a .lib file if we build a DLL.
15841+ old_archive_from_new_cmds='true'
15842+ # FIXME: Should let the user specify the lib program.
15843+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
15844+ enable_shared_with_static_runtimes=yes
15845+ ;;
15846+ esac
15847 ;;
15848
15849 darwin* | rhapsody*)
15850@@ -9380,7 +9958,7 @@
15851
15852 # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
15853 freebsd* | dragonfly*)
15854- archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
15855+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
15856 hardcode_libdir_flag_spec='-R$libdir'
15857 hardcode_direct=yes
15858 hardcode_shlibpath_var=no
15859@@ -9388,7 +9966,7 @@
15860
15861 hpux9*)
15862 if test "$GCC" = yes; then
15863- archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
15864+ archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
15865 else
15866 archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
15867 fi
15868@@ -9404,7 +9982,7 @@
15869
15870 hpux10*)
15871 if test "$GCC" = yes && test "$with_gnu_ld" = no; then
15872- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
15873+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
15874 else
15875 archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
15876 fi
15877@@ -9428,10 +10006,10 @@
15878 archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
15879 ;;
15880 ia64*)
15881- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
15882+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
15883 ;;
15884 *)
15885- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
15886+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
15887 ;;
15888 esac
15889 else
15890@@ -9510,23 +10088,36 @@
15891
15892 irix5* | irix6* | nonstopux*)
15893 if test "$GCC" = yes; then
15894- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
15895+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
15896 # Try to use the -exported_symbol ld option, if it does not
15897 # work, assume that -exports_file does not work either and
15898 # implicitly export all symbols.
15899- save_LDFLAGS="$LDFLAGS"
15900- LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
15901- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
15902+ # This should be the same for all languages, so no per-tag cache variable.
15903+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
15904+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
15905+if test "${lt_cv_irix_exported_symbol+set}" = set; then :
15906+ $as_echo_n "(cached) " >&6
15907+else
15908+ save_LDFLAGS="$LDFLAGS"
15909+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
15910+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
15911 /* end confdefs.h. */
15912-int foo(void) {}
15913+int foo (void) { return 0; }
15914 _ACEOF
15915 if ac_fn_c_try_link "$LINENO"; then :
15916- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
15917-
15918+ lt_cv_irix_exported_symbol=yes
15919+else
15920+ lt_cv_irix_exported_symbol=no
15921 fi
15922 rm -f core conftest.err conftest.$ac_objext \
15923 conftest$ac_exeext conftest.$ac_ext
15924- LDFLAGS="$save_LDFLAGS"
15925+ LDFLAGS="$save_LDFLAGS"
15926+fi
15927+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
15928+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
15929+ if test "$lt_cv_irix_exported_symbol" = yes; then
15930+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
15931+ fi
15932 else
15933 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
15934 archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
15935@@ -9611,7 +10202,7 @@
15936 osf4* | osf5*) # as osf3* with the addition of -msym flag
15937 if test "$GCC" = yes; then
15938 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
15939- archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
15940+ archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
15941 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
15942 else
15943 allow_undefined_flag=' -expect_unresolved \*'
15944@@ -9630,9 +10221,9 @@
15945 no_undefined_flag=' -z defs'
15946 if test "$GCC" = yes; then
15947 wlarc='${wl}'
15948- archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
15949+ archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
15950 archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
15951- $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
15952+ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
15953 else
15954 case `$CC -V 2>&1` in
15955 *"Compilers 5.0"*)
15956@@ -10208,8 +10799,9 @@
15957 need_version=no
15958 need_lib_prefix=no
15959
15960- case $GCC,$host_os in
15961- yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
15962+ case $GCC,$cc_basename in
15963+ yes,*)
15964+ # gcc
15965 library_names_spec='$libname.dll.a'
15966 # DLL is installed to $(libdir)/../bin by postinstall_cmds
15967 postinstall_cmds='base_file=`basename \${file}`~
15968@@ -10242,13 +10834,71 @@
15969 library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
15970 ;;
15971 esac
15972+ dynamic_linker='Win32 ld.exe'
15973+ ;;
15974+
15975+ *,cl*)
15976+ # Native MSVC
15977+ libname_spec='$name'
15978+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
15979+ library_names_spec='${libname}.dll.lib'
15980+
15981+ case $build_os in
15982+ mingw*)
15983+ sys_lib_search_path_spec=
15984+ lt_save_ifs=$IFS
15985+ IFS=';'
15986+ for lt_path in $LIB
15987+ do
15988+ IFS=$lt_save_ifs
15989+ # Let DOS variable expansion print the short 8.3 style file name.
15990+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
15991+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
15992+ done
15993+ IFS=$lt_save_ifs
15994+ # Convert to MSYS style.
15995+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
15996+ ;;
15997+ cygwin*)
15998+ # Convert to unix form, then to dos form, then back to unix form
15999+ # but this time dos style (no spaces!) so that the unix form looks
16000+ # like /cygdrive/c/PROGRA~1:/cygdr...
16001+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
16002+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
16003+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
16004+ ;;
16005+ *)
16006+ sys_lib_search_path_spec="$LIB"
16007+ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
16008+ # It is most probably a Windows format PATH.
16009+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
16010+ else
16011+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
16012+ fi
16013+ # FIXME: find the short name or the path components, as spaces are
16014+ # common. (e.g. "Program Files" -> "PROGRA~1")
16015+ ;;
16016+ esac
16017+
16018+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
16019+ postinstall_cmds='base_file=`basename \${file}`~
16020+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
16021+ dldir=$destdir/`dirname \$dlpath`~
16022+ test -d \$dldir || mkdir -p \$dldir~
16023+ $install_prog $dir/$dlname \$dldir/$dlname'
16024+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
16025+ dlpath=$dir/\$dldll~
16026+ $RM \$dlpath'
16027+ shlibpath_overrides_runpath=yes
16028+ dynamic_linker='Win32 link.exe'
16029 ;;
16030
16031 *)
16032+ # Assume MSVC wrapper
16033 library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
16034+ dynamic_linker='Win32 ld.exe'
16035 ;;
16036 esac
16037- dynamic_linker='Win32 ld.exe'
16038 # FIXME: first we should search . and the directory the executable is in
16039 shlibpath_var=PATH
16040 ;;
16041@@ -10340,7 +10990,7 @@
16042 soname_spec='${libname}${release}${shared_ext}$major'
16043 shlibpath_var=LIBRARY_PATH
16044 shlibpath_overrides_runpath=yes
16045- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
16046+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
16047 hardcode_into_libs=yes
16048 ;;
16049
16050@@ -11180,10 +11830,10 @@
16051 /* When -fvisbility=hidden is used, assume the code has been annotated
16052 correspondingly for the symbols needed. */
16053 #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
16054-void fnord () __attribute__((visibility("default")));
16055+int fnord () __attribute__((visibility("default")));
16056 #endif
16057
16058-void fnord () { int i=42; }
16059+int fnord () { return 42; }
16060 int main ()
16061 {
16062 void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
16063@@ -11286,10 +11936,10 @@
16064 /* When -fvisbility=hidden is used, assume the code has been annotated
16065 correspondingly for the symbols needed. */
16066 #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
16067-void fnord () __attribute__((visibility("default")));
16068+int fnord () __attribute__((visibility("default")));
16069 #endif
16070
16071-void fnord () { int i=42; }
16072+int fnord () { return 42; }
16073 int main ()
16074 {
16075 void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
16076@@ -12831,13 +13481,20 @@
16077 lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
16078 lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
16079 lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
16080+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
16081+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
16082 reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
16083 reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
16084 OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
16085 deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
16086 file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
16087+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
16088+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
16089+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
16090+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
16091 AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
16092 AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
16093+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
16094 STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
16095 RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
16096 old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
16097@@ -12852,14 +13509,17 @@
16098 lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
16099 lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
16100 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
16101+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
16102+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
16103 objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
16104 MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
16105 lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
16106-lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
16107 lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
16108+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
16109 lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
16110 lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
16111 need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
16112+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
16113 DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
16114 NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
16115 LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
16116@@ -12892,12 +13552,12 @@
16117 hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
16118 inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
16119 link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
16120-fix_srcfile_path='`$ECHO "$fix_srcfile_path" | $SED "$delay_single_quote_subst"`'
16121 always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
16122 export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
16123 exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
16124 include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
16125 prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
16126+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
16127 file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
16128 variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
16129 need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
16130@@ -12952,8 +13612,13 @@
16131 OBJDUMP \
16132 deplibs_check_method \
16133 file_magic_cmd \
16134+file_magic_glob \
16135+want_nocaseglob \
16136+DLLTOOL \
16137+sharedlib_from_linklib_cmd \
16138 AR \
16139 AR_FLAGS \
16140+archiver_list_spec \
16141 STRIP \
16142 RANLIB \
16143 CC \
16144@@ -12963,12 +13628,14 @@
16145 lt_cv_sys_global_symbol_to_cdecl \
16146 lt_cv_sys_global_symbol_to_c_name_address \
16147 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
16148+nm_file_list_spec \
16149 lt_prog_compiler_no_builtin_flag \
16150-lt_prog_compiler_wl \
16151 lt_prog_compiler_pic \
16152+lt_prog_compiler_wl \
16153 lt_prog_compiler_static \
16154 lt_cv_prog_compiler_c_o \
16155 need_locks \
16156+MANIFEST_TOOL \
16157 DSYMUTIL \
16158 NMEDIT \
16159 LIPO \
16160@@ -12984,7 +13651,6 @@
16161 hardcode_libdir_flag_spec \
16162 hardcode_libdir_flag_spec_ld \
16163 hardcode_libdir_separator \
16164-fix_srcfile_path \
16165 exclude_expsyms \
16166 include_expsyms \
16167 file_list_spec \
16168@@ -13020,6 +13686,7 @@
16169 module_expsym_cmds \
16170 export_symbols_cmds \
16171 prelink_cmds \
16172+postlink_cmds \
16173 postinstall_cmds \
16174 postuninstall_cmds \
16175 finish_cmds \
16176@@ -13776,7 +14443,8 @@
16177 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
16178 #
16179 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
16180-# 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
16181+# 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
16182+# Inc.
16183 # Written by Gordon Matzigkeit, 1996
16184 #
16185 # This file is part of GNU Libtool.
16186@@ -13879,19 +14547,42 @@
16187 # turn newlines into spaces.
16188 NL2SP=$lt_lt_NL2SP
16189
16190+# convert \$build file names to \$host format.
16191+to_host_file_cmd=$lt_cv_to_host_file_cmd
16192+
16193+# convert \$build files to toolchain format.
16194+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
16195+
16196 # An object symbol dumper.
16197 OBJDUMP=$lt_OBJDUMP
16198
16199 # Method to check whether dependent libraries are shared objects.
16200 deplibs_check_method=$lt_deplibs_check_method
16201
16202-# Command to use when deplibs_check_method == "file_magic".
16203+# Command to use when deplibs_check_method = "file_magic".
16204 file_magic_cmd=$lt_file_magic_cmd
16205
16206+# How to find potential files when deplibs_check_method = "file_magic".
16207+file_magic_glob=$lt_file_magic_glob
16208+
16209+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
16210+want_nocaseglob=$lt_want_nocaseglob
16211+
16212+# DLL creation program.
16213+DLLTOOL=$lt_DLLTOOL
16214+
16215+# Command to associate shared and link libraries.
16216+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
16217+
16218 # The archiver.
16219 AR=$lt_AR
16220+
16221+# Flags to create an archive.
16222 AR_FLAGS=$lt_AR_FLAGS
16223
16224+# How to feed a file listing to the archiver.
16225+archiver_list_spec=$lt_archiver_list_spec
16226+
16227 # A symbol stripping program.
16228 STRIP=$lt_STRIP
16229
16230@@ -13921,6 +14612,12 @@
16231 # Transform the output of nm in a C name address pair when lib prefix is needed.
16232 global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
16233
16234+# Specify filename containing input files for \$NM.
16235+nm_file_list_spec=$lt_nm_file_list_spec
16236+
16237+# The root where to search for dependent libraries,and in which our libraries should be installed.
16238+lt_sysroot=$lt_sysroot
16239+
16240 # The name of the directory that contains temporary libtool files.
16241 objdir=$objdir
16242
16243@@ -13930,6 +14627,9 @@
16244 # Must we lock files when doing compilation?
16245 need_locks=$lt_need_locks
16246
16247+# Manifest tool.
16248+MANIFEST_TOOL=$lt_MANIFEST_TOOL
16249+
16250 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
16251 DSYMUTIL=$lt_DSYMUTIL
16252
16253@@ -14044,12 +14744,12 @@
16254 # Compiler flag to turn off builtin functions.
16255 no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
16256
16257-# How to pass a linker flag through the compiler.
16258-wl=$lt_lt_prog_compiler_wl
16259-
16260 # Additional compiler flags for building library objects.
16261 pic_flag=$lt_lt_prog_compiler_pic
16262
16263+# How to pass a linker flag through the compiler.
16264+wl=$lt_lt_prog_compiler_wl
16265+
16266 # Compiler flag to prevent dynamic linking.
16267 link_static_flag=$lt_lt_prog_compiler_static
16268
16269@@ -14136,9 +14836,6 @@
16270 # Whether libtool must link a program against all its dependency libraries.
16271 link_all_deplibs=$link_all_deplibs
16272
16273-# Fix the shell variable \$srcfile for the compiler.
16274-fix_srcfile_path=$lt_fix_srcfile_path
16275-
16276 # Set to "yes" if exported symbols are required.
16277 always_export_symbols=$always_export_symbols
16278
16279@@ -14154,6 +14851,9 @@
16280 # Commands necessary for linking programs (against libraries) with templates.
16281 prelink_cmds=$lt_prelink_cmds
16282
16283+# Commands necessary for finishing linking programs.
16284+postlink_cmds=$lt_postlink_cmds
16285+
16286 # Specify filename containing input files.
16287 file_list_spec=$lt_file_list_spec
16288
16289@@ -14186,210 +14886,169 @@
16290 # if finds mixed CR/LF and LF-only lines. Since sed operates in
16291 # text mode, it properly converts lines to CR/LF. This bash problem
16292 # is reportedly fixed, but why not run on old versions too?
16293- sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
16294- || (rm -f "$cfgfile"; exit 1)
16295-
16296- case $xsi_shell in
16297- yes)
16298- cat << \_LT_EOF >> "$cfgfile"
16299-
16300-# func_dirname file append nondir_replacement
16301-# Compute the dirname of FILE. If nonempty, add APPEND to the result,
16302-# otherwise set result to NONDIR_REPLACEMENT.
16303-func_dirname ()
16304-{
16305- case ${1} in
16306- */*) func_dirname_result="${1%/*}${2}" ;;
16307- * ) func_dirname_result="${3}" ;;
16308- esac
16309-}
16310-
16311-# func_basename file
16312-func_basename ()
16313-{
16314- func_basename_result="${1##*/}"
16315-}
16316-
16317-# func_dirname_and_basename file append nondir_replacement
16318-# perform func_basename and func_dirname in a single function
16319-# call:
16320-# dirname: Compute the dirname of FILE. If nonempty,
16321-# add APPEND to the result, otherwise set result
16322-# to NONDIR_REPLACEMENT.
16323-# value returned in "$func_dirname_result"
16324-# basename: Compute filename of FILE.
16325-# value retuned in "$func_basename_result"
16326-# Implementation must be kept synchronized with func_dirname
16327-# and func_basename. For efficiency, we do not delegate to
16328-# those functions but instead duplicate the functionality here.
16329-func_dirname_and_basename ()
16330-{
16331- case ${1} in
16332- */*) func_dirname_result="${1%/*}${2}" ;;
16333- * ) func_dirname_result="${3}" ;;
16334- esac
16335- func_basename_result="${1##*/}"
16336-}
16337-
16338-# func_stripname prefix suffix name
16339-# strip PREFIX and SUFFIX off of NAME.
16340-# PREFIX and SUFFIX must not contain globbing or regex special
16341-# characters, hashes, percent signs, but SUFFIX may contain a leading
16342-# dot (in which case that matches only a dot).
16343-func_stripname ()
16344-{
16345- # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
16346- # positional parameters, so assign one to ordinary parameter first.
16347- func_stripname_result=${3}
16348- func_stripname_result=${func_stripname_result#"${1}"}
16349- func_stripname_result=${func_stripname_result%"${2}"}
16350-}
16351-
16352-# func_opt_split
16353-func_opt_split ()
16354-{
16355- func_opt_split_opt=${1%%=*}
16356- func_opt_split_arg=${1#*=}
16357-}
16358-
16359-# func_lo2o object
16360-func_lo2o ()
16361-{
16362- case ${1} in
16363- *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
16364- *) func_lo2o_result=${1} ;;
16365- esac
16366-}
16367-
16368-# func_xform libobj-or-source
16369-func_xform ()
16370-{
16371- func_xform_result=${1%.*}.lo
16372-}
16373-
16374-# func_arith arithmetic-term...
16375-func_arith ()
16376-{
16377- func_arith_result=$(( $* ))
16378-}
16379-
16380-# func_len string
16381-# STRING may not start with a hyphen.
16382-func_len ()
16383-{
16384- func_len_result=${#1}
16385-}
16386-
16387-_LT_EOF
16388- ;;
16389- *) # Bourne compatible functions.
16390- cat << \_LT_EOF >> "$cfgfile"
16391-
16392-# func_dirname file append nondir_replacement
16393-# Compute the dirname of FILE. If nonempty, add APPEND to the result,
16394-# otherwise set result to NONDIR_REPLACEMENT.
16395-func_dirname ()
16396-{
16397- # Extract subdirectory from the argument.
16398- func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
16399- if test "X$func_dirname_result" = "X${1}"; then
16400- func_dirname_result="${3}"
16401- else
16402- func_dirname_result="$func_dirname_result${2}"
16403- fi
16404-}
16405-
16406-# func_basename file
16407-func_basename ()
16408-{
16409- func_basename_result=`$ECHO "${1}" | $SED "$basename"`
16410-}
16411-
16412-
16413-# func_stripname prefix suffix name
16414-# strip PREFIX and SUFFIX off of NAME.
16415-# PREFIX and SUFFIX must not contain globbing or regex special
16416-# characters, hashes, percent signs, but SUFFIX may contain a leading
16417-# dot (in which case that matches only a dot).
16418-# func_strip_suffix prefix name
16419-func_stripname ()
16420-{
16421- case ${2} in
16422- .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
16423- *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
16424- esac
16425-}
16426-
16427-# sed scripts:
16428-my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
16429-my_sed_long_arg='1s/^-[^=]*=//'
16430-
16431-# func_opt_split
16432-func_opt_split ()
16433-{
16434- func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"`
16435- func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"`
16436-}
16437-
16438-# func_lo2o object
16439-func_lo2o ()
16440-{
16441- func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
16442-}
16443-
16444-# func_xform libobj-or-source
16445-func_xform ()
16446-{
16447- func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
16448-}
16449-
16450-# func_arith arithmetic-term...
16451-func_arith ()
16452-{
16453- func_arith_result=`expr "$@"`
16454-}
16455-
16456-# func_len string
16457-# STRING may not start with a hyphen.
16458-func_len ()
16459-{
16460- func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
16461-}
16462-
16463-_LT_EOF
16464-esac
16465-
16466-case $lt_shell_append in
16467- yes)
16468- cat << \_LT_EOF >> "$cfgfile"
16469-
16470-# func_append var value
16471-# Append VALUE to the end of shell variable VAR.
16472-func_append ()
16473-{
16474- eval "$1+=\$2"
16475-}
16476-_LT_EOF
16477- ;;
16478- *)
16479- cat << \_LT_EOF >> "$cfgfile"
16480-
16481-# func_append var value
16482-# Append VALUE to the end of shell variable VAR.
16483-func_append ()
16484-{
16485- eval "$1=\$$1\$2"
16486-}
16487-
16488-_LT_EOF
16489- ;;
16490- esac
16491+ sed '$q' "$ltmain" >> "$cfgfile" \
16492+ || (rm -f "$cfgfile"; exit 1)
16493
16494+ if test x"$xsi_shell" = xyes; then
16495+ sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
16496+func_dirname ()\
16497+{\
16498+\ case ${1} in\
16499+\ */*) func_dirname_result="${1%/*}${2}" ;;\
16500+\ * ) func_dirname_result="${3}" ;;\
16501+\ esac\
16502+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
16503+ && mv -f "$cfgfile.tmp" "$cfgfile" \
16504+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
16505+test 0 -eq $? || _lt_function_replace_fail=:
16506+
16507+
16508+ sed -e '/^func_basename ()$/,/^} # func_basename /c\
16509+func_basename ()\
16510+{\
16511+\ func_basename_result="${1##*/}"\
16512+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
16513+ && mv -f "$cfgfile.tmp" "$cfgfile" \
16514+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
16515+test 0 -eq $? || _lt_function_replace_fail=:
16516+
16517+
16518+ sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
16519+func_dirname_and_basename ()\
16520+{\
16521+\ case ${1} in\
16522+\ */*) func_dirname_result="${1%/*}${2}" ;;\
16523+\ * ) func_dirname_result="${3}" ;;\
16524+\ esac\
16525+\ func_basename_result="${1##*/}"\
16526+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
16527+ && mv -f "$cfgfile.tmp" "$cfgfile" \
16528+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
16529+test 0 -eq $? || _lt_function_replace_fail=:
16530+
16531+
16532+ sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
16533+func_stripname ()\
16534+{\
16535+\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
16536+\ # positional parameters, so assign one to ordinary parameter first.\
16537+\ func_stripname_result=${3}\
16538+\ func_stripname_result=${func_stripname_result#"${1}"}\
16539+\ func_stripname_result=${func_stripname_result%"${2}"}\
16540+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
16541+ && mv -f "$cfgfile.tmp" "$cfgfile" \
16542+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
16543+test 0 -eq $? || _lt_function_replace_fail=:
16544+
16545+
16546+ sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
16547+func_split_long_opt ()\
16548+{\
16549+\ func_split_long_opt_name=${1%%=*}\
16550+\ func_split_long_opt_arg=${1#*=}\
16551+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
16552+ && mv -f "$cfgfile.tmp" "$cfgfile" \
16553+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
16554+test 0 -eq $? || _lt_function_replace_fail=:
16555+
16556+
16557+ sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
16558+func_split_short_opt ()\
16559+{\
16560+\ func_split_short_opt_arg=${1#??}\
16561+\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
16562+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
16563+ && mv -f "$cfgfile.tmp" "$cfgfile" \
16564+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
16565+test 0 -eq $? || _lt_function_replace_fail=:
16566+
16567+
16568+ sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
16569+func_lo2o ()\
16570+{\
16571+\ case ${1} in\
16572+\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
16573+\ *) func_lo2o_result=${1} ;;\
16574+\ esac\
16575+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
16576+ && mv -f "$cfgfile.tmp" "$cfgfile" \
16577+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
16578+test 0 -eq $? || _lt_function_replace_fail=:
16579+
16580+
16581+ sed -e '/^func_xform ()$/,/^} # func_xform /c\
16582+func_xform ()\
16583+{\
16584+ func_xform_result=${1%.*}.lo\
16585+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
16586+ && mv -f "$cfgfile.tmp" "$cfgfile" \
16587+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
16588+test 0 -eq $? || _lt_function_replace_fail=:
16589+
16590+
16591+ sed -e '/^func_arith ()$/,/^} # func_arith /c\
16592+func_arith ()\
16593+{\
16594+ func_arith_result=$(( $* ))\
16595+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
16596+ && mv -f "$cfgfile.tmp" "$cfgfile" \
16597+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
16598+test 0 -eq $? || _lt_function_replace_fail=:
16599+
16600+
16601+ sed -e '/^func_len ()$/,/^} # func_len /c\
16602+func_len ()\
16603+{\
16604+ func_len_result=${#1}\
16605+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
16606+ && mv -f "$cfgfile.tmp" "$cfgfile" \
16607+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
16608+test 0 -eq $? || _lt_function_replace_fail=:
16609+
16610+fi
16611+
16612+if test x"$lt_shell_append" = xyes; then
16613+ sed -e '/^func_append ()$/,/^} # func_append /c\
16614+func_append ()\
16615+{\
16616+ eval "${1}+=\\${2}"\
16617+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
16618+ && mv -f "$cfgfile.tmp" "$cfgfile" \
16619+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
16620+test 0 -eq $? || _lt_function_replace_fail=:
16621+
16622+
16623+ sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
16624+func_append_quoted ()\
16625+{\
16626+\ func_quote_for_eval "${2}"\
16627+\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
16628+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
16629+ && mv -f "$cfgfile.tmp" "$cfgfile" \
16630+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
16631+test 0 -eq $? || _lt_function_replace_fail=:
16632+
16633+
16634+ # Save a `func_append' function call where possible by direct use of '+='
16635+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
16636+ && mv -f "$cfgfile.tmp" "$cfgfile" \
16637+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
16638+ test 0 -eq $? || _lt_function_replace_fail=:
16639+else
16640+ # Save a `func_append' function call even when '+=' is not available
16641+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
16642+ && mv -f "$cfgfile.tmp" "$cfgfile" \
16643+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
16644+ test 0 -eq $? || _lt_function_replace_fail=:
16645+fi
16646+
16647+if test x"$_lt_function_replace_fail" = x":"; then
16648+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
16649+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
16650+fi
16651
16652- sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
16653- || (rm -f "$cfgfile"; exit 1)
16654
16655- mv -f "$cfgfile" "$ofile" ||
16656+ mv -f "$cfgfile" "$ofile" ||
16657 (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
16658 chmod +x "$ofile"
16659
16660Index: binutils-2.24/ld/configure
16661===================================================================
16662--- binutils-2.24.orig/ld/configure 2013-11-04 07:33:39.000000000 -0800
16663+++ binutils-2.24/ld/configure 2013-12-15 11:12:06.120451266 -0800
16664@@ -646,8 +646,11 @@
16665 LIPO
16666 NMEDIT
16667 DSYMUTIL
16668+MANIFEST_TOOL
16669 RANLIB
16670+ac_ct_AR
16671 AR
16672+DLLTOOL
16673 OBJDUMP
16674 LN_S
16675 NM
16676@@ -785,6 +788,7 @@
16677 with_pic
16678 enable_fast_install
16679 with_gnu_ld
16680+with_libtool_sysroot
16681 enable_libtool_lock
16682 enable_nls
16683 enable_initfini_array
16684@@ -1452,6 +1456,8 @@
16685 --with-pic try to use only PIC/non-PIC objects [default=use
16686 both]
16687 --with-gnu-ld assume the C compiler uses GNU ld [default=no]
16688+ --with-libtool-sysroot=DIR Search for dependent libraries within DIR
16689+ (or the compiler's sysroot if not specified).
16690 --with-zlib include zlib support (auto/yes/no) default=auto
16691
16692 Some influential environment variables:
16693@@ -6125,8 +6131,8 @@
16694
16695
16696
16697-macro_version='2.2.7a'
16698-macro_revision='1.3134'
16699+macro_version='2.4'
16700+macro_revision='1.3293'
16701
16702
16703
16704@@ -6166,7 +6172,7 @@
16705 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
16706 $as_echo_n "checking how to print strings... " >&6; }
16707 # Test print first, because it will be a builtin if present.
16708-if test "X`print -r -- -n 2>/dev/null`" = X-n && \
16709+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
16710 test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
16711 ECHO='print -r --'
16712 elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
16713@@ -6852,8 +6858,8 @@
16714 # Try some XSI features
16715 xsi_shell=no
16716 ( _lt_dummy="a/b/c"
16717- test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
16718- = c,a/b,, \
16719+ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
16720+ = c,a/b,b/c, \
16721 && eval 'test $(( 1 + 1 )) -eq 2 \
16722 && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
16723 && xsi_shell=yes
16724@@ -6902,6 +6908,80 @@
16725
16726
16727
16728+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
16729+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
16730+if test "${lt_cv_to_host_file_cmd+set}" = set; then :
16731+ $as_echo_n "(cached) " >&6
16732+else
16733+ case $host in
16734+ *-*-mingw* )
16735+ case $build in
16736+ *-*-mingw* ) # actually msys
16737+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
16738+ ;;
16739+ *-*-cygwin* )
16740+ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
16741+ ;;
16742+ * ) # otherwise, assume *nix
16743+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
16744+ ;;
16745+ esac
16746+ ;;
16747+ *-*-cygwin* )
16748+ case $build in
16749+ *-*-mingw* ) # actually msys
16750+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
16751+ ;;
16752+ *-*-cygwin* )
16753+ lt_cv_to_host_file_cmd=func_convert_file_noop
16754+ ;;
16755+ * ) # otherwise, assume *nix
16756+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
16757+ ;;
16758+ esac
16759+ ;;
16760+ * ) # unhandled hosts (and "normal" native builds)
16761+ lt_cv_to_host_file_cmd=func_convert_file_noop
16762+ ;;
16763+esac
16764+
16765+fi
16766+
16767+to_host_file_cmd=$lt_cv_to_host_file_cmd
16768+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
16769+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
16770+
16771+
16772+
16773+
16774+
16775+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
16776+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
16777+if test "${lt_cv_to_tool_file_cmd+set}" = set; then :
16778+ $as_echo_n "(cached) " >&6
16779+else
16780+ #assume ordinary cross tools, or native build.
16781+lt_cv_to_tool_file_cmd=func_convert_file_noop
16782+case $host in
16783+ *-*-mingw* )
16784+ case $build in
16785+ *-*-mingw* ) # actually msys
16786+ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
16787+ ;;
16788+ esac
16789+ ;;
16790+esac
16791+
16792+fi
16793+
16794+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
16795+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
16796+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
16797+
16798+
16799+
16800+
16801+
16802 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
16803 $as_echo_n "checking for $LD option to reload object files... " >&6; }
16804 if test "${lt_cv_ld_reload_flag+set}" = set; then :
16805@@ -6918,6 +6998,11 @@
16806 esac
16807 reload_cmds='$LD$reload_flag -o $output$reload_objs'
16808 case $host_os in
16809+ cygwin* | mingw* | pw32* | cegcc*)
16810+ if test "$GCC" != yes; then
16811+ reload_cmds=false
16812+ fi
16813+ ;;
16814 darwin*)
16815 if test "$GCC" = yes; then
16816 reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
16817@@ -7086,7 +7171,8 @@
16818 lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
16819 lt_cv_file_magic_cmd='func_win32_libid'
16820 else
16821- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
16822+ # Keep this pattern in sync with the one in func_win32_libid.
16823+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
16824 lt_cv_file_magic_cmd='$OBJDUMP -f'
16825 fi
16826 ;;
16827@@ -7240,6 +7326,21 @@
16828 fi
16829 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
16830 $as_echo "$lt_cv_deplibs_check_method" >&6; }
16831+
16832+file_magic_glob=
16833+want_nocaseglob=no
16834+if test "$build" = "$host"; then
16835+ case $host_os in
16836+ mingw* | pw32*)
16837+ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
16838+ want_nocaseglob=yes
16839+ else
16840+ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
16841+ fi
16842+ ;;
16843+ esac
16844+fi
16845+
16846 file_magic_cmd=$lt_cv_file_magic_cmd
16847 deplibs_check_method=$lt_cv_deplibs_check_method
16848 test -z "$deplibs_check_method" && deplibs_check_method=unknown
16849@@ -7255,9 +7356,162 @@
16850
16851
16852
16853+
16854+
16855+
16856+
16857+
16858+
16859+
16860+
16861+
16862+
16863 if test -n "$ac_tool_prefix"; then
16864- # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
16865-set dummy ${ac_tool_prefix}ar; ac_word=$2
16866+ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
16867+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
16868+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
16869+$as_echo_n "checking for $ac_word... " >&6; }
16870+if test "${ac_cv_prog_DLLTOOL+set}" = set; then :
16871+ $as_echo_n "(cached) " >&6
16872+else
16873+ if test -n "$DLLTOOL"; then
16874+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
16875+else
16876+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
16877+for as_dir in $PATH
16878+do
16879+ IFS=$as_save_IFS
16880+ test -z "$as_dir" && as_dir=.
16881+ for ac_exec_ext in '' $ac_executable_extensions; do
16882+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
16883+ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
16884+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
16885+ break 2
16886+ fi
16887+done
16888+ done
16889+IFS=$as_save_IFS
16890+
16891+fi
16892+fi
16893+DLLTOOL=$ac_cv_prog_DLLTOOL
16894+if test -n "$DLLTOOL"; then
16895+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
16896+$as_echo "$DLLTOOL" >&6; }
16897+else
16898+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
16899+$as_echo "no" >&6; }
16900+fi
16901+
16902+
16903+fi
16904+if test -z "$ac_cv_prog_DLLTOOL"; then
16905+ ac_ct_DLLTOOL=$DLLTOOL
16906+ # Extract the first word of "dlltool", so it can be a program name with args.
16907+set dummy dlltool; ac_word=$2
16908+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
16909+$as_echo_n "checking for $ac_word... " >&6; }
16910+if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then :
16911+ $as_echo_n "(cached) " >&6
16912+else
16913+ if test -n "$ac_ct_DLLTOOL"; then
16914+ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
16915+else
16916+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
16917+for as_dir in $PATH
16918+do
16919+ IFS=$as_save_IFS
16920+ test -z "$as_dir" && as_dir=.
16921+ for ac_exec_ext in '' $ac_executable_extensions; do
16922+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
16923+ ac_cv_prog_ac_ct_DLLTOOL="dlltool"
16924+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
16925+ break 2
16926+ fi
16927+done
16928+ done
16929+IFS=$as_save_IFS
16930+
16931+fi
16932+fi
16933+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
16934+if test -n "$ac_ct_DLLTOOL"; then
16935+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
16936+$as_echo "$ac_ct_DLLTOOL" >&6; }
16937+else
16938+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
16939+$as_echo "no" >&6; }
16940+fi
16941+
16942+ if test "x$ac_ct_DLLTOOL" = x; then
16943+ DLLTOOL="false"
16944+ else
16945+ case $cross_compiling:$ac_tool_warned in
16946+yes:)
16947+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
16948+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
16949+ac_tool_warned=yes ;;
16950+esac
16951+ DLLTOOL=$ac_ct_DLLTOOL
16952+ fi
16953+else
16954+ DLLTOOL="$ac_cv_prog_DLLTOOL"
16955+fi
16956+
16957+test -z "$DLLTOOL" && DLLTOOL=dlltool
16958+
16959+
16960+
16961+
16962+
16963+
16964+
16965+
16966+
16967+
16968+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
16969+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
16970+if test "${lt_cv_sharedlib_from_linklib_cmd+set}" = set; then :
16971+ $as_echo_n "(cached) " >&6
16972+else
16973+ lt_cv_sharedlib_from_linklib_cmd='unknown'
16974+
16975+case $host_os in
16976+cygwin* | mingw* | pw32* | cegcc*)
16977+ # two different shell functions defined in ltmain.sh
16978+ # decide which to use based on capabilities of $DLLTOOL
16979+ case `$DLLTOOL --help 2>&1` in
16980+ *--identify-strict*)
16981+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
16982+ ;;
16983+ *)
16984+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
16985+ ;;
16986+ esac
16987+ ;;
16988+*)
16989+ # fallback: assume linklib IS sharedlib
16990+ lt_cv_sharedlib_from_linklib_cmd="$ECHO"
16991+ ;;
16992+esac
16993+
16994+fi
16995+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
16996+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
16997+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
16998+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
16999+
17000+
17001+
17002+
17003+
17004+
17005+
17006+if test -n "$ac_tool_prefix"; then
17007+ for ac_prog in ar
17008+ do
17009+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
17010+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
17011 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
17012 $as_echo_n "checking for $ac_word... " >&6; }
17013 if test "${ac_cv_prog_AR+set}" = set; then :
17014@@ -7273,7 +7527,7 @@
17015 test -z "$as_dir" && as_dir=.
17016 for ac_exec_ext in '' $ac_executable_extensions; do
17017 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
17018- ac_cv_prog_AR="${ac_tool_prefix}ar"
17019+ ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
17020 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
17021 break 2
17022 fi
17023@@ -7293,11 +7547,15 @@
17024 fi
17025
17026
17027+ test -n "$AR" && break
17028+ done
17029 fi
17030-if test -z "$ac_cv_prog_AR"; then
17031+if test -z "$AR"; then
17032 ac_ct_AR=$AR
17033- # Extract the first word of "ar", so it can be a program name with args.
17034-set dummy ar; ac_word=$2
17035+ for ac_prog in ar
17036+do
17037+ # Extract the first word of "$ac_prog", so it can be a program name with args.
17038+set dummy $ac_prog; ac_word=$2
17039 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
17040 $as_echo_n "checking for $ac_word... " >&6; }
17041 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
17042@@ -7313,7 +7571,7 @@
17043 test -z "$as_dir" && as_dir=.
17044 for ac_exec_ext in '' $ac_executable_extensions; do
17045 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
17046- ac_cv_prog_ac_ct_AR="ar"
17047+ ac_cv_prog_ac_ct_AR="$ac_prog"
17048 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
17049 break 2
17050 fi
17051@@ -7332,6 +7590,10 @@
17052 $as_echo "no" >&6; }
17053 fi
17054
17055+
17056+ test -n "$ac_ct_AR" && break
17057+done
17058+
17059 if test "x$ac_ct_AR" = x; then
17060 AR="false"
17061 else
17062@@ -7343,12 +7605,10 @@
17063 esac
17064 AR=$ac_ct_AR
17065 fi
17066-else
17067- AR="$ac_cv_prog_AR"
17068 fi
17069
17070-test -z "$AR" && AR=ar
17071-test -z "$AR_FLAGS" && AR_FLAGS=cru
17072+: ${AR=ar}
17073+: ${AR_FLAGS=cru}
17074
17075
17076
17077@@ -7360,6 +7620,64 @@
17078
17079
17080
17081+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
17082+$as_echo_n "checking for archiver @FILE support... " >&6; }
17083+if test "${lt_cv_ar_at_file+set}" = set; then :
17084+ $as_echo_n "(cached) " >&6
17085+else
17086+ lt_cv_ar_at_file=no
17087+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17088+/* end confdefs.h. */
17089+
17090+int
17091+main ()
17092+{
17093+
17094+ ;
17095+ return 0;
17096+}
17097+_ACEOF
17098+if ac_fn_c_try_compile "$LINENO"; then :
17099+ echo conftest.$ac_objext > conftest.lst
17100+ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
17101+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
17102+ (eval $lt_ar_try) 2>&5
17103+ ac_status=$?
17104+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
17105+ test $ac_status = 0; }
17106+ if test "$ac_status" -eq 0; then
17107+ # Ensure the archiver fails upon bogus file names.
17108+ rm -f conftest.$ac_objext libconftest.a
17109+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
17110+ (eval $lt_ar_try) 2>&5
17111+ ac_status=$?
17112+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
17113+ test $ac_status = 0; }
17114+ if test "$ac_status" -ne 0; then
17115+ lt_cv_ar_at_file=@
17116+ fi
17117+ fi
17118+ rm -f conftest.* libconftest.a
17119+
17120+fi
17121+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
17122+
17123+fi
17124+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
17125+$as_echo "$lt_cv_ar_at_file" >&6; }
17126+
17127+if test "x$lt_cv_ar_at_file" = xno; then
17128+ archiver_list_spec=
17129+else
17130+ archiver_list_spec=$lt_cv_ar_at_file
17131+fi
17132+
17133+
17134+
17135+
17136+
17137+
17138+
17139 if test -n "$ac_tool_prefix"; then
17140 # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
17141 set dummy ${ac_tool_prefix}strip; ac_word=$2
17142@@ -7694,8 +8012,8 @@
17143 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
17144
17145 # Transform an extracted symbol line into symbol name and symbol address
17146-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
17147-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
17148+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
17149+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
17150
17151 # Handle CRLF in mingw tool chain
17152 opt_cr=
17153@@ -7731,6 +8049,7 @@
17154 else
17155 lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
17156 fi
17157+ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
17158
17159 # Check to see that the pipe works correctly.
17160 pipe_works=no
17161@@ -7772,6 +8091,18 @@
17162 if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
17163 if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
17164 cat <<_LT_EOF > conftest.$ac_ext
17165+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
17166+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
17167+/* DATA imports from DLLs on WIN32 con't be const, because runtime
17168+ relocations are performed -- see ld's documentation on pseudo-relocs. */
17169+# define LT_DLSYM_CONST
17170+#elif defined(__osf__)
17171+/* This system does not cope well with relocations in const data. */
17172+# define LT_DLSYM_CONST
17173+#else
17174+# define LT_DLSYM_CONST const
17175+#endif
17176+
17177 #ifdef __cplusplus
17178 extern "C" {
17179 #endif
17180@@ -7783,7 +8114,7 @@
17181 cat <<_LT_EOF >> conftest.$ac_ext
17182
17183 /* The mapping between symbol names and symbols. */
17184-const struct {
17185+LT_DLSYM_CONST struct {
17186 const char *name;
17187 void *address;
17188 }
17189@@ -7809,8 +8140,8 @@
17190 _LT_EOF
17191 # Now try linking the two files.
17192 mv conftest.$ac_objext conftstm.$ac_objext
17193- lt_save_LIBS="$LIBS"
17194- lt_save_CFLAGS="$CFLAGS"
17195+ lt_globsym_save_LIBS=$LIBS
17196+ lt_globsym_save_CFLAGS=$CFLAGS
17197 LIBS="conftstm.$ac_objext"
17198 CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
17199 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
17200@@ -7820,8 +8151,8 @@
17201 test $ac_status = 0; } && test -s conftest${ac_exeext}; then
17202 pipe_works=yes
17203 fi
17204- LIBS="$lt_save_LIBS"
17205- CFLAGS="$lt_save_CFLAGS"
17206+ LIBS=$lt_globsym_save_LIBS
17207+ CFLAGS=$lt_globsym_save_CFLAGS
17208 else
17209 echo "cannot find nm_test_func in $nlist" >&5
17210 fi
17211@@ -7858,6 +8189,23 @@
17212 $as_echo "ok" >&6; }
17213 fi
17214
17215+# Response file support.
17216+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
17217+ nm_file_list_spec='@'
17218+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
17219+ nm_file_list_spec='@'
17220+fi
17221+
17222+
17223+
17224+
17225+
17226+
17227+
17228+
17229+
17230+
17231+
17232
17233
17234
17235@@ -7874,6 +8222,38 @@
17236
17237
17238
17239+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
17240+$as_echo_n "checking for sysroot... " >&6; }
17241+
17242+# Check whether --with-libtool-sysroot was given.
17243+if test "${with_libtool_sysroot+set}" = set; then :
17244+ withval=$with_libtool_sysroot;
17245+else
17246+ with_libtool_sysroot=no
17247+fi
17248+
17249+
17250+lt_sysroot=
17251+case ${with_libtool_sysroot} in #(
17252+ yes)
17253+ if test "$GCC" = yes; then
17254+ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
17255+ fi
17256+ ;; #(
17257+ /*)
17258+ lt_sysroot=`echo "$with_libtool_sysroot" | sed -e "$sed_quote_subst"`
17259+ ;; #(
17260+ no|'')
17261+ ;; #(
17262+ *)
17263+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_libtool_sysroot}" >&5
17264+$as_echo "${with_libtool_sysroot}" >&6; }
17265+ as_fn_error "The sysroot must be an absolute path." "$LINENO" 5
17266+ ;;
17267+esac
17268+
17269+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
17270+$as_echo "${lt_sysroot:-no}" >&6; }
17271
17272
17273
17274@@ -8085,6 +8465,123 @@
17275
17276 need_locks="$enable_libtool_lock"
17277
17278+if test -n "$ac_tool_prefix"; then
17279+ # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
17280+set dummy ${ac_tool_prefix}mt; ac_word=$2
17281+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
17282+$as_echo_n "checking for $ac_word... " >&6; }
17283+if test "${ac_cv_prog_MANIFEST_TOOL+set}" = set; then :
17284+ $as_echo_n "(cached) " >&6
17285+else
17286+ if test -n "$MANIFEST_TOOL"; then
17287+ ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
17288+else
17289+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
17290+for as_dir in $PATH
17291+do
17292+ IFS=$as_save_IFS
17293+ test -z "$as_dir" && as_dir=.
17294+ for ac_exec_ext in '' $ac_executable_extensions; do
17295+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
17296+ ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
17297+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
17298+ break 2
17299+ fi
17300+done
17301+ done
17302+IFS=$as_save_IFS
17303+
17304+fi
17305+fi
17306+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
17307+if test -n "$MANIFEST_TOOL"; then
17308+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
17309+$as_echo "$MANIFEST_TOOL" >&6; }
17310+else
17311+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
17312+$as_echo "no" >&6; }
17313+fi
17314+
17315+
17316+fi
17317+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
17318+ ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
17319+ # Extract the first word of "mt", so it can be a program name with args.
17320+set dummy mt; ac_word=$2
17321+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
17322+$as_echo_n "checking for $ac_word... " >&6; }
17323+if test "${ac_cv_prog_ac_ct_MANIFEST_TOOL+set}" = set; then :
17324+ $as_echo_n "(cached) " >&6
17325+else
17326+ if test -n "$ac_ct_MANIFEST_TOOL"; then
17327+ ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
17328+else
17329+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
17330+for as_dir in $PATH
17331+do
17332+ IFS=$as_save_IFS
17333+ test -z "$as_dir" && as_dir=.
17334+ for ac_exec_ext in '' $ac_executable_extensions; do
17335+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
17336+ ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
17337+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
17338+ break 2
17339+ fi
17340+done
17341+ done
17342+IFS=$as_save_IFS
17343+
17344+fi
17345+fi
17346+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
17347+if test -n "$ac_ct_MANIFEST_TOOL"; then
17348+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
17349+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
17350+else
17351+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
17352+$as_echo "no" >&6; }
17353+fi
17354+
17355+ if test "x$ac_ct_MANIFEST_TOOL" = x; then
17356+ MANIFEST_TOOL=":"
17357+ else
17358+ case $cross_compiling:$ac_tool_warned in
17359+yes:)
17360+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
17361+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
17362+ac_tool_warned=yes ;;
17363+esac
17364+ MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
17365+ fi
17366+else
17367+ MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
17368+fi
17369+
17370+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
17371+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
17372+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
17373+if test "${lt_cv_path_mainfest_tool+set}" = set; then :
17374+ $as_echo_n "(cached) " >&6
17375+else
17376+ lt_cv_path_mainfest_tool=no
17377+ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
17378+ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
17379+ cat conftest.err >&5
17380+ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
17381+ lt_cv_path_mainfest_tool=yes
17382+ fi
17383+ rm -f conftest*
17384+fi
17385+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
17386+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
17387+if test "x$lt_cv_path_mainfest_tool" != xyes; then
17388+ MANIFEST_TOOL=:
17389+fi
17390+
17391+
17392+
17393+
17394+
17395
17396 case $host_os in
17397 rhapsody* | darwin*)
17398@@ -8648,6 +9145,8 @@
17399 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
17400 echo "$AR cru libconftest.a conftest.o" >&5
17401 $AR cru libconftest.a conftest.o 2>&5
17402+ echo "$RANLIB libconftest.a" >&5
17403+ $RANLIB libconftest.a 2>&5
17404 cat > conftest.c << _LT_EOF
17405 int main() { return 0;}
17406 _LT_EOF
17407@@ -8716,6 +9215,16 @@
17408
17409
17410
17411+func_stripname_cnf ()
17412+{
17413+ case ${2} in
17414+ .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
17415+ *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
17416+ esac
17417+} # func_stripname_cnf
17418+
17419+
17420+
17421
17422
17423 # Set options
17424@@ -8844,7 +9353,8 @@
17425 LIBTOOL_DEPS="$ltmain"
17426
17427 # Always use our own libtool.
17428-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
17429+LIBTOOL='$(SHELL) $(top_builddir)'
17430+LIBTOOL="$LIBTOOL/${host_alias}-libtool"
17431
17432
17433
17434@@ -8933,7 +9443,7 @@
17435 esac
17436
17437 # Global variables:
17438-ofile=libtool
17439+ofile=${host_alias}-libtool
17440 can_build_shared=yes
17441
17442 # All known linkers require a `.a' archive for static linking (except MSVC,
17443@@ -9231,8 +9741,6 @@
17444 lt_prog_compiler_pic=
17445 lt_prog_compiler_static=
17446
17447-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
17448-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
17449
17450 if test "$GCC" = yes; then
17451 lt_prog_compiler_wl='-Wl,'
17452@@ -9398,6 +9906,12 @@
17453 lt_prog_compiler_pic='--shared'
17454 lt_prog_compiler_static='--static'
17455 ;;
17456+ nagfor*)
17457+ # NAG Fortran compiler
17458+ lt_prog_compiler_wl='-Wl,-Wl,,'
17459+ lt_prog_compiler_pic='-PIC'
17460+ lt_prog_compiler_static='-Bstatic'
17461+ ;;
17462 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
17463 # Portland Group compilers (*not* the Pentium gcc compiler,
17464 # which looks to be a dead project)
17465@@ -9460,7 +9974,7 @@
17466 lt_prog_compiler_pic='-KPIC'
17467 lt_prog_compiler_static='-Bstatic'
17468 case $cc_basename in
17469- f77* | f90* | f95*)
17470+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
17471 lt_prog_compiler_wl='-Qoption ld ';;
17472 *)
17473 lt_prog_compiler_wl='-Wl,';;
17474@@ -9517,13 +10031,17 @@
17475 lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
17476 ;;
17477 esac
17478-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
17479-$as_echo "$lt_prog_compiler_pic" >&6; }
17480-
17481-
17482-
17483-
17484
17485+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
17486+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
17487+if test "${lt_cv_prog_compiler_pic+set}" = set; then :
17488+ $as_echo_n "(cached) " >&6
17489+else
17490+ lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
17491+fi
17492+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
17493+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
17494+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
17495
17496 #
17497 # Check to make sure the PIC flag actually works.
17498@@ -9584,6 +10102,11 @@
17499
17500
17501
17502+
17503+
17504+
17505+
17506+
17507 #
17508 # Check to make sure the static flag actually works.
17509 #
17510@@ -9934,7 +10457,8 @@
17511 allow_undefined_flag=unsupported
17512 always_export_symbols=no
17513 enable_shared_with_static_runtimes=yes
17514- export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
17515+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
17516+ exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
17517
17518 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
17519 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
17520@@ -9982,7 +10506,7 @@
17521 if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
17522 && test "$tmp_diet" = no
17523 then
17524- tmp_addflag=
17525+ tmp_addflag=' $pic_flag'
17526 tmp_sharedflag='-shared'
17527 case $cc_basename,$host_cpu in
17528 pgcc*) # Portland Group C compiler
17529@@ -10033,12 +10557,12 @@
17530 whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
17531 hardcode_libdir_flag_spec=
17532 hardcode_libdir_flag_spec_ld='-rpath $libdir'
17533- archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
17534+ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
17535 if test "x$supports_anon_versioning" = xyes; then
17536 archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
17537 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
17538 echo "local: *; };" >> $output_objdir/$libname.ver~
17539- $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
17540+ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
17541 fi
17542 ;;
17543 esac
17544@@ -10052,8 +10576,8 @@
17545 archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
17546 wlarc=
17547 else
17548- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
17549- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
17550+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
17551+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
17552 fi
17553 ;;
17554
17555@@ -10071,8 +10595,8 @@
17556
17557 _LT_EOF
17558 elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
17559- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
17560- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
17561+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
17562+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
17563 else
17564 ld_shlibs=no
17565 fi
17566@@ -10118,8 +10642,8 @@
17567
17568 *)
17569 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
17570- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
17571- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
17572+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
17573+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
17574 else
17575 ld_shlibs=no
17576 fi
17577@@ -10249,7 +10773,13 @@
17578 allow_undefined_flag='-berok'
17579 # Determine the default libpath from the value encoded in an
17580 # empty executable.
17581- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17582+ if test "${lt_cv_aix_libpath+set}" = set; then
17583+ aix_libpath=$lt_cv_aix_libpath
17584+else
17585+ if test "${lt_cv_aix_libpath_+set}" = set; then :
17586+ $as_echo_n "(cached) " >&6
17587+else
17588+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17589 /* end confdefs.h. */
17590
17591 int
17592@@ -10262,22 +10792,29 @@
17593 _ACEOF
17594 if ac_fn_c_try_link "$LINENO"; then :
17595
17596-lt_aix_libpath_sed='
17597- /Import File Strings/,/^$/ {
17598- /^0/ {
17599- s/^0 *\(.*\)$/\1/
17600- p
17601- }
17602- }'
17603-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
17604-# Check for a 64-bit object if we didn't find anything.
17605-if test -z "$aix_libpath"; then
17606- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
17607-fi
17608+ lt_aix_libpath_sed='
17609+ /Import File Strings/,/^$/ {
17610+ /^0/ {
17611+ s/^0 *\([^ ]*\) *$/\1/
17612+ p
17613+ }
17614+ }'
17615+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
17616+ # Check for a 64-bit object if we didn't find anything.
17617+ if test -z "$lt_cv_aix_libpath_"; then
17618+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
17619+ fi
17620 fi
17621 rm -f core conftest.err conftest.$ac_objext \
17622 conftest$ac_exeext conftest.$ac_ext
17623-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
17624+ if test -z "$lt_cv_aix_libpath_"; then
17625+ lt_cv_aix_libpath_="/usr/lib:/lib"
17626+ fi
17627+
17628+fi
17629+
17630+ aix_libpath=$lt_cv_aix_libpath_
17631+fi
17632
17633 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
17634 archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
17635@@ -10289,7 +10826,13 @@
17636 else
17637 # Determine the default libpath from the value encoded in an
17638 # empty executable.
17639- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17640+ if test "${lt_cv_aix_libpath+set}" = set; then
17641+ aix_libpath=$lt_cv_aix_libpath
17642+else
17643+ if test "${lt_cv_aix_libpath_+set}" = set; then :
17644+ $as_echo_n "(cached) " >&6
17645+else
17646+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17647 /* end confdefs.h. */
17648
17649 int
17650@@ -10302,22 +10845,29 @@
17651 _ACEOF
17652 if ac_fn_c_try_link "$LINENO"; then :
17653
17654-lt_aix_libpath_sed='
17655- /Import File Strings/,/^$/ {
17656- /^0/ {
17657- s/^0 *\(.*\)$/\1/
17658- p
17659- }
17660- }'
17661-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
17662-# Check for a 64-bit object if we didn't find anything.
17663-if test -z "$aix_libpath"; then
17664- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
17665-fi
17666+ lt_aix_libpath_sed='
17667+ /Import File Strings/,/^$/ {
17668+ /^0/ {
17669+ s/^0 *\([^ ]*\) *$/\1/
17670+ p
17671+ }
17672+ }'
17673+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
17674+ # Check for a 64-bit object if we didn't find anything.
17675+ if test -z "$lt_cv_aix_libpath_"; then
17676+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
17677+ fi
17678 fi
17679 rm -f core conftest.err conftest.$ac_objext \
17680 conftest$ac_exeext conftest.$ac_ext
17681-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
17682+ if test -z "$lt_cv_aix_libpath_"; then
17683+ lt_cv_aix_libpath_="/usr/lib:/lib"
17684+ fi
17685+
17686+fi
17687+
17688+ aix_libpath=$lt_cv_aix_libpath_
17689+fi
17690
17691 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
17692 # Warning - without using the other run time loading flags,
17693@@ -10362,20 +10912,63 @@
17694 # Microsoft Visual C++.
17695 # hardcode_libdir_flag_spec is actually meaningless, as there is
17696 # no search path for DLLs.
17697- hardcode_libdir_flag_spec=' '
17698- allow_undefined_flag=unsupported
17699- # Tell ltmain to make .lib files, not .a files.
17700- libext=lib
17701- # Tell ltmain to make .dll files, not .so files.
17702- shrext_cmds=".dll"
17703- # FIXME: Setting linknames here is a bad hack.
17704- archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
17705- # The linker will automatically build a .lib file if we build a DLL.
17706- old_archive_from_new_cmds='true'
17707- # FIXME: Should let the user specify the lib program.
17708- old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
17709- fix_srcfile_path='`cygpath -w "$srcfile"`'
17710- enable_shared_with_static_runtimes=yes
17711+ case $cc_basename in
17712+ cl*)
17713+ # Native MSVC
17714+ hardcode_libdir_flag_spec=' '
17715+ allow_undefined_flag=unsupported
17716+ always_export_symbols=yes
17717+ file_list_spec='@'
17718+ # Tell ltmain to make .lib files, not .a files.
17719+ libext=lib
17720+ # Tell ltmain to make .dll files, not .so files.
17721+ shrext_cmds=".dll"
17722+ # FIXME: Setting linknames here is a bad hack.
17723+ archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
17724+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
17725+ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
17726+ else
17727+ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
17728+ fi~
17729+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
17730+ linknames='
17731+ # The linker will not automatically build a static lib if we build a DLL.
17732+ # _LT_TAGVAR(old_archive_from_new_cmds, )='true'
17733+ enable_shared_with_static_runtimes=yes
17734+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
17735+ # Don't use ranlib
17736+ old_postinstall_cmds='chmod 644 $oldlib'
17737+ postlink_cmds='lt_outputfile="@OUTPUT@"~
17738+ lt_tool_outputfile="@TOOL_OUTPUT@"~
17739+ case $lt_outputfile in
17740+ *.exe|*.EXE) ;;
17741+ *)
17742+ lt_outputfile="$lt_outputfile.exe"
17743+ lt_tool_outputfile="$lt_tool_outputfile.exe"
17744+ ;;
17745+ esac~
17746+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
17747+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
17748+ $RM "$lt_outputfile.manifest";
17749+ fi'
17750+ ;;
17751+ *)
17752+ # Assume MSVC wrapper
17753+ hardcode_libdir_flag_spec=' '
17754+ allow_undefined_flag=unsupported
17755+ # Tell ltmain to make .lib files, not .a files.
17756+ libext=lib
17757+ # Tell ltmain to make .dll files, not .so files.
17758+ shrext_cmds=".dll"
17759+ # FIXME: Setting linknames here is a bad hack.
17760+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
17761+ # The linker will automatically build a .lib file if we build a DLL.
17762+ old_archive_from_new_cmds='true'
17763+ # FIXME: Should let the user specify the lib program.
17764+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
17765+ enable_shared_with_static_runtimes=yes
17766+ ;;
17767+ esac
17768 ;;
17769
17770 darwin* | rhapsody*)
17771@@ -10436,7 +11029,7 @@
17772
17773 # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
17774 freebsd* | dragonfly*)
17775- archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
17776+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
17777 hardcode_libdir_flag_spec='-R$libdir'
17778 hardcode_direct=yes
17779 hardcode_shlibpath_var=no
17780@@ -10444,7 +11037,7 @@
17781
17782 hpux9*)
17783 if test "$GCC" = yes; then
17784- archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
17785+ archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
17786 else
17787 archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
17788 fi
17789@@ -10460,7 +11053,7 @@
17790
17791 hpux10*)
17792 if test "$GCC" = yes && test "$with_gnu_ld" = no; then
17793- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
17794+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
17795 else
17796 archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
17797 fi
17798@@ -10484,10 +11077,10 @@
17799 archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
17800 ;;
17801 ia64*)
17802- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
17803+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
17804 ;;
17805 *)
17806- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
17807+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
17808 ;;
17809 esac
17810 else
17811@@ -10566,23 +11159,36 @@
17812
17813 irix5* | irix6* | nonstopux*)
17814 if test "$GCC" = yes; then
17815- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
17816+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
17817 # Try to use the -exported_symbol ld option, if it does not
17818 # work, assume that -exports_file does not work either and
17819 # implicitly export all symbols.
17820- save_LDFLAGS="$LDFLAGS"
17821- LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
17822- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17823+ # This should be the same for all languages, so no per-tag cache variable.
17824+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
17825+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
17826+if test "${lt_cv_irix_exported_symbol+set}" = set; then :
17827+ $as_echo_n "(cached) " >&6
17828+else
17829+ save_LDFLAGS="$LDFLAGS"
17830+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
17831+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17832 /* end confdefs.h. */
17833-int foo(void) {}
17834+int foo (void) { return 0; }
17835 _ACEOF
17836 if ac_fn_c_try_link "$LINENO"; then :
17837- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
17838-
17839+ lt_cv_irix_exported_symbol=yes
17840+else
17841+ lt_cv_irix_exported_symbol=no
17842 fi
17843 rm -f core conftest.err conftest.$ac_objext \
17844 conftest$ac_exeext conftest.$ac_ext
17845- LDFLAGS="$save_LDFLAGS"
17846+ LDFLAGS="$save_LDFLAGS"
17847+fi
17848+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
17849+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
17850+ if test "$lt_cv_irix_exported_symbol" = yes; then
17851+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
17852+ fi
17853 else
17854 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
17855 archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
17856@@ -10667,7 +11273,7 @@
17857 osf4* | osf5*) # as osf3* with the addition of -msym flag
17858 if test "$GCC" = yes; then
17859 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
17860- archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
17861+ archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
17862 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
17863 else
17864 allow_undefined_flag=' -expect_unresolved \*'
17865@@ -10686,9 +11292,9 @@
17866 no_undefined_flag=' -z defs'
17867 if test "$GCC" = yes; then
17868 wlarc='${wl}'
17869- archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
17870+ archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
17871 archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
17872- $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
17873+ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
17874 else
17875 case `$CC -V 2>&1` in
17876 *"Compilers 5.0"*)
17877@@ -11264,8 +11870,9 @@
17878 need_version=no
17879 need_lib_prefix=no
17880
17881- case $GCC,$host_os in
17882- yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
17883+ case $GCC,$cc_basename in
17884+ yes,*)
17885+ # gcc
17886 library_names_spec='$libname.dll.a'
17887 # DLL is installed to $(libdir)/../bin by postinstall_cmds
17888 postinstall_cmds='base_file=`basename \${file}`~
17889@@ -11298,13 +11905,71 @@
17890 library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
17891 ;;
17892 esac
17893+ dynamic_linker='Win32 ld.exe'
17894+ ;;
17895+
17896+ *,cl*)
17897+ # Native MSVC
17898+ libname_spec='$name'
17899+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
17900+ library_names_spec='${libname}.dll.lib'
17901+
17902+ case $build_os in
17903+ mingw*)
17904+ sys_lib_search_path_spec=
17905+ lt_save_ifs=$IFS
17906+ IFS=';'
17907+ for lt_path in $LIB
17908+ do
17909+ IFS=$lt_save_ifs
17910+ # Let DOS variable expansion print the short 8.3 style file name.
17911+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
17912+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
17913+ done
17914+ IFS=$lt_save_ifs
17915+ # Convert to MSYS style.
17916+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
17917+ ;;
17918+ cygwin*)
17919+ # Convert to unix form, then to dos form, then back to unix form
17920+ # but this time dos style (no spaces!) so that the unix form looks
17921+ # like /cygdrive/c/PROGRA~1:/cygdr...
17922+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
17923+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
17924+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
17925+ ;;
17926+ *)
17927+ sys_lib_search_path_spec="$LIB"
17928+ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
17929+ # It is most probably a Windows format PATH.
17930+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
17931+ else
17932+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
17933+ fi
17934+ # FIXME: find the short name or the path components, as spaces are
17935+ # common. (e.g. "Program Files" -> "PROGRA~1")
17936+ ;;
17937+ esac
17938+
17939+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
17940+ postinstall_cmds='base_file=`basename \${file}`~
17941+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
17942+ dldir=$destdir/`dirname \$dlpath`~
17943+ test -d \$dldir || mkdir -p \$dldir~
17944+ $install_prog $dir/$dlname \$dldir/$dlname'
17945+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
17946+ dlpath=$dir/\$dldll~
17947+ $RM \$dlpath'
17948+ shlibpath_overrides_runpath=yes
17949+ dynamic_linker='Win32 link.exe'
17950 ;;
17951
17952 *)
17953+ # Assume MSVC wrapper
17954 library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
17955+ dynamic_linker='Win32 ld.exe'
17956 ;;
17957 esac
17958- dynamic_linker='Win32 ld.exe'
17959 # FIXME: first we should search . and the directory the executable is in
17960 shlibpath_var=PATH
17961 ;;
17962@@ -11396,7 +12061,7 @@
17963 soname_spec='${libname}${release}${shared_ext}$major'
17964 shlibpath_var=LIBRARY_PATH
17965 shlibpath_overrides_runpath=yes
17966- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
17967+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
17968 hardcode_into_libs=yes
17969 ;;
17970
17971@@ -12192,7 +12857,7 @@
17972 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
17973 lt_status=$lt_dlunknown
17974 cat > conftest.$ac_ext <<_LT_EOF
17975-#line 12195 "configure"
17976+#line $LINENO "configure"
17977 #include "confdefs.h"
17978
17979 #if HAVE_DLFCN_H
17980@@ -12236,10 +12901,10 @@
17981 /* When -fvisbility=hidden is used, assume the code has been annotated
17982 correspondingly for the symbols needed. */
17983 #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
17984-void fnord () __attribute__((visibility("default")));
17985+int fnord () __attribute__((visibility("default")));
17986 #endif
17987
17988-void fnord () { int i=42; }
17989+int fnord () { return 42; }
17990 int main ()
17991 {
17992 void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
17993@@ -12298,7 +12963,7 @@
17994 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
17995 lt_status=$lt_dlunknown
17996 cat > conftest.$ac_ext <<_LT_EOF
17997-#line 12301 "configure"
17998+#line $LINENO "configure"
17999 #include "confdefs.h"
18000
18001 #if HAVE_DLFCN_H
18002@@ -12342,10 +13007,10 @@
18003 /* When -fvisbility=hidden is used, assume the code has been annotated
18004 correspondingly for the symbols needed. */
18005 #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
18006-void fnord () __attribute__((visibility("default")));
18007+int fnord () __attribute__((visibility("default")));
18008 #endif
18009
18010-void fnord () { int i=42; }
18011+int fnord () { return 42; }
18012 int main ()
18013 {
18014 void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
18015@@ -12737,6 +13402,7 @@
18016
18017 # Allow CC to be a program name with arguments.
18018 lt_save_CC=$CC
18019+ lt_save_CFLAGS=$CFLAGS
18020 lt_save_LD=$LD
18021 lt_save_GCC=$GCC
18022 GCC=$GXX
18023@@ -12754,6 +13420,7 @@
18024 fi
18025 test -z "${LDCXX+set}" || LD=$LDCXX
18026 CC=${CXX-"c++"}
18027+ CFLAGS=$CXXFLAGS
18028 compiler=$CC
18029 compiler_CXX=$CC
18030 for cc_temp in $compiler""; do
18031@@ -12893,8 +13560,8 @@
18032 # Check if GNU C++ uses GNU ld as the underlying linker, since the
18033 # archiving commands below assume that GNU ld is being used.
18034 if test "$with_gnu_ld" = yes; then
18035- archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
18036- archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
18037+ archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
18038+ archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
18039
18040 hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
18041 export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
18042@@ -13036,7 +13703,13 @@
18043 allow_undefined_flag_CXX='-berok'
18044 # Determine the default libpath from the value encoded in an empty
18045 # executable.
18046- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
18047+ if test "${lt_cv_aix_libpath+set}" = set; then
18048+ aix_libpath=$lt_cv_aix_libpath
18049+else
18050+ if test "${lt_cv_aix_libpath__CXX+set}" = set; then :
18051+ $as_echo_n "(cached) " >&6
18052+else
18053+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
18054 /* end confdefs.h. */
18055
18056 int
18057@@ -13049,22 +13722,29 @@
18058 _ACEOF
18059 if ac_fn_cxx_try_link "$LINENO"; then :
18060
18061-lt_aix_libpath_sed='
18062- /Import File Strings/,/^$/ {
18063- /^0/ {
18064- s/^0 *\(.*\)$/\1/
18065- p
18066- }
18067- }'
18068-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
18069-# Check for a 64-bit object if we didn't find anything.
18070-if test -z "$aix_libpath"; then
18071- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
18072-fi
18073+ lt_aix_libpath_sed='
18074+ /Import File Strings/,/^$/ {
18075+ /^0/ {
18076+ s/^0 *\([^ ]*\) *$/\1/
18077+ p
18078+ }
18079+ }'
18080+ lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
18081+ # Check for a 64-bit object if we didn't find anything.
18082+ if test -z "$lt_cv_aix_libpath__CXX"; then
18083+ lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
18084+ fi
18085 fi
18086 rm -f core conftest.err conftest.$ac_objext \
18087 conftest$ac_exeext conftest.$ac_ext
18088-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
18089+ if test -z "$lt_cv_aix_libpath__CXX"; then
18090+ lt_cv_aix_libpath__CXX="/usr/lib:/lib"
18091+ fi
18092+
18093+fi
18094+
18095+ aix_libpath=$lt_cv_aix_libpath__CXX
18096+fi
18097
18098 hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
18099
18100@@ -13077,7 +13757,13 @@
18101 else
18102 # Determine the default libpath from the value encoded in an
18103 # empty executable.
18104- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
18105+ if test "${lt_cv_aix_libpath+set}" = set; then
18106+ aix_libpath=$lt_cv_aix_libpath
18107+else
18108+ if test "${lt_cv_aix_libpath__CXX+set}" = set; then :
18109+ $as_echo_n "(cached) " >&6
18110+else
18111+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
18112 /* end confdefs.h. */
18113
18114 int
18115@@ -13090,22 +13776,29 @@
18116 _ACEOF
18117 if ac_fn_cxx_try_link "$LINENO"; then :
18118
18119-lt_aix_libpath_sed='
18120- /Import File Strings/,/^$/ {
18121- /^0/ {
18122- s/^0 *\(.*\)$/\1/
18123- p
18124- }
18125- }'
18126-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
18127-# Check for a 64-bit object if we didn't find anything.
18128-if test -z "$aix_libpath"; then
18129- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
18130-fi
18131+ lt_aix_libpath_sed='
18132+ /Import File Strings/,/^$/ {
18133+ /^0/ {
18134+ s/^0 *\([^ ]*\) *$/\1/
18135+ p
18136+ }
18137+ }'
18138+ lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
18139+ # Check for a 64-bit object if we didn't find anything.
18140+ if test -z "$lt_cv_aix_libpath__CXX"; then
18141+ lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
18142+ fi
18143 fi
18144 rm -f core conftest.err conftest.$ac_objext \
18145 conftest$ac_exeext conftest.$ac_ext
18146-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
18147+ if test -z "$lt_cv_aix_libpath__CXX"; then
18148+ lt_cv_aix_libpath__CXX="/usr/lib:/lib"
18149+ fi
18150+
18151+fi
18152+
18153+ aix_libpath=$lt_cv_aix_libpath__CXX
18154+fi
18155
18156 hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
18157 # Warning - without using the other run time loading flags,
18158@@ -13148,29 +13841,75 @@
18159 ;;
18160
18161 cygwin* | mingw* | pw32* | cegcc*)
18162- # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
18163- # as there is no search path for DLLs.
18164- hardcode_libdir_flag_spec_CXX='-L$libdir'
18165- export_dynamic_flag_spec_CXX='${wl}--export-all-symbols'
18166- allow_undefined_flag_CXX=unsupported
18167- always_export_symbols_CXX=no
18168- enable_shared_with_static_runtimes_CXX=yes
18169-
18170- if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
18171- archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
18172- # If the export-symbols file already is a .def file (1st line
18173- # is EXPORTS), use it as is; otherwise, prepend...
18174- archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
18175- cp $export_symbols $output_objdir/$soname.def;
18176- else
18177- echo EXPORTS > $output_objdir/$soname.def;
18178- cat $export_symbols >> $output_objdir/$soname.def;
18179- fi~
18180- $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
18181- else
18182- ld_shlibs_CXX=no
18183- fi
18184- ;;
18185+ case $GXX,$cc_basename in
18186+ ,cl* | no,cl*)
18187+ # Native MSVC
18188+ # hardcode_libdir_flag_spec is actually meaningless, as there is
18189+ # no search path for DLLs.
18190+ hardcode_libdir_flag_spec_CXX=' '
18191+ allow_undefined_flag_CXX=unsupported
18192+ always_export_symbols_CXX=yes
18193+ file_list_spec_CXX='@'
18194+ # Tell ltmain to make .lib files, not .a files.
18195+ libext=lib
18196+ # Tell ltmain to make .dll files, not .so files.
18197+ shrext_cmds=".dll"
18198+ # FIXME: Setting linknames here is a bad hack.
18199+ archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
18200+ archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
18201+ $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
18202+ else
18203+ $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
18204+ fi~
18205+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
18206+ linknames='
18207+ # The linker will not automatically build a static lib if we build a DLL.
18208+ # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true'
18209+ enable_shared_with_static_runtimes_CXX=yes
18210+ # Don't use ranlib
18211+ old_postinstall_cmds_CXX='chmod 644 $oldlib'
18212+ postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~
18213+ lt_tool_outputfile="@TOOL_OUTPUT@"~
18214+ case $lt_outputfile in
18215+ *.exe|*.EXE) ;;
18216+ *)
18217+ lt_outputfile="$lt_outputfile.exe"
18218+ lt_tool_outputfile="$lt_tool_outputfile.exe"
18219+ ;;
18220+ esac~
18221+ func_to_tool_file "$lt_outputfile"~
18222+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
18223+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
18224+ $RM "$lt_outputfile.manifest";
18225+ fi'
18226+ ;;
18227+ *)
18228+ # g++
18229+ # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
18230+ # as there is no search path for DLLs.
18231+ hardcode_libdir_flag_spec_CXX='-L$libdir'
18232+ export_dynamic_flag_spec_CXX='${wl}--export-all-symbols'
18233+ allow_undefined_flag_CXX=unsupported
18234+ always_export_symbols_CXX=no
18235+ enable_shared_with_static_runtimes_CXX=yes
18236+
18237+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
18238+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
18239+ # If the export-symbols file already is a .def file (1st line
18240+ # is EXPORTS), use it as is; otherwise, prepend...
18241+ archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
18242+ cp $export_symbols $output_objdir/$soname.def;
18243+ else
18244+ echo EXPORTS > $output_objdir/$soname.def;
18245+ cat $export_symbols >> $output_objdir/$soname.def;
18246+ fi~
18247+ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
18248+ else
18249+ ld_shlibs_CXX=no
18250+ fi
18251+ ;;
18252+ esac
18253+ ;;
18254 darwin* | rhapsody*)
18255
18256
18257@@ -13276,7 +14015,7 @@
18258 ;;
18259 *)
18260 if test "$GXX" = yes; then
18261- archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
18262+ archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
18263 else
18264 # FIXME: insert proper C++ library support
18265 ld_shlibs_CXX=no
18266@@ -13347,10 +14086,10 @@
18267 archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
18268 ;;
18269 ia64*)
18270- archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
18271+ archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
18272 ;;
18273 *)
18274- archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
18275+ archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
18276 ;;
18277 esac
18278 fi
18279@@ -13391,9 +14130,9 @@
18280 *)
18281 if test "$GXX" = yes; then
18282 if test "$with_gnu_ld" = no; then
18283- archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
18284+ archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
18285 else
18286- archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
18287+ archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
18288 fi
18289 fi
18290 link_all_deplibs_CXX=yes
18291@@ -13463,20 +14202,20 @@
18292 prelink_cmds_CXX='tpldir=Template.dir~
18293 rm -rf $tpldir~
18294 $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
18295- compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
18296+ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
18297 old_archive_cmds_CXX='tpldir=Template.dir~
18298 rm -rf $tpldir~
18299 $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
18300- $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
18301+ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
18302 $RANLIB $oldlib'
18303 archive_cmds_CXX='tpldir=Template.dir~
18304 rm -rf $tpldir~
18305 $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
18306- $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
18307+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
18308 archive_expsym_cmds_CXX='tpldir=Template.dir~
18309 rm -rf $tpldir~
18310 $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
18311- $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
18312+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
18313 ;;
18314 *) # Version 6 and above use weak symbols
18315 archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
18316@@ -13671,7 +14410,7 @@
18317 archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
18318 ;;
18319 *)
18320- archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
18321+ archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
18322 ;;
18323 esac
18324
18325@@ -13717,7 +14456,7 @@
18326
18327 solaris*)
18328 case $cc_basename in
18329- CC*)
18330+ CC* | sunCC*)
18331 # Sun C++ 4.2, 5.x and Centerline C++
18332 archive_cmds_need_lc_CXX=yes
18333 no_undefined_flag_CXX=' -zdefs'
18334@@ -13758,9 +14497,9 @@
18335 if test "$GXX" = yes && test "$with_gnu_ld" = no; then
18336 no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
18337 if $CC --version | $GREP -v '^2\.7' > /dev/null; then
18338- archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
18339+ archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
18340 archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
18341- $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
18342+ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
18343
18344 # Commands to make compiler produce verbose output that lists
18345 # what "hidden" libraries, object files and flags are used when
18346@@ -13895,6 +14634,13 @@
18347 };
18348 _LT_EOF
18349
18350+
18351+_lt_libdeps_save_CFLAGS=$CFLAGS
18352+case "$CC $CFLAGS " in #(
18353+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
18354+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
18355+esac
18356+
18357 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
18358 (eval $ac_compile) 2>&5
18359 ac_status=$?
18360@@ -13908,7 +14654,7 @@
18361 pre_test_object_deps_done=no
18362
18363 for p in `eval "$output_verbose_link_cmd"`; do
18364- case $p in
18365+ case ${prev}${p} in
18366
18367 -L* | -R* | -l*)
18368 # Some compilers place space between "-{L,R}" and the path.
18369@@ -13917,13 +14663,22 @@
18370 test $p = "-R"; then
18371 prev=$p
18372 continue
18373- else
18374- prev=
18375 fi
18376
18377+ # Expand the sysroot to ease extracting the directories later.
18378+ if test -z "$prev"; then
18379+ case $p in
18380+ -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
18381+ -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
18382+ -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
18383+ esac
18384+ fi
18385+ case $p in
18386+ =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
18387+ esac
18388 if test "$pre_test_object_deps_done" = no; then
18389- case $p in
18390- -L* | -R*)
18391+ case ${prev} in
18392+ -L | -R)
18393 # Internal compiler library paths should come after those
18394 # provided the user. The postdeps already come after the
18395 # user supplied libs so there is no need to process them.
18396@@ -13943,8 +14698,10 @@
18397 postdeps_CXX="${postdeps_CXX} ${prev}${p}"
18398 fi
18399 fi
18400+ prev=
18401 ;;
18402
18403+ *.lto.$objext) ;; # Ignore GCC LTO objects
18404 *.$objext)
18405 # This assumes that the test object file only shows up
18406 # once in the compiler output.
18407@@ -13980,6 +14737,7 @@
18408 fi
18409
18410 $RM -f confest.$objext
18411+CFLAGS=$_lt_libdeps_save_CFLAGS
18412
18413 # PORTME: override above test on systems where it is broken
18414 case $host_os in
18415@@ -14015,7 +14773,7 @@
18416
18417 solaris*)
18418 case $cc_basename in
18419- CC*)
18420+ CC* | sunCC*)
18421 # The more standards-conforming stlport4 library is
18422 # incompatible with the Cstd library. Avoid specifying
18423 # it if it's in CXXFLAGS. Ignore libCrun as
18424@@ -14080,8 +14838,6 @@
18425 lt_prog_compiler_pic_CXX=
18426 lt_prog_compiler_static_CXX=
18427
18428-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
18429-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
18430
18431 # C++ specific cases for pic, static, wl, etc.
18432 if test "$GXX" = yes; then
18433@@ -14186,6 +14942,11 @@
18434 ;;
18435 esac
18436 ;;
18437+ mingw* | cygwin* | os2* | pw32* | cegcc*)
18438+ # This hack is so that the source file can tell whether it is being
18439+ # built for inclusion in a dll (and should export symbols for example).
18440+ lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
18441+ ;;
18442 dgux*)
18443 case $cc_basename in
18444 ec++*)
18445@@ -14338,7 +15099,7 @@
18446 ;;
18447 solaris*)
18448 case $cc_basename in
18449- CC*)
18450+ CC* | sunCC*)
18451 # Sun C++ 4.2, 5.x and Centerline C++
18452 lt_prog_compiler_pic_CXX='-KPIC'
18453 lt_prog_compiler_static_CXX='-Bstatic'
18454@@ -14403,10 +15164,17 @@
18455 lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
18456 ;;
18457 esac
18458-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_CXX" >&5
18459-$as_echo "$lt_prog_compiler_pic_CXX" >&6; }
18460-
18461
18462+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
18463+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
18464+if test "${lt_cv_prog_compiler_pic_CXX+set}" = set; then :
18465+ $as_echo_n "(cached) " >&6
18466+else
18467+ lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX
18468+fi
18469+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5
18470+$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; }
18471+lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX
18472
18473 #
18474 # Check to make sure the PIC flag actually works.
18475@@ -14464,6 +15232,8 @@
18476
18477
18478
18479+
18480+
18481 #
18482 # Check to make sure the static flag actually works.
18483 #
18484@@ -14641,6 +15411,7 @@
18485 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
18486
18487 export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
18488+ exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
18489 case $host_os in
18490 aix[4-9]*)
18491 # If we're using GNU nm, then we don't want the "-C" option.
18492@@ -14655,15 +15426,20 @@
18493 ;;
18494 pw32*)
18495 export_symbols_cmds_CXX="$ltdll_cmds"
18496- ;;
18497+ ;;
18498 cygwin* | mingw* | cegcc*)
18499- export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
18500- ;;
18501+ case $cc_basename in
18502+ cl*) ;;
18503+ *)
18504+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
18505+ exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
18506+ ;;
18507+ esac
18508+ ;;
18509 *)
18510 export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
18511- ;;
18512+ ;;
18513 esac
18514- exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
18515
18516 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
18517 $as_echo "$ld_shlibs_CXX" >&6; }
18518@@ -14926,8 +15702,9 @@
18519 need_version=no
18520 need_lib_prefix=no
18521
18522- case $GCC,$host_os in
18523- yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
18524+ case $GCC,$cc_basename in
18525+ yes,*)
18526+ # gcc
18527 library_names_spec='$libname.dll.a'
18528 # DLL is installed to $(libdir)/../bin by postinstall_cmds
18529 postinstall_cmds='base_file=`basename \${file}`~
18530@@ -14959,13 +15736,71 @@
18531 library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
18532 ;;
18533 esac
18534+ dynamic_linker='Win32 ld.exe'
18535+ ;;
18536+
18537+ *,cl*)
18538+ # Native MSVC
18539+ libname_spec='$name'
18540+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
18541+ library_names_spec='${libname}.dll.lib'
18542+
18543+ case $build_os in
18544+ mingw*)
18545+ sys_lib_search_path_spec=
18546+ lt_save_ifs=$IFS
18547+ IFS=';'
18548+ for lt_path in $LIB
18549+ do
18550+ IFS=$lt_save_ifs
18551+ # Let DOS variable expansion print the short 8.3 style file name.
18552+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
18553+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
18554+ done
18555+ IFS=$lt_save_ifs
18556+ # Convert to MSYS style.
18557+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
18558+ ;;
18559+ cygwin*)
18560+ # Convert to unix form, then to dos form, then back to unix form
18561+ # but this time dos style (no spaces!) so that the unix form looks
18562+ # like /cygdrive/c/PROGRA~1:/cygdr...
18563+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
18564+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
18565+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
18566+ ;;
18567+ *)
18568+ sys_lib_search_path_spec="$LIB"
18569+ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
18570+ # It is most probably a Windows format PATH.
18571+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
18572+ else
18573+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
18574+ fi
18575+ # FIXME: find the short name or the path components, as spaces are
18576+ # common. (e.g. "Program Files" -> "PROGRA~1")
18577+ ;;
18578+ esac
18579+
18580+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
18581+ postinstall_cmds='base_file=`basename \${file}`~
18582+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
18583+ dldir=$destdir/`dirname \$dlpath`~
18584+ test -d \$dldir || mkdir -p \$dldir~
18585+ $install_prog $dir/$dlname \$dldir/$dlname'
18586+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
18587+ dlpath=$dir/\$dldll~
18588+ $RM \$dlpath'
18589+ shlibpath_overrides_runpath=yes
18590+ dynamic_linker='Win32 link.exe'
18591 ;;
18592
18593 *)
18594+ # Assume MSVC wrapper
18595 library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
18596+ dynamic_linker='Win32 ld.exe'
18597 ;;
18598 esac
18599- dynamic_linker='Win32 ld.exe'
18600 # FIXME: first we should search . and the directory the executable is in
18601 shlibpath_var=PATH
18602 ;;
18603@@ -15056,7 +15891,7 @@
18604 soname_spec='${libname}${release}${shared_ext}$major'
18605 shlibpath_var=LIBRARY_PATH
18606 shlibpath_overrides_runpath=yes
18607- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
18608+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
18609 hardcode_into_libs=yes
18610 ;;
18611
18612@@ -15515,6 +16350,7 @@
18613 fi # test -n "$compiler"
18614
18615 CC=$lt_save_CC
18616+ CFLAGS=$lt_save_CFLAGS
18617 LDCXX=$LD
18618 LD=$lt_save_LD
18619 GCC=$lt_save_GCC
18620@@ -17754,13 +18590,20 @@
18621 lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
18622 lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
18623 lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
18624+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
18625+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
18626 reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
18627 reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
18628 OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
18629 deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
18630 file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
18631+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
18632+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
18633+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
18634+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
18635 AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
18636 AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
18637+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
18638 STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
18639 RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
18640 old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
18641@@ -17775,14 +18618,17 @@
18642 lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
18643 lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
18644 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
18645+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
18646+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
18647 objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
18648 MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
18649 lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
18650-lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
18651 lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
18652+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
18653 lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
18654 lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
18655 need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
18656+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
18657 DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
18658 NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
18659 LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
18660@@ -17815,12 +18661,12 @@
18661 hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
18662 inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
18663 link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
18664-fix_srcfile_path='`$ECHO "$fix_srcfile_path" | $SED "$delay_single_quote_subst"`'
18665 always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
18666 export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
18667 exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
18668 include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
18669 prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
18670+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
18671 file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
18672 variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
18673 need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
18674@@ -17859,8 +18705,8 @@
18675 compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`'
18676 GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`'
18677 lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`'
18678-lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`'
18679 lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`'
18680+lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`'
18681 lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`'
18682 lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`'
18683 archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`'
18684@@ -17887,12 +18733,12 @@
18685 hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`'
18686 inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`'
18687 link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`'
18688-fix_srcfile_path_CXX='`$ECHO "$fix_srcfile_path_CXX" | $SED "$delay_single_quote_subst"`'
18689 always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`'
18690 export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`'
18691 exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
18692 include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
18693 prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
18694+postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
18695 file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`'
18696 hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`'
18697 compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`'
18698@@ -17930,8 +18776,13 @@
18699 OBJDUMP \
18700 deplibs_check_method \
18701 file_magic_cmd \
18702+file_magic_glob \
18703+want_nocaseglob \
18704+DLLTOOL \
18705+sharedlib_from_linklib_cmd \
18706 AR \
18707 AR_FLAGS \
18708+archiver_list_spec \
18709 STRIP \
18710 RANLIB \
18711 CC \
18712@@ -17941,12 +18792,14 @@
18713 lt_cv_sys_global_symbol_to_cdecl \
18714 lt_cv_sys_global_symbol_to_c_name_address \
18715 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
18716+nm_file_list_spec \
18717 lt_prog_compiler_no_builtin_flag \
18718-lt_prog_compiler_wl \
18719 lt_prog_compiler_pic \
18720+lt_prog_compiler_wl \
18721 lt_prog_compiler_static \
18722 lt_cv_prog_compiler_c_o \
18723 need_locks \
18724+MANIFEST_TOOL \
18725 DSYMUTIL \
18726 NMEDIT \
18727 LIPO \
18728@@ -17962,7 +18815,6 @@
18729 hardcode_libdir_flag_spec \
18730 hardcode_libdir_flag_spec_ld \
18731 hardcode_libdir_separator \
18732-fix_srcfile_path \
18733 exclude_expsyms \
18734 include_expsyms \
18735 file_list_spec \
18736@@ -17984,8 +18836,8 @@
18737 reload_flag_CXX \
18738 compiler_CXX \
18739 lt_prog_compiler_no_builtin_flag_CXX \
18740-lt_prog_compiler_wl_CXX \
18741 lt_prog_compiler_pic_CXX \
18742+lt_prog_compiler_wl_CXX \
18743 lt_prog_compiler_static_CXX \
18744 lt_cv_prog_compiler_c_o_CXX \
18745 export_dynamic_flag_spec_CXX \
18746@@ -17997,7 +18849,6 @@
18747 hardcode_libdir_flag_spec_CXX \
18748 hardcode_libdir_flag_spec_ld_CXX \
18749 hardcode_libdir_separator_CXX \
18750-fix_srcfile_path_CXX \
18751 exclude_expsyms_CXX \
18752 include_expsyms_CXX \
18753 file_list_spec_CXX \
18754@@ -18031,6 +18882,7 @@
18755 module_expsym_cmds \
18756 export_symbols_cmds \
18757 prelink_cmds \
18758+postlink_cmds \
18759 postinstall_cmds \
18760 postuninstall_cmds \
18761 finish_cmds \
18762@@ -18045,7 +18897,8 @@
18763 module_cmds_CXX \
18764 module_expsym_cmds_CXX \
18765 export_symbols_cmds_CXX \
18766-prelink_cmds_CXX; do
18767+prelink_cmds_CXX \
18768+postlink_cmds_CXX; do
18769 case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
18770 *[\\\\\\\`\\"\\\$]*)
18771 eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
18772@@ -18838,7 +19691,8 @@
18773 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
18774 #
18775 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
18776-# 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
18777+# 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
18778+# Inc.
18779 # Written by Gordon Matzigkeit, 1996
18780 #
18781 # This file is part of GNU Libtool.
18782@@ -18941,19 +19795,42 @@
18783 # turn newlines into spaces.
18784 NL2SP=$lt_lt_NL2SP
18785
18786+# convert \$build file names to \$host format.
18787+to_host_file_cmd=$lt_cv_to_host_file_cmd
18788+
18789+# convert \$build files to toolchain format.
18790+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
18791+
18792 # An object symbol dumper.
18793 OBJDUMP=$lt_OBJDUMP
18794
18795 # Method to check whether dependent libraries are shared objects.
18796 deplibs_check_method=$lt_deplibs_check_method
18797
18798-# Command to use when deplibs_check_method == "file_magic".
18799+# Command to use when deplibs_check_method = "file_magic".
18800 file_magic_cmd=$lt_file_magic_cmd
18801
18802+# How to find potential files when deplibs_check_method = "file_magic".
18803+file_magic_glob=$lt_file_magic_glob
18804+
18805+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
18806+want_nocaseglob=$lt_want_nocaseglob
18807+
18808+# DLL creation program.
18809+DLLTOOL=$lt_DLLTOOL
18810+
18811+# Command to associate shared and link libraries.
18812+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
18813+
18814 # The archiver.
18815 AR=$lt_AR
18816+
18817+# Flags to create an archive.
18818 AR_FLAGS=$lt_AR_FLAGS
18819
18820+# How to feed a file listing to the archiver.
18821+archiver_list_spec=$lt_archiver_list_spec
18822+
18823 # A symbol stripping program.
18824 STRIP=$lt_STRIP
18825
18826@@ -18983,6 +19860,12 @@
18827 # Transform the output of nm in a C name address pair when lib prefix is needed.
18828 global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
18829
18830+# Specify filename containing input files for \$NM.
18831+nm_file_list_spec=$lt_nm_file_list_spec
18832+
18833+# The root where to search for dependent libraries,and in which our libraries should be installed.
18834+lt_sysroot=$lt_sysroot
18835+
18836 # The name of the directory that contains temporary libtool files.
18837 objdir=$objdir
18838
18839@@ -18992,6 +19875,9 @@
18840 # Must we lock files when doing compilation?
18841 need_locks=$lt_need_locks
18842
18843+# Manifest tool.
18844+MANIFEST_TOOL=$lt_MANIFEST_TOOL
18845+
18846 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
18847 DSYMUTIL=$lt_DSYMUTIL
18848
18849@@ -19106,12 +19992,12 @@
18850 # Compiler flag to turn off builtin functions.
18851 no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
18852
18853-# How to pass a linker flag through the compiler.
18854-wl=$lt_lt_prog_compiler_wl
18855-
18856 # Additional compiler flags for building library objects.
18857 pic_flag=$lt_lt_prog_compiler_pic
18858
18859+# How to pass a linker flag through the compiler.
18860+wl=$lt_lt_prog_compiler_wl
18861+
18862 # Compiler flag to prevent dynamic linking.
18863 link_static_flag=$lt_lt_prog_compiler_static
18864
18865@@ -19198,9 +20084,6 @@
18866 # Whether libtool must link a program against all its dependency libraries.
18867 link_all_deplibs=$link_all_deplibs
18868
18869-# Fix the shell variable \$srcfile for the compiler.
18870-fix_srcfile_path=$lt_fix_srcfile_path
18871-
18872 # Set to "yes" if exported symbols are required.
18873 always_export_symbols=$always_export_symbols
18874
18875@@ -19216,6 +20099,9 @@
18876 # Commands necessary for linking programs (against libraries) with templates.
18877 prelink_cmds=$lt_prelink_cmds
18878
18879+# Commands necessary for finishing linking programs.
18880+postlink_cmds=$lt_postlink_cmds
18881+
18882 # Specify filename containing input files.
18883 file_list_spec=$lt_file_list_spec
18884
18885@@ -19262,210 +20148,169 @@
18886 # if finds mixed CR/LF and LF-only lines. Since sed operates in
18887 # text mode, it properly converts lines to CR/LF. This bash problem
18888 # is reportedly fixed, but why not run on old versions too?
18889- sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
18890- || (rm -f "$cfgfile"; exit 1)
18891-
18892- case $xsi_shell in
18893- yes)
18894- cat << \_LT_EOF >> "$cfgfile"
18895-
18896-# func_dirname file append nondir_replacement
18897-# Compute the dirname of FILE. If nonempty, add APPEND to the result,
18898-# otherwise set result to NONDIR_REPLACEMENT.
18899-func_dirname ()
18900-{
18901- case ${1} in
18902- */*) func_dirname_result="${1%/*}${2}" ;;
18903- * ) func_dirname_result="${3}" ;;
18904- esac
18905-}
18906-
18907-# func_basename file
18908-func_basename ()
18909-{
18910- func_basename_result="${1##*/}"
18911-}
18912-
18913-# func_dirname_and_basename file append nondir_replacement
18914-# perform func_basename and func_dirname in a single function
18915-# call:
18916-# dirname: Compute the dirname of FILE. If nonempty,
18917-# add APPEND to the result, otherwise set result
18918-# to NONDIR_REPLACEMENT.
18919-# value returned in "$func_dirname_result"
18920-# basename: Compute filename of FILE.
18921-# value retuned in "$func_basename_result"
18922-# Implementation must be kept synchronized with func_dirname
18923-# and func_basename. For efficiency, we do not delegate to
18924-# those functions but instead duplicate the functionality here.
18925-func_dirname_and_basename ()
18926-{
18927- case ${1} in
18928- */*) func_dirname_result="${1%/*}${2}" ;;
18929- * ) func_dirname_result="${3}" ;;
18930- esac
18931- func_basename_result="${1##*/}"
18932-}
18933-
18934-# func_stripname prefix suffix name
18935-# strip PREFIX and SUFFIX off of NAME.
18936-# PREFIX and SUFFIX must not contain globbing or regex special
18937-# characters, hashes, percent signs, but SUFFIX may contain a leading
18938-# dot (in which case that matches only a dot).
18939-func_stripname ()
18940-{
18941- # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
18942- # positional parameters, so assign one to ordinary parameter first.
18943- func_stripname_result=${3}
18944- func_stripname_result=${func_stripname_result#"${1}"}
18945- func_stripname_result=${func_stripname_result%"${2}"}
18946-}
18947-
18948-# func_opt_split
18949-func_opt_split ()
18950-{
18951- func_opt_split_opt=${1%%=*}
18952- func_opt_split_arg=${1#*=}
18953-}
18954-
18955-# func_lo2o object
18956-func_lo2o ()
18957-{
18958- case ${1} in
18959- *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
18960- *) func_lo2o_result=${1} ;;
18961- esac
18962-}
18963-
18964-# func_xform libobj-or-source
18965-func_xform ()
18966-{
18967- func_xform_result=${1%.*}.lo
18968-}
18969-
18970-# func_arith arithmetic-term...
18971-func_arith ()
18972-{
18973- func_arith_result=$(( $* ))
18974-}
18975-
18976-# func_len string
18977-# STRING may not start with a hyphen.
18978-func_len ()
18979-{
18980- func_len_result=${#1}
18981-}
18982-
18983-_LT_EOF
18984- ;;
18985- *) # Bourne compatible functions.
18986- cat << \_LT_EOF >> "$cfgfile"
18987-
18988-# func_dirname file append nondir_replacement
18989-# Compute the dirname of FILE. If nonempty, add APPEND to the result,
18990-# otherwise set result to NONDIR_REPLACEMENT.
18991-func_dirname ()
18992-{
18993- # Extract subdirectory from the argument.
18994- func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
18995- if test "X$func_dirname_result" = "X${1}"; then
18996- func_dirname_result="${3}"
18997- else
18998- func_dirname_result="$func_dirname_result${2}"
18999- fi
19000-}
19001-
19002-# func_basename file
19003-func_basename ()
19004-{
19005- func_basename_result=`$ECHO "${1}" | $SED "$basename"`
19006-}
19007-
19008-
19009-# func_stripname prefix suffix name
19010-# strip PREFIX and SUFFIX off of NAME.
19011-# PREFIX and SUFFIX must not contain globbing or regex special
19012-# characters, hashes, percent signs, but SUFFIX may contain a leading
19013-# dot (in which case that matches only a dot).
19014-# func_strip_suffix prefix name
19015-func_stripname ()
19016-{
19017- case ${2} in
19018- .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
19019- *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
19020- esac
19021-}
19022-
19023-# sed scripts:
19024-my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
19025-my_sed_long_arg='1s/^-[^=]*=//'
19026-
19027-# func_opt_split
19028-func_opt_split ()
19029-{
19030- func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"`
19031- func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"`
19032-}
19033-
19034-# func_lo2o object
19035-func_lo2o ()
19036-{
19037- func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
19038-}
19039-
19040-# func_xform libobj-or-source
19041-func_xform ()
19042-{
19043- func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
19044-}
19045-
19046-# func_arith arithmetic-term...
19047-func_arith ()
19048-{
19049- func_arith_result=`expr "$@"`
19050-}
19051-
19052-# func_len string
19053-# STRING may not start with a hyphen.
19054-func_len ()
19055-{
19056- func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
19057-}
19058-
19059-_LT_EOF
19060-esac
19061-
19062-case $lt_shell_append in
19063- yes)
19064- cat << \_LT_EOF >> "$cfgfile"
19065-
19066-# func_append var value
19067-# Append VALUE to the end of shell variable VAR.
19068-func_append ()
19069-{
19070- eval "$1+=\$2"
19071-}
19072-_LT_EOF
19073- ;;
19074- *)
19075- cat << \_LT_EOF >> "$cfgfile"
19076-
19077-# func_append var value
19078-# Append VALUE to the end of shell variable VAR.
19079-func_append ()
19080-{
19081- eval "$1=\$$1\$2"
19082-}
19083-
19084-_LT_EOF
19085- ;;
19086- esac
19087+ sed '$q' "$ltmain" >> "$cfgfile" \
19088+ || (rm -f "$cfgfile"; exit 1)
19089
19090+ if test x"$xsi_shell" = xyes; then
19091+ sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
19092+func_dirname ()\
19093+{\
19094+\ case ${1} in\
19095+\ */*) func_dirname_result="${1%/*}${2}" ;;\
19096+\ * ) func_dirname_result="${3}" ;;\
19097+\ esac\
19098+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
19099+ && mv -f "$cfgfile.tmp" "$cfgfile" \
19100+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
19101+test 0 -eq $? || _lt_function_replace_fail=:
19102+
19103+
19104+ sed -e '/^func_basename ()$/,/^} # func_basename /c\
19105+func_basename ()\
19106+{\
19107+\ func_basename_result="${1##*/}"\
19108+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
19109+ && mv -f "$cfgfile.tmp" "$cfgfile" \
19110+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
19111+test 0 -eq $? || _lt_function_replace_fail=:
19112+
19113+
19114+ sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
19115+func_dirname_and_basename ()\
19116+{\
19117+\ case ${1} in\
19118+\ */*) func_dirname_result="${1%/*}${2}" ;;\
19119+\ * ) func_dirname_result="${3}" ;;\
19120+\ esac\
19121+\ func_basename_result="${1##*/}"\
19122+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
19123+ && mv -f "$cfgfile.tmp" "$cfgfile" \
19124+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
19125+test 0 -eq $? || _lt_function_replace_fail=:
19126+
19127+
19128+ sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
19129+func_stripname ()\
19130+{\
19131+\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
19132+\ # positional parameters, so assign one to ordinary parameter first.\
19133+\ func_stripname_result=${3}\
19134+\ func_stripname_result=${func_stripname_result#"${1}"}\
19135+\ func_stripname_result=${func_stripname_result%"${2}"}\
19136+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
19137+ && mv -f "$cfgfile.tmp" "$cfgfile" \
19138+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
19139+test 0 -eq $? || _lt_function_replace_fail=:
19140+
19141+
19142+ sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
19143+func_split_long_opt ()\
19144+{\
19145+\ func_split_long_opt_name=${1%%=*}\
19146+\ func_split_long_opt_arg=${1#*=}\
19147+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
19148+ && mv -f "$cfgfile.tmp" "$cfgfile" \
19149+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
19150+test 0 -eq $? || _lt_function_replace_fail=:
19151+
19152+
19153+ sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
19154+func_split_short_opt ()\
19155+{\
19156+\ func_split_short_opt_arg=${1#??}\
19157+\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
19158+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
19159+ && mv -f "$cfgfile.tmp" "$cfgfile" \
19160+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
19161+test 0 -eq $? || _lt_function_replace_fail=:
19162+
19163+
19164+ sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
19165+func_lo2o ()\
19166+{\
19167+\ case ${1} in\
19168+\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
19169+\ *) func_lo2o_result=${1} ;;\
19170+\ esac\
19171+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
19172+ && mv -f "$cfgfile.tmp" "$cfgfile" \
19173+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
19174+test 0 -eq $? || _lt_function_replace_fail=:
19175+
19176+
19177+ sed -e '/^func_xform ()$/,/^} # func_xform /c\
19178+func_xform ()\
19179+{\
19180+ func_xform_result=${1%.*}.lo\
19181+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
19182+ && mv -f "$cfgfile.tmp" "$cfgfile" \
19183+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
19184+test 0 -eq $? || _lt_function_replace_fail=:
19185+
19186+
19187+ sed -e '/^func_arith ()$/,/^} # func_arith /c\
19188+func_arith ()\
19189+{\
19190+ func_arith_result=$(( $* ))\
19191+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
19192+ && mv -f "$cfgfile.tmp" "$cfgfile" \
19193+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
19194+test 0 -eq $? || _lt_function_replace_fail=:
19195+
19196+
19197+ sed -e '/^func_len ()$/,/^} # func_len /c\
19198+func_len ()\
19199+{\
19200+ func_len_result=${#1}\
19201+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
19202+ && mv -f "$cfgfile.tmp" "$cfgfile" \
19203+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
19204+test 0 -eq $? || _lt_function_replace_fail=:
19205+
19206+fi
19207+
19208+if test x"$lt_shell_append" = xyes; then
19209+ sed -e '/^func_append ()$/,/^} # func_append /c\
19210+func_append ()\
19211+{\
19212+ eval "${1}+=\\${2}"\
19213+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
19214+ && mv -f "$cfgfile.tmp" "$cfgfile" \
19215+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
19216+test 0 -eq $? || _lt_function_replace_fail=:
19217+
19218+
19219+ sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
19220+func_append_quoted ()\
19221+{\
19222+\ func_quote_for_eval "${2}"\
19223+\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
19224+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
19225+ && mv -f "$cfgfile.tmp" "$cfgfile" \
19226+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
19227+test 0 -eq $? || _lt_function_replace_fail=:
19228+
19229+
19230+ # Save a `func_append' function call where possible by direct use of '+='
19231+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
19232+ && mv -f "$cfgfile.tmp" "$cfgfile" \
19233+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
19234+ test 0 -eq $? || _lt_function_replace_fail=:
19235+else
19236+ # Save a `func_append' function call even when '+=' is not available
19237+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
19238+ && mv -f "$cfgfile.tmp" "$cfgfile" \
19239+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
19240+ test 0 -eq $? || _lt_function_replace_fail=:
19241+fi
19242+
19243+if test x"$_lt_function_replace_fail" = x":"; then
19244+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
19245+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
19246+fi
19247
19248- sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
19249- || (rm -f "$cfgfile"; exit 1)
19250
19251- mv -f "$cfgfile" "$ofile" ||
19252+ mv -f "$cfgfile" "$ofile" ||
19253 (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
19254 chmod +x "$ofile"
19255
19256@@ -19493,12 +20338,12 @@
19257 # Compiler flag to turn off builtin functions.
19258 no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
19259
19260-# How to pass a linker flag through the compiler.
19261-wl=$lt_lt_prog_compiler_wl_CXX
19262-
19263 # Additional compiler flags for building library objects.
19264 pic_flag=$lt_lt_prog_compiler_pic_CXX
19265
19266+# How to pass a linker flag through the compiler.
19267+wl=$lt_lt_prog_compiler_wl_CXX
19268+
19269 # Compiler flag to prevent dynamic linking.
19270 link_static_flag=$lt_lt_prog_compiler_static_CXX
19271
19272@@ -19585,9 +20430,6 @@
19273 # Whether libtool must link a program against all its dependency libraries.
19274 link_all_deplibs=$link_all_deplibs_CXX
19275
19276-# Fix the shell variable \$srcfile for the compiler.
19277-fix_srcfile_path=$lt_fix_srcfile_path_CXX
19278-
19279 # Set to "yes" if exported symbols are required.
19280 always_export_symbols=$always_export_symbols_CXX
19281
19282@@ -19603,6 +20445,9 @@
19283 # Commands necessary for linking programs (against libraries) with templates.
19284 prelink_cmds=$lt_prelink_cmds_CXX
19285
19286+# Commands necessary for finishing linking programs.
19287+postlink_cmds=$lt_postlink_cmds_CXX
19288+
19289 # Specify filename containing input files.
19290 file_list_spec=$lt_file_list_spec_CXX
19291
19292Index: binutils-2.24/bfd/configure.in
19293===================================================================
19294--- binutils-2.24.orig/bfd/configure.in 2013-12-02 01:30:28.000000000 -0800
19295+++ binutils-2.24/bfd/configure.in 2013-12-15 11:10:23.887118697 -0800
19296@@ -568,7 +568,7 @@
19297 x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
19298 changequote([,])dnl
19299 if test -n "$x"; then
19300- SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
19301+ SHARED_LIBADD="`pwd`/../libiberty/pic/libiberty.a"
19302 fi
19303
19304 # More hacks to build DLLs on Windows.
19305Index: binutils-2.24/opcodes/configure.in
19306===================================================================
19307--- binutils-2.24.orig/opcodes/configure.in 2013-11-04 07:33:40.000000000 -0800
19308+++ binutils-2.24/opcodes/configure.in 2013-12-15 11:10:23.887118697 -0800
19309@@ -162,7 +162,7 @@
19310 x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
19311 changequote([,])dnl
19312 if test -n "$x"; then
19313- SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
19314+ SHARED_LIBADD="`pwd`/../libiberty/pic/libiberty.a"
19315 fi
19316
19317 case "${host}" in
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/libtool-rpath-fix.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/libtool-rpath-fix.patch
new file mode 100644
index 0000000..4fcffa4
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/libtool-rpath-fix.patch
@@ -0,0 +1,39 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3Enabling sysroot support in libtool exposed a bug where the final
4library had an RPATH encoded into it which still pointed to the
5sysroot. This works around the issue until it gets sorted out
6upstream.
7
8Fix suggested by Richard Purdie <richard.purdie@linuxfoundation.org>
9Signed-off-by: Scott Garman <scott.a.garman@intel.com>
10
11Index: binutils-2.22/ltmain.sh
12===================================================================
13--- binutils-2.22.orig/ltmain.sh
14+++ binutils-2.22/ltmain.sh
15@@ -8035,9 +8035,11 @@ EOF
16 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
17 for libdir in $rpath; do
18 if test -n "$hardcode_libdir_flag_spec"; then
19+ func_replace_sysroot "$libdir"
20+ libdir=$func_replace_sysroot_result
21+ func_stripname '=' '' "$libdir"
22+ libdir=$func_stripname_result
23 if test -n "$hardcode_libdir_separator"; then
24- func_replace_sysroot "$libdir"
25- libdir=$func_replace_sysroot_result
26 if test -z "$hardcode_libdirs"; then
27 hardcode_libdirs="$libdir"
28 else
29@@ -8770,6 +8772,10 @@ EOF
30 hardcode_libdirs=
31 for libdir in $compile_rpath $finalize_rpath; do
32 if test -n "$hardcode_libdir_flag_spec"; then
33+ func_replace_sysroot "$libdir"
34+ libdir=$func_replace_sysroot_result
35+ func_stripname '=' '' "$libdir"
36+ libdir=$func_stripname_result
37 if test -n "$hardcode_libdir_separator"; then
38 if test -z "$hardcode_libdirs"; then
39 hardcode_libdirs="$libdir"
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/mips64-default-ld-emulation.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/mips64-default-ld-emulation.patch
new file mode 100644
index 0000000..51eaf0b
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/mips64-default-ld-emulation.patch
@@ -0,0 +1,54 @@
1for mips64*-*-linux we change the default emulations to be
2N64 instead of N32
3
4Upstream-Status: Inappropriate [ OE configuration Specific]
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Index: binutils-2.24/bfd/config.bfd
9===================================================================
10--- binutils-2.24.orig/bfd/config.bfd 2013-11-04 07:33:37.000000000 -0800
11+++ binutils-2.24/bfd/config.bfd 2013-12-15 11:54:57.113765374 -0800
12@@ -1052,14 +1052,14 @@
13 targ_defvec=bfd_elf32_bigmips_vec
14 targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_big_vec ecoff_little_vec"
15 ;;
16- mips64*el-*-linux*)
17- targ_defvec=bfd_elf32_ntradlittlemips_vec
18- targ_selvecs="bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf64_tradbigmips_vec"
19- ;;
20- mips64*-*-linux*)
21- targ_defvec=bfd_elf32_ntradbigmips_vec
22- targ_selvecs="bfd_elf32_ntradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
23- ;;
24+ mips64*el-*-linux*)
25+ targ_defvec=bfd_elf64_tradlittlemips_vec
26+ targ_selvecs="bfd_elf32_ntradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf64_tradbigmips_vec"
27+ ;;
28+ mips64*-*-linux*)
29+ targ_defvec=bfd_elf64_tradbigmips_vec
30+ targ_selvecs="bfd_elf32_ntradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf64_tradlittlemips_vec"
31+ ;;
32 mips*el-*-linux*)
33 targ_defvec=bfd_elf32_tradlittlemips_vec
34 targ_selvecs="bfd_elf32_tradbigmips_vec ecoff_little_vec ecoff_big_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf64_tradbigmips_vec"
35Index: binutils-2.24/ld/configure.tgt
36===================================================================
37--- binutils-2.24.orig/ld/configure.tgt 2013-11-26 03:37:33.000000000 -0800
38+++ binutils-2.24/ld/configure.tgt 2013-12-15 11:50:52.273766155 -0800
39@@ -471,11 +471,11 @@
40 mips*-*-vxworks*) targ_emul=elf32ebmipvxworks
41 targ_extra_emuls="elf32elmipvxworks" ;;
42 mips*-*-windiss) targ_emul=elf32mipswindiss ;;
43-mips64*el-*-linux-*) targ_emul=elf32ltsmipn32
44- targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
45+mips64*el-*-linux-*) targ_emul=elf64ltsmip
46+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32ltsmip elf32btsmip elf64btsmip"
47 targ_extra_libpath=$targ_extra_emuls ;;
48-mips64*-*-linux-*) targ_emul=elf32btsmipn32
49- targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
50+mips64*-*-linux-*) targ_emul=elf64btsmip
51+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip"
52 targ_extra_libpath=$targ_extra_emuls ;;
53 mips*el-*-linux-*) targ_emul=elf32ltsmip
54 targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/relocatable_sdk.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/relocatable_sdk.patch
new file mode 100644
index 0000000..7408c31
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/relocatable_sdk.patch
@@ -0,0 +1,49 @@
1Upstream-Status: Inappropriate [SDK specific]
2
3This patch will modify the ELF linker scripts so that the crosssdk linker will
4generate binaries with a 4096 bytes PT_INTERP section. When the binaries will
5be relocated, at SDK install time, the interpreter path can be easily changed
6by the relocating script.
7
8Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
9
10Index: binutils_git/ld/genscripts.sh
11===================================================================
12--- binutils_git.orig/ld/genscripts.sh 2012-11-21 11:58:23.325441925 +0200
13+++ binutils_git/ld/genscripts.sh 2012-11-21 12:03:42.106815400 +0200
14@@ -290,6 +290,7 @@
15 LD_FLAG=r
16 DATA_ALIGNMENT=${DATA_ALIGNMENT_r}
17 DEFAULT_DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})"
18+PARTIAL_LINKING=" "
19 ( echo "/* Script for ld -r: link without relocation */"
20 . ${CUSTOMIZER_SCRIPT}
21 . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
22@@ -298,10 +299,12 @@
23 LD_FLAG=u
24 DATA_ALIGNMENT=${DATA_ALIGNMENT_u}
25 CONSTRUCTING=" "
26+PARTIAL_LINKING=" "
27 ( echo "/* Script for ld -Ur: link w/out relocation, do create constructors */"
28 . ${CUSTOMIZER_SCRIPT}
29 . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
30 ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xu
31+unset PARTIAL_LINKING
32
33 LD_FLAG=
34 DATA_ALIGNMENT=${DATA_ALIGNMENT_}
35Index: binutils_git/ld/scripttempl/elf.sc
36===================================================================
37--- binutils_git.orig/ld/scripttempl/elf.sc 2012-11-21 12:02:26.800377384 +0200
38+++ binutils_git/ld/scripttempl/elf.sc 2012-11-21 12:04:16.166109621 +0200
39@@ -124,8 +124,8 @@
40 DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);"
41 DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);"
42 fi
43-if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then
44- INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }"
45+if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}${PARTIAL_LINKING}"; then
46+ INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp); . = 0x1000; }"
47 fi
48 if test -z "$PLT"; then
49 IPLT=".iplt ${RELOCATING-0} : { *(.iplt) }"
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/replace_macros_with_static_inline.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/replace_macros_with_static_inline.patch
new file mode 100644
index 0000000..834f55c
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-linaro-2.24/replace_macros_with_static_inline.patch
@@ -0,0 +1,188 @@
1Upstream-Status: Backport
2
3From 27b829ee701e29804216b3803fbaeb629be27491 Mon Sep 17 00:00:00 2001
4From: Nick Clifton <nickc@redhat.com>
5Date: Wed, 29 Jan 2014 13:46:39 +0000
6Subject: [PATCH 1/1] Following up on Tom's suggestion I am checking in a patch to replace the various
7 bfd_xxx_set macros with static inline functions, so that we can avoid compile time
8 warnings about comma expressions with unused values.
9
10 * bfd-in.h (bfd_set_section_vma): Delete.
11 (bfd_set_section_alignment): Delete.
12 (bfd_set_section_userdata): Delete.
13 (bfd_set_cacheable): Delete.
14 * bfd.c (bfd_set_cacheable): New static inline function.
15 * section.c (bfd_set_section_userdata): Likewise.
16 (bfd_set_section_vma): Likewise.
17 (bfd_set_section_alignment): Likewise.
18 * bfd-in2.h: Regenerate.
19---
20 bfd/ChangeLog | 12 ++++++++++++
21 bfd/bfd-in.h | 5 -----
22 bfd/bfd-in2.h | 41 +++++++++++++++++++++++++++++++++++------
23 bfd/bfd.c | 8 ++++++++
24 bfd/section.c | 26 ++++++++++++++++++++++++++
25 5 files changed, 81 insertions(+), 11 deletions(-)
26
27diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
28index 3afd71b..c7c5a7d 100644
29--- a/bfd/bfd-in.h
30+++ b/bfd/bfd-in.h
31@@ -292,9 +292,6 @@ typedef struct bfd_section *sec_ptr;
32
33 #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
34
35-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
36-#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
37-#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
38 /* Find the address one past the end of SEC. */
39 #define bfd_get_section_limit(bfd, sec) \
40 (((bfd)->direction != write_direction && (sec)->rawsize != 0 \
41@@ -517,8 +514,6 @@ extern void warn_deprecated (const char *, const char *, int, const char *);
42
43 #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
44
45-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
46-
47 extern bfd_boolean bfd_cache_close
48 (bfd *abfd);
49 /* NB: This declaration should match the autogenerated one in libbfd.h. */
50diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
51index 71996db..b5aeb40 100644
52--- a/bfd/bfd-in2.h
53+++ b/bfd/bfd-in2.h
54@@ -299,9 +299,6 @@ typedef struct bfd_section *sec_ptr;
55
56 #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
57
58-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
59-#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
60-#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
61 /* Find the address one past the end of SEC. */
62 #define bfd_get_section_limit(bfd, sec) \
63 (((bfd)->direction != write_direction && (sec)->rawsize != 0 \
64@@ -524,8 +521,6 @@ extern void warn_deprecated (const char *, const char *, int, const char *);
65
66 #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
67
68-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
69-
70 extern bfd_boolean bfd_cache_close
71 (bfd *abfd);
72 /* NB: This declaration should match the autogenerated one in libbfd.h. */
73@@ -1029,7 +1024,7 @@ bfd *bfd_openr (const char *filename, const char *target);
74
75 bfd *bfd_fdopenr (const char *filename, const char *target, int fd);
76
77-bfd *bfd_openstreamr (const char *, const char *, void *);
78+bfd *bfd_openstreamr (const char * filename, const char * target, void * stream);
79
80 bfd *bfd_openr_iovec (const char *filename, const char *target,
81 void *(*open_func) (struct bfd *nbfd,
82@@ -1596,6 +1591,32 @@ struct relax_table {
83 int size;
84 };
85
86+/* Note: the following are provided as inline functions rather than macros
87+ because not all callers use the return value. A macro implementation
88+ would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some
89+ compilers will complain about comma expressions that have no effect. */
90+static inline bfd_boolean
91+bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val)
92+{
93+ ptr->userdata = val;
94+ return TRUE;
95+}
96+
97+static inline bfd_boolean
98+bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val)
99+{
100+ ptr->vma = ptr->lma = val;
101+ ptr->user_set_vma = TRUE;
102+ return TRUE;
103+}
104+
105+static inline bfd_boolean
106+bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val)
107+{
108+ ptr->alignment_power = val;
109+ return TRUE;
110+}
111+
112 /* These sections are global, and are managed by BFD. The application
113 and target back end are not permitted to change the values in
114 these sections. */
115@@ -6415,6 +6436,14 @@ struct bfd
116 unsigned int selective_search : 1;
117 };
118
119+/* See note beside bfd_set_section_userdata. */
120+static inline bfd_boolean
121+bfd_set_cacheable (bfd * abfd, bfd_boolean val)
122+{
123+ abfd->cacheable = val;
124+ return TRUE;
125+}
126+
127 typedef enum bfd_error
128 {
129 bfd_error_no_error = 0,
130diff --git a/bfd/bfd.c b/bfd/bfd.c
131index 8d0580c..2d174f3 100644
132--- a/bfd/bfd.c
133+++ b/bfd/bfd.c
134@@ -311,6 +311,14 @@ CODE_FRAGMENT
135 . unsigned int selective_search : 1;
136 .};
137 .
138+.{* See note beside bfd_set_section_userdata. *}
139+.static inline bfd_boolean
140+.bfd_set_cacheable (bfd * abfd, bfd_boolean val)
141+.{
142+. abfd->cacheable = val;
143+. return TRUE;
144+.}
145+.
146 */
147
148 #include "sysdep.h"
149diff --git a/bfd/section.c b/bfd/section.c
150index fb19d8c..a661228 100644
151--- a/bfd/section.c
152+++ b/bfd/section.c
153@@ -542,6 +542,32 @@ CODE_FRAGMENT
154 . int size;
155 .};
156 .
157+.{* Note: the following are provided as inline functions rather than macros
158+. because not all callers use the return value. A macro implementation
159+. would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some
160+. compilers will complain about comma expressions that have no effect. *}
161+.static inline bfd_boolean
162+.bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val)
163+.{
164+. ptr->userdata = val;
165+. return TRUE;
166+.}
167+.
168+.static inline bfd_boolean
169+.bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val)
170+.{
171+. ptr->vma = ptr->lma = val;
172+. ptr->user_set_vma = TRUE;
173+. return TRUE;
174+.}
175+.
176+.static inline bfd_boolean
177+.bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val)
178+.{
179+. ptr->alignment_power = val;
180+. return TRUE;
181+.}
182+.
183 .{* These sections are global, and are managed by BFD. The application
184 . and target back end are not permitted to change the values in
185 . these sections. *}
186--
1871.7.1
188
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils_linaro-2.24.bb b/meta-linaro-toolchain/recipes-devtools/binutils/binutils_linaro-2.24.bb
new file mode 100644
index 0000000..ef5b7c5
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils_linaro-2.24.bb
@@ -0,0 +1,39 @@
1require recipes-devtools/binutils/binutils.inc
2require recipes-devtools/binutils/binutils-${PV}.inc
3
4DEPENDS += "flex bison zlib"
5
6EXTRA_OECONF += "--with-sysroot=/ \
7 --enable-install-libbfd \
8 --enable-install-libiberty \
9 --enable-shared \
10 "
11
12EXTRA_OECONF_class-native = "--enable-targets=all \
13 --enable-64-bit-bfd \
14 --enable-install-libbfd \
15 --enable-install-libiberty"
16
17do_install_class-native () {
18 autotools_do_install
19
20 # Install the libiberty header
21 install -d ${D}${includedir}
22 install -m 644 ${S}/include/ansidecl.h ${D}${includedir}
23 install -m 644 ${S}/include/libiberty.h ${D}${includedir}
24
25 # We only want libiberty, libbfd and libopcodes
26 rm -rf ${D}${bindir}
27 rm -rf ${D}${prefix}/${TARGET_SYS}
28 rm -rf ${D}${prefix}/lib/ldscripts
29 rm -rf ${D}${prefix}/share/info
30 rm -rf ${D}${prefix}/share/locale
31 rm -rf ${D}${prefix}/share/man
32 rmdir ${D}${prefix}/share || :
33 rmdir ${D}/${libdir}/gcc-lib || :
34 rmdir ${D}/${libdir}64/gcc-lib || :
35 rmdir ${D}/${libdir} || :
36 rmdir ${D}/${libdir}64 || :
37}
38
39BBCLASSEXTEND = "native"
diff --git a/meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/external-linaro-toolchain.bb b/meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/external-linaro-toolchain.bb
new file mode 100644
index 0000000..9e8ad6e
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/external-linaro-toolchain.bb
@@ -0,0 +1,376 @@
1require recipes-core/glibc/glibc-package.inc
2
3INHIBIT_DEFAULT_DEPS = "1"
4INHIBIT_PACKAGE_STRIP = "1"
5INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
6
7# License applies to this recipe code, not the toolchain itself
8LICENSE = "MIT"
9LIC_FILES_CHKSUM = "\
10 file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
11 file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420 \
12"
13
14PROVIDES += "\
15 linux-libc-headers \
16 virtual/${TARGET_PREFIX}gcc \
17 virtual/${TARGET_PREFIX}g++ \
18 virtual/${TARGET_PREFIX}gcc-initial \
19 virtual/${TARGET_PREFIX}binutils \
20 virtual/${TARGET_PREFIX}libc-for-gcc \
21 virtual/${TARGET_PREFIX}compilerlibs \
22 virtual/libc \
23 virtual/libintl \
24 virtual/libiconv \
25 glibc-thread-db \
26 glibc \
27 libgcc \
28 libg2c \
29 libg2c-dev \
30 libssp \
31 libssp-dev \
32 libssp-staticdev \
33 libgfortran \
34 libgfortran-dev \
35 libgfortran-staticdev \
36 libmudflap \
37 libmudflap-dev \
38 libgomp \
39 libgomp-dev \
40 libgomp-staticdev \
41 libitm \
42 libitm-dev \
43 libitm-staticdev \
44 virtual/linux-libc-headers \
45 libgcov-dev \
46"
47
48PV = "${ELT_VER_MAIN}"
49
50# https://launchpad.net/linaro-toolchain-binaries
51SRC_URI = "file://SUPPORTED"
52
53do_install() {
54 install -d ${D}${base_libdir}
55 install -d ${D}${bindir}
56 install -d ${D}${sbindir}
57 install -d ${D}${libdir}
58 install -d ${D}${libexecdir}
59 install -d ${D}${datadir}
60 install -d ${D}${includedir}
61
62 cp -a ${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/lib/* ${D}${base_libdir}
63 if [ -d ${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/libc/lib/${ELT_TARGET_SYS} ]; then
64 cp -a ${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/libc/lib/${ELT_TARGET_SYS}/* ${D}${base_libdir}
65 else
66 cp -a ${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/libc/lib/* ${D}${base_libdir}
67 fi
68 if [ -d ${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/libc/usr/lib/${ELT_TARGET_SYS} ]; then
69 cp -a ${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/libc/usr/lib/${ELT_TARGET_SYS}/* ${D}${libdir}
70 else
71 cp -a ${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/libc/usr/lib/* ${D}${libdir}
72 fi
73 cp -a ${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/libc/usr/share/* ${D}${datadir}
74 cp -a ${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/libc/usr/include/* ${D}${includedir}
75 if [ -d ${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/libc/usr/include/${ELT_TARGET_SYS} ]; then
76 cp -a ${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/libc/usr/include/${ELT_TARGET_SYS}/* ${D}${includedir}
77
78 rm -r ${D}${includedir}/${ELT_TARGET_SYS}
79 fi
80
81 # fix up the copied symlinks (they are still pointing to the multiarch directory)
82 linker_name="${@base_contains("TUNE_FEATURES", "aarch64", "ld-linux-aarch64.so.1", base_contains("TUNE_FEATURES", "callconvention-hard", "ld-linux-armhf.so.3", "ld-linux.so.3",d), d)}"
83 ln -sf ld-${ELT_VER_LIBC}.so ${D}${base_libdir}/${linker_name}
84 ln -sf ../../lib/libnsl.so.1 ${D}${libdir}/libnsl.so
85 ln -sf ../../lib/librt.so.1 ${D}${libdir}/librt.so
86 ln -sf ../../lib/libcrypt.so.1 ${D}${libdir}/libcrypt.so
87 ln -sf ../../lib/libnss_nis.so.2 ${D}${libdir}/libnss_nis.so
88 ln -sf ../../lib/libresolv.so.2 ${D}${libdir}/libresolv.so
89 ln -sf ../../lib/libnss_dns.so.2 ${D}${libdir}/libnss_dns.so
90 ln -sf ../../lib/libnss_hesiod.so.2 ${D}${libdir}/libnss_hesiod.so
91 ln -sf ../../lib/libutil.so.1 ${D}${libdir}/libutil.so
92 ln -sf ../../lib/libnss_files.so.2 ${D}${libdir}/libnss_files.so
93 ln -sf ../../lib/libnss_compat.so.2 ${D}${libdir}/libnss_compat.so
94 ln -sf ../../lib/libcidn.so.1 ${D}${libdir}/libcidn.so
95 ln -sf ../../lib/libBrokenLocale.so.1 ${D}${libdir}/libBrokenLocale.so
96 ln -sf ../../lib/libthread_db.so.1 ${D}${libdir}/libthread_db.so
97 ln -sf ../../lib/libanl.so.1 ${D}${libdir}/libanl.so
98 ln -sf ../../lib/libdl.so.2 ${D}${libdir}/libdl.so
99 ln -sf ../../lib/libnss_nisplus.so.2 ${D}${libdir}/libnss_nisplus.so
100 ln -sf ../../lib/libm.so.6 ${D}${libdir}/libm.so
101
102 if [ -d ${D}${base_libdir}/arm-linux-gnueabi ]; then
103 rm -rf ${D}${base_libdir}/arm-linux-gnueabi
104 fi
105
106 if [ -d ${D}${base_libdir}/ldscripts ]; then
107 rm -rf ${D}${base_libdir}/ldscripts
108 fi
109
110 if [ -f ${D}${libdir}/libc.so ];then
111 sed -i -e "s# /lib/${ELT_TARGET_SYS}# ../../lib#g" -e "s# /usr/lib/${ELT_TARGET_SYS}# .#g" -e "s# /lib/ld-linux# ../../lib/ld-linux#g" ${D}${libdir}/libc.so
112 fi
113 if [ -f ${D}${base_libdir}/libc.so ];then
114 sed -i -e "s# /lib/${ELT_TARGET_SYS}# ../../lib#g" -e "s# /usr/lib/${ELT_TARGET_SYS}# .#g" -e "s# /lib/ld-linux# ../../lib/ld-linux#g" ${D}${base_libdir}/libc.so
115 fi
116 if [ -f ${D}${libdir}/libpthread.so ];then
117 sed -i -e "s# /lib/${ELT_TARGET_SYS}# ../../lib#g" -e "s# /usr/lib/${ELT_TARGET_SYS}# .#g" ${D}${libdir}/libpthread.so
118 fi
119 if [ -f ${D}${base_libdir}/libpthread.so ];then
120 sed -i -e "s# /lib/${ELT_TARGET_SYS}# ../../lib#g" -e "s# /usr/lib/${ELT_TARGET_SYS}# .#g" ${D}${base_libdir}/libpthread.so
121 fi
122}
123
124PACKAGES =+ "\
125 libgcov-dev \
126 libgcc \
127 libgcc-dev \
128 libstdc++ \
129 libstdc++-dev \
130 libstdc++-staticdev \
131 libatomic \
132 libatomic-dev \
133 libatomic-staticdev \
134 libasan \
135 libasan-dev \
136 libasan-staticdev \
137 linux-libc-headers \
138 libubsan \
139 libubsan-dev \
140 libubsan-staticdev \
141 linux-libc-headers-dev \
142 libssp \
143 libssp-dev \
144 libssp-staticdev \
145 libgfortran \
146 libgfortran-dev \
147 libgfortran-staticdev \
148 libmudflap \
149 libmudflap-dev \
150 libmudflap-staticdev \
151 libgomp \
152 libgomp-dev \
153 libgomp-staticdev \
154 libitm \
155 libitm-dev \
156 libitm-staticdev \
157"
158
159INSANE_SKIP_${PN}-dbg = "staticdev"
160INSANE_SKIP_${PN}-utils += "ldflags"
161INSANE_SKIP_libstdc++ += "ldflags"
162INSANE_SKIP_libgcc += "ldflags"
163INSANE_SKIP_gdbserver += "ldflags"
164
165# OE-core has literally listed 'glibc' in LIBC_DEPENDENCIES :/
166RPROVIDES_${PN} = "glibc"
167# Add runtime provides for the other libc* packages as well
168RPROVIDES_${PN}-dev = "glibc-dev"
169RPROVIDES_${PN}-doc = "glibc-doc"
170RPROVIDES_${PN}-dbg = "glibc-dbg"
171RPROVIDES_${PN}-pic = "glibc-pic"
172RPROVIDES_${PN}-utils = "glibc-utils"
173
174PKG_${PN} = "glibc"
175PKG_${PN}-dev = "glibc-dev"
176PKG_${PN}-doc = "glibc-doc"
177PKG_${PN}-dbg = "glibc-dbg"
178PKG_${PN}-pic = "glibc-pic"
179PKG_${PN}-utils = "glibc-utils"
180PKG_${PN}-gconv = "glibc-gconv"
181PKG_${PN}-extra-nss = "glibc-extra-nss"
182PKG_${PN}-thread-db = "glibc-thread-db"
183PKG_${PN}-pcprofile = "glibc-pcprofile"
184PKG_${PN}-staticdev = "glibc-staticdev"
185
186PKGV_${PN} = "${ELT_VER_LIBC}"
187PKGV_${PN}-dev = "${ELT_VER_LIBC}"
188PKGV_${PN}-doc = "${ELT_VER_LIBC}"
189PKGV_${PN}-dbg = "${ELT_VER_LIBC}"
190PKGV_${PN}-pic = "${ELT_VER_LIBC}"
191PKGV_${PN}-utils = "${ELT_VER_LIBC}"
192PKGV_${PN}-gconv = "${ELT_VER_LIBC}"
193PKGV_${PN}-extra-nss = "${ELT_VER_LIBC}"
194PKGV_${PN}-thread-db = "${ELT_VER_LIBC}"
195PKGV_${PN}-pcprofile = "${ELT_VER_LIBC}"
196PKGV_${PN}-staticdev = "${ELT_VER_LIBC}"
197PKGV_catchsegv = "${ELT_VER_LIBC}"
198PKGV_libsegfault = "${ELT_VER_LIBC}"
199PKGV_sln = "${ELT_VER_LIBC}"
200PKGV_nscd = "${ELT_VER_LIBC}"
201PKGV_ldd = "${ELT_VER_LIBC}"
202PKGV_libgcc = "${ELT_VER_GCC}"
203PKGV_libgcc-dev = "${ELT_VER_GCC}"
204PKGV_libstdc++ = "${ELT_VER_GCC}"
205PKGV_libstdc++-dev = "${ELT_VER_GCC}"
206PKGV_libstdc++-staticdev = "${ELT_VER_GCC}"
207PKGV_libatomic = "${ELT_VER_GCC}"
208PKGV_libatomic = "${ELT_VER_GCC}"
209PKGV_libatomic = "${ELT_VER_GCC}"
210PKGV_libasan = "${ELT_VER_GCC}"
211PKGV_libasan-dev = "${ELT_VER_GCC}"
212PKGV_libasan-staticdev = "${ELT_VER_GCC}"
213PKGV_libubsan = "${ELT_VER_GCC}"
214PKGV_libubsan-dev = "${ELT_VER_GCC}"
215PKGV_libubsan-staticdev = "${ELT_VER_GCC}"
216PKGV_linux-libc-headers = "${ELT_VER_KERNEL}"
217PKGV_linux-libc-headers-dev = "${ELT_VER_KERNEL}"
218PKGV_gdbserver = "${ELT_VER_GDBSERVER}"
219
220FILES_libgcov-dev = "${libdir}/${TARGET_SYS}/${BINV}/libgcov.a"
221
222FILES_libsegfault = "${base_libdir}/libSegFault*"
223
224FILES_catchsegv = "${bindir}/catchsegv"
225RDEPENDS_catchsegv = "libsegfault"
226
227FILES_libatomic = "${base_libdir}/libatomic.so.*"
228FILES_libatomic-dev = "\
229 ${base_libdir}/libatomic.so \
230 ${base_libdir}/libatomic.la \
231"
232FILES_libatomic-staticdev = "${base_libdir}/libatomic.a"
233
234FILES_libasan = "${base_libdir}/libasan.so.*"
235FILES_libasan-dev = "\
236 ${base_libdir}/libasan.so \
237 ${base_libdir}/libasan.la \
238"
239FILES_libasan-staticdev = "${base_libdir}/libasan.a"
240
241FILES_libubsan = "${base_libdir}/libubsan.so.*"
242FILES_libubsan-dev = "\
243 ${base_libdir}/libubsan.so \
244 ${base_libdir}/libubsan.la \
245"
246FILES_libubsan-staticdev = "${base_libdir}/libubsan.a"
247
248FILES_libgcc = "${base_libdir}/libgcc_s.so.1"
249FILES_libgcc-dev = "${base_libdir}/libgcc_s.so"
250FILES_libstdc++ = "${base_libdir}/libstdc++.so.*"
251FILES_libstdc++-dev = "\
252 ${includedir}/c++/${PV} \
253 ${base_libdir}/libstdc++.so"
254FILES_libstdc++-staticdev = "\
255 ${base_libdir}/libstdc++.a \
256 ${base_libdir}/libsupc++.a \
257"
258FILES_linux-libc-headers = "\
259 ${includedir}/asm* \
260 ${includedir}/linux \
261 ${includedir}/mtd \
262 ${includedir}/rdma \
263 ${includedir}/scsi \
264 ${includedir}/sound \
265 ${includedir}/video \
266"
267FILES_${PN} += "\
268 ${libdir}/bin \
269 ${libdir}/locale \
270 ${libdir}/gconv/gconv-modules \
271 ${datadir}/zoneinfo \
272 ${base_libdir}/libcrypt*.so.* \
273 ${base_libdir}/libcrypt-*.so \
274 ${base_libdir}/libc.so.* \
275 ${base_libdir}/libc-*.so \
276 ${base_libdir}/libm.so.* \
277 ${base_libdir}/libmemusage.so \
278 ${base_libdir}/libm-*.so \
279 ${base_libdir}/ld*.so.* \
280 ${base_libdir}/ld-*.so \
281 ${base_libdir}/libpthread*.so.* \
282 ${base_libdir}/libpthread-*.so \
283 ${base_libdir}/libresolv*.so.* \
284 ${base_libdir}/libresolv-*.so \
285 ${base_libdir}/librt*.so.* \
286 ${base_libdir}/librt-*.so \
287 ${base_libdir}/libutil*.so.* \
288 ${base_libdir}/libutil-*.so \
289 ${base_libdir}/libnsl*.so.* \
290 ${base_libdir}/libnsl-*.so \
291 ${base_libdir}/libnss_files*.so.* \
292 ${base_libdir}/libnss_files-*.so \
293 ${base_libdir}/libnss_compat*.so.* \
294 ${base_libdir}/libnss_compat-*.so \
295 ${base_libdir}/libnss_dns*.so.* \
296 ${base_libdir}/libnss_dns-*.so \
297 ${base_libdir}/libnss_nis*.so.* \
298 ${base_libdir}/libnss_nisplus-*.so \
299 ${base_libdir}/libnss_nisplus*.so.* \
300 ${base_libdir}/libnss_nis-*.so \
301 ${base_libdir}/libnss_hesiod*.so.* \
302 ${base_libdir}/libnss_hesiod-*.so \
303 ${base_libdir}/libdl*.so.* \
304 ${base_libdir}/libdl-*.so \
305 ${base_libdir}/libanl*.so.* \
306 ${base_libdir}/libanl-*.so \
307 ${base_libdir}/libBrokenLocale*.so.* \
308 ${base_libdir}/libBrokenLocale-*.so \
309 ${base_libdir}/libcidn*.so.* \
310 ${base_libdir}/libcidn-*.so \
311 ${base_libdir}/libthread_db*.so.* \
312 ${base_libdir}/libthread_db-*.so \
313 ${base_libdir}/libmemusage.so \
314 ${base_libdir}/libSegFault.so \
315 ${base_libdir}/libpcprofile.so \
316 "
317
318FILES_libstdc++ = "${base_libdir}/libstdc++.so.*"
319FILES_libstdc++-dev = "\
320 ${includedir}/c++/ \
321 ${base_libdir}/libstdc++.so \
322 ${base_libdir}/libstdc++.la \
323 ${base_libdir}/libsupc++.la"
324FILES_libstdc++-staticdev = "\
325 ${base_libdir}/libstdc++.a \
326 ${base_libdir}/libsupc++.a"
327
328FILES_libstdc++-precompile-dev = "${includedir}/c++/${TARGET_SYS}/bits/*.gch"
329
330FILES_libssp = "${base_libdir}/libssp.so.*"
331FILES_libssp-dev = " \
332 ${base_libdir}/libssp*.so \
333 ${base_libdir}/libssp*_nonshared.a \
334 ${base_libdir}/libssp*.la \
335 ${base_libdir}/gcc/${TARGET_SYS}/${BINV}/include/ssp"
336FILES_libssp-staticdev = " \
337 ${base_libdir}/libssp*.a"
338
339FILES_libgfortran = "${base_libdir}/libgfortran.so.*"
340FILES_libgfortran-dev = " \
341 ${base_libdir}/libgfortran.so"
342FILES_libgfortran-staticdev = " \
343 ${base_libdir}/libgfortran.a \
344 ${base_libdir}/libgfortranbegin.a"
345
346FILES_libmudflap = "${base_libdir}/libmudflap*.so.*"
347FILES_libmudflap-dev = "\
348 ${base_libdir}/libmudflap*.so \
349 ${base_libdir}/libmudflap*.a \
350 ${base_libdir}/libmudflap*.la"
351
352FILES_libitm = "${base_libdir}/libitm*${SOLIBS}"
353FILES_libitm-dev = "\
354 ${base_libdir}/libitm*${SOLIBSDEV} \
355 ${base_libdir}/libitm*.la \
356 ${base_libdir}/libitm.spec \
357 "
358FILES_libitm-staticdev = "\
359 ${base_libdir}/libitm*.a \
360 "
361
362FILES_libgomp = "${base_libdir}/libgomp*${SOLIBS}"
363FILES_libgomp-dev = "\
364 ${base_libdir}/libgomp*${SOLIBSDEV} \
365 ${base_libdir}/libgomp*.la \
366 ${base_libdir}/libgomp.spec \
367 ${base_libdir}/gcc/${TARGET_SYS}/${BINV}/include/omp.h \
368 "
369FILES_libgomp-staticdev = "\
370 ${base_libdir}/libgomp*.a \
371 "
372ELT_VER_MAIN ??= ""
373
374python () {
375 if not d.getVar("ELT_VER_MAIN"):
376 raise bb.parse.SkipPackage("External Linaro toolchain not configured (ELT_VER_MAIN not set).")
diff --git a/meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/files/SUPPORTED b/meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/files/SUPPORTED
new file mode 100644
index 0000000..9615075
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/external-linaro-toolchain/files/SUPPORTED
@@ -0,0 +1 @@
POSIX
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross-canadian_linaro-4.8.bb b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross-canadian_linaro-4.8.bb
new file mode 100644
index 0000000..81c4700
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross-canadian_linaro-4.8.bb
@@ -0,0 +1,2 @@
1require gcc-linaro-common-4.8.inc
2require recipes-devtools/gcc/gcc-cross-canadian_${BASEPV}.bb
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross-canadian_linaro-4.9.bb b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross-canadian_linaro-4.9.bb
new file mode 100644
index 0000000..c473b6f
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross-canadian_linaro-4.9.bb
@@ -0,0 +1,2 @@
1require gcc-linaro-common-4.9.inc
2require recipes-devtools/gcc/gcc-cross-canadian_${BASEPV}.bb
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross-initial_linaro-4.8.bb b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross-initial_linaro-4.8.bb
new file mode 100644
index 0000000..c13cecf
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross-initial_linaro-4.8.bb
@@ -0,0 +1,3 @@
1BASEPV = "4.8"
2PV = "linaro-${BASEPV}"
3require recipes-devtools/gcc/gcc-cross-initial_${BASEPV}.bb
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross-initial_linaro-4.9.bb b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross-initial_linaro-4.9.bb
new file mode 100644
index 0000000..3a7abea
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross-initial_linaro-4.9.bb
@@ -0,0 +1,3 @@
1BASEPV = "4.9"
2PV = "linaro-${BASEPV}"
3require recipes-devtools/gcc/gcc-cross-initial_${BASEPV}.bb
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross_linaro-4.8.bb b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross_linaro-4.8.bb
new file mode 100644
index 0000000..05de58b
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross_linaro-4.8.bb
@@ -0,0 +1,3 @@
1BASEPV = "4.8"
2PV = "linaro-${BASEPV}"
3require recipes-devtools/gcc/gcc-cross_${BASEPV}.bb
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross_linaro-4.9.bb b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross_linaro-4.9.bb
new file mode 100644
index 0000000..cc76e36
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-cross_linaro-4.9.bb
@@ -0,0 +1,3 @@
1BASEPV = "4.9"
2PV = "linaro-${BASEPV}"
3require recipes-devtools/gcc/gcc-cross_${BASEPV}.bb
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-crosssdk-initial_linaro-4.8.bb b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-crosssdk-initial_linaro-4.8.bb
new file mode 100644
index 0000000..09276a2
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-crosssdk-initial_linaro-4.8.bb
@@ -0,0 +1,4 @@
1require gcc-linaro-common-4.8.inc
2require recipes-devtools/gcc/gcc-crosssdk-initial_${BASEPV}.bb
3
4EXTRA_OECONF += " --with-native-system-header-dir=${SYSTEMHEADERS} "
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-crosssdk-initial_linaro-4.9.bb b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-crosssdk-initial_linaro-4.9.bb
new file mode 100644
index 0000000..eb3719e
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-crosssdk-initial_linaro-4.9.bb
@@ -0,0 +1,4 @@
1require gcc-linaro-common-4.9.inc
2require recipes-devtools/gcc/gcc-crosssdk-initial_${BASEPV}.bb
3
4EXTRA_OECONF += " --with-native-system-header-dir=${SYSTEMHEADERS} "
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-crosssdk_linaro-4.8.bb b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-crosssdk_linaro-4.8.bb
new file mode 100644
index 0000000..e622a48
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-crosssdk_linaro-4.8.bb
@@ -0,0 +1,2 @@
1require gcc-linaro-common-4.8.inc
2require recipes-devtools/gcc/gcc-crosssdk_${BASEPV}.bb
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-crosssdk_linaro-4.9.bb b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-crosssdk_linaro-4.9.bb
new file mode 100644
index 0000000..5c3ab13
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-crosssdk_linaro-4.9.bb
@@ -0,0 +1,2 @@
1require gcc-linaro-common-4.9.inc
2require recipes-devtools/gcc/gcc-crosssdk_${BASEPV}.bb
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8.inc b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8.inc
new file mode 100644
index 0000000..76660d3
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8.inc
@@ -0,0 +1,73 @@
1require recipes-devtools/gcc/gcc-4.8.inc
2PV = "linaro-${BASEPV}"
3
4MMYY = "14.04"
5RELEASE = "20${MMYY}"
6PR = "r${RELEASE}"
7BINV = "4.8.3"
8
9FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/gcc-${PV}' ], d)}"
10FILESPATH_append := ":${COREBASE}/meta/recipes-devtools/gcc/gcc-4.8"
11
12SRC_URI = "https://releases.linaro.org/${MMYY}/components/toolchain/gcc-linaro/${BASEPV}/gcc-${PV}-${RELEASE}.tar.xz \
13 file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
14 file://0002-uclibc-conf.patch \
15 file://0003-gcc-uclibc-locale-ctype_touplow_t.patch \
16 file://0004-uclibc-locale.patch \
17 file://0005-uclibc-locale-no__x.patch \
18 file://0006-uclibc-locale-wchar_fix.patch \
19 file://0007-uclibc-locale-update.patch \
20 file://0008-missing-execinfo_h.patch \
21 file://0009-c99-snprintf.patch \
22 file://0010-c99-complex-ugly-hack.patch \
23 file://0011-index_macro.patch \
24 file://0012-libmudflap-susv3-legacy.patch \
25 file://0013-libstdc-namespace.patch \
26 file://0014-sh-pr24836.patch \
27 file://0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch;apply=no \
28 file://0016-gcc-poison-system-directories.patch \
29 file://0017-gcc-poison-dir-extend.patch \
30 file://0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
31 file://0019-64-bit-multilib-hack.patch \
32 file://0020-optional-libstdc.patch \
33 file://0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch \
34 file://0022-COLLECT_GCC_OPTIONS.patch \
35 file://0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
36 file://0024-PR-target-32219.patch \
37 file://0025-fortran-cross-compile-hack.patch \
38 file://0026-libgcc-sjlj-check.patch \
39 file://0027-cpp-honor-sysroot.patch \
40 file://0028-MIPS64-Default-to-N64-ABI.patch \
41 file://0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
42 file://0030-gcc-Fix-argument-list-too-long-error.patch \
43 file://0031-Disable-sdt.patch \
44 file://0032-libtool.patch \
45 file://0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
46 file://0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
47 file://0035-wcast-qual-PR-55383.patch \
48 file://0037-gcc-4.8-PR56797.patch \
49 file://0038-gcc-4.8-build-args.patch;apply=no \
50 file://0039-gcc-4.8-PR57717.patch;apply=no \
51 file://0040-fix-g++-sysroot.patch \
52 file://0041-libtool-avoid-libdir.patch \
53 file://0042-pr57748.patch \
54 file://0043-cpp.patch \
55 file://0044-gengtypes.patch \
56 file://0045-gcc-4.8-PR57717-PowerPC-E500v2.patch \
57 file://0046-libatomic-deptracking.patch \
58 file://0047-repomembug.patch \
59 file://0048-PR58854_fix_arm_apcs_epilogue.patch;apply=no \
60 file://0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch \
61 file://0050-PR-target-58595.patch \
62 file://use-lib-for-aarch64.patch \
63 file://0001-AArch64-Define-BE-loader-name.patch \
64 file://AArch64-Define-BE-loader-name-default-be.patch \
65 file://add-install-ptest-to-Makefile.patch \
66 file://run-ptest \
67 "
68
69SRC_URI[md5sum] = "5ba2f3a449b1658ccc09d27cc7ab3c03"
70SRC_URI[sha256sum] = "9a72b00f50265fc6ea92e95383fa0b25450cf15fc685a33a67ad15e10a008808"
71
72S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}-${RELEASE}"
73B = "${WORKDIR}/gcc-${PV}-${RELEASE}/build.${HOST_SYS}.${TARGET_SYS}"
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0001-AArch64-Define-BE-loader-name.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0001-AArch64-Define-BE-loader-name.patch
new file mode 100644
index 0000000..b529d6d
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0001-AArch64-Define-BE-loader-name.patch
@@ -0,0 +1,42 @@
1From 33a9ec1309cf9e4c8b64f289acf509c81d5bb3f8 Mon Sep 17 00:00:00 2001
2From: mshawcroft <mshawcroft@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Mon, 20 Jan 2014 17:41:54 +0000
4Subject: [PATCH] [AArch64] Define BE loader name.
5
6 Backport from mainline
7 2014-03-19 Victor Kamensky <victor.kamensky@linaro.org>
8
9 2014-01-20 Marcus Shawcroft <marcus.shawcroft@arm.com>
10
11 * config/aarch64/aarch64-linux.h (GLIBC_DYNAMIC_LINKER): Expand
12 loader name using mbig-endian.
13 (LINUX_TARGET_LINK_SPEC): Pass linker -m flag.
14
15git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206845 138bc75d-0d04-0410-961f-82ee72b054a4
16---
17 gcc/config/aarch64/aarch64-linux.h | 5 +++--
18 2 files changed, 9 insertions(+), 2 deletions(-)
19
20Index: gcc-linaro-4.8-2014.03/gcc/config/aarch64/aarch64-linux.h
21===================================================================
22--- gcc-linaro-4.8-2014.03.orig/gcc/config/aarch64/aarch64-linux.h
23+++ gcc-linaro-4.8-2014.03/gcc/config/aarch64/aarch64-linux.h
24@@ -21,7 +21,7 @@
25 #ifndef GCC_AARCH64_LINUX_H
26 #define GCC_AARCH64_LINUX_H
27
28-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64.so.1"
29+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}.so.1"
30
31 #define CPP_SPEC "%{pthread:-D_REENTRANT}"
32
33@@ -32,7 +32,8 @@
34 %{rdynamic:-export-dynamic} \
35 -dynamic-linker " GNU_USER_DYNAMIC_LINKER " \
36 -X \
37- %{mbig-endian:-EB} %{mlittle-endian:-EL}"
38+ %{mbig-endian:-EB} %{mlittle-endian:-EL} \
39+ -maarch64linux%{mbig-endian:b}"
40
41 #define LINK_SPEC LINUX_TARGET_LINK_SPEC
42
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000..fe564c1
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
@@ -0,0 +1,39 @@
1From bf3d96ae58fa180b8b468d25dc2e0209daca2751 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:37:11 +0400
4Subject: [PATCH 01/35] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Inappropriate [embedded specific]
9---
10 configure | 2 +-
11 configure.ac | 2 +-
12 2 files changed, 2 insertions(+), 2 deletions(-)
13
14diff --git a/configure b/configure
15index f16d506..d260ee2 100755
16--- a/configure
17+++ b/configure
18@@ -7490,7 +7490,7 @@ fi
19 # for target_alias and gcc doesn't manage it consistently.
20 target_configargs="--cache-file=./config.cache ${target_configargs}"
21
22-FLAGS_FOR_TARGET=
23+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
24 case " $target_configdirs " in
25 *" newlib "*)
26 case " $target_configargs " in
27diff --git a/configure.ac b/configure.ac
28index d5d609b..b5beb30 100644
29--- a/configure.ac
30+++ b/configure.ac
31@@ -2878,7 +2878,7 @@ fi
32 # for target_alias and gcc doesn't manage it consistently.
33 target_configargs="--cache-file=./config.cache ${target_configargs}"
34
35-FLAGS_FOR_TARGET=
36+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
37 case " $target_configdirs " in
38 *" newlib "*)
39 case " $target_configargs " in
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0002-uclibc-conf.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0002-uclibc-conf.patch
new file mode 100644
index 0000000..dda3b10
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0002-uclibc-conf.patch
@@ -0,0 +1,53 @@
1From d030973c872c00d916921d84deee0af2c0d38081 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:38:25 +0400
4Subject: [PATCH 02/35] uclibc-conf
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 contrib/regression/objs-gcc.sh | 4 ++++
11 libjava/classpath/ltconfig | 4 ++--
12 2 files changed, 6 insertions(+), 2 deletions(-)
13
14diff --git a/contrib/regression/objs-gcc.sh b/contrib/regression/objs-gcc.sh
15index 60b0497..6dc7ead 100755
16--- a/contrib/regression/objs-gcc.sh
17+++ b/contrib/regression/objs-gcc.sh
18@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-gnu ]
19 then
20 make all-gdb all-dejagnu all-ld || exit 1
21 make install-gdb install-dejagnu install-ld || exit 1
22+elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
23+ then
24+ make all-gdb all-dejagnu all-ld || exit 1
25+ make install-gdb install-dejagnu install-ld || exit 1
26 elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
27 make bootstrap || exit 1
28 make install || exit 1
29diff --git a/libjava/classpath/ltconfig b/libjava/classpath/ltconfig
30index 743d951..ae4ea60 100755
31--- a/libjava/classpath/ltconfig
32+++ b/libjava/classpath/ltconfig
33@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
34
35 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
36 case $host_os in
37-linux-gnu*) ;;
38+linux-gnu*|linux-uclibc*) ;;
39 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
40 esac
41
42@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
43 ;;
44
45 # This must be Linux ELF.
46-linux-gnu*)
47+linux*)
48 version_type=linux
49 need_lib_prefix=no
50 need_version=no
51--
521.7.10.4
53
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0003-gcc-uclibc-locale-ctype_touplow_t.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0003-gcc-uclibc-locale-ctype_touplow_t.patch
new file mode 100644
index 0000000..7098e99
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0003-gcc-uclibc-locale-ctype_touplow_t.patch
@@ -0,0 +1,87 @@
1From d2d9dd756c4356d14dd7ae003856344cb4f37985 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:40:12 +0400
4Subject: [PATCH 03/35] gcc-uclibc-locale-ctype_touplow_t
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/config/locale/generic/c_locale.cc | 5 +++++
11 libstdc++-v3/config/locale/generic/c_locale.h | 9 +++++++++
12 libstdc++-v3/config/os/gnu-linux/ctype_base.h | 9 +++++++++
13 3 files changed, 23 insertions(+)
14
15diff --git a/libstdc++-v3/config/locale/generic/c_locale.cc b/libstdc++-v3/config/locale/generic/c_locale.cc
16index 0d309a5..f2f1e1f 100644
17--- a/libstdc++-v3/config/locale/generic/c_locale.cc
18+++ b/libstdc++-v3/config/locale/generic/c_locale.cc
19@@ -263,5 +263,10 @@ _GLIBCXX_END_NAMESPACE_VERSION
20 #ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
21 #define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
22 extern "C" void ldbl (void) __attribute__ ((alias (#dbl)))
23+#ifdef __UCLIBC__
24+// This is because __c_locale is of type __ctype_touplow_t* which is short on uclibc. for glibc its int*
25+_GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPs, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPs);
26+#else
27 _GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPi, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPi);
28+#endif
29 #endif // _GLIBCXX_LONG_DOUBLE_COMPAT
30diff --git a/libstdc++-v3/config/locale/generic/c_locale.h b/libstdc++-v3/config/locale/generic/c_locale.h
31index b5fd989..3da9a5d 100644
32--- a/libstdc++-v3/config/locale/generic/c_locale.h
33+++ b/libstdc++-v3/config/locale/generic/c_locale.h
34@@ -40,13 +40,22 @@
35
36 #include <clocale>
37
38+#ifdef __UCLIBC__
39+#include <features.h>
40+#include <ctype.h>
41+#endif
42+
43 #define _GLIBCXX_NUM_CATEGORIES 0
44
45 namespace std _GLIBCXX_VISIBILITY(default)
46 {
47 _GLIBCXX_BEGIN_NAMESPACE_VERSION
48
49+#ifdef __UCLIBC__
50+ typedef __ctype_touplow_t* __c_locale;
51+#else
52 typedef int* __c_locale;
53+#endif
54
55 // Convert numeric value of type double and long double to string and
56 // return length of string. If vsnprintf is available use it, otherwise
57diff --git a/libstdc++-v3/config/os/gnu-linux/ctype_base.h b/libstdc++-v3/config/os/gnu-linux/ctype_base.h
58index 2d8e978..14eb08f 100644
59--- a/libstdc++-v3/config/os/gnu-linux/ctype_base.h
60+++ b/libstdc++-v3/config/os/gnu-linux/ctype_base.h
61@@ -33,6 +33,11 @@
62
63 // Information as gleaned from /usr/include/ctype.h
64
65+#ifdef __UCLIBC__
66+#include <features.h>
67+#include <ctype.h>
68+#endif
69+
70 namespace std _GLIBCXX_VISIBILITY(default)
71 {
72 _GLIBCXX_BEGIN_NAMESPACE_VERSION
73@@ -41,7 +46,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
74 struct ctype_base
75 {
76 // Non-standard typedefs.
77+#ifdef __UCLIBC__
78+ typedef const __ctype_touplow_t* __to_type;
79+#else
80 typedef const int* __to_type;
81+#endif
82
83 // NB: Offsets into ctype<char>::_M_table force a particular size
84 // on the mask type. Because of this, we don't use an enum.
85--
861.7.10.4
87
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0004-uclibc-locale.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0004-uclibc-locale.patch
new file mode 100644
index 0000000..49f5f33
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0004-uclibc-locale.patch
@@ -0,0 +1,2862 @@
1From a55c751a449c2cbf0b3fcc07aab1b86bf9661510 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:41:39 +0400
4Subject: [PATCH 04/35] uclibc-locale
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/acinclude.m4 | 37 ++
11 .../config/locale/uclibc/c++locale_internal.h | 63 ++
12 libstdc++-v3/config/locale/uclibc/c_locale.cc | 160 +++++
13 libstdc++-v3/config/locale/uclibc/c_locale.h | 117 ++++
14 .../config/locale/uclibc/codecvt_members.cc | 308 +++++++++
15 .../config/locale/uclibc/collate_members.cc | 80 +++
16 libstdc++-v3/config/locale/uclibc/ctype_members.cc | 300 +++++++++
17 .../config/locale/uclibc/messages_members.cc | 100 +++
18 .../config/locale/uclibc/messages_members.h | 118 ++++
19 .../config/locale/uclibc/monetary_members.cc | 692 ++++++++++++++++++++
20 .../config/locale/uclibc/numeric_members.cc | 160 +++++
21 libstdc++-v3/config/locale/uclibc/time_members.cc | 406 ++++++++++++
22 libstdc++-v3/config/locale/uclibc/time_members.h | 68 ++
23 libstdc++-v3/configure | 75 +++
24 libstdc++-v3/include/c_compatibility/wchar.h | 2 +
25 libstdc++-v3/include/c_std/cwchar | 2 +
26 16 files changed, 2688 insertions(+)
27 create mode 100644 libstdc++-v3/config/locale/uclibc/c++locale_internal.h
28 create mode 100644 libstdc++-v3/config/locale/uclibc/c_locale.cc
29 create mode 100644 libstdc++-v3/config/locale/uclibc/c_locale.h
30 create mode 100644 libstdc++-v3/config/locale/uclibc/codecvt_members.cc
31 create mode 100644 libstdc++-v3/config/locale/uclibc/collate_members.cc
32 create mode 100644 libstdc++-v3/config/locale/uclibc/ctype_members.cc
33 create mode 100644 libstdc++-v3/config/locale/uclibc/messages_members.cc
34 create mode 100644 libstdc++-v3/config/locale/uclibc/messages_members.h
35 create mode 100644 libstdc++-v3/config/locale/uclibc/monetary_members.cc
36 create mode 100644 libstdc++-v3/config/locale/uclibc/numeric_members.cc
37 create mode 100644 libstdc++-v3/config/locale/uclibc/time_members.cc
38 create mode 100644 libstdc++-v3/config/locale/uclibc/time_members.h
39
40diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
41index 0871a6a..326d7ef 100644
42--- a/libstdc++-v3/acinclude.m4
43+++ b/libstdc++-v3/acinclude.m4
44@@ -1905,6 +1905,9 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
45 # Default to "generic".
46 if test $enable_clocale_flag = auto; then
47 case ${target_os} in
48+ *-uclibc*)
49+ enable_clocale_flag=uclibc
50+ ;;
51 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
52 enable_clocale_flag=gnu
53 ;;
54@@ -2069,6 +2072,40 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
55 CTIME_CC=config/locale/generic/time_members.cc
56 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
57 ;;
58+ uclibc)
59+ AC_MSG_RESULT(uclibc)
60+
61+ # Declare intention to use gettext, and add support for specific
62+ # languages.
63+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
64+ ALL_LINGUAS="de fr"
65+
66+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
67+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
68+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
69+ USE_NLS=yes
70+ fi
71+ # Export the build objects.
72+ for ling in $ALL_LINGUAS; do \
73+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
74+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
75+ done
76+ AC_SUBST(glibcxx_MOFILES)
77+ AC_SUBST(glibcxx_POFILES)
78+
79+ CLOCALE_H=config/locale/uclibc/c_locale.h
80+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
81+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
82+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
83+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
84+ CMESSAGES_H=config/locale/uclibc/messages_members.h
85+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
86+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
87+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
88+ CTIME_H=config/locale/uclibc/time_members.h
89+ CTIME_CC=config/locale/uclibc/time_members.cc
90+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
91+ ;;
92 esac
93
94 # This is where the testsuite looks for locale catalogs, using the
95diff --git a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
96new file mode 100644
97index 0000000..2ae3e4a
98--- /dev/null
99+++ b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
100@@ -0,0 +1,63 @@
101+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
102+
103+// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
104+//
105+// This file is part of the GNU ISO C++ Library. This library is free
106+// software; you can redistribute it and/or modify it under the
107+// terms of the GNU General Public License as published by the
108+// Free Software Foundation; either version 2, or (at your option)
109+// any later version.
110+
111+// This library is distributed in the hope that it will be useful,
112+// but WITHOUT ANY WARRANTY; without even the implied warranty of
113+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
114+// GNU General Public License for more details.
115+
116+// You should have received a copy of the GNU General Public License along
117+// with this library; see the file COPYING. If not, write to the Free
118+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
119+// USA.
120+
121+// As a special exception, you may use this file as part of a free software
122+// library without restriction. Specifically, if other files instantiate
123+// templates or use macros or inline functions from this file, or you compile
124+// this file and link it with other files to produce an executable, this
125+// file does not by itself cause the resulting executable to be covered by
126+// the GNU General Public License. This exception does not however
127+// invalidate any other reasons why the executable file might be covered by
128+// the GNU General Public License.
129+
130+// Written by Jakub Jelinek <jakub@redhat.com>
131+
132+#include <bits/c++config.h>
133+#include <clocale>
134+
135+#ifdef __UCLIBC_MJN3_ONLY__
136+#warning clean this up
137+#endif
138+
139+#ifdef __UCLIBC_HAS_XLOCALE__
140+
141+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
142+extern "C" __typeof(strcoll_l) __strcoll_l;
143+extern "C" __typeof(strftime_l) __strftime_l;
144+extern "C" __typeof(strtod_l) __strtod_l;
145+extern "C" __typeof(strtof_l) __strtof_l;
146+extern "C" __typeof(strtold_l) __strtold_l;
147+extern "C" __typeof(strxfrm_l) __strxfrm_l;
148+extern "C" __typeof(newlocale) __newlocale;
149+extern "C" __typeof(freelocale) __freelocale;
150+extern "C" __typeof(duplocale) __duplocale;
151+extern "C" __typeof(uselocale) __uselocale;
152+
153+#ifdef _GLIBCXX_USE_WCHAR_T
154+extern "C" __typeof(iswctype_l) __iswctype_l;
155+extern "C" __typeof(towlower_l) __towlower_l;
156+extern "C" __typeof(towupper_l) __towupper_l;
157+extern "C" __typeof(wcscoll_l) __wcscoll_l;
158+extern "C" __typeof(wcsftime_l) __wcsftime_l;
159+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
160+extern "C" __typeof(wctype_l) __wctype_l;
161+#endif
162+
163+#endif // GLIBC 2.3 and later
164diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.cc b/libstdc++-v3/config/locale/uclibc/c_locale.cc
165new file mode 100644
166index 0000000..5081dc1
167--- /dev/null
168+++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc
169@@ -0,0 +1,160 @@
170+// Wrapper for underlying C-language localization -*- C++ -*-
171+
172+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
173+//
174+// This file is part of the GNU ISO C++ Library. This library is free
175+// software; you can redistribute it and/or modify it under the
176+// terms of the GNU General Public License as published by the
177+// Free Software Foundation; either version 2, or (at your option)
178+// any later version.
179+
180+// This library is distributed in the hope that it will be useful,
181+// but WITHOUT ANY WARRANTY; without even the implied warranty of
182+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
183+// GNU General Public License for more details.
184+
185+// You should have received a copy of the GNU General Public License along
186+// with this library; see the file COPYING. If not, write to the Free
187+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
188+// USA.
189+
190+// As a special exception, you may use this file as part of a free software
191+// library without restriction. Specifically, if other files instantiate
192+// templates or use macros or inline functions from this file, or you compile
193+// this file and link it with other files to produce an executable, this
194+// file does not by itself cause the resulting executable to be covered by
195+// the GNU General Public License. This exception does not however
196+// invalidate any other reasons why the executable file might be covered by
197+// the GNU General Public License.
198+
199+//
200+// ISO C++ 14882: 22.8 Standard locale categories.
201+//
202+
203+// Written by Benjamin Kosnik <bkoz@redhat.com>
204+
205+#include <cerrno> // For errno
206+#include <locale>
207+#include <stdexcept>
208+#include <langinfo.h>
209+#include <bits/c++locale_internal.h>
210+
211+#ifndef __UCLIBC_HAS_XLOCALE__
212+#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
213+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
214+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
215+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
216+#define __strtof_l(S, E, L) strtof((S), (E))
217+#define __strtod_l(S, E, L) strtod((S), (E))
218+#define __strtold_l(S, E, L) strtold((S), (E))
219+#warning should dummy __newlocale check for C|POSIX ?
220+#define __newlocale(a, b, c) NULL
221+#define __freelocale(a) ((void)0)
222+#define __duplocale(a) __c_locale()
223+#endif
224+
225+namespace std
226+{
227+ template<>
228+ void
229+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
230+ const __c_locale& __cloc)
231+ {
232+ if (!(__err & ios_base::failbit))
233+ {
234+ char* __sanity;
235+ errno = 0;
236+ float __f = __strtof_l(__s, &__sanity, __cloc);
237+ if (__sanity != __s && errno != ERANGE)
238+ __v = __f;
239+ else
240+ __err |= ios_base::failbit;
241+ }
242+ }
243+
244+ template<>
245+ void
246+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
247+ const __c_locale& __cloc)
248+ {
249+ if (!(__err & ios_base::failbit))
250+ {
251+ char* __sanity;
252+ errno = 0;
253+ double __d = __strtod_l(__s, &__sanity, __cloc);
254+ if (__sanity != __s && errno != ERANGE)
255+ __v = __d;
256+ else
257+ __err |= ios_base::failbit;
258+ }
259+ }
260+
261+ template<>
262+ void
263+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
264+ const __c_locale& __cloc)
265+ {
266+ if (!(__err & ios_base::failbit))
267+ {
268+ char* __sanity;
269+ errno = 0;
270+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
271+ if (__sanity != __s && errno != ERANGE)
272+ __v = __ld;
273+ else
274+ __err |= ios_base::failbit;
275+ }
276+ }
277+
278+ void
279+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
280+ __c_locale __old)
281+ {
282+ __cloc = __newlocale(1 << LC_ALL, __s, __old);
283+#ifdef __UCLIBC_HAS_XLOCALE__
284+ if (!__cloc)
285+ {
286+ // This named locale is not supported by the underlying OS.
287+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
288+ "name not valid"));
289+ }
290+#endif
291+ }
292+
293+ void
294+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
295+ {
296+ if (_S_get_c_locale() != __cloc)
297+ __freelocale(__cloc);
298+ }
299+
300+ __c_locale
301+ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
302+ { return __duplocale(__cloc); }
303+} // namespace std
304+
305+namespace __gnu_cxx
306+{
307+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
308+ {
309+ "LC_CTYPE",
310+ "LC_NUMERIC",
311+ "LC_TIME",
312+ "LC_COLLATE",
313+ "LC_MONETARY",
314+ "LC_MESSAGES",
315+#if _GLIBCXX_NUM_CATEGORIES != 0
316+ "LC_PAPER",
317+ "LC_NAME",
318+ "LC_ADDRESS",
319+ "LC_TELEPHONE",
320+ "LC_MEASUREMENT",
321+ "LC_IDENTIFICATION"
322+#endif
323+ };
324+}
325+
326+namespace std
327+{
328+ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
329+} // namespace std
330diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.h b/libstdc++-v3/config/locale/uclibc/c_locale.h
331new file mode 100644
332index 0000000..da07c1f
333--- /dev/null
334+++ b/libstdc++-v3/config/locale/uclibc/c_locale.h
335@@ -0,0 +1,117 @@
336+// Wrapper for underlying C-language localization -*- C++ -*-
337+
338+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
339+//
340+// This file is part of the GNU ISO C++ Library. This library is free
341+// software; you can redistribute it and/or modify it under the
342+// terms of the GNU General Public License as published by the
343+// Free Software Foundation; either version 2, or (at your option)
344+// any later version.
345+
346+// This library is distributed in the hope that it will be useful,
347+// but WITHOUT ANY WARRANTY; without even the implied warranty of
348+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
349+// GNU General Public License for more details.
350+
351+// You should have received a copy of the GNU General Public License along
352+// with this library; see the file COPYING. If not, write to the Free
353+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
354+// USA.
355+
356+// As a special exception, you may use this file as part of a free software
357+// library without restriction. Specifically, if other files instantiate
358+// templates or use macros or inline functions from this file, or you compile
359+// this file and link it with other files to produce an executable, this
360+// file does not by itself cause the resulting executable to be covered by
361+// the GNU General Public License. This exception does not however
362+// invalidate any other reasons why the executable file might be covered by
363+// the GNU General Public License.
364+
365+//
366+// ISO C++ 14882: 22.8 Standard locale categories.
367+//
368+
369+// Written by Benjamin Kosnik <bkoz@redhat.com>
370+
371+#ifndef _C_LOCALE_H
372+#define _C_LOCALE_H 1
373+
374+#pragma GCC system_header
375+
376+#include <cstring> // get std::strlen
377+#include <cstdio> // get std::snprintf or std::sprintf
378+#include <clocale>
379+#include <langinfo.h> // For codecvt
380+#ifdef __UCLIBC_MJN3_ONLY__
381+#warning fix this
382+#endif
383+#ifdef __UCLIBC_HAS_LOCALE__
384+#include <iconv.h> // For codecvt using iconv, iconv_t
385+#endif
386+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
387+#include <libintl.h> // For messages
388+#endif
389+
390+#ifdef __UCLIBC_MJN3_ONLY__
391+#warning what is _GLIBCXX_C_LOCALE_GNU for
392+#endif
393+#define _GLIBCXX_C_LOCALE_GNU 1
394+
395+#ifdef __UCLIBC_MJN3_ONLY__
396+#warning fix categories
397+#endif
398+// #define _GLIBCXX_NUM_CATEGORIES 6
399+#define _GLIBCXX_NUM_CATEGORIES 0
400+
401+#ifdef __UCLIBC_HAS_XLOCALE__
402+namespace __gnu_cxx
403+{
404+ extern "C" __typeof(uselocale) __uselocale;
405+}
406+#endif
407+
408+namespace std
409+{
410+#ifdef __UCLIBC_HAS_XLOCALE__
411+ typedef __locale_t __c_locale;
412+#else
413+ typedef int* __c_locale;
414+#endif
415+
416+ // Convert numeric value of type _Tv to string and return length of
417+ // string. If snprintf is available use it, otherwise fall back to
418+ // the unsafe sprintf which, in general, can be dangerous and should
419+ // be avoided.
420+ template<typename _Tv>
421+ int
422+ __convert_from_v(char* __out,
423+ const int __size __attribute__ ((__unused__)),
424+ const char* __fmt,
425+#ifdef __UCLIBC_HAS_XCLOCALE__
426+ _Tv __v, const __c_locale& __cloc, int __prec)
427+ {
428+ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
429+#else
430+ _Tv __v, const __c_locale&, int __prec)
431+ {
432+# ifdef __UCLIBC_HAS_LOCALE__
433+ char* __old = std::setlocale(LC_ALL, NULL);
434+ char* __sav = new char[std::strlen(__old) + 1];
435+ std::strcpy(__sav, __old);
436+ std::setlocale(LC_ALL, "C");
437+# endif
438+#endif
439+
440+ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
441+
442+#ifdef __UCLIBC_HAS_XCLOCALE__
443+ __gnu_cxx::__uselocale(__old);
444+#elif defined __UCLIBC_HAS_LOCALE__
445+ std::setlocale(LC_ALL, __sav);
446+ delete [] __sav;
447+#endif
448+ return __ret;
449+ }
450+}
451+
452+#endif
453diff --git a/libstdc++-v3/config/locale/uclibc/codecvt_members.cc b/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
454new file mode 100644
455index 0000000..64aa962
456--- /dev/null
457+++ b/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
458@@ -0,0 +1,308 @@
459+// std::codecvt implementation details, GNU version -*- C++ -*-
460+
461+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
462+//
463+// This file is part of the GNU ISO C++ Library. This library is free
464+// software; you can redistribute it and/or modify it under the
465+// terms of the GNU General Public License as published by the
466+// Free Software Foundation; either version 2, or (at your option)
467+// any later version.
468+
469+// This library is distributed in the hope that it will be useful,
470+// but WITHOUT ANY WARRANTY; without even the implied warranty of
471+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
472+// GNU General Public License for more details.
473+
474+// You should have received a copy of the GNU General Public License along
475+// with this library; see the file COPYING. If not, write to the Free
476+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
477+// USA.
478+
479+// As a special exception, you may use this file as part of a free software
480+// library without restriction. Specifically, if other files instantiate
481+// templates or use macros or inline functions from this file, or you compile
482+// this file and link it with other files to produce an executable, this
483+// file does not by itself cause the resulting executable to be covered by
484+// the GNU General Public License. This exception does not however
485+// invalidate any other reasons why the executable file might be covered by
486+// the GNU General Public License.
487+
488+//
489+// ISO C++ 14882: 22.2.1.5 - Template class codecvt
490+//
491+
492+// Written by Benjamin Kosnik <bkoz@redhat.com>
493+
494+#include <locale>
495+#include <cstdlib> // For MB_CUR_MAX
496+#include <climits> // For MB_LEN_MAX
497+#include <bits/c++locale_internal.h>
498+
499+namespace std
500+{
501+ // Specializations.
502+#ifdef _GLIBCXX_USE_WCHAR_T
503+ codecvt_base::result
504+ codecvt<wchar_t, char, mbstate_t>::
505+ do_out(state_type& __state, const intern_type* __from,
506+ const intern_type* __from_end, const intern_type*& __from_next,
507+ extern_type* __to, extern_type* __to_end,
508+ extern_type*& __to_next) const
509+ {
510+ result __ret = ok;
511+ state_type __tmp_state(__state);
512+
513+#ifdef __UCLIBC_HAS_XLOCALE__
514+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
515+#endif
516+
517+ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
518+ // in case we fall back to wcrtomb and then continue, in a loop.
519+ // NB: wcsnrtombs is a GNU extension
520+ for (__from_next = __from, __to_next = __to;
521+ __from_next < __from_end && __to_next < __to_end
522+ && __ret == ok;)
523+ {
524+ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
525+ __from_end - __from_next);
526+ if (!__from_chunk_end)
527+ __from_chunk_end = __from_end;
528+
529+ __from = __from_next;
530+ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
531+ __from_chunk_end - __from_next,
532+ __to_end - __to_next, &__state);
533+ if (__conv == static_cast<size_t>(-1))
534+ {
535+ // In case of error, in order to stop at the exact place we
536+ // have to start again from the beginning with a series of
537+ // wcrtomb.
538+ for (; __from < __from_next; ++__from)
539+ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
540+ __state = __tmp_state;
541+ __ret = error;
542+ }
543+ else if (__from_next && __from_next < __from_chunk_end)
544+ {
545+ __to_next += __conv;
546+ __ret = partial;
547+ }
548+ else
549+ {
550+ __from_next = __from_chunk_end;
551+ __to_next += __conv;
552+ }
553+
554+ if (__from_next < __from_end && __ret == ok)
555+ {
556+ extern_type __buf[MB_LEN_MAX];
557+ __tmp_state = __state;
558+ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
559+ if (__conv > static_cast<size_t>(__to_end - __to_next))
560+ __ret = partial;
561+ else
562+ {
563+ memcpy(__to_next, __buf, __conv);
564+ __state = __tmp_state;
565+ __to_next += __conv;
566+ ++__from_next;
567+ }
568+ }
569+ }
570+
571+#ifdef __UCLIBC_HAS_XLOCALE__
572+ __uselocale(__old);
573+#endif
574+
575+ return __ret;
576+ }
577+
578+ codecvt_base::result
579+ codecvt<wchar_t, char, mbstate_t>::
580+ do_in(state_type& __state, const extern_type* __from,
581+ const extern_type* __from_end, const extern_type*& __from_next,
582+ intern_type* __to, intern_type* __to_end,
583+ intern_type*& __to_next) const
584+ {
585+ result __ret = ok;
586+ state_type __tmp_state(__state);
587+
588+#ifdef __UCLIBC_HAS_XLOCALE__
589+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
590+#endif
591+
592+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
593+ // in case we store a L'\0' and then continue, in a loop.
594+ // NB: mbsnrtowcs is a GNU extension
595+ for (__from_next = __from, __to_next = __to;
596+ __from_next < __from_end && __to_next < __to_end
597+ && __ret == ok;)
598+ {
599+ const extern_type* __from_chunk_end;
600+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
601+ __from_end
602+ - __from_next));
603+ if (!__from_chunk_end)
604+ __from_chunk_end = __from_end;
605+
606+ __from = __from_next;
607+ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
608+ __from_chunk_end - __from_next,
609+ __to_end - __to_next, &__state);
610+ if (__conv == static_cast<size_t>(-1))
611+ {
612+ // In case of error, in order to stop at the exact place we
613+ // have to start again from the beginning with a series of
614+ // mbrtowc.
615+ for (;; ++__to_next, __from += __conv)
616+ {
617+ __conv = mbrtowc(__to_next, __from, __from_end - __from,
618+ &__tmp_state);
619+ if (__conv == static_cast<size_t>(-1)
620+ || __conv == static_cast<size_t>(-2))
621+ break;
622+ }
623+ __from_next = __from;
624+ __state = __tmp_state;
625+ __ret = error;
626+ }
627+ else if (__from_next && __from_next < __from_chunk_end)
628+ {
629+ // It is unclear what to return in this case (see DR 382).
630+ __to_next += __conv;
631+ __ret = partial;
632+ }
633+ else
634+ {
635+ __from_next = __from_chunk_end;
636+ __to_next += __conv;
637+ }
638+
639+ if (__from_next < __from_end && __ret == ok)
640+ {
641+ if (__to_next < __to_end)
642+ {
643+ // XXX Probably wrong for stateful encodings
644+ __tmp_state = __state;
645+ ++__from_next;
646+ *__to_next++ = L'\0';
647+ }
648+ else
649+ __ret = partial;
650+ }
651+ }
652+
653+#ifdef __UCLIBC_HAS_XLOCALE__
654+ __uselocale(__old);
655+#endif
656+
657+ return __ret;
658+ }
659+
660+ int
661+ codecvt<wchar_t, char, mbstate_t>::
662+ do_encoding() const throw()
663+ {
664+ // XXX This implementation assumes that the encoding is
665+ // stateless and is either single-byte or variable-width.
666+ int __ret = 0;
667+#ifdef __UCLIBC_HAS_XLOCALE__
668+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
669+#endif
670+ if (MB_CUR_MAX == 1)
671+ __ret = 1;
672+#ifdef __UCLIBC_HAS_XLOCALE__
673+ __uselocale(__old);
674+#endif
675+ return __ret;
676+ }
677+
678+ int
679+ codecvt<wchar_t, char, mbstate_t>::
680+ do_max_length() const throw()
681+ {
682+#ifdef __UCLIBC_HAS_XLOCALE__
683+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
684+#endif
685+ // XXX Probably wrong for stateful encodings.
686+ int __ret = MB_CUR_MAX;
687+#ifdef __UCLIBC_HAS_XLOCALE__
688+ __uselocale(__old);
689+#endif
690+ return __ret;
691+ }
692+
693+ int
694+ codecvt<wchar_t, char, mbstate_t>::
695+ do_length(state_type& __state, const extern_type* __from,
696+ const extern_type* __end, size_t __max) const
697+ {
698+ int __ret = 0;
699+ state_type __tmp_state(__state);
700+
701+#ifdef __UCLIBC_HAS_XLOCALE__
702+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
703+#endif
704+
705+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
706+ // in case we advance past it and then continue, in a loop.
707+ // NB: mbsnrtowcs is a GNU extension
708+
709+ // A dummy internal buffer is needed in order for mbsnrtocws to consider
710+ // its fourth parameter (it wouldn't with NULL as first parameter).
711+ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
712+ * __max));
713+ while (__from < __end && __max)
714+ {
715+ const extern_type* __from_chunk_end;
716+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
717+ __end
718+ - __from));
719+ if (!__from_chunk_end)
720+ __from_chunk_end = __end;
721+
722+ const extern_type* __tmp_from = __from;
723+ size_t __conv = mbsnrtowcs(__to, &__from,
724+ __from_chunk_end - __from,
725+ __max, &__state);
726+ if (__conv == static_cast<size_t>(-1))
727+ {
728+ // In case of error, in order to stop at the exact place we
729+ // have to start again from the beginning with a series of
730+ // mbrtowc.
731+ for (__from = __tmp_from;; __from += __conv)
732+ {
733+ __conv = mbrtowc(NULL, __from, __end - __from,
734+ &__tmp_state);
735+ if (__conv == static_cast<size_t>(-1)
736+ || __conv == static_cast<size_t>(-2))
737+ break;
738+ }
739+ __state = __tmp_state;
740+ __ret += __from - __tmp_from;
741+ break;
742+ }
743+ if (!__from)
744+ __from = __from_chunk_end;
745+
746+ __ret += __from - __tmp_from;
747+ __max -= __conv;
748+
749+ if (__from < __end && __max)
750+ {
751+ // XXX Probably wrong for stateful encodings
752+ __tmp_state = __state;
753+ ++__from;
754+ ++__ret;
755+ --__max;
756+ }
757+ }
758+
759+#ifdef __UCLIBC_HAS_XLOCALE__
760+ __uselocale(__old);
761+#endif
762+
763+ return __ret;
764+ }
765+#endif
766+}
767diff --git a/libstdc++-v3/config/locale/uclibc/collate_members.cc b/libstdc++-v3/config/locale/uclibc/collate_members.cc
768new file mode 100644
769index 0000000..c2664a7
770--- /dev/null
771+++ b/libstdc++-v3/config/locale/uclibc/collate_members.cc
772@@ -0,0 +1,80 @@
773+// std::collate implementation details, GNU version -*- C++ -*-
774+
775+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
776+//
777+// This file is part of the GNU ISO C++ Library. This library is free
778+// software; you can redistribute it and/or modify it under the
779+// terms of the GNU General Public License as published by the
780+// Free Software Foundation; either version 2, or (at your option)
781+// any later version.
782+
783+// This library is distributed in the hope that it will be useful,
784+// but WITHOUT ANY WARRANTY; without even the implied warranty of
785+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
786+// GNU General Public License for more details.
787+
788+// You should have received a copy of the GNU General Public License along
789+// with this library; see the file COPYING. If not, write to the Free
790+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
791+// USA.
792+
793+// As a special exception, you may use this file as part of a free software
794+// library without restriction. Specifically, if other files instantiate
795+// templates or use macros or inline functions from this file, or you compile
796+// this file and link it with other files to produce an executable, this
797+// file does not by itself cause the resulting executable to be covered by
798+// the GNU General Public License. This exception does not however
799+// invalidate any other reasons why the executable file might be covered by
800+// the GNU General Public License.
801+
802+//
803+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
804+//
805+
806+// Written by Benjamin Kosnik <bkoz@redhat.com>
807+
808+#include <locale>
809+#include <bits/c++locale_internal.h>
810+
811+#ifndef __UCLIBC_HAS_XLOCALE__
812+#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
813+#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
814+#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
815+#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
816+#endif
817+
818+namespace std
819+{
820+ // These are basically extensions to char_traits, and perhaps should
821+ // be put there instead of here.
822+ template<>
823+ int
824+ collate<char>::_M_compare(const char* __one, const char* __two) const
825+ {
826+ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
827+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
828+ }
829+
830+ template<>
831+ size_t
832+ collate<char>::_M_transform(char* __to, const char* __from,
833+ size_t __n) const
834+ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
835+
836+#ifdef _GLIBCXX_USE_WCHAR_T
837+ template<>
838+ int
839+ collate<wchar_t>::_M_compare(const wchar_t* __one,
840+ const wchar_t* __two) const
841+ {
842+ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
843+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
844+ }
845+
846+ template<>
847+ size_t
848+ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
849+ size_t __n) const
850+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
851+#endif
852+}
853diff --git a/libstdc++-v3/config/locale/uclibc/ctype_members.cc b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
854new file mode 100644
855index 0000000..7294e3a
856--- /dev/null
857+++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
858@@ -0,0 +1,300 @@
859+// std::ctype implementation details, GNU version -*- C++ -*-
860+
861+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
862+//
863+// This file is part of the GNU ISO C++ Library. This library is free
864+// software; you can redistribute it and/or modify it under the
865+// terms of the GNU General Public License as published by the
866+// Free Software Foundation; either version 2, or (at your option)
867+// any later version.
868+
869+// This library is distributed in the hope that it will be useful,
870+// but WITHOUT ANY WARRANTY; without even the implied warranty of
871+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
872+// GNU General Public License for more details.
873+
874+// You should have received a copy of the GNU General Public License along
875+// with this library; see the file COPYING. If not, write to the Free
876+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
877+// USA.
878+
879+// As a special exception, you may use this file as part of a free software
880+// library without restriction. Specifically, if other files instantiate
881+// templates or use macros or inline functions from this file, or you compile
882+// this file and link it with other files to produce an executable, this
883+// file does not by itself cause the resulting executable to be covered by
884+// the GNU General Public License. This exception does not however
885+// invalidate any other reasons why the executable file might be covered by
886+// the GNU General Public License.
887+
888+//
889+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
890+//
891+
892+// Written by Benjamin Kosnik <bkoz@redhat.com>
893+
894+#define _LIBC
895+#include <locale>
896+#undef _LIBC
897+#include <bits/c++locale_internal.h>
898+
899+#ifndef __UCLIBC_HAS_XLOCALE__
900+#define __wctype_l(S, L) wctype((S))
901+#define __towupper_l(C, L) towupper((C))
902+#define __towlower_l(C, L) towlower((C))
903+#define __iswctype_l(C, M, L) iswctype((C), (M))
904+#endif
905+
906+namespace std
907+{
908+ // NB: The other ctype<char> specializations are in src/locale.cc and
909+ // various /config/os/* files.
910+ template<>
911+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
912+ : ctype<char>(0, false, __refs)
913+ {
914+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
915+ {
916+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
917+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
918+#ifdef __UCLIBC_HAS_XLOCALE__
919+ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
920+ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
921+ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
922+#endif
923+ }
924+ }
925+
926+#ifdef _GLIBCXX_USE_WCHAR_T
927+ ctype<wchar_t>::__wmask_type
928+ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
929+ {
930+ __wmask_type __ret;
931+ switch (__m)
932+ {
933+ case space:
934+ __ret = __wctype_l("space", _M_c_locale_ctype);
935+ break;
936+ case print:
937+ __ret = __wctype_l("print", _M_c_locale_ctype);
938+ break;
939+ case cntrl:
940+ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
941+ break;
942+ case upper:
943+ __ret = __wctype_l("upper", _M_c_locale_ctype);
944+ break;
945+ case lower:
946+ __ret = __wctype_l("lower", _M_c_locale_ctype);
947+ break;
948+ case alpha:
949+ __ret = __wctype_l("alpha", _M_c_locale_ctype);
950+ break;
951+ case digit:
952+ __ret = __wctype_l("digit", _M_c_locale_ctype);
953+ break;
954+ case punct:
955+ __ret = __wctype_l("punct", _M_c_locale_ctype);
956+ break;
957+ case xdigit:
958+ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
959+ break;
960+ case alnum:
961+ __ret = __wctype_l("alnum", _M_c_locale_ctype);
962+ break;
963+ case graph:
964+ __ret = __wctype_l("graph", _M_c_locale_ctype);
965+ break;
966+ default:
967+ __ret = __wmask_type();
968+ }
969+ return __ret;
970+ }
971+
972+ wchar_t
973+ ctype<wchar_t>::do_toupper(wchar_t __c) const
974+ { return __towupper_l(__c, _M_c_locale_ctype); }
975+
976+ const wchar_t*
977+ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
978+ {
979+ while (__lo < __hi)
980+ {
981+ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
982+ ++__lo;
983+ }
984+ return __hi;
985+ }
986+
987+ wchar_t
988+ ctype<wchar_t>::do_tolower(wchar_t __c) const
989+ { return __towlower_l(__c, _M_c_locale_ctype); }
990+
991+ const wchar_t*
992+ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
993+ {
994+ while (__lo < __hi)
995+ {
996+ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
997+ ++__lo;
998+ }
999+ return __hi;
1000+ }
1001+
1002+ bool
1003+ ctype<wchar_t>::
1004+ do_is(mask __m, wchar_t __c) const
1005+ {
1006+ // Highest bitmask in ctype_base == 10, but extra in "C"
1007+ // library for blank.
1008+ bool __ret = false;
1009+ const size_t __bitmasksize = 11;
1010+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
1011+ if (__m & _M_bit[__bitcur]
1012+ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
1013+ {
1014+ __ret = true;
1015+ break;
1016+ }
1017+ return __ret;
1018+ }
1019+
1020+ const wchar_t*
1021+ ctype<wchar_t>::
1022+ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
1023+ {
1024+ for (; __lo < __hi; ++__vec, ++__lo)
1025+ {
1026+ // Highest bitmask in ctype_base == 10, but extra in "C"
1027+ // library for blank.
1028+ const size_t __bitmasksize = 11;
1029+ mask __m = 0;
1030+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
1031+ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
1032+ __m |= _M_bit[__bitcur];
1033+ *__vec = __m;
1034+ }
1035+ return __hi;
1036+ }
1037+
1038+ const wchar_t*
1039+ ctype<wchar_t>::
1040+ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
1041+ {
1042+ while (__lo < __hi && !this->do_is(__m, *__lo))
1043+ ++__lo;
1044+ return __lo;
1045+ }
1046+
1047+ const wchar_t*
1048+ ctype<wchar_t>::
1049+ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
1050+ {
1051+ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
1052+ ++__lo;
1053+ return __lo;
1054+ }
1055+
1056+ wchar_t
1057+ ctype<wchar_t>::
1058+ do_widen(char __c) const
1059+ { return _M_widen[static_cast<unsigned char>(__c)]; }
1060+
1061+ const char*
1062+ ctype<wchar_t>::
1063+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
1064+ {
1065+ while (__lo < __hi)
1066+ {
1067+ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
1068+ ++__lo;
1069+ ++__dest;
1070+ }
1071+ return __hi;
1072+ }
1073+
1074+ char
1075+ ctype<wchar_t>::
1076+ do_narrow(wchar_t __wc, char __dfault) const
1077+ {
1078+ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
1079+ return _M_narrow[__wc];
1080+#ifdef __UCLIBC_HAS_XLOCALE__
1081+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1082+#endif
1083+ const int __c = wctob(__wc);
1084+#ifdef __UCLIBC_HAS_XLOCALE__
1085+ __uselocale(__old);
1086+#endif
1087+ return (__c == EOF ? __dfault : static_cast<char>(__c));
1088+ }
1089+
1090+ const wchar_t*
1091+ ctype<wchar_t>::
1092+ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
1093+ char* __dest) const
1094+ {
1095+#ifdef __UCLIBC_HAS_XLOCALE__
1096+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1097+#endif
1098+ if (_M_narrow_ok)
1099+ while (__lo < __hi)
1100+ {
1101+ if (*__lo >= 0 && *__lo < 128)
1102+ *__dest = _M_narrow[*__lo];
1103+ else
1104+ {
1105+ const int __c = wctob(*__lo);
1106+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1107+ }
1108+ ++__lo;
1109+ ++__dest;
1110+ }
1111+ else
1112+ while (__lo < __hi)
1113+ {
1114+ const int __c = wctob(*__lo);
1115+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1116+ ++__lo;
1117+ ++__dest;
1118+ }
1119+#ifdef __UCLIBC_HAS_XLOCALE__
1120+ __uselocale(__old);
1121+#endif
1122+ return __hi;
1123+ }
1124+
1125+ void
1126+ ctype<wchar_t>::_M_initialize_ctype()
1127+ {
1128+#ifdef __UCLIBC_HAS_XLOCALE__
1129+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1130+#endif
1131+ wint_t __i;
1132+ for (__i = 0; __i < 128; ++__i)
1133+ {
1134+ const int __c = wctob(__i);
1135+ if (__c == EOF)
1136+ break;
1137+ else
1138+ _M_narrow[__i] = static_cast<char>(__c);
1139+ }
1140+ if (__i == 128)
1141+ _M_narrow_ok = true;
1142+ else
1143+ _M_narrow_ok = false;
1144+ for (size_t __j = 0;
1145+ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
1146+ _M_widen[__j] = btowc(__j);
1147+
1148+ for (size_t __k = 0; __k <= 11; ++__k)
1149+ {
1150+ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
1151+ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
1152+ }
1153+#ifdef __UCLIBC_HAS_XLOCALE__
1154+ __uselocale(__old);
1155+#endif
1156+ }
1157+#endif // _GLIBCXX_USE_WCHAR_T
1158+}
1159diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.cc b/libstdc++-v3/config/locale/uclibc/messages_members.cc
1160new file mode 100644
1161index 0000000..13594d9
1162--- /dev/null
1163+++ b/libstdc++-v3/config/locale/uclibc/messages_members.cc
1164@@ -0,0 +1,100 @@
1165+// std::messages implementation details, GNU version -*- C++ -*-
1166+
1167+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1168+//
1169+// This file is part of the GNU ISO C++ Library. This library is free
1170+// software; you can redistribute it and/or modify it under the
1171+// terms of the GNU General Public License as published by the
1172+// Free Software Foundation; either version 2, or (at your option)
1173+// any later version.
1174+
1175+// This library is distributed in the hope that it will be useful,
1176+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1177+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1178+// GNU General Public License for more details.
1179+
1180+// You should have received a copy of the GNU General Public License along
1181+// with this library; see the file COPYING. If not, write to the Free
1182+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1183+// USA.
1184+
1185+// As a special exception, you may use this file as part of a free software
1186+// library without restriction. Specifically, if other files instantiate
1187+// templates or use macros or inline functions from this file, or you compile
1188+// this file and link it with other files to produce an executable, this
1189+// file does not by itself cause the resulting executable to be covered by
1190+// the GNU General Public License. This exception does not however
1191+// invalidate any other reasons why the executable file might be covered by
1192+// the GNU General Public License.
1193+
1194+//
1195+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
1196+//
1197+
1198+// Written by Benjamin Kosnik <bkoz@redhat.com>
1199+
1200+#include <locale>
1201+#include <bits/c++locale_internal.h>
1202+
1203+#ifdef __UCLIBC_MJN3_ONLY__
1204+#warning fix gettext stuff
1205+#endif
1206+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1207+extern "C" char *__dcgettext(const char *domainname,
1208+ const char *msgid, int category);
1209+#undef gettext
1210+#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
1211+#else
1212+#undef gettext
1213+#define gettext(msgid) (msgid)
1214+#endif
1215+
1216+namespace std
1217+{
1218+ // Specializations.
1219+ template<>
1220+ string
1221+ messages<char>::do_get(catalog, int, int, const string& __dfault) const
1222+ {
1223+#ifdef __UCLIBC_HAS_XLOCALE__
1224+ __c_locale __old = __uselocale(_M_c_locale_messages);
1225+ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
1226+ __uselocale(__old);
1227+ return string(__msg);
1228+#elif defined __UCLIBC_HAS_LOCALE__
1229+ char* __old = strdup(setlocale(LC_ALL, NULL));
1230+ setlocale(LC_ALL, _M_name_messages);
1231+ const char* __msg = gettext(__dfault.c_str());
1232+ setlocale(LC_ALL, __old);
1233+ free(__old);
1234+ return string(__msg);
1235+#else
1236+ const char* __msg = gettext(__dfault.c_str());
1237+ return string(__msg);
1238+#endif
1239+ }
1240+
1241+#ifdef _GLIBCXX_USE_WCHAR_T
1242+ template<>
1243+ wstring
1244+ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
1245+ {
1246+# ifdef __UCLIBC_HAS_XLOCALE__
1247+ __c_locale __old = __uselocale(_M_c_locale_messages);
1248+ char* __msg = gettext(_M_convert_to_char(__dfault));
1249+ __uselocale(__old);
1250+ return _M_convert_from_char(__msg);
1251+# elif defined __UCLIBC_HAS_LOCALE__
1252+ char* __old = strdup(setlocale(LC_ALL, NULL));
1253+ setlocale(LC_ALL, _M_name_messages);
1254+ char* __msg = gettext(_M_convert_to_char(__dfault));
1255+ setlocale(LC_ALL, __old);
1256+ free(__old);
1257+ return _M_convert_from_char(__msg);
1258+# else
1259+ char* __msg = gettext(_M_convert_to_char(__dfault));
1260+ return _M_convert_from_char(__msg);
1261+# endif
1262+ }
1263+#endif
1264+}
1265diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.h b/libstdc++-v3/config/locale/uclibc/messages_members.h
1266new file mode 100644
1267index 0000000..1424078
1268--- /dev/null
1269+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
1270@@ -0,0 +1,118 @@
1271+// std::messages implementation details, GNU version -*- C++ -*-
1272+
1273+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1274+//
1275+// This file is part of the GNU ISO C++ Library. This library is free
1276+// software; you can redistribute it and/or modify it under the
1277+// terms of the GNU General Public License as published by the
1278+// Free Software Foundation; either version 2, or (at your option)
1279+// any later version.
1280+
1281+// This library is distributed in the hope that it will be useful,
1282+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1283+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1284+// GNU General Public License for more details.
1285+
1286+// You should have received a copy of the GNU General Public License along
1287+// with this library; see the file COPYING. If not, write to the Free
1288+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1289+// USA.
1290+
1291+// As a special exception, you may use this file as part of a free software
1292+// library without restriction. Specifically, if other files instantiate
1293+// templates or use macros or inline functions from this file, or you compile
1294+// this file and link it with other files to produce an executable, this
1295+// file does not by itself cause the resulting executable to be covered by
1296+// the GNU General Public License. This exception does not however
1297+// invalidate any other reasons why the executable file might be covered by
1298+// the GNU General Public License.
1299+
1300+//
1301+// ISO C++ 14882: 22.2.7.1.2 messages functions
1302+//
1303+
1304+// Written by Benjamin Kosnik <bkoz@redhat.com>
1305+
1306+#ifdef __UCLIBC_MJN3_ONLY__
1307+#warning fix prototypes for *textdomain funcs
1308+#endif
1309+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1310+extern "C" char *__textdomain(const char *domainname);
1311+extern "C" char *__bindtextdomain(const char *domainname,
1312+ const char *dirname);
1313+#else
1314+#undef __textdomain
1315+#undef __bindtextdomain
1316+#define __textdomain(D) ((void)0)
1317+#define __bindtextdomain(D,P) ((void)0)
1318+#endif
1319+
1320+ // Non-virtual member functions.
1321+ template<typename _CharT>
1322+ messages<_CharT>::messages(size_t __refs)
1323+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
1324+ _M_name_messages(_S_get_c_name())
1325+ { }
1326+
1327+ template<typename _CharT>
1328+ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
1329+ size_t __refs)
1330+ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
1331+ _M_name_messages(__s)
1332+ {
1333+ char* __tmp = new char[std::strlen(__s) + 1];
1334+ std::strcpy(__tmp, __s);
1335+ _M_name_messages = __tmp;
1336+ }
1337+
1338+ template<typename _CharT>
1339+ typename messages<_CharT>::catalog
1340+ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
1341+ const char* __dir) const
1342+ {
1343+ __bindtextdomain(__s.c_str(), __dir);
1344+ return this->do_open(__s, __loc);
1345+ }
1346+
1347+ // Virtual member functions.
1348+ template<typename _CharT>
1349+ messages<_CharT>::~messages()
1350+ {
1351+ if (_M_name_messages != _S_get_c_name())
1352+ delete [] _M_name_messages;
1353+ _S_destroy_c_locale(_M_c_locale_messages);
1354+ }
1355+
1356+ template<typename _CharT>
1357+ typename messages<_CharT>::catalog
1358+ messages<_CharT>::do_open(const basic_string<char>& __s,
1359+ const locale&) const
1360+ {
1361+ // No error checking is done, assume the catalog exists and can
1362+ // be used.
1363+ __textdomain(__s.c_str());
1364+ return 0;
1365+ }
1366+
1367+ template<typename _CharT>
1368+ void
1369+ messages<_CharT>::do_close(catalog) const
1370+ { }
1371+
1372+ // messages_byname
1373+ template<typename _CharT>
1374+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
1375+ : messages<_CharT>(__refs)
1376+ {
1377+ if (this->_M_name_messages != locale::facet::_S_get_c_name())
1378+ delete [] this->_M_name_messages;
1379+ char* __tmp = new char[std::strlen(__s) + 1];
1380+ std::strcpy(__tmp, __s);
1381+ this->_M_name_messages = __tmp;
1382+
1383+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
1384+ {
1385+ this->_S_destroy_c_locale(this->_M_c_locale_messages);
1386+ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
1387+ }
1388+ }
1389diff --git a/libstdc++-v3/config/locale/uclibc/monetary_members.cc b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1390new file mode 100644
1391index 0000000..aa52731
1392--- /dev/null
1393+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1394@@ -0,0 +1,692 @@
1395+// std::moneypunct implementation details, GNU version -*- C++ -*-
1396+
1397+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1398+//
1399+// This file is part of the GNU ISO C++ Library. This library is free
1400+// software; you can redistribute it and/or modify it under the
1401+// terms of the GNU General Public License as published by the
1402+// Free Software Foundation; either version 2, or (at your option)
1403+// any later version.
1404+
1405+// This library is distributed in the hope that it will be useful,
1406+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1407+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1408+// GNU General Public License for more details.
1409+
1410+// You should have received a copy of the GNU General Public License along
1411+// with this library; see the file COPYING. If not, write to the Free
1412+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1413+// USA.
1414+
1415+// As a special exception, you may use this file as part of a free software
1416+// library without restriction. Specifically, if other files instantiate
1417+// templates or use macros or inline functions from this file, or you compile
1418+// this file and link it with other files to produce an executable, this
1419+// file does not by itself cause the resulting executable to be covered by
1420+// the GNU General Public License. This exception does not however
1421+// invalidate any other reasons why the executable file might be covered by
1422+// the GNU General Public License.
1423+
1424+//
1425+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
1426+//
1427+
1428+// Written by Benjamin Kosnik <bkoz@redhat.com>
1429+
1430+#define _LIBC
1431+#include <locale>
1432+#undef _LIBC
1433+#include <bits/c++locale_internal.h>
1434+
1435+#ifdef __UCLIBC_MJN3_ONLY__
1436+#warning optimize this for uclibc
1437+#warning tailor for stub locale support
1438+#endif
1439+
1440+#ifndef __UCLIBC_HAS_XLOCALE__
1441+#define __nl_langinfo_l(N, L) nl_langinfo((N))
1442+#endif
1443+
1444+namespace std
1445+{
1446+ // Construct and return valid pattern consisting of some combination of:
1447+ // space none symbol sign value
1448+ money_base::pattern
1449+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
1450+ {
1451+ pattern __ret;
1452+
1453+ // This insanely complicated routine attempts to construct a valid
1454+ // pattern for use with monyepunct. A couple of invariants:
1455+
1456+ // if (__precedes) symbol -> value
1457+ // else value -> symbol
1458+
1459+ // if (__space) space
1460+ // else none
1461+
1462+ // none == never first
1463+ // space never first or last
1464+
1465+ // Any elegant implementations of this are welcome.
1466+ switch (__posn)
1467+ {
1468+ case 0:
1469+ case 1:
1470+ // 1 The sign precedes the value and symbol.
1471+ __ret.field[0] = sign;
1472+ if (__space)
1473+ {
1474+ // Pattern starts with sign.
1475+ if (__precedes)
1476+ {
1477+ __ret.field[1] = symbol;
1478+ __ret.field[3] = value;
1479+ }
1480+ else
1481+ {
1482+ __ret.field[1] = value;
1483+ __ret.field[3] = symbol;
1484+ }
1485+ __ret.field[2] = space;
1486+ }
1487+ else
1488+ {
1489+ // Pattern starts with sign and ends with none.
1490+ if (__precedes)
1491+ {
1492+ __ret.field[1] = symbol;
1493+ __ret.field[2] = value;
1494+ }
1495+ else
1496+ {
1497+ __ret.field[1] = value;
1498+ __ret.field[2] = symbol;
1499+ }
1500+ __ret.field[3] = none;
1501+ }
1502+ break;
1503+ case 2:
1504+ // 2 The sign follows the value and symbol.
1505+ if (__space)
1506+ {
1507+ // Pattern either ends with sign.
1508+ if (__precedes)
1509+ {
1510+ __ret.field[0] = symbol;
1511+ __ret.field[2] = value;
1512+ }
1513+ else
1514+ {
1515+ __ret.field[0] = value;
1516+ __ret.field[2] = symbol;
1517+ }
1518+ __ret.field[1] = space;
1519+ __ret.field[3] = sign;
1520+ }
1521+ else
1522+ {
1523+ // Pattern ends with sign then none.
1524+ if (__precedes)
1525+ {
1526+ __ret.field[0] = symbol;
1527+ __ret.field[1] = value;
1528+ }
1529+ else
1530+ {
1531+ __ret.field[0] = value;
1532+ __ret.field[1] = symbol;
1533+ }
1534+ __ret.field[2] = sign;
1535+ __ret.field[3] = none;
1536+ }
1537+ break;
1538+ case 3:
1539+ // 3 The sign immediately precedes the symbol.
1540+ if (__precedes)
1541+ {
1542+ __ret.field[0] = sign;
1543+ __ret.field[1] = symbol;
1544+ if (__space)
1545+ {
1546+ __ret.field[2] = space;
1547+ __ret.field[3] = value;
1548+ }
1549+ else
1550+ {
1551+ __ret.field[2] = value;
1552+ __ret.field[3] = none;
1553+ }
1554+ }
1555+ else
1556+ {
1557+ __ret.field[0] = value;
1558+ if (__space)
1559+ {
1560+ __ret.field[1] = space;
1561+ __ret.field[2] = sign;
1562+ __ret.field[3] = symbol;
1563+ }
1564+ else
1565+ {
1566+ __ret.field[1] = sign;
1567+ __ret.field[2] = symbol;
1568+ __ret.field[3] = none;
1569+ }
1570+ }
1571+ break;
1572+ case 4:
1573+ // 4 The sign immediately follows the symbol.
1574+ if (__precedes)
1575+ {
1576+ __ret.field[0] = symbol;
1577+ __ret.field[1] = sign;
1578+ if (__space)
1579+ {
1580+ __ret.field[2] = space;
1581+ __ret.field[3] = value;
1582+ }
1583+ else
1584+ {
1585+ __ret.field[2] = value;
1586+ __ret.field[3] = none;
1587+ }
1588+ }
1589+ else
1590+ {
1591+ __ret.field[0] = value;
1592+ if (__space)
1593+ {
1594+ __ret.field[1] = space;
1595+ __ret.field[2] = symbol;
1596+ __ret.field[3] = sign;
1597+ }
1598+ else
1599+ {
1600+ __ret.field[1] = symbol;
1601+ __ret.field[2] = sign;
1602+ __ret.field[3] = none;
1603+ }
1604+ }
1605+ break;
1606+ default:
1607+ ;
1608+ }
1609+ return __ret;
1610+ }
1611+
1612+ template<>
1613+ void
1614+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
1615+ const char*)
1616+ {
1617+ if (!_M_data)
1618+ _M_data = new __moneypunct_cache<char, true>;
1619+
1620+ if (!__cloc)
1621+ {
1622+ // "C" locale
1623+ _M_data->_M_decimal_point = '.';
1624+ _M_data->_M_thousands_sep = ',';
1625+ _M_data->_M_grouping = "";
1626+ _M_data->_M_grouping_size = 0;
1627+ _M_data->_M_curr_symbol = "";
1628+ _M_data->_M_curr_symbol_size = 0;
1629+ _M_data->_M_positive_sign = "";
1630+ _M_data->_M_positive_sign_size = 0;
1631+ _M_data->_M_negative_sign = "";
1632+ _M_data->_M_negative_sign_size = 0;
1633+ _M_data->_M_frac_digits = 0;
1634+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1635+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1636+
1637+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1638+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1639+ }
1640+ else
1641+ {
1642+ // Named locale.
1643+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1644+ __cloc));
1645+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1646+ __cloc));
1647+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1648+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1649+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1650+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1651+
1652+ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1653+ if (!__nposn)
1654+ _M_data->_M_negative_sign = "()";
1655+ else
1656+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1657+ __cloc);
1658+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1659+
1660+ // _Intl == true
1661+ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1662+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1663+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1664+ __cloc));
1665+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1666+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1667+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1668+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1669+ __pposn);
1670+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1671+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1672+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1673+ __nposn);
1674+ }
1675+ }
1676+
1677+ template<>
1678+ void
1679+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
1680+ const char*)
1681+ {
1682+ if (!_M_data)
1683+ _M_data = new __moneypunct_cache<char, false>;
1684+
1685+ if (!__cloc)
1686+ {
1687+ // "C" locale
1688+ _M_data->_M_decimal_point = '.';
1689+ _M_data->_M_thousands_sep = ',';
1690+ _M_data->_M_grouping = "";
1691+ _M_data->_M_grouping_size = 0;
1692+ _M_data->_M_curr_symbol = "";
1693+ _M_data->_M_curr_symbol_size = 0;
1694+ _M_data->_M_positive_sign = "";
1695+ _M_data->_M_positive_sign_size = 0;
1696+ _M_data->_M_negative_sign = "";
1697+ _M_data->_M_negative_sign_size = 0;
1698+ _M_data->_M_frac_digits = 0;
1699+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1700+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1701+
1702+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1703+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1704+ }
1705+ else
1706+ {
1707+ // Named locale.
1708+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1709+ __cloc));
1710+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1711+ __cloc));
1712+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1713+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1714+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1715+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1716+
1717+ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1718+ if (!__nposn)
1719+ _M_data->_M_negative_sign = "()";
1720+ else
1721+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1722+ __cloc);
1723+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1724+
1725+ // _Intl == false
1726+ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1727+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1728+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1729+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1730+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1731+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1732+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1733+ __pposn);
1734+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1735+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1736+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1737+ __nposn);
1738+ }
1739+ }
1740+
1741+ template<>
1742+ moneypunct<char, true>::~moneypunct()
1743+ { delete _M_data; }
1744+
1745+ template<>
1746+ moneypunct<char, false>::~moneypunct()
1747+ { delete _M_data; }
1748+
1749+#ifdef _GLIBCXX_USE_WCHAR_T
1750+ template<>
1751+ void
1752+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
1753+#ifdef __UCLIBC_HAS_XLOCALE__
1754+ const char*)
1755+#else
1756+ const char* __name)
1757+#endif
1758+ {
1759+ if (!_M_data)
1760+ _M_data = new __moneypunct_cache<wchar_t, true>;
1761+
1762+ if (!__cloc)
1763+ {
1764+ // "C" locale
1765+ _M_data->_M_decimal_point = L'.';
1766+ _M_data->_M_thousands_sep = L',';
1767+ _M_data->_M_grouping = "";
1768+ _M_data->_M_grouping_size = 0;
1769+ _M_data->_M_curr_symbol = L"";
1770+ _M_data->_M_curr_symbol_size = 0;
1771+ _M_data->_M_positive_sign = L"";
1772+ _M_data->_M_positive_sign_size = 0;
1773+ _M_data->_M_negative_sign = L"";
1774+ _M_data->_M_negative_sign_size = 0;
1775+ _M_data->_M_frac_digits = 0;
1776+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1777+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1778+
1779+ // Use ctype::widen code without the facet...
1780+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1781+ _M_data->_M_atoms[__i] =
1782+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1783+ }
1784+ else
1785+ {
1786+ // Named locale.
1787+#ifdef __UCLIBC_HAS_XLOCALE__
1788+ __c_locale __old = __uselocale(__cloc);
1789+#else
1790+ // Switch to named locale so that mbsrtowcs will work.
1791+ char* __old = strdup(setlocale(LC_ALL, NULL));
1792+ setlocale(LC_ALL, __name);
1793+#endif
1794+
1795+#ifdef __UCLIBC_MJN3_ONLY__
1796+#warning fix this... should be monetary
1797+#endif
1798+#ifdef __UCLIBC__
1799+# ifdef __UCLIBC_HAS_XLOCALE__
1800+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1801+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1802+# else
1803+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1804+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1805+# endif
1806+#else
1807+ union { char *__s; wchar_t __w; } __u;
1808+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1809+ _M_data->_M_decimal_point = __u.__w;
1810+
1811+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1812+ _M_data->_M_thousands_sep = __u.__w;
1813+#endif
1814+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1815+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1816+
1817+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1818+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1819+ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1820+
1821+ wchar_t* __wcs_ps = 0;
1822+ wchar_t* __wcs_ns = 0;
1823+ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1824+ try
1825+ {
1826+ mbstate_t __state;
1827+ size_t __len = strlen(__cpossign);
1828+ if (__len)
1829+ {
1830+ ++__len;
1831+ memset(&__state, 0, sizeof(mbstate_t));
1832+ __wcs_ps = new wchar_t[__len];
1833+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1834+ _M_data->_M_positive_sign = __wcs_ps;
1835+ }
1836+ else
1837+ _M_data->_M_positive_sign = L"";
1838+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1839+
1840+ __len = strlen(__cnegsign);
1841+ if (!__nposn)
1842+ _M_data->_M_negative_sign = L"()";
1843+ else if (__len)
1844+ {
1845+ ++__len;
1846+ memset(&__state, 0, sizeof(mbstate_t));
1847+ __wcs_ns = new wchar_t[__len];
1848+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1849+ _M_data->_M_negative_sign = __wcs_ns;
1850+ }
1851+ else
1852+ _M_data->_M_negative_sign = L"";
1853+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1854+
1855+ // _Intl == true.
1856+ __len = strlen(__ccurr);
1857+ if (__len)
1858+ {
1859+ ++__len;
1860+ memset(&__state, 0, sizeof(mbstate_t));
1861+ wchar_t* __wcs = new wchar_t[__len];
1862+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1863+ _M_data->_M_curr_symbol = __wcs;
1864+ }
1865+ else
1866+ _M_data->_M_curr_symbol = L"";
1867+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1868+ }
1869+ catch (...)
1870+ {
1871+ delete _M_data;
1872+ _M_data = 0;
1873+ delete __wcs_ps;
1874+ delete __wcs_ns;
1875+#ifdef __UCLIBC_HAS_XLOCALE__
1876+ __uselocale(__old);
1877+#else
1878+ setlocale(LC_ALL, __old);
1879+ free(__old);
1880+#endif
1881+ __throw_exception_again;
1882+ }
1883+
1884+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1885+ __cloc));
1886+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1887+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1888+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1889+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1890+ __pposn);
1891+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1892+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1893+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1894+ __nposn);
1895+
1896+#ifdef __UCLIBC_HAS_XLOCALE__
1897+ __uselocale(__old);
1898+#else
1899+ setlocale(LC_ALL, __old);
1900+ free(__old);
1901+#endif
1902+ }
1903+ }
1904+
1905+ template<>
1906+ void
1907+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
1908+#ifdef __UCLIBC_HAS_XLOCALE__
1909+ const char*)
1910+#else
1911+ const char* __name)
1912+#endif
1913+ {
1914+ if (!_M_data)
1915+ _M_data = new __moneypunct_cache<wchar_t, false>;
1916+
1917+ if (!__cloc)
1918+ {
1919+ // "C" locale
1920+ _M_data->_M_decimal_point = L'.';
1921+ _M_data->_M_thousands_sep = L',';
1922+ _M_data->_M_grouping = "";
1923+ _M_data->_M_grouping_size = 0;
1924+ _M_data->_M_curr_symbol = L"";
1925+ _M_data->_M_curr_symbol_size = 0;
1926+ _M_data->_M_positive_sign = L"";
1927+ _M_data->_M_positive_sign_size = 0;
1928+ _M_data->_M_negative_sign = L"";
1929+ _M_data->_M_negative_sign_size = 0;
1930+ _M_data->_M_frac_digits = 0;
1931+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1932+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1933+
1934+ // Use ctype::widen code without the facet...
1935+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1936+ _M_data->_M_atoms[__i] =
1937+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1938+ }
1939+ else
1940+ {
1941+ // Named locale.
1942+#ifdef __UCLIBC_HAS_XLOCALE__
1943+ __c_locale __old = __uselocale(__cloc);
1944+#else
1945+ // Switch to named locale so that mbsrtowcs will work.
1946+ char* __old = strdup(setlocale(LC_ALL, NULL));
1947+ setlocale(LC_ALL, __name);
1948+#endif
1949+
1950+#ifdef __UCLIBC_MJN3_ONLY__
1951+#warning fix this... should be monetary
1952+#endif
1953+#ifdef __UCLIBC__
1954+# ifdef __UCLIBC_HAS_XLOCALE__
1955+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1956+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1957+# else
1958+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1959+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1960+# endif
1961+#else
1962+ union { char *__s; wchar_t __w; } __u;
1963+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1964+ _M_data->_M_decimal_point = __u.__w;
1965+
1966+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1967+ _M_data->_M_thousands_sep = __u.__w;
1968+#endif
1969+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1970+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1971+
1972+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1973+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1974+ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1975+
1976+ wchar_t* __wcs_ps = 0;
1977+ wchar_t* __wcs_ns = 0;
1978+ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1979+ try
1980+ {
1981+ mbstate_t __state;
1982+ size_t __len;
1983+ __len = strlen(__cpossign);
1984+ if (__len)
1985+ {
1986+ ++__len;
1987+ memset(&__state, 0, sizeof(mbstate_t));
1988+ __wcs_ps = new wchar_t[__len];
1989+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1990+ _M_data->_M_positive_sign = __wcs_ps;
1991+ }
1992+ else
1993+ _M_data->_M_positive_sign = L"";
1994+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1995+
1996+ __len = strlen(__cnegsign);
1997+ if (!__nposn)
1998+ _M_data->_M_negative_sign = L"()";
1999+ else if (__len)
2000+ {
2001+ ++__len;
2002+ memset(&__state, 0, sizeof(mbstate_t));
2003+ __wcs_ns = new wchar_t[__len];
2004+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
2005+ _M_data->_M_negative_sign = __wcs_ns;
2006+ }
2007+ else
2008+ _M_data->_M_negative_sign = L"";
2009+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
2010+
2011+ // _Intl == true.
2012+ __len = strlen(__ccurr);
2013+ if (__len)
2014+ {
2015+ ++__len;
2016+ memset(&__state, 0, sizeof(mbstate_t));
2017+ wchar_t* __wcs = new wchar_t[__len];
2018+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
2019+ _M_data->_M_curr_symbol = __wcs;
2020+ }
2021+ else
2022+ _M_data->_M_curr_symbol = L"";
2023+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
2024+ }
2025+ catch (...)
2026+ {
2027+ delete _M_data;
2028+ _M_data = 0;
2029+ delete __wcs_ps;
2030+ delete __wcs_ns;
2031+#ifdef __UCLIBC_HAS_XLOCALE__
2032+ __uselocale(__old);
2033+#else
2034+ setlocale(LC_ALL, __old);
2035+ free(__old);
2036+#endif
2037+ __throw_exception_again;
2038+ }
2039+
2040+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
2041+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
2042+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
2043+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
2044+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
2045+ __pposn);
2046+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
2047+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
2048+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
2049+ __nposn);
2050+
2051+#ifdef __UCLIBC_HAS_XLOCALE__
2052+ __uselocale(__old);
2053+#else
2054+ setlocale(LC_ALL, __old);
2055+ free(__old);
2056+#endif
2057+ }
2058+ }
2059+
2060+ template<>
2061+ moneypunct<wchar_t, true>::~moneypunct()
2062+ {
2063+ if (_M_data->_M_positive_sign_size)
2064+ delete [] _M_data->_M_positive_sign;
2065+ if (_M_data->_M_negative_sign_size
2066+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2067+ delete [] _M_data->_M_negative_sign;
2068+ if (_M_data->_M_curr_symbol_size)
2069+ delete [] _M_data->_M_curr_symbol;
2070+ delete _M_data;
2071+ }
2072+
2073+ template<>
2074+ moneypunct<wchar_t, false>::~moneypunct()
2075+ {
2076+ if (_M_data->_M_positive_sign_size)
2077+ delete [] _M_data->_M_positive_sign;
2078+ if (_M_data->_M_negative_sign_size
2079+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2080+ delete [] _M_data->_M_negative_sign;
2081+ if (_M_data->_M_curr_symbol_size)
2082+ delete [] _M_data->_M_curr_symbol;
2083+ delete _M_data;
2084+ }
2085+#endif
2086+}
2087diff --git a/libstdc++-v3/config/locale/uclibc/numeric_members.cc b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2088new file mode 100644
2089index 0000000..883ec1a
2090--- /dev/null
2091+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2092@@ -0,0 +1,160 @@
2093+// std::numpunct implementation details, GNU version -*- C++ -*-
2094+
2095+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2096+//
2097+// This file is part of the GNU ISO C++ Library. This library is free
2098+// software; you can redistribute it and/or modify it under the
2099+// terms of the GNU General Public License as published by the
2100+// Free Software Foundation; either version 2, or (at your option)
2101+// any later version.
2102+
2103+// This library is distributed in the hope that it will be useful,
2104+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2105+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2106+// GNU General Public License for more details.
2107+
2108+// You should have received a copy of the GNU General Public License along
2109+// with this library; see the file COPYING. If not, write to the Free
2110+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2111+// USA.
2112+
2113+// As a special exception, you may use this file as part of a free software
2114+// library without restriction. Specifically, if other files instantiate
2115+// templates or use macros or inline functions from this file, or you compile
2116+// this file and link it with other files to produce an executable, this
2117+// file does not by itself cause the resulting executable to be covered by
2118+// the GNU General Public License. This exception does not however
2119+// invalidate any other reasons why the executable file might be covered by
2120+// the GNU General Public License.
2121+
2122+//
2123+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
2124+//
2125+
2126+// Written by Benjamin Kosnik <bkoz@redhat.com>
2127+
2128+#define _LIBC
2129+#include <locale>
2130+#undef _LIBC
2131+#include <bits/c++locale_internal.h>
2132+
2133+#ifdef __UCLIBC_MJN3_ONLY__
2134+#warning tailor for stub locale support
2135+#endif
2136+#ifndef __UCLIBC_HAS_XLOCALE__
2137+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2138+#endif
2139+
2140+namespace std
2141+{
2142+ template<>
2143+ void
2144+ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
2145+ {
2146+ if (!_M_data)
2147+ _M_data = new __numpunct_cache<char>;
2148+
2149+ if (!__cloc)
2150+ {
2151+ // "C" locale
2152+ _M_data->_M_grouping = "";
2153+ _M_data->_M_grouping_size = 0;
2154+ _M_data->_M_use_grouping = false;
2155+
2156+ _M_data->_M_decimal_point = '.';
2157+ _M_data->_M_thousands_sep = ',';
2158+
2159+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2160+ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
2161+
2162+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2163+ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
2164+ }
2165+ else
2166+ {
2167+ // Named locale.
2168+ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
2169+ __cloc));
2170+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
2171+ __cloc));
2172+
2173+ // Check for NULL, which implies no grouping.
2174+ if (_M_data->_M_thousands_sep == '\0')
2175+ _M_data->_M_grouping = "";
2176+ else
2177+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2178+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2179+ }
2180+
2181+ // NB: There is no way to extact this info from posix locales.
2182+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2183+ _M_data->_M_truename = "true";
2184+ _M_data->_M_truename_size = 4;
2185+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2186+ _M_data->_M_falsename = "false";
2187+ _M_data->_M_falsename_size = 5;
2188+ }
2189+
2190+ template<>
2191+ numpunct<char>::~numpunct()
2192+ { delete _M_data; }
2193+
2194+#ifdef _GLIBCXX_USE_WCHAR_T
2195+ template<>
2196+ void
2197+ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
2198+ {
2199+ if (!_M_data)
2200+ _M_data = new __numpunct_cache<wchar_t>;
2201+
2202+ if (!__cloc)
2203+ {
2204+ // "C" locale
2205+ _M_data->_M_grouping = "";
2206+ _M_data->_M_grouping_size = 0;
2207+ _M_data->_M_use_grouping = false;
2208+
2209+ _M_data->_M_decimal_point = L'.';
2210+ _M_data->_M_thousands_sep = L',';
2211+
2212+ // Use ctype::widen code without the facet...
2213+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2214+ _M_data->_M_atoms_out[__i] =
2215+ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
2216+
2217+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2218+ _M_data->_M_atoms_in[__j] =
2219+ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
2220+ }
2221+ else
2222+ {
2223+ // Named locale.
2224+ // NB: In the GNU model wchar_t is always 32 bit wide.
2225+ union { char *__s; wchar_t __w; } __u;
2226+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
2227+ _M_data->_M_decimal_point = __u.__w;
2228+
2229+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
2230+ _M_data->_M_thousands_sep = __u.__w;
2231+
2232+ if (_M_data->_M_thousands_sep == L'\0')
2233+ _M_data->_M_grouping = "";
2234+ else
2235+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2236+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2237+ }
2238+
2239+ // NB: There is no way to extact this info from posix locales.
2240+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2241+ _M_data->_M_truename = L"true";
2242+ _M_data->_M_truename_size = 4;
2243+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2244+ _M_data->_M_falsename = L"false";
2245+ _M_data->_M_falsename_size = 5;
2246+ }
2247+
2248+ template<>
2249+ numpunct<wchar_t>::~numpunct()
2250+ { delete _M_data; }
2251+ #endif
2252+}
2253diff --git a/libstdc++-v3/config/locale/uclibc/time_members.cc b/libstdc++-v3/config/locale/uclibc/time_members.cc
2254new file mode 100644
2255index 0000000..e0707d7
2256--- /dev/null
2257+++ b/libstdc++-v3/config/locale/uclibc/time_members.cc
2258@@ -0,0 +1,406 @@
2259+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2260+
2261+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2262+//
2263+// This file is part of the GNU ISO C++ Library. This library is free
2264+// software; you can redistribute it and/or modify it under the
2265+// terms of the GNU General Public License as published by the
2266+// Free Software Foundation; either version 2, or (at your option)
2267+// any later version.
2268+
2269+// This library is distributed in the hope that it will be useful,
2270+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2271+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2272+// GNU General Public License for more details.
2273+
2274+// You should have received a copy of the GNU General Public License along
2275+// with this library; see the file COPYING. If not, write to the Free
2276+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2277+// USA.
2278+
2279+// As a special exception, you may use this file as part of a free software
2280+// library without restriction. Specifically, if other files instantiate
2281+// templates or use macros or inline functions from this file, or you compile
2282+// this file and link it with other files to produce an executable, this
2283+// file does not by itself cause the resulting executable to be covered by
2284+// the GNU General Public License. This exception does not however
2285+// invalidate any other reasons why the executable file might be covered by
2286+// the GNU General Public License.
2287+
2288+//
2289+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
2290+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
2291+//
2292+
2293+// Written by Benjamin Kosnik <bkoz@redhat.com>
2294+
2295+#include <locale>
2296+#include <bits/c++locale_internal.h>
2297+
2298+#ifdef __UCLIBC_MJN3_ONLY__
2299+#warning tailor for stub locale support
2300+#endif
2301+#ifndef __UCLIBC_HAS_XLOCALE__
2302+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2303+#endif
2304+
2305+namespace std
2306+{
2307+ template<>
2308+ void
2309+ __timepunct<char>::
2310+ _M_put(char* __s, size_t __maxlen, const char* __format,
2311+ const tm* __tm) const
2312+ {
2313+#ifdef __UCLIBC_HAS_XLOCALE__
2314+ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
2315+ _M_c_locale_timepunct);
2316+#else
2317+ char* __old = strdup(setlocale(LC_ALL, NULL));
2318+ setlocale(LC_ALL, _M_name_timepunct);
2319+ const size_t __len = strftime(__s, __maxlen, __format, __tm);
2320+ setlocale(LC_ALL, __old);
2321+ free(__old);
2322+#endif
2323+ // Make sure __s is null terminated.
2324+ if (__len == 0)
2325+ __s[0] = '\0';
2326+ }
2327+
2328+ template<>
2329+ void
2330+ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
2331+ {
2332+ if (!_M_data)
2333+ _M_data = new __timepunct_cache<char>;
2334+
2335+ if (!__cloc)
2336+ {
2337+ // "C" locale
2338+ _M_c_locale_timepunct = _S_get_c_locale();
2339+
2340+ _M_data->_M_date_format = "%m/%d/%y";
2341+ _M_data->_M_date_era_format = "%m/%d/%y";
2342+ _M_data->_M_time_format = "%H:%M:%S";
2343+ _M_data->_M_time_era_format = "%H:%M:%S";
2344+ _M_data->_M_date_time_format = "";
2345+ _M_data->_M_date_time_era_format = "";
2346+ _M_data->_M_am = "AM";
2347+ _M_data->_M_pm = "PM";
2348+ _M_data->_M_am_pm_format = "";
2349+
2350+ // Day names, starting with "C"'s Sunday.
2351+ _M_data->_M_day1 = "Sunday";
2352+ _M_data->_M_day2 = "Monday";
2353+ _M_data->_M_day3 = "Tuesday";
2354+ _M_data->_M_day4 = "Wednesday";
2355+ _M_data->_M_day5 = "Thursday";
2356+ _M_data->_M_day6 = "Friday";
2357+ _M_data->_M_day7 = "Saturday";
2358+
2359+ // Abbreviated day names, starting with "C"'s Sun.
2360+ _M_data->_M_aday1 = "Sun";
2361+ _M_data->_M_aday2 = "Mon";
2362+ _M_data->_M_aday3 = "Tue";
2363+ _M_data->_M_aday4 = "Wed";
2364+ _M_data->_M_aday5 = "Thu";
2365+ _M_data->_M_aday6 = "Fri";
2366+ _M_data->_M_aday7 = "Sat";
2367+
2368+ // Month names, starting with "C"'s January.
2369+ _M_data->_M_month01 = "January";
2370+ _M_data->_M_month02 = "February";
2371+ _M_data->_M_month03 = "March";
2372+ _M_data->_M_month04 = "April";
2373+ _M_data->_M_month05 = "May";
2374+ _M_data->_M_month06 = "June";
2375+ _M_data->_M_month07 = "July";
2376+ _M_data->_M_month08 = "August";
2377+ _M_data->_M_month09 = "September";
2378+ _M_data->_M_month10 = "October";
2379+ _M_data->_M_month11 = "November";
2380+ _M_data->_M_month12 = "December";
2381+
2382+ // Abbreviated month names, starting with "C"'s Jan.
2383+ _M_data->_M_amonth01 = "Jan";
2384+ _M_data->_M_amonth02 = "Feb";
2385+ _M_data->_M_amonth03 = "Mar";
2386+ _M_data->_M_amonth04 = "Apr";
2387+ _M_data->_M_amonth05 = "May";
2388+ _M_data->_M_amonth06 = "Jun";
2389+ _M_data->_M_amonth07 = "Jul";
2390+ _M_data->_M_amonth08 = "Aug";
2391+ _M_data->_M_amonth09 = "Sep";
2392+ _M_data->_M_amonth10 = "Oct";
2393+ _M_data->_M_amonth11 = "Nov";
2394+ _M_data->_M_amonth12 = "Dec";
2395+ }
2396+ else
2397+ {
2398+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2399+
2400+ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
2401+ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
2402+ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
2403+ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
2404+ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
2405+ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
2406+ __cloc);
2407+ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
2408+ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
2409+ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
2410+
2411+ // Day names, starting with "C"'s Sunday.
2412+ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
2413+ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
2414+ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
2415+ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
2416+ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
2417+ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
2418+ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
2419+
2420+ // Abbreviated day names, starting with "C"'s Sun.
2421+ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
2422+ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
2423+ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
2424+ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
2425+ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
2426+ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
2427+ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
2428+
2429+ // Month names, starting with "C"'s January.
2430+ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
2431+ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
2432+ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
2433+ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
2434+ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
2435+ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
2436+ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
2437+ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
2438+ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
2439+ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
2440+ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
2441+ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
2442+
2443+ // Abbreviated month names, starting with "C"'s Jan.
2444+ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
2445+ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
2446+ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
2447+ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
2448+ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
2449+ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
2450+ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
2451+ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
2452+ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
2453+ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
2454+ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
2455+ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
2456+ }
2457+ }
2458+
2459+#ifdef _GLIBCXX_USE_WCHAR_T
2460+ template<>
2461+ void
2462+ __timepunct<wchar_t>::
2463+ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
2464+ const tm* __tm) const
2465+ {
2466+#ifdef __UCLIBC_HAS_XLOCALE__
2467+ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2468+ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
2469+ _M_c_locale_timepunct);
2470+#else
2471+ char* __old = strdup(setlocale(LC_ALL, NULL));
2472+ setlocale(LC_ALL, _M_name_timepunct);
2473+ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
2474+ setlocale(LC_ALL, __old);
2475+ free(__old);
2476+#endif
2477+ // Make sure __s is null terminated.
2478+ if (__len == 0)
2479+ __s[0] = L'\0';
2480+ }
2481+
2482+ template<>
2483+ void
2484+ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
2485+ {
2486+ if (!_M_data)
2487+ _M_data = new __timepunct_cache<wchar_t>;
2488+
2489+#warning wide time stuff
2490+// if (!__cloc)
2491+ {
2492+ // "C" locale
2493+ _M_c_locale_timepunct = _S_get_c_locale();
2494+
2495+ _M_data->_M_date_format = L"%m/%d/%y";
2496+ _M_data->_M_date_era_format = L"%m/%d/%y";
2497+ _M_data->_M_time_format = L"%H:%M:%S";
2498+ _M_data->_M_time_era_format = L"%H:%M:%S";
2499+ _M_data->_M_date_time_format = L"";
2500+ _M_data->_M_date_time_era_format = L"";
2501+ _M_data->_M_am = L"AM";
2502+ _M_data->_M_pm = L"PM";
2503+ _M_data->_M_am_pm_format = L"";
2504+
2505+ // Day names, starting with "C"'s Sunday.
2506+ _M_data->_M_day1 = L"Sunday";
2507+ _M_data->_M_day2 = L"Monday";
2508+ _M_data->_M_day3 = L"Tuesday";
2509+ _M_data->_M_day4 = L"Wednesday";
2510+ _M_data->_M_day5 = L"Thursday";
2511+ _M_data->_M_day6 = L"Friday";
2512+ _M_data->_M_day7 = L"Saturday";
2513+
2514+ // Abbreviated day names, starting with "C"'s Sun.
2515+ _M_data->_M_aday1 = L"Sun";
2516+ _M_data->_M_aday2 = L"Mon";
2517+ _M_data->_M_aday3 = L"Tue";
2518+ _M_data->_M_aday4 = L"Wed";
2519+ _M_data->_M_aday5 = L"Thu";
2520+ _M_data->_M_aday6 = L"Fri";
2521+ _M_data->_M_aday7 = L"Sat";
2522+
2523+ // Month names, starting with "C"'s January.
2524+ _M_data->_M_month01 = L"January";
2525+ _M_data->_M_month02 = L"February";
2526+ _M_data->_M_month03 = L"March";
2527+ _M_data->_M_month04 = L"April";
2528+ _M_data->_M_month05 = L"May";
2529+ _M_data->_M_month06 = L"June";
2530+ _M_data->_M_month07 = L"July";
2531+ _M_data->_M_month08 = L"August";
2532+ _M_data->_M_month09 = L"September";
2533+ _M_data->_M_month10 = L"October";
2534+ _M_data->_M_month11 = L"November";
2535+ _M_data->_M_month12 = L"December";
2536+
2537+ // Abbreviated month names, starting with "C"'s Jan.
2538+ _M_data->_M_amonth01 = L"Jan";
2539+ _M_data->_M_amonth02 = L"Feb";
2540+ _M_data->_M_amonth03 = L"Mar";
2541+ _M_data->_M_amonth04 = L"Apr";
2542+ _M_data->_M_amonth05 = L"May";
2543+ _M_data->_M_amonth06 = L"Jun";
2544+ _M_data->_M_amonth07 = L"Jul";
2545+ _M_data->_M_amonth08 = L"Aug";
2546+ _M_data->_M_amonth09 = L"Sep";
2547+ _M_data->_M_amonth10 = L"Oct";
2548+ _M_data->_M_amonth11 = L"Nov";
2549+ _M_data->_M_amonth12 = L"Dec";
2550+ }
2551+#if 0
2552+ else
2553+ {
2554+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2555+
2556+ union { char *__s; wchar_t *__w; } __u;
2557+
2558+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
2559+ _M_data->_M_date_format = __u.__w;
2560+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
2561+ _M_data->_M_date_era_format = __u.__w;
2562+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
2563+ _M_data->_M_time_format = __u.__w;
2564+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
2565+ _M_data->_M_time_era_format = __u.__w;
2566+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
2567+ _M_data->_M_date_time_format = __u.__w;
2568+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
2569+ _M_data->_M_date_time_era_format = __u.__w;
2570+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
2571+ _M_data->_M_am = __u.__w;
2572+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
2573+ _M_data->_M_pm = __u.__w;
2574+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
2575+ _M_data->_M_am_pm_format = __u.__w;
2576+
2577+ // Day names, starting with "C"'s Sunday.
2578+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
2579+ _M_data->_M_day1 = __u.__w;
2580+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
2581+ _M_data->_M_day2 = __u.__w;
2582+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
2583+ _M_data->_M_day3 = __u.__w;
2584+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
2585+ _M_data->_M_day4 = __u.__w;
2586+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
2587+ _M_data->_M_day5 = __u.__w;
2588+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
2589+ _M_data->_M_day6 = __u.__w;
2590+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
2591+ _M_data->_M_day7 = __u.__w;
2592+
2593+ // Abbreviated day names, starting with "C"'s Sun.
2594+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
2595+ _M_data->_M_aday1 = __u.__w;
2596+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
2597+ _M_data->_M_aday2 = __u.__w;
2598+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
2599+ _M_data->_M_aday3 = __u.__w;
2600+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
2601+ _M_data->_M_aday4 = __u.__w;
2602+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
2603+ _M_data->_M_aday5 = __u.__w;
2604+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
2605+ _M_data->_M_aday6 = __u.__w;
2606+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
2607+ _M_data->_M_aday7 = __u.__w;
2608+
2609+ // Month names, starting with "C"'s January.
2610+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
2611+ _M_data->_M_month01 = __u.__w;
2612+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
2613+ _M_data->_M_month02 = __u.__w;
2614+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
2615+ _M_data->_M_month03 = __u.__w;
2616+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
2617+ _M_data->_M_month04 = __u.__w;
2618+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
2619+ _M_data->_M_month05 = __u.__w;
2620+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
2621+ _M_data->_M_month06 = __u.__w;
2622+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
2623+ _M_data->_M_month07 = __u.__w;
2624+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
2625+ _M_data->_M_month08 = __u.__w;
2626+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
2627+ _M_data->_M_month09 = __u.__w;
2628+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
2629+ _M_data->_M_month10 = __u.__w;
2630+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
2631+ _M_data->_M_month11 = __u.__w;
2632+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
2633+ _M_data->_M_month12 = __u.__w;
2634+
2635+ // Abbreviated month names, starting with "C"'s Jan.
2636+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
2637+ _M_data->_M_amonth01 = __u.__w;
2638+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
2639+ _M_data->_M_amonth02 = __u.__w;
2640+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
2641+ _M_data->_M_amonth03 = __u.__w;
2642+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
2643+ _M_data->_M_amonth04 = __u.__w;
2644+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
2645+ _M_data->_M_amonth05 = __u.__w;
2646+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
2647+ _M_data->_M_amonth06 = __u.__w;
2648+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
2649+ _M_data->_M_amonth07 = __u.__w;
2650+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
2651+ _M_data->_M_amonth08 = __u.__w;
2652+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
2653+ _M_data->_M_amonth09 = __u.__w;
2654+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
2655+ _M_data->_M_amonth10 = __u.__w;
2656+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
2657+ _M_data->_M_amonth11 = __u.__w;
2658+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
2659+ _M_data->_M_amonth12 = __u.__w;
2660+ }
2661+#endif // 0
2662+ }
2663+#endif
2664+}
2665diff --git a/libstdc++-v3/config/locale/uclibc/time_members.h b/libstdc++-v3/config/locale/uclibc/time_members.h
2666new file mode 100644
2667index 0000000..ba8e858
2668--- /dev/null
2669+++ b/libstdc++-v3/config/locale/uclibc/time_members.h
2670@@ -0,0 +1,68 @@
2671+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2672+
2673+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2674+//
2675+// This file is part of the GNU ISO C++ Library. This library is free
2676+// software; you can redistribute it and/or modify it under the
2677+// terms of the GNU General Public License as published by the
2678+// Free Software Foundation; either version 2, or (at your option)
2679+// any later version.
2680+
2681+// This library is distributed in the hope that it will be useful,
2682+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2683+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2684+// GNU General Public License for more details.
2685+
2686+// You should have received a copy of the GNU General Public License along
2687+// with this library; see the file COPYING. If not, write to the Free
2688+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2689+// USA.
2690+
2691+// As a special exception, you may use this file as part of a free software
2692+// library without restriction. Specifically, if other files instantiate
2693+// templates or use macros or inline functions from this file, or you compile
2694+// this file and link it with other files to produce an executable, this
2695+// file does not by itself cause the resulting executable to be covered by
2696+// the GNU General Public License. This exception does not however
2697+// invalidate any other reasons why the executable file might be covered by
2698+// the GNU General Public License.
2699+
2700+//
2701+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
2702+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
2703+//
2704+
2705+// Written by Benjamin Kosnik <bkoz@redhat.com>
2706+
2707+ template<typename _CharT>
2708+ __timepunct<_CharT>::__timepunct(size_t __refs)
2709+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2710+ _M_name_timepunct(_S_get_c_name())
2711+ { _M_initialize_timepunct(); }
2712+
2713+ template<typename _CharT>
2714+ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
2715+ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
2716+ _M_name_timepunct(_S_get_c_name())
2717+ { _M_initialize_timepunct(); }
2718+
2719+ template<typename _CharT>
2720+ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
2721+ size_t __refs)
2722+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2723+ _M_name_timepunct(__s)
2724+ {
2725+ char* __tmp = new char[std::strlen(__s) + 1];
2726+ std::strcpy(__tmp, __s);
2727+ _M_name_timepunct = __tmp;
2728+ _M_initialize_timepunct(__cloc);
2729+ }
2730+
2731+ template<typename _CharT>
2732+ __timepunct<_CharT>::~__timepunct()
2733+ {
2734+ if (_M_name_timepunct != _S_get_c_name())
2735+ delete [] _M_name_timepunct;
2736+ delete _M_data;
2737+ _S_destroy_c_locale(_M_c_locale_timepunct);
2738+ }
2739diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
2740index f40ddcf..c57a751 100755
2741--- a/libstdc++-v3/configure
2742+++ b/libstdc++-v3/configure
2743@@ -15822,6 +15822,9 @@ fi
2744 # Default to "generic".
2745 if test $enable_clocale_flag = auto; then
2746 case ${target_os} in
2747+ *-uclibc*)
2748+ enable_clocale_flag=uclibc
2749+ ;;
2750 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
2751 enable_clocale_flag=gnu
2752 ;;
2753@@ -16079,6 +16082,78 @@ $as_echo "newlib" >&6; }
2754 CTIME_CC=config/locale/generic/time_members.cc
2755 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
2756 ;;
2757+ uclibc)
2758+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: uclibc" >&5
2759+$as_echo "uclibc" >&6; }
2760+
2761+ # Declare intention to use gettext, and add support for specific
2762+ # languages.
2763+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
2764+ ALL_LINGUAS="de fr"
2765+
2766+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
2767+ # Extract the first word of "msgfmt", so it can be a program name with args.
2768+set dummy msgfmt; ac_word=$2
2769+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
2770+$as_echo_n "checking for $ac_word... " >&6; }
2771+if test "${ac_cv_prog_check_msgfmt+set}" = set; then :
2772+ $as_echo_n "(cached) " >&6
2773+else
2774+ if test -n "$check_msgfmt"; then
2775+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
2776+else
2777+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2778+for as_dir in $PATH
2779+do
2780+ IFS=$as_save_IFS
2781+ test -z "$as_dir" && as_dir=.
2782+ for ac_exec_ext in '' $ac_executable_extensions; do
2783+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
2784+ ac_cv_prog_check_msgfmt="yes"
2785+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
2786+ break 2
2787+ fi
2788+done
2789+ done
2790+IFS=$as_save_IFS
2791+
2792+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
2793+fi
2794+fi
2795+check_msgfmt=$ac_cv_prog_check_msgfmt
2796+if test -n "$check_msgfmt"; then
2797+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $check_msgfmt" >&5
2798+$as_echo "$check_msgfmt" >&6; }
2799+else
2800+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
2801+$as_echo "no" >&6; }
2802+fi
2803+
2804+
2805+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
2806+ USE_NLS=yes
2807+ fi
2808+ # Export the build objects.
2809+ for ling in $ALL_LINGUAS; do \
2810+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
2811+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
2812+ done
2813+
2814+
2815+
2816+ CLOCALE_H=config/locale/uclibc/c_locale.h
2817+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
2818+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
2819+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
2820+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
2821+ CMESSAGES_H=config/locale/uclibc/messages_members.h
2822+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
2823+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
2824+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
2825+ CTIME_H=config/locale/uclibc/time_members.h
2826+ CTIME_CC=config/locale/uclibc/time_members.cc
2827+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
2828+ ;;
2829 esac
2830
2831 # This is where the testsuite looks for locale catalogs, using the
2832diff --git a/libstdc++-v3/include/c_compatibility/wchar.h b/libstdc++-v3/include/c_compatibility/wchar.h
2833index 580d725..3fe61b8 100644
2834--- a/libstdc++-v3/include/c_compatibility/wchar.h
2835+++ b/libstdc++-v3/include/c_compatibility/wchar.h
2836@@ -101,7 +101,9 @@ using std::wmemcmp;
2837 using std::wmemcpy;
2838 using std::wmemmove;
2839 using std::wmemset;
2840+#if _GLIBCXX_HAVE_WCSFTIME
2841 using std::wcsftime;
2842+#endif
2843
2844 #if _GLIBCXX_USE_C99
2845 using std::wcstold;
2846diff --git a/libstdc++-v3/include/c_std/cwchar b/libstdc++-v3/include/c_std/cwchar
2847index 0e6b1fc..405aee2 100644
2848--- a/libstdc++-v3/include/c_std/cwchar
2849+++ b/libstdc++-v3/include/c_std/cwchar
2850@@ -175,7 +175,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
2851 using ::wcscoll;
2852 using ::wcscpy;
2853 using ::wcscspn;
2854+#if _GLIBCXX_HAVE_WCSFTIME
2855 using ::wcsftime;
2856+#endif
2857 using ::wcslen;
2858 using ::wcsncat;
2859 using ::wcsncmp;
2860--
28611.7.10.4
2862
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0005-uclibc-locale-no__x.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0005-uclibc-locale-no__x.patch
new file mode 100644
index 0000000..dcbbfe4
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0005-uclibc-locale-no__x.patch
@@ -0,0 +1,257 @@
1From 6a3e8506a12c12728d8b29901defd738be43757f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:42:36 +0400
4Subject: [PATCH 05/35] uclibc-locale-no__x
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 .../config/locale/uclibc/c++locale_internal.h | 45 ++++++++++++++++++++
11 libstdc++-v3/config/locale/uclibc/c_locale.cc | 14 ------
12 libstdc++-v3/config/locale/uclibc/c_locale.h | 1 +
13 .../config/locale/uclibc/collate_members.cc | 7 ---
14 libstdc++-v3/config/locale/uclibc/ctype_members.cc | 7 ---
15 .../config/locale/uclibc/messages_members.cc | 7 +--
16 .../config/locale/uclibc/messages_members.h | 18 +++-----
17 .../config/locale/uclibc/monetary_members.cc | 4 --
18 .../config/locale/uclibc/numeric_members.cc | 3 --
19 libstdc++-v3/config/locale/uclibc/time_members.cc | 3 --
20 10 files changed, 55 insertions(+), 54 deletions(-)
21
22diff --git a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
23index 2ae3e4a..e74fddf 100644
24--- a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
25+++ b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
26@@ -60,4 +60,49 @@ extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
27 extern "C" __typeof(wctype_l) __wctype_l;
28 #endif
29
30+# define __nl_langinfo_l nl_langinfo_l
31+# define __strcoll_l strcoll_l
32+# define __strftime_l strftime_l
33+# define __strtod_l strtod_l
34+# define __strtof_l strtof_l
35+# define __strtold_l strtold_l
36+# define __strxfrm_l strxfrm_l
37+# define __newlocale newlocale
38+# define __freelocale freelocale
39+# define __duplocale duplocale
40+# define __uselocale uselocale
41+
42+# ifdef _GLIBCXX_USE_WCHAR_T
43+# define __iswctype_l iswctype_l
44+# define __towlower_l towlower_l
45+# define __towupper_l towupper_l
46+# define __wcscoll_l wcscoll_l
47+# define __wcsftime_l wcsftime_l
48+# define __wcsxfrm_l wcsxfrm_l
49+# define __wctype_l wctype_l
50+# endif
51+
52+#else
53+# define __nl_langinfo_l(N, L) nl_langinfo((N))
54+# define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
55+# define __strtod_l(S, E, L) strtod((S), (E))
56+# define __strtof_l(S, E, L) strtof((S), (E))
57+# define __strtold_l(S, E, L) strtold((S), (E))
58+# define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
59+# warning should dummy __newlocale check for C|POSIX ?
60+# define __newlocale(a, b, c) NULL
61+# define __freelocale(a) ((void)0)
62+# define __duplocale(a) __c_locale()
63+//# define __uselocale ?
64+//
65+# ifdef _GLIBCXX_USE_WCHAR_T
66+# define __iswctype_l(C, M, L) iswctype((C), (M))
67+# define __towlower_l(C, L) towlower((C))
68+# define __towupper_l(C, L) towupper((C))
69+# define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
70+//# define __wcsftime_l(S, M, F, T, L) wcsftime((S), (M), (F), (T))
71+# define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
72+# define __wctype_l(S, L) wctype((S))
73+# endif
74+
75 #endif // GLIBC 2.3 and later
76diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.cc b/libstdc++-v3/config/locale/uclibc/c_locale.cc
77index 5081dc1..21430d0 100644
78--- a/libstdc++-v3/config/locale/uclibc/c_locale.cc
79+++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc
80@@ -39,20 +39,6 @@
81 #include <langinfo.h>
82 #include <bits/c++locale_internal.h>
83
84-#ifndef __UCLIBC_HAS_XLOCALE__
85-#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
86-#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
87-#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
88-#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
89-#define __strtof_l(S, E, L) strtof((S), (E))
90-#define __strtod_l(S, E, L) strtod((S), (E))
91-#define __strtold_l(S, E, L) strtold((S), (E))
92-#warning should dummy __newlocale check for C|POSIX ?
93-#define __newlocale(a, b, c) NULL
94-#define __freelocale(a) ((void)0)
95-#define __duplocale(a) __c_locale()
96-#endif
97-
98 namespace std
99 {
100 template<>
101diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.h b/libstdc++-v3/config/locale/uclibc/c_locale.h
102index da07c1f..4bca5f1 100644
103--- a/libstdc++-v3/config/locale/uclibc/c_locale.h
104+++ b/libstdc++-v3/config/locale/uclibc/c_locale.h
105@@ -68,6 +68,7 @@ namespace __gnu_cxx
106 {
107 extern "C" __typeof(uselocale) __uselocale;
108 }
109+#define __uselocale uselocale
110 #endif
111
112 namespace std
113diff --git a/libstdc++-v3/config/locale/uclibc/collate_members.cc b/libstdc++-v3/config/locale/uclibc/collate_members.cc
114index c2664a7..ec5c329 100644
115--- a/libstdc++-v3/config/locale/uclibc/collate_members.cc
116+++ b/libstdc++-v3/config/locale/uclibc/collate_members.cc
117@@ -36,13 +36,6 @@
118 #include <locale>
119 #include <bits/c++locale_internal.h>
120
121-#ifndef __UCLIBC_HAS_XLOCALE__
122-#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
123-#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
124-#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
125-#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
126-#endif
127-
128 namespace std
129 {
130 // These are basically extensions to char_traits, and perhaps should
131diff --git a/libstdc++-v3/config/locale/uclibc/ctype_members.cc b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
132index 7294e3a..7b12861 100644
133--- a/libstdc++-v3/config/locale/uclibc/ctype_members.cc
134+++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
135@@ -38,13 +38,6 @@
136 #undef _LIBC
137 #include <bits/c++locale_internal.h>
138
139-#ifndef __UCLIBC_HAS_XLOCALE__
140-#define __wctype_l(S, L) wctype((S))
141-#define __towupper_l(C, L) towupper((C))
142-#define __towlower_l(C, L) towlower((C))
143-#define __iswctype_l(C, M, L) iswctype((C), (M))
144-#endif
145-
146 namespace std
147 {
148 // NB: The other ctype<char> specializations are in src/locale.cc and
149diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.cc b/libstdc++-v3/config/locale/uclibc/messages_members.cc
150index 13594d9..d7693b4 100644
151--- a/libstdc++-v3/config/locale/uclibc/messages_members.cc
152+++ b/libstdc++-v3/config/locale/uclibc/messages_members.cc
153@@ -39,13 +39,10 @@
154 #ifdef __UCLIBC_MJN3_ONLY__
155 #warning fix gettext stuff
156 #endif
157-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
158-extern "C" char *__dcgettext(const char *domainname,
159- const char *msgid, int category);
160 #undef gettext
161-#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
162+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
163+#define gettext(msgid) dcgettext(NULL, msgid, LC_MESSAGES)
164 #else
165-#undef gettext
166 #define gettext(msgid) (msgid)
167 #endif
168
169diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.h b/libstdc++-v3/config/locale/uclibc/messages_members.h
170index 1424078..d89da33 100644
171--- a/libstdc++-v3/config/locale/uclibc/messages_members.h
172+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
173@@ -36,15 +36,11 @@
174 #ifdef __UCLIBC_MJN3_ONLY__
175 #warning fix prototypes for *textdomain funcs
176 #endif
177-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
178-extern "C" char *__textdomain(const char *domainname);
179-extern "C" char *__bindtextdomain(const char *domainname,
180- const char *dirname);
181-#else
182-#undef __textdomain
183-#undef __bindtextdomain
184-#define __textdomain(D) ((void)0)
185-#define __bindtextdomain(D,P) ((void)0)
186+#ifndef __UCLIBC_HAS_GETTEXT_AWARENESS__
187+#undef textdomain
188+#undef bindtextdomain
189+#define textdomain(D) ((void)0)
190+#define bindtextdomain(D,P) ((void)0)
191 #endif
192
193 // Non-virtual member functions.
194@@ -70,7 +66,7 @@ extern "C" char *__bindtextdomain(const char *domainname,
195 messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
196 const char* __dir) const
197 {
198- __bindtextdomain(__s.c_str(), __dir);
199+ bindtextdomain(__s.c_str(), __dir);
200 return this->do_open(__s, __loc);
201 }
202
203@@ -90,7 +86,7 @@ extern "C" char *__bindtextdomain(const char *domainname,
204 {
205 // No error checking is done, assume the catalog exists and can
206 // be used.
207- __textdomain(__s.c_str());
208+ textdomain(__s.c_str());
209 return 0;
210 }
211
212diff --git a/libstdc++-v3/config/locale/uclibc/monetary_members.cc b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
213index aa52731..2e6f80a 100644
214--- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
215+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
216@@ -43,10 +43,6 @@
217 #warning tailor for stub locale support
218 #endif
219
220-#ifndef __UCLIBC_HAS_XLOCALE__
221-#define __nl_langinfo_l(N, L) nl_langinfo((N))
222-#endif
223-
224 namespace std
225 {
226 // Construct and return valid pattern consisting of some combination of:
227diff --git a/libstdc++-v3/config/locale/uclibc/numeric_members.cc b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
228index 883ec1a..2c70642 100644
229--- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
230+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
231@@ -41,9 +41,6 @@
232 #ifdef __UCLIBC_MJN3_ONLY__
233 #warning tailor for stub locale support
234 #endif
235-#ifndef __UCLIBC_HAS_XLOCALE__
236-#define __nl_langinfo_l(N, L) nl_langinfo((N))
237-#endif
238
239 namespace std
240 {
241diff --git a/libstdc++-v3/config/locale/uclibc/time_members.cc b/libstdc++-v3/config/locale/uclibc/time_members.cc
242index e0707d7..d848ed5 100644
243--- a/libstdc++-v3/config/locale/uclibc/time_members.cc
244+++ b/libstdc++-v3/config/locale/uclibc/time_members.cc
245@@ -40,9 +40,6 @@
246 #ifdef __UCLIBC_MJN3_ONLY__
247 #warning tailor for stub locale support
248 #endif
249-#ifndef __UCLIBC_HAS_XLOCALE__
250-#define __nl_langinfo_l(N, L) nl_langinfo((N))
251-#endif
252
253 namespace std
254 {
255--
2561.7.10.4
257
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0006-uclibc-locale-wchar_fix.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0006-uclibc-locale-wchar_fix.patch
new file mode 100644
index 0000000..3406859
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0006-uclibc-locale-wchar_fix.patch
@@ -0,0 +1,68 @@
1From 225511a3aeb193a916b3999f0b640a392caa67cd Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:45:57 +0400
4Subject: [PATCH 06/35] uclibc-locale-wchar_fix
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/config/locale/uclibc/monetary_members.cc | 4 ++--
11 libstdc++-v3/config/locale/uclibc/numeric_members.cc | 13 +++++++++++++
12 2 files changed, 15 insertions(+), 2 deletions(-)
13
14diff --git a/libstdc++-v3/config/locale/uclibc/monetary_members.cc b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
15index 2e6f80a..31ebb9f 100644
16--- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
17+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
18@@ -401,7 +401,7 @@ namespace std
19 # ifdef __UCLIBC_HAS_XLOCALE__
20 _M_data->_M_decimal_point = __cloc->decimal_point_wc;
21 _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
22-# else
23+# elif defined __UCLIBC_HAS_LOCALE__
24 _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
25 _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
26 # endif
27@@ -556,7 +556,7 @@ namespace std
28 # ifdef __UCLIBC_HAS_XLOCALE__
29 _M_data->_M_decimal_point = __cloc->decimal_point_wc;
30 _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
31-# else
32+# elif defined __UCLIBC_HAS_LOCALE__
33 _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
34 _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
35 # endif
36diff --git a/libstdc++-v3/config/locale/uclibc/numeric_members.cc b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
37index 2c70642..d5c8961 100644
38--- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
39+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
40@@ -127,12 +127,25 @@ namespace std
41 {
42 // Named locale.
43 // NB: In the GNU model wchar_t is always 32 bit wide.
44+#ifdef __UCLIBC_MJN3_ONLY__
45+#warning fix this... should be numeric
46+#endif
47+#ifdef __UCLIBC__
48+# ifdef __UCLIBC_HAS_XLOCALE__
49+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
50+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
51+# elif defined __UCLIBC_HAS_LOCALE__
52+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
53+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
54+# endif
55+#else
56 union { char *__s; wchar_t __w; } __u;
57 __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
58 _M_data->_M_decimal_point = __u.__w;
59
60 __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
61 _M_data->_M_thousands_sep = __u.__w;
62+#endif
63
64 if (_M_data->_M_thousands_sep == L'\0')
65 _M_data->_M_grouping = "";
66--
671.7.10.4
68
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0007-uclibc-locale-update.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0007-uclibc-locale-update.patch
new file mode 100644
index 0000000..5851123
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0007-uclibc-locale-update.patch
@@ -0,0 +1,542 @@
1From 6ffe7c46f52d27864c3df3663e16ec9ddee71e8f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:46:58 +0400
4Subject: [PATCH 07/35] uclibc-locale-update
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 .../config/locale/uclibc/c++locale_internal.h | 3 +
11 libstdc++-v3/config/locale/uclibc/c_locale.cc | 74 +++++++++-----------
12 libstdc++-v3/config/locale/uclibc/c_locale.h | 42 ++++++-----
13 libstdc++-v3/config/locale/uclibc/ctype_members.cc | 51 ++++++++++----
14 .../config/locale/uclibc/messages_members.h | 12 ++--
15 .../config/locale/uclibc/monetary_members.cc | 34 +++++----
16 .../config/locale/uclibc/numeric_members.cc | 5 ++
17 libstdc++-v3/config/locale/uclibc/time_members.cc | 18 +++--
18 libstdc++-v3/config/locale/uclibc/time_members.h | 17 +++--
19 9 files changed, 158 insertions(+), 98 deletions(-)
20
21diff --git a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
22index e74fddf..971a6b4 100644
23--- a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
24+++ b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
25@@ -31,6 +31,9 @@
26
27 #include <bits/c++config.h>
28 #include <clocale>
29+#include <cstdlib>
30+#include <cstring>
31+#include <cstddef>
32
33 #ifdef __UCLIBC_MJN3_ONLY__
34 #warning clean this up
35diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.cc b/libstdc++-v3/config/locale/uclibc/c_locale.cc
36index 21430d0..1b9d8e1 100644
37--- a/libstdc++-v3/config/locale/uclibc/c_locale.cc
38+++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc
39@@ -39,23 +39,20 @@
40 #include <langinfo.h>
41 #include <bits/c++locale_internal.h>
42
43-namespace std
44-{
45+_GLIBCXX_BEGIN_NAMESPACE(std)
46+
47 template<>
48 void
49 __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
50 const __c_locale& __cloc)
51 {
52- if (!(__err & ios_base::failbit))
53- {
54- char* __sanity;
55- errno = 0;
56- float __f = __strtof_l(__s, &__sanity, __cloc);
57- if (__sanity != __s && errno != ERANGE)
58- __v = __f;
59- else
60- __err |= ios_base::failbit;
61- }
62+ char* __sanity;
63+ errno = 0;
64+ float __f = __strtof_l(__s, &__sanity, __cloc);
65+ if (__sanity != __s && errno != ERANGE)
66+ __v = __f;
67+ else
68+ __err |= ios_base::failbit;
69 }
70
71 template<>
72@@ -63,16 +60,13 @@ namespace std
73 __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
74 const __c_locale& __cloc)
75 {
76- if (!(__err & ios_base::failbit))
77- {
78- char* __sanity;
79- errno = 0;
80- double __d = __strtod_l(__s, &__sanity, __cloc);
81- if (__sanity != __s && errno != ERANGE)
82- __v = __d;
83- else
84- __err |= ios_base::failbit;
85- }
86+ char* __sanity;
87+ errno = 0;
88+ double __d = __strtod_l(__s, &__sanity, __cloc);
89+ if (__sanity != __s && errno != ERANGE)
90+ __v = __d;
91+ else
92+ __err |= ios_base::failbit;
93 }
94
95 template<>
96@@ -80,16 +74,13 @@ namespace std
97 __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
98 const __c_locale& __cloc)
99 {
100- if (!(__err & ios_base::failbit))
101- {
102- char* __sanity;
103- errno = 0;
104- long double __ld = __strtold_l(__s, &__sanity, __cloc);
105- if (__sanity != __s && errno != ERANGE)
106- __v = __ld;
107- else
108- __err |= ios_base::failbit;
109- }
110+ char* __sanity;
111+ errno = 0;
112+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
113+ if (__sanity != __s && errno != ERANGE)
114+ __v = __ld;
115+ else
116+ __err |= ios_base::failbit;
117 }
118
119 void
120@@ -110,17 +101,18 @@ namespace std
121 void
122 locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
123 {
124- if (_S_get_c_locale() != __cloc)
125+ if (__cloc && _S_get_c_locale() != __cloc)
126 __freelocale(__cloc);
127 }
128
129 __c_locale
130 locale::facet::_S_clone_c_locale(__c_locale& __cloc)
131 { return __duplocale(__cloc); }
132-} // namespace std
133
134-namespace __gnu_cxx
135-{
136+_GLIBCXX_END_NAMESPACE
137+
138+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
139+
140 const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
141 {
142 "LC_CTYPE",
143@@ -138,9 +130,11 @@ namespace __gnu_cxx
144 "LC_IDENTIFICATION"
145 #endif
146 };
147-}
148
149-namespace std
150-{
151+_GLIBCXX_END_NAMESPACE
152+
153+_GLIBCXX_BEGIN_NAMESPACE(std)
154+
155 const char* const* const locale::_S_categories = __gnu_cxx::category_names;
156-} // namespace std
157+
158+_GLIBCXX_END_NAMESPACE
159diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.h b/libstdc++-v3/config/locale/uclibc/c_locale.h
160index 4bca5f1..64a6d46 100644
161--- a/libstdc++-v3/config/locale/uclibc/c_locale.h
162+++ b/libstdc++-v3/config/locale/uclibc/c_locale.h
163@@ -39,21 +39,23 @@
164 #pragma GCC system_header
165
166 #include <cstring> // get std::strlen
167-#include <cstdio> // get std::snprintf or std::sprintf
168+#include <cstdio> // get std::vsnprintf or std::vsprintf
169 #include <clocale>
170 #include <langinfo.h> // For codecvt
171 #ifdef __UCLIBC_MJN3_ONLY__
172 #warning fix this
173 #endif
174-#ifdef __UCLIBC_HAS_LOCALE__
175+#ifdef _GLIBCXX_USE_ICONV
176 #include <iconv.h> // For codecvt using iconv, iconv_t
177 #endif
178-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
179-#include <libintl.h> // For messages
180+#ifdef HAVE_LIBINTL_H
181+#include <libintl.h> // For messages
182 #endif
183+#include <cstdarg>
184
185 #ifdef __UCLIBC_MJN3_ONLY__
186 #warning what is _GLIBCXX_C_LOCALE_GNU for
187+// psm: used in os/gnu-linux/ctype_noninline.h
188 #endif
189 #define _GLIBCXX_C_LOCALE_GNU 1
190
191@@ -78,23 +80,25 @@ namespace std
192 #else
193 typedef int* __c_locale;
194 #endif
195-
196- // Convert numeric value of type _Tv to string and return length of
197- // string. If snprintf is available use it, otherwise fall back to
198- // the unsafe sprintf which, in general, can be dangerous and should
199+ // Convert numeric value of type double to string and return length of
200+ // string. If vsnprintf is available use it, otherwise fall back to
201+ // the unsafe vsprintf which, in general, can be dangerous and should
202 // be avoided.
203- template<typename _Tv>
204- int
205- __convert_from_v(char* __out,
206- const int __size __attribute__ ((__unused__)),
207- const char* __fmt,
208-#ifdef __UCLIBC_HAS_XCLOCALE__
209- _Tv __v, const __c_locale& __cloc, int __prec)
210+ inline int
211+ __convert_from_v(const __c_locale&
212+#ifndef __UCLIBC_HAS_XCLOCALE__
213+ __cloc __attribute__ ((__unused__))
214+#endif
215+ ,
216+ char* __out,
217+ const int __size,
218+ const char* __fmt, ...)
219 {
220+ va_list __args;
221+#ifdef __UCLIBC_HAS_XCLOCALE__
222+
223 __c_locale __old = __gnu_cxx::__uselocale(__cloc);
224 #else
225- _Tv __v, const __c_locale&, int __prec)
226- {
227 # ifdef __UCLIBC_HAS_LOCALE__
228 char* __old = std::setlocale(LC_ALL, NULL);
229 char* __sav = new char[std::strlen(__old) + 1];
230@@ -103,7 +107,9 @@ namespace std
231 # endif
232 #endif
233
234- const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
235+ va_start(__args, __fmt);
236+ const int __ret = std::vsnprintf(__out, __size, __fmt, __args);
237+ va_end(__args);
238
239 #ifdef __UCLIBC_HAS_XCLOCALE__
240 __gnu_cxx::__uselocale(__old);
241diff --git a/libstdc++-v3/config/locale/uclibc/ctype_members.cc b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
242index 7b12861..13e011d 100644
243--- a/libstdc++-v3/config/locale/uclibc/ctype_members.cc
244+++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
245@@ -33,16 +33,20 @@
246
247 // Written by Benjamin Kosnik <bkoz@redhat.com>
248
249+#include <features.h>
250+#ifdef __UCLIBC_HAS_LOCALE__
251 #define _LIBC
252 #include <locale>
253 #undef _LIBC
254+#else
255+#include <locale>
256+#endif
257 #include <bits/c++locale_internal.h>
258
259-namespace std
260-{
261+_GLIBCXX_BEGIN_NAMESPACE(std)
262+
263 // NB: The other ctype<char> specializations are in src/locale.cc and
264 // various /config/os/* files.
265- template<>
266 ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
267 : ctype<char>(0, false, __refs)
268 {
269@@ -57,6 +61,8 @@ namespace std
270 #endif
271 }
272 }
273+ ctype_byname<char>::~ctype_byname()
274+ { }
275
276 #ifdef _GLIBCXX_USE_WCHAR_T
277 ctype<wchar_t>::__wmask_type
278@@ -138,17 +144,33 @@ namespace std
279 ctype<wchar_t>::
280 do_is(mask __m, wchar_t __c) const
281 {
282- // Highest bitmask in ctype_base == 10, but extra in "C"
283- // library for blank.
284+ // The case of __m == ctype_base::space is particularly important,
285+ // due to its use in many istream functions. Therefore we deal with
286+ // it first, exploiting the knowledge that on GNU systems _M_bit[5]
287+ // is the mask corresponding to ctype_base::space. NB: an encoding
288+ // change would not affect correctness!
289+
290 bool __ret = false;
291- const size_t __bitmasksize = 11;
292- for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
293- if (__m & _M_bit[__bitcur]
294- && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
295- {
296- __ret = true;
297- break;
298- }
299+ if (__m == _M_bit[5])
300+ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
301+ else
302+ {
303+ // Highest bitmask in ctype_base == 10, but extra in "C"
304+ // library for blank.
305+ const size_t __bitmasksize = 11;
306+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
307+ if (__m & _M_bit[__bitcur])
308+ {
309+ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
310+ {
311+ __ret = true;
312+ break;
313+ }
314+ else if (__m == _M_bit[__bitcur])
315+ break;
316+ }
317+ }
318+
319 return __ret;
320 }
321
322@@ -290,4 +312,5 @@ namespace std
323 #endif
324 }
325 #endif // _GLIBCXX_USE_WCHAR_T
326-}
327+
328+_GLIBCXX_END_NAMESPACE
329diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.h b/libstdc++-v3/config/locale/uclibc/messages_members.h
330index d89da33..067657a 100644
331--- a/libstdc++-v3/config/locale/uclibc/messages_members.h
332+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
333@@ -53,12 +53,16 @@
334 template<typename _CharT>
335 messages<_CharT>::messages(__c_locale __cloc, const char* __s,
336 size_t __refs)
337- : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
338- _M_name_messages(__s)
339+ : facet(__refs), _M_c_locale_messages(NULL),
340+ _M_name_messages(NULL)
341 {
342- char* __tmp = new char[std::strlen(__s) + 1];
343- std::strcpy(__tmp, __s);
344+ const size_t __len = std::strlen(__s) + 1;
345+ char* __tmp = new char[__len];
346+ std::memcpy(__tmp, __s, __len);
347 _M_name_messages = __tmp;
348+
349+ // Last to avoid leaking memory if new throws.
350+ _M_c_locale_messages = _S_clone_c_locale(__cloc);
351 }
352
353 template<typename _CharT>
354diff --git a/libstdc++-v3/config/locale/uclibc/monetary_members.cc b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
355index 31ebb9f..7679b9c 100644
356--- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
357+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
358@@ -33,9 +33,14 @@
359
360 // Written by Benjamin Kosnik <bkoz@redhat.com>
361
362+#include <features.h>
363+#ifdef __UCLIBC_HAS_LOCALE__
364 #define _LIBC
365 #include <locale>
366 #undef _LIBC
367+#else
368+#include <locale>
369+#endif
370 #include <bits/c++locale_internal.h>
371
372 #ifdef __UCLIBC_MJN3_ONLY__
373@@ -206,7 +211,7 @@ namespace std
374 }
375 break;
376 default:
377- ;
378+ __ret = pattern();
379 }
380 return __ret;
381 }
382@@ -390,7 +395,9 @@ namespace std
383 __c_locale __old = __uselocale(__cloc);
384 #else
385 // Switch to named locale so that mbsrtowcs will work.
386- char* __old = strdup(setlocale(LC_ALL, NULL));
387+ char* __old = setlocale(LC_ALL, NULL);
388+ const size_t __llen = strlen(__old) + 1;
389+ char* __sav = new char[__llen];
390 setlocale(LC_ALL, __name);
391 #endif
392
393@@ -477,8 +484,8 @@ namespace std
394 #ifdef __UCLIBC_HAS_XLOCALE__
395 __uselocale(__old);
396 #else
397- setlocale(LC_ALL, __old);
398- free(__old);
399+ setlocale(LC_ALL, __sav);
400+ delete [] __sav;
401 #endif
402 __throw_exception_again;
403 }
404@@ -498,8 +505,8 @@ namespace std
405 #ifdef __UCLIBC_HAS_XLOCALE__
406 __uselocale(__old);
407 #else
408- setlocale(LC_ALL, __old);
409- free(__old);
410+ setlocale(LC_ALL, __sav);
411+ delete [] __sav;
412 #endif
413 }
414 }
415@@ -545,8 +552,11 @@ namespace std
416 __c_locale __old = __uselocale(__cloc);
417 #else
418 // Switch to named locale so that mbsrtowcs will work.
419- char* __old = strdup(setlocale(LC_ALL, NULL));
420- setlocale(LC_ALL, __name);
421+ char* __old = setlocale(LC_ALL, NULL);
422+ const size_t __llen = strlen(__old) + 1;
423+ char* __sav = new char[__llen];
424+ memcpy(__sav, __old, __llen);
425+ setlocale(LC_ALL, __name);
426 #endif
427
428 #ifdef __UCLIBC_MJN3_ONLY__
429@@ -633,8 +643,8 @@ namespace std
430 #ifdef __UCLIBC_HAS_XLOCALE__
431 __uselocale(__old);
432 #else
433- setlocale(LC_ALL, __old);
434- free(__old);
435+ setlocale(LC_ALL, __sav);
436+ delete [] __sav;
437 #endif
438 __throw_exception_again;
439 }
440@@ -653,8 +663,8 @@ namespace std
441 #ifdef __UCLIBC_HAS_XLOCALE__
442 __uselocale(__old);
443 #else
444- setlocale(LC_ALL, __old);
445- free(__old);
446+ setlocale(LC_ALL, __sav);
447+ delete [] __sav;
448 #endif
449 }
450 }
451diff --git a/libstdc++-v3/config/locale/uclibc/numeric_members.cc b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
452index d5c8961..8ae8969 100644
453--- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
454+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
455@@ -33,9 +33,14 @@
456
457 // Written by Benjamin Kosnik <bkoz@redhat.com>
458
459+#include <features.h>
460+#ifdef __UCLIBC_HAS_LOCALE__
461 #define _LIBC
462 #include <locale>
463 #undef _LIBC
464+#else
465+#include <locale>
466+#endif
467 #include <bits/c++locale_internal.h>
468
469 #ifdef __UCLIBC_MJN3_ONLY__
470diff --git a/libstdc++-v3/config/locale/uclibc/time_members.cc b/libstdc++-v3/config/locale/uclibc/time_members.cc
471index d848ed5..f24d53e 100644
472--- a/libstdc++-v3/config/locale/uclibc/time_members.cc
473+++ b/libstdc++-v3/config/locale/uclibc/time_members.cc
474@@ -53,11 +53,14 @@ namespace std
475 const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
476 _M_c_locale_timepunct);
477 #else
478- char* __old = strdup(setlocale(LC_ALL, NULL));
479+ char* __old = setlocale(LC_ALL, NULL);
480+ const size_t __llen = strlen(__old) + 1;
481+ char* __sav = new char[__llen];
482+ memcpy(__sav, __old, __llen);
483 setlocale(LC_ALL, _M_name_timepunct);
484 const size_t __len = strftime(__s, __maxlen, __format, __tm);
485- setlocale(LC_ALL, __old);
486- free(__old);
487+ setlocale(LC_ALL, __sav);
488+ delete [] __sav;
489 #endif
490 // Make sure __s is null terminated.
491 if (__len == 0)
492@@ -207,11 +210,14 @@ namespace std
493 const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
494 _M_c_locale_timepunct);
495 #else
496- char* __old = strdup(setlocale(LC_ALL, NULL));
497+ char* __old = setlocale(LC_ALL, NULL);
498+ const size_t __llen = strlen(__old) + 1;
499+ char* __sav = new char[__llen];
500+ memcpy(__sav, __old, __llen);
501 setlocale(LC_ALL, _M_name_timepunct);
502 const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
503- setlocale(LC_ALL, __old);
504- free(__old);
505+ setlocale(LC_ALL, __sav);
506+ delete [] __sav;
507 #endif
508 // Make sure __s is null terminated.
509 if (__len == 0)
510diff --git a/libstdc++-v3/config/locale/uclibc/time_members.h b/libstdc++-v3/config/locale/uclibc/time_members.h
511index ba8e858..1665dde 100644
512--- a/libstdc++-v3/config/locale/uclibc/time_members.h
513+++ b/libstdc++-v3/config/locale/uclibc/time_members.h
514@@ -50,12 +50,21 @@
515 __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
516 size_t __refs)
517 : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
518- _M_name_timepunct(__s)
519+ _M_name_timepunct(NULL)
520 {
521- char* __tmp = new char[std::strlen(__s) + 1];
522- std::strcpy(__tmp, __s);
523+ const size_t __len = std::strlen(__s) + 1;
524+ char* __tmp = new char[__len];
525+ std::memcpy(__tmp, __s, __len);
526 _M_name_timepunct = __tmp;
527- _M_initialize_timepunct(__cloc);
528+
529+ try
530+ { _M_initialize_timepunct(__cloc); }
531+ catch(...)
532+ {
533+ delete [] _M_name_timepunct;
534+ __throw_exception_again;
535+ }
536+
537 }
538
539 template<typename _CharT>
540--
5411.7.10.4
542
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0008-missing-execinfo_h.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0008-missing-execinfo_h.patch
new file mode 100644
index 0000000..2823809
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0008-missing-execinfo_h.patch
@@ -0,0 +1,28 @@
1From 9f2158451981cf0a80cfabdc79ae31bb6976a801 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:48:10 +0400
4Subject: [PATCH 08/35] missing-execinfo_h
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 boehm-gc/include/gc.h | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/boehm-gc/include/gc.h b/boehm-gc/include/gc.h
14index c51e017..a7ba8dc 100644
15--- a/boehm-gc/include/gc.h
16+++ b/boehm-gc/include/gc.h
17@@ -503,7 +503,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
18 #if defined(__linux__) || defined(__GLIBC__)
19 # include <features.h>
20 # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
21- && !defined(__ia64__)
22+ && !defined(__ia64__) && !defined(__UCLIBC__)
23 # ifndef GC_HAVE_BUILTIN_BACKTRACE
24 # define GC_HAVE_BUILTIN_BACKTRACE
25 # endif
26--
271.7.10.4
28
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0009-c99-snprintf.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0009-c99-snprintf.patch
new file mode 100644
index 0000000..7168778
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0009-c99-snprintf.patch
@@ -0,0 +1,28 @@
1From e393e076f1ab82d25e1aa04d6edea27b41d3eb06 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:49:03 +0400
4Subject: [PATCH 09/35] c99-snprintf
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/include/c_std/cstdio | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/libstdc++-v3/include/c_std/cstdio b/libstdc++-v3/include/c_std/cstdio
14index e85bd83..6af839a 100644
15--- a/libstdc++-v3/include/c_std/cstdio
16+++ b/libstdc++-v3/include/c_std/cstdio
17@@ -139,7 +139,7 @@ namespace std
18 using ::vsprintf;
19 } // namespace std
20
21-#if _GLIBCXX_USE_C99
22+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
23
24 #undef snprintf
25 #undef vfscanf
26--
271.7.10.4
28
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0010-c99-complex-ugly-hack.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0010-c99-complex-ugly-hack.patch
new file mode 100644
index 0000000..b628571
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0010-c99-complex-ugly-hack.patch
@@ -0,0 +1,29 @@
1From 73f69d806e2c9561a54995223431a1076cfd6164 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:49:57 +0400
4Subject: [PATCH 10/35] c99-complex-ugly-hack
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Inappropriate [embedded specific]
9---
10 libstdc++-v3/configure | 3 +++
11 1 file changed, 3 insertions(+)
12
13diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
14index c57a751..a1333e2 100755
15--- a/libstdc++-v3/configure
16+++ b/libstdc++-v3/configure
17@@ -18734,6 +18734,9 @@ $as_echo_n "checking for ISO C99 support to TR1 in <complex.h>... " >&6; }
18 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
19 /* end confdefs.h. */
20 #include <complex.h>
21+#ifdef __UCLIBC__
22+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
23+#endif
24 int
25 main ()
26 {
27--
281.7.10.4
29
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0011-index_macro.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0011-index_macro.patch
new file mode 100644
index 0000000..8ee79b0
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0011-index_macro.patch
@@ -0,0 +1,44 @@
1From b037953e40312b45ab84ed0a3ad882bb5e413101 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:51:02 +0400
4Subject: [PATCH 11/35] index_macro
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/include/ext/rope | 3 +++
11 libstdc++-v3/include/ext/ropeimpl.h | 3 +++
12 2 files changed, 6 insertions(+)
13
14diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope
15index 38eb1e8..158d21a 100644
16--- a/libstdc++-v3/include/ext/rope
17+++ b/libstdc++-v3/include/ext/rope
18@@ -55,6 +55,9 @@
19 #include <bits/gthr.h>
20 #include <tr1/functional>
21
22+/* cope w/ index defined as macro, SuSv3 proposal */
23+#undef index
24+
25 # ifdef __GC
26 # define __GC_CONST const
27 # else
28diff --git a/libstdc++-v3/include/ext/ropeimpl.h b/libstdc++-v3/include/ext/ropeimpl.h
29index d7b5cbd..b9b3acb 100644
30--- a/libstdc++-v3/include/ext/ropeimpl.h
31+++ b/libstdc++-v3/include/ext/ropeimpl.h
32@@ -48,6 +48,9 @@
33 #include <ext/memory> // For uninitialized_copy_n
34 #include <ext/numeric> // For power
35
36+/* cope w/ index defined as macro, SuSv3 proposal */
37+#undef index
38+
39 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
40 {
41 _GLIBCXX_BEGIN_NAMESPACE_VERSION
42--
431.7.10.4
44
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0012-libmudflap-susv3-legacy.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0012-libmudflap-susv3-legacy.patch
new file mode 100644
index 0000000..968d45e
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0012-libmudflap-susv3-legacy.patch
@@ -0,0 +1,64 @@
1From a0cb13bdd98a941b81fdafe4cd96e4c569feb651 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:52:36 +0400
4Subject: [PATCH 12/35] libmudflap-susv3-legacy
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Inappropriate [embedded specific]
9---
10 libmudflap/mf-hooks2.c | 10 +++++-----
11 1 file changed, 5 insertions(+), 5 deletions(-)
12
13diff --git a/libmudflap/mf-hooks2.c b/libmudflap/mf-hooks2.c
14index 4af17df..a3c6b2f 100644
15--- a/libmudflap/mf-hooks2.c
16+++ b/libmudflap/mf-hooks2.c
17@@ -424,7 +424,7 @@ WRAPPER2(void, bzero, void *s, size_t n)
18 {
19 TRACE ("%s\n", __PRETTY_FUNCTION__);
20 MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
21- bzero (s, n);
22+ memset (s, 0, n);
23 }
24
25
26@@ -434,7 +434,7 @@ WRAPPER2(void, bcopy, const void *src, void *dest, size_t n)
27 TRACE ("%s\n", __PRETTY_FUNCTION__);
28 MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
29 MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
30- bcopy (src, dest, n);
31+ memmove (dest, src, n);
32 }
33
34
35@@ -444,7 +444,7 @@ WRAPPER2(int, bcmp, const void *s1, const void *s2, size_t n)
36 TRACE ("%s\n", __PRETTY_FUNCTION__);
37 MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
38 MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
39- return bcmp (s1, s2, n);
40+ return n == 0 ? 0 : memcmp (s1, s2, n);
41 }
42
43
44@@ -453,7 +453,7 @@ WRAPPER2(char *, index, const char *s, int c)
45 size_t n = strlen (s);
46 TRACE ("%s\n", __PRETTY_FUNCTION__);
47 MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
48- return index (s, c);
49+ return strchr (s, c);
50 }
51
52
53@@ -462,7 +462,7 @@ WRAPPER2(char *, rindex, const char *s, int c)
54 size_t n = strlen (s);
55 TRACE ("%s\n", __PRETTY_FUNCTION__);
56 MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
57- return rindex (s, c);
58+ return strrchr (s, c);
59 }
60
61 /* XXX: stpcpy, memccpy */
62--
631.7.10.4
64
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0013-libstdc-namespace.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0013-libstdc-namespace.patch
new file mode 100644
index 0000000..4a3efde
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0013-libstdc-namespace.patch
@@ -0,0 +1,54 @@
1From 104e4d66208f2726b14d2f5eebce90700cbc83c8 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:54:02 +0400
4Subject: [PATCH 13/35] libstdc++-namespace
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/config/locale/uclibc/messages_members.h | 4 +++-
11 libstdc++-v3/config/locale/uclibc/time_members.h | 4 +++-
12 2 files changed, 6 insertions(+), 2 deletions(-)
13
14diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.h b/libstdc++-v3/config/locale/uclibc/messages_members.h
15index 067657a..dd76a6c 100644
16--- a/libstdc++-v3/config/locale/uclibc/messages_members.h
17+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
18@@ -32,7 +32,8 @@
19 //
20
21 // Written by Benjamin Kosnik <bkoz@redhat.com>
22-
23+namespace std
24+{
25 #ifdef __UCLIBC_MJN3_ONLY__
26 #warning fix prototypes for *textdomain funcs
27 #endif
28@@ -116,3 +117,4 @@
29 this->_S_create_c_locale(this->_M_c_locale_messages, __s);
30 }
31 }
32+}
33diff --git a/libstdc++-v3/config/locale/uclibc/time_members.h b/libstdc++-v3/config/locale/uclibc/time_members.h
34index 1665dde..905c433 100644
35--- a/libstdc++-v3/config/locale/uclibc/time_members.h
36+++ b/libstdc++-v3/config/locale/uclibc/time_members.h
37@@ -33,7 +33,8 @@
38 //
39
40 // Written by Benjamin Kosnik <bkoz@redhat.com>
41-
42+namespace std
43+{
44 template<typename _CharT>
45 __timepunct<_CharT>::__timepunct(size_t __refs)
46 : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
47@@ -75,3 +76,4 @@
48 delete _M_data;
49 _S_destroy_c_locale(_M_c_locale_timepunct);
50 }
51+}
52--
531.7.10.4
54
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0014-sh-pr24836.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0014-sh-pr24836.patch
new file mode 100644
index 0000000..d74f493
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0014-sh-pr24836.patch
@@ -0,0 +1,29 @@
1From edc9acb181810f234b6b9f7d2820b0e4f6a1eeaf Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:54:48 +0400
4Subject: [PATCH 14/35] sh-pr24836
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9
10http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348
11http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836
12---
13 gcc/configure | 2 +-
14 gcc/configure.ac | 2 +-
15 2 files changed, 2 insertions(+), 2 deletions(-)
16
17Index: gcc-linaro-4.8-2013.10/gcc/configure
18===================================================================
19--- gcc-linaro-4.8-2013.10.orig/gcc/configure 2013-11-05 23:39:39.000000000 -0800
20+++ gcc-linaro-4.8-2013.10/gcc/configure 2013-11-06 15:22:43.000000000 -0800
21@@ -23394,7 +23394,7 @@
22 tls_first_minor=14
23 tls_as_opt="-m64 -Aesame --fatal-warnings"
24 ;;
25- sh-*-* | sh[34]-*-*)
26+ sh-*-* | sh[34]*-*-*)
27 conftest_s='
28 .section ".tdata","awT",@progbits
29 foo: .long 25
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch
new file mode 100644
index 0000000..1081222
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch
@@ -0,0 +1,29 @@
1From 50e5366005b0f6af27378e2a5c3cb9f9936a7e62 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:58:36 +0400
4Subject: [PATCH 15/35] arm: Use TARGET_ENDIAN_OPTION for determining
5 MULTILIB_DEFAULTS
6
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8
9Upstream-Status: Pending
10---
11 gcc/config/arm/linux-elf.h | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
15index 488efa4..753dc3a 100644
16--- a/gcc/config/arm/linux-elf.h
17+++ b/gcc/config/arm/linux-elf.h
18@@ -46,7 +46,7 @@
19
20 #undef MULTILIB_DEFAULTS
21 #define MULTILIB_DEFAULTS \
22- { "marm", "mlittle-endian", "mfloat-abi=hard", "mno-thumb-interwork" }
23+ { "marm", TARGET_ENDIAN_OPTION, "mfloat-abi=hard", "mno-thumb-interwork" }
24
25 /* Now we define the strings used to build the spec file. */
26 #undef LIB_SPEC
27--
281.7.10.4
29
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0016-gcc-poison-system-directories.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0016-gcc-poison-system-directories.patch
new file mode 100644
index 0000000..48e7d40
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0016-gcc-poison-system-directories.patch
@@ -0,0 +1,224 @@
1From 160397ef3c3331099af028f1b8d3e085b07d88ad Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:59:00 +0400
4Subject: [PATCH 16/35] gcc: poison-system-directories
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Inappropriate [distribution: codesourcery]
9---
10 gcc/Makefile.in | 2 +-
11 gcc/common.opt | 4 ++++
12 gcc/config.in | 6 ++++++
13 gcc/configure | 20 ++++++++++++++++++--
14 gcc/configure.ac | 10 ++++++++++
15 gcc/doc/invoke.texi | 9 +++++++++
16 gcc/gcc.c | 2 ++
17 gcc/incpath.c | 19 +++++++++++++++++++
18 8 files changed, 69 insertions(+), 3 deletions(-)
19
20diff --git a/gcc/Makefile.in b/gcc/Makefile.in
21index 54ea04f..90a2bba 100644
22--- a/gcc/Makefile.in
23+++ b/gcc/Makefile.in
24@@ -2018,7 +2018,7 @@ attribs.o : attribs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
25
26 incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
27 intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \
28- $(MACHMODE_H)
29+ $(MACHMODE_H) $(FLAGS_H) toplev.h
30
31 CFLAGS-prefix.o += -DPREFIX=\"$(prefix)\" -DBASEVER=$(BASEVER_s)
32 prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h prefix.h \
33diff --git a/gcc/common.opt b/gcc/common.opt
34index bdbd3b6..ab86b00 100644
35--- a/gcc/common.opt
36+++ b/gcc/common.opt
37@@ -595,6 +595,10 @@ Wpedantic
38 Common Var(pedantic) Warning
39 Issue warnings needed for strict compliance to the standard
40
41+Wpoison-system-directories
42+Common Var(flag_poison_system_directories) Init(1) Warning
43+Warn for -I and -L options using system directories if cross compiling
44+
45 Wshadow
46 Common Var(warn_shadow) Warning
47 Warn when one local variable shadows another
48diff --git a/gcc/config.in b/gcc/config.in
49index d80fb9f..0524af7 100644
50--- a/gcc/config.in
51+++ b/gcc/config.in
52@@ -138,6 +138,12 @@
53 #endif
54
55
56+/* Define to warn for use of native system header directories */
57+#ifndef USED_FOR_TARGET
58+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
59+#endif
60+
61+
62 /* Define if you want all operations on RTL (the basic data structure of the
63 optimizer and back end) to be checked for dynamic type safety at runtime.
64 This is quite expensive. */
65diff --git a/gcc/configure b/gcc/configure
66index 135bbf5..b65d21d 100755
67--- a/gcc/configure
68+++ b/gcc/configure
69@@ -917,6 +917,7 @@ with_gc
70 with_system_zlib
71 enable_maintainer_mode
72 enable_version_specific_runtime_libs
73+enable_poison_system_directories
74 enable_plugin
75 enable_libquadmath_support
76 with_linker_hash_style
77@@ -1630,6 +1631,8 @@ Optional Features:
78 --enable-version-specific-runtime-libs
79 specify that runtime libraries should be installed
80 in a compiler-specific directory
81+ --enable-poison-system-directories
82+ warn for use of native system header directories
83 --enable-plugin enable plugin support
84 --disable-libquadmath-support
85 disable libquadmath support for Fortran
86@@ -17828,7 +17831,7 @@ else
87 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
88 lt_status=$lt_dlunknown
89 cat > conftest.$ac_ext <<_LT_EOF
90-#line 17830 "configure"
91+#line 17834 "configure"
92 #include "confdefs.h"
93
94 #if HAVE_DLFCN_H
95@@ -17934,7 +17937,7 @@ else
96 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
97 lt_status=$lt_dlunknown
98 cat > conftest.$ac_ext <<_LT_EOF
99-#line 17936 "configure"
100+#line 17940 "configure"
101 #include "confdefs.h"
102
103 #if HAVE_DLFCN_H
104@@ -27103,6 +27106,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
105 fi
106
107
108+# Check whether --enable-poison-system-directories was given.
109+if test "${enable_poison_system_directories+set}" = set; then :
110+ enableval=$enable_poison_system_directories;
111+else
112+ enable_poison_system_directories=no
113+fi
114+
115+if test "x${enable_poison_system_directories}" = "xyes"; then
116+
117+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
118+
119+fi
120+
121 # Substitute configuration variables
122
123
124diff --git a/gcc/configure.ac b/gcc/configure.ac
125index 6363a21..e226b85 100644
126--- a/gcc/configure.ac
127+++ b/gcc/configure.ac
128@@ -5063,6 +5063,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
129 [specify that runtime libraries should be
130 installed in a compiler-specific directory])])
131
132+AC_ARG_ENABLE([poison-system-directories],
133+ AS_HELP_STRING([--enable-poison-system-directories],
134+ [warn for use of native system header directories]),,
135+ [enable_poison_system_directories=no])
136+if test "x${enable_poison_system_directories}" = "xyes"; then
137+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
138+ [1],
139+ [Define to warn for use of native system header directories])
140+fi
141+
142 # Substitute configuration variables
143 AC_SUBST(subdirs)
144 AC_SUBST(srcdir)
145diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
146index 9273d7d..a022622 100644
147--- a/gcc/doc/invoke.texi
148+++ b/gcc/doc/invoke.texi
149@@ -258,6 +258,7 @@ Objective-C and Objective-C++ Dialects}.
150 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
151 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
152 -Wpointer-arith -Wno-pointer-to-int-cast @gol
153+-Wno-poison-system-directories @gol
154 -Wredundant-decls -Wno-return-local-addr @gol
155 -Wreturn-type -Wsequence-point -Wshadow @gol
156 -Wsign-compare -Wsign-conversion -Wsizeof-pointer-memaccess @gol
157@@ -4007,6 +4008,14 @@ headers---for that, @option{-Wunknown-pragmas} must also be used.
158 for most targets, it is made up of code and thus requires the stack
159 to be made executable in order for the program to work properly.
160
161+@item -Wno-poison-system-directories
162+@opindex Wno-poison-system-directories
163+Do not warn for @option{-I} or @option{-L} options using system
164+directories such as @file{/usr/include} when cross compiling. This
165+option is intended for use in chroot environments when such
166+directories contain the correct headers and libraries for the target
167+system rather than the host.
168+
169 @item -Wfloat-equal
170 @opindex Wfloat-equal
171 @opindex Wno-float-equal
172diff --git a/gcc/gcc.c b/gcc/gcc.c
173index 86077f8..efdb625 100644
174--- a/gcc/gcc.c
175+++ b/gcc/gcc.c
176@@ -740,6 +740,8 @@ proper position among the other output files. */
177 "%{fuse-ld=*:-fuse-ld=%*}\
178 %X %{o*} %{e*} %{N} %{n} %{r}\
179 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
180+ %{Wno-poison-system-directories:--no-poison-system-directories}\
181+ %{Werror=poison-system-directories:--error-poison-system-directories}\
182 %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\
183 %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
184 %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
185diff --git a/gcc/incpath.c b/gcc/incpath.c
186index 018da98..cd41c78 100644
187--- a/gcc/incpath.c
188+++ b/gcc/incpath.c
189@@ -28,6 +28,7 @@
190 #include "intl.h"
191 #include "incpath.h"
192 #include "cppdefault.h"
193+#include "diagnostic-core.h"
194
195 /* Microsoft Windows does not natively support inodes.
196 VMS has non-numeric inodes. */
197@@ -382,6 +383,24 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
198 }
199 fprintf (stderr, _("End of search list.\n"));
200 }
201+
202+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
203+ if (flag_poison_system_directories)
204+ {
205+ struct cpp_dir *p;
206+
207+ for (p = heads[QUOTE]; p; p = p->next)
208+ {
209+ if ((!strncmp (p->name, "/usr/include", 12))
210+ || (!strncmp (p->name, "/usr/local/include", 18))
211+ || (!strncmp (p->name, "/usr/X11R6/include", 18)))
212+ warning (OPT_Wpoison_system_directories,
213+ "include location \"%s\" is unsafe for "
214+ "cross-compilation",
215+ p->name);
216+ }
217+ }
218+#endif
219 }
220
221 /* Use given -I paths for #include "..." but not #include <...>, and
222--
2231.7.10.4
224
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0017-gcc-poison-dir-extend.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0017-gcc-poison-dir-extend.patch
new file mode 100644
index 0000000..9e81efd
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0017-gcc-poison-dir-extend.patch
@@ -0,0 +1,39 @@
1From e99c9c97266d6d3e8cac798aa91408250c4d60cf Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:00:34 +0400
4Subject: [PATCH 17/35] gcc-poison-dir-extend
5
6Add /sw/include and /opt/include based on the original
7zecke-no-host-includes.patch patch. The original patch checked for
8/usr/include, /sw/include and /opt/include and then triggered a failure and
9aborted.
10
11Instead, we add the two missing items to the current scan. If the user
12wants this to be a failure, they can add "-Werror=poison-system-directories".
13
14Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16
17Upstream-Status: Pending
18---
19 gcc/incpath.c | 4 +++-
20 1 file changed, 3 insertions(+), 1 deletion(-)
21
22diff --git a/gcc/incpath.c b/gcc/incpath.c
23index cd41c78..eac4a92 100644
24--- a/gcc/incpath.c
25+++ b/gcc/incpath.c
26@@ -393,7 +393,9 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
27 {
28 if ((!strncmp (p->name, "/usr/include", 12))
29 || (!strncmp (p->name, "/usr/local/include", 18))
30- || (!strncmp (p->name, "/usr/X11R6/include", 18)))
31+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
32+ || (!strncmp (p->name, "/sw/include", 11))
33+ || (!strncmp (p->name, "/opt/include", 12)))
34 warning (OPT_Wpoison_system_directories,
35 "include location \"%s\" is unsafe for "
36 "cross-compilation",
37--
381.7.10.4
39
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000..a28cafd
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
@@ -0,0 +1,73 @@
1From 56207fa2923e8edf774e98ffac82666091076be3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:08:31 +0400
4Subject: [PATCH 18/35] gcc-4.3.3: SYSROOT_CFLAGS_FOR_TARGET
5
6Before committing, I noticed that PR/32161 was marked as a dup of PR/32009, but my previous patch did not fix it.
7
8This alternative patch is better because it lets you just use CFLAGS_FOR_TARGET to set the compilation flags for libgcc. Since bootstrapped target libraries are never compiled with the native compiler, it makes little sense to use different flags for stage1 and later stages. And it also makes little sense to use a different variable than CFLAGS_FOR_TARGET.
9
10Other changes I had to do include:
11
12- moving the creation of default CFLAGS_FOR_TARGET from Makefile.am to configure.ac, because otherwise the BOOT_CFLAGS are substituted into CFLAGS_FOR_TARGET (which is "-O2 -g $(CFLAGS)") via $(CFLAGS). It is also cleaner this way though.
13
14- passing the right CFLAGS to configure scripts as exported environment variables
15
16I also stopped passing LIBCFLAGS to configure scripts since they are unused in the whole src tree. And I updated the documentation as H-P reminded me to do.
17
18Bootstrapped/regtested i686-pc-linux-gnu, will commit to 4.4 shortly. Ok for 4.3?
19
20Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
21Signed-off-by: Khem Raj <raj.khem@gmail.com>
22
23Upstream-Status: Pending
24---
25 configure | 32 ++++++++++++++++++++++++++++++++
26 1 file changed, 32 insertions(+)
27
28diff --git a/configure b/configure
29index 1b76c90..e4dce7c 100755
30--- a/configure
31+++ b/configure
32@@ -6772,6 +6772,38 @@ fi
33
34
35
36+# During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
37+# might be empty or "-g". We don't require a C++ compiler, so CXXFLAGS
38+# might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
39+# We want to ensure that TARGET libraries (which we know are built with
40+# gcc) are built with "-O2 -g", so include those options when setting
41+# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
42+if test "x$CFLAGS_FOR_TARGET" = x; then
43+ CFLAGS_FOR_TARGET=$CFLAGS
44+ case " $CFLAGS " in
45+ *" -O2 "*) ;;
46+ *) CFLAGS_FOR_TARGET="-O2 $CFLAGS" ;;
47+ esac
48+ case " $CFLAGS " in
49+ *" -g "* | *" -g3 "*) ;;
50+ *) CFLAGS_FOR_TARGET="-g $CFLAGS" ;;
51+ esac
52+fi
53+
54+
55+if test "x$CXXFLAGS_FOR_TARGET" = x; then
56+ CXXFLAGS_FOR_TARGET=$CXXFLAGS
57+ case " $CXXFLAGS " in
58+ *" -O2 "*) ;;
59+ *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS" ;;
60+ esac
61+ case " $CXXFLAGS " in
62+ *" -g "* | *" -g3 "*) ;;
63+ *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS" ;;
64+ esac
65+fi
66+
67+
68 # Handle --with-headers=XXX. If the value is not "yes", the contents of
69 # the named directory are copied to $(tooldir)/sys-include.
70 if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
71--
721.7.10.4
73
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0019-64-bit-multilib-hack.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0019-64-bit-multilib-hack.patch
new file mode 100644
index 0000000..51f4dba
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0019-64-bit-multilib-hack.patch
@@ -0,0 +1,82 @@
1From 18fde5740b09324dfb9cf41e9849672573ff5fa0 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:10:06 +0400
4Subject: [PATCH 19/35] 64-bit multilib hack.
5
6GCC has internal multilib handling code but it assumes a very specific rigid directory
7layout. The build system implementation of multilib layout is very generic and allows
8complete customisation of the library directories.
9
10This patch is a partial solution to allow any custom directories to be passed into gcc
11and handled correctly. It forces gcc to use the base_libdir (which is the current
12directory, "."). We need to do this for each multilib that is configured as we don't
13know which compiler options may be being passed into the compiler. Since we have a compiler
14per mulitlib at this point that isn't an issue.
15
16The one problem is the target compiler is only going to work for the default multlilib at
17this point. Ideally we'd figure out which multilibs were being enabled with which paths
18and be able to patch these entries with a complete set of correct paths but this we
19don't have such code at this point. This is something the target gcc recipe should do
20and override these platform defaults in its build config.
21
22RP 15/8/11
23
24Signed-off-by: Khem Raj <raj.khem@gmail.com>
25Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>
26
27Upstream-Status: Pending
28---
29 gcc/config/i386/t-linux64 | 6 ++----
30 gcc/config/mips/t-linux64 | 10 +++-------
31 gcc/config/rs6000/t-linux64 | 5 ++---
32 3 files changed, 7 insertions(+), 14 deletions(-)
33
34diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
35index bcea0c6..eb004d7 100644
36--- a/gcc/config/i386/t-linux64
37+++ b/gcc/config/i386/t-linux64
38@@ -32,7 +32,5 @@
39 #
40 comma=,
41 MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
42-MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
43-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
44-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
45-MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
46+MULTILIB_DIRNAMES = . .
47+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
48diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64
49index bdbbd4f..16a6366 100644
50--- a/gcc/config/mips/t-linux64
51+++ b/gcc/config/mips/t-linux64
52@@ -17,10 +17,6 @@
53 # <http://www.gnu.org/licenses/>.
54
55 MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
56-MULTILIB_DIRNAMES = n32 32 64
57-MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
58-MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
59-MULTILIB_OSDIRNAMES = \
60- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
61- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
62- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
63+MULTILIB_DIRNAMES = . . .
64+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
65+
66diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
67index 9175de2..3971019 100644
68--- a/gcc/config/rs6000/t-linux64
69+++ b/gcc/config/rs6000/t-linux64
70@@ -26,7 +26,6 @@
71 # MULTILIB_OSDIRNAMES according to what is found on the target.
72
73 MULTILIB_OPTIONS = m64/m32
74-MULTILIB_DIRNAMES = 64 32
75+MULTILIB_DIRNAMES = . .
76 MULTILIB_EXTRA_OPTS = fPIC
77-MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:powerpc64-linux-gnu)
78-MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
79+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
80--
811.7.10.4
82
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0020-optional-libstdc.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0020-optional-libstdc.patch
new file mode 100644
index 0000000..eff021e
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0020-optional-libstdc.patch
@@ -0,0 +1,102 @@
1From 307c8ff3ef666b7bd5ac733863f2fbb27a9d521e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:12:56 +0400
4Subject: [PATCH 20/35] optional libstdc
5
6gcc-runtime builds libstdc++ separately from gcc-cross-*. Its configure tests using g++
7will not run correctly since by default the linker will try to link against libstdc++
8which shouldn't exist yet. We need an option to disable -lstdc++
9option whilst leaving -lc, -lgcc and other automatic library dependencies added by gcc
10driver. This patch adds such an option which only disables the -lstdc++.
11
12A "standard" gcc build uses xgcc and hence avoids this. We should ask upstream how to
13do this officially, the likely answer is don't build libstdc++ separately.
14
15RP 29/6/10
16
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18
19Upstream-Status: Inappropriate [embedded specific]
20---
21 gcc/c-family/c.opt | 4 ++++
22 gcc/cp/g++spec.c | 1 +
23 gcc/doc/invoke.texi | 9 +++++++--
24 gcc/gcc.c | 1 +
25 4 files changed, 13 insertions(+), 2 deletions(-)
26
27diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
28index 10ae84d..dc3ffdf 100644
29--- a/gcc/c-family/c.opt
30+++ b/gcc/c-family/c.opt
31@@ -1299,6 +1299,10 @@ nostdinc++
32 C++ ObjC++
33 Do not search standard system include directories for C++
34
35+nostdlib++
36+Driver
37+Do not link standard C++ runtime library
38+
39 o
40 C ObjC C++ ObjC++ Joined Separate
41 ; Documented in common.opt
42diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c
43index b896eea..f55216b 100644
44--- a/gcc/cp/g++spec.c
45+++ b/gcc/cp/g++spec.c
46@@ -126,6 +126,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
47 switch (decoded_options[i].opt_index)
48 {
49 case OPT_nostdlib:
50+ case OPT_nostdlib__:
51 case OPT_nodefaultlibs:
52 library = -1;
53 break;
54diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
55index a022622..f15c991 100644
56--- a/gcc/doc/invoke.texi
57+++ b/gcc/doc/invoke.texi
58@@ -190,7 +190,7 @@ in the following sections.
59 -frepo -fno-rtti -fstats -ftemplate-backtrace-limit=@var{n} @gol
60 -ftemplate-depth=@var{n} @gol
61 -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
62--fno-default-inline -fvisibility-inlines-hidden @gol
63+-nostdlib++ -fno-default-inline -fvisibility-inlines-hidden @gol
64 -fvisibility-ms-compat @gol
65 -fext-numeric-literals @gol
66 -Wabi -Wconversion-null -Wctor-dtor-privacy @gol
67@@ -453,7 +453,7 @@ Objective-C and Objective-C++ Dialects}.
68 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
69 -s -static -static-libgcc -static-libstdc++ @gol
70 -static-libasan -static-libtsan @gol
71--shared -shared-libgcc -symbolic @gol
72+-shared -shared-libgcc -symbolic -nostdlib++ @gol
73 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
74 -u @var{symbol}}
75
76@@ -9886,6 +9886,11 @@ These entries are usually resolved by entries in
77 libc. These entry points should be supplied through some other
78 mechanism when this option is specified.
79
80+@item -nostdlib++
81+@opindex nostdlib++
82+Do not use the standard system C++ runtime libraries when linking.
83+Only the libraries you specify will be passed to the linker.
84+
85 @cindex @option{-lgcc}, use with @option{-nostdlib}
86 @cindex @option{-nostdlib} and unresolved references
87 @cindex unresolved references and @option{-nostdlib}
88diff --git a/gcc/gcc.c b/gcc/gcc.c
89index efdb625..477752f 100644
90--- a/gcc/gcc.c
91+++ b/gcc/gcc.c
92@@ -748,6 +748,7 @@ proper position among the other output files. */
93 %(mflib) " STACK_SPLIT_SPEC "\
94 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \
95 %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
96+ %{!nostdlib++:}\
97 %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
98 #endif
99
100--
1011.7.10.4
102
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch
new file mode 100644
index 0000000..eb3c61f
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch
@@ -0,0 +1,59 @@
1From 004696e054ae9dc71d512cc755ccc4074fc62b2d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:14:20 +0400
4Subject: [PATCH 21/35] gcc: disable MASK_RELAX_PIC_CALLS bit
5
6The new feature added after 4.3.3
7"http://www.pubbs.net/200909/gcc/94048-patch-add-support-for-rmipsjalr.html"
8will cause cc1plus eat up all the system memory when build webkit-gtk.
9The function mips_get_pic_call_symbol keeps on recursively calling itself.
10Disable this feature to walk aside the bug.
11
12Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14
15Upstream-Status: Inappropriate [configuration]
16---
17 gcc/configure | 7 -------
18 gcc/configure.ac | 7 -------
19 2 files changed, 14 deletions(-)
20
21diff --git a/gcc/configure b/gcc/configure
22index b65d21d..bdab45a 100755
23--- a/gcc/configure
24+++ b/gcc/configure
25@@ -25829,13 +25829,6 @@ $as_echo_n "checking assembler and linker for explicit JALR relocation... " >&6;
26 rm -f conftest.*
27 fi
28 fi
29- if test $gcc_cv_as_ld_jalr_reloc = yes; then
30- if test x$target_cpu_default = x; then
31- target_cpu_default=MASK_RELAX_PIC_CALLS
32- else
33- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
34- fi
35- fi
36 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_ld_jalr_reloc" >&5
37 $as_echo "$gcc_cv_as_ld_jalr_reloc" >&6; }
38
39diff --git a/gcc/configure.ac b/gcc/configure.ac
40index e226b85..5f5c909 100644
41--- a/gcc/configure.ac
42+++ b/gcc/configure.ac
43@@ -4099,13 +4099,6 @@ x:
44 rm -f conftest.*
45 fi
46 fi
47- if test $gcc_cv_as_ld_jalr_reloc = yes; then
48- if test x$target_cpu_default = x; then
49- target_cpu_default=MASK_RELAX_PIC_CALLS
50- else
51- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
52- fi
53- fi
54 AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc)
55
56 AC_CACHE_CHECK([linker for .eh_frame personality relaxation],
57--
581.7.10.4
59
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0022-COLLECT_GCC_OPTIONS.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0022-COLLECT_GCC_OPTIONS.patch
new file mode 100644
index 0000000..40c8abf
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0022-COLLECT_GCC_OPTIONS.patch
@@ -0,0 +1,38 @@
1From 7f5c9dcc71c8b83a0b5596266cc4bdf0936e8e00 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:16:28 +0400
4Subject: [PATCH 22/35] COLLECT_GCC_OPTIONS
5
6This patch adds --sysroot into COLLECT_GCC_OPTIONS which is used to
7invoke collect2.
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11Upstream-Status: Pending
12---
13 gcc/gcc.c | 9 +++++++++
14 1 file changed, 9 insertions(+)
15
16diff --git a/gcc/gcc.c b/gcc/gcc.c
17index 477752f..51062aa 100644
18--- a/gcc/gcc.c
19+++ b/gcc/gcc.c
20@@ -4098,6 +4098,15 @@ set_collect_gcc_options (void)
21 sizeof ("COLLECT_GCC_OPTIONS=") - 1);
22
23 first_time = TRUE;
24+#ifdef HAVE_LD_SYSROOT
25+ if (target_system_root_changed && target_system_root)
26+ {
27+ obstack_grow (&collect_obstack, "'--sysroot=", sizeof("'--sysroot=")-1);
28+ obstack_grow (&collect_obstack, target_system_root,strlen(target_system_root));
29+ obstack_grow (&collect_obstack, "'", 1);
30+ first_time = FALSE;
31+ }
32+#endif
33 for (i = 0; (int) i < n_switches; i++)
34 {
35 const char *const *args;
36--
371.7.10.4
38
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
new file mode 100644
index 0000000..9e4435c
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
@@ -0,0 +1,88 @@
1From 46d52439052f0876a92dcf8a0ab9c60d75c8030b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:17:25 +0400
4Subject: [PATCH 23/35] Use the defaults.h in ${B} instead of ${S}, and t-oe
5 in ${B}
6
7Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}, so that
8the source can be shared between gcc-cross-initial,
9gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13Upstream-Status: Pending
14---
15 gcc/Makefile.in | 2 +-
16 gcc/configure | 4 ++--
17 gcc/configure.ac | 4 ++--
18 gcc/mkconfig.sh | 4 ++--
19 4 files changed, 7 insertions(+), 7 deletions(-)
20
21diff --git a/gcc/Makefile.in b/gcc/Makefile.in
22index 90a2bba..2320497 100644
23--- a/gcc/Makefile.in
24+++ b/gcc/Makefile.in
25@@ -469,7 +469,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
26 TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
27
28 xmake_file=@xmake_file@
29-tmake_file=@tmake_file@
30+tmake_file=@tmake_file@ ./t-oe
31 TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@
32 TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
33 TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
34diff --git a/gcc/configure b/gcc/configure
35index bdab45a..d587993 100755
36--- a/gcc/configure
37+++ b/gcc/configure
38@@ -11539,8 +11539,8 @@ for f in $tm_file; do
39 tm_include_list="${tm_include_list} $f"
40 ;;
41 defaults.h )
42- tm_file_list="${tm_file_list} \$(srcdir)/$f"
43- tm_include_list="${tm_include_list} $f"
44+ tm_file_list="${tm_file_list} ./$f"
45+ tm_include_list="${tm_include_list} ./$f"
46 ;;
47 * )
48 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
49diff --git a/gcc/configure.ac b/gcc/configure.ac
50index 5f5c909..5e5e84f 100644
51--- a/gcc/configure.ac
52+++ b/gcc/configure.ac
53@@ -1720,8 +1720,8 @@ for f in $tm_file; do
54 tm_include_list="${tm_include_list} $f"
55 ;;
56 defaults.h )
57- tm_file_list="${tm_file_list} \$(srcdir)/$f"
58- tm_include_list="${tm_include_list} $f"
59+ tm_file_list="${tm_file_list} ./$f"
60+ tm_include_list="${tm_include_list} ./$f"
61 ;;
62 * )
63 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
64diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh
65index 29fdfc7..e048dce 100644
66--- a/gcc/mkconfig.sh
67+++ b/gcc/mkconfig.sh
68@@ -77,7 +77,7 @@ if [ -n "$HEADERS" ]; then
69 if [ $# -ge 1 ]; then
70 echo '#ifdef IN_GCC' >> ${output}T
71 for file in "$@"; do
72- if test x"$file" = x"defaults.h"; then
73+ if test x"$file" = x"./defaults.h"; then
74 postpone_defaults_h="yes"
75 else
76 echo "# include \"$file\"" >> ${output}T
77@@ -103,7 +103,7 @@ esac
78
79 # If we postponed including defaults.h, add the #include now.
80 if test x"$postpone_defaults_h" = x"yes"; then
81- echo "# include \"defaults.h\"" >> ${output}T
82+ echo "# include \"./defaults.h\"" >> ${output}T
83 fi
84
85 # Add multiple inclusion protection guard, part two.
86--
871.7.10.4
88
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0024-PR-target-32219.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0024-PR-target-32219.patch
new file mode 100644
index 0000000..b47d841
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0024-PR-target-32219.patch
@@ -0,0 +1,67 @@
1From e0d15f4f8bf28c351b9215ca37f1caa24df0e1fd Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:18:54 +0400
4Subject: [PATCH 24/35] PR target/32219
5
6* varasm.c (default_binds_local_p_1): Weak data is not local.
7
8Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11Upstream-Status: Backport
12---
13 gcc/testsuite/gcc.dg/visibility-21.c | 14 ++++++++++++++
14 gcc/varasm.c | 9 ++++-----
15 2 files changed, 18 insertions(+), 5 deletions(-)
16 create mode 100644 gcc/testsuite/gcc.dg/visibility-21.c
17
18diff --git a/gcc/testsuite/gcc.dg/visibility-21.c b/gcc/testsuite/gcc.dg/visibility-21.c
19new file mode 100644
20index 0000000..be7deda
21--- /dev/null
22+++ b/gcc/testsuite/gcc.dg/visibility-21.c
23@@ -0,0 +1,14 @@
24+/* PR target/32219 */
25+/* { dg-do run } */
26+/* { dg-require-visibility "" } */
27+/* { dg-options "-fPIC" { target fpic } } */
28+
29+extern void f() __attribute__((weak,visibility("hidden")));
30+extern int puts( char const* );
31+int main()
32+{
33+ if (f)
34+ f();
35+ return 0;
36+}
37+
38diff --git a/gcc/varasm.c b/gcc/varasm.c
39index 6648103..fadba78 100644
40--- a/gcc/varasm.c
41+++ b/gcc/varasm.c
42@@ -6675,6 +6675,10 @@ default_binds_local_p_1 (const_tree exp, int shlib)
43 /* Static variables are always local. */
44 else if (! TREE_PUBLIC (exp))
45 local_p = true;
46+ /* hidden weak can't be overridden by something non-local, all
47+ that is possible is that it is not defined at all. */
48+ else if (DECL_WEAK (exp))
49+ local_p = false;
50 /* A variable is local if the user has said explicitly that it will
51 be. */
52 else if ((DECL_VISIBILITY_SPECIFIED (exp)
53@@ -6688,11 +6692,6 @@ default_binds_local_p_1 (const_tree exp, int shlib)
54 local. */
55 else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
56 local_p = true;
57- /* Default visibility weak data can be overridden by a strong symbol
58- in another module and so are not local. */
59- else if (DECL_WEAK (exp)
60- && !resolved_locally)
61- local_p = false;
62 /* If PIC, then assume that any global name can be overridden by
63 symbols resolved from other modules. */
64 else if (shlib)
65--
661.7.10.4
67
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0025-fortran-cross-compile-hack.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0025-fortran-cross-compile-hack.patch
new file mode 100644
index 0000000..0e7914d
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0025-fortran-cross-compile-hack.patch
@@ -0,0 +1,46 @@
1From af8a56ea4e17b2909eff2c57704ab43ef24f28d3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:20:01 +0400
4Subject: [PATCH 25/35] fortran cross-compile hack.
5
6* Fortran would have searched for arm-angstrom-gnueabi-gfortran but would have used
7used gfortan. For gcc_4.2.2.bb we want to use the gfortran compiler from our cross
8directory.
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11
12Upstream-Status: Inappropriate [embedded specific]
13---
14 libgfortran/configure | 2 +-
15 libgfortran/configure.ac | 2 +-
16 2 files changed, 2 insertions(+), 2 deletions(-)
17
18diff --git a/libgfortran/configure b/libgfortran/configure
19index 8385e96..b8f7a92 100755
20--- a/libgfortran/configure
21+++ b/libgfortran/configure
22@@ -12704,7 +12704,7 @@ esac
23
24 # We need gfortran to compile parts of the library
25 #AC_PROG_FC(gfortran)
26-FC="$GFORTRAN"
27+#FC="$GFORTRAN"
28 ac_ext=${ac_fc_srcext-f}
29 ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
30 ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
31diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
32index 7d97fed..3f9f484 100644
33--- a/libgfortran/configure.ac
34+++ b/libgfortran/configure.ac
35@@ -227,7 +227,7 @@ AC_SUBST(enable_static)
36
37 # We need gfortran to compile parts of the library
38 #AC_PROG_FC(gfortran)
39-FC="$GFORTRAN"
40+#FC="$GFORTRAN"
41 AC_PROG_FC(gfortran)
42
43 # extra LD Flags which are required for targets
44--
451.7.10.4
46
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0026-libgcc-sjlj-check.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0026-libgcc-sjlj-check.patch
new file mode 100644
index 0000000..d4efab9
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0026-libgcc-sjlj-check.patch
@@ -0,0 +1,74 @@
1From 08c2398445e6cac282488f64ae6bf29cbcd8db23 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:20:50 +0400
4Subject: [PATCH 26/35] libgcc-sjlj-check
5
6ac_fn_c_try_compile doesnt seem to keep the intermediate files
7which are needed for sjlj test to pass since it greps into the
8generated file. So we run the compiler command using AC_TRY_COMMAND
9which then generates the needed .s file
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13Upstream-Status: Pending
14---
15 libgcc/configure | 10 ++++++----
16 libgcc/configure.ac | 10 ++++------
17 2 files changed, 10 insertions(+), 10 deletions(-)
18
19diff --git a/libgcc/configure b/libgcc/configure
20index 1425df6..d18e3cb 100644
21--- a/libgcc/configure
22+++ b/libgcc/configure
23@@ -4208,17 +4208,19 @@ void foo ()
24 }
25
26 _ACEOF
27-CFLAGS_hold=$CFLAGS
28-CFLAGS="--save-temps -fexceptions"
29 libgcc_cv_lib_sjlj_exceptions=unknown
30-if ac_fn_c_try_compile; then :
31+if { ac_try='${CC-cc} -fexceptions -S conftest.c -o conftest.s 1>&5'
32+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
33+ (eval $ac_try) 2>&5
34+ ac_status=$?
35+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
36+ test $ac_status = 0; }; }; then
37 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
38 libgcc_cv_lib_sjlj_exceptions=yes
39 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1; then
40 libgcc_cv_lib_sjlj_exceptions=no
41 fi
42 fi
43-CFLAGS=$CFLAGS_hold
44 rm -f conftest*
45
46 fi
47diff --git a/libgcc/configure.ac b/libgcc/configure.ac
48index 8b7aba5..c7c9644 100644
49--- a/libgcc/configure.ac
50+++ b/libgcc/configure.ac
51@@ -216,16 +216,14 @@ void foo ()
52 bar();
53 }
54 ])])
55-CFLAGS_hold=$CFLAGS
56-CFLAGS="--save-temps -fexceptions"
57 libgcc_cv_lib_sjlj_exceptions=unknown
58-AS_IF([ac_fn_c_try_compile],
59- [if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
60+if AC_TRY_COMMAND(${CC-cc} -fexceptions -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
61+ if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
62 libgcc_cv_lib_sjlj_exceptions=yes
63 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1; then
64 libgcc_cv_lib_sjlj_exceptions=no
65- fi])
66-CFLAGS=$CFLAGS_hold
67+ fi
68+fi
69 rm -f conftest*
70 ])
71
72--
731.7.10.4
74
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0027-cpp-honor-sysroot.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0027-cpp-honor-sysroot.patch
new file mode 100644
index 0000000..05e9521
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0027-cpp-honor-sysroot.patch
@@ -0,0 +1,54 @@
1From a0f9bd09c816ad29ecf7c29d6c27f7df97710364 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:22:00 +0400
4Subject: [PATCH 27/35] cpp: honor sysroot.
5
6Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile
7preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location
8rather than the --sysroot option specified on the commandline. If access to that directory is
9permission denied (unreadable), gcc will error.
10
11This happens when ccache is in use due to the fact it uses preprocessed source files.
12
13The fix below adds %I to the cpp-output spec macro so the default substitutions for -iprefix,
14-isystem, -isysroot happen and the correct sysroot is used.
15
16[YOCTO #2074]
17
18RP 2012/04/13
19
20Signed-off-by: Khem Raj <raj.khem@gmail.com>
21
22Upstream-Status: Pending
23---
24 gcc/cp/lang-specs.h | 2 +-
25 gcc/gcc.c | 2 +-
26 2 files changed, 2 insertions(+), 2 deletions(-)
27
28diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
29index a001c3e..1aae1e4 100644
30--- a/gcc/cp/lang-specs.h
31+++ b/gcc/cp/lang-specs.h
32@@ -63,5 +63,5 @@ along with GCC; see the file COPYING3. If not see
33 {".ii", "@c++-cpp-output", 0, 0, 0},
34 {"@c++-cpp-output",
35 "%{!M:%{!MM:%{!E:\
36- cc1plus -fpreprocessed %i %(cc1_options) %2\
37+ cc1plus -fpreprocessed %i %I %(cc1_options) %2\
38 %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
39diff --git a/gcc/gcc.c b/gcc/gcc.c
40index 51062aa..cf6b99e 100644
41--- a/gcc/gcc.c
42+++ b/gcc/gcc.c
43@@ -1042,7 +1042,7 @@ static const struct compiler default_compilers[] =
44 %W{o*:--output-pch=%*}}%V}}}}}}", 0, 0, 0},
45 {".i", "@cpp-output", 0, 0, 0},
46 {"@cpp-output",
47- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
48+ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
49 {".s", "@assembler", 0, 0, 0},
50 {"@assembler",
51 "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
52--
531.7.10.4
54
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0028-MIPS64-Default-to-N64-ABI.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0028-MIPS64-Default-to-N64-ABI.patch
new file mode 100644
index 0000000..2638720
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0028-MIPS64-Default-to-N64-ABI.patch
@@ -0,0 +1,31 @@
1From 301e18d4711db5925e767fad08dffa9cfe0a2f1f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:23:08 +0400
4Subject: [PATCH 28/35] MIPS64: Default to N64 ABI
5
6MIPS64 defaults to n32 ABI, this patch makes it
7so that it defaults to N64 ABI
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11Upstream-Status: Inappropriate [OE config specific]
12---
13 gcc/config.gcc | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-)
15
16diff --git a/gcc/config.gcc b/gcc/config.gcc
17index 1a0be50..989c2fb 100644
18--- a/gcc/config.gcc
19+++ b/gcc/config.gcc
20@@ -1797,7 +1797,7 @@ mips*-mti-linux*)
21 mips64*-*-linux* | mipsisa64*-*-linux*)
22 tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h mips/linux-common.h"
23 tmake_file="${tmake_file} mips/t-linux64"
24- tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32"
25+ tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_64"
26 case ${target} in
27 mips64el-st-linux-gnu)
28 tm_file="${tm_file} mips/st.h"
29--
301.7.10.4
31
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
new file mode 100644
index 0000000..0e8fffc
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
@@ -0,0 +1,190 @@
1From 29d12344fb682a053de53eb08b95704cf3b67af2 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:24:50 +0400
4Subject: [PATCH 29/35] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
5 relative to SYSTEMLIBS_DIR
6
7This patch defines GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
8relative to SYSTEMLIBS_DIR which can be set in generated headers
9This breaks the assumption of hardcoded multilib in gcc
10Change is only for the supported architectures in OE including
11SH, sparc, alpha for possible future support (if any)
12
13Removes the do_headerfix task in metadata
14
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16
17Upstream-Status: Inappropriate [OE configuration]
18---
19 gcc/config/alpha/linux-elf.h | 4 ++--
20 gcc/config/arm/linux-eabi.h | 4 ++--
21 gcc/config/arm/linux-elf.h | 2 +-
22 gcc/config/i386/linux.h | 2 +-
23 gcc/config/i386/linux64.h | 6 +++---
24 gcc/config/mips/linux.h | 2 +-
25 gcc/config/mips/linux64.h | 8 ++++----
26 gcc/config/rs6000/linux64.h | 8 ++++----
27 gcc/config/sh/linux.h | 2 +-
28 gcc/config/sparc/linux.h | 2 +-
29 gcc/config/sparc/linux64.h | 4 ++--
30 11 files changed, 22 insertions(+), 22 deletions(-)
31
32diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
33index 84e0596..3a59d71 100644
34--- a/gcc/config/alpha/linux-elf.h
35+++ b/gcc/config/alpha/linux-elf.h
36@@ -23,8 +23,8 @@ along with GCC; see the file COPYING3. If not see
37 #define EXTRA_SPECS \
38 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
39
40-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
41-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
42+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
43+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
44 #if DEFAULT_LIBC == LIBC_UCLIBC
45 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
46 #elif DEFAULT_LIBC == LIBC_GLIBC
47diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
48index 4a425c8..80f454d 100644
49--- a/gcc/config/arm/linux-eabi.h
50+++ b/gcc/config/arm/linux-eabi.h
51@@ -68,8 +68,8 @@
52 GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
53
54 #undef GLIBC_DYNAMIC_LINKER
55-#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
56-#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
57+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT SYSTEMLIBS_DIR "ld-linux.so.3"
58+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT SYSTEMLIBS_DIR "ld-linux-armhf.so.3"
59 #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
60
61 #define GLIBC_DYNAMIC_LINKER \
62diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
63index 753dc3a..d593967 100644
64--- a/gcc/config/arm/linux-elf.h
65+++ b/gcc/config/arm/linux-elf.h
66@@ -57,7 +57,7 @@
67
68 #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
69
70-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
71+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
72
73 #define LINUX_TARGET_LINK_SPEC "%{h*} \
74 %{static:-Bstatic} \
75diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
76index 3c95ee0..33b8acd 100644
77--- a/gcc/config/i386/linux.h
78+++ b/gcc/config/i386/linux.h
79@@ -20,4 +20,4 @@ along with GCC; see the file COPYING3. If not see
80 <http://www.gnu.org/licenses/>. */
81
82 #define GNU_USER_LINK_EMULATION "elf_i386"
83-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
84+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
85diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
86index b793e08..da788b8 100644
87--- a/gcc/config/i386/linux64.h
88+++ b/gcc/config/i386/linux64.h
89@@ -27,6 +27,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
90 #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
91 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
92
93-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
94-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
95-#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
96+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
97+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
98+#define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
99diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
100index 9b4c68d..7ee5ba8 100644
101--- a/gcc/config/mips/linux.h
102+++ b/gcc/config/mips/linux.h
103@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
104 along with GCC; see the file COPYING3. If not see
105 <http://www.gnu.org/licenses/>. */
106
107-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
108+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld.so.1"
109diff --git a/gcc/config/mips/linux64.h b/gcc/config/mips/linux64.h
110index dbba47a..c7ed573 100644
111--- a/gcc/config/mips/linux64.h
112+++ b/gcc/config/mips/linux64.h
113@@ -22,10 +22,10 @@ along with GCC; see the file COPYING3. If not see
114 #define GNU_USER_LINK_EMULATION64 "elf64%{EB:b}%{EL:l}tsmip"
115 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
116
117-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
118-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld.so.1"
119-#define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
120-#define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
121+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
122+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld.so.1"
123+#define GLIBC_DYNAMIC_LINKERN32 SYSTEMLIBS_DIR "ld.so.1"
124+#define UCLIBC_DYNAMIC_LINKERN32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
125 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
126 #define GNU_USER_DYNAMIC_LINKERN32 \
127 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
128diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
129index dc6f67f..bc60769 100644
130--- a/gcc/config/rs6000/linux64.h
131+++ b/gcc/config/rs6000/linux64.h
132@@ -360,10 +360,10 @@ extern int dot_symbols;
133 #undef LINK_OS_DEFAULT_SPEC
134 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
135
136-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
137-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
138-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
139-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
140+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
141+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64.so.1"
142+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
143+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
144 #if DEFAULT_LIBC == LIBC_UCLIBC
145 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
146 #elif DEFAULT_LIBC == LIBC_GLIBC
147diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
148index 9e8f32d..86bf81e 100644
149--- a/gcc/config/sh/linux.h
150+++ b/gcc/config/sh/linux.h
151@@ -43,7 +43,7 @@ along with GCC; see the file COPYING3. If not see
152
153 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
154
155-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
156+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
157
158 #undef SUBTARGET_LINK_EMUL_SUFFIX
159 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
160diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
161index 49283d3..6f0b03a 100644
162--- a/gcc/config/sparc/linux.h
163+++ b/gcc/config/sparc/linux.h
164@@ -83,7 +83,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
165 When the -shared link option is used a final link is not being
166 done. */
167
168-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
169+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
170
171 #undef LINK_SPEC
172 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
173diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
174index 7d48e96..b01993f 100644
175--- a/gcc/config/sparc/linux64.h
176+++ b/gcc/config/sparc/linux64.h
177@@ -92,8 +92,8 @@ along with GCC; see the file COPYING3. If not see
178 When the -shared link option is used a final link is not being
179 done. */
180
181-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
182-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
183+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
184+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux.so.2"
185
186 #ifdef SPARC_BI_ARCH
187
188--
1891.7.10.4
190
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0030-gcc-Fix-argument-list-too-long-error.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0030-gcc-Fix-argument-list-too-long-error.patch
new file mode 100644
index 0000000..2ceaff6
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0030-gcc-Fix-argument-list-too-long-error.patch
@@ -0,0 +1,40 @@
1From c1816c160156f99c34e6a0a0311bb0219326804e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:26:37 +0400
4Subject: [PATCH 30/35] gcc: Fix argument list too long error.
5
6There would be an "Argument list too long" error when the
7build directory is longer than 200, this is caused by:
8
9headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`
10
11The PLUGIN_HEADERS is too long before sort, so the "echo" can't handle
12it, use the $(sort list) of GNU make which can handle the too long list
13would fix the problem, the header would be short enough after sorted.
14The "tr ' ' '\012'" was used for translating the space to "\n", the
15$(sort list) doesn't need this.
16
17Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19
20Upstream-Status: Pending
21---
22 gcc/Makefile.in | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25diff --git a/gcc/Makefile.in b/gcc/Makefile.in
26index 2320497..8562a62 100644
27--- a/gcc/Makefile.in
28+++ b/gcc/Makefile.in
29@@ -4627,7 +4627,7 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
30 # We keep the directory structure for files in config or c-family and .def
31 # files. All other files are flattened to a single directory.
32 $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
33- headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`; \
34+ headers="$(sort $(PLUGIN_HEADERS))"; \
35 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
36 for file in $$headers; do \
37 if [ -f $$file ] ; then \
38--
391.7.10.4
40
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0031-Disable-sdt.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0031-Disable-sdt.patch
new file mode 100644
index 0000000..c714239
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0031-Disable-sdt.patch
@@ -0,0 +1,45 @@
1From eb70cb2785af7171897f363298bbfcd83de5ec57 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:28:10 +0400
4Subject: [PATCH 31/35] Disable sdt.
5
6We don't list dtrace in DEPENDS so we shouldn't be depending on this header.
7It may or may not exist from preivous builds though. To be determinstic, disable
8sdt.h usage always. This avoids build failures if the header is removed after configure
9but before libgcc is compiled for example.
10
11RP 2012/8/7
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14
15Upstream-Status: Inappropriate [hack]
16---
17 gcc/configure | 12 ++++++------
18 1 file changed, 6 insertions(+), 6 deletions(-)
19
20diff --git a/gcc/configure b/gcc/configure
21index d587993..8bc0c98 100755
22--- a/gcc/configure
23+++ b/gcc/configure
24@@ -26792,12 +26792,12 @@ fi
25 { $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
26 $as_echo_n "checking sys/sdt.h in the target C library... " >&6; }
27 have_sys_sdt_h=no
28-if test -f $target_header_dir/sys/sdt.h; then
29- have_sys_sdt_h=yes
30-
31-$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
32-
33-fi
34+#if test -f $target_header_dir/sys/sdt.h; then
35+# have_sys_sdt_h=yes
36+#
37+#$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
38+#
39+#fi
40 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5
41 $as_echo "$have_sys_sdt_h" >&6; }
42
43--
441.7.10.4
45
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0032-libtool.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0032-libtool.patch
new file mode 100644
index 0000000..3b3d1b6
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0032-libtool.patch
@@ -0,0 +1,42 @@
1From 6c715fcfa262adadca81c68a1f3f69aa3187a501 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:29:11 +0400
4Subject: [PATCH 32/35] libtool
5
6libstdc++ from gcc-runtime gets created with -rpath=/usr/lib/../lib for qemux86-64
7when running on am x86_64 build host.
8
9This patch stops this speading to libdir in the libstdc++.la file within libtool.
10Arguably, it shouldn't be passing this into libtool in the first place but
11for now this resolves the nastiest problems this causes.
12
13func_normal_abspath would resolve an empty path to `pwd` so we need
14to filter the zero case.
15
16RP 2012/8/24
17
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19
20Upstream-Status: Pending
21---
22 ltmain.sh | 4 ++++
23 1 file changed, 4 insertions(+)
24
25diff --git a/ltmain.sh b/ltmain.sh
26index a03433f..46f47c2 100644
27--- a/ltmain.sh
28+++ b/ltmain.sh
29@@ -6359,6 +6359,10 @@ func_mode_link ()
30 func_warning "ignoring multiple \`-rpath's for a libtool library"
31
32 install_libdir="$1"
33+ if test -n "$install_libdir"; then
34+ func_normal_abspath "$install_libdir"
35+ install_libdir=$func_normal_abspath_result
36+ fi
37
38 oldlibs=
39 if test -z "$rpath"; then
40--
411.7.10.4
42
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
new file mode 100644
index 0000000..199984d
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
@@ -0,0 +1,43 @@
1From 97e4591c20310425e7aca0e6712a8d9480e7744c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:30:32 +0400
4Subject: [PATCH 33/35] gcc: armv4: pass fix-v4bx to linker to support EABI.
5
6The LINK_SPEC for linux gets overwritten by linux-eabi.h which
7means the value of TARGET_FIX_V4BX_SPEC gets lost and as a result
8the option is not passed to linker when chosing march=armv4
9This patch redefines this in linux-eabi.h and reinserts it
10for eabi defaulting toolchains.
11
12We might want to send it upstream.
13
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15
16Upstream-Status: Pending
17---
18 gcc/config/arm/linux-eabi.h | 6 +++++-
19 1 file changed, 5 insertions(+), 1 deletion(-)
20
21diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
22index 80f454d..4db3eb9 100644
23--- a/gcc/config/arm/linux-eabi.h
24+++ b/gcc/config/arm/linux-eabi.h
25@@ -77,10 +77,14 @@
26 %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
27 %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
28
29+/* For armv4 we pass --fix-v4bx to linker to support EABI */
30+#undef TARGET_FIX_V4BX_SPEC
31+#define TARGET_FIX_V4BX_SPEC "%{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4: --fix-v4bx}"
32+
33 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
34 use the GNU/Linux version, not the generic BPABI version. */
35 #undef LINK_SPEC
36-#define LINK_SPEC BE8_LINK_SPEC \
37+#define LINK_SPEC BE8_LINK_SPEC TARGET_FIX_V4BX_SPEC \
38 LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
39 LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
40
41--
421.7.10.4
43
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch
new file mode 100644
index 0000000..66b9f89
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch
@@ -0,0 +1,102 @@
1From fc5e4beaea856a2b486c770ad3addc0f5bb3100e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:33:04 +0400
4Subject: [PATCH 34/35] Use the multilib config files from ${B} instead of
5 using the ones from ${S}
6
7Use the multilib config files from ${B} instead of using the ones from ${S}
8so that the source can be shared between gcc-cross-initial,
9gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
13
14Upstream-Status: Inappropriate [configuration]
15---
16 gcc/configure | 22 ++++++++++++++++++----
17 gcc/configure.ac | 22 ++++++++++++++++++----
18 2 files changed, 36 insertions(+), 8 deletions(-)
19
20diff --git a/gcc/configure b/gcc/configure
21index 8bc0c98..3cd0817 100755
22--- a/gcc/configure
23+++ b/gcc/configure
24@@ -11519,10 +11519,20 @@ done
25 tmake_file_=
26 for f in ${tmake_file}
27 do
28- if test -f ${srcdir}/config/$f
29- then
30- tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
31- fi
32+ case $f in
33+ */t-linux64 )
34+ if test -f ./config/$f
35+ then
36+ tmake_file_="${tmake_file_} ./config/$f"
37+ fi
38+ ;;
39+ * )
40+ if test -f ${srcdir}/config/$f
41+ then
42+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
43+ fi
44+ ;;
45+ esac
46 done
47 tmake_file="${tmake_file_}"
48
49@@ -11533,6 +11543,10 @@ tm_file_list="options.h"
50 tm_include_list="options.h insn-constants.h"
51 for f in $tm_file; do
52 case $f in
53+ */linux64.h )
54+ tm_file_list="${tm_file_list} ./config/$f"
55+ tm_include_list="${tm_include_list} ./config/$f"
56+ ;;
57 ./* )
58 f=`echo $f | sed 's/^..//'`
59 tm_file_list="${tm_file_list} $f"
60diff --git a/gcc/configure.ac b/gcc/configure.ac
61index 5e5e84f..415a6df 100644
62--- a/gcc/configure.ac
63+++ b/gcc/configure.ac
64@@ -1700,10 +1700,20 @@ done
65 tmake_file_=
66 for f in ${tmake_file}
67 do
68- if test -f ${srcdir}/config/$f
69- then
70- tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
71- fi
72+ case $f in
73+ */t-linux64 )
74+ if test -f ./config/$f
75+ then
76+ tmake_file_="${tmake_file_} ./config/$f"
77+ fi
78+ ;;
79+ * )
80+ if test -f ${srcdir}/config/$f
81+ then
82+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
83+ fi
84+ ;;
85+ esac
86 done
87 tmake_file="${tmake_file_}"
88
89@@ -1714,6 +1724,10 @@ tm_file_list="options.h"
90 tm_include_list="options.h insn-constants.h"
91 for f in $tm_file; do
92 case $f in
93+ */linux64.h )
94+ tm_file_list="${tm_file_list} ./config/$f"
95+ tm_include_list="${tm_include_list} ./config/$f"
96+ ;;
97 ./* )
98 f=`echo $f | sed 's/^..//'`
99 tm_file_list="${tm_file_list} $f"
100--
1011.7.10.4
102
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0035-wcast-qual-PR-55383.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0035-wcast-qual-PR-55383.patch
new file mode 100644
index 0000000..be4cf4a
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0035-wcast-qual-PR-55383.patch
@@ -0,0 +1,55 @@
1From deffdb0b2497a106061d3ea2c6a3fef4fba3445e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:39:51 +0400
4Subject: [PATCH 35/35] wcast-qual PR/55383
5
6This is a backport from gcc bugzilla
7
8http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55383
9
10This commit fixes a wrong warning behavior. This bug which has no
11workaround other than disabling the warning.
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14
15Upstream-Status: Backport
16---
17 gcc/c/c-typeck.c | 2 +-
18 gcc/testsuite/c-c++-common/Wcast-qual-1.c | 6 +++---
19 2 files changed, 4 insertions(+), 4 deletions(-)
20
21diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
22index ddb6d39..c624120 100644
23--- a/gcc/c/c-typeck.c
24+++ b/gcc/c/c-typeck.c
25@@ -4464,7 +4464,7 @@ handle_warn_cast_qual (location_t loc, tree type, tree otype)
26 /* There are qualifiers present in IN_OTYPE that are not present
27 in IN_TYPE. */
28 warning_at (loc, OPT_Wcast_qual,
29- "cast discards %q#v qualifier from pointer target type",
30+ "cast discards %qv qualifier from pointer target type",
31 discarded);
32
33 if (added || discarded)
34diff --git a/gcc/testsuite/c-c++-common/Wcast-qual-1.c b/gcc/testsuite/c-c++-common/Wcast-qual-1.c
35index 640e4f0..56382c7 100644
36--- a/gcc/testsuite/c-c++-common/Wcast-qual-1.c
37+++ b/gcc/testsuite/c-c++-common/Wcast-qual-1.c
38@@ -85,11 +85,11 @@ f3 (void ***bar)
39 void
40 f4 (void * const **bar)
41 {
42- const void ***p9 = (const void ***) bar; /* { dg-warning "cast" } */
43+ const void ***p9 = (const void ***) bar; /* { dg-warning "cast discards .const. qualifier" } */
44 void * const **p11 = (void * const **) bar;
45- void ** const *p13 = (void ** const *) bar; /* { dg-warning "cast" } */
46+ void ** const *p13 = (void ** const *) bar; /* { dg-warning "cast discards .const. qualifier" } */
47 const void * const **p15 = (const void * const **) bar; /* { dg-warning "cast" } */
48- const void ** const *p17 = (const void ** const *) bar; /* { dg-warning "cast" } */
49+ const void ** const *p17 = (const void ** const *) bar; /* { dg-warning "cast discards .const. qualifier" } */
50 void * const * const * p19 = (void * const * const *) bar;
51 const void * const * const *p21 = (const void * const * const *) bar;
52 }
53--
541.7.10.4
55
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0037-gcc-4.8-PR56797.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0037-gcc-4.8-PR56797.patch
new file mode 100644
index 0000000..b5d7b86
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0037-gcc-4.8-PR56797.patch
@@ -0,0 +1,66 @@
1Upstream-Status: Backport
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4From patchwork Fri Apr 19 09:34:49 2013
5Content-Type: text/plain; charset="utf-8"
6MIME-Version: 1.0
7Content-Transfer-Encoding: 7bit
8Subject: [ARM] Fix PR56797
9Date: Thu, 18 Apr 2013 23:34:49 -0000
10From: Greta Yorsh <Greta.Yorsh@arm.com>
11X-Patchwork-Id: 237891
12Message-Id: <000801ce3ce1$23fbdd60$6bf39820$@yorsh@arm.com>
13To: "GCC Patches" <gcc-patches@gcc.gnu.org>
14Cc: <raj.khem@gmail.com>, "Richard Earnshaw" <Richard.Earnshaw@arm.com>,
15 "Ramana Radhakrishnan" <Ramana.Radhakrishnan@arm.com>
16
17Fix PR56797
18http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56797
19
20The problem is that peephole optimizer thinks it can generate an ldm, but
21the pattern for ldm no longer matches, because after r188738 it requires
22that if one of the destination registers is SP then the base register must
23be SP, and it's not SP in the test case.
24
25The test case fails on armv5t but doesn't fail on armv6t2 or armv7-a because
26peephole doesn't trigger there (because there is a different epilogue
27sequence). It looks like a latent problem for other architecture or CPUs.
28
29This patch adds this condition to the peephole optimizer.
30
31No regression on qemu for arm-none-eabi and fixes the test reported in the
32PR. I couldn't minimize the test sufficiently to include it in the
33testsuite.
34
35Ok for trunk?
36
37Thanks,
38Greta
39
40gcc/
41
422013-04-18 Greta Yorsh <Greta.Yorsh@arm.com>
43
44 PR target/56797
45 * config/arm/arm.c (load_multiple_sequence): Require SP
46 as base register for loads if SP is in the register list.
47
48
49diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
50index d00849c..60fef78 100644
51--- a/gcc/config/arm/arm.c
52+++ b/gcc/config/arm/arm.c
53@@ -10347,6 +10347,13 @@ load_multiple_sequence (rtx *operands, int nops, int *regs, int *saved_order,
54 || (i != nops - 1 && unsorted_regs[i] == base_reg))
55 return 0;
56
57+ /* Don't allow SP to be loaded unless it is also the base
58+ register. It guarantees that SP is reset correctly when
59+ an LDM instruction is interruptted. Otherwise, we might
60+ end up with a corrupt stack. */
61+ if (unsorted_regs[i] == SP_REGNUM && base_reg != SP_REGNUM)
62+ return 0;
63+
64 unsorted_offsets[i] = INTVAL (offset);
65 if (i == 0 || unsorted_offsets[i] < unsorted_offsets[order[0]])
66 order[0] = i;
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0038-gcc-4.8-build-args.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0038-gcc-4.8-build-args.patch
new file mode 100644
index 0000000..c27e009
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0038-gcc-4.8-build-args.patch
@@ -0,0 +1,41 @@
1When cross compiling a target gcc, target flags may be used on the host
2
3Configure identifies a number of warning flags (WARN_CFLAGS and
4WARN_CXXFLAGS) from the $CC value. The cross compiler may be different
5from the host compiler and may not support the same set of flags. This
6leads to problems such as:
7
8cc1plus: error: unrecognized command line option "-Wno-narrowing"
9cc1plus: error: unrecognized command line option "-Wno-overlength-strings"
10
11Work around this problem by removing the warning flags from the
12BUILD_CXXFLAGS value, in a way similar to the BUILD_CFLAGS.
13
14Upstream-Status: Pending
15
16Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
17
18Index: gcc-4.8.0/gcc/configure
19===================================================================
20--- gcc-4.8.0.orig/gcc/configure
21+++ gcc-4.8.0/gcc/configure
22@@ -11720,6 +10581,7 @@ STMP_FIXINC=stmp-fixinc
23 if test x$build != x$host || test "x$coverage_flags" != x
24 then
25 BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
26+ BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
27 BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
28 fi
29
30Index: gcc-4.8.0/gcc/configure.ac
31===================================================================
32--- gcc-4.8.0.orig/gcc/configure.ac
33+++ gcc-4.8.0/gcc/configure.ac
34@@ -1901,6 +1901,7 @@ STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_F
35 if test x$build != x$host || test "x$coverage_flags" != x
36 then
37 BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
38+ BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
39 BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
40 fi
41
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0039-gcc-4.8-PR57717.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0039-gcc-4.8-PR57717.patch
new file mode 100644
index 0000000..f983f70
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0039-gcc-4.8-PR57717.patch
@@ -0,0 +1,23 @@
1This backports fix from http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57717
2
3Upstream-Status: Backport
4Signed-off-by: Khem Raj <raj.khem@gmail.com>
5
6Index: gcc-4.8.1/gcc/config/rs6000/rs6000.c
7===================================================================
8--- gcc-4.8.1.orig/gcc/config/rs6000/rs6000.c 2013-05-09 18:54:06.000000000 -0700
9+++ gcc-4.8.1/gcc/config/rs6000/rs6000.c 2013-06-27 08:22:40.459021366 -0700
10@@ -5431,11 +5431,12 @@
11
12 case TFmode:
13 case TDmode:
14- case TImode:
15 if (TARGET_E500_DOUBLE)
16 return (SPE_CONST_OFFSET_OK (offset)
17 && SPE_CONST_OFFSET_OK (offset + 8));
18+ /* Fall through. */
19
20+ case TImode:
21 extra = 8;
22 if (!worst_case)
23 break;
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0040-fix-g++-sysroot.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0040-fix-g++-sysroot.patch
new file mode 100644
index 0000000..d50aa5c
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0040-fix-g++-sysroot.patch
@@ -0,0 +1,40 @@
1Portions of
2
3http://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg26013.html
4
5are not upstreamed yet. So lets keep missing pieces.
6
7Upstream-Status: Pending
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11Index: gcc-4.8.1/gcc/configure.ac
12===================================================================
13--- gcc-4.8.1.orig/gcc/configure.ac 2013-07-15 15:55:49.488399132 -0700
14+++ gcc-4.8.1/gcc/configure.ac 2013-07-15 16:02:31.772406679 -0700
15@@ -148,7 +148,9 @@
16 if test "${with_sysroot+set}" = set; then
17 gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
18 if test "${gcc_gxx_without_sysroot}"; then
19- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
20+ if test x${with_sysroot} != x/; then
21+ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
22+ fi
23 gcc_gxx_include_dir_add_sysroot=1
24 fi
25 fi
26Index: gcc-4.8.1/gcc/configure
27===================================================================
28--- gcc-4.8.1.orig/gcc/configure 2013-07-15 15:55:49.472399132 -0700
29+++ gcc-4.8.1/gcc/configure 2013-07-15 16:02:31.780406680 -0700
30@@ -3325,7 +3325,9 @@
31 if test "${with_sysroot+set}" = set; then
32 gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
33 if test "${gcc_gxx_without_sysroot}"; then
34- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
35+ if test x${with_sysroot} != x/; then
36+ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
37+ fi
38 gcc_gxx_include_dir_add_sysroot=1
39 fi
40 fi
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0041-libtool-avoid-libdir.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0041-libtool-avoid-libdir.patch
new file mode 100644
index 0000000..2dd9610
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0041-libtool-avoid-libdir.patch
@@ -0,0 +1,19 @@
1Avoid using libdir from .la which usually points to a host path
2
3Upstream-Status: Inappropriate [embedded specific]
4Signed-off-by: Jonathan Liu <net147@gmail.com>
5
6diff --git a/ltmain.sh b/ltmain.sh
7index a03433f..1902a90 100644
8--- a/ltmain.sh
9+++ b/ltmain.sh
10@@ -5628,6 +5628,9 @@ func_mode_link ()
11 absdir="$abs_ladir"
12 libdir="$abs_ladir"
13 else
14+ # Instead of using libdir from .la which usually points to a host path,
15+ # use the path the .la is contained in.
16+ libdir="$abs_ladir"
17 dir="$libdir"
18 absdir="$libdir"
19 fi
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0042-pr57748.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0042-pr57748.patch
new file mode 100644
index 0000000..5356f72
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0042-pr57748.patch
@@ -0,0 +1,78 @@
1Upstream-Status: Backport
2Signed-off-by: Khem Raj
3
42013-08-01 Martin Jambor <mjambor@suse.cz>
5
6 PR middle-end/57748
7 * stor-layout.c (compute_record_mode): Treat zero-sized array fields
8 like incomplete types.
9
10testsuite/
11 * gcc.dg/torture/pr57748.c: New test.
12
13
14Index: gcc-4.8.1/gcc/stor-layout.c
15===================================================================
16--- gcc-4.8.1.orig/gcc/stor-layout.c 2013-04-28 10:29:18.000000000 -0700
17+++ gcc-4.8.1/gcc/stor-layout.c 2013-08-01 15:02:08.018006125 -0700
18@@ -1618,7 +1618,9 @@
19 && integer_zerop (TYPE_SIZE (TREE_TYPE (field)))))
20 || ! host_integerp (bit_position (field), 1)
21 || DECL_SIZE (field) == 0
22- || ! host_integerp (DECL_SIZE (field), 1))
23+ || ! host_integerp (DECL_SIZE (field), 1)
24+ || (TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE
25+ && tree_low_cst (DECL_SIZE (field), 1) == 0))
26 return;
27
28 /* If this field is the whole struct, remember its mode so
29Index: gcc-4.8.1/gcc/testsuite/gcc.dg/torture/pr57748.c
30===================================================================
31--- /dev/null 1970-01-01 00:00:00.000000000 +0000
32+++ gcc-4.8.1/gcc/testsuite/gcc.dg/torture/pr57748.c 2013-08-01 15:02:08.062006126 -0700
33@@ -0,0 +1,45 @@
34+/* PR middle-end/57748 */
35+/* { dg-do run } */
36+
37+#include <stdlib.h>
38+
39+extern void abort (void);
40+
41+typedef long long V
42+ __attribute__ ((vector_size (2 * sizeof (long long)), may_alias));
43+
44+typedef struct S { V a; V b[0]; } P __attribute__((aligned (1)));
45+
46+struct __attribute__((packed)) T { char c; P s; };
47+
48+void __attribute__((noinline, noclone))
49+check (struct T *t)
50+{
51+ if (t->s.b[0][0] != 3 || t->s.b[0][1] != 4)
52+ abort ();
53+}
54+
55+int __attribute__((noinline, noclone))
56+get_i (void)
57+{
58+ return 0;
59+}
60+
61+void __attribute__((noinline, noclone))
62+foo (P *p)
63+{
64+ V a = { 3, 4 };
65+ int i = get_i();
66+ p->b[i] = a;
67+}
68+
69+int
70+main ()
71+{
72+ struct T *t = (struct T *) malloc (128);
73+
74+ foo (&t->s);
75+ check (t);
76+
77+ return 0;
78+}
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0043-cpp.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0043-cpp.patch
new file mode 100644
index 0000000..eaf8646
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0043-cpp.patch
@@ -0,0 +1,40 @@
1The OE environment sets and exports CPP as being the target gcc. When building
2gcc-cross-canadian for a mingw targetted sdk, the following can be found in
3build.x86_64-pokysdk-mingw32.i586-poky-linux/build-x86_64-linux/libiberty/config.log:
4
5configure:3641: checking for _FILE_OFFSET_BITS value needed for large files
6configure:3666: gcc -c -isystem/media/build1/poky/build/tmp/sysroots/x86_64-linux/usr/include -O2 -pipe conftest.c >&5
7configure:3666: $? = 0
8configure:3698: result: no
9configure:3786: checking how to run the C preprocessor
10configure:3856: result: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32
11configure:3876: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32 conftest.c
12configure:3876: $? = 0
13
14Note this is a *build* target (in build-x86_64-linux) so it should be using
15the host "gcc", not x86_64-pokysdk-mingw32-gcc. Since the mingw32 headers are
16very different, using the wrong cpp is a real problem. It is leaking into
17configure through the CPP variable. Ultimately this leads to build failures
18related to not being able to include a process.h file for pem-unix.c.
19
20The fix is to ensure we export a sane CPP value into the build environment when
21using build targets. We could define a CPP_FOR_BUILD value which may be the version
22which needs to be upstreamed but for now, this fix is good enough to avoid the
23problem.
24
25RP 22/08/2013
26
27Upstream-Status: Pending
28
29Index: gcc-4.8.1/Makefile.in
30===================================================================
31--- gcc-4.8.1.orig/Makefile.in 2013-03-30 11:25:03.000000000 +0000
32+++ gcc-4.8.1/Makefile.in 2013-08-13 12:03:17.151988882 +0000
33@@ -149,6 +149,7 @@
34 AR="$(AR_FOR_BUILD)"; export AR; \
35 AS="$(AS_FOR_BUILD)"; export AS; \
36 CC="$(CC_FOR_BUILD)"; export CC; \
37+ CPP="$(CC_FOR_BUILD) -E"; export CPP; \
38 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
39 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
40 CXX="$(CXX_FOR_BUILD)"; export CXX; \
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0044-gengtypes.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0044-gengtypes.patch
new file mode 100644
index 0000000..e38761d
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0044-gengtypes.patch
@@ -0,0 +1,97 @@
1gengtype is generated for both the build system and the target. -DGENERATOR_FILE
2was added in the patch http://gcc.gnu.org/ml/gcc-patches/2012-07/msg00273.html
3and was applied to both versions of gengtype.
4
5Unfortunately the presence of this flag triggers the build configuration (bconfig.h)
6to be included for the target build of gengtype. Compiling gengtype with the target
7compiler and bconfig.h can result in errors if the build and target systems are
8dissimilar. An example case this fails is cross compiling gcc on linux for a darwin
9target system:
10
11In file included from /media/build1/poky/build/tmp/work-shared/gcc-4.8.1-r0/gcc-4.8.1/gcc/gengtype-parse.c:25:0:
12| /media/build1/poky/build/tmp/work-shared/gcc-4.8.1-r0/gcc-4.8.1/gcc/gengtype-parse.c: In function 'void parse_error(const char*, ...)':
13| /media/build1/poky/build/tmp/work-shared/gcc-4.8.1-r0/gcc-4.8.1/gcc/system.h:93:53: error: 'fputc_unlocked' was not declared in this scope
14| # define fputc(C, Stream) fputc_unlocked (C, Stream)
15
16which occurs since auto-build.h and auto-host.h have differnet values of
17HAVE_FPUTC_UNLOCKED:
18
19#define HAVE_FPUTC_UNLOCKED 1
20/* #undef HAVE_FPUTS_UNLOCKED */
21
22The obvious fix is to only include the flag on build/ targets which this patch does, however
23this also leads to compile errors due to const_tree being undefined but used in double_int.h
24
25I added a GENERATOR_FILE2 flag to workaround those in the
26target case and allow the build to succeed.
27
28Only the build/gengtypes should have the -DGENERATOR_FILE
29
30RP 22/8/2013
31
32Upstream-Status: Pending
33
34Index: gcc-4.8.1/gcc/Makefile.in
35===================================================================
36--- gcc-4.8.1.orig/gcc/Makefile.in 2013-08-19 11:40:36.844014424 +0000
37+++ gcc-4.8.1/gcc/Makefile.in 2013-08-19 11:40:37.784014402 +0000
38@@ -3903,27 +3903,29 @@
39
40 gengtype-lex.o build/gengtype-lex.o : gengtype-lex.c gengtype.h $(SYSTEM_H)
41 gengtype-lex.o: $(CONFIG_H) $(BCONFIG_H)
42-CFLAGS-gengtype-lex.o += -DGENERATOR_FILE
43+CFLAGS-build/gengtype-lex.o += -DGENERATOR_FILE
44 build/gengtype-lex.o: $(BCONFIG_H)
45
46 gengtype-parse.o build/gengtype-parse.o : gengtype-parse.c gengtype.h \
47 $(SYSTEM_H)
48 gengtype-parse.o: $(CONFIG_H)
49-CFLAGS-gengtype-parse.o += -DGENERATOR_FILE
50+CFLAGS-build/gengtype-parse.o += -DGENERATOR_FILE
51 build/gengtype-parse.o: $(BCONFIG_H)
52
53 gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \
54 gengtype.h errors.h double-int.h version.h $(HASHTAB_H) $(OBSTACK_H) \
55 $(XREGEX_H)
56 gengtype-state.o: $(CONFIG_H)
57-CFLAGS-gengtype-state.o += -DGENERATOR_FILE
58+CFLAGS-gengtype-state.o += -DGENERATOR_FILE2
59+CFLAGS-build/gengtype-state.o += -DGENERATOR_FILE
60 build/gengtype-state.o: $(BCONFIG_H)
61
62 gengtype.o build/gengtype.o : gengtype.c $(SYSTEM_H) gengtype.h \
63 rtl.def insn-notes.def errors.h double-int.h version.h $(HASHTAB_H) \
64 $(OBSTACK_H) $(XREGEX_H)
65 gengtype.o: $(CONFIG_H)
66-CFLAGS-gengtype.o += -DGENERATOR_FILE
67+CFLAGS-gengtype.o += -DGENERATOR_FILE2
68+CFLAGS-build/gengtype.o += -DGENERATOR_FILE
69 build/gengtype.o: $(BCONFIG_H)
70
71 build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
72@@ -3988,7 +3990,7 @@
73 # any system header is included.
74 gengtype-lex.c : gengtype-lex.l
75 -$(FLEX) $(FLEXFLAGS) -o$@ $< && { \
76- echo '#include "bconfig.h"' > $@.tmp; \
77+ echo '' > $@.tmp; \
78 cat $@ >> $@.tmp; \
79 mv $@.tmp $@; \
80 }
81Index: gcc-4.8.1/gcc/double-int.h
82===================================================================
83--- gcc-4.8.1.orig/gcc/double-int.h 2013-01-30 11:04:30.000000000 +0000
84+++ gcc-4.8.1/gcc/double-int.h 2013-08-19 11:41:51.564012719 +0000
85@@ -448,10 +448,12 @@
86
87
88 #ifndef GENERATOR_FILE
89+#ifndef GENERATOR_FILE2
90 /* Conversion to and from GMP integer representations. */
91
92 void mpz_set_double_int (mpz_t, double_int, bool);
93 double_int mpz_get_double_int (const_tree, mpz_t, bool);
94 #endif
95+#endif
96
97 #endif /* DOUBLE_INT_H */
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0045-gcc-4.8-PR57717-PowerPC-E500v2.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0045-gcc-4.8-PR57717-PowerPC-E500v2.patch
new file mode 100644
index 0000000..96fa1da
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0045-gcc-4.8-PR57717-PowerPC-E500v2.patch
@@ -0,0 +1,21 @@
1This backports fix from http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57717
2
3Upstream-Status: Backport
4Signed-off-by: Julian Brown <Julian_Brown@mentor.com>
5
6fix for PR57717 (PowerPC E500v2)
7http://gcc.gnu.org/ml/gcc-patches/2013-08/msg00668.html
8
9--- a/gcc/config/rs6000/rs6000.c 2013-05-09 20:54:06.000000000 -0500
10+++ b/gcc/config/rs6000/rs6000.c 2013-08-28 01:25:24.865218744 -0500
11@@ -6337,9 +6337,7 @@
12 && GET_CODE (XEXP (x, 1)) == CONST_INT
13 && reg_offset_p
14 && !SPE_VECTOR_MODE (mode)
15- && !(TARGET_E500_DOUBLE && (mode == DFmode || mode == TFmode
16- || mode == DDmode || mode == TDmode
17- || mode == DImode))
18+ && !(TARGET_E500_DOUBLE && GET_MODE_SIZE (mode) > UNITS_PER_WORD)
19 && VECTOR_MEM_NONE_P (mode))
20 {
21 HOST_WIDE_INT val = INTVAL (XEXP (x, 1));
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0046-libatomic-deptracking.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0046-libatomic-deptracking.patch
new file mode 100644
index 0000000..6ea4f42
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0046-libatomic-deptracking.patch
@@ -0,0 +1,41 @@
1gcc 4.8 won't build with --disable-dependency-tracking since the *.Ppo files
2don't get created unless --enable-dependency-tracking is true.
3
4This patch ensures we only use those compiler options when its enabled.
5
6Upstream-Status: Submitted
7
8(Problem was already reported upstream, attached this patch there
9http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55930)
10
11RP
122012/09/22
13
14Index: gcc-4.8.1/libatomic/Makefile.am
15===================================================================
16--- gcc-4.8.1.orig/libatomic/Makefile.am 2013-01-14 18:16:23.000000000 +0000
17+++ gcc-4.8.1/libatomic/Makefile.am 2013-09-22 10:38:18.904064750 +0000
18@@ -100,7 +100,8 @@
19 IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
20 IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
21
22-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
23+@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
24+@AMDEP_FALSE@M_DEPS =
25 M_SIZE = -DN=$(PAT_N)
26 M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
27 M_FILE = $(PAT_BASE)_n.c
28Index: gcc-4.8.1/libatomic/Makefile.in
29===================================================================
30--- gcc-4.8.1.orig/libatomic/Makefile.in 2013-05-31 09:09:26.000000000 +0000
31+++ gcc-4.8.1/libatomic/Makefile.in 2013-09-22 10:40:42.520059917 +0000
32@@ -298,7 +298,8 @@
33 PAT_S = $(word 3,$(PAT_SPLIT))
34 IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
35 IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
36-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
37+@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
38+@AMDEP_FALSE@M_DEPS =
39 M_SIZE = -DN=$(PAT_N)
40 M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
41 M_FILE = $(PAT_BASE)_n.c
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0047-repomembug.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0047-repomembug.patch
new file mode 100644
index 0000000..868a4f3
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0047-repomembug.patch
@@ -0,0 +1,53 @@
1When compiling a project using -frepo, .rpo files are written alongside
2the .o file, the symbols either have O or C against them. During final linking,
3the objects can be recompiled with some of the entries tweaked/chosen by the
4tlink.c code (visible with TLINK_VERBOSE=3), it does this by changing O -> C
5in the .rpo files.
6
7My tests showed that init_repo (cp/repo.c) was correctly calling
8IDENTIFIER_REPO_CHOSEN against the right identifers and setting the
9chosen bit.
10
11By the time finish_repo() or emit_repo_p() were called, the pointer returned
12by get_identifier() for the symbol marked during init_repo had changed and
13the chosen bit was no longer set. This lead to linking bugs like:
14
15collect: relinking
16collect2: error: '_ZNK6sudoku5ClearINS_8SequenceEEclERS1_' was assigned to 'board.rpo', but was not defined during recompilation, or vice versa
17
18The problem is that the garbage collection is getting called before
19finish_repo() is called and ggc_protect_identifiers is set to false
20so the identifiers are not preserved. They are recreated but the
21chosen bits get wiped out which is why the pointer changes and the
22chosen bit is not set.
23
24The fix is to change ggc_protect_identifiers *after* the finish_repo
25calls are made.
26
27Reproduction is tricky since you need to trigger the garbage collector at
28just the right moment.
29
30RP 2013/10/9
31
32[YOCTO #5133]
33
34Upstream-State: Pending
35
36Index: gcc-4.8.1/gcc/toplev.c
37===================================================================
38--- gcc-4.8.1.orig/gcc/toplev.c 2013-03-28 08:29:51.000000000 +0000
39+++ gcc-4.8.1/gcc/toplev.c 2013-10-09 20:27:17.089228023 +0000
40@@ -551,11 +551,11 @@
41 if (flag_syntax_only || flag_wpa)
42 return;
43
44- ggc_protect_identifiers = false;
45-
46 /* This must also call finalize_compilation_unit. */
47 lang_hooks.decls.final_write_globals ();
48
49+ ggc_protect_identifiers = false;
50+
51 if (seen_error ())
52 return;
53
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0048-PR58854_fix_arm_apcs_epilogue.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0048-PR58854_fix_arm_apcs_epilogue.patch
new file mode 100644
index 0000000..0ef245a
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0048-PR58854_fix_arm_apcs_epilogue.patch
@@ -0,0 +1,23 @@
1Backport fix for PR target/58854
2
32013-11-11 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
4
5 Backported from mainline
6 2013-10-30 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
7
8 PR target/58854
9 * config/arm/arm.c (arm_expand_epilogue_apcs_frame): Emit blockage
10
11
12Upstream-Status: Backport
13
14--- gcc-4_8-branch/gcc/config/arm/arm.c 2013/11/11 08:00:45 204664
15+++ gcc-4_8-branch/gcc/config/arm/arm.c 2013/11/11 09:38:14 204665
16@@ -23555,6 +23555,7 @@
17 num_regs = bit_count (saved_regs_mask);
18 if ((offsets->outgoing_args != (1 + num_regs)) || cfun->calls_alloca)
19 {
20+ emit_insn (gen_blockage ());
21 /* Unwind the stack to just below the saved registers. */
22 emit_insn (gen_addsi3 (stack_pointer_rtx,
23 hard_frame_pointer_rtx,
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch
new file mode 100644
index 0000000..b98f8ff
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch
@@ -0,0 +1,42 @@
1From 9e0e19eac2562f73858602fe26e2044eb8b20c47 Mon Sep 17 00:00:00 2001
2From: Alexandru-Cezar Sardan <alexandru.sardan@freescale.com>
3Date: Wed, 5 Feb 2014 16:52:31 +0200
4Subject: [PATCH] Enable SPE & AltiVec generation on powepc*linux target
5
6When is configured with --target=powerpc-linux, the resulting GCC will
7not be able to generate code for SPE targets (e500v1/v2).
8GCC configured with --target=powerpc-linuxspe will not be able to
9generate AltiVec instructions (for e6500).
10This patch modifies the configured file such that SPE or AltiVec code
11can be generated when gcc is configured with --target=powerpc-linux.
12The ABI and speciffic instructions can be selected through the
13"-mabi=spe or -mabi=altivec" and the "-mspe or -maltivec" parameters.
14
15Upstream-Status: Inappropriate [configuration]
16
17Signed-off-by: Alexandru-Cezar Sardan <alexandru.sardan@freescale.com>
18---
19 gcc/config.gcc | 7 ++++++-
20 1 file changed, 6 insertions(+), 1 deletion(-)
21
22diff --git a/gcc/config.gcc b/gcc/config.gcc
23index cb7a94e..d392c2b 100644
24--- a/gcc/config.gcc
25+++ b/gcc/config.gcc
26@@ -2068,7 +2068,12 @@ powerpc-*-rtems*)
27 tmake_file="rs6000/t-fprules rs6000/t-rtems t-rtems rs6000/t-ppccomm"
28 ;;
29 powerpc*-*-linux*)
30- tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h"
31+ case ${target} in
32+ powerpc*-*-linux*spe* | powerpc*-*-linux*altivec*)
33+ tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h" ;;
34+ *)
35+ tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h rs6000/linuxaltivec.h rs6000/linuxspe.h rs6000/e500.h" ;;
36+ esac
37 extra_options="${extra_options} rs6000/sysv4.opt"
38 tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
39 case ${target} in
40--
411.7.9.5
42
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0050-PR-target-58595.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0050-PR-target-58595.patch
new file mode 100644
index 0000000..62a3994
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0050-PR-target-58595.patch
@@ -0,0 +1,101 @@
1Backport fix for PR target/58595
2
3From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
4Date: Thu, 6 Mar 2014 12:07:07 +0000
5Subject: [PATCH] PR target/58595 * config/arm/arm.c
6 (arm_tls_symbol_p): Remove. (arm_legitimize_address): Call
7 legitimize_tls_address for any arm_tls_referenced_p expression,
8 handle constant addend. Call it before testing for !TARGET_ARM.
9 (thumb_legitimize_address): Don't handle arm_tls_symbol_p here.
10
11 * gcc.dg/tls/pr58595.c: New test.
12
13
14git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208380 138bc75d-0d04-0410-961f-82ee72b054a4
15
16Index: gcc-4.8.2/gcc/config/arm/arm.c
17===================================================================
18--- gcc-4.8.2.orig/gcc/config/arm/arm.c
19+++ gcc-4.8.2/gcc/config/arm/arm.c
20@@ -230,7 +230,6 @@ static tree arm_gimplify_va_arg_expr (tr
21 static void arm_option_override (void);
22 static unsigned HOST_WIDE_INT arm_shift_truncation_mask (enum machine_mode);
23 static bool arm_cannot_copy_insn_p (rtx);
24-static bool arm_tls_symbol_p (rtx x);
25 static int arm_issue_rate (void);
26 static void arm_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
27 static bool arm_output_addr_const_extra (FILE *, rtx);
28@@ -6573,6 +6572,32 @@ legitimize_tls_address (rtx x, rtx reg)
29 rtx
30 arm_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode)
31 {
32+ if (arm_tls_referenced_p (x))
33+ {
34+ rtx addend = NULL;
35+
36+ if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS)
37+ {
38+ addend = XEXP (XEXP (x, 0), 1);
39+ x = XEXP (XEXP (x, 0), 0);
40+ }
41+
42+ if (GET_CODE (x) != SYMBOL_REF)
43+ return x;
44+
45+ gcc_assert (SYMBOL_REF_TLS_MODEL (x) != 0);
46+
47+ x = legitimize_tls_address (x, NULL_RTX);
48+
49+ if (addend)
50+ {
51+ x = gen_rtx_PLUS (SImode, x, addend);
52+ orig_x = x;
53+ }
54+ else
55+ return x;
56+ }
57+
58 if (!TARGET_ARM)
59 {
60 /* TODO: legitimize_address for Thumb2. */
61@@ -6581,9 +6606,6 @@ arm_legitimize_address (rtx x, rtx orig_
62 return thumb_legitimize_address (x, orig_x, mode);
63 }
64
65- if (arm_tls_symbol_p (x))
66- return legitimize_tls_address (x, NULL_RTX);
67-
68 if (GET_CODE (x) == PLUS)
69 {
70 rtx xop0 = XEXP (x, 0);
71@@ -6695,9 +6717,6 @@ arm_legitimize_address (rtx x, rtx orig_
72 rtx
73 thumb_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode)
74 {
75- if (arm_tls_symbol_p (x))
76- return legitimize_tls_address (x, NULL_RTX);
77-
78 if (GET_CODE (x) == PLUS
79 && CONST_INT_P (XEXP (x, 1))
80 && (INTVAL (XEXP (x, 1)) >= 32 * GET_MODE_SIZE (mode)
81@@ -6988,20 +7007,6 @@ thumb_legitimize_reload_address (rtx *x_
82
83 /* Test for various thread-local symbols. */
84
85-/* Return TRUE if X is a thread-local symbol. */
86-
87-static bool
88-arm_tls_symbol_p (rtx x)
89-{
90- if (! TARGET_HAVE_TLS)
91- return false;
92-
93- if (GET_CODE (x) != SYMBOL_REF)
94- return false;
95-
96- return SYMBOL_REF_TLS_MODEL (x) != 0;
97-}
98-
99 /* Helper for arm_tls_referenced_p. */
100
101 static int
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/AArch64-Define-BE-loader-name-default-be.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/AArch64-Define-BE-loader-name-default-be.patch
new file mode 100644
index 0000000..eb8ff01
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/AArch64-Define-BE-loader-name-default-be.patch
@@ -0,0 +1,38 @@
1Index: gcc-linaro-4.8-2014.03/gcc/config/aarch64/aarch64-linux.h
2===================================================================
3--- gcc-linaro-4.8-2014.03.orig/gcc/config/aarch64/aarch64-linux.h
4+++ gcc-linaro-4.8-2014.03/gcc/config/aarch64/aarch64-linux.h
5@@ -21,10 +21,23 @@
6 #ifndef GCC_AARCH64_LINUX_H
7 #define GCC_AARCH64_LINUX_H
8
9-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}.so.1"
10-
11 #define CPP_SPEC "%{pthread:-D_REENTRANT}"
12
13+#if TARGET_BIG_ENDIAN_DEFAULT
14+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{!mlittle-endian:_be}.so.1"
15+
16+#define LINUX_TARGET_LINK_SPEC "%{h*} \
17+ %{static:-Bstatic} \
18+ %{shared:-shared} \
19+ %{symbolic:-Bsymbolic} \
20+ %{rdynamic:-export-dynamic} \
21+ -dynamic-linker " GNU_USER_DYNAMIC_LINKER " \
22+ -X \
23+ %{mbig-endian:-EB} %{mlittle-endian:-EL} \
24+ -maarch64linux%{!mlittle-endian:b}"
25+#else
26+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}.so.1"
27+
28 #define LINUX_TARGET_LINK_SPEC "%{h*} \
29 %{static:-Bstatic} \
30 %{shared:-shared} \
31@@ -34,6 +47,7 @@
32 -X \
33 %{mbig-endian:-EB} %{mlittle-endian:-EL} \
34 -maarch64linux%{mbig-endian:b}"
35+#endif
36
37 #define LINK_SPEC LINUX_TARGET_LINK_SPEC
38
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/gcc-4.8-PR56797.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/gcc-4.8-PR56797.patch
new file mode 100644
index 0000000..b5d7b86
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/gcc-4.8-PR56797.patch
@@ -0,0 +1,66 @@
1Upstream-Status: Backport
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4From patchwork Fri Apr 19 09:34:49 2013
5Content-Type: text/plain; charset="utf-8"
6MIME-Version: 1.0
7Content-Transfer-Encoding: 7bit
8Subject: [ARM] Fix PR56797
9Date: Thu, 18 Apr 2013 23:34:49 -0000
10From: Greta Yorsh <Greta.Yorsh@arm.com>
11X-Patchwork-Id: 237891
12Message-Id: <000801ce3ce1$23fbdd60$6bf39820$@yorsh@arm.com>
13To: "GCC Patches" <gcc-patches@gcc.gnu.org>
14Cc: <raj.khem@gmail.com>, "Richard Earnshaw" <Richard.Earnshaw@arm.com>,
15 "Ramana Radhakrishnan" <Ramana.Radhakrishnan@arm.com>
16
17Fix PR56797
18http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56797
19
20The problem is that peephole optimizer thinks it can generate an ldm, but
21the pattern for ldm no longer matches, because after r188738 it requires
22that if one of the destination registers is SP then the base register must
23be SP, and it's not SP in the test case.
24
25The test case fails on armv5t but doesn't fail on armv6t2 or armv7-a because
26peephole doesn't trigger there (because there is a different epilogue
27sequence). It looks like a latent problem for other architecture or CPUs.
28
29This patch adds this condition to the peephole optimizer.
30
31No regression on qemu for arm-none-eabi and fixes the test reported in the
32PR. I couldn't minimize the test sufficiently to include it in the
33testsuite.
34
35Ok for trunk?
36
37Thanks,
38Greta
39
40gcc/
41
422013-04-18 Greta Yorsh <Greta.Yorsh@arm.com>
43
44 PR target/56797
45 * config/arm/arm.c (load_multiple_sequence): Require SP
46 as base register for loads if SP is in the register list.
47
48
49diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
50index d00849c..60fef78 100644
51--- a/gcc/config/arm/arm.c
52+++ b/gcc/config/arm/arm.c
53@@ -10347,6 +10347,13 @@ load_multiple_sequence (rtx *operands, int nops, int *regs, int *saved_order,
54 || (i != nops - 1 && unsorted_regs[i] == base_reg))
55 return 0;
56
57+ /* Don't allow SP to be loaded unless it is also the base
58+ register. It guarantees that SP is reset correctly when
59+ an LDM instruction is interruptted. Otherwise, we might
60+ end up with a corrupt stack. */
61+ if (unsorted_regs[i] == SP_REGNUM && base_reg != SP_REGNUM)
62+ return 0;
63+
64 unsorted_offsets[i] = INTVAL (offset);
65 if (i == 0 || unsorted_offsets[i] < unsorted_offsets[order[0]])
66 order[0] = i;
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/use-lib-for-aarch64.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/use-lib-for-aarch64.patch
new file mode 100644
index 0000000..d6bacd8
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/use-lib-for-aarch64.patch
@@ -0,0 +1,14 @@
1---
2 gcc/config/aarch64/t-aarch64-linux | 2 +-
3 1 file changed, 1 insertion(+), 1 deletion(-)
4
5--- gcc-linaro-4.8-2013.04.orig/gcc/config/aarch64/t-aarch64-linux
6+++ gcc-linaro-4.8-2013.04/gcc/config/aarch64/t-aarch64-linux
7@@ -20,6 +20,6 @@
8
9 LIB1ASMSRC = aarch64/lib1funcs.asm
10 LIB1ASMFUNCS = _aarch64_sync_cache_range
11
12 AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
13-MULTILIB_OSDIRNAMES = .=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
14+MULTILIB_OSDIRNAMES = .=../lib$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9.inc b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9.inc
new file mode 100644
index 0000000..2334719
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9.inc
@@ -0,0 +1,73 @@
1require recipes-devtools/gcc/gcc-4.9.inc
2PV = "linaro-${BASEPV}"
3
4MMYY = "14.11"
5RELEASE = "20${MMYY}"
6PR = "r${RELEASE}"
7BINV = "4.9.3"
8
9FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/gcc-${PV}' ], d)}"
10FILESPATH_append := ":${COREBASE}/meta/recipes-devtools/gcc/gcc-4.9"
11
12SRC_URI = "https://releases.linaro.org/${MMYY}/components/toolchain/gcc-linaro/${BASEPV}/gcc-${PV}-${RELEASE}.tar.xz \
13 file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
14 file://0002-uclibc-conf.patch \
15 file://0003-gcc-uclibc-locale-ctype_touplow_t.patch \
16 file://0004-uclibc-locale.patch \
17 file://0005-uclibc-locale-no__x.patch \
18 file://0006-uclibc-locale-wchar_fix.patch \
19 file://0007-uclibc-locale-update.patch \
20 file://0008-missing-execinfo_h.patch \
21 file://0009-c99-snprintf.patch \
22 file://0010-c99-complex-ugly-hack.patch \
23 file://0011-index_macro.patch \
24 file://0013-libstdc-namespace.patch \
25 file://0014-sh-pr24836.patch \
26 file://0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch \
27 file://0016-gcc-poison-system-directories.patch \
28 file://0017-gcc-poison-dir-extend.patch \
29 file://0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
30 file://0019-64-bit-multilib-hack.patch \
31 file://0020-optional-libstdc.patch \
32 file://0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch \
33 file://0022-COLLECT_GCC_OPTIONS.patch \
34 file://0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
35 file://0024-PR-target-32219.patch \
36 file://0025-fortran-cross-compile-hack.patch \
37 file://0026-libgcc-sjlj-check.patch \
38 file://0027-cpp-honor-sysroot.patch \
39 file://0028-MIPS64-Default-to-N64-ABI.patch \
40 file://0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
41 file://0030-gcc-Fix-argument-list-too-long-error.patch \
42 file://0031-Disable-sdt.patch \
43 file://0032-libtool.patch \
44 file://0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
45 file://0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
46 file://0037-gcc-4.8-PR56797.patch \
47 file://0040-fix-g++-sysroot.patch \
48 file://0041-libtool-avoid-libdir.patch \
49 file://0043-cpp.patch \
50 file://0044-gengtypes.patch \
51 file://0046-libatomic-deptracking.patch \
52 file://0047-repomembug.patch \
53 file://0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch \
54 file://0050-Revert-Use-dbx_reg_number-for-spanning-registers.patch \
55 file://0051-eabispe.patch \
56 file://0052-Fix-GCC-targeting-E500-SPE-errors-with-the-_Decimal64-type.patch;apply=no \
57 file://0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch \
58 file://0054-gcc-Makefile.in-fix-parallel-building-failure.patch \
59 file://0055-PR-rtl-optimization-61801.patch;apply=no \
60 file://0056-top-level-reorder_gcc-bug-61144.patch \
61 file://0058-gcc-r212171.patch \
62 file://0059-gcc-PR-rtl-optimization-63348.patch \
63 file://AArch64-Define-BE-loader-name-default-be.patch \
64 file://use-lib-for-aarch64.patch \
65 file://1001-add-install-ptest-to-Makefile.patch \
66 file://run-ptest \
67 "
68
69SRC_URI[md5sum] = "a0fda0cc4408f935086bb156aeef5ff9"
70SRC_URI[sha256sum] = "7e176614b4a39259bfe4dad08d89651f511f3e52c2201210037b48cce90cc32a"
71
72S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}-${RELEASE}"
73B = "${WORKDIR}/gcc-${PV}-${RELEASE}/build.${HOST_SYS}.${TARGET_SYS}"
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000..e588011
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
@@ -0,0 +1,42 @@
1From bf3d96ae58fa180b8b468d25dc2e0209daca2751 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:37:11 +0400
4Subject: [PATCH 01/35] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Inappropriate [embedded specific]
9---
10 configure | 2 +-
11 configure.ac | 2 +-
12 2 files changed, 2 insertions(+), 2 deletions(-)
13
14diff --git a/configure b/configure
15index d809535..1b76c90 100755
16--- a/configure
17+++ b/configure
18@@ -7439,7 +7439,7 @@ fi
19 # for target_alias and gcc doesn't manage it consistently.
20 target_configargs="--cache-file=./config.cache ${target_configargs}"
21
22-FLAGS_FOR_TARGET=
23+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
24 case " $target_configdirs " in
25 *" newlib "*)
26 case " $target_configargs " in
27diff --git a/configure.ac b/configure.ac
28index 48ec1aa..89d1d3f 100644
29--- a/configure.ac
30+++ b/configure.ac
31@@ -2873,7 +2873,7 @@ fi
32 # for target_alias and gcc doesn't manage it consistently.
33 target_configargs="--cache-file=./config.cache ${target_configargs}"
34
35-FLAGS_FOR_TARGET=
36+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
37 case " $target_configdirs " in
38 *" newlib "*)
39 case " $target_configargs " in
40--
411.7.10.4
42
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0002-uclibc-conf.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0002-uclibc-conf.patch
new file mode 100644
index 0000000..dda3b10
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0002-uclibc-conf.patch
@@ -0,0 +1,53 @@
1From d030973c872c00d916921d84deee0af2c0d38081 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:38:25 +0400
4Subject: [PATCH 02/35] uclibc-conf
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 contrib/regression/objs-gcc.sh | 4 ++++
11 libjava/classpath/ltconfig | 4 ++--
12 2 files changed, 6 insertions(+), 2 deletions(-)
13
14diff --git a/contrib/regression/objs-gcc.sh b/contrib/regression/objs-gcc.sh
15index 60b0497..6dc7ead 100755
16--- a/contrib/regression/objs-gcc.sh
17+++ b/contrib/regression/objs-gcc.sh
18@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-gnu ]
19 then
20 make all-gdb all-dejagnu all-ld || exit 1
21 make install-gdb install-dejagnu install-ld || exit 1
22+elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
23+ then
24+ make all-gdb all-dejagnu all-ld || exit 1
25+ make install-gdb install-dejagnu install-ld || exit 1
26 elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
27 make bootstrap || exit 1
28 make install || exit 1
29diff --git a/libjava/classpath/ltconfig b/libjava/classpath/ltconfig
30index 743d951..ae4ea60 100755
31--- a/libjava/classpath/ltconfig
32+++ b/libjava/classpath/ltconfig
33@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
34
35 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
36 case $host_os in
37-linux-gnu*) ;;
38+linux-gnu*|linux-uclibc*) ;;
39 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
40 esac
41
42@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
43 ;;
44
45 # This must be Linux ELF.
46-linux-gnu*)
47+linux*)
48 version_type=linux
49 need_lib_prefix=no
50 need_version=no
51--
521.7.10.4
53
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0003-gcc-uclibc-locale-ctype_touplow_t.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0003-gcc-uclibc-locale-ctype_touplow_t.patch
new file mode 100644
index 0000000..7098e99
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0003-gcc-uclibc-locale-ctype_touplow_t.patch
@@ -0,0 +1,87 @@
1From d2d9dd756c4356d14dd7ae003856344cb4f37985 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:40:12 +0400
4Subject: [PATCH 03/35] gcc-uclibc-locale-ctype_touplow_t
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/config/locale/generic/c_locale.cc | 5 +++++
11 libstdc++-v3/config/locale/generic/c_locale.h | 9 +++++++++
12 libstdc++-v3/config/os/gnu-linux/ctype_base.h | 9 +++++++++
13 3 files changed, 23 insertions(+)
14
15diff --git a/libstdc++-v3/config/locale/generic/c_locale.cc b/libstdc++-v3/config/locale/generic/c_locale.cc
16index 0d309a5..f2f1e1f 100644
17--- a/libstdc++-v3/config/locale/generic/c_locale.cc
18+++ b/libstdc++-v3/config/locale/generic/c_locale.cc
19@@ -263,5 +263,10 @@ _GLIBCXX_END_NAMESPACE_VERSION
20 #ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
21 #define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
22 extern "C" void ldbl (void) __attribute__ ((alias (#dbl)))
23+#ifdef __UCLIBC__
24+// This is because __c_locale is of type __ctype_touplow_t* which is short on uclibc. for glibc its int*
25+_GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPs, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPs);
26+#else
27 _GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPi, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPi);
28+#endif
29 #endif // _GLIBCXX_LONG_DOUBLE_COMPAT
30diff --git a/libstdc++-v3/config/locale/generic/c_locale.h b/libstdc++-v3/config/locale/generic/c_locale.h
31index b5fd989..3da9a5d 100644
32--- a/libstdc++-v3/config/locale/generic/c_locale.h
33+++ b/libstdc++-v3/config/locale/generic/c_locale.h
34@@ -40,13 +40,22 @@
35
36 #include <clocale>
37
38+#ifdef __UCLIBC__
39+#include <features.h>
40+#include <ctype.h>
41+#endif
42+
43 #define _GLIBCXX_NUM_CATEGORIES 0
44
45 namespace std _GLIBCXX_VISIBILITY(default)
46 {
47 _GLIBCXX_BEGIN_NAMESPACE_VERSION
48
49+#ifdef __UCLIBC__
50+ typedef __ctype_touplow_t* __c_locale;
51+#else
52 typedef int* __c_locale;
53+#endif
54
55 // Convert numeric value of type double and long double to string and
56 // return length of string. If vsnprintf is available use it, otherwise
57diff --git a/libstdc++-v3/config/os/gnu-linux/ctype_base.h b/libstdc++-v3/config/os/gnu-linux/ctype_base.h
58index 2d8e978..14eb08f 100644
59--- a/libstdc++-v3/config/os/gnu-linux/ctype_base.h
60+++ b/libstdc++-v3/config/os/gnu-linux/ctype_base.h
61@@ -33,6 +33,11 @@
62
63 // Information as gleaned from /usr/include/ctype.h
64
65+#ifdef __UCLIBC__
66+#include <features.h>
67+#include <ctype.h>
68+#endif
69+
70 namespace std _GLIBCXX_VISIBILITY(default)
71 {
72 _GLIBCXX_BEGIN_NAMESPACE_VERSION
73@@ -41,7 +46,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
74 struct ctype_base
75 {
76 // Non-standard typedefs.
77+#ifdef __UCLIBC__
78+ typedef const __ctype_touplow_t* __to_type;
79+#else
80 typedef const int* __to_type;
81+#endif
82
83 // NB: Offsets into ctype<char>::_M_table force a particular size
84 // on the mask type. Because of this, we don't use an enum.
85--
861.7.10.4
87
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0004-uclibc-locale.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0004-uclibc-locale.patch
new file mode 100644
index 0000000..49f5f33
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0004-uclibc-locale.patch
@@ -0,0 +1,2862 @@
1From a55c751a449c2cbf0b3fcc07aab1b86bf9661510 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:41:39 +0400
4Subject: [PATCH 04/35] uclibc-locale
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/acinclude.m4 | 37 ++
11 .../config/locale/uclibc/c++locale_internal.h | 63 ++
12 libstdc++-v3/config/locale/uclibc/c_locale.cc | 160 +++++
13 libstdc++-v3/config/locale/uclibc/c_locale.h | 117 ++++
14 .../config/locale/uclibc/codecvt_members.cc | 308 +++++++++
15 .../config/locale/uclibc/collate_members.cc | 80 +++
16 libstdc++-v3/config/locale/uclibc/ctype_members.cc | 300 +++++++++
17 .../config/locale/uclibc/messages_members.cc | 100 +++
18 .../config/locale/uclibc/messages_members.h | 118 ++++
19 .../config/locale/uclibc/monetary_members.cc | 692 ++++++++++++++++++++
20 .../config/locale/uclibc/numeric_members.cc | 160 +++++
21 libstdc++-v3/config/locale/uclibc/time_members.cc | 406 ++++++++++++
22 libstdc++-v3/config/locale/uclibc/time_members.h | 68 ++
23 libstdc++-v3/configure | 75 +++
24 libstdc++-v3/include/c_compatibility/wchar.h | 2 +
25 libstdc++-v3/include/c_std/cwchar | 2 +
26 16 files changed, 2688 insertions(+)
27 create mode 100644 libstdc++-v3/config/locale/uclibc/c++locale_internal.h
28 create mode 100644 libstdc++-v3/config/locale/uclibc/c_locale.cc
29 create mode 100644 libstdc++-v3/config/locale/uclibc/c_locale.h
30 create mode 100644 libstdc++-v3/config/locale/uclibc/codecvt_members.cc
31 create mode 100644 libstdc++-v3/config/locale/uclibc/collate_members.cc
32 create mode 100644 libstdc++-v3/config/locale/uclibc/ctype_members.cc
33 create mode 100644 libstdc++-v3/config/locale/uclibc/messages_members.cc
34 create mode 100644 libstdc++-v3/config/locale/uclibc/messages_members.h
35 create mode 100644 libstdc++-v3/config/locale/uclibc/monetary_members.cc
36 create mode 100644 libstdc++-v3/config/locale/uclibc/numeric_members.cc
37 create mode 100644 libstdc++-v3/config/locale/uclibc/time_members.cc
38 create mode 100644 libstdc++-v3/config/locale/uclibc/time_members.h
39
40diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
41index 0871a6a..326d7ef 100644
42--- a/libstdc++-v3/acinclude.m4
43+++ b/libstdc++-v3/acinclude.m4
44@@ -1905,6 +1905,9 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
45 # Default to "generic".
46 if test $enable_clocale_flag = auto; then
47 case ${target_os} in
48+ *-uclibc*)
49+ enable_clocale_flag=uclibc
50+ ;;
51 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
52 enable_clocale_flag=gnu
53 ;;
54@@ -2069,6 +2072,40 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
55 CTIME_CC=config/locale/generic/time_members.cc
56 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
57 ;;
58+ uclibc)
59+ AC_MSG_RESULT(uclibc)
60+
61+ # Declare intention to use gettext, and add support for specific
62+ # languages.
63+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
64+ ALL_LINGUAS="de fr"
65+
66+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
67+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
68+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
69+ USE_NLS=yes
70+ fi
71+ # Export the build objects.
72+ for ling in $ALL_LINGUAS; do \
73+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
74+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
75+ done
76+ AC_SUBST(glibcxx_MOFILES)
77+ AC_SUBST(glibcxx_POFILES)
78+
79+ CLOCALE_H=config/locale/uclibc/c_locale.h
80+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
81+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
82+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
83+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
84+ CMESSAGES_H=config/locale/uclibc/messages_members.h
85+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
86+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
87+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
88+ CTIME_H=config/locale/uclibc/time_members.h
89+ CTIME_CC=config/locale/uclibc/time_members.cc
90+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
91+ ;;
92 esac
93
94 # This is where the testsuite looks for locale catalogs, using the
95diff --git a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
96new file mode 100644
97index 0000000..2ae3e4a
98--- /dev/null
99+++ b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
100@@ -0,0 +1,63 @@
101+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
102+
103+// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
104+//
105+// This file is part of the GNU ISO C++ Library. This library is free
106+// software; you can redistribute it and/or modify it under the
107+// terms of the GNU General Public License as published by the
108+// Free Software Foundation; either version 2, or (at your option)
109+// any later version.
110+
111+// This library is distributed in the hope that it will be useful,
112+// but WITHOUT ANY WARRANTY; without even the implied warranty of
113+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
114+// GNU General Public License for more details.
115+
116+// You should have received a copy of the GNU General Public License along
117+// with this library; see the file COPYING. If not, write to the Free
118+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
119+// USA.
120+
121+// As a special exception, you may use this file as part of a free software
122+// library without restriction. Specifically, if other files instantiate
123+// templates or use macros or inline functions from this file, or you compile
124+// this file and link it with other files to produce an executable, this
125+// file does not by itself cause the resulting executable to be covered by
126+// the GNU General Public License. This exception does not however
127+// invalidate any other reasons why the executable file might be covered by
128+// the GNU General Public License.
129+
130+// Written by Jakub Jelinek <jakub@redhat.com>
131+
132+#include <bits/c++config.h>
133+#include <clocale>
134+
135+#ifdef __UCLIBC_MJN3_ONLY__
136+#warning clean this up
137+#endif
138+
139+#ifdef __UCLIBC_HAS_XLOCALE__
140+
141+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
142+extern "C" __typeof(strcoll_l) __strcoll_l;
143+extern "C" __typeof(strftime_l) __strftime_l;
144+extern "C" __typeof(strtod_l) __strtod_l;
145+extern "C" __typeof(strtof_l) __strtof_l;
146+extern "C" __typeof(strtold_l) __strtold_l;
147+extern "C" __typeof(strxfrm_l) __strxfrm_l;
148+extern "C" __typeof(newlocale) __newlocale;
149+extern "C" __typeof(freelocale) __freelocale;
150+extern "C" __typeof(duplocale) __duplocale;
151+extern "C" __typeof(uselocale) __uselocale;
152+
153+#ifdef _GLIBCXX_USE_WCHAR_T
154+extern "C" __typeof(iswctype_l) __iswctype_l;
155+extern "C" __typeof(towlower_l) __towlower_l;
156+extern "C" __typeof(towupper_l) __towupper_l;
157+extern "C" __typeof(wcscoll_l) __wcscoll_l;
158+extern "C" __typeof(wcsftime_l) __wcsftime_l;
159+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
160+extern "C" __typeof(wctype_l) __wctype_l;
161+#endif
162+
163+#endif // GLIBC 2.3 and later
164diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.cc b/libstdc++-v3/config/locale/uclibc/c_locale.cc
165new file mode 100644
166index 0000000..5081dc1
167--- /dev/null
168+++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc
169@@ -0,0 +1,160 @@
170+// Wrapper for underlying C-language localization -*- C++ -*-
171+
172+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
173+//
174+// This file is part of the GNU ISO C++ Library. This library is free
175+// software; you can redistribute it and/or modify it under the
176+// terms of the GNU General Public License as published by the
177+// Free Software Foundation; either version 2, or (at your option)
178+// any later version.
179+
180+// This library is distributed in the hope that it will be useful,
181+// but WITHOUT ANY WARRANTY; without even the implied warranty of
182+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
183+// GNU General Public License for more details.
184+
185+// You should have received a copy of the GNU General Public License along
186+// with this library; see the file COPYING. If not, write to the Free
187+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
188+// USA.
189+
190+// As a special exception, you may use this file as part of a free software
191+// library without restriction. Specifically, if other files instantiate
192+// templates or use macros or inline functions from this file, or you compile
193+// this file and link it with other files to produce an executable, this
194+// file does not by itself cause the resulting executable to be covered by
195+// the GNU General Public License. This exception does not however
196+// invalidate any other reasons why the executable file might be covered by
197+// the GNU General Public License.
198+
199+//
200+// ISO C++ 14882: 22.8 Standard locale categories.
201+//
202+
203+// Written by Benjamin Kosnik <bkoz@redhat.com>
204+
205+#include <cerrno> // For errno
206+#include <locale>
207+#include <stdexcept>
208+#include <langinfo.h>
209+#include <bits/c++locale_internal.h>
210+
211+#ifndef __UCLIBC_HAS_XLOCALE__
212+#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
213+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
214+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
215+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
216+#define __strtof_l(S, E, L) strtof((S), (E))
217+#define __strtod_l(S, E, L) strtod((S), (E))
218+#define __strtold_l(S, E, L) strtold((S), (E))
219+#warning should dummy __newlocale check for C|POSIX ?
220+#define __newlocale(a, b, c) NULL
221+#define __freelocale(a) ((void)0)
222+#define __duplocale(a) __c_locale()
223+#endif
224+
225+namespace std
226+{
227+ template<>
228+ void
229+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
230+ const __c_locale& __cloc)
231+ {
232+ if (!(__err & ios_base::failbit))
233+ {
234+ char* __sanity;
235+ errno = 0;
236+ float __f = __strtof_l(__s, &__sanity, __cloc);
237+ if (__sanity != __s && errno != ERANGE)
238+ __v = __f;
239+ else
240+ __err |= ios_base::failbit;
241+ }
242+ }
243+
244+ template<>
245+ void
246+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
247+ const __c_locale& __cloc)
248+ {
249+ if (!(__err & ios_base::failbit))
250+ {
251+ char* __sanity;
252+ errno = 0;
253+ double __d = __strtod_l(__s, &__sanity, __cloc);
254+ if (__sanity != __s && errno != ERANGE)
255+ __v = __d;
256+ else
257+ __err |= ios_base::failbit;
258+ }
259+ }
260+
261+ template<>
262+ void
263+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
264+ const __c_locale& __cloc)
265+ {
266+ if (!(__err & ios_base::failbit))
267+ {
268+ char* __sanity;
269+ errno = 0;
270+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
271+ if (__sanity != __s && errno != ERANGE)
272+ __v = __ld;
273+ else
274+ __err |= ios_base::failbit;
275+ }
276+ }
277+
278+ void
279+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
280+ __c_locale __old)
281+ {
282+ __cloc = __newlocale(1 << LC_ALL, __s, __old);
283+#ifdef __UCLIBC_HAS_XLOCALE__
284+ if (!__cloc)
285+ {
286+ // This named locale is not supported by the underlying OS.
287+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
288+ "name not valid"));
289+ }
290+#endif
291+ }
292+
293+ void
294+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
295+ {
296+ if (_S_get_c_locale() != __cloc)
297+ __freelocale(__cloc);
298+ }
299+
300+ __c_locale
301+ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
302+ { return __duplocale(__cloc); }
303+} // namespace std
304+
305+namespace __gnu_cxx
306+{
307+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
308+ {
309+ "LC_CTYPE",
310+ "LC_NUMERIC",
311+ "LC_TIME",
312+ "LC_COLLATE",
313+ "LC_MONETARY",
314+ "LC_MESSAGES",
315+#if _GLIBCXX_NUM_CATEGORIES != 0
316+ "LC_PAPER",
317+ "LC_NAME",
318+ "LC_ADDRESS",
319+ "LC_TELEPHONE",
320+ "LC_MEASUREMENT",
321+ "LC_IDENTIFICATION"
322+#endif
323+ };
324+}
325+
326+namespace std
327+{
328+ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
329+} // namespace std
330diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.h b/libstdc++-v3/config/locale/uclibc/c_locale.h
331new file mode 100644
332index 0000000..da07c1f
333--- /dev/null
334+++ b/libstdc++-v3/config/locale/uclibc/c_locale.h
335@@ -0,0 +1,117 @@
336+// Wrapper for underlying C-language localization -*- C++ -*-
337+
338+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
339+//
340+// This file is part of the GNU ISO C++ Library. This library is free
341+// software; you can redistribute it and/or modify it under the
342+// terms of the GNU General Public License as published by the
343+// Free Software Foundation; either version 2, or (at your option)
344+// any later version.
345+
346+// This library is distributed in the hope that it will be useful,
347+// but WITHOUT ANY WARRANTY; without even the implied warranty of
348+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
349+// GNU General Public License for more details.
350+
351+// You should have received a copy of the GNU General Public License along
352+// with this library; see the file COPYING. If not, write to the Free
353+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
354+// USA.
355+
356+// As a special exception, you may use this file as part of a free software
357+// library without restriction. Specifically, if other files instantiate
358+// templates or use macros or inline functions from this file, or you compile
359+// this file and link it with other files to produce an executable, this
360+// file does not by itself cause the resulting executable to be covered by
361+// the GNU General Public License. This exception does not however
362+// invalidate any other reasons why the executable file might be covered by
363+// the GNU General Public License.
364+
365+//
366+// ISO C++ 14882: 22.8 Standard locale categories.
367+//
368+
369+// Written by Benjamin Kosnik <bkoz@redhat.com>
370+
371+#ifndef _C_LOCALE_H
372+#define _C_LOCALE_H 1
373+
374+#pragma GCC system_header
375+
376+#include <cstring> // get std::strlen
377+#include <cstdio> // get std::snprintf or std::sprintf
378+#include <clocale>
379+#include <langinfo.h> // For codecvt
380+#ifdef __UCLIBC_MJN3_ONLY__
381+#warning fix this
382+#endif
383+#ifdef __UCLIBC_HAS_LOCALE__
384+#include <iconv.h> // For codecvt using iconv, iconv_t
385+#endif
386+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
387+#include <libintl.h> // For messages
388+#endif
389+
390+#ifdef __UCLIBC_MJN3_ONLY__
391+#warning what is _GLIBCXX_C_LOCALE_GNU for
392+#endif
393+#define _GLIBCXX_C_LOCALE_GNU 1
394+
395+#ifdef __UCLIBC_MJN3_ONLY__
396+#warning fix categories
397+#endif
398+// #define _GLIBCXX_NUM_CATEGORIES 6
399+#define _GLIBCXX_NUM_CATEGORIES 0
400+
401+#ifdef __UCLIBC_HAS_XLOCALE__
402+namespace __gnu_cxx
403+{
404+ extern "C" __typeof(uselocale) __uselocale;
405+}
406+#endif
407+
408+namespace std
409+{
410+#ifdef __UCLIBC_HAS_XLOCALE__
411+ typedef __locale_t __c_locale;
412+#else
413+ typedef int* __c_locale;
414+#endif
415+
416+ // Convert numeric value of type _Tv to string and return length of
417+ // string. If snprintf is available use it, otherwise fall back to
418+ // the unsafe sprintf which, in general, can be dangerous and should
419+ // be avoided.
420+ template<typename _Tv>
421+ int
422+ __convert_from_v(char* __out,
423+ const int __size __attribute__ ((__unused__)),
424+ const char* __fmt,
425+#ifdef __UCLIBC_HAS_XCLOCALE__
426+ _Tv __v, const __c_locale& __cloc, int __prec)
427+ {
428+ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
429+#else
430+ _Tv __v, const __c_locale&, int __prec)
431+ {
432+# ifdef __UCLIBC_HAS_LOCALE__
433+ char* __old = std::setlocale(LC_ALL, NULL);
434+ char* __sav = new char[std::strlen(__old) + 1];
435+ std::strcpy(__sav, __old);
436+ std::setlocale(LC_ALL, "C");
437+# endif
438+#endif
439+
440+ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
441+
442+#ifdef __UCLIBC_HAS_XCLOCALE__
443+ __gnu_cxx::__uselocale(__old);
444+#elif defined __UCLIBC_HAS_LOCALE__
445+ std::setlocale(LC_ALL, __sav);
446+ delete [] __sav;
447+#endif
448+ return __ret;
449+ }
450+}
451+
452+#endif
453diff --git a/libstdc++-v3/config/locale/uclibc/codecvt_members.cc b/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
454new file mode 100644
455index 0000000..64aa962
456--- /dev/null
457+++ b/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
458@@ -0,0 +1,308 @@
459+// std::codecvt implementation details, GNU version -*- C++ -*-
460+
461+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
462+//
463+// This file is part of the GNU ISO C++ Library. This library is free
464+// software; you can redistribute it and/or modify it under the
465+// terms of the GNU General Public License as published by the
466+// Free Software Foundation; either version 2, or (at your option)
467+// any later version.
468+
469+// This library is distributed in the hope that it will be useful,
470+// but WITHOUT ANY WARRANTY; without even the implied warranty of
471+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
472+// GNU General Public License for more details.
473+
474+// You should have received a copy of the GNU General Public License along
475+// with this library; see the file COPYING. If not, write to the Free
476+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
477+// USA.
478+
479+// As a special exception, you may use this file as part of a free software
480+// library without restriction. Specifically, if other files instantiate
481+// templates or use macros or inline functions from this file, or you compile
482+// this file and link it with other files to produce an executable, this
483+// file does not by itself cause the resulting executable to be covered by
484+// the GNU General Public License. This exception does not however
485+// invalidate any other reasons why the executable file might be covered by
486+// the GNU General Public License.
487+
488+//
489+// ISO C++ 14882: 22.2.1.5 - Template class codecvt
490+//
491+
492+// Written by Benjamin Kosnik <bkoz@redhat.com>
493+
494+#include <locale>
495+#include <cstdlib> // For MB_CUR_MAX
496+#include <climits> // For MB_LEN_MAX
497+#include <bits/c++locale_internal.h>
498+
499+namespace std
500+{
501+ // Specializations.
502+#ifdef _GLIBCXX_USE_WCHAR_T
503+ codecvt_base::result
504+ codecvt<wchar_t, char, mbstate_t>::
505+ do_out(state_type& __state, const intern_type* __from,
506+ const intern_type* __from_end, const intern_type*& __from_next,
507+ extern_type* __to, extern_type* __to_end,
508+ extern_type*& __to_next) const
509+ {
510+ result __ret = ok;
511+ state_type __tmp_state(__state);
512+
513+#ifdef __UCLIBC_HAS_XLOCALE__
514+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
515+#endif
516+
517+ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
518+ // in case we fall back to wcrtomb and then continue, in a loop.
519+ // NB: wcsnrtombs is a GNU extension
520+ for (__from_next = __from, __to_next = __to;
521+ __from_next < __from_end && __to_next < __to_end
522+ && __ret == ok;)
523+ {
524+ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
525+ __from_end - __from_next);
526+ if (!__from_chunk_end)
527+ __from_chunk_end = __from_end;
528+
529+ __from = __from_next;
530+ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
531+ __from_chunk_end - __from_next,
532+ __to_end - __to_next, &__state);
533+ if (__conv == static_cast<size_t>(-1))
534+ {
535+ // In case of error, in order to stop at the exact place we
536+ // have to start again from the beginning with a series of
537+ // wcrtomb.
538+ for (; __from < __from_next; ++__from)
539+ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
540+ __state = __tmp_state;
541+ __ret = error;
542+ }
543+ else if (__from_next && __from_next < __from_chunk_end)
544+ {
545+ __to_next += __conv;
546+ __ret = partial;
547+ }
548+ else
549+ {
550+ __from_next = __from_chunk_end;
551+ __to_next += __conv;
552+ }
553+
554+ if (__from_next < __from_end && __ret == ok)
555+ {
556+ extern_type __buf[MB_LEN_MAX];
557+ __tmp_state = __state;
558+ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
559+ if (__conv > static_cast<size_t>(__to_end - __to_next))
560+ __ret = partial;
561+ else
562+ {
563+ memcpy(__to_next, __buf, __conv);
564+ __state = __tmp_state;
565+ __to_next += __conv;
566+ ++__from_next;
567+ }
568+ }
569+ }
570+
571+#ifdef __UCLIBC_HAS_XLOCALE__
572+ __uselocale(__old);
573+#endif
574+
575+ return __ret;
576+ }
577+
578+ codecvt_base::result
579+ codecvt<wchar_t, char, mbstate_t>::
580+ do_in(state_type& __state, const extern_type* __from,
581+ const extern_type* __from_end, const extern_type*& __from_next,
582+ intern_type* __to, intern_type* __to_end,
583+ intern_type*& __to_next) const
584+ {
585+ result __ret = ok;
586+ state_type __tmp_state(__state);
587+
588+#ifdef __UCLIBC_HAS_XLOCALE__
589+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
590+#endif
591+
592+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
593+ // in case we store a L'\0' and then continue, in a loop.
594+ // NB: mbsnrtowcs is a GNU extension
595+ for (__from_next = __from, __to_next = __to;
596+ __from_next < __from_end && __to_next < __to_end
597+ && __ret == ok;)
598+ {
599+ const extern_type* __from_chunk_end;
600+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
601+ __from_end
602+ - __from_next));
603+ if (!__from_chunk_end)
604+ __from_chunk_end = __from_end;
605+
606+ __from = __from_next;
607+ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
608+ __from_chunk_end - __from_next,
609+ __to_end - __to_next, &__state);
610+ if (__conv == static_cast<size_t>(-1))
611+ {
612+ // In case of error, in order to stop at the exact place we
613+ // have to start again from the beginning with a series of
614+ // mbrtowc.
615+ for (;; ++__to_next, __from += __conv)
616+ {
617+ __conv = mbrtowc(__to_next, __from, __from_end - __from,
618+ &__tmp_state);
619+ if (__conv == static_cast<size_t>(-1)
620+ || __conv == static_cast<size_t>(-2))
621+ break;
622+ }
623+ __from_next = __from;
624+ __state = __tmp_state;
625+ __ret = error;
626+ }
627+ else if (__from_next && __from_next < __from_chunk_end)
628+ {
629+ // It is unclear what to return in this case (see DR 382).
630+ __to_next += __conv;
631+ __ret = partial;
632+ }
633+ else
634+ {
635+ __from_next = __from_chunk_end;
636+ __to_next += __conv;
637+ }
638+
639+ if (__from_next < __from_end && __ret == ok)
640+ {
641+ if (__to_next < __to_end)
642+ {
643+ // XXX Probably wrong for stateful encodings
644+ __tmp_state = __state;
645+ ++__from_next;
646+ *__to_next++ = L'\0';
647+ }
648+ else
649+ __ret = partial;
650+ }
651+ }
652+
653+#ifdef __UCLIBC_HAS_XLOCALE__
654+ __uselocale(__old);
655+#endif
656+
657+ return __ret;
658+ }
659+
660+ int
661+ codecvt<wchar_t, char, mbstate_t>::
662+ do_encoding() const throw()
663+ {
664+ // XXX This implementation assumes that the encoding is
665+ // stateless and is either single-byte or variable-width.
666+ int __ret = 0;
667+#ifdef __UCLIBC_HAS_XLOCALE__
668+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
669+#endif
670+ if (MB_CUR_MAX == 1)
671+ __ret = 1;
672+#ifdef __UCLIBC_HAS_XLOCALE__
673+ __uselocale(__old);
674+#endif
675+ return __ret;
676+ }
677+
678+ int
679+ codecvt<wchar_t, char, mbstate_t>::
680+ do_max_length() const throw()
681+ {
682+#ifdef __UCLIBC_HAS_XLOCALE__
683+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
684+#endif
685+ // XXX Probably wrong for stateful encodings.
686+ int __ret = MB_CUR_MAX;
687+#ifdef __UCLIBC_HAS_XLOCALE__
688+ __uselocale(__old);
689+#endif
690+ return __ret;
691+ }
692+
693+ int
694+ codecvt<wchar_t, char, mbstate_t>::
695+ do_length(state_type& __state, const extern_type* __from,
696+ const extern_type* __end, size_t __max) const
697+ {
698+ int __ret = 0;
699+ state_type __tmp_state(__state);
700+
701+#ifdef __UCLIBC_HAS_XLOCALE__
702+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
703+#endif
704+
705+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
706+ // in case we advance past it and then continue, in a loop.
707+ // NB: mbsnrtowcs is a GNU extension
708+
709+ // A dummy internal buffer is needed in order for mbsnrtocws to consider
710+ // its fourth parameter (it wouldn't with NULL as first parameter).
711+ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
712+ * __max));
713+ while (__from < __end && __max)
714+ {
715+ const extern_type* __from_chunk_end;
716+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
717+ __end
718+ - __from));
719+ if (!__from_chunk_end)
720+ __from_chunk_end = __end;
721+
722+ const extern_type* __tmp_from = __from;
723+ size_t __conv = mbsnrtowcs(__to, &__from,
724+ __from_chunk_end - __from,
725+ __max, &__state);
726+ if (__conv == static_cast<size_t>(-1))
727+ {
728+ // In case of error, in order to stop at the exact place we
729+ // have to start again from the beginning with a series of
730+ // mbrtowc.
731+ for (__from = __tmp_from;; __from += __conv)
732+ {
733+ __conv = mbrtowc(NULL, __from, __end - __from,
734+ &__tmp_state);
735+ if (__conv == static_cast<size_t>(-1)
736+ || __conv == static_cast<size_t>(-2))
737+ break;
738+ }
739+ __state = __tmp_state;
740+ __ret += __from - __tmp_from;
741+ break;
742+ }
743+ if (!__from)
744+ __from = __from_chunk_end;
745+
746+ __ret += __from - __tmp_from;
747+ __max -= __conv;
748+
749+ if (__from < __end && __max)
750+ {
751+ // XXX Probably wrong for stateful encodings
752+ __tmp_state = __state;
753+ ++__from;
754+ ++__ret;
755+ --__max;
756+ }
757+ }
758+
759+#ifdef __UCLIBC_HAS_XLOCALE__
760+ __uselocale(__old);
761+#endif
762+
763+ return __ret;
764+ }
765+#endif
766+}
767diff --git a/libstdc++-v3/config/locale/uclibc/collate_members.cc b/libstdc++-v3/config/locale/uclibc/collate_members.cc
768new file mode 100644
769index 0000000..c2664a7
770--- /dev/null
771+++ b/libstdc++-v3/config/locale/uclibc/collate_members.cc
772@@ -0,0 +1,80 @@
773+// std::collate implementation details, GNU version -*- C++ -*-
774+
775+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
776+//
777+// This file is part of the GNU ISO C++ Library. This library is free
778+// software; you can redistribute it and/or modify it under the
779+// terms of the GNU General Public License as published by the
780+// Free Software Foundation; either version 2, or (at your option)
781+// any later version.
782+
783+// This library is distributed in the hope that it will be useful,
784+// but WITHOUT ANY WARRANTY; without even the implied warranty of
785+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
786+// GNU General Public License for more details.
787+
788+// You should have received a copy of the GNU General Public License along
789+// with this library; see the file COPYING. If not, write to the Free
790+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
791+// USA.
792+
793+// As a special exception, you may use this file as part of a free software
794+// library without restriction. Specifically, if other files instantiate
795+// templates or use macros or inline functions from this file, or you compile
796+// this file and link it with other files to produce an executable, this
797+// file does not by itself cause the resulting executable to be covered by
798+// the GNU General Public License. This exception does not however
799+// invalidate any other reasons why the executable file might be covered by
800+// the GNU General Public License.
801+
802+//
803+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
804+//
805+
806+// Written by Benjamin Kosnik <bkoz@redhat.com>
807+
808+#include <locale>
809+#include <bits/c++locale_internal.h>
810+
811+#ifndef __UCLIBC_HAS_XLOCALE__
812+#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
813+#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
814+#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
815+#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
816+#endif
817+
818+namespace std
819+{
820+ // These are basically extensions to char_traits, and perhaps should
821+ // be put there instead of here.
822+ template<>
823+ int
824+ collate<char>::_M_compare(const char* __one, const char* __two) const
825+ {
826+ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
827+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
828+ }
829+
830+ template<>
831+ size_t
832+ collate<char>::_M_transform(char* __to, const char* __from,
833+ size_t __n) const
834+ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
835+
836+#ifdef _GLIBCXX_USE_WCHAR_T
837+ template<>
838+ int
839+ collate<wchar_t>::_M_compare(const wchar_t* __one,
840+ const wchar_t* __two) const
841+ {
842+ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
843+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
844+ }
845+
846+ template<>
847+ size_t
848+ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
849+ size_t __n) const
850+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
851+#endif
852+}
853diff --git a/libstdc++-v3/config/locale/uclibc/ctype_members.cc b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
854new file mode 100644
855index 0000000..7294e3a
856--- /dev/null
857+++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
858@@ -0,0 +1,300 @@
859+// std::ctype implementation details, GNU version -*- C++ -*-
860+
861+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
862+//
863+// This file is part of the GNU ISO C++ Library. This library is free
864+// software; you can redistribute it and/or modify it under the
865+// terms of the GNU General Public License as published by the
866+// Free Software Foundation; either version 2, or (at your option)
867+// any later version.
868+
869+// This library is distributed in the hope that it will be useful,
870+// but WITHOUT ANY WARRANTY; without even the implied warranty of
871+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
872+// GNU General Public License for more details.
873+
874+// You should have received a copy of the GNU General Public License along
875+// with this library; see the file COPYING. If not, write to the Free
876+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
877+// USA.
878+
879+// As a special exception, you may use this file as part of a free software
880+// library without restriction. Specifically, if other files instantiate
881+// templates or use macros or inline functions from this file, or you compile
882+// this file and link it with other files to produce an executable, this
883+// file does not by itself cause the resulting executable to be covered by
884+// the GNU General Public License. This exception does not however
885+// invalidate any other reasons why the executable file might be covered by
886+// the GNU General Public License.
887+
888+//
889+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
890+//
891+
892+// Written by Benjamin Kosnik <bkoz@redhat.com>
893+
894+#define _LIBC
895+#include <locale>
896+#undef _LIBC
897+#include <bits/c++locale_internal.h>
898+
899+#ifndef __UCLIBC_HAS_XLOCALE__
900+#define __wctype_l(S, L) wctype((S))
901+#define __towupper_l(C, L) towupper((C))
902+#define __towlower_l(C, L) towlower((C))
903+#define __iswctype_l(C, M, L) iswctype((C), (M))
904+#endif
905+
906+namespace std
907+{
908+ // NB: The other ctype<char> specializations are in src/locale.cc and
909+ // various /config/os/* files.
910+ template<>
911+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
912+ : ctype<char>(0, false, __refs)
913+ {
914+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
915+ {
916+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
917+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
918+#ifdef __UCLIBC_HAS_XLOCALE__
919+ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
920+ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
921+ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
922+#endif
923+ }
924+ }
925+
926+#ifdef _GLIBCXX_USE_WCHAR_T
927+ ctype<wchar_t>::__wmask_type
928+ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
929+ {
930+ __wmask_type __ret;
931+ switch (__m)
932+ {
933+ case space:
934+ __ret = __wctype_l("space", _M_c_locale_ctype);
935+ break;
936+ case print:
937+ __ret = __wctype_l("print", _M_c_locale_ctype);
938+ break;
939+ case cntrl:
940+ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
941+ break;
942+ case upper:
943+ __ret = __wctype_l("upper", _M_c_locale_ctype);
944+ break;
945+ case lower:
946+ __ret = __wctype_l("lower", _M_c_locale_ctype);
947+ break;
948+ case alpha:
949+ __ret = __wctype_l("alpha", _M_c_locale_ctype);
950+ break;
951+ case digit:
952+ __ret = __wctype_l("digit", _M_c_locale_ctype);
953+ break;
954+ case punct:
955+ __ret = __wctype_l("punct", _M_c_locale_ctype);
956+ break;
957+ case xdigit:
958+ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
959+ break;
960+ case alnum:
961+ __ret = __wctype_l("alnum", _M_c_locale_ctype);
962+ break;
963+ case graph:
964+ __ret = __wctype_l("graph", _M_c_locale_ctype);
965+ break;
966+ default:
967+ __ret = __wmask_type();
968+ }
969+ return __ret;
970+ }
971+
972+ wchar_t
973+ ctype<wchar_t>::do_toupper(wchar_t __c) const
974+ { return __towupper_l(__c, _M_c_locale_ctype); }
975+
976+ const wchar_t*
977+ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
978+ {
979+ while (__lo < __hi)
980+ {
981+ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
982+ ++__lo;
983+ }
984+ return __hi;
985+ }
986+
987+ wchar_t
988+ ctype<wchar_t>::do_tolower(wchar_t __c) const
989+ { return __towlower_l(__c, _M_c_locale_ctype); }
990+
991+ const wchar_t*
992+ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
993+ {
994+ while (__lo < __hi)
995+ {
996+ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
997+ ++__lo;
998+ }
999+ return __hi;
1000+ }
1001+
1002+ bool
1003+ ctype<wchar_t>::
1004+ do_is(mask __m, wchar_t __c) const
1005+ {
1006+ // Highest bitmask in ctype_base == 10, but extra in "C"
1007+ // library for blank.
1008+ bool __ret = false;
1009+ const size_t __bitmasksize = 11;
1010+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
1011+ if (__m & _M_bit[__bitcur]
1012+ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
1013+ {
1014+ __ret = true;
1015+ break;
1016+ }
1017+ return __ret;
1018+ }
1019+
1020+ const wchar_t*
1021+ ctype<wchar_t>::
1022+ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
1023+ {
1024+ for (; __lo < __hi; ++__vec, ++__lo)
1025+ {
1026+ // Highest bitmask in ctype_base == 10, but extra in "C"
1027+ // library for blank.
1028+ const size_t __bitmasksize = 11;
1029+ mask __m = 0;
1030+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
1031+ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
1032+ __m |= _M_bit[__bitcur];
1033+ *__vec = __m;
1034+ }
1035+ return __hi;
1036+ }
1037+
1038+ const wchar_t*
1039+ ctype<wchar_t>::
1040+ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
1041+ {
1042+ while (__lo < __hi && !this->do_is(__m, *__lo))
1043+ ++__lo;
1044+ return __lo;
1045+ }
1046+
1047+ const wchar_t*
1048+ ctype<wchar_t>::
1049+ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
1050+ {
1051+ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
1052+ ++__lo;
1053+ return __lo;
1054+ }
1055+
1056+ wchar_t
1057+ ctype<wchar_t>::
1058+ do_widen(char __c) const
1059+ { return _M_widen[static_cast<unsigned char>(__c)]; }
1060+
1061+ const char*
1062+ ctype<wchar_t>::
1063+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
1064+ {
1065+ while (__lo < __hi)
1066+ {
1067+ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
1068+ ++__lo;
1069+ ++__dest;
1070+ }
1071+ return __hi;
1072+ }
1073+
1074+ char
1075+ ctype<wchar_t>::
1076+ do_narrow(wchar_t __wc, char __dfault) const
1077+ {
1078+ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
1079+ return _M_narrow[__wc];
1080+#ifdef __UCLIBC_HAS_XLOCALE__
1081+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1082+#endif
1083+ const int __c = wctob(__wc);
1084+#ifdef __UCLIBC_HAS_XLOCALE__
1085+ __uselocale(__old);
1086+#endif
1087+ return (__c == EOF ? __dfault : static_cast<char>(__c));
1088+ }
1089+
1090+ const wchar_t*
1091+ ctype<wchar_t>::
1092+ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
1093+ char* __dest) const
1094+ {
1095+#ifdef __UCLIBC_HAS_XLOCALE__
1096+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1097+#endif
1098+ if (_M_narrow_ok)
1099+ while (__lo < __hi)
1100+ {
1101+ if (*__lo >= 0 && *__lo < 128)
1102+ *__dest = _M_narrow[*__lo];
1103+ else
1104+ {
1105+ const int __c = wctob(*__lo);
1106+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1107+ }
1108+ ++__lo;
1109+ ++__dest;
1110+ }
1111+ else
1112+ while (__lo < __hi)
1113+ {
1114+ const int __c = wctob(*__lo);
1115+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1116+ ++__lo;
1117+ ++__dest;
1118+ }
1119+#ifdef __UCLIBC_HAS_XLOCALE__
1120+ __uselocale(__old);
1121+#endif
1122+ return __hi;
1123+ }
1124+
1125+ void
1126+ ctype<wchar_t>::_M_initialize_ctype()
1127+ {
1128+#ifdef __UCLIBC_HAS_XLOCALE__
1129+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1130+#endif
1131+ wint_t __i;
1132+ for (__i = 0; __i < 128; ++__i)
1133+ {
1134+ const int __c = wctob(__i);
1135+ if (__c == EOF)
1136+ break;
1137+ else
1138+ _M_narrow[__i] = static_cast<char>(__c);
1139+ }
1140+ if (__i == 128)
1141+ _M_narrow_ok = true;
1142+ else
1143+ _M_narrow_ok = false;
1144+ for (size_t __j = 0;
1145+ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
1146+ _M_widen[__j] = btowc(__j);
1147+
1148+ for (size_t __k = 0; __k <= 11; ++__k)
1149+ {
1150+ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
1151+ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
1152+ }
1153+#ifdef __UCLIBC_HAS_XLOCALE__
1154+ __uselocale(__old);
1155+#endif
1156+ }
1157+#endif // _GLIBCXX_USE_WCHAR_T
1158+}
1159diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.cc b/libstdc++-v3/config/locale/uclibc/messages_members.cc
1160new file mode 100644
1161index 0000000..13594d9
1162--- /dev/null
1163+++ b/libstdc++-v3/config/locale/uclibc/messages_members.cc
1164@@ -0,0 +1,100 @@
1165+// std::messages implementation details, GNU version -*- C++ -*-
1166+
1167+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1168+//
1169+// This file is part of the GNU ISO C++ Library. This library is free
1170+// software; you can redistribute it and/or modify it under the
1171+// terms of the GNU General Public License as published by the
1172+// Free Software Foundation; either version 2, or (at your option)
1173+// any later version.
1174+
1175+// This library is distributed in the hope that it will be useful,
1176+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1177+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1178+// GNU General Public License for more details.
1179+
1180+// You should have received a copy of the GNU General Public License along
1181+// with this library; see the file COPYING. If not, write to the Free
1182+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1183+// USA.
1184+
1185+// As a special exception, you may use this file as part of a free software
1186+// library without restriction. Specifically, if other files instantiate
1187+// templates or use macros or inline functions from this file, or you compile
1188+// this file and link it with other files to produce an executable, this
1189+// file does not by itself cause the resulting executable to be covered by
1190+// the GNU General Public License. This exception does not however
1191+// invalidate any other reasons why the executable file might be covered by
1192+// the GNU General Public License.
1193+
1194+//
1195+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
1196+//
1197+
1198+// Written by Benjamin Kosnik <bkoz@redhat.com>
1199+
1200+#include <locale>
1201+#include <bits/c++locale_internal.h>
1202+
1203+#ifdef __UCLIBC_MJN3_ONLY__
1204+#warning fix gettext stuff
1205+#endif
1206+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1207+extern "C" char *__dcgettext(const char *domainname,
1208+ const char *msgid, int category);
1209+#undef gettext
1210+#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
1211+#else
1212+#undef gettext
1213+#define gettext(msgid) (msgid)
1214+#endif
1215+
1216+namespace std
1217+{
1218+ // Specializations.
1219+ template<>
1220+ string
1221+ messages<char>::do_get(catalog, int, int, const string& __dfault) const
1222+ {
1223+#ifdef __UCLIBC_HAS_XLOCALE__
1224+ __c_locale __old = __uselocale(_M_c_locale_messages);
1225+ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
1226+ __uselocale(__old);
1227+ return string(__msg);
1228+#elif defined __UCLIBC_HAS_LOCALE__
1229+ char* __old = strdup(setlocale(LC_ALL, NULL));
1230+ setlocale(LC_ALL, _M_name_messages);
1231+ const char* __msg = gettext(__dfault.c_str());
1232+ setlocale(LC_ALL, __old);
1233+ free(__old);
1234+ return string(__msg);
1235+#else
1236+ const char* __msg = gettext(__dfault.c_str());
1237+ return string(__msg);
1238+#endif
1239+ }
1240+
1241+#ifdef _GLIBCXX_USE_WCHAR_T
1242+ template<>
1243+ wstring
1244+ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
1245+ {
1246+# ifdef __UCLIBC_HAS_XLOCALE__
1247+ __c_locale __old = __uselocale(_M_c_locale_messages);
1248+ char* __msg = gettext(_M_convert_to_char(__dfault));
1249+ __uselocale(__old);
1250+ return _M_convert_from_char(__msg);
1251+# elif defined __UCLIBC_HAS_LOCALE__
1252+ char* __old = strdup(setlocale(LC_ALL, NULL));
1253+ setlocale(LC_ALL, _M_name_messages);
1254+ char* __msg = gettext(_M_convert_to_char(__dfault));
1255+ setlocale(LC_ALL, __old);
1256+ free(__old);
1257+ return _M_convert_from_char(__msg);
1258+# else
1259+ char* __msg = gettext(_M_convert_to_char(__dfault));
1260+ return _M_convert_from_char(__msg);
1261+# endif
1262+ }
1263+#endif
1264+}
1265diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.h b/libstdc++-v3/config/locale/uclibc/messages_members.h
1266new file mode 100644
1267index 0000000..1424078
1268--- /dev/null
1269+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
1270@@ -0,0 +1,118 @@
1271+// std::messages implementation details, GNU version -*- C++ -*-
1272+
1273+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1274+//
1275+// This file is part of the GNU ISO C++ Library. This library is free
1276+// software; you can redistribute it and/or modify it under the
1277+// terms of the GNU General Public License as published by the
1278+// Free Software Foundation; either version 2, or (at your option)
1279+// any later version.
1280+
1281+// This library is distributed in the hope that it will be useful,
1282+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1283+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1284+// GNU General Public License for more details.
1285+
1286+// You should have received a copy of the GNU General Public License along
1287+// with this library; see the file COPYING. If not, write to the Free
1288+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1289+// USA.
1290+
1291+// As a special exception, you may use this file as part of a free software
1292+// library without restriction. Specifically, if other files instantiate
1293+// templates or use macros or inline functions from this file, or you compile
1294+// this file and link it with other files to produce an executable, this
1295+// file does not by itself cause the resulting executable to be covered by
1296+// the GNU General Public License. This exception does not however
1297+// invalidate any other reasons why the executable file might be covered by
1298+// the GNU General Public License.
1299+
1300+//
1301+// ISO C++ 14882: 22.2.7.1.2 messages functions
1302+//
1303+
1304+// Written by Benjamin Kosnik <bkoz@redhat.com>
1305+
1306+#ifdef __UCLIBC_MJN3_ONLY__
1307+#warning fix prototypes for *textdomain funcs
1308+#endif
1309+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1310+extern "C" char *__textdomain(const char *domainname);
1311+extern "C" char *__bindtextdomain(const char *domainname,
1312+ const char *dirname);
1313+#else
1314+#undef __textdomain
1315+#undef __bindtextdomain
1316+#define __textdomain(D) ((void)0)
1317+#define __bindtextdomain(D,P) ((void)0)
1318+#endif
1319+
1320+ // Non-virtual member functions.
1321+ template<typename _CharT>
1322+ messages<_CharT>::messages(size_t __refs)
1323+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
1324+ _M_name_messages(_S_get_c_name())
1325+ { }
1326+
1327+ template<typename _CharT>
1328+ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
1329+ size_t __refs)
1330+ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
1331+ _M_name_messages(__s)
1332+ {
1333+ char* __tmp = new char[std::strlen(__s) + 1];
1334+ std::strcpy(__tmp, __s);
1335+ _M_name_messages = __tmp;
1336+ }
1337+
1338+ template<typename _CharT>
1339+ typename messages<_CharT>::catalog
1340+ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
1341+ const char* __dir) const
1342+ {
1343+ __bindtextdomain(__s.c_str(), __dir);
1344+ return this->do_open(__s, __loc);
1345+ }
1346+
1347+ // Virtual member functions.
1348+ template<typename _CharT>
1349+ messages<_CharT>::~messages()
1350+ {
1351+ if (_M_name_messages != _S_get_c_name())
1352+ delete [] _M_name_messages;
1353+ _S_destroy_c_locale(_M_c_locale_messages);
1354+ }
1355+
1356+ template<typename _CharT>
1357+ typename messages<_CharT>::catalog
1358+ messages<_CharT>::do_open(const basic_string<char>& __s,
1359+ const locale&) const
1360+ {
1361+ // No error checking is done, assume the catalog exists and can
1362+ // be used.
1363+ __textdomain(__s.c_str());
1364+ return 0;
1365+ }
1366+
1367+ template<typename _CharT>
1368+ void
1369+ messages<_CharT>::do_close(catalog) const
1370+ { }
1371+
1372+ // messages_byname
1373+ template<typename _CharT>
1374+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
1375+ : messages<_CharT>(__refs)
1376+ {
1377+ if (this->_M_name_messages != locale::facet::_S_get_c_name())
1378+ delete [] this->_M_name_messages;
1379+ char* __tmp = new char[std::strlen(__s) + 1];
1380+ std::strcpy(__tmp, __s);
1381+ this->_M_name_messages = __tmp;
1382+
1383+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
1384+ {
1385+ this->_S_destroy_c_locale(this->_M_c_locale_messages);
1386+ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
1387+ }
1388+ }
1389diff --git a/libstdc++-v3/config/locale/uclibc/monetary_members.cc b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1390new file mode 100644
1391index 0000000..aa52731
1392--- /dev/null
1393+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1394@@ -0,0 +1,692 @@
1395+// std::moneypunct implementation details, GNU version -*- C++ -*-
1396+
1397+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1398+//
1399+// This file is part of the GNU ISO C++ Library. This library is free
1400+// software; you can redistribute it and/or modify it under the
1401+// terms of the GNU General Public License as published by the
1402+// Free Software Foundation; either version 2, or (at your option)
1403+// any later version.
1404+
1405+// This library is distributed in the hope that it will be useful,
1406+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1407+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1408+// GNU General Public License for more details.
1409+
1410+// You should have received a copy of the GNU General Public License along
1411+// with this library; see the file COPYING. If not, write to the Free
1412+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1413+// USA.
1414+
1415+// As a special exception, you may use this file as part of a free software
1416+// library without restriction. Specifically, if other files instantiate
1417+// templates or use macros or inline functions from this file, or you compile
1418+// this file and link it with other files to produce an executable, this
1419+// file does not by itself cause the resulting executable to be covered by
1420+// the GNU General Public License. This exception does not however
1421+// invalidate any other reasons why the executable file might be covered by
1422+// the GNU General Public License.
1423+
1424+//
1425+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
1426+//
1427+
1428+// Written by Benjamin Kosnik <bkoz@redhat.com>
1429+
1430+#define _LIBC
1431+#include <locale>
1432+#undef _LIBC
1433+#include <bits/c++locale_internal.h>
1434+
1435+#ifdef __UCLIBC_MJN3_ONLY__
1436+#warning optimize this for uclibc
1437+#warning tailor for stub locale support
1438+#endif
1439+
1440+#ifndef __UCLIBC_HAS_XLOCALE__
1441+#define __nl_langinfo_l(N, L) nl_langinfo((N))
1442+#endif
1443+
1444+namespace std
1445+{
1446+ // Construct and return valid pattern consisting of some combination of:
1447+ // space none symbol sign value
1448+ money_base::pattern
1449+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
1450+ {
1451+ pattern __ret;
1452+
1453+ // This insanely complicated routine attempts to construct a valid
1454+ // pattern for use with monyepunct. A couple of invariants:
1455+
1456+ // if (__precedes) symbol -> value
1457+ // else value -> symbol
1458+
1459+ // if (__space) space
1460+ // else none
1461+
1462+ // none == never first
1463+ // space never first or last
1464+
1465+ // Any elegant implementations of this are welcome.
1466+ switch (__posn)
1467+ {
1468+ case 0:
1469+ case 1:
1470+ // 1 The sign precedes the value and symbol.
1471+ __ret.field[0] = sign;
1472+ if (__space)
1473+ {
1474+ // Pattern starts with sign.
1475+ if (__precedes)
1476+ {
1477+ __ret.field[1] = symbol;
1478+ __ret.field[3] = value;
1479+ }
1480+ else
1481+ {
1482+ __ret.field[1] = value;
1483+ __ret.field[3] = symbol;
1484+ }
1485+ __ret.field[2] = space;
1486+ }
1487+ else
1488+ {
1489+ // Pattern starts with sign and ends with none.
1490+ if (__precedes)
1491+ {
1492+ __ret.field[1] = symbol;
1493+ __ret.field[2] = value;
1494+ }
1495+ else
1496+ {
1497+ __ret.field[1] = value;
1498+ __ret.field[2] = symbol;
1499+ }
1500+ __ret.field[3] = none;
1501+ }
1502+ break;
1503+ case 2:
1504+ // 2 The sign follows the value and symbol.
1505+ if (__space)
1506+ {
1507+ // Pattern either ends with sign.
1508+ if (__precedes)
1509+ {
1510+ __ret.field[0] = symbol;
1511+ __ret.field[2] = value;
1512+ }
1513+ else
1514+ {
1515+ __ret.field[0] = value;
1516+ __ret.field[2] = symbol;
1517+ }
1518+ __ret.field[1] = space;
1519+ __ret.field[3] = sign;
1520+ }
1521+ else
1522+ {
1523+ // Pattern ends with sign then none.
1524+ if (__precedes)
1525+ {
1526+ __ret.field[0] = symbol;
1527+ __ret.field[1] = value;
1528+ }
1529+ else
1530+ {
1531+ __ret.field[0] = value;
1532+ __ret.field[1] = symbol;
1533+ }
1534+ __ret.field[2] = sign;
1535+ __ret.field[3] = none;
1536+ }
1537+ break;
1538+ case 3:
1539+ // 3 The sign immediately precedes the symbol.
1540+ if (__precedes)
1541+ {
1542+ __ret.field[0] = sign;
1543+ __ret.field[1] = symbol;
1544+ if (__space)
1545+ {
1546+ __ret.field[2] = space;
1547+ __ret.field[3] = value;
1548+ }
1549+ else
1550+ {
1551+ __ret.field[2] = value;
1552+ __ret.field[3] = none;
1553+ }
1554+ }
1555+ else
1556+ {
1557+ __ret.field[0] = value;
1558+ if (__space)
1559+ {
1560+ __ret.field[1] = space;
1561+ __ret.field[2] = sign;
1562+ __ret.field[3] = symbol;
1563+ }
1564+ else
1565+ {
1566+ __ret.field[1] = sign;
1567+ __ret.field[2] = symbol;
1568+ __ret.field[3] = none;
1569+ }
1570+ }
1571+ break;
1572+ case 4:
1573+ // 4 The sign immediately follows the symbol.
1574+ if (__precedes)
1575+ {
1576+ __ret.field[0] = symbol;
1577+ __ret.field[1] = sign;
1578+ if (__space)
1579+ {
1580+ __ret.field[2] = space;
1581+ __ret.field[3] = value;
1582+ }
1583+ else
1584+ {
1585+ __ret.field[2] = value;
1586+ __ret.field[3] = none;
1587+ }
1588+ }
1589+ else
1590+ {
1591+ __ret.field[0] = value;
1592+ if (__space)
1593+ {
1594+ __ret.field[1] = space;
1595+ __ret.field[2] = symbol;
1596+ __ret.field[3] = sign;
1597+ }
1598+ else
1599+ {
1600+ __ret.field[1] = symbol;
1601+ __ret.field[2] = sign;
1602+ __ret.field[3] = none;
1603+ }
1604+ }
1605+ break;
1606+ default:
1607+ ;
1608+ }
1609+ return __ret;
1610+ }
1611+
1612+ template<>
1613+ void
1614+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
1615+ const char*)
1616+ {
1617+ if (!_M_data)
1618+ _M_data = new __moneypunct_cache<char, true>;
1619+
1620+ if (!__cloc)
1621+ {
1622+ // "C" locale
1623+ _M_data->_M_decimal_point = '.';
1624+ _M_data->_M_thousands_sep = ',';
1625+ _M_data->_M_grouping = "";
1626+ _M_data->_M_grouping_size = 0;
1627+ _M_data->_M_curr_symbol = "";
1628+ _M_data->_M_curr_symbol_size = 0;
1629+ _M_data->_M_positive_sign = "";
1630+ _M_data->_M_positive_sign_size = 0;
1631+ _M_data->_M_negative_sign = "";
1632+ _M_data->_M_negative_sign_size = 0;
1633+ _M_data->_M_frac_digits = 0;
1634+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1635+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1636+
1637+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1638+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1639+ }
1640+ else
1641+ {
1642+ // Named locale.
1643+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1644+ __cloc));
1645+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1646+ __cloc));
1647+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1648+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1649+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1650+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1651+
1652+ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1653+ if (!__nposn)
1654+ _M_data->_M_negative_sign = "()";
1655+ else
1656+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1657+ __cloc);
1658+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1659+
1660+ // _Intl == true
1661+ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1662+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1663+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1664+ __cloc));
1665+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1666+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1667+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1668+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1669+ __pposn);
1670+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1671+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1672+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1673+ __nposn);
1674+ }
1675+ }
1676+
1677+ template<>
1678+ void
1679+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
1680+ const char*)
1681+ {
1682+ if (!_M_data)
1683+ _M_data = new __moneypunct_cache<char, false>;
1684+
1685+ if (!__cloc)
1686+ {
1687+ // "C" locale
1688+ _M_data->_M_decimal_point = '.';
1689+ _M_data->_M_thousands_sep = ',';
1690+ _M_data->_M_grouping = "";
1691+ _M_data->_M_grouping_size = 0;
1692+ _M_data->_M_curr_symbol = "";
1693+ _M_data->_M_curr_symbol_size = 0;
1694+ _M_data->_M_positive_sign = "";
1695+ _M_data->_M_positive_sign_size = 0;
1696+ _M_data->_M_negative_sign = "";
1697+ _M_data->_M_negative_sign_size = 0;
1698+ _M_data->_M_frac_digits = 0;
1699+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1700+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1701+
1702+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1703+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1704+ }
1705+ else
1706+ {
1707+ // Named locale.
1708+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1709+ __cloc));
1710+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1711+ __cloc));
1712+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1713+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1714+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1715+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1716+
1717+ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1718+ if (!__nposn)
1719+ _M_data->_M_negative_sign = "()";
1720+ else
1721+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1722+ __cloc);
1723+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1724+
1725+ // _Intl == false
1726+ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1727+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1728+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1729+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1730+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1731+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1732+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1733+ __pposn);
1734+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1735+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1736+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1737+ __nposn);
1738+ }
1739+ }
1740+
1741+ template<>
1742+ moneypunct<char, true>::~moneypunct()
1743+ { delete _M_data; }
1744+
1745+ template<>
1746+ moneypunct<char, false>::~moneypunct()
1747+ { delete _M_data; }
1748+
1749+#ifdef _GLIBCXX_USE_WCHAR_T
1750+ template<>
1751+ void
1752+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
1753+#ifdef __UCLIBC_HAS_XLOCALE__
1754+ const char*)
1755+#else
1756+ const char* __name)
1757+#endif
1758+ {
1759+ if (!_M_data)
1760+ _M_data = new __moneypunct_cache<wchar_t, true>;
1761+
1762+ if (!__cloc)
1763+ {
1764+ // "C" locale
1765+ _M_data->_M_decimal_point = L'.';
1766+ _M_data->_M_thousands_sep = L',';
1767+ _M_data->_M_grouping = "";
1768+ _M_data->_M_grouping_size = 0;
1769+ _M_data->_M_curr_symbol = L"";
1770+ _M_data->_M_curr_symbol_size = 0;
1771+ _M_data->_M_positive_sign = L"";
1772+ _M_data->_M_positive_sign_size = 0;
1773+ _M_data->_M_negative_sign = L"";
1774+ _M_data->_M_negative_sign_size = 0;
1775+ _M_data->_M_frac_digits = 0;
1776+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1777+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1778+
1779+ // Use ctype::widen code without the facet...
1780+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1781+ _M_data->_M_atoms[__i] =
1782+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1783+ }
1784+ else
1785+ {
1786+ // Named locale.
1787+#ifdef __UCLIBC_HAS_XLOCALE__
1788+ __c_locale __old = __uselocale(__cloc);
1789+#else
1790+ // Switch to named locale so that mbsrtowcs will work.
1791+ char* __old = strdup(setlocale(LC_ALL, NULL));
1792+ setlocale(LC_ALL, __name);
1793+#endif
1794+
1795+#ifdef __UCLIBC_MJN3_ONLY__
1796+#warning fix this... should be monetary
1797+#endif
1798+#ifdef __UCLIBC__
1799+# ifdef __UCLIBC_HAS_XLOCALE__
1800+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1801+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1802+# else
1803+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1804+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1805+# endif
1806+#else
1807+ union { char *__s; wchar_t __w; } __u;
1808+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1809+ _M_data->_M_decimal_point = __u.__w;
1810+
1811+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1812+ _M_data->_M_thousands_sep = __u.__w;
1813+#endif
1814+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1815+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1816+
1817+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1818+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1819+ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1820+
1821+ wchar_t* __wcs_ps = 0;
1822+ wchar_t* __wcs_ns = 0;
1823+ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1824+ try
1825+ {
1826+ mbstate_t __state;
1827+ size_t __len = strlen(__cpossign);
1828+ if (__len)
1829+ {
1830+ ++__len;
1831+ memset(&__state, 0, sizeof(mbstate_t));
1832+ __wcs_ps = new wchar_t[__len];
1833+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1834+ _M_data->_M_positive_sign = __wcs_ps;
1835+ }
1836+ else
1837+ _M_data->_M_positive_sign = L"";
1838+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1839+
1840+ __len = strlen(__cnegsign);
1841+ if (!__nposn)
1842+ _M_data->_M_negative_sign = L"()";
1843+ else if (__len)
1844+ {
1845+ ++__len;
1846+ memset(&__state, 0, sizeof(mbstate_t));
1847+ __wcs_ns = new wchar_t[__len];
1848+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1849+ _M_data->_M_negative_sign = __wcs_ns;
1850+ }
1851+ else
1852+ _M_data->_M_negative_sign = L"";
1853+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1854+
1855+ // _Intl == true.
1856+ __len = strlen(__ccurr);
1857+ if (__len)
1858+ {
1859+ ++__len;
1860+ memset(&__state, 0, sizeof(mbstate_t));
1861+ wchar_t* __wcs = new wchar_t[__len];
1862+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1863+ _M_data->_M_curr_symbol = __wcs;
1864+ }
1865+ else
1866+ _M_data->_M_curr_symbol = L"";
1867+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1868+ }
1869+ catch (...)
1870+ {
1871+ delete _M_data;
1872+ _M_data = 0;
1873+ delete __wcs_ps;
1874+ delete __wcs_ns;
1875+#ifdef __UCLIBC_HAS_XLOCALE__
1876+ __uselocale(__old);
1877+#else
1878+ setlocale(LC_ALL, __old);
1879+ free(__old);
1880+#endif
1881+ __throw_exception_again;
1882+ }
1883+
1884+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1885+ __cloc));
1886+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1887+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1888+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1889+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1890+ __pposn);
1891+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1892+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1893+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1894+ __nposn);
1895+
1896+#ifdef __UCLIBC_HAS_XLOCALE__
1897+ __uselocale(__old);
1898+#else
1899+ setlocale(LC_ALL, __old);
1900+ free(__old);
1901+#endif
1902+ }
1903+ }
1904+
1905+ template<>
1906+ void
1907+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
1908+#ifdef __UCLIBC_HAS_XLOCALE__
1909+ const char*)
1910+#else
1911+ const char* __name)
1912+#endif
1913+ {
1914+ if (!_M_data)
1915+ _M_data = new __moneypunct_cache<wchar_t, false>;
1916+
1917+ if (!__cloc)
1918+ {
1919+ // "C" locale
1920+ _M_data->_M_decimal_point = L'.';
1921+ _M_data->_M_thousands_sep = L',';
1922+ _M_data->_M_grouping = "";
1923+ _M_data->_M_grouping_size = 0;
1924+ _M_data->_M_curr_symbol = L"";
1925+ _M_data->_M_curr_symbol_size = 0;
1926+ _M_data->_M_positive_sign = L"";
1927+ _M_data->_M_positive_sign_size = 0;
1928+ _M_data->_M_negative_sign = L"";
1929+ _M_data->_M_negative_sign_size = 0;
1930+ _M_data->_M_frac_digits = 0;
1931+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1932+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1933+
1934+ // Use ctype::widen code without the facet...
1935+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1936+ _M_data->_M_atoms[__i] =
1937+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1938+ }
1939+ else
1940+ {
1941+ // Named locale.
1942+#ifdef __UCLIBC_HAS_XLOCALE__
1943+ __c_locale __old = __uselocale(__cloc);
1944+#else
1945+ // Switch to named locale so that mbsrtowcs will work.
1946+ char* __old = strdup(setlocale(LC_ALL, NULL));
1947+ setlocale(LC_ALL, __name);
1948+#endif
1949+
1950+#ifdef __UCLIBC_MJN3_ONLY__
1951+#warning fix this... should be monetary
1952+#endif
1953+#ifdef __UCLIBC__
1954+# ifdef __UCLIBC_HAS_XLOCALE__
1955+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1956+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1957+# else
1958+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1959+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1960+# endif
1961+#else
1962+ union { char *__s; wchar_t __w; } __u;
1963+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1964+ _M_data->_M_decimal_point = __u.__w;
1965+
1966+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1967+ _M_data->_M_thousands_sep = __u.__w;
1968+#endif
1969+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1970+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1971+
1972+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1973+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1974+ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1975+
1976+ wchar_t* __wcs_ps = 0;
1977+ wchar_t* __wcs_ns = 0;
1978+ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1979+ try
1980+ {
1981+ mbstate_t __state;
1982+ size_t __len;
1983+ __len = strlen(__cpossign);
1984+ if (__len)
1985+ {
1986+ ++__len;
1987+ memset(&__state, 0, sizeof(mbstate_t));
1988+ __wcs_ps = new wchar_t[__len];
1989+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1990+ _M_data->_M_positive_sign = __wcs_ps;
1991+ }
1992+ else
1993+ _M_data->_M_positive_sign = L"";
1994+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1995+
1996+ __len = strlen(__cnegsign);
1997+ if (!__nposn)
1998+ _M_data->_M_negative_sign = L"()";
1999+ else if (__len)
2000+ {
2001+ ++__len;
2002+ memset(&__state, 0, sizeof(mbstate_t));
2003+ __wcs_ns = new wchar_t[__len];
2004+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
2005+ _M_data->_M_negative_sign = __wcs_ns;
2006+ }
2007+ else
2008+ _M_data->_M_negative_sign = L"";
2009+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
2010+
2011+ // _Intl == true.
2012+ __len = strlen(__ccurr);
2013+ if (__len)
2014+ {
2015+ ++__len;
2016+ memset(&__state, 0, sizeof(mbstate_t));
2017+ wchar_t* __wcs = new wchar_t[__len];
2018+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
2019+ _M_data->_M_curr_symbol = __wcs;
2020+ }
2021+ else
2022+ _M_data->_M_curr_symbol = L"";
2023+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
2024+ }
2025+ catch (...)
2026+ {
2027+ delete _M_data;
2028+ _M_data = 0;
2029+ delete __wcs_ps;
2030+ delete __wcs_ns;
2031+#ifdef __UCLIBC_HAS_XLOCALE__
2032+ __uselocale(__old);
2033+#else
2034+ setlocale(LC_ALL, __old);
2035+ free(__old);
2036+#endif
2037+ __throw_exception_again;
2038+ }
2039+
2040+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
2041+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
2042+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
2043+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
2044+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
2045+ __pposn);
2046+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
2047+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
2048+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
2049+ __nposn);
2050+
2051+#ifdef __UCLIBC_HAS_XLOCALE__
2052+ __uselocale(__old);
2053+#else
2054+ setlocale(LC_ALL, __old);
2055+ free(__old);
2056+#endif
2057+ }
2058+ }
2059+
2060+ template<>
2061+ moneypunct<wchar_t, true>::~moneypunct()
2062+ {
2063+ if (_M_data->_M_positive_sign_size)
2064+ delete [] _M_data->_M_positive_sign;
2065+ if (_M_data->_M_negative_sign_size
2066+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2067+ delete [] _M_data->_M_negative_sign;
2068+ if (_M_data->_M_curr_symbol_size)
2069+ delete [] _M_data->_M_curr_symbol;
2070+ delete _M_data;
2071+ }
2072+
2073+ template<>
2074+ moneypunct<wchar_t, false>::~moneypunct()
2075+ {
2076+ if (_M_data->_M_positive_sign_size)
2077+ delete [] _M_data->_M_positive_sign;
2078+ if (_M_data->_M_negative_sign_size
2079+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2080+ delete [] _M_data->_M_negative_sign;
2081+ if (_M_data->_M_curr_symbol_size)
2082+ delete [] _M_data->_M_curr_symbol;
2083+ delete _M_data;
2084+ }
2085+#endif
2086+}
2087diff --git a/libstdc++-v3/config/locale/uclibc/numeric_members.cc b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2088new file mode 100644
2089index 0000000..883ec1a
2090--- /dev/null
2091+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2092@@ -0,0 +1,160 @@
2093+// std::numpunct implementation details, GNU version -*- C++ -*-
2094+
2095+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2096+//
2097+// This file is part of the GNU ISO C++ Library. This library is free
2098+// software; you can redistribute it and/or modify it under the
2099+// terms of the GNU General Public License as published by the
2100+// Free Software Foundation; either version 2, or (at your option)
2101+// any later version.
2102+
2103+// This library is distributed in the hope that it will be useful,
2104+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2105+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2106+// GNU General Public License for more details.
2107+
2108+// You should have received a copy of the GNU General Public License along
2109+// with this library; see the file COPYING. If not, write to the Free
2110+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2111+// USA.
2112+
2113+// As a special exception, you may use this file as part of a free software
2114+// library without restriction. Specifically, if other files instantiate
2115+// templates or use macros or inline functions from this file, or you compile
2116+// this file and link it with other files to produce an executable, this
2117+// file does not by itself cause the resulting executable to be covered by
2118+// the GNU General Public License. This exception does not however
2119+// invalidate any other reasons why the executable file might be covered by
2120+// the GNU General Public License.
2121+
2122+//
2123+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
2124+//
2125+
2126+// Written by Benjamin Kosnik <bkoz@redhat.com>
2127+
2128+#define _LIBC
2129+#include <locale>
2130+#undef _LIBC
2131+#include <bits/c++locale_internal.h>
2132+
2133+#ifdef __UCLIBC_MJN3_ONLY__
2134+#warning tailor for stub locale support
2135+#endif
2136+#ifndef __UCLIBC_HAS_XLOCALE__
2137+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2138+#endif
2139+
2140+namespace std
2141+{
2142+ template<>
2143+ void
2144+ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
2145+ {
2146+ if (!_M_data)
2147+ _M_data = new __numpunct_cache<char>;
2148+
2149+ if (!__cloc)
2150+ {
2151+ // "C" locale
2152+ _M_data->_M_grouping = "";
2153+ _M_data->_M_grouping_size = 0;
2154+ _M_data->_M_use_grouping = false;
2155+
2156+ _M_data->_M_decimal_point = '.';
2157+ _M_data->_M_thousands_sep = ',';
2158+
2159+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2160+ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
2161+
2162+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2163+ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
2164+ }
2165+ else
2166+ {
2167+ // Named locale.
2168+ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
2169+ __cloc));
2170+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
2171+ __cloc));
2172+
2173+ // Check for NULL, which implies no grouping.
2174+ if (_M_data->_M_thousands_sep == '\0')
2175+ _M_data->_M_grouping = "";
2176+ else
2177+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2178+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2179+ }
2180+
2181+ // NB: There is no way to extact this info from posix locales.
2182+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2183+ _M_data->_M_truename = "true";
2184+ _M_data->_M_truename_size = 4;
2185+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2186+ _M_data->_M_falsename = "false";
2187+ _M_data->_M_falsename_size = 5;
2188+ }
2189+
2190+ template<>
2191+ numpunct<char>::~numpunct()
2192+ { delete _M_data; }
2193+
2194+#ifdef _GLIBCXX_USE_WCHAR_T
2195+ template<>
2196+ void
2197+ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
2198+ {
2199+ if (!_M_data)
2200+ _M_data = new __numpunct_cache<wchar_t>;
2201+
2202+ if (!__cloc)
2203+ {
2204+ // "C" locale
2205+ _M_data->_M_grouping = "";
2206+ _M_data->_M_grouping_size = 0;
2207+ _M_data->_M_use_grouping = false;
2208+
2209+ _M_data->_M_decimal_point = L'.';
2210+ _M_data->_M_thousands_sep = L',';
2211+
2212+ // Use ctype::widen code without the facet...
2213+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2214+ _M_data->_M_atoms_out[__i] =
2215+ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
2216+
2217+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2218+ _M_data->_M_atoms_in[__j] =
2219+ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
2220+ }
2221+ else
2222+ {
2223+ // Named locale.
2224+ // NB: In the GNU model wchar_t is always 32 bit wide.
2225+ union { char *__s; wchar_t __w; } __u;
2226+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
2227+ _M_data->_M_decimal_point = __u.__w;
2228+
2229+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
2230+ _M_data->_M_thousands_sep = __u.__w;
2231+
2232+ if (_M_data->_M_thousands_sep == L'\0')
2233+ _M_data->_M_grouping = "";
2234+ else
2235+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2236+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2237+ }
2238+
2239+ // NB: There is no way to extact this info from posix locales.
2240+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2241+ _M_data->_M_truename = L"true";
2242+ _M_data->_M_truename_size = 4;
2243+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2244+ _M_data->_M_falsename = L"false";
2245+ _M_data->_M_falsename_size = 5;
2246+ }
2247+
2248+ template<>
2249+ numpunct<wchar_t>::~numpunct()
2250+ { delete _M_data; }
2251+ #endif
2252+}
2253diff --git a/libstdc++-v3/config/locale/uclibc/time_members.cc b/libstdc++-v3/config/locale/uclibc/time_members.cc
2254new file mode 100644
2255index 0000000..e0707d7
2256--- /dev/null
2257+++ b/libstdc++-v3/config/locale/uclibc/time_members.cc
2258@@ -0,0 +1,406 @@
2259+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2260+
2261+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2262+//
2263+// This file is part of the GNU ISO C++ Library. This library is free
2264+// software; you can redistribute it and/or modify it under the
2265+// terms of the GNU General Public License as published by the
2266+// Free Software Foundation; either version 2, or (at your option)
2267+// any later version.
2268+
2269+// This library is distributed in the hope that it will be useful,
2270+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2271+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2272+// GNU General Public License for more details.
2273+
2274+// You should have received a copy of the GNU General Public License along
2275+// with this library; see the file COPYING. If not, write to the Free
2276+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2277+// USA.
2278+
2279+// As a special exception, you may use this file as part of a free software
2280+// library without restriction. Specifically, if other files instantiate
2281+// templates or use macros or inline functions from this file, or you compile
2282+// this file and link it with other files to produce an executable, this
2283+// file does not by itself cause the resulting executable to be covered by
2284+// the GNU General Public License. This exception does not however
2285+// invalidate any other reasons why the executable file might be covered by
2286+// the GNU General Public License.
2287+
2288+//
2289+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
2290+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
2291+//
2292+
2293+// Written by Benjamin Kosnik <bkoz@redhat.com>
2294+
2295+#include <locale>
2296+#include <bits/c++locale_internal.h>
2297+
2298+#ifdef __UCLIBC_MJN3_ONLY__
2299+#warning tailor for stub locale support
2300+#endif
2301+#ifndef __UCLIBC_HAS_XLOCALE__
2302+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2303+#endif
2304+
2305+namespace std
2306+{
2307+ template<>
2308+ void
2309+ __timepunct<char>::
2310+ _M_put(char* __s, size_t __maxlen, const char* __format,
2311+ const tm* __tm) const
2312+ {
2313+#ifdef __UCLIBC_HAS_XLOCALE__
2314+ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
2315+ _M_c_locale_timepunct);
2316+#else
2317+ char* __old = strdup(setlocale(LC_ALL, NULL));
2318+ setlocale(LC_ALL, _M_name_timepunct);
2319+ const size_t __len = strftime(__s, __maxlen, __format, __tm);
2320+ setlocale(LC_ALL, __old);
2321+ free(__old);
2322+#endif
2323+ // Make sure __s is null terminated.
2324+ if (__len == 0)
2325+ __s[0] = '\0';
2326+ }
2327+
2328+ template<>
2329+ void
2330+ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
2331+ {
2332+ if (!_M_data)
2333+ _M_data = new __timepunct_cache<char>;
2334+
2335+ if (!__cloc)
2336+ {
2337+ // "C" locale
2338+ _M_c_locale_timepunct = _S_get_c_locale();
2339+
2340+ _M_data->_M_date_format = "%m/%d/%y";
2341+ _M_data->_M_date_era_format = "%m/%d/%y";
2342+ _M_data->_M_time_format = "%H:%M:%S";
2343+ _M_data->_M_time_era_format = "%H:%M:%S";
2344+ _M_data->_M_date_time_format = "";
2345+ _M_data->_M_date_time_era_format = "";
2346+ _M_data->_M_am = "AM";
2347+ _M_data->_M_pm = "PM";
2348+ _M_data->_M_am_pm_format = "";
2349+
2350+ // Day names, starting with "C"'s Sunday.
2351+ _M_data->_M_day1 = "Sunday";
2352+ _M_data->_M_day2 = "Monday";
2353+ _M_data->_M_day3 = "Tuesday";
2354+ _M_data->_M_day4 = "Wednesday";
2355+ _M_data->_M_day5 = "Thursday";
2356+ _M_data->_M_day6 = "Friday";
2357+ _M_data->_M_day7 = "Saturday";
2358+
2359+ // Abbreviated day names, starting with "C"'s Sun.
2360+ _M_data->_M_aday1 = "Sun";
2361+ _M_data->_M_aday2 = "Mon";
2362+ _M_data->_M_aday3 = "Tue";
2363+ _M_data->_M_aday4 = "Wed";
2364+ _M_data->_M_aday5 = "Thu";
2365+ _M_data->_M_aday6 = "Fri";
2366+ _M_data->_M_aday7 = "Sat";
2367+
2368+ // Month names, starting with "C"'s January.
2369+ _M_data->_M_month01 = "January";
2370+ _M_data->_M_month02 = "February";
2371+ _M_data->_M_month03 = "March";
2372+ _M_data->_M_month04 = "April";
2373+ _M_data->_M_month05 = "May";
2374+ _M_data->_M_month06 = "June";
2375+ _M_data->_M_month07 = "July";
2376+ _M_data->_M_month08 = "August";
2377+ _M_data->_M_month09 = "September";
2378+ _M_data->_M_month10 = "October";
2379+ _M_data->_M_month11 = "November";
2380+ _M_data->_M_month12 = "December";
2381+
2382+ // Abbreviated month names, starting with "C"'s Jan.
2383+ _M_data->_M_amonth01 = "Jan";
2384+ _M_data->_M_amonth02 = "Feb";
2385+ _M_data->_M_amonth03 = "Mar";
2386+ _M_data->_M_amonth04 = "Apr";
2387+ _M_data->_M_amonth05 = "May";
2388+ _M_data->_M_amonth06 = "Jun";
2389+ _M_data->_M_amonth07 = "Jul";
2390+ _M_data->_M_amonth08 = "Aug";
2391+ _M_data->_M_amonth09 = "Sep";
2392+ _M_data->_M_amonth10 = "Oct";
2393+ _M_data->_M_amonth11 = "Nov";
2394+ _M_data->_M_amonth12 = "Dec";
2395+ }
2396+ else
2397+ {
2398+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2399+
2400+ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
2401+ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
2402+ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
2403+ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
2404+ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
2405+ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
2406+ __cloc);
2407+ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
2408+ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
2409+ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
2410+
2411+ // Day names, starting with "C"'s Sunday.
2412+ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
2413+ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
2414+ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
2415+ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
2416+ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
2417+ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
2418+ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
2419+
2420+ // Abbreviated day names, starting with "C"'s Sun.
2421+ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
2422+ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
2423+ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
2424+ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
2425+ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
2426+ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
2427+ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
2428+
2429+ // Month names, starting with "C"'s January.
2430+ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
2431+ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
2432+ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
2433+ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
2434+ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
2435+ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
2436+ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
2437+ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
2438+ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
2439+ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
2440+ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
2441+ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
2442+
2443+ // Abbreviated month names, starting with "C"'s Jan.
2444+ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
2445+ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
2446+ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
2447+ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
2448+ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
2449+ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
2450+ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
2451+ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
2452+ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
2453+ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
2454+ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
2455+ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
2456+ }
2457+ }
2458+
2459+#ifdef _GLIBCXX_USE_WCHAR_T
2460+ template<>
2461+ void
2462+ __timepunct<wchar_t>::
2463+ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
2464+ const tm* __tm) const
2465+ {
2466+#ifdef __UCLIBC_HAS_XLOCALE__
2467+ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2468+ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
2469+ _M_c_locale_timepunct);
2470+#else
2471+ char* __old = strdup(setlocale(LC_ALL, NULL));
2472+ setlocale(LC_ALL, _M_name_timepunct);
2473+ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
2474+ setlocale(LC_ALL, __old);
2475+ free(__old);
2476+#endif
2477+ // Make sure __s is null terminated.
2478+ if (__len == 0)
2479+ __s[0] = L'\0';
2480+ }
2481+
2482+ template<>
2483+ void
2484+ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
2485+ {
2486+ if (!_M_data)
2487+ _M_data = new __timepunct_cache<wchar_t>;
2488+
2489+#warning wide time stuff
2490+// if (!__cloc)
2491+ {
2492+ // "C" locale
2493+ _M_c_locale_timepunct = _S_get_c_locale();
2494+
2495+ _M_data->_M_date_format = L"%m/%d/%y";
2496+ _M_data->_M_date_era_format = L"%m/%d/%y";
2497+ _M_data->_M_time_format = L"%H:%M:%S";
2498+ _M_data->_M_time_era_format = L"%H:%M:%S";
2499+ _M_data->_M_date_time_format = L"";
2500+ _M_data->_M_date_time_era_format = L"";
2501+ _M_data->_M_am = L"AM";
2502+ _M_data->_M_pm = L"PM";
2503+ _M_data->_M_am_pm_format = L"";
2504+
2505+ // Day names, starting with "C"'s Sunday.
2506+ _M_data->_M_day1 = L"Sunday";
2507+ _M_data->_M_day2 = L"Monday";
2508+ _M_data->_M_day3 = L"Tuesday";
2509+ _M_data->_M_day4 = L"Wednesday";
2510+ _M_data->_M_day5 = L"Thursday";
2511+ _M_data->_M_day6 = L"Friday";
2512+ _M_data->_M_day7 = L"Saturday";
2513+
2514+ // Abbreviated day names, starting with "C"'s Sun.
2515+ _M_data->_M_aday1 = L"Sun";
2516+ _M_data->_M_aday2 = L"Mon";
2517+ _M_data->_M_aday3 = L"Tue";
2518+ _M_data->_M_aday4 = L"Wed";
2519+ _M_data->_M_aday5 = L"Thu";
2520+ _M_data->_M_aday6 = L"Fri";
2521+ _M_data->_M_aday7 = L"Sat";
2522+
2523+ // Month names, starting with "C"'s January.
2524+ _M_data->_M_month01 = L"January";
2525+ _M_data->_M_month02 = L"February";
2526+ _M_data->_M_month03 = L"March";
2527+ _M_data->_M_month04 = L"April";
2528+ _M_data->_M_month05 = L"May";
2529+ _M_data->_M_month06 = L"June";
2530+ _M_data->_M_month07 = L"July";
2531+ _M_data->_M_month08 = L"August";
2532+ _M_data->_M_month09 = L"September";
2533+ _M_data->_M_month10 = L"October";
2534+ _M_data->_M_month11 = L"November";
2535+ _M_data->_M_month12 = L"December";
2536+
2537+ // Abbreviated month names, starting with "C"'s Jan.
2538+ _M_data->_M_amonth01 = L"Jan";
2539+ _M_data->_M_amonth02 = L"Feb";
2540+ _M_data->_M_amonth03 = L"Mar";
2541+ _M_data->_M_amonth04 = L"Apr";
2542+ _M_data->_M_amonth05 = L"May";
2543+ _M_data->_M_amonth06 = L"Jun";
2544+ _M_data->_M_amonth07 = L"Jul";
2545+ _M_data->_M_amonth08 = L"Aug";
2546+ _M_data->_M_amonth09 = L"Sep";
2547+ _M_data->_M_amonth10 = L"Oct";
2548+ _M_data->_M_amonth11 = L"Nov";
2549+ _M_data->_M_amonth12 = L"Dec";
2550+ }
2551+#if 0
2552+ else
2553+ {
2554+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2555+
2556+ union { char *__s; wchar_t *__w; } __u;
2557+
2558+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
2559+ _M_data->_M_date_format = __u.__w;
2560+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
2561+ _M_data->_M_date_era_format = __u.__w;
2562+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
2563+ _M_data->_M_time_format = __u.__w;
2564+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
2565+ _M_data->_M_time_era_format = __u.__w;
2566+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
2567+ _M_data->_M_date_time_format = __u.__w;
2568+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
2569+ _M_data->_M_date_time_era_format = __u.__w;
2570+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
2571+ _M_data->_M_am = __u.__w;
2572+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
2573+ _M_data->_M_pm = __u.__w;
2574+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
2575+ _M_data->_M_am_pm_format = __u.__w;
2576+
2577+ // Day names, starting with "C"'s Sunday.
2578+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
2579+ _M_data->_M_day1 = __u.__w;
2580+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
2581+ _M_data->_M_day2 = __u.__w;
2582+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
2583+ _M_data->_M_day3 = __u.__w;
2584+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
2585+ _M_data->_M_day4 = __u.__w;
2586+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
2587+ _M_data->_M_day5 = __u.__w;
2588+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
2589+ _M_data->_M_day6 = __u.__w;
2590+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
2591+ _M_data->_M_day7 = __u.__w;
2592+
2593+ // Abbreviated day names, starting with "C"'s Sun.
2594+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
2595+ _M_data->_M_aday1 = __u.__w;
2596+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
2597+ _M_data->_M_aday2 = __u.__w;
2598+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
2599+ _M_data->_M_aday3 = __u.__w;
2600+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
2601+ _M_data->_M_aday4 = __u.__w;
2602+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
2603+ _M_data->_M_aday5 = __u.__w;
2604+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
2605+ _M_data->_M_aday6 = __u.__w;
2606+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
2607+ _M_data->_M_aday7 = __u.__w;
2608+
2609+ // Month names, starting with "C"'s January.
2610+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
2611+ _M_data->_M_month01 = __u.__w;
2612+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
2613+ _M_data->_M_month02 = __u.__w;
2614+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
2615+ _M_data->_M_month03 = __u.__w;
2616+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
2617+ _M_data->_M_month04 = __u.__w;
2618+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
2619+ _M_data->_M_month05 = __u.__w;
2620+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
2621+ _M_data->_M_month06 = __u.__w;
2622+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
2623+ _M_data->_M_month07 = __u.__w;
2624+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
2625+ _M_data->_M_month08 = __u.__w;
2626+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
2627+ _M_data->_M_month09 = __u.__w;
2628+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
2629+ _M_data->_M_month10 = __u.__w;
2630+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
2631+ _M_data->_M_month11 = __u.__w;
2632+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
2633+ _M_data->_M_month12 = __u.__w;
2634+
2635+ // Abbreviated month names, starting with "C"'s Jan.
2636+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
2637+ _M_data->_M_amonth01 = __u.__w;
2638+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
2639+ _M_data->_M_amonth02 = __u.__w;
2640+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
2641+ _M_data->_M_amonth03 = __u.__w;
2642+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
2643+ _M_data->_M_amonth04 = __u.__w;
2644+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
2645+ _M_data->_M_amonth05 = __u.__w;
2646+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
2647+ _M_data->_M_amonth06 = __u.__w;
2648+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
2649+ _M_data->_M_amonth07 = __u.__w;
2650+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
2651+ _M_data->_M_amonth08 = __u.__w;
2652+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
2653+ _M_data->_M_amonth09 = __u.__w;
2654+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
2655+ _M_data->_M_amonth10 = __u.__w;
2656+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
2657+ _M_data->_M_amonth11 = __u.__w;
2658+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
2659+ _M_data->_M_amonth12 = __u.__w;
2660+ }
2661+#endif // 0
2662+ }
2663+#endif
2664+}
2665diff --git a/libstdc++-v3/config/locale/uclibc/time_members.h b/libstdc++-v3/config/locale/uclibc/time_members.h
2666new file mode 100644
2667index 0000000..ba8e858
2668--- /dev/null
2669+++ b/libstdc++-v3/config/locale/uclibc/time_members.h
2670@@ -0,0 +1,68 @@
2671+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2672+
2673+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2674+//
2675+// This file is part of the GNU ISO C++ Library. This library is free
2676+// software; you can redistribute it and/or modify it under the
2677+// terms of the GNU General Public License as published by the
2678+// Free Software Foundation; either version 2, or (at your option)
2679+// any later version.
2680+
2681+// This library is distributed in the hope that it will be useful,
2682+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2683+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2684+// GNU General Public License for more details.
2685+
2686+// You should have received a copy of the GNU General Public License along
2687+// with this library; see the file COPYING. If not, write to the Free
2688+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2689+// USA.
2690+
2691+// As a special exception, you may use this file as part of a free software
2692+// library without restriction. Specifically, if other files instantiate
2693+// templates or use macros or inline functions from this file, or you compile
2694+// this file and link it with other files to produce an executable, this
2695+// file does not by itself cause the resulting executable to be covered by
2696+// the GNU General Public License. This exception does not however
2697+// invalidate any other reasons why the executable file might be covered by
2698+// the GNU General Public License.
2699+
2700+//
2701+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
2702+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
2703+//
2704+
2705+// Written by Benjamin Kosnik <bkoz@redhat.com>
2706+
2707+ template<typename _CharT>
2708+ __timepunct<_CharT>::__timepunct(size_t __refs)
2709+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2710+ _M_name_timepunct(_S_get_c_name())
2711+ { _M_initialize_timepunct(); }
2712+
2713+ template<typename _CharT>
2714+ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
2715+ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
2716+ _M_name_timepunct(_S_get_c_name())
2717+ { _M_initialize_timepunct(); }
2718+
2719+ template<typename _CharT>
2720+ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
2721+ size_t __refs)
2722+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2723+ _M_name_timepunct(__s)
2724+ {
2725+ char* __tmp = new char[std::strlen(__s) + 1];
2726+ std::strcpy(__tmp, __s);
2727+ _M_name_timepunct = __tmp;
2728+ _M_initialize_timepunct(__cloc);
2729+ }
2730+
2731+ template<typename _CharT>
2732+ __timepunct<_CharT>::~__timepunct()
2733+ {
2734+ if (_M_name_timepunct != _S_get_c_name())
2735+ delete [] _M_name_timepunct;
2736+ delete _M_data;
2737+ _S_destroy_c_locale(_M_c_locale_timepunct);
2738+ }
2739diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
2740index f40ddcf..c57a751 100755
2741--- a/libstdc++-v3/configure
2742+++ b/libstdc++-v3/configure
2743@@ -15822,6 +15822,9 @@ fi
2744 # Default to "generic".
2745 if test $enable_clocale_flag = auto; then
2746 case ${target_os} in
2747+ *-uclibc*)
2748+ enable_clocale_flag=uclibc
2749+ ;;
2750 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
2751 enable_clocale_flag=gnu
2752 ;;
2753@@ -16079,6 +16082,78 @@ $as_echo "newlib" >&6; }
2754 CTIME_CC=config/locale/generic/time_members.cc
2755 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
2756 ;;
2757+ uclibc)
2758+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: uclibc" >&5
2759+$as_echo "uclibc" >&6; }
2760+
2761+ # Declare intention to use gettext, and add support for specific
2762+ # languages.
2763+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
2764+ ALL_LINGUAS="de fr"
2765+
2766+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
2767+ # Extract the first word of "msgfmt", so it can be a program name with args.
2768+set dummy msgfmt; ac_word=$2
2769+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
2770+$as_echo_n "checking for $ac_word... " >&6; }
2771+if test "${ac_cv_prog_check_msgfmt+set}" = set; then :
2772+ $as_echo_n "(cached) " >&6
2773+else
2774+ if test -n "$check_msgfmt"; then
2775+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
2776+else
2777+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2778+for as_dir in $PATH
2779+do
2780+ IFS=$as_save_IFS
2781+ test -z "$as_dir" && as_dir=.
2782+ for ac_exec_ext in '' $ac_executable_extensions; do
2783+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
2784+ ac_cv_prog_check_msgfmt="yes"
2785+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
2786+ break 2
2787+ fi
2788+done
2789+ done
2790+IFS=$as_save_IFS
2791+
2792+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
2793+fi
2794+fi
2795+check_msgfmt=$ac_cv_prog_check_msgfmt
2796+if test -n "$check_msgfmt"; then
2797+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $check_msgfmt" >&5
2798+$as_echo "$check_msgfmt" >&6; }
2799+else
2800+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
2801+$as_echo "no" >&6; }
2802+fi
2803+
2804+
2805+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
2806+ USE_NLS=yes
2807+ fi
2808+ # Export the build objects.
2809+ for ling in $ALL_LINGUAS; do \
2810+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
2811+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
2812+ done
2813+
2814+
2815+
2816+ CLOCALE_H=config/locale/uclibc/c_locale.h
2817+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
2818+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
2819+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
2820+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
2821+ CMESSAGES_H=config/locale/uclibc/messages_members.h
2822+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
2823+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
2824+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
2825+ CTIME_H=config/locale/uclibc/time_members.h
2826+ CTIME_CC=config/locale/uclibc/time_members.cc
2827+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
2828+ ;;
2829 esac
2830
2831 # This is where the testsuite looks for locale catalogs, using the
2832diff --git a/libstdc++-v3/include/c_compatibility/wchar.h b/libstdc++-v3/include/c_compatibility/wchar.h
2833index 580d725..3fe61b8 100644
2834--- a/libstdc++-v3/include/c_compatibility/wchar.h
2835+++ b/libstdc++-v3/include/c_compatibility/wchar.h
2836@@ -101,7 +101,9 @@ using std::wmemcmp;
2837 using std::wmemcpy;
2838 using std::wmemmove;
2839 using std::wmemset;
2840+#if _GLIBCXX_HAVE_WCSFTIME
2841 using std::wcsftime;
2842+#endif
2843
2844 #if _GLIBCXX_USE_C99
2845 using std::wcstold;
2846diff --git a/libstdc++-v3/include/c_std/cwchar b/libstdc++-v3/include/c_std/cwchar
2847index 0e6b1fc..405aee2 100644
2848--- a/libstdc++-v3/include/c_std/cwchar
2849+++ b/libstdc++-v3/include/c_std/cwchar
2850@@ -175,7 +175,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
2851 using ::wcscoll;
2852 using ::wcscpy;
2853 using ::wcscspn;
2854+#if _GLIBCXX_HAVE_WCSFTIME
2855 using ::wcsftime;
2856+#endif
2857 using ::wcslen;
2858 using ::wcsncat;
2859 using ::wcsncmp;
2860--
28611.7.10.4
2862
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0005-uclibc-locale-no__x.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0005-uclibc-locale-no__x.patch
new file mode 100644
index 0000000..dcbbfe4
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0005-uclibc-locale-no__x.patch
@@ -0,0 +1,257 @@
1From 6a3e8506a12c12728d8b29901defd738be43757f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:42:36 +0400
4Subject: [PATCH 05/35] uclibc-locale-no__x
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 .../config/locale/uclibc/c++locale_internal.h | 45 ++++++++++++++++++++
11 libstdc++-v3/config/locale/uclibc/c_locale.cc | 14 ------
12 libstdc++-v3/config/locale/uclibc/c_locale.h | 1 +
13 .../config/locale/uclibc/collate_members.cc | 7 ---
14 libstdc++-v3/config/locale/uclibc/ctype_members.cc | 7 ---
15 .../config/locale/uclibc/messages_members.cc | 7 +--
16 .../config/locale/uclibc/messages_members.h | 18 +++-----
17 .../config/locale/uclibc/monetary_members.cc | 4 --
18 .../config/locale/uclibc/numeric_members.cc | 3 --
19 libstdc++-v3/config/locale/uclibc/time_members.cc | 3 --
20 10 files changed, 55 insertions(+), 54 deletions(-)
21
22diff --git a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
23index 2ae3e4a..e74fddf 100644
24--- a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
25+++ b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
26@@ -60,4 +60,49 @@ extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
27 extern "C" __typeof(wctype_l) __wctype_l;
28 #endif
29
30+# define __nl_langinfo_l nl_langinfo_l
31+# define __strcoll_l strcoll_l
32+# define __strftime_l strftime_l
33+# define __strtod_l strtod_l
34+# define __strtof_l strtof_l
35+# define __strtold_l strtold_l
36+# define __strxfrm_l strxfrm_l
37+# define __newlocale newlocale
38+# define __freelocale freelocale
39+# define __duplocale duplocale
40+# define __uselocale uselocale
41+
42+# ifdef _GLIBCXX_USE_WCHAR_T
43+# define __iswctype_l iswctype_l
44+# define __towlower_l towlower_l
45+# define __towupper_l towupper_l
46+# define __wcscoll_l wcscoll_l
47+# define __wcsftime_l wcsftime_l
48+# define __wcsxfrm_l wcsxfrm_l
49+# define __wctype_l wctype_l
50+# endif
51+
52+#else
53+# define __nl_langinfo_l(N, L) nl_langinfo((N))
54+# define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
55+# define __strtod_l(S, E, L) strtod((S), (E))
56+# define __strtof_l(S, E, L) strtof((S), (E))
57+# define __strtold_l(S, E, L) strtold((S), (E))
58+# define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
59+# warning should dummy __newlocale check for C|POSIX ?
60+# define __newlocale(a, b, c) NULL
61+# define __freelocale(a) ((void)0)
62+# define __duplocale(a) __c_locale()
63+//# define __uselocale ?
64+//
65+# ifdef _GLIBCXX_USE_WCHAR_T
66+# define __iswctype_l(C, M, L) iswctype((C), (M))
67+# define __towlower_l(C, L) towlower((C))
68+# define __towupper_l(C, L) towupper((C))
69+# define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
70+//# define __wcsftime_l(S, M, F, T, L) wcsftime((S), (M), (F), (T))
71+# define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
72+# define __wctype_l(S, L) wctype((S))
73+# endif
74+
75 #endif // GLIBC 2.3 and later
76diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.cc b/libstdc++-v3/config/locale/uclibc/c_locale.cc
77index 5081dc1..21430d0 100644
78--- a/libstdc++-v3/config/locale/uclibc/c_locale.cc
79+++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc
80@@ -39,20 +39,6 @@
81 #include <langinfo.h>
82 #include <bits/c++locale_internal.h>
83
84-#ifndef __UCLIBC_HAS_XLOCALE__
85-#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
86-#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
87-#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
88-#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
89-#define __strtof_l(S, E, L) strtof((S), (E))
90-#define __strtod_l(S, E, L) strtod((S), (E))
91-#define __strtold_l(S, E, L) strtold((S), (E))
92-#warning should dummy __newlocale check for C|POSIX ?
93-#define __newlocale(a, b, c) NULL
94-#define __freelocale(a) ((void)0)
95-#define __duplocale(a) __c_locale()
96-#endif
97-
98 namespace std
99 {
100 template<>
101diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.h b/libstdc++-v3/config/locale/uclibc/c_locale.h
102index da07c1f..4bca5f1 100644
103--- a/libstdc++-v3/config/locale/uclibc/c_locale.h
104+++ b/libstdc++-v3/config/locale/uclibc/c_locale.h
105@@ -68,6 +68,7 @@ namespace __gnu_cxx
106 {
107 extern "C" __typeof(uselocale) __uselocale;
108 }
109+#define __uselocale uselocale
110 #endif
111
112 namespace std
113diff --git a/libstdc++-v3/config/locale/uclibc/collate_members.cc b/libstdc++-v3/config/locale/uclibc/collate_members.cc
114index c2664a7..ec5c329 100644
115--- a/libstdc++-v3/config/locale/uclibc/collate_members.cc
116+++ b/libstdc++-v3/config/locale/uclibc/collate_members.cc
117@@ -36,13 +36,6 @@
118 #include <locale>
119 #include <bits/c++locale_internal.h>
120
121-#ifndef __UCLIBC_HAS_XLOCALE__
122-#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
123-#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
124-#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
125-#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
126-#endif
127-
128 namespace std
129 {
130 // These are basically extensions to char_traits, and perhaps should
131diff --git a/libstdc++-v3/config/locale/uclibc/ctype_members.cc b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
132index 7294e3a..7b12861 100644
133--- a/libstdc++-v3/config/locale/uclibc/ctype_members.cc
134+++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
135@@ -38,13 +38,6 @@
136 #undef _LIBC
137 #include <bits/c++locale_internal.h>
138
139-#ifndef __UCLIBC_HAS_XLOCALE__
140-#define __wctype_l(S, L) wctype((S))
141-#define __towupper_l(C, L) towupper((C))
142-#define __towlower_l(C, L) towlower((C))
143-#define __iswctype_l(C, M, L) iswctype((C), (M))
144-#endif
145-
146 namespace std
147 {
148 // NB: The other ctype<char> specializations are in src/locale.cc and
149diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.cc b/libstdc++-v3/config/locale/uclibc/messages_members.cc
150index 13594d9..d7693b4 100644
151--- a/libstdc++-v3/config/locale/uclibc/messages_members.cc
152+++ b/libstdc++-v3/config/locale/uclibc/messages_members.cc
153@@ -39,13 +39,10 @@
154 #ifdef __UCLIBC_MJN3_ONLY__
155 #warning fix gettext stuff
156 #endif
157-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
158-extern "C" char *__dcgettext(const char *domainname,
159- const char *msgid, int category);
160 #undef gettext
161-#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
162+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
163+#define gettext(msgid) dcgettext(NULL, msgid, LC_MESSAGES)
164 #else
165-#undef gettext
166 #define gettext(msgid) (msgid)
167 #endif
168
169diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.h b/libstdc++-v3/config/locale/uclibc/messages_members.h
170index 1424078..d89da33 100644
171--- a/libstdc++-v3/config/locale/uclibc/messages_members.h
172+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
173@@ -36,15 +36,11 @@
174 #ifdef __UCLIBC_MJN3_ONLY__
175 #warning fix prototypes for *textdomain funcs
176 #endif
177-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
178-extern "C" char *__textdomain(const char *domainname);
179-extern "C" char *__bindtextdomain(const char *domainname,
180- const char *dirname);
181-#else
182-#undef __textdomain
183-#undef __bindtextdomain
184-#define __textdomain(D) ((void)0)
185-#define __bindtextdomain(D,P) ((void)0)
186+#ifndef __UCLIBC_HAS_GETTEXT_AWARENESS__
187+#undef textdomain
188+#undef bindtextdomain
189+#define textdomain(D) ((void)0)
190+#define bindtextdomain(D,P) ((void)0)
191 #endif
192
193 // Non-virtual member functions.
194@@ -70,7 +66,7 @@ extern "C" char *__bindtextdomain(const char *domainname,
195 messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
196 const char* __dir) const
197 {
198- __bindtextdomain(__s.c_str(), __dir);
199+ bindtextdomain(__s.c_str(), __dir);
200 return this->do_open(__s, __loc);
201 }
202
203@@ -90,7 +86,7 @@ extern "C" char *__bindtextdomain(const char *domainname,
204 {
205 // No error checking is done, assume the catalog exists and can
206 // be used.
207- __textdomain(__s.c_str());
208+ textdomain(__s.c_str());
209 return 0;
210 }
211
212diff --git a/libstdc++-v3/config/locale/uclibc/monetary_members.cc b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
213index aa52731..2e6f80a 100644
214--- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
215+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
216@@ -43,10 +43,6 @@
217 #warning tailor for stub locale support
218 #endif
219
220-#ifndef __UCLIBC_HAS_XLOCALE__
221-#define __nl_langinfo_l(N, L) nl_langinfo((N))
222-#endif
223-
224 namespace std
225 {
226 // Construct and return valid pattern consisting of some combination of:
227diff --git a/libstdc++-v3/config/locale/uclibc/numeric_members.cc b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
228index 883ec1a..2c70642 100644
229--- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
230+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
231@@ -41,9 +41,6 @@
232 #ifdef __UCLIBC_MJN3_ONLY__
233 #warning tailor for stub locale support
234 #endif
235-#ifndef __UCLIBC_HAS_XLOCALE__
236-#define __nl_langinfo_l(N, L) nl_langinfo((N))
237-#endif
238
239 namespace std
240 {
241diff --git a/libstdc++-v3/config/locale/uclibc/time_members.cc b/libstdc++-v3/config/locale/uclibc/time_members.cc
242index e0707d7..d848ed5 100644
243--- a/libstdc++-v3/config/locale/uclibc/time_members.cc
244+++ b/libstdc++-v3/config/locale/uclibc/time_members.cc
245@@ -40,9 +40,6 @@
246 #ifdef __UCLIBC_MJN3_ONLY__
247 #warning tailor for stub locale support
248 #endif
249-#ifndef __UCLIBC_HAS_XLOCALE__
250-#define __nl_langinfo_l(N, L) nl_langinfo((N))
251-#endif
252
253 namespace std
254 {
255--
2561.7.10.4
257
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0006-uclibc-locale-wchar_fix.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0006-uclibc-locale-wchar_fix.patch
new file mode 100644
index 0000000..3406859
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0006-uclibc-locale-wchar_fix.patch
@@ -0,0 +1,68 @@
1From 225511a3aeb193a916b3999f0b640a392caa67cd Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:45:57 +0400
4Subject: [PATCH 06/35] uclibc-locale-wchar_fix
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/config/locale/uclibc/monetary_members.cc | 4 ++--
11 libstdc++-v3/config/locale/uclibc/numeric_members.cc | 13 +++++++++++++
12 2 files changed, 15 insertions(+), 2 deletions(-)
13
14diff --git a/libstdc++-v3/config/locale/uclibc/monetary_members.cc b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
15index 2e6f80a..31ebb9f 100644
16--- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
17+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
18@@ -401,7 +401,7 @@ namespace std
19 # ifdef __UCLIBC_HAS_XLOCALE__
20 _M_data->_M_decimal_point = __cloc->decimal_point_wc;
21 _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
22-# else
23+# elif defined __UCLIBC_HAS_LOCALE__
24 _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
25 _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
26 # endif
27@@ -556,7 +556,7 @@ namespace std
28 # ifdef __UCLIBC_HAS_XLOCALE__
29 _M_data->_M_decimal_point = __cloc->decimal_point_wc;
30 _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
31-# else
32+# elif defined __UCLIBC_HAS_LOCALE__
33 _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
34 _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
35 # endif
36diff --git a/libstdc++-v3/config/locale/uclibc/numeric_members.cc b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
37index 2c70642..d5c8961 100644
38--- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
39+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
40@@ -127,12 +127,25 @@ namespace std
41 {
42 // Named locale.
43 // NB: In the GNU model wchar_t is always 32 bit wide.
44+#ifdef __UCLIBC_MJN3_ONLY__
45+#warning fix this... should be numeric
46+#endif
47+#ifdef __UCLIBC__
48+# ifdef __UCLIBC_HAS_XLOCALE__
49+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
50+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
51+# elif defined __UCLIBC_HAS_LOCALE__
52+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
53+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
54+# endif
55+#else
56 union { char *__s; wchar_t __w; } __u;
57 __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
58 _M_data->_M_decimal_point = __u.__w;
59
60 __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
61 _M_data->_M_thousands_sep = __u.__w;
62+#endif
63
64 if (_M_data->_M_thousands_sep == L'\0')
65 _M_data->_M_grouping = "";
66--
671.7.10.4
68
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0007-uclibc-locale-update.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0007-uclibc-locale-update.patch
new file mode 100644
index 0000000..5851123
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0007-uclibc-locale-update.patch
@@ -0,0 +1,542 @@
1From 6ffe7c46f52d27864c3df3663e16ec9ddee71e8f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:46:58 +0400
4Subject: [PATCH 07/35] uclibc-locale-update
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 .../config/locale/uclibc/c++locale_internal.h | 3 +
11 libstdc++-v3/config/locale/uclibc/c_locale.cc | 74 +++++++++-----------
12 libstdc++-v3/config/locale/uclibc/c_locale.h | 42 ++++++-----
13 libstdc++-v3/config/locale/uclibc/ctype_members.cc | 51 ++++++++++----
14 .../config/locale/uclibc/messages_members.h | 12 ++--
15 .../config/locale/uclibc/monetary_members.cc | 34 +++++----
16 .../config/locale/uclibc/numeric_members.cc | 5 ++
17 libstdc++-v3/config/locale/uclibc/time_members.cc | 18 +++--
18 libstdc++-v3/config/locale/uclibc/time_members.h | 17 +++--
19 9 files changed, 158 insertions(+), 98 deletions(-)
20
21diff --git a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
22index e74fddf..971a6b4 100644
23--- a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
24+++ b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
25@@ -31,6 +31,9 @@
26
27 #include <bits/c++config.h>
28 #include <clocale>
29+#include <cstdlib>
30+#include <cstring>
31+#include <cstddef>
32
33 #ifdef __UCLIBC_MJN3_ONLY__
34 #warning clean this up
35diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.cc b/libstdc++-v3/config/locale/uclibc/c_locale.cc
36index 21430d0..1b9d8e1 100644
37--- a/libstdc++-v3/config/locale/uclibc/c_locale.cc
38+++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc
39@@ -39,23 +39,20 @@
40 #include <langinfo.h>
41 #include <bits/c++locale_internal.h>
42
43-namespace std
44-{
45+_GLIBCXX_BEGIN_NAMESPACE(std)
46+
47 template<>
48 void
49 __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
50 const __c_locale& __cloc)
51 {
52- if (!(__err & ios_base::failbit))
53- {
54- char* __sanity;
55- errno = 0;
56- float __f = __strtof_l(__s, &__sanity, __cloc);
57- if (__sanity != __s && errno != ERANGE)
58- __v = __f;
59- else
60- __err |= ios_base::failbit;
61- }
62+ char* __sanity;
63+ errno = 0;
64+ float __f = __strtof_l(__s, &__sanity, __cloc);
65+ if (__sanity != __s && errno != ERANGE)
66+ __v = __f;
67+ else
68+ __err |= ios_base::failbit;
69 }
70
71 template<>
72@@ -63,16 +60,13 @@ namespace std
73 __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
74 const __c_locale& __cloc)
75 {
76- if (!(__err & ios_base::failbit))
77- {
78- char* __sanity;
79- errno = 0;
80- double __d = __strtod_l(__s, &__sanity, __cloc);
81- if (__sanity != __s && errno != ERANGE)
82- __v = __d;
83- else
84- __err |= ios_base::failbit;
85- }
86+ char* __sanity;
87+ errno = 0;
88+ double __d = __strtod_l(__s, &__sanity, __cloc);
89+ if (__sanity != __s && errno != ERANGE)
90+ __v = __d;
91+ else
92+ __err |= ios_base::failbit;
93 }
94
95 template<>
96@@ -80,16 +74,13 @@ namespace std
97 __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
98 const __c_locale& __cloc)
99 {
100- if (!(__err & ios_base::failbit))
101- {
102- char* __sanity;
103- errno = 0;
104- long double __ld = __strtold_l(__s, &__sanity, __cloc);
105- if (__sanity != __s && errno != ERANGE)
106- __v = __ld;
107- else
108- __err |= ios_base::failbit;
109- }
110+ char* __sanity;
111+ errno = 0;
112+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
113+ if (__sanity != __s && errno != ERANGE)
114+ __v = __ld;
115+ else
116+ __err |= ios_base::failbit;
117 }
118
119 void
120@@ -110,17 +101,18 @@ namespace std
121 void
122 locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
123 {
124- if (_S_get_c_locale() != __cloc)
125+ if (__cloc && _S_get_c_locale() != __cloc)
126 __freelocale(__cloc);
127 }
128
129 __c_locale
130 locale::facet::_S_clone_c_locale(__c_locale& __cloc)
131 { return __duplocale(__cloc); }
132-} // namespace std
133
134-namespace __gnu_cxx
135-{
136+_GLIBCXX_END_NAMESPACE
137+
138+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
139+
140 const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
141 {
142 "LC_CTYPE",
143@@ -138,9 +130,11 @@ namespace __gnu_cxx
144 "LC_IDENTIFICATION"
145 #endif
146 };
147-}
148
149-namespace std
150-{
151+_GLIBCXX_END_NAMESPACE
152+
153+_GLIBCXX_BEGIN_NAMESPACE(std)
154+
155 const char* const* const locale::_S_categories = __gnu_cxx::category_names;
156-} // namespace std
157+
158+_GLIBCXX_END_NAMESPACE
159diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.h b/libstdc++-v3/config/locale/uclibc/c_locale.h
160index 4bca5f1..64a6d46 100644
161--- a/libstdc++-v3/config/locale/uclibc/c_locale.h
162+++ b/libstdc++-v3/config/locale/uclibc/c_locale.h
163@@ -39,21 +39,23 @@
164 #pragma GCC system_header
165
166 #include <cstring> // get std::strlen
167-#include <cstdio> // get std::snprintf or std::sprintf
168+#include <cstdio> // get std::vsnprintf or std::vsprintf
169 #include <clocale>
170 #include <langinfo.h> // For codecvt
171 #ifdef __UCLIBC_MJN3_ONLY__
172 #warning fix this
173 #endif
174-#ifdef __UCLIBC_HAS_LOCALE__
175+#ifdef _GLIBCXX_USE_ICONV
176 #include <iconv.h> // For codecvt using iconv, iconv_t
177 #endif
178-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
179-#include <libintl.h> // For messages
180+#ifdef HAVE_LIBINTL_H
181+#include <libintl.h> // For messages
182 #endif
183+#include <cstdarg>
184
185 #ifdef __UCLIBC_MJN3_ONLY__
186 #warning what is _GLIBCXX_C_LOCALE_GNU for
187+// psm: used in os/gnu-linux/ctype_noninline.h
188 #endif
189 #define _GLIBCXX_C_LOCALE_GNU 1
190
191@@ -78,23 +80,25 @@ namespace std
192 #else
193 typedef int* __c_locale;
194 #endif
195-
196- // Convert numeric value of type _Tv to string and return length of
197- // string. If snprintf is available use it, otherwise fall back to
198- // the unsafe sprintf which, in general, can be dangerous and should
199+ // Convert numeric value of type double to string and return length of
200+ // string. If vsnprintf is available use it, otherwise fall back to
201+ // the unsafe vsprintf which, in general, can be dangerous and should
202 // be avoided.
203- template<typename _Tv>
204- int
205- __convert_from_v(char* __out,
206- const int __size __attribute__ ((__unused__)),
207- const char* __fmt,
208-#ifdef __UCLIBC_HAS_XCLOCALE__
209- _Tv __v, const __c_locale& __cloc, int __prec)
210+ inline int
211+ __convert_from_v(const __c_locale&
212+#ifndef __UCLIBC_HAS_XCLOCALE__
213+ __cloc __attribute__ ((__unused__))
214+#endif
215+ ,
216+ char* __out,
217+ const int __size,
218+ const char* __fmt, ...)
219 {
220+ va_list __args;
221+#ifdef __UCLIBC_HAS_XCLOCALE__
222+
223 __c_locale __old = __gnu_cxx::__uselocale(__cloc);
224 #else
225- _Tv __v, const __c_locale&, int __prec)
226- {
227 # ifdef __UCLIBC_HAS_LOCALE__
228 char* __old = std::setlocale(LC_ALL, NULL);
229 char* __sav = new char[std::strlen(__old) + 1];
230@@ -103,7 +107,9 @@ namespace std
231 # endif
232 #endif
233
234- const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
235+ va_start(__args, __fmt);
236+ const int __ret = std::vsnprintf(__out, __size, __fmt, __args);
237+ va_end(__args);
238
239 #ifdef __UCLIBC_HAS_XCLOCALE__
240 __gnu_cxx::__uselocale(__old);
241diff --git a/libstdc++-v3/config/locale/uclibc/ctype_members.cc b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
242index 7b12861..13e011d 100644
243--- a/libstdc++-v3/config/locale/uclibc/ctype_members.cc
244+++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
245@@ -33,16 +33,20 @@
246
247 // Written by Benjamin Kosnik <bkoz@redhat.com>
248
249+#include <features.h>
250+#ifdef __UCLIBC_HAS_LOCALE__
251 #define _LIBC
252 #include <locale>
253 #undef _LIBC
254+#else
255+#include <locale>
256+#endif
257 #include <bits/c++locale_internal.h>
258
259-namespace std
260-{
261+_GLIBCXX_BEGIN_NAMESPACE(std)
262+
263 // NB: The other ctype<char> specializations are in src/locale.cc and
264 // various /config/os/* files.
265- template<>
266 ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
267 : ctype<char>(0, false, __refs)
268 {
269@@ -57,6 +61,8 @@ namespace std
270 #endif
271 }
272 }
273+ ctype_byname<char>::~ctype_byname()
274+ { }
275
276 #ifdef _GLIBCXX_USE_WCHAR_T
277 ctype<wchar_t>::__wmask_type
278@@ -138,17 +144,33 @@ namespace std
279 ctype<wchar_t>::
280 do_is(mask __m, wchar_t __c) const
281 {
282- // Highest bitmask in ctype_base == 10, but extra in "C"
283- // library for blank.
284+ // The case of __m == ctype_base::space is particularly important,
285+ // due to its use in many istream functions. Therefore we deal with
286+ // it first, exploiting the knowledge that on GNU systems _M_bit[5]
287+ // is the mask corresponding to ctype_base::space. NB: an encoding
288+ // change would not affect correctness!
289+
290 bool __ret = false;
291- const size_t __bitmasksize = 11;
292- for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
293- if (__m & _M_bit[__bitcur]
294- && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
295- {
296- __ret = true;
297- break;
298- }
299+ if (__m == _M_bit[5])
300+ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
301+ else
302+ {
303+ // Highest bitmask in ctype_base == 10, but extra in "C"
304+ // library for blank.
305+ const size_t __bitmasksize = 11;
306+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
307+ if (__m & _M_bit[__bitcur])
308+ {
309+ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
310+ {
311+ __ret = true;
312+ break;
313+ }
314+ else if (__m == _M_bit[__bitcur])
315+ break;
316+ }
317+ }
318+
319 return __ret;
320 }
321
322@@ -290,4 +312,5 @@ namespace std
323 #endif
324 }
325 #endif // _GLIBCXX_USE_WCHAR_T
326-}
327+
328+_GLIBCXX_END_NAMESPACE
329diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.h b/libstdc++-v3/config/locale/uclibc/messages_members.h
330index d89da33..067657a 100644
331--- a/libstdc++-v3/config/locale/uclibc/messages_members.h
332+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
333@@ -53,12 +53,16 @@
334 template<typename _CharT>
335 messages<_CharT>::messages(__c_locale __cloc, const char* __s,
336 size_t __refs)
337- : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
338- _M_name_messages(__s)
339+ : facet(__refs), _M_c_locale_messages(NULL),
340+ _M_name_messages(NULL)
341 {
342- char* __tmp = new char[std::strlen(__s) + 1];
343- std::strcpy(__tmp, __s);
344+ const size_t __len = std::strlen(__s) + 1;
345+ char* __tmp = new char[__len];
346+ std::memcpy(__tmp, __s, __len);
347 _M_name_messages = __tmp;
348+
349+ // Last to avoid leaking memory if new throws.
350+ _M_c_locale_messages = _S_clone_c_locale(__cloc);
351 }
352
353 template<typename _CharT>
354diff --git a/libstdc++-v3/config/locale/uclibc/monetary_members.cc b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
355index 31ebb9f..7679b9c 100644
356--- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
357+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
358@@ -33,9 +33,14 @@
359
360 // Written by Benjamin Kosnik <bkoz@redhat.com>
361
362+#include <features.h>
363+#ifdef __UCLIBC_HAS_LOCALE__
364 #define _LIBC
365 #include <locale>
366 #undef _LIBC
367+#else
368+#include <locale>
369+#endif
370 #include <bits/c++locale_internal.h>
371
372 #ifdef __UCLIBC_MJN3_ONLY__
373@@ -206,7 +211,7 @@ namespace std
374 }
375 break;
376 default:
377- ;
378+ __ret = pattern();
379 }
380 return __ret;
381 }
382@@ -390,7 +395,9 @@ namespace std
383 __c_locale __old = __uselocale(__cloc);
384 #else
385 // Switch to named locale so that mbsrtowcs will work.
386- char* __old = strdup(setlocale(LC_ALL, NULL));
387+ char* __old = setlocale(LC_ALL, NULL);
388+ const size_t __llen = strlen(__old) + 1;
389+ char* __sav = new char[__llen];
390 setlocale(LC_ALL, __name);
391 #endif
392
393@@ -477,8 +484,8 @@ namespace std
394 #ifdef __UCLIBC_HAS_XLOCALE__
395 __uselocale(__old);
396 #else
397- setlocale(LC_ALL, __old);
398- free(__old);
399+ setlocale(LC_ALL, __sav);
400+ delete [] __sav;
401 #endif
402 __throw_exception_again;
403 }
404@@ -498,8 +505,8 @@ namespace std
405 #ifdef __UCLIBC_HAS_XLOCALE__
406 __uselocale(__old);
407 #else
408- setlocale(LC_ALL, __old);
409- free(__old);
410+ setlocale(LC_ALL, __sav);
411+ delete [] __sav;
412 #endif
413 }
414 }
415@@ -545,8 +552,11 @@ namespace std
416 __c_locale __old = __uselocale(__cloc);
417 #else
418 // Switch to named locale so that mbsrtowcs will work.
419- char* __old = strdup(setlocale(LC_ALL, NULL));
420- setlocale(LC_ALL, __name);
421+ char* __old = setlocale(LC_ALL, NULL);
422+ const size_t __llen = strlen(__old) + 1;
423+ char* __sav = new char[__llen];
424+ memcpy(__sav, __old, __llen);
425+ setlocale(LC_ALL, __name);
426 #endif
427
428 #ifdef __UCLIBC_MJN3_ONLY__
429@@ -633,8 +643,8 @@ namespace std
430 #ifdef __UCLIBC_HAS_XLOCALE__
431 __uselocale(__old);
432 #else
433- setlocale(LC_ALL, __old);
434- free(__old);
435+ setlocale(LC_ALL, __sav);
436+ delete [] __sav;
437 #endif
438 __throw_exception_again;
439 }
440@@ -653,8 +663,8 @@ namespace std
441 #ifdef __UCLIBC_HAS_XLOCALE__
442 __uselocale(__old);
443 #else
444- setlocale(LC_ALL, __old);
445- free(__old);
446+ setlocale(LC_ALL, __sav);
447+ delete [] __sav;
448 #endif
449 }
450 }
451diff --git a/libstdc++-v3/config/locale/uclibc/numeric_members.cc b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
452index d5c8961..8ae8969 100644
453--- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
454+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
455@@ -33,9 +33,14 @@
456
457 // Written by Benjamin Kosnik <bkoz@redhat.com>
458
459+#include <features.h>
460+#ifdef __UCLIBC_HAS_LOCALE__
461 #define _LIBC
462 #include <locale>
463 #undef _LIBC
464+#else
465+#include <locale>
466+#endif
467 #include <bits/c++locale_internal.h>
468
469 #ifdef __UCLIBC_MJN3_ONLY__
470diff --git a/libstdc++-v3/config/locale/uclibc/time_members.cc b/libstdc++-v3/config/locale/uclibc/time_members.cc
471index d848ed5..f24d53e 100644
472--- a/libstdc++-v3/config/locale/uclibc/time_members.cc
473+++ b/libstdc++-v3/config/locale/uclibc/time_members.cc
474@@ -53,11 +53,14 @@ namespace std
475 const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
476 _M_c_locale_timepunct);
477 #else
478- char* __old = strdup(setlocale(LC_ALL, NULL));
479+ char* __old = setlocale(LC_ALL, NULL);
480+ const size_t __llen = strlen(__old) + 1;
481+ char* __sav = new char[__llen];
482+ memcpy(__sav, __old, __llen);
483 setlocale(LC_ALL, _M_name_timepunct);
484 const size_t __len = strftime(__s, __maxlen, __format, __tm);
485- setlocale(LC_ALL, __old);
486- free(__old);
487+ setlocale(LC_ALL, __sav);
488+ delete [] __sav;
489 #endif
490 // Make sure __s is null terminated.
491 if (__len == 0)
492@@ -207,11 +210,14 @@ namespace std
493 const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
494 _M_c_locale_timepunct);
495 #else
496- char* __old = strdup(setlocale(LC_ALL, NULL));
497+ char* __old = setlocale(LC_ALL, NULL);
498+ const size_t __llen = strlen(__old) + 1;
499+ char* __sav = new char[__llen];
500+ memcpy(__sav, __old, __llen);
501 setlocale(LC_ALL, _M_name_timepunct);
502 const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
503- setlocale(LC_ALL, __old);
504- free(__old);
505+ setlocale(LC_ALL, __sav);
506+ delete [] __sav;
507 #endif
508 // Make sure __s is null terminated.
509 if (__len == 0)
510diff --git a/libstdc++-v3/config/locale/uclibc/time_members.h b/libstdc++-v3/config/locale/uclibc/time_members.h
511index ba8e858..1665dde 100644
512--- a/libstdc++-v3/config/locale/uclibc/time_members.h
513+++ b/libstdc++-v3/config/locale/uclibc/time_members.h
514@@ -50,12 +50,21 @@
515 __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
516 size_t __refs)
517 : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
518- _M_name_timepunct(__s)
519+ _M_name_timepunct(NULL)
520 {
521- char* __tmp = new char[std::strlen(__s) + 1];
522- std::strcpy(__tmp, __s);
523+ const size_t __len = std::strlen(__s) + 1;
524+ char* __tmp = new char[__len];
525+ std::memcpy(__tmp, __s, __len);
526 _M_name_timepunct = __tmp;
527- _M_initialize_timepunct(__cloc);
528+
529+ try
530+ { _M_initialize_timepunct(__cloc); }
531+ catch(...)
532+ {
533+ delete [] _M_name_timepunct;
534+ __throw_exception_again;
535+ }
536+
537 }
538
539 template<typename _CharT>
540--
5411.7.10.4
542
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0008-missing-execinfo_h.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0008-missing-execinfo_h.patch
new file mode 100644
index 0000000..2823809
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0008-missing-execinfo_h.patch
@@ -0,0 +1,28 @@
1From 9f2158451981cf0a80cfabdc79ae31bb6976a801 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:48:10 +0400
4Subject: [PATCH 08/35] missing-execinfo_h
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 boehm-gc/include/gc.h | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/boehm-gc/include/gc.h b/boehm-gc/include/gc.h
14index c51e017..a7ba8dc 100644
15--- a/boehm-gc/include/gc.h
16+++ b/boehm-gc/include/gc.h
17@@ -503,7 +503,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
18 #if defined(__linux__) || defined(__GLIBC__)
19 # include <features.h>
20 # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
21- && !defined(__ia64__)
22+ && !defined(__ia64__) && !defined(__UCLIBC__)
23 # ifndef GC_HAVE_BUILTIN_BACKTRACE
24 # define GC_HAVE_BUILTIN_BACKTRACE
25 # endif
26--
271.7.10.4
28
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0009-c99-snprintf.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0009-c99-snprintf.patch
new file mode 100644
index 0000000..7168778
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0009-c99-snprintf.patch
@@ -0,0 +1,28 @@
1From e393e076f1ab82d25e1aa04d6edea27b41d3eb06 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:49:03 +0400
4Subject: [PATCH 09/35] c99-snprintf
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/include/c_std/cstdio | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/libstdc++-v3/include/c_std/cstdio b/libstdc++-v3/include/c_std/cstdio
14index e85bd83..6af839a 100644
15--- a/libstdc++-v3/include/c_std/cstdio
16+++ b/libstdc++-v3/include/c_std/cstdio
17@@ -139,7 +139,7 @@ namespace std
18 using ::vsprintf;
19 } // namespace std
20
21-#if _GLIBCXX_USE_C99
22+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
23
24 #undef snprintf
25 #undef vfscanf
26--
271.7.10.4
28
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0010-c99-complex-ugly-hack.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0010-c99-complex-ugly-hack.patch
new file mode 100644
index 0000000..b628571
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0010-c99-complex-ugly-hack.patch
@@ -0,0 +1,29 @@
1From 73f69d806e2c9561a54995223431a1076cfd6164 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:49:57 +0400
4Subject: [PATCH 10/35] c99-complex-ugly-hack
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Inappropriate [embedded specific]
9---
10 libstdc++-v3/configure | 3 +++
11 1 file changed, 3 insertions(+)
12
13diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
14index c57a751..a1333e2 100755
15--- a/libstdc++-v3/configure
16+++ b/libstdc++-v3/configure
17@@ -18734,6 +18734,9 @@ $as_echo_n "checking for ISO C99 support to TR1 in <complex.h>... " >&6; }
18 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
19 /* end confdefs.h. */
20 #include <complex.h>
21+#ifdef __UCLIBC__
22+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
23+#endif
24 int
25 main ()
26 {
27--
281.7.10.4
29
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0011-index_macro.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0011-index_macro.patch
new file mode 100644
index 0000000..8ee79b0
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0011-index_macro.patch
@@ -0,0 +1,44 @@
1From b037953e40312b45ab84ed0a3ad882bb5e413101 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:51:02 +0400
4Subject: [PATCH 11/35] index_macro
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/include/ext/rope | 3 +++
11 libstdc++-v3/include/ext/ropeimpl.h | 3 +++
12 2 files changed, 6 insertions(+)
13
14diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope
15index 38eb1e8..158d21a 100644
16--- a/libstdc++-v3/include/ext/rope
17+++ b/libstdc++-v3/include/ext/rope
18@@ -55,6 +55,9 @@
19 #include <bits/gthr.h>
20 #include <tr1/functional>
21
22+/* cope w/ index defined as macro, SuSv3 proposal */
23+#undef index
24+
25 # ifdef __GC
26 # define __GC_CONST const
27 # else
28diff --git a/libstdc++-v3/include/ext/ropeimpl.h b/libstdc++-v3/include/ext/ropeimpl.h
29index d7b5cbd..b9b3acb 100644
30--- a/libstdc++-v3/include/ext/ropeimpl.h
31+++ b/libstdc++-v3/include/ext/ropeimpl.h
32@@ -48,6 +48,9 @@
33 #include <ext/memory> // For uninitialized_copy_n
34 #include <ext/numeric> // For power
35
36+/* cope w/ index defined as macro, SuSv3 proposal */
37+#undef index
38+
39 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
40 {
41 _GLIBCXX_BEGIN_NAMESPACE_VERSION
42--
431.7.10.4
44
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0013-libstdc-namespace.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0013-libstdc-namespace.patch
new file mode 100644
index 0000000..4a3efde
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0013-libstdc-namespace.patch
@@ -0,0 +1,54 @@
1From 104e4d66208f2726b14d2f5eebce90700cbc83c8 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:54:02 +0400
4Subject: [PATCH 13/35] libstdc++-namespace
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9---
10 libstdc++-v3/config/locale/uclibc/messages_members.h | 4 +++-
11 libstdc++-v3/config/locale/uclibc/time_members.h | 4 +++-
12 2 files changed, 6 insertions(+), 2 deletions(-)
13
14diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.h b/libstdc++-v3/config/locale/uclibc/messages_members.h
15index 067657a..dd76a6c 100644
16--- a/libstdc++-v3/config/locale/uclibc/messages_members.h
17+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
18@@ -32,7 +32,8 @@
19 //
20
21 // Written by Benjamin Kosnik <bkoz@redhat.com>
22-
23+namespace std
24+{
25 #ifdef __UCLIBC_MJN3_ONLY__
26 #warning fix prototypes for *textdomain funcs
27 #endif
28@@ -116,3 +117,4 @@
29 this->_S_create_c_locale(this->_M_c_locale_messages, __s);
30 }
31 }
32+}
33diff --git a/libstdc++-v3/config/locale/uclibc/time_members.h b/libstdc++-v3/config/locale/uclibc/time_members.h
34index 1665dde..905c433 100644
35--- a/libstdc++-v3/config/locale/uclibc/time_members.h
36+++ b/libstdc++-v3/config/locale/uclibc/time_members.h
37@@ -33,7 +33,8 @@
38 //
39
40 // Written by Benjamin Kosnik <bkoz@redhat.com>
41-
42+namespace std
43+{
44 template<typename _CharT>
45 __timepunct<_CharT>::__timepunct(size_t __refs)
46 : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
47@@ -75,3 +76,4 @@
48 delete _M_data;
49 _S_destroy_c_locale(_M_c_locale_timepunct);
50 }
51+}
52--
531.7.10.4
54
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0014-sh-pr24836.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0014-sh-pr24836.patch
new file mode 100644
index 0000000..cb8fd52
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0014-sh-pr24836.patch
@@ -0,0 +1,45 @@
1From edc9acb181810f234b6b9f7d2820b0e4f6a1eeaf Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:54:48 +0400
4Subject: [PATCH 14/35] sh-pr24836
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Pending
9
10http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348
11http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836
12---
13 gcc/configure | 2 +-
14 gcc/configure.ac | 2 +-
15 2 files changed, 2 insertions(+), 2 deletions(-)
16
17diff --git a/gcc/configure b/gcc/configure
18index e12a180..135bbf5 100755
19--- a/gcc/configure
20+++ b/gcc/configure
21@@ -23378,7 +23378,7 @@ foo: .long 25
22 tls_first_minor=14
23 tls_as_opt="-m64 -Aesame --fatal-warnings"
24 ;;
25- sh-*-* | sh[34]-*-*)
26+ sh-*-* | sh[34]*-*-*)
27 conftest_s='
28 .section ".tdata","awT",@progbits
29 foo: .long 25
30diff --git a/gcc/configure.ac b/gcc/configure.ac
31index eba3577..6363a21 100644
32--- a/gcc/configure.ac
33+++ b/gcc/configure.ac
34@@ -3141,7 +3141,7 @@ foo: .long 25
35 tls_first_minor=14
36 tls_as_opt="-m64 -Aesame --fatal-warnings"
37 ;;
38- sh-*-* | sh[34]-*-*)
39+ sh-*-* | sh[34]*-*-*)
40 conftest_s='
41 .section ".tdata","awT",@progbits
42 foo: .long 25
43--
441.7.10.4
45
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch
new file mode 100644
index 0000000..ba0a227
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch
@@ -0,0 +1,39 @@
1From 50e5366005b0f6af27378e2a5c3cb9f9936a7e62 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:58:36 +0400
4Subject: [PATCH 15/35] arm: Use TARGET_ENDIAN_OPTION for determining
5 MULTILIB_DEFAULTS
6
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8
9Upstream-Status: Pending
10---
11 gcc/config/arm/linux-elf.h | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14Index: gcc-4.9-20140316/gcc/config/arm/coff.h
15===================================================================
16--- gcc-4.9-20140316.orig/gcc/config/arm/coff.h
17+++ gcc-4.9-20140316/gcc/config/arm/coff.h
18@@ -33,7 +33,7 @@
19
20 #ifndef MULTILIB_DEFAULTS
21 #define MULTILIB_DEFAULTS \
22- { "marm", "mlittle-endian", "mfloat-abi=soft", "mno-thumb-interwork" }
23+ { "marm", TARGET_ENDIAN_OPTION, "mfloat-abi=soft", "mno-thumb-interwork" }
24 #endif
25
26 /* This is COFF, but prefer stabs. */
27Index: gcc-4.9-20140316/gcc/config/arm/elf.h
28===================================================================
29--- gcc-4.9-20140316.orig/gcc/config/arm/elf.h
30+++ gcc-4.9-20140316/gcc/config/arm/elf.h
31@@ -112,7 +112,7 @@
32
33 #ifndef MULTILIB_DEFAULTS
34 #define MULTILIB_DEFAULTS \
35- { "marm", "mlittle-endian", "mfloat-abi=soft", "mno-thumb-interwork", "fno-leading-underscore" }
36+ { "marm", TARGET_ENDIAN_OPTION, "mfloat-abi=soft", "mno-thumb-interwork", "fno-leading-underscore" }
37 #endif
38
39 #define TARGET_ASM_FILE_START_APP_OFF true
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0016-gcc-poison-system-directories.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0016-gcc-poison-system-directories.patch
new file mode 100644
index 0000000..475ef96
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0016-gcc-poison-system-directories.patch
@@ -0,0 +1,190 @@
1From 160397ef3c3331099af028f1b8d3e085b07d88ad Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:59:00 +0400
4Subject: [PATCH 16/35] gcc: poison-system-directories
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Inappropriate [distribution: codesourcery]
9---
10 gcc/Makefile.in | 2 +-
11 gcc/common.opt | 4 ++++
12 gcc/config.in | 6 ++++++
13 gcc/configure | 20 ++++++++++++++++++--
14 gcc/configure.ac | 10 ++++++++++
15 gcc/doc/invoke.texi | 9 +++++++++
16 gcc/gcc.c | 2 ++
17 gcc/incpath.c | 19 +++++++++++++++++++
18 8 files changed, 69 insertions(+), 3 deletions(-)
19
20Index: gcc-4.9-20140316/gcc/common.opt
21===================================================================
22--- gcc-4.9-20140316.orig/gcc/common.opt
23+++ gcc-4.9-20140316/gcc/common.opt
24@@ -603,6 +603,10 @@ Wpedantic
25 Common Var(pedantic) Warning
26 Issue warnings needed for strict compliance to the standard
27
28+Wpoison-system-directories
29+Common Var(flag_poison_system_directories) Init(1) Warning
30+Warn for -I and -L options using system directories if cross compiling
31+
32 Wshadow
33 Common Var(warn_shadow) Warning
34 Warn when one local variable shadows another
35Index: gcc-4.9-20140316/gcc/config.in
36===================================================================
37--- gcc-4.9-20140316.orig/gcc/config.in
38+++ gcc-4.9-20140316/gcc/config.in
39@@ -138,6 +138,12 @@
40 #endif
41
42
43+/* Define to warn for use of native system header directories */
44+#ifndef USED_FOR_TARGET
45+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
46+#endif
47+
48+
49 /* Define if you want all operations on RTL (the basic data structure of the
50 optimizer and back end) to be checked for dynamic type safety at runtime.
51 This is quite expensive. */
52Index: gcc-4.9-20140316/gcc/configure
53===================================================================
54--- gcc-4.9-20140316.orig/gcc/configure
55+++ gcc-4.9-20140316/gcc/configure
56@@ -928,6 +928,7 @@ with_system_zlib
57 enable_maintainer_mode
58 enable_link_mutex
59 enable_version_specific_runtime_libs
60+enable_poison_system_directories
61 enable_plugin
62 enable_host_shared
63 enable_libquadmath_support
64@@ -1648,6 +1649,8 @@ Optional Features:
65 --enable-version-specific-runtime-libs
66 specify that runtime libraries should be installed
67 in a compiler-specific directory
68+ --enable-poison-system-directories
69+ warn for use of native system header directories
70 --enable-plugin enable plugin support
71 --enable-host-shared build host code as shared libraries
72 --disable-libquadmath-support
73@@ -27702,6 +27705,19 @@ if test "${enable_version_specific_runti
74 fi
75
76
77+# Check whether --enable-poison-system-directories was given.
78+if test "${enable_poison_system_directories+set}" = set; then :
79+ enableval=$enable_poison_system_directories;
80+else
81+ enable_poison_system_directories=no
82+fi
83+
84+if test "x${enable_poison_system_directories}" = "xyes"; then
85+
86+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
87+
88+fi
89+
90 # Substitute configuration variables
91
92
93Index: gcc-4.9-20140316/gcc/configure.ac
94===================================================================
95--- gcc-4.9-20140316.orig/gcc/configure.ac
96+++ gcc-4.9-20140316/gcc/configure.ac
97@@ -5366,6 +5366,16 @@ AC_ARG_ENABLE(version-specific-runtime-l
98 [specify that runtime libraries should be
99 installed in a compiler-specific directory])])
100
101+AC_ARG_ENABLE([poison-system-directories],
102+ AS_HELP_STRING([--enable-poison-system-directories],
103+ [warn for use of native system header directories]),,
104+ [enable_poison_system_directories=no])
105+if test "x${enable_poison_system_directories}" = "xyes"; then
106+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
107+ [1],
108+ [Define to warn for use of native system header directories])
109+fi
110+
111 # Substitute configuration variables
112 AC_SUBST(subdirs)
113 AC_SUBST(srcdir)
114Index: gcc-4.9-20140316/gcc/doc/invoke.texi
115===================================================================
116--- gcc-4.9-20140316.orig/gcc/doc/invoke.texi
117+++ gcc-4.9-20140316/gcc/doc/invoke.texi
118@@ -260,6 +260,7 @@ Objective-C and Objective-C++ Dialects}.
119 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
120 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
121 -Wpointer-arith -Wno-pointer-to-int-cast @gol
122+-Wno-poison-system-directories @gol
123 -Wredundant-decls -Wno-return-local-addr @gol
124 -Wreturn-type -Wsequence-point -Wshadow @gol
125 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
126@@ -4230,6 +4231,14 @@ headers---for that, @option{-Wunknown-pr
127 for most targets, it is made up of code and thus requires the stack
128 to be made executable in order for the program to work properly.
129
130+@item -Wno-poison-system-directories
131+@opindex Wno-poison-system-directories
132+Do not warn for @option{-I} or @option{-L} options using system
133+directories such as @file{/usr/include} when cross compiling. This
134+option is intended for use in chroot environments when such
135+directories contain the correct headers and libraries for the target
136+system rather than the host.
137+
138 @item -Wfloat-equal
139 @opindex Wfloat-equal
140 @opindex Wno-float-equal
141Index: gcc-4.9-20140316/gcc/gcc.c
142===================================================================
143--- gcc-4.9-20140316.orig/gcc/gcc.c
144+++ gcc-4.9-20140316/gcc/gcc.c
145@@ -764,6 +764,8 @@ proper position among the other output f
146 "%{fuse-ld=*:-fuse-ld=%*}\
147 %X %{o*} %{e*} %{N} %{n} %{r}\
148 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \
149+ %{Wno-poison-system-directories:--no-poison-system-directories}\
150+ %{Werror=poison-system-directories:--error-poison-system-directories}\
151 %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\
152 %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
153 %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
154Index: gcc-4.9-20140316/gcc/incpath.c
155===================================================================
156--- gcc-4.9-20140316.orig/gcc/incpath.c
157+++ gcc-4.9-20140316/gcc/incpath.c
158@@ -28,6 +28,7 @@
159 #include "intl.h"
160 #include "incpath.h"
161 #include "cppdefault.h"
162+#include "diagnostic-core.h"
163
164 /* Microsoft Windows does not natively support inodes.
165 VMS has non-numeric inodes. */
166@@ -382,6 +383,24 @@ merge_include_chains (const char *sysroo
167 }
168 fprintf (stderr, _("End of search list.\n"));
169 }
170+
171+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
172+ if (flag_poison_system_directories)
173+ {
174+ struct cpp_dir *p;
175+
176+ for (p = heads[QUOTE]; p; p = p->next)
177+ {
178+ if ((!strncmp (p->name, "/usr/include", 12))
179+ || (!strncmp (p->name, "/usr/local/include", 18))
180+ || (!strncmp (p->name, "/usr/X11R6/include", 18)))
181+ warning (OPT_Wpoison_system_directories,
182+ "include location \"%s\" is unsafe for "
183+ "cross-compilation",
184+ p->name);
185+ }
186+ }
187+#endif
188 }
189
190 /* Use given -I paths for #include "..." but not #include <...>, and
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0017-gcc-poison-dir-extend.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0017-gcc-poison-dir-extend.patch
new file mode 100644
index 0000000..9e81efd
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0017-gcc-poison-dir-extend.patch
@@ -0,0 +1,39 @@
1From e99c9c97266d6d3e8cac798aa91408250c4d60cf Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:00:34 +0400
4Subject: [PATCH 17/35] gcc-poison-dir-extend
5
6Add /sw/include and /opt/include based on the original
7zecke-no-host-includes.patch patch. The original patch checked for
8/usr/include, /sw/include and /opt/include and then triggered a failure and
9aborted.
10
11Instead, we add the two missing items to the current scan. If the user
12wants this to be a failure, they can add "-Werror=poison-system-directories".
13
14Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16
17Upstream-Status: Pending
18---
19 gcc/incpath.c | 4 +++-
20 1 file changed, 3 insertions(+), 1 deletion(-)
21
22diff --git a/gcc/incpath.c b/gcc/incpath.c
23index cd41c78..eac4a92 100644
24--- a/gcc/incpath.c
25+++ b/gcc/incpath.c
26@@ -393,7 +393,9 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
27 {
28 if ((!strncmp (p->name, "/usr/include", 12))
29 || (!strncmp (p->name, "/usr/local/include", 18))
30- || (!strncmp (p->name, "/usr/X11R6/include", 18)))
31+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
32+ || (!strncmp (p->name, "/sw/include", 11))
33+ || (!strncmp (p->name, "/opt/include", 12)))
34 warning (OPT_Wpoison_system_directories,
35 "include location \"%s\" is unsafe for "
36 "cross-compilation",
37--
381.7.10.4
39
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000..a28cafd
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
@@ -0,0 +1,73 @@
1From 56207fa2923e8edf774e98ffac82666091076be3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:08:31 +0400
4Subject: [PATCH 18/35] gcc-4.3.3: SYSROOT_CFLAGS_FOR_TARGET
5
6Before committing, I noticed that PR/32161 was marked as a dup of PR/32009, but my previous patch did not fix it.
7
8This alternative patch is better because it lets you just use CFLAGS_FOR_TARGET to set the compilation flags for libgcc. Since bootstrapped target libraries are never compiled with the native compiler, it makes little sense to use different flags for stage1 and later stages. And it also makes little sense to use a different variable than CFLAGS_FOR_TARGET.
9
10Other changes I had to do include:
11
12- moving the creation of default CFLAGS_FOR_TARGET from Makefile.am to configure.ac, because otherwise the BOOT_CFLAGS are substituted into CFLAGS_FOR_TARGET (which is "-O2 -g $(CFLAGS)") via $(CFLAGS). It is also cleaner this way though.
13
14- passing the right CFLAGS to configure scripts as exported environment variables
15
16I also stopped passing LIBCFLAGS to configure scripts since they are unused in the whole src tree. And I updated the documentation as H-P reminded me to do.
17
18Bootstrapped/regtested i686-pc-linux-gnu, will commit to 4.4 shortly. Ok for 4.3?
19
20Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
21Signed-off-by: Khem Raj <raj.khem@gmail.com>
22
23Upstream-Status: Pending
24---
25 configure | 32 ++++++++++++++++++++++++++++++++
26 1 file changed, 32 insertions(+)
27
28diff --git a/configure b/configure
29index 1b76c90..e4dce7c 100755
30--- a/configure
31+++ b/configure
32@@ -6772,6 +6772,38 @@ fi
33
34
35
36+# During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
37+# might be empty or "-g". We don't require a C++ compiler, so CXXFLAGS
38+# might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
39+# We want to ensure that TARGET libraries (which we know are built with
40+# gcc) are built with "-O2 -g", so include those options when setting
41+# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
42+if test "x$CFLAGS_FOR_TARGET" = x; then
43+ CFLAGS_FOR_TARGET=$CFLAGS
44+ case " $CFLAGS " in
45+ *" -O2 "*) ;;
46+ *) CFLAGS_FOR_TARGET="-O2 $CFLAGS" ;;
47+ esac
48+ case " $CFLAGS " in
49+ *" -g "* | *" -g3 "*) ;;
50+ *) CFLAGS_FOR_TARGET="-g $CFLAGS" ;;
51+ esac
52+fi
53+
54+
55+if test "x$CXXFLAGS_FOR_TARGET" = x; then
56+ CXXFLAGS_FOR_TARGET=$CXXFLAGS
57+ case " $CXXFLAGS " in
58+ *" -O2 "*) ;;
59+ *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS" ;;
60+ esac
61+ case " $CXXFLAGS " in
62+ *" -g "* | *" -g3 "*) ;;
63+ *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS" ;;
64+ esac
65+fi
66+
67+
68 # Handle --with-headers=XXX. If the value is not "yes", the contents of
69 # the named directory are copied to $(tooldir)/sys-include.
70 if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
71--
721.7.10.4
73
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0019-64-bit-multilib-hack.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0019-64-bit-multilib-hack.patch
new file mode 100644
index 0000000..058be0c
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0019-64-bit-multilib-hack.patch
@@ -0,0 +1,82 @@
1From 18fde5740b09324dfb9cf41e9849672573ff5fa0 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:10:06 +0400
4Subject: [PATCH 19/35] 64-bit multilib hack.
5
6GCC has internal multilib handling code but it assumes a very specific rigid directory
7layout. The build system implementation of multilib layout is very generic and allows
8complete customisation of the library directories.
9
10This patch is a partial solution to allow any custom directories to be passed into gcc
11and handled correctly. It forces gcc to use the base_libdir (which is the current
12directory, "."). We need to do this for each multilib that is configured as we don't
13know which compiler options may be being passed into the compiler. Since we have a compiler
14per mulitlib at this point that isn't an issue.
15
16The one problem is the target compiler is only going to work for the default multlilib at
17this point. Ideally we'd figure out which multilibs were being enabled with which paths
18and be able to patch these entries with a complete set of correct paths but this we
19don't have such code at this point. This is something the target gcc recipe should do
20and override these platform defaults in its build config.
21
22RP 15/8/11
23
24Signed-off-by: Khem Raj <raj.khem@gmail.com>
25Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>
26
27Upstream-Status: Pending
28---
29 gcc/config/i386/t-linux64 | 6 ++----
30 gcc/config/mips/t-linux64 | 10 +++-------
31 gcc/config/rs6000/t-linux64 | 5 ++---
32 3 files changed, 7 insertions(+), 14 deletions(-)
33
34Index: gcc-4.9-20140316/gcc/config/i386/t-linux64
35===================================================================
36--- gcc-4.9-20140316.orig/gcc/config/i386/t-linux64
37+++ gcc-4.9-20140316/gcc/config/i386/t-linux64
38@@ -32,7 +32,5 @@
39 #
40 comma=,
41 MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
42-MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
43-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
44-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
45-MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
46+MULTILIB_DIRNAMES = . .
47+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
48Index: gcc-4.9-20140316/gcc/config/mips/t-linux64
49===================================================================
50--- gcc-4.9-20140316.orig/gcc/config/mips/t-linux64
51+++ gcc-4.9-20140316/gcc/config/mips/t-linux64
52@@ -17,10 +17,6 @@
53 # <http://www.gnu.org/licenses/>.
54
55 MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
56-MULTILIB_DIRNAMES = n32 32 64
57-MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
58-MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
59-MULTILIB_OSDIRNAMES = \
60- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
61- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
62- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
63+MULTILIB_DIRNAMES = . . .
64+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
65+
66Index: gcc-4.9-20140316/gcc/config/rs6000/t-linux64
67===================================================================
68--- gcc-4.9-20140316.orig/gcc/config/rs6000/t-linux64
69+++ gcc-4.9-20140316/gcc/config/rs6000/t-linux64
70@@ -26,10 +26,9 @@
71 # MULTILIB_OSDIRNAMES according to what is found on the target.
72
73 MULTILIB_OPTIONS := m64/m32
74-MULTILIB_DIRNAMES := 64 32
75+MULTILIB_DIRNAMES := . .
76 MULTILIB_EXTRA_OPTS :=
77-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
78-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
79+MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
80
81 rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
82 $(COMPILE) $<
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0020-optional-libstdc.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0020-optional-libstdc.patch
new file mode 100644
index 0000000..5b46614
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0020-optional-libstdc.patch
@@ -0,0 +1,98 @@
1From 307c8ff3ef666b7bd5ac733863f2fbb27a9d521e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:12:56 +0400
4Subject: [PATCH 20/35] optional libstdc
5
6gcc-runtime builds libstdc++ separately from gcc-cross-*. Its configure tests using g++
7will not run correctly since by default the linker will try to link against libstdc++
8which shouldn't exist yet. We need an option to disable -lstdc++
9option whilst leaving -lc, -lgcc and other automatic library dependencies added by gcc
10driver. This patch adds such an option which only disables the -lstdc++.
11
12A "standard" gcc build uses xgcc and hence avoids this. We should ask upstream how to
13do this officially, the likely answer is don't build libstdc++ separately.
14
15RP 29/6/10
16
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18
19Upstream-Status: Inappropriate [embedded specific]
20---
21 gcc/c-family/c.opt | 4 ++++
22 gcc/cp/g++spec.c | 1 +
23 gcc/doc/invoke.texi | 9 +++++++--
24 gcc/gcc.c | 1 +
25 4 files changed, 13 insertions(+), 2 deletions(-)
26
27Index: gcc-4.9-20140316/gcc/c-family/c.opt
28===================================================================
29--- gcc-4.9-20140316.orig/gcc/c-family/c.opt
30+++ gcc-4.9-20140316/gcc/c-family/c.opt
31@@ -1323,6 +1323,10 @@ nostdinc++
32 C++ ObjC++
33 Do not search standard system include directories for C++
34
35+nostdlib++
36+Driver
37+Do not link standard C++ runtime library
38+
39 o
40 C ObjC C++ ObjC++ Joined Separate
41 ; Documented in common.opt
42Index: gcc-4.9-20140316/gcc/cp/g++spec.c
43===================================================================
44--- gcc-4.9-20140316.orig/gcc/cp/g++spec.c
45+++ gcc-4.9-20140316/gcc/cp/g++spec.c
46@@ -138,6 +138,7 @@ lang_specific_driver (struct cl_decoded_
47 switch (decoded_options[i].opt_index)
48 {
49 case OPT_nostdlib:
50+ case OPT_nostdlib__:
51 case OPT_nodefaultlibs:
52 library = -1;
53 break;
54Index: gcc-4.9-20140316/gcc/doc/invoke.texi
55===================================================================
56--- gcc-4.9-20140316.orig/gcc/doc/invoke.texi
57+++ gcc-4.9-20140316/gcc/doc/invoke.texi
58@@ -193,6 +193,7 @@ in the following sections.
59 -fvisibility-inlines-hidden @gol
60 -fvtable-verify=@var{std|preinit|none} @gol
61 -fvtv-counts -fvtv-debug @gol
62+-nostdlib++ @gol
63 -fvisibility-ms-compat @gol
64 -fext-numeric-literals @gol
65 -Wabi -Wconversion-null -Wctor-dtor-privacy @gol
66@@ -457,7 +458,7 @@ Objective-C and Objective-C++ Dialects}.
67 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
68 -s -static -static-libgcc -static-libstdc++ @gol
69 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
70--shared -shared-libgcc -symbolic @gol
71+-shared -shared-libgcc -symbolic -nostdlib++ @gol
72 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
73 -u @var{symbol}}
74
75@@ -10285,6 +10286,11 @@ These entries are usually resolved by en
76 libc. These entry points should be supplied through some other
77 mechanism when this option is specified.
78
79+@item -nostdlib++
80+@opindex nostdlib++
81+Do not use the standard system C++ runtime libraries when linking.
82+Only the libraries you specify will be passed to the linker.
83+
84 @cindex @option{-lgcc}, use with @option{-nostdlib}
85 @cindex @option{-nostdlib} and unresolved references
86 @cindex unresolved references and @option{-nostdlib}
87Index: gcc-4.9-20140316/gcc/gcc.c
88===================================================================
89--- gcc-4.9-20140316.orig/gcc/gcc.c
90+++ gcc-4.9-20140316/gcc/gcc.c
91@@ -772,6 +772,7 @@ proper position among the other output f
92 %(mflib) " STACK_SPLIT_SPEC "\
93 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \
94 %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
95+ %{!nostdlib++:}\
96 %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
97 #endif
98
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch
new file mode 100644
index 0000000..eb3c61f
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch
@@ -0,0 +1,59 @@
1From 004696e054ae9dc71d512cc755ccc4074fc62b2d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:14:20 +0400
4Subject: [PATCH 21/35] gcc: disable MASK_RELAX_PIC_CALLS bit
5
6The new feature added after 4.3.3
7"http://www.pubbs.net/200909/gcc/94048-patch-add-support-for-rmipsjalr.html"
8will cause cc1plus eat up all the system memory when build webkit-gtk.
9The function mips_get_pic_call_symbol keeps on recursively calling itself.
10Disable this feature to walk aside the bug.
11
12Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14
15Upstream-Status: Inappropriate [configuration]
16---
17 gcc/configure | 7 -------
18 gcc/configure.ac | 7 -------
19 2 files changed, 14 deletions(-)
20
21diff --git a/gcc/configure b/gcc/configure
22index b65d21d..bdab45a 100755
23--- a/gcc/configure
24+++ b/gcc/configure
25@@ -25829,13 +25829,6 @@ $as_echo_n "checking assembler and linker for explicit JALR relocation... " >&6;
26 rm -f conftest.*
27 fi
28 fi
29- if test $gcc_cv_as_ld_jalr_reloc = yes; then
30- if test x$target_cpu_default = x; then
31- target_cpu_default=MASK_RELAX_PIC_CALLS
32- else
33- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
34- fi
35- fi
36 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_ld_jalr_reloc" >&5
37 $as_echo "$gcc_cv_as_ld_jalr_reloc" >&6; }
38
39diff --git a/gcc/configure.ac b/gcc/configure.ac
40index e226b85..5f5c909 100644
41--- a/gcc/configure.ac
42+++ b/gcc/configure.ac
43@@ -4099,13 +4099,6 @@ x:
44 rm -f conftest.*
45 fi
46 fi
47- if test $gcc_cv_as_ld_jalr_reloc = yes; then
48- if test x$target_cpu_default = x; then
49- target_cpu_default=MASK_RELAX_PIC_CALLS
50- else
51- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
52- fi
53- fi
54 AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc)
55
56 AC_CACHE_CHECK([linker for .eh_frame personality relaxation],
57--
581.7.10.4
59
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0022-COLLECT_GCC_OPTIONS.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0022-COLLECT_GCC_OPTIONS.patch
new file mode 100644
index 0000000..40c8abf
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0022-COLLECT_GCC_OPTIONS.patch
@@ -0,0 +1,38 @@
1From 7f5c9dcc71c8b83a0b5596266cc4bdf0936e8e00 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:16:28 +0400
4Subject: [PATCH 22/35] COLLECT_GCC_OPTIONS
5
6This patch adds --sysroot into COLLECT_GCC_OPTIONS which is used to
7invoke collect2.
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11Upstream-Status: Pending
12---
13 gcc/gcc.c | 9 +++++++++
14 1 file changed, 9 insertions(+)
15
16diff --git a/gcc/gcc.c b/gcc/gcc.c
17index 477752f..51062aa 100644
18--- a/gcc/gcc.c
19+++ b/gcc/gcc.c
20@@ -4098,6 +4098,15 @@ set_collect_gcc_options (void)
21 sizeof ("COLLECT_GCC_OPTIONS=") - 1);
22
23 first_time = TRUE;
24+#ifdef HAVE_LD_SYSROOT
25+ if (target_system_root_changed && target_system_root)
26+ {
27+ obstack_grow (&collect_obstack, "'--sysroot=", sizeof("'--sysroot=")-1);
28+ obstack_grow (&collect_obstack, target_system_root,strlen(target_system_root));
29+ obstack_grow (&collect_obstack, "'", 1);
30+ first_time = FALSE;
31+ }
32+#endif
33 for (i = 0; (int) i < n_switches; i++)
34 {
35 const char *const *args;
36--
371.7.10.4
38
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
new file mode 100644
index 0000000..9e4435c
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
@@ -0,0 +1,88 @@
1From 46d52439052f0876a92dcf8a0ab9c60d75c8030b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:17:25 +0400
4Subject: [PATCH 23/35] Use the defaults.h in ${B} instead of ${S}, and t-oe
5 in ${B}
6
7Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}, so that
8the source can be shared between gcc-cross-initial,
9gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13Upstream-Status: Pending
14---
15 gcc/Makefile.in | 2 +-
16 gcc/configure | 4 ++--
17 gcc/configure.ac | 4 ++--
18 gcc/mkconfig.sh | 4 ++--
19 4 files changed, 7 insertions(+), 7 deletions(-)
20
21diff --git a/gcc/Makefile.in b/gcc/Makefile.in
22index 90a2bba..2320497 100644
23--- a/gcc/Makefile.in
24+++ b/gcc/Makefile.in
25@@ -469,7 +469,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
26 TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
27
28 xmake_file=@xmake_file@
29-tmake_file=@tmake_file@
30+tmake_file=@tmake_file@ ./t-oe
31 TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@
32 TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
33 TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
34diff --git a/gcc/configure b/gcc/configure
35index bdab45a..d587993 100755
36--- a/gcc/configure
37+++ b/gcc/configure
38@@ -11539,8 +11539,8 @@ for f in $tm_file; do
39 tm_include_list="${tm_include_list} $f"
40 ;;
41 defaults.h )
42- tm_file_list="${tm_file_list} \$(srcdir)/$f"
43- tm_include_list="${tm_include_list} $f"
44+ tm_file_list="${tm_file_list} ./$f"
45+ tm_include_list="${tm_include_list} ./$f"
46 ;;
47 * )
48 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
49diff --git a/gcc/configure.ac b/gcc/configure.ac
50index 5f5c909..5e5e84f 100644
51--- a/gcc/configure.ac
52+++ b/gcc/configure.ac
53@@ -1720,8 +1720,8 @@ for f in $tm_file; do
54 tm_include_list="${tm_include_list} $f"
55 ;;
56 defaults.h )
57- tm_file_list="${tm_file_list} \$(srcdir)/$f"
58- tm_include_list="${tm_include_list} $f"
59+ tm_file_list="${tm_file_list} ./$f"
60+ tm_include_list="${tm_include_list} ./$f"
61 ;;
62 * )
63 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
64diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh
65index 29fdfc7..e048dce 100644
66--- a/gcc/mkconfig.sh
67+++ b/gcc/mkconfig.sh
68@@ -77,7 +77,7 @@ if [ -n "$HEADERS" ]; then
69 if [ $# -ge 1 ]; then
70 echo '#ifdef IN_GCC' >> ${output}T
71 for file in "$@"; do
72- if test x"$file" = x"defaults.h"; then
73+ if test x"$file" = x"./defaults.h"; then
74 postpone_defaults_h="yes"
75 else
76 echo "# include \"$file\"" >> ${output}T
77@@ -103,7 +103,7 @@ esac
78
79 # If we postponed including defaults.h, add the #include now.
80 if test x"$postpone_defaults_h" = x"yes"; then
81- echo "# include \"defaults.h\"" >> ${output}T
82+ echo "# include \"./defaults.h\"" >> ${output}T
83 fi
84
85 # Add multiple inclusion protection guard, part two.
86--
871.7.10.4
88
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0024-PR-target-32219.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0024-PR-target-32219.patch
new file mode 100644
index 0000000..45acf7f
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0024-PR-target-32219.patch
@@ -0,0 +1,62 @@
1From e0d15f4f8bf28c351b9215ca37f1caa24df0e1fd Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:18:54 +0400
4Subject: [PATCH 24/35] PR target/32219
5
6* varasm.c (default_binds_local_p_1): Weak data is not local.
7
8Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11Upstream-Status: Backport
12---
13 gcc/testsuite/gcc.dg/visibility-21.c | 14 ++++++++++++++
14 gcc/varasm.c | 9 ++++-----
15 2 files changed, 18 insertions(+), 5 deletions(-)
16 create mode 100644 gcc/testsuite/gcc.dg/visibility-21.c
17
18Index: gcc-4.9-20140316/gcc/varasm.c
19===================================================================
20--- gcc-4.9-20140316.orig/gcc/varasm.c
21+++ gcc-4.9-20140316/gcc/varasm.c
22@@ -6771,6 +6771,10 @@ default_binds_local_p_1 (const_tree exp,
23 /* Static variables are always local. */
24 else if (! TREE_PUBLIC (exp))
25 local_p = true;
26+ /* hidden weak can't be overridden by something non-local, all
27+ that is possible is that it is not defined at all. */
28+ else if (DECL_WEAK (exp))
29+ local_p = false;
30 /* A variable is local if the user has said explicitly that it will
31 be. */
32 else if ((DECL_VISIBILITY_SPECIFIED (exp)
33@@ -6784,11 +6788,6 @@ default_binds_local_p_1 (const_tree exp,
34 local. */
35 else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
36 local_p = true;
37- /* Default visibility weak data can be overridden by a strong symbol
38- in another module and so are not local. */
39- else if (DECL_WEAK (exp)
40- && !resolved_locally)
41- local_p = false;
42 /* If PIC, then assume that any global name can be overridden by
43 symbols resolved from other modules. */
44 else if (shlib)
45Index: gcc-4.9-20140316/gcc/testsuite/gcc.dg/visibility-22.c
46===================================================================
47--- /dev/null
48+++ gcc-4.9-20140316/gcc/testsuite/gcc.dg/visibility-22.c
49@@ -0,0 +1,13 @@
50+/* PR target/32219 */
51+/* { dg-do run } */
52+/* { dg-require-visibility "" } */
53+/* { dg-options "-fPIC" { target fpic } } */
54+
55+extern void f() __attribute__((weak,visibility("hidden")));
56+extern int puts( char const* );
57+int main()
58+{
59+ if (f)
60+ f();
61+ return 0;
62+}
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0025-fortran-cross-compile-hack.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0025-fortran-cross-compile-hack.patch
new file mode 100644
index 0000000..0e7914d
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0025-fortran-cross-compile-hack.patch
@@ -0,0 +1,46 @@
1From af8a56ea4e17b2909eff2c57704ab43ef24f28d3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:20:01 +0400
4Subject: [PATCH 25/35] fortran cross-compile hack.
5
6* Fortran would have searched for arm-angstrom-gnueabi-gfortran but would have used
7used gfortan. For gcc_4.2.2.bb we want to use the gfortran compiler from our cross
8directory.
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11
12Upstream-Status: Inappropriate [embedded specific]
13---
14 libgfortran/configure | 2 +-
15 libgfortran/configure.ac | 2 +-
16 2 files changed, 2 insertions(+), 2 deletions(-)
17
18diff --git a/libgfortran/configure b/libgfortran/configure
19index 8385e96..b8f7a92 100755
20--- a/libgfortran/configure
21+++ b/libgfortran/configure
22@@ -12704,7 +12704,7 @@ esac
23
24 # We need gfortran to compile parts of the library
25 #AC_PROG_FC(gfortran)
26-FC="$GFORTRAN"
27+#FC="$GFORTRAN"
28 ac_ext=${ac_fc_srcext-f}
29 ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
30 ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
31diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
32index 7d97fed..3f9f484 100644
33--- a/libgfortran/configure.ac
34+++ b/libgfortran/configure.ac
35@@ -227,7 +227,7 @@ AC_SUBST(enable_static)
36
37 # We need gfortran to compile parts of the library
38 #AC_PROG_FC(gfortran)
39-FC="$GFORTRAN"
40+#FC="$GFORTRAN"
41 AC_PROG_FC(gfortran)
42
43 # extra LD Flags which are required for targets
44--
451.7.10.4
46
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0026-libgcc-sjlj-check.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0026-libgcc-sjlj-check.patch
new file mode 100644
index 0000000..d4efab9
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0026-libgcc-sjlj-check.patch
@@ -0,0 +1,74 @@
1From 08c2398445e6cac282488f64ae6bf29cbcd8db23 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:20:50 +0400
4Subject: [PATCH 26/35] libgcc-sjlj-check
5
6ac_fn_c_try_compile doesnt seem to keep the intermediate files
7which are needed for sjlj test to pass since it greps into the
8generated file. So we run the compiler command using AC_TRY_COMMAND
9which then generates the needed .s file
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13Upstream-Status: Pending
14---
15 libgcc/configure | 10 ++++++----
16 libgcc/configure.ac | 10 ++++------
17 2 files changed, 10 insertions(+), 10 deletions(-)
18
19diff --git a/libgcc/configure b/libgcc/configure
20index 1425df6..d18e3cb 100644
21--- a/libgcc/configure
22+++ b/libgcc/configure
23@@ -4208,17 +4208,19 @@ void foo ()
24 }
25
26 _ACEOF
27-CFLAGS_hold=$CFLAGS
28-CFLAGS="--save-temps -fexceptions"
29 libgcc_cv_lib_sjlj_exceptions=unknown
30-if ac_fn_c_try_compile; then :
31+if { ac_try='${CC-cc} -fexceptions -S conftest.c -o conftest.s 1>&5'
32+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
33+ (eval $ac_try) 2>&5
34+ ac_status=$?
35+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
36+ test $ac_status = 0; }; }; then
37 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
38 libgcc_cv_lib_sjlj_exceptions=yes
39 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1; then
40 libgcc_cv_lib_sjlj_exceptions=no
41 fi
42 fi
43-CFLAGS=$CFLAGS_hold
44 rm -f conftest*
45
46 fi
47diff --git a/libgcc/configure.ac b/libgcc/configure.ac
48index 8b7aba5..c7c9644 100644
49--- a/libgcc/configure.ac
50+++ b/libgcc/configure.ac
51@@ -216,16 +216,14 @@ void foo ()
52 bar();
53 }
54 ])])
55-CFLAGS_hold=$CFLAGS
56-CFLAGS="--save-temps -fexceptions"
57 libgcc_cv_lib_sjlj_exceptions=unknown
58-AS_IF([ac_fn_c_try_compile],
59- [if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
60+if AC_TRY_COMMAND(${CC-cc} -fexceptions -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
61+ if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
62 libgcc_cv_lib_sjlj_exceptions=yes
63 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1; then
64 libgcc_cv_lib_sjlj_exceptions=no
65- fi])
66-CFLAGS=$CFLAGS_hold
67+ fi
68+fi
69 rm -f conftest*
70 ])
71
72--
731.7.10.4
74
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0027-cpp-honor-sysroot.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0027-cpp-honor-sysroot.patch
new file mode 100644
index 0000000..05e9521
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0027-cpp-honor-sysroot.patch
@@ -0,0 +1,54 @@
1From a0f9bd09c816ad29ecf7c29d6c27f7df97710364 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:22:00 +0400
4Subject: [PATCH 27/35] cpp: honor sysroot.
5
6Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile
7preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location
8rather than the --sysroot option specified on the commandline. If access to that directory is
9permission denied (unreadable), gcc will error.
10
11This happens when ccache is in use due to the fact it uses preprocessed source files.
12
13The fix below adds %I to the cpp-output spec macro so the default substitutions for -iprefix,
14-isystem, -isysroot happen and the correct sysroot is used.
15
16[YOCTO #2074]
17
18RP 2012/04/13
19
20Signed-off-by: Khem Raj <raj.khem@gmail.com>
21
22Upstream-Status: Pending
23---
24 gcc/cp/lang-specs.h | 2 +-
25 gcc/gcc.c | 2 +-
26 2 files changed, 2 insertions(+), 2 deletions(-)
27
28diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
29index a001c3e..1aae1e4 100644
30--- a/gcc/cp/lang-specs.h
31+++ b/gcc/cp/lang-specs.h
32@@ -63,5 +63,5 @@ along with GCC; see the file COPYING3. If not see
33 {".ii", "@c++-cpp-output", 0, 0, 0},
34 {"@c++-cpp-output",
35 "%{!M:%{!MM:%{!E:\
36- cc1plus -fpreprocessed %i %(cc1_options) %2\
37+ cc1plus -fpreprocessed %i %I %(cc1_options) %2\
38 %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
39diff --git a/gcc/gcc.c b/gcc/gcc.c
40index 51062aa..cf6b99e 100644
41--- a/gcc/gcc.c
42+++ b/gcc/gcc.c
43@@ -1042,7 +1042,7 @@ static const struct compiler default_compilers[] =
44 %W{o*:--output-pch=%*}}%V}}}}}}", 0, 0, 0},
45 {".i", "@cpp-output", 0, 0, 0},
46 {"@cpp-output",
47- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
48+ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
49 {".s", "@assembler", 0, 0, 0},
50 {"@assembler",
51 "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
52--
531.7.10.4
54
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0028-MIPS64-Default-to-N64-ABI.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0028-MIPS64-Default-to-N64-ABI.patch
new file mode 100644
index 0000000..2638720
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0028-MIPS64-Default-to-N64-ABI.patch
@@ -0,0 +1,31 @@
1From 301e18d4711db5925e767fad08dffa9cfe0a2f1f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:23:08 +0400
4Subject: [PATCH 28/35] MIPS64: Default to N64 ABI
5
6MIPS64 defaults to n32 ABI, this patch makes it
7so that it defaults to N64 ABI
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11Upstream-Status: Inappropriate [OE config specific]
12---
13 gcc/config.gcc | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-)
15
16diff --git a/gcc/config.gcc b/gcc/config.gcc
17index 1a0be50..989c2fb 100644
18--- a/gcc/config.gcc
19+++ b/gcc/config.gcc
20@@ -1797,7 +1797,7 @@ mips*-mti-linux*)
21 mips64*-*-linux* | mipsisa64*-*-linux*)
22 tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h mips/linux-common.h"
23 tmake_file="${tmake_file} mips/t-linux64"
24- tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32"
25+ tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_64"
26 case ${target} in
27 mips64el-st-linux-gnu)
28 tm_file="${tm_file} mips/st.h"
29--
301.7.10.4
31
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
new file mode 100644
index 0000000..969d290
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
@@ -0,0 +1,228 @@
1From 29d12344fb682a053de53eb08b95704cf3b67af2 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:24:50 +0400
4Subject: [PATCH 29/35] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
5 relative to SYSTEMLIBS_DIR
6
7This patch defines GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
8relative to SYSTEMLIBS_DIR which can be set in generated headers
9This breaks the assumption of hardcoded multilib in gcc
10Change is only for the supported architectures in OE including
11SH, sparc, alpha for possible future support (if any)
12
13Removes the do_headerfix task in metadata
14
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16
17Upstream-Status: Inappropriate [OE configuration]
18---
19 gcc/config/alpha/linux-elf.h | 4 ++--
20 gcc/config/arm/linux-eabi.h | 4 ++--
21 gcc/config/arm/linux-elf.h | 2 +-
22 gcc/config/i386/linux.h | 2 +-
23 gcc/config/i386/linux64.h | 6 +++---
24 gcc/config/mips/linux.h | 2 +-
25 gcc/config/mips/linux64.h | 8 ++++----
26 gcc/config/rs6000/linux64.h | 8 ++++----
27 gcc/config/sh/linux.h | 2 +-
28 gcc/config/sparc/linux.h | 2 +-
29 gcc/config/sparc/linux64.h | 4 ++--
30 11 files changed, 22 insertions(+), 22 deletions(-)
31
32Index: gcc-4.9.0/gcc/config/alpha/linux-elf.h
33===================================================================
34--- gcc-4.9.0.orig/gcc/config/alpha/linux-elf.h 2014-05-07 16:43:50.609106535 +0000
35+++ gcc-4.9.0/gcc/config/alpha/linux-elf.h 2014-05-07 16:43:50.605106535 +0000
36@@ -23,8 +23,8 @@
37 #define EXTRA_SPECS \
38 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
39
40-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
41-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
42+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
43+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
44 #if DEFAULT_LIBC == LIBC_UCLIBC
45 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
46 #elif DEFAULT_LIBC == LIBC_GLIBC
47Index: gcc-4.9.0/gcc/config/arm/linux-eabi.h
48===================================================================
49--- gcc-4.9.0.orig/gcc/config/arm/linux-eabi.h 2014-05-07 16:43:50.609106535 +0000
50+++ gcc-4.9.0/gcc/config/arm/linux-eabi.h 2014-05-07 16:43:50.605106535 +0000
51@@ -68,8 +68,8 @@
52 GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
53
54 #undef GLIBC_DYNAMIC_LINKER
55-#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
56-#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
57+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT SYSTEMLIBS_DIR "ld-linux.so.3"
58+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT SYSTEMLIBS_DIR "ld-linux-armhf.so.3"
59 #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
60
61 #define GLIBC_DYNAMIC_LINKER \
62Index: gcc-4.9.0/gcc/config/arm/linux-elf.h
63===================================================================
64--- gcc-4.9.0.orig/gcc/config/arm/linux-elf.h 2014-05-07 16:43:50.609106535 +0000
65+++ gcc-4.9.0/gcc/config/arm/linux-elf.h 2014-05-07 16:43:50.605106535 +0000
66@@ -57,7 +57,7 @@
67
68 #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
69
70-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
71+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
72
73 #define LINUX_TARGET_LINK_SPEC "%{h*} \
74 %{static:-Bstatic} \
75Index: gcc-4.9.0/gcc/config/i386/linux.h
76===================================================================
77--- gcc-4.9.0.orig/gcc/config/i386/linux.h 2014-05-07 16:43:50.609106535 +0000
78+++ gcc-4.9.0/gcc/config/i386/linux.h 2014-05-07 16:43:50.605106535 +0000
79@@ -20,4 +20,4 @@
80 <http://www.gnu.org/licenses/>. */
81
82 #define GNU_USER_LINK_EMULATION "elf_i386"
83-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
84+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
85Index: gcc-4.9.0/gcc/config/i386/linux64.h
86===================================================================
87--- gcc-4.9.0.orig/gcc/config/i386/linux64.h 2014-05-07 16:43:50.609106535 +0000
88+++ gcc-4.9.0/gcc/config/i386/linux64.h 2014-05-07 16:43:50.605106535 +0000
89@@ -27,6 +27,6 @@
90 #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
91 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
92
93-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
94-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
95-#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
96+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
97+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
98+#define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
99Index: gcc-4.9.0/gcc/config/mips/linux.h
100===================================================================
101--- gcc-4.9.0.orig/gcc/config/mips/linux.h 2014-05-07 16:43:50.609106535 +0000
102+++ gcc-4.9.0/gcc/config/mips/linux.h 2014-05-07 16:43:50.605106535 +0000
103@@ -18,8 +18,8 @@
104 <http://www.gnu.org/licenses/>. */
105
106 #define GLIBC_DYNAMIC_LINKER \
107- "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
108+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
109
110 #undef UCLIBC_DYNAMIC_LINKER
111 #define UCLIBC_DYNAMIC_LINKER \
112- "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
113+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
114Index: gcc-4.9.0/gcc/config/mips/linux64.h
115===================================================================
116--- gcc-4.9.0.orig/gcc/config/mips/linux64.h 2014-05-07 16:43:50.609106535 +0000
117+++ gcc-4.9.0/gcc/config/mips/linux64.h 2014-05-07 16:43:50.605106535 +0000
118@@ -23,20 +23,20 @@
119 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
120
121 #define GLIBC_DYNAMIC_LINKER32 \
122- "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
123+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
124 #define GLIBC_DYNAMIC_LINKER64 \
125- "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}"
126+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
127 #define GLIBC_DYNAMIC_LINKERN32 \
128- "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}"
129+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
130
131 #undef UCLIBC_DYNAMIC_LINKER32
132 #define UCLIBC_DYNAMIC_LINKER32 \
133- "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
134+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
135 #undef UCLIBC_DYNAMIC_LINKER64
136 #define UCLIBC_DYNAMIC_LINKER64 \
137- "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
138+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld64-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld64-uClibc.so.0}"
139 #define UCLIBC_DYNAMIC_LINKERN32 \
140- "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
141+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
142
143 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
144 #define GNU_USER_DYNAMIC_LINKERN32 \
145Index: gcc-4.9.0/gcc/config/rs6000/linux64.h
146===================================================================
147--- gcc-4.9.0.orig/gcc/config/rs6000/linux64.h 2014-05-07 16:43:50.609106535 +0000
148+++ gcc-4.9.0/gcc/config/rs6000/linux64.h 2014-05-07 16:43:50.605106535 +0000
149@@ -367,14 +367,14 @@
150 #undef LINK_OS_DEFAULT_SPEC
151 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
152
153-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
154+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
155 #ifdef LINUX64_DEFAULT_ABI_ELFv2
156-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
157+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:" SYSTEMLIBS_DIR "ld64.so.1;:" SYSTEMLIBS_DIR "ld64.so.2}"
158 #else
159-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
160+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:" SYSTEMLIBS_DIR "ld64.so.2;:" SYSTEMLIBS_DIR "ld64.so.1}"
161 #endif
162-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
163-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
164+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
165+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
166 #if DEFAULT_LIBC == LIBC_UCLIBC
167 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
168 #elif DEFAULT_LIBC == LIBC_GLIBC
169Index: gcc-4.9.0/gcc/config/sh/linux.h
170===================================================================
171--- gcc-4.9.0.orig/gcc/config/sh/linux.h 2014-05-07 16:43:50.609106535 +0000
172+++ gcc-4.9.0/gcc/config/sh/linux.h 2014-05-07 16:43:50.605106535 +0000
173@@ -43,7 +43,7 @@
174
175 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
176
177-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
178+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
179
180 #undef SUBTARGET_LINK_EMUL_SUFFIX
181 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
182Index: gcc-4.9.0/gcc/config/sparc/linux.h
183===================================================================
184--- gcc-4.9.0.orig/gcc/config/sparc/linux.h 2014-05-07 16:43:50.609106535 +0000
185+++ gcc-4.9.0/gcc/config/sparc/linux.h 2014-05-07 16:43:50.605106535 +0000
186@@ -83,7 +83,7 @@
187 When the -shared link option is used a final link is not being
188 done. */
189
190-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
191+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
192
193 #undef LINK_SPEC
194 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
195Index: gcc-4.9.0/gcc/config/sparc/linux64.h
196===================================================================
197--- gcc-4.9.0.orig/gcc/config/sparc/linux64.h 2014-05-07 16:43:50.609106535 +0000
198+++ gcc-4.9.0/gcc/config/sparc/linux64.h 2014-05-07 16:43:50.605106535 +0000
199@@ -92,8 +92,8 @@
200 When the -shared link option is used a final link is not being
201 done. */
202
203-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
204-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
205+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
206+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux.so.2"
207
208 #ifdef SPARC_BI_ARCH
209
210Index: gcc-4.9.0/gcc/config/linux.h
211===================================================================
212--- gcc-4.9.0.orig/gcc/config/linux.h 2014-05-07 16:43:50.609106535 +0000
213+++ gcc-4.9.0/gcc/config/linux.h 2014-05-07 16:43:50.605106535 +0000
214@@ -73,10 +73,10 @@
215 GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
216 GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
217 supporting both 32-bit and 64-bit compilation. */
218-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
219-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
220-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
221-#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0"
222+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
223+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
224+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
225+#define UCLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ldx32-uClibc.so.0"
226 #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
227 #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
228 #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0030-gcc-Fix-argument-list-too-long-error.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0030-gcc-Fix-argument-list-too-long-error.patch
new file mode 100644
index 0000000..2ceaff6
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0030-gcc-Fix-argument-list-too-long-error.patch
@@ -0,0 +1,40 @@
1From c1816c160156f99c34e6a0a0311bb0219326804e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:26:37 +0400
4Subject: [PATCH 30/35] gcc: Fix argument list too long error.
5
6There would be an "Argument list too long" error when the
7build directory is longer than 200, this is caused by:
8
9headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`
10
11The PLUGIN_HEADERS is too long before sort, so the "echo" can't handle
12it, use the $(sort list) of GNU make which can handle the too long list
13would fix the problem, the header would be short enough after sorted.
14The "tr ' ' '\012'" was used for translating the space to "\n", the
15$(sort list) doesn't need this.
16
17Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19
20Upstream-Status: Pending
21---
22 gcc/Makefile.in | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25diff --git a/gcc/Makefile.in b/gcc/Makefile.in
26index 2320497..8562a62 100644
27--- a/gcc/Makefile.in
28+++ b/gcc/Makefile.in
29@@ -4627,7 +4627,7 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
30 # We keep the directory structure for files in config or c-family and .def
31 # files. All other files are flattened to a single directory.
32 $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
33- headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`; \
34+ headers="$(sort $(PLUGIN_HEADERS))"; \
35 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
36 for file in $$headers; do \
37 if [ -f $$file ] ; then \
38--
391.7.10.4
40
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0031-Disable-sdt.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0031-Disable-sdt.patch
new file mode 100644
index 0000000..2c1d5e0
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0031-Disable-sdt.patch
@@ -0,0 +1,113 @@
1From b85265bc94ec1beaf1d3b697c03db62991553467 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:28:10 +0400
4Subject: [PATCH 31/35] Disable sdt.
5
6We don't list dtrace in DEPENDS so we shouldn't be depending on this header.
7It may or may not exist from preivous builds though. To be determinstic, disable
8sdt.h usage always. This avoids build failures if the header is removed after configure
9but before libgcc is compiled for example.
10
11RP 2012/8/7
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14
15Disable sdt for libstdc++-v3.
16
17Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
18
19Upstream-Status: Inappropriate [hack]
20---
21 gcc/configure | 12 ++++++------
22 gcc/configure.ac | 18 +++++++++---------
23 libstdc++-v3/configure | 6 +++---
24 libstdc++-v3/configure.ac | 2 +-
25 4 files changed, 19 insertions(+), 19 deletions(-)
26
27diff --git a/gcc/configure b/gcc/configure
28index 3c550a6..01c7626 100755
29--- a/gcc/configure
30+++ b/gcc/configure
31@@ -26812,12 +26812,12 @@ fi
32 { $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
33 $as_echo_n "checking sys/sdt.h in the target C library... " >&6; }
34 have_sys_sdt_h=no
35-if test -f $target_header_dir/sys/sdt.h; then
36- have_sys_sdt_h=yes
37-
38-$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
39-
40-fi
41+#if test -f $target_header_dir/sys/sdt.h; then
42+# have_sys_sdt_h=yes
43+#
44+#$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
45+#
46+#fi
47 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5
48 $as_echo "$have_sys_sdt_h" >&6; }
49
50diff --git a/gcc/configure.ac b/gcc/configure.ac
51index 3601ab6..06e501f 100644
52--- a/gcc/configure.ac
53+++ b/gcc/configure.ac
54@@ -4779,15 +4779,15 @@ if test x$gcc_cv_libc_provides_ssp = xyes; then
55 fi
56
57 # Test for <sys/sdt.h> on the target.
58-GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
59-AC_MSG_CHECKING(sys/sdt.h in the target C library)
60-have_sys_sdt_h=no
61-if test -f $target_header_dir/sys/sdt.h; then
62- have_sys_sdt_h=yes
63- AC_DEFINE(HAVE_SYS_SDT_H, 1,
64- [Define if your target C library provides sys/sdt.h])
65-fi
66-AC_MSG_RESULT($have_sys_sdt_h)
67+#GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
68+#AC_MSG_CHECKING(sys/sdt.h in the target C library)
69+#have_sys_sdt_h=no
70+#if test -f $target_header_dir/sys/sdt.h; then
71+# have_sys_sdt_h=yes
72+# AC_DEFINE(HAVE_SYS_SDT_H, 1,
73+# [Define if your target C library provides sys/sdt.h])
74+#fi
75+#AC_MSG_RESULT($have_sys_sdt_h)
76
77 # Check if TFmode long double should be used by default or not.
78 # Some glibc targets used DFmode long double, but with glibc 2.4
79diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
80index 4953c9f..53a1145 100755
81--- a/libstdc++-v3/configure
82+++ b/libstdc++-v3/configure
83@@ -20578,11 +20578,11 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
84 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
85 ac_compiler_gnu=$ac_cv_c_compiler_gnu
86
87- if test $glibcxx_cv_sys_sdt_h = yes; then
88+# if test $glibcxx_cv_sys_sdt_h = yes; then
89
90-$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
91+#$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
92
93- fi
94+# fi
95 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_sys_sdt_h" >&5
96 $as_echo "$glibcxx_cv_sys_sdt_h" >&6; }
97
98diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
99index 73d430a..f2135e2 100644
100--- a/libstdc++-v3/configure.ac
101+++ b/libstdc++-v3/configure.ac
102@@ -211,7 +211,7 @@ GLIBCXX_CHECK_SC_NPROCESSORS_ONLN
103 GLIBCXX_CHECK_SC_NPROC_ONLN
104 GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP
105 GLIBCXX_CHECK_SYSCTL_HW_NCPU
106-GLIBCXX_CHECK_SDT_H
107+#GLIBCXX_CHECK_SDT_H
108
109 # Check for available headers.
110 AC_CHECK_HEADERS([endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \
111--
1121.8.3.1
113
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0032-libtool.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0032-libtool.patch
new file mode 100644
index 0000000..3b3d1b6
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0032-libtool.patch
@@ -0,0 +1,42 @@
1From 6c715fcfa262adadca81c68a1f3f69aa3187a501 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:29:11 +0400
4Subject: [PATCH 32/35] libtool
5
6libstdc++ from gcc-runtime gets created with -rpath=/usr/lib/../lib for qemux86-64
7when running on am x86_64 build host.
8
9This patch stops this speading to libdir in the libstdc++.la file within libtool.
10Arguably, it shouldn't be passing this into libtool in the first place but
11for now this resolves the nastiest problems this causes.
12
13func_normal_abspath would resolve an empty path to `pwd` so we need
14to filter the zero case.
15
16RP 2012/8/24
17
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19
20Upstream-Status: Pending
21---
22 ltmain.sh | 4 ++++
23 1 file changed, 4 insertions(+)
24
25diff --git a/ltmain.sh b/ltmain.sh
26index a03433f..46f47c2 100644
27--- a/ltmain.sh
28+++ b/ltmain.sh
29@@ -6359,6 +6359,10 @@ func_mode_link ()
30 func_warning "ignoring multiple \`-rpath's for a libtool library"
31
32 install_libdir="$1"
33+ if test -n "$install_libdir"; then
34+ func_normal_abspath "$install_libdir"
35+ install_libdir=$func_normal_abspath_result
36+ fi
37
38 oldlibs=
39 if test -z "$rpath"; then
40--
411.7.10.4
42
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
new file mode 100644
index 0000000..b236c37
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
@@ -0,0 +1,40 @@
1From 97e4591c20310425e7aca0e6712a8d9480e7744c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:30:32 +0400
4Subject: [PATCH 33/35] gcc: armv4: pass fix-v4bx to linker to support EABI.
5
6The LINK_SPEC for linux gets overwritten by linux-eabi.h which
7means the value of TARGET_FIX_V4BX_SPEC gets lost and as a result
8the option is not passed to linker when chosing march=armv4
9This patch redefines this in linux-eabi.h and reinserts it
10for eabi defaulting toolchains.
11
12We might want to send it upstream.
13
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15
16Upstream-Status: Pending
17---
18 gcc/config/arm/linux-eabi.h | 6 +++++-
19 1 file changed, 5 insertions(+), 1 deletion(-)
20
21Index: gcc-4.9-20140316/gcc/config/arm/linux-eabi.h
22===================================================================
23--- gcc-4.9-20140316.orig/gcc/config/arm/linux-eabi.h
24+++ gcc-4.9-20140316/gcc/config/arm/linux-eabi.h
25@@ -77,10 +77,14 @@
26 %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
27 %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
28
29+/* For armv4 we pass --fix-v4bx to linker to support EABI */
30+#undef TARGET_FIX_V4BX_SPEC
31+#define TARGET_FIX_V4BX_SPEC "%{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4: --fix-v4bx}"
32+
33 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
34 use the GNU/Linux version, not the generic BPABI version. */
35 #undef LINK_SPEC
36-#define LINK_SPEC EABI_LINK_SPEC \
37+#define LINK_SPEC TARGET_FIX_V4BX_SPEC EABI_LINK_SPEC \
38 LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
39 LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
40
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch
new file mode 100644
index 0000000..66b9f89
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch
@@ -0,0 +1,102 @@
1From fc5e4beaea856a2b486c770ad3addc0f5bb3100e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:33:04 +0400
4Subject: [PATCH 34/35] Use the multilib config files from ${B} instead of
5 using the ones from ${S}
6
7Use the multilib config files from ${B} instead of using the ones from ${S}
8so that the source can be shared between gcc-cross-initial,
9gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
13
14Upstream-Status: Inappropriate [configuration]
15---
16 gcc/configure | 22 ++++++++++++++++++----
17 gcc/configure.ac | 22 ++++++++++++++++++----
18 2 files changed, 36 insertions(+), 8 deletions(-)
19
20diff --git a/gcc/configure b/gcc/configure
21index 8bc0c98..3cd0817 100755
22--- a/gcc/configure
23+++ b/gcc/configure
24@@ -11519,10 +11519,20 @@ done
25 tmake_file_=
26 for f in ${tmake_file}
27 do
28- if test -f ${srcdir}/config/$f
29- then
30- tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
31- fi
32+ case $f in
33+ */t-linux64 )
34+ if test -f ./config/$f
35+ then
36+ tmake_file_="${tmake_file_} ./config/$f"
37+ fi
38+ ;;
39+ * )
40+ if test -f ${srcdir}/config/$f
41+ then
42+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
43+ fi
44+ ;;
45+ esac
46 done
47 tmake_file="${tmake_file_}"
48
49@@ -11533,6 +11543,10 @@ tm_file_list="options.h"
50 tm_include_list="options.h insn-constants.h"
51 for f in $tm_file; do
52 case $f in
53+ */linux64.h )
54+ tm_file_list="${tm_file_list} ./config/$f"
55+ tm_include_list="${tm_include_list} ./config/$f"
56+ ;;
57 ./* )
58 f=`echo $f | sed 's/^..//'`
59 tm_file_list="${tm_file_list} $f"
60diff --git a/gcc/configure.ac b/gcc/configure.ac
61index 5e5e84f..415a6df 100644
62--- a/gcc/configure.ac
63+++ b/gcc/configure.ac
64@@ -1700,10 +1700,20 @@ done
65 tmake_file_=
66 for f in ${tmake_file}
67 do
68- if test -f ${srcdir}/config/$f
69- then
70- tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
71- fi
72+ case $f in
73+ */t-linux64 )
74+ if test -f ./config/$f
75+ then
76+ tmake_file_="${tmake_file_} ./config/$f"
77+ fi
78+ ;;
79+ * )
80+ if test -f ${srcdir}/config/$f
81+ then
82+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
83+ fi
84+ ;;
85+ esac
86 done
87 tmake_file="${tmake_file_}"
88
89@@ -1714,6 +1724,10 @@ tm_file_list="options.h"
90 tm_include_list="options.h insn-constants.h"
91 for f in $tm_file; do
92 case $f in
93+ */linux64.h )
94+ tm_file_list="${tm_file_list} ./config/$f"
95+ tm_include_list="${tm_include_list} ./config/$f"
96+ ;;
97 ./* )
98 f=`echo $f | sed 's/^..//'`
99 tm_file_list="${tm_file_list} $f"
100--
1011.7.10.4
102
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0037-gcc-4.8-PR56797.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0037-gcc-4.8-PR56797.patch
new file mode 100644
index 0000000..b5d7b86
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0037-gcc-4.8-PR56797.patch
@@ -0,0 +1,66 @@
1Upstream-Status: Backport
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4From patchwork Fri Apr 19 09:34:49 2013
5Content-Type: text/plain; charset="utf-8"
6MIME-Version: 1.0
7Content-Transfer-Encoding: 7bit
8Subject: [ARM] Fix PR56797
9Date: Thu, 18 Apr 2013 23:34:49 -0000
10From: Greta Yorsh <Greta.Yorsh@arm.com>
11X-Patchwork-Id: 237891
12Message-Id: <000801ce3ce1$23fbdd60$6bf39820$@yorsh@arm.com>
13To: "GCC Patches" <gcc-patches@gcc.gnu.org>
14Cc: <raj.khem@gmail.com>, "Richard Earnshaw" <Richard.Earnshaw@arm.com>,
15 "Ramana Radhakrishnan" <Ramana.Radhakrishnan@arm.com>
16
17Fix PR56797
18http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56797
19
20The problem is that peephole optimizer thinks it can generate an ldm, but
21the pattern for ldm no longer matches, because after r188738 it requires
22that if one of the destination registers is SP then the base register must
23be SP, and it's not SP in the test case.
24
25The test case fails on armv5t but doesn't fail on armv6t2 or armv7-a because
26peephole doesn't trigger there (because there is a different epilogue
27sequence). It looks like a latent problem for other architecture or CPUs.
28
29This patch adds this condition to the peephole optimizer.
30
31No regression on qemu for arm-none-eabi and fixes the test reported in the
32PR. I couldn't minimize the test sufficiently to include it in the
33testsuite.
34
35Ok for trunk?
36
37Thanks,
38Greta
39
40gcc/
41
422013-04-18 Greta Yorsh <Greta.Yorsh@arm.com>
43
44 PR target/56797
45 * config/arm/arm.c (load_multiple_sequence): Require SP
46 as base register for loads if SP is in the register list.
47
48
49diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
50index d00849c..60fef78 100644
51--- a/gcc/config/arm/arm.c
52+++ b/gcc/config/arm/arm.c
53@@ -10347,6 +10347,13 @@ load_multiple_sequence (rtx *operands, int nops, int *regs, int *saved_order,
54 || (i != nops - 1 && unsorted_regs[i] == base_reg))
55 return 0;
56
57+ /* Don't allow SP to be loaded unless it is also the base
58+ register. It guarantees that SP is reset correctly when
59+ an LDM instruction is interruptted. Otherwise, we might
60+ end up with a corrupt stack. */
61+ if (unsorted_regs[i] == SP_REGNUM && base_reg != SP_REGNUM)
62+ return 0;
63+
64 unsorted_offsets[i] = INTVAL (offset);
65 if (i == 0 || unsorted_offsets[i] < unsorted_offsets[order[0]])
66 order[0] = i;
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0040-fix-g++-sysroot.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0040-fix-g++-sysroot.patch
new file mode 100644
index 0000000..d50aa5c
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0040-fix-g++-sysroot.patch
@@ -0,0 +1,40 @@
1Portions of
2
3http://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg26013.html
4
5are not upstreamed yet. So lets keep missing pieces.
6
7Upstream-Status: Pending
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11Index: gcc-4.8.1/gcc/configure.ac
12===================================================================
13--- gcc-4.8.1.orig/gcc/configure.ac 2013-07-15 15:55:49.488399132 -0700
14+++ gcc-4.8.1/gcc/configure.ac 2013-07-15 16:02:31.772406679 -0700
15@@ -148,7 +148,9 @@
16 if test "${with_sysroot+set}" = set; then
17 gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
18 if test "${gcc_gxx_without_sysroot}"; then
19- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
20+ if test x${with_sysroot} != x/; then
21+ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
22+ fi
23 gcc_gxx_include_dir_add_sysroot=1
24 fi
25 fi
26Index: gcc-4.8.1/gcc/configure
27===================================================================
28--- gcc-4.8.1.orig/gcc/configure 2013-07-15 15:55:49.472399132 -0700
29+++ gcc-4.8.1/gcc/configure 2013-07-15 16:02:31.780406680 -0700
30@@ -3325,7 +3325,9 @@
31 if test "${with_sysroot+set}" = set; then
32 gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
33 if test "${gcc_gxx_without_sysroot}"; then
34- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
35+ if test x${with_sysroot} != x/; then
36+ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
37+ fi
38 gcc_gxx_include_dir_add_sysroot=1
39 fi
40 fi
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0041-libtool-avoid-libdir.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0041-libtool-avoid-libdir.patch
new file mode 100644
index 0000000..2dd9610
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0041-libtool-avoid-libdir.patch
@@ -0,0 +1,19 @@
1Avoid using libdir from .la which usually points to a host path
2
3Upstream-Status: Inappropriate [embedded specific]
4Signed-off-by: Jonathan Liu <net147@gmail.com>
5
6diff --git a/ltmain.sh b/ltmain.sh
7index a03433f..1902a90 100644
8--- a/ltmain.sh
9+++ b/ltmain.sh
10@@ -5628,6 +5628,9 @@ func_mode_link ()
11 absdir="$abs_ladir"
12 libdir="$abs_ladir"
13 else
14+ # Instead of using libdir from .la which usually points to a host path,
15+ # use the path the .la is contained in.
16+ libdir="$abs_ladir"
17 dir="$libdir"
18 absdir="$libdir"
19 fi
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0043-cpp.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0043-cpp.patch
new file mode 100644
index 0000000..eaf8646
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0043-cpp.patch
@@ -0,0 +1,40 @@
1The OE environment sets and exports CPP as being the target gcc. When building
2gcc-cross-canadian for a mingw targetted sdk, the following can be found in
3build.x86_64-pokysdk-mingw32.i586-poky-linux/build-x86_64-linux/libiberty/config.log:
4
5configure:3641: checking for _FILE_OFFSET_BITS value needed for large files
6configure:3666: gcc -c -isystem/media/build1/poky/build/tmp/sysroots/x86_64-linux/usr/include -O2 -pipe conftest.c >&5
7configure:3666: $? = 0
8configure:3698: result: no
9configure:3786: checking how to run the C preprocessor
10configure:3856: result: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32
11configure:3876: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32 conftest.c
12configure:3876: $? = 0
13
14Note this is a *build* target (in build-x86_64-linux) so it should be using
15the host "gcc", not x86_64-pokysdk-mingw32-gcc. Since the mingw32 headers are
16very different, using the wrong cpp is a real problem. It is leaking into
17configure through the CPP variable. Ultimately this leads to build failures
18related to not being able to include a process.h file for pem-unix.c.
19
20The fix is to ensure we export a sane CPP value into the build environment when
21using build targets. We could define a CPP_FOR_BUILD value which may be the version
22which needs to be upstreamed but for now, this fix is good enough to avoid the
23problem.
24
25RP 22/08/2013
26
27Upstream-Status: Pending
28
29Index: gcc-4.8.1/Makefile.in
30===================================================================
31--- gcc-4.8.1.orig/Makefile.in 2013-03-30 11:25:03.000000000 +0000
32+++ gcc-4.8.1/Makefile.in 2013-08-13 12:03:17.151988882 +0000
33@@ -149,6 +149,7 @@
34 AR="$(AR_FOR_BUILD)"; export AR; \
35 AS="$(AS_FOR_BUILD)"; export AS; \
36 CC="$(CC_FOR_BUILD)"; export CC; \
37+ CPP="$(CC_FOR_BUILD) -E"; export CPP; \
38 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
39 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
40 CXX="$(CXX_FOR_BUILD)"; export CXX; \
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0044-gengtypes.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0044-gengtypes.patch
new file mode 100644
index 0000000..e38761d
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0044-gengtypes.patch
@@ -0,0 +1,97 @@
1gengtype is generated for both the build system and the target. -DGENERATOR_FILE
2was added in the patch http://gcc.gnu.org/ml/gcc-patches/2012-07/msg00273.html
3and was applied to both versions of gengtype.
4
5Unfortunately the presence of this flag triggers the build configuration (bconfig.h)
6to be included for the target build of gengtype. Compiling gengtype with the target
7compiler and bconfig.h can result in errors if the build and target systems are
8dissimilar. An example case this fails is cross compiling gcc on linux for a darwin
9target system:
10
11In file included from /media/build1/poky/build/tmp/work-shared/gcc-4.8.1-r0/gcc-4.8.1/gcc/gengtype-parse.c:25:0:
12| /media/build1/poky/build/tmp/work-shared/gcc-4.8.1-r0/gcc-4.8.1/gcc/gengtype-parse.c: In function 'void parse_error(const char*, ...)':
13| /media/build1/poky/build/tmp/work-shared/gcc-4.8.1-r0/gcc-4.8.1/gcc/system.h:93:53: error: 'fputc_unlocked' was not declared in this scope
14| # define fputc(C, Stream) fputc_unlocked (C, Stream)
15
16which occurs since auto-build.h and auto-host.h have differnet values of
17HAVE_FPUTC_UNLOCKED:
18
19#define HAVE_FPUTC_UNLOCKED 1
20/* #undef HAVE_FPUTS_UNLOCKED */
21
22The obvious fix is to only include the flag on build/ targets which this patch does, however
23this also leads to compile errors due to const_tree being undefined but used in double_int.h
24
25I added a GENERATOR_FILE2 flag to workaround those in the
26target case and allow the build to succeed.
27
28Only the build/gengtypes should have the -DGENERATOR_FILE
29
30RP 22/8/2013
31
32Upstream-Status: Pending
33
34Index: gcc-4.8.1/gcc/Makefile.in
35===================================================================
36--- gcc-4.8.1.orig/gcc/Makefile.in 2013-08-19 11:40:36.844014424 +0000
37+++ gcc-4.8.1/gcc/Makefile.in 2013-08-19 11:40:37.784014402 +0000
38@@ -3903,27 +3903,29 @@
39
40 gengtype-lex.o build/gengtype-lex.o : gengtype-lex.c gengtype.h $(SYSTEM_H)
41 gengtype-lex.o: $(CONFIG_H) $(BCONFIG_H)
42-CFLAGS-gengtype-lex.o += -DGENERATOR_FILE
43+CFLAGS-build/gengtype-lex.o += -DGENERATOR_FILE
44 build/gengtype-lex.o: $(BCONFIG_H)
45
46 gengtype-parse.o build/gengtype-parse.o : gengtype-parse.c gengtype.h \
47 $(SYSTEM_H)
48 gengtype-parse.o: $(CONFIG_H)
49-CFLAGS-gengtype-parse.o += -DGENERATOR_FILE
50+CFLAGS-build/gengtype-parse.o += -DGENERATOR_FILE
51 build/gengtype-parse.o: $(BCONFIG_H)
52
53 gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \
54 gengtype.h errors.h double-int.h version.h $(HASHTAB_H) $(OBSTACK_H) \
55 $(XREGEX_H)
56 gengtype-state.o: $(CONFIG_H)
57-CFLAGS-gengtype-state.o += -DGENERATOR_FILE
58+CFLAGS-gengtype-state.o += -DGENERATOR_FILE2
59+CFLAGS-build/gengtype-state.o += -DGENERATOR_FILE
60 build/gengtype-state.o: $(BCONFIG_H)
61
62 gengtype.o build/gengtype.o : gengtype.c $(SYSTEM_H) gengtype.h \
63 rtl.def insn-notes.def errors.h double-int.h version.h $(HASHTAB_H) \
64 $(OBSTACK_H) $(XREGEX_H)
65 gengtype.o: $(CONFIG_H)
66-CFLAGS-gengtype.o += -DGENERATOR_FILE
67+CFLAGS-gengtype.o += -DGENERATOR_FILE2
68+CFLAGS-build/gengtype.o += -DGENERATOR_FILE
69 build/gengtype.o: $(BCONFIG_H)
70
71 build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
72@@ -3988,7 +3990,7 @@
73 # any system header is included.
74 gengtype-lex.c : gengtype-lex.l
75 -$(FLEX) $(FLEXFLAGS) -o$@ $< && { \
76- echo '#include "bconfig.h"' > $@.tmp; \
77+ echo '' > $@.tmp; \
78 cat $@ >> $@.tmp; \
79 mv $@.tmp $@; \
80 }
81Index: gcc-4.8.1/gcc/double-int.h
82===================================================================
83--- gcc-4.8.1.orig/gcc/double-int.h 2013-01-30 11:04:30.000000000 +0000
84+++ gcc-4.8.1/gcc/double-int.h 2013-08-19 11:41:51.564012719 +0000
85@@ -448,10 +448,12 @@
86
87
88 #ifndef GENERATOR_FILE
89+#ifndef GENERATOR_FILE2
90 /* Conversion to and from GMP integer representations. */
91
92 void mpz_set_double_int (mpz_t, double_int, bool);
93 double_int mpz_get_double_int (const_tree, mpz_t, bool);
94 #endif
95+#endif
96
97 #endif /* DOUBLE_INT_H */
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0046-libatomic-deptracking.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0046-libatomic-deptracking.patch
new file mode 100644
index 0000000..6ea4f42
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0046-libatomic-deptracking.patch
@@ -0,0 +1,41 @@
1gcc 4.8 won't build with --disable-dependency-tracking since the *.Ppo files
2don't get created unless --enable-dependency-tracking is true.
3
4This patch ensures we only use those compiler options when its enabled.
5
6Upstream-Status: Submitted
7
8(Problem was already reported upstream, attached this patch there
9http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55930)
10
11RP
122012/09/22
13
14Index: gcc-4.8.1/libatomic/Makefile.am
15===================================================================
16--- gcc-4.8.1.orig/libatomic/Makefile.am 2013-01-14 18:16:23.000000000 +0000
17+++ gcc-4.8.1/libatomic/Makefile.am 2013-09-22 10:38:18.904064750 +0000
18@@ -100,7 +100,8 @@
19 IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
20 IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
21
22-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
23+@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
24+@AMDEP_FALSE@M_DEPS =
25 M_SIZE = -DN=$(PAT_N)
26 M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
27 M_FILE = $(PAT_BASE)_n.c
28Index: gcc-4.8.1/libatomic/Makefile.in
29===================================================================
30--- gcc-4.8.1.orig/libatomic/Makefile.in 2013-05-31 09:09:26.000000000 +0000
31+++ gcc-4.8.1/libatomic/Makefile.in 2013-09-22 10:40:42.520059917 +0000
32@@ -298,7 +298,8 @@
33 PAT_S = $(word 3,$(PAT_SPLIT))
34 IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
35 IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
36-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
37+@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
38+@AMDEP_FALSE@M_DEPS =
39 M_SIZE = -DN=$(PAT_N)
40 M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
41 M_FILE = $(PAT_BASE)_n.c
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0047-repomembug.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0047-repomembug.patch
new file mode 100644
index 0000000..9afd55c
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0047-repomembug.patch
@@ -0,0 +1,53 @@
1When compiling a project using -frepo, .rpo files are written alongside
2the .o file, the symbols either have O or C against them. During final linking,
3the objects can be recompiled with some of the entries tweaked/chosen by the
4tlink.c code (visible with TLINK_VERBOSE=3), it does this by changing O -> C
5in the .rpo files.
6
7My tests showed that init_repo (cp/repo.c) was correctly calling
8IDENTIFIER_REPO_CHOSEN against the right identifers and setting the
9chosen bit.
10
11By the time finish_repo() or emit_repo_p() were called, the pointer returned
12by get_identifier() for the symbol marked during init_repo had changed and
13the chosen bit was no longer set. This lead to linking bugs like:
14
15collect: relinking
16collect2: error: '_ZNK6sudoku5ClearINS_8SequenceEEclERS1_' was assigned to 'board.rpo', but was not defined during recompilation, or vice versa
17
18The problem is that the garbage collection is getting called before
19finish_repo() is called and ggc_protect_identifiers is set to false
20so the identifiers are not preserved. They are recreated but the
21chosen bits get wiped out which is why the pointer changes and the
22chosen bit is not set.
23
24The fix is to change ggc_protect_identifiers *after* the finish_repo
25calls are made.
26
27Reproduction is tricky since you need to trigger the garbage collector at
28just the right moment.
29
30RP 2013/10/9
31
32[YOCTO #5133]
33
34Upstream-Status: Pending
35
36Index: gcc-4.8.1/gcc/toplev.c
37===================================================================
38--- gcc-4.8.1.orig/gcc/toplev.c 2013-03-28 08:29:51.000000000 +0000
39+++ gcc-4.8.1/gcc/toplev.c 2013-10-09 20:27:17.089228023 +0000
40@@ -551,11 +551,11 @@
41 if (flag_syntax_only || flag_wpa)
42 return;
43
44- ggc_protect_identifiers = false;
45-
46 /* This must also call finalize_compilation_unit. */
47 lang_hooks.decls.final_write_globals ();
48
49+ ggc_protect_identifiers = false;
50+
51 if (seen_error ())
52 return;
53
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch
new file mode 100644
index 0000000..b98f8ff
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch
@@ -0,0 +1,42 @@
1From 9e0e19eac2562f73858602fe26e2044eb8b20c47 Mon Sep 17 00:00:00 2001
2From: Alexandru-Cezar Sardan <alexandru.sardan@freescale.com>
3Date: Wed, 5 Feb 2014 16:52:31 +0200
4Subject: [PATCH] Enable SPE & AltiVec generation on powepc*linux target
5
6When is configured with --target=powerpc-linux, the resulting GCC will
7not be able to generate code for SPE targets (e500v1/v2).
8GCC configured with --target=powerpc-linuxspe will not be able to
9generate AltiVec instructions (for e6500).
10This patch modifies the configured file such that SPE or AltiVec code
11can be generated when gcc is configured with --target=powerpc-linux.
12The ABI and speciffic instructions can be selected through the
13"-mabi=spe or -mabi=altivec" and the "-mspe or -maltivec" parameters.
14
15Upstream-Status: Inappropriate [configuration]
16
17Signed-off-by: Alexandru-Cezar Sardan <alexandru.sardan@freescale.com>
18---
19 gcc/config.gcc | 7 ++++++-
20 1 file changed, 6 insertions(+), 1 deletion(-)
21
22diff --git a/gcc/config.gcc b/gcc/config.gcc
23index cb7a94e..d392c2b 100644
24--- a/gcc/config.gcc
25+++ b/gcc/config.gcc
26@@ -2068,7 +2068,12 @@ powerpc-*-rtems*)
27 tmake_file="rs6000/t-fprules rs6000/t-rtems t-rtems rs6000/t-ppccomm"
28 ;;
29 powerpc*-*-linux*)
30- tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h"
31+ case ${target} in
32+ powerpc*-*-linux*spe* | powerpc*-*-linux*altivec*)
33+ tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h" ;;
34+ *)
35+ tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h rs6000/linuxaltivec.h rs6000/linuxspe.h rs6000/e500.h" ;;
36+ esac
37 extra_options="${extra_options} rs6000/sysv4.opt"
38 tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
39 case ${target} in
40--
411.7.9.5
42
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0050-Revert-Use-dbx_reg_number-for-spanning-registers.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0050-Revert-Use-dbx_reg_number-for-spanning-registers.patch
new file mode 100644
index 0000000..aead6f6
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0050-Revert-Use-dbx_reg_number-for-spanning-registers.patch
@@ -0,0 +1,80 @@
1Upstream-Status: Pending
2
3From cb9b1c041b634a4c128896e3d3eed4082608c797 Mon Sep 17 00:00:00 2001
4From: Khem Raj <raj.khem@gmail.com>
5Date: Sat, 3 May 2014 19:25:17 -0700
6Subject: [PATCH] Revert "2013-05-21 Christian Bruel
7 <christian.bruel@st.com>"
8
9This reverts commit 3983036a8b6b2710c57777194f21507819a73553.
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13Conflicts:
14 gcc/ChangeLog
15---
16 gcc/ChangeLog | 219 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
17 gcc/dwarf2out.c | 33 +++++----
18 2 files changed, 234 insertions(+), 18 deletions(-)
19
20diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
21index 1272326..6ac2b28 100644
22--- a/gcc/dwarf2out.c
23+++ b/gcc/dwarf2out.c
24@@ -10870,27 +10870,25 @@ static dw_loc_descr_ref
25 multiple_reg_loc_descriptor (rtx rtl, rtx regs,
26 enum var_init_status initialized)
27 {
28- int size, i;
29+ int nregs, size, i;
30+ unsigned reg;
31 dw_loc_descr_ref loc_result = NULL;
32
33- /* Simple, contiguous registers. */
34- if (regs == NULL_RTX)
35- {
36- unsigned reg = REGNO (rtl);
37- int nregs;
38-
39+ reg = REGNO (rtl);
40 #ifdef LEAF_REG_REMAP
41- if (crtl->uses_only_leaf_regs)
42- {
43- int leaf_reg = LEAF_REG_REMAP (reg);
44- if (leaf_reg != -1)
45- reg = (unsigned) leaf_reg;
46- }
47+ if (crtl->uses_only_leaf_regs)
48+ {
49+ int leaf_reg = LEAF_REG_REMAP (reg);
50+ if (leaf_reg != -1)
51+ reg = (unsigned) leaf_reg;
52+ }
53 #endif
54+ gcc_assert ((unsigned) DBX_REGISTER_NUMBER (reg) == dbx_reg_number (rtl));
55+ nregs = hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)];
56
57- gcc_assert ((unsigned) DBX_REGISTER_NUMBER (reg) == dbx_reg_number (rtl));
58- nregs = hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)];
59-
60+ /* Simple, contiguous registers. */
61+ if (regs == NULL_RTX)
62+ {
63 size = GET_MODE_SIZE (GET_MODE (rtl)) / nregs;
64
65 loc_result = NULL;
66@@ -10918,9 +10916,10 @@ multiple_reg_loc_descriptor (rtx rtl, rtx regs,
67 {
68 dw_loc_descr_ref t;
69
70- t = one_reg_loc_descriptor (dbx_reg_number (XVECEXP (regs, 0, i)),
71+ t = one_reg_loc_descriptor (REGNO (XVECEXP (regs, 0, i)),
72 VAR_INIT_STATUS_INITIALIZED);
73 add_loc_descr (&loc_result, t);
74+ size = GET_MODE_SIZE (GET_MODE (XVECEXP (regs, 0, 0)));
75 add_loc_descr_op_piece (&loc_result, size);
76 }
77
78--
791.9.2
80
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0051-eabispe.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0051-eabispe.patch
new file mode 100644
index 0000000..55e3890
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0051-eabispe.patch
@@ -0,0 +1,23 @@
1Upstream-Status: Pending
2
3Taken from http://gcc.gnu.org/ml/gcc-patches/2014-04/msg02064.html
4
52014-04-30 Cesar Philippidis <cesar@codesourcery.com>
6
7 gcc/
8 * dwarf2cfi.c (dwf_regno): Don't assert reg is a pseudo
9 register.
10
11
12diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
13index 4180890..40ef0e2 100644
14--- a/gcc/dwarf2cfi.c
15+++ b/gcc/dwarf2cfi.c
16@@ -906,7 +906,6 @@ notice_eh_throw (rtx insn)
17 static inline unsigned
18 dwf_regno (const_rtx reg)
19 {
20- gcc_assert (REGNO (reg) < FIRST_PSEUDO_REGISTER);
21 return DWARF_FRAME_REGNUM (REGNO (reg));
22 }
23
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0052-Fix-GCC-targeting-E500-SPE-errors-with-the-_Decimal64-type.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0052-Fix-GCC-targeting-E500-SPE-errors-with-the-_Decimal64-type.patch
new file mode 100644
index 0000000..b4be18e
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0052-Fix-GCC-targeting-E500-SPE-errors-with-the-_Decimal64-type.patch
@@ -0,0 +1,98 @@
1From e44a6d438db4848c2a555be773568a3cf7994206 Mon Sep 17 00:00:00 2001
2From: Alexandru-Cezar Sardan <alexandru.sardan-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
3Date: Mon, 26 May 2014 12:11:13 +0300
4Subject: [PATCH] Fix E500 with SPE errors with the _Decimal64 type
5
6[gcc]
72014-04-21 Michael Meissner <meissner-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
8
9 PR target/60735
10 * config/rs6000/rs6000.md (mov<mode>_softfloat32, FMOVE64 case):
11 If mode is DDmode and TARGET_E500_DOUBLE allow move.
12
13 * config/rs6000/rs6000.c (rs6000_debug_reg_global): Print some
14 more debug information for E500 if -mdebug=reg.
15
16[gcc/testsuite]
172014-04-21 Michael Meissner <meissner-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
18
19 PR target/60735
20 * gcc.target/powerpc/pr60735.c: New test. Insure _Decimal64 does
21 not cause errors if -mspe.
22
23Upstream status: Accepted
24
25This solves upstream bug 60735
26(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60735).
27
28Patch taken from https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=209664
29---
30 gcc/config/rs6000/rs6000.c | 18 ++++++++++++++++++
31 gcc/config/rs6000/rs6000.md | 3 ++-
32 gcc/testsuite/gcc.target/powerpc/pr60735.c | 11 +++++++++++
33 3 files changed, 31 insertions(+), 1 deletion(-)
34 create mode 100644 gcc/testsuite/gcc.target/powerpc/pr60735.c
35
36diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
37index 494efc5..6dcf440 100644
38--- a/gcc/config/rs6000/rs6000.c
39+++ b/gcc/config/rs6000/rs6000.c
40@@ -2283,6 +2283,24 @@ rs6000_debug_reg_global (void)
41 if (rs6000_float_gprs)
42 fprintf (stderr, DEBUG_FMT_S, "float_gprs", "true");
43
44+ fprintf (stderr, DEBUG_FMT_S, "fprs",
45+ (TARGET_FPRS ? "true" : "false"));
46+
47+ fprintf (stderr, DEBUG_FMT_S, "single_float",
48+ (TARGET_SINGLE_FLOAT ? "true" : "false"));
49+
50+ fprintf (stderr, DEBUG_FMT_S, "double_float",
51+ (TARGET_DOUBLE_FLOAT ? "true" : "false"));
52+
53+ fprintf (stderr, DEBUG_FMT_S, "soft_float",
54+ (TARGET_SOFT_FLOAT ? "true" : "false"));
55+
56+ fprintf (stderr, DEBUG_FMT_S, "e500_single",
57+ (TARGET_E500_SINGLE ? "true" : "false"));
58+
59+ fprintf (stderr, DEBUG_FMT_S, "e500_double",
60+ (TARGET_E500_DOUBLE ? "true" : "false"));
61+
62 if (TARGET_LINK_STACK)
63 fprintf (stderr, DEBUG_FMT_S, "link_stack", "true");
64
65diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
66index 64c9e7c..9cefe15 100644
67--- a/gcc/config/rs6000/rs6000.md
68+++ b/gcc/config/rs6000/rs6000.md
69@@ -9395,7 +9395,8 @@
70 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,G,H,F"))]
71 "! TARGET_POWERPC64
72 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
73- || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
74+ || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE
75+ || (<MODE>mode == DDmode && TARGET_E500_DOUBLE))
76 && (gpc_reg_operand (operands[0], <MODE>mode)
77 || gpc_reg_operand (operands[1], <MODE>mode))"
78 "#"
79diff --git a/gcc/testsuite/gcc.target/powerpc/pr60735.c b/gcc/testsuite/gcc.target/powerpc/pr60735.c
80new file mode 100644
81index 0000000..9bac30b
82--- /dev/null
83+++ b/gcc/testsuite/gcc.target/powerpc/pr60735.c
84@@ -0,0 +1,11 @@
85+/* { dg-do compile } */
86+/* { dg-options "-mcpu=8548 -mspe -mabi=spe -O2" } */
87+/* { dg-skip-if "not an SPE target" { ! powerpc_spe_nocache } { "*" } { "" } } */
88+
89+/* In PR60735, the type _Decimal64 generated an insn not found message. */
90+
91+void
92+pr60735 (_Decimal64 *p, _Decimal64 *q)
93+{
94+ *p = *q;
95+}
96--
971.7.9.5
98
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch
new file mode 100644
index 0000000..23b445c
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch
@@ -0,0 +1,66 @@
1From a22a222c8f9299f6c07a0274388ade7d4ab8c28d Mon Sep 17 00:00:00 2001
2From: Paul Gortmaker <paul.gortmaker@windriver.com>
3Date: Fri, 20 Jun 2014 16:41:08 -0400
4Subject: [PATCH] gcc: fix segfault from calling free on non-malloc'd area
5
6We see the following on a 32bit gcc installed on 64 bit host:
7
8 Reading symbols from ./i586-pokymllib32-linux-gcc...done.
9 (gdb) run
10 Starting program: x86-pokymllib32-linux/lib32-gcc/4.9.0-r0/image/usr/bin/i586-pokymllib32-linux-gcc
11
12 Program received signal SIGSEGV, Segmentation fault.
13 0xf7e957e0 in free () from /lib/i386-linux-gnu/libc.so.6
14 (gdb) bt
15 #0 0xf7e957e0 in free () from /lib/i386-linux-gnu/libc.so.6
16 #1 0x0804b73c in set_multilib_dir () at gcc-4.9.0/gcc/gcc.c:7827
17 #2 main (argc=1, argv=0xffffd504) at gcc-4.9.0/gcc/gcc.c:6688
18 (gdb)
19
20The problem arises because we conditionally assign the pointer we
21eventually free, and the conditional may assign the pointer to the
22non-malloc'd internal string "." which fails when we free it here:
23
24 if (multilib_dir == NULL && multilib_os_dir != NULL
25 && strcmp (multilib_os_dir, ".") == 0)
26 {
27 free (CONST_CAST (char *, multilib_os_dir));
28 ...
29
30As suggested by Jakub, ensure the "." case is also malloc'd via
31xstrdup() and hence the pointer for the "." case can be freed.
32
33Cc: Jakub Jelinek <jakub@redhat.com>
34Cc: Jeff Law <law@redhat.com>
35Cc: Matthias Klose <doko@ubuntu.com>
36CC: Tobias Burnus <burnus@net-b.de>
37Upstream-Status: Accepted [ https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02069.html ]
38Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
39
40diff --git a/gcc/gcc.c b/gcc/gcc.c
41index 9ac18e60d801..168acf7eb0c9 100644
42--- a/gcc/gcc.c
43+++ b/gcc/gcc.c
44@@ -7790,10 +7790,15 @@ set_multilib_dir (void)
45 q2++;
46 if (*q2 == ':')
47 ml_end = q2;
48- new_multilib_os_dir = XNEWVEC (char, ml_end - q);
49- memcpy (new_multilib_os_dir, q + 1, ml_end - q - 1);
50- new_multilib_os_dir[ml_end - q - 1] = '\0';
51- multilib_os_dir = *new_multilib_os_dir ? new_multilib_os_dir : ".";
52+ if (ml_end - q == 1)
53+ multilib_os_dir = xstrdup (".");
54+ else
55+ {
56+ new_multilib_os_dir = XNEWVEC (char, ml_end - q);
57+ memcpy (new_multilib_os_dir, q + 1, ml_end - q - 1);
58+ new_multilib_os_dir[ml_end - q - 1] = '\0';
59+ multilib_os_dir = new_multilib_os_dir;
60+ }
61
62 if (q2 < end && *q2 == ':')
63 {
64--
651.9.2
66
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0054-gcc-Makefile.in-fix-parallel-building-failure.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0054-gcc-Makefile.in-fix-parallel-building-failure.patch
new file mode 100644
index 0000000..4c98ca2
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0054-gcc-Makefile.in-fix-parallel-building-failure.patch
@@ -0,0 +1,61 @@
1gcc/Makefile.in: fix parallel building failure
2
3The gcc-ar.o, gcc-nm.o, gcc-ranlib.o and errors.o included
4config.h which was a generated file. But no explicity rule
5to clarify the dependency. There was potential building
6failure while parallel make.
7
8For gcc-ar.o, gcc-nm.o and gcc-ranlib.o, they were compiled from one C
9source file gcc-ar.c, we add them to ALL_HOST_BACKEND_OBJS, so the
10'$(ALL_HOST_OBJS) : | $(generated_files)' rule could work for these
11objects.
12
13For errors.o, it is part of gengtype, and the gengtype generator program
14is special: Two versions are built. One is for the build machine, and one
15is for the host. We refered what gengtype-parse.o did (which also is part
16of gengtype).
17
18[GCC #61899]
19https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61899
20
21Upstream-Status: Send to gcc-patches@gcc.gnu.org mailing list
22
23Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
24---
25 gcc/Makefile.in | 7 ++++++-
26 1 file changed, 6 insertions(+), 1 deletion(-)
27
28diff --git a/gcc/Makefile.in b/gcc/Makefile.in
29index 6475cba..56e50bb 100644
30--- a/gcc/Makefile.in
31+++ b/gcc/Makefile.in
32@@ -1481,13 +1481,16 @@ OBJS-libcommon-target = $(common_out_object_file) prefix.o params.o \
33 opts.o opts-common.o options.o vec.o hooks.o common/common-targhooks.o \
34 hash-table.o file-find.o
35
36+# Objects compiled from one C source file gcc-ar.c
37+OBJS-gcc-ar = gcc-ar.o gcc-nm.o gcc-ranlib.o
38+
39 # This lists all host objects for the front ends.
40 ALL_HOST_FRONTEND_OBJS = $(foreach v,$(CONFIG_LANGUAGES),$($(v)_OBJS))
41
42 ALL_HOST_BACKEND_OBJS = $(GCC_OBJS) $(OBJS) $(OBJS-libcommon) \
43 $(OBJS-libcommon-target) @TREEBROWSER@ main.o c-family/cppspec.o \
44 $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) $(GCOV_OBJS) $(GCOV_DUMP_OBJS) \
45- lto-wrapper.o
46+ lto-wrapper.o $(OBJS-gcc-ar)
47
48 # This lists all host object files, whether they are included in this
49 # compilation or not.
50@@ -2437,6 +2440,8 @@ gengtype-parse.o: $(CONFIG_H)
51 CFLAGS-build/gengtype-parse.o += -DGENERATOR_FILE
52 build/gengtype-parse.o: $(BCONFIG_H)
53
54+errors.o : $(CONFIG_H)
55+
56 gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \
57 gengtype.h errors.h double-int.h version.h $(HASHTAB_H) $(OBSTACK_H) \
58 $(XREGEX_H)
59--
601.8.1.2
61
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0055-PR-rtl-optimization-61801.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0055-PR-rtl-optimization-61801.patch
new file mode 100644
index 0000000..b27abde
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0055-PR-rtl-optimization-61801.patch
@@ -0,0 +1,36 @@
1From 556537c4ad0df4cbebb74197bb2bdea75cf5dd35 Mon Sep 17 00:00:00 2001
2From: rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Thu, 17 Jul 2014 07:48:49 +0000
4Subject: [PATCH] 2014-07-17 Richard Biener <rguenther@suse.de>
5
6 PR rtl-optimization/61801
7 * sched-deps.c (sched_analyze_2): For ASM_OPERANDS and
8 ASM_INPUT don't set reg_pending_barrier if it appears in a
9 debug-insn.
10
11
12git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@212739 138bc75d-0d04-0410-961f-82ee72b054a4
13
14Upstream-Status: Backport [https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801]
15Signed-off-by: Peter A. Bigot <pab@pabigot.com>
16
17---
18 gcc/sched-deps.c | 3 ++-
19
20diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
21index efc4223..df29bd3 100644
22--- a/gcc/sched-deps.c
23+++ b/gcc/sched-deps.c
24@@ -2750,7 +2750,8 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx insn)
25 Consider for instance a volatile asm that changes the fpu rounding
26 mode. An insn should not be moved across this even if it only uses
27 pseudo-regs because it might give an incorrectly rounded result. */
28- if (code != ASM_OPERANDS || MEM_VOLATILE_P (x))
29+ if ((code != ASM_OPERANDS || MEM_VOLATILE_P (x))
30+ && !DEBUG_INSN_P (insn))
31 reg_pending_barrier = TRUE_BARRIER;
32
33 /* For all ASM_OPERANDS, we must traverse the vector of input operands.
34--
351.8.5.5
36
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0056-top-level-reorder_gcc-bug-61144.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0056-top-level-reorder_gcc-bug-61144.patch
new file mode 100644
index 0000000..f448932
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0056-top-level-reorder_gcc-bug-61144.patch
@@ -0,0 +1,31 @@
1
2Upstream-Status: Backport
3
4Originally-submitted-by: Peter Urbanec <openembedded-devel@urbanec.net>
5Signed-off-by: Saul Wold <sgw@linux.intel.com>
6
7--- /dev/null
8+++ b/meta/recipes-devtools/gcc/gcc-4.9/0056-top-level-reorder_gcc-bug-61144.patch
9@@ -0,0 +1,21 @@
10+--- a/gcc/varpool.c 2014/10/05 02:50:01 215895
11++++ b/gcc/varpool.c 2014/10/05 04:52:19 215896
12+@@ -329,8 +329,16 @@
13+
14+ /* Variables declared 'const' without an initializer
15+ have zero as the initializer if they may not be
16+- overridden at link or run time. */
17+- if (!DECL_INITIAL (real_decl)
18++ overridden at link or run time.
19++
20++ It is actually requirement for C++ compiler to optimize const variables
21++ consistently. As a GNU extension, do not enfore this rule for user defined
22++ weak variables, so we support interposition on:
23++ static const int dummy = 0;
24++ extern const int foo __attribute__((__weak__, __alias__("dummy")));
25++ */
26++ if ((!DECL_INITIAL (real_decl)
27++ || (DECL_WEAK (decl) && !DECL_COMDAT (decl)))
28+ && (DECL_EXTERNAL (decl) || decl_replaceable_p (decl)))
29+ return error_mark_node;
30+
31
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0058-gcc-r212171.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0058-gcc-r212171.patch
new file mode 100644
index 0000000..4b312d4
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0058-gcc-r212171.patch
@@ -0,0 +1,113 @@
1From ca03cf1b133d66eb978c68f6dbc345e9aabcba88 Mon Sep 17 00:00:00 2001
2From: uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Mon, 30 Jun 2014 19:30:52 +0000
4Subject: [PATCH] r212171
5
6* except.c (emit_note_eh_region_end): New helper
7 function. (convert_to_eh_region_ranges): Use
8 emit_note_eh_region_end to emit EH_REGION_END note.
9 * jump.c (cleanup_barriers): Do not split a call and its
10 corresponding CALL_ARG_LOCATION note.
11
12git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212171 138bc75d-0d04-0410-961f-82ee72b054a4
13
14Upstream-status: Backport [https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=212171]
15Signed-off-by: Baoshan Pang <baoshan.pang@windriver.com>
16---
17 gcc/except.c | 23 ++++++++++++++++++-----
18 gcc/jump.c | 19 +++++++++++++++----
19 2 files changed, 33 insertions(+), 9 deletions(-)
20
21diff --git a/gcc/except.c b/gcc/except.c
22index dc5c1d2..7ac114f 100644
23--- a/gcc/except.c
24+++ b/gcc/except.c
25@@ -2466,6 +2466,20 @@ add_call_site (rtx landing_pad, int action, int section)
26 return call_site_base + crtl->eh.call_site_record_v[section]->length () - 1;
27 }
28
29+static rtx
30+emit_note_eh_region_end (rtx insn)
31+{
32+ rtx next = NEXT_INSN (insn);
33+
34+ /* Make sure we do not split a call and its corresponding
35+ CALL_ARG_LOCATION note. */
36+ if (next && NOTE_P (next)
37+ && NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
38+ insn = next;
39+
40+ return emit_note_after (NOTE_INSN_EH_REGION_END, insn);
41+}
42+
43 /* Turn REG_EH_REGION notes back into NOTE_INSN_EH_REGION notes.
44 The new note numbers will not refer to region numbers, but
45 instead to call site entries. */
46@@ -2544,8 +2558,8 @@ convert_to_eh_region_ranges (void)
47 note = emit_note_before (NOTE_INSN_EH_REGION_BEG,
48 first_no_action_insn_before_switch);
49 NOTE_EH_HANDLER (note) = call_site;
50- note = emit_note_after (NOTE_INSN_EH_REGION_END,
51- last_no_action_insn_before_switch);
52+ note
53+ = emit_note_eh_region_end (last_no_action_insn_before_switch);
54 NOTE_EH_HANDLER (note) = call_site;
55 gcc_assert (last_action != -3
56 || (last_action_insn
57@@ -2569,8 +2583,7 @@ convert_to_eh_region_ranges (void)
58 first_no_action_insn = NULL_RTX;
59 }
60
61- note = emit_note_after (NOTE_INSN_EH_REGION_END,
62- last_action_insn);
63+ note = emit_note_eh_region_end (last_action_insn);
64 NOTE_EH_HANDLER (note) = call_site;
65 }
66
67@@ -2617,7 +2630,7 @@ convert_to_eh_region_ranges (void)
68
69 if (last_action >= -1 && ! first_no_action_insn)
70 {
71- note = emit_note_after (NOTE_INSN_EH_REGION_END, last_action_insn);
72+ note = emit_note_eh_region_end (last_action_insn);
73 NOTE_EH_HANDLER (note) = call_site;
74 }
75
76diff --git a/gcc/jump.c b/gcc/jump.c
77index 9418f65..a5e5f52 100644
78--- a/gcc/jump.c
79+++ b/gcc/jump.c
80@@ -121,15 +121,26 @@ rebuild_jump_labels_chain (rtx chain)
81 static unsigned int
82 cleanup_barriers (void)
83 {
84- rtx insn, next, prev;
85- for (insn = get_insns (); insn; insn = next)
86+ rtx insn;
87+ for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
88 {
89- next = NEXT_INSN (insn);
90 if (BARRIER_P (insn))
91 {
92- prev = prev_nonnote_insn (insn);
93+ rtx prev = prev_nonnote_insn (insn);
94 if (!prev)
95 continue;
96+
97+ if (CALL_P (prev))
98+ {
99+ /* Make sure we do not split a call and its corresponding
100+ CALL_ARG_LOCATION note. */
101+ rtx next = NEXT_INSN (prev);
102+
103+ if (NOTE_P (next)
104+ && NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
105+ prev = next;
106+ }
107+
108 if (BARRIER_P (prev))
109 delete_insn (insn);
110 else if (prev != PREV_INSN (insn))
111--
1121.7.9.5
113
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0059-gcc-PR-rtl-optimization-63348.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0059-gcc-PR-rtl-optimization-63348.patch
new file mode 100644
index 0000000..6d24aa4
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0059-gcc-PR-rtl-optimization-63348.patch
@@ -0,0 +1,59 @@
1From 6eae3e637fcc22d21b51d44d61e3a9cb4825e776 Mon Sep 17 00:00:00 2001
2From: Jackie Huang <jackie.huang@windriver.com>
3Date: Thu, 30 Oct 2014 20:37:14 -0700
4Subject: [PATCH]PR rtl-optimization/63348
5
6PR rtl-optimization/63348
7* emit-rtl.c (try_split): Do not emit extra barrier.
8
9Note: this patch is to fix the side effect introduced by r212171 which was reported at:
10https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63348
11
12git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215613 138bc75d-0d04-0410-961f-82ee72b054a4
13
14Upstream-status: Backport [https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=215613]
15Signed-off-by: Baoshan Pang <baoshan.pang@windriver.com>
16Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
17---
18 gcc/emit-rtl.c | 11 -----------
19 1 files changed, 0 insertions(+), 11 deletions(-)
20
21diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
22index 4736f8d..ae69dbd 100644
23--- a/gcc/emit-rtl.c
24+++ b/gcc/emit-rtl.c
25@@ -3422,7 +3422,6 @@ try_split (rtx pat, rtx trial, int last)
26 {
27 rtx before = PREV_INSN (trial);
28 rtx after = NEXT_INSN (trial);
29- int has_barrier = 0;
30 rtx note, seq, tem;
31 int probability;
32 rtx insn_last, insn;
33@@ -3441,14 +3440,6 @@ try_split (rtx pat, rtx trial, int last)
34
35 split_branch_probability = -1;
36
37- /* If we are splitting a JUMP_INSN, it might be followed by a BARRIER.
38- We may need to handle this specially. */
39- if (after && BARRIER_P (after))
40- {
41- has_barrier = 1;
42- after = NEXT_INSN (after);
43- }
44-
45 if (!seq)
46 return trial;
47
48@@ -3594,8 +3585,6 @@ try_split (rtx pat, rtx trial, int last)
49 tem = emit_insn_after_setloc (seq, trial, INSN_LOCATION (trial));
50
51 delete_insn (trial);
52- if (has_barrier)
53- emit_barrier_after (tem);
54
55 /* Recursively call try_split for each new insn created; by the
56 time control returns here that insn will be fully split, so
57--
581.7.1
59
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/AArch64-Define-BE-loader-name-default-be.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/AArch64-Define-BE-loader-name-default-be.patch
new file mode 100644
index 0000000..8755241
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/AArch64-Define-BE-loader-name-default-be.patch
@@ -0,0 +1,38 @@
1Index: gcc-linaro-4.8-2014.03/gcc/config/aarch64/aarch64-linux.h
2===================================================================
3--- gcc-linaro-4.8-2014.03.orig/gcc/config/aarch64/aarch64-linux.h
4+++ gcc-linaro-4.8-2014.03/gcc/config/aarch64/aarch64-linux.h
5@@ -21,10 +21,23 @@
6 #ifndef GCC_AARCH64_LINUX_H
7 #define GCC_AARCH64_LINUX_H
8
9-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
10-
11 #define CPP_SPEC "%{pthread:-D_REENTRANT}"
12
13+#if TARGET_BIG_ENDIAN_DEFAULT
14+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{!mlittle-endian:_be}.so.1"
15+
16+#define LINUX_TARGET_LINK_SPEC "%{h*} \
17+ %{static:-Bstatic} \
18+ %{shared:-shared} \
19+ %{symbolic:-Bsymbolic} \
20+ %{rdynamic:-export-dynamic} \
21+ -dynamic-linker " GNU_USER_DYNAMIC_LINKER " \
22+ -X \
23+ %{mbig-endian:-EB} %{mlittle-endian:-EL} \
24+ -maarch64linux%{mabi=ilp32:32}%{!mlittle-endian:b}"
25+#else
26+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
27+
28 #define LINUX_TARGET_LINK_SPEC "%{h*} \
29 %{static:-Bstatic} \
30 %{shared:-shared} \
31@@ -34,6 +47,7 @@
32 -X \
33 %{mbig-endian:-EB} %{mlittle-endian:-EL} \
34 -maarch64linux%{mabi=ilp32:32}%{mbig-endian:b}"
35+#endif
36
37 #define LINK_SPEC LINUX_TARGET_LINK_SPEC
38
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/use-lib-for-aarch64.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/use-lib-for-aarch64.patch
new file mode 100644
index 0000000..62bb110
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/use-lib-for-aarch64.patch
@@ -0,0 +1,13 @@
1diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux
2index 147452b..1930046 100644
3--- a/gcc/config/aarch64/t-aarch64-linux
4+++ b/gcc/config/aarch64/t-aarch64-linux
5@@ -22,7 +22,7 @@ LIB1ASMSRC = aarch64/lib1funcs.asm
6 LIB1ASMFUNCS = _aarch64_sync_cache_range
7
8 AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
9-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
10+MULTILIB_OSDIRNAMES = mabi.lp64=../lib$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
11 MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
12
13 MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-common-4.8.inc b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-common-4.8.inc
new file mode 100644
index 0000000..ea97fdb
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-common-4.8.inc
@@ -0,0 +1,2 @@
1BASEPV = "4.8"
2PV = "linaro-${BASEPV}"
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-common-4.9.inc b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-common-4.9.inc
new file mode 100644
index 0000000..52f0696
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-common-4.9.inc
@@ -0,0 +1,2 @@
1BASEPV = "4.9"
2PV = "linaro-${BASEPV}"
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-runtime_linaro-4.8.bb b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-runtime_linaro-4.8.bb
new file mode 100644
index 0000000..971c1e4
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-runtime_linaro-4.8.bb
@@ -0,0 +1,2 @@
1require gcc-linaro-common-4.8.inc
2require recipes-devtools/gcc/gcc-runtime_${BASEPV}.bb
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-runtime_linaro-4.9.bb b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-runtime_linaro-4.9.bb
new file mode 100644
index 0000000..c298881
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-runtime_linaro-4.9.bb
@@ -0,0 +1,2 @@
1require gcc-linaro-common-4.9.inc
2require recipes-devtools/gcc/gcc-runtime_${BASEPV}.bb
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-source_linaro-4.8.bb b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-source_linaro-4.8.bb
new file mode 100644
index 0000000..433f4e0
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-source_linaro-4.8.bb
@@ -0,0 +1,3 @@
1require gcc-linaro-common-4.8.inc
2require recipes-devtools/gcc/gcc-${PV}.inc
3require recipes-devtools/gcc/gcc-source.inc
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-source_linaro-4.9.bb b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-source_linaro-4.9.bb
new file mode 100644
index 0000000..f77b2b2
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-source_linaro-4.9.bb
@@ -0,0 +1,3 @@
1require gcc-linaro-common-4.9.inc
2require recipes-devtools/gcc/gcc-${PV}.inc
3require recipes-devtools/gcc/gcc-source.inc
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc_linaro-4.8.bb b/meta-linaro-toolchain/recipes-devtools/gcc/gcc_linaro-4.8.bb
new file mode 100644
index 0000000..73ff5c4
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc_linaro-4.8.bb
@@ -0,0 +1,4 @@
1require gcc-linaro-common-4.8.inc
2require recipes-devtools/gcc/gcc_${BASEPV}.bb
3
4DEPENDS += "gmp-native"
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc_linaro-4.9.bb b/meta-linaro-toolchain/recipes-devtools/gcc/gcc_linaro-4.9.bb
new file mode 100644
index 0000000..0306ed8
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc_linaro-4.9.bb
@@ -0,0 +1,4 @@
1require gcc-linaro-common-4.9.inc
2require recipes-devtools/gcc/gcc_${BASEPV}.bb
3
4DEPENDS += "gmp-native"
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/libgcc-initial_linaro-4.8.bb b/meta-linaro-toolchain/recipes-devtools/gcc/libgcc-initial_linaro-4.8.bb
new file mode 100644
index 0000000..d9a99ec
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/libgcc-initial_linaro-4.8.bb
@@ -0,0 +1,3 @@
1require gcc-linaro-common-4.8.inc
2require gcc-linaro-4.8.inc
3require recipes-devtools/gcc/libgcc-initial.inc
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/libgcc-initial_linaro-4.9.bb b/meta-linaro-toolchain/recipes-devtools/gcc/libgcc-initial_linaro-4.9.bb
new file mode 100644
index 0000000..987cc52
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/libgcc-initial_linaro-4.9.bb
@@ -0,0 +1,3 @@
1require gcc-linaro-common-4.9.inc
2require gcc-linaro-4.9.inc
3require recipes-devtools/gcc/libgcc-initial.inc
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/libgcc_linaro-4.8.bb b/meta-linaro-toolchain/recipes-devtools/gcc/libgcc_linaro-4.8.bb
new file mode 100644
index 0000000..d37d511
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/libgcc_linaro-4.8.bb
@@ -0,0 +1,2 @@
1require gcc-linaro-common-4.8.inc
2require recipes-devtools/gcc/libgcc_${BASEPV}.bb
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/libgcc_linaro-4.9.bb b/meta-linaro-toolchain/recipes-devtools/gcc/libgcc_linaro-4.9.bb
new file mode 100644
index 0000000..540230d
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/libgcc_linaro-4.9.bb
@@ -0,0 +1,2 @@
1require gcc-linaro-common-4.9.inc
2require recipes-devtools/gcc/libgcc_${BASEPV}.bb
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/libgfortran_linaro-4.8.bb b/meta-linaro-toolchain/recipes-devtools/gcc/libgfortran_linaro-4.8.bb
new file mode 100644
index 0000000..4ec303b
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/libgfortran_linaro-4.8.bb
@@ -0,0 +1,4 @@
1require gcc-linaro-common-4.8.inc
2require gcc-linaro-4.8.inc
3require recipes-devtools/gcc/libgfortran.inc
4
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/libgfortran_linaro-4.9.bb b/meta-linaro-toolchain/recipes-devtools/gcc/libgfortran_linaro-4.9.bb
new file mode 100644
index 0000000..181ef0a
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/libgfortran_linaro-4.9.bb
@@ -0,0 +1,4 @@
1require gcc-linaro-common-4.9.inc
2require gcc-linaro-4.9.inc
3require recipes-devtools/gcc/libgfortran.inc
4
diff --git a/meta-linaro-toolchain/recipes-devtools/gdb/gdb-7.8/sim-install-6.6.patch b/meta-linaro-toolchain/recipes-devtools/gdb/gdb-7.8/sim-install-6.6.patch
new file mode 100644
index 0000000..f67c25d
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gdb/gdb-7.8/sim-install-6.6.patch
@@ -0,0 +1,14 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3--- gdb-6.1/sim/common/Makefile.in~ 2004-01-15 21:25:06.000000000 +0000
4+++ gdb-6.1/sim/common/Makefile.in 2004-07-22 17:07:46.237809032 +0100
5@@ -34,7 +34,7 @@
6
7 datadir = @datadir@
8 mandir = @mandir@
9-man1dir = $(mandir)/man1
10+man1dir = $(DESTDIR)$(mandir)/man1
11 infodir = @infodir@
12 includedir = @includedir@
13
14
diff --git a/meta-linaro-toolchain/recipes-devtools/gdb/gdb-cross-canadian_linaro-7.8.bb b/meta-linaro-toolchain/recipes-devtools/gdb/gdb-cross-canadian_linaro-7.8.bb
new file mode 100644
index 0000000..5c79fdd
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gdb/gdb-cross-canadian_linaro-7.8.bb
@@ -0,0 +1,3 @@
1require recipes-devtools/gdb/gdb-common.inc
2require recipes-devtools/gdb/gdb-cross-canadian.inc
3require gdb-${PV}.inc
diff --git a/meta-linaro-toolchain/recipes-devtools/gdb/gdb-cross_linaro-7.8.bb b/meta-linaro-toolchain/recipes-devtools/gdb/gdb-cross_linaro-7.8.bb
new file mode 100644
index 0000000..b2003b4
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gdb/gdb-cross_linaro-7.8.bb
@@ -0,0 +1,4 @@
1require recipes-devtools/gdb/gdb-cross.inc
2require gdb-${PV}.inc
3
4SRC_URI += "file://sim-install-6.6.patch"
diff --git a/meta-linaro-toolchain/recipes-devtools/gdb/gdb-linaro-7.8.inc b/meta-linaro-toolchain/recipes-devtools/gdb/gdb-linaro-7.8.inc
new file mode 100644
index 0000000..773fcea
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gdb/gdb-linaro-7.8.inc
@@ -0,0 +1,20 @@
1LICENSE="GPLv2 & GPLv3 & LGPLv2 & LGPLv3"
2LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
3 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
4 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
5 file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674"
6
7
8MMYY = "14.09"
9RELEASE = "20${MMYY}"
10PR = "r${RELEASE}"
11BINV = "7.8"
12
13S = "${WORKDIR}/${BPN}-${PV}-${RELEASE}"
14
15FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/gdb-${BINV}' ], d)}"
16
17SRC_URI = "https://releases.linaro.org/${MMYY}/components/toolchain/gdb-linaro/gdb-${PV}-${RELEASE}.tar.xz"
18
19SRC_URI[md5sum] = "954e47e397de0b635ecdb5bb5d0f145f"
20SRC_URI[sha256sum] = "fbbe96b8d0debf7c2d8c9a4a6c7ca0ba87d536e43289f81c4af56f95e5f7b5ea"
diff --git a/meta-linaro-toolchain/recipes-devtools/gdb/gdb_linaro-7.8.bb b/meta-linaro-toolchain/recipes-devtools/gdb/gdb_linaro-7.8.bb
new file mode 100644
index 0000000..3ce2de4
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gdb/gdb_linaro-7.8.bb
@@ -0,0 +1,23 @@
1require recipes-devtools/gdb/gdb.inc
2require gdb-${PV}.inc
3
4inherit python-dir
5
6PACKAGECONFIG ??= ""
7PACKAGECONFIG[python] = "--with-python=${WORKDIR}/python,--without-python,python"
8
9do_configure_prepend() {
10 if [ -n "${@base_contains('PACKAGECONFIG', 'python', 'python', '', d)}" ]; then
11 cat > ${WORKDIR}/python << EOF
12#!/bin/sh
13case "\$2" in
14 --includes) echo "-I${STAGING_INCDIR}/${PYTHON_DIR}/" ;;
15 --ldflags) echo "-Wl,-rpath-link,${STAGING_LIBDIR}/.. -Wl,-rpath,${libdir}/.. -lpthread -ldl -lutil -lm -lpython${PYTHON_BASEVERSION}" ;;
16 --exec-prefix) echo "${exec_prefix}" ;;
17 *) exit 1 ;;
18esac
19exit 0
20EOF
21 chmod +x ${WORKDIR}/python
22 fi
23}