diff --git a/conf/distro/snps-arc64-minimal.conf b/conf/distro/snps-arc64-minimal.conf new file mode 100644 index 0000000..154f195 --- /dev/null +++ b/conf/distro/snps-arc64-minimal.conf @@ -0,0 +1,16 @@ +DISTRO_NAME = "Synopsys minimal ramdisk" +DISTRO_VERSION = "0.1" +TARGET_VENDOR = "-snps" + +VIRTUAL-RUNTIME_dev_manager = "busybox-mdev" +VIRTUAL-RUNTIME_login_manager = "busybox" +VIRTUAL-RUNTIME_init_manager = "busybox" +VIRTUAL-RUNTIME_base-utils = "busybox" + +PREFERRED_PROVIDER_virtual/kernel = "linux-arc64-dev" + +GCCVERSION = "arc" +SDKGCCVERSION = "${GCCVERSION}" +BINUVERSION = "arc" +GDBVERSION = "arc" +GLIBCVERSION = "arc64" diff --git a/conf/layer.conf b/conf/layer.conf index b8a6204..b83b2df 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -8,6 +8,6 @@ BBFILE_COLLECTIONS += "synopsys-layer" BBFILE_PATTERN_synopsys-layer = "^${LAYERDIR}/" BBFILE_PRIORITY_synopsys-layer = "6" -LAYERSERIES_COMPAT_synopsys-layer = " honister" +LAYERSERIES_COMPAT_synopsys-layer = " kirkstone" TOOLCHAIN_arc = "gcc" diff --git a/conf/machine/hapshs5x.conf b/conf/machine/hapshs5x.conf new file mode 100644 index 0000000..795bac7 --- /dev/null +++ b/conf/machine/hapshs5x.conf @@ -0,0 +1,11 @@ +DEFAULTTUNE = "hs58" + +require conf/machine/include/tune-arcv3.inc + +SERIAL_CONSOLES = "115200;ttyS0" + +KERNEL_IMAGETYPE = "loader" + +IMAGE_FSTYPES += "${INITRAMFS_FSTYPES}" +INITRAMFS_IMAGE ?= "core-image-minimal" +INITRAMFS_IMAGE_BUNDLE = "1" diff --git a/conf/machine/hapshs6x.conf b/conf/machine/hapshs6x.conf new file mode 100644 index 0000000..1e36017 --- /dev/null +++ b/conf/machine/hapshs6x.conf @@ -0,0 +1,11 @@ +DEFAULTTUNE = "hs68" + +require conf/machine/include/tune-arcv3.inc + +SERIAL_CONSOLES = "115200;ttyS0" + +KERNEL_IMAGETYPE = "loader" + +IMAGE_FSTYPES += "${INITRAMFS_FSTYPES}" +INITRAMFS_IMAGE ?= "core-image-minimal" +INITRAMFS_IMAGE_BUNDLE = "1" diff --git a/conf/machine/include/tune-arcv3.inc b/conf/machine/include/tune-arcv3.inc new file mode 100644 index 0000000..121d330 --- /dev/null +++ b/conf/machine/include/tune-arcv3.inc @@ -0,0 +1,43 @@ +TUNE_ARCH = "${@bb.utils.contains('TUNE_FEATURES', 'hs58', 'arc32', 'arc64', d)}" + +TUNE_PKGARCH = "${TUNE_PKGARCH_tune-${DEFAULTTUNE}}" + +TUNEVALID[hs58] = "Enable ARCv3 64-bit" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'hs58', ' -mcpu=hs5x', '', d)}" + +TUNEVALID[hs68] = "Enable ARCv3 64-bit core" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'hs68', ' -mcpu=hs6x', '', d)}" + +TUNEVALID[ll64] = "Enable 64-bit load/store operations" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'll64', ' -mll64', '', d)}" + +TUNEVALID[ll128] = "Enable 128-bit load/store operations" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'll128', ' -m128', ' -mno-128', d)}" + +TUNEVALID[div_rem] = "Enable simple divider" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'div_rem', ' -mdiv-rem', ' -mno-div-rem', d)}" + +AVAILTUNES += "hs58 hs68" + +TUNE_FEATURES:tune-hs58 = "hs58 div_rem" +TUNE_PKGARCH_tune-hs58 = "hs58" +PACKAGE_EXTRA_ARCHS:tune-hs58 = "hs58" + +TUNE_FEATURES:tune-hs68 = "hs68 ll128 div_rem" +TUNE_PKGARCH_tune-hs68 = "hs68" +PACKAGE_EXTRA_ARCHS:tune-hs68 = "hs68" + +def arc_machine_dict(machdata, d): + machdata = { + "elf" : { + "arc32" : (255, 0, 0, True, 32), + "arc64" : (253, 0, 0, True, 64), + }, + "linux" : { + "arc32" : (255, 0, 0, True, 32), + "arc64" : (253, 0, 0, True, 64), + }, + } + return machdata + +PACKAGEQA_EXTRA_MACHDEFFUNCS = "arc_machine_dict" diff --git a/recipes-connectivity/openssl/openssl_%.bbappend b/recipes-connectivity/openssl/openssl_%.bbappend new file mode 100644 index 0000000..e93094a --- /dev/null +++ b/recipes-connectivity/openssl/openssl_%.bbappend @@ -0,0 +1,2 @@ +# Using 64-bit atomics requires libatomic on arc32 +CFLAGS:append:arc32 = " -latomic" diff --git a/recipes-core/glibc/cross-localedef-native_arc64.bb b/recipes-core/glibc/cross-localedef-native_arc64.bb new file mode 100644 index 0000000..482e53c --- /dev/null +++ b/recipes-core/glibc/cross-localedef-native_arc64.bb @@ -0,0 +1,49 @@ +SUMMARY = "Cross locale generation tool for glibc" +HOMEPAGE = "http://www.gnu.org/software/libc/libc.html" +SECTION = "libs" +LICENSE = "LGPL-2.1" + +LIC_FILES_CHKSUM = "file://LICENSES;md5=1541fd8f5e8f1579512bf05f533371ba \ + file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \ + file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c" + +require glibc-version.inc + +# Tell autotools that we're working in the localedef directory +# +AUTOTOOLS_SCRIPT_PATH = "${S}/localedef" + +inherit autotools +inherit native + +FILESEXTRAPATHS =. "${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/glibc:" + +SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ + git://github.com/kraj/localedef;branch=master;name=localedef;destsuffix=git/localedef;protocol=https \ + \ + file://0001-localedef-Add-hardlink-resolver-from-util-linux.patch \ + file://0002-localedef-fix-ups-hardlink-to-make-it-compile.patch \ + \ + file://0017-timezone-re-written-tzselect-as-posix-sh.patch \ + file://0018-Remove-bash-dependency-for-nscd-init-script.patch \ + file://0019-eglibc-Cross-building-and-testing-instructions.patch \ + file://0020-eglibc-Help-bootstrap-cross-toolchain.patch \ + file://0021-eglibc-Resolve-__fpscr_values-on-SH4.patch \ + file://0022-eglibc-Forward-port-cross-locale-generation-support.patch \ + file://0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ +" +# Makes for a rather long rev (22 characters), but... +# +SRCREV_FORMAT = "glibc_localedef" + +S = "${WORKDIR}/git" + +EXTRA_OECONF = "--with-glibc=${S}" +CFLAGS += "-fgnu89-inline -std=gnu99 -DIS_IN\(x\)='0'" + +do_install() { + install -d ${D}${bindir} + install -m 0755 ${B}/localedef ${D}${bindir}/cross-localedef + install -m 0755 ${B}/cross-localedef-hardlink ${D}${bindir}/cross-localedef-hardlink +} diff --git a/recipes-core/glibc/glibc-collateral.inc b/recipes-core/glibc/glibc-collateral.inc new file mode 100644 index 0000000..4f81f07 --- /dev/null +++ b/recipes-core/glibc/glibc-collateral.inc @@ -0,0 +1,12 @@ +require glibc-common.inc + +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6 \ + file://${COMMON_LICENSE_DIR}/LGPL-2.1-only;md5=1a6d268fd218675ffea8be556788b780" + +deltask do_fetch +deltask do_unpack +deltask do_patch +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +do_install[depends] += "virtual/${MLPREFIX}libc:do_stash_locale" diff --git a/recipes-core/glibc/glibc-common.inc b/recipes-core/glibc/glibc-common.inc new file mode 100644 index 0000000..f5bc680 --- /dev/null +++ b/recipes-core/glibc/glibc-common.inc @@ -0,0 +1,25 @@ +SUMMARY = "GLIBC (GNU C Library)" +DESCRIPTION = "The GNU C Library is used as the system C library in most systems with the Linux kernel." +HOMEPAGE = "http://www.gnu.org/software/libc/libc.html" +SECTION = "libs" +LICENSE = "GPLv2 & LGPLv2.1" + +LIC_FILES_CHKSUM ?= "file://LICENSES;md5=1541fd8f5e8f1579512bf05f533371ba \ + file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \ + file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c" + +CVE_PRODUCT = "glibc" + +INHIBIT_DEFAULT_DEPS = "1" + +ARM_INSTRUCTION_SET:armv4 = "arm" +ARM_INSTRUCTION_SET:armv5 = "arm" +ARM_INSTRUCTION_SET:armv6 = "arm" +# +# We will skip parsing glibc when target system C library selection is not glibc +# this helps in easing out parsing for non-glibc system libraries +# +COMPATIBLE_HOST:libc-musl:class-target = "null" + +PV = "arc64" diff --git a/recipes-core/glibc/glibc-locale.inc b/recipes-core/glibc/glibc-locale.inc new file mode 100644 index 0000000..b8de7d3 --- /dev/null +++ b/recipes-core/glibc/glibc-locale.inc @@ -0,0 +1,103 @@ +require glibc-collateral.inc + +SUMMARY = "Locale data from glibc" + +BPN = "glibc" +LOCALEBASEPN = "${MLPREFIX}glibc" + +# glibc-collateral.inc inhibits all default deps, but do_package needs objcopy +# ERROR: objcopy failed with exit code 127 (cmd was 'i586-webos-linux-objcopy' --only-keep-debug 'glibc-locale/2.17-r0/package/usr/lib/gconv/IBM1166.so' 'glibc-locale/2.17-r0/package/usr/lib/gconv/.debug/IBM1166.so') +# ERROR: Function failed: split_and_strip_files +BINUTILSDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}binutils:do_populate_sysroot" +BINUTILSDEP:class-nativesdk = "virtual/${TARGET_PREFIX}binutils-crosssdk:do_populate_sysroot" +do_package[depends] += "${BINUTILSDEP}" + +DEPENDS += "virtual/libc" + +# Binary locales are generated at build time if ENABLE_BINARY_LOCALE_GENERATION +# is set. The idea is to avoid running localedef on the target (at first boot) +# to decrease initial boot time and avoid localedef being killed by the OOM +# killer which used to effectively break i18n on machines with < 128MB RAM. + +# default to disabled +ENABLE_BINARY_LOCALE_GENERATION ?= "0" +ENABLE_BINARY_LOCALE_GENERATION:pn-nativesdk-glibc-locale = "1" + +#enable locale generation on these arches +# BINARY_LOCALE_ARCHES is a space separated list of regular expressions +BINARY_LOCALE_ARCHES ?= "arc arm.* aarch64 i[3-6]86 x86_64 powerpc mips mips64 riscv32 riscv64" + +# set "1" to use cross-localedef for locale generation +# set "0" for qemu emulation of native localedef for locale generation +LOCALE_GENERATION_WITH_CROSS-LOCALEDEF = "1" + +PROVIDES = "virtual/libc-locale" + +PACKAGES = "localedef ${PN}-dbg" + +PACKAGES_DYNAMIC = "^locale-base-.* \ + ^glibc-gconv-.* ^glibc-charmap-.* ^glibc-localedata-.* ^glibc-binary-localedata-.* \ + ^${MLPREFIX}glibc-gconv$" + +# Create a glibc-binaries package +ALLOW_EMPTY:${BPN}-binaries = "1" +PACKAGES += "${BPN}-binaries" +RRECOMMENDS:${BPN}-binaries = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-binary") != -1])}" + +# Create a glibc-charmaps package +ALLOW_EMPTY:${BPN}-charmaps = "1" +PACKAGES += "${BPN}-charmaps" +RRECOMMENDS:${BPN}-charmaps = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-charmap") != -1])}" + +# Create a glibc-gconvs package +ALLOW_EMPTY:${BPN}-gconvs = "1" +PACKAGES += "${BPN}-gconvs" +RRECOMMENDS:${BPN}-gconvs = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-gconv") != -1])}" + +# Create a glibc-localedatas package +ALLOW_EMPTY:${BPN}-localedatas = "1" +PACKAGES += "${BPN}-localedatas" +RRECOMMENDS:${BPN}-localedatas = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-localedata") != -1])}" + +DESCRIPTION:localedef = "glibc: compile locale definition files" + +# glibc-gconv is dynamically added into PACKAGES, thus +# FILES:glibc-gconv will not be automatically extended in multilib. +# Explicitly add ${MLPREFIX} for FILES:glibc-gconv. +FILES:${MLPREFIX}glibc-gconv = "${libdir}/gconv/*" +FILES:localedef = "${bindir}/localedef" + +LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale" + +copy_locale_files() { + local dir=$1 mode=$2 + + [ -e "${LOCALETREESRC}$dir" ] || return 0 + + for d in . $(find "${LOCALETREESRC}$dir" -type d -printf '%P '); do + install -d ${D}$dir/$d + find "${LOCALETREESRC}$dir/$d" -maxdepth 1 -type f \ + -exec install -m $mode -t "${D}$dir/$d" {} \; + done +} + +do_install() { + copy_locale_files ${bindir} 0755 + copy_locale_files ${localedir} 0644 + if [ ${PACKAGE_NO_GCONV} -eq 0 ]; then + copy_locale_files ${libdir}/gconv 0755 + copy_locale_files ${datadir}/i18n 0644 + else + # Remove the libdir if it is empty when gconv is not copied + find ${D}${libdir} -type d -empty -delete + fi + copy_locale_files ${datadir}/locale 0644 + install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED +} + +inherit libc-package + +BBCLASSEXTEND = "nativesdk" + +# Don't scan for CVEs as glibc will be scanned +CVE_PRODUCT = "" diff --git a/recipes-core/glibc/glibc-locale_arc64.bb b/recipes-core/glibc/glibc-locale_arc64.bb new file mode 100644 index 0000000..f7702e0 --- /dev/null +++ b/recipes-core/glibc/glibc-locale_arc64.bb @@ -0,0 +1 @@ +require glibc-locale.inc diff --git a/recipes-core/glibc/glibc-mtrace.inc b/recipes-core/glibc/glibc-mtrace.inc new file mode 100644 index 0000000..734a566 --- /dev/null +++ b/recipes-core/glibc/glibc-mtrace.inc @@ -0,0 +1,16 @@ +require glibc-collateral.inc + +SUMMARY = "mtrace utility provided by glibc" +DESCRIPTION = "mtrace utility provided by glibc" +RDEPENDS:${PN} = "perl" +RPROVIDES:${PN} = "libc-mtrace" + +SRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale/scripts" + +do_install() { + install -d -m 0755 ${D}${bindir} + install -m 0755 ${SRC}/mtrace ${D}${bindir}/ +} + +# Don't scan for CVEs as glibc will be scanned +CVE_PRODUCT = "" diff --git a/recipes-core/glibc/glibc-mtrace_arc64.bb b/recipes-core/glibc/glibc-mtrace_arc64.bb new file mode 100644 index 0000000..0b69bad --- /dev/null +++ b/recipes-core/glibc/glibc-mtrace_arc64.bb @@ -0,0 +1 @@ +require glibc-mtrace.inc diff --git a/recipes-core/glibc/glibc-package.inc b/recipes-core/glibc/glibc-package.inc new file mode 100644 index 0000000..c2f71a7 --- /dev/null +++ b/recipes-core/glibc/glibc-package.inc @@ -0,0 +1,289 @@ +INHIBIT_SYSROOT_STRIP = "1" + +PACKAGES = "${PN}-dbg catchsegv sln nscd ldconfig ldd tzcode glibc-thread-db ${PN}-pic libmemusage malloc-debug libnss-db libsegfault ${PN}-pcprofile libsotruss ${PN} ${PN}-utils glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc ${PN}-src" + +# The ld.so in this glibc supports the GNU_HASH +RPROVIDES:${PN} = "eglibc rtld(GNU_HASH)" +RPROVIDES:${PN}-utils = "eglibc-utils" +RPROVIDES:${PN}-mtrace = "eglibc-mtrace libc-mtrace" +RPROVIDES:${PN}-pic = "eglibc-pic" +RPROVIDES:${PN}-dev = "eglibc-dev libc6-dev virtual-libc-dev" +RPROVIDES:${PN}-staticdev = "eglibc-staticdev" +RPROVIDES:${PN}-doc = "eglibc-doc" +RPROVIDES:glibc-extra-nss = "eglibc-extra-nss" +RPROVIDES:glibc-thread-db = "eglibc-thread-db" +RPROVIDES:${PN}-pcprofile = "eglibc-pcprofile" +RPROVIDES:${PN}-dbg = "eglibc-dbg" +libc_baselibs = "${base_libdir}/libc.so.* ${base_libdir}/libc-*.so ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so ${base_libdir}/libmvec-*.so ${base_libdir}/ld*.so.* ${base_libdir}/ld-*.so ${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so ${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so ${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so ${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so ${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so ${base_libdir}/libnss_files*.so.* ${base_libdir}/libnss_files-*.so ${base_libdir}/libnss_compat*.so.* ${base_libdir}/libnss_compat-*.so ${base_libdir}/libnss_dns*.so.* ${base_libdir}/libnss_dns-*.so ${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so ${base_libdir}/libanl*.so.* ${base_libdir}/libanl-*.so ${base_libdir}/libBrokenLocale*.so.* ${base_libdir}/libBrokenLocale-*.so" +ARCH_DYNAMIC_LOADER = "" +# The aarch64 ABI says the dynamic linker -must- be +# /lib/ld-linux-aarch64{,_be}.so.1. With usrmerge, that may mean that +# we need to install it in /usr/lib. +ARCH_DYNAMIC_LOADER:aarch64 = "ld-linux-${TARGET_ARCH}.so.1" +libc_baselibs:append = " ${@oe.utils.conditional('ARCH_DYNAMIC_LOADER', '', '', '${root_prefix}/lib/${ARCH_DYNAMIC_LOADER}', d)}" +INSANE_SKIP:${PN}:append:aarch64 = " libdir" +INSANE_SKIP:${PN}-dev += "staticdev" + +FILES:${PN} = "${libc_baselibs} ${libexecdir}/* ${sysconfdir}/ld.so.conf" +RRECOMMENDS:${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'ldconfig', '${MLPREFIX}ldconfig', '', d)}" +FILES:ldconfig = "${base_sbindir}/ldconfig" +FILES:ldd = "${bindir}/ldd" +FILES:libsegfault = "${base_libdir}/libSegFault*" +FILES:libmemusage = "${base_libdir}/libmemusage.so" +FILES:malloc-debug = "${base_libdir}/libc_malloc_debug.so.0" +FILES:libnss-db = "${base_libdir}/libnss_db.so.* ${base_libdir}/libnss_db-*.so ${localstatedir}/db/Makefile ${localstatedir}/db/makedbs.sh" +RDEPENDS:libnss-db = "${PN}-utils" +FILES:glibc-extra-nss = "${base_libdir}/libnss_*-*.so ${base_libdir}/libnss_*.so.*" +FILES:sln = "${base_sbindir}/sln" +FILES:${PN}-pic = "${libdir}/*_pic.a ${libdir}/*_pic.map ${libdir}/libc_pic/*.o" +FILES:libsotruss = "${libdir}/audit/sotruss-lib.so" +FILES_SOLIBSDEV = "${libdir}/lib*${SOLIBSDEV}" +FILES:${PN}-dev += "${libdir}/libpthread.a ${libdir}/libdl.a ${libdir}/libutil.a ${libdir}/libanl.a ${libdir}/*_nonshared.a ${base_libdir}/*_nonshared.a ${base_libdir}/*.o ${datadir}/aclocal" +RDEPENDS:${PN}-dev = "linux-libc-headers-dev" +FILES:${PN}-staticdev += "${libdir}/*.a ${base_libdir}/*.a" +FILES:nscd = "${sbindir}/nscd* ${sysconfdir}/init.d/nscd ${systemd_system_unitdir}/nscd* ${sysconfdir}/tmpfiles.d/nscd.conf \ + ${sysconfdir}/nscd.conf ${sysconfdir}/default/volatiles/98_nscd ${localstatedir}/db/nscd" +FILES:${PN}-mtrace = "${bindir}/mtrace" +FILES:tzcode = "${bindir}/tzselect ${sbindir}/zic ${bindir}/zdump" +FILES:${PN}-utils = "${bindir}/* ${sbindir}/*" +FILES:catchsegv = "${bindir}/catchsegv" +RDEPENDS:catchsegv = "libsegfault" +FILES:${PN}-pcprofile = "${base_libdir}/libpcprofile.so" +FILES:glibc-thread-db = "${base_libdir}/libthread_db.so.* ${base_libdir}/libthread_db-*.so" +RPROVIDES:${PN}-dev += "libc-dev" +RPROVIDES:${PN}-staticdev += "libc-staticdev" + +SUMMARY:sln = "The static ln" +DESCRIPTION:sln = "Similar to the 'ln' utility, but statically linked. sln is useful to make symbolic links to dynamic libraries if the dynamic linking system, for some reason, is not functional." +SUMMARY:nscd = "Name service cache daemon" +DESCRIPTION:nscd = "nscd, name service cache daemon, caches name service lookups for the passwd, group and hosts information. It can damatically improvide performance with remote, such as NIS or NIS+, name services." +SUMMARY:glibc-extra-nss = "hesiod, NIS and NIS+ nss libraries" +DESCRIPTION:glibc-extra-nss = "glibc: nis, nisplus and hesiod search services." +SUMMARY:ldd = "print shared library dependencies" +DESCRIPTION:ldd = "${bindir}/ldd prints shared library dependencies for each program or shared library specified on the command line." +SUMMARY:${PN}-utils = "Miscellaneous utilities provided by glibc" +DESCRIPTION:${PN}-utils = "Miscellaneous utilities including getconf, iconv, locale, gencat, ..." +DESCRIPTION:libsotruss = "Library to support sotruss which traces calls through PLTs" +DESCRIPTION:tzcode = "tzcode, timezone zoneinfo utils -- zic, zdump, tzselect" + +inherit multilib_header + +do_install() { + oe_runmake install_root=${D} install + install -Dm 0644 ${WORKDIR}/etc/ld.so.conf ${D}/${sysconfdir}/ld.so.conf + install -d ${D}${localedir} + make -f ${WORKDIR}/generate-supported.mk IN="${S}/localedata/SUPPORTED" OUT="${WORKDIR}/SUPPORTED" + # get rid of some broken files... + for i in ${GLIBC_BROKEN_LOCALES}; do + sed -i "/$i/d" ${WORKDIR}/SUPPORTED + done + rm -f ${D}${sysconfdir}/rpc + rm -rf ${D}${datadir}/zoneinfo + rm -rf ${D}${libexecdir}/getconf + + rm -f ${D}${sysconfdir}/localtime + + # remove empty glibc dir + if [ -d ${D}${libexecdir} ]; then + rmdir --ignore-fail-on-non-empty ${D}${libexecdir} + fi + + oe_multilib_header bits/syscall.h bits/long-double.h bits/floatn.h bits/endianness.h bits/struct_rwlock.h + + if [ -f ${D}${bindir}/mtrace ]; then + sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' -e '2s,exec.*perl,exec ${USRBINPATH}/env perl,' ${D}${bindir}/mtrace + fi + # Info dir listing isn't interesting at this point so remove it if it exists. + if [ -e "${D}${infodir}/dir" ]; then + rm -f ${D}${infodir}/dir + fi + + install -d ${D}${sysconfdir}/init.d + install -d ${D}${localstatedir}/db/nscd + install -m 0755 ${S}/nscd/nscd.init ${D}${sysconfdir}/init.d/nscd + install -m 0755 ${S}/nscd/nscd.conf ${D}${sysconfdir}/nscd.conf + install -m 0755 ${WORKDIR}/makedbs.sh ${D}${localstatedir}/db + sed -i "s%daemon%start-stop-daemon --start --exec%g" ${D}${sysconfdir}/init.d/nscd + sed -i "s|\(enable-cache\t\+netgroup\t\+\)yes|\1no|" ${D}${sysconfdir}/nscd.conf + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${S}/nscd/nscd.service ${D}${systemd_system_unitdir}/ + + # The dynamic loader will have been installed into + # ${base_libdir}. However, if that isn't going to end up being + # available in the ABI-mandated location, then a symlink must + # be created. + + if [ -n "${ARCH_DYNAMIC_LOADER}" -a ! -e "${D}${root_prefix}/lib/${ARCH_DYNAMIC_LOADER}" ]; then + install -d ${D}${root_prefix}/lib + ln -s ${@oe.path.relative('${root_prefix}/lib', '${base_libdir}')}/${ARCH_DYNAMIC_LOADER} \ + ${D}${root_prefix}/lib/${ARCH_DYNAMIC_LOADER} + fi + ln -rs ${D}${base_libdir}/libpthread.so.0 ${D}${libdir}/libpthread.so + ln -rs ${D}${base_libdir}/librt.so.1 ${D}${libdir}/librt.so +} + +def get_libc_fpu_setting(bb, d): + if d.getVar('TARGET_FPU') in [ 'soft', 'ppc-efd' ]: + return "--without-fp" + return "" + +do_install:append:class-target() { + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/tmpfiles.d + echo "d /run/nscd 755 root root -" \ + > ${D}${sysconfdir}/tmpfiles.d/nscd.conf + fi + + if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/default/volatiles + echo "d root root 0755 /var/run/nscd none" \ + > ${D}${sysconfdir}/default/volatiles/98_nscd + fi + +} +do_install:append:aarch64 () { + do_install_armmultilib +} + +do_install:append:arm () { + do_install_armmultilib +} + +do_install:append:armeb () { + do_install_armmultilib +} + +do_install_armmultilib () { + oe_multilib_header bits/endian.h bits/fcntl.h bits/fenv.h bits/fp-fast.h bits/hwcap.h bits/ipc.h bits/link.h + oe_multilib_header bits/local_lim.h bits/mman.h bits/msq.h bits/pthreadtypes.h bits/pthreadtypes-arch.h bits/sem.h bits/semaphore.h bits/setjmp.h + oe_multilib_header bits/shm.h bits/sigstack.h bits/stat.h bits/statfs.h bits/typesizes.h + oe_multilib_header bits/procfs-id.h bits/procfs.h bits/shmlba.h + oe_multilib_header bits/struct_stat.h bits/pthread_stack_min.h + + oe_multilib_header fpu_control.h gnu/lib-names.h gnu/stubs.h ieee754.h + + oe_multilib_header sys/elf.h sys/procfs.h sys/ptrace.h sys/ucontext.h sys/user.h +} + + +LOCALESTASH = "${WORKDIR}/stashed-locale" +bashscripts = "mtrace sotruss xtrace" + +do_stash_locale () { + dest=${LOCALESTASH} + install -d $dest${base_libdir} $dest${bindir} $dest${libdir} $dest${datadir} + # Hide away the locale data from the deployment + if [ -e ${D}${bindir}/localedef ]; then + cp -a ${D}${bindir}/localedef $dest${bindir} + fi + if [ -e ${D}${libdir}/gconv ]; then + cp -a ${D}${libdir}/gconv $dest${libdir} + fi + if [ -e ${D}${datadir}/i18n ]; then + cp -a ${D}${datadir}/i18n $dest${datadir} + fi + + # Make a copy of all the libraries into the locale stash + cp -fpPR ${D}${libdir}/* $dest${libdir} + if [ "${base_libdir}" != "${libdir}" ]; then + cp -fpPR ${D}${base_libdir}/* $dest${base_libdir} + fi + if [ -e ${D}${exec_prefix}/lib ]; then + if [ ${exec_prefix}/lib != ${base_libdir} ] && [ ${exec_prefix}/lib != ${libdir} ]; then + cp -fpPR ${D}${exec_prefix}/lib $dest${exec_prefix} + fi + fi + + cp -fpPR ${D}${datadir}/* $dest${datadir} + cp -fpPR ${WORKDIR}/SUPPORTED $dest + + target=$dest/scripts + mkdir -p $target + for i in ${bashscripts}; do + if [ -f ${D}${bindir}/$i ]; then + cp ${D}${bindir}/$i $target/ + fi + done +} + +addtask do_stash_locale after do_install before do_populate_sysroot do_package +do_stash_locale[dirs] = "${B}" +do_stash_locale[cleandirs] = "${LOCALESTASH}" +SSTATETASKS += "do_stash_locale" +do_stash_locale[sstate-inputdirs] = "${LOCALESTASH}" +do_stash_locale[sstate-outputdirs] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale" +do_stash_locale[sstate-fixmedir] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale" + +python do_stash_locale_setscene () { + sstate_setscene(d) +} +addtask do_stash_locale_setscene + +PACKAGE_PREPROCESS_FUNCS += "stash_locale_package_cleanup" +SYSROOT_PREPROCESS_FUNCS += "stash_locale_sysroot_cleanup" +stash_locale_cleanup () { + cleanupdir=$1 + # Remove all files which do_stash_locale() copies + for i in ${bashscripts}; do + rm -f $cleanupdir${bindir}/$i + done + rm -f $cleanupdir${bindir}/localedef + rm -rf $cleanupdir${datadir}/i18n + rm -rf $cleanupdir${libdir}/gconv + rm -rf $cleanupdir${localedir} + rm -rf $cleanupdir${datadir}/locale + rmdir --ignore-fail-on-non-empty $cleanupdir${datadir} + + if [ "${libdir}" != "${exec_prefix}/lib" ] && [ "${root_prefix}/lib" != "${exec_prefix}/lib" ]; then + if [ -d "$cleanupdir${exec_prefix}/lib" ]; then + if [ -z "${ARCH_DYNAMIC_LOADER}" -o \ + ! -e "$cleanupdir${exec_prefix}/lib/${ARCH_DYNAMIC_LOADER}" ]; then + # error out if directory isn't empty + # this dir should only contain locale dir + # which has been deleted in the previous step + rmdir $cleanupdir${exec_prefix}/lib + fi + fi + fi +} + +stash_locale_sysroot_cleanup() { + stash_locale_cleanup ${SYSROOT_DESTDIR} +} +stash_locale_package_cleanup() { + stash_locale_cleanup ${PKGD} +} + +python populate_packages:prepend () { + if d.getVar('DEBIAN_NAMES'): + pkgs = d.getVar('PACKAGES').split() + bpn = d.getVar('BPN') + prefix = d.getVar('MLPREFIX') or "" + # Set the base package... + d.setVar('PKG:' + prefix + bpn, prefix + 'libc6') + libcprefix = prefix + bpn + '-' + for p in pkgs: + # And all the subpackages. + if p.startswith(libcprefix): + renamed = p.replace(bpn, 'libc6', 1) + d.setVar('PKG:' + p, renamed) + # For backward compatibility with old -dbg package + d.appendVar('RPROVIDES:' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg') + d.appendVar('RCONFLICTS:' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg') + d.appendVar('RREPLACES:' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg') +} + +pkg_postinst:nscd () { + if [ -z "$D" ]; then + if command -v systemd-tmpfiles >/dev/null; then + systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/nscd.conf + elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then + ${sysconfdir}/init.d/populate-volatile.sh update + fi + fi +} +CONFFILES:nscd="${sysconfdir}/nscd.conf" + +SYSTEMD_PACKAGES = "nscd" +SYSTEMD_SERVICE:nscd = "nscd.service" diff --git a/recipes-core/glibc/glibc-scripts.inc b/recipes-core/glibc/glibc-scripts.inc new file mode 100644 index 0000000..47216ae --- /dev/null +++ b/recipes-core/glibc/glibc-scripts.inc @@ -0,0 +1,23 @@ +require glibc-collateral.inc + +SUMMARY = "utility scripts provided by glibc" +DESCRIPTION = "utility scripts provided by glibc" +RDEPENDS:${PN} = "bash glibc-mtrace" + +SRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale/scripts" + +bashscripts = "sotruss xtrace" + +do_install() { + install -d -m 0755 ${D}${bindir} + for i in ${bashscripts}; do + install -m 0755 ${SRC}/$i ${D}${bindir}/ + done +} + +# sotruss script requires sotruss-lib.so (given by libsotruss package), +# to produce trace of the library calls. +RDEPENDS:${PN} += "libsotruss" + +# Don't scan for CVEs as glibc will be scanned +CVE_PRODUCT = "" diff --git a/recipes-core/glibc/glibc-scripts_arc64.bb b/recipes-core/glibc/glibc-scripts_arc64.bb new file mode 100644 index 0000000..5a89bd8 --- /dev/null +++ b/recipes-core/glibc/glibc-scripts_arc64.bb @@ -0,0 +1 @@ +require glibc-scripts.inc diff --git a/recipes-core/glibc/glibc-version.inc b/recipes-core/glibc/glibc-version.inc new file mode 100644 index 0000000..deee7de --- /dev/null +++ b/recipes-core/glibc/glibc-version.inc @@ -0,0 +1,6 @@ +SRCBRANCH ?= "arc64" +PV = "arc64" +SRCREV_glibc ?= "f4964381d160479ea1146dbc5c4cfe1b97968e3c" +SRCREV_localedef ?= "95c0221703ad970a52445e9eaf91c4aff35eebef" + +GLIBC_GIT_URI ?= "git://github.com/foss-for-synopsys-dwc-arc-processors/glibc.git;protocol=https" diff --git a/recipes-core/glibc/glibc/0001-CVE-2021-38604.patch b/recipes-core/glibc/glibc/0001-CVE-2021-38604.patch new file mode 100644 index 0000000..1e94049 --- /dev/null +++ b/recipes-core/glibc/glibc/0001-CVE-2021-38604.patch @@ -0,0 +1,43 @@ +From b805aebd42364fe696e417808a700fdb9800c9e8 Mon Sep 17 00:00:00 2001 +From: Nikita Popov +Date: Mon, 9 Aug 2021 20:17:34 +0530 +Subject: [PATCH] librt: fix NULL pointer dereference (bug 28213) + +Helper thread frees copied attribute on NOTIFY_REMOVED message +received from the OS kernel. Unfortunately, it fails to check whether +copied attribute actually exists (data.attr != NULL). This worked +earlier because free() checks passed pointer before actually +attempting to release corresponding memory. But +__pthread_attr_destroy assumes pointer is not NULL. + +So passing NULL pointer to __pthread_attr_destroy will result in +segmentation fault. This scenario is possible if +notification->sigev_notify_attributes == NULL (which means default +thread attributes should be used). + +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=b805aebd42364fe696e417808a700fdb9800c9e8] +CVE: CVE-2021-38604 + +Signed-off-by: Nikita Popov +Reviewed-by: Siddhesh Poyarekar +Signed-off-by: Vinay Kumar +--- + sysdeps/unix/sysv/linux/mq_notify.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c +index 9799dcdaa4..eccae2e4c6 100644 +--- a/sysdeps/unix/sysv/linux/mq_notify.c ++++ b/sysdeps/unix/sysv/linux/mq_notify.c +@@ -131,7 +131,7 @@ helper_thread (void *arg) + to wait until it is done with it. */ + (void) __pthread_barrier_wait (¬ify_barrier); + } +- else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED) ++ else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED && data.attr != NULL) + { + /* The only state we keep is the copy of the thread attributes. */ + __pthread_attr_destroy (data.attr); +-- +2.31.1 + diff --git a/recipes-core/glibc/glibc/0001-CVE-2021-3998.patch b/recipes-core/glibc/glibc/0001-CVE-2021-3998.patch new file mode 100644 index 0000000..c6bd591 --- /dev/null +++ b/recipes-core/glibc/glibc/0001-CVE-2021-3998.patch @@ -0,0 +1,282 @@ +From fb7bff12e81c677a6622f724edd4d4987dd9d971 Mon Sep 17 00:00:00 2001 +From: Siddhesh Poyarekar +Date: Tue, 18 Jan 2022 13:29:36 +0530 +Subject: [PATCH] support: Add helpers to create paths longer than PATH_MAX + +Add new helpers support_create_and_chdir_toolong_temp_directory and +support_chdir_toolong_temp_directory to create and descend into +directory trees longer than PATH_MAX. + +Reviewed-by: Adhemerval Zanella +Signed-off-by: Siddhesh Poyarekar + +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=062ff490c1467059f6cd64bb9c3d85f6cc6cf97a] +CVE: CVE-2021-3998 + +Signed-off-by: Pgowda +--- + support/temp_file.c | 159 +++++++++++++++++++++++++++++++++++++++++--- + support/temp_file.h | 9 +++ + 2 files changed, 159 insertions(+), 9 deletions(-) + +diff --git a/support/temp_file.c b/support/temp_file.c +index e7bb8aadb9..e41128c2d4 100644 +--- a/support/temp_file.c ++++ b/support/temp_file.c +@@ -1,5 +1,6 @@ + /* Temporary file handling for tests. + Copyright (C) 1998-2021 Free Software Foundation, Inc. ++ Copyright The GNU Tools Authors. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or +@@ -20,15 +21,17 @@ + some 32-bit platforms. */ + #define _FILE_OFFSET_BITS 64 + ++#include + #include + #include + #include + ++#include + #include + #include + #include + #include +-#include ++#include + + /* List of temporary files. */ + static struct temp_name_list +@@ -36,14 +39,20 @@ static struct temp_name_list + struct temp_name_list *next; + char *name; + pid_t owner; ++ bool toolong; + } *temp_name_list; + + /* Location of the temporary files. Set by the test skeleton via + support_set_test_dir. The string is not be freed. */ + static const char *test_dir = _PATH_TMP; + +-void +-add_temp_file (const char *name) ++/* Name of subdirectories in a too long temporary directory tree. */ ++static char toolong_subdir[NAME_MAX + 1]; ++static bool toolong_initialized; ++static size_t toolong_path_max; ++ ++static void ++add_temp_file_internal (const char *name, bool toolong) + { + struct temp_name_list *newp + = (struct temp_name_list *) xcalloc (sizeof (*newp), 1); +@@ -53,12 +62,19 @@ add_temp_file (const char *name) + newp->name = newname; + newp->next = temp_name_list; + newp->owner = getpid (); ++ newp->toolong = toolong; + temp_name_list = newp; + } + else + free (newp); + } + ++void ++add_temp_file (const char *name) ++{ ++ add_temp_file_internal (name, false); ++} ++ + int + create_temp_file_in_dir (const char *base, const char *dir, char **filename) + { +@@ -90,8 +106,8 @@ create_temp_file (const char *base, char + return create_temp_file_in_dir (base, test_dir, filename); + } + +-char * +-support_create_temp_directory (const char *base) ++static char * ++create_temp_directory_internal (const char *base, bool toolong) + { + char *path = xasprintf ("%s/%sXXXXXX", test_dir, base); + if (mkdtemp (path) == NULL) +@@ -99,16 +115,132 @@ support_create_temp_directory (const cha + printf ("error: mkdtemp (\"%s\"): %m", path); + exit (1); + } +- add_temp_file (path); ++ add_temp_file_internal (path, toolong); + return path; + } + +-/* Helper functions called by the test skeleton follow. */ ++char * ++support_create_temp_directory (const char *base) ++{ ++ return create_temp_directory_internal (base, false); ++} ++ ++static void ++ensure_toolong_initialized (void) ++{ ++ if (!toolong_initialized) ++ FAIL_EXIT1 ("uninitialized toolong directory tree\n"); ++} ++ ++static void ++initialize_toolong (const char *base) ++{ ++ long name_max = pathconf (base, _PC_NAME_MAX); ++ name_max = (name_max < 0 ? 64 ++ : (name_max < sizeof (toolong_subdir) ? name_max ++ : sizeof (toolong_subdir) - 1)); ++ ++ long path_max = pathconf (base, _PC_PATH_MAX); ++ path_max = (path_max < 0 ? 1024 ++ : path_max <= PTRDIFF_MAX ? path_max : PTRDIFF_MAX); ++ ++ /* Sanity check to ensure that the test does not create temporary directories ++ in different filesystems because this API doesn't support it. */ ++ if (toolong_initialized) ++ { ++ if (name_max != strlen (toolong_subdir)) ++ FAIL_UNSUPPORTED ("name_max: Temporary directories in different" ++ " filesystems not supported yet\n"); ++ if (path_max != toolong_path_max) ++ FAIL_UNSUPPORTED ("path_max: Temporary directories in different" ++ " filesystems not supported yet\n"); ++ return; ++ } ++ ++ toolong_path_max = path_max; ++ ++ size_t len = name_max; ++ memset (toolong_subdir, 'X', len); ++ toolong_initialized = true; ++} ++ ++char * ++support_create_and_chdir_toolong_temp_directory (const char *basename) ++{ ++ char *base = create_temp_directory_internal (basename, true); ++ xchdir (base); ++ ++ initialize_toolong (base); ++ ++ size_t sz = strlen (toolong_subdir); ++ ++ /* Create directories and descend into them so that the final path is larger ++ than PATH_MAX. */ ++ for (size_t i = 0; i <= toolong_path_max / sz; i++) ++ { ++ int ret = mkdir (toolong_subdir, S_IRWXU); ++ if (ret != 0 && errno == ENAMETOOLONG) ++ FAIL_UNSUPPORTED ("Filesystem does not support creating too long " ++ "directory trees\n"); ++ else if (ret != 0) ++ FAIL_EXIT1 ("Failed to create directory tree: %m\n"); ++ xchdir (toolong_subdir); ++ } ++ return base; ++} + + void +-support_set_test_dir (const char *path) ++support_chdir_toolong_temp_directory (const char *base) + { +- test_dir = path; ++ ensure_toolong_initialized (); ++ ++ xchdir (base); ++ ++ size_t sz = strlen (toolong_subdir); ++ for (size_t i = 0; i <= toolong_path_max / sz; i++) ++ xchdir (toolong_subdir); ++} ++ ++/* Helper functions called by the test skeleton follow. */ ++ ++static void ++remove_toolong_subdirs (const char *base) ++{ ++ ensure_toolong_initialized (); ++ ++ if (chdir (base) != 0) ++ { ++ printf ("warning: toolong cleanup base failed: chdir (\"%s\"): %m\n", ++ base); ++ return; ++ } ++ ++ /* Descend. */ ++ int levels = 0; ++ size_t sz = strlen (toolong_subdir); ++ for (levels = 0; levels <= toolong_path_max / sz; levels++) ++ if (chdir (toolong_subdir) != 0) ++ { ++ printf ("warning: toolong cleanup failed: chdir (\"%s\"): %m\n", ++ toolong_subdir); ++ break; ++ } ++ ++ /* Ascend and remove. */ ++ while (--levels >= 0) ++ { ++ if (chdir ("..") != 0) ++ { ++ printf ("warning: toolong cleanup failed: chdir (\"..\"): %m\n"); ++ return; ++ } ++ if (remove (toolong_subdir) != 0) ++ { ++ printf ("warning: could not remove subdirectory: %s: %m\n", ++ toolong_subdir); ++ return; ++ } ++ } + } + + void +@@ -123,6 +255,9 @@ support_delete_temp_files (void) + around, to prevent PID reuse.) */ + if (temp_name_list->owner == pid) + { ++ if (temp_name_list->toolong) ++ remove_toolong_subdirs (temp_name_list->name); ++ + if (remove (temp_name_list->name) != 0) + printf ("warning: could not remove temporary file: %s: %m\n", + temp_name_list->name); +@@ -147,3 +282,9 @@ support_print_temp_files (FILE *f) + fprintf (f, ")\n"); + } + } ++ ++void ++support_set_test_dir (const char *path) ++{ ++ test_dir = path; ++} +diff --git a/support/temp_file.h b/support/temp_file.h +index 50a443abe4..8459ddda72 100644 +--- a/support/temp_file.h ++++ b/support/temp_file.h +@@ -44,6 +44,15 @@ int create_temp_file_in_dir (const char + returns. The caller should free this string. */ + char *support_create_temp_directory (const char *base); + ++/* Create a temporary directory tree that is longer than PATH_MAX and schedule ++ it for deletion. BASENAME is used as a prefix for the unique directory ++ name, which the function returns. The caller should free this string. */ ++char *support_create_and_chdir_toolong_temp_directory (const char *basename); ++ ++/* Change into the innermost directory of the directory tree BASE, which was ++ created using support_create_and_chdir_toolong_temp_directory. */ ++void support_chdir_toolong_temp_directory (const char *base); ++ + __END_DECLS + + #endif /* SUPPORT_TEMP_FILE_H */ diff --git a/recipes-core/glibc/glibc/0001-CVE-2021-3999.patch b/recipes-core/glibc/glibc/0001-CVE-2021-3999.patch new file mode 100644 index 0000000..6474939 --- /dev/null +++ b/recipes-core/glibc/glibc/0001-CVE-2021-3999.patch @@ -0,0 +1,36 @@ +From 8c8a71c85f2ed5cc90d08d82ce645513fc907cb6 Mon Sep 17 00:00:00 2001 +From: Siddhesh Poyarekar +Date: Mon, 24 Jan 2022 10:57:09 +0530 +Subject: [PATCH] tst-realpath-toolong: Fix hurd build + +Define PATH_MAX to a constant if it isn't already defined, like in hurd. + +Signed-off-by: Siddhesh Poyarekar +(cherry picked from commit 976db046bc3a3738f69255ae00b0a09b8e77fd9c) + +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=8c8a71c85f2ed5cc90d08d82ce645513fc907cb6] +CVE: CVE-2021-3999 + +Signed-off-by: Pgowda +--- + stdlib/tst-realpath-toolong.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/stdlib/tst-realpath-toolong.c b/stdlib/tst-realpath-toolong.c +index 8bed772460..4388890294 100644 +--- a/stdlib/tst-realpath-toolong.c ++++ b/stdlib/tst-realpath-toolong.c +@@ -29,6 +29,10 @@ + + #define BASENAME "tst-realpath-toolong." + ++#ifndef PATH_MAX ++# define PATH_MAX 1024 ++#endif ++ + int + do_test (void) + { +-- +2.27.0 + diff --git a/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch b/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch new file mode 100644 index 0000000..4eb1fb7 --- /dev/null +++ b/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch @@ -0,0 +1,178 @@ +From e368b12f6c16b6888dda99ba641e999b9c9643c8 Mon Sep 17 00:00:00 2001 +From: Florian Weimer +Date: Mon, 17 Jan 2022 10:21:34 +0100 +Subject: [PATCH] socket: Add the __sockaddr_un_set function + +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=e368b12f6c16b6888dda99ba641e999b9c9643c8] +CVE: CVE-2022-23219 + +Reviewed-by: Siddhesh Poyarekar +Signed-off-by: Pgowda +--- + include/sys/un.h | 12 +++++++ + socket/Makefile | 6 +++- + socket/sockaddr_un_set.c | 41 ++++++++++++++++++++++++ + socket/tst-sockaddr_un_set.c | 62 ++++++++++++++++++++++++++++++++++++ + 4 files changed, 120 insertions(+), 1 deletion(-) + create mode 100644 socket/sockaddr_un_set.c + create mode 100644 socket/tst-sockaddr_un_set.c + +diff --git a/include/sys/un.h b/include/sys/un.h +index bdbee99980..152afd9fc7 100644 +--- a/include/sys/un.h ++++ b/include/sys/un.h +@@ -1 +1,13 @@ + #include ++ ++#ifndef _ISOMAC ++ ++/* Set ADDR->sun_family to AF_UNIX and ADDR->sun_path to PATHNAME. ++ Return 0 on success or -1 on failure (due to overlong PATHNAME). ++ The caller should always use sizeof (struct sockaddr_un) as the ++ socket address length, disregaring the length of PATHNAME. ++ Only concrete (non-abstract) pathnames are supported. */ ++int __sockaddr_un_set (struct sockaddr_un *addr, const char *pathname) ++ attribute_hidden; ++ ++#endif /* _ISOMAC */ +diff --git a/socket/Makefile b/socket/Makefile +index 39333e10ca..156eec6c85 100644 +--- a/socket/Makefile ++++ b/socket/Makefile +@@ -29,13 +29,17 @@ headers := sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h \ + routines := accept bind connect getpeername getsockname getsockopt \ + listen recv recvfrom recvmsg send sendmsg sendto \ + setsockopt shutdown socket socketpair isfdtype opensock \ +- sockatmark accept4 recvmmsg sendmmsg ++ sockatmark accept4 recvmmsg sendmmsg sockaddr_un_set + + tests := \ + tst-accept4 \ + tst-sockopt \ + # tests + ++tests-internal := \ ++ tst-sockaddr_un_set \ ++ # tests-internal ++ + tests-time64 := \ + tst-sockopt-time64 \ + # tests +diff --git a/socket/sockaddr_un_set.c b/socket/sockaddr_un_set.c +new file mode 100644 +index 0000000000..0bd40dc34e +--- /dev/null ++++ b/socket/sockaddr_un_set.c +@@ -0,0 +1,41 @@ ++/* Set the sun_path member of struct sockaddr_un. ++ Copyright (C) 2022 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++ ++int ++__sockaddr_un_set (struct sockaddr_un *addr, const char *pathname) ++{ ++ size_t name_length = strlen (pathname); ++ ++ /* The kernel supports names of exactly sizeof (addr->sun_path) ++ bytes, without a null terminator, but userspace does not; see the ++ SUN_LEN macro. */ ++ if (name_length >= sizeof (addr->sun_path)) ++ { ++ __set_errno (EINVAL); /* Error code used by the kernel. */ ++ return -1; ++ } ++ ++ addr->sun_family = AF_UNIX; ++ memcpy (addr->sun_path, pathname, name_length + 1); ++ return 0; ++} +diff --git a/socket/tst-sockaddr_un_set.c b/socket/tst-sockaddr_un_set.c +new file mode 100644 +index 0000000000..29c2a81afd +--- /dev/null ++++ b/socket/tst-sockaddr_un_set.c +@@ -0,0 +1,62 @@ ++/* Test the __sockaddr_un_set function. ++ Copyright (C) 2022 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++/* Re-compile the function because the version in libc is not ++ exported. */ ++#include "sockaddr_un_set.c" ++ ++#include ++ ++static int ++do_test (void) ++{ ++ struct sockaddr_un sun; ++ ++ memset (&sun, 0xcc, sizeof (sun)); ++ __sockaddr_un_set (&sun, ""); ++ TEST_COMPARE (sun.sun_family, AF_UNIX); ++ TEST_COMPARE (__sockaddr_un_set (&sun, ""), 0); ++ ++ memset (&sun, 0xcc, sizeof (sun)); ++ TEST_COMPARE (__sockaddr_un_set (&sun, "/example"), 0); ++ TEST_COMPARE_STRING (sun.sun_path, "/example"); ++ ++ { ++ char pathname[108]; /* Length of sun_path (ABI constant). */ ++ memset (pathname, 'x', sizeof (pathname)); ++ pathname[sizeof (pathname) - 1] = '\0'; ++ memset (&sun, 0xcc, sizeof (sun)); ++ TEST_COMPARE (__sockaddr_un_set (&sun, pathname), 0); ++ TEST_COMPARE (sun.sun_family, AF_UNIX); ++ TEST_COMPARE_STRING (sun.sun_path, pathname); ++ } ++ ++ { ++ char pathname[109]; ++ memset (pathname, 'x', sizeof (pathname)); ++ pathname[sizeof (pathname) - 1] = '\0'; ++ memset (&sun, 0xcc, sizeof (sun)); ++ errno = 0; ++ TEST_COMPARE (__sockaddr_un_set (&sun, pathname), -1); ++ TEST_COMPARE (errno, EINVAL); ++ } ++ ++ return 0; ++} ++ ++#include +-- +2.27.0 + diff --git a/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch b/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch new file mode 100644 index 0000000..261c290 --- /dev/null +++ b/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch @@ -0,0 +1,55 @@ +From 226b46770c82899b555986583294b049c6ec9b40 Mon Sep 17 00:00:00 2001 +From: Florian Weimer +Date: Mon, 17 Jan 2022 10:21:34 +0100 +Subject: [PATCH] CVE-2022-23219: Buffer overflow in sunrpc clnt_create for + "unix" (bug 22542) + +Processing an overlong pathname in the sunrpc clnt_create function +results in a stack-based buffer overflow. + +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=226b46770c82899b555986583294b049c6ec9b40] +CVE: CVE-2022-23219 + +Reviewed-by: Siddhesh Poyarekar +Signed-off-by: Pgowda +--- + NEWS | 4 +++- + sunrpc/clnt_gen.c | 10 +++++++--- + 2 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/NEWS b/NEWS +index ddd95a8329..38a9ddb2cf 100644 +--- a/NEWS ++++ b/NEWS +@@ -206,6 +206,10 @@ Security related changes: + CVE-2022-23218: Passing an overlong file name to the svcunix_create + legacy function could result in a stack-based buffer overflow. + ++ CVE-2022-23219: Passing an overlong file name to the clnt_create ++ legacy function could result in a stack-based buffer overflow when ++ using the "unix" protocol. Reported by Martin Sebor. ++ + The following bugs are resolved with this release: + + [4737] libc: fork is not async-signal-safe +diff --git a/sunrpc/clnt_gen.c b/sunrpc/clnt_gen.c +index 13ced8994e..b44357cd88 100644 +--- a/sunrpc/clnt_gen.c ++++ b/sunrpc/clnt_gen.c +@@ -57,9 +57,13 @@ clnt_create (const char *hostname, u_lon + + if (strcmp (proto, "unix") == 0) + { +- memset ((char *)&sun, 0, sizeof (sun)); +- sun.sun_family = AF_UNIX; +- strcpy (sun.sun_path, hostname); ++ if (__sockaddr_un_set (&sun, hostname) < 0) ++ { ++ struct rpc_createerr *ce = &get_rpc_createerr (); ++ ce->cf_stat = RPC_SYSTEMERROR; ++ ce->cf_error.re_errno = errno; ++ return NULL; ++ } + sock = RPC_ANYSOCK; + client = clntunix_create (&sun, prog, vers, &sock, 0, 0); + if (client == NULL) diff --git a/recipes-core/glibc/glibc/0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch b/recipes-core/glibc/glibc/0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch new file mode 100644 index 0000000..3283dd7 --- /dev/null +++ b/recipes-core/glibc/glibc/0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch @@ -0,0 +1,79 @@ +From a8bc44936202692edcd82a48c07d7cf27d6ed8ee Mon Sep 17 00:00:00 2001 +From: Hongxu Jia +Date: Sun, 29 Aug 2021 20:49:16 +0800 +Subject: [PATCH] fix create thread failed in unprivileged process [BZ #28287] + +Since commit [d8ea0d0168 Add an internal wrapper for clone, clone2 and clone3] +applied, start a unprivileged container (docker run without --privileged), +it creates a thread failed in container. + +In commit d8ea0d0168, it calls __clone3 if HAVE_CLONE3_WAPPER is defined. If +__clone3 returns -1 with ENOSYS, fall back to clone or clone2. + +As known from [1], cloneXXX fails with EPERM if CLONE_NEWCGROUP, +CLONE_NEWIPC, CLONE_NEWNET, CLONE_NEWNS, CLONE_NEWPID, or CLONE_NEWUTS +was specified by an unprivileged process (process without CAP_SYS_ADMIN) + +[1] https://man7.org/linux/man-pages/man2/clone3.2.html + +So if __clone3 returns -1 with EPERM, fall back to clone or clone2 could +fix the issue. Here are the test steps: + +1) Prepare test code +cat > conftest.c < + #include + +int check_me = 0; +void* func(void* data) {check_me = 42; printf("start thread: check_me %d\n", check_me); return &check_me;} +int main() +{ + pthread_t t; + void *ret; + pthread_create (&t, 0, func, 0); + pthread_join (t, &ret); + printf("check_me %d, p %p\n", check_me, &ret); + return (check_me != 42 || ret != &check_me); +} + +ENDOF + +2) Compile +gcc -o conftest -pthread conftest.c + +3) Start a container with glibc 2.34 installed +[skip details] +docker run -it bash + +4) Run conftest without this patch +$ ./conftest +check_me 0, p 0x7ffd91ccd400 + +5) Run conftest with this patch +$ ./conftest +start thread: check_me 42 +check_me 42, p 0x7ffe253c6f20 + +Upstream-Status: Submitted [libc-alpha@sourceware.org] + +Signed-off-by: Hongxu Jia +--- + sysdeps/unix/sysv/linux/clone-internal.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sysdeps/unix/sysv/linux/clone-internal.c b/sysdeps/unix/sysv/linux/clone-internal.c +index 979f7880be..97101994e8 100644 +--- a/sysdeps/unix/sysv/linux/clone-internal.c ++++ b/sysdeps/unix/sysv/linux/clone-internal.c +@@ -52,7 +52,7 @@ __clone_internal (struct clone_args *cl_args, + /* Try clone3 first. */ + int saved_errno = errno; + ret = __clone3 (cl_args, sizeof (*cl_args), func, arg); +- if (ret != -1 || errno != ENOSYS) ++ if (ret != -1 || (errno != ENOSYS && errno != EPERM)) + return ret; + + /* NB: Restore errno since errno may be checked against non-zero +-- +2.30.2 + diff --git a/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch b/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch new file mode 100644 index 0000000..3ff485b --- /dev/null +++ b/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch @@ -0,0 +1,1130 @@ +From d34ba0833cd811f8869a6262044af55f9e7b59d8 Mon Sep 17 00:00:00 2001 +From: Jason Wessel +Date: Sat, 7 Dec 2019 09:59:22 -0800 +Subject: [PATCH] localedef: Add hardlink resolver from util-linux + +The hard link resolver that is built into localedef cannot be run in +parallel. It will search sibling directories (which are be processed +in parallel) and perform a creation of a .tmp file and remove the +original and move the .tmp file in. The problem is that if a probe +occurs a hard link can be requested to the file that is being removed. +This will lead to a stray copy or potentially, on a loaded system +cause race condition which pseudo cannot deal with, where it is left +with a hard link request to a file that no longer exists. In this +situation psuedo will inherit the permissions of what ever the target +inode had to offer. + +In short, there are two problems: + +1) You will be left with stray copies when using the hard link +resolution that is built in while running in parallel with +localedef. + +2) When running under pseudo the possibility exists for uid/gid +leakage when the source file is removed before the hard link can +be completed. + +The solution is to call localedef with --no-hard-links and separately +process the hardlinks at a later point. To do this requires the +inclusion of the hardlink utility found in modern versions of +util-linux. Most host systems do not have this, so it will be +included with the cross-localedef binary. + +[YOCTO #11299] +[YOCTO #12434] + +Upstream-Status: Pending + +Signed-off-by: Jason Wessel +Signed-off-by: Khem Raj +--- + locale/programs/c.h | 407 ++++++++++++++++ + locale/programs/cross-localedef-hardlink.c | 528 +++++++++++++++++++++ + locale/programs/xalloc.h | 129 +++++ + 3 files changed, 1064 insertions(+) + create mode 100644 locale/programs/c.h + create mode 100644 locale/programs/cross-localedef-hardlink.c + create mode 100644 locale/programs/xalloc.h + +diff --git a/locale/programs/c.h b/locale/programs/c.h +new file mode 100644 +index 0000000000..d0a402e90e +--- /dev/null ++++ b/locale/programs/c.h +@@ -0,0 +1,407 @@ ++/* ++ * Fundamental C definitions. ++ */ ++ ++#ifndef UTIL_LINUX_C_H ++#define UTIL_LINUX_C_H ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#ifdef HAVE_ERR_H ++# include ++#endif ++ ++#ifdef HAVE_SYS_SYSMACROS_H ++# include /* for major, minor */ ++#endif ++ ++#ifndef LOGIN_NAME_MAX ++# define LOGIN_NAME_MAX 256 ++#endif ++ ++#ifndef NAME_MAX ++# define NAME_MAX PATH_MAX ++#endif ++ ++/* ++ * __GNUC_PREREQ is deprecated in favour of __has_attribute() and ++ * __has_feature(). The __has macros are supported by clang and gcc>=5. ++ */ ++#ifndef __GNUC_PREREQ ++# if defined __GNUC__ && defined __GNUC_MINOR__ ++# define __GNUC_PREREQ(maj, min) \ ++ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) ++# else ++# define __GNUC_PREREQ(maj, min) 0 ++# endif ++#endif ++ ++#ifdef __GNUC__ ++ ++/* &a[0] degrades to a pointer: a different type from an array */ ++# define __must_be_array(a) \ ++ UL_BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(__typeof__(a), __typeof__(&a[0]))) ++ ++# define ignore_result(x) __extension__ ({ \ ++ __typeof__(x) __dummy __attribute__((__unused__)) = (x); (void) __dummy; \ ++}) ++ ++#else /* !__GNUC__ */ ++# define __must_be_array(a) 0 ++# define __attribute__(_arg_) ++# define ignore_result(x) ((void) (x)) ++#endif /* !__GNUC__ */ ++ ++/* ++ * It evaluates to 1 if the attribute/feature is supported by the current ++ * compilation targed. Fallback for old compilers. ++ */ ++#ifndef __has_attribute ++ #define __has_attribute(x) 0 ++#endif ++ ++#ifndef __has_feature ++ #define __has_feature(x) 0 ++#endif ++ ++/* ++ * Function attributes ++ */ ++#ifndef __ul_alloc_size ++# if (__has_attribute(alloc_size) && __has_attribute(warn_unused_result)) || __GNUC_PREREQ (4, 3) ++# define __ul_alloc_size(s) __attribute__((alloc_size(s), warn_unused_result)) ++# else ++# define __ul_alloc_size(s) ++# endif ++#endif ++ ++#ifndef __ul_calloc_size ++# if (__has_attribute(alloc_size) && __has_attribute(warn_unused_result)) || __GNUC_PREREQ (4, 3) ++# define __ul_calloc_size(n, s) __attribute__((alloc_size(n, s), warn_unused_result)) ++# else ++# define __ul_calloc_size(n, s) ++# endif ++#endif ++ ++#if __has_attribute(returns_nonnull) || __GNUC_PREREQ (4, 9) ++# define __ul_returns_nonnull __attribute__((returns_nonnull)) ++#else ++# define __ul_returns_nonnull ++#endif ++ ++/* ++ * Force a compilation error if condition is true, but also produce a ++ * result (of value 0 and type size_t), so the expression can be used ++ * e.g. in a structure initializer (or wherever else comma expressions ++ * aren't permitted). ++ */ ++#define UL_BUILD_BUG_ON_ZERO(e) __extension__ (sizeof(struct { int:-!!(e); })) ++#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) ++ ++#ifndef ARRAY_SIZE ++# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) ++#endif ++ ++#ifndef PATH_MAX ++# define PATH_MAX 4096 ++#endif ++ ++#ifndef TRUE ++# define TRUE 1 ++#endif ++ ++#ifndef FALSE ++# define FALSE 0 ++#endif ++ ++#ifndef min ++# define min(x, y) __extension__ ({ \ ++ __typeof__(x) _min1 = (x); \ ++ __typeof__(y) _min2 = (y); \ ++ (void) (&_min1 == &_min2); \ ++ _min1 < _min2 ? _min1 : _min2; }) ++#endif ++ ++#ifndef max ++# define max(x, y) __extension__ ({ \ ++ __typeof__(x) _max1 = (x); \ ++ __typeof__(y) _max2 = (y); \ ++ (void) (&_max1 == &_max2); \ ++ _max1 > _max2 ? _max1 : _max2; }) ++#endif ++ ++#ifndef cmp_numbers ++# define cmp_numbers(x, y) __extension__ ({ \ ++ __typeof__(x) _a = (x); \ ++ __typeof__(y) _b = (y); \ ++ (void) (&_a == &_b); \ ++ _a == _b ? 0 : _a > _b ? 1 : -1; }) ++#endif ++ ++#ifndef offsetof ++#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) ++#endif ++ ++/* ++ * container_of - cast a member of a structure out to the containing structure ++ * @ptr: the pointer to the member. ++ * @type: the type of the container struct this is embedded in. ++ * @member: the name of the member within the struct. ++ */ ++#ifndef container_of ++#define container_of(ptr, type, member) __extension__ ({ \ ++ const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \ ++ (type *)( (char *)__mptr - offsetof(type,member) );}) ++#endif ++ ++#ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME ++# ifdef HAVE___PROGNAME ++extern char *__progname; ++# define program_invocation_short_name __progname ++# else ++# ifdef HAVE_GETEXECNAME ++# define program_invocation_short_name \ ++ prog_inv_sh_nm_from_file(getexecname(), 0) ++# else ++# define program_invocation_short_name \ ++ prog_inv_sh_nm_from_file(__FILE__, 1) ++# endif ++static char prog_inv_sh_nm_buf[256]; ++static inline char * ++prog_inv_sh_nm_from_file(char *f, char stripext) ++{ ++ char *t; ++ ++ if ((t = strrchr(f, '/')) != NULL) ++ t++; ++ else ++ t = f; ++ ++ strncpy(prog_inv_sh_nm_buf, t, sizeof(prog_inv_sh_nm_buf) - 1); ++ prog_inv_sh_nm_buf[sizeof(prog_inv_sh_nm_buf) - 1] = '\0'; ++ ++ if (stripext && (t = strrchr(prog_inv_sh_nm_buf, '.')) != NULL) ++ *t = '\0'; ++ ++ return prog_inv_sh_nm_buf; ++} ++# endif ++#endif ++ ++ ++#ifndef HAVE_ERR_H ++static inline void ++errmsg(char doexit, int excode, char adderr, const char *fmt, ...) ++{ ++ fprintf(stderr, "%s: ", program_invocation_short_name); ++ if (fmt != NULL) { ++ va_list argp; ++ va_start(argp, fmt); ++ vfprintf(stderr, fmt, argp); ++ va_end(argp); ++ if (adderr) ++ fprintf(stderr, ": "); ++ } ++ if (adderr) ++ fprintf(stderr, "%m"); ++ fprintf(stderr, "\n"); ++ if (doexit) ++ exit(excode); ++} ++ ++#ifndef HAVE_ERR ++# define err(E, FMT...) errmsg(1, E, 1, FMT) ++#endif ++ ++#ifndef HAVE_ERRX ++# define errx(E, FMT...) errmsg(1, E, 0, FMT) ++#endif ++ ++#ifndef HAVE_WARN ++# define warn(FMT...) errmsg(0, 0, 1, FMT) ++#endif ++ ++#ifndef HAVE_WARNX ++# define warnx(FMT...) errmsg(0, 0, 0, FMT) ++#endif ++#endif /* !HAVE_ERR_H */ ++ ++ ++/* Don't use inline function to avoid '#include "nls.h"' in c.h ++ */ ++#define errtryhelp(eval) __extension__ ({ \ ++ fprintf(stderr, _("Try '%s --help' for more information.\n"), \ ++ program_invocation_short_name); \ ++ exit(eval); \ ++}) ++ ++/* After failed execvp() */ ++#define EX_EXEC_FAILED 126 /* Program located, but not usable. */ ++#define EX_EXEC_ENOENT 127 /* Could not find program to exec. */ ++#define errexec(name) err(errno == ENOENT ? EX_EXEC_ENOENT : EX_EXEC_FAILED, \ ++ _("failed to execute %s"), name) ++ ++ ++static inline __attribute__((const)) int is_power_of_2(unsigned long num) ++{ ++ return (num != 0 && ((num & (num - 1)) == 0)); ++} ++ ++#ifndef HAVE_LOFF_T ++typedef int64_t loff_t; ++#endif ++ ++#if !defined(HAVE_DIRFD) && (!defined(HAVE_DECL_DIRFD) || HAVE_DECL_DIRFD == 0) && defined(HAVE_DIR_DD_FD) ++#include ++#include ++static inline int dirfd(DIR *d) ++{ ++ return d->dd_fd; ++} ++#endif ++ ++/* ++ * Fallback defines for old versions of glibc ++ */ ++#include ++ ++#ifdef O_CLOEXEC ++#define UL_CLOEXECSTR "e" ++#else ++#define UL_CLOEXECSTR "" ++#endif ++ ++#ifndef O_CLOEXEC ++#define O_CLOEXEC 0 ++#endif ++ ++#ifdef __FreeBSD_kernel__ ++#ifndef F_DUPFD_CLOEXEC ++#define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ ++#endif ++#endif ++ ++ ++#ifndef AI_ADDRCONFIG ++#define AI_ADDRCONFIG 0x0020 ++#endif ++ ++#ifndef IUTF8 ++#define IUTF8 0040000 ++#endif ++ ++/* ++ * MAXHOSTNAMELEN replacement ++ */ ++static inline size_t get_hostname_max(void) ++{ ++ long len = sysconf(_SC_HOST_NAME_MAX); ++ ++ if (0 < len) ++ return len; ++ ++#ifdef MAXHOSTNAMELEN ++ return MAXHOSTNAMELEN; ++#elif HOST_NAME_MAX ++ return HOST_NAME_MAX; ++#endif ++ return 64; ++} ++ ++ ++/* ++ * Constant strings for usage() functions. For more info see ++ * Documentation/{howto-usage-function.txt,boilerplate.c} ++ */ ++#define USAGE_HEADER ("\nUsage:\n") ++#define USAGE_OPTIONS ("\nOptions:\n") ++#define USAGE_FUNCTIONS ("\nFunctions:\n") ++#define USAGE_COMMANDS ("\nCommands:\n") ++#define USAGE_COLUMNS ("\nAvailable output columns:\n") ++#define USAGE_SEPARATOR "\n" ++ ++#define USAGE_OPTSTR_HELP ("display this help") ++#define USAGE_OPTSTR_VERSION ("display version") ++ ++#define USAGE_HELP_OPTIONS(marg_dsc) \ ++ "%-" #marg_dsc "s%s\n" \ ++ "%-" #marg_dsc "s%s\n" \ ++ , " -h, --help", USAGE_OPTSTR_HELP \ ++ , " -V, --version", USAGE_OPTSTR_VERSION ++ ++#define USAGE_MAN_TAIL(_man) ("\nFor more details see %s.\n"), _man ++ ++#define UTIL_LINUX_VERSION ("%s from %s\n"), program_invocation_short_name, PACKAGE_STRING ++ ++#define print_version(eval) __extension__ ({ \ ++ printf(UTIL_LINUX_VERSION); \ ++ exit(eval); \ ++}) ++ ++/* ++ * scanf modifiers for "strings allocation" ++ */ ++#ifdef HAVE_SCANF_MS_MODIFIER ++#define UL_SCNsA "%ms" ++#elif defined(HAVE_SCANF_AS_MODIFIER) ++#define UL_SCNsA "%as" ++#endif ++ ++/* ++ * seek stuff ++ */ ++#ifndef SEEK_DATA ++# define SEEK_DATA 3 ++#endif ++#ifndef SEEK_HOLE ++# define SEEK_HOLE 4 ++#endif ++ ++ ++/* ++ * Macros to convert #define'itions to strings, for example ++ * #define XYXXY 42 ++ * printf ("%s=%s\n", stringify(XYXXY), stringify_value(XYXXY)); ++ */ ++#define stringify_value(s) stringify(s) ++#define stringify(s) #s ++ ++/* ++ * UL_ASAN_BLACKLIST is a macro to tell AddressSanitizer (a compile-time ++ * instrumentation shipped with Clang and GCC) to not instrument the ++ * annotated function. Furthermore, it will prevent the compiler from ++ * inlining the function because inlining currently breaks the blacklisting ++ * mechanism of AddressSanitizer. ++ */ ++#if __has_feature(address_sanitizer) && __has_attribute(no_sanitize_memory) && __has_attribute(no_sanitize_address) ++# define UL_ASAN_BLACKLIST __attribute__((noinline)) __attribute__((no_sanitize_memory)) __attribute__((no_sanitize_address)) ++#else ++# define UL_ASAN_BLACKLIST /* nothing */ ++#endif ++ ++/* ++ * Note that sysconf(_SC_GETPW_R_SIZE_MAX) returns *initial* suggested size for ++ * pwd buffer and in some cases it is not large enough. See POSIX and ++ * getpwnam_r man page for more details. ++ */ ++#define UL_GETPW_BUFSIZ (16 * 1024) ++ ++/* ++ * Darwin or other BSDs may only have MAP_ANON. To get it on Darwin we must ++ * define _DARWIN_C_SOURCE before including sys/mman.h. We do this in config.h. ++ */ ++#if !defined MAP_ANONYMOUS && defined MAP_ANON ++# define MAP_ANONYMOUS (MAP_ANON) ++#endif ++ ++#endif /* UTIL_LINUX_C_H */ +diff --git a/locale/programs/cross-localedef-hardlink.c b/locale/programs/cross-localedef-hardlink.c +new file mode 100644 +index 0000000000..63615896b0 +--- /dev/null ++++ b/locale/programs/cross-localedef-hardlink.c +@@ -0,0 +1,528 @@ ++/* ++ * hardlink - consolidate duplicate files via hardlinks ++ * ++ * Copyright (C) 2018 Red Hat, Inc. All rights reserved. ++ * Written by Jakub Jelinek ++ * ++ * Copyright (C) 2019 Karel Zak ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it would be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License along ++ * with this program; if not, write to the Free Software Foundation, Inc., ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#ifdef HAVE_PCRE ++# define PCRE2_CODE_UNIT_WIDTH 8 ++# include ++#endif ++ ++#include "c.h" ++#include "xalloc.h" ++#include "nls.h" ++#include "closestream.h" ++ ++#define NHASH (1<<17) /* Must be a power of 2! */ ++#define NBUF 64 ++ ++struct hardlink_file; ++ ++struct hardlink_hash { ++ struct hardlink_hash *next; ++ struct hardlink_file *chain; ++ off_t size; ++ time_t mtime; ++}; ++ ++struct hardlink_dir { ++ struct hardlink_dir *next; ++ char name[]; ++}; ++ ++struct hardlink_file { ++ struct hardlink_file *next; ++ ino_t ino; ++ dev_t dev; ++ unsigned int cksum; ++ char name[]; ++}; ++ ++struct hardlink_dynstr { ++ char *buf; ++ size_t alloc; ++}; ++ ++struct hardlink_ctl { ++ struct hardlink_dir *dirs; ++ struct hardlink_hash *hps[NHASH]; ++ char iobuf1[BUFSIZ]; ++ char iobuf2[BUFSIZ]; ++ /* summary counters */ ++ unsigned long long ndirs; ++ unsigned long long nobjects; ++ unsigned long long nregfiles; ++ unsigned long long ncomp; ++ unsigned long long nlinks; ++ unsigned long long nsaved; ++ /* current device */ ++ dev_t dev; ++ /* flags */ ++ unsigned int verbose; ++ unsigned int ++ no_link:1, ++ content_only:1, ++ force:1; ++}; ++/* ctl is in global scope due use in atexit() */ ++struct hardlink_ctl global_ctl; ++ ++__attribute__ ((always_inline)) ++static inline unsigned int hash(off_t size, time_t mtime) ++{ ++ return (size ^ mtime) & (NHASH - 1); ++} ++ ++__attribute__ ((always_inline)) ++static inline int stcmp(struct stat *st1, struct stat *st2, int content_scope) ++{ ++ if (content_scope) ++ return st1->st_size != st2->st_size; ++ ++ return st1->st_mode != st2->st_mode ++ || st1->st_uid != st2->st_uid ++ || st1->st_gid != st2->st_gid ++ || st1->st_size != st2->st_size ++ || st1->st_mtime != st2->st_mtime; ++} ++ ++static void print_summary(void) ++{ ++ struct hardlink_ctl const *const ctl = &global_ctl; ++ ++ if (!ctl->verbose) ++ return; ++ ++ if (ctl->verbose > 1 && ctl->nlinks) ++ fputc('\n', stdout); ++ ++ printf(_("Directories: %9lld\n"), ctl->ndirs); ++ printf(_("Objects: %9lld\n"), ctl->nobjects); ++ printf(_("Regular files: %9lld\n"), ctl->nregfiles); ++ printf(_("Comparisons: %9lld\n"), ctl->ncomp); ++ printf( "%s%9lld\n", (ctl->no_link ? ++ _("Would link: ") : ++ _("Linked: ")), ctl->nlinks); ++ printf( "%s %9lld\n", (ctl->no_link ? ++ _("Would save: ") : ++ _("Saved: ")), ctl->nsaved); ++} ++ ++static void __attribute__((__noreturn__)) usage(void) ++{ ++ fputs(USAGE_HEADER, stdout); ++ printf(_(" %s [options] directory...\n"), program_invocation_short_name); ++ ++ fputs(USAGE_SEPARATOR, stdout); ++ puts(_("Consolidate duplicate files using hardlinks.")); ++ ++ fputs(USAGE_OPTIONS, stdout); ++ puts(_(" -c, --content compare only contents, ignore permission, etc.")); ++ puts(_(" -n, --dry-run don't actually link anything")); ++ puts(_(" -v, --verbose print summary after hardlinking")); ++ puts(_(" -vv print every hardlinked file and summary")); ++ puts(_(" -f, --force force hardlinking across filesystems")); ++ puts(_(" -x, --exclude exclude files matching pattern")); ++ ++ fputs(USAGE_SEPARATOR, stdout); ++ printf(USAGE_HELP_OPTIONS(16)); /* char offset to align option descriptions */ ++ printf(USAGE_MAN_TAIL("hardlink(1)")); ++ exit(EXIT_SUCCESS); ++} ++ ++__attribute__ ((always_inline)) ++static inline size_t add2(size_t a, size_t b) ++{ ++ size_t sum = a + b; ++ ++ if (sum < a) ++ errx(EXIT_FAILURE, _("integer overflow")); ++ return sum; ++} ++ ++__attribute__ ((always_inline)) ++static inline size_t add3(size_t a, size_t b, size_t c) ++{ ++ return add2(add2(a, b), c); ++} ++ ++static void growstr(struct hardlink_dynstr *str, size_t newlen) ++{ ++ if (newlen < str->alloc) ++ return; ++ str->buf = xrealloc(str->buf, str->alloc = add2(newlen, 1)); ++} ++ ++static void process_path(struct hardlink_ctl *ctl, const char *name) ++{ ++ struct stat st, st2, st3; ++ const size_t namelen = strlen(name); ++ ++ ctl->nobjects++; ++ if (lstat(name, &st)) ++ return; ++ ++ if (st.st_dev != ctl->dev && !ctl->force) { ++ if (ctl->dev) ++ errx(EXIT_FAILURE, ++ _("%s is on different filesystem than the rest " ++ "(use -f option to override)."), name); ++ ctl->dev = st.st_dev; ++ } ++ if (S_ISDIR(st.st_mode)) { ++ struct hardlink_dir *dp = xmalloc(add3(sizeof(*dp), namelen, 1)); ++ memcpy(dp->name, name, namelen + 1); ++ dp->next = ctl->dirs; ++ ctl->dirs = dp; ++ ++ } else if (S_ISREG(st.st_mode)) { ++ int fd, i; ++ struct hardlink_file *fp, *fp2; ++ struct hardlink_hash *hp; ++ const char *n1, *n2; ++ unsigned int buf[NBUF]; ++ int cksumsize = sizeof(buf); ++ unsigned int cksum; ++ time_t mtime = ctl->content_only ? 0 : st.st_mtime; ++ unsigned int hsh = hash(st.st_size, mtime); ++ off_t fsize; ++ ++ ctl->nregfiles++; ++ if (ctl->verbose > 1) ++ printf("%s\n", name); ++ ++ fd = open(name, O_RDONLY); ++ if (fd < 0) ++ return; ++ ++ if ((size_t)st.st_size < sizeof(buf)) { ++ cksumsize = st.st_size; ++ memset(((char *)buf) + cksumsize, 0, ++ (sizeof(buf) - cksumsize) % sizeof(buf[0])); ++ } ++ if (read(fd, buf, cksumsize) != cksumsize) { ++ close(fd); ++ return; ++ } ++ cksumsize = (cksumsize + sizeof(buf[0]) - 1) / sizeof(buf[0]); ++ for (i = 0, cksum = 0; i < cksumsize; i++) { ++ if (cksum + buf[i] < cksum) ++ cksum += buf[i] + 1; ++ else ++ cksum += buf[i]; ++ } ++ for (hp = ctl->hps[hsh]; hp; hp = hp->next) { ++ if (hp->size == st.st_size && hp->mtime == mtime) ++ break; ++ } ++ if (!hp) { ++ hp = xmalloc(sizeof(*hp)); ++ hp->size = st.st_size; ++ hp->mtime = mtime; ++ hp->chain = NULL; ++ hp->next = ctl->hps[hsh]; ++ ctl->hps[hsh] = hp; ++ } ++ for (fp = hp->chain; fp; fp = fp->next) { ++ if (fp->cksum == cksum) ++ break; ++ } ++ for (fp2 = fp; fp2 && fp2->cksum == cksum; fp2 = fp2->next) { ++ if (fp2->ino == st.st_ino && fp2->dev == st.st_dev) { ++ close(fd); ++ return; ++ } ++ } ++ for (fp2 = fp; fp2 && fp2->cksum == cksum; fp2 = fp2->next) { ++ ++ if (!lstat(fp2->name, &st2) && S_ISREG(st2.st_mode) && ++ !stcmp(&st, &st2, ctl->content_only) && ++ st2.st_ino != st.st_ino && ++ st2.st_dev == st.st_dev) { ++ ++ int fd2 = open(fp2->name, O_RDONLY); ++ if (fd2 < 0) ++ continue; ++ ++ if (fstat(fd2, &st2) || !S_ISREG(st2.st_mode) ++ || st2.st_size == 0) { ++ close(fd2); ++ continue; ++ } ++ ctl->ncomp++; ++ lseek(fd, 0, SEEK_SET); ++ ++ for (fsize = st.st_size; fsize > 0; ++ fsize -= (off_t)sizeof(ctl->iobuf1)) { ++ ssize_t xsz; ++ ssize_t rsize = fsize > (ssize_t) sizeof(ctl->iobuf1) ? ++ (ssize_t) sizeof(ctl->iobuf1) : fsize; ++ ++ if ((xsz = read(fd, ctl->iobuf1, rsize)) != rsize) ++ warn(_("cannot read %s"), name); ++ else if ((xsz = read(fd2, ctl->iobuf2, rsize)) != rsize) ++ warn(_("cannot read %s"), fp2->name); ++ ++ if (xsz != rsize) { ++ close(fd); ++ close(fd2); ++ return; ++ } ++ if (memcmp(ctl->iobuf1, ctl->iobuf2, rsize)) ++ break; ++ } ++ close(fd2); ++ if (fsize > 0) ++ continue; ++ if (lstat(name, &st3)) { ++ warn(_("cannot stat %s"), name); ++ close(fd); ++ return; ++ } ++ st3.st_atime = st.st_atime; ++ if (stcmp(&st, &st3, 0)) { ++ warnx(_("file %s changed underneath us"), name); ++ close(fd); ++ return; ++ } ++ n1 = fp2->name; ++ n2 = name; ++ ++ if (!ctl->no_link) { ++ const char *suffix = ++ ".$$$___cleanit___$$$"; ++ const size_t suffixlen = strlen(suffix); ++ size_t n2len = strlen(n2); ++ struct hardlink_dynstr nam2 = { NULL, 0 }; ++ ++ growstr(&nam2, add2(n2len, suffixlen)); ++ memcpy(nam2.buf, n2, n2len); ++ memcpy(&nam2.buf[n2len], suffix, ++ suffixlen + 1); ++ /* First create a temporary link to n1 under a new name */ ++ if (link(n1, nam2.buf)) { ++ warn(_("failed to hardlink %s to %s (create temporary link as %s failed)"), ++ n1, n2, nam2.buf); ++ free(nam2.buf); ++ continue; ++ } ++ /* Then rename into place over the existing n2 */ ++ if (rename(nam2.buf, n2)) { ++ warn(_("failed to hardlink %s to %s (rename temporary link to %s failed)"), ++ n1, n2, n2); ++ /* Something went wrong, try to remove the now redundant temporary link */ ++ if (unlink(nam2.buf)) ++ warn(_("failed to remove temporary link %s"), nam2.buf); ++ free(nam2.buf); ++ continue; ++ } ++ free(nam2.buf); ++ } ++ ctl->nlinks++; ++ if (st3.st_nlink > 1) { ++ /* We actually did not save anything this time, since the link second argument ++ had some other links as well. */ ++ if (ctl->verbose > 1) ++ printf(_(" %s %s to %s\n"), ++ (ctl->no_link ? _("Would link") : _("Linked")), ++ n1, n2); ++ } else { ++ ctl->nsaved += ((st.st_size + 4095) / 4096) * 4096; ++ if (ctl->verbose > 1) ++ printf(_(" %s %s to %s, %s %jd\n"), ++ (ctl->no_link ? _("Would link") : _("Linked")), ++ n1, n2, ++ (ctl->no_link ? _("would save") : _("saved")), ++ (intmax_t)st.st_size); ++ } ++ close(fd); ++ return; ++ } ++ } ++ fp2 = xmalloc(add3(sizeof(*fp2), namelen, 1)); ++ close(fd); ++ fp2->ino = st.st_ino; ++ fp2->dev = st.st_dev; ++ fp2->cksum = cksum; ++ memcpy(fp2->name, name, namelen + 1); ++ ++ if (fp) { ++ fp2->next = fp->next; ++ fp->next = fp2; ++ } else { ++ fp2->next = hp->chain; ++ hp->chain = fp2; ++ } ++ return; ++ } ++} ++ ++int main(int argc, char **argv) ++{ ++ int ch; ++ int i; ++#ifdef HAVE_PCRE ++ int errornumber; ++ PCRE2_SIZE erroroffset; ++ pcre2_code *re = NULL; ++ PCRE2_SPTR exclude_pattern = NULL; ++ pcre2_match_data *match_data = NULL; ++#endif ++ struct hardlink_dynstr nam1 = { NULL, 0 }; ++ struct hardlink_ctl *ctl = &global_ctl; ++ ++ static const struct option longopts[] = { ++ { "content", no_argument, NULL, 'c' }, ++ { "dry-run", no_argument, NULL, 'n' }, ++ { "exclude", required_argument, NULL, 'x' }, ++ { "force", no_argument, NULL, 'f' }, ++ { "help", no_argument, NULL, 'h' }, ++ { "verbose", no_argument, NULL, 'v' }, ++ { "version", no_argument, NULL, 'V' }, ++ { NULL, 0, NULL, 0 }, ++ }; ++ ++ setlocale(LC_ALL, ""); ++ bindtextdomain(PACKAGE, LOCALEDIR); ++ textdomain(PACKAGE); ++ close_stdout_atexit(); ++ ++ while ((ch = getopt_long(argc, argv, "cnvfx:Vh", longopts, NULL)) != -1) { ++ switch (ch) { ++ case 'n': ++ ctl->no_link = 1; ++ break; ++ case 'v': ++ ctl->verbose++; ++ break; ++ case 'c': ++ ctl->content_only = 1; ++ break; ++ case 'f': ++ ctl->force = 1; ++ break; ++ case 'x': ++#ifdef HAVE_PCRE ++ exclude_pattern = (PCRE2_SPTR) optarg; ++#else ++ errx(EXIT_FAILURE, ++ _("option --exclude not supported (built without pcre2)")); ++#endif ++ break; ++ case 'V': ++ print_version(EXIT_SUCCESS); ++ case 'h': ++ usage(); ++ default: ++ errtryhelp(EXIT_FAILURE); ++ } ++ } ++ ++ if (optind == argc) { ++ warnx(_("no directory specified")); ++ errtryhelp(EXIT_FAILURE); ++ } ++ ++#ifdef HAVE_PCRE ++ if (exclude_pattern) { ++ re = pcre2_compile(exclude_pattern, /* the pattern */ ++ PCRE2_ZERO_TERMINATED, /* indicates pattern is zero-terminate */ ++ 0, /* default options */ ++ &errornumber, &erroroffset, NULL); /* use default compile context */ ++ if (!re) { ++ PCRE2_UCHAR buffer[256]; ++ pcre2_get_error_message(errornumber, buffer, ++ sizeof(buffer)); ++ errx(EXIT_FAILURE, _("pattern error at offset %d: %s"), ++ (int)erroroffset, buffer); ++ } ++ match_data = pcre2_match_data_create_from_pattern(re, NULL); ++ } ++#endif ++ atexit(print_summary); ++ ++ for (i = optind; i < argc; i++) ++ process_path(ctl, argv[i]); ++ ++ while (ctl->dirs) { ++ DIR *dh; ++ struct dirent *di; ++ struct hardlink_dir *dp = ctl->dirs; ++ size_t nam1baselen = strlen(dp->name); ++ ++ ctl->dirs = dp->next; ++ growstr(&nam1, add2(nam1baselen, 1)); ++ memcpy(nam1.buf, dp->name, nam1baselen); ++ free(dp); ++ nam1.buf[nam1baselen++] = '/'; ++ nam1.buf[nam1baselen] = 0; ++ dh = opendir(nam1.buf); ++ ++ if (dh == NULL) ++ continue; ++ ctl->ndirs++; ++ ++ while ((di = readdir(dh)) != NULL) { ++ if (!di->d_name[0]) ++ continue; ++ if (di->d_name[0] == '.') { ++ if (!di->d_name[1] || !strcmp(di->d_name, "..")) ++ continue; ++ } ++#ifdef HAVE_PCRE ++ if (re && pcre2_match(re, /* compiled regex */ ++ (PCRE2_SPTR) di->d_name, strlen(di->d_name), 0, /* start at offset 0 */ ++ 0, /* default options */ ++ match_data, /* block for storing the result */ ++ NULL) /* use default match context */ ++ >=0) { ++ if (ctl->verbose) { ++ nam1.buf[nam1baselen] = 0; ++ printf(_("Skipping %s%s\n"), nam1.buf, di->d_name); ++ } ++ continue; ++ } ++#endif ++ { ++ size_t subdirlen; ++ growstr(&nam1, ++ add2(nam1baselen, subdirlen = ++ strlen(di->d_name))); ++ memcpy(&nam1.buf[nam1baselen], di->d_name, ++ add2(subdirlen, 1)); ++ } ++ process_path(ctl, nam1.buf); ++ } ++ closedir(dh); ++ } ++ ++ return 0; ++} +diff --git a/locale/programs/xalloc.h b/locale/programs/xalloc.h +new file mode 100644 +index 0000000000..0129a85e2e +--- /dev/null ++++ b/locale/programs/xalloc.h +@@ -0,0 +1,129 @@ ++/* ++ * Copyright (C) 2010 Davidlohr Bueso ++ * ++ * This file may be redistributed under the terms of the ++ * GNU Lesser General Public License. ++ * ++ * General memory allocation wrappers for malloc, realloc, calloc and strdup ++ */ ++ ++#ifndef UTIL_LINUX_XALLOC_H ++#define UTIL_LINUX_XALLOC_H ++ ++#include ++#include ++ ++#include "c.h" ++ ++#ifndef XALLOC_EXIT_CODE ++# define XALLOC_EXIT_CODE EXIT_FAILURE ++#endif ++ ++static inline void __attribute__((__noreturn__)) ++__err_oom(const char *file, unsigned int line) ++{ ++ err(XALLOC_EXIT_CODE, "%s: %u: cannot allocate memory", file, line); ++} ++ ++#define err_oom() __err_oom(__FILE__, __LINE__) ++ ++static inline __ul_alloc_size(1) __ul_returns_nonnull ++void *xmalloc(const size_t size) ++{ ++ void *ret = malloc(size); ++ ++ if (!ret && size) ++ err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size); ++ return ret; ++} ++ ++static inline __ul_alloc_size(2) __ul_returns_nonnull ++void *xrealloc(void *ptr, const size_t size) ++{ ++ void *ret = realloc(ptr, size); ++ ++ if (!ret && size) ++ err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size); ++ return ret; ++} ++ ++static inline __ul_calloc_size(1, 2) __ul_returns_nonnull ++void *xcalloc(const size_t nelems, const size_t size) ++{ ++ void *ret = calloc(nelems, size); ++ ++ if (!ret && size && nelems) ++ err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size); ++ return ret; ++} ++ ++static inline char __attribute__((warn_unused_result)) __ul_returns_nonnull ++*xstrdup(const char *str) ++{ ++ char *ret; ++ ++ if (!str) ++ return NULL; ++ ++ ret = strdup(str); ++ ++ if (!ret) ++ err(XALLOC_EXIT_CODE, "cannot duplicate string"); ++ return ret; ++} ++ ++static inline char * __attribute__((warn_unused_result)) __ul_returns_nonnull ++xstrndup(const char *str, size_t size) ++{ ++ char *ret; ++ ++ if (!str) ++ return NULL; ++ ++ ret = strndup(str, size); ++ ++ if (!ret) ++ err(XALLOC_EXIT_CODE, "cannot duplicate string"); ++ return ret; ++} ++ ++ ++static inline int __attribute__ ((__format__(printf, 2, 3))) ++ xasprintf(char **strp, const char *fmt, ...) ++{ ++ int ret; ++ va_list args; ++ va_start(args, fmt); ++ ret = vasprintf(&(*strp), fmt, args); ++ va_end(args); ++ if (ret < 0) ++ err(XALLOC_EXIT_CODE, "cannot allocate string"); ++ return ret; ++} ++ ++static inline int __attribute__ ((__format__(printf, 2, 0))) ++xvasprintf(char **strp, const char *fmt, va_list ap) ++{ ++ int ret = vasprintf(&(*strp), fmt, ap); ++ if (ret < 0) ++ err(XALLOC_EXIT_CODE, "cannot allocate string"); ++ return ret; ++} ++ ++ ++static inline char * __attribute__((warn_unused_result)) xgethostname(void) ++{ ++ char *name; ++ size_t sz = get_hostname_max() + 1; ++ ++ name = xmalloc(sizeof(char) * sz); ++ ++ if (gethostname(name, sz) != 0) { ++ free(name); ++ return NULL; ++ } ++ name[sz - 1] = '\0'; ++ return name; ++} ++ ++#endif diff --git a/recipes-core/glibc/glibc/0002-CVE-2021-38604.patch b/recipes-core/glibc/glibc/0002-CVE-2021-38604.patch new file mode 100644 index 0000000..9f71fec --- /dev/null +++ b/recipes-core/glibc/glibc/0002-CVE-2021-38604.patch @@ -0,0 +1,150 @@ +From 4cc79c217744743077bf7a0ec5e0a4318f1e6641 Mon Sep 17 00:00:00 2001 +From: Nikita Popov +Date: Thu, 12 Aug 2021 16:09:50 +0530 +Subject: [PATCH] librt: add test (bug 28213) + +This test implements following logic: +1) Create POSIX message queue. + Register a notification with mq_notify (using NULL attributes). + Then immediately unregister the notification with mq_notify. + Helper thread in a vulnerable version of glibc + should cause NULL pointer dereference after these steps. +2) Once again, register the same notification. + Try to send a dummy message. + Test is considered successfulif the dummy message + is successfully received by the callback function. + +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=4cc79c217744743077bf7a0ec5e0a4318f1e6641] +CVE: CVE-2021-38604 + +Signed-off-by: Nikita Popov +Reviewed-by: Siddhesh Poyarekar +Signed-off-by: Vinay Kumar +--- + rt/Makefile | 1 + + rt/tst-bz28213.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 102 insertions(+) + create mode 100644 rt/tst-bz28213.c + +diff --git a/rt/Makefile b/rt/Makefile +index 113cea03a5..910e775995 100644 +--- a/rt/Makefile ++++ b/rt/Makefile +@@ -74,6 +74,7 @@ tests := tst-shm tst-timer tst-timer2 \ + tst-aio7 tst-aio8 tst-aio9 tst-aio10 \ + tst-mqueue1 tst-mqueue2 tst-mqueue3 tst-mqueue4 \ + tst-mqueue5 tst-mqueue6 tst-mqueue7 tst-mqueue8 tst-mqueue9 \ ++ tst-bz28213 \ + tst-timer3 tst-timer4 tst-timer5 \ + tst-cpuclock2 tst-cputimer1 tst-cputimer2 tst-cputimer3 \ + tst-shm-cancel \ +diff --git a/rt/tst-bz28213.c b/rt/tst-bz28213.c +new file mode 100644 +index 0000000000..0c096b5a0a +--- /dev/null ++++ b/rt/tst-bz28213.c +@@ -0,0 +1,101 @@ ++/* Bug 28213: test for NULL pointer dereference in mq_notify. ++ Copyright (C) The GNU Toolchain Authors. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static mqd_t m = -1; ++static const char msg[] = "hello"; ++ ++static void ++check_bz28213_cb (union sigval sv) ++{ ++ char buf[sizeof (msg)]; ++ ++ (void) sv; ++ ++ TEST_VERIFY_EXIT ((size_t) mq_receive (m, buf, sizeof (buf), NULL) ++ == sizeof (buf)); ++ TEST_VERIFY_EXIT (memcmp (buf, msg, sizeof (buf)) == 0); ++ ++ exit (0); ++} ++ ++static void ++check_bz28213 (void) ++{ ++ struct sigevent sev; ++ ++ memset (&sev, '\0', sizeof (sev)); ++ sev.sigev_notify = SIGEV_THREAD; ++ sev.sigev_notify_function = check_bz28213_cb; ++ ++ /* Step 1: Register & unregister notifier. ++ Helper thread should receive NOTIFY_REMOVED notification. ++ In a vulnerable version of glibc, NULL pointer dereference follows. */ ++ TEST_VERIFY_EXIT (mq_notify (m, &sev) == 0); ++ TEST_VERIFY_EXIT (mq_notify (m, NULL) == 0); ++ ++ /* Step 2: Once again, register notification. ++ Try to send one message. ++ Test is considered successful, if the callback does exit (0). */ ++ TEST_VERIFY_EXIT (mq_notify (m, &sev) == 0); ++ TEST_VERIFY_EXIT (mq_send (m, msg, sizeof (msg), 1) == 0); ++ ++ /* Wait... */ ++ pause (); ++} ++ ++static int ++do_test (void) ++{ ++ static const char m_name[] = "/bz28213_queue"; ++ struct mq_attr m_attr; ++ ++ memset (&m_attr, '\0', sizeof (m_attr)); ++ m_attr.mq_maxmsg = 1; ++ m_attr.mq_msgsize = sizeof (msg); ++ ++ m = mq_open (m_name, ++ O_RDWR | O_CREAT | O_EXCL, ++ 0600, ++ &m_attr); ++ ++ if (m < 0) ++ { ++ if (errno == ENOSYS) ++ FAIL_UNSUPPORTED ("POSIX message queues are not implemented\n"); ++ FAIL_EXIT1 ("Failed to create POSIX message queue: %m\n"); ++ } ++ ++ TEST_VERIFY_EXIT (mq_unlink (m_name) == 0); ++ ++ check_bz28213 (); ++ ++ return 0; ++} ++ ++#include +-- +2.31.1 + diff --git a/recipes-core/glibc/glibc/0002-CVE-2021-3998.patch b/recipes-core/glibc/glibc/0002-CVE-2021-3998.patch new file mode 100644 index 0000000..0a4c344 --- /dev/null +++ b/recipes-core/glibc/glibc/0002-CVE-2021-3998.patch @@ -0,0 +1,138 @@ +From f7a79879c0b2bef0dadd6caaaeeb0d26423e04e5 Mon Sep 17 00:00:00 2001 +From: Siddhesh Poyarekar +Date: Thu, 13 Jan 2022 11:28:36 +0530 +Subject: [PATCH] realpath: Set errno to ENAMETOOLONG for result larger than + PATH_MAX [BZ #28770] + +realpath returns an allocated string when the result exceeds PATH_MAX, +which is unexpected when its second argument is not NULL. This results +in the second argument (resolved) being uninitialized and also results +in a memory leak since the caller expects resolved to be the same as the +returned value. + +Return NULL and set errno to ENAMETOOLONG if the result exceeds +PATH_MAX. This fixes [BZ #28770], which is CVE-2021-3998. + +Reviewed-by: Adhemerval Zanella +Signed-off-by: Siddhesh Poyarekar +(cherry picked from commit ee8d5e33adb284601c00c94687bc907e10aec9bb) + +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=f7a79879c0b2bef0dadd6caaaeeb0d26423e04e5] +CVE: CVE-2021-3998 + +Signed-off-by: Pgowda +--- + NEWS | 4 +++ + stdlib/Makefile | 1 + + stdlib/canonicalize.c | 12 +++++++-- + stdlib/tst-realpath-toolong.c | 49 +++++++++++++++++++++++++++++++++++ + 4 files changed, 64 insertions(+), 2 deletions(-) + create mode 100644 stdlib/tst-realpath-toolong.c + +diff --git a/NEWS b/NEWS +index 7e773bd005..b4f81c2668 100644 +--- a/NEWS ++++ b/NEWS +@@ -210,6 +210,10 @@ Security related changes: + legacy function could result in a stack-based buffer overflow when + using the "unix" protocol. Reported by Martin Sebor. + ++ CVE-2021-3998: Passing a path longer than PATH_MAX to the realpath ++ function could result in a memory leak and potential access of ++ uninitialized memory. Reported by Qualys. ++ + The following bugs are resolved with this release: + + [4737] libc: fork is not async-signal-safe +diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c +index 698f9ede25..7a23a51b3a 100644 +--- a/stdlib/canonicalize.c ++++ b/stdlib/canonicalize.c +@@ -400,8 +400,16 @@ realpath_stk (const char *name, char *re + + error: + *dest++ = '\0'; +- if (resolved != NULL && dest - rname <= get_path_max ()) +- rname = strcpy (resolved, rname); ++ if (resolved != NULL) ++ { ++ if (dest - rname <= get_path_max ()) ++ rname = strcpy (resolved, rname); ++ else ++ { ++ failed = true; ++ __set_errno (ENAMETOOLONG); ++ } ++ } + + error_nomem: + scratch_buffer_free (&extra_buffer); +diff --git a/stdlib/Makefile b/stdlib/Makefile +index 9bb5c221e8..a4ac30d1f6 100644 +--- a/stdlib/Makefile ++++ b/stdlib/Makefile +@@ -88,7 +88,8 @@ tests := tst-strtol tst-strtod testmb t + tst-swapcontext1 tst-setcontext4 tst-setcontext5 \ + tst-setcontext6 tst-setcontext7 tst-setcontext8 \ + tst-setcontext9 tst-bz20544 tst-canon-bz26341 \ +- tst-realpath ++ tst-realpath \ ++ tst-realpath-toolong + + tests-internal := tst-strtod1i tst-strtod3 tst-strtod4 tst-strtod5i \ + tst-tls-atexit tst-tls-atexit-nodelete +diff --git a/stdlib/tst-realpath-toolong.c b/stdlib/tst-realpath-toolong.c +new file mode 100644 +index 0000000000..8bed772460 +--- /dev/null ++++ b/stdlib/tst-realpath-toolong.c +@@ -0,0 +1,49 @@ ++/* Verify that realpath returns NULL with ENAMETOOLONG if the result exceeds ++ NAME_MAX. ++ Copyright The GNU Toolchain Authors. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define BASENAME "tst-realpath-toolong." ++ ++int ++do_test (void) ++{ ++ char *base = support_create_and_chdir_toolong_temp_directory (BASENAME); ++ ++ char buf[PATH_MAX + 1]; ++ const char *res = realpath (".", buf); ++ ++ /* canonicalize.c states that if the real path is >= PATH_MAX, then ++ realpath returns NULL and sets ENAMETOOLONG. */ ++ TEST_VERIFY (res == NULL); ++ TEST_VERIFY (errno == ENAMETOOLONG); ++ ++ free (base); ++ return 0; ++} ++ ++#include diff --git a/recipes-core/glibc/glibc/0002-CVE-2021-3999.patch b/recipes-core/glibc/glibc/0002-CVE-2021-3999.patch new file mode 100644 index 0000000..ef3a504 --- /dev/null +++ b/recipes-core/glibc/glibc/0002-CVE-2021-3999.patch @@ -0,0 +1,357 @@ +From 472e799a5f2102bc0c3206dbd5a801765fceb39c Mon Sep 17 00:00:00 2001 +From: Siddhesh Poyarekar +Date: Fri, 21 Jan 2022 23:32:56 +0530 +Subject: [PATCH] getcwd: Set errno to ERANGE for size == 1 (CVE-2021-3999) + +No valid path returned by getcwd would fit into 1 byte, so reject the +size early and return NULL with errno set to ERANGE. This change is +prompted by CVE-2021-3999, which describes a single byte buffer +underflow and overflow when all of the following conditions are met: + +- The buffer size (i.e. the second argument of getcwd) is 1 byte +- The current working directory is too long +- '/' is also mounted on the current working directory + +Sequence of events: + +- In sysdeps/unix/sysv/linux/getcwd.c, the syscall returns ENAMETOOLONG + because the linux kernel checks for name length before it checks + buffer size + +- The code falls back to the generic getcwd in sysdeps/posix + +- In the generic func, the buf[0] is set to '\0' on line 250 + +- this while loop on line 262 is bypassed: + + while (!(thisdev == rootdev && thisino == rootino)) + + since the rootfs (/) is bind mounted onto the directory and the flow + goes on to line 449, where it puts a '/' in the byte before the + buffer. + +- Finally on line 458, it moves 2 bytes (the underflowed byte and the + '\0') to the buf[0] and buf[1], resulting in a 1 byte buffer overflow. + +- buf is returned on line 469 and errno is not set. + +This resolves BZ #28769. + +Reviewed-by: Andreas Schwab +Reviewed-by: Adhemerval Zanella +Signed-off-by: Qualys Security Advisory +Signed-off-by: Siddhesh Poyarekar +(cherry picked from commit 23e0e8f5f1fb5ed150253d986ecccdc90c2dcd5e) + +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=472e799a5f2102bc0c3206dbd5a801765fceb39c] +CVE: CVE-2021-3999 + +Signed-off-by: Pgowda +--- + NEWS | 6 + + sysdeps/posix/getcwd.c | 7 + + sysdeps/unix/sysv/linux/Makefile | 7 +- + .../unix/sysv/linux/tst-getcwd-smallbuff.c | 241 ++++++++++++++++++ + 4 files changed, 260 insertions(+), 1 deletion(-) + create mode 100644 sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c + +diff --git a/NEWS b/NEWS +index b4f81c2668..8d7467d2c1 100644 +--- a/NEWS ++++ b/NEWS +@@ -214,6 +214,12 @@ Security related changes: + function could result in a memory leak and potential access of + uninitialized memory. Reported by Qualys. + ++ CVE-2021-3999: Passing a buffer of size exactly 1 byte to the getcwd ++ function may result in an off-by-one buffer underflow and overflow ++ when the current working directory is longer than PATH_MAX and also ++ corresponds to the / directory through an unprivileged mount ++ namespace. Reported by Qualys. ++ + The following bugs are resolved with this release: + + [4737] libc: fork is not async-signal-safe +diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c +index 13680026ff..b6984a382c 100644 +--- a/sysdeps/posix/getcwd.c ++++ b/sysdeps/posix/getcwd.c +@@ -187,6 +187,13 @@ __getcwd_generic (char *buf, size_t size + size_t allocated = size; + size_t used; + ++ /* A size of 1 byte is never useful. */ ++ if (allocated == 1) ++ { ++ __set_errno (ERANGE); ++ return NULL; ++ } ++ + #if HAVE_MINIMALLY_WORKING_GETCWD + /* If AT_FDCWD is not defined, the algorithm below is O(N**2) and + this is much slower than the system getcwd (at least on +diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile +index 76ad06361c..9380d3848d 100644 +--- a/sysdeps/unix/sysv/linux/Makefile ++++ b/sysdeps/unix/sysv/linux/Makefile +@@ -331,7 +331,12 @@ sysdep_routines += xstatconv internal_st + + sysdep_headers += bits/fcntl-linux.h + +-tests += tst-fallocate tst-fallocate64 tst-o_path-locks ++tests += \ ++ tst-fallocate \ ++ tst-fallocate64 \ ++ tst-getcwd-smallbuff \ ++ tst-o_path-locks \ ++# tests + endif + + ifeq ($(subdir),elf) +diff --git a/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c b/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c +new file mode 100644 +index 0000000000..d460d6e766 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c +@@ -0,0 +1,241 @@ ++/* Verify that getcwd returns ERANGE for size 1 byte and does not underflow ++ buffer when the CWD is too long and is also a mount target of /. See bug ++ #28769 or CVE-2021-3999 for more context. ++ Copyright The GNU Toolchain Authors. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static char *base; ++#define BASENAME "tst-getcwd-smallbuff" ++#define MOUNT_NAME "mpoint" ++static int sockfd[2]; ++ ++static void ++do_cleanup (void) ++{ ++ support_chdir_toolong_temp_directory (base); ++ TEST_VERIFY_EXIT (rmdir (MOUNT_NAME) == 0); ++ free (base); ++} ++ ++static void ++send_fd (const int sock, const int fd) ++{ ++ struct msghdr msg = {0}; ++ union ++ { ++ struct cmsghdr hdr; ++ char buf[CMSG_SPACE (sizeof (int))]; ++ } cmsgbuf = {0}; ++ struct cmsghdr *cmsg; ++ struct iovec vec; ++ char ch = 'A'; ++ ssize_t n; ++ ++ msg.msg_control = &cmsgbuf.buf; ++ msg.msg_controllen = sizeof (cmsgbuf.buf); ++ ++ cmsg = CMSG_FIRSTHDR (&msg); ++ cmsg->cmsg_len = CMSG_LEN (sizeof (int)); ++ cmsg->cmsg_level = SOL_SOCKET; ++ cmsg->cmsg_type = SCM_RIGHTS; ++ memcpy (CMSG_DATA (cmsg), &fd, sizeof (fd)); ++ ++ vec.iov_base = &ch; ++ vec.iov_len = 1; ++ msg.msg_iov = &vec; ++ msg.msg_iovlen = 1; ++ ++ while ((n = sendmsg (sock, &msg, 0)) == -1 && errno == EINTR); ++ ++ TEST_VERIFY_EXIT (n == 1); ++} ++ ++static int ++recv_fd (const int sock) ++{ ++ struct msghdr msg = {0}; ++ union ++ { ++ struct cmsghdr hdr; ++ char buf[CMSG_SPACE(sizeof(int))]; ++ } cmsgbuf = {0}; ++ struct cmsghdr *cmsg; ++ struct iovec vec; ++ ssize_t n; ++ char ch = '\0'; ++ int fd = -1; ++ ++ vec.iov_base = &ch; ++ vec.iov_len = 1; ++ msg.msg_iov = &vec; ++ msg.msg_iovlen = 1; ++ ++ msg.msg_control = &cmsgbuf.buf; ++ msg.msg_controllen = sizeof (cmsgbuf.buf); ++ ++ while ((n = recvmsg (sock, &msg, 0)) == -1 && errno == EINTR); ++ if (n != 1 || ch != 'A') ++ return -1; ++ ++ cmsg = CMSG_FIRSTHDR (&msg); ++ if (cmsg == NULL) ++ return -1; ++ if (cmsg->cmsg_type != SCM_RIGHTS) ++ return -1; ++ memcpy (&fd, CMSG_DATA (cmsg), sizeof (fd)); ++ if (fd < 0) ++ return -1; ++ return fd; ++} ++ ++static int ++child_func (void * const arg) ++{ ++ xclose (sockfd[0]); ++ const int sock = sockfd[1]; ++ char ch; ++ ++ TEST_VERIFY_EXIT (read (sock, &ch, 1) == 1); ++ TEST_VERIFY_EXIT (ch == '1'); ++ ++ if (mount ("/", MOUNT_NAME, NULL, MS_BIND | MS_REC, NULL)) ++ FAIL_EXIT1 ("mount failed: %m\n"); ++ const int fd = xopen ("mpoint", ++ O_RDONLY | O_PATH | O_DIRECTORY | O_NOFOLLOW, 0); ++ ++ send_fd (sock, fd); ++ xclose (fd); ++ ++ TEST_VERIFY_EXIT (read (sock, &ch, 1) == 1); ++ TEST_VERIFY_EXIT (ch == 'a'); ++ ++ xclose (sock); ++ return 0; ++} ++ ++static void ++update_map (char * const mapping, const char * const map_file) ++{ ++ const size_t map_len = strlen (mapping); ++ ++ const int fd = xopen (map_file, O_WRONLY, 0); ++ xwrite (fd, mapping, map_len); ++ xclose (fd); ++} ++ ++static void ++proc_setgroups_write (const long child_pid, const char * const str) ++{ ++ const size_t str_len = strlen(str); ++ ++ char setgroups_path[sizeof ("/proc//setgroups") + INT_STRLEN_BOUND (long)]; ++ ++ snprintf (setgroups_path, sizeof (setgroups_path), ++ "/proc/%ld/setgroups", child_pid); ++ ++ const int fd = open (setgroups_path, O_WRONLY); ++ ++ if (fd < 0) ++ { ++ TEST_VERIFY_EXIT (errno == ENOENT); ++ FAIL_UNSUPPORTED ("/proc/%ld/setgroups not found\n", child_pid); ++ } ++ ++ xwrite (fd, str, str_len); ++ xclose(fd); ++} ++ ++static char child_stack[1024 * 1024]; ++ ++int ++do_test (void) ++{ ++ base = support_create_and_chdir_toolong_temp_directory (BASENAME); ++ ++ xmkdir (MOUNT_NAME, S_IRWXU); ++ atexit (do_cleanup); ++ ++ TEST_VERIFY_EXIT (socketpair (AF_UNIX, SOCK_STREAM, 0, sockfd) == 0); ++ pid_t child_pid = xclone (child_func, NULL, child_stack, ++ sizeof (child_stack), ++ CLONE_NEWUSER | CLONE_NEWNS | SIGCHLD); ++ ++ xclose (sockfd[1]); ++ const int sock = sockfd[0]; ++ ++ char map_path[sizeof ("/proc//uid_map") + INT_STRLEN_BOUND (long)]; ++ char map_buf[sizeof ("0 1") + INT_STRLEN_BOUND (long)]; ++ ++ snprintf (map_path, sizeof (map_path), "/proc/%ld/uid_map", ++ (long) child_pid); ++ snprintf (map_buf, sizeof (map_buf), "0 %ld 1", (long) getuid()); ++ update_map (map_buf, map_path); ++ ++ proc_setgroups_write ((long) child_pid, "deny"); ++ snprintf (map_path, sizeof (map_path), "/proc/%ld/gid_map", ++ (long) child_pid); ++ snprintf (map_buf, sizeof (map_buf), "0 %ld 1", (long) getgid()); ++ update_map (map_buf, map_path); ++ ++ TEST_VERIFY_EXIT (send (sock, "1", 1, MSG_NOSIGNAL) == 1); ++ const int fd = recv_fd (sock); ++ TEST_VERIFY_EXIT (fd >= 0); ++ TEST_VERIFY_EXIT (fchdir (fd) == 0); ++ ++ static char buf[2 * 10 + 1]; ++ memset (buf, 'A', sizeof (buf)); ++ ++ /* Finally, call getcwd and check if it resulted in a buffer underflow. */ ++ char * cwd = getcwd (buf + sizeof (buf) / 2, 1); ++ TEST_VERIFY (cwd == NULL); ++ TEST_VERIFY (errno == ERANGE); ++ ++ for (int i = 0; i < sizeof (buf); i++) ++ if (buf[i] != 'A') ++ { ++ printf ("buf[%d] = %02x\n", i, (unsigned int) buf[i]); ++ support_record_failure (); ++ } ++ ++ TEST_VERIFY_EXIT (send (sock, "a", 1, MSG_NOSIGNAL) == 1); ++ xclose (sock); ++ TEST_VERIFY_EXIT (xwaitpid (child_pid, NULL, 0) == child_pid); ++ ++ return 0; ++} ++ ++#define CLEANUP_HANDLER do_cleanup ++#include diff --git a/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch b/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch new file mode 100644 index 0000000..00fb326 --- /dev/null +++ b/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch @@ -0,0 +1,126 @@ +From f545ad4928fa1f27a3075265182b38a4f939a5f7 Mon Sep 17 00:00:00 2001 +From: Florian Weimer +Date: Mon, 17 Jan 2022 10:21:34 +0100 +Subject: [PATCH] CVE-2022-23218: Buffer overflow in sunrpc svcunix_create (bug + 28768) + +The sunrpc function svcunix_create suffers from a stack-based buffer +overflow with overlong pathname arguments. + +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=f545ad4928fa1f27a3075265182b38a4f939a5f7] +CVE: CVE-2022-23218 + +Reviewed-by: Siddhesh Poyarekar +Signed-off-by: Pgowda +--- + NEWS | 3 +++ + sunrpc/Makefile | 2 +- + sunrpc/svc_unix.c | 11 ++++------- + sunrpc/tst-bug28768.c | 42 ++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 50 insertions(+), 8 deletions(-) + create mode 100644 sunrpc/tst-bug28768.c + +diff --git a/NEWS b/NEWS +index 38a9ddb2cf..38802f0673 100644 +--- a/NEWS ++++ b/NEWS +@@ -203,6 +203,9 @@ Security related changes: + parameter number when processing the expansion resulting in a crash. + Reported by Philippe Antoine. + ++ CVE-2022-23218: Passing an overlong file name to the svcunix_create ++ legacy function could result in a stack-based buffer overflow. ++ + The following bugs are resolved with this release: + + [4737] libc: fork is not async-signal-safe +diff --git a/sunrpc/Makefile b/sunrpc/Makefile +index 183ef3dc55..a79a7195fc 100644 +--- a/sunrpc/Makefile ++++ b/sunrpc/Makefile +@@ -65,7 +65,7 @@ shared-only-routines = $(routines) + endif + + tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error tst-udp-timeout \ +- tst-udp-nonblocking ++ tst-udp-nonblocking tst-bug28768 + xtests := tst-getmyaddr + + ifeq ($(have-thread-library),yes) +diff --git a/sunrpc/svc_unix.c b/sunrpc/svc_unix.c +index f2280b4c49..67177a2e78 100644 +--- a/sunrpc/svc_unix.c ++++ b/sunrpc/svc_unix.c +@@ -154,7 +154,10 @@ svcunix_create (int sock, u_int sendsize + SVCXPRT *xprt; + struct unix_rendezvous *r; + struct sockaddr_un addr; +- socklen_t len = sizeof (struct sockaddr_in); ++ socklen_t len = sizeof (addr); ++ ++ if (__sockaddr_un_set (&addr, path) < 0) ++ return NULL; + + if (sock == RPC_ANYSOCK) + { +@@ -165,12 +168,6 @@ svcunix_create (int sock, u_int sendsize + } + madesock = TRUE; + } +- memset (&addr, '\0', sizeof (addr)); +- addr.sun_family = AF_UNIX; +- len = strlen (path) + 1; +- memcpy (addr.sun_path, path, len); +- len += sizeof (addr.sun_family); +- + __bind (sock, (struct sockaddr *) &addr, len); + + if (__getsockname (sock, (struct sockaddr *) &addr, &len) != 0 +diff --git a/sunrpc/tst-bug28768.c b/sunrpc/tst-bug28768.c +new file mode 100644 +index 0000000000..35a4b7b0b3 +--- /dev/null ++++ b/sunrpc/tst-bug28768.c +@@ -0,0 +1,42 @@ ++/* Test to verify that long path is rejected by svcunix_create (bug 28768). ++ Copyright (C) 2022 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++/* svcunix_create does not have a default version in linkobj/libc.so. */ ++compat_symbol_reference (libc, svcunix_create, svcunix_create, GLIBC_2_1); ++ ++static int ++do_test (void) ++{ ++ char pathname[109]; ++ memset (pathname, 'x', sizeof (pathname)); ++ pathname[sizeof (pathname) - 1] = '\0'; ++ ++ errno = 0; ++ TEST_VERIFY (svcunix_create (RPC_ANYSOCK, 4096, 4096, pathname) == NULL); ++ TEST_COMPARE (errno, EINVAL); ++ ++ return 0; ++} ++ ++#include diff --git a/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch b/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch new file mode 100644 index 0000000..6779e9a --- /dev/null +++ b/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch @@ -0,0 +1,89 @@ +From ef972a4c50014a16132b5c75571cfb6b30bef136 Mon Sep 17 00:00:00 2001 +From: Martin Sebor +Date: Mon, 17 Jan 2022 10:21:34 +0100 +Subject: [PATCH] sunrpc: Test case for clnt_create "unix" buffer overflow (bug + 22542) + +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=ef972a4c50014a16132b5c75571cfb6b30bef136] +CVE: CVE-2022-23219 + +Reviewed-by: Siddhesh Poyarekar +Signed-off-by: Pgowda +--- + sunrpc/Makefile | 5 ++++- + sunrpc/tst-bug22542.c | 44 +++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 48 insertions(+), 1 deletion(-) + create mode 100644 sunrpc/tst-bug22542.c + +diff --git a/sunrpc/Makefile b/sunrpc/Makefile +index 9a31fe48b9..183ef3dc55 100644 +--- a/sunrpc/Makefile ++++ b/sunrpc/Makefile +@@ -65,7 +65,7 @@ shared-only-routines = $(routines) + endif + + tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error tst-udp-timeout \ +- tst-udp-nonblocking tst-bug28768 ++ tst-udp-nonblocking tst-bug22542 tst-bug28768 + xtests := tst-getmyaddr + + ifeq ($(have-thread-library),yes) +@@ -110,6 +110,8 @@ $(objpfx)tst-udp-nonblocking: $(common-o + $(objpfx)tst-udp-garbage: \ + $(common-objpfx)linkobj/libc.so $(shared-thread-library) + ++$(objpfx)tst-bug22542: $(common-objpfx)linkobj/libc.so ++ + else # !have-GLIBC_2.31 + + routines = $(routines-for-nss) +diff --git a/sunrpc/tst-bug22542.c b/sunrpc/tst-bug22542.c +new file mode 100644 +index 0000000000..d6cd79787b +--- /dev/null ++++ b/sunrpc/tst-bug22542.c +@@ -0,0 +1,44 @@ ++/* Test to verify that overlong hostname is rejected by clnt_create ++ and doesn't cause a buffer overflow (bug 22542). ++ ++ Copyright (C) 2022 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static int ++do_test (void) ++{ ++ /* Create an arbitrary hostname that's longer than fits in sun_path. */ ++ char name [sizeof ((struct sockaddr_un*)0)->sun_path * 2]; ++ memset (name, 'x', sizeof name - 1); ++ name [sizeof name - 1] = '\0'; ++ ++ errno = 0; ++ CLIENT *clnt = clnt_create (name, 0, 0, "unix"); ++ ++ TEST_VERIFY (clnt == NULL); ++ TEST_COMPARE (errno, EINVAL); ++ return 0; ++} ++ ++#include diff --git a/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch b/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch new file mode 100644 index 0000000..2445aa5 --- /dev/null +++ b/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch @@ -0,0 +1,238 @@ +From d7bb36a9a27e5e4c3be6378493b41286513750e9 Mon Sep 17 00:00:00 2001 +From: Jason Wessel +Date: Sat, 7 Dec 2019 10:01:37 -0800 +Subject: [PATCH] localedef: fix-ups hardlink to make it compile + +Upstream-Status: Pending +Signed-off-by: Jason Wessel +Signed-off-by: Khem Raj +--- + locale/programs/c.h | 2 +- + locale/programs/cross-localedef-hardlink.c | 79 +++++++++++----------- + 2 files changed, 39 insertions(+), 42 deletions(-) + +diff --git a/locale/programs/c.h b/locale/programs/c.h +index d0a402e90e..1804d31c73 100644 +--- a/locale/programs/c.h ++++ b/locale/programs/c.h +@@ -240,7 +240,7 @@ errmsg(char doexit, int excode, char adderr, const char *fmt, ...) + /* Don't use inline function to avoid '#include "nls.h"' in c.h + */ + #define errtryhelp(eval) __extension__ ({ \ +- fprintf(stderr, _("Try '%s --help' for more information.\n"), \ ++ fprintf(stderr, ("Try '%s --help' for more information.\n"), \ + program_invocation_short_name); \ + exit(eval); \ + }) +diff --git a/locale/programs/cross-localedef-hardlink.c b/locale/programs/cross-localedef-hardlink.c +index 63615896b0..726e6dd948 100644 +--- a/locale/programs/cross-localedef-hardlink.c ++++ b/locale/programs/cross-localedef-hardlink.c +@@ -20,6 +20,8 @@ + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ ++ ++#undef HAVE_PCRE + #include + #include + #include +@@ -38,8 +40,8 @@ + + #include "c.h" + #include "xalloc.h" +-#include "nls.h" +-#include "closestream.h" ++//#include "nls.h" ++//#include "closestream.h" + + #define NHASH (1<<17) /* Must be a power of 2! */ + #define NBUF 64 +@@ -124,33 +126,33 @@ static void print_summary(void) + if (ctl->verbose > 1 && ctl->nlinks) + fputc('\n', stdout); + +- printf(_("Directories: %9lld\n"), ctl->ndirs); +- printf(_("Objects: %9lld\n"), ctl->nobjects); +- printf(_("Regular files: %9lld\n"), ctl->nregfiles); +- printf(_("Comparisons: %9lld\n"), ctl->ncomp); ++ printf(("Directories: %9lld\n"), ctl->ndirs); ++ printf(("Objects: %9lld\n"), ctl->nobjects); ++ printf(("Regular files: %9lld\n"), ctl->nregfiles); ++ printf(("Comparisons: %9lld\n"), ctl->ncomp); + printf( "%s%9lld\n", (ctl->no_link ? +- _("Would link: ") : +- _("Linked: ")), ctl->nlinks); ++ ("Would link: ") : ++ ("Linked: ")), ctl->nlinks); + printf( "%s %9lld\n", (ctl->no_link ? +- _("Would save: ") : +- _("Saved: ")), ctl->nsaved); ++ ("Would save: ") : ++ ("Saved: ")), ctl->nsaved); + } + + static void __attribute__((__noreturn__)) usage(void) + { + fputs(USAGE_HEADER, stdout); +- printf(_(" %s [options] directory...\n"), program_invocation_short_name); ++ printf((" %s [options] directory...\n"), program_invocation_short_name); + + fputs(USAGE_SEPARATOR, stdout); +- puts(_("Consolidate duplicate files using hardlinks.")); ++ puts(("Consolidate duplicate files using hardlinks.")); + + fputs(USAGE_OPTIONS, stdout); +- puts(_(" -c, --content compare only contents, ignore permission, etc.")); +- puts(_(" -n, --dry-run don't actually link anything")); +- puts(_(" -v, --verbose print summary after hardlinking")); +- puts(_(" -vv print every hardlinked file and summary")); +- puts(_(" -f, --force force hardlinking across filesystems")); +- puts(_(" -x, --exclude exclude files matching pattern")); ++ puts((" -c, --content compare only contents, ignore permission, etc.")); ++ puts((" -n, --dry-run don't actually link anything")); ++ puts((" -v, --verbose print summary after hardlinking")); ++ puts((" -vv print every hardlinked file and summary")); ++ puts((" -f, --force force hardlinking across filesystems")); ++ puts((" -x, --exclude exclude files matching pattern")); + + fputs(USAGE_SEPARATOR, stdout); + printf(USAGE_HELP_OPTIONS(16)); /* char offset to align option descriptions */ +@@ -164,7 +166,7 @@ static inline size_t add2(size_t a, size_t b) + size_t sum = a + b; + + if (sum < a) +- errx(EXIT_FAILURE, _("integer overflow")); ++ errx(EXIT_FAILURE, ("integer overflow")); + return sum; + } + +@@ -193,7 +195,7 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) + if (st.st_dev != ctl->dev && !ctl->force) { + if (ctl->dev) + errx(EXIT_FAILURE, +- _("%s is on different filesystem than the rest " ++ ("%s is on different filesystem than the rest " + "(use -f option to override)."), name); + ctl->dev = st.st_dev; + } +@@ -287,9 +289,9 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) + (ssize_t) sizeof(ctl->iobuf1) : fsize; + + if ((xsz = read(fd, ctl->iobuf1, rsize)) != rsize) +- warn(_("cannot read %s"), name); ++ warn(("cannot read %s"), name); + else if ((xsz = read(fd2, ctl->iobuf2, rsize)) != rsize) +- warn(_("cannot read %s"), fp2->name); ++ warn(("cannot read %s"), fp2->name); + + if (xsz != rsize) { + close(fd); +@@ -303,13 +305,13 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) + if (fsize > 0) + continue; + if (lstat(name, &st3)) { +- warn(_("cannot stat %s"), name); ++ warn(("cannot stat %s"), name); + close(fd); + return; + } + st3.st_atime = st.st_atime; + if (stcmp(&st, &st3, 0)) { +- warnx(_("file %s changed underneath us"), name); ++ warnx(("file %s changed underneath us"), name); + close(fd); + return; + } +@@ -329,18 +331,18 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) + suffixlen + 1); + /* First create a temporary link to n1 under a new name */ + if (link(n1, nam2.buf)) { +- warn(_("failed to hardlink %s to %s (create temporary link as %s failed)"), ++ warn(("failed to hardlink %s to %s (create temporary link as %s failed)"), + n1, n2, nam2.buf); + free(nam2.buf); + continue; + } + /* Then rename into place over the existing n2 */ + if (rename(nam2.buf, n2)) { +- warn(_("failed to hardlink %s to %s (rename temporary link to %s failed)"), ++ warn(("failed to hardlink %s to %s (rename temporary link to %s failed)"), + n1, n2, n2); + /* Something went wrong, try to remove the now redundant temporary link */ + if (unlink(nam2.buf)) +- warn(_("failed to remove temporary link %s"), nam2.buf); ++ warn(("failed to remove temporary link %s"), nam2.buf); + free(nam2.buf); + continue; + } +@@ -351,16 +353,16 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) + /* We actually did not save anything this time, since the link second argument + had some other links as well. */ + if (ctl->verbose > 1) +- printf(_(" %s %s to %s\n"), +- (ctl->no_link ? _("Would link") : _("Linked")), ++ printf((" %s %s to %s\n"), ++ (ctl->no_link ? ("Would link") : ("Linked")), + n1, n2); + } else { + ctl->nsaved += ((st.st_size + 4095) / 4096) * 4096; + if (ctl->verbose > 1) +- printf(_(" %s %s to %s, %s %jd\n"), +- (ctl->no_link ? _("Would link") : _("Linked")), ++ printf((" %s %s to %s, %s %jd\n"), ++ (ctl->no_link ? ("Would link") : ("Linked")), + n1, n2, +- (ctl->no_link ? _("would save") : _("saved")), ++ (ctl->no_link ? ("would save") : ("saved")), + (intmax_t)st.st_size); + } + close(fd); +@@ -410,11 +412,6 @@ int main(int argc, char **argv) + { NULL, 0, NULL, 0 }, + }; + +- setlocale(LC_ALL, ""); +- bindtextdomain(PACKAGE, LOCALEDIR); +- textdomain(PACKAGE); +- close_stdout_atexit(); +- + while ((ch = getopt_long(argc, argv, "cnvfx:Vh", longopts, NULL)) != -1) { + switch (ch) { + case 'n': +@@ -434,7 +431,7 @@ int main(int argc, char **argv) + exclude_pattern = (PCRE2_SPTR) optarg; + #else + errx(EXIT_FAILURE, +- _("option --exclude not supported (built without pcre2)")); ++ ("option --exclude not supported (built without pcre2)")); + #endif + break; + case 'V': +@@ -447,7 +444,7 @@ int main(int argc, char **argv) + } + + if (optind == argc) { +- warnx(_("no directory specified")); ++ warnx(("no directory specified")); + errtryhelp(EXIT_FAILURE); + } + +@@ -461,7 +458,7 @@ int main(int argc, char **argv) + PCRE2_UCHAR buffer[256]; + pcre2_get_error_message(errornumber, buffer, + sizeof(buffer)); +- errx(EXIT_FAILURE, _("pattern error at offset %d: %s"), ++ errx(EXIT_FAILURE, ("pattern error at offset %d: %s"), + (int)erroroffset, buffer); + } + match_data = pcre2_match_data_create_from_pattern(re, NULL); +@@ -506,7 +503,7 @@ int main(int argc, char **argv) + >=0) { + if (ctl->verbose) { + nam1.buf[nam1baselen] = 0; +- printf(_("Skipping %s%s\n"), nam1.buf, di->d_name); ++ printf(("Skipping %s%s\n"), nam1.buf, di->d_name); + } + continue; + } diff --git a/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch b/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch new file mode 100644 index 0000000..210cc10 --- /dev/null +++ b/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch @@ -0,0 +1,65 @@ +From 776a53db6afba8a7ff4412aba88b0679227877f9 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 01:48:24 +0000 +Subject: [PATCH] nativesdk-glibc: Look for host system ld.so.cache as well + +Upstream-Status: Inappropriate [embedded specific] + +The default lib search path order is: + + 1) LD_LIBRARY_PATH + 2) RPATH from the binary + 3) ld.so.cache + 4) default search paths embedded in the linker + +For nativesdk binaries which are being used alongside binaries on a host system, we +need the search paths to firstly search the shipped nativesdk libs but then also +cover the host system. For example we want the host system's libGL and this may be +in a non-standard location like /usr/lib/mesa. The only place the location is know +about is in the ld.so.cache of the host system. + +Since nativesdk has a simple structure and doesn't need to use a cache itself, we +repurpose the cache for use as a last resort in finding host system binaries. This +means we need to switch the order of 3 and 4 above to make this work effectively. + +RP 14/10/2010 + +Signed-off-by: Khem Raj +--- + elf/dl-load.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/elf/dl-load.c b/elf/dl-load.c +index a08df001af..d09daf9e41 100644 +--- a/elf/dl-load.c ++++ b/elf/dl-load.c +@@ -2196,6 +2196,14 @@ _dl_map_object (struct link_map *loader, const char *name, + } + } + ++ /* try the default path. */ ++ if (fd == -1 ++ && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL ++ || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1)) ++ && __rtld_search_dirs.dirs != (void *) -1) ++ fd = open_path (name, namelen, mode & __RTLD_SECURE, &__rtld_search_dirs, ++ &realname, &fb, l, LA_SER_DEFAULT, &found_other_class); ++ /* Finally try ld.so.cache */ + #ifdef USE_LDCONFIG + if (fd == -1 + && (__glibc_likely ((mode & __RTLD_SECURE) == 0) +@@ -2254,14 +2262,6 @@ _dl_map_object (struct link_map *loader, const char *name, + } + #endif + +- /* Finally, try the default path. */ +- if (fd == -1 +- && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL +- || __glibc_likely (!(l->l_flags_1 & DF_1_NODEFLIB))) +- && __rtld_search_dirs.dirs != (void *) -1) +- fd = open_path (name, namelen, mode, &__rtld_search_dirs, +- &realname, &fb, l, LA_SER_DEFAULT, &found_other_class); +- + /* Add another newline when we are tracing the library loading. */ + if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS)) + _dl_debug_printf ("\n"); diff --git a/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch b/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch new file mode 100644 index 0000000..010b816 --- /dev/null +++ b/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch @@ -0,0 +1,46 @@ +From df18bae1eeee55ecb9db36d13fe67c58355682eb Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 01:50:00 +0000 +Subject: [PATCH] nativesdk-glibc: Fix buffer overrun with a relocated SDK + +When ld-linux-*.so.2 is relocated to a path that is longer than the +original fixed location, the dynamic loader will crash in open_path +because it implicitly assumes that max_dirnamelen is a fixed size that +never changes. + +The allocated buffer will not be large enough to contain the directory +path string which is larger than the fixed location provided at build +time. + +Upstream-Status: Inappropriate [OE SDK specific] + +Signed-off-by: Jason Wessel +Signed-off-by: Khem Raj +--- + elf/dl-load.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/elf/dl-load.c b/elf/dl-load.c +index d09daf9e41..2c6270e2a7 100644 +--- a/elf/dl-load.c ++++ b/elf/dl-load.c +@@ -1892,7 +1892,19 @@ open_path (const char *name, size_t namelen, int mode, + given on the command line when rtld is run directly. */ + return -1; + ++ do ++ { ++ struct r_search_path_elem *this_dir = *dirs; ++ if (this_dir->dirnamelen > max_dirnamelen) ++ { ++ max_dirnamelen = this_dir->dirnamelen; ++ } ++ } ++ while (*++dirs != NULL); ++ + buf = alloca (max_dirnamelen + max_capstrlen + namelen); ++ ++ dirs = sps->dirs; + do + { + struct r_search_path_elem *this_dir = *dirs; diff --git a/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch b/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch new file mode 100644 index 0000000..bf9f3e3 --- /dev/null +++ b/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch @@ -0,0 +1,153 @@ +From 6af8ce8eceed86addbc188f773a2d36d83ee4042 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 01:51:38 +0000 +Subject: [PATCH] nativesdk-glibc: Raise the size of arrays containing dl paths + +This patch puts the dynamic loader path in the binaries, SYSTEM_DIRS strings +and lengths as well as ld.so.cache path in the dynamic loader to specific +sections in memory. The sections that contain paths have been allocated a 4096 +byte section, which is the maximum path length in linux. This will allow the +relocating script to parse the ELF binary, detect the section and easily replace +the strings in a certain path. + +Upstream-Status: Inappropriate [SDK specific] + +Signed-off-by: Laurentiu Palcu +Signed-off-by: Khem Raj +--- + elf/dl-cache.c | 4 ++++ + elf/dl-load.c | 4 ++-- + elf/dl-usage.c | 6 ++++-- + elf/interp.c | 2 +- + elf/ldconfig.c | 3 +++ + elf/rtld.c | 1 + + iconv/gconv_conf.c | 2 +- + sysdeps/generic/dl-cache.h | 4 ---- + 8 files changed, 16 insertions(+), 10 deletions(-) + +diff --git a/elf/dl-cache.c b/elf/dl-cache.c +index 2b8da8650d..3d9787bda4 100644 +--- a/elf/dl-cache.c ++++ b/elf/dl-cache.c +@@ -355,6 +355,10 @@ search_cache (const char *string_table, uint32_t string_table_size, + return best; + } + ++const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache"))) = ++ SYSCONFDIR "/ld.so.cache"; ++ ++ + int + _dl_cache_libcmp (const char *p1, const char *p2) + { +diff --git a/elf/dl-load.c b/elf/dl-load.c +index 2c6270e2a7..23018d2f7e 100644 +--- a/elf/dl-load.c ++++ b/elf/dl-load.c +@@ -115,8 +115,8 @@ enum { ncapstr = 1, max_capstrlen = 0 }; + gen-trusted-dirs.awk. */ + #include "trusted-dirs.h" + +-static const char system_dirs[] = SYSTEM_DIRS; +-static const size_t system_dirs_len[] = ++static const char system_dirs[4096] __attribute__ ((section (".sysdirs"))) = SYSTEM_DIRS; ++volatile static const size_t system_dirs_len[] __attribute__ ((section (".sysdirslen"))) = + { + SYSTEM_DIRS_LEN + }; +diff --git a/elf/dl-usage.c b/elf/dl-usage.c +index 5ad3a72559..88f26d3692 100644 +--- a/elf/dl-usage.c ++++ b/elf/dl-usage.c +@@ -25,6 +25,8 @@ + #include + #include + ++extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache"))); ++ + void + _dl_usage (const char *argv0, const char *wrong_option) + { +@@ -244,7 +246,7 @@ setting environment variables (which would be inherited by subprocesses).\n\ + --list list all dependencies and how they are resolved\n\ + --verify verify that given object really is a dynamically linked\n\ + object we can handle\n\ +- --inhibit-cache Do not use " LD_SO_CACHE "\n\ ++ --inhibit-cache Do not use %s\n\ + --library-path PATH use given PATH instead of content of the environment\n\ + variable LD_LIBRARY_PATH\n\ + --glibc-hwcaps-prepend LIST\n\ +@@ -267,7 +269,7 @@ setting environment variables (which would be inherited by subprocesses).\n\ + \n\ + This program interpreter self-identifies as: " RTLD "\n\ + ", +- argv0); ++ argv0, LD_SO_CACHE); + print_search_path_for_help (state); + print_hwcaps_subdirectories (state); + print_legacy_hwcap_directories (); +diff --git a/elf/interp.c b/elf/interp.c +index 91966702ca..dc86c20e83 100644 +--- a/elf/interp.c ++++ b/elf/interp.c +@@ -18,5 +18,5 @@ + + #include + +-const char __invoke_dynamic_linker__[] __attribute__ ((section (".interp"))) ++const char __invoke_dynamic_linker__[4096] __attribute__ ((section (".interp"))) + = RUNTIME_LINKER; +diff --git a/elf/ldconfig.c b/elf/ldconfig.c +index 1037e8d0cf..ffdac84952 100644 +--- a/elf/ldconfig.c ++++ b/elf/ldconfig.c +@@ -177,6 +177,9 @@ static struct argp argp = + options, parse_opt, NULL, doc, NULL, more_help, NULL + }; + ++ ++extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache"))); ++ + /* Check if string corresponds to an important hardware capability or + a platform. */ + static int +diff --git a/elf/rtld.c b/elf/rtld.c +index fbbd60b446..fce9940f80 100644 +--- a/elf/rtld.c ++++ b/elf/rtld.c +@@ -185,6 +185,7 @@ dso_name_valid_for_suid (const char *p) + } + return *p != '\0'; + } ++extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache"))); + + static void + audit_list_init (struct audit_list *list) +diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c +index 62bee28769..67b60dc88c 100644 +--- a/iconv/gconv_conf.c ++++ b/iconv/gconv_conf.c +@@ -36,7 +36,7 @@ + #include + + /* This is the default path where we look for module lists. */ +-static const char default_gconv_path[] = GCONV_PATH; ++static char default_gconv_path[4096] __attribute__ ((section (".gccrelocprefix"))) = GCONV_PATH; + + /* Type to represent search path. */ + struct path_elem +diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h +index 964d50a486..94bf68ca9d 100644 +--- a/sysdeps/generic/dl-cache.h ++++ b/sysdeps/generic/dl-cache.h +@@ -34,10 +34,6 @@ + ((flags) == 1 || (flags) == _DL_CACHE_DEFAULT_ID) + #endif + +-#ifndef LD_SO_CACHE +-# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache" +-#endif +- + #ifndef add_system_dir + # define add_system_dir(dir) add_dir (dir) + #endif diff --git a/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch b/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch new file mode 100644 index 0000000..3a37f7a --- /dev/null +++ b/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch @@ -0,0 +1,39 @@ +From b30f380cd88ae181a4a6a3a4784206ffe3ccd19b Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 31 Dec 2015 14:35:35 -0800 +Subject: [PATCH] nativesdk-glibc: Allow 64 bit atomics for x86 + +The fix consist of allowing 64bit atomic ops for x86. +This should be safe for i586 and newer CPUs. +It also makes the synchronization more efficient. + +Upstream-Status: Inappropriate [OE-Specific] + +Signed-off-by: Juro Bystricky +Signed-off-by: Richard Purdie +Signed-off-by: Khem Raj +--- + sysdeps/x86/atomic-machine.h | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h +index 695222e4fa..9d39bfdbd5 100644 +--- a/sysdeps/x86/atomic-machine.h ++++ b/sysdeps/x86/atomic-machine.h +@@ -52,15 +52,14 @@ typedef uintmax_t uatomic_max_t; + #define LOCK_PREFIX "lock;" + + #define USE_ATOMIC_COMPILER_BUILTINS 1 ++# define __HAVE_64B_ATOMICS 1 + + #ifdef __x86_64__ +-# define __HAVE_64B_ATOMICS 1 + # define SP_REG "rsp" + # define SEG_REG "fs" + # define BR_CONSTRAINT "q" + # define IBR_CONSTRAINT "iq" + #else +-# define __HAVE_64B_ATOMICS 0 + # define SP_REG "esp" + # define SEG_REG "gs" + # define BR_CONSTRAINT "r" diff --git a/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch b/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch new file mode 100644 index 0000000..d763178 --- /dev/null +++ b/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch @@ -0,0 +1,100 @@ +From 24bffe9c2645cd6542e29cb57786dc703cced07b Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 3 Aug 2018 09:55:12 -0700 +Subject: [PATCH] nativesdk-glibc: Make relocatable install for locales + +The glibc locale path is hard-coded to the install prefix, but in SDKs we need +to be able to relocate the binaries. Expand the strings to 4K and put them in a +magic segment that we can relocate at install time. + +Upstream-Status: Inappropriate (OE-specific) + +Signed-off-by: Ross Burton +Signed-off-by: Khem Raj +--- + locale/findlocale.c | 4 ++-- + locale/loadarchive.c | 2 +- + locale/localeinfo.h | 2 +- + locale/programs/locale.c | 7 ++++--- + 4 files changed, 8 insertions(+), 7 deletions(-) + +diff --git a/locale/findlocale.c b/locale/findlocale.c +index ab09122b0c..f42cc75780 100644 +--- a/locale/findlocale.c ++++ b/locale/findlocale.c +@@ -56,7 +56,7 @@ struct __locale_data *const _nl_C[] attribute_hidden = + which are somehow addressed. */ + struct loaded_l10nfile *_nl_locale_file_list[__LC_LAST]; + +-const char _nl_default_locale_path[] attribute_hidden = COMPLOCALEDIR; ++char _nl_default_locale_path[4096] attribute_hidden __attribute__ ((section (".gccrelocprefix"))) = COMPLOCALEDIR; + + /* Checks if the name is actually present, that is, not NULL and not + empty. */ +@@ -166,7 +166,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len, + + /* Nothing in the archive. Set the default path to search below. */ + locale_path = _nl_default_locale_path; +- locale_path_len = sizeof _nl_default_locale_path; ++ locale_path_len = strlen(locale_path) + 1; + } + else + /* We really have to load some data. First see whether the name is +diff --git a/locale/loadarchive.c b/locale/loadarchive.c +index 512769eaec..436619091b 100644 +--- a/locale/loadarchive.c ++++ b/locale/loadarchive.c +@@ -42,7 +42,7 @@ + + + /* Name of the locale archive file. */ +-static const char archfname[] = COMPLOCALEDIR "/locale-archive"; ++static const char archfname[4096] __attribute__ ((section (".gccrelocprefix"))) = COMPLOCALEDIR "/locale-archive"; + + /* Size of initial mapping window, optimal if large enough to + cover the header plus the initial locale. */ +diff --git a/locale/localeinfo.h b/locale/localeinfo.h +index b3d4da0185..22f9dc1140 100644 +--- a/locale/localeinfo.h ++++ b/locale/localeinfo.h +@@ -331,7 +331,7 @@ _nl_lookup_word (locale_t l, int category, int item) + } + + /* Default search path if no LOCPATH environment variable. */ +-extern const char _nl_default_locale_path[] attribute_hidden; ++extern char _nl_default_locale_path[4096] attribute_hidden; + + /* Load the locale data for CATEGORY from the file specified by *NAME. + If *NAME is "", use environment variables as specified by POSIX, and +diff --git a/locale/programs/locale.c b/locale/programs/locale.c +index ca0a95be99..6b98895203 100644 +--- a/locale/programs/locale.c ++++ b/locale/programs/locale.c +@@ -632,6 +632,7 @@ nameentcmp (const void *a, const void *b) + ((const struct nameent *) b)->name); + } + ++static char _write_archive_locales_path[4096] attribute_hidden __attribute__ ((section (".gccrelocprefix"))) = ARCHIVE_NAME; + + static int + write_archive_locales (void **all_datap, char *linebuf) +@@ -645,7 +646,7 @@ write_archive_locales (void **all_datap, char *linebuf) + int fd, ret = 0; + uint32_t cnt; + +- fd = open64 (ARCHIVE_NAME, O_RDONLY); ++ fd = open64 (_write_archive_locales_path, O_RDONLY); + if (fd < 0) + return 0; + +@@ -700,8 +701,8 @@ write_archive_locales (void **all_datap, char *linebuf) + if (cnt) + putchar_unlocked ('\n'); + +- printf ("locale: %-15.15s archive: " ARCHIVE_NAME "\n%s\n", +- names[cnt].name, linebuf); ++ printf ("locale: %-15.15s archive: %s\n%s\n", ++ names[cnt].name, _write_archive_locales_path, linebuf); + + locrec = (struct locrecent *) (addr + names[cnt].locrec_offset); + diff --git a/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch b/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch new file mode 100644 index 0000000..f4fc1d6 --- /dev/null +++ b/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch @@ -0,0 +1,32 @@ +From 2761400989bcbf11e10bc85f90c3a2ba1305c4ae Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 6 Mar 2021 14:48:56 -0800 +Subject: [PATCH] nativesdk-glibc: Fall back to faccessat on faccess2 returns + EPERM + +Fedora-specific workaround for systemd-nspawn + +Upstream-Status: Inappropriate [Distro Specific] + +Signed-off-by: Khem Raj +--- + sysdeps/unix/sysv/linux/faccessat.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c +index 13160d3249..ee3ddc9b79 100644 +--- a/sysdeps/unix/sysv/linux/faccessat.c ++++ b/sysdeps/unix/sysv/linux/faccessat.c +@@ -30,7 +30,11 @@ __faccessat (int fd, const char *file, int mode, int flag) + #if __ASSUME_FACCESSAT2 + return ret; + #else +- if (ret == 0 || errno != ENOSYS) ++ /* Fedora-specific workaround: ++ As a workround for a broken systemd-nspawn that returns ++ EPERM when a syscall is not allowed instead of ENOSYS ++ we must check for EPERM here and fall back to faccessat. */ ++ if (ret == 0 || !(errno == ENOSYS || errno == EPERM)) + return ret; + + if (flag & ~(AT_SYMLINK_NOFOLLOW | AT_EACCESS)) diff --git a/recipes-core/glibc/glibc/0009-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch b/recipes-core/glibc/glibc/0009-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch new file mode 100644 index 0000000..01de227 --- /dev/null +++ b/recipes-core/glibc/glibc/0009-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch @@ -0,0 +1,1581 @@ +From 74923ca4b1ae0ed5a2478e7d265b37534f6815d7 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:01:50 +0000 +Subject: [PATCH] fsl e500/e5500/e6500/603e fsqrt implementation + +Upstream-Status: Pending +Signed-off-by: Edmar Wienskoski +Signed-off-by: Khem Raj +--- + sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c | 134 ++++++++++++++++++ + sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c | 101 +++++++++++++ + sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c | 134 ++++++++++++++++++ + .../powerpc/powerpc32/e500mc/fpu/e_sqrtf.c | 101 +++++++++++++ + sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c | 134 ++++++++++++++++++ + sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c | 101 +++++++++++++ + sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c | 134 ++++++++++++++++++ + sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c | 101 +++++++++++++ + sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c | 134 ++++++++++++++++++ + sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c | 101 +++++++++++++ + sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c | 134 ++++++++++++++++++ + sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c | 101 +++++++++++++ + .../linux/powerpc/powerpc32/603e/fpu/Implies | 1 + + .../powerpc/powerpc32/e300c3/fpu/Implies | 2 + + .../powerpc/powerpc32/e500mc/fpu/Implies | 1 + + .../linux/powerpc/powerpc32/e5500/fpu/Implies | 1 + + .../linux/powerpc/powerpc32/e6500/fpu/Implies | 1 + + .../linux/powerpc/powerpc64/e5500/fpu/Implies | 1 + + .../linux/powerpc/powerpc64/e6500/fpu/Implies | 1 + + 19 files changed, 1418 insertions(+) + create mode 100644 sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c + create mode 100644 sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c + create mode 100644 sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c + create mode 100644 sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c + create mode 100644 sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c + create mode 100644 sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c + create mode 100644 sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c + create mode 100644 sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c + create mode 100644 sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c + create mode 100644 sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c + create mode 100644 sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c + create mode 100644 sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c + create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies + create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies + create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies + create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies + create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies + create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies + create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies + +diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c +new file mode 100644 +index 0000000000..71e516d1c8 +--- /dev/null ++++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c +@@ -0,0 +1,134 @@ ++/* Double-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float two108 = 3.245185536584267269e+32; ++static const float twom54 = 5.551115123125782702e-17; ++static const float half = 0.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the actual square root and half of its reciprocal ++ simultaneously. */ ++ ++#ifdef __STDC__ ++double ++__ieee754_sqrt (double b) ++#else ++double ++__ieee754_sqrt (b) ++ double b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++ double y, g, h, d, r; ++ ieee_double_shape_type u; ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ u.value = b; ++ ++ relax_fenv_state (); ++ ++ __asm__ ("frsqrte %[estimate], %[x]\n" ++ : [estimate] "=f" (y) : [x] "f" (b)); ++ ++ /* Following Muller et al, page 168, equation 5.20. ++ ++ h goes to 1/(2*sqrt(b)) ++ g goes to sqrt(b). ++ ++ We need three iterations to get within 1ulp. */ ++ ++ /* Indicate that these can be performed prior to the branch. GCC ++ insists on sinking them below the branch, however; it seems like ++ they'd be better before the branch so that we can cover any latency ++ from storing the argument and loading its high word. Oh well. */ ++ ++ g = b * y; ++ h = 0.5 * y; ++ ++ /* Handle small numbers by scaling. */ ++ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) ++ return __ieee754_sqrt (b * two108) * twom54; ++ ++#define FMADD(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */ ++ ++ /* Final refinement. */ ++ d = FNMSUB (g, g, b); ++ ++ fesetenv_register (fe); ++ return FMADD (d, h, g); ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_wash (b); ++} +diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c +new file mode 100644 +index 0000000000..26fa067abf +--- /dev/null ++++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c +@@ -0,0 +1,101 @@ ++/* Single-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float threehalf = 1.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the reciprocal square root and use that to compute the actual ++ square root. */ ++ ++#ifdef __STDC__ ++float ++__ieee754_sqrtf (float b) ++#else ++float ++__ieee754_sqrtf (b) ++ float b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++#define FMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ double y, x; ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ relax_fenv_state (); ++ ++ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */ ++ y = FMSUB (threehalf, b, b); ++ ++ /* Initial estimate. */ ++ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b)); ++ ++ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */ ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ ++ /* All done. */ ++ fesetenv_register (fe); ++ return x * b; ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_washf (b); ++} +diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c +new file mode 100644 +index 0000000000..71e516d1c8 +--- /dev/null ++++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c +@@ -0,0 +1,134 @@ ++/* Double-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float two108 = 3.245185536584267269e+32; ++static const float twom54 = 5.551115123125782702e-17; ++static const float half = 0.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the actual square root and half of its reciprocal ++ simultaneously. */ ++ ++#ifdef __STDC__ ++double ++__ieee754_sqrt (double b) ++#else ++double ++__ieee754_sqrt (b) ++ double b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++ double y, g, h, d, r; ++ ieee_double_shape_type u; ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ u.value = b; ++ ++ relax_fenv_state (); ++ ++ __asm__ ("frsqrte %[estimate], %[x]\n" ++ : [estimate] "=f" (y) : [x] "f" (b)); ++ ++ /* Following Muller et al, page 168, equation 5.20. ++ ++ h goes to 1/(2*sqrt(b)) ++ g goes to sqrt(b). ++ ++ We need three iterations to get within 1ulp. */ ++ ++ /* Indicate that these can be performed prior to the branch. GCC ++ insists on sinking them below the branch, however; it seems like ++ they'd be better before the branch so that we can cover any latency ++ from storing the argument and loading its high word. Oh well. */ ++ ++ g = b * y; ++ h = 0.5 * y; ++ ++ /* Handle small numbers by scaling. */ ++ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) ++ return __ieee754_sqrt (b * two108) * twom54; ++ ++#define FMADD(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */ ++ ++ /* Final refinement. */ ++ d = FNMSUB (g, g, b); ++ ++ fesetenv_register (fe); ++ return FMADD (d, h, g); ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_wash (b); ++} +diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c +new file mode 100644 +index 0000000000..26fa067abf +--- /dev/null ++++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c +@@ -0,0 +1,101 @@ ++/* Single-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float threehalf = 1.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the reciprocal square root and use that to compute the actual ++ square root. */ ++ ++#ifdef __STDC__ ++float ++__ieee754_sqrtf (float b) ++#else ++float ++__ieee754_sqrtf (b) ++ float b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++#define FMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ double y, x; ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ relax_fenv_state (); ++ ++ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */ ++ y = FMSUB (threehalf, b, b); ++ ++ /* Initial estimate. */ ++ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b)); ++ ++ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */ ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ ++ /* All done. */ ++ fesetenv_register (fe); ++ return x * b; ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_washf (b); ++} +diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c +new file mode 100644 +index 0000000000..71e516d1c8 +--- /dev/null ++++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c +@@ -0,0 +1,134 @@ ++/* Double-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float two108 = 3.245185536584267269e+32; ++static const float twom54 = 5.551115123125782702e-17; ++static const float half = 0.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the actual square root and half of its reciprocal ++ simultaneously. */ ++ ++#ifdef __STDC__ ++double ++__ieee754_sqrt (double b) ++#else ++double ++__ieee754_sqrt (b) ++ double b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++ double y, g, h, d, r; ++ ieee_double_shape_type u; ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ u.value = b; ++ ++ relax_fenv_state (); ++ ++ __asm__ ("frsqrte %[estimate], %[x]\n" ++ : [estimate] "=f" (y) : [x] "f" (b)); ++ ++ /* Following Muller et al, page 168, equation 5.20. ++ ++ h goes to 1/(2*sqrt(b)) ++ g goes to sqrt(b). ++ ++ We need three iterations to get within 1ulp. */ ++ ++ /* Indicate that these can be performed prior to the branch. GCC ++ insists on sinking them below the branch, however; it seems like ++ they'd be better before the branch so that we can cover any latency ++ from storing the argument and loading its high word. Oh well. */ ++ ++ g = b * y; ++ h = 0.5 * y; ++ ++ /* Handle small numbers by scaling. */ ++ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) ++ return __ieee754_sqrt (b * two108) * twom54; ++ ++#define FMADD(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */ ++ ++ /* Final refinement. */ ++ d = FNMSUB (g, g, b); ++ ++ fesetenv_register (fe); ++ return FMADD (d, h, g); ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_wash (b); ++} +diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c +new file mode 100644 +index 0000000000..26fa067abf +--- /dev/null ++++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c +@@ -0,0 +1,101 @@ ++/* Single-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float threehalf = 1.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the reciprocal square root and use that to compute the actual ++ square root. */ ++ ++#ifdef __STDC__ ++float ++__ieee754_sqrtf (float b) ++#else ++float ++__ieee754_sqrtf (b) ++ float b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++#define FMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ double y, x; ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ relax_fenv_state (); ++ ++ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */ ++ y = FMSUB (threehalf, b, b); ++ ++ /* Initial estimate. */ ++ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b)); ++ ++ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */ ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ ++ /* All done. */ ++ fesetenv_register (fe); ++ return x * b; ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_washf (b); ++} +diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c +new file mode 100644 +index 0000000000..71e516d1c8 +--- /dev/null ++++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c +@@ -0,0 +1,134 @@ ++/* Double-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float two108 = 3.245185536584267269e+32; ++static const float twom54 = 5.551115123125782702e-17; ++static const float half = 0.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the actual square root and half of its reciprocal ++ simultaneously. */ ++ ++#ifdef __STDC__ ++double ++__ieee754_sqrt (double b) ++#else ++double ++__ieee754_sqrt (b) ++ double b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++ double y, g, h, d, r; ++ ieee_double_shape_type u; ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ u.value = b; ++ ++ relax_fenv_state (); ++ ++ __asm__ ("frsqrte %[estimate], %[x]\n" ++ : [estimate] "=f" (y) : [x] "f" (b)); ++ ++ /* Following Muller et al, page 168, equation 5.20. ++ ++ h goes to 1/(2*sqrt(b)) ++ g goes to sqrt(b). ++ ++ We need three iterations to get within 1ulp. */ ++ ++ /* Indicate that these can be performed prior to the branch. GCC ++ insists on sinking them below the branch, however; it seems like ++ they'd be better before the branch so that we can cover any latency ++ from storing the argument and loading its high word. Oh well. */ ++ ++ g = b * y; ++ h = 0.5 * y; ++ ++ /* Handle small numbers by scaling. */ ++ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) ++ return __ieee754_sqrt (b * two108) * twom54; ++ ++#define FMADD(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */ ++ ++ /* Final refinement. */ ++ d = FNMSUB (g, g, b); ++ ++ fesetenv_register (fe); ++ return FMADD (d, h, g); ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_wash (b); ++} +diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c +new file mode 100644 +index 0000000000..26fa067abf +--- /dev/null ++++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c +@@ -0,0 +1,101 @@ ++/* Single-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float threehalf = 1.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the reciprocal square root and use that to compute the actual ++ square root. */ ++ ++#ifdef __STDC__ ++float ++__ieee754_sqrtf (float b) ++#else ++float ++__ieee754_sqrtf (b) ++ float b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++#define FMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ double y, x; ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ relax_fenv_state (); ++ ++ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */ ++ y = FMSUB (threehalf, b, b); ++ ++ /* Initial estimate. */ ++ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b)); ++ ++ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */ ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ ++ /* All done. */ ++ fesetenv_register (fe); ++ return x * b; ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_washf (b); ++} +diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c +new file mode 100644 +index 0000000000..71e516d1c8 +--- /dev/null ++++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c +@@ -0,0 +1,134 @@ ++/* Double-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float two108 = 3.245185536584267269e+32; ++static const float twom54 = 5.551115123125782702e-17; ++static const float half = 0.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the actual square root and half of its reciprocal ++ simultaneously. */ ++ ++#ifdef __STDC__ ++double ++__ieee754_sqrt (double b) ++#else ++double ++__ieee754_sqrt (b) ++ double b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++ double y, g, h, d, r; ++ ieee_double_shape_type u; ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ u.value = b; ++ ++ relax_fenv_state (); ++ ++ __asm__ ("frsqrte %[estimate], %[x]\n" ++ : [estimate] "=f" (y) : [x] "f" (b)); ++ ++ /* Following Muller et al, page 168, equation 5.20. ++ ++ h goes to 1/(2*sqrt(b)) ++ g goes to sqrt(b). ++ ++ We need three iterations to get within 1ulp. */ ++ ++ /* Indicate that these can be performed prior to the branch. GCC ++ insists on sinking them below the branch, however; it seems like ++ they'd be better before the branch so that we can cover any latency ++ from storing the argument and loading its high word. Oh well. */ ++ ++ g = b * y; ++ h = 0.5 * y; ++ ++ /* Handle small numbers by scaling. */ ++ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) ++ return __ieee754_sqrt (b * two108) * twom54; ++ ++#define FMADD(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */ ++ ++ /* Final refinement. */ ++ d = FNMSUB (g, g, b); ++ ++ fesetenv_register (fe); ++ return FMADD (d, h, g); ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_wash (b); ++} +diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c +new file mode 100644 +index 0000000000..26fa067abf +--- /dev/null ++++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c +@@ -0,0 +1,101 @@ ++/* Single-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float threehalf = 1.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the reciprocal square root and use that to compute the actual ++ square root. */ ++ ++#ifdef __STDC__ ++float ++__ieee754_sqrtf (float b) ++#else ++float ++__ieee754_sqrtf (b) ++ float b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++#define FMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ double y, x; ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ relax_fenv_state (); ++ ++ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */ ++ y = FMSUB (threehalf, b, b); ++ ++ /* Initial estimate. */ ++ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b)); ++ ++ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */ ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ ++ /* All done. */ ++ fesetenv_register (fe); ++ return x * b; ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_washf (b); ++} +diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c +new file mode 100644 +index 0000000000..71e516d1c8 +--- /dev/null ++++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c +@@ -0,0 +1,134 @@ ++/* Double-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float two108 = 3.245185536584267269e+32; ++static const float twom54 = 5.551115123125782702e-17; ++static const float half = 0.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the actual square root and half of its reciprocal ++ simultaneously. */ ++ ++#ifdef __STDC__ ++double ++__ieee754_sqrt (double b) ++#else ++double ++__ieee754_sqrt (b) ++ double b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++ double y, g, h, d, r; ++ ieee_double_shape_type u; ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ u.value = b; ++ ++ relax_fenv_state (); ++ ++ __asm__ ("frsqrte %[estimate], %[x]\n" ++ : [estimate] "=f" (y) : [x] "f" (b)); ++ ++ /* Following Muller et al, page 168, equation 5.20. ++ ++ h goes to 1/(2*sqrt(b)) ++ g goes to sqrt(b). ++ ++ We need three iterations to get within 1ulp. */ ++ ++ /* Indicate that these can be performed prior to the branch. GCC ++ insists on sinking them below the branch, however; it seems like ++ they'd be better before the branch so that we can cover any latency ++ from storing the argument and loading its high word. Oh well. */ ++ ++ g = b * y; ++ h = 0.5 * y; ++ ++ /* Handle small numbers by scaling. */ ++ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) ++ return __ieee754_sqrt (b * two108) * twom54; ++ ++#define FMADD(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */ ++ ++ /* Final refinement. */ ++ d = FNMSUB (g, g, b); ++ ++ fesetenv_register (fe); ++ return FMADD (d, h, g); ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_wash (b); ++} +diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c +new file mode 100644 +index 0000000000..26fa067abf +--- /dev/null ++++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c +@@ -0,0 +1,101 @@ ++/* Single-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float threehalf = 1.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the reciprocal square root and use that to compute the actual ++ square root. */ ++ ++#ifdef __STDC__ ++float ++__ieee754_sqrtf (float b) ++#else ++float ++__ieee754_sqrtf (b) ++ float b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++#define FMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ double y, x; ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ relax_fenv_state (); ++ ++ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */ ++ y = FMSUB (threehalf, b, b); ++ ++ /* Initial estimate. */ ++ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b)); ++ ++ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */ ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ ++ /* All done. */ ++ fesetenv_register (fe); ++ return x * b; ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_washf (b); ++} +diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies +new file mode 100644 +index 0000000000..b103b4dea5 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies +@@ -0,0 +1 @@ ++powerpc/powerpc32/603e/fpu +diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies +new file mode 100644 +index 0000000000..64db17fada +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies +@@ -0,0 +1,2 @@ ++# e300c3 is a variant of 603e so use the same optimizations for sqrt ++powerpc/powerpc32/603e/fpu +diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies +new file mode 100644 +index 0000000000..7eac5fcf02 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies +@@ -0,0 +1 @@ ++powerpc/powerpc32/e500mc/fpu +diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies +new file mode 100644 +index 0000000000..264b2a7700 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies +@@ -0,0 +1 @@ ++powerpc/powerpc32/e5500/fpu +diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies +new file mode 100644 +index 0000000000..a25934467b +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies +@@ -0,0 +1 @@ ++powerpc/powerpc32/e6500/fpu +diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies +new file mode 100644 +index 0000000000..a7bc854be8 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies +@@ -0,0 +1 @@ ++powerpc/powerpc64/e5500/fpu +diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies +new file mode 100644 +index 0000000000..04ff8cc181 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies +@@ -0,0 +1 @@ ++powerpc/powerpc64/e6500/fpu diff --git a/recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch b/recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch new file mode 100644 index 0000000..5c1130c --- /dev/null +++ b/recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch @@ -0,0 +1,205 @@ +From 5da3da7f2d276c2a6ae1b04419b28e96953803ec Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:15:07 +0000 +Subject: [PATCH] ppc/sqrt: Fix undefined reference to `__sqrt_finite' + +on ppc fixes the errors like below +| ./.libs/libpulsecore-1.1.so: undefined reference to `__sqrt_finite' +| collect2: ld returned 1 exit status + +Upstream-Status: Pending + +ChangeLog + +2012-01-06 Khem Raj + + * sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c: Add __*_finite alias. + Remove cruft. + * sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c: Ditto. + * sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c: Ditto. + * sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c: Ditto. + +Signed-off-by: Khem Raj +--- + sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c | 7 +------ + sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c | 7 +------ + sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c | 1 + + sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c | 1 + + sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c | 1 + + sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c | 1 + + sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c | 1 + + sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c | 1 + + sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c | 7 +------ + sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c | 7 +------ + sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c | 1 + + sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c | 1 + + 12 files changed, 12 insertions(+), 24 deletions(-) + +diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c +index 71e516d1c8..1795fd6c3e 100644 +--- a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c ++++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c +@@ -39,14 +39,8 @@ static const float half = 0.5; + We find the actual square root and half of its reciprocal + simultaneously. */ + +-#ifdef __STDC__ + double + __ieee754_sqrt (double b) +-#else +-double +-__ieee754_sqrt (b) +- double b; +-#endif + { + if (__builtin_expect (b > 0, 1)) + { +@@ -132,3 +126,4 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++strong_alias (__ieee754_sqrt, __sqrt_finite) +diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c +index 26fa067abf..a917f313ab 100644 +--- a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c ++++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c +@@ -37,14 +37,8 @@ static const float threehalf = 1.5; + We find the reciprocal square root and use that to compute the actual + square root. */ + +-#ifdef __STDC__ + float + __ieee754_sqrtf (float b) +-#else +-float +-__ieee754_sqrtf (b) +- float b; +-#endif + { + if (__builtin_expect (b > 0, 1)) + { +@@ -99,3 +93,4 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++strong_alias (__ieee754_sqrtf, __sqrtf_finite) +diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c +index 71e516d1c8..fc4a74990e 100644 +--- a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c ++++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c +@@ -132,3 +132,4 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++strong_alias (__ieee754_sqrt, __sqrt_finite) +diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c +index 26fa067abf..9d175122a8 100644 +--- a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c ++++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c +@@ -99,3 +99,4 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++strong_alias (__ieee754_sqrtf, __sqrtf_finite) +diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c +index 71e516d1c8..fc4a74990e 100644 +--- a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c ++++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c +@@ -132,3 +132,4 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++strong_alias (__ieee754_sqrt, __sqrt_finite) +diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c +index 26fa067abf..9d175122a8 100644 +--- a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c ++++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c +@@ -99,3 +99,4 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++strong_alias (__ieee754_sqrtf, __sqrtf_finite) +diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c +index 71e516d1c8..fc4a74990e 100644 +--- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c ++++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c +@@ -132,3 +132,4 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++strong_alias (__ieee754_sqrt, __sqrt_finite) +diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c +index 26fa067abf..9d175122a8 100644 +--- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c ++++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c +@@ -99,3 +99,4 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++strong_alias (__ieee754_sqrtf, __sqrtf_finite) +diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c +index 71e516d1c8..1795fd6c3e 100644 +--- a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c ++++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c +@@ -39,14 +39,8 @@ static const float half = 0.5; + We find the actual square root and half of its reciprocal + simultaneously. */ + +-#ifdef __STDC__ + double + __ieee754_sqrt (double b) +-#else +-double +-__ieee754_sqrt (b) +- double b; +-#endif + { + if (__builtin_expect (b > 0, 1)) + { +@@ -132,3 +126,4 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++strong_alias (__ieee754_sqrt, __sqrt_finite) +diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c +index 26fa067abf..a917f313ab 100644 +--- a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c ++++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c +@@ -37,14 +37,8 @@ static const float threehalf = 1.5; + We find the reciprocal square root and use that to compute the actual + square root. */ + +-#ifdef __STDC__ + float + __ieee754_sqrtf (float b) +-#else +-float +-__ieee754_sqrtf (b) +- float b; +-#endif + { + if (__builtin_expect (b > 0, 1)) + { +@@ -99,3 +93,4 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++strong_alias (__ieee754_sqrtf, __sqrtf_finite) +diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c +index 71e516d1c8..fc4a74990e 100644 +--- a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c ++++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c +@@ -132,3 +132,4 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++strong_alias (__ieee754_sqrt, __sqrt_finite) +diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c +index 26fa067abf..9d175122a8 100644 +--- a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c ++++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c +@@ -99,3 +99,4 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++strong_alias (__ieee754_sqrtf, __sqrtf_finite) diff --git a/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch b/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch new file mode 100644 index 0000000..b72e790 --- /dev/null +++ b/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch @@ -0,0 +1,384 @@ +From 77f1c90d67a2f8852184fb8fd95cb0ed63065dc7 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:16:38 +0000 +Subject: [PATCH] __ieee754_sqrt{,f} are now inline functions and call out + __slow versions + +Upstream-Status: Pending + +Signed-off-by: Khem Raj +--- + sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c | 12 ++++++++++-- + sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c | 8 +++++++- + sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c | 14 +++++++++++--- + sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c | 12 ++++++++++-- + sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c | 14 +++++++++++--- + sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c | 12 ++++++++++-- + sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c | 8 ++++++++ + sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c | 8 ++++++++ + sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c | 12 ++++++++++-- + sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c | 9 ++++++++- + sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c | 14 +++++++++++--- + sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c | 12 ++++++++++-- + 12 files changed, 114 insertions(+), 21 deletions(-) + +diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c +index 1795fd6c3e..daa83f3fe8 100644 +--- a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c ++++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c +@@ -40,7 +40,7 @@ static const float half = 0.5; + simultaneously. */ + + double +-__ieee754_sqrt (double b) ++__slow_ieee754_sqrt (double b) + { + if (__builtin_expect (b > 0, 1)) + { +@@ -77,7 +77,7 @@ __ieee754_sqrt (double b) + + /* Handle small numbers by scaling. */ + if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) +- return __ieee754_sqrt (b * two108) * twom54; ++ return __slow_ieee754_sqrt (b * two108) * twom54; + + #define FMADD(a_, c_, b_) \ + ({ double __r; \ +@@ -126,4 +126,12 @@ __ieee754_sqrt (double b) + } + return f_wash (b); + } ++ ++#undef __ieee754_sqrt ++double ++__ieee754_sqrt (double x) ++{ ++ return __slow_ieee754_sqrt (x); ++} ++ + strong_alias (__ieee754_sqrt, __sqrt_finite) +diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c +index a917f313ab..b812cf1705 100644 +--- a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c ++++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c +@@ -38,7 +38,7 @@ static const float threehalf = 1.5; + square root. */ + + float +-__ieee754_sqrtf (float b) ++__slow_ieee754_sqrtf (float b) + { + if (__builtin_expect (b > 0, 1)) + { +@@ -93,4 +93,10 @@ __ieee754_sqrtf (float b) + } + return f_washf (b); + } ++#undef __ieee754_sqrtf ++float ++__ieee754_sqrtf (float x) ++{ ++ return __slow_ieee754_sqrtf (x); ++} + strong_alias (__ieee754_sqrtf, __sqrtf_finite) +diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c +index fc4a74990e..7038a70b47 100644 +--- a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c ++++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c +@@ -41,10 +41,10 @@ static const float half = 0.5; + + #ifdef __STDC__ + double +-__ieee754_sqrt (double b) ++__slow_ieee754_sqrt (double b) + #else + double +-__ieee754_sqrt (b) ++__slow_ieee754_sqrt (b) + double b; + #endif + { +@@ -83,7 +83,7 @@ __ieee754_sqrt (b) + + /* Handle small numbers by scaling. */ + if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) +- return __ieee754_sqrt (b * two108) * twom54; ++ return __slow_ieee754_sqrt (b * two108) * twom54; + + #define FMADD(a_, c_, b_) \ + ({ double __r; \ +@@ -132,4 +132,12 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++ ++#undef __ieee754_sqrt ++double ++__ieee754_sqrt (double x) ++{ ++ return __slow_ieee754_sqrt (x); ++} ++ + strong_alias (__ieee754_sqrt, __sqrt_finite) +diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c +index 9d175122a8..10de1f0cc3 100644 +--- a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c ++++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c +@@ -39,10 +39,10 @@ static const float threehalf = 1.5; + + #ifdef __STDC__ + float +-__ieee754_sqrtf (float b) ++__slow_ieee754_sqrtf (float b) + #else + float +-__ieee754_sqrtf (b) ++__slow_ieee754_sqrtf (b) + float b; + #endif + { +@@ -99,4 +99,12 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++ ++#undef __ieee754_sqrtf ++float ++__ieee754_sqrtf (float x) ++{ ++ return __slow_ieee754_sqrtf (x); ++} ++ + strong_alias (__ieee754_sqrtf, __sqrtf_finite) +diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c +index fc4a74990e..7038a70b47 100644 +--- a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c ++++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c +@@ -41,10 +41,10 @@ static const float half = 0.5; + + #ifdef __STDC__ + double +-__ieee754_sqrt (double b) ++__slow_ieee754_sqrt (double b) + #else + double +-__ieee754_sqrt (b) ++__slow_ieee754_sqrt (b) + double b; + #endif + { +@@ -83,7 +83,7 @@ __ieee754_sqrt (b) + + /* Handle small numbers by scaling. */ + if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) +- return __ieee754_sqrt (b * two108) * twom54; ++ return __slow_ieee754_sqrt (b * two108) * twom54; + + #define FMADD(a_, c_, b_) \ + ({ double __r; \ +@@ -132,4 +132,12 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++ ++#undef __ieee754_sqrt ++double ++__ieee754_sqrt (double x) ++{ ++ return __slow_ieee754_sqrt (x); ++} ++ + strong_alias (__ieee754_sqrt, __sqrt_finite) +diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c +index 9d175122a8..10de1f0cc3 100644 +--- a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c ++++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c +@@ -39,10 +39,10 @@ static const float threehalf = 1.5; + + #ifdef __STDC__ + float +-__ieee754_sqrtf (float b) ++__slow_ieee754_sqrtf (float b) + #else + float +-__ieee754_sqrtf (b) ++__slow_ieee754_sqrtf (b) + float b; + #endif + { +@@ -99,4 +99,12 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++ ++#undef __ieee754_sqrtf ++float ++__ieee754_sqrtf (float x) ++{ ++ return __slow_ieee754_sqrtf (x); ++} ++ + strong_alias (__ieee754_sqrtf, __sqrtf_finite) +diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c +index fc4a74990e..1c34244bd8 100644 +--- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c ++++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c +@@ -132,4 +132,12 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++ ++#undef __ieee754_sqrt ++double ++__ieee754_sqrt (double x) ++{ ++ return __slow_ieee754_sqrt (x); ++} ++ + strong_alias (__ieee754_sqrt, __sqrt_finite) +diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c +index 9d175122a8..812653558f 100644 +--- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c ++++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c +@@ -99,4 +99,12 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++ ++#undef __ieee754_sqrtf ++float ++__ieee754_sqrtf (float x) ++{ ++ return __slow_ieee754_sqrtf (x); ++} ++ + strong_alias (__ieee754_sqrtf, __sqrtf_finite) +diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c +index 1795fd6c3e..13a81973e3 100644 +--- a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c ++++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c +@@ -40,7 +40,7 @@ static const float half = 0.5; + simultaneously. */ + + double +-__ieee754_sqrt (double b) ++__slow_ieee754_sqrt (double b) + { + if (__builtin_expect (b > 0, 1)) + { +@@ -77,7 +77,7 @@ __ieee754_sqrt (double b) + + /* Handle small numbers by scaling. */ + if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) +- return __ieee754_sqrt (b * two108) * twom54; ++ return __slow_ieee754_sqrt (b * two108) * twom54; + + #define FMADD(a_, c_, b_) \ + ({ double __r; \ +@@ -126,4 +126,12 @@ __ieee754_sqrt (double b) + } + return f_wash (b); + } ++ ++#undef __ieee754_sqrt ++double ++__ieee754_sqrt (double x) ++{ ++ return __slow_ieee754_sqrt (x); ++} ++ + strong_alias (__ieee754_sqrt, __sqrt_finite) +diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c +index a917f313ab..fae2d81210 100644 +--- a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c ++++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c +@@ -38,7 +38,7 @@ static const float threehalf = 1.5; + square root. */ + + float +-__ieee754_sqrtf (float b) ++__slow_ieee754_sqrtf (float b) + { + if (__builtin_expect (b > 0, 1)) + { +@@ -93,4 +93,11 @@ __ieee754_sqrtf (float b) + } + return f_washf (b); + } ++#undef __ieee754_sqrtf ++float ++__ieee754_sqrtf (float x) ++{ ++ return __slow_ieee754_sqrtf (x); ++} ++ + strong_alias (__ieee754_sqrtf, __sqrtf_finite) +diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c +index fc4a74990e..7038a70b47 100644 +--- a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c ++++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c +@@ -41,10 +41,10 @@ static const float half = 0.5; + + #ifdef __STDC__ + double +-__ieee754_sqrt (double b) ++__slow_ieee754_sqrt (double b) + #else + double +-__ieee754_sqrt (b) ++__slow_ieee754_sqrt (b) + double b; + #endif + { +@@ -83,7 +83,7 @@ __ieee754_sqrt (b) + + /* Handle small numbers by scaling. */ + if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) +- return __ieee754_sqrt (b * two108) * twom54; ++ return __slow_ieee754_sqrt (b * two108) * twom54; + + #define FMADD(a_, c_, b_) \ + ({ double __r; \ +@@ -132,4 +132,12 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++ ++#undef __ieee754_sqrt ++double ++__ieee754_sqrt (double x) ++{ ++ return __slow_ieee754_sqrt (x); ++} ++ + strong_alias (__ieee754_sqrt, __sqrt_finite) +diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c +index 9d175122a8..10de1f0cc3 100644 +--- a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c ++++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c +@@ -39,10 +39,10 @@ static const float threehalf = 1.5; + + #ifdef __STDC__ + float +-__ieee754_sqrtf (float b) ++__slow_ieee754_sqrtf (float b) + #else + float +-__ieee754_sqrtf (b) ++__slow_ieee754_sqrtf (b) + float b; + #endif + { +@@ -99,4 +99,12 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++ ++#undef __ieee754_sqrtf ++float ++__ieee754_sqrtf (float x) ++{ ++ return __slow_ieee754_sqrtf (x); ++} ++ + strong_alias (__ieee754_sqrtf, __sqrtf_finite) diff --git a/recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch b/recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch new file mode 100644 index 0000000..07d4411 --- /dev/null +++ b/recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch @@ -0,0 +1,58 @@ +From add514edf4299d1bf540d85d0aa0bd5fe0d46b78 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:20:09 +0000 +Subject: [PATCH] Quote from bug 1443 which explains what the patch does : + + We build some random program and link it with -lust. When we run it, + it dies with a SIGSEGV before reaching main(). + + Libust.so depends on liburcu-bp.so from the usermode-rcu package. + Although libust.so is not prelinked, liburcu-bp.so IS prelinked; this + is critical. + + Libust.so uses a TLS / __thread variable that is defined in liburcu- + bp.so. There are special ARM-specific relocation types that allow two + shared libraries to share thread-specific data. This is critical too. + + One more critical issue: although liburcu-bp.so is prelinked, we can't + load it at its prelinked address, because we also link against + librt.so, and librt.so uses that address. + + The dynamic linker is forced to relink liburcu-bp.so at a different + address. In the course of relinking, it processes the special ARM + relocation record mentioned above. The prelinker has already filled + in the information, which is a short offset into a table of thread- + specific data that is allocated per-thread for each library that uses + TLS. Because the normal behavior of a relocation is to add the symbol + value to an addend stored at the address being relocated, we end up + adding the short offset to itself, doubling it. + + Now we have an awkward situation. The libust.so library doesn't know + about the addend, so its TLS data for this element is correct. The + liburcu-bp.so library has a different offset for the element. When we + go to initialize the element for the first time in liburcu-bp.so, we + write the address of the result at the doubled (broken) offset. + Later, when we refer to the address from libust.so, we check the value + at the correct offset, but it's NULL, so we eat hot SIGSEGV. + +Upstream-Status: Pending + +Signed-off-by: Andrei Dinu +Signed-off-by: Khem Raj +--- + sysdeps/arm/dl-machine.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h +index ff5e09e207..d68bfe5cbe 100644 +--- a/sysdeps/arm/dl-machine.h ++++ b/sysdeps/arm/dl-machine.h +@@ -510,7 +510,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, + + case R_ARM_TLS_DTPOFF32: + if (sym != NULL) +- *reloc_addr += sym->st_value; ++ *reloc_addr = sym->st_value; + break; + + case R_ARM_TLS_TPOFF32: diff --git a/recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch b/recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch new file mode 100644 index 0000000..c2766ef --- /dev/null +++ b/recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch @@ -0,0 +1,33 @@ +From c5047b8f7d1a17324cfa02b99f07a70ebcec2cf2 Mon Sep 17 00:00:00 2001 +From: Ting Liu +Date: Wed, 19 Dec 2012 04:39:57 -0600 +Subject: [PATCH] eglibc: run libm-err-tab.pl with specific dirs in ${S} + +libm-err-tab.pl will parse all the files named "libm-test-ulps" +in the given dir recursively. To avoid parsing the one in +${S}/.pc/ (it does exist after eglibc adds aarch64 support, +${S}/.pc/aarch64-0001-glibc-fsf-v1-eaf6f205.patch/ports/sysdeps/ +aarch64/libm-test-ulps), run libm-err-tab.pl with specific dirs +in ${S}. + +Upstream-Status: inappropriate [OE specific] + +Signed-off-by: Ting Liu +--- + manual/Makefile | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/manual/Makefile b/manual/Makefile +index e83444341e..aa2645bc55 100644 +--- a/manual/Makefile ++++ b/manual/Makefile +@@ -103,7 +103,8 @@ $(objpfx)stamp-libm-err: $(..)math/gen-libm-test.py \ + $(wildcard $(foreach dir,$(sysdirs),\ + $(dir)/libm-test-ulps)) + pwd=`pwd`; \ +- $(PYTHON) $< -s $$pwd/.. -m $(objpfx)libm-err-tmp ++ $(PYTHON) $< -s $$pwd/../ports -m $(objpfx)libm-err-tmp ++ $(PYTHON) $< -s $$pwd/../sysdeps -m $(objpfx)libm-err-tmp + $(move-if-change) $(objpfx)libm-err-tmp $(objpfx)libm-err.texi + touch $@ + diff --git a/recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch b/recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch new file mode 100644 index 0000000..088b810 --- /dev/null +++ b/recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch @@ -0,0 +1,58 @@ +From 133870f12ba36686dd8df1311fac32a4c5b28579 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:24:46 +0000 +Subject: [PATCH] __ieee754_sqrt{,f} are now inline functions and call out + __slow versions + +Upstream-Status: Pending + +Signed-off-by: chunrong guo +Signed-off-by: Khem Raj +--- + sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c | 6 +++--- + sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c | 4 ++-- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c +index 1c34244bd8..7038a70b47 100644 +--- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c ++++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c +@@ -41,10 +41,10 @@ static const float half = 0.5; + + #ifdef __STDC__ + double +-__ieee754_sqrt (double b) ++__slow_ieee754_sqrt (double b) + #else + double +-__ieee754_sqrt (b) ++__slow_ieee754_sqrt (b) + double b; + #endif + { +@@ -83,7 +83,7 @@ __ieee754_sqrt (b) + + /* Handle small numbers by scaling. */ + if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) +- return __ieee754_sqrt (b * two108) * twom54; ++ return __slow_ieee754_sqrt (b * two108) * twom54; + + #define FMADD(a_, c_, b_) \ + ({ double __r; \ +diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c +index 812653558f..10de1f0cc3 100644 +--- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c ++++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c +@@ -39,10 +39,10 @@ static const float threehalf = 1.5; + + #ifdef __STDC__ + float +-__ieee754_sqrtf (float b) ++__slow_ieee754_sqrtf (float b) + #else + float +-__ieee754_sqrtf (b) ++__slow_ieee754_sqrtf (b) + float b; + #endif + { diff --git a/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch b/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch new file mode 100644 index 0000000..e8332a5 --- /dev/null +++ b/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch @@ -0,0 +1,39 @@ +From b4613f814ba7ba5db95d18116172f81a83ac8f5b Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:27:10 +0000 +Subject: [PATCH] sysdeps/gnu/configure.ac: handle correctly + $libc_cv_rootsbindir + +Upstream-Status:Pending + +Signed-off-by: Matthieu Crapet +Signed-off-by: Khem Raj +--- + sysdeps/gnu/configure | 2 +- + sysdeps/gnu/configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sysdeps/gnu/configure b/sysdeps/gnu/configure +index c15d1087e8..37cc983f2a 100644 +--- a/sysdeps/gnu/configure ++++ b/sysdeps/gnu/configure +@@ -32,6 +32,6 @@ case "$prefix" in + else + libc_cv_localstatedir=$localstatedir + fi +- libc_cv_rootsbindir=/sbin ++ test -n "$libc_cv_rootsbindir" || libc_cv_rootsbindir=/sbin + ;; + esac +diff --git a/sysdeps/gnu/configure.ac b/sysdeps/gnu/configure.ac +index 634fe4de2a..3db1697f4f 100644 +--- a/sysdeps/gnu/configure.ac ++++ b/sysdeps/gnu/configure.ac +@@ -21,6 +21,6 @@ case "$prefix" in + else + libc_cv_localstatedir=$localstatedir + fi +- libc_cv_rootsbindir=/sbin ++ test -n "$libc_cv_rootsbindir" || libc_cv_rootsbindir=/sbin + ;; + esac diff --git a/recipes-core/glibc/glibc/0016-yes-within-the-path-sets-wrong-config-variables.patch b/recipes-core/glibc/glibc/0016-yes-within-the-path-sets-wrong-config-variables.patch new file mode 100644 index 0000000..f7e7f1c --- /dev/null +++ b/recipes-core/glibc/glibc/0016-yes-within-the-path-sets-wrong-config-variables.patch @@ -0,0 +1,260 @@ +From 7be3e82b66394a7b242e56c6fc609e858b8e2436 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:31:06 +0000 +Subject: [PATCH] 'yes' within the path sets wrong config variables + +It seems that the 'AC_EGREP_CPP(yes...' example is quite popular +but being such a short word to grep it is likely to produce +false-positive matches with the path it is configured into. + +The change is to use a more elaborated string to grep for. + +Upstream-Status: Submitted [libc-alpha@sourceware.org] + +Signed-off-by: Benjamin Esquivel +Signed-off-by: Khem Raj +--- + sysdeps/aarch64/configure | 4 ++-- + sysdeps/aarch64/configure.ac | 4 ++-- + sysdeps/arm/configure | 4 ++-- + sysdeps/arm/configure.ac | 4 ++-- + sysdeps/mips/configure | 4 ++-- + sysdeps/mips/configure.ac | 4 ++-- + sysdeps/nios2/configure | 4 ++-- + sysdeps/nios2/configure.ac | 4 ++-- + sysdeps/unix/sysv/linux/mips/configure | 4 ++-- + sysdeps/unix/sysv/linux/mips/configure.ac | 4 ++-- + sysdeps/unix/sysv/linux/powerpc/powerpc64/configure | 8 ++++---- + sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac | 8 ++++---- + 12 files changed, 28 insertions(+), 28 deletions(-) + +diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure +index 4c1fac49f3..597314f476 100644 +--- a/sysdeps/aarch64/configure ++++ b/sysdeps/aarch64/configure +@@ -157,12 +157,12 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #ifdef __AARCH64EB__ +- yes ++ is_aarch64_be + #endif + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1; then : ++ $EGREP "is_aarch64_be" >/dev/null 2>&1; then : + libc_cv_aarch64_be=yes + else + libc_cv_aarch64_be=no +diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac +index 3347c13fa1..4af163c0b6 100644 +--- a/sysdeps/aarch64/configure.ac ++++ b/sysdeps/aarch64/configure.ac +@@ -17,8 +17,8 @@ AC_DEFINE(SUPPORT_STATIC_PIE) + # the dynamic linker via %ifdef. + AC_CACHE_CHECK([for big endian], + [libc_cv_aarch64_be], +- [AC_EGREP_CPP(yes,[#ifdef __AARCH64EB__ +- yes ++ [AC_EGREP_CPP(is_aarch64_be,[#ifdef __AARCH64EB__ ++ is_aarch64_be + #endif + ], libc_cv_aarch64_be=yes, libc_cv_aarch64_be=no)]) + if test $libc_cv_aarch64_be = yes; then +diff --git a/sysdeps/arm/configure b/sysdeps/arm/configure +index 431e843b2b..e152461138 100644 +--- a/sysdeps/arm/configure ++++ b/sysdeps/arm/configure +@@ -151,12 +151,12 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #ifdef __ARM_PCS_VFP +- yes ++ use_arm_pcs_vfp + #endif + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1; then : ++ $EGREP "use_arm_pcs_vfp" >/dev/null 2>&1; then : + libc_cv_arm_pcs_vfp=yes + else + libc_cv_arm_pcs_vfp=no +diff --git a/sysdeps/arm/configure.ac b/sysdeps/arm/configure.ac +index 90cdd69c75..05a262ba00 100644 +--- a/sysdeps/arm/configure.ac ++++ b/sysdeps/arm/configure.ac +@@ -15,8 +15,8 @@ AC_DEFINE(PI_STATIC_AND_HIDDEN) + # the dynamic linker via %ifdef. + AC_CACHE_CHECK([whether the compiler is using the ARM hard-float ABI], + [libc_cv_arm_pcs_vfp], +- [AC_EGREP_CPP(yes,[#ifdef __ARM_PCS_VFP +- yes ++ [AC_EGREP_CPP(use_arm_pcs_vfp,[#ifdef __ARM_PCS_VFP ++ use_arm_pcs_vfp + #endif + ], libc_cv_arm_pcs_vfp=yes, libc_cv_arm_pcs_vfp=no)]) + if test $libc_cv_arm_pcs_vfp = yes; then +diff --git a/sysdeps/mips/configure b/sysdeps/mips/configure +index 4e13248c03..f14af952d0 100644 +--- a/sysdeps/mips/configure ++++ b/sysdeps/mips/configure +@@ -143,11 +143,11 @@ else + /* end confdefs.h. */ + dnl + #ifdef __mips_nan2008 +-yes ++use_mips_nan2008 + #endif + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1; then : ++ $EGREP "use_mips_nan2008" >/dev/null 2>&1; then : + libc_cv_mips_nan2008=yes + else + libc_cv_mips_nan2008=no +diff --git a/sysdeps/mips/configure.ac b/sysdeps/mips/configure.ac +index bcbdaffd9f..ad3057f4cc 100644 +--- a/sysdeps/mips/configure.ac ++++ b/sysdeps/mips/configure.ac +@@ -6,9 +6,9 @@ dnl position independent way. + dnl AC_DEFINE(PI_STATIC_AND_HIDDEN) + + AC_CACHE_CHECK([whether the compiler is using the 2008 NaN encoding], +- libc_cv_mips_nan2008, [AC_EGREP_CPP(yes, [dnl ++ libc_cv_mips_nan2008, [AC_EGREP_CPP(use_mips_nan2008, [dnl + #ifdef __mips_nan2008 +-yes ++use_mips_nan2008 + #endif], libc_cv_mips_nan2008=yes, libc_cv_mips_nan2008=no)]) + if test x$libc_cv_mips_nan2008 = xyes; then + AC_DEFINE(HAVE_MIPS_NAN2008) +diff --git a/sysdeps/nios2/configure b/sysdeps/nios2/configure +index 14c8a3a014..dde3814ef2 100644 +--- a/sysdeps/nios2/configure ++++ b/sysdeps/nios2/configure +@@ -142,12 +142,12 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #ifdef __nios2_big_endian__ +- yes ++ is_nios2_be + #endif + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1; then : ++ $EGREP "is_nios2_be" >/dev/null 2>&1; then : + libc_cv_nios2_be=yes + else + libc_cv_nios2_be=no +diff --git a/sysdeps/nios2/configure.ac b/sysdeps/nios2/configure.ac +index f05f43802b..dc8639902d 100644 +--- a/sysdeps/nios2/configure.ac ++++ b/sysdeps/nios2/configure.ac +@@ -4,8 +4,8 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. + # Nios II big endian is not yet supported. + AC_CACHE_CHECK([for big endian], + [libc_cv_nios2_be], +- [AC_EGREP_CPP(yes,[#ifdef __nios2_big_endian__ +- yes ++ [AC_EGREP_CPP(is_nios2_be,[#ifdef __nios2_big_endian__ ++ is_nios2_be + #endif + ], libc_cv_nios2_be=yes, libc_cv_nios2_be=no)]) + if test $libc_cv_nios2_be = yes; then +diff --git a/sysdeps/unix/sysv/linux/mips/configure b/sysdeps/unix/sysv/linux/mips/configure +index f25f2a3a65..1b7483e6c6 100644 +--- a/sysdeps/unix/sysv/linux/mips/configure ++++ b/sysdeps/unix/sysv/linux/mips/configure +@@ -414,11 +414,11 @@ else + /* end confdefs.h. */ + dnl + #ifdef __mips_nan2008 +-yes ++use_mips_nan2008 + #endif + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1; then : ++ $EGREP "use_mips_nan2008" >/dev/null 2>&1; then : + libc_cv_mips_nan2008=yes + else + libc_cv_mips_nan2008=no +diff --git a/sysdeps/unix/sysv/linux/mips/configure.ac b/sysdeps/unix/sysv/linux/mips/configure.ac +index 049a0f4bdf..005526d4e8 100644 +--- a/sysdeps/unix/sysv/linux/mips/configure.ac ++++ b/sysdeps/unix/sysv/linux/mips/configure.ac +@@ -105,9 +105,9 @@ AC_COMPILE_IFELSE( + LIBC_CONFIG_VAR([mips-mode-switch],[${libc_mips_mode_switch}]) + + AC_CACHE_CHECK([whether the compiler is using the 2008 NaN encoding], +- libc_cv_mips_nan2008, [AC_EGREP_CPP(yes, [dnl ++ libc_cv_mips_nan2008, [AC_EGREP_CPP(use_mips_nan2008, [dnl + #ifdef __mips_nan2008 +-yes ++use_mips_nan2008 + #endif], libc_cv_mips_nan2008=yes, libc_cv_mips_nan2008=no)]) + + libc_mips_nan= +diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure +index ae7f254da4..874519000b 100644 +--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure ++++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure +@@ -155,12 +155,12 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #if _CALL_ELF == 2 +- yes ++ use_ppc_elfv2_abi + #endif + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1; then : ++ $EGREP "use_ppc_elfv2_abi" >/dev/null 2>&1; then : + libc_cv_ppc64_elfv2_abi=yes + else + libc_cv_ppc64_elfv2_abi=no +@@ -188,12 +188,12 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #ifdef _CALL_ELF +- yes ++ is_def_call_elf + #endif + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1; then : ++ $EGREP "is_def_call_elf" >/dev/null 2>&1; then : + libc_cv_ppc64_def_call_elf=yes + else + libc_cv_ppc64_def_call_elf=no +diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac +index f9cba6e15d..b21f72f1e4 100644 +--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac ++++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac +@@ -6,8 +6,8 @@ LIBC_SLIBDIR_RTLDDIR([lib64], [lib64]) + # Define default-abi according to compiler flags. + AC_CACHE_CHECK([whether the compiler is using the PowerPC64 ELFv2 ABI], + [libc_cv_ppc64_elfv2_abi], +- [AC_EGREP_CPP(yes,[#if _CALL_ELF == 2 +- yes ++ [AC_EGREP_CPP(use_ppc_elfv2_abi,[#if _CALL_ELF == 2 ++ use_ppc_elfv2_abi + #endif + ], libc_cv_ppc64_elfv2_abi=yes, libc_cv_ppc64_elfv2_abi=no)]) + if test $libc_cv_ppc64_elfv2_abi = yes; then +@@ -19,8 +19,8 @@ else + # Compiler that do not support ELFv2 ABI does not define _CALL_ELF + AC_CACHE_CHECK([whether the compiler defines _CALL_ELF], + [libc_cv_ppc64_def_call_elf], +- [AC_EGREP_CPP(yes,[#ifdef _CALL_ELF +- yes ++ [AC_EGREP_CPP(is_def_call_elf,[#ifdef _CALL_ELF ++ is_def_call_elf + #endif + ], libc_cv_ppc64_def_call_elf=yes, libc_cv_ppc64_def_call_elf=no)]) + if test $libc_cv_ppc64_def_call_elf = no; then diff --git a/recipes-core/glibc/glibc/0017-timezone-re-written-tzselect-as-posix-sh.patch b/recipes-core/glibc/glibc/0017-timezone-re-written-tzselect-as-posix-sh.patch new file mode 100644 index 0000000..100d085 --- /dev/null +++ b/recipes-core/glibc/glibc/0017-timezone-re-written-tzselect-as-posix-sh.patch @@ -0,0 +1,34 @@ +From 2731fa0c7463cd160361a8ac92f3bd7f984d953d Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:33:03 +0000 +Subject: [PATCH] timezone: re-written tzselect as posix sh + +To avoid the bash dependency. + +Upstream-Status: Pending + +Signed-off-by: Hongxu Jia +Signed-off-by: Khem Raj +--- + timezone/tzselect.ksh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/timezone/tzselect.ksh b/timezone/tzselect.ksh +index 18fce27e24..7705df83d7 100755 +--- a/timezone/tzselect.ksh ++++ b/timezone/tzselect.ksh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # Ask the user about the time zone, and output the resulting TZ value to stdout. + # Interact with the user via stderr and stdin. + +@@ -34,7 +34,7 @@ REPORT_BUGS_TO=tz@iana.org + + # Specify default values for environment variables if they are unset. + : ${AWK=awk} +-: ${TZDIR=`pwd`} ++: ${TZDIR=$(pwd)} + + # Output one argument as-is to standard output. + # Safer than 'echo', which can mishandle '\' or leading '-'. diff --git a/recipes-core/glibc/glibc/0018-Remove-bash-dependency-for-nscd-init-script.patch b/recipes-core/glibc/glibc/0018-Remove-bash-dependency-for-nscd-init-script.patch new file mode 100644 index 0000000..23296da --- /dev/null +++ b/recipes-core/glibc/glibc/0018-Remove-bash-dependency-for-nscd-init-script.patch @@ -0,0 +1,72 @@ +From 412d33bbfe42a10a9b1f62afcc73fe121a0363b0 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 31 Dec 2015 14:33:02 -0800 +Subject: [PATCH] Remove bash dependency for nscd init script + +The nscd init script uses #! /bin/bash but only really uses one bashism +(translated strings), so remove them and switch the shell to #!/bin/sh. + +Upstream-Status: Pending + +Signed-off-by: Ross Burton +Signed-off-by: Khem Raj +--- + nscd/nscd.init | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/nscd/nscd.init b/nscd/nscd.init +index a882da7d8b..b02986ec15 100644 +--- a/nscd/nscd.init ++++ b/nscd/nscd.init +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # nscd: Starts the Name Switch Cache Daemon + # +@@ -49,7 +49,7 @@ prog=nscd + start () { + [ -d /var/run/nscd ] || mkdir /var/run/nscd + [ -d /var/db/nscd ] || mkdir /var/db/nscd +- echo -n $"Starting $prog: " ++ echo -n "Starting $prog: " + daemon /usr/sbin/nscd + RETVAL=$? + echo +@@ -58,7 +58,7 @@ start () { + } + + stop () { +- echo -n $"Stopping $prog: " ++ echo -n "Stopping $prog: " + /usr/sbin/nscd -K + RETVAL=$? + if [ $RETVAL -eq 0 ]; then +@@ -67,9 +67,9 @@ stop () { + # a non-privileged user + rm -f /var/run/nscd/nscd.pid + rm -f /var/run/nscd/socket +- success $"$prog shutdown" ++ success "$prog shutdown" + else +- failure $"$prog shutdown" ++ failure "$prog shutdown" + fi + echo + return $RETVAL +@@ -103,13 +103,13 @@ case "$1" in + RETVAL=$? + ;; + force-reload | reload) +- echo -n $"Reloading $prog: " ++ echo -n "Reloading $prog: " + killproc /usr/sbin/nscd -HUP + RETVAL=$? + echo + ;; + *) +- echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}" ++ echo "Usage: $0 {start|stop|status|restart|reload|condrestart}" + RETVAL=1 + ;; + esac diff --git a/recipes-core/glibc/glibc/0019-eglibc-Cross-building-and-testing-instructions.patch b/recipes-core/glibc/glibc/0019-eglibc-Cross-building-and-testing-instructions.patch new file mode 100644 index 0000000..8fb9182 --- /dev/null +++ b/recipes-core/glibc/glibc/0019-eglibc-Cross-building-and-testing-instructions.patch @@ -0,0 +1,616 @@ +From db9674ffc6583a508da1a3cb044c3ccf3febaea1 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:42:58 +0000 +Subject: [PATCH] eglibc: Cross building and testing instructions + +Ported from eglibc +Upstream-Status: Pending + +Signed-off-by: Khem Raj +--- + GLIBC.cross-building | 383 +++++++++++++++++++++++++++++++++++++++++++ + GLIBC.cross-testing | 205 +++++++++++++++++++++++ + 2 files changed, 588 insertions(+) + create mode 100644 GLIBC.cross-building + create mode 100644 GLIBC.cross-testing + +diff --git a/GLIBC.cross-building b/GLIBC.cross-building +new file mode 100644 +index 0000000000..e6e0da1aaf +--- /dev/null ++++ b/GLIBC.cross-building +@@ -0,0 +1,383 @@ ++ -*- mode: text -*- ++ ++ Cross-Compiling GLIBC ++ Jim Blandy ++ ++ ++Introduction ++ ++Most GNU tools have a simple build procedure: you run their ++'configure' script, and then you run 'make'. Unfortunately, the ++process of cross-compiling the GNU C library is quite a bit more ++involved: ++ ++1) Build a cross-compiler, with certain facilities disabled. ++ ++2) Configure the C library using the compiler you built in step 1). ++ Build a few of the C run-time object files, but not the rest of the ++ library. Install the library's header files and the run-time ++ object files, and create a dummy libc.so. ++ ++3) Build a second cross-compiler, using the header files and object ++ files you installed in step 2. ++ ++4) Configure, build, and install a fresh C library, using the compiler ++ built in step 3. ++ ++5) Build a third cross-compiler, based on the C library built in step 4. ++ ++The reason for this complexity is that, although GCC and the GNU C ++library are distributed separately, they are not actually independent ++of each other: GCC requires the C library's headers and some object ++files to compile its own libraries, while the C library depends on ++GCC's libraries. GLIBC includes features and bug fixes to the stock ++GNU C library that simplify this process, but the fundamental ++interdependency stands. ++ ++In this document, we explain how to cross-compile an GLIBC/GCC pair ++from source. Our intended audience is developers who are already ++familiar with the GNU toolchain and comfortable working with ++cross-development tools. While we do present a worked example to ++accompany the explanation, for clarity's sake we do not cover many of ++the options available to cross-toolchain users. ++ ++ ++Preparation ++ ++GLIBC requires recent versions of the GNU binutils, GCC, and the ++Linux kernel. The web page ++documents the current requirements, and lists patches needed for ++certain target architectures. As of this writing, these build ++instructions have been tested with binutils 2.22.51, GCC 4.6.2, ++and Linux 3.1. ++ ++First, let's set some variables, to simplify later commands. We'll ++build GLIBC and GCC for an ARM target, known to the Linux kernel ++as 'arm', and we'll do the build on an Intel x86_64 Linux box: ++ ++ $ build=x86_64-pc-linux-gnu ++ $ host=$build ++ $ target=arm-none-linux-gnueabi ++ $ linux_arch=arm ++ ++We're using the aforementioned versions of Binutils, GCC, and Linux: ++ ++ $ binutilsv=binutils-2.22.51 ++ $ gccv=gcc-4.6.2 ++ $ linuxv=linux-3.1 ++ ++We're carrying out the entire process under '~/cross-build', which ++contains unpacked source trees for binutils, gcc, and linux kernel, ++along with GLIBC svn trunk (which can be checked-out with ++'svn co http://www.eglibc.org/svn/trunk eglibc'): ++ ++ $ top=$HOME/cross-build/$target ++ $ src=$HOME/cross-build/src ++ $ ls $src ++ binutils-2.22.51 glibc gcc-4.6.2 linux-3.1 ++ ++We're going to place our build directories in a subdirectory 'obj', ++we'll install the cross-development toolchain in 'tools', and we'll ++place our sysroot (containing files to be installed on the target ++system) in 'sysroot': ++ ++ $ obj=$top/obj ++ $ tools=$top/tools ++ $ sysroot=$top/sysroot ++ ++ ++Binutils ++ ++Configuring and building binutils for the target is straightforward: ++ ++ $ mkdir -p $obj/binutils ++ $ cd $obj/binutils ++ $ $src/$binutilsv/configure \ ++ > --target=$target \ ++ > --prefix=$tools \ ++ > --with-sysroot=$sysroot ++ $ make ++ $ make install ++ ++ ++The First GCC ++ ++For our work, we need a cross-compiler targeting an ARM Linux ++system. However, that configuration includes the shared library ++'libgcc_s.so', which is compiled against the GLIBC headers (which we ++haven't installed yet) and linked against 'libc.so' (which we haven't ++built yet). ++ ++Fortunately, there are configuration options for GCC which tell it not ++to build 'libgcc_s.so'. The '--without-headers' option is supposed to ++take care of this, but its implementation is incomplete, so you must ++also configure with the '--with-newlib' option. While '--with-newlib' ++appears to mean "Use the Newlib C library", its effect is to tell the ++GCC build machinery, "Don't assume there is a C library available." ++ ++We also need to disable some of the libraries that would normally be ++built along with GCC, and specify that only the compiler for the C ++language is needed. ++ ++So, we create a build directory, configure, make, and install. ++ ++ $ mkdir -p $obj/gcc1 ++ $ cd $obj/gcc1 ++ $ $src/$gccv/configure \ ++ > --target=$target \ ++ > --prefix=$tools \ ++ > --without-headers --with-newlib \ ++ > --disable-shared --disable-threads --disable-libssp \ ++ > --disable-libgomp --disable-libmudflap --disable-libquadmath \ ++ > --disable-decimal-float --disable-libffi \ ++ > --enable-languages=c ++ $ PATH=$tools/bin:$PATH make ++ $ PATH=$tools/bin:$PATH make install ++ ++ ++Linux Kernel Headers ++ ++To configure GLIBC, we also need Linux kernel headers in place. ++Fortunately, the Linux makefiles have a target that installs them for ++us. Since the process does modify the source tree a bit, we make a ++copy first: ++ ++ $ cp -r $src/$linuxv $obj/linux ++ $ cd $obj/linux ++ ++Now we're ready to install the headers into the sysroot: ++ ++ $ PATH=$tools/bin:$PATH \ ++ > make headers_install \ ++ > ARCH=$linux_arch CROSS_COMPILE=$target- \ ++ > INSTALL_HDR_PATH=$sysroot/usr ++ ++ ++GLIBC Headers and Preliminary Objects ++ ++Using the cross-compiler we've just built, we can now configure GLIBC ++well enough to install the headers and build the object files that the ++full cross-compiler will need: ++ ++ $ mkdir -p $obj/glibc-headers ++ $ cd $obj/glibc-headers ++ $ BUILD_CC=gcc \ ++ > CC=$tools/bin/$target-gcc \ ++ > CXX=$tools/bin/$target-g++ \ ++ > AR=$tools/bin/$target-ar \ ++ > RANLIB=$tools/bin/$target-ranlib \ ++ > $src/glibc/libc/configure \ ++ > --prefix=/usr \ ++ > --with-headers=$sysroot/usr/include \ ++ > --build=$build \ ++ > --host=$target \ ++ > --disable-profile --without-gd --without-cvs \ ++ > --enable-add-ons=nptl,libidn,../ports ++ ++The option '--prefix=/usr' may look strange, but you should never ++configure GLIBC with a prefix other than '/usr': in various places, ++GLIBC's build system checks whether the prefix is '/usr', and does ++special handling only if that is the case. Unless you use this ++prefix, you will get a sysroot that does not use the standard Linux ++directory layouts and cannot be used as a basis for the root ++filesystem on your target system compatibly with normal GLIBC ++installations. ++ ++The '--with-headers' option tells GLIBC where the Linux headers have ++been installed. ++ ++The '--enable-add-ons=nptl,libidn,../ports' option tells GLIBC to look ++for the listed glibc add-ons. Most notably the ports add-on (located ++just above the libc sources in the GLIBC svn tree) is required to ++support ARM targets. ++ ++We can now use the 'install-headers' makefile target to install the ++headers: ++ ++ $ make install-headers install_root=$sysroot \ ++ > install-bootstrap-headers=yes ++ ++The 'install_root' variable indicates where the files should actually ++be installed; its value is treated as the parent of the '--prefix' ++directory we passed to the configure script, so the headers will go in ++'$sysroot/usr/include'. The 'install-bootstrap-headers' variable ++requests special handling for certain tricky header files. ++ ++Next, there are a few object files needed to link shared libraries, ++which we build and install by hand: ++ ++ $ mkdir -p $sysroot/usr/lib ++ $ make csu/subdir_lib ++ $ cp csu/crt1.o csu/crti.o csu/crtn.o $sysroot/usr/lib ++ ++Finally, 'libgcc_s.so' requires a 'libc.so' to link against. However, ++since we will never actually execute its code, it doesn't matter what ++it contains. So, treating '/dev/null' as a C source file, we produce ++a dummy 'libc.so' in one step: ++ ++ $ $tools/bin/$target-gcc -nostdlib -nostartfiles -shared -x c /dev/null \ ++ > -o $sysroot/usr/lib/libc.so ++ ++ ++The Second GCC ++ ++With the GLIBC headers and selected object files installed, we can ++now build a GCC that is capable of compiling GLIBC. We configure, ++build, and install the second GCC, again building only the C compiler, ++and avoiding libraries we won't use: ++ ++ $ mkdir -p $obj/gcc2 ++ $ cd $obj/gcc2 ++ $ $src/$gccv/configure \ ++ > --target=$target \ ++ > --prefix=$tools \ ++ > --with-sysroot=$sysroot \ ++ > --disable-libssp --disable-libgomp --disable-libmudflap \ ++ > --disable-libffi --disable-libquadmath \ ++ > --enable-languages=c ++ $ PATH=$tools/bin:$PATH make ++ $ PATH=$tools/bin:$PATH make install ++ ++ ++GLIBC, Complete ++ ++With the second compiler built and installed, we're now ready for the ++full GLIBC build: ++ ++ $ mkdir -p $obj/glibc ++ $ cd $obj/glibc ++ $ BUILD_CC=gcc \ ++ > CC=$tools/bin/$target-gcc \ ++ > CXX=$tools/bin/$target-g++ \ ++ > AR=$tools/bin/$target-ar \ ++ > RANLIB=$tools/bin/$target-ranlib \ ++ > $src/glibc/libc/configure \ ++ > --prefix=/usr \ ++ > --with-headers=$sysroot/usr/include \ ++ > --with-kconfig=$obj/linux/scripts/kconfig \ ++ > --build=$build \ ++ > --host=$target \ ++ > --disable-profile --without-gd --without-cvs \ ++ > --enable-add-ons=nptl,libidn,../ports ++ ++Note the additional '--with-kconfig' option. This tells GLIBC where to ++find the host config tools used by the kernel 'make config' and 'make ++menuconfig'. These tools can be re-used by GLIBC for its own 'make ++*config' support, which will create 'option-groups.config' for you. ++But first make sure those tools have been built by running some ++dummy 'make *config' calls in the kernel directory: ++ ++ $ cd $obj/linux ++ $ PATH=$tools/bin:$PATH make config \ ++ > ARCH=$linux_arch CROSS_COMPILE=$target- \ ++ $ PATH=$tools/bin:$PATH make menuconfig \ ++ > ARCH=$linux_arch CROSS_COMPILE=$target- \ ++ ++Now we can configure and build the full GLIBC: ++ ++ $ cd $obj/glibc ++ $ PATH=$tools/bin:$PATH make defconfig ++ $ PATH=$tools/bin:$PATH make menuconfig ++ $ PATH=$tools/bin:$PATH make ++ $ PATH=$tools/bin:$PATH make install install_root=$sysroot ++ ++At this point, we have a complete GLIBC installation in '$sysroot', ++with header files, library files, and most of the C runtime startup ++files in place. ++ ++ ++The Third GCC ++ ++Finally, we recompile GCC against this full installation, enabling ++whatever languages and libraries we would like to use: ++ ++ $ mkdir -p $obj/gcc3 ++ $ cd $obj/gcc3 ++ $ $src/$gccv/configure \ ++ > --target=$target \ ++ > --prefix=$tools \ ++ > --with-sysroot=$sysroot \ ++ > --enable-__cxa_atexit \ ++ > --disable-libssp --disable-libgomp --disable-libmudflap \ ++ > --enable-languages=c,c++ ++ $ PATH=$tools/bin:$PATH make ++ $ PATH=$tools/bin:$PATH make install ++ ++The '--enable-__cxa_atexit' option tells GCC what sort of C++ ++destructor support to expect from the C library; it's required with ++GLIBC. ++ ++And since GCC's installation process isn't designed to help construct ++sysroot trees, we must manually copy certain libraries into place in ++the sysroot. ++ ++ $ cp -d $tools/$target/lib/libgcc_s.so* $sysroot/lib ++ $ cp -d $tools/$target/lib/libstdc++.so* $sysroot/usr/lib ++ ++ ++Trying Things Out ++ ++At this point, '$tools' contains a cross toolchain ready to use ++the GLIBC installation in '$sysroot': ++ ++ $ cat > hello.c < #include ++ > int ++ > main (int argc, char **argv) ++ > { ++ > puts ("Hello, world!"); ++ > return 0; ++ > } ++ > EOF ++ $ $tools/bin/$target-gcc -Wall hello.c -o hello ++ $ cat > c++-hello.cc < #include ++ > int ++ > main (int argc, char **argv) ++ > { ++ > std::cout << "Hello, C++ world!" << std::endl; ++ > return 0; ++ > } ++ > EOF ++ $ $tools/bin/$target-g++ -Wall c++-hello.cc -o c++-hello ++ ++ ++We can use 'readelf' to verify that these are indeed executables for ++our target, using our dynamic linker: ++ ++ $ $tools/bin/$target-readelf -hl hello ++ ELF Header: ++ ... ++ Type: EXEC (Executable file) ++ Machine: ARM ++ ++ ... ++ Program Headers: ++ Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align ++ PHDR 0x000034 0x10000034 0x10000034 0x00100 0x00100 R E 0x4 ++ INTERP 0x000134 0x00008134 0x00008134 0x00013 0x00013 R 0x1 ++ [Requesting program interpreter: /lib/ld-linux.so.3] ++ LOAD 0x000000 0x00008000 0x00008000 0x0042c 0x0042c R E 0x8000 ++ ... ++ ++Looking at the dynamic section of the installed 'libgcc_s.so', we see ++that the 'NEEDED' entry for the C library does include the '.6' ++suffix, indicating that was linked against our fully build GLIBC, and ++not our dummy 'libc.so': ++ ++ $ $tools/bin/$target-readelf -d $sysroot/lib/libgcc_s.so.1 ++ Dynamic section at offset 0x1083c contains 24 entries: ++ Tag Type Name/Value ++ 0x00000001 (NEEDED) Shared library: [libc.so.6] ++ 0x0000000e (SONAME) Library soname: [libgcc_s.so.1] ++ ... ++ ++ ++And on the target machine, we can run our programs: ++ ++ $ $sysroot/lib/ld.so.1 --library-path $sysroot/lib:$sysroot/usr/lib \ ++ > ./hello ++ Hello, world! ++ $ $sysroot/lib/ld.so.1 --library-path $sysroot/lib:$sysroot/usr/lib \ ++ > ./c++-hello ++ Hello, C++ world! +diff --git a/GLIBC.cross-testing b/GLIBC.cross-testing +new file mode 100644 +index 0000000000..b67b468466 +--- /dev/null ++++ b/GLIBC.cross-testing +@@ -0,0 +1,205 @@ ++ -*- mode: text -*- ++ ++ Cross-Testing With GLIBC ++ Jim Blandy ++ ++ ++Introduction ++ ++Developers writing software for embedded systems often use a desktop ++or other similarly capable computer for development, but need to run ++tests on the embedded system, or perhaps on a simulator. When ++configured for cross-compilation, the stock GNU C library simply ++disables running tests altogether: the command 'make tests' builds ++test programs, but does not run them. GLIBC, however, provides ++facilities for compiling tests and generating data files on the build ++system, but running the test programs themselves on a remote system or ++simulator. ++ ++ ++Test environment requirements ++ ++The test environment must meet certain conditions for GLIBC's ++cross-testing facilities to work: ++ ++- Shared filesystems. The 'build' system, on which you configure and ++ compile GLIBC, and the 'host' system, on which you intend to run ++ GLIBC, must share a filesystem containing the GLIBC build and ++ source trees. Files must appear at the same paths on both systems. ++ ++- Remote-shell like invocation. There must be a way to run a program ++ on the host system from the build system, passing it properly quoted ++ command-line arguments, setting environment variables, and ++ inheriting the caller's standard input and output. ++ ++ ++Usage ++ ++To use GLIBC's cross-testing support, provide values for the ++following Make variables when you invoke 'make': ++ ++- cross-test-wrapper ++ ++ This should be the name of the cross-testing wrapper command, along ++ with any arguments. ++ ++- cross-localedef ++ ++ This should be the name of a cross-capable localedef program, like ++ that included in the GLIBC 'localedef' module, along with any ++ arguments needed. ++ ++These are each explained in detail below. ++ ++ ++The Cross-Testing Wrapper ++ ++To run test programs reliably, the stock GNU C library takes care to ++ensure that test programs use the newly compiled dynamic linker and ++shared libraries, and never the host system's installed libraries. To ++accomplish this, it runs the tests by explicitly invoking the dynamic ++linker from the build tree, passing it a list of build tree ++directories to search for shared libraries, followed by the name of ++the executable to run and its arguments. ++ ++For example, where one might normally run a test program like this: ++ ++ $ ./tst-foo arg1 arg2 ++ ++the GNU C library might run that program like this: ++ ++ $ $objdir/elf/ld-linux.so.3 --library-path $objdir \ ++ ./tst-foo arg1 arg2 ++ ++(where $objdir is the path to the top of the build tree, and the ++trailing backslash indicates a continuation of the command). In other ++words, each test program invocation is 'wrapped up' inside an explicit ++invocation of the dynamic linker, which must itself execute the test ++program, having loaded shared libraries from the appropriate ++directories. ++ ++To support cross-testing, GLIBC allows the developer to optionally ++set the 'cross-test-wrapper' Make variable to another wrapper command, ++to which it passes the entire dynamic linker invocation shown above as ++arguments. For example, if the developer supplies a wrapper of ++'my-wrapper hostname', then GLIBC would run the test above as ++follows: ++ ++ $ my-wrapper hostname \ ++ $objdir/elf/ld-linux.so.3 --library-path $objdir \ ++ ./tst-foo arg1 arg2 ++ ++The 'my-wrapper' command is responsible for executing the command ++given on the host system. ++ ++Since tests are run in varying directories, the wrapper should either ++be in your command search path, or 'cross-test-wrapper' should give an ++absolute path for the wrapper. ++ ++The wrapper must meet several requirements: ++ ++- It must preserve the current directory. As explained above, the ++ build directory tree must be visible on both the build and host ++ systems, at the same path. The test wrapper must ensure that the ++ current directory it inherits is also inherited by the dynamic ++ linker (and thus the test program itself). ++ ++- It must preserve environment variables' values. Many GLIBC tests ++ set environment variables for test runs; in native testing, it ++ invokes programs like this: ++ ++ $ GCONV_PATH=$objdir/iconvdata \ ++ $objdir/elf/ld-linux.so.3 --library-path $objdir \ ++ ./tst-foo arg1 arg2 ++ ++ With the cross-testing wrapper, that invocation becomes: ++ ++ $ GCONV_PATH=$objdir/iconvdata \ ++ my-wrapper hostname \ ++ $objdir/elf/ld-linux.so.3 --library-path $objdir \ ++ ./tst-foo arg1 arg2 ++ ++ Here, 'my-wrapper' must ensure that the value it sees for ++ 'GCONV_PATH' will be seen by the dynamic linker, and thus 'tst-foo' ++ itself. (The wrapper supplied with GLIBC simply preserves the ++ values of *all* enviroment variables, with a fixed set of ++ exceptions.) ++ ++ If your wrapper is a shell script, take care to correctly propagate ++ environment variables whose values contain spaces and shell ++ metacharacters. ++ ++- It must pass the command's arguments, unmodified. The arguments ++ seen by the test program should be exactly those seen by the wrapper ++ (after whatever arguments are given to the wrapper itself). The ++ GLIBC test framework performs all needed shell word splitting and ++ expansion (wildcard expansion, parameter substitution, and so on) ++ before invoking the wrapper; further expansion may break the tests. ++ ++ ++The 'cross-test-ssh.sh' script ++ ++If you want to use 'ssh' (or something sufficiently similar) to run ++test programs on your host system, GLIBC includes a shell script, ++'scripts/cross-test-ssh.sh', which you can use as your wrapper ++command. This script takes care of setting the test command's current ++directory, propagating environment variable values, and carrying ++command-line arguments, all across an 'ssh' connection. You may even ++supply an alternative to 'ssh' on the command line, if needed. ++ ++For more details, pass 'cross-test-ssh.sh' the '--help' option. ++ ++ ++The Cross-Compiling Locale Definition Command ++ ++Some GLIBC tests rely on locales generated especially for the test ++process. In a native configuration, these tests simply run the ++'localedef' command built by the normal GLIBC build process, ++'locale/localedef', to process and install their locales. However, in ++a cross-compiling configuration, this 'localedef' is built for the ++host system, not the build system, and since it requires quite a bit ++of memory to run (we have seen it fail on systems with 64MiB of ++memory), it may not be practical to run it on the host system. ++ ++If set, GLIBC uses the 'cross-localedef' Make variable as the command ++to run on the build system to process and install locales. The ++localedef program built from the GLIBC 'localedef' module is ++suitable. ++ ++The value of 'cross-localedef' may also include command-line arguments ++to be passed to the program; if you are using GLIBC's 'localedef', ++you may include endianness and 'uint32_t' alignment arguments here. ++ ++ ++Example ++ ++In developing GLIBC's cross-testing facility, we invoked 'make' with ++the following script: ++ ++ #!/bin/sh ++ ++ srcdir=... ++ test_hostname=... ++ localedefdir=... ++ cross_gxx=...-g++ ++ ++ wrapper="$srcdir/scripts/cross-test-ssh.sh $test_hostname" ++ localedef="$localedefdir/localedef --little-endian --uint32-align=4" ++ ++ make cross-test-wrapper="$wrapper" \ ++ cross-localedef="$localedef" \ ++ CXX="$cross_gxx" \ ++ "$@" ++ ++ ++Other Cross-Testing Concerns ++ ++Here are notes on some other issues which you may encounter in running ++the GLIBC tests in a cross-compiling environment: ++ ++- Some tests require a C++ cross-compiler; you should set the 'CXX' ++ Make variable to the name of an appropriate cross-compiler. ++ ++- Some tests require access to libstdc++.so.6 and libgcc_s.so.1; we ++ simply place copies of these libraries in the top GLIBC build ++ directory. diff --git a/recipes-core/glibc/glibc/0020-eglibc-Help-bootstrap-cross-toolchain.patch b/recipes-core/glibc/glibc/0020-eglibc-Help-bootstrap-cross-toolchain.patch new file mode 100644 index 0000000..9b76cfd --- /dev/null +++ b/recipes-core/glibc/glibc/0020-eglibc-Help-bootstrap-cross-toolchain.patch @@ -0,0 +1,97 @@ +From 7856684f76c100155cad11b5b236fb31234b6e28 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:49:28 +0000 +Subject: [PATCH] eglibc: Help bootstrap cross toolchain + +Taken from EGLIBC, r1484 + r1525 + + 2007-02-20 Jim Blandy + + * Makefile (install-headers): Preserve old behavior: depend on + $(inst_includedir)/gnu/stubs.h only if install-bootstrap-headers + is set; otherwise, place gnu/stubs.h on the 'install-others' list. + + 2007-02-16 Jim Blandy + + * Makefile: Amend make install-headers to install everything + necessary for building a cross-compiler. Install gnu/stubs.h as + part of 'install-headers', not 'install-others'. + If install-bootstrap-headers is 'yes', install a dummy copy of + gnu/stubs.h, instead of computing the real thing. + * include/stubs-bootstrap.h: New file. + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + Makefile | 22 +++++++++++++++++++++- + include/stubs-bootstrap.h | 12 ++++++++++++ + 2 files changed, 33 insertions(+), 1 deletion(-) + create mode 100644 include/stubs-bootstrap.h + +diff --git a/Makefile b/Makefile +index f98d5a9e67..c36d04da0f 100644 +--- a/Makefile ++++ b/Makefile +@@ -79,9 +79,18 @@ subdir-dirs = include + vpath %.h $(subdir-dirs) + + # What to install. +-install-others = $(inst_includedir)/gnu/stubs.h + install-bin-script = + ++# If we're bootstrapping, install a dummy gnu/stubs.h along with the ++# other headers, so 'make install-headers' produces a useable include ++# tree. Otherwise, install gnu/stubs.h later, after the rest of the ++# build is done. ++ifeq ($(install-bootstrap-headers),yes) ++install-headers: $(inst_includedir)/gnu/stubs.h ++else ++install-others = $(inst_includedir)/gnu/stubs.h ++endif ++ + ifeq (yes,$(build-shared)) + headers += gnu/lib-names.h + endif +@@ -415,6 +424,16 @@ others: $(common-objpfx)testrun.sh $(common-objpfx)debugglibc.sh + + subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs) + ++# gnu/stubs.h depends (via the subdir 'stubs' targets) on all the .o ++# files in EGLIBC. For bootstrapping a GCC/EGLIBC pair, an empty ++# gnu/stubs.h is good enough. ++ifeq ($(install-bootstrap-headers),yes) ++$(inst_includedir)/gnu/stubs.h: include/stubs-bootstrap.h $(+force) ++ $(make-target-directory) ++ $(INSTALL_DATA) $< $@ ++ ++installed-stubs = ++else + ifndef abi-variants + installed-stubs = $(inst_includedir)/gnu/stubs.h + else +@@ -441,6 +460,7 @@ $(inst_includedir)/gnu/stubs.h: $(+force) + + install-others-nosubdir: $(installed-stubs) + endif ++endif + + + # Since stubs.h is never needed when building the library, we simplify the +diff --git a/include/stubs-bootstrap.h b/include/stubs-bootstrap.h +new file mode 100644 +index 0000000000..1d2b669aff +--- /dev/null ++++ b/include/stubs-bootstrap.h +@@ -0,0 +1,12 @@ ++/* Placeholder stubs.h file for bootstrapping. ++ ++ When bootstrapping a GCC/EGLIBC pair, GCC requires that the EGLIBC ++ headers be installed, but we can't fully build EGLIBC without that ++ GCC. So we run the command: ++ ++ make install-headers install-bootstrap-headers=yes ++ ++ to install the headers GCC needs, but avoid building certain ++ difficult headers. The header depends, via the ++ EGLIBC subdir 'stubs' make targets, on every .o file in EGLIBC, but ++ an empty stubs.h like this will do fine for GCC. */ diff --git a/recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch b/recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch new file mode 100644 index 0000000..74c8c10 --- /dev/null +++ b/recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch @@ -0,0 +1,53 @@ +From 111ab95a85314d1e70fb159a14250354cc69d899 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:55:53 +0000 +Subject: [PATCH] eglibc: Resolve __fpscr_values on SH4 + +2010-09-29 Nobuhiro Iwamatsu + Andrew Stubbs + + Resolve SH's __fpscr_values to symbol in libc.so. + + * sysdeps/sh/sh4/fpu/fpu_control.h: Add C++ __set_fpscr prototype. + * sysdeps/unix/sysv/linux/sh/Versions (GLIBC_2.2): Add __fpscr_values. + * sysdeps/unix/sysv/linux/sh/sysdep.S (___fpscr_values): New constant. + +Upstream-Status: Pending + +Signed-off-by: Khem Raj +--- + sysdeps/unix/sysv/linux/sh/Versions | 1 + + sysdeps/unix/sysv/linux/sh/sysdep.S | 11 +++++++++++ + 2 files changed, 12 insertions(+) + +diff --git a/sysdeps/unix/sysv/linux/sh/Versions b/sysdeps/unix/sysv/linux/sh/Versions +index 9c734ff755..974e33b4b1 100644 +--- a/sysdeps/unix/sysv/linux/sh/Versions ++++ b/sysdeps/unix/sysv/linux/sh/Versions +@@ -3,6 +3,7 @@ libc { + GLIBC_2.2 { + # functions used in other libraries + __xstat64; __fxstat64; __lxstat64; ++ __fpscr_values; + + # a* + alphasort64; +diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.S b/sysdeps/unix/sysv/linux/sh/sysdep.S +index a18fbb2e8b..59421bfbb0 100644 +--- a/sysdeps/unix/sysv/linux/sh/sysdep.S ++++ b/sysdeps/unix/sysv/linux/sh/sysdep.S +@@ -30,3 +30,14 @@ ENTRY (__syscall_error) + + #define __syscall_error __syscall_error_1 + #include ++ ++ .data ++ .align 3 ++ .globl ___fpscr_values ++ .type ___fpscr_values, @object ++ .size ___fpscr_values, 8 ++___fpscr_values: ++ .long 0 ++ .long 0x80000 ++weak_alias (___fpscr_values, __fpscr_values) ++ diff --git a/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch b/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch new file mode 100644 index 0000000..a9ff8e9 --- /dev/null +++ b/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch @@ -0,0 +1,560 @@ +From 4e5de801a39d66b8bd93d09f5912dcbe5db4ef04 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 01:33:49 +0000 +Subject: [PATCH] eglibc: Forward port cross locale generation support + +Upstream-Status: Pending + +Signed-off-by: Khem Raj +--- + locale/Makefile | 3 +- + locale/catnames.c | 46 +++++++++++++++++++++++++++ + locale/localeinfo.h | 2 +- + locale/programs/charmap-dir.c | 6 ++++ + locale/programs/ld-collate.c | 17 +++++----- + locale/programs/ld-ctype.c | 27 ++++++++-------- + locale/programs/ld-time.c | 31 ++++++++++++------ + locale/programs/linereader.c | 2 +- + locale/programs/localedef.c | 8 +++++ + locale/programs/locfile.c | 5 ++- + locale/programs/locfile.h | 59 +++++++++++++++++++++++++++++++++-- + locale/setlocale.c | 29 ----------------- + 12 files changed, 167 insertions(+), 68 deletions(-) + create mode 100644 locale/catnames.c + +diff --git a/locale/Makefile b/locale/Makefile +index b7c60681fa..07c606cde3 100644 +--- a/locale/Makefile ++++ b/locale/Makefile +@@ -26,7 +26,8 @@ headers = langinfo.h locale.h bits/locale.h \ + bits/types/locale_t.h bits/types/__locale_t.h + routines = setlocale findlocale loadlocale loadarchive \ + localeconv nl_langinfo nl_langinfo_l mb_cur_max \ +- newlocale duplocale freelocale uselocale ++ newlocale duplocale freelocale uselocale \ ++ catnames + tests = tst-C-locale tst-locname tst-duplocale + tests-container = tst-localedef-path-norm + categories = ctype messages monetary numeric time paper name \ +diff --git a/locale/catnames.c b/locale/catnames.c +new file mode 100644 +index 0000000000..538f3f5edb +--- /dev/null ++++ b/locale/catnames.c +@@ -0,0 +1,46 @@ ++/* Copyright (C) 2006 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include "localeinfo.h" ++ ++/* Define an array of category names (also the environment variable names). */ ++const struct catnamestr_t _nl_category_names attribute_hidden = ++ { ++#define DEFINE_CATEGORY(category, category_name, items, a) \ ++ category_name, ++#include "categories.def" ++#undef DEFINE_CATEGORY ++ }; ++ ++const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden = ++ { ++#define DEFINE_CATEGORY(category, category_name, items, a) \ ++ [category] = offsetof (struct catnamestr_t, CATNAMEMF (__LINE__)), ++#include "categories.def" ++#undef DEFINE_CATEGORY ++ }; ++ ++/* An array of their lengths, for convenience. */ ++const uint8_t _nl_category_name_sizes[] attribute_hidden = ++ { ++#define DEFINE_CATEGORY(category, category_name, items, a) \ ++ [category] = sizeof (category_name) - 1, ++#include "categories.def" ++#undef DEFINE_CATEGORY ++ [LC_ALL] = sizeof ("LC_ALL") - 1 ++ }; +diff --git a/locale/localeinfo.h b/locale/localeinfo.h +index 22f9dc1140..fa31b3c5ea 100644 +--- a/locale/localeinfo.h ++++ b/locale/localeinfo.h +@@ -230,7 +230,7 @@ __libc_tsd_define (extern, locale_t, LOCALE) + unused. We can manage this playing some tricks with weak references. + But with thread-local locale settings, it becomes quite ungainly unless + we can use __thread variables. So only in that case do we attempt this. */ +-#ifndef SHARED ++#if !defined SHARED && !defined IN_GLIBC_LOCALEDEF + # include + # define NL_CURRENT_INDIRECT 1 + #endif +diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c +index 4841bfd05d..ffcba1fd79 100644 +--- a/locale/programs/charmap-dir.c ++++ b/locale/programs/charmap-dir.c +@@ -18,7 +18,9 @@ + #include + #include + #include ++#ifndef NO_UNCOMPRESS + #include ++#endif + #include + #include + #include +@@ -154,6 +156,7 @@ charmap_closedir (CHARMAP_DIR *cdir) + return closedir (dir); + } + ++#ifndef NO_UNCOMPRESS + /* Creates a subprocess decompressing the given pathname, and returns + a stream reading its output (the decompressed data). */ + static +@@ -202,6 +205,7 @@ fopen_uncompressed (const char *pathname, const char *compressor) + } + return NULL; + } ++#endif + + /* Opens a charmap for reading, given its name (not an alias name). */ + FILE * +@@ -224,6 +228,7 @@ charmap_open (const char *directory, const char *name) + if (stream != NULL) + return stream; + ++#ifndef NO_UNCOMPRESS + memcpy (p, ".gz", 4); + stream = fopen_uncompressed (pathname, "gzip"); + if (stream != NULL) +@@ -233,6 +238,7 @@ charmap_open (const char *directory, const char *name) + stream = fopen_uncompressed (pathname, "bzip2"); + if (stream != NULL) + return stream; ++#endif + + return NULL; + } +diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c +index b6406b775d..bfa4adba9c 100644 +--- a/locale/programs/ld-collate.c ++++ b/locale/programs/ld-collate.c +@@ -349,7 +349,7 @@ new_element (struct locale_collate_t *collate, const char *mbs, size_t mbslen, + } + if (wcs != NULL) + { +- size_t nwcs = wcslen ((wchar_t *) wcs); ++ size_t nwcs = wcslen_uint32 (wcs); + uint32_t zero = 0; + /* Handle as a single character. */ + if (nwcs == 0) +@@ -1775,8 +1775,7 @@ symbol `%s' has the same encoding as"), (*eptr)->name); + + if ((*eptr)->nwcs == runp->nwcs) + { +- int c = wmemcmp ((wchar_t *) (*eptr)->wcs, +- (wchar_t *) runp->wcs, runp->nwcs); ++ int c = wmemcmp_uint32 ((*eptr)->wcs, runp->wcs, runp->nwcs); + + if (c == 0) + { +@@ -2003,9 +2002,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp) + one consecutive entry. */ + if (runp->wcnext != NULL + && runp->nwcs == runp->wcnext->nwcs +- && wmemcmp ((wchar_t *) runp->wcs, +- (wchar_t *)runp->wcnext->wcs, +- runp->nwcs - 1) == 0 ++ && wmemcmp_uint32 (runp->wcs, ++ runp->wcnext->wcs, ++ runp->nwcs - 1) == 0 + && (runp->wcs[runp->nwcs - 1] + == runp->wcnext->wcs[runp->nwcs - 1] + 1)) + { +@@ -2029,9 +2028,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp) + runp = runp->wcnext; + while (runp->wcnext != NULL + && runp->nwcs == runp->wcnext->nwcs +- && wmemcmp ((wchar_t *) runp->wcs, +- (wchar_t *)runp->wcnext->wcs, +- runp->nwcs - 1) == 0 ++ && wmemcmp_uint32 (runp->wcs, ++ runp->wcnext->wcs, ++ runp->nwcs - 1) == 0 + && (runp->wcs[runp->nwcs - 1] + == runp->wcnext->wcs[runp->nwcs - 1] + 1)); + +diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c +index 2fb579bbbf..d0be99581c 100644 +--- a/locale/programs/ld-ctype.c ++++ b/locale/programs/ld-ctype.c +@@ -915,7 +915,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap, + allocate_arrays (ctype, charmap, ctype->repertoire); + + default_missing_len = (ctype->default_missing +- ? wcslen ((wchar_t *) ctype->default_missing) ++ ? wcslen_uint32 (ctype->default_missing) + : 0); + + init_locale_data (&file, nelems); +@@ -1927,7 +1927,7 @@ read_translit_entry (struct linereader *ldfile, struct locale_ctype_t *ctype, + ignore = 1; + else + /* This value is usable. */ +- obstack_grow (ob, to_wstr, wcslen ((wchar_t *) to_wstr) * 4); ++ obstack_grow (ob, to_wstr, wcslen_uint32 (to_wstr) * 4); + + first = 0; + } +@@ -2461,8 +2461,8 @@ with character code range values one must use the absolute ellipsis `...'")); + } + + handle_tok_digit: +- class_bit = _ISwdigit; +- class256_bit = _ISdigit; ++ class_bit = BITw (tok_digit); ++ class256_bit = BIT (tok_digit); + handle_digits = 1; + goto read_charclass; + +@@ -3904,8 +3904,7 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, + + while (idx < number) + { +- int res = wcscmp ((const wchar_t *) sorted[idx]->from, +- (const wchar_t *) runp->from); ++ int res = wcscmp_uint32 (sorted[idx]->from, runp->from); + if (res == 0) + { + replace = 1; +@@ -3942,11 +3941,11 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, + for (size_t cnt = 0; cnt < number; ++cnt) + { + struct translit_to_t *srunp; +- from_len += wcslen ((const wchar_t *) sorted[cnt]->from) + 1; ++ from_len += wcslen_uint32 (sorted[cnt]->from) + 1; + srunp = sorted[cnt]->to; + while (srunp != NULL) + { +- to_len += wcslen ((const wchar_t *) srunp->str) + 1; ++ to_len += wcslen_uint32 (srunp->str) + 1; + srunp = srunp->next; + } + /* Plus one for the extra NUL character marking the end of +@@ -3970,18 +3969,18 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, + ctype->translit_from_idx[cnt] = from_len; + ctype->translit_to_idx[cnt] = to_len; + +- len = wcslen ((const wchar_t *) sorted[cnt]->from) + 1; +- wmemcpy ((wchar_t *) &ctype->translit_from_tbl[from_len], +- (const wchar_t *) sorted[cnt]->from, len); ++ len = wcslen_uint32 (sorted[cnt]->from) + 1; ++ wmemcpy_uint32 (&ctype->translit_from_tbl[from_len], ++ sorted[cnt]->from, len); + from_len += len; + + ctype->translit_to_idx[cnt] = to_len; + srunp = sorted[cnt]->to; + while (srunp != NULL) + { +- len = wcslen ((const wchar_t *) srunp->str) + 1; +- wmemcpy ((wchar_t *) &ctype->translit_to_tbl[to_len], +- (const wchar_t *) srunp->str, len); ++ len = wcslen_uint32 (srunp->str) + 1; ++ wmemcpy_uint32 (&ctype->translit_to_tbl[to_len], ++ srunp->str, len); + to_len += len; + srunp = srunp->next; + } +diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c +index dcd2a2386d..6814740325 100644 +--- a/locale/programs/ld-time.c ++++ b/locale/programs/ld-time.c +@@ -220,8 +220,10 @@ No definition for %s category found"), "LC_TIME"); + } + else + { ++ static const uint32_t wt_fmt_ampm[] ++ = { '%','I',':','%','M',':','%','S',' ','%','p',0 }; + time->t_fmt_ampm = "%I:%M:%S %p"; +- time->wt_fmt_ampm = (const uint32_t *) L"%I:%M:%S %p"; ++ time->wt_fmt_ampm = wt_fmt_ampm; + } + } + +@@ -231,7 +233,7 @@ No definition for %s category found"), "LC_TIME"); + const int days_per_month[12] = { 31, 29, 31, 30, 31, 30, + 31, 31, 30, 31 ,30, 31 }; + size_t idx; +- wchar_t *wstr; ++ uint32_t *wstr; + + time->era_entries = + (struct era_data *) xmalloc (time->num_era +@@ -457,18 +459,18 @@ No definition for %s category found"), "LC_TIME"); + } + + /* Now generate the wide character name and format. */ +- wstr = wcschr ((wchar_t *) time->wera[idx], L':');/* end direction */ +- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end offset */ +- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end start */ +- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end end */ ++ wstr = wcschr_uint32 (time->wera[idx], L':'); /* end direction */ ++ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end offset */ ++ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end start */ ++ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end end */ + if (wstr != NULL) + { +- time->era_entries[idx].wname = (uint32_t *) wstr + 1; +- wstr = wcschr (wstr + 1, L':'); /* end name */ ++ time->era_entries[idx].wname = wstr + 1; ++ wstr = wcschr_uint32 (wstr + 1, L':'); /* end name */ + if (wstr != NULL) + { + *wstr = L'\0'; +- time->era_entries[idx].wformat = (uint32_t *) wstr + 1; ++ time->era_entries[idx].wformat = wstr + 1; + } + else + time->era_entries[idx].wname = +@@ -527,7 +529,16 @@ No definition for %s category found"), "LC_TIME"); + if (time->date_fmt == NULL) + time->date_fmt = "%a %b %e %H:%M:%S %Z %Y"; + if (time->wdate_fmt == NULL) +- time->wdate_fmt = (const uint32_t *) L"%a %b %e %H:%M:%S %Z %Y"; ++ { ++ static const uint32_t wdate_fmt[] = ++ { '%','a',' ', ++ '%','b',' ', ++ '%','e',' ', ++ '%','H',':','%','M',':','%','S',' ', ++ '%','Z',' ', ++ '%','Y',0 }; ++ time->wdate_fmt = wdate_fmt; ++ } + } + + +diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c +index 96d3ab66db..3af379d2c3 100644 +--- a/locale/programs/linereader.c ++++ b/locale/programs/linereader.c +@@ -595,7 +595,7 @@ get_string (struct linereader *lr, const struct charmap_t *charmap, + { + int return_widestr = lr->return_widestr; + char *buf; +- wchar_t *buf2 = NULL; ++ uint32_t *buf2 = NULL; + size_t bufact; + size_t bufmax = 56; + +diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c +index 832c8fd1fc..fe689b3ae1 100644 +--- a/locale/programs/localedef.c ++++ b/locale/programs/localedef.c +@@ -109,6 +109,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; + #define OPT_NO_WARN 402 + #define OPT_WARN 403 + #define OPT_NO_HARD_LINKS 404 ++#define OPT_UINT32_ALIGN 405 + + /* Definitions of arguments for argp functions. */ + static const struct argp_option options[] = +@@ -153,6 +154,8 @@ static const struct argp_option options[] = + N_("Generate little-endian output") }, + { "big-endian", OPT_BIG_ENDIAN, NULL, 0, + N_("Generate big-endian output") }, ++ { "uint32-align", OPT_UINT32_ALIGN, "ALIGNMENT", 0, ++ N_("Set the target's uint32_t alignment in bytes (default 4)") }, + { NULL, 0, NULL, 0, NULL } + }; + +@@ -243,12 +246,14 @@ main (int argc, char *argv[]) + ctype locale. (P1003.2 4.35.5.2) */ + setlocale (LC_CTYPE, "POSIX"); + ++#ifndef NO_SYSCONF + /* Look whether the system really allows locale definitions. POSIX + defines error code 3 for this situation so I think it must be + a fatal error (see P1003.2 4.35.8). */ + if (sysconf (_SC_2_LOCALEDEF) < 0) + record_error (3, 0, _("\ + FATAL: system does not define `_POSIX2_LOCALEDEF'")); ++#endif + + /* Process charmap file. */ + charmap = charmap_read (charmap_file, verbose, 1, be_quiet, 1); +@@ -400,6 +405,9 @@ parse_opt (int key, char *arg, struct argp_state *state) + /* Do not hard link to other locales. */ + hard_links = false; + break; ++ case OPT_UINT32_ALIGN: ++ uint32_align_mask = strtol (arg, NULL, 0) - 1; ++ break; + case 'c': + force_output = 1; + break; +diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c +index 0f1affa1d4..7d86fae801 100644 +--- a/locale/programs/locfile.c ++++ b/locale/programs/locfile.c +@@ -544,6 +544,9 @@ compare_files (const char *filename1, const char *filename2, size_t size, + machine running localedef. */ + bool swap_endianness_p; + ++/* The target's value of __align__(uint32_t) - 1. */ ++unsigned int uint32_align_mask = 3; ++ + /* When called outside a start_locale_structure/end_locale_structure + or start_locale_prelude/end_locale_prelude block, record that the + next byte in FILE's obstack will be the first byte of a new element. +@@ -621,7 +624,7 @@ add_locale_string (struct locale_file *file, const char *string) + void + add_locale_wstring (struct locale_file *file, const uint32_t *string) + { +- add_locale_uint32_array (file, string, wcslen ((const wchar_t *) string) + 1); ++ add_locale_uint32_array (file, string, wcslen_uint32 (string) + 1); + } + + /* Record that FILE's next element is the 32-bit integer VALUE. */ +diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h +index c986d599ec..222a779176 100644 +--- a/locale/programs/locfile.h ++++ b/locale/programs/locfile.h +@@ -71,6 +71,8 @@ extern void write_all_categories (struct localedef_t *definitions, + + extern bool swap_endianness_p; + ++extern unsigned int uint32_align_mask; ++ + /* Change the output to be big-endian if BIG_ENDIAN is true and + little-endian otherwise. */ + static inline void +@@ -89,7 +91,8 @@ maybe_swap_uint32 (uint32_t value) + } + + /* Likewise, but munge an array of N uint32_ts starting at ARRAY. */ +-static inline void ++static void ++__attribute__ ((unused)) + maybe_swap_uint32_array (uint32_t *array, size_t n) + { + if (swap_endianness_p) +@@ -99,7 +102,8 @@ maybe_swap_uint32_array (uint32_t *array, size_t n) + + /* Like maybe_swap_uint32_array, but the array of N elements is at + the end of OBSTACK's current object. */ +-static inline void ++static void ++__attribute__ ((unused)) + maybe_swap_uint32_obstack (struct obstack *obstack, size_t n) + { + maybe_swap_uint32_array ((uint32_t *) obstack_next_free (obstack) - n, n); +@@ -276,4 +280,55 @@ extern void identification_output (struct localedef_t *locale, + const struct charmap_t *charmap, + const char *output_path); + ++static size_t wcslen_uint32 (const uint32_t *str) __attribute__ ((unused)); ++static uint32_t * wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n) __attribute__ ((unused)); ++static uint32_t * wcschr_uint32 (const uint32_t *s, uint32_t ch) __attribute__ ((unused)); ++static int wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2) __attribute__ ((unused)); ++static int wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n) __attribute__ ((unused)); ++ ++static size_t ++wcslen_uint32 (const uint32_t *str) ++{ ++ size_t len = 0; ++ while (str[len] != 0) ++ len++; ++ return len; ++} ++ ++static int ++wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n) ++{ ++ while (n-- != 0) ++ { ++ int diff = *s1++ - *s2++; ++ if (diff != 0) ++ return diff; ++ } ++ return 0; ++} ++ ++static int ++wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2) ++{ ++ while (*s1 != 0 && *s1 == *s2) ++ s1++, s2++; ++ return *s1 - *s2; ++} ++ ++static uint32_t * ++wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n) ++{ ++ return memcpy (s1, s2, n * sizeof (uint32_t)); ++} ++ ++static uint32_t * ++wcschr_uint32 (const uint32_t *s, uint32_t ch) ++{ ++ do ++ if (*s == ch) ++ return (uint32_t *) s; ++ while (*s++ != 0); ++ return 0; ++} ++ + #endif /* locfile.h */ +diff --git a/locale/setlocale.c b/locale/setlocale.c +index 19ed85ae8e..f28ca11446 100644 +--- a/locale/setlocale.c ++++ b/locale/setlocale.c +@@ -63,35 +63,6 @@ static char *const _nl_current_used[] = + + #endif + +- +-/* Define an array of category names (also the environment variable names). */ +-const struct catnamestr_t _nl_category_names attribute_hidden = +- { +-#define DEFINE_CATEGORY(category, category_name, items, a) \ +- category_name, +-#include "categories.def" +-#undef DEFINE_CATEGORY +- }; +- +-const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden = +- { +-#define DEFINE_CATEGORY(category, category_name, items, a) \ +- [category] = offsetof (struct catnamestr_t, CATNAMEMF (__LINE__)), +-#include "categories.def" +-#undef DEFINE_CATEGORY +- }; +- +-/* An array of their lengths, for convenience. */ +-const uint8_t _nl_category_name_sizes[] attribute_hidden = +- { +-#define DEFINE_CATEGORY(category, category_name, items, a) \ +- [category] = sizeof (category_name) - 1, +-#include "categories.def" +-#undef DEFINE_CATEGORY +- [LC_ALL] = sizeof ("LC_ALL") - 1 +- }; +- +- + #ifdef NL_CURRENT_INDIRECT + # define WEAK_POSTLOAD(postload) weak_extern (postload) + #else diff --git a/recipes-core/glibc/glibc/0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch b/recipes-core/glibc/glibc/0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch new file mode 100644 index 0000000..50c2e14 --- /dev/null +++ b/recipes-core/glibc/glibc/0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch @@ -0,0 +1,80 @@ +From 13bc0e53cc91e102472d532f28b3d44c30d291fc Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 3 Aug 2018 09:42:06 -0700 +Subject: [PATCH] localedef --add-to-archive uses a hard-coded locale path + +it doesn't exist in normal use, and there's no way to pass an +alternative filename. + +Add a fallback of $LOCALEARCHIVE from the environment, and allow +creation of new locale archives that are not the system archive. + +Upstream-Status: Inappropriate (OE-specific) + +Signed-off-by: Ross Burton +Signed-off-by: Khem Raj +--- + locale/programs/locarchive.c | 35 +++++++++++++++++++++++++---------- + 1 file changed, 25 insertions(+), 10 deletions(-) + +diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c +index f38e835c52..8d8f8699b2 100644 +--- a/locale/programs/locarchive.c ++++ b/locale/programs/locarchive.c +@@ -340,12 +340,24 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) + struct namehashent *oldnamehashtab; + struct locarhandle new_ah; + size_t prefix_len = output_prefix ? strlen (output_prefix) : 0; +- char archivefname[prefix_len + sizeof (ARCHIVE_NAME)]; +- char fname[prefix_len + sizeof (ARCHIVE_NAME) + sizeof (".XXXXXX") - 1]; ++ char *archivefname; ++ char *fname; ++ char *envarchive = getenv("LOCALEARCHIVE"); + +- if (output_prefix) +- memcpy (archivefname, output_prefix, prefix_len); +- strcpy (archivefname + prefix_len, ARCHIVE_NAME); ++ if (envarchive != NULL) ++ { ++ archivefname = xmalloc(strlen(envarchive) + 1); ++ fname = xmalloc(strlen(envarchive) + sizeof (".XXXXXX")); ++ strcpy (archivefname, envarchive); ++ } ++ else ++ { ++ archivefname = xmalloc(prefix_len + sizeof (ARCHIVE_NAME)); ++ fname = xmalloc(prefix_len + sizeof (ARCHIVE_NAME) + sizeof (".XXXXXX") - 1); ++ if (output_prefix) ++ memcpy (archivefname, output_prefix, prefix_len); ++ strcpy (archivefname + prefix_len, ARCHIVE_NAME); ++ } + strcpy (stpcpy (fname, archivefname), ".XXXXXX"); + + /* Not all of the old file has to be mapped. Change this now this +@@ -569,10 +581,13 @@ open_archive (struct locarhandle *ah, bool readonly) + /* If ah has a non-NULL fname open that otherwise open the default. */ + if (archivefname == NULL) + { +- archivefname = default_fname; +- if (output_prefix) +- memcpy (default_fname, output_prefix, prefix_len); +- strcpy (default_fname + prefix_len, ARCHIVE_NAME); ++ archivefname = getenv("LOCALEARCHIVE"); ++ if (archivefname == NULL) { ++ archivefname = default_fname; ++ if (output_prefix) ++ memcpy (default_fname, output_prefix, prefix_len); ++ strcpy (default_fname + prefix_len, ARCHIVE_NAME); ++ } + } + + while (1) +@@ -585,7 +600,7 @@ open_archive (struct locarhandle *ah, bool readonly) + the default locale archive we ignore the failure and + list an empty archive, otherwise we print an error + and exit. */ +- if (errno == ENOENT && archivefname == default_fname) ++ if (errno == ENOENT) + { + if (readonly) + { diff --git a/recipes-core/glibc/glibc/0025-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch b/recipes-core/glibc/glibc/0025-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch new file mode 100644 index 0000000..fb0a609 --- /dev/null +++ b/recipes-core/glibc/glibc/0025-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch @@ -0,0 +1,53 @@ +From 50b605dece16606dd9d1c737e579c13725eab11d Mon Sep 17 00:00:00 2001 +From: Mark Hatle +Date: Thu, 18 Aug 2016 14:07:58 -0500 +Subject: [PATCH] elf/dl-deps.c: Make _dl_build_local_scope breadth first + +According to the ELF specification: + +When resolving symbolic references, the dynamic linker examines the symbol +tables with a breadth-first search. + +This function was using a depth first search. By doing so the conflict +resolution reported to the prelinker (when LD_TRACE_PRELINKING=1 is set) +was incorrect. This caused problems when their were various circular +dependencies between libraries. The problem usually manifested itself by +the wrong IFUNC being executed. + +[BZ# 20488] + +Upstream-Status: Submitted [libc-alpha] + +Signed-off-by: Mark Hatle +--- + elf/dl-deps.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/elf/dl-deps.c b/elf/dl-deps.c +index 087a49b212..c09f9334f2 100644 +--- a/elf/dl-deps.c ++++ b/elf/dl-deps.c +@@ -73,13 +73,19 @@ _dl_build_local_scope (struct link_map **list, struct link_map *map) + { + struct link_map **p = list; + struct link_map **q; ++ struct link_map **r; + + *p++ = map; + map->l_reserved = 1; +- if (map->l_initfini) +- for (q = map->l_initfini + 1; *q; ++q) +- if (! (*q)->l_reserved) +- p += _dl_build_local_scope (p, *q); ++ ++ for (r = list; r < p; ++r) ++ if ((*r)->l_initfini) ++ for (q = (*r)->l_initfini + 1; *q; ++q) ++ if (! (*q)->l_reserved) ++ { ++ *p++ = *q; ++ (*q)->l_reserved = 1; ++ } + return p - list; + } + diff --git a/recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch b/recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch new file mode 100644 index 0000000..998db39 --- /dev/null +++ b/recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch @@ -0,0 +1,31 @@ +From 99ab34278a6ebec134267412b4f619f43e278dea Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 3 Aug 2018 09:44:00 -0700 +Subject: [PATCH] intl: Emit no lines in bison generated files + +Improve reproducibility: +Do not put any #line preprocessor commands in bison generated files. +These lines contain absolute paths containing file locations on +the host build machine. + +Upstream-Status: Pending + +Signed-off-by: Juro Bystricky +Signed-off-by: Khem Raj +--- + intl/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/intl/Makefile b/intl/Makefile +index 93478d87e8..b27a7935eb 100644 +--- a/intl/Makefile ++++ b/intl/Makefile +@@ -155,7 +155,7 @@ $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out + + CPPFLAGS += -D'LOCALEDIR="$(localedir)"' \ + -D'LOCALE_ALIAS_PATH="$(localedir)"' +-BISONFLAGS = --yacc --name-prefix=__gettext --output ++BISONFLAGS = --yacc --no-lines --name-prefix=__gettext --output + + $(inst_localedir)/locale.alias: locale.alias $(+force) + $(do-install) diff --git a/recipes-core/glibc/glibc/0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch b/recipes-core/glibc/glibc/0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch new file mode 100644 index 0000000..2bfa2aa --- /dev/null +++ b/recipes-core/glibc/glibc/0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch @@ -0,0 +1,53 @@ +From 3190ada9ecaec915794886a608221655c120f90c Mon Sep 17 00:00:00 2001 +From: Martin Jansa +Date: Mon, 17 Dec 2018 21:36:18 +0000 +Subject: [PATCH] locale: prevent maybe-uninitialized errors with -Os [BZ + #19444] + +Fixes following error when building for aarch64 with -Os: +| In file included from strcoll_l.c:43: +| strcoll_l.c: In function '__strcoll_l': +| ../locale/weight.h:31:26: error: 'seq2.back_us' may be used uninitialized in this function [-Werror=maybe-uninitialized] +| int_fast32_t i = table[*(*cpp)++]; +| ^~~~~~~~~ +| strcoll_l.c:304:18: note: 'seq2.back_us' was declared here +| coll_seq seq1, seq2; +| ^~~~ +| In file included from strcoll_l.c:43: +| ../locale/weight.h:31:26: error: 'seq1.back_us' may be used uninitialized in this function [-Werror=maybe-uninitialized] +| int_fast32_t i = table[*(*cpp)++]; +| ^~~~~~~~~ +| strcoll_l.c:304:12: note: 'seq1.back_us' was declared here +| coll_seq seq1, seq2; +| ^~~~ + + Partial fix for [BZ #19444] + * locale/weight.h: Fix build with -Os. + +Upstream-Status: Submitted [https://patchwork.ozlabs.org/patch/1014766] + +Signed-off-by: Martin Jansa +Signed-off-by: Khem Raj +--- + locale/weight.h | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/locale/weight.h b/locale/weight.h +index 723e1fefda..f5798d379a 100644 +--- a/locale/weight.h ++++ b/locale/weight.h +@@ -28,7 +28,14 @@ findidx (const int32_t *table, + const unsigned char *extra, + const unsigned char **cpp, size_t len) + { ++ /* With GCC 8 when compiling with -Os the compiler warns that ++ seq1.back_us and seq2.back_us might be used uninitialized. ++ This uninitialized use is impossible for the same reason ++ as described in comments in locale/weightwc.h. */ ++ DIAG_PUSH_NEEDS_COMMENT; ++ DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); + int_fast32_t i = table[*(*cpp)++]; ++ DIAG_POP_NEEDS_COMMENT; + const unsigned char *cp; + const unsigned char *usrc; + diff --git a/recipes-core/glibc/glibc/0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch b/recipes-core/glibc/glibc/0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch new file mode 100644 index 0000000..8042caa --- /dev/null +++ b/recipes-core/glibc/glibc/0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch @@ -0,0 +1,29 @@ +From 5d201a75918a0e181ee6206f701901fdb91baf81 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:11:22 +0000 +Subject: [PATCH] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known names + +This bolts in a hook for OE to pass its own version of interpreter +names into glibc especially for multilib case, where it differs from any +other distros + +Upstream-Status: Inappropriate [OE specific] + +Signed-off-by: Lianhao Lu +Signed-off-by: Khem Raj +--- + elf/readlib.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/elf/readlib.c b/elf/readlib.c +index 7383c23249..e97ea9449d 100644 +--- a/elf/readlib.c ++++ b/elf/readlib.c +@@ -51,6 +51,7 @@ static struct known_names interpreters[] = + #ifdef SYSDEP_KNOWN_INTERPRETER_NAMES + SYSDEP_KNOWN_INTERPRETER_NAMES + #endif ++ OECORE_KNOWN_INTERPRETER_NAMES + }; + + static struct known_names known_libs[] = diff --git a/recipes-core/glibc/glibc/0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch b/recipes-core/glibc/glibc/0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch new file mode 100644 index 0000000..ece7925 --- /dev/null +++ b/recipes-core/glibc/glibc/0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch @@ -0,0 +1,67 @@ +From baba3c6021340a9070b734f931a15cea4cfe6c31 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 15 May 2020 17:05:45 -0700 +Subject: [PATCH] wordsize.h: Unify the header between arm and aarch64 + +This helps OE multilibs to not sythesize this header which causes all +kind of recursions and other issues since wordsize is fundamental header +and ends up including itself in many case e.g. clang tidy, bpf etc. + +Upstream-Status: Inappropriate [ OE-Specific ] + +Signed-off-by: Khem Raj +--- + sysdeps/aarch64/bits/wordsize.h | 8 ++++++-- + sysdeps/{aarch64 => arm}/bits/wordsize.h | 10 +++++++--- + 2 files changed, 13 insertions(+), 5 deletions(-) + copy sysdeps/{aarch64 => arm}/bits/wordsize.h (80%) + +diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h +index 91da566b74..9a754514b3 100644 +--- a/sysdeps/aarch64/bits/wordsize.h ++++ b/sysdeps/aarch64/bits/wordsize.h +@@ -17,12 +17,16 @@ + License along with the GNU C Library; if not, see + . */ + +-#ifdef __LP64__ ++#if defined (__aarch64__) && defined (__LP64__) + # define __WORDSIZE 64 +-#else ++#elif defined (__aarch64__) + # define __WORDSIZE 32 + # define __WORDSIZE32_SIZE_ULONG 1 + # define __WORDSIZE32_PTRDIFF_LONG 1 ++#else ++# define __WORDSIZE 32 ++# define __WORDSIZE32_SIZE_ULONG 0 ++# define __WORDSIZE32_PTRDIFF_LONG 0 + #endif + + #define __WORDSIZE_TIME64_COMPAT32 0 +diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/arm/bits/wordsize.h +similarity index 80% +copy from sysdeps/aarch64/bits/wordsize.h +copy to sysdeps/arm/bits/wordsize.h +index 91da566b74..34fcdef1f1 100644 +--- a/sysdeps/aarch64/bits/wordsize.h ++++ b/sysdeps/arm/bits/wordsize.h +@@ -17,12 +17,16 @@ + License along with the GNU C Library; if not, see + . */ + +-#ifdef __LP64__ ++#if defined (__aarch64__) && defined (__LP64__) + # define __WORDSIZE 64 +-#else ++#elif defined (__aarch64__) + # define __WORDSIZE 32 + # define __WORDSIZE32_SIZE_ULONG 1 + # define __WORDSIZE32_PTRDIFF_LONG 1 ++#else ++# define __WORDSIZE 32 ++# define __WORDSIZE32_SIZE_ULONG 0 ++# define __WORDSIZE32_PTRDIFF_LONG 0 + #endif + + #define __WORDSIZE_TIME64_COMPAT32 0 diff --git a/recipes-core/glibc/glibc/0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch b/recipes-core/glibc/glibc/0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch new file mode 100644 index 0000000..22df820 --- /dev/null +++ b/recipes-core/glibc/glibc/0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch @@ -0,0 +1,48 @@ +From 60aa53f547911163b42a1c436d695a15c87f34ee Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 7 Aug 2020 14:31:16 -0700 +Subject: [PATCH] powerpc: Do not ask compiler for finding arch + +This does not work well in cross compiling environments like OE +and moreover it uses its own -mcpu/-march options via cflags + +Upstream-Status: Inappropriate [ OE-Specific] + +Signed-off-by: Khem Raj +--- + sysdeps/powerpc/preconfigure | 5 +---- + sysdeps/powerpc/preconfigure.ac | 5 +---- + 2 files changed, 2 insertions(+), 8 deletions(-) + +diff --git a/sysdeps/powerpc/preconfigure b/sysdeps/powerpc/preconfigure +index dfe8e20399..bbff040f0f 100644 +--- a/sysdeps/powerpc/preconfigure ++++ b/sysdeps/powerpc/preconfigure +@@ -29,10 +29,7 @@ esac + # directive which shows up, and try using it. + case "${machine}:${submachine}" in + *powerpc*:) +- archcpu=`echo "int foo () { return 0; }" \ +- | $CC $CFLAGS $CPPFLAGS -S -frecord-gcc-switches -xc -o - - \ +- | grep -E "mcpu=|.machine" -m 1 \ +- | sed -e "s/.*machine //" -e "s/.*mcpu=\(.*\)\"/\1/"` ++ archcpu='' + # Note if you add patterns here you must ensure that an appropriate + # directory exists in sysdeps/powerpc. Likewise, if we find a + # cpu, don't let the generic configure append extra compiler options. +diff --git a/sysdeps/powerpc/preconfigure.ac b/sysdeps/powerpc/preconfigure.ac +index 6c63bd8257..3e925f1d48 100644 +--- a/sysdeps/powerpc/preconfigure.ac ++++ b/sysdeps/powerpc/preconfigure.ac +@@ -29,10 +29,7 @@ esac + # directive which shows up, and try using it. + case "${machine}:${submachine}" in + *powerpc*:) +- archcpu=`echo "int foo () { return 0; }" \ +- | $CC $CFLAGS $CPPFLAGS -S -frecord-gcc-switches -xc -o - - \ +- | grep -E "mcpu=|[.]machine" -m 1 \ +- | sed -e "s/.*machine //" -e "s/.*mcpu=\(.*\)\"/\1/"` ++ archcpu='' + # Note if you add patterns here you must ensure that an appropriate + # directory exists in sysdeps/powerpc. Likewise, if we find a + # cpu, don't let the generic configure append extra compiler options. diff --git a/recipes-core/glibc/glibc/CVE-2021-43396.patch b/recipes-core/glibc/glibc/CVE-2021-43396.patch new file mode 100644 index 0000000..ebea5ef --- /dev/null +++ b/recipes-core/glibc/glibc/CVE-2021-43396.patch @@ -0,0 +1,184 @@ +From ff012870b2c02a62598c04daa1e54632e020fd7d Mon Sep 17 00:00:00 2001 +From: Nikita Popov +Date: Tue, 2 Nov 2021 13:21:42 +0500 +Subject: [PATCH] gconv: Do not emit spurious NUL character in ISO-2022-JP-3 + (bug 28524) + +Bugfix 27256 has introduced another issue: +In conversion from ISO-2022-JP-3 encoding, it is possible +to force iconv to emit extra NUL character on internal state reset. +To do this, it is sufficient to feed iconv with escape sequence +which switches active character set. +The simplified check 'data->__statep->__count != ASCII_set' +introduced by the aforementioned bugfix picks that case and +behaves as if '\0' character has been queued thus emitting it. + +To eliminate this issue, these steps are taken: +* Restore original condition +'(data->__statep->__count & ~7) != ASCII_set'. +It is necessary since bits 0-2 may contain +number of buffered input characters. +* Check that queued character is not NUL. +Similar step is taken for main conversion loop. + +Bundled test case follows following logic: +* Try to convert ISO-2022-JP-3 escape sequence +switching active character set +* Reset internal state by providing NULL as input buffer +* Ensure that nothing has been converted. + +Signed-off-by: Nikita Popov + +CVE: CVE-2021-43396 +Upstream-Status: Backport [ff012870b2c02a62598c04daa1e54632e020fd7d] +--- + iconvdata/Makefile | 5 +++- + iconvdata/bug-iconv15.c | 60 +++++++++++++++++++++++++++++++++++++++ + iconvdata/iso-2022-jp-3.c | 28 ++++++++++++------ + 3 files changed, 84 insertions(+), 9 deletions(-) + create mode 100644 iconvdata/bug-iconv15.c + +Index: git/iconvdata/Makefile +=================================================================== +--- git.orig/iconvdata/Makefile ++++ git/iconvdata/Makefile +@@ -1,4 +1,5 @@ + # Copyright (C) 1997-2021 Free Software Foundation, Inc. ++# Copyright (C) The GNU Toolchain Authors. + # This file is part of the GNU C Library. + + # The GNU C Library is free software; you can redistribute it and/or +@@ -74,7 +75,7 @@ ifeq (yes,$(build-shared)) + tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \ + tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9 \ + bug-iconv10 bug-iconv11 bug-iconv12 tst-iconv-big5-hkscs-to-2ucs4 \ +- bug-iconv13 bug-iconv14 ++ bug-iconv13 bug-iconv14 bug-iconv15 + ifeq ($(have-thread-library),yes) + tests += bug-iconv3 + endif +@@ -327,6 +328,8 @@ $(objpfx)bug-iconv12.out: $(addprefix $( + $(addprefix $(objpfx),$(modules.so)) + $(objpfx)bug-iconv14.out: $(addprefix $(objpfx), $(gconv-modules)) \ + $(addprefix $(objpfx),$(modules.so)) ++$(objpfx)bug-iconv15.out: $(addprefix $(objpfx), $(gconv-modules)) \ ++ $(addprefix $(objpfx),$(modules.so)) + + $(objpfx)iconv-test.out: run-iconv-test.sh \ + $(addprefix $(objpfx), $(gconv-modules)) \ +Index: git/iconvdata/bug-iconv15.c +=================================================================== +--- /dev/null ++++ git/iconvdata/bug-iconv15.c +@@ -0,0 +1,60 @@ ++/* Bug 28524: Conversion from ISO-2022-JP-3 with iconv ++ may emit spurious NUL character on state reset. ++ Copyright (C) The GNU Toolchain Authors. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++ ++static int ++do_test (void) ++{ ++ char in[] = "\x1b(I"; ++ char *inbuf = in; ++ size_t inleft = sizeof (in) - 1; ++ char out[1]; ++ char *outbuf = out; ++ size_t outleft = sizeof (out); ++ iconv_t cd; ++ ++ cd = iconv_open ("UTF8", "ISO-2022-JP-3"); ++ TEST_VERIFY_EXIT (cd != (iconv_t) -1); ++ ++ /* First call to iconv should alter internal state. ++ Now, JISX0201_Kana_set is selected and ++ state value != ASCII_set. */ ++ TEST_VERIFY (iconv (cd, &inbuf, &inleft, &outbuf, &outleft) != (size_t) -1); ++ ++ /* No bytes should have been added to ++ the output buffer at this point. */ ++ TEST_VERIFY (outbuf == out); ++ TEST_VERIFY (outleft == sizeof (out)); ++ ++ /* Second call shall emit spurious NUL character in unpatched glibc. */ ++ TEST_VERIFY (iconv (cd, NULL, NULL, &outbuf, &outleft) != (size_t) -1); ++ ++ /* No characters are expected to be produced. */ ++ TEST_VERIFY (outbuf == out); ++ TEST_VERIFY (outleft == sizeof (out)); ++ ++ TEST_VERIFY_EXIT (iconv_close (cd) != -1); ++ ++ return 0; ++} ++ ++#include +Index: git/iconvdata/iso-2022-jp-3.c +=================================================================== +--- git.orig/iconvdata/iso-2022-jp-3.c ++++ git/iconvdata/iso-2022-jp-3.c +@@ -1,5 +1,6 @@ + /* Conversion module for ISO-2022-JP-3. + Copyright (C) 1998-2021 Free Software Foundation, Inc. ++ Copyright (C) The GNU Toolchain Authors. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998, + and Bruno Haible , 2002. +@@ -81,20 +82,31 @@ enum + the output state to the initial state. This has to be done during the + flushing. */ + #define EMIT_SHIFT_TO_INIT \ +- if (data->__statep->__count != ASCII_set) \ ++ if ((data->__statep->__count & ~7) != ASCII_set) \ + { \ + if (FROM_DIRECTION) \ + { \ +- if (__glibc_likely (outbuf + 4 <= outend)) \ ++ uint32_t ch = data->__statep->__count >> 6; \ ++ \ ++ if (__glibc_unlikely (ch != 0)) \ + { \ +- /* Write out the last character. */ \ +- *((uint32_t *) outbuf) = data->__statep->__count >> 6; \ +- outbuf += sizeof (uint32_t); \ +- data->__statep->__count = ASCII_set; \ ++ if (__glibc_likely (outbuf + 4 <= outend)) \ ++ { \ ++ /* Write out the last character. */ \ ++ put32u (outbuf, ch); \ ++ outbuf += 4; \ ++ data->__statep->__count &= 7; \ ++ data->__statep->__count |= ASCII_set; \ ++ } \ ++ else \ ++ /* We don't have enough room in the output buffer. */ \ ++ status = __GCONV_FULL_OUTPUT; \ + } \ + else \ +- /* We don't have enough room in the output buffer. */ \ +- status = __GCONV_FULL_OUTPUT; \ ++ { \ ++ data->__statep->__count &= 7; \ ++ data->__statep->__count |= ASCII_set; \ ++ } \ + } \ + else \ + { \ diff --git a/recipes-core/glibc/glibc/check-test-wrapper b/recipes-core/glibc/glibc/check-test-wrapper new file mode 100644 index 0000000..6ec9b9b --- /dev/null +++ b/recipes-core/glibc/glibc/check-test-wrapper @@ -0,0 +1,80 @@ +#!/usr/bin/env python3 +import sys +import os +import subprocess +import resource + +env = os.environ.copy() +args = sys.argv[1:] +targettype = args.pop(0) + +if targettype == "user": + qemuargs = os.environ.get("QEMU_OPTIONS", "").split() + if not os.path.exists(qemuargs[0]): + # ensure qemu args has a valid absolute path + for i in os.environ.get("PATH", "").split(":"): + if os.path.exists(os.path.join(i, qemuargs[0])): + qemuargs[0] = os.path.join(i, qemuargs[0]) + break + sysroot = os.environ.get("QEMU_SYSROOT", None) + if not sysroot: + sys.exit(-1) + libpaths = [sysroot + "/usr/lib", sysroot + "/lib"] + + if args[0] == "env": + args.pop(0) + if len(args) == 0: + args = ["env"] + else: + # process options + while args[0].startswith("-"): + opt = args.pop(0).lstrip("-") + if "i" in opt: + env.clear() + # process environment vars + while "=" in args[0]: + key, val = args.pop(0).split("=", 1) + if key == "LD_LIBRARY_PATH": + libpaths += val.split(":") + else: + env[key] = val + if args[0] == "cp": + # ignore copies, the filesystem is the same + sys.exit(0) + + qemuargs += ["-L", sysroot] + qemuargs += ["-E", "LD_LIBRARY_PATH={}".format(":".join(libpaths))] + command = qemuargs + args + + # We've seen qemu-arm using up all system memory for some glibc + # tests e.g. nptl/tst-pthread-timedlock-lockloop + # Cap at 8GB since no test should need more than that + # (5GB adds 7 failures for qemuarm glibc test run) + limit = 8*1024*1024*1024 + resource.setrlimit(resource.RLIMIT_AS, (limit, limit)) + +elif targettype == "ssh": + host = os.environ.get("SSH_HOST", None) + user = os.environ.get("SSH_HOST_USER", None) + port = os.environ.get("SSH_HOST_PORT", None) + + command = ["ssh", "-o", "UserKnownHostsFile=/dev/null", "-o", "StrictHostKeyChecking=no"] + if port: + command += ["-p", str(port)] + if not host: + sys.exit(-1) + command += ["{}@{}".format(user, host) if user else host] + + # wrap and replace quotes for correct transformation on ssh + wrapped = " ".join(["'{0}'".format(i.replace("'", r"'\''")) for i in ["cd", os.getcwd()]]) + "; " + wrapped += " ".join(["'{0}'".format(i.replace("'", r"'\''")) for i in args]) + command += ["sh", "-c", "\"{}\"".format(wrapped)] +else: + sys.exit(-1) + +try: + r = subprocess.run(command, timeout = 1800, env = env) + sys.exit(r.returncode) +except subprocess.TimeoutExpired: + sys.exit(-1) + diff --git a/recipes-core/glibc/glibc/etc/ld.so.conf b/recipes-core/glibc/glibc/etc/ld.so.conf new file mode 100644 index 0000000..83327c0 --- /dev/null +++ b/recipes-core/glibc/glibc/etc/ld.so.conf @@ -0,0 +1 @@ +include /etc/ld.so.conf.d/*.conf diff --git a/recipes-core/glibc/glibc/generate-supported.mk b/recipes-core/glibc/glibc/generate-supported.mk new file mode 100644 index 0000000..d2a28c2 --- /dev/null +++ b/recipes-core/glibc/glibc/generate-supported.mk @@ -0,0 +1,11 @@ +#!/usr/bin/make + +include $(IN) + +all: + rm -f $(OUT) + touch $(OUT) + for locale in $(SUPPORTED-LOCALES); do \ + [ $$locale = true ] && continue; \ + echo $$locale | sed 's,/, ,' >> $(OUT); \ + done diff --git a/recipes-core/glibc/glibc/makedbs.sh b/recipes-core/glibc/glibc/makedbs.sh new file mode 100755 index 0000000..7d51a67 --- /dev/null +++ b/recipes-core/glibc/glibc/makedbs.sh @@ -0,0 +1,177 @@ +#!/bin/sh + +# +# Make passwd.db, group.db, etc. +# + +VAR_DB=/var/db + +# Use make if available +if [ -x /usr/bin/make -o -x /bin/make ]; then + make -C $VAR_DB + exit 0 +fi + +# No make available, do it in hard way + +# passwd.db +if [ -e /etc/passwd ]; then +target=$VAR_DB/passwd.db +echo -n "passwd... " +awk 'BEGIN { FS=":"; OFS=":" } \ + /^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print; \ + printf "=%s ", $$3; print }' /etc/passwd | \ +makedb --quiet -o $target - +echo "done." +fi + +# group.db +if [ -e /etc/group ]; then +target=$VAR_DB/group.db +echo -n "group... " +awk 'BEGIN { FS=":"; OFS=":" } \ + /^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print; \ + printf "=%s ", $$3; print; \ + if ($$4 != "") { \ + split($$4, grmems, ","); \ + for (memidx in grmems) { \ + mem=grmems[memidx]; \ + if (members[mem] == "") \ + members[mem]=$$3; \ + else \ + members[mem]=members[mem] "," $$3; \ + } \ + delete grmems; } } \ + END { for (mem in members) \ + printf ":%s %s %s\n", mem, mem, members[mem]; }' /etc/group | \ +makedb --quiet -o $target - +echo "done." +fi + +# ethers.db +if [ -e /etc/ethers ]; then +target=$VAR_DB/ethers.db +echo -n "ethers... " +awk '/^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print; \ + printf "=%s ", $$2; print }' /etc/ethers | \ +makedb --quiet -o $target - +echo "done." +fi + +# protocols.db +if [ -e /etc/protocols ]; then +target=$VAR_DB/protocols.db +echo -n "protocols... " +awk '/^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print; \ + printf "=%s ", $$2; print; \ + for (i = 3; i <= NF && !($$i ~ /^#/); ++i) \ + { printf ".%s ", $$i; print } }' /etc/protocols | \ +makedb --quiet -o $target - +echo "done." +fi + +# rpc.db +if [ -e /etc/rpc ]; then +target=$VAR_DB/rpc.db +echo -n "rpc... " +awk '/^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print; \ + printf "=%s ", $$2; print; \ + for (i = 3; i <= NF && !($$i ~ /^#/); ++i) \ + { printf ".%s ", $$i; print } }' /etc/rpc | \ +makedb --quiet -o $target - +echo "done." +fi + +# services.db +if [ -e /etc/services ]; then +target=$VAR_DB/services.db +echo -n "services... " +awk 'BEGIN { FS="[ \t/]+" } \ + /^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { sub(/[ \t]*#.*$$/, "");\ + printf ":%s/%s ", $$1, $$3; print; \ + printf ":%s/ ", $$1; print; \ + printf "=%s/%s ", $$2, $$3; print; \ + printf "=%s/ ", $$2; print; \ + for (i = 4; i <= NF && !($$i ~ /^#/); ++i) \ + { printf ":%s/%s ", $$i, $$3; print; \ + printf ":%s/ ", $$i; print } }' /etc/services | \ +makedb --quiet -o $target - +echo "done." +fi + +# shadow.db +if [ -e /etc/shadow ]; then +target=$VAR_DB/shadow.db +echo -n "shadow... " +awk 'BEGIN { FS=":"; OFS=":" } \ + /^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print }' /etc/shadow | \ +(umask 077 && makedb --quiet -o $target -) +echo "done." +if chgrp shadow $target 2>/dev/null; then + chmod g+r $target +else + chown 0 $target; chgrp 0 $target; chmod 600 $target; + echo + echo "Warning: The shadow password database $target" + echo "has been set to be readable only by root. You may want" + echo "to make it readable by the \`shadow' group depending" + echo "on your configuration." + echo +fi +fi + +# gshadow.db +if [ -e /etc/gshadow ]; then +target=$VAR_DB/gshadow.db +echo -n "gshadow... " +awk 'BEGIN { FS=":"; OFS=":" } \ + /^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print }' /etc/gshadow | \ +(umask 077 && makedb --quiet -o $target -) +echo "done." +if chgrp shadow $target 2>/dev/null; then + chmod g+r $target +else + chown 0 $target; chgrp 0 $target; chmod 600 $target + echo + echo "Warning: The shadow group database $target" + echo "has been set to be readable only by root. You may want" + echo "to make it readable by the \`shadow' group depending" + echo "on your configuration." + echo +fi +fi + +# netgroup.db +if [ -e /etc/netgroup ]; then +target=$VAR_DB/netgroup.db +echo -n "netgroup... " +awk 'BEGIN { ini=1 } \ + /^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { if (sub(/[ \t]*\\$$/, " ") == 0) end="\n"; \ + else end=""; \ + gsub(/[ \t]+/, " "); \ + sub(/^[ \t]*/, ""); \ + if (ini == 0) printf "%s%s", $$0, end; \ + else printf ".%s %s%s", $$1, $$0, end; \ + ini=end == "" ? 0 : 1; } \ + END { if (ini==0) printf "\n" }' /etc/netgroup | \ +makedb --quiet -o $target +echo "done." +fi diff --git a/recipes-core/glibc/glibc_arc64.bb b/recipes-core/glibc/glibc_arc64.bb new file mode 100644 index 0000000..9a1aa46 --- /dev/null +++ b/recipes-core/glibc/glibc_arc64.bb @@ -0,0 +1,142 @@ +require recipes-core/glibc/glibc.inc +require glibc-version.inc + +CVE_CHECK_IGNORE += "CVE-2020-10029 CVE-2021-27645" + +# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010022 +# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010023 +# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010024 +# Upstream glibc maintainers dispute there is any issue and have no plans to address it further. +# "this is being treated as a non-security bug and no real threat." +CVE_CHECK_IGNORE += "CVE-2019-1010022 CVE-2019-1010023 CVE-2019-1010024" + +# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010025 +# Allows for ASLR bypass so can bypass some hardening, not an exploit in itself, may allow +# easier access for another. "ASLR bypass itself is not a vulnerability." +# Potential patch at https://sourceware.org/bugzilla/show_bug.cgi?id=22853 +CVE_CHECK_IGNORE += "CVE-2019-1010025" + +DEPENDS += "gperf-native bison-native make-native" + +NATIVESDKFIXES ?= "" +NATIVESDKFIXES:class-nativesdk = "\ + file://0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch \ + file://0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch \ + file://0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch \ + file://0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch \ + file://0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch \ + file://0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch \ +" + +SRC_URI = "${GLIBC_GIT_URI};protocol=https;branch=${SRCBRANCH};name=glibc \ + file://etc/ld.so.conf \ + file://generate-supported.mk \ + file://makedbs.sh \ + \ + ${NATIVESDKFIXES} \ + file://0009-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch \ + file://0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch \ + file://0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch \ + file://0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch \ + file://0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch \ + file://0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch \ + file://0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch \ + file://0016-yes-within-the-path-sets-wrong-config-variables.patch \ + file://0017-timezone-re-written-tzselect-as-posix-sh.patch \ + file://0018-Remove-bash-dependency-for-nscd-init-script.patch \ + file://0019-eglibc-Cross-building-and-testing-instructions.patch \ + file://0020-eglibc-Help-bootstrap-cross-toolchain.patch \ + file://0021-eglibc-Resolve-__fpscr_values-on-SH4.patch \ + file://0022-eglibc-Forward-port-cross-locale-generation-support.patch \ + file://0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ + file://0025-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \ + file://0026-intl-Emit-no-lines-in-bison-generated-files.patch \ + file://0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch \ + file://0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \ + file://0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch \ + file://0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch \ + file://0001-CVE-2021-38604.patch \ + file://0002-CVE-2021-38604.patch \ + file://0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \ + file://CVE-2021-43396.patch \ + file://0001-CVE-2022-23218.patch \ + file://0002-CVE-2022-23218.patch \ + file://0001-CVE-2022-23219.patch \ + file://0002-CVE-2022-23219.patch \ + file://0001-CVE-2021-3998.patch \ + file://0002-CVE-2021-3998.patch \ + file://0001-CVE-2021-3999.patch \ + file://0002-CVE-2021-3999.patch \ + " +S = "${WORKDIR}/git" +B = "${WORKDIR}/build-${TARGET_SYS}" + +PACKAGES_DYNAMIC = "" + +# the -isystem in bitbake.conf screws up glibc do_stage +BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}" +TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}" + +GLIBC_BROKEN_LOCALES = "" + +GLIBCPIE ??= "" + +EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \ + --disable-profile \ + --disable-debug --without-gd \ + --enable-clocale=gnu \ + --with-headers=${STAGING_INCDIR} \ + --without-selinux \ + --enable-tunables \ + --enable-bind-now \ + --enable-stack-protector=strong \ + --disable-crypt \ + --with-default-link \ + ${@bb.utils.contains_any('SELECTED_OPTIMIZATION', '-O0 -Og', '--disable-werror', '', d)} \ + ${GLIBCPIE} \ + ${GLIBC_EXTRA_OECONF}" + +EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}" + +EXTRA_OECONF:append:x86 = " ${@bb.utils.contains_any('TUNE_FEATURES', 'i586 c3', '--disable-cet', '--enable-cet', d)}" +EXTRA_OECONF:append:x86-64 = " --enable-cet" + +PACKAGECONFIG ??= "nscd memory-tagging" +PACKAGECONFIG[nscd] = "--enable-nscd,--disable-nscd" +PACKAGECONFIG[memory-tagging] = "--enable-memory-tagging,--disable-memory-tagging" + +do_patch:append() { + bb.build.exec_func('do_fix_readlib_c', d) +} + +do_fix_readlib_c () { + sed -i -e 's#OECORE_KNOWN_INTERPRETER_NAMES#${EGLIBC_KNOWN_INTERPRETER_NAMES}#' ${S}/elf/readlib.c +} + +do_configure () { +# override this function to avoid the autoconf/automake/aclocal/autoheader +# calls for now +# don't pass CPPFLAGS into configure, since it upsets the kernel-headers +# version check and doesn't really help with anything + (cd ${S} && gnu-configize) || die "failure in running gnu-configize" + find ${S} -name "configure" | xargs touch + CPPFLAGS="" oe_runconf +} + +LDFLAGS += "-fuse-ld=bfd" +do_compile () { + base_do_compile + echo "Adjust ldd script" + if [ -n "${RTLDLIST}" ] + then + prevrtld=`cat ${B}/elf/ldd | grep "^RTLDLIST=" | sed 's#^RTLDLIST="\?\([^"]*\)"\?$#\1#'` + # remove duplicate entries + newrtld=`echo $(printf '%s\n' ${prevrtld} ${RTLDLIST} | LC_ALL=C sort -u)` + echo "ldd \"${prevrtld} ${RTLDLIST}\" -> \"${newrtld}\"" + sed -i ${B}/elf/ldd -e "s#^RTLDLIST=.*\$#RTLDLIST=\"${newrtld}\"#" + fi +} + +require glibc-package.inc + +BBCLASSEXTEND = "nativesdk" diff --git a/recipes-devtools/binutils/binutils-arc.inc b/recipes-devtools/binutils/binutils-arc.inc index 1bd3b2a..b085610 100644 --- a/recipes-devtools/binutils/binutils-arc.inc +++ b/recipes-devtools/binutils/binutils-arc.inc @@ -10,32 +10,25 @@ LIC_FILES_CHKSUM="\ file://bfd/COPYING;md5=d32239bcb673463ab874e80d47fae504\ " -# When upgrading to 2.37, please make sure there is no trailing .0, so -# that upstream version check can work correctly. PV = "arc" -CVE_VERSION = "2.36.1" +CVE_VERSION = "2.38" -RELEASE ?= "arc-2021.03" +RELEASE ?= "arc-2022.03" BINUTILS_GIT_URI ?= "git://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb.git;protocol=https;branch=${RELEASE}" -SRCREV ?= "${RELEASE}-release" +# SRCREV tagged arc-2022.03-release +SRCREV ?= "159d1d05c170512094ff3926978259ad94d3beae" SRC_URI = "\ ${BINUTILS_GIT_URI} \ - file://0004-configure-widen-the-regexp-for-SH-architectures.patch \ - file://0005-Point-scripts-location-to-libdir.patch \ - file://0006-Only-generate-an-RPATH-entry-if-LD_RUN_PATH-is-not-e.patch \ - file://0007-don-t-let-the-distro-compiler-point-to-the-wrong-ins.patch \ - file://0008-warn-for-uses-of-system-directories-when-cross-linki.patch \ - file://0009-Change-default-emulation-for-mips64-linux.patch \ - file://0010-Add-support-for-Netlogic-XLP.patch \ - file://0011-fix-the-incorrect-assembling-for-ppc-wait-mnemonic.patch \ - file://0012-Detect-64-bit-MIPS-targets.patch \ - file://0013-Use-libtool-2.4.patch \ - file://0014-Fix-rpath-in-libtool-when-sysroot-is-enabled.patch \ - file://0015-sync-with-OE-libtool-changes.patch \ - file://0016-Check-for-clang-before-checking-gcc-version.patch \ - file://0017-Add-support-for-the-DW_FORM_strx-forms-to-the-BFD-li.patch \ - file://0018-Add-DWARF-5-support-in-gold.patch \ - file://CVE-2021-20197.patch \ + file://0004-Point-scripts-location-to-libdir.patch \ + file://0005-Only-generate-an-RPATH-entry-if-LD_RUN_PATH-is-not-e.patch \ + file://0006-don-t-let-the-distro-compiler-point-to-the-wrong-ins.patch \ + file://0007-warn-for-uses-of-system-directories-when-cross-linki.patch \ + file://0008-fix-the-incorrect-assembling-for-ppc-wait-mnemonic.patch \ + file://0009-Use-libtool-2.4.patch \ + file://0010-Fix-rpath-in-libtool-when-sysroot-is-enabled.patch \ + file://0011-sync-with-OE-libtool-changes.patch \ + file://0012-Check-for-clang-before-checking-gcc-version.patch \ " + S = "${WORKDIR}/git" diff --git a/recipes-devtools/binutils/binutils/0001-binutils-crosssdk-Generate-relocatable-SDKs.patch b/recipes-devtools/binutils/binutils/0001-binutils-crosssdk-Generate-relocatable-SDKs.patch index 49dacfe..481f192 100644 --- a/recipes-devtools/binutils/binutils/0001-binutils-crosssdk-Generate-relocatable-SDKs.patch +++ b/recipes-devtools/binutils/binutils/0001-binutils-crosssdk-Generate-relocatable-SDKs.patch @@ -1,7 +1,7 @@ -From 3b278a56a0e98d50ec62735598ee5f4b1834e8b3 Mon Sep 17 00:00:00 2001 +From cc97105c736ac6192c7e4fc0478ad86b07ca16aa Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 2 Mar 2015 01:58:54 +0000 -Subject: [PATCH] binutils-crosssdk: Generate relocatable SDKs +Subject: [PATCH 01/12] binutils-crosssdk: Generate relocatable SDKs This patch will modify the ELF linker scripts so that the crosssdk linker will generate binaries with a 4096 bytes PT_INTERP section. When the binaries @@ -21,10 +21,10 @@ Signed-off-by: Khem Raj 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gold/layout.cc b/gold/layout.cc -index a27cb071c75..32b52890b39 100644 +index 3efe8d98ae9..9cc389664a6 100644 --- a/gold/layout.cc +++ b/gold/layout.cc -@@ -5032,7 +5032,7 @@ Layout::create_interp(const Target* target) +@@ -5033,7 +5033,7 @@ Layout::create_interp(const Target* target) gold_assert(interp != NULL); } @@ -34,7 +34,7 @@ index a27cb071c75..32b52890b39 100644 Output_section_data* odata = new Output_data_const(interp, len, 1); diff --git a/ld/genscripts.sh b/ld/genscripts.sh -index 088417ef2d5..46a2db7005c 100755 +index 278f212bdad..0c52ebee4d0 100755 --- a/ld/genscripts.sh +++ b/ld/genscripts.sh @@ -304,6 +304,7 @@ DATA_ALIGNMENT_u="${DATA_ALIGNMENT_u-${DATA_ALIGNMENT_r}}" @@ -59,10 +59,10 @@ index 088417ef2d5..46a2db7005c 100755 DATA_ALIGNMENT=${DATA_ALIGNMENT_} RELOCATING=" " diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc -index 29a8f0781d5..75e46f4adaf 100644 +index bf2268bb0ad..b1811ef130f 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc -@@ -147,8 +147,8 @@ if test -z "$DATA_SEGMENT_ALIGN"; then +@@ -148,8 +148,8 @@ if test -z "$DATA_SEGMENT_ALIGN"; then DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);" fi fi @@ -73,3 +73,6 @@ index 29a8f0781d5..75e46f4adaf 100644 fi if test -z "$PLT"; then IPLT=".iplt ${RELOCATING-0} : { *(.iplt) }" +-- +2.25.1 + diff --git a/recipes-devtools/binutils/binutils/0002-binutils-cross-Do-not-generate-linker-script-directo.patch b/recipes-devtools/binutils/binutils/0002-binutils-cross-Do-not-generate-linker-script-directo.patch index d079474..78dadcc 100644 --- a/recipes-devtools/binutils/binutils/0002-binutils-cross-Do-not-generate-linker-script-directo.patch +++ b/recipes-devtools/binutils/binutils/0002-binutils-cross-Do-not-generate-linker-script-directo.patch @@ -1,7 +1,8 @@ -From cf4c8a97b7dc1fe36a7d5dabed417fe18b15ad6b Mon Sep 17 00:00:00 2001 +From 54d2965b13be9d9b81d46088607ba186e7a28ce5 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 6 Mar 2017 23:37:05 -0800 -Subject: [PATCH] binutils-cross: Do not generate linker script directories +Subject: [PATCH 02/12] binutils-cross: Do not generate linker script + directories We don't place target libraries within ${exec_prefix}, we'd always place these within the target sysroot within the standard library directories. Worse, the @@ -22,7 +23,7 @@ Signed-off-by: Khem Raj 1 file changed, 25 deletions(-) diff --git a/ld/genscripts.sh b/ld/genscripts.sh -index 46a2db7005c..4bb7c33f560 100755 +index 0c52ebee4d0..1acbe66bd2e 100755 --- a/ld/genscripts.sh +++ b/ld/genscripts.sh @@ -235,31 +235,6 @@ append_to_lib_path() @@ -57,3 +58,6 @@ index 46a2db7005c..4bb7c33f560 100755 if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then libs=${NATIVE_LIB_DIRS} if [ "x${NATIVE}" = "xyes" ] ; then +-- +2.25.1 + diff --git a/recipes-devtools/binutils/binutils/0003-binutils-nativesdk-Search-for-alternative-ld.so.conf.patch b/recipes-devtools/binutils/binutils/0003-binutils-nativesdk-Search-for-alternative-ld.so.conf.patch index cc37d30..e60a1bd 100644 --- a/recipes-devtools/binutils/binutils/0003-binutils-nativesdk-Search-for-alternative-ld.so.conf.patch +++ b/recipes-devtools/binutils/binutils/0003-binutils-nativesdk-Search-for-alternative-ld.so.conf.patch @@ -1,8 +1,8 @@ -From 9701cab0fdf6a0c011978ae140c4c12a962956f6 Mon Sep 17 00:00:00 2001 +From 9220f491d829fbecce80fe87964c5432ab8f491c Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 19 Feb 2020 09:51:16 -0800 -Subject: [PATCH] binutils-nativesdk: Search for alternative ld.so.conf in SDK - installation +Subject: [PATCH 03/12] binutils-nativesdk: Search for alternative ld.so.conf + in SDK installation We need binutils to look at our ld.so.conf file within the SDK to ensure we search the SDK's libdirs as well as those from the host system. @@ -29,7 +29,7 @@ Signed-off-by: Khem Raj 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ld/Makefile.am b/ld/Makefile.am -index 2c9a487335c..3b01357b651 100644 +index 48f22e8ad93..ee4b339f8f1 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -42,7 +42,8 @@ ZLIBINC = @zlibinc@ @@ -43,10 +43,10 @@ index 2c9a487335c..3b01357b651 100644 NO_WERROR = @NO_WERROR@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) diff --git a/ld/Makefile.in b/ld/Makefile.in -index b41941c89e2..a6382bf2a45 100644 +index f82dd7e6e5f..65cb955c7ce 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in -@@ -554,7 +554,8 @@ ZLIB = @zlibdir@ -lz +@@ -556,7 +556,8 @@ ZLIB = @zlibdir@ -lz ZLIBINC = @zlibinc@ ELF_CLFAGS = -DELF_LIST_OPTIONS=@elf_list_options@ \ -DELF_SHLIB_LIST_OPTIONS=@elf_shlib_list_options@ \ @@ -57,10 +57,10 @@ index b41941c89e2..a6382bf2a45 100644 AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) diff --git a/ld/ldelf.c b/ld/ldelf.c -index f7407ab55a7..b25781cc0c4 100644 +index 33c6a9f1f46..974b83d7678 100644 --- a/ld/ldelf.c +++ b/ld/ldelf.c -@@ -911,7 +911,7 @@ ldelf_check_ld_so_conf (const struct bfd_link_needed_list *l, int force, +@@ -930,7 +930,7 @@ ldelf_check_ld_so_conf (const struct bfd_link_needed_list *l, int force, info.path = NULL; info.len = info.alloc = 0; @@ -70,7 +70,7 @@ index f7407ab55a7..b25781cc0c4 100644 if (!ldelf_parse_ld_so_conf (&info, tmppath)) { diff --git a/ld/ldmain.c b/ld/ldmain.c -index 863df0293ea..080b1c4c6c2 100644 +index ea72b14a301..1ae90a77749 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -70,6 +70,7 @@ char *program_name; @@ -82,7 +82,7 @@ index 863df0293ea..080b1c4c6c2 100644 /* The canonical representation of ld_sysroot. */ char *ld_canon_sysroot; diff --git a/ld/ldmain.h b/ld/ldmain.h -index 38e63922d31..0966914938c 100644 +index f6d05a02f59..e60292cd522 100644 --- a/ld/ldmain.h +++ b/ld/ldmain.h @@ -23,6 +23,7 @@ @@ -93,3 +93,6 @@ index 38e63922d31..0966914938c 100644 extern char *ld_canon_sysroot; extern int ld_canon_sysroot_len; extern FILE *saved_script_handle; +-- +2.25.1 + diff --git a/recipes-devtools/binutils/binutils/0005-Point-scripts-location-to-libdir.patch b/recipes-devtools/binutils/binutils/0004-Point-scripts-location-to-libdir.patch similarity index 80% rename from recipes-devtools/binutils/binutils/0005-Point-scripts-location-to-libdir.patch rename to recipes-devtools/binutils/binutils/0004-Point-scripts-location-to-libdir.patch index dde0cb5..bb9a7b8 100644 --- a/recipes-devtools/binutils/binutils/0005-Point-scripts-location-to-libdir.patch +++ b/recipes-devtools/binutils/binutils/0004-Point-scripts-location-to-libdir.patch @@ -1,7 +1,7 @@ -From 6a67d277941228d997b527990960413f8444fb81 Mon Sep 17 00:00:00 2001 +From 8ed1877818c5225651586165aacbf019f2aefeb2 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 2 Mar 2015 01:09:58 +0000 -Subject: [PATCH] Point scripts location to libdir +Subject: [PATCH 04/12] Point scripts location to libdir Upstream-Status: Inappropriate [debian patch] @@ -12,7 +12,7 @@ Signed-off-by: Khem Raj 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ld/Makefile.am b/ld/Makefile.am -index 3b01357b651..b7a1f7491b0 100644 +index ee4b339f8f1..72ccb2b29da 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -51,7 +51,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) @@ -25,10 +25,10 @@ index 3b01357b651..b7a1f7491b0 100644 EMUL = @EMUL@ EMULATION_OFILES = @EMULATION_OFILES@ diff --git a/ld/Makefile.in b/ld/Makefile.in -index a6382bf2a45..5ee3a4971be 100644 +index 65cb955c7ce..960408068db 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in -@@ -562,7 +562,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) +@@ -564,7 +564,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) # We put the scripts in the directory $(scriptdir)/ldscripts. # We can't put the scripts in $(datadir) because the SEARCH_DIR # directives need to be different for native and cross linkers. @@ -37,3 +37,6 @@ index a6382bf2a45..5ee3a4971be 100644 BASEDIR = $(srcdir)/.. BFDDIR = $(BASEDIR)/bfd INCDIR = $(BASEDIR)/include +-- +2.25.1 + diff --git a/recipes-devtools/binutils/binutils/0004-configure-widen-the-regexp-for-SH-architectures.patch b/recipes-devtools/binutils/binutils/0004-configure-widen-the-regexp-for-SH-architectures.patch deleted file mode 100644 index 1cd459a..0000000 --- a/recipes-devtools/binutils/binutils/0004-configure-widen-the-regexp-for-SH-architectures.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 7e7512c82402363688cca6f1febea2c01cb03409 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Mon, 2 Mar 2015 01:07:33 +0000 -Subject: [PATCH] configure: widen the regexp for SH architectures - -gprof needs to know about uclibc - -Upstream-Status: Pending - -Signed-off-by: Khem Raj ---- - configure | 2 +- - configure.ac | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/configure b/configure -index 68779feb42b..7b369071141 100755 ---- a/configure -+++ b/configure -@@ -3887,7 +3887,7 @@ case "${target}" in - nvptx*-*-*) - noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc" - ;; -- sh-*-*) -+ sh*-*-* | sh64-*-*) - case "${target}" in - sh*-*-elf) - ;; -diff --git a/configure.ac b/configure.ac -index d16a2757689..92f01fb3ed7 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1177,7 +1177,7 @@ case "${target}" in - nvptx*-*-*) - noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc" - ;; -- sh-*-*) -+ sh*-*-* | sh64-*-*) - case "${target}" in - sh*-*-elf) - ;; diff --git a/recipes-devtools/binutils/binutils/0006-Only-generate-an-RPATH-entry-if-LD_RUN_PATH-is-not-e.patch b/recipes-devtools/binutils/binutils/0005-Only-generate-an-RPATH-entry-if-LD_RUN_PATH-is-not-e.patch similarity index 75% rename from recipes-devtools/binutils/binutils/0006-Only-generate-an-RPATH-entry-if-LD_RUN_PATH-is-not-e.patch rename to recipes-devtools/binutils/binutils/0005-Only-generate-an-RPATH-entry-if-LD_RUN_PATH-is-not-e.patch index caa5f0b..b7d942f 100644 --- a/recipes-devtools/binutils/binutils/0006-Only-generate-an-RPATH-entry-if-LD_RUN_PATH-is-not-e.patch +++ b/recipes-devtools/binutils/binutils/0005-Only-generate-an-RPATH-entry-if-LD_RUN_PATH-is-not-e.patch @@ -1,7 +1,8 @@ -From 8ad249270414a23a3e65c74fd67a8e4adaebec78 Mon Sep 17 00:00:00 2001 +From d34ac6cea56673cb26aef1352f61a58af2d07f4b Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 2 Mar 2015 01:27:17 +0000 -Subject: [PATCH] Only generate an RPATH entry if LD_RUN_PATH is not empty +Subject: [PATCH 05/12] Only generate an RPATH entry if LD_RUN_PATH is not + empty for cases where -rpath isn't specified. debian (#151024) @@ -14,10 +15,10 @@ Signed-off-by: Khem Raj 1 file changed, 4 insertions(+) diff --git a/ld/ldelf.c b/ld/ldelf.c -index b25781cc0c4..77d7fb8ff03 100644 +index 974b83d7678..adac03c713a 100644 --- a/ld/ldelf.c +++ b/ld/ldelf.c -@@ -1248,6 +1248,8 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd, +@@ -1277,6 +1277,8 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd, && command_line.rpath == NULL) { path = (const char *) getenv ("LD_RUN_PATH"); @@ -26,7 +27,7 @@ index b25781cc0c4..77d7fb8ff03 100644 if (path && ldelf_search_needed (path, &n, force, is_linux, elfsize)) -@@ -1608,6 +1610,8 @@ ldelf_before_allocation (char *audit, char *depaudit, +@@ -1635,6 +1637,8 @@ ldelf_before_allocation (char *audit, char *depaudit, rpath = command_line.rpath; if (rpath == NULL) rpath = (const char *) getenv ("LD_RUN_PATH"); @@ -35,3 +36,6 @@ index b25781cc0c4..77d7fb8ff03 100644 for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next) if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) +-- +2.25.1 + diff --git a/recipes-devtools/binutils/binutils/0007-don-t-let-the-distro-compiler-point-to-the-wrong-ins.patch b/recipes-devtools/binutils/binutils/0006-don-t-let-the-distro-compiler-point-to-the-wrong-ins.patch similarity index 78% rename from recipes-devtools/binutils/binutils/0007-don-t-let-the-distro-compiler-point-to-the-wrong-ins.patch rename to recipes-devtools/binutils/binutils/0006-don-t-let-the-distro-compiler-point-to-the-wrong-ins.patch index b13a35e..0b5c85f 100644 --- a/recipes-devtools/binutils/binutils/0007-don-t-let-the-distro-compiler-point-to-the-wrong-ins.patch +++ b/recipes-devtools/binutils/binutils/0006-don-t-let-the-distro-compiler-point-to-the-wrong-ins.patch @@ -1,8 +1,8 @@ -From 091870218f192a5698c4420adf938e7178553c07 Mon Sep 17 00:00:00 2001 +From 34bb49d751ca8fbfc9f740d90fba9417ea7ad312 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 2 Mar 2015 01:39:01 +0000 -Subject: [PATCH] don't let the distro compiler point to the wrong installation - location +Subject: [PATCH 06/12] don't let the distro compiler point to the wrong + installation location Thanks to RP for helping find the source code causing the issue. @@ -17,10 +17,10 @@ Signed-off-by: Khem Raj 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in -index 788590957e1..1bca4aafeb7 100644 +index abef3c4601b..880c8826482 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in -@@ -367,7 +367,8 @@ install-strip: install +@@ -385,7 +385,8 @@ install-strip: install # multilib-specific flags, it's overridden by FLAGS_TO_PASS from the # default multilib, so we have to take CFLAGS into account as well, # since it will be passed the multilib flags. @@ -30,3 +30,6 @@ index 788590957e1..1bca4aafeb7 100644 install_to_libdir: all if test -n "${target_header_dir}"; then \ ${mkinstalldirs} $(DESTDIR)$(libdir)/$(MULTIOSDIR); \ +-- +2.25.1 + diff --git a/recipes-devtools/binutils/binutils/0008-warn-for-uses-of-system-directories-when-cross-linki.patch b/recipes-devtools/binutils/binutils/0007-warn-for-uses-of-system-directories-when-cross-linki.patch similarity index 78% rename from recipes-devtools/binutils/binutils/0008-warn-for-uses-of-system-directories-when-cross-linki.patch rename to recipes-devtools/binutils/binutils/0007-warn-for-uses-of-system-directories-when-cross-linki.patch index 5c148ea..948334d 100644 --- a/recipes-devtools/binutils/binutils/0008-warn-for-uses-of-system-directories-when-cross-linki.patch +++ b/recipes-devtools/binutils/binutils/0007-warn-for-uses-of-system-directories-when-cross-linki.patch @@ -1,7 +1,7 @@ -From bb48edf1a87bbc711e8978dd1e9112fe953dc1bf Mon Sep 17 00:00:00 2001 +From 0761f21f6c6c1e3f0dd77f5e8df308de77fe22c9 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 15 Jan 2016 06:31:09 +0000 -Subject: [PATCH] warn for uses of system directories when cross linking +Subject: [PATCH 07/12] warn for uses of system directories when cross linking 2008-07-02 Joseph Myers @@ -58,15 +58,15 @@ Signed-off-by: Khem Raj ld/ld.texi | 12 ++++++++++++ ld/ldfile.c | 17 +++++++++++++++++ ld/ldlex.h | 2 ++ - ld/ldmain.c | 2 ++ + ld/ldmain.c | 6 ++++-- ld/lexsup.c | 16 ++++++++++++++++ - 9 files changed, 86 insertions(+) + 9 files changed, 88 insertions(+), 2 deletions(-) diff --git a/ld/config.in b/ld/config.in -index 7b60d778587..37b8e9b6f6c 100644 +index 26d55a00d47..ffad464783c 100644 --- a/ld/config.in +++ b/ld/config.in -@@ -40,6 +40,9 @@ +@@ -43,6 +43,9 @@ language is requested. */ #undef ENABLE_NLS @@ -77,10 +77,10 @@ index 7b60d778587..37b8e9b6f6c 100644 #undef EXTRA_SHLIB_EXTENSION diff --git a/ld/configure b/ld/configure -index b0969791959..50bb04ce6a8 100755 +index 034fe373106..5d7415a4670 100755 --- a/ld/configure +++ b/ld/configure -@@ -828,6 +828,7 @@ with_lib_path +@@ -831,6 +831,7 @@ with_lib_path enable_targets enable_64_bit_bfd with_sysroot @@ -88,8 +88,8 @@ index b0969791959..50bb04ce6a8 100755 enable_gold enable_got enable_compressed_debug_sections -@@ -1496,6 +1497,8 @@ Optional Features: - --disable-largefile omit support for large files +@@ -1500,6 +1501,8 @@ Optional Features: + --enable-checking enable run-time checks --enable-targets alternative target configurations --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes) + --enable-poison-system-directories @@ -97,7 +97,7 @@ index b0969791959..50bb04ce6a8 100755 --enable-gold[=ARG] build gold [ARG={default,yes,no}] --enable-got= GOT handling scheme (target, single, negative, multigot) -@@ -15820,6 +15823,19 @@ fi +@@ -15312,6 +15315,19 @@ fi @@ -118,10 +118,10 @@ index b0969791959..50bb04ce6a8 100755 if test "${enable_gold+set}" = set; then : enableval=$enable_gold; case "${enableval}" in diff --git a/ld/configure.ac b/ld/configure.ac -index c9c69ab9245..59dab0a6ac4 100644 +index 7f4cff079b7..57d1abff870 100644 --- a/ld/configure.ac +++ b/ld/configure.ac -@@ -94,6 +94,16 @@ AC_SUBST(use_sysroot) +@@ -102,6 +102,16 @@ AC_SUBST(use_sysroot) AC_SUBST(TARGET_SYSTEM_ROOT) AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) @@ -139,29 +139,29 @@ index c9c69ab9245..59dab0a6ac4 100644 dnl "install_as_default" is set to false if gold is the default linker. dnl "installed_linker" is the installed BFD linker name. diff --git a/ld/ld.h b/ld/ld.h -index 93f5af92c7d..ff7f71a7b66 100644 +index f3086bf30de..db5064243c7 100644 --- a/ld/ld.h +++ b/ld/ld.h -@@ -166,6 +166,14 @@ typedef struct +@@ -162,6 +162,14 @@ typedef struct in the linker script. */ - bfd_boolean force_group_allocation; + bool force_group_allocation; + /* If TRUE (the default) warn for uses of system directories when + cross linking. */ -+ bfd_boolean poison_system_directories; ++ bool poison_system_directories; + + /* If TRUE (default FALSE) give an error for uses of system + directories when cross linking instead of a warning. */ -+ bfd_boolean error_poison_system_directories; ++ bool error_poison_system_directories; + /* Big or little endian as set on command line. */ enum endian_enum endian; diff --git a/ld/ld.texi b/ld/ld.texi -index 7a602b9c6ab..cccbfbab3bb 100644 +index fc75e9b3625..dca697d626e 100644 --- a/ld/ld.texi +++ b/ld/ld.texi -@@ -2810,6 +2810,18 @@ string identifying the original linked file does not change. +@@ -2892,6 +2892,18 @@ string identifying the original linked file does not change. Passing @code{none} for @var{style} disables the setting from any @code{--build-id} options earlier on the command line. @@ -181,10 +181,10 @@ index 7a602b9c6ab..cccbfbab3bb 100644 @c man end diff --git a/ld/ldfile.c b/ld/ldfile.c -index 81cb86d51e2..cd5c2752679 100644 +index 731ae5f7aed..dd8f03fd960 100644 --- a/ld/ldfile.c +++ b/ld/ldfile.c -@@ -117,6 +117,23 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline) +@@ -117,6 +117,23 @@ ldfile_add_library_path (const char *name, bool cmdline) new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL); else new_dirs->name = xstrdup (name); @@ -209,10 +209,10 @@ index 81cb86d51e2..cd5c2752679 100644 /* Try to open a BFD for a lang_input_statement. */ diff --git a/ld/ldlex.h b/ld/ldlex.h -index b0101028321..77f5accb5d9 100644 +index bc58fea73cc..a1595589197 100644 --- a/ld/ldlex.h +++ b/ld/ldlex.h -@@ -161,6 +161,8 @@ enum option_values +@@ -164,6 +164,8 @@ enum option_values OPTION_CTF_VARIABLES, OPTION_NO_CTF_VARIABLES, OPTION_CTF_SHARE_TYPES, @@ -222,23 +222,41 @@ index b0101028321..77f5accb5d9 100644 /* The initial parser states. */ diff --git a/ld/ldmain.c b/ld/ldmain.c -index 080b1c4c6c2..78d8a2df278 100644 +index 1ae90a77749..f40750fd816 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c -@@ -324,6 +324,8 @@ main (int argc, char **argv) - command_line.warn_mismatch = TRUE; - command_line.warn_search_mismatch = TRUE; +@@ -322,6 +322,8 @@ main (int argc, char **argv) + command_line.warn_mismatch = true; + command_line.warn_search_mismatch = true; command_line.check_section_addresses = -1; -+ command_line.poison_system_directories = TRUE; -+ command_line.error_poison_system_directories = FALSE; ++ command_line.poison_system_directories = true; ++ command_line.error_poison_system_directories = false; /* We initialize DEMANGLING based on the environment variable COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the +@@ -1447,7 +1449,7 @@ undefined_symbol (struct bfd_link_info *info, + argv[1] = "undefined-symbol"; + argv[2] = (char *) name; + argv[3] = NULL; +- ++ + if (verbose) + einfo (_("%P: About to run error handling script '%s' with arguments: '%s' '%s'\n"), + argv[0], argv[1], argv[2]); +@@ -1468,7 +1470,7 @@ undefined_symbol (struct bfd_link_info *info, + carry on to issue the normal error message. */ + } + #endif /* SUPPORT_ERROR_HANDLING_SCRIPT */ +- ++ + if (section != NULL) + { + if (error_count < MAX_ERRORS_IN_A_ROW) diff --git a/ld/lexsup.c b/ld/lexsup.c -index f005a58a045..5eb8439fef7 100644 +index 5acc47ed5a0..d03c6136ccf 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c -@@ -591,6 +591,14 @@ static const struct ld_option ld_options[] = +@@ -600,6 +600,14 @@ static const struct ld_option ld_options[] = " is: share-unconflicted (default),\n" " share-duplicated"), TWO_DASHES }, @@ -253,18 +271,21 @@ index f005a58a045..5eb8439fef7 100644 }; #define OPTION_COUNT ARRAY_SIZE (ld_options) -@@ -1676,6 +1684,14 @@ parse_args (unsigned argc, char **argv) - config.print_map_discarded = TRUE; +@@ -1702,6 +1710,14 @@ parse_args (unsigned argc, char **argv) + config.print_map_discarded = true; break; + case OPTION_NO_POISON_SYSTEM_DIRECTORIES: -+ command_line.poison_system_directories = FALSE; ++ command_line.poison_system_directories = false; + break; + + case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES: -+ command_line.error_poison_system_directories = TRUE; ++ command_line.error_poison_system_directories = true; + break; + case OPTION_DEPENDENCY_FILE: config.dependency_file = optarg; break; +-- +2.25.1 + diff --git a/recipes-devtools/binutils/binutils/0011-fix-the-incorrect-assembling-for-ppc-wait-mnemonic.patch b/recipes-devtools/binutils/binutils/0008-fix-the-incorrect-assembling-for-ppc-wait-mnemonic.patch similarity index 50% rename from recipes-devtools/binutils/binutils/0011-fix-the-incorrect-assembling-for-ppc-wait-mnemonic.patch rename to recipes-devtools/binutils/binutils/0008-fix-the-incorrect-assembling-for-ppc-wait-mnemonic.patch index 1041b73..38bef2f 100644 --- a/recipes-devtools/binutils/binutils/0011-fix-the-incorrect-assembling-for-ppc-wait-mnemonic.patch +++ b/recipes-devtools/binutils/binutils/0008-fix-the-incorrect-assembling-for-ppc-wait-mnemonic.patch @@ -1,34 +1,40 @@ -From 7f4938d062146e40b4e6d427a5eca6cc6acaaeee Mon Sep 17 00:00:00 2001 +From 7273e86714b9855ffb9f9890e6b3b303a62cbfb3 Mon Sep 17 00:00:00 2001 From: Zhenhua Luo Date: Sat, 11 Jun 2016 22:08:29 -0500 -Subject: [PATCH] fix the incorrect assembling for ppc wait mnemonic +Subject: [PATCH 08/12] fix the incorrect assembling for ppc wait mnemonic -Signed-off-by: Zhenhua Luo +The wait mnemonic for ppc targets is incorrectly assembled into 0x7c00003c due +to duplicated address definition with waitasec instruction. The issue causes +kernel boot calltrace for ppc targets when wait instruction is executed. Upstream-Status: Pending +Signed-off-by: Zhenhua Luo --- opcodes/ppc-opc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c -index bbbadffad8f..72092355e12 100644 +index a424dd924de..406d5b60917 100644 --- a/opcodes/ppc-opc.c +++ b/opcodes/ppc-opc.c -@@ -6302,8 +6302,6 @@ const struct powerpc_opcode powerpc_opcodes[] = { +@@ -6378,8 +6378,6 @@ const struct powerpc_opcode powerpc_opcodes[] = { {"waitasec", X(31,30), XRTRARB_MASK, POWER8, POWER9, {0}}, - {"waitrsv", XWCPL(31,30,1,0),0xffffffff, POWER10, 0, {0}}, - {"pause_short", XWCPL(31,30,2,0),0xffffffff, POWER10, 0, {0}}, + {"waitrsv", XWCPL(31,30,1,0),0xffffffff, POWER10, EXT, {0}}, + {"pause_short", XWCPL(31,30,2,0),0xffffffff, POWER10, EXT, {0}}, -{"wait", X(31,30), XWCPL_MASK, POWER10, 0, {WC, PL}}, -{"wait", X(31,30), XWC_MASK, POWER9, POWER10, {WC}}, {"lwepx", X(31,31), X_MASK, E500MC|PPCA2, 0, {RT, RA0, RB}}, -@@ -6363,7 +6361,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { +@@ -6433,7 +6431,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { - {"waitrsv", X(31,62)|(1<<21), 0xffffffff, E500MC|PPCA2, 0, {0}}, - {"waitimpl", X(31,62)|(2<<21), 0xffffffff, E500MC|PPCA2, 0, {0}}, + {"waitrsv", X(31,62)|(1<<21), 0xffffffff, E500MC|PPCA2, EXT, {0}}, + {"waitimpl", X(31,62)|(2<<21), 0xffffffff, E500MC|PPCA2, EXT, {0}}, -{"wait", X(31,62), XWC_MASK, E500MC|PPCA2, 0, {WC}}, +{"wait", X(31,62), XWC_MASK, E500MC|PPCA2|POWER9|POWER10, 0, {WC}}, {"dcbstep", XRT(31,63,0), XRT_MASK, E500MC|PPCA2, 0, {RA0, RB}}, +-- +2.25.1 + diff --git a/recipes-devtools/binutils/binutils/0009-Change-default-emulation-for-mips64-linux.patch b/recipes-devtools/binutils/binutils/0009-Change-default-emulation-for-mips64-linux.patch deleted file mode 100644 index b8a1939..0000000 --- a/recipes-devtools/binutils/binutils/0009-Change-default-emulation-for-mips64-linux.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 5bd94030de598d3a13091dafaed3b956e0ab708f Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Mon, 2 Mar 2015 01:44:14 +0000 -Subject: [PATCH] Change default emulation for mips64*-*-linux - -we change the default emulations to be N64 instead of N32 - -Upstream-Status: Inappropriate [ OE configuration Specific] - -Signed-off-by: Khem Raj ---- - bfd/config.bfd | 8 ++++---- - ld/configure.tgt | 8 ++++---- - 2 files changed, 8 insertions(+), 8 deletions(-) - -diff --git a/bfd/config.bfd b/bfd/config.bfd -index e7b55b0dd78..2caf492e172 100644 ---- a/bfd/config.bfd -+++ b/bfd/config.bfd -@@ -896,12 +896,12 @@ case "${targ}" in - targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_be_vec mips_ecoff_le_vec" - ;; - mips64*el-*-linux*) -- targ_defvec=mips_elf32_ntrad_le_vec -- targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec" -+ targ_defvec=mips_elf64_trad_le_vec -+ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_be_vec" - ;; - mips64*-*-linux*) -- targ_defvec=mips_elf32_ntrad_be_vec -- targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec" -+ targ_defvec=mips_elf64_trad_be_vec -+ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_be_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_le_vec" - ;; - mips*el-*-linux*) - targ_defvec=mips_elf32_trad_le_vec -diff --git a/ld/configure.tgt b/ld/configure.tgt -index 0c780b24d57..47431770a17 100644 ---- a/ld/configure.tgt -+++ b/ld/configure.tgt -@@ -531,12 +531,12 @@ mips*-*-vxworks*) targ_emul=elf32ebmipvxworks - ;; - mips*-*-windiss) targ_emul=elf32mipswindiss - ;; --mips64*el-*-linux-*) targ_emul=elf32ltsmipn32 -- targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip" -+mips64*el-*-linux-*) targ_emul=elf64ltsmip -+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32ltsmip elf32btsmip elf64btsmip" - targ_extra_libpath=$targ_extra_emuls - ;; --mips64*-*-linux-*) targ_emul=elf32btsmipn32 -- targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip" -+mips64*-*-linux-*) targ_emul=elf64btsmip -+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip" - targ_extra_libpath=$targ_extra_emuls - ;; - mips*el-*-linux-*) targ_emul=elf32ltsmip diff --git a/recipes-devtools/binutils/binutils/0013-Use-libtool-2.4.patch b/recipes-devtools/binutils/binutils/0009-Use-libtool-2.4.patch similarity index 87% rename from recipes-devtools/binutils/binutils/0013-Use-libtool-2.4.patch rename to recipes-devtools/binutils/binutils/0009-Use-libtool-2.4.patch index d406769..286e43b 100644 --- a/recipes-devtools/binutils/binutils/0013-Use-libtool-2.4.patch +++ b/recipes-devtools/binutils/binutils/0009-Use-libtool-2.4.patch @@ -1,7 +1,7 @@ -From a1031fca1b6c1348c078bb8a9df6e7d29148dae1 Mon Sep 17 00:00:00 2001 +From 9d60b7b8e119b166ffe9aa4471afe9bf78a13bd2 Mon Sep 17 00:00:00 2001 From: Khem Raj -Date: Sun, 14 Feb 2016 17:04:07 +0000 -Subject: [PATCH] Use libtool 2.4 +Date: Thu, 10 Mar 2022 17:51:48 +0300 +Subject: [PATCH 09/12] Use libtool 2.4 get libtool sysroot support @@ -9,27 +9,28 @@ Upstream-Status: Pending Signed-off-by: Khem Raj --- - bfd/configure | 1322 +++++++++++++++----- - bfd/configure.ac | 2 +- - binutils/configure | 1320 +++++++++++++++----- - gas/configure | 1320 +++++++++++++++----- - gprof/configure | 1320 +++++++++++++++----- - ld/configure | 1695 ++++++++++++++++++------- - libctf/configure | 1319 +++++++++++++++----- - libtool.m4 | 1080 +++++++++++----- - ltmain.sh | 2925 +++++++++++++++++++++++++++++--------------- - ltoptions.m4 | 2 +- - ltversion.m4 | 12 +- - lt~obsolete.m4 | 2 +- - opcodes/configure | 1320 +++++++++++++++----- - zlib/configure | 1320 +++++++++++++++----- - 14 files changed, 10931 insertions(+), 4028 deletions(-) + bfd/configure | 1333 +++++++++++++----- + bfd/configure.ac | 2 +- + binutils/configure | 1331 +++++++++++++----- + gas/configure | 1331 +++++++++++++----- + gprof/configure | 1331 +++++++++++++----- + ld/configure | 1704 +++++++++++++++++------ + libbacktrace/configure | 1534 +++++++++++++++------ + libctf/configure | 1330 +++++++++++++----- + libtool.m4 | 1093 ++++++++++----- + ltmain.sh | 2925 +++++++++++++++++++++++++++------------- + ltoptions.m4 | 2 +- + ltversion.m4 | 12 +- + lt~obsolete.m4 | 2 +- + opcodes/configure | 1331 +++++++++++++----- + zlib/configure | 1331 +++++++++++++----- + 15 files changed, 12067 insertions(+), 4525 deletions(-) diff --git a/bfd/configure b/bfd/configure -index b3665c68c13..376b951d496 100755 +index 9f7512b6aa4..30ca449c7e7 100755 --- a/bfd/configure +++ b/bfd/configure -@@ -705,6 +705,9 @@ OTOOL +@@ -707,6 +707,9 @@ OTOOL LIPO NMEDIT DSYMUTIL @@ -39,7 +40,7 @@ index b3665c68c13..376b951d496 100755 OBJDUMP LN_S NM -@@ -823,6 +826,7 @@ enable_static +@@ -826,6 +829,7 @@ enable_static with_pic enable_fast_install with_gnu_ld @@ -47,7 +48,7 @@ index b3665c68c13..376b951d496 100755 enable_libtool_lock enable_plugins enable_largefile -@@ -1505,6 +1509,8 @@ Optional Packages: +@@ -1521,6 +1525,8 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] @@ -56,7 +57,7 @@ index b3665c68c13..376b951d496 100755 --with-mmap try using mmap for BFD input files if available --with-separate-debug-dir=DIR Look for global separate debug info in DIR -@@ -5694,8 +5700,8 @@ esac +@@ -5041,8 +5047,8 @@ esac @@ -67,7 +68,7 @@ index b3665c68c13..376b951d496 100755 -@@ -5735,7 +5741,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO +@@ -5082,7 +5088,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. @@ -76,7 +77,7 @@ index b3665c68c13..376b951d496 100755 test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then -@@ -6421,8 +6427,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; +@@ -5769,8 +5775,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" @@ -87,7 +88,7 @@ index b3665c68c13..376b951d496 100755 && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes -@@ -6471,6 +6477,80 @@ esac +@@ -5819,6 +5825,80 @@ esac @@ -168,7 +169,7 @@ index b3665c68c13..376b951d496 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : -@@ -6487,6 +6567,11 @@ case $reload_flag in +@@ -5835,6 +5915,11 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in @@ -180,7 +181,7 @@ index b3665c68c13..376b951d496 100755 darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' -@@ -6655,7 +6740,8 @@ mingw* | pw32*) +@@ -6003,7 +6088,8 @@ mingw* | pw32*) lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else @@ -190,7 +191,7 @@ index b3665c68c13..376b951d496 100755 lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -@@ -6809,6 +6895,21 @@ esac +@@ -6157,6 +6243,21 @@ esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } @@ -212,7 +213,7 @@ index b3665c68c13..376b951d496 100755 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown -@@ -6822,11 +6923,164 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown +@@ -6172,6 +6273,157 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -226,11 +227,7 @@ index b3665c68c13..376b951d496 100755 + + + - - - if test -n "$ac_tool_prefix"; then -- # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. --set dummy ${ac_tool_prefix}ar; ac_word=$2 ++if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -371,7 +368,15 @@ index b3665c68c13..376b951d496 100755 + + + -+if test -n "$ac_tool_prefix"; then + plugin_option= + plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll" + for plugin in $plugin_names; do +@@ -6186,8 +6438,10 @@ for plugin in $plugin_names; do + done + + if test -n "$ac_tool_prefix"; then +- # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +-set dummy ${ac_tool_prefix}ar; ac_word=$2 + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. @@ -379,7 +384,7 @@ index b3665c68c13..376b951d496 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : -@@ -6842,7 +7096,7 @@ do +@@ -6203,7 +6457,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then @@ -388,7 +393,7 @@ index b3665c68c13..376b951d496 100755 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi -@@ -6862,11 +7116,15 @@ $as_echo "no" >&6; } +@@ -6223,11 +6477,15 @@ $as_echo "no" >&6; } fi @@ -407,7 +412,7 @@ index b3665c68c13..376b951d496 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : -@@ -6882,7 +7140,7 @@ do +@@ -6243,7 +6501,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then @@ -416,7 +421,7 @@ index b3665c68c13..376b951d496 100755 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi -@@ -6901,6 +7159,10 @@ else +@@ -6262,6 +6520,10 @@ else $as_echo "no" >&6; } fi @@ -427,7 +432,7 @@ index b3665c68c13..376b951d496 100755 if test "x$ac_ct_AR" = x; then AR="false" else -@@ -6912,16 +7174,72 @@ ac_tool_warned=yes ;; +@@ -6273,25 +6535,20 @@ ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi @@ -436,20 +441,37 @@ index b3665c68c13..376b951d496 100755 fi -test -z "$AR" && AR=ar +-if test -n "$plugin_option"; then +- if $AR --help 2>&1 | grep -q "\--plugin"; then +- touch conftest.c +- $AR $plugin_option rc conftest.a conftest.c +- if test "$?" != 0; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 ++ touch conftest.c ++ $AR $plugin_option rc conftest.a conftest.c ++ if test "$?" != 0; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 + $as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;} +- else +- AR="$AR $plugin_option" +- fi +- rm -f conftest.* ++ else ++ AR="$AR $plugin_option" + fi +-fi -test -z "$AR_FLAGS" && AR_FLAGS=cru ++ rm -f conftest.* +: ${AR=ar} +: ${AR_FLAGS=cru} + -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ + + + +@@ -6302,6 +6559,63 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : @@ -462,7 +484,7 @@ index b3665c68c13..376b951d496 100755 +int +main () +{ - ++ + ; + return 0; +} @@ -488,23 +510,29 @@ index b3665c68c13..376b951d496 100755 + fi + fi + rm -f conftest.* libconftest.a - ++ +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ++ +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } - ++ +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi ++ ++ ++ ++ ++ ++ - - -@@ -7263,8 +7581,8 @@ esac + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +@@ -6642,8 +6956,8 @@ esac lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address @@ -515,7 +543,7 @@ index b3665c68c13..376b951d496 100755 # Handle CRLF in mingw tool chain opt_cr= -@@ -7300,6 +7618,7 @@ for ac_symprfx in "" "_"; do +@@ -6679,6 +6993,7 @@ for ac_symprfx in "" "_"; do else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi @@ -523,7 +551,7 @@ index b3665c68c13..376b951d496 100755 # Check to see that the pipe works correctly. pipe_works=no -@@ -7341,6 +7660,18 @@ _LT_EOF +@@ -6720,6 +7035,18 @@ _LT_EOF if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext @@ -542,7 +570,7 @@ index b3665c68c13..376b951d496 100755 #ifdef __cplusplus extern "C" { #endif -@@ -7352,7 +7683,7 @@ _LT_EOF +@@ -6731,7 +7058,7 @@ _LT_EOF cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ @@ -551,7 +579,7 @@ index b3665c68c13..376b951d496 100755 const char *name; void *address; } -@@ -7378,8 +7709,8 @@ static const void *lt_preloaded_setup() { +@@ -6757,8 +7084,8 @@ static const void *lt_preloaded_setup() { _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext @@ -562,7 +590,7 @@ index b3665c68c13..376b951d496 100755 LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 -@@ -7389,8 +7720,8 @@ _LT_EOF +@@ -6768,8 +7095,8 @@ _LT_EOF test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi @@ -573,7 +601,7 @@ index b3665c68c13..376b951d496 100755 else echo "cannot find nm_test_func in $nlist" >&5 fi -@@ -7427,6 +7758,16 @@ else +@@ -6806,6 +7133,12 @@ else $as_echo "ok" >&6; } fi @@ -583,24 +611,13 @@ index b3665c68c13..376b951d496 100755 +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi -+ -+ -+ -+ -@@ -7443,6 +7784,45 @@ fi +@@ -6821,6 +7154,49 @@ fi -+ -+ -+ -+ -+ -+ -+ +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } + @@ -633,10 +650,21 @@ index b3665c68c13..376b951d496 100755 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ -@@ -7654,6 +8034,123 @@ esac +@@ -7033,6 +7409,123 @@ esac need_locks="$enable_libtool_lock" @@ -760,7 +788,7 @@ index b3665c68c13..376b951d496 100755 case $host_os in rhapsody* | darwin*) -@@ -8217,6 +8714,8 @@ _LT_EOF +@@ -7596,6 +8089,8 @@ _LT_EOF $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 @@ -769,26 +797,7 @@ index b3665c68c13..376b951d496 100755 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF -@@ -8381,7 +8880,8 @@ fi - LIBTOOL_DEPS="$ltmain" - - # Always use our own libtool. --LIBTOOL='$(SHELL) $(top_builddir)/libtool' -+LIBTOOL='$(SHELL) $(top_builddir)' -+LIBTOOL="$LIBTOOL/${host_alias}-libtool" - - - -@@ -8470,7 +8970,7 @@ aix3*) - esac - - # Global variables: --ofile=libtool -+ofile=${host_alias}-libtool - can_build_shared=yes - - # All known linkers require a `.a' archive for static linking (except MSVC, -@@ -8768,8 +9268,6 @@ fi +@@ -8147,8 +8642,6 @@ fi lt_prog_compiler_pic= lt_prog_compiler_static= @@ -797,7 +806,7 @@ index b3665c68c13..376b951d496 100755 if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' -@@ -8935,6 +9433,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -8314,6 +8807,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; @@ -810,7 +819,7 @@ index b3665c68c13..376b951d496 100755 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) -@@ -8997,7 +9501,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -8376,7 +8875,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in @@ -819,7 +828,7 @@ index b3665c68c13..376b951d496 100755 lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; -@@ -9054,13 +9558,17 @@ case $host_os in +@@ -8433,13 +8932,17 @@ case $host_os in lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac @@ -843,7 +852,7 @@ index b3665c68c13..376b951d496 100755 # # Check to make sure the PIC flag actually works. -@@ -9121,6 +9629,11 @@ fi +@@ -8500,6 +9003,11 @@ fi @@ -855,7 +864,7 @@ index b3665c68c13..376b951d496 100755 # # Check to make sure the static flag actually works. # -@@ -9471,7 +9984,8 @@ _LT_EOF +@@ -8850,7 +9358,8 @@ _LT_EOF allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes @@ -865,7 +874,7 @@ index b3665c68c13..376b951d496 100755 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' -@@ -9570,12 +10084,12 @@ _LT_EOF +@@ -8949,12 +9458,12 @@ _LT_EOF whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' @@ -880,7 +889,7 @@ index b3665c68c13..376b951d496 100755 fi ;; esac -@@ -9589,8 +10103,8 @@ _LT_EOF +@@ -8968,8 +9477,8 @@ _LT_EOF archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else @@ -891,7 +900,7 @@ index b3665c68c13..376b951d496 100755 fi ;; -@@ -9608,8 +10122,8 @@ _LT_EOF +@@ -8987,8 +9496,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then @@ -902,7 +911,7 @@ index b3665c68c13..376b951d496 100755 else ld_shlibs=no fi -@@ -9655,8 +10169,8 @@ _LT_EOF +@@ -9034,8 +9543,8 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then @@ -913,7 +922,7 @@ index b3665c68c13..376b951d496 100755 else ld_shlibs=no fi -@@ -9786,7 +10300,13 @@ _LT_EOF +@@ -9165,7 +9674,13 @@ _LT_EOF allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. @@ -928,7 +937,7 @@ index b3665c68c13..376b951d496 100755 /* end confdefs.h. */ int -@@ -9799,22 +10319,29 @@ main () +@@ -9178,22 +9693,29 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : @@ -971,7 +980,7 @@ index b3665c68c13..376b951d496 100755 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" 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" -@@ -9826,7 +10353,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9205,7 +9727,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else # Determine the default libpath from the value encoded in an # empty executable. @@ -986,7 +995,7 @@ index b3665c68c13..376b951d496 100755 /* end confdefs.h. */ int -@@ -9839,22 +10372,29 @@ main () +@@ -9218,22 +9746,29 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : @@ -1029,7 +1038,7 @@ index b3665c68c13..376b951d496 100755 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, -@@ -9899,20 +10439,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9278,20 +9813,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. @@ -1107,7 +1116,7 @@ index b3665c68c13..376b951d496 100755 ;; darwin* | rhapsody*) -@@ -9973,7 +10556,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9352,7 +9930,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) @@ -1116,7 +1125,7 @@ index b3665c68c13..376b951d496 100755 hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no -@@ -9981,7 +10564,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9360,7 +9938,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux9*) if test "$GCC" = yes; then @@ -1125,7 +1134,7 @@ index b3665c68c13..376b951d496 100755 else 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' fi -@@ -9997,7 +10580,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9376,7 +9954,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then @@ -1134,7 +1143,7 @@ index b3665c68c13..376b951d496 100755 else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi -@@ -10021,10 +10604,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9400,10 +9978,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) @@ -1147,7 +1156,7 @@ index b3665c68c13..376b951d496 100755 ;; esac else -@@ -10103,23 +10686,36 @@ fi +@@ -9482,23 +10060,36 @@ fi irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then @@ -1192,7 +1201,7 @@ index b3665c68c13..376b951d496 100755 else 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' 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' -@@ -10204,7 +10800,7 @@ rm -f core conftest.err conftest.$ac_objext \ +@@ -9583,7 +10174,7 @@ rm -f core conftest.err conftest.$ac_objext \ osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' @@ -1201,7 +1210,7 @@ index b3665c68c13..376b951d496 100755 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' -@@ -10223,9 +10819,9 @@ rm -f core conftest.err conftest.$ac_objext \ +@@ -9602,9 +10193,9 @@ rm -f core conftest.err conftest.$ac_objext \ no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' @@ -1213,7 +1222,7 @@ index b3665c68c13..376b951d496 100755 else case `$CC -V 2>&1` in *"Compilers 5.0"*) -@@ -10801,8 +11397,9 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -10180,8 +10771,9 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no @@ -1225,7 +1234,7 @@ index b3665c68c13..376b951d496 100755 library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ -@@ -10835,13 +11432,71 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -10214,13 +10806,71 @@ cygwin* | mingw* | pw32* | cegcc*) library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac @@ -1298,25 +1307,16 @@ index b3665c68c13..376b951d496 100755 # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; -@@ -10923,7 +11578,7 @@ haiku*) - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes -- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' -+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -@@ -11719,7 +12374,7 @@ else +@@ -11098,7 +11748,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF --#line 11722 "configure" +-#line 11089 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H -@@ -11763,10 +12418,10 @@ else +@@ -11142,10 +11792,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) @@ -1329,16 +1329,16 @@ index b3665c68c13..376b951d496 100755 int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); -@@ -11825,7 +12480,7 @@ else +@@ -11204,7 +11854,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF --#line 11828 "configure" +-#line 11195 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H -@@ -11869,10 +12524,10 @@ else +@@ -11248,10 +11898,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) @@ -1351,16 +1351,16 @@ index b3665c68c13..376b951d496 100755 int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); -@@ -14599,7 +15254,7 @@ SHARED_LDFLAGS= +@@ -13236,7 +13886,7 @@ SHARED_LDFLAGS= if test "$enable_shared" = "yes"; then x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'` if test -n "$x"; then - SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty" + SHARED_LIBADD="`pwd`/../libiberty/pic/libiberty.a" fi + fi - case "${host}" in -@@ -17199,13 +17854,20 @@ exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +@@ -15892,13 +16542,20 @@ exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' @@ -1381,7 +1381,7 @@ index b3665c68c13..376b951d496 100755 STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' -@@ -17220,14 +17882,17 @@ lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$de +@@ -15913,14 +16570,17 @@ lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$de lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' 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"`' @@ -1400,7 +1400,7 @@ index b3665c68c13..376b951d496 100755 DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' -@@ -17260,12 +17925,12 @@ hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_q +@@ -15953,12 +16613,12 @@ hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_q hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' @@ -1414,7 +1414,7 @@ index b3665c68c13..376b951d496 100755 file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' -@@ -17320,8 +17985,13 @@ reload_flag \ +@@ -16013,8 +16673,13 @@ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ @@ -1428,7 +1428,7 @@ index b3665c68c13..376b951d496 100755 STRIP \ RANLIB \ CC \ -@@ -17331,12 +18001,14 @@ lt_cv_sys_global_symbol_pipe \ +@@ -16024,12 +16689,14 @@ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ @@ -1444,7 +1444,7 @@ index b3665c68c13..376b951d496 100755 DSYMUTIL \ NMEDIT \ LIPO \ -@@ -17352,7 +18024,6 @@ no_undefined_flag \ +@@ -16045,7 +16712,6 @@ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ @@ -1452,7 +1452,7 @@ index b3665c68c13..376b951d496 100755 exclude_expsyms \ include_expsyms \ file_list_spec \ -@@ -17388,6 +18059,7 @@ module_cmds \ +@@ -16081,6 +16747,7 @@ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ @@ -1460,7 +1460,7 @@ index b3665c68c13..376b951d496 100755 postinstall_cmds \ postuninstall_cmds \ finish_cmds \ -@@ -18176,7 +18848,8 @@ $as_echo X"$file" | +@@ -16849,7 +17516,8 @@ $as_echo X"$file" | # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, @@ -1470,7 +1470,7 @@ index b3665c68c13..376b951d496 100755 # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. -@@ -18279,19 +18952,42 @@ SP2NL=$lt_lt_SP2NL +@@ -16952,19 +17620,42 @@ SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP @@ -1514,7 +1514,7 @@ index b3665c68c13..376b951d496 100755 # A symbol stripping program. STRIP=$lt_STRIP -@@ -18321,6 +19017,12 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address +@@ -16994,6 +17685,12 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix @@ -1527,7 +1527,7 @@ index b3665c68c13..376b951d496 100755 # The name of the directory that contains temporary libtool files. objdir=$objdir -@@ -18330,6 +19032,9 @@ MAGIC_CMD=$MAGIC_CMD +@@ -17003,6 +17700,9 @@ MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks @@ -1537,7 +1537,7 @@ index b3665c68c13..376b951d496 100755 # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL -@@ -18444,12 +19149,12 @@ with_gcc=$GCC +@@ -17117,12 +17817,12 @@ with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag @@ -1553,7 +1553,7 @@ index b3665c68c13..376b951d496 100755 # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static -@@ -18536,9 +19241,6 @@ inherit_rpath=$inherit_rpath +@@ -17209,9 +17909,6 @@ inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs @@ -1563,7 +1563,7 @@ index b3665c68c13..376b951d496 100755 # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols -@@ -18554,6 +19256,9 @@ include_expsyms=$lt_include_expsyms +@@ -17227,6 +17924,9 @@ include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds @@ -1573,7 +1573,7 @@ index b3665c68c13..376b951d496 100755 # Specify filename containing input files. file_list_spec=$lt_file_list_spec -@@ -18586,210 +19291,169 @@ ltmain="$ac_aux_dir/ltmain.sh" +@@ -17259,210 +17959,169 @@ ltmain="$ac_aux_dir/ltmain.sh" # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? @@ -1948,23 +1948,23 @@ index b3665c68c13..376b951d496 100755 chmod +x "$ofile" diff --git a/bfd/configure.ac b/bfd/configure.ac -index 0797a08ff37..133d714cf18 100644 +index 65fdfa514c9..287e9bf529f 100644 --- a/bfd/configure.ac +++ b/bfd/configure.ac -@@ -315,7 +315,7 @@ changequote(,)dnl +@@ -303,7 +303,7 @@ changequote(,)dnl x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'` changequote([,])dnl if test -n "$x"; then - SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty" + SHARED_LIBADD="`pwd`/../libiberty/pic/libiberty.a" fi + fi - case "${host}" in diff --git a/binutils/configure b/binutils/configure -index 83b4b0172db..2154238189e 100755 +index 19d82badc63..62f55602455 100755 --- a/binutils/configure +++ b/binutils/configure -@@ -697,8 +697,11 @@ OTOOL +@@ -696,8 +696,11 @@ OTOOL LIPO NMEDIT DSYMUTIL @@ -1976,7 +1976,7 @@ index 83b4b0172db..2154238189e 100755 OBJDUMP LN_S NM -@@ -815,6 +818,7 @@ enable_static +@@ -814,6 +817,7 @@ enable_static with_pic enable_fast_install with_gnu_ld @@ -1984,7 +1984,7 @@ index 83b4b0172db..2154238189e 100755 enable_libtool_lock enable_plugins enable_largefile -@@ -1504,6 +1508,8 @@ Optional Packages: +@@ -1509,6 +1513,8 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] @@ -1993,7 +1993,7 @@ index 83b4b0172db..2154238189e 100755 --with-debuginfod Enable debuginfo lookups with debuginfod (auto/yes/no) --with-system-zlib use installed libz -@@ -5490,8 +5496,8 @@ esac +@@ -4883,8 +4889,8 @@ esac @@ -2004,7 +2004,7 @@ index 83b4b0172db..2154238189e 100755 -@@ -5531,7 +5537,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO +@@ -4924,7 +4930,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. @@ -2013,7 +2013,7 @@ index 83b4b0172db..2154238189e 100755 test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then -@@ -6217,8 +6223,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; +@@ -5611,8 +5617,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" @@ -2024,7 +2024,7 @@ index 83b4b0172db..2154238189e 100755 && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes -@@ -6267,6 +6273,80 @@ esac +@@ -5661,6 +5667,80 @@ esac @@ -2105,7 +2105,7 @@ index 83b4b0172db..2154238189e 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : -@@ -6283,6 +6363,11 @@ case $reload_flag in +@@ -5677,6 +5757,11 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in @@ -2117,7 +2117,7 @@ index 83b4b0172db..2154238189e 100755 darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' -@@ -6451,7 +6536,8 @@ mingw* | pw32*) +@@ -5845,7 +5930,8 @@ mingw* | pw32*) lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else @@ -2127,7 +2127,7 @@ index 83b4b0172db..2154238189e 100755 lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -@@ -6605,6 +6691,21 @@ esac +@@ -5999,6 +6085,21 @@ esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } @@ -2149,7 +2149,7 @@ index 83b4b0172db..2154238189e 100755 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown -@@ -6620,9 +6721,162 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown +@@ -6014,6 +6115,157 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -2304,6 +2304,12 @@ index 83b4b0172db..2154238189e 100755 + + + + plugin_option= + plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll" + for plugin in $plugin_names; do +@@ -6028,8 +6280,10 @@ for plugin in $plugin_names; do + done + if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 @@ -2314,7 +2320,7 @@ index 83b4b0172db..2154238189e 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : -@@ -6638,7 +6892,7 @@ do +@@ -6045,7 +6299,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then @@ -2323,7 +2329,7 @@ index 83b4b0172db..2154238189e 100755 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi -@@ -6658,11 +6912,15 @@ $as_echo "no" >&6; } +@@ -6065,11 +6319,15 @@ $as_echo "no" >&6; } fi @@ -2342,7 +2348,7 @@ index 83b4b0172db..2154238189e 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : -@@ -6678,7 +6936,7 @@ do +@@ -6085,7 +6343,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then @@ -2351,7 +2357,7 @@ index 83b4b0172db..2154238189e 100755 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi -@@ -6697,6 +6955,10 @@ else +@@ -6104,6 +6362,10 @@ else $as_echo "no" >&6; } fi @@ -2362,7 +2368,7 @@ index 83b4b0172db..2154238189e 100755 if test "x$ac_ct_AR" = x; then AR="false" else -@@ -6708,12 +6970,10 @@ ac_tool_warned=yes ;; +@@ -6115,29 +6377,81 @@ ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi @@ -2371,16 +2377,40 @@ index 83b4b0172db..2154238189e 100755 fi -test -z "$AR" && AR=ar +-if test -n "$plugin_option"; then +- if $AR --help 2>&1 | grep -q "\--plugin"; then +- touch conftest.c +- $AR $plugin_option rc conftest.a conftest.c +- if test "$?" != 0; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 ++ touch conftest.c ++ $AR $plugin_option rc conftest.a conftest.c ++ if test "$?" != 0; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 + $as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;} +- else +- AR="$AR $plugin_option" +- fi +- rm -f conftest.* ++ else ++ AR="$AR $plugin_option" + fi +-fi -test -z "$AR_FLAGS" && AR_FLAGS=cru ++ rm -f conftest.* +: ${AR=ar} +: ${AR_FLAGS=cru} - - - -@@ -6725,6 +6985,64 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru - - - ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : @@ -2393,7 +2423,7 @@ index 83b4b0172db..2154238189e 100755 +int +main () +{ -+ + + ; + return 0; +} @@ -2419,30 +2449,23 @@ index 83b4b0172db..2154238189e 100755 + fi + fi + rm -f conftest.* libconftest.a -+ + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -+ + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } -+ + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi -+ -+ -+ -+ -+ -+ -+ - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. - set dummy ${ac_tool_prefix}strip; ac_word=$2 -@@ -7059,8 +7377,8 @@ esac + + + +@@ -6484,8 +6798,8 @@ esac lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address @@ -2453,7 +2476,7 @@ index 83b4b0172db..2154238189e 100755 # Handle CRLF in mingw tool chain opt_cr= -@@ -7096,6 +7414,7 @@ for ac_symprfx in "" "_"; do +@@ -6521,6 +6835,7 @@ for ac_symprfx in "" "_"; do else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi @@ -2461,7 +2484,7 @@ index 83b4b0172db..2154238189e 100755 # Check to see that the pipe works correctly. pipe_works=no -@@ -7137,6 +7456,18 @@ _LT_EOF +@@ -6562,6 +6877,18 @@ _LT_EOF if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext @@ -2480,7 +2503,7 @@ index 83b4b0172db..2154238189e 100755 #ifdef __cplusplus extern "C" { #endif -@@ -7148,7 +7479,7 @@ _LT_EOF +@@ -6573,7 +6900,7 @@ _LT_EOF cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ @@ -2489,7 +2512,7 @@ index 83b4b0172db..2154238189e 100755 const char *name; void *address; } -@@ -7174,8 +7505,8 @@ static const void *lt_preloaded_setup() { +@@ -6599,8 +6926,8 @@ static const void *lt_preloaded_setup() { _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext @@ -2500,7 +2523,7 @@ index 83b4b0172db..2154238189e 100755 LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 -@@ -7185,8 +7516,8 @@ _LT_EOF +@@ -6610,8 +6937,8 @@ _LT_EOF test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi @@ -2511,7 +2534,7 @@ index 83b4b0172db..2154238189e 100755 else echo "cannot find nm_test_func in $nlist" >&5 fi -@@ -7223,6 +7554,21 @@ else +@@ -6648,6 +6975,19 @@ else $as_echo "ok" >&6; } fi @@ -2528,15 +2551,15 @@ index 83b4b0172db..2154238189e 100755 + + + -+ -+ -@@ -7239,6 +7585,40 @@ fi +@@ -6664,6 +7004,42 @@ fi ++ ++ + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 @@ -2574,7 +2597,7 @@ index 83b4b0172db..2154238189e 100755 -@@ -7450,6 +7830,123 @@ esac +@@ -6875,6 +7251,123 @@ esac need_locks="$enable_libtool_lock" @@ -2698,7 +2721,7 @@ index 83b4b0172db..2154238189e 100755 case $host_os in rhapsody* | darwin*) -@@ -8013,6 +8510,8 @@ _LT_EOF +@@ -7438,6 +7931,8 @@ _LT_EOF $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 @@ -2707,26 +2730,7 @@ index 83b4b0172db..2154238189e 100755 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF -@@ -8208,7 +8707,8 @@ fi - LIBTOOL_DEPS="$ltmain" - - # Always use our own libtool. --LIBTOOL='$(SHELL) $(top_builddir)/libtool' -+LIBTOOL='$(SHELL) $(top_builddir)' -+LIBTOOL="$LIBTOOL/${host_alias}-libtool" - - - -@@ -8297,7 +8797,7 @@ aix3*) - esac - - # Global variables: --ofile=libtool -+ofile=${host_alias}-libtool - can_build_shared=yes - - # All known linkers require a `.a' archive for static linking (except MSVC, -@@ -8595,8 +9095,6 @@ fi +@@ -8020,8 +8515,6 @@ fi lt_prog_compiler_pic= lt_prog_compiler_static= @@ -2735,7 +2739,7 @@ index 83b4b0172db..2154238189e 100755 if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' -@@ -8762,6 +9260,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -8187,6 +8680,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; @@ -2748,7 +2752,7 @@ index 83b4b0172db..2154238189e 100755 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) -@@ -8824,7 +9328,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -8249,7 +8748,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in @@ -2757,7 +2761,7 @@ index 83b4b0172db..2154238189e 100755 lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; -@@ -8881,13 +9385,17 @@ case $host_os in +@@ -8306,13 +8805,17 @@ case $host_os in lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac @@ -2781,7 +2785,7 @@ index 83b4b0172db..2154238189e 100755 # # Check to make sure the PIC flag actually works. -@@ -8948,6 +9456,11 @@ fi +@@ -8373,6 +8876,11 @@ fi @@ -2793,7 +2797,7 @@ index 83b4b0172db..2154238189e 100755 # # Check to make sure the static flag actually works. # -@@ -9298,7 +9811,8 @@ _LT_EOF +@@ -8723,7 +9231,8 @@ _LT_EOF allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes @@ -2803,7 +2807,7 @@ index 83b4b0172db..2154238189e 100755 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' -@@ -9397,12 +9911,12 @@ _LT_EOF +@@ -8822,12 +9331,12 @@ _LT_EOF whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' @@ -2818,7 +2822,7 @@ index 83b4b0172db..2154238189e 100755 fi ;; esac -@@ -9416,8 +9930,8 @@ _LT_EOF +@@ -8841,8 +9350,8 @@ _LT_EOF archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else @@ -2829,7 +2833,7 @@ index 83b4b0172db..2154238189e 100755 fi ;; -@@ -9435,8 +9949,8 @@ _LT_EOF +@@ -8860,8 +9369,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then @@ -2840,7 +2844,7 @@ index 83b4b0172db..2154238189e 100755 else ld_shlibs=no fi -@@ -9482,8 +9996,8 @@ _LT_EOF +@@ -8907,8 +9416,8 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then @@ -2851,7 +2855,7 @@ index 83b4b0172db..2154238189e 100755 else ld_shlibs=no fi -@@ -9613,7 +10127,13 @@ _LT_EOF +@@ -9038,7 +9547,13 @@ _LT_EOF allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. @@ -2866,7 +2870,7 @@ index 83b4b0172db..2154238189e 100755 /* end confdefs.h. */ int -@@ -9626,22 +10146,29 @@ main () +@@ -9051,22 +9566,29 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : @@ -2909,7 +2913,7 @@ index 83b4b0172db..2154238189e 100755 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" 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" -@@ -9653,7 +10180,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9078,7 +9600,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else # Determine the default libpath from the value encoded in an # empty executable. @@ -2924,7 +2928,7 @@ index 83b4b0172db..2154238189e 100755 /* end confdefs.h. */ int -@@ -9666,22 +10199,29 @@ main () +@@ -9091,22 +9619,29 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : @@ -2967,7 +2971,7 @@ index 83b4b0172db..2154238189e 100755 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, -@@ -9726,20 +10266,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9151,20 +9686,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. @@ -3045,7 +3049,7 @@ index 83b4b0172db..2154238189e 100755 ;; darwin* | rhapsody*) -@@ -9800,7 +10383,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9225,7 +9803,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) @@ -3054,7 +3058,7 @@ index 83b4b0172db..2154238189e 100755 hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no -@@ -9808,7 +10391,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9233,7 +9811,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux9*) if test "$GCC" = yes; then @@ -3063,7 +3067,7 @@ index 83b4b0172db..2154238189e 100755 else 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' fi -@@ -9824,7 +10407,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9249,7 +9827,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then @@ -3072,7 +3076,7 @@ index 83b4b0172db..2154238189e 100755 else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi -@@ -9848,10 +10431,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9273,10 +9851,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) @@ -3085,7 +3089,7 @@ index 83b4b0172db..2154238189e 100755 ;; esac else -@@ -9930,23 +10513,36 @@ fi +@@ -9355,23 +9933,36 @@ fi irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then @@ -3130,7 +3134,7 @@ index 83b4b0172db..2154238189e 100755 else 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' 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' -@@ -10031,7 +10627,7 @@ rm -f core conftest.err conftest.$ac_objext \ +@@ -9456,7 +10047,7 @@ rm -f core conftest.err conftest.$ac_objext \ osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' @@ -3139,7 +3143,7 @@ index 83b4b0172db..2154238189e 100755 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' -@@ -10050,9 +10646,9 @@ rm -f core conftest.err conftest.$ac_objext \ +@@ -9475,9 +10066,9 @@ rm -f core conftest.err conftest.$ac_objext \ no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' @@ -3151,7 +3155,7 @@ index 83b4b0172db..2154238189e 100755 else case `$CC -V 2>&1` in *"Compilers 5.0"*) -@@ -10628,8 +11224,9 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -10053,8 +10644,9 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no @@ -3163,7 +3167,7 @@ index 83b4b0172db..2154238189e 100755 library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ -@@ -10662,13 +11259,71 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -10087,13 +10679,71 @@ cygwin* | mingw* | pw32* | cegcc*) library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac @@ -3236,25 +3240,16 @@ index 83b4b0172db..2154238189e 100755 # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; -@@ -10750,7 +11405,7 @@ haiku*) - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes -- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' -+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -@@ -11546,7 +12201,7 @@ else +@@ -10971,7 +11621,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF --#line 11549 "configure" +-#line 10974 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H -@@ -11590,10 +12245,10 @@ else +@@ -11015,10 +11665,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) @@ -3267,16 +3262,16 @@ index 83b4b0172db..2154238189e 100755 int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); -@@ -11652,7 +12307,7 @@ else +@@ -11077,7 +11727,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF --#line 11655 "configure" +-#line 11080 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H -@@ -11696,10 +12351,10 @@ else +@@ -11121,10 +11771,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) @@ -3289,7 +3284,7 @@ index 83b4b0172db..2154238189e 100755 int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); -@@ -16308,13 +16963,20 @@ exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +@@ -15505,13 +16155,20 @@ exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' @@ -3310,7 +3305,7 @@ index 83b4b0172db..2154238189e 100755 STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' -@@ -16329,14 +16991,17 @@ lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$de +@@ -15526,14 +16183,17 @@ lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$de lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' 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"`' @@ -3329,7 +3324,7 @@ index 83b4b0172db..2154238189e 100755 DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' -@@ -16369,12 +17034,12 @@ hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_q +@@ -15566,12 +16226,12 @@ hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_q hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' @@ -3343,7 +3338,7 @@ index 83b4b0172db..2154238189e 100755 file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' -@@ -16429,8 +17094,13 @@ reload_flag \ +@@ -15626,8 +16286,13 @@ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ @@ -3357,7 +3352,7 @@ index 83b4b0172db..2154238189e 100755 STRIP \ RANLIB \ CC \ -@@ -16440,12 +17110,14 @@ lt_cv_sys_global_symbol_pipe \ +@@ -15637,12 +16302,14 @@ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ @@ -3373,7 +3368,7 @@ index 83b4b0172db..2154238189e 100755 DSYMUTIL \ NMEDIT \ LIPO \ -@@ -16461,7 +17133,6 @@ no_undefined_flag \ +@@ -15658,7 +16325,6 @@ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ @@ -3381,7 +3376,7 @@ index 83b4b0172db..2154238189e 100755 exclude_expsyms \ include_expsyms \ file_list_spec \ -@@ -16497,6 +17168,7 @@ module_cmds \ +@@ -15694,6 +16360,7 @@ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ @@ -3389,7 +3384,7 @@ index 83b4b0172db..2154238189e 100755 postinstall_cmds \ postuninstall_cmds \ finish_cmds \ -@@ -17263,7 +17935,8 @@ $as_echo X"$file" | +@@ -16459,7 +17126,8 @@ $as_echo X"$file" | # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, @@ -3399,7 +3394,7 @@ index 83b4b0172db..2154238189e 100755 # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. -@@ -17366,19 +18039,42 @@ SP2NL=$lt_lt_SP2NL +@@ -16562,19 +17230,42 @@ SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP @@ -3443,7 +3438,7 @@ index 83b4b0172db..2154238189e 100755 # A symbol stripping program. STRIP=$lt_STRIP -@@ -17408,6 +18104,12 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address +@@ -16604,6 +17295,12 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix @@ -3456,7 +3451,7 @@ index 83b4b0172db..2154238189e 100755 # The name of the directory that contains temporary libtool files. objdir=$objdir -@@ -17417,6 +18119,9 @@ MAGIC_CMD=$MAGIC_CMD +@@ -16613,6 +17310,9 @@ MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks @@ -3466,7 +3461,7 @@ index 83b4b0172db..2154238189e 100755 # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL -@@ -17531,12 +18236,12 @@ with_gcc=$GCC +@@ -16727,12 +17427,12 @@ with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag @@ -3482,7 +3477,7 @@ index 83b4b0172db..2154238189e 100755 # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static -@@ -17623,9 +18328,6 @@ inherit_rpath=$inherit_rpath +@@ -16819,9 +17519,6 @@ inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs @@ -3492,7 +3487,7 @@ index 83b4b0172db..2154238189e 100755 # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols -@@ -17641,6 +18343,9 @@ include_expsyms=$lt_include_expsyms +@@ -16837,6 +17534,9 @@ include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds @@ -3502,7 +3497,7 @@ index 83b4b0172db..2154238189e 100755 # Specify filename containing input files. file_list_spec=$lt_file_list_spec -@@ -17673,210 +18378,169 @@ ltmain="$ac_aux_dir/ltmain.sh" +@@ -16869,210 +17569,169 @@ ltmain="$ac_aux_dir/ltmain.sh" # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? @@ -3877,10 +3872,10 @@ index 83b4b0172db..2154238189e 100755 chmod +x "$ofile" diff --git a/gas/configure b/gas/configure -index d5ae54925e9..3ff1148d9dd 100755 +index c93030c47c5..b460686bfd6 100755 --- a/gas/configure +++ b/gas/configure -@@ -682,8 +682,11 @@ OTOOL +@@ -681,8 +681,11 @@ OTOOL LIPO NMEDIT DSYMUTIL @@ -3892,7 +3887,7 @@ index d5ae54925e9..3ff1148d9dd 100755 OBJDUMP LN_S NM -@@ -800,6 +803,7 @@ enable_static +@@ -799,6 +802,7 @@ enable_static with_pic enable_fast_install with_gnu_ld @@ -3900,7 +3895,7 @@ index d5ae54925e9..3ff1148d9dd 100755 enable_libtool_lock enable_plugins enable_largefile -@@ -1491,6 +1495,8 @@ Optional Packages: +@@ -1490,6 +1494,8 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] @@ -3909,7 +3904,7 @@ index d5ae54925e9..3ff1148d9dd 100755 --with-cpu=CPU default cpu variant is CPU (currently only supported on ARC) --with-system-zlib use installed libz -@@ -5278,8 +5284,8 @@ esac +@@ -4608,8 +4614,8 @@ esac @@ -3920,7 +3915,7 @@ index d5ae54925e9..3ff1148d9dd 100755 -@@ -5319,7 +5325,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO +@@ -4649,7 +4655,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. @@ -3929,7 +3924,7 @@ index d5ae54925e9..3ff1148d9dd 100755 test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then -@@ -6005,8 +6011,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; +@@ -5336,8 +5342,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" @@ -3940,7 +3935,7 @@ index d5ae54925e9..3ff1148d9dd 100755 && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes -@@ -6055,6 +6061,80 @@ esac +@@ -5386,6 +5392,80 @@ esac @@ -4021,7 +4016,7 @@ index d5ae54925e9..3ff1148d9dd 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : -@@ -6071,6 +6151,11 @@ case $reload_flag in +@@ -5402,6 +5482,11 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in @@ -4033,7 +4028,7 @@ index d5ae54925e9..3ff1148d9dd 100755 darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' -@@ -6239,7 +6324,8 @@ mingw* | pw32*) +@@ -5570,7 +5655,8 @@ mingw* | pw32*) lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else @@ -4043,7 +4038,7 @@ index d5ae54925e9..3ff1148d9dd 100755 lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -@@ -6393,6 +6479,21 @@ esac +@@ -5724,6 +5810,21 @@ esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } @@ -4065,7 +4060,7 @@ index d5ae54925e9..3ff1148d9dd 100755 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown -@@ -6408,9 +6509,162 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown +@@ -5739,6 +5840,157 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -4220,6 +4215,12 @@ index d5ae54925e9..3ff1148d9dd 100755 + + + + plugin_option= + plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll" + for plugin in $plugin_names; do +@@ -5753,8 +6005,10 @@ for plugin in $plugin_names; do + done + if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 @@ -4230,7 +4231,7 @@ index d5ae54925e9..3ff1148d9dd 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : -@@ -6426,7 +6680,7 @@ do +@@ -5770,7 +6024,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then @@ -4239,7 +4240,7 @@ index d5ae54925e9..3ff1148d9dd 100755 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi -@@ -6446,11 +6700,15 @@ $as_echo "no" >&6; } +@@ -5790,11 +6044,15 @@ $as_echo "no" >&6; } fi @@ -4258,7 +4259,7 @@ index d5ae54925e9..3ff1148d9dd 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : -@@ -6466,7 +6724,7 @@ do +@@ -5810,7 +6068,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then @@ -4267,7 +4268,7 @@ index d5ae54925e9..3ff1148d9dd 100755 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi -@@ -6485,6 +6743,10 @@ else +@@ -5829,6 +6087,10 @@ else $as_echo "no" >&6; } fi @@ -4278,7 +4279,7 @@ index d5ae54925e9..3ff1148d9dd 100755 if test "x$ac_ct_AR" = x; then AR="false" else -@@ -6496,12 +6758,10 @@ ac_tool_warned=yes ;; +@@ -5840,29 +6102,81 @@ ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi @@ -4287,16 +4288,40 @@ index d5ae54925e9..3ff1148d9dd 100755 fi -test -z "$AR" && AR=ar +-if test -n "$plugin_option"; then +- if $AR --help 2>&1 | grep -q "\--plugin"; then +- touch conftest.c +- $AR $plugin_option rc conftest.a conftest.c +- if test "$?" != 0; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 ++ touch conftest.c ++ $AR $plugin_option rc conftest.a conftest.c ++ if test "$?" != 0; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 + $as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;} +- else +- AR="$AR $plugin_option" +- fi +- rm -f conftest.* ++ else ++ AR="$AR $plugin_option" + fi +-fi -test -z "$AR_FLAGS" && AR_FLAGS=cru ++ rm -f conftest.* +: ${AR=ar} +: ${AR_FLAGS=cru} - - - -@@ -6513,6 +6773,64 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru - - - ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : @@ -4309,7 +4334,7 @@ index d5ae54925e9..3ff1148d9dd 100755 +int +main () +{ -+ + + ; + return 0; +} @@ -4335,30 +4360,23 @@ index d5ae54925e9..3ff1148d9dd 100755 + fi + fi + rm -f conftest.* libconftest.a -+ + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -+ + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } -+ + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi -+ -+ -+ -+ -+ -+ -+ - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. - set dummy ${ac_tool_prefix}strip; ac_word=$2 -@@ -6847,8 +7165,8 @@ esac + + + +@@ -6209,8 +6523,8 @@ esac lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address @@ -4369,7 +4387,7 @@ index d5ae54925e9..3ff1148d9dd 100755 # Handle CRLF in mingw tool chain opt_cr= -@@ -6884,6 +7202,7 @@ for ac_symprfx in "" "_"; do +@@ -6246,6 +6560,7 @@ for ac_symprfx in "" "_"; do else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi @@ -4377,7 +4395,7 @@ index d5ae54925e9..3ff1148d9dd 100755 # Check to see that the pipe works correctly. pipe_works=no -@@ -6925,6 +7244,18 @@ _LT_EOF +@@ -6287,6 +6602,18 @@ _LT_EOF if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext @@ -4396,7 +4414,7 @@ index d5ae54925e9..3ff1148d9dd 100755 #ifdef __cplusplus extern "C" { #endif -@@ -6936,7 +7267,7 @@ _LT_EOF +@@ -6298,7 +6625,7 @@ _LT_EOF cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ @@ -4405,7 +4423,7 @@ index d5ae54925e9..3ff1148d9dd 100755 const char *name; void *address; } -@@ -6962,8 +7293,8 @@ static const void *lt_preloaded_setup() { +@@ -6324,8 +6651,8 @@ static const void *lt_preloaded_setup() { _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext @@ -4416,7 +4434,7 @@ index d5ae54925e9..3ff1148d9dd 100755 LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 -@@ -6973,8 +7304,8 @@ _LT_EOF +@@ -6335,8 +6662,8 @@ _LT_EOF test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi @@ -4427,7 +4445,7 @@ index d5ae54925e9..3ff1148d9dd 100755 else echo "cannot find nm_test_func in $nlist" >&5 fi -@@ -7011,6 +7342,21 @@ else +@@ -6373,6 +6700,19 @@ else $as_echo "ok" >&6; } fi @@ -4444,15 +4462,15 @@ index d5ae54925e9..3ff1148d9dd 100755 + + + -+ -+ -@@ -7027,6 +7373,40 @@ fi +@@ -6389,6 +6729,42 @@ fi ++ ++ + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 @@ -4490,7 +4508,7 @@ index d5ae54925e9..3ff1148d9dd 100755 -@@ -7238,6 +7618,123 @@ esac +@@ -6600,6 +6976,123 @@ esac need_locks="$enable_libtool_lock" @@ -4614,7 +4632,7 @@ index d5ae54925e9..3ff1148d9dd 100755 case $host_os in rhapsody* | darwin*) -@@ -7801,6 +8298,8 @@ _LT_EOF +@@ -7163,6 +7656,8 @@ _LT_EOF $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 @@ -4623,26 +4641,7 @@ index d5ae54925e9..3ff1148d9dd 100755 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF -@@ -7996,7 +8495,8 @@ fi - LIBTOOL_DEPS="$ltmain" - - # Always use our own libtool. --LIBTOOL='$(SHELL) $(top_builddir)/libtool' -+LIBTOOL='$(SHELL) $(top_builddir)' -+LIBTOOL="$LIBTOOL/${host_alias}-libtool" - - - -@@ -8085,7 +8585,7 @@ aix3*) - esac - - # Global variables: --ofile=libtool -+ofile=${host_alias}-libtool - can_build_shared=yes - - # All known linkers require a `.a' archive for static linking (except MSVC, -@@ -8383,8 +8883,6 @@ fi +@@ -7745,8 +8240,6 @@ fi lt_prog_compiler_pic= lt_prog_compiler_static= @@ -4651,7 +4650,7 @@ index d5ae54925e9..3ff1148d9dd 100755 if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' -@@ -8550,6 +9048,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -7912,6 +8405,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; @@ -4664,7 +4663,7 @@ index d5ae54925e9..3ff1148d9dd 100755 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) -@@ -8612,7 +9116,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -7974,7 +8473,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in @@ -4673,7 +4672,7 @@ index d5ae54925e9..3ff1148d9dd 100755 lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; -@@ -8669,13 +9173,17 @@ case $host_os in +@@ -8031,13 +8530,17 @@ case $host_os in lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac @@ -4697,7 +4696,7 @@ index d5ae54925e9..3ff1148d9dd 100755 # # Check to make sure the PIC flag actually works. -@@ -8736,6 +9244,11 @@ fi +@@ -8098,6 +8601,11 @@ fi @@ -4709,7 +4708,7 @@ index d5ae54925e9..3ff1148d9dd 100755 # # Check to make sure the static flag actually works. # -@@ -9086,7 +9599,8 @@ _LT_EOF +@@ -8448,7 +8956,8 @@ _LT_EOF allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes @@ -4719,7 +4718,7 @@ index d5ae54925e9..3ff1148d9dd 100755 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' -@@ -9185,12 +9699,12 @@ _LT_EOF +@@ -8547,12 +9056,12 @@ _LT_EOF whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' @@ -4734,7 +4733,7 @@ index d5ae54925e9..3ff1148d9dd 100755 fi ;; esac -@@ -9204,8 +9718,8 @@ _LT_EOF +@@ -8566,8 +9075,8 @@ _LT_EOF archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else @@ -4745,7 +4744,7 @@ index d5ae54925e9..3ff1148d9dd 100755 fi ;; -@@ -9223,8 +9737,8 @@ _LT_EOF +@@ -8585,8 +9094,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then @@ -4756,7 +4755,7 @@ index d5ae54925e9..3ff1148d9dd 100755 else ld_shlibs=no fi -@@ -9270,8 +9784,8 @@ _LT_EOF +@@ -8632,8 +9141,8 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then @@ -4767,7 +4766,7 @@ index d5ae54925e9..3ff1148d9dd 100755 else ld_shlibs=no fi -@@ -9401,7 +9915,13 @@ _LT_EOF +@@ -8763,7 +9272,13 @@ _LT_EOF allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. @@ -4782,7 +4781,7 @@ index d5ae54925e9..3ff1148d9dd 100755 /* end confdefs.h. */ int -@@ -9414,22 +9934,29 @@ main () +@@ -8776,22 +9291,29 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : @@ -4825,7 +4824,7 @@ index d5ae54925e9..3ff1148d9dd 100755 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" 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" -@@ -9441,7 +9968,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -8803,7 +9325,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else # Determine the default libpath from the value encoded in an # empty executable. @@ -4840,7 +4839,7 @@ index d5ae54925e9..3ff1148d9dd 100755 /* end confdefs.h. */ int -@@ -9454,22 +9987,29 @@ main () +@@ -8816,22 +9344,29 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : @@ -4883,7 +4882,7 @@ index d5ae54925e9..3ff1148d9dd 100755 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, -@@ -9514,20 +10054,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -8876,20 +9411,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. @@ -4961,7 +4960,7 @@ index d5ae54925e9..3ff1148d9dd 100755 ;; darwin* | rhapsody*) -@@ -9588,7 +10171,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -8950,7 +9528,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) @@ -4970,7 +4969,7 @@ index d5ae54925e9..3ff1148d9dd 100755 hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no -@@ -9596,7 +10179,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -8958,7 +9536,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux9*) if test "$GCC" = yes; then @@ -4979,7 +4978,7 @@ index d5ae54925e9..3ff1148d9dd 100755 else 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' fi -@@ -9612,7 +10195,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -8974,7 +9552,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then @@ -4988,7 +4987,7 @@ index d5ae54925e9..3ff1148d9dd 100755 else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi -@@ -9636,10 +10219,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -8998,10 +9576,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) @@ -5001,7 +5000,7 @@ index d5ae54925e9..3ff1148d9dd 100755 ;; esac else -@@ -9718,23 +10301,36 @@ fi +@@ -9080,23 +9658,36 @@ fi irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then @@ -5046,7 +5045,7 @@ index d5ae54925e9..3ff1148d9dd 100755 else 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' 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' -@@ -9819,7 +10415,7 @@ rm -f core conftest.err conftest.$ac_objext \ +@@ -9181,7 +9772,7 @@ rm -f core conftest.err conftest.$ac_objext \ osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' @@ -5055,7 +5054,7 @@ index d5ae54925e9..3ff1148d9dd 100755 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' -@@ -9838,9 +10434,9 @@ rm -f core conftest.err conftest.$ac_objext \ +@@ -9200,9 +9791,9 @@ rm -f core conftest.err conftest.$ac_objext \ no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' @@ -5067,7 +5066,7 @@ index d5ae54925e9..3ff1148d9dd 100755 else case `$CC -V 2>&1` in *"Compilers 5.0"*) -@@ -10416,8 +11012,9 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -9778,8 +10369,9 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no @@ -5079,7 +5078,7 @@ index d5ae54925e9..3ff1148d9dd 100755 library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ -@@ -10450,13 +11047,71 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -9812,13 +10404,71 @@ cygwin* | mingw* | pw32* | cegcc*) library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac @@ -5152,25 +5151,16 @@ index d5ae54925e9..3ff1148d9dd 100755 # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; -@@ -10538,7 +11193,7 @@ haiku*) - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes -- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' -+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -@@ -11334,7 +11989,7 @@ else +@@ -10696,7 +11346,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF --#line 11337 "configure" +-#line 10699 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H -@@ -11378,10 +12033,10 @@ else +@@ -10740,10 +11390,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) @@ -5183,16 +5173,16 @@ index d5ae54925e9..3ff1148d9dd 100755 int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); -@@ -11440,7 +12095,7 @@ else +@@ -10802,7 +11452,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF --#line 11443 "configure" +-#line 10805 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H -@@ -11484,10 +12139,10 @@ else +@@ -10846,10 +11496,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) @@ -5205,7 +5195,7 @@ index d5ae54925e9..3ff1148d9dd 100755 int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); -@@ -16020,13 +16675,20 @@ exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +@@ -14844,13 +15494,20 @@ exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' @@ -5226,7 +5216,7 @@ index d5ae54925e9..3ff1148d9dd 100755 STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' -@@ -16041,14 +16703,17 @@ lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$de +@@ -14865,14 +15522,17 @@ lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$de lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' 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"`' @@ -5245,7 +5235,7 @@ index d5ae54925e9..3ff1148d9dd 100755 DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' -@@ -16081,12 +16746,12 @@ hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_q +@@ -14905,12 +15565,12 @@ hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_q hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' @@ -5259,7 +5249,7 @@ index d5ae54925e9..3ff1148d9dd 100755 file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' -@@ -16141,8 +16806,13 @@ reload_flag \ +@@ -14965,8 +15625,13 @@ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ @@ -5273,7 +5263,7 @@ index d5ae54925e9..3ff1148d9dd 100755 STRIP \ RANLIB \ CC \ -@@ -16152,12 +16822,14 @@ lt_cv_sys_global_symbol_pipe \ +@@ -14976,12 +15641,14 @@ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ @@ -5289,7 +5279,7 @@ index d5ae54925e9..3ff1148d9dd 100755 DSYMUTIL \ NMEDIT \ LIPO \ -@@ -16173,7 +16845,6 @@ no_undefined_flag \ +@@ -14997,7 +15664,6 @@ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ @@ -5297,7 +5287,7 @@ index d5ae54925e9..3ff1148d9dd 100755 exclude_expsyms \ include_expsyms \ file_list_spec \ -@@ -16209,6 +16880,7 @@ module_cmds \ +@@ -15033,6 +15699,7 @@ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ @@ -5305,7 +5295,7 @@ index d5ae54925e9..3ff1148d9dd 100755 postinstall_cmds \ postuninstall_cmds \ finish_cmds \ -@@ -16982,7 +17654,8 @@ $as_echo X"$file" | +@@ -15805,7 +16472,8 @@ $as_echo X"$file" | # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, @@ -5315,7 +5305,7 @@ index d5ae54925e9..3ff1148d9dd 100755 # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. -@@ -17085,19 +17758,42 @@ SP2NL=$lt_lt_SP2NL +@@ -15908,19 +16576,42 @@ SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP @@ -5359,7 +5349,7 @@ index d5ae54925e9..3ff1148d9dd 100755 # A symbol stripping program. STRIP=$lt_STRIP -@@ -17127,6 +17823,12 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address +@@ -15950,6 +16641,12 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix @@ -5372,7 +5362,7 @@ index d5ae54925e9..3ff1148d9dd 100755 # The name of the directory that contains temporary libtool files. objdir=$objdir -@@ -17136,6 +17838,9 @@ MAGIC_CMD=$MAGIC_CMD +@@ -15959,6 +16656,9 @@ MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks @@ -5382,7 +5372,7 @@ index d5ae54925e9..3ff1148d9dd 100755 # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL -@@ -17250,12 +17955,12 @@ with_gcc=$GCC +@@ -16073,12 +16773,12 @@ with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag @@ -5398,7 +5388,7 @@ index d5ae54925e9..3ff1148d9dd 100755 # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static -@@ -17342,9 +18047,6 @@ inherit_rpath=$inherit_rpath +@@ -16165,9 +16865,6 @@ inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs @@ -5408,7 +5398,7 @@ index d5ae54925e9..3ff1148d9dd 100755 # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols -@@ -17360,6 +18062,9 @@ include_expsyms=$lt_include_expsyms +@@ -16183,6 +16880,9 @@ include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds @@ -5418,7 +5408,7 @@ index d5ae54925e9..3ff1148d9dd 100755 # Specify filename containing input files. file_list_spec=$lt_file_list_spec -@@ -17392,210 +18097,169 @@ ltmain="$ac_aux_dir/ltmain.sh" +@@ -16215,210 +16915,169 @@ ltmain="$ac_aux_dir/ltmain.sh" # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? @@ -5793,7 +5783,7 @@ index d5ae54925e9..3ff1148d9dd 100755 chmod +x "$ofile" diff --git a/gprof/configure b/gprof/configure -index b12ec2e472f..57986ca995a 100755 +index 8cb3921c34f..6fbe9721ba4 100755 --- a/gprof/configure +++ b/gprof/configure @@ -663,8 +663,11 @@ OTOOL @@ -5825,7 +5815,7 @@ index b12ec2e472f..57986ca995a 100755 Some influential environment variables: CC C compiler command -@@ -5125,8 +5131,8 @@ esac +@@ -4510,8 +4516,8 @@ esac @@ -5836,7 +5826,7 @@ index b12ec2e472f..57986ca995a 100755 -@@ -5166,7 +5172,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO +@@ -4551,7 +4557,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. @@ -5845,7 +5835,7 @@ index b12ec2e472f..57986ca995a 100755 test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then -@@ -5852,8 +5858,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; +@@ -5238,8 +5244,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" @@ -5856,7 +5846,7 @@ index b12ec2e472f..57986ca995a 100755 && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes -@@ -5902,6 +5908,80 @@ esac +@@ -5288,6 +5294,80 @@ esac @@ -5937,7 +5927,7 @@ index b12ec2e472f..57986ca995a 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : -@@ -5918,6 +5998,11 @@ case $reload_flag in +@@ -5304,6 +5384,11 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in @@ -5949,7 +5939,7 @@ index b12ec2e472f..57986ca995a 100755 darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' -@@ -6086,7 +6171,8 @@ mingw* | pw32*) +@@ -5472,7 +5557,8 @@ mingw* | pw32*) lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else @@ -5959,7 +5949,7 @@ index b12ec2e472f..57986ca995a 100755 lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -@@ -6240,6 +6326,21 @@ esac +@@ -5626,6 +5712,21 @@ esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } @@ -5981,7 +5971,7 @@ index b12ec2e472f..57986ca995a 100755 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown -@@ -6253,11 +6354,164 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown +@@ -5641,6 +5742,157 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -5995,11 +5985,7 @@ index b12ec2e472f..57986ca995a 100755 + + + - - - if test -n "$ac_tool_prefix"; then -- # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. --set dummy ${ac_tool_prefix}ar; ac_word=$2 ++if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -6140,7 +6126,15 @@ index b12ec2e472f..57986ca995a 100755 + + + -+if test -n "$ac_tool_prefix"; then + plugin_option= + plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll" + for plugin in $plugin_names; do +@@ -5655,8 +5907,10 @@ for plugin in $plugin_names; do + done + + if test -n "$ac_tool_prefix"; then +- # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +-set dummy ${ac_tool_prefix}ar; ac_word=$2 + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. @@ -6148,7 +6142,7 @@ index b12ec2e472f..57986ca995a 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : -@@ -6273,7 +6527,7 @@ do +@@ -5672,7 +5926,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then @@ -6157,7 +6151,7 @@ index b12ec2e472f..57986ca995a 100755 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi -@@ -6293,11 +6547,15 @@ $as_echo "no" >&6; } +@@ -5692,11 +5946,15 @@ $as_echo "no" >&6; } fi @@ -6176,7 +6170,7 @@ index b12ec2e472f..57986ca995a 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : -@@ -6313,7 +6571,7 @@ do +@@ -5712,7 +5970,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then @@ -6185,7 +6179,7 @@ index b12ec2e472f..57986ca995a 100755 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi -@@ -6332,6 +6590,10 @@ else +@@ -5731,6 +5989,10 @@ else $as_echo "no" >&6; } fi @@ -6196,7 +6190,7 @@ index b12ec2e472f..57986ca995a 100755 if test "x$ac_ct_AR" = x; then AR="false" else -@@ -6343,16 +6605,72 @@ ac_tool_warned=yes ;; +@@ -5742,25 +6004,19 @@ ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi @@ -6205,20 +6199,36 @@ index b12ec2e472f..57986ca995a 100755 fi -test -z "$AR" && AR=ar +-if test -n "$plugin_option"; then +- if $AR --help 2>&1 | grep -q "\--plugin"; then +- touch conftest.c +- $AR $plugin_option rc conftest.a conftest.c +- if test "$?" != 0; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 ++ touch conftest.c ++ $AR $plugin_option rc conftest.a conftest.c ++ if test "$?" != 0; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 + $as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;} +- else +- AR="$AR $plugin_option" +- fi +- rm -f conftest.* ++ else ++ AR="$AR $plugin_option" + fi +-fi -test -z "$AR_FLAGS" && AR_FLAGS=cru ++ rm -f conftest.* +: ${AR=ar} +: ${AR_FLAGS=cru} -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ + + + +@@ -5772,6 +6028,64 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : @@ -6231,7 +6241,7 @@ index b12ec2e472f..57986ca995a 100755 +int +main () +{ - ++ + ; + return 0; +} @@ -6257,23 +6267,30 @@ index b12ec2e472f..57986ca995a 100755 + fi + fi + rm -f conftest.* libconftest.a - ++ +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ++ +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } - ++ +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi - - - -@@ -6694,8 +7012,8 @@ esac ++ ++ ++ ++ ++ ++ ++ + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. + set dummy ${ac_tool_prefix}strip; ac_word=$2 +@@ -6111,8 +6425,8 @@ esac lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address @@ -6284,7 +6301,7 @@ index b12ec2e472f..57986ca995a 100755 # Handle CRLF in mingw tool chain opt_cr= -@@ -6731,6 +7049,7 @@ for ac_symprfx in "" "_"; do +@@ -6148,6 +6462,7 @@ for ac_symprfx in "" "_"; do else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi @@ -6292,7 +6309,7 @@ index b12ec2e472f..57986ca995a 100755 # Check to see that the pipe works correctly. pipe_works=no -@@ -6772,6 +7091,18 @@ _LT_EOF +@@ -6189,6 +6504,18 @@ _LT_EOF if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext @@ -6311,7 +6328,7 @@ index b12ec2e472f..57986ca995a 100755 #ifdef __cplusplus extern "C" { #endif -@@ -6783,7 +7114,7 @@ _LT_EOF +@@ -6200,7 +6527,7 @@ _LT_EOF cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ @@ -6320,7 +6337,7 @@ index b12ec2e472f..57986ca995a 100755 const char *name; void *address; } -@@ -6809,8 +7140,8 @@ static const void *lt_preloaded_setup() { +@@ -6226,8 +6553,8 @@ static const void *lt_preloaded_setup() { _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext @@ -6331,7 +6348,7 @@ index b12ec2e472f..57986ca995a 100755 LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 -@@ -6820,8 +7151,8 @@ _LT_EOF +@@ -6237,8 +6564,8 @@ _LT_EOF test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi @@ -6342,7 +6359,7 @@ index b12ec2e472f..57986ca995a 100755 else echo "cannot find nm_test_func in $nlist" >&5 fi -@@ -6858,6 +7189,20 @@ else +@@ -6275,6 +6602,18 @@ else $as_echo "ok" >&6; } fi @@ -6358,15 +6375,15 @@ index b12ec2e472f..57986ca995a 100755 + + + -+ -+ -@@ -6874,6 +7219,41 @@ fi +@@ -6291,6 +6630,43 @@ fi ++ ++ + + + @@ -6405,7 +6422,7 @@ index b12ec2e472f..57986ca995a 100755 -@@ -7085,6 +7465,123 @@ esac +@@ -6502,6 +6878,123 @@ esac need_locks="$enable_libtool_lock" @@ -6529,7 +6546,7 @@ index b12ec2e472f..57986ca995a 100755 case $host_os in rhapsody* | darwin*) -@@ -7648,6 +8145,8 @@ _LT_EOF +@@ -7065,6 +7558,8 @@ _LT_EOF $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 @@ -6538,26 +6555,7 @@ index b12ec2e472f..57986ca995a 100755 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF -@@ -7843,7 +8342,8 @@ fi - LIBTOOL_DEPS="$ltmain" - - # Always use our own libtool. --LIBTOOL='$(SHELL) $(top_builddir)/libtool' -+LIBTOOL='$(SHELL) $(top_builddir)' -+LIBTOOL="$LIBTOOL/${host_alias}-libtool" - - - -@@ -7932,7 +8432,7 @@ aix3*) - esac - - # Global variables: --ofile=libtool -+ofile=${host_alias}-libtool - can_build_shared=yes - - # All known linkers require a `.a' archive for static linking (except MSVC, -@@ -8230,8 +8730,6 @@ fi +@@ -7647,8 +8142,6 @@ fi lt_prog_compiler_pic= lt_prog_compiler_static= @@ -6566,7 +6564,7 @@ index b12ec2e472f..57986ca995a 100755 if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' -@@ -8397,6 +8895,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -7814,6 +8307,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; @@ -6579,7 +6577,7 @@ index b12ec2e472f..57986ca995a 100755 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) -@@ -8459,7 +8963,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -7876,7 +8375,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in @@ -6588,7 +6586,7 @@ index b12ec2e472f..57986ca995a 100755 lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; -@@ -8516,13 +9020,17 @@ case $host_os in +@@ -7933,13 +8432,17 @@ case $host_os in lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac @@ -6612,7 +6610,7 @@ index b12ec2e472f..57986ca995a 100755 # # Check to make sure the PIC flag actually works. -@@ -8583,6 +9091,11 @@ fi +@@ -8000,6 +8503,11 @@ fi @@ -6624,7 +6622,7 @@ index b12ec2e472f..57986ca995a 100755 # # Check to make sure the static flag actually works. # -@@ -8933,7 +9446,8 @@ _LT_EOF +@@ -8350,7 +8858,8 @@ _LT_EOF allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes @@ -6634,7 +6632,7 @@ index b12ec2e472f..57986ca995a 100755 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' -@@ -9032,12 +9546,12 @@ _LT_EOF +@@ -8449,12 +8958,12 @@ _LT_EOF whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' @@ -6649,7 +6647,7 @@ index b12ec2e472f..57986ca995a 100755 fi ;; esac -@@ -9051,8 +9565,8 @@ _LT_EOF +@@ -8468,8 +8977,8 @@ _LT_EOF archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else @@ -6660,7 +6658,7 @@ index b12ec2e472f..57986ca995a 100755 fi ;; -@@ -9070,8 +9584,8 @@ _LT_EOF +@@ -8487,8 +8996,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then @@ -6671,7 +6669,7 @@ index b12ec2e472f..57986ca995a 100755 else ld_shlibs=no fi -@@ -9117,8 +9631,8 @@ _LT_EOF +@@ -8534,8 +9043,8 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then @@ -6682,7 +6680,7 @@ index b12ec2e472f..57986ca995a 100755 else ld_shlibs=no fi -@@ -9248,7 +9762,13 @@ _LT_EOF +@@ -8665,7 +9174,13 @@ _LT_EOF allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. @@ -6697,7 +6695,7 @@ index b12ec2e472f..57986ca995a 100755 /* end confdefs.h. */ int -@@ -9261,22 +9781,29 @@ main () +@@ -8678,22 +9193,29 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : @@ -6740,7 +6738,7 @@ index b12ec2e472f..57986ca995a 100755 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" 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" -@@ -9288,7 +9815,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -8705,7 +9227,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else # Determine the default libpath from the value encoded in an # empty executable. @@ -6755,7 +6753,7 @@ index b12ec2e472f..57986ca995a 100755 /* end confdefs.h. */ int -@@ -9301,22 +9834,29 @@ main () +@@ -8718,22 +9246,29 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : @@ -6798,7 +6796,7 @@ index b12ec2e472f..57986ca995a 100755 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, -@@ -9361,20 +9901,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -8778,20 +9313,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. @@ -6876,7 +6874,7 @@ index b12ec2e472f..57986ca995a 100755 ;; darwin* | rhapsody*) -@@ -9435,7 +10018,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -8852,7 +9430,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) @@ -6885,7 +6883,7 @@ index b12ec2e472f..57986ca995a 100755 hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no -@@ -9443,7 +10026,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -8860,7 +9438,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux9*) if test "$GCC" = yes; then @@ -6894,7 +6892,7 @@ index b12ec2e472f..57986ca995a 100755 else 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' fi -@@ -9459,7 +10042,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -8876,7 +9454,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then @@ -6903,7 +6901,7 @@ index b12ec2e472f..57986ca995a 100755 else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi -@@ -9483,10 +10066,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -8900,10 +9478,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) @@ -6916,7 +6914,7 @@ index b12ec2e472f..57986ca995a 100755 ;; esac else -@@ -9565,23 +10148,36 @@ fi +@@ -8982,23 +9560,36 @@ fi irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then @@ -6961,7 +6959,7 @@ index b12ec2e472f..57986ca995a 100755 else 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' 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' -@@ -9666,7 +10262,7 @@ rm -f core conftest.err conftest.$ac_objext \ +@@ -9083,7 +9674,7 @@ rm -f core conftest.err conftest.$ac_objext \ osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' @@ -6970,7 +6968,7 @@ index b12ec2e472f..57986ca995a 100755 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' -@@ -9685,9 +10281,9 @@ rm -f core conftest.err conftest.$ac_objext \ +@@ -9102,9 +9693,9 @@ rm -f core conftest.err conftest.$ac_objext \ no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' @@ -6982,7 +6980,7 @@ index b12ec2e472f..57986ca995a 100755 else case `$CC -V 2>&1` in *"Compilers 5.0"*) -@@ -10263,8 +10859,9 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -9680,8 +10271,9 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no @@ -6994,7 +6992,7 @@ index b12ec2e472f..57986ca995a 100755 library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ -@@ -10297,13 +10894,71 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -9714,13 +10306,71 @@ cygwin* | mingw* | pw32* | cegcc*) library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac @@ -7067,25 +7065,16 @@ index b12ec2e472f..57986ca995a 100755 # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; -@@ -10385,7 +11040,7 @@ haiku*) - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes -- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' -+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -@@ -11181,7 +11836,7 @@ else +@@ -10598,7 +11248,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF --#line 11184 "configure" +-#line 10601 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H -@@ -11225,10 +11880,10 @@ else +@@ -10642,10 +11292,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) @@ -7098,16 +7087,16 @@ index b12ec2e472f..57986ca995a 100755 int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); -@@ -11287,7 +11942,7 @@ else +@@ -10704,7 +11354,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF --#line 11290 "configure" +-#line 10707 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H -@@ -11331,10 +11986,10 @@ else +@@ -10748,10 +11398,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) @@ -7120,7 +7109,7 @@ index b12ec2e472f..57986ca995a 100755 int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); -@@ -13341,13 +13996,20 @@ exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +@@ -12771,13 +13421,20 @@ exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' @@ -7141,7 +7130,7 @@ index b12ec2e472f..57986ca995a 100755 STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' -@@ -13362,14 +14024,17 @@ lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$de +@@ -12792,14 +13449,17 @@ lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$de lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' 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"`' @@ -7160,7 +7149,7 @@ index b12ec2e472f..57986ca995a 100755 DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' -@@ -13402,12 +14067,12 @@ hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_q +@@ -12832,12 +13492,12 @@ hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_q hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' @@ -7174,7 +7163,7 @@ index b12ec2e472f..57986ca995a 100755 file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' -@@ -13462,8 +14127,13 @@ reload_flag \ +@@ -12892,8 +13552,13 @@ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ @@ -7188,7 +7177,7 @@ index b12ec2e472f..57986ca995a 100755 STRIP \ RANLIB \ CC \ -@@ -13473,12 +14143,14 @@ lt_cv_sys_global_symbol_pipe \ +@@ -12903,12 +13568,14 @@ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ @@ -7204,7 +7193,7 @@ index b12ec2e472f..57986ca995a 100755 DSYMUTIL \ NMEDIT \ LIPO \ -@@ -13494,7 +14166,6 @@ no_undefined_flag \ +@@ -12924,7 +13591,6 @@ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ @@ -7212,7 +7201,7 @@ index b12ec2e472f..57986ca995a 100755 exclude_expsyms \ include_expsyms \ file_list_spec \ -@@ -13530,6 +14201,7 @@ module_cmds \ +@@ -12960,6 +13626,7 @@ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ @@ -7220,7 +7209,7 @@ index b12ec2e472f..57986ca995a 100755 postinstall_cmds \ postuninstall_cmds \ finish_cmds \ -@@ -14295,7 +14967,8 @@ $as_echo X"$file" | +@@ -13725,7 +14392,8 @@ $as_echo X"$file" | # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, @@ -7230,7 +7219,7 @@ index b12ec2e472f..57986ca995a 100755 # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. -@@ -14398,19 +15071,42 @@ SP2NL=$lt_lt_SP2NL +@@ -13828,19 +14496,42 @@ SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP @@ -7274,7 +7263,7 @@ index b12ec2e472f..57986ca995a 100755 # A symbol stripping program. STRIP=$lt_STRIP -@@ -14440,6 +15136,12 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address +@@ -13870,6 +14561,12 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix @@ -7287,7 +7276,7 @@ index b12ec2e472f..57986ca995a 100755 # The name of the directory that contains temporary libtool files. objdir=$objdir -@@ -14449,6 +15151,9 @@ MAGIC_CMD=$MAGIC_CMD +@@ -13879,6 +14576,9 @@ MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks @@ -7297,7 +7286,7 @@ index b12ec2e472f..57986ca995a 100755 # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL -@@ -14563,12 +15268,12 @@ with_gcc=$GCC +@@ -13993,12 +14693,12 @@ with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag @@ -7313,7 +7302,7 @@ index b12ec2e472f..57986ca995a 100755 # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static -@@ -14655,9 +15360,6 @@ inherit_rpath=$inherit_rpath +@@ -14085,9 +14785,6 @@ inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs @@ -7323,7 +7312,7 @@ index b12ec2e472f..57986ca995a 100755 # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols -@@ -14673,6 +15375,9 @@ include_expsyms=$lt_include_expsyms +@@ -14103,6 +14800,9 @@ include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds @@ -7333,7 +7322,7 @@ index b12ec2e472f..57986ca995a 100755 # Specify filename containing input files. file_list_spec=$lt_file_list_spec -@@ -14705,210 +15410,169 @@ ltmain="$ac_aux_dir/ltmain.sh" +@@ -14135,210 +14835,169 @@ ltmain="$ac_aux_dir/ltmain.sh" # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? @@ -7708,10 +7697,10 @@ index b12ec2e472f..57986ca995a 100755 chmod +x "$ofile" diff --git a/ld/configure b/ld/configure -index 8355c433c76..a49ab3d1f09 100755 +index 5d7415a4670..fb8fa5c4df3 100755 --- a/ld/configure +++ b/ld/configure -@@ -693,8 +693,11 @@ OTOOL +@@ -695,8 +695,11 @@ OTOOL LIPO NMEDIT DSYMUTIL @@ -7723,7 +7712,7 @@ index 8355c433c76..a49ab3d1f09 100755 OBJDUMP LN_S NM -@@ -821,6 +824,7 @@ enable_static +@@ -823,6 +826,7 @@ enable_static with_pic enable_fast_install with_gnu_ld @@ -7731,7 +7720,7 @@ index 8355c433c76..a49ab3d1f09 100755 enable_libtool_lock enable_plugins enable_largefile -@@ -1526,6 +1530,8 @@ Optional Packages: +@@ -1530,6 +1534,8 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] @@ -7740,7 +7729,7 @@ index 8355c433c76..a49ab3d1f09 100755 --with-lib-path=dir1:dir2... set default LIB_PATH --with-sysroot=DIR Search for usr/lib et al within DIR. --with-system-zlib use installed libz -@@ -5979,8 +5985,8 @@ esac +@@ -5368,8 +5374,8 @@ esac @@ -7751,7 +7740,7 @@ index 8355c433c76..a49ab3d1f09 100755 -@@ -6020,7 +6026,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO +@@ -5409,7 +5415,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. @@ -7760,7 +7749,7 @@ index 8355c433c76..a49ab3d1f09 100755 test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then -@@ -6706,8 +6712,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; +@@ -6096,8 +6102,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" @@ -7771,7 +7760,7 @@ index 8355c433c76..a49ab3d1f09 100755 && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes -@@ -6756,6 +6762,80 @@ esac +@@ -6146,6 +6152,80 @@ esac @@ -7852,7 +7841,7 @@ index 8355c433c76..a49ab3d1f09 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : -@@ -6772,6 +6852,11 @@ case $reload_flag in +@@ -6162,6 +6242,11 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in @@ -7864,7 +7853,7 @@ index 8355c433c76..a49ab3d1f09 100755 darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' -@@ -6940,7 +7025,8 @@ mingw* | pw32*) +@@ -6330,7 +6415,8 @@ mingw* | pw32*) lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else @@ -7874,7 +7863,7 @@ index 8355c433c76..a49ab3d1f09 100755 lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -@@ -7094,6 +7180,21 @@ esac +@@ -6484,6 +6570,21 @@ esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } @@ -7896,7 +7885,7 @@ index 8355c433c76..a49ab3d1f09 100755 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown -@@ -7109,9 +7210,162 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown +@@ -6499,6 +6600,157 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -8051,6 +8040,12 @@ index 8355c433c76..a49ab3d1f09 100755 + + + + plugin_option= + plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll" + for plugin in $plugin_names; do +@@ -6513,8 +6765,10 @@ for plugin in $plugin_names; do + done + if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 @@ -8061,7 +8056,7 @@ index 8355c433c76..a49ab3d1f09 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : -@@ -7127,7 +7381,7 @@ do +@@ -6530,7 +6784,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then @@ -8070,7 +8065,7 @@ index 8355c433c76..a49ab3d1f09 100755 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi -@@ -7147,11 +7401,15 @@ $as_echo "no" >&6; } +@@ -6550,11 +6804,15 @@ $as_echo "no" >&6; } fi @@ -8089,7 +8084,7 @@ index 8355c433c76..a49ab3d1f09 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : -@@ -7167,7 +7425,7 @@ do +@@ -6570,7 +6828,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then @@ -8098,7 +8093,7 @@ index 8355c433c76..a49ab3d1f09 100755 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi -@@ -7186,6 +7444,10 @@ else +@@ -6589,6 +6847,10 @@ else $as_echo "no" >&6; } fi @@ -8109,7 +8104,7 @@ index 8355c433c76..a49ab3d1f09 100755 if test "x$ac_ct_AR" = x; then AR="false" else -@@ -7197,12 +7459,12 @@ ac_tool_warned=yes ;; +@@ -6600,25 +6862,19 @@ ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi @@ -8118,15 +8113,33 @@ index 8355c433c76..a49ab3d1f09 100755 fi -test -z "$AR" && AR=ar +-if test -n "$plugin_option"; then +- if $AR --help 2>&1 | grep -q "\--plugin"; then +- touch conftest.c +- $AR $plugin_option rc conftest.a conftest.c +- if test "$?" != 0; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 ++ touch conftest.c ++ $AR $plugin_option rc conftest.a conftest.c ++ if test "$?" != 0; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 + $as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;} +- else +- AR="$AR $plugin_option" +- fi +- rm -f conftest.* ++ else ++ AR="$AR $plugin_option" + fi +-fi -test -z "$AR_FLAGS" && AR_FLAGS=cru ++ rm -f conftest.* +: ${AR=ar} +: ${AR_FLAGS=cru} -+ -+ -@@ -7212,6 +7474,62 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru +@@ -6630,6 +6886,64 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru @@ -8186,10 +8199,12 @@ index 8355c433c76..a49ab3d1f09 100755 + + + - - ++ ++ if test -n "$ac_tool_prefix"; then -@@ -7548,8 +7866,8 @@ esac + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. + set dummy ${ac_tool_prefix}strip; ac_word=$2 +@@ -6969,8 +7283,8 @@ esac lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address @@ -8200,7 +8215,7 @@ index 8355c433c76..a49ab3d1f09 100755 # Handle CRLF in mingw tool chain opt_cr= -@@ -7585,6 +7903,7 @@ for ac_symprfx in "" "_"; do +@@ -7006,6 +7320,7 @@ for ac_symprfx in "" "_"; do else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi @@ -8208,7 +8223,7 @@ index 8355c433c76..a49ab3d1f09 100755 # Check to see that the pipe works correctly. pipe_works=no -@@ -7626,6 +7945,18 @@ _LT_EOF +@@ -7047,6 +7362,18 @@ _LT_EOF if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext @@ -8227,7 +8242,7 @@ index 8355c433c76..a49ab3d1f09 100755 #ifdef __cplusplus extern "C" { #endif -@@ -7637,7 +7968,7 @@ _LT_EOF +@@ -7058,7 +7385,7 @@ _LT_EOF cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ @@ -8236,7 +8251,7 @@ index 8355c433c76..a49ab3d1f09 100755 const char *name; void *address; } -@@ -7663,8 +7994,8 @@ static const void *lt_preloaded_setup() { +@@ -7084,8 +7411,8 @@ static const void *lt_preloaded_setup() { _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext @@ -8247,7 +8262,7 @@ index 8355c433c76..a49ab3d1f09 100755 LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 -@@ -7674,8 +8005,8 @@ _LT_EOF +@@ -7095,8 +7422,8 @@ _LT_EOF test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi @@ -8258,7 +8273,7 @@ index 8355c433c76..a49ab3d1f09 100755 else echo "cannot find nm_test_func in $nlist" >&5 fi -@@ -7712,6 +8043,19 @@ else +@@ -7133,6 +7460,17 @@ else $as_echo "ok" >&6; } fi @@ -8273,12 +8288,10 @@ index 8355c433c76..a49ab3d1f09 100755 + + + -+ -+ -@@ -7728,6 +8072,42 @@ fi +@@ -7149,6 +7487,44 @@ fi @@ -8286,6 +8299,8 @@ index 8355c433c76..a49ab3d1f09 100755 + + + ++ ++ +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } + @@ -8321,7 +8336,7 @@ index 8355c433c76..a49ab3d1f09 100755 -@@ -7939,6 +8319,123 @@ esac +@@ -7360,6 +7736,123 @@ esac need_locks="$enable_libtool_lock" @@ -8445,7 +8460,7 @@ index 8355c433c76..a49ab3d1f09 100755 case $host_os in rhapsody* | darwin*) -@@ -8502,6 +8999,8 @@ _LT_EOF +@@ -7923,6 +8416,8 @@ _LT_EOF $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 @@ -8454,7 +8469,7 @@ index 8355c433c76..a49ab3d1f09 100755 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF -@@ -8570,6 +9069,16 @@ done +@@ -7991,6 +8486,16 @@ done @@ -8471,26 +8486,7 @@ index 8355c433c76..a49ab3d1f09 100755 # Set options -@@ -8698,7 +9207,8 @@ fi - LIBTOOL_DEPS="$ltmain" - - # Always use our own libtool. --LIBTOOL='$(SHELL) $(top_builddir)/libtool' -+LIBTOOL='$(SHELL) $(top_builddir)' -+LIBTOOL="$LIBTOOL/${host_alias}-libtool" - - - -@@ -8787,7 +9297,7 @@ aix3*) - esac - - # Global variables: --ofile=libtool -+ofile=${host_alias}-libtool - can_build_shared=yes - - # All known linkers require a `.a' archive for static linking (except MSVC, -@@ -9085,8 +9595,6 @@ fi +@@ -8506,8 +9011,6 @@ fi lt_prog_compiler_pic= lt_prog_compiler_static= @@ -8499,7 +8495,7 @@ index 8355c433c76..a49ab3d1f09 100755 if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' -@@ -9252,6 +9760,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -8673,6 +9176,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; @@ -8512,7 +8508,7 @@ index 8355c433c76..a49ab3d1f09 100755 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) -@@ -9314,7 +9828,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -8735,7 +9244,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in @@ -8521,7 +8517,7 @@ index 8355c433c76..a49ab3d1f09 100755 lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; -@@ -9371,13 +9885,17 @@ case $host_os in +@@ -8792,13 +9301,17 @@ case $host_os in lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac @@ -8545,7 +8541,7 @@ index 8355c433c76..a49ab3d1f09 100755 # # Check to make sure the PIC flag actually works. -@@ -9438,6 +9956,11 @@ fi +@@ -8859,6 +9372,11 @@ fi @@ -8557,7 +8553,7 @@ index 8355c433c76..a49ab3d1f09 100755 # # Check to make sure the static flag actually works. # -@@ -9788,7 +10311,8 @@ _LT_EOF +@@ -9209,7 +9727,8 @@ _LT_EOF allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes @@ -8567,7 +8563,7 @@ index 8355c433c76..a49ab3d1f09 100755 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' -@@ -9887,12 +10411,12 @@ _LT_EOF +@@ -9308,12 +9827,12 @@ _LT_EOF whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' @@ -8582,7 +8578,7 @@ index 8355c433c76..a49ab3d1f09 100755 fi ;; esac -@@ -9906,8 +10430,8 @@ _LT_EOF +@@ -9327,8 +9846,8 @@ _LT_EOF archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else @@ -8593,7 +8589,7 @@ index 8355c433c76..a49ab3d1f09 100755 fi ;; -@@ -9925,8 +10449,8 @@ _LT_EOF +@@ -9346,8 +9865,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then @@ -8604,7 +8600,7 @@ index 8355c433c76..a49ab3d1f09 100755 else ld_shlibs=no fi -@@ -9972,8 +10496,8 @@ _LT_EOF +@@ -9393,8 +9912,8 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then @@ -8615,7 +8611,7 @@ index 8355c433c76..a49ab3d1f09 100755 else ld_shlibs=no fi -@@ -10103,7 +10627,13 @@ _LT_EOF +@@ -9524,7 +10043,13 @@ _LT_EOF allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. @@ -8630,7 +8626,7 @@ index 8355c433c76..a49ab3d1f09 100755 /* end confdefs.h. */ int -@@ -10116,22 +10646,29 @@ main () +@@ -9537,22 +10062,29 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : @@ -8673,7 +8669,7 @@ index 8355c433c76..a49ab3d1f09 100755 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" 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" -@@ -10143,7 +10680,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9564,7 +10096,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else # Determine the default libpath from the value encoded in an # empty executable. @@ -8688,7 +8684,7 @@ index 8355c433c76..a49ab3d1f09 100755 /* end confdefs.h. */ int -@@ -10156,22 +10699,29 @@ main () +@@ -9577,22 +10115,29 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : @@ -8731,7 +8727,7 @@ index 8355c433c76..a49ab3d1f09 100755 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, -@@ -10215,21 +10765,64 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9636,21 +10181,64 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is @@ -8811,7 +8807,7 @@ index 8355c433c76..a49ab3d1f09 100755 ;; darwin* | rhapsody*) -@@ -10290,7 +10883,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9711,7 +10299,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) @@ -8820,7 +8816,7 @@ index 8355c433c76..a49ab3d1f09 100755 hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no -@@ -10298,7 +10891,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9719,7 +10307,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux9*) if test "$GCC" = yes; then @@ -8829,7 +8825,7 @@ index 8355c433c76..a49ab3d1f09 100755 else 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' fi -@@ -10314,7 +10907,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9735,7 +10323,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then @@ -8838,7 +8834,7 @@ index 8355c433c76..a49ab3d1f09 100755 else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi -@@ -10338,10 +10931,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9759,10 +10347,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) @@ -8851,7 +8847,7 @@ index 8355c433c76..a49ab3d1f09 100755 ;; esac else -@@ -10420,23 +11013,36 @@ fi +@@ -9841,23 +10429,36 @@ fi irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then @@ -8896,7 +8892,7 @@ index 8355c433c76..a49ab3d1f09 100755 else 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' 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' -@@ -10521,7 +11127,7 @@ rm -f core conftest.err conftest.$ac_objext \ +@@ -9942,7 +10543,7 @@ rm -f core conftest.err conftest.$ac_objext \ osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' @@ -8905,7 +8901,7 @@ index 8355c433c76..a49ab3d1f09 100755 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' -@@ -10540,9 +11146,9 @@ rm -f core conftest.err conftest.$ac_objext \ +@@ -9961,9 +10562,9 @@ rm -f core conftest.err conftest.$ac_objext \ no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' @@ -8917,7 +8913,7 @@ index 8355c433c76..a49ab3d1f09 100755 else case `$CC -V 2>&1` in *"Compilers 5.0"*) -@@ -11118,8 +11724,9 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -10539,8 +11140,9 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no @@ -8929,7 +8925,7 @@ index 8355c433c76..a49ab3d1f09 100755 library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ -@@ -11152,13 +11759,71 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -10573,13 +11175,71 @@ cygwin* | mingw* | pw32* | cegcc*) library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac @@ -9002,25 +8998,16 @@ index 8355c433c76..a49ab3d1f09 100755 # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; -@@ -11240,7 +11905,7 @@ haiku*) - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes -- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' -+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -@@ -12036,7 +12701,7 @@ else +@@ -11457,7 +12117,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF --#line 12036 "configure" +-#line 11457 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H -@@ -12080,10 +12745,10 @@ else +@@ -11501,10 +12161,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) @@ -9033,16 +9020,16 @@ index 8355c433c76..a49ab3d1f09 100755 int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); -@@ -12142,7 +12807,7 @@ else +@@ -11563,7 +12223,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF --#line 12142 "configure" +-#line 11563 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H -@@ -12186,10 +12851,10 @@ else +@@ -11607,10 +12267,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) @@ -9055,7 +9042,7 @@ index 8355c433c76..a49ab3d1f09 100755 int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); -@@ -12581,6 +13246,7 @@ $RM -r conftest* +@@ -12002,6 +12662,7 @@ $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC @@ -9063,7 +9050,7 @@ index 8355c433c76..a49ab3d1f09 100755 lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX -@@ -12598,6 +13264,7 @@ $RM -r conftest* +@@ -12019,6 +12680,7 @@ $RM -r conftest* fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} @@ -9071,7 +9058,7 @@ index 8355c433c76..a49ab3d1f09 100755 compiler=$CC compiler_CXX=$CC for cc_temp in $compiler""; do -@@ -12880,7 +13547,13 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie +@@ -12301,7 +12963,13 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty # executable. @@ -9086,7 +9073,7 @@ index 8355c433c76..a49ab3d1f09 100755 /* end confdefs.h. */ int -@@ -12893,22 +13566,29 @@ main () +@@ -12314,22 +12982,29 @@ main () _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : @@ -9129,7 +9116,7 @@ index 8355c433c76..a49ab3d1f09 100755 hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" -@@ -12921,7 +13601,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -12342,7 +13017,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else # Determine the default libpath from the value encoded in an # empty executable. @@ -9144,7 +9131,7 @@ index 8355c433c76..a49ab3d1f09 100755 /* end confdefs.h. */ int -@@ -12934,22 +13620,29 @@ main () +@@ -12355,22 +13036,29 @@ main () _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : @@ -9187,7 +9174,7 @@ index 8355c433c76..a49ab3d1f09 100755 hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, -@@ -12992,29 +13685,75 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -12413,29 +13101,75 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; cygwin* | mingw* | pw32* | cegcc*) @@ -9286,7 +9273,7 @@ index 8355c433c76..a49ab3d1f09 100755 darwin* | rhapsody*) -@@ -13120,7 +13859,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -12541,7 +13275,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; *) if test "$GXX" = yes; then @@ -9295,7 +9282,7 @@ index 8355c433c76..a49ab3d1f09 100755 else # FIXME: insert proper C++ library support ld_shlibs_CXX=no -@@ -13191,10 +13930,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -12612,10 +13346,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) @@ -9308,7 +9295,7 @@ index 8355c433c76..a49ab3d1f09 100755 ;; esac fi -@@ -13235,9 +13974,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -12656,9 +13390,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then @@ -9320,7 +9307,7 @@ index 8355c433c76..a49ab3d1f09 100755 fi fi link_all_deplibs_CXX=yes -@@ -13307,20 +14046,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -12728,20 +13462,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi prelink_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ @@ -9345,7 +9332,7 @@ index 8355c433c76..a49ab3d1f09 100755 ;; *) # Version 6 and above use weak symbols archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' -@@ -13515,7 +14254,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -12936,7 +13670,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi 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' ;; *) @@ -9354,7 +9341,7 @@ index 8355c433c76..a49ab3d1f09 100755 ;; esac -@@ -13561,7 +14300,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -12982,7 +13716,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) case $cc_basename in @@ -9363,7 +9350,7 @@ index 8355c433c76..a49ab3d1f09 100755 # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' -@@ -13602,9 +14341,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -13023,9 +13757,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi if test "$GXX" = yes && test "$with_gnu_ld" = no; then no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then @@ -9375,7 +9362,7 @@ index 8355c433c76..a49ab3d1f09 100755 # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when -@@ -13739,6 +14478,13 @@ private: +@@ -13160,6 +13894,13 @@ private: }; _LT_EOF @@ -9389,7 +9376,7 @@ index 8355c433c76..a49ab3d1f09 100755 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? -@@ -13752,7 +14498,7 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 +@@ -13173,7 +13914,7 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do @@ -9398,7 +9385,7 @@ index 8355c433c76..a49ab3d1f09 100755 -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. -@@ -13761,13 +14507,22 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 +@@ -13182,13 +13923,22 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 test $p = "-R"; then prev=$p continue @@ -9425,7 +9412,7 @@ index 8355c433c76..a49ab3d1f09 100755 # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. -@@ -13787,8 +14542,10 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 +@@ -13208,8 +13958,10 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi @@ -9436,7 +9423,7 @@ index 8355c433c76..a49ab3d1f09 100755 *.$objext) # This assumes that the test object file only shows up # once in the compiler output. -@@ -13824,6 +14581,7 @@ else +@@ -13245,6 +13997,7 @@ else fi $RM -f confest.$objext @@ -9444,7 +9431,7 @@ index 8355c433c76..a49ab3d1f09 100755 # PORTME: override above test on systems where it is broken case $host_os in -@@ -13859,7 +14617,7 @@ linux*) +@@ -13280,7 +14033,7 @@ linux*) solaris*) case $cc_basename in @@ -9453,7 +9440,7 @@ index 8355c433c76..a49ab3d1f09 100755 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as -@@ -13924,8 +14682,6 @@ fi +@@ -13345,8 +14098,6 @@ fi lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= @@ -9462,7 +9449,7 @@ index 8355c433c76..a49ab3d1f09 100755 # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then -@@ -14030,6 +14786,11 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -13451,6 +14202,11 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } ;; esac ;; @@ -9474,7 +9461,7 @@ index 8355c433c76..a49ab3d1f09 100755 dgux*) case $cc_basename in ec++*) -@@ -14182,7 +14943,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -13603,7 +14359,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } ;; solaris*) case $cc_basename in @@ -9483,7 +9470,7 @@ index 8355c433c76..a49ab3d1f09 100755 # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' -@@ -14247,10 +15008,17 @@ case $host_os in +@@ -13668,10 +14424,17 @@ case $host_os in lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac @@ -9504,7 +9491,7 @@ index 8355c433c76..a49ab3d1f09 100755 # # Check to make sure the PIC flag actually works. -@@ -14308,6 +15076,8 @@ fi +@@ -13729,6 +14492,8 @@ fi @@ -9513,7 +9500,7 @@ index 8355c433c76..a49ab3d1f09 100755 # # Check to make sure the static flag actually works. # -@@ -14485,6 +15255,7 @@ fi +@@ -13906,6 +14671,7 @@ fi $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' @@ -9521,7 +9508,7 @@ index 8355c433c76..a49ab3d1f09 100755 case $host_os in aix[4-9]*) # If we're using GNU nm, then we don't want the "-C" option. -@@ -14499,15 +15270,20 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie +@@ -13920,15 +14686,20 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie ;; pw32*) export_symbols_cmds_CXX="$ltdll_cmds" @@ -9547,7 +9534,7 @@ index 8355c433c76..a49ab3d1f09 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } -@@ -14770,8 +15546,9 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -14191,8 +14962,9 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no @@ -9559,7 +9546,7 @@ index 8355c433c76..a49ab3d1f09 100755 library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ -@@ -14803,13 +15580,71 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -14224,13 +14996,71 @@ cygwin* | mingw* | pw32* | cegcc*) library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac @@ -9632,16 +9619,7 @@ index 8355c433c76..a49ab3d1f09 100755 # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; -@@ -14890,7 +15725,7 @@ haiku*) - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes -- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' -+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -@@ -15349,6 +16184,7 @@ fi +@@ -14770,6 +15600,7 @@ fi fi # test -n "$compiler" CC=$lt_save_CC @@ -9649,7 +9627,7 @@ index 8355c433c76..a49ab3d1f09 100755 LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC -@@ -18612,13 +19448,20 @@ exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +@@ -17830,13 +18661,20 @@ exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' @@ -9670,7 +9648,7 @@ index 8355c433c76..a49ab3d1f09 100755 STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' -@@ -18633,14 +19476,17 @@ lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$de +@@ -17851,14 +18689,17 @@ lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$de lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' 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"`' @@ -9689,7 +9667,7 @@ index 8355c433c76..a49ab3d1f09 100755 DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' -@@ -18673,12 +19519,12 @@ hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_q +@@ -17891,12 +18732,12 @@ hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_q hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' @@ -9703,7 +9681,7 @@ index 8355c433c76..a49ab3d1f09 100755 file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' -@@ -18717,8 +19563,8 @@ old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote +@@ -17935,8 +18776,8 @@ old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' @@ -9713,7 +9691,7 @@ index 8355c433c76..a49ab3d1f09 100755 lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' -@@ -18745,12 +19591,12 @@ hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_ +@@ -17963,12 +18804,12 @@ hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_ hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' @@ -9727,7 +9705,7 @@ index 8355c433c76..a49ab3d1f09 100755 file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' -@@ -18788,8 +19634,13 @@ reload_flag \ +@@ -18006,8 +18847,13 @@ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ @@ -9741,7 +9719,7 @@ index 8355c433c76..a49ab3d1f09 100755 STRIP \ RANLIB \ CC \ -@@ -18799,12 +19650,14 @@ lt_cv_sys_global_symbol_pipe \ +@@ -18017,12 +18863,14 @@ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ @@ -9757,7 +9735,7 @@ index 8355c433c76..a49ab3d1f09 100755 DSYMUTIL \ NMEDIT \ LIPO \ -@@ -18820,7 +19673,6 @@ no_undefined_flag \ +@@ -18038,7 +18886,6 @@ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ @@ -9765,7 +9743,7 @@ index 8355c433c76..a49ab3d1f09 100755 exclude_expsyms \ include_expsyms \ file_list_spec \ -@@ -18842,8 +19694,8 @@ LD_CXX \ +@@ -18060,8 +18907,8 @@ LD_CXX \ reload_flag_CXX \ compiler_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ @@ -9775,7 +9753,7 @@ index 8355c433c76..a49ab3d1f09 100755 lt_prog_compiler_static_CXX \ lt_cv_prog_compiler_c_o_CXX \ export_dynamic_flag_spec_CXX \ -@@ -18855,7 +19707,6 @@ no_undefined_flag_CXX \ +@@ -18073,7 +18920,6 @@ no_undefined_flag_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_flag_spec_ld_CXX \ hardcode_libdir_separator_CXX \ @@ -9783,7 +9761,7 @@ index 8355c433c76..a49ab3d1f09 100755 exclude_expsyms_CXX \ include_expsyms_CXX \ file_list_spec_CXX \ -@@ -18889,6 +19740,7 @@ module_cmds \ +@@ -18107,6 +18953,7 @@ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ @@ -9791,7 +9769,7 @@ index 8355c433c76..a49ab3d1f09 100755 postinstall_cmds \ postuninstall_cmds \ finish_cmds \ -@@ -18903,7 +19755,8 @@ archive_expsym_cmds_CXX \ +@@ -18121,7 +18968,8 @@ archive_expsym_cmds_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ export_symbols_cmds_CXX \ @@ -9801,7 +9779,7 @@ index 8355c433c76..a49ab3d1f09 100755 case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" -@@ -19668,7 +20521,8 @@ $as_echo X"$file" | +@@ -18886,7 +19734,8 @@ $as_echo X"$file" | # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, @@ -9811,7 +9789,7 @@ index 8355c433c76..a49ab3d1f09 100755 # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. -@@ -19771,19 +20625,42 @@ SP2NL=$lt_lt_SP2NL +@@ -18989,19 +19838,42 @@ SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP @@ -9855,7 +9833,7 @@ index 8355c433c76..a49ab3d1f09 100755 # A symbol stripping program. STRIP=$lt_STRIP -@@ -19813,6 +20690,12 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address +@@ -19031,6 +19903,12 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix @@ -9868,7 +9846,7 @@ index 8355c433c76..a49ab3d1f09 100755 # The name of the directory that contains temporary libtool files. objdir=$objdir -@@ -19822,6 +20705,9 @@ MAGIC_CMD=$MAGIC_CMD +@@ -19040,6 +19918,9 @@ MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks @@ -9878,7 +9856,7 @@ index 8355c433c76..a49ab3d1f09 100755 # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL -@@ -19936,12 +20822,12 @@ with_gcc=$GCC +@@ -19154,12 +20035,12 @@ with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag @@ -9894,7 +9872,7 @@ index 8355c433c76..a49ab3d1f09 100755 # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static -@@ -20028,9 +20914,6 @@ inherit_rpath=$inherit_rpath +@@ -19246,9 +20127,6 @@ inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs @@ -9904,7 +9882,7 @@ index 8355c433c76..a49ab3d1f09 100755 # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols -@@ -20046,6 +20929,9 @@ include_expsyms=$lt_include_expsyms +@@ -19264,6 +20142,9 @@ include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds @@ -9914,7 +9892,7 @@ index 8355c433c76..a49ab3d1f09 100755 # Specify filename containing input files. file_list_spec=$lt_file_list_spec -@@ -20092,210 +20978,169 @@ ltmain="$ac_aux_dir/ltmain.sh" +@@ -19310,210 +20191,169 @@ ltmain="$ac_aux_dir/ltmain.sh" # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? @@ -10288,7 +10266,7 @@ index 8355c433c76..a49ab3d1f09 100755 (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" -@@ -20323,12 +21168,12 @@ with_gcc=$GCC_CXX +@@ -19541,12 +20381,12 @@ with_gcc=$GCC_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX @@ -10301,34 +10279,2213 @@ index 8355c433c76..a49ab3d1f09 100755 +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + - # Compiler flag to prevent dynamic linking. - link_static_flag=$lt_lt_prog_compiler_static_CXX - -@@ -20415,9 +21260,6 @@ inherit_rpath=$inherit_rpath_CXX - # Whether libtool must link a program against all its dependency libraries. - link_all_deplibs=$link_all_deplibs_CXX - --# Fix the shell variable \$srcfile for the compiler. --fix_srcfile_path=$lt_fix_srcfile_path_CXX -- - # Set to "yes" if exported symbols are required. - always_export_symbols=$always_export_symbols_CXX - -@@ -20433,6 +21275,9 @@ include_expsyms=$lt_include_expsyms_CXX - # Commands necessary for linking programs (against libraries) with templates. - prelink_cmds=$lt_prelink_cmds_CXX - -+# Commands necessary for finishing linking programs. -+postlink_cmds=$lt_postlink_cmds_CXX + # Compiler flag to prevent dynamic linking. + link_static_flag=$lt_lt_prog_compiler_static_CXX + +@@ -19633,9 +20473,6 @@ inherit_rpath=$inherit_rpath_CXX + # Whether libtool must link a program against all its dependency libraries. + link_all_deplibs=$link_all_deplibs_CXX + +-# Fix the shell variable \$srcfile for the compiler. +-fix_srcfile_path=$lt_fix_srcfile_path_CXX +- + # Set to "yes" if exported symbols are required. + always_export_symbols=$always_export_symbols_CXX + +@@ -19651,6 +20488,9 @@ include_expsyms=$lt_include_expsyms_CXX + # Commands necessary for linking programs (against libraries) with templates. + prelink_cmds=$lt_prelink_cmds_CXX + ++# Commands necessary for finishing linking programs. ++postlink_cmds=$lt_postlink_cmds_CXX ++ + # Specify filename containing input files. + file_list_spec=$lt_file_list_spec_CXX + +diff --git a/libbacktrace/configure b/libbacktrace/configure +index a2f33c0f35d..90667680701 100755 +--- a/libbacktrace/configure ++++ b/libbacktrace/configure +@@ -680,7 +680,10 @@ OTOOL + LIPO + NMEDIT + DSYMUTIL ++MANIFEST_TOOL ++ac_ct_AR + AR ++DLLTOOL + OBJDUMP + LN_S + NM +@@ -798,6 +801,7 @@ enable_static + with_pic + enable_fast_install + with_gnu_ld ++with_libtool_sysroot + enable_libtool_lock + enable_largefile + enable_cet +@@ -1458,6 +1462,8 @@ Optional Packages: + --with-pic try to use only PIC/non-PIC objects [default=use + both] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] ++ --with-libtool-sysroot=DIR Search for dependent libraries within DIR ++ (or the compiler's sysroot if not specified). + --with-system-libunwind use installed libunwind + + Some influential environment variables: +@@ -5446,8 +5452,8 @@ esac + + + +-macro_version='2.2.7a' +-macro_revision='1.3134' ++macro_version='2.4' ++macro_revision='1.3293' + + + +@@ -5487,7 +5493,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 + $as_echo_n "checking how to print strings... " >&6; } + # Test print first, because it will be a builtin if present. +-if test "X`print -r -- -n 2>/dev/null`" = X-n && \ ++if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' + elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then +@@ -5818,48 +5824,49 @@ if ${lt_cv_path_NM+:} false; then : + $as_echo_n "(cached) " >&6 + else + if test -n "$NM"; then +- # Let the user override the test. +- lt_cv_path_NM="$NM" +-else +- lt_nm_to_check="${ac_tool_prefix}nm" +- if test -n "$ac_tool_prefix" && test "$build" = "$host"; then +- lt_nm_to_check="$lt_nm_to_check nm" +- fi +- for lt_tmp_nm in $lt_nm_to_check; do +- lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +- for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do +- IFS="$lt_save_ifs" +- test -z "$ac_dir" && ac_dir=. +- tmp_nm="$ac_dir/$lt_tmp_nm" +- if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then +- # Check to see if the nm accepts a BSD-compat flag. +- # Adding the `sed 1q' prevents false positives on HP-UX, which says: +- # nm: unknown option "B" ignored +- # Tru64's nm complains that /dev/null is an invalid object file +- case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in +- */dev/null* | *'Invalid file or object type'*) +- lt_cv_path_NM="$tmp_nm -B" +- break +- ;; +- *) +- case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in +- */dev/null*) +- lt_cv_path_NM="$tmp_nm -p" +- break +- ;; +- *) +- lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but +- continue # so that we can try to find one that supports BSD flags +- ;; +- esac +- ;; +- esac +- fi +- done +- IFS="$lt_save_ifs" +- done +- : ${lt_cv_path_NM=no} +-fi ++ # Let the user override the nm to test. ++ lt_nm_to_check="$NM" ++ else ++ lt_nm_to_check="${ac_tool_prefix}nm" ++ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then ++ lt_nm_to_check="$lt_nm_to_check nm" ++ fi ++ fi ++ for lt_tmp_nm in $lt_nm_to_check; do ++ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ++ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do ++ IFS="$lt_save_ifs" ++ test -z "$ac_dir" && ac_dir=. ++ case "$lt_tmp_nm" in ++ */*|*\\*) tmp_nm="$lt_tmp_nm";; ++ *) tmp_nm="$ac_dir/$lt_tmp_nm";; ++ esac ++ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then ++ # Check to see if the nm accepts a BSD-compat flag. ++ # Adding the `sed 1q' prevents false positives on HP-UX, which says: ++ # nm: unknown option "B" ignored ++ case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in ++ *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B" ++ break ++ ;; ++ *) ++ case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in ++ *$tmp_nm*) ++ lt_cv_path_NM="$tmp_nm -p" ++ break ++ ;; ++ *) ++ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but ++ continue # so that we can try to find one that supports BSD flags ++ ;; ++ esac ++ ;; ++ esac ++ fi ++ done ++ IFS="$lt_save_ifs" ++ done ++ : ${lt_cv_path_NM=no} + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 + $as_echo "$lt_cv_path_NM" >&6; } +@@ -6173,8 +6180,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; + # Try some XSI features + xsi_shell=no + ( _lt_dummy="a/b/c" +- test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ +- = c,a/b,, \ ++ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ ++ = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +@@ -6223,6 +6230,80 @@ esac + + + ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 ++$as_echo_n "checking how to convert $build file names to $host format... " >&6; } ++if ${lt_cv_to_host_file_cmd+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ case $host in ++ *-*-mingw* ) ++ case $build in ++ *-*-mingw* ) # actually msys ++ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ++ ;; ++ *-*-cygwin* ) ++ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ++ ;; ++ * ) # otherwise, assume *nix ++ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ++ ;; ++ esac ++ ;; ++ *-*-cygwin* ) ++ case $build in ++ *-*-mingw* ) # actually msys ++ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ++ ;; ++ *-*-cygwin* ) ++ lt_cv_to_host_file_cmd=func_convert_file_noop ++ ;; ++ * ) # otherwise, assume *nix ++ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ++ ;; ++ esac ++ ;; ++ * ) # unhandled hosts (and "normal" native builds) ++ lt_cv_to_host_file_cmd=func_convert_file_noop ++ ;; ++esac ++ ++fi ++ ++to_host_file_cmd=$lt_cv_to_host_file_cmd ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 ++$as_echo "$lt_cv_to_host_file_cmd" >&6; } ++ ++ ++ ++ ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 ++$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } ++if ${lt_cv_to_tool_file_cmd+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ #assume ordinary cross tools, or native build. ++lt_cv_to_tool_file_cmd=func_convert_file_noop ++case $host in ++ *-*-mingw* ) ++ case $build in ++ *-*-mingw* ) # actually msys ++ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ++ ;; ++ esac ++ ;; ++esac ++ ++fi ++ ++to_tool_file_cmd=$lt_cv_to_tool_file_cmd ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 ++$as_echo "$lt_cv_to_tool_file_cmd" >&6; } ++ ++ ++ ++ ++ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 + $as_echo_n "checking for $LD option to reload object files... " >&6; } + if ${lt_cv_ld_reload_flag+:} false; then : +@@ -6239,6 +6320,11 @@ case $reload_flag in + esac + reload_cmds='$LD$reload_flag -o $output$reload_objs' + case $host_os in ++ cygwin* | mingw* | pw32* | cegcc*) ++ if test "$GCC" != yes; then ++ reload_cmds=false ++ fi ++ ;; + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' +@@ -6407,7 +6493,8 @@ mingw* | pw32*) + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else +- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' ++ # Keep this pattern in sync with the one in func_win32_libid. ++ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; +@@ -6480,7 +6567,7 @@ irix5* | irix6* | nonstopux*) + ;; + + # This must be Linux ELF. +-linux* | k*bsd*-gnu | kopensolaris*-gnu | uclinuxfdpiceabi) ++linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +@@ -6561,6 +6648,21 @@ esac + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 + $as_echo "$lt_cv_deplibs_check_method" >&6; } ++ ++file_magic_glob= ++want_nocaseglob=no ++if test "$build" = "$host"; then ++ case $host_os in ++ mingw* | pw32*) ++ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then ++ want_nocaseglob=yes ++ else ++ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` ++ fi ++ ;; ++ esac ++fi ++ + file_magic_cmd=$lt_cv_file_magic_cmd + deplibs_check_method=$lt_cv_deplibs_check_method + test -z "$deplibs_check_method" && deplibs_check_method=unknown +@@ -6574,11 +6676,177 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + if test -n "$ac_tool_prefix"; then +- # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +-set dummy ${ac_tool_prefix}ar; ac_word=$2 ++ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. ++set dummy ${ac_tool_prefix}dlltool; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if ${ac_cv_prog_DLLTOOL+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ if test -n "$DLLTOOL"; then ++ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++fi ++fi ++DLLTOOL=$ac_cv_prog_DLLTOOL ++if test -n "$DLLTOOL"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 ++$as_echo "$DLLTOOL" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ ++fi ++if test -z "$ac_cv_prog_DLLTOOL"; then ++ ac_ct_DLLTOOL=$DLLTOOL ++ # Extract the first word of "dlltool", so it can be a program name with args. ++set dummy dlltool; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ if test -n "$ac_ct_DLLTOOL"; then ++ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_ac_ct_DLLTOOL="dlltool" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++fi ++fi ++ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL ++if test -n "$ac_ct_DLLTOOL"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 ++$as_echo "$ac_ct_DLLTOOL" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ if test "x$ac_ct_DLLTOOL" = x; then ++ DLLTOOL="false" ++ else ++ case $cross_compiling:$ac_tool_warned in ++yes:) ++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 ++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ++ac_tool_warned=yes ;; ++esac ++ DLLTOOL=$ac_ct_DLLTOOL ++ fi ++else ++ DLLTOOL="$ac_cv_prog_DLLTOOL" ++fi ++ ++test -z "$DLLTOOL" && DLLTOOL=dlltool ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 ++$as_echo_n "checking how to associate runtime and link libraries... " >&6; } ++if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ lt_cv_sharedlib_from_linklib_cmd='unknown' ++ ++case $host_os in ++cygwin* | mingw* | pw32* | cegcc*) ++ # two different shell functions defined in ltmain.sh ++ # decide which to use based on capabilities of $DLLTOOL ++ case `$DLLTOOL --help 2>&1` in ++ *--identify-strict*) ++ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ++ ;; ++ *) ++ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ++ ;; ++ esac ++ ;; ++*) ++ # fallback: assume linklib IS sharedlib ++ lt_cv_sharedlib_from_linklib_cmd="$ECHO" ++ ;; ++esac ++ ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 ++$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } ++sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd ++test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO ++ ++ ++ ++ ++ ++ ++ ++plugin_option= ++plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll" ++for plugin in $plugin_names; do ++ plugin_so=`${CC} ${CFLAGS} --print-prog-name $plugin` ++ if test x$plugin_so = x$plugin; then ++ plugin_so=`${CC} ${CFLAGS} --print-file-name $plugin` ++ fi ++ if test x$plugin_so != x$plugin; then ++ plugin_option="--plugin $plugin_so" ++ break ++ fi ++done ++ ++if test -n "$ac_tool_prefix"; then ++ for ac_prog in ar ++ do ++ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. ++set dummy $ac_tool_prefix$ac_prog; ac_word=$2 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 + $as_echo_n "checking for $ac_word... " >&6; } + if ${ac_cv_prog_AR+:} false; then : +@@ -6594,7 +6862,7 @@ do + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +- ac_cv_prog_AR="${ac_tool_prefix}ar" ++ ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +@@ -6614,11 +6882,15 @@ $as_echo "no" >&6; } + fi + + ++ test -n "$AR" && break ++ done + fi +-if test -z "$ac_cv_prog_AR"; then ++if test -z "$AR"; then + ac_ct_AR=$AR +- # Extract the first word of "ar", so it can be a program name with args. +-set dummy ar; ac_word=$2 ++ for ac_prog in ar ++do ++ # Extract the first word of "$ac_prog", so it can be a program name with args. ++set dummy $ac_prog; ac_word=$2 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 + $as_echo_n "checking for $ac_word... " >&6; } + if ${ac_cv_prog_ac_ct_AR+:} false; then : +@@ -6634,7 +6906,7 @@ do + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then +- ac_cv_prog_ac_ct_AR="ar" ++ ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +@@ -6653,6 +6925,10 @@ else + $as_echo "no" >&6; } + fi + ++ ++ test -n "$ac_ct_AR" && break ++done ++ + if test "x$ac_ct_AR" = x; then + AR="false" + else +@@ -6664,12 +6940,21 @@ ac_tool_warned=yes ;; + esac + AR=$ac_ct_AR + fi +-else +- AR="$ac_cv_prog_AR" + fi + +-test -z "$AR" && AR=ar +-test -z "$AR_FLAGS" && AR_FLAGS=cru ++ touch conftest.c ++ $AR $plugin_option rc conftest.a conftest.c ++ if test "$?" != 0; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 ++$as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;} ++ else ++ AR="$AR $plugin_option" ++ fi ++ rm -f conftest.* ++: ${AR=ar} ++: ${AR_FLAGS=cru} ++ ++ + + + +@@ -6679,6 +6964,62 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru + + + ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 ++$as_echo_n "checking for archiver @FILE support... " >&6; } ++if ${lt_cv_ar_at_file+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ lt_cv_ar_at_file=no ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++int ++main () ++{ ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO"; then : ++ echo conftest.$ac_objext > conftest.lst ++ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' ++ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 ++ (eval $lt_ar_try) 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; } ++ if test "$ac_status" -eq 0; then ++ # Ensure the archiver fails upon bogus file names. ++ rm -f conftest.$ac_objext libconftest.a ++ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 ++ (eval $lt_ar_try) 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; } ++ if test "$ac_status" -ne 0; then ++ lt_cv_ar_at_file=@ ++ fi ++ fi ++ rm -f conftest.* libconftest.a ++ ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++ ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 ++$as_echo "$lt_cv_ar_at_file" >&6; } ++ ++if test "x$lt_cv_ar_at_file" = xno; then ++ archiver_list_spec= ++else ++ archiver_list_spec=$lt_cv_ar_at_file ++fi ++ ++ ++ ++ ++ + + + if test -n "$ac_tool_prefix"; then +@@ -6873,6 +7214,11 @@ else + fi + + test -z "$RANLIB" && RANLIB=: ++if test -n "$plugin_option" && test "$RANLIB" != ":"; then ++ if $RANLIB --help 2>&1 | grep -q "\--plugin"; then ++ RANLIB="$RANLIB $plugin_option" ++ fi ++fi + + + +@@ -6987,7 +7333,7 @@ osf*) + symcode='[BCDEGQRST]' + ;; + solaris*) +- symcode='[BDRT]' ++ symcode='[BCDRT]' + ;; + sco3.2v5*) + symcode='[DT]' +@@ -7015,8 +7361,8 @@ esac + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + + # Transform an extracted symbol line into symbol name and symbol address +-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +-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'" ++lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" ++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'" + + # Handle CRLF in mingw tool chain + opt_cr= +@@ -7052,6 +7398,7 @@ for ac_symprfx in "" "_"; do + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi ++ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no +@@ -7093,6 +7440,18 @@ _LT_EOF + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext ++/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ ++#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) ++/* DATA imports from DLLs on WIN32 con't be const, because runtime ++ relocations are performed -- see ld's documentation on pseudo-relocs. */ ++# define LT_DLSYM_CONST ++#elif defined(__osf__) ++/* This system does not cope well with relocations in const data. */ ++# define LT_DLSYM_CONST ++#else ++# define LT_DLSYM_CONST const ++#endif ++ + #ifdef __cplusplus + extern "C" { + #endif +@@ -7104,7 +7463,7 @@ _LT_EOF + cat <<_LT_EOF >> conftest.$ac_ext + + /* The mapping between symbol names and symbols. */ +-const struct { ++LT_DLSYM_CONST struct { + const char *name; + void *address; + } +@@ -7130,8 +7489,8 @@ static const void *lt_preloaded_setup() { + _LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext +- lt_save_LIBS="$LIBS" +- lt_save_CFLAGS="$CFLAGS" ++ lt_globsym_save_LIBS=$LIBS ++ lt_globsym_save_CFLAGS=$CFLAGS + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 +@@ -7141,8 +7500,8 @@ _LT_EOF + test $ac_status = 0; } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi +- LIBS="$lt_save_LIBS" +- CFLAGS="$lt_save_CFLAGS" ++ LIBS=$lt_globsym_save_LIBS ++ CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&5 + fi +@@ -7179,6 +7538,17 @@ else + $as_echo "ok" >&6; } + fi + ++# Response file support. ++if test "$lt_cv_nm_interface" = "MS dumpbin"; then ++ nm_file_list_spec='@' ++elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then ++ nm_file_list_spec='@' ++fi ++ ++ ++ ++ ++ + + + +@@ -7195,6 +7565,44 @@ fi + + + ++ ++ ++ ++ ++ ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 ++$as_echo_n "checking for sysroot... " >&6; } ++ ++# Check whether --with-libtool-sysroot was given. ++if test "${with_libtool_sysroot+set}" = set; then : ++ withval=$with_libtool_sysroot; ++else ++ with_libtool_sysroot=no ++fi ++ ++ ++lt_sysroot= ++case ${with_libtool_sysroot} in #( ++ yes) ++ if test "$GCC" = yes; then ++ lt_sysroot=`$CC --print-sysroot 2>/dev/null` ++ fi ++ ;; #( ++ /*) ++ lt_sysroot=`echo "$with_libtool_sysroot" | sed -e "$sed_quote_subst"` ++ ;; #( ++ no|'') ++ ;; #( ++ *) ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_libtool_sysroot}" >&5 ++$as_echo "${with_libtool_sysroot}" >&6; } ++ as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ++ ;; ++esac ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 ++$as_echo "${lt_sysroot:-no}" >&6; } + + + +@@ -7372,39 +7780,156 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ + ac_compiler_gnu=$ac_cv_c_compiler_gnu + + fi +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +-$as_echo "$lt_cv_cc_needs_belf" >&6; } +- if test x"$lt_cv_cc_needs_belf" != x"yes"; then +- # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf +- CFLAGS="$SAVE_CFLAGS" ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 ++$as_echo "$lt_cv_cc_needs_belf" >&6; } ++ if test x"$lt_cv_cc_needs_belf" != x"yes"; then ++ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf ++ CFLAGS="$SAVE_CFLAGS" ++ fi ++ ;; ++sparc*-*solaris*) ++ # Find out which ABI we are using. ++ echo 'int i;' > conftest.$ac_ext ++ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ case `/usr/bin/file conftest.o` in ++ *64-bit*) ++ case $lt_cv_prog_gnu_ld in ++ yes*) LD="${LD-ld} -m elf64_sparc" ;; ++ *) ++ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then ++ LD="${LD-ld} -64" ++ fi ++ ;; ++ esac ++ ;; ++ esac ++ fi ++ rm -rf conftest* ++ ;; ++esac ++ ++need_locks="$enable_libtool_lock" ++ ++if test -n "$ac_tool_prefix"; then ++ # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. ++set dummy ${ac_tool_prefix}mt; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ if test -n "$MANIFEST_TOOL"; then ++ ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++fi ++fi ++MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL ++if test -n "$MANIFEST_TOOL"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 ++$as_echo "$MANIFEST_TOOL" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ ++fi ++if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ++ ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL ++ # Extract the first word of "mt", so it can be a program name with args. ++set dummy mt; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ if test -n "$ac_ct_MANIFEST_TOOL"; then ++ ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++fi ++fi ++ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL ++if test -n "$ac_ct_MANIFEST_TOOL"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 ++$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ if test "x$ac_ct_MANIFEST_TOOL" = x; then ++ MANIFEST_TOOL=":" ++ else ++ case $cross_compiling:$ac_tool_warned in ++yes:) ++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 ++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ++ac_tool_warned=yes ;; ++esac ++ MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +- ;; +-sparc*-*solaris*) +- # Find out which ABI we are using. +- echo 'int i;' > conftest.$ac_ext +- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 +- (eval $ac_compile) 2>&5 +- ac_status=$? +- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 +- test $ac_status = 0; }; then +- case `/usr/bin/file conftest.o` in +- *64-bit*) +- case $lt_cv_prog_gnu_ld in +- yes*) LD="${LD-ld} -m elf64_sparc" ;; +- *) +- if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then +- LD="${LD-ld} -64" +- fi +- ;; +- esac +- ;; +- esac ++else ++ MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" ++fi ++ ++test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 ++$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } ++if ${lt_cv_path_mainfest_tool+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ lt_cv_path_mainfest_tool=no ++ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 ++ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out ++ cat conftest.err >&5 ++ if $GREP 'Manifest Tool' conftest.out > /dev/null; then ++ lt_cv_path_mainfest_tool=yes + fi +- rm -rf conftest* +- ;; +-esac ++ rm -f conftest* ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 ++$as_echo "$lt_cv_path_mainfest_tool" >&6; } ++if test "x$lt_cv_path_mainfest_tool" != xyes; then ++ MANIFEST_TOOL=: ++fi ++ ++ ++ + +-need_locks="$enable_libtool_lock" + + + case $host_os in +@@ -7969,6 +8494,8 @@ _LT_EOF + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 ++ echo "$RANLIB libconftest.a" >&5 ++ $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF + int main() { return 0;} + _LT_EOF +@@ -7986,25 +8513,23 @@ _LT_EOF + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 + $as_echo "$lt_cv_ld_force_load" >&6; } +- # Allow for Darwin 4-7 (macOS 10.0-10.3) although these are not expect to +- # build without first building modern cctools / linker. +- case $host_cpu-$host_os in +- *-rhapsody* | *-darwin1.[012]) ++ case $host_os in ++ rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; +- *-darwin1.*) ++ darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; +- *-darwin*) +- # darwin 5.x (macOS 10.1) onwards we only need to adjust when the +- # deployment target is forced to an earlier version. +- case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in +- UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*) +- ;; ++ darwin*) # darwin 5.x on ++ # if running on 10.5 or later, the deployment target defaults ++ # to the OS version, if on x86, and 10.4, the deployment ++ # target defaults to 10.4. Don't you love it? ++ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in ++ 10.0,*86*-darwin8*|10.0,*-darwin[91]*) ++ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012][,.]*) +- _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' +- ;; +- *) +- ;; +- esac ++ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; ++ 10.*) ++ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; ++ esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then +@@ -8553,8 +9078,6 @@ fi + lt_prog_compiler_pic= + lt_prog_compiler_static= + +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +-$as_echo_n "checking for $compiler option to produce PIC... " >&6; } + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' +@@ -8720,6 +9243,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; ++ nagfor*) ++ # NAG Fortran compiler ++ lt_prog_compiler_wl='-Wl,-Wl,,' ++ lt_prog_compiler_pic='-PIC' ++ lt_prog_compiler_static='-Bstatic' ++ ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) +@@ -8782,7 +9311,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in +- f77* | f90* | f95*) ++ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; +@@ -8839,13 +9368,17 @@ case $host_os in + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; + esac +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 +-$as_echo "$lt_prog_compiler_pic" >&6; } +- +- +- +- + ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 ++$as_echo_n "checking for $compiler option to produce PIC... " >&6; } ++if ${lt_cv_prog_compiler_pic+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ lt_cv_prog_compiler_pic=$lt_prog_compiler_pic ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 ++$as_echo "$lt_cv_prog_compiler_pic" >&6; } ++lt_prog_compiler_pic=$lt_cv_prog_compiler_pic + + # + # Check to make sure the PIC flag actually works. +@@ -8906,6 +9439,11 @@ fi + + + ++ ++ ++ ++ ++ + # + # Check to make sure the static flag actually works. + # +@@ -9256,7 +9794,8 @@ _LT_EOF + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes +- export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' ++ 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' ++ exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' +@@ -9294,7 +9833,7 @@ _LT_EOF + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + +- gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu | uclinuxfdpiceabi) ++ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in +@@ -9355,12 +9894,12 @@ _LT_EOF + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld='-rpath $libdir' +- archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' ++ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ +- $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' ++ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac +@@ -9374,8 +9913,8 @@ _LT_EOF + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else +- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' ++ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + +@@ -9393,8 +9932,8 @@ _LT_EOF + + _LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then +- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' ++ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi +@@ -9440,8 +9979,8 @@ _LT_EOF + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then +- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' ++ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi +@@ -9571,7 +10110,13 @@ _LT_EOF + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++ if test "${lt_cv_aix_libpath+set}" = set; then ++ aix_libpath=$lt_cv_aix_libpath ++else ++ if ${lt_cv_aix_libpath_+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + + int +@@ -9584,22 +10129,29 @@ main () + _ACEOF + if ac_fn_c_try_link "$LINENO"; then : + +-lt_aix_libpath_sed=' +- /Import File Strings/,/^$/ { +- /^0/ { +- s/^0 *\(.*\)$/\1/ +- p +- } +- }' +-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +-# Check for a 64-bit object if we didn't find anything. +-if test -z "$aix_libpath"; then +- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +-fi ++ lt_aix_libpath_sed=' ++ /Import File Strings/,/^$/ { ++ /^0/ { ++ s/^0 *\([^ ]*\) *$/\1/ ++ p ++ } ++ }' ++ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` ++ # Check for a 64-bit object if we didn't find anything. ++ if test -z "$lt_cv_aix_libpath_"; then ++ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` ++ fi + fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ++ if test -z "$lt_cv_aix_libpath_"; then ++ lt_cv_aix_libpath_="/usr/lib:/lib" ++ fi ++ ++fi ++ ++ aix_libpath=$lt_cv_aix_libpath_ ++fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + 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" +@@ -9611,7 +10163,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + else + # Determine the default libpath from the value encoded in an + # empty executable. +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++ if test "${lt_cv_aix_libpath+set}" = set; then ++ aix_libpath=$lt_cv_aix_libpath ++else ++ if ${lt_cv_aix_libpath_+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + + int +@@ -9624,22 +10182,29 @@ main () + _ACEOF + if ac_fn_c_try_link "$LINENO"; then : + +-lt_aix_libpath_sed=' +- /Import File Strings/,/^$/ { +- /^0/ { +- s/^0 *\(.*\)$/\1/ +- p +- } +- }' +-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +-# Check for a 64-bit object if we didn't find anything. +-if test -z "$aix_libpath"; then +- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +-fi ++ lt_aix_libpath_sed=' ++ /Import File Strings/,/^$/ { ++ /^0/ { ++ s/^0 *\([^ ]*\) *$/\1/ ++ p ++ } ++ }' ++ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` ++ # Check for a 64-bit object if we didn't find anything. ++ if test -z "$lt_cv_aix_libpath_"; then ++ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` ++ fi + fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ++ if test -z "$lt_cv_aix_libpath_"; then ++ lt_cv_aix_libpath_="/usr/lib:/lib" ++ fi ++ ++fi ++ ++ aix_libpath=$lt_cv_aix_libpath_ ++fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, +@@ -9684,20 +10249,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. +- hardcode_libdir_flag_spec=' ' +- allow_undefined_flag=unsupported +- # Tell ltmain to make .lib files, not .a files. +- libext=lib +- # Tell ltmain to make .dll files, not .so files. +- shrext_cmds=".dll" +- # FIXME: Setting linknames here is a bad hack. +- archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' +- # The linker will automatically build a .lib file if we build a DLL. +- old_archive_from_new_cmds='true' +- # FIXME: Should let the user specify the lib program. +- old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' +- fix_srcfile_path='`cygpath -w "$srcfile"`' +- enable_shared_with_static_runtimes=yes ++ case $cc_basename in ++ cl*) ++ # Native MSVC ++ hardcode_libdir_flag_spec=' ' ++ allow_undefined_flag=unsupported ++ always_export_symbols=yes ++ file_list_spec='@' ++ # Tell ltmain to make .lib files, not .a files. ++ libext=lib ++ # Tell ltmain to make .dll files, not .so files. ++ shrext_cmds=".dll" ++ # FIXME: Setting linknames here is a bad hack. ++ archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' ++ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then ++ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; ++ else ++ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; ++ fi~ ++ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ ++ linknames=' ++ # The linker will not automatically build a static lib if we build a DLL. ++ # _LT_TAGVAR(old_archive_from_new_cmds, )='true' ++ enable_shared_with_static_runtimes=yes ++ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' ++ # Don't use ranlib ++ old_postinstall_cmds='chmod 644 $oldlib' ++ postlink_cmds='lt_outputfile="@OUTPUT@"~ ++ lt_tool_outputfile="@TOOL_OUTPUT@"~ ++ case $lt_outputfile in ++ *.exe|*.EXE) ;; ++ *) ++ lt_outputfile="$lt_outputfile.exe" ++ lt_tool_outputfile="$lt_tool_outputfile.exe" ++ ;; ++ esac~ ++ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then ++ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; ++ $RM "$lt_outputfile.manifest"; ++ fi' ++ ;; ++ *) ++ # Assume MSVC wrapper ++ hardcode_libdir_flag_spec=' ' ++ allow_undefined_flag=unsupported ++ # Tell ltmain to make .lib files, not .a files. ++ libext=lib ++ # Tell ltmain to make .dll files, not .so files. ++ shrext_cmds=".dll" ++ # FIXME: Setting linknames here is a bad hack. ++ archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' ++ # The linker will automatically build a .lib file if we build a DLL. ++ old_archive_from_new_cmds='true' ++ # FIXME: Should let the user specify the lib program. ++ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' ++ enable_shared_with_static_runtimes=yes ++ ;; ++ esac + ;; + + darwin* | rhapsody*) +@@ -9758,7 +10366,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) +- archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' ++ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no +@@ -9766,7 +10374,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hpux9*) + if test "$GCC" = yes; then +- 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' ++ 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' + else + 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' + fi +@@ -9782,7 +10390,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then +- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ++ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi +@@ -9803,19 +10411,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) +- archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ++ archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) +- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ++ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) +- archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ++ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) +- archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ++ archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' +@@ -9888,23 +10496,36 @@ fi + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then +- 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' ++ 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' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. +- save_LDFLAGS="$LDFLAGS" +- LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++ # This should be the same for all languages, so no per-tag cache variable. ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 ++$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } ++if ${lt_cv_irix_exported_symbol+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ save_LDFLAGS="$LDFLAGS" ++ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +-int foo(void) {} ++int foo (void) { return 0; } + _ACEOF + if ac_fn_c_try_link "$LINENO"; then : +- 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' +- ++ lt_cv_irix_exported_symbol=yes ++else ++ lt_cv_irix_exported_symbol=no + fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +- LDFLAGS="$save_LDFLAGS" ++ LDFLAGS="$save_LDFLAGS" ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 ++$as_echo "$lt_cv_irix_exported_symbol" >&6; } ++ if test "$lt_cv_irix_exported_symbol" = yes; then ++ 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' ++ fi + else + 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' + 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' +@@ -9989,7 +10610,7 @@ rm -f core conftest.err conftest.$ac_objext \ + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' +- 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' ++ 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' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' +@@ -10008,9 +10629,9 @@ rm -f core conftest.err conftest.$ac_objext \ + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' +- archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ++ archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ +- $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ++ $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' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) +@@ -10586,8 +11207,9 @@ cygwin* | mingw* | pw32* | cegcc*) + need_version=no + need_lib_prefix=no + +- case $GCC,$host_os in +- yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) ++ case $GCC,$cc_basename in ++ yes,*) ++ # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ +@@ -10620,13 +11242,71 @@ cygwin* | mingw* | pw32* | cegcc*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac ++ dynamic_linker='Win32 ld.exe' ++ ;; ++ ++ *,cl*) ++ # Native MSVC ++ libname_spec='$name' ++ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ++ library_names_spec='${libname}.dll.lib' ++ ++ case $build_os in ++ mingw*) ++ sys_lib_search_path_spec= ++ lt_save_ifs=$IFS ++ IFS=';' ++ for lt_path in $LIB ++ do ++ IFS=$lt_save_ifs ++ # Let DOS variable expansion print the short 8.3 style file name. ++ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` ++ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" ++ done ++ IFS=$lt_save_ifs ++ # Convert to MSYS style. ++ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ++ ;; ++ cygwin*) ++ # Convert to unix form, then to dos form, then back to unix form ++ # but this time dos style (no spaces!) so that the unix form looks ++ # like /cygdrive/c/PROGRA~1:/cygdr... ++ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` ++ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` ++ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ++ ;; ++ *) ++ sys_lib_search_path_spec="$LIB" ++ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then ++ # It is most probably a Windows format PATH. ++ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` ++ else ++ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ++ fi ++ # FIXME: find the short name or the path components, as spaces are ++ # common. (e.g. "Program Files" -> "PROGRA~1") ++ ;; ++ esac ++ ++ # DLL is installed to $(libdir)/../bin by postinstall_cmds ++ postinstall_cmds='base_file=`basename \${file}`~ ++ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ ++ dldir=$destdir/`dirname \$dlpath`~ ++ test -d \$dldir || mkdir -p \$dldir~ ++ $install_prog $dir/$dlname \$dldir/$dlname' ++ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ ++ dlpath=$dir/\$dldll~ ++ $RM \$dlpath' ++ shlibpath_overrides_runpath=yes ++ dynamic_linker='Win32 link.exe' + ;; + + *) ++ # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ++ dynamic_linker='Win32 ld.exe' + ;; + esac +- dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; +@@ -10708,7 +11388,7 @@ haiku*) + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes +- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' ++ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +@@ -10815,12 +11495,7 @@ linux*oldld* | linux*aout* | linux*coff*) + ;; + + # This must be Linux ELF. +- +-# uclinux* changes (here and below) have been submitted to the libtool +-# project, but have not yet been accepted: they are GCC-local changes +-# for the time being. (See +-# https://lists.gnu.org/archive/html/libtool-patches/2018-05/msg00000.html) +-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu* | uclinuxfdpiceabi) ++linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux + need_lib_prefix=no + need_version=no +@@ -11509,7 +12184,7 @@ else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +-#line 11512 "configure" ++#line $LINENO "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -11553,10 +12228,10 @@ else + /* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ + #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +-void fnord () __attribute__((visibility("default"))); ++int fnord () __attribute__((visibility("default"))); + #endif + +-void fnord () { int i=42; } ++int fnord () { return 42; } + int main () + { + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); +@@ -11615,7 +12290,7 @@ else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +-#line 11618 "configure" ++#line $LINENO "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -11659,10 +12334,10 @@ else + /* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ + #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +-void fnord () __attribute__((visibility("default"))); ++int fnord () __attribute__((visibility("default"))); + #endif + +-void fnord () { int i=42; } ++int fnord () { return 42; } + int main () + { + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); +@@ -14948,13 +15623,20 @@ exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' + lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' + lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' + lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' ++lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' ++lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' + reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' + reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' + OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' + deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' + file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' ++file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' ++want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' ++DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' ++sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' + AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' + AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' ++archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' + STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' + RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' + old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +@@ -14969,14 +15651,17 @@ lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$de + lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' + lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' + 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"`' ++nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' ++lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' + objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' + MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' + lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +-lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' + lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' ++lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' + lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' + lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' + need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' ++MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' + DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' + NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' + LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +@@ -15009,12 +15694,12 @@ hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_q + hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' + inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' + link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +-fix_srcfile_path='`$ECHO "$fix_srcfile_path" | $SED "$delay_single_quote_subst"`' + always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' + export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' + exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' + include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' + prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' ++postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' + file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' + variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' + need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +@@ -15069,8 +15754,13 @@ reload_flag \ + OBJDUMP \ + deplibs_check_method \ + file_magic_cmd \ ++file_magic_glob \ ++want_nocaseglob \ ++DLLTOOL \ ++sharedlib_from_linklib_cmd \ + AR \ + AR_FLAGS \ ++archiver_list_spec \ + STRIP \ + RANLIB \ + CC \ +@@ -15080,12 +15770,14 @@ lt_cv_sys_global_symbol_pipe \ + lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ ++nm_file_list_spec \ + lt_prog_compiler_no_builtin_flag \ +-lt_prog_compiler_wl \ + lt_prog_compiler_pic \ ++lt_prog_compiler_wl \ + lt_prog_compiler_static \ + lt_cv_prog_compiler_c_o \ + need_locks \ ++MANIFEST_TOOL \ + DSYMUTIL \ + NMEDIT \ + LIPO \ +@@ -15101,7 +15793,6 @@ no_undefined_flag \ + hardcode_libdir_flag_spec \ + hardcode_libdir_flag_spec_ld \ + hardcode_libdir_separator \ +-fix_srcfile_path \ + exclude_expsyms \ + include_expsyms \ + file_list_spec \ +@@ -15137,6 +15828,7 @@ module_cmds \ + module_expsym_cmds \ + export_symbols_cmds \ + prelink_cmds \ ++postlink_cmds \ + postinstall_cmds \ + postuninstall_cmds \ + finish_cmds \ +@@ -15835,7 +16527,8 @@ esac ;; + # NOTE: Changes made to this file will be lost: look at ltmain.sh. + # + # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +-# 2006, 2007, 2008, 2009 Free Software Foundation, Inc. ++# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, ++# Inc. + # Written by Gordon Matzigkeit, 1996 + # + # This file is part of GNU Libtool. +@@ -15938,19 +16631,42 @@ SP2NL=$lt_lt_SP2NL + # turn newlines into spaces. + NL2SP=$lt_lt_NL2SP + ++# convert \$build file names to \$host format. ++to_host_file_cmd=$lt_cv_to_host_file_cmd ++ ++# convert \$build files to toolchain format. ++to_tool_file_cmd=$lt_cv_to_tool_file_cmd ++ + # An object symbol dumper. + OBJDUMP=$lt_OBJDUMP + + # Method to check whether dependent libraries are shared objects. + deplibs_check_method=$lt_deplibs_check_method + +-# Command to use when deplibs_check_method == "file_magic". ++# Command to use when deplibs_check_method = "file_magic". + file_magic_cmd=$lt_file_magic_cmd + ++# How to find potential files when deplibs_check_method = "file_magic". ++file_magic_glob=$lt_file_magic_glob ++ ++# Find potential files using nocaseglob when deplibs_check_method = "file_magic". ++want_nocaseglob=$lt_want_nocaseglob ++ ++# DLL creation program. ++DLLTOOL=$lt_DLLTOOL ++ ++# Command to associate shared and link libraries. ++sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd ++ + # The archiver. + AR=$lt_AR ++ ++# Flags to create an archive. + AR_FLAGS=$lt_AR_FLAGS + ++# How to feed a file listing to the archiver. ++archiver_list_spec=$lt_archiver_list_spec ++ + # A symbol stripping program. + STRIP=$lt_STRIP + +@@ -15980,6 +16696,12 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + # Transform the output of nm in a C name address pair when lib prefix is needed. + global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + ++# Specify filename containing input files for \$NM. ++nm_file_list_spec=$lt_nm_file_list_spec ++ ++# The root where to search for dependent libraries,and in which our libraries should be installed. ++lt_sysroot=$lt_sysroot ++ + # The name of the directory that contains temporary libtool files. + objdir=$objdir + +@@ -15989,6 +16711,9 @@ MAGIC_CMD=$MAGIC_CMD + # Must we lock files when doing compilation? + need_locks=$lt_need_locks + ++# Manifest tool. ++MANIFEST_TOOL=$lt_MANIFEST_TOOL ++ + # Tool to manipulate archived DWARF debug symbol files on Mac OS X. + DSYMUTIL=$lt_DSYMUTIL + +@@ -16103,12 +16828,12 @@ with_gcc=$GCC + # Compiler flag to turn off builtin functions. + no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +-# How to pass a linker flag through the compiler. +-wl=$lt_lt_prog_compiler_wl +- + # Additional compiler flags for building library objects. + pic_flag=$lt_lt_prog_compiler_pic + ++# How to pass a linker flag through the compiler. ++wl=$lt_lt_prog_compiler_wl ++ + # Compiler flag to prevent dynamic linking. + link_static_flag=$lt_lt_prog_compiler_static + +@@ -16195,9 +16920,6 @@ inherit_rpath=$inherit_rpath + # Whether libtool must link a program against all its dependency libraries. + link_all_deplibs=$link_all_deplibs + +-# Fix the shell variable \$srcfile for the compiler. +-fix_srcfile_path=$lt_fix_srcfile_path +- + # Set to "yes" if exported symbols are required. + always_export_symbols=$always_export_symbols + +@@ -16213,6 +16935,9 @@ include_expsyms=$lt_include_expsyms + # Commands necessary for linking programs (against libraries) with templates. + prelink_cmds=$lt_prelink_cmds + ++# Commands necessary for finishing linking programs. ++postlink_cmds=$lt_postlink_cmds ++ + # Specify filename containing input files. + file_list_spec=$lt_file_list_spec + +@@ -16245,210 +16970,169 @@ ltmain="$ac_aux_dir/ltmain.sh" + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? +- sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ +- || (rm -f "$cfgfile"; exit 1) +- +- case $xsi_shell in +- yes) +- cat << \_LT_EOF >> "$cfgfile" +- +-# func_dirname file append nondir_replacement +-# Compute the dirname of FILE. If nonempty, add APPEND to the result, +-# otherwise set result to NONDIR_REPLACEMENT. +-func_dirname () +-{ +- case ${1} in +- */*) func_dirname_result="${1%/*}${2}" ;; +- * ) func_dirname_result="${3}" ;; +- esac +-} +- +-# func_basename file +-func_basename () +-{ +- func_basename_result="${1##*/}" +-} +- +-# func_dirname_and_basename file append nondir_replacement +-# perform func_basename and func_dirname in a single function +-# call: +-# dirname: Compute the dirname of FILE. If nonempty, +-# add APPEND to the result, otherwise set result +-# to NONDIR_REPLACEMENT. +-# value returned in "$func_dirname_result" +-# basename: Compute filename of FILE. +-# value retuned in "$func_basename_result" +-# Implementation must be kept synchronized with func_dirname +-# and func_basename. For efficiency, we do not delegate to +-# those functions but instead duplicate the functionality here. +-func_dirname_and_basename () +-{ +- case ${1} in +- */*) func_dirname_result="${1%/*}${2}" ;; +- * ) func_dirname_result="${3}" ;; +- esac +- func_basename_result="${1##*/}" +-} +- +-# func_stripname prefix suffix name +-# strip PREFIX and SUFFIX off of NAME. +-# PREFIX and SUFFIX must not contain globbing or regex special +-# characters, hashes, percent signs, but SUFFIX may contain a leading +-# dot (in which case that matches only a dot). +-func_stripname () +-{ +- # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are +- # positional parameters, so assign one to ordinary parameter first. +- func_stripname_result=${3} +- func_stripname_result=${func_stripname_result#"${1}"} +- func_stripname_result=${func_stripname_result%"${2}"} +-} +- +-# func_opt_split +-func_opt_split () +-{ +- func_opt_split_opt=${1%%=*} +- func_opt_split_arg=${1#*=} +-} +- +-# func_lo2o object +-func_lo2o () +-{ +- case ${1} in +- *.lo) func_lo2o_result=${1%.lo}.${objext} ;; +- *) func_lo2o_result=${1} ;; +- esac +-} +- +-# func_xform libobj-or-source +-func_xform () +-{ +- func_xform_result=${1%.*}.lo +-} +- +-# func_arith arithmetic-term... +-func_arith () +-{ +- func_arith_result=$(( $* )) +-} +- +-# func_len string +-# STRING may not start with a hyphen. +-func_len () +-{ +- func_len_result=${#1} +-} +- +-_LT_EOF +- ;; +- *) # Bourne compatible functions. +- cat << \_LT_EOF >> "$cfgfile" +- +-# func_dirname file append nondir_replacement +-# Compute the dirname of FILE. If nonempty, add APPEND to the result, +-# otherwise set result to NONDIR_REPLACEMENT. +-func_dirname () +-{ +- # Extract subdirectory from the argument. +- func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` +- if test "X$func_dirname_result" = "X${1}"; then +- func_dirname_result="${3}" +- else +- func_dirname_result="$func_dirname_result${2}" +- fi +-} +- +-# func_basename file +-func_basename () +-{ +- func_basename_result=`$ECHO "${1}" | $SED "$basename"` +-} +- +- +-# func_stripname prefix suffix name +-# strip PREFIX and SUFFIX off of NAME. +-# PREFIX and SUFFIX must not contain globbing or regex special +-# characters, hashes, percent signs, but SUFFIX may contain a leading +-# dot (in which case that matches only a dot). +-# func_strip_suffix prefix name +-func_stripname () +-{ +- case ${2} in +- .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; +- *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; +- esac +-} +- +-# sed scripts: +-my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' +-my_sed_long_arg='1s/^-[^=]*=//' +- +-# func_opt_split +-func_opt_split () +-{ +- func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"` +- func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"` +-} +- +-# func_lo2o object +-func_lo2o () +-{ +- func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` +-} +- +-# func_xform libobj-or-source +-func_xform () +-{ +- func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` +-} +- +-# func_arith arithmetic-term... +-func_arith () +-{ +- func_arith_result=`expr "$@"` +-} +- +-# func_len string +-# STRING may not start with a hyphen. +-func_len () +-{ +- func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` +-} +- +-_LT_EOF +-esac +- +-case $lt_shell_append in +- yes) +- cat << \_LT_EOF >> "$cfgfile" +- +-# func_append var value +-# Append VALUE to the end of shell variable VAR. +-func_append () +-{ +- eval "$1+=\$2" +-} +-_LT_EOF +- ;; +- *) +- cat << \_LT_EOF >> "$cfgfile" +- +-# func_append var value +-# Append VALUE to the end of shell variable VAR. +-func_append () +-{ +- eval "$1=\$$1\$2" +-} +- +-_LT_EOF +- ;; +- esac +- +- +- sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ +- || (rm -f "$cfgfile"; exit 1) +- +- mv -f "$cfgfile" "$ofile" || ++ sed '$q' "$ltmain" >> "$cfgfile" \ ++ || (rm -f "$cfgfile"; exit 1) ++ ++ if test x"$xsi_shell" = xyes; then ++ sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ ++func_dirname ()\ ++{\ ++\ case ${1} in\ ++\ */*) func_dirname_result="${1%/*}${2}" ;;\ ++\ * ) func_dirname_result="${3}" ;;\ ++\ esac\ ++} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ ++ && mv -f "$cfgfile.tmp" "$cfgfile" \ ++ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") ++test 0 -eq $? || _lt_function_replace_fail=: ++ ++ ++ sed -e '/^func_basename ()$/,/^} # func_basename /c\ ++func_basename ()\ ++{\ ++\ func_basename_result="${1##*/}"\ ++} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ ++ && mv -f "$cfgfile.tmp" "$cfgfile" \ ++ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") ++test 0 -eq $? || _lt_function_replace_fail=: ++ ++ ++ sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ ++func_dirname_and_basename ()\ ++{\ ++\ case ${1} in\ ++\ */*) func_dirname_result="${1%/*}${2}" ;;\ ++\ * ) func_dirname_result="${3}" ;;\ ++\ esac\ ++\ func_basename_result="${1##*/}"\ ++} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ ++ && mv -f "$cfgfile.tmp" "$cfgfile" \ ++ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") ++test 0 -eq $? || _lt_function_replace_fail=: ++ ++ ++ sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ ++func_stripname ()\ ++{\ ++\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ ++\ # positional parameters, so assign one to ordinary parameter first.\ ++\ func_stripname_result=${3}\ ++\ func_stripname_result=${func_stripname_result#"${1}"}\ ++\ func_stripname_result=${func_stripname_result%"${2}"}\ ++} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ ++ && mv -f "$cfgfile.tmp" "$cfgfile" \ ++ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") ++test 0 -eq $? || _lt_function_replace_fail=: ++ ++ ++ sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ ++func_split_long_opt ()\ ++{\ ++\ func_split_long_opt_name=${1%%=*}\ ++\ func_split_long_opt_arg=${1#*=}\ ++} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ ++ && mv -f "$cfgfile.tmp" "$cfgfile" \ ++ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") ++test 0 -eq $? || _lt_function_replace_fail=: ++ ++ ++ sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ ++func_split_short_opt ()\ ++{\ ++\ func_split_short_opt_arg=${1#??}\ ++\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ ++} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ ++ && mv -f "$cfgfile.tmp" "$cfgfile" \ ++ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") ++test 0 -eq $? || _lt_function_replace_fail=: ++ ++ ++ sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ ++func_lo2o ()\ ++{\ ++\ case ${1} in\ ++\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ ++\ *) func_lo2o_result=${1} ;;\ ++\ esac\ ++} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ ++ && mv -f "$cfgfile.tmp" "$cfgfile" \ ++ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") ++test 0 -eq $? || _lt_function_replace_fail=: ++ ++ ++ sed -e '/^func_xform ()$/,/^} # func_xform /c\ ++func_xform ()\ ++{\ ++ func_xform_result=${1%.*}.lo\ ++} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ ++ && mv -f "$cfgfile.tmp" "$cfgfile" \ ++ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") ++test 0 -eq $? || _lt_function_replace_fail=: ++ ++ ++ sed -e '/^func_arith ()$/,/^} # func_arith /c\ ++func_arith ()\ ++{\ ++ func_arith_result=$(( $* ))\ ++} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ ++ && mv -f "$cfgfile.tmp" "$cfgfile" \ ++ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") ++test 0 -eq $? || _lt_function_replace_fail=: ++ ++ ++ sed -e '/^func_len ()$/,/^} # func_len /c\ ++func_len ()\ ++{\ ++ func_len_result=${#1}\ ++} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ ++ && mv -f "$cfgfile.tmp" "$cfgfile" \ ++ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") ++test 0 -eq $? || _lt_function_replace_fail=: ++ ++fi ++ ++if test x"$lt_shell_append" = xyes; then ++ sed -e '/^func_append ()$/,/^} # func_append /c\ ++func_append ()\ ++{\ ++ eval "${1}+=\\${2}"\ ++} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ ++ && mv -f "$cfgfile.tmp" "$cfgfile" \ ++ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") ++test 0 -eq $? || _lt_function_replace_fail=: ++ ++ ++ sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ ++func_append_quoted ()\ ++{\ ++\ func_quote_for_eval "${2}"\ ++\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ ++} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ ++ && mv -f "$cfgfile.tmp" "$cfgfile" \ ++ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") ++test 0 -eq $? || _lt_function_replace_fail=: ++ ++ ++ # Save a `func_append' function call where possible by direct use of '+=' ++ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ ++ && mv -f "$cfgfile.tmp" "$cfgfile" \ ++ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") ++ test 0 -eq $? || _lt_function_replace_fail=: ++else ++ # Save a `func_append' function call even when '+=' is not available ++ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ ++ && mv -f "$cfgfile.tmp" "$cfgfile" \ ++ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") ++ test 0 -eq $? || _lt_function_replace_fail=: ++fi ++ ++if test x"$_lt_function_replace_fail" = x":"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 ++$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} ++fi ++ + - # Specify filename containing input files. - file_list_spec=$lt_file_list_spec_CXX ++ mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" diff --git a/libctf/configure b/libctf/configure -index 6b294bfebfb..52a025bb848 100755 +index c56ac218213..8e02ca04422 100755 --- a/libctf/configure +++ b/libctf/configure -@@ -663,6 +663,8 @@ OTOOL +@@ -669,6 +669,8 @@ OTOOL LIPO NMEDIT DSYMUTIL @@ -10337,7 +12494,7 @@ index 6b294bfebfb..52a025bb848 100755 OBJDUMP LN_S NM -@@ -790,6 +792,7 @@ enable_static +@@ -800,6 +802,7 @@ enable_static with_pic enable_fast_install with_gnu_ld @@ -10345,7 +12502,7 @@ index 6b294bfebfb..52a025bb848 100755 enable_libtool_lock enable_largefile enable_werror_always -@@ -1452,6 +1455,8 @@ Optional Packages: +@@ -1463,6 +1466,8 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] @@ -10354,7 +12511,7 @@ index 6b294bfebfb..52a025bb848 100755 --with-system-zlib use installed libz Some influential environment variables: -@@ -5411,8 +5416,8 @@ esac +@@ -5571,8 +5576,8 @@ esac @@ -10365,7 +12522,7 @@ index 6b294bfebfb..52a025bb848 100755 -@@ -5523,7 +5528,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO +@@ -5612,7 +5617,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. @@ -10374,7 +12531,7 @@ index 6b294bfebfb..52a025bb848 100755 test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then -@@ -6209,8 +6214,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; +@@ -6299,8 +6304,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" @@ -10385,7 +12542,7 @@ index 6b294bfebfb..52a025bb848 100755 && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes -@@ -6259,6 +6264,80 @@ esac +@@ -6349,6 +6354,80 @@ esac @@ -10466,7 +12623,7 @@ index 6b294bfebfb..52a025bb848 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : -@@ -6275,6 +6354,11 @@ case $reload_flag in +@@ -6365,6 +6444,11 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in @@ -10478,7 +12635,7 @@ index 6b294bfebfb..52a025bb848 100755 darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' -@@ -6443,7 +6527,8 @@ mingw* | pw32*) +@@ -6533,7 +6617,8 @@ mingw* | pw32*) lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else @@ -10488,7 +12645,7 @@ index 6b294bfebfb..52a025bb848 100755 lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -@@ -6597,6 +6682,21 @@ esac +@@ -6687,6 +6772,21 @@ esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } @@ -10510,7 +12667,7 @@ index 6b294bfebfb..52a025bb848 100755 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown -@@ -6612,9 +6712,162 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown +@@ -6702,6 +6802,157 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -10665,6 +12822,12 @@ index 6b294bfebfb..52a025bb848 100755 + + + + plugin_option= + plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll" + for plugin in $plugin_names; do +@@ -6716,8 +6967,10 @@ for plugin in $plugin_names; do + done + if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 @@ -10675,7 +12838,7 @@ index 6b294bfebfb..52a025bb848 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : -@@ -6630,7 +6883,7 @@ do +@@ -6733,7 +6986,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then @@ -10684,7 +12847,7 @@ index 6b294bfebfb..52a025bb848 100755 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi -@@ -6650,11 +6903,15 @@ $as_echo "no" >&6; } +@@ -6753,11 +7006,15 @@ $as_echo "no" >&6; } fi @@ -10703,7 +12866,7 @@ index 6b294bfebfb..52a025bb848 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : -@@ -6670,7 +6927,7 @@ do +@@ -6773,7 +7030,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then @@ -10712,7 +12875,7 @@ index 6b294bfebfb..52a025bb848 100755 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi -@@ -6689,6 +6946,10 @@ else +@@ -6792,6 +7049,10 @@ else $as_echo "no" >&6; } fi @@ -10723,7 +12886,7 @@ index 6b294bfebfb..52a025bb848 100755 if test "x$ac_ct_AR" = x; then AR="false" else -@@ -6700,16 +6961,72 @@ ac_tool_warned=yes ;; +@@ -6803,25 +7064,19 @@ ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi @@ -10732,20 +12895,36 @@ index 6b294bfebfb..52a025bb848 100755 fi -test -z "$AR" && AR=ar +-if test -n "$plugin_option"; then +- if $AR --help 2>&1 | grep -q "\--plugin"; then +- touch conftest.c +- $AR $plugin_option rc conftest.a conftest.c +- if test "$?" != 0; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 ++ touch conftest.c ++ $AR $plugin_option rc conftest.a conftest.c ++ if test "$?" != 0; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 + $as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;} +- else +- AR="$AR $plugin_option" +- fi +- rm -f conftest.* ++ else ++ AR="$AR $plugin_option" + fi +-fi -test -z "$AR_FLAGS" && AR_FLAGS=cru ++ rm -f conftest.* +: ${AR=ar} +: ${AR_FLAGS=cru} -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ + + + +@@ -6833,6 +7088,64 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : @@ -10758,7 +12937,7 @@ index 6b294bfebfb..52a025bb848 100755 +int +main () +{ - ++ + ; + return 0; +} @@ -10784,23 +12963,30 @@ index 6b294bfebfb..52a025bb848 100755 + fi + fi + rm -f conftest.* libconftest.a - ++ +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ++ +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } - ++ +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi - - - -@@ -7051,8 +7368,8 @@ esac ++ ++ ++ ++ ++ ++ ++ + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. + set dummy ${ac_tool_prefix}strip; ac_word=$2 +@@ -7172,8 +7485,8 @@ esac lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address @@ -10811,7 +12997,7 @@ index 6b294bfebfb..52a025bb848 100755 # Handle CRLF in mingw tool chain opt_cr= -@@ -7088,6 +7405,7 @@ for ac_symprfx in "" "_"; do +@@ -7209,6 +7522,7 @@ for ac_symprfx in "" "_"; do else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi @@ -10819,7 +13005,7 @@ index 6b294bfebfb..52a025bb848 100755 # Check to see that the pipe works correctly. pipe_works=no -@@ -7129,6 +7447,18 @@ _LT_EOF +@@ -7250,6 +7564,18 @@ _LT_EOF if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext @@ -10838,7 +13024,7 @@ index 6b294bfebfb..52a025bb848 100755 #ifdef __cplusplus extern "C" { #endif -@@ -7140,7 +7470,7 @@ _LT_EOF +@@ -7261,7 +7587,7 @@ _LT_EOF cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ @@ -10847,7 +13033,7 @@ index 6b294bfebfb..52a025bb848 100755 const char *name; void *address; } -@@ -7166,8 +7496,8 @@ static const void *lt_preloaded_setup() { +@@ -7287,8 +7613,8 @@ static const void *lt_preloaded_setup() { _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext @@ -10858,7 +13044,7 @@ index 6b294bfebfb..52a025bb848 100755 LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 -@@ -7177,8 +7507,8 @@ _LT_EOF +@@ -7298,8 +7624,8 @@ _LT_EOF test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi @@ -10869,7 +13055,7 @@ index 6b294bfebfb..52a025bb848 100755 else echo "cannot find nm_test_func in $nlist" >&5 fi -@@ -7215,6 +7545,16 @@ else +@@ -7336,6 +7662,14 @@ else $as_echo "ok" >&6; } fi @@ -10881,12 +13067,10 @@ index 6b294bfebfb..52a025bb848 100755 +fi + + -+ -+ -@@ -7231,6 +7571,45 @@ fi +@@ -7354,6 +7688,47 @@ fi @@ -10929,10 +13113,12 @@ index 6b294bfebfb..52a025bb848 100755 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } ++ ++ -@@ -7442,6 +7821,123 @@ esac +@@ -7563,6 +7938,123 @@ esac need_locks="$enable_libtool_lock" @@ -11056,7 +13242,7 @@ index 6b294bfebfb..52a025bb848 100755 case $host_os in rhapsody* | darwin*) -@@ -8005,6 +8501,8 @@ _LT_EOF +@@ -8126,6 +8618,8 @@ _LT_EOF $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 @@ -11065,26 +13251,7 @@ index 6b294bfebfb..52a025bb848 100755 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF -@@ -8170,7 +8668,8 @@ fi - LIBTOOL_DEPS="$ltmain" - - # Always use our own libtool. --LIBTOOL='$(SHELL) $(top_builddir)/libtool' -+LIBTOOL='$(SHELL) $(top_builddir)' -+LIBTOOL="$LIBTOOL/${host_alias}-libtool" - - - -@@ -8259,7 +8758,7 @@ aix3*) - esac - - # Global variables: --ofile=libtool -+ofile=${host_alias}-libtool - can_build_shared=yes - - # All known linkers require a `.a' archive for static linking (except MSVC, -@@ -8557,8 +9056,6 @@ fi +@@ -8678,8 +9172,6 @@ fi lt_prog_compiler_pic= lt_prog_compiler_static= @@ -11093,7 +13260,7 @@ index 6b294bfebfb..52a025bb848 100755 if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' -@@ -8724,6 +9221,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -8845,6 +9337,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; @@ -11106,7 +13273,7 @@ index 6b294bfebfb..52a025bb848 100755 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) -@@ -8786,7 +9289,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -8907,7 +9405,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in @@ -11115,7 +13282,7 @@ index 6b294bfebfb..52a025bb848 100755 lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; -@@ -8843,13 +9346,17 @@ case $host_os in +@@ -8964,13 +9462,17 @@ case $host_os in lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac @@ -11139,7 +13306,7 @@ index 6b294bfebfb..52a025bb848 100755 # # Check to make sure the PIC flag actually works. -@@ -8910,6 +9417,11 @@ fi +@@ -9031,6 +9533,11 @@ fi @@ -11151,7 +13318,7 @@ index 6b294bfebfb..52a025bb848 100755 # # Check to make sure the static flag actually works. # -@@ -9260,7 +9772,8 @@ _LT_EOF +@@ -9381,7 +9888,8 @@ _LT_EOF allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes @@ -11161,7 +13328,7 @@ index 6b294bfebfb..52a025bb848 100755 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' -@@ -9359,12 +9872,12 @@ _LT_EOF +@@ -9480,12 +9988,12 @@ _LT_EOF whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' @@ -11176,7 +13343,7 @@ index 6b294bfebfb..52a025bb848 100755 fi ;; esac -@@ -9378,8 +9891,8 @@ _LT_EOF +@@ -9499,8 +10007,8 @@ _LT_EOF archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else @@ -11187,7 +13354,7 @@ index 6b294bfebfb..52a025bb848 100755 fi ;; -@@ -9397,8 +9910,8 @@ _LT_EOF +@@ -9518,8 +10026,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then @@ -11198,7 +13365,7 @@ index 6b294bfebfb..52a025bb848 100755 else ld_shlibs=no fi -@@ -9444,8 +9957,8 @@ _LT_EOF +@@ -9565,8 +10073,8 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then @@ -11209,7 +13376,7 @@ index 6b294bfebfb..52a025bb848 100755 else ld_shlibs=no fi -@@ -9575,7 +10088,13 @@ _LT_EOF +@@ -9696,7 +10204,13 @@ _LT_EOF allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. @@ -11224,7 +13391,7 @@ index 6b294bfebfb..52a025bb848 100755 /* end confdefs.h. */ int -@@ -9588,22 +10107,29 @@ main () +@@ -9709,22 +10223,29 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : @@ -11267,7 +13434,7 @@ index 6b294bfebfb..52a025bb848 100755 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" 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" -@@ -9615,7 +10141,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9736,7 +10257,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else # Determine the default libpath from the value encoded in an # empty executable. @@ -11282,7 +13449,7 @@ index 6b294bfebfb..52a025bb848 100755 /* end confdefs.h. */ int -@@ -9628,22 +10160,29 @@ main () +@@ -9749,22 +10276,29 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : @@ -11325,7 +13492,7 @@ index 6b294bfebfb..52a025bb848 100755 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, -@@ -9688,20 +10227,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9809,20 +10343,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. @@ -11403,7 +13570,7 @@ index 6b294bfebfb..52a025bb848 100755 ;; darwin* | rhapsody*) -@@ -9762,7 +10344,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9883,7 +10460,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) @@ -11412,7 +13579,7 @@ index 6b294bfebfb..52a025bb848 100755 hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no -@@ -9770,7 +10352,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9891,7 +10468,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux9*) if test "$GCC" = yes; then @@ -11421,7 +13588,7 @@ index 6b294bfebfb..52a025bb848 100755 else 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' fi -@@ -9786,7 +10368,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9907,7 +10484,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then @@ -11430,7 +13597,7 @@ index 6b294bfebfb..52a025bb848 100755 else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi -@@ -9810,10 +10392,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9931,10 +10508,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) @@ -11443,7 +13610,7 @@ index 6b294bfebfb..52a025bb848 100755 ;; esac else -@@ -9892,23 +10474,36 @@ fi +@@ -10013,23 +10590,36 @@ fi irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then @@ -11488,7 +13655,7 @@ index 6b294bfebfb..52a025bb848 100755 else 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' 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' -@@ -9993,7 +10588,7 @@ rm -f core conftest.err conftest.$ac_objext \ +@@ -10114,7 +10704,7 @@ rm -f core conftest.err conftest.$ac_objext \ osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' @@ -11497,7 +13664,7 @@ index 6b294bfebfb..52a025bb848 100755 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' -@@ -10012,9 +10607,9 @@ rm -f core conftest.err conftest.$ac_objext \ +@@ -10133,9 +10723,9 @@ rm -f core conftest.err conftest.$ac_objext \ no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' @@ -11509,7 +13676,7 @@ index 6b294bfebfb..52a025bb848 100755 else case `$CC -V 2>&1` in *"Compilers 5.0"*) -@@ -10590,8 +11185,9 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -10711,8 +11301,9 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no @@ -11521,7 +13688,7 @@ index 6b294bfebfb..52a025bb848 100755 library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ -@@ -10624,13 +11220,71 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -10745,13 +11336,71 @@ cygwin* | mingw* | pw32* | cegcc*) library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac @@ -11594,25 +13761,16 @@ index 6b294bfebfb..52a025bb848 100755 # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; -@@ -10712,7 +11366,7 @@ haiku*) - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes -- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' -+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -@@ -11508,7 +12162,7 @@ else +@@ -11629,7 +12278,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF --#line 11511 "configure" +-#line 11632 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H -@@ -11552,10 +12206,10 @@ else +@@ -11673,10 +12322,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) @@ -11625,16 +13783,16 @@ index 6b294bfebfb..52a025bb848 100755 int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); -@@ -11614,7 +12268,7 @@ else +@@ -11735,7 +12384,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF --#line 11617 "configure" +-#line 11738 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H -@@ -11658,10 +12312,10 @@ else +@@ -11779,10 +12428,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) @@ -11647,7 +13805,7 @@ index 6b294bfebfb..52a025bb848 100755 int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); -@@ -14136,13 +14790,20 @@ exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +@@ -14467,13 +15116,20 @@ exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' @@ -11668,7 +13826,7 @@ index 6b294bfebfb..52a025bb848 100755 STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' -@@ -14157,14 +14818,17 @@ lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$de +@@ -14488,14 +15144,17 @@ lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$de lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' 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"`' @@ -11687,7 +13845,7 @@ index 6b294bfebfb..52a025bb848 100755 DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' -@@ -14197,12 +14861,12 @@ hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_q +@@ -14528,12 +15187,12 @@ hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_q hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' @@ -11701,7 +13859,7 @@ index 6b294bfebfb..52a025bb848 100755 file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' -@@ -14257,8 +14921,13 @@ reload_flag \ +@@ -14588,8 +15247,13 @@ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ @@ -11715,7 +13873,7 @@ index 6b294bfebfb..52a025bb848 100755 STRIP \ RANLIB \ CC \ -@@ -14268,12 +14937,14 @@ lt_cv_sys_global_symbol_pipe \ +@@ -14599,12 +15263,14 @@ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ @@ -11731,7 +13889,7 @@ index 6b294bfebfb..52a025bb848 100755 DSYMUTIL \ NMEDIT \ LIPO \ -@@ -14289,7 +14960,6 @@ no_undefined_flag \ +@@ -14620,7 +15286,6 @@ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ @@ -11739,7 +13897,7 @@ index 6b294bfebfb..52a025bb848 100755 exclude_expsyms \ include_expsyms \ file_list_spec \ -@@ -14325,6 +14995,7 @@ module_cmds \ +@@ -14656,6 +15321,7 @@ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ @@ -11747,7 +13905,7 @@ index 6b294bfebfb..52a025bb848 100755 postinstall_cmds \ postuninstall_cmds \ finish_cmds \ -@@ -15081,7 +15752,8 @@ $as_echo X"$file" | +@@ -15412,7 +16078,8 @@ $as_echo X"$file" | # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, @@ -11757,7 +13915,7 @@ index 6b294bfebfb..52a025bb848 100755 # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. -@@ -15184,19 +15856,42 @@ SP2NL=$lt_lt_SP2NL +@@ -15515,19 +16182,42 @@ SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP @@ -11801,7 +13959,7 @@ index 6b294bfebfb..52a025bb848 100755 # A symbol stripping program. STRIP=$lt_STRIP -@@ -15226,6 +15921,12 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address +@@ -15557,6 +16247,12 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix @@ -11814,7 +13972,7 @@ index 6b294bfebfb..52a025bb848 100755 # The name of the directory that contains temporary libtool files. objdir=$objdir -@@ -15235,6 +15936,9 @@ MAGIC_CMD=$MAGIC_CMD +@@ -15566,6 +16262,9 @@ MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks @@ -11824,7 +13982,7 @@ index 6b294bfebfb..52a025bb848 100755 # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL -@@ -15349,12 +16053,12 @@ with_gcc=$GCC +@@ -15680,12 +16379,12 @@ with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag @@ -11840,7 +13998,7 @@ index 6b294bfebfb..52a025bb848 100755 # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static -@@ -15441,9 +16145,6 @@ inherit_rpath=$inherit_rpath +@@ -15772,9 +16471,6 @@ inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs @@ -11850,7 +14008,7 @@ index 6b294bfebfb..52a025bb848 100755 # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols -@@ -15459,6 +16160,9 @@ include_expsyms=$lt_include_expsyms +@@ -15790,6 +16486,9 @@ include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds @@ -11860,7 +14018,7 @@ index 6b294bfebfb..52a025bb848 100755 # Specify filename containing input files. file_list_spec=$lt_file_list_spec -@@ -15491,210 +16195,169 @@ ltmain="$ac_aux_dir/ltmain.sh" +@@ -15822,210 +16521,169 @@ ltmain="$ac_aux_dir/ltmain.sh" # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? @@ -12235,7 +14393,7 @@ index 6b294bfebfb..52a025bb848 100755 chmod +x "$ofile" diff --git a/libtool.m4 b/libtool.m4 -index e993b621ac2..7715af647f4 100644 +index a216bb14e99..e37c45ac0b1 100644 --- a/libtool.m4 +++ b/libtool.m4 @@ -1,7 +1,8 @@ @@ -12267,17 +14425,7 @@ index e993b621ac2..7715af647f4 100644 # LT_PREREQ(VERSION) -@@ -92,7 +94,8 @@ _LT_SET_OPTIONS([$0], [$1]) - LIBTOOL_DEPS="$ltmain" - - # Always use our own libtool. --LIBTOOL='$(SHELL) $(top_builddir)/libtool' -+LIBTOOL='$(SHELL) $(top_builddir)' -+LIBTOOL="$LIBTOOL/${host_alias}-libtool" - AC_SUBST(LIBTOOL)dnl - - _LT_SETUP -@@ -166,10 +169,13 @@ _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl +@@ -166,10 +168,13 @@ _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl @@ -12291,16 +14439,7 @@ index e993b621ac2..7715af647f4 100644 _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our -@@ -199,7 +205,7 @@ aix3*) - esac - - # Global variables: --ofile=libtool -+ofile=${host_alias}-libtool - can_build_shared=yes - - # All known linkers require a `.a' archive for static linking (except MSVC, -@@ -632,7 +638,7 @@ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +@@ -632,7 +637,7 @@ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. @@ -12309,7 +14448,7 @@ index e993b621ac2..7715af647f4 100644 This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." -@@ -746,15 +752,12 @@ _LT_EOF +@@ -746,15 +751,12 @@ _LT_EOF # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? @@ -12329,7 +14468,7 @@ index e993b621ac2..7715af647f4 100644 (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], -@@ -980,6 +983,8 @@ _LT_EOF +@@ -980,6 +982,8 @@ _LT_EOF $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD @@ -12338,7 +14477,7 @@ index e993b621ac2..7715af647f4 100644 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF -@@ -1069,30 +1074,41 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES], +@@ -1069,30 +1073,41 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES], fi ]) @@ -12396,7 +14535,7 @@ index e993b621ac2..7715af647f4 100644 ])# _LT_SYS_MODULE_PATH_AIX -@@ -1117,7 +1133,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO +@@ -1117,7 +1132,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. @@ -12405,7 +14544,7 @@ index e993b621ac2..7715af647f4 100644 test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then -@@ -1161,6 +1177,39 @@ _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) +@@ -1161,6 +1176,39 @@ _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH @@ -12445,7 +14584,7 @@ index e993b621ac2..7715af647f4 100644 # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], -@@ -1320,14 +1369,47 @@ need_locks="$enable_libtool_lock" +@@ -1320,6 +1368,51 @@ need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK @@ -12453,6 +14592,14 @@ index e993b621ac2..7715af647f4 100644 +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) ++ touch conftest.c ++ $AR $plugin_option rc conftest.a conftest.c ++ if test "$?" != 0; then ++ AC_MSG_WARN([Failed: $AR $plugin_option rc]) ++ else ++ AR="$AR $plugin_option" ++ fi ++ rm -f conftest.* +: ${AR=ar} +: ${AR_FLAGS=cru} +_LT_DECL([], [AR], [1], [The archiver]) @@ -12489,16 +14636,32 @@ index e993b621ac2..7715af647f4 100644 # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], --[AC_CHECK_TOOL(AR, ar, false) +@@ -1336,23 +1429,7 @@ for plugin in $plugin_names; do + fi + done + +-AC_CHECK_TOOL(AR, ar, false) -test -z "$AR" && AR=ar +-if test -n "$plugin_option"; then +- if $AR --help 2>&1 | grep -q "\--plugin"; then +- touch conftest.c +- $AR $plugin_option rc conftest.a conftest.c +- if test "$?" != 0; then +- AC_MSG_WARN([Failed: $AR $plugin_option rc]) +- else +- AR="$AR $plugin_option" +- fi +- rm -f conftest.* +- fi +-fi -test -z "$AR_FLAGS" && AR_FLAGS=cru -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1]) -+[_LT_PROG_AR ++_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: -@@ -1623,7 +1705,7 @@ else +@@ -1653,7 +1730,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF @@ -12507,7 +14670,7 @@ index e993b621ac2..7715af647f4 100644 #include "confdefs.h" #if HAVE_DLFCN_H -@@ -1667,10 +1749,10 @@ else +@@ -1697,10 +1774,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) @@ -12520,7 +14683,7 @@ index e993b621ac2..7715af647f4 100644 int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); -@@ -2210,8 +2292,9 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -2240,8 +2317,9 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no @@ -12532,7 +14695,7 @@ index e993b621ac2..7715af647f4 100644 library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ -@@ -2244,13 +2327,71 @@ m4_if([$1], [],[ +@@ -2274,13 +2352,71 @@ m4_if([$1], [],[ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac @@ -12605,16 +14768,7 @@ index e993b621ac2..7715af647f4 100644 # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; -@@ -2332,7 +2473,7 @@ haiku*) - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes -- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' -+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -@@ -2940,6 +3081,11 @@ case $reload_flag in +@@ -2970,6 +3106,11 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in @@ -12626,7 +14780,7 @@ index e993b621ac2..7715af647f4 100644 darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' -@@ -3006,7 +3152,8 @@ mingw* | pw32*) +@@ -3036,7 +3177,8 @@ mingw* | pw32*) lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else @@ -12636,7 +14790,7 @@ index e993b621ac2..7715af647f4 100644 lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -@@ -3157,6 +3304,21 @@ tpf*) +@@ -3187,6 +3329,21 @@ tpf*) ;; esac ]) @@ -12658,7 +14812,7 @@ index e993b621ac2..7715af647f4 100644 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown -@@ -3164,7 +3326,11 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown +@@ -3194,7 +3351,11 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], @@ -12671,7 +14825,7 @@ index e993b621ac2..7715af647f4 100644 ])# _LT_CHECK_MAGIC_METHOD -@@ -3267,6 +3433,67 @@ dnl aclocal-1.4 backwards compatibility: +@@ -3299,6 +3460,67 @@ dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) @@ -12739,7 +14893,7 @@ index e993b621ac2..7715af647f4 100644 # LT_LIB_M # -------- -@@ -3393,8 +3620,8 @@ esac +@@ -3425,8 +3647,8 @@ esac lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address @@ -12750,7 +14904,7 @@ index e993b621ac2..7715af647f4 100644 # Handle CRLF in mingw tool chain opt_cr= -@@ -3430,6 +3657,7 @@ for ac_symprfx in "" "_"; do +@@ -3462,6 +3684,7 @@ for ac_symprfx in "" "_"; do else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi @@ -12758,7 +14912,7 @@ index e993b621ac2..7715af647f4 100644 # Check to see that the pipe works correctly. pipe_works=no -@@ -3463,6 +3691,18 @@ _LT_EOF +@@ -3495,6 +3718,18 @@ _LT_EOF if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext @@ -12777,7 +14931,7 @@ index e993b621ac2..7715af647f4 100644 #ifdef __cplusplus extern "C" { #endif -@@ -3474,7 +3714,7 @@ _LT_EOF +@@ -3506,7 +3741,7 @@ _LT_EOF cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ @@ -12786,7 +14940,7 @@ index e993b621ac2..7715af647f4 100644 const char *name; void *address; } -@@ -3500,15 +3740,15 @@ static const void *lt_preloaded_setup() { +@@ -3532,15 +3767,15 @@ static const void *lt_preloaded_setup() { _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext @@ -12806,7 +14960,7 @@ index e993b621ac2..7715af647f4 100644 else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi -@@ -3541,6 +3781,13 @@ else +@@ -3573,6 +3808,13 @@ else AC_MSG_RESULT(ok) fi @@ -12820,7 +14974,7 @@ index e993b621ac2..7715af647f4 100644 _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], -@@ -3551,6 +3798,8 @@ _LT_DECL([global_symbol_to_c_name_address], +@@ -3583,6 +3825,8 @@ _LT_DECL([global_symbol_to_c_name_address], _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) @@ -12829,7 +14983,7 @@ index e993b621ac2..7715af647f4 100644 ]) # _LT_CMD_GLOBAL_SYMBOLS -@@ -3562,7 +3811,6 @@ _LT_TAGVAR(lt_prog_compiler_wl, $1)= +@@ -3594,7 +3838,6 @@ _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= @@ -12837,7 +14991,7 @@ index e993b621ac2..7715af647f4 100644 m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then -@@ -3668,6 +3916,12 @@ m4_if([$1], [CXX], [ +@@ -3700,6 +3943,12 @@ m4_if([$1], [CXX], [ ;; esac ;; @@ -12850,7 +15004,7 @@ index e993b621ac2..7715af647f4 100644 dgux*) case $cc_basename in ec++*) -@@ -3820,7 +4074,7 @@ m4_if([$1], [CXX], [ +@@ -3852,7 +4101,7 @@ m4_if([$1], [CXX], [ ;; solaris*) case $cc_basename in @@ -12859,7 +15013,7 @@ index e993b621ac2..7715af647f4 100644 # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' -@@ -4043,6 +4297,12 @@ m4_if([$1], [CXX], [ +@@ -4075,6 +4324,12 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; @@ -12872,7 +15026,7 @@ index e993b621ac2..7715af647f4 100644 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) -@@ -4105,7 +4365,7 @@ m4_if([$1], [CXX], [ +@@ -4137,7 +4392,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in @@ -12881,7 +15035,7 @@ index e993b621ac2..7715af647f4 100644 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; -@@ -4162,9 +4422,11 @@ case $host_os in +@@ -4194,9 +4449,11 @@ case $host_os in _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac @@ -12896,7 +15050,7 @@ index e993b621ac2..7715af647f4 100644 # # Check to make sure the PIC flag actually works. -@@ -4183,6 +4445,8 @@ fi +@@ -4215,6 +4472,8 @@ fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) @@ -12905,7 +15059,7 @@ index e993b621ac2..7715af647f4 100644 # # Check to make sure the static flag actually works. # -@@ -4203,6 +4467,7 @@ _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], +@@ -4235,6 +4494,7 @@ _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl @@ -12913,7 +15067,7 @@ index e993b621ac2..7715af647f4 100644 m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl -@@ -4211,6 +4476,7 @@ m4_require([_LT_TAG_COMPILER])dnl +@@ -4243,6 +4503,7 @@ m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' @@ -12921,7 +15075,7 @@ index e993b621ac2..7715af647f4 100644 case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. -@@ -4225,15 +4491,20 @@ m4_if([$1], [CXX], [ +@@ -4257,15 +4518,20 @@ m4_if([$1], [CXX], [ ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" @@ -12947,7 +15101,7 @@ index e993b621ac2..7715af647f4 100644 ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= -@@ -4401,7 +4672,8 @@ _LT_EOF +@@ -4433,7 +4699,8 @@ _LT_EOF _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes @@ -12957,7 +15111,7 @@ index e993b621ac2..7715af647f4 100644 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _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' -@@ -4500,12 +4772,12 @@ _LT_EOF +@@ -4532,12 +4799,12 @@ _LT_EOF _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' @@ -12972,7 +15126,7 @@ index e993b621ac2..7715af647f4 100644 fi ;; esac -@@ -4519,8 +4791,8 @@ _LT_EOF +@@ -4551,8 +4818,8 @@ _LT_EOF _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else @@ -12983,7 +15137,7 @@ index e993b621ac2..7715af647f4 100644 fi ;; -@@ -4538,8 +4810,8 @@ _LT_EOF +@@ -4570,8 +4837,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then @@ -12994,7 +15148,7 @@ index e993b621ac2..7715af647f4 100644 else _LT_TAGVAR(ld_shlibs, $1)=no fi -@@ -4585,8 +4857,8 @@ _LT_EOF +@@ -4617,8 +4884,8 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then @@ -13005,7 +15159,7 @@ index e993b621ac2..7715af647f4 100644 else _LT_TAGVAR(ld_shlibs, $1)=no fi -@@ -4716,7 +4988,7 @@ _LT_EOF +@@ -4748,7 +5015,7 @@ _LT_EOF _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. @@ -13014,7 +15168,7 @@ index e993b621ac2..7715af647f4 100644 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _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" else -@@ -4727,7 +4999,7 @@ _LT_EOF +@@ -4759,7 +5026,7 @@ _LT_EOF else # Determine the default libpath from the value encoded in an # empty executable. @@ -13023,7 +15177,7 @@ index e993b621ac2..7715af647f4 100644 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. -@@ -4771,20 +5043,63 @@ _LT_EOF +@@ -4803,20 +5070,63 @@ _LT_EOF # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. @@ -13101,7 +15255,7 @@ index e993b621ac2..7715af647f4 100644 ;; darwin* | rhapsody*) -@@ -4818,7 +5133,7 @@ _LT_EOF +@@ -4850,7 +5160,7 @@ _LT_EOF # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) @@ -13110,7 +15264,7 @@ index e993b621ac2..7715af647f4 100644 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no -@@ -4826,7 +5141,7 @@ _LT_EOF +@@ -4858,7 +5168,7 @@ _LT_EOF hpux9*) if test "$GCC" = yes; then @@ -13119,7 +15273,7 @@ index e993b621ac2..7715af647f4 100644 else _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' fi -@@ -4842,7 +5157,7 @@ _LT_EOF +@@ -4874,7 +5184,7 @@ _LT_EOF hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then @@ -13128,7 +15282,7 @@ index e993b621ac2..7715af647f4 100644 else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi -@@ -4866,10 +5181,10 @@ _LT_EOF +@@ -4898,10 +5208,10 @@ _LT_EOF _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) @@ -13141,7 +15295,7 @@ index e993b621ac2..7715af647f4 100644 ;; esac else -@@ -4916,16 +5231,31 @@ _LT_EOF +@@ -4948,16 +5258,31 @@ _LT_EOF irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then @@ -13180,7 +15334,7 @@ index e993b621ac2..7715af647f4 100644 else _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' _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' -@@ -5010,7 +5340,7 @@ _LT_EOF +@@ -5042,7 +5367,7 @@ _LT_EOF osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' @@ -13189,7 +15343,7 @@ index e993b621ac2..7715af647f4 100644 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' -@@ -5029,9 +5359,9 @@ _LT_EOF +@@ -5061,9 +5386,9 @@ _LT_EOF _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' @@ -13201,7 +15355,7 @@ index e993b621ac2..7715af647f4 100644 else case `$CC -V 2>&1` in *"Compilers 5.0"*) -@@ -5303,8 +5633,6 @@ _LT_TAGDECL([], [inherit_rpath], [0], +@@ -5335,8 +5660,6 @@ _LT_TAGDECL([], [inherit_rpath], [0], to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) @@ -13210,7 +15364,7 @@ index e993b621ac2..7715af647f4 100644 _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], -@@ -5315,6 +5643,8 @@ _LT_TAGDECL([], [include_expsyms], [1], +@@ -5347,6 +5670,8 @@ _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) @@ -13219,7 +15373,7 @@ index e993b621ac2..7715af647f4 100644 _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented -@@ -5416,6 +5746,7 @@ CC="$lt_save_CC" +@@ -5448,6 +5773,7 @@ CC="$lt_save_CC" m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl @@ -13227,7 +15381,7 @@ index e993b621ac2..7715af647f4 100644 if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then -@@ -5477,6 +5808,7 @@ if test "$_lt_caught_CXX_error" != yes; then +@@ -5509,6 +5835,7 @@ if test "$_lt_caught_CXX_error" != yes; then # Allow CC to be a program name with arguments. lt_save_CC=$CC @@ -13235,7 +15389,7 @@ index e993b621ac2..7715af647f4 100644 lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX -@@ -5494,6 +5826,7 @@ if test "$_lt_caught_CXX_error" != yes; then +@@ -5526,6 +5853,7 @@ if test "$_lt_caught_CXX_error" != yes; then fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} @@ -13243,7 +15397,7 @@ index e993b621ac2..7715af647f4 100644 compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) -@@ -5657,7 +5990,7 @@ if test "$_lt_caught_CXX_error" != yes; then +@@ -5689,7 +6017,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. @@ -13252,7 +15406,7 @@ index e993b621ac2..7715af647f4 100644 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _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" -@@ -5669,7 +6002,7 @@ if test "$_lt_caught_CXX_error" != yes; then +@@ -5701,7 +6029,7 @@ if test "$_lt_caught_CXX_error" != yes; then else # Determine the default libpath from the value encoded in an # empty executable. @@ -13261,7 +15415,7 @@ index e993b621ac2..7715af647f4 100644 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. -@@ -5711,29 +6044,75 @@ if test "$_lt_caught_CXX_error" != yes; then +@@ -5743,29 +6071,75 @@ if test "$_lt_caught_CXX_error" != yes; then ;; cygwin* | mingw* | pw32* | cegcc*) @@ -13360,7 +15514,7 @@ index e993b621ac2..7715af647f4 100644 darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; -@@ -5808,7 +6187,7 @@ if test "$_lt_caught_CXX_error" != yes; then +@@ -5840,7 +6214,7 @@ if test "$_lt_caught_CXX_error" != yes; then ;; *) if test "$GXX" = yes; then @@ -13369,7 +15523,7 @@ index e993b621ac2..7715af647f4 100644 else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no -@@ -5879,10 +6258,10 @@ if test "$_lt_caught_CXX_error" != yes; then +@@ -5911,10 +6285,10 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) @@ -13382,7 +15536,7 @@ index e993b621ac2..7715af647f4 100644 ;; esac fi -@@ -5923,9 +6302,9 @@ if test "$_lt_caught_CXX_error" != yes; then +@@ -5955,9 +6329,9 @@ if test "$_lt_caught_CXX_error" != yes; then *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then @@ -13394,7 +15548,7 @@ index e993b621ac2..7715af647f4 100644 fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes -@@ -5995,20 +6374,20 @@ if test "$_lt_caught_CXX_error" != yes; then +@@ -6027,20 +6401,20 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ @@ -13419,7 +15573,7 @@ index e993b621ac2..7715af647f4 100644 ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' -@@ -6203,7 +6582,7 @@ if test "$_lt_caught_CXX_error" != yes; then +@@ -6235,7 +6609,7 @@ if test "$_lt_caught_CXX_error" != yes; then _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' ;; *) @@ -13428,7 +15582,7 @@ index e993b621ac2..7715af647f4 100644 ;; esac -@@ -6249,7 +6628,7 @@ if test "$_lt_caught_CXX_error" != yes; then +@@ -6281,7 +6655,7 @@ if test "$_lt_caught_CXX_error" != yes; then solaris*) case $cc_basename in @@ -13437,7 +15591,7 @@ index e993b621ac2..7715af647f4 100644 # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' -@@ -6290,9 +6669,9 @@ if test "$_lt_caught_CXX_error" != yes; then +@@ -6322,9 +6696,9 @@ if test "$_lt_caught_CXX_error" != yes; then if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then @@ -13449,7 +15603,7 @@ index e993b621ac2..7715af647f4 100644 # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when -@@ -6421,6 +6800,7 @@ if test "$_lt_caught_CXX_error" != yes; then +@@ -6453,6 +6827,7 @@ if test "$_lt_caught_CXX_error" != yes; then fi # test -n "$compiler" CC=$lt_save_CC @@ -13457,7 +15611,7 @@ index e993b621ac2..7715af647f4 100644 LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC -@@ -6435,6 +6815,29 @@ AC_LANG_POP +@@ -6467,6 +6842,29 @@ AC_LANG_POP ])# _LT_LANG_CXX_CONFIG @@ -13487,7 +15641,7 @@ index e993b621ac2..7715af647f4 100644 # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose -@@ -6443,6 +6846,7 @@ AC_LANG_POP +@@ -6475,6 +6873,7 @@ AC_LANG_POP # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl @@ -13495,7 +15649,7 @@ index e993b621ac2..7715af647f4 100644 # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= -@@ -6493,6 +6897,13 @@ public class foo { +@@ -6525,6 +6924,13 @@ public class foo { }; _LT_EOF ]) @@ -13509,7 +15663,7 @@ index e993b621ac2..7715af647f4 100644 dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then -@@ -6504,7 +6915,7 @@ if AC_TRY_EVAL(ac_compile); then +@@ -6536,7 +6942,7 @@ if AC_TRY_EVAL(ac_compile); then pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do @@ -13518,7 +15672,7 @@ index e993b621ac2..7715af647f4 100644 -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. -@@ -6513,13 +6924,22 @@ if AC_TRY_EVAL(ac_compile); then +@@ -6545,13 +6951,22 @@ if AC_TRY_EVAL(ac_compile); then test $p = "-R"; then prev=$p continue @@ -13545,7 +15699,7 @@ index e993b621ac2..7715af647f4 100644 # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. -@@ -6539,8 +6959,10 @@ if AC_TRY_EVAL(ac_compile); then +@@ -6571,8 +6986,10 @@ if AC_TRY_EVAL(ac_compile); then _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi @@ -13556,7 +15710,7 @@ index e993b621ac2..7715af647f4 100644 *.$objext) # This assumes that the test object file only shows up # once in the compiler output. -@@ -6576,6 +6998,7 @@ else +@@ -6608,6 +7025,7 @@ else fi $RM -f confest.$objext @@ -13564,7 +15718,7 @@ index e993b621ac2..7715af647f4 100644 # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], -@@ -6612,7 +7035,7 @@ linux*) +@@ -6644,7 +7062,7 @@ linux*) solaris*) case $cc_basename in @@ -13573,7 +15727,7 @@ index e993b621ac2..7715af647f4 100644 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as -@@ -6725,7 +7148,9 @@ if test "$_lt_disable_F77" != yes; then +@@ -6757,7 +7175,9 @@ if test "$_lt_disable_F77" != yes; then # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC @@ -13583,7 +15737,7 @@ index e993b621ac2..7715af647f4 100644 compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) -@@ -6779,6 +7204,7 @@ if test "$_lt_disable_F77" != yes; then +@@ -6811,6 +7231,7 @@ if test "$_lt_disable_F77" != yes; then GCC=$lt_save_GCC CC="$lt_save_CC" @@ -13591,7 +15745,7 @@ index e993b621ac2..7715af647f4 100644 fi # test "$_lt_disable_F77" != yes AC_LANG_POP -@@ -6855,7 +7281,9 @@ if test "$_lt_disable_FC" != yes; then +@@ -6887,7 +7308,9 @@ if test "$_lt_disable_FC" != yes; then # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC @@ -13601,7 +15755,7 @@ index e993b621ac2..7715af647f4 100644 compiler=$CC GCC=$ac_cv_fc_compiler_gnu -@@ -6911,7 +7339,8 @@ if test "$_lt_disable_FC" != yes; then +@@ -6943,7 +7366,8 @@ if test "$_lt_disable_FC" != yes; then fi # test -n "$compiler" GCC=$lt_save_GCC @@ -13611,7 +15765,7 @@ index e993b621ac2..7715af647f4 100644 fi # test "$_lt_disable_FC" != yes AC_LANG_POP -@@ -6948,10 +7377,12 @@ _LT_COMPILER_BOILERPLATE +@@ -6980,10 +7404,12 @@ _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. @@ -13625,7 +15779,7 @@ index e993b621ac2..7715af647f4 100644 compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" -@@ -6982,7 +7413,8 @@ fi +@@ -7014,7 +7440,8 @@ fi AC_LANG_RESTORE GCC=$lt_save_GCC @@ -13635,7 +15789,7 @@ index e993b621ac2..7715af647f4 100644 ])# _LT_LANG_GCJ_CONFIG -@@ -7017,9 +7449,11 @@ _LT_LINKER_BOILERPLATE +@@ -7049,9 +7476,11 @@ _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" @@ -13647,7 +15801,7 @@ index e993b621ac2..7715af647f4 100644 compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) -@@ -7032,7 +7466,8 @@ fi +@@ -7064,7 +7493,8 @@ fi GCC=$lt_save_GCC AC_LANG_RESTORE @@ -13657,7 +15811,7 @@ index e993b621ac2..7715af647f4 100644 ])# _LT_LANG_RC_CONFIG -@@ -7091,6 +7526,15 @@ _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) +@@ -7123,6 +7553,15 @@ _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) @@ -13673,7 +15827,7 @@ index e993b621ac2..7715af647f4 100644 # _LT_DECL_SED # ------------ -@@ -7184,8 +7628,8 @@ m4_defun([_LT_CHECK_SHELL_FEATURES], +@@ -7216,8 +7655,8 @@ m4_defun([_LT_CHECK_SHELL_FEATURES], # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" @@ -13684,7 +15838,7 @@ index e993b621ac2..7715af647f4 100644 && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes -@@ -7224,206 +7668,162 @@ _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl +@@ -7256,206 +7695,162 @@ _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES @@ -19318,10 +21472,10 @@ index bf92b5e0790..c573da90c5c 100644 # These exist entirely to fool aclocal when bootstrapping libtool. # diff --git a/opcodes/configure b/opcodes/configure -index dca94db9c3f..26dcc4b82dd 100755 +index 7937529508c..9d4248ca464 100755 --- a/opcodes/configure +++ b/opcodes/configure -@@ -680,6 +680,9 @@ OTOOL +@@ -682,6 +682,9 @@ OTOOL LIPO NMEDIT DSYMUTIL @@ -19331,15 +21485,15 @@ index dca94db9c3f..26dcc4b82dd 100755 OBJDUMP LN_S NM -@@ -798,6 +801,7 @@ enable_static +@@ -800,6 +803,7 @@ enable_static with_pic enable_fast_install with_gnu_ld +with_libtool_sysroot enable_libtool_lock + enable_checking enable_targets - enable_werror -@@ -1462,6 +1466,8 @@ Optional Packages: +@@ -1468,6 +1472,8 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] @@ -19348,7 +21502,7 @@ index dca94db9c3f..26dcc4b82dd 100755 Some influential environment variables: CC C compiler command -@@ -5403,8 +5409,8 @@ esac +@@ -4977,8 +4983,8 @@ esac @@ -19359,7 +21513,7 @@ index dca94db9c3f..26dcc4b82dd 100755 -@@ -5444,7 +5450,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO +@@ -5018,7 +5024,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. @@ -19368,7 +21522,7 @@ index dca94db9c3f..26dcc4b82dd 100755 test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then -@@ -6130,8 +6136,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; +@@ -5705,8 +5711,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" @@ -19379,7 +21533,7 @@ index dca94db9c3f..26dcc4b82dd 100755 && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes -@@ -6180,6 +6186,80 @@ esac +@@ -5755,6 +5761,80 @@ esac @@ -19460,7 +21614,7 @@ index dca94db9c3f..26dcc4b82dd 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : -@@ -6196,6 +6276,11 @@ case $reload_flag in +@@ -5771,6 +5851,11 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in @@ -19472,7 +21626,7 @@ index dca94db9c3f..26dcc4b82dd 100755 darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' -@@ -6364,7 +6449,8 @@ mingw* | pw32*) +@@ -5939,7 +6024,8 @@ mingw* | pw32*) lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else @@ -19482,7 +21636,7 @@ index dca94db9c3f..26dcc4b82dd 100755 lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -@@ -6518,6 +6604,21 @@ esac +@@ -6093,6 +6179,21 @@ esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } @@ -19504,7 +21658,7 @@ index dca94db9c3f..26dcc4b82dd 100755 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown -@@ -6531,11 +6632,164 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown +@@ -6108,6 +6209,157 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -19518,11 +21672,7 @@ index dca94db9c3f..26dcc4b82dd 100755 + + + - - - if test -n "$ac_tool_prefix"; then -- # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. --set dummy ${ac_tool_prefix}ar; ac_word=$2 ++if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -19663,7 +21813,15 @@ index dca94db9c3f..26dcc4b82dd 100755 + + + -+if test -n "$ac_tool_prefix"; then + plugin_option= + plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll" + for plugin in $plugin_names; do +@@ -6122,8 +6374,10 @@ for plugin in $plugin_names; do + done + + if test -n "$ac_tool_prefix"; then +- # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +-set dummy ${ac_tool_prefix}ar; ac_word=$2 + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. @@ -19671,7 +21829,7 @@ index dca94db9c3f..26dcc4b82dd 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : -@@ -6551,7 +6805,7 @@ do +@@ -6139,7 +6393,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then @@ -19680,7 +21838,7 @@ index dca94db9c3f..26dcc4b82dd 100755 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi -@@ -6571,11 +6825,15 @@ $as_echo "no" >&6; } +@@ -6159,11 +6413,15 @@ $as_echo "no" >&6; } fi @@ -19699,7 +21857,7 @@ index dca94db9c3f..26dcc4b82dd 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : -@@ -6591,7 +6849,7 @@ do +@@ -6179,7 +6437,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then @@ -19708,7 +21866,7 @@ index dca94db9c3f..26dcc4b82dd 100755 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi -@@ -6610,6 +6868,10 @@ else +@@ -6198,6 +6456,10 @@ else $as_echo "no" >&6; } fi @@ -19719,7 +21877,7 @@ index dca94db9c3f..26dcc4b82dd 100755 if test "x$ac_ct_AR" = x; then AR="false" else -@@ -6621,16 +6883,72 @@ ac_tool_warned=yes ;; +@@ -6209,25 +6471,20 @@ ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi @@ -19728,20 +21886,37 @@ index dca94db9c3f..26dcc4b82dd 100755 fi -test -z "$AR" && AR=ar +-if test -n "$plugin_option"; then +- if $AR --help 2>&1 | grep -q "\--plugin"; then +- touch conftest.c +- $AR $plugin_option rc conftest.a conftest.c +- if test "$?" != 0; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 ++ touch conftest.c ++ $AR $plugin_option rc conftest.a conftest.c ++ if test "$?" != 0; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 + $as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;} +- else +- AR="$AR $plugin_option" +- fi +- rm -f conftest.* ++ else ++ AR="$AR $plugin_option" + fi +-fi -test -z "$AR_FLAGS" && AR_FLAGS=cru ++ rm -f conftest.* +: ${AR=ar} +: ${AR_FLAGS=cru} + -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ + + + +@@ -6238,6 +6495,63 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : @@ -19754,7 +21929,7 @@ index dca94db9c3f..26dcc4b82dd 100755 +int +main () +{ - ++ + ; + return 0; +} @@ -19780,23 +21955,29 @@ index dca94db9c3f..26dcc4b82dd 100755 + fi + fi + rm -f conftest.* libconftest.a - ++ +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ++ +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } - ++ +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi ++ ++ ++ ++ ++ ++ - - -@@ -6972,8 +7290,8 @@ esac + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +@@ -6578,8 +6892,8 @@ esac lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address @@ -19807,7 +21988,7 @@ index dca94db9c3f..26dcc4b82dd 100755 # Handle CRLF in mingw tool chain opt_cr= -@@ -7009,6 +7327,7 @@ for ac_symprfx in "" "_"; do +@@ -6615,6 +6929,7 @@ for ac_symprfx in "" "_"; do else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi @@ -19815,7 +21996,7 @@ index dca94db9c3f..26dcc4b82dd 100755 # Check to see that the pipe works correctly. pipe_works=no -@@ -7050,6 +7369,18 @@ _LT_EOF +@@ -6656,6 +6971,18 @@ _LT_EOF if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext @@ -19834,7 +22015,7 @@ index dca94db9c3f..26dcc4b82dd 100755 #ifdef __cplusplus extern "C" { #endif -@@ -7061,7 +7392,7 @@ _LT_EOF +@@ -6667,7 +6994,7 @@ _LT_EOF cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ @@ -19843,7 +22024,7 @@ index dca94db9c3f..26dcc4b82dd 100755 const char *name; void *address; } -@@ -7087,8 +7418,8 @@ static const void *lt_preloaded_setup() { +@@ -6693,8 +7020,8 @@ static const void *lt_preloaded_setup() { _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext @@ -19854,7 +22035,7 @@ index dca94db9c3f..26dcc4b82dd 100755 LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 -@@ -7098,8 +7429,8 @@ _LT_EOF +@@ -6704,8 +7031,8 @@ _LT_EOF test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi @@ -19865,7 +22046,7 @@ index dca94db9c3f..26dcc4b82dd 100755 else echo "cannot find nm_test_func in $nlist" >&5 fi -@@ -7136,6 +7467,16 @@ else +@@ -6742,6 +7069,14 @@ else $as_echo "ok" >&6; } fi @@ -19877,12 +22058,10 @@ index dca94db9c3f..26dcc4b82dd 100755 +fi + + -+ -+ -@@ -7152,6 +7493,45 @@ fi +@@ -6760,6 +7095,47 @@ fi @@ -19925,10 +22104,12 @@ index dca94db9c3f..26dcc4b82dd 100755 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } ++ ++ -@@ -7363,6 +7743,123 @@ esac +@@ -6969,6 +7345,123 @@ esac need_locks="$enable_libtool_lock" @@ -20052,7 +22233,7 @@ index dca94db9c3f..26dcc4b82dd 100755 case $host_os in rhapsody* | darwin*) -@@ -7926,6 +8423,8 @@ _LT_EOF +@@ -7532,6 +8025,8 @@ _LT_EOF $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 @@ -20061,26 +22242,7 @@ index dca94db9c3f..26dcc4b82dd 100755 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF -@@ -8091,7 +8590,8 @@ fi - LIBTOOL_DEPS="$ltmain" - - # Always use our own libtool. --LIBTOOL='$(SHELL) $(top_builddir)/libtool' -+LIBTOOL='$(SHELL) $(top_builddir)' -+LIBTOOL="$LIBTOOL/${host_alias}-libtool" - - - -@@ -8180,7 +8680,7 @@ aix3*) - esac - - # Global variables: --ofile=libtool -+ofile=${host_alias}-libtool - can_build_shared=yes - - # All known linkers require a `.a' archive for static linking (except MSVC, -@@ -8478,8 +8978,6 @@ fi +@@ -8084,8 +8579,6 @@ fi lt_prog_compiler_pic= lt_prog_compiler_static= @@ -20089,7 +22251,7 @@ index dca94db9c3f..26dcc4b82dd 100755 if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' -@@ -8645,6 +9143,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -8251,6 +8744,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; @@ -20102,7 +22264,7 @@ index dca94db9c3f..26dcc4b82dd 100755 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) -@@ -8707,7 +9211,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -8313,7 +8812,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in @@ -20111,7 +22273,7 @@ index dca94db9c3f..26dcc4b82dd 100755 lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; -@@ -8764,13 +9268,17 @@ case $host_os in +@@ -8370,13 +8869,17 @@ case $host_os in lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac @@ -20135,7 +22297,7 @@ index dca94db9c3f..26dcc4b82dd 100755 # # Check to make sure the PIC flag actually works. -@@ -8831,6 +9339,11 @@ fi +@@ -8437,6 +8940,11 @@ fi @@ -20147,7 +22309,7 @@ index dca94db9c3f..26dcc4b82dd 100755 # # Check to make sure the static flag actually works. # -@@ -9181,7 +9694,8 @@ _LT_EOF +@@ -8787,7 +9295,8 @@ _LT_EOF allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes @@ -20157,7 +22319,7 @@ index dca94db9c3f..26dcc4b82dd 100755 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' -@@ -9280,12 +9794,12 @@ _LT_EOF +@@ -8886,12 +9395,12 @@ _LT_EOF whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' @@ -20172,7 +22334,7 @@ index dca94db9c3f..26dcc4b82dd 100755 fi ;; esac -@@ -9299,8 +9813,8 @@ _LT_EOF +@@ -8905,8 +9414,8 @@ _LT_EOF archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else @@ -20183,7 +22345,7 @@ index dca94db9c3f..26dcc4b82dd 100755 fi ;; -@@ -9318,8 +9832,8 @@ _LT_EOF +@@ -8924,8 +9433,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then @@ -20194,7 +22356,7 @@ index dca94db9c3f..26dcc4b82dd 100755 else ld_shlibs=no fi -@@ -9365,8 +9879,8 @@ _LT_EOF +@@ -8971,8 +9480,8 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then @@ -20205,7 +22367,7 @@ index dca94db9c3f..26dcc4b82dd 100755 else ld_shlibs=no fi -@@ -9496,7 +10010,13 @@ _LT_EOF +@@ -9102,7 +9611,13 @@ _LT_EOF allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. @@ -20220,7 +22382,7 @@ index dca94db9c3f..26dcc4b82dd 100755 /* end confdefs.h. */ int -@@ -9509,22 +10029,29 @@ main () +@@ -9115,22 +9630,29 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : @@ -20263,7 +22425,7 @@ index dca94db9c3f..26dcc4b82dd 100755 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" 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" -@@ -9536,7 +10063,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9142,7 +9664,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else # Determine the default libpath from the value encoded in an # empty executable. @@ -20278,7 +22440,7 @@ index dca94db9c3f..26dcc4b82dd 100755 /* end confdefs.h. */ int -@@ -9549,22 +10082,29 @@ main () +@@ -9155,22 +9683,29 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : @@ -20321,7 +22483,7 @@ index dca94db9c3f..26dcc4b82dd 100755 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, -@@ -9609,20 +10149,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9215,20 +9750,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. @@ -20399,7 +22561,7 @@ index dca94db9c3f..26dcc4b82dd 100755 ;; darwin* | rhapsody*) -@@ -9683,7 +10266,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9289,7 +9867,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) @@ -20408,7 +22570,7 @@ index dca94db9c3f..26dcc4b82dd 100755 hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no -@@ -9691,7 +10274,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9297,7 +9875,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux9*) if test "$GCC" = yes; then @@ -20417,7 +22579,7 @@ index dca94db9c3f..26dcc4b82dd 100755 else 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' fi -@@ -9707,7 +10290,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9313,7 +9891,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then @@ -20426,7 +22588,7 @@ index dca94db9c3f..26dcc4b82dd 100755 else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi -@@ -9731,10 +10314,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -9337,10 +9915,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) @@ -20439,7 +22601,7 @@ index dca94db9c3f..26dcc4b82dd 100755 ;; esac else -@@ -9813,23 +10396,36 @@ fi +@@ -9419,23 +9997,36 @@ fi irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then @@ -20484,7 +22646,7 @@ index dca94db9c3f..26dcc4b82dd 100755 else 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' 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' -@@ -9914,7 +10510,7 @@ rm -f core conftest.err conftest.$ac_objext \ +@@ -9520,7 +10111,7 @@ rm -f core conftest.err conftest.$ac_objext \ osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' @@ -20493,7 +22655,7 @@ index dca94db9c3f..26dcc4b82dd 100755 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' -@@ -9933,9 +10529,9 @@ rm -f core conftest.err conftest.$ac_objext \ +@@ -9539,9 +10130,9 @@ rm -f core conftest.err conftest.$ac_objext \ no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' @@ -20505,7 +22667,7 @@ index dca94db9c3f..26dcc4b82dd 100755 else case `$CC -V 2>&1` in *"Compilers 5.0"*) -@@ -10511,8 +11107,9 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -10117,8 +10708,9 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no @@ -20517,7 +22679,7 @@ index dca94db9c3f..26dcc4b82dd 100755 library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ -@@ -10545,13 +11142,71 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -10151,13 +10743,71 @@ cygwin* | mingw* | pw32* | cegcc*) library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac @@ -20590,25 +22752,16 @@ index dca94db9c3f..26dcc4b82dd 100755 # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; -@@ -10633,7 +11288,7 @@ haiku*) - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes -- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' -+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -@@ -11429,7 +12084,7 @@ else +@@ -11035,7 +11685,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF --#line 11432 "configure" +-#line 11038 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H -@@ -11473,10 +12128,10 @@ else +@@ -11079,10 +11729,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) @@ -20621,16 +22774,16 @@ index dca94db9c3f..26dcc4b82dd 100755 int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); -@@ -11535,7 +12190,7 @@ else +@@ -11141,7 +11791,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF --#line 11538 "configure" +-#line 11144 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H -@@ -11579,10 +12234,10 @@ else +@@ -11185,10 +11835,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) @@ -20643,7 +22796,7 @@ index dca94db9c3f..26dcc4b82dd 100755 int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); -@@ -13746,13 +14401,20 @@ exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +@@ -13391,13 +14041,20 @@ exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' @@ -20664,7 +22817,7 @@ index dca94db9c3f..26dcc4b82dd 100755 STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' -@@ -13767,14 +14429,17 @@ lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$de +@@ -13412,14 +14069,17 @@ lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$de lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' 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"`' @@ -20683,7 +22836,7 @@ index dca94db9c3f..26dcc4b82dd 100755 DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' -@@ -13807,12 +14472,12 @@ hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_q +@@ -13452,12 +14112,12 @@ hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_q hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' @@ -20697,7 +22850,7 @@ index dca94db9c3f..26dcc4b82dd 100755 file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' -@@ -13867,8 +14532,13 @@ reload_flag \ +@@ -13512,8 +14172,13 @@ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ @@ -20711,7 +22864,7 @@ index dca94db9c3f..26dcc4b82dd 100755 STRIP \ RANLIB \ CC \ -@@ -13878,12 +14548,14 @@ lt_cv_sys_global_symbol_pipe \ +@@ -13523,12 +14188,14 @@ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ @@ -20727,7 +22880,7 @@ index dca94db9c3f..26dcc4b82dd 100755 DSYMUTIL \ NMEDIT \ LIPO \ -@@ -13899,7 +14571,6 @@ no_undefined_flag \ +@@ -13544,7 +14211,6 @@ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ @@ -20735,7 +22888,7 @@ index dca94db9c3f..26dcc4b82dd 100755 exclude_expsyms \ include_expsyms \ file_list_spec \ -@@ -13935,6 +14606,7 @@ module_cmds \ +@@ -13580,6 +14246,7 @@ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ @@ -20743,7 +22896,7 @@ index dca94db9c3f..26dcc4b82dd 100755 postinstall_cmds \ postuninstall_cmds \ finish_cmds \ -@@ -14700,7 +15372,8 @@ $as_echo X"$file" | +@@ -14345,7 +15012,8 @@ $as_echo X"$file" | # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, @@ -20753,7 +22906,7 @@ index dca94db9c3f..26dcc4b82dd 100755 # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. -@@ -14803,19 +15476,42 @@ SP2NL=$lt_lt_SP2NL +@@ -14448,19 +15116,42 @@ SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP @@ -20797,7 +22950,7 @@ index dca94db9c3f..26dcc4b82dd 100755 # A symbol stripping program. STRIP=$lt_STRIP -@@ -14845,6 +15541,12 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address +@@ -14490,6 +15181,12 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix @@ -20810,7 +22963,7 @@ index dca94db9c3f..26dcc4b82dd 100755 # The name of the directory that contains temporary libtool files. objdir=$objdir -@@ -14854,6 +15556,9 @@ MAGIC_CMD=$MAGIC_CMD +@@ -14499,6 +15196,9 @@ MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks @@ -20820,7 +22973,7 @@ index dca94db9c3f..26dcc4b82dd 100755 # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL -@@ -14968,12 +15673,12 @@ with_gcc=$GCC +@@ -14613,12 +15313,12 @@ with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag @@ -20836,7 +22989,7 @@ index dca94db9c3f..26dcc4b82dd 100755 # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static -@@ -15060,9 +15765,6 @@ inherit_rpath=$inherit_rpath +@@ -14705,9 +15405,6 @@ inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs @@ -20846,7 +22999,7 @@ index dca94db9c3f..26dcc4b82dd 100755 # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols -@@ -15078,6 +15780,9 @@ include_expsyms=$lt_include_expsyms +@@ -14723,6 +15420,9 @@ include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds @@ -20856,7 +23009,7 @@ index dca94db9c3f..26dcc4b82dd 100755 # Specify filename containing input files. file_list_spec=$lt_file_list_spec -@@ -15110,210 +15815,169 @@ ltmain="$ac_aux_dir/ltmain.sh" +@@ -14755,210 +15455,169 @@ ltmain="$ac_aux_dir/ltmain.sh" # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? @@ -21231,7 +23384,7 @@ index dca94db9c3f..26dcc4b82dd 100755 chmod +x "$ofile" diff --git a/zlib/configure b/zlib/configure -index b124acf9259..e4075ef3a2c 100755 +index db7845c5d42..cd59daa39b5 100755 --- a/zlib/configure +++ b/zlib/configure @@ -646,8 +646,11 @@ OTOOL @@ -21263,7 +23416,7 @@ index b124acf9259..e4075ef3a2c 100755 Some influential environment variables: CC C compiler command -@@ -4147,8 +4153,8 @@ esac +@@ -4186,8 +4192,8 @@ esac @@ -21274,7 +23427,7 @@ index b124acf9259..e4075ef3a2c 100755 -@@ -4188,7 +4194,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO +@@ -4227,7 +4233,7 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. @@ -21283,7 +23436,7 @@ index b124acf9259..e4075ef3a2c 100755 test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then -@@ -5004,8 +5010,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; +@@ -5044,8 +5050,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" @@ -21294,7 +23447,7 @@ index b124acf9259..e4075ef3a2c 100755 && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes -@@ -5054,6 +5060,80 @@ esac +@@ -5094,6 +5100,80 @@ esac @@ -21375,7 +23528,7 @@ index b124acf9259..e4075ef3a2c 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : -@@ -5070,6 +5150,11 @@ case $reload_flag in +@@ -5110,6 +5190,11 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in @@ -21387,7 +23540,7 @@ index b124acf9259..e4075ef3a2c 100755 darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' -@@ -5238,7 +5323,8 @@ mingw* | pw32*) +@@ -5278,7 +5363,8 @@ mingw* | pw32*) lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else @@ -21397,7 +23550,7 @@ index b124acf9259..e4075ef3a2c 100755 lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -@@ -5392,6 +5478,21 @@ esac +@@ -5432,6 +5518,21 @@ esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } @@ -21419,7 +23572,7 @@ index b124acf9259..e4075ef3a2c 100755 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown -@@ -5405,11 +5506,165 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown +@@ -5447,6 +5548,158 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -21433,11 +23586,7 @@ index b124acf9259..e4075ef3a2c 100755 + + + - - - if test -n "$ac_tool_prefix"; then -- # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. --set dummy ${ac_tool_prefix}ar; ac_word=$2 ++if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -21579,7 +23728,15 @@ index b124acf9259..e4075ef3a2c 100755 + + + -+if test -n "$ac_tool_prefix"; then + plugin_option= + plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll" + for plugin in $plugin_names; do +@@ -5461,8 +5714,10 @@ for plugin in $plugin_names; do + done + + if test -n "$ac_tool_prefix"; then +- # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +-set dummy ${ac_tool_prefix}ar; ac_word=$2 + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. @@ -21587,7 +23744,7 @@ index b124acf9259..e4075ef3a2c 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : -@@ -5425,7 +5680,7 @@ do +@@ -5478,7 +5733,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then @@ -21596,7 +23753,7 @@ index b124acf9259..e4075ef3a2c 100755 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi -@@ -5445,11 +5700,15 @@ $as_echo "no" >&6; } +@@ -5498,11 +5753,15 @@ $as_echo "no" >&6; } fi @@ -21615,7 +23772,7 @@ index b124acf9259..e4075ef3a2c 100755 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : -@@ -5465,7 +5724,7 @@ do +@@ -5518,7 +5777,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then @@ -21624,7 +23781,7 @@ index b124acf9259..e4075ef3a2c 100755 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi -@@ -5484,6 +5743,10 @@ else +@@ -5537,6 +5796,10 @@ else $as_echo "no" >&6; } fi @@ -21635,7 +23792,7 @@ index b124acf9259..e4075ef3a2c 100755 if test "x$ac_ct_AR" = x; then AR="false" else -@@ -5495,16 +5758,72 @@ ac_tool_warned=yes ;; +@@ -5548,25 +5811,19 @@ ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi @@ -21644,20 +23801,36 @@ index b124acf9259..e4075ef3a2c 100755 fi -test -z "$AR" && AR=ar +-if test -n "$plugin_option"; then +- if $AR --help 2>&1 | grep -q "\--plugin"; then +- touch conftest.c +- $AR $plugin_option rc conftest.a conftest.c +- if test "$?" != 0; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 ++ touch conftest.c ++ $AR $plugin_option rc conftest.a conftest.c ++ if test "$?" != 0; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 + $as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;} +- else +- AR="$AR $plugin_option" +- fi +- rm -f conftest.* ++ else ++ AR="$AR $plugin_option" + fi +-fi -test -z "$AR_FLAGS" && AR_FLAGS=cru ++ rm -f conftest.* +: ${AR=ar} +: ${AR_FLAGS=cru} -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ + + + +@@ -5578,6 +5835,64 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : @@ -21670,7 +23843,7 @@ index b124acf9259..e4075ef3a2c 100755 +int +main () +{ - ++ + ; + return 0; +} @@ -21696,23 +23869,30 @@ index b124acf9259..e4075ef3a2c 100755 + fi + fi + rm -f conftest.* libconftest.a - ++ +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ++ +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } - ++ +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi - - - -@@ -5846,8 +6165,8 @@ esac ++ ++ ++ ++ ++ ++ ++ + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. + set dummy ${ac_tool_prefix}strip; ac_word=$2 +@@ -5917,8 +6232,8 @@ esac lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address @@ -21723,7 +23903,7 @@ index b124acf9259..e4075ef3a2c 100755 # Handle CRLF in mingw tool chain opt_cr= -@@ -5883,6 +6202,7 @@ for ac_symprfx in "" "_"; do +@@ -5954,6 +6269,7 @@ for ac_symprfx in "" "_"; do else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi @@ -21731,7 +23911,7 @@ index b124acf9259..e4075ef3a2c 100755 # Check to see that the pipe works correctly. pipe_works=no -@@ -5924,6 +6244,18 @@ _LT_EOF +@@ -5995,6 +6311,18 @@ _LT_EOF if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext @@ -21750,7 +23930,7 @@ index b124acf9259..e4075ef3a2c 100755 #ifdef __cplusplus extern "C" { #endif -@@ -5935,7 +6267,7 @@ _LT_EOF +@@ -6006,7 +6334,7 @@ _LT_EOF cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ @@ -21759,7 +23939,7 @@ index b124acf9259..e4075ef3a2c 100755 const char *name; void *address; } -@@ -5961,8 +6293,8 @@ static const void *lt_preloaded_setup() { +@@ -6032,8 +6360,8 @@ static const void *lt_preloaded_setup() { _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext @@ -21770,7 +23950,7 @@ index b124acf9259..e4075ef3a2c 100755 LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 -@@ -5972,8 +6304,8 @@ _LT_EOF +@@ -6043,8 +6371,8 @@ _LT_EOF test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi @@ -21781,7 +23961,7 @@ index b124acf9259..e4075ef3a2c 100755 else echo "cannot find nm_test_func in $nlist" >&5 fi -@@ -6010,6 +6342,19 @@ else +@@ -6081,6 +6409,17 @@ else $as_echo "ok" >&6; } fi @@ -21796,15 +23976,15 @@ index b124acf9259..e4075ef3a2c 100755 + + + -+ -+ -@@ -6027,6 +6372,41 @@ fi +@@ -6098,6 +6437,43 @@ fi ++ ++ + + + @@ -21843,7 +24023,7 @@ index b124acf9259..e4075ef3a2c 100755 -@@ -6241,6 +6621,123 @@ esac +@@ -6312,6 +6688,123 @@ esac need_locks="$enable_libtool_lock" @@ -21967,7 +24147,7 @@ index b124acf9259..e4075ef3a2c 100755 case $host_os in rhapsody* | darwin*) -@@ -6807,6 +7304,8 @@ _LT_EOF +@@ -6878,6 +7371,8 @@ _LT_EOF $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 @@ -21976,26 +24156,7 @@ index b124acf9259..e4075ef3a2c 100755 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF -@@ -7269,7 +7768,8 @@ fi - LIBTOOL_DEPS="$ltmain" - - # Always use our own libtool. --LIBTOOL='$(SHELL) $(top_builddir)/libtool' -+LIBTOOL='$(SHELL) $(top_builddir)' -+LIBTOOL="$LIBTOOL/${host_alias}-libtool" - - - -@@ -7358,7 +7858,7 @@ aix3*) - esac - - # Global variables: --ofile=libtool -+ofile=${host_alias}-libtool - can_build_shared=yes - - # All known linkers require a `.a' archive for static linking (except MSVC, -@@ -7656,8 +8156,6 @@ fi +@@ -7727,8 +8222,6 @@ fi lt_prog_compiler_pic= lt_prog_compiler_static= @@ -22004,7 +24165,7 @@ index b124acf9259..e4075ef3a2c 100755 if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' -@@ -7823,6 +8321,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -7894,6 +8387,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; @@ -22017,7 +24178,7 @@ index b124acf9259..e4075ef3a2c 100755 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) -@@ -7885,7 +8389,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } +@@ -7956,7 +8455,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in @@ -22026,7 +24187,7 @@ index b124acf9259..e4075ef3a2c 100755 lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; -@@ -7942,13 +8446,17 @@ case $host_os in +@@ -8013,13 +8512,17 @@ case $host_os in lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac @@ -22050,7 +24211,7 @@ index b124acf9259..e4075ef3a2c 100755 # # Check to make sure the PIC flag actually works. -@@ -8009,6 +8517,11 @@ fi +@@ -8080,6 +8583,11 @@ fi @@ -22062,7 +24223,7 @@ index b124acf9259..e4075ef3a2c 100755 # # Check to make sure the static flag actually works. # -@@ -8359,7 +8872,8 @@ _LT_EOF +@@ -8430,7 +8938,8 @@ _LT_EOF allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes @@ -22072,7 +24233,7 @@ index b124acf9259..e4075ef3a2c 100755 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' -@@ -8458,12 +8972,12 @@ _LT_EOF +@@ -8529,12 +9038,12 @@ _LT_EOF whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' @@ -22087,7 +24248,7 @@ index b124acf9259..e4075ef3a2c 100755 fi ;; esac -@@ -8477,8 +8991,8 @@ _LT_EOF +@@ -8548,8 +9057,8 @@ _LT_EOF archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else @@ -22098,7 +24259,7 @@ index b124acf9259..e4075ef3a2c 100755 fi ;; -@@ -8496,8 +9010,8 @@ _LT_EOF +@@ -8567,8 +9076,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then @@ -22109,7 +24270,7 @@ index b124acf9259..e4075ef3a2c 100755 else ld_shlibs=no fi -@@ -8543,8 +9057,8 @@ _LT_EOF +@@ -8614,8 +9123,8 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then @@ -22120,7 +24281,7 @@ index b124acf9259..e4075ef3a2c 100755 else ld_shlibs=no fi -@@ -8674,7 +9188,13 @@ _LT_EOF +@@ -8745,7 +9254,13 @@ _LT_EOF allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. @@ -22135,7 +24296,7 @@ index b124acf9259..e4075ef3a2c 100755 as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext -@@ -8690,22 +9210,29 @@ main () +@@ -8761,22 +9276,29 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : @@ -22178,7 +24339,7 @@ index b124acf9259..e4075ef3a2c 100755 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" 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" -@@ -8717,7 +9244,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -8788,7 +9310,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else # Determine the default libpath from the value encoded in an # empty executable. @@ -22193,7 +24354,7 @@ index b124acf9259..e4075ef3a2c 100755 as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext -@@ -8733,22 +9266,29 @@ main () +@@ -8804,22 +9332,29 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : @@ -22236,7 +24397,7 @@ index b124acf9259..e4075ef3a2c 100755 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, -@@ -8793,20 +9333,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -8864,20 +9399,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. @@ -22314,7 +24475,7 @@ index b124acf9259..e4075ef3a2c 100755 ;; darwin* | rhapsody*) -@@ -8867,7 +9450,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -8938,7 +9516,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) @@ -22323,7 +24484,7 @@ index b124acf9259..e4075ef3a2c 100755 hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no -@@ -8875,7 +9458,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -8946,7 +9524,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux9*) if test "$GCC" = yes; then @@ -22332,7 +24493,7 @@ index b124acf9259..e4075ef3a2c 100755 else 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' fi -@@ -8891,7 +9474,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -8962,7 +9540,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then @@ -22341,7 +24502,7 @@ index b124acf9259..e4075ef3a2c 100755 else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi -@@ -8915,10 +9498,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +@@ -8986,10 +9564,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) @@ -22354,7 +24515,7 @@ index b124acf9259..e4075ef3a2c 100755 ;; esac else -@@ -8997,26 +9580,39 @@ fi +@@ -9068,26 +9646,39 @@ fi irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then @@ -22402,7 +24563,7 @@ index b124acf9259..e4075ef3a2c 100755 else 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' 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' -@@ -9101,7 +9697,7 @@ rm -f core conftest.err conftest.$ac_objext \ +@@ -9172,7 +9763,7 @@ rm -f core conftest.err conftest.$ac_objext \ osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' @@ -22411,7 +24572,7 @@ index b124acf9259..e4075ef3a2c 100755 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' -@@ -9120,9 +9716,9 @@ rm -f core conftest.err conftest.$ac_objext \ +@@ -9191,9 +9782,9 @@ rm -f core conftest.err conftest.$ac_objext \ no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' @@ -22423,7 +24584,7 @@ index b124acf9259..e4075ef3a2c 100755 else case `$CC -V 2>&1` in *"Compilers 5.0"*) -@@ -9698,8 +10294,9 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -9769,8 +10360,9 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no @@ -22435,7 +24596,7 @@ index b124acf9259..e4075ef3a2c 100755 library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ -@@ -9732,13 +10329,71 @@ cygwin* | mingw* | pw32* | cegcc*) +@@ -9803,13 +10395,71 @@ cygwin* | mingw* | pw32* | cegcc*) library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac @@ -22508,25 +24669,16 @@ index b124acf9259..e4075ef3a2c 100755 # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; -@@ -9820,7 +10475,7 @@ haiku*) - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes -- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' -+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -@@ -10634,7 +11289,7 @@ else +@@ -10705,7 +11355,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF --#line 10637 "configure" +-#line 10708 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H -@@ -10678,10 +11333,10 @@ else +@@ -10749,10 +11399,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) @@ -22539,16 +24691,16 @@ index b124acf9259..e4075ef3a2c 100755 int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); -@@ -10740,7 +11395,7 @@ else +@@ -10811,7 +11461,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF --#line 10743 "configure" +-#line 10814 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H -@@ -10784,10 +11439,10 @@ else +@@ -10855,10 +11505,10 @@ else /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) @@ -22561,7 +24713,7 @@ index b124acf9259..e4075ef3a2c 100755 int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); -@@ -12257,13 +12912,20 @@ exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +@@ -12328,13 +12978,20 @@ exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' @@ -22582,7 +24734,7 @@ index b124acf9259..e4075ef3a2c 100755 STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' -@@ -12278,14 +12940,17 @@ lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$de +@@ -12349,14 +13006,17 @@ lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$de lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' 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"`' @@ -22601,7 +24753,7 @@ index b124acf9259..e4075ef3a2c 100755 DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' -@@ -12318,12 +12983,12 @@ hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_q +@@ -12389,12 +13049,12 @@ hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_q hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' @@ -22615,7 +24767,7 @@ index b124acf9259..e4075ef3a2c 100755 file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' -@@ -12378,8 +13043,13 @@ reload_flag \ +@@ -12449,8 +13109,13 @@ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ @@ -22629,7 +24781,7 @@ index b124acf9259..e4075ef3a2c 100755 STRIP \ RANLIB \ CC \ -@@ -12389,12 +13059,14 @@ lt_cv_sys_global_symbol_pipe \ +@@ -12460,12 +13125,14 @@ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ @@ -22645,7 +24797,7 @@ index b124acf9259..e4075ef3a2c 100755 DSYMUTIL \ NMEDIT \ LIPO \ -@@ -12410,7 +13082,6 @@ no_undefined_flag \ +@@ -12481,7 +13148,6 @@ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ @@ -22653,7 +24805,7 @@ index b124acf9259..e4075ef3a2c 100755 exclude_expsyms \ include_expsyms \ file_list_spec \ -@@ -12446,6 +13117,7 @@ module_cmds \ +@@ -12517,6 +13183,7 @@ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ @@ -22661,7 +24813,7 @@ index b124acf9259..e4075ef3a2c 100755 postinstall_cmds \ postuninstall_cmds \ finish_cmds \ -@@ -13044,7 +13716,8 @@ $as_echo X"$file" | +@@ -13115,7 +13782,8 @@ $as_echo X"$file" | # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, @@ -22671,7 +24823,7 @@ index b124acf9259..e4075ef3a2c 100755 # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. -@@ -13147,19 +13820,42 @@ SP2NL=$lt_lt_SP2NL +@@ -13218,19 +13886,42 @@ SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP @@ -22715,7 +24867,7 @@ index b124acf9259..e4075ef3a2c 100755 # A symbol stripping program. STRIP=$lt_STRIP -@@ -13189,6 +13885,12 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address +@@ -13260,6 +13951,12 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix @@ -22728,7 +24880,7 @@ index b124acf9259..e4075ef3a2c 100755 # The name of the directory that contains temporary libtool files. objdir=$objdir -@@ -13198,6 +13900,9 @@ MAGIC_CMD=$MAGIC_CMD +@@ -13269,6 +13966,9 @@ MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks @@ -22738,7 +24890,7 @@ index b124acf9259..e4075ef3a2c 100755 # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL -@@ -13312,12 +14017,12 @@ with_gcc=$GCC +@@ -13383,12 +14083,12 @@ with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag @@ -22754,7 +24906,7 @@ index b124acf9259..e4075ef3a2c 100755 # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static -@@ -13404,9 +14109,6 @@ inherit_rpath=$inherit_rpath +@@ -13475,9 +14175,6 @@ inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs @@ -22764,7 +24916,7 @@ index b124acf9259..e4075ef3a2c 100755 # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols -@@ -13422,6 +14124,9 @@ include_expsyms=$lt_include_expsyms +@@ -13493,6 +14190,9 @@ include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds @@ -22774,7 +24926,7 @@ index b124acf9259..e4075ef3a2c 100755 # Specify filename containing input files. file_list_spec=$lt_file_list_spec -@@ -13454,210 +14159,169 @@ ltmain="$ac_aux_dir/ltmain.sh" +@@ -13525,210 +14225,169 @@ ltmain="$ac_aux_dir/ltmain.sh" # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? @@ -23148,3 +25300,6 @@ index b124acf9259..e4075ef3a2c 100755 (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" +-- +2.25.1 + diff --git a/recipes-devtools/binutils/binutils/0010-Add-support-for-Netlogic-XLP.patch b/recipes-devtools/binutils/binutils/0010-Add-support-for-Netlogic-XLP.patch deleted file mode 100644 index fe2d02f..0000000 --- a/recipes-devtools/binutils/binutils/0010-Add-support-for-Netlogic-XLP.patch +++ /dev/null @@ -1,406 +0,0 @@ -From c64a5ca02a55b748311032e2c7d9c4f87bd74c63 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sun, 14 Feb 2016 17:06:19 +0000 -Subject: [PATCH] Add support for Netlogic XLP - -Patch From: Nebu Philips - -Using the mipsisa64r2nlm target, add support for XLP from -Netlogic. Also, update vendor name to NLM wherever applicable. - -Use 0x00000080 for INSN_XLP, the value 0x00000040 has already been -assigned to INSN_OCTEON3 - -Upstream-Status: Pending - -Signed-off-by: Khem Raj -Signed-off-by: Baoshan Pang -Signed-off-by: Mark Hatle ---- - bfd/aoutx.h | 1 + - bfd/archures.c | 1 + - bfd/bfd-in2.h | 1 + - bfd/config.bfd | 5 +++++ - bfd/cpu-mips.c | 6 ++++-- - bfd/elfxx-mips.c | 8 ++++++++ - binutils/readelf.c | 1 + - gas/config/tc-mips.c | 4 +++- - gas/configure | 3 +++ - gas/configure.ac | 3 +++ - include/elf/mips.h | 1 + - include/opcode/mips.h | 6 ++++++ - ld/configure.tgt | 3 +++ - opcodes/mips-dis.c | 12 +++++------- - opcodes/mips-opc.c | 31 ++++++++++++++++++++----------- - 15 files changed, 65 insertions(+), 21 deletions(-) - -diff --git a/bfd/aoutx.h b/bfd/aoutx.h -index 8025b8c5241..cdcb7876896 100644 ---- a/bfd/aoutx.h -+++ b/bfd/aoutx.h -@@ -810,6 +810,7 @@ NAME (aout, machine_type) (enum bfd_architecture arch, - case bfd_mach_mipsisa64r6: - case bfd_mach_mips_sb1: - case bfd_mach_mips_xlr: -+ case bfd_mach_mips_xlp: - /* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc. */ - arch_flags = M_MIPS2; - break; -diff --git a/bfd/archures.c b/bfd/archures.c -index 8c1d32ca930..b4b2927ebc0 100644 ---- a/bfd/archures.c -+++ b/bfd/archures.c -@@ -185,6 +185,7 @@ DESCRIPTION - .#define bfd_mach_mips_octeon3 6503 - .#define bfd_mach_mips_xlr 887682 {* decimal 'XLR'. *} - .#define bfd_mach_mips_interaptiv_mr2 736550 {* decimal 'IA2'. *} -+.#define bfd_mach_mips_xlp 887680 {* decimal 'XLP'. *} - .#define bfd_mach_mipsisa32 32 - .#define bfd_mach_mipsisa32r2 33 - .#define bfd_mach_mipsisa32r3 34 -diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h -index 7eff85b7eaa..6c9eb12865e 100644 ---- a/bfd/bfd-in2.h -+++ b/bfd/bfd-in2.h -@@ -1590,6 +1590,7 @@ enum bfd_architecture - #define bfd_mach_mips_octeon3 6503 - #define bfd_mach_mips_xlr 887682 /* decimal 'XLR'. */ - #define bfd_mach_mips_interaptiv_mr2 736550 /* decimal 'IA2'. */ -+#define bfd_mach_mips_xlp 887680 /* decimal 'XLP'. */ - #define bfd_mach_mipsisa32 32 - #define bfd_mach_mipsisa32r2 33 - #define bfd_mach_mipsisa32r3 34 -diff --git a/bfd/config.bfd b/bfd/config.bfd -index 2caf492e172..e75417da4d8 100644 ---- a/bfd/config.bfd -+++ b/bfd/config.bfd -@@ -879,6 +879,11 @@ case "${targ}" in - targ_defvec=mips_elf32_le_vec - targ_selvecs="mips_elf32_be_vec mips_elf64_be_vec mips_elf64_le_vec" - ;; -+ mipsisa64*-*-elf*) -+ targ_defvec=mips_elf32_trad_be_vec -+ targ_selvecs="mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec" -+ want64=true -+ ;; - mips*-*-elf* | mips*-*-rtems* | mips*-*-windiss | mips*-*-none) - targ_defvec=mips_elf32_be_vec - targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec" -diff --git a/bfd/cpu-mips.c b/bfd/cpu-mips.c -index 5a944ceee81..c57d12ba3dd 100644 ---- a/bfd/cpu-mips.c -+++ b/bfd/cpu-mips.c -@@ -108,7 +108,8 @@ enum - I_mipsocteon3, - I_xlr, - I_interaptiv_mr2, -- I_micromips -+ I_micromips, -+ I_xlp - }; - - #define NN(index) (&arch_info_struct[(index) + 1]) -@@ -163,7 +164,8 @@ static const bfd_arch_info_type arch_info_struct[] = - N (64, 64, bfd_mach_mips_xlr, "mips:xlr", FALSE, NN(I_xlr)), - N (32, 32, bfd_mach_mips_interaptiv_mr2, "mips:interaptiv-mr2", FALSE, - NN(I_interaptiv_mr2)), -- N (64, 64, bfd_mach_mips_micromips, "mips:micromips", FALSE, NULL) -+ N (64, 64, bfd_mach_mips_micromips, "mips:micromips", FALSE, NN(I_micromips)), -+ N (64, 64, bfd_mach_mips_xlp, "mips:xlp", FALSE, NULL) - }; - - /* The default architecture is mips:3000, but with a machine number of -diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c -index 3cbb3cf9495..0c6cd47b40c 100644 ---- a/bfd/elfxx-mips.c -+++ b/bfd/elfxx-mips.c -@@ -6980,6 +6980,9 @@ _bfd_elf_mips_mach (flagword flags) - case E_MIPS_MACH_IAMR2: - return bfd_mach_mips_interaptiv_mr2; - -+ case E_MIPS_MACH_XLP: -+ return bfd_mach_mips_xlp; -+ - default: - switch (flags & EF_MIPS_ARCH) - { -@@ -12335,6 +12338,10 @@ mips_set_isa_flags (bfd *abfd) - val = E_MIPS_ARCH_64R2 | E_MIPS_MACH_OCTEON2; - break; - -+ case bfd_mach_mips_xlp: -+ val = E_MIPS_ARCH_64R2 | E_MIPS_MACH_XLP; -+ break; -+ - case bfd_mach_mipsisa32: - val = E_MIPS_ARCH_32; - break; -@@ -14352,6 +14359,7 @@ static const struct mips_mach_extension mips_mach_extensions[] = - { bfd_mach_mips_gs264e, bfd_mach_mips_gs464e }, - { bfd_mach_mips_gs464e, bfd_mach_mips_gs464 }, - { bfd_mach_mips_gs464, bfd_mach_mipsisa64r2 }, -+ { bfd_mach_mips_xlp, bfd_mach_mipsisa64r2 }, - - /* MIPS64 extensions. */ - { bfd_mach_mipsisa64r2, bfd_mach_mipsisa64 }, -diff --git a/binutils/readelf.c b/binutils/readelf.c -index ad16b4571c9..4bf2b732502 100644 ---- a/binutils/readelf.c -+++ b/binutils/readelf.c -@@ -3502,6 +3502,7 @@ get_machine_flags (Filedata * filedata, unsigned e_flags, unsigned e_machine) - case E_MIPS_MACH_OCTEON3: strcat (buf, ", octeon3"); break; - case E_MIPS_MACH_XLR: strcat (buf, ", xlr"); break; - case E_MIPS_MACH_IAMR2: strcat (buf, ", interaptiv-mr2"); break; -+ case E_MIPS_MACH_XLP: strcat (buf, ", xlp"); break; - case 0: - /* We simply ignore the field in this case to avoid confusion: - MIPS ELF does not specify EF_MIPS_MACH, it is a GNU -diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c -index 538b69710f5..b021b64f14b 100644 ---- a/gas/config/tc-mips.c -+++ b/gas/config/tc-mips.c -@@ -568,6 +568,7 @@ static int mips_32bitmode = 0; - || mips_opts.arch == CPU_RM7000 \ - || mips_opts.arch == CPU_VR5500 \ - || mips_opts.micromips \ -+ || mips_opts.arch == CPU_XLP \ - ) - - /* Whether the processor uses hardware interlocks to protect reads -@@ -597,6 +598,7 @@ static int mips_32bitmode = 0; - && mips_opts.isa != ISA_MIPS3) \ - || mips_opts.arch == CPU_R4300 \ - || mips_opts.micromips \ -+ || mips_opts.arch == CPU_XLP \ - ) - - /* Whether the processor uses hardware interlocks to protect reads -@@ -20156,7 +20158,7 @@ static const struct mips_cpu_info mips_cpu_info_table[] = - /* Broadcom XLP. - XLP is mostly like XLR, with the prominent exception that it is - MIPS64R2 rather than MIPS64. */ -- { "xlp", 0, 0, ISA_MIPS64R2, CPU_XLR }, -+ { "xlp", 0, 0, ISA_MIPS64R2, CPU_XLP }, - - /* MIPS 64 Release 6. */ - { "i6400", 0, ASE_VIRT | ASE_MSA, ISA_MIPS64R6, CPU_MIPS64R6}, -diff --git a/gas/configure b/gas/configure -index d03432c6dc6..d5ae54925e9 100755 ---- a/gas/configure -+++ b/gas/configure -@@ -12761,6 +12761,9 @@ _ACEOF - mipsisa64r6 | mipsisa64r6el) - mips_cpu=mips64r6 - ;; -+ mipsisa64r2nlm | mipsisa64r2nlmel) -+ mips_cpu=xlp -+ ;; - mipstx39 | mipstx39el) - mips_cpu=r3900 - ;; -diff --git a/gas/configure.ac b/gas/configure.ac -index 82706561886..f1c27bf2878 100644 ---- a/gas/configure.ac -+++ b/gas/configure.ac -@@ -332,6 +332,9 @@ changequote([,])dnl - mipsisa64r6 | mipsisa64r6el) - mips_cpu=mips64r6 - ;; -+ mipsisa64r2nlm | mipsisa64r2nlmel) -+ mips_cpu=xlp -+ ;; - mipstx39 | mipstx39el) - mips_cpu=r3900 - ;; -diff --git a/include/elf/mips.h b/include/elf/mips.h -index 4bd86307120..2d7df22abf2 100644 ---- a/include/elf/mips.h -+++ b/include/elf/mips.h -@@ -290,6 +290,7 @@ END_RELOC_NUMBERS (R_MIPS_maxext) - #define E_MIPS_MACH_SB1 0x008a0000 - #define E_MIPS_MACH_OCTEON 0x008b0000 - #define E_MIPS_MACH_XLR 0x008c0000 -+#define E_MIPS_MACH_XLP 0x008f0000 - #define E_MIPS_MACH_OCTEON2 0x008d0000 - #define E_MIPS_MACH_OCTEON3 0x008e0000 - #define E_MIPS_MACH_5400 0x00910000 -diff --git a/include/opcode/mips.h b/include/opcode/mips.h -index d1b4a2574ac..879c68fcfd4 100644 ---- a/include/opcode/mips.h -+++ b/include/opcode/mips.h -@@ -1260,6 +1260,8 @@ static const unsigned int mips_isa_table[] = { - #define INSN_XLR 0x00000020 - /* Imagination interAptiv MR2. */ - #define INSN_INTERAPTIV_MR2 0x04000000 -+/* Netlogic XlP instruction */ -+#define INSN_XLP 0x00000080 - - /* DSP ASE */ - #define ASE_DSP 0x00000001 -@@ -1384,6 +1386,7 @@ static const unsigned int mips_isa_table[] = { - #define CPU_OCTEON3 6503 - #define CPU_XLR 887682 /* decimal 'XLR' */ - #define CPU_INTERAPTIV_MR2 736550 /* decimal 'IA2' */ -+#define CPU_XLP 887680 /* decimal 'XLP' */ - - /* Return true if the given CPU is included in INSN_* mask MASK. */ - -@@ -1461,6 +1464,9 @@ cpu_is_member (int cpu, unsigned int mask) - return ((mask & INSN_ISA_MASK) == INSN_ISA32R6) - || ((mask & INSN_ISA_MASK) == INSN_ISA64R6); - -+ case CPU_XLP: -+ return (mask & INSN_XLP) != 0; -+ - default: - return FALSE; - } -diff --git a/ld/configure.tgt b/ld/configure.tgt -index 47431770a17..f714744eab3 100644 ---- a/ld/configure.tgt -+++ b/ld/configure.tgt -@@ -510,6 +510,9 @@ mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*) - targ_emul=elf32btsmip - targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip" - ;; -+mipsisa64*-*-elf*) targ_emul=elf32btsmip -+ targ_extra_emuls="elf32ltsmip elf64btsmip elf64ltsmip" -+ ;; - mips64*el-ps2-elf*) targ_emul=elf32lr5900n32 - targ_extra_emuls="elf32lr5900" - targ_extra_libpath=$targ_extra_emuls -diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c -index 317ced51204..6869f890656 100644 ---- a/opcodes/mips-dis.c -+++ b/opcodes/mips-dis.c -@@ -674,13 +674,11 @@ const struct mips_arch_choice mips_arch_choices[] = - mips_cp0sel_names_xlr, ARRAY_SIZE (mips_cp0sel_names_xlr), - mips_cp1_names_mips3264, mips_hwr_names_numeric }, - -- /* XLP is mostly like XLR, with the prominent exception it is being -- MIPS64R2. */ -- { "xlp", 1, bfd_mach_mips_xlr, CPU_XLR, -- ISA_MIPS64R2 | INSN_XLR, 0, -- mips_cp0_names_xlr, -- mips_cp0sel_names_xlr, ARRAY_SIZE (mips_cp0sel_names_xlr), -- mips_cp1_names_mips3264, mips_hwr_names_numeric }, -+ { "xlp", 1, bfd_mach_mips_xlp, CPU_XLP, -+ ISA_MIPS64R2 | INSN_XLP, 0, -+ mips_cp0_names_mips3264r2, -+ mips_cp0sel_names_mips3264r2, ARRAY_SIZE (mips_cp0sel_names_mips3264r2), -+ mips_cp1_names_mips3264, mips_hwr_names_mips3264r2 }, - - /* This entry, mips16, is here only for ISA/processor selection; do - not print its name. */ -diff --git a/opcodes/mips-opc.c b/opcodes/mips-opc.c -index b45eb40bf69..2f4eb5c0354 100644 ---- a/opcodes/mips-opc.c -+++ b/opcodes/mips-opc.c -@@ -328,6 +328,7 @@ decode_mips_operand (const char *p) - #define IOCT3 INSN_OCTEON3 - #define XLR INSN_XLR - #define IAMR2 INSN_INTERAPTIV_MR2 -+#define XLP INSN_XLP - #define IVIRT ASE_VIRT - #define IVIRT64 ASE_VIRT64 - -@@ -990,6 +991,7 @@ const struct mips_opcode mips_builtin_opcodes[] = - {"clo", "U,s", 0x70000021, 0xfc0007ff, WR_1|RD_2, 0, I32|N55, 0, I37 }, - {"clz", "d,s", 0x00000050, 0xfc1f07ff, WR_1|RD_2, 0, I37, 0, 0 }, - {"clz", "U,s", 0x70000020, 0xfc0007ff, WR_1|RD_2, 0, I32|N55, 0, I37 }, -+{"crc", "d,s,t", 0x7000001c, 0xfc0007ff, WR_1|RD_2|RD_3, 0, XLP, 0, 0 }, - /* ctc0 is at the bottom of the table. */ - {"ctc1", "t,G", 0x44c00000, 0xffe007ff, RD_1|WR_CC|CM, 0, I1, 0, 0 }, - {"ctc1", "t,S", 0x44c00000, 0xffe007ff, RD_1|WR_CC|CM, 0, I1, 0, 0 }, -@@ -1022,12 +1024,13 @@ const struct mips_opcode mips_builtin_opcodes[] = - {"daddiu", "t,r,j", 0x64000000, 0xfc000000, WR_1|RD_2, 0, I3, 0, 0 }, - {"daddu", "d,v,t", 0x0000002d, 0xfc0007ff, WR_1|RD_2|RD_3, 0, I3, 0, 0 }, - {"daddu", "t,r,I", 0, (int) M_DADDU_I, INSN_MACRO, 0, I3, 0, 0 }, --{"daddwc", "d,s,t", 0x70000038, 0xfc0007ff, WR_1|RD_2|RD_3|WR_C0|RD_C0, 0, XLR, 0, 0 }, -+{"daddwc", "d,s,t", 0x70000038, 0xfc0007ff, WR_1|RD_2|RD_3|WR_C0|RD_C0, 0, XLR|XLP, 0, 0 }, - {"dbreak", "", 0x7000003f, 0xffffffff, 0, 0, N5, 0, 0 }, - {"dclo", "d,s", 0x00000053, 0xfc1f07ff, WR_1|RD_2, 0, I69, 0, 0 }, - {"dclo", "U,s", 0x70000025, 0xfc0007ff, WR_1|RD_2, 0, I64|N55, 0, I69 }, - {"dclz", "d,s", 0x00000052, 0xfc1f07ff, WR_1|RD_2, 0, I69, 0, 0 }, - {"dclz", "U,s", 0x70000024, 0xfc0007ff, WR_1|RD_2, 0, I64|N55, 0, I69 }, -+{"dcrc", "d,s,t", 0x7000001d, 0xfc0007ff, WR_1|RD_2|RD_3, 0, XLP, 0, 0 }, - /* dctr and dctw are used on the r5000. */ - {"dctr", "o(b)", 0xbc050000, 0xfc1f0000, RD_2, 0, I3, 0, 0 }, - {"dctw", "o(b)", 0xbc090000, 0xfc1f0000, RD_2, 0, I3, 0, 0 }, -@@ -1099,6 +1102,7 @@ const struct mips_opcode mips_builtin_opcodes[] = - {"dmfc0", "t,G,H", 0x40200000, 0xffe007f8, WR_1|RD_C0|LC, 0, I64, 0, 0 }, - {"dmfgc0", "t,G", 0x40600100, 0xffe007ff, WR_1|RD_C0|LC, 0, 0, IVIRT64, 0 }, - {"dmfgc0", "t,G,H", 0x40600100, 0xffe007f8, WR_1|RD_C0|LC, 0, 0, IVIRT64, 0 }, -+{"dmfur", "t,d", 0x7000001e, 0xffe007ff, WR_1, 0, XLP, 0, 0 }, - {"dmt", "", 0x41600bc1, 0xffffffff, TRAP, 0, 0, MT32, 0 }, - {"dmt", "t", 0x41600bc1, 0xffe0ffff, WR_1|TRAP, 0, 0, MT32, 0 }, - {"dmtc0", "t,G", 0x40a00000, 0xffe007ff, RD_1|WR_C0|WR_CC|CM, 0, I3, 0, EE }, -@@ -1114,6 +1118,8 @@ const struct mips_opcode mips_builtin_opcodes[] = - /* dmfc3 is at the bottom of the table. */ - /* dmtc3 is at the bottom of the table. */ - {"dmuh", "d,s,t", 0x000000dc, 0xfc0007ff, WR_1|RD_2|RD_3, 0, I69, 0, 0 }, -+{"dmtur", "t,d", 0x7000001f, 0xffe007ff, RD_1, 0, XLP, 0, 0 }, -+{"dmul", "d,s,t", 0x70000006, 0xfc0007ff, WR_1|RD_2|RD_3, 0, XLP, 0, 0 }, - {"dmul", "d,s,t", 0x0000009c, 0xfc0007ff, WR_1|RD_2|RD_3, 0, I69, 0, 0 }, - {"dmul", "d,v,t", 0x70000003, 0xfc0007ff, WR_1|RD_2|RD_3|WR_HILO, 0, IOCT, 0, 0 }, - {"dmul", "d,v,t", 0, (int) M_DMUL, INSN_MACRO, 0, I3, 0, M32|I69 }, -@@ -1267,9 +1273,9 @@ const struct mips_opcode mips_builtin_opcodes[] = - {"ld", "s,-b(+R)", 0xec180000, 0xfc1c0000, WR_1, RD_pc, I69, 0, 0 }, - {"ld", "t,A(b)", 0, (int) M_LD_AB, INSN_MACRO, 0, I1, 0, 0 }, - {"ld", "t,o(b)", 0xdc000000, 0xfc000000, WR_1|RD_3|LM, 0, I3, 0, 0 }, --{"ldaddw", "t,b", 0x70000010, 0xfc00ffff, MOD_1|RD_2|LM|SM, 0, XLR, 0, 0 }, --{"ldaddwu", "t,b", 0x70000011, 0xfc00ffff, MOD_1|RD_2|LM|SM, 0, XLR, 0, 0 }, --{"ldaddd", "t,b", 0x70000012, 0xfc00ffff, MOD_1|RD_2|LM|SM, 0, XLR, 0, 0 }, -+{"ldaddw", "t,b", 0x70000010, 0xfc00ffff, MOD_1|RD_2|SM, 0, XLR|XLP, 0, 0 }, -+{"ldaddwu", "t,b", 0x70000011, 0xfc00ffff, MOD_1|RD_2|SM, 0, XLR|XLP, 0, 0 }, -+{"ldaddd", "t,b", 0x70000012, 0xfc00ffff, MOD_1|RD_2|SM, 0, XLR|XLP, 0, 0 }, - {"ldc1", "T,o(b)", 0xd4000000, 0xfc000000, WR_1|RD_3|CLD|FP_D, 0, I2, 0, SF }, - {"ldc1", "E,o(b)", 0xd4000000, 0xfc000000, WR_1|RD_3|CLD|FP_D, 0, I2, 0, SF }, - {"ldc1", "T,A(b)", 0, (int) M_LDC1_AB, INSN_MACRO, INSN2_M_FP_D, I2, 0, SF }, -@@ -1438,7 +1444,7 @@ const struct mips_opcode mips_builtin_opcodes[] = - {"mflo", "d,9", 0x00000012, 0xff9f07ff, WR_1|RD_LO, 0, 0, D32, 0 }, - {"mflo1", "d", 0x70000012, 0xffff07ff, WR_1|RD_LO, 0, EE, 0, 0 }, - {"mflhxu", "d", 0x00000052, 0xffff07ff, WR_1|MOD_HILO, 0, 0, SMT, 0 }, --{"mfcr", "t,s", 0x70000018, 0xfc00ffff, WR_1|RD_2, 0, XLR, 0, 0 }, -+{"mfcr", "t,s", 0x70000018, 0xfc00ffff, WR_1, 0, XLR|XLP, 0, 0 }, - {"mfsa", "d", 0x00000028, 0xffff07ff, WR_1, 0, EE, 0, 0 }, - {"min.ob", "X,Y,Q", 0x78000006, 0xfc20003f, WR_1|RD_2|RD_3|FP_D, 0, SB1, MX, 0 }, - {"min.ob", "D,S,Q", 0x48000006, 0xfc20003f, WR_1|RD_2|RD_3|FP_D, 0, N54, 0, 0 }, -@@ -1483,10 +1489,13 @@ const struct mips_opcode mips_builtin_opcodes[] = - /* move is at the top of the table. */ - {"msgn.qh", "X,Y,Q", 0x78200000, 0xfc20003f, WR_1|RD_2|RD_3|FP_D, 0, 0, MX, 0 }, - {"msgsnd", "t", 0, (int) M_MSGSND, INSN_MACRO, 0, XLR, 0, 0 }, -+{"msgsnds", "d,t", 0x4a000001, 0xffe007ff, WR_1|RD_2|RD_C0|WR_C0, 0, XLP, 0, 0 }, - {"msgld", "", 0, (int) M_MSGLD, INSN_MACRO, 0, XLR, 0, 0 }, - {"msgld", "t", 0, (int) M_MSGLD_T, INSN_MACRO, 0, XLR, 0, 0 }, --{"msgwait", "", 0, (int) M_MSGWAIT, INSN_MACRO, 0, XLR, 0, 0 }, --{"msgwait", "t", 0, (int) M_MSGWAIT_T,INSN_MACRO, 0, XLR, 0, 0 }, -+{"msglds", "d,t", 0x4a000002, 0xffe007ff, WR_1|RD_2|RD_C0|WR_C0, 0, XLP, 0, 0 }, -+{"msgwait", "", 0, (int) M_MSGWAIT, INSN_MACRO, 0, XLR|XLP, 0, 0 }, -+{"msgwait", "t", 0, (int) M_MSGWAIT_T,INSN_MACRO, 0, XLR|XLP, 0, 0 }, -+{"msgsync", "", 0x4a000004, 0xffffffff,0, 0, XLP, 0, 0 }, - {"msub.d", "D,R,S,T", 0x4c000029, 0xfc00003f, WR_1|RD_2|RD_3|RD_4|FP_D, 0, I4_33, 0, I37 }, - {"msub.d", "D,S,T", 0x46200019, 0xffe0003f, WR_1|RD_2|RD_3|FP_D, 0, IL2E, 0, 0 }, - {"msub.d", "D,S,T", 0x72200019, 0xffe0003f, WR_1|RD_2|RD_3|FP_D, 0, IL2F, 0, 0 }, -@@ -1536,7 +1545,7 @@ const struct mips_opcode mips_builtin_opcodes[] = - {"mtlo", "s,7", 0x00000013, 0xfc1fe7ff, RD_1|WR_LO, 0, 0, D32, 0 }, - {"mtlo1", "s", 0x70000013, 0xfc1fffff, RD_1|WR_LO, 0, EE, 0, 0 }, - {"mtlhx", "s", 0x00000053, 0xfc1fffff, RD_1|MOD_HILO, 0, 0, SMT, 0 }, --{"mtcr", "t,s", 0x70000019, 0xfc00ffff, RD_1|RD_2, 0, XLR, 0, 0 }, -+{"mtcr", "t,s", 0x70000019, 0xfc00ffff, RD_1, 0, XLR|XLP, 0, 0 }, - {"mtm0", "s", 0x70000008, 0xfc1fffff, RD_1, 0, IOCT, 0, 0 }, - {"mtm0", "s,t", 0x70000008, 0xfc00ffff, RD_1|RD_2, 0, IOCT3, 0, 0 }, - {"mtm1", "s", 0x7000000c, 0xfc1fffff, RD_1, 0, IOCT, 0, 0 }, -@@ -1978,9 +1987,9 @@ const struct mips_opcode mips_builtin_opcodes[] = - {"suxc1", "S,t(b)", 0x4c00000d, 0xfc0007ff, RD_1|RD_2|RD_3|SM|FP_D, 0, I5_33|N55, 0, I37}, - {"sw", "t,o(b)", 0xac000000, 0xfc000000, RD_1|RD_3|SM, 0, I1, 0, 0 }, - {"sw", "t,A(b)", 0, (int) M_SW_AB, INSN_MACRO, 0, I1, 0, 0 }, --{"swapw", "t,b", 0x70000014, 0xfc00ffff, MOD_1|RD_2|LM|SM, 0, XLR, 0, 0 }, --{"swapwu", "t,b", 0x70000015, 0xfc00ffff, MOD_1|RD_2|LM|SM, 0, XLR, 0, 0 }, --{"swapd", "t,b", 0x70000016, 0xfc00ffff, MOD_1|RD_2|LM|SM, 0, XLR, 0, 0 }, -+{"swapw", "t,b", 0x70000014, 0xfc00ffff, MOD_1|RD_2|SM, 0, XLR|XLP, 0, 0 }, -+{"swapwu", "t,b", 0x70000015, 0xfc00ffff, MOD_1|RD_2|SM, 0, XLR|XLP, 0, 0 }, -+{"swapd", "t,b", 0x70000016, 0xfc00ffff, MOD_1|RD_2|SM, 0, XLR|XLP, 0, 0 }, - {"swc0", "E,o(b)", 0xe0000000, 0xfc000000, RD_3|RD_C0|SM, 0, I1, 0, IOCT|IOCTP|IOCT2|I37 }, - {"swc0", "E,A(b)", 0, (int) M_SWC0_AB, INSN_MACRO, 0, I1, 0, IOCT|IOCTP|IOCT2|I37 }, - {"swc1", "T,o(b)", 0xe4000000, 0xfc000000, RD_1|RD_3|SM|FP_S, 0, I1, 0, 0 }, diff --git a/recipes-devtools/binutils/binutils/0014-Fix-rpath-in-libtool-when-sysroot-is-enabled.patch b/recipes-devtools/binutils/binutils/0010-Fix-rpath-in-libtool-when-sysroot-is-enabled.patch similarity index 91% rename from recipes-devtools/binutils/binutils/0014-Fix-rpath-in-libtool-when-sysroot-is-enabled.patch rename to recipes-devtools/binutils/binutils/0010-Fix-rpath-in-libtool-when-sysroot-is-enabled.patch index c3a95e6..a0a614d 100644 --- a/recipes-devtools/binutils/binutils/0014-Fix-rpath-in-libtool-when-sysroot-is-enabled.patch +++ b/recipes-devtools/binutils/binutils/0010-Fix-rpath-in-libtool-when-sysroot-is-enabled.patch @@ -1,7 +1,7 @@ -From 0e026a8758a5416b548de21d5245477cf8e33ed2 Mon Sep 17 00:00:00 2001 +From 4f5c89aa095882cd8975cb9a80cf4380ef8188f1 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 2 Mar 2015 01:42:38 +0000 -Subject: [PATCH] Fix rpath in libtool when sysroot is enabled +Subject: [PATCH 10/12] Fix rpath in libtool when sysroot is enabled Enabling sysroot support in libtool exposed a bug where the final library had an RPATH encoded into it which still pointed to the @@ -47,3 +47,6 @@ index 70e856e0659..11ee684cccf 100644 if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" +-- +2.25.1 + diff --git a/recipes-devtools/binutils/binutils/0015-sync-with-OE-libtool-changes.patch b/recipes-devtools/binutils/binutils/0011-sync-with-OE-libtool-changes.patch similarity index 95% rename from recipes-devtools/binutils/binutils/0015-sync-with-OE-libtool-changes.patch rename to recipes-devtools/binutils/binutils/0011-sync-with-OE-libtool-changes.patch index 824d9d4..4ec7057 100644 --- a/recipes-devtools/binutils/binutils/0015-sync-with-OE-libtool-changes.patch +++ b/recipes-devtools/binutils/binutils/0011-sync-with-OE-libtool-changes.patch @@ -1,7 +1,7 @@ -From 9d41698ca97b2c5c20ac83147de1f02d385fa66f Mon Sep 17 00:00:00 2001 +From d4c44e97c9c4592decd2f8a8fdd05723a69fa426 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Mon, 6 Mar 2017 23:33:27 -0800 -Subject: [PATCH] sync with OE libtool changes +Subject: [PATCH 11/12] sync with OE libtool changes Apply these patches from our libtool patches as not only are redundant RPATHs a waste of space but they can cause incorrect linking when native packages are @@ -84,3 +84,6 @@ index 11ee684cccf..3b19ac15328 100644 fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in +-- +2.25.1 + diff --git a/recipes-devtools/binutils/binutils/0016-Check-for-clang-before-checking-gcc-version.patch b/recipes-devtools/binutils/binutils/0012-Check-for-clang-before-checking-gcc-version.patch similarity index 80% rename from recipes-devtools/binutils/binutils/0016-Check-for-clang-before-checking-gcc-version.patch rename to recipes-devtools/binutils/binutils/0012-Check-for-clang-before-checking-gcc-version.patch index 0602c80..d233fe1 100644 --- a/recipes-devtools/binutils/binutils/0016-Check-for-clang-before-checking-gcc-version.patch +++ b/recipes-devtools/binutils/binutils/0012-Check-for-clang-before-checking-gcc-version.patch @@ -1,7 +1,7 @@ -From 805e3ce0c20bee5049ff167ab6f620a230c6db51 Mon Sep 17 00:00:00 2001 +From cbaa4a47f5a86908b91d61a70268eff883b12836 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 15 Apr 2020 14:17:20 -0700 -Subject: [PATCH] Check for clang before checking gcc version +Subject: [PATCH 12/12] Check for clang before checking gcc version Clang advertises itself to be gcc 4.2.1, so when compiling this test here fails since gcc < 4.4.5 did not support -static-libstdc++ but thats @@ -18,10 +18,10 @@ Signed-off-by: Khem Raj 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure -index 7b369071141..7da69e27ce9 100755 +index 787fcf89100..8c5d2a21c77 100755 --- a/configure +++ b/configure -@@ -5093,7 +5093,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +@@ -5275,7 +5275,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -31,10 +31,10 @@ index 7b369071141..7da69e27ce9 100755 #endif int main() {} diff --git a/configure.ac b/configure.ac -index 92f01fb3ed7..e99d67ab86b 100644 +index 2b10e9a1b02..677a0196c2b 100644 --- a/configure.ac +++ b/configure.ac -@@ -1311,7 +1311,7 @@ if test "$GCC" = yes; then +@@ -1309,7 +1309,7 @@ if test "$GCC" = yes; then AC_MSG_CHECKING([whether g++ accepts -static-libstdc++ -static-libgcc]) AC_LANG_PUSH(C++) AC_LINK_IFELSE([AC_LANG_SOURCE([ @@ -43,3 +43,6 @@ index 92f01fb3ed7..e99d67ab86b 100644 #error -static-libstdc++ not implemented #endif int main() {}])], +-- +2.25.1 + diff --git a/recipes-devtools/binutils/binutils/0012-Detect-64-bit-MIPS-targets.patch b/recipes-devtools/binutils/binutils/0012-Detect-64-bit-MIPS-targets.patch deleted file mode 100644 index 659ae79..0000000 --- a/recipes-devtools/binutils/binutils/0012-Detect-64-bit-MIPS-targets.patch +++ /dev/null @@ -1,47 +0,0 @@ -From bb229568e505f2276ca58b72fef6781034fa839f Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 31 Mar 2017 11:42:03 -0700 -Subject: [PATCH] Detect 64-bit MIPS targets - -Add mips64 target triplets and default to N64 - -Upstream-Status: Submitted -https://sourceware.org/ml/binutils/2016-08/msg00048.html - -Signed-off-by: Khem Raj ---- - gold/configure.tgt | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/gold/configure.tgt b/gold/configure.tgt -index cac0866e628..24fbf641456 100644 ---- a/gold/configure.tgt -+++ b/gold/configure.tgt -@@ -153,6 +153,13 @@ aarch64*-*) - targ_big_endian=false - targ_extra_big_endian=true - ;; -+mips*64*el*-*-*|mips*64*le*-*-*) -+ targ_obj=mips -+ targ_machine=EM_MIPS_RS3_LE -+ targ_size=64 -+ targ_big_endian=false -+ targ_extra_big_endian=true -+ ;; - mips*el*-*-*|mips*le*-*-*) - targ_obj=mips - targ_machine=EM_MIPS_RS3_LE -@@ -160,6 +167,13 @@ mips*el*-*-*|mips*le*-*-*) - targ_big_endian=false - targ_extra_big_endian=true - ;; -+mips*64*-*-*) -+ targ_obj=mips -+ targ_machine=EM_MIPS -+ targ_size=64 -+ targ_big_endian=true -+ targ_extra_big_endian=false -+ ;; - mips*-*-*) - targ_obj=mips - targ_machine=EM_MIPS diff --git a/recipes-devtools/binutils/binutils/0017-Add-support-for-the-DW_FORM_strx-forms-to-the-BFD-li.patch b/recipes-devtools/binutils/binutils/0017-Add-support-for-the-DW_FORM_strx-forms-to-the-BFD-li.patch deleted file mode 100644 index b4880e0..0000000 --- a/recipes-devtools/binutils/binutils/0017-Add-support-for-the-DW_FORM_strx-forms-to-the-BFD-li.patch +++ /dev/null @@ -1,183 +0,0 @@ -From a50c11a7a47b26e6a3e095dfb72aa2e465919fb6 Mon Sep 17 00:00:00 2001 -From: Nick Clifton -Date: Fri, 5 Mar 2021 17:06:59 +0000 -Subject: [PATCH] Add support for the DW_FORM_strx* forms to the BFD library. - - PR 27521 - * dwarf2.c (is_str_attr): Add DW_FORM_strx* forms. - (read_indexed_string): Placeholder function. - (read_attribute_value): Handle DW_FORM_strx* and DW_FORM_addrx* - forms. - -Upstream-Status: Backport [https://sourceware.org/bugzilla/show_bug.cgi?id=27521] -Signed-off-by: Khem Raj ---- - bfd/dwarf2.c | 105 ++++++++++++++++++++++++++++++++------------------- - 1 file changed, 67 insertions(+), 38 deletions(-) - -diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c -index 5651696c0f7..5ffcd93f54c 100644 ---- a/bfd/dwarf2.c -+++ b/bfd/dwarf2.c -@@ -1160,8 +1160,23 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash, - static inline bfd_boolean - is_str_attr (enum dwarf_form form) - { -- return (form == DW_FORM_string || form == DW_FORM_strp -- || form == DW_FORM_line_strp || form == DW_FORM_GNU_strp_alt); -+ return (form == DW_FORM_string -+ || form == DW_FORM_strp -+ || form == DW_FORM_strx -+ || form == DW_FORM_strx1 -+ || form == DW_FORM_strx2 -+ || form == DW_FORM_strx3 -+ || form == DW_FORM_strx4 -+ || form == DW_FORM_line_strp -+ || form == DW_FORM_GNU_strp_alt); -+} -+ -+static const char * -+read_indexed_string (bfd_uint64_t index ATTRIBUTE_UNUSED, -+ struct comp_unit * unit ATTRIBUTE_UNUSED) -+{ -+ /* FIXME: Add support for indexed strings. */ -+ return ""; - } - - /* Read and fill in the value of attribute ATTR as described by FORM. -@@ -1192,6 +1207,9 @@ read_attribute_value (struct attribute * attr, - - switch (form) - { -+ case DW_FORM_flag_present: -+ attr->u.val = 1; -+ break; - case DW_FORM_ref_addr: - /* DW_FORM_ref_addr is an address in DWARF2, and an offset in - DWARF3. */ -@@ -1237,15 +1255,32 @@ read_attribute_value (struct attribute * attr, - info_ptr = read_n_bytes (info_ptr, info_ptr_end, blk); - attr->u.blk = blk; - break; -+ case DW_FORM_ref1: -+ case DW_FORM_flag: -+ case DW_FORM_data1: -+ case DW_FORM_addrx1: -+ attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end); -+ info_ptr += 1; -+ break; - case DW_FORM_data2: -+ case DW_FORM_ref2: - attr->u.val = read_2_bytes (abfd, info_ptr, info_ptr_end); - info_ptr += 2; - break; -+ case DW_FORM_addrx3: -+ attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end); -+ attr->u.val &= 0xffffff; -+ info_ptr += 3; -+ break; -+ case DW_FORM_ref4: - case DW_FORM_data4: -+ case DW_FORM_addrx4: - attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end); - info_ptr += 4; - break; - case DW_FORM_data8: -+ case DW_FORM_ref8: -+ case DW_FORM_ref_sig8: - attr->u.val = read_8_bytes (abfd, info_ptr, info_ptr_end); - info_ptr += 8; - break; -@@ -1265,6 +1300,33 @@ read_attribute_value (struct attribute * attr, - attr->u.str = read_alt_indirect_string (unit, info_ptr, info_ptr_end, &bytes_read); - info_ptr += bytes_read; - break; -+ case DW_FORM_strx1: -+ attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end); -+ info_ptr += 1; -+ attr->u.str = (char *) read_indexed_string (attr->u.val, unit); -+ break; -+ case DW_FORM_strx2: -+ attr->u.val = read_2_bytes (abfd, info_ptr, info_ptr_end); -+ info_ptr += 2; -+ attr->u.str = (char *) read_indexed_string (attr->u.val, unit); -+ break; -+ case DW_FORM_strx3: -+ attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end); -+ info_ptr += 3; -+ attr->u.val &= 0xffffff; -+ attr->u.str = (char *) read_indexed_string (attr->u.val, unit); -+ break; -+ case DW_FORM_strx4: -+ attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end); -+ info_ptr += 4; -+ attr->u.str = (char *) read_indexed_string (attr->u.val, unit); -+ break; -+ case DW_FORM_strx: -+ attr->u.val = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read, -+ FALSE, info_ptr_end); -+ info_ptr += bytes_read; -+ attr->u.str = (char *) read_indexed_string (attr->u.val, unit); -+ break; - case DW_FORM_exprloc: - case DW_FORM_block: - amt = sizeof (struct dwarf_block); -@@ -1287,48 +1349,14 @@ read_attribute_value (struct attribute * attr, - info_ptr = read_n_bytes (info_ptr, info_ptr_end, blk); - attr->u.blk = blk; - break; -- case DW_FORM_data1: -- attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end); -- info_ptr += 1; -- break; -- case DW_FORM_flag: -- attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end); -- info_ptr += 1; -- break; -- case DW_FORM_flag_present: -- attr->u.val = 1; -- break; - case DW_FORM_sdata: - attr->u.sval = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read, - TRUE, info_ptr_end); - info_ptr += bytes_read; - break; -- case DW_FORM_udata: -- attr->u.val = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read, -- FALSE, info_ptr_end); -- info_ptr += bytes_read; -- break; -- case DW_FORM_ref1: -- attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end); -- info_ptr += 1; -- break; -- case DW_FORM_ref2: -- attr->u.val = read_2_bytes (abfd, info_ptr, info_ptr_end); -- info_ptr += 2; -- break; -- case DW_FORM_ref4: -- attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end); -- info_ptr += 4; -- break; -- case DW_FORM_ref8: -- attr->u.val = read_8_bytes (abfd, info_ptr, info_ptr_end); -- info_ptr += 8; -- break; -- case DW_FORM_ref_sig8: -- attr->u.val = read_8_bytes (abfd, info_ptr, info_ptr_end); -- info_ptr += 8; -- break; - case DW_FORM_ref_udata: -+ case DW_FORM_udata: -+ case DW_FORM_addrx: - attr->u.val = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read, - FALSE, info_ptr_end); - info_ptr += bytes_read; -@@ -1361,6 +1389,7 @@ read_attribute_value (struct attribute * attr, - info_ptr = read_n_bytes (info_ptr, info_ptr_end, blk); - attr->u.blk = blk; - break; -+ - default: - _bfd_error_handler (_("DWARF error: invalid or unhandled FORM value: %#x"), - form); diff --git a/recipes-devtools/binutils/binutils/0018-Add-DWARF-5-support-in-gold.patch b/recipes-devtools/binutils/binutils/0018-Add-DWARF-5-support-in-gold.patch deleted file mode 100644 index 353b680..0000000 --- a/recipes-devtools/binutils/binutils/0018-Add-DWARF-5-support-in-gold.patch +++ /dev/null @@ -1,1374 +0,0 @@ -From 29dab7648672342418a9d32767e3b3182d9e6a30 Mon Sep 17 00:00:00 2001 -From: Cary Coutant -Date: Wed, 17 Mar 2021 21:31:15 -0700 -Subject: [PATCH] Add DWARF 5 support in gold. - -elfcpp/ - PR gold/27246 - * dwarf.h (enum DW_LNCT): Add line number table content type codes. - (enum DW_LINE_OPS): Reformat. - (enum DW_LINE_EXTENDED_OPS): Reformat. - (enum DW_CHILDREN): Reformat. - (enum DW_RLE): Add range list entry types. - (enum DW_SECT): Update values for DWARF 5. - -gold/ - PR gold/27246 - * dwarf_reader.cc (Dwarf_abbrev_table::do_get_abbrev): Handle - DW_FORM_implicit_const. - (Dwarf_ranges_table::read_ranges_table): Add version parameter; - Adjust all callers. Look for .debug_rnglists section if DWARF 5. - (Dwarf_ranges_table::read_range_list_v5): New method. - (Dwarf_die::read_attributes): Handle new DWARF 5 DW_FORM codes. - (Dwarf_die::skip_attributes): Likewise. - (Dwarf_info_reader::do_parse): Support DWARF 5 unit header format. - (Dwarf_info_reader::read_3bytes_from_pointer): New method. - (Sized_dwarf_line_info::Sized_dwarf_line_info): Initialize - str_buffer_, str_buffer_start, reloc_map_, line_number_map_. - Look for .debug_line_str section. - (Sized_dwarf_line_info::read_header_prolog): Support DWARF 5 prolog. - (Sized_dwarf_line_info::read_header_tables): Rename to... - (Sized_dwarf_line_info::read_header_tables_v2): ... this. - (Sized_dwarf_line_info::read_header_tables_v5): New method. - (Sized_dwarf_line_info::process_one_opcode): Insert missing "this->". - Change advance_line to signed int64_t. - (Sized_dwarf_line_info::read_lines): Add endptr parameter; adjust - callers. Insert missing "this->". - (Sized_dwarf_line_info::read_line_mappings): Support DWARF 5. - (Sized_dwarf_line_info::do_addr2line): Add debug code. - * dwarf_reader.h (Dwarf_abbrev_table::Attribute): Add implicit_const - field. Adjust constructor. - (Dwarf_abbrev_table::add_sttribute): Add implicit_const parameter. - (Dwarf_ranges_table::read_ranges_table): Add version parameter. - (Dwarf_ranges_table::read_range_list_v5): New method. - (Dwarf_die): Remove unused attr_off field. - (Dwarf_info_reader::Dwarf_info_reader): Initialize unit_type_ field. - (Dwarf_info_reader::is_type_unit): New method. - (Dwarf_info_reader::read_3bytes_from_pointer): New method. - (Dwarf_info_reader::read_range_list): Call read_range_list_v5 for - DWARF 5 range lists. - (Dwarf_info_reader::is_type_unit_): Remove. - (Dwarf_info_reader::unit_type_): New field. - (Sized_dwarf_line_info::~Sized_dwarf_line_info): Delete - str_buffer_start_. - (Sized_dwarf_line_info::read_header_tables): Rename to... - (Sized_dwarf_line_info::read_header_tables_v2): ... this. - (Sized_dwarf_line_info::read_header_tables_v5): New method. - (Sized_dwarf_line_info::read_lines): Add endptr parameter. - (Sized_dwarf_line_info::Dwarf_line_infoHeader): Add address_size field. - (Sized_dwarf_line_info::str_buffer_): New field. - (Sized_dwarf_line_info::str_buffer_end_): New field. - (Sized_dwarf_line_info::str_buffer_start_): New field. - (Sized_dwarf_line_info::end_of_header_length_): New field. - (Sized_dwarf_line_info::end_of_unit_): New field. - -Upstream-Status: Backport [5cde809b7b9 Add DWARF 5 support in gold.] - -Signed-off-by: Martin Jansa ---- - elfcpp/dwarf.h | 89 +++++-- - gold/dwarf_reader.cc | 591 +++++++++++++++++++++++++++++++++++++------ - gold/dwarf_reader.h | 103 ++++++-- - 3 files changed, 654 insertions(+), 129 deletions(-) - -diff --git a/elfcpp/dwarf.h b/elfcpp/dwarf.h -index e24347f8481..c9a9e02369c 100644 ---- a/elfcpp/dwarf.h -+++ b/elfcpp/dwarf.h -@@ -152,35 +152,48 @@ enum DW_EH_PE - DW_EH_PE_indirect = 0x80 - }; - -+// Line number table content type codes. -+ -+enum DW_LNCT -+{ -+ DW_LNCT_path = 0x1, -+ DW_LNCT_directory_index = 0x2, -+ DW_LNCT_timestamp = 0x3, -+ DW_LNCT_size = 0x4, -+ DW_LNCT_MD5 = 0x5, -+ DW_LNCT_lo_user = 0x2000, -+ DW_LNCT_hi_user = 0x3fff -+}; -+ - // Line number opcodes. - - enum DW_LINE_OPS - { -- DW_LNS_extended_op = 0, -- DW_LNS_copy = 1, -- DW_LNS_advance_pc = 2, -- DW_LNS_advance_line = 3, -- DW_LNS_set_file = 4, -- DW_LNS_set_column = 5, -- DW_LNS_negate_stmt = 6, -- DW_LNS_set_basic_block = 7, -- DW_LNS_const_add_pc = 8, -- DW_LNS_fixed_advance_pc = 9, -+ DW_LNS_extended_op = 0x00, -+ DW_LNS_copy = 0x01, -+ DW_LNS_advance_pc = 0x02, -+ DW_LNS_advance_line = 0x03, -+ DW_LNS_set_file = 0x04, -+ DW_LNS_set_column = 0x05, -+ DW_LNS_negate_stmt = 0x06, -+ DW_LNS_set_basic_block = 0x07, -+ DW_LNS_const_add_pc = 0x08, -+ DW_LNS_fixed_advance_pc = 0x09, - // DWARF 3. -- DW_LNS_set_prologue_end = 10, -- DW_LNS_set_epilogue_begin = 11, -- DW_LNS_set_isa = 12 -+ DW_LNS_set_prologue_end = 0x0a, -+ DW_LNS_set_epilogue_begin = 0x0b, -+ DW_LNS_set_isa = 0x0c - }; - - // Line number extended opcodes. - - enum DW_LINE_EXTENDED_OPS - { -- DW_LNE_end_sequence = 1, -- DW_LNE_set_address = 2, -- DW_LNE_define_file = 3, -+ DW_LNE_end_sequence = 0x01, -+ DW_LNE_set_address = 0x02, -+ DW_LNE_define_file = 0x03, - // DWARF4. -- DW_LNE_set_discriminator = 4, -+ DW_LNE_set_discriminator = 0x04, - // HP extensions. - DW_LNE_HP_negate_is_UV_update = 0x11, - DW_LNE_HP_push_context = 0x12, -@@ -191,13 +204,15 @@ enum DW_LINE_EXTENDED_OPS - DW_LNE_HP_negate_post_semantics = 0x17, - DW_LNE_HP_negate_function_exit = 0x18, - DW_LNE_HP_negate_front_end_logical = 0x19, -- DW_LNE_HP_define_proc = 0x20 -+ DW_LNE_HP_define_proc = 0x20, -+ DW_LNE_lo_user = 0x80, -+ DW_LNE_hi_user = 0xff - }; - - enum DW_CHILDREN - { -- DW_CHILDREN_no =0x00, -- DW_CHILDREN_yes =0x01 -+ DW_CHILDREN_no = 0, -+ DW_CHILDREN_yes = 1 - }; - - // Source language names and codes. -@@ -247,20 +262,38 @@ enum DW_LANG - DW_LANG_HP_Assembler = 0x8007 - }; - -+// Range list entry kinds in .debug_rnglists* section. -+ -+enum DW_RLE -+{ -+ DW_RLE_end_of_list = 0x00, -+ DW_RLE_base_addressx = 0x01, -+ DW_RLE_startx_endx = 0x02, -+ DW_RLE_startx_length = 0x03, -+ DW_RLE_offset_pair = 0x04, -+ DW_RLE_base_address = 0x05, -+ DW_RLE_start_end = 0x06, -+ DW_RLE_start_length = 0x07 -+}; -+ - // DWARF section identifiers used in the package format. - // Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFissionDWP. -+// Added (with changes) in DWARF 5. - - enum DW_SECT - { -- DW_SECT_INFO = 1, -- DW_SECT_TYPES = 2, -- DW_SECT_ABBREV = 3, -- DW_SECT_LINE = 4, -- DW_SECT_LOC = 5, -+ DW_SECT_INFO = 1, -+ DW_SECT_ABBREV = 3, -+ DW_SECT_LINE = 4, -+ DW_SECT_LOCLISTS = 5, - DW_SECT_STR_OFFSETS = 6, -- DW_SECT_MACINFO = 7, -- DW_SECT_MACRO = 8, -- DW_SECT_MAX = DW_SECT_MACRO, -+ DW_SECT_MACINFO = 7, -+ DW_SECT_RNGLISTS = 8, -+ DW_SECT_MAX = DW_SECT_RNGLISTS, -+ // These were used only for the experimental Fission support in DWARF 4. -+ DW_SECT_TYPES = 2, -+ DW_SECT_LOC = 5, -+ DW_SECT_MACRO = 8 - }; - - } // End namespace elfcpp. -diff --git a/gold/dwarf_reader.cc b/gold/dwarf_reader.cc -index f0e6b89bde2..83a0114ed39 100644 ---- a/gold/dwarf_reader.cc -+++ b/gold/dwarf_reader.cc -@@ -26,6 +26,7 @@ - #include - #include - -+#include "debug.h" - #include "elfcpp_swap.h" - #include "dwarf.h" - #include "object.h" -@@ -275,6 +276,14 @@ Dwarf_abbrev_table::do_get_abbrev(unsigned int code) - uint64_t form = read_unsigned_LEB_128(this->buffer_pos_, &len); - this->buffer_pos_ += len; - -+ // For DW_FORM_implicit_const, read the constant. -+ int64_t implicit_const = 0; -+ if (form == elfcpp::DW_FORM_implicit_const) -+ { -+ implicit_const = read_signed_LEB_128(this->buffer_pos_, &len); -+ this->buffer_pos_ += len; -+ } -+ - // A (0,0) pair terminates the list. - if (attr == 0 && form == 0) - break; -@@ -282,7 +291,7 @@ Dwarf_abbrev_table::do_get_abbrev(unsigned int code) - if (attr == elfcpp::DW_AT_sibling) - entry->has_sibling_attribute = true; - -- entry->add_attribute(attr, form); -+ entry->add_attribute(attr, form, implicit_const); - } - - this->store_abbrev(nextcode, entry); -@@ -302,8 +311,16 @@ Dwarf_ranges_table::read_ranges_table( - Relobj* object, - const unsigned char* symtab, - off_t symtab_size, -- unsigned int ranges_shndx) -+ unsigned int ranges_shndx, -+ unsigned int version) - { -+ const std::string section_name(version < 5 -+ ? ".debug_ranges" -+ : ".debug_rnglists"); -+ const std::string compressed_section_name(version < 5 -+ ? ".zdebug_ranges" -+ : ".zdebug_rnglists"); -+ - // If we've already read this abbrev table, return immediately. - if (this->ranges_shndx_ > 0 - && this->ranges_shndx_ == ranges_shndx) -@@ -318,7 +335,7 @@ Dwarf_ranges_table::read_ranges_table( - for (unsigned int i = 1; i < object->shnum(); ++i) - { - std::string name = object->section_name(i); -- if (name == ".debug_ranges" || name == ".zdebug_ranges") -+ if (name == section_name || name == compressed_section_name) - { - ranges_shndx = i; - this->output_section_offset_ = object->output_section_offset(i); -@@ -393,7 +410,7 @@ Dwarf_ranges_table::read_range_list( - { - Dwarf_range_list* ranges; - -- if (!this->read_ranges_table(object, symtab, symtab_size, ranges_shndx)) -+ if (!this->read_ranges_table(object, symtab, symtab_size, ranges_shndx, 4)) - return NULL; - - // Correct the offset. For incremental update links, we have a -@@ -459,6 +476,125 @@ Dwarf_ranges_table::read_range_list( - return ranges; - } - -+// Read a DWARF 5 range list from section RANGES_SHNDX at offset RANGES_OFFSET. -+ -+Dwarf_range_list* -+Dwarf_ranges_table::read_range_list_v5( -+ Relobj* object, -+ const unsigned char* symtab, -+ off_t symtab_size, -+ unsigned int addr_size, -+ unsigned int ranges_shndx, -+ off_t offset) -+{ -+ Dwarf_range_list* ranges; -+ -+ if (!this->read_ranges_table(object, symtab, symtab_size, ranges_shndx, 5)) -+ return NULL; -+ -+ ranges = new Dwarf_range_list(); -+ off_t base = 0; -+ unsigned int shndx0 = 0; -+ -+ // Correct the offset. For incremental update links, we have a -+ // relocated offset that is relative to the output section, but -+ // here we need an offset relative to the input section. -+ offset -= this->output_section_offset_; -+ -+ // Read the range list at OFFSET. -+ const unsigned char* prle = this->ranges_buffer_ + offset; -+ while (prle < this->ranges_buffer_end_) -+ { -+ off_t start; -+ off_t end; -+ unsigned int shndx1 = 0; -+ unsigned int shndx2 = 0; -+ size_t len; -+ -+ // Read the entry type. -+ unsigned int rle_type = *prle++; -+ offset += 1; -+ -+ if (rle_type == elfcpp::DW_RLE_end_of_list) -+ break; -+ -+ switch (rle_type) -+ { -+ case elfcpp::DW_RLE_base_address: -+ if (addr_size == 4) -+ base = this->dwinfo_->read_from_pointer<32>(prle); -+ else -+ base = this->dwinfo_->read_from_pointer<64>(prle); -+ if (this->ranges_reloc_mapper_ != NULL) -+ shndx0 = this->lookup_reloc(offset, &base); -+ prle += addr_size; -+ offset += addr_size; -+ break; -+ -+ case elfcpp::DW_RLE_offset_pair: -+ start = read_unsigned_LEB_128(prle, &len); -+ prle += len; -+ offset += len; -+ end = read_unsigned_LEB_128(prle, &len); -+ prle += len; -+ offset += len; -+ if (shndx0 == 0 || object->is_section_included(shndx0)) -+ ranges->add(shndx0, base + start, base + end); -+ break; -+ -+ case elfcpp::DW_RLE_start_end: -+ if (addr_size == 4) -+ { -+ start = this->dwinfo_->read_from_pointer<32>(prle); -+ end = this->dwinfo_->read_from_pointer<32>(prle + 4); -+ } -+ else -+ { -+ start = this->dwinfo_->read_from_pointer<64>(prle); -+ end = this->dwinfo_->read_from_pointer<64>(prle + 8); -+ } -+ if (this->ranges_reloc_mapper_ != NULL) -+ { -+ shndx1 = this->lookup_reloc(offset, &start); -+ shndx2 = this->lookup_reloc(offset + addr_size, &end); -+ if (shndx1 != shndx2) -+ gold_warning(_("%s: DWARF info may be corrupt; offsets in a " -+ "range list entry are in different sections"), -+ object->name().c_str()); -+ } -+ prle += addr_size * 2; -+ offset += addr_size * 2; -+ if (shndx1 == 0 || object->is_section_included(shndx1)) -+ ranges->add(shndx1, start, end); -+ break; -+ -+ case elfcpp::DW_RLE_start_length: -+ if (addr_size == 4) -+ start = this->dwinfo_->read_from_pointer<32>(prle); -+ else -+ start = this->dwinfo_->read_from_pointer<64>(prle); -+ if (this->ranges_reloc_mapper_ != NULL) -+ shndx1 = this->lookup_reloc(offset, &start); -+ prle += addr_size; -+ offset += addr_size; -+ end = start + read_unsigned_LEB_128(prle, &len); -+ prle += len; -+ offset += len; -+ if (shndx1 == 0 || object->is_section_included(shndx1)) -+ ranges->add(shndx1, start, end); -+ break; -+ -+ default: -+ gold_warning(_("%s: DWARF range list contains " -+ "unsupported entry type (%d)"), -+ object->name().c_str(), rle_type); -+ break; -+ } -+ } -+ -+ return ranges; -+} -+ - // Look for a relocation at offset OFF in the range table, - // and return the section index and offset of the target. - -@@ -709,7 +845,13 @@ Dwarf_die::read_attributes() - case elfcpp::DW_FORM_flag_present: - attr_value.val.intval = 1; - break; -+ case elfcpp::DW_FORM_implicit_const: -+ attr_value.val.intval = -+ this->abbrev_code_->attributes[i].implicit_const; -+ break; - case elfcpp::DW_FORM_strp: -+ case elfcpp::DW_FORM_strp_sup: -+ case elfcpp::DW_FORM_line_strp: - { - off_t str_off; - if (this->dwinfo_->offset_size() == 4) -@@ -722,6 +864,26 @@ Dwarf_die::read_attributes() - attr_value.val.refval = str_off; - break; - } -+ case elfcpp::DW_FORM_strx: -+ case elfcpp::DW_FORM_GNU_str_index: -+ attr_value.val.uintval = read_unsigned_LEB_128(pattr, &len); -+ pattr += len; -+ break; -+ case elfcpp::DW_FORM_strx1: -+ attr_value.val.uintval = *pattr++; -+ break; -+ case elfcpp::DW_FORM_strx2: -+ attr_value.val.uintval = -+ this->dwinfo_->read_from_pointer<16>(&pattr); -+ break; -+ case elfcpp::DW_FORM_strx3: -+ attr_value.val.uintval = -+ this->dwinfo_->read_3bytes_from_pointer(&pattr); -+ break; -+ case elfcpp::DW_FORM_strx4: -+ attr_value.val.uintval = -+ this->dwinfo_->read_from_pointer<32>(&pattr); -+ break; - case elfcpp::DW_FORM_sec_offset: - { - off_t sec_off; -@@ -747,7 +909,6 @@ Dwarf_die::read_attributes() - this->dwinfo_->lookup_reloc(attr_off, &sec_off); - attr_value.aux.shndx = shndx; - attr_value.val.refval = sec_off; -- ref_form = true; - break; - } - case elfcpp::DW_FORM_ref_addr: -@@ -815,6 +976,7 @@ Dwarf_die::read_attributes() - break; - } - case elfcpp::DW_FORM_ref4: -+ case elfcpp::DW_FORM_ref_sup4: - { - off_t sec_off; - sec_off = this->dwinfo_->read_from_pointer<32>(&pattr); -@@ -835,11 +997,20 @@ Dwarf_die::read_attributes() - attr_value.val.intval = sec_off; - break; - } -+ case elfcpp::DW_FORM_data16: -+ { -+ // For now, treat this as a 16-byte block. -+ attr_value.val.blockval = pattr; -+ attr_value.aux.blocklen = 16; -+ pattr += 16; -+ break; -+ } - case elfcpp::DW_FORM_ref_sig8: - attr_value.val.uintval = - this->dwinfo_->read_from_pointer<64>(&pattr); - break; - case elfcpp::DW_FORM_ref8: -+ case elfcpp::DW_FORM_ref_sup8: - { - off_t sec_off; - sec_off = this->dwinfo_->read_from_pointer<64>(&pattr); -@@ -856,11 +1027,29 @@ Dwarf_die::read_attributes() - pattr += len; - break; - case elfcpp::DW_FORM_udata: -+ attr_value.val.uintval = read_unsigned_LEB_128(pattr, &len); -+ pattr += len; -+ break; -+ case elfcpp::DW_FORM_addrx: - case elfcpp::DW_FORM_GNU_addr_index: -- case elfcpp::DW_FORM_GNU_str_index: - attr_value.val.uintval = read_unsigned_LEB_128(pattr, &len); - pattr += len; - break; -+ case elfcpp::DW_FORM_addrx1: -+ attr_value.val.uintval = *pattr++; -+ break; -+ case elfcpp::DW_FORM_addrx2: -+ attr_value.val.uintval = -+ this->dwinfo_->read_from_pointer<16>(&pattr); -+ break; -+ case elfcpp::DW_FORM_addrx3: -+ attr_value.val.uintval = -+ this->dwinfo_->read_3bytes_from_pointer(&pattr); -+ break; -+ case elfcpp::DW_FORM_addrx4: -+ attr_value.val.uintval = -+ this->dwinfo_->read_from_pointer<32>(&pattr); -+ break; - case elfcpp::DW_FORM_sdata: - attr_value.val.intval = read_signed_LEB_128(pattr, &len); - pattr += len; -@@ -870,6 +1059,11 @@ Dwarf_die::read_attributes() - len = strlen(attr_value.val.stringval); - pattr += len + 1; - break; -+ case elfcpp::DW_FORM_loclistx: -+ case elfcpp::DW_FORM_rnglistx: -+ attr_value.val.uintval = read_unsigned_LEB_128(pattr, &len); -+ pattr += len; -+ break; - default: - return false; - } -@@ -954,9 +1148,12 @@ Dwarf_die::skip_attributes() - switch(form) - { - case elfcpp::DW_FORM_flag_present: -+ case elfcpp::DW_FORM_implicit_const: - break; - case elfcpp::DW_FORM_strp: - case elfcpp::DW_FORM_sec_offset: -+ case elfcpp::DW_FORM_strp_sup: -+ case elfcpp::DW_FORM_line_strp: - pattr += this->dwinfo_->offset_size(); - break; - case elfcpp::DW_FORM_addr: -@@ -993,23 +1190,42 @@ Dwarf_die::skip_attributes() - case elfcpp::DW_FORM_data1: - case elfcpp::DW_FORM_ref1: - case elfcpp::DW_FORM_flag: -+ case elfcpp::DW_FORM_strx1: -+ case elfcpp::DW_FORM_addrx1: - pattr += 1; - break; - case elfcpp::DW_FORM_data2: - case elfcpp::DW_FORM_ref2: -+ case elfcpp::DW_FORM_strx2: -+ case elfcpp::DW_FORM_addrx2: - pattr += 2; - break; -+ case elfcpp::DW_FORM_strx3: -+ case elfcpp::DW_FORM_addrx3: -+ pattr += 3; -+ break; - case elfcpp::DW_FORM_data4: - case elfcpp::DW_FORM_ref4: -+ case elfcpp::DW_FORM_ref_sup4: -+ case elfcpp::DW_FORM_strx4: -+ case elfcpp::DW_FORM_addrx4: - pattr += 4; - break; - case elfcpp::DW_FORM_data8: - case elfcpp::DW_FORM_ref8: - case elfcpp::DW_FORM_ref_sig8: -+ case elfcpp::DW_FORM_ref_sup8: - pattr += 8; - break; -+ case elfcpp::DW_FORM_data16: -+ pattr += 16; -+ break; - case elfcpp::DW_FORM_ref_udata: - case elfcpp::DW_FORM_udata: -+ case elfcpp::DW_FORM_addrx: -+ case elfcpp::DW_FORM_strx: -+ case elfcpp::DW_FORM_loclistx: -+ case elfcpp::DW_FORM_rnglistx: - case elfcpp::DW_FORM_GNU_addr_index: - case elfcpp::DW_FORM_GNU_str_index: - read_unsigned_LEB_128(pattr, &len); -@@ -1313,6 +1529,13 @@ Dwarf_info_reader::do_parse() - elfcpp::Swap_unaligned<16, big_endian>::readval(pinfo); - pinfo += 2; - -+ // DWARF 5: Read the unit type (1 byte) and address size (1 byte). -+ if (this->cu_version_ >= 5) -+ { -+ this->unit_type_ = *pinfo++; -+ this->address_size_ = *pinfo++; -+ } -+ - // Read debug_abbrev_offset (4 or 8 bytes). - if (this->offset_size_ == 4) - abbrev_offset = elfcpp::Swap_unaligned<32, big_endian>::readval(pinfo); -@@ -1333,13 +1556,14 @@ Dwarf_info_reader::do_parse() - } - pinfo += this->offset_size_; - -- // Read address_size (1 byte). -- this->address_size_ = *pinfo++; -+ // DWARF 2-4: Read address_size (1 byte). -+ if (this->cu_version_ < 5) -+ this->address_size_ = *pinfo++; - - // For type units, read the two extra fields. - uint64_t signature = 0; - off_t type_offset = 0; -- if (this->is_type_unit_) -+ if (this->is_type_unit()) - { - if (!this->check_buffer(pinfo + 8 + this->offset_size_)) - break; -@@ -1369,7 +1593,7 @@ Dwarf_info_reader::do_parse() - if (root_die.tag() != 0) - { - // Visit the CU or TU. -- if (this->is_type_unit_) -+ if (this->is_type_unit()) - this->visit_type_unit(section_offset + this->cu_offset_, - cu_end - cu_start, type_offset, signature, - &root_die); -@@ -1460,6 +1684,19 @@ Dwarf_info_reader::read_from_pointer(const unsigned char** source) - return return_value; - } - -+// Read a 3-byte integer. Update SOURCE after read. -+inline typename elfcpp::Valtype_base<32>::Valtype -+Dwarf_info_reader::read_3bytes_from_pointer(const unsigned char** source) -+{ -+ typename elfcpp::Valtype_base<32>::Valtype return_value; -+ if (this->object_->is_big_endian()) -+ return_value = ((*source)[0] << 16) | ((*source)[1] << 8) | (*source)[2]; -+ else -+ return_value = ((*source)[2] << 16) | ((*source)[1] << 8) | (*source)[0]; -+ *source += 3; -+ return return_value; -+} -+ - // Look for a relocation at offset ATTR_OFF in the dwarf info, - // and return the section index and offset of the target. - -@@ -1561,27 +1798,40 @@ Sized_dwarf_line_info::Sized_dwarf_line_info( - Object* object, - unsigned int read_shndx) - : data_valid_(false), buffer_(NULL), buffer_start_(NULL), -+ str_buffer_(NULL), str_buffer_start_(NULL), - reloc_mapper_(NULL), symtab_buffer_(NULL), directories_(), files_(), -- current_header_index_(-1) -+ current_header_index_(-1), reloc_map_(), line_number_map_() - { -- unsigned int debug_shndx; -+ unsigned int debug_line_shndx = 0; -+ unsigned int debug_line_str_shndx = 0; - -- for (debug_shndx = 1; debug_shndx < object->shnum(); ++debug_shndx) -+ for (unsigned int i = 1; i < object->shnum(); ++i) - { -+ section_size_type buffer_size; -+ bool is_new = false; -+ - // FIXME: do this more efficiently: section_name() isn't super-fast -- std::string name = object->section_name(debug_shndx); -+ std::string name = object->section_name(i); - if (name == ".debug_line" || name == ".zdebug_line") - { -- section_size_type buffer_size; -- bool is_new = false; -- this->buffer_ = object->decompressed_section_contents(debug_shndx, -- &buffer_size, -- &is_new); -+ this->buffer_ = -+ object->decompressed_section_contents(i, &buffer_size, &is_new); - if (is_new) - this->buffer_start_ = this->buffer_; - this->buffer_end_ = this->buffer_ + buffer_size; -- break; -+ debug_line_shndx = i; -+ } -+ else if (name == ".debug_line_str" || name == ".zdebug_line_str") -+ { -+ this->str_buffer_ = -+ object->decompressed_section_contents(i, &buffer_size, &is_new); -+ if (is_new) -+ this->str_buffer_start_ = this->str_buffer_; -+ this->str_buffer_end_ = this->str_buffer_ + buffer_size; -+ debug_line_str_shndx = i; - } -+ if (debug_line_shndx > 0 && debug_line_str_shndx > 0) -+ break; - } - if (this->buffer_ == NULL) - return; -@@ -1594,7 +1844,7 @@ Sized_dwarf_line_info::Sized_dwarf_line_info( - unsigned int reloc_sh_type = object->section_type(i); - if ((reloc_sh_type == elfcpp::SHT_REL - || reloc_sh_type == elfcpp::SHT_RELA) -- && object->section_info(i) == debug_shndx) -+ && object->section_info(i) == debug_line_shndx) - { - reloc_shndx = i; - this->track_relocs_type_ = reloc_sh_type; -@@ -1640,65 +1890,80 @@ Sized_dwarf_line_info::read_header_prolog( - uint32_t initial_length = elfcpp::Swap_unaligned<32, big_endian>::readval(lineptr); - lineptr += 4; - -- // In DWARF2/3, if the initial length is all 1 bits, then the offset -+ // In DWARF, if the initial length is all 1 bits, then the offset - // size is 8 and we need to read the next 8 bytes for the real length. - if (initial_length == 0xffffffff) - { -- header_.offset_size = 8; -+ this->header_.offset_size = 8; - initial_length = elfcpp::Swap_unaligned<64, big_endian>::readval(lineptr); - lineptr += 8; - } - else -- header_.offset_size = 4; -+ this->header_.offset_size = 4; - -- header_.total_length = initial_length; -+ this->header_.total_length = initial_length; - -- gold_assert(lineptr + header_.total_length <= buffer_end_); -+ this->end_of_unit_ = lineptr + initial_length; -+ gold_assert(this->end_of_unit_ <= buffer_end_); - -- header_.version = elfcpp::Swap_unaligned<16, big_endian>::readval(lineptr); -+ this->header_.version = -+ elfcpp::Swap_unaligned<16, big_endian>::readval(lineptr); - lineptr += 2; - -- // Skip address size and segment selector for DWARF5. -- if (header_.version >= 5) -- lineptr += 2; -+ // We can only read versions 2-5 of the DWARF line number table. -+ // For other versions, just skip the entire line number table. -+ if (this->header_.version < 2 || this->header_.version > 5) -+ return this->end_of_unit_; - -- if (header_.offset_size == 4) -- header_.prologue_length = elfcpp::Swap_unaligned<32, big_endian>::readval(lineptr); -+ // DWARF 5 only: address size and segment selector. -+ if (this->header_.version >= 5) -+ { -+ this->header_.address_size = *lineptr; -+ // We ignore the segment selector. -+ lineptr += 2; -+ } -+ -+ if (this->header_.offset_size == 4) -+ this->header_.prologue_length = -+ elfcpp::Swap_unaligned<32, big_endian>::readval(lineptr); - else -- header_.prologue_length = elfcpp::Swap_unaligned<64, big_endian>::readval(lineptr); -- lineptr += header_.offset_size; -+ this->header_.prologue_length = -+ elfcpp::Swap_unaligned<64, big_endian>::readval(lineptr); -+ lineptr += this->header_.offset_size; - -- header_.min_insn_length = *lineptr; -+ this->end_of_header_length_ = lineptr; -+ -+ this->header_.min_insn_length = *lineptr; - lineptr += 1; - -- if (header_.version < 4) -- header_.max_ops_per_insn = 1; -+ if (this->header_.version < 4) -+ this->header_.max_ops_per_insn = 1; - else - { - // DWARF 4 added the maximum_operations_per_instruction field. -- header_.max_ops_per_insn = *lineptr; -+ this->header_.max_ops_per_insn = *lineptr; - lineptr += 1; - // TODO: Add support for values other than 1. -- gold_assert(header_.max_ops_per_insn == 1); -+ gold_assert(this->header_.max_ops_per_insn == 1); - } - -- header_.default_is_stmt = *lineptr; -+ this->header_.default_is_stmt = *lineptr; - lineptr += 1; - -- header_.line_base = *reinterpret_cast(lineptr); -+ this->header_.line_base = *reinterpret_cast(lineptr); - lineptr += 1; - -- header_.line_range = *lineptr; -+ this->header_.line_range = *lineptr; - lineptr += 1; - -- header_.opcode_base = *lineptr; -+ this->header_.opcode_base = *lineptr; - lineptr += 1; - -- header_.std_opcode_lengths.resize(header_.opcode_base + 1); -- header_.std_opcode_lengths[0] = 0; -- for (int i = 1; i < header_.opcode_base; i++) -+ this->header_.std_opcode_lengths.resize(this->header_.opcode_base + 1); -+ this->header_.std_opcode_lengths[0] = 0; -+ for (int i = 1; i < this->header_.opcode_base; i++) - { -- header_.std_opcode_lengths[i] = *lineptr; -+ this->header_.std_opcode_lengths[i] = *lineptr; - lineptr += 1; - } - -@@ -1707,10 +1972,11 @@ Sized_dwarf_line_info::read_header_prolog( - - // The header for a debug_line section is mildly complicated, because - // the line info is very tightly encoded. -+// This routine is for DWARF versions 2, 3, and 4. - - template - const unsigned char* --Sized_dwarf_line_info::read_header_tables( -+Sized_dwarf_line_info::read_header_tables_v2( - const unsigned char* lineptr) - { - ++this->current_header_index_; -@@ -1775,6 +2041,169 @@ Sized_dwarf_line_info::read_header_tables( - return lineptr; - } - -+// This routine is for DWARF version 5. -+ -+template -+const unsigned char* -+Sized_dwarf_line_info::read_header_tables_v5( -+ const unsigned char* lineptr) -+{ -+ size_t len; -+ -+ ++this->current_header_index_; -+ -+ gold_assert(static_cast(this->directories_.size()) -+ == this->current_header_index_); -+ gold_assert(static_cast(this->files_.size()) -+ == this->current_header_index_); -+ -+ // Read the directory list. -+ unsigned int format_count = *lineptr; -+ lineptr += 1; -+ -+ unsigned int *types = new unsigned int[format_count]; -+ unsigned int *forms = new unsigned int[format_count]; -+ -+ for (unsigned int i = 0; i < format_count; i++) -+ { -+ types[i] = read_unsigned_LEB_128(lineptr, &len); -+ lineptr += len; -+ forms[i] = read_unsigned_LEB_128(lineptr, &len); -+ lineptr += len; -+ } -+ -+ uint64_t entry_count = read_unsigned_LEB_128(lineptr, &len); -+ lineptr += len; -+ this->directories_.push_back(std::vector(0)); -+ std::vector& dir_list = this->directories_.back(); -+ -+ for (unsigned int j = 0; j < entry_count; j++) -+ { -+ std::string dirname; -+ -+ for (unsigned int i = 0; i < format_count; i++) -+ { -+ if (types[i] == elfcpp::DW_LNCT_path) -+ { -+ if (forms[i] == elfcpp::DW_FORM_string) -+ { -+ dirname = reinterpret_cast(lineptr); -+ lineptr += dirname.size() + 1; -+ } -+ else if (forms[i] == elfcpp::DW_FORM_line_strp) -+ { -+ uint64_t offset; -+ if (this->header_.offset_size == 4) -+ offset = -+ elfcpp::Swap_unaligned<32, big_endian>::readval(lineptr); -+ else -+ offset = -+ elfcpp::Swap_unaligned<64, big_endian>::readval(lineptr); -+ typename Reloc_map::const_iterator it -+ = this->reloc_map_.find(lineptr - this->buffer_); -+ if (it != reloc_map_.end()) -+ { -+ if (this->track_relocs_type_ == elfcpp::SHT_RELA) -+ offset = 0; -+ offset += it->second.second; -+ } -+ lineptr += this->header_.offset_size; -+ dirname = reinterpret_cast(this->str_buffer_ -+ + offset); -+ } -+ else -+ return lineptr; -+ } -+ else -+ return lineptr; -+ } -+ dir_list.push_back(dirname); -+ } -+ -+ delete[] types; -+ delete[] forms; -+ -+ // Read the filenames list. -+ format_count = *lineptr; -+ lineptr += 1; -+ -+ types = new unsigned int[format_count]; -+ forms = new unsigned int[format_count]; -+ -+ for (unsigned int i = 0; i < format_count; i++) -+ { -+ types[i] = read_unsigned_LEB_128(lineptr, &len); -+ lineptr += len; -+ forms[i] = read_unsigned_LEB_128(lineptr, &len); -+ lineptr += len; -+ } -+ -+ entry_count = read_unsigned_LEB_128(lineptr, &len); -+ lineptr += len; -+ this->files_.push_back( -+ std::vector >(0)); -+ std::vector >& file_list = this->files_.back(); -+ -+ for (unsigned int j = 0; j < entry_count; j++) -+ { -+ const char* path = NULL; -+ int dirindex = 0; -+ -+ for (unsigned int i = 0; i < format_count; i++) -+ { -+ if (types[i] == elfcpp::DW_LNCT_path) -+ { -+ if (forms[i] == elfcpp::DW_FORM_string) -+ { -+ path = reinterpret_cast(lineptr); -+ lineptr += strlen(path) + 1; -+ } -+ else if (forms[i] == elfcpp::DW_FORM_line_strp) -+ { -+ uint64_t offset; -+ if (this->header_.offset_size == 4) -+ offset = elfcpp::Swap_unaligned<32, big_endian>::readval(lineptr); -+ else -+ offset = elfcpp::Swap_unaligned<64, big_endian>::readval(lineptr); -+ typename Reloc_map::const_iterator it -+ = this->reloc_map_.find(lineptr - this->buffer_); -+ if (it != reloc_map_.end()) -+ { -+ if (this->track_relocs_type_ == elfcpp::SHT_RELA) -+ offset = 0; -+ offset += it->second.second; -+ } -+ lineptr += this->header_.offset_size; -+ path = reinterpret_cast(this->str_buffer_ -+ + offset); -+ } -+ else -+ return lineptr; -+ } -+ else if (types[i] == elfcpp::DW_LNCT_directory_index) -+ { -+ if (forms[i] == elfcpp::DW_FORM_udata) -+ { -+ dirindex = read_unsigned_LEB_128(lineptr, &len); -+ lineptr += len; -+ } -+ else -+ return lineptr; -+ } -+ else -+ return lineptr; -+ } -+ gold_debug(DEBUG_LOCATION, "File %3d: %s", -+ static_cast(file_list.size()), path); -+ file_list.push_back(std::make_pair(dirindex, path)); -+ } -+ -+ delete[] types; -+ delete[] forms; -+ -+ return lineptr; -+} -+ - // Process a single opcode in the .debug.line structure. - - template -@@ -1790,15 +2219,15 @@ Sized_dwarf_line_info::process_one_opcode( - - // If the opcode is great than the opcode_base, it is a special - // opcode. Most line programs consist mainly of special opcodes. -- if (opcode >= header_.opcode_base) -+ if (opcode >= this->header_.opcode_base) - { -- opcode -= header_.opcode_base; -- const int advance_address = ((opcode / header_.line_range) -- * header_.min_insn_length); -+ opcode -= this->header_.opcode_base; -+ const int advance_address = ((opcode / this->header_.line_range) -+ * this->header_.min_insn_length); - lsm->address += advance_address; - -- const int advance_line = ((opcode % header_.line_range) -- + header_.line_base); -+ const int advance_line = ((opcode % this->header_.line_range) -+ + this->header_.line_base); - lsm->line_num += advance_line; - lsm->basic_block = true; - *len = oplen; -@@ -1818,13 +2247,13 @@ Sized_dwarf_line_info::process_one_opcode( - const uint64_t advance_address - = read_unsigned_LEB_128(start, &templen); - oplen += templen; -- lsm->address += header_.min_insn_length * advance_address; -+ lsm->address += this->header_.min_insn_length * advance_address; - } - break; - - case elfcpp::DW_LNS_advance_line: - { -- const uint64_t advance_line = read_signed_LEB_128(start, &templen); -+ const int64_t advance_line = read_signed_LEB_128(start, &templen); - oplen += templen; - lsm->line_num += advance_line; - } -@@ -1865,9 +2294,9 @@ Sized_dwarf_line_info::process_one_opcode( - - case elfcpp::DW_LNS_const_add_pc: - { -- const int advance_address = (header_.min_insn_length -- * ((255 - header_.opcode_base) -- / header_.line_range)); -+ const int advance_address = (this->header_.min_insn_length -+ * ((255 - this->header_.opcode_base) -+ / this->header_.line_range)); - lsm->address += advance_address; - } - break; -@@ -1950,7 +2379,7 @@ Sized_dwarf_line_info::process_one_opcode( - default: - { - // Ignore unknown opcode silently -- for (int i = 0; i < header_.std_opcode_lengths[opcode]; i++) -+ for (int i = 0; i < this->header_.std_opcode_lengths[opcode]; i++) - { - size_t templen; - read_unsigned_LEB_128(start, &templen); -@@ -1970,28 +2399,24 @@ Sized_dwarf_line_info::process_one_opcode( - template - unsigned const char* - Sized_dwarf_line_info::read_lines(unsigned const char* lineptr, -+ unsigned const char* endptr, - unsigned int shndx) - { - struct LineStateMachine lsm; - -- // LENGTHSTART is the place the length field is based on. It is the -- // point in the header after the initial length field. -- const unsigned char* lengthstart = buffer_; -- -- // In 64 bit dwarf, the initial length is 12 bytes, because of the -- // 0xffffffff at the start. -- if (header_.offset_size == 8) -- lengthstart += 12; -- else -- lengthstart += 4; -- -- while (lineptr < lengthstart + header_.total_length) -+ while (lineptr < endptr) - { -- ResetLineStateMachine(&lsm, header_.default_is_stmt); -+ ResetLineStateMachine(&lsm, this->header_.default_is_stmt); - while (!lsm.end_sequence) - { - size_t oplength; -+ -+ if (lineptr >= endptr) -+ break; -+ - bool add_line = this->process_one_opcode(lineptr, &lsm, &oplength); -+ lineptr += oplength; -+ - if (add_line - && (shndx == -1U || lsm.shndx == -1U || shndx == lsm.shndx)) - { -@@ -2012,11 +2437,10 @@ Sized_dwarf_line_info::read_lines(unsigned const char* lineptr - map.back().last_line_for_offset = false; - map.push_back(entry); - } -- lineptr += oplength; - } - } - -- return lengthstart + header_.total_length; -+ return endptr; - } - - // Read the relocations into a Reloc_map. -@@ -2057,9 +2481,17 @@ Sized_dwarf_line_info::read_line_mappings(unsigned int shndx) - { - const unsigned char* lineptr = this->buffer_; - lineptr = this->read_header_prolog(lineptr); -- lineptr = this->read_header_tables(lineptr); -- lineptr = this->read_lines(lineptr, shndx); -- this->buffer_ = lineptr; -+ if (this->header_.version >= 2 && this->header_.version <= 4) -+ { -+ lineptr = this->read_header_tables_v2(lineptr); -+ lineptr = this->read_lines(lineptr, this->end_of_unit_, shndx); -+ } -+ else if (this->header_.version == 5) -+ { -+ lineptr = this->read_header_tables_v5(lineptr); -+ lineptr = this->read_lines(lineptr, this->end_of_unit_, shndx); -+ } -+ this->buffer_ = this->end_of_unit_; - } - - // Sort the lines numbers, so addr2line can use binary search. -@@ -2215,6 +2647,9 @@ Sized_dwarf_line_info::do_addr2line( - off_t offset, - std::vector* other_lines) - { -+ gold_debug(DEBUG_LOCATION, "do_addr2line: shndx %u offset %08x", -+ shndx, static_cast(offset)); -+ - if (this->data_valid_ == false) - return ""; - -diff --git a/gold/dwarf_reader.h b/gold/dwarf_reader.h -index 80b2231327c..921a1f7c876 100644 ---- a/gold/dwarf_reader.h -+++ b/gold/dwarf_reader.h -@@ -173,11 +173,12 @@ class Dwarf_abbrev_table - // An attribute list entry. - struct Attribute - { -- Attribute(unsigned int a, unsigned int f) -- : attr(a), form(f) -+ Attribute(unsigned int a, unsigned int f, int c) -+ : attr(a), form(f), implicit_const(c) - { } - unsigned int attr; - unsigned int form; -+ int implicit_const; - }; - - // An abbrev code entry. -@@ -190,9 +191,9 @@ class Dwarf_abbrev_table - } - - void -- add_attribute(unsigned int attr, unsigned int form) -+ add_attribute(unsigned int attr, unsigned int form, int implicit_const) - { -- this->attributes.push_back(Attribute(attr, form)); -+ this->attributes.push_back(Attribute(attr, form, implicit_const)); - } - - // The DWARF tag. -@@ -349,14 +350,15 @@ class Dwarf_ranges_table - delete this->ranges_reloc_mapper_; - } - -- // Read the ranges table from an object file. -+ // Fetch the contents of the ranges table from an object file. - bool - read_ranges_table(Relobj* object, - const unsigned char* symtab, - off_t symtab_size, -- unsigned int ranges_shndx); -+ unsigned int ranges_shndx, -+ unsigned int version); - -- // Read the range table from an object file. -+ // Read the DWARF 2/3/4 range table. - Dwarf_range_list* - read_range_list(Relobj* object, - const unsigned char* symtab, -@@ -365,6 +367,15 @@ class Dwarf_ranges_table - unsigned int ranges_shndx, - off_t ranges_offset); - -+ // Read the DWARF 5 rnglists table. -+ Dwarf_range_list* -+ read_range_list_v5(Relobj* object, -+ const unsigned char* symtab, -+ off_t symtab_size, -+ unsigned int address_size, -+ unsigned int ranges_shndx, -+ off_t ranges_offset); -+ - // Look for a relocation at offset OFF in the range table, - // and return the section index and offset of the target. - unsigned int -@@ -490,8 +501,6 @@ class Dwarf_die - unsigned int shndx; - // Block length for block forms. - unsigned int blocklen; -- // Attribute offset for DW_FORM_strp. -- unsigned int attr_off; - } aux; - }; - -@@ -684,6 +693,10 @@ class Dwarf_die - // calls the various visit_xxx() methods for each header. Clients - // should derive a new class from this one and implement the - // visit_compilation_unit() and visit_type_unit() functions. -+// IS_TYPE_UNIT is true if we are reading from a .debug_types section, -+// which is used only in DWARF 4. For DWARF 5, it will be false, -+// and we will determine whether it's a type init when we parse the -+// header. - - class Dwarf_info_reader - { -@@ -695,7 +708,7 @@ class Dwarf_info_reader - unsigned int shndx, - unsigned int reloc_shndx, - unsigned int reloc_type) -- : is_type_unit_(is_type_unit), object_(object), symtab_(symtab), -+ : object_(object), symtab_(symtab), - symtab_size_(symtab_size), shndx_(shndx), reloc_shndx_(reloc_shndx), - reloc_type_(reloc_type), abbrev_shndx_(0), string_shndx_(0), - buffer_(NULL), buffer_end_(NULL), cu_offset_(0), cu_length_(0), -@@ -703,7 +716,12 @@ class Dwarf_info_reader - abbrev_table_(), ranges_table_(this), - reloc_mapper_(NULL), string_buffer_(NULL), string_buffer_end_(NULL), - owns_string_buffer_(false), string_output_section_offset_(0) -- { } -+ { -+ // For DWARF 4, we infer the unit type from the section name. -+ // For DWARF 5, we will read this from the unit header. -+ this->unit_type_ = -+ (is_type_unit ? elfcpp::DW_UT_type : elfcpp::DW_UT_compile); -+ } - - virtual - ~Dwarf_info_reader() -@@ -714,6 +732,13 @@ class Dwarf_info_reader - delete[] this->string_buffer_; - } - -+ bool -+ is_type_unit() const -+ { -+ return (this->unit_type_ == elfcpp::DW_UT_type -+ || this->unit_type_ == elfcpp::DW_UT_split_type); -+ } -+ - // Begin parsing the debug info. This calls visit_compilation_unit() - // or visit_type_unit() for each compilation or type unit found in the - // section, and visit_die() for each top-level DIE. -@@ -745,6 +770,9 @@ class Dwarf_info_reader - inline typename elfcpp::Valtype_base::Valtype - read_from_pointer(const unsigned char** source); - -+ inline typename elfcpp::Valtype_base<32>::Valtype -+ read_3bytes_from_pointer(const unsigned char** source); -+ - // Look for a relocation at offset ATTR_OFF in the dwarf info, - // and return the section index and offset of the target. - unsigned int -@@ -818,12 +846,20 @@ class Dwarf_info_reader - Dwarf_range_list* - read_range_list(unsigned int ranges_shndx, off_t ranges_offset) - { -- return this->ranges_table_.read_range_list(this->object_, -- this->symtab_, -- this->symtab_size_, -- this->address_size_, -- ranges_shndx, -- ranges_offset); -+ if (this->cu_version_ < 5) -+ return this->ranges_table_.read_range_list(this->object_, -+ this->symtab_, -+ this->symtab_size_, -+ this->address_size_, -+ ranges_shndx, -+ ranges_offset); -+ else -+ return this->ranges_table_.read_range_list_v5(this->object_, -+ this->symtab_, -+ this->symtab_size_, -+ this->address_size_, -+ ranges_shndx, -+ ranges_offset); - } - - // Return the object. -@@ -873,8 +909,8 @@ class Dwarf_info_reader - bool - do_read_string_table(unsigned int string_shndx); - -- // True if this is a type unit; false for a compilation unit. -- bool is_type_unit_; -+ // The unit type (DW_UT_xxx). -+ unsigned int unit_type_; - // The object containing the .debug_info or .debug_types input section. - Relobj* object_; - // The ELF symbol table. -@@ -1008,6 +1044,8 @@ class Sized_dwarf_line_info : public Dwarf_line_info - { - if (this->buffer_start_ != NULL) - delete[] this->buffer_start_; -+ if (this->str_buffer_start_ != NULL) -+ delete[] this->str_buffer_start_; - } - - private: -@@ -1030,19 +1068,23 @@ class Sized_dwarf_line_info : public Dwarf_line_info - void - read_relocs(); - -- // Reads the DWARF2/3 header for this line info. Each takes as input -+ // Reads the DWARF header for this line info. Each takes as input - // a starting buffer position, and returns the ending position. - const unsigned char* - read_header_prolog(const unsigned char* lineptr); - - const unsigned char* -- read_header_tables(const unsigned char* lineptr); -+ read_header_tables_v2(const unsigned char* lineptr); -+ -+ const unsigned char* -+ read_header_tables_v5(const unsigned char* lineptr); - -- // Reads the DWARF2/3 line information. If shndx is non-negative, -+ // Reads the DWARF line information. If shndx is non-negative, - // discard all line information that doesn't pertain to the given - // section. - const unsigned char* -- read_lines(const unsigned char* lineptr, unsigned int shndx); -+ read_lines(const unsigned char* lineptr, const unsigned char* endptr, -+ unsigned int shndx); - - // Process a single line info opcode at START using the state - // machine at LSM. Return true if we should define a line using the -@@ -1069,6 +1111,7 @@ class Sized_dwarf_line_info : public Dwarf_line_info - { - off_t total_length; - int version; -+ int address_size; - off_t prologue_length; - int min_insn_length; // insn stands for instruction - int max_ops_per_insn; // Added in DWARF-4. -@@ -1089,6 +1132,20 @@ class Sized_dwarf_line_info : public Dwarf_line_info - // of the buffer. - const unsigned char* buffer_start_; - -+ // str_buffer is the buffer for the line table strings. -+ const unsigned char* str_buffer_; -+ const unsigned char* str_buffer_end_; -+ // If the buffer was allocated temporarily, and therefore must be -+ // deallocated in the dtor, this contains a pointer to the start -+ // of the buffer. -+ const unsigned char* str_buffer_start_; -+ -+ // Pointer to the end of the header_length field (aka prologue_length). -+ const unsigned char* end_of_header_length_; -+ -+ // Pointer to the end of the current compilation unit. -+ const unsigned char* end_of_unit_; -+ - // This has relocations that point into buffer. - Sized_elf_reloc_mapper* reloc_mapper_; - // The type of the reloc section in track_relocs_--SHT_REL or SHT_RELA. diff --git a/recipes-devtools/binutils/binutils/CVE-2021-20197.patch b/recipes-devtools/binutils/binutils/CVE-2021-20197.patch deleted file mode 100644 index d6117b6..0000000 --- a/recipes-devtools/binutils/binutils/CVE-2021-20197.patch +++ /dev/null @@ -1,388 +0,0 @@ -From d3edaa91d4cf7202ec14342410194841e2f67f12 Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Fri, 26 Feb 2021 11:30:32 +1030 -Subject: [PATCH] Reinstate various pieces backed out from smart_rename changes - -In the interests of a stable release various last minute smart_rename -patches were backed out of the 2.36 branch. The main reason to -reinstate some of those backed out changes here is to make necessary -followup fixes to commit 8e03235147a9 simple cherry-picks from -mainline. A secondary reason is that ar -M support isn't fixed for -pr26945 without this patch. - - PR 26945 - * ar.c: Don't include libbfd.h. - (write_archive): Replace xmalloc+strcpy with xstrdup. - * arsup.c (temp_name, real_ofd): New static variables. - (ar_open): Use make_tempname and bfd_fdopenw. - (ar_save): Adjust to suit ar_open changes. - * objcopy.c: Don't include libbfd.h. - * rename.c: Rename and reorder variables. - -(cherry picked from commit 95b91a043aeaeb546d2fea556d84a2de1e917770) - -Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d3edaa91d4cf7202ec14342410194841e2f67f12] -CVE: CVE-2021-20197 -Signed-off-by: Vinay Kumar ---- - binutils/ar.c | 6 +- - binutils/arsup.c | 37 ++++++++---- - binutils/bucomm.h | 3 +- - binutils/objcopy.c | 9 +-- - binutils/rename.c | 148 +++++++++++---------------------------------- - 5 files changed, 67 insertions(+), 136 deletions(-) - -diff --git a/binutils/ar.c b/binutils/ar.c -index 45a34e3a6cf..44df48c5c67 100644 ---- a/binutils/ar.c -+++ b/binutils/ar.c -@@ -25,7 +25,6 @@ - - #include "sysdep.h" - #include "bfd.h" --#include "libbfd.h" - #include "libiberty.h" - #include "progress.h" - #include "getopt.h" -@@ -1255,8 +1254,7 @@ write_archive (bfd *iarch) - bfd *contents_head = iarch->archive_next; - int ofd = -1; - -- old_name = (char *) xmalloc (strlen (bfd_get_filename (iarch)) + 1); -- strcpy (old_name, bfd_get_filename (iarch)); -+ old_name = xstrdup (bfd_get_filename (iarch)); - new_name = make_tempname (old_name, &ofd); - - if (new_name == NULL) -@@ -1308,7 +1306,7 @@ write_archive (bfd *iarch) - /* We don't care if this fails; we might be creating the archive. */ - bfd_close (iarch); - -- if (smart_rename (new_name, old_name, 0) != 0) -+ if (smart_rename (new_name, old_name, NULL) != 0) - xexit (1); - free (old_name); - free (new_name); -diff --git a/binutils/arsup.c b/binutils/arsup.c -index 5403a0c5d74..f7ce8f0bc82 100644 ---- a/binutils/arsup.c -+++ b/binutils/arsup.c -@@ -42,6 +42,8 @@ extern int deterministic; - - static bfd *obfd; - static char *real_name; -+static char *temp_name; -+static int real_ofd; - static FILE *outfile; - - static void -@@ -149,27 +151,24 @@ maybequit (void) - void - ar_open (char *name, int t) - { -- char *tname; -- const char *bname = lbasename (name); -- real_name = name; -+ real_name = xstrdup (name); -+ temp_name = make_tempname (real_name, &real_ofd); - -- /* Prepend tmp- to the beginning, to avoid file-name clashes after -- truncation on filesystems with limited namespaces (DOS). */ -- if (asprintf (&tname, "%.*stmp-%s", (int) (bname - name), name, bname) == -1) -+ if (temp_name == NULL) - { -- fprintf (stderr, _("%s: Can't allocate memory for temp name (%s)\n"), -+ fprintf (stderr, _("%s: Can't open temporary file (%s)\n"), - program_name, strerror(errno)); - maybequit (); - return; - } - -- obfd = bfd_openw (tname, NULL); -+ obfd = bfd_fdopenw (temp_name, NULL, real_ofd); - - if (!obfd) - { - fprintf (stderr, - _("%s: Can't open output archive %s\n"), -- program_name, tname); -+ program_name, temp_name); - - maybequit (); - } -@@ -344,16 +343,30 @@ ar_save (void) - } - else - { -- char *ofilename = xstrdup (bfd_get_filename (obfd)); -+ struct stat target_stat; - - if (deterministic > 0) - obfd->flags |= BFD_DETERMINISTIC_OUTPUT; - - bfd_close (obfd); - -- smart_rename (ofilename, real_name, 0); -+ if (stat (real_name, &target_stat) != 0) -+ { -+ /* The temp file created in ar_open has mode 0600 as per mkstemp. -+ Create the real empty output file here so smart_rename will -+ update the mode according to the process umask. */ -+ obfd = bfd_openw (real_name, NULL); -+ if (obfd != NULL) -+ { -+ bfd_set_format (obfd, bfd_archive); -+ bfd_close (obfd); -+ } -+ } -+ -+ smart_rename (temp_name, real_name, NULL); - obfd = 0; -- free (ofilename); -+ free (temp_name); -+ free (real_name); - } - } - -diff --git a/binutils/bucomm.h b/binutils/bucomm.h -index 91f6a5b228f..aa7e33d8cd1 100644 ---- a/binutils/bucomm.h -+++ b/binutils/bucomm.h -@@ -71,7 +71,8 @@ extern void print_version (const char *); - /* In rename.c. */ - extern void set_times (const char *, const struct stat *); - --extern int smart_rename (const char *, const char *, int); -+extern int smart_rename (const char *, const char *, struct stat *); -+ - - /* In libiberty. */ - void *xmalloc (size_t); -diff --git a/binutils/objcopy.c b/binutils/objcopy.c -index eab3b6db585..73aa8bc2514 100644 ---- a/binutils/objcopy.c -+++ b/binutils/objcopy.c -@@ -20,7 +20,6 @@ - - #include "sysdep.h" - #include "bfd.h" --#include "libbfd.h" - #include "progress.h" - #include "getopt.h" - #include "libiberty.h" -@@ -4861,12 +4860,10 @@ strip_main (int argc, char *argv[]) - output_target, NULL); - if (status == 0) - { -- if (preserve_dates) -- set_times (tmpname, &statbuf); - if (output_file != tmpname) - status = (smart_rename (tmpname, - output_file ? output_file : argv[i], -- preserve_dates) != 0); -+ preserve_dates ? &statbuf : NULL) != 0); - if (status == 0) - status = hold_status; - } -@@ -5931,11 +5928,9 @@ copy_main (int argc, char *argv[]) - output_target, input_arch); - if (status == 0) - { -- if (preserve_dates) -- set_times (tmpname, &statbuf); - if (tmpname != output_filename) - status = (smart_rename (tmpname, input_filename, -- preserve_dates) != 0); -+ preserve_dates ? &statbuf : NULL) != 0); - } - else - unlink_if_ordinary (tmpname); -diff --git a/binutils/rename.c b/binutils/rename.c -index 65ad5bf52c4..72a9323d72c 100644 ---- a/binutils/rename.c -+++ b/binutils/rename.c -@@ -24,14 +24,9 @@ - - #ifdef HAVE_GOOD_UTIME_H - #include --#else /* ! HAVE_GOOD_UTIME_H */ --#ifdef HAVE_UTIMES -+#elif defined HAVE_UTIMES - #include --#endif /* HAVE_UTIMES */ --#endif /* ! HAVE_GOOD_UTIME_H */ -- --#if ! defined (_WIN32) || defined (__CYGWIN32__) --static int simple_copy (const char *, const char *); -+#endif - - /* The number of bytes to copy at once. */ - #define COPY_BUF 8192 -@@ -82,7 +77,6 @@ simple_copy (const char *from, const char *to) - } - return 0; - } --#endif /* __CYGWIN32__ or not _WIN32 */ - - /* Set the times of the file DESTINATION to be the same as those in - STATBUF. */ -@@ -91,122 +85,52 @@ void - set_times (const char *destination, const struct stat *statbuf) - { - int result; -- -- { - #ifdef HAVE_GOOD_UTIME_H -- struct utimbuf tb; -- -- tb.actime = statbuf->st_atime; -- tb.modtime = statbuf->st_mtime; -- result = utime (destination, &tb); --#else /* ! HAVE_GOOD_UTIME_H */ --#ifndef HAVE_UTIMES -- long tb[2]; -- -- tb[0] = statbuf->st_atime; -- tb[1] = statbuf->st_mtime; -- result = utime (destination, tb); --#else /* HAVE_UTIMES */ -- struct timeval tv[2]; -- -- tv[0].tv_sec = statbuf->st_atime; -- tv[0].tv_usec = 0; -- tv[1].tv_sec = statbuf->st_mtime; -- tv[1].tv_usec = 0; -- result = utimes (destination, tv); --#endif /* HAVE_UTIMES */ --#endif /* ! HAVE_GOOD_UTIME_H */ -- } -+ struct utimbuf tb; -+ -+ tb.actime = statbuf->st_atime; -+ tb.modtime = statbuf->st_mtime; -+ result = utime (destination, &tb); -+#elif defined HAVE_UTIMES -+ struct timeval tv[2]; -+ -+ tv[0].tv_sec = statbuf->st_atime; -+ tv[0].tv_usec = 0; -+ tv[1].tv_sec = statbuf->st_mtime; -+ tv[1].tv_usec = 0; -+ result = utimes (destination, tv); -+#else -+ long tb[2]; -+ -+ tb[0] = statbuf->st_atime; -+ tb[1] = statbuf->st_mtime; -+ result = utime (destination, tb); -+#endif - - if (result != 0) - non_fatal (_("%s: cannot set time: %s"), destination, strerror (errno)); - } - --#ifndef S_ISLNK --#ifdef S_IFLNK --#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) --#else --#define S_ISLNK(m) 0 --#define lstat stat --#endif --#endif -- --/* Rename FROM to TO, copying if TO is a link. -- Return 0 if ok, -1 if error. */ -+/* Copy FROM to TO. TARGET_STAT has the file status that, if non-NULL, -+ is used to fix up timestamps. Return 0 if ok, -1 if error. -+ At one time this function renamed files, but file permissions are -+ tricky to update given the number of different schemes used by -+ various systems. So now we just copy. */ - - int --smart_rename (const char *from, const char *to, int preserve_dates ATTRIBUTE_UNUSED) -+smart_rename (const char *from, const char *to, -+ struct stat *target_stat) - { -- bfd_boolean exists; -- struct stat s; -- int ret = 0; -- -- exists = lstat (to, &s) == 0; -- --#if defined (_WIN32) && !defined (__CYGWIN32__) -- /* Win32, unlike unix, will not erase `to' in `rename(from, to)' but -- fail instead. Also, chown is not present. */ -+ int ret; - -- if (exists) -- remove (to); -- -- ret = rename (from, to); -+ ret = simple_copy (from, to); - if (ret != 0) -- { -- /* We have to clean up here. */ -- non_fatal (_("unable to rename '%s'; reason: %s"), to, strerror (errno)); -- unlink (from); -- } --#else -- /* Use rename only if TO is not a symbolic link and has -- only one hard link, and we have permission to write to it. */ -- if (! exists -- || (!S_ISLNK (s.st_mode) -- && S_ISREG (s.st_mode) -- && (s.st_mode & S_IWUSR) -- && s.st_nlink == 1) -- ) -- { -- ret = rename (from, to); -- if (ret == 0) -- { -- if (exists) -- { -- /* Try to preserve the permission bits and ownership of -- TO. First get the mode right except for the setuid -- bit. Then change the ownership. Then fix the setuid -- bit. We do the chmod before the chown because if the -- chown succeeds, and we are a normal user, we won't be -- able to do the chmod afterward. We don't bother to -- fix the setuid bit first because that might introduce -- a fleeting security problem, and because the chown -- will clear the setuid bit anyhow. We only fix the -- setuid bit if the chown succeeds, because we don't -- want to introduce an unexpected setuid file owned by -- the user running objcopy. */ -- chmod (to, s.st_mode & 0777); -- if (chown (to, s.st_uid, s.st_gid) >= 0) -- chmod (to, s.st_mode & 07777); -- } -- } -- else -- { -- /* We have to clean up here. */ -- non_fatal (_("unable to rename '%s'; reason: %s"), to, strerror (errno)); -- unlink (from); -- } -- } -- else -- { -- ret = simple_copy (from, to); -- if (ret != 0) -- non_fatal (_("unable to copy file '%s'; reason: %s"), to, strerror (errno)); -+ non_fatal (_("unable to copy file '%s'; reason: %s"), -+ to, strerror (errno)); - -- if (preserve_dates) -- set_times (to, &s); -- unlink (from); -- } --#endif /* _WIN32 && !__CYGWIN32__ */ -+ if (target_stat != NULL) -+ set_times (to, target_stat); -+ unlink (from); - - return ret; - } --- -2.17.1 - diff --git a/recipes-devtools/gcc/gcc-arc.inc b/recipes-devtools/gcc/gcc-arc.inc index 347a579..9a536ed 100644 --- a/recipes-devtools/gcc/gcc-arc.inc +++ b/recipes-devtools/gcc/gcc-arc.inc @@ -6,7 +6,7 @@ PV = "arc" # BINV should be incremented to a revision after a minor gcc release -BINV = "10.2.0" +BINV = "11.2.1" FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc-arc:" @@ -23,25 +23,20 @@ LIC_FILES_CHKSUM = "\ file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8 \ " -RELEASE ?= "arc-2021.03" +RELEASE ?= "arc-2022.03" BASEURI ?= "git://github.com/foss-for-synopsys-dwc-arc-processors/gcc.git;protocol=https;branch=${RELEASE}" -SRCREV ?= "${RELEASE}-release" +# SRCREV tagged arc-2022.03-release +SRCREV ?= "a01d12e8814c89cd1e131f69a417458ab96e3a21" SRC_URI = "\ ${BASEURI} \ file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \ file://0002-gcc-poison-system-directories.patch \ - file://0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \ file://0004-64-bit-multilib-hack.patch \ - file://0005-optional-libstdc.patch \ - file://0006-COLLECT_GCC_OPTIONS.patch \ file://0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \ - file://0008-fortran-cross-compile-hack.patch \ file://0009-cpp-honor-sysroot.patch \ - file://0010-MIPS64-Default-to-N64-ABI.patch \ file://0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \ file://0012-gcc-Fix-argument-list-too-long-error.patch \ - file://0013-Disable-sdt.patch \ file://0014-libtool.patch \ file://0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \ file://0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch \ @@ -49,30 +44,24 @@ SRC_URI = "\ file://0018-export-CPP.patch \ file://0019-Ensure-target-gcc-headers-can-be-included.patch \ file://0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch \ - file://0021-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch \ - file://0022-aarch64-Add-support-for-musl-ldso.patch \ file://0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch \ file://0024-handle-sysroot-support-for-nativesdk-gcc.patch \ file://0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch \ - file://0026-Fix-various-_FOR_BUILD-and-related-variables.patch \ file://0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch \ file://0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch \ file://0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \ file://0030-sync-gcc-stddef.h-with-musl.patch \ - file://0031-fix-segmentation-fault-in-precompiled-header-generat.patch \ - file://0032-Fix-for-testsuite-failure.patch \ file://0033-Re-introduce-spe-commandline-options.patch \ file://0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \ file://0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch \ file://0036-mingw32-Enable-operation_not_supported.patch \ file://0037-libatomic-Do-not-enforce-march-on-aarch64.patch \ - file://0001-aarch64-New-Straight-Line-Speculation-SLS-mitigation.patch \ - file://0002-aarch64-Introduce-SLS-mitigation-for-RET-and-BR-inst.patch \ - file://0003-aarch64-Mitigate-SLS-for-BLR-instruction.patch \ - file://0001-aarch64-Fix-up-__aarch64_cas16_acq_rel-fallback.patch \ - file://0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch \ + file://0041-apply-debug-prefix-maps-before-checksumming-DIEs.patch \ + file://0006-If-CXXFLAGS-contains-something-unsupported-by-the-bu.patch \ + file://0001-Fix-install-path-of-linux64.h.patch \ " + S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/git" B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}" @@ -87,6 +76,7 @@ EXTRA_OECONF_BASE = "\ ${SSP} \ --enable-libitm \ --enable-lto \ + --enable-tls \ --disable-bootstrap \ --with-system-zlib \ ${@'--with-linker-hash-style=${LINKER_HASH_STYLE}' if '${LINKER_HASH_STYLE}' else ''} \ @@ -104,6 +94,7 @@ EXTRA_OECONF_INITIAL = "\ --disable-libquadmath \ --with-system-zlib \ --disable-lto \ + --enable-tls \ --disable-plugin \ --enable-linker-build-id \ --enable-decimal-float=no \ diff --git a/recipes-devtools/gcc/gcc-arc/0001-CVE-2021-35465.patch b/recipes-devtools/gcc/gcc-arc/0001-CVE-2021-35465.patch new file mode 100644 index 0000000..e4aee10 --- /dev/null +++ b/recipes-devtools/gcc/gcc-arc/0001-CVE-2021-35465.patch @@ -0,0 +1,138 @@ +From 3929bca9ca95de9d35e82ae8828b188029e3eb70 Mon Sep 17 00:00:00 2001 +From: Richard Earnshaw +Date: Fri, 11 Jun 2021 16:02:05 +0100 +Subject: [PATCH] arm: Add command-line option for enabling CVE-2021-35465 + mitigation [PR102035] + +Add a new option, -mfix-cmse-cve-2021-35465 and document it. Enable it +automatically for cortex-m33, cortex-m35p and cortex-m55. + +gcc: + PR target/102035 + * config/arm/arm.opt (mfix-cmse-cve-2021-35465): New option. + * doc/invoke.texi (Arm Options): Document it. + * config/arm/arm-cpus.in (quirk_vlldm): New feature bit. + (ALL_QUIRKS): Add quirk_vlldm. + (cortex-m33): Add quirk_vlldm. + (cortex-m35p, cortex-m55): Likewise. + * config/arm/arm.c (arm_option_override): Enable fix_vlldm if + targetting an affected CPU and not explicitly controlled on + the command line. + +CVE: CVE-2021-35465 +Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=3929bca9ca95de9d35e82ae8828b188029e3eb70] +Signed-off-by: Pgowda + +--- + gcc/config/arm/arm-cpus.in | 9 +++++++-- + gcc/config/arm/arm.c | 9 +++++++++ + gcc/config/arm/arm.opt | 4 ++++ + gcc/doc/invoke.texi | 9 +++++++++ + 4 files changed, 29 insertions(+), 2 deletions(-) + +diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c +--- a/gcc/config/arm/arm.c 2021-11-15 02:13:11.100579812 -0800 ++++ b/gcc/config/arm/arm.c 2021-11-15 02:17:36.988237692 -0800 +@@ -3610,6 +3610,15 @@ arm_option_override (void) + fix_cm3_ldrd = 0; + } + ++ /* Enable fix_vlldm by default if required. */ ++ if (fix_vlldm == 2) ++ { ++ if (bitmap_bit_p (arm_active_target.isa, isa_bit_quirk_vlldm)) ++ fix_vlldm = 1; ++ else ++ fix_vlldm = 0; ++ } ++ + /* Hot/Cold partitioning is not currently supported, since we can't + handle literal pool placement in that case. */ + if (flag_reorder_blocks_and_partition) +diff --git a/gcc/config/arm/arm-cpus.in b/gcc/config/arm/arm-cpus.in +--- a/gcc/config/arm/arm-cpus.in 2021-11-15 02:13:11.104579747 -0800 ++++ b/gcc/config/arm/arm-cpus.in 2021-11-15 02:17:36.984237757 -0800 +@@ -186,6 +186,9 @@ define feature quirk_armv6kz + # Cortex-M3 LDRD quirk. + define feature quirk_cm3_ldrd + ++# v8-m/v8.1-m VLLDM errata. ++define feature quirk_vlldm ++ + # Don't use .cpu assembly directive + define feature quirk_no_asmcpu + +@@ -322,7 +325,7 @@ define implied vfp_base MVE MVE_FP ALL_F + # architectures. + # xscale isn't really a 'quirk', but it isn't an architecture either and we + # need to ignore it for matching purposes. +-define fgroup ALL_QUIRKS quirk_no_volatile_ce quirk_armv6kz quirk_cm3_ldrd xscale quirk_no_asmcpu ++define fgroup ALL_QUIRKS quirk_no_volatile_ce quirk_armv6kz quirk_cm3_ldrd quirk_vlldm xscale quirk_no_asmcpu + + define fgroup IGNORE_FOR_MULTILIB cdecp0 cdecp1 cdecp2 cdecp3 cdecp4 cdecp5 cdecp6 cdecp7 + +@@ -1570,6 +1573,7 @@ begin cpu cortex-m33 + architecture armv8-m.main+dsp+fp + option nofp remove ALL_FP + option nodsp remove armv7em ++ isa quirk_vlldm + costs v7m + end cpu cortex-m33 + +@@ -1579,6 +1583,7 @@ begin cpu cortex-m35p + architecture armv8-m.main+dsp+fp + option nofp remove ALL_FP + option nodsp remove armv7em ++ isa quirk_vlldm + costs v7m + end cpu cortex-m35p + +@@ -1590,7 +1595,7 @@ begin cpu cortex-m55 + option nomve remove mve mve_float + option nofp remove ALL_FP mve_float + option nodsp remove MVE mve_float +- isa quirk_no_asmcpu ++ isa quirk_no_asmcpu quirk_vlldm + costs v7m + vendor 41 + end cpu cortex-m55 +diff --git a/gcc/config/arm/arm.opt b/gcc/config/arm/arm.opt +--- a/gcc/config/arm/arm.opt 2021-11-15 02:13:11.104579747 -0800 ++++ b/gcc/config/arm/arm.opt 2021-11-15 02:17:36.988237692 -0800 +@@ -268,6 +268,10 @@ Target Var(fix_cm3_ldrd) Init(2) + Avoid overlapping destination and address registers on LDRD instructions + that may trigger Cortex-M3 errata. + ++mfix-cmse-cve-2021-35465 ++Target Var(fix_vlldm) Init(2) ++Mitigate issues with VLLDM on some M-profile devices (CVE-2021-35465). ++ + munaligned-access + Target Var(unaligned_access) Init(2) Save + Enable unaligned word and halfword accesses to packed data. +diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi +--- a/gcc/doc/invoke.texi 2021-11-15 02:13:11.112579616 -0800 ++++ b/gcc/doc/invoke.texi 2021-11-15 02:17:36.996237562 -0800 +@@ -804,6 +804,7 @@ Objective-C and Objective-C++ Dialects}. + -mverbose-cost-dump @gol + -mpure-code @gol + -mcmse @gol ++-mfix-cmse-cve-2021-35465 @gol + -mfdpic} + + @emph{AVR Options} +@@ -20487,6 +20488,14 @@ Generate secure code as per the "ARMv8-M + Development Tools Engineering Specification", which can be found on + @url{https://developer.arm.com/documentation/ecm0359818/latest/}. + ++@item -mfix-cmse-cve-2021-35465 ++@opindex mfix-cmse-cve-2021-35465 ++Mitigate against a potential security issue with the @code{VLLDM} instruction ++in some M-profile devices when using CMSE (CVE-2021-365465). This option is ++enabled by default when the option @option{-mcpu=} is used with ++@code{cortex-m33}, @code{cortex-m35p} or @code{cortex-m55}. The option ++@option{-mno-fix-cmse-cve-2021-35465} can be used to disable the mitigation. ++ + @item -mfdpic + @itemx -mno-fdpic + @opindex mfdpic diff --git a/recipes-devtools/gcc/gcc-arc/0001-CVE-2021-42574.patch b/recipes-devtools/gcc/gcc-arc/0001-CVE-2021-42574.patch new file mode 100644 index 0000000..4d680cc --- /dev/null +++ b/recipes-devtools/gcc/gcc-arc/0001-CVE-2021-42574.patch @@ -0,0 +1,2282 @@ +From bd5e882cf6e0def3dd1bc106075d59a303fe0d1e Mon Sep 17 00:00:00 2001 +From: David Malcolm +Date: Mon, 18 Oct 2021 18:55:31 -0400 +Subject: [PATCH] diagnostics: escape non-ASCII source bytes for certain + diagnostics +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf8 +Content-Transfer-Encoding: 8bit + +This patch adds support to GCC's diagnostic subsystem for escaping certain +bytes and Unicode characters when quoting source code. + +Specifically, this patch adds a new flag rich_location::m_escape_on_output +which is a hint from a diagnostic that non-ASCII bytes in the pertinent +lines of the user's source code should be escaped when printed. + +The patch sets this for the following diagnostics: +- when complaining about stray bytes in the program (when these +are non-printable) +- when complaining about "null character(s) ignored"); +- for -Wnormalized= (and generate source ranges for such warnings) + +The escaping is controlled by a new option: + -fdiagnostics-escape-format=[unicode|bytes] + +For example, consider a diagnostic involing a source line containing the +string "before" followed by the Unicode character U+03C0 ("GREEK SMALL +LETTER PI", with UTF-8 encoding 0xCF 0x80) followed by the byte 0xBF +(a stray UTF-8 trailing byte), followed by the string "after", where the +diagnostic highlights the U+03C0 character. + +By default, this line will be printed verbatim to the user when +reporting a diagnostic at it, as: + + beforeÏXafter + ^ + +(using X for the stray byte to avoid putting invalid UTF-8 in this +commit message) + +If the diagnostic sets the "escape" flag, it will be printed as: + + beforeafter + ^~~~~~~~ + +with -fdiagnostics-escape-format=unicode (the default), or as: + + before<80>after + ^~~~~~~~ + +if the user supplies -fdiagnostics-escape-format=bytes. + +This only affects how the source is printed; it does not affect +how column numbers that are printed (as per -fdiagnostics-column-unit= +and -fdiagnostics-column-origin=). + +gcc/c-family/ChangeLog: + * c-lex.c (c_lex_with_flags): When complaining about non-printable + CPP_OTHER tokens, set the "escape on output" flag. + +gcc/ChangeLog: + * common.opt (fdiagnostics-escape-format=): New. + (diagnostics_escape_format): New enum. + (DIAGNOSTICS_ESCAPE_FORMAT_UNICODE): New enum value. + (DIAGNOSTICS_ESCAPE_FORMAT_BYTES): Likewise. + * diagnostic-format-json.cc (json_end_diagnostic): Add + "escape-source" attribute. + * diagnostic-show-locus.c + (exploc_with_display_col::exploc_with_display_col): Replace + "tabstop" param with a cpp_char_column_policy and add an "aspect" + param. Use these to compute m_display_col accordingly. + (struct char_display_policy): New struct. + (layout::m_policy): New field. + (layout::m_escape_on_output): New field. + (def_policy): New function. + (make_range): Update for changes to exploc_with_display_col ctor. + (default_print_decoded_ch): New. + (width_per_escaped_byte): New. + (escape_as_bytes_width): New. + (escape_as_bytes_print): New. + (escape_as_unicode_width): New. + (escape_as_unicode_print): New. + (make_policy): New. + (layout::layout): Initialize new fields. Update m_exploc ctor + call for above change to ctor. + (layout::maybe_add_location_range): Update for changes to + exploc_with_display_col ctor. + (layout::calculate_x_offset_display): Update for change to + cpp_display_width. + (layout::print_source_line): Pass policy + to cpp_display_width_computation. Capture cpp_decoded_char when + calling process_next_codepoint. Move printing of source code to + m_policy.m_print_cb. + (line_label::line_label): Pass in policy rather than context. + (layout::print_any_labels): Update for change to line_label ctor. + (get_affected_range): Pass in policy rather than context, updating + calls to location_compute_display_column accordingly. + (get_printed_columns): Likewise, also for cpp_display_width. + (correction::correction): Pass in policy rather than tabstop. + (correction::compute_display_cols): Pass m_policy rather than + m_tabstop to cpp_display_width. + (correction::m_tabstop): Replace with... + (correction::m_policy): ...this. + (line_corrections::line_corrections): Pass in policy rather than + context. + (line_corrections::m_context): Replace with... + (line_corrections::m_policy): ...this. + (line_corrections::add_hint): Update to use m_policy rather than + m_context. + (line_corrections::add_hint): Likewise. + (layout::print_trailing_fixits): Likewise. + (selftest::test_display_widths): New. + (selftest::test_layout_x_offset_display_utf8): Update to use + policy rather than tabstop. + (selftest::test_one_liner_labels_utf8): Add test of escaping + source lines. + (selftest::test_diagnostic_show_locus_one_liner_utf8): Update to + use policy rather than tabstop. + (selftest::test_overlapped_fixit_printing): Likewise. + (selftest::test_overlapped_fixit_printing_utf8): Likewise. + (selftest::test_overlapped_fixit_printing_2): Likewise. + (selftest::test_tab_expansion): Likewise. + (selftest::test_escaping_bytes_1): New. + (selftest::test_escaping_bytes_2): New. + (selftest::diagnostic_show_locus_c_tests): Call the new tests. + * diagnostic.c (diagnostic_initialize): Initialize + context->escape_format. + (convert_column_unit): Update to use default character width policy. + (selftest::test_diagnostic_get_location_text): Likewise. + * diagnostic.h (enum diagnostics_escape_format): New enum. + (diagnostic_context::escape_format): New field. + * doc/invoke.texi (-fdiagnostics-escape-format=): New option. + (-fdiagnostics-format=): Add "escape-source" attribute to examples + of JSON output, and document it. + * input.c (location_compute_display_column): Pass in "policy" + rather than "tabstop", passing to + cpp_byte_column_to_display_column. + (selftest::test_cpp_utf8): Update to use cpp_char_column_policy. + * input.h (class cpp_char_column_policy): New forward decl. + (location_compute_display_column): Pass in "policy" rather than + "tabstop". + * opts.c (common_handle_option): Handle + OPT_fdiagnostics_escape_format_. + * selftest.c (temp_source_file::temp_source_file): New ctor + overload taking a size_t. + * selftest.h (temp_source_file::temp_source_file): Likewise. + +gcc/testsuite/ChangeLog: + * c-c++-common/diagnostic-format-json-1.c: Add regexp to consume + "escape-source" attribute. + * c-c++-common/diagnostic-format-json-2.c: Likewise. + * c-c++-common/diagnostic-format-json-3.c: Likewise. + * c-c++-common/diagnostic-format-json-4.c: Likewise, twice. + * c-c++-common/diagnostic-format-json-5.c: Likewise. + * gcc.dg/cpp/warn-normalized-4-bytes.c: New test. + * gcc.dg/cpp/warn-normalized-4-unicode.c: New test. + * gcc.dg/encoding-issues-bytes.c: New test. + * gcc.dg/encoding-issues-unicode.c: New test. + * gfortran.dg/diagnostic-format-json-1.F90: Add regexp to consume + "escape-source" attribute. + * gfortran.dg/diagnostic-format-json-2.F90: Likewise. + * gfortran.dg/diagnostic-format-json-3.F90: Likewise. + +libcpp/ChangeLog: + * charset.c (convert_escape): Use encoding_rich_location when + complaining about nonprintable unknown escape sequences. + (cpp_display_width_computation::::cpp_display_width_computation): + Pass in policy rather than tabstop. + (cpp_display_width_computation::process_next_codepoint): Add "out" + param and populate *out if non-NULL. + (cpp_display_width_computation::advance_display_cols): Pass NULL + to process_next_codepoint. + (cpp_byte_column_to_display_column): Pass in policy rather than + tabstop. Pass NULL to process_next_codepoint. + (cpp_display_column_to_byte_column): Pass in policy rather than + tabstop. + * errors.c (cpp_diagnostic_get_current_location): New function, + splitting out the logic from... + (cpp_diagnostic): ...here. + (cpp_warning_at): New function. + (cpp_pedwarning_at): New function. + * include/cpplib.h (cpp_warning_at): New decl for rich_location. + (cpp_pedwarning_at): Likewise. + (struct cpp_decoded_char): New. + (struct cpp_char_column_policy): New. + (cpp_display_width_computation::cpp_display_width_computation): + Replace "tabstop" param with "policy". + (cpp_display_width_computation::process_next_codepoint): Add "out" + param. + (cpp_display_width_computation::m_tabstop): Replace with... + (cpp_display_width_computation::m_policy): ...this. + (cpp_byte_column_to_display_column): Replace "tabstop" param with + "policy". + (cpp_display_width): Likewise. + (cpp_display_column_to_byte_column): Likewise. + * include/line-map.h (rich_location::escape_on_output_p): New. + (rich_location::set_escape_on_output): New. + (rich_location::m_escape_on_output): New. + * internal.h (cpp_diagnostic_get_current_location): New decl. + (class encoding_rich_location): New. + * lex.c (skip_whitespace): Use encoding_rich_location when + complaining about null characters. + (warn_about_normalization): Generate a source range when + complaining about improperly normalized tokens, rather than just a + point, and use encoding_rich_location so that the source code + is escaped on printing. + * line-map.c (rich_location::rich_location): Initialize + m_escape_on_output. + +Signed-off-by: David Malcolm + +CVE: CVE-2021-42574 +Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=bd5e882cf6e0def3dd1bc106075d59a303fe0d1e] +Signed-off-by: Pgowda + +--- + gcc/c-family/c-lex.c | 6 +- + gcc/common.opt | 13 + + gcc/diagnostic-format-json.cc | 3 + + gcc/diagnostic-show-locus.c | 580 +++++++++++++++--- + gcc/diagnostic.c | 10 +- + gcc/diagnostic.h | 18 + + gcc/doc/invoke.texi | 43 +- + gcc/input.c | 62 +- + gcc/input.h | 7 +- + gcc/opts.c | 4 + + gcc/selftest.c | 15 + + gcc/selftest.h | 2 + + .../c-c++-common/diagnostic-format-json-1.c | 1 + + .../c-c++-common/diagnostic-format-json-2.c | 1 + + .../c-c++-common/diagnostic-format-json-3.c | 1 + + .../c-c++-common/diagnostic-format-json-4.c | 2 + + .../c-c++-common/diagnostic-format-json-5.c | 1 + + .../gcc.dg/cpp/warn-normalized-4-bytes.c | 21 + + .../gcc.dg/cpp/warn-normalized-4-unicode.c | 19 + + gcc/testsuite/gcc.dg/encoding-issues-bytes.c | Bin 0 -> 595 bytes + .../gcc.dg/encoding-issues-unicode.c | Bin 0 -> 613 bytes + .../gfortran.dg/diagnostic-format-json-1.F90 | 1 + + .../gfortran.dg/diagnostic-format-json-2.F90 | 1 + + .../gfortran.dg/diagnostic-format-json-3.F90 | 1 + + libcpp/charset.c | 63 +- + libcpp/errors.c | 82 ++- + libcpp/include/cpplib.h | 76 ++- + libcpp/include/line-map.h | 13 + + libcpp/internal.h | 23 + + libcpp/lex.c | 38 +- + libcpp/line-map.c | 3 +- + 31 files changed, 942 insertions(+), 168 deletions(-) + create mode 100644 gcc/testsuite/gcc.dg/cpp/warn-normalized-4-bytes.c + create mode 100644 gcc/testsuite/gcc.dg/cpp/warn-normalized-4-unicode.c + create mode 100644 gcc/testsuite/gcc.dg/encoding-issues-bytes.c + create mode 100644 gcc/testsuite/gcc.dg/encoding-issues-unicode.c + +diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c +--- a/gcc/c-family/c-lex.c 2021-07-27 23:55:06.980283060 -0700 ++++ b/gcc/c-family/c-lex.c 2021-12-14 01:16:01.541943272 -0800 +@@ -603,7 +603,11 @@ c_lex_with_flags (tree *value, location_ + else if (ISGRAPH (c)) + error_at (*loc, "stray %qc in program", (int) c); + else +- error_at (*loc, "stray %<\\%o%> in program", (int) c); ++ { ++ rich_location rich_loc (line_table, *loc); ++ rich_loc.set_escape_on_output (true); ++ error_at (&rich_loc, "stray %<\\%o%> in program", (int) c); ++ } + } + goto retry; + +diff --git a/gcc/common.opt b/gcc/common.opt +--- a/gcc/common.opt 2021-12-13 22:08:44.939137107 -0800 ++++ b/gcc/common.opt 2021-12-14 01:16:01.541943272 -0800 +@@ -1348,6 +1348,10 @@ fdiagnostics-format= + Common Joined RejectNegative Enum(diagnostics_output_format) + -fdiagnostics-format=[text|json] Select output format. + ++fdiagnostics-escape-format= ++Common Joined RejectNegative Enum(diagnostics_escape_format) ++-fdiagnostics-escape-format=[unicode|bytes] Select how to escape non-printable-ASCII bytes in the source for diagnostics that suggest it. ++ + ; Required for these enum values. + SourceInclude + diagnostic.h +@@ -1362,6 +1366,15 @@ EnumValue + Enum(diagnostics_column_unit) String(byte) Value(DIAGNOSTICS_COLUMN_UNIT_BYTE) + + Enum ++Name(diagnostics_escape_format) Type(int) ++ ++EnumValue ++Enum(diagnostics_escape_format) String(unicode) Value(DIAGNOSTICS_ESCAPE_FORMAT_UNICODE) ++ ++EnumValue ++Enum(diagnostics_escape_format) String(bytes) Value(DIAGNOSTICS_ESCAPE_FORMAT_BYTES) ++ ++Enum + Name(diagnostics_output_format) Type(int) + + EnumValue +diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c +--- a/gcc/diagnostic.c 2021-07-27 23:55:07.232286576 -0700 ++++ b/gcc/diagnostic.c 2021-12-14 01:16:01.545943202 -0800 +@@ -230,6 +230,7 @@ diagnostic_initialize (diagnostic_contex + context->column_unit = DIAGNOSTICS_COLUMN_UNIT_DISPLAY; + context->column_origin = 1; + context->tabstop = 8; ++ context->escape_format = DIAGNOSTICS_ESCAPE_FORMAT_UNICODE; + context->edit_context_ptr = NULL; + context->diagnostic_group_nesting_depth = 0; + context->diagnostic_group_emission_count = 0; +@@ -382,7 +383,10 @@ convert_column_unit (enum diagnostics_co + gcc_unreachable (); + + case DIAGNOSTICS_COLUMN_UNIT_DISPLAY: +- return location_compute_display_column (s, tabstop); ++ { ++ cpp_char_column_policy policy (tabstop, cpp_wcwidth); ++ return location_compute_display_column (s, policy); ++ } + + case DIAGNOSTICS_COLUMN_UNIT_BYTE: + return s.column; +@@ -2275,8 +2279,8 @@ test_diagnostic_get_location_text () + const char *const content = "smile \xf0\x9f\x98\x82\n"; + const int line_bytes = strlen (content) - 1; + const int def_tabstop = 8; +- const int display_width = cpp_display_width (content, line_bytes, +- def_tabstop); ++ const cpp_char_column_policy policy (def_tabstop, cpp_wcwidth); ++ const int display_width = cpp_display_width (content, line_bytes, policy); + ASSERT_EQ (line_bytes - 2, display_width); + temp_source_file tmp (SELFTEST_LOCATION, ".c", content); + const char *const fname = tmp.get_filename (); +diff --git a/gcc/diagnostic-format-json.cc b/gcc/diagnostic-format-json.cc +--- a/gcc/diagnostic-format-json.cc 2021-07-27 23:55:07.232286576 -0700 ++++ b/gcc/diagnostic-format-json.cc 2021-12-14 01:16:01.541943272 -0800 +@@ -264,6 +264,9 @@ json_end_diagnostic (diagnostic_context + json::value *path_value = context->make_json_for_path (context, path); + diag_obj->set ("path", path_value); + } ++ ++ diag_obj->set ("escape-source", ++ new json::literal (richloc->escape_on_output_p ())); + } + + /* No-op implementation of "begin_group_cb" for JSON output. */ +diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h +--- a/gcc/diagnostic.h 2021-07-27 23:55:07.236286632 -0700 ++++ b/gcc/diagnostic.h 2021-12-14 01:16:01.545943202 -0800 +@@ -38,6 +38,20 @@ enum diagnostics_column_unit + DIAGNOSTICS_COLUMN_UNIT_BYTE + }; + ++/* An enum for controlling how to print non-ASCII characters/bytes when ++ a diagnostic suggests escaping the source code on output. */ ++ ++enum diagnostics_escape_format ++{ ++ /* Escape non-ASCII Unicode characters in the form and ++ non-UTF-8 bytes in the form . */ ++ DIAGNOSTICS_ESCAPE_FORMAT_UNICODE, ++ ++ /* Escape non-ASCII bytes in the form (thus showing the underlying ++ encoding of non-ASCII Unicode characters). */ ++ DIAGNOSTICS_ESCAPE_FORMAT_BYTES ++}; ++ + /* Enum for overriding the standard output format. */ + + enum diagnostics_output_format +@@ -320,6 +334,10 @@ struct diagnostic_context + /* The size of the tabstop for tab expansion. */ + int tabstop; + ++ /* How should non-ASCII/non-printable bytes be escaped when ++ a diagnostic suggests escaping the source code on output. */ ++ enum diagnostics_escape_format escape_format; ++ + /* If non-NULL, an edit_context to which fix-it hints should be + applied, for generating patches. */ + edit_context *edit_context_ptr; +diff --git a/gcc/diagnostic-show-locus.c b/gcc/diagnostic-show-locus.c +--- a/gcc/diagnostic-show-locus.c 2021-07-27 23:55:07.232286576 -0700 ++++ b/gcc/diagnostic-show-locus.c 2021-12-14 01:16:01.545943202 -0800 +@@ -175,10 +175,26 @@ enum column_unit { + class exploc_with_display_col : public expanded_location + { + public: +- exploc_with_display_col (const expanded_location &exploc, int tabstop) +- : expanded_location (exploc), +- m_display_col (location_compute_display_column (exploc, tabstop)) +- {} ++ exploc_with_display_col (const expanded_location &exploc, ++ const cpp_char_column_policy &policy, ++ enum location_aspect aspect) ++ : expanded_location (exploc), ++ m_display_col (location_compute_display_column (exploc, policy)) ++ { ++ if (exploc.column > 0) ++ { ++ /* m_display_col is now the final column of the byte. ++ If escaping has happened, we may want the first column instead. */ ++ if (aspect != LOCATION_ASPECT_FINISH) ++ { ++ expanded_location prev_exploc (exploc); ++ prev_exploc.column--; ++ int prev_display_col ++ = (location_compute_display_column (prev_exploc, policy)); ++ m_display_col = prev_display_col + 1; ++ } ++ } ++ } + + int m_display_col; + }; +@@ -313,6 +329,31 @@ test_line_span () + + #endif /* #if CHECKING_P */ + ++/* A bundle of information containing how to print unicode ++ characters and bytes when quoting source code. ++ ++ Provides a unified place to support escaping some subset ++ of characters to some format. ++ ++ Extends char_column_policy; printing is split out to avoid ++ libcpp having to know about pretty_printer. */ ++ ++struct char_display_policy : public cpp_char_column_policy ++{ ++ public: ++ char_display_policy (int tabstop, ++ int (*width_cb) (cppchar_t c), ++ void (*print_cb) (pretty_printer *pp, ++ const cpp_decoded_char &cp)) ++ : cpp_char_column_policy (tabstop, width_cb), ++ m_print_cb (print_cb) ++ { ++ } ++ ++ void (*m_print_cb) (pretty_printer *pp, ++ const cpp_decoded_char &cp); ++}; ++ + /* A class to control the overall layout when printing a diagnostic. + + The layout is determined within the constructor. +@@ -345,6 +386,8 @@ class layout + + void print_line (linenum_type row); + ++ void on_bad_codepoint (const char *ptr, cppchar_t ch, size_t ch_sz); ++ + private: + bool will_show_line_p (linenum_type row) const; + void print_leading_fixits (linenum_type row); +@@ -386,6 +429,7 @@ class layout + private: + diagnostic_context *m_context; + pretty_printer *m_pp; ++ char_display_policy m_policy; + location_t m_primary_loc; + exploc_with_display_col m_exploc; + colorizer m_colorizer; +@@ -398,6 +442,7 @@ class layout + auto_vec m_line_spans; + int m_linenum_width; + int m_x_offset_display; ++ bool m_escape_on_output; + }; + + /* Implementation of "class colorizer". */ +@@ -646,6 +691,11 @@ layout_range::intersects_line_p (linenum + /* Default for when we don't care what the tab expansion is set to. */ + static const int def_tabstop = 8; + ++static cpp_char_column_policy def_policy () ++{ ++ return cpp_char_column_policy (8, cpp_wcwidth); ++} ++ + /* Create some expanded locations for testing layout_range. The filename + member of the explocs is set to the empty string. This member will only be + inspected by the calls to location_compute_display_column() made from the +@@ -662,10 +712,13 @@ make_range (int start_line, int start_co + = {"", start_line, start_col, NULL, false}; + const expanded_location finish_exploc + = {"", end_line, end_col, NULL, false}; +- return layout_range (exploc_with_display_col (start_exploc, def_tabstop), +- exploc_with_display_col (finish_exploc, def_tabstop), ++ return layout_range (exploc_with_display_col (start_exploc, def_policy (), ++ LOCATION_ASPECT_START), ++ exploc_with_display_col (finish_exploc, def_policy (), ++ LOCATION_ASPECT_FINISH), + SHOW_RANGE_WITHOUT_CARET, +- exploc_with_display_col (start_exploc, def_tabstop), ++ exploc_with_display_col (start_exploc, def_policy (), ++ LOCATION_ASPECT_CARET), + 0, NULL); + } + +@@ -959,6 +1012,164 @@ fixit_cmp (const void *p_a, const void * + return hint_a->get_start_loc () - hint_b->get_start_loc (); + } + ++/* Callbacks for use when not escaping the source. */ ++ ++/* The default callback for char_column_policy::m_width_cb is cpp_wcwidth. */ ++ ++/* Callback for char_display_policy::m_print_cb for printing source chars ++ when not escaping the source. */ ++ ++static void ++default_print_decoded_ch (pretty_printer *pp, ++ const cpp_decoded_char &decoded_ch) ++{ ++ for (const char *ptr = decoded_ch.m_start_byte; ++ ptr != decoded_ch.m_next_byte; ptr++) ++ { ++ if (*ptr == '\0' || *ptr == '\r') ++ { ++ pp_space (pp); ++ continue; ++ } ++ ++ pp_character (pp, *ptr); ++ } ++} ++ ++/* Callbacks for use with DIAGNOSTICS_ESCAPE_FORMAT_BYTES. */ ++ ++static const int width_per_escaped_byte = 4; ++ ++/* Callback for char_column_policy::m_width_cb for determining the ++ display width when escaping with DIAGNOSTICS_ESCAPE_FORMAT_BYTES. */ ++ ++static int ++escape_as_bytes_width (cppchar_t ch) ++{ ++ if (ch < 0x80 && ISPRINT (ch)) ++ return cpp_wcwidth (ch); ++ else ++ { ++ if (ch <= 0x7F) return 1 * width_per_escaped_byte; ++ if (ch <= 0x7FF) return 2 * width_per_escaped_byte; ++ if (ch <= 0xFFFF) return 3 * width_per_escaped_byte; ++ return 4 * width_per_escaped_byte; ++ } ++} ++ ++/* Callback for char_display_policy::m_print_cb for printing source chars ++ when escaping with DIAGNOSTICS_ESCAPE_FORMAT_BYTES. */ ++ ++static void ++escape_as_bytes_print (pretty_printer *pp, ++ const cpp_decoded_char &decoded_ch) ++{ ++ if (!decoded_ch.m_valid_ch) ++ { ++ for (const char *iter = decoded_ch.m_start_byte; ++ iter != decoded_ch.m_next_byte; ++iter) ++ { ++ char buf[16]; ++ sprintf (buf, "<%02x>", (unsigned char)*iter); ++ pp_string (pp, buf); ++ } ++ return; ++ } ++ ++ cppchar_t ch = decoded_ch.m_ch; ++ if (ch < 0x80 && ISPRINT (ch)) ++ pp_character (pp, ch); ++ else ++ { ++ for (const char *iter = decoded_ch.m_start_byte; ++ iter < decoded_ch.m_next_byte; ++iter) ++ { ++ char buf[16]; ++ sprintf (buf, "<%02x>", (unsigned char)*iter); ++ pp_string (pp, buf); ++ } ++ } ++} ++ ++/* Callbacks for use with DIAGNOSTICS_ESCAPE_FORMAT_UNICODE. */ ++ ++/* Callback for char_column_policy::m_width_cb for determining the ++ display width when escaping with DIAGNOSTICS_ESCAPE_FORMAT_UNICODE. */ ++ ++static int ++escape_as_unicode_width (cppchar_t ch) ++{ ++ if (ch < 0x80 && ISPRINT (ch)) ++ return cpp_wcwidth (ch); ++ else ++ { ++ // Width of "" ++ if (ch > 0xfffff) ++ return 10; ++ else if (ch > 0xffff) ++ return 9; ++ else ++ return 8; ++ } ++} ++ ++/* Callback for char_display_policy::m_print_cb for printing source chars ++ when escaping with DIAGNOSTICS_ESCAPE_FORMAT_UNICODE. */ ++ ++static void ++escape_as_unicode_print (pretty_printer *pp, ++ const cpp_decoded_char &decoded_ch) ++{ ++ if (!decoded_ch.m_valid_ch) ++ { ++ escape_as_bytes_print (pp, decoded_ch); ++ return; ++ } ++ ++ cppchar_t ch = decoded_ch.m_ch; ++ if (ch < 0x80 && ISPRINT (ch)) ++ pp_character (pp, ch); ++ else ++ { ++ char buf[16]; ++ sprintf (buf, "", ch); ++ pp_string (pp, buf); ++ } ++} ++ ++/* Populate a char_display_policy based on DC and RICHLOC. */ ++ ++static char_display_policy ++make_policy (const diagnostic_context &dc, ++ const rich_location &richloc) ++{ ++ /* The default is to not escape non-ASCII bytes. */ ++ char_display_policy result ++ (dc.tabstop, cpp_wcwidth, default_print_decoded_ch); ++ ++ /* If the diagnostic suggests escaping non-ASCII bytes, then ++ use policy from user-supplied options. */ ++ if (richloc.escape_on_output_p ()) ++ { ++ result.m_undecoded_byte_width = width_per_escaped_byte; ++ switch (dc.escape_format) ++ { ++ default: ++ gcc_unreachable (); ++ case DIAGNOSTICS_ESCAPE_FORMAT_UNICODE: ++ result.m_width_cb = escape_as_unicode_width; ++ result.m_print_cb = escape_as_unicode_print; ++ break; ++ case DIAGNOSTICS_ESCAPE_FORMAT_BYTES: ++ result.m_width_cb = escape_as_bytes_width; ++ result.m_print_cb = escape_as_bytes_print; ++ break; ++ } ++ } ++ ++ return result; ++} ++ + /* Implementation of class layout. */ + + /* Constructor for class layout. +@@ -975,8 +1186,10 @@ layout::layout (diagnostic_context * con + diagnostic_t diagnostic_kind) + : m_context (context), + m_pp (context->printer), ++ m_policy (make_policy (*context, *richloc)), + m_primary_loc (richloc->get_range (0)->m_loc), +- m_exploc (richloc->get_expanded_location (0), context->tabstop), ++ m_exploc (richloc->get_expanded_location (0), m_policy, ++ LOCATION_ASPECT_CARET), + m_colorizer (context, diagnostic_kind), + m_colorize_source_p (context->colorize_source_p), + m_show_labels_p (context->show_labels_p), +@@ -986,7 +1199,8 @@ layout::layout (diagnostic_context * con + m_fixit_hints (richloc->get_num_fixit_hints ()), + m_line_spans (1 + richloc->get_num_locations ()), + m_linenum_width (0), +- m_x_offset_display (0) ++ m_x_offset_display (0), ++ m_escape_on_output (richloc->escape_on_output_p ()) + { + for (unsigned int idx = 0; idx < richloc->get_num_locations (); idx++) + { +@@ -1072,10 +1286,13 @@ layout::maybe_add_location_range (const + + /* Everything is now known to be in the correct source file, + but it may require further sanitization. */ +- layout_range ri (exploc_with_display_col (start, m_context->tabstop), +- exploc_with_display_col (finish, m_context->tabstop), ++ layout_range ri (exploc_with_display_col (start, m_policy, ++ LOCATION_ASPECT_START), ++ exploc_with_display_col (finish, m_policy, ++ LOCATION_ASPECT_FINISH), + loc_range->m_range_display_kind, +- exploc_with_display_col (caret, m_context->tabstop), ++ exploc_with_display_col (caret, m_policy, ++ LOCATION_ASPECT_CARET), + original_idx, loc_range->m_label); + + /* If we have a range that finishes before it starts (perhaps +@@ -1409,7 +1626,7 @@ layout::calculate_x_offset_display () + = get_line_bytes_without_trailing_whitespace (line.get_buffer (), + line.length ()); + int eol_display_column +- = cpp_display_width (line.get_buffer (), line_bytes, m_context->tabstop); ++ = cpp_display_width (line.get_buffer (), line_bytes, m_policy); + if (caret_display_column > eol_display_column + || !caret_display_column) + { +@@ -1488,7 +1705,7 @@ layout::print_source_line (linenum_type + /* This object helps to keep track of which display column we are at, which is + necessary for computing the line bounds in display units, for doing + tab expansion, and for implementing m_x_offset_display. */ +- cpp_display_width_computation dw (line, line_bytes, m_context->tabstop); ++ cpp_display_width_computation dw (line, line_bytes, m_policy); + + /* Skip the first m_x_offset_display display columns. In case the leading + portion that will be skipped ends with a character with wcwidth > 1, then +@@ -1536,7 +1753,8 @@ layout::print_source_line (linenum_type + tabs and replacing some control bytes with spaces as necessary. */ + const char *c = dw.next_byte (); + const int start_disp_col = dw.display_cols_processed () + 1; +- const int this_display_width = dw.process_next_codepoint (); ++ cpp_decoded_char cp; ++ const int this_display_width = dw.process_next_codepoint (&cp); + if (*c == '\t') + { + /* The returned display width is the number of spaces into which the +@@ -1545,15 +1763,6 @@ layout::print_source_line (linenum_type + pp_space (m_pp); + continue; + } +- if (*c == '\0' || *c == '\r') +- { +- /* cpp_wcwidth() promises to return 1 for all control bytes, and we +- want to output these as a single space too, so this case is +- actually the same as the '\t' case. */ +- gcc_assert (this_display_width == 1); +- pp_space (m_pp); +- continue; +- } + + /* We have a (possibly multibyte) character to output; update the line + bounds if it is not whitespace. */ +@@ -1565,7 +1774,8 @@ layout::print_source_line (linenum_type + } + + /* Output the character. */ +- while (c != dw.next_byte ()) pp_character (m_pp, *c++); ++ m_policy.m_print_cb (m_pp, cp); ++ c = dw.next_byte (); + } + print_newline (); + return lbounds; +@@ -1664,14 +1874,14 @@ layout::print_annotation_line (linenum_t + class line_label + { + public: +- line_label (diagnostic_context *context, int state_idx, int column, ++ line_label (const cpp_char_column_policy &policy, ++ int state_idx, int column, + label_text text) + : m_state_idx (state_idx), m_column (column), + m_text (text), m_label_line (0), m_has_vbar (true) + { + const int bytes = strlen (text.m_buffer); +- m_display_width +- = cpp_display_width (text.m_buffer, bytes, context->tabstop); ++ m_display_width = cpp_display_width (text.m_buffer, bytes, policy); + } + + /* Sorting is primarily by column, then by state index. */ +@@ -1731,7 +1941,7 @@ layout::print_any_labels (linenum_type r + if (text.m_buffer == NULL) + continue; + +- labels.safe_push (line_label (m_context, i, disp_col, text)); ++ labels.safe_push (line_label (m_policy, i, disp_col, text)); + } + } + +@@ -2011,7 +2221,7 @@ public: + + /* Get the range of bytes or display columns that HINT would affect. */ + static column_range +-get_affected_range (diagnostic_context *context, ++get_affected_range (const cpp_char_column_policy &policy, + const fixit_hint *hint, enum column_unit col_unit) + { + expanded_location exploc_start = expand_location (hint->get_start_loc ()); +@@ -2022,13 +2232,11 @@ get_affected_range (diagnostic_context * + int finish_column; + if (col_unit == CU_DISPLAY_COLS) + { +- start_column +- = location_compute_display_column (exploc_start, context->tabstop); ++ start_column = location_compute_display_column (exploc_start, policy); + if (hint->insertion_p ()) + finish_column = start_column - 1; + else +- finish_column +- = location_compute_display_column (exploc_finish, context->tabstop); ++ finish_column = location_compute_display_column (exploc_finish, policy); + } + else + { +@@ -2041,12 +2249,13 @@ get_affected_range (diagnostic_context * + /* Get the range of display columns that would be printed for HINT. */ + + static column_range +-get_printed_columns (diagnostic_context *context, const fixit_hint *hint) ++get_printed_columns (const cpp_char_column_policy &policy, ++ const fixit_hint *hint) + { + expanded_location exploc = expand_location (hint->get_start_loc ()); +- int start_column = location_compute_display_column (exploc, context->tabstop); ++ int start_column = location_compute_display_column (exploc, policy); + int hint_width = cpp_display_width (hint->get_string (), hint->get_length (), +- context->tabstop); ++ policy); + int final_hint_column = start_column + hint_width - 1; + if (hint->insertion_p ()) + { +@@ -2056,8 +2265,7 @@ get_printed_columns (diagnostic_context + { + exploc = expand_location (hint->get_next_loc ()); + --exploc.column; +- int finish_column +- = location_compute_display_column (exploc, context->tabstop); ++ int finish_column = location_compute_display_column (exploc, policy); + return column_range (start_column, + MAX (finish_column, final_hint_column)); + } +@@ -2075,13 +2283,13 @@ public: + column_range affected_columns, + column_range printed_columns, + const char *new_text, size_t new_text_len, +- int tabstop) ++ const cpp_char_column_policy &policy) + : m_affected_bytes (affected_bytes), + m_affected_columns (affected_columns), + m_printed_columns (printed_columns), + m_text (xstrdup (new_text)), + m_byte_length (new_text_len), +- m_tabstop (tabstop), ++ m_policy (policy), + m_alloc_sz (new_text_len + 1) + { + compute_display_cols (); +@@ -2099,7 +2307,7 @@ public: + + void compute_display_cols () + { +- m_display_cols = cpp_display_width (m_text, m_byte_length, m_tabstop); ++ m_display_cols = cpp_display_width (m_text, m_byte_length, m_policy); + } + + void overwrite (int dst_offset, const char_span &src_span) +@@ -2127,7 +2335,7 @@ public: + char *m_text; + size_t m_byte_length; /* Not including null-terminator. */ + int m_display_cols; +- int m_tabstop; ++ const cpp_char_column_policy &m_policy; + size_t m_alloc_sz; + }; + +@@ -2163,15 +2371,16 @@ correction::ensure_terminated () + class line_corrections + { + public: +- line_corrections (diagnostic_context *context, const char *filename, ++ line_corrections (const char_display_policy &policy, ++ const char *filename, + linenum_type row) +- : m_context (context), m_filename (filename), m_row (row) ++ : m_policy (policy), m_filename (filename), m_row (row) + {} + ~line_corrections (); + + void add_hint (const fixit_hint *hint); + +- diagnostic_context *m_context; ++ const char_display_policy &m_policy; + const char *m_filename; + linenum_type m_row; + auto_vec m_corrections; +@@ -2217,10 +2426,10 @@ source_line::source_line (const char *fi + void + line_corrections::add_hint (const fixit_hint *hint) + { +- column_range affected_bytes = get_affected_range (m_context, hint, CU_BYTES); +- column_range affected_columns = get_affected_range (m_context, hint, ++ column_range affected_bytes = get_affected_range (m_policy, hint, CU_BYTES); ++ column_range affected_columns = get_affected_range (m_policy, hint, + CU_DISPLAY_COLS); +- column_range printed_columns = get_printed_columns (m_context, hint); ++ column_range printed_columns = get_printed_columns (m_policy, hint); + + /* Potentially consolidate. */ + if (!m_corrections.is_empty ()) +@@ -2289,7 +2498,7 @@ line_corrections::add_hint (const fixit_ + printed_columns, + hint->get_string (), + hint->get_length (), +- m_context->tabstop)); ++ m_policy)); + } + + /* If there are any fixit hints on source line ROW, print them. +@@ -2303,7 +2512,7 @@ layout::print_trailing_fixits (linenum_t + { + /* Build a list of correction instances for the line, + potentially consolidating hints (for the sake of readability). */ +- line_corrections corrections (m_context, m_exploc.file, row); ++ line_corrections corrections (m_policy, m_exploc.file, row); + for (unsigned int i = 0; i < m_fixit_hints.length (); i++) + { + const fixit_hint *hint = m_fixit_hints[i]; +@@ -2646,6 +2855,59 @@ namespace selftest { + + /* Selftests for diagnostic_show_locus. */ + ++/* Verify that cpp_display_width correctly handles escaping. */ ++ ++static void ++test_display_widths () ++{ ++ gcc_rich_location richloc (UNKNOWN_LOCATION); ++ ++ /* U+03C0 "GREEK SMALL LETTER PI". */ ++ const char *pi = "\xCF\x80"; ++ /* U+1F642 "SLIGHTLY SMILING FACE". */ ++ const char *emoji = "\xF0\x9F\x99\x82"; ++ /* Stray trailing byte of a UTF-8 character. */ ++ const char *stray = "\xBF"; ++ /* U+10FFFF. */ ++ const char *max_codepoint = "\xF4\x8F\xBF\xBF"; ++ ++ /* No escaping. */ ++ { ++ test_diagnostic_context dc; ++ char_display_policy policy (make_policy (dc, richloc)); ++ ASSERT_EQ (cpp_display_width (pi, strlen (pi), policy), 1); ++ ASSERT_EQ (cpp_display_width (emoji, strlen (emoji), policy), 2); ++ ASSERT_EQ (cpp_display_width (stray, strlen (stray), policy), 1); ++ /* Don't check width of U+10FFFF; it's in a private use plane. */ ++ } ++ ++ richloc.set_escape_on_output (true); ++ ++ { ++ test_diagnostic_context dc; ++ dc.escape_format = DIAGNOSTICS_ESCAPE_FORMAT_UNICODE; ++ char_display_policy policy (make_policy (dc, richloc)); ++ ASSERT_EQ (cpp_display_width (pi, strlen (pi), policy), 8); ++ ASSERT_EQ (cpp_display_width (emoji, strlen (emoji), policy), 9); ++ ASSERT_EQ (cpp_display_width (stray, strlen (stray), policy), 4); ++ ASSERT_EQ (cpp_display_width (max_codepoint, strlen (max_codepoint), ++ policy), ++ strlen ("")); ++ } ++ ++ { ++ test_diagnostic_context dc; ++ dc.escape_format = DIAGNOSTICS_ESCAPE_FORMAT_BYTES; ++ char_display_policy policy (make_policy (dc, richloc)); ++ ASSERT_EQ (cpp_display_width (pi, strlen (pi), policy), 8); ++ ASSERT_EQ (cpp_display_width (emoji, strlen (emoji), policy), 16); ++ ASSERT_EQ (cpp_display_width (stray, strlen (stray), policy), 4); ++ ASSERT_EQ (cpp_display_width (max_codepoint, strlen (max_codepoint), ++ policy), ++ 16); ++ } ++} ++ + /* For precise tests of the layout, make clear where the source line will + start. test_left_margin sets the total byte count from the left side of the + screen to the start of source lines, after the line number and the separator, +@@ -2715,10 +2977,10 @@ test_layout_x_offset_display_utf8 (const + char_span lspan = location_get_source_line (tmp.get_filename (), 1); + ASSERT_EQ (line_display_cols, + cpp_display_width (lspan.get_buffer (), lspan.length (), +- def_tabstop)); ++ def_policy ())); + ASSERT_EQ (line_display_cols, + location_compute_display_column (expand_location (line_end), +- def_tabstop)); ++ def_policy ())); + ASSERT_EQ (0, memcmp (lspan.get_buffer () + (emoji_col - 1), + "\xf0\x9f\x98\x82\xf0\x9f\x98\x82", 8)); + +@@ -2866,12 +3128,13 @@ test_layout_x_offset_display_tab (const + ASSERT_EQ ('\t', *(lspan.get_buffer () + (tab_col - 1))); + for (int tabstop = 1; tabstop != num_tabstops; ++tabstop) + { ++ cpp_char_column_policy policy (tabstop, cpp_wcwidth); + ASSERT_EQ (line_bytes + extra_width[tabstop], + cpp_display_width (lspan.get_buffer (), lspan.length (), +- tabstop)); ++ policy)); + ASSERT_EQ (line_bytes + extra_width[tabstop], + location_compute_display_column (expand_location (line_end), +- tabstop)); ++ policy)); + } + + /* Check that the tab is expanded to the expected number of spaces. */ +@@ -4003,6 +4266,43 @@ test_one_liner_labels_utf8 () + " bb\xf0\x9f\x98\x82\xf0\x9f\x98\x82\n", + pp_formatted_text (dc.printer)); + } ++ ++ /* Example of escaping the source lines. */ ++ { ++ text_range_label label0 ("label 0\xf0\x9f\x98\x82"); ++ text_range_label label1 ("label 1\xcf\x80"); ++ text_range_label label2 ("label 2\xcf\x80"); ++ gcc_rich_location richloc (foo, &label0); ++ richloc.add_range (bar, SHOW_RANGE_WITHOUT_CARET, &label1); ++ richloc.add_range (field, SHOW_RANGE_WITHOUT_CARET, &label2); ++ richloc.set_escape_on_output (true); ++ ++ { ++ test_diagnostic_context dc; ++ dc.escape_format = DIAGNOSTICS_ESCAPE_FORMAT_UNICODE; ++ diagnostic_show_locus (&dc, &richloc, DK_ERROR); ++ ASSERT_STREQ (" _foo = _bar._field;\n" ++ " ^~~~~~~~~~~~~ ~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~\n" ++ " | | |\n" ++ " | | label 2\xcf\x80\n" ++ " | label 1\xcf\x80\n" ++ " label 0\xf0\x9f\x98\x82\n", ++ pp_formatted_text (dc.printer)); ++ } ++ { ++ test_diagnostic_context dc; ++ dc.escape_format = DIAGNOSTICS_ESCAPE_FORMAT_BYTES; ++ diagnostic_show_locus (&dc, &richloc, DK_ERROR); ++ ASSERT_STREQ ++ (" <9f><98><82>_foo = <80>_bar.<9f><98><82>_field<80>;\n" ++ " ^~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" ++ " | | |\n" ++ " | | label 2\xcf\x80\n" ++ " | label 1\xcf\x80\n" ++ " label 0\xf0\x9f\x98\x82\n", ++ pp_formatted_text (dc.printer)); ++ } ++ } + } + + /* Make sure that colorization codes don't interrupt a multibyte +@@ -4057,9 +4357,9 @@ test_diagnostic_show_locus_one_liner_utf + + char_span lspan = location_get_source_line (tmp.get_filename (), 1); + ASSERT_EQ (25, cpp_display_width (lspan.get_buffer (), lspan.length (), +- def_tabstop)); ++ def_policy ())); + ASSERT_EQ (25, location_compute_display_column (expand_location (line_end), +- def_tabstop)); ++ def_policy ())); + + test_one_liner_simple_caret_utf8 (); + test_one_liner_caret_and_range_utf8 (); +@@ -4445,30 +4745,31 @@ test_overlapped_fixit_printing (const li + pp_formatted_text (dc.printer)); + + /* Unit-test the line_corrections machinery. */ ++ char_display_policy policy (make_policy (dc, richloc)); + ASSERT_EQ (3, richloc.get_num_fixit_hints ()); + const fixit_hint *hint_0 = richloc.get_fixit_hint (0); + ASSERT_EQ (column_range (12, 12), +- get_affected_range (&dc, hint_0, CU_BYTES)); ++ get_affected_range (policy, hint_0, CU_BYTES)); + ASSERT_EQ (column_range (12, 12), +- get_affected_range (&dc, hint_0, CU_DISPLAY_COLS)); +- ASSERT_EQ (column_range (12, 22), get_printed_columns (&dc, hint_0)); ++ get_affected_range (policy, hint_0, CU_DISPLAY_COLS)); ++ ASSERT_EQ (column_range (12, 22), get_printed_columns (policy, hint_0)); + const fixit_hint *hint_1 = richloc.get_fixit_hint (1); + ASSERT_EQ (column_range (18, 18), +- get_affected_range (&dc, hint_1, CU_BYTES)); ++ get_affected_range (policy, hint_1, CU_BYTES)); + ASSERT_EQ (column_range (18, 18), +- get_affected_range (&dc, hint_1, CU_DISPLAY_COLS)); +- ASSERT_EQ (column_range (18, 20), get_printed_columns (&dc, hint_1)); ++ get_affected_range (policy, hint_1, CU_DISPLAY_COLS)); ++ ASSERT_EQ (column_range (18, 20), get_printed_columns (policy, hint_1)); + const fixit_hint *hint_2 = richloc.get_fixit_hint (2); + ASSERT_EQ (column_range (29, 28), +- get_affected_range (&dc, hint_2, CU_BYTES)); ++ get_affected_range (policy, hint_2, CU_BYTES)); + ASSERT_EQ (column_range (29, 28), +- get_affected_range (&dc, hint_2, CU_DISPLAY_COLS)); +- ASSERT_EQ (column_range (29, 29), get_printed_columns (&dc, hint_2)); ++ get_affected_range (policy, hint_2, CU_DISPLAY_COLS)); ++ ASSERT_EQ (column_range (29, 29), get_printed_columns (policy, hint_2)); + + /* Add each hint in turn to a line_corrections instance, + and verify that they are consolidated into one correction instance + as expected. */ +- line_corrections lc (&dc, tmp.get_filename (), 1); ++ line_corrections lc (policy, tmp.get_filename (), 1); + + /* The first replace hint by itself. */ + lc.add_hint (hint_0); +@@ -4660,30 +4961,31 @@ test_overlapped_fixit_printing_utf8 (con + pp_formatted_text (dc.printer)); + + /* Unit-test the line_corrections machinery. */ ++ char_display_policy policy (make_policy (dc, richloc)); + ASSERT_EQ (3, richloc.get_num_fixit_hints ()); + const fixit_hint *hint_0 = richloc.get_fixit_hint (0); + ASSERT_EQ (column_range (14, 14), +- get_affected_range (&dc, hint_0, CU_BYTES)); ++ get_affected_range (policy, hint_0, CU_BYTES)); + ASSERT_EQ (column_range (12, 12), +- get_affected_range (&dc, hint_0, CU_DISPLAY_COLS)); +- ASSERT_EQ (column_range (12, 22), get_printed_columns (&dc, hint_0)); ++ get_affected_range (policy, hint_0, CU_DISPLAY_COLS)); ++ ASSERT_EQ (column_range (12, 22), get_printed_columns (policy, hint_0)); + const fixit_hint *hint_1 = richloc.get_fixit_hint (1); + ASSERT_EQ (column_range (22, 22), +- get_affected_range (&dc, hint_1, CU_BYTES)); ++ get_affected_range (policy, hint_1, CU_BYTES)); + ASSERT_EQ (column_range (18, 18), +- get_affected_range (&dc, hint_1, CU_DISPLAY_COLS)); +- ASSERT_EQ (column_range (18, 20), get_printed_columns (&dc, hint_1)); ++ get_affected_range (policy, hint_1, CU_DISPLAY_COLS)); ++ ASSERT_EQ (column_range (18, 20), get_printed_columns (policy, hint_1)); + const fixit_hint *hint_2 = richloc.get_fixit_hint (2); + ASSERT_EQ (column_range (35, 34), +- get_affected_range (&dc, hint_2, CU_BYTES)); ++ get_affected_range (policy, hint_2, CU_BYTES)); + ASSERT_EQ (column_range (30, 29), +- get_affected_range (&dc, hint_2, CU_DISPLAY_COLS)); +- ASSERT_EQ (column_range (30, 30), get_printed_columns (&dc, hint_2)); ++ get_affected_range (policy, hint_2, CU_DISPLAY_COLS)); ++ ASSERT_EQ (column_range (30, 30), get_printed_columns (policy, hint_2)); + + /* Add each hint in turn to a line_corrections instance, + and verify that they are consolidated into one correction instance + as expected. */ +- line_corrections lc (&dc, tmp.get_filename (), 1); ++ line_corrections lc (policy, tmp.get_filename (), 1); + + /* The first replace hint by itself. */ + lc.add_hint (hint_0); +@@ -4877,15 +5179,16 @@ test_overlapped_fixit_printing_2 (const + richloc.add_fixit_insert_before (col_21, "}"); + + /* These fixits should be accepted; they can't be consolidated. */ ++ char_display_policy policy (make_policy (dc, richloc)); + ASSERT_EQ (2, richloc.get_num_fixit_hints ()); + const fixit_hint *hint_0 = richloc.get_fixit_hint (0); + ASSERT_EQ (column_range (23, 22), +- get_affected_range (&dc, hint_0, CU_BYTES)); +- ASSERT_EQ (column_range (23, 23), get_printed_columns (&dc, hint_0)); ++ get_affected_range (policy, hint_0, CU_BYTES)); ++ ASSERT_EQ (column_range (23, 23), get_printed_columns (policy, hint_0)); + const fixit_hint *hint_1 = richloc.get_fixit_hint (1); + ASSERT_EQ (column_range (21, 20), +- get_affected_range (&dc, hint_1, CU_BYTES)); +- ASSERT_EQ (column_range (21, 21), get_printed_columns (&dc, hint_1)); ++ get_affected_range (policy, hint_1, CU_BYTES)); ++ ASSERT_EQ (column_range (21, 21), get_printed_columns (policy, hint_1)); + + /* Verify that they're printed correctly. */ + diagnostic_show_locus (&dc, &richloc, DK_ERROR); +@@ -5152,10 +5455,11 @@ test_tab_expansion (const line_table_cas + ....................123 45678901234 56789012345 columns */ + + const int tabstop = 8; ++ cpp_char_column_policy policy (tabstop, cpp_wcwidth); + const int first_non_ws_byte_col = 7; + const int right_quote_byte_col = 15; + const int last_byte_col = 25; +- ASSERT_EQ (35, cpp_display_width (content, last_byte_col, tabstop)); ++ ASSERT_EQ (35, cpp_display_width (content, last_byte_col, policy)); + + temp_source_file tmp (SELFTEST_LOCATION, ".c", content); + line_table_test ltt (case_); +@@ -5198,6 +5502,114 @@ test_tab_expansion (const line_table_cas + } + } + ++/* Verify that the escaping machinery can cope with a variety of different ++ invalid bytes. */ ++ ++static void ++test_escaping_bytes_1 (const line_table_case &case_) ++{ ++ const char content[] = "before\0\1\2\3\r\x80\xff""after\n"; ++ const size_t sz = sizeof (content); ++ temp_source_file tmp (SELFTEST_LOCATION, ".c", content, sz); ++ line_table_test ltt (case_); ++ const line_map_ordinary *ord_map = linemap_check_ordinary ++ (linemap_add (line_table, LC_ENTER, false, tmp.get_filename (), 0)); ++ linemap_line_start (line_table, 1, 100); ++ ++ location_t finish ++ = linemap_position_for_line_and_column (line_table, ord_map, 1, ++ strlen (content)); ++ ++ if (finish > LINE_MAP_MAX_LOCATION_WITH_COLS) ++ return; ++ ++ /* Locations of the NUL and \r bytes. */ ++ location_t nul_loc ++ = linemap_position_for_line_and_column (line_table, ord_map, 1, 7); ++ location_t r_loc ++ = linemap_position_for_line_and_column (line_table, ord_map, 1, 11); ++ gcc_rich_location richloc (nul_loc); ++ richloc.add_range (r_loc); ++ ++ { ++ test_diagnostic_context dc; ++ diagnostic_show_locus (&dc, &richloc, DK_ERROR); ++ ASSERT_STREQ (" before \1\2\3 \x80\xff""after\n" ++ " ^ ~\n", ++ pp_formatted_text (dc.printer)); ++ } ++ richloc.set_escape_on_output (true); ++ { ++ test_diagnostic_context dc; ++ dc.escape_format = DIAGNOSTICS_ESCAPE_FORMAT_UNICODE; ++ diagnostic_show_locus (&dc, &richloc, DK_ERROR); ++ ASSERT_STREQ ++ (" before<80>after\n" ++ " ^~~~~~~~ ~~~~~~~~\n", ++ pp_formatted_text (dc.printer)); ++ } ++ { ++ test_diagnostic_context dc; ++ dc.escape_format = DIAGNOSTICS_ESCAPE_FORMAT_BYTES; ++ diagnostic_show_locus (&dc, &richloc, DK_ERROR); ++ ASSERT_STREQ (" before<00><01><02><03><0d><80>after\n" ++ " ^~~~ ~~~~\n", ++ pp_formatted_text (dc.printer)); ++ } ++} ++ ++/* As above, but verify that we handle the initial byte of a line ++ correctly. */ ++ ++static void ++test_escaping_bytes_2 (const line_table_case &case_) ++{ ++ const char content[] = "\0after\n"; ++ const size_t sz = sizeof (content); ++ temp_source_file tmp (SELFTEST_LOCATION, ".c", content, sz); ++ line_table_test ltt (case_); ++ const line_map_ordinary *ord_map = linemap_check_ordinary ++ (linemap_add (line_table, LC_ENTER, false, tmp.get_filename (), 0)); ++ linemap_line_start (line_table, 1, 100); ++ ++ location_t finish ++ = linemap_position_for_line_and_column (line_table, ord_map, 1, ++ strlen (content)); ++ ++ if (finish > LINE_MAP_MAX_LOCATION_WITH_COLS) ++ return; ++ ++ /* Location of the NUL byte. */ ++ location_t nul_loc ++ = linemap_position_for_line_and_column (line_table, ord_map, 1, 1); ++ gcc_rich_location richloc (nul_loc); ++ ++ { ++ test_diagnostic_context dc; ++ diagnostic_show_locus (&dc, &richloc, DK_ERROR); ++ ASSERT_STREQ (" after\n" ++ " ^\n", ++ pp_formatted_text (dc.printer)); ++ } ++ richloc.set_escape_on_output (true); ++ { ++ test_diagnostic_context dc; ++ dc.escape_format = DIAGNOSTICS_ESCAPE_FORMAT_UNICODE; ++ diagnostic_show_locus (&dc, &richloc, DK_ERROR); ++ ASSERT_STREQ (" after\n" ++ " ^~~~~~~~\n", ++ pp_formatted_text (dc.printer)); ++ } ++ { ++ test_diagnostic_context dc; ++ dc.escape_format = DIAGNOSTICS_ESCAPE_FORMAT_BYTES; ++ diagnostic_show_locus (&dc, &richloc, DK_ERROR); ++ ASSERT_STREQ (" <00>after\n" ++ " ^~~~\n", ++ pp_formatted_text (dc.printer)); ++ } ++} ++ + /* Verify that line numbers are correctly printed for the case of + a multiline range in which the width of the line numbers changes + (e.g. from "9" to "10"). */ +@@ -5254,6 +5666,8 @@ diagnostic_show_locus_c_tests () + test_layout_range_for_single_line (); + test_layout_range_for_multiple_lines (); + ++ test_display_widths (); ++ + for_each_line_table_case (test_layout_x_offset_display_utf8); + for_each_line_table_case (test_layout_x_offset_display_tab); + +@@ -5274,6 +5688,8 @@ diagnostic_show_locus_c_tests () + for_each_line_table_case (test_fixit_replace_containing_newline); + for_each_line_table_case (test_fixit_deletion_affecting_newline); + for_each_line_table_case (test_tab_expansion); ++ for_each_line_table_case (test_escaping_bytes_1); ++ for_each_line_table_case (test_escaping_bytes_2); + + test_line_numbers_multiline_range (); + } +diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi +--- a/gcc/doc/invoke.texi 2021-12-13 23:23:05.764437151 -0800 ++++ b/gcc/doc/invoke.texi 2021-12-14 01:16:01.553943061 -0800 +@@ -312,7 +312,8 @@ Objective-C and Objective-C++ Dialects}. + -fdiagnostics-show-path-depths @gol + -fno-show-column @gol + -fdiagnostics-column-unit=@r{[}display@r{|}byte@r{]} @gol +--fdiagnostics-column-origin=@var{origin}} ++-fdiagnostics-column-origin=@var{origin} @gol ++-fdiagnostics-escape-format=@r{[}unicode@r{|}bytes@r{]}} + + @item Warning Options + @xref{Warning Options,,Options to Request or Suppress Warnings}. +@@ -5083,6 +5084,38 @@ first column. The default value of 1 co + behavior and to the GNU style guide. Some utilities may perform better with an + origin of 0; any non-negative value may be specified. + ++@item -fdiagnostics-escape-format=@var{FORMAT} ++@opindex fdiagnostics-escape-format ++When GCC prints pertinent source lines for a diagnostic it normally attempts ++to print the source bytes directly. However, some diagnostics relate to encoding ++issues in the source file, such as malformed UTF-8, or issues with Unicode ++normalization. These diagnostics are flagged so that GCC will escape bytes ++that are not printable ASCII when printing their pertinent source lines. ++ ++This option controls how such bytes should be escaped. ++ ++The default @var{FORMAT}, @samp{unicode} displays Unicode characters that ++are not printable ASCII in the form @samp{}, and bytes that do not ++correspond to a Unicode character validly-encoded in UTF-8-encoded will be ++displayed as hexadecimal in the form @samp{}. ++ ++For example, a source line containing the string @samp{before} followed by the ++Unicode character U+03C0 (``GREEK SMALL LETTER PI'', with UTF-8 encoding ++0xCF 0x80) followed by the byte 0xBF (a stray UTF-8 trailing byte), followed by ++the string @samp{after} will be printed for such a diagnostic as: ++ ++@smallexample ++ beforeafter ++@end smallexample ++ ++Setting @var{FORMAT} to @samp{bytes} will display all non-printable-ASCII bytes ++in the form @samp{}, thus showing the underlying encoding of non-ASCII ++Unicode characters. For the example above, the following will be printed: ++ ++@smallexample ++ before<80>after ++@end smallexample ++ + @item -fdiagnostics-format=@var{FORMAT} + @opindex fdiagnostics-format + Select a different format for printing diagnostics. +@@ -5150,9 +5183,11 @@ might be printed in JSON form (after for + @} + @} + ], ++ "escape-source": false, + "message": "...this statement, but the latter is @dots{}" + @} + ] ++ "escape-source": false, + "column-origin": 1, + @}, + @dots{} +@@ -5239,6 +5274,7 @@ of the expression, which have labels. I + "label": "T @{aka struct t@}" + @} + ], ++ "escape-source": false, + "message": "invalid operands to binary + @dots{}" + @} + @end smallexample +@@ -5292,6 +5328,7 @@ might be printed in JSON form as: + @} + @} + ], ++ "escape-source": false, + "message": "\u2018struct s\u2019 has no member named @dots{}" + @} + @end smallexample +@@ -5349,6 +5386,10 @@ For example, the intraprocedural example + ] + @end smallexample + ++Diagnostics have a boolean attribute @code{escape-source}, hinting whether ++non-ASCII bytes should be escaped when printing the pertinent lines of ++source code (@code{true} for diagnostics involving source encoding issues). ++ + @end table + + @node Warning Options +diff --git a/gcc/input.c b/gcc/input.c +--- a/gcc/input.c 2021-07-27 23:55:07.328287915 -0700 ++++ b/gcc/input.c 2021-12-14 01:16:01.553943061 -0800 +@@ -913,7 +913,8 @@ make_location (location_t caret, source_ + source line in order to calculate the display width. If that cannot be done + for any reason, then returns the byte column as a fallback. */ + int +-location_compute_display_column (expanded_location exploc, int tabstop) ++location_compute_display_column (expanded_location exploc, ++ const cpp_char_column_policy &policy) + { + if (!(exploc.file && *exploc.file && exploc.line && exploc.column)) + return exploc.column; +@@ -921,7 +922,7 @@ location_compute_display_column (expande + /* If line is NULL, this function returns exploc.column which is the + desired fallback. */ + return cpp_byte_column_to_display_column (line.get_buffer (), line.length (), +- exploc.column, tabstop); ++ exploc.column, policy); + } + + /* Dump statistics to stderr about the memory usage of the line_table +@@ -3611,43 +3612,50 @@ test_line_offset_overflow () + void test_cpp_utf8 () + { + const int def_tabstop = 8; ++ cpp_char_column_policy policy (def_tabstop, cpp_wcwidth); ++ + /* Verify that wcwidth of invalid UTF-8 or control bytes is 1. */ + { +- int w_bad = cpp_display_width ("\xf0!\x9f!\x98!\x82!", 8, def_tabstop); ++ int w_bad = cpp_display_width ("\xf0!\x9f!\x98!\x82!", 8, policy); + ASSERT_EQ (8, w_bad); +- int w_ctrl = cpp_display_width ("\r\n\v\0\1", 5, def_tabstop); ++ int w_ctrl = cpp_display_width ("\r\n\v\0\1", 5, policy); + ASSERT_EQ (5, w_ctrl); + } + + /* Verify that wcwidth of valid UTF-8 is as expected. */ + { +- const int w_pi = cpp_display_width ("\xcf\x80", 2, def_tabstop); ++ const int w_pi = cpp_display_width ("\xcf\x80", 2, policy); + ASSERT_EQ (1, w_pi); +- const int w_emoji = cpp_display_width ("\xf0\x9f\x98\x82", 4, def_tabstop); ++ const int w_emoji = cpp_display_width ("\xf0\x9f\x98\x82", 4, policy); + ASSERT_EQ (2, w_emoji); + const int w_umlaut_precomposed = cpp_display_width ("\xc3\xbf", 2, +- def_tabstop); ++ policy); + ASSERT_EQ (1, w_umlaut_precomposed); + const int w_umlaut_combining = cpp_display_width ("y\xcc\x88", 3, +- def_tabstop); ++ policy); + ASSERT_EQ (1, w_umlaut_combining); +- const int w_han = cpp_display_width ("\xe4\xb8\xba", 3, def_tabstop); ++ const int w_han = cpp_display_width ("\xe4\xb8\xba", 3, policy); + ASSERT_EQ (2, w_han); +- const int w_ascii = cpp_display_width ("GCC", 3, def_tabstop); ++ const int w_ascii = cpp_display_width ("GCC", 3, policy); + ASSERT_EQ (3, w_ascii); + const int w_mixed = cpp_display_width ("\xcf\x80 = 3.14 \xf0\x9f\x98\x82" + "\x9f! \xe4\xb8\xba y\xcc\x88", +- 24, def_tabstop); ++ 24, policy); + ASSERT_EQ (18, w_mixed); + } + + /* Verify that display width properly expands tabs. */ + { + const char *tstr = "\tabc\td"; +- ASSERT_EQ (6, cpp_display_width (tstr, 6, 1)); +- ASSERT_EQ (10, cpp_display_width (tstr, 6, 3)); +- ASSERT_EQ (17, cpp_display_width (tstr, 6, 8)); +- ASSERT_EQ (1, cpp_display_column_to_byte_column (tstr, 6, 7, 8)); ++ ASSERT_EQ (6, cpp_display_width (tstr, 6, ++ cpp_char_column_policy (1, cpp_wcwidth))); ++ ASSERT_EQ (10, cpp_display_width (tstr, 6, ++ cpp_char_column_policy (3, cpp_wcwidth))); ++ ASSERT_EQ (17, cpp_display_width (tstr, 6, ++ cpp_char_column_policy (8, cpp_wcwidth))); ++ ASSERT_EQ (1, ++ cpp_display_column_to_byte_column ++ (tstr, 6, 7, cpp_char_column_policy (8, cpp_wcwidth))); + } + + /* Verify that cpp_byte_column_to_display_column can go past the end, +@@ -3660,13 +3668,13 @@ void test_cpp_utf8 () + /* 111122223456 + Byte columns. */ + +- ASSERT_EQ (5, cpp_display_width (str, 6, def_tabstop)); ++ ASSERT_EQ (5, cpp_display_width (str, 6, policy)); + ASSERT_EQ (105, +- cpp_byte_column_to_display_column (str, 6, 106, def_tabstop)); ++ cpp_byte_column_to_display_column (str, 6, 106, policy)); + ASSERT_EQ (10000, +- cpp_byte_column_to_display_column (NULL, 0, 10000, def_tabstop)); ++ cpp_byte_column_to_display_column (NULL, 0, 10000, policy)); + ASSERT_EQ (0, +- cpp_byte_column_to_display_column (NULL, 10000, 0, def_tabstop)); ++ cpp_byte_column_to_display_column (NULL, 10000, 0, policy)); + } + + /* Verify that cpp_display_column_to_byte_column can go past the end, +@@ -3680,25 +3688,25 @@ void test_cpp_utf8 () + /* 000000000000000000000000000000000111111 + 111122223333444456666777788889999012345 + Byte columns. */ +- ASSERT_EQ (4, cpp_display_column_to_byte_column (str, 15, 2, def_tabstop)); ++ ASSERT_EQ (4, cpp_display_column_to_byte_column (str, 15, 2, policy)); + ASSERT_EQ (15, +- cpp_display_column_to_byte_column (str, 15, 11, def_tabstop)); ++ cpp_display_column_to_byte_column (str, 15, 11, policy)); + ASSERT_EQ (115, +- cpp_display_column_to_byte_column (str, 15, 111, def_tabstop)); ++ cpp_display_column_to_byte_column (str, 15, 111, policy)); + ASSERT_EQ (10000, +- cpp_display_column_to_byte_column (NULL, 0, 10000, def_tabstop)); ++ cpp_display_column_to_byte_column (NULL, 0, 10000, policy)); + ASSERT_EQ (0, +- cpp_display_column_to_byte_column (NULL, 10000, 0, def_tabstop)); ++ cpp_display_column_to_byte_column (NULL, 10000, 0, policy)); + + /* Verify that we do not interrupt a UTF-8 sequence. */ +- ASSERT_EQ (4, cpp_display_column_to_byte_column (str, 15, 1, def_tabstop)); ++ ASSERT_EQ (4, cpp_display_column_to_byte_column (str, 15, 1, policy)); + + for (int byte_col = 1; byte_col <= 15; ++byte_col) + { + const int disp_col +- = cpp_byte_column_to_display_column (str, 15, byte_col, def_tabstop); ++ = cpp_byte_column_to_display_column (str, 15, byte_col, policy); + const int byte_col2 +- = cpp_display_column_to_byte_column (str, 15, disp_col, def_tabstop); ++ = cpp_display_column_to_byte_column (str, 15, disp_col, policy); + + /* If we ask for the display column in the middle of a UTF-8 + sequence, it will return the length of the partial sequence, +diff --git a/gcc/input.h b/gcc/input.h +--- a/gcc/input.h 2021-07-27 23:55:07.328287915 -0700 ++++ b/gcc/input.h 2021-12-14 01:16:01.553943061 -0800 +@@ -39,8 +39,11 @@ STATIC_ASSERT (BUILTINS_LOCATION < RESER + extern bool is_location_from_builtin_token (location_t); + extern expanded_location expand_location (location_t); + +-extern int location_compute_display_column (expanded_location exploc, +- int tabstop); ++class cpp_char_column_policy; ++ ++extern int ++location_compute_display_column (expanded_location exploc, ++ const cpp_char_column_policy &policy); + + /* A class capturing the bounds of a buffer, to allow for run-time + bounds-checking in a checked build. */ +diff --git a/gcc/opts.c b/gcc/opts.c +--- a/gcc/opts.c 2021-07-27 23:55:07.364288417 -0700 ++++ b/gcc/opts.c 2021-12-14 01:16:01.553943061 -0800 +@@ -2573,6 +2573,10 @@ common_handle_option (struct gcc_options + dc->column_origin = value; + break; + ++ case OPT_fdiagnostics_escape_format_: ++ dc->escape_format = (enum diagnostics_escape_format)value; ++ break; ++ + case OPT_fdiagnostics_show_cwe: + dc->show_cwe = value; + break; +diff --git a/gcc/selftest.c b/gcc/selftest.c +--- a/gcc/selftest.c 2021-07-27 23:55:07.500290315 -0700 ++++ b/gcc/selftest.c 2021-12-14 01:16:01.557942991 -0800 +@@ -193,6 +193,21 @@ temp_source_file::temp_source_file (cons + fclose (out); + } + ++/* As above, but with a size, to allow for NUL bytes in CONTENT. */ ++ ++temp_source_file::temp_source_file (const location &loc, ++ const char *suffix, ++ const char *content, ++ size_t sz) ++: named_temp_file (suffix) ++{ ++ FILE *out = fopen (get_filename (), "w"); ++ if (!out) ++ fail_formatted (loc, "unable to open tempfile: %s", get_filename ()); ++ fwrite (content, sz, 1, out); ++ fclose (out); ++} ++ + /* Avoid introducing locale-specific differences in the results + by hardcoding open_quote and close_quote. */ + +diff --git a/gcc/selftest.h b/gcc/selftest.h +--- a/gcc/selftest.h 2021-07-27 23:55:07.500290315 -0700 ++++ b/gcc/selftest.h 2021-12-14 01:16:01.557942991 -0800 +@@ -112,6 +112,8 @@ class temp_source_file : public named_te + public: + temp_source_file (const location &loc, const char *suffix, + const char *content); ++ temp_source_file (const location &loc, const char *suffix, ++ const char *content, size_t sz); + }; + + /* RAII-style class for avoiding introducing locale-specific differences +diff --git a/gcc/testsuite/c-c++-common/diagnostic-format-json-1.c b/gcc/testsuite/c-c++-common/diagnostic-format-json-1.c +--- a/gcc/testsuite/c-c++-common/diagnostic-format-json-1.c 2021-07-27 23:55:07.596291654 -0700 ++++ b/gcc/testsuite/c-c++-common/diagnostic-format-json-1.c 2021-12-14 01:16:01.557942991 -0800 +@@ -9,6 +9,7 @@ + + /* { dg-regexp "\"kind\": \"error\"" } */ + /* { dg-regexp "\"column-origin\": 1" } */ ++/* { dg-regexp "\"escape-source\": false" } */ + /* { dg-regexp "\"message\": \"#error message\"" } */ + + /* { dg-regexp "\"caret\": \{" } */ +diff --git a/gcc/testsuite/c-c++-common/diagnostic-format-json-2.c b/gcc/testsuite/c-c++-common/diagnostic-format-json-2.c +--- a/gcc/testsuite/c-c++-common/diagnostic-format-json-2.c 2021-07-27 23:55:07.596291654 -0700 ++++ b/gcc/testsuite/c-c++-common/diagnostic-format-json-2.c 2021-12-14 01:16:01.557942991 -0800 +@@ -9,6 +9,7 @@ + + /* { dg-regexp "\"kind\": \"warning\"" } */ + /* { dg-regexp "\"column-origin\": 1" } */ ++/* { dg-regexp "\"escape-source\": false" } */ + /* { dg-regexp "\"message\": \"#warning message\"" } */ + /* { dg-regexp "\"option\": \"-Wcpp\"" } */ + /* { dg-regexp "\"option_url\": \"https:\[^\n\r\"\]*#index-Wcpp\"" } */ +diff --git a/gcc/testsuite/c-c++-common/diagnostic-format-json-3.c b/gcc/testsuite/c-c++-common/diagnostic-format-json-3.c +--- a/gcc/testsuite/c-c++-common/diagnostic-format-json-3.c 2021-07-27 23:55:07.596291654 -0700 ++++ b/gcc/testsuite/c-c++-common/diagnostic-format-json-3.c 2021-12-14 01:16:01.557942991 -0800 +@@ -9,6 +9,7 @@ + + /* { dg-regexp "\"kind\": \"error\"" } */ + /* { dg-regexp "\"column-origin\": 1" } */ ++/* { dg-regexp "\"escape-source\": false" } */ + /* { dg-regexp "\"message\": \"#warning message\"" } */ + /* { dg-regexp "\"option\": \"-Werror=cpp\"" } */ + /* { dg-regexp "\"option_url\": \"https:\[^\n\r\"\]*#index-Wcpp\"" } */ +diff --git a/gcc/testsuite/c-c++-common/diagnostic-format-json-4.c b/gcc/testsuite/c-c++-common/diagnostic-format-json-4.c +--- a/gcc/testsuite/c-c++-common/diagnostic-format-json-4.c 2021-07-27 23:55:07.596291654 -0700 ++++ b/gcc/testsuite/c-c++-common/diagnostic-format-json-4.c 2021-12-14 01:16:01.557942991 -0800 +@@ -19,6 +19,7 @@ int test (void) + + /* { dg-regexp "\"kind\": \"note\"" } */ + /* { dg-regexp "\"message\": \"...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'\"" } */ ++/* { dg-regexp "\"escape-source\": false" } */ + + /* { dg-regexp "\"caret\": \{" } */ + /* { dg-regexp "\"file\": \"\[^\n\r\"\]*diagnostic-format-json-4.c\"" } */ +@@ -39,6 +40,7 @@ int test (void) + /* { dg-regexp "\"kind\": \"warning\"" } */ + /* { dg-regexp "\"column-origin\": 1" } */ + /* { dg-regexp "\"message\": \"this 'if' clause does not guard...\"" } */ ++/* { dg-regexp "\"escape-source\": false" } */ + /* { dg-regexp "\"option\": \"-Wmisleading-indentation\"" } */ + /* { dg-regexp "\"option_url\": \"https:\[^\n\r\"\]*#index-Wmisleading-indentation\"" } */ + +diff --git a/gcc/testsuite/c-c++-common/diagnostic-format-json-5.c b/gcc/testsuite/c-c++-common/diagnostic-format-json-5.c +--- a/gcc/testsuite/c-c++-common/diagnostic-format-json-5.c 2021-07-27 23:55:07.596291654 -0700 ++++ b/gcc/testsuite/c-c++-common/diagnostic-format-json-5.c 2021-12-14 01:16:01.557942991 -0800 +@@ -14,6 +14,7 @@ int test (struct s *ptr) + + /* { dg-regexp "\"kind\": \"error\"" } */ + /* { dg-regexp "\"column-origin\": 1" } */ ++/* { dg-regexp "\"escape-source\": false" } */ + /* { dg-regexp "\"message\": \".*\"" } */ + + /* Verify fix-it hints. */ +diff --git a/gcc/testsuite/gcc.dg/cpp/warn-normalized-4-bytes.c b/gcc/testsuite/gcc.dg/cpp/warn-normalized-4-bytes.c +--- a/gcc/testsuite/gcc.dg/cpp/warn-normalized-4-bytes.c 1969-12-31 16:00:00.000000000 -0800 ++++ b/gcc/testsuite/gcc.dg/cpp/warn-normalized-4-bytes.c 2021-12-14 01:16:01.557942991 -0800 +@@ -0,0 +1,21 @@ ++// { dg-do preprocess } ++// { dg-options "-std=gnu99 -Werror=normalized=nfc -fdiagnostics-show-caret -fdiagnostics-escape-format=bytes" } ++/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ ++ ++/* འ= U+0F43 TIBETAN LETTER GHA, which has decomposition "0F42 0FB7" i.e. ++ U+0F42 TIBETAN LETTER GA: འ++ U+0FB7 TIBETAN SUBJOINED LETTER HA: ྷ ++ ++ The UTF-8 encoding of U+0F43 TIBETAN LETTER GHA is: E0 BD 83. */ ++ ++foo before_\u0F43_after bar // { dg-error "`before_.U00000f43_after' is not in NFC .-Werror=normalized=." } ++/* { dg-begin-multiline-output "" } ++ foo before_\u0F43_after bar ++ ^~~~~~~~~~~~~~~~~~~ ++ { dg-end-multiline-output "" } */ ++ ++foo before_à½_after bar // { dg-error "`before_.U00000f43_after' is not in NFC .-Werror=normalized=." } ++/* { dg-begin-multiline-output "" } ++ foo before_<83>_after bar ++ ^~~~~~~~~~~~~~~~~~~~~~~~~ ++ { dg-end-multiline-output "" } */ +diff --git a/gcc/testsuite/gcc.dg/cpp/warn-normalized-4-unicode.c b/gcc/testsuite/gcc.dg/cpp/warn-normalized-4-unicode.c +--- a/gcc/testsuite/gcc.dg/cpp/warn-normalized-4-unicode.c 1969-12-31 16:00:00.000000000 -0800 ++++ b/gcc/testsuite/gcc.dg/cpp/warn-normalized-4-unicode.c 2021-12-14 01:16:01.557942991 -0800 +@@ -0,0 +1,19 @@ ++// { dg-do preprocess } ++// { dg-options "-std=gnu99 -Werror=normalized=nfc -fdiagnostics-show-caret -fdiagnostics-escape-format=unicode" } ++/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ ++ ++/* འ= U+0F43 TIBETAN LETTER GHA, which has decomposition "0F42 0FB7" i.e. ++ U+0F42 TIBETAN LETTER GA: འ++ U+0FB7 TIBETAN SUBJOINED LETTER HA: ྷ */ ++ ++foo before_\u0F43_after bar // { dg-error "`before_.U00000f43_after' is not in NFC .-Werror=normalized=." } ++/* { dg-begin-multiline-output "" } ++ foo before_\u0F43_after bar ++ ^~~~~~~~~~~~~~~~~~~ ++ { dg-end-multiline-output "" } */ ++ ++foo before_à½_after bar // { dg-error "`before_.U00000f43_after' is not in NFC .-Werror=normalized=." } ++/* { dg-begin-multiline-output "" } ++ foo before__after bar ++ ^~~~~~~~~~~~~~~~~~~~~ ++ { dg-end-multiline-output "" } */ +diff --git a/gcc/testsuite/gfortran.dg/diagnostic-format-json-1.F90 b/gcc/testsuite/gfortran.dg/diagnostic-format-json-1.F90 +--- a/gcc/testsuite/gfortran.dg/diagnostic-format-json-1.F90 2021-07-27 23:55:08.472303878 -0700 ++++ b/gcc/testsuite/gfortran.dg/diagnostic-format-json-1.F90 2021-12-14 01:16:01.557942991 -0800 +@@ -9,6 +9,7 @@ + + ! { dg-regexp "\"kind\": \"error\"" } + ! { dg-regexp "\"column-origin\": 1" } ++! { dg-regexp "\"escape-source\": false" } + ! { dg-regexp "\"message\": \"#error message\"" } + + ! { dg-regexp "\"caret\": \{" } +diff --git a/gcc/testsuite/gfortran.dg/diagnostic-format-json-2.F90 b/gcc/testsuite/gfortran.dg/diagnostic-format-json-2.F90 +--- a/gcc/testsuite/gfortran.dg/diagnostic-format-json-2.F90 2021-07-27 23:55:08.472303878 -0700 ++++ b/gcc/testsuite/gfortran.dg/diagnostic-format-json-2.F90 2021-12-14 01:16:01.557942991 -0800 +@@ -9,6 +9,7 @@ + + ! { dg-regexp "\"kind\": \"warning\"" } + ! { dg-regexp "\"column-origin\": 1" } ++! { dg-regexp "\"escape-source\": false" } + ! { dg-regexp "\"message\": \"#warning message\"" } + ! { dg-regexp "\"option\": \"-Wcpp\"" } + ! { dg-regexp "\"option_url\": \"\[^\n\r\"\]*#index-Wcpp\"" } +diff --git a/gcc/testsuite/gfortran.dg/diagnostic-format-json-3.F90 b/gcc/testsuite/gfortran.dg/diagnostic-format-json-3.F90 +--- a/gcc/testsuite/gfortran.dg/diagnostic-format-json-3.F90 2021-07-27 23:55:08.472303878 -0700 ++++ b/gcc/testsuite/gfortran.dg/diagnostic-format-json-3.F90 2021-12-14 01:16:01.557942991 -0800 +@@ -9,6 +9,7 @@ + + ! { dg-regexp "\"kind\": \"error\"" } + ! { dg-regexp "\"column-origin\": 1" } ++! { dg-regexp "\"escape-source\": false" } + ! { dg-regexp "\"message\": \"#warning message\"" } + ! { dg-regexp "\"option\": \"-Werror=cpp\"" } + ! { dg-regexp "\"option_url\": \"\[^\n\r\"\]*#index-Wcpp\"" } +diff --git a/libcpp/charset.c b/libcpp/charset.c +--- a/libcpp/charset.c 2021-07-27 23:55:08.712307227 -0700 ++++ b/libcpp/charset.c 2021-12-14 01:16:01.557942991 -0800 +@@ -1552,12 +1552,14 @@ convert_escape (cpp_reader *pfile, const + "unknown escape sequence: '\\%c'", (int) c); + else + { ++ encoding_rich_location rich_loc (pfile); ++ + /* diagnostic.c does not support "%03o". When it does, this + code can use %03o directly in the diagnostic again. */ + char buf[32]; + sprintf(buf, "%03o", (int) c); +- cpp_error (pfile, CPP_DL_PEDWARN, +- "unknown escape sequence: '\\%s'", buf); ++ cpp_error_at (pfile, CPP_DL_PEDWARN, &rich_loc, ++ "unknown escape sequence: '\\%s'", buf); + } + } + +@@ -2280,14 +2282,16 @@ cpp_string_location_reader::get_next () + } + + cpp_display_width_computation:: +-cpp_display_width_computation (const char *data, int data_length, int tabstop) : ++cpp_display_width_computation (const char *data, int data_length, ++ const cpp_char_column_policy &policy) : + m_begin (data), + m_next (m_begin), + m_bytes_left (data_length), +- m_tabstop (tabstop), ++ m_policy (policy), + m_display_cols (0) + { +- gcc_assert (m_tabstop > 0); ++ gcc_assert (policy.m_tabstop > 0); ++ gcc_assert (policy.m_width_cb); + } + + +@@ -2299,19 +2303,28 @@ cpp_display_width_computation (const cha + point to a valid UTF-8-encoded sequence, then it will be treated as a single + byte with display width 1. m_cur_display_col is the current display column, + relative to which tab stops should be expanded. Returns the display width of +- the codepoint just processed. */ ++ the codepoint just processed. ++ If OUT is non-NULL, it is populated. */ + + int +-cpp_display_width_computation::process_next_codepoint () ++cpp_display_width_computation::process_next_codepoint (cpp_decoded_char *out) + { + cppchar_t c; + int next_width; + ++ if (out) ++ out->m_start_byte = m_next; ++ + if (*m_next == '\t') + { + ++m_next; + --m_bytes_left; +- next_width = m_tabstop - (m_display_cols % m_tabstop); ++ next_width = m_policy.m_tabstop - (m_display_cols % m_policy.m_tabstop); ++ if (out) ++ { ++ out->m_ch = '\t'; ++ out->m_valid_ch = true; ++ } + } + else if (one_utf8_to_cppchar ((const uchar **) &m_next, &m_bytes_left, &c) + != 0) +@@ -2321,14 +2334,24 @@ cpp_display_width_computation::process_n + of one. */ + ++m_next; + --m_bytes_left; +- next_width = 1; ++ next_width = m_policy.m_undecoded_byte_width; ++ if (out) ++ out->m_valid_ch = false; + } + else + { + /* one_utf8_to_cppchar() has updated m_next and m_bytes_left for us. */ +- next_width = cpp_wcwidth (c); ++ next_width = m_policy.m_width_cb (c); ++ if (out) ++ { ++ out->m_ch = c; ++ out->m_valid_ch = true; ++ } + } + ++ if (out) ++ out->m_next_byte = m_next; ++ + m_display_cols += next_width; + return next_width; + } +@@ -2344,7 +2367,7 @@ cpp_display_width_computation::advance_d + const int start = m_display_cols; + const int target = start + n; + while (m_display_cols < target && !done ()) +- process_next_codepoint (); ++ process_next_codepoint (NULL); + return m_display_cols - start; + } + +@@ -2352,29 +2375,33 @@ cpp_display_width_computation::advance_d + how many display columns are occupied by the first COLUMN bytes. COLUMN + may exceed DATA_LENGTH, in which case the phantom bytes at the end are + treated as if they have display width 1. Tabs are expanded to the next tab +- stop, relative to the start of DATA. */ ++ stop, relative to the start of DATA, and non-printable-ASCII characters ++ will be escaped as per POLICY. */ + + int + cpp_byte_column_to_display_column (const char *data, int data_length, +- int column, int tabstop) ++ int column, ++ const cpp_char_column_policy &policy) + { + const int offset = MAX (0, column - data_length); +- cpp_display_width_computation dw (data, column - offset, tabstop); ++ cpp_display_width_computation dw (data, column - offset, policy); + while (!dw.done ()) +- dw.process_next_codepoint (); ++ dw.process_next_codepoint (NULL); + return dw.display_cols_processed () + offset; + } + + /* For the string of length DATA_LENGTH bytes that begins at DATA, compute + the least number of bytes that will result in at least DISPLAY_COL display + columns. The return value may exceed DATA_LENGTH if the entire string does +- not occupy enough display columns. */ ++ not occupy enough display columns. Non-printable-ASCII characters ++ will be escaped as per POLICY. */ + + int + cpp_display_column_to_byte_column (const char *data, int data_length, +- int display_col, int tabstop) ++ int display_col, ++ const cpp_char_column_policy &policy) + { +- cpp_display_width_computation dw (data, data_length, tabstop); ++ cpp_display_width_computation dw (data, data_length, policy); + const int avail_display = dw.advance_display_cols (display_col); + return dw.bytes_processed () + MAX (0, display_col - avail_display); + } +diff --git a/libcpp/errors.c b/libcpp/errors.c +--- a/libcpp/errors.c 2021-07-27 23:55:08.712307227 -0700 ++++ b/libcpp/errors.c 2021-12-14 01:16:01.557942991 -0800 +@@ -27,6 +27,31 @@ along with this program; see the file CO + #include "cpplib.h" + #include "internal.h" + ++/* Get a location_t for the current location in PFILE, ++ generally that of the previously lexed token. */ ++ ++location_t ++cpp_diagnostic_get_current_location (cpp_reader *pfile) ++{ ++ if (CPP_OPTION (pfile, traditional)) ++ { ++ if (pfile->state.in_directive) ++ return pfile->directive_line; ++ else ++ return pfile->line_table->highest_line; ++ } ++ /* We don't want to refer to a token before the beginning of the ++ current run -- that is invalid. */ ++ else if (pfile->cur_token == pfile->cur_run->base) ++ { ++ return 0; ++ } ++ else ++ { ++ return pfile->cur_token[-1].src_loc; ++ } ++} ++ + /* Print a diagnostic at the given location. */ + + ATTRIBUTE_FPTR_PRINTF(5,0) +@@ -52,25 +77,7 @@ cpp_diagnostic (cpp_reader * pfile, enum + enum cpp_warning_reason reason, + const char *msgid, va_list *ap) + { +- location_t src_loc; +- +- if (CPP_OPTION (pfile, traditional)) +- { +- if (pfile->state.in_directive) +- src_loc = pfile->directive_line; +- else +- src_loc = pfile->line_table->highest_line; +- } +- /* We don't want to refer to a token before the beginning of the +- current run -- that is invalid. */ +- else if (pfile->cur_token == pfile->cur_run->base) +- { +- src_loc = 0; +- } +- else +- { +- src_loc = pfile->cur_token[-1].src_loc; +- } ++ location_t src_loc = cpp_diagnostic_get_current_location (pfile); + rich_location richloc (pfile->line_table, src_loc); + return cpp_diagnostic_at (pfile, level, reason, &richloc, msgid, ap); + } +@@ -142,6 +149,43 @@ cpp_warning_syshdr (cpp_reader * pfile, + + va_end (ap); + return ret; ++} ++ ++/* As cpp_warning above, but use RICHLOC as the location of the diagnostic. */ ++ ++bool cpp_warning_at (cpp_reader *pfile, enum cpp_warning_reason reason, ++ rich_location *richloc, const char *msgid, ...) ++{ ++ va_list ap; ++ bool ret; ++ ++ va_start (ap, msgid); ++ ++ ret = cpp_diagnostic_at (pfile, CPP_DL_WARNING, reason, richloc, ++ msgid, &ap); ++ ++ va_end (ap); ++ return ret; ++ ++} ++ ++/* As cpp_pedwarning above, but use RICHLOC as the location of the ++ diagnostic. */ ++ ++bool ++cpp_pedwarning_at (cpp_reader * pfile, enum cpp_warning_reason reason, ++ rich_location *richloc, const char *msgid, ...) ++{ ++ va_list ap; ++ bool ret; ++ ++ va_start (ap, msgid); ++ ++ ret = cpp_diagnostic_at (pfile, CPP_DL_PEDWARN, reason, richloc, ++ msgid, &ap); ++ ++ va_end (ap); ++ return ret; + } + + /* Print a diagnostic at a specific location. */ +diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h +--- a/libcpp/include/cpplib.h 2021-12-13 23:23:05.768437079 -0800 ++++ b/libcpp/include/cpplib.h 2021-12-14 01:20:16.189507386 -0800 +@@ -1275,6 +1275,14 @@ extern bool cpp_warning_syshdr (cpp_read + const char *msgid, ...) + ATTRIBUTE_PRINTF_3; + ++/* As their counterparts above, but use RICHLOC. */ ++extern bool cpp_warning_at (cpp_reader *, enum cpp_warning_reason, ++ rich_location *richloc, const char *msgid, ...) ++ ATTRIBUTE_PRINTF_4; ++extern bool cpp_pedwarning_at (cpp_reader *, enum cpp_warning_reason, ++ rich_location *richloc, const char *msgid, ...) ++ ATTRIBUTE_PRINTF_4; ++ + /* Output a diagnostic with "MSGID: " preceding the + error string of errno. No location is printed. */ + extern bool cpp_errno (cpp_reader *, enum cpp_diagnostic_level, +@@ -1435,42 +1443,95 @@ extern const char * cpp_get_userdef_suff + + /* In charset.c */ + ++/* The result of attempting to decode a run of UTF-8 bytes. */ ++ ++struct cpp_decoded_char ++{ ++ const char *m_start_byte; ++ const char *m_next_byte; ++ ++ bool m_valid_ch; ++ cppchar_t m_ch; ++}; ++ ++/* Information for mapping between code points and display columns. ++ ++ This is a tabstop value, along with a callback for getting the ++ widths of characters. Normally this callback is cpp_wcwidth, but we ++ support other schemes for escaping non-ASCII unicode as a series of ++ ASCII chars when printing the user's source code in diagnostic-show-locus.c ++ ++ For example, consider: ++ - the Unicode character U+03C0 "GREEK SMALL LETTER PI" (UTF-8: 0xCF 0x80) ++ - the Unicode character U+1F642 "SLIGHTLY SMILING FACE" ++ (UTF-8: 0xF0 0x9F 0x99 0x82) ++ - the byte 0xBF (a stray trailing byte of a UTF-8 character) ++ Normally U+03C0 would occupy one display column, U+1F642 ++ would occupy two display columns, and the stray byte would be ++ printed verbatim as one display column. ++ ++ However when escaping them as unicode code points as "" ++ and "" they occupy 8 and 9 display columns respectively, ++ and when escaping them as bytes as "<80>" and "<9F><99><82>" ++ they occupy 8 and 16 display columns respectively. In both cases ++ the stray byte is escaped to as 4 display columns. */ ++ ++struct cpp_char_column_policy ++{ ++ cpp_char_column_policy (int tabstop, ++ int (*width_cb) (cppchar_t c)) ++ : m_tabstop (tabstop), ++ m_undecoded_byte_width (1), ++ m_width_cb (width_cb) ++ {} ++ ++ int m_tabstop; ++ /* Width in display columns of a stray byte that isn't decodable ++ as UTF-8. */ ++ int m_undecoded_byte_width; ++ int (*m_width_cb) (cppchar_t c); ++}; ++ + /* A class to manage the state while converting a UTF-8 sequence to cppchar_t + and computing the display width one character at a time. */ + class cpp_display_width_computation { + public: + cpp_display_width_computation (const char *data, int data_length, +- int tabstop); ++ const cpp_char_column_policy &policy); + const char *next_byte () const { return m_next; } + int bytes_processed () const { return m_next - m_begin; } + int bytes_left () const { return m_bytes_left; } + bool done () const { return !bytes_left (); } + int display_cols_processed () const { return m_display_cols; } + +- int process_next_codepoint (); ++ int process_next_codepoint (cpp_decoded_char *out); + int advance_display_cols (int n); + + private: + const char *const m_begin; + const char *m_next; + size_t m_bytes_left; +- const int m_tabstop; ++ const cpp_char_column_policy &m_policy; + int m_display_cols; + }; + + /* Convenience functions that are simple use cases for class + cpp_display_width_computation. Tab characters will be expanded to spaces +- as determined by TABSTOP. */ ++ as determined by POLICY.m_tabstop, and non-printable-ASCII characters ++ will be escaped as per POLICY. */ ++ + int cpp_byte_column_to_display_column (const char *data, int data_length, +- int column, int tabstop); ++ int column, ++ const cpp_char_column_policy &policy); + inline int cpp_display_width (const char *data, int data_length, +- int tabstop) ++ const cpp_char_column_policy &policy) + { + return cpp_byte_column_to_display_column (data, data_length, data_length, +- tabstop); ++ policy); + } + int cpp_display_column_to_byte_column (const char *data, int data_length, +- int display_col, int tabstop); ++ int display_col, ++ const cpp_char_column_policy &policy); + int cpp_wcwidth (cppchar_t c); + + #endif /* ! LIBCPP_CPPLIB_H */ +diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h +--- a/libcpp/include/line-map.h 2021-07-27 23:55:08.716307283 -0700 ++++ b/libcpp/include/line-map.h 2021-12-14 01:16:01.557942991 -0800 +@@ -1781,6 +1781,18 @@ class rich_location + const diagnostic_path *get_path () const { return m_path; } + void set_path (const diagnostic_path *path) { m_path = path; } + ++ /* A flag for hinting that the diagnostic involves character encoding ++ issues, and thus that it will be helpful to the user if we show some ++ representation of how the characters in the pertinent source lines ++ are encoded. ++ The default is false (i.e. do not escape). ++ When set to true, non-ASCII bytes in the pertinent source lines will ++ be escaped in a manner controlled by the user-supplied option ++ -fdiagnostics-escape-format=, so that the user can better understand ++ what's going on with the encoding in their source file. */ ++ bool escape_on_output_p () const { return m_escape_on_output; } ++ void set_escape_on_output (bool flag) { m_escape_on_output = flag; } ++ + private: + bool reject_impossible_fixit (location_t where); + void stop_supporting_fixits (); +@@ -1807,6 +1819,7 @@ protected: + bool m_fixits_cannot_be_auto_applied; + + const diagnostic_path *m_path; ++ bool m_escape_on_output; + }; + + /* A struct for the result of range_label::get_text: a NUL-terminated buffer +diff --git a/libcpp/internal.h b/libcpp/internal.h +--- a/libcpp/internal.h 2021-12-13 23:23:05.768437079 -0800 ++++ b/libcpp/internal.h 2021-12-14 01:16:01.557942991 -0800 +@@ -776,6 +776,9 @@ extern void _cpp_do_file_change (cpp_rea + extern void _cpp_pop_buffer (cpp_reader *); + extern char *_cpp_bracket_include (cpp_reader *); + ++/* In errors.c */ ++extern location_t cpp_diagnostic_get_current_location (cpp_reader *); ++ + /* In traditional.c. */ + extern bool _cpp_scan_out_logical_line (cpp_reader *, cpp_macro *, bool); + extern bool _cpp_read_logical_line_trad (cpp_reader *); +@@ -942,6 +945,26 @@ int linemap_get_expansion_line (class li + const char* linemap_get_expansion_filename (class line_maps *, + location_t); + ++/* A subclass of rich_location for emitting a diagnostic ++ at the current location of the reader, but flagging ++ it with set_escape_on_output (true). */ ++class encoding_rich_location : public rich_location ++{ ++ public: ++ encoding_rich_location (cpp_reader *pfile) ++ : rich_location (pfile->line_table, ++ cpp_diagnostic_get_current_location (pfile)) ++ { ++ set_escape_on_output (true); ++ } ++ ++ encoding_rich_location (cpp_reader *pfile, location_t loc) ++ : rich_location (pfile->line_table, loc) ++ { ++ set_escape_on_output (true); ++ } ++}; ++ + #ifdef __cplusplus + } + #endif +diff --git a/libcpp/lex.c b/libcpp/lex.c +--- a/libcpp/lex.c 2021-12-14 01:14:48.435225968 -0800 ++++ b/libcpp/lex.c 2021-12-14 01:24:37.220995816 -0800 +@@ -1774,7 +1774,11 @@ skip_whitespace (cpp_reader *pfile, cppc + while (is_nvspace (c)); + + if (saw_NUL) +- cpp_error (pfile, CPP_DL_WARNING, "null character(s) ignored"); ++ { ++ encoding_rich_location rich_loc (pfile); ++ cpp_error_at (pfile, CPP_DL_WARNING, &rich_loc, ++ "null character(s) ignored"); ++ } + + buffer->cur--; + } +@@ -1803,6 +1807,28 @@ warn_about_normalization (cpp_reader *pf + if (CPP_OPTION (pfile, warn_normalize) < NORMALIZE_STATE_RESULT (s) + && !pfile->state.skipping) + { ++ location_t loc = token->src_loc; ++ ++ /* If possible, create a location range for the token. */ ++ if (loc >= RESERVED_LOCATION_COUNT ++ && token->type != CPP_EOF ++ /* There must be no line notes to process. */ ++ && (!(pfile->buffer->cur ++ >= pfile->buffer->notes[pfile->buffer->cur_note].pos ++ && !pfile->overlaid_buffer))) ++ { ++ source_range tok_range; ++ tok_range.m_start = loc; ++ tok_range.m_finish ++ = linemap_position_for_column (pfile->line_table, ++ CPP_BUF_COLUMN (pfile->buffer, ++ pfile->buffer->cur)); ++ loc = COMBINE_LOCATION_DATA (pfile->line_table, ++ loc, tok_range, NULL); ++ } ++ ++ encoding_rich_location rich_loc (pfile, loc); ++ + /* Make sure that the token is printed using UCNs, even + if we'd otherwise happily print UTF-8. */ + unsigned char *buf = XNEWVEC (unsigned char, cpp_token_len (token)); +@@ -1810,11 +1836,11 @@ warn_about_normalization (cpp_reader *pf + + sz = cpp_spell_token (pfile, token, buf, false) - buf; + if (NORMALIZE_STATE_RESULT (s) == normalized_C) +- cpp_warning_with_line (pfile, CPP_W_NORMALIZE, token->src_loc, 0, +- "`%.*s' is not in NFKC", (int) sz, buf); ++ cpp_warning_at (pfile, CPP_W_NORMALIZE, &rich_loc, ++ "`%.*s' is not in NFKC", (int) sz, buf); + else +- cpp_warning_with_line (pfile, CPP_W_NORMALIZE, token->src_loc, 0, +- "`%.*s' is not in NFC", (int) sz, buf); ++ cpp_warning_at (pfile, CPP_W_NORMALIZE, &rich_loc, ++ "`%.*s' is not in NFC", (int) sz, buf); + free (buf); + } + } +diff --git a/libcpp/line-map.c b/libcpp/line-map.c +--- a/libcpp/line-map.c 2021-07-27 23:55:08.716307283 -0700 ++++ b/libcpp/line-map.c 2021-12-14 01:16:01.561942921 -0800 +@@ -2086,7 +2086,8 @@ rich_location::rich_location (line_maps + m_fixit_hints (), + m_seen_impossible_fixit (false), + m_fixits_cannot_be_auto_applied (false), +- m_path (NULL) ++ m_path (NULL), ++ m_escape_on_output (false) + { + add_range (loc, SHOW_RANGE_WITH_CARET, label); + } diff --git a/recipes-devtools/gcc/gcc-arc/0001-CVE-2021-46195.patch b/recipes-devtools/gcc/gcc-arc/0001-CVE-2021-46195.patch new file mode 100644 index 0000000..7b3651c --- /dev/null +++ b/recipes-devtools/gcc/gcc-arc/0001-CVE-2021-46195.patch @@ -0,0 +1,128 @@ +From f10bec5ffa487ad3033ed5f38cfd0fc7d696deab Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Mon, 31 Jan 2022 14:28:42 +0000 +Subject: [PATCH] libiberty: Fix infinite recursion in rust demangler. + +libiberty/ + PR demangler/98886 + PR demangler/99935 + * rust-demangle.c (struct rust_demangler): Add a recursion + counter. + (demangle_path): Increment/decrement the recursion counter upon + entry and exit. Fail if the counter exceeds a fixed limit. + (demangle_type): Likewise. + (rust_demangle_callback): Initialise the recursion counter, + disabling if requested by the option flags. + +CVE: CVE-2021-46195 +Upstream-Status: Backport +[https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=f10bec5ffa487ad3033ed5f38cfd0fc7d696deab] +Signed-off-by: Pgowda +--- + libiberty/rust-demangle.c | 47 ++++++++++++++++++++++++++++++++++----- + 1 file changed, 41 insertions(+), 6 deletions(-) + +diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c +index 18c760491bd..3b24d63892a 100644 +--- a/libiberty/rust-demangle.c ++++ b/libiberty/rust-demangle.c +@@ -74,6 +74,12 @@ struct rust_demangler + /* Rust mangling version, with legacy mangling being -1. */ + int version; + ++ /* Recursion depth. */ ++ unsigned int recursion; ++ /* Maximum number of times demangle_path may be called recursively. */ ++#define RUST_MAX_RECURSION_COUNT 1024 ++#define RUST_NO_RECURSION_LIMIT ((unsigned int) -1) ++ + uint64_t bound_lifetime_depth; + }; + +@@ -671,6 +677,15 @@ demangle_path (struct rust_demangler *rdm, int in_value) + if (rdm->errored) + return; + ++ if (rdm->recursion != RUST_NO_RECURSION_LIMIT) ++ { ++ ++ rdm->recursion; ++ if (rdm->recursion > RUST_MAX_RECURSION_COUNT) ++ /* FIXME: There ought to be a way to report ++ that the recursion limit has been reached. */ ++ goto fail_return; ++ } ++ + switch (tag = next (rdm)) + { + case 'C': +@@ -688,10 +703,7 @@ demangle_path (struct rust_demangler *rdm, int in_value) + case 'N': + ns = next (rdm); + if (!ISLOWER (ns) && !ISUPPER (ns)) +- { +- rdm->errored = 1; +- return; +- } ++ goto fail_return; + + demangle_path (rdm, in_value); + +@@ -776,9 +788,15 @@ demangle_path (struct rust_demangler *rdm, int in_value) + } + break; + default: +- rdm->errored = 1; +- return; ++ goto fail_return; + } ++ goto pass_return; ++ ++ fail_return: ++ rdm->errored = 1; ++ pass_return: ++ if (rdm->recursion != RUST_NO_RECURSION_LIMIT) ++ -- rdm->recursion; + } + + static void +@@ -870,6 +888,19 @@ demangle_type (struct rust_demangler *rdm) + return; + } + ++ if (rdm->recursion != RUST_NO_RECURSION_LIMIT) ++ { ++ ++ rdm->recursion; ++ if (rdm->recursion > RUST_MAX_RECURSION_COUNT) ++ /* FIXME: There ought to be a way to report ++ that the recursion limit has been reached. */ ++ { ++ rdm->errored = 1; ++ -- rdm->recursion; ++ return; ++ } ++ } ++ + switch (tag) + { + case 'R': +@@ -1030,6 +1061,9 @@ demangle_type (struct rust_demangler *rdm) + rdm->next--; + demangle_path (rdm, 0); + } ++ ++ if (rdm->recursion != RUST_NO_RECURSION_LIMIT) ++ -- rdm->recursion; + } + + /* A trait in a trait object may have some "existential projections" +@@ -1320,6 +1354,7 @@ rust_demangle_callback (const char *mangled, int options, + rdm.skipping_printing = 0; + rdm.verbose = (options & DMGL_VERBOSE) != 0; + rdm.version = 0; ++ rdm.recursion = (options & DMGL_NO_RECURSE_LIMIT) ? RUST_NO_RECURSION_LIMIT : 0; + rdm.bound_lifetime_depth = 0; + + /* Rust symbols always start with _R (v0) or _ZN (legacy). */ +-- +2.27.0 + diff --git a/recipes-devtools/gcc/gcc-arc/0001-Fix-install-path-of-linux64.h.patch b/recipes-devtools/gcc/gcc-arc/0001-Fix-install-path-of-linux64.h.patch new file mode 100644 index 0000000..5bf895d --- /dev/null +++ b/recipes-devtools/gcc/gcc-arc/0001-Fix-install-path-of-linux64.h.patch @@ -0,0 +1,33 @@ +From 58211c7ceb0510b2a11a7f1da3c7fa968c658749 Mon Sep 17 00:00:00 2001 +From: Andrei Gherzan +Date: Wed, 22 Dec 2021 12:49:25 +0100 +Subject: [PATCH] Fix install path of linux64.h + +We add linux64.h to tm includes[1] as a relative path to B. This patch +adapts the install path of linux64.h to match the include in tm.h. + +[1] 0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch + +Signed-off-by: Andrei Gherzan + +Upstream-Status: Inappropriate [configuration] +--- + gcc/Makefile.in | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/gcc/Makefile.in b/gcc/Makefile.in +index 9b17d120a..d175ec4e3 100644 +--- a/gcc/Makefile.in ++++ b/gcc/Makefile.in +@@ -3693,6 +3693,8 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype + "$(srcdir)"/config/* | "$(srcdir)"/common/config/* \ + | "$(srcdir)"/c-family/* | "$(srcdir)"/*.def ) \ + base=`echo "$$path" | sed -e "s|$$srcdirstrip/||"`;; \ ++ */linux64.h ) \ ++ base=`dirname $$path`;;\ + *) base=`basename $$path` ;; \ + esac; \ + dest=$(plugin_includedir)/$$base; \ +-- +2.25.1 + diff --git a/recipes-devtools/gcc/gcc-arc/0001-aarch64-Fix-up-__aarch64_cas16_acq_rel-fallback.patch b/recipes-devtools/gcc/gcc-arc/0001-aarch64-Fix-up-__aarch64_cas16_acq_rel-fallback.patch deleted file mode 100644 index c060acc..0000000 --- a/recipes-devtools/gcc/gcc-arc/0001-aarch64-Fix-up-__aarch64_cas16_acq_rel-fallback.patch +++ /dev/null @@ -1,66 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From fd2ec4542fd2975e6d3f2f1c1a2639945a84f9e1 Mon Sep 17 00:00:00 2001 -From: Jakub Jelinek -Date: Mon, 3 Aug 2020 22:55:28 +0200 -Subject: [PATCH] aarch64: Fix up __aarch64_cas16_acq_rel fallback - -As mentioned in the PR, the fallback path when LSE is unavailable writes -incorrect registers to the memory if the previous content compares equal -to x0, x1 - it writes copy of x0, x1 from the start of function, but it -should write x2, x3. - -2020-08-03 Jakub Jelinek - - PR target/96402 - * config/aarch64/lse.S (__aarch64_cas16_acq_rel): Use x2, x3 instead - of x(tmp0), x(tmp1) in STXP arguments. - - * gcc.target/aarch64/pr96402.c: New test. - -(cherry picked from commit 90b43856fdff7d96d93d22970eca8a86c56e0ddc) ---- - gcc/testsuite/gcc.target/aarch64/pr96402.c | 16 ++++++++++++++++ - libgcc/config/aarch64/lse.S | 2 +- - 2 files changed, 17 insertions(+), 1 deletion(-) - create mode 100644 gcc/testsuite/gcc.target/aarch64/pr96402.c - -diff --git a/gcc/testsuite/gcc.target/aarch64/pr96402.c b/gcc/testsuite/gcc.target/aarch64/pr96402.c -new file mode 100644 -index 00000000000..fa2dddfac15 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/aarch64/pr96402.c -@@ -0,0 +1,16 @@ -+/* PR target/96402 */ -+/* { dg-do run { target int128 } } */ -+/* { dg-options "-moutline-atomics" } */ -+ -+int -+main () -+{ -+ __int128 a = 0; -+ __sync_val_compare_and_swap (&a, (__int128) 0, (__int128) 1); -+ if (a != 1) -+ __builtin_abort (); -+ __sync_val_compare_and_swap (&a, (__int128) 1, (((__int128) 0xdeadbeeffeedbac1ULL) << 64) | 0xabadcafe00c0ffeeULL); -+ if (a != ((((__int128) 0xdeadbeeffeedbac1ULL) << 64) | 0xabadcafe00c0ffeeULL)) -+ __builtin_abort (); -+ return 0; -+} -diff --git a/libgcc/config/aarch64/lse.S b/libgcc/config/aarch64/lse.S -index 64691c601c1..c8fbfbce4fd 100644 ---- a/libgcc/config/aarch64/lse.S -+++ b/libgcc/config/aarch64/lse.S -@@ -203,7 +203,7 @@ STARTFN NAME(cas) - cmp x0, x(tmp0) - ccmp x1, x(tmp1), #0, eq - bne 1f -- STXP w(tmp2), x(tmp0), x(tmp1), [x4] -+ STXP w(tmp2), x2, x3, [x4] - cbnz w(tmp2), 0b - 1: ret - --- -2.26.2 - diff --git a/recipes-devtools/gcc/gcc-arc/0001-aarch64-New-Straight-Line-Speculation-SLS-mitigation.patch b/recipes-devtools/gcc/gcc-arc/0001-aarch64-New-Straight-Line-Speculation-SLS-mitigation.patch deleted file mode 100644 index 73de4c7..0000000 --- a/recipes-devtools/gcc/gcc-arc/0001-aarch64-New-Straight-Line-Speculation-SLS-mitigation.patch +++ /dev/null @@ -1,202 +0,0 @@ -CVE: CVE-2020-13844 -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From 1ff243934ac443b5f58cd02a5012ce58ecc31fb2 Mon Sep 17 00:00:00 2001 -From: Matthew Malcomson -Date: Thu, 9 Jul 2020 09:11:58 +0100 -Subject: [PATCH 1/3] aarch64: New Straight Line Speculation (SLS) mitigation - flags - -Here we introduce the flags that will be used for straight line speculation. - -The new flag introduced is `-mharden-sls=`. -This flag can take arguments of `none`, `all`, or a comma seperated list of one -or more of `retbr` or `blr`. -`none` indicates no special mitigation of the straight line speculation -vulnerability. -`all` requests all mitigations currently implemented. -`retbr` requests that the RET and BR instructions have a speculation barrier -inserted after them. -`blr` requests that BLR instructions are replaced by a BL to a function stub -using a BR with a speculation barrier after it. - -Setting this on a per-function basis using attributes or the like is not -enabled, but may be in the future. - -gcc/ChangeLog: - -2020-06-02 Matthew Malcomson - - * config/aarch64/aarch64-protos.h (aarch64_harden_sls_retbr_p): - New. - (aarch64_harden_sls_blr_p): New. - * config/aarch64/aarch64.c (enum aarch64_sls_hardening_type): - New. - (aarch64_harden_sls_retbr_p): New. - (aarch64_harden_sls_blr_p): New. - (aarch64_validate_sls_mitigation): New. - (aarch64_override_options): Parse options for SLS mitigation. - * config/aarch64/aarch64.opt (-mharden-sls): New option. - * doc/invoke.texi: Document new option. ---- - gcc/config/aarch64/aarch64-protos.h | 3 ++ - gcc/config/aarch64/aarch64.c | 76 +++++++++++++++++++++++++++++++++++++ - gcc/config/aarch64/aarch64.opt | 4 ++ - gcc/doc/invoke.texi | 12 ++++++ - 4 files changed, 95 insertions(+) - -diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h -index 723d9ba..eb5f4b4 100644 ---- a/gcc/config/aarch64/aarch64-protos.h -+++ b/gcc/config/aarch64/aarch64-protos.h -@@ -781,4 +781,7 @@ extern const atomic_ool_names aarch64_ool_ldeor_names; - - tree aarch64_resolve_overloaded_builtin_general (location_t, tree, void *); - -+extern bool aarch64_harden_sls_retbr_p (void); -+extern bool aarch64_harden_sls_blr_p (void); -+ - #endif /* GCC_AARCH64_PROTOS_H */ -diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c -index b86434a..437a9cf 100644 ---- a/gcc/config/aarch64/aarch64.c -+++ b/gcc/config/aarch64/aarch64.c -@@ -14494,6 +14494,79 @@ aarch64_validate_mcpu (const char *str, const struct processor **res, - return false; - } - -+/* Straight line speculation indicators. */ -+enum aarch64_sls_hardening_type -+{ -+ SLS_NONE = 0, -+ SLS_RETBR = 1, -+ SLS_BLR = 2, -+ SLS_ALL = 3, -+}; -+static enum aarch64_sls_hardening_type aarch64_sls_hardening; -+ -+/* Return whether we should mitigatate Straight Line Speculation for the RET -+ and BR instructions. */ -+bool -+aarch64_harden_sls_retbr_p (void) -+{ -+ return aarch64_sls_hardening & SLS_RETBR; -+} -+ -+/* Return whether we should mitigatate Straight Line Speculation for the BLR -+ instruction. */ -+bool -+aarch64_harden_sls_blr_p (void) -+{ -+ return aarch64_sls_hardening & SLS_BLR; -+} -+ -+/* As of yet we only allow setting these options globally, in the future we may -+ allow setting them per function. */ -+static void -+aarch64_validate_sls_mitigation (const char *const_str) -+{ -+ char *token_save = NULL; -+ char *str = NULL; -+ -+ if (strcmp (const_str, "none") == 0) -+ { -+ aarch64_sls_hardening = SLS_NONE; -+ return; -+ } -+ if (strcmp (const_str, "all") == 0) -+ { -+ aarch64_sls_hardening = SLS_ALL; -+ return; -+ } -+ -+ char *str_root = xstrdup (const_str); -+ str = strtok_r (str_root, ",", &token_save); -+ if (!str) -+ error ("invalid argument given to %<-mharden-sls=%>"); -+ -+ int temp = SLS_NONE; -+ while (str) -+ { -+ if (strcmp (str, "blr") == 0) -+ temp |= SLS_BLR; -+ else if (strcmp (str, "retbr") == 0) -+ temp |= SLS_RETBR; -+ else if (strcmp (str, "none") == 0 || strcmp (str, "all") == 0) -+ { -+ error ("%<%s%> must be by itself for %<-mharden-sls=%>", str); -+ break; -+ } -+ else -+ { -+ error ("invalid argument %<%s%> for %<-mharden-sls=%>", str); -+ break; -+ } -+ str = strtok_r (NULL, ",", &token_save); -+ } -+ aarch64_sls_hardening = (aarch64_sls_hardening_type) temp; -+ free (str_root); -+} -+ - /* Parses CONST_STR for branch protection features specified in - aarch64_branch_protect_types, and set any global variables required. Returns - the parsing result and assigns LAST_STR to the last processed token from -@@ -14738,6 +14811,9 @@ aarch64_override_options (void) - selected_arch = NULL; - selected_tune = NULL; - -+ if (aarch64_harden_sls_string) -+ aarch64_validate_sls_mitigation (aarch64_harden_sls_string); -+ - if (aarch64_branch_protection_string) - aarch64_validate_mbranch_protection (aarch64_branch_protection_string); - -diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt -index d99d14c..5170361 100644 ---- a/gcc/config/aarch64/aarch64.opt -+++ b/gcc/config/aarch64/aarch64.opt -@@ -71,6 +71,10 @@ mgeneral-regs-only - Target Report RejectNegative Mask(GENERAL_REGS_ONLY) Save - Generate code which uses only the general registers. - -+mharden-sls= -+Target RejectNegative Joined Var(aarch64_harden_sls_string) -+Generate code to mitigate against straight line speculation. -+ - mfix-cortex-a53-835769 - Target Report Var(aarch64_fix_a53_err835769) Init(2) Save - Workaround for ARM Cortex-A53 Erratum number 835769. -diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi -index a2794a6..bd5b77a 100644 ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -696,6 +696,7 @@ Objective-C and Objective-C++ Dialects}. - -msign-return-address=@var{scope} @gol - -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf} - +@var{b-key}]|@var{bti} @gol -+-mharden-sls=@var{opts} @gol - -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol - -moverride=@var{string} -mverbose-cost-dump @gol - -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol -@@ -17065,6 +17066,17 @@ functions. The optional argument @samp{b-key} can be used to sign the functions - with the B-key instead of the A-key. - @samp{bti} turns on branch target identification mechanism. - -+@item -mharden-sls=@var{opts} -+@opindex mharden-sls -+Enable compiler hardening against straight line speculation (SLS). -+@var{opts} is a comma-separated list of the following options: -+@table @samp -+@item retbr -+@item blr -+@end table -+In addition, @samp{-mharden-sls=all} enables all SLS hardening while -+@samp{-mharden-sls=none} disables all SLS hardening. -+ - @item -msve-vector-bits=@var{bits} - @opindex msve-vector-bits - Specify the number of bits in an SVE vector register. This option only has --- -2.7.4 - diff --git a/recipes-devtools/gcc/gcc-arc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/recipes-devtools/gcc/gcc-arc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch index 82ae9f8..0a108ee 100644 --- a/recipes-devtools/gcc/gcc-arc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch +++ b/recipes-devtools/gcc/gcc-arc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch @@ -1,4 +1,4 @@ -From f2a5dc3bc7e5727d6bf77e1c6e8a31a6f000883d Mon Sep 17 00:00:00 2001 +From 368eaf1846733a9920c7cf5bc547a377e7167785 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 29 Mar 2013 08:37:11 +0400 Subject: [PATCH] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET @@ -12,10 +12,10 @@ Upstream-Status: Inappropriate [embedded specific] 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure -index 4cc938ebb7d..226a64939d1 100755 +index 504f6410274..bcebad264ec 100755 --- a/configure +++ b/configure -@@ -7722,7 +7722,7 @@ fi +@@ -9728,7 +9728,7 @@ fi # for target_alias and gcc doesn't manage it consistently. target_configargs="--cache-file=./config.cache ${target_configargs}" @@ -25,10 +25,10 @@ index 4cc938ebb7d..226a64939d1 100755 *" newlib "*) case " $target_configargs " in diff --git a/configure.ac b/configure.ac -index c78d9cbea62..f024f4bac9b 100644 +index 088e735c5db..1289fe08760 100644 --- a/configure.ac +++ b/configure.ac -@@ -3227,7 +3227,7 @@ fi +@@ -3240,7 +3240,7 @@ fi # for target_alias and gcc doesn't manage it consistently. target_configargs="--cache-file=./config.cache ${target_configargs}" diff --git a/recipes-devtools/gcc/gcc-arc/0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch b/recipes-devtools/gcc/gcc-arc/0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch deleted file mode 100644 index addecb4..0000000 --- a/recipes-devtools/gcc/gcc-arc/0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch +++ /dev/null @@ -1,208 +0,0 @@ -From 2824d2418605e092899117e77bc8ebf332321807 Mon Sep 17 00:00:00 2001 -From: Jakub Jelinek -Date: Fri, 15 Jan 2021 13:12:59 +0100 -Subject: [PATCH] libatomic, libgomp, libitc: Fix bootstrap [PR70454] - -The recent changes to error on mixing -march=i386 and -fcf-protection broke -bootstrap. This patch changes lib{atomic,gomp,itm} configury, so that it -only adds -march=i486 to flags if really needed (i.e. when 486 or later isn't -on by default already). Similarly, it will not use ifuncs if -mcx16 -(or -march=i686 for 32-bit) is on by default. - -2021-01-15 Jakub Jelinek - - PR target/70454 -libatomic/ - * configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to - be added through preprocessor check on - __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4. Determine if try_ifunc is needed - based on preprocessor check on __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 - or __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8. -libgomp/ - * configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to - be added through preprocessor check on - __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4. -libitm/ - * configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to - be added through preprocessor check on - __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4. - -Upstream-Status: Backport [master post 10.x release] ---- - libatomic/configure.tgt | 56 +++++++++++++++++++++++------------------ - libgomp/configure.tgt | 35 +++++++++++--------------- - libitm/configure.tgt | 37 +++++++++++++-------------- - 3 files changed, 64 insertions(+), 64 deletions(-) - -diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt -index 5dd0926d20..6ea082a29b 100644 ---- a/libatomic/configure.tgt -+++ b/libatomic/configure.tgt -@@ -81,32 +81,40 @@ case "${target_cpu}" in - ARCH=sparc - ;; - -- i[3456]86) -- case " ${CC} ${CFLAGS} " in -- *" -m64 "*|*" -mx32 "*) -- ;; -- *) -- if test -z "$with_arch"; then -- XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" -- XCFLAGS="${XCFLAGS} -fomit-frame-pointer" -- fi -- esac -- ARCH=x86 -- # ??? Detect when -march=i686 is already enabled. -- try_ifunc=yes -- ;; -- x86_64) -- case " ${CC} ${CFLAGS} " in -- *" -m32 "*) -+ i[3456]86 | x86_64) -+ cat > conftestx.c < /dev/null 2>&1; then -+ : -+ else -+ if test "${target_cpu}" = x86_64; then - XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic" -- XCFLAGS="${XCFLAGS} -fomit-frame-pointer" -- ;; -- *) -- ;; -- esac -+ else -+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" -+ fi -+ XCFLAGS="${XCFLAGS} -fomit-frame-pointer" -+ fi -+ cat > conftestx.c < /dev/null 2>&1; then -+ try_ifunc=no -+ else -+ try_ifunc=yes -+ fi -+ rm -f conftestx.c - ARCH=x86 -- # ??? Detect when -mcx16 is already enabled. -- try_ifunc=yes - ;; - - *) ARCH="${target_cpu}" ;; -diff --git a/libgomp/configure.tgt b/libgomp/configure.tgt -index 4790a31e39..761ef2a7db 100644 ---- a/libgomp/configure.tgt -+++ b/libgomp/configure.tgt -@@ -70,28 +70,23 @@ if test x$enable_linux_futex = xyes; then - ;; - - # Note that bare i386 is not included here. We need cmpxchg. -- i[456]86-*-linux*) -+ i[456]86-*-linux* | x86_64-*-linux*) - config_path="linux/x86 linux posix" -- case " ${CC} ${CFLAGS} " in -- *" -m64 "*|*" -mx32 "*) -- ;; -- *) -- if test -z "$with_arch"; then -- XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" -- fi -- esac -- ;; -- -- # Similar jiggery-pokery for x86_64 multilibs, except here we -- # can't rely on the --with-arch configure option, since that -- # applies to the 64-bit side. -- x86_64-*-linux*) -- config_path="linux/x86 linux posix" -- case " ${CC} ${CFLAGS} " in -- *" -m32 "*) -+ cat > conftestx.c < /dev/null 2>&1; then -+ : -+ else -+ if test "${target_cpu}" = x86_64; then - XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic" -- ;; -- esac -+ else -+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" -+ fi -+ fi -+ rm -f conftestx.c - ;; - - # Note that sparcv7 and sparcv8 is not included here. We need cas. -diff --git a/libitm/configure.tgt b/libitm/configure.tgt -index 04109160e9..ca62bac627 100644 ---- a/libitm/configure.tgt -+++ b/libitm/configure.tgt -@@ -58,16 +58,23 @@ case "${target_cpu}" in - - arm*) ARCH=arm ;; - -- i[3456]86) -- case " ${CC} ${CFLAGS} " in -- *" -m64 "*|*" -mx32 "*) -- ;; -- *) -- if test -z "$with_arch"; then -- XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" -- XCFLAGS="${XCFLAGS} -fomit-frame-pointer" -- fi -- esac -+ i[3456]86 | x86_64) -+ cat > conftestx.c < /dev/null 2>&1; then -+ : -+ else -+ if test "${target_cpu}" = x86_64; then -+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic" -+ else -+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" -+ fi -+ XCFLAGS="${XCFLAGS} -fomit-frame-pointer" -+ fi -+ rm -f conftestx.c - XCFLAGS="${XCFLAGS} -mrtm" - ARCH=x86 - ;; -@@ -102,16 +109,6 @@ case "${target_cpu}" in - ARCH=sparc - ;; - -- x86_64) -- case " ${CC} ${CFLAGS} " in -- *" -m32 "*) -- XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic" -- XCFLAGS="${XCFLAGS} -fomit-frame-pointer" -- ;; -- esac -- XCFLAGS="${XCFLAGS} -mrtm" -- ARCH=x86 -- ;; - s390|s390x) - XCFLAGS="${XCFLAGS} -mzarch -mhtm" - ARCH=s390 diff --git a/recipes-devtools/gcc/gcc-arc/0002-CVE-2021-35465.patch b/recipes-devtools/gcc/gcc-arc/0002-CVE-2021-35465.patch new file mode 100644 index 0000000..e09818f --- /dev/null +++ b/recipes-devtools/gcc/gcc-arc/0002-CVE-2021-35465.patch @@ -0,0 +1,39 @@ +From 574e7950bd6b34e9e2cacce18c802b45505d1d0a Mon Sep 17 00:00:00 2001 +From: Richard Earnshaw +Date: Fri, 18 Jun 2021 17:16:25 +0100 +Subject: [PATCH] arm: add erratum mitigation to __gnu_cmse_nonsecure_call + [PR102035] + +Add the recommended erratum mitigation sequence to +__gnu_cmse_nonsecure_call for use on Armv8-m.main devices. Since this +is in the library code we cannot know in advance whether the core we +are running on will be affected by this, so always enable it. + +libgcc: + PR target/102035 + * config/arm/cmse_nonsecure_call.S (__gnu_cmse_nonsecure_call): + Add vlldm erratum work-around. + +CVE: CVE-2021-35465 +Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=574e7950bd6b34e9e2cacce18c802b45505d1d0a] +Signed-off-by: Pgowda + +--- + libgcc/config/arm/cmse_nonsecure_call.S | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/libgcc/config/arm/cmse_nonsecure_call.S b/libgcc/config/arm/cmse_nonsecure_call.S +--- a/libgcc/config/arm/cmse_nonsecure_call.S ++++ b/libgcc/config/arm/cmse_nonsecure_call.S +@@ -102,6 +102,11 @@ blxns r4 + #ifdef __ARM_PCS_VFP + vpop.f64 {d8-d15} + #else ++/* VLLDM erratum mitigation sequence. */ ++mrs r5, control ++tst r5, #8 /* CONTROL_S.SFPA */ ++it ne ++.inst.w 0xeeb00a40 /* vmovne s0, s0 */ + vlldm sp /* Lazy restore of d0-d16 and FPSCR. */ + add sp, sp, #0x88 /* Free space used to save floating point registers. */ + #endif /* __ARM_PCS_VFP */ diff --git a/recipes-devtools/gcc/gcc-arc/0002-CVE-2021-42574.patch b/recipes-devtools/gcc/gcc-arc/0002-CVE-2021-42574.patch new file mode 100644 index 0000000..9bad81d --- /dev/null +++ b/recipes-devtools/gcc/gcc-arc/0002-CVE-2021-42574.patch @@ -0,0 +1,1765 @@ +From 51c500269bf53749b107807d84271385fad35628 Mon Sep 17 00:00:00 2001 +From: Marek Polacek +Date: Wed, 6 Oct 2021 14:33:59 -0400 +Subject: [PATCH] libcpp: Implement -Wbidi-chars for CVE-2021-42574 [PR103026] + +From a link below: +"An issue was discovered in the Bidirectional Algorithm in the Unicode +Specification through 14.0. It permits the visual reordering of +characters via control sequences, which can be used to craft source code +that renders different logic than the logical ordering of tokens +ingested by compilers and interpreters. Adversaries can leverage this to +encode source code for compilers accepting Unicode such that targeted +vulnerabilities are introduced invisibly to human reviewers." + +More info: +https://nvd.nist.gov/vuln/detail/CVE-2021-42574 +https://trojansource.codes/ + +This is not a compiler bug. However, to mitigate the problem, this patch +implements -Wbidi-chars=[none|unpaired|any] to warn about possibly +misleading Unicode bidirectional control characters the preprocessor may +encounter. + +The default is =unpaired, which warns about improperly terminated +bidirectional control characters; e.g. a LRE without its corresponding PDF. +The level =any warns about any use of bidirectional control characters. + +This patch handles both UCNs and UTF-8 characters. UCNs designating +bidi characters in identifiers are accepted since r204886. Then r217144 +enabled -fextended-identifiers by default. Extended characters in C/C++ +identifiers have been accepted since r275979. However, this patch still +warns about mixing UTF-8 and UCN bidi characters; there seems to be no +good reason to allow mixing them. + +We warn in different contexts: comments (both C and C++-style), string +literals, character constants, and identifiers. Expectedly, UCNs are ignored +in comments and raw string literals. The bidirectional control characters +can nest so this patch handles that as well. + +I have not included nor tested this at all with Fortran (which also has +string literals and line comments). + +Dave M. posted patches improving diagnostic involving Unicode characters. +This patch does not make use of this new infrastructure yet. + + PR preprocessor/103026 + +gcc/c-family/ChangeLog: + + * c.opt (Wbidi-chars, Wbidi-chars=): New option. + +gcc/ChangeLog: + + * doc/invoke.texi: Document -Wbidi-chars. + +libcpp/ChangeLog: + + * include/cpplib.h (enum cpp_bidirectional_level): New. + (struct cpp_options): Add cpp_warn_bidirectional. + (enum cpp_warning_reason): Add CPP_W_BIDIRECTIONAL. + * internal.h (struct cpp_reader): Add warn_bidi_p member + function. + * init.c (cpp_create_reader): Set cpp_warn_bidirectional. + * lex.c (bidi): New namespace. + (get_bidi_utf8): New function. + (get_bidi_ucn): Likewise. + (maybe_warn_bidi_on_close): Likewise. + (maybe_warn_bidi_on_char): Likewise. + (_cpp_skip_block_comment): Implement warning about bidirectional + control characters. + (skip_line_comment): Likewise. + (forms_identifier_p): Likewise. + (lex_identifier): Likewise. + (lex_string): Likewise. + (lex_raw_string): Likewise. + +gcc/testsuite/ChangeLog: + + * c-c++-common/Wbidi-chars-1.c: New test. + * c-c++-common/Wbidi-chars-2.c: New test. + * c-c++-common/Wbidi-chars-3.c: New test. + * c-c++-common/Wbidi-chars-4.c: New test. + * c-c++-common/Wbidi-chars-5.c: New test. + * c-c++-common/Wbidi-chars-6.c: New test. + * c-c++-common/Wbidi-chars-7.c: New test. + * c-c++-common/Wbidi-chars-8.c: New test. + * c-c++-common/Wbidi-chars-9.c: New test. + * c-c++-common/Wbidi-chars-10.c: New test. + * c-c++-common/Wbidi-chars-11.c: New test. + * c-c++-common/Wbidi-chars-12.c: New test. + * c-c++-common/Wbidi-chars-13.c: New test. + * c-c++-common/Wbidi-chars-14.c: New test. + * c-c++-common/Wbidi-chars-15.c: New test. + * c-c++-common/Wbidi-chars-16.c: New test. + * c-c++-common/Wbidi-chars-17.c: New test. + +CVE: CVE-2021-42574 +Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=51c500269bf53749b107807d84271385fad35628] +Signed-off-by: Pgowda + +--- + gcc/c-family/c.opt | 24 ++ + gcc/doc/invoke.texi | 21 +- + gcc/testsuite/c-c++-common/Wbidi-chars-1.c | 12 + + gcc/testsuite/c-c++-common/Wbidi-chars-10.c | 27 ++ + gcc/testsuite/c-c++-common/Wbidi-chars-11.c | 13 + + gcc/testsuite/c-c++-common/Wbidi-chars-12.c | 19 + + gcc/testsuite/c-c++-common/Wbidi-chars-13.c | 17 + + gcc/testsuite/c-c++-common/Wbidi-chars-14.c | 38 ++ + gcc/testsuite/c-c++-common/Wbidi-chars-15.c | 59 +++ + gcc/testsuite/c-c++-common/Wbidi-chars-16.c | 26 ++ + gcc/testsuite/c-c++-common/Wbidi-chars-17.c | 30 ++ + gcc/testsuite/c-c++-common/Wbidi-chars-2.c | 9 + + gcc/testsuite/c-c++-common/Wbidi-chars-3.c | 11 + + gcc/testsuite/c-c++-common/Wbidi-chars-4.c | 188 +++++++++ + gcc/testsuite/c-c++-common/Wbidi-chars-5.c | 188 +++++++++ + gcc/testsuite/c-c++-common/Wbidi-chars-6.c | 155 ++++++++ + gcc/testsuite/c-c++-common/Wbidi-chars-7.c | 9 + + gcc/testsuite/c-c++-common/Wbidi-chars-8.c | 13 + + gcc/testsuite/c-c++-common/Wbidi-chars-9.c | 29 ++ + libcpp/include/cpplib.h | 18 +- + libcpp/init.c | 1 + + libcpp/internal.h | 7 + + libcpp/lex.c | 408 +++++++++++++++++++- + 23 files changed, 1315 insertions(+), 7 deletions(-) + create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-1.c + create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-10.c + create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-11.c + create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-12.c + create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-13.c + create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-14.c + create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-15.c + create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-16.c + create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-17.c + create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-2.c + create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-3.c + create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-4.c + create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-5.c + create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-6.c + create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-7.c + create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-8.c + create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-9.c + +diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt +index 8a4cd634f77..3976fc368db 100644 +--- a/gcc/c-family/c.opt ++++ b/gcc/c-family/c.opt +@@ -370,6 +370,30 @@ Wbad-function-cast + C ObjC Var(warn_bad_function_cast) Warning + Warn about casting functions to incompatible types. + ++Wbidi-chars ++C ObjC C++ ObjC++ Warning Alias(Wbidi-chars=,any,none) ++; ++ ++Wbidi-chars= ++C ObjC C++ ObjC++ RejectNegative Joined Warning CPP(cpp_warn_bidirectional) CppReason(CPP_W_BIDIRECTIONAL) Var(warn_bidirectional) Init(bidirectional_unpaired) Enum(cpp_bidirectional_level) ++-Wbidi-chars=[none|unpaired|any] Warn about UTF-8 bidirectional control characters. ++ ++; Required for these enum values. ++SourceInclude ++cpplib.h ++ ++Enum ++Name(cpp_bidirectional_level) Type(int) UnknownError(argument %qs to %<-Wbidi-chars%> not recognized) ++ ++EnumValue ++Enum(cpp_bidirectional_level) String(none) Value(bidirectional_none) ++ ++EnumValue ++Enum(cpp_bidirectional_level) String(unpaired) Value(bidirectional_unpaired) ++ ++EnumValue ++Enum(cpp_bidirectional_level) String(any) Value(bidirectional_any) ++ + Wbool-compare + C ObjC C++ ObjC++ Var(warn_bool_compare) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) + Warn about boolean expression compared with an integer value different from true/false. +diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi +index 6070288856c..a22758d18ee 100644 +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -326,7 +326,9 @@ Objective-C and Objective-C++ Dialects}. + -Warith-conversion @gol + -Warray-bounds -Warray-bounds=@var{n} @gol + -Wno-attributes -Wattribute-alias=@var{n} -Wno-attribute-alias @gol +--Wno-attribute-warning -Wbool-compare -Wbool-operation @gol ++-Wno-attribute-warning @gol ++-Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{]} @gol ++-Wbool-compare -Wbool-operation @gol + -Wno-builtin-declaration-mismatch @gol + -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol + -Wc11-c2x-compat @gol +@@ -7559,6 +7561,23 @@ Attributes considered include @code{allo + This is the default. You can disable these warnings with either + @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}. + ++@item -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{]} ++@opindex Wbidi-chars= ++@opindex Wbidi-chars ++@opindex Wno-bidi-chars ++Warn about possibly misleading UTF-8 bidirectional control characters in ++comments, string literals, character constants, and identifiers. Such ++characters can change left-to-right writing direction into right-to-left ++(and vice versa), which can cause confusion between the logical order and ++visual order. This may be dangerous; for instance, it may seem that a piece ++of code is not commented out, whereas it in fact is. ++ ++There are three levels of warning supported by GCC@. The default is ++@option{-Wbidi-chars=unpaired}, which warns about improperly terminated ++bidi contexts. @option{-Wbidi-chars=none} turns the warning off. ++@option{-Wbidi-chars=any} warns about any use of bidirectional control ++characters. ++ + @item -Wbool-compare + @opindex Wno-bool-compare + @opindex Wbool-compare +diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-10.c b/gcc/testsuite/c-c++-common/Wbidi-chars-10.c +new file mode 100644 +index 00000000000..34f5ac19271 +--- /dev/null ++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-10.c +@@ -0,0 +1,27 @@ ++/* PR preprocessor/103026 */ ++/* { dg-do compile } */ ++/* { dg-options "-Wbidi-chars=unpaired" } */ ++/* More nesting testing. */ ++ ++/* RLEâ« LRI⦠PDF⬠PDIâ©*/ ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int LRE_\u202a_PDF_\u202c; ++int LRE_\u202a_PDF_\u202c_LRE_\u202a_PDF_\u202c; ++int LRE_\u202a_LRI_\u2066_PDF_\u202c_PDI_\u2069; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int RLE_\u202b_RLI_\u2067_PDF_\u202c_PDI_\u2069; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int RLE_\u202b_RLI_\u2067_PDI_\u2069_PDF_\u202c; ++int FSI_\u2068_LRO_\u202d_PDI_\u2069_PDF_\u202c; ++int FSI_\u2068; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int FSI_\u2068_PDI_\u2069; ++int FSI_\u2068_FSI_\u2068_PDI_\u2069; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069; ++int RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDF_\u202c; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_FSI_\u2068_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ +diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-11.c b/gcc/testsuite/c-c++-common/Wbidi-chars-11.c +new file mode 100644 +index 00000000000..270ce2368a9 +--- /dev/null ++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-11.c +@@ -0,0 +1,13 @@ ++/* PR preprocessor/103026 */ ++/* { dg-do compile } */ ++/* { dg-options "-Wbidi-chars=unpaired" } */ ++/* Test that we warn when mixing UCN and UTF-8. */ ++ ++int LRE_âª_PDF_\u202c; ++/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */ ++int LRE_\u202a_PDF_â¬_; ++/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */ ++const char *s1 = "LRE_âª_PDF_\u202c"; ++/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */ ++const char *s2 = "LRE_\u202a_PDF_â¬"; ++/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */ +diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-12.c b/gcc/testsuite/c-c++-common/Wbidi-chars-12.c +new file mode 100644 +index 00000000000..b07eec1da91 +--- /dev/null ++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-12.c +@@ -0,0 +1,19 @@ ++/* PR preprocessor/103026 */ ++/* { dg-do compile { target { c || c++11 } } } */ ++/* { dg-options "-Wbidi-chars=any" } */ ++/* Test raw strings. */ ++ ++const char *s1 = R"(a b c LRE⪠1 2 3 PDF⬠x y z)"; ++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */ ++const char *s2 = R"(a b c RLEâ« 1 2 3 PDF⬠x y z)"; ++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */ ++const char *s3 = R"(a b c LROâ­ 1 2 3 PDF⬠x y z)"; ++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */ ++const char *s4 = R"(a b c RLOâ® 1 2 3 PDF⬠x y z)"; ++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */ ++const char *s7 = R"(a b c FSI⨠1 2 3 PDIâ© x y) z"; ++/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */ ++const char *s8 = R"(a b c PDIâ© x y )z"; ++/* { dg-warning "U\\+2069" "" { target *-*-* } .-1 } */ ++const char *s9 = R"(a b c PDF⬠x y z)"; ++/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */ +diff -uprN '-x*.orig' '-x*.rej' del/gcc-11.2.0/gcc/testsuite/c-c++-common/Wbidi-chars-13.c gcc-11.2.0/gcc/testsuite/c-c++-common/Wbidi-chars-13.c +--- del/gcc-11.2.0/gcc/testsuite/c-c++-common/Wbidi-chars-13.c 1969-12-31 16:00:00.000000000 -0800 ++++ gcc-11.2.0/gcc/testsuite/c-c++-common/Wbidi-chars-13.c 2021-12-13 23:11:22.328439287 -0800 +@@ -0,0 +1,17 @@ ++/* PR preprocessor/103026 */ ++/* { dg-do compile { target { c || c++11 } } } */ ++/* { dg-options "-Wbidi-chars=unpaired" } */ ++/* Test raw strings. */ ++ ++const char *s1 = R"(a b c LRE⪠1 2 3)"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++const char *s2 = R"(a b c RLEâ« 1 2 3)"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++const char *s3 = R"(a b c LROâ­ 1 2 3)"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++const char *s4 = R"(a b c FSI⨠1 2 3)"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++const char *s5 = R"(a b c LRI⦠1 2 3)"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++const char *s6 = R"(a b c RLI⧠1 2 3)"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ +diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-14.c b/gcc/testsuite/c-c++-common/Wbidi-chars-14.c +new file mode 100644 +index 00000000000..ba5f75d9553 +--- /dev/null ++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-14.c +@@ -0,0 +1,38 @@ ++/* PR preprocessor/103026 */ ++/* { dg-do compile } */ ++/* { dg-options "-Wbidi-chars=unpaired" } */ ++/* Test PDI handling, which also pops any subsequent LREs, RLEs, LROs, ++ or RLOs. */ ++ ++/* LRI_â¦_LRI_â¦_RLE_â«_RLE_â«_RLE_â«_PDI_â©*/ ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++// LRI_â¦_RLE_â«_RLE_â«_RLE_â«_PDI_â© ++// LRI_â¦_RLO_â®_RLE_â«_RLE_â«_PDI_â© ++// LRI_â¦_RLO_â®_RLE_â«_PDI_â© ++// FSI_â¨_RLO_â®_PDI_â© ++// FSI_â¨_FSI_â¨_RLO_â®_PDI_â© ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ ++int LRI_\u2066_LRI_\u2066_LRE_\u202a_LRE_\u202a_LRE_\u202a_PDI_\u2069; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int LRI_\u2066_LRI_\u2066_LRE_\u202a_LRE_\u202a_LRE_\u202a_PDI_\u2069_PDI_\u2069; ++int LRI_\u2066_LRI_\u2066_LRI_\u2066_LRE_\u202a_LRE_\u202a_LRE_\u202a_PDI_\u2069_PDI_\u2069; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int PDI_\u2069; ++int LRI_\u2066_PDI_\u2069; ++int RLI_\u2067_PDI_\u2069; ++int LRE_\u202a_LRI_\u2066_PDI_\u2069; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int LRI_\u2066_LRE_\u202a_PDF_\u202c_PDI_\u2069; ++int LRI_\u2066_LRE_\u202a_LRE_\u202a_PDF_\u202c_PDI_\u2069; ++int RLI_\u2067_LRI_\u2066_LRE_\u202a_LRE_\u202a_PDF_\u202c_PDI_\u2069; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int FSI_\u2068_LRI_\u2066_LRE_\u202a_LRE_\u202a_PDF_\u202c_PDI_\u2069; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int RLO_\u202e_PDI_\u2069; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int RLI_\u2067_PDI_\u2069_RLI_\u2067; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int FSI_\u2068_PDF_\u202c_PDI_\u2069; ++int FSI_\u2068_FSI_\u2068_PDF_\u202c_PDI_\u2069; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ +diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-15.c b/gcc/testsuite/c-c++-common/Wbidi-chars-15.c +new file mode 100644 +index 00000000000..a0ce8ff5e2c +--- /dev/null ++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-15.c +@@ -0,0 +1,59 @@ ++/* PR preprocessor/103026 */ ++/* { dg-do compile } */ ++/* { dg-options "-Wbidi-chars=unpaired" } */ ++/* Test unpaired bidi control chars in multiline comments. */ ++ ++/* ++ * LRE⪠end ++ */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */ ++/* ++ * RLEâ« end ++ */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */ ++/* ++ * LROâ­ end ++ */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */ ++/* ++ * RLOâ® end ++ */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */ ++/* ++ * LRI⦠end ++ */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */ ++/* ++ * RLI⧠end ++ */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */ ++/* ++ * FSI⨠end ++ */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */ ++/* LRE⪠++ PDF⬠*/ ++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */ ++/* FSI⨠++ PDIâ© */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */ ++ ++/* LRE<âª> ++ * ++ */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-3 } */ ++ ++/* ++ * LRE<âª> ++ */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */ ++ ++/* ++ * ++ * LRE<âª> */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ ++/* RLI<â§> */ /* PDI<â©> */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++/* LRE<âª> */ /* PDF<â¬> */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ +diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-16.c b/gcc/testsuite/c-c++-common/Wbidi-chars-16.c +new file mode 100644 +index 00000000000..baa0159861c +--- /dev/null ++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-16.c +@@ -0,0 +1,26 @@ ++/* PR preprocessor/103026 */ ++/* { dg-do compile } */ ++/* { dg-options "-Wbidi-chars=any" } */ ++/* Test LTR/RTL chars. */ ++ ++/* LTR<â> */ ++/* { dg-warning "U\\+200E" "" { target *-*-* } .-1 } */ ++// LTR<â> ++/* { dg-warning "U\\+200E" "" { target *-*-* } .-1 } */ ++/* RTL<â> */ ++/* { dg-warning "U\\+200F" "" { target *-*-* } .-1 } */ ++// RTL<â> ++/* { dg-warning "U\\+200F" "" { target *-*-* } .-1 } */ ++ ++const char *s1 = "LTR<â>"; ++/* { dg-warning "U\\+200E" "" { target *-*-* } .-1 } */ ++const char *s2 = "LTR\u200e"; ++/* { dg-warning "U\\+200E" "" { target *-*-* } .-1 } */ ++const char *s3 = "LTR\u200E"; ++/* { dg-warning "U\\+200E" "" { target *-*-* } .-1 } */ ++const char *s4 = "RTL<â>"; ++/* { dg-warning "U\\+200F" "" { target *-*-* } .-1 } */ ++const char *s5 = "RTL\u200f"; ++/* { dg-warning "U\\+200F" "" { target *-*-* } .-1 } */ ++const char *s6 = "RTL\u200F"; ++/* { dg-warning "U\\+200F" "" { target *-*-* } .-1 } */ +diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-17.c b/gcc/testsuite/c-c++-common/Wbidi-chars-17.c +new file mode 100644 +index 00000000000..07cb4321f96 +--- /dev/null ++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-17.c +@@ -0,0 +1,30 @@ ++/* PR preprocessor/103026 */ ++/* { dg-do compile } */ ++/* { dg-options "-Wbidi-chars=unpaired" } */ ++/* Test LTR/RTL chars. */ ++ ++/* LTR<â> */ ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++// LTR<â> ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++/* RTL<â> */ ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++// RTL<â> ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int ltr_\u200e; ++/* { dg-error "universal character " "" { target *-*-* } .-1 } */ ++int rtl_\u200f; ++/* { dg-error "universal character " "" { target *-*-* } .-1 } */ ++ ++const char *s1 = "LTR<â>"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++const char *s2 = "LTR\u200e"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++const char *s3 = "LTR\u200E"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++const char *s4 = "RTL<â>"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++const char *s5 = "RTL\u200f"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++const char *s6 = "RTL\u200F"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ +diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-1.c b/gcc/testsuite/c-c++-common/Wbidi-chars-1.c +new file mode 100644 +index 00000000000..2340374f276 +--- /dev/null ++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-1.c +@@ -0,0 +1,12 @@ ++/* PR preprocessor/103026 */ ++/* { dg-do compile } */ ++ ++int main() { ++ int isAdmin = 0; ++ /*â® } â¦if (isAdmin)⩠⦠begin admins only */ ++/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */ ++ __builtin_printf("You are an admin.\n"); ++ /* end admins only â® { â¦*/ ++/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */ ++ return 0; ++} +diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-2.c b/gcc/testsuite/c-c++-common/Wbidi-chars-2.c +new file mode 100644 +index 00000000000..2340374f276 +--- /dev/null ++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-2.c +@@ -0,0 +1,9 @@ ++/* PR preprocessor/103026 */ ++/* { dg-do compile } */ ++ ++int main() { ++ /* Say hello; newlineâ§/*/ return 0 ; ++/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */ ++ __builtin_printf("Hello world.\n"); ++ return 0; ++} +diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-3.c b/gcc/testsuite/c-c++-common/Wbidi-chars-3.c +new file mode 100644 +index 00000000000..9dc7edb6e64 +--- /dev/null ++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-3.c +@@ -0,0 +1,11 @@ ++/* PR preprocessor/103026 */ ++/* { dg-do compile } */ ++ ++int main() { ++ const char* access_level = "user"; ++ if (__builtin_strcmp(access_level, "userâ® â¦// Check if adminâ© â¦")) { ++/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */ ++ __builtin_printf("You are an admin.\n"); ++ } ++ return 0; ++} +diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-4.c b/gcc/testsuite/c-c++-common/Wbidi-chars-4.c +new file mode 100644 +index 00000000000..639e5c62e88 +--- /dev/null ++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-4.c +@@ -0,0 +1,188 @@ ++/* PR preprocessor/103026 */ ++/* { dg-do compile } */ ++/* { dg-options "-Wbidi-chars=any -Wno-multichar -Wno-overflow" } */ ++/* Test all bidi chars in various contexts (identifiers, comments, ++ string literals, character constants), both UCN and UTF-8. The bidi ++ chars here are properly terminated, except for the character constants. */ ++ ++/* a b c LRE⪠1 2 3 PDF⬠x y z */ ++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */ ++/* a b c RLEâ« 1 2 3 PDF⬠x y z */ ++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */ ++/* a b c LROâ­ 1 2 3 PDF⬠x y z */ ++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */ ++/* a b c RLOâ® 1 2 3 PDF⬠x y z */ ++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */ ++/* a b c LRI⦠1 2 3 PDIâ© x y z */ ++/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */ ++/* a b c RLI⧠1 2 3 PDIâ© x y */ ++/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */ ++/* a b c FSI⨠1 2 3 PDIâ© x y z */ ++/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */ ++ ++/* Same but C++ comments instead. */ ++// a b c LRE⪠1 2 3 PDF⬠x y z ++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */ ++// a b c RLEâ« 1 2 3 PDF⬠x y z ++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */ ++// a b c LROâ­ 1 2 3 PDF⬠x y z ++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */ ++// a b c RLOâ® 1 2 3 PDF⬠x y z ++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */ ++// a b c LRI⦠1 2 3 PDIâ© x y z ++/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */ ++// a b c RLI⧠1 2 3 PDIâ© x y ++/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */ ++// a b c FSI⨠1 2 3 PDIâ© x y z ++/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */ ++ ++/* Here we're closing an unopened context, warn when =any. */ ++/* a b c PDIâ© x y z */ ++/* { dg-warning "U\\+2069" "" { target *-*-* } .-1 } */ ++/* a b c PDF⬠x y z */ ++/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */ ++// a b c PDIâ© x y z ++/* { dg-warning "U\\+2069" "" { target *-*-* } .-1 } */ ++// a b c PDF⬠x y z ++/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */ ++ ++/* Multiline comments. */ ++/* a b c PDIâ© x y z ++ */ ++/* { dg-warning "U\\+2069" "" { target *-*-* } .-2 } */ ++/* a b c PDF⬠x y z ++ */ ++/* { dg-warning "U\\+202C" "" { target *-*-* } .-2 } */ ++/* first ++ a b c PDIâ© x y z ++ */ ++/* { dg-warning "U\\+2069" "" { target *-*-* } .-2 } */ ++/* first ++ a b c PDF⬠x y z ++ */ ++/* { dg-warning "U\\+202C" "" { target *-*-* } .-2 } */ ++/* first ++ a b c PDIâ© x y z */ ++/* { dg-warning "U\\+2069" "" { target *-*-* } .-1 } */ ++/* first ++ a b c PDF⬠x y z */ ++/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */ ++ ++void ++g1 () ++{ ++ const char *s1 = "a b c LRE⪠1 2 3 PDF⬠x y z"; ++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */ ++ const char *s2 = "a b c RLEâ« 1 2 3 PDF⬠x y z"; ++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */ ++ const char *s3 = "a b c LROâ­ 1 2 3 PDF⬠x y z"; ++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */ ++ const char *s4 = "a b c RLOâ® 1 2 3 PDF⬠x y z"; ++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */ ++ const char *s5 = "a b c LRI⦠1 2 3 PDIâ© x y z"; ++/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */ ++ const char *s6 = "a b c RLI⧠1 2 3 PDIâ© x y z"; ++/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */ ++ const char *s7 = "a b c FSI⨠1 2 3 PDIâ© x y z"; ++/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */ ++ const char *s8 = "a b c PDIâ© x y z"; ++/* { dg-warning "U\\+2069" "" { target *-*-* } .-1 } */ ++ const char *s9 = "a b c PDF⬠x y z"; ++/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */ ++ ++ const char *s10 = "a b c LRE\u202a 1 2 3 PDF\u202c x y z"; ++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */ ++ const char *s11 = "a b c LRE\u202A 1 2 3 PDF\u202c x y z"; ++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */ ++ const char *s12 = "a b c RLE\u202b 1 2 3 PDF\u202c x y z"; ++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */ ++ const char *s13 = "a b c RLE\u202B 1 2 3 PDF\u202c x y z"; ++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */ ++ const char *s14 = "a b c LRO\u202d 1 2 3 PDF\u202c x y z"; ++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */ ++ const char *s15 = "a b c LRO\u202D 1 2 3 PDF\u202c x y z"; ++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */ ++ const char *s16 = "a b c RLO\u202e 1 2 3 PDF\u202c x y z"; ++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */ ++ const char *s17 = "a b c RLO\u202E 1 2 3 PDF\u202c x y z"; ++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */ ++ const char *s18 = "a b c LRI\u2066 1 2 3 PDI\u2069 x y z"; ++/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */ ++ const char *s19 = "a b c RLI\u2067 1 2 3 PDI\u2069 x y z"; ++/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */ ++ const char *s20 = "a b c FSI\u2068 1 2 3 PDI\u2069 x y z"; ++/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */ ++} ++ ++void ++g2 () ++{ ++ const char c1 = '\u202a'; ++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */ ++ const char c2 = '\u202A'; ++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */ ++ const char c3 = '\u202b'; ++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */ ++ const char c4 = '\u202B'; ++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */ ++ const char c5 = '\u202d'; ++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */ ++ const char c6 = '\u202D'; ++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */ ++ const char c7 = '\u202e'; ++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */ ++ const char c8 = '\u202E'; ++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */ ++ const char c9 = '\u2066'; ++/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */ ++ const char c10 = '\u2067'; ++/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */ ++ const char c11 = '\u2068'; ++/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */ ++} ++ ++int aâªbâ¬c; ++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */ ++int aâ«bâ¬c; ++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */ ++int aâ­bâ¬c; ++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */ ++int aâ®bâ¬c; ++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */ ++int aâ¦bâ©c; ++/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */ ++int aâ§bâ©c; ++/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */ ++int aâ¨bâ©c; ++/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */ ++int Aâ¬X; ++/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */ ++int A\u202cY; ++/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */ ++int A\u202CY2; ++/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */ ++ ++int d\u202ae\u202cf; ++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */ ++int d\u202Ae\u202cf2; ++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */ ++int d\u202be\u202cf; ++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */ ++int d\u202Be\u202cf2; ++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */ ++int d\u202de\u202cf; ++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */ ++int d\u202De\u202cf2; ++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */ ++int d\u202ee\u202cf; ++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */ ++int d\u202Ee\u202cf2; ++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */ ++int d\u2066e\u2069f; ++/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */ ++int d\u2067e\u2069f; ++/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */ ++int d\u2068e\u2069f; ++/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */ ++int X\u2069; ++/* { dg-warning "U\\+2069" "" { target *-*-* } .-1 } */ +diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-5.c b/gcc/testsuite/c-c++-common/Wbidi-chars-5.c +new file mode 100644 +index 00000000000..68cb053144b +--- /dev/null ++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-5.c +@@ -0,0 +1,188 @@ ++/* PR preprocessor/103026 */ ++/* { dg-do compile } */ ++/* { dg-options "-Wbidi-chars=unpaired -Wno-multichar -Wno-overflow" } */ ++/* Test all bidi chars in various contexts (identifiers, comments, ++ string literals, character constants), both UCN and UTF-8. The bidi ++ chars here are properly terminated, except for the character constants. */ ++ ++/* a b c LRE⪠1 2 3 PDF⬠x y z */ ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++/* a b c RLEâ« 1 2 3 PDF⬠x y z */ ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++/* a b c LROâ­ 1 2 3 PDF⬠x y z */ ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++/* a b c RLOâ® 1 2 3 PDF⬠x y z */ ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++/* a b c LRI⦠1 2 3 PDIâ© x y z */ ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++/* a b c RLI⧠1 2 3 PDIâ© x y */ ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++/* a b c FSI⨠1 2 3 PDIâ© x y z */ ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ ++/* Same but C++ comments instead. */ ++// a b c LRE⪠1 2 3 PDF⬠x y z ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++// a b c RLEâ« 1 2 3 PDF⬠x y z ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++// a b c LROâ­ 1 2 3 PDF⬠x y z ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++// a b c RLOâ® 1 2 3 PDF⬠x y z ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++// a b c LRI⦠1 2 3 PDIâ© x y z ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++// a b c RLI⧠1 2 3 PDIâ© x y ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++// a b c FSI⨠1 2 3 PDIâ© x y z ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ ++/* Here we're closing an unopened context, warn when =any. */ ++/* a b c PDIâ© x y z */ ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++/* a b c PDF⬠x y z */ ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++// a b c PDIâ© x y z ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++// a b c PDF⬠x y z ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ ++/* Multiline comments. */ ++/* a b c PDIâ© x y z ++ */ ++/* { dg-bogus "unpaired" "" { target *-*-* } .-2 } */ ++/* a b c PDF⬠x y z ++ */ ++/* { dg-bogus "unpaired" "" { target *-*-* } .-2 } */ ++/* first ++ a b c PDIâ© x y z ++ */ ++/* { dg-bogus "unpaired" "" { target *-*-* } .-2 } */ ++/* first ++ a b c PDF⬠x y z ++ */ ++/* { dg-bogus "unpaired" "" { target *-*-* } .-2 } */ ++/* first ++ a b c PDIâ© x y z */ ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++/* first ++ a b c PDF⬠x y z */ ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ ++void ++g1 () ++{ ++ const char *s1 = "a b c LRE⪠1 2 3 PDF⬠x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s2 = "a b c RLEâ« 1 2 3 PDF⬠x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s3 = "a b c LROâ­ 1 2 3 PDF⬠x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s4 = "a b c RLOâ® 1 2 3 PDF⬠x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s5 = "a b c LRI⦠1 2 3 PDIâ© x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s6 = "a b c RLI⧠1 2 3 PDIâ© x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s7 = "a b c FSI⨠1 2 3 PDIâ© x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s8 = "a b c PDIâ© x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s9 = "a b c PDF⬠x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ ++ const char *s10 = "a b c LRE\u202a 1 2 3 PDF\u202c x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s11 = "a b c LRE\u202A 1 2 3 PDF\u202c x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s12 = "a b c RLE\u202b 1 2 3 PDF\u202c x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s13 = "a b c RLE\u202B 1 2 3 PDF\u202c x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s14 = "a b c LRO\u202d 1 2 3 PDF\u202c x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s15 = "a b c LRO\u202D 1 2 3 PDF\u202c x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s16 = "a b c RLO\u202e 1 2 3 PDF\u202c x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s17 = "a b c RLO\u202E 1 2 3 PDF\u202c x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s18 = "a b c LRI\u2066 1 2 3 PDI\u2069 x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s19 = "a b c RLI\u2067 1 2 3 PDI\u2069 x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s20 = "a b c FSI\u2068 1 2 3 PDI\u2069 x y z"; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++} ++ ++void ++g2 () ++{ ++ const char c1 = '\u202a'; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char c2 = '\u202A'; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char c3 = '\u202b'; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char c4 = '\u202B'; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char c5 = '\u202d'; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char c6 = '\u202D'; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char c7 = '\u202e'; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char c8 = '\u202E'; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char c9 = '\u2066'; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char c10 = '\u2067'; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char c11 = '\u2068'; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++} ++ ++int aâªbâ¬c; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int aâ«bâ¬c; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int aâ­bâ¬c; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int aâ®bâ¬c; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int aâ¦bâ©c; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int aâ§bâ©c; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int aâ¨bâ©c; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int Aâ¬X; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int A\u202cY; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int A\u202CY2; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++ ++int d\u202ae\u202cf; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int d\u202Ae\u202cf2; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int d\u202be\u202cf; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int d\u202Be\u202cf2; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int d\u202de\u202cf; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int d\u202De\u202cf2; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int d\u202ee\u202cf; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int d\u202Ee\u202cf2; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int d\u2066e\u2069f; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int d\u2067e\u2069f; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int d\u2068e\u2069f; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ ++int X\u2069; ++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */ +diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-6.c b/gcc/testsuite/c-c++-common/Wbidi-chars-6.c +new file mode 100644 +index 00000000000..0ce6fff2dee +--- /dev/null ++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-6.c +@@ -0,0 +1,155 @@ ++/* PR preprocessor/103026 */ ++/* { dg-do compile } */ ++/* { dg-options "-Wbidi-chars=unpaired" } */ ++/* Test nesting of bidi chars in various contexts. */ ++ ++/* Terminated by the wrong char: */ ++/* a b c LRE⪠1 2 3 PDIâ© x y z */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++/* a b c RLEâ« 1 2 3 PDIâ© x y z*/ ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++/* a b c LROâ­ 1 2 3 PDIâ© x y z */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++/* a b c RLOâ® 1 2 3 PDIâ© x y z */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++/* a b c LRI⦠1 2 3 PDF⬠x y z */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++/* a b c RLI⧠1 2 3 PDF⬠x y z */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++/* a b c FSI⨠1 2 3 PDF⬠x y z*/ ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ ++/* LRE⪠PDF⬠*/ ++/* LRE⪠LRE⪠PDF⬠PDF⬠*/ ++/* PDF⬠LRE⪠PDF⬠*/ ++/* LRE⪠PDF⬠LRE⪠PDF⬠*/ ++/* LRE⪠LRE⪠PDF⬠*/ ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++/* PDF⬠LRE⪠*/ ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ ++// a b c LRE⪠1 2 3 PDIâ© x y z ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++// a b c RLEâ« 1 2 3 PDIâ© x y z*/ ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++// a b c LROâ­ 1 2 3 PDIâ© x y z ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++// a b c RLOâ® 1 2 3 PDIâ© x y z ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++// a b c LRI⦠1 2 3 PDF⬠x y z ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++// a b c RLI⧠1 2 3 PDF⬠x y z ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++// a b c FSI⨠1 2 3 PDF⬠x y z ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ ++// LRE⪠PDF⬠++// LRE⪠LRE⪠PDF⬠PDF⬠++// PDF⬠LRE⪠PDF⬠++// LRE⪠PDF⬠LRE⪠PDF⬠++// LRE⪠LRE⪠PDF⬠++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++// PDF⬠LRE⪠++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ ++void ++g1 () ++{ ++ const char *s1 = "a b c LRE⪠1 2 3 PDIâ© x y z"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s2 = "a b c LRE\u202a 1 2 3 PDI\u2069 x y z"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s3 = "a b c RLEâ« 1 2 3 PDIâ© x y "; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s4 = "a b c RLE\u202b 1 2 3 PDI\u2069 x y z"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s5 = "a b c LROâ­ 1 2 3 PDIâ© x y z"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s6 = "a b c LRO\u202d 1 2 3 PDI\u2069 x y z"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s7 = "a b c RLOâ® 1 2 3 PDIâ© x y z"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s8 = "a b c RLO\u202e 1 2 3 PDI\u2069 x y z"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s9 = "a b c LRI⦠1 2 3 PDF⬠x y z"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s10 = "a b c LRI\u2066 1 2 3 PDF\u202c x y z"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s11 = "a b c RLI⧠1 2 3 PDF⬠x y z\ ++ "; ++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */ ++ const char *s12 = "a b c RLI\u2067 1 2 3 PDF\u202c x y z"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s13 = "a b c FSI⨠1 2 3 PDF⬠x y z"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s14 = "a b c FSI\u2068 1 2 3 PDF\u202c x y z"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s15 = "PDF⬠LREâª"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s16 = "PDF\u202c LRE\u202a"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s17 = "LRE⪠PDFâ¬"; ++ const char *s18 = "LRE\u202a PDF\u202c"; ++ const char *s19 = "LRE⪠LRE⪠PDF⬠PDFâ¬"; ++ const char *s20 = "LRE\u202a LRE\u202a PDF\u202c PDF\u202c"; ++ const char *s21 = "PDF⬠LRE⪠PDFâ¬"; ++ const char *s22 = "PDF\u202c LRE\u202a PDF\u202c"; ++ const char *s23 = "LRE⪠LRE⪠PDFâ¬"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s24 = "LRE\u202a LRE\u202a PDF\u202c"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s25 = "PDF⬠LREâª"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s26 = "PDF\u202c LRE\u202a"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s27 = "PDF⬠LRE\u202a"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ const char *s28 = "PDF\u202c LREâª"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++} ++ ++int aLREâªbPDIâ©; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int A\u202aB\u2069C; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int aRLEâ«bPDIâ©; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int a\u202bB\u2069c; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int aLROâ­bPDIâ©; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int a\u202db\u2069c2; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int aRLOâ®bPDIâ©; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int a\u202eb\u2069; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int aLRIâ¦bPDFâ¬; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int a\u2066b\u202c; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int aRLIâ§bPDFâ¬c ++; ++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */ ++int a\u2067b\u202c; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int aFSIâ¨bPDFâ¬; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int a\u2068b\u202c; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int aFSIâ¨bPD\u202C; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int aFSI\u2068bPDFâ¬_; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int aLREâªbPDFâ¬b; ++int A\u202aB\u202c; ++int a_LREâª_LREâª_b_PDFâ¬_PDFâ¬; ++int A\u202aA\u202aB\u202cB\u202c; ++int aPDFâ¬bLREadPDFâ¬; ++int a_\u202C_\u202a_\u202c; ++int a_LREâª_b_PDFâ¬_c_LREâª_PDFâ¬; ++int a_\u202a_\u202c_\u202a_\u202c_; ++int a_LREâª_b_PDFâ¬_c_LREâª; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int a_\u202a_\u202c_\u202a_; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ +diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-7.c b/gcc/testsuite/c-c++-common/Wbidi-chars-7.c +new file mode 100644 +index 00000000000..d012d420ec0 +--- /dev/null ++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-7.c +@@ -0,0 +1,9 @@ ++/* PR preprocessor/103026 */ ++/* { dg-do compile } */ ++/* { dg-options "-Wbidi-chars=any" } */ ++/* Test we ignore UCNs in comments. */ ++ ++// a b c \u202a 1 2 3 ++// a b c \u202A 1 2 3 ++/* a b c \u202a 1 2 3 */ ++/* a b c \u202A 1 2 3 */ +diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-8.c b/gcc/testsuite/c-c++-common/Wbidi-chars-8.c +new file mode 100644 +index 00000000000..4f54c5092ec +--- /dev/null ++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-8.c +@@ -0,0 +1,13 @@ ++/* PR preprocessor/103026 */ ++/* { dg-do compile } */ ++/* { dg-options "-Wbidi-chars=any" } */ ++/* Test \u vs \U. */ ++ ++int a_\u202A; ++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */ ++int a_\u202a_2; ++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */ ++int a_\U0000202A_3; ++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */ ++int a_\U0000202a_4; ++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */ +diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-9.c b/gcc/testsuite/c-c++-common/Wbidi-chars-9.c +new file mode 100644 +index 00000000000..e2af1b1ca97 +--- /dev/null ++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-9.c +@@ -0,0 +1,29 @@ ++/* PR preprocessor/103026 */ ++/* { dg-do compile } */ ++/* { dg-options "-Wbidi-chars=unpaired" } */ ++/* Test that we properly separate bidi contexts (comment/identifier/character ++ constant/string literal). */ ++ ++/* LRE ->âª<- */ int pdf_\u202c_1; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++/* RLE ->â«<- */ int pdf_\u202c_2; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++/* LRO ->â­<- */ int pdf_\u202c_3; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++/* RLO ->â®<- */ int pdf_\u202c_4; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++/* LRI ->â¦<-*/ int pdi_\u2069_1; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++/* RLI ->â§<- */ int pdi_\u2069_12; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++/* FSI ->â¨<- */ int pdi_\u2069_3; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++ ++const char *s1 = "LRE\u202a"; /* PDF ->â¬<- */ ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++/* LRE ->âª<- */ const char *s2 = "PDF\u202c"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++const char *s3 = "LRE\u202a"; int pdf_\u202c_5; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ ++int lre_\u202a; const char *s4 = "PDF\u202c"; ++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */ +diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h +index 176f8c5bbce..112b9c24751 100644 +--- a/libcpp/include/cpplib.h ++++ b/libcpp/include/cpplib.h +@@ -318,6 +318,17 @@ enum cpp_main_search + CMS_system, /* Search the system INCLUDE path. */ + }; + ++/* The possible bidirectional control characters checking levels, from least ++ restrictive to most. */ ++enum cpp_bidirectional_level { ++ /* No checking. */ ++ bidirectional_none, ++ /* Only detect unpaired uses of bidirectional control characters. */ ++ bidirectional_unpaired, ++ /* Detect any use of bidirectional control characters. */ ++ bidirectional_any ++}; ++ + /* This structure is nested inside struct cpp_reader, and + carries all the options visible to the command line. */ + struct cpp_options +@@ -531,6 +542,10 @@ struct cpp_options + /* True if warn about differences between C++98 and C++11. */ + bool cpp_warn_cxx11_compat; + ++ /* Nonzero if bidirectional control characters checking is on. See enum ++ cpp_bidirectional_level. */ ++ unsigned char cpp_warn_bidirectional; ++ + /* Dependency generation. */ + struct + { +@@ -635,7 +650,8 @@ enum cpp_warning_reason { + CPP_W_C90_C99_COMPAT, + CPP_W_C11_C2X_COMPAT, + CPP_W_CXX11_COMPAT, +- CPP_W_EXPANSION_TO_DEFINED ++ CPP_W_EXPANSION_TO_DEFINED, ++ CPP_W_BIDIRECTIONAL + }; + + /* Callback for header lookup for HEADER, which is the name of a +diff --git a/libcpp/init.c b/libcpp/init.c +index 5a424e23553..f9a8f5f088f 100644 +--- a/libcpp/init.c ++++ b/libcpp/init.c +@@ -219,6 +219,7 @@ cpp_create_reader (enum c_lang lang, cpp + = ENABLE_CANONICAL_SYSTEM_HEADERS; + CPP_OPTION (pfile, ext_numeric_literals) = 1; + CPP_OPTION (pfile, warn_date_time) = 0; ++ CPP_OPTION (pfile, cpp_warn_bidirectional) = bidirectional_unpaired; + + /* Default CPP arithmetic to something sensible for the host for the + benefit of dumb users like fix-header. */ +diff --git a/libcpp/internal.h b/libcpp/internal.h +index 8577cab6c83..0ce0246c5a2 100644 +--- a/libcpp/internal.h ++++ b/libcpp/internal.h +@@ -597,6 +597,13 @@ struct cpp_reader + /* Location identifying the main source file -- intended to be line + zero of said file. */ + location_t main_loc; ++ ++ /* Returns true iff we should warn about UTF-8 bidirectional control ++ characters. */ ++ bool warn_bidi_p () const ++ { ++ return CPP_OPTION (this, cpp_warn_bidirectional) != bidirectional_none; ++ } + }; + + /* Character classes. Based on the more primitive macros in safe-ctype.h. +diff --git a/libcpp/lex.c b/libcpp/lex.c +index fa2253d41c3..6a4fbce6030 100644 +--- a/libcpp/lex.c ++++ b/libcpp/lex.c +@@ -1164,6 +1164,324 @@ _cpp_process_line_notes (cpp_reader *pfi + } + } + ++namespace bidi { ++ enum class kind { ++ NONE, LRE, RLE, LRO, RLO, LRI, RLI, FSI, PDF, PDI, LTR, RTL ++ }; ++ ++ /* All the UTF-8 encodings of bidi characters start with E2. */ ++ constexpr uchar utf8_start = 0xe2; ++ ++ /* A vector holding currently open bidi contexts. We use a char for ++ each context, its LSB is 1 if it represents a PDF context, 0 if it ++ represents a PDI context. The next bit is 1 if this context was open ++ by a bidi character written as a UCN, and 0 when it was UTF-8. */ ++ semi_embedded_vec vec; ++ ++ /* Close the whole comment/identifier/string literal/character constant ++ context. */ ++ void on_close () ++ { ++ vec.truncate (0); ++ } ++ ++ /* Pop the last element in the vector. */ ++ void pop () ++ { ++ unsigned int len = vec.count (); ++ gcc_checking_assert (len > 0); ++ vec.truncate (len - 1); ++ } ++ ++ /* Return the context of the Ith element. */ ++ kind ctx_at (unsigned int i) ++ { ++ return (vec[i] & 1) ? kind::PDF : kind::PDI; ++ } ++ ++ /* Return which context is currently opened. */ ++ kind current_ctx () ++ { ++ unsigned int len = vec.count (); ++ if (len == 0) ++ return kind::NONE; ++ return ctx_at (len - 1); ++ } ++ ++ /* Return true if the current context comes from a UCN origin, that is, ++ the bidi char which started this bidi context was written as a UCN. */ ++ bool current_ctx_ucn_p () ++ { ++ unsigned int len = vec.count (); ++ gcc_checking_assert (len > 0); ++ return (vec[len - 1] >> 1) & 1; ++ } ++ ++ /* We've read a bidi char, update the current vector as necessary. */ ++ void on_char (kind k, bool ucn_p) ++ { ++ switch (k) ++ { ++ case kind::LRE: ++ case kind::RLE: ++ case kind::LRO: ++ case kind::RLO: ++ vec.push (ucn_p ? 3u : 1u); ++ break; ++ case kind::LRI: ++ case kind::RLI: ++ case kind::FSI: ++ vec.push (ucn_p ? 2u : 0u); ++ break; ++ /* PDF terminates the scope of the last LRE, RLE, LRO, or RLO ++ whose scope has not yet been terminated. */ ++ case kind::PDF: ++ if (current_ctx () == kind::PDF) ++ pop (); ++ break; ++ /* PDI terminates the scope of the last LRI, RLI, or FSI whose ++ scope has not yet been terminated, as well as the scopes of ++ any subsequent LREs, RLEs, LROs, or RLOs whose scopes have not ++ yet been terminated. */ ++ case kind::PDI: ++ for (int i = vec.count () - 1; i >= 0; --i) ++ if (ctx_at (i) == kind::PDI) ++ { ++ vec.truncate (i); ++ break; ++ } ++ break; ++ case kind::LTR: ++ case kind::RTL: ++ /* These aren't popped by a PDF/PDI. */ ++ break; ++ [[likely]] case kind::NONE: ++ break; ++ default: ++ abort (); ++ } ++ } ++ ++ /* Return a descriptive string for K. */ ++ const char *to_str (kind k) ++ { ++ switch (k) ++ { ++ case kind::LRE: ++ return "U+202A (LEFT-TO-RIGHT EMBEDDING)"; ++ case kind::RLE: ++ return "U+202B (RIGHT-TO-LEFT EMBEDDING)"; ++ case kind::LRO: ++ return "U+202D (LEFT-TO-RIGHT OVERRIDE)"; ++ case kind::RLO: ++ return "U+202E (RIGHT-TO-LEFT OVERRIDE)"; ++ case kind::LRI: ++ return "U+2066 (LEFT-TO-RIGHT ISOLATE)"; ++ case kind::RLI: ++ return "U+2067 (RIGHT-TO-LEFT ISOLATE)"; ++ case kind::FSI: ++ return "U+2068 (FIRST STRONG ISOLATE)"; ++ case kind::PDF: ++ return "U+202C (POP DIRECTIONAL FORMATTING)"; ++ case kind::PDI: ++ return "U+2069 (POP DIRECTIONAL ISOLATE)"; ++ case kind::LTR: ++ return "U+200E (LEFT-TO-RIGHT MARK)"; ++ case kind::RTL: ++ return "U+200F (RIGHT-TO-LEFT MARK)"; ++ default: ++ abort (); ++ } ++ } ++} ++ ++/* Parse a sequence of 3 bytes starting with P and return its bidi code. */ ++ ++static bidi::kind ++get_bidi_utf8 (const unsigned char *const p) ++{ ++ gcc_checking_assert (p[0] == bidi::utf8_start); ++ ++ if (p[1] == 0x80) ++ switch (p[2]) ++ { ++ case 0xaa: ++ return bidi::kind::LRE; ++ case 0xab: ++ return bidi::kind::RLE; ++ case 0xac: ++ return bidi::kind::PDF; ++ case 0xad: ++ return bidi::kind::LRO; ++ case 0xae: ++ return bidi::kind::RLO; ++ case 0x8e: ++ return bidi::kind::LTR; ++ case 0x8f: ++ return bidi::kind::RTL; ++ default: ++ break; ++ } ++ else if (p[1] == 0x81) ++ switch (p[2]) ++ { ++ case 0xa6: ++ return bidi::kind::LRI; ++ case 0xa7: ++ return bidi::kind::RLI; ++ case 0xa8: ++ return bidi::kind::FSI; ++ case 0xa9: ++ return bidi::kind::PDI; ++ default: ++ break; ++ } ++ ++ return bidi::kind::NONE; ++} ++ ++/* Parse a UCN where P points just past \u or \U and return its bidi code. */ ++ ++static bidi::kind ++get_bidi_ucn (const unsigned char *p, bool is_U) ++{ ++ /* 6.4.3 Universal Character Names ++ \u hex-quad ++ \U hex-quad hex-quad ++ where \unnnn means \U0000nnnn. */ ++ ++ if (is_U) ++ { ++ if (p[0] != '0' || p[1] != '0' || p[2] != '0' || p[3] != '0') ++ return bidi::kind::NONE; ++ /* Skip 4B so we can treat \u and \U the same below. */ ++ p += 4; ++ } ++ ++ /* All code points we are looking for start with 20xx. */ ++ if (p[0] != '2' || p[1] != '0') ++ return bidi::kind::NONE; ++ else if (p[2] == '2') ++ switch (p[3]) ++ { ++ case 'a': ++ case 'A': ++ return bidi::kind::LRE; ++ case 'b': ++ case 'B': ++ return bidi::kind::RLE; ++ case 'c': ++ case 'C': ++ return bidi::kind::PDF; ++ case 'd': ++ case 'D': ++ return bidi::kind::LRO; ++ case 'e': ++ case 'E': ++ return bidi::kind::RLO; ++ default: ++ break; ++ } ++ else if (p[2] == '6') ++ switch (p[3]) ++ { ++ case '6': ++ return bidi::kind::LRI; ++ case '7': ++ return bidi::kind::RLI; ++ case '8': ++ return bidi::kind::FSI; ++ case '9': ++ return bidi::kind::PDI; ++ default: ++ break; ++ } ++ else if (p[2] == '0') ++ switch (p[3]) ++ { ++ case 'e': ++ case 'E': ++ return bidi::kind::LTR; ++ case 'f': ++ case 'F': ++ return bidi::kind::RTL; ++ default: ++ break; ++ } ++ ++ return bidi::kind::NONE; ++} ++ ++/* We're closing a bidi context, that is, we've encountered a newline, ++ are closing a C-style comment, or are at the end of a string literal, ++ character constant, or identifier. Warn if this context was not ++ properly terminated by a PDI or PDF. P points to the last character ++ in this context. */ ++ ++static void ++maybe_warn_bidi_on_close (cpp_reader *pfile, const uchar *p) ++{ ++ if (CPP_OPTION (pfile, cpp_warn_bidirectional) == bidirectional_unpaired ++ && bidi::vec.count () > 0) ++ { ++ const location_t loc ++ = linemap_position_for_column (pfile->line_table, ++ CPP_BUF_COLUMN (pfile->buffer, p)); ++ cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0, ++ "unpaired UTF-8 bidirectional control character " ++ "detected"); ++ } ++ /* We're done with this context. */ ++ bidi::on_close (); ++} ++ ++/* We're at the beginning or in the middle of an identifier/comment/string ++ literal/character constant. Warn if we've encountered a bidi character. ++ KIND says which bidi character it was; P points to it in the character ++ stream. UCN_P is true iff this bidi character was written as a UCN. */ ++ ++static void ++maybe_warn_bidi_on_char (cpp_reader *pfile, const uchar *p, bidi::kind kind, ++ bool ucn_p) ++{ ++ if (__builtin_expect (kind == bidi::kind::NONE, 1)) ++ return; ++ ++ const auto warn_bidi = CPP_OPTION (pfile, cpp_warn_bidirectional); ++ ++ if (warn_bidi != bidirectional_none) ++ { ++ const location_t loc ++ = linemap_position_for_column (pfile->line_table, ++ CPP_BUF_COLUMN (pfile->buffer, p)); ++ /* It seems excessive to warn about a PDI/PDF that is closing ++ an opened context because we've already warned about the ++ opening character. Except warn when we have a UCN x UTF-8 ++ mismatch. */ ++ if (kind == bidi::current_ctx ()) ++ { ++ if (warn_bidi == bidirectional_unpaired ++ && bidi::current_ctx_ucn_p () != ucn_p) ++ cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0, ++ "UTF-8 vs UCN mismatch when closing " ++ "a context by \"%s\"", bidi::to_str (kind)); ++ } ++ else if (warn_bidi == bidirectional_any) ++ { ++ if (kind == bidi::kind::PDF || kind == bidi::kind::PDI) ++ cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0, ++ "\"%s\" is closing an unopened context", ++ bidi::to_str (kind)); ++ else ++ cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0, ++ "found problematic Unicode character \"%s\"", ++ bidi::to_str (kind)); ++ } ++ } ++ /* We're done with this context. */ ++ bidi::on_char (kind, ucn_p); ++} ++ + /* Skip a C-style block comment. We find the end of the comment by + seeing if an asterisk is before every '/' we encounter. Returns + nonzero if comment terminated by EOF, zero otherwise. +@@ -1175,6 +1493,7 @@ _cpp_skip_block_comment (cpp_reader *pfi + cpp_buffer *buffer = pfile->buffer; + const uchar *cur = buffer->cur; + uchar c; ++ const bool warn_bidi_p = pfile->warn_bidi_p (); + + cur++; + if (*cur == '/') +@@ -1189,7 +1508,11 @@ _cpp_skip_block_comment (cpp_reader *pfi + if (c == '/') + { + if (cur[-2] == '*') +- break; ++ { ++ if (warn_bidi_p) ++ maybe_warn_bidi_on_close (pfile, cur); ++ break; ++ } + + /* Warn about potential nested comments, but not if the '/' + comes immediately before the true comment delimiter. +@@ -1208,6 +1531,8 @@ _cpp_skip_block_comment (cpp_reader *pfi + { + unsigned int cols; + buffer->cur = cur - 1; ++ if (warn_bidi_p) ++ maybe_warn_bidi_on_close (pfile, cur); + _cpp_process_line_notes (pfile, true); + if (buffer->next_line >= buffer->rlimit) + return true; +@@ -1218,6 +1543,13 @@ _cpp_skip_block_comment (cpp_reader *pfi + + cur = buffer->cur; + } ++ /* If this is a beginning of a UTF-8 encoding, it might be ++ a bidirectional control character. */ ++ else if (__builtin_expect (c == bidi::utf8_start, 0) && warn_bidi_p) ++ { ++ bidi::kind kind = get_bidi_utf8 (cur - 1); ++ maybe_warn_bidi_on_char (pfile, cur, kind, /*ucn_p=*/false); ++ } + } + + buffer->cur = cur; +@@ -1233,9 +1565,31 @@ skip_line_comment (cpp_reader *pfile) + { + cpp_buffer *buffer = pfile->buffer; + location_t orig_line = pfile->line_table->highest_line; ++ const bool warn_bidi_p = pfile->warn_bidi_p (); + +- while (*buffer->cur != '\n') +- buffer->cur++; ++ if (!warn_bidi_p) ++ while (*buffer->cur != '\n') ++ buffer->cur++; ++ else ++ { ++ while (*buffer->cur != '\n' ++ && *buffer->cur != bidi::utf8_start) ++ buffer->cur++; ++ if (__builtin_expect (*buffer->cur == bidi::utf8_start, 0)) ++ { ++ while (*buffer->cur != '\n') ++ { ++ if (__builtin_expect (*buffer->cur == bidi::utf8_start, 0)) ++ { ++ bidi::kind kind = get_bidi_utf8 (buffer->cur); ++ maybe_warn_bidi_on_char (pfile, buffer->cur, kind, ++ /*ucn_p=*/false); ++ } ++ buffer->cur++; ++ } ++ maybe_warn_bidi_on_close (pfile, buffer->cur); ++ } ++ } + + _cpp_process_line_notes (pfile, true); + return orig_line != pfile->line_table->highest_line; +@@ -1317,11 +1671,13 @@ static const cppchar_t utf8_signifier = + + /* Returns TRUE if the sequence starting at buffer->cur is valid in + an identifier. FIRST is TRUE if this starts an identifier. */ ++ + static bool + forms_identifier_p (cpp_reader *pfile, int first, + struct normalize_state *state) + { + cpp_buffer *buffer = pfile->buffer; ++ const bool warn_bidi_p = pfile->warn_bidi_p (); + + if (*buffer->cur == '$') + { +@@ -1344,6 +1700,13 @@ forms_identifier_p (cpp_reader *pfile, i + cppchar_t s; + if (*buffer->cur >= utf8_signifier) + { ++ if (__builtin_expect (*buffer->cur == bidi::utf8_start, 0) ++ && warn_bidi_p) ++ { ++ bidi::kind kind = get_bidi_utf8 (buffer->cur); ++ maybe_warn_bidi_on_char (pfile, buffer->cur, kind, ++ /*ucn_p=*/false); ++ } + if (_cpp_valid_utf8 (pfile, &buffer->cur, buffer->rlimit, 1 + !first, + state, &s)) + return true; +@@ -1352,6 +1715,13 @@ forms_identifier_p (cpp_reader *pfile, i + && (buffer->cur[1] == 'u' || buffer->cur[1] == 'U')) + { + buffer->cur += 2; ++ if (warn_bidi_p) ++ { ++ bidi::kind kind = get_bidi_ucn (buffer->cur, ++ buffer->cur[-1] == 'U'); ++ maybe_warn_bidi_on_char (pfile, buffer->cur, kind, ++ /*ucn_p=*/true); ++ } + if (_cpp_valid_ucn (pfile, &buffer->cur, buffer->rlimit, 1 + !first, + state, &s, NULL, NULL)) + return true; +@@ -1460,6 +1830,7 @@ lex_identifier (cpp_reader *pfile, const + const uchar *cur; + unsigned int len; + unsigned int hash = HT_HASHSTEP (0, *base); ++ const bool warn_bidi_p = pfile->warn_bidi_p (); + + cur = pfile->buffer->cur; + if (! starts_ucn) +@@ -1483,6 +1854,8 @@ lex_identifier (cpp_reader *pfile, const + pfile->buffer->cur++; + } + } while (forms_identifier_p (pfile, false, nst)); ++ if (warn_bidi_p) ++ maybe_warn_bidi_on_close (pfile, pfile->buffer->cur); + result = _cpp_interpret_identifier (pfile, base, + pfile->buffer->cur - base); + *spelling = cpp_lookup (pfile, base, pfile->buffer->cur - base); +@@ -1719,6 +2092,7 @@ static void + lex_raw_string (cpp_reader *pfile, cpp_token *token, const uchar *base) + { + const uchar *pos = base; ++ const bool warn_bidi_p = pfile->warn_bidi_p (); + + /* 'tis a pity this information isn't passed down from the lexer's + initial categorization of the token. */ +@@ -1955,8 +2329,15 @@ lex_raw_string (cpp_reader *pfile, cpp_t + pos = base = pfile->buffer->cur; + note = &pfile->buffer->notes[pfile->buffer->cur_note]; + } ++ else if (__builtin_expect ((unsigned char) c == bidi::utf8_start, 0) ++ && warn_bidi_p) ++ maybe_warn_bidi_on_char (pfile, pos - 1, get_bidi_utf8 (pos - 1), ++ /*ucn_p=*/false); + } + ++ if (warn_bidi_p) ++ maybe_warn_bidi_on_close (pfile, pos); ++ + if (CPP_OPTION (pfile, user_literals)) + { + /* If a string format macro, say from inttypes.h, is placed touching +@@ -2051,15 +2432,27 @@ lex_string (cpp_reader *pfile, cpp_token + else + terminator = '>', type = CPP_HEADER_NAME; + ++ const bool warn_bidi_p = pfile->warn_bidi_p (); + for (;;) + { + cppchar_t c = *cur++; + + /* In #include-style directives, terminators are not escapable. */ + if (c == '\\' && !pfile->state.angled_headers && *cur != '\n') +- cur++; ++ { ++ if ((cur[0] == 'u' || cur[0] == 'U') && warn_bidi_p) ++ { ++ bidi::kind kind = get_bidi_ucn (cur + 1, cur[0] == 'U'); ++ maybe_warn_bidi_on_char (pfile, cur, kind, /*ucn_p=*/true); ++ } ++ cur++; ++ } + else if (c == terminator) +- break; ++ { ++ if (warn_bidi_p) ++ maybe_warn_bidi_on_close (pfile, cur - 1); ++ break; ++ } + else if (c == '\n') + { + cur--; +@@ -2076,6 +2469,11 @@ lex_string (cpp_reader *pfile, cpp_token + } + else if (c == '\0') + saw_NUL = true; ++ else if (__builtin_expect (c == bidi::utf8_start, 0) && warn_bidi_p) ++ { ++ bidi::kind kind = get_bidi_utf8 (cur - 1); ++ maybe_warn_bidi_on_char (pfile, cur - 1, kind, /*ucn_p=*/false); ++ } + } + + if (saw_NUL && !pfile->state.skipping) diff --git a/recipes-devtools/gcc/gcc-arc/0002-aarch64-Introduce-SLS-mitigation-for-RET-and-BR-inst.patch b/recipes-devtools/gcc/gcc-arc/0002-aarch64-Introduce-SLS-mitigation-for-RET-and-BR-inst.patch deleted file mode 100644 index 823cc8b..0000000 --- a/recipes-devtools/gcc/gcc-arc/0002-aarch64-Introduce-SLS-mitigation-for-RET-and-BR-inst.patch +++ /dev/null @@ -1,607 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From b1204d16e1ec96a4aa89e44de8990e2499ffdb22 Mon Sep 17 00:00:00 2001 -From: Matthew Malcomson -Date: Thu, 9 Jul 2020 09:11:59 +0100 -Subject: [PATCH 2/3] aarch64: Introduce SLS mitigation for RET and BR - instructions - -Instructions following RET or BR are not necessarily executed. In order -to avoid speculation past RET and BR we can simply append a speculation -barrier. - -Since these speculation barriers will not be architecturally executed, -they are not expected to add a high performance penalty. - -The speculation barrier is to be SB when targeting architectures which -have this enabled, and DSB SY + ISB otherwise. - -We add tests for each of the cases where such an instruction was seen. - -This is implemented by modifying each machine description pattern that -emits either a RET or a BR instruction. We choose not to use something -like `TARGET_ASM_FUNCTION_EPILOGUE` since it does not affect the -`indirect_jump`, `jump`, `sibcall_insn` and `sibcall_value_insn` -patterns and we find it preferable to implement the functionality in the -same way for every pattern. - -There is one particular case which is slightly tricky. The -implementation of TARGET_ASM_TRAMPOLINE_TEMPLATE uses a BR which needs -to be mitigated against. The trampoline template is used *once* per -compilation unit, and the TRAMPOLINE_SIZE is exposed to the user via the -builtin macro __LIBGCC_TRAMPOLINE_SIZE__. -In the future we may implement function specific attributes to turn on -and off hardening on a per-function basis. -The fixed nature of the trampoline described above implies it will be -safer to ensure this speculation barrier is always used. - -Testing: - Bootstrap and regtest done on aarch64-none-linux - Used a temporary hack(1) to use these options on every test in the - testsuite and a script to check that the output never emitted an - unmitigated RET or BR. - -1) Temporary hack was a change to the testsuite to always use -`-save-temps` and run a script on the assembly output of those -compilations which produced one to ensure every RET or BR is immediately -followed by a speculation barrier. - -gcc/ChangeLog: - - * config/aarch64/aarch64-protos.h (aarch64_sls_barrier): New. - * config/aarch64/aarch64.c (aarch64_output_casesi): Emit - speculation barrier after BR instruction if needs be. - (aarch64_trampoline_init): Handle ptr_mode value & adjust size - of code copied. - (aarch64_sls_barrier): New. - (aarch64_asm_trampoline_template): Add needed barriers. - * config/aarch64/aarch64.h (AARCH64_ISA_SB): New. - (TARGET_SB): New. - (TRAMPOLINE_SIZE): Account for barrier. - * config/aarch64/aarch64.md (indirect_jump, *casesi_dispatch, - simple_return, *do_return, *sibcall_insn, *sibcall_value_insn): - Emit barrier if needs be, also account for possible barrier using - "sls_length" attribute. - (sls_length): New attribute. - (length): Determine default using any non-default sls_length - value. - -gcc/testsuite/ChangeLog: - - * gcc.target/aarch64/sls-mitigation/sls-miti-retbr.c: New test. - * gcc.target/aarch64/sls-mitigation/sls-miti-retbr-pacret.c: - New test. - * gcc.target/aarch64/sls-mitigation/sls-mitigation.exp: New file. - * lib/target-supports.exp (check_effective_target_aarch64_asm_sb_ok): - New proc. ---- - gcc/config/aarch64/aarch64-protos.h | 1 + - gcc/config/aarch64/aarch64.c | 41 ++++++- - gcc/config/aarch64/aarch64.h | 10 +- - gcc/config/aarch64/aarch64.md | 76 +++++++++---- - .../aarch64/sls-mitigation/sls-miti-retbr-pacret.c | 21 ++++ - .../aarch64/sls-mitigation/sls-miti-retbr.c | 119 +++++++++++++++++++++ - .../aarch64/sls-mitigation/sls-mitigation.exp | 73 +++++++++++++ - gcc/testsuite/lib/target-supports.exp | 2 +- - 8 files changed, 318 insertions(+), 25 deletions(-) - create mode 100644 gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-retbr-pacret.c - create mode 100644 gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-retbr.c - create mode 100644 gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-mitigation.exp - -diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h -index eb5f4b4..ee0ffde 100644 ---- a/gcc/config/aarch64/aarch64-protos.h -+++ b/gcc/config/aarch64/aarch64-protos.h -@@ -781,6 +781,7 @@ extern const atomic_ool_names aarch64_ool_ldeor_names; - - tree aarch64_resolve_overloaded_builtin_general (location_t, tree, void *); - -+const char *aarch64_sls_barrier (int); - extern bool aarch64_harden_sls_retbr_p (void); - extern bool aarch64_harden_sls_blr_p (void); - -diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c -index 437a9cf..44e3d1f 100644 ---- a/gcc/config/aarch64/aarch64.c -+++ b/gcc/config/aarch64/aarch64.c -@@ -10852,8 +10852,8 @@ aarch64_return_addr (int count, rtx frame ATTRIBUTE_UNUSED) - static void - aarch64_asm_trampoline_template (FILE *f) - { -- int offset1 = 16; -- int offset2 = 20; -+ int offset1 = 24; -+ int offset2 = 28; - - if (aarch64_bti_enabled ()) - { -@@ -10876,6 +10876,17 @@ aarch64_asm_trampoline_template (FILE *f) - } - asm_fprintf (f, "\tbr\t%s\n", reg_names [IP1_REGNUM]); - -+ /* We always emit a speculation barrier. -+ This is because the same trampoline template is used for every nested -+ function. Since nested functions are not particularly common or -+ performant we don't worry too much about the extra instructions to copy -+ around. -+ This is not yet a problem, since we have not yet implemented function -+ specific attributes to choose between hardening against straight line -+ speculation or not, but such function specific attributes are likely to -+ happen in the future. */ -+ asm_fprintf (f, "\tdsb\tsy\n\tisb\n"); -+ - /* The trampoline needs an extra padding instruction. In case if BTI is - enabled the padding instruction is replaced by the BTI instruction at - the beginning. */ -@@ -10890,10 +10901,14 @@ static void - aarch64_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value) - { - rtx fnaddr, mem, a_tramp; -- const int tramp_code_sz = 16; -+ const int tramp_code_sz = 24; - - /* Don't need to copy the trailing D-words, we fill those in below. */ -- emit_block_move (m_tramp, assemble_trampoline_template (), -+ /* We create our own memory address in Pmode so that `emit_block_move` can -+ use parts of the backend which expect Pmode addresses. */ -+ rtx temp = convert_memory_address (Pmode, XEXP (m_tramp, 0)); -+ emit_block_move (gen_rtx_MEM (BLKmode, temp), -+ assemble_trampoline_template (), - GEN_INT (tramp_code_sz), BLOCK_OP_NORMAL); - mem = adjust_address (m_tramp, ptr_mode, tramp_code_sz); - fnaddr = XEXP (DECL_RTL (fndecl), 0); -@@ -11084,6 +11099,8 @@ aarch64_output_casesi (rtx *operands) - output_asm_insn (buf, operands); - output_asm_insn (patterns[index][1], operands); - output_asm_insn ("br\t%3", operands); -+ output_asm_insn (aarch64_sls_barrier (aarch64_harden_sls_retbr_p ()), -+ operands); - assemble_label (asm_out_file, label); - return ""; - } -@@ -22924,6 +22941,22 @@ aarch64_file_end_indicate_exec_stack () - #undef GNU_PROPERTY_AARCH64_FEATURE_1_BTI - #undef GNU_PROPERTY_AARCH64_FEATURE_1_AND - -+/* Helper function for straight line speculation. -+ Return what barrier should be emitted for straight line speculation -+ mitigation. -+ When not mitigating against straight line speculation this function returns -+ an empty string. -+ When mitigating against straight line speculation, use: -+ * SB when the v8.5-A SB extension is enabled. -+ * DSB+ISB otherwise. */ -+const char * -+aarch64_sls_barrier (int mitigation_required) -+{ -+ return mitigation_required -+ ? (TARGET_SB ? "sb" : "dsb\tsy\n\tisb") -+ : ""; -+} -+ - /* Target-specific selftests. */ - - #if CHECKING_P -diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h -index 1ce23c6..c21015f 100644 ---- a/gcc/config/aarch64/aarch64.h -+++ b/gcc/config/aarch64/aarch64.h -@@ -281,6 +281,7 @@ extern unsigned aarch64_architecture_version; - #define AARCH64_ISA_F32MM (aarch64_isa_flags & AARCH64_FL_F32MM) - #define AARCH64_ISA_F64MM (aarch64_isa_flags & AARCH64_FL_F64MM) - #define AARCH64_ISA_BF16 (aarch64_isa_flags & AARCH64_FL_BF16) -+#define AARCH64_ISA_SB (aarch64_isa_flags & AARCH64_FL_SB) - - /* Crypto is an optional extension to AdvSIMD. */ - #define TARGET_CRYPTO (TARGET_SIMD && AARCH64_ISA_CRYPTO) -@@ -378,6 +379,9 @@ extern unsigned aarch64_architecture_version; - #define TARGET_FIX_ERR_A53_835769_DEFAULT 1 - #endif - -+/* SB instruction is enabled through +sb. */ -+#define TARGET_SB (AARCH64_ISA_SB) -+ - /* Apply the workaround for Cortex-A53 erratum 835769. */ - #define TARGET_FIX_ERR_A53_835769 \ - ((aarch64_fix_a53_err835769 == 2) \ -@@ -1058,8 +1062,10 @@ typedef struct - - #define RETURN_ADDR_RTX aarch64_return_addr - --/* BTI c + 3 insns + 2 pointer-sized entries. */ --#define TRAMPOLINE_SIZE (TARGET_ILP32 ? 24 : 32) -+/* BTI c + 3 insns -+ + sls barrier of DSB + ISB. -+ + 2 pointer-sized entries. */ -+#define TRAMPOLINE_SIZE (24 + (TARGET_ILP32 ? 8 : 16)) - - /* Trampolines contain dwords, so must be dword aligned. */ - #define TRAMPOLINE_ALIGNMENT 64 -diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md -index 8c8be3c..dda04ee 100644 ---- a/gcc/config/aarch64/aarch64.md -+++ b/gcc/config/aarch64/aarch64.md -@@ -407,10 +407,25 @@ - ;; Attribute that specifies whether the alternative uses MOVPRFX. - (define_attr "movprfx" "no,yes" (const_string "no")) - -+;; Attribute to specify that an alternative has the length of a single -+;; instruction plus a speculation barrier. -+(define_attr "sls_length" "none,retbr,casesi" (const_string "none")) -+ - (define_attr "length" "" - (cond [(eq_attr "movprfx" "yes") - (const_int 8) -- ] (const_int 4))) -+ -+ (eq_attr "sls_length" "retbr") -+ (cond [(match_test "!aarch64_harden_sls_retbr_p ()") (const_int 4) -+ (match_test "TARGET_SB") (const_int 8)] -+ (const_int 12)) -+ -+ (eq_attr "sls_length" "casesi") -+ (cond [(match_test "!aarch64_harden_sls_retbr_p ()") (const_int 16) -+ (match_test "TARGET_SB") (const_int 20)] -+ (const_int 24)) -+ ] -+ (const_int 4))) - - ;; Strictly for compatibility with AArch32 in pipeline models, since AArch64 has - ;; no predicated insns. -@@ -447,8 +462,12 @@ - (define_insn "indirect_jump" - [(set (pc) (match_operand:DI 0 "register_operand" "r"))] - "" -- "br\\t%0" -- [(set_attr "type" "branch")] -+ { -+ output_asm_insn ("br\\t%0", operands); -+ return aarch64_sls_barrier (aarch64_harden_sls_retbr_p ()); -+ } -+ [(set_attr "type" "branch") -+ (set_attr "sls_length" "retbr")] - ) - - (define_insn "jump" -@@ -765,7 +784,7 @@ - "* - return aarch64_output_casesi (operands); - " -- [(set_attr "length" "16") -+ [(set_attr "sls_length" "casesi") - (set_attr "type" "branch")] - ) - -@@ -844,18 +863,23 @@ - [(return)] - "" - { -+ const char *ret = NULL; - if (aarch64_return_address_signing_enabled () - && TARGET_ARMV8_3 - && !crtl->calls_eh_return) - { - if (aarch64_ra_sign_key == AARCH64_KEY_B) -- return "retab"; -+ ret = "retab"; - else -- return "retaa"; -+ ret = "retaa"; - } -- return "ret"; -+ else -+ ret = "ret"; -+ output_asm_insn (ret, operands); -+ return aarch64_sls_barrier (aarch64_harden_sls_retbr_p ()); - } -- [(set_attr "type" "branch")] -+ [(set_attr "type" "branch") -+ (set_attr "sls_length" "retbr")] - ) - - (define_expand "return" -@@ -867,8 +891,12 @@ - (define_insn "simple_return" - [(simple_return)] - "" -- "ret" -- [(set_attr "type" "branch")] -+ { -+ output_asm_insn ("ret", operands); -+ return aarch64_sls_barrier (aarch64_harden_sls_retbr_p ()); -+ } -+ [(set_attr "type" "branch") -+ (set_attr "sls_length" "retbr")] - ) - - (define_insn "*cb1" -@@ -1066,10 +1094,16 @@ - (unspec:DI [(match_operand:DI 2 "const_int_operand")] UNSPEC_CALLEE_ABI) - (return)] - "SIBLING_CALL_P (insn)" -- "@ -- br\\t%0 -- b\\t%c0" -- [(set_attr "type" "branch, branch")] -+ { -+ if (which_alternative == 0) -+ { -+ output_asm_insn ("br\\t%0", operands); -+ return aarch64_sls_barrier (aarch64_harden_sls_retbr_p ()); -+ } -+ return "b\\t%c0"; -+ } -+ [(set_attr "type" "branch, branch") -+ (set_attr "sls_length" "retbr,none")] - ) - - (define_insn "*sibcall_value_insn" -@@ -1080,10 +1114,16 @@ - (unspec:DI [(match_operand:DI 3 "const_int_operand")] UNSPEC_CALLEE_ABI) - (return)] - "SIBLING_CALL_P (insn)" -- "@ -- br\\t%1 -- b\\t%c1" -- [(set_attr "type" "branch, branch")] -+ { -+ if (which_alternative == 0) -+ { -+ output_asm_insn ("br\\t%1", operands); -+ return aarch64_sls_barrier (aarch64_harden_sls_retbr_p ()); -+ } -+ return "b\\t%c1"; -+ } -+ [(set_attr "type" "branch, branch") -+ (set_attr "sls_length" "retbr,none")] - ) - - ;; Call subroutine returning any type. -diff --git a/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-retbr-pacret.c b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-retbr-pacret.c -new file mode 100644 -index 0000000..fa1887a ---- /dev/null -+++ b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-retbr-pacret.c -@@ -0,0 +1,21 @@ -+/* Avoid ILP32 since pacret is only available for LP64 */ -+/* { dg-do compile { target { ! ilp32 } } } */ -+/* { dg-additional-options "-mharden-sls=retbr -mbranch-protection=pac-ret -march=armv8.3-a" } */ -+ -+/* Testing the do_return pattern for retaa and retab. */ -+long retbr_subcall(void); -+long retbr_do_return_retaa(void) -+{ -+ return retbr_subcall()+1; -+} -+ -+__attribute__((target("branch-protection=pac-ret+b-key"))) -+long retbr_do_return_retab(void) -+{ -+ return retbr_subcall()+1; -+} -+ -+/* Ensure there are no BR or RET instructions which are not directly followed -+ by a speculation barrier. */ -+/* { dg-final { scan-assembler-not {\t(br|ret|retaa|retab)\tx[0-9][0-9]?\n\t(?!dsb\tsy\n\tisb)} } } */ -+/* { dg-final { scan-assembler-not {ret\t} } } */ -diff --git a/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-retbr.c b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-retbr.c -new file mode 100644 -index 0000000..76b8d03 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-retbr.c -@@ -0,0 +1,119 @@ -+/* We ensure that -Wpedantic is off since it complains about the trampolines -+ we explicitly want to test. */ -+/* { dg-additional-options "-mharden-sls=retbr -Wno-pedantic " } */ -+/* -+ Ensure that the SLS hardening of RET and BR leaves no unprotected RET/BR -+ instructions. -+ */ -+typedef int (foo) (int, int); -+typedef void (bar) (int, int); -+struct sls_testclass { -+ foo *x; -+ bar *y; -+ int left; -+ int right; -+}; -+ -+int -+retbr_sibcall_value_insn (struct sls_testclass x) -+{ -+ return x.x(x.left, x.right); -+} -+ -+void -+retbr_sibcall_insn (struct sls_testclass x) -+{ -+ x.y(x.left, x.right); -+} -+ -+/* Aim to test two different returns. -+ One that introduces a tail call in the middle of the function, and one that -+ has a normal return. */ -+int -+retbr_multiple_returns (struct sls_testclass x) -+{ -+ int temp; -+ if (x.left % 10) -+ return x.x(x.left, 100); -+ else if (x.right % 20) -+ { -+ return x.x(x.left * x.right, 100); -+ } -+ temp = x.left % x.right; -+ temp *= 100; -+ temp /= 2; -+ return temp % 3; -+} -+ -+void -+retbr_multiple_returns_void (struct sls_testclass x) -+{ -+ if (x.left % 10) -+ { -+ x.y(x.left, 100); -+ } -+ else if (x.right % 20) -+ { -+ x.y(x.left * x.right, 100); -+ } -+ return; -+} -+ -+/* Testing the casesi jump via register. */ -+__attribute__ ((optimize ("Os"))) -+int -+retbr_casesi_dispatch (struct sls_testclass x) -+{ -+ switch (x.left) -+ { -+ case -5: -+ return -2; -+ case -3: -+ return -1; -+ case 0: -+ return 0; -+ case 3: -+ return 1; -+ case 5: -+ break; -+ default: -+ __builtin_unreachable (); -+ } -+ return x.right; -+} -+ -+/* Testing the BR in trampolines is mitigated against. */ -+void f1 (void *); -+void f3 (void *, void (*)(void *)); -+void f2 (void *); -+ -+int -+retbr_trampolines (void *a, int b) -+{ -+ if (!b) -+ { -+ f1 (a); -+ return 1; -+ } -+ if (b) -+ { -+ void retbr_tramp_internal (void *c) -+ { -+ if (c == a) -+ f2 (c); -+ } -+ f3 (a, retbr_tramp_internal); -+ } -+ return 0; -+} -+ -+/* Testing the indirect_jump pattern. */ -+void -+retbr_indirect_jump (int *buf) -+{ -+ __builtin_longjmp(buf, 1); -+} -+ -+/* Ensure there are no BR or RET instructions which are not directly followed -+ by a speculation barrier. */ -+/* { dg-final { scan-assembler-not {\t(br|ret|retaa|retab)\tx[0-9][0-9]?\n\t(?!dsb\tsy\n\tisb|sb)} } } */ -diff --git a/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-mitigation.exp b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-mitigation.exp -new file mode 100644 -index 0000000..8122503 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-mitigation.exp -@@ -0,0 +1,73 @@ -+# Regression driver for SLS mitigation on AArch64. -+# Copyright (C) 2020 Free Software Foundation, Inc. -+# Contributed by ARM Ltd. -+# -+# This file is part of GCC. -+# -+# GCC is free software; you can redistribute it and/or modify it -+# under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3, or (at your option) -+# any later version. -+# -+# GCC is distributed in the hope that it will be useful, but -+# WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with GCC; see the file COPYING3. If not see -+# . */ -+ -+# Exit immediately if this isn't an AArch64 target. -+if {![istarget aarch64*-*-*] } then { -+ return -+} -+ -+# Load support procs. -+load_lib gcc-dg.exp -+load_lib torture-options.exp -+ -+# If a testcase doesn't have special options, use these. -+global DEFAULT_CFLAGS -+if ![info exists DEFAULT_CFLAGS] then { -+ set DEFAULT_CFLAGS " " -+} -+ -+# Initialize `dg'. -+dg-init -+torture-init -+ -+# Use different architectures as well as the normal optimisation options. -+# (i.e. use both SB and DSB+ISB barriers). -+ -+set save-dg-do-what-default ${dg-do-what-default} -+# Main loop. -+# Run with torture tests (i.e. a bunch of different optimisation levels) just -+# to increase test coverage. -+set dg-do-what-default assemble -+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ -+ "-save-temps" $DEFAULT_CFLAGS -+ -+# Run the same tests but this time with SB extension. -+# Since not all supported assemblers will support that extension we decide -+# whether to assemble or just compile based on whether the extension is -+# supported for the available assembler. -+ -+set templist {} -+foreach x $DG_TORTURE_OPTIONS { -+ lappend templist "$x -march=armv8.3-a+sb " -+ lappend templist "$x -march=armv8-a+sb " -+} -+set-torture-options $templist -+if { [check_effective_target_aarch64_asm_sb_ok] } { -+ set dg-do-what-default assemble -+} else { -+ set dg-do-what-default compile -+} -+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ -+ "-save-temps" $DEFAULT_CFLAGS -+set dg-do-what-default ${save-dg-do-what-default} -+ -+# All done. -+torture-finish -+dg-finish -diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp -index 8a186dd..9d2e093 100644 ---- a/gcc/testsuite/lib/target-supports.exp -+++ b/gcc/testsuite/lib/target-supports.exp -@@ -9432,7 +9432,7 @@ proc check_effective_target_aarch64_tiny { } { - # various architecture extensions via the .arch_extension pseudo-op. - - foreach { aarch64_ext } { "fp" "simd" "crypto" "crc" "lse" "dotprod" "sve" -- "i8mm" "f32mm" "f64mm" "bf16" } { -+ "i8mm" "f32mm" "f64mm" "bf16" "sb" } { - eval [string map [list FUNC $aarch64_ext] { - proc check_effective_target_aarch64_asm_FUNC_ok { } { - if { [istarget aarch64*-*-*] } { --- -2.7.4 - diff --git a/recipes-devtools/gcc/gcc-arc/0002-gcc-poison-system-directories.patch b/recipes-devtools/gcc/gcc-arc/0002-gcc-poison-system-directories.patch index 697bdc8..18a9fb8 100644 --- a/recipes-devtools/gcc/gcc-arc/0002-gcc-poison-system-directories.patch +++ b/recipes-devtools/gcc/gcc-arc/0002-gcc-poison-system-directories.patch @@ -1,6 +1,6 @@ -From 74cc21f474402cf3578e37e1d7a1a22bbd070f6a Mon Sep 17 00:00:00 2001 +From 118c6f054711d437167ff125a88c9236bfc8099c Mon Sep 17 00:00:00 2001 From: Khem Raj -Date: Fri, 29 Mar 2013 08:59:00 +0400 +Date: Mon, 8 Mar 2021 16:04:20 -0800 Subject: [PATCH] gcc: poison-system-directories Add /sw/include and /opt/include based on the original @@ -11,11 +11,9 @@ aborted. Instead, we add the two missing items to the current scan. If the user wants this to be a failure, they can add "-Werror=poison-system-directories". +Upstream-Status: Pending Signed-off-by: Mark Hatle Signed-off-by: Khem Raj -Signed-off-by: Wang Mingyu - -Upstream-Status: Pending --- gcc/common.opt | 4 ++++ gcc/config.in | 10 ++++++++++ @@ -27,10 +25,10 @@ Upstream-Status: Pending 7 files changed, 86 insertions(+), 2 deletions(-) diff --git a/gcc/common.opt b/gcc/common.opt -index 3ec7743ea..d3c3e51dc 100644 +index c75dd36843e..49acbd6ed44 100644 --- a/gcc/common.opt +++ b/gcc/common.opt -@@ -682,6 +682,10 @@ Wreturn-local-addr +@@ -683,6 +683,10 @@ Wreturn-local-addr Common Var(warn_return_local_addr) Init(1) Warning Warn about returning a pointer/reference to a local or temporary variable. @@ -42,10 +40,10 @@ index 3ec7743ea..d3c3e51dc 100644 Common Var(warn_shadow) Warning Warn when one variable shadows another. Same as -Wshadow=global. diff --git a/gcc/config.in b/gcc/config.in -index 364eba477..7d2c3bbf1 100644 +index 10a13cde586..8848284da41 100644 --- a/gcc/config.in +++ b/gcc/config.in -@@ -224,6 +224,16 @@ +@@ -218,6 +218,16 @@ #endif @@ -63,18 +61,18 @@ index 364eba477..7d2c3bbf1 100644 optimizer and back end) to be checked for dynamic type safety at runtime. This is quite expensive. */ diff --git a/gcc/configure b/gcc/configure -index 2a9d646b4..a848792f2 100755 +index 9bb436ce7bd..3f0734bff11 100755 --- a/gcc/configure +++ b/gcc/configure -@@ -1010,6 +1010,7 @@ with_system_zlib - enable_maintainer_mode +@@ -1020,6 +1020,7 @@ enable_maintainer_mode enable_link_mutex + enable_link_serialization enable_version_specific_runtime_libs +enable_poison_system_directories enable_plugin enable_host_shared enable_libquadmath_support -@@ -1766,6 +1767,8 @@ Optional Features: +@@ -1782,6 +1783,8 @@ Optional Features: --enable-version-specific-runtime-libs specify that runtime libraries should be installed in a compiler-specific directory @@ -83,7 +81,7 @@ index 2a9d646b4..a848792f2 100755 --enable-plugin enable plugin support --enable-host-shared build host code as shared libraries --disable-libquadmath-support -@@ -30280,6 +30283,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then : +@@ -31325,6 +31328,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then : fi @@ -107,16 +105,16 @@ index 2a9d646b4..a848792f2 100755 diff --git a/gcc/configure.ac b/gcc/configure.ac -index 51cce36ce..66ffde305 100644 +index caa611933df..54e21764b3e 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac -@@ -6614,6 +6614,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs, +@@ -7123,6 +7123,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs, [specify that runtime libraries should be installed in a compiler-specific directory])]) +AC_ARG_ENABLE([poison-system-directories], + AS_HELP_STRING([--enable-poison-system-directories], -+ [warn for use of native system header directories (no/yes/error)]),, ++ [warn for use of native system header directories (no/yes/error)]),, + [enable_poison_system_directories=no]) +AC_MSG_NOTICE([poisoned directories $enable_poison_system_directories]) +if test "x${enable_poison_system_directories}" != "xno"; then @@ -134,10 +132,10 @@ index 51cce36ce..66ffde305 100644 AC_SUBST(subdirs) AC_SUBST(srcdir) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi -index d929eb109..aa5ff88b1 100644 +index 7a368959e5e..6659a903bf0 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi -@@ -351,6 +351,7 @@ Objective-C and Objective-C++ Dialects}. +@@ -369,6 +369,7 @@ Objective-C and Objective-C++ Dialects}. -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol -Wparentheses -Wno-pedantic-ms-format @gol -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol @@ -145,7 +143,7 @@ index d929eb109..aa5ff88b1 100644 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol -Wrestrict -Wno-return-local-addr -Wreturn-type @gol -Wno-scalar-storage-order -Wsequence-point @gol -@@ -6928,6 +6929,14 @@ made up of data only and thus requires no special treatment. But, for +@@ -7735,6 +7736,14 @@ made up of data only and thus requires no special treatment. But, for most targets, it is made up of code and thus requires the stack to be made executable in order for the program to work properly. @@ -161,10 +159,10 @@ index d929eb109..aa5ff88b1 100644 @opindex Wfloat-equal @opindex Wno-float-equal diff --git a/gcc/gcc.c b/gcc/gcc.c -index 49c9c6c17..24a92bf27 100644 +index 7837553958b..19c75b6e20d 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c -@@ -1044,6 +1044,8 @@ proper position among the other output files. */ +@@ -1152,6 +1152,8 @@ proper position among the other output files. */ "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \ "%X %{o*} %{e*} %{N} %{n} %{r}\ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \ @@ -173,7 +171,7 @@ index 49c9c6c17..24a92bf27 100644 %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \ VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \ %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ -@@ -1138,8 +1140,11 @@ static const char *cpp_unique_options = +@@ -1247,8 +1249,11 @@ static const char *cpp_unique_options = static const char *cpp_options = "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\ %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\ @@ -185,10 +183,10 @@ index 49c9c6c17..24a92bf27 100644 +#endif + " %{undef} %{save-temps*:-fpch-preprocess}"; - /* This contains cpp options which are not passed when the preprocessor - output will be used by another program. */ + /* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al. + diff --git a/gcc/incpath.c b/gcc/incpath.c -index 94eaba7b1..bfad4ebe3 100644 +index 446d280321d..fbfc0ce03b8 100644 --- a/gcc/incpath.c +++ b/gcc/incpath.c @@ -26,6 +26,7 @@ @@ -199,7 +197,7 @@ index 94eaba7b1..bfad4ebe3 100644 /* Microsoft Windows does not natively support inodes. VMS has non-numeric inodes. */ -@@ -393,6 +394,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose) +@@ -395,6 +396,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose) } fprintf (stderr, _("End of search list.\n")); } @@ -226,6 +224,3 @@ index 94eaba7b1..bfad4ebe3 100644 } /* Use given -I paths for #include "..." but not #include <...>, and --- -2.25.1 - diff --git a/recipes-devtools/gcc/gcc-arc/0003-CVE-2021-35465.patch b/recipes-devtools/gcc/gcc-arc/0003-CVE-2021-35465.patch new file mode 100644 index 0000000..c7a7c76 --- /dev/null +++ b/recipes-devtools/gcc/gcc-arc/0003-CVE-2021-35465.patch @@ -0,0 +1,103 @@ +From 30461cf8dba3d3adb15a125e4da48800eb2b9b8f Mon Sep 17 00:00:00 2001 +From: Richard Earnshaw +Date: Fri, 18 Jun 2021 17:18:37 +0100 +Subject: [PATCH] arm: fix vlldm erratum for Armv8.1-m [PR102035] + +For Armv8.1-m we generate code that emits VLLDM directly and do not +rely on support code in the library, so emit the mitigation directly +as well, when required. In this case, we can use the compiler options +to determine when to apply the fix and when it is safe to omit it. + +gcc: + PR target/102035 + * config/arm/arm.md (attribute arch): Add fix_vlldm. + (arch_enabled): Use it. + * config/arm/vfp.md (lazy_store_multiple_insn): Add alternative to + use when erratum mitigation is needed. + +CVE: CVE-2021-35465 +Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=30461cf8dba3d3adb15a125e4da48800eb2b9b8f] +Signed-off-by: Pgowda + +--- + gcc/config/arm/arm.md | 11 +++++++++-- + gcc/config/arm/vfp.md | 10 +++++++--- + 2 files changed, 16 insertions(+), 5 deletions(-) + +diff -upr a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md +--- a/gcc/config/arm/arm.md 2020-07-22 23:35:17.344384552 -0700 ++++ b/gcc/config/arm/arm.md 2021-11-11 20:33:58.431543947 -0800 +@@ -132,9 +132,12 @@ + ; TARGET_32BIT, "t1" or "t2" to specify a specific Thumb mode. "v6" + ; for ARM or Thumb-2 with arm_arch6, and nov6 for ARM without + ; arm_arch6. "v6t2" for Thumb-2 with arm_arch6 and "v8mb" for ARMv8-M +-; Baseline. This attribute is used to compute attribute "enabled", ++; Baseline. "fix_vlldm" is for fixing the v8-m/v8.1-m VLLDM erratum. ++; This attribute is used to compute attribute "enabled", + ; use type "any" to enable an alternative in all cases. +-(define_attr "arch" "any,a,t,32,t1,t2,v6,nov6,v6t2,v8mb,iwmmxt,iwmmxt2,armv6_or_vfpv3,neon,mve" ++(define_attr "arch" "any, a, t, 32, t1, t2, v6,nov6, v6t2, \ ++ v8mb, fix_vlldm, iwmmxt, iwmmxt2, armv6_or_vfpv3, \ ++ neon, mve" + (const_string "any")) + + (define_attr "arch_enabled" "no,yes" +@@ -177,6 +180,10 @@ + (match_test "TARGET_THUMB1 && arm_arch8")) + (const_string "yes") + ++ (and (eq_attr "arch" "fix_vlldm") ++ (match_test "fix_vlldm")) ++ (const_string "yes") ++ + (and (eq_attr "arch" "iwmmxt2") + (match_test "TARGET_REALLY_IWMMXT2")) + (const_string "yes") +diff -upr a/gcc/config/arm/vfp.md b/gcc/config/arm/vfp.md +--- a/gcc/config/arm/vfp.md 2020-07-22 23:35:17.356384684 -0700 ++++ b/gcc/config/arm/vfp.md 2021-11-11 20:33:58.431543947 -0800 +@@ -1703,12 +1703,15 @@ + (set_attr "type" "mov_reg")] + ) + ++;; Both this and the next instruction are treated by GCC in the same ++;; way as a blockage pattern. That's perhaps stronger than it needs ++;; to be, but we do not want accesses to the VFP register bank to be ++;; moved across either instruction. ++ + (define_insn "lazy_store_multiple_insn" +- [(set (match_operand:SI 0 "s_register_operand" "+&rk") +- (post_dec:SI (match_dup 0))) +- (unspec_volatile [(const_int 0) +- (mem:SI (post_dec:SI (match_dup 0)))] +- VUNSPEC_VLSTM)] ++ [(unspec_volatile ++ [(mem:BLK (match_operand:SI 0 "s_register_operand" "rk"))] ++ VUNSPEC_VLSTM)] + "use_cmse && reload_completed" + "vlstm%?\\t%0" + [(set_attr "predicable" "yes") +@@ -1716,14 +1719,16 @@ + ) + + (define_insn "lazy_load_multiple_insn" +- [(set (match_operand:SI 0 "s_register_operand" "+&rk") +- (post_inc:SI (match_dup 0))) +- (unspec_volatile:SI [(const_int 0) +- (mem:SI (match_dup 0))] +- VUNSPEC_VLLDM)] ++ [(unspec_volatile ++ [(mem:BLK (match_operand:SI 0 "s_register_operand" "rk,rk"))] ++ VUNSPEC_VLLDM)] + "use_cmse && reload_completed" +- "vlldm%?\\t%0" +- [(set_attr "predicable" "yes") ++ "@ ++ vscclrm\\t{vpr}\;vlldm\\t%0 ++ vlldm\\t%0" ++ [(set_attr "arch" "fix_vlldm,*") ++ (set_attr "predicable" "no") ++ (set_attr "length" "8,4") + (set_attr "type" "load_4")] + ) + diff --git a/recipes-devtools/gcc/gcc-arc/0003-CVE-2021-42574.patch b/recipes-devtools/gcc/gcc-arc/0003-CVE-2021-42574.patch new file mode 100644 index 0000000..2995a6f --- /dev/null +++ b/recipes-devtools/gcc/gcc-arc/0003-CVE-2021-42574.patch @@ -0,0 +1,142 @@ +From 1a7f2c0774129750fdf73e9f1b78f0ce983c9ab3 Mon Sep 17 00:00:00 2001 +From: David Malcolm +Date: Tue, 2 Nov 2021 09:54:32 -0400 +Subject: [PATCH] libcpp: escape non-ASCII source bytes in -Wbidi-chars= + [PR103026] +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf8 +Content-Transfer-Encoding: 8bit + +This flags rich_locations associated with -Wbidi-chars= so that +non-ASCII bytes will be escaped when printing the source lines +(using the diagnostics support I added in +r12-4825-gbd5e882cf6e0def3dd1bc106075d59a303fe0d1e). + +In particular, this ensures that the printed source lines will +be pure ASCII, and thus the visual ordering of the characters +will be the same as the logical ordering. + +Before: + + Wbidi-chars-1.c: In function âmainâ: + Wbidi-chars-1.c:6:43: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=] + 6 | /*â® } â¦if (isAdmin)⩠⦠begin admins only */ + | ^ + Wbidi-chars-1.c:9:28: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=] + 9 | /* end admins only â® { â¦*/ + | ^ + + Wbidi-chars-11.c:6:15: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=] + 6 | int LRE_âª_PDF_\u202c; + | ^ + Wbidi-chars-11.c:8:19: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=] + 8 | int LRE_\u202a_PDF_â¬_; + | ^ + Wbidi-chars-11.c:10:28: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=] + 10 | const char *s1 = "LRE_âª_PDF_\u202c"; + | ^ + Wbidi-chars-11.c:12:33: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=] + 12 | const char *s2 = "LRE_\u202a_PDF_â¬"; + | ^ + +After: + + Wbidi-chars-1.c: In function âmainâ: + Wbidi-chars-1.c:6:43: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=] + 6 | /* } if (isAdmin) begin admins only */ + | ^ + Wbidi-chars-1.c:9:28: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=] + 9 | /* end admins only { */ + | ^ + + Wbidi-chars-11.c:6:15: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=] + 6 | int LRE__PDF_\u202c; + | ^ + Wbidi-chars-11.c:8:19: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=] + 8 | int LRE_\u202a_PDF__; + | ^ + Wbidi-chars-11.c:10:28: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=] + 10 | const char *s1 = "LRE__PDF_\u202c"; + | ^ + Wbidi-chars-11.c:12:33: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=] + 12 | const char *s2 = "LRE_\u202a_PDF_"; + | ^ + +libcpp/ChangeLog: + PR preprocessor/103026 + * lex.c (maybe_warn_bidi_on_close): Use a rich_location + and call set_escape_on_output (true) on it. + (maybe_warn_bidi_on_char): Likewise. + +Signed-off-by: David Malcolm + +CVE: CVE-2021-42574 +Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=1a7f2c0774129750fdf73e9f1b78f0ce983c9ab3] +Signed-off-by: Pgowda + +--- + libcpp/lex.c | 29 +++++++++++++++++------------ + 1 file changed, 17 insertions(+), 12 deletions(-) + +diff --git a/libcpp/lex.c b/libcpp/lex.c +index 8188e33b07d..2421d6c0f40 100644 +--- a/libcpp/lex.c ++++ b/libcpp/lex.c +@@ -1427,9 +1427,11 @@ maybe_warn_bidi_on_close (cpp_reader *pfile, const uchar *p) + const location_t loc + = linemap_position_for_column (pfile->line_table, + CPP_BUF_COLUMN (pfile->buffer, p)); +- cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0, +- "unpaired UTF-8 bidirectional control character " +- "detected"); ++ rich_location rich_loc (pfile->line_table, loc); ++ rich_loc.set_escape_on_output (true); ++ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc, ++ "unpaired UTF-8 bidirectional control character " ++ "detected"); + } + /* We're done with this context. */ + bidi::on_close (); +@@ -1454,6 +1456,9 @@ maybe_warn_bidi_on_char (cpp_reader *pfile, const uchar *p, bidi::kind kind, + const location_t loc + = linemap_position_for_column (pfile->line_table, + CPP_BUF_COLUMN (pfile->buffer, p)); ++ rich_location rich_loc (pfile->line_table, loc); ++ rich_loc.set_escape_on_output (true); ++ + /* It seems excessive to warn about a PDI/PDF that is closing + an opened context because we've already warned about the + opening character. Except warn when we have a UCN x UTF-8 +@@ -1462,20 +1467,20 @@ maybe_warn_bidi_on_char (cpp_reader *pfile, const uchar *p, bidi::kind kind, + { + if (warn_bidi == bidirectional_unpaired + && bidi::current_ctx_ucn_p () != ucn_p) +- cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0, +- "UTF-8 vs UCN mismatch when closing " +- "a context by \"%s\"", bidi::to_str (kind)); ++ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc, ++ "UTF-8 vs UCN mismatch when closing " ++ "a context by \"%s\"", bidi::to_str (kind)); + } + else if (warn_bidi == bidirectional_any) + { + if (kind == bidi::kind::PDF || kind == bidi::kind::PDI) +- cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0, +- "\"%s\" is closing an unopened context", +- bidi::to_str (kind)); ++ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc, ++ "\"%s\" is closing an unopened context", ++ bidi::to_str (kind)); + else +- cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0, +- "found problematic Unicode character \"%s\"", +- bidi::to_str (kind)); ++ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc, ++ "found problematic Unicode character \"%s\"", ++ bidi::to_str (kind)); + } + } + /* We're done with this context. */ +-- +2.27.0 + diff --git a/recipes-devtools/gcc/gcc-arc/0003-aarch64-Mitigate-SLS-for-BLR-instruction.patch b/recipes-devtools/gcc/gcc-arc/0003-aarch64-Mitigate-SLS-for-BLR-instruction.patch deleted file mode 100644 index 716a367..0000000 --- a/recipes-devtools/gcc/gcc-arc/0003-aarch64-Mitigate-SLS-for-BLR-instruction.patch +++ /dev/null @@ -1,658 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From a5e7efc40ed841934c1d913f39476afa17d8e5f7 Mon Sep 17 00:00:00 2001 -From: Matthew Malcomson -Date: Thu, 9 Jul 2020 09:11:59 +0100 -Subject: [PATCH 3/3] aarch64: Mitigate SLS for BLR instruction - -This patch introduces the mitigation for Straight Line Speculation past -the BLR instruction. - -This mitigation replaces BLR instructions with a BL to a stub which uses -a BR to jump to the original value. These function stubs are then -appended with a speculation barrier to ensure no straight line -speculation happens after these jumps. - -When optimising for speed we use a set of stubs for each function since -this should help the branch predictor make more accurate predictions -about where a stub should branch. - -When optimising for size we use one set of stubs for all functions. -This set of stubs can have human readable names, and we are using -`__call_indirect_x` for register x. - -When BTI branch protection is enabled the BLR instruction can jump to a -`BTI c` instruction using any register, while the BR instruction can -only jump to a `BTI c` instruction using the x16 or x17 registers. -Hence, in order to ensure this transformation is safe we mov the value -of the original register into x16 and use x16 for the BR. - -As an example when optimising for size: -a - BLR x0 -instruction would get transformed to something like - BL __call_indirect_x0 -where __call_indirect_x0 labels a thunk that contains -__call_indirect_x0: - MOV X16, X0 - BR X16 - - -The first version of this patch used local symbols specific to a -compilation unit to try and avoid relocations. -This was mistaken since functions coming from the same compilation unit -can still be in different sections, and the assembler will insert -relocations at jumps between sections. - -On any relocation the linker is permitted to emit a veneer to handle -jumps between symbols that are very far apart. The registers x16 and -x17 may be clobbered by these veneers. -Hence the function stubs cannot rely on the values of x16 and x17 being -the same as just before the function stub is called. - -Similar can be said for the hot/cold partitioning of single functions, -so function-local stubs have the same restriction. - -This updated version of the patch never emits function stubs for x16 and -x17, and instead forces other registers to be used. - -Given the above, there is now no benefit to local symbols (since they -are not enough to avoid dealing with linker intricacies). This patch -now uses global symbols with hidden visibility each stored in their own -COMDAT section. This means stubs can be shared between compilation -units while still avoiding the PLT indirection. - -This patch also removes the `__call_indirect_x30` stub (and -function-local equivalent) which would simply jump back to the original -location. - -The function-local stubs are emitted to the assembly output file in one -chunk, which means we need not add the speculation barrier directly -after each one. -This is because we know for certain that the instructions directly after -the BR in all but the last function stub will be from another one of -these stubs and hence will not contain a speculation gadget. -Instead we add a speculation barrier at the end of the sequence of -stubs. - -The global stubs are emitted in COMDAT/.linkonce sections by -themselves so that the linker can remove duplicates from multiple object -files. This means they are not emitted in one chunk, and each one must -include the speculation barrier. - -Another difference is that since the global stubs are shared across -compilation units we do not know that all functions will be targeting an -architecture supporting the SB instruction. -Rather than provide multiple stubs for each architecture, we provide a -stub that will work for all architectures -- using the DSB+ISB barrier. - -This mitigation does not apply for BLR instructions in the following -places: -- Some accesses to thread-local variables use a code sequence with a BLR - instruction. This code sequence is part of the binary interface between - compiler and linker. If this BLR instruction needs to be mitigated, it'd - probably be best to do so in the linker. It seems that the code sequence - for thread-local variable access is unlikely to lead to a Spectre Revalation - Gadget. -- PLT stubs are produced by the linker and each contain a BLR instruction. - It seems that at most only after the last PLT stub a Spectre Revalation - Gadget might appear. - -Testing: - Bootstrap and regtest on AArch64 - (with BOOT_CFLAGS="-mharden-sls=retbr,blr") - Used a temporary hack(1) in gcc-dg.exp to use these options on every - test in the testsuite, a slight modification to emit the speculation - barrier after every function stub, and a script to check that the - output never emitted a BLR, or unmitigated BR or RET instruction. - Similar on an aarch64-none-elf cross-compiler. - -1) Temporary hack emitted a speculation barrier at the end of every stub -function, and used a script to ensure that: - a) Every RET or BR is immediately followed by a speculation barrier. - b) No BLR instruction is emitted by compiler. - -gcc/ChangeLog: - - * config/aarch64/aarch64-protos.h (aarch64_indirect_call_asm): - New declaration. - * config/aarch64/aarch64.c (aarch64_regno_regclass): Handle new - stub registers class. - (aarch64_class_max_nregs): Likewise. - (aarch64_register_move_cost): Likewise. - (aarch64_sls_shared_thunks): Global array to store stub labels. - (aarch64_sls_emit_function_stub): New. - (aarch64_create_blr_label): New. - (aarch64_sls_emit_blr_function_thunks): New. - (aarch64_sls_emit_shared_blr_thunks): New. - (aarch64_asm_file_end): New. - (aarch64_indirect_call_asm): New. - (TARGET_ASM_FILE_END): Use aarch64_asm_file_end. - (TARGET_ASM_FUNCTION_EPILOGUE): Use - aarch64_sls_emit_blr_function_thunks. - * config/aarch64/aarch64.h (STB_REGNUM_P): New. - (enum reg_class): Add STUB_REGS class. - (machine_function): Introduce `call_via` array for - function-local stub labels. - * config/aarch64/aarch64.md (*call_insn, *call_value_insn): Use - aarch64_indirect_call_asm to emit code when hardening BLR - instructions. - * config/aarch64/constraints.md (Ucr): New constraint - representing registers for indirect calls. Is GENERAL_REGS - usually, and STUB_REGS when hardening BLR instruction against - SLS. - * config/aarch64/predicates.md (aarch64_general_reg): STUB_REGS class - is also a general register. - -gcc/testsuite/ChangeLog: - - * gcc.target/aarch64/sls-mitigation/sls-miti-blr-bti.c: New test. - * gcc.target/aarch64/sls-mitigation/sls-miti-blr.c: New test. ---- - gcc/config/aarch64/aarch64-protos.h | 1 + - gcc/config/aarch64/aarch64.c | 225 ++++++++++++++++++++- - gcc/config/aarch64/aarch64.h | 15 ++ - gcc/config/aarch64/aarch64.md | 11 +- - gcc/config/aarch64/constraints.md | 9 + - gcc/config/aarch64/predicates.md | 3 +- - .../aarch64/sls-mitigation/sls-miti-blr-bti.c | 40 ++++ - .../aarch64/sls-mitigation/sls-miti-blr.c | 33 +++ - 8 files changed, 328 insertions(+), 9 deletions(-) - create mode 100644 gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-blr-bti.c - create mode 100644 gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-blr.c - -diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h -index ee0ffde..839f801 100644 ---- a/gcc/config/aarch64/aarch64-protos.h -+++ b/gcc/config/aarch64/aarch64-protos.h -@@ -782,6 +782,7 @@ extern const atomic_ool_names aarch64_ool_ldeor_names; - tree aarch64_resolve_overloaded_builtin_general (location_t, tree, void *); - - const char *aarch64_sls_barrier (int); -+const char *aarch64_indirect_call_asm (rtx); - extern bool aarch64_harden_sls_retbr_p (void); - extern bool aarch64_harden_sls_blr_p (void); - -diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c -index 2389d49..0f7bba3 100644 ---- a/gcc/config/aarch64/aarch64.c -+++ b/gcc/config/aarch64/aarch64.c -@@ -10605,6 +10605,9 @@ aarch64_label_mentioned_p (rtx x) - enum reg_class - aarch64_regno_regclass (unsigned regno) - { -+ if (STUB_REGNUM_P (regno)) -+ return STUB_REGS; -+ - if (GP_REGNUM_P (regno)) - return GENERAL_REGS; - -@@ -10939,6 +10942,7 @@ aarch64_class_max_nregs (reg_class_t regclass, machine_mode mode) - unsigned int nregs, vec_flags; - switch (regclass) - { -+ case STUB_REGS: - case TAILCALL_ADDR_REGS: - case POINTER_REGS: - case GENERAL_REGS: -@@ -13155,10 +13159,12 @@ aarch64_register_move_cost (machine_mode mode, - = aarch64_tune_params.regmove_cost; - - /* Caller save and pointer regs are equivalent to GENERAL_REGS. */ -- if (to == TAILCALL_ADDR_REGS || to == POINTER_REGS) -+ if (to == TAILCALL_ADDR_REGS || to == POINTER_REGS -+ || to == STUB_REGS) - to = GENERAL_REGS; - -- if (from == TAILCALL_ADDR_REGS || from == POINTER_REGS) -+ if (from == TAILCALL_ADDR_REGS || from == POINTER_REGS -+ || from == STUB_REGS) - from = GENERAL_REGS; - - /* Make RDFFR very expensive. In particular, if we know that the FFR -@@ -22957,6 +22963,215 @@ aarch64_sls_barrier (int mitigation_required) - : ""; - } - -+static GTY (()) tree aarch64_sls_shared_thunks[30]; -+static GTY (()) bool aarch64_sls_shared_thunks_needed = false; -+const char *indirect_symbol_names[30] = { -+ "__call_indirect_x0", -+ "__call_indirect_x1", -+ "__call_indirect_x2", -+ "__call_indirect_x3", -+ "__call_indirect_x4", -+ "__call_indirect_x5", -+ "__call_indirect_x6", -+ "__call_indirect_x7", -+ "__call_indirect_x8", -+ "__call_indirect_x9", -+ "__call_indirect_x10", -+ "__call_indirect_x11", -+ "__call_indirect_x12", -+ "__call_indirect_x13", -+ "__call_indirect_x14", -+ "__call_indirect_x15", -+ "", /* "__call_indirect_x16", */ -+ "", /* "__call_indirect_x17", */ -+ "__call_indirect_x18", -+ "__call_indirect_x19", -+ "__call_indirect_x20", -+ "__call_indirect_x21", -+ "__call_indirect_x22", -+ "__call_indirect_x23", -+ "__call_indirect_x24", -+ "__call_indirect_x25", -+ "__call_indirect_x26", -+ "__call_indirect_x27", -+ "__call_indirect_x28", -+ "__call_indirect_x29", -+}; -+ -+/* Function to create a BLR thunk. This thunk is used to mitigate straight -+ line speculation. Instead of a simple BLR that can be speculated past, -+ we emit a BL to this thunk, and this thunk contains a BR to the relevant -+ register. These thunks have the relevant speculation barries put after -+ their indirect branch so that speculation is blocked. -+ -+ We use such a thunk so the speculation barriers are kept off the -+ architecturally executed path in order to reduce the performance overhead. -+ -+ When optimizing for size we use stubs shared by the linked object. -+ When optimizing for performance we emit stubs for each function in the hope -+ that the branch predictor can better train on jumps specific for a given -+ function. */ -+rtx -+aarch64_sls_create_blr_label (int regnum) -+{ -+ gcc_assert (STUB_REGNUM_P (regnum)); -+ if (optimize_function_for_size_p (cfun)) -+ { -+ /* For the thunks shared between different functions in this compilation -+ unit we use a named symbol -- this is just for users to more easily -+ understand the generated assembly. */ -+ aarch64_sls_shared_thunks_needed = true; -+ const char *thunk_name = indirect_symbol_names[regnum]; -+ if (aarch64_sls_shared_thunks[regnum] == NULL) -+ { -+ /* Build a decl representing this function stub and record it for -+ later. We build a decl here so we can use the GCC machinery for -+ handling sections automatically (through `get_named_section` and -+ `make_decl_one_only`). That saves us a lot of trouble handling -+ the specifics of different output file formats. */ -+ tree decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL, -+ get_identifier (thunk_name), -+ build_function_type_list (void_type_node, -+ NULL_TREE)); -+ DECL_RESULT (decl) = build_decl (BUILTINS_LOCATION, RESULT_DECL, -+ NULL_TREE, void_type_node); -+ TREE_PUBLIC (decl) = 1; -+ TREE_STATIC (decl) = 1; -+ DECL_IGNORED_P (decl) = 1; -+ DECL_ARTIFICIAL (decl) = 1; -+ make_decl_one_only (decl, DECL_ASSEMBLER_NAME (decl)); -+ resolve_unique_section (decl, 0, false); -+ aarch64_sls_shared_thunks[regnum] = decl; -+ } -+ -+ return gen_rtx_SYMBOL_REF (Pmode, thunk_name); -+ } -+ -+ if (cfun->machine->call_via[regnum] == NULL) -+ cfun->machine->call_via[regnum] -+ = gen_rtx_LABEL_REF (Pmode, gen_label_rtx ()); -+ return cfun->machine->call_via[regnum]; -+} -+ -+/* Helper function for aarch64_sls_emit_blr_function_thunks and -+ aarch64_sls_emit_shared_blr_thunks below. */ -+static void -+aarch64_sls_emit_function_stub (FILE *out_file, int regnum) -+{ -+ /* Save in x16 and branch to that function so this transformation does -+ not prevent jumping to `BTI c` instructions. */ -+ asm_fprintf (out_file, "\tmov\tx16, x%d\n", regnum); -+ asm_fprintf (out_file, "\tbr\tx16\n"); -+} -+ -+/* Emit all BLR stubs for this particular function. -+ Here we emit all the BLR stubs needed for the current function. Since we -+ emit these stubs in a consecutive block we know there will be no speculation -+ gadgets between each stub, and hence we only emit a speculation barrier at -+ the end of the stub sequences. -+ -+ This is called in the TARGET_ASM_FUNCTION_EPILOGUE hook. */ -+void -+aarch64_sls_emit_blr_function_thunks (FILE *out_file) -+{ -+ if (! aarch64_harden_sls_blr_p ()) -+ return; -+ -+ bool any_functions_emitted = false; -+ /* We must save and restore the current function section since this assembly -+ is emitted at the end of the function. This means it can be emitted *just -+ after* the cold section of a function. That cold part would be emitted in -+ a different section. That switch would trigger a `.cfi_endproc` directive -+ to be emitted in the original section and a `.cfi_startproc` directive to -+ be emitted in the new section. Switching to the original section without -+ restoring would mean that the `.cfi_endproc` emitted as a function ends -+ would happen in a different section -- leaving an unmatched -+ `.cfi_startproc` in the cold text section and an unmatched `.cfi_endproc` -+ in the standard text section. */ -+ section *save_text_section = in_section; -+ switch_to_section (function_section (current_function_decl)); -+ for (int regnum = 0; regnum < 30; ++regnum) -+ { -+ rtx specu_label = cfun->machine->call_via[regnum]; -+ if (specu_label == NULL) -+ continue; -+ -+ targetm.asm_out.print_operand (out_file, specu_label, 0); -+ asm_fprintf (out_file, ":\n"); -+ aarch64_sls_emit_function_stub (out_file, regnum); -+ any_functions_emitted = true; -+ } -+ if (any_functions_emitted) -+ /* Can use the SB if needs be here, since this stub will only be used -+ by the current function, and hence for the current target. */ -+ asm_fprintf (out_file, "\t%s\n", aarch64_sls_barrier (true)); -+ switch_to_section (save_text_section); -+} -+ -+/* Emit shared BLR stubs for the current compilation unit. -+ Over the course of compiling this unit we may have converted some BLR -+ instructions to a BL to a shared stub function. This is where we emit those -+ stub functions. -+ This function is for the stubs shared between different functions in this -+ compilation unit. We share when optimizing for size instead of speed. -+ -+ This function is called through the TARGET_ASM_FILE_END hook. */ -+void -+aarch64_sls_emit_shared_blr_thunks (FILE *out_file) -+{ -+ if (! aarch64_sls_shared_thunks_needed) -+ return; -+ -+ for (int regnum = 0; regnum < 30; ++regnum) -+ { -+ tree decl = aarch64_sls_shared_thunks[regnum]; -+ if (!decl) -+ continue; -+ -+ const char *name = indirect_symbol_names[regnum]; -+ switch_to_section (get_named_section (decl, NULL, 0)); -+ ASM_OUTPUT_ALIGN (out_file, 2); -+ targetm.asm_out.globalize_label (out_file, name); -+ /* Only emits if the compiler is configured for an assembler that can -+ handle visibility directives. */ -+ targetm.asm_out.assemble_visibility (decl, VISIBILITY_HIDDEN); -+ ASM_OUTPUT_TYPE_DIRECTIVE (out_file, name, "function"); -+ ASM_OUTPUT_LABEL (out_file, name); -+ aarch64_sls_emit_function_stub (out_file, regnum); -+ /* Use the most conservative target to ensure it can always be used by any -+ function in the translation unit. */ -+ asm_fprintf (out_file, "\tdsb\tsy\n\tisb\n"); -+ ASM_DECLARE_FUNCTION_SIZE (out_file, name, decl); -+ } -+} -+ -+/* Implement TARGET_ASM_FILE_END. */ -+void -+aarch64_asm_file_end () -+{ -+ aarch64_sls_emit_shared_blr_thunks (asm_out_file); -+ /* Since this function will be called for the ASM_FILE_END hook, we ensure -+ that what would be called otherwise (e.g. `file_end_indicate_exec_stack` -+ for FreeBSD) still gets called. */ -+#ifdef TARGET_ASM_FILE_END -+ TARGET_ASM_FILE_END (); -+#endif -+} -+ -+const char * -+aarch64_indirect_call_asm (rtx addr) -+{ -+ gcc_assert (REG_P (addr)); -+ if (aarch64_harden_sls_blr_p ()) -+ { -+ rtx stub_label = aarch64_sls_create_blr_label (REGNO (addr)); -+ output_asm_insn ("bl\t%0", &stub_label); -+ } -+ else -+ output_asm_insn ("blr\t%0", &addr); -+ return ""; -+} -+ - /* Target-specific selftests. */ - - #if CHECKING_P -@@ -23507,6 +23722,12 @@ aarch64_libgcc_floating_mode_supported_p - #undef TARGET_MD_ASM_ADJUST - #define TARGET_MD_ASM_ADJUST arm_md_asm_adjust - -+#undef TARGET_ASM_FILE_END -+#define TARGET_ASM_FILE_END aarch64_asm_file_end -+ -+#undef TARGET_ASM_FUNCTION_EPILOGUE -+#define TARGET_ASM_FUNCTION_EPILOGUE aarch64_sls_emit_blr_function_thunks -+ - struct gcc_target targetm = TARGET_INITIALIZER; - - #include "gt-aarch64.h" -diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h -index 8e0fc37..7331450 100644 ---- a/gcc/config/aarch64/aarch64.h -+++ b/gcc/config/aarch64/aarch64.h -@@ -643,6 +643,16 @@ extern unsigned aarch64_architecture_version; - #define GP_REGNUM_P(REGNO) \ - (((unsigned) (REGNO - R0_REGNUM)) <= (R30_REGNUM - R0_REGNUM)) - -+/* Registers known to be preserved over a BL instruction. This consists of the -+ GENERAL_REGS without x16, x17, and x30. The x30 register is changed by the -+ BL instruction itself, while the x16 and x17 registers may be used by -+ veneers which can be inserted by the linker. */ -+#define STUB_REGNUM_P(REGNO) \ -+ (GP_REGNUM_P (REGNO) \ -+ && (REGNO) != R16_REGNUM \ -+ && (REGNO) != R17_REGNUM \ -+ && (REGNO) != R30_REGNUM) \ -+ - #define FP_REGNUM_P(REGNO) \ - (((unsigned) (REGNO - V0_REGNUM)) <= (V31_REGNUM - V0_REGNUM)) - -@@ -667,6 +677,7 @@ enum reg_class - { - NO_REGS, - TAILCALL_ADDR_REGS, -+ STUB_REGS, - GENERAL_REGS, - STACK_REG, - POINTER_REGS, -@@ -689,6 +700,7 @@ enum reg_class - { \ - "NO_REGS", \ - "TAILCALL_ADDR_REGS", \ -+ "STUB_REGS", \ - "GENERAL_REGS", \ - "STACK_REG", \ - "POINTER_REGS", \ -@@ -708,6 +720,7 @@ enum reg_class - { \ - { 0x00000000, 0x00000000, 0x00000000 }, /* NO_REGS */ \ - { 0x00030000, 0x00000000, 0x00000000 }, /* TAILCALL_ADDR_REGS */\ -+ { 0x3ffcffff, 0x00000000, 0x00000000 }, /* STUB_REGS */ \ - { 0x7fffffff, 0x00000000, 0x00000003 }, /* GENERAL_REGS */ \ - { 0x80000000, 0x00000000, 0x00000000 }, /* STACK_REG */ \ - { 0xffffffff, 0x00000000, 0x00000003 }, /* POINTER_REGS */ \ -@@ -862,6 +875,8 @@ typedef struct GTY (()) machine_function - struct aarch64_frame frame; - /* One entry for each hard register. */ - bool reg_is_wrapped_separately[LAST_SAVED_REGNUM]; -+ /* One entry for each general purpose register. */ -+ rtx call_via[SP_REGNUM]; - bool label_is_assembled; - } machine_function; - #endif -diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md -index dda04ee..43da754 100644 ---- a/gcc/config/aarch64/aarch64.md -+++ b/gcc/config/aarch64/aarch64.md -@@ -1022,16 +1022,15 @@ - ) - - (define_insn "*call_insn" -- [(call (mem:DI (match_operand:DI 0 "aarch64_call_insn_operand" "r, Usf")) -+ [(call (mem:DI (match_operand:DI 0 "aarch64_call_insn_operand" "Ucr, Usf")) - (match_operand 1 "" "")) - (unspec:DI [(match_operand:DI 2 "const_int_operand")] UNSPEC_CALLEE_ABI) - (clobber (reg:DI LR_REGNUM))] - "" - "@ -- blr\\t%0 -+ * return aarch64_indirect_call_asm (operands[0]); - bl\\t%c0" -- [(set_attr "type" "call, call")] --) -+ [(set_attr "type" "call, call")]) - - (define_expand "call_value" - [(parallel -@@ -1050,13 +1049,13 @@ - - (define_insn "*call_value_insn" - [(set (match_operand 0 "" "") -- (call (mem:DI (match_operand:DI 1 "aarch64_call_insn_operand" "r, Usf")) -+ (call (mem:DI (match_operand:DI 1 "aarch64_call_insn_operand" "Ucr, Usf")) - (match_operand 2 "" ""))) - (unspec:DI [(match_operand:DI 3 "const_int_operand")] UNSPEC_CALLEE_ABI) - (clobber (reg:DI LR_REGNUM))] - "" - "@ -- blr\\t%1 -+ * return aarch64_indirect_call_asm (operands[1]); - bl\\t%c1" - [(set_attr "type" "call, call")] - ) -diff --git a/gcc/config/aarch64/constraints.md b/gcc/config/aarch64/constraints.md -index d993268..8cc6f50 100644 ---- a/gcc/config/aarch64/constraints.md -+++ b/gcc/config/aarch64/constraints.md -@@ -24,6 +24,15 @@ - (define_register_constraint "Ucs" "TAILCALL_ADDR_REGS" - "@internal Registers suitable for an indirect tail call") - -+(define_register_constraint "Ucr" -+ "aarch64_harden_sls_blr_p () ? STUB_REGS : GENERAL_REGS" -+ "@internal Registers to be used for an indirect call. -+ This is usually the general registers, but when we are hardening against -+ Straight Line Speculation we disallow x16, x17, and x30 so we can use -+ indirection stubs. These indirection stubs cannot use the above registers -+ since they will be reached by a BL that may have to go through a linker -+ veneer.") -+ - (define_register_constraint "w" "FP_REGS" - "Floating point and SIMD vector registers.") - -diff --git a/gcc/config/aarch64/predicates.md b/gcc/config/aarch64/predicates.md -index 215fcec..1754b1e 100644 ---- a/gcc/config/aarch64/predicates.md -+++ b/gcc/config/aarch64/predicates.md -@@ -32,7 +32,8 @@ - - (define_predicate "aarch64_general_reg" - (and (match_operand 0 "register_operand") -- (match_test "REGNO_REG_CLASS (REGNO (op)) == GENERAL_REGS"))) -+ (match_test "REGNO_REG_CLASS (REGNO (op)) == STUB_REGS -+ || REGNO_REG_CLASS (REGNO (op)) == GENERAL_REGS"))) - - ;; Return true if OP a (const_int 0) operand. - (define_predicate "const0_operand" -diff --git a/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-blr-bti.c b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-blr-bti.c -new file mode 100644 -index 0000000..b1fb754 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-blr-bti.c -@@ -0,0 +1,40 @@ -+/* { dg-do compile } */ -+/* { dg-additional-options "-mharden-sls=blr -mbranch-protection=bti" } */ -+/* -+ Ensure that the SLS hardening of BLR leaves no BLR instructions. -+ Here we also check that there are no BR instructions with anything except an -+ x16 or x17 register. This is because a `BTI c` instruction can be branched -+ to using a BLR instruction using any register, but can only be branched to -+ with a BR using an x16 or x17 register. -+ */ -+typedef int (foo) (int, int); -+typedef void (bar) (int, int); -+struct sls_testclass { -+ foo *x; -+ bar *y; -+ int left; -+ int right; -+}; -+ -+/* We test both RTL patterns for a call which returns a value and a call which -+ does not. */ -+int blr_call_value (struct sls_testclass x) -+{ -+ int retval = x.x(x.left, x.right); -+ if (retval % 10) -+ return 100; -+ return 9; -+} -+ -+int blr_call (struct sls_testclass x) -+{ -+ x.y(x.left, x.right); -+ if (x.left % 10) -+ return 100; -+ return 9; -+} -+ -+/* { dg-final { scan-assembler-not {\tblr\t} } } */ -+/* { dg-final { scan-assembler-not {\tbr\tx(?!16|17)} } } */ -+/* { dg-final { scan-assembler {\tbr\tx(16|17)} } } */ -+ -diff --git a/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-blr.c b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-blr.c -new file mode 100644 -index 0000000..88bafff ---- /dev/null -+++ b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-blr.c -@@ -0,0 +1,33 @@ -+/* { dg-additional-options "-mharden-sls=blr -save-temps" } */ -+/* Ensure that the SLS hardening of BLR leaves no BLR instructions. -+ We only test that all BLR instructions have been removed, not that the -+ resulting code makes sense. */ -+typedef int (foo) (int, int); -+typedef void (bar) (int, int); -+struct sls_testclass { -+ foo *x; -+ bar *y; -+ int left; -+ int right; -+}; -+ -+/* We test both RTL patterns for a call which returns a value and a call which -+ does not. */ -+int blr_call_value (struct sls_testclass x) -+{ -+ int retval = x.x(x.left, x.right); -+ if (retval % 10) -+ return 100; -+ return 9; -+} -+ -+int blr_call (struct sls_testclass x) -+{ -+ x.y(x.left, x.right); -+ if (x.left % 10) -+ return 100; -+ return 9; -+} -+ -+/* { dg-final { scan-assembler-not {\tblr\t} } } */ -+/* { dg-final { scan-assembler {\tbr\tx[0-9][0-9]?} } } */ --- -2.7.4 - diff --git a/recipes-devtools/gcc/gcc-arc/0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch b/recipes-devtools/gcc/gcc-arc/0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch deleted file mode 100644 index 27237fe..0000000 --- a/recipes-devtools/gcc/gcc-arc/0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 6e3395c0bc933bdc3242d1dead4896d0aa4e11a8 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 29 Mar 2013 09:08:31 +0400 -Subject: [PATCH] gcc-4.3.3: SYSROOT_CFLAGS_FOR_TARGET - -Before committing, I noticed that PR/32161 was marked as a dup of PR/32009, but my previous patch did not fix it. - -This 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. - -Other changes I had to do include: - -- 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. - -- passing the right CFLAGS to configure scripts as exported environment variables - -I 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. - -Bootstrapped/regtested i686-pc-linux-gnu, will commit to 4.4 shortly. Ok for 4.3? - -Signed-off-by: Paolo Bonzini -Signed-off-by: Khem Raj - -Upstream-Status: Pending ---- - configure | 32 ++++++++++++++++++++++++++++++++ - 1 file changed, 32 insertions(+) - -diff --git a/configure b/configure -index 226a64939d1..b31dc137fc9 100755 ---- a/configure -+++ b/configure -@@ -6971,6 +6971,38 @@ fi - - - -+# During gcc bootstrap, if we use some random cc for stage1 then CFLAGS -+# might be empty or "-g". We don't require a C++ compiler, so CXXFLAGS -+# might also be empty (or "-g", if a non-GCC C++ compiler is in the path). -+# We want to ensure that TARGET libraries (which we know are built with -+# gcc) are built with "-O2 -g", so include those options when setting -+# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET. -+if test "x$CFLAGS_FOR_TARGET" = x; then -+ CFLAGS_FOR_TARGET=$CFLAGS -+ case " $CFLAGS " in -+ *" -O2 "*) ;; -+ *) CFLAGS_FOR_TARGET="-O2 $CFLAGS" ;; -+ esac -+ case " $CFLAGS " in -+ *" -g "* | *" -g3 "*) ;; -+ *) CFLAGS_FOR_TARGET="-g $CFLAGS" ;; -+ esac -+fi -+ -+ -+if test "x$CXXFLAGS_FOR_TARGET" = x; then -+ CXXFLAGS_FOR_TARGET=$CXXFLAGS -+ case " $CXXFLAGS " in -+ *" -O2 "*) ;; -+ *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS" ;; -+ esac -+ case " $CXXFLAGS " in -+ *" -g "* | *" -g3 "*) ;; -+ *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS" ;; -+ esac -+fi -+ -+ - # Handle --with-headers=XXX. If the value is not "yes", the contents of - # the named directory are copied to $(tooldir)/sys-include. - if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then diff --git a/recipes-devtools/gcc/gcc-arc/0004-64-bit-multilib-hack.patch b/recipes-devtools/gcc/gcc-arc/0004-64-bit-multilib-hack.patch index d6b8c71..5f14dd2 100644 --- a/recipes-devtools/gcc/gcc-arc/0004-64-bit-multilib-hack.patch +++ b/recipes-devtools/gcc/gcc-arc/0004-64-bit-multilib-hack.patch @@ -23,7 +23,7 @@ Do same for riscv64, aarch64 & arc RP 15/8/11 -Upstream-Status: Inappropriate[OE-Specific] +Upstream-Status: Inappropriate [OE-Specific] Signed-off-by: Khem Raj Signed-off-by: Elvis Dowson @@ -38,7 +38,7 @@ Signed-off-by: Mark Hatle 6 files changed, 17 insertions(+), 22 deletions(-) diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux -index 83e59e33b85..b1356be1fb4 100644 +index 241b0ef20b6..a7dadb2d64f 100644 --- a/gcc/config/aarch64/t-aarch64-linux +++ b/gcc/config/aarch64/t-aarch64-linux @@ -21,8 +21,8 @@ @@ -71,7 +71,7 @@ index fc3fff640a2..d58e28f6df8 100644 # Aliases: MULTILIB_MATCHES += mcpu?arc700=mA7 diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64 -index 1171e218578..5e057b7e5db 100644 +index d288b093522..7b5980a9d21 100644 --- a/gcc/config/i386/t-linux64 +++ b/gcc/config/i386/t-linux64 @@ -32,7 +32,5 @@ @@ -85,7 +85,7 @@ index 1171e218578..5e057b7e5db 100644 +MULTILIB_DIRNAMES = . . +MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64 -index ceb58d3b5f3..43fe2bf28ab 100644 +index 130e1f04707..3b7eb6b2a2f 100644 --- a/gcc/config/mips/t-linux64 +++ b/gcc/config/mips/t-linux64 @@ -17,10 +17,6 @@ @@ -115,7 +115,7 @@ index 216d2776a18..e4d817621fc 100644 +#MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES)) +MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64 -index 264a7e27524..dc9d440f66b 100644 +index e11a118cb5f..4eaffb416fe 100644 --- a/gcc/config/rs6000/t-linux64 +++ b/gcc/config/rs6000/t-linux64 @@ -26,10 +26,9 @@ diff --git a/recipes-devtools/gcc/gcc-arc/0004-CVE-2021-35465.patch b/recipes-devtools/gcc/gcc-arc/0004-CVE-2021-35465.patch new file mode 100644 index 0000000..9dd6a31 --- /dev/null +++ b/recipes-devtools/gcc/gcc-arc/0004-CVE-2021-35465.patch @@ -0,0 +1,304 @@ +From 809330ab8450261e05919b472783bf15e4b000f7 Mon Sep 17 00:00:00 2001 +From: Richard Earnshaw +Date: Tue, 6 Jul 2021 15:10:18 +0100 +Subject: [PATCH] arm: Add tests for VLLDM mitigation [PR102035] + +New tests for the erratum mitigation. + +gcc/testsuite: + PR target/102035 + * gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c: New test. + * gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c: Likewise. + * gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c: Likewise. + * gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c: Likewise. + * gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c: Likewise. + * gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c: Likewise. + * gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c: Likewise. + * gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c: Likewise. + +CVE: CVE-2021-35465 +Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=809330ab8450261e05919b472783bf15e4b000f7] +Signed-off-by: Pgowda + +--- + .../arm/cmse/mainline/8_1m/soft/cmse-13a.c | 31 +++++++++++++++++++ + .../arm/cmse/mainline/8_1m/soft/cmse-7a.c | 28 +++++++++++++++++ + .../arm/cmse/mainline/8_1m/soft/cmse-8a.c | 30 ++++++++++++++++++ + .../cmse/mainline/8_1m/softfp-sp/cmse-7a.c | 27 ++++++++++++++++ + .../cmse/mainline/8_1m/softfp-sp/cmse-8a.c | 29 +++++++++++++++++ + .../arm/cmse/mainline/8_1m/softfp/cmse-13a.c | 30 ++++++++++++++++++ + .../arm/cmse/mainline/8_1m/softfp/cmse-7a.c | 27 ++++++++++++++++ + .../arm/cmse/mainline/8_1m/softfp/cmse-8a.c | 29 +++++++++++++++++ + 8 files changed, 231 insertions(+) + create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c + create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c + create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c + create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c + create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c + create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c + create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c + create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c + +diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c +--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c 1969-12-31 16:00:00.000000000 -0800 ++++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c 2021-11-15 02:30:37.210637445 -0800 +@@ -0,0 +1,31 @@ ++/* { dg-do compile } */ ++/* { dg-options "-mcmse -mfloat-abi=soft -mfix-cmse-cve-2021-35465" } */ ++/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */ ++ ++#include "../../../cmse-13.x" ++ ++/* Checks for saving and clearing prior to function call. */ ++/* Shift on the same register as blxns. */ ++/* { dg-final { scan-assembler "lsrs\t(r\[1,4-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */ ++/* { dg-final { scan-assembler "lsls\t(r\[1,4-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */ ++/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */ ++/* { dg-final { scan-assembler-not "mov\tr2, r4" } } */ ++/* { dg-final { scan-assembler-not "mov\tr3, r4" } } */ ++/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */ ++/* { dg-final { scan-assembler "vlstm\tsp" } } */ ++/* Check the right registers are cleared and none appears twice. */ ++/* { dg-final { scan-assembler "clrm\t\{(r1, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */ ++/* Check that the right number of registers is cleared and thus only one ++ register is missing. */ ++/* { dg-final { scan-assembler "clrm\t\{((r\[1,4-9\]|r10|fp|ip), ){9}APSR\}" } } */ ++/* Check that no cleared register is used for blxns. */ ++/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[1,4-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */ ++/* Check for v8.1-m variant of erratum work-around. */ ++/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */ ++/* { dg-final { scan-assembler "vlldm\tsp" } } */ ++/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */ ++/* { dg-final { scan-assembler-not "vmov" } } */ ++/* { dg-final { scan-assembler-not "vmsr" } } */ ++ ++/* Now we check that we use the correct intrinsic to call. */ ++/* { dg-final { scan-assembler "blxns" } } */ +diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c +--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c 1969-12-31 16:00:00.000000000 -0800 ++++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c 2021-11-15 02:30:37.210637445 -0800 +@@ -0,0 +1,28 @@ ++/* { dg-do compile } */ ++/* { dg-options "-mcmse -mfloat-abi=soft -mfix-cmse-cve-2021-35465" } */ ++/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */ ++ ++#include "../../../cmse-7.x" ++ ++/* Checks for saving and clearing prior to function call. */ ++/* Shift on the same register as blxns. */ ++/* { dg-final { scan-assembler "lsrs\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */ ++/* { dg-final { scan-assembler "lsls\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */ ++/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */ ++/* { dg-final { scan-assembler "vlstm\tsp" } } */ ++/* Check the right registers are cleared and none appears twice. */ ++/* { dg-final { scan-assembler "clrm\t\{(r0, )?(r1, )?(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */ ++/* Check that the right number of registers is cleared and thus only one ++ register is missing. */ ++/* { dg-final { scan-assembler "clrm\t\{((r\[0-9\]|r10|fp|ip), ){12}APSR\}" } } */ ++/* Check that no cleared register is used for blxns. */ ++/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[0-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */ ++/* Check for v8.1-m variant of erratum work-around. */ ++/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */ ++/* { dg-final { scan-assembler "vlldm\tsp" } } */ ++/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */ ++/* { dg-final { scan-assembler-not "vmov" } } */ ++/* { dg-final { scan-assembler-not "vmsr" } } */ ++ ++/* Now we check that we use the correct intrinsic to call. */ ++/* { dg-final { scan-assembler "blxns" } } */ +diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c +--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c 1969-12-31 16:00:00.000000000 -0800 ++++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c 2021-11-15 02:30:37.210637445 -0800 +@@ -0,0 +1,30 @@ ++/* { dg-do compile } */ ++/* { dg-options "-mcmse -mfloat-abi=soft -mfix-cmse-cve-2021-35465" } */ ++/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */ ++ ++#include "../../../cmse-8.x" ++ ++/* Checks for saving and clearing prior to function call. */ ++/* Shift on the same register as blxns. */ ++/* { dg-final { scan-assembler "lsrs\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */ ++/* { dg-final { scan-assembler "lsls\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */ ++/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */ ++/* { dg-final { scan-assembler-not "mov\tr1, r4" } } */ ++/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */ ++/* { dg-final { scan-assembler "vlstm\tsp" } } */ ++/* Check the right registers are cleared and none appears twice. */ ++/* { dg-final { scan-assembler "clrm\t\{(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */ ++/* Check that the right number of registers is cleared and thus only one ++ register is missing. */ ++/* { dg-final { scan-assembler "clrm\t\{((r\[2-9\]|r10|fp|ip), ){10}APSR\}" } } */ ++/* Check that no cleared register is used for blxns. */ ++/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[2-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */ ++/* Check for v8.1-m variant of erratum work-around. */ ++/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */ ++/* { dg-final { scan-assembler "vlldm\tsp" } } */ ++/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */ ++/* { dg-final { scan-assembler-not "vmov" } } */ ++/* { dg-final { scan-assembler-not "vmsr" } } */ ++ ++/* Now we check that we use the correct intrinsic to call. */ ++/* { dg-final { scan-assembler "blxns" } } */ +diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c +--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c 1969-12-31 16:00:00.000000000 -0800 ++++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c 2021-11-15 02:30:37.210637445 -0800 +@@ -0,0 +1,30 @@ ++/* { dg-do compile } */ ++/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-d16 -mfix-cmse-cve-2021-35465" } */ ++/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */ ++/* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */ ++ ++#include "../../../cmse-13.x" ++ ++/* Checks for saving and clearing prior to function call. */ ++/* Shift on the same register as blxns. */ ++/* { dg-final { scan-assembler "lsrs\t(r\[1,4-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */ ++/* { dg-final { scan-assembler "lsls\t(r\[1,4-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */ ++/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */ ++/* { dg-final { scan-assembler-not "mov\tr2, r4" } } */ ++/* { dg-final { scan-assembler-not "mov\tr3, r4" } } */ ++/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */ ++/* { dg-final { scan-assembler "vlstm\tsp" } } */ ++/* Check the right registers are cleared and none appears twice. */ ++/* { dg-final { scan-assembler "clrm\t\{(r1, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */ ++/* Check that the right number of registers is cleared and thus only one ++ register is missing. */ ++/* { dg-final { scan-assembler "clrm\t\{((r\[1,4-9\]|r10|fp|ip), ){9}APSR\}" } } */ ++/* Check that no cleared register is used for blxns. */ ++/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[1,4-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */ ++/* Check for v8.1-m variant of erratum work-around. */ ++/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */ ++/* { dg-final { scan-assembler "vlldm\tsp" } } */ ++/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */ ++ ++/* Now we check that we use the correct intrinsic to call. */ ++/* { dg-final { scan-assembler "blxns" } } */ +diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c +--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c 1969-12-31 16:00:00.000000000 -0800 ++++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c 2021-11-15 02:30:37.210637445 -0800 +@@ -0,0 +1,27 @@ ++/* { dg-do compile } */ ++/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-d16 -mfix-cmse-cve-2021-35465" } */ ++/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */ ++/* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */ ++ ++#include "../../../cmse-7.x" ++ ++/* Checks for saving and clearing prior to function call. */ ++/* Shift on the same register as blxns. */ ++/* { dg-final { scan-assembler "lsrs\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */ ++/* { dg-final { scan-assembler "lsls\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */ ++/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */ ++/* { dg-final { scan-assembler "vlstm\tsp" } } */ ++/* Check the right registers are cleared and none appears twice. */ ++/* { dg-final { scan-assembler "clrm\t\{(r0, )?(r1, )?(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */ ++/* Check that the right number of registers is cleared and thus only one ++ register is missing. */ ++/* { dg-final { scan-assembler "clrm\t\{((r\[0-9\]|r10|fp|ip), ){12}APSR\}" } } */ ++/* Check that no cleared register is used for blxns. */ ++/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[0-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */ ++/* Check for v8.1-m variant of erratum work-around. */ ++/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */ ++/* { dg-final { scan-assembler "vlldm\tsp" } } */ ++/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */ ++ ++/* Now we check that we use the correct intrinsic to call. */ ++/* { dg-final { scan-assembler "blxns" } } */ +diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c +--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c 1969-12-31 16:00:00.000000000 -0800 ++++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c 2021-11-15 02:30:37.210637445 -0800 +@@ -0,0 +1,29 @@ ++/* { dg-do compile } */ ++/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-d16 -mfix-cmse-cve-2021-35465" } */ ++/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */ ++/* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */ ++ ++#include "../../../cmse-8.x" ++ ++/* Checks for saving and clearing prior to function call. */ ++/* Shift on the same register as blxns. */ ++/* { dg-final { scan-assembler "lsrs\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */ ++/* { dg-final { scan-assembler "lsls\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */ ++/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */ ++/* { dg-final { scan-assembler-not "mov\tr1, r4" } } */ ++/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */ ++/* { dg-final { scan-assembler "vlstm\tsp" } } */ ++/* Check the right registers are cleared and none appears twice. */ ++/* { dg-final { scan-assembler "clrm\t\{(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */ ++/* Check that the right number of registers is cleared and thus only one ++ register is missing. */ ++/* { dg-final { scan-assembler "clrm\t\{((r\[2-9\]|r10|fp|ip), ){10}APSR\}" } } */ ++/* Check that no cleared register is used for blxns. */ ++/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[2-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */ ++/* Check for v8.1-m variant of erratum work-around. */ ++/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */ ++/* { dg-final { scan-assembler "vlldm\tsp" } } */ ++/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */ ++ ++/* Now we check that we use the correct intrinsic to call. */ ++/* { dg-final { scan-assembler "blxns" } } */ +diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c +--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c 1969-12-31 16:00:00.000000000 -0800 ++++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c 2021-11-15 02:30:37.210637445 -0800 +@@ -0,0 +1,27 @@ ++/* { dg-do compile } */ ++/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -mfix-cmse-cve-2021-35465" } */ ++/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */ ++/* { dg-skip-if "Skip these if testing double precision" {*-*-*} {"-mfpu=fpv[4-5]-d16"} {""} } */ ++ ++#include "../../../cmse-7.x" ++ ++/* Checks for saving and clearing prior to function call. */ ++/* Shift on the same register as blxns. */ ++/* { dg-final { scan-assembler "lsrs\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */ ++/* { dg-final { scan-assembler "lsls\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */ ++/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */ ++/* { dg-final { scan-assembler "vlstm\tsp" } } */ ++/* Check the right registers are cleared and none appears twice. */ ++/* { dg-final { scan-assembler "clrm\t\{(r0, )?(r1, )?(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */ ++/* Check that the right number of registers is cleared and thus only one ++ register is missing. */ ++/* { dg-final { scan-assembler "clrm\t\{((r\[0-9\]|r10|fp|ip), ){12}APSR\}" } } */ ++/* Check that no cleared register is used for blxns. */ ++/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[0-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */ ++/* Check for v8.1-m variant of erratum work-around. */ ++/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */ ++/* { dg-final { scan-assembler "vlldm\tsp" } } */ ++/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */ ++ ++/* Now we check that we use the correct intrinsic to call. */ ++/* { dg-final { scan-assembler "blxns" } } */ +diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c +--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c 1969-12-31 16:00:00.000000000 -0800 ++++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c 2021-11-15 02:30:37.210637445 -0800 +@@ -0,0 +1,29 @@ ++/* { dg-do compile } */ ++/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -mfix-cmse-cve-2021-35465" } */ ++/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */ ++/* { dg-skip-if "Skip these if testing double precision" {*-*-*} {"-mfpu=fpv[4-5]-d16"} {""} } */ ++ ++#include "../../../cmse-8.x" ++ ++/* Checks for saving and clearing prior to function call. */ ++/* Shift on the same register as blxns. */ ++/* { dg-final { scan-assembler "lsrs\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */ ++/* { dg-final { scan-assembler "lsls\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */ ++/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */ ++/* { dg-final { scan-assembler-not "mov\tr1, r4" } } */ ++/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */ ++/* { dg-final { scan-assembler "vlstm\tsp" } } */ ++/* Check the right registers are cleared and none appears twice. */ ++/* { dg-final { scan-assembler "clrm\t\{(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */ ++/* Check that the right number of registers is cleared and thus only one ++ register is missing. */ ++/* { dg-final { scan-assembler "clrm\t\{((r\[2-9\]|r10|fp|ip), ){10}APSR\}" } } */ ++/* Check that no cleared register is used for blxns. */ ++/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[2-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */ ++/* Check for v8.1-m variant of erratum work-around. */ ++/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */ ++/* { dg-final { scan-assembler "vlldm\tsp" } } */ ++/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */ ++ ++/* Now we check that we use the correct intrinsic to call. */ ++/* { dg-final { scan-assembler "blxns" } } */ diff --git a/recipes-devtools/gcc/gcc-arc/0004-CVE-2021-42574.patch b/recipes-devtools/gcc/gcc-arc/0004-CVE-2021-42574.patch new file mode 100644 index 0000000..4999c71 --- /dev/null +++ b/recipes-devtools/gcc/gcc-arc/0004-CVE-2021-42574.patch @@ -0,0 +1,573 @@ +From bef32d4a28595e933f24fef378cf052a30b674a7 Mon Sep 17 00:00:00 2001 +From: David Malcolm +Date: Tue, 2 Nov 2021 15:45:22 -0400 +Subject: [PATCH] libcpp: capture and underline ranges in -Wbidi-chars= + [PR103026] +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf8 +Content-Transfer-Encoding: 8bit + +This patch converts the bidi::vec to use a struct so that we can +capture location_t values for the bidirectional control characters. + +Before: + + Wbidi-chars-1.c: In function âmainâ: + Wbidi-chars-1.c:6:43: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=] + 6 | /* } if (isAdmin) begin admins only */ + | ^ + Wbidi-chars-1.c:9:28: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=] + 9 | /* end admins only { */ + | ^ + +After: + + Wbidi-chars-1.c: In function âmainâ: + Wbidi-chars-1.c:6:43: warning: unpaired UTF-8 bidirectional control characters detected [-Wbidi-chars=] + 6 | /* } if (isAdmin) begin admins only */ + | ~~~~~~~~ ~~~~~~~~ ^ + | | | | + | | | end of bidirectional context + | U+202E (RIGHT-TO-LEFT OVERRIDE) U+2066 (LEFT-TO-RIGHT ISOLATE) + Wbidi-chars-1.c:9:28: warning: unpaired UTF-8 bidirectional control characters detected [-Wbidi-chars=] + 9 | /* end admins only { */ + | ~~~~~~~~ ~~~~~~~~ ^ + | | | | + | | | end of bidirectional context + | | U+2066 (LEFT-TO-RIGHT ISOLATE) + | U+202E (RIGHT-TO-LEFT OVERRIDE) + +Signed-off-by: David Malcolm + +gcc/testsuite/ChangeLog: + PR preprocessor/103026 + * c-c++-common/Wbidi-chars-ranges.c: New test. + +libcpp/ChangeLog: + PR preprocessor/103026 + * lex.c (struct bidi::context): New. + (bidi::vec): Convert to a vec of context rather than unsigned + char. + (bidi::ctx_at): Rename to... + (bidi::pop_kind_at): ...this and reimplement for above change. + (bidi::current_ctx): Update for change to vec. + (bidi::current_ctx_ucn_p): Likewise. + (bidi::current_ctx_loc): New. + (bidi::on_char): Update for usage of context struct. Add "loc" + param and pass it when pushing contexts. + (get_location_for_byte_range_in_cur_line): New. + (get_bidi_utf8): Rename to... + (get_bidi_utf8_1): ...this, reintroducing... + (get_bidi_utf8): ...as a wrapper, setting *OUT when the result is + not NONE. + (get_bidi_ucn): Rename to... + (get_bidi_ucn_1): ...this, reintroducing... + (get_bidi_ucn): ...as a wrapper, setting *OUT when the result is + not NONE. + (class unpaired_bidi_rich_location): New. + (maybe_warn_bidi_on_close): Use unpaired_bidi_rich_location when + reporting on unpaired bidi chars. Split into singular vs plural + spellings. + (maybe_warn_bidi_on_char): Pass in a location_t rather than a + const uchar * and use it when emitting warnings, and when calling + bidi::on_char. + (_cpp_skip_block_comment): Capture location when kind is not NONE + and pass it to maybe_warn_bidi_on_char. + (skip_line_comment): Likewise. + (forms_identifier_p): Likewise. + (lex_raw_string): Likewise. + (lex_string): Likewise. + +Signed-off-by: David Malcolm + +CVE: CVE-2021-42574 +Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=bef32d4a28595e933f24fef378cf052a30b674a7] +Signed-off-by: Pgowda + +--- + .../c-c++-common/Wbidi-chars-ranges.c | 54 ++++ + libcpp/lex.c | 251 ++++++++++++++---- + 2 files changed, 257 insertions(+), 48 deletions(-) + create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-ranges.c + +diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-ranges.c b/gcc/testsuite/c-c++-common/Wbidi-chars-ranges.c +new file mode 100644 +index 00000000000..298750a2a64 +--- /dev/null ++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-ranges.c +@@ -0,0 +1,54 @@ ++/* PR preprocessor/103026 */ ++/* { dg-do compile } */ ++/* { dg-options "-Wbidi-chars=unpaired -fdiagnostics-show-caret" } */ ++/* Verify that we escape and underline pertinent bidirectional ++ control characters when quoting the source. */ ++ ++int test_unpaired_bidi () { ++ int isAdmin = 0; ++ /*â® } â¦if (isAdmin)⩠⦠begin admins only */ ++/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */ ++#if 0 ++ { dg-begin-multiline-output "" } ++ /* } if (isAdmin) begin admins only */ ++ ~~~~~~~~ ~~~~~~~~ ^ ++ | | | ++ | | end of bidirectional context ++ U+202E (RIGHT-TO-LEFT OVERRIDE) U+2066 (LEFT-TO-RIGHT ISOLATE) ++ { dg-end-multiline-output "" } ++#endif ++ ++ __builtin_printf("You are an admin.\n"); ++ /* end admins only â® { â¦*/ ++/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */ ++#if 0 ++ { dg-begin-multiline-output "" } ++ /* end admins only { */ ++ ~~~~~~~~ ~~~~~~~~ ^ ++ | | | ++ | | end of bidirectional context ++ | U+2066 (LEFT-TO-RIGHT ISOLATE) ++ U+202E (RIGHT-TO-LEFT OVERRIDE) ++ { dg-end-multiline-output "" } ++#endif ++ ++ return 0; ++} ++ ++int LRE_âª_PDF_\u202c; ++/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */ ++#if 0 ++ { dg-begin-multiline-output "" } ++ int LRE__PDF_\u202c; ++ ~~~~~~~~ ^~~~~~ ++ { dg-end-multiline-output "" } ++#endif ++ ++const char *s1 = "LRE_âª_PDF_\u202c"; ++/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */ ++#if 0 ++ { dg-begin-multiline-output "" } ++ const char *s1 = "LRE__PDF_\u202c"; ++ ~~~~~~~~ ^~~~~~ ++ { dg-end-multiline-output "" } ++#endif +diff --git a/libcpp/lex.c b/libcpp/lex.c +index 2421d6c0f40..94c36f0d014 100644 +--- a/libcpp/lex.c ++++ b/libcpp/lex.c +@@ -1172,11 +1172,34 @@ namespace bidi { + /* All the UTF-8 encodings of bidi characters start with E2. */ + constexpr uchar utf8_start = 0xe2; + ++ struct context ++ { ++ context () {} ++ context (location_t loc, kind k, bool pdf, bool ucn) ++ : m_loc (loc), m_kind (k), m_pdf (pdf), m_ucn (ucn) ++ { ++ } ++ ++ kind get_pop_kind () const ++ { ++ return m_pdf ? kind::PDF : kind::PDI; ++ } ++ bool ucn_p () const ++ { ++ return m_ucn; ++ } ++ ++ location_t m_loc; ++ kind m_kind; ++ unsigned m_pdf : 1; ++ unsigned m_ucn : 1; ++ }; ++ + /* A vector holding currently open bidi contexts. We use a char for + each context, its LSB is 1 if it represents a PDF context, 0 if it + represents a PDI context. The next bit is 1 if this context was open + by a bidi character written as a UCN, and 0 when it was UTF-8. */ +- semi_embedded_vec vec; ++ semi_embedded_vec vec; + + /* Close the whole comment/identifier/string literal/character constant + context. */ +@@ -1193,19 +1216,19 @@ namespace bidi { + vec.truncate (len - 1); + } + +- /* Return the context of the Ith element. */ +- kind ctx_at (unsigned int i) ++ /* Return the pop kind of the context of the Ith element. */ ++ kind pop_kind_at (unsigned int i) + { +- return (vec[i] & 1) ? kind::PDF : kind::PDI; ++ return vec[i].get_pop_kind (); + } + +- /* Return which context is currently opened. */ ++ /* Return the pop kind of the context that is currently opened. */ + kind current_ctx () + { + unsigned int len = vec.count (); + if (len == 0) + return kind::NONE; +- return ctx_at (len - 1); ++ return vec[len - 1].get_pop_kind (); + } + + /* Return true if the current context comes from a UCN origin, that is, +@@ -1214,11 +1237,19 @@ namespace bidi { + { + unsigned int len = vec.count (); + gcc_checking_assert (len > 0); +- return (vec[len - 1] >> 1) & 1; ++ return vec[len - 1].m_ucn; + } + +- /* We've read a bidi char, update the current vector as necessary. */ +- void on_char (kind k, bool ucn_p) ++ location_t current_ctx_loc () ++ { ++ unsigned int len = vec.count (); ++ gcc_checking_assert (len > 0); ++ return vec[len - 1].m_loc; ++ } ++ ++ /* We've read a bidi char, update the current vector as necessary. ++ LOC is only valid when K is not kind::NONE. */ ++ void on_char (kind k, bool ucn_p, location_t loc) + { + switch (k) + { +@@ -1226,12 +1257,12 @@ namespace bidi { + case kind::RLE: + case kind::LRO: + case kind::RLO: +- vec.push (ucn_p ? 3u : 1u); ++ vec.push (context (loc, k, true, ucn_p)); + break; + case kind::LRI: + case kind::RLI: + case kind::FSI: +- vec.push (ucn_p ? 2u : 0u); ++ vec.push (context (loc, k, false, ucn_p)); + break; + /* PDF terminates the scope of the last LRE, RLE, LRO, or RLO + whose scope has not yet been terminated. */ +@@ -1245,7 +1276,7 @@ namespace bidi { + yet been terminated. */ + case kind::PDI: + for (int i = vec.count () - 1; i >= 0; --i) +- if (ctx_at (i) == kind::PDI) ++ if (pop_kind_at (i) == kind::PDI) + { + vec.truncate (i); + break; +@@ -1295,10 +1326,47 @@ namespace bidi { + } + } + ++/* Get location_t for the range of bytes [START, START + NUM_BYTES) ++ within the current line in FILE, with the caret at START. */ ++ ++static location_t ++get_location_for_byte_range_in_cur_line (cpp_reader *pfile, ++ const unsigned char *const start, ++ size_t num_bytes) ++{ ++ gcc_checking_assert (num_bytes > 0); ++ ++ /* CPP_BUF_COLUMN and linemap_position_for_column both refer ++ to offsets in bytes, but CPP_BUF_COLUMN is 0-based, ++ whereas linemap_position_for_column is 1-based. */ ++ ++ /* Get 0-based offsets within the line. */ ++ size_t start_offset = CPP_BUF_COLUMN (pfile->buffer, start); ++ size_t end_offset = start_offset + num_bytes - 1; ++ ++ /* Now convert to location_t, where "columns" are 1-based byte offsets. */ ++ location_t start_loc = linemap_position_for_column (pfile->line_table, ++ start_offset + 1); ++ location_t end_loc = linemap_position_for_column (pfile->line_table, ++ end_offset + 1); ++ ++ if (start_loc == end_loc) ++ return start_loc; ++ ++ source_range src_range; ++ src_range.m_start = start_loc; ++ src_range.m_finish = end_loc; ++ location_t combined_loc = COMBINE_LOCATION_DATA (pfile->line_table, ++ start_loc, ++ src_range, ++ NULL); ++ return combined_loc; ++} ++ + /* Parse a sequence of 3 bytes starting with P and return its bidi code. */ + + static bidi::kind +-get_bidi_utf8 (const unsigned char *const p) ++get_bidi_utf8_1 (const unsigned char *const p) + { + gcc_checking_assert (p[0] == bidi::utf8_start); + +@@ -1340,10 +1408,25 @@ get_bidi_utf8 (const unsigned char *cons + return bidi::kind::NONE; + } + ++/* Parse a sequence of 3 bytes starting with P and return its bidi code. ++ If the kind is not NONE, write the location to *OUT.*/ ++ ++static bidi::kind ++get_bidi_utf8 (cpp_reader *pfile, const unsigned char *const p, location_t *out) ++{ ++ bidi::kind result = get_bidi_utf8_1 (p); ++ if (result != bidi::kind::NONE) ++ { ++ /* We have a sequence of 3 bytes starting at P. */ ++ *out = get_location_for_byte_range_in_cur_line (pfile, p, 3); ++ } ++ return result; ++} ++ + /* Parse a UCN where P points just past \u or \U and return its bidi code. */ + + static bidi::kind +-get_bidi_ucn (const unsigned char *p, bool is_U) ++get_bidi_ucn_1 (const unsigned char *p, bool is_U) + { + /* 6.4.3 Universal Character Names + \u hex-quad +@@ -1412,6 +1495,62 @@ get_bidi_ucn (const unsigned char *p, bo + return bidi::kind::NONE; + } + ++/* Parse a UCN where P points just past \u or \U and return its bidi code. ++ If the kind is not NONE, write the location to *OUT.*/ ++ ++static bidi::kind ++get_bidi_ucn (cpp_reader *pfile, const unsigned char *p, bool is_U, ++ location_t *out) ++{ ++ bidi::kind result = get_bidi_ucn_1 (p, is_U); ++ if (result != bidi::kind::NONE) ++ { ++ const unsigned char *start = p - 2; ++ size_t num_bytes = 2 + (is_U ? 8 : 4); ++ *out = get_location_for_byte_range_in_cur_line (pfile, start, num_bytes); ++ } ++ return result; ++} ++ ++/* Subclass of rich_location for reporting on unpaired UTF-8 ++ bidirectional control character(s). ++ Escape the source lines on output, and show all unclosed ++ bidi context, labelling everything. */ ++ ++class unpaired_bidi_rich_location : public rich_location ++{ ++ public: ++ class custom_range_label : public range_label ++ { ++ public: ++ label_text get_text (unsigned range_idx) const FINAL OVERRIDE ++ { ++ /* range 0 is the primary location; each subsequent range i + 1 ++ is for bidi::vec[i]. */ ++ if (range_idx > 0) ++ { ++ const bidi::context &ctxt (bidi::vec[range_idx - 1]); ++ return label_text::borrow (bidi::to_str (ctxt.m_kind)); ++ } ++ else ++ return label_text::borrow (_("end of bidirectional context")); ++ } ++ }; ++ ++ unpaired_bidi_rich_location (cpp_reader *pfile, location_t loc) ++ : rich_location (pfile->line_table, loc, &m_custom_label) ++ { ++ set_escape_on_output (true); ++ for (unsigned i = 0; i < bidi::vec.count (); i++) ++ add_range (bidi::vec[i].m_loc, ++ SHOW_RANGE_WITHOUT_CARET, ++ &m_custom_label); ++ } ++ ++ private: ++ custom_range_label m_custom_label; ++}; ++ + /* We're closing a bidi context, that is, we've encountered a newline, + are closing a C-style comment, or are at the end of a string literal, + character constant, or identifier. Warn if this context was not +@@ -1427,11 +1566,17 @@ maybe_warn_bidi_on_close (cpp_reader *pf + const location_t loc + = linemap_position_for_column (pfile->line_table, + CPP_BUF_COLUMN (pfile->buffer, p)); +- rich_location rich_loc (pfile->line_table, loc); +- rich_loc.set_escape_on_output (true); +- cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc, +- "unpaired UTF-8 bidirectional control character " +- "detected"); ++ unpaired_bidi_rich_location rich_loc (pfile, loc); ++ /* cpp_callbacks doesn't yet have a way to handle singular vs plural ++ forms of a diagnostic, so fake it for now. */ ++ if (bidi::vec.count () > 1) ++ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc, ++ "unpaired UTF-8 bidirectional control characters " ++ "detected"); ++ else ++ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc, ++ "unpaired UTF-8 bidirectional control character " ++ "detected"); + } + /* We're done with this context. */ + bidi::on_close (); +@@ -1439,12 +1584,13 @@ maybe_warn_bidi_on_close (cpp_reader *pf + + /* We're at the beginning or in the middle of an identifier/comment/string + literal/character constant. Warn if we've encountered a bidi character. +- KIND says which bidi character it was; P points to it in the character +- stream. UCN_P is true iff this bidi character was written as a UCN. */ ++ KIND says which bidi control character it was; UCN_P is true iff this bidi ++ control character was written as a UCN. LOC is the location of the ++ character, but is only valid if KIND != bidi::kind::NONE. */ + + static void +-maybe_warn_bidi_on_char (cpp_reader *pfile, const uchar *p, bidi::kind kind, +- bool ucn_p) ++maybe_warn_bidi_on_char (cpp_reader *pfile, bidi::kind kind, ++ bool ucn_p, location_t loc) + { + if (__builtin_expect (kind == bidi::kind::NONE, 1)) + return; +@@ -1453,9 +1599,6 @@ maybe_warn_bidi_on_char (cpp_reader *pfi + + if (warn_bidi != bidirectional_none) + { +- const location_t loc +- = linemap_position_for_column (pfile->line_table, +- CPP_BUF_COLUMN (pfile->buffer, p)); + rich_location rich_loc (pfile->line_table, loc); + rich_loc.set_escape_on_output (true); + +@@ -1467,9 +1610,12 @@ maybe_warn_bidi_on_char (cpp_reader *pfi + { + if (warn_bidi == bidirectional_unpaired + && bidi::current_ctx_ucn_p () != ucn_p) +- cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc, +- "UTF-8 vs UCN mismatch when closing " +- "a context by \"%s\"", bidi::to_str (kind)); ++ { ++ rich_loc.add_range (bidi::current_ctx_loc ()); ++ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc, ++ "UTF-8 vs UCN mismatch when closing " ++ "a context by \"%s\"", bidi::to_str (kind)); ++ } + } + else if (warn_bidi == bidirectional_any) + { +@@ -1484,7 +1630,7 @@ maybe_warn_bidi_on_char (cpp_reader *pfi + } + } + /* We're done with this context. */ +- bidi::on_char (kind, ucn_p); ++ bidi::on_char (kind, ucn_p, loc); + } + + /* Skip a C-style block comment. We find the end of the comment by +@@ -1552,8 +1698,9 @@ _cpp_skip_block_comment (cpp_reader *pfi + a bidirectional control character. */ + else if (__builtin_expect (c == bidi::utf8_start, 0) && warn_bidi_p) + { +- bidi::kind kind = get_bidi_utf8 (cur - 1); +- maybe_warn_bidi_on_char (pfile, cur, kind, /*ucn_p=*/false); ++ location_t loc; ++ bidi::kind kind = get_bidi_utf8 (pfile, cur - 1, &loc); ++ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/false, loc); + } + } + +@@ -1586,9 +1733,9 @@ skip_line_comment (cpp_reader *pfile) + { + if (__builtin_expect (*buffer->cur == bidi::utf8_start, 0)) + { +- bidi::kind kind = get_bidi_utf8 (buffer->cur); +- maybe_warn_bidi_on_char (pfile, buffer->cur, kind, +- /*ucn_p=*/false); ++ location_t loc; ++ bidi::kind kind = get_bidi_utf8 (pfile, buffer->cur, &loc); ++ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/false, loc); + } + buffer->cur++; + } +@@ -1708,9 +1855,9 @@ forms_identifier_p (cpp_reader *pfile, i + if (__builtin_expect (*buffer->cur == bidi::utf8_start, 0) + && warn_bidi_p) + { +- bidi::kind kind = get_bidi_utf8 (buffer->cur); +- maybe_warn_bidi_on_char (pfile, buffer->cur, kind, +- /*ucn_p=*/false); ++ location_t loc; ++ bidi::kind kind = get_bidi_utf8 (pfile, buffer->cur, &loc); ++ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/false, loc); + } + if (_cpp_valid_utf8 (pfile, &buffer->cur, buffer->rlimit, 1 + !first, + state, &s)) +@@ -1722,10 +1869,12 @@ forms_identifier_p (cpp_reader *pfile, i + buffer->cur += 2; + if (warn_bidi_p) + { +- bidi::kind kind = get_bidi_ucn (buffer->cur, +- buffer->cur[-1] == 'U'); +- maybe_warn_bidi_on_char (pfile, buffer->cur, kind, +- /*ucn_p=*/true); ++ location_t loc; ++ bidi::kind kind = get_bidi_ucn (pfile, ++ buffer->cur, ++ buffer->cur[-1] == 'U', ++ &loc); ++ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/true, loc); + } + if (_cpp_valid_ucn (pfile, &buffer->cur, buffer->rlimit, 1 + !first, + state, &s, NULL, NULL)) +@@ -2336,8 +2485,11 @@ lex_raw_string (cpp_reader *pfile, cpp_t + } + else if (__builtin_expect ((unsigned char) c == bidi::utf8_start, 0) + && warn_bidi_p) +- maybe_warn_bidi_on_char (pfile, pos - 1, get_bidi_utf8 (pos - 1), +- /*ucn_p=*/false); ++ { ++ location_t loc; ++ bidi::kind kind = get_bidi_utf8 (pfile, pos - 1, &loc); ++ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/false, loc); ++ } + } + + if (warn_bidi_p) +@@ -2447,8 +2599,10 @@ lex_string (cpp_reader *pfile, cpp_token + { + if ((cur[0] == 'u' || cur[0] == 'U') && warn_bidi_p) + { +- bidi::kind kind = get_bidi_ucn (cur + 1, cur[0] == 'U'); +- maybe_warn_bidi_on_char (pfile, cur, kind, /*ucn_p=*/true); ++ location_t loc; ++ bidi::kind kind = get_bidi_ucn (pfile, cur + 1, cur[0] == 'U', ++ &loc); ++ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/true, loc); + } + cur++; + } +@@ -2476,8 +2630,9 @@ lex_string (cpp_reader *pfile, cpp_token + saw_NUL = true; + else if (__builtin_expect (c == bidi::utf8_start, 0) && warn_bidi_p) + { +- bidi::kind kind = get_bidi_utf8 (cur - 1); +- maybe_warn_bidi_on_char (pfile, cur - 1, kind, /*ucn_p=*/false); ++ location_t loc; ++ bidi::kind kind = get_bidi_utf8 (pfile, cur - 1, &loc); ++ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/false, loc); + } + } + diff --git a/recipes-devtools/gcc/gcc-arc/0005-optional-libstdc.patch b/recipes-devtools/gcc/gcc-arc/0005-optional-libstdc.patch deleted file mode 100644 index 4020c9e..0000000 --- a/recipes-devtools/gcc/gcc-arc/0005-optional-libstdc.patch +++ /dev/null @@ -1,122 +0,0 @@ -From 6ddfb0bfcd1eea71acd37ab06f7a4510b9f1d12b Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 29 Mar 2013 09:12:56 +0400 -Subject: [PATCH] optional libstdc - -gcc-runtime builds libstdc++ separately from gcc-cross-*. Its configure tests using g++ -will not run correctly since by default the linker will try to link against libstdc++ -which shouldn't exist yet. We need an option to disable -lstdc++ -option whilst leaving -lc, -lgcc and other automatic library dependencies added by gcc -driver. This patch adds such an option which only disables the -lstdc++. - -A "standard" gcc build uses xgcc and hence avoids this. We should ask upstream how to -do this officially, the likely answer is don't build libstdc++ separately. - -RP 29/6/10 - -Signed-off-by: Khem Raj - -Upstream-Status: Inappropriate [embedded specific] ---- - gcc/c-family/c.opt | 4 ++++ - gcc/cp/g++spec.c | 1 + - gcc/doc/invoke.texi | 32 +++++++++++++++++++++++++++++++- - gcc/gcc.c | 1 + - 4 files changed, 37 insertions(+), 1 deletion(-) - -diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt -index c49da99d395..35f712e2c84 100644 ---- a/gcc/c-family/c.opt -+++ b/gcc/c-family/c.opt -@@ -2025,6 +2025,10 @@ nostdinc++ - C++ ObjC++ - Do not search standard system include directories for C++. - -+nostdlib++ -+Driver -+Do not link standard C++ runtime library -+ - o - C ObjC C++ ObjC++ Joined Separate - ; Documented in common.opt -diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c -index 0ab63bcd211..7b081e9e4f0 100644 ---- a/gcc/cp/g++spec.c -+++ b/gcc/cp/g++spec.c -@@ -137,6 +137,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, - switch (decoded_options[i].opt_index) - { - case OPT_nostdlib: -+ case OPT_nostdlib__: - case OPT_nodefaultlibs: - library = -1; - break; -diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi -index f12d8d12150..cf6cb428e7d 100644 ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -230,6 +230,9 @@ in the following sections. - -fno-weak -nostdinc++ @gol - -fvisibility-inlines-hidden @gol - -fvisibility-ms-compat @gol -+-fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol -+-fvtv-counts -fvtv-debug @gol -+-nostdlib++ @gol - -fext-numeric-literals @gol - -Wabi-tag -Wcatch-value -Wcatch-value=@var{n} @gol - -Wno-class-conversion -Wclass-memaccess @gol -@@ -599,7 +602,7 @@ Objective-C and Objective-C++ Dialects}. - -pie -pthread -r -rdynamic @gol - -s -static -static-pie -static-libgcc -static-libstdc++ @gol - -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol ---shared -shared-libgcc -symbolic @gol -+-shared -shared-libgcc -symbolic -nostdlib++ @gol - -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol - -u @var{symbol} -z @var{keyword}} - -@@ -14407,6 +14410,33 @@ Specify that the program entry point is @var{entry}. The argument is - interpreted by the linker; the GNU linker accepts either a symbol name - or an address. - -+@item -nostdlib++ -+@opindex nostdlib++ -+Do not use the standard system C++ runtime libraries when linking. -+Only the libraries you specify will be passed to the linker. -+ -+@cindex @option{-lgcc}, use with @option{-nostdlib} -+@cindex @option{-nostdlib} and unresolved references -+@cindex unresolved references and @option{-nostdlib} -+@cindex @option{-lgcc}, use with @option{-nodefaultlibs} -+@cindex @option{-nodefaultlibs} and unresolved references -+@cindex unresolved references and @option{-nodefaultlibs} -+One of the standard libraries bypassed by @option{-nostdlib} and -+@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines -+which GCC uses to overcome shortcomings of particular machines, or special -+needs for some languages. -+(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler -+Collection (GCC) Internals}, -+for more discussion of @file{libgcc.a}.) -+In most cases, you need @file{libgcc.a} even when you want to avoid -+other standard libraries. In other words, when you specify @option{-nostdlib} -+or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. -+This ensures that you have no unresolved references to internal GCC -+library subroutines. -+(An example of such an internal subroutine is @code{__main}, used to ensure C++ -+constructors are called; @pxref{Collect2,,@code{collect2}, gccint, -+GNU Compiler Collection (GCC) Internals}.) -+ - @item -pie - @opindex pie - Produce a dynamically linked position independent executable on targets -diff --git a/gcc/gcc.c b/gcc/gcc.c -index b2200c5185a..f8be58ce0a6 100644 ---- a/gcc/gcc.c -+++ b/gcc/gcc.c -@@ -1051,6 +1051,7 @@ proper position among the other output files. */ - %(mflib) " STACK_SPLIT_SPEC "\ - %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \ - %{!nostdlib:%{!r:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}}\ -+ %{!nostdlib++:}\ - %{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*} \n%(post_link) }}}}}}" - #endif - diff --git a/recipes-devtools/gcc/gcc-arc/0006-COLLECT_GCC_OPTIONS.patch b/recipes-devtools/gcc/gcc-arc/0006-COLLECT_GCC_OPTIONS.patch deleted file mode 100644 index 9fbbe80..0000000 --- a/recipes-devtools/gcc/gcc-arc/0006-COLLECT_GCC_OPTIONS.patch +++ /dev/null @@ -1,35 +0,0 @@ -From a6c90d3a9c5010b4aa7cc30467cf81ca7e0f430e Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 29 Mar 2013 09:16:28 +0400 -Subject: [PATCH] COLLECT_GCC_OPTIONS - -This patch adds --sysroot into COLLECT_GCC_OPTIONS which is used to -invoke collect2. - -Signed-off-by: Khem Raj - -Upstream-Status: Pending ---- - gcc/gcc.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/gcc/gcc.c b/gcc/gcc.c -index f8be58ce0a6..48b0f9dde81 100644 ---- a/gcc/gcc.c -+++ b/gcc/gcc.c -@@ -4806,6 +4806,15 @@ set_collect_gcc_options (void) - sizeof ("COLLECT_GCC_OPTIONS=") - 1); - - first_time = TRUE; -+#ifdef HAVE_LD_SYSROOT -+ if (target_system_root_changed && target_system_root) -+ { -+ obstack_grow (&collect_obstack, "'--sysroot=", sizeof("'--sysroot=")-1); -+ obstack_grow (&collect_obstack, target_system_root,strlen(target_system_root)); -+ obstack_grow (&collect_obstack, "'", 1); -+ first_time = FALSE; -+ } -+#endif - for (i = 0; (int) i < n_switches; i++) - { - const char *const *args; diff --git a/recipes-devtools/gcc/gcc-arc/0006-If-CXXFLAGS-contains-something-unsupported-by-the-bu.patch b/recipes-devtools/gcc/gcc-arc/0006-If-CXXFLAGS-contains-something-unsupported-by-the-bu.patch new file mode 100644 index 0000000..98a1bb2 --- /dev/null +++ b/recipes-devtools/gcc/gcc-arc/0006-If-CXXFLAGS-contains-something-unsupported-by-the-bu.patch @@ -0,0 +1,63 @@ +From e700190743fa29ddaebd6ee075298a24b1688773 Mon Sep 17 00:00:00 2001 +From: Richard Purdie +Date: Thu, 28 Oct 2021 11:33:40 +0100 +Subject: [PATCH 6/6] If CXXFLAGS contains something unsupported by the build + CXX, we see build failures (e.g. using -fmacro-prefix-map for the target). + +Pass CXXFLAGS_FOR_BUILD in a couple of places to avoid these errors. + +2021-10-28 Richard Purdie + +ChangeLog: + + * Makefile.in: Regenerate. + * Makefile.tpl: Add missing CXXFLAGS_FOR_BUILD overrides + +Signed-off-by: Richard Purdie +--- + Makefile.in | 2 ++ + Makefile.tpl | 2 ++ + 2 files changed, 4 insertions(+) + +Upstream-Status: Pending [should be submittable] + +Index: gcc-11.2.0/Makefile.in +=================================================================== +--- gcc-11.2.0.orig/Makefile.in ++++ gcc-11.2.0/Makefile.in +@@ -172,6 +172,7 @@ BUILD_EXPORTS = \ + # built for the build system to override those in BASE_FLAGS_TO_PASS. + EXTRA_BUILD_FLAGS = \ + CFLAGS="$(CFLAGS_FOR_BUILD)" \ ++ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \ + LDFLAGS="$(LDFLAGS_FOR_BUILD)" + + # This is the list of directories to built for the host system. +@@ -203,6 +204,7 @@ HOST_EXPORTS = \ + CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \ + CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \ + CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \ ++ CXXFLAGS_FOR_BUILD="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \ +Index: gcc-11.2.0/Makefile.tpl +=================================================================== +--- gcc-11.2.0.orig/Makefile.tpl ++++ gcc-11.2.0/Makefile.tpl +@@ -175,6 +175,7 @@ BUILD_EXPORTS = \ + # built for the build system to override those in BASE_FLAGS_TO_PASS. + EXTRA_BUILD_FLAGS = \ + CFLAGS="$(CFLAGS_FOR_BUILD)" \ ++ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \ + LDFLAGS="$(LDFLAGS_FOR_BUILD)" + + # This is the list of directories to built for the host system. +@@ -206,6 +207,7 @@ HOST_EXPORTS = \ + CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \ + CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \ + CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \ ++ CXXFLAGS_FOR_BUILD="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \ diff --git a/recipes-devtools/gcc/gcc-arc/0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch b/recipes-devtools/gcc/gcc-arc/0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch index a764bdd..9844c2a 100644 --- a/recipes-devtools/gcc/gcc-arc/0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch +++ b/recipes-devtools/gcc/gcc-arc/0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch @@ -1,4 +1,4 @@ -From 5670d4489f119d2da661734895ac0be99b606d1b Mon Sep 17 00:00:00 2001 +From e64342df647829d3e1c52fd480a5be7c1281ced0 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 29 Mar 2013 09:17:25 +0400 Subject: [PATCH] Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B} @@ -26,10 +26,10 @@ Signed-off-by: Hongxu Jia 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in -index 543b477ff18..a67d2cc18d6 100644 +index 8a5fb3fd99c..7da6f439fff 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in -@@ -540,7 +540,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@ +@@ -552,7 +552,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@ TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@ xmake_file=@xmake_file@ @@ -39,10 +39,10 @@ index 543b477ff18..a67d2cc18d6 100644 TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@ TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@ diff --git a/gcc/configure b/gcc/configure -index 8de766a942c..b26e8fc7fee 100755 +index 3f0734bff11..c5d3bc4ee2d 100755 --- a/gcc/configure +++ b/gcc/configure -@@ -12705,8 +12705,8 @@ for f in $tm_file; do +@@ -13090,8 +13090,8 @@ for f in $tm_file; do tm_include_list="${tm_include_list} $f" ;; defaults.h ) @@ -54,10 +54,10 @@ index 8de766a942c..b26e8fc7fee 100755 * ) tm_file_list="${tm_file_list} \$(srcdir)/config/$f" diff --git a/gcc/configure.ac b/gcc/configure.ac -index 8bfd6feb780..26fa46802c7 100644 +index 54e21764b3e..f83420326d6 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac -@@ -2138,8 +2138,8 @@ for f in $tm_file; do +@@ -2263,8 +2263,8 @@ for f in $tm_file; do tm_include_list="${tm_include_list} $f" ;; defaults.h ) @@ -69,7 +69,7 @@ index 8bfd6feb780..26fa46802c7 100644 * ) tm_file_list="${tm_file_list} \$(srcdir)/config/$f" diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh -index d2c677a4a42..d03852481cb 100644 +index c49acd8f7e4..a0a657bdbb9 100644 --- a/gcc/mkconfig.sh +++ b/gcc/mkconfig.sh @@ -77,7 +77,7 @@ if [ -n "$HEADERS" ]; then diff --git a/recipes-devtools/gcc/gcc-arc/0008-fortran-cross-compile-hack.patch b/recipes-devtools/gcc/gcc-arc/0008-fortran-cross-compile-hack.patch deleted file mode 100644 index 714db3b..0000000 --- a/recipes-devtools/gcc/gcc-arc/0008-fortran-cross-compile-hack.patch +++ /dev/null @@ -1,43 +0,0 @@ -From f05062625e7a4751be723595a2f7a4b7fbeff311 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 29 Mar 2013 09:20:01 +0400 -Subject: [PATCH] fortran cross-compile hack. - -* Fortran would have searched for arm-angstrom-gnueabi-gfortran but would have used -used gfortan. For gcc_4.2.2.bb we want to use the gfortran compiler from our cross -directory. - -Signed-off-by: Khem Raj - -Upstream-Status: Inappropriate [embedded specific] ---- - libgfortran/configure | 2 +- - libgfortran/configure.ac | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libgfortran/configure b/libgfortran/configure -index b4cf854ddb3..e8e0ac3b1cf 100755 ---- a/libgfortran/configure -+++ b/libgfortran/configure -@@ -13090,7 +13090,7 @@ esac - - # We need gfortran to compile parts of the library - #AC_PROG_FC(gfortran) --FC="$GFORTRAN" -+#FC="$GFORTRAN" - ac_ext=${ac_fc_srcext-f} - ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' - ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' -diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac -index 711dc60ff78..3c9bbfbf47d 100644 ---- a/libgfortran/configure.ac -+++ b/libgfortran/configure.ac -@@ -258,7 +258,7 @@ AC_SUBST(enable_static) - - # We need gfortran to compile parts of the library - #AC_PROG_FC(gfortran) --FC="$GFORTRAN" -+#FC="$GFORTRAN" - AC_PROG_FC(gfortran) - - # extra LD Flags which are required for targets diff --git a/recipes-devtools/gcc/gcc-arc/0009-cpp-honor-sysroot.patch b/recipes-devtools/gcc/gcc-arc/0009-cpp-honor-sysroot.patch index 8ad6853..37f26f0 100644 --- a/recipes-devtools/gcc/gcc-arc/0009-cpp-honor-sysroot.patch +++ b/recipes-devtools/gcc/gcc-arc/0009-cpp-honor-sysroot.patch @@ -1,46 +1,54 @@ -From 1d76de7f1f5c99f1fa1a4b14aedad3d702e4e136 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 29 Mar 2013 09:22:00 +0400 -Subject: [PATCH] cpp: honor sysroot. +From: Richard Purdie +Subject: [PATCH 5/5] gcc: Pass sysroot options to cpp for preprocessed source -Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile -preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location -rather than the --sysroot option specified on the commandline. If access to that directory is -permission denied (unreadable), gcc will error. +OpenEmbedded/Yocto Project extensively uses the --sysroot support within gcc. +We discovered that when compiling preprocessed source (.i or .ii files), the +compiler will try and access the builtin sysroot location rather than the +--sysroot option specified on the commandline. If access to that directory is +permission denied (unreadable), gcc will error. This is particularly problematic +when ccache is involved. -This happens when ccache is in use due to the fact it uses preprocessed source files. +This patch adds %I to the cpp-output spec macro so the default substitutions for +-iprefix, -isystem, -isysroot happen and the correct sysroot is used. -The fix below adds %I to the cpp-output spec macro so the default substitutions for -iprefix, --isystem, -isysroot happen and the correct sysroot is used. +2021-10-27 Richard Purdie -[YOCTO #2074] +gcc/cp/ChangeLog: + + * lang-specs.h: Pass sysroot options to cpp for preprocessed source + +gcc/ChangeLog: -RP 2012/04/13 + * gcc.c: Pass sysroot options to cpp for preprocessed source -Signed-off-by: Khem Raj +Signed-off-by: Richard Purdie + +[YOCTO #2074] -Upstream-Status: Pending +Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582725.html] --- gcc/cp/lang-specs.h | 2 +- gcc/gcc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h -index 0ad4a33b93e..16c744f4f90 100644 ---- a/gcc/cp/lang-specs.h -+++ b/gcc/cp/lang-specs.h -@@ -66,5 +66,5 @@ along with GCC; see the file COPYING3. If not see +Index: gcc-11.2.0/gcc/cp/lang-specs.h +=================================================================== +--- gcc-11.2.0.orig/gcc/cp/lang-specs.h ++++ gcc-11.2.0/gcc/cp/lang-specs.h +@@ -116,7 +116,7 @@ along with GCC; see the file COPYING3. {".ii", "@c++-cpp-output", 0, 0, 0}, {"@c++-cpp-output", "%{!E:%{!M:%{!MM:" - " cc1plus -fpreprocessed %i %(cc1_options) %2" + " cc1plus -fpreprocessed %i %I %(cc1_options) %2" - " %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, -diff --git a/gcc/gcc.c b/gcc/gcc.c -index 48b0f9dde81..c87f603955f 100644 ---- a/gcc/gcc.c -+++ b/gcc/gcc.c -@@ -1348,7 +1348,7 @@ static const struct compiler default_compilers[] = + " %{!fsyntax-only:" + " %{fmodule-only:%{!S:-o %g.s%V}}" + " %{!fmodule-only:%{!fmodule-header*:%(invoke_as)}}}" +Index: gcc-11.2.0/gcc/gcc.c +=================================================================== +--- gcc-11.2.0.orig/gcc/gcc.c ++++ gcc-11.2.0/gcc/gcc.c +@@ -1470,7 +1470,7 @@ static const struct compiler default_com %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0}, {".i", "@cpp-output", 0, 0, 0}, {"@cpp-output", diff --git a/recipes-devtools/gcc/gcc-arc/0010-MIPS64-Default-to-N64-ABI.patch b/recipes-devtools/gcc/gcc-arc/0010-MIPS64-Default-to-N64-ABI.patch deleted file mode 100644 index 625e2d8..0000000 --- a/recipes-devtools/gcc/gcc-arc/0010-MIPS64-Default-to-N64-ABI.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 4fad4433c96bc9d0d9d124f9674fb3389f6f426e Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 29 Mar 2013 09:23:08 +0400 -Subject: [PATCH] MIPS64: Default to N64 ABI - -MIPS64 defaults to n32 ABI, this patch makes it -so that it defaults to N64 ABI - -Signed-off-by: Khem Raj - -Upstream-Status: Inappropriate [OE config specific] ---- - gcc/config.gcc | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/gcc/config.gcc b/gcc/config.gcc -index cf1a87e2efd..37c4221a39f 100644 ---- a/gcc/config.gcc -+++ b/gcc/config.gcc -@@ -2511,29 +2511,29 @@ mips*-*-linux*) # Linux MIPS, either endian. - default_mips_arch=mips32 - ;; - mips64el-st-linux-gnu) -- default_mips_abi=n32 -+ default_mips_abi=64 - tm_file="${tm_file} mips/st.h" - tmake_file="${tmake_file} mips/t-st" - enable_mips_multilibs="yes" - ;; - mips64octeon*-*-linux*) -- default_mips_abi=n32 -+ default_mips_abi=64 - tm_defines="${tm_defines} MIPS_CPU_STRING_DEFAULT=\\\"octeon\\\"" - target_cpu_default=MASK_SOFT_FLOAT_ABI - enable_mips_multilibs="yes" - ;; - mipsisa64r6*-*-linux*) -- default_mips_abi=n32 -+ default_mips_abi=64 - default_mips_arch=mips64r6 - enable_mips_multilibs="yes" - ;; - mipsisa64r2*-*-linux*) -- default_mips_abi=n32 -+ default_mips_abi=64 - default_mips_arch=mips64r2 - enable_mips_multilibs="yes" - ;; - mips64*-*-linux* | mipsisa64*-*-linux*) -- default_mips_abi=n32 -+ default_mips_abi=64 - enable_mips_multilibs="yes" - ;; - esac diff --git a/recipes-devtools/gcc/gcc-arc/0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch b/recipes-devtools/gcc/gcc-arc/0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch index e357976..0884730 100644 --- a/recipes-devtools/gcc/gcc-arc/0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch +++ b/recipes-devtools/gcc/gcc-arc/0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch @@ -1,4 +1,4 @@ -From 8fc016a53c22c19feccbfa13ebdf19090dc67058 Mon Sep 17 00:00:00 2001 +From 8e9d6efecdc8c42f47e3a012dee764b13c3dad59 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 29 Mar 2013 09:24:50 +0400 Subject: [PATCH] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER @@ -30,8 +30,7 @@ Upstream-Status: Inappropriate [OE configuration] gcc/config/sparc/linux64.h | 4 ++-- 12 files changed, 29 insertions(+), 34 deletions(-) -diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h -index e25fcac3c59..01aca0c6542 100644 +unchanged: --- a/gcc/config/alpha/linux-elf.h +++ b/gcc/config/alpha/linux-elf.h @@ -23,8 +23,8 @@ along with GCC; see the file COPYING3. If not see @@ -45,8 +44,7 @@ index e25fcac3c59..01aca0c6542 100644 #if DEFAULT_LIBC == LIBC_UCLIBC #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" #elif DEFAULT_LIBC == LIBC_GLIBC -diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h -index 5bdcfa0c5d3..0c0332f317f 100644 +unchanged: --- a/gcc/config/arm/linux-eabi.h +++ b/gcc/config/arm/linux-eabi.h @@ -65,8 +65,8 @@ @@ -60,8 +58,7 @@ index 5bdcfa0c5d3..0c0332f317f 100644 #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT #define GLIBC_DYNAMIC_LINKER \ -diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h -index 0ec3aa53189..abfa9566d74 100644 +unchanged: --- a/gcc/config/arm/linux-elf.h +++ b/gcc/config/arm/linux-elf.h @@ -60,7 +60,7 @@ @@ -73,8 +70,7 @@ index 0ec3aa53189..abfa9566d74 100644 #define LINUX_TARGET_LINK_SPEC "%{h*} \ %{static:-Bstatic} \ -diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h -index 9f823f125ed..e0390b7d5e3 100644 +unchanged: --- a/gcc/config/i386/linux.h +++ b/gcc/config/i386/linux.h @@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. If not see @@ -86,8 +82,7 @@ index 9f823f125ed..e0390b7d5e3 100644 #undef MUSL_DYNAMIC_LINKER #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1" -diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h -index 6cb68d1ccfa..7de09ec857c 100644 +unchanged: --- a/gcc/config/i386/linux64.h +++ b/gcc/config/i386/linux64.h @@ -27,9 +27,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see @@ -103,8 +98,7 @@ index 6cb68d1ccfa..7de09ec857c 100644 #undef MUSL_DYNAMIC_LINKER32 #define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1" -diff --git a/gcc/config/linux.h b/gcc/config/linux.h -index 95654bcdb5a..0c1a8118a26 100644 +unchanged: --- a/gcc/config/linux.h +++ b/gcc/config/linux.h @@ -94,10 +94,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see @@ -122,8 +116,7 @@ index 95654bcdb5a..0c1a8118a26 100644 #define BIONIC_DYNAMIC_LINKER "/system/bin/linker" #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker" #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64" -diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h -index 54446e58e5f..4786ee304c1 100644 +unchanged: --- a/gcc/config/mips/linux.h +++ b/gcc/config/mips/linux.h @@ -22,20 +22,20 @@ along with GCC; see the file COPYING3. If not see @@ -153,8 +146,7 @@ index 54446e58e5f..4786ee304c1 100644 #undef MUSL_DYNAMIC_LINKER32 #define MUSL_DYNAMIC_LINKER32 \ -diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h -index 4afef7c228c..01997330741 100644 +unchanged: --- a/gcc/config/riscv/linux.h +++ b/gcc/config/riscv/linux.h @@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see @@ -166,11 +158,10 @@ index 4afef7c228c..01997330741 100644 #define MUSL_ABI_SUFFIX \ "%{mabi=ilp32:-sf}" \ -diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h -index 34776c8421e..967c1c43c63 100644 +unchanged: --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h -@@ -419,24 +419,19 @@ extern int dot_symbols; +@@ -336,24 +336,19 @@ extern int dot_symbols; #undef LINK_OS_DEFAULT_SPEC #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)" @@ -200,8 +191,7 @@ index 34776c8421e..967c1c43c63 100644 #undef DEFAULT_ASM_ENDIAN #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN) -diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h -index c1d0441d488..81373eb8336 100644 +unchanged: --- a/gcc/config/sh/linux.h +++ b/gcc/config/sh/linux.h @@ -64,7 +64,7 @@ along with GCC; see the file COPYING3. If not see @@ -213,11 +203,10 @@ index c1d0441d488..81373eb8336 100644 #undef SUBTARGET_LINK_EMUL_SUFFIX #define SUBTARGET_LINK_EMUL_SUFFIX "%{mfdpic:_fd;:_linux}" -diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h -index 81201e67a2f..8b6fc577594 100644 +unchanged: --- a/gcc/config/sparc/linux.h +++ b/gcc/config/sparc/linux.h -@@ -84,7 +84,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); +@@ -78,7 +78,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); When the -shared link option is used a final link is not being done. */ @@ -226,11 +215,10 @@ index 81201e67a2f..8b6fc577594 100644 #undef LINK_SPEC #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \ -diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h -index a1a0efd8f28..85d1084afc2 100644 +unchanged: --- a/gcc/config/sparc/linux64.h +++ b/gcc/config/sparc/linux64.h -@@ -84,8 +84,8 @@ along with GCC; see the file COPYING3. If not see +@@ -78,8 +78,8 @@ along with GCC; see the file COPYING3. If not see When the -shared link option is used a final link is not being done. */ @@ -241,3 +229,19 @@ index a1a0efd8f28..85d1084afc2 100644 #ifdef SPARC_BI_ARCH +diff -u b/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h +--- b/gcc/config/aarch64/aarch64-linux.h ++++ b/gcc/config/aarch64/aarch64-linux.h +@@ -21,10 +21,10 @@ + #ifndef GCC_AARCH64_LINUX_H + #define GCC_AARCH64_LINUX_H + +-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" ++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" + + #undef MUSL_DYNAMIC_LINKER +-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" ++#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" + + #undef ASAN_CC1_SPEC + #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}" diff --git a/recipes-devtools/gcc/gcc-arc/0012-gcc-Fix-argument-list-too-long-error.patch b/recipes-devtools/gcc/gcc-arc/0012-gcc-Fix-argument-list-too-long-error.patch index 88e1715..ebee30b 100644 --- a/recipes-devtools/gcc/gcc-arc/0012-gcc-Fix-argument-list-too-long-error.patch +++ b/recipes-devtools/gcc/gcc-arc/0012-gcc-Fix-argument-list-too-long-error.patch @@ -1,38 +1,35 @@ -From a22d1264049d29b90663cf5667049ae6f9b7a5ce Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 29 Mar 2013 09:26:37 +0400 -Subject: [PATCH] gcc: Fix argument list too long error. +From: Richard Purdie +Subject: [PATCH 2/5] gcc: Fix "argument list too long" from install-plugins -There would be an "Argument list too long" error when the -build directory is longer than 200, this is caused by: +When building in longer build paths (200+ characters), the +"echo $(PLUGIN_HEADERS)" from the install-plugins target would cause an +"argument list too long error" on some systems. -headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u` +Avoid this by calling make's sort function on the list which removes +duplicates and stops the overflow from reaching the echo command. +The original sort is left to handle the the .h and .def files. -The PLUGIN_HEADERS is too long before sort, so the "echo" can't handle -it, use the $(sort list) of GNU make which can handle the too long list -would fix the problem, the header would be short enough after sorted. -The "tr ' ' '\012'" was used for translating the space to "\n", the -$(sort list) doesn't need this. +2021-10-26 Richard Purdie -Signed-off-by: Robert Yang -Signed-off-by: Khem Raj +gcc/ChangeLog: -RP: gcc then added *.h and *.def additions to this list, breaking the original -fix. Add the sort to the original gcc code, leaving the tr+sort to fix the original -issue but include the new files too as reported by Zhuang + * Makefile.in: Fix "argument list too long" from install-plugins -Upstream-Status: Pending +Signed-off-by: Richard Purdie + +Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582722.html] +Upstream-Status: Backport [https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=66e157188bd2f789809e17e85f917534c9381599] --- gcc/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/gcc/Makefile.in b/gcc/Makefile.in -index a67d2cc18d6..480c9366418 100644 ---- a/gcc/Makefile.in -+++ b/gcc/Makefile.in -@@ -3606,7 +3606,7 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype - # We keep the directory structure for files in config or c-family and .def - # files. All other files are flattened to a single directory. +Index: gcc-11.2.0/gcc/Makefile.in +=================================================================== +--- gcc-11.2.0.orig/gcc/Makefile.in ++++ gcc-11.2.0/gcc/Makefile.in +@@ -3678,7 +3678,7 @@ install-plugin: installdirs lang.install + # We keep the directory structure for files in config, common/config or + # c-family and .def files. All other files are flattened to a single directory. $(mkinstalldirs) $(DESTDIR)$(plugin_includedir) - headers=`echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \ + headers=`echo $(sort $(PLUGIN_HEADERS)) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \ diff --git a/recipes-devtools/gcc/gcc-arc/0013-Disable-sdt.patch b/recipes-devtools/gcc/gcc-arc/0013-Disable-sdt.patch deleted file mode 100644 index 207cdb5..0000000 --- a/recipes-devtools/gcc/gcc-arc/0013-Disable-sdt.patch +++ /dev/null @@ -1,110 +0,0 @@ -From fa47586935a18ecfc2ad5586802e326e21741b7b Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 29 Mar 2013 09:28:10 +0400 -Subject: [PATCH] Disable sdt. - -We don't list dtrace in DEPENDS so we shouldn't be depending on this header. -It may or may not exist from preivous builds though. To be determinstic, disable -sdt.h usage always. This avoids build failures if the header is removed after configure -but before libgcc is compiled for example. - -RP 2012/8/7 - -Signed-off-by: Khem Raj - -Disable sdt for libstdc++-v3. - -Signed-off-by: Robert Yang - -Upstream-Status: Inappropriate [hack] ---- - gcc/configure | 12 ++++++------ - gcc/configure.ac | 18 +++++++++--------- - libstdc++-v3/configure | 6 +++--- - libstdc++-v3/configure.ac | 2 +- - 4 files changed, 19 insertions(+), 19 deletions(-) - -diff --git a/gcc/configure b/gcc/configure -index b26e8fc7fee..6080f86145e 100755 ---- a/gcc/configure -+++ b/gcc/configure -@@ -29789,12 +29789,12 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5 - $as_echo_n "checking sys/sdt.h in the target C library... " >&6; } - have_sys_sdt_h=no --if test -f $target_header_dir/sys/sdt.h; then -- have_sys_sdt_h=yes -- --$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h -- --fi -+#if test -f $target_header_dir/sys/sdt.h; then -+# have_sys_sdt_h=yes -+# -+#$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h -+# -+#fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5 - $as_echo "$have_sys_sdt_h" >&6; } - -diff --git a/gcc/configure.ac b/gcc/configure.ac -index 26fa46802c7..42be5252778 100644 ---- a/gcc/configure.ac -+++ b/gcc/configure.ac -@@ -6190,15 +6190,15 @@ fi - AC_SUBST([enable_default_ssp]) - - # Test for on the target. --GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H]) --AC_MSG_CHECKING(sys/sdt.h in the target C library) --have_sys_sdt_h=no --if test -f $target_header_dir/sys/sdt.h; then -- have_sys_sdt_h=yes -- AC_DEFINE(HAVE_SYS_SDT_H, 1, -- [Define if your target C library provides sys/sdt.h]) --fi --AC_MSG_RESULT($have_sys_sdt_h) -+#GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H]) -+#AC_MSG_CHECKING(sys/sdt.h in the target C library) -+#have_sys_sdt_h=no -+#if test -f $target_header_dir/sys/sdt.h; then -+# have_sys_sdt_h=yes -+# AC_DEFINE(HAVE_SYS_SDT_H, 1, -+# [Define if your target C library provides sys/sdt.h]) -+#fi -+#AC_MSG_RESULT($have_sys_sdt_h) - - # Check if TFmode long double should be used by default or not. - # Some glibc targets used DFmode long double, but with glibc 2.4 -diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure -index 9f9c5a2419a..71ed13b815b 100755 ---- a/libstdc++-v3/configure -+++ b/libstdc++-v3/configure -@@ -22615,11 +22615,11 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' - ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' - ac_compiler_gnu=$ac_cv_c_compiler_gnu - -- if test $glibcxx_cv_sys_sdt_h = yes; then -+# if test $glibcxx_cv_sys_sdt_h = yes; then - --$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h -+#$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h - -- fi -+# fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_sys_sdt_h" >&5 - $as_echo "$glibcxx_cv_sys_sdt_h" >&6; } - -diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac -index 699e55fd829..5c7a7bda439 100644 ---- a/libstdc++-v3/configure.ac -+++ b/libstdc++-v3/configure.ac -@@ -241,7 +241,7 @@ GLIBCXX_CHECK_SC_NPROCESSORS_ONLN - GLIBCXX_CHECK_SC_NPROC_ONLN - GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP - GLIBCXX_CHECK_SYSCTL_HW_NCPU --GLIBCXX_CHECK_SDT_H -+#GLIBCXX_CHECK_SDT_H - - # Check for available headers. - AC_CHECK_HEADERS([endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \ diff --git a/recipes-devtools/gcc/gcc-arc/0014-libtool.patch b/recipes-devtools/gcc/gcc-arc/0014-libtool.patch index f4e70c3..f2b8924 100644 --- a/recipes-devtools/gcc/gcc-arc/0014-libtool.patch +++ b/recipes-devtools/gcc/gcc-arc/0014-libtool.patch @@ -1,4 +1,4 @@ -From 6ecd478881468934444ff85611fd43f7033b1e81 Mon Sep 17 00:00:00 2001 +From a5b984db9669cf38a7bd76c3fcdb41c086f740db Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 29 Mar 2013 09:29:11 +0400 Subject: [PATCH] libtool diff --git a/recipes-devtools/gcc/gcc-arc/0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch b/recipes-devtools/gcc/gcc-arc/0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch index bc2674a..1ccf39c 100644 --- a/recipes-devtools/gcc/gcc-arc/0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch +++ b/recipes-devtools/gcc/gcc-arc/0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch @@ -1,4 +1,4 @@ -From de4427fa49c07dc651ee6ceaf5c5078700ca3b08 Mon Sep 17 00:00:00 2001 +From 0ae7090dec149cb2ff0c87eef87c043d4000ece1 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 29 Mar 2013 09:30:32 +0400 Subject: [PATCH] gcc: armv4: pass fix-v4bx to linker to support EABI. @@ -19,7 +19,7 @@ Upstream-Status: Pending 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h -index 0c0332f317f..7b3769e8459 100644 +index 6bd95855827..77befab5da8 100644 --- a/gcc/config/arm/linux-eabi.h +++ b/gcc/config/arm/linux-eabi.h @@ -91,10 +91,14 @@ diff --git a/recipes-devtools/gcc/gcc-arc/0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch b/recipes-devtools/gcc/gcc-arc/0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch index 1dc4bb8..bde7ec6 100644 --- a/recipes-devtools/gcc/gcc-arc/0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch +++ b/recipes-devtools/gcc/gcc-arc/0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch @@ -1,4 +1,4 @@ -From 6b363c2c1c089ee900efa6013aefba1003840a37 Mon Sep 17 00:00:00 2001 +From 5ce8aa4615a3816d12c43752323154744517ae9f Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 29 Mar 2013 09:33:04 +0400 Subject: [PATCH] Use the multilib config files from ${B} instead of using the @@ -18,10 +18,10 @@ Upstream-Status: Inappropriate [configuration] 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/gcc/configure b/gcc/configure -index 6080f86145e..825a9652329 100755 +index 5160917d73e..e663052cad2 100755 --- a/gcc/configure +++ b/gcc/configure -@@ -12685,10 +12685,20 @@ done +@@ -13070,10 +13070,20 @@ done tmake_file_= for f in ${tmake_file} do @@ -46,7 +46,7 @@ index 6080f86145e..825a9652329 100755 done tmake_file="${tmake_file_}${omp_device_property_tmake_file}" -@@ -12699,6 +12709,10 @@ tm_file_list="options.h" +@@ -13084,6 +13094,10 @@ tm_file_list="options.h" tm_include_list="options.h insn-constants.h" for f in $tm_file; do case $f in @@ -58,10 +58,10 @@ index 6080f86145e..825a9652329 100755 f=`echo $f | sed 's/^..//'` tm_file_list="${tm_file_list} $f" diff --git a/gcc/configure.ac b/gcc/configure.ac -index 42be5252778..6099eb3251f 100644 +index 50f78308e8a..2b84875b028 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac -@@ -2118,10 +2118,20 @@ done +@@ -2243,10 +2243,20 @@ done tmake_file_= for f in ${tmake_file} do @@ -86,7 +86,7 @@ index 42be5252778..6099eb3251f 100644 done tmake_file="${tmake_file_}${omp_device_property_tmake_file}" -@@ -2132,6 +2142,10 @@ tm_file_list="options.h" +@@ -2257,6 +2267,10 @@ tm_file_list="options.h" tm_include_list="options.h insn-constants.h" for f in $tm_file; do case $f in diff --git a/recipes-devtools/gcc/gcc-arc/0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch b/recipes-devtools/gcc/gcc-arc/0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch index 05f1284..3e0a1b4 100644 --- a/recipes-devtools/gcc/gcc-arc/0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch +++ b/recipes-devtools/gcc/gcc-arc/0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch @@ -1,4 +1,4 @@ -From 08752c2f1d21553301bee5757c453c6a36cbe03c Mon Sep 17 00:00:00 2001 +From 75a1ce0265ca123f74f17a40ad8bd8f26d9c2ab3 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 20 Feb 2015 09:39:38 +0000 Subject: [PATCH] Avoid using libdir from .la which usually points to a host diff --git a/recipes-devtools/gcc/gcc-arc/0018-export-CPP.patch b/recipes-devtools/gcc/gcc-arc/0018-export-CPP.patch index 886a122..86ab657 100644 --- a/recipes-devtools/gcc/gcc-arc/0018-export-CPP.patch +++ b/recipes-devtools/gcc/gcc-arc/0018-export-CPP.patch @@ -1,50 +1,199 @@ -From 5c3d66378c7ff60ca11a875aa4aa6f8a8529d43a Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 20 Feb 2015 09:40:59 +0000 -Subject: [PATCH] export CPP - -The OE environment sets and exports CPP as being the target gcc. When -building gcc-cross-canadian for a mingw targetted sdk, the following can be found -in build.x86_64-pokysdk-mingw32.i586-poky-linux/build-x86_64-linux/libiberty/config.log: - -configure:3641: checking for _FILE_OFFSET_BITS value needed for large files -configure:3666: gcc -c -isystem/media/build1/poky/build/tmp/sysroots/x86_64-linux/usr/include -O2 -pipe conftest.c >&5 -configure:3666: $? = 0 -configure:3698: result: no +From: Richard Purdie +Subject: [PATCH 1/5] Makefile.in: Ensure build CPP/CPPFLAGS is used for build targets + +During cross compiling, CPP is being set to the target compiler even for +build targets. As an example, when building a cross compiler targetting +mingw, the config.log for libiberty in +build.x86_64-pokysdk-mingw32.i586-poky-linux/build-x86_64-linux/libiberty/config.log +shows: + configure:3786: checking how to run the C preprocessor -configure:3856: result: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32 -configure:3876: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32 conftest.c +configure:3856: result: x86_64-pokysdk-mingw32-gcc -E --sysroot=[sysroot]/x86_64-nativesdk-mingw32-pokysdk-mingw32 +configure:3876: x86_64-pokysdk-mingw32-gcc -E --sysroot=[sysroot]/x86_64-nativesdk-mingw32-pokysdk-mingw32 conftest.c configure:3876: $? = 0 -Note this is a *build* target (in build-x86_64-linux) so it should be -using the host "gcc", not x86_64-pokysdk-mingw32-gcc. Since the mingw32 -headers are very different, using the wrong cpp is a real problem. It is leaking -into configure through the CPP variable. Ultimately this leads to build -failures related to not being able to include a process.h file for pem-unix.c. +This is libiberty being built for the build environment, not the target one +(i.e. in build-x86_64-linux). As such it should be using the build environment's +gcc and not the target one. In the mingw case the system headers are quite +different leading to build failures related to not being able to include a +process.h file for pem-unix.c. + +Further analysis shows the same issue occuring for CPPFLAGS too. + +Fix this by adding support for CPP_FOR_BUILD and CPPFLAGS_FOR_BUILD which +for example, avoids mixing the mingw headers for host binaries on linux +systems. + +2021-10-27 Richard Purdie + +ChangeLog: -The fix is to ensure we export a sane CPP value into the build -environment when using build targets. We could define a CPP_FOR_BUILD value which may be -the version which needs to be upstreamed but for now, this fix is good enough to -avoid the problem. + * Makefile.tpl: Add CPP_FOR_BUILD and CPPFLAGS_FOR_BUILD support + * Makefile.in: Regenerate. + * configure: Regenerate. + * configure.ac: Add CPP_FOR_BUILD and CPPFLAGS_FOR_BUILD support -RP 22/08/2013 +gcc/ChangeLog: -Upstream-Status: Pending + * configure: Regenerate. + * configure.ac: Use CPPFLAGS_FOR_BUILD for GMPINC -Signed-off-by: Khem Raj +Signed-off-by: Richard Purdie + +Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582727.html] +Upstream-Status: Backport [https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=84401ce5fb4ecab55decb472b168100e7593e01f] --- - Makefile.in | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/Makefile.in b/Makefile.in -index 36e369df6e7..c717903bb13 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -149,6 +149,7 @@ BUILD_EXPORTS = \ - AR="$(AR_FOR_BUILD)"; export AR; \ - AS="$(AS_FOR_BUILD)"; export AS; \ + Makefile.in | 6 ++++++ + Makefile.tpl | 6 ++++++ + configure | 4 ++++ + configure.ac | 4 ++++ + gcc/configure | 2 +- + gcc/configure.ac | 2 +- + 6 files changed, 22 insertions(+), 2 deletions(-) + +Index: gcc-11.2.0/Makefile.in +=================================================================== +--- gcc-11.2.0.orig/Makefile.in ++++ gcc-11.2.0/Makefile.in +@@ -151,6 +151,8 @@ BUILD_EXPORTS = \ + CC="$(CC_FOR_BUILD)"; export CC; \ + CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ ++ CPP="$(CPP_FOR_BUILD)"; export CPP; \ ++ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \ + CXX="$(CXX_FOR_BUILD)"; export CXX; \ + CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \ + GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \ +@@ -198,6 +200,8 @@ HOST_EXPORTS = \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ ++ CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \ ++ CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \ + CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ +@@ -353,6 +357,8 @@ AR_FOR_BUILD = @AR_FOR_BUILD@ + AS_FOR_BUILD = @AS_FOR_BUILD@ + CC_FOR_BUILD = @CC_FOR_BUILD@ + CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ ++CPP_FOR_BUILD = @CPP_FOR_BUILD@ ++CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ + CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@ + CXX_FOR_BUILD = @CXX_FOR_BUILD@ + DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@ +Index: gcc-11.2.0/Makefile.tpl +=================================================================== +--- gcc-11.2.0.orig/Makefile.tpl ++++ gcc-11.2.0/Makefile.tpl +@@ -154,6 +154,8 @@ BUILD_EXPORTS = \ CC="$(CC_FOR_BUILD)"; export CC; \ -+ CPP="$(CC_FOR_BUILD) -E"; export CPP; \ CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ ++ CPP="$(CPP_FOR_BUILD)"; export CPP; \ ++ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \ CXX="$(CXX_FOR_BUILD)"; export CXX; \ + CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \ + GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \ +@@ -201,6 +203,8 @@ HOST_EXPORTS = \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ ++ CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \ ++ CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \ + CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ +@@ -356,6 +360,8 @@ AR_FOR_BUILD = @AR_FOR_BUILD@ + AS_FOR_BUILD = @AS_FOR_BUILD@ + CC_FOR_BUILD = @CC_FOR_BUILD@ + CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ ++CPP_FOR_BUILD = @CPP_FOR_BUILD@ ++CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ + CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@ + CXX_FOR_BUILD = @CXX_FOR_BUILD@ + DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@ +Index: gcc-11.2.0/configure +=================================================================== +--- gcc-11.2.0.orig/configure ++++ gcc-11.2.0/configure +@@ -652,6 +652,8 @@ GFORTRAN_FOR_BUILD + DLLTOOL_FOR_BUILD + CXX_FOR_BUILD + CXXFLAGS_FOR_BUILD ++CPPFLAGS_FOR_BUILD ++CPP_FOR_BUILD + CFLAGS_FOR_BUILD + CC_FOR_BUILD + AS_FOR_BUILD +@@ -4092,6 +4094,7 @@ if test "${build}" != "${host}" ; then + AR_FOR_BUILD=${AR_FOR_BUILD-ar} + AS_FOR_BUILD=${AS_FOR_BUILD-as} + CC_FOR_BUILD=${CC_FOR_BUILD-gcc} ++ CPP_FOR_BUILD="${CPP_FOR_BUILD-\$(CPP)}" + CXX_FOR_BUILD=${CXX_FOR_BUILD-g++} + GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran} + GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo} +@@ -9809,6 +9812,7 @@ esac + # our build compiler if desired. + if test x"${build}" = x"${host}" ; then + CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}} ++ CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-${CPPFLAGS}} + CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}} + LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}} + fi +Index: gcc-11.2.0/configure.ac +=================================================================== +--- gcc-11.2.0.orig/configure.ac ++++ gcc-11.2.0/configure.ac +@@ -1347,6 +1347,7 @@ if test "${build}" != "${host}" ; then + AR_FOR_BUILD=${AR_FOR_BUILD-ar} + AS_FOR_BUILD=${AS_FOR_BUILD-as} + CC_FOR_BUILD=${CC_FOR_BUILD-gcc} ++ CPP_FOR_BUILD="${CPP_FOR_BUILD-\$(CPP)}" + CXX_FOR_BUILD=${CXX_FOR_BUILD-g++} + GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran} + GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo} +@@ -3321,6 +3322,7 @@ esac + # our build compiler if desired. + if test x"${build}" = x"${host}" ; then + CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}} ++ CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-${CPPFLAGS}} + CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}} + LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}} + fi +@@ -3387,6 +3389,8 @@ AC_SUBST(AR_FOR_BUILD) + AC_SUBST(AS_FOR_BUILD) + AC_SUBST(CC_FOR_BUILD) + AC_SUBST(CFLAGS_FOR_BUILD) ++AC_SUBST(CPP_FOR_BUILD) ++AC_SUBST(CPPFLAGS_FOR_BUILD) + AC_SUBST(CXXFLAGS_FOR_BUILD) + AC_SUBST(CXX_FOR_BUILD) + AC_SUBST(DLLTOOL_FOR_BUILD) +Index: gcc-11.2.0/gcc/configure +=================================================================== +--- gcc-11.2.0.orig/gcc/configure ++++ gcc-11.2.0/gcc/configure +@@ -12699,7 +12699,7 @@ else + CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ + CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \ + LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \ +- GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \ ++ GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \ + ${realsrcdir}/configure \ + --enable-languages=${enable_languages-all} \ + ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \ +Index: gcc-11.2.0/gcc/configure.ac +=================================================================== +--- gcc-11.2.0.orig/gcc/configure.ac ++++ gcc-11.2.0/gcc/configure.ac +@@ -2023,7 +2023,7 @@ else + CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ + CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \ + LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \ +- GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \ ++ GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \ + ${realsrcdir}/configure \ + --enable-languages=${enable_languages-all} \ + ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \ diff --git a/recipes-devtools/gcc/gcc-arc/0019-Ensure-target-gcc-headers-can-be-included.patch b/recipes-devtools/gcc/gcc-arc/0019-Ensure-target-gcc-headers-can-be-included.patch index 2797b2c..120d5a2 100644 --- a/recipes-devtools/gcc/gcc-arc/0019-Ensure-target-gcc-headers-can-be-included.patch +++ b/recipes-devtools/gcc/gcc-arc/0019-Ensure-target-gcc-headers-can-be-included.patch @@ -1,4 +1,4 @@ -From 378b752c5d9a3dba4e58cdadf8b4b4f34ea99a76 Mon Sep 17 00:00:00 2001 +From 6f410ed8fb7eee11ba7a25634c2257666b98ef52 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 20 Feb 2015 10:25:11 +0000 Subject: [PATCH] Ensure target gcc headers can be included @@ -11,20 +11,24 @@ found by gcc with the existing search paths. Add support for picking up these headers under the sysroot supplied on the gcc command line in order to resolve this. +Extend target gcc headers search to musl too + Upstream-Status: Pending Signed-off-by: Paul Eggleton Signed-off-by: Khem Raj --- - gcc/Makefile.in | 2 ++ - gcc/cppdefault.c | 4 ++++ - 2 files changed, 6 insertions(+) + gcc/Makefile.in | 2 ++ + gcc/config/linux.h | 8 ++++++++ + gcc/config/rs6000/sysv4.h | 8 ++++++++ + gcc/cppdefault.c | 4 ++++ + 4 files changed, 22 insertions(+) diff --git a/gcc/Makefile.in b/gcc/Makefile.in -index 480c9366418..011c7ac2db6 100644 +index 59c45c81393..9b17d120aa1 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in -@@ -618,6 +618,7 @@ libexecdir = @libexecdir@ +@@ -630,6 +630,7 @@ libexecdir = @libexecdir@ # Directory in which the compiler finds libraries etc. libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix) @@ -32,7 +36,7 @@ index 480c9366418..011c7ac2db6 100644 # Directory in which the compiler finds executables libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix) # Directory in which all plugin resources are installed -@@ -2946,6 +2947,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\" +@@ -3016,6 +3017,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\" PREPROCESSOR_DEFINES = \ -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \ @@ -40,11 +44,63 @@ index 480c9366418..011c7ac2db6 100644 -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \ -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \ -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \ +diff --git a/gcc/config/linux.h b/gcc/config/linux.h +index 87efc5f69fe..b525bcd56b3 100644 +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -165,6 +165,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + #define INCLUDE_DEFAULTS_MUSL_TOOL + #endif + ++#ifdef GCC_INCLUDE_SUBDIR_TARGET ++#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \ ++ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET ++#endif ++ + #ifdef NATIVE_SYSTEM_HEADER_DIR + #define INCLUDE_DEFAULTS_MUSL_NATIVE \ + { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ +@@ -191,6 +198,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + INCLUDE_DEFAULTS_MUSL_PREFIX \ + INCLUDE_DEFAULTS_MUSL_CROSS \ + INCLUDE_DEFAULTS_MUSL_TOOL \ ++ INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \ + INCLUDE_DEFAULTS_MUSL_NATIVE \ + { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ + { 0, 0, 0, 0, 0, 0 } \ +diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h +index 510abe169c5..0c2bba5ea32 100644 +--- a/gcc/config/rs6000/sysv4.h ++++ b/gcc/config/rs6000/sysv4.h +@@ -995,6 +995,13 @@ ncrtn.o%s" + #define INCLUDE_DEFAULTS_MUSL_TOOL + #endif + ++#ifdef GCC_INCLUDE_SUBDIR_TARGET ++#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \ ++ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET ++#endif ++ + #ifdef NATIVE_SYSTEM_HEADER_DIR + #define INCLUDE_DEFAULTS_MUSL_NATIVE \ + { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ +@@ -1021,6 +1028,7 @@ ncrtn.o%s" + INCLUDE_DEFAULTS_MUSL_PREFIX \ + INCLUDE_DEFAULTS_MUSL_CROSS \ + INCLUDE_DEFAULTS_MUSL_TOOL \ ++ INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \ + INCLUDE_DEFAULTS_MUSL_NATIVE \ + { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ + { 0, 0, 0, 0, 0, 0 } \ diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c -index af38cc494ea..2f43b88a0c3 100644 +index c503d14fc3f..d54d6ce0076 100644 --- a/gcc/cppdefault.c +++ b/gcc/cppdefault.c -@@ -59,6 +59,10 @@ const struct default_include cpp_include_defaults[] +@@ -64,6 +64,10 @@ const struct default_include cpp_include_defaults[] /* This is the dir for gcc's private headers. */ { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 }, #endif diff --git a/recipes-devtools/gcc/gcc-arc/0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch b/recipes-devtools/gcc/gcc-arc/0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch index c3baf8b..bb2a367 100644 --- a/recipes-devtools/gcc/gcc-arc/0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch +++ b/recipes-devtools/gcc/gcc-arc/0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch @@ -1,4 +1,4 @@ -From 870e805d705d99d9b9d7dbd09727f9c1d2ad9c1d Mon Sep 17 00:00:00 2001 +From cd09adb1e7f2a7e81a9f595a17c36f24911b90ac Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 3 Mar 2015 08:21:19 +0000 Subject: [PATCH] Don't search host directory during "relink" if $inst_prefix diff --git a/recipes-devtools/gcc/gcc-arc/0021-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch b/recipes-devtools/gcc/gcc-arc/0021-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch deleted file mode 100644 index abee486..0000000 --- a/recipes-devtools/gcc/gcc-arc/0021-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch +++ /dev/null @@ -1,26 +0,0 @@ -From aba42de763a619355471efd1573561b0cbf51162 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Tue, 28 Apr 2015 23:15:27 -0700 -Subject: [PATCH] Use SYSTEMLIBS_DIR replacement instead of hardcoding - base_libdir - -Upstream-Status: Pending - -Signed-off-by: Khem Raj ---- - gcc/config/aarch64/aarch64-linux.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h -index e587e2e9ad6..ddc62895693 100644 ---- a/gcc/config/aarch64/aarch64-linux.h -+++ b/gcc/config/aarch64/aarch64-linux.h -@@ -21,7 +21,7 @@ - #ifndef GCC_AARCH64_LINUX_H - #define GCC_AARCH64_LINUX_H - --#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" -+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" - - #undef MUSL_DYNAMIC_LINKER - #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" diff --git a/recipes-devtools/gcc/gcc-arc/0022-aarch64-Add-support-for-musl-ldso.patch b/recipes-devtools/gcc/gcc-arc/0022-aarch64-Add-support-for-musl-ldso.patch deleted file mode 100644 index c55b66d..0000000 --- a/recipes-devtools/gcc/gcc-arc/0022-aarch64-Add-support-for-musl-ldso.patch +++ /dev/null @@ -1,25 +0,0 @@ -From d63820a78d92f302410358293546f01c7ad17bd8 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Tue, 28 Apr 2015 23:18:39 -0700 -Subject: [PATCH] aarch64: Add support for musl ldso - -Upstream-Status: Pending - -Signed-off-by: Khem Raj ---- - gcc/config/aarch64/aarch64-linux.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h -index ddc62895693..b301825313a 100644 ---- a/gcc/config/aarch64/aarch64-linux.h -+++ b/gcc/config/aarch64/aarch64-linux.h -@@ -24,7 +24,7 @@ - #define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" - - #undef MUSL_DYNAMIC_LINKER --#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" -+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" - - #undef ASAN_CC1_SPEC - #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}" diff --git a/recipes-devtools/gcc/gcc-arc/0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch b/recipes-devtools/gcc/gcc-arc/0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch index 80c4d22..fb4511c 100644 --- a/recipes-devtools/gcc/gcc-arc/0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch +++ b/recipes-devtools/gcc/gcc-arc/0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch @@ -1,4 +1,4 @@ -From 3474e16ad4ea8cf4e0e330568e3bc9039e723dce Mon Sep 17 00:00:00 2001 +From 2cfc5ee38b3f5ec1d7965aae0991bcd48b5dc2e6 Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Sun, 5 Jul 2015 20:25:18 -0700 Subject: [PATCH] libcc1: fix libcc1's install path and rpath @@ -20,10 +20,10 @@ Signed-off-by: Robert Yang 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libcc1/Makefile.am b/libcc1/Makefile.am -index c005b0dad4a..ec31d35b7b9 100644 +index f148fdd7aa2..0b6eb8f2855 100644 --- a/libcc1/Makefile.am +++ b/libcc1/Makefile.am -@@ -37,8 +37,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \ +@@ -40,8 +40,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \ $(Wc)$(libiberty_normal))) libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty)) @@ -35,10 +35,10 @@ index c005b0dad4a..ec31d35b7b9 100644 if ENABLE_PLUGIN plugin_LTLIBRARIES = libcc1plugin.la libcp1plugin.la diff --git a/libcc1/Makefile.in b/libcc1/Makefile.in -index 7104b649026..2103c477468 100644 +index 753d435c9cb..455627b0a3b 100644 --- a/libcc1/Makefile.in +++ b/libcc1/Makefile.in -@@ -393,8 +393,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \ +@@ -398,8 +398,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \ $(Wc)$(libiberty_normal))) libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty)) diff --git a/recipes-devtools/gcc/gcc-arc/0024-handle-sysroot-support-for-nativesdk-gcc.patch b/recipes-devtools/gcc/gcc-arc/0024-handle-sysroot-support-for-nativesdk-gcc.patch index dc3e6da..b1054fa 100644 --- a/recipes-devtools/gcc/gcc-arc/0024-handle-sysroot-support-for-nativesdk-gcc.patch +++ b/recipes-devtools/gcc/gcc-arc/0024-handle-sysroot-support-for-nativesdk-gcc.patch @@ -1,4 +1,4 @@ -From 702daf2e9cb97337e0e594fcd435b1b61a917d14 Mon Sep 17 00:00:00 2001 +From 354682ad8f71f62643dcd83f64b51b5979615a0c Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 7 Dec 2015 23:39:54 +0000 Subject: [PATCH] handle sysroot support for nativesdk-gcc @@ -23,6 +23,9 @@ b) Add other paths which need relocation into a .gccrelocprefix section Upstream-Status: Inappropriate RP 2015/7/28 +Extend the gccrelocprefix support to musl config too, this ensures +that gcc will get right bits in SDK installations + Signed-off-by: Khem Raj Added PREFIXVAR and EXEC_PREFIXVAR to support runtime relocation. Without @@ -32,19 +35,21 @@ implementation.) Signed-off-by: Mark Hatle --- - gcc/c-family/c-opts.c | 4 +-- - gcc/cppdefault.c | 63 ++++++++++++++++++++++++++----------------- - gcc/cppdefault.h | 13 ++++----- - gcc/gcc.c | 20 +++++++++----- - gcc/incpath.c | 12 ++++----- - gcc/prefix.c | 6 +++-- - 6 files changed, 70 insertions(+), 48 deletions(-) + gcc/c-family/c-opts.c | 4 +-- + gcc/config/linux.h | 24 +++++++-------- + gcc/config/rs6000/sysv4.h | 24 +++++++-------- + gcc/cppdefault.c | 63 ++++++++++++++++++++++++--------------- + gcc/cppdefault.h | 13 ++++---- + gcc/gcc.c | 20 +++++++++---- + gcc/incpath.c | 12 ++++---- + gcc/prefix.c | 6 ++-- + 8 files changed, 94 insertions(+), 72 deletions(-) diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c -index 58ba0948e79..806bbcfb7a5 100644 +index 89e05a4c551..5577383665d 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c -@@ -1409,8 +1409,8 @@ add_prefixed_path (const char *suffix, incpath_kind chain) +@@ -1436,8 +1436,8 @@ add_prefixed_path (const char *suffix, incpath_kind chain) size_t prefix_len, suffix_len; suffix_len = strlen (suffix); @@ -55,8 +60,164 @@ index 58ba0948e79..806bbcfb7a5 100644 path = (char *) xmalloc (prefix_len + suffix_len + 1); memcpy (path, prefix, prefix_len); +diff --git a/gcc/config/linux.h b/gcc/config/linux.h +index b525bcd56b3..ba02c013e30 100644 +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -129,53 +129,53 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + * Unfortunately, this is mostly duplicated from cppdefault.c */ + #if DEFAULT_LIBC == LIBC_MUSL + #define INCLUDE_DEFAULTS_MUSL_GPP \ +- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \ ++ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1, \ + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \ +- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \ ++ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1, \ + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \ +- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \ ++ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1, \ + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, + + #ifdef LOCAL_INCLUDE_DIR + #define INCLUDE_DEFAULTS_MUSL_LOCAL \ +- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \ +- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 }, ++ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 }, \ ++ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 }, + #else + #define INCLUDE_DEFAULTS_MUSL_LOCAL + #endif + + #ifdef PREFIX_INCLUDE_DIR + #define INCLUDE_DEFAULTS_MUSL_PREFIX \ +- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0}, ++ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0}, + #else + #define INCLUDE_DEFAULTS_MUSL_PREFIX + #endif + + #ifdef CROSS_INCLUDE_DIR + #define INCLUDE_DEFAULTS_MUSL_CROSS \ +- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0}, ++ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0}, + #else + #define INCLUDE_DEFAULTS_MUSL_CROSS + #endif + + #ifdef TOOL_INCLUDE_DIR + #define INCLUDE_DEFAULTS_MUSL_TOOL \ +- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0}, ++ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0}, + #else + #define INCLUDE_DEFAULTS_MUSL_TOOL + #endif + + #ifdef GCC_INCLUDE_SUBDIR_TARGET + #define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \ +- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0}, ++ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0}, + #else + #define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET + #endif + + #ifdef NATIVE_SYSTEM_HEADER_DIR + #define INCLUDE_DEFAULTS_MUSL_NATIVE \ +- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ +- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, ++ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 2 }, \ ++ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 0 }, + #else + #define INCLUDE_DEFAULTS_MUSL_NATIVE + #endif +@@ -200,7 +200,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + INCLUDE_DEFAULTS_MUSL_TOOL \ + INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \ + INCLUDE_DEFAULTS_MUSL_NATIVE \ +- { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ ++ { GCC_INCLUDE_DIRVAR, "GCC", 0, 1, 0, 0 }, \ + { 0, 0, 0, 0, 0, 0 } \ + } + #endif +diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h +index 0c2bba5ea32..313a8de4417 100644 +--- a/gcc/config/rs6000/sysv4.h ++++ b/gcc/config/rs6000/sysv4.h +@@ -959,53 +959,53 @@ ncrtn.o%s" + /* Include order changes for musl, same as in generic linux.h. */ + #if DEFAULT_LIBC == LIBC_MUSL + #define INCLUDE_DEFAULTS_MUSL_GPP \ +- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \ ++ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1, \ + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \ +- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \ ++ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1, \ + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \ +- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \ ++ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1, \ + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, + + #ifdef LOCAL_INCLUDE_DIR + #define INCLUDE_DEFAULTS_MUSL_LOCAL \ +- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \ +- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 }, ++ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 }, \ ++ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 }, + #else + #define INCLUDE_DEFAULTS_MUSL_LOCAL + #endif + + #ifdef PREFIX_INCLUDE_DIR + #define INCLUDE_DEFAULTS_MUSL_PREFIX \ +- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0}, ++ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0}, + #else + #define INCLUDE_DEFAULTS_MUSL_PREFIX + #endif + + #ifdef CROSS_INCLUDE_DIR + #define INCLUDE_DEFAULTS_MUSL_CROSS \ +- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0}, ++ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0}, + #else + #define INCLUDE_DEFAULTS_MUSL_CROSS + #endif + + #ifdef TOOL_INCLUDE_DIR + #define INCLUDE_DEFAULTS_MUSL_TOOL \ +- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0}, ++ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0}, + #else + #define INCLUDE_DEFAULTS_MUSL_TOOL + #endif + + #ifdef GCC_INCLUDE_SUBDIR_TARGET + #define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \ +- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0}, ++ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0}, + #else + #define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET + #endif + + #ifdef NATIVE_SYSTEM_HEADER_DIR + #define INCLUDE_DEFAULTS_MUSL_NATIVE \ +- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ +- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, ++ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 2 }, \ ++ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 0 }, + #else + #define INCLUDE_DEFAULTS_MUSL_NATIVE + #endif +@@ -1030,7 +1030,7 @@ ncrtn.o%s" + INCLUDE_DEFAULTS_MUSL_TOOL \ + INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \ + INCLUDE_DEFAULTS_MUSL_NATIVE \ +- { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ ++ { GCC_INCLUDE_DIRVAR, "GCC", 0, 1, 0, 0 }, \ + { 0, 0, 0, 0, 0, 0 } \ + } + #endif diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c -index 2f43b88a0c3..6b6be04686c 100644 +index d54d6ce0076..784a92a0c24 100644 --- a/gcc/cppdefault.c +++ b/gcc/cppdefault.c @@ -35,6 +35,30 @@ @@ -90,7 +251,7 @@ index 2f43b88a0c3..6b6be04686c 100644 const struct default_include cpp_include_defaults[] #ifdef INCLUDE_DEFAULTS = INCLUDE_DEFAULTS; -@@ -42,38 +66,38 @@ const struct default_include cpp_include_defaults[] +@@ -42,17 +66,17 @@ const struct default_include cpp_include_defaults[] = { #ifdef GPLUSPLUS_INCLUDE_DIR /* Pick up GNU C++ generic include files. */ @@ -110,6 +271,9 @@ index 2f43b88a0c3..6b6be04686c 100644 + { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1, GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, #endif + #ifdef GPLUSPLUS_LIBCXX_INCLUDE_DIR +@@ -62,23 +86,23 @@ const struct default_include cpp_include_defaults[] + #endif #ifdef GCC_INCLUDE_DIR /* This is the dir for gcc's private headers. */ - { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 }, @@ -138,7 +302,7 @@ index 2f43b88a0c3..6b6be04686c 100644 /* A multilib suffix needs adding if different multilibs use different headers. */ #ifdef SYSROOT_HEADERS_SUFFIX_SPEC -@@ -85,33 +109,24 @@ const struct default_include cpp_include_defaults[] +@@ -90,33 +114,24 @@ const struct default_include cpp_include_defaults[] #endif #ifdef CROSS_INCLUDE_DIR /* One place the target system's headers might be. */ @@ -179,7 +343,7 @@ index 2f43b88a0c3..6b6be04686c 100644 /* This value is set by cpp_relocated at runtime */ const char *gcc_exec_prefix; diff --git a/gcc/cppdefault.h b/gcc/cppdefault.h -index a681264f75e..5e10a2fa140 100644 +index fd3c655db1c..20669ac427d 100644 --- a/gcc/cppdefault.h +++ b/gcc/cppdefault.h @@ -33,7 +33,8 @@ @@ -191,8 +355,8 @@ index a681264f75e..5e10a2fa140 100644 + const char *const component; /* The component containing the directory (see update_path in prefix.c) */ - const char cplusplus; /* Only look here if we're compiling C++. */ -@@ -50,17 +51,13 @@ struct default_include + const char cplusplus; /* When this is non-zero, we should only +@@ -55,17 +56,13 @@ struct default_include }; extern const struct default_include cpp_include_defaults[]; @@ -214,7 +378,7 @@ index a681264f75e..5e10a2fa140 100644 subdirectory of the actual installation. */ extern const char *gcc_exec_prefix; diff --git a/gcc/gcc.c b/gcc/gcc.c -index c87f603955f..535d5c3bb65 100644 +index 8737bae5353..aa6fbe43965 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -252,6 +252,8 @@ FILE *report_times_to_file = NULL; @@ -226,7 +390,7 @@ index c87f603955f..535d5c3bb65 100644 /* Nonzero means pass the updated target_system_root to the compiler. */ static int target_system_root_changed; -@@ -526,6 +528,7 @@ or with constant text in a single argument. +@@ -568,6 +570,7 @@ or with constant text in a single argument. %G process LIBGCC_SPEC as a spec. %R Output the concatenation of target_system_root and target_sysroot_suffix. @@ -234,7 +398,7 @@ index c87f603955f..535d5c3bb65 100644 %S process STARTFILE_SPEC as a spec. A capital S is actually used here. %E process ENDFILE_SPEC as a spec. A capital E is actually used here. %C process CPP_SPEC as a spec. -@@ -1499,10 +1502,10 @@ static const char *gcc_libexec_prefix; +@@ -1621,10 +1624,10 @@ static const char *gcc_libexec_prefix; gcc_exec_prefix is set because, in that case, we know where the compiler has been installed, and use paths relative to that location instead. */ @@ -249,7 +413,7 @@ index c87f603955f..535d5c3bb65 100644 /* For native compilers, these are well-known paths containing components that may be provided by the system. For cross -@@ -1510,9 +1513,9 @@ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX; +@@ -1632,9 +1635,9 @@ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX; static const char *md_exec_prefix = MD_EXEC_PREFIX; static const char *md_startfile_prefix = MD_STARTFILE_PREFIX; static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1; @@ -261,7 +425,7 @@ index c87f603955f..535d5c3bb65 100644 = STANDARD_STARTFILE_PREFIX_2; /* A relative path to be used in finding the location of tools -@@ -5952,6 +5955,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) +@@ -6564,6 +6567,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) } break; @@ -274,7 +438,7 @@ index c87f603955f..535d5c3bb65 100644 value = do_spec_1 (startfile_spec, 0, NULL); if (value != 0) diff --git a/gcc/incpath.c b/gcc/incpath.c -index 9098ab044ab..bfad4ebe382 100644 +index fbfc0ce03b8..a82e543428b 100644 --- a/gcc/incpath.c +++ b/gcc/incpath.c @@ -131,7 +131,7 @@ add_standard_paths (const char *sysroot, const char *iprefix, @@ -286,7 +450,7 @@ index 9098ab044ab..bfad4ebe382 100644 { /* Look for directories that start with the standard prefix. "Translate" them, i.e. replace /usr/local/lib/gcc... with -@@ -145,7 +145,7 @@ add_standard_paths (const char *sysroot, const char *iprefix, +@@ -146,7 +146,7 @@ add_standard_paths (const char *sysroot, const char *iprefix, now. */ if (sysroot && p->add_sysroot) continue; @@ -295,7 +459,7 @@ index 9098ab044ab..bfad4ebe382 100644 { char *str = concat (iprefix, p->fname + len, NULL); if (p->multilib == 1 && imultilib) -@@ -185,7 +185,7 @@ add_standard_paths (const char *sysroot, const char *iprefix, +@@ -187,7 +187,7 @@ add_standard_paths (const char *sysroot, const char *iprefix, free (sysroot_no_trailing_dir_separator); } else if (!p->add_sysroot && relocated @@ -304,7 +468,7 @@ index 9098ab044ab..bfad4ebe382 100644 { static const char *relocated_prefix; char *ostr; -@@ -202,12 +202,12 @@ add_standard_paths (const char *sysroot, const char *iprefix, +@@ -204,12 +204,12 @@ add_standard_paths (const char *sysroot, const char *iprefix, dummy = concat (gcc_exec_prefix, "dummy", NULL); relocated_prefix = make_relative_prefix (dummy, @@ -321,7 +485,7 @@ index 9098ab044ab..bfad4ebe382 100644 str = update_path (ostr, p->component); free (ostr); diff --git a/gcc/prefix.c b/gcc/prefix.c -index 1a403e535bd..c26d07bde12 100644 +index 747c09de638..f728638dc65 100644 --- a/gcc/prefix.c +++ b/gcc/prefix.c @@ -72,7 +72,9 @@ License along with GCC; see the file COPYING3. If not see @@ -344,6 +508,3 @@ index 1a403e535bd..c26d07bde12 100644 /* We used to strip trailing DIR_SEPARATORs here, but that can sometimes yield a result with no separator when one was coded --- -2.29.2 - diff --git a/recipes-devtools/gcc/gcc-arc/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch b/recipes-devtools/gcc/gcc-arc/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch index abf1f84..ff622b1 100644 --- a/recipes-devtools/gcc/gcc-arc/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch +++ b/recipes-devtools/gcc/gcc-arc/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch @@ -1,4 +1,4 @@ -From 9c0c73ee48dbee2aad57f4dcdad1b7b74e77b944 Mon Sep 17 00:00:00 2001 +From c55e24459370ad96577496ecd87475e3a9de7dad Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 7 Dec 2015 23:41:45 +0000 Subject: [PATCH] Search target sysroot gcc version specific dirs with @@ -51,10 +51,10 @@ Signed-off-by: Khem Raj 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/gcc/gcc.c b/gcc/gcc.c -index 535d5c3bb65..04647ae812d 100644 +index aa6fbe43965..f8a71a13826 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c -@@ -2616,7 +2616,7 @@ for_each_path (const struct path_prefix *paths, +@@ -2811,7 +2811,7 @@ for_each_path (const struct path_prefix *paths, if (path == NULL) { len = paths->max_len + extra_space + 1; @@ -63,7 +63,7 @@ index 535d5c3bb65..04647ae812d 100644 path = XNEWVEC (char, len); } -@@ -2628,6 +2628,33 @@ for_each_path (const struct path_prefix *paths, +@@ -2823,6 +2823,33 @@ for_each_path (const struct path_prefix *paths, /* Look first in MACHINE/VERSION subdirectory. */ if (!skip_multi_dir) { diff --git a/recipes-devtools/gcc/gcc-arc/0026-Fix-various-_FOR_BUILD-and-related-variables.patch b/recipes-devtools/gcc/gcc-arc/0026-Fix-various-_FOR_BUILD-and-related-variables.patch deleted file mode 100644 index 97bf2f3..0000000 --- a/recipes-devtools/gcc/gcc-arc/0026-Fix-various-_FOR_BUILD-and-related-variables.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 3a003af8804dda90fdf4862eca5f66cb12faaf02 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Mon, 7 Dec 2015 23:42:45 +0000 -Subject: [PATCH] Fix various _FOR_BUILD and related variables - -When doing a FOR_BUILD thing, you have to override CFLAGS with -CFLAGS_FOR_BUILD. And if you use C++, you also have to override -CXXFLAGS with CXXFLAGS_FOR_BUILD. -Without this, when building for mingw, you end up trying to use -the mingw headers for a host build. - -The same goes for other variables as well, such as CPPFLAGS, -CPP, and GMPINC. - -Upstream-Status: Pending - -Signed-off-by: Peter Seebach -Signed-off-by: Mark Hatle -Signed-off-by: Khem Raj ---- - Makefile.in | 6 ++++++ - Makefile.tpl | 5 +++++ - gcc/Makefile.in | 2 +- - gcc/configure | 2 +- - gcc/configure.ac | 2 +- - 5 files changed, 14 insertions(+), 3 deletions(-) - -diff --git a/Makefile.in b/Makefile.in -index c717903bb13..5abc649868d 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -152,6 +152,7 @@ BUILD_EXPORTS = \ - CPP="$(CC_FOR_BUILD) -E"; export CPP; \ - CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ -+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \ - CXX="$(CXX_FOR_BUILD)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \ - GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \ -@@ -171,6 +172,9 @@ BUILD_EXPORTS = \ - # built for the build system to override those in BASE_FLAGS_TO_PASS. - EXTRA_BUILD_FLAGS = \ - CFLAGS="$(CFLAGS_FOR_BUILD)" \ -+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \ -+ CPP="$(CC_FOR_BUILD) -E" \ -+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \ - LDFLAGS="$(LDFLAGS_FOR_BUILD)" - - # This is the list of directories to built for the host system. -@@ -188,6 +192,7 @@ HOST_SUBDIR = @host_subdir@ - HOST_EXPORTS = \ - $(BASE_EXPORTS) \ - CC="$(CC)"; export CC; \ -+ CPP="$(CC) -E"; export CPP; \ - ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ -@@ -776,6 +781,7 @@ BASE_FLAGS_TO_PASS = \ - "CC_FOR_BUILD=$(CC_FOR_BUILD)" \ - "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \ - "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \ -+ "CXXFLAGS_FOR_BUILD=$(CXXFLAGS_FOR_BUILD)" \ - "EXPECT=$(EXPECT)" \ - "FLEX=$(FLEX)" \ - "INSTALL=$(INSTALL)" \ -diff --git a/Makefile.tpl b/Makefile.tpl -index efed1511750..778beb705b4 100644 ---- a/Makefile.tpl -+++ b/Makefile.tpl -@@ -154,6 +154,7 @@ BUILD_EXPORTS = \ - CC="$(CC_FOR_BUILD)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ -+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \ - CXX="$(CXX_FOR_BUILD)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \ - GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \ -@@ -173,6 +174,9 @@ BUILD_EXPORTS = \ - # built for the build system to override those in BASE_FLAGS_TO_PASS. - EXTRA_BUILD_FLAGS = \ - CFLAGS="$(CFLAGS_FOR_BUILD)" \ -+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \ -+ CPP="$(CC_FOR_BUILD) -E" \ -+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \ - LDFLAGS="$(LDFLAGS_FOR_BUILD)" - - # This is the list of directories to built for the host system. -@@ -190,6 +194,7 @@ HOST_SUBDIR = @host_subdir@ - HOST_EXPORTS = \ - $(BASE_EXPORTS) \ - CC="$(CC)"; export CC; \ -+ CPP="$(CC) -E"; export CPP; \ - ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ -diff --git a/gcc/Makefile.in b/gcc/Makefile.in -index 011c7ac2db6..2f1165f7b5e 100644 ---- a/gcc/Makefile.in -+++ b/gcc/Makefile.in -@@ -805,7 +805,7 @@ BUILD_LDFLAGS=@BUILD_LDFLAGS@ - BUILD_NO_PIE_FLAG = @BUILD_NO_PIE_FLAG@ - BUILD_LDFLAGS += $(BUILD_NO_PIE_FLAG) - BUILD_CPPFLAGS= -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \ -- -I$(srcdir)/../include @INCINTL@ $(CPPINC) $(CPPFLAGS) -+ -I$(srcdir)/../include @INCINTL@ $(CPPINC) $(CPPFLAGS_FOR_BUILD) - - # Actual name to use when installing a native compiler. - GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)') -diff --git a/gcc/configure b/gcc/configure -index 825a9652329..ff46cf58960 100755 ---- a/gcc/configure -+++ b/gcc/configure -@@ -12314,7 +12314,7 @@ else - CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ - CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \ - LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \ -- GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \ -+ GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \ - ${realsrcdir}/configure \ - --enable-languages=${enable_languages-all} \ - ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \ -diff --git a/gcc/configure.ac b/gcc/configure.ac -index 6099eb3251f..b3c345b61dc 100644 ---- a/gcc/configure.ac -+++ b/gcc/configure.ac -@@ -1898,7 +1898,7 @@ else - CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ - CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \ - LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \ -- GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \ -+ GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \ - ${realsrcdir}/configure \ - --enable-languages=${enable_languages-all} \ - ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \ diff --git a/recipes-devtools/gcc/gcc-arc/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch b/recipes-devtools/gcc/gcc-arc/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch index 3cd75b7..97c2713 100644 --- a/recipes-devtools/gcc/gcc-arc/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch +++ b/recipes-devtools/gcc/gcc-arc/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch @@ -1,20 +1,26 @@ -From 4e53d0ae70af85af0e112a48a3e4dfe4c39f4a8d Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Tue, 2 Feb 2016 10:26:10 -0800 -Subject: [PATCH] nios2: Define MUSL_DYNAMIC_LINKER +From: Richard Purdie +Subject: [PATCH 4/5] gcc/nios2: Define the musl linker -Upstream-Status: Pending +Add a definition of the musl linker used on the nios2 platform. -Signed-off-by: Marek Vasut -Signed-off-by: Khem Raj +2021-10-26 Richard Purdie + +gcc/ChangeLog: + + * config/nios2/linux.h (MUSL_DYNAMIC_LINKER): Add musl linker + +Signed-off-by: Richard Purdie + +Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582723.html] +Upstream-Status: Backport [https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=e5ddbbf992b909d8e38851bd3179d29389e6ac97] --- gcc/config/nios2/linux.h | 1 + 1 file changed, 1 insertion(+) -diff --git a/gcc/config/nios2/linux.h b/gcc/config/nios2/linux.h -index 4bdcdcca1f0..e7943a9d640 100644 ---- a/gcc/config/nios2/linux.h -+++ b/gcc/config/nios2/linux.h +Index: gcc-11.2.0/gcc/config/nios2/linux.h +=================================================================== +--- gcc-11.2.0.orig/gcc/config/nios2/linux.h ++++ gcc-11.2.0/gcc/config/nios2/linux.h @@ -30,6 +30,7 @@ #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" diff --git a/recipes-devtools/gcc/gcc-arc/0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch b/recipes-devtools/gcc/gcc-arc/0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch index 2a6769a..9c616d2 100644 --- a/recipes-devtools/gcc/gcc-arc/0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch +++ b/recipes-devtools/gcc/gcc-arc/0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch @@ -1,4 +1,4 @@ -From 5db0404eb770ac477fd99d444226bcf021067584 Mon Sep 17 00:00:00 2001 +From 745a2ac7825c73102b888226c54397d21512f86b Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 27 Jun 2017 18:10:54 -0700 Subject: [PATCH] Add ssp_nonshared to link commandline for musl targets @@ -22,12 +22,10 @@ Signed-off-by: Khem Raj gcc/config/rs6000/linux64.h | 10 ++++++++++ 3 files changed, 27 insertions(+) -diff --git a/gcc/config/linux.h b/gcc/config/linux.h -index 0c1a8118a26..bdc2a2d0659 100644 --- a/gcc/config/linux.h +++ b/gcc/config/linux.h -@@ -195,6 +195,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ +@@ -203,6 +203,13 @@ see the files COPYING3 and COPYING.RUNTI + { GCC_INCLUDE_DIRVAR, "GCC", 0, 1, 0, 0 }, \ { 0, 0, 0, 0, 0, 0 } \ } +#ifdef TARGET_LIBC_PROVIDES_SSP @@ -40,8 +38,6 @@ index 0c1a8118a26..bdc2a2d0659 100644 #endif #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */ -diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h -index b7026fcbee7..dd54d6c393e 100644 --- a/gcc/config/rs6000/linux.h +++ b/gcc/config/rs6000/linux.h @@ -94,6 +94,16 @@ @@ -61,11 +57,9 @@ index b7026fcbee7..dd54d6c393e 100644 #undef LINK_OS_LINUX_SPEC #define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \ %{!static-pie: \ -diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h -index 967c1c43c63..dc5e4d97975 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h -@@ -452,6 +452,16 @@ extern int dot_symbols; +@@ -369,6 +369,16 @@ extern int dot_symbols; " -m elf64ppc") #endif diff --git a/recipes-devtools/gcc/gcc-arc/0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch b/recipes-devtools/gcc/gcc-arc/0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch index 767cba0..b74aeb8 100644 --- a/recipes-devtools/gcc/gcc-arc/0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch +++ b/recipes-devtools/gcc/gcc-arc/0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch @@ -1,4 +1,4 @@ -From fbc926dbf6a47fa623b9c94cd9b09a0e90448fdc Mon Sep 17 00:00:00 2001 +From 695adb4dffb23c6f5cbc757e05cf4187a2bd6528 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 4 May 2016 21:11:34 -0700 Subject: [PATCH] Link libgcc using LDFLAGS, not just SHLIB_LDFLAGS @@ -12,7 +12,7 @@ Signed-off-by: Khem Raj 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgcc/config/t-slibgcc b/libgcc/config/t-slibgcc -index c997553447c..330352c2c81 100644 +index c59b43b7b69..ca4c141f526 100644 --- a/libgcc/config/t-slibgcc +++ b/libgcc/config/t-slibgcc @@ -32,7 +32,7 @@ SHLIB_INSTALL_SOLINK = $(LN_S) $(SHLIB_SONAME) \ diff --git a/recipes-devtools/gcc/gcc-arc/0030-sync-gcc-stddef.h-with-musl.patch b/recipes-devtools/gcc/gcc-arc/0030-sync-gcc-stddef.h-with-musl.patch index 4f18907..fd7d604 100644 --- a/recipes-devtools/gcc/gcc-arc/0030-sync-gcc-stddef.h-with-musl.patch +++ b/recipes-devtools/gcc/gcc-arc/0030-sync-gcc-stddef.h-with-musl.patch @@ -1,4 +1,4 @@ -From 24dc04dc8d69e3bf61322615b3ef18e02ccd311e Mon Sep 17 00:00:00 2001 +From a9173429ae256c4b4a3ab4d758a6adf42f8c4239 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 3 Feb 2017 12:56:00 -0800 Subject: [PATCH] sync gcc stddef.h with musl @@ -6,7 +6,7 @@ Subject: [PATCH] sync gcc stddef.h with musl musl defines ptrdiff_t size_t and wchar_t so dont define them here if musl is definining them -Upstream-Status: Pending +Upstream-Status: Backport [https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=85a438fc78dd12249ca854a3e5c577fefeb1a5cd] Signed-off-by: Khem Raj --- @@ -14,7 +14,7 @@ Signed-off-by: Khem Raj 1 file changed, 9 insertions(+) diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h -index 9d67eac4947..6cb5edbedb4 100644 +index 66619fe43b1..3f843d6f365 100644 --- a/gcc/ginclude/stddef.h +++ b/gcc/ginclude/stddef.h @@ -128,6 +128,7 @@ _TYPE_wchar_t; diff --git a/recipes-devtools/gcc/gcc-arc/0031-fix-segmentation-fault-in-precompiled-header-generat.patch b/recipes-devtools/gcc/gcc-arc/0031-fix-segmentation-fault-in-precompiled-header-generat.patch deleted file mode 100644 index 702279a..0000000 --- a/recipes-devtools/gcc/gcc-arc/0031-fix-segmentation-fault-in-precompiled-header-generat.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 27b8ba5555ada2dab076988529bfb84d00a4b901 Mon Sep 17 00:00:00 2001 -From: Juro Bystricky -Date: Mon, 19 Mar 2018 22:31:20 -0700 -Subject: [PATCH] fix segmentation fault in precompiled header generation - -Prevent a segmentation fault which occurs when using incorrect -structure trying to access name of some named operators, such as -CPP_NOT, CPP_AND etc. "token->val.node.spelling" cannot be used in -those cases, as is may not be initialized at all. - -[YOCTO #11738] - -Upstream-Status: Pending - -Signed-off-by: Juro Bystricky -Signed-off-by: Khem Raj ---- - libcpp/lex.c | 26 +++++++++++++++++++++----- - 1 file changed, 21 insertions(+), 5 deletions(-) - -diff --git a/libcpp/lex.c b/libcpp/lex.c -index 56ac3a1dd73..73a951148b3 100644 ---- a/libcpp/lex.c -+++ b/libcpp/lex.c -@@ -3311,11 +3311,27 @@ cpp_spell_token (cpp_reader *pfile, const cpp_token *token, - spell_ident: - case SPELL_IDENT: - if (forstring) -- { -- memcpy (buffer, NODE_NAME (token->val.node.spelling), -- NODE_LEN (token->val.node.spelling)); -- buffer += NODE_LEN (token->val.node.spelling); -- } -+ { -+ if (token->type == CPP_NAME) -+ { -+ memcpy (buffer, NODE_NAME (token->val.node.spelling), -+ NODE_LEN (token->val.node.spelling)); -+ buffer += NODE_LEN (token->val.node.spelling); -+ break; -+ } -+ /* NAMED_OP, cannot use node.spelling */ -+ if (token->flags & NAMED_OP) -+ { -+ const char *str = cpp_named_operator2name (token->type); -+ if (str) -+ { -+ size_t len = strlen(str); -+ memcpy(buffer, str, len); -+ buffer += len; -+ } -+ break; -+ } -+ } - else - buffer = _cpp_spell_ident_ucns (buffer, token->val.node.node); - break; diff --git a/recipes-devtools/gcc/gcc-arc/0032-Fix-for-testsuite-failure.patch b/recipes-devtools/gcc/gcc-arc/0032-Fix-for-testsuite-failure.patch deleted file mode 100644 index 0a0767b..0000000 --- a/recipes-devtools/gcc/gcc-arc/0032-Fix-for-testsuite-failure.patch +++ /dev/null @@ -1,255 +0,0 @@ -From 2512aacf023c679d86d8f40caff4f6ff412b32ff Mon Sep 17 00:00:00 2001 -From: RAGHUNATH LOLUR -Date: Wed, 6 Dec 2017 22:52:26 -0800 -Subject: [PATCH] Fix for testsuite failure - -2017-11-16 Raghunath Lolur - - * gcc.dg/pr56275.c: If SSE is disabled, ensure that - "-mfpmath" is not set to use SSE. Set "-mfpmath=387". - * gcc.dg/pr68306.c: Likewise - * gcc.dg/pr68306-2.c: Likewise - * gcc.dg/pr68306-3.c: Likewise - * gcc.dg/pr69634.c: Likewise - * gcc.target/i386/amd64-abi-1.c: Likewise - * gcc.target/i386/funcspec-6.c: Likewise - * gcc.target/i386/interrupt-387-err-1.c: Likewise - * gcc.target/i386/isa-14.c: Likewise - * gcc.target/i386/pr44948-2b.c: Likewise - * gcc.target/i386/pr53425-1.c: Likewise - * gcc.target/i386/pr53425-2.c: Likewise - * gcc.target/i386/pr55247.c: Likewise - * gcc.target/i386/pr59644.c: Likewise - * gcc.target/i386/pr62120.c: Likewise - * gcc.target/i386/pr70467-1.c: Likewise - * gcc.target/i386/warn-vect-op-1.c: Likewise - -If -Wall, -Werror are used during compilation various test cases fail -to compile. - -If SSE is disabled, be sure to -mfpmath=387 to resolve this. - -This patch removes the changes to Changelog from the original patch. -This will help us avoid conflicts. - -Upstream-Status: Pending - -Signed-off-by: Mark Hatle ---- - gcc/testsuite/gcc.dg/pr56275.c | 2 +- - gcc/testsuite/gcc.dg/pr68306-2.c | 2 +- - gcc/testsuite/gcc.dg/pr68306-3.c | 2 +- - gcc/testsuite/gcc.dg/pr68306.c | 2 +- - gcc/testsuite/gcc.dg/pr69634.c | 2 +- - gcc/testsuite/gcc.target/i386/amd64-abi-1.c | 2 +- - gcc/testsuite/gcc.target/i386/funcspec-6.c | 1 + - gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c | 2 +- - gcc/testsuite/gcc.target/i386/isa-14.c | 2 +- - gcc/testsuite/gcc.target/i386/pr44948-2b.c | 2 +- - gcc/testsuite/gcc.target/i386/pr53425-1.c | 2 +- - gcc/testsuite/gcc.target/i386/pr53425-2.c | 2 +- - gcc/testsuite/gcc.target/i386/pr55247.c | 2 +- - gcc/testsuite/gcc.target/i386/pr59644.c | 2 +- - gcc/testsuite/gcc.target/i386/pr62120.c | 2 +- - gcc/testsuite/gcc.target/i386/pr70467-1.c | 2 +- - gcc/testsuite/gcc.target/i386/warn-vect-op-1.c | 2 +- - 17 files changed, 17 insertions(+), 16 deletions(-) - -diff --git a/gcc/testsuite/gcc.dg/pr56275.c b/gcc/testsuite/gcc.dg/pr56275.c -index b901bb2b199..a4f6c95e1a1 100644 ---- a/gcc/testsuite/gcc.dg/pr56275.c -+++ b/gcc/testsuite/gcc.dg/pr56275.c -@@ -1,6 +1,6 @@ - /* { dg-do compile } */ - /* { dg-options "-O2" } */ --/* { dg-additional-options "-mno-sse" { target { i?86-*-* x86_64-*-* } } } */ -+/* { dg-additional-options "-mno-sse -mfpmath=387" { target { i?86-*-* x86_64-*-* } } } */ - - typedef long long v2tw __attribute__ ((vector_size (2 * sizeof (long long)))); - -diff --git a/gcc/testsuite/gcc.dg/pr68306-2.c b/gcc/testsuite/gcc.dg/pr68306-2.c -index 4672ebe7987..2a368c484b6 100644 ---- a/gcc/testsuite/gcc.dg/pr68306-2.c -+++ b/gcc/testsuite/gcc.dg/pr68306-2.c -@@ -1,6 +1,6 @@ - /* { dg-do compile } */ - /* { dg-options "-O3" } */ --/* { dg-additional-options "-mno-sse -mno-mmx" { target i?86-*-* x86_64-*-* } } */ -+/* { dg-additional-options "-mno-sse -mno-mmx -mfpmath=387" { target i?86-*-* x86_64-*-* } } */ - - struct { - int tz_minuteswest; -diff --git a/gcc/testsuite/gcc.dg/pr68306-3.c b/gcc/testsuite/gcc.dg/pr68306-3.c -index f5a8c102cf8..df3390c64c2 100644 ---- a/gcc/testsuite/gcc.dg/pr68306-3.c -+++ b/gcc/testsuite/gcc.dg/pr68306-3.c -@@ -1,6 +1,6 @@ - /* { dg-do compile } */ - /* { dg-options "-O3" } */ --/* { dg-additional-options "-mno-sse -mno-mmx" { target i?86-*-* x86_64-*-* } } */ -+/* { dg-additional-options "-mno-sse -mno-mmx -mfpmath=387" { target i?86-*-* x86_64-*-* } } */ - /* { dg-additional-options "-mno-altivec -mno-vsx" { target powerpc*-*-* } } */ - - extern void fn2(); -diff --git a/gcc/testsuite/gcc.dg/pr68306.c b/gcc/testsuite/gcc.dg/pr68306.c -index 54e5b40f221..0813389e2c1 100644 ---- a/gcc/testsuite/gcc.dg/pr68306.c -+++ b/gcc/testsuite/gcc.dg/pr68306.c -@@ -1,6 +1,6 @@ - /* { dg-do compile } */ - /* { dg-options "-O3" } */ --/* { dg-additional-options "-mno-sse -mno-mmx" { target i?86-*-* x86_64-*-* } } */ -+/* { dg-additional-options "-mno-sse -mno-mmx -mfpmath=387" { target i?86-*-* x86_64-*-* } } */ - - enum powerpc_pmc_type { PPC_PMC_IBM }; - struct { -diff --git a/gcc/testsuite/gcc.dg/pr69634.c b/gcc/testsuite/gcc.dg/pr69634.c -index 60a56149463..bcc23f9ccd6 100644 ---- a/gcc/testsuite/gcc.dg/pr69634.c -+++ b/gcc/testsuite/gcc.dg/pr69634.c -@@ -1,6 +1,6 @@ - /* { dg-do compile } */ - /* { dg-options "-O2 -fno-dce -fschedule-insns -fno-tree-vrp -fcompare-debug -Wno-psabi" } */ --/* { dg-additional-options "-mno-sse" { target i?86-*-* x86_64-*-* } } */ -+/* { dg-additional-options "-mno-sse -mfpmath=387" { target i?86-*-* x86_64-*-* } } */ - /* { dg-require-effective-target scheduling } */ - - typedef unsigned short u16; -diff --git a/gcc/testsuite/gcc.target/i386/amd64-abi-1.c b/gcc/testsuite/gcc.target/i386/amd64-abi-1.c -index 69fde57bf06..7f1f1c03edf 100644 ---- a/gcc/testsuite/gcc.target/i386/amd64-abi-1.c -+++ b/gcc/testsuite/gcc.target/i386/amd64-abi-1.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target { ! ia32 } } } */ --/* { dg-options "-mno-sse" } */ -+/* { dg-options "-mno-sse -mfpmath=387" } */ - /* { dg-additional-options "-mabi=sysv" { target *-*-mingw* } } */ - - double foo(void) { return 0; } /* { dg-error "SSE disabled" } */ -diff --git a/gcc/testsuite/gcc.target/i386/funcspec-6.c b/gcc/testsuite/gcc.target/i386/funcspec-6.c -index ea896b7ebfd..bf15569b826 100644 ---- a/gcc/testsuite/gcc.target/i386/funcspec-6.c -+++ b/gcc/testsuite/gcc.target/i386/funcspec-6.c -@@ -1,6 +1,7 @@ - /* Test whether all of the 64-bit function specific options are accepted - without error. */ - /* { dg-do compile { target { ! ia32 } } } */ -+/* { dg-additional-options "-mfpmath=387" } */ - - #include "funcspec-56.inc" - -diff --git a/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c b/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c -index 8561a3c26d6..6377f814645 100644 ---- a/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c -+++ b/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mgeneral-regs-only -mno-cld -mno-iamcu -m80387" } */ -+/* { dg-options "-O2 -mgeneral-regs-only -mno-cld -mno-iamcu -m80387 -mfpmath=387" } */ - - typedef unsigned int uword_t __attribute__ ((mode (__word__))); - -diff --git a/gcc/testsuite/gcc.target/i386/isa-14.c b/gcc/testsuite/gcc.target/i386/isa-14.c -index 5d49e6e77fe..1de2db92bdd 100644 ---- a/gcc/testsuite/gcc.target/i386/isa-14.c -+++ b/gcc/testsuite/gcc.target/i386/isa-14.c -@@ -1,5 +1,5 @@ - /* { dg-do run } */ --/* { dg-options "-march=x86-64 -msse4a -mfma4 -mno-sse" } */ -+/* { dg-options "-march=x86-64 -msse4a -mfma4 -mno-sse -mfpmath=387" } */ - - extern void abort (void); - -diff --git a/gcc/testsuite/gcc.target/i386/pr44948-2b.c b/gcc/testsuite/gcc.target/i386/pr44948-2b.c -index fa1769b62fb..f79fb12726f 100644 ---- a/gcc/testsuite/gcc.target/i386/pr44948-2b.c -+++ b/gcc/testsuite/gcc.target/i386/pr44948-2b.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O -mno-sse -Wno-psabi -mtune=generic" } */ -+/* { dg-options "-O -mno-sse -Wno-psabi -mtune=generic -mfpmath=387" } */ - - struct A - { -diff --git a/gcc/testsuite/gcc.target/i386/pr53425-1.c b/gcc/testsuite/gcc.target/i386/pr53425-1.c -index 2e89ff7d81d..6339bf6b736 100644 ---- a/gcc/testsuite/gcc.target/i386/pr53425-1.c -+++ b/gcc/testsuite/gcc.target/i386/pr53425-1.c -@@ -1,6 +1,6 @@ - /* PR target/53425 */ - /* { dg-do compile { target { ! ia32 } } } */ --/* { dg-options "-O2 -mno-sse" } */ -+/* { dg-options "-O2 -mno-sse -mfpmath=387" } */ - /* { dg-skip-if "no SSE vector" { x86_64-*-mingw* } } */ - - typedef double __v2df __attribute__ ((__vector_size__ (16))); -diff --git a/gcc/testsuite/gcc.target/i386/pr53425-2.c b/gcc/testsuite/gcc.target/i386/pr53425-2.c -index 61f6283dbe9..2c5a55f0ac3 100644 ---- a/gcc/testsuite/gcc.target/i386/pr53425-2.c -+++ b/gcc/testsuite/gcc.target/i386/pr53425-2.c -@@ -1,6 +1,6 @@ - /* PR target/53425 */ - /* { dg-do compile { target { ! ia32 } } } */ --/* { dg-options "-O2 -mno-sse" } */ -+/* { dg-options "-O2 -mno-sse -mfpmath=387" } */ - /* { dg-skip-if "no SSE vector" { x86_64-*-mingw* } } */ - - typedef float __v2sf __attribute__ ((__vector_size__ (8))); -diff --git a/gcc/testsuite/gcc.target/i386/pr55247.c b/gcc/testsuite/gcc.target/i386/pr55247.c -index 23366d0909d..9810e3abb76 100644 ---- a/gcc/testsuite/gcc.target/i386/pr55247.c -+++ b/gcc/testsuite/gcc.target/i386/pr55247.c -@@ -1,6 +1,6 @@ - /* { dg-do compile { target { ! ia32 } } } */ - /* { dg-require-effective-target maybe_x32 } */ --/* { dg-options "-O2 -mno-sse -mno-mmx -mx32 -maddress-mode=long" } */ -+/* { dg-options "-O2 -mno-sse -mno-mmx -mx32 -maddress-mode=long -mfpmath=387" } */ - - typedef unsigned int uint32_t; - typedef uint32_t Elf32_Word; -diff --git a/gcc/testsuite/gcc.target/i386/pr59644.c b/gcc/testsuite/gcc.target/i386/pr59644.c -index 96006b3e338..4287e4538bf 100644 ---- a/gcc/testsuite/gcc.target/i386/pr59644.c -+++ b/gcc/testsuite/gcc.target/i386/pr59644.c -@@ -1,6 +1,6 @@ - /* PR target/59644 */ - /* { dg-do run { target lp64 } } */ --/* { dg-options "-O2 -ffreestanding -mno-sse -mpreferred-stack-boundary=3 -maccumulate-outgoing-args -mno-red-zone" } */ -+/* { dg-options "-O2 -ffreestanding -mno-sse -mpreferred-stack-boundary=3 -maccumulate-outgoing-args -mno-red-zone -mfpmath=387" } */ - - /* This test uses __builtin_trap () instead of e.g. abort, - because due to -mpreferred-stack-boundary=3 it should not call -diff --git a/gcc/testsuite/gcc.target/i386/pr62120.c b/gcc/testsuite/gcc.target/i386/pr62120.c -index 28d85d37712..c93266bd4bc 100644 ---- a/gcc/testsuite/gcc.target/i386/pr62120.c -+++ b/gcc/testsuite/gcc.target/i386/pr62120.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-mno-sse" } */ -+/* { dg-options "-mno-sse -mfpmath=387" } */ - - void foo () - { -diff --git a/gcc/testsuite/gcc.target/i386/pr70467-1.c b/gcc/testsuite/gcc.target/i386/pr70467-1.c -index 4e112c88d07..bcfb396a68d 100644 ---- a/gcc/testsuite/gcc.target/i386/pr70467-1.c -+++ b/gcc/testsuite/gcc.target/i386/pr70467-1.c -@@ -1,6 +1,6 @@ - /* PR rtl-optimization/70467 */ - /* { dg-do compile } */ --/* { dg-options "-O2 -mno-sse" } */ -+/* { dg-options "-O2 -mno-sse -mfpmath=387" } */ - - void foo (unsigned long long *); - -diff --git a/gcc/testsuite/gcc.target/i386/warn-vect-op-1.c b/gcc/testsuite/gcc.target/i386/warn-vect-op-1.c -index 6cda1534311..26e37f5b8ba 100644 ---- a/gcc/testsuite/gcc.target/i386/warn-vect-op-1.c -+++ b/gcc/testsuite/gcc.target/i386/warn-vect-op-1.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target { ! ia32 } } } */ --/* { dg-options "-mno-sse -Wvector-operation-performance" } */ -+/* { dg-options "-mno-sse -Wvector-operation-performance -mfpmath=387" } */ - #define vector(elcount, type) \ - __attribute__((vector_size((elcount)*sizeof(type)))) type - diff --git a/recipes-devtools/gcc/gcc-arc/0033-Re-introduce-spe-commandline-options.patch b/recipes-devtools/gcc/gcc-arc/0033-Re-introduce-spe-commandline-options.patch index ba7c2b8..129f555 100644 --- a/recipes-devtools/gcc/gcc-arc/0033-Re-introduce-spe-commandline-options.patch +++ b/recipes-devtools/gcc/gcc-arc/0033-Re-introduce-spe-commandline-options.patch @@ -1,4 +1,4 @@ -From 3fc06241ce37e2e4b3ed21ace28d347eb511448d Mon Sep 17 00:00:00 2001 +From 0b900d6410b7c1938e86eceb87b032fd538566a9 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 6 Jun 2018 12:10:22 -0700 Subject: [PATCH] Re-introduce spe commandline options @@ -10,17 +10,18 @@ Upstream-Status: Inappropriate [SPE port is removed from rs600 port] Signed-off-by: Khem Raj --- - gcc/config/rs6000/rs6000.opt | 12 ++++++++++++ - 1 file changed, 12 insertions(+) + gcc/config/rs6000/rs6000.opt | 13 +++++++++++++ + 1 file changed, 13 insertions(+) diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt -index f95b8279270..0e52d51409d 100644 +index 0dbdf753673..b273eb65c35 100644 --- a/gcc/config/rs6000/rs6000.opt +++ b/gcc/config/rs6000/rs6000.opt -@@ -344,6 +344,18 @@ mdebug= +@@ -352,6 +352,19 @@ mdebug= Target RejectNegative Joined -mdebug= Enable debug output. ++; PPC SPE ABI +mspe +Target Var(rs6000_spe) Save +Generate SPE SIMD instructions on E500. @@ -33,6 +34,6 @@ index f95b8279270..0e52d51409d 100644 +Target RejectNegative Var(rs6000_spe_abi, 0) +Do not use the SPE ABI extensions. + + ; Altivec ABI mabi=altivec Target RejectNegative Var(rs6000_altivec_abi) Save - Use the AltiVec ABI extensions. diff --git a/recipes-devtools/gcc/gcc-arc/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch b/recipes-devtools/gcc/gcc-arc/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch index 4ce9dc6..3f666dc 100644 --- a/recipes-devtools/gcc/gcc-arc/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch +++ b/recipes-devtools/gcc/gcc-arc/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch @@ -1,4 +1,4 @@ -From b42ff59c3fe2967d37815c8db72a47b9b7f585b4 Mon Sep 17 00:00:00 2001 +From ea9154338cb3acbd75945fddde4202e73c20dd1a Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Sat, 24 Oct 2015 20:09:53 +0000 Subject: [PATCH] libgcc_s: Use alias for __cpu_indicator_init instead of @@ -39,10 +39,10 @@ Signed-off-by: Khem Raj 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c -index 48f00c5fcfc..468f5f71fac 100644 +index ac69eed4d32..ffaa44a16fc 100644 --- a/gcc/config/i386/i386-expand.c +++ b/gcc/config/i386/i386-expand.c -@@ -10941,10 +10941,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget, +@@ -11038,10 +11038,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget, { case IX86_BUILTIN_CPU_INIT: { @@ -56,11 +56,11 @@ index 48f00c5fcfc..468f5f71fac 100644 return expand_expr (call_expr, target, mode, EXPAND_NORMAL); } diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c -index 00322c58622..f42bbb8af98 100644 +index ef463848f9d..1a3de052c80 100644 --- a/libgcc/config/i386/cpuinfo.c +++ b/libgcc/config/i386/cpuinfo.c -@@ -508,7 +508,7 @@ __cpu_indicator_init (void) - return 0; +@@ -63,7 +63,7 @@ __cpu_indicator_init (void) + __cpu_features2); } -#if defined SHARED && defined USE_ELF_SYMVER diff --git a/recipes-devtools/gcc/gcc-arc/0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch b/recipes-devtools/gcc/gcc-arc/0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch index dd1bf6d..874cd77 100644 --- a/recipes-devtools/gcc/gcc-arc/0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch +++ b/recipes-devtools/gcc/gcc-arc/0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch @@ -1,4 +1,4 @@ -From 0395060a7dcf98c5f5a65103f6aaa71d6b862259 Mon Sep 17 00:00:00 2001 +From 520411cf364ee4b0b5a8f0857498aaabd790afb3 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 10 Mar 2020 08:26:53 -0700 Subject: [PATCH] gentypes/genmodes: Do not use __LINE__ for maintaining @@ -17,7 +17,7 @@ Signed-off-by: Khem Raj 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/gcc/gengtype.c b/gcc/gengtype.c -index 981577481af..d5700fff401 100644 +index 5f50242e857..cbaca9b8cd0 100644 --- a/gcc/gengtype.c +++ b/gcc/gengtype.c @@ -991,7 +991,7 @@ create_field_at (pair_p next, type_p type, const char *name, options_p opt, @@ -38,7 +38,7 @@ index 981577481af..d5700fff401 100644 /* Reverse a linked list of 'struct pair's in place. */ pair_p -@@ -5187,7 +5187,7 @@ main (int argc, char **argv) +@@ -5189,7 +5189,7 @@ main (int argc, char **argv) /* These types are set up with #define or else outside of where we can see them. We should initialize them before calling read_input_list. */ @@ -48,10 +48,10 @@ index 981577481af..d5700fff401 100644 POS_HERE (do_scalar_typedef ("CUMULATIVE_ARGS", &pos)); POS_HERE (do_scalar_typedef ("REAL_VALUE_TYPE", &pos)); diff --git a/gcc/genmodes.c b/gcc/genmodes.c -index bd78310ea24..dbd02c51a4c 100644 +index c268ebc4c6e..4361f3f1563 100644 --- a/gcc/genmodes.c +++ b/gcc/genmodes.c -@@ -430,7 +430,7 @@ complete_all_modes (void) +@@ -438,7 +438,7 @@ complete_all_modes (void) } /* For each mode in class CLASS, construct a corresponding complex mode. */ @@ -60,7 +60,7 @@ index bd78310ea24..dbd02c51a4c 100644 static void make_complex_modes (enum mode_class cl, const char *file, unsigned int line) -@@ -489,7 +489,7 @@ make_complex_modes (enum mode_class cl, +@@ -497,7 +497,7 @@ make_complex_modes (enum mode_class cl, having as many components as necessary. ORDER is the sorting order of the mode, with smaller numbers indicating a higher priority. */ #define VECTOR_MODES_WITH_PREFIX(PREFIX, C, W, ORDER) \ @@ -69,7 +69,7 @@ index bd78310ea24..dbd02c51a4c 100644 #define VECTOR_MODES(C, W) VECTOR_MODES_WITH_PREFIX (V, C, W, 0) static void ATTRIBUTE_UNUSED make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width, -@@ -541,7 +541,7 @@ make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width, +@@ -549,7 +549,7 @@ make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width, /* Create a vector of booleans called NAME with COUNT elements and BYTESIZE bytes in total. */ #define VECTOR_BOOL_MODE(NAME, COUNT, BYTESIZE) \ @@ -78,7 +78,7 @@ index bd78310ea24..dbd02c51a4c 100644 static void ATTRIBUTE_UNUSED make_vector_bool_mode (const char *name, unsigned int count, unsigned int bytesize, const char *file, -@@ -563,7 +563,7 @@ make_vector_bool_mode (const char *name, unsigned int count, +@@ -571,7 +571,7 @@ make_vector_bool_mode (const char *name, unsigned int count, /* Input. */ #define _SPECIAL_MODE(C, N) \ @@ -87,7 +87,7 @@ index bd78310ea24..dbd02c51a4c 100644 #define RANDOM_MODE(N) _SPECIAL_MODE (RANDOM, N) #define CC_MODE(N) _SPECIAL_MODE (CC, N) -@@ -576,7 +576,7 @@ make_special_mode (enum mode_class cl, const char *name, +@@ -584,7 +584,7 @@ make_special_mode (enum mode_class cl, const char *name, #define INT_MODE(N, Y) FRACTIONAL_INT_MODE (N, -1U, Y) #define FRACTIONAL_INT_MODE(N, B, Y) \ @@ -96,7 +96,7 @@ index bd78310ea24..dbd02c51a4c 100644 static void make_int_mode (const char *name, -@@ -589,16 +589,16 @@ make_int_mode (const char *name, +@@ -611,16 +611,16 @@ make_opaque_mode (const char *name, } #define FRACT_MODE(N, Y, F) \ @@ -117,7 +117,7 @@ index bd78310ea24..dbd02c51a4c 100644 /* Create a fixed-point mode by setting CL, NAME, BYTESIZE, IBIT, FBIT, FILE, and LINE. */ -@@ -619,7 +619,7 @@ make_fixed_point_mode (enum mode_class cl, +@@ -641,7 +641,7 @@ make_fixed_point_mode (enum mode_class cl, #define FLOAT_MODE(N, Y, F) FRACTIONAL_FLOAT_MODE (N, -1U, Y, F) #define FRACTIONAL_FLOAT_MODE(N, B, Y, F) \ @@ -126,7 +126,7 @@ index bd78310ea24..dbd02c51a4c 100644 static void make_float_mode (const char *name, -@@ -636,7 +636,7 @@ make_float_mode (const char *name, +@@ -658,7 +658,7 @@ make_float_mode (const char *name, #define DECIMAL_FLOAT_MODE(N, Y, F) \ FRACTIONAL_DECIMAL_FLOAT_MODE (N, -1U, Y, F) #define FRACTIONAL_DECIMAL_FLOAT_MODE(N, B, Y, F) \ @@ -135,7 +135,7 @@ index bd78310ea24..dbd02c51a4c 100644 static void make_decimal_float_mode (const char *name, -@@ -651,7 +651,7 @@ make_decimal_float_mode (const char *name, +@@ -673,7 +673,7 @@ make_decimal_float_mode (const char *name, } #define RESET_FLOAT_FORMAT(N, F) \ @@ -144,7 +144,7 @@ index bd78310ea24..dbd02c51a4c 100644 static void ATTRIBUTE_UNUSED reset_float_format (const char *name, const char *format, const char *file, unsigned int line) -@@ -672,7 +672,7 @@ reset_float_format (const char *name, const char *format, +@@ -694,7 +694,7 @@ reset_float_format (const char *name, const char *format, /* __intN support. */ #define INT_N(M,PREC) \ @@ -153,7 +153,7 @@ index bd78310ea24..dbd02c51a4c 100644 static void ATTRIBUTE_UNUSED make_int_n (const char *m, int bitsize, const char *file, unsigned int line) -@@ -701,7 +701,7 @@ make_int_n (const char *m, int bitsize, +@@ -723,7 +723,7 @@ make_int_n (const char *m, int bitsize, /* Partial integer modes are specified by relation to a full integer mode. */ #define PARTIAL_INT_MODE(M,PREC,NAME) \ @@ -162,7 +162,7 @@ index bd78310ea24..dbd02c51a4c 100644 static void ATTRIBUTE_UNUSED make_partial_integer_mode (const char *base, const char *name, unsigned int precision, -@@ -728,7 +728,7 @@ make_partial_integer_mode (const char *base, const char *name, +@@ -750,7 +750,7 @@ make_partial_integer_mode (const char *base, const char *name, /* A single vector mode can be specified by naming its component mode and the number of components. */ #define VECTOR_MODE(C, M, N) \ @@ -171,7 +171,7 @@ index bd78310ea24..dbd02c51a4c 100644 static void ATTRIBUTE_UNUSED make_vector_mode (enum mode_class bclass, const char *base, -@@ -771,7 +771,7 @@ make_vector_mode (enum mode_class bclass, +@@ -793,7 +793,7 @@ make_vector_mode (enum mode_class bclass, /* Adjustability. */ #define _ADD_ADJUST(A, M, X, C1, C2) \ diff --git a/recipes-devtools/gcc/gcc-arc/0036-mingw32-Enable-operation_not_supported.patch b/recipes-devtools/gcc/gcc-arc/0036-mingw32-Enable-operation_not_supported.patch index de82a3a..3a7618c 100644 --- a/recipes-devtools/gcc/gcc-arc/0036-mingw32-Enable-operation_not_supported.patch +++ b/recipes-devtools/gcc/gcc-arc/0036-mingw32-Enable-operation_not_supported.patch @@ -1,4 +1,4 @@ -From 6f87a095f0e696bec07a50df789c9db8bdbca43d Mon Sep 17 00:00:00 2001 +From 96d895c8d5dc895d24fe37aa2b4f201a2566b4cc Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 12 May 2020 10:39:09 -0700 Subject: [PATCH] mingw32: Enable operation_not_supported @@ -12,15 +12,15 @@ Signed-off-by: Khem Raj 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstdc++-v3/config/os/mingw32/error_constants.h b/libstdc++-v3/config/os/mingw32/error_constants.h -index 68ac72a78fb..71cd5815b81 100644 +index eca06a97014..933cfab49cf 100644 --- a/libstdc++-v3/config/os/mingw32/error_constants.h +++ b/libstdc++-v3/config/os/mingw32/error_constants.h @@ -107,7 +107,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION - #ifdef _GLIBCXX_HAVE_EPERM + #ifdef EPERM operation_not_permitted = EPERM, #endif -// operation_not_supported = EOPNOTSUPP, + operation_not_supported = EOPNOTSUPP, - #ifdef _GLIBCXX_HAVE_EWOULDBLOCK + #ifdef EWOULDBLOCK operation_would_block = EWOULDBLOCK, #endif diff --git a/recipes-devtools/gcc/gcc-arc/0037-libatomic-Do-not-enforce-march-on-aarch64.patch b/recipes-devtools/gcc/gcc-arc/0037-libatomic-Do-not-enforce-march-on-aarch64.patch index 3946ace..4c9a79c 100644 --- a/recipes-devtools/gcc/gcc-arc/0037-libatomic-Do-not-enforce-march-on-aarch64.patch +++ b/recipes-devtools/gcc/gcc-arc/0037-libatomic-Do-not-enforce-march-on-aarch64.patch @@ -1,4 +1,4 @@ -From 38d262bfe7c0c894c364dc6e4dc7971e78a73974 Mon Sep 17 00:00:00 2001 +From 36d4fdbc99e69f9d70a29e2bada40cc3c1534557 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 13 May 2020 15:10:38 -0700 Subject: [PATCH] libatomic: Do not enforce march on aarch64 @@ -17,7 +17,7 @@ Signed-off-by: Khem Raj 2 files changed, 2 deletions(-) diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am -index 133fbbca77e..ac1ca645876 100644 +index 0f3cd6f7121..c8124c1d5aa 100644 --- a/libatomic/Makefile.am +++ b/libatomic/Makefile.am @@ -125,7 +125,6 @@ libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix _$(s)_.lo,$(SIZEOBJS))) @@ -29,10 +29,10 @@ index 133fbbca77e..ac1ca645876 100644 endif if ARCH_ARM_LINUX diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in -index a51807e95c9..97df2d7ff03 100644 +index 0a51bd55f01..6d5b1581706 100644 --- a/libatomic/Makefile.in +++ b/libatomic/Makefile.in -@@ -431,7 +431,6 @@ M_SRC = $(firstword $(filter %/$(M_FILE), $(all_c_files))) +@@ -432,7 +432,6 @@ M_SRC = $(firstword $(filter %/$(M_FILE), $(all_c_files))) libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix \ _$(s)_.lo,$(SIZEOBJS))) $(am__append_1) $(am__append_2) \ $(am__append_3) $(am__append_4) diff --git a/recipes-devtools/gcc/gcc-arc/0041-apply-debug-prefix-maps-before-checksumming-DIEs.patch b/recipes-devtools/gcc/gcc-arc/0041-apply-debug-prefix-maps-before-checksumming-DIEs.patch new file mode 100644 index 0000000..c8dcd74 --- /dev/null +++ b/recipes-devtools/gcc/gcc-arc/0041-apply-debug-prefix-maps-before-checksumming-DIEs.patch @@ -0,0 +1,95 @@ +From 7cc2df084b7977653a9b59cbc34a9ad500ae619c Mon Sep 17 00:00:00 2001 +From: Richard Biener +Date: Tue, 20 Jul 2021 11:00:33 +0200 +Subject: [PATCH] debug/101473 - apply debug prefix maps before checksumming DIEs + +The following makes sure to apply the debug prefix maps to filenames +before checksumming DIEs to create the global symbol for the CU DIE +used by LTO to link the late debug to the early debug. This avoids +binary differences (in said symbol) when compiling with toolchains +installed under a different path and that compensated with appropriate +-fdebug-prefix-map options. + +The easiest and most scalable way is to record both the unmapped +and the remapped filename in the dwarf_file_data so the remapping +process takes place at a single point and only once (otherwise it +creates GC garbage at each point doing that). + +2021-07-20 Richard Biener + + PR debug/101473 + * dwarf2out.h (dwarf_file_data): Add key member. + * dwarf2out.c (dwarf_file_hasher::equal): Compare key. + (dwarf_file_hasher::hash): Hash key. + (lookup_filename): Remap the filename and store it in the + filename member of dwarf_file_data when creating a new + dwarf_file_data. + (file_name_acquire): Do not remap the filename again. + (maybe_emit_file): Likewise. + +[YOCTO #14481] + +Upstream-Status: Backport [https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=7cc2df084b7977653a9b59cbc34a9ad500ae619c] + +The upstream patch was modified to compensate for the definition of +"struct dwarf_file_data" being in dwarf2out.c rather than dwarf2out.h in +this version of gcc. + +Signed-off-by: Tony Battersby +--- +diff -urpN a/gcc/dwarf2out.c b/gcc/dwarf2out.c +--- a/gcc/dwarf2out.c 2021-04-27 06:00:13.000000000 -0400 ++++ b/gcc/dwarf2out.c 2021-07-23 16:40:06.141886167 -0400 +@@ -1283,6 +1283,7 @@ dwarf2out_switch_text_section (void) + + /* Data about a single source file. */ + struct GTY((for_user)) dwarf_file_data { ++ const char * key; + const char * filename; + int emitted_number; + }; +@@ -12334,7 +12335,7 @@ file_name_acquire (dwarf_file_data **slo + + fi = fnad->files + fnad->used_files++; + +- f = remap_debug_filename (d->filename); ++ f = d->filename; + + /* Skip all leading "./". */ + while (f[0] == '.' && IS_DIR_SEPARATOR (f[1])) +@@ -27231,13 +27232,13 @@ dwarf2out_ignore_block (const_tree block + bool + dwarf_file_hasher::equal (dwarf_file_data *p1, const char *p2) + { +- return filename_cmp (p1->filename, p2) == 0; ++ return filename_cmp (p1->key, p2) == 0; + } + + hashval_t + dwarf_file_hasher::hash (dwarf_file_data *p) + { +- return htab_hash_string (p->filename); ++ return htab_hash_string (p->key); + } + + /* Lookup FILE_NAME (in the list of filenames that we know about here in +@@ -27267,7 +27268,8 @@ lookup_filename (const char *file_name) + return *slot; + + created = ggc_alloc (); +- created->filename = file_name; ++ created->key = file_name; ++ created->filename = remap_debug_filename (file_name); + created->emitted_number = 0; + *slot = created; + return created; +@@ -27293,8 +27295,7 @@ maybe_emit_file (struct dwarf_file_data + if (output_asm_line_debug_info ()) + { + fprintf (asm_out_file, "\t.file %u ", fd->emitted_number); +- output_quoted_string (asm_out_file, +- remap_debug_filename (fd->filename)); ++ output_quoted_string (asm_out_file, fd->filename); + fputc ('\n', asm_out_file); + } + } diff --git a/recipes-devtools/gcc/gcc-runtime_arc.bb b/recipes-devtools/gcc/gcc-runtime_arc.bb index b755f55..9e4feb6 100644 --- a/recipes-devtools/gcc/gcc-runtime_arc.bb +++ b/recipes-devtools/gcc/gcc-runtime_arc.bb @@ -1,2 +1,5 @@ require recipes-devtools/gcc/gcc-${PV}.inc require recipes-devtools/gcc/gcc-runtime.inc + +RUNTIMELIBITM:arc32 = "" +RUNTIMELIBITM:arc64 = "" diff --git a/recipes-devtools/perl-cross/perlcross/0001-perl-cross-arcv3.patch b/recipes-devtools/perl-cross/perlcross/0001-perl-cross-arcv3.patch new file mode 100644 index 0000000..2c61eca --- /dev/null +++ b/recipes-devtools/perl-cross/perlcross/0001-perl-cross-arcv3.patch @@ -0,0 +1,33 @@ +Add support for ARCv3 + +Signed-off-by: Sergey Matyukevich + +Upstream-Status: Inappropriate (triplet names are not yet finalized) +--- + +diff --git a/cnf/config.guess b/cnf/config.guess +index 97ad073..6525388 100755 +--- a/cnf/config.guess ++++ b/cnf/config.guess +@@ -934,7 +934,7 @@ EOF + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; +- arc:Linux:*:* | arceb:Linux:*:*) ++ arc:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:* | arceb:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + arm*:Linux:*:*) +diff --git a/cnf/config.sub b/cnf/config.sub +index a318a46..45ee4eb 100755 +--- a/cnf/config.sub ++++ b/cnf/config.sub +@@ -1163,7 +1163,7 @@ case $cpu-$vendor in + | alphapca5[67] | alpha64pca5[67] \ + | am33_2.0 \ + | amdgcn \ +- | arc | arceb \ ++ | arc | arceb | arc32 | arc64 \ + | arm | arm[lb]e | arme[lb] | armv* \ + | avr | avr32 \ + | asmjs \ diff --git a/recipes-devtools/perl-cross/perlcross_%.bbappend b/recipes-devtools/perl-cross/perlcross_%.bbappend new file mode 100644 index 0000000..b3452b7 --- /dev/null +++ b/recipes-devtools/perl-cross/perlcross_%.bbappend @@ -0,0 +1,3 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +SRC_URI:append = " file://0001-perl-cross-arcv3.patch" diff --git a/recipes-kernel/linux/linux-arc64-dev.bb b/recipes-kernel/linux/linux-arc64-dev.bb new file mode 100644 index 0000000..9325458 --- /dev/null +++ b/recipes-kernel/linux/linux-arc64-dev.bb @@ -0,0 +1,25 @@ +DESCRIPTION = "Kernel image for the ARC architecture" +SUMMARY = "ARCv3 dev kernel recipe" +SECTION = "kernel" +LICENSE = "GPLv2" + +inherit kernel + +LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" +KERNEL_VERSION_SANITY_SKIP = "1" + +SRCREV = "a154b5efb4abedb0244f135fe93fa727c40ef4d1" +BRANCH = "arc64" +SRC_URI = "git://github.com/foss-for-synopsys-dwc-arc-processors/linux.git;protocol=https;branch=${BRANCH}" + +S = "${WORKDIR}/git" + +DEPENDS += " libgcc" +KERNEL_CC:append = " ${TOOLCHAIN_OPTIONS}" + +KERNEL_DEFCONFIG:hapshs5x = "haps_hs5x" +KERNEL_DEFCONFIG:hapshs6x = "haps_arc64" + +KERNEL_CONFIG_COMMAND = "oe_runmake -C ${S} O=${B} ${KERNEL_DEFCONFIG}_defconfig" + +KERNEL_CLASSES = "" diff --git a/recipes-support/libffi/libffi_%.bbappend b/recipes-support/libffi/libffi_%.bbappend new file mode 100644 index 0000000..9c09f8b --- /dev/null +++ b/recipes-support/libffi/libffi_%.bbappend @@ -0,0 +1,12 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +# ARCv3 port is still not upstream yet +SRC_URI:arc64 = "git://github.com/foss-for-synopsys-dwc-arc-processors/libffi.git;branch=arc64;protocol=https" + +S:arc64 = "${WORKDIR}/git" + +LIC_FILES_CHKSUM:arc64 = "file://LICENSE;md5=05fd00eaa848fefa07df5ea3460f874e" + +SRCREV:arc64 = "2a5f158887aa23dd5f3a705716b5fcd44419d74a" + +EXTRA_OECONF:remove:arc64 = "--disable-exec-static-tramp"