ld.so.8: Document use of $ORIGIN, $LIB, and $PLATFORM in environment variables

These strings are meaningful in LD_LIBRARY_PATH and LD_PRELOAD.

Reported-by: Alon Bar-Lev <alon.barlev@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2016-04-21 14:14:31 +02:00
parent 71ffb3ed69
commit 0a8909c474
1 changed files with 50 additions and 0 deletions

View File

@ -162,6 +162,14 @@ Use
instead of instead of
.B LD_LIBRARY_PATH .B LD_LIBRARY_PATH
environment variable setting (see below). environment variable setting (see below).
The names
.IR ORIGIN ,
.IR LIB ,
and
.IR PLATFORM
are interpreted as for the
.BR LD_LIBRARY_PATH
environment variable.
.TP .TP
.BI \-\-inhibit\-rpath " list" .BI \-\-inhibit\-rpath " list"
Ignore RPATH and RUNPATH information in object names in Ignore RPATH and RUNPATH information in object names in
@ -258,6 +266,31 @@ Similar to the
.B PATH .B PATH
environment variable. environment variable.
This variable is ignored in secure-execution mode. This variable is ignored in secure-execution mode.
Within the pathnames specified in
.BR LD_LIBRARY_PATH ,
the dynamic linker expands the strings
.IR $ORIGIN ,
.IR $LIB ,
and
.IR $PLATFORM
(or the versions using curly braces around the names)
as described above in
.IR "Rpath token expansion" .
Thus, for example,
the following would cause a library to be searched for in either the
.I lib
or
.I lib64
subdirectory below the directory containing the program to be executed:
$ \fBLD_LIBRARY_PATH='$ORIGIN/$LIB' prog\fP
(Note the use of single quotes, which prevent expansion of
.I ORIGIN
and
.I LIB
as shell variables!)
.TP .TP
.B LD_PRELOAD .B LD_PRELOAD
A list of additional, user-specified, ELF shared A list of additional, user-specified, ELF shared
@ -269,6 +302,23 @@ In secure-execution mode,
preload pathnames containing slashes are ignored, preload pathnames containing slashes are ignored,
and shared objects in the standard search directories are loaded and shared objects in the standard search directories are loaded
only if the set-user-ID mode bit is enabled on the shared object file. only if the set-user-ID mode bit is enabled on the shared object file.
Within the pathnames specified in
.BR LD_PRELOAD ,
the dynamic linker understands the strings
.IR $ORIGIN ,
.IR $LIB ,
and
.IR $PLATFORM
(or the versions using curly braces around the names)
as described above in
.IR "Rpath token expansion" .
.\" Tested with the following:
.\"
.\" LD_PRELOAD='$LIB/libmod.so' LD_LIBRARY_PATH=. ./prog
.\"
.\" which will reload the libmod.so in 'lib' or 'lib64', using it
.\" in preference to the version in '.'.
.TP .TP
.B LD_TRACE_LOADED_OBJECTS .B LD_TRACE_LOADED_OBJECTS
(ELF only) (ELF only)