Invoking the fastbind Tool

To invoke fastbind on an incomplete executable file, verify that your executable has write access (because fastbindwrites to the file) and then run fastbind.

$ ls -l main

-rwxrwxrwx 1 janet 191 28722 Feb 20 09:11 main $ fastbind main

The fastbind tool generates fastbind information for main and rewrites main to contain this information.

Invoking fastbind from the Linker

To invoke fastbind from ld, pass the request to the linker from your compiler by using the -Wl, +fb options.

Example 21 Example

$ ld -b convert.o volume.o -o libunits.s

//Build the shared library.

$ cc -Aa -Wl,+fb main.c -o main \

//Link main to the shared

libunits.s -lc

library. //Perform fastbind.

The linker performs fastbind after it creates the executable file.

How to Tell if fastbind Information is Current

By default, when the dynamic loader detects out-of-date fastbind information for one or more shared library dependencies, it silently reverts back to the standard method for binding the symbols in the these libraries.

To view if an executable file has out-of-date fastbind information, set the _HP_DLDOPTS environment variable, as follows:

$ export _HP_DLDOPTS=-fbverbose $ app

/usr/lib/hpux32/dld.so: Fastbind data out of date for ./libapp59.so.

/usr/lib/hpux32/dld.so: Fastbind data cannot be used for ./libapp60.so.

/usr/lib/hpux32/dld.so: Fastbind data cannot be used for ./libm.so.

/usr/lib/hpux32/dld.so: Fastbind data cannot be used for ./libc.so.1.

/usr/lib/hpux32/dld.so: Fastbind data cannot be used for /usr/lib/hpux32/libdl.so.1

In this example, the “"Fastbind data out of date"” messages indicate that libapp59.so was modified after fastbind was run on the application, app, and dld reverts to using the normal symbol lookup for resolving the symbols in the libapp59.so library.

The “"Fastbind data cannot be used"” messages indicate that the change to libapp59.so includes one or more symbols, which were added or removed from the library export list. This can change the symbol bindings in the application for the library dependencies, which follow libapp59.so in the library search order.

It is recommended that the applications link with the application libraries first and the system libraries last. If the application in this example is linked with libm before linking with the application libraries, a libm patch will invalidate the fastbind data for all the 60 application libraries. Careful arrangement of library dependencies will minimize the need for rerunning fastbind to restore startup time improvements.

In IA and PA64 applications, the fastbind data is outdated on a per-library basis. When a library patch is installed, the dld exclusively invalidates the modified fastbind data for the corresponding library. The fastbind data for the other libraries continue to be valid. The dld continues to use the fastbind data for the modified shared library if the symbols that are exported from the shared library are not modified.

Improving Shared Library Start-Up Time with fastbind 223