3 .\" Copyright (c) 1995 Paul Kranenburg
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. All advertising materials mentioning features or use of this software
15 .\" must display the following acknowledgment:
16 .\" This product includes software developed by Paul Kranenburg.
17 .\" 3. The name of the author may not be used to endorse or promote products
18 .\" derived from this software without specific prior written permission
20 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 .Nd run-time link-editor
40 is a self-contained, position independent program image providing run-time
41 support for loading and link-editing shared objects into a process'
42 address space. It uses the data structures
47 contained within dynamically linked programs to determine which shared
48 libraries are needed and loads them at a convenient virtual address
53 After all shared libraries have been successfully loaded,
55 proceeds to resolve external references from both the main program and
56 all objects loaded. 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 is itself a shared object that is initially loaded by the startup module
66 formats do not provide easy access to the file header from within a running
69 uses the special symbol
71 to determine whether a program is in fact dynamically linked or not. Whenever
74 has relocated this symbol to a location other than 0,
76 assumes the services of
87 \&'s entry point before the program's
89 routine is called. Thus,
91 can complete the link-editing process before the dynamic program calls upon
92 services of any dynamic library.
94 To quickly locate the required shared objects in the filesystem,
100 utility, in which the full path specification of the shared objects can be
101 looked up by hashing on the 3-tuple
103 library-name, major-version-number, minor-version-number
107 recognizes a number of environment variables that can be used to modify
108 its behaviour as follows:
110 .Bl -tag -width "LD_IGNORE_MISSING_OBJECTS"
111 .It Ev LD_LIBRARY_PATH
112 A colon separated list of directories, overriding the default search path
113 for shared libraries.
114 This is ignored for set-user-ID and set-group-ID programs.
116 A colon separated list of shared libraries, to be linked in before any
117 other shared libraries. If the directory is not specified then
118 the directories specified by LD_LIBRARY_PATH will be searched first
119 followed by the set of built-in standard directories.
120 This is ignored for set-user-ID and set-group-ID programs.
122 When set to a nonempty string, causes
124 to relocate all external function calls before starting execution of the
125 program. Normally, function calls are bound lazily, at the first call
128 increases the start-up time of a program, but it avoids run-time
129 surprises caused by unexpectedly undefined functions.
130 .It Ev LD_WARN_NON_PURE_CODE
131 When set to a nonempty string, issue a warning whenever a link-editing
132 operation requires modification of the text segment of some loaded
133 object. This is usually indicative of an incorrectly built library.
134 .It Ev LD_SUPPRESS_WARNINGS
135 When set to a nonempty string, no warning messages of any kind are
136 issued. Normally, a warning is given if satisfactorily versioned
137 library could not be found.
138 .It Ev LD_IGNORE_MISSING_OBJECTS
139 When set to a nonempty string, makes it a nonfatal condition if
140 one or more required shared objects cannot be loaded.
141 Loading and execution proceeds using the objects that are
143 A warning is produced for each missing object, unless the environment
145 .Ev LD_SUPPRESS_WARNINGS
146 is set to a nonempty string.
148 This is ignored for set-user-ID and set-group-ID programs.
150 Missing shared objects can be ignored without errors if all the
151 following conditions hold:
154 They do not supply definitions for any required data symbols.
156 No functions defined by them are called during program execution.
158 The environment variable
160 is unset or is set to the empty string.
162 .It Ev LD_TRACE_LOADED_OBJECTS
163 When set to a nonempty string, causes
165 to exit after loading the shared objects and printing a summary which includes
166 the absolute pathnames of all objects, to standard output.
167 .It Ev LD_TRACE_LOADED_OBJECTS_FMT1
168 .It Ev LD_TRACE_LOADED_OBJECTS_FMT2
169 When set, these variables are interpreted as format strings a la
171 to customize the trace output and are used by
176 to be operated as a filter more conveniently.
177 The following conversions can be used:
178 .Bl -tag -indent "LD_TRACE_LOADED_OBJECTS_FMT1 " -width "xxxx"
180 The main program's name
185 The value of the environment variable
186 .Ev LD_TRACE_LOADED_OBJECTS_PROGNAME
190 The library's major version number.
192 The library's minor version number.
194 The full pathname as determined by
196 library search rules.
198 The library's load address.
205 are recognized and have their usual meaning.
206 .\" .It Ev LD_NO_INTERN_SEARCH
209 .\" does not process any internal search paths that were recorded in the
211 .\" .It Ev LD_NOSTD_PATH
212 .\" When set, do not include a set of built-in standard directory paths for
213 .\" searching. This might be useful when running on a system with a completely
214 .\" non-standard filesystem layout.
225 The shared library model employed first appeared in SunOS 4.0