1*11a6dbe7Smartin.\" $NetBSD: ldconfig.8,v 1.15 2008/04/30 13:10:53 martin Exp $ 26f591a0eSpk.\" 30a97faa0Spk.\" Copyright (c) 1998 The NetBSD Foundation, Inc. 46f591a0eSpk.\" All rights reserved. 56f591a0eSpk.\" 60a97faa0Spk.\" This code is derived from software contributed to The NetBSD Foundation 70a97faa0Spk.\" by Paul Kranenburg. 80a97faa0Spk.\" 96f591a0eSpk.\" Redistribution and use in source and binary forms, with or without 106f591a0eSpk.\" modification, are permitted provided that the following conditions 116f591a0eSpk.\" are met: 126f591a0eSpk.\" 1. Redistributions of source code must retain the above copyright 136f591a0eSpk.\" notice, this list of conditions and the following disclaimer. 146f591a0eSpk.\" 2. Redistributions in binary form must reproduce the above copyright 156f591a0eSpk.\" notice, this list of conditions and the following disclaimer in the 166f591a0eSpk.\" documentation and/or other materials provided with the distribution. 176f591a0eSpk.\" 180a97faa0Spk.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 190a97faa0Spk.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 200a97faa0Spk.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 210a97faa0Spk.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 220a97faa0Spk.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 230a97faa0Spk.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 240a97faa0Spk.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 250a97faa0Spk.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 260a97faa0Spk.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 270a97faa0Spk.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 280a97faa0Spk.\" POSSIBILITY OF SUCH DAMAGE. 296f591a0eSpk.\" 3030ee56ecSbjh21.Dd October 8, 2000 31bfca4dbeSpk.Dt LDCONFIG 8 32162b0b64Sbjh21.Os 33bfca4dbeSpk.Sh NAME 34bfca4dbeSpk.Nm ldconfig 3530ee56ecSbjh21.Nd configure the a.out shared library cache 36bfca4dbeSpk.Sh SYNOPSIS 37bfca4dbeSpk.Nm ldconfig 38c46d775bSthorpej.Op Fl cmrsSv 39bfca4dbeSpk.Op Ar directory Ar ... 40bfca4dbeSpk.Sh DESCRIPTION 41bfca4dbeSpk.Nm 42bfca4dbeSpkis used to prepare a set of 43bfca4dbeSpk.Dq hints 4430ee56ecSbjh21for use by the a.out run-time linker 45c46d775bSthorpej.Nm ld.so 46bfca4dbeSpkto facilitate quick lookup of shared libraries available in multiple 4730ee56ecSbjh21directories. 4830ee56ecSbjh21.Nm 4930ee56ecSbjh21is only available on systems that use the 5030ee56ecSbjh21.Dq a.out 5130ee56ecSbjh21format for executables and libraries \(en on ELF systems, all the work 5230ee56ecSbjh21is done by 5330ee56ecSbjh21.Nm ld.elf_so . 5430ee56ecSbjh21.Pp 5530ee56ecSbjh21By default, it scans a set of built-in system directories, 56c46d775bSthorpejdirectories listed in 57c46d775bSthorpej.Pa /etc/ld.so.conf , 58c46d775bSthorpejand any 59bfca4dbeSpk.Ar directories 60bfca4dbeSpkspecified on the command line (in the given order) looking for shared 61bfca4dbeSpklibraries and stores the results in the file 62c46d775bSthorpej.Pa /var/run/ld.so.hints 63d64d286bSpkto forestall the overhead that would otherwise result from the 64bfca4dbeSpkdirectory search operations 65c46d775bSthorpej.Nm ld.so 66c46d775bSthorpejwould have to perform to load required shared libraries. 67bfca4dbeSpk.Pp 68bfca4dbeSpkThe shared libraries so found will be automatically available for loading 692fb4b1dbSwizif needed by the program being prepared for execution. 702fb4b1dbSwizThis obviates the need for storing search paths within the executable. 71bfca4dbeSpk.Pp 72bfca4dbeSpkThe 73bfca4dbeSpk.Ev LD_LIBRARY_PATH 74bfca4dbeSpkenvironment variable can be used to override the use of 75bfca4dbeSpkdirectories (or the order thereof) from the cache or to specify additional 76bfca4dbeSpkdirectories where shared libraries might be found. 77bfca4dbeSpk.Ev LD_LIBRARY_PATH 78bfca4dbeSpkis a 790c8436d4Swiz.Sq \&: 80c46d775bSthorpejseparated list of directory paths that are searched by 81c46d775bSthorpej.Nm ld.so 822fb4b1dbSwizwhen it needs to load a shared library. 832fb4b1dbSwizIt can be viewed as the run-time equivalent of the 84bfca4dbeSpk.Fl L 85bfca4dbeSpkswitch of 86c46d775bSthorpej.Nm ld . 87bfca4dbeSpk.Pp 88c46d775bSthorpej.Nm 89bfca4dbeSpkis typically run as part of the boot sequence. 90bfca4dbeSpk.Pp 91d8f640e1SpkThe following options are recognized by 92bfca4dbeSpk.Nm ldconfig : 93bfca4dbeSpk.Bl -tag -width indent 94c46d775bSthorpej.It Fl c 95c46d775bSthorpejDo not scan directories listed in 96c46d775bSthorpej.Pa /etc/ld.so.conf 97c46d775bSthorpejfor shared libraries. 98d8f640e1Spk.It Fl m 99d8f640e1SpkMerge the result of the scan of the directories given as arguments into 1002fb4b1dbSwizthe existing hints file. 1012fb4b1dbSwizThe default action is to build the hints file afresh. 102bfca4dbeSpk.It Fl r 103bfca4dbeSpkLists the current contents of 104c46d775bSthorpej.Pa ld.so.hints 1052fb4b1dbSwizon the standard output. 1062fb4b1dbSwizThe hints file will not be modified. 107bfca4dbeSpk.It Fl s 108d64d286bSpkDo not scan the built-in system directory 109162b0b64Sbjh21.Pq Pa /usr/lib , 110c46d775bSthorpejnor any directories listed in 111c46d775bSthorpej.Pa /etc/ld.so.conf 112bfca4dbeSpkfor shared libraries. 113c46d775bSthorpej.It Fl S 114c46d775bSthorpejDo not scan the built-in system directory 115162b0b64Sbjh21.Pq Pa /usr/lib , 1162fb4b1dbSwizfor shared libraries. 1172fb4b1dbSwiz(Directories listed in 118c46d775bSthorpej.Pa /etc/ld.so.conf 119c46d775bSthorpejare still scanned.) 120bfca4dbeSpk.It Fl v 121bfca4dbeSpkSwitch on verbose mode. 1229a58d580Smsaitoh.El 1230c8436d4Swiz.Sh FILES 1240c8436d4Swiz.Pa /var/run/ld.so.hints , 1250c8436d4Swiz.Pa /etc/ld.so.conf 1260c8436d4Swiz.Sh SEE ALSO 1270c8436d4Swiz.Xr ld 1 , 1280c8436d4Swiz.Xr ld.so 1 , 1290c8436d4Swiz.Xr ld.so.conf 5 , 1300c8436d4Swiz.Xr link 5 1310c8436d4Swiz.Sh HISTORY 1320c8436d4SwizA 1330c8436d4Swiz.Nm 1340c8436d4Swizutility first appeared in SunOS 4.0, it appeared in its current form 1350c8436d4Swizin 1360c8436d4Swiz.Nx 0.9a . 1370c8436d4Swiz.Sh SECURITY CONSIDERATIONS 138bfca4dbeSpkSpecial care must be taken when loading shared libraries into the address 139bfca4dbeSpkspace of 140162b0b64Sbjh21.Em set-user-ID 1412fb4b1dbSwizprograms. 1422fb4b1dbSwizWhenever such a program is run, 143c46d775bSthorpej.Nm ld.so 144bfca4dbeSpkwill only load shared libraries from the 145c46d775bSthorpej.Pa ld.so.hints 1462fb4b1dbSwizfile. 1472fb4b1dbSwizIn particular, the 148bfca4dbeSpk.Ev LD_LIBRARY_PATH 1499a58d580Smsaitohand 1509a58d580Smsaitoh.Ev LD_PRELOAD 1512fb4b1dbSwizis not used to search for libraries. 1522fb4b1dbSwizThus, the role of ldconfig is dual. 1532fb4b1dbSwizIn addition to building a set of hints for quick lookup, it also serves to 154bfca4dbeSpkspecify the trusted collection of directories from which shared objects can 1552fb4b1dbSwizbe safely loaded. 1562fb4b1dbSwizIt is presumed that the set of directories specified to 157c46d775bSthorpej.Nm 158c46d775bSthorpejis under control of the system's administrator. 159c46d775bSthorpej.Nm ld.so 16010cc9f3bScgdfurther assists set-user-ID programs by erasing the 161bfca4dbeSpk.Ev LD_LIBRARY_PATH 1629a58d580Smsaitohand 1639a58d580Smsaitoh.Ev LD_PRELOAD 164bfca4dbeSpkfrom the environment. 165