ELF/BFD: Propagate the return status from backend section processing
authorMaciej W. Rozycki <macro@mips.com>
Mon, 5 Feb 2018 14:00:21 +0000 (14:00 +0000)
committerMaciej W. Rozycki <macro@mips.com>
Mon, 5 Feb 2018 14:00:21 +0000 (14:00 +0000)
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'.

bfd/ChangeLog
bfd/elf.c

index b651051b91040d69621aa2873579b3149b8bfa61..091e363d8c997d4d6ee2b5b6d6f3e9c8bc39ef6f 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-05  Maciej W. Rozycki  <macro@mips.com>
+
+       * elf.c (_bfd_elf_write_object_contents): Propagate a failure
+       status from `->elf_backend_section_processing'.
+
 2018-02-02  Jim Wilson  <jimw@sifive.com>
 
        PR ld/22756
index d71efd1e0f775466c429ec81d143cea00d310e8c..dedf35feb3c468d020025b3528a2c6544107db04 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -6354,7 +6354,8 @@ _bfd_elf_write_object_contents (bfd *abfd)
        = _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;