23 #define SHT_PROGBITS 0x1 // The data is contained in the program file. 24 #define SHT_SYMTAB 0x2 // Symbol table 25 #define SHT_STRTAB 0x3 // String table 27 #define SHT_HASH 0x5 // Symbol hash table 28 #define SHT_DYNAMIC 0x6 // Dynamic linking information 30 #define SHT_NOBITS 0x8 // The data is not contained in the program file. 32 #define SHT_DYNSYM 0xb 33 #define SHT_INIT_ARRAY 0xe 34 #define SHT_FINI_ARRAY 0xf 35 #define SHT_PREINIT_ARRAY 0x10 39 #define SHF_EXECINSTR 0x4 40 #define SHF_MASKPROC 0xf0000000 42 #define ELF32_R_SYM(val) ((val) >> 8) 43 #define ELF32_R_TYPE(val) ((val) &0xff) 45 #define ELF32_ST_BIND(i) ((i) >> 4) 46 #define ELF32_ST_TYPE(i) ((i) &0xf) 47 #define ELF32_ST_INFO(b, t) (((b) << 4) + ((t) &0xf)) 48 #define PACKED __attribute__((packed)) 51 typedef unsigned char uint8_t;
52 typedef unsigned short uint16_t;
53 typedef unsigned int uint32_t;
55 typedef unsigned int size_t;
72 Elf32(
const char *name);
83 bool load(uint8_t *pBuffer,
unsigned int nBufferLength);
88 bool load(BootstrapInfo *pBootstrap);
109 const char *
lookupSymbol(
unsigned int addr,
unsigned int *startAddr = 0);
160 struct Elf32ProcessHeader_t
172 struct Elf32SectionHeader_t
212 Elf32Header_t *m_pHeader;
213 Elf32SectionHeader_t *m_pSymbolTable;
214 Elf32SectionHeader_t *m_pStringTable;
215 Elf32SectionHeader_t *m_pShstrtab;
216 Elf32SectionHeader_t *m_pGotTable;
217 Elf32SectionHeader_t *m_pRelTable;
218 Elf32SectionHeader_t *m_pSectionHeaders;
unsigned int getLastAddress()
uint32_t getGlobalOffsetTable()
const char * lookupSymbol(unsigned int addr, unsigned int *startAddr=0)
char * lookupDynamicSymbolName(uint32_t off)
uint32_t lookupDynamicSymbolAddress(uint32_t off)
Elf32 & operator=(const Elf32 &)
uint8_t * m_pBuffer
Offset of the file in memory.
bool load(uint8_t *pBuffer, unsigned int nBufferLength)