[PATCH] PR binutils/18218: bad handling of .debug_str_offsets section

Doug Evans dje@google.com
Fri Apr 10 18:31:00 GMT 2015


On Thu, Apr 9, 2015 at 1:29 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Apr 9, 2015 at 12:35 PM, Doug Evans <dje@google.com> wrote:
>> H.J. Lu writes:
>>  > On Thu, Apr 9, 2015 at 11:03 AM, Doug Evans <dje@google.com> wrote:
>>  > > On Thu, Apr 9, 2015 at 10:41 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>  > >>> Even better, treat the "sec" argument to load_specific_debug_section
>>  > >>> as "const Elf_Internal_Shdr * sec".
>>  > >>> Modifying sec->sh_size to be the size of the now-uncompressed section
>>  > >>> is fragile and what led to this bug. Leave this data be the
>>  > >>> representation of what's actually on disk, and build on it, not modify
>>  > >>> it.
>>  > >>
>>  > >> We need to update sh_size to get readelf to work right.
>>  > >
>>  > > I don't understand.
>>  > > There are lots of ways to make readelf work right.
>>  > > Some better than others.
>>  >
>>  > Patches are welcome.
>>
>> I would have expected a more technical explanation of why
>> the proposed patch is ok.
>>
>> How about this?
>>
>> [I can imagine there's more work to do along these lines.
>> At least this headed in a good direction.
>>
>> Ultimately, I can imagine adding a backlink from
>> dwarf_section to Elf_Internal_Shdr, though a more sound
>> proposal would need more research.]
>>
>> 2015-04-09  Doug Evans  <dje@google.com>
>>
>>         PR binutils/18218
>>         * readelf.c (printable_section_name): Constify sec argument.
>>         (apply_relocations): Ditto.  New arg "size".  All callers updated.
>>         (load_specific_debug_section): Constify sec argument.
>>         Remove side-effect of modifying sec->sh_size.
>>
>
> It looks good to me.  Does it pass "make check"?

On amd64-linux, yes.



More information about the Binutils mailing list