]> Git Repo - binutils.git/blobdiff - bfd/coff-mips.c
* Makefile.in (install): Move subdir_do out of conditional. From
[binutils.git] / bfd / coff-mips.c
index 591bd757ac6e45e0746dda19c813f2d56785c20e..2b0a6a7fcd04ccf8750ed887c038c5a05cd2378e 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for MIPS Extended-Coff files.
-   Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
+   Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
    Original version by Per Bothner.
    Full support added by Ian Lance Taylor, [email protected].
 
@@ -396,12 +396,12 @@ mips_ecoff_bad_format_hook (abfd, filehdr)
     case MIPS_MAGIC_BIG:
     case MIPS_MAGIC_BIG2:
     case MIPS_MAGIC_BIG3:
-      return abfd->xvec->byteorder_big_p;
+      return bfd_big_endian (abfd);
 
     case MIPS_MAGIC_LITTLE:
     case MIPS_MAGIC_LITTLE2:
     case MIPS_MAGIC_LITTLE3:
-      return abfd->xvec->byteorder_big_p == false;
+      return bfd_little_endian (abfd);
 
     default:
       return false;
@@ -423,7 +423,7 @@ mips_ecoff_swap_reloc_in (abfd, ext_ptr, intern)
   const RELOC *ext = (RELOC *) ext_ptr;
 
   intern->r_vaddr = bfd_h_get_32 (abfd, (bfd_byte *) ext->r_vaddr);
-  if (abfd->xvec->header_byteorder_big_p != false)
+  if (bfd_header_big_endian (abfd))
     {
       intern->r_symndx = (((int) ext->r_bits[0]
                           << RELOC_BITS0_SYMNDX_SH_LEFT_BIG)
@@ -500,7 +500,7 @@ mips_ecoff_swap_reloc_out (abfd, intern, dst)
     }
 
   bfd_h_put_32 (abfd, intern->r_vaddr, (bfd_byte *) ext->r_vaddr);
-  if (abfd->xvec->header_byteorder_big_p != false)
+  if (bfd_header_big_endian (abfd))
     {
       ext->r_bits[0] = r_symndx >> RELOC_BITS0_SYMNDX_SH_LEFT_BIG;
       ext->r_bits[1] = r_symndx >> RELOC_BITS1_SYMNDX_SH_LEFT_BIG;
@@ -538,7 +538,7 @@ mips_adjust_reloc_in (abfd, intern, rptr)
   if (! intern->r_extern
       && (intern->r_type == MIPS_R_GPREL
          || intern->r_type == MIPS_R_LITERAL))
-    rptr->addend += ecoff_data (abfd)->gp;
+    rptr->addend += _bfd_get_gp_value (abfd);
 
   /* If the type is MIPS_R_IGNORE, make sure this is a reference to
      the absolute section so that the reloc is ignored.  */
@@ -794,15 +794,15 @@ mips_gprel_reloc (abfd,
      BFD.  If we can't find it, we're stuck.  We cache it in the ECOFF
      target data.  We don't need to adjust the symbol value for an
      external symbol if we are producing relocateable output.  */
-  if (ecoff_data (output_bfd)->gp == 0
+  if (_bfd_get_gp_value (output_bfd) == 0
       && (relocateable == false
          || (symbol->flags & BSF_SECTION_SYM) != 0))
     {
       if (relocateable != false)
        {
          /* Make up a value.  */
-         ecoff_data (output_bfd)->gp =
-           symbol->section->output_section->vma + 0x4000;
+         _bfd_set_gp_value (output_bfd,
+                            symbol->section->output_section->vma + 0x4000);
        }
       else
        {
@@ -824,7 +824,8 @@ mips_gprel_reloc (abfd,
                  name = bfd_asymbol_name (*sym);
                  if (*name == '_' && strcmp (name, "_gp") == 0)
                    {
-                     ecoff_data (output_bfd)->gp = bfd_asymbol_value (*sym);
+                     _bfd_set_gp_value (output_bfd,
+                                        bfd_asymbol_value (*sym));
                      break;
                    }
                }
@@ -833,7 +834,7 @@ mips_gprel_reloc (abfd,
          if (i >= count)
            {
              /* Only get the error once.  */
-             ecoff_data (output_bfd)->gp = 4;
+             _bfd_set_gp_value (output_bfd, 4);
              *error_message =
                (char *) "GP relative relocation when _gp not defined";
              return bfd_reloc_dangerous;
@@ -864,7 +865,7 @@ mips_gprel_reloc (abfd,
      an external symbol.  */
   if (relocateable == false
       || (symbol->flags & BSF_SECTION_SYM) != 0)
-    val += relocation - ecoff_data (output_bfd)->gp;
+    val += relocation - _bfd_get_gp_value (output_bfd);
 
   insn = (insn &~ 0xffff) | (val & 0xffff);
   bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
@@ -1190,8 +1191,8 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
   boolean got_lo;
   struct internal_reloc lo_int_rel;
 
-  BFD_ASSERT (input_bfd->xvec->header_byteorder_big_p
-             == output_bfd->xvec->header_byteorder_big_p);
+  BFD_ASSERT (input_bfd->xvec->header_byteorder
+             == output_bfd->xvec->header_byteorder);
 
   /* We keep a table mapping the symndx found in an internal reloc to
      the appropriate section.  This is faster than looking up the
@@ -1237,7 +1238,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
 
   sym_hashes = ecoff_data (input_bfd)->sym_hashes;
 
-  gp = ecoff_data (output_bfd)->gp;
+  gp = _bfd_get_gp_value (output_bfd);
   if (gp == 0)
     gp_undefined = true;
   else
@@ -1356,7 +1357,8 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
                      int_rel.r_vaddr - input_section->vma)))
                return false;
              /* Only give the error once per link.  */
-             ecoff_data (output_bfd)->gp = gp = 4;
+             gp = 4;
+             _bfd_set_gp_value (output_bfd, gp);
              gp_undefined = false;
            }
          if (! int_rel.r_extern)
@@ -1927,7 +1929,7 @@ mips_relax_section (abfd, sec, info, again)
        continue;
 
       /* Quickly check that this reloc is external PCREL16.  */
-      if (abfd->xvec->header_byteorder_big_p)
+      if (bfd_header_big_endian (abfd))
        {
          if ((ext_rel->r_bits[3] & RELOC_BITS3_EXTERN_BIG) == 0
              || (((ext_rel->r_bits[3] & RELOC_BITS3_TYPE_BIG)
@@ -1996,12 +1998,9 @@ mips_relax_section (abfd, sec, info, again)
          if (info->keep_memory)
            contents = (bfd_byte *) bfd_alloc (abfd, sec->_raw_size);
          else
-           contents = (bfd_byte *) malloc ((size_t) sec->_raw_size);
+           contents = (bfd_byte *) bfd_malloc ((size_t) sec->_raw_size);
          if (contents == (bfd_byte *) NULL)
-           {
-             bfd_set_error (bfd_error_no_memory);
-             goto error_return;
-           }
+           goto error_return;
          if (! bfd_get_section_contents (abfd, sec, (PTR) contents,
                                          (file_ptr) 0, sec->_raw_size))
            goto error_return;
@@ -2424,7 +2423,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
     mips_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
     _bfd_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
     _bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table,
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
   },
   /* Supported architecture.  */
   bfd_arch_mips,
@@ -2491,7 +2490,9 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
   /* Relocate section contents while linking.  */
   mips_relocate_section,
   /* Do final adjustments to filehdr and aouthdr.  */
-  NULL
+  NULL,
+  /* Read an element from an archive at a given file position.  */
+  _bfd_get_elt_at_filepos
 };
 
 /* Looking up a reloc type is MIPS specific.  */
@@ -2512,8 +2513,8 @@ const bfd_target ecoff_little_vec =
 {
   "ecoff-littlemips",          /* name */
   bfd_target_ecoff_flavour,
-  false,                       /* data byte order is little */
-  false,                       /* header byte order is little */
+  BFD_ENDIAN_LITTLE,           /* data byte order is little */
+  BFD_ENDIAN_LITTLE,           /* header byte order is little */
 
   (HAS_RELOC | EXEC_P |                /* object flags */
    HAS_LINENO | HAS_DEBUG |
@@ -2554,8 +2555,8 @@ const bfd_target ecoff_big_vec =
 {
   "ecoff-bigmips",             /* name */
   bfd_target_ecoff_flavour,
-  true,                                /* data byte order is big */
-  true,                                /* header byte order is big */
+  BFD_ENDIAN_BIG,              /* data byte order is big */
+  BFD_ENDIAN_BIG,              /* header byte order is big */
 
   (HAS_RELOC | EXEC_P |                /* object flags */
    HAS_LINENO | HAS_DEBUG |
This page took 0.03193 seconds and 4 git commands to generate.