gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / bfd / elf32-h8300.c
index 40680fa3f59efdf5b212b4d1b393babe86ca351f..5488500b1712d685788d2d168da5e196bb531bb9 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for Renesas H8/300 ELF binaries.
-   Copyright (C) 1993-2019 Free Software Foundation, Inc.
+   Copyright (C) 1993-2020 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -23,6 +23,7 @@
 #include "libbfd.h"
 #include "elf-bfd.h"
 #include "elf/h8.h"
+#include "cpu-h8300.h"
 
 static reloc_howto_type *elf32_h8_reloc_type_lookup
   (bfd *abfd, bfd_reloc_code_real_type code);
@@ -502,7 +503,7 @@ elf32_h8_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
              name = (bfd_elf_string_from_elf_section
                      (input_bfd, symtab_hdr->sh_link, sym->st_name));
              if (name == NULL || *name == '\0')
-               name = bfd_section_name (input_bfd, sec);
+               name = bfd_section_name (sec);
            }
 
          switch (r)
@@ -583,8 +584,8 @@ elf32_h8_mach (flagword flags)
    file.  We use this opportunity to encode the BFD machine type
    into the flags field in the object file.  */
 
-static void
-elf32_h8_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+elf32_h8_final_write_processing (bfd *abfd)
 {
   unsigned long val;
 
@@ -622,7 +623,7 @@ elf32_h8_final_write_processing (bfd *abfd, bfd_boolean linker)
 
   elf_elfheader (abfd)->e_flags &= ~ (EF_H8_MACH);
   elf_elfheader (abfd)->e_flags |= val;
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 /* Return nonzero if ABFD represents a valid H8 ELF object file; also
@@ -1464,21 +1465,17 @@ elf32_h8_relax_section (bfd *abfd, asection *sec,
        }
     }
 
-  if (internal_relocs != NULL
-      && elf_section_data (sec)->relocs != internal_relocs)
+  if (elf_section_data (sec)->relocs != internal_relocs)
     free (internal_relocs);
 
   return TRUE;
 
  error_return:
-  if (isymbuf != NULL
-      && symtab_hdr->contents != (unsigned char *) isymbuf)
+  if (symtab_hdr->contents != (unsigned char *) isymbuf)
     free (isymbuf);
-  if (contents != NULL
-      && elf_section_data (sec)->this_hdr.contents != contents)
+  if (elf_section_data (sec)->this_hdr.contents != contents)
     free (contents);
-  if (internal_relocs != NULL
-      && elf_section_data (sec)->relocs != internal_relocs)
+  if (elf_section_data (sec)->relocs != internal_relocs)
     free (internal_relocs);
   return FALSE;
 }
@@ -1681,10 +1678,8 @@ elf32_h8_get_relocated_section_contents (bfd *output_bfd,
                                       isymbuf, sections))
        goto error_return;
 
-      if (sections != NULL)
-       free (sections);
-      if (isymbuf != NULL
-         && symtab_hdr->contents != (unsigned char *) isymbuf)
+      free (sections);
+      if (symtab_hdr->contents != (unsigned char *) isymbuf)
        free (isymbuf);
       if (elf_section_data (input_section)->relocs != internal_relocs)
        free (internal_relocs);
@@ -1693,13 +1688,10 @@ elf32_h8_get_relocated_section_contents (bfd *output_bfd,
   return data;
 
  error_return:
-  if (sections != NULL)
-    free (sections);
-  if (isymbuf != NULL
-      && symtab_hdr->contents != (unsigned char *) isymbuf)
+  free (sections);
+  if (symtab_hdr->contents != (unsigned char *) isymbuf)
     free (isymbuf);
-  if (internal_relocs != NULL
-      && elf_section_data (input_section)->relocs != internal_relocs)
+  if (elf_section_data (input_section)->relocs != internal_relocs)
     free (internal_relocs);
   return NULL;
 }
This page took 0.026744 seconds and 4 git commands to generate.