1.\" $NetBSD: ldd.1,v 1.27 2025/02/01 22:19:57 kre Exp $ 2.\" 3.\" Copyright (c) 1998 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Paul Kranenburg. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.Dd February 1, 2025 31.Dt LDD 1 32.Os 33. 34.Sh NAME 35.Nm ldd 36.Nd list dynamic object dependencies 37.Sh SYNOPSIS 38.Nm 39.Op Fl ov 40.Op Fl f Ar format 41.Ar program ... 42. 43.Sh DESCRIPTION 44.Nm 45displays all shared objects that are needed to run the given program. 46Unlike 47.Xr nm 1 , 48the list includes 49.Dq indirect 50dependencies that are the result of needed shared objects which themselves 51depend on yet other shared objects. 52.Pp 53Zero, one or two 54.Fl f 55options may be given. 56The argument is a format string that allows customization of 57.Nm Ap s 58output. 59The first format argument is used for library objects and defaults to 60.Ql \et-l%o.%m => %p\en . 61The second format argument is used for non-library objects and defaults to 62.Ql \et%o => %p\en . 63.Pp 64These arguments are interpreted as format strings a\~la 65.Xr printf 3 66to customize the trace output and allow 67.Nm 68to be operated as a filter more conveniently. 69The following conversions can be used: 70.Bl -tag -width Ds -offset indent 71. 72.It Li %a 73The main program's absolute path, 74constructed either from the exact argument passed to 75.Nm 76if it is an absolute path, 77or having the current working directory prepended to it if not. 78. 79.It Li \&%A \" NB: .%A is a mdoc macro name 80The program name from the argument vector. 81. 82.It Li %o 83The library name. 84. 85.It Li %m 86The library's major version number. 87. 88.It Li %n 89.Em Obsolete 90.Pq a.out . 91The library's minor version number, 92expands to an empty string in 93.Tn ELF . 94. 95.It Li %p 96The full pathname as determined by 97.Nm rtld Ap s 98library search rules. 99. 100.It Li %x 101The library's load address 102.El 103.Pp 104Additionally, 105.Ql \en 106and 107.Ql \et 108are recognized and have their usual meaning. 109.Pp 110The 111.Fl o 112option is a shorthand to set the format for library objects to 113.Ql %a:-l%o.%m => %p\en , 114which makes 115.Nm 116behave analogously to 117.Ic nm Fl o . 118It cannot be combined with 119.Fl f . 120.Pp 121The 122.Fl v 123option turns on verbose mode. 124. 125.Sh EXIT STATUS 126.Ex -std 127. 128.Sh SEE ALSO 129.Xr ld 1 , 130.Xr ld.elf_so 1 , 131.Xr nm 1 , 132.Xr rtld 1 133. 134.Sh HISTORY 135A 136.Nm 137utility first appeared in 138.Tn SunOS 4.0 . 139It appeared in its current form in 140.Nx 0.9a . 141