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: src/sbin/ldconfig/ldconfig.8,v 1.19.2.10 2003/05/13 19:25:19 trhodes Exp $ 31.\" $DragonFly: src/sbin/ldconfig/ldconfig.8,v 1.4 2007/05/19 17:32:12 swildner Exp $ 32.\" 33.Dd October 3, 1993 34.Dt LDCONFIG 8 35.Os 36.Sh NAME 37.Nm ldconfig 38.Nd configure the shared library cache 39.Sh SYNOPSIS 40.Nm 41.Op Fl elf 42.Op Fl Rimrs 43.Op Fl f Ar hints_file 44.Op Ar directory | Ar 45.Sh DESCRIPTION 46The 47.Nm 48utility is used to prepare a set of 49.Dq hints 50for use by the dynamic linker 51to facilitate quick lookup of shared libraries available in multiple 52directories. It scans a set of built-in system directories and any 53.Ar directories 54specified on the command line (in the given order) looking for 55shared libraries and stores the results in a system file to forestall 56the overhead that would otherwise result from the directory search 57operations the dynamic linker would have to perform to load the 58required 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. 65Filenames must conform to the 66.Pa lib*.so.[0-9] 67pattern in order to be added to the hints file. 68.Pp 69For security reasons, directories which are world or group-writable or which 70are not owned by root produce warning messages and are skipped, unless 71the 72.Fl i 73option is present. 74.Pp 75The shared libraries which are found will be automatically available for loading 76if needed by the program being prepared for execution. 77This obviates the need 78for storing search paths within the executable. 79.Pp 80The 81.Ev LD_LIBRARY_PATH 82environment variable can be used to override the use of 83directories (or the order thereof) from the cache or to specify additional 84directories where shared libraries might be found. 85.Ev LD_LIBRARY_PATH 86is a 87.Sq \&: 88separated list of directory paths which are searched by 89the dynamic linker 90when it needs to load a shared library. 91It can be viewed as the run-time 92equivalent of the 93.Fl L 94switch of 95.Xr ld 1 . 96.Pp 97The 98.Nm 99utility is typically run as part of the boot sequence. 100.Pp 101The following options are recognized by 102.Nm : 103.Bl -tag -width indent 104.It Fl elf 105Generate the hints for ELF format shared libraries. 106.It Fl R 107Rescan the previously configured directories. This opens the previous hints 108file and fetches the directory list from the header. Any additional pathnames 109on the command line are also processed. 110This is the default action when no parameters are given. 111.It Fl f Ar hints_file 112Read and/or update the specified hints file, instead of the standard file. 113This option is provided primarily for testing. 114.It Fl i 115Run in insecure mode. The security checks will not be performed. 116.It Fl m 117Instead of replacing the contents of the hints file 118with those found in the directories specified, 119.Dq merge 120in new entries. 121Directories recorded in the hints file by previous runs of 122.Nm 123are also rescanned for new shared libraries. 124.It Fl r 125List the current contents of the hints file 126on the standard output. 127The hints file is not modified. The list of 128directories stored in the hints file is included. 129.It Fl s 130Do not scan the built-in system directory 131.Pq Dq /usr/lib 132for shared libraries. 133.El 134.Sh SECURITY 135Special care must be taken when loading shared libraries into the address 136space of 137.Ev set-user-Id 138programs. 139Whenever such a program is run by any user except the owner of the program, 140the dynamic linker 141will only load shared libraries from the hints 142file. 143In particular, the 144.Ev LD_LIBRARY_PATH 145is not used to search for libraries. 146Thus, the role of 147.Nm 148is dual. 149In addition to building a set of hints for quick lookup, it also serves to 150specify the trusted collection of directories from which shared objects can 151be safely loaded. 152.Sh FILES 153.Bl -tag -width /var/run/ld-elf.so.hintsxxx -compact 154.It Pa /var/run/ld-elf.so.hints 155Standard hints file for the ELF dynamic linker. 156.It Pa /etc/ld-elf.so.conf 157Conventional configuration file containing directory names for 158invocations with 159.Fl elf . 160.El 161.Sh SEE ALSO 162.Xr ld 1 , 163.Xr link 5 164.Sh HISTORY 165A 166.Nm 167utility first appeared in SunOS 4.0, it appeared in its current form 168in 169.Fx 1.1 . 170