aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog17
-rw-r--r--bfd/elf-bfd.h7
-rw-r--r--bfd/elf.c5
-rw-r--r--bfd/elf32-hppa.c1
-rw-r--r--bfd/elf32-i386.c1
-rw-r--r--bfd/elf64-ppc.c1
-rw-r--r--bfd/elflink.h11
-rw-r--r--bfd/elfxx-ia64.c6
8 files changed, 40 insertions, 9 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e60ffe6..0311dfb 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 42f8f29..8ab13b7 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -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 *));
diff --git a/bfd/elf.c b/bfd/elf.c
index 826dbbb..289c06c 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -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;
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 8b662ab..557b9fe 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -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
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 192aa4e..719a209 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -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
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index c314f5e..d3cdbec 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -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
diff --git a/bfd/elflink.h b/bfd/elflink.h
index 39f8811..3879dbc 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -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;
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index 739fe7a..d467a98 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -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. */