man-pages/man8/ld.so.8

253 lines
6.8 KiB
Groff
Raw Normal View History

2004-11-03 13:51:07 +00:00
.\" This is in the public domain
.TH LD.SO 8 2001-12-16 "" "Linux Programmer's Manual"
.SH NAME
ld.so, ld-linux.so* \- dynamic linker/loader
.SH DESCRIPTION
The programs
.B ld.so
and
.B ld-linux.so*
find and load the shared libraries needed by a program, prepare
the program to run, and then run it.
.LP
Linux binaries require dynamic linking (linking at run time)
unless the
.B \-static
option was given to
.B ld
during compilation.
.LP
The program
.B ld.so
handles a.out binaries, a format used long ago;
.B ld-linux.so*
handles ELF (\fB/lib/ld-linux.so.1\fP for libc5, \fB/lib/ld-linux.so.2\fP
for glibc2), which everybody has been using for years now.
Otherwise both have the same behaviour, and use the same
support files and programs
.BR ldd (1),
.BR ldconfig (8)
and
.IR /etc/ld.so.conf .
.LP
The shared libraries needed by the program are searched for
in various places:
.IP o
(ELF only) Using the DT_RPATH dynamic section attribute
of the binary if present and DT_RUNPATH attribute does not exist.
Use of DT_RPATH is deprecated.
.IP o
Using the environment variable
.BR LD_LIBRARY_PATH .
Except if the executable is a set-user-ID/set-group-ID binary,
in which case it is ignored.
2004-11-03 13:51:07 +00:00
.IP o
(ELF only) Using the DT_RUNPATH dynamic section attribute
of the binary if present.
.IP o
From the cache file
.BR /etc/ld.so.cache
which contains a compiled list of candidate libraries previously found
in the augmented library path. If, however, the binary was linked with
2005-07-06 07:41:37 +00:00
.B \-z nodeflib
2004-11-03 13:51:07 +00:00
linker option, libraries in the default library paths are skipped.
.IP o
In the default path
.BR /lib ,
and then
.BR /usr/lib .
If the binary was linked with
2005-07-06 07:41:37 +00:00
.B \-z nodeflib
2004-11-03 13:51:07 +00:00
linker option, this step is skipped.
.SH SYNOPSIS
The dynamic linker can be run either indirectly through running some
dynamically linked program or library (in which case no command line options
to the dynamic linker can be passed and, in the ELF case, the dynamic linker
which is stored in the
.B .interp
section of the program is executed) or directly by running:
.P
.B /lib/ld-linux.so.*
[OPTIONS] [PROGRAM [ARGUMENTS]]
.SH COMMAND LINE OPTIONS
.TP
2005-07-06 07:41:37 +00:00
.B \-\-list
2004-11-03 13:51:07 +00:00
List all dependencies and how they are resolved.
.TP
2005-07-06 07:41:37 +00:00
.B \-\-verify
2004-11-03 13:51:07 +00:00
Verify that program is dynamically linked and this dynamic linker can handle
it.
.TP
2005-07-06 07:41:37 +00:00
.B \-\-library\-path PATH
2004-11-03 13:51:07 +00:00
Override
.B LD_LIBRARY_PATH
environment variable setting (see below).
.TP
2005-07-06 07:41:37 +00:00
.B \-\-ignore\-rpath LIST
2004-11-03 13:51:07 +00:00
Ignore RPATH and RUNPATH information in object names in LIST.
This option has been supported by glibc2 for about one hour.
Then it was renamed into:
.TP
2005-07-06 07:41:37 +00:00
.B \-\-inhibit\-rpath LIST
2004-11-03 13:51:07 +00:00
.SH ENVIRONMENT
There are four important environment variables.
.TP
.B LD_LIBRARY_PATH
A colon-separated list of directories in which to search for
ELF libraries at execution-time.
Similar to the
.B PATH
environment variable.
.TP
.B LD_PRELOAD
A whitespace-separated list of additional, user-specified, ELF shared
libraries to be loaded before all others.
This can be used to selectively override functions in other shared libraries.
For set-user-ID/set-group-ID ELF binaries,
only libraries in the standard search
directories that are also set-user-ID will be loaded.
2004-11-03 13:51:07 +00:00
.TP
.B LD_BIND_NOW
(libc5; glibc since 2.1.1)
If set to non-empty string, causes the dynamic linker to resolve all symbols
at program startup instead of deferring function call resolval to the point
when they are first referenced.
This is useful when using a debugger.
.TP
.B LD_TRACE_LOADED_OBJECTS
(ELF only)
If set to non-empty string, causes the program to list its dynamic library
dependencies, as if run by
.BR ldd (1),
instead of running normally.
.LP
Then there are lots of more or less obscure variables,
many obsolete or only for internal use.
.TP
.B LD_WARN
(ELF only)(glibc since 2.1.3)
If set to non-empty string, warn about unresolved symbols.
.TP
.B LD_NOWARN
(a.out only)(libc5)
Suppress warnings about a.out libraries with incompatible minor
version numbers.
.TP
.B LD_BIND_NOT
(glibc since 2.1.95)
Do not update the GOT (global offset table) and PLT (procedure linkage table)
after resolving a symbol.
.TP
.B LD_DEBUG
(glibc since 2.1)
Output verbose debugging information about the dynamic linker.
If set to
.B all
prints all debugging information it has, if set to
.B help
prints a help message about which categories can be specified in this
environment variable.
.TP
.B LD_DEBUG_OUTPUT
(glibc since 2.1)
File where
.B LD_DEBUG
output should be fed into, default is standard output.
LD_DEBUG_OUTPUT is ignored for set-user-ID/set-group-ID binaries.
2004-11-03 13:51:07 +00:00
.TP
.B LD_VERBOSE
(glibc since 2.1)
If set to non-empty string, output symbol versioning information about the
program if querying information about the program (ie. either
.B LD_TRACE_LOADED_OBJECTS
has been set, or
2005-07-06 07:41:37 +00:00
.B \-\-list
2004-11-03 13:51:07 +00:00
or
2005-07-06 07:41:37 +00:00
.B \-\-verify
2004-11-03 13:51:07 +00:00
options have been given to the dynamic linker).
.TP
.B LD_PROFILE
(glibc since 2.1)
Shared object to be profiled.
.TP
.B LD_PROFILE_OUTPUT
(glibc since 2.1)
File where
.B LD_PROFILE
output should be stored, default is standard output.
LD_DEBUG_OUTPUT is ignored for set-user-ID/set-group-ID binaries.
2004-11-03 13:51:07 +00:00
.TP
.B LD_AOUT_LIBRARY_PATH
(libc5)
Version of LD_LIBRARY_PATH for a.out binaries only.
2005-07-06 07:41:37 +00:00
Old versions of ld\-linux.so.1 also supported LD_ELF_LIBRARY_PATH.
2004-11-03 13:51:07 +00:00
.TP
.B LD_AOUT_PRELOAD
(libc5)
Version of LD_PRELOAD for a.out binaries only.
2005-07-06 07:41:37 +00:00
Old versions of ld\-linux.so.1 also supported LD_ELF_PRELOAD.
2004-11-03 13:51:07 +00:00
.TP
.B LD_SHOW_AUXV
(glibc since 2.1)
Show auxiliary array passed up from the kernel.
.TP
.B LD_HWCAP_MASK
(glibc since 2.1)
Mask for hardware capabilities.
.TP
.B LD_ORIGIN_PATH
(glibc since 2.1)
Path where the binary is found (for non-set-user-ID programs).
2004-11-03 13:51:07 +00:00
.TP
.B LD_DYNAMIC_WEAK
(glibc since 2.1.91)
Allow weak symbols to be overridden (reverting to old glibc behaviour).
.TP
.B LD_KEEPDIR
(a.out only)(libc5)
Don't ignore the directory in the names of a.out libraries to be loaded.
Use of this option is strongly discouraged.
.TP
.B LDD_ARGV0
(libc5)
.IR argv [0]
to be used by
.BR ldd (1)
when none is present.
.SH FILES
.PD 0
.TP
.B /lib/ld.so
a.out dynamic linker/loader
.TP
2005-07-06 07:41:37 +00:00
.BR /lib/ld\-linux.so. { 1 , 2 }
2004-11-03 13:51:07 +00:00
ELF dynamic linker/loader
.TP
.B /etc/ld.so.cache
File containing a compiled list of directories in which to search for
libraries and an ordered list of candidate libraries.
.TP
.B /etc/ld.so.preload
File containing a whitespace separated list of ELF shared libraries to
be loaded before the program.
libraries and an ordered list of candidate libraries.
.TP
.B lib*.so*
shared libraries
.PD
.SH NOTES
The
.B ld.so
functionality is available for executables compiled using libc version
4.4.3 or greater.
ELF functionality is available since Linux 1.1.52 and libc5.
.SH SEE ALSO
.BR ldd (1),
.BR ldconfig (8)
.\" .SH AUTHORS
.\" ld.so: David Engel, Eric Youngdale, Peter MacDonald, Hongjiu Lu, Linus
.\" Torvalds, Lars Wirzenius and Mitch D'Souza
.\" ld-linux.so: Roland McGrath, Ulrich Drepper and others.
.\"
.\" In the above, (libc5) stands for David Engel's ld.so/ld-linux.so.