Class: Elf::GNU::SymbolVersionDef
Constant Summary collapse
- FlagBase =
0x0001
- FlagWeak =
0x0002
Constants inherited from Section
Section::Abs, Section::Common, Section::FlagsToChars, Section::OsSpecific, Section::ProcSpecific, Section::Reserved, Section::SunW, Section::SunWIgnore, Section::Undef, Section::XIndex
Instance Attribute Summary
Attributes inherited from Section
#addr, #addralign, #entsize, #file, #index, #info, #offset, #size, #type
Instance Method Summary collapse
- #[](idx) ⇒ Object
- #count ⇒ Object
-
#each_version(&block) ⇒ Object
Allow to iterate over all the versions defined in the ELF file.
- #load_internal ⇒ Object
Methods inherited from Section
#==, #flags, #flags_i, #flags_s, #initialize, #link, #load, #name, read, #summary
Constructor Details
This class inherits a constructor from Elf::Section
Instance Method Details
#[](idx) ⇒ Object
100 101 102 103 104 |
# File 'lib/elf/gnu.rb', line 100 def [](idx) load unless @defined_versions @defined_versions[idx] end |
#count ⇒ Object
94 95 96 97 98 |
# File 'lib/elf/gnu.rb', line 94 def count load unless @defined_versions @defined_versions.size end |
#each_version(&block) ⇒ Object
Allow to iterate over all the versions defined in the ELF file.
108 109 110 111 112 |
# File 'lib/elf/gnu.rb', line 108 def each_version(&block) load unless @defined_versions @defined_versions.each_value(&block) end |
#load_internal ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/elf/gnu.rb', line 59 def load_internal link.load # do this now for safety @defined_versions = {} entry_off = @offset loop do @file.seek(entry_off) entry = {} version = @file.read_half raise SymbolVersionUnknown.new(version) if version != 1 entry[:flags] = @file.read_half ndx = @file.read_half aux_count = @file.read_half entry[:hash] = @file.read_word name_off = entry_off + @file.read_word next_entry_off = @file.read_word entry[:names] = [] for i in 1..aux_count @file.seek(name_off) entry[:names] << link[@file.read_word] next_name_off = @file.read_word break unless next_name_off != 0 name_off += next_name_off end @defined_versions[ndx] = entry break unless next_entry_off != 0 entry_off += next_entry_off end end |