[Lldb-commits] [PATCH 3/8] Test if an ELF object is executable by checking if an entry point is defined.

Greg Clayton gclayton at apple.com
Fri Jan 14 13:34:58 PST 2011


Could a bootloader ELF file have an entry point of zero? Should this be:

bool
ObjectFileELF::IsExecutable() const
{
    return m_header.e_entry != LLDB_INVALID_ADDRESS;
}

And then you would need to make sure that m_header.e_entry always gets initialized to LLDB_INVALID_ADDRESS?


On Jan 14, 2011, at 1:12 PM, Stephen Wilson wrote:

> The previous check on header type ET_EXEC is not general enough.  Position
> independent executables have type ET_DYN.
> ---
> source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
> index 5b99d01..f58c779 100644
> --- a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
> +++ b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
> @@ -159,7 +159,7 @@ ObjectFileELF::~ObjectFileELF()
> bool
> ObjectFileELF::IsExecutable() const
> {
> -    return m_header.e_type == ET_EXEC;
> +    return m_header.e_entry != 0;
> }
> 
> Address
> -- 
> 1.7.3.5
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits





More information about the lldb-commits mailing list