Revert previous patch.
[platform/upstream/binutils.git] / bfd / oasys.c
index a8f3bb8..e69053b 100644 (file)
@@ -1,5 +1,6 @@
 /* BFD back-end for oasys objects.
-   Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support, <sac@cygnus.com>.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -16,11 +17,12 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #define UNDERSCORE_HACK 1
 #include "bfd.h"
 #include "sysdep.h"
+#include <ctype.h>
 #include "libbfd.h"
 #include "oasys.h"
 #include "liboasys.h"
@@ -33,24 +35,38 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define offsetof(type, identifier) (size_t) &(((type *) 0)->identifier)
 #endif
 
+static boolean oasys_read_record PARAMS ((bfd *,
+                                         oasys_record_union_type *));
 static boolean oasys_write_sections PARAMS ((bfd *));
+static boolean oasys_write_record PARAMS ((bfd *,
+                                          oasys_record_enum_type,
+                                          oasys_record_union_type *,
+                                          size_t));
+static boolean oasys_write_syms PARAMS ((bfd *));
+static boolean oasys_write_header PARAMS ((bfd *));
+static boolean oasys_write_end PARAMS ((bfd *));
+static boolean oasys_write_data PARAMS ((bfd *));
 
 /* Read in all the section data and relocation stuff too */
 PROTO (static boolean, oasys_slurp_section_data, (bfd * CONST abfd));
 
-static void
+static boolean
 oasys_read_record (abfd, record)
-     bfd *CONST abfd;
+     bfd *abfd;
      oasys_record_union_type *record;
 {
-
-  bfd_read ((PTR) record, 1, sizeof (record->header), abfd);
+  if (bfd_read ((PTR) record, 1, sizeof (record->header), abfd)
+      != sizeof (record->header))
+    return false;
 
   if ((size_t) record->header.length <= (size_t) sizeof (record->header))
-    return;
-  bfd_read ((PTR) (((char *) record) + sizeof (record->header)),
-           1, record->header.length - sizeof (record->header),
-           abfd);
+    return true;
+  if (bfd_read ((PTR) (((char *) record) + sizeof (record->header)),
+               1, record->header.length - sizeof (record->header),
+               abfd)
+      != record->header.length - sizeof (record->header))
+    return false;
+  return true;
 }
 static size_t
 oasys_string_length (record)
@@ -103,19 +119,18 @@ oasys_slurp_symbol_table (abfd)
   data->strings = bfd_alloc (abfd, data->symbol_string_length);
 #endif
   if (!data->symbols || !data->strings)
-    {
-      bfd_set_error (bfd_error_no_memory);
-      return false;
-    }
+    return false;
 
   dest_defined = data->symbols + abfd->symcount - 1;
 
   string_ptr = data->strings;
-  bfd_seek (abfd, (file_ptr) 0, SEEK_SET);
+  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+    return false;
   while (loop)
     {
 
-      oasys_read_record (abfd, &record);
+      if (! oasys_read_record (abfd, &record))
+       return false;
       switch (record.header.type)
        {
        case oasys_record_is_header_enum:
@@ -132,7 +147,7 @@ oasys_slurp_symbol_table (abfd)
              {
              case RELOCATION_TYPE_ABS:
                dest = dest_defined--;
-               dest->section = &bfd_abs_section;
+               dest->section = bfd_abs_section_ptr;
                dest->flags = 0;
 
                break;
@@ -160,14 +175,14 @@ oasys_slurp_symbol_table (abfd)
                break;
              case RELOCATION_TYPE_UND:
                dest = data->symbols + bfd_h_get_16 (abfd, record.symbol.refno);
-               dest->section = &bfd_und_section;
+               dest->section = bfd_und_section_ptr;
                break;
              case RELOCATION_TYPE_COM:
                dest = dest_defined--;
                dest->name = string_ptr;
                dest->the_bfd = abfd;
 
-               dest->section = &bfd_com_section;
+               dest->section = bfd_com_section_ptr;
 
                break;
              default:
@@ -177,7 +192,7 @@ oasys_slurp_symbol_table (abfd)
              }
            dest->name = string_ptr;
            dest->the_bfd = abfd;
-           dest->udata = (PTR) NULL;
+           dest->udata.p = (PTR) NULL;
            dest->value = bfd_h_get_32 (abfd, record.symbol.value);
 
 #ifdef UNDERSCORE_HACK
@@ -214,7 +229,7 @@ oasys_get_symtab_upper_bound (abfd)
 /*
 */
 
-extern bfd_target oasys_vec;
+extern const bfd_target oasys_vec;
 
 long
 oasys_get_symtab (abfd, location)
@@ -240,7 +255,7 @@ oasys_get_symtab (abfd, location)
 *  archive stuff
 */
 
-static bfd_target *
+static const bfd_target *
 oasys_archive_p (abfd)
      bfd *abfd;
 {
@@ -249,8 +264,14 @@ oasys_archive_p (abfd)
   unsigned int i;
   file_ptr filepos;
 
-  bfd_seek (abfd, (file_ptr) 0, false);
-  bfd_read ((PTR) & header_ext, 1, sizeof (header_ext), abfd);
+  if (bfd_seek (abfd, (file_ptr) 0, false) != 0
+      || (bfd_read ((PTR) & header_ext, 1, sizeof (header_ext), abfd)
+         != sizeof (header_ext)))
+    {
+      if (bfd_get_error () != bfd_error_system_call)
+       bfd_set_error (bfd_error_wrong_format);
+      return NULL;
+    }
 
   header.version = bfd_h_get_32 (abfd, header_ext.version);
   header.mod_count = bfd_h_get_32 (abfd, header_ext.mod_count);
@@ -271,7 +292,7 @@ oasys_archive_p (abfd)
       header.mod_count > 10000 ||
       header.sym_count > 100000 ||
       header.xref_count > 100000)
-    return (bfd_target *) NULL;
+    return (const bfd_target *) NULL;
 
   /*
     That all worked, let's buy the space for the header and read in
@@ -287,10 +308,7 @@ oasys_archive_p (abfd)
     oasys_module_table_type record;
 
     if (!ar || !module)
-      {
-       bfd_set_error (bfd_error_no_memory);
-       return NULL;
-      }
+      return NULL;
 
     abfd->tdata.oasys_ar_data = ar;
     ar->module = module;
@@ -299,14 +317,17 @@ oasys_archive_p (abfd)
     filepos = header.mod_tbl_offset;
     for (i = 0; i < header.mod_count; i++)
       {
-       bfd_seek (abfd, filepos, SEEK_SET);
+       if (bfd_seek (abfd, filepos, SEEK_SET) != 0)
+         return NULL;
 
        /* There are two ways of specifying the archive header */
 
        if (0)
          {
            oasys_extmodule_table_type_a_type record_ext;
-           bfd_read ((PTR) & record_ext, 1, sizeof (record_ext), abfd);
+           if (bfd_read ((PTR) & record_ext, 1, sizeof (record_ext), abfd)
+               != sizeof (record_ext))
+             return NULL;
 
            record.mod_size = bfd_h_get_32 (abfd, record_ext.mod_size);
            record.file_offset = bfd_h_get_32 (abfd, record_ext.file_offset);
@@ -317,10 +338,7 @@ oasys_archive_p (abfd)
 
            module[i].name = bfd_alloc (abfd, 33);
            if (!module[i].name)
-             {
-               bfd_set_error (bfd_error_no_error);
-               return NULL;
-             }
+             return NULL;
 
            memcpy (module[i].name, record_ext.mod_name, 33);
            filepos +=
@@ -332,7 +350,9 @@ oasys_archive_p (abfd)
        else
          {
            oasys_extmodule_table_type_b_type record_ext;
-           bfd_read ((PTR) & record_ext, 1, sizeof (record_ext), abfd);
+           if (bfd_read ((PTR) & record_ext, 1, sizeof (record_ext), abfd)
+               != sizeof (record_ext))
+             return NULL;
 
            record.mod_size = bfd_h_get_32 (abfd, record_ext.mod_size);
            record.file_offset = bfd_h_get_32 (abfd, record_ext.file_offset);
@@ -344,11 +364,11 @@ oasys_archive_p (abfd)
 
            module[i].name = bfd_alloc (abfd, record.module_name_size + 1);
            if (!module[i].name)
-             {
-               bfd_set_error (bfd_error_no_error);
-               return NULL;
-             }
-           bfd_read ((PTR) module[i].name, 1, record.module_name_size, abfd);
+             return NULL;
+           if (bfd_read ((PTR) module[i].name, 1, record.module_name_size,
+                         abfd)
+               != record.module_name_size)
+             return NULL;
            module[i].name[record.module_name_size] = 0;
            filepos +=
              sizeof (record_ext) +
@@ -377,7 +397,7 @@ oasys_mkobject (abfd)
 }
 
 #define MAX_SECS 16
-static bfd_target *
+static const bfd_target *
 oasys_object_p (abfd)
      bfd *abfd;
 {
@@ -392,7 +412,8 @@ oasys_object_p (abfd)
   memset ((PTR) oasys->sections, 0xff, sizeof (oasys->sections));
 
   /* Point to the start of the file */
-  bfd_seek (abfd, (file_ptr) 0, SEEK_SET);
+  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+    goto fail;
   oasys->symbol_string_length = 0;
   /* Inspect the records, but only keep the section info -
      remember the size of the symbols
@@ -401,7 +422,8 @@ oasys_object_p (abfd)
   while (loop)
     {
       oasys_record_union_type record;
-      oasys_read_record (abfd, &record);
+      if (! oasys_read_record (abfd, &record))
+       goto fail;
       if ((size_t) record.header.length < (size_t) sizeof (record.header))
        goto fail;
 
@@ -429,10 +451,7 @@ oasys_object_p (abfd)
              }
            buffer = bfd_alloc (abfd, 3);
            if (!buffer)
-             {
-               bfd_set_error (bfd_error_no_memory);
-               goto fail;
-             }
+             goto fail;
            section_number = record.section.relb & RELOCATION_SECT_BITS;
            sprintf (buffer, "%u", section_number);
            s = bfd_make_section (abfd, buffer);
@@ -490,13 +509,13 @@ oasys_object_p (abfd)
 fail:
   (void) bfd_release (abfd, oasys);
   abfd->tdata.oasys_obj_data = save;
-  return (bfd_target *) NULL;
+  return (const bfd_target *) NULL;
 }
 
 
 static void
 oasys_get_symbol_info (ignore_abfd, symbol, ret)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      asymbol *symbol;
      symbol_info *ret;
 {
@@ -507,7 +526,7 @@ oasys_get_symbol_info (ignore_abfd, symbol, ret)
 
 static void
 oasys_print_symbol (ignore_abfd, afile, symbol, how)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      PTR afile;
      asymbol *symbol;
      bfd_print_symbol_type how;
@@ -571,10 +590,12 @@ oasys_slurp_section_data (abfd)
   if (data->first_data_record == 0)
     return true;
 
-  bfd_seek (abfd, data->first_data_record, SEEK_SET);
+  if (bfd_seek (abfd, data->first_data_record, SEEK_SET) != 0)
+    return false;
   while (loop)
     {
-      oasys_read_record (abfd, &record);
+      if (! oasys_read_record (abfd, &record))
+       return false;
       switch (record.header.type)
        {
        case oasys_record_is_header_enum:
@@ -598,10 +619,7 @@ oasys_slurp_section_data (abfd)
              {
                per->data = (bfd_byte *) bfd_zalloc (abfd, section->_raw_size);
                if (!per->data)
-                 {
-                   bfd_set_error (bfd_error_no_memory);
-                   return false;
-                 }
+                 return false;
                per->reloc_tail_ptr = (oasys_reloc_type **) & (section->relocation);
                per->had_vma = false;
                per->initialized = true;
@@ -668,10 +686,7 @@ oasys_slurp_section_data (abfd)
                                  bfd_alloc (abfd,
                                             sizeof (oasys_reloc_type));
                                  if (!r)
-                                   {
-                                     bfd_set_error (bfd_error_no_memory);
-                                     return false;
-                                   }
+                                   return false;
                                  *(per->reloc_tail_ptr) = r;
                                  per->reloc_tail_ptr = &r->next;
                                  r->next = (oasys_reloc_type *) NULL;
@@ -715,10 +730,7 @@ oasys_slurp_section_data (abfd)
                                  bfd_alloc (abfd,
                                             sizeof (oasys_reloc_type));
                                  if (!r)
-                                   {
-                                     bfd_set_error (bfd_error_no_memory);
-                                     return false;
-                                   }
+                                   return false;
                                  *(per->reloc_tail_ptr) = r;
                                  per->reloc_tail_ptr = &r->next;
                                  r->next = (oasys_reloc_type *) NULL;
@@ -784,10 +796,7 @@ oasys_new_section_hook (abfd, newsect)
   newsect->used_by_bfd = (PTR)
     bfd_alloc (abfd, sizeof (oasys_per_section_type));
   if (!newsect->used_by_bfd)
-    {
-      bfd_set_error (bfd_error_no_memory);
-      return false;
-    }
+    return false;
   oasys_per_section (newsect)->data = (bfd_byte *) NULL;
   oasys_per_section (newsect)->section = newsect;
   oasys_per_section (newsect)->offset = 0;
@@ -835,10 +844,10 @@ oasys_get_section_contents (abfd, section, location, offset, count)
 
 long
 oasys_canonicalize_reloc (ignore_abfd, section, relptr, symbols)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      sec_ptr section;
      arelent **relptr;
-     asymbol **symbols;
+     asymbol **symbols ATTRIBUTE_UNUSED;
 {
   unsigned int reloc_count = 0;
   oasys_reloc_type *src = (oasys_reloc_type *) (section->relocation);
@@ -868,12 +877,12 @@ oasys_canonicalize_reloc (ignore_abfd, section, relptr, symbols)
 
 
 /* Calculate the checksum and write one record */
-static void
+static boolean
 oasys_write_record (abfd, type, record, size)
-     bfd *CONST abfd;
-     CONST oasys_record_enum_type type;
+     bfd *abfd;
+     oasys_record_enum_type type;
      oasys_record_union_type *record;
-     CONST size_t size;
+     size_t size;
 {
   int checksum;
   size_t i;
@@ -890,14 +899,16 @@ oasys_write_record (abfd, type, record, size)
       checksum += *ptr++;
     }
   record->header.check_sum = 0xff & (-checksum);
-  bfd_write ((PTR) record, 1, size, abfd);
+  if (bfd_write ((PTR) record, 1, size, abfd) != size)
+    return false;
+  return true;
 }
 
 
 /* Write out all the symbols */
-static void
+static boolean
 oasys_write_syms (abfd)
-     bfd *CONST abfd;
+     bfd *abfd;
 {
   unsigned int count;
   asymbol **generic = bfd_get_outsymbols (abfd);
@@ -918,13 +929,13 @@ oasys_write_syms (abfd)
          bfd_h_put_16 (abfd, index, symbol.refno);
          index++;
        }
-      else if (g->section == &bfd_abs_section)
+      else if (bfd_is_abs_section (g->section))
        {
          symbol.relb = RELOCATION_TYPE_ABS;
          bfd_h_put_16 (abfd, 0, symbol.refno);
 
        }
-      else if (g->section == &bfd_und_section)
+      else if (bfd_is_und_section (g->section))
        {
          symbol.relb = RELOCATION_TYPE_UND;
          bfd_h_put_16 (abfd, index, symbol.refno);
@@ -966,20 +977,26 @@ oasys_write_syms (abfd)
 
       if (g->flags & BSF_LOCAL)
        {
-         oasys_write_record (abfd,
-                             oasys_record_is_local_enum,
-                             (oasys_record_union_type *) & symbol,
-                         offsetof (oasys_symbol_record_type, name[0]) + l);
+         if (! oasys_write_record (abfd,
+                                   oasys_record_is_local_enum,
+                                   (oasys_record_union_type *) & symbol,
+                                   offsetof (oasys_symbol_record_type,
+                                             name[0]) + l))
+           return false;
        }
       else
        {
-         oasys_write_record (abfd,
-                             oasys_record_is_symbol_enum,
-                             (oasys_record_union_type *) & symbol,
-                         offsetof (oasys_symbol_record_type, name[0]) + l);
+         if (! oasys_write_record (abfd,
+                                   oasys_record_is_symbol_enum,
+                                   (oasys_record_union_type *) & symbol,
+                                   offsetof (oasys_symbol_record_type,
+                                             name[0]) + l))
+           return false;
        }
       g->value = index - 1;
     }
+
+  return true;
 }
 
 
@@ -993,8 +1010,11 @@ oasys_write_sections (abfd)
 
   for (s = abfd->sections; s != (asection *) NULL; s = s->next)
     {
-      if (!isdigit (s->name[0]))
+      if (!isdigit ((unsigned char) s->name[0]))
        {
+         (*_bfd_error_handler)
+           (_("%s: can not represent section `%s' in oasys"),
+            bfd_get_filename (abfd), s->name);
          bfd_set_error (bfd_error_nonrepresentable_section);
          return false;
        }
@@ -1002,17 +1022,18 @@ oasys_write_sections (abfd)
       bfd_h_put_32 (abfd, s->_cooked_size, out.value);
       bfd_h_put_32 (abfd, s->vma, out.vma);
 
-      oasys_write_record (abfd,
-                         oasys_record_is_section_enum,
-                         (oasys_record_union_type *) & out,
-                         sizeof (out));
+      if (! oasys_write_record (abfd,
+                               oasys_record_is_section_enum,
+                               (oasys_record_union_type *) & out,
+                               sizeof (out)))
+       return false;
     }
   return true;
 }
 
-static void
+static boolean
 oasys_write_header (abfd)
-     bfd *CONST abfd;
+     bfd *abfd;
 {
   /* Create and write the header */
   oasys_header_record_type r;
@@ -1031,18 +1052,19 @@ oasys_write_header (abfd)
 
   r.version_number = OASYS_VERSION_NUMBER;
   r.rev_number = OASYS_REV_NUMBER;
-  oasys_write_record (abfd,
-                     oasys_record_is_header_enum,
-                     (oasys_record_union_type *) & r,
-                     offsetof (oasys_header_record_type, description[0]));
-
-
+  if (! oasys_write_record (abfd,
+                           oasys_record_is_header_enum,
+                           (oasys_record_union_type *) & r,
+                           offsetof (oasys_header_record_type,
+                                     description[0])))
+    return false;
 
+  return true;
 }
 
-static void
+static boolean
 oasys_write_end (abfd)
-     bfd *CONST abfd;
+     bfd *abfd;
 {
   oasys_end_record_type end;
   unsigned char null = 0;
@@ -1050,11 +1072,14 @@ oasys_write_end (abfd)
   bfd_h_put_32 (abfd, abfd->start_address, end.entry);
   bfd_h_put_16 (abfd, 0, end.fill);
   end.zero = 0;
-  oasys_write_record (abfd,
-                     oasys_record_is_end_enum,
-                     (oasys_record_union_type *) & end,
-                     sizeof (end));
-  bfd_write ((PTR) & null, 1, 1, abfd);
+  if (! oasys_write_record (abfd,
+                           oasys_record_is_end_enum,
+                           (oasys_record_union_type *) & end,
+                           sizeof (end)))
+    return false;
+  if (bfd_write ((PTR) & null, 1, 1, abfd) != 1)
+    return false;
+  return true;
 }
 
 static int
@@ -1071,9 +1096,9 @@ comp (ap, bp)
  Writing data..
 
 */
-static void
+static boolean
 oasys_write_data (abfd)
-     bfd *CONST abfd;
+     bfd *abfd;
 {
   asection *s;
   for (s = abfd->sections; s != (asection *) NULL; s = s->next)
@@ -1127,7 +1152,7 @@ oasys_write_data (abfd)
                  if (relocs_to_go != 0)
                    {
                      arelent *r = *p;
-                     const reloc_howto_type *const how = r->howto;
+                     reloc_howto_type *const how = r->howto;
                      /* There is a relocation, is it for this byte ? */
                      if (r->address == current_byte_index)
                        {
@@ -1244,25 +1269,33 @@ oasys_write_data (abfd)
                  --dst;
                }
 
-             oasys_write_record (abfd,
-                                 oasys_record_is_data_enum,
-                              (oasys_record_union_type *) & processed_data,
-                                 dst - (bfd_byte *) & processed_data);
-
+             if (! oasys_write_record (abfd,
+                                       oasys_record_is_data_enum,
+                                       ((oasys_record_union_type *)
+                                        & processed_data),
+                                       dst - (bfd_byte *) & processed_data))
+               return false;
            }
        }
     }
+
+  return true;
 }
+
 static boolean
 oasys_write_object_contents (abfd)
      bfd *abfd;
 {
-  oasys_write_header (abfd);
-  oasys_write_syms (abfd);
-  if (!oasys_write_sections (abfd))
+  if (! oasys_write_header (abfd))
+    return false;
+  if (! oasys_write_syms (abfd))
+    return false;
+  if (! oasys_write_sections (abfd))
+    return false;
+  if (! oasys_write_data (abfd))
+    return false;
+  if (! oasys_write_end (abfd))
     return false;
-  oasys_write_data (abfd);
-  oasys_write_end (abfd);
   return true;
 }
 
@@ -1289,14 +1322,11 @@ oasys_set_section_contents (abfd, section, location, offset, count)
          oasys_per_section (section)->data =
            (bfd_byte *) (bfd_alloc (abfd, section->_cooked_size));
          if (!oasys_per_section (section)->data)
-           {
-             bfd_set_error (bfd_error_no_memory);
-             return false;
-           }
+           return false;
        }
       (void) memcpy ((PTR) (oasys_per_section (section)->data + offset),
                     location,
-                    count);
+                    (size_t) count);
     }
   return true;
 }
@@ -1317,10 +1347,7 @@ oasys_make_empty_symbol (abfd)
   oasys_symbol_type *new =
   (oasys_symbol_type *) bfd_zalloc (abfd, sizeof (oasys_symbol_type));
   if (!new)
-    {
-      bfd_set_error (bfd_error_no_memory);
-      return NULL;
-    }
+    return NULL;
   new->symbol.the_bfd = abfd;
   return &new->symbol;
 }
@@ -1376,13 +1403,13 @@ oasys_find_nearest_line (abfd,
                         filename_ptr,
                         functionname_ptr,
                         line_ptr)
-     bfd *abfd;
-     asection *section;
-     asymbol **symbols;
-     bfd_vma offset;
-     char **filename_ptr;
-     char **functionname_ptr;
-     unsigned int *line_ptr;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *section ATTRIBUTE_UNUSED;
+     asymbol **symbols ATTRIBUTE_UNUSED;
+     bfd_vma offset ATTRIBUTE_UNUSED;
+     char **filename_ptr ATTRIBUTE_UNUSED;
+     char **functionname_ptr ATTRIBUTE_UNUSED;
+     unsigned int *line_ptr ATTRIBUTE_UNUSED;
 {
   return false;
 
@@ -1409,47 +1436,58 @@ oasys_generic_stat_arch_elt (abfd, buf)
 
 static int
 oasys_sizeof_headers (abfd, exec)
-     bfd *abfd;
-     boolean exec;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     boolean exec ATTRIBUTE_UNUSED;
 {
   return 0;
 }
-#define FOO PROTO
-#define oasys_core_file_failing_command (char *(*)())(bfd_nullvoidptr)
-#define oasys_core_file_failing_signal (int (*)())bfd_0
-#define oasys_core_file_matches_executable_p  0
+
+#define        oasys_close_and_cleanup _bfd_generic_close_and_cleanup
+#define oasys_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
+
 #define oasys_slurp_armap bfd_true
 #define oasys_slurp_extended_name_table bfd_true
-#define oasys_truncate_arname (void (*)())bfd_nullvoidptr
-#define oasys_write_armap 0
-#define oasys_get_lineno (struct lineno_cache_entry *(*)())bfd_nullvoidptr
-#define        oasys_close_and_cleanup         bfd_generic_close_and_cleanup
+#define oasys_construct_extended_name_table \
+  ((boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
+   bfd_true)
+#define oasys_truncate_arname bfd_dont_truncate_arname
+#define oasys_write_armap \
+  ((boolean (*) \
+    PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \
+   bfd_true)
+#define oasys_read_ar_hdr bfd_nullvoidptr
+#define oasys_get_elt_at_index _bfd_generic_get_elt_at_index
+#define oasys_update_armap_timestamp bfd_true
+
+#define oasys_bfd_is_local_label_name bfd_generic_is_local_label_name
+#define oasys_get_lineno _bfd_nosymbols_get_lineno
+#define oasys_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
+#define oasys_read_minisymbols _bfd_generic_read_minisymbols
+#define oasys_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
+
+#define oasys_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
+
 #define oasys_set_arch_mach bfd_default_set_arch_mach
-#define oasys_bfd_debug_info_start bfd_void
-#define oasys_bfd_debug_info_end bfd_void
-#define oasys_bfd_debug_info_accumulate  (FOO(void, (*), (bfd *, asection *)))bfd_void
-#define oasys_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
+
+#define oasys_get_section_contents_in_window \
+  _bfd_generic_get_section_contents_in_window
+
+#define oasys_bfd_get_relocated_section_contents \
+  bfd_generic_get_relocated_section_contents
 #define oasys_bfd_relax_section bfd_generic_relax_section
-#define oasys_bfd_reloc_type_lookup \
-  ((CONST struct reloc_howto_struct *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) bfd_nullvoidptr)
-#define oasys_bfd_make_debug_symbol \
-  ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
+#define oasys_bfd_gc_sections bfd_generic_gc_sections
 #define oasys_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
 #define oasys_bfd_link_add_symbols _bfd_generic_link_add_symbols
 #define oasys_bfd_final_link _bfd_generic_final_link
-#define oasys_bfd_copy_private_section_data \
-  ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
-#define oasys_bfd_copy_private_bfd_data \
-  ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
-#define oasys_bfd_is_local_label bfd_generic_is_local_label
+#define oasys_bfd_link_split_section _bfd_generic_link_split_section
 
 /*SUPPRESS 460 */
-bfd_target oasys_vec =
+const bfd_target oasys_vec =
 {
   "oasys",                     /* name */
   bfd_target_oasys_flavour,
-  true,                                /* target byte order */
-  true,                                /* target headers byte order */
+  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),
@@ -1458,7 +1496,6 @@ bfd_target oasys_vec =
   0,                           /* leading underscore */
   ' ',                         /* ar_pad_char */
   16,                          /* ar_max_namelen */
-  1,                           /* minimum alignment */
   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 */
@@ -1483,6 +1520,18 @@ bfd_target oasys_vec =
     _bfd_write_archive_contents,
     bfd_false,
   },
-  JUMP_TABLE (oasys),
+
+  BFD_JUMP_TABLE_GENERIC (oasys),
+  BFD_JUMP_TABLE_COPY (_bfd_generic),
+  BFD_JUMP_TABLE_CORE (_bfd_nocore),
+  BFD_JUMP_TABLE_ARCHIVE (oasys),
+  BFD_JUMP_TABLE_SYMBOLS (oasys),
+  BFD_JUMP_TABLE_RELOCS (oasys),
+  BFD_JUMP_TABLE_WRITE (oasys),
+  BFD_JUMP_TABLE_LINK (oasys),
+  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
+  NULL,
+  
   (PTR) 0
 };