* Makefile.in (SFILES): Add cp-names.y.
[deliverable/binutils-gdb.git] / ld / ldexp.c
index cd6068cc47834ec4d559997e728c0ce70bc76b3f..ec25557bafb3879da2cc7f4b1f3dee05bc66eefd 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
+   2001, 2002, 2003, 2004, 2005
    Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
 
@@ -50,6 +50,9 @@ struct exp_data_seg exp_data_seg;
 
 segment_type *segments;
 
+/* Principally used for diagnostics.  */
+static bfd_boolean assigning_to_dot = FALSE;
+
 /* Print the string representation of the given token.  Surround it
    with spaces if INFIX_P is TRUE.  */
 
@@ -144,6 +147,7 @@ new_abs (bfd_vma value)
   new.valid_p = TRUE;
   new.section = abs_output_section;
   new.value = value;
+  new.str = NULL;
   return new;
 }
 
@@ -435,8 +439,10 @@ fold_binary (etree_type *tree,
                      if (allocation_done == lang_allocating_phase_enum)
                        {
                          exp_data_seg.phase = exp_dataseg_align_seen;
+                         exp_data_seg.min_base = align_n (dot, maxpage);
                          exp_data_seg.base = result.value;
                          exp_data_seg.pagesize = other.value;
+                         exp_data_seg.maxpagesize = maxpage;
                          exp_data_seg.relro_end = 0;
                        }
                    }
@@ -593,7 +599,8 @@ fold_name (etree_type *tree,
                    }
                }
            }
-         else if (allocation_done == lang_final_phase_enum)
+         else if (allocation_done == lang_final_phase_enum
+                  || assigning_to_dot)
            einfo (_("%F%S: undefined symbol `%s' referenced in expression\n"),
                   tree->name.name);
          else if (h->type == bfd_link_hash_new)
@@ -752,10 +759,13 @@ exp_fold_tree (etree_type *tree,
              || (allocation_done == lang_final_phase_enum
                  && current_section == abs_output_section))
            {
+             /* Notify the folder that this is an assignment to dot.  */
+             assigning_to_dot = TRUE;
              result = exp_fold_tree (tree->assign.src,
                                      current_section,
-                                     allocation_done, dot,
-                                     dotp);
+                                     allocation_done, dot, dotp);
+             assigning_to_dot = FALSE;
+
              if (! result.valid_p)
                einfo (_("%F%S invalid assignment to location counter\n"));
              else
@@ -933,10 +943,6 @@ exp_assop (int code, const char *dst, etree_type *src)
   value.assign.dst = dst;
   value.assign.type.node_class = etree_assign;
 
-#if 0
-  if (exp_fold_tree_no_dot (&value, &result))
-    return exp_intop (result);
-#endif
   new = stat_alloc (sizeof (new->assign));
   memcpy (new, &value, sizeof (new->assign));
   return new;
@@ -995,13 +1001,6 @@ exp_print_tree (etree_type *tree)
       minfo ("%s+0x%v", tree->rel.section->name, tree->rel.value);
       return;
     case etree_assign:
-#if 0
-      if (tree->assign.dst->sdefs != NULL)
-       fprintf (config.map_file, "%s (%x) ", tree->assign.dst->name,
-                tree->assign.dst->sdefs->value);
-      else
-       fprintf (config.map_file, "%s (UNDEFINED)", tree->assign.dst->name);
-#endif
       fprintf (config.map_file, "%s", tree->assign.dst);
       exp_print_token (tree->type.node_code, TRUE);
       exp_print_tree (tree->assign.src);
@@ -1116,7 +1115,7 @@ exp_get_fill (etree_type *tree,
       fill = xmalloc ((len + 1) / 2 + sizeof (*fill) - 1);
       fill->size = (len + 1) / 2;
       dst = fill->data;
-      s = r.str;
+      s = (unsigned char *) r.str;
       val = 0;
       do
        {
This page took 0.02476 seconds and 4 git commands to generate.