[PATCH REVIEW 10/10] bfd, ld, libctf: skip zero-refcount strings in CTF string reporting
Tue Mar 2 14:26:19 GMT 2021
On 1 Mar 2021, Nick Clifton via Binutils spake thusly:
>> diff --git a/bfd/ChangeLog b/bfd/ChangeLog
>> index 2fef817d734..f1b4e8a2a46 100644
>> --- a/bfd/ChangeLog
>> +++ b/bfd/ChangeLog
>> @@ -1,3 +1,7 @@
>> +2021-02-26 Nick Alcock <firstname.lastname@example.org>
>> + * elf-strtab.c (_bfd_elf_strtab_str): Skip strings with zero refcount.
> Please can changelog entries not be submitted as context diffs.
> They almost never apply cleanly...
Sorry! This is due to my absentmindedly using git format-patch rather
than the alias I normally use to chop them out when sending out patch
mails. (FWIW, the arcane git syntax needed to automatically elide
ChangeLogs is this line noise:
git format-patch "$@" -- ':!:./**/ChangeLog'
which explains why I normally use an alias.)
>> @@ -302,6 +302,8 @@ _bfd_elf_strtab_str (struct elf_strtab_hash *tab, size_t idx,
>> return 0;
>> BFD_ASSERT (idx < tab->size);
>> BFD_ASSERT (tab->sec_size);
>> + if (tab->array[idx]->refcount == 0)
>> + return 0;
> This should really be "return NULL;". (I know that there is a 'return 0;' a few
> lines above, but that one is wrong too).
I really should have spotted that. Fixed.
>> + ret = _bfd_elf_strtab_str (arg->strtab, arg->next_i++, &off);
>> + } while (ret == 0);
> The while statement should be on its own line. IE:
> while (ret == 0);
... whoops, I had no idea GNU syntax decreed that (though it is
perfectly clear in standards.texi). Will fix. I'll fix up libctf to
follow this too (in a separate commit, coming soon, along with fixing up
some tabdamage etc) since it violates this all over the place.
Will push this batch later today.
More information about the Binutils