Linker and Libraries Guide

Version Symbol Section

The version symbol section is defined by the type SHT_SUNW_versym. This section consists of an array of elements of the following structure.

typedef Elf32_Half      Elf32_Versym;
typedef Elf64_Half      Elf64_Versym;

The number of elements of the array must equal the number of symbol table entries that are contained in the associated symbol table. This number is determined by the section's sh_link value. Each element of the array contains a single index that can have the values shown in the following table.

Table 7–24 ELF Version Dependency Indexes

Name 

Value 

Meaning 

VER_NDX_LOCAL

0

Symbol has local scope. 

VER_NDX_GLOBAL

1

Symbol has global scope and is assigned to the base version definition. 

 

>1

Symbol has global scope and is assigned to a user-defined version definition, SHT_SUNW_verdef, or a version dependency, SHT_SUNW_verneed.

A symbol may be assigned the special reserved index 0. This index can be assigned for any of the following reasons.

Versions defined by an object are assigned version indexes starting at 1 and incremented by 1 for each version. Index 1 is reserved for the first global version. If the object does not have a SHT_SUNW_verdef version definition section, then all the global symbols defined by the object receive index 1. If the object does have a version definition section, then VER_NDX_GLOBAL simply refers to the first such version.

Versions required by the object from other SHT_SUNW_verneed dependencies, are assigned version indexes that start 1 past the final version definition index. These indexes are also incremented by 1 for each version. Since index 1 is always reserved for VER_NDX_GLOBAL, the first possible index for a dependency version is 2.

Versions of Solaris up to and including the Solaris 10 release, did not assign a version index to a SHT_SUNW_verneed dependency version. In such an object, any symbol reference had a version index of 0 indicating that no versioning information is available for that symbol.