Automatic date update in version.in
[deliverable/binutils-gdb.git] / bfd / oasys.c
index 11d24401fe188b2874dd25298d47865887c0521a..efe0d7c14d72d8b9e45c85e245c09c83988f851d 100644 (file)
@@ -1,7 +1,5 @@
 /* BFD back-end for oasys objects.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001,
-   2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   Copyright (C) 1990-2017 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.
@@ -28,6 +26,7 @@
 #include "libbfd.h"
 #include "oasys.h"
 #include "liboasys.h"
+#include "libiberty.h"
 
 /* Read in all the section data and relocation stuff too.  */
 
@@ -273,37 +272,35 @@ oasys_archive_p (bfd *abfd)
     filepos = header.mod_tbl_offset;
     for (i = 0; i < header.mod_count; i++)
       {
+       oasys_extmodule_table_type_b_type record_ext;
+
        if (bfd_seek (abfd, filepos, SEEK_SET) != 0)
          return NULL;
 
        /* There are two ways of specifying the archive header.  */
-         {
-           oasys_extmodule_table_type_b_type record_ext;
-
-           amt = sizeof (record_ext);
-           if (bfd_bread ((void *) &record_ext, amt, abfd) != amt)
-             return NULL;
-
-           record.mod_size = H_GET_32 (abfd, record_ext.mod_size);
-           record.file_offset = H_GET_32 (abfd, record_ext.file_offset);
-
-           record.dep_count = H_GET_32 (abfd, record_ext.dep_count);
-           record.depee_count = H_GET_32 (abfd, record_ext.depee_count);
-           record.sect_count = H_GET_32 (abfd, record_ext.sect_count);
-           record.module_name_size = H_GET_32 (abfd,
-                                               record_ext.mod_name_length);
-
-           amt = record.module_name_size;
-           module[i].name = bfd_alloc (abfd, amt + 1);
-           if (!module[i].name)
-             return NULL;
-           if (bfd_bread ((void *) module[i].name, amt, abfd) != amt)
-             return NULL;
-           module[i].name[record.module_name_size] = 0;
-           filepos += (sizeof (record_ext)
-                       + record.dep_count * 4
-                       + record.module_name_size + 1);
-         }
+       amt = sizeof (record_ext);
+       if (bfd_bread ((void *) &record_ext, amt, abfd) != amt)
+         return NULL;
+
+       record.mod_size = H_GET_32 (abfd, record_ext.mod_size);
+       record.file_offset = H_GET_32 (abfd, record_ext.file_offset);
+
+       record.dep_count = H_GET_32 (abfd, record_ext.dep_count);
+       record.depee_count = H_GET_32 (abfd, record_ext.depee_count);
+       record.sect_count = H_GET_32 (abfd, record_ext.sect_count);
+       record.module_name_size = H_GET_32 (abfd,
+                                           record_ext.mod_name_length);
+
+       amt = record.module_name_size;
+       module[i].name = bfd_alloc (abfd, amt + 1);
+       if (!module[i].name)
+         return NULL;
+       if (bfd_bread ((void *) module[i].name, amt, abfd) != amt)
+         return NULL;
+       module[i].name[record.module_name_size] = 0;
+       filepos += (sizeof (record_ext)
+                   + record.dep_count * 4
+                   + record.module_name_size + 1);
 
        module[i].size = record.mod_size;
        module[i].pos = record.file_offset;
@@ -615,6 +612,7 @@ oasys_object_p (bfd *abfd)
          break;
        case oasys_record_is_data_enum:
          oasys->first_data_record = bfd_tell (abfd) - record.header.length;
+         /* Fall through.  */
        case oasys_record_is_debug_enum:
        case oasys_record_is_module_enum:
        case oasys_record_is_named_section_enum:
@@ -878,9 +876,9 @@ oasys_write_sections (bfd *abfd)
     {
       if (!ISDIGIT (s->name[0]))
        {
-         (*_bfd_error_handler)
-           (_("%s: can not represent section `%s' in oasys"),
-            bfd_get_filename (abfd), s->name);
+         _bfd_error_handler
+           /* xgettext:c-format */
+           (_("%B: can not represent section `%A' in oasys"), abfd, s);
          bfd_set_error (bfd_error_nonrepresentable_section);
          return FALSE;
        }
@@ -906,9 +904,11 @@ oasys_write_header (bfd *abfd)
 
   if (length > (size_t) sizeof (r.module_name))
     length = sizeof (r.module_name);
+  else if (length < (size_t) sizeof (r.module_name))
+    (void) memset (r.module_name + length, ' ',
+                  sizeof (r.module_name) - length);
 
   (void) memcpy (r.module_name, abfd->filename, length);
-  (void) memset (r.module_name + length, ' ', sizeof (r.module_name) - length);
 
   r.version_number = OASYS_VERSION_NUMBER;
   r.rev_number = OASYS_REV_NUMBER;
@@ -1116,7 +1116,7 @@ oasys_openr_next_archived_file (bfd *arch, bfd *prev)
        {
          p->abfd = _bfd_create_empty_archive_element_shell (arch);
          p->abfd->origin = p->pos;
-         p->abfd->filename = p->name;
+         p->abfd->filename = xstrdup (p->name);
 
          /* Fixup a pointer to this element for the member.  */
          p->abfd->arelt_data = (void *) p;
@@ -1128,26 +1128,9 @@ oasys_openr_next_archived_file (bfd *arch, bfd *prev)
   return NULL;
 }
 
-static bfd_boolean
-oasys_find_nearest_line (bfd *abfd ATTRIBUTE_UNUSED,
-                        asection *section ATTRIBUTE_UNUSED,
-                        asymbol **symbols ATTRIBUTE_UNUSED,
-                        bfd_vma offset ATTRIBUTE_UNUSED,
-                        const char **filename_ptr ATTRIBUTE_UNUSED,
-                        const char **functionname_ptr ATTRIBUTE_UNUSED,
-                        unsigned int *line_ptr ATTRIBUTE_UNUSED)
-{
-  return FALSE;
-}
-
-static bfd_boolean
-oasys_find_inliner_info (bfd *abfd ATTRIBUTE_UNUSED,
-                        const char **filename_ptr ATTRIBUTE_UNUSED,
-                        const char **functionname_ptr ATTRIBUTE_UNUSED,
-                        unsigned int *line_ptr ATTRIBUTE_UNUSED)
-{
-  return FALSE;
-}
+#define oasys_find_nearest_line _bfd_nosymbols_find_nearest_line
+#define oasys_find_line         _bfd_nosymbols_find_line
+#define oasys_find_inliner_info _bfd_nosymbols_find_inliner_info
 
 static int
 oasys_generic_stat_arch_elt (bfd *abfd, struct stat *buf)
@@ -1186,6 +1169,7 @@ oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
 #define oasys_bfd_is_local_label_name              bfd_generic_is_local_label_name
 #define oasys_bfd_is_target_special_symbol         ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define oasys_get_lineno                           _bfd_nosymbols_get_lineno
+#define oasys_get_symbol_version_string                   _bfd_nosymbols_get_symbol_version_string
 #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
@@ -1202,14 +1186,16 @@ oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
 #define oasys_bfd_discard_group                    bfd_generic_discard_group
 #define oasys_section_already_linked               _bfd_generic_section_already_linked
 #define oasys_bfd_define_common_symbol             bfd_generic_define_common_symbol
+#define oasys_bfd_define_start_stop                bfd_generic_define_start_stop
 #define oasys_bfd_link_hash_table_create           _bfd_generic_link_hash_table_create
-#define oasys_bfd_link_hash_table_free             _bfd_generic_link_hash_table_free
 #define oasys_bfd_link_add_symbols                 _bfd_generic_link_add_symbols
 #define oasys_bfd_link_just_syms                   _bfd_generic_link_just_syms
 #define oasys_bfd_copy_link_hash_symbol_type \
   _bfd_generic_copy_link_hash_symbol_type
 #define oasys_bfd_final_link                       _bfd_generic_final_link
 #define oasys_bfd_link_split_section               _bfd_generic_link_split_section
+#define oasys_bfd_link_check_relocs                _bfd_generic_link_check_relocs
+#define oasys_set_reloc                                   _bfd_generic_set_reloc
 
 const bfd_target oasys_vec =
 {
This page took 0.036567 seconds and 4 git commands to generate.