161f9ce8dSNate Williams.\" 261f9ce8dSNate Williams.\" Copyright (c) 1993 Paul Kranenburg 361f9ce8dSNate Williams.\" All rights reserved. 4*dab59af3SLi-Wen Hsu.\" Copyright (c) 2021 The FreeBSD Foundation 5a19e14caSKonstantin Belousov.\" 6a19e14caSKonstantin Belousov.\" Portions of this documentation were written by 7a19e14caSKonstantin Belousov.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship 8a19e14caSKonstantin Belousov.\" from the FreeBSD Foundation. 961f9ce8dSNate Williams.\" 1061f9ce8dSNate Williams.\" Redistribution and use in source and binary forms, with or without 1161f9ce8dSNate Williams.\" modification, are permitted provided that the following conditions 1261f9ce8dSNate Williams.\" are met: 1361f9ce8dSNate Williams.\" 1. Redistributions of source code must retain the above copyright 1461f9ce8dSNate Williams.\" notice, this list of conditions and the following disclaimer. 1561f9ce8dSNate Williams.\" 2. Redistributions in binary form must reproduce the above copyright 1661f9ce8dSNate Williams.\" notice, this list of conditions and the following disclaimer in the 1761f9ce8dSNate Williams.\" documentation and/or other materials provided with the distribution. 1861f9ce8dSNate Williams.\" 3. All advertising materials mentioning features or use of this software 1961f9ce8dSNate Williams.\" must display the following acknowledgement: 2061f9ce8dSNate Williams.\" This product includes software developed by Paul Kranenburg. 2161f9ce8dSNate Williams.\" 3. The name of the author may not be used to endorse or promote products 2261f9ce8dSNate Williams.\" derived from this software without specific prior written permission 2361f9ce8dSNate Williams.\" 2461f9ce8dSNate Williams.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2561f9ce8dSNate Williams.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2661f9ce8dSNate Williams.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2761f9ce8dSNate Williams.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2861f9ce8dSNate Williams.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2961f9ce8dSNate Williams.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 3061f9ce8dSNate Williams.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 3161f9ce8dSNate Williams.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3261f9ce8dSNate Williams.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 3361f9ce8dSNate Williams.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3461f9ce8dSNate Williams.\" 3521ffadb6SStefan Eßer.Dd April 20, 2024 36b9ae52e3SPaul Richards.Dt LDCONFIG 8 379fe48c6eSRuslan Ermilov.Os 38b9ae52e3SPaul Richards.Sh NAME 39b9ae52e3SPaul Richards.Nm ldconfig 40a19e14caSKonstantin Belousov.Nd configure the dynamic linker search path for shared libraries 41b9ae52e3SPaul Richards.Sh SYNOPSIS 427c7fb079SRuslan Ermilov.Nm 43cff2cd1dSJohn Baldwin.Op Fl 32 44484de86fSStefan Eßer.Op Fl BRimr 457c6da7dcSJohn Polstra.Op Fl f Ar hints_file 46d0353b83SRuslan Ermilov.Op Ar directory | Ar 47b9ae52e3SPaul Richards.Sh DESCRIPTION 48b9ae52e3SPaul Richards.Nm 49a19e14caSKonstantin Belousovutility is used to configure the set of paths used by the dynamic linker 50a19e14caSKonstantin Belousov.Xr ld-elf.so.1 1 51a19e14caSKonstantin Belousovwhen searching for shared libraries. 52a19e14caSKonstantin BelousovThe dynamic linker looks for libraries in a set of built-in system directories 53a19e14caSKonstantin Belousovand any directories specified in the hints file. 54a19e14caSKonstantin BelousovThis obviates the need for storing search paths within the executable, 55a19e14caSKonstantin Belousovsee the 56a19e14caSKonstantin Belousov.Fl rpath 57a19e14caSKonstantin Belousovoption for the static linker 58a19e14caSKonstantin Belousov.Xr ld 1 . 59b9ae52e3SPaul Richards.Pp 60a19e14caSKonstantin BelousovThe hints file is maintained by 61a19e14caSKonstantin Belousov.Nm . 62a19e14caSKonstantin BelousovThe 63a19e14caSKonstantin Belousov.Ar directories 64a19e14caSKonstantin Belousovlist to be stored in the hints file is supplied on the command line. 65a19e14caSKonstantin Belousov.Pp 66a19e14caSKonstantin BelousovAlternatively to the 67a19e14caSKonstantin Belousov.Ar directories 68a19e14caSKonstantin Belousovlist on the command line, 69f0c0c1daSEitan Adler.Ar files 70f0c0c1daSEitan Adlermay be specified; these are expected to contain directories 719806e231SRuslan Ermilovto scan for shared libraries. 729806e231SRuslan ErmilovEach directory's pathname must start on a new 739806e231SRuslan Ermilovline. 749806e231SRuslan ErmilovBlank lines and lines starting with the comment character 75571b472bSJordan K. Hubbard.Ql \&# 76a565ca59SJohn Polstraare ignored. 77571b472bSJordan K. Hubbard.Pp 784c6616fcSJohn PolstraFor security reasons, directories which are world or group-writable or which 79643dcf40SJohn Polstraare not owned by root produce warning messages and are skipped, unless 804c6616fcSJohn Polstrathe 814c6616fcSJohn Polstra.Fl i 824c6616fcSJohn Polstraoption is present. 83fa0c86aaSJohn Polstra.Pp 84b9ae52e3SPaul RichardsThe 85b9ae52e3SPaul Richards.Ev LD_LIBRARY_PATH 86a19e14caSKonstantin Belousovenvironment variable can be used to specify additional 87a19e14caSKonstantin Belousovshared library search directories. 88b9ae52e3SPaul Richards.Ev LD_LIBRARY_PATH 89b9ae52e3SPaul Richardsis a 901252c1bbSRuslan Ermilov.Sq \&: 91b9ae52e3SPaul Richardsseparated list of directory paths which are searched by 92a565ca59SJohn Polstrathe dynamic linker 93ef8f7ac9SSheldon Hearnwhen it needs to load a shared library. 94ef8f7ac9SSheldon HearnIt can be viewed as the run-time 95b9ae52e3SPaul Richardsequivalent of the 96b9ae52e3SPaul Richards.Fl L 97b9ae52e3SPaul Richardsswitch of 98edf0e5b3SMike Pritchard.Xr ld 1 . 99b9ae52e3SPaul Richards.Pp 100cb48fca2SJens SchweikhardtThe following options are recognized by 1017c7fb079SRuslan Ermilov.Nm : 102b9ae52e3SPaul Richards.Bl -tag -width indent 103cff2cd1dSJohn Baldwin.It Fl 32 10416edf4d4SDavid E. O'BrienGenerate the hints for 32-bit ABI shared libraries 10516edf4d4SDavid E. O'Brienon 64-bit systems that support running 32-bit binaries. 106a565ca59SJohn Polstra.It Fl elf 10750a40d09SEd MasteIgnored for backwards compatibility. 108e0dfecadSStefan Eßer.It Fl B 109484de86fSStefan EßerForce writing big-endian binary data to the hints file. 11021ffadb6SStefan EßerThe default is to create hints files in little-endian byte-order on all 1116815606cSStefan Eßerarchitectures. 112e0dfecadSStefan EßerReading of and merging into hints files preserves the endianness of the 113e0dfecadSStefan Eßerexisting hints file. 114d4ba5766SPeter Wemm.It Fl R 115a19e14caSKonstantin BelousovAppends pathnames on the command line to the directory list from 116a19e14caSKonstantin Belousovthe hints file. 117a19e14caSKonstantin Belousov.Pp 118a19e14caSKonstantin BelousovThis is the default action when no options are given. 1197c6da7dcSJohn Polstra.It Fl f Ar hints_file 120a565ca59SJohn PolstraRead and/or update the specified hints file, instead of the standard file. 1217c6da7dcSJohn PolstraThis option is provided primarily for testing. 122643dcf40SJohn Polstra.It Fl i 1239806e231SRuslan ErmilovRun in insecure mode. 1249806e231SRuslan ErmilovThe security checks will not be performed. 125f606c848SSatoshi Asami.It Fl m 126a19e14caSKonstantin BelousovInstead of replacing the list of the directories to search with the 127a19e14caSKonstantin Belousovdirectories specified on the command line, merge existing list 128a19e14caSKonstantin Belousovwith the specified directories, and write the result to the hints file. 129b9ae52e3SPaul Richards.It Fl r 130a19e14caSKonstantin BelousovList the current list of the directories from the hints file 131ef8f7ac9SSheldon Hearnon the standard output. 1329806e231SRuslan ErmilovThe hints file is not modified. 133a19e14caSKonstantin Belousov.Pp 134a19e14caSKonstantin BelousovScan and print all libraries found on the directories list. 1351252c1bbSRuslan Ermilov.El 136484de86fSStefan Eßer.Pp 137484de86fSStefan EßerThe historic options 138484de86fSStefan Eßer.Fl elf , 139484de86fSStefan Eßer.Fl s , 140484de86fSStefan Eßerand 141484de86fSStefan Eßer.Fl v 142484de86fSStefan Eßerare accepted but ignored. 14392fd9018SJohn Polstra.Sh SECURITY 144b9ae52e3SPaul RichardsSpecial care must be taken when loading shared libraries into the address 145b9ae52e3SPaul Richardsspace of 146b9ae52e3SPaul Richards.Ev set-user-Id 147ef8f7ac9SSheldon Hearnprograms. 14892fd9018SJohn PolstraWhenever such a program is run by any user except the owner of the program, 149a19e14caSKonstantin Belousovthe dynamic linker will only load shared libraries from paths found in 150a19e14caSKonstantin Belousovthe hints file. 151ef8f7ac9SSheldon HearnIn particular, the 152b9ae52e3SPaul Richards.Ev LD_LIBRARY_PATH 1532ed2dc52SSheldon Hearnis not used to search for libraries. 154a19e14caSKonstantin BelousovThus, 155d85e65cbSEitan Adler.Nm 156a19e14caSKonstantin Belousovserves to specify the trusted collection of directories from which 157a19e14caSKonstantin Belousovshared objects can be safely loaded. 158b9ae52e3SPaul Richards.Sh FILES 159484de86fSStefan Eßer.Bl -tag -width /usr/local/libdata/ldconfig/* -compact 160a565ca59SJohn Polstra.It Pa /var/run/ld-elf.so.hints 161a565ca59SJohn PolstraStandard hints file for the ELF dynamic linker. 16216edf4d4SDavid E. O'Brien.It Pa /var/run/ld-elf32.so.hints 163484de86fSStefan EßerHints file for 32 bit libraries on 64 bit architectures, processed by 164484de86fSStefan Eßerldconfig when invoked with 16516edf4d4SDavid E. O'Brien.Fl 32 . 166484de86fSStefan Eßer.It Pa /etc/ld-elf.so.conf 167484de86fSStefan EßerOptional file with names of directories to be included in the standard 168484de86fSStefan Eßerhints file when booting to multi-user mode. 169484de86fSStefan Eßer.It Pa /usr/local/libdata/ldconfig/* 170484de86fSStefan EßerAdditional files with names of directories provided by optional ports 171484de86fSStefan Eßeror packages. 1721252c1bbSRuslan Ermilov.El 173b9ae52e3SPaul Richards.Sh SEE ALSO 174b9ae52e3SPaul Richards.Xr ld 1 , 175e0dfecadSStefan Eßer.Xr ld-elf.so.1 1 , 176b9ae52e3SPaul Richards.Xr link 5 177b9ae52e3SPaul Richards.Sh HISTORY 178b9ae52e3SPaul RichardsA 179b9ae52e3SPaul Richards.Nm 180b9ae52e3SPaul Richardsutility first appeared in SunOS 4.0, it appeared in its current form 181b5c508fbSRuslan Ermilovin 182b5c508fbSRuslan Ermilov.Fx 1.1 . 183a19e14caSKonstantin Belousov.Pp 184a19e14caSKonstantin BelousovThe name 'hints file' is historic from the times when the file also contained 185a19e14caSKonstantin Belousovhints to the dynamic linker. 186a19e14caSKonstantin BelousovThis functionality is not provided for ELF. 187