Section: Linux Programmer's Manual (8)
Updated: 2009-01-12
Index Return to Main Contents

NAME,* - dynamic linker/loader  


The dynamic linker can be run either indirectly by running some dynamically linked program or library (in which case no command-line options to the dynamic linker can be passed and, in the ELF case, the dynamic linker which is stored in the .interp section of the program is executed) or directly by running:



The programs and* find and load the shared libraries needed by a program, prepare the program to run, and then run it.

Linux binaries require dynamic linking (linking at run time) unless the -static option was given to ld(1) during compilation.

The program handles a.out binaries, a format used long ago;* handles ELF (/lib/ for libc5, /lib/ for glibc2), which everybody has been using for years now. Otherwise both have the same behavior, and use the same support files and programs ldd(1), ldconfig(8) and /etc/

The shared libraries needed by the program are searched for in the following order:

(ELF only) Using the directories specified in the DT_RPATH dynamic section attribute of the binary if present and DT_RUNPATH attribute does not exist. Use of DT_RPATH is deprecated.
Using the environment variable LD_LIBRARY_PATH. Except if the executable is a set-user-ID/set-group-ID binary, in which case it is ignored.
(ELF only) Using the directories specified in the DT_RUNPATH dynamic section attribute of the binary if present.
From the cache file /etc/ which contains a compiled list of candidate libraries previously found in the augmented library path. If, however, the binary was linked with the -z nodeflib linker option, libraries in the default library paths are skipped.
In the default path /lib, and then /usr/lib. If the binary was linked with the -z nodeflib linker option, this step is skipped.

$ORIGIN and rpath understands the string $ORIGIN (or equivalently ${ORIGIN}) in an rpath specification (DT_RPATH or DT_RUNPATH) to mean the directory containing the application executable. Thus, an application located in somedir/app could be compiled with gcc -Wl,-rpath,'$ORIGIN/../lib' so that it finds an associated shared library in somedir/lib no matter where somedir is located in the directory hierarchy. This facilitates the creation of "turn-key" applications that do not need to be installed into special directories, but can instead be unpacked into any directory and still find their own shared libraries.  


List all dependencies and how they are resolved.
Verify that program is dynamically linked and this dynamic linker can handle it.
--library-path PATH
Override LD_LIBRARY_PATH environment variable setting (see below).
--inhibit-rpath LIST
Ignore RPATH and RUNPATH information in object names in LIST. This option is ignored if is set-user-ID or set-group-ID.


There are four important environment variables.
(libc5; glibc since 2.1.1) If set to a non-empty string, causes the dynamic linker to resolve all symbols at program startup instead of deferring function call resolution to the point when they are first referenced. This is useful when using a debugger.
A colon-separated list of directories in which to search for ELF libraries at execution-time. Similar to the PATH environment variable.
A whitespace-separated list of additional, user-specified, ELF shared libraries to be loaded before all others. This can be used to selectively override functions in other shared libraries. For set-user-ID/set-group-ID ELF binaries, only libraries in the standard search directories that are also set-user-ID will be loaded.
(ELF only) If set to a non-empty string, causes the program to list its dynamic library dependencies, as if run by ldd(1), instead of running normally.

Then there are lots of more or less obscure variables, many obsolete or only for internal use.

(libc5) Version of LD_LIBRARY_PATH for a.out binaries only. Old versions of also supported LD_ELF_LIBRARY_PATH.
(libc5) Version of LD_PRELOAD for a.out binaries only. Old versions of also supported LD_ELF_PRELOAD.
(glibc since 2.4) A colon-separated list of user-specified, ELF shared objects to be loaded before all others in a separate linker namespace (i.e., one that does not intrude upon the normal symbol bindings that would occur in the process). These libraries can be used to audit the operation of the dynamic linker. LD_AUDIT is ignored for set-user-ID/set-group-ID binaries.

The dynamic linker will notify the audit libraries at so-called auditing checkpoints---for example, loading a new library, resolving a symbol, or calling a symbol from another shared object---by calling an appropriate function within the audit library. For details, see rtld-audit(7). The auditing interface is largely compatible with that provided on Solaris, as described in its Linker and Libraries Guide, in the chapter Runtime Linker Auditing Interface.

(glibc since 2.1.95) Do not update the GOT (global offset table) and PLT (procedure linkage table) after resolving a symbol.
(glibc since 2.1) Output verbose debugging information about the dynamic linker. If set to all prints all debugging information it has, if set to help prints a help message about which categories can be specified in this environment variable. Since glibc 2.3.4, LD_DEBUG is ignored for set-user-ID/set-group-ID binaries.
(glibc since 2.1) File where LD_DEBUG output should be fed into, default is standard output. LD_DEBUG_OUTPUT is ignored for set-user-ID/set-group-ID binaries.
(glibc since 2.1.91) Allow weak symbols to be overridden (reverting to old glibc behavior). For security reasons, since glibc 2.3.4, LD_DYNAMIC_WEAK is ignored for set-user-ID/set-group-ID binaries.
(glibc since 2.1) Mask for hardware capabilities.
(a.out only)(libc5) Don't ignore the directory in the names of a.out libraries to be loaded. Use of this option is strongly discouraged.
(a.out only)(libc5) Suppress warnings about a.out libraries with incompatible minor version numbers.
(glibc since 2.1) Path where the binary is found (for non-set-user-ID programs). For security reasons, since glibc 2.4, LD_ORIGIN_PATH is ignored for set-user-ID/set-group-ID binaries.
(glibc since 2.4) Set to 0 to disable pointer guarding. Any other value enables pointer guarding, which is also the default. Pointer guarding is a security mechanism whereby some pointers to code stored in writable program memory (return addresses saved by setjmp(3) or function pointers used by various glibc internals) are mangled semi-randomly to make it more difficult for an attacker to hijack the pointers for use in the event of a buffer overrun or stack-smashing attack.
(glibc since 2.1) Shared object to be profiled, specified either as a pathname or a soname. Profiling output is written to the file whose name is: "$LD_PROFILE_OUTPUT/$LD_PROFILE.profile".
(glibc since 2.1) Directory where LD_PROFILE output should be written. If this variable is not defined, or is defined as an empty string, then the default is /var/tmp. LD_PROFILE_OUTPUT is ignored for set-user-ID and set-group-ID programs, which always use /var/profile.
(glibc since 2.1) Show auxiliary array passed up from the kernel. For security reasons, since glibc 2.3.5, LD_SHOW_AUXV is ignored for set-user-ID/set-group-ID binaries.
By default (i.e., if this variable is not defined) executables and prelinked shared objects will honor base addresses of their dependent libraries and (non-prelinked) position-independent executables (PIEs) and other shared objects will not honor them. If LD_USE_LOAD_BIAS is defined wit the value, both executables and PIEs will honor the base addresses. If LD_USE_LOAD_BIAS is defined with the value 0, neither executables nor PIEs will honor the base addresses. This variable is ignored by set-user-ID and set-group-ID programs.
(glibc since 2.1) If set to a non-empty string, output symbol versioning information about the program if querying information about the program (i.e., either LD_TRACE_LOADED_OBJECTS has been set, or --list or --verify options have been given to the dynamic linker).
(ELF only)(glibc since 2.1.3) If set to a non-empty string, warn about unresolved symbols.
(libc5) argv[0] to be used by ldd(1) when none is present.


a.out dynamic linker/loader
ELF dynamic linker/loader
File containing a compiled list of directories in which to search for libraries and an ordered list of candidate libraries.
File containing a whitespace separated list of ELF shared libraries to be loaded before the program.
shared libraries


The functionality is available for executables compiled using libc version 4.4.3 or greater. ELF functionality is available since Linux 1.1.52 and libc5.  


ldd(1), rtld-audit(7), ldconfig(8)  


This page is part of release 3.21 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at



$ORIGIN and rpath



Subscribe to Comments Feed

Upcoming Linux Foundation Courses

  1. LFS101 Introduction to Linux
    01 Jan » 31 Dec - Online Self-Paced
  2. LFS201 Essentials of System Administration
    01 Jan » 31 Dec - Online Self-Paced
  3. LFS201-Esp Fundamentos de Administración de Sistemas Linux
    01 Jan » 31 Aug - Online Self-Paced

View All Upcoming Courses

Become an Individual Member
Check out the Friday Funnies

Sign Up For the Newsletter

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board