Skip Navigation Links | |
Exit Print View | |
Oracle Solaris 11.1 Linkers and Libraries Guide Oracle Solaris 11.1 Information Library |
Part I Using the Link-Editor and Runtime Linker
1. Introduction to the Oracle Solaris Link Editors
5. Link-Editor Quick Reference
7. Building Objects to Optimize System Performance
10. Establishing Dependencies with Dynamic String Tokens
Part IV ELF Application Binary Interface
64-bit SPARC: Relocation Types
Symbol Table Layout and Conventions
13. Program Loading and Dynamic Linking
A. Linker and Libraries Updates and New Features
Objects created by the link-editor can contain two types of versioning information.
Version definitions provide associations of global symbols and are implemented using sections of type SHT_SUNW_verdef and SHT_SUNW_versym.
Version dependencies indicate the version definition requirements from other object dependencies and are implemented using sections of type SHT_SUNW_verneedSHT_SUNW_versym.
The structures that form these sections are defined in sys/link.h. Sections that contain versioning information are named .SUNW_version.
This section is defined by the type SHT_SUNW_verdef. If this section exists, a SHT_SUNW_versym section must also exist. These two structures provide an association of symbols to version definitions within the file. See Creating a Version Definition. Elements of this section have the following structure.
typedef struct { Elf32_Half vd_version; Elf32_Half vd_flags; Elf32_Half vd_ndx; Elf32_Half vd_cnt; Elf32_Word vd_hash; Elf32_Word vd_aux; Elf32_Word vd_next; } Elf32_Verdef; typedef struct { Elf32_Word vda_name; Elf32_Word vda_next; } Elf32_Verdaux; typedef struct { Elf64_Half vd_version; Elf64_Half vd_flags; Elf64_Half vd_ndx; Elf64_Half vd_cnt; Elf64_Word vd_hash; Elf64_Word vd_aux; Elf64_Word vd_next; } Elf64_Verdef; typedef struct { Elf64_Word vda_name; Elf64_Word vda_next; } Elf64_Verdaux;
This member identifies the version of the structure, as listed in the following table.
|
The value 1 signifies the original section format. Extensions require new versions with higher numbers. The value of VER_DEF_CURRENT changes as necessary to reflect the current version number.
This member holds version definition-specific information, as listed in the following table.
|
The base version definition is always present when version definitions, or symbol auto-reduction, have been applied to the file. The base version provides a default version for the files reserved symbols. A weak version definition has no symbols associated with the version. See Creating a Weak Version Definition.
The version index. Each version definition has a unique index that is used to associate SHT_SUNW_versym entries to the appropriate version definition.
The number of elements in the Elf32_Verdaux array.
The hash value of the version definition name. This value is generated using the same hashing function that is described in Hash Table Section.
The byte offset from the start of this Elf32_Verdef entry to the Elf32_Verdaux array of version definition names. The first element of the array must exist. This element points to the version definition string this structure defines. Additional elements can be present. The number of elements is indicated by the vd_cnt value. These elements represent the dependencies of this version definition. Each of these dependencies will have its own version definition structure.
The byte offset from the start of this Elf32_Verdef structure to the next Elf32_Verdef entry.
The string table offset to a null-terminated string, giving the name of the version definition.
The byte offset from the start of this Elf32_Verdaux entry to the next Elf32_Verdaux entry.
The version dependency section is defined by the type SHT_SUNW_verneed. This section complements the dynamic dependency requirements of the file by indicating the version definitions required from these dependencies. A recording is made in this section only if a dependency contains version definitions. Elements of this section have the following structure.
typedef struct { Elf32_Half vn_version; Elf32_Half vn_cnt; Elf32_Word vn_file; Elf32_Word vn_aux; Elf32_Word vn_next; } Elf32_Verneed; typedef struct { Elf32_Word vna_hash; Elf32_Half vna_flags; Elf32_Half vna_other; Elf32_Word vna_name; Elf32_Word vna_next; } Elf32_Vernaux; typedef struct { Elf64_Half vn_version; Elf64_Half vn_cnt; Elf64_Word vn_file; Elf64_Word vn_aux; Elf64_Word vn_next; } Elf64_Verneed; typedef struct { Elf64_Word vna_hash; Elf64_Half vna_flags; Elf64_Half vna_other; Elf64_Word vna_name; Elf64_Word vna_next; } Elf64_Vernaux;
This member identifies the version of the structure, as listed in the following table.
|
The value 1 signifies the original section format. Extensions require new versions with higher numbers. The value of VER_NEED_CURRENT changes as necessary to reflect the current version number.
The number of elements in the Elf32_Vernaux array.
The string table offset to a null-terminated string, providing the file name of a version dependency. This name matches one of the .dynamic dependencies found in the file. See Dynamic Section.
The byte offset, from the start of this Elf32_Verneed entry, to the Elf32_Vernaux array of version definitions that are required from the associated file dependency. At least one version dependency must exist. Additional version dependencies can be present, the number being indicated by the vn_cnt value.
The byte offset, from the start of this Elf32_Verneed entry, to the next Elf32_Verneed entry.
The hash value of the version dependency name. This value is generated using the same hashing function that is described in Hash Table Section.
Version dependency specific information, as listed in the following table.
|
A weak version dependency indicates an original binding to a weak version definition.
If non-zero, the version index assigned to this dependency version. This index is used within the SHT_SUNW_versym to assign global symbol references to this version.
Versions of Solaris up to and including the Oracle Solaris 10 release, did not assign version symbol indexes to dependency versions. In these objects, the value of vna_other is 0.
The string table offset to a null-terminated string, giving the name of the version dependency.
The byte offset from the start of this Elf32_Vernaux entry to the next Elf32_Vernaux entry.
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 12-25 ELF Version Dependency Indexes
|
A symbol may be assigned the special reserved index 0. This index can be assigned for any of the following reasons.
A non-global symbol is always assigned VER_NDX_LOCAL. However, this is rare in practice. Versioning sections are usually created only in conjunction with the dynamic symbol table, .dynsym, which only contains global symbols.
A global symbol defined within an object that does not have a SHT_SUNW_verdef version definition section.
An undefined global symbol defined within an object that does not have a SHT_SUNW_verneed version dependency section. Or, an undefined global symbol defined within an object in which the version dependency section does not assign version indexes.
The first entry of a symbol table is always NULL. This entry always receives VER_NDX_LOCAL, however the value has no particular meaning.
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 Oracle 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.