Fix PROVIDE
authorNick Clifton <nickc@redhat.com>
Mon, 2 Sep 2002 14:46:56 +0000 (14:46 +0000)
committerNick Clifton <nickc@redhat.com>
Mon, 2 Sep 2002 14:46:56 +0000 (14:46 +0000)
ld/ChangeLog
ld/ldexp.c

index 0fd8e85aece065a655fa4e8c079b125ab9c3173b..f097310f5ea1f9f81f1daad64f91ac787a5e16b2 100644 (file)
@@ -1,3 +1,9 @@
+2002-09-02  Nick Clifton  <nickc@redhat.com>
+
+       * 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  <nickc@redhat.com>
 
        * scripttempl/elfd10v.sc (MEMORY): Remove UNIFIED, it is not
index 8e3ea6308e86ebb5ad8d221a4b738f65fcfef62c..6c4937ddaef19561a11822eeaed2fdb93035e785 100644 (file)
@@ -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