How stable is ld64.lld?

Recently, I was surprised to find that the standard Clang in Xcode does NOT use the ld64.lld linker, instead it uses a third-party ld64 project. Is ld64.lld so bad that even Apple doesn’t trust it?

1 Like

It’s stable enough for Chrome on macOS at least. I don’t think it’s mistrust from apple. The macho port of lld is fairly new so there might be edge cases still. But go ahead and use it and if you find problems, please file issues!

People from Meta are the code owners and main contributors for ld64.lld. They also use it internally. ld64 or ld is the Apple linker. It often gets features before ld64.lld. Even if you install an open-source clang, it will invoke ld64.

If you install open-source Clang and LLD, then -fuse-ld=lld will invoke ld64.lld on MacOS. I would be surprised if it does not work.

Thanks for explaining!

Does anyone have experience with cross-platform linking for Mac? When we link from Linux to Mac, the resulting binary does not run. When we link from Windows to Mac - problems with the standard library.

I have no experience with cross-platform. However, I believe that your are mixing two concepts. lld is just a tool. It can run on Windows, Linux, BSDs, and more. The bigger issue is the Apple SDK.



We have internal builds that’ve been using lld-macho for the past 3+ months for cross-linking without issues (that is, linking on Linux machines for Mac and iOS apps)

1 Like

If you suspect a difference between ld64.lld and ld64, please file an open issue along with a repro (Issues · llvm/llvm-project · GitHub), and the people there could help take a look at what’s wrong. Without further information, we can’t help you diagnose what problems you are having. That said, ld64.lld should be stable and be a drop in replacement for ld64.

1 Like

It’s great that you have this experience!

May I ask you to share your experience, step by step, how to create such an application. I created a separate forum thread:

What will be valuable:

  1. How did you get the correct SDK (we got some problems with the standard libraries)?
  2. What arguments were passed to build to macOS?
  3. Can you tell us about the experience of cross-compiling CMake + Clang + ld64.lld?

For example, we can build HelloWorld with std::cout.