* targets.c (bfd_target_vector) [SELECT_VECS not defined]: Add
[binutils-gdb.git] / bfd / syms.c
index 138979c3f4bddbf89e4fa538000fd8e4ae2f3b58..feaddd6d3f79cdd339d72518c52d3885e6891bd2 100644 (file)
@@ -1,5 +1,6 @@
 /* Generic symbol-table support for the BFD library.
-   Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997
+   Free Software Foundation, Inc.
    Written by Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -87,7 +88,7 @@ SUBSECTION
 |           process_symbol (symbol_table[i]);
 |        }
 
-       All storage for the symbols themselves is in an obstack
+       All storage for the symbols themselves is in an objalloc
        connected to the BFD; it is freed when the BFD is closed.
 
 
@@ -307,6 +308,8 @@ CODE_FRAGMENT
 #include "bfdlink.h"
 #include "aout/stab_gnu.h"
 
+static char coff_section_type PARAMS ((const char *));
+
 /*
 DOCDD
 INODE
@@ -340,8 +343,35 @@ SYNOPSIS
 DESCRIPTION
        Return true if the given symbol @var{sym} in the BFD @var{abfd} is
        a compiler generated local label, else return false.
-.#define bfd_is_local_label(abfd, sym) \
-.     BFD_SEND (abfd, _bfd_is_local_label,(abfd, sym))
+*/
+
+boolean
+bfd_is_local_label (abfd, sym)
+     bfd *abfd;
+     asymbol *sym;
+{
+  if ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0)
+    return false;
+  if (sym->name == NULL)
+    return false;
+  return bfd_is_local_label_name (abfd, sym->name);
+}
+
+/*
+FUNCTION
+       bfd_is_local_label_name
+
+SYNOPSIS
+        boolean bfd_is_local_label_name(bfd *abfd, const char *name);
+
+DESCRIPTION
+       Return true if a symbol with the name @var{name} in the BFD
+       @var{abfd} is a compiler generated local label, else return
+       false.  This just checks whether the name has the form of a
+       local label.
+
+.#define bfd_is_local_label_name(abfd, name) \
+.     BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
 */
 
 /*
@@ -483,13 +513,16 @@ static CONST struct section_to_type stt[] =
 {
   {"*DEBUG*", 'N'},
   {".bss", 'b'},
+  {"zerovars", 'b'},           /* MRI .bss */
   {".data", 'd'},
+  {"vars", 'd'},               /* MRI .data */
   {".rdata", 'r'},             /* Read only data.  */
   {".rodata", 'r'},            /* Read only data.  */
   {".sbss", 's'},              /* Small BSS (uninitialized data).  */
   {".scommon", 'c'},           /* Small common.  */
   {".sdata", 'g'},             /* Small initialized data.  */
   {".text", 't'},
+  {"code", 't'},               /* MRI .text */
   {0, 0}
 };
 
@@ -501,7 +534,7 @@ static CONST struct section_to_type stt[] =
 
 static char
 coff_section_type (s)
-     char *s;
+     const char *s;
 {
   CONST struct section_to_type *t;
 
@@ -616,7 +649,7 @@ DESCRIPTION
        Not enough memory exists to create private data for @var{osec}.
 
 .#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
-.     BFD_SEND (ibfd, _bfd_copy_private_symbol_data, \
+.     BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
 .              (ibfd, isymbol, obfd, osymbol))
 
 */
@@ -768,7 +801,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
        {
          /* No stabs debugging information.  Set *pinfo so that we
              can return quickly in the info != NULL case above.  */
-         *pinfo = info;
+         *pinfo = (PTR) info;
          return true;
        }
 
@@ -841,7 +874,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
       if (reloc_vector != NULL)
        free (reloc_vector);
 
-      *pinfo = info;
+      *pinfo = (PTR) info;
     }
 
   /* We are passed a section relative offset.  The offsets in the
@@ -930,7 +963,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
              break;
            }
 
-         name = str + bfd_get_32 (abfd, stab + STRDXOFF);
+         name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
 
          /* An empty string indicates the end of the compilation
              unit.  */
@@ -963,7 +996,8 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
            {
              stab += STABSIZE;
              directory_name = current_file_name;
-             current_file_name = str + bfd_get_32 (abfd, stab + STRDXOFF);
+             current_file_name = ((char *) str
+                                  + bfd_get_32 (abfd, stab + STRDXOFF));
            }
 
          main_file_name = current_file_name;
@@ -972,7 +1006,8 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
 
        case N_SOL:
          /* The name of an include file.  */
-         current_file_name = str + bfd_get_32 (abfd, stab + STRDXOFF);
+         current_file_name = ((char *) str
+                              + bfd_get_32 (abfd, stab + STRDXOFF));
          break;
 
        case N_SLINE:
@@ -992,7 +1027,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
        case N_FUN:
          /* A function name.  */
          val = bfd_get_32 (abfd, stab + VALOFF);
-         name = str + bfd_get_32 (abfd, stab + STRDXOFF);
+         name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
 
          /* An empty string here indicates the end of a function, and
             the value is relative to fnaddr.  */