Skip to content

Latest commit

 

History

History
48 lines (41 loc) · 2.47 KB

README.md

File metadata and controls

48 lines (41 loc) · 2.47 KB

ld64

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.

  1. Initial setup
    1. Install Xcode 10.1 from Apple
    2. Clone this project, or download the zip.
    3. Navigate to the project directory in the terminal.
    4. Make sure there are no spaces in the current directory path, or things will go badly for you.
  2. Get Sources
    1. curl https://opensource.apple.com/tarballs/ld64/ld64-409.12.tar.gz --output ld64-409.12.tar.gz | tar xz
    2. curl https://opensource.apple.com/tarballs/dyld/dyld-635.2.tar.gz --output dyld-635.2.tar.gz | tar xz
    3. mkdir tapi-master
    4. curl -L https://github.com/ributzka/tapi/tarball/master | tar xz -C tapi-master --strip-components=1
    5. curl http://releases.llvm.org/7.0.1/llvm-7.0.1.src.tar.xz | tar xJ
    6. curl http://releases.llvm.org/7.0.1/cfe-7.0.1.src.tar.xz | tar xJ
  3. Apply patches
    1. patch -p1 -d tapi-master < patches/tapi.patch
    2. patch -p1 -d ld64-409.12 < patches/ld64.patch
    3. patch -p1 -d dyld-635.2 < patches/dyld.patch
  4. Configure ld64 project
    1. open ld64-409.12/ld64.xcodeproj
    2. Change the Base SDK for the ld64 project from macosx.internal to macos alt text
    3. Remove the override for Base SDK from the ld target so it changes from macosx.internal to macos (you can do this be selecting it and hitting delete). alt text
    4. Add the following Header Search Paths:
      • $(SRCROOT)/../tapi-master/include
      • $(SRCROOT)/../dyld-635.2/include
      • $(SRCROOT)/../llvm-7.0.1.src/include
      • $(SRCROOT)/../cfe-7.0.1.src/include alt text
    5. Set Treat Warnings as Errors to No alt text
  5. Select the ld target to build
  6. 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.

Level of support

This is not an officially supported Google product.