]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - sbin/ldconfig/ldconfig.8
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.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 November 11, 2005
33 .Dt LDCONFIG 8
34 .Os
35 .Sh NAME
36 .Nm ldconfig
37 .Nd configure the shared library cache
38 .Sh SYNOPSIS
39 .Nm
40 .Op Fl 32
41 .Op Fl aout | Fl elf
42 .Op Fl Rimrsv
43 .Op Fl f Ar hints_file
44 .Op Ar directory | Ar
45 .Sh DESCRIPTION
46 The
47 .Nm
48 utility is used to prepare a set of
49 .Dq hints
50 for use by the dynamic linker
51 to facilitate quick lookup of shared libraries available in multiple
52 directories.
53 It scans a set of built-in system directories and any
54 .Ar directories
55 specified on the command line (in the given order) looking for
56 shared libraries and stores the results in a system file to forestall
57 the overhead that would otherwise result from the directory search
58 operations the dynamic linker would have to perform to load the
59 required shared libraries.
60 .Pp
61 Files named on the command line are expected to contain directories
62 to scan for shared libraries.
63 Each directory's pathname must start on a new
64 line.
65 Blank lines and lines starting with the comment character
66 .Ql \&#
67 are ignored.
68 Filenames must conform to the
69 .Pa lib*.so.[0-9]
70 pattern in order to be added to the hints file.
71 .Pp
72 For security reasons, directories which are world or group-writable or which
73 are not owned by root produce warning messages and are skipped, unless
74 the
75 .Fl i
76 option is present.
77 .Pp
78 The shared libraries which are found will be automatically available for loading
79 if needed by the program being prepared for execution.
80 This obviates the need
81 for storing search paths within the executable.
82 .Pp
83 The
84 .Ev LD_LIBRARY_PATH
85 environment variable can be used to override the use of
86 directories (or the order thereof) from the cache or to specify additional
87 directories where shared libraries might be found.
88 .Ev LD_LIBRARY_PATH
89 is a
90 .Sq \&:
91 separated list of directory paths which are searched by
92 the dynamic linker
93 when it needs to load a shared library.
94 It can be viewed as the run-time
95 equivalent of the
96 .Fl L
97 switch of
98 .Xr ld 1 .
99 .Pp
100 The
101 .Nm
102 utility is typically run as part of the boot sequence.
103 .Pp
104 The following options are recognized by
105 .Nm :
106 .Bl -tag -width indent
107 .It Fl 32
108 Generate the hints for 32-bit ABI shared libraries
109 on 64-bit systems that support running 32-bit binaries.
110 .It Fl aout
111 Generate the hints for a.out format shared libraries.
112 .It Fl elf
113 Generate the hints for ELF format shared libraries.
114 .It Fl R
115 Rescan the previously configured directories.
116 This opens the previous hints
117 file and fetches the directory list from the header.
118 Any additional pathnames
119 on the command line are also processed.
120 This is the default action when no parameters are given.
121 .It Fl f Ar hints_file
122 Read and/or update the specified hints file, instead of the standard file.
123 This option is provided primarily for testing.
124 .It Fl i
125 Run in insecure mode.
126 The security checks will not be performed.
127 .It Fl m
128 Instead of replacing the contents of the hints file
129 with those found in the directories specified,
130 .Dq merge
131 in new entries.
132 Directories recorded in the hints file by previous runs of
133 .Nm
134 are also rescanned for new shared libraries.
135 .It Fl r
136 List the current contents of the hints file
137 on the standard output.
138 The hints file is not modified.
139 The list of
140 directories stored in the hints file is included.
141 .It Fl s
142 Do not scan the built-in system directory
143 .Pq Dq /usr/lib
144 for shared libraries.
145 .It Fl v
146 Switch on verbose mode.
147 .El
148 .Sh SECURITY
149 Special care must be taken when loading shared libraries into the address
150 space of
151 .Ev set-user-Id
152 programs.
153 Whenever such a program is run by any user except the owner of the program,
154 the dynamic linker
155 will only load shared libraries from the hints
156 file.
157 In particular, the
158 .Ev LD_LIBRARY_PATH
159 is not used to search for libraries.
160 Thus, the role of ldconfig is dual.
161 In
162 addition to building a set of hints for quick lookup, it also serves to
163 specify the trusted collection of directories from which shared objects can
164 be safely loaded.
165 .Sh ENVIRONMENT
166 .Bl -tag -width OBJFORMATxxx -compact
167 .It Ev OBJFORMAT
168 Overrides
169 .Pa /etc/objformat
170 (see below) to determine whether
171 .Fl aout
172 or
173 .Fl elf
174 is the default.
175 If set, its value should be either
176 .Ql aout
177 or
178 .Ql elf .
179 .El
180 .Sh FILES
181 .Bl -tag -width /var/run/ld-elf.so.hintsxxx -compact
182 .It Pa /var/run/ld.so.hints
183 Standard hints file for the a.out dynamic linker.
184 .It Pa /var/run/ld-elf.so.hints
185 Standard hints file for the ELF dynamic linker.
186 .It Pa /etc/ld.so.conf
187 Conventional configuration file containing directory names for
188 invocations with
189 .Fl aout .
190 .It Pa /etc/ld-elf.so.conf
191 Conventional configuration file containing directory names for
192 invocations with
193 .Fl elf .
194 .It Pa /var/run/ld-elf32.so.hints
195 .It Pa /var/run/ld32.so.hints
196 Conventional configuration files containing directory names for
197 invocations with
198 .Fl 32 .
199 .It Pa /etc/objformat
200 Determines whether
201 .Fl aout
202 or
203 .Fl elf
204 is the default.
205 If present, it must consist of a single line
206 containing either
207 .Ql OBJFORMAT=aout
208 or
209 .Ql OBJFORMAT=elf .
210 .El
211 .Sh SEE ALSO
212 .Xr ld 1 ,
213 .Xr link 5
214 .Sh HISTORY
215 A
216 .Nm
217 utility first appeared in SunOS 4.0, it appeared in its current form
218 in
219 .Fx 1.1 .
220 .Sh BUGS
221 Some security checks (for example, verifying root ownership of
222 added directories) are not performed when
223 .Fl aout
224 is specified.