HP-UX Linker and Libraries User's Guide
_HP_DLDOPTS=-time directs dld to print the time taken for shared library loading, symbol
resolution, and applying relocations (the time taken by dld at startup). The optimal hash table
setting for a target application is the option that takes the least time to apply relocations and to
resolve symbols.
Improving Performance with Function Symbol Aliasing
The +afs option supports function symbol aliasing. Often user programs have functions that exactly
match the functionality of optimized library functions with a different name. These user- defined
functions are usually called frequently in the program. With the +afs option, you can make
significant gains in performance by replacing all references to a user-defined function with references
to a tuned library function during link time, thus optimizing these functions with just a relink. The
+afs func_sym_x=func_sym_y ... instructs the linker to replace the function symbol with
an alternate function symbol in shared library and executable file links. Both functions must define
the same number and type of parameters, and return a value of the same type. If they do not
match, the results can be unpredictable, and the linker does not generate a warning message.
Example 20 Example:
$ ld ... +afs func_sym1=func_sym2 ...
In the example, the linker replaces all references to the function symbol func_sym1 with references
to func_sym2. The func_sym2 symbol must be an normal unaliased symbol. It cannot appear
on the left-hand side of “"="” on another +afs option. You can specify more than one function
symbol alias on the command line with multiple option-symbol pairs. That is, each symbol pair you
specify must be preceded by the +afs option.
Improving Shared Library Start-Up Time with fastbind
• “Using fastbind” (page 222)
• “Invoking the fastbind Tool” (page 223)
• “Invoking fastbind from the Linker” (page 223)
• “How to Tell if fastbind Information is Current” (page 223)
• “Removing fastbind Information from a File” (page 224)
• “Turning off fastbind at Run Time” (page 224)
The fastbind tool improves the start-up time of programs that use shared libraries. When
fastbind is invoked, it caches relocation information inside the executable file. The next time
the executable file runs, the dynamic loader uses this cached information to bind the executable
instead of searching for symbols. The syntax for fastbind is:
fastbind [-n] [-u] incomplete executable...
where:
Removes fastbind data from the executable.-n
Performs fastbind even when unresolved symbols are found. (By default, fastbind stops when it
cannot resolve symbols.)
-u
Using fastbind
You can create and delete fastbind information for an executable file after it has been linked
with shared libraries. You can invoke fastbind from the linker or use the fastbind tool directly.
You can set the _HP_DLDOPTS environment variable to find out if fastbind information is
out-of-date and to turn off fastbind at run time.
222 Improving Your Application Performance