Module: Elf::Policy
- Defined in:
- lib/mithril/policy/dsl.rb,
lib/mithril/inject_symbols.rb
Defined Under Namespace
Modules: BuilderHelper, Generator, Hacks
Classes: Call, Data, DataBuilder, MemoryRange, Policy, PolicyBuilder, StateBuilder, TagBuilder, Transition
Constant Summary
collapse
- R =
ElfFlags::Relocation
- ELFP =
ElfFlags::ElfPData
Class Method Summary
collapse
Class Method Details
.build(&block) ⇒ Object
336
337
338
339
340
|
# File 'lib/mithril/policy/dsl.rb', line 336
def self.build(&block)
x= PolicyBuilder.new()
x.instance_eval(&block)
x.policy
end
|
.inject_symbols(file) ⇒ Object
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/mithril/inject_symbols.rb', line 2
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) sym.gnu_version = :global
sym.hidden = false
sym.is_dynamic = true
file.symbols << sym
}
end
|
.section_symbol_name(file_name, section_name) ⇒ Object
4
5
6
|
# File 'lib/mithril/policy/dsl.rb', line 4
def self.section_symbol_name(file_name,section_name)
"_elfp_#{file_name}_#{section_name}"
end
|