]> git.ipfire.org Git - thirdparty/man-pages.git/blame_incremental - man1/ldd.1
ldd.1: Add more detail on the output of ldd
[thirdparty/man-pages.git] / man1 / ldd.1
... / ...
CommitLineData
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.
7.\" Most of this was copied from the README file.
8.\"
9.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
10.\" Do not restrict distribution.
11.\" May be distributed under the GNU General Public License
12.\" %%%LICENSE_END
13.\"
14.TH LDD 1 2015-08-08 "" "Linux Programmer's Manual"
15.SH NAME
16ldd \- print shared object dependencies
17.SH SYNOPSIS
18.BR ldd " [\fIoption\fP]... \fIfile\fP..."
19.SH DESCRIPTION
20.B ldd
21prints the shared objects (shared libraries) required by each program or
22shared object specified on the command line.
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
39In the usual case,
40.B ldd
41invokes the standard dynamic linker (see
42.BR ld.so (8))
43with the
44.B LD_TRACE_LOADED_OBJECTS
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
64Be aware that in some circumstances, some versions of
65.BR ldd
66may attempt to obtain the dependency information
67by directly executing the program.
68.\" Mainline glibc's ldd allows this possibility (the line
69.\" try_trace "$file"
70.\" in glibc 2.15, for example), but many distro versions of
71.\" ldd seem to remove that code path from the script.
72Thus, you should
73.I never
74employ
75.B ldd
76on an untrusted executable,
77since this may result in the execution of arbitrary code.
78A safer alternative when dealing with untrusted executables is:
79
80 $ objdump \-p /path/to/program | grep NEEDED
81.SH OPTIONS
82.TP
83.B \-\-version
84Print the version number of
85.BR ldd .
86.TP
87.BR \-v ", " \-\-verbose
88Print all information, including, for example,
89symbol versioning information.
90.TP
91.BR \-u ", " \-\-unused
92Print unused direct dependencies.
93(Since glibc 2.3.4.)
94.TP
95.BR \-d ", " \-\-data\-relocs
96Perform relocations and report any missing objects (ELF only).
97.TP
98.BR \-r ", " \-\-function\-relocs
99Perform relocations for both data objects and functions, and
100report any missing objects or functions (ELF only).
101.TP
102.B \-\-help
103Usage information.
104.\" .SH NOTES
105.\" The standard version of
106.\" .B ldd
107.\" comes with glibc2.
108.\" Libc5 came with an older version, still present
109.\" on some systems.
110.\" The long options are not supported by the libc5 version.
111.\" On the other hand, the glibc2 version does not support
112.\" .B \-V
113.\" and only has the equivalent
114.\" .BR \-\-version .
115.\" .LP
116.\" The libc5 version of this program will use the name of a library given
117.\" on the command line as-is when it contains a \(aq/\(aq; otherwise it
118.\" searches for the library in the standard locations.
119.\" To run it
120.\" on a shared library in the current directory, prefix the name with "./".
121.SH BUGS
122.B ldd
123does not work on a.out shared libraries.
124.PP
125.B ldd
126does not work with some extremely old a.out programs which were
127built before
128.B ldd
129support was added to the compiler releases.
130If you use
131.B ldd
132on one of these programs, the program will attempt to run with
133.I argc
134= 0 and the results will be unpredictable.
135.\" .SH AUTHOR
136.\" David Engel.
137.\" Roland McGrath and Ulrich Drepper.
138.SH SEE ALSO
139.BR pldd (1),
140.BR sprof (1),
141.BR ld.so (8),
142.BR ldconfig (8)