aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog43
-rw-r--r--bfd/ecoff.c12
-rw-r--r--bfd/elf-bfd.h80
-rw-r--r--bfd/elf-m10300.c12
-rw-r--r--bfd/elf.c30
-rw-r--r--bfd/elf32-arm.h12
-rw-r--r--bfd/elf32-cris.c12
-rw-r--r--bfd/elf32-frv.c12
-rw-r--r--bfd/elf32-hppa.c12
-rw-r--r--bfd/elf32-i370.c12
-rw-r--r--bfd/elf32-i386.c12
-rw-r--r--bfd/elf32-m32r.c12
-rw-r--r--bfd/elf32-m68k.c12
-rw-r--r--bfd/elf32-ppc.c14
-rw-r--r--bfd/elf32-s390.c12
-rw-r--r--bfd/elf32-sh.c14
-rw-r--r--bfd/elf32-sparc.c12
-rw-r--r--bfd/elf32-vax.c12
-rw-r--r--bfd/elf32-xtensa.c10
-rw-r--r--bfd/elf64-alpha.c10
-rw-r--r--bfd/elf64-hppa.c10
-rw-r--r--bfd/elf64-ppc.c22
-rw-r--r--bfd/elf64-s390.c12
-rw-r--r--bfd/elf64-sh64.c12
-rw-r--r--bfd/elf64-sparc.c12
-rw-r--r--bfd/elf64-x86-64.c12
-rw-r--r--bfd/elflink.c108
-rw-r--r--bfd/elfxx-ia64.c10
-rw-r--r--bfd/elfxx-mips.c12
-rw-r--r--bfd/linker.c26
-rw-r--r--bfd/xcofflink.c2
-rw-r--r--include/ChangeLog5
-rw-r--r--include/bfdlink.h47
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/emultempl/pe.em8
-rw-r--r--ld/emultempl/sunos.em2
-rw-r--r--ld/ldexp.c2
37 files changed, 360 insertions, 305 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 82b09e9..29eee3d 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,48 @@
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".
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index eba6236..b94de12 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -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;
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 03fbd75..8a1b6da 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -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
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 5daf27f..d882eb4 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -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;
}
diff --git a/bfd/elf.c b/bfd/elf.c
index 3c34ed4..c57da59 100644
--- 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;
diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h
index 706ca59..79e089a 100644
--- a/bfd/elf32-arm.h
+++ b/bfd/elf32-arm.h
@@ -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;
}
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 7414ca7..2e8a6b3 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -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;
}
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
index bdb2760..d95fa80 100644
--- a/bfd/elf32-frv.c
+++ b/bfd/elf32-frv.c
@@ -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;
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 4cfb259..dbe6d06 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -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;
}
diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c
index 75a92f5..18d4a25 100644
--- a/bfd/elf32-i370.c
+++ b/bfd/elf32-i370.c
@@ -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;
}
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 87df2f9..5763acc 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -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;
}
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
index fc95840..ec967e2 100644
--- a/bfd/elf32-m32r.c
+++ b/bfd/elf32-m32r.c
@@ -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;
}
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index a7696cd..4f11903 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -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;
}
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index c6f01a8..50cb3a4 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -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;
}
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index f7f17fc..65c27e0 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -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;
}
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index e4f195d..4304a4e 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -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;
}
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index 48906fd..77b1086 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -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;
}
diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c
index 6cf279e..9a8f040 100644
--- a/bfd/elf32-vax.c
+++ b/bfd/elf32-vax.c
@@ -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;
}
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index 99d4f9b..0755e09 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -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;
}
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 5a8e5b1..6480612 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -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;
}
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index dbfefe9..800d66a 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -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;
}
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 3a49acb..6f30194 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -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;
}
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 1e84f30..796c4f7 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -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;
}
diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c
index 28ee26b..c2e1034 100644
--- a/bfd/elf64-sh64.c
+++ b/bfd/elf64-sh64.c
@@ -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;
}
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index 9d7469a..6a8977c 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -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;
}
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 959be55..8737f23 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -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;
}
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 9332366..8320fd8 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -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;
}
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index ed4b08e..69ec779 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -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;
}
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 5b4ae5d..64eff15 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -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;
}
diff --git a/bfd/linker.c b/bfd/linker.c
index aac7da9..8abf359 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -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))
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index ec737d1..ccb9c90 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -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
diff --git a/include/ChangeLog b/include/ChangeLog
index fa03f7c..a1d374e 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -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__.
diff --git a/include/bfdlink.h b/include/bfdlink.h
index 5adad79..5aa72d4 100644
--- a/include/bfdlink.h
+++ b/include/bfdlink.h
@@ -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;
};
diff --git a/ld/ChangeLog b/ld/ChangeLog
index a1a6823..6caf17b 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,11 @@
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".
* Makefile.in: Regenerate.
* config.in: Regenerate.
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 0991691..318eb7c 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -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);
diff --git a/ld/emultempl/sunos.em b/ld/emultempl/sunos.em
index 13850bc..070ff98 100644
--- a/ld/emultempl/sunos.em
+++ b/ld/emultempl/sunos.em
@@ -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
diff --git a/ld/ldexp.c b/ld/ldexp.c
index c19070f..217a702 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -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);
}
}