1LDD(1) Linux Programmer's Manual LDD(1)
2
3
4
6 ldd - print shared object dependencies
7
9 ldd [option]... file...
10
12 ldd prints the shared objects (shared libraries) required by each pro‐
13 gram or shared object specified on the command line. An example of its
14 use and output is the following:
15
16 $ ldd /bin/ls
17 linux-vdso.so.1 (0x00007ffcc3563000)
18 libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f87e5459000)
19 libcap.so.2 => /lib64/libcap.so.2 (0x00007f87e5254000)
20 libc.so.6 => /lib64/libc.so.6 (0x00007f87e4e92000)
21 libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f87e4c22000)
22 libdl.so.2 => /lib64/libdl.so.2 (0x00007f87e4a1e000)
23 /lib64/ld-linux-x86-64.so.2 (0x00005574bf12e000)
24 libattr.so.1 => /lib64/libattr.so.1 (0x00007f87e4817000)
25 libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f87e45fa000)
26
27 In the usual case, ldd invokes the standard dynamic linker (see
28 ld.so(8)) with the LD_TRACE_LOADED_OBJECTS environment variable set to
29 1. This causes the dynamic linker to inspect the program's dynamic
30 dependencies, and find (according to the rules described in ld.so(8))
31 and load the objects that satisfy those dependencies. For each depen‐
32 dency, ldd displays the location of the matching object and the (hexa‐
33 decimal) address at which it is loaded. (The linux-vdso and ld-linux
34 shared dependencies are special; see vdso(7) and ld.so(8).)
35
36 Security
37 Be aware that in some circumstances (e.g., where the program specifies
38 an ELF interpreter other than ld-linux.so), some versions of ldd may
39 attempt to obtain the dependency information by attempting to directly
40 execute the program, which may lead to the execution of whatever code
41 is defined in the program's ELF interpreter, and perhaps to execution
42 of the program itself. (In glibc versions before 2.27, the upstream
43 ldd implementation did this for example, although most distributions
44 provided a modified version that did not.)
45
46 Thus, you should never employ ldd on an untrusted executable, since
47 this may result in the execution of arbitrary code. A safer alterna‐
48 tive when dealing with untrusted executables is:
49
50 $ objdump -p /path/to/program | grep NEEDED
51
52 Note, however, that this alternative shows only the direct dependencies
53 of the executable, while ldd shows the entire dependency tree of the
54 executable.
55
57 --version
58 Print the version number of ldd.
59
60 -v, --verbose
61 Print all information, including, for example, symbol versioning
62 information.
63
64 -u, --unused
65 Print unused direct dependencies. (Since glibc 2.3.4.)
66
67 -d, --data-relocs
68 Perform relocations and report any missing objects (ELF only).
69
70 -r, --function-relocs
71 Perform relocations for both data objects and functions, and
72 report any missing objects or functions (ELF only).
73
74 --help Usage information.
75
77 ldd does not work on a.out shared libraries.
78
79 ldd does not work with some extremely old a.out programs which were
80 built before ldd support was added to the compiler releases. If you
81 use ldd on one of these programs, the program will attempt to run with
82 argc = 0 and the results will be unpredictable.
83
85 pldd(1), sprof(1), ld.so(8), ldconfig(8)
86
88 This page is part of release 5.02 of the Linux man-pages project. A
89 description of the project, information about reporting bugs, and the
90 latest version of this page, can be found at
91 https://www.kernel.org/doc/man-pages/.
92
93
94
95 2019-03-06 LDD(1)