OSDN Git Service

(MOD[SD]I_LIBCALL): Call ots$rem, not ots$mod.
[pf3gnuchains/gcc-fork.git] / gcc / mips-tdump.c
index 789a0fd..6890fc7 100644 (file)
@@ -1,7 +1,7 @@
 /* Read and manage MIPS symbol tables from object modules.
-   Source originally from hartzell@boulder.colorado.edu
-   Rewritten by: meissner@osf.org
-   Copyright (C) 1991 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1994, 1995 Free Software Foundation, Inc.
+   Contributed by hartzell@boulder.colorado.edu,
+   Rewritten by meissner@osf.org.
 
 This file is part of GNU CC.
 
@@ -17,11 +17,13 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
 
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/file.h>
+#include <time.h>
 #include <fcntl.h>
 #include <errno.h>
 #include "config.h"
@@ -42,7 +44,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
    which does not include mips.h.
 
    These must match the corresponding definitions in gdb/mipsread.c.
-   Unfortunately, gcc and gdb do not currently share any directories. */
+   Unfortunately, gcc and gdb do not currently share any directories.  */
 
 #define CODE_MASK 0x8F300
 #define MIPS_IS_STAB(sym) (((sym)->index & 0xFFF00) == CODE_MASK)
@@ -142,6 +144,11 @@ typedef enum st {
   st_StaticProc        = stStaticProc, /* load time only static procs */
   st_StaParam  = stStaParam,   /* Fortran static parameters */
   st_Constant  = stConstant,   /* const */
+#ifdef stStruct
+  st_Struct    = stStruct,     /* struct */
+  st_Union     = stUnion,      /* union */
+  st_Enum      = stEnum,       /* enum */
+#endif
   st_Str       = stStr,        /* string */
   st_Number    = stNumber,     /* pure number (ie. 4 NOR 2+2) */
   st_Expr      = stExpr,       /* 2+2 vs. 4 */
@@ -258,14 +265,14 @@ void  read_tfile  __proto((void));
 void  print_global_hdr __proto((struct filehdr *));
 void  print_sym_hdr    __proto((HDRR *));
 void  print_file_desc  __proto((FDR *, int));
-void  print_symbol     __proto((SYMR *, int, char *, AUXU *, int));
+void  print_symbol     __proto((SYMR *, int, char *, AUXU *, int, FDR *));
 void  print_aux                __proto((AUXU, int, int));
-void  emit_aggregate   __proto((char *, AUXU, AUXU, const char *));
+void  emit_aggregate   __proto((char *, AUXU, AUXU, const char *, FDR *));
 char *st_to_string     __proto((st_t));
 char *sc_to_string     __proto((sc_t));
 char *glevel_to_string __proto((glevel_t));
 char *lang_to_string   __proto((lang_t));
-char *type_to_string   __proto((AUXU *, int));
+char *type_to_string   __proto((AUXU *, int, FDR *));
 
 #ifndef __alpha
 extern PTR_T   malloc  __proto((size_t));
@@ -273,7 +280,6 @@ extern PTR_T        calloc  __proto((size_t, size_t));
 extern PTR_T   realloc __proto((PTR_T, size_t));
 extern void    free    __proto((PTR_T));
 #endif
-extern char    *ctime  __proto((time_t *));
 
 extern char *optarg;
 extern int   optind;
@@ -302,7 +308,7 @@ read_seek (ptr, size, offset, context)
   if (size == 0)               /* nothing to read */
     return ptr;
 
-  if ((ptr == (PTR_T)0 && (ptr = malloc (size)) == (PTR_T)0)
+  if ((ptr == (PTR_T) 0 && (ptr = malloc (size)) == (PTR_T) 0)
       || (tfile_offset != offset && lseek (tfile_fd, offset, 0) == -1)
       || (read_size = read (tfile_fd, ptr, size)) < 0)
     {
@@ -408,6 +414,11 @@ st_to_string(symbol_type)
     case st_StaticProc:        return "StaticProc";
     case st_Constant:  return "Constant";
     case st_StaParam:  return "StaticParam";
+#ifdef stStruct
+    case st_Struct:    return "Struct";
+    case st_Union:     return "Union";
+    case st_Enum:      return "Enum";
+#endif
     case st_Str:       return "String";
     case st_Number:    return "Number";
     case st_Expr:      return "Expr";
@@ -440,9 +451,10 @@ glevel_to_string (g_level)
 /* Convert the type information to string format.  */
 
 char *
-type_to_string (aux_ptr, index)
+type_to_string (aux_ptr, index, fdp)
      AUXU *aux_ptr;
      int index;
+     FDR *fdp;
 {
   AUXU u;
   struct qual {
@@ -539,7 +551,7 @@ type_to_string (aux_ptr, index)
         2nd word is file index if 1st word rfd is ST_RFDESCAPE.  */
 
     case bt_Struct:            /* Structure (Record) */
-      emit_aggregate (p1, aux_ptr[index], aux_ptr[index+1], "struct");
+      emit_aggregate (p1, aux_ptr[index], aux_ptr[index+1], "struct", fdp);
       used_ptr[index] = 1;
       if (aux_ptr[index].rndx.rfd == ST_RFDESCAPE)
        used_ptr[++index] = 1;
@@ -552,7 +564,7 @@ type_to_string (aux_ptr, index)
         2nd word is file index if 1st word rfd is ST_RFDESCAPE.  */
 
     case bt_Union:             /* Union */
-      emit_aggregate (p1, aux_ptr[index], aux_ptr[index+1], "union");
+      emit_aggregate (p1, aux_ptr[index], aux_ptr[index+1], "union", fdp);
       used_ptr[index] = 1;
       if (aux_ptr[index].rndx.rfd == ST_RFDESCAPE)
        used_ptr[++index] = 1;
@@ -565,7 +577,7 @@ type_to_string (aux_ptr, index)
         2nd word is file index if 1st word rfd is ST_RFDESCAPE.  */
 
     case bt_Enum:              /* Enumeration */
-      emit_aggregate (p1, aux_ptr[index], aux_ptr[index+1], "enum");
+      emit_aggregate (p1, aux_ptr[index], aux_ptr[index+1], "enum", fdp);
       used_ptr[index] = 1;
       if (aux_ptr[index].rndx.rfd == ST_RFDESCAPE)
        used_ptr[++index] = 1;
@@ -594,7 +606,7 @@ type_to_string (aux_ptr, index)
       break;
 
     case bt_Indirect:          /* forward or unnamed typedef */
-      strcpy (p1, "forward/unamed typedef");
+      strcpy (p1, "forward/unnamed typedef");
       break;
 
     case bt_FixedDec:          /* Fixed Decimal */
@@ -709,7 +721,7 @@ type_to_string (aux_ptr, index)
                int j;
 
                /* Print array bounds reversed (ie, in the order the C
-                  programmer writes them).  C is such a fun language.... */
+                  programmer writes them).  C is such a fun language....  */
 
                while (i < 5 && qualifiers[i+1].type == tq_Array)
                  i++;
@@ -765,7 +777,7 @@ print_global_hdr (ptr)
   printf("    %-*s %ld\n",     24, "symbolic header offset", (long)   ptr->f_symptr);
   printf("    %-*s %ld\n",     24, "symbolic header size",   (long)   ptr->f_nsyms);
   printf("    %-*s %ld\n",     24, "optional header",       (long)   ptr->f_opthdr);
-  printf("    %-*s 0x%lx",     24, "flags",                 (ushort) flags);
+  printf("    %-*s 0x%x",     24, "flags",                  (ushort) flags);
 
   if ((flags & F_RELFLG) != 0)
     printf (", F_RELFLG");
@@ -820,73 +832,74 @@ print_sym_hdr (sym_ptr)
   printf("    %-*s %11s %11s %11s\n", width, "Info", "Offset", "Number", "Bytes");
   printf("    %-*s %11s %11s %11s\n", width, "====", "======", "======", "=====\n");
 
-  printf("    %-*s %11ld %11d %11d [%d]\n", width, "Line numbers",
-        (long)sym_ptr->cbLineOffset,
-        (long)sym_ptr->cbLine,
-        (long)sym_ptr->cbLine,
-        (int)sym_ptr->ilineMax);
-
-  printf("    %-*s %11ld %11d %11d\n", width, "Dense numbers",
-        (long)sym_ptr->cbDnOffset,
-        (long)sym_ptr->idnMax,
-        (long)(sym_ptr->idnMax * sizeof (DNR)));
-
-  printf("    %-*s %11ld %11d %11d\n", width, "Procedures Tables",
-        (long)sym_ptr->cbPdOffset,
-        (long)sym_ptr->ipdMax,
-        (long)(sym_ptr->ipdMax * sizeof (PDR)));
-
-  printf("    %-*s %11ld %11d %11d\n", width, "Local Symbols",
-        (long)sym_ptr->cbSymOffset,
-        (long)sym_ptr->isymMax,
-        (long)(sym_ptr->isymMax * sizeof (SYMR)));
-
-  printf("    %-*s %11ld %11d %11d\n", width, "Optimization Symbols",
-        (long)sym_ptr->cbOptOffset,
-        (long)sym_ptr->ioptMax,
-        (long)(sym_ptr->ioptMax * sizeof (OPTR)));
-
-  printf("    %-*s %11ld %11d %11d\n", width, "Auxiliary Symbols",
-        (long)sym_ptr->cbAuxOffset,
-        (long)sym_ptr->iauxMax,
-        (long)(sym_ptr->iauxMax * sizeof (AUXU)));
-
-  printf("    %-*s %11ld %11d %11d\n", width, "Local Strings",
-        (long)sym_ptr->cbSsOffset,
-        (long)sym_ptr->issMax,
-        (long)sym_ptr->issMax);
-
-  printf("    %-*s %11ld %11d %11d\n", width, "External Strings",
-        (long)sym_ptr->cbSsExtOffset,
-        (long)sym_ptr->issExtMax,
-        (long)sym_ptr->issExtMax);
-
-  printf("    %-*s %11ld %11d %11d\n", width, "File Tables",
-        (long)sym_ptr->cbFdOffset,
-        (long)sym_ptr->ifdMax,
-        (long)(sym_ptr->ifdMax * sizeof (FDR)));
-
-  printf("    %-*s %11ld %11d %11d\n", width, "Relative Files",
-        (long)sym_ptr->cbRfdOffset,
-        (long)sym_ptr->crfd,
-        (long)(sym_ptr->crfd * sizeof (ulong)));
-
-  printf("    %-*s %11ld %11d %11d\n", width, "External Symbols",
-        (long)sym_ptr->cbExtOffset,
-        (long)sym_ptr->iextMax,
-        (long)(sym_ptr->iextMax * sizeof (EXTR)));
+  printf("    %-*s %11ld %11ld %11ld [%d]\n", width, "Line numbers",
+        (long) sym_ptr->cbLineOffset,
+        (long) sym_ptr->cbLine,
+        (long) sym_ptr->cbLine,
+        (int) sym_ptr->ilineMax);
+
+  printf("    %-*s %11ld %11ld %11ld\n", width, "Dense numbers",
+        (long) sym_ptr->cbDnOffset,
+        (long) sym_ptr->idnMax,
+        (long) (sym_ptr->idnMax * sizeof (DNR)));
+
+  printf("    %-*s %11ld %11ld %11ld\n", width, "Procedures Tables",
+        (long) sym_ptr->cbPdOffset,
+        (long) sym_ptr->ipdMax,
+        (long) (sym_ptr->ipdMax * sizeof (PDR)));
+
+  printf("    %-*s %11ld %11ld %11ld\n", width, "Local Symbols",
+        (long) sym_ptr->cbSymOffset,
+        (long) sym_ptr->isymMax,
+        (long) (sym_ptr->isymMax * sizeof (SYMR)));
+
+  printf("    %-*s %11ld %11ld %11ld\n", width, "Optimization Symbols",
+        (long) sym_ptr->cbOptOffset,
+        (long) sym_ptr->ioptMax,
+        (long) (sym_ptr->ioptMax * sizeof (OPTR)));
+
+  printf("    %-*s %11ld %11ld %11ld\n", width, "Auxiliary Symbols",
+        (long) sym_ptr->cbAuxOffset,
+        (long) sym_ptr->iauxMax,
+        (long) (sym_ptr->iauxMax * sizeof (AUXU)));
+
+  printf("    %-*s %11ld %11ld %11ld\n", width, "Local Strings",
+        (long) sym_ptr->cbSsOffset,
+        (long) sym_ptr->issMax,
+        (long) sym_ptr->issMax);
+
+  printf("    %-*s %11ld %11ld %11ld\n", width, "External Strings",
+        (long) sym_ptr->cbSsExtOffset,
+        (long) sym_ptr->issExtMax,
+        (long) sym_ptr->issExtMax);
+
+  printf("    %-*s %11ld %11ld %11ld\n", width, "File Tables",
+        (long) sym_ptr->cbFdOffset,
+        (long) sym_ptr->ifdMax,
+        (long) (sym_ptr->ifdMax * sizeof (FDR)));
+
+  printf("    %-*s %11ld %11ld %11ld\n", width, "Relative Files",
+        (long) sym_ptr->cbRfdOffset,
+        (long) sym_ptr->crfd,
+        (long) (sym_ptr->crfd * sizeof (ulong)));
+
+  printf("    %-*s %11ld %11ld %11ld\n", width, "External Symbols",
+        (long) sym_ptr->cbExtOffset,
+        (long) sym_ptr->iextMax,
+        (long) (sym_ptr->iextMax * sizeof (EXTR)));
 }
 
 \f
 /* Print out a symbol.  */
 
 void
-print_symbol (sym_ptr, number, strbase, aux_base, ifd)
+print_symbol (sym_ptr, number, strbase, aux_base, ifd, fdp)
      SYMR *sym_ptr;
      int number;
      char *strbase;
      AUXU *aux_base;
      int ifd;
+     FDR *fdp;
 {
   sc_t storage_class = (sc_t) sym_ptr->sc;
   st_t symbol_type   = (st_t) sym_ptr->st;
@@ -896,7 +909,7 @@ print_symbol (sym_ptr, number, strbase, aux_base, ifd)
 
   printf ("\n    Symbol# %d: \"%s\"\n", number, sym_ptr->iss + strbase);
 
-  if (aux_base != (AUXU *)0 && index != indexNil)
+  if (aux_base != (AUXU *) 0 && index != indexNil)
     switch (symbol_type)
       {
       case st_Nil:
@@ -908,7 +921,7 @@ print_symbol (sym_ptr, number, strbase, aux_base, ifd)
        printf ("      End+1 symbol: %ld\n", index);
        if (want_scope)
          {
-           if (free_scope == (scope_t *)0)
+           if (free_scope == (scope_t *) 0)
              scope_ptr = (scope_t *) malloc (sizeof (scope_t));
            else
              {
@@ -934,7 +947,7 @@ print_symbol (sym_ptr, number, strbase, aux_base, ifd)
 
        if (want_scope)
          {
-           if (cur_scope == (scope_t *)0)
+           if (cur_scope == (scope_t *) 0)
              printf ("      Can't pop end scope\n");
            else
              {
@@ -954,18 +967,15 @@ print_symbol (sym_ptr, number, strbase, aux_base, ifd)
          {
            used_ptr[index] = used_ptr[index+1] = 1;
            printf ("      End+1 symbol: %-7ld   Type:  %s\n",
-                   aux_base[index].isym, type_to_string (aux_base, index+1));
+                   aux_base[index].isym,
+                   type_to_string (aux_base, index+1, fdp));
          }
        else                    /* global symbol */
-         {
-           used_ptr[index] = 1;
-           printf ("      Type: %s\n",
-                   type_to_string (aux_base, index));
-         }
+         printf ("      Local symbol: %ld\n", index);
 
        if (want_scope)
          {
-           if (free_scope == (scope_t *)0)
+           if (free_scope == (scope_t *) 0)
              scope_ptr = (scope_t *) malloc (sizeof (scope_t));
            else
              {
@@ -980,12 +990,20 @@ print_symbol (sym_ptr, number, strbase, aux_base, ifd)
          }
        break;
 
+#ifdef stStruct
+      case st_Struct:
+      case st_Union:
+      case st_Enum:
+       printf ("      End+1 symbol: %lu\n", index);
+       break;
+#endif
+
       default:
        if (!MIPS_IS_STAB (sym_ptr))
          {
            used_ptr[index] = 1;
            printf ("      Type: %s\n",
-                   type_to_string (aux_base, index));
+                   type_to_string (aux_base, index, fdp));
          }
        break;
       }
@@ -993,12 +1011,12 @@ print_symbol (sym_ptr, number, strbase, aux_base, ifd)
   if (want_scope)
     {
       printf ("      Scopes:  ");
-      if (cur_scope == (scope_t *)0)
+      if (cur_scope == (scope_t *) 0)
        printf (" none\n");
       else
        {
          for (scope_ptr = cur_scope;
-              scope_ptr != (scope_t *)0;
+              scope_ptr != (scope_t *) 0;
               scope_ptr = scope_ptr->prev)
            {
              char *class;
@@ -1013,7 +1031,7 @@ print_symbol (sym_ptr, number, strbase, aux_base, ifd)
              else
                class = "???";
 
-             printf (" %d [%s]", scope_ptr->open_sym, class);
+             printf (" %ld [%s]", scope_ptr->open_sym, class);
            }
          printf ("\n");
        }
@@ -1080,30 +1098,39 @@ print_aux (u, auxi, used)
 /* Write aggregate information to a string.  */
 
 void
-emit_aggregate (string, u, u2, which)
+emit_aggregate (string, u, u2, which, fdp)
      char *string;
      AUXU u;
      AUXU u2;
      const char *which;
+     FDR *fdp;
 {
-  int ifd = u.rndx.rfd;
-  int index = u.rndx.index;
-  int sym_base, ss_base;
-  int name;
+  unsigned int ifd = u.rndx.rfd;
+  unsigned int index = u.rndx.index;
+  const char *name;
   
   if (ifd == ST_RFDESCAPE)
     ifd = u2.isym;
-
-  sym_base = file_desc[ifd].isymBase;
-  ss_base  = file_desc[ifd].issBase;
   
-  name = (index == indexNil) ? 0 : l_symbols[index + sym_base].iss;
+  /* An ifd of -1 is an opaque type.  An escaped index of 0 is a
+     struct return type of a procedure compiled without -g.  */
+  if (ifd == 0xffffffff
+      || (u.rndx.rfd == ST_RFDESCAPE && index == 0))
+    name = "<undefined>";
+  else if (index == indexNil)
+    name = "<no name>";
+  else
+    {
+      if (fdp == 0 || sym_hdr.crfd == 0)
+       fdp = &file_desc[ifd];
+      else
+       fdp = &file_desc[rfile_desc[fdp->rfdBase + ifd]];
+      name = &l_strings[fdp->issBase + l_symbols[index + fdp->isymBase].iss];
+    }
+  
   sprintf (string,
-          "%s %s { ifd = %d, index = %d }",
-          which,
-          (name == 0) ? "/* no name */" : &l_strings[ ss_base + name ],
-          ifd,
-          index);
+          "%s %s { ifd = %u, index = %u }",
+          which, name, ifd, index);
 }
 
 \f
@@ -1127,7 +1154,7 @@ print_file_desc (fdp, number)
 
   printf ("\nFile #%d, \"%s\"\n\n", number, str_base + fdp->rss);
 
-  printf ("    Name index  = %-10d Readin      = %s\n",
+  printf ("    Name index  = %-10ld Readin      = %s\n",
          (long) fdp->rss, (fdp->fReadin) ? "Yes" : "No");
 
   printf ("    Merge       = %-10s Endian      = %s\n",
@@ -1150,7 +1177,7 @@ print_file_desc (fdp, number)
         (ulong) fdp->cbSs,
         (ulong) (fdp->issBase + sym_hdr.cbSsOffset));
 
-  printf("    %-*s %11lu %11u %11u %11lu\n",
+  printf("    %-*s %11lu %11lu %11lu %11lu\n",
         width, "Local symbols",
         (ulong) fdp->isymBase,
         (ulong) fdp->csym,
@@ -1161,7 +1188,7 @@ print_file_desc (fdp, number)
         width, "Line numbers",
         (ulong) fdp->cbLineOffset,
         (ulong) fdp->cline,
-        (ulong) fdp->cline,
+        (ulong) fdp->cbLine,
         (ulong) (fdp->cbLineOffset + sym_hdr.cbLineOffset));
 
   printf("    %-*s %11lu %11lu %11lu %11lu\n",
@@ -1171,7 +1198,7 @@ print_file_desc (fdp, number)
         (ulong) (fdp->copt * sizeof (OPTR)),
         (ulong) (fdp->ioptBase * sizeof (OPTR) + sym_hdr.cbOptOffset));
 
-  printf("    %-*s %11llu %11lu %11lu %11lu\n",
+  printf("    %-*s %11lu %11lu %11lu %11lu\n",
         width, "Procedures",
         (ulong) fdp->ipdFirst,
         (ulong) fdp->cpd,
@@ -1193,7 +1220,7 @@ print_file_desc (fdp, number)
         (ulong) (fdp->rfdBase * sizeof(ulong) + sym_hdr.cbRfdOffset));
 
 
-  if (want_scope && cur_scope != (scope_t *)0)
+  if (want_scope && cur_scope != (scope_t *) 0)
     printf ("\n    Warning scope does not start at 0!\n");
 
   /* 
@@ -1208,9 +1235,10 @@ print_file_desc (fdp, number)
                  symi - fdp->isymBase,
                  str_base,
                  aux_base,
-                 -1);
+                 -1,
+                 fdp);
 
-  if (want_scope && cur_scope != (scope_t *)0)
+  if (want_scope && cur_scope != (scope_t *) 0)
     printf ("\n    Warning scope does not end at 0!\n");
 
   /*
@@ -1294,14 +1322,15 @@ print_file_desc (fdp, number)
        {
          int delta, count;
          long cur_line = proc_ptr->lnLow;
-         uchar *line_ptr = ((uchar *)lines) + proc_ptr->cbLineOffset;
+         uchar *line_ptr = (((uchar *)lines) + proc_ptr->cbLineOffset
+                            + fdp->cbLineOffset);
          uchar *line_end;
 
          if (pdi == fdp->cpd + fdp->ipdFirst - 1)      /* last procedure */
-           line_end = ((uchar *)lines) + fdp->cbLine + fdp->ilineBase;
-         else                                          /* not last proc. */
-           line_end = ((uchar *)lines) + proc_desc[pdi+1].cbLineOffset;
-
+           line_end = ((uchar *)lines) + fdp->cbLine + fdp->cbLineOffset;
+         else                                          /* not last proc.  */
+           line_end = (((uchar *)lines) + proc_desc[pdi+1].cbLineOffset
+                       + fdp->cbLineOffset);
 
          printf ("\n\tThere are %lu bytes holding line numbers, starting at %lu.\n",
                  (ulong) (line_end - line_ptr),
@@ -1339,12 +1368,12 @@ read_tfile __proto((void))
   short magic;
   off_t sym_hdr_offset = 0;
 
-  (void) read_seek ((PTR_T) &magic, sizeof (magic), (off_t)0, "Magic number");
+  (void) read_seek ((PTR_T) &magic, sizeof (magic), (off_t) 0, "Magic number");
   if (!tfile)
     {
       /* Print out the global header, since this is not a T-file.  */
 
-      (void) read_seek ((PTR_T) &global_hdr, sizeof (global_hdr), (off_t)0,
+      (void) read_seek ((PTR_T) &global_hdr, sizeof (global_hdr), (off_t) 0,
                        "Global file header");
 
       print_global_hdr (&global_hdr);
@@ -1365,32 +1394,32 @@ read_tfile __proto((void))
 
   print_sym_hdr (&sym_hdr);
 
-  lines = (LINER *) read_seek ((PTR_T)0,
+  lines = (LINER *) read_seek ((PTR_T) 0,
                               sym_hdr.cbLine,
                               sym_hdr.cbLineOffset,
                               "Line numbers");
 
-  dense_nums = (DNR *) read_seek ((PTR_T)0,
+  dense_nums = (DNR *) read_seek ((PTR_T) 0,
                                  sym_hdr.idnMax * sizeof (DNR),
                                  sym_hdr.cbDnOffset,
                                  "Dense numbers");
 
-  proc_desc = (PDR *) read_seek ((PTR_T)0,
+  proc_desc = (PDR *) read_seek ((PTR_T) 0,
                                 sym_hdr.ipdMax * sizeof (PDR),
                                 sym_hdr.cbPdOffset,
                                 "Procedure tables");
 
-  l_symbols = (SYMR *) read_seek ((PTR_T)0,
+  l_symbols = (SYMR *) read_seek ((PTR_T) 0,
                                  sym_hdr.isymMax * sizeof (SYMR),
                                  sym_hdr.cbSymOffset,
                                  "Local symbols");
 
-  opt_symbols = (OPTR *) read_seek ((PTR_T)0,
+  opt_symbols = (OPTR *) read_seek ((PTR_T) 0,
                                    sym_hdr.ioptMax * sizeof (OPTR),
                                    sym_hdr.cbOptOffset,
                                    "Optimization symbols");
 
-  aux_symbols = (AUXU *) read_seek ((PTR_T)0,
+  aux_symbols = (AUXU *) read_seek ((PTR_T) 0,
                                    sym_hdr.iauxMax * sizeof (AUXU),
                                    sym_hdr.cbAuxOffset,
                                    "Auxiliary symbols");
@@ -1398,34 +1427,34 @@ read_tfile __proto((void))
   if (sym_hdr.iauxMax > 0)
     {
       aux_used = calloc (sym_hdr.iauxMax, 1);
-      if (aux_used == (char *)0)
+      if (aux_used == (char *) 0)
        {
          perror ("calloc");
          exit (1);
        }
     }
 
-  l_strings = (char *) read_seek ((PTR_T)0,
+  l_strings = (char *) read_seek ((PTR_T) 0,
                                  sym_hdr.issMax,
                                  sym_hdr.cbSsOffset,
                                  "Local string table");
 
-  e_strings = (char *) read_seek ((PTR_T)0,
+  e_strings = (char *) read_seek ((PTR_T) 0,
                                  sym_hdr.issExtMax,
                                  sym_hdr.cbSsExtOffset,
                                  "External string table");
 
-  file_desc = (FDR *) read_seek ((PTR_T)0,
+  file_desc = (FDR *) read_seek ((PTR_T) 0,
                                 sym_hdr.ifdMax * sizeof (FDR),
                                 sym_hdr.cbFdOffset,
                                 "File tables");
 
-  rfile_desc = (ulong *) read_seek ((PTR_T)0,
+  rfile_desc = (ulong *) read_seek ((PTR_T) 0,
                                    sym_hdr.crfd * sizeof (ulong),
                                    sym_hdr.cbRfdOffset,
                                    "Relative file tables");
 
-  e_symbols = (EXTR *) read_seek ((PTR_T)0,
+  e_symbols = (EXTR *) read_seek ((PTR_T) 0,
                                  sym_hdr.iextMax * sizeof (EXTR),
                                  sym_hdr.cbExtOffset,
                                  "External symbols");
@@ -1457,7 +1486,7 @@ main (argc, argv)
   if (errors || optind != argc - 1)
     {
       fprintf (stderr, "Calling Sequence:\n");
-      fprintf (stderr, "\t%0 [-alrst] <object-or-T-file>\n", argv[0]);
+      fprintf (stderr, "\t%s [-alrst] <object-or-T-file>\n", argv[0]);
       fprintf (stderr, "\n");
       fprintf (stderr, "switches:\n");
       fprintf (stderr, "\t-a Print out auxiliary table.\n");
@@ -1526,7 +1555,8 @@ main (argc, argv)
   for(i = 0; i < sym_hdr.iextMax; i++)
     print_symbol (&e_symbols[i].asym, i, e_strings,
                  aux_symbols + file_desc[e_symbols[i].ifd].iauxBase,
-                 e_symbols[i].ifd);
+                 e_symbols[i].ifd,
+                 &file_desc[e_symbols[i].ifd]);
 
   /*
    * Print unused aux symbols now.
@@ -1550,7 +1580,7 @@ main (argc, argv)
                      i,
                      (long) aux_symbols[i].isym,
                      (long) aux_symbols[i].isym,
-                     type_to_string (aux_symbols, i));
+                     type_to_string (aux_symbols, i, (FDR *) 0));
            }
        }
     }