Symbol Visibility Directives

A symbol's visibility, although it may be specified in an object file, defines how that symbol may be accessed once it has become part of an executable or shared object.

The default visibility of symbols is specified by the symbol's binding type. That is, global and weak symbols are visible outside of their defining component (executable file or shared object). Local symbols are hidden, as described below.

A symbol defined in the current executable file or shared object is protected if it is visible in other components but not preemptable. Preemptable means that any reference to such a symbol from within the defining component must be resolved to the definition in that component, even if there is a definition in another component.

A symbol defined in the current component is hidden if its name is not visible to other components. Such a symbol is necessarily protected. This directive may be used to control the external interface of a component.

To declare one or more symbols as protected, use the .protected directive. These symbols are flagged as protected symbols for the linkage editor. The .protected directive has the following format:

.protected name,name, ...

Where:

name

represents a symbol name.

To declare one or more symbols as hidden, use the .hidden directive. These symbols are flagged as hidden symbols for the linkage editor. The .hidden directive has the following format:

.hidden name,name, ...

Where:

name

represents a symbol name.

To declare one or more symbols as exported, use the .export directive. These symbols are flagged as exported symbols for the linkage editor. The .export directive has the following format:

.export name,name, ...

Where:

name

represents a symbol name.