1 .\" $FreeBSD: src/libexec/rtld-elf/rtld.1,v 1.18.2.7 2002/01/10 17:51:28 ru Exp $
2 .\" $DragonFly: src/libexec/rtld-elf/rtld.1,v 1.6 2008/01/08 00:02:04 corecode Exp $
4 .\" Copyright (c) 1995 Paul Kranenburg
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" 3. All advertising materials mentioning features or use of this software
16 .\" must display the following acknowledgment:
17 .\" This product includes software developed by Paul Kranenburg.
18 .\" 3. The name of the author may not be used to endorse or promote products
19 .\" derived from this software without specific prior written permission
21 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 .Nd run-time link-editor
42 is a self-contained shared object providing run-time
43 support for loading and link-editing shared objects into a process'
45 It is also commonly known as the dynamic linker.
46 It uses the data structures
47 contained within dynamically linked programs to determine which shared
48 libraries are needed and loads them using the
52 After all shared libraries have been successfully loaded,
54 proceeds to resolve external references from both the main program and
56 A mechanism is provided for initialization routines
57 to be called on a per-object basis, giving a shared object an opportunity
58 to perform any extra set-up before execution of the program proper begins.
59 This is useful for C++ libraries that contain static constructors.
62 itself is loaded by the kernel together with any dynamically-linked
63 program that is to be executed.
64 The kernel transfers control to the
66 After the dynamic linker has finished loading,
67 relocating, and initializing the program and its required shared
68 objects, it transfers control to the entry point of the program.
70 To locate the required shared objects in the filesystem,
79 recognizes a number of environment variables that can be used to modify
80 its behaviour as follows:
82 .Bl -tag -width ".Ev LD_LIBRARY_PATH"
83 .It Ev LD_LIBRARY_PATH
84 A colon separated list of directories, overriding the default search path
86 This is ignored for set-user-ID and set-group-ID programs.
88 A list of shared libraries, separated by colons and/or white space,
89 to be linked in before any
90 other shared libraries.
91 If the directory is not specified then
92 the directories specified by
94 will be searched first
95 followed by the set of built-in standard directories.
96 This is ignored for set-user-ID and set-group-ID programs.
98 When set to a nonempty string, causes
100 to relocate all external function calls before starting execution of the
102 Normally, function calls are bound lazily, at the first call
105 increases the start-up time of a program, but it avoids run-time
106 surprises caused by unexpectedly undefined functions.
107 .It Ev LD_TRACE_LOADED_OBJECTS
108 When set to a nonempty string, causes
110 to exit after loading the shared objects and printing a summary which includes
111 the absolute pathnames of all objects, to standard output.
112 .It Ev LD_TRACE_LOADED_OBJECTS_FMT1
113 .It Ev LD_TRACE_LOADED_OBJECTS_FMT2
114 When set, these variables are interpreted as format strings a la
116 to customize the trace output and are used by
121 to be operated as a filter more conveniently.
122 The following conversions can be used:
125 The main program's name
129 The value of the environment variable
130 .Ev LD_TRACE_LOADED_OBJECTS_PROGNAME
134 The library's major version number.
136 The full pathname as determined by
138 library search rules.
140 The library's load address.
147 are recognized and have their usual meaning.
150 If a shared object preloaded by the
152 mechanism contains a public symbol
153 .Dq _rtld_functrace ,
155 will transfer control to this function each time
156 it needs to resolve an unbound function symbol.
157 By returning a non-zero value,
159 can advise the linker to keep tracing the specified
160 combination of caller shared object and called function;
161 returning 0 will prevent
163 to be called for this combination again.
165 When implementing a custom
167 function, be aware of the possibility that
169 might be called for functions called on its behalf,
170 or that multiple threads could enter
176 is specified as follows.
179 .Fn _rtld_functrace "const char *callerso" "const char *calleeso" "const char *calleefun" "void *stack"
180 .Sh DIFFERENCES BETWEEN .1 and .2
181 ABI changes have been made to support TLS allocation and initialization
182 and to give threading libraries a chance to complete initialization of the
183 TCB prior to the calling of the _init() functions for the dynamically loaded
186 .Bl -tag -width indent
187 .It Pa /var/run/ld-elf.so.hints