aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2016-04-21 14:14:31 +0200
committerMichael Kerrisk <mtk.manpages@gmail.com>2016-04-21 14:19:34 +0200
commit0a8909c47492a617a769dfeed7f72d96dacf927c (patch)
treebb0889f994e504255fa7c05f1aa6a9b20beb0a1e
parent71ffb3ed69b13e356a3c68d54dca9b9de614c73e (diff)
downloadman-pages-0a8909c47492a617a769dfeed7f72d96dacf927c.tar.gz
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>
-rw-r--r--man8/ld.so.850
1 files changed, 50 insertions, 0 deletions
diff --git a/man8/ld.so.8 b/man8/ld.so.8
index b33f417d66..e6f173c552 100644
--- a/man8/ld.so.8
+++ b/man8/ld.so.8
@@ -162,6 +162,14 @@ Use
instead of
.B LD_LIBRARY_PATH
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
.BI \-\-inhibit\-rpath " list"
Ignore RPATH and RUNPATH information in object names in
@@ -258,6 +266,31 @@ Similar to the
.B PATH
environment variable.
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
.B LD_PRELOAD
A list of additional, user-specified, ELF shared
@@ -269,6 +302,23 @@ In secure-execution mode,
preload pathnames containing slashes are ignored,
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.
+
+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
.B LD_TRACE_LOADED_OBJECTS
(ELF only)