summaryrefslogtreecommitdiff
path: root/ld/ldexp.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2011-01-13 13:06:22 +0000
committerAlan Modra <amodra@gmail.com>2011-01-13 13:06:22 +0000
commit2e57b2afce83621b72b2ac8b54635ad199663dec (patch)
treea162756c66238efb1835bc8af47ad6fe0fa9177a /ld/ldexp.c
parent15b8ba76931a8fed121a0f634388e828b3cbc063 (diff)
downloadbinutils-gdb-2e57b2afce83621b72b2ac8b54635ad199663dec.tar.gz
PR ld/12356
* ldexp.h (exp_assop): Delete. (exp_assign, exp_defsym): Declare. * ldexp.c (exp_assop): Make static, handle all assignment variations. (exp_assign, exp_defsym): New functions. (exp_provide): Use exp_assop. * ldgram.y (defsym_expr): Use exp_defsym. * ldctor.c, * ldgram.y, * ldlang.c, * mri.c, * emultempl/beos.em, * emultempl/pe.em, * emultempl/pep.em, * emultempl/spuelf.em, * emultempl/xtensaelf.em: Update exp_assop -> exp_assign.
Diffstat (limited to 'ld/ldexp.c')
-rw-r--r--ld/ldexp.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/ld/ldexp.c b/ld/ldexp.c
index 9aad09214f2..326a0aa1f20 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -974,37 +974,44 @@ exp_nameop (int code, const char *name)
}
-etree_type *
-exp_assop (int code, const char *dst, etree_type *src)
-{
- etree_type *new_e;
-
- new_e = (etree_type *) stat_alloc (sizeof (new_e->assign));
- new_e->type.node_code = code;
- new_e->type.lineno = src->type.lineno;
- new_e->type.node_class = etree_assign;
- new_e->assign.src = src;
- new_e->assign.dst = dst;
- return new_e;
-}
-
-/* Handle PROVIDE. */
-
-etree_type *
-exp_provide (const char *dst, etree_type *src, bfd_boolean hidden)
+static etree_type *
+exp_assop (const char *dst,
+ etree_type *src,
+ enum node_tree_enum class,
+ bfd_boolean hidden)
{
etree_type *n;
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;
+ n->assign.type.node_class = class;
n->assign.src = src;
n->assign.dst = dst;
n->assign.hidden = hidden;
return n;
}
+etree_type *
+exp_assign (const char *dst, etree_type *src)
+{
+ return exp_assop (dst, src, etree_assign, FALSE);
+}
+
+etree_type *
+exp_defsym (const char *dst, etree_type *src)
+{
+ return exp_assop (dst, src, etree_assign, TRUE);
+}
+
+/* Handle PROVIDE. */
+
+etree_type *
+exp_provide (const char *dst, etree_type *src, bfd_boolean hidden)
+{
+ return exp_assop (dst, src, etree_provide, hidden);
+}
+
/* Handle ASSERT. */
etree_type *