diff --git a/core/elf.cc b/core/elf.cc index 1edb5858a8..e51d20900f 100644 --- a/core/elf.cc +++ b/core/elf.cc @@ -25,6 +25,7 @@ #include #include #include +#include "api/elf.h" #include "arch.hh" @@ -181,10 +182,10 @@ const char * object::symbol_name(const Elf64_Sym * sym) { } void* object::entry_point() const { - if (!_is_executable) { - return nullptr; + if (_is_executable || _ehdr.e_type == ET_EXEC) { + return _base + _ehdr.e_entry; } - return _base + _ehdr.e_entry; + return nullptr; } file::file(program& prog, ::fileref f, std::string pathname)