When is -B restricted most useful? Consider a program that creates duplicate symbol definitions by either of these methods:

The program uses shl_load with the BIND_FIRST flag to load a library that contains symbol definitions that are already defined in a library that was loaded at program startup.

The program calls shl_definesym to define a symbol that is already defined in a library that was loaded at program startup.

If such a program is linked with -B immediate, references to symbols are bound at program startup, regardless of whether duplicate symbols are created later by shl_load or shl_definesym.

But what happens when, to take advantage of the performance benefits of deferred binding, the same program is linked with -B deferred? If a duplicate, more visible symbol definition is created prior to referencing the symbol, it binds to the more visible definition, and the program may run incorrectly. In such cases, -B restricted is useful, because symbols bind the same way as they do with -B immediate, but the actual binding is still deferred.

Direct Shared Library Binding with -B direct

The linker also supports direct binding, which creates a direct link between symbol references and shared libraries by recording the name of the resolved shared library during symbol resolution. This information is used during runtime to quickly resolve symbols without searching through all currently-loaded libraries.

The -B direct option implicitly turns on symbolic binding and disables dependent shared library processing.

Direct binding can be disabled during runtime by setting the LD_NODIRECTBIND environment variable.

Shared Library Binding with -B group

Group binding marks the shared library so that it behaves as if loaded with RTLD_GROUP flag to dlopen(). This does not affect the dependent shared libraries.

NOTE: You can use the libraries built with the -B group option only with the dld.sl in version B.11.37 or later.

Lazydirect Shared Library Binding with -B lazydirect

Lazydirect binding only records direct bind information to shared libraries that are marked for lazy loading. See +[no]lazyload.

Shared Library Binding with -B nodelete

Nodelete binding marks the shared library so that an explicit unload using dlclose or shl_load returns success silently without detaching the shared library from the process. Subsequently, the shared library handle is valid only for shl_findsym. It stays invalid for dlsym, dlclose, and shl_unload until the next explicit load using shl_load or dlopen.

NOTE: You can use the libraries built with the -B nodelete option only with the dld.sl in version B.11.37 or later.

-B nodirect

Nodirect binding precludes direct binding. Only a "direct hint" is recorded for references to libraries marked for lazy loading. This is the default behavior.

Using Linker Commands 33