LLMpediaThe first transparent, open encyclopedia generated by LLMs

ld (GNU linker)

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 Assembler Hop 5
Expansion Funnel Raw 57 → Dedup 0 → NER 0 → Enqueued 0
1. Extracted57
2. After dedup0 (None)
3. After NER0 ()
4. Enqueued0 ()
ld (GNU linker)
Nameld (GNU linker)
DeveloperGNU Project
Released1986
Operating systemUnix-like
LicenseGNU General Public License

ld (GNU linker) ld is the GNU Project's linker, a program that combines object files into executable programs, shared libraries, and other binary formats. It is a core component of the GNU toolchain, used alongside compilers, assemblers, and debuggers in Unix-like environments, and it supports multiple architectures and formats for portability and performance.

Overview

ld performs symbol resolution, relocation processing, and binary layout for executables and libraries. It is commonly invoked by GCC and Clang frontends and integrates with assemblers such as GNU Assembler and debuggers such as GDB; it also interacts with binary utilities including objdump and readelf. The linker supports executable formats like ELF and legacy formats used by DOS tools, and it is distributed by the GNU Project and included in distributions from organizations such as Debian and Red Hat.

History and Development

Development of ld began within the GNU Project during the 1980s as part of a goal to create a free software toolchain alongside projects like GCC and glibc. Early efforts were influenced by linkers on Unix systems developed at AT&T Bell Labs and implementations from vendors such as Sun Microsystems and Digital Equipment Corporation. Over time, contributions came from individuals and organizations including maintainers in the Free Software Foundation community, and work on portability linked ld to efforts involving Linux kernel maintainers and distributions like Ubuntu and Fedora.

Features and Supported Formats

ld implements features for static linking, dynamic linking, and creating shared objects; it supports format standards such as ELF and retains compatibility with legacy formats like a.out for some platforms. Advanced capabilities include symbol versioning, garbage collection of unused sections, linker scripts, and support for link-time optimizations used by GCC and LLVM. Architectures supported span x86-64, ARM, PowerPC, MIPS, and others maintained in collaboration with projects such as Binutils and upstream maintainers from vendors like IBM and ARM Holdings.

Command-line Interface and Options

ld exposes a command-line interface with options for controlling entry points, library search paths, and output formats; common flags include specification of library paths and use of linker scripts. Typical invocation is mediated by compiler drivers such as GCC and Clang, which pass options to ld or to plugin linkers like lld from the LLVM Project. Users rely on options documented in Binutils releases maintained by the GNU Project and tested by distributions including Gentoo and Arch Linux.

Linking Process and Internals

Internally, ld reads object files emitted by assemblers and compilers such as GNU Assembler and GCC, builds symbol tables, performs relocation processing, and emits final binaries consumable by loaders in operating systems like Linux and FreeBSD. The process involves parsing section headers and program headers defined by standards committees and implementers at organizations like the IEEE and contributors from projects such as glibc. ld's support for linker scripts allows precise control of memory layout used in embedded projects associated with vendors like Texas Instruments and STMicroelectronics.

Integration with Toolchains and Build Systems

ld is invoked directly by toolchains including GNU Compiler Collection and indirectly through build systems such as Make (software), CMake, and Meson. Embedded toolchains from companies like ARM and projects such as Yocto Project and Buildroot integrate ld or compatible linkers to produce firmware for platforms supported by vendors like NXP Semiconductors and Espressif Systems. Continuous integration services and package maintainers at organizations such as Debian and OpenBSD exercise ld within automated builds and reproducible build efforts.

Notable Usage and Examples

ld is used to link the Linux kernel modules and userland programs compiled with GCC in distributions like Debian and Fedora, and it is part of the build pipelines for large projects such as GNU Emacs and GCC itself. Example workflows include static linking of utilities in minimalist systems like BusyBox and creation of shared libraries used by glibc and language runtimes for Python and Ruby. Alternative linkers like lld and platform-specific linkers from Microsoft for Windows coexist with ld in cross-compilation scenarios handled by projects such as MinGW and Cygwin.

Category:GNU Binutils Category:Linkers