man-pages/man1/ldd.1.html
2021-03-31 01:06:50 +01:00

257 lines
5.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of LDD</TITLE>
</HEAD><BODY>
<H1>LDD</H1>
Section: Linux Programmer's Manual (1)<BR>Updated: 2019-03-06<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
ldd - print shared object dependencies
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>ldd</B> [<I>option</I>]... <I>file</I>...
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>ldd</B>
prints the shared objects (shared libraries) required by each program or
shared object specified on the command line.
An example of its use and output is the following:
<P>
$ <B>ldd /bin/ls</B>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;linux-vdso.so.1&nbsp;(0x00007ffcc3563000)
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libselinux.so.1&nbsp;=&gt;&nbsp;/lib64/libselinux.so.1&nbsp;(0x00007f87e5459000)
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libcap.so.2&nbsp;=&gt;&nbsp;/lib64/libcap.so.2&nbsp;(0x00007f87e5254000)
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libc.so.6&nbsp;=&gt;&nbsp;/lib64/libc.so.6&nbsp;(0x00007f87e4e92000)
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libpcre.so.1&nbsp;=&gt;&nbsp;/lib64/libpcre.so.1&nbsp;(0x00007f87e4c22000)
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libdl.so.2&nbsp;=&gt;&nbsp;/lib64/libdl.so.2&nbsp;(0x00007f87e4a1e000)
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/lib64/ld-linux-x86-64.so.2&nbsp;(0x00005574bf12e000)
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libattr.so.1&nbsp;=&gt;&nbsp;/lib64/libattr.so.1&nbsp;(0x00007f87e4817000)
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libpthread.so.0&nbsp;=&gt;&nbsp;/lib64/libpthread.so.0&nbsp;(0x00007f87e45fa000)
<P>
In the usual case,
<B>ldd</B>
invokes the standard dynamic linker (see
<B><A HREF="/cgi-bin/man/man2html?8+ld.so">ld.so</A></B>(8))
with the
<B>LD_TRACE_LOADED_OBJECTS</B>
environment variable set to 1.
This causes the dynamic linker to inspect the program's dynamic dependencies,
and find (according to the rules described in
<B><A HREF="/cgi-bin/man/man2html?8+ld.so">ld.so</A></B>(8))
and load the objects that satisfy those dependencies.
For each dependency,
<B>ldd</B>
displays the location of the matching object
and the (hexadecimal) address at which it is loaded.
(The
<I>linux-vdso</I>
and
<I>ld-linux</I>
shared dependencies are special; see
<B><A HREF="/cgi-bin/man/man2html?7+vdso">vdso</A></B>(7)
and
<B><A HREF="/cgi-bin/man/man2html?8+ld.so">ld.so</A></B>(8).)
<A NAME="lbAE">&nbsp;</A>
<H3>Security</H3>
Be aware that in some circumstances
(e.g., where the program specifies an ELF interpreter other than
<I>ld-linux.so</I>),
some versions of
<B>ldd</B>
may attempt to obtain the dependency information
by attempting to directly execute the program,
which may lead to the execution of whatever code is defined
in the program's ELF interpreter,
and perhaps to execution of the program itself.
(In glibc versions before 2.27,
the upstream
<B>ldd</B>
implementation did this for example,
although most distributions provided a modified version that did not.)
<P>
Thus, you should
<I>never</I>
employ
<B>ldd</B>
on an untrusted executable,
since this may result in the execution of arbitrary code.
A safer alternative when dealing with untrusted executables is:
<P>
$ <B>objdump -p /path/to/program | grep NEEDED</B>
<P>
Note, however, that this alternative shows only the direct dependencies
of the executable, while
<B>ldd</B>
shows the entire dependency tree of the executable.
<A NAME="lbAF">&nbsp;</A>
<H2>OPTIONS</H2>
<DL COMPACT>
<DT id="1"><B>--version</B>
<DD>
Print the version number of
<B>ldd</B>.
<DT id="2"><B>-v</B>, <B>--verbose</B>
<DD>
Print all information, including, for example,
symbol versioning information.
<DT id="3"><B>-u</B>, <B>--unused</B>
<DD>
Print unused direct dependencies.
(Since glibc 2.3.4.)
<DT id="4"><B>-d</B>, <B>--data-relocs</B>
<DD>
Perform relocations and report any missing objects (ELF only).
<DT id="5"><B>-r</B>, <B>--function-relocs</B>
<DD>
Perform relocations for both data objects and functions, and
report any missing objects or functions (ELF only).
<DT id="6"><B>--help</B>
<DD>
Usage information.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>BUGS</H2>
<B>ldd</B>
does not work on a.out shared libraries.
<P>
<B>ldd</B>
does not work with some extremely old a.out programs which were
built before
<B>ldd</B>
support was added to the compiler releases.
If you use
<B>ldd</B>
on one of these programs, the program will attempt to run with
<I>argc</I>
= 0 and the results will be unpredictable.
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?1+pldd">pldd</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?1+sprof">sprof</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?8+ld.so">ld.so</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+ldconfig">ldconfig</A></B>(8)
<A NAME="lbAI">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="7"><A HREF="#lbAB">NAME</A><DD>
<DT id="8"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="9"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DL>
<DT id="10"><A HREF="#lbAE">Security</A><DD>
</DL>
<DT id="11"><A HREF="#lbAF">OPTIONS</A><DD>
<DT id="12"><A HREF="#lbAG">BUGS</A><DD>
<DT id="13"><A HREF="#lbAH">SEE ALSO</A><DD>
<DT id="14"><A HREF="#lbAI">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:18 GMT, March 31, 2021
</BODY>
</HTML>