daily update
[deliverable/binutils-gdb.git] / bfd / coff-ppc.c
index 067f2b65878875cbf04a425a0a213b4b8173f2af..38d0099748c74983bebcd146fc9b2e3e09063f51 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for PowerPC Microsoft Portable Executable files.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 /* BFD back-end for PowerPC Microsoft Portable Executable files.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003
+   2000, 2001, 2002, 2003, 2004
    Free Software Foundation, Inc.
 
    Original version pieced together by Kim Knuttila (krk@cygnus.com)
    Free Software Foundation, Inc.
 
    Original version pieced together by Kim Knuttila (krk@cygnus.com)
@@ -929,7 +929,7 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
          local_syms[sym] = global_toc_size;
          global_toc_size += 4;
 
          local_syms[sym] = global_toc_size;
          global_toc_size += 4;
 
-         /* The size must fit in a 16bit displacment.  */
+         /* The size must fit in a 16-bit displacement.  */
          if (global_toc_size > 65535)
            {
              (*_bfd_error_handler) (_("TOC overflow"));
          if (global_toc_size > 65535)
            {
              (*_bfd_error_handler) (_("TOC overflow"));
@@ -949,7 +949,7 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
          h->toc_offset = global_toc_size;
          global_toc_size += 4;
 
          h->toc_offset = global_toc_size;
          global_toc_size += 4;
 
-         /* The size must fit in a 16bit displacment.  */
+         /* The size must fit in a 16-bit displacement.  */
          if (global_toc_size >= 65535)
            {
              (*_bfd_error_handler) (_("TOC overflow"));
          if (global_toc_size >= 65535)
            {
              (*_bfd_error_handler) (_("TOC overflow"));
@@ -1088,10 +1088,10 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
   bfd_vma relocation;
   reloc_howto_type *howto = 0;
 
   bfd_vma relocation;
   reloc_howto_type *howto = 0;
 
-  /* If we are performing a relocateable link, we don't need to do a
+  /* If we are performing a relocatable link, we don't need to do a
      thing.  The caller will take care of adjusting the reloc
      addresses and symbol indices.  */
      thing.  The caller will take care of adjusting the reloc
      addresses and symbol indices.  */
-  if (info->relocateable)
+  if (info->relocatable)
     return TRUE;
 
   hihalf = FALSE;
     return TRUE;
 
   hihalf = FALSE;
@@ -1188,8 +1188,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
        {
        default:
          (*_bfd_error_handler)
        {
        default:
          (*_bfd_error_handler)
-           (_("%s: unsupported relocation type 0x%02x"),
-            bfd_archive_filename (input_bfd), r_type);
+           (_("%B: unsupported relocation type 0x%02x"), input_bfd, r_type);
          bfd_set_error (bfd_error_bad_value);
          return FALSE;
        case IMAGE_REL_PPC_TOCREL16:
          bfd_set_error (bfd_error_bad_value);
          return FALSE;
        case IMAGE_REL_PPC_TOCREL16:
@@ -1274,12 +1273,12 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
                    our_toc_offset = val - (toc_section->output_section->vma
                                            + toc_section->output_offset);
 
                    our_toc_offset = val - (toc_section->output_section->vma
                                            + toc_section->output_offset);
 
-                   /* The size must still fit in a 16bit displacment.  */
+                   /* The size must still fit in a 16-bit displacement.  */
                    if ((bfd_vma) our_toc_offset >= 65535)
                      {
                        (*_bfd_error_handler)
                    if ((bfd_vma) our_toc_offset >= 65535)
                      {
                        (*_bfd_error_handler)
-                         (_("%s: Relocation for %s of %lx exceeds Toc size limit"),
-                          bfd_archive_filename (input_bfd), name,
+                         (_("%B: Relocation for %s of %lx exceeds Toc size limit"),
+                          input_bfd, name,
                           (unsigned long) our_toc_offset);
                        bfd_set_error (bfd_error_bad_value);
                        return FALSE;
                           (unsigned long) our_toc_offset);
                        bfd_set_error (bfd_error_bad_value);
                        return FALSE;
@@ -1330,12 +1329,11 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
 
            /* FIXME: this test is conservative.  */
            if ((r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN
 
            /* FIXME: this test is conservative.  */
            if ((r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN
-               && (bfd_vma) our_toc_offset > toc_section->_raw_size)
+               && (bfd_vma) our_toc_offset > toc_section->size)
              {
                (*_bfd_error_handler)
              {
                (*_bfd_error_handler)
-                 (_("%s: Relocation exceeds allocated TOC (%lx)"),
-                  bfd_archive_filename (input_bfd),
-                  (unsigned long) toc_section->_raw_size);
+                 (_("%B: Relocation exceeds allocated TOC (%lx)"),
+                  input_bfd, (unsigned long) toc_section->size);
                bfd_set_error (bfd_error_bad_value);
                return FALSE;
              }
                bfd_set_error (bfd_error_bad_value);
                return FALSE;
              }
@@ -1387,15 +1385,12 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
            else
              my_name = h->root.root.root.string;
 
            else
              my_name = h->root.root.root.string;
 
-           fprintf (stderr,
-                   _("Warning: unsupported reloc %s <file %s, section %s>\n"),
-                   howto->name,
-                   bfd_archive_filename(input_bfd),
-                   input_section->name);
-
-           fprintf (stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n",
-                   rel->r_symndx, my_name, (long) rel->r_vaddr,
-                   (unsigned long) rel->r_vaddr);
+           (*_bfd_error_handler)
+             (_("Warning: unsupported reloc %s <file %B, section %A>\n"
+                "sym %ld (%s), r_vaddr %ld (%lx)"),
+              input_bfd, input_section, howto->name,
+              rel->r_symndx, my_name, (long) rel->r_vaddr,
+              (unsigned long) rel->r_vaddr);
          }
          break;
        case IMAGE_REL_PPC_IMGLUE:
          }
          break;
        case IMAGE_REL_PPC_IMGLUE:
@@ -1409,8 +1404,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
            my_name = h->root.root.root.string;
 
            (*_bfd_error_handler)
            my_name = h->root.root.root.string;
 
            (*_bfd_error_handler)
-             (_("%s: Out of order IMGLUE reloc for %s"),
-              bfd_archive_filename (input_bfd), my_name);
+             (_("%B: Out of order IMGLUE reloc for %s"), input_bfd, my_name);
            bfd_set_error (bfd_error_bad_value);
            return FALSE;
          }
            bfd_set_error (bfd_error_bad_value);
            return FALSE;
          }
@@ -1690,7 +1684,7 @@ ppc_allocate_toc_section (info)
   foo = (bfd_byte *) bfd_alloc (bfd_of_toc_owner, amt);
   memset(foo, test_char, (size_t) global_toc_size);
 
   foo = (bfd_byte *) bfd_alloc (bfd_of_toc_owner, amt);
   memset(foo, test_char, (size_t) global_toc_size);
 
-  s->_raw_size = s->_cooked_size = global_toc_size;
+  s->size = global_toc_size;
   s->contents = foo;
 
   return TRUE;
   s->contents = foo;
 
   return TRUE;
@@ -1931,7 +1925,7 @@ ppc_imglue_reloc (abfd, reloc_entry, symbol, data,
 #define MAX_RELOC_INDEX  \
       (sizeof (ppc_coff_howto_table) / sizeof (ppc_coff_howto_table[0]) - 1)
 
 #define MAX_RELOC_INDEX  \
       (sizeof (ppc_coff_howto_table) / sizeof (ppc_coff_howto_table[0]) - 1)
 
-/* FIXME: There is a possiblity that when we read in a reloc from a file,
+/* FIXME: There is a possibility that when we read in a reloc from a file,
           that there are some bits encoded in the upper portion of the
          type field. Not yet implemented.  */
 static void ppc_coff_rtype2howto PARAMS ((arelent *, struct internal_reloc *));
           that there are some bits encoded in the upper portion of the
          type field. Not yet implemented.  */
 static void ppc_coff_rtype2howto PARAMS ((arelent *, struct internal_reloc *));
@@ -2325,17 +2319,19 @@ ppc_bfd_coff_final_link (abfd, info)
                  || info->strip == strip_some)
                o->lineno_count += sec->lineno_count;
 
                  || info->strip == strip_some)
                o->lineno_count += sec->lineno_count;
 
-             if (info->relocateable)
+             if (info->relocatable)
                o->reloc_count += sec->reloc_count;
 
                o->reloc_count += sec->reloc_count;
 
-             if (sec->_raw_size > max_contents_size)
-               max_contents_size = sec->_raw_size;
+             if (sec->rawsize > max_contents_size)
+               max_contents_size = sec->rawsize;
+             if (sec->size > max_contents_size)
+               max_contents_size = sec->size;
              if (sec->lineno_count > max_lineno_count)
                max_lineno_count = sec->lineno_count;
              if (sec->reloc_count > max_reloc_count)
                max_reloc_count = sec->reloc_count;
            }
              if (sec->lineno_count > max_lineno_count)
                max_lineno_count = sec->lineno_count;
              if (sec->reloc_count > max_reloc_count)
                max_reloc_count = sec->reloc_count;
            }
-         else if (info->relocateable
+         else if (info->relocatable
                   && (p->type == bfd_section_reloc_link_order
                       || p->type == bfd_symbol_reloc_link_order))
            ++o->reloc_count;
                   && (p->type == bfd_section_reloc_link_order
                       || p->type == bfd_symbol_reloc_link_order))
            ++o->reloc_count;
@@ -2350,9 +2346,9 @@ ppc_bfd_coff_final_link (abfd, info)
        }
     }
 
        }
     }
 
-  /* If doing a relocateable link, allocate space for the pointers we
+  /* If doing a relocatable link, allocate space for the pointers we
      need to keep.  */
      need to keep.  */
-  if (info->relocateable)
+  if (info->relocatable)
     {
       unsigned int i;
 
     {
       unsigned int i;
 
@@ -2401,9 +2397,9 @@ ppc_bfd_coff_final_link (abfd, info)
 
             Because of this problem, we also keep the relocs in
             memory until the end of the link.  This wastes memory,
 
             Because of this problem, we also keep the relocs in
             memory until the end of the link.  This wastes memory,
-            but only when doing a relocateable link, which is not the
+            but only when doing a relocatable link, which is not the
             common case.  */
             common case.  */
-         BFD_ASSERT (info->relocateable);
+         BFD_ASSERT (info->relocatable);
          amt = o->reloc_count;
          amt *= sizeof (struct internal_reloc);
          finfo.section_info[o->target_index].relocs =
          amt = o->reloc_count;
          amt *= sizeof (struct internal_reloc);
          finfo.section_info[o->target_index].relocs =
@@ -2455,7 +2451,7 @@ ppc_bfd_coff_final_link (abfd, info)
   finfo.linenos = (bfd_byte *) bfd_malloc (amt);
   finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
   finfo.external_relocs = (bfd_byte *) bfd_malloc (max_reloc_count * relsz);
   finfo.linenos = (bfd_byte *) bfd_malloc (amt);
   finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
   finfo.external_relocs = (bfd_byte *) bfd_malloc (max_reloc_count * relsz);
-  if (! info->relocateable)
+  if (! info->relocatable)
     {
       amt = max_reloc_count * sizeof (struct internal_reloc);
       finfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt);
     {
       amt = max_reloc_count * sizeof (struct internal_reloc);
       finfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt);
@@ -2467,7 +2463,7 @@ ppc_bfd_coff_final_link (abfd, info)
       || (finfo.linenos == NULL && max_lineno_count > 0)
       || (finfo.contents == NULL && max_contents_size > 0)
       || (finfo.external_relocs == NULL && max_reloc_count > 0)
       || (finfo.linenos == NULL && max_lineno_count > 0)
       || (finfo.contents == NULL && max_contents_size > 0)
       || (finfo.external_relocs == NULL && max_reloc_count > 0)
-      || (! info->relocateable
+      || (! info->relocatable
          && finfo.internal_relocs == NULL
          && max_reloc_count > 0))
     goto error_return;
          && finfo.internal_relocs == NULL
          && max_reloc_count > 0))
     goto error_return;
@@ -2602,7 +2598,7 @@ ppc_bfd_coff_final_link (abfd, info)
       finfo.outsyms = NULL;
     }
 
       finfo.outsyms = NULL;
     }
 
-  if (info->relocateable)
+  if (info->relocatable)
     {
       /* Now that we have written out all the global symbols, we know
         the symbol indices to use for relocs against them, and we can
     {
       /* Now that we have written out all the global symbols, we know
         the symbol indices to use for relocs against them, and we can
@@ -2663,7 +2659,7 @@ ppc_bfd_coff_final_link (abfd, info)
     }
 
   /* If we have optimized stabs strings, output them.  */
     }
 
   /* If we have optimized stabs strings, output them.  */
-  if (coff_hash_table (info)->stab_info != NULL)
+  if (coff_hash_table (info)->stab_info.stabstr != NULL)
     {
       if (! _bfd_write_stab_strings (abfd, &coff_hash_table (info)->stab_info))
        return FALSE;
     {
       if (! _bfd_write_stab_strings (abfd, &coff_hash_table (info)->stab_info))
        return FALSE;
This page took 0.028054 seconds and 4 git commands to generate.