]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/ldconfig/ldconfig.8
Make "ldconfig" with no arguments behave the same as "ldconfig -R".
[FreeBSD/FreeBSD.git] / sbin / ldconfig / ldconfig.8
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 .\" $FreeBSD$
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 aout | Fl elf
41 .Op Fl Rmrsv
42 .Op Fl f Ar hints_file
43 .Op Ar directory | file Ar ...
44 .Sh DESCRIPTION
45 .Nm
46 is used to prepare a set of
47 .Dq hints
48 for use by the dynamic linker
49 to facilitate quick lookup of shared libraries available in multiple
50 directories.  It scans a set of built-in system directories and any
51 .Ar directories
52 specified on the command line (in the given order) looking for
53 shared libraries and stores the results in a system file to forestall
54 the overhead that would otherwise result from the directory search
55 operations the dynamic linker would have to perform to load the
56 required shared libraries.
57 .Pp
58 Files named on the command line are expected to contain directories
59 to scan for shared libraries.  Each directory's pathname must start on a new
60 line.  Blank lines and lines starting with the comment character
61 .Ql \&#
62 are ignored.
63 .Pp
64 The shared libraries so found will be automatically available for loading
65 if needed by the program being prepared for execution.
66 This obviates the need
67 for storing search paths within the executable.
68 .Pp
69 The
70 .Ev LD_LIBRARY_PATH
71 environment variable can be used to override the use of
72 directories (or the order thereof) from the cache or to specify additional
73 directories where shared libraries might be found.
74 .Ev LD_LIBRARY_PATH
75 is a
76 .Sq \:
77 separated list of directory paths which are searched by
78 the dynamic linker
79 when it needs to load a shared library.
80 It can be viewed as the run-time
81 equivalent of the
82 .Fl L
83 switch of
84 .Xr ld 1 .
85 .Pp
86 .Nm Ldconfig
87 is typically run as part of the boot sequence.
88 .Pp
89 The following options recognized by
90 .Nm ldconfig:
91 .Bl -tag -width indent
92 .It Fl aout
93 Generate the hints for a.out format shared libraries.
94 .It Fl elf
95 Generate the hints for ELF format shared libraries.
96 .It Fl R
97 Rescan the previously configured directories.  This opens the previous hints
98 file and fetches the directory list from the header.  Any additional pathnames
99 on the command line are also processed.
100 This is the default action when no parameters are given.
101 .It Fl f Ar hints_file
102 Read and/or update the specified hints file, instead of the standard file.
103 This option is provided primarily for testing.
104 .It Fl m
105 Instead of replacing the contents of the hints file
106 with those found in the directories specified,
107 .Dq merge
108 in new entries.
109 Directories recorded in the hints file by previous runs of
110 .Nm
111 are also rescanned for new shared libraries.
112 .It Fl r
113 List the current contents of the hints file
114 on the standard output.
115 The hints file is not modified.  The list of
116 directories stored in the hints file is included.
117 .It Fl s
118 Do not scan the built-in system directory
119 .Pq Dq /usr/lib
120 for shared libraries.
121 .It Fl v
122 Switch on verbose mode.
123 .Sh Security
124 Special care must be taken when loading shared libraries into the address
125 space of
126 .Ev set-user-Id
127 programs.
128 Whenever such a program is run,
129 the dynamic linker
130 will only load shared libraries from the hints
131 file.
132 In particular, the
133 .Ev LD_LIBRARY_PATH
134 is not used to search for libraries.
135 Thus, the role of ldconfig is dual.
136 In
137 addition to building a set of hints for quick lookup, it also serves to
138 specify the trusted collection of directories from which shared objects can
139 be safely loaded.
140 It is presumed that the set of directories specified to
141 .Nm ldconfig
142 are under control of the system's administrator.
143 .Sh ENVIRONMENT
144 .Bl -tag -width OBJFORMATxxx -compact
145 .It Ev OBJFORMAT
146 Overrides
147 .Pa /etc/objformat
148 (see below) to determine whether
149 .Fl aout
150 or
151 .Fl elf
152 is the default.  If set, its value should be either
153 .Ql aout
154 or
155 .Ql elf .
156 .El
157 .Sh FILES
158 .Bl -tag -width /var/run/ld-elf.so.hintsxxx -compact
159 .It Pa /var/run/ld.so.hints
160 Standard hints file for the a.out dynamic linker.
161 .It Pa /var/run/ld-elf.so.hints
162 Standard hints file for the ELF dynamic linker.
163 .It Pa /etc/ld.so.conf
164 Conventional configuration file containing directory names for
165 invocations with
166 .Fl aout .
167 .It Pa /etc/ld-elf.so.conf
168 Conventional configuration file containing directory names for
169 invocations with
170 .Fl elf .
171 .It Pa /etc/objformat
172 Determines whether
173 .Fl aout
174 or
175 .Fl elf
176 is the default.  If present, it must consist of a single line
177 containing either
178 .Ql OBJFORMAT=aout
179 or
180 .Ql OBJFORMAT=elf .
181 .Sh SEE ALSO
182 .Xr ld 1 ,
183 .Xr link 5
184 .Sh HISTORY
185 A
186 .Nm
187 utility first appeared in SunOS 4.0, it appeared in its current form
188 in FreeBSD 1.1.