1 .\" Copyright 1995-2000 David Engel (david@ods.com)
2 .\" Copyright 1995 Rickard E. Faith (faith@cs.unc.edu)
3 .\" Copyright 2000 Ben Collins (bcollins@debian.org)
4 .\" Redone for GLibc 2.2
5 .\" Copyright 2000 Jakub Jelinek (jakub@redhat.com)
7 .\" and Copyright (C) 2012, 2016, Michael Kerrisk <mtk.manpages@gmail.com>
9 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
10 .\" Do not restrict distribution.
11 .\" May be distributed under the GNU General Public License
14 .TH LDD 1 2016-07-17 "" "Linux Programmer's Manual"
16 ldd \- print shared object dependencies
18 .BR ldd " [\fIoption\fP]... \fIfile\fP..."
21 prints the shared objects (shared libraries) required by each program or
22 shared object specified on the command line.
23 An example of its use and output is the following:
28 linux-vdso.so.1 (0x00007ffcc3563000)
29 libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f87e5459000)
30 libcap.so.2 => /lib64/libcap.so.2 (0x00007f87e5254000)
31 libc.so.6 => /lib64/libc.so.6 (0x00007f87e4e92000)
32 libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f87e4c22000)
33 libdl.so.2 => /lib64/libdl.so.2 (0x00007f87e4a1e000)
34 /lib64/ld-linux-x86-64.so.2 (0x00005574bf12e000)
35 libattr.so.1 => /lib64/libattr.so.1 (0x00007f87e4817000)
36 libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f87e45fa000)
41 invokes the standard dynamic linker (see
44 .B LD_TRACE_LOADED_OBJECTS
45 environment variable set to 1.
46 This causes the dynamic linker to inspect the program's dynamic dependencies,
47 and find (according to the rules described in
49 and load the objects that satisfy those dependencies.
52 displays the location of the matching object
53 and the (hexadecimal) address at which it is loaded.
58 shared dependencies are special; see
64 Be aware that in some circumstances
65 (e.g., where the program specifies an ELF interpreter other than
67 .\" The circumstances are where the program has an interpreter
68 .\" other than ld-linux.so. In this case, ldd tries to execute the
69 .\" program directly with LD_TRACE_LOADED_OBJECTS=1, with the
70 .\" result that the program interpreter gets control, and can do
71 .\" what it likes, or pass control to the program itself.
72 .\" Much more detail at
73 .\" http://www.catonmat.net/blog/ldd-arbitrary-code-execution/
76 may attempt to obtain the dependency information
77 by attempting to directly execute the program
78 (which may lead to the execution of whatever code is defined
79 in the program's ELF interpreter,
80 and perhaps to execution of the program itself).
81 .\" Mainline glibc's ldd allows this possibility (the line
83 .\" in glibc 2.15, for example), but many distro versions of
84 .\" ldd seem to remove that code path from the script.
89 on an untrusted executable,
90 since this may result in the execution of arbitrary code.
91 A safer alternative when dealing with untrusted executables is:
93 $ \fBobjdump \-p /path/to/program | grep NEEDED\fP
97 Print the version number of
100 .BR \-v ", " \-\-verbose
101 Print all information, including, for example,
102 symbol versioning information.
104 .BR \-u ", " \-\-unused
105 Print unused direct dependencies.
108 .BR \-d ", " \-\-data\-relocs
109 Perform relocations and report any missing objects (ELF only).
111 .BR \-r ", " \-\-function\-relocs
112 Perform relocations for both data objects and functions, and
113 report any missing objects or functions (ELF only).
118 .\" The standard version of
120 .\" comes with glibc2.
121 .\" Libc5 came with an older version, still present
123 .\" The long options are not supported by the libc5 version.
124 .\" On the other hand, the glibc2 version does not support
126 .\" and only has the equivalent
127 .\" .BR \-\-version .
129 .\" The libc5 version of this program will use the name of a library given
130 .\" on the command line as-is when it contains a \(aq/\(aq; otherwise it
131 .\" searches for the library in the standard locations.
133 .\" on a shared library in the current directory, prefix the name with "./".
136 does not work on a.out shared libraries.
139 does not work with some extremely old a.out programs which were
142 support was added to the compiler releases.
145 on one of these programs, the program will attempt to run with
147 = 0 and the results will be unpredictable.
150 .\" Roland McGrath and Ulrich Drepper.