/* 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>.
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. */
new.valid_p = TRUE;
new.section = abs_output_section;
new.value = value;
+ new.str = NULL;
return new;
}
}
}
}
- 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)
if (tree == NULL)
{
- result.valid_p = FALSE;
+ memset (&result, 0, sizeof (result));
return result;
}
case etree_rel:
if (allocation_done != lang_final_phase_enum)
- result.valid_p = FALSE;
+ memset (&result, 0, sizeof (result));
else
result = new_rel ((tree->rel.value
+ tree->rel.section->output_section->vma
result = exp_fold_tree (tree->assert_s.child,
current_section,
allocation_done, dot, dotp);
- if (result.valid_p)
- {
- if (! result.value)
- einfo ("%X%P: %s\n", tree->assert_s.message);
- return result;
- }
+ if (result.valid_p && !result.value)
+ einfo ("%X%P: %s\n", tree->assert_s.message);
break;
case etree_unary:
|| (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
}
}
}
+ else
+ memset (&result, 0, sizeof (result));
}
else
{
default:
FAIL ();
+ memset (&result, 0, sizeof (result));
break;
}
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
{