#include <loader/ElfBinaryFile.h>
Inheritance diagram for ElfBinaryFile:
Definition at line 152 of file ElfBinaryFile.h.
Public Member Functions | |
void | AddSymbol (ADDRESS uNative, const char *pName) |
void | applyRelocations () |
virtual void | Close () |
void | dumpSymbols () |
ElfBinaryFile (bool bArchive=false) | |
ADDRESS | GetAddressByName (const char *pName, bool bNoTypeOK=false) |
virtual std::list< const char * > | getDependencyList () |
int | GetDistanceByName (const char *pName, const char *pSectName) |
int | GetDistanceByName (const char *pName) |
virtual std::map< ADDRESS, const char * > * | GetDynamicGlobalMap () |
virtual ADDRESS | GetEntryPoint () |
virtual std::list< SectionInfo * > & | GetEntryPoints (const char *pEntry="main") |
virtual std::vector< ADDRESS > | GetExportedAddresses (bool funcsOnly=true) |
virtual const char * | getFilename () const |
virtual const char * | getFilenameSymbolFor (const char *sym) |
virtual LOAD_FMT | GetFormat () const |
virtual ADDRESS | getImageBase () |
virtual size_t | getImageSize () |
virtual ADDRESS * | GetImportStubs (int &numImports) |
virtual MACHINE | GetMachine () const |
virtual ADDRESS | GetMainEntryPoint () |
bool | GetNextMember () |
ADDRESS | GetRelocatedAddress (ADDRESS uNative) |
int | GetSizeByName (const char *pName, bool bNoTypeOK=false) |
char * | GetStrPtr (int idx, int offset) |
virtual std::map< ADDRESS, std::string > & | getSymbols () |
bool | IsAddressRelocatable (ADDRESS uNative) |
bool | IsDynamicLinkedProc (ADDRESS wNative) |
virtual bool | isLibrary () const |
virtual bool | IsRelocationAt (ADDRESS uNative) |
ADDRESS | NativeToHostAddress (ADDRESS uNative) |
virtual bool | Open (const char *sName) |
int | readNative1 (ADDRESS a) |
int | readNative2 (ADDRESS a) |
int | readNative4 (ADDRESS a) |
QWord | readNative8 (ADDRESS a) |
float | readNativeFloat4 (ADDRESS a) |
double | readNativeFloat8 (ADDRESS a) |
void | SetLinkAndInfo (int idx, int link, int info) |
const char * | SymbolByAddress (ADDRESS uAddr) |
virtual void | UnLoad () |
void | writeNative4 (ADDRESS nat, unsigned int n) |
void | writeObjectFile (std::string &path, const char *name, void *ptxt, int txtsz, RelocMap &reloc) |
virtual | ~ElfBinaryFile () |
Public Attributes | |
const char * | m_pFileName |
Protected Member Functions | |
virtual bool | RealLoad (const char *sName) |
Private Member Functions | |
void | AddRelocsAsSyms (int secIndex) |
void | AddSyms (int secIndex) |
int | elfRead2 (short *ps) const |
int | elfRead4 (int *pi) const |
void | elfWrite4 (int *pi, int val) |
ADDRESS | findRelPltOffset (int i, ADDRESS addrRelPlt, int sizeRelPlt, int numRelPlt, ADDRESS addrPlt) |
void | Init () |
bool | PostLoad (void *handle) |
int | ProcessElfFile () |
bool | SearchValueByName (const char *pName, SymValue *pVal, const char *pSectName, const char *pStrName) |
bool | SearchValueByName (const char *pName, SymValue *pVal) |
void | SetRelocInfo (PSectionInfo pSect) |
bool | ValueByName (const char *pName, SymValue *pVal, bool bNoTypeOK=false) |
Private Attributes | |
ADDRESS | first_extern |
bool | m_bAddend |
char | m_elfEndianness |
std::list< SectionInfo * > | m_EntryPoint |
FILE * | m_fd |
int | m_iLastSize |
long | m_lImageSize |
char * | m_pImage |
ADDRESS * | m_pImportStubs |
Elf32_Phdr * | m_pPhdrs |
Elf32_Rel * | m_pReloc |
Elf32_Shdr * | m_pShdrs |
char * | m_pStrings |
Elf32_Sym * | m_pSym |
SymTab | m_Reloc |
int * | m_sh_info |
int * | m_sh_link |
std::map< ADDRESS, std::string > | m_SymTab |
ADDRESS | m_uBaseAddr |
size_t | m_uImageSize |
ADDRESS | m_uLastAddr |
ADDRESS | m_uPltMax |
ADDRESS | m_uPltMin |
ADDRESS | next_extern |
|
Definition at line 47 of file ElfBinaryFile.cpp. References Init(), m_fd, and m_pFileName. |
|
Definition at line 56 of file ElfBinaryFile.cpp. References m_pImportStubs. |
|
Definition at line 452 of file ElfBinaryFile.cpp. References elfRead2(), elfRead4(), BinaryFile::GetSectionInfo(), GetStrPtr(), m_pReloc, BinaryFile::m_pSections, m_pSym, m_sh_link, m_SymTab, next_extern, R_386_32, R_386_PC32, STT_SECTION, SectionInfo::uHostAddr, SectionInfo::uNativeAddr, SectionInfo::uSectionEntrySize, SectionInfo::uSectionSize, and writeNative4(). |
|
Reimplemented from BinaryFile. Definition at line 1274 of file ElfBinaryFile.cpp. References m_SymTab. Referenced by applyRelocations(). |
|
Definition at line 335 of file ElfBinaryFile.cpp. References E_REL, e_type, ELF32_ST_TYPE, elfRead2(), elfRead4(), findRelPltOffset(), BinaryFile::GetSectionInfo(), BinaryFile::GetSectionInfoByName(), GetStrPtr(), m_pImage, BinaryFile::m_pSections, m_pSym, m_sh_link, m_SymTab, NULL, STT_FUNC, SectionInfo::uHostAddr, SectionInfo::uNativeAddr, SectionInfo::uSectionEntrySize, and SectionInfo::uSectionSize. |
|
Definition at line 1060 of file ElfBinaryFile.cpp. References AddSymbol(), E_REL, ELF32_ST_TYPE, elfRead2(), elfRead4(), elfWrite4(), EM_386, EM_SPARC, BinaryFile::GetSectionInfo(), BinaryFile::GetSectionInfoByAddr(), m_pImage, BinaryFile::m_pSections, m_sh_info, m_sh_link, SHT_REL, size, STT_SECTION, SectionInfo::uHostAddr, and SectionInfo::uNativeAddr. |
|
Implements BinaryFile. Definition at line 757 of file ElfBinaryFile.cpp. References UnLoad(). |
|
Definition at line 1279 of file ElfBinaryFile.cpp. References m_SymTab. |
|
Definition at line 924 of file ElfBinaryFile.cpp. References m_elfEndianness. Referenced by AddRelocsAsSyms(), AddSyms(), applyRelocations(), elfRead4(), GetMachine(), isLibrary(), IsRelocationAt(), readNative2(), RealLoad(), SearchValueByName(), and ValueByName(). |
|
Definition at line 934 of file ElfBinaryFile.cpp. References elfRead2(), and m_elfEndianness. Referenced by AddRelocsAsSyms(), AddSyms(), applyRelocations(), findRelPltOffset(), GetEntryPoint(), IsRelocationAt(), readNative4(), RealLoad(), SearchValueByName(), and ValueByName(). |
|
Definition at line 942 of file ElfBinaryFile.cpp. References m_elfEndianness. Referenced by applyRelocations(). |
|
Definition at line 312 of file ElfBinaryFile.cpp. References elfRead4(). Referenced by AddSyms(). |
|
Reimplemented from BinaryFile. Definition at line 615 of file ElfBinaryFile.cpp. References SymValue::iSymSize, m_iLastSize, m_uLastAddr, NO_ADDRESS, SymValue::uSymAddr, and ValueByName(). Referenced by GetDistanceByName(), GetEntryPoints(), and GetMainEntryPoint(). |
|
Implements BinaryFile. Definition at line 789 of file ElfBinaryFile.cpp. References Elf32_Dyn::d_ptr, Elf32_Dyn::d_tag, Elf32_Dyn::d_un, Elf32_Dyn::d_val, DT_NEEDED, DT_NULL, DT_STRTAB, BinaryFile::GetSectionInfoByName(), NativeToHostAddress(), NO_ADDRESS, NULL, result, and SectionInfo::uHostAddr. |
|
Definition at line 640 of file ElfBinaryFile.cpp. References GetAddressByName(), BinaryFile::GetSectionInfoByName(), GetSizeByName(), size, Elf32_Sym::st_value, SectionInfo::uHostAddr, SectionInfo::uSectionEntrySize, and SectionInfo::uSectionSize. |
|
Definition at line 677 of file ElfBinaryFile.cpp. |
|
Reimplemented from BinaryFile. Definition at line 880 of file ElfBinaryFile.cpp. References ELF32_R_SYM, BinaryFile::GetSectionIndexByName(), BinaryFile::GetSectionInfoByName(), GetStrPtr(), Elf32_Sym::st_name, SectionInfo::uHostAddr, SectionInfo::uSectionEntrySize, and SectionInfo::uSectionSize. |
|
Implements BinaryFile. Definition at line 725 of file ElfBinaryFile.cpp. References elfRead4(), and m_pImage. |
|
Implements BinaryFile. Definition at line 698 of file ElfBinaryFile.cpp. References GetAddressByName(), BinaryFile::GetSectionInfoByName(), m_EntryPoint, SectionInfo::uHostAddr, SectionInfo::uNativeAddr, and SectionInfo::uSectionSize. |
|
Reimplemented from BinaryFile. Definition at line 400 of file ElfBinaryFile.cpp. References BinaryFile::m_pSections, and SHT_SYMTAB. |
|
Implements BinaryFile. Definition at line 163 of file ElfBinaryFile.h. References m_pFileName. |
|
Reimplemented from BinaryFile. Definition at line 1227 of file ElfBinaryFile.cpp. References BinaryFile::m_pSections, and SHT_SYMTAB. |
|
Implements BinaryFile. Definition at line 761 of file ElfBinaryFile.cpp. References LOADFMT_ELF. |
|
Implements BinaryFile. Definition at line 818 of file ElfBinaryFile.cpp. References m_uBaseAddr. |
|
Implements BinaryFile. Definition at line 822 of file ElfBinaryFile.cpp. References m_uImageSize. |
|
Reimplemented from BinaryFile. Definition at line 834 of file ElfBinaryFile.cpp. |
|
Implements BinaryFile. Definition at line 765 of file ElfBinaryFile.cpp. References elfRead2(), EM_386, EM_68K, EM_PA_RISC, EM_PPC, EM_SPARC, EM_SPARC32PLUS, EM_ST20, EM_X86_64, m_pImage, MACHINE_HPRISC, MACHINE_PALM, MACHINE_PENTIUM, MACHINE_PPC, MACHINE_SPARC, and MACHINE_ST20. |
|
Implements BinaryFile. Definition at line 721 of file ElfBinaryFile.cpp. References GetAddressByName(). |
|
|
|
Definition at line 735 of file ElfBinaryFile.cpp. |
|
Reimplemented from BinaryFile. Definition at line 627 of file ElfBinaryFile.cpp. References SymValue::iSymSize, m_iLastSize, m_uLastAddr, SymValue::uSymAddr, and ValueByName(). Referenced by GetDistanceByName(). |
|
Definition at line 294 of file ElfBinaryFile.cpp. References BinaryFile::m_pSections. Referenced by AddRelocsAsSyms(), AddSyms(), GetDynamicGlobalMap(), and ValueByName(). |
|
Reimplemented from BinaryFile. Definition at line 234 of file ElfBinaryFile.h. References m_SymTab. |
|
Definition at line 65 of file ElfBinaryFile.cpp. References m_iLastSize, m_pImage, m_pImportStubs, m_pPhdrs, m_pReloc, m_pShdrs, m_pStrings, m_pSym, m_uPltMax, and m_uPltMin. Referenced by ElfBinaryFile(), and UnLoad(). |
|
|
|
Reimplemented from BinaryFile. Definition at line 683 of file ElfBinaryFile.cpp. References first_extern, m_uPltMax, m_uPltMin, and next_extern. |
|
Implements BinaryFile. Definition at line 784 of file ElfBinaryFile.cpp. References elfRead2(), ET_DYN, and m_pImage. |
|
Reimplemented from BinaryFile. Definition at line 1168 of file ElfBinaryFile.cpp. References E_REL, elfRead2(), elfRead4(), EM_386, EM_SPARC, BinaryFile::GetSectionInfoByAddr(), m_pImage, BinaryFile::m_pSections, m_sh_info, SHT_REL, size, SectionInfo::uHostAddr, and SectionInfo::uNativeAddr. |
|
Definition at line 730 of file ElfBinaryFile.cpp. References BinaryFile::m_pSections, SectionInfo::uHostAddr, and SectionInfo::uNativeAddr. Referenced by getDependencyList(). |
|
Implements BinaryFile. Definition at line 752 of file ElfBinaryFile.cpp. |
|
Implements BinaryFile. Definition at line 740 of file ElfBinaryFile.cpp. |
|
|
|
Reimplemented from BinaryFile. Definition at line 958 of file ElfBinaryFile.cpp. References BinaryFile::GetSectionInfo(), BinaryFile::GetSectionInfoByAddr(), SectionInfo::uHostAddr, and SectionInfo::uNativeAddr. |
|
Reimplemented from BinaryFile. Definition at line 968 of file ElfBinaryFile.cpp. References elfRead2(), BinaryFile::GetSectionInfoByAddr(), SectionInfo::uHostAddr, and SectionInfo::uNativeAddr. |
|
Reimplemented from BinaryFile. Definition at line 976 of file ElfBinaryFile.cpp. References elfRead4(), BinaryFile::GetSectionInfoByAddr(), SectionInfo::uHostAddr, and SectionInfo::uNativeAddr. Referenced by readNative8(), readNativeFloat4(), and readNativeFloat8(). |
|
Reimplemented from BinaryFile. Definition at line 1001 of file ElfBinaryFile.cpp. References m_elfEndianness, and readNative4(). |
|
Reimplemented from BinaryFile. Definition at line 1021 of file ElfBinaryFile.cpp. References readNative4(). |
|
Reimplemented from BinaryFile. Definition at line 1029 of file ElfBinaryFile.cpp. References m_elfEndianness, and readNative4(). |
|
Implements BinaryFile. Definition at line 102 of file ElfBinaryFile.cpp. References Elf32_Ehdr::e_ident, Elf32_Ehdr::e_phoff, Elf32_Ehdr::e_shnum, Elf32_Ehdr::e_shoff, Elf32_Ehdr::e_shstrndx, elfRead2(), elfRead4(), Elf32_Ehdr::endianness, BinaryFile::m_bArchive, m_elfEndianness, m_fd, BinaryFile::m_iNumSections, m_lImageSize, m_pFileName, m_pImage, m_pPhdrs, BinaryFile::m_pSections, m_pShdrs, m_pStrings, m_sh_info, m_sh_link, NULL, and size. |
|
Definition at line 574 of file ElfBinaryFile.cpp. References E_REL, elfRead2(), elfRead4(), BinaryFile::GetSectionInfo(), BinaryFile::GetSectionInfoByName(), SymValue::iSymSize, m_pImage, SectionInfo::uHostAddr, SectionInfo::uNativeAddr, SectionInfo::uSectionEntrySize, SectionInfo::uSectionSize, and SymValue::uSymAddr. |
|
Definition at line 608 of file ElfBinaryFile.cpp. Referenced by ValueByName(). |
|
|
|
|
|
Reimplemented from BinaryFile. Definition at line 500 of file ElfBinaryFile.cpp. References m_SymTab. |
|
Implements BinaryFile. Definition at line 286 of file ElfBinaryFile.cpp. References Init(), m_fd, and m_pImage. Referenced by Close(). |
|
Definition at line 507 of file ElfBinaryFile.cpp. References E_REL, ELF32_ST_TYPE, elf_hash(), elfRead2(), elfRead4(), BinaryFile::GetSectionIndexByName(), BinaryFile::GetSectionInfo(), BinaryFile::GetSectionInfoByName(), GetStrPtr(), SymValue::iSymSize, m_pImage, SearchValueByName(), STT_NOTYPE, SectionInfo::uHostAddr, SectionInfo::uNativeAddr, and SymValue::uSymAddr. Referenced by GetAddressByName(), and GetSizeByName(). |
|
Definition at line 983 of file ElfBinaryFile.cpp. References BinaryFile::GetSectionInfoByAddr(), m_elfEndianness, SectionInfo::uHostAddr, and SectionInfo::uNativeAddr. Referenced by AddRelocsAsSyms(). |
|
|
|
Definition at line 289 of file ElfBinaryFile.h. Referenced by IsDynamicLinkedProc(). |
|
Definition at line 280 of file ElfBinaryFile.h. |
|
Definition at line 273 of file ElfBinaryFile.h. Referenced by elfRead2(), elfRead4(), elfWrite4(), readNative8(), readNativeFloat8(), RealLoad(), and writeNative4(). |
|
Definition at line 285 of file ElfBinaryFile.h. Referenced by GetEntryPoints(). |
|
Definition at line 267 of file ElfBinaryFile.h. Referenced by ElfBinaryFile(), RealLoad(), and UnLoad(). |
|
Definition at line 282 of file ElfBinaryFile.h. Referenced by GetAddressByName(), GetSizeByName(), and Init(). |
|
Definition at line 268 of file ElfBinaryFile.h. Referenced by RealLoad(). |
|
Definition at line 244 of file ElfBinaryFile.h. Referenced by ElfBinaryFile(), getFilename(), and RealLoad(). |
|
Definition at line 269 of file ElfBinaryFile.h. Referenced by AddSyms(), applyRelocations(), GetEntryPoint(), GetMachine(), Init(), isLibrary(), IsRelocationAt(), RealLoad(), SearchValueByName(), UnLoad(), and ValueByName(). |
|
Definition at line 286 of file ElfBinaryFile.h. Referenced by Init(), and ~ElfBinaryFile(). |
|
Definition at line 270 of file ElfBinaryFile.h. Referenced by Init(), and RealLoad(). |
|
Definition at line 278 of file ElfBinaryFile.h. Referenced by AddRelocsAsSyms(), and Init(). |
|
Definition at line 271 of file ElfBinaryFile.h. Referenced by Init(), and RealLoad(). |
|
Definition at line 272 of file ElfBinaryFile.h. Referenced by Init(), and RealLoad(). |
|
Definition at line 279 of file ElfBinaryFile.h. Referenced by AddRelocsAsSyms(), AddSyms(), and Init(). |
|
Definition at line 277 of file ElfBinaryFile.h. |
|
Definition at line 292 of file ElfBinaryFile.h. Referenced by applyRelocations(), IsRelocationAt(), and RealLoad(). |
|
Definition at line 291 of file ElfBinaryFile.h. Referenced by AddRelocsAsSyms(), AddSyms(), applyRelocations(), and RealLoad(). |
|
Definition at line 274 of file ElfBinaryFile.h. Referenced by AddRelocsAsSyms(), AddSymbol(), AddSyms(), dumpSymbols(), GetImportStubs(), getSymbols(), and SymbolByAddress(). |
|
Definition at line 287 of file ElfBinaryFile.h. Referenced by getImageBase(). |
|
Definition at line 288 of file ElfBinaryFile.h. Referenced by getImageSize(). |
|
Definition at line 281 of file ElfBinaryFile.h. Referenced by GetAddressByName(), and GetSizeByName(). |
|
Definition at line 284 of file ElfBinaryFile.h. Referenced by Init(), and IsDynamicLinkedProc(). |
|
Definition at line 283 of file ElfBinaryFile.h. Referenced by GetImportStubs(), Init(), and IsDynamicLinkedProc(). |
|
Definition at line 290 of file ElfBinaryFile.h. Referenced by AddRelocsAsSyms(), and IsDynamicLinkedProc(). |