alloc2 used unnecessarily
authorAlan Modra <amodra@gmail.com>
Wed, 19 Feb 2020 02:44:45 +0000 (13:14 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 19 Feb 2020 02:44:45 +0000 (13:14 +1030)
commit446f7ed5abfd2d0bed8c4442d0634b1a8bc116f4
tree8e1fac2505e01df41dc5991026fb3733f03442bb
parentb03202e32c8235997b3485b0b4655926ad97a1cc
alloc2 used unnecessarily

The bfd_alloc2 series of functions were invented to handle cases where
nmemb * size can overflow.  This patch changes some places where the
calculation can't overflow.

* elf.c (bfd_section_from_shdr): Use bfd_zalloc rather than
bfd_zalloc2.
(assign_section_numbers): Likewise.
(elf_map_symbols): Likewise, and bfd_alloc rather than bfd_alloc2.
(_bfd_elf_map_sections_to_segments): Use bfd_malloc rather than
bfd_malloc2, size_t amt, and unsigned tls_count.
(rewrite_elf_program_header): Use bfd_malloc and size_t amt.
* elflink.c (elf_create_symbuf): Use bfd_malloc.
(elf_output_implib): Use bfd_alloc.
bfd/ChangeLog
bfd/elf.c
bfd/elflink.c