[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 15:43:29 PST 2011
Sounds good, just checking.
On Jan 14, 2011, at 2:19 PM, Stephen Wilson wrote:
> Greg Clayton <gclayton at apple.com> writes:
>
>> Could a bootloader ELF file have an entry point of zero? Should this be:
>
> Interesting question. I have never seen one myself (but that does not
> mean they do not exist).
>
> However the spec specifically says that if an ELF does not have an entry
> point then this field must be zero. For that reason I think this should
> be a relatively safe test.
>
>
>> 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
>>
>
>
>
> --
> steve
More information about the lldb-commits
mailing list