* scripttempl/elf.sc (DISCARDED): Renamed from STACKNOTE. Add
[deliverable/binutils-gdb.git] / bfd / som.c
index 31c706f4616af4836d804590e2e33e47b0f1cec2..e267658ca17109deca0af68a949b7b905eceba96 100644 (file)
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -1,6 +1,6 @@
 /* bfd back-end for HP PA-RISC SOM objects.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005
+   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
    Free Software Foundation, Inc.
 
    Contributed by the Center for Software Science at the
@@ -10,7 +10,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
    02110-1301, USA.  */
 
 #include "alloca-conf.h"
-#include "bfd.h"
 #include "sysdep.h"
+#include "bfd.h"
 
 #if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) || defined(HOST_HPPAMPEIX)
 
@@ -1054,7 +1054,7 @@ som_reloc_queue_find (unsigned char *p,
 
 static unsigned char *
 try_prev_fixup (bfd *abfd ATTRIBUTE_UNUSED,
-               int *subspace_reloc_sizep,
+               unsigned int *subspace_reloc_sizep,
                unsigned char *p,
                unsigned int size,
                struct reloc_queue *queue)
@@ -1626,6 +1626,22 @@ som_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
   return NULL;
 }
 
+static reloc_howto_type *
+som_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+                          const char *r_name)
+{
+  unsigned int i;
+
+  for (i = 0;
+       i < sizeof (som_hppa_howto_table) / sizeof (som_hppa_howto_table[0]);
+       i++)
+    if (som_hppa_howto_table[i].name != NULL
+       && strcasecmp (som_hppa_howto_table[i].name, r_name) == 0)
+      return &som_hppa_howto_table[i];
+
+  return NULL;
+}
+
 /* Perform some initialization for an object.  Save results of this
    initialization in the BFD.  */
 
@@ -2958,8 +2974,8 @@ som_write_space_strings (bfd *abfd,
   /* Chunk of memory that we can use as buffer space, then throw
      away.  */
   size_t tmp_space_size = SOM_TMP_BUFSIZE;
-  unsigned char *tmp_space = alloca (tmp_space_size);
-  unsigned char *p = tmp_space;
+  char *tmp_space = alloca (tmp_space_size);
+  char *p = tmp_space;
   unsigned int strings_size = 0;
   asection *section;
   bfd_size_type amt;
@@ -3063,11 +3079,11 @@ som_write_symbol_strings (bfd *abfd,
   /* Chunk of memory that we can use as buffer space, then throw
      away.  */
   size_t tmp_space_size = SOM_TMP_BUFSIZE;
-  unsigned char *tmp_space = alloca (tmp_space_size);
-  unsigned char *p = tmp_space;
+  char *tmp_space = alloca (tmp_space_size);
+  char *p = tmp_space;
 
   unsigned int strings_size = 0;
-  unsigned char *comp[4];
+  char *comp[4];
   bfd_size_type amt;
 
   /* This gets a bit gruesome because of the compilation unit.  The
@@ -3227,7 +3243,7 @@ static bfd_boolean
 som_begin_writing (bfd *abfd)
 {
   unsigned long current_offset = 0;
-  int strings_size = 0;
+  unsigned int strings_size = 0;
   unsigned long num_spaces, num_subspaces, i;
   asection *section;
   unsigned int total_subspaces = 0;
@@ -3576,12 +3592,12 @@ som_finish_writing (bfd *abfd)
 {
   int num_spaces = som_count_spaces (abfd);
   asymbol **syms = bfd_get_outsymbols (abfd);
-  int i, num_syms, strings_size;
+  int i, num_syms;
   int subspace_index = 0;
   file_ptr location;
   asection *section;
   unsigned long current_offset;
-  unsigned int total_reloc_size;
+  unsigned int strings_size, total_reloc_size;
   bfd_size_type amt;
 
   /* We must set up the version identifier here as objcopy/strip copy
@@ -4374,12 +4390,12 @@ som_slurp_symbol_table (bfd *abfd)
          && sym->symbol.name[strlen (sym->symbol.name) - 1] == '$'
          && !strcmp (sym->symbol.name, sym->symbol.section->name))
        sym->symbol.flags |= BSF_SECTION_SYM;
-      else if (!strncmp (sym->symbol.name, "L$0\002", 4))
+      else if (CONST_STRNEQ (sym->symbol.name, "L$0\002"))
        {
          sym->symbol.flags |= BSF_SECTION_SYM;
          sym->symbol.name = sym->symbol.section->name;
        }
-      else if (!strncmp (sym->symbol.name, "L$0\001", 4))
+      else if (CONST_STRNEQ (sym->symbol.name, "L$0\001"))
        sym->symbol.flags |= BSF_DEBUGGING;
 
       /* Note increment at bottom of loop, since we skip some symbols
@@ -4842,7 +4858,7 @@ som_slurp_reloc_table (bfd *abfd,
                       asymbol **symbols,
                       bfd_boolean just_count)
 {
-  char *external_relocs;
+  unsigned char *external_relocs;
   unsigned int fixup_stream_size;
   arelent *internal_relocs;
   unsigned int num_relocs;
@@ -4959,15 +4975,18 @@ extern const bfd_target som_vec;
 static bfd_boolean
 som_new_section_hook (bfd *abfd, asection *newsect)
 {
-  bfd_size_type amt = sizeof (struct som_section_data_struct);
-
-  newsect->used_by_bfd = bfd_zalloc (abfd, amt);
   if (!newsect->used_by_bfd)
-    return FALSE;
+    {
+      bfd_size_type amt = sizeof (struct som_section_data_struct);
+
+      newsect->used_by_bfd = bfd_zalloc (abfd, amt);
+      if (!newsect->used_by_bfd)
+       return FALSE;
+    }
   newsect->alignment_power = 3;
 
   /* We allow more than three sections internally.  */
-  return TRUE;
+  return _bfd_generic_new_section_hook (abfd, newsect);
 }
 
 /* Copy any private info we understand from the input symbol
@@ -5325,7 +5344,7 @@ som_find_nearest_line (bfd *abfd ATTRIBUTE_UNUSED,
 
 static int
 som_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
-                   bfd_boolean reloc ATTRIBUTE_UNUSED)
+                   struct bfd_link_info *info ATTRIBUTE_UNUSED)
 {
   (*_bfd_error_handler) (_("som_sizeof_headers unimplemented"));
   fflush (stderr);
@@ -5355,11 +5374,30 @@ som_decode_symclass (asymbol *symbol)
   if (bfd_is_com_section (symbol->section))
     return 'C';
   if (bfd_is_und_section (symbol->section))
-    return 'U';
+    {
+      if (symbol->flags & BSF_WEAK)
+       {
+         /* If weak, determine if it's specifically an object
+            or non-object weak.  */
+         if (symbol->flags & BSF_OBJECT)
+           return 'v';
+         else
+           return 'w';
+       }
+      else
+        return 'U';
+    }
   if (bfd_is_ind_section (symbol->section))
     return 'I';
   if (symbol->flags & BSF_WEAK)
-    return 'W';
+    {
+      /* If weak, determine if it's specifically an object
+        or non-object weak.  */
+      if (symbol->flags & BSF_OBJECT)
+       return 'V';
+      else
+       return 'W';
+    }
   if (!(symbol->flags & (BSF_GLOBAL | BSF_LOCAL)))
     return '?';
 
@@ -5631,7 +5669,7 @@ som_slurp_armap (bfd *abfd)
     return FALSE;
 
   /* For archives without .o files there is no symbol table.  */
-  if (strncmp (nextname, "/               ", 16))
+  if (! CONST_STRNEQ (nextname, "/               "))
     {
       bfd_has_map (abfd) = FALSE;
       return TRUE;
@@ -5730,7 +5768,7 @@ som_bfd_prep_for_ar_write (bfd *abfd,
       if (curr_bfd->format != bfd_object
          || curr_bfd->xvec->flavour != bfd_target_som_flavour)
        {
-         curr_bfd = curr_bfd->next;
+         curr_bfd = curr_bfd->archive_next;
          continue;
        }
 
@@ -5775,7 +5813,7 @@ som_bfd_prep_for_ar_write (bfd *abfd,
            (*stringsize)++;
        }
 
-      curr_bfd = curr_bfd->next;
+      curr_bfd = curr_bfd->archive_next;
     }
   return TRUE;
 }
@@ -5884,7 +5922,7 @@ som_bfd_ar_write_symbol_stuff (bfd *abfd,
       if (curr_bfd->format != bfd_object
          || curr_bfd->xvec->flavour != bfd_target_som_flavour)
        {
-         curr_bfd = curr_bfd->next;
+         curr_bfd = curr_bfd->archive_next;
          continue;
        }
 
@@ -6000,7 +6038,7 @@ som_bfd_ar_write_symbol_stuff (bfd *abfd,
         linker requires objects begin on an even boundary.  So round
         up the current offset as necessary.  */
       curr_som_offset = (curr_som_offset + 0x1) &~ (unsigned) 1;
-      curr_bfd = curr_bfd->next;
+      curr_bfd = curr_bfd->archive_next;
       som_index++;
     }
 
@@ -6106,7 +6144,7 @@ som_write_armap (bfd *abfd,
       if (curr_bfd->format == bfd_object
          && curr_bfd->xvec->flavour == bfd_target_som_flavour)
        lst.module_count++;
-      curr_bfd = curr_bfd->next;
+      curr_bfd = curr_bfd->archive_next;
     }
   lst.module_limit = lst.module_count;
   lst.dir_loc = lst_size;
@@ -6246,6 +6284,7 @@ som_bfd_link_split_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
 #define som_bfd_merge_private_bfd_data         _bfd_generic_bfd_merge_private_bfd_data
 #define som_bfd_copy_private_header_data       _bfd_generic_bfd_copy_private_header_data
 #define som_bfd_set_private_flags              _bfd_generic_bfd_set_private_flags
+#define som_find_inliner_info                  _bfd_nosymbols_find_inliner_info
 
 const bfd_target som_vec =
 {
This page took 0.027643 seconds and 4 git commands to generate.