ld.so.8: List more places in which dynamic string tokens are expanded

This happens for more than just DT_RPATH/DT_RUNPATH.

Signed-off-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Florian Weimer 2020-07-20 12:00:23 +02:00 committed by Michael Kerrisk
parent 9eff2f495f
commit 8aea307b4f
1 changed files with 37 additions and 5 deletions

View File

@ -97,12 +97,41 @@ and then
If the binary was linked with the If the binary was linked with the
.B \-z nodeflib .B \-z nodeflib
linker option, this step is skipped. linker option, this step is skipped.
.SS Rpath token expansion .SS Dynamic string tokens
.PP .PP
The dynamic linker In several places, the dynamic linker expands dynamic string tokens:
understands certain token strings in an rpath specification .IP o 3
(DT_RPATH or DT_RUNPATH). In the environment variables
Those strings are substituted as follows: .BR LD_LIBRARY_PATH ,
.BR LD_PRELOAD ,
and
.BR LD_AUDIT ,
.IP o 3
inside the values of the dynamic section tags
.BR DT_NEEDED ,
.BR DT_RPATH ,
.BR DT_RUNPATH ,
.BR DT_AUDIT ,
and
.BR DT_DEPAUDIT
of ELF binaries,
.IP o 3
in the arguments to the
.B ld.so
command line options
.BR \-\-audit ,
.BR \-\-library-path ,
and
.B \-\-preload
(see below), and
.IP o 3
in the file name arguments to the
.BR dlopen (3)
and
.BR dlmopen (3)
functions.
.PP
The substituted tokens are as follows.
.TP .TP
.IR $ORIGIN " (or equivalently " ${ORIGIN} ) .IR $ORIGIN " (or equivalently " ${ORIGIN} )
This expands to This expands to
@ -156,6 +185,9 @@ value in the auxiliary vector (see
.\" .\"
.\" ld.so lets names be abbreviated, so $O will work for $ORIGIN; .\" ld.so lets names be abbreviated, so $O will work for $ORIGIN;
.\" Don't do this!! .\" Don't do this!!
.PP
Note that the dynamic string tokens have to be quoted properly when
set from a shell, to prevent their expension as environment variables.
.SH OPTIONS .SH OPTIONS
.TP .TP
.BI \-\-audit " list" .BI \-\-audit " list"