xref: /freebsd/usr.bin/ldd/ldd.1 (revision dd41de95a84d979615a2ef11df6850622bf6184e)
1.\" $FreeBSD$
2.\"
3.Dd October 23, 2018
4.Dt LDD 1
5.Os
6.Sh NAME
7.Nm ldd
8.Nd list dynamic object dependencies
9.Sh SYNOPSIS
10.Nm
11.Op Fl a
12.Op Fl v
13.Op Fl f Ar format
14.Ar program ...
15.Sh DESCRIPTION
16The
17.Nm
18utility displays all shared objects that are needed to run the given program or
19to load the given shared object.
20Contrary to
21.Xr nm 1 ,
22the list includes
23.Dq indirect
24dependencies that are the result of needed shared objects which themselves
25depend on yet other shared objects.
26.Pp
27Zero, one or two
28.Fl f
29options may be given.
30The argument is a format string passed to
31.Xr rtld 1
32and allows customization of
33.Nm Ns 's
34output.
35If one is given, it sets
36.Ev LD_TRACE_LOADED_OBJECTS_FMT1 .
37If two are given, they set
38.Ev LD_TRACE_LOADED_OBJECTS_FMT1
39and
40.Ev LD_TRACE_LOADED_OBJECTS_FMT2 ,
41respectively.
42See
43.Xr rtld 1
44for details, including a list of recognized conversion characters.
45.Pp
46The
47.Fl a
48option displays the list of all objects that are needed by each loaded
49object.
50This option does not work with
51.Xr a.out 5
52binaries.
53.Pp
54The
55.Fl v
56option displays a verbose listing of the dynamic linking headers
57encoded in the executable.
58See the source code and include
59files for the definitive meaning of all the fields.
60.Sh IMPLEMENTATION NOTES
61.Nm
62lists the dependencies of an executable by setting
63.Xr rtld 1
64environment variables and running the executable in a child process.
65If the executable is corrupt or invalid,
66.Nm
67may therefore fail without providing any diagnostic error messages.
68.Sh EXAMPLES
69The following is an example of a shell pipeline which uses the
70.Fl f
71option.
72It will print a report of all ELF binaries in the current directory,
73which link against libc.so.6:
74.Dl "find . -type f | xargs -n1 file -F ' ' | grep 'ELF.*dynamically' | cut -f1 -d' ' | xargs ldd -f '%A %o\en' | grep libc.so.6"
75.Sh SEE ALSO
76.Xr ld 1 ,
77.Xr nm 1 ,
78.Xr readelf 1 ,
79.Xr rtld 1
80.Sh HISTORY
81A
82.Nm
83utility first appeared in SunOS 4.0, it appeared in its current form in
84.Fx 1.1 .
85.Pp
86The
87.Fl v
88support is based on code written by
89.An John Polstra Aq Mt jdp@polstra.com
90