HP-UX Reference (11i v2 07/12) - 5 Miscellaneous (vol 9)

d
dld.so(5)
Itanium(R)-based Systems Only
dld.so(5)
For PA-RISC 32-bit compatibility mode libraries (libraries built or linked with
ld +compat), the dynamic
loader only does dynamic path searching for these libraries if they were linked with
-l or -l: and one of
these were specified:
ld +s
ld +b
chatr +s enable
There are several ways to specify a dynamic path list :
By storing a directory path list in the executable (in
rpath) using the +b path_list option to ld.
By not specifying
ld +b and letting the linker set the
rpath value to a concatenation of the
ld -L
path_list followed by the value of the environment variable
LPATH followed by the 64-bit default direc-
tory
/usr/lib/hpux64
, or the 32-bit default directory /usr/lib/hpux32
.
By storing a directory path list in the environment variables
LD_LIBRARY_PATH
and/or
SHLIB_PATH . LD_LIBRARY_PATH
and SHLIB_PATH can contain paths for both 32 and 64 bit
libraries; dld.so will only load appropriate libraries. For compatibility mode shared libraries and execut-
ables, the directory path list should only be put in the
SHLIB_PATH environment variable.
The path list is a list of one or more path names separated by colons (:). The dynamic path list works only
for libraries specified with the
-l or -l: options to ld. However, it can be enabled for libraries specified
with a full path name using the -l option to chatr (see chatr(1)). If both +s
and +b are used, their rela-
tive order on the command line indicates which path list is searched first in compatibility mode. See the
+help option to ld(1) or the HP-UX Linker and Libraries User’s Guide for more details.
The dynamic loader uses these rules when determining which dynamic path list to use:
If
ld +noenvvar was specified and ld +b and ld +compat were not specified, then the only
dynamic path searching that can be done is to look at the path list in
rpath followed by the 64-bit
default directory
/usr/lib/hpux64
, or the 32-bit default directory /usr/lib/hpux32.
If
ld +compat was specified and ld +b and ld +s were not specified, no shared library is subject
to dynamic path searching. The link-time location of the library (recorded path) is used.
If the
ld +compat and ld +b options are not specified, then the path list in the
LD_LIBRARY_PATH environment variable is searched, followed by the path list in the
SHLIB_PATH
environment variable, followed by the path list in rpath, followed by the 64-bit default directory
/usr/lib/hpux64, or the 32-bit default directory
/usr/lib/hpux32.
If the
ld +compat, ld +b, and ld +s are specified, then use the relative ordering of
ld +b and
ld +s to determine if the dynamic loader should use the path list in rpath before SHLIB_PATH
fol-
lowed by library as specified in the library list. If
ld +b is specified first, use the path list in
rpath
first.
The rules change slightly when looking for dependent shared libraries.
For default mode libraries, the path list in the LD_LIBRARY_PATH
environment variable is searched
first, followed by the path list in the
SHLIB_PATH environment variable, followed by the value in the
parent shared library’s rpath, followed by the 64-bit default directory
/usr/lib/hpux64, or the
32-bit default directory
/usr/lib/hpux32. The ancestors of a parent shared library may contain a
path list in rpath, but this is ignored when searching for dependent shared libraries of this parent.
Only the parent’s rpath is used.
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 depen-
dents, and so on.
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 func-
tion 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 are required
later. Thus, better real-time response may result, and the risk of a later abort due to unresolved externals
is eliminated.
120 Hewlett-Packard Company 2 HP-UX 11i Version 2: December 2007 Update