On Tue, 2014-02-25 at 09:28 -0800, Josh Stone wrote:
On 02/25/2014 01:43 AM, Florian Weimer wrote:
> On 02/24/2014 05:54 PM, Mark Wielaard wrote:
>
>>> Is there a reliable way to recognize separate debugging information?
>>> Then I could avoid extracting data from phdrs.
>>
>> I looked a bit into this and I don't see any way to detect that the
>> phdrs are invalid, unless you already know this is a separate debuginfo
>> file and not a real/valid ELF file.
>
> Could you change the debuginfo extraction to clearly mark the resulting
> ELF files as separate debuginfo? This would help dealing with this in
> the future.
And/or, could the debuginfo extraction keep the .interp section? The
rest of the phdr offsets would still be meaningless, of course, but
INTERP/.interp is both tiny and useful.
Even if we keep it, it should then be at the same offset in the file
that the phdrs claim it to be. Which is unlikely since we remove the
contents of some sections, updating the sections in shdrs, but not the
segments in phdrs...
I think we really need some way to mark the ELF files as having a
"bad" (or maybe call it "detached") phdrs. Maybe some new ehdr
e_ident,
e_type or e_flag to indicate a partial/debug/stripped-out ELF file? That
would of course need coordination with the rest of the toolchain so all
tools set and recognize it.
Cheers,
mark