Module: ELFTools::Dynamic::Versions

Included in:
ELFTools::Dynamic
Defined in:
lib/elftools/dynamic/versions.rb

Overview

Note:

This module is included by ELFTools::Dynamic and reads through the methods there, so it cannot be included on its own.

The versions a file binds its symbols to.

Two tables record them, the versions the file needs of the files it is loaded with and the versions it defines for what it exports, and a symbol names one of either by the same index.

Instance Method Summary collapse

Instance Method Details

#version_definitionsArray<ELFTools::VersionTables::Definition>

The versions this file defines for what it exports.

The first of them is the file itself rather than a version of it, which VersionTables::Definition#base? tells apart.

Examples:

elf.dynamic.version_definitions.map(&:name).first(3)
#=> ['libc.so.6', 'GLIBC_2.2.5', 'GLIBC_2.2.6']

Returns:



37
38
39
# File 'lib/elftools/dynamic/versions.rb', line 37

def version_definitions
  @version_definitions ||= read_table(:verdef, :verdefnum) { |at, count| tables.definitions(at, count) }
end

#version_requirementsArray<ELFTools::VersionTables::Requirement>

The versions this file needs of the files it is loaded with.

Examples:

elf.dynamic.version_requirements.map { |need| [need.file, need.versions.map(&:name)] }
#=> [['libc.so.6', ['GLIBC_2.4', 'GLIBC_2.2.5']]]

Returns:



24
25
26
# File 'lib/elftools/dynamic/versions.rb', line 24

def version_requirements
  @version_requirements ||= read_table(:verneed, :verneednum) { |at, count| tables.requirements(at, count) }
end