Re: [PATCH] [dwarf2read] Fix crash when loading dwp files: calculate num_sections based on actual section indices, not just the number of sections.

Simon Marchi
2019-02-27T04:41:33Z

On 2019-02-26 11:24, Simon Marchi wrote:
> On 2019-02-26 10:08, Tom Tromey wrote:
>>>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
>>
>>>> - dwp_file->num_sections = bfd_count_sections (dwp_file->dbfd) + 1;
>>>> + dwp_file->num_sections = elf_numsections (dwp_file->dbfd);
>>
>> Simon> I have tweaked the original commit message a bit and pushed.
>> Simon> Thanks again for the patch.
>>
>> I wonder if there's any way to reach this with a non-ELF objfile --
>> Mach-O seems probable. I think we also handle DWARF on AIX (ECOFF
>> IIRC)
>> but I don't know if that does dwp.
>
> Oh, maybe. Unfortunately, I don't have access to a Mac to test this
> at the moment.
>
> I'll give it a try on gcc119.fsffrance.org for AIX.
>
> Simon

So my impression now is that dwp doesn't apply to non-ELF projects. It
is built as part of gold, which itself deals only with ELF, AFAIK. I
tried to build gold on AIX, without success.

Simon