Rename u.weakdef and make it a circular list

This makes the elf_link_hash_entry weakdef field, currently used to
point from a weak symbol to a strong alias, a circular list so that
all aliases can be found from any of them.  A new flag, is_weakalias,
distinguishes the weak symbol from a strong alias, and is used in all
places where we currently test u.weakdef != NULL.

With the original u.weakdef handling it was possible to have two or
more weak symbols pointing via u.weakdef to a strong definition.
Obviously that situation can't map to a circular list; One or more of
the weak symbols must point at another weak alias rather than the
strong definition.  To handle that, I've added an accessor function to
return the strong definition.

	* elf-bfd.h (struct elf_link_hash_entry): Add is_weakalias.
	Rename u.weakdef to u.alias and update comment.
	(weakdef): New static inline function.
	* elflink.c (bfd_elf_record_link_assignment) Test is_weakalias
	rather than u.weakdef != NULL, and use weakdef function.
	(_bfd_elf_adjust_dynamic_symbol): Likewise.
	(_bfd_elf_fix_symbol_flags): Likewise.  Clear is_weakalias on
	all aliases if def has been overridden in a regular object, not
	u.weakdef.
	(elf_link_add_object_symbols): Delete new_weakdef flag.  Test
	is_weakalias and use weakdef.  Set is_weakalias and circular
	u.alias.  Update comments.
	(_bfd_elf_gc_mark_rsec): Test is_weakalias rather than
	u.weakdef != NULL and use weakdef function.
	* elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Test
	is_weakalias rather than u.weakdef != NULL and use weakdef
	function.  Assert that def is strong defined.
	* elf32-arc.c (elf_arc_adjust_dynamic_symbol): Likewise.
	* elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Likewise.
	* elf32-bfin.c (elf32_bfinfdpic_adjust_dynamic_symbol): Likewise.
	(bfin_adjust_dynamic_symbol): Likewise.
	* elf32-cr16.c (_bfd_cr16_elf_adjust_dynamic_symbol): Likewise.
	* elf32-cris.c (elf_cris_adjust_dynamic_symbol): Likewise.
	* elf32-frv.c (elf32_frvfdpic_adjust_dynamic_symbol): Likewise.
	* elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise.
	* elf32-i370.c (i370_elf_adjust_dynamic_symbol): Likewise.
	* elf32-lm32.c (lm32_elf_adjust_dynamic_symbol): Likewise.
	* elf32-m32r.c (m32r_elf_adjust_dynamic_symbol): Likewise.
	* elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise.
	* elf32-metag.c (elf_metag_adjust_dynamic_symbol): Likewise.
	* elf32-microblaze.c (microblaze_elf_adjust_dynamic_symbol): Likewise.
	* elf32-nds32.c (nds32_elf_adjust_dynamic_symbol): Likewise.
	* elf32-nios2.c (nios2_elf32_adjust_dynamic_symbol): Likewise.
	* elf32-or1k.c (or1k_elf_adjust_dynamic_symbol): Likewise.
	* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise.
	* elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
	* elf32-score.c (s3_bfd_score_elf_adjust_dynamic_symbol): Likewise.
	* elf32-score7.c (s7_bfd_score_elf_adjust_dynamic_symbol): Likewise.
	* elf32-sh.c (sh_elf_adjust_dynamic_symbol): Likewise.
	* elf32-tic6x.c (elf32_tic6x_adjust_dynamic_symbol): Likewise.
	* elf32-tilepro.c (tilepro_elf_gc_mark_hook): Likewise.
	(tilepro_elf_adjust_dynamic_symbol): Likewise.
	* elf32-vax.c (elf_vax_adjust_dynamic_symbol): Likewise.
	* elf32-xtensa.c (elf_xtensa_adjust_dynamic_symbol): Likewise.
	* elf64-alpha.c (elf64_alpha_adjust_dynamic_symbol): Likewise.
	* elf64-hppa.c (elf64_hppa_adjust_dynamic_symbol): Likewise.
	* elf64-ia64-vms.c (elf64_ia64_adjust_dynamic_symbol): Likewise.
	* elf64-ppc.c (ppc64_elf_gc_mark_hook): Likewise.
	(ppc64_elf_adjust_dynamic_symbol): Likewise.
	* elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
	* elf64-sh64.c (sh64_elf64_adjust_dynamic_symbol): Likewise.
	* elfnn-aarch64.c (elfNN_aarch64_adjust_dynamic_symbol): Likewise.
	* elfnn-ia64.c (elfNN_ia64_adjust_dynamic_symbol): Likewise.
	* elfnn-riscv.c (riscv_elf_adjust_dynamic_symbol): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Likewise.
	* elfxx-sparc.c (_bfd_sparc_elf_gc_mark_hook): Likewise.
	(_bfd_sparc_elf_adjust_dynamic_symbol): Likewise.
	* elfxx-tilegx.c (tilegx_elf_gc_mark_hook): Likewise.
	(tilegx_elf_adjust_dynamic_symbol): Likewise.
	* elfxx-x86.c (_bfd_x86_elf_adjust_dynamic_symbol): Likewise.
This commit is contained in:
Alan Modra 2017-11-22 17:30:55 +10:30
parent 9d9c67b06c
commit 60d67dc84b
42 changed files with 377 additions and 294 deletions

View File

@ -1,3 +1,66 @@
2017-11-23 Alan Modra <amodra@gmail.com>
* elf-bfd.h (struct elf_link_hash_entry): Add is_weakalias.
Rename u.weakdef to u.alias and update comment.
(weakdef): New static inline function.
* elflink.c (bfd_elf_record_link_assignment) Test is_weakalias
rather than u.weakdef != NULL, and use weakdef function.
(_bfd_elf_adjust_dynamic_symbol): Likewise.
(_bfd_elf_fix_symbol_flags): Likewise. Clear is_weakalias on
all aliases if def has been overridden in a regular object, not
u.weakdef.
(elf_link_add_object_symbols): Delete new_weakdef flag. Test
is_weakalias and use weakdef. Set is_weakalias and circular
u.alias. Update comments.
(_bfd_elf_gc_mark_rsec): Test is_weakalias rather than
u.weakdef != NULL and use weakdef function.
* elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Test
is_weakalias rather than u.weakdef != NULL and use weakdef
function. Assert that def is strong defined.
* elf32-arc.c (elf_arc_adjust_dynamic_symbol): Likewise.
* elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Likewise.
* elf32-bfin.c (elf32_bfinfdpic_adjust_dynamic_symbol): Likewise.
(bfin_adjust_dynamic_symbol): Likewise.
* elf32-cr16.c (_bfd_cr16_elf_adjust_dynamic_symbol): Likewise.
* elf32-cris.c (elf_cris_adjust_dynamic_symbol): Likewise.
* elf32-frv.c (elf32_frvfdpic_adjust_dynamic_symbol): Likewise.
* elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise.
* elf32-i370.c (i370_elf_adjust_dynamic_symbol): Likewise.
* elf32-lm32.c (lm32_elf_adjust_dynamic_symbol): Likewise.
* elf32-m32r.c (m32r_elf_adjust_dynamic_symbol): Likewise.
* elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise.
* elf32-metag.c (elf_metag_adjust_dynamic_symbol): Likewise.
* elf32-microblaze.c (microblaze_elf_adjust_dynamic_symbol): Likewise.
* elf32-nds32.c (nds32_elf_adjust_dynamic_symbol): Likewise.
* elf32-nios2.c (nios2_elf32_adjust_dynamic_symbol): Likewise.
* elf32-or1k.c (or1k_elf_adjust_dynamic_symbol): Likewise.
* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise.
* elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
* elf32-score.c (s3_bfd_score_elf_adjust_dynamic_symbol): Likewise.
* elf32-score7.c (s7_bfd_score_elf_adjust_dynamic_symbol): Likewise.
* elf32-sh.c (sh_elf_adjust_dynamic_symbol): Likewise.
* elf32-tic6x.c (elf32_tic6x_adjust_dynamic_symbol): Likewise.
* elf32-tilepro.c (tilepro_elf_gc_mark_hook): Likewise.
(tilepro_elf_adjust_dynamic_symbol): Likewise.
* elf32-vax.c (elf_vax_adjust_dynamic_symbol): Likewise.
* elf32-xtensa.c (elf_xtensa_adjust_dynamic_symbol): Likewise.
* elf64-alpha.c (elf64_alpha_adjust_dynamic_symbol): Likewise.
* elf64-hppa.c (elf64_hppa_adjust_dynamic_symbol): Likewise.
* elf64-ia64-vms.c (elf64_ia64_adjust_dynamic_symbol): Likewise.
* elf64-ppc.c (ppc64_elf_gc_mark_hook): Likewise.
(ppc64_elf_adjust_dynamic_symbol): Likewise.
* elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
* elf64-sh64.c (sh64_elf64_adjust_dynamic_symbol): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_adjust_dynamic_symbol): Likewise.
* elfnn-ia64.c (elfNN_ia64_adjust_dynamic_symbol): Likewise.
* elfnn-riscv.c (riscv_elf_adjust_dynamic_symbol): Likewise.
* elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_gc_mark_hook): Likewise.
(_bfd_sparc_elf_adjust_dynamic_symbol): Likewise.
* elfxx-tilegx.c (tilegx_elf_gc_mark_hook): Likewise.
(tilegx_elf_adjust_dynamic_symbol): Likewise.
* elfxx-x86.c (_bfd_x86_elf_adjust_dynamic_symbol): Likewise.
2017-11-21 Alan Modra <amodra@gmail.com> 2017-11-21 Alan Modra <amodra@gmail.com>
* elf-bfd.h (elf_symbol_from): Check for NULL symbol bfd. * elf-bfd.h (elf_symbol_from): Check for NULL symbol bfd.

View File

@ -216,20 +216,22 @@ struct elf_link_hash_entry
/* Symbol is __start_SECNAME or __stop_SECNAME to mark section /* Symbol is __start_SECNAME or __stop_SECNAME to mark section
SECNAME. */ SECNAME. */
unsigned int start_stop : 1; unsigned int start_stop : 1;
/* Symbol is or was a weak defined symbol from a dynamic object with
a strong defined symbol alias. U.ALIAS points to a list of aliases,
the definition having is_weakalias clear. */
unsigned int is_weakalias : 1;
/* String table index in .dynstr if this is a dynamic symbol. */ /* String table index in .dynstr if this is a dynamic symbol. */
unsigned long dynstr_index; unsigned long dynstr_index;
union union
{ {
/* If this is a weak defined symbol from a dynamic object, this /* Points to a circular list of non-function symbol aliases. */
field points to a defined symbol with the same value, if there is struct elf_link_hash_entry *alias;
one. Otherwise it is NULL. */
struct elf_link_hash_entry *weakdef;
/* Hash value of the name computed using the ELF hash function. /* Hash value of the name computed using the ELF hash function.
Used part way through size_dynamic_sections, after we've finished Used part way through size_dynamic_sections, after we've finished
with weakdefs. */ with aliases. */
unsigned long elf_hash_value; unsigned long elf_hash_value;
} u; } u;
@ -257,6 +259,16 @@ struct elf_link_hash_entry
} u2; } u2;
}; };
/* Return the strong definition for a weak symbol with aliases. */
static inline struct elf_link_hash_entry *
weakdef (struct elf_link_hash_entry *h)
{
while (h->is_weakalias)
h = h->u.alias;
return h;
}
/* Will references to this symbol always reference the symbol /* Will references to this symbol always reference the symbol
in this object? */ in this object? */
#define SYMBOL_REFERENCES_LOCAL(INFO, H) \ #define SYMBOL_REFERENCES_LOCAL(INFO, H) \

View File

@ -4889,7 +4889,7 @@ _bfd_mn10300_elf_adjust_dynamic_symbol (struct bfd_link_info * info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -4962,12 +4962,12 @@ _bfd_mn10300_elf_adjust_dynamic_symbol (struct bfd_link_info * info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -2291,12 +2291,12 @@ elf_arc_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -15120,7 +15120,7 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info,
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->type == STT_GNU_IFUNC || h->type == STT_GNU_IFUNC
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -15170,12 +15170,12 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -4327,7 +4327,7 @@ elf32_bfinfdpic_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->u.weakdef != NULL && (h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -4335,12 +4335,12 @@ elf32_bfinfdpic_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
} }
return TRUE; return TRUE;
@ -4984,7 +4984,7 @@ bfin_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic && h->ref_regular && !h->def_regular))); || (h->def_dynamic && h->ref_regular && !h->def_regular)));
/* If this is a function, put it in the procedure linkage table. We /* If this is a function, put it in the procedure linkage table. We
@ -4998,12 +4998,12 @@ bfin_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -2308,7 +2308,7 @@ _bfd_cr16_elf_adjust_dynamic_symbol (struct bfd_link_info * info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -2358,12 +2358,12 @@ _bfd_cr16_elf_adjust_dynamic_symbol (struct bfd_link_info * info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -2671,7 +2671,7 @@ elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -2813,12 +2813,12 @@ elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -5824,7 +5824,7 @@ elf32_frvfdpic_adjust_dynamic_symbol
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->u.weakdef != NULL && (h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -5832,12 +5832,13 @@ elf32_frvfdpic_adjust_dynamic_symbol
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE;
} }
return TRUE; return TRUE;

View File

@ -1741,15 +1741,14 @@ elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (eh->u.weakdef != NULL) if (eh->is_weakalias)
{ {
if (eh->u.weakdef->root.type != bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (eh);
&& eh->u.weakdef->root.type != bfd_link_hash_defweak) BFD_ASSERT (def->root.type == bfd_link_hash_defined);
abort (); eh->root.u.def.section = def->root.u.def.section;
eh->root.u.def.section = eh->u.weakdef->root.u.def.section; eh->root.u.def.value = def->root.u.def.value;
eh->root.u.def.value = eh->u.weakdef->root.u.def.value;
if (ELIMINATE_COPY_RELOCS) if (ELIMINATE_COPY_RELOCS)
eh->non_got_ref = eh->u.weakdef->non_got_ref; eh->non_got_ref = def->non_got_ref;
return TRUE; return TRUE;
} }

View File

@ -478,7 +478,7 @@ i370_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -490,12 +490,12 @@ i370_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -1668,7 +1668,7 @@ lm32_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -1702,12 +1702,12 @@ lm32_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -1782,7 +1782,7 @@ m32r_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -1816,12 +1816,12 @@ m32r_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -2891,7 +2891,7 @@ elf_m68k_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -2976,12 +2976,12 @@ elf_m68k_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -2499,14 +2499,13 @@ elf_metag_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (eh->u.weakdef != NULL) if (eh->is_weakalias)
{ {
if (eh->u.weakdef->root.type != bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (eh);
&& eh->u.weakdef->root.type != bfd_link_hash_defweak) BFD_ASSERT (def->root.type == bfd_link_hash_defined);
abort (); eh->root.u.def.section = def->root.u.def.section;
eh->root.u.def.section = eh->u.weakdef->root.u.def.section; eh->root.u.def.value = def->root.u.def.value;
eh->root.u.def.value = eh->u.weakdef->root.u.def.value; eh->non_got_ref = def->non_got_ref;
eh->non_got_ref = eh->u.weakdef->non_got_ref;
return TRUE; return TRUE;
} }

View File

@ -2606,12 +2606,12 @@ microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -3584,7 +3584,7 @@ nds32_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic && h->ref_regular && !h->def_regular))); || (h->def_dynamic && h->ref_regular && !h->def_regular)));
@ -3616,12 +3616,12 @@ nds32_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -5332,7 +5332,7 @@ nios2_elf32_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -5366,12 +5366,12 @@ nios2_elf32_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -1946,7 +1946,7 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -1980,12 +1980,12 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -5464,7 +5464,7 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
BFD_ASSERT (htab->elf.dynobj != NULL BFD_ASSERT (htab->elf.dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->type == STT_GNU_IFUNC || h->type == STT_GNU_IFUNC
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -5499,8 +5499,8 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
Note that function symbols are not supposed to have weakdefs, Note that function symbols are not supposed to have weakdefs,
but since symbols may not be correctly typed we handle them but since symbols may not be correctly typed we handle them
here. */ here. */
h->non_got_ref = (h->u.weakdef != NULL h->non_got_ref = (h->is_weakalias
? h->u.weakdef->non_got_ref ? weakdef (h)->non_got_ref
: !local && (((struct ppc_elf_link_hash_entry *) h) : !local && (((struct ppc_elf_link_hash_entry *) h)
->dyn_relocs != NULL)); ->dyn_relocs != NULL));
@ -5567,14 +5567,14 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
if (ELIMINATE_COPY_RELOCS) if (ELIMINATE_COPY_RELOCS)
h->non_got_ref = h->u.weakdef->non_got_ref; h->non_got_ref = def->non_got_ref;
return TRUE; return TRUE;
} }

View File

@ -1514,14 +1514,14 @@ elf_s390_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
if (ELIMINATE_COPY_RELOCS || info->nocopyreloc) if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
h->non_got_ref = h->u.weakdef->non_got_ref; h->non_got_ref = def->non_got_ref;
return TRUE; return TRUE;
} }

View File

@ -3098,7 +3098,7 @@ s3_bfd_score_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic && h->ref_regular && !h->def_regular))); || (h->def_dynamic && h->ref_regular && !h->def_regular)));
/* If this symbol is defined in a dynamic object, we need to copy /* If this symbol is defined in a dynamic object, we need to copy
@ -3157,12 +3157,12 @@ s3_bfd_score_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -2904,7 +2904,7 @@ s7_bfd_score_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic && h->ref_regular && !h->def_regular))); || (h->def_dynamic && h->ref_regular && !h->def_regular)));
/* If this symbol is defined in a dynamic object, we need to copy /* If this symbol is defined in a dynamic object, we need to copy
@ -2963,12 +2963,12 @@ s7_bfd_score_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -2817,7 +2817,7 @@ sh_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (htab->root.dynobj != NULL BFD_ASSERT (htab->root.dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -2850,14 +2850,14 @@ sh_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
if (info->nocopyreloc) if (info->nocopyreloc)
h->non_got_ref = h->u.weakdef->non_got_ref; h->non_got_ref = def->non_got_ref;
return TRUE; return TRUE;
} }

View File

@ -1990,7 +1990,7 @@ elf32_tic6x_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic && h->ref_regular && !h->def_regular))); || (h->def_dynamic && h->ref_regular && !h->def_regular)));
/* If this is a function, put it in the procedure linkage table. We /* If this is a function, put it in the procedure linkage table. We
@ -2019,13 +2019,13 @@ elf32_tic6x_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
h->non_got_ref = h->u.weakdef->non_got_ref; h->non_got_ref = def->non_got_ref;
return TRUE; return TRUE;
} }

View File

@ -1884,8 +1884,8 @@ tilepro_elf_gc_mark_hook (asection *sec,
h = (struct elf_link_hash_entry *) bh; h = (struct elf_link_hash_entry *) bh;
BFD_ASSERT (h != NULL); BFD_ASSERT (h != NULL);
h->mark = 1; h->mark = 1;
if (h->u.weakdef != NULL) if (h->is_weakalias)
h->u.weakdef->mark = 1; weakdef (h)->mark = 1;
sym = NULL; sym = NULL;
} }
} }
@ -1914,7 +1914,7 @@ tilepro_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (htab->elf.dynobj != NULL BFD_ASSERT (htab->elf.dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -1947,12 +1947,12 @@ tilepro_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -839,7 +839,7 @@ elf_vax_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -915,12 +915,12 @@ elf_vax_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -1387,12 +1387,12 @@ elf_xtensa_adjust_dynamic_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -2082,12 +2082,12 @@ elf64_alpha_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -1474,12 +1474,12 @@ elf64_hppa_adjust_dynamic_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (eh->u.weakdef != NULL) if (eh->is_weakalias)
{ {
BFD_ASSERT (eh->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (eh);
|| eh->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
eh->root.u.def.section = eh->u.weakdef->root.u.def.section; eh->root.u.def.section = def->root.u.def.section;
eh->root.u.def.value = eh->u.weakdef->root.u.def.value; eh->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -2575,12 +2575,12 @@ elf64_ia64_adjust_dynamic_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -6576,8 +6576,8 @@ ppc64_elf_gc_mark_hook (asection *sec,
a call reloc. Mark the function descriptor too a call reloc. Mark the function descriptor too
against garbage collection. */ against garbage collection. */
fdh->elf.mark = 1; fdh->elf.mark = 1;
if (fdh->elf.u.weakdef != NULL) if (fdh->elf.is_weakalias)
fdh->elf.u.weakdef->mark = 1; weakdef (&fdh->elf)->mark = 1;
eh = fdh; eh = fdh;
} }
@ -7251,14 +7251,14 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
if (ELIMINATE_COPY_RELOCS) if (ELIMINATE_COPY_RELOCS)
h->non_got_ref = h->u.weakdef->non_got_ref; h->non_got_ref = def->non_got_ref;
return TRUE; return TRUE;
} }

View File

@ -1446,14 +1446,14 @@ elf_s390_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
if (ELIMINATE_COPY_RELOCS || info->nocopyreloc) if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
h->non_got_ref = h->u.weakdef->non_got_ref; h->non_got_ref = def->non_got_ref;
return TRUE; return TRUE;
} }

View File

@ -3192,7 +3192,7 @@ sh64_elf64_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -3267,12 +3267,12 @@ sh64_elf64_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -723,10 +723,12 @@ bfd_elf_record_link_assignment (bfd *output_bfd,
/* If this is a weak defined symbol, and we know a corresponding /* If this is a weak defined symbol, and we know a corresponding
real symbol from the same dynamic object, make sure the real real symbol from the same dynamic object, make sure the real
symbol is also made into a dynamic symbol. */ symbol is also made into a dynamic symbol. */
if (h->u.weakdef != NULL if (h->is_weakalias)
&& h->u.weakdef->dynindx == -1)
{ {
if (! bfd_elf_link_record_dynamic_symbol (info, h->u.weakdef)) struct elf_link_hash_entry *def = weakdef (h);
if (def->dynindx == -1
&& !bfd_elf_link_record_dynamic_symbol (info, def))
return FALSE; return FALSE;
} }
} }
@ -2782,26 +2784,28 @@ _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 /* If this is a weak defined symbol in a dynamic object, and we know
the real definition in the dynamic object, copy interesting flags the real definition in the dynamic object, copy interesting flags
over to the real definition. */ over to the real definition. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
struct elf_link_hash_entry *def = weakdef (h);
/* If the real definition is defined by a regular object file, /* If the real definition is defined by a regular object file,
don't do anything special. See the longer description in don't do anything special. See the longer description in
_bfd_elf_adjust_dynamic_symbol, below. */ _bfd_elf_adjust_dynamic_symbol, below. */
if (h->u.weakdef->def_regular) if (def->def_regular)
h->u.weakdef = NULL; {
h = def;
while ((h = h->u.alias) != def)
h->is_weakalias = 0;
}
else else
{ {
struct elf_link_hash_entry *weakdef = h->u.weakdef;
while (h->root.type == bfd_link_hash_indirect) while (h->root.type == bfd_link_hash_indirect)
h = (struct elf_link_hash_entry *) h->root.u.i.link; h = (struct elf_link_hash_entry *) h->root.u.i.link;
BFD_ASSERT (h->root.type == bfd_link_hash_defined BFD_ASSERT (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak); || h->root.type == bfd_link_hash_defweak);
BFD_ASSERT (weakdef->def_dynamic); BFD_ASSERT (def->def_dynamic);
BFD_ASSERT (weakdef->root.type == bfd_link_hash_defined BFD_ASSERT (def->root.type == bfd_link_hash_defined);
|| weakdef->root.type == bfd_link_hash_defweak); (*bed->elf_backend_copy_indirect_symbol) (eif->info, def, h);
(*bed->elf_backend_copy_indirect_symbol) (eif->info, weakdef, h);
} }
} }
@ -2863,7 +2867,7 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
&& (h->def_regular && (h->def_regular
|| !h->def_dynamic || !h->def_dynamic
|| (!h->ref_regular || (!h->ref_regular
&& (h->u.weakdef == NULL || h->u.weakdef->dynindx == -1)))) && (!h->is_weakalias || weakdef (h)->dynindx == -1))))
{ {
h->plt = elf_hash_table (eif->info)->init_plt_offset; h->plt = elf_hash_table (eif->info)->init_plt_offset;
return TRUE; return TRUE;
@ -2908,15 +2912,17 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
wind up at different memory locations. The tzset call will set wind up at different memory locations. The tzset call will set
_timezone, leaving timezone unchanged. */ _timezone, leaving timezone unchanged. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
struct elf_link_hash_entry *def = weakdef (h);
/* If we get to this point, there is an implicit reference to /* If we get to this point, there is an implicit reference to
H->U.WEAKDEF by a regular object file via the weak symbol H. */ the alias by a regular object file via the weak symbol H. */
h->u.weakdef->ref_regular = 1; def->ref_regular = 1;
/* Ensure that the backend adjust_dynamic_symbol function sees /* Ensure that the backend adjust_dynamic_symbol function sees
H->U.WEAKDEF before H by recursively calling ourselves. */ the strong alias before H by recursively calling ourselves. */
if (! _bfd_elf_adjust_dynamic_symbol (h->u.weakdef, eif)) if (!_bfd_elf_adjust_dynamic_symbol (def, eif))
return FALSE; return FALSE;
} }
@ -4256,7 +4262,6 @@ error_free_dyn:
bfd_boolean definition; bfd_boolean definition;
bfd_boolean size_change_ok; bfd_boolean size_change_ok;
bfd_boolean type_change_ok; bfd_boolean type_change_ok;
bfd_boolean new_weakdef;
bfd_boolean new_weak; bfd_boolean new_weak;
bfd_boolean old_weak; bfd_boolean old_weak;
bfd_boolean override; bfd_boolean override;
@ -4588,29 +4593,27 @@ error_free_dyn:
*sym_hash = h; *sym_hash = h;
new_weak = (flags & BSF_WEAK) != 0; new_weak = (flags & BSF_WEAK) != 0;
new_weakdef = FALSE;
if (dynamic if (dynamic
&& definition && definition
&& new_weak && new_weak
&& !bed->is_function_type (ELF_ST_TYPE (isym->st_info)) && !bed->is_function_type (ELF_ST_TYPE (isym->st_info))
&& is_elf_hash_table (htab) && is_elf_hash_table (htab)
&& h->u.weakdef == NULL) && h->u.alias == NULL)
{ {
/* Keep a list of all weak defined non function symbols from /* Keep a list of all weak defined non function symbols from
a dynamic object, using the weakdef field. Later in this a dynamic object, using the alias field. Later in this
function we will set the weakdef field to the correct function we will set the alias field to the correct
value. We only put non-function symbols from dynamic value. We only put non-function symbols from dynamic
objects on this list, because that happens to be the only objects on this list, because that happens to be the only
time we need to know the normal symbol corresponding to a time we need to know the normal symbol corresponding to a
weak symbol, and the information is time consuming to weak symbol, and the information is time consuming to
figure out. If the weakdef field is not already NULL, figure out. If the alias field is not already NULL,
then this symbol was already defined by some previous then this symbol was already defined by some previous
dynamic object, and we will be using that previous dynamic object, and we will be using that previous
definition anyhow. */ definition anyhow. */
h->u.weakdef = weaks; h->u.alias = weaks;
weaks = h; weaks = h;
new_weakdef = TRUE;
} }
/* Set the alignment of a common symbol. */ /* Set the alignment of a common symbol. */
@ -4689,9 +4692,8 @@ error_free_dyn:
if ((h == hi || !hi->forced_local) if ((h == hi || !hi->forced_local)
&& (h->def_regular && (h->def_regular
|| h->ref_regular || h->ref_regular
|| (h->u.weakdef != NULL || (h->is_weakalias
&& ! new_weakdef && weakdef (h)->dynindx != -1)))
&& h->u.weakdef->dynindx != -1)))
dynsym = TRUE; dynsym = TRUE;
} }
@ -4860,11 +4862,10 @@ error_free_dyn:
{ {
if (! bfd_elf_link_record_dynamic_symbol (info, h)) if (! bfd_elf_link_record_dynamic_symbol (info, h))
goto error_free_vers; goto error_free_vers;
if (h->u.weakdef != NULL if (h->is_weakalias
&& ! new_weakdef && weakdef (h)->dynindx == -1)
&& h->u.weakdef->dynindx == -1)
{ {
if (!bfd_elf_link_record_dynamic_symbol (info, h->u.weakdef)) if (!bfd_elf_link_record_dynamic_symbol (info, weakdef (h)))
goto error_free_vers; goto error_free_vers;
} }
} }
@ -5084,7 +5085,7 @@ error_free_dyn:
nondeflt_vers = NULL; nondeflt_vers = NULL;
} }
/* Now set the weakdefs field correctly for all the weak defined /* Now set the alias field correctly for all the weak defined
symbols we found. The only way to do this is to search all the symbols we found. The only way to do this is to search all the
symbols. Since we only need the information for non functions in symbols. Since we only need the information for non functions in
dynamic objects, that's the only time we actually put anything on dynamic objects, that's the only time we actually put anything on
@ -5142,8 +5143,8 @@ error_free_dyn:
size_t i, j, idx = 0; size_t i, j, idx = 0;
hlook = weaks; hlook = weaks;
weaks = hlook->u.weakdef; weaks = hlook->u.alias;
hlook->u.weakdef = NULL; hlook->u.alias = NULL;
if (hlook->root.type != bfd_link_hash_defined if (hlook->root.type != bfd_link_hash_defined
&& hlook->root.type != bfd_link_hash_defweak) && hlook->root.type != bfd_link_hash_defweak)
@ -5205,7 +5206,15 @@ error_free_dyn:
break; break;
else if (h != hlook) else if (h != hlook)
{ {
hlook->u.weakdef = h; struct elf_link_hash_entry *t;
hlook->u.alias = h;
hlook->is_weakalias = 1;
t = h;
if (t->u.alias != NULL)
while (t->u.alias != h)
t = t->u.alias;
t->u.alias = hlook;
/* If the weak definition is in the list of dynamic /* If the weak definition is in the list of dynamic
symbols, make sure the real definition is put symbols, make sure the real definition is put
@ -12756,8 +12765,8 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_info *info, asection *sec,
keep the non-weak definition because many backends put keep the non-weak definition because many backends put
dynamic reloc info on the non-weak definition for code dynamic reloc info on the non-weak definition for code
handling copy relocs. */ handling copy relocs. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
h->u.weakdef->mark = 1; weakdef (h)->mark = 1;
if (start_stop != NULL) if (start_stop != NULL)
{ {

View File

@ -6761,14 +6761,14 @@ elfNN_aarch64_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
if (ELIMINATE_COPY_RELOCS || info->nocopyreloc) if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
h->non_got_ref = h->u.weakdef->non_got_ref; h->non_got_ref = def->non_got_ref;
return TRUE; return TRUE;
} }

View File

@ -2963,12 +2963,12 @@ elfNN_ia64_adjust_dynamic_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -786,7 +786,7 @@ riscv_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->type == STT_GNU_IFUNC || h->type == STT_GNU_IFUNC
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -817,12 +817,12 @@ riscv_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -9012,7 +9012,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -9204,12 +9204,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 /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -1932,8 +1932,8 @@ _bfd_sparc_elf_gc_mark_hook (asection *sec,
FALSE, FALSE, TRUE); FALSE, FALSE, TRUE);
BFD_ASSERT (h != NULL); BFD_ASSERT (h != NULL);
h->mark = 1; h->mark = 1;
if (h->u.weakdef != NULL) if (h->is_weakalias)
h->u.weakdef->mark = 1; weakdef (h)->mark = 1;
sym = NULL; sym = NULL;
} }
} }
@ -1995,7 +1995,7 @@ _bfd_sparc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
BFD_ASSERT (htab->elf.dynobj != NULL BFD_ASSERT (htab->elf.dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->type == STT_GNU_IFUNC || h->type == STT_GNU_IFUNC
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -2038,12 +2038,12 @@ _bfd_sparc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -2123,8 +2123,8 @@ tilegx_elf_gc_mark_hook (asection *sec,
h = (struct elf_link_hash_entry *) bh; h = (struct elf_link_hash_entry *) bh;
BFD_ASSERT (h != NULL); BFD_ASSERT (h != NULL);
h->mark = 1; h->mark = 1;
if (h->u.weakdef != NULL) if (h->is_weakalias)
h->u.weakdef->mark = 1; weakdef (h)->mark = 1;
sym = NULL; sym = NULL;
} }
} }
@ -2156,7 +2156,7 @@ tilegx_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL BFD_ASSERT (dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->u.weakdef != NULL || h->is_weakalias
|| (h->def_dynamic || (h->def_dynamic
&& h->ref_regular && h->ref_regular
&& !h->def_regular))); && !h->def_regular)));
@ -2189,12 +2189,12 @@ tilegx_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
return TRUE; return TRUE;
} }

View File

@ -1765,19 +1765,19 @@ _bfd_x86_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this is a weak symbol, and there is a real definition, the /* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */ real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL) if (h->is_weakalias)
{ {
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined struct elf_link_hash_entry *def = weakdef (h);
|| h->u.weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->root.type == bfd_link_hash_defined);
h->root.u.def.section = h->u.weakdef->root.u.def.section; h->root.u.def.section = def->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value; h->root.u.def.value = def->root.u.def.value;
if (ELIMINATE_COPY_RELOCS if (ELIMINATE_COPY_RELOCS
|| info->nocopyreloc || info->nocopyreloc
|| SYMBOL_NO_COPYRELOC (info, eh)) || SYMBOL_NO_COPYRELOC (info, eh))
{ {
/* NB: needs_copy is always 0 for i386. */ /* NB: needs_copy is always 0 for i386. */
h->non_got_ref = h->u.weakdef->non_got_ref; h->non_got_ref = def->non_got_ref;
eh->needs_copy = h->u.weakdef->needs_copy; eh->needs_copy = def->needs_copy;
} }
return TRUE; return TRUE;
} }