[PATCH 2/3] ELF/BFD: Propagate the return status from backend section processing

Maciej W. Rozycki macro@mips.com
Fri Feb 2 17:23:00 GMT 2018


Fix the issue of any failure from `->elf_backend_section_processing' 
not being propagated by `_bfd_elf_write_object_contents'.  The MIPS 
`_bfd_mips_elf_section_processing' handler can actually potentially 
fail, however the caller currently ignores that.

	bfd/
	* elf.c (_bfd_elf_write_object_contents): Propagate a failure 
	status from `->elf_backend_section_processing'.
---
Hi,

 I think this qualifies as obvious really.  No regressions across my usual 
targets (only the MIPS handler containss code that allows it to fail 
anyway).  OK to apply?

  Maciej
---
 bfd/elf.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

binutils-bfd-elf-backend-section-processing-error.diff
Index: binutils/bfd/elf.c
===================================================================
--- binutils.orig/bfd/elf.c	2018-01-30 18:07:24.110281697 +0000
+++ binutils/bfd/elf.c	2018-02-01 01:34:41.603581368 +0000
@@ -6354,7 +6354,8 @@ _bfd_elf_write_object_contents (bfd *abf
 	= _bfd_elf_strtab_offset (elf_shstrtab (abfd),
 				  i_shdrp[count]->sh_name);
       if (bed->elf_backend_section_processing)
-	(*bed->elf_backend_section_processing) (abfd, i_shdrp[count]);
+	if (!(*bed->elf_backend_section_processing) (abfd, i_shdrp[count]))
+	  return FALSE;
       if (i_shdrp[count]->contents)
 	{
 	  bfd_size_type amt = i_shdrp[count]->sh_size;



More information about the Binutils mailing list