OSDN Git Service

Update README
[linuxjm/LDP_man-pages.git] / original / man8 / ld.so.8
index 70b6faf..3f3e846 100644 (file)
@@ -1,5 +1,8 @@
+.\" %%%LICENSE_START(PUBLIC_DOMAIN)
 .\" This is in the public domain
-.TH LD.SO 8 2012-04-17 "GNU" "Linux Programmer's Manual"
+.\" %%%LICENSE_END
+.\"
+.TH LD.SO 8 2014-12-31 "GNU" "Linux Programmer's Manual"
 .SH NAME
 ld.so, ld-linux.so* \- dynamic linker/loader
 .SH SYNOPSIS
@@ -33,15 +36,23 @@ handles a.out binaries, a format used long ago;
 .B ld-linux.so*
 handles ELF (\fI/lib/ld-linux.so.1\fP for libc5, \fI/lib/ld-linux.so.2\fP
 for glibc2), which everybody has been using for years now.
-Otherwise both have the same behavior, and use the same
+Otherwise, both have the same behavior, and use the same
 support files and programs
 .BR ldd (1),
-.BR ldconfig (8)
+.BR ldconfig (8),
 and
 .IR /etc/ld.so.conf .
 .LP
-The shared libraries needed by the program are searched for
-in the following order:
+When resolving library dependencies,
+the dynamic linker first inspects each dependency
+string to see if it contains a slash (this can occur if
+a library pathname containing slashes was specified at link time).
+If a slash is found, then the dependency string is interpreted as
+a (relative or absolute) pathname,
+and the library is loaded using that pathname.
+.LP
+If a library dependency does not contain a slash,
+then it is searched for in the following order:
 .IP o 3
 (ELF only) Using the directories specified in the
 DT_RPATH dynamic section attribute
@@ -58,7 +69,7 @@ DT_RUNPATH dynamic section attribute
 of the binary if present.
 .IP o
 From the cache file
-.I /etc/ld.so.cache
+.IR /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 the
@@ -74,19 +85,20 @@ and then
 If the binary was linked with the
 .B \-z nodeflib
 linker option, this step is skipped.
-.SS $ORIGIN and rpath
+.SS Rpath token expansion
 .PP
 .B ld.so
-understands the string
-.I $ORIGIN
-(or equivalently
-.IR ${ORIGIN} )
-in an rpath specification (DT_RPATH or DT_RUNPATH) to mean
-the directory containing the application executable.
+understands certain strings in an rpath specification (DT_RPATH or DT_RUNPATH); those strings are substituted as follows
+.TP
+.IR $ORIGIN " (or equivalently " ${ORIGIN} )
+This expands to
+the directory containing the program or shared library.
 Thus, an application located in
 .I somedir/app
 could be compiled with
-.I gcc -Wl,-rpath,\(aq$ORIGIN/../lib\(aq
+
+    gcc \-Wl,\-rpath,\(aq$ORIGIN/../lib\(aq
+
 so that it finds an associated shared library in
 .I somedir/lib
 no matter where
@@ -96,16 +108,33 @@ This facilitates the creation of "turn-key" applications that
 do not need to be installed into special directories,
 but can instead be unpacked into any directory
 and still find their own shared libraries.
-.\" ld.so also understands $LIB, with the same meaning as $ORIGIN/lib,
-.\" it appears.
-.\"
-.\" There is also $PLATFORM.  This is a kind of wildcard
-.\" of directories related at AT_HWCAP.  To get an idea of the
-.\" places that $PLATFORM would match, look at the output of the
-.\" following:
+.TP
+.IR $LIB " (or equivalently " ${LIB} )
+This expands to
+.I lib
+or
+.I lib64
+depending on the architecture
+(e.g., on x86-64, it expands to
+.IR lib64
+and
+on x86-32, it expands to
+.IR lib ).
+.TP
+.IR $PLATFORM " (or equivalently " ${PLATFORM} )
+This expands to a string corresponding to the processor type
+of the host system (e.g., "x86_64").
+On some architectures, the Linux kernel doesn't provide a platform
+string to the dynamic linker.
+The value of this string is taken from the
+.BR AT_PLATFORM
+value in the auxiliary vector (see
+.BR getauxval (3)).
+.\" To get an idea of the places that $PLATFORM would match,
+.\" look at the output of the following:
 .\"
-.\" mkdir /tmp/d
-.\" LD_LIBRARY_PATH=/tmp/d strace -e open /bin/date 2>&1 | grep /tmp/d
+.\"     mkdir /tmp/d
+.\"     LD_LIBRARY_PATH=/tmp/d strace -e open /bin/date 2>&1 | grep /tmp/d
 .\"
 .\" ld.so lets names be abbreviated, so $O will work for $ORIGIN;
 .\" Don't do this!!
@@ -118,6 +147,9 @@ List all dependencies and how they are resolved.
 Verify that program is dynamically linked and this dynamic linker can handle
 it.
 .TP
+.B \-\-inhibit-cache
+Do not use /etc/ld.so.cache.
+.TP
 .B \-\-library\-path PATH
 Use PATH instead of
 .B LD_LIBRARY_PATH
@@ -161,12 +193,59 @@ flush, muldiv, stbar, swap, ultra3, v9, v9v, v9v2
 dfp, eimm, esan3, etf3enh, g5, highgprs, hpage, ldisp, msa, stfle,
 z900, z990, z9-109, z10, zarch
 .TP
-.TP
 .B x86 (32-bit only)
 acpi, apic, clflush, cmov, cx8, dts, fxsr, ht, i386, i486, i586, i686, mca, mmx,
 mtrr, pat, pbe, pge, pn, pse36, sep, ss, sse, sse2, tm
 .SH ENVIRONMENT
-There are four important environment variables.
+Among the more important environment variables are the following:
+.TP
+.B LD_ASSUME_KERNEL
+(glibc since 2.2.3)
+Each shared library can inform the dynamic linker of the minimum kernel ABI
+version that it requires.
+(This requirement is encoded in an ELF note section that is viewable via
+.IR "readelf\ \-n"
+as a section labeled
+.BR NT_GNU_ABI_TAG .)
+At run time,
+the dynamic linker determines the ABI version of the running kernel and
+will reject loading shared libraries that specify minimum ABI versions
+that exceed that ABI version.
+
+.BR LD_ASSUME_KERNEL
+can be used to
+cause the dynamic linker to assume that it is running on a system with
+a different kernel ABI version.
+For example, the following command line causes the
+dynamic linker to assume it is running on Linux 2.2.5 when loading
+the shared libraries required by
+.IR myprog :
+
+.in +4n
+.nf
+$ \fBLD_ASSUME_KERNEL=2.2.5 ./myprog\fP
+.fi
+.in
+
+On systems that provide multiple versions of a shared library
+(in different directories in the search path) that have
+different minimum kernel ABI version requirements,
+.BR LD_ASSUME_KERNEL
+can be used to select the version of the library that is used
+(dependent on the directory search order).
+Historically, the most common use of the
+.BR LD_ASSUME_KERNEL
+feature was to manually select the older
+LinuxThreads POSIX threads implementation on systems that provided both
+LinuxThreads and NPTL
+(which latter was typically the default on such systems);
+see
+.BR pthreads (7).
+.TP
+.B LD_BIND_NOT
+(glibc since 2.2)
+Don't update the Global Offset Table (GOT) and Procedure Linkage Table (PLT)
+when resolving a symbol.
 .TP
 .B LD_BIND_NOW
 (libc5; glibc since 2.1.1)
@@ -182,14 +261,18 @@ ELF libraries at execution-time.
 Similar to the
 .B PATH
 environment variable.
+Ignored in set-user-ID and set-group-ID programs.
 .TP
 .B LD_PRELOAD
-A whitespace-separated list of additional, user-specified, ELF shared
+A list of additional, user-specified, ELF shared
 libraries to be loaded before all others.
+The items of the list can be separated by spaces or colons.
 This can be used to selectively override functions in other shared libraries.
+The libraries are searched for using the rules given under DESCRIPTION.
 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.
+preload pathnames containing slashes are ignored,
+and libraries in the standard search directories are loaded
+only if the set-user-ID permission bit is enabled on the library file.
 .TP
 .B LD_TRACE_LOADED_OBJECTS
 (ELF only)
@@ -260,9 +343,10 @@ is ignored for set-user-ID/set-group-ID binaries.
 .TP
 .B LD_DEBUG_OUTPUT
 (glibc since 2.1)
-File where
+File in which
 .B LD_DEBUG
-output should be fed into, default is standard output.
+output should be written.
+The default is standard error.
 .B LD_DEBUG_OUTPUT
 is ignored for set-user-ID/set-group-ID binaries.
 .TP
@@ -310,9 +394,9 @@ stack-smashing attack.
 .TP
 .B LD_PROFILE
 (glibc since 2.1)
-Shared object to be profiled,
+The name of a (single) shared object to be profiled,
 specified either as a pathname or a soname.
-Profiling output is written to the file whose name is:
+Profiling output is appended to the file whose name is:
 "\fI$LD_PROFILE_OUTPUT\fP/\fI$LD_PROFILE\fP.profile".
 .TP
 .B LD_PROFILE_OUTPUT
@@ -336,8 +420,8 @@ For security reasons, since glibc 2.3.5,
 is ignored for set-user-ID/set-group-ID binaries.
 .\" FIXME
 .\" Document LD_TRACE_PRELINKING (e.g.: LD_TRACE_PRELINKING=libx1.so ./prog)
-.\" Since glibc 2.3
-.\" Also enables DL_DEBUG_PRELINK
+.\"    Available since glibc 2.3
+.\"    Also enables DL_DEBUG_PRELINK
 .TP
 .B LD_USE_LOAD_BIAS
 .\" http://sources.redhat.com/ml/libc-hacker/2003-11/msg00127.html
@@ -350,7 +434,7 @@ and (nonprelinked) position-independent executables (PIEs)
 and other shared objects will not honor them.
 If
 .B LD_USE_LOAD_BIAS
-is defined wit the value, both executables and PIEs
+is defined with the value 1, both executables and PIEs
 will honor the base addresses.
 If
 .B LD_USE_LOAD_BIAS
@@ -362,13 +446,9 @@ This variable is ignored by set-user-ID and set-group-ID programs.
 (glibc since 2.1)
 If set to a nonempty string,
 output symbol versioning information about the
-program if querying information about the program (i.e., either
+program if the
 .B LD_TRACE_LOADED_OBJECTS
-has been set, or
-.B \-\-list
-or
-.B \-\-verify
-options have been given to the dynamic linker).
+environment variable has been set.
 .TP
 .B LD_WARN
 (ELF only)(glibc since 2.1.3)
@@ -394,7 +474,7 @@ File containing a compiled list of directories in which to search for
 libraries and an ordered list of candidate libraries.
 .TP
 .I /etc/ld.so.preload
-File containing a whitespace separated list of ELF shared libraries to
+File containing a whitespace-separated list of ELF shared libraries to
 be loaded before the program.
 .TP
 .B lib*.so*
@@ -407,12 +487,27 @@ 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 ld (1),
 .BR ldd (1),
+.BR pldd (1),
+.BR sprof (1),
+.BR dlopen (3),
+.BR getauxval (3),
 .BR rtld-audit (7),
-.BR ldconfig (8)
+.BR ldconfig (8),
+.BR sln (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.
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.