Each
elf(5) object file may contain information in its dynamic (PT_DYNAMIC) section about which shared objects it requires (often referred to as dependencies). These dependencies are specified in the optional DT_NEEDED entry within the dynamic section. Each DT_NEEDED entry refers to a filename string of the shared object that is to be searched for.
The linker will search for libraries in three lists of paths:
1.
A user defined list of paths as specified in LD_LIBRARY_PATH and
ld.so.conf(5).
The use of ld.so.conf should be avoided as the setting of a global search path can present a security risk.
2.
A list of paths specified within a shared object using a DT_RPATH entry in the dynamic section. This is defined at shared object link time.
3.
The list of default paths which is set to /usr/lib.
ld.elf_so will expand the following variables if present in the paths:
$HWCAP
Processor hardware capabilities, for example FPU, MMX, SSE. Currently unimplemented.
$ISALIST
List of instructions sets this processor can execute. Currently unimplemented.
$ORIGIN
The directory of the main object.
Both
${VARIABLE} and
$VARIABLE are recognized.
The filename string can be considered free form, however, it will almost always take the form lib<name>.so.<number>, where name specifies the ‘library' name and number is conceptually the library's major version number.
This name and another of the form lib<name>.so are normally symbolic links to the real shared object which has a filename of the form lib<name>.so.<major>.<minor>[.<teeny>]. This naming convention allows a versioning scheme similar to
a.out(5).