ld.so
Load shared libraries for program execution
SYNOPSIS
ld.so [options] program [arguments]
PARAMETERS
--help
Display help information.
--version
Display the dynamic linker version.
--library-path path
Use 'path' as the library search path, instead of the content of the environment variable LD_LIBRARY_PATH or /etc/ld.so.conf.
--inhibit-cache
Do not use /etc/ld.so.cache.
--verify
Verify the program.
DESCRIPTION
ld.so and ld-linux.so are the dynamic linker/loader used by the system to prepare and execute dynamically linked programs. When a dynamically linked program is executed, the kernel starts ld.so. The dynamic linker then loads the program's required shared libraries (also known as dynamic libraries) into memory, resolves symbol references between the program and the libraries, and finally starts the program.
ld.so uses shared library paths which are configured via /etc/ld.so.conf (or trusted directories) to find appropriate shared libraries. It resolves symbols by walking through all of the dependencies in the correct order. It is a crucial part of Linux application runtime environment.
It handles program relocation, shared library initialization and clean-up. It also supports environment variables like LD_LIBRARY_PATH to override system library locations for testing or development purposes, though security considerations apply to the use of LD_LIBRARY_PATH.
CAVEATS
Using LD_LIBRARY_PATH can introduce security risks if not managed carefully, especially for set-user-ID or set-group-ID programs, where it is often ignored for security reasons. The dynamic linker may not be directly invokable in some distributions; instead, the architecture-specific variant (e.g., ld-linux-x86-64.so.2) should be used. Using glibc wrapper is preferred.
ENVIRONMENT VARIABLES
LD_LIBRARY_PATH: A colon-separated list of directories that the dynamic linker searches for shared libraries before the standard locations.
LD_PRELOAD: A space-separated list of shared libraries to load before any other libraries. Can be used to override functionality of existing libraries.
LD_DEBUG: Enables debugging output from the dynamic linker. A numeric value controls the type of debugging information displayed (e.g., resolutions, relocations, symbols).
LD_BIND_NOW: If set to a non-empty string, causes the dynamic linker to perform all necessary relocations at program startup, instead of lazily as symbols are first referenced.
HISTORY
The dynamic linker has evolved alongside the development of shared libraries in Unix-like systems. Early versions were simpler, providing basic loading and symbol resolution. Over time, security features, performance optimizations, and support for different architectures have been added. ld.so is a fundamental component of the GNU C Library (glibc) and other C libraries, playing a vital role in the modern Linux application ecosystem. Its use significantly reduces program sizes by allowing code to be shared across multiple applications. Modern Linux distributions typically use an arch-specific version, such as ld-linux-x86-64.so.2.
SEE ALSO
ldconfig(8), dlopen(3), dlsym(3)