tidy elf_backend calls

Function pointers in elfNN_bed that are initialized by elfxx-target.h
to non-zero values generally don't need a non-NULL test before calling
them.  Targets don't set a non-NULL function to NULL.  The one
exception being elfnn-ia64.c and that exception is removed here.

	* elf.c (_bfd_elf_setup_sections): Don't test known non-NULL
	backend functions for NULL before calling.
	(copy_special_section_fields, _bfd_elf_copy_private_bfd_data),
	(bfd_section_from_shdr, assign_section_numbers): Likewise.
	* elfcode.h (elf_write_relocs, elf_slurp_reloc_table): Likewise.
	* elfnn-ia64.c (ignore_errors): New function.
	(elf_backend_link_order_error_handler): Redefine as ignore_errors.
This commit is contained in:
Alan Modra
2020-03-18 07:31:47 +10:30
parent ce2ea1c7e0
commit a859124df2
4 changed files with 37 additions and 27 deletions
+6 -8
View File
@@ -987,12 +987,11 @@ elf_write_relocs (bfd *abfd, asection *sec, void *data)
(*swap_out) (abfd, &src_rela, dst_rela);
}
if (bed->write_secondary_relocs != NULL)
if (! bed->write_secondary_relocs (abfd, sec))
{
*failedp = TRUE;
return;
}
if (!bed->write_secondary_relocs (abfd, sec))
{
*failedp = TRUE;
return;
}
}
/* Write out the program headers. */
@@ -1596,8 +1595,7 @@ elf_slurp_reloc_table (bfd *abfd,
symbols, dynamic))
return FALSE;
if (bed->slurp_secondary_relocs != NULL
&& ! bed->slurp_secondary_relocs (abfd, asect, symbols))
if (!bed->slurp_secondary_relocs (abfd, asect, symbols))
return FALSE;
asect->relocation = relents;