From mise-toolkit
mold vs lld vs system ld โ when to pick each, how to wire them via mise, and the link-time speedup for large C++ projects. Covers Linux-only mold, cross-platform lld, and Apple's ld-prime. Use when link times dominate your build loop.
npx claudepluginhub ray-manaloto/claude-code-marketplace --plugin mise-toolkitThis skill uses the workspace's default tool permissions.
Linking a large C++ binary with GNU ld can take 30+ seconds. Switching to mold or lld drops that to 2-5 seconds with zero code changes. It's the cheapest performance win available.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Checks Next.js compilation errors using a running Turbopack dev server after code edits. Fixes actionable issues before reporting complete. Replaces `next build`.
Guides code writing, review, and refactoring with Karpathy-inspired rules to avoid overcomplication, ensure simplicity, surgical changes, and verifiable success criteria.
Share bugs, ideas, or general feedback.
Linking a large C++ binary with GNU ld can take 30+ seconds. Switching to mold or lld drops that to 2-5 seconds with zero code changes. It's the cheapest performance win available.
| Linker | Platforms | Relative speed | Notes |
|---|---|---|---|
| mold | Linux (x86_64, aarch64) | ๐ Fastest | Written by rui314 (also wrote lld). Linux-only. MIT license. |
| lld | Linux, macOS, Windows (with caveats) | ๐ฅ Very fast | Part of LLVM. Portable. Battle-tested. |
| ld-prime | macOS 14+ | ๐ฅ Very fast | Apple's new linker (default in recent Xcode). No setup needed. |
| gold | Linux (legacy) | ๐ฅ Faster than ld | Deprecated; use mold instead. |
| GNU ld | Everywhere | (baseline) | Fine for small projects; slow for anything >100k LOC. |
Linking dominates your build loop if:
.cc file and wait >5 seconds before the binary is ready.ninja shows "1/1 linking ..." stuck for a noticeable time.If your build loop is <2 seconds, don't bother. Focus on ccache first.
[tools]
mold = "latest" # aqua:rui314/mold
[env]
LDFLAGS = "-fuse-ld=mold"
# Optional: also set for cmake directly
CMAKE_LINKER_TYPE = "MOLD"
For cmake projects specifically, use the linker flag approach:
[env]
CMAKE_EXE_LINKER_FLAGS = "-fuse-ld=mold"
CMAKE_SHARED_LINKER_FLAGS = "-fuse-ld=mold"
CMAKE_MODULE_LINKER_FLAGS = "-fuse-ld=mold"
Or, if you're on a recent cmake (3.29+), use the CMAKE_LINKER_TYPE variable:
[env]
CMAKE_LINKER_TYPE = "MOLD"
Verify mold is actually being used:
mise exec -- ld.mold --version # should print mold version
mise exec -- cmake --build build -v 2>&1 | grep mold # should see -fuse-ld=mold in link commands
[tools]
"aqua:llvm/llvm-project" = "18" # bundles lld
[env]
LDFLAGS = "-fuse-ld=lld"
On macOS, check whether you're on macOS 14+ first. If so, Apple's ld-prime is already the system linker and is as fast as lld โ you don't need to install anything. Just use the default.
ld -v 2>&1 | head -1 # on macOS 14+: "@(#)PROGRAM:ld PROJECT:dyld-..." (ld-prime)
Rule of thumb: if your project is Linux-only, use mold. If you build on both Linux and macOS, use lld on Linux and let macOS use its default.
ld is ld-prime, which is already fast. Don't install a second linker.aqua:llvm/llvm-project and use -fuse-ld=lld.LDFLAGS is ignored. Pass OTHER_LDFLAGS = -fuse-ld=lld via xcconfig or scheme env instead.Before/after:
# before: measure a clean link
time ninja -C build clean
time ninja -C build
# add LDFLAGS to mise.toml, mise install, reconfigure
rm -rf build
mise run configure
time ninja -C build clean
time ninja -C build
For a 1M-LOC C++ project, link time typically drops from 30s to 3s.
LDFLAGS=-fuse-ld=mold without installing mold. The build fails with "unknown linker". Always pin the tool first.mise-cpp-toolchain-overview โ where the linker fits.mise-cpp-cmake-ninja-ccache โ the other layers of the golden trio.github.com/rui314/mold.lld.llvm.org.