HP-UX Reference (11i v1 00/12) - 5 Miscellaneous Topics, 7 Device (Special) Files, 9 General Information, Index (vol 9)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man5/!!!intro.5
________________________________________________________________
___ ___
d
dld.sl(5) dld.sl(5)
At run time, the loader will look at the library list recorded in the incomplete executable file or shared
library. For each library in the list that was not an internal name, the dynamic loader will look for a .0
version of the library (e.g. libname.0) to load. If it does not find this version, it will look for the library
name that is recorded in the list.
PA32 Explicit Loading and Binding
The duties of the dynamic loader as described above are all performed automatically, although they can be
controlled somewhat by appropriate options to ld. The dynamic loader can also be accessed programmati-
cally. The reserved symbol _ _dld_loc, which is defined in crt0.o, points to a jump table within the
dynamic loader. The routines described under shl_load(3X) provide a portable interface that allows the
programmer to explicitly attach a shared library to the process at run time, to calculate the addresses of
symbols defined within shared libraries, and to detach the library when done.
PA64 Explicit Loading and Binding
The duties of the dynamic loader as described above are all performed automatically, although they can be
controlled somewhat by appropriate options to ld. The dynamic loader can also be accessed programmati-
cally. The routines described under shl_load(3X), dlclose(3C), dlerror(3C), dlget(3C), dlmodinfo(3C),
dlopen(3C), and dlsym(3C) provide a portable interface that allows the programmer to explicitly attach a
shared library to the process at run time, to calculate the addresses of symbols defined within shared
libraries, and to detach the library when done.
Global Symbol Table
The global symbol table mechanism is designed as a performance enhancement option. Enabling this
mechanism causes the creation of a global symbol table which speeds up symbol lookup, by eliminating the
need to scan all loaded libraries in order to find a symbol. This is particularly effective for applications with
large numbers of shared libraries. This mechanism is off by default.
The global symbol table is implemented using a hash table. Under this mechanism, whenever a library is
loaded (either implicitly or by using dlopen() or shl_load()), the mechanism hashes the library’s
exports and places them into this table. When a library is unloaded, the mechanism looks up the library’s
exports in the table and removes them.
The hash table does not contain entries for symbols defined by shl_definesym()
. User-defined sym-
bols must therefore be handled separately.
Enabling the mechanism causes
dld to use more memory and impacts the performance of the dlo-
pen()
, dlclose(), shl_load() , and shl_unload() API calls.
With the global symbol table, the dynamic loader may need to perform a large number of hashing opera-
tions to locate symbols. Performing this hash function may cost considerable time, especially when symbol
names are very long (C++ programs). To speed up dld, computing hash values can be off-loaded to the
linker.
Use the +gst options, +gst, +gstbuckets (32-bit only), +gstsize, +nodynhash (64-bit only), and
+plabel_cache, (32-bit only) to control the behavior of the global symbol table hash mechanism. See
the ld(1) and chatr(1) commands for information on these options.
With these options, you can tune the size of the hash table and number of buckets per entry to reach a bal-
ance of performance and memory use. To maximize for performance, tune the table size for an average
chain length of one. For maximum memory use, at the expense of performance, tune the size of the table
to minimize the number of empty entries. In general, use prime numbers for the table size. The mechan-
ism provide default values of table size, 1103, and number of buckets, 3.
To get statistical information about hash table performance, set the environment variable _HP_DLDOPTS
to contain the -symtab_stat option. This option provideds a message for each library that contains the
following information:
Operation (load/unload)
Name of library
Number of exports
Number of entries in table with no stored symbols
Average length of non-zero chains
Calculated performance of the hash table
Section 544 4 HP-UX Release 11i: December 2000
___
___