* sim-info.c (sim_info): Be verbose when either VERBOSE or STATE_VERBOSE_P.
[deliverable/binutils-gdb.git] / gdb / xcoffread.c
index 49814c3800de50d6bd771c4ec735ee45a5e94099..dc34f3285b88146b47866584ae3de4e58ea9279b 100644 (file)
@@ -88,17 +88,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* This is output from LD.  */
 #define N_SETV 0x1C            /* Pointer to set vector in data area.  */
-
-/* Hook for recording the toc offset value of a symbol table into
-   the ldinfo structure. */
-
-void (*xcoff_add_toc_to_loadinfo_hook) PARAMS ((unsigned long)) = NULL;
-
-/* Hook for recording how to call xcoff_init_loadinfo for a native
-   rs6000 config only. */
-
-void (*xcoff_init_loadinfo_hook) PARAMS ((void)) = NULL;
-
 \f
 /* We put a pointer to this structure in the read_symtab_private field
    of the psymtab.  */
@@ -185,6 +174,9 @@ struct coff_symfile_info {
 
   /* Number of symbols in symtbl.  */
   int symtbl_num_syms;
+
+  /* Offset in data section to TOC anchor.  */
+  CORE_ADDR toc_offset;
 };
 
 static struct complaint storclass_complaint =
@@ -997,6 +989,7 @@ read_xcoff_symtab (pst)
 
   start_stabs ();
   start_symtab (filestring, (char *)NULL, file_start_addr);
+  record_debugformat ("XCOFF");
   symnum = ((struct symloc *)pst->read_symtab_private)->first_symnum;
   max_symnum =
     symnum + ((struct symloc *)pst->read_symtab_private)->numsyms;
@@ -1090,6 +1083,7 @@ read_xcoff_symtab (pst)
 
          start_stabs ();
          start_symtab ("_globals_", (char *)NULL, (CORE_ADDR)0);
+         record_debugformat ("XCOFF");
          cur_src_end_addr = first_object_file_end;
          /* done with all files, everything from here on is globals */
        }
@@ -1154,6 +1148,7 @@ read_xcoff_symtab (pst)
                          /* Give all csects for this source file the same
                             name.  */
                          start_symtab (filestring, NULL, (CORE_ADDR)0);
+                         record_debugformat ("XCOFF");
                        }
 
                      /* If this is the very first csect seen,
@@ -1282,6 +1277,7 @@ read_xcoff_symtab (pst)
 
          start_stabs ();
          start_symtab (filestring, (char *)NULL, (CORE_ADDR)0);
+         record_debugformat ("XCOFF");
          last_csect_name = 0;
 
          /* reset file start and end addresses. A compilation unit with no text
@@ -1615,9 +1611,8 @@ process_xcoff_symbol (cs, objfile)
   return sym2;
 }
 
-/* Extract the file name from the aux entry of a C_FILE symbol.  Return
-   only the last component of the name.  Result is in static storage and
-   is only good for temporary use.  */
+/* Extract the file name from the aux entry of a C_FILE symbol.
+   Result is in static storage and is only good for temporary use.  */
 
 static char *
 coff_getfilename (aux_entry, objfile)
@@ -1625,8 +1620,6 @@ coff_getfilename (aux_entry, objfile)
      struct objfile *objfile;
 {
   static char buffer[BUFSIZ];
-  register char *temp;
-  char *result;
 
   if (aux_entry->x_file.x_n.x_zeroes == 0)
     strcpy (buffer,
@@ -1637,14 +1630,7 @@ coff_getfilename (aux_entry, objfile)
       strncpy (buffer, aux_entry->x_file.x_fname, FILNMLEN);
       buffer[FILNMLEN] = '\0';
     }
-  result = buffer;
-
-  /* FIXME: We should not be throwing away the information about what
-     directory.  It should go into dirname of the symtab, or some such
-     place.  */
-  if ((temp = strrchr (result, '/')) != NULL)
-    result = temp + 1;
-  return (result);
+  return (buffer);
 }
 
 /* Set *SYMBOL to symbol number symno in symtbl.  */
@@ -2129,21 +2115,8 @@ xcoff_end_psymtab (pst, include_list, num_includes, capping_symbol_number,
         it is on the obstack, but we can forget to chain it on the list.  */
       /* Empty psymtabs happen as a result of header files which don't have
         any symbols in them.  There can be a lot of them.  */
-      struct partial_symtab *prev_pst;
-
-      /* First, snip it out of the psymtab chain */
-
-      if (pst->objfile->psymtabs == pst)
-       pst->objfile->psymtabs = pst->next;
-      else
-       for (prev_pst = pst->objfile->psymtabs; prev_pst; prev_pst = pst->next)
-         if (prev_pst->next == pst)
-           prev_pst->next = pst->next;
 
-      /* Next, put it on a free list for recycling */
-
-      pst->next = pst->objfile->free_psymtabs;
-      pst->objfile->free_psymtabs = pst;
+      discard_psymtab (pst);
 
       /* Indicate that psymtab was thrown away.  */
       pst = (struct partial_symtab *)NULL;
@@ -2634,12 +2607,22 @@ scan_xcoff_symtab (section_offsets, objfile)
                         dependencies_used, textlow_not_set);
     }
 
-  /* Record the toc offset value of this symbol table into ldinfo structure.
+  /* Record the toc offset value of this symbol table into objfile structure.
      If no XMC_TC0 is found, toc_offset should be zero. Another place to obtain
      this information would be file auxiliary header. */
 
-  if (xcoff_add_toc_to_loadinfo_hook != NULL)
-    (*xcoff_add_toc_to_loadinfo_hook) ((unsigned long) toc_offset);
+  ((struct coff_symfile_info *) objfile->sym_private)->toc_offset = toc_offset;
+}
+
+/* Return the toc offset value for a given objfile.  */
+
+CORE_ADDR
+get_toc_offset (objfile)
+     struct objfile *objfile;
+{
+  if (objfile)
+    return ((struct coff_symfile_info *) objfile->sym_private)->toc_offset;
+  return 0;
 }
 
 /* Scan and build partial symbols for a symbol file.
@@ -2668,10 +2651,6 @@ xcoff_initial_scan (objfile, section_offsets, mainline)
   char *name;
   unsigned int size;
 
-  /* Initialize load info structure. */
-  if (mainline && xcoff_init_loadinfo_hook != NULL)
-    (*xcoff_init_loadinfo_hook) ();
-
   info = (struct coff_symfile_info *) objfile -> sym_private;
   symfile_bfd = abfd = objfile->obfd;
   name = objfile->name;
This page took 0.02762 seconds and 4 git commands to generate.