From a02c6202855bfac74b3834c43bc3f81a51af0c3e Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 2 Sep 2002 14:46:56 +0000 Subject: [PATCH] Fix PROVIDE --- ld/ChangeLog | 6 ++++++ ld/ldexp.c | 24 +++++++++++------------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 0fd8e85ae..f097310f5 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2002-09-02 Nick Clifton + + * ldexp.c (exp_fold_tree): If the first attempt to lookup a + PROVIDEd symbol fails, look it up again, but this time with + the 'create' flag set. + 2002-08-30 Nick Clifton * scripttempl/elfd10v.sc (MEMORY): Remove UNIFIED, it is not diff --git a/ld/ldexp.c b/ld/ldexp.c index 8e3ea6308..6c4937dda 100644 --- a/ld/ldexp.c +++ b/ld/ldexp.c @@ -726,22 +726,20 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp) if (tree->type.node_class == etree_assign) create = true; else - create = false; + create = false; h = bfd_link_hash_lookup (link_info.hash, tree->assign.dst, create, false, false); + + if (tree->type.node_class == etree_provide + && (h == NULL + || h->type == bfd_link_hash_undefined + || h->type == bfd_link_hash_common)) + h = bfd_link_hash_lookup (link_info.hash, tree->assign.dst, + true, false, false); + if (h == (struct bfd_link_hash_entry *) NULL) - { - if (tree->type.node_class == etree_assign) - einfo (_("%P%F:%s: hash creation failed\n"), - tree->assign.dst); - } - else if (tree->type.node_class == etree_provide - && h->type != bfd_link_hash_undefined - && h->type != bfd_link_hash_common) - { - /* Do nothing. The symbol was defined by some - object. */ - } + einfo (_("%P%F:%s: hash creation failed\n"), + tree->assign.dst); else { /* FIXME: Should we worry if the symbol is already -- 2.11.4.GIT