* 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.
This commit is contained in:
Alan Modra 2001-10-03 08:33:18 +00:00
parent 7997c6eaf4
commit 0a991dfe0d
8 changed files with 40 additions and 9 deletions

View File

@ -1,3 +1,20 @@
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

View File

@ -648,8 +648,11 @@ struct elf_backend_data
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 *));

View File

@ -986,7 +986,7 @@ _bfd_elf_link_hash_newfunc (entry, table, string)
}
/* 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)
@ -1004,6 +1004,9 @@ _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;

View File

@ -1855,6 +1855,7 @@ elf32_hppa_adjust_dynamic_symbol (info, h)
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

View File

@ -1109,6 +1109,7 @@ elf_i386_adjust_dynamic_symbol (info, h)
|| 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

View File

@ -2376,6 +2376,7 @@ ppc64_elf_adjust_dynamic_symbol (info, h)
|| 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

View File

@ -3615,11 +3615,12 @@ elf_fix_symbol_flags (h, eif)
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;

View File

@ -1190,7 +1190,8 @@ elfNN_ia64_aix_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
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;
@ -1523,6 +1524,9 @@ elfNN_ia64_hash_copy_indirect (xdir, xind)
| 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. */