OSDN Git Service

2009-12-03 Tristan Gingold <gingold@adacore.com>
[pf3gnuchains/pf3gnuchains3x.git] / bfd / xsym.c
index e5889d4..dd1ffd7 100644 (file)
@@ -1,12 +1,12 @@
 /* xSYM symbol-file support for BFD.
-   Copyright 1999, 2000, 2001, 2002, 2003, 2004
-   Free Software Foundation, Inc.
+   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+   2009 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
 
    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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
+#include "alloca-conf.h"
+#include "sysdep.h"
 #include "xsym.h"
 #include "bfd.h"
-#include "sysdep.h"
 #include "libbfd.h"
 
-#define bfd_sym_close_and_cleanup _bfd_generic_close_and_cleanup
-#define bfd_sym_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
-#define bfd_sym_new_section_hook _bfd_generic_new_section_hook
-#define bfd_sym_bfd_is_local_label_name bfd_generic_is_local_label_name
-#define bfd_sym_get_lineno _bfd_nosymbols_get_lineno
-#define bfd_sym_find_nearest_line _bfd_nosymbols_find_nearest_line
-#define bfd_sym_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
-#define bfd_sym_read_minisymbols _bfd_generic_read_minisymbols
-#define bfd_sym_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-#define bfd_sym_get_reloc_upper_bound _bfd_norelocs_get_reloc_upper_bound
-#define bfd_sym_canonicalize_reloc _bfd_norelocs_canonicalize_reloc
-#define bfd_sym_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
-#define bfd_sym_set_arch_mach _bfd_generic_set_arch_mach
-#define bfd_sym_get_section_contents _bfd_generic_get_section_contents
-#define bfd_sym_set_section_contents _bfd_generic_set_section_contents
-#define bfd_sym_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
-#define bfd_sym_bfd_relax_section bfd_generic_relax_section
-#define bfd_sym_bfd_gc_sections bfd_generic_gc_sections
-#define bfd_sym_bfd_merge_sections bfd_generic_merge_sections
-#define bfd_sym_bfd_is_group_section bfd_generic_is_group_section
-#define bfd_sym_bfd_discard_group bfd_generic_discard_group
-#define bfd_sym_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
-#define bfd_sym_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-#define bfd_sym_bfd_link_add_symbols _bfd_generic_link_add_symbols
-#define bfd_sym_bfd_link_just_syms _bfd_generic_link_just_syms
-#define bfd_sym_bfd_final_link _bfd_generic_final_link
-#define bfd_sym_bfd_link_split_section _bfd_generic_link_split_section
-#define bfd_sym_get_section_contents_in_window  _bfd_generic_get_section_contents_in_window
-
-static int pstrcmp PARAMS ((unsigned char *, unsigned char *));
-static unsigned long compute_offset
-  PARAMS ((unsigned long, unsigned long, unsigned long, unsigned long));
+#define bfd_sym_close_and_cleanup                   _bfd_generic_close_and_cleanup
+#define bfd_sym_bfd_free_cached_info                _bfd_generic_bfd_free_cached_info
+#define bfd_sym_new_section_hook                    _bfd_generic_new_section_hook
+#define bfd_sym_bfd_is_local_label_name             bfd_generic_is_local_label_name
+#define bfd_sym_bfd_is_target_special_symbol       ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#define bfd_sym_get_lineno                          _bfd_nosymbols_get_lineno
+#define bfd_sym_find_nearest_line                   _bfd_nosymbols_find_nearest_line
+#define bfd_sym_find_inliner_info                   _bfd_nosymbols_find_inliner_info
+#define bfd_sym_bfd_make_debug_symbol               _bfd_nosymbols_bfd_make_debug_symbol
+#define bfd_sym_read_minisymbols                    _bfd_generic_read_minisymbols
+#define bfd_sym_minisymbol_to_symbol                _bfd_generic_minisymbol_to_symbol
+#define bfd_sym_set_arch_mach                       _bfd_generic_set_arch_mach
+#define bfd_sym_get_section_contents                _bfd_generic_get_section_contents
+#define bfd_sym_set_section_contents                _bfd_generic_set_section_contents
+#define bfd_sym_bfd_get_relocated_section_contents  bfd_generic_get_relocated_section_contents
+#define bfd_sym_bfd_relax_section                   bfd_generic_relax_section
+#define bfd_sym_bfd_gc_sections                     bfd_generic_gc_sections
+#define bfd_sym_bfd_merge_sections                  bfd_generic_merge_sections
+#define bfd_sym_bfd_is_group_section                bfd_generic_is_group_section
+#define bfd_sym_bfd_discard_group                   bfd_generic_discard_group
+#define bfd_sym_section_already_linked              _bfd_generic_section_already_linked
+#define bfd_sym_bfd_define_common_symbol            bfd_generic_define_common_symbol
+#define bfd_sym_bfd_link_hash_table_create          _bfd_generic_link_hash_table_create
+#define bfd_sym_bfd_link_hash_table_free            _bfd_generic_link_hash_table_free
+#define bfd_sym_bfd_link_add_symbols                _bfd_generic_link_add_symbols
+#define bfd_sym_bfd_link_just_syms                  _bfd_generic_link_just_syms
+#define bfd_sym_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
+#define bfd_sym_bfd_final_link                      _bfd_generic_final_link
+#define bfd_sym_bfd_link_split_section              _bfd_generic_link_split_section
+#define bfd_sym_get_section_contents_in_window      _bfd_generic_get_section_contents_in_window
 
 extern const bfd_target sym_vec;
 
 static int
-pstrcmp (a, b)
-     unsigned char *a;
-     unsigned char *b;
+pstrcmp (const char *as, const char *bs)
 {
+  const unsigned char *a = (const unsigned char *) as;
+  const unsigned char *b = (const unsigned char *) bs;
   unsigned char clen;
   int ret;
 
-  clen = (a[0] > b[0]) ? a[0] : b[0];
+  clen = (a[0] > b[0]) ? b[0] : a[0];
   ret = memcmp (a + 1, b + 1, clen);
   if (ret != 0)
     return ret;
@@ -76,15 +77,14 @@ pstrcmp (a, b)
   else if (a[0] < b[0])
     return -1;
   else
-    return 0;
+    return 1;
 }
 
 static unsigned long
-compute_offset (first_page, page_size, entry_size, index)
-     unsigned long first_page;
-     unsigned long page_size;
-     unsigned long entry_size;
-     unsigned long index;
+compute_offset (unsigned long first_page,
+               unsigned long page_size,
+               unsigned long entry_size,
+               unsigned long index)
 {
   unsigned long entries_per_page = page_size / entry_size;
   unsigned long page_number = first_page + (index / entries_per_page);
@@ -94,25 +94,22 @@ compute_offset (first_page, page_size, entry_size, index)
 }
 
 bfd_boolean
-bfd_sym_mkobject (abfd)
-     bfd *abfd ATTRIBUTE_UNUSED;
+bfd_sym_mkobject (bfd *abfd ATTRIBUTE_UNUSED)
 {
   return 1;
 }
 
 void
-bfd_sym_print_symbol (abfd, afile, symbol, how)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     PTR afile ATTRIBUTE_UNUSED;
-     asymbol *symbol ATTRIBUTE_UNUSED;
-     bfd_print_symbol_type how ATTRIBUTE_UNUSED;
+bfd_sym_print_symbol (bfd *abfd ATTRIBUTE_UNUSED,
+                     void * afile ATTRIBUTE_UNUSED,
+                     asymbol *symbol ATTRIBUTE_UNUSED,
+                     bfd_print_symbol_type how ATTRIBUTE_UNUSED)
 {
   return;
 }
 
 bfd_boolean
-bfd_sym_valid (abfd)
-     bfd *abfd;
+bfd_sym_valid (bfd *abfd)
 {
   if (abfd == NULL || abfd->xvec == NULL)
     return 0;
@@ -121,16 +118,14 @@ bfd_sym_valid (abfd)
 }
 
 unsigned char *
-bfd_sym_read_name_table (abfd, dshb)
-     bfd *abfd;
-     bfd_sym_header_block *dshb;
+bfd_sym_read_name_table (bfd *abfd, bfd_sym_header_block *dshb)
 {
   unsigned char *rstr;
   long ret;
   size_t table_size = dshb->dshb_nte.dti_page_count * dshb->dshb_page_size;
   size_t table_offset = dshb->dshb_nte.dti_first_page * dshb->dshb_page_size;
 
-  rstr = (unsigned char *) bfd_alloc (abfd, table_size);
+  rstr = bfd_alloc (abfd, table_size);
   if (rstr == NULL)
     return rstr;
 
@@ -146,10 +141,9 @@ bfd_sym_read_name_table (abfd, dshb)
 }
 
 void
-bfd_sym_parse_file_reference_v32 (buf, len, entry)
-     unsigned char *buf;
-     size_t len;
-     bfd_sym_file_reference *entry;
+bfd_sym_parse_file_reference_v32 (unsigned char *buf,
+                                 size_t len,
+                                 bfd_sym_file_reference *entry)
 {
   BFD_ASSERT (len == 6);
 
@@ -158,10 +152,9 @@ bfd_sym_parse_file_reference_v32 (buf, len, entry)
 }
 
 void
-bfd_sym_parse_disk_table_v32 (buf, len, table)
-     unsigned char *buf;
-     size_t len;
-     bfd_sym_table_info *table;
+bfd_sym_parse_disk_table_v32 (unsigned char *buf,
+                             size_t len,
+                             bfd_sym_table_info *table)
 {
   BFD_ASSERT (len == 8);
 
@@ -171,10 +164,9 @@ bfd_sym_parse_disk_table_v32 (buf, len, table)
 }
 
 void
-bfd_sym_parse_header_v32 (buf, len, header)
-     unsigned char *buf;
-     size_t len;
-     bfd_sym_header_block *header;
+bfd_sym_parse_header_v32 (unsigned char *buf,
+                         size_t len,
+                         bfd_sym_header_block *header)
 {
   BFD_ASSERT (len == 154);
 
@@ -203,9 +195,7 @@ bfd_sym_parse_header_v32 (buf, len, header)
 }
 
 int
-bfd_sym_read_header_v32 (abfd, header)
-     bfd *abfd;
-     bfd_sym_header_block *header;
+bfd_sym_read_header_v32 (bfd *abfd, bfd_sym_header_block *header)
 {
   unsigned char buf[154];
   long ret;
@@ -220,18 +210,16 @@ bfd_sym_read_header_v32 (abfd, header)
 }
 
 int
-bfd_sym_read_header_v34 (abfd, header)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     bfd_sym_header_block *header ATTRIBUTE_UNUSED;
+bfd_sym_read_header_v34 (bfd *abfd ATTRIBUTE_UNUSED,
+                        bfd_sym_header_block *header ATTRIBUTE_UNUSED)
 {
   abort ();
 }
 
 int
-bfd_sym_read_header (abfd, header, version)
-     bfd *abfd;
-     bfd_sym_header_block *header;
-     bfd_sym_version version;
+bfd_sym_read_header (bfd *abfd,
+                    bfd_sym_header_block *header,
+                    bfd_sym_version version)
 {
   switch (version)
     {
@@ -243,16 +231,14 @@ bfd_sym_read_header (abfd, header, version)
       return bfd_sym_read_header_v32 (abfd, header);
     case BFD_SYM_VERSION_3_1:
     default:
-      return FALSE;
+      return 0;
     }
 }
 
 int
-bfd_sym_read_version (abfd, version)
-     bfd *abfd;
-     bfd_sym_version *version;
+bfd_sym_read_version (bfd *abfd, bfd_sym_version *version)
 {
-  unsigned char version_string[32];
+  char version_string[32];
   long ret;
 
   ret = bfd_bread (version_string, sizeof (version_string), abfd);
@@ -276,10 +262,9 @@ bfd_sym_read_version (abfd, version)
 }
 
 void
-bfd_sym_display_table_summary (f, dti, name)
-     FILE *f;
-     bfd_sym_table_info *dti;
-     const char *name;
+bfd_sym_display_table_summary (FILE *f,
+                              bfd_sym_table_info *dti,
+                              const char *name)
 {
   fprintf (f, "%-6s %13ld %13ld %13ld\n",
           name,
@@ -289,9 +274,7 @@ bfd_sym_display_table_summary (f, dti, name)
 }
 
 void
-bfd_sym_display_header (f, dshb)
-     FILE *f;
-     bfd_sym_header_block *dshb;
+bfd_sym_display_header (FILE *f, bfd_sym_header_block *dshb)
 {
   fprintf (f, "            Version: %.*s\n", dshb->dshb_id[0], dshb->dshb_id + 1);
   fprintf (f, "          Page Size: 0x%x\n", dshb->dshb_page_size);
@@ -325,10 +308,9 @@ bfd_sym_display_header (f, dshb)
 }
 
 void
-bfd_sym_parse_resources_table_entry_v32 (buf, len, entry)
-     unsigned char *buf;
-     size_t len;
-     bfd_sym_resources_table_entry *entry;
+bfd_sym_parse_resources_table_entry_v32 (unsigned char *buf,
+                                        size_t len,
+                                        bfd_sym_resources_table_entry *entry)
 {
   BFD_ASSERT (len == 18);
 
@@ -341,10 +323,9 @@ bfd_sym_parse_resources_table_entry_v32 (buf, len, entry)
 }
 
 void
-bfd_sym_parse_modules_table_entry_v33 (buf, len, entry)
-     unsigned char *buf;
-     size_t len;
-     bfd_sym_modules_table_entry *entry;
+bfd_sym_parse_modules_table_entry_v33 (unsigned char *buf,
+                                      size_t len,
+                                      bfd_sym_modules_table_entry *entry)
 {
   BFD_ASSERT (len == 46);
 
@@ -366,10 +347,9 @@ bfd_sym_parse_modules_table_entry_v33 (buf, len, entry)
 }
 
 void
-bfd_sym_parse_file_references_table_entry_v32 (buf, len, entry)
-     unsigned char *buf;
-     size_t len;
-     bfd_sym_file_references_table_entry *entry;
+bfd_sym_parse_file_references_table_entry_v32 (unsigned char *buf,
+                                              size_t len,
+                                              bfd_sym_file_references_table_entry *entry)
 {
   unsigned int type;
 
@@ -397,10 +377,9 @@ bfd_sym_parse_file_references_table_entry_v32 (buf, len, entry)
 }
 
 void
-bfd_sym_parse_contained_modules_table_entry_v32 (buf, len, entry)
-     unsigned char *buf;
-     size_t len;
-     bfd_sym_contained_modules_table_entry *entry;
+bfd_sym_parse_contained_modules_table_entry_v32 (unsigned char *buf,
+                                                size_t len,
+                                                bfd_sym_contained_modules_table_entry *entry)
 {
   unsigned int type;
 
@@ -423,10 +402,9 @@ bfd_sym_parse_contained_modules_table_entry_v32 (buf, len, entry)
 }
 
 void
-bfd_sym_parse_contained_variables_table_entry_v32 (buf, len, entry)
-     unsigned char *buf;
-     size_t len;
-     bfd_sym_contained_variables_table_entry *entry;
+bfd_sym_parse_contained_variables_table_entry_v32 (unsigned char *buf,
+                                                  size_t len,
+                                                  bfd_sym_contained_variables_table_entry *entry)
 {
   unsigned int type;
 
@@ -461,7 +439,10 @@ bfd_sym_parse_contained_variables_table_entry_v32 (buf, len, entry)
        }
       else if (entry->entry.la_size <= BFD_SYM_CVTE_SCA)
        {
-         memcpy (&entry->entry.address.lastruct.la, buf + 10, BFD_SYM_CVTE_SCA);
+#if BFD_SYM_CVTE_SCA > 0
+         memcpy (&entry->entry.address.lastruct.la, buf + 10,
+                 BFD_SYM_CVTE_SCA);
+#endif
          entry->entry.address.lastruct.la_kind = buf[23];
        }
       else if (entry->entry.la_size == BFD_SYM_CVTE_BIG_LA)
@@ -473,10 +454,9 @@ bfd_sym_parse_contained_variables_table_entry_v32 (buf, len, entry)
 }
 
 void
-bfd_sym_parse_contained_statements_table_entry_v32 (buf, len, entry)
-     unsigned char *buf;
-     size_t len;
-     bfd_sym_contained_statements_table_entry *entry;
+bfd_sym_parse_contained_statements_table_entry_v32 (unsigned char *buf,
+                                                   size_t len,
+                                                   bfd_sym_contained_statements_table_entry *entry)
 {
   unsigned int type;
 
@@ -505,10 +485,9 @@ bfd_sym_parse_contained_statements_table_entry_v32 (buf, len, entry)
 }
 
 void
-bfd_sym_parse_contained_labels_table_entry_v32 (buf, len, entry)
-     unsigned char *buf;
-     size_t len;
-     bfd_sym_contained_labels_table_entry *entry;
+bfd_sym_parse_contained_labels_table_entry_v32 (unsigned char *buf,
+                                               size_t len,
+                                               bfd_sym_contained_labels_table_entry *entry)
 {
   unsigned int type;
 
@@ -539,10 +518,9 @@ bfd_sym_parse_contained_labels_table_entry_v32 (buf, len, entry)
 }
 
 void
-bfd_sym_parse_type_table_entry_v32 (buf, len, entry)
-     unsigned char *buf;
-     size_t len;
-     bfd_sym_type_table_entry *entry;
+bfd_sym_parse_type_table_entry_v32 (unsigned char *buf,
+                                   size_t len,
+                                   bfd_sym_type_table_entry *entry)
 {
   BFD_ASSERT (len == 4);
 
@@ -550,13 +528,11 @@ bfd_sym_parse_type_table_entry_v32 (buf, len, entry)
 }
 
 int
-bfd_sym_fetch_resources_table_entry (abfd, entry, index)
-     bfd *abfd;
-     bfd_sym_resources_table_entry *entry;
-     unsigned long index;
+bfd_sym_fetch_resources_table_entry (bfd *abfd,
+                                    bfd_sym_resources_table_entry *entry,
+                                    unsigned long index)
 {
-  void (*parser) PARAMS ((unsigned char *, size_t,
-                         bfd_sym_resources_table_entry *));
+  void (*parser) (unsigned char *, size_t, bfd_sym_resources_table_entry *);
   unsigned long offset;
   unsigned long entry_size;
   unsigned char buf[18];
@@ -603,13 +579,11 @@ bfd_sym_fetch_resources_table_entry (abfd, entry, index)
 }
 
 int
-bfd_sym_fetch_modules_table_entry (abfd, entry, index)
-     bfd *abfd;
-     bfd_sym_modules_table_entry *entry;
-     unsigned long index;
+bfd_sym_fetch_modules_table_entry (bfd *abfd,
+                                  bfd_sym_modules_table_entry *entry,
+                                  unsigned long index)
 {
-  void (*parser) PARAMS ((unsigned char *, size_t,
-                         bfd_sym_modules_table_entry *));
+  void (*parser) (unsigned char *, size_t, bfd_sym_modules_table_entry *);
   unsigned long offset;
   unsigned long entry_size;
   unsigned char buf[46];
@@ -656,13 +630,11 @@ bfd_sym_fetch_modules_table_entry (abfd, entry, index)
 }
 
 int
-bfd_sym_fetch_file_references_table_entry (abfd, entry, index)
-     bfd *abfd;
-     bfd_sym_file_references_table_entry *entry;
-     unsigned long index;
+bfd_sym_fetch_file_references_table_entry (bfd *abfd,
+                                          bfd_sym_file_references_table_entry *entry,
+                                          unsigned long index)
 {
-  void (*parser) PARAMS ((unsigned char *, size_t,
-                         bfd_sym_file_references_table_entry *));
+  void (*parser) (unsigned char *, size_t, bfd_sym_file_references_table_entry *);
   unsigned long offset;
   unsigned long entry_size = 0;
   unsigned char buf[8];
@@ -708,13 +680,11 @@ bfd_sym_fetch_file_references_table_entry (abfd, entry, index)
 }
 
 int
-bfd_sym_fetch_contained_modules_table_entry (abfd, entry, index)
-     bfd *abfd;
-     bfd_sym_contained_modules_table_entry *entry;
-     unsigned long index;
+bfd_sym_fetch_contained_modules_table_entry (bfd *abfd,
+                                            bfd_sym_contained_modules_table_entry *entry,
+                                            unsigned long index)
 {
-  void (*parser) PARAMS ((unsigned char *, size_t,
-                         bfd_sym_contained_modules_table_entry *));
+  void (*parser) (unsigned char *, size_t, bfd_sym_contained_modules_table_entry *);
   unsigned long offset;
   unsigned long entry_size = 0;
   unsigned char buf[6];
@@ -760,13 +730,11 @@ bfd_sym_fetch_contained_modules_table_entry (abfd, entry, index)
 }
 
 int
-bfd_sym_fetch_contained_variables_table_entry (abfd, entry, index)
-     bfd *abfd;
-     bfd_sym_contained_variables_table_entry *entry;
-     unsigned long index;
+bfd_sym_fetch_contained_variables_table_entry (bfd *abfd,
+                                              bfd_sym_contained_variables_table_entry *entry,
+                                              unsigned long index)
 {
-  void (*parser) PARAMS ((unsigned char *, size_t,
-                         bfd_sym_contained_variables_table_entry *));
+  void (*parser) (unsigned char *, size_t, bfd_sym_contained_variables_table_entry *);
   unsigned long offset;
   unsigned long entry_size = 0;
   unsigned char buf[26];
@@ -812,13 +780,11 @@ bfd_sym_fetch_contained_variables_table_entry (abfd, entry, index)
 }
 
 int
-bfd_sym_fetch_contained_statements_table_entry (abfd, entry, index)
-     bfd *abfd;
-     bfd_sym_contained_statements_table_entry *entry;
-     unsigned long index;
+bfd_sym_fetch_contained_statements_table_entry (bfd *abfd,
+                                               bfd_sym_contained_statements_table_entry *entry,
+                                               unsigned long index)
 {
-  void (*parser) PARAMS ((unsigned char *, size_t,
-                         bfd_sym_contained_statements_table_entry *));
+  void (*parser) (unsigned char *, size_t, bfd_sym_contained_statements_table_entry *);
   unsigned long offset;
   unsigned long entry_size = 0;
   unsigned char buf[8];
@@ -864,13 +830,11 @@ bfd_sym_fetch_contained_statements_table_entry (abfd, entry, index)
 }
 
 int
-bfd_sym_fetch_contained_labels_table_entry (abfd, entry, index)
-     bfd *abfd;
-     bfd_sym_contained_labels_table_entry *entry;
-     unsigned long index;
+bfd_sym_fetch_contained_labels_table_entry (bfd *abfd,
+                                           bfd_sym_contained_labels_table_entry *entry,
+                                           unsigned long index)
 {
-  void (*parser) PARAMS ((unsigned char *, size_t,
-                         bfd_sym_contained_labels_table_entry *));
+  void (*parser) (unsigned char *, size_t, bfd_sym_contained_labels_table_entry *);
   unsigned long offset;
   unsigned long entry_size = 0;
   unsigned char buf[12];
@@ -916,13 +880,11 @@ bfd_sym_fetch_contained_labels_table_entry (abfd, entry, index)
 }
 
 int
-bfd_sym_fetch_contained_types_table_entry (abfd, entry, index)
-     bfd *abfd;
-     bfd_sym_contained_types_table_entry *entry;
-     unsigned long index;
+bfd_sym_fetch_contained_types_table_entry (bfd *abfd,
+                                          bfd_sym_contained_types_table_entry *entry,
+                                          unsigned long index)
 {
-  void (*parser) PARAMS ((unsigned char *, size_t,
-                         bfd_sym_contained_types_table_entry *));
+  void (*parser) (unsigned char *, size_t, bfd_sym_contained_types_table_entry *);
   unsigned long offset;
   unsigned long entry_size = 0;
   unsigned char buf[0];
@@ -968,13 +930,11 @@ bfd_sym_fetch_contained_types_table_entry (abfd, entry, index)
 }
 
 int
-bfd_sym_fetch_file_references_index_table_entry (abfd, entry, index)
-     bfd *abfd;
-     bfd_sym_file_references_index_table_entry *entry;
-     unsigned long index;
+bfd_sym_fetch_file_references_index_table_entry (bfd *abfd,
+                                                bfd_sym_file_references_index_table_entry *entry,
+                                                unsigned long index)
 {
-  void (*parser) PARAMS ((unsigned char *, size_t,
-                         bfd_sym_file_references_index_table_entry *));
+  void (*parser) (unsigned char *, size_t, bfd_sym_file_references_index_table_entry *);
   unsigned long offset;
   unsigned long entry_size = 0;
   unsigned char buf[0];
@@ -1020,13 +980,11 @@ bfd_sym_fetch_file_references_index_table_entry (abfd, entry, index)
 }
 
 int
-bfd_sym_fetch_constant_pool_entry (abfd, entry, index)
-     bfd *abfd;
-     bfd_sym_constant_pool_entry *entry;
-     unsigned long index;
+bfd_sym_fetch_constant_pool_entry (bfd *abfd,
+                                  bfd_sym_constant_pool_entry *entry,
+                                  unsigned long index)
 {
-  void (*parser) PARAMS ((unsigned char *, size_t,
-                         bfd_sym_constant_pool_entry *));
+  void (*parser) (unsigned char *, size_t, bfd_sym_constant_pool_entry *);
   unsigned long offset;
   unsigned long entry_size = 0;
   unsigned char buf[0];
@@ -1072,13 +1030,11 @@ bfd_sym_fetch_constant_pool_entry (abfd, entry, index)
 }
 
 int
-bfd_sym_fetch_type_table_entry (abfd, entry, index)
-     bfd *abfd;
-     bfd_sym_type_table_entry *entry;
-     unsigned long index;
+bfd_sym_fetch_type_table_entry (bfd *abfd,
+                               bfd_sym_type_table_entry *entry,
+                               unsigned long index)
 {
-  void (*parser) PARAMS ((unsigned char *, size_t,
-                         bfd_sym_type_table_entry *));
+  void (*parser) (unsigned char *, size_t, bfd_sym_type_table_entry *);
   unsigned long offset;
   unsigned long entry_size = 0;
   unsigned char buf[4];
@@ -1121,10 +1077,9 @@ bfd_sym_fetch_type_table_entry (abfd, entry, index)
 }
 
 int
-bfd_sym_fetch_type_information_table_entry (abfd, entry, offset)
-     bfd *abfd;
-     bfd_sym_type_information_table_entry *entry;
-     unsigned long offset;
+bfd_sym_fetch_type_information_table_entry (bfd *abfd,
+                                           bfd_sym_type_information_table_entry *entry,
+                                           unsigned long offset)
 {
   unsigned char buf[4];
   bfd_sym_data_struct *sdata = NULL;
@@ -1167,10 +1122,9 @@ bfd_sym_fetch_type_information_table_entry (abfd, entry, offset)
 }
 
 int
-bfd_sym_fetch_type_table_information (abfd, entry, index)
-     bfd *abfd;
-     bfd_sym_type_information_table_entry *entry;
-     unsigned long index;
+bfd_sym_fetch_type_table_information (bfd *abfd,
+                                     bfd_sym_type_information_table_entry *entry,
+                                     unsigned long index)
 {
   bfd_sym_type_table_entry tindex;
   bfd_sym_data_struct *sdata = NULL;
@@ -1192,9 +1146,7 @@ bfd_sym_fetch_type_table_information (abfd, entry, index)
 }
 
 const unsigned char *
-bfd_sym_symbol_name (abfd, index)
-     bfd *abfd;
-     unsigned long index;
+bfd_sym_symbol_name (bfd *abfd, unsigned long index)
 {
   bfd_sym_data_struct *sdata = NULL;
 
@@ -1202,32 +1154,29 @@ bfd_sym_symbol_name (abfd, index)
   sdata = abfd->tdata.sym_data;
 
   if (index == 0)
-    return "";
+    return (const unsigned char *) "";
 
   index *= 2;
   if ((index / sdata->header.dshb_page_size)
       > sdata->header.dshb_nte.dti_page_count)
-    return "\009[INVALID]";
+    return (const unsigned char *) "\09[INVALID]";
 
   return (const unsigned char *) sdata->name_table + index;
 }
 
 const unsigned char *
-bfd_sym_module_name (abfd, index)
-     bfd *abfd;
-     unsigned long index;
+bfd_sym_module_name (bfd *abfd, unsigned long index)
 {
   bfd_sym_modules_table_entry entry;
 
   if (bfd_sym_fetch_modules_table_entry (abfd, &entry, index) < 0)
-    return "\011[INVALID]";
+    return (const unsigned char *) "\09[INVALID]";
 
   return bfd_sym_symbol_name (abfd, entry.mte_nte_index);
 }
 
 const char *
-bfd_sym_unparse_storage_kind (kind)
-     enum bfd_sym_storage_kind kind;
+bfd_sym_unparse_storage_kind (enum bfd_sym_storage_kind kind)
 {
   switch (kind)
     {
@@ -1240,8 +1189,7 @@ bfd_sym_unparse_storage_kind (kind)
 }
 
 const char *
-bfd_sym_unparse_storage_class (kind)
-     enum bfd_sym_storage_class kind;
+bfd_sym_unparse_storage_class (enum bfd_sym_storage_class kind)
 {
   switch (kind)
     {
@@ -1258,8 +1206,7 @@ bfd_sym_unparse_storage_class (kind)
 }
 
 const char *
-bfd_sym_unparse_module_kind (kind)
-     enum bfd_sym_module_kind kind;
+bfd_sym_unparse_module_kind (enum bfd_sym_module_kind kind)
 {
   switch (kind)
     {
@@ -1275,8 +1222,7 @@ bfd_sym_unparse_module_kind (kind)
 }
 
 const char *
-bfd_sym_unparse_symbol_scope (scope)
-     enum bfd_sym_symbol_scope scope;
+bfd_sym_unparse_symbol_scope (enum bfd_sym_symbol_scope scope)
 {
   switch (scope)
     {
@@ -1288,10 +1234,9 @@ bfd_sym_unparse_symbol_scope (scope)
 }
 
 void
-bfd_sym_print_file_reference (abfd, f, entry)
-     bfd *abfd;
-     FILE *f;
-     bfd_sym_file_reference *entry;
+bfd_sym_print_file_reference (bfd *abfd,
+                             FILE *f,
+                             bfd_sym_file_reference *entry)
 {
   bfd_sym_file_references_table_entry frtentry;
   int ret;
@@ -1311,10 +1256,9 @@ bfd_sym_print_file_reference (abfd, f, entry)
 }
 
 void
-bfd_sym_print_resources_table_entry (abfd, f, entry)
-     bfd *abfd;
-     FILE *f;
-     bfd_sym_resources_table_entry *entry;
+bfd_sym_print_resources_table_entry (bfd *abfd,
+                                    FILE *f,
+                                    bfd_sym_resources_table_entry *entry)
 {
   fprintf (f, " \"%.*s\" (NTE %lu), type \"%.4s\", num %u, size %lu, MTE %lu -- %lu",
           bfd_sym_symbol_name (abfd, entry->rte_nte_index)[0],
@@ -1324,10 +1268,9 @@ bfd_sym_print_resources_table_entry (abfd, f, entry)
 }
 
 void
-bfd_sym_print_modules_table_entry (abfd, f, entry)
-     bfd *abfd;
-     FILE *f;
-     bfd_sym_modules_table_entry *entry;
+bfd_sym_print_modules_table_entry (bfd *abfd,
+                                  FILE *f,
+                                  bfd_sym_modules_table_entry *entry)
 {
   fprintf (f, "\"%.*s\" (NTE %lu)",
           bfd_sym_symbol_name (abfd, entry->mte_nte_index)[0],
@@ -1364,28 +1307,12 @@ bfd_sym_print_modules_table_entry (abfd, f, entry)
     fprintf (f, ", child %lu", entry->mte_cmte_index);
   else
     fprintf (f, ", no child");
-
-#if 0
-  {
-    MTE bfd_sym_modules_table_entry pentry;
-
-    ret = bfd_sym_fetch_modules_table_entry (abfd, &pentry, entry->mte_parent);
-    if (ret < 0)
-      fprintf (f, " parent MTE %lu [INVALID]\n", entry->mte_parent);
-    else
-      fprintf (f, " parent MTE %lu \"%.*s\"\n",
-              entry->mte_parent,
-              bfd_sym_symbol_name (abfd, pentry.mte_nte_index)[0],
-              &bfd_sym_symbol_name (abfd, pentry.mte_nte_index)[1]);
-  }
-#endif
 }
 
 void
-bfd_sym_print_file_references_table_entry (abfd, f, entry)
-     bfd *abfd;
-     FILE *f;
-     bfd_sym_file_references_table_entry *entry;
+bfd_sym_print_file_references_table_entry (bfd *abfd,
+                                          FILE *f,
+                                          bfd_sym_file_references_table_entry *entry)
 {
   switch (entry->generic.type)
     {
@@ -1415,10 +1342,9 @@ bfd_sym_print_file_references_table_entry (abfd, f, entry)
 }
 
 void
-bfd_sym_print_contained_modules_table_entry (abfd, f, entry)
-     bfd *abfd;
-     FILE *f;
-     bfd_sym_contained_modules_table_entry *entry;
+bfd_sym_print_contained_modules_table_entry (bfd *abfd,
+                                            FILE *f,
+                                            bfd_sym_contained_modules_table_entry *entry)
 {
   switch (entry->generic.type)
     {
@@ -1437,10 +1363,9 @@ bfd_sym_print_contained_modules_table_entry (abfd, f, entry)
 }
 
 void
-bfd_sym_print_contained_variables_table_entry (abfd, f, entry)
-     bfd *abfd;
-     FILE *f;
-     bfd_sym_contained_variables_table_entry *entry;
+bfd_sym_print_contained_variables_table_entry (bfd *abfd,
+                                              FILE *f,
+                                              bfd_sym_contained_variables_table_entry *entry)
 {
   if (entry->generic.type == BFD_SYM_END_OF_LIST)
     {
@@ -1488,10 +1413,9 @@ bfd_sym_print_contained_variables_table_entry (abfd, f, entry)
 }
 
 void
-bfd_sym_print_contained_statements_table_entry (abfd, f, entry)
-     bfd *abfd;
-     FILE *f;
-     bfd_sym_contained_statements_table_entry *entry;
+bfd_sym_print_contained_statements_table_entry (bfd *abfd,
+                                               FILE *f,
+                                               bfd_sym_contained_statements_table_entry *entry)
 {
   if (entry->generic.type == BFD_SYM_END_OF_LIST)
     {
@@ -1515,10 +1439,9 @@ bfd_sym_print_contained_statements_table_entry (abfd, f, entry)
 }
 
 void
-bfd_sym_print_contained_labels_table_entry (abfd, f, entry)
-     bfd *abfd;
-     FILE *f;
-     bfd_sym_contained_labels_table_entry *entry;
+bfd_sym_print_contained_labels_table_entry (bfd *abfd,
+                                           FILE *f,
+                                           bfd_sym_contained_labels_table_entry *entry)
 {
   if (entry->generic.type == BFD_SYM_END_OF_LIST)
     {
@@ -1543,17 +1466,15 @@ bfd_sym_print_contained_labels_table_entry (abfd, f, entry)
 }
 
 void
-bfd_sym_print_contained_types_table_entry (abfd, f, entry)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     FILE *f;
-     bfd_sym_contained_types_table_entry *entry ATTRIBUTE_UNUSED;
+bfd_sym_print_contained_types_table_entry (bfd *abfd ATTRIBUTE_UNUSED,
+                                          FILE *f,
+                                          bfd_sym_contained_types_table_entry *entry ATTRIBUTE_UNUSED)
 {
   fprintf (f, "[UNIMPLEMENTED]");
 }
 
 const char *
-bfd_sym_type_operator_name (num)
-     unsigned char num;
+bfd_sym_type_operator_name (unsigned char num)
 {
   switch (num)
     {
@@ -1576,8 +1497,7 @@ bfd_sym_type_operator_name (num)
 }
 
 const char *
-bfd_sym_type_basic_name (num)
-     unsigned char num;
+bfd_sym_type_basic_name (unsigned char num)
 {
   switch (num)
     {
@@ -1604,12 +1524,11 @@ bfd_sym_type_basic_name (num)
 }
 
 int
-bfd_sym_fetch_long (buf, len, offset, offsetptr, value)
-     unsigned char *buf;
-     unsigned long len;
-     unsigned long offset;
-     unsigned long *offsetptr;
-     long *value;
+bfd_sym_fetch_long (unsigned char *buf,
+                   unsigned long len,
+                   unsigned long offset,
+                   unsigned long *offsetptr,
+                   long *value)
 {
   int ret;
 
@@ -1671,13 +1590,12 @@ bfd_sym_fetch_long (buf, len, offset, offsetptr, value)
 }
 
 void
-bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr)
-     bfd *abfd;
-     FILE *f;
-     unsigned char *buf;
-     unsigned long len;
-     unsigned long offset;
-     unsigned long *offsetptr;
+bfd_sym_print_type_information (bfd *abfd,
+                               FILE *f,
+                               unsigned char *buf,
+                               unsigned long len,
+                               unsigned long offset,
+                               unsigned long *offsetptr)
 {
   unsigned int type;
 
@@ -1726,7 +1644,7 @@ bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr)
                       bfd_sym_symbol_name (abfd, tinfo.nte_index)[0],
                       &bfd_sym_symbol_name (abfd, tinfo.nte_index)[1]);
          }
-       fprintf (f, " (TTE %lu)", value);
+       fprintf (f, " (TTE %lu)", (unsigned long) value);
        break;
       }
 
@@ -1737,26 +1655,28 @@ bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr)
 
     case 3:
       {
-       unsigned long value;
+       long value;
 
        fprintf (f, "scalar (0x%x) of ", type);
        bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset);
        bfd_sym_fetch_long (buf, len, offset, &offset, &value);
-       fprintf (f, " (%lu)", value);
+       fprintf (f, " (%lu)", (unsigned long) value);
        break;
       }
 
     case 5:
       {
-       unsigned long lower, upper, nelem;
-       unsigned long i;
+       long lower, upper, nelem;
+       int i;
 
        fprintf (f, "enumeration (0x%x) of ", type);
        bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset);
        bfd_sym_fetch_long (buf, len, offset, &offset, &lower);
        bfd_sym_fetch_long (buf, len, offset, &offset, &upper);
        bfd_sym_fetch_long (buf, len, offset, &offset, &nelem);
-       fprintf (f, " from %lu to %lu with %lu elements: ", lower, upper, nelem);
+       fprintf (f, " from %lu to %lu with %lu elements: ",
+                (unsigned long) lower, (unsigned long) upper,
+                (unsigned long) nelem);
 
        for (i = 0; i < nelem; i++)
          {
@@ -1785,13 +1705,13 @@ bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr)
          fprintf (f, "union (0x%x) of ", type);
 
        bfd_sym_fetch_long (buf, len, offset, &offset, &nrec);
-       fprintf (f, "%lu elements: ", nrec);
+       fprintf (f, "%lu elements: ", (unsigned long) nrec);
 
        for (i = 0; i < nrec; i++)
          {
            bfd_sym_fetch_long (buf, len, offset, &offset, &eloff);
            fprintf (f, "\n                ");
-           fprintf (f, "offset %lu: ", eloff);
+           fprintf (f, "offset %lu: ", (unsigned long) eloff);
            bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset);
          }
        break;
@@ -1819,7 +1739,7 @@ bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr)
                 bfd_sym_symbol_name (abfd, value)[0],
                 &bfd_sym_symbol_name (abfd, value)[1]);
 
-      fprintf (f, " (NTE %lu) with type ", value);
+      fprintf (f, " (NTE %lu) with type ", (unsigned long) value);
       bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset);
       break;
     }
@@ -1867,10 +1787,9 @@ bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr)
 }
 
 void
-bfd_sym_print_type_information_table_entry (abfd, f, entry)
-     bfd *abfd;
-     FILE *f;
-     bfd_sym_type_information_table_entry *entry;
+bfd_sym_print_type_information_table_entry (bfd *abfd,
+                                           FILE *f,
+                                           bfd_sym_type_information_table_entry *entry)
 {
   unsigned char *buf;
   unsigned long offset;
@@ -1916,31 +1835,29 @@ bfd_sym_print_type_information_table_entry (abfd, f, entry)
   bfd_sym_print_type_information (abfd, f, buf, entry->physical_size, 0, &offset);
 
   if (offset != entry->physical_size)
-    fprintf (f, "\n            [parser used %lu bytes instead of %lu]", offset, entry->physical_size);        }
+    fprintf (f, "\n            [parser used %lu bytes instead of %lu]", offset, entry->physical_size);
+}
 
 void
-bfd_sym_print_file_references_index_table_entry (abfd, f, entry)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     FILE *f;
-     bfd_sym_file_references_index_table_entry *entry ATTRIBUTE_UNUSED;
+bfd_sym_print_file_references_index_table_entry (bfd *abfd ATTRIBUTE_UNUSED,
+                                                FILE *f,
+                                                bfd_sym_file_references_index_table_entry *entry ATTRIBUTE_UNUSED)
 {
   fprintf (f, "[UNIMPLEMENTED]");
 }
 
 void
-bfd_sym_print_constant_pool_entry (abfd, f, entry)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     FILE *f;
-     bfd_sym_constant_pool_entry *entry ATTRIBUTE_UNUSED;
+bfd_sym_print_constant_pool_entry (bfd *abfd ATTRIBUTE_UNUSED,
+                                  FILE *f,
+                                  bfd_sym_constant_pool_entry *entry ATTRIBUTE_UNUSED)
 {
   fprintf (f, "[UNIMPLEMENTED]");
 }
 
 unsigned char *
-bfd_sym_display_name_table_entry (abfd, f, entry)
-     bfd *abfd;
-     FILE *f;
-     unsigned char *entry;
+bfd_sym_display_name_table_entry (bfd *abfd,
+                                 FILE *f,
+                                 unsigned char *entry)
 {
   unsigned long index;
   unsigned long offset;
@@ -1971,9 +1888,7 @@ bfd_sym_display_name_table_entry (abfd, f, entry)
 }
 
 void
-bfd_sym_display_name_table (abfd, f)
-     bfd *abfd;
-     FILE *f;
+bfd_sym_display_name_table (bfd *abfd, FILE *f)
 {
   unsigned long name_table_len;
   unsigned char *name_table, *name_table_end, *cur;
@@ -1998,9 +1913,7 @@ bfd_sym_display_name_table (abfd, f)
 }
 
 void
-bfd_sym_display_resources_table (abfd, f)
-     bfd *abfd;
-     FILE *f;
+bfd_sym_display_resources_table (bfd *abfd, FILE *f)
 {
   unsigned long i;
   bfd_sym_resources_table_entry entry;
@@ -2026,9 +1939,7 @@ bfd_sym_display_resources_table (abfd, f)
 }
 
 void
-bfd_sym_display_modules_table (abfd, f)
-     bfd *abfd;
-     FILE *f;
+bfd_sym_display_modules_table (bfd *abfd, FILE *f)
 {
   unsigned long i;
   bfd_sym_modules_table_entry entry;
@@ -2054,9 +1965,7 @@ bfd_sym_display_modules_table (abfd, f)
 }
 
 void
-bfd_sym_display_file_references_table (abfd, f)
-     bfd *abfd;
-     FILE *f;
+bfd_sym_display_file_references_table (bfd *abfd, FILE *f)
 {
   unsigned long i;
   bfd_sym_file_references_table_entry entry;
@@ -2082,9 +1991,7 @@ bfd_sym_display_file_references_table (abfd, f)
 }
 
 void
-bfd_sym_display_contained_modules_table (abfd, f)
-     bfd *abfd;
-     FILE *f;
+bfd_sym_display_contained_modules_table (bfd *abfd, FILE *f)
 {
   unsigned long i;
   bfd_sym_contained_modules_table_entry entry;
@@ -2110,9 +2017,7 @@ bfd_sym_display_contained_modules_table (abfd, f)
 }
 
 void
-bfd_sym_display_contained_variables_table (abfd, f)
-     bfd *abfd;
-     FILE *f;
+bfd_sym_display_contained_variables_table (bfd *abfd, FILE *f)
 {
   unsigned long i;
   bfd_sym_contained_variables_table_entry entry;
@@ -2140,9 +2045,7 @@ bfd_sym_display_contained_variables_table (abfd, f)
 }
 
 void
-bfd_sym_display_contained_statements_table (abfd, f)
-     bfd *abfd;
-     FILE *f;
+bfd_sym_display_contained_statements_table (bfd *abfd, FILE *f)
 {
   unsigned long i;
   bfd_sym_contained_statements_table_entry entry;
@@ -2168,9 +2071,7 @@ bfd_sym_display_contained_statements_table (abfd, f)
 }
 
 void
-bfd_sym_display_contained_labels_table (abfd, f)
-     bfd *abfd;
-     FILE *f;
+bfd_sym_display_contained_labels_table (bfd *abfd, FILE *f)
 {
   unsigned long i;
   bfd_sym_contained_labels_table_entry entry;
@@ -2196,9 +2097,7 @@ bfd_sym_display_contained_labels_table (abfd, f)
 }
 
 void
-bfd_sym_display_contained_types_table (abfd, f)
-     bfd *abfd;
-     FILE *f;
+bfd_sym_display_contained_types_table (bfd *abfd, FILE *f)
 {
   unsigned long i;
   bfd_sym_contained_types_table_entry entry;
@@ -2224,9 +2123,7 @@ bfd_sym_display_contained_types_table (abfd, f)
 }
 
 void
-bfd_sym_display_file_references_index_table (abfd, f)
-     bfd *abfd;
-     FILE *f;
+bfd_sym_display_file_references_index_table (bfd *abfd, FILE *f)
 {
   unsigned long i;
   bfd_sym_file_references_index_table_entry entry;
@@ -2252,9 +2149,7 @@ bfd_sym_display_file_references_index_table (abfd, f)
 }
 
 void
-bfd_sym_display_constant_pool (abfd, f)
-     bfd *abfd;
-     FILE *f;
+bfd_sym_display_constant_pool (bfd *abfd, FILE *f)
 {
   unsigned long i;
   bfd_sym_constant_pool_entry entry;
@@ -2280,9 +2175,7 @@ bfd_sym_display_constant_pool (abfd, f)
 }
 
 void
-bfd_sym_display_type_information_table (abfd, f)
-     bfd *abfd;
-     FILE *f;
+bfd_sym_display_type_information_table (bfd *abfd, FILE *f)
 {
   unsigned long i;
   bfd_sym_type_table_entry index;
@@ -2320,10 +2213,7 @@ bfd_sym_display_type_information_table (abfd, f)
 }
 
 int
-bfd_sym_scan (abfd, version, mdata)
-     bfd *abfd;
-     bfd_sym_version version;
-     bfd_sym_data_struct *mdata;
+bfd_sym_scan (bfd *abfd, bfd_sym_version version, bfd_sym_data_struct *mdata)
 {
   asection *bfdsec;
   const char *name = "symbols";
@@ -2340,26 +2230,23 @@ bfd_sym_scan (abfd, version, mdata)
   if (mdata->name_table == NULL)
     return -1;
 
-  bfdsec = bfd_make_section_anyway (abfd, name);
+  bfdsec = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
   if (bfdsec == NULL)
     return -1;
 
   bfdsec->vma = 0;
   bfdsec->lma = 0;
-  bfdsec->_raw_size = 0;
+  bfdsec->size = 0;
   bfdsec->filepos = 0;
   bfdsec->alignment_power = 0;
 
-  bfdsec->flags = SEC_HAS_CONTENTS;
-
   abfd->tdata.sym_data = mdata;
 
   return 0;
 }
 
 const bfd_target *
-bfd_sym_object_p (abfd)
-     bfd *abfd;
+bfd_sym_object_p (bfd *abfd)
 {
   struct bfd_preserve preserve;
   bfd_sym_version version = -1;
@@ -2390,78 +2277,66 @@ bfd_sym_object_p (abfd)
   return NULL;
 }
 
-asymbol *
-bfd_sym_make_empty_symbol (abfd)
-     bfd *abfd;
-{
-  return (asymbol *) bfd_alloc (abfd, sizeof (asymbol));
-}
+#define bfd_sym_make_empty_symbol _bfd_generic_make_empty_symbol
 
 void
-bfd_sym_get_symbol_info (abfd, symbol, ret)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     asymbol *symbol;
-     symbol_info *ret;
+bfd_sym_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED, asymbol *symbol, symbol_info *ret)
 {
   bfd_symbol_info (symbol, ret);
 }
 
 long
-bfd_sym_get_symtab_upper_bound (abfd)
-     bfd *abfd ATTRIBUTE_UNUSED;
+bfd_sym_get_symtab_upper_bound (bfd *abfd ATTRIBUTE_UNUSED)
 {
   return 0;
 }
 
 long
-bfd_sym_canonicalize_symtab (abfd, sym)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     asymbol **sym ATTRIBUTE_UNUSED;
+bfd_sym_canonicalize_symtab (bfd *abfd ATTRIBUTE_UNUSED, asymbol **sym ATTRIBUTE_UNUSED)
 {
   return 0;
 }
 
 int
-bfd_sym_sizeof_headers (abfd, exec)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     bfd_boolean exec ATTRIBUTE_UNUSED;
+bfd_sym_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
+                       struct bfd_link_info *info ATTRIBUTE_UNUSED)
 {
   return 0;
 }
 
 const bfd_target sym_vec =
 {
-  "sym",                       /* name */
-  bfd_target_sym_flavour,      /* flavour */
-  BFD_ENDIAN_BIG,              /* byteorder */
-  BFD_ENDIAN_BIG,              /* header_byteorder */
-  (HAS_RELOC | EXEC_P |                /* object flags */
+  "sym",                       /* Name.  */
+  bfd_target_sym_flavour,      /* Flavour.  */
+  BFD_ENDIAN_BIG,              /* Byteorder.  */
+  BFD_ENDIAN_BIG,              /* Header byteorder.  */
+  (HAS_RELOC | EXEC_P |                /* Object flags.  */
    HAS_LINENO | HAS_DEBUG |
    HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
   (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_DATA
-   | SEC_ROM | SEC_HAS_CONTENTS), /* section_flags */
-  0,                           /* symbol_leading_char */
-  ' ',                         /* ar_pad_char */
-  16,                          /* ar_max_namelen */
+   | SEC_ROM | SEC_HAS_CONTENTS), /* Section_flags.  */
+  0,                           /* Symbol_leading_char.  */
+  ' ',                         /* AR_pad_char.  */
+  16,                          /* AR_max_namelen.  */
   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_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_getb16, bfd_getb_signed_16, bfd_putb16,  /* Hdrs.  */
+  {                            /* bfd_check_format */
     _bfd_dummy_target,
-    bfd_sym_object_p,          /* bfd_check_format */
+    bfd_sym_object_p,          /* bfd_check_format */
     _bfd_dummy_target,
     _bfd_dummy_target,
   },
-  {                            /* bfd_set_format */
+  {                            /* bfd_set_format */
     bfd_false,
     bfd_sym_mkobject,
     bfd_false,
     bfd_false,
   },
-  {                            /* bfd_write_contents */
+  {                            /* bfd_write_contents */
     bfd_false,
     bfd_true,
     bfd_false,
@@ -2473,7 +2348,7 @@ const bfd_target sym_vec =
   BFD_JUMP_TABLE_CORE (_bfd_nocore),
   BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
   BFD_JUMP_TABLE_SYMBOLS (bfd_sym),
-  BFD_JUMP_TABLE_RELOCS (bfd_sym),
+  BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
   BFD_JUMP_TABLE_WRITE (bfd_sym),
   BFD_JUMP_TABLE_LINK (bfd_sym),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
@@ -2482,4 +2357,3 @@ const bfd_target sym_vec =
 
   NULL
 };
-