X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=original%2Fman8%2Fld.so.8;h=0f2945e866dc760694e24cf8b74df20f5f94dde7;hb=110dba020f489b75aff2497105f7970c05e2b87c;hp=5c022044e4895acc1c98a9138ccb1ac5b50297b3;hpb=8c1fdd9182c4f91a7416672dec58db625462603b;p=linuxjm%2FLDP_man-pages.git diff --git a/original/man8/ld.so.8 b/original/man8/ld.so.8 index 5c022044..0f2945e8 100644 --- a/original/man8/ld.so.8 +++ b/original/man8/ld.so.8 @@ -1,5 +1,8 @@ +.\" %%%LICENSE_START(PUBLIC_DOMAIN) .\" This is in the public domain -.TH LD.SO 8 2012-03-06 "GNU" "Linux Programmer's Manual" +.\" %%%LICENSE_END +.\" +.TH LD.SO 8 2014-01-08 "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) 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,12 +69,14 @@ 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 .B \-z nodeflib linker option, libraries in the default library paths are skipped. +Libraries installed in hardware capability directories (see below) +are preferred to other libraries. .IP o In the default path .IR /lib , @@ -72,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 +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 application executable. 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 @@ -94,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!! @@ -126,10 +157,92 @@ Ignore RPATH and RUNPATH information in object names in LIST. This option is ignored if .B ld.so is set-user-ID or set-group-ID. +.TP .B \-\-audit LIST Use objects named in LIST as auditors. +.SH HARDWARE CAPABILITIES +Some libraries are compiled using hardware-specific instructions which do +not exist on every CPU. +Such libraries should be installed in directories whose names define the +required hardware capabilities, such as +.IR /usr/lib/sse2/ . +The dynamic linker checks these directories against the hardware of the +machine and selects the most suitable version of a given library. +Hardware capability directories can be cascaded to combine CPU features. +The list of supported hardware capability names depends on the CPU. +The following names are currently recognized: +.TP +.B Alpha +ev4, ev5, ev56, ev6, ev67 +.TP +.B MIPS +loongson2e, loongson2f, octeon, octeon2 +.TP +.B PowerPC +4xxmac, altivec, arch_2_05, arch_2_06, booke, cellbe, dfp, efpdouble, efpsingle, +fpu, ic_snoop, mmu, notb, pa6t, power4, power5, power5+, power6x, ppc32, ppc601, +ppc64, smt, spe, ucache, vsx +.TP +.B SPARC +flush, muldiv, stbar, swap, ultra3, v9, v9v, v9v2 +.TP +.B s390 +dfp, eimm, esan3, etf3enh, g5, highgprs, hpage, ldisp, msa, stfle, +z900, z990, z9-109, z10, zarch +.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) @@ -145,14 +258,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) @@ -223,9 +340,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 @@ -325,13 +443,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) @@ -357,7 +471,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* @@ -371,11 +485,22 @@ functionality is available for executables compiled using libc version ELF functionality is available since Linux 1.1.52 and libc5. .SH SEE ALSO .BR ldd (1), +.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.68 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/.