.TH "LD.SO" 8 "26 May 2007" .SH NAME ld.so/ld-linux.so \- dynamic linker/loader .SH DESCRIPTION .B ld.so loads the shared libraries needed by a program, prepares the program to run, and then runs it. Unless explicitly specified via the .B \-static option to .B ld during compilation, all Linux programs are incomplete and require further linking at run time. .PP The necessary shared libraries needed by the program are searched for in the following order .IP o Using the environment variable .B LD_LIBRARY_PATH .RB ( LD_AOUT_LIBRARY_PATH for a.out programs). Except if the executable is a setuid/setgid binary, in which case it is ignored. .IP o From the cache file .BR /etc/ld.so.cache which contains a compiled list of candidate libraries previously found in the augmented library path. .IP o In the default path .BR /lib , and then .BR /usr/lib . .SH COMMAND LINE OPTIONS .TP .B \-\-list List all dependencies and how they are resolved. .TP .B \-\-verify Verify that program is dynamically linked and this dynamic linker can handle it. .TP .B \-\-library\-path PATH Override .B LD_LIBRARY_PATH environment variable setting (see below). .TP .B \-\-ignore\-rpath LIST Ignore RPATH and RUNPATH information in object names in LIST. This option has been supported by glibc2 for about one hour. Then it was renamed into: .TP .B \-\-inhibit\-rpath LIST .SH ENVIRONMENT .TP .B LD_LIBRARY_PATH A colon-separated list of directories in which to search for ELF libraries at execution-time. Similar to the .B PATH environment variable. .TP .B LD_PRELOAD 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 setuid/setgid ELF binaries, only libraries in the standard search directories that are also setgid will be loaded. .TP .B LD_TRACE_LOADED_OBJECTS If present, causes the program to list its dynamic library dependencies, as if run by ldd, instead of running normally. .TP .B LD_BIND_NOW If present, causes the dynamic linker to resolve all symbols at program startup instead of when they are first referenced. .TP .B LD_BIND_NOT Do not update the GOT (global offset table) and PLT (procedure linkage table) after resolving a symbol. .TP .B LD_AOUT_LIBRARY_PATH A colon-separated list of directories in which to search for a.out libraries at execution-time. Similar to the .B PATH environment variable. .TP .B LD_AOUT_PRELOAD The name of an additional, user-specified, a.out shared library to be loaded after all others. This can be used to selectively override functions in other shared libraries. .TP .B LD_NOWARN Suppress warnings about a.out libraries with incompatible minor version numbers. .TP .B LD_WARN If set to non-empty string, warn about unresolved symbols. .TP .B LD_KEEPDIR Don't ignore the directory in the names of a.out libraries to be loaded. Use of this option is strongly discouraged. .TP .B LD_DEBUG 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. .TP .B LD_DEBUG_OUTPUT File where LD_DEBUG output should be fed into, default is standard output. LD_DEBUG_OUTPUT is ignored for setuid/setgid binaries. .TP .B LD_VERBOSE If set to non-empty string, output symbol versioning information about the program if querying information about the program (ie. either .B LD_TRACE_LOADED_OBJECTS has been set, or --list or --verify options have been given to the dynamic linker). .TP .B LD_PROFILE Shared object to be profiled. .TP .B LD_PROFILE_OUTPUT File where .B LD_PROFILE output should be stored, default is standard output. LD_PROFILE_OUTPUT is ignored for setuid/setgid binaries. .TP .B LD_ASSUME_KERNEL Every DSO (Dynamic Shared Object, aka shared library) can tell the dynamic linker in glibc which minimum OS ABI version is needed. The information about the minimum OS ABI version is encoded in a ELF note section usually named .note.ABI-tag. This is used to determine which library to load when multiple version of the same library is installed on the system. The .B LD_ASSUME_KERNEL environment variable overrides the kernel version used by the dynamic linker to determine which library to load. .SH RPATH TOKEN EXPANSION The runtime linker provides a number of tokens that can be used in an rpath specification (\fBDT_RPATH\fR or \fBDT_RUNPATH\fR). .TP .B $ORIGIN ld.so understands the string \fB$ORIGIN\fR (or equivalently \fB${ORIGIN}\fR) in an rpath specification 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. .TP .B $PLATFORM The string \fB$PLATFORM\fR (or equivalently \fB${PLATFORM}\fR) in an rpath specifcation expands to the processor type of the current machine. Please note that on some architectures the Linux kernel doesn't provide a platform string to the dynamic linker. .TP .B $LIB The string \fB$LIB\fR (or equivalently \fB${LIB}\fR) in an rpath corresponds to the system libraries directory, which is /lib for the native architecture on FHS compliant GNU/Linux systems. .SH FILES .PD 0 .TP 20 .B /lib/ld.so a.out dynamic linker/loader .TP 20 .B /lib/ld-linux.so.* ELF dynamic linker/loader .TP .B /etc/ld.so.cache File containing a compiled list of directories in which to search for libraries and an ordered list of candidate libraries. .TP .B /etc/ld.so.preload File containing a whitespace separated list of ELF shared libraries to be loaded before the program. libraries and an ordered list of candidate libraries. .TP .B /etc/ld.so.nohwcap When this file is present the dynamic linker will load the non-optimized version of a library, even if the CPU supports the optimized version. .TP .B lib*.so* shared libraries .PD .SH SEE ALSO .BR ldd (1), .BR ldconfig (8). .SH BUGS .LP Currently .B ld.so has no means of unloading and searching for compatible or newer version of libraries. .PP .B ld.so functionality is only available for executables compiled using libc version 4.4.3 or greater. .SH AUTHORS David Engel, Eric Youngdale, Peter MacDonald, Hongjiu Lu, Linus Torvalds, Lars Wirzenius and Mitch D'Souza (not necessarily in that order).