Class: ELFTools::Sections::VersionSection
- Defined in:
- lib/elftools/sections/version_section.rb
Overview
Class of the section recording which version each symbol binds to.
This section is usually named .gnu.version, and holds an index per symbol
of the table its sh_link names, the very indices the DT_VERSYM tag
points at.
Instance Attribute Summary
Attributes inherited from Section
Instance Method Summary collapse
-
#num_versions ⇒ Integer
How many symbols the section records a version for.
-
#version_at(n) ⇒ Integer?
What the +n+-th symbol records as its version, which is an index into the versions a file needs or defines, with the highest bit marking a version the symbol asks for by name rather than the default one.
Methods inherited from Section
#allocated?, create, #data, #executable?, #initialize, #name, #null?, #type, #writable?
Constructor Details
This class inherits a constructor from ELFTools::Sections::Section
Instance Method Details
#num_versions ⇒ Integer
How many symbols the section records a version for.
15 16 17 |
# File 'lib/elftools/sections/version_section.rb', line 15 def num_versions header.sh_size.to_i / entry_size end |
#version_at(n) ⇒ Integer?
What the +n+-th symbol records as its version, which is an index into the versions a file needs or defines, with the highest bit marking a version the symbol asks for by name rather than the default one.
27 28 29 30 31 32 |
# File 'lib/elftools/sections/version_section.rb', line 27 def version_at(n) return if n.negative? || n >= num_versions stream.pos = header.sh_offset.to_i + (n * entry_size) stream.read(entry_size).unpack1(header.class.self_endian == :big ? 'S>' : 'S<') end |