HP-UX Reference (11i v2 04/09) - 5 Miscellaneous Topics (vol 9)

d
dld.sl(5) dld.sl(5)
(PA-RISC System Only)
(library name without a path) has already been loaded for the program, that library is used to
resolve the dependent shared library.
For compatibility mode libraries, the search is the same as for parent shared libraries, except
rpath can be passed from parent shared libraries to child dependent shared libraries to that child’s
dependents, et cetera.
Binding
The dynamic loader also resolves symbolic references between the executable and libraries. By default,
function calls are trapped via the linkage table and bound on first reference. References to data symbols
and other absolute address references cannot be trapped. They are bound on the first resolution of a
function call that could potentially reference the object.
If the -B immediate option to ld
is used, the loader binds all necessary references at startup time.
This increases the startup cost of a program, but ensures that no more binding operations will be
required later. Thus, better real-time response may result, and the risk of a later abort due to unresolved
externals is eliminated.
The
fastbind tool can be used to improve the start-up time of programs that use shared libraries
(incomplete executables). The
fastbind tool performs analysis on the shared library routines and data
used to bind the symbols and stores this information in the executable file. The dynamic loader will
notice that this information is available, and it will use this fastbind information to bind the symbols
instead of the standard search method. For more details refer to fastbind (1) and the
+help option to
ld(1) or the HP-UX Linker and Libraries User’s Guide manual.
Breadth-first Searching
This is only available on PA-RISC 64-bit systems. By default, the dynamic loader will do breadth-first
searching when binding symbols. If the incomplete executable was linked with
+compat or if a
shl_load() is being executed, then depth-first searching is used. Breadth-first searching specifies that
the dynamic loader will look for symbols starting with the incomplete executable followed by all loaded
shared libraries in a left to right order until the symbol is found. For example, the incomplete executable
is searched followed by all libraries in its shared library list. Then the dependent shared libraries of the
first library in the shared library list is searched, followed by the dependent shared libraries of the second
library in the list, et cetera.
Depth-first Searching
This is the only search behavior on PA-RISC 32-bit systems and is used on PA-RISC 64-bit systems if
doing a
shl_load() or if the incomplete executable was linked with +compat. The dynamic loader
will search the incomplete executable followed by the first library in its shared library list. The first
dependent library of this library is then searched, followed by the first dependent of this dependent, and
so on. When there are no more dependents, the siblings and their dependents are searched until eventu-
ally the second library in the program’s shared library list is searched, followed by the first dependent of
this library, et cetera.
Version Control
Since code from a shared library is mapped at run time from a separate shared library file, modifications
to a shared library may alter the behavior of existing executables. In some cases, this may cause pro-
grams to operate incorrectly. Two means of version control is provided to solve this problem.
Intra-Library Versioning
This is available on PA-RISC 32-bit systems only. Whenever an incompatible change is made to a library
interface, both versions of the affected module or modules are included in the library. A mark indicating
the date (month/year) the change was made is recorded in the new module via the pragma
HP_SHLIB_VERSION in C, or the compiler directive SHLIB_VERSION
in Fortran and Pascal. This
date applies to all symbols defined within the module. A high water mark giving the date of the latest
incompatible change is recorded in the shared library, and the high water mark for each library linked
with the program is recorded in the incomplete executable file. At run time, the dynamic loader checks
the high water mark of each library and loads the library only if it is at least as new as the high water
mark recorded at link time. When binding symbolic references, the loader chooses the latest version of a
symbol that is not later than the high water mark recorded at link time. These two checks help ensure
that the version of each library interface used at run time is the same as was expected at link time.
Intra-library versioning may be removed in a future release.
HP-UX 11i Version 2: September 2004 3 Hewlett-Packard Company Section 585