Sha256: c1f7a59e10490c0e10e7e970c97a3ccf2c9d382a303dd4d389ae7e3b8e45d173
Contents?: true
Size: 811 Bytes
Versions: 3
Compression:
Stored size: 811 Bytes
Contents
module Elf::Policy def self.inject_symbols(file) case file.filetype when ElfFlags::Type::ET_EXEC filename = "" when ElfFlags::Type::ET_DYN filename = file.dynamic.soname else raise RuntimeError.new "section_symbols works only for ET_DYN and ET_EXEC files" end (file.progbits + file.nobits).each{|section| name = Elf::Policy::section_symbol_name(filename,section.name) next if file.symbols.include? name sym = Elf::Symbol.new(name,section,ElfFlags::SymbolType::STT_OBJECT,0,ElfFlags::SymbolBinding::STB_GLOBAL,section.size) # STT_SECTION is ignored for lookup! # print "Injecting #{name}" sym.gnu_version = :global sym.hidden = false sym.is_dynamic = true file.symbols << sym } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
elf-mithril-0.0.5 | lib/mithril/inject_symbols.rb |
elf-mithril-0.0.4 | lib/mithril/inject_symbols.rb |
elf-mithril-0.0.1 | lib/mithril/inject_symbols.rb |