diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b41c05965c..7d841e29e5 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2019-07-15 Alan Modra + + * elflink.c (_bfd_elf_fix_symbol_flags): If the def for an + alias is no longer bfd_link_hash_defined, clear the alias. + 2019-07-13 Alan Modra * elflink.c (_bfd_elf_omit_section_dynsym_default): Don't keep diff --git a/bfd/elflink.c b/bfd/elflink.c index d146a4b285..9175d3fa20 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -2918,8 +2918,16 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h, /* If the real definition is defined by a regular object file, don't do anything special. See the longer description in - _bfd_elf_adjust_dynamic_symbol, below. */ - if (def->def_regular) + _bfd_elf_adjust_dynamic_symbol, below. If the def is not + bfd_link_hash_defined as it was when put on the alias list + then it must have originally been a versioned symbol (for + which a non-versioned indirect symbol is created) and later + a definition for the non-versioned symbol is found. In that + case the indirection is flipped with the versioned symbol + becoming an indirect pointing at the non-versioned symbol. + Thus, not an alias any more. */ + if (def->def_regular + || def->root.type != bfd_link_hash_defined) { h = def; while ((h = h->u.alias) != def) @@ -2932,7 +2940,6 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h, BFD_ASSERT (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak); BFD_ASSERT (def->def_dynamic); - BFD_ASSERT (def->root.type == bfd_link_hash_defined); (*bed->elf_backend_copy_indirect_symbol) (eif->info, def, h); } }