| LD.SO(1) | General Commands Manual | LD.SO(1) |
ld.so — run-time
link-editor
ld.so is a self-contained, position
independent program image providing run-time support for loading and
link-editing shared objects into a process's address space. It uses the data
structures (see elf(5)) contained
within dynamically linked programs to determine which shared libraries are
needed and loads them at a convenient virtual address using the
mmap(2) system call.
After all shared libraries have been successfully loaded,
ld.so proceeds to resolve external references from
both the main program and all objects loaded. A mechanism is provided for
initialization routines to be called, on a per-object basis, giving a shared
object an opportunity to perform any extra set-up, before execution of the
program proper begins.
ld.so is itself a shared object that is
initially loaded by the kernel.
To quickly locate the required shared objects in the filesystem,
ld.so may use a “hints” file, prepared
by the ldconfig(8) utility, in
which the full path specification of the shared objects can be looked up by
hashing on the 3-tuple ⟨library-name, major-version-number,
minor-version-number⟩.
ld.so searches for shared objects in the
following lists of paths:
LD_LIBRARY_PATH
environment variable if setDT_RUNPATH
of the calling object if set, otherwise:
(The use of DT_RPATH is deprecated as its behaviour
varies across operating systems.)ld.so recognises a number of environment
variables that can be used to modify its behaviour as follows:
LD_LIBRARY_PATHLD_PRELOADLD_BIND_NOWLD_TRACE_LOADED_OBJECTSld.so to exit after loading the
shared objects and printing a summary which includes the absolute
pathnames of all objects, to standard output.
LD_TRACE_LOADED_OBJECTS_FMT1LD_TRACE_LOADED_OBJECTS_FMT2-f option and allows
ldd(1) to be operated as a filter
more conveniently. LD_TRACE_LOADED_OBJECTS_FMT1 is
used for tracing shared libraries;
LD_TRACE_LOADED_OBJECTS_FMT2 for dynamically
loaded objects, the dynamic linker, and the main executable. The following
conversions can be used:
LD_TRACE_LOADED_OBJECTS_PROGNAME.ld.so's
library search rules.Additionally, \n and \t are recognised and have their usual meaning.
LD_DEBUGld.so does. This
variable is ignored for set-user-ID and set-group-ID executables.The shared library model employed first appeared in SunOS 4.0.
| June 14, 2022 | openbsd |