<s> """<STR_LIT>""" <EOL> import os <EOL> import sys <EOL> import struct <EOL> import traceback <EOL> import zlib <EOL> from stat import * <EOL> from Elf . elf_lookup import * <EOL> import vstruct <EOL> import vstruct . defs . elf as vs_elf <EOL> verbose = False <EOL> class ElfReloc : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , r_types ) : <EOL> self . name = "<STR_LIT>" <EOL> self . r_types = r_types <EOL> def __repr__ ( self ) : <EOL> return "<STR_LIT>" % ( hex ( self . r_offset ) , self . getName ( ) , self . getTypeName ( ) ) <EOL> def setName ( self , name ) : <EOL> self . name = name <EOL> def getName ( self ) : <EOL> return self . name <EOL> def getType ( self ) : <EOL> return self . r_info & <NUM_LIT> <EOL> def getTypeName ( self ) : <EOL> return self . r_types . get ( self . getType ( ) , "<STR_LIT>" ) <EOL> class Elf32Reloc ( ElfReloc , vs_elf . Elf32Reloc ) : <EOL> def __init__ ( self , r_types ) : <EOL> vs_elf . Elf32Reloc . __init__ ( self ) <EOL> ElfReloc . __init__ ( self , r_types ) <EOL> def getSymTabIndex ( self ) : <EOL> return self . r_info >> <NUM_LIT:8> <EOL> class Elf32Reloca ( ElfReloc , vs_elf . Elf32Reloca ) : <EOL> def __init__ ( self , r_types ) : <EOL> vs_elf . Elf32Reloca . __init__ ( self ) <EOL> ElfReloc . __init__ ( self , r_types ) <EOL> def getSymTabIndex ( self ) : <EOL> return self . r_info >> <NUM_LIT:8> <EOL> class Elf64Reloc ( ElfReloc , vs_elf . Elf64Reloc ) : <EOL> def __init__ ( self , r_types ) : <EOL> vs_elf . Elf64Reloc . __init__ ( self ) <EOL> ElfReloc . __init__ ( self , r_types ) <EOL> def getSymTabIndex ( self ) : <EOL> return self . r_info >> <NUM_LIT:32> <EOL> class Elf64Reloca ( ElfReloc , vs_elf . Elf64Reloca ) : <EOL> def __init__ ( self , r_types ) : <EOL> vs_elf . Elf64Reloca . __init__ ( self ) <EOL> ElfReloc . __init__ ( self , r_types ) <EOL> def getSymTabIndex ( self ) : <EOL> return self . r_info >> <NUM_LIT:32> <EOL> class ElfDynamic : <EOL> has_string = [ DT_NEEDED , DT_SONAME ] <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , bytes = None ) : <EOL> self . name = "<STR_LIT>" <EOL> def __repr__ ( self ) : <EOL> name = self . getName ( ) <EOL> if not name : <EOL> name = hex ( self . d_value ) <EOL> return "<STR_LIT>" % ( name , self . getTypeName ( ) ) <EOL> def getName ( self ) : <EOL> return self . name <EOL> def setName ( self , name ) : <EOL> self . name = name <EOL> def getTypeName ( self ) : <EOL> return dt_types . get ( self . d_tag , "<STR_LIT>" % hex ( self . d_tag ) ) <EOL> class Elf32Dynamic ( ElfDynamic , vs_elf . Elf32Dynamic ) : <EOL> def __init__ ( self ) : <EOL> vs_elf . Elf32Dynamic . __init__ ( self ) <EOL> ElfDynamic . __init__ ( self ) <EOL> class Elf64Dynamic ( ElfDynamic , vs_elf . Elf64Dynamic ) : <EOL> def __init__ ( self ) : <EOL> vs_elf . Elf64Dynamic . __init__ ( self ) <EOL> ElfDynamic . __init__ ( self ) <EOL> class ElfSymbol : <EOL> def __init__ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> def getInfoType ( self ) : <EOL> return self . st_info & <NUM_LIT> <EOL> def getInfoBind ( self ) : <EOL> return self . st_info >> <NUM_LIT:4> <EOL> def setStInfo ( self , bind , typ ) : <EOL> self . st_info &= <NUM_LIT:0> <EOL> self . st_info |= ( ( bind << <NUM_LIT:4> ) & <NUM_LIT> ) <EOL> self . st_info |= ( typ & <NUM_LIT> ) <EOL> def setStOther ( self , val ) : <EOL> self . st_other &= <NUM_LIT:0> <EOL> self . st_other |= ( val & <NUM_LIT> ) <EOL> def __cmp__ ( self , other ) : <EOL> if self . st_value > other . st_value : <EOL> return <NUM_LIT:1> <EOL> return - <NUM_LIT:1> <EOL> def setName ( self , name ) : <EOL> self . name = name <EOL> def getName ( self ) : <EOL> return self . name <EOL> def __repr__ ( self ) : <EOL> return "<STR_LIT>" % ( self . st_value , self . st_size , self . name ) <EOL> class Elf32Symbol ( ElfSymbol , vs_elf . Elf32Symbol ) : <EOL> def __init__ ( self ) : <EOL> vs_elf . Elf32Symbol . __init__ ( self ) <EOL> ElfSymbol . __init__ ( self ) <EOL> class Elf64Symbol ( ElfSymbol , vs_elf . Elf64Symbol ) : <EOL> def __init__ ( self ) : <EOL> vs_elf . Elf64Symbol . __init__ ( self ) <EOL> ElfSymbol . __init__ ( self ) <EOL> class ElfPheader : <EOL> def __init__ ( self ) : <EOL> pass <EOL> def getTypeName ( self ) : <EOL> return ph_types . get ( self . p_type , "<STR_LIT>" ) <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % ( <EOL> self . getTypeName ( ) , <EOL> self . p_vaddr , <EOL> self . p_offset , <EOL> self . p_memsz , <EOL> self . p_align , <EOL> self . p_filesz , <EOL> self . p_flags ) <EOL> class Elf32Pheader ( ElfPheader , vs_elf . Elf32Pheader ) : <EOL> def __init__ ( self ) : <EOL> vs_elf . Elf32Pheader . __init__ ( self ) <EOL> ElfPheader . __init__ ( self ) <EOL> class Elf64Pheader ( ElfPheader , vs_elf . Elf64Pheader ) : <EOL> def __init__ ( self ) : <EOL> vs_elf . Elf64Pheader . __init__ ( self ) <EOL> ElfPheader . __init__ ( self ) <EOL> class ElfSection : <EOL> def __init__ ( self ) : <EOL> self . name = '<STR_LIT>' <EOL> def setName ( self , name ) : <EOL> self . name = name <EOL> def getName ( self ) : <EOL> return self . name <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % ( <EOL> self . name , <EOL> self . sh_addr , <EOL> self . sh_offset , <EOL> self . sh_entsize , <EOL> self . sh_size , <EOL> self . sh_addralign ) <EOL> class Elf32Section ( ElfSection , vs_elf . Elf32Section ) : <EOL> def __init__ ( self ) : <EOL> vs_elf . Elf32Section . __init__ ( self ) <EOL> ElfSection . __init__ ( self ) <EOL> class Elf64Section ( ElfSection , vs_elf . Elf64Section ) : <EOL> def __init__ ( self ) : <EOL> vs_elf . Elf64Section . __init__ ( self ) <EOL> ElfSection . __init__ ( self ) <EOL> class Elf ( vs_elf . Elf32 , vs_elf . Elf64 ) : <EOL> def __init__ ( self , fd , inmem = False ) : <EOL> e = vs_elf . Elf32 ( ) <EOL> fd . seek ( <NUM_LIT:0> ) <EOL> bytes = fd . read ( len ( e ) ) <EOL> e . vsParse ( bytes ) <EOL> if e . e_machine in e_machine_32 : <EOL> vs_elf . Elf32 . __init__ ( self ) <EOL> self . bits = <NUM_LIT:32> <EOL> self . psize = <NUM_LIT:4> <EOL> elif e . e_machine in e_machine_64 : <EOL> vs_elf . Elf64 . __init__ ( self ) <EOL> self . bits = <NUM_LIT:64> <EOL> self . psize = <NUM_LIT:8> <EOL> else : <EOL> raise Exception ( '<STR_LIT>' % e . e_machine ) <EOL> self . fd = fd <EOL> bytes = self . readAtOffset ( <NUM_LIT:0> , len ( self ) ) <EOL> self . vsParse ( bytes ) <EOL> if self . e_machine == EM_386 : <EOL> self . r_types = r_types_386 <EOL> elif self . e_machine == EM_X86_64 : <EOL> self . r_types = r_types_amd64 <EOL> else : <EOL> self . r_types = { } <EOL> self . pheaders = [ ] <EOL> self . sections = [ ] <EOL> self . secnames = { } <EOL> self . symbols = [ ] <EOL> self . relocs = [ ] <EOL> self . symbols_by_name = { } <EOL> self . symbols_by_addr = { } <EOL> self . dynamics = [ ] <EOL> self . dynamic_symbols = [ ] <EOL> self . _parsePheaders ( ) <EOL> self . _parseSections ( ) <EOL> self . _parseSymbols ( ) <EOL> self . _parseDynamic ( ) <EOL> self . _parseRelocs ( ) <EOL> def getRelocTypeName ( self , rtype ) : <EOL> '''<STR_LIT>''' <EOL> return self . r_types . get ( rtype ) <EOL> def _parsePheaders ( self ) : <EOL> if self . e_phoff : <EOL> pbase = self . e_phoff <EOL> plen = self . e_phentsize <EOL> for i in range ( self . e_phnum ) : <EOL> if self . bits == <NUM_LIT:32> : <EOL> pgm = Elf32Pheader ( ) <EOL> elif self . bits == <NUM_LIT:64> : <EOL> pgm = Elf64Pheader ( ) <EOL> else : <EOL> raise Exception ( '<STR_LIT>' % ( self . bits ) ) <EOL> bytes = self . readAtOffset ( pbase , plen ) <EOL> pgm . vsParse ( bytes ) <EOL> self . pheaders . append ( pgm ) <EOL> pbase += plen <EOL> def _parseSections ( self ) : <EOL> if self . e_shoff : <EOL> sbase = self . e_shoff <EOL> slen = self . e_shentsize <EOL> for i in range ( self . e_shnum ) : <EOL> if self . bits == <NUM_LIT:32> : <EOL> sec = Elf32Section ( ) <EOL> elif self . bits == <NUM_LIT:64> : <EOL> sec = Elf64Section ( ) <EOL> else : <EOL> raise Exception ( '<STR_LIT>' % ( self . bits ) ) <EOL> bytes = self . readAtOffset ( sbase , slen ) <EOL> sec . vsParse ( bytes ) <EOL> self . sections . append ( sec ) <EOL> sbase += slen <EOL> strsec = self . sections [ self . e_shstrndx ] <EOL> names = self . readAtOffset ( strsec . sh_offset , strsec . sh_size ) <EOL> for sec in self . sections : <EOL> name = names [ sec . sh_name : ] . split ( "<STR_LIT:\x00>" ) [ <NUM_LIT:0> ] <EOL> if len ( name ) > <NUM_LIT:0> : <EOL> sec . setName ( name ) <EOL> self . secnames [ name ] = sec <EOL> def _parseSymbols ( self ) : <EOL> """<STR_LIT>""" <EOL> for sec in self . sections : <EOL> if sec . sh_type == SHT_SYMTAB : <EOL> symtab = self . readAtOffset ( sec . sh_offset , sec . sh_size ) <EOL> while symtab : <EOL> if self . bits == <NUM_LIT:32> : <EOL> newsym = Elf32Symbol ( ) <EOL> elif self . bits == <NUM_LIT:64> : <EOL> newsym = Elf64Symbol ( ) <EOL> else : <EOL> raise Exception ( '<STR_LIT>' % ( self . bits ) ) <EOL> newsym . vsParse ( symtab ) <EOL> if newsym . st_name : <EOL> name = self . getStrtabString ( newsym . st_name , "<STR_LIT>" ) <EOL> newsym . setName ( name ) <EOL> self . addSymbol ( newsym ) <EOL> symtab = symtab [ len ( newsym ) : ] <EOL> def _parseDynamic ( self ) : <EOL> symtab = self . getSectionBytes ( '<STR_LIT>' ) <EOL> if symtab == None : <EOL> return <EOL> while symtab : <EOL> if self . bits == <NUM_LIT:32> : <EOL> newsym = Elf32Symbol ( ) <EOL> elif self . bits == <NUM_LIT:64> : <EOL> newsym = Elf64Symbol ( ) <EOL> else : <EOL> raise Exception ( '<STR_LIT>' % ( self . bits ) ) <EOL> newsym . vsParse ( symtab ) <EOL> if newsym . st_name : <EOL> name = self . getStrtabString ( newsym . st_name , "<STR_LIT>" ) <EOL> newsym . setName ( name ) <EOL> self . dynamic_symbols . append ( newsym ) <EOL> symtab = symtab [ len ( newsym ) : ] <EOL> dynbytes = self . getSectionBytes ( '<STR_LIT>' ) <EOL> while dynbytes : <EOL> if self . bits == <NUM_LIT:32> : <EOL> dyn = Elf32Dynamic ( ) <EOL> elif self . bits == <NUM_LIT:64> : <EOL> dyn = Elf64Dynamic ( ) <EOL> else : <EOL> raise Exception ( '<STR_LIT>' % ( self . bits ) ) <EOL> dyn . vsParse ( dynbytes ) <EOL> if dyn . d_tag in Elf32Dynamic . has_string : <EOL> name = self . getStrtabString ( dyn . d_value , "<STR_LIT>" ) <EOL> dyn . setName ( name ) <EOL> self . dynamics . append ( dyn ) <EOL> if dyn . d_tag == DT_NULL : <EOL> break <EOL> dynbytes = dynbytes [ len ( dyn ) : ] <EOL> def _parseRelocs ( self ) : <EOL> """<STR_LIT>""" <EOL> for sec in self . sections : <EOL> if sec . sh_type == SHT_REL : <EOL> bytes = self . readAtOffset ( sec . sh_offset , sec . sh_size ) <EOL> while bytes : <EOL> if self . bits == <NUM_LIT:32> : <EOL> reloc = Elf32Reloc ( self . r_types ) <EOL> elif self . bits == <NUM_LIT:64> : <EOL> reloc = Elf64Reloc ( self . r_types ) <EOL> else : <EOL> raise Exception ( '<STR_LIT>' % ( self . bits ) ) <EOL> reloc . vsParse ( bytes ) <EOL> index = reloc . getSymTabIndex ( ) <EOL> try : <EOL> sym = self . dynamic_symbols [ index ] <EOL> reloc . setName ( sym . getName ( ) ) <EOL> except : <EOL> traceback . print_exc ( ) <EOL> self . relocs . append ( reloc ) <EOL> bytes = bytes [ len ( reloc ) : ] <EOL> elif sec . sh_type == SHT_RELA : <EOL> bytes = self . readAtOffset ( sec . sh_offset , sec . sh_size ) <EOL> while bytes : <EOL> if self . bits == <NUM_LIT:32> : <EOL> reloc = Elf32Reloca ( self . r_types ) <EOL> elif self . bits == <NUM_LIT:64> : <EOL> reloc = Elf64Reloca ( self . r_types ) <EOL> else : <EOL> raise Exception ( '<STR_LIT>' % ( self . bits ) ) <EOL> reloc . vsParse ( bytes ) <EOL> index = reloc . getSymTabIndex ( ) <EOL> try : <EOL> sym = self . dynamic_symbols [ index ] <EOL> reloc . setName ( sym . getName ( ) ) <EOL> except : <EOL> traceback . print_exc ( ) <EOL> self . relocs . append ( reloc ) <EOL> bytes = bytes [ len ( reloc ) : ] <EOL> def getBaseAddress ( self ) : <EOL> """<STR_LIT>""" <EOL> shrd = self . isSharedObject ( ) <EOL> plnk = self . isPreLinked ( ) <EOL> if shrd and not plnk : <EOL> return <NUM_LIT> <EOL> base = None <EOL> for pgm in self . getPheaders ( ) : <EOL> if pgm . p_vaddr == <NUM_LIT:0> : <EOL> continue <EOL> if base == None : <EOL> base = pgm . p_vaddr <EOL> continue <EOL> if pgm . p_vaddr < base : <EOL> base = pgm . p_vaddr <EOL> base &= <NUM_LIT> <EOL> return base <EOL> def writeDynamic ( self ) : <EOL> secsize = self . setFdAtSection ( '<STR_LIT>' ) <EOL> if self . bits == <NUM_LIT:32> : <EOL> sym = Elf32Symbol ( ) <EOL> elif self . bits == <NUM_LIT:64> : <EOL> sym = Elf64Symbol ( ) <EOL> else : <EOL> raise Exception ( '<STR_LIT>' % ( self . bits ) ) <EOL> dsize = len ( sym ) * len ( self . dynamic_symbols ) <EOL> if dsize != secsize : <EOL> raise Exception ( "<STR_LIT>" % ( dsize , secsize ) ) <EOL> for sym in self . dynamic_symbols : <EOL> symbytes = sym . vsEmit ( ) <EOL> self . fd . write ( symbytes ) <EOL> def modStrtabString ( self , offset , newstr , section = "<STR_LIT>" ) : <EOL> oldstr = self . getStrtabString ( offset , section ) <EOL> if len ( newstr ) > len ( oldstr ) : <EOL> raise Exception ( "<STR_LIT>" <EOL> "<STR_LIT>" % ( len ( oldstr ) , len ( newstr ) ) ) <EOL> self . setFdAtSection ( section , offset ) <EOL> self . fd . write ( newstr ) <EOL> return None <EOL> def setSoname ( self , name ) : <EOL> for dyn in self . dynamics : <EOL> if dyn . d_tag == DT_SONAME : <EOL> self . modStrtabString ( dyn . d_value , name , "<STR_LIT>" ) <EOL> break <EOL> def readAtRva ( self , rva , size ) : <EOL> '''<STR_LIT>''' <EOL> return self . readAtOffset ( self . rvaToOffset ( rva ) , size ) <EOL> def rvaToOffset ( self , rva ) : <EOL> '''<STR_LIT>''' <EOL> baseaddr = <NUM_LIT:0> <EOL> for pgm in self . pheaders : <EOL> if pgm . p_type != PT_LOAD : <EOL> continue <EOL> phrva = pgm . p_vaddr - baseaddr <EOL> if rva < phrva : <EOL> continue <EOL> if rva >= phrva + pgm . p_memsz : <EOL> continue <EOL> print '<STR_LIT>' , hex ( pgm . p_vaddr ) , hex ( phrva ) , hex ( rva ) <EOL> rvaoff = rva - phrva <EOL> return pgm . p_offset + rvaoff <EOL> raise '<STR_LIT>' , hex ( rva ) <EOL> return None <EOL> def readAtOffset ( self , off , size ) : <EOL> '''<STR_LIT>''' <EOL> self . fd . seek ( off ) <EOL> return self . fd . read ( size ) <EOL> def getSection ( self , secname ) : <EOL> return self . secnames . get ( secname , None ) <EOL> def getSections ( self ) : <EOL> """<STR_LIT>""" <EOL> return list ( self . sections ) <EOL> def getSectionBytes ( self , secname ) : <EOL> sec = self . getSection ( secname ) <EOL> if sec == None : <EOL> return None <EOL> return self . readAtOffset ( sec . sh_offset , sec . sh_size ) <EOL> def setFdOffset ( self , off ) : <EOL> '''<STR_LIT>''' <EOL> self . fd . seek ( off ) <EOL> return None <EOL> def setFdAtSection ( self , secname , offset = <NUM_LIT:0> ) : <EOL> sec = self . getSection ( secname ) <EOL> if sec == None : <EOL> return <NUM_LIT:0> <EOL> self . setFdOffset ( sec . sh_offset + offset ) <EOL> return sec . sh_size <EOL> def getStrtabString ( self , offset , section = "<STR_LIT>" ) : <EOL> sec = self . getSection ( section ) <EOL> bytes = self . readAtOffset ( sec . sh_offset , sec . sh_size ) <EOL> index = bytes . find ( "<STR_LIT:\x00>" , offset ) <EOL> return bytes [ offset : index ] <EOL> def getDynamics ( self ) : <EOL> '''<STR_LIT>''' <EOL> return list ( self . dynamics ) <EOL> def getDynSyms ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . dynamic_symbols <EOL> def getRelocs ( self ) : <EOL> '''<STR_LIT>''' <EOL> return list ( self . relocs ) <EOL> def isPreLinked ( self ) : <EOL> '''<STR_LIT>''' <EOL> for dyn in self . dynamics : <EOL> if dyn . d_tag == DT_GNU_PRELINKED : <EOL> return True <EOL> if dyn . d_tag == DT_GNU_CONFLICTSZ : <EOL> return True <EOL> return False <EOL> def isSharedObject ( self ) : <EOL> '''<STR_LIT>''' <EOL> if self . e_type == ET_DYN : <EOL> return True <EOL> return False <EOL> def __repr__ ( self , verbose = False ) : <EOL> """<STR_LIT>""" <EOL> mystr = '<STR_LIT>' <EOL> mystr += "<STR_LIT>" <EOL> mystr += "<STR_LIT>" + self . e_ident <EOL> mystr += "<STR_LIT>" + e_types . get ( self . e_type ) <EOL> mystr += "<STR_LIT>" + e_machine_types . get ( self . e_machine ) <EOL> mystr += "<STR_LIT>" % ( self . e_version ) <EOL> mystr += "<STR_LIT>" % ( self . e_entry ) <EOL> mystr += "<STR_LIT>" % ( self . e_phoff , self . e_phoff ) <EOL> mystr += "<STR_LIT>" % ( self . e_shoff , self . e_shoff ) <EOL> mystr += "<STR_LIT>" + repr ( self . e_flags ) + "<STR_LIT:U+0020>" <EOL> mystr += "<STR_LIT>" + repr ( self . e_ehsize ) + "<STR_LIT>" + hex ( self . e_ehsize ) + "<STR_LIT>" <EOL> mystr += "<STR_LIT>" + repr ( self . e_phentsize ) + "<STR_LIT>" + hex ( self . e_phentsize ) + "<STR_LIT>" <EOL> mystr += "<STR_LIT>" + repr ( self . e_phnum ) + "<STR_LIT>" + hex ( self . e_phnum ) + "<STR_LIT:)>" <EOL> mystr += "<STR_LIT>" + repr ( self . e_shentsize ) + "<STR_LIT>" + hex ( self . e_shentsize ) + "<STR_LIT>" <EOL> mystr += "<STR_LIT>" + repr ( self . e_shnum ) + "<STR_LIT>" + hex ( self . e_shnum ) + "<STR_LIT:)>" <EOL> mystr += "<STR_LIT>" + repr ( self . e_shstrndx ) + "<STR_LIT>" + hex ( self . e_shstrndx ) + "<STR_LIT>" <EOL> mystr += "<STR_LIT>" <EOL> for sec in self . sections : <EOL> mystr += "<STR_LIT:\n>" + repr ( sec ) <EOL> mystr += "<STR_LIT>" <EOL> for ph in self . pheaders : <EOL> mystr += "<STR_LIT:\n>" + repr ( ph ) <EOL> return mystr <EOL> def verbrepr ( self ) : <EOL> mystr = repr ( self ) <EOL> mystr += "<STR_LIT>" <EOL> for sym in self . symbols : <EOL> mystr += "<STR_LIT:\n>" + repr ( sym ) <EOL> mystr += "<STR_LIT>" <EOL> for reloc in self . relocs : <EOL> mystr += "<STR_LIT:\n>" + repr ( reloc ) <EOL> mystr += "<STR_LIT>" <EOL> for dyn in self . dynamics : <EOL> mystr += "<STR_LIT:\n>" + repr ( dyn ) <EOL> mystr += "<STR_LIT>" <EOL> for dyn in self . dynamic_symbols : <EOL> mystr += "<STR_LIT:\n>" + repr ( dyn ) <EOL> return mystr <EOL> def lookupSymbolName ( self , name ) : <EOL> """<STR_LIT>""" <EOL> return self . symbols_by_name . get ( name , None ) <EOL> def lookupSymbolAddr ( self , address ) : <EOL> """<STR_LIT>""" <EOL> return self . symbols_by_addr . get ( address , None ) <EOL> def getPheaders ( self ) : <EOL> """<STR_LIT>""" <EOL> return list ( self . pheaders ) <EOL> def addSymbol ( self , symbol ) : <EOL> self . symbols . append ( symbol ) <EOL> self . symbols_by_name [ symbol . getName ( ) ] = symbol <EOL> self . symbols_by_addr [ symbol . st_value ] = symbol <EOL> def getSymbols ( self ) : <EOL> return self . symbols <EOL> def getRelocType ( val ) : <EOL> return val & <NUM_LIT> <EOL> def getRelocSymTabIndex ( val ) : <EOL> return val >> <NUM_LIT:8> </s>
