Symbol Versioning in Oracle Solaris Libraries
The Oracle Solaris link editor and run-time linker use two kinds of library versioning: file versioning and symbol versioning. In file versioning, a library is named with an appended version number, such as libc.so.1
. In a few cases, when an incompatible change is made to one or more public interfaces in that library, the version number is incremented. For example, libc.so.2
.
Library symbol versioning associates a set of symbols with a symbol version name. The following is an example mapfile for a hypothetical Oracle Solaris library, libfoo.so.1
.
$mapfile_version 2 SYMBOL_VERSION SUNWpublic { global: symbolA; symbolB; symbolC; }; SYMBOL_VERSION SUNWprivate { global: __fooimpl; local: *; };
This mapfile indicates that symbolA
, symbolB
, and symbolC
are associated with version SUNWpublic
. The symbol __fooimpl
is associated with SUNWprivate
.
Note:
Thelocal: *
directive in the mapfile causes any symbol in the library that is not explicitly associated with a named version, to be scoped locally to the library. Such locally scoped symbols are not visible outside the library. This convention ensures that symbols are only visible when associated with a symbol versioning name.