]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man1/ldd.1
ldd.1, localedef.1, add_key.2, chroot.2, clone.2, fork.2, futex.2, get_mempolicy...
[thirdparty/man-pages.git] / man1 / ldd.1
CommitLineData
fea681da
MK
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)
6.\" Corrected.
e15805cc 7.\" and Copyright (C) 2012, 2016, Michael Kerrisk <mtk.manpages@gmail.com>
2297bf0e 8.\"
fd0fc519 9.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
558f3367 10.\" Do not restrict distribution.
fea681da 11.\" May be distributed under the GNU General Public License
fd0fc519 12.\" %%%LICENSE_END
4784c377 13.\"
3df541c0 14.TH LDD 1 2016-07-17 "" "Linux Programmer's Manual"
fea681da 15.SH NAME
43151de3 16ldd \- print shared object dependencies
fea681da 17.SH SYNOPSIS
1b369cc6 18.BR ldd " [\fIoption\fP]... \fIfile\fP..."
fea681da
MK
19.SH DESCRIPTION
20.B ldd
30ea59e7 21prints the shared objects (shared libraries) required by each program or
43151de3 22shared object specified on the command line.
98ea8ea3
MK
23An example of its use and output is the following:
24
25.nf
26
27$ \fBldd /bin/ls\fP
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)
37.fi
38
ca93a9ed
MK
39In the usual case,
40.B ldd
41invokes the standard dynamic linker (see
053439c9 42.BR ld.so (8))
ca93a9ed
MK
43with the
44.B LD_TRACE_LOADED_OBJECTS
98ea8ea3
MK
45environment variable set to 1.
46This causes the dynamic linker to inspect the program's dynamic dependencies,
47and find (according to the rules described in
48.BR ld.so (8))
49and load the objects that satisfy those dependencies.
50For each dependency,
51.BR ldd
52displays the location of the matching object
53and the (hexadecimal) address at which it is loaded.
54(The
55.I linux-vdso
56and
57.I ld-linux
58shared dependencies are special; see
59.BR vdso (7)
60and
61.BR ld.so (8).)
62.\"
63.SS Security
7106a194
MK
64Be aware that in some circumstances
65(e.g., where the program specifies an ELF interpreter other than
66.IR ld-linux.so ),
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/
74some versions of
ca93a9ed
MK
75.BR ldd
76may attempt to obtain the dependency information
7106a194
MK
77by attempting to directly execute the program
78(which may lead to the execution of whatever code is defined
79in the program's ELF interpreter,
80and perhaps to execution of the program itself).
ca93a9ed
MK
81.\" Mainline glibc's ldd allows this possibility (the line
82.\" try_trace "$file"
83.\" in glibc 2.15, for example), but many distro versions of
84.\" ldd seem to remove that code path from the script.
85Thus, you should
86.I never
87employ
88.B ldd
89on an untrusted executable,
90since this may result in the execution of arbitrary code.
91A safer alternative when dealing with untrusted executables is:
92
b517a36f 93 $ \fBobjdump \-p /path/to/program | grep NEEDED\fP
fea681da
MK
94.SH OPTIONS
95.TP
9de38bff 96.B \-\-version
fea681da
MK
97Print the version number of
98.BR ldd .
99.TP
ed74a1a1 100.BR \-v ", " \-\-verbose
75b94dc3
MK
101Print all information, including, for example,
102symbol versioning information.
fea681da 103.TP
ed74a1a1 104.BR \-u ", " \-\-unused
46672d0d 105Print unused direct dependencies.
cd38a583 106(Since glibc 2.3.4.)
46672d0d 107.TP
ed74a1a1 108.BR \-d ", " \-\-data\-relocs
fea681da
MK
109Perform relocations and report any missing objects (ELF only).
110.TP
ed74a1a1 111.BR \-r ", " \-\-function\-relocs
fea681da
MK
112Perform relocations for both data objects and functions, and
113report any missing objects or functions (ELF only).
114.TP
115.B \-\-help
116Usage information.
2fb50e2a
MK
117.\" .SH NOTES
118.\" The standard version of
119.\" .B ldd
120.\" comes with glibc2.
121.\" Libc5 came with an older version, still present
122.\" on some systems.
123.\" The long options are not supported by the libc5 version.
124.\" On the other hand, the glibc2 version does not support
125.\" .B \-V
126.\" and only has the equivalent
127.\" .BR \-\-version .
128.\" .LP
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.
132.\" To run it
133.\" on a shared library in the current directory, prefix the name with "./".
fea681da
MK
134.SH BUGS
135.B ldd
136does not work on a.out shared libraries.
137.PP
138.B ldd
139does not work with some extremely old a.out programs which were
140built before
141.B ldd
142support was added to the compiler releases.
143If you use
144.B ldd
145on one of these programs, the program will attempt to run with
aeb9b6a6
MK
146.I argc
147= 0 and the results will be unpredictable.
fea681da
MK
148.\" .SH AUTHOR
149.\" David Engel.
150.\" Roland McGrath and Ulrich Drepper.
151.SH SEE ALSO
450c6969 152.BR pldd (1),
cd22e342 153.BR sprof (1),
fea681da
MK
154.BR ld.so (8),
155.BR ldconfig (8)