LLMpediaThe first transparent, open encyclopedia generated by LLMs

Linker (computing)

Generated by GPT-5-mini
Note: This article was automatically generated by a large language model (LLM) from purely parametric knowledge (no retrieval). It may contain inaccuracies or hallucinations. This encyclopedia is part of a research project currently under review.
Article Genealogy
Parent: GNU Binutils Hop 5
Expansion Funnel Raw 108 → Dedup 0 → NER 0 → Enqueued 0
1. Extracted108
2. After dedup0 (None)
3. After NER0 ()
4. Enqueued0 ()
Linker (computing)
NameLinker (computing)

Linker (computing) is a program that combines one or more object files produced by compilers or assemblers into a single executable, library, or load module, resolving symbolic references and assigning final addresses. Linkers operate in toolchains used by projects involving Intel, ARM, IBM, Microsoft Corporation, Apple Inc., Linus Torvalds, Richard Stallman, and organizations such as the Free Software Foundation and GNU Project. They interact with formats like ELF, PE/COFF, Mach-O, and with build systems from Make (software) to CMake, affecting software produced for platforms including Linux, Windows NT, macOS, Android (operating system), iOS, FreeBSD, and NetBSD.

Overview

A linker merges object code and data from multiple modules, resolves external symbols, and performs relocation so that code and data can execute at runtime on architectures such as x86-64, ARMv8-A, RISC-V, PowerPC, and MIPS. Linkers cooperate with compilers like GCC, Clang, MSVC, Intel Parallel Studio, and assemblers such as GNU Assembler to implement calling conventions defined by entities like System V AMD64 ABI and Microsoft x64 calling convention. They also produce shared libraries and static archives consumed by package managers and systems like RPM (file format), Debian, Homebrew (package manager), and Conda (package manager).

History and evolution

Early linkers trace to the era of UNIVAC, ENIAC, and systems from IBM such as the IBM 701, with relocatable link editors evolving in Multics and UNIX. Notable milestones include the development of the ar (Unix) archive format, the a.out format, the introduction of COFF by AT&T Corporation and Microsoft Corporation, and later transition to ELF driven by projects like Sun Microsystems and ULTRIX adopters. The growth of shared libraries and dynamic linking was influenced by NeXTstep, Darwin (operating system), and commercial products from Novell and SGI. Modern open-source linkers such as GNU ld, Gold (linker), LLVM lld, and proprietary linkers inside Microsoft Visual Studio reflect contributions from communities around GNU Project, LLVM Project, and corporations including Red Hat and Google.

Linking process and algorithms

The linking pipeline typically includes symbol resolution, relocation processing, section layout, and symbol table generation. Algorithms address unresolved references using techniques akin to graph reachability studied by Edsger Dijkstra and rely on data structures like hash tables used in systems by Donald Knuth. Optimization phases perform dead code elimination and garbage collection of unused sections inspired by work from John McCarthy and integrated in toolchains used by projects such as Mozilla and Chromium. Linkers implement lazy binding and Procedure Linkage Tables (PLT) and Global Offset Tables (GOT) specified in standards influenced by POSIX and used by runtimes for Perl, Python (programming language), Ruby (programming language), and Node.js. Algorithms for symbol interposition and relocation consider constraints from vendors including Intel Corporation and ARM Holdings and are validated by conformance suites from organizations such as The Open Group.

Types of linkers and linkage

Linkers come in forms: static linkers create monolithic executables as seen in BusyBox or embedded systems produced by ARM Ltd. toolchains; dynamic linkers perform runtime binding exemplified by ld.so on Linux and dyld on macOS; incremental and partial linkers support rapid iteration in environments like Visual Studio and Eclipse (software); and post-link editors manipulate binaries in projects like Binutils and Ghidra. Linkage types include static linkage, dynamic linkage, load-time dynamic linking used by Solaris, and run-time dynamic linking used by Android NDK. Techniques such as symbol versioning and symbol preemption are prevalent in ecosystems managed by Red Hat and enterprise vendors like Oracle Corporation.

Linker scripts and control mechanisms

Linker scripts provide explicit control over segment layout, memory mapping, and section placement, used heavily in embedded projects targeting vendors like STMicroelectronics, Texas Instruments, NXP Semiconductors, and Microchip Technology. Formats and directives differ between implementations like GNU ld scripts, LLVM lld command-line options, and Microsoft LINK.EXE response files used by Windows Driver Kit. Scripts and control files interact with startup code provided by Newlib, musl, or glibc and with debuggers such as GDB and LLDB to map symbols to source-level constructs from compilers like Clang and GCC for toolchains in projects such as Zephyr Project and RTOS vendors.

Performance, optimization, and security considerations

Link-time optimizations (LTO) pioneered by compilers like GCC and LLVM enable interprocedural optimizations across translation units, benefiting large codebases from companies like Google, Facebook, Microsoft, and Apple Inc.. Techniques such as function inlining, identical code folding, and Profile-Guided Optimization (PGO) require cooperation between compilers and linkers in build systems including Bazel and Ninja. Security features implemented at link time include Control Flow Integrity (CFI) enabled by Clang and LLVM, RELRO and stack-smashing protection adopted from ProPolice research, and address space layout randomization (ASLR) supported by Linux kernel and Windows NT. Linkers also play roles in supply-chain protections championed by organizations like SLSA and OpenSSF and in binary hardening utilized by vendors such as Canonical and SUSE.

Category:Software development tools