2010-05-14 Michael Snyder <msnyder@vmware.com>
[deliverable/binutils-gdb.git] / ld / ldexp.c
index 31681382516a5a6d9a734c029ae22ffc3306de35..34d9eabde7f67506d79f54afdcdc262b194d7b30 100644 (file)
@@ -815,6 +815,28 @@ exp_fold_tree_1 (etree_type *tree)
              h->u.def.section = expld.result.section;
              if (tree->type.node_class == etree_provide)
                tree->type.node_class = etree_provided;
+
+             /* Copy the symbol type if this is a simple assignment of
+                one symbol to annother.  */
+             if (tree->assign.src->type.node_class == etree_name)
+               {
+                 struct bfd_link_hash_entry *hsrc;
+
+                 hsrc = bfd_link_hash_lookup (link_info.hash,
+                                              tree->assign.src->name.name,
+                                              FALSE, FALSE, TRUE);
+                 if (hsrc)
+                   bfd_copy_link_hash_symbol_type (link_info.output_bfd, h,
+                                                   hsrc);
+               }
+           }
+         else if (expld.phase == lang_final_phase_enum)
+           {
+             h = bfd_link_hash_lookup (link_info.hash, tree->assign.dst,
+                                       FALSE, FALSE, TRUE);
+             if (h != NULL
+                 && h->type == bfd_link_hash_new)
+               h->type = bfd_link_hash_undefined;
            }
        }
       break;
@@ -946,7 +968,7 @@ exp_provide (const char *dst, etree_type *src, bfd_boolean hidden)
 {
   etree_type *n;
 
-  n = stat_alloc (sizeof (n->assign));
+  n = (etree_type *) stat_alloc (sizeof (n->assign));
   n->assign.type.node_code = '=';
   n->assign.type.lineno = src->type.lineno;
   n->assign.type.node_class = etree_provide;
@@ -963,7 +985,7 @@ exp_assert (etree_type *exp, const char *message)
 {
   etree_type *n;
 
-  n = stat_alloc (sizeof (n->assert_s));
+  n = (etree_type *) stat_alloc (sizeof (n->assert_s));
   n->assert_s.type.node_code = '!';
   n->assert_s.type.lineno = exp->type.lineno;
   n->assert_s.type.node_class = etree_assert;
@@ -1095,7 +1117,7 @@ exp_get_fill (etree_type *tree, fill_type *def, char *name)
     {
       unsigned char *dst;
       unsigned char *s;
-      fill = xmalloc ((len + 1) / 2 + sizeof (*fill) - 1);
+      fill = (fill_type *) xmalloc ((len + 1) / 2 + sizeof (*fill) - 1);
       fill->size = (len + 1) / 2;
       dst = fill->data;
       s = (unsigned char *) expld.result.str;
@@ -1120,7 +1142,7 @@ exp_get_fill (etree_type *tree, fill_type *def, char *name)
     }
   else
     {
-      fill = xmalloc (4 + sizeof (*fill) - 1);
+      fill = (fill_type *) xmalloc (4 + sizeof (*fill) - 1);
       val = expld.result.value;
       fill->data[0] = (val >> 24) & 0xff;
       fill->data[1] = (val >> 16) & 0xff;
This page took 0.024249 seconds and 4 git commands to generate.