}
}
+ if (binary->isELF()) {
+ bool is64bit = (binary->getData()[4] == 0x02);
+
+ uint64_t entry(0);
+ for (int i(0); i < (is64bit? 8 : 4); ++i) {
+ if (binary->isLittleEndian()) {
+ entry |= (unsigned int)((unsigned char)binary->getData()[0x18 + i]) << 8*i;
+ } else {
+ entry = entry << 8;
+ entry |= (unsigned char)binary->getData()[0x18 + i];
+ }
+ }
+ if (functions.find(entry) == functions.end()) {
+ LOG4CXX_DEBUG(logger, "Adding entry at: " << std::hex << entry);
+ std::stringstream s;
+ s << "<_start 0x" << std::hex << entry << ">";
+ LLVMFunction * fun = new LLVMFunction(s.str(), entry);
+ functions.insert(std::make_pair(entry, fun));
+ remaining_functions.push(fun);
+ }
+ }
+
+ if (functions.empty()) {
+ uint64_t text_entry;
+ text_section.getAddress(text_entry);
+ LOG4CXX_INFO(logger, "No Symbols found, starting at the beginning of the text segment");
+
+ std::stringstream s;
+ s << "<Unnamed 0x" << std::hex << text_entry << ">";
+ LLVMFunction * fun = new LLVMFunction(s.str(), text_entry);
+ functions.insert(std::make_pair(text_entry, fun));
+ remaining_functions.push(fun);
+ }
+
StringRef bytes;
text_section.getContents(bytes);
StringRefMemoryObject ref(bytes);