aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2005-02-03 14:12:54 +0000
committerAlan Modra <amodra@gmail.com>2005-02-03 14:12:54 +0000
commit4ea42fb74f7eeda2968163eaa74a10139c4a04b2 (patch)
tree7b617c4fbeea4bf94c73070375faf7baae7aa25b
parent10d86c8a5c3965bfcc895c7e6a624cd3fd6e240d (diff)
downloadgdb-4ea42fb74f7eeda2968163eaa74a10139c4a04b2.zip
gdb-4ea42fb74f7eeda2968163eaa74a10139c4a04b2.tar.gz
gdb-4ea42fb74f7eeda2968163eaa74a10139c4a04b2.tar.bz2
bfd/
* elflink.c (bfd_elf_record_link_assignment): Do "provide" symbol lookup here. Set to new before calling bfd_link_repair_undef_list. (elf_smash_syms): Check that u.undef.weak isn't the not_needed bfd. ld/ emultempl/elf32.em (gld${EMULATION_NAME}_find_exp_assignment): Don't look up symbol for etree_provide here.
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elflink.c13
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/emultempl/elf32.em18
4 files changed, 24 insertions, 18 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 72eaad8..064499a 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2005-02-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (bfd_elf_record_link_assignment): Do "provide" symbol
+ lookup here. Set to new before calling bfd_link_repair_undef_list.
+ (elf_smash_syms): Check that u.undef.weak isn't the not_needed bfd.
+
2005-02-03 Alan Modra <amodra@bigpond.net.au>
* linker.c (_bfd_link_hash_newfunc): Set all local fields.
diff --git a/bfd/elflink.c b/bfd/elflink.c
index ba2676d..4ece121 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -440,13 +440,15 @@ bfd_elf_record_link_assignment (bfd *output_bfd ATTRIBUTE_UNUSED,
bfd_boolean provide)
{
struct elf_link_hash_entry *h;
+ struct elf_link_hash_table *htab;
if (!is_elf_hash_table (info->hash))
return TRUE;
- h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, TRUE, FALSE);
+ htab = elf_hash_table (info);
+ h = elf_link_hash_lookup (htab, name, !provide, TRUE, FALSE);
if (h == NULL)
- return FALSE;
+ return provide;
/* Since we're defining the symbol, don't let it seem to have not
been defined. record_dynamic_symbol and size_dynamic_sections
@@ -454,11 +456,9 @@ bfd_elf_record_link_assignment (bfd *output_bfd ATTRIBUTE_UNUSED,
if (h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined)
{
- struct elf_link_hash_table *htab = elf_hash_table (info);
-
+ h->root.type = bfd_link_hash_new;
if (h->root.u.undef.next != NULL || htab->root.undefs_tail == &h->root)
bfd_link_repair_undef_list (&htab->root);
- h->root.type = bfd_link_hash_new;
}
if (h->root.type == bfd_link_hash_new)
@@ -2844,7 +2844,8 @@ elf_smash_syms (struct elf_link_hash_entry *h, void *data)
case bfd_link_hash_undefined:
if (h->root.u.undef.abfd != inf->not_needed)
return TRUE;
- if (h->root.u.undef.weak != NULL)
+ if (h->root.u.undef.weak != NULL
+ && h->root.u.undef.weak != inf->not_needed)
{
/* Symbol was undefweak in u.undef.weak bfd, and has become
undefined in as-needed lib. Restore weak. */
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 9aeda3a..aed570d 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2005-02-04 Alan Modra <amodra@bigpond.net.au>
+
+ * emultempl/elf32.em (gld${EMULATION_NAME}_find_exp_assignment): Don't
+ look up symbol for etree_provide here.
+
2005-02-02 Daniel Jacobowitz <dan@codesourcery.com>
* emulparams/elf32bmip.sh (TEXT_DYNAMIC): Always set.
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index fd35938..771a98c 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -931,16 +931,14 @@ cat >>e${EMULATION_NAME}.c <<EOF
static void
gld${EMULATION_NAME}_find_exp_assignment (etree_type *exp)
{
- struct bfd_link_hash_entry *h;
+ bfd_boolean provide = FALSE;
switch (exp->type.node_class)
{
case etree_provide:
- h = bfd_link_hash_lookup (link_info.hash, exp->assign.dst,
- FALSE, FALSE, FALSE);
- if (h == NULL)
- break;
-
+ provide = TRUE;
+ /* Fall thru */
+ case etree_assign:
/* We call record_link_assignment even if the symbol is defined.
This is because if it is defined by a dynamic object, we
actually want to use the value defined by the linker script,
@@ -948,14 +946,10 @@ gld${EMULATION_NAME}_find_exp_assignment (etree_type *exp)
symbols like etext). If the symbol is defined by a regular
object, then, as it happens, calling record_link_assignment
will do no harm. */
-
- /* Fall through. */
- case etree_assign:
if (strcmp (exp->assign.dst, ".") != 0)
{
- if (! (bfd_elf_record_link_assignment
- (output_bfd, &link_info, exp->assign.dst,
- exp->type.node_class == etree_provide ? TRUE : FALSE)))
+ if (!bfd_elf_record_link_assignment (output_bfd, &link_info,
+ exp->assign.dst, provide))
einfo ("%P%F: failed to record assignment to %s: %E\n",
exp->assign.dst);
}