xref: /freebsd/sbin/ldconfig/ldconfig.8 (revision ce834215a70ff69e7e222827437116eee2f9ac6f)
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: ldconfig.8,v 1.12 1997/02/22 15:46:37 peter Exp $
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 mrsv
41.Op Fl f Ar hints_file
42.Op Ar directory | file Ar ...
43.Sh DESCRIPTION
44.Nm
45is used to prepare a set of
46.Dq hints
47for use by the run-time linker
48.Xr ld.so 1
49to facilitate quick lookup of shared libraries available in multiple
50directories.  It scans a set of built-in system directories and any
51.Ar directories
52specified on the command line (in the given order) looking for shared
53libraries and stores the results in the file
54.Pa /var/run/ld.so.hints
55to forestall the overhead that would otherwise result from the
56directory search operations
57.Xr ld.so 1
58would have to perform to load the required shared libraries.
59.Pp
60Files named on the command line are expected to contain directories
61to scan for shared libraries.  Each directory's pathname must start on a new
62line.  Blank lines and lines starting with the comment character
63.Ql \&#
64are ignored.  A standard name for this file is
65.Xr /etc/ld.so.conf.
66.Pp
67The shared libraries so found will be automatically available for loading
68if needed by the program being prepared for execution. This obviates the need
69for storing search paths within the executable.
70.Pp
71The
72.Ev LD_LIBRARY_PATH
73environment variable can be used to override the use of
74directories (or the order thereof) from the cache or to specify additional
75directories where shared libraries might be found.
76.Ev LD_LIBRARY_PATH
77is a
78.Sq \:
79separated list of directory paths which are searched by
80.Xr ld.so 1
81when it needs to load a shared library. It can be viewed as the run-time
82equivalent of the
83.Fl L
84switch of
85.Xr ld 1 .
86.Pp
87.Nm Ldconfig
88is typically run as part of the boot sequence.
89.Pp
90The following options recognized by
91.Nm ldconfig:
92.Bl -tag -width indent
93.It Fl f Ar hints_file
94Read and/or update the specified hints file, instead of
95.Pa /var/run/ld.so.hints .
96This option is provided primarily for testing.
97.It Fl m
98Instead of replacing the contents of the hints file
99with those found in the directories specified,
100.Dq merge
101in new entries.
102Directories recorded in the hints file by previous runs of
103.Nm
104are also rescanned for new shared libraries.
105.It Fl r
106List the current contents of the hints file
107on the standard output. The hints file is not modified.
108.It Fl s
109Do not scan the built-in system directory
110.Pq Dq /usr/lib
111for shared libraries.
112.It Fl v
113Switch on verbose mode.
114.Sh Security
115Special care must be taken when loading shared libraries into the address
116space of
117.Ev set-user-Id
118programs. Whenever such a program is run,
119.Nm ld.so
120will only load shared libraries from the hints
121file. In particular, the
122.Ev LD_LIBRARY_PATH
123is not used to search for libraries. Thus, the role of ldconfig is dual. In
124addition to building a set of hints for quick lookup, it also serves to
125specify the trusted collection of directories from which shared objects can
126be safely loaded. It is presumed that the set of directories specified to
127.Nm ldconfig
128are under control of the system's administrator.
129.Sh FILES
130.Bl -tag -width /var/run/ld.so.hintsxxx -compact
131.It Pa /var/run/ld.so.hints
132Default
133.Dq hints
134file.
135.It Pa /etc/ld.so.conf
136Standard configuration file.
137.Sh SEE ALSO
138.Xr ld 1 ,
139.Xr link 5
140.Sh HISTORY
141A
142.Nm
143utility first appeared in SunOS 4.0, it appeared in its current form
144in FreeBSD 1.1.
145