2010-05-10 Andrew Stubbs <ams@codesourcery.com>
[deliverable/binutils-gdb.git] / ld / ldexp.c
index 7133f37df3e9fe51f0c553cf1d457a330b1ff7b2..7fdf7f40587d16bd0ff6f98f5f446c3c2a725a7d 100644 (file)
@@ -1,6 +1,6 @@
 /* This module handles expression trees.
    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
 
@@ -815,6 +815,20 @@ 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);
+               }
            }
        }
       break;
@@ -946,7 +960,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 +977,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 +1109,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 +1134,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.035487 seconds and 4 git commands to generate.