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

Message ID alpine.DEB.2.00.1802020122170.3553@tp.orcam.me.uk
State New
Headers show
Series
  • MIPS: Correctly report unsupported `.reginfo' section size in GAS/objcopy
Related show

Commit Message

Maciej W. Rozycki Feb. 2, 2018, 5:23 p.m.
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

Comments

Nick Clifton Feb. 3, 2018, 12:59 p.m. | #1
Hi Maciej,

> 	bfd/

> 	* elf.c (_bfd_elf_write_object_contents): Propagate a failure 

> 	status from `->elf_backend_section_processing'.


Approved - please apply.

>  I think this qualifies as obvious really.


yes, I would agree with that.

Cheers
  Nick

PS. Still thinking about patch 1 in your series.  Will respond in the next few days.

Patch

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;