}
if (binary->isELF()) {
- bool is64bit = (binary->getData()[4] == 0x02);
+ typedef ELFFile<ELFT> ELFO;
+ const ELFO * elffile = o->getELFFile();
+ const typename ELFO::Elf_Ehdr * header = elffile->getHeader();
- for (int i(0); i < (is64bit? 8 : 4); ++i) {
- if (binary->isLittleEndian()) {
- _entryAddress |= (unsigned int)((unsigned char)binary->getData()[0x18 + i]) << 8*i;
- } else {
- _entryAddress = _entryAddress << 8;
- _entryAddress |= (unsigned char)binary->getData()[0x18 + i];
- }
- }
+ _entryAddress = header->e_entry;
LOG4CXX_DEBUG(logger, "Adding entryAddress at: " << std::hex << _entryAddress);
std::stringstream s;
s << "<_start 0x" << std::hex << _entryAddress << ">";