summaryrefslogtreecommitdiffstats
path: root/libexec/rtld-elf/rtld.1
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-07-15 10:53:48 +0000
committerkib <kib@FreeBSD.org>2012-07-15 10:53:48 +0000
commita78a2e3c36e31109393e2a502b2f8f54f3a7f8d0 (patch)
treebbdaeedcb61722e97f659e43f80ef46bc3c33597 /libexec/rtld-elf/rtld.1
parent4d945ad412911425ef9b9dcb54ae11c825cd2bf7 (diff)
downloadFreeBSD-src-a78a2e3c36e31109393e2a502b2f8f54f3a7f8d0.zip
FreeBSD-src-a78a2e3c36e31109393e2a502b2f8f54f3a7f8d0.tar.gz
Import the DragonFly BSD commit 4f0bc915b65fcf5a23214f6d221d65c80be68ad4
by John Marino <draco@marino.st>, with the following (edited) commit message Date: Sat, 24 Mar 2012 06:40:50 +0100 Subject: [PATCH 1/1] rtld: Implement DT_RUNPATH and -z nodefaultlib DT_RUNPATH is incorrectly being considered as an alias of DT_RPATH. The purpose of DT_RUNPATH is to have two different types of rpath: one that can be overridden by the environment variable LD_LIBRARY_PATH and one that can't. With the currently implementation, LD_LIBRARY_PATH will always trump any embedded rpath or runpath tags. Current path search order by rtld: ================================== LD_LIBRARY_PATH DT_RPATH / DT_RUNPATH (always the same) ldconfig hints file (default: /var/run/ld-elf.so.hints) /usr/lib New path search order by rtld: ============================== DT_RPATH of the calling object if no DT_RUNPATH DT_RPATH of the main binary if no DT_RUNPATH and binary isn't calling obj LD_LIBRARY_PATH DT_RUNPATH ldconfig hints file /usr/lib The new path search matches how the linux runtime loader works. The other major added feature is support for linker flag "-z nodefaultlib". When this flag is passed to the linker, rtld will skip all references to the standard library search path ("/usr/lib" in this case but it could handle more color delimited paths) except in DT_RPATH and DT_RUNPATH. New path search order by rtld with -z nodefaultlib flag set: ============================================================ DT_RPATH of the calling object if no DT_RUNPATH DT_RPATH of the main binary if no DT_RUNPATH and binary isn't calling obj LD_LIBRARY_PATH DT_RUNPATH ldconfig hints file (skips all references to /usr/lib) FreeBSD notes: - we fixed some bugs which were submitted to DragonFly and merged there as commit 1ff8a2bd3eb6e5587174c6a983303ea3a79e0002; - we added LD_LIBRARY_PATH_RPATH environment variable to switch to the previous behaviour of considering DT_RPATH a synonym for DT_RUNPATH; - the FreeBSD default search path is /lib:/usr/lib and not /usr/lib. Reviewed by: kan MFC after: 1 month MFC note: flip the ld_library_path_rpath default value for stable/9
Diffstat (limited to 'libexec/rtld-elf/rtld.1')
-rw-r--r--libexec/rtld-elf/rtld.153
1 files changed, 46 insertions, 7 deletions
diff --git a/libexec/rtld-elf/rtld.1 b/libexec/rtld-elf/rtld.1
index f77b150..703a462 100644
--- a/libexec/rtld-elf/rtld.1
+++ b/libexec/rtld-elf/rtld.1
@@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 1, 2009
+.Dd June 28, 2012
.Dt RTLD 1
.Os
.Sh NAME
@@ -86,14 +86,39 @@ dynamic linker.
After the dynamic linker has finished loading,
relocating, and initializing the program and its required shared
objects, it transfers control to the entry point of the program.
+The following search order is used to locate required shared objects:
.Pp
-To locate the required shared objects in the file system,
-.Nm
-may use a
-.Dq hints
-file prepared by the
+.Bl -enum -offset indent -compact
+.It
+.Dv DT_RPATH
+of the referencing object unless that object also contains a
+.Dv DT_RUNPATH
+tag
+.It
+.Dv DT_RPATH
+of the program unless the referencing object contains a
+.Dv DT_RUNPATH
+tag
+.It
+Path indicated by
+.Ev LD_LIBRARY_PATH
+environment variable
+.It
+.Dv DT_RUNPATH
+of the referencing object
+.It
+Hints file produced by the
.Xr ldconfig 8
-utility.
+utility
+.It
+The
+.Pa /lib
+and
+.Pa /usr/lib
+directories, unless the referencing object was linked using the
+.Dq Fl z Ar nodefaultlib
+option
+.El
.Pp
The
.Nm
@@ -143,6 +168,20 @@ This variable is unset for set-user-ID and set-group-ID programs.
A colon separated list of directories, overriding the default search path
for shared libraries.
This variable is unset for set-user-ID and set-group-ID programs.
+.It Ev LD_LIBRARY_PATH_RPATH
+If the variable is specified and has a value starting with
+any of \'y\', \'Y\' or \'1\' symbols, the path specified by
+.Ev LD_LIBRARY_PATH
+variable is allowed to override the path from
+.Dv DT_RPATH
+for binaries which does not contain
+.Dv DT_RUNPATH
+tag.
+For such binaries, when the variable
+.Ev LD_LIBRARY_PATH_RPATH
+is set,
+.Dq Fl z Ar nodefaultlib
+link-time option is ignored as well.
.It Ev LD_PRELOAD
A list of shared libraries, separated by colons and/or white space,
to be linked in before any
OpenPOWER on IntegriCloud