* elflink.h (struct elf_final_link_info): Add shndxbuf_size.

(elf_bfd_final_link): Don't bother zeroing symtab_hdr fields.
	Set up a larger symshndxbuf, and write it out.  Free it on
	exit rather than freeing symbuf twice.  Correct section index
	on output section symbol loop.
	(elf_link_output_sym): Accumulate symbol extension section
	indices, reallocating symshndxbuf rather than writing it out.
	(elf_link_flush_output_syms): Don't flush symshndxbuf.
	* elf.c (assign_section_numbers): Init i_shdrp to all zero.
	Use bfd_zalloc to clear i_shdrp[0] too.
This commit is contained in:
Alan Modra
2002-11-04 13:20:56 +00:00
parent f1ef08cb01
commit c97e73ddb6
3 changed files with 63 additions and 29 deletions

View File

@@ -2671,18 +2671,17 @@ assign_section_numbers (abfd)
/* Set up the list of section header pointers, in agreement with the
indices. */
amt = section_number * sizeof (Elf_Internal_Shdr *);
i_shdrp = (Elf_Internal_Shdr **) bfd_alloc (abfd, amt);
i_shdrp = (Elf_Internal_Shdr **) bfd_zalloc (abfd, amt);
if (i_shdrp == NULL)
return false;
amt = sizeof (Elf_Internal_Shdr);
i_shdrp[0] = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt);
i_shdrp[0] = (Elf_Internal_Shdr *) bfd_zalloc (abfd, amt);
if (i_shdrp[0] == NULL)
{
bfd_release (abfd, i_shdrp);
return false;
}
memset (i_shdrp[0], 0, sizeof (Elf_Internal_Shdr));
elf_elfsections (abfd) = i_shdrp;