Oracle® Solaris 11.2 Linkers and Libraries Guide

Exit Print View

Updated: July 2014

Using the –B nodirect Option

The –B nodirect option provides the simplest mechanism of preventing direct binding from any dynamic object. This option prevents direct binding from any other object, and from within the object being built.

The following components are used to build three shared objects,, and The –B nodirect option is used to prevent from directly binding to However, can continue to establish direct bindings to using the –z direct option.

$ cat a.c
extern int o(), p(), x(), y();

int a() { return (o() + p() - x() - y()); }
$ cat o.c
extern int x(), y();

int o() { return (x()); }
int p() { return (y()); }
$ cat x.c
int x() { return (1); }
int y() { return (2); }
$ cc -o -G -Kpic x.c
$ cc -o -G -Kpic o.c -Bnodirect -zdirect -R.
$ cc -o -G -Kpic a.c -Bdirect -R.

The symbol information for and can be viewed with elfdump(1).

$ elfdump -y
     [1]  DBL     [3]            x
     [5]  DBL     [3]            y
     [6]  DL      [1]            o
     [9]  DL      [1]            p
$ elfdump -y
     [3]  DB      [0]            x
     [4]  DB      [0]            y
     [6]  N                             o
     [7]  N                             p

The letter “N” indicates that no direct bindings be allowed to the functions o() and p(). Even though has requested direct bindings by using the –B direct option, direct bindings have not be established to the functions o() and p(). can still request direct bindings to its dependency using the –z direct option.

The Oracle Solaris library is built with the –B nodirect option. Users of this library are expected to provide their own call back interfaces for many of the libproc functions. References to the libproc functions from any dependencies of libproc should bind to any user definitions when such definitions exist.