[PATCH] elf: Use elf_link_first_hash_entry for first_hash
H.J. Lu
hjl.tools@gmail.com
Sat Apr 6 00:10:51 GMT 2024
On Fri, Apr 5, 2024 at 4:53 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Fri, Apr 05, 2024 at 04:37:58PM -0700, H.J. Lu wrote:
> > @@ -4341,11 +4377,11 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
> > && htab->first_hash == NULL)
> > {
> > /* Initialize first_hash for an IR input. */
> > - htab->first_hash = (struct bfd_link_hash_table *)
> > - xmalloc (sizeof (struct bfd_link_hash_table));
> > - if (!bfd_hash_table_init (&htab->first_hash->table,
> > - _bfd_link_hash_newfunc,
> > - sizeof (struct bfd_link_hash_entry)))
> > + htab->first_hash = (struct bfd_hash_table *)
> > + xmalloc (sizeof (struct bfd_hash_table));
> > + if (!bfd_hash_table_init
> > + (htab->first_hash, elf_link_first_hash_newfunc,
> > + sizeof (struct elf_link_first_hash_entry)))
> > info->callbacks->einfo
> > (_("%F%P: first_hash failed to initialize: %E\n"));
> > }
>
> I didn't notice this before, but you shouldn't really be using xmalloc
> in libbfd. Yes, as a practical matter it isn't so relevant for
> linker-only bfd functions, but it's probably worth fixing here.
>
>
Done:
https://sourceware.org/pipermail/binutils/2024-April/133419.html
--
H.J.
More information about the Binutils
mailing list