p By default, it scans a set of built-in system directories, directories listed in
a /etc/ld.so.conf , and any .Ar directories specified on the command line (in the given order) looking for shared libraries and stores the results in the file
a /var/run/ld.so.hints to forestall the overhead that would otherwise result from the directory search operations .Nm ld.so would have to perform to load required shared libraries.
p The shared libraries so found will be automatically available for loading if needed by the program being prepared for execution. This obviates the need for storing search paths within the executable.
p The .Ev LD_LIBRARY_PATH environment variable can be used to override the use of directories (or the order thereof) from the cache or to specify additional directories where shared libraries might be found. .Ev LD_LIBRARY_PATH is a .Sq : separated list of directory paths that are searched by .Nm ld.so when it needs to load a shared library. It can be viewed as the run-time equivalent of the .Fl L switch of .Nm ld .
p .Nm is typically run as part of the boot sequence.
p The following options are recognized by .Nm ldconfig : l -tag -width indent t Fl c Do not scan directories listed in
a /etc/ld.so.conf for shared libraries. t Fl m Merge the result of the scan of the directories given as arguments into the existing hints file. The default action is to build the hints file afresh. t Fl r Lists the current contents of
a ld.so.hints on the standard output. The hints file will not be modified. t Fl s Do not scan the built-in system directory
q Pa /usr/lib , nor any directories listed in
a /etc/ld.so.conf for shared libraries. t Fl S Do not scan the built-in system directory
q Pa /usr/lib , for shared libraries. (Directories listed in
a /etc/ld.so.conf are still scanned.) t Fl v Switch on verbose mode. .El .Sh FILES
a /var/run/ld.so.hints ,
a /etc/ld.so.conf .Sh SEE ALSO .Xr ld 1 , .Xr ld.so 1 , .Xr ld.so.conf 5 , .Xr link 5 .Sh HISTORY A .Nm utility first appeared in SunOS 4.0, it appeared in its current form in .Nx 0.9a . .Sh SECURITY CONSIDERATIONS Special care must be taken when loading shared libraries into the address space of .Em set-user-ID programs. Whenever such a program is run, .Nm ld.so will only load shared libraries from the
a ld.so.hints file. In particular, the .Ev LD_LIBRARY_PATH and .Ev LD_PRELOAD is not used to search for libraries. Thus, the role of ldconfig is dual. In addition to building a set of hints for quick lookup, it also serves to specify the trusted collection of directories from which shared objects can be safely loaded. It is presumed that the set of directories specified to .Nm is under control of the system's administrator. .Nm ld.so further assists set-user-ID programs by erasing the .Ev LD_LIBRARY_PATH and .Ev LD_PRELOAD from the environment.