arXiv:2608.23228cs.OSAug 2026

Manuscript Offprint

arXiv:2608.23228

mold: A Massively Parallel Linker

Rui Ueyama

Abstract

Linking is a critical step in the software build process that combines compiled object files into a single executable or shared library. Despite decades of engineering effort, link times remain a significant bottleneck in the edit-compile-debug cycle, particularly for large C++ programs. Existing linkers exploit limited parallelism, leaving most CPU cores idle during linking. We present mold, a Unix/Linux linker that applies data parallelism systematically across the entire linking pipeline. We first analyze the architectural constraints that prevent existing linkers from scaling, including entangled symbol resolution and archive processing, and then show how a clean-slate design that decouples them overcomes these limitations. On large real-world programs, mold links multi-gigabyte debug binaries in at most a few seconds, and often in under a second. It is 2.4–16.1x faster than the state-of-the-art lld linker, and up to 112x faster than the traditional GNU ld. An ablation study shows that no single optimization dominates; the speedup comes from the cumulative effect of parallelizing all passes.

CCS Concepts: • Software and its engineering → Compilers; • Computing methodologies → Parallel algorithms.

Keywords: linkers, ELF, data parallelism, build systems

1 Introduction

Building large software systems from source code is a multi-stage process that typically involves compiling individual source files into object files and then linking them together into an executable or shared library. Despite extensive research on compilation, the linking step has remained largely neglected. Yet for large programs, linking alone can take tens of seconds, becoming the bottleneck in the edit-compile-debug cycle that developers repeat dozens of times a day. A debug build of TensorFlow, for example, comprises 24 GiB of object files, which the linker combines into a single 9.9 GiB shared library. Linking such a program with the state-of-the-art LLVM lld [35] takes 52 seconds on a 64-core machine, leaving most of its cores idle.

This paper presents mold, a production-quality Unix/Linux linker designed from scratch around a single principle: structure every major pass as a data-parallel loop over homogeneous arrays of elements (symbols, relocations, sections), using concurrent data structures and atomic operations for the few points requiring synchronization. The key architectural decision is to decouple parsing from symbol resolution: mold eagerly parses all input files—including every member of every archive—in parallel, and only then performs symbol resolution as a separate parallel pass using atomic compare-and-swap. This eliminates the entangled processing that forces sequential execution in prior linkers. The same data-parallel structure is applied to every subsequent pass: relocation scanning, section garbage collection, identical code folding, string merging, layout computation, and output generation. By Amdahl's law [1], parallelizing only a subset of passes leaves the serial remainder as a hard ceiling on speedup; mold avoids this by parallelizing all of them.

The contributions of this paper are:

  • We analyze the architectural constraints that prevent existing linkers from exploiting modern multi-core hardware ( §2.3§2.3).

  • We present a linker architecture that decouples traditionally entangled phases and applies data parallelism to every major pass, and describe the concurrent algorithms used for each ( §3§3, §4§4).

  • We provide a comprehensive evaluation on nine large real-world workloads, including an ablation study quantifying each technique’s contribution, a scalability analysis from 1 to 64 threads, and a head-to-head per-pass comparison with lld ( §7§7).

References (11)