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