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