]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - bfd/cisco-core.c
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / bfd / cisco-core.c
index c2858159066be0086a66b39ed16829d03e69b03a..db63ba9bfb202e0925e0a00b360de8fc5b53fd0a 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for CISCO crash dumps.
-   Copyright (C) 1994-2017 Free Software Foundation, Inc.
+   Copyright (C) 1994-2022 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -80,7 +80,7 @@ struct cisco_core_struct
 /* Examine the file for a crash info struct at the offset given by
    CRASH_INFO_LOC.  */
 
-static const bfd_target *
+static bfd_cleanup
 cisco_core_file_validate (bfd *abfd, int crash_info_loc)
 {
   char buf[4];
@@ -92,7 +92,7 @@ cisco_core_file_validate (bfd *abfd, int crash_info_loc)
   unsigned int rambase;
   sec_ptr asect;
   struct stat statbuf;
-  bfd_size_type amt;
+  size_t amt;
   flagword flags;
 
   if (bfd_seek (abfd, (file_ptr) crash_info_loc, SEEK_SET) != 0)
@@ -274,7 +274,7 @@ cisco_core_file_validate (bfd *abfd, int crash_info_loc)
   nread = statbuf.st_size - asect->filepos;
   asect->size = (nread < 1024) ? nread : 1024;
 
-  return abfd->xvec;
+  return _bfd_no_cleanup;
 
   /* Get here if we have already started filling out the BFD
      and there is an error of some kind.  */
@@ -286,19 +286,19 @@ cisco_core_file_validate (bfd *abfd, int crash_info_loc)
   return NULL;
 }
 
-static const bfd_target *
+static bfd_cleanup
 cisco_core_file_p (bfd *abfd)
 {
   int *crash_info_locp;
-  const bfd_target *target = NULL;
+  bfd_cleanup cleanup = NULL;
 
   for (crash_info_locp = crash_info_locs;
-       *crash_info_locp != -1  &&  target == NULL;
+       *crash_info_locp != -1 && cleanup == NULL;
        crash_info_locp++)
     {
-      target = cisco_core_file_validate (abfd, *crash_info_locp);
+      cleanup = cisco_core_file_validate (abfd, *crash_info_locp);
     }
-  return (target);
+  return cleanup;
 }
 
 static char *
@@ -317,102 +317,112 @@ extern const bfd_target core_cisco_le_vec;
 
 const bfd_target core_cisco_be_vec =
 {
-    "cisco-ios-core-big",
-    bfd_target_unknown_flavour,
-    BFD_ENDIAN_BIG,            /* target byte order */
-    BFD_ENDIAN_BIG,            /* target headers byte order */
-    (HAS_RELOC | EXEC_P |      /* object flags */
-     HAS_LINENO | HAS_DEBUG |
-     HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
-    0,                         /* symbol prefix */
-    ' ',                       /* ar_pad_char */
-    16,                                /* ar_max_namelen */
-    0,                         /* match priority.  */
-    bfd_getb64, bfd_getb_signed_64, bfd_putb64,
-    bfd_getb32, bfd_getb_signed_32, bfd_putb32,
-    bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
-    bfd_getb64, bfd_getb_signed_64, bfd_putb64,
-    bfd_getb32, bfd_getb_signed_32, bfd_putb32,
-    bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
-
-    {                          /* bfd_check_format */
-     _bfd_dummy_target,                /* unknown format */
-     _bfd_dummy_target,                /* object file */
-     _bfd_dummy_target,                /* archive */
-     cisco_core_file_p /* a core file */
-    },
-    {                          /* bfd_set_format */
-     bfd_false, bfd_false,
-     bfd_false, bfd_false
-    },
-    {                          /* bfd_write_contents */
-     bfd_false, bfd_false,
-     bfd_false, bfd_false
-    },
-
-       BFD_JUMP_TABLE_GENERIC (_bfd_generic),
-       BFD_JUMP_TABLE_COPY (_bfd_generic),
-       BFD_JUMP_TABLE_CORE (cisco),
-       BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
-       BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
-       BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
-       BFD_JUMP_TABLE_WRITE (_bfd_generic),
-       BFD_JUMP_TABLE_LINK (_bfd_nolink),
-       BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-    & core_cisco_le_vec,
-
-    NULL       /* backend_data */
+  "cisco-ios-core-big",
+  bfd_target_unknown_flavour,
+  BFD_ENDIAN_BIG,              /* target byte order */
+  BFD_ENDIAN_BIG,              /* target headers byte order */
+  (HAS_RELOC | EXEC_P          /* object flags */
+   | HAS_LINENO | HAS_DEBUG
+   | HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
+  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
+  0,                           /* symbol prefix */
+  ' ',                         /* ar_pad_char */
+  16,                          /* ar_max_namelen */
+  0,                           /* match priority.  */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
+  bfd_getb64, bfd_getb_signed_64, bfd_putb64,
+  bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+  bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
+  bfd_getb64, bfd_getb_signed_64, bfd_putb64,
+  bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+  bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
+
+  {                            /* bfd_check_format */
+    _bfd_dummy_target,                 /* unknown format */
+    _bfd_dummy_target,                 /* object file */
+    _bfd_dummy_target,                 /* archive */
+    cisco_core_file_p                  /* a core file */
+  },
+  {                            /* bfd_set_format */
+    _bfd_bool_bfd_false_error,
+    _bfd_bool_bfd_false_error,
+    _bfd_bool_bfd_false_error,
+    _bfd_bool_bfd_false_error
+  },
+  {                            /* bfd_write_contents */
+    _bfd_bool_bfd_false_error,
+    _bfd_bool_bfd_false_error,
+    _bfd_bool_bfd_false_error,
+    _bfd_bool_bfd_false_error
+  },
+
+  BFD_JUMP_TABLE_GENERIC (_bfd_generic),
+  BFD_JUMP_TABLE_COPY (_bfd_generic),
+  BFD_JUMP_TABLE_CORE (cisco),
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
+  BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
+  BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
+  BFD_JUMP_TABLE_WRITE (_bfd_generic),
+  BFD_JUMP_TABLE_LINK (_bfd_nolink),
+  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
+  &core_cisco_le_vec,
+
+  NULL                         /* backend_data */
 };
 
 const bfd_target core_cisco_le_vec =
 {
-    "cisco-ios-core-little",
-    bfd_target_unknown_flavour,
-    BFD_ENDIAN_LITTLE,         /* target byte order */
-    BFD_ENDIAN_LITTLE,         /* target headers byte order */
-    (HAS_RELOC | EXEC_P |      /* object flags */
-     HAS_LINENO | HAS_DEBUG |
-     HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
-    0,                                                    /* symbol prefix */
-    ' ',                                                  /* ar_pad_char */
-    16,                                                           /* ar_max_namelen */
-    0,                         /* match_priority */
-    bfd_getl64, bfd_getl_signed_64, bfd_putl64,
-    bfd_getl32, bfd_getl_signed_32, bfd_putl32,
-    bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
-    bfd_getl64, bfd_getl_signed_64, bfd_putl64,
-    bfd_getl32, bfd_getl_signed_32, bfd_putl32,
-    bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-
-    {                          /* bfd_check_format */
-     _bfd_dummy_target,                /* unknown format */
-     _bfd_dummy_target,                /* object file */
-     _bfd_dummy_target,                /* archive */
-     cisco_core_file_p /* a core file */
-    },
-    {                          /* bfd_set_format */
-     bfd_false, bfd_false,
-     bfd_false, bfd_false
-    },
-    {                          /* bfd_write_contents */
-     bfd_false, bfd_false,
-     bfd_false, bfd_false
-    },
-
-       BFD_JUMP_TABLE_GENERIC (_bfd_generic),
-       BFD_JUMP_TABLE_COPY (_bfd_generic),
-       BFD_JUMP_TABLE_CORE (cisco),
-       BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
-       BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
-       BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
-       BFD_JUMP_TABLE_WRITE (_bfd_generic),
-       BFD_JUMP_TABLE_LINK (_bfd_nolink),
-       BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
-    &core_cisco_be_vec,
-
-    NULL                       /* backend_data */
+  "cisco-ios-core-little",
+  bfd_target_unknown_flavour,
+  BFD_ENDIAN_LITTLE,           /* target byte order */
+  BFD_ENDIAN_LITTLE,           /* target headers byte order */
+  (HAS_RELOC | EXEC_P          /* object flags */
+   | HAS_LINENO | HAS_DEBUG
+   | HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
+  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
+  0,                           /* symbol prefix */
+  ' ',                         /* ar_pad_char */
+  16,                          /* ar_max_namelen */
+  0,                           /* match_priority */
+  TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
+  bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+  bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+  bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
+  bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+  bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+  bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
+
+  {                            /* bfd_check_format */
+    _bfd_dummy_target,                 /* unknown format */
+    _bfd_dummy_target,                 /* object file */
+    _bfd_dummy_target,                 /* archive */
+    cisco_core_file_p                  /* a core file */
+  },
+  {                            /* bfd_set_format */
+    _bfd_bool_bfd_false_error,
+    _bfd_bool_bfd_false_error,
+    _bfd_bool_bfd_false_error,
+    _bfd_bool_bfd_false_error
+  },
+  {                            /* bfd_write_contents */
+    _bfd_bool_bfd_false_error,
+    _bfd_bool_bfd_false_error,
+    _bfd_bool_bfd_false_error,
+    _bfd_bool_bfd_false_error
+  },
+
+  BFD_JUMP_TABLE_GENERIC (_bfd_generic),
+  BFD_JUMP_TABLE_COPY (_bfd_generic),
+  BFD_JUMP_TABLE_CORE (cisco),
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
+  BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
+  BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
+  BFD_JUMP_TABLE_WRITE (_bfd_generic),
+  BFD_JUMP_TABLE_LINK (_bfd_nolink),
+  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
+  &core_cisco_be_vec,
+
+  NULL                         /* backend_data */
 };