These instructions are for building ld64 based on Apple's sources for the ld64 that comes with Xcode 10.1 and the dyld from Mojave (10.14.1) with clang/llvm 7.0.1.
Thanks to @rmaz for helping simplify my instructions.
- Initial setup
- Install Xcode 10.1 from Apple
- Clone this project, or download the zip.
- Navigate to the project directory in the terminal.
- Make sure there are no spaces in the current directory path, or things will go badly for you.
- Get Sources
curl https://opensource.apple.com/tarballs/ld64/ld64-409.12.tar.gz --output ld64-409.12.tar.gz | tar xz
curl https://opensource.apple.com/tarballs/dyld/dyld-635.2.tar.gz --output dyld-635.2.tar.gz | tar xz
mkdir tapi-master
curl -L https://github.com/ributzka/tapi/tarball/master | tar xz -C tapi-master --strip-components=1
curl http://releases.llvm.org/7.0.1/llvm-7.0.1.src.tar.xz | tar xJ
curl http://releases.llvm.org/7.0.1/cfe-7.0.1.src.tar.xz | tar xJ
- Apply patches
patch -p1 -d tapi-master < patches/tapi.patch
patch -p1 -d ld64-409.12 < patches/ld64.patch
patch -p1 -d dyld-635.2 < patches/dyld.patch
- Configure ld64 project
open ld64-409.12/ld64.xcodeproj
- Change the
Base SDK
for the ld64 project frommacosx.internal
tomacos
- Remove the override for
Base SDK
from the ld target so it changes frommacosx.internal
tomacos
(you can do this be selecting it and hitting delete). - Add the following
Header Search Paths
: - Set
Treat Warnings as Errors
toNo
- Select the
ld
target to build Build
You should be able to replace the ld64 that comes with Xcode 10.1 with this one (located in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/
). It will successfully link macOS 10.14, iOS 12 apps.
Be sure to back up your original ld64
!!!
Do not ship anything to Apple that was linked with this linker. This is purely for debugging linker related issues.
This is not an officially supported Google product.