Bug 1551690 - be more specific about the LLVM target on OS X; r=nalexander
authorNathan Froyd <froydnj@mozilla.com>
Tue, 21 May 2019 17:53:44 +0000
changeset 474813 167dbfcf5251e0af024f481ffe1670b0d826ab29
parent 474812 592cf72930939b956c6a11311d500b330b5323e3
child 474814 f023603f7e7265c5602fb6e9c871b19a3c7f3a92
push id36046
push useraiakab@mozilla.com
push dateTue, 21 May 2019 21:45:52 +0000
treeherdermozilla-central@257f2c96cef5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1551690
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1551690 - be more specific about the LLVM target on OS X; r=nalexander Our current OS X builds use `--target=x86_64-darwin11` (which corresponds to OS X 10.7). This target is problematic for two reasons: * We're actually targeting for OS X 10.9 (`MACOSX_DEPLOYMENT_TARGET`); * It's slightly different from the default Rust target. Let's address these problems in reverse order: differences from the Rust target are bad, because the `--target` we provide to `clang` and the Rust target find their way into LLVM bitcode files and the linker will refuse to link together bitcode files that have incompatible targets. Why are the two incompatible? The current `--target` doesn't have a "vendor" in triple-speak, whereas the Rust one has "apple" as the vendor (`x86_64-apple-darwin`) We therefore need to change the `--target` we pass to `clang` to have a vendor of "apple". This need is behind the {init,toolchain}.configure changes, but it has ramifications elsewhere, because `clang` looks for `--target`-prefixed build tools. So we have to change the `--target` for cctools to get the right tool prefixes and we have to change the `--target` for building clang ourselves so that *those* builds can find the newly renamed cctools. Once we've done, that's really enough; we don't *need to address the first problem: While the `--target` might be `x86_64-apple-darwin11`, both `clang` and `rustc` will dynamically choose the target triple that eventually lands in LLVM bitcode files based on `MACOSX_DEPLOYMENT_TARGET`, which we set in all builds. But the current target is slightly misleading, and the cctools don't need to be prefixed with a particular Darwin version, since they work for all Darwin targets. Let's just drop the "11" from the `--target` and eliminate a little bit of confusion. Differential Revision: https://phabricator.services.mozilla.com/D31128
build/build-clang/build-clang.py
build/build-clang/clang-8-macosx64.json
build/build-clang/clang-tidy-macosx64.json
build/build-clang/compiler-rt-cross-compile.patch
build/macosx/cross-mozconfig.common
build/moz.configure/init.configure
python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
taskcluster/scripts/misc/build-cbindgen.sh
taskcluster/scripts/misc/build-cctools-port-macosx.sh
taskcluster/scripts/misc/build-cctools-port.sh
taskcluster/scripts/misc/build-gn-macosx.sh
taskcluster/scripts/misc/build-minidump-stackwalk.sh
taskcluster/scripts/misc/wr-macos-cross-build-setup.sh
--- a/build/build-clang/build-clang.py
+++ b/build/build-clang/build-clang.py
@@ -289,17 +289,17 @@ def build_one_stage(cc, cxx, asm, ld, ar
                 "-DCMAKE_FIND_ROOT_PATH=%s" % slashify_path(os.getenv("CROSS_CCTOOLS_PATH")), # noqa
                 "-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER",
                 "-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY",
                 "-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY",
                 "-DCMAKE_MACOSX_RPATH=ON",
                 "-DCMAKE_OSX_ARCHITECTURES=x86_64",
                 "-DDARWIN_osx_ARCHS=x86_64",
                 "-DDARWIN_osx_SYSROOT=%s" % slashify_path(os.getenv("CROSS_SYSROOT")),
-                "-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-darwin11"
+                "-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-apple-darwin"
             ]
         return cmake_args
 
     cmake_args = []
 
     runtime_targets = []
     if is_final_stage:
         if android_targets:
@@ -781,17 +781,17 @@ if __name__ == "__main__":
 
     if osx_cross_compile:
         # undo the damage done in the is_linux() block above, and also simulate
         # the is_darwin() block above.
         extra_cflags = []
         extra_cxxflags = ["-stdlib=libc++"]
         extra_cxxflags2 = ["-stdlib=libc++"]
 
-        extra_flags = ["-target", "x86_64-darwin11", "-mlinker-version=137",
+        extra_flags = ["-target", "x86_64-apple-darwin", "-mlinker-version=137",
                        "-B", "%s/bin" % os.getenv("CROSS_CCTOOLS_PATH"),
                        "-isysroot", os.getenv("CROSS_SYSROOT"),
                        # technically the sysroot flag there should be enough to deduce this,
                        # but clang needs some help to figure this out.
                        "-I%s/usr/include" % os.getenv("CROSS_SYSROOT"),
                        "-iframework", "%s/System/Library/Frameworks" % os.getenv("CROSS_SYSROOT")]
         extra_cflags += extra_flags
         extra_cxxflags += extra_flags
--- a/build/build-clang/clang-8-macosx64.json
+++ b/build/build-clang/clang-8-macosx64.json
@@ -11,19 +11,19 @@
     "compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_800/final",
     "libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_800/final",
     "libcxxabi_repo": "https://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_800/final",
     "python_path": "/usr/bin/python2.7",
     "gcc_dir": "/builds/worker/workspace/build/src/gcc",
     "cc": "/builds/worker/workspace/build/src/clang/bin/clang",
     "cxx": "/builds/worker/workspace/build/src/clang/bin/clang++",
     "as": "/builds/worker/workspace/build/src/clang/bin/clang",
-    "ar": "/builds/worker/workspace/build/src/cctools/bin/x86_64-darwin11-ar",
-    "ranlib": "/builds/worker/workspace/build/src/cctools/bin/x86_64-darwin11-ranlib",
-    "libtool": "/builds/worker/workspace/build/src/cctools/bin/x86_64-darwin11-libtool",
+    "ar": "/builds/worker/workspace/build/src/cctools/bin/x86_64-apple-darwin-ar",
+    "ranlib": "/builds/worker/workspace/build/src/cctools/bin/x86_64-apple-darwin-ranlib",
+    "libtool": "/builds/worker/workspace/build/src/cctools/bin/x86_64-apple-darwin-libtool",
     "ld": "/builds/worker/workspace/build/src/clang/bin/clang",
     "patches": [
       "static-llvm-symbolizer.patch",
       "rename_gcov_flush.patch",
       "compiler-rt-cross-compile.patch",
       "compiler-rt-no-codesign.patch"
     ]
 }
--- a/build/build-clang/clang-tidy-macosx64.json
+++ b/build/build-clang/clang-tidy-macosx64.json
@@ -11,16 +11,16 @@
     "extra_repo": "https://llvm.org/svn/llvm-project/clang-tools-extra/tags/RELEASE_800/final",
     "libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_800/final",
     "libcxxabi_repo": "https://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_800/final",
     "python_path": "/usr/bin/python2.7",
     "gcc_dir": "/builds/worker/workspace/build/src/gcc",
     "cc": "/builds/worker/workspace/build/src/clang/bin/clang",
     "cxx": "/builds/worker/workspace/build/src/clang/bin/clang++",
     "as": "/builds/worker/workspace/build/src/clang/bin/clang",
-    "ar": "/builds/worker/workspace/build/src/cctools/bin/x86_64-darwin11-ar",
-    "ranlib": "/builds/worker/workspace/build/src/cctools/bin/x86_64-darwin11-ranlib",
-    "libtool": "/builds/worker/workspace/build/src/cctools/bin/x86_64-darwin11-libtool",
+    "ar": "/builds/worker/workspace/build/src/cctools/bin/x86_64-apple-darwin-ar",
+    "ranlib": "/builds/worker/workspace/build/src/cctools/bin/x86_64-apple-darwin-ranlib",
+    "libtool": "/builds/worker/workspace/build/src/cctools/bin/x86_64-apple-darwin-libtool",
     "ld": "/builds/worker/workspace/build/src/clang/bin/clang",
     "patches": [
       "clang-tidy-8.patch"
     ]
 }
--- a/build/build-clang/compiler-rt-cross-compile.patch
+++ b/build/build-clang/compiler-rt-cross-compile.patch
@@ -1,15 +1,15 @@
-Add `-target x86_64-darwin11' to the compiler-rt overridden CFLAGS
+Add `-target x86_64-apple-darwin' to the compiler-rt overridden CFLAGS
 
 diff --git a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
 index 28d398672..aac68bf36 100644
 --- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
 +++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
 @@ -265,7 +265,7 @@ endfunction()
  macro(darwin_add_builtin_libraries)
    set(DARWIN_EXCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Darwin-excludes)
  
 -  set(CFLAGS "-fPIC -O3 -fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -fomit-frame-pointer")
-+  set(CFLAGS "-fPIC -O3 -fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -fomit-frame-pointer -target x86_64-darwin11 -isysroot ${CMAKE_OSX_SYSROOT} -I${CMAKE_OSX_SYSROOT}/usr/include")
++  set(CFLAGS "-fPIC -O3 -fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -fomit-frame-pointer -target x86_64-apple-darwin -isysroot ${CMAKE_OSX_SYSROOT} -I${CMAKE_OSX_SYSROOT}/usr/include")
    set(CMAKE_C_FLAGS "")
    set(CMAKE_CXX_FLAGS "")
    set(CMAKE_ASM_FLAGS "")
--- a/build/macosx/cross-mozconfig.common
+++ b/build/macosx/cross-mozconfig.common
@@ -32,17 +32,17 @@ mk_add_options "export REAL_DSYMUTIL=$to
 export MKFSHFS=$topsrcdir/hfsplus-tools/newfs_hfs
 export DMG_TOOL=$topsrcdir/dmg/dmg
 export HFS_TOOL=$topsrcdir/dmg/hfsplus
 
 export HOST_CFLAGS="-g"
 export HOST_CXXFLAGS="-g"
 export HOST_LDFLAGS="-g"
 
-ac_add_options --target=x86_64-apple-darwin11
+ac_add_options --target=x86_64-apple-darwin
 export MACOS_SDK_DIR=$CROSS_SYSROOT
 export MACOS_PRIVATE_FRAMEWORKS_DIR=$CROSS_PRIVATE_FRAMEWORKS
 
 if [ "x$MOZ_PKG_SPECIAL" != "xasan" -a -z "$MOZ_AUTOMATION_ARTIFACT_BUILDS" ]; then
   # Enable static analysis checks by default on OSX cross builds.
   # Exception is ASan, where this breaks.
   # The option is not valid on artifact builds, so don't add it there either.
   ac_add_options --enable-clang-plugin
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -745,28 +745,35 @@ def split_triplet(triplet, allow_unknown
         except (KeyError, ValueError):
             if allow_unknown:
                 return value
             raise
 
     def bitness(cpu):
         return CPU_bitness[cpu]
 
+    # Toolchains, most notably for cross compilation may use cpu-os
+    # prefixes. We need to be more specific about the LLVM target on Mac
+    # so cross-language LTO will work correctly.
+
+    if os.startswith('darwin'):
+        toolchain = '%s-apple-%s' % (cpu, os)
+    else:
+        toolchain = '%s-%s' % (cpu, os)
+
     return namespace(
         alias=triplet,
         cpu=sanitize(CPU, canonical_cpu),
         bitness=sanitize(bitness, canonical_cpu),
         kernel=sanitize(Kernel, canonical_kernel),
         os=sanitize(OS, canonical_os),
         endianness=sanitize(Endianness, endianness),
         raw_cpu=cpu,
         raw_os=os,
-        # Toolchains, most notably for cross compilation may use cpu-os
-        # prefixes.
-        toolchain='%s-%s' % (cpu, os),
+        toolchain=toolchain,
     )
 
 
 # This defines a fake target/host namespace for when running with --help
 # If either --host or --target is passed on the command line, then fall
 # back to the real deal.
 @depends('--help', '--host', '--target')
 def help_host_target(help, host, target):
--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
@@ -201,19 +201,19 @@ CLANGXX_3_6 = CLANGXX('3.6.2') + {
 }
 DEFAULT_CLANG = CLANG_3_6
 DEFAULT_CLANGXX = CLANGXX_3_6
 
 
 def CLANG_PLATFORM(gcc_platform):
     base = {
         '--target=x86_64-linux-gnu': GCC_PLATFORM_X86_64_LINUX[None],
-        '--target=x86_64-darwin11.2.0': GCC_PLATFORM_X86_64_OSX[None],
+        '--target=x86_64-apple-darwin11.2.0': GCC_PLATFORM_X86_64_OSX[None],
         '--target=i686-linux-gnu': GCC_PLATFORM_X86_LINUX[None],
-        '--target=i686-darwin11.2.0': GCC_PLATFORM_X86_OSX[None],
+        '--target=i686-apple-darwin11.2.0': GCC_PLATFORM_X86_OSX[None],
         '--target=arm-linux-gnu': GCC_PLATFORM_ARM_LINUX[None],
     }
     undo_gcc_platform = {
         k: {symbol: False for symbol in gcc_platform[None]}
         for k in base
     }
     return FakeCompiler(gcc_platform, undo_gcc_platform, base)
 
@@ -1327,20 +1327,20 @@ class OSXCrossToolchainTest(BaseToolchai
     TARGET = 'i686-apple-darwin11.2.0'
     PATHS = LinuxToolchainTest.PATHS
     DEFAULT_CLANG_RESULT = LinuxToolchainTest.DEFAULT_CLANG_RESULT
     DEFAULT_CLANGXX_RESULT = LinuxToolchainTest.DEFAULT_CLANGXX_RESULT
 
     def test_osx_cross(self):
         self.do_toolchain_test(self.PATHS, {
             'c_compiler': self.DEFAULT_CLANG_RESULT + {
-                'flags': ['--target=i686-darwin11.2.0'],
+                'flags': ['--target=i686-apple-darwin11.2.0'],
             },
             'cxx_compiler': self.DEFAULT_CLANGXX_RESULT + {
-                'flags': ['--target=i686-darwin11.2.0'],
+                'flags': ['--target=i686-apple-darwin11.2.0'],
             },
             'host_c_compiler': self.DEFAULT_CLANG_RESULT,
             'host_cxx_compiler': self.DEFAULT_CLANGXX_RESULT,
         }, environ={
             'CC': 'clang',
         })
 
     def test_cannot_osx_cross(self):
--- a/taskcluster/scripts/misc/build-cbindgen.sh
+++ b/taskcluster/scripts/misc/build-cbindgen.sh
@@ -33,17 +33,17 @@ cd $WORKSPACE/build/src
 . taskcluster/scripts/misc/tooltool-download.sh
 
 # OSX cross builds are a bit harder
 if [ "$TARGET" == "x86_64-apple-darwin" ]; then
   export PATH="$PWD/llvm-dsymutil/bin:$PATH"
   export PATH="$PWD/cctools/bin:$PATH"
   cat >cross-linker <<EOF
 exec $PWD/clang/bin/clang -v \
-  -fuse-ld=$PWD/cctools/bin/x86_64-darwin11-ld \
+  -fuse-ld=$PWD/cctools/bin/x86_64-apple-darwin-ld \
   -mmacosx-version-min=10.11 \
   -target $TARGET \
   -B $PWD/cctools/bin \
   -isysroot $PWD/MacOSX10.11.sdk \
   "\$@"
 EOF
   chmod +x cross-linker
   export RUSTFLAGS="-C linker=$PWD/cross-linker"
--- a/taskcluster/scripts/misc/build-cctools-port-macosx.sh
+++ b/taskcluster/scripts/misc/build-cctools-port-macosx.sh
@@ -18,17 +18,17 @@ UPLOAD_DIR=$HOME/artifacts
 # Set some crosstools-port directories
 CROSSTOOLS_SOURCE_DIR=$WORKSPACE/crosstools-port
 CROSSTOOLS_CCTOOLS_DIR=$CROSSTOOLS_SOURCE_DIR/cctools
 CROSSTOOLS_BUILD_DIR=/tmp/cctools
 CLANG_DIR=$WORKSPACE/build/src/clang
 CCTOOLS_DIR=$WORKSPACE/build/src/cctools
 MACOSX_SDK_DIR=$WORKSPACE/build/src/MacOSX10.11.sdk
 
-TARGET_TRIPLE=x86_64-darwin11
+TARGET_TRIPLE=x86_64-apple-darwin
 
 # Create our directories
 mkdir -p $CROSSTOOLS_BUILD_DIR
 
 git clone --no-checkout $CROSSTOOL_PORT_REPOSITORY $CROSSTOOLS_SOURCE_DIR
 cd $CROSSTOOLS_SOURCE_DIR
 git checkout $CROSSTOOL_PORT_REV
 # Cherry pick two fixes for LTO.
--- a/taskcluster/scripts/misc/build-cctools-port.sh
+++ b/taskcluster/scripts/misc/build-cctools-port.sh
@@ -37,21 +37,21 @@ cd $WORKSPACE/build/src
 . taskcluster/scripts/misc/tooltool-download.sh
 
 # Configure crosstools-port
 cd $CROSSTOOLS_CCTOOLS_DIR
 export CC=$CLANG_DIR/bin/clang
 export CXX=$CLANG_DIR/bin/clang++
 export LDFLAGS="-lpthread -Wl,-rpath-link,$CLANG_DIR/lib"
 ./autogen.sh
-./configure --prefix=$CROSSTOOLS_BUILD_DIR --target=x86_64-darwin11 --with-llvm-config=$CLANG_DIR/bin/llvm-config
+./configure --prefix=$CROSSTOOLS_BUILD_DIR --target=x86_64-apple-darwin --with-llvm-config=$CLANG_DIR/bin/llvm-config
 
 # Build cctools
 make -j `nproc --all` install
 strip $CROSSTOOLS_BUILD_DIR/bin/*
 # cctools-port doesn't include dsymutil but clang will need to find it.
-cp $CLANG_DIR/bin/dsymutil $CROSSTOOLS_BUILD_DIR/bin/x86_64-darwin11-dsymutil
+cp $CLANG_DIR/bin/dsymutil $CROSSTOOLS_BUILD_DIR/bin/x86_64-apple-darwin-dsymutil
 # various build scripts based on cmake want to find `lipo` without a prefix
-cp $CROSSTOOLS_BUILD_DIR/bin/x86_64-darwin11-lipo $CROSSTOOLS_BUILD_DIR/bin/lipo
+cp $CROSSTOOLS_BUILD_DIR/bin/x86_64-apple-darwin-lipo $CROSSTOOLS_BUILD_DIR/bin/lipo
 
 # Put a tarball in the artifacts dir
 mkdir -p $UPLOAD_DIR
 tar cJf $UPLOAD_DIR/cctools.tar.xz -C $CROSSTOOLS_BUILD_DIR/.. `basename $CROSSTOOLS_BUILD_DIR`
--- a/taskcluster/scripts/misc/build-gn-macosx.sh
+++ b/taskcluster/scripts/misc/build-gn-macosx.sh
@@ -9,17 +9,17 @@ COMPRESS_EXT=xz
 
 CROSS_CCTOOLS_PATH=$WORKSPACE/build/src/cctools
 CROSS_SYSROOT=$WORKSPACE/build/src/MacOSX10.11.sdk
 
 export LD_LIBRARY_PATH=$WORKSPACE/build/src/clang/lib
 export CC=$WORKSPACE/build/src/clang/bin/clang
 export CXX=$WORKSPACE/build/src/clang/bin/clang++
 export AR=$WORKSPACE/build/src/clang/bin/llvm-ar
-export CFLAGS="-target x86_64-darwin11 -mlinker-version=137 -B ${CROSS_CCTOOLS_PATH}/bin -isysroot ${CROSS_SYSROOT} -I${CROSS_SYSROOT}/usr/include -iframework ${CROSS_SYSROOT}/System/Library/Frameworks"
+export CFLAGS="-target x86_64-apple-darwin -mlinker-version=137 -B ${CROSS_CCTOOLS_PATH}/bin -isysroot ${CROSS_SYSROOT} -I${CROSS_SYSROOT}/usr/include -iframework ${CROSS_SYSROOT}/System/Library/Frameworks"
 export CXXFLAGS="-stdlib=libc++ ${CFLAGS}"
 export LDFLAGS="${CXXFLAGS} -Wl,-syslibroot,${CROSS_SYSROOT} -Wl,-dead_strip"
 
 # We patch tools/gn/bootstrap/bootstrap.py to detect this.
 export MAC_CROSS=1
 
 # Gn build scripts use #!/usr/bin/env python, which will be python 2.6 on
 # the worker and cause failures. Work around this by putting python2.7
@@ -29,12 +29,12 @@ ln -s /usr/bin/python2.7 $WORKSPACE/pyth
 export PATH=$WORKSPACE/python_bin:$PATH
 
 cd $WORKSPACE/build/src
 
 . taskcluster/scripts/misc/tooltool-download.sh
 
 # The ninja templates used to bootstrap gn have hard-coded references to
 # 'libtool', make sure we find the right one.
-ln -s $CROSS_CCTOOLS_PATH/bin/x86_64-darwin11-libtool $CROSS_CCTOOLS_PATH/bin/libtool
+ln -s $CROSS_CCTOOLS_PATH/bin/x86_64-apple-darwin-libtool $CROSS_CCTOOLS_PATH/bin/libtool
 export PATH=$CROSS_CCTOOLS_PATH/bin:$PATH
 
 . taskcluster/scripts/misc/build-gn-common.sh
--- a/taskcluster/scripts/misc/build-minidump-stackwalk.sh
+++ b/taskcluster/scripts/misc/build-minidump-stackwalk.sh
@@ -15,17 +15,17 @@ export MOZ_OBJDIR=obj-minidump
 
 echo ac_add_options --enable-project=tools/crashreporter > .mozconfig
 
 MINIDUMP_STACKWALK=minidump_stackwalk
 
 case "$1" in
 macosx64)
     TOOLCHAINS="cctools rustc clang"
-    echo ac_add_options --target=x86_64-apple-darwin11 >> .mozconfig
+    echo ac_add_options --target=x86_64-apple-darwin >> .mozconfig
     echo ac_add_options --with-macos-sdk=$WORKSPACE/build/src/MacOSX10.11.sdk >> .mozconfig
     ;;
 mingw32)
     TOOLCHAINS="binutils rustc clang"
     echo ac_add_options --target=i686-w64-mingw32 >> .mozconfig
     echo export CC=i686-w64-mingw32-clang >> .mozconfig
     echo export HOST_CC=clang >> .mozconfig
     MINIDUMP_STACKWALK=minidump_stackwalk.exe
old mode 100644
new mode 100755
--- a/taskcluster/scripts/misc/wr-macos-cross-build-setup.sh
+++ b/taskcluster/scripts/misc/wr-macos-cross-build-setup.sh
@@ -20,24 +20,16 @@ CLANGDIR="${TOOLS_DIR}/clang"
 # Deploy the wrench dependencies
 mv ${TOOLS_DIR}/wrench-deps/{vendor,.cargo} "${GECKO_PATH}/gfx/wr/"
 
 # Building wrench with the `headless` feature also builds the osmesa-src crate,
 # which includes building C++ code. We have to do a bunch of shenanigans
 # to make this cross-compile properly.
 
 pushd "${TOOLS_DIR}/cctools/bin"
-# Link all the tools from x86_64-darwin11-* to x86_64-apple-darwin-* because
-# x86_64-apple-darwin is the Official Rust Triple (TM) and so that's the prefix
-# we run configure with, and the toolchain configure/make will look for.
-# We can't just rename the files because e.g. the ar tool invokes the ranlib
-# tool with the old prefix hard-coded. So we symlink instead.
-for TOOL in x86_64-darwin11-*; do
-    ln -s "${TOOL}" "${TOOL/x86_64-darwin11/${TARGET_TRIPLE}}"
-done
 
 # Add a pkg-config cross-compile wrapper. Without this, the configure script
 # will use pkg-config from the host, which will find host libraries that are
 # not what we want. This script stolen from
 # https://autotools.io/pkgconfig/cross-compiling.html
 cat > ${TARGET_TRIPLE}-pkg-config <<END_PKGCONFIG_WRAPPER
 #!/bin/sh
 export PKG_CONFIG_DIR=