summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-devel')
-rw-r--r--sys-devel/binutils-apple/Manifest2
-rw-r--r--sys-devel/binutils-apple/binutils-apple-6.3.ebuild347
-rw-r--r--sys-devel/binutils-apple/files/ld64-242-gcc.patch1038
-rw-r--r--sys-devel/binutils-apple/files/ld64-242-noarm.patch1255
4 files changed, 2642 insertions, 0 deletions
diff --git a/sys-devel/binutils-apple/Manifest b/sys-devel/binutils-apple/Manifest
index 9c32c170d0ad..6133d2049015 100644
--- a/sys-devel/binutils-apple/Manifest
+++ b/sys-devel/binutils-apple/Manifest
@@ -7,6 +7,7 @@ DIST cctools-809.tar.gz 2014410 SHA256 03ba62749b843b131c7304a044a98c6ffacd65b13
DIST cctools-822.tar.gz 2024412 SHA256 dfaa9bdbd023524d47429674f64d2d5ea393123dabf90868be0aa17f61f45289 SHA512 8b02cc837d5e0520f35da445f25ba86b5042d5caa27b49a599e829ed89428cf78dbd1831bcf6c18301f941fbfb31ac2114e248041d98008a466e1574f4fe1586 WHIRLPOOL 81191ab46e8a9e47e4267146f978438ff64314b0363296b973a02f361918a5cd69057753a1b40766b93d3d4a3ed10585a27f6da2953992a406be61d1dcc1d06c
DIST cctools-855.tar.gz 1699635 SHA256 751748ddf32c8ea84c175f32792721fa44424dad6acbf163f84f41e9617dbc58 SHA512 50f5d015ce807aa5ca274dd2deea810b8b375110e60b5e334ca4b2170526b738ea5f86a5436caebbdb748badc3b89601d0f450f5b867d8393c89e336a3db4b3f WHIRLPOOL fa493a29e32583f60c3553794bbb6d01a7b5ef797d8e8ba8161c9cbf237906ebbfaff560366da2d5b852bfcbdd55e874c00edf5b3169b16b357a54fcf3c07c4c
DIST cctools-862.tar.gz 1702345 SHA256 1bf29f620b91c901ad3116b47738ab5076c1aed75d13869cd3bc7f067b4aaadb SHA512 faa401c1dc55bfb9cd2a9a9cc7bc9d473ee63b019607967c8b0da325514d6a1f7b1f52404370bcc018e86d30d75a4b01183f49b793f577110663efe43871360a WHIRLPOOL 371307f3264361f5e2e48d83177aff1a8f435cf2bdc1f4998cc5780c5b3760048a29a7620d2390db8f0c9378cd2f3b2f130b6aca9d402e3d428c4f4d353db097
+DIST cctools-870.tar.gz 1702965 SHA256 b83f4b4696414b814cc1781ec4b68ff9c7bb97920a68f308351a74e75f41d961 SHA512 8cd16350bc2eea576e3922f44de3d15cfcf492a5561215a3a9160f2045284a2fd0fa28e030686868bae8619993fc8901649d7576c56d86a423f9955b27f65138 WHIRLPOOL 9c99188b0e6e71fc3beef674b977f5f59310410b004c26e85e83b7fe7d48f4499a31b982935c695effaa9130781dc10b9a20633800df361a550cf53fb52ba352
DIST dyld-195.5.tar.gz 411615 SHA256 2cf0484c87cf79b606b351a7055a247dae84093ae92c747a74e0cde2c8c8f83c SHA512 f316d32f3e417cf0898a8e231df66572d3424765831375863799d3ff30f8e28342ca692426d0ece7a8d069b341a3b9ca79c625edc322d90e3f26f528ea555324 WHIRLPOOL e0e231653ad37ad8fdb7d5fbd372fe1dc34b80e41f7dafa8bb46f4c8fa4f5acb4574f4cd346304dfaca1f074667f381931ca5ff7a7efddaea770fb35d30539dc
DIST dyld-195.6.tar.gz 412518 SHA256 69296e9b4192bdac778ea899fffc18b02be62b51b5e8474b4cf85ae5f2b08aa4 SHA512 58a9ea27efc02e66f9d99bfa250af1d90326385385431e5279386bbd9ab53366bf7e8236543296908b7214c33523c8f60098a6298a7393b3180e2a6bce18e7c5 WHIRLPOOL e37b11d3996559f8a1843577a5fa42f96e4d42419f205276600f0ed79fcd2490da1f8a77eecf29f111b3db62a65e8e9cd77a154e3b389d633a7ac1525273b9b5
DIST dyld-353.2.1.tar.gz 510036 SHA256 051089e284c5a4d671b21b73866abd01d54e5ea1912cadf3a9b916890fb31540 SHA512 a9488620499f682e245b55b7e0e4ec02fc0bcf03bd8a70d4a4ee0ba762067ade2f41c188990c101727476d41c19368b4cc89cccf2df40231da1c777742c7391f WHIRLPOOL 3164746ed8c866df993f08e405e7e329db427af8eeded681d5fb88031ef2c025363d5bfb647e9315738024adf9f48efacf49226f86f27def584ec7f538da292e
@@ -14,6 +15,7 @@ DIST ld64-127.2.tar.gz 496975 SHA256 97b75547b2bd761306ab3e15ae297f01e7ab9760b92
DIST ld64-128.2.tar.gz 494361 SHA256 96a912464e2d4d3d7cdaab0744003b0fa93d139f203c82867f659ee94b4ae9f7 SHA512 f50a3c396e6f4fddc685bb3f59f9a260bd2f47060535d24259b2b411e4f759e48daa35819da682ad9bceaa1b9a1981eb34716387d988cdc4b7eec9ab2169726e WHIRLPOOL 78dec40124ae11c80483b362860b01c833fcaff67bae6b6cb3b72371daffdf3be809186f5daca4bb6ace77441cb43168939eb60eedf9f8c05ae3ec644c2a0502
DIST ld64-236.3.tar.gz 624400 SHA256 8ef36729b643201081ab45ebd8586ede8f9968bc17614b679a940faa82875ca6 SHA512 e103fc5efd4d4161c7dc55b1ad53aebd455cfcd72de7873ebfdf5ba896b7b0da9c9aeb12e1e1a76425768ac1dc85d864a4ce33b5b841ba115eeab96a2e2965aa WHIRLPOOL d122e325518860c810b9efde7016ebecb6b59c56bb40ae1f041a840be764a5d9b90c7db1922fd9037c18f4caae7ace0d395591ffb3db704c87b92837ef997a17
DIST ld64-241.9.tar.gz 639944 SHA256 3594e87c626c3b5abab6470cac6f27b367f1efcee60eb3d0f6b6d4ecf9b24230 SHA512 6958e7064f4fd8b47501225fc4cbc6292e5da63d7f4103ad79add177ef7382c8de3c732f14d19a9c11356b8070f578392383caccc3795e2ab8ef7b7ddbde88da WHIRLPOOL 5b07a336efde52b00b2601866907513517593a113583f05a9c45b98b4d6f394d87add887a7e44a95f462b6c2b5617ce497376b94a523e5cdf0f69d4d10ef3407
+DIST ld64-242.tar.gz 641597 SHA256 bec1a5e20b599d108be0017736833c1f6212ea26c67f20d8437abc5d23433c36 SHA512 bde2eee69ada7f81d5e97762c371661f304372d5461da4bd843c76d0abcab518193fa71b917850af2022e586a756a3624a0ad28debfa8de6777e3c255d83dd34 WHIRLPOOL d4c54f2a145386fd90a8a12f08010e31a84912c5f11e4a48e08497f282449cc9eb053855f302cf0353035bb2a6513aaed92737ab60c8b3a6bb3a1af626adf475
DIST ld64-85.2.1.tar.gz 598524 SHA256 4bcbcbdfd62efdc46c51700b8f5dae2cbd1638e9e50f649d5c7f242d32fca804 SHA512 b5ffaffc43e74f22688fecd9fb3023a59160cf051f9412f34e6b0acf1c4f9d43ba641e199d8d6b1c6cf3bbbbf117645988fd879ded1fec8be056b6941fe79999 WHIRLPOOL 7c50f462eb41808b57ea06b82bdf576460bddb4150abe7a678af541aa0b179105d994a2b6fd10152481aa28acc903265160945b4aae9dcfce0a1a1cfe4b9460a
DIST ld64-97.17.tar.gz 421947 SHA256 02bd46af0809eaa415d096d7d41c3e8e7d80f7d8d181840866fb87f036b4e089 SHA512 841774a1a7c0e2f661ac7e66703f7578d8f11274897ffa15f8c49daf290a23465763f264a4dae99f15754891f44c425c0d327652112007b499bc8f755a7fc9d6 WHIRLPOOL 7225b44d845b13c6b6d1a685170f2b6e15b81c48320fa3b570771938ed457a59452e80873996a4b2712a8f6813486063afd73acf979a97d823afb3d510d74678
DIST libunwind-30.tar.gz 82811 SHA256 6ac97d18cc2b05e6de1269bf5af03b81948bd2200dae827527f3dc618b82bd41 SHA512 57106eafa1516791b4e0db2de6c6336bc0c1cbd8bf098a6d3a809fafa457802c95a7aeae9137f4ca5922a3018dfd8f597907ea4187b0afbbf267500eae00041f WHIRLPOOL c3caf5ba593cffa2f0a9cdb256f518524e9500eaf0a013c4973dc9881b16efa0c388e70407bbed1fd331f100af2da01ddeee12d33b3afc1213d69c32ab5e1d0b
diff --git a/sys-devel/binutils-apple/binutils-apple-6.3.ebuild b/sys-devel/binutils-apple/binutils-apple-6.3.ebuild
new file mode 100644
index 000000000000..663c6681c0b5
--- /dev/null
+++ b/sys-devel/binutils-apple/binutils-apple-6.3.ebuild
@@ -0,0 +1,347 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils flag-o-matic toolchain-funcs
+
+LD64=ld64-242
+CCTOOLS_VERSION=870
+CCTOOLS=cctools-${CCTOOLS_VERSION}
+LIBUNWIND=libunwind-35.3
+DYLD=dyld-353.2.1
+
+DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools ${PV}"
+HOMEPAGE="http://www.opensource.apple.com/darwinsource/"
+SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz
+ http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz
+ http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz
+ http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz"
+
+LICENSE="APSL-2"
+KEYWORDS="~x64-macos ~x86-macos"
+IUSE="lto test libcxx"
+
+RDEPEND="sys-devel/binutils-config
+ lto? ( sys-devel/llvm )
+ libcxx? ( sys-libs/libcxx )"
+DEPEND="${RDEPEND}
+ test? ( >=dev-lang/perl-5.8.8 )
+ || ( >=sys-devel/gcc-apple-4.2.1 sys-devel/llvm )
+ libcxx? ( sys-devel/llvm )"
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+if is_cross ; then
+ SLOT="${CTARGET}-6"
+else
+ SLOT="6"
+fi
+
+LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
+INCPATH=${LIBPATH}/include
+DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
+if is_cross ; then
+ BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV}
+else
+ BINPATH=/usr/${CTARGET}/binutils-bin/${PV}
+fi
+
+S=${WORKDIR}
+
+src_prepare() {
+ cd "${S}"/${LD64}/src
+ cp "${FILESDIR}"/ld64-136-compile_stubs.h ld/compile_stubs.h
+ cp "${FILESDIR}"/ld64-236.3-Makefile Makefile
+
+ epatch "${FILESDIR}"/ld64-236.3-nolto.patch
+ epatch "${FILESDIR}"/ld64-241.9-extraneous-includes.patch
+ epatch "${FILESDIR}"/ld64-241.9-atomic-volatile.patch
+ epatch "${FILESDIR}"/ld64-236.3-crashreporter.patch
+ epatch "${FILESDIR}"/ld64-242-gcc.patch
+ epatch "${FILESDIR}"/ld64-236.3-constant-types.patch
+ epatch "${FILESDIR}"/ld64-241.9-nosnapshots.patch
+ epatch "${FILESDIR}"/ld64-242-noarm.patch
+ epatch "${FILESDIR}"/ld64-241.9-register-names.patch
+ epatch "${FILESDIR}"/ld64-241.9-get-comm-align.patch
+ epatch "${FILESDIR}"/ld64-241.9-cc_md5.patch
+
+ # provide missing headers from libunwind and dyld
+ mkdir -p include/{mach,mach-o/arm} || die
+ # never present because it's private
+ cp ../../${DYLD}/include/mach-o/dyld_priv.h include/mach-o || die
+ # missing on <= 10.5
+ cp ../../${LIBUNWIND}/include/libunwind.h include/ || die
+ cp ../../${LIBUNWIND}/include/mach-o/compact_unwind_encoding.h include/mach-o || die
+ # missing on <= 10.4
+ cp ../../${DYLD}/include/mach-o/dyld_images.h include/mach-o || die
+ cp ../../${CCTOOLS}/include/mach-o/loader.h include/mach-o || die
+ # use copies from cctools because they're otherwise hidden in some SDK
+ cp ../../${CCTOOLS}/include/mach-o/arm/reloc.h include/mach-o/arm || die
+ # provide all required CPU_TYPEs on all platforms
+ cp ../../${CCTOOLS}/include/mach/machine.h include/mach/machine.h
+ # add alias for newer identifiers, because ld64 uses both but cctools
+ # header only defines the older
+ epatch "${FILESDIR}"/ld64-236.3-missing-cputypes.patch
+
+ # mimic OS X Leopard-style Availability.h macros for libunwind.h on
+ # older systems
+ [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] && \
+ echo "#define __OSX_AVAILABLE_STARTING(x,y) " > include/Availability.h
+
+ local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64} (Gentoo ${PN}-${PVR})\\n\""
+ echo "char ldVersionString[] = ${VER_STR};" > version.cpp
+
+ epatch "${FILESDIR}"/ld64-123.2-debug-backtrace.patch
+
+ cd "${S}"/${CCTOOLS}
+ epatch "${FILESDIR}"/${PN}-4.5-as.patch
+ epatch "${FILESDIR}"/${PN}-5.1-as-dir.patch
+ epatch "${FILESDIR}"/${PN}-5.1-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
+ epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
+ epatch "${FILESDIR}"/${PN}-4.0-no-oss-dir.patch
+ epatch "${FILESDIR}"/cctools-839-intel-retf.patch
+ epatch "${FILESDIR}"/${PN}-5.1-extraneous-includes.patch
+ epatch "${FILESDIR}"/${PN}-5.1-otool-stdc.patch
+ epatch "${FILESDIR}"/${PN}-5.1-constant-types.patch
+ epatch "${FILESDIR}"/${PN}-5.1-strnlen.patch
+ cp ../${LD64}/src/other/prune_trie.h include/mach-o/ || die
+
+ # do not build profileable libstuff to save compile time
+ sed -i -e "/^all:/s, profile , ," libstuff/Makefile
+
+ # cctools version is provided to make via RC_ProjectSourceVersion which
+ # generates and compiles it as apple_version[] into libstuff. From
+ # there it's picked up by the individual tools. Since
+ # RC_ProjectSourceVersion is also used as library version, we can't
+ # just append our local version info. So we hack the libstuff Makefile
+ # to include our Gentoo version.
+ sed -i -e "/cctools-.*(RC_ProjectSourceVersion).*OFILE_DIR/s,Version),Version) (Gentoo ${PN}-${PVR})," \
+ libstuff/Makefile
+
+ # clean up test suite
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ local c
+
+ # we don't have llvm
+ ((++c)); rm -rf llvm-integration;
+
+ # we don't have dtrace
+ ((++c)); rm -rf dtrace-static-probes-coalescing;
+ ((++c)); rm -rf dtrace-static-probes;
+
+ # a file is missing
+ ((++c)); rm -rf eh-coalescing-r
+
+ # we don't do universal binaries
+ ((++c)); rm -rf blank-stubs;
+
+ # looks like a problem with apple's result-filter.pl
+ ((++c)); rm -rf implicit-common3;
+ ((++c)); rm -rf order_file-ans;
+
+ # TODO no idea what goes wrong here
+ ((++c)); rm -rf dwarf-debug-notes;
+
+ einfo "Deleted $c tests that were bound to fail"
+
+ cd "${S}"
+ ebegin "cleaning Makefiles from unwanted CFLAGS"
+ find . -name "Makefile" -print0 | xargs -0 sed \
+ -i \
+ -e 's/ -g / /g' \
+ -e 's/^G =.*$/G =/' \
+ -e 's/^OFLAG =.*$/OFLAG =/' \
+ -e 's/install -c -s/install/g'
+ eend $?
+}
+
+src_configure() {
+ CCTOOLS_LTO=
+ LD64_LTO=0
+ if use lto ; then
+ CCTOOLS_LTO="-DLTO_SUPPORT"
+ LD64_LTO=1
+ fi
+
+ if [[ ${CXX} == *clang* ]] ; then
+ if use libcxx ; then
+ append-cxxflags -stdlib=libc++
+ CXXLIB=-stdlib=libc++
+ else
+ # force libstdc++ for systems where libc++ is default (OS X 10.9+?)
+ append-cxxflags -stdlib=libstdc++
+ CXXLIB=-stdlib=libstdc++
+ fi
+ else
+ use libcxx && \
+ ewarn "libcxx only available with clang and your C++ compiler ($CXX) does not seem to be clang"
+ fi
+
+ # CPPFLAGS only affects ld64, cctools don't use 'em (which currently is
+ # what we want)
+ append-cppflags -DNDEBUG
+
+ # Block API and thus snapshots supported on >= 10.6
+ [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -ge 10 ]] && \
+ append-cppflags -DSUPPORT_SNAPSHOTS
+
+ CCTOOLS_OFLAG=
+ if [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] ; then
+ # cctools expect to use UNIX03 struct member names.
+ # This is default on > 10.4. Activate it on <= 10.4 by defining
+ # __DARWIN_UNIX03 explicitly.
+ CCTOOLS_OFLAG="-D__DARWIN_UNIX03=1"
+ fi
+
+ # Create configure.h for ld64 with SUPPORT_ARCH_<arch> defines in it.
+ # RC_SUPPORTED_ARCHS="i386 x86_64 x86_64h armv6 ..." can be used to
+ # override architectures (there are more arms to add) but we configure
+ # with the default to be in line with Xcode's ld.
+ DERIVED_FILE_DIR=${LD64}/src \
+ RC_SUPPORTED_ARCHS="" \
+ ${LD64}/src/create_configure
+}
+
+compile_ld64() {
+ einfo "building ${LD64}"
+ cd "${S}"/${LD64}/src
+ emake \
+ LTO=${LD64_LTO} \
+ || die "emake failed for ld64"
+ use test && emake build_test
+}
+
+compile_cctools() {
+ einfo "building ${CCTOOLS}"
+ cd "${S}"/${CCTOOLS}
+ # -j1 because it fails too often with weird errors
+ # Suppress running dsymutil because it will warn about missing debug
+ # info which is expected when compiling without -g as we normally do.
+ # This might need some more thought if anyone ever wanted to build us
+ # for debugging with Apple's tools.
+ emake \
+ LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \
+ EFITOOLS= \
+ LTO="${CCTOOLS_LTO}" \
+ COMMON_SUBDIRS='libstuff ar misc otool' \
+ SUBDIRS_32= \
+ LEGACY= \
+ RC_ProjectSourceVersion=${CCTOOLS_VERSION} \
+ RC_CFLAGS="${CFLAGS}" \
+ OFLAG="${CCTOOLS_OFLAG}" \
+ CXXLIB="${CXXLIB}" \
+ DSYMUTIL=": disabled: dsymutil" \
+ -j1 \
+ || die "emake failed for the cctools"
+ cd "${S}"/${CCTOOLS}/as
+ emake \
+ BUILD_OBSOLETE_ARCH= \
+ RC_ProjectSourceVersion=${CCTOOLS_VERSION} \
+ RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" ${CFLAGS}" \
+ OFLAG="${CCTOOLS_OFLAG}" \
+ DSYMUTIL=": disabled: dsymutil" \
+ || die "emake failed for as"
+}
+
+src_compile() {
+ compile_ld64
+ compile_cctools
+}
+
+install_ld64() {
+ exeinto ${BINPATH}
+ doexe "${S}"/${LD64}/src/{ld64,rebase,dyldinfo,unwinddump,ObjectDump}
+ dosym ld64 ${BINPATH}/ld
+ insinto ${DATAPATH}/man/man1
+ doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1
+}
+
+install_cctools() {
+ cd "${S}"/${CCTOOLS}
+ emake install_all_but_headers \
+ EFITOOLS= \
+ COMMON_SUBDIRS='ar misc otool' \
+ SUBDIRS_32= \
+ DSTROOT=\"${D}\" \
+ BINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCBINDIR=\"${EPREFIX}\"${BINPATH} \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \
+ MANDIR=\"${EPREFIX}\"${DATAPATH}/man/
+ cd "${S}"/${CCTOOLS}/as
+ emake install \
+ BUILD_OBSOLETE_ARCH= \
+ DSTROOT=\"${D}\" \
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \
+ LIBDIR=\"${EPREFIX}\"${LIBPATH} \
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH}
+
+ cd "${ED}"${BINPATH}
+ insinto ${DATAPATH}/man/man1
+ local skips manpage
+ # ar brings an up-to-date manpage with it
+ skips=( ar )
+ for bin in *; do
+ for skip in ${skips[@]}; do
+ if [[ ${bin} == ${skip} ]]; then
+ continue 2;
+ fi
+ done
+ manpage=${S}/${CCTOOLS}/man/${bin}.1
+ if [[ -f "${manpage}" ]]; then
+ doins "${manpage}"
+ fi
+ done
+ insinto ${DATAPATH}/man/man5
+ doins "${S}"/${CCTOOLS}/man/*.5
+}
+
+src_test() {
+ if ! [ "${EPREFIX}"/usr/bin/clang ] ; then
+ einfo "Test suite only works properly with clang - please install"
+ return
+ fi
+
+ einfo "Running unit tests"
+ cd "${S}"/${LD64}/unit-tests/test-cases
+ # provide the new ld as a symlink to clang so that -ccc-install-dir
+ # will pick it up
+ ln -sfn ../../src/ld64 ld
+ # use our arch command because the System's will report i386 even for an
+ # x86_64 prefix
+ perl ../bin/make-recursive.pl \
+ BUILT_PRODUCTS_DIR="${S}"/${LD64}/src \
+ ARCH="$(arch)" \
+ LD="${S}"/${LD64}/src/ld64 \
+ CC="clang -ccc-install-dir $PWD" \
+ CXX="clang++ -ccc-install-dir $PWD" \
+ OTOOL="${S}"/${CCTOOLS}/otool/otool.NEW \
+ | perl ../bin/result-filter.pl
+}
+
+src_install() {
+ install_ld64
+ install_cctools
+
+ cd "${S}"
+ insinto /etc/env.d/binutils
+ cat <<-EOF > env.d
+ TARGET="${CHOST}"
+ VER="${PV}"
+ FAKE_TARGETS="${CHOST}"
+ EOF
+ newins env.d ${CHOST}-${PV}
+}
+
+pkg_postinst() {
+ binutils-config ${CHOST}-${PV}
+}
diff --git a/sys-devel/binutils-apple/files/ld64-242-gcc.patch b/sys-devel/binutils-apple/files/ld64-242-gcc.patch
new file mode 100644
index 000000000000..b6e1dbbbbe05
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-242-gcc.patch
@@ -0,0 +1,1038 @@
+Provide c++11 headers from tr1 include directory and namespace.
+
+Work around weird namespacing bug in gcc-4.2.1 where class ld::Section
+conflicts with template mach_o::relocatable::Section by renaming the latter to
+MRFSection (could possibly be done using sed from ebuild or avoided by figuring
+out, what's actually going on with those namespaces).
+
+--- ld64-242/src/ld/InputFiles.h.gcc 2015-08-03 01:11:48.000000000 +0200
++++ ld64-242/src/ld/InputFiles.h 2015-08-03 01:11:57.000000000 +0200
+@@ -46,6 +46,14 @@
+ #include <pthread.h>
+ #endif
+
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#else
++#include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#endif
++
+ #include <vector>
+
+ #include "Options.h"
+@@ -112,7 +120,7 @@
+ static void parseWorkerThread(InputFiles *inputFiles);
+ void startThread(void (*threadFunc)(InputFiles *)) const;
+
+- typedef std::unordered_map<const char*, ld::dylib::File*, CStringHash, CStringEquals> InstallNameToDylib;
++ typedef std::UNORDERED_MAP<const char*, ld::dylib::File*, CStringHash, CStringEquals> InstallNameToDylib;
+
+ const Options& _options;
+ std::vector<ld::File*> _inputFiles;
+--- ld64-242/src/ld/ld.cpp.gcc 2015-08-03 01:11:48.000000000 +0200
++++ ld64-242/src/ld/ld.cpp 2015-08-03 01:11:57.000000000 +0200
+@@ -56,7 +56,13 @@
+ #include <vector>
+ #include <list>
+ #include <algorithm>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#else
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#endif
+ #include <cxxabi.h>
+
+ #include "Options.h"
+@@ -153,7 +159,7 @@
+ struct SectionEquals {
+ bool operator()(const ld::Section* left, const ld::Section* right) const;
+ };
+- typedef std::unordered_map<const ld::Section*, FinalSection*, SectionHash, SectionEquals> SectionInToOut;
++ typedef std::UNORDERED_MAP<const ld::Section*, FinalSection*, SectionHash, SectionEquals> SectionInToOut;
+
+
+ SectionInToOut _sectionInToFinalMap;
+--- ld64-242/src/ld/ld.hpp.gcc 2015-08-03 01:11:48.000000000 +0200
++++ ld64-242/src/ld/ld.hpp 2015-08-03 01:11:57.000000000 +0200
+@@ -32,7 +32,13 @@
+ #include <assert.h>
+
+ #include <vector>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "configure.h"
+
+@@ -822,7 +828,7 @@
+ bool operator()(const char* left, const char* right) const { return (strcmp(left, right) == 0); }
+ };
+
+-typedef std::unordered_set<const char*, ld::CStringHash, ld::CStringEquals> CStringSet;
++typedef std::UNORDERED_SET<const char*, ld::CStringHash, ld::CStringEquals> CStringSet;
+
+ class Internal
+ {
+--- ld64-242/src/ld/LinkEditClassic.hpp.gcc 2015-08-03 01:11:48.000000000 +0200
++++ ld64-242/src/ld/LinkEditClassic.hpp 2015-08-03 01:11:57.000000000 +0200
+@@ -31,8 +31,13 @@
+ #include <limits.h>
+ #include <unistd.h>
+
+-#include <vector>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#else
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#endif
+
+ #if !defined(SET_COMM_ALIGN)
+ /* missing on < 10.5 */
+@@ -98,7 +103,7 @@
+
+ private:
+ enum { kBufferSize = 0x01000000 };
+- typedef std::unordered_map<const char*, int32_t, CStringHash, CStringEquals> StringToOffset;
++ typedef std::UNORDERED_MAP<const char*, int32_t, CStringHash, CStringEquals> StringToOffset;
+
+ const uint32_t _pointerSize;
+ std::vector<char*> _fullBuffers;
+--- ld64-242/src/ld/Options.cpp.gcc 2015-08-03 01:11:48.000000000 +0200
++++ ld64-242/src/ld/Options.cpp 2015-08-03 01:11:57.000000000 +0200
+@@ -4743,7 +4743,7 @@
+
+ // make sure all required exported symbols exist
+ std::vector<const char*> impliedExports;
+- for (NameSet::iterator it=fExportSymbols.regularBegin(); it != fExportSymbols.regularEnd(); ++it) {
++ for (NameSet::const_iterator it=fExportSymbols.regularBegin(); it != fExportSymbols.regularEnd(); ++it) {
+ const char* name = *it;
+ const int len = strlen(name);
+ if ( (strcmp(&name[len-3], ".eh") == 0) || (strncmp(name, ".objc_category_name_", 20) == 0) ) {
+@@ -4775,7 +4775,7 @@
+ }
+
+ // make sure all required re-exported symbols exist
+- for (NameSet::iterator it=fReExportSymbols.regularBegin(); it != fReExportSymbols.regularEnd(); ++it) {
++ for (NameSet::const_iterator it=fReExportSymbols.regularBegin(); it != fReExportSymbols.regularEnd(); ++it) {
+ fInitialUndefines.push_back(*it);
+ }
+
+--- ld64-242/src/ld/Options.h.gcc 2015-08-03 01:11:48.000000000 +0200
++++ ld64-242/src/ld/Options.h 2015-08-03 01:11:57.000000000 +0200
+@@ -30,8 +30,17 @@
+ #include <mach/machine.h>
+
+ #include <vector>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "ld.hpp"
+ #include "Snapshot.h"
+@@ -401,8 +410,8 @@
+ bool moveRwSymbol(const char* symName, const char* filePath, const char*& seg, bool& wildCardMatch) const;
+
+ private:
+- typedef std::unordered_map<const char*, unsigned int, ld::CStringHash, ld::CStringEquals> NameToOrder;
+- typedef std::unordered_set<const char*, ld::CStringHash, ld::CStringEquals> NameSet;
++ typedef std::UNORDERED_MAP<const char*, unsigned int, ld::CStringHash, ld::CStringEquals> NameToOrder;
++ typedef std::UNORDERED_SET<const char*, ld::CStringHash, ld::CStringEquals> NameSet;
+ enum ExportMode { kExportDefault, kExportSome, kDontExportSome };
+ enum LibrarySearchMode { kSearchDylibAndArchiveInEachDir, kSearchAllDirsForDylibsThenAllDirsForArchives };
+ enum InterposeMode { kInterposeNone, kInterposeAllExternal, kInterposeSome };
+@@ -415,8 +424,8 @@
+ bool containsNonWildcard(const char*) const;
+ bool empty() const { return fRegular.empty() && fWildCard.empty(); }
+ bool hasWildCards() const { return !fWildCard.empty(); }
+- NameSet::iterator regularBegin() const { return fRegular.begin(); }
+- NameSet::iterator regularEnd() const { return fRegular.end(); }
++ NameSet::const_iterator regularBegin() const { return fRegular.begin(); }
++ NameSet::const_iterator regularEnd() const { return fRegular.end(); }
+ void remove(const NameSet&);
+ private:
+ static bool hasWildCards(const char*);
+--- ld64-242/src/ld/OutputFile.cpp.gcc 2015-08-03 01:11:48.000000000 +0200
++++ ld64-242/src/ld/OutputFile.cpp 2015-08-03 01:11:57.000000000 +0200
+@@ -50,7 +50,13 @@
+ #include <vector>
+ #include <list>
+ #include <algorithm>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include <CommonCrypto/CommonDigest.h>
+ #include <AvailabilityMacros.h>
+@@ -4800,7 +4806,7 @@
+ const char* filename = NULL;
+ bool wroteStartSO = false;
+ state.stabs.reserve(atomsNeedingDebugNotes.size()*4);
+- std::unordered_set<const char*, CStringHash, CStringEquals> seenFiles;
++ std::UNORDERED_SET<const char*, CStringHash, CStringEquals> seenFiles;
+ for (std::vector<const ld::Atom*>::iterator it=atomsNeedingDebugNotes.begin(); it != atomsNeedingDebugNotes.end(); it++) {
+ const ld::Atom* atom = *it;
+ const ld::File* atomFile = atom->file();
+--- ld64-242/src/ld/parsers/archive_file.cpp.gcc 2015-08-03 01:11:48.000000000 +0200
++++ ld64-242/src/ld/parsers/archive_file.cpp 2015-08-03 01:11:57.000000000 +0200
+@@ -33,7 +33,13 @@
+ #include <set>
+ #include <map>
+ #include <algorithm>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#else
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#endif
+
+ #include "MachOFileAbstraction.hpp"
+ #include "Architectures.hpp"
+@@ -116,7 +122,7 @@
+ struct MemberState { ld::relocatable::File* file; const Entry *entry; bool logged; bool loaded; uint32_t index;};
+ bool loadMember(MemberState& state, ld::File::AtomHandler& handler, const char *format, ...) const;
+
+- typedef std::unordered_map<const char*, const struct ranlib*, ld::CStringHash, ld::CStringEquals> NameToEntryMap;
++ typedef std::UNORDERED_MAP<const char*, const struct ranlib*, ld::CStringHash, ld::CStringEquals> NameToEntryMap;
+
+ typedef typename A::P P;
+ typedef typename A::P::E E;
+--- ld64-242/src/ld/parsers/lto_file.cpp.gcc 2015-08-03 01:11:48.000000000 +0200
++++ ld64-242/src/ld/parsers/lto_file.cpp 2015-08-03 01:11:57.000000000 +0200
+@@ -33,8 +33,17 @@
+ #include <pthread.h>
+ #include <mach-o/dyld.h>
+ #include <vector>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "MachOFileAbstraction.hpp"
+ #include "Architectures.hpp"
+@@ -218,8 +227,8 @@
+ static void ltoDiagnosticHandler(lto_codegen_diagnostic_severity_t, const char*, void*);
+ #endif
+
+- typedef std::unordered_set<const char*, ld::CStringHash, ld::CStringEquals> CStringSet;
+- typedef std::unordered_map<const char*, Atom*, ld::CStringHash, ld::CStringEquals> CStringToAtom;
++ typedef std::UNORDERED_SET<const char*, ld::CStringHash, ld::CStringEquals> CStringSet;
++ typedef std::UNORDERED_MAP<const char*, Atom*, ld::CStringHash, ld::CStringEquals> CStringToAtom;
+
+ class AtomSyncer : public ld::File::AtomHandler {
+ public:
+--- ld64-242/src/ld/parsers/macho_dylib_file.cpp.gcc 2015-08-03 01:11:48.000000000 +0200
++++ ld64-242/src/ld/parsers/macho_dylib_file.cpp 2015-08-03 01:11:57.000000000 +0200
+@@ -34,8 +34,17 @@
+ #include <vector>
+ #include <set>
+ #include <algorithm>
+-#include <unordered_map>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
++#include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "Architectures.hpp"
+ #include "MachOFileAbstraction.hpp"
+@@ -193,8 +202,8 @@
+ };
+ };
+ struct AtomAndWeak { ld::Atom* atom; bool weakDef; bool tlv; pint_t address; };
+- typedef std::unordered_map<const char*, AtomAndWeak, ld::CStringHash, ld::CStringEquals> NameToAtomMap;
+- typedef std::unordered_set<const char*, CStringHash, ld::CStringEquals> NameSet;
++ typedef std::UNORDERED_MAP<const char*, AtomAndWeak, ld::CStringHash, ld::CStringEquals> NameToAtomMap;
++ typedef std::UNORDERED_SET<const char*, CStringHash, ld::CStringEquals> NameSet;
+
+ struct Dependent { const char* path; File<A>* dylib; bool reExport; };
+
+@@ -566,14 +575,18 @@
+ if ( _s_logHashtable ) fprintf(stderr, "ld: building hashtable of %u toc entries for %s\n", dynamicInfo->nextdefsym(), this->path());
+ const macho_nlist<P>* start = &symbolTable[dynamicInfo->iextdefsym()];
+ const macho_nlist<P>* end = &start[dynamicInfo->nextdefsym()];
++#ifndef __GLIBCXX__
+ _atoms.reserve(dynamicInfo->nextdefsym()); // set initial bucket count
++#endif
+ for (const macho_nlist<P>* sym=start; sym < end; ++sym) {
+ this->addSymbol(&strings[sym->n_strx()], (sym->n_desc() & N_WEAK_DEF) != 0, false, sym->n_value());
+ }
+ }
+ else {
+ int32_t count = dynamicInfo->ntoc();
++#ifndef __GLIBCXX__
+ _atoms.reserve(count); // set initial bucket count
++#endif
+ if ( _s_logHashtable ) fprintf(stderr, "ld: building hashtable of %u entries for %s\n", count, this->path());
+ const struct dylib_table_of_contents* toc = (dylib_table_of_contents*)(fileContent + dynamicInfo->tocoff());
+ for (int32_t i = 0; i < count; ++i) {
+--- ld64-242/src/ld/parsers/macho_relocatable_file.cpp.gcc 2015-08-03 01:11:48.000000000 +0200
++++ ld64-242/src/ld/parsers/macho_relocatable_file.cpp 2015-08-03 01:12:27.000000000 +0200
+@@ -66,7 +66,7 @@
+ // forward reference
+ template <typename A> class Parser;
+ template <typename A> class Atom;
+-template <typename A> class Section;
++template <typename A> class MRFSection;
+ template <typename A> class CFISection;
+ template <typename A> class CUSection;
+
+@@ -106,14 +106,14 @@
+ const uint8_t* fileContent() { return _fileContent; }
+ private:
+ friend class Atom<A>;
+- friend class Section<A>;
++ friend class MRFSection<A>;
+ friend class Parser<A>;
+ friend class CFISection<A>::OAS;
+
+ typedef typename A::P P;
+
+ const uint8_t* _fileContent;
+- Section<A>** _sectionsArray;
++ MRFSection<A>** _sectionsArray;
+ uint8_t* _atomsArray;
+ uint8_t* _aliasAtomsArray;
+ uint32_t _sectionsArrayCount;
+@@ -138,14 +138,14 @@
+
+
+ template <typename A>
+-class Section : public ld::Section
++class MRFSection : public ld::Section
+ {
+ public:
+ typedef typename A::P::uint_t pint_t;
+ typedef typename A::P P;
+ typedef typename A::P::E E;
+
+- virtual ~Section() { }
++ virtual ~MRFSection() { }
+ class File<A>& file() const { return _file; }
+ const macho_section<P>* machoSection() const { return _machOSection; }
+ uint32_t sectionNum(class Parser<A>&) const;
+@@ -169,10 +169,10 @@
+ static const char* makeSectionName(const macho_section<typename A::P>* s);
+
+ protected:
+- Section(File<A>& f, const macho_section<typename A::P>* s)
++ MRFSection(File<A>& f, const macho_section<typename A::P>* s)
+ : ld::Section(makeSegmentName(s), makeSectionName(s), sectionType(s)),
+ _file(f), _machOSection(s), _beginAtoms(NULL), _endAtoms(NULL), _hasAliases(false) { }
+- Section(File<A>& f, const char* segName, const char* sectName, ld::Section::Type t, bool hidden=false)
++ MRFSection(File<A>& f, const char* segName, const char* sectName, ld::Section::Type t, bool hidden=false)
+ : ld::Section(segName, sectName, t, hidden), _file(f), _machOSection(NULL),
+ _beginAtoms(NULL), _endAtoms(NULL), _hasAliases(false) { }
+
+@@ -196,11 +196,11 @@
+
+
+ template <typename A>
+-class CFISection : public Section<A>
++class CFISection : public MRFSection<A>
+ {
+ public:
+ CFISection(Parser<A>& parser, File<A>& f, const macho_section<typename A::P>* s)
+- : Section<A>(f, s) { }
++ : MRFSection<A>(f, s) { }
+ uint32_t cfiCount(Parser<A>& parser);
+
+ virtual ld::Atom::ContentType contentType() { return ld::Atom::typeCFI; }
+@@ -260,11 +260,11 @@
+
+
+ template <typename A>
+-class CUSection : public Section<A>
++class CUSection : public MRFSection<A>
+ {
+ public:
+ CUSection(Parser<A>& parser, File<A>& f, const macho_section<typename A::P>* s)
+- : Section<A>(f, s) { }
++ : MRFSection<A>(f, s) { }
+
+ typedef typename A::P::uint_t pint_t;
+ typedef typename A::P P;
+@@ -301,11 +301,11 @@
+
+
+ template <typename A>
+-class TentativeDefinitionSection : public Section<A>
++class TentativeDefinitionSection : public MRFSection<A>
+ {
+ public:
+ TentativeDefinitionSection(Parser<A>& parser, File<A>& f)
+- : Section<A>(f, "__DATA", "__comm/tent", ld::Section::typeTentativeDefs) {}
++ : MRFSection<A>(f, "__DATA", "__comm/tent", ld::Section::typeTentativeDefs) {}
+
+ virtual ld::Atom::ContentType contentType() { return ld::Atom::typeZeroFill; }
+ virtual bool addFollowOnFixups() const { return false; }
+@@ -323,11 +323,11 @@
+
+
+ template <typename A>
+-class AbsoluteSymbolSection : public Section<A>
++class AbsoluteSymbolSection : public MRFSection<A>
+ {
+ public:
+ AbsoluteSymbolSection(Parser<A>& parser, File<A>& f)
+- : Section<A>(f, "__DATA", "__abs", ld::Section::typeAbsoluteSymbols, true) {}
++ : MRFSection<A>(f, "__DATA", "__abs", ld::Section::typeAbsoluteSymbols, true) {}
+
+ virtual ld::Atom::ContentType contentType() { return ld::Atom::typeUnclassified; }
+ virtual bool dontDeadStrip() { return false; }
+@@ -349,7 +349,7 @@
+
+
+ template <typename A>
+-class SymboledSection : public Section<A>
++class SymboledSection : public MRFSection<A>
+ {
+ public:
+ SymboledSection(Parser<A>& parser, File<A>& f, const macho_section<typename A::P>* s);
+@@ -381,11 +381,11 @@
+
+
+ template <typename A>
+-class ImplicitSizeSection : public Section<A>
++class ImplicitSizeSection : public MRFSection<A>
+ {
+ public:
+ ImplicitSizeSection(Parser<A>& parser, File<A>& f, const macho_section<typename A::P>* s)
+- : Section<A>(f, s) { }
++ : MRFSection<A>(f, s) { }
+ virtual uint32_t computeAtomCount(class Parser<A>& parser, struct Parser<A>::LabelAndCFIBreakIterator& it, const struct Parser<A>::CFI_CU_InfoArrays&);
+ virtual uint32_t appendAtoms(class Parser<A>& parser, uint8_t* buffer, struct Parser<A>::LabelAndCFIBreakIterator& it, const struct Parser<A>::CFI_CU_InfoArrays&);
+ protected:
+@@ -722,8 +722,8 @@
+
+ public:
+ // methods for all atoms from mach-o object file
+- Section<A>& sect() const { return (Section<A>&)section(); }
+- File<A>& machofile() const { return ((Section<A>*)(this->_section))->file(); }
++ MRFSection<A>& sect() const { return (MRFSection<A>&)section(); }
++ File<A>& machofile() const { return ((MRFSection<A>*)(this->_section))->file(); }
+ void setFixupsRange(uint32_t s, uint32_t c);
+ void setUnwindInfoRange(uint32_t s, uint32_t c);
+ void extendUnwindInfoRange();
+@@ -740,7 +740,7 @@
+ typedef typename A::P::E E;
+ typedef typename A::P::uint_t pint_t;
+ // constuct via all attributes
+- Atom(Section<A>& sct, const char* nm, pint_t addr, uint64_t sz,
++ Atom(MRFSection<A>& sct, const char* nm, pint_t addr, uint64_t sz,
+ ld::Atom::Definition d, ld::Atom::Combine c, ld::Atom::Scope s,
+ ld::Atom::ContentType ct, ld::Atom::SymbolTableInclusion i,
+ bool dds, bool thumb, bool al, ld::Atom::Alignment a)
+@@ -750,7 +750,7 @@
+ _unwindInfoStartIndex(0), _fixupsCount(0),
+ _lineInfoCount(0), _unwindInfoCount(0) { }
+ // construct via symbol table entry
+- Atom(Section<A>& sct, Parser<A>& parser, const macho_nlist<P>& sym,
++ Atom(MRFSection<A>& sct, Parser<A>& parser, const macho_nlist<P>& sym,
+ uint64_t sz, bool alias=false)
+ : ld::Atom((ld::Section&)sct, parser.definitionFromSymbol(sym),
+ parser.combineFromSymbol(sym), parser.scopeFromSymbol(sym),
+@@ -773,7 +773,7 @@
+
+ private:
+ friend class Parser<A>;
+- friend class Section<A>;
++ friend class MRFSection<A>;
+ friend class CStringSection<A>;
+ friend class AbsoluteSymbolSection<A>;
+
+@@ -1040,8 +1040,8 @@
+ uint32_t undefinedStartIndex() { return _undefinedStartIndex; }
+ uint32_t undefinedEndIndex() { return _undefinedEndIndex; }
+ void addFixup(FixupInAtom f) { _allFixups.push_back(f); }
+- Section<A>* sectionForNum(unsigned int sectNum);
+- Section<A>* sectionForAddress(pint_t addr);
++ MRFSection<A>* sectionForNum(unsigned int sectNum);
++ MRFSection<A>* sectionForAddress(pint_t addr);
+ Atom<A>* findAtomByAddress(pint_t addr);
+ Atom<A>* findAtomByAddressOrNullIfStub(pint_t addr);
+ Atom<A>* findAtomByAddressOrLocalTargetOfStub(pint_t addr, uint32_t* offsetInAtom);
+@@ -1084,7 +1084,7 @@
+ : sortedSymbolIndexes(ssa), sortedSymbolCount(ssc), cfiStartsArray(cfisa),
+ cfiStartsCount(cfisc), fileHasOverlappingSymbols(ols),
+ newSection(false), cfiIndex(0), symIndex(0) {}
+- bool next(Parser<A>& parser, const Section<A>& sect, uint32_t sectNum, pint_t startAddr, pint_t endAddr,
++ bool next(Parser<A>& parser, const MRFSection<A>& sect, uint32_t sectNum, pint_t startAddr, pint_t endAddr,
+ pint_t* addr, pint_t* size, const macho_nlist<P>** sym);
+ pint_t peek(Parser<A>& parser, pint_t startAddr, pint_t endAddr);
+ void beginSection() { newSection = true; symIndex = 0; }
+@@ -1113,7 +1113,7 @@
+
+
+ private:
+- friend class Section<A>;
++ friend class MRFSection<A>;
+
+ enum SectionType { sectionTypeIgnore, sectionTypeLiteral4, sectionTypeLiteral8, sectionTypeLiteral16,
+ sectionTypeNonLazy, sectionTypeCFI, sectionTypeCString, sectionTypeCStringPointer,
+@@ -1465,7 +1465,7 @@
+ // was becuase of a label, the symbol). Returns false when no more chunks.
+ //
+ template <typename A>
+-bool Parser<A>::LabelAndCFIBreakIterator::next(Parser<A>& parser, const Section<A>& sect, uint32_t sectNum, pint_t startAddr, pint_t endAddr,
++bool Parser<A>::LabelAndCFIBreakIterator::next(Parser<A>& parser, const MRFSection<A>& sect, uint32_t sectNum, pint_t startAddr, pint_t endAddr,
+ pint_t* addr, pint_t* size, const macho_nlist<P>** symbol)
+ {
+ // may not be a label on start of section, but need atom demarcation there
+@@ -1618,7 +1618,7 @@
+
+ #if SUPPORT_ARCH_arm_any
+ template <>
+-typename arm::P::uint_t Parser<arm>::realAddr(typename arm::P::uint_t addr)
++arm::P::uint_t Parser<arm>::realAddr(arm::P::uint_t addr)
+ {
+ return addr & (-2);
+ }
+@@ -1667,7 +1667,7 @@
+ uint32_t sortedSymbolIndexes[_symbolsInSections];
+ this->makeSortedSymbolsArray(sortedSymbolIndexes, sortedSectionIndexes);
+
+- // allocate Section<A> object for each mach-o section
++ // allocate MRFSection<A> object for each mach-o section
+ makeSections();
+
+ // if it exists, do special early parsing of __compact_unwind section
+@@ -1764,7 +1764,7 @@
+ #endif
+ }
+
+- Section<A>** sections = _file->_sectionsArray;
++ MRFSection<A>** sections = _file->_sectionsArray;
+ uint32_t sectionsCount = _file->_sectionsArrayCount;
+
+ // figure out how many atoms will be allocated and allocate
+@@ -2331,11 +2331,11 @@
+ _file->_swiftVersion = ((flags >> 8) & 0xFF);
+ if ( sect->size() > 8 ) {
+ warning("section %s/%s has unexpectedly large size %llu in %s",
+- sect->segname(), Section<A>::makeSectionName(sect), sect->size(), _file->path());
++ sect->segname(), MRFSection<A>::makeSectionName(sect), sect->size(), _file->path());
+ }
+ }
+ else {
+- warning("can't parse %s/%s section in %s", sect->segname(), Section<A>::makeSectionName(sect), _file->path());
++ warning("can't parse %s/%s section in %s", sect->segname(), MRFSection<A>::makeSectionName(sect), _file->path());
+ }
+ continue;
+ }
+@@ -2431,24 +2431,24 @@
+ // sort by address (mach-o object files don't aways have sections sorted)
+ ::qsort(machOSects, count, sizeof(MachOSectionAndSectionClass<P>), MachOSectionAndSectionClass<P>::sorter);
+
+- // we will synthesize a dummy Section<A> object for tentative definitions
++ // we will synthesize a dummy MRFSection<A> object for tentative definitions
+ if ( _tentativeDefinitionCount > 0 ) {
+ totalSectionsSize += sizeof(TentativeDefinitionSection<A>);
+ machOSects[count++].type = sectionTypeTentativeDefinitions;
+ }
+
+- // we will synthesize a dummy Section<A> object for Absolute symbols
++ // we will synthesize a dummy MRFSection<A> object for Absolute symbols
+ if ( _absoluteSymbolCount > 0 ) {
+ totalSectionsSize += sizeof(AbsoluteSymbolSection<A>);
+ machOSects[count++].type = sectionTypeAbsoluteSymbols;
+ }
+
+ // allocate one block for all Section objects as well as pointers to each
+- uint8_t* space = new uint8_t[totalSectionsSize+count*sizeof(Section<A>*)];
+- _file->_sectionsArray = (Section<A>**)space;
++ uint8_t* space = new uint8_t[totalSectionsSize+count*sizeof(MRFSection<A>*)];
++ _file->_sectionsArray = (MRFSection<A>**)space;
+ _file->_sectionsArrayCount = count;
+- Section<A>** objects = _file->_sectionsArray;
+- space += count*sizeof(Section<A>*);
++ MRFSection<A>** objects = _file->_sectionsArray;
++ space += count*sizeof(MRFSection<A>*);
+ for (uint32_t i=0; i < count; ++i) {
+ switch ( machOSects[i].type ) {
+ case sectionTypeIgnore:
+@@ -2536,7 +2536,7 @@
+
+
+ template <typename A>
+-Section<A>* Parser<A>::sectionForAddress(typename A::P::uint_t addr)
++MRFSection<A>* Parser<A>::sectionForAddress(typename A::P::uint_t addr)
+ {
+ for (uint32_t i=0; i < _file->_sectionsArrayCount; ++i ) {
+ const macho_section<typename A::P>* sect = _file->_sectionsArray[i]->machoSection();
+@@ -2563,7 +2563,7 @@
+ }
+
+ template <typename A>
+-Section<A>* Parser<A>::sectionForNum(unsigned int num)
++MRFSection<A>* Parser<A>::sectionForNum(unsigned int num)
+ {
+ for (uint32_t i=0; i < _file->_sectionsArrayCount; ++i ) {
+ const macho_section<typename A::P>* sect = _file->_sectionsArray[i]->machoSection();
+@@ -2579,7 +2579,7 @@
+ template <typename A>
+ Atom<A>* Parser<A>::findAtomByAddress(pint_t addr)
+ {
+- Section<A>* section = this->sectionForAddress(addr);
++ MRFSection<A>* section = this->sectionForAddress(addr);
+ return section->findAtomByAddress(addr);
+ }
+
+@@ -2636,7 +2636,7 @@
+ target.addend = 0;
+ return;
+ }
+- Section<A>* section = this->sectionForAddress(addr);
++ MRFSection<A>* section = this->sectionForAddress(addr);
+ target.atom = section->findAtomByAddress(addr);
+ target.addend = addr - target.atom->_objAddress;
+ target.weakImport = false;
+@@ -2684,7 +2684,7 @@
+ }
+ return;
+ }
+- Section<A>* section = this->sectionForNum(sectNum);
++ MRFSection<A>* section = this->sectionForNum(sectNum);
+ target.atom = section->findAtomByAddress(addr);
+ if ( target.atom == NULL ) {
+ typedef typename A::P::sint_t sint_t;
+@@ -3892,7 +3892,7 @@
+ }
+
+ template <typename A>
+-const char* Section<A>::makeSegmentName(const macho_section<typename A::P>* sect)
++const char* MRFSection<A>::makeSegmentName(const macho_section<typename A::P>* sect)
+ {
+ // mach-o section record only has room for 16-byte seg/sect names
+ // so a 16-byte name has no trailing zero
+@@ -3905,7 +3905,7 @@
+ }
+
+ template <typename A>
+-const char* Section<A>::makeSectionName(const macho_section<typename A::P>* sect)
++const char* MRFSection<A>::makeSectionName(const macho_section<typename A::P>* sect)
+ {
+ const char* name = sect->sectname();
+ if ( strlen(name) < 16 )
+@@ -3939,13 +3939,13 @@
+ }
+
+ template <typename A>
+-bool Section<A>::readable(const macho_section<typename A::P>* sect)
++bool MRFSection<A>::readable(const macho_section<typename A::P>* sect)
+ {
+ return true;
+ }
+
+ template <typename A>
+-bool Section<A>::writable(const macho_section<typename A::P>* sect)
++bool MRFSection<A>::writable(const macho_section<typename A::P>* sect)
+ {
+ // mach-o .o files do not contain segment permissions
+ // we just know TEXT is special
+@@ -3953,7 +3953,7 @@
+ }
+
+ template <typename A>
+-bool Section<A>::exectuable(const macho_section<typename A::P>* sect)
++bool MRFSection<A>::exectuable(const macho_section<typename A::P>* sect)
+ {
+ // mach-o .o files do not contain segment permissions
+ // we just know TEXT is special
+@@ -3962,7 +3962,7 @@
+
+
+ template <typename A>
+-ld::Section::Type Section<A>::sectionType(const macho_section<typename A::P>* sect)
++ld::Section::Type MRFSection<A>::sectionType(const macho_section<typename A::P>* sect)
+ {
+ switch ( sect->flags() & SECTION_TYPE ) {
+ case S_ZEROFILL:
+@@ -4040,7 +4040,7 @@
+
+
+ template <typename A>
+-Atom<A>* Section<A>::findContentAtomByAddress(pint_t addr, class Atom<A>* start, class Atom<A>* end)
++Atom<A>* MRFSection<A>::findContentAtomByAddress(pint_t addr, class Atom<A>* start, class Atom<A>* end)
+ {
+ // do a binary search of atom array
+ uint32_t atomCount = end - start;
+@@ -4072,7 +4072,7 @@
+ }
+
+ template <typename A>
+-ld::Atom::Alignment Section<A>::alignmentForAddress(pint_t addr)
++ld::Atom::Alignment MRFSection<A>::alignmentForAddress(pint_t addr)
+ {
+ const uint32_t sectionAlignment = this->_machOSection->align();
+ uint32_t modulus = (addr % (1 << sectionAlignment));
+@@ -4082,7 +4082,7 @@
+ }
+
+ template <typename A>
+-uint32_t Section<A>::sectionNum(class Parser<A>& parser) const
++uint32_t MRFSection<A>::sectionNum(class Parser<A>& parser) const
+ {
+ if ( _machOSection == NULL )
+ return 0;
+@@ -4727,7 +4727,7 @@
+ // support __LD, __compact_unwind personality entries which are pointer to personality non-lazy pointer
+ const pint_t* content = (pint_t*)(this->file().fileContent() + this->_machOSection->offset() + reloc->r_address());
+ pint_t nlPointerAddr = *content;
+- Section<x86>* nlSection = parser.sectionForAddress(nlPointerAddr);
++ MRFSection<x86>* nlSection = parser.sectionForAddress(nlPointerAddr);
+ if ( nlSection->type() == ld::Section::typeCode ) {
+ // personality function is defined in this .o file, so this is a direct reference to it
+ // atoms may not be constructed yet, so scan symbol table for labels
+@@ -4754,7 +4754,7 @@
+ else {
+ const pint_t* content = (pint_t*)(this->file().fileContent() + this->_machOSection->offset() + reloc->r_address());
+ pint_t personalityAddr = *content;
+- Section<arm64>* personalitySection = parser.sectionForAddress(personalityAddr);
++ MRFSection<arm64>* personalitySection = parser.sectionForAddress(personalityAddr);
+ assert((personalitySection->type() == ld::Section::typeCode) && "personality column in __compact_unwind section is not pointer to function");
+ // atoms may not be constructed yet, so scan symbol table for labels
+ const char* name = parser.scanSymbolTableForAddress(personalityAddr);
+@@ -4776,7 +4776,7 @@
+ // support __LD, __compact_unwind personality entries which are pointer to personality non-lazy pointer
+ const pint_t* content = (pint_t*)(this->file().fileContent() + this->_machOSection->offset() + reloc->r_address());
+ pint_t nlPointerAddr = *content;
+- Section<arm>* nlSection = parser.sectionForAddress(nlPointerAddr);
++ MRFSection<arm>* nlSection = parser.sectionForAddress(nlPointerAddr);
+ if ( nlSection->type() == ld::Section::typeCode ) {
+ // personality function is defined in this .o file, so this is a direct reference to it
+ // atoms may not be constructed yet, so scan symbol table for labels
+@@ -4937,7 +4937,7 @@
+
+ template <typename A>
+ SymboledSection<A>::SymboledSection(Parser<A>& parser, File<A>& f, const macho_section<typename A::P>* s)
+- : Section<A>(f, s), _type(ld::Atom::typeUnclassified)
++ : MRFSection<A>(f, s), _type(ld::Atom::typeUnclassified)
+ {
+ switch ( s->flags() & SECTION_TYPE ) {
+ case S_ZEROFILL:
+@@ -4983,7 +4983,7 @@
+ if ( ! this->_file.canScatterAtoms() )
+ return true;
+ // call inherited
+- return Section<A>::dontDeadStrip();
++ return MRFSection<A>::dontDeadStrip();
+ }
+ return false;
+ }
+@@ -5847,7 +5847,7 @@
+
+
+ template <>
+-uint32_t Section<x86_64>::x86_64PcRelOffset(uint8_t r_type)
++uint32_t MRFSection<x86_64>::x86_64PcRelOffset(uint8_t r_type)
+ {
+ switch ( r_type ) {
+ case X86_64_RELOC_SIGNED:
+@@ -5864,7 +5864,7 @@
+
+
+ template <>
+-bool Section<x86_64>::addRelocFixup(class Parser<x86_64>& parser, const macho_relocation_info<P>* reloc)
++bool MRFSection<x86_64>::addRelocFixup(class Parser<x86_64>& parser, const macho_relocation_info<P>* reloc)
+ {
+ const macho_section<P>* sect = this->machoSection();
+ uint64_t srcAddr = sect->addr() + reloc->r_address();
+@@ -6071,7 +6071,7 @@
+
+
+ template <>
+-bool Section<x86>::addRelocFixup(class Parser<x86>& parser, const macho_relocation_info<P>* reloc)
++bool MRFSection<x86>::addRelocFixup(class Parser<x86>& parser, const macho_relocation_info<P>* reloc)
+ {
+ const macho_section<P>* sect = this->machoSection();
+ uint32_t srcAddr;
+@@ -6312,7 +6312,7 @@
+
+ #if SUPPORT_ARCH_arm_any
+ template <>
+-bool Section<arm>::addRelocFixup(class Parser<arm>& parser, const macho_relocation_info<P>* reloc)
++bool MRFSection<arm>::addRelocFixup(class Parser<arm>& parser, const macho_relocation_info<P>* reloc)
+ {
+ const macho_section<P>* sect = this->machoSection();
+ bool result = false;
+@@ -6779,7 +6779,7 @@
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+-bool Section<arm64>::addRelocFixup(class Parser<arm64>& parser, const macho_relocation_info<P>* reloc)
++bool MRFSection<arm64>::addRelocFixup(class Parser<arm64>& parser, const macho_relocation_info<P>* reloc)
+ {
+ bool result = false;
+ Parser<arm64>::SourceLocation src;
+@@ -7177,7 +7177,7 @@
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+-void Section<arm64>::addLOH(class Parser<arm64>& parser, int kind, int count, const uint64_t addrs[]) {
++void MRFSection<arm64>::addLOH(class Parser<arm64>& parser, int kind, int count, const uint64_t addrs[]) {
+ switch (kind) {
+ case LOH_ARM64_ADRP_ADRP:
+ case LOH_ARM64_ADRP_LDR:
+@@ -7232,18 +7232,18 @@
+ extra.info.delta2 = (count > 1) ? ((addrs[1] - lowestAddress) >> 2) : 0;
+ extra.info.delta3 = (count > 2) ? ((addrs[2] - lowestAddress) >> 2) : 0;
+ extra.info.delta4 = (count > 3) ? ((addrs[3] - lowestAddress) >> 2) : 0;
+- typename Parser<arm64>::SourceLocation src(inAtom, lowestAddress- inAtom->objectAddress());
++ Parser<arm64>::SourceLocation src(inAtom, lowestAddress- inAtom->objectAddress());
+ parser.addFixup(src, ld::Fixup::k1of1, ld::Fixup::kindLinkerOptimizationHint, extra.addend);
+ }
+ #endif
+
+ template <typename A>
+-void Section<A>::addLOH(class Parser<A>& parser, int kind, int count, const uint64_t addrs[]) {
++void MRFSection<A>::addLOH(class Parser<A>& parser, int kind, int count, const uint64_t addrs[]) {
+
+ }
+
+ template <typename A>
+-void Section<A>::makeFixups(class Parser<A>& parser, const struct Parser<A>::CFI_CU_InfoArrays&)
++void MRFSection<A>::makeFixups(class Parser<A>& parser, const struct Parser<A>::CFI_CU_InfoArrays&)
+ {
+ const macho_section<P>* sect = this->machoSection();
+ const macho_relocation_info<P>* relocs = (macho_relocation_info<P>*)(file().fileContent() + sect->reloff());
+@@ -7254,7 +7254,7 @@
+ ++r; // skip next
+ }
+ catch (const char* msg) {
+- throwf("in section %s,%s reloc %u: %s", sect->segname(), Section<A>::makeSectionName(sect), r, msg);
++ throwf("in section %s,%s reloc %u: %s", sect->segname(), MRFSection<A>::makeSectionName(sect), r, msg);
+ }
+ }
+
+@@ -7280,7 +7280,7 @@
+ }
+ if ( !this->_altEntries.empty() && !this->addFollowOnFixups() ) {
+ if ( _altEntries.count(_beginAtoms) != 0 )
+- warning("N_ALT_ENTRY bit set on first atom in section %s/%s", sect->segname(), Section<A>::makeSectionName(sect));
++ warning("N_ALT_ENTRY bit set on first atom in section %s/%s", sect->segname(), MRFSection<A>::makeSectionName(sect));
+
+ Atom<A>* end = &_endAtoms[-1];
+ for(Atom<A>* p = _beginAtoms; p < end; ++p) {
+--- ld64-242/src/ld/passes/dtrace_dof.cpp.gcc 2015-08-03 01:11:48.000000000 +0200
++++ ld64-242/src/ld/passes/dtrace_dof.cpp 2015-08-03 01:11:57.000000000 +0200
+@@ -30,8 +30,17 @@
+
+ #include <vector>
+ #include <map>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#include <tr1/unordered_set>
++#define UNORDERED_MAP tr1::unordered_map
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_map>
+ #include <unordered_set>
++#define UNORDERED_MAP unordered_map
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "ld.hpp"
+ #include "MachOFileAbstraction.hpp"
+@@ -111,8 +120,8 @@
+ uint32_t offset;
+ const char* probeName;
+ };
+-typedef std::unordered_map<const char*, std::vector<DTraceProbeInfo>, CStringHash, CStringEquals> ProviderToProbes;
+-typedef std::unordered_set<const char*, CStringHash, CStringEquals> CStringSet;
++typedef std::UNORDERED_MAP<const char*, std::vector<DTraceProbeInfo>, CStringHash, CStringEquals> ProviderToProbes;
++typedef std::UNORDERED_SET<const char*, CStringHash, CStringEquals> CStringSet;
+
+
+
+--- ld64-242/src/ld/passes/order.cpp.gcc 2015-08-03 01:11:48.000000000 +0200
++++ ld64-242/src/ld/passes/order.cpp 2015-08-03 01:11:57.000000000 +0200
+@@ -32,7 +32,13 @@
+ #include <vector>
+ #include <map>
+ #include <set>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#else
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#endif
+
+ #include "ld.hpp"
+ #include "order.h"
+@@ -85,7 +91,7 @@
+ ld::Internal& _state;
+ };
+
+- typedef std::unordered_map<const char*, const ld::Atom*, CStringHash, CStringEquals> NameToAtom;
++ typedef std::UNORDERED_MAP<const char*, const ld::Atom*, CStringHash, CStringEquals> NameToAtom;
+
+ typedef std::map<const ld::Atom*, const ld::Atom*> AtomToAtom;
+
+--- ld64-242/src/ld/Resolver.h.gcc 2015-08-03 01:11:48.000000000 +0200
++++ ld64-242/src/ld/Resolver.h 2015-08-03 01:11:57.000000000 +0200
+@@ -42,7 +42,13 @@
+ #include <mach-o/dyld.h>
+
+ #include <vector>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "Options.h"
+ #include "ld.hpp"
+@@ -105,7 +111,7 @@
+ void doLinkerOption(const std::vector<const char*>& linkerOption, const char* fileName);
+ void dumpAtoms();
+
+- typedef std::unordered_set<const char*, CStringHash, CStringEquals> StringSet;
++ typedef std::UNORDERED_SET<const char*, CStringHash, CStringEquals> StringSet;
+
+ class NotLive {
+ public:
+--- ld64-242/src/ld/SymbolTable.h.gcc 2015-08-03 01:11:48.000000000 +0200
++++ ld64-242/src/ld/SymbolTable.h 2015-08-03 01:11:57.000000000 +0200
+@@ -42,7 +42,13 @@
+ #include <mach-o/dyld.h>
+
+ #include <vector>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_map>
++#define UNORDERED_MAP tr1::unordered_map
++#else
+ #include <unordered_map>
++#define UNORDERED_MAP unordered_map
++#endif
+
+ #include "Options.h"
+ #include "ld.hpp"
+@@ -57,38 +63,38 @@
+ typedef uint32_t IndirectBindingSlot;
+
+ private:
+- typedef std::unordered_map<const char*, IndirectBindingSlot, CStringHash, CStringEquals> NameToSlot;
++ typedef std::UNORDERED_MAP<const char*, IndirectBindingSlot, CStringHash, CStringEquals> NameToSlot;
+
+ class ContentFuncs {
+ public:
+ size_t operator()(const ld::Atom*) const;
+ bool operator()(const ld::Atom* left, const ld::Atom* right) const;
+ };
+- typedef std::unordered_map<const ld::Atom*, IndirectBindingSlot, ContentFuncs, ContentFuncs> ContentToSlot;
++ typedef std::UNORDERED_MAP<const ld::Atom*, IndirectBindingSlot, ContentFuncs, ContentFuncs> ContentToSlot;
+
+ class ReferencesHashFuncs {
+ public:
+ size_t operator()(const ld::Atom*) const;
+ bool operator()(const ld::Atom* left, const ld::Atom* right) const;
+ };
+- typedef std::unordered_map<const ld::Atom*, IndirectBindingSlot, ReferencesHashFuncs, ReferencesHashFuncs> ReferencesToSlot;
++ typedef std::UNORDERED_MAP<const ld::Atom*, IndirectBindingSlot, ReferencesHashFuncs, ReferencesHashFuncs> ReferencesToSlot;
+
+ class CStringHashFuncs {
+ public:
+ size_t operator()(const ld::Atom*) const;
+ bool operator()(const ld::Atom* left, const ld::Atom* right) const;
+ };
+- typedef std::unordered_map<const ld::Atom*, IndirectBindingSlot, CStringHashFuncs, CStringHashFuncs> CStringToSlot;
++ typedef std::UNORDERED_MAP<const ld::Atom*, IndirectBindingSlot, CStringHashFuncs, CStringHashFuncs> CStringToSlot;
+
+ class UTF16StringHashFuncs {
+ public:
+ size_t operator()(const ld::Atom*) const;
+ bool operator()(const ld::Atom* left, const ld::Atom* right) const;
+ };
+- typedef std::unordered_map<const ld::Atom*, IndirectBindingSlot, UTF16StringHashFuncs, UTF16StringHashFuncs> UTF16StringToSlot;
++ typedef std::UNORDERED_MAP<const ld::Atom*, IndirectBindingSlot, UTF16StringHashFuncs, UTF16StringHashFuncs> UTF16StringToSlot;
+
+ typedef std::map<IndirectBindingSlot, const char*> SlotToName;
+- typedef std::unordered_map<const char*, CStringToSlot*, CStringHash, CStringEquals> NameToMap;
++ typedef std::UNORDERED_MAP<const char*, CStringToSlot*, CStringHash, CStringEquals> NameToMap;
+
+ typedef std::vector<const ld::Atom *> DuplicatedSymbolAtomList;
+ typedef std::map<const char *, DuplicatedSymbolAtomList * > DuplicateSymbols;
+--- ld64-242/src/other/dyldinfo.cpp.gcc 2015-08-03 01:11:48.000000000 +0200
++++ ld64-242/src/other/dyldinfo.cpp 2015-08-03 01:11:57.000000000 +0200
+@@ -33,7 +33,6 @@
+
+ #include <vector>
+ #include <set>
+-#include <unordered_set>
+
+ #include "configure.h"
+ #include "MachOFileAbstraction.hpp"
+--- ld64-242/src/other/machochecker.cpp.gcc 2015-08-03 01:11:48.000000000 +0200
++++ ld64-242/src/other/machochecker.cpp 2015-08-03 01:11:57.000000000 +0200
+@@ -33,7 +33,13 @@
+
+ #include <vector>
+ #include <set>
++#ifdef __GLIBCXX__
++#include <tr1/unordered_set>
++#define UNORDERED_SET tr1::unordered_set
++#else
+ #include <unordered_set>
++#define UNORDERED_SET unordered_set
++#endif
+
+ #include "configure.h"
+
+@@ -124,7 +130,7 @@
+ bool operator()(const char* left, const char* right) const { return (strcmp(left, right) == 0); }
+ };
+
+- typedef std::unordered_set<const char*, CStringHash, CStringEquals> StringSet;
++ typedef std::UNORDERED_SET<const char*, CStringHash, CStringEquals> StringSet;
+
+ MachOChecker(const uint8_t* fileContent, uint32_t fileLength, const char* path);
+ void checkMachHeader();
+--- ld64-242/src/other/unwinddump.cpp.gcc 2015-08-03 01:11:48.000000000 +0200
++++ ld64-242/src/other/unwinddump.cpp 2015-08-03 01:11:57.000000000 +0200
+@@ -33,7 +33,6 @@
+
+ #include <vector>
+ #include <set>
+-#include <unordered_set>
+
+ #include "configure.h"
+ #include "MachOFileAbstraction.hpp"
diff --git a/sys-devel/binutils-apple/files/ld64-242-noarm.patch b/sys-devel/binutils-apple/files/ld64-242-noarm.patch
new file mode 100644
index 000000000000..adfae99ffef8
--- /dev/null
+++ b/sys-devel/binutils-apple/files/ld64-242-noarm.patch
@@ -0,0 +1,1255 @@
+Fully conditionalise arm support so it can be disabled on 10.4.
+
+--- ld64-242/src/ld/HeaderAndLoadCommands.hpp.noarm 2014-05-08 03:38:16.000000000 +0200
++++ ld64-242/src/ld/HeaderAndLoadCommands.hpp 2015-08-03 01:09:13.000000000 +0200
+@@ -607,8 +607,12 @@
+
+ template <> uint32_t HeaderAndLoadCommandsAtom<x86>::cpuType() const { return CPU_TYPE_I386; }
+ template <> uint32_t HeaderAndLoadCommandsAtom<x86_64>::cpuType() const { return CPU_TYPE_X86_64; }
++#if SUPPORT_ARCH_arm_any
+ template <> uint32_t HeaderAndLoadCommandsAtom<arm>::cpuType() const { return CPU_TYPE_ARM; }
++#endif
++#if SUPPORT_ARCH_arm64
+ template <> uint32_t HeaderAndLoadCommandsAtom<arm64>::cpuType() const { return CPU_TYPE_ARM64; }
++#endif
+
+
+
+@@ -627,17 +631,21 @@
+ return _state.cpuSubType;
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ uint32_t HeaderAndLoadCommandsAtom<arm>::cpuSubType() const
+ {
+ return _state.cpuSubType;
+ }
++#endif
+
++#if SUPPORT_ARCH_arm64
+ template <>
+ uint32_t HeaderAndLoadCommandsAtom<arm64>::cpuSubType() const
+ {
+ return CPU_SUBTYPE_ARM64_ALL;
+ }
++#endif
+
+
+
+--- ld64-242/src/ld/LinkEdit.hpp.noarm 2015-08-03 01:08:57.000000000 +0200
++++ ld64-242/src/ld/LinkEdit.hpp 2015-08-03 01:09:13.000000000 +0200
+@@ -1595,6 +1595,7 @@
+ for (ld::Fixup::iterator fit = atom->fixupsBegin(); fit != atom->fixupsEnd(); ++fit) {
+ if ( fit->kind != ld::Fixup::kindLinkerOptimizationHint)
+ continue;
++#if SUPPORT_ARCH_arm64
+ ld::Fixup::LOH_arm64 extra;
+ extra.addend = fit->u.addend;
+ _encodedData.append_uleb128(extra.info.kind);
+@@ -1606,6 +1607,7 @@
+ _encodedData.append_uleb128((extra.info.delta3 << 2) + fit->offsetInAtom + address);
+ if ( extra.info.count > 2 )
+ _encodedData.append_uleb128((extra.info.delta4 << 2) + fit->offsetInAtom + address);
++#endif
+ }
+ }
+ }
+--- ld64-242/src/ld/Options.cpp.noarm 2015-08-03 01:08:57.000000000 +0200
++++ ld64-242/src/ld/Options.cpp 2015-08-03 01:09:13.000000000 +0200
+@@ -579,8 +579,13 @@
+ #endif
+ }
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
++#endif
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
++#if SUPPORT_ARCH_arm_any || SUPPORT_ARCH_arm64
+ if ( (fMacVersionMin == ld::macVersionUnset) && (fIOSVersionMin == ld::iOSVersionUnset) && (fOutputKind != Options::kObjectFile) ) {
+ #if defined(DEFAULT_IPHONEOS_MIN_VERSION)
+ warning("-ios_version_min not specified, assuming " DEFAULT_IPHONEOS_MIN_VERSION);
+@@ -591,6 +596,7 @@
+ #endif
+ }
+ break;
++#endif
+ }
+ #ifdef SUPPORT_SNAPSHOTS
+ fLinkSnapshot.recordArch(fArchitectureName);
+@@ -1687,9 +1693,11 @@
+ symbolStart = NULL;
+ }
+ else if ( strncmp(symbolStart, "arm:", 4) == 0 ) {
++#if SUPPORT_ARCH_arm_any
+ if ( fArchitecture == CPU_TYPE_ARM )
+ symbolStart = &symbolStart[4];
+ else
++#endif
+ symbolStart = NULL;
+ }
+ if ( symbolStart != NULL ) {
+@@ -3672,6 +3680,7 @@
+ #endif
+ }
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( (fOutputKind != Options::kObjectFile) && (fOutputKind != Options::kPreload) ) {
+ #if defined(DEFAULT_IPHONEOS_MIN_VERSION)
+@@ -3683,6 +3692,7 @@
+ #endif
+ }
+ break;
++#endif
+ default:
+ // architecture will be infered later by examining .o files
+ break;
+@@ -3705,12 +3715,14 @@
+ fMacVersionMin = ld::mac10_4;
+ }
+ break;
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
+ if ( fIOSVersionMin < ld::iOS_7_0 ) {
+ //warning("-mios_version_min should be 7.0 or later for arm64");
+ fIOSVersionMin = ld::iOS_7_0;
+ }
+ break;
++#endif
+ }
+
+ // default to adding functions start for dynamic code, static code must opt-in
+@@ -3750,6 +3762,7 @@
+ fAllowTextRelocs = true;
+ fUndefinedTreatment = kUndefinedDynamicLookup;
+ break;
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
+ // arm64 uses new MH_KEXT_BUNDLE type
+ fMakeCompressedDyldInfo = false;
+@@ -3758,6 +3771,8 @@
+ fKextsUseStubs = true;
+ fUndefinedTreatment = kUndefinedDynamicLookup;
+ break;
++#endif
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( fIOSVersionMin >= ld::iOS_5_0 ) {
+ // iOS 5.0 and later use new MH_KEXT_BUNDLE type
+@@ -3769,6 +3784,7 @@
+ fUndefinedTreatment = kUndefinedDynamicLookup;
+ break;
+ }
++#endif
+ // else use object file
+ case CPU_TYPE_I386:
+ // use .o files
+@@ -3821,6 +3837,7 @@
+ if ( fSplitSegs && (fBaseWritableAddress-fBaseAddress != 0x10000000) )
+ fBaseWritableAddress = fBaseAddress + 0x10000000;
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( fOutputKind != Options::kDynamicLibrary ) {
+ fSplitSegs = false;
+@@ -3831,6 +3848,7 @@
+ fBaseWritableAddress = fBaseAddress + 0x08000000;
+ }
+ break;
++#endif
+ default:
+ fSplitSegs = false;
+ fBaseAddress = 0;
+@@ -3845,6 +3863,7 @@
+ break;
+ case CPU_TYPE_X86_64:
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ switch ( fOutputKind ) {
+ case Options::kDynamicExecutable:
+@@ -3867,6 +3886,7 @@
+ fBaseAddress = 0;
+ }
+ break;
++#endif
+ }
+
+ // <rdar://problem/6138961> -r implies no prebinding for all architectures
+@@ -3912,6 +3932,7 @@
+ case CPU_TYPE_X86_64:
+ fPrebind = false;
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ switch ( fOutputKind ) {
+ case Options::kDynamicExecutable:
+@@ -3929,6 +3950,7 @@
+ break;
+ }
+ break;
++#endif
+ }
+ }
+
+@@ -3955,10 +3977,12 @@
+ case CPU_TYPE_I386:
+ if ( fIOSVersionMin != ld::iOSVersionUnset ) // simulator never needs modules
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( fPrebind )
+ fNeedsModuleTable = true; // redo_prebinding requires a module table
+ break;
++#endif
+ }
+ }
+
+@@ -3974,7 +3998,9 @@
+ switch ( fArchitecture ) {
+ case CPU_TYPE_I386:
+ case CPU_TYPE_X86_64:
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
+ switch ( fOutputKind ) {
+ case Options::kObjectFile:
+ case Options::kStaticExecutable:
+@@ -4037,7 +4063,15 @@
+ fEncryptable = false;
+ break;
+ }
+- if ( (fArchitecture != CPU_TYPE_ARM) && (fArchitecture != CPU_TYPE_ARM64) )
++ if (
++#if SUPPORT_ARCH_arm_any
++ (fArchitecture != CPU_TYPE_ARM) &&
++#endif
++#if SUPPORT_ARCH_arm64
++ (fArchitecture != CPU_TYPE_ARM64) &&
++#endif
++ 1
++ )
+ fEncryptable = false;
+
+ // don't move inits in dyld because dyld wants certain
+@@ -4089,11 +4123,15 @@
+
+ // only ARM and x86_64 enforces that cpu-sub-types must match
+ switch ( fArchitecture ) {
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
++#endif
+ case CPU_TYPE_X86_64:
+ break;
+ case CPU_TYPE_I386:
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
+ fAllowCpuSubtypeMismatches = true;
+ break;
+ }
+@@ -4139,6 +4177,7 @@
+ fPositionIndependentExecutable = true;
+ }
+
++#if SUPPORT_ARCH_arm_any
+ // armv7 for iOS4.3 defaults to PIE
+ if ( (fArchitecture == CPU_TYPE_ARM)
+ && fArchSupportsThumb2
+@@ -4146,6 +4185,7 @@
+ && (fIOSVersionMin >= ld::iOS_4_3) ) {
+ fPositionIndependentExecutable = true;
+ }
++#endif
+
+ // Simulator defaults to PIE
+ if ( fTargetIOSSimulator && (fOutputKind == kDynamicExecutable) )
+@@ -4155,10 +4195,12 @@
+ if ( fDisablePositionIndependentExecutable )
+ fPositionIndependentExecutable = false;
+
++#if SUPPORT_ARCH_arm64
+ // arm64 is always PIE
+ if ( (fArchitecture == CPU_TYPE_ARM64) && (fOutputKind == kDynamicExecutable) ) {
+ fPositionIndependentExecutable = true;
+ }
++#endif
+
+ // set fOutputSlidable
+ switch ( fOutputKind ) {
+@@ -4184,9 +4226,11 @@
+ if ( fMacVersionMin >= ld::mac10_7 ) {
+ fTLVSupport = true;
+ }
++#if SUPPORT_ARCH_arm64
+ else if ( (fArchitecture == CPU_TYPE_ARM64) && (fIOSVersionMin >= ld::iOS_8_0) ) {
+ fTLVSupport = true;
+ }
++#endif
+
+ // default to adding version load command for dynamic code, static code must opt-in
+ switch ( fOutputKind ) {
+@@ -4524,12 +4568,16 @@
+ if ( fStackAddr != 0 ) {
+ switch (fArchitecture) {
+ case CPU_TYPE_I386:
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
++#endif
+ if ( fStackAddr > 0xFFFFFFFFULL )
+ throw "-stack_addr must be < 4G for 32-bit processes";
+ break;
+ case CPU_TYPE_X86_64:
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
+ break;
+ }
+ if ( (fStackAddr & -4096) != fStackAddr )
+@@ -4550,6 +4598,7 @@
+ if ( (fStackAddr > 0xB0000000ULL) && ((fStackAddr-fStackSize) < 0xB0000000ULL) )
+ warning("custom stack placement overlaps and will disable shared region");
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( fStackSize > 0x2F000000 )
+ throw "-stack_size must be < 752MB";
+@@ -4558,11 +4607,13 @@
+ if ( fStackAddr > 0x30000000ULL)
+ throw "-stack_addr must be < 0x30000000 for arm";
+ break;
++#endif
+ case CPU_TYPE_X86_64:
+ if ( fStackAddr == 0 ) {
+ fStackAddr = 0x00007FFF5C000000ULL;
+ }
+ break;
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
+ if ( fStackSize > 0x20000000 )
+ throw "-stack_size must be < 512MB";
+@@ -4570,6 +4621,7 @@
+ fStackAddr = 0x120000000ULL;
+ }
+ break;
++#endif
+ }
+ if ( (fStackSize & -4096) != fStackSize )
+ throw "-stack_size must be multiples of 4K";
+@@ -4679,8 +4731,12 @@
+ alterObjC1ClassNamesToObjC2 = true;
+ break;
+ case CPU_TYPE_X86_64:
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
++#endif
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
+ alterObjC1ClassNamesToObjC2 = true;
+ break;
+ }
+@@ -4772,11 +4828,15 @@
+ // zero page size not specified on command line, set default
+ switch (fArchitecture) {
+ case CPU_TYPE_I386:
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
++#endif
+ // first 4KB for 32-bit architectures
+ fZeroPageSize = 0x1000;
+ break;
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
+ case CPU_TYPE_X86_64:
+ // first 4GB for x86_64 on all OS's
+ fZeroPageSize = 0x100000000ULL;
+@@ -4878,9 +4938,11 @@
+
+ // -force_cpusubtype_ALL is not supported for ARM
+ if ( fForceSubtypeAll ) {
++#if SUPPORT_ARCH_arm_any
+ if ( fArchitecture == CPU_TYPE_ARM ) {
+ warning("-force_cpusubtype_ALL will become unsupported for ARM architectures");
+ }
++#endif
+ }
+
+ // -reexported_symbols_list can only be used with -dynamiclib
+--- ld64-242/src/ld/OutputFile.cpp.noarm 2015-08-03 01:08:57.000000000 +0200
++++ ld64-242/src/ld/OutputFile.cpp 2015-08-03 01:09:13.000000000 +0200
+@@ -631,7 +631,12 @@
+ // is encoded in mach-o the same as:
+ // .long _foo + 0x40000000
+ // so if _foo lays out to 0xC0000100, the first is ok, but the second is not.
+- if ( (_options.architecture() == CPU_TYPE_ARM) || (_options.architecture() == CPU_TYPE_I386) ) {
++ if (
++#if SUPPORT_ARCH_arm_any
++ (_options.architecture() == CPU_TYPE_ARM) ||
++#endif
++ (_options.architecture() == CPU_TYPE_I386) ||
++ 0) {
+ // Unlikely userland code does funky stuff like this, so warn for them, but not warn for -preload or -static
+ if ( (_options.outputKind() != Options::kPreload) && (_options.outputKind() != Options::kStaticExecutable) ) {
+ warning("32-bit absolute address out of range (0x%08llX max is 4GB): from %s + 0x%08X (0x%08llX) to 0x%08llX",
+@@ -1235,22 +1240,26 @@
+ return false;
+ const ld::Fixup* f;
+ switch ( fixup->kind ) {
++#if SUPPORT_ARCH_arm64
+ case ld::Fixup::kindStoreTargetAddressARM64Page21:
+ return !mustBeGOT;
+ case ld::Fixup::kindStoreTargetAddressARM64GOTLoadPage21:
+ case ld::Fixup::kindStoreTargetAddressARM64GOTLeaPage21:
+ return true;
++#endif
+ case ld::Fixup::kindSetTargetAddress:
+ f = fixup;
+ do {
+ ++f;
+ } while ( ! f->lastInCluster() );
+ switch (f->kind ) {
++#if SUPPORT_ARCH_arm64
+ case ld::Fixup::kindStoreARM64Page21:
+ return !mustBeGOT;
+ case ld::Fixup::kindStoreARM64GOTLoadPage21:
+ case ld::Fixup::kindStoreARM64GOTLeaPage21:
+ return true;
++#endif
+ default:
+ break;
+ }
+@@ -1267,22 +1276,26 @@
+ return false;
+ const ld::Fixup* f;
+ switch ( fixup->kind ) {
++#if SUPPORT_ARCH_arm64
+ case ld::Fixup::kindStoreTargetAddressARM64PageOff12:
+ return !mustBeGOT;
+ case ld::Fixup::kindStoreTargetAddressARM64GOTLoadPageOff12:
+ case ld::Fixup::kindStoreTargetAddressARM64GOTLeaPageOff12:
+ return true;
++#endif
+ case ld::Fixup::kindSetTargetAddress:
+ f = fixup;
+ do {
+ ++f;
+ } while ( ! f->lastInCluster() );
+ switch (f->kind ) {
++#if SUPPORT_ARCH_arm64
+ case ld::Fixup::kindStoreARM64PageOff12:
+ return !mustBeGOT;
+ case ld::Fixup::kindStoreARM64GOTLoadPageOff12:
+ case ld::Fixup::kindStoreARM64GOTLeaPageOff12:
+ return true;
++#endif
+ default:
+ break;
+ }
+@@ -1318,7 +1331,9 @@
+ std::map<uint32_t, const Fixup*> usedByHints;
+ for (ld::Fixup::iterator fit = atom->fixupsBegin(), end=atom->fixupsEnd(); fit != end; ++fit) {
+ uint8_t* fixUpLocation = &buffer[fit->offsetInAtom];
++#if SUPPORT_ARCH_arm64
+ ld::Fixup::LOH_arm64 lohExtra;
++#endif
+ switch ( (ld::Fixup::Kind)(fit->kind) ) {
+ case ld::Fixup::kindNone:
+ case ld::Fixup::kindNoneFollowOn:
+@@ -1580,6 +1595,7 @@
+ break;
+ case ld::Fixup::kindLinkerOptimizationHint:
+ // expand table of address/offsets used by hints
++#if SUPPORT_ARCH_arm64
+ lohExtra.addend = fit->u.addend;
+ usedByHints[fit->offsetInAtom + (lohExtra.info.delta1 << 2)] = NULL;
+ if ( lohExtra.info.count > 0 )
+@@ -1588,6 +1604,7 @@
+ usedByHints[fit->offsetInAtom + (lohExtra.info.delta3 << 2)] = NULL;
+ if ( lohExtra.info.count > 2 )
+ usedByHints[fit->offsetInAtom + (lohExtra.info.delta4 << 2)] = NULL;
++#endif
+ break;
+ case ld::Fixup::kindStoreTargetAddressLittleEndian32:
+ accumulator = addressOf(state, fit, &toTarget);
+@@ -2095,6 +2112,7 @@
+ //uint8_t loadSize, destReg;
+ //uint32_t scaledOffset;
+ //uint32_t imm12;
++#if SUPPORT_ARCH_arm64
+ ld::Fixup::LOH_arm64 alt;
+ alt.addend = fit->u.addend;
+ setInfo(state, atom, buffer, usedByHints, fit->offsetInAtom, (alt.info.delta1 << 2), &infoA);
+@@ -2453,6 +2471,7 @@
+ fprintf(stderr, "unknown hint kind %d alt.info.kind at 0x%08llX\n", alt.info.kind, infoA.instructionAddress);
+ break;
+ }
++#endif
+ }
+ // apply hints pass 2
+ for (ld::Fixup::iterator fit = atom->fixupsBegin(), end=atom->fixupsEnd(); fit != end; ++fit) {
+@@ -2460,6 +2479,7 @@
+ continue;
+ InstructionInfo infoA;
+ InstructionInfo infoB;
++#if SUPPORT_ARCH_arm64
+ ld::Fixup::LOH_arm64 alt;
+ alt.addend = fit->u.addend;
+ setInfo(state, atom, buffer, usedByHints, fit->offsetInAtom, (alt.info.delta1 << 2), &infoA);
+@@ -2491,6 +2511,7 @@
+ }
+ break;
+ }
++#endif
+ }
+ }
+ #endif // SUPPORT_ARCH_arm64
+@@ -2505,6 +2526,7 @@
+ for (uint8_t* p=from; p < to; ++p)
+ *p = 0x90;
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( thumb ) {
+ for (uint8_t* p=from; p < to; p += 2)
+@@ -2515,6 +2537,7 @@
+ OSWriteLittleInt32((uint32_t*)p, 0, 0xe1a00000);
+ }
+ break;
++#endif
+ default:
+ for (uint8_t* p=from; p < to; ++p)
+ *p = 0x00;
+@@ -2843,7 +2866,11 @@
+
+ // in -r mode, clarify symbolTableNotInFinalLinkedImages
+ if ( _options.outputKind() == Options::kObjectFile ) {
+- if ( (_options.architecture() == CPU_TYPE_X86_64) || (_options.architecture() == CPU_TYPE_ARM64) ) {
++ if ( (_options.architecture() == CPU_TYPE_X86_64) ||
++#if SUPPORT_ARCH_arm64
++ (_options.architecture() == CPU_TYPE_ARM64) ||
++#endif
++ 0 ) {
+ // x86_64 .o files need labels on anonymous literal strings
+ if ( (sect->type() == ld::Section::typeCString) && (atom->combine() == ld::Atom::combineByNameAndContent) ) {
+ (const_cast<ld::Atom*>(atom))->setSymbolTableInclusion(ld::Atom::symbolTableIn);
+@@ -4071,8 +4098,10 @@
+ if ( _options.sharedRegionEligible() ) {
+ // <rdar://problem/13287063> when range checking, ignore high byte of arm64 addends
+ uint64_t checkAddend = addend;
++#if SUPPORT_ARCH_arm64
+ if ( _options.architecture() == CPU_TYPE_ARM64 )
+ checkAddend &= 0x0FFFFFFFFFFFFFFFULL;
++#endif
+ if ( checkAddend != 0 ) {
+ // make sure the addend does not cause the pointer to point outside the target's segment
+ // if it does, update_dyld_shared_cache will not be able to put this dylib into the shared cache
+@@ -4279,12 +4308,17 @@
+
+ bool OutputFile::useExternalSectionReloc(const ld::Atom* atom, const ld::Atom* target, ld::Fixup* fixupWithTarget)
+ {
+- if ( (_options.architecture() == CPU_TYPE_X86_64) || (_options.architecture() == CPU_TYPE_ARM64) ) {
++ if ( (_options.architecture() == CPU_TYPE_X86_64) ||
++#if SUPPORT_ARCH_arm64
++ (_options.architecture() == CPU_TYPE_ARM64) ||
++#endif
++ 0) {
+ // x86_64 and ARM64 use external relocations for everthing that has a symbol
+ return ( target->symbolTableInclusion() != ld::Atom::symbolTableNotIn );
+ }
+
+ // <rdar://problem/9513487> support arm branch interworking in -r mode
++#if SUPPORT_ARCH_arm_any
+ if ( (_options.architecture() == CPU_TYPE_ARM) && (_options.outputKind() == Options::kObjectFile) ) {
+ if ( atom->isThumb() != target->isThumb() ) {
+ switch ( fixupWithTarget->kind ) {
+@@ -4298,6 +4332,7 @@
+ }
+ }
+ }
++#endif
+
+ if ( (_options.architecture() == CPU_TYPE_I386) && (_options.outputKind() == Options::kObjectFile) ) {
+ if ( target->contentType() == ld::Atom::typeTLV )
+@@ -4365,7 +4400,11 @@
+ bool minusTargetUsesExternalReloc = (minusTarget != NULL) && this->useExternalSectionReloc(atom, minusTarget, fixupWithMinusTarget);
+
+ // in x86_64 and arm64 .o files an external reloc means the content contains just the addend
+- if ( (_options.architecture() == CPU_TYPE_X86_64) ||(_options.architecture() == CPU_TYPE_ARM64) ) {
++ if ( (_options.architecture() == CPU_TYPE_X86_64) ||
++#if SUPPORT_ARCH_arm64
++ (_options.architecture() == CPU_TYPE_ARM64) ||
++#endif
++ 0 ) {
+ if ( targetUsesExternalReloc ) {
+ fixupWithTarget->contentAddendOnly = true;
+ fixupWithStore->contentAddendOnly = true;
+--- ld64-242/src/ld/parsers/archive_file.cpp.noarm 2015-08-03 01:08:57.000000000 +0200
++++ ld64-242/src/ld/parsers/archive_file.cpp 2015-08-03 01:09:13.000000000 +0200
+@@ -232,8 +232,12 @@
+
+ template <> cpu_type_t File<x86>::architecture() { return CPU_TYPE_I386; }
+ template <> cpu_type_t File<x86_64>::architecture() { return CPU_TYPE_X86_64; }
++#if SUPPORT_ARCH_arm_any
+ template <> cpu_type_t File<arm>::architecture() { return CPU_TYPE_ARM; }
++#endif
++#if SUPPORT_ARCH_arm64
+ template <> cpu_type_t File<arm64>::architecture() { return CPU_TYPE_ARM64; }
++#endif
+
+
+ template <typename A>
+--- ld64-242/src/ld/parsers/macho_dylib_file.cpp.noarm 2015-08-03 01:08:57.000000000 +0200
++++ ld64-242/src/ld/parsers/macho_dylib_file.cpp 2015-08-03 01:09:13.000000000 +0200
+@@ -258,11 +258,15 @@
+ bool File<A>::_s_logHashtable = false;
+
+ template <> const char* File<x86_64>::objCInfoSegmentName() { return "__DATA"; }
++#if SUPPORT_ARCH_arm_any
+ template <> const char* File<arm>::objCInfoSegmentName() { return "__DATA"; }
++#endif
+ template <typename A> const char* File<A>::objCInfoSegmentName() { return "__OBJC"; }
+
+ template <> const char* File<x86_64>::objCInfoSectionName() { return "__objc_imageinfo"; }
++#if SUPPORT_ARCH_arm_any
+ template <> const char* File<arm>::objCInfoSectionName() { return "__objc_imageinfo"; }
++#endif
+ template <typename A> const char* File<A>::objCInfoSectionName() { return "__image_info"; }
+
+ template <typename A>
+@@ -1020,6 +1024,7 @@
+ }
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ bool Parser<arm>::validFile(const uint8_t* fileContent, bool executableOrDyliborBundle)
+ {
+@@ -1046,9 +1051,11 @@
+ return false;
+ }
+ }
++#endif
+
+
+
++#if SUPPORT_ARCH_arm64
+ template <>
+ bool Parser<arm64>::validFile(const uint8_t* fileContent, bool executableOrDyliborBundle)
+ {
+@@ -1075,6 +1082,7 @@
+ return false;
+ }
+ }
++#endif
+
+
+ bool isDylibFile(const uint8_t* fileContent, cpu_type_t* result, cpu_subtype_t* subResult)
+@@ -1090,17 +1098,21 @@
+ *subResult = CPU_SUBTYPE_X86_ALL;
+ return true;
+ }
++#if SUPPORT_ARCH_arm_any
+ if ( Parser<arm>::validFile(fileContent, false) ) {
+ *result = CPU_TYPE_ARM;
+ const macho_header<Pointer32<LittleEndian> >* header = (const macho_header<Pointer32<LittleEndian> >*)fileContent;
+ *subResult = header->cpusubtype();
+ return true;
+ }
++#endif
++#if SUPPORT_ARCH_arm64
+ if ( Parser<arm64>::validFile(fileContent, false) ) {
+ *result = CPU_TYPE_ARM64;
+ *subResult = CPU_SUBTYPE_ARM64_ALL;
+ return true;
+ }
++#endif
+ return false;
+ }
+
+@@ -1126,6 +1138,7 @@
+ return "x86_64";
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ const char* Parser<arm>::fileKind(const uint8_t* fileContent)
+ {
+@@ -1141,6 +1154,7 @@
+ }
+ return "arm???";
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+@@ -1166,9 +1180,11 @@
+ if ( Parser<x86>::validFile(fileContent, true) ) {
+ return Parser<x86>::fileKind(fileContent);
+ }
++#if SUPPORT_ARCH_arm_any
+ if ( Parser<arm>::validFile(fileContent, true) ) {
+ return Parser<arm>::fileKind(fileContent);
+ }
++#endif
+ #if SUPPORT_ARCH_arm64
+ if ( Parser<arm64>::validFile(fileContent, false) ) {
+ return Parser<arm64>::fileKind(fileContent);
+--- ld64-242/src/ld/parsers/macho_relocatable_file.cpp.noarm 2015-08-03 01:08:57.000000000 +0200
++++ ld64-242/src/ld/parsers/macho_relocatable_file.cpp 2015-08-03 01:10:52.000000000 +0200
+@@ -870,6 +870,7 @@
+ }
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ void Atom<arm>::verifyAlignment(const macho_section<P>&) const
+ {
+@@ -878,6 +879,7 @@
+ warning("ARM function not 4-byte aligned: %s from %s", this->name(), this->file()->path());
+ }
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+@@ -1267,6 +1269,7 @@
+ return true;
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ bool Parser<arm>::validFile(const uint8_t* fileContent, bool subtypeMustMatch, cpu_subtype_t subtype)
+ {
+@@ -1287,8 +1290,10 @@
+ }
+ return true;
+ }
++#endif
+
+
++#if SUPPORT_ARCH_arm64
+ template <>
+ bool Parser<arm64>::validFile(const uint8_t* fileContent, bool subtypeMustMatch, cpu_subtype_t subtype)
+ {
+@@ -1301,6 +1306,7 @@
+ return false;
+ return true;
+ }
++#endif
+
+
+ template <>
+@@ -1325,6 +1331,7 @@
+ return "x86_64";
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ const char* Parser<arm>::fileKind(const uint8_t* fileContent)
+ {
+@@ -1340,6 +1347,7 @@
+ }
+ return "arm???";
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+@@ -1604,11 +1612,13 @@
+ return false;
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ arm::P::uint_t Parser<arm>::realAddr(arm::P::uint_t addr)
+ {
+ return addr & (-2);
+ }
++#endif
+
+ template <typename A>
+ typename A::P::uint_t Parser<A>::realAddr(typename A::P::uint_t addr)
+@@ -1874,8 +1884,12 @@
+
+ template <> uint8_t Parser<x86>::loadCommandSizeMask() { return 0x03; }
+ template <> uint8_t Parser<x86_64>::loadCommandSizeMask() { return 0x07; }
++#if SUPPORT_ARCH_arm_any
+ template <> uint8_t Parser<arm>::loadCommandSizeMask() { return 0x03; }
++#endif
++#if SUPPORT_ARCH_arm64
+ template <> uint8_t Parser<arm64>::loadCommandSizeMask() { return 0x07; }
++#endif
+
+ template <typename A>
+ bool Parser<A>::parseLoadCommands()
+@@ -4072,6 +4086,7 @@
+ return 1 + (this->_machOSection - parser.firstMachOSection());
+ }
+
++#if SUPPORT_ARCH_arm_any
+ // arm does not have zero cost exceptions
+ template <>
+ uint32_t CFISection<arm>::cfiCount(Parser<arm>& parser)
+@@ -4084,6 +4099,7 @@
+ }
+ return 0;
+ }
++#endif
+
+ template <typename A>
+ uint32_t CFISection<A>::cfiCount(Parser<A>& parser)
+@@ -4211,6 +4227,7 @@
+
+
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ void CFISection<arm>::cfiParse(class Parser<arm>& parser, uint8_t* buffer,
+ libunwind::CFI_Atom_Info<CFISection<arm>::OAS>::CFI_Atom_Info cfiArray[],
+@@ -4233,6 +4250,7 @@
+ if ( msg != NULL )
+ throwf("malformed __eh_frame section: %s", msg);
+ }
++#endif
+
+
+
+@@ -4337,8 +4355,12 @@
+
+ template <> bool CFISection<x86_64>::bigEndian() { return false; }
+ template <> bool CFISection<x86>::bigEndian() { return false; }
++#if SUPPORT_ARCH_arm_any
+ template <> bool CFISection<arm>::bigEndian() { return false; }
++#endif
++#if SUPPORT_ARCH_arm64
+ template <> bool CFISection<arm64>::bigEndian() { return false; }
++#endif
+
+
+ template <>
+@@ -4412,6 +4434,7 @@
+ }
+ #endif
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ void CFISection<arm>::addCiePersonalityFixups(class Parser<arm>& parser, const CFI_Atom_Info* cieInfo)
+ {
+@@ -4433,7 +4456,7 @@
+ throwf("unsupported address encoding (%02X) of personality function in CIE", personalityEncoding);
+ }
+ }
+-
++#endif
+
+
+ template <typename A>
+@@ -5324,11 +5347,13 @@
+ return ld::Fixup::kindStoreLittleEndian32;
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ ld::Fixup::Kind NonLazyPointerSection<arm>::fixupKind()
+ {
+ return ld::Fixup::kindStoreLittleEndian32;
+ }
++#endif
+
+ template <>
+ ld::Fixup::Kind NonLazyPointerSection<arm64>::fixupKind()
+@@ -7440,10 +7465,14 @@
+ return ( mach_o::relocatable::Parser<x86_64>::validFile(fileContent) );
+ case CPU_TYPE_I386:
+ return ( mach_o::relocatable::Parser<x86>::validFile(fileContent) );
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ return ( mach_o::relocatable::Parser<arm>::validFile(fileContent, opts.objSubtypeMustMatch, opts.subType) );
++#endif
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
+ return ( mach_o::relocatable::Parser<arm64>::validFile(fileContent, opts.objSubtypeMustMatch, opts.subType) );
++#endif
+ }
+ return false;
+ }
+@@ -7464,17 +7493,21 @@
+ *subResult = CPU_SUBTYPE_X86_ALL;
+ return true;
+ }
++#if SUPPORT_ARCH_arm_any
+ if ( mach_o::relocatable::Parser<arm>::validFile(fileContent, false, 0) ) {
+ *result = CPU_TYPE_ARM;
+ const macho_header<Pointer32<LittleEndian> >* header = (const macho_header<Pointer32<LittleEndian> >*)fileContent;
+ *subResult = header->cpusubtype();
+ return true;
+ }
++#endif
++#if SUPPORT_ARCH_arm_any
+ if ( mach_o::relocatable::Parser<arm64>::validFile(fileContent, false, 0) ) {
+ *result = CPU_TYPE_ARM64;
+ *subResult = CPU_SUBTYPE_ARM64_ALL;
+ return true;
+ }
++#endif
+ return false;
+ }
+
+@@ -7489,9 +7522,11 @@
+ if ( mach_o::relocatable::Parser<x86>::validFile(fileContent) ) {
+ return mach_o::relocatable::Parser<x86>::fileKind(fileContent);
+ }
++#if SUPPORT_ARCH_arm_any
+ if ( mach_o::relocatable::Parser<arm>::validFile(fileContent, false, 0) ) {
+ return mach_o::relocatable::Parser<arm>::fileKind(fileContent);
+ }
++#endif
+ return NULL;
+ }
+
+@@ -7503,9 +7538,11 @@
+ if ( mach_o::relocatable::Parser<x86_64>::validFile(fileContent) ) {
+ return mach_o::relocatable::Parser<x86_64>::hasObjC2Categories(fileContent);
+ }
++#if SUPPORT_ARCH_arm_any
+ else if ( mach_o::relocatable::Parser<arm>::validFile(fileContent, false, 0) ) {
+ return mach_o::relocatable::Parser<arm>::hasObjC2Categories(fileContent);
+ }
++#endif
+ else if ( mach_o::relocatable::Parser<x86>::validFile(fileContent, false, 0) ) {
+ return mach_o::relocatable::Parser<x86>::hasObjC2Categories(fileContent);
+ }
+--- ld64-242/src/ld/passes/branch_island.cpp.noarm 2014-03-19 23:50:50.000000000 +0100
++++ ld64-242/src/ld/passes/branch_island.cpp 2015-08-03 01:09:13.000000000 +0200
+@@ -285,6 +285,7 @@
+ static uint64_t textSizeWhenMightNeedBranchIslands(const Options& opts, bool seenThumbBranch)
+ {
+ switch ( opts.architecture() ) {
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( ! seenThumbBranch )
+ return 32000000; // ARM can branch +/- 32MB
+@@ -293,6 +294,7 @@
+ else
+ return 4000000; // thumb1 can branch +/- 4MB
+ break;
++#endif
+ }
+ assert(0 && "unexpected architecture");
+ return 0x100000000LL;
+@@ -302,6 +304,7 @@
+ static uint64_t maxDistanceBetweenIslands(const Options& opts, bool seenThumbBranch)
+ {
+ switch ( opts.architecture() ) {
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( ! seenThumbBranch )
+ return 30*1024*1024; // 2MB of branch islands per 32MB
+@@ -310,6 +313,7 @@
+ else
+ return 3500000; // 0.5MB of branch islands per 4MB
+ break;
++#endif
+ }
+ assert(0 && "unexpected architecture");
+ return 0x100000000LL;
+@@ -654,8 +658,10 @@
+
+ // only ARM needs branch islands
+ switch ( opts.architecture() ) {
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ break;
++#endif
+ default:
+ return;
+ }
+--- ld64-242/src/ld/passes/branch_shim.cpp.noarm 2013-03-08 00:10:19.000000000 +0100
++++ ld64-242/src/ld/passes/branch_shim.cpp 2015-08-03 01:09:13.000000000 +0200
+@@ -276,6 +276,9 @@
+ //
+ void doPass(const Options& opts, ld::Internal& state)
+ {
++#if !SUPPORT_ARCH_arm_any
++ return;
++#else
+ // only make branch shims in final linked images
+ if ( opts.outputKind() == Options::kObjectFile )
+ return;
+@@ -386,6 +389,7 @@
+ // append all new shims to end of __text
+ sect->atoms.insert(sect->atoms.end(), shims.begin(), shims.end());
+ }
++#endif
+ }
+
+
+--- ld64-242/src/ld/passes/dtrace_dof.cpp.noarm 2015-08-03 01:08:57.000000000 +0200
++++ ld64-242/src/ld/passes/dtrace_dof.cpp 2015-08-03 01:09:13.000000000 +0200
+@@ -179,8 +179,12 @@
+ switch ( opts.architecture() ) {
+ case CPU_TYPE_I386:
+ case CPU_TYPE_X86_64:
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
++#endif
++#if SUPPORT_ARCH_arm64
+ case CPU_TYPE_ARM64:
++#endif
+ storeKind = ld::Fixup::kindStoreLittleEndian32;
+ break;
+ default:
+--- ld64-242/src/ld/passes/stubs/stubs.cpp.noarm 2013-07-23 01:37:47.000000000 +0200
++++ ld64-242/src/ld/passes/stubs/stubs.cpp 2015-08-03 01:09:13.000000000 +0200
+@@ -324,9 +324,11 @@
+ if ( _options.outputKind() != Options::kDynamicLibrary )
+ throwf("resolver functions (%s) can only be used in dylibs", atom->name());
+ if ( !_options.makeCompressedDyldInfo() ) {
++#if SUPPORT_ARCH_arm_any
+ if ( _options.architecture() == CPU_TYPE_ARM )
+ throwf("resolver functions (%s) can only be used when targeting iOS 4.2 or later", atom->name());
+ else
++#endif
+ throwf("resolver functions (%s) can only be used when targeting Mac OS X 10.6 or later", atom->name());
+ }
+ stubFor[atom] = NULL;
+@@ -354,6 +356,7 @@
+ throw "symbol dyld_stub_binding_helper not found, normally in crt1.o/dylib1.o/bundle1.o";
+
+ // disable arm close stubs in some cases
++#if SUPPORT_ARCH_arm_any
+ if ( _architecture == CPU_TYPE_ARM ) {
+ if ( codeSize > 4*1024*1024 )
+ _largeText = true;
+@@ -377,6 +380,7 @@
+ }
+ }
+ }
++#endif
+
+ // make stub atoms
+ for (std::map<const ld::Atom*,ld::Atom*>::iterator it = stubFor.begin(); it != stubFor.end(); ++it) {
+--- ld64-242/src/ld/Resolver.cpp.noarm 2015-08-03 01:08:56.000000000 +0200
++++ ld64-242/src/ld/Resolver.cpp 2015-08-03 01:09:13.000000000 +0200
+@@ -428,6 +428,7 @@
+ // update cpu-sub-type
+ cpu_subtype_t nextObjectSubType = file.cpuSubType();
+ switch ( _options.architecture() ) {
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ if ( _options.subArchitecture() != nextObjectSubType ) {
+ if ( (_options.subArchitecture() == CPU_SUBTYPE_ARM_ALL) && _options.forceCpuSubtypeAll() ) {
+@@ -446,6 +447,7 @@
+ }
+ }
+ break;
++#endif
+
+ case CPU_TYPE_I386:
+ _internal.cpuSubType = CPU_SUBTYPE_I386_ALL;
+--- ld64-242/src/other/machochecker.cpp.noarm 2015-08-03 01:08:57.000000000 +0200
++++ ld64-242/src/other/machochecker.cpp 2015-08-03 01:09:13.000000000 +0200
+@@ -252,6 +252,7 @@
+ return false;
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ bool MachOChecker<arm>::validFile(const uint8_t* fileContent)
+ {
+@@ -269,6 +270,7 @@
+ }
+ return false;
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+@@ -294,7 +296,9 @@
+ template <> uint8_t MachOChecker<ppc64>::loadCommandSizeMask() { return 0x07; }
+ template <> uint8_t MachOChecker<x86>::loadCommandSizeMask() { return 0x03; }
+ template <> uint8_t MachOChecker<x86_64>::loadCommandSizeMask() { return 0x07; }
++#if SUPPORT_ARCH_arm_any
+ template <> uint8_t MachOChecker<arm>::loadCommandSizeMask() { return 0x03; }
++#endif
+ #if SUPPORT_ARCH_arm64
+ template <> uint8_t MachOChecker<arm64>::loadCommandSizeMask() { return 0x07; }
+ #endif
+@@ -324,11 +328,13 @@
+ return threadInfo->thread_register(7);
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ arm::P::uint_t MachOChecker<arm>::getInitialStackPointer(const macho_thread_command<arm::P>* threadInfo)
+ {
+ return threadInfo->thread_register(13);
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+@@ -362,11 +368,13 @@
+ return threadInfo->thread_register(16);
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ arm::P::uint_t MachOChecker<arm>::getEntryPoint(const macho_thread_command<arm::P>* threadInfo)
+ {
+ return threadInfo->thread_register(15);
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+@@ -1025,6 +1033,7 @@
+ return fFirstWritableSegment->vmaddr();
+ }
+
++#if SUPPORT_ARCH_arm_any
+ template <>
+ arm::P::uint_t MachOChecker<arm>::relocBase()
+ {
+@@ -1033,6 +1042,7 @@
+ else
+ return fFirstSegment->vmaddr();
+ }
++#endif
+
+ #if SUPPORT_ARCH_arm64
+ template <>
+--- ld64-242/src/other/ObjectDump.cpp.noarm 2015-08-03 01:08:56.000000000 +0200
++++ ld64-242/src/other/ObjectDump.cpp 2015-08-03 01:09:13.000000000 +0200
+@@ -806,6 +806,7 @@
+ case ld::Fixup::kindStoreThumbHigh16:
+ printf(", then store high-16 in Thumb movt");
+ break;
++#if SUPPORT_ARCH_arm64
+ case ld::Fixup::kindStoreARM64Branch26:
+ printf(", then store as ARM64 26-bit pcrel branch");
+ break;
+@@ -845,6 +846,7 @@
+ case ld::Fixup::kindStoreARM64PCRelToGOT:
+ printf(", then store as 32-bit delta to GOT entry");
+ break;
++#endif
+ case ld::Fixup::kindDtraceExtra:
+ printf("dtrace static probe extra info");
+ break;
+@@ -989,6 +991,7 @@
+ case ld::Fixup::kindSetTargetTLVTemplateOffsetLittleEndian64:
+ printf("tlv template offset of %s", referenceTargetAtomName(ref));
+ break;
++#if SUPPORT_ARCH_arm64
+ case ld::Fixup::kindStoreTargetAddressARM64Branch26:
+ printf("ARM64 store 26-bit pcrel branch to %s", referenceTargetAtomName(ref));
+ break;
+@@ -1022,6 +1025,7 @@
+ case ld::Fixup::kindStoreTargetAddressARM64TLVPLoadNowLeaPageOff12:
+ printf("ARM64 store 12-bit page offset of lea for TLV of %s", referenceTargetAtomName(ref));
+ break;
++#endif
+ //default:
+ // printf("unknown fixup");
+ // break;
+--- ld64-242/src/other/rebase.cpp.noarm 2013-03-08 00:10:19.000000000 +0100
++++ ld64-242/src/other/rebase.cpp 2015-08-03 01:09:13.000000000 +0200
+@@ -160,9 +160,11 @@
+ case CPU_TYPE_X86_64:
+ fRebasers.push_back(new Rebaser<x86_64>(&p[fileOffset]));
+ break;
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ fRebasers.push_back(new Rebaser<arm>(&p[fileOffset]));
+ break;
++#endif
+ default:
+ throw "unknown file format";
+ }
+@@ -186,9 +188,11 @@
+ else if ( (OSSwapLittleToHostInt32(mh->magic) == MH_MAGIC_64) && (OSSwapLittleToHostInt32(mh->cputype) == CPU_TYPE_X86_64)) {
+ fRebasers.push_back(new Rebaser<x86_64>(mh));
+ }
++#if SUPPORT_ARCH_arm_any
+ else if ( (OSSwapLittleToHostInt32(mh->magic) == MH_MAGIC) && (OSSwapLittleToHostInt32(mh->cputype) == CPU_TYPE_ARM)) {
+ fRebasers.push_back(new Rebaser<arm>(mh));
+ }
++#endif
+ else {
+ throw "unknown file format";
+ }
+@@ -236,7 +240,9 @@
+ template <> cpu_type_t Rebaser<ppc64>::getArchitecture() const { return CPU_TYPE_POWERPC64; }
+ template <> cpu_type_t Rebaser<x86>::getArchitecture() const { return CPU_TYPE_I386; }
+ template <> cpu_type_t Rebaser<x86_64>::getArchitecture() const { return CPU_TYPE_X86_64; }
++#if SUPPORT_ARCH_arm_any
+ template <> cpu_type_t Rebaser<arm>::getArchitecture() const { return CPU_TYPE_ARM; }
++#endif
+
+ template <typename A>
+ uint64_t Rebaser<A>::getBaseAddress() const
+@@ -875,8 +881,10 @@
+ return "i386";
+ case CPU_TYPE_X86_64:
+ return "x86_64";
++#if SUPPORT_ARCH_arm_any
+ case CPU_TYPE_ARM:
+ return "arm";
++#endif
+ }
+ return "unknown";
+ }
+@@ -969,6 +977,7 @@
+ else if ( arch == CPU_TYPE_X86_64 ) {
+ return 0x200000000ULL;
+ }
++#if SUPPORT_ARCH_arm_any
+ else if ( arch == CPU_TYPE_ARM ) {
+ // place dylibs below dyld
+ uint64_t topAddr = 0x2FE00000;
+@@ -977,6 +986,7 @@
+ throwf("total size of images (0x%X) does not fit below 0x2FE00000", totalSize);
+ return topAddr - totalSize;
+ }
++#endif
+ else
+ throw "unknown architecture";
+ }
+@@ -1043,7 +1053,9 @@
+ onlyArchs.insert(CPU_TYPE_POWERPC64);
+ onlyArchs.insert(CPU_TYPE_I386);
+ onlyArchs.insert(CPU_TYPE_X86_64);
++#if SUPPORT_ARCH_arm_any
+ onlyArchs.insert(CPU_TYPE_ARM);
++#endif
+ }
+
+ // scan files and collect sizes
+--- ld64-242/src/other/unwinddump.cpp.noarm 2015-08-03 01:08:57.000000000 +0200
++++ ld64-242/src/other/unwinddump.cpp 2015-08-03 01:09:13.000000000 +0200
+@@ -97,7 +97,9 @@
+
+ template <> const char* UnwindPrinter<x86>::archName() { return "i386"; }
+ template <> const char* UnwindPrinter<x86_64>::archName() { return "x86_64"; }
++#if SUPPORT_ARCH_arm_any
+ template <> const char* UnwindPrinter<arm>::archName() { return "arm"; }
++#endif
+ #if SUPPORT_ARCH_arm64
+ template <> const char* UnwindPrinter<arm64>::archName() { return "arm64"; }
+ #endif
+@@ -1195,7 +1197,9 @@
+ #if SUPPORT_ARCH_arm64
+ onlyArchs.insert(CPU_TYPE_ARM64);
+ #endif
++#if SUPPORT_ARCH_arm_any
+ onlyArchs.insert(CPU_TYPE_ARM);
++#endif
+ }
+
+ // process each file