* opncls.c (bfd_openstreamr): New function.
[deliverable/binutils-gdb.git] / bfd / coff-alpha.c
index cee3ea7bd3aaa9da102561f2f18d12b96f89eaf7..9b67dfb42cfba5ceec4fa7ed673175ddea4cbbd7 100644 (file)
@@ -33,8 +33,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 \f
 /* Prototypes for static functions.  */
 
-static bfd_target *alpha_ecoff_object_p PARAMS ((bfd *));
+static const bfd_target *alpha_ecoff_object_p PARAMS ((bfd *));
 static boolean alpha_ecoff_bad_format_hook PARAMS ((bfd *abfd, PTR filehdr));
+static PTR alpha_ecoff_mkobject_hook PARAMS ((bfd *, PTR filehdr, PTR aouthdr));
 static void alpha_ecoff_swap_reloc_in PARAMS ((bfd *, PTR,
                                              struct internal_reloc *));
 static void alpha_ecoff_swap_reloc_out PARAMS ((bfd *,
@@ -421,15 +422,15 @@ static reloc_howto_type alpha_howto_table[] =
 \f
 /* Recognize an Alpha ECOFF file.  */
 
-static bfd_target *
+static const bfd_target *
 alpha_ecoff_object_p (abfd)
      bfd *abfd;
 {
-  static bfd_target *ret;
+  static const bfd_target *ret;
 
   ret = coff_object_p (abfd);
 
-  if (ret != (bfd_target *) NULL)
+  if (ret != NULL)
     {
       asection *sec;
 
@@ -472,6 +473,40 @@ alpha_ecoff_bad_format_hook (abfd, filehdr)
 
   return true;
 }
+
+/* This is a hook called by coff_real_object_p to create any backend
+   specific information.  */
+
+static PTR
+alpha_ecoff_mkobject_hook (abfd, filehdr, aouthdr)
+     bfd *abfd;
+     PTR filehdr;
+     PTR aouthdr;
+{
+  PTR ecoff;
+
+  ecoff = _bfd_ecoff_mkobject_hook (abfd, filehdr, aouthdr);
+
+  if (ecoff != NULL)
+    {
+      struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
+
+      /* Set additional BFD flags according to the object type from the
+        machine specific file header flags.  */
+      switch (internal_f->f_flags & F_ALPHA_OBJECT_TYPE_MASK)
+       {
+       case F_ALPHA_SHARABLE:
+         abfd->flags |= DYNAMIC;
+         break;
+       case F_ALPHA_CALL_SHARED:
+         /* Always executable if using shared libraries as the run time
+            loader might resolve undefined references.  */
+         abfd->flags |= (DYNAMIC | EXEC_P);
+         break;
+       }
+    }
+  return ecoff;
+}
 \f
 /* Reloc handling.  */
 
@@ -641,7 +676,7 @@ alpha_adjust_reloc_in (abfd, intern, rptr)
         some reason the address of this reloc type is not adjusted by
         the section vma.  We record the gp value for this object file
         here, for convenience when doing the GPDISP relocation.  */
-      rptr->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
+      rptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
       rptr->address = intern->r_vaddr;
       rptr->addend = ecoff_data (abfd)->gp;
       break;
@@ -954,7 +989,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
            /* Figure out the relocation of this symbol.  */
            symbol = *rel->sym_ptr_ptr;
 
-           if (symbol->section == &bfd_und_section)
+           if (bfd_is_und_section (symbol->section))
              r = bfd_reloc_undefined;
 
            if (bfd_is_com_section (symbol->section))
@@ -1014,7 +1049,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
            /* Figure out the relocation of this symbol.  */
            symbol = *rel->sym_ptr_ptr;
 
-           if (symbol->section == &bfd_und_section)
+           if (bfd_is_und_section (symbol->section))
              r = bfd_reloc_undefined;
 
            if (bfd_is_com_section (symbol->section))
@@ -1047,7 +1082,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
            /* Figure out the relocation of this symbol.  */
            symbol = *rel->sym_ptr_ptr;
 
-           if (symbol->section == &bfd_und_section)
+           if (bfd_is_und_section (symbol->section))
              r = bfd_reloc_undefined;
 
            if (bfd_is_com_section (symbol->section))
@@ -1382,7 +1417,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
        bfd_get_section_by_name (input_bfd, ".fini");
       symndx_to_section[RELOC_SECTION_LITA] =
        bfd_get_section_by_name (input_bfd, ".lita");
-      symndx_to_section[RELOC_SECTION_ABS] = &bfd_abs_section;
+      symndx_to_section[RELOC_SECTION_ABS] = bfd_abs_section_ptr;
 
       ecoff_data (input_bfd)->symndx_to_section = symndx_to_section;
     }
@@ -1911,12 +1946,14 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
     (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */
     alpha_ecoff_swap_filehdr_out, alpha_ecoff_swap_aouthdr_out,
     alpha_ecoff_swap_scnhdr_out,
-    FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, true,
+    FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, true,
     alpha_ecoff_swap_filehdr_in, alpha_ecoff_swap_aouthdr_in,
-    alpha_ecoff_swap_scnhdr_in, alpha_ecoff_bad_format_hook,
-    ecoff_set_arch_mach_hook, ecoff_mkobject_hook,
-    ecoff_styp_to_sec_flags, ecoff_make_section_hook, ecoff_set_alignment_hook,
-    ecoff_slurp_symbol_table, NULL, NULL
+    alpha_ecoff_swap_scnhdr_in, NULL,
+    alpha_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
+    alpha_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
+    _bfd_ecoff_make_section_hook, _bfd_ecoff_set_alignment_hook,
+    _bfd_ecoff_slurp_symbol_table,
+    NULL, NULL, NULL, NULL, NULL, NULL
   },
   /* Supported architecture.  */
   bfd_arch_alpha,
@@ -1956,6 +1993,8 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
     ecoff_swap_fdr_in,
     ecoff_swap_rfd_in,
     ecoff_swap_ext_in,
+    _bfd_ecoff_swap_tir_in,
+    _bfd_ecoff_swap_rndx_in,
     /* Functions to swap out external symbolic data.  */
     ecoff_swap_hdr_out,
     ecoff_swap_dnr_out,
@@ -1964,7 +2003,11 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
     ecoff_swap_opt_out,
     ecoff_swap_fdr_out,
     ecoff_swap_rfd_out,
-    ecoff_swap_ext_out
+    ecoff_swap_ext_out,
+    _bfd_ecoff_swap_tir_out,
+    _bfd_ecoff_swap_rndx_out,
+    /* Function to read in symbolic data.  */
+    _bfd_ecoff_slurp_symbolic_info
   },
   /* External reloc size.  */
   RELSZ,
@@ -1979,16 +2022,16 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
 };
 
 /* Looking up a reloc type is Alpha specific.  */
-#define ecoff_bfd_reloc_type_lookup alpha_bfd_reloc_type_lookup
+#define _bfd_ecoff_bfd_reloc_type_lookup alpha_bfd_reloc_type_lookup
 
 /* So is getting relocated section contents.  */
-#define ecoff_bfd_get_relocated_section_contents \
+#define _bfd_ecoff_bfd_get_relocated_section_contents \
   alpha_ecoff_get_relocated_section_contents
 
 /* Relaxing sections is generic.  */
-#define ecoff_bfd_relax_section bfd_generic_relax_section
+#define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section
 
-bfd_target ecoffalpha_little_vec =
+const bfd_target ecoffalpha_little_vec =
 {
   "ecoff-littlealpha",         /* name */
   bfd_target_ecoff_flavour,
@@ -1997,7 +2040,7 @@ bfd_target ecoffalpha_little_vec =
 
   (HAS_RELOC | EXEC_P |                /* object flags */
    HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
+   HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
 
   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect
                                                            flags */
@@ -2013,20 +2056,21 @@ bfd_target ecoffalpha_little_vec =
      bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
 
   {_bfd_dummy_target, alpha_ecoff_object_p, /* bfd_check_format */
-     ecoff_archive_p, _bfd_dummy_target},
-  {bfd_false, ecoff_mkobject,  /* bfd_set_format */
+     _bfd_ecoff_archive_p, _bfd_dummy_target},
+  {bfd_false, _bfd_ecoff_mkobject,  /* bfd_set_format */
      _bfd_generic_mkarchive, bfd_false},
-  {bfd_false, ecoff_write_object_contents, /* bfd_write_contents */
+  {bfd_false, _bfd_ecoff_write_object_contents, /* bfd_write_contents */
      _bfd_write_archive_contents, bfd_false},
 
-     BFD_JUMP_TABLE_GENERIC (ecoff),
-     BFD_JUMP_TABLE_COPY (ecoff),
+     BFD_JUMP_TABLE_GENERIC (_bfd_ecoff),
+     BFD_JUMP_TABLE_COPY (_bfd_ecoff),
      BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (ecoff),
-     BFD_JUMP_TABLE_SYMBOLS (ecoff),
-     BFD_JUMP_TABLE_RELOCS (ecoff),
-     BFD_JUMP_TABLE_WRITE (ecoff),
-     BFD_JUMP_TABLE_LINK (ecoff),
+     BFD_JUMP_TABLE_ARCHIVE (_bfd_ecoff),
+     BFD_JUMP_TABLE_SYMBOLS (_bfd_ecoff),
+     BFD_JUMP_TABLE_RELOCS (_bfd_ecoff),
+     BFD_JUMP_TABLE_WRITE (_bfd_ecoff),
+     BFD_JUMP_TABLE_LINK (_bfd_ecoff),
+     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   (PTR) &alpha_ecoff_backend_data
 };
This page took 0.028217 seconds and 4 git commands to generate.