* netbsd-core.c (netbsd_core_file_p): Make `i' unsigned.
[deliverable/binutils-gdb.git] / bfd / coff-alpha.c
index 14e0ee15c5ef5332f239b910646ae7157d1d6767..68dd76527860ce06b0619cacddd0c8934d32253a 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for ALPHA Extended-Coff files.
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
-   Free Software Foundation, Inc.
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+   2003, 2004 Free Software Foundation, Inc.
    Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and
    Ian Lance Taylor <ian@cygnus.com>.
 
@@ -53,7 +53,7 @@ static reloc_howto_type *alpha_bfd_reloc_type_lookup
   PARAMS ((bfd *, bfd_reloc_code_real_type));
 static bfd_byte *alpha_ecoff_get_relocated_section_contents
   PARAMS ((bfd *abfd, struct bfd_link_info *, struct bfd_link_order *,
-          bfd_byte *data, bfd_boolean relocateable, asymbol **symbols));
+          bfd_byte *data, bfd_boolean relocatable, asymbol **symbols));
 static bfd_vma alpha_convert_external_reloc
   PARAMS ((bfd *, struct bfd_link_info *, bfd *, struct external_reloc *,
           struct ecoff_link_hash_entry *));
@@ -462,8 +462,8 @@ alpha_ecoff_object_p (abfd)
          bfd_size_type size;
 
          size = sec->line_filepos * 8;
-         BFD_ASSERT (size == bfd_section_size (abfd, sec)
-                     || size + 8 == bfd_section_size (abfd, sec));
+         BFD_ASSERT (size == sec->size
+                     || size + 8 == sec->size);
          if (! bfd_set_section_size (abfd, sec, size))
            return NULL;
        }
@@ -753,12 +753,12 @@ alpha_adjust_reloc_out (abfd, rel, intern)
 
 static bfd_byte *
 alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
-                                           data, relocateable, symbols)
+                                           data, relocatable, symbols)
      bfd *abfd;
      struct bfd_link_info *link_info;
      struct bfd_link_order *link_order;
      bfd_byte *data;
-     bfd_boolean relocateable;
+     bfd_boolean relocatable;
      asymbol **symbols;
 {
   bfd *input_bfd = link_order->u.indirect.section->owner;
@@ -766,8 +766,9 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
   long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
   arelent **reloc_vector = NULL;
   long reloc_count;
-  bfd *output_bfd = relocateable ? abfd : (bfd *) NULL;
+  bfd *output_bfd = relocatable ? abfd : (bfd *) NULL;
   bfd_vma gp;
+  bfd_size_type sz;
   bfd_boolean gp_undefined;
   bfd_vma stack[RELOC_STACKSIZE];
   int tos = 0;
@@ -778,14 +779,10 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
   if (reloc_vector == NULL && reloc_size != 0)
     goto error_return;
 
-  if (! bfd_get_section_contents (input_bfd, input_section, data,
-                                 (file_ptr) 0, input_section->_raw_size))
+  sz = input_section->rawsize ? input_section->rawsize : input_section->size;
+  if (! bfd_get_section_contents (input_bfd, input_section, data, 0, sz))
     goto error_return;
 
-  /* The section size is not going to change.  */
-  input_section->_cooked_size = input_section->_raw_size;
-  input_section->reloc_done = TRUE;
-
   reloc_count = bfd_canonicalize_reloc (input_bfd, input_section,
                                        reloc_vector, symbols);
   if (reloc_count < 0)
@@ -798,7 +795,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
   gp = _bfd_get_gp_value (abfd);
   if (gp == 0)
     {
-      if (relocateable)
+      if (relocatable)
        {
          asection *sec;
          bfd_vma lo;
@@ -858,7 +855,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
        case ALPHA_R_SREL16:
        case ALPHA_R_SREL32:
        case ALPHA_R_SREL64:
-         if (relocateable
+         if (relocatable
              && ((*rel->sym_ptr_ptr)->flags & BSF_SECTION_SYM) == 0)
            {
              rel->address += input_section->output_offset;
@@ -991,7 +988,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
            asymbol *symbol;
            bfd_vma relocation;
 
-           if (relocateable)
+           if (relocatable)
              {
                rel->address += input_section->output_offset;
                break;
@@ -1024,7 +1021,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
            bfd_vma val;
            int offset, size;
 
-           if (relocateable)
+           if (relocatable)
              {
                rel->address += input_section->output_offset;
                break;
@@ -1051,7 +1048,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
            asymbol *symbol;
            bfd_vma relocation;
 
-           if (relocateable)
+           if (relocatable)
              {
                rel->address += input_section->output_offset;
                break;
@@ -1084,7 +1081,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
            asymbol *symbol;
            bfd_vma relocation;
 
-           if (relocateable)
+           if (relocatable)
              {
                rel->address += input_section->output_offset;
                break;
@@ -1121,7 +1118,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
          abort ();
        }
 
-      if (relocateable)
+      if (relocatable)
        {
          asection *os = input_section->output_section;
 
@@ -1148,7 +1145,8 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
              break;
            case bfd_reloc_overflow:
              if (! ((*link_info->callbacks->reloc_overflow)
-                    (link_info, bfd_asymbol_name (*rel->sym_ptr_ptr),
+                    (link_info, NULL,
+                     bfd_asymbol_name (*rel->sym_ptr_ptr),
                      rel->howto->name, rel->addend, input_bfd,
                      input_section, rel->address)))
                goto error_return;
@@ -1248,7 +1246,7 @@ alpha_bfd_reloc_type_lookup (abfd, code)
 }
 \f
 /* A helper routine for alpha_relocate_section which converts an
-   external reloc when generating relocateable output.  Returns the
+   external reloc when generating relocatable output.  Returns the
    relocation amount.  */
 
 static bfd_vma
@@ -1262,7 +1260,7 @@ alpha_convert_external_reloc (output_bfd, info, input_bfd, ext_rel, h)
   unsigned long r_symndx;
   bfd_vma relocation;
 
-  BFD_ASSERT (info->relocateable);
+  BFD_ASSERT (info->relocatable);
 
   if (h->root.type == bfd_link_hash_defined
       || h->root.type == bfd_link_hash_defweak)
@@ -1443,7 +1441,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
 
   lita_sec = symndx_to_section[RELOC_SECTION_LITA];
   gp = _bfd_get_gp_value (output_bfd);
-  if (! info->relocateable && lita_sec != NULL)
+  if (! info->relocatable && lita_sec != NULL)
     {
       struct ecoff_section_tdata *lita_sec_data;
 
@@ -1455,7 +1453,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
          amt = sizeof (struct ecoff_section_tdata);
          lita_sec_data = ((struct ecoff_section_tdata *)
                           bfd_zalloc (input_bfd, amt));
-         ecoff_section_data (input_bfd, lita_sec) = lita_sec_data;
+         lita_sec->used_by_bfd = lita_sec_data;
        }
 
       if (lita_sec_data->gp != 0)
@@ -1470,9 +1468,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
          bfd_size_type lita_size;
 
          lita_vma = lita_sec->output_offset + lita_sec->output_section->vma;
-         lita_size = lita_sec->_cooked_size;
-         if (lita_size == 0)
-           lita_size = lita_sec->_raw_size;
+         lita_size = lita_sec->size;
 
          if (gp == 0
              || lita_vma <  gp - 0x8000
@@ -1552,7 +1548,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
             not otherwise used for anything.  For some reason, the
             address of the relocation does not appear to include the
             section VMA, unlike the other relocation types.  */
-         if (info->relocateable)
+         if (info->relocatable)
            H_PUT_64 (input_bfd, input_section->output_offset + r_vaddr,
                      ext_rel->r_vaddr);
          adjust_addrp = FALSE;
@@ -1705,7 +1701,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
              if (h == (struct ecoff_link_hash_entry *) NULL)
                abort ();
 
-             if (! info->relocateable)
+             if (! info->relocatable)
                {
                  if (h->root.type == bfd_link_hash_defined
                      || h->root.type == bfd_link_hash_defweak)
@@ -1748,7 +1744,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
 
          addend += r_vaddr;
 
-         if (info->relocateable)
+         if (info->relocatable)
            {
              /* Adjust r_vaddr by the addend.  */
              H_PUT_64 (input_bfd, addend, ext_rel->r_vaddr);
@@ -1782,9 +1778,9 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
 
        case ALPHA_R_OP_STORE:
          /* Store a value from the reloc stack into a bitfield.  If
-            we are generating relocateable output, all we do is
+            we are generating relocatable output, all we do is
             adjust the address of the reloc.  */
-         if (! info->relocateable)
+         if (! info->relocatable)
            {
              bfd_vma mask;
              bfd_vma val;
@@ -1850,9 +1846,9 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
                abort ();
            }
 
-         if (info->relocateable)
+         if (info->relocatable)
            {
-             /* We are generating relocateable output, and must
+             /* We are generating relocatable output, and must
                 convert the existing reloc.  */
              if (r_extern)
                {
@@ -1965,7 +1961,8 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
                      name = bfd_section_name (input_bfd,
                                               symndx_to_section[r_symndx]);
                    if (! ((*info->callbacks->reloc_overflow)
-                          (info, name, alpha_howto_table[r_type].name,
+                          (info, NULL, name,
+                           alpha_howto_table[r_type].name,
                            (bfd_vma) 0, input_bfd, input_section,
                            r_vaddr - input_section->vma)))
                      return FALSE;
@@ -1975,7 +1972,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
            }
        }
 
-      if (info->relocateable && adjust_addrp)
+      if (info->relocatable && adjust_addrp)
        {
          /* Change the address of the relocation.  */
          H_PUT_64 (input_bfd,
@@ -2359,7 +2356,10 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
 #define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section
 #define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
 #define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections
+#define _bfd_ecoff_bfd_is_group_section bfd_generic_is_group_section
 #define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group
+#define _bfd_ecoff_section_already_linked \
+  _bfd_generic_section_already_linked
 
 const bfd_target ecoffalpha_little_vec =
 {
This page took 0.02809 seconds and 4 git commands to generate.