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