Class: ELFTools::Sections::VersionDefinitionSection

Inherits:
Section
  • Object
show all
Defined in:
lib/elftools/sections/version_definition_section.rb

Overview

Class of the section recording the versions a file defines for what it exports.

This section is usually named .gnu.version_d, and records the very versions the DT_VERDEF tag points at.

Instance Attribute Summary

Attributes inherited from Section

#header, #stream

Instance Method Summary collapse

Methods inherited from Section

#allocated?, create, #data, #executable?, #name, #null?, #type, #writable?

Constructor Details

#initialize(header, stream, section_at: nil, **_kwargs) ⇒ VersionDefinitionSection

Parameters:



22
23
24
25
# File 'lib/elftools/sections/version_definition_section.rb', line 22

def initialize(header, stream, section_at: nil, **_kwargs)
  @section_at = section_at
  super
end

Instance Method Details

#definitionsArray<ELFTools::VersionTables::Definition>

The versions this file defines for what it exports.

Examples:

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

Returns:



33
34
35
36
37
# File 'lib/elftools/sections/version_definition_section.rb', line 33

def definitions
  @definitions ||= VersionTables.new(stream, @section_at.call(header.sh_link),
                                     endian: header.class.self_endian)
                                .definitions(header.sh_offset.to_i, header.sh_info.to_i)
end