xref: /freebsd/sbin/ldconfig/ldconfig.8 (revision a316b26e50bbed7cf655fbba726ab87d8ab7599d)
1.\"
2.\" Copyright (c) 1993 Paul Kranenburg
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\" 3. All advertising materials mentioning features or use of this software
14.\"    must display the following acknowledgement:
15.\"      This product includes software developed by Paul Kranenburg.
16.\" 3. The name of the author may not be used to endorse or promote products
17.\"    derived from this software without specific prior written permission
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29.\"
30.\"	$Id$
31.\"
32.Dd October 3, 1993
33.Dt LDCONFIG 8
34.Os FreeBSD
35.Sh NAME
36.Nm ldconfig
37.Nd configure the shared library cache
38.Sh SYNOPSIS
39.Nm ldconfig
40.Op Fl rsv
41.Op Ar directory Ar ...
42.Sh DESCRIPTION
43.Nm
44is used to prepare a set of
45.Dq hints
46for use by the run-time linker
47.Xr ld.so
48to facilitate quick lookup of shared libraries available in multiple
49directories.  It scans a set of built-in system directories and any
50.Ar directories
51specified on the command line (in the given order) looking for shared
52libraries and stores the results in the file
53.Xr /var/run/ld.so.hints
54to forestall the overhead that would otherwise result from the
55directory search operations
56.Xr ld.so
57would have to perform to load the required shared libraries.
58.Pp
59The shared libraries so found will be automatically available for loading
60if needed by the program being prepared for execution. This obviates the need
61for storing search paths within the executable.
62.Pp
63The
64.Ev LD_LIBRARY_PATH
65environment variable can be used to override the use of
66directories (or the order thereof) from the cache or to specify additional
67directories where shared libraries might be found.
68.Ev LD_LIBRARY_PATH
69is a
70.Sq \:
71separated list of directory paths which are searched by
72.Xr ld.so
73when it needs to load a shared library. It can be viewed as the run-time
74equivalent of the
75.Fl L
76switch of
77.Xr ld.
78.Pp
79.Nm Ldconfig
80is typically run as part of the boot sequence.
81.Pp
82The following options recognized by
83.Nm ldconfig:
84.Bl -tag -width indent
85.It Fl r
86Lists the current contents of
87.Xr ld.so.hints
88on the standard output. The hints file will not be modified.
89.It Fl s
90Do not scan the built-in system directory
91.Pq Dq /usr/lib
92for shared libraries.
93.It Fl v
94Switch on verbose mode.
95.Sh Security
96Special care must be taken when loading shared libraries into the address
97space of
98.Ev set-user-Id
99programs. Whenever such a program is run,
100.Xr ld.so
101will only load shared libraries from the
102.Ev ld.so.hints
103file. In particular, the
104.Ev LD_LIBRARY_PATH
105is not used to search for libraries. Thus, the role of ldconfig is dual. In
106addition to building a set of hints for quick lookup, it also serves to
107specify the trusted collection of directories from which shared objects can
108be safely loaded. It is presumed that the set of directories specified to
109.Nm ldconfig
110are under control of the system's administrator.
111.Xr ld.so
112further assists set-user-Id programs by erasing the
113.Ev LD_LIBRARY_PATH
114from the environment.
115
116.Sh FILES
117.Xr /var/run/ld.so.hints
118.Sh SEE ALSO
119.Xr ld 1 ,
120.Xr link 5
121.Sh HISTORY
122A
123.Nm
124utility first appeared in SunOS 4.0, it appeared in its current form
125in FreeBSD 1.1.
126