* elflink.c (is_reloc_section): New function. Returns true if the
[deliverable/binutils-gdb.git] / bfd / elf32-vax.c
index 8ce4678e29157a6faf6c8addc1d75bdc206f8701..7f47819223cb9e784edebd4457e3ac8d607924bb 100644 (file)
@@ -1,13 +1,13 @@
 /* VAX series support for 32-bit ELF
    Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004 Free Software Foundation, Inc.
+   2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
    Contributed by Matt Thomas <matt@3am-software.com>.
 
    This file is part of BFD, the Binary File Descriptor library.
 
    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 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
-#include "bfd.h"
 #include "sysdep.h"
+#include "bfd.h"
 #include "bfdlink.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
 #include "elf/vax.h"
 
-static reloc_howto_type *reloc_type_lookup
-  PARAMS ((bfd *, bfd_reloc_code_real_type));
-static void rtype_to_howto
-  PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
-static struct bfd_hash_entry *elf_vax_link_hash_newfunc
-  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static struct bfd_link_hash_table *elf_vax_link_hash_table_create
-  PARAMS ((bfd *));
-static bfd_boolean elf_vax_check_relocs
-  PARAMS ((bfd *, struct bfd_link_info *, asection *,
-          const Elf_Internal_Rela *));
-static asection *elf_vax_gc_mark_hook
-  PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
-          struct elf_link_hash_entry *, Elf_Internal_Sym *));
-static bfd_boolean elf_vax_gc_sweep_hook
-  PARAMS ((bfd *, struct bfd_link_info *, asection *,
-          const Elf_Internal_Rela *));
-static bfd_boolean elf_vax_adjust_dynamic_symbol
-  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static bfd_boolean elf_vax_size_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf_vax_relocate_section
-  PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
-          Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-static bfd_boolean elf_vax_finish_dynamic_symbol
-  PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
-          Elf_Internal_Sym *));
-static bfd_boolean elf_vax_finish_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-
-static bfd_boolean elf32_vax_set_private_flags
-  PARAMS ((bfd *, flagword));
-static bfd_boolean elf32_vax_merge_private_bfd_data
-  PARAMS ((bfd *, bfd *));
-static bfd_boolean elf32_vax_print_private_bfd_data
-  PARAMS ((bfd *, PTR));
+static reloc_howto_type *reloc_type_lookup (bfd *, bfd_reloc_code_real_type);
+static void rtype_to_howto (bfd *, arelent *, Elf_Internal_Rela *);
+static struct bfd_hash_entry *elf_vax_link_hash_newfunc (struct bfd_hash_entry *,
+                                                        struct bfd_hash_table *,
+                                                        const char *);
+static struct bfd_link_hash_table *elf_vax_link_hash_table_create (bfd *);
+static bfd_boolean elf_vax_check_relocs (bfd *, struct bfd_link_info *,
+                                        asection *, const Elf_Internal_Rela *);
+static bfd_boolean elf_vax_adjust_dynamic_symbol (struct bfd_link_info *,
+                                                 struct elf_link_hash_entry *);
+static bfd_boolean elf_vax_size_dynamic_sections (bfd *, struct bfd_link_info *);
+static bfd_boolean elf_vax_relocate_section (bfd *, struct bfd_link_info *,
+                                            bfd *, asection *, bfd_byte *,
+                                            Elf_Internal_Rela *,
+                                            Elf_Internal_Sym *, asection **);
+static bfd_boolean elf_vax_finish_dynamic_symbol (bfd *, struct bfd_link_info *,
+                                                 struct elf_link_hash_entry *,
+                                                 Elf_Internal_Sym *);
+static bfd_boolean elf_vax_finish_dynamic_sections (bfd *,
+                                                   struct bfd_link_info *);
+
+static bfd_boolean elf32_vax_set_private_flags (bfd *, flagword);
+static bfd_boolean elf32_vax_merge_private_bfd_data (bfd *, bfd *);
+static bfd_boolean elf32_vax_print_private_bfd_data (bfd *, PTR);
 
 static reloc_howto_type howto_table[] = {
   HOWTO (R_VAX_NONE,           /* type */
@@ -290,10 +279,8 @@ static reloc_howto_type howto_table[] = {
 };
 
 static void
-rtype_to_howto (abfd, cache_ptr, dst)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     arelent *cache_ptr;
-     Elf_Internal_Rela *dst;
+rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
+               Elf_Internal_Rela *dst)
 {
   BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_VAX_max);
   cache_ptr->howto = &howto_table[ELF32_R_TYPE(dst->r_info)];
@@ -325,9 +312,7 @@ static const struct
 };
 
 static reloc_howto_type *
-reloc_type_lookup (abfd, code)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     bfd_reloc_code_real_type code;
+reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type code)
 {
   unsigned int i;
   for (i = 0; i < sizeof (reloc_map) / sizeof (reloc_map[0]); i++)
@@ -338,7 +323,22 @@ reloc_type_lookup (abfd, code)
   return 0;
 }
 
+static reloc_howto_type *
+reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+                  const char *r_name)
+{
+  unsigned int i;
+
+  for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++)
+    if (howto_table[i].name != NULL
+       && strcasecmp (howto_table[i].name, r_name) == 0)
+      return &howto_table[i];
+
+  return NULL;
+}
+
 #define bfd_elf32_bfd_reloc_type_lookup reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup reloc_name_lookup
 #define ELF_ARCH bfd_arch_vax
 /* end code generated by elf.el */
 \f
@@ -414,52 +414,50 @@ struct elf_vax_link_hash_table
 
 /* Declare this now that the above structures are defined.  */
 
-static bfd_boolean elf_vax_discard_copies
-  PARAMS ((struct elf_vax_link_hash_entry *, PTR));
+static bfd_boolean elf_vax_discard_copies (struct elf_vax_link_hash_entry *,
+                                          PTR);
 
 /* Declare this now that the above structures are defined.  */
 
-static bfd_boolean elf_vax_instantiate_got_entries
-  PARAMS ((struct elf_link_hash_entry *, PTR));
+static bfd_boolean elf_vax_instantiate_got_entries (struct elf_link_hash_entry *,
+                                                   PTR);
 
 /* Traverse an VAX ELF linker hash table.  */
 
 #define elf_vax_link_hash_traverse(table, func, info)                  \
   (elf_link_hash_traverse                                              \
    (&(table)->root,                                                    \
-    (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \
+    (bfd_boolean (*) (struct elf_link_hash_entry *, PTR)) (func),      \
     (info)))
 
 /* Get the VAX ELF linker hash table from a link_info structure.  */
 
-#define elf_vax_hash_table(p) \
-  ((struct elf_vax_link_hash_table *) (p)->hash)
+#define elf_vax_hash_table(p) ((struct elf_vax_link_hash_table *) (p)->hash)
 
 /* Create an entry in an VAX ELF linker hash table.  */
 
 static struct bfd_hash_entry *
-elf_vax_link_hash_newfunc (entry, table, string)
-     struct bfd_hash_entry *entry;
-     struct bfd_hash_table *table;
-     const char *string;
+elf_vax_link_hash_newfunc (struct bfd_hash_entry *entry,
+                          struct bfd_hash_table *table,
+                          const char *string)
 {
   struct elf_vax_link_hash_entry *ret =
     (struct elf_vax_link_hash_entry *) entry;
 
   /* Allocate the structure if it has not already been allocated by a
      subclass.  */
-  if (ret == (struct elf_vax_link_hash_entry *) NULL)
+  if (ret == NULL)
     ret = ((struct elf_vax_link_hash_entry *)
           bfd_hash_allocate (table,
                              sizeof (struct elf_vax_link_hash_entry)));
-  if (ret == (struct elf_vax_link_hash_entry *) NULL)
+  if (ret == NULL)
     return (struct bfd_hash_entry *) ret;
 
   /* Call the allocation method of the superclass.  */
   ret = ((struct elf_vax_link_hash_entry *)
         _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
                                     table, string));
-  if (ret != (struct elf_vax_link_hash_entry *) NULL)
+  if (ret != NULL)
     {
       ret->pcrel_relocs_copied = NULL;
     }
@@ -470,18 +468,18 @@ elf_vax_link_hash_newfunc (entry, table, string)
 /* Create an VAX ELF linker hash table.  */
 
 static struct bfd_link_hash_table *
-elf_vax_link_hash_table_create (abfd)
-     bfd *abfd;
+elf_vax_link_hash_table_create (bfd *abfd)
 {
   struct elf_vax_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_vax_link_hash_table);
 
-  ret = (struct elf_vax_link_hash_table *) bfd_malloc (amt);
-  if (ret == (struct elf_vax_link_hash_table *) NULL)
+  ret = bfd_malloc (amt);
+  if (ret == NULL)
     return NULL;
 
-  if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
-                                      elf_vax_link_hash_newfunc))
+  if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
+                                     elf_vax_link_hash_newfunc,
+                                     sizeof (struct elf_vax_link_hash_entry)))
     {
       free (ret);
       return NULL;
@@ -492,9 +490,7 @@ elf_vax_link_hash_table_create (abfd)
 
 /* Keep vax-specific flags in the ELF header */
 static bfd_boolean
-elf32_vax_set_private_flags (abfd, flags)
-     bfd *abfd;
-     flagword flags;
+elf32_vax_set_private_flags (bfd *abfd, flagword flags)
 {
   elf_elfheader (abfd)->e_flags = flags;
   elf_flags_init (abfd) = TRUE;
@@ -504,9 +500,7 @@ elf32_vax_set_private_flags (abfd, flags)
 /* Merge backend specific data from an object file to the output
    object file when linking.  */
 static bfd_boolean
-elf32_vax_merge_private_bfd_data (ibfd, obfd)
-     bfd *ibfd;
-     bfd *obfd;
+elf32_vax_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
 {
   flagword out_flags;
   flagword in_flags;
@@ -529,9 +523,7 @@ elf32_vax_merge_private_bfd_data (ibfd, obfd)
 
 /* Display the flags field */
 static bfd_boolean
-elf32_vax_print_private_bfd_data (abfd, ptr)
-     bfd *abfd;
-     PTR ptr;
+elf32_vax_print_private_bfd_data (bfd *abfd, PTR ptr)
 {
   FILE *file = (FILE *) ptr;
 
@@ -563,11 +555,8 @@ elf32_vax_print_private_bfd_data (abfd, ptr)
    table.  */
 
 static bfd_boolean
-elf_vax_check_relocs (abfd, info, sec, relocs)
-     bfd *abfd;
-     struct bfd_link_info *info;
-     asection *sec;
-     const Elf_Internal_Rela *relocs;
+elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
+                     const Elf_Internal_Rela *relocs)
 {
   bfd *dynobj;
   Elf_Internal_Shdr *symtab_hdr;
@@ -600,7 +589,12 @@ elf_vax_check_relocs (abfd, info, sec, relocs)
       if (r_symndx < symtab_hdr->sh_info)
        h = NULL;
       else
-       h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+       {
+         h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+         while (h->root.type == bfd_link_hash_indirect
+                || h->root.type == bfd_link_hash_warning)
+           h = (struct elf_link_hash_entry *) h->root.u.i.link;
+       }
 
       switch (ELF32_R_TYPE (rel->r_info))
        {
@@ -631,15 +625,15 @@ elf_vax_check_relocs (abfd, info, sec, relocs)
              srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
              if (srelgot == NULL)
                {
-                 srelgot = bfd_make_section (dynobj, ".rela.got");
+                 srelgot = bfd_make_section_with_flags (dynobj,
+                                                        ".rela.got",
+                                                        (SEC_ALLOC
+                                                         | SEC_LOAD
+                                                         | SEC_HAS_CONTENTS
+                                                         | SEC_IN_MEMORY
+                                                         | SEC_LINKER_CREATED
+                                                         | SEC_READONLY));
                  if (srelgot == NULL
-                     || !bfd_set_section_flags (dynobj, srelgot,
-                                                (SEC_ALLOC
-                                                 | SEC_LOAD
-                                                 | SEC_HAS_CONTENTS
-                                                 | SEC_IN_MEMORY
-                                                 | SEC_LINKER_CREATED
-                                                 | SEC_READONLY))
                      || !bfd_set_section_alignment (dynobj, srelgot, 2))
                    return FALSE;
                }
@@ -682,7 +676,7 @@ elf_vax_check_relocs (abfd, info, sec, relocs)
          if (h == NULL)
            continue;
 
-         h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+         h->needs_plt = 1;
          if (h->plt.refcount == -1)
            h->plt.refcount = 1;
          else
@@ -706,8 +700,7 @@ elf_vax_check_relocs (abfd, info, sec, relocs)
                && (sec->flags & SEC_ALLOC) != 0
                && h != NULL
                && (!info->symbolic
-                   || (h->elf_link_hash_flags
-                       & ELF_LINK_HASH_DEF_REGULAR) == 0)))
+                   || !h->def_regular)))
            {
              if (h != NULL)
                {
@@ -745,39 +738,17 @@ elf_vax_check_relocs (abfd, info, sec, relocs)
                 section in dynobj and make room for this reloc.  */
              if (sreloc == NULL)
                {
-                 const char *name;
+                 sreloc = _bfd_elf_make_dynamic_reloc_section
+                   (sec, dynobj, 2, abfd, /*rela?*/ TRUE);
 
-                 name = (bfd_elf_string_from_elf_section
-                         (abfd,
-                          elf_elfheader (abfd)->e_shstrndx,
-                          elf_section_data (sec)->rel_hdr.sh_name));
-                 if (name == NULL)
+                 if (sreloc == NULL)
                    return FALSE;
 
-                 BFD_ASSERT (strncmp (name, ".rela", 5) == 0
-                             && strcmp (bfd_get_section_name (abfd, sec),
-                                        name + 5) == 0);
-
-                 sreloc = bfd_get_section_by_name (dynobj, name);
-                 if (sreloc == NULL)
-                   {
-                     sreloc = bfd_make_section (dynobj, name);
-                     if (sreloc == NULL
-                         || !bfd_set_section_flags (dynobj, sreloc,
-                                                    (SEC_ALLOC
-                                                     | SEC_LOAD
-                                                     | SEC_HAS_CONTENTS
-                                                     | SEC_IN_MEMORY
-                                                     | SEC_LINKER_CREATED
-                                                     | SEC_READONLY))
-                         || !bfd_set_section_alignment (dynobj, sreloc, 2))
-                       return FALSE;
-                   }
                  if (sec->flags & SEC_READONLY)
                    info->flags |= DF_TEXTREL;
                }
 
-             sreloc->_raw_size += sizeof (Elf32_External_Rela);
+             sreloc->size += sizeof (Elf32_External_Rela);
 
              /* If we are linking with -Bsymbolic, we count the number of
                 PC relative relocations we have entered for this symbol,
@@ -787,8 +758,8 @@ elf_vax_check_relocs (abfd, info, sec, relocs)
                 which means that h is really a pointer to an
                 elf_vax_link_hash_entry.  */
              if ((ELF32_R_TYPE (rel->r_info) == R_VAX_PC8
-                  || ELF32_R_TYPE (rel->r_info) == R_VAX_PC16
-                  || ELF32_R_TYPE (rel->r_info) == R_VAX_PC32)
+                  || ELF32_R_TYPE (rel->r_info) == R_VAX_PC16
+                  || ELF32_R_TYPE (rel->r_info) == R_VAX_PC32)
                  && info->symbolic)
                {
                  struct elf_vax_link_hash_entry *eh;
@@ -828,7 +799,9 @@ elf_vax_check_relocs (abfd, info, sec, relocs)
          /* This relocation describes which C++ vtable entries are actually
             used.  Record for later use during GC.  */
        case R_VAX_GNU_VTENTRY:
-         if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+         BFD_ASSERT (h != NULL);
+         if (h != NULL
+             && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
            return FALSE;
          break;
 
@@ -844,56 +817,37 @@ elf_vax_check_relocs (abfd, info, sec, relocs)
    relocation.  */
 
 static asection *
-elf_vax_gc_mark_hook (sec, info, rel, h, sym)
-     asection *sec;
-     struct bfd_link_info *info ATTRIBUTE_UNUSED;
-     Elf_Internal_Rela *rel;
-     struct elf_link_hash_entry *h;
-     Elf_Internal_Sym *sym;
+elf_vax_gc_mark_hook (asection *sec,
+                     struct bfd_link_info *info,
+                     Elf_Internal_Rela *rel,
+                     struct elf_link_hash_entry *h,
+                     Elf_Internal_Sym *sym)
 {
   if (h != NULL)
-    {
-      switch (ELF32_R_TYPE (rel->r_info))
-       {
-       case R_VAX_GNU_VTINHERIT:
-       case R_VAX_GNU_VTENTRY:
-         break;
-
-       default:
-         switch (h->root.type)
-           {
-           default:
-             break;
-
-           case bfd_link_hash_defined:
-           case bfd_link_hash_defweak:
-             return h->root.u.def.section;
-
-           case bfd_link_hash_common:
-             return h->root.u.c.p->section;
-           }
-       }
-    }
-  else
-    return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
-  return NULL;
+    switch (ELF32_R_TYPE (rel->r_info))
+      {
+      case R_VAX_GNU_VTINHERIT:
+      case R_VAX_GNU_VTENTRY:
+       return NULL;
+      }
+
+  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
 }
 
 /* Update the got entry reference counts for the section being removed.  */
 
 static bfd_boolean
-elf_vax_gc_sweep_hook (abfd, info, sec, relocs)
-     bfd *abfd;
-     struct bfd_link_info *info;
-     asection *sec;
-     const Elf_Internal_Rela *relocs;
+elf_vax_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, asection *sec,
+                      const Elf_Internal_Rela *relocs)
 {
   Elf_Internal_Shdr *symtab_hdr;
   struct elf_link_hash_entry **sym_hashes;
   const Elf_Internal_Rela *rel, *relend;
   bfd *dynobj;
 
+  if (info->relocatable)
+    return TRUE;
+
   dynobj = elf_hash_table (info)->dynobj;
   if (dynobj == NULL)
     return TRUE;
@@ -905,18 +859,22 @@ elf_vax_gc_sweep_hook (abfd, info, sec, relocs)
   for (rel = relocs; rel < relend; rel++)
     {
       unsigned long r_symndx;
-      struct elf_link_hash_entry *h;
+      struct elf_link_hash_entry *h = NULL;
+
+      r_symndx = ELF32_R_SYM (rel->r_info);
+      if (r_symndx >= symtab_hdr->sh_info)
+       {
+         h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+         while (h->root.type == bfd_link_hash_indirect
+                || h->root.type == bfd_link_hash_warning)
+           h = (struct elf_link_hash_entry *) h->root.u.i.link;
+       }
 
       switch (ELF32_R_TYPE (rel->r_info))
        {
        case R_VAX_GOT32:
-         r_symndx = ELF32_R_SYM (rel->r_info);
-         if (r_symndx >= symtab_hdr->sh_info)
-           {
-             h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-             if (h->got.refcount > 0)
-               --h->got.refcount;
-           }
+         if (h != NULL && h->got.refcount > 0)
+           --h->got.refcount;
          break;
 
        case R_VAX_PLT32:
@@ -926,13 +884,8 @@ elf_vax_gc_sweep_hook (abfd, info, sec, relocs)
        case R_VAX_8:
        case R_VAX_16:
        case R_VAX_32:
-         r_symndx = ELF32_R_SYM (rel->r_info);
-         if (r_symndx >= symtab_hdr->sh_info)
-           {
-             h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-             if (h->plt.refcount > 0)
-               --h->plt.refcount;
-           }
+         if (h != NULL && h->plt.refcount > 0)
+           --h->plt.refcount;
          break;
 
        default:
@@ -956,30 +909,26 @@ elf_vax_adjust_dynamic_symbol (info, h)
 {
   bfd *dynobj;
   asection *s;
-  unsigned int power_of_two;
 
   dynobj = elf_hash_table (info)->dynobj;
 
   /* Make sure we know what is going on here.  */
   BFD_ASSERT (dynobj != NULL
-             && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
-                 || h->weakdef != NULL
-                 || ((h->elf_link_hash_flags
-                      & ELF_LINK_HASH_DEF_DYNAMIC) != 0
-                     && (h->elf_link_hash_flags
-                         & ELF_LINK_HASH_REF_REGULAR) != 0
-                     && (h->elf_link_hash_flags
-                         & ELF_LINK_HASH_DEF_REGULAR) == 0)));
+             && (h->needs_plt
+                 || h->u.weakdef != NULL
+                 || (h->def_dynamic
+                     && h->ref_regular
+                     && !h->def_regular)));
 
   /* If this is a function, put it in the procedure linkage table.  We
      will fill in the contents of the procedure linkage table later,
      when we know the address of the .got section.  */
   if (h->type == STT_FUNC
-      || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
+      || h->needs_plt)
     {
       if (! info->shared
-         && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
-         && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
+         && !h->def_dynamic
+         && !h->ref_dynamic
          /* We must always create the plt entry if it was referenced
             by a PLTxxO relocation.  In this case we already recorded
             it as a dynamic symbol.  */
@@ -990,7 +939,7 @@ elf_vax_adjust_dynamic_symbol (info, h)
             object.  In such a case, we don't actually need to build
             a procedure linkage table, and we can just do a PCxx
             reloc instead.  */
-         BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0);
+         BFD_ASSERT (h->needs_plt);
          h->plt.offset = (bfd_vma) -1;
          return TRUE;
        }
@@ -998,7 +947,7 @@ elf_vax_adjust_dynamic_symbol (info, h)
       /* GC may have rendered this entry unused.  */
       if (h->plt.refcount <= 0)
        {
-         h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+         h->needs_plt = 0;
          h->plt.offset = (bfd_vma) -1;
          return TRUE;
        }
@@ -1015,9 +964,9 @@ elf_vax_adjust_dynamic_symbol (info, h)
 
       /* If this is the first .plt entry, make room for the special
         first entry.  */
-      if (s->_raw_size == 0)
+      if (s->size == 0)
        {
-         s->_raw_size += PLT_ENTRY_SIZE;
+         s->size += PLT_ENTRY_SIZE;
        }
 
       /* If this symbol is not defined in a regular file, and we are
@@ -1026,29 +975,29 @@ elf_vax_adjust_dynamic_symbol (info, h)
         pointers compare as equal between the normal executable and
         the shared library.  */
       if (!info->shared
-         && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+         && !h->def_regular)
        {
          h->root.u.def.section = s;
-         h->root.u.def.value = s->_raw_size;
+         h->root.u.def.value = s->size;
        }
 
-      h->plt.offset = s->_raw_size;
+      h->plt.offset = s->size;
 
       /* Make room for this entry.  */
-      s->_raw_size += PLT_ENTRY_SIZE;
+      s->size += PLT_ENTRY_SIZE;
 
       /* We also need to make an entry in the .got.plt section, which
         will be placed in the .got section by the linker script.  */
 
       s = bfd_get_section_by_name (dynobj, ".got.plt");
       BFD_ASSERT (s != NULL);
-      s->_raw_size += 4;
+      s->size += 4;
 
       /* We also need to make an entry in the .rela.plt section.  */
 
       s = bfd_get_section_by_name (dynobj, ".rela.plt");
       BFD_ASSERT (s != NULL);
-      s->_raw_size += sizeof (Elf32_External_Rela);
+      s->size += sizeof (Elf32_External_Rela);
 
       return TRUE;
     }
@@ -1060,12 +1009,12 @@ elf_vax_adjust_dynamic_symbol (info, h)
   /* If this is a weak symbol, and there is a real definition, the
      processor independent code will have arranged for us to see the
      real definition first, and we can just use the same value.  */
-  if (h->weakdef != NULL)
+  if (h->u.weakdef != NULL)
     {
-      BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
-                 || h->weakdef->root.type == bfd_link_hash_defweak);
-      h->root.u.def.section = h->weakdef->root.u.def.section;
-      h->root.u.def.value = h->weakdef->root.u.def.value;
+      BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
+                 || h->u.weakdef->root.type == bfd_link_hash_defweak);
+      h->root.u.def.section = h->u.weakdef->root.u.def.section;
+      h->root.u.def.value = h->u.weakdef->root.u.def.value;
       return TRUE;
     }
 
@@ -1079,6 +1028,13 @@ elf_vax_adjust_dynamic_symbol (info, h)
   if (info->shared)
     return TRUE;
 
+  if (h->size == 0)
+    {
+      (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
+                            h->root.root.string);
+      return TRUE;
+    }
+
   /* We must allocate the symbol in our .dynbss section, which will
      become part of the .bss section of the executable.  There will be
      an entry for this symbol in the .dynsym section.  The dynamic
@@ -1102,41 +1058,17 @@ elf_vax_adjust_dynamic_symbol (info, h)
 
       srel = bfd_get_section_by_name (dynobj, ".rela.bss");
       BFD_ASSERT (srel != NULL);
-      srel->_raw_size += sizeof (Elf32_External_Rela);
-      h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
+      srel->size += sizeof (Elf32_External_Rela);
+      h->needs_copy = 1;
     }
 
-  /* We need to figure out the alignment required for this symbol.  I
-     have no idea how ELF linkers handle this.  */
-  power_of_two = bfd_log2 (h->size);
-  if (power_of_two > 3)
-    power_of_two = 3;
-
-  /* Apply the required alignment.  */
-  s->_raw_size = BFD_ALIGN (s->_raw_size,
-                           (bfd_size_type) (1 << power_of_two));
-  if (power_of_two > bfd_get_section_alignment (dynobj, s))
-    {
-      if (!bfd_set_section_alignment (dynobj, s, power_of_two))
-       return FALSE;
-    }
-
-  /* Define the symbol as being at this point in the section.  */
-  h->root.u.def.section = s;
-  h->root.u.def.value = s->_raw_size;
-
-  /* Increment the section size to make room for the symbol.  */
-  s->_raw_size += h->size;
-
-  return TRUE;
+  return _bfd_elf_adjust_dynamic_copy (h, s);
 }
 
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
-elf_vax_size_dynamic_sections (output_bfd, info)
-     bfd *output_bfd;
-     struct bfd_link_info *info;
+elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
 {
   bfd *dynobj;
   asection *s;
@@ -1154,7 +1086,7 @@ elf_vax_size_dynamic_sections (output_bfd, info)
        {
          s = bfd_get_section_by_name (dynobj, ".interp");
          BFD_ASSERT (s != NULL);
-         s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
+         s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
        }
     }
@@ -1167,13 +1099,13 @@ elf_vax_size_dynamic_sections (output_bfd, info)
         file below.  */
       s = bfd_get_section_by_name (dynobj, ".rela.got");
       if (s != NULL)
-       s->_raw_size = 0;
+       s->size = 0;
       s = bfd_get_section_by_name (dynobj, ".got.plt");
       if (s != NULL)
-       s->_raw_size = 0;
+       s->size = 0;
       s = bfd_get_section_by_name (dynobj, ".got");
       if (s != NULL)
-       s->_raw_size = 0;
+       s->size = 0;
     }
 
   /* If this is a -Bsymbolic shared link, then we need to discard all PC
@@ -1183,7 +1115,7 @@ elf_vax_size_dynamic_sections (output_bfd, info)
   if (info->shared && info->symbolic)
     elf_vax_link_hash_traverse (elf_vax_hash_table (info),
                                elf_vax_discard_copies,
-                               (PTR) NULL);
+                               NULL);
 
   /* If this is a -Bsymbolic shared link or a static link, we need to
      discard all the got entries we've recorded.  Otherwise, we need to
@@ -1201,7 +1133,6 @@ elf_vax_size_dynamic_sections (output_bfd, info)
   for (s = dynobj->sections; s != NULL; s = s->next)
     {
       const char *name;
-      bfd_boolean strip;
 
       if ((s->flags & SEC_LINKER_CREATED) == 0)
        continue;
@@ -1210,38 +1141,14 @@ elf_vax_size_dynamic_sections (output_bfd, info)
         of the dynobj section names depend upon the input files.  */
       name = bfd_get_section_name (dynobj, s);
 
-      strip = FALSE;
-
       if (strcmp (name, ".plt") == 0)
        {
-         if (s->_raw_size == 0)
-           {
-             /* Strip this section if we don't need it; see the
-                 comment below.  */
-             strip = TRUE;
-           }
-         else
-           {
-             /* Remember whether there is a PLT.  */
-             plt = TRUE;
-           }
+         /* Remember whether there is a PLT.  */
+         plt = s->size != 0;
        }
-      else if (strncmp (name, ".rela", 5) == 0)
+      else if (CONST_STRNEQ (name, ".rela"))
        {
-         if (s->_raw_size == 0)
-           {
-             /* If we don't need this section, strip it from the
-                output file.  This is mostly to handle .rela.bss and
-                .rela.plt.  We must create both sections in
-                create_dynamic_sections, because they must be created
-                before the linker maps input sections to output
-                sections.  The linker does that before
-                adjust_dynamic_symbol is called, and it is that
-                function which decides whether anything needs to go
-                into these sections.  */
-             strip = TRUE;
-           }
-         else
+         if (s->size != 0)
            {
              asection *target;
 
@@ -1271,21 +1178,34 @@ elf_vax_size_dynamic_sections (output_bfd, info)
              s->reloc_count = 0;
            }
        }
-      else if (strncmp (name, ".got", 4) != 0)
+      else if (! CONST_STRNEQ (name, ".got")
+              && strcmp (name, ".dynbss") != 0)
        {
          /* It's not one of our sections, so don't allocate space.  */
          continue;
        }
 
-      if (strip)
+      if (s->size == 0)
        {
-         _bfd_strip_section_from_output (info, s);
+         /* If we don't need this section, strip it from the
+            output file.  This is mostly to handle .rela.bss and
+            .rela.plt.  We must create both sections in
+            create_dynamic_sections, because they must be created
+            before the linker maps input sections to output
+            sections.  The linker does that before
+            adjust_dynamic_symbol is called, and it is that
+            function which decides whether anything needs to go
+            into these sections.  */
+         s->flags |= SEC_EXCLUDE;
          continue;
        }
 
+      if ((s->flags & SEC_HAS_CONTENTS) == 0)
+       continue;
+
       /* Allocate memory for the section contents.  */
-      s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
-      if (s->contents == NULL && s->_raw_size != 0)
+      s->contents = (bfd_byte *) bfd_alloc (dynobj, s->size);
+      if (s->contents == NULL)
        return FALSE;
     }
 
@@ -1340,9 +1260,8 @@ elf_vax_size_dynamic_sections (output_bfd, info)
    routine, but we won't fill them in in the relocate_section routine.  */
 
 static bfd_boolean
-elf_vax_discard_copies (h, ignore)
-     struct elf_vax_link_hash_entry *h;
-     PTR ignore ATTRIBUTE_UNUSED;
+elf_vax_discard_copies (struct elf_vax_link_hash_entry *h,
+                       PTR ignore ATTRIBUTE_UNUSED)
 {
   struct elf_vax_pcrel_relocs_copied *s;
 
@@ -1350,11 +1269,11 @@ elf_vax_discard_copies (h, ignore)
     h = (struct elf_vax_link_hash_entry *) h->root.root.u.i.link;
 
   /* We only discard relocs for symbols defined in a regular object.  */
-  if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+  if (!h->root.def_regular)
     return TRUE;
 
   for (s = h->pcrel_relocs_copied; s != NULL; s = s->next)
-    s->section->_raw_size -= s->count * sizeof (Elf32_External_Rela);
+    s->section->size -= s->count * sizeof (Elf32_External_Rela);
 
   return TRUE;
 }
@@ -1367,9 +1286,7 @@ elf_vax_discard_copies (h, ignore)
    will be reserved for the symbol.  */
 
 static bfd_boolean
-elf_vax_instantiate_got_entries (h, infoptr)
-     struct elf_link_hash_entry *h;
-     PTR infoptr;
+elf_vax_instantiate_got_entries (struct elf_link_hash_entry *h, PTR infoptr)
 {
   struct bfd_link_info *info = (struct bfd_link_info *) infoptr;
   bfd *dynobj;
@@ -1405,8 +1322,8 @@ elf_vax_instantiate_got_entries (h, infoptr)
        }
 
       /* Allocate space in the .got and .rela.got sections.  */
-      sgot->_raw_size += 4;
-      srelgot->_raw_size += sizeof (Elf32_External_Rela);
+      sgot->size += 4;
+      srelgot->size += sizeof (Elf32_External_Rela);
     }
 
   return TRUE;
@@ -1415,16 +1332,14 @@ elf_vax_instantiate_got_entries (h, infoptr)
 /* Relocate an VAX ELF section.  */
 
 static bfd_boolean
-elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
-                          contents, relocs, local_syms, local_sections)
-     bfd *output_bfd;
-     struct bfd_link_info *info;
-     bfd *input_bfd;
-     asection *input_section;
-     bfd_byte *contents;
-     Elf_Internal_Rela *relocs;
-     Elf_Internal_Sym *local_syms;
-     asection **local_sections;
+elf_vax_relocate_section (bfd *output_bfd,
+                         struct bfd_link_info *info,
+                         bfd *input_bfd,
+                         asection *input_section,
+                         bfd_byte *contents,
+                         Elf_Internal_Rela *relocs,
+                         Elf_Internal_Sym *local_syms,
+                         asection **local_sections)
 {
   bfd *dynobj;
   Elf_Internal_Shdr *symtab_hdr;
@@ -1439,9 +1354,6 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
   Elf_Internal_Rela *rel;
   Elf_Internal_Rela *relend;
 
-  if (info->relocatable)
-    return TRUE;
-
   dynobj = elf_hash_table (info)->dynobj;
   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (input_bfd);
@@ -1473,7 +1385,6 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
        }
       howto = howto_table + r_type;
 
-      /* This is a final link.  */
       r_symndx = ELF32_R_SYM (rel->r_info);
       h = NULL;
       sym = NULL;
@@ -1493,7 +1404,7 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
                                   r_symndx, symtab_hdr, sym_hashes,
                                   h, sec, relocation,
                                   unresolved_reloc, warned);
-          
+
          if ((h->root.type == bfd_link_hash_defined
              || h->root.type == bfd_link_hash_defweak)
              && ((r_type == R_VAX_PLT32
@@ -1505,12 +1416,10 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
                      && elf_hash_table (info)->dynamic_sections_created
                      && (! info->shared
                          || (! info->symbolic && h->dynindx != -1)
-                         || (h->elf_link_hash_flags
-                             & ELF_LINK_HASH_DEF_REGULAR) == 0))
+                         || !h->def_regular))
                  || (info->shared
                      && ((! info->symbolic && h->dynindx != -1)
-                         || (h->elf_link_hash_flags
-                             & ELF_LINK_HASH_DEF_REGULAR) == 0)
+                         || !h->def_regular)
                      && ((input_section->flags & SEC_ALLOC) != 0
                          /* DWARF will emit R_VAX_32 relocations in its
                             sections against symbols defined externally
@@ -1518,8 +1427,7 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
                             with them here.  */
 
                          || ((input_section->flags & SEC_DEBUGGING) != 0
-                             && (h->elf_link_hash_flags
-                                 & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
+                             && h->def_dynamic))
                      && (r_type == R_VAX_8
                          || r_type == R_VAX_16
                          || r_type == R_VAX_32
@@ -1532,6 +1440,20 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
            relocation = 0;
        }
 
+      if (sec != NULL && elf_discarded_section (sec))
+       {
+         /* For relocs against symbols from removed linkonce sections,
+            or sections discarded by a linker script, we just want the
+            section contents zeroed.  Avoid any special processing.  */
+         _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+         rel->r_info = 0;
+         rel->r_addend = 0;
+         continue;
+       }
+
+      if (info->relocatable)
+       continue;
+
       switch (r_type)
        {
        case R_VAX_GOT32:
@@ -1555,11 +1477,11 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
            BFD_ASSERT (h != NULL);
            off = h->got.offset;
            BFD_ASSERT (off != (bfd_vma) -1);
-           BFD_ASSERT (off < sgot->_raw_size);
+           BFD_ASSERT (off < sgot->size);
 
            if (info->shared
                && h->dynindx == -1
-               && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+               && h->def_regular)
              {
                /* The symbol was forced to be local
                   because of a version file..  We must initialize
@@ -1665,9 +1587,9 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
              && ((r_type != R_VAX_PC8
                   && r_type != R_VAX_PC16
                   && r_type != R_VAX_PC32)
-                 || (!info->symbolic
-                     || (h->elf_link_hash_flags
-                         & ELF_LINK_HASH_DEF_REGULAR) == 0)))
+                 || ((input_section->flags & SEC_CODE)
+                     && (!info->symbolic
+                         || (!h->def_regular && h->type != STT_SECTION)))))
            {
              Elf_Internal_Rela outrel;
              bfd_byte *loc;
@@ -1678,22 +1600,10 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
                 time.  */
              if (sreloc == NULL)
                {
-                 const char *name;
-
-                 name = (bfd_elf_string_from_elf_section
-                         (input_bfd,
-                          elf_elfheader (input_bfd)->e_shstrndx,
-                          elf_section_data (input_section)->rel_hdr.sh_name));
-                 if (name == NULL)
+                 sreloc = _bfd_elf_get_dynamic_reloc_section
+                   (input_bfd, input_section, /*rela?*/ TRUE);
+                 if (sreloc == NULL)
                    return FALSE;
-
-                 BFD_ASSERT (strncmp (name, ".rela", 5) == 0
-                             && strcmp (bfd_get_section_name (input_bfd,
-                                                              input_section),
-                                        name + 5) == 0);
-
-                 sreloc = bfd_get_section_by_name (dynobj, name);
-                 BFD_ASSERT (sreloc != NULL);
                }
 
              skip = FALSE;
@@ -1715,8 +1625,7 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
                  become local.  */
              else if (h != NULL
                       && ((! info->symbolic && h->dynindx != -1)
-                          || (h->elf_link_hash_flags
-                              & ELF_LINK_HASH_DEF_REGULAR) == 0))
+                          || !h->def_regular))
                {
                  BFD_ASSERT (h->dynindx != -1);
                  outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
@@ -1747,9 +1656,21 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
                        {
                          asection *osec;
 
+                         /* We are turning this relocation into one
+                            against a section symbol.  It would be
+                            proper to subtract the symbol's value,
+                            osec->vma, from the emitted reloc addend,
+                            but ld.so expects buggy relocs.  */
                          osec = sec->output_section;
                          indx = elf_section_data (osec)->dynindx;
-                         BFD_ASSERT (indx > 0);
+                         if (indx == 0)
+                           {
+                             struct elf_link_hash_table *htab;
+                             htab = elf_hash_table (info);
+                             osec = htab->text_index_section;
+                             indx = elf_section_data (osec)->dynindx;
+                           }
+                         BFD_ASSERT (indx != 0);
                        }
 
                      outrel.r_info = ELF32_R_INFO (indx, r_type);
@@ -1824,7 +1745,7 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
                const char *name;
 
                if (h != NULL)
-                 name = h->root.root.string;
+                 name = NULL;
                else
                  {
                    name = bfd_elf_string_from_elf_section (input_bfd,
@@ -1836,8 +1757,9 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
                      name = bfd_section_name (input_bfd, sec);
                  }
                if (!(info->callbacks->reloc_overflow
-                     (info, name, howto->name, (bfd_vma) 0,
-                      input_bfd, input_section, rel->r_offset)))
+                     (info, (h ? &h->root : NULL), name, howto->name,
+                      (bfd_vma) 0, input_bfd, input_section,
+                      rel->r_offset)))
                  return FALSE;
              }
              break;
@@ -1852,11 +1774,9 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
    dynamic sections here.  */
 
 static bfd_boolean
-elf_vax_finish_dynamic_symbol (output_bfd, info, h, sym)
-     bfd *output_bfd;
-     struct bfd_link_info *info;
-     struct elf_link_hash_entry *h;
-     Elf_Internal_Sym *sym;
+elf_vax_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
+                              struct elf_link_hash_entry *h,
+                              Elf_Internal_Sym *sym)
 {
   bfd *dynobj;
 
@@ -1924,7 +1844,7 @@ elf_vax_finish_dynamic_symbol (output_bfd, info, h, sym)
       loc = srela->contents + plt_index * sizeof (Elf32_External_Rela);
       bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
 
-      if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+      if (!h->def_regular)
        {
          /* Mark the symbol as undefined, rather than as defined in
             the .plt section.  Leave the value alone.  */
@@ -1955,7 +1875,7 @@ elf_vax_finish_dynamic_symbol (output_bfd, info, h, sym)
         the relocate_section function.  */
       if (info->shared
          && h->dynindx == -1
-         && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+         && h->def_regular)
        {
          rela.r_info = ELF32_R_INFO (0, R_VAX_RELATIVE);
        }
@@ -1972,7 +1892,7 @@ elf_vax_finish_dynamic_symbol (output_bfd, info, h, sym)
       bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
     }
 
-  if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
+  if (h->needs_copy)
     {
       asection *s;
       Elf_Internal_Rela rela;
@@ -1998,7 +1918,7 @@ elf_vax_finish_dynamic_symbol (output_bfd, info, h, sym)
 
   /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  */
   if (strcmp (h->root.root.string, "_DYNAMIC") == 0
-      || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+      || h == elf_hash_table (info)->hgot)
     sym->st_shndx = SHN_ABS;
 
   return TRUE;
@@ -2007,9 +1927,7 @@ elf_vax_finish_dynamic_symbol (output_bfd, info, h, sym)
 /* Finish up the dynamic sections.  */
 
 static bfd_boolean
-elf_vax_finish_dynamic_sections (output_bfd, info)
-     bfd *output_bfd;
-     struct bfd_link_info *info;
+elf_vax_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
 {
   bfd *dynobj;
   asection *sgot;
@@ -2030,7 +1948,7 @@ elf_vax_finish_dynamic_sections (output_bfd, info)
       BFD_ASSERT (splt != NULL && sdyn != NULL);
 
       dyncon = (Elf32_External_Dyn *) sdyn->contents;
-      dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
+      dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size);
       for (; dyncon < dynconend; dyncon++)
        {
          Elf_Internal_Dyn dyn;
@@ -2059,10 +1977,7 @@ elf_vax_finish_dynamic_sections (output_bfd, info)
            case DT_PLTRELSZ:
              s = bfd_get_section_by_name (output_bfd, ".rela.plt");
              BFD_ASSERT (s != NULL);
-             if (s->_cooked_size != 0)
-               dyn.d_un.d_val = s->_cooked_size;
-             else
-               dyn.d_un.d_val = s->_raw_size;
+             dyn.d_un.d_val = s->size;
              bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
              break;
 
@@ -2076,19 +1991,14 @@ elf_vax_finish_dynamic_sections (output_bfd, info)
                 about changing the DT_RELA entry.  */
              s = bfd_get_section_by_name (output_bfd, ".rela.plt");
              if (s != NULL)
-               {
-                 if (s->_cooked_size != 0)
-                   dyn.d_un.d_val -= s->_cooked_size;
-                 else
-                   dyn.d_un.d_val -= s->_raw_size;
-               }
+               dyn.d_un.d_val -= s->size;
              bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
              break;
            }
        }
 
       /* Fill in the first entry in the procedure linkage table.  */
-      if (splt->_raw_size > 0)
+      if (splt->size > 0)
        {
          memcpy (splt->contents, elf_vax_plt0_entry, PLT_ENTRY_SIZE);
          bfd_put_32 (output_bfd,
@@ -2107,7 +2017,7 @@ elf_vax_finish_dynamic_sections (output_bfd, info)
     }
 
   /* Fill in the first three entries in the global offset table.  */
-  if (sgot->_raw_size > 0)
+  if (sgot->size > 0)
     {
       if (sdyn == NULL)
        bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents);
@@ -2140,6 +2050,7 @@ elf_vax_finish_dynamic_sections (output_bfd, info)
                                        elf_vax_adjust_dynamic_symbol
 #define elf_backend_size_dynamic_sections \
                                        elf_vax_size_dynamic_sections
+#define elf_backend_init_index_section _bfd_elf_init_1_index_section
 #define elf_backend_relocate_section   elf_vax_relocate_section
 #define elf_backend_finish_dynamic_symbol \
                                        elf_vax_finish_dynamic_symbol
This page took 0.039756 seconds and 4 git commands to generate.