* archive.c (_bfd_write_archive_contents): Revert June 1 change.
[deliverable/binutils-gdb.git] / bfd / syms.c
index 4154cbfd831c39e17a2402e225aeb7f42a4832a7..2234c80f6b22dd286a23bbba5e2551116519455f 100644 (file)
@@ -61,12 +61,15 @@ SUBSECTION
        allocating storage, and the actual reading process. This is an
        excerpt from an application which reads the symbol table:
 
-|        unsigned int storage_needed;
+|        long storage_needed;
 |        asymbol **symbol_table;
-|        unsigned int number_of_symbols;
-|        unsigned int i;
+|        long number_of_symbols;
+|        long i;
 |
-|        storage_needed = get_symtab_upper_bound (abfd);
+|        storage_needed = bfd_get_symtab_upper_bound (abfd);
+|
+|         if (storage_needed < 0)
+|           FAIL
 |
 |        if (storage_needed == 0) {
 |           return ;
@@ -76,6 +79,9 @@ SUBSECTION
 |        number_of_symbols =
 |           bfd_canonicalize_symtab (abfd, symbol_table);
 |
+|         if (number_of_symbols < 0)
+|           FAIL
+|
 |        for (i = 0; i < number_of_symbols; i++) {
 |           process_symbol (symbol_table[i]);
 |        }
@@ -256,12 +262,15 @@ CODE_FRAGMENT
 .
 .      {* A pointer to the section to which this symbol is
 .         relative.  This will always be non NULL, there are special
-.          sections for undefined and absolute symbols *}
+.          sections for undefined and absolute symbols *}
 .  struct sec *section;
 .
-.      {* Back end special data. This is being phased out in favour
-.         of making this a union. *}
-.  PTR udata;
+.      {* Back end special data.  *}
+.  union
+.    {
+.      PTR p;
+.      bfd_vma i;
+.    } udata;
 .
 .} asymbol;
 */
@@ -282,17 +291,31 @@ SUBSECTION
 
 /*
 FUNCTION
-       get_symtab_upper_bound
+       bfd_get_symtab_upper_bound
 
 DESCRIPTION
        Return the number of bytes required to store a vector of pointers
        to <<asymbols>> for all the symbols in the BFD @var{abfd},
        including a terminal NULL pointer. If there are no symbols in
-       the BFD, then return 0.
+       the BFD, then return 0.  If an error occurs, return -1.
+
+.#define bfd_get_symtab_upper_bound(abfd) \
+.     BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
+
+*/
+
+/*
+FUNCTION
+       bfd_is_local_label
 
-.#define get_symtab_upper_bound(abfd) \
-.     BFD_SEND (abfd, _get_symtab_upper_bound, (abfd))
+SYNOPSIS
+        boolean bfd_is_local_label(bfd *abfd, asymbol *sym);
 
+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))
 */
 
 /*
@@ -372,16 +395,17 @@ bfd_print_symbol_vandf (arg, symbol)
     }
 
   /* This presumes that a symbol can not be both BSF_DEBUGGING and
-     BSF_DYNAMIC.  */
+     BSF_DYNAMIC, nor both BSF_FUNCTION and BSF_FILE.  */
   fprintf (file, " %c%c%c%c%c%c%c",
-          (type & BSF_LOCAL) ? 'l' : ' ',
-          (type & BSF_GLOBAL) ? 'g' : ' ',
+          ((type & BSF_LOCAL)
+           ? (type & BSF_GLOBAL) ? '!' : 'l'
+           : (type & BSF_GLOBAL) ? 'g' : ' '),
           (type & BSF_WEAK) ? 'w' : ' ',
           (type & BSF_CONSTRUCTOR) ? 'C' : ' ',
           (type & BSF_WARNING) ? 'W' : ' ',
           (type & BSF_INDIRECT) ? 'I' : ' ',
-          (type & BSF_DEBUGGING) ? 'd'
-          : (type & BSF_DYNAMIC) ? 'D' : ' ');
+          (type & BSF_DEBUGGING) ? 'd' : (type & BSF_DYNAMIC) ? 'D' : ' ',
+          (type & BSF_FUNCTION) ? 'F' : (type & BSF_FILE) ? 'f' : ' ');
 }
 
 
@@ -429,15 +453,20 @@ static CONST struct section_to_type stt[] =
   {"*DEBUG*", 'N'},
   {".bss", 'b'},
   {".data", 'd'},
-  {".sbss", 's'},              /* Small BSS (uninitialized data) */
-  {".scommon", 'c'},           /* Small common */
-  {".sdata", 'g'},             /* Small initialized 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'},
   {0, 0}
 };
 
 /* Return the single-character symbol type corresponding to
-   section S, or '?' for an unknown COFF section.  */
+   section S, or '?' for an unknown COFF section.  
+
+   Check for any leading string which matches, so .text5 returns
+   't' as well as .text */
 
 static char
 coff_section_type (s)
@@ -445,9 +474,10 @@ coff_section_type (s)
 {
   CONST struct section_to_type *t;
 
-  for (t = &stt[0]; t->section; t++)
-    if (!strcmp (s, t->section))
+  for (t = &stt[0]; t->section; t++) 
+    if (!strncmp (s, t->section, strlen (t->section)))
       return t->type;
+
   return '?';
 }
 
@@ -477,14 +507,16 @@ bfd_decode_symclass (symbol)
 
   if (bfd_is_com_section (symbol->section))
     return 'C';
-  if (symbol->section == &bfd_und_section)
+  if (bfd_is_und_section (symbol->section))
     return 'U';
-  if (symbol->section == &bfd_ind_section)
+  if (bfd_is_ind_section (symbol->section))
     return 'I';
+  if (symbol->flags & BSF_WEAK)
+    return 'W';
   if (!(symbol->flags & (BSF_GLOBAL | BSF_LOCAL)))
     return '?';
 
-  if (symbol->section == &bfd_abs_section)
+  if (bfd_is_abs_section (symbol->section))
     c = 'a';
   else if (symbol->section)
     c = coff_section_type (symbol->section->name);
@@ -535,3 +567,25 @@ bfd_symbol_is_absolute ()
 {
   abort ();
 }
+
+/*
+FUNCTION
+       bfd_copy_private_symbol_data
+
+SYNOPSIS
+       boolean bfd_copy_private_symbol_data(bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
+
+DESCRIPTION
+       Copy private symbol information from @var{isym} in the BFD
+       @var{ibfd} to the symbol @var{osym} in the BFD @var{obfd}.
+       Return <<true>> on success, <<false>> on error.  Possible error
+       returns are:
+
+       o <<bfd_error_no_memory>> -
+       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, \
+.              (ibfd, isymbol, obfd, osymbol))
+
+*/
This page took 0.026431 seconds and 4 git commands to generate.