Exemplo n.º 1
0
 def __init__(self, abi, source=None):
     from peachpy.formats.elf.section import null_section, StringSection, SymbolSection, SectionIndex
     from peachpy.formats.elf.symbol import Symbol, SymbolBinding, SymbolType
     self.abi = abi
     self.shstrtab = StringSection(".shstrtab")
     self.strtab = StringSection(".strtab")
     self.symtab = SymbolSection(string_table=self.strtab)
     self.sections = [null_section, self.shstrtab, self.strtab, self.symtab]
     self._section_names = set(
         [self.shstrtab.name, self.strtab.name, self.symtab.name])
     if source:
         source_symbol = Symbol()
         source_symbol.value = 0
         source_symbol.binding = SymbolBinding.local
         source_symbol.type = SymbolType.file
         source_symbol.name = source
         source_symbol.size = 0
         source_symbol.section = SectionIndex.absolute
         self.symtab.add(source_symbol)
Exemplo n.º 2
0
 def __init__(self, abi, source=None):
     from peachpy.formats.elf.section import NullSection, StringSection, SymbolSection, SectionIndex
     from peachpy.formats.elf.symbol import Symbol, SymbolBinding, SymbolType
     self.abi = abi
     self.sections = []
     null = NullSection(abi)
     self.bind_section(null)
     shstrtab = StringSection(abi)
     self.bind_section(shstrtab, ".shstrtab")
     strtab = StringSection(abi)
     self.bind_section(strtab, ".strtab")
     symtab = SymbolSection(abi)
     symtab.header.link_index = strtab.index
     symtab.header.info = 0
     self.bind_section(symtab, ".symtab")
     if source:
         source_symbol = Symbol(abi)
         source_symbol.value = 0
         source_symbol.binding = SymbolBinding.Local
         source_symbol.type = SymbolType.File
         source_symbol.name_index = strtab.add(source)
         source_symbol.content_size = 0
         source_symbol.section_index = SectionIndex.Absolute
         symtab.add(source_symbol)