GNU/Linux |
RedHat 6.2(Zoot) |
|
![]() |
ld.so(8) |
![]() |
ld.so − a.out dynamic linker/loader
ld.so completes the final process of linking all necessary references to sharable objects and unreferenced symbols in an impure executable, (usually a dynamically linked executable), to produce a runnable file.
Unless explicitly specified via the −static option to ld during compilation, all Linux binaries in a.out format will be "incomplete" and require further linking at run time. ld.so’s job is thus to complete the linking process started at compilation.
The necessary dynamically linked libraries (DLL’s) which the executable requires to complete it’s linking process are searched for in the following order
o |
Using the environment variable LD_AOUT_LIBRARY_PATH. Except if the executable is a setuid/setgid binary, in which case it is ignored. | ||
o |
From the cache file /etc/ld.so.cache which contains a compiled list of candidate libraries previously found in the augmented library path. | ||
o |
In the default path /usr/lib, and then /lib. |
The following,
possibly fatal, warnings may be output by ld.so
can’t find library
’libfoo’
If ld.so cannot find the library the executable requires anywhere.
can’t load library ’libfoo’
If the library is corrupt.
incompatible library
’libfoo’
Require major version x and found y
ld.so cannot use the library version found as it is incompatable with the binary attempting to be executed.
using incompatible
library ’libfoo’
Desire minor version >= x and found y
Even though the minor version is incompatable ld.so will attempt to use it. This message is suppressed if the environment variable LD_NOWARN is set.
too many directories in library path
There is a hard coded limit of 32 search directories. The above warning will ensue it this limit is exceeded.
dynamic linker error
in fixup pass 1,2
dynamic linker error in resolve pass
dynamic linker error in reset pass
An attempt to perform necessary fixups and or relocations failed. These are usually fatal and signifies possible binary corruption.
can’t map cache
file ’/etc/ld.so.cache’
cache file ’/etc/ld.so.cache’ is corrupt
cache file ’/etc/ld.so.cache’ has wrong version
cache file ’/etc/ld.so.cache’ is
empty
A problem was encountered with the cache. Execution will continue as if the cache did not exist.
LD_AOUT_LIBRARY_PATH
A colon-separated list of directories in which to search for libraries at execution-time. Similar to the PATH environment variable.
LD_NOWARN
Suppress warnings about libraries with incompatible minor version numbers.
LD_KEEPDIR
Don’t ignore the directory in the names of libraries to be loaded. Use of this option is strongly discouraged.
LD_AOUT_PRELOAD
The name of an additional, user-specified, shared library to be loaded after all others. This can be used to selectively override functions in other shared libraries.
/lib/ld.so |
execution time linker/loader | ||
/etc/ld.so.cache |
File containing a compiled list of directories in which to search for libraries and an ordered list of candidate libraries. | ||
lib*.so.version |
shared libraries | ||
lib*.sa |
exported initialized library data. |
ldd(1), ldconfig(8), ld.so.info.
Currently ld.so has no means of unloading and searching for compatible or newer version of libraries.
ld.so functionality is only available for executables compiled using libc version 4.4.3 or greater.
David Engel, Eric Youngdale, Peter MacDonald, Hongjiu Lu, Linus Torvalds, Lars Wirzenius and Mitch D’Souza (not necessarily in that order).
![]() |
ld.so(8) | ![]() |