Oracle® Solaris 11.2 Linkers and Libraries Guide

Exit Print View

Updated: July 2014
 
 

Enabling Direct Binding

An object that uses direct bindings maintains the relationship between a symbol reference and the dependency that provided the definition. The runtime linker uses this information to search directly for the symbol in the associated object, rather than carry out the default symbol search model.

Direct binding information for a dynamic object is recorded at link-edit time. This information can only be established for the dependencies that are specified with the link-edit of that object. Use the –z defs option to ensure that all of the necessary dependencies are provided as part of the link-edit.

Objects that use direct bindings can exist within a process with objects that do not use direct bindings. Those objects that do not use direct bindings use the default symbol search model.

The direct binding of a symbol reference to a symbol definition can be established with one of the following link-editing mechanisms.

  • With the –B direct option. This option establishes direct bindings between the object being built and all of the objects dependencies. This option also establishes direct bindings between any symbol reference and symbol definition within the object being built.

    The use of the –B direct option also enables lazy loading. This enabling is equivalent to adding the –z lazyload option to the front of the link-edit command line. This attribute was introduced in Lazy Loading of Dynamic Dependencies.

  • With the –z direct option. This option establishes direct bindings from the object being built to any dependencies that follow the option on the command line. This option can be used together with the –z nodirect option to toggle the use of direct bindings between dependencies. This option does not establish direct bindings between any symbol reference and symbol definition within the object being built.

  • With the DIRECT mapfile keyword. This keyword provides for directly binding individual symbols. This keyword is described in SYMBOL_SCOPE / SYMBOL_VERSION Directives.


Note - Direct bindings can be disabled at runtime by setting the environment variable LD_NODIRECT to a non-null value. By setting this environment variable, all symbol binding within a process is carried out using the default search model.

The following sections describe the use of each of the direct binding mechanisms.