include/
authorAlan Modra <amodra@gmail.com>
Fri, 17 Sep 2004 07:14:33 +0000 (07:14 +0000)
committerAlan Modra <amodra@gmail.com>
Fri, 17 Sep 2004 07:14:33 +0000 (07:14 +0000)
* bfdlink.h (struct bfd_link_hash_entry): Move und_next into elements
of union.
bfd/
* ecoff.c: Update u.undef.next refs.
* elf64-ppc.c: Likewise.
* elflink.c: Likewise.
* linker.c: Likewise.
* xcofflink.c: Likewise.
ld/
* ldexp.c (fold_name): Update u.undef.next refs.
* emultempl/pe.em: Likewise.
* emultempl/sunos.em: Likewise.

bfd/
* elf-bfd.h (struct elf_link_hash_entry): Rearrange.  Add FIXME to
dynamic_def.  Combine weakdef and elf_hash_value.  Move vtable
fields to indirect struct.
* elf-m10300.c: Update u.weakdef refs.
* elf32-arm.h: Likewise.
* elf32-cris.c: Likewise.
* elf32-frv.c: Likewise.
* elf32-hppa.c: Likewise.
* elf32-i370.c: Likewise.
* elf32-i386.c: Likewise.
* elf32-m32r.c: Likewise.
* elf32-m68k.c: Likewise.
* elf32-ppc.c: Likewise.
* elf32-s390.c: Likewise.
* elf32-sh.c: Likewise.
* elf32-sparc.c: Likewise.
* elf32-vax.c: Likewise.
* elf32-xtensa.c: Likewise.
* elf64-alpha.c: Likewise.
* elf64-hppa.c: Likewise.
* elf64-ppc.c: Likewise.
* elf64-s390.c: Likewise.
* elf64-sh64.c: Likewise.
* elf64-sparc.c: Likewise.
* elf64-x86-64.c: Likewise.
* elfxx-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
* elflink.c: Likewise.  Also u.elf_hash_value.
(elf_gc_propagate_vtable_entries_used): Update for h->vtable
indirection.
(elf_gc_smash_unused_vtentry_relocs): Likewise.
(bfd_elf_gc_record_vtinherit): Alloc vtable.
(bfd_elf_gc_record_vtentry): Likewise.
* elf.c (_bfd_elf_link_hash_newfunc): Use memset.

37 files changed:
bfd/ChangeLog
bfd/ecoff.c
bfd/elf-bfd.h
bfd/elf-m10300.c
bfd/elf.c
bfd/elf32-arm.h
bfd/elf32-cris.c
bfd/elf32-frv.c
bfd/elf32-hppa.c
bfd/elf32-i370.c
bfd/elf32-i386.c
bfd/elf32-m32r.c
bfd/elf32-m68k.c
bfd/elf32-ppc.c
bfd/elf32-s390.c
bfd/elf32-sh.c
bfd/elf32-sparc.c
bfd/elf32-vax.c
bfd/elf32-xtensa.c
bfd/elf64-alpha.c
bfd/elf64-hppa.c
bfd/elf64-ppc.c
bfd/elf64-s390.c
bfd/elf64-sh64.c
bfd/elf64-sparc.c
bfd/elf64-x86-64.c
bfd/elflink.c
bfd/elfxx-ia64.c
bfd/elfxx-mips.c
bfd/linker.c
bfd/xcofflink.c
include/ChangeLog
include/bfdlink.h
ld/ChangeLog
ld/emultempl/pe.em
ld/emultempl/sunos.em
ld/ldexp.c

index 82b09e9dcf2750bcd427bff659689d2f8d21322c..29eee3d858028f17abfcc1e517343fa22dae0ac0 100644 (file)
@@ -1,3 +1,46 @@
+2004-09-17  Alan Modra  <amodra@bigpond.net.au>
+
+       * ecoff.c: Update u.undef.next refs.
+       * elf64-ppc.c: Likewise.
+       * elflink.c: Likewise.
+       * linker.c: Likewise.
+       * xcofflink.c: Likewise.
+
+       * elf-bfd.h (struct elf_link_hash_entry): Rearrange.  Add FIXME to
+       dynamic_def.  Combine weakdef and elf_hash_value.  Move vtable
+       fields to indirect struct.
+       * elf-m10300.c: Update u.weakdef refs.
+       * elf32-arm.h: Likewise.
+       * elf32-cris.c: Likewise.
+       * elf32-frv.c: Likewise.
+       * elf32-hppa.c: Likewise.
+       * elf32-i370.c: Likewise.
+       * elf32-i386.c: Likewise.
+       * elf32-m32r.c: Likewise.
+       * elf32-m68k.c: Likewise.
+       * elf32-ppc.c: Likewise.
+       * elf32-s390.c: Likewise.
+       * elf32-sh.c: Likewise.
+       * elf32-sparc.c: Likewise.
+       * elf32-vax.c: Likewise.
+       * elf32-xtensa.c: Likewise.
+       * elf64-alpha.c: Likewise.
+       * elf64-hppa.c: Likewise.
+       * elf64-ppc.c: Likewise.
+       * elf64-s390.c: Likewise.
+       * elf64-sh64.c: Likewise.
+       * elf64-sparc.c: Likewise.
+       * elf64-x86-64.c: Likewise.
+       * elfxx-ia64.c: Likewise.
+       * elfxx-mips.c: Likewise.
+       * elflink.c: Likewise.  Also u.elf_hash_value.
+       (elf_gc_propagate_vtable_entries_used): Update for h->vtable
+       indirection.
+       (elf_gc_smash_unused_vtentry_relocs): Likewise.
+       (bfd_elf_gc_record_vtinherit): Alloc vtable.
+       (bfd_elf_gc_record_vtentry): Likewise.
+       * elf.c (_bfd_elf_link_hash_newfunc): Use memset.
+
 2004-09-17  Alan Modra  <amodra@bigpond.net.au>
 
        * Makefile.am: Run "make dep-am".
index eba6236fd6b18b9920a9479d5266a8f92b55f178..b94de12abb7548aeeb3f79e4bb863d2a739fe761 100644 (file)
@@ -3563,9 +3563,9 @@ ecoff_link_add_archive_symbols (abfd, info)
             entry if it is the tail, because that would lose any
             entries we add to the list later on.  */
          if (*pundef != info->hash->undefs_tail)
-           *pundef = (*pundef)->und_next;
+           *pundef = (*pundef)->u.undef.next;
          else
-           pundef = &(*pundef)->und_next;
+           pundef = &(*pundef)->u.undef.next;
          continue;
        }
 
@@ -3575,7 +3575,7 @@ ecoff_link_add_archive_symbols (abfd, info)
         other object format.  */
       if (h->type != bfd_link_hash_undefined)
        {
-         pundef = &(*pundef)->und_next;
+         pundef = &(*pundef)->u.undef.next;
          continue;
        }
 
@@ -3587,7 +3587,7 @@ ecoff_link_add_archive_symbols (abfd, info)
       if (file_offset == 0)
        {
          /* Nothing in this slot.  */
-         pundef = &(*pundef)->und_next;
+         pundef = &(*pundef)->u.undef.next;
          continue;
        }
 
@@ -3618,7 +3618,7 @@ ecoff_link_add_archive_symbols (abfd, info)
 
          if (! found)
            {
-             pundef = &(*pundef)->und_next;
+             pundef = &(*pundef)->u.undef.next;
              continue;
            }
 
@@ -3640,7 +3640,7 @@ ecoff_link_add_archive_symbols (abfd, info)
       if (! ecoff_link_add_object_symbols (element, info))
        return FALSE;
 
-      pundef = &(*pundef)->und_next;
+      pundef = &(*pundef)->u.undef.next;
     }
 
   return TRUE;
index 03fbd7513052c70d24c15627b2ed9bab9700d2e0..8a1b6da01464f4d657d5028917df81676844dbbf 100644 (file)
@@ -104,40 +104,6 @@ struct elf_link_hash_entry
      not visible outside this DSO.  */
   long dynindx;
 
-  /* String table index in .dynstr if this is a dynamic symbol.  */
-  unsigned long dynstr_index;
-
-  /* Hash value of the name computed using the ELF hash function.  */
-  unsigned long elf_hash_value;
-
-  /* If this is a weak defined symbol from a dynamic object, this
-     field points to a defined symbol with the same value, if there is
-     one.  Otherwise it is NULL.  */
-  struct elf_link_hash_entry *weakdef;
-
-  /* Version information.  */
-  union
-  {
-    /* This field is used for a symbol which is not defined in a
-       regular object.  It points to the version information read in
-       from the dynamic object.  */
-    Elf_Internal_Verdef *verdef;
-    /* This field is used for a symbol which is defined in a regular
-       object.  It is set up in size_dynamic_sections.  It points to
-       the version information we should write out for this symbol.  */
-    struct bfd_elf_version_tree *vertree;
-  } verinfo;
-
-  /* Virtual table entry use information.  This array is nominally of size
-     size/sizeof(target_void_pointer), though we have to be able to assume
-     and track a size while the symbol is still undefined.  It is indexed
-     via offset/sizeof(target_void_pointer).  */
-  size_t vtable_entries_size;
-  bfd_boolean *vtable_entries_used;
-
-  /* Virtual table derivation info.  */
-  struct elf_link_hash_entry *vtable_parent;
-
   /* If this symbol requires an entry in the global offset table, the
      processor specific backend uses this field to track usage and
      final offset.  Two schemes are supported:  The first assumes that
@@ -194,13 +160,57 @@ struct elf_link_hash_entry
   /* Symbol is referenced by a non-GOT/non-PLT relocation.  This is
      not currently set by all the backends.  */
   unsigned int non_got_ref : 1;
-  /* Symbol has a definition in a shared object.  */
+  /* Symbol has a definition in a shared object.
+     FIXME: There is no real need for this field if def_dynamic is never
+     cleared and all places that test def_dynamic also test def_regular.  */
   unsigned int dynamic_def : 1;
   /* Symbol is weak in all shared objects.  */
   unsigned int dynamic_weak : 1;
   /* Symbol is referenced with a relocation where C/C++ pointer equality
      matters.  */
   unsigned int pointer_equality_needed : 1;
+
+  /* String table index in .dynstr if this is a dynamic symbol.  */
+  unsigned long dynstr_index;
+
+  union
+  {
+    /* If this is a weak defined symbol from a dynamic object, this
+       field points to a defined symbol with the same value, if there is
+       one.  Otherwise it is NULL.  */
+    struct elf_link_hash_entry *weakdef;
+
+    /* Hash value of the name computed using the ELF hash function.
+       Used part way through size_dynamic_sections, after we've finished
+       with weakdefs.  */
+    unsigned long elf_hash_value;
+  } u;
+
+  /* Version information.  */
+  union
+  {
+    /* This field is used for a symbol which is not defined in a
+       regular object.  It points to the version information read in
+       from the dynamic object.  */
+    Elf_Internal_Verdef *verdef;
+    /* This field is used for a symbol which is defined in a regular
+       object.  It is set up in size_dynamic_sections.  It points to
+       the version information we should write out for this symbol.  */
+    struct bfd_elf_version_tree *vertree;
+  } verinfo;
+
+  struct
+  {
+    /* Virtual table entry use information.  This array is nominally of size
+       size/sizeof(target_void_pointer), though we have to be able to assume
+       and track a size while the symbol is still undefined.  It is indexed
+       via offset/sizeof(target_void_pointer).  */
+    size_t size;
+    bfd_boolean *used;
+
+    /* Virtual table derivation info.  */
+    struct elf_link_hash_entry *parent;
+  } *vtable;
 };
 
 /* Will references to this symbol always reference the symbol
index 5daf27fc51a755decaf3f4b7bf9be90794fed92c..d882eb4f775f6223dadf0ac691fc7a13e543ad19 100644 (file)
@@ -4021,7 +4021,7 @@ _bfd_mn10300_elf_adjust_dynamic_symbol (info, h)
   /* Make sure we know what is going on here.  */
   BFD_ASSERT (dynobj != NULL
              && (h->needs_plt
-                 || h->weakdef != NULL
+                 || h->u.weakdef != NULL
                  || (h->def_dynamic
                      && h->ref_regular
                      && !h->def_regular)));
@@ -4096,12 +4096,12 @@ _bfd_mn10300_elf_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;
     }
 
index 3c34ed40dffc08f7f586ce679d7781b883969eae..c57da590e25e372938309f4b3885f067e1c2948a 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1391,38 +1391,14 @@ _bfd_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
       /* Set local fields.  */
       ret->indx = -1;
       ret->dynindx = -1;
-      ret->dynstr_index = 0;
-      ret->elf_hash_value = 0;
-      ret->weakdef = NULL;
-      ret->verinfo.verdef = NULL;
-      ret->vtable_entries_size = 0;
-      ret->vtable_entries_used = NULL;
-      ret->vtable_parent = NULL;
-      ret->got = htab->init_refcount;
-      ret->plt = htab->init_refcount;
-      ret->size = 0;
-      ret->type = STT_NOTYPE;
-      ret->other = 0;
+      ret->got = ret->plt = htab->init_refcount;
+      memset (&ret->size, 0, (sizeof (struct elf_link_hash_entry)
+                             - offsetof (struct elf_link_hash_entry, size)));
       /* Assume that we have been called by a non-ELF symbol reader.
          This flag is then reset by the code which reads an ELF input
          file.  This ensures that a symbol created by a non-ELF symbol
          reader will have the flag set correctly.  */
-      ret->ref_regular = 0;
-      ret->def_regular = 0;
-      ret->ref_dynamic = 0;
-      ret->def_dynamic = 0;
-      ret->ref_regular_nonweak = 0;
-      ret->dynamic_adjusted = 0;
-      ret->needs_copy = 0;
-      ret->needs_plt = 0;
       ret->non_elf = 1;
-      ret->hidden = 0;
-      ret->forced_local = 0;
-      ret->mark = 0;
-      ret->non_got_ref = 0;
-      ret->dynamic_def = 0;
-      ret->dynamic_weak = 0;
-      ret->pointer_equality_needed = 0;
     }
 
   return entry;
index 706ca59d9e2925eb9960b3c0bba204b787ec312e..79e089a76b515599c6ca467fd70ccdea82608444 100644 (file)
@@ -3187,7 +3187,7 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info,
   /* Make sure we know what is going on here.  */
   BFD_ASSERT (dynobj != NULL
              && (h->needs_plt
-                 || h->weakdef != NULL
+                 || h->u.weakdef != NULL
                  || (h->def_dynamic
                      && h->ref_regular
                      && !h->def_regular)));
@@ -3225,12 +3225,12 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info,
   /* 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;
     }
 
index 7414ca7df61e5f882be4ed04b5da23f0a70af33d..2e8a6b3874df75129ea2bd05ec771753c8878827 100644 (file)
@@ -2024,7 +2024,7 @@ elf_cris_adjust_dynamic_symbol (info, h)
   /* Make sure we know what is going on here.  */
   BFD_ASSERT (dynobj != NULL
              && (h->needs_plt
-                 || h->weakdef != NULL
+                 || h->u.weakdef != NULL
                  || (h->def_dynamic
                      && h->ref_regular
                      && !h->def_regular)));
@@ -2162,12 +2162,12 @@ elf_cris_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;
     }
 
index bdb2760bc60c46d370c69a0f6e5bfb21f1d07aaf..d95fa800c8756a1f99055a7132f1b70a12adaff1 100644 (file)
@@ -3865,7 +3865,7 @@ elf32_frvfdpic_adjust_dynamic_symbol
 
   /* Make sure we know what is going on here.  */
   BFD_ASSERT (dynobj != NULL
-             && (h->weakdef != NULL
+             && (h->u.weakdef != NULL
                  || (h->def_dynamic
                      && h->ref_regular
                      && !h->def_regular)));
@@ -3873,12 +3873,12 @@ elf32_frvfdpic_adjust_dynamic_symbol
   /* 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;
index 4cfb2599cbc89b0739ee022fbadad2e2be671937..dbe6d06553e6ee8f79864356023a8c84200656e0 100644 (file)
@@ -1671,15 +1671,15 @@ elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info,
   /* 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)
     {
-      if (h->weakdef->root.type != bfd_link_hash_defined
-         && h->weakdef->root.type != bfd_link_hash_defweak)
+      if (h->u.weakdef->root.type != bfd_link_hash_defined
+         && h->u.weakdef->root.type != bfd_link_hash_defweak)
        abort ();
-      h->root.u.def.section = h->weakdef->root.u.def.section;
-      h->root.u.def.value = h->weakdef->root.u.def.value;
+      h->root.u.def.section = h->u.weakdef->root.u.def.section;
+      h->root.u.def.value = h->u.weakdef->root.u.def.value;
       if (ELIMINATE_COPY_RELOCS)
-       h->non_got_ref = h->weakdef->non_got_ref;
+       h->non_got_ref = h->u.weakdef->non_got_ref;
       return TRUE;
     }
 
index 75a92f5e3eb986747d84474c3385d451b6ce2ed3..18d4a2558e116abbc33e3ff719ea793e28d4f5bc 100644 (file)
@@ -501,7 +501,7 @@ i370_elf_adjust_dynamic_symbol (info, h)
   /* Make sure we know what is going on here.  */
   BFD_ASSERT (dynobj != NULL
              && (h->needs_plt
-                 || h->weakdef != NULL
+                 || h->u.weakdef != NULL
                  || (h->def_dynamic
                      && h->ref_regular
                      && !h->def_regular)));
@@ -513,12 +513,12 @@ i370_elf_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;
     }
 
index 87df2f93548e695f65d17f6a1a01d795ecac5295..5763acc00e9afe005d463506fca8b64b90b28676 100644 (file)
@@ -1354,14 +1354,14 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
   /* 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;
       if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
-       h->non_got_ref = h->weakdef->non_got_ref;
+       h->non_got_ref = h->u.weakdef->non_got_ref;
       return TRUE;
     }
 
index fc95840900c140215d9f62fe5f380ab96d6c0e49..ec967e2118fe6e7ac7cb158c4ff914ccedfc6d91 100644 (file)
@@ -1955,7 +1955,7 @@ printf("m32r_elf_adjust_dynamic_symbol()\n");
   /* Make sure we know what is going on here.  */
   BFD_ASSERT (dynobj != NULL
               && (h->needs_plt
-                  || h->weakdef != NULL
+                  || h->u.weakdef != NULL
                   || (h->def_dynamic
                       && h->ref_regular
                       && !h->def_regular)));
@@ -1990,12 +1990,12 @@ printf("m32r_elf_adjust_dynamic_symbol()\n");
   /* 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;
     }
 
index a7696cd074496a5a1b6b9d7bbdea3da440627978..4f119035811e6c16808dfef71e2e1c90985b191c 100644 (file)
@@ -925,7 +925,7 @@ elf_m68k_adjust_dynamic_symbol (info, h)
   /* Make sure we know what is going on here.  */
   BFD_ASSERT (dynobj != NULL
              && (h->needs_plt
-                 || h->weakdef != NULL
+                 || h->u.weakdef != NULL
                  || (h->def_dynamic
                      && h->ref_regular
                      && !h->def_regular)));
@@ -1024,12 +1024,12 @@ elf_m68k_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;
     }
 
index c6f01a8ff172ef3d32a559c14a663cc969b99e1e..50cb3a445d0cd39e66f97a0560c9a996e39e02c2 100644 (file)
@@ -2874,7 +2874,7 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
   htab = ppc_elf_hash_table (info);
   BFD_ASSERT (htab->elf.dynobj != NULL
              && (h->needs_plt
-                 || h->weakdef != NULL
+                 || h->u.weakdef != NULL
                  || (h->def_dynamic
                      && h->ref_regular
                      && !h->def_regular)));
@@ -2911,14 +2911,14 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
   /* 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;
       if (ELIMINATE_COPY_RELOCS)
-       h->non_got_ref = h->weakdef->non_got_ref;
+       h->non_got_ref = h->u.weakdef->non_got_ref;
       return TRUE;
     }
 
index f7f17fc0a6632257636fda660427c4da987f52a1..65c27e0220f5ccee89e6be9c7e393e4d4043b9df 100644 (file)
@@ -1611,14 +1611,14 @@ elf_s390_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;
       if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
-       h->non_got_ref = h->weakdef->non_got_ref;
+       h->non_got_ref = h->u.weakdef->non_got_ref;
       return TRUE;
     }
 
index e4f195d890b8ed31478cdadbbec18bca3061784e..4304a4ec40a22aae0d20daeb16db94462db6b08a 100644 (file)
@@ -4018,7 +4018,7 @@ sh_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
   /* Make sure we know what is going on here.  */
   BFD_ASSERT (htab->root.dynobj != NULL
              && (h->needs_plt
-                 || h->weakdef != NULL
+                 || h->u.weakdef != NULL
                  || (h->def_dynamic
                      && h->ref_regular
                      && !h->def_regular)));
@@ -4051,14 +4051,14 @@ sh_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
   /* 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;
       if (info->nocopyreloc)
-       h->non_got_ref = h->weakdef->non_got_ref;
+       h->non_got_ref = h->u.weakdef->non_got_ref;
       return TRUE;
     }
 
index 48906fdc191475f0bc7b0ee5ecb1f400dc37dbeb..77b108632a3106058b047db1ab70f5e60427bcb7 100644 (file)
@@ -1456,7 +1456,7 @@ elf32_sparc_adjust_dynamic_symbol (info, h)
   /* Make sure we know what is going on here.  */
   BFD_ASSERT (htab->elf.dynobj != NULL
              && (h->needs_plt
-                 || h->weakdef != NULL
+                 || h->u.weakdef != NULL
                  || (h->def_dynamic
                      && h->ref_regular
                      && !h->def_regular)));
@@ -1499,12 +1499,12 @@ elf32_sparc_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;
     }
 
index 6cf279ec93b19d274a1358dfc2f4f8d5a135bff9..9a8f0407435347558e64c699942538c7b4382075 100644 (file)
@@ -962,7 +962,7 @@ elf_vax_adjust_dynamic_symbol (info, h)
   /* Make sure we know what is going on here.  */
   BFD_ASSERT (dynobj != NULL
              && (h->needs_plt
-                 || h->weakdef != NULL
+                 || h->u.weakdef != NULL
                  || (h->def_dynamic
                      && h->ref_regular
                      && !h->def_regular)));
@@ -1056,12 +1056,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;
     }
 
index 99d4f9b8b7576158254f8eb9dbc2faeb8f30c22d..0755e09d5963fba5797da048a62ed39ca28d7051 100644 (file)
@@ -984,12 +984,12 @@ elf_xtensa_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;
     }
 
index 5a8e5b16ac378552adc0b84d888e55de7ae0e791..648061265173a523c79583a7088b27354a356bfc 100644 (file)
@@ -3279,12 +3279,12 @@ elf64_alpha_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;
     }
 
index dbfefe99c6e7b7018ae5665068bea869f6adb4d7..800d66ad7ca57e966a20ab13d23da164268fa04b 100644 (file)
@@ -1559,12 +1559,12 @@ elf64_hppa_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;
     }
 
index 3a49acb8f3ec3e81152ff70e207dcd9727d7e49f..6f30194e6ada7792a52d21ff438ee26bd9e03778 100644 (file)
@@ -4063,22 +4063,22 @@ ppc64_elf_check_directives (bfd *abfd ATTRIBUTE_UNUSED,
          if (h->type != bfd_link_hash_undefined
              && h->type != bfd_link_hash_common)
            {
-             *pun = h->und_next;
-             h->und_next = NULL;
+             *pun = h->u.undef.next;
+             h->u.undef.next = NULL;
              if (h == htab->elf.root.undefs_tail)
                {
                  if (pun == &htab->elf.root.undefs)
                    htab->elf.root.undefs_tail = NULL;
                  else
-                   /* pun points at an und_next field.  Go back to
+                   /* pun points at an u.undef.next field.  Go back to
                       the start of the link_hash_entry.  */
                    htab->elf.root.undefs_tail = (struct bfd_link_hash_entry *)
-                     ((char *) pun - ((char *) &h->und_next - (char *) h));
+                     ((char *) pun - ((char *) &h->u.undef.next - (char *) h));
                  break;
                }
            }
          else
-           pun = &h->und_next;
+           pun = &h->u.undef.next;
        }
 
       htab->twiddled_syms = 0;
@@ -5498,14 +5498,14 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
   /* 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;
       if (ELIMINATE_COPY_RELOCS)
-       h->non_got_ref = h->weakdef->non_got_ref;
+       h->non_got_ref = h->u.weakdef->non_got_ref;
       return TRUE;
     }
 
index 1e84f30104e3ed24c7717e7607a92759e0d851fa..796c4f7c539ac514da730eb79b747292113c4247 100644 (file)
@@ -1583,14 +1583,14 @@ elf_s390_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;
       if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
-       h->non_got_ref = h->weakdef->non_got_ref;
+       h->non_got_ref = h->u.weakdef->non_got_ref;
       return TRUE;
     }
 
index 28ee26b0ddafdcc04f0ccaff0e5548bb5a846d94..c2e1034020df005014c7c745df396ec010377288 100644 (file)
@@ -3388,7 +3388,7 @@ sh64_elf64_adjust_dynamic_symbol (struct bfd_link_info *info,
   /* Make sure we know what is going on here.  */
   BFD_ASSERT (dynobj != NULL
              && (h->needs_plt
-                 || h->weakdef != NULL
+                 || h->u.weakdef != NULL
                  || (h->def_dynamic
                      && h->ref_regular
                      && !h->def_regular)));
@@ -3463,12 +3463,12 @@ sh64_elf64_adjust_dynamic_symbol (struct bfd_link_info *info,
   /* 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;
     }
 
index 9d7469ad1f0c2b0e971bc641128f4e4577c30009..6a8977c438ec5e2012ed9607d1f15395a72302b5 100644 (file)
@@ -1613,7 +1613,7 @@ sparc64_elf_adjust_dynamic_symbol (info, h)
   /* Make sure we know what is going on here.  */
   BFD_ASSERT (dynobj != NULL
              && (h->needs_plt
-                 || h->weakdef != NULL
+                 || h->u.weakdef != NULL
                  || (h->def_dynamic
                      && h->ref_regular
                      && !h->def_regular)));
@@ -1689,12 +1689,12 @@ sparc64_elf_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;
     }
 
index 959be554b0d38cb35ec52585eeecb4d4ccdd9fa1..8737f23435862f47ed22c3dea65b53353b01ecb9 100644 (file)
@@ -1154,14 +1154,14 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info,
   /* 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;
       if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
-       h->non_got_ref = h->weakdef->non_got_ref;
+       h->non_got_ref = h->u.weakdef->non_got_ref;
       return TRUE;
     }
 
index 93323664657e1cbd93cafbff4b095b500ca411de..8320fd87831e8d7cbc30c189a7611f7cac816e3c 100644 (file)
@@ -472,10 +472,10 @@ bfd_elf_record_link_assignment (bfd *output_bfd ATTRIBUTE_UNUSED,
       /* If this is a weak defined symbol, and we know a corresponding
         real symbol from the same dynamic object, make sure the real
         symbol is also made into a dynamic symbol.  */
-      if (h->weakdef != NULL
-         && h->weakdef->dynindx == -1)
+      if (h->u.weakdef != NULL
+         && h->u.weakdef->dynindx == -1)
        {
-         if (! bfd_elf_link_record_dynamic_symbol (info, h->weakdef))
+         if (! bfd_elf_link_record_dynamic_symbol (info, h->u.weakdef))
            return FALSE;
        }
     }
@@ -890,17 +890,16 @@ _bfd_elf_merge_symbol (bfd *abfd,
       if ((*sym_hash)->root.type == bfd_link_hash_indirect)
        h = *sym_hash;
 
-      if ((h->root.und_next || info->hash->undefs_tail == &h->root)
+      if ((h->root.u.undef.next || info->hash->undefs_tail == &h->root)
          && bfd_is_und_section (sec))
        {
          /* If the new symbol is undefined and the old symbol was
             also undefined before, we need to make sure
             _bfd_generic_link_add_one_symbol doesn't mess
-            up the linker hash table undefs list. Since the old
+            up the linker hash table undefs list.  Since the old
             definition came from a dynamic object, it is still on the
             undefs list.  */
          h->root.type = bfd_link_hash_undefined;
-         /* FIXME: What if the new symbol is weak undefined?  */
          h->root.u.undef.abfd = abfd;
        }
       else
@@ -2193,11 +2192,11 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
   /* If this is a weak defined symbol in a dynamic object, and we know
      the real definition in the dynamic object, copy interesting flags
      over to the real definition.  */
-  if (h->weakdef != NULL)
+  if (h->u.weakdef != NULL)
     {
       struct elf_link_hash_entry *weakdef;
 
-      weakdef = h->weakdef;
+      weakdef = h->u.weakdef;
       if (h->root.type == bfd_link_hash_indirect)
        h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
@@ -2211,7 +2210,7 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
         don't do anything special.  See the longer description in
         _bfd_elf_adjust_dynamic_symbol, below.  */
       if (weakdef->def_regular)
-       h->weakdef = NULL;
+       h->u.weakdef = NULL;
       else
        {
          const struct elf_backend_data *bed;
@@ -2268,7 +2267,7 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
       && (h->def_regular
          || !h->def_dynamic
          || (!h->ref_regular
-             && (h->weakdef == NULL || h->weakdef->dynindx == -1))))
+             && (h->u.weakdef == NULL || h->u.weakdef->dynindx == -1))))
     {
       h->plt = elf_hash_table (eif->info)->init_offset;
       return TRUE;
@@ -2313,15 +2312,15 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
      wind up at different memory locations.  The tzset call will set
      _timezone, leaving timezone unchanged.  */
 
-  if (h->weakdef != NULL)
+  if (h->u.weakdef != NULL)
     {
       /* If we get to this point, we know there is an implicit
         reference by a regular object file via the weak symbol H.
         FIXME: Is this really true?  What if the traversal finds
-        H->WEAKDEF before it finds H?  */
-      h->weakdef->ref_regular = 1;
+        H->U.WEAKDEF before it finds H?  */
+      h->u.weakdef->ref_regular = 1;
 
-      if (! _bfd_elf_adjust_dynamic_symbol (h->weakdef, eif))
+      if (! _bfd_elf_adjust_dynamic_symbol (h->u.weakdef, eif))
        return FALSE;
     }
 
@@ -3594,7 +3593,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
          && (flags & BSF_WEAK) != 0
          && ELF_ST_TYPE (isym->st_info) != STT_FUNC
          && is_elf_hash_table (hash_table)
-         && h->weakdef == NULL)
+         && h->u.weakdef == NULL)
        {
          /* Keep a list of all weak defined non function symbols from
             a dynamic object, using the weakdef field.  Later in this
@@ -3608,7 +3607,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
             dynamic object, and we will be using that previous
             definition anyhow.  */
 
-         h->weakdef = weaks;
+         h->u.weakdef = weaks;
          weaks = h;
          new_weakdef = TRUE;
        }
@@ -3773,9 +3772,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
                h->def_dynamic = 1;
              if (h->def_regular
                  || h->ref_regular
-                 || (h->weakdef != NULL
+                 || (h->u.weakdef != NULL
                      && ! new_weakdef
-                     && h->weakdef->dynindx != -1))
+                     && h->u.weakdef->dynindx != -1))
                dynsym = TRUE;
            }
 
@@ -3808,11 +3807,11 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
            {
              if (! bfd_elf_link_record_dynamic_symbol (info, h))
                goto error_free_vers;
-             if (h->weakdef != NULL
+             if (h->u.weakdef != NULL
                  && ! new_weakdef
-                 && h->weakdef->dynindx == -1)
+                 && h->u.weakdef->dynindx == -1)
                {
-                 if (! bfd_elf_link_record_dynamic_symbol (info, h->weakdef))
+                 if (! bfd_elf_link_record_dynamic_symbol (info, h->u.weakdef))
                    goto error_free_vers;
                }
            }
@@ -3977,8 +3976,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
          size_t i, j, idx;
 
          hlook = weaks;
-         weaks = hlook->weakdef;
-         hlook->weakdef = NULL;
+         weaks = hlook->u.weakdef;
+         hlook->u.weakdef = NULL;
 
          BFD_ASSERT (hlook->root.type == bfd_link_hash_defined
                      || hlook->root.type == bfd_link_hash_defweak
@@ -4029,7 +4028,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
                break;
              else if (h != hlook)
                {
-                 hlook->weakdef = h;
+                 hlook->u.weakdef = h;
 
                  /* If the weak definition is in the list of dynamic
                     symbols, make sure the real definition is put
@@ -4472,7 +4471,7 @@ elf_collect_hash_codes (struct elf_link_hash_entry *h, void *data)
 
   /* And store it in the struct so that we can put it in the hash table
      later.  */
-  h->elf_hash_value = ha;
+  h->u.elf_hash_value = ha;
 
   if (alc != NULL)
     free (alc);
@@ -6230,7 +6229,7 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
       bed->s->swap_symbol_out (finfo->output_bfd, &sym, esym, 0);
 
       bucketcount = elf_hash_table (finfo->info)->bucketcount;
-      bucket = h->elf_hash_value % bucketcount;
+      bucket = h->u.elf_hash_value % bucketcount;
       hash_entry_size
        = elf_section_data (finfo->hash_sec)->this_hdr.sh_entsize;
       bucketpos = ((bfd_byte *) finfo->hash_sec->contents
@@ -8565,26 +8564,26 @@ elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp)
     h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
   /* Those that are not vtables.  */
-  if (h->vtable_parent == NULL)
+  if (h->vtable == NULL || h->vtable->parent == NULL)
     return TRUE;
 
   /* Those vtables that do not have parents, we cannot merge.  */
-  if (h->vtable_parent == (struct elf_link_hash_entry *) -1)
+  if (h->vtable->parent == (struct elf_link_hash_entry *) -1)
     return TRUE;
 
   /* If we've already been done, exit.  */
-  if (h->vtable_entries_used && h->vtable_entries_used[-1])
+  if (h->vtable->used && h->vtable->used[-1])
     return TRUE;
 
   /* Make sure the parent's table is up to date.  */
-  elf_gc_propagate_vtable_entries_used (h->vtable_parent, okp);
+  elf_gc_propagate_vtable_entries_used (h->vtable->parent, okp);
 
-  if (h->vtable_entries_used == NULL)
+  if (h->vtable->used == NULL)
     {
       /* None of this table's entries were referenced.  Re-use the
         parent's table.  */
-      h->vtable_entries_used = h->vtable_parent->vtable_entries_used;
-      h->vtable_entries_size = h->vtable_parent->vtable_entries_size;
+      h->vtable->used = h->vtable->parent->vtable->used;
+      h->vtable->size = h->vtable->parent->vtable->size;
     }
   else
     {
@@ -8592,9 +8591,9 @@ elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp)
       bfd_boolean *cu, *pu;
 
       /* Or the parent's entries into ours.  */
-      cu = h->vtable_entries_used;
+      cu = h->vtable->used;
       cu[-1] = TRUE;
-      pu = h->vtable_parent->vtable_entries_used;
+      pu = h->vtable->parent->vtable->used;
       if (pu != NULL)
        {
          const struct elf_backend_data *bed;
@@ -8602,7 +8601,7 @@ elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp)
 
          bed = get_elf_backend_data (h->root.u.def.section->owner);
          log_file_align = bed->s->log_file_align;
-         n = h->vtable_parent->vtable_entries_size >> log_file_align;
+         n = h->vtable->parent->vtable->size >> log_file_align;
          while (n--)
            {
              if (*pu)
@@ -8630,7 +8629,7 @@ elf_gc_smash_unused_vtentry_relocs (struct elf_link_hash_entry *h, void *okp)
 
   /* Take care of both those symbols that do not describe vtables as
      well as those that are not loaded.  */
-  if (h->vtable_parent == NULL)
+  if (h->vtable == NULL || h->vtable->parent == NULL)
     return TRUE;
 
   BFD_ASSERT (h->root.type == bfd_link_hash_defined
@@ -8652,11 +8651,11 @@ elf_gc_smash_unused_vtentry_relocs (struct elf_link_hash_entry *h, void *okp)
     if (rel->r_offset >= hstart && rel->r_offset < hend)
       {
        /* If the entry is in use, do nothing.  */
-       if (h->vtable_entries_used
-           && (rel->r_offset - hstart) < h->vtable_entries_size)
+       if (h->vtable->used
+           && (rel->r_offset - hstart) < h->vtable->size)
          {
            bfd_vma entry = (rel->r_offset - hstart) >> log_file_align;
-           if (h->vtable_entries_used[entry])
+           if (h->vtable->used[entry])
              continue;
          }
        /* Otherwise, kill it.  */
@@ -8799,6 +8798,12 @@ bfd_elf_gc_record_vtinherit (bfd *abfd,
   return FALSE;
 
  win:
+  if (!child->vtable)
+    {
+      child->vtable = bfd_zalloc (abfd, sizeof (*child->vtable));
+      if (!child->vtable)
+       return FALSE;
+    }
   if (!h)
     {
       /* This *should* only be the absolute section.  It could potentially
@@ -8806,10 +8811,10 @@ bfd_elf_gc_record_vtinherit (bfd *abfd,
         would be bad.  It isn't worth paging in the local symbols to be
         sure though; that case should simply be handled by the assembler.  */
 
-      child->vtable_parent = (struct elf_link_hash_entry *) -1;
+      child->vtable->parent = (struct elf_link_hash_entry *) -1;
     }
   else
-    child->vtable_parent = h;
+    child->vtable->parent = h;
 
   return TRUE;
 }
@@ -8825,10 +8830,17 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED,
   const struct elf_backend_data *bed = get_elf_backend_data (abfd);
   unsigned int log_file_align = bed->s->log_file_align;
 
-  if (addend >= h->vtable_entries_size)
+  if (!h->vtable)
+    {
+      h->vtable = bfd_zalloc (abfd, sizeof (*h->vtable));
+      if (!h->vtable)
+       return FALSE;
+    }
+
+  if (addend >= h->vtable->size)
     {
       size_t size, bytes, file_align;
-      bfd_boolean *ptr = h->vtable_entries_used;
+      bfd_boolean *ptr = h->vtable->used;
 
       /* While the symbol is undefined, we have to be prepared to handle
         a zero size.  */
@@ -8859,7 +8871,7 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED,
            {
              size_t oldbytes;
 
-             oldbytes = (((h->vtable_entries_size >> log_file_align) + 1)
+             oldbytes = (((h->vtable->size >> log_file_align) + 1)
                          * sizeof (bfd_boolean));
              memset (((char *) ptr) + oldbytes, 0, bytes - oldbytes);
            }
@@ -8871,11 +8883,11 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED,
        return FALSE;
 
       /* And arrange for that done flag to be at index -1.  */
-      h->vtable_entries_used = ptr + 1;
-      h->vtable_entries_size = size;
+      h->vtable->used = ptr + 1;
+      h->vtable->size = size;
     }
 
-  h->vtable_entries_used[addend >> log_file_align] = TRUE;
+  h->vtable->used[addend >> log_file_align] = TRUE;
 
   return TRUE;
 }
index ed4b08efab218f4fd481c1fcf700eedff7b49d63..69ec779331c9642d156367b40e266e72aacc5eff 100644 (file)
@@ -2838,12 +2838,12 @@ elfNN_ia64_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;
     }
 
index 5b4ae5d9cb097fe566bfcf6f238794e30739e1cb..64eff153c477fb87cd632e986c0c37dcccd1b9ec 100644 (file)
@@ -5668,7 +5668,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
   /* Make sure we know what is going on here.  */
   BFD_ASSERT (dynobj != NULL
              && (h->needs_plt
-                 || h->weakdef != NULL
+                 || h->u.weakdef != NULL
                  || (h->def_dynamic
                      && h->ref_regular
                      && !h->def_regular)));
@@ -5734,12 +5734,12 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
   /* 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;
     }
 
index aac7da907633e752708f27ad77030733834406cc..8abf35967011d6cdd01b42d2d24cd6a110dacceb 100644 (file)
@@ -455,7 +455,7 @@ _bfd_link_hash_newfunc (struct bfd_hash_entry *entry,
 
       /* Initialize the local fields.  */
       h->type = bfd_link_hash_new;
-      h->und_next = NULL;
+      h->u.undef.next = NULL;
     }
 
   return entry;
@@ -616,9 +616,9 @@ void
 bfd_link_add_undef (struct bfd_link_hash_table *table,
                    struct bfd_link_hash_entry *h)
 {
-  BFD_ASSERT (h->und_next == NULL);
+  BFD_ASSERT (h->u.undef.next == NULL);
   if (table->undefs_tail != NULL)
-    table->undefs_tail->und_next = h;
+    table->undefs_tail->u.undef.next = h;
   if (table->undefs == NULL)
     table->undefs = h;
   table->undefs_tail = h;
@@ -990,9 +990,9 @@ _bfd_generic_link_add_archive_symbols
             us to lose track of whether the symbol has been
             referenced).  */
          if (*pundef != info->hash->undefs_tail)
-           *pundef = (*pundef)->und_next;
+           *pundef = (*pundef)->u.undef.next;
          else
-           pundef = &(*pundef)->und_next;
+           pundef = &(*pundef)->u.undef.next;
          continue;
        }
 
@@ -1015,7 +1015,7 @@ _bfd_generic_link_add_archive_symbols
            }
          if (arh == NULL)
            {
-             pundef = &(*pundef)->und_next;
+             pundef = &(*pundef)->u.undef.next;
              continue;
            }
        }
@@ -1064,7 +1064,7 @@ _bfd_generic_link_add_archive_symbols
            }
        }
 
-      pundef = &(*pundef)->und_next;
+      pundef = &(*pundef)->u.undef.next;
     }
 
   archive_hash_table_free (&arsym_hash);
@@ -1694,8 +1694,8 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
 
        case REF:
          /* A reference to a defined symbol.  */
-         if (h->und_next == NULL && info->hash->undefs_tail != h)
-           h->und_next = h;
+         if (h->u.undef.next == NULL && info->hash->undefs_tail != h)
+           h->u.undef.next = h;
          break;
 
        case BIG:
@@ -1881,8 +1881,8 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
 
        case REFC:
          /* A reference to an indirect symbol.  */
-         if (h->und_next == NULL && info->hash->undefs_tail != h)
-           h->und_next = h;
+         if (h->u.undef.next == NULL && info->hash->undefs_tail != h)
+           h->u.undef.next = h;
          h = h->u.i.link;
          cycle = TRUE;
          break;
@@ -1897,10 +1897,10 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
        case CWARN:
          /* Warn if this symbol has been referenced already,
             otherwise add a warning.  A symbol has been referenced if
-            the und_next field is not NULL, or it is the tail of the
+            the u.undef.next field is not NULL, or it is the tail of the
             undefined symbol list.  The REF case above helps to
             ensure this.  */
-         if (h->und_next != NULL || info->hash->undefs_tail == h)
+         if (h->u.undef.next != NULL || info->hash->undefs_tail == h)
            {
              if (! (*info->callbacks->warning) (info, string, h->root.string,
                                                 hash_entry_bfd (h), NULL, 0))
index ec737d12a4d01865bf020f84e57e7ad43dd6045d..ccb9c90558940b975899924daee201470ff7b579 100644 (file)
@@ -1825,7 +1825,7 @@ xcoff_link_add_symbols (abfd, info)
                      section = bfd_und_section_ptr;
                      value = 0;
                    }
-                 else if ((*sym_hash)->root.und_next != NULL
+                 else if ((*sym_hash)->root.u.undef.next != NULL
                           || info->hash->undefs_tail == &(*sym_hash)->root)
                    {
                      /* This symbol has been referenced.  In this
index fa03f7cd7fa982a078ae18ab5199842da4b47b03..a1d374e150c29a1e25b6804b9b70bee129466797 100644 (file)
@@ -1,3 +1,8 @@
+2004-09-17  Alan Modra  <amodra@bigpond.net.au>
+
+       * bfdlink.h (struct bfd_link_hash_entry): Move und_next into elements
+       of union.
+
 2004-09-13  Aaron W. LaFramboise  <aaronavay62@aaronwl.com>
 
        * libiberty.h (basename): Prototype for __MINGW32__.
index 5adad790e6fdb354849cf5debfd02c0ea834a667..5aa72d4b4c28d46d43b58032d55b92b7fadaaa52 100644 (file)
@@ -85,26 +85,6 @@ struct bfd_link_hash_entry
   /* Type of this entry.  */
   enum bfd_link_hash_type type;
 
-  /* Undefined and common symbols are kept in a linked list through
-     this field.  This field is not in the union because that would
-     force us to remove entries from the list when we changed their
-     type, which would force the list to be doubly linked, which would
-     waste more memory.  When an undefined or common symbol is
-     created, it should be added to this list, the head of which is in
-     the link hash table itself.  As symbols are defined, they need
-     not be removed from the list; anything which reads the list must
-     doublecheck the symbol type.
-
-     Weak symbols are not kept on this list.
-
-     Defined and defweak symbols use this field as a reference marker.
-     If the field is not NULL, or this structure is the tail of the
-     undefined symbol list, the symbol has been referenced.  If the
-     symbol is undefined and becomes defined, this field will
-     automatically be non-NULL since the symbol will have been on the
-     undefined symbol list.  */
-  struct bfd_link_hash_entry *und_next;
-
   /* A union of information depending upon the type.  */
   union
     {
@@ -112,23 +92,46 @@ struct bfd_link_hash_entry
       /* bfd_link_hash_undefined, bfd_link_hash_undefweak.  */
       struct
        {
+         /* Undefined and common symbols are kept in a linked list through
+            this field.  This field is present in all of the union element
+            so that we don't need to remove entries from the list when we
+            change their type.  Removing entries would either require the
+            list to be doubly linked, which would waste more memory, or
+            require a traversal.  When an undefined or common symbol is
+            created, it should be added to this list, the head of which is in
+            the link hash table itself.  As symbols are defined, they need
+            not be removed from the list; anything which reads the list must
+            doublecheck the symbol type.
+
+            Weak symbols are not kept on this list.
+
+            Defined and defweak symbols use this field as a reference marker.
+            If the field is not NULL, or this structure is the tail of the
+            undefined symbol list, the symbol has been referenced.  If the
+            symbol is undefined and becomes defined, this field will
+            automatically be non-NULL since the symbol will have been on the
+            undefined symbol list.  */
+         struct bfd_link_hash_entry *next;
          bfd *abfd;            /* BFD symbol was found in.  */
        } undef;
       /* bfd_link_hash_defined, bfd_link_hash_defweak.  */
       struct
        {
-         bfd_vma value;        /* Symbol value.  */
+         struct bfd_link_hash_entry *next;
          asection *section;    /* Symbol section.  */
+         bfd_vma value;        /* Symbol value.  */
        } def;
       /* bfd_link_hash_indirect, bfd_link_hash_warning.  */
       struct
        {
+         struct bfd_link_hash_entry *next;
          struct bfd_link_hash_entry *link;     /* Real symbol.  */
          const char *warning;  /* Warning (bfd_link_hash_warning only).  */
        } i;
       /* bfd_link_hash_common.  */
       struct
        {
+         struct bfd_link_hash_entry *next;
          /* The linker needs to know three things about common
             symbols: the size, the alignment, and the section in
             which the symbol should be placed.  We store the size
@@ -138,12 +141,12 @@ struct bfd_link_hash_entry
             directly because we don't want to increase the size of
             the union; this structure is a major space user in the
             linker.  */
-         bfd_size_type size;   /* Common symbol size.  */
          struct bfd_link_hash_common_entry
            {
              unsigned int alignment_power;     /* Alignment.  */
              asection *section;                /* Symbol section.  */
            } *p;
+         bfd_size_type size;   /* Common symbol size.  */
        } c;
     } u;
 };
index a1a68237698dce16c113efc050000113aa15c7b8..6caf17bd9cf185403a36e6c75b99373db910f366 100644 (file)
@@ -1,3 +1,9 @@
+2004-09-17  Alan Modra  <amodra@bigpond.net.au>
+
+       * ldexp.c (fold_name): Update u.undef.next refs.
+       * emultempl/pe.em: Likewise.
+       * emultempl/sunos.em: Likewise.
+
 2004-09-17  Alan Modra  <amodra@bigpond.net.au>
 
        * Makefile.am: Run "make dep-am".
index 09916911015fda3026a853c932792af1ba551511..318eb7c2bf906504ef68dba0187cec8838bed2dc 100644 (file)
@@ -773,7 +773,7 @@ pe_fixup_stdcalls (void)
   if (pe_dll_extra_pe_debug)
     printf ("%s\n", __FUNCTION__);
 
-  for (undef = link_info.hash->undefs; undef; undef=undef->und_next)
+  for (undef = link_info.hash->undefs; undef; undef=undef->u.undef.next)
     if (undef->type == bfd_link_hash_undefined)
       {
        char* at = strchr (undef->root.string, '@');
@@ -865,7 +865,7 @@ pe_find_data_imports (void)
   if (link_info.pei386_auto_import == 0)
     return;
 
-  for (undef = link_info.hash->undefs; undef; undef=undef->und_next)
+  for (undef = link_info.hash->undefs; undef; undef=undef->u.undef.next)
     {
       if (undef->type == bfd_link_hash_undefined)
         {
@@ -945,7 +945,7 @@ gld_${EMULATION_NAME}_after_open (void)
 
       printf ("%s()\n", __FUNCTION__);
 
-      for (sym = link_info.hash->undefs; sym; sym=sym->und_next)
+      for (sym = link_info.hash->undefs; sym; sym=sym->u.undef.next)
         printf ("-%s\n", sym->root.string);
       bfd_hash_traverse (&link_info.hash->table, pr_sym, NULL);
 
@@ -1066,7 +1066,7 @@ gld_${EMULATION_NAME}_after_open (void)
 
                    relocs = (arelent **) xmalloc ((size_t) relsize);
                    nrelocs = bfd_canonicalize_reloc (is->the_bfd, sec,
-                                                         relocs, symbols);
+                                                     relocs, symbols);
                    if (nrelocs < 0)
                      {
                        free (relocs);
index 13850bc58bf2b8fdf677838e38ea58b64025fd7d..070ff9814713be770d62b010bb265c240956e99a 100644 (file)
@@ -671,7 +671,7 @@ gld${EMULATION_NAME}_before_allocation (void)
     {
       struct bfd_link_hash_entry *h;
 
-      for (h = link_info.hash->undefs; h != NULL; h = h->und_next)
+      for (h = link_info.hash->undefs; h != NULL; h = h->u.undef.next)
        {
          if (h->type == bfd_link_hash_undefined
              && h->u.undef.abfd != NULL
index c19070f41dc1fa9b5b5772744eba9f9b72046001..217a702edf21183dbf50eaa483deab35e94144ba 100644 (file)
@@ -577,7 +577,7 @@ fold_name (etree_type *tree,
            {
              h->type = bfd_link_hash_undefined;
              h->u.undef.abfd = NULL;
-             if (h->und_next == NULL)
+             if (h->u.undef.next == NULL)
                bfd_link_add_undef (link_info.hash, h);
            }
        }
This page took 0.085672 seconds and 4 git commands to generate.