Glossary
dyld
macOS's dynamic linker and loader. Maps Mach-O binaries into a process's address space, resolves dependencies, runs initializers.
dyld is the program that turns a Mach-O executable into a running process. The kernel loads dyld itself; everything after that — mapping your binary, mapping its dylib dependencies, resolving symbols, running C++ static initializers, finally jumping to main — is dyld's job.
Apple ships it as open source at apple-oss-distributions/dyld. It's one of the more actively-maintained pieces of the Darwin userland.
Modern dyld features that you'll have used without realizing:
- The shared cache. All system
.dylibs are pre-linked into a single huge file (/System/Library/dyld/dyld_shared_cache_*) that's mapped into every process at the same address. Cuts startup time dramatically and saves enormous amounts of physical memory. - Chained fixups. Modern Mach-O binaries pre-compute rebase/bind information as compact chains in the binary itself, removing per-image work at load time.
- Closures. dyld caches launch-time work in a small per-binary blob so subsequent launches skip redundant resolution.