Adopting the Parallel DWARF linker in dsymutil
3 days ago
- #debugging
- #dsymutil
- #DWARF
- Apple platforms optimize the compile-link-debug cycle by leaving debug info in object files with a debug map, requiring dsymutil for self-contained bundles.
- dsymutil acts as an optimizing linker using the One Definition Rule to deduplicate types, essential for large C++ projects to stay within Mach-O's 4GB limit.
- The classic dsymutil is single-threaded due to memory constraints, while a parallel linker exists but faces challenges with qualification and determinism.
- A semantic DWARF diffing tool was prototyped to compare outputs from classic and parallel linkers, identifying differences without binary identity.
- Determinism in the parallel linker was achieved by prioritizing compile units based on link order, ensuring reproducible builds.
- To switch the default to the parallel linker, qualification involves passing existing tests, using the LLDB test suite, and manual diffing on large projects.
- Performance improvement: dsymutil on clang takes about 40 seconds with the parallel linker vs. 3 minutes with the classic linker.