AI 中文总结
本文提出大规模并行链接器mold,通过解耦符号解析与归档处理等架构约束实现全流程数据并行,在大型C++程序链接中比lld、GNU ld快得多,加速来自所有阶段并行的累积效应。
AI 中文摘要
链接是软件构建流程中的关键步骤,它将已编译的目标文件组合成单个可执行文件或共享库。尽管经过了数十年的工程努力,链接时间仍然是编辑-编译-调试周期中的一个重要瓶颈,尤其是对于大型C++程序而言。现有链接器仅能利用有限的并行性,导致链接过程中大部分CPU核心处于空闲状态。我们提出了mold,这是一个Unix/Linux链接器,它在整个链接流程中系统地应用了数据并行性。我们首先分析了阻碍现有链接器扩展的架构约束,包括纠缠的符号解析和归档处理,然后展示了一种将它们解耦的全新设计如何克服这些限制。在大型真实程序上,mold可在最多几秒内链接多GB的调试二进制文件,通常不到1秒。它比当前最先进的lld链接器快2.4至16.1倍,比传统的GNU ld快达112倍。 ablation研究表明,没有单一优化起主导作用,加速效果来自于对所有阶段进行并行化的累积效应。
英文摘要
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.
Comments15 pages, 3 figures, 10 tables. Accepted to ASPLOS 2027