OSDN Git Service

Use datarootdir for locales.
[pf3gnuchains/pf3gnuchains4x.git] / bfd / syms.c
index cdbf905..e819eae 100644 (file)
@@ -1,6 +1,6 @@
 /* Generic symbol-table support for the BFD library.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009
+   2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -297,6 +297,16 @@ CODE_FRAGMENT
 .  {* This symbol was created by bfd_get_synthetic_symtab.  *}
 .#define BSF_SYNTHETIC         (1 << 21)
 .
+.  {* This symbol is an indirect code object.  Unrelated to BSF_INDIRECT.
+.     The dynamic linker will compute the value of this symbol by
+.     calling the function that it points to.  BSF_FUNCTION must
+.     also be also set.  *}
+.#define BSF_GNU_INDIRECT_FUNCTION (1 << 22)
+.  {* This symbol is a globally unique data object.  The dynamic linker
+.     will make sure that in the entire process there is just one symbol
+.     with this name and type in use.  BSF_OBJECT must also be set.  *}
+.#define BSF_GNU_UNIQUE                (1 << 23)
+.
 .  flagword flags;
 .
 .  {* A pointer to the section to which this symbol is
@@ -464,7 +474,7 @@ DESCRIPTION
 void
 bfd_print_symbol_vandf (bfd *abfd, void *arg, asymbol *symbol)
 {
-  FILE *file = arg;
+  FILE *file = (FILE *) arg;
 
   flagword type = symbol->flags;
 
@@ -479,11 +489,12 @@ bfd_print_symbol_vandf (bfd *abfd, void *arg, asymbol *symbol)
   fprintf (file, " %c%c%c%c%c%c%c",
           ((type & BSF_LOCAL)
            ? (type & BSF_GLOBAL) ? '!' : 'l'
-           : (type & BSF_GLOBAL) ? 'g' : ' '),
+           : (type & BSF_GLOBAL) ? 'g'
+           : (type & BSF_GNU_UNIQUE) ? 'u' : ' '),
           (type & BSF_WEAK) ? 'w' : ' ',
           (type & BSF_CONSTRUCTOR) ? 'C' : ' ',
           (type & BSF_WARNING) ? 'W' : ' ',
-          (type & BSF_INDIRECT) ? 'I' : ' ',
+          (type & BSF_INDIRECT) ? 'I' : (type & BSF_GNU_INDIRECT_FUNCTION) ? 'i' : ' ',
           (type & BSF_DEBUGGING) ? 'd' : (type & BSF_DYNAMIC) ? 'D' : ' ',
           ((type & BSF_FUNCTION)
            ? 'F'
@@ -528,10 +539,10 @@ asymbol *
 _bfd_generic_make_empty_symbol (bfd *abfd)
 {
   bfd_size_type amt = sizeof (asymbol);
-  asymbol *new = bfd_zalloc (abfd, amt);
-  if (new)
-    new->the_bfd = abfd;
-  return new;
+  asymbol *new_symbol = (asymbol *) bfd_zalloc (abfd, amt);
+  if (new_symbol)
+    new_symbol->the_bfd = abfd;
+  return new_symbol;
 }
 
 /*
@@ -669,6 +680,8 @@ bfd_decode_symclass (asymbol *symbol)
     }
   if (bfd_is_ind_section (symbol->section))
     return 'I';
+  if (symbol->flags & BSF_GNU_INDIRECT_FUNCTION)
+    return 'i';
   if (symbol->flags & BSF_WEAK)
     {
       /* If weak, determine if it's specifically an object
@@ -678,6 +691,8 @@ bfd_decode_symclass (asymbol *symbol)
       else
        return 'W';
     }
+  if (symbol->flags & BSF_GNU_UNIQUE)
+    return 'u';
   if (!(symbol->flags & (BSF_GLOBAL | BSF_LOCAL)))
     return '?';
 
@@ -796,7 +811,7 @@ _bfd_generic_read_minisymbols (bfd *abfd,
   if (storage == 0)
     return 0;
 
-  syms = bfd_malloc (storage);
+  syms = (asymbol **) bfd_malloc (storage);
   if (syms == NULL)
     goto error_return;
 
@@ -863,8 +878,8 @@ struct indexentry
 static int
 cmpindexentry (const void *a, const void *b)
 {
-  const struct indexentry *contestantA = a;
-  const struct indexentry *contestantB = b;
+  const struct indexentry *contestantA = (const struct indexentry *) a;
+  const struct indexentry *contestantB = (const struct indexentry *) b;
 
   if (contestantA->val < contestantB->val)
     return -1;
@@ -951,7 +966,7 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
 #define VALOFF (8)
 #define STABSIZE (12)
 
-  info = *pinfo;
+  info = (struct stab_find_info *) *pinfo;
   if (info != NULL)
     {
       if (info->stabsec == NULL || info->strsec == NULL)
@@ -976,7 +991,7 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
       char *function_name;
       bfd_size_type amt = sizeof *info;
 
-      info = bfd_zalloc (abfd, amt);
+      info = (struct stab_find_info *) bfd_zalloc (abfd, amt);
       if (info == NULL)
        return FALSE;
 
@@ -1009,8 +1024,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
                 ? info->strsec->rawsize
                 : info->strsec->size);
 
-      info->stabs = bfd_alloc (abfd, stabsize);
-      info->strs = bfd_alloc (abfd, strsize);
+      info->stabs = (bfd_byte *) bfd_alloc (abfd, stabsize);
+      info->strs = (bfd_byte *) bfd_alloc (abfd, strsize);
       if (info->stabs == NULL || info->strs == NULL)
        return FALSE;
 
@@ -1027,7 +1042,7 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
       reloc_size = bfd_get_reloc_upper_bound (abfd, info->stabsec);
       if (reloc_size < 0)
        return FALSE;
-      reloc_vector = bfd_malloc (reloc_size);
+      reloc_vector = (arelent **) bfd_malloc (reloc_size);
       if (reloc_vector == NULL && reloc_size != 0)
        return FALSE;
       reloc_count = bfd_canonicalize_reloc (abfd, info->stabsec, reloc_vector,
@@ -1124,7 +1139,7 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
 
       amt = info->indextablesize;
       amt *= sizeof (struct indexentry);
-      info->indextable = bfd_alloc (abfd, amt);
+      info->indextable = (struct indexentry *) bfd_alloc (abfd, amt);
       if (info->indextable == NULL)
        return FALSE;
 
@@ -1371,8 +1386,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
 
       dirlen = strlen (directory_name);
       if (info->filename == NULL
-         || strncmp (info->filename, directory_name, dirlen) != 0
-         || strcmp (info->filename + dirlen, file_name) != 0)
+         || filename_ncmp (info->filename, directory_name, dirlen) != 0
+         || filename_cmp (info->filename + dirlen, file_name) != 0)
        {
          size_t len;
 
@@ -1380,7 +1395,7 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
             apps keep a copy of a previously returned file name
             pointer.  */
          len = strlen (file_name) + 1;
-         info->filename = bfd_alloc (abfd, dirlen + len);
+         info->filename = (char *) bfd_alloc (abfd, dirlen + len);
          if (info->filename == NULL)
            return FALSE;
          memcpy (info->filename, directory_name, dirlen);