+2001-10-03 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_fix_symbol_flags): Copy flags to weakdef using
+ elf_backend_copy_indirect_symbol so that backend has a chance to
+ copy other necessary fields.
+ * elf-bfd.h (struct elf_backend_data): Update description of
+ elf_backend_copy_indirect_symbol.
+ * elf.c (_bfd_elf_link_hash_copy_indirect): Bail out after
+ copying flags if this is a weakdef.
+ * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise.
+ (elfNN_ia64_aix_add_symbol_hook): Use elf_link_hash_lookup rather
+ than bfd_link_hash_lookup.
+ * elf32-i386 (elf_i386_adjust_dynamic_symbol): Don't do copy
+ reloc processing for weakdefs.
+ * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise.
+ * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
+
2001-10-02 Alan Modra <amodra@bigpond.net.au>
* elf64-ppc.c (ppc64_elf_check_relocs): Use a local var and cast
PARAMS ((bfd *, struct bfd_link_info *, PTR,
boolean (*) (PTR, const char *, Elf_Internal_Sym *, asection *)));
- /* Copy any information related to dynamic linking from a pre-existing
- symbol IND to a newly created symbol DIR. */
+ /* Copy any information related to dynamic linking from a pre-existing
+ symbol to a newly created symbol. Also called to copy flags and
+ other back-end info to a weakdef, in which case the symbol is not
+ newly created and plt/got refcounts and dynamic indices should not
+ be copied. */
void (*elf_backend_copy_indirect_symbol)
PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
}
/* Copy data from an indirect symbol to its direct symbol, hiding the
- old indirect symbol. */
+ old indirect symbol. Also used for copying flags to a weakdef. */
void
_bfd_elf_link_hash_copy_indirect (dir, ind)
| ELF_LINK_HASH_REF_REGULAR_NONWEAK
| ELF_LINK_NON_GOT_REF));
+ if (dir == ind->weakdef)
+ return;
+
/* Copy over the global and procedure linkage table refcount entries.
These may have been already set up by a check_relocs routine. */
tmp = dir->got.refcount;
abort ();
h->root.u.def.section = h->weakdef->root.u.def.section;
h->root.u.def.value = h->weakdef->root.u.def.value;
+ return true;
}
/* This is a reference to a symbol defined by a dynamic object which
|| 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;
+ return true;
}
/* This is a reference to a symbol defined by a dynamic object which
|| 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;
+ return true;
}
/* This is a reference to a symbol defined by a dynamic object which
if ((weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
h->weakdef = NULL;
else
- weakdef->elf_link_hash_flags |=
- (h->elf_link_hash_flags
- & (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK
- | ELF_LINK_NON_GOT_REF));
+ {
+ struct elf_backend_data *bed;
+
+ bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
+ (*bed->elf_backend_copy_indirect_symbol) (weakdef, h);
+ }
}
return true;
no one else should use it b/c it is undocumented. */
struct elf_link_hash_entry *h;
- h = (struct elf_link_hash_entry *) bfd_link_hash_lookup (info->hash, *namep, false, false, false);
+ h = elf_link_hash_lookup (elf_hash_table (info), *namep,
+ false, false, false);
if (h == NULL)
{
struct elf_backend_data *bed;
| ELF_LINK_HASH_REF_REGULAR
| ELF_LINK_HASH_REF_REGULAR_NONWEAK));
+ if (dir == ind->weakdef)
+ return;
+
/* Copy over the got and plt data. This would have been done
by check_relocs. */