aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2010-07-28 06:43:32 +0000
committerAlan Modra <amodra@gmail.com>2010-07-28 06:43:32 +0000
commitae78bbeb22f44373fa63d97c79d8d3690850a9ff (patch)
treef785e060932030a3e1958817ac4ffb04b0115a91 /ld
parent5a93804749f93a734e8cc9f6b6b3a00b70f46c5d (diff)
downloadgdb-ae78bbeb22f44373fa63d97c79d8d3690850a9ff.zip
gdb-ae78bbeb22f44373fa63d97c79d8d3690850a9ff.tar.gz
gdb-ae78bbeb22f44373fa63d97c79d8d3690850a9ff.tar.bz2
* ldexp.c (exp_print_tree): Print function-like binary nodes as
functions rather than in-fix operators. Use fputs and fputc where appropriate.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/ldexp.c40
2 files changed, 35 insertions, 11 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 7635da4..fb1804b 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2010-07-28 Alan Modra <amodra@gmail.com>
+
+ * ldexp.c (exp_print_tree): Print function-like binary nodes as
+ functions rather than in-fix operators. Use fputs and fputc
+ where appropriate.
+
2010-07-23 Naveen.H.S <naveen.S@kpitcummins.com>
Ina Pandit <ina.pandit@kpitcummins.com>
diff --git a/ld/ldexp.c b/ld/ldexp.c
index c0ca818..aae94c6 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -1002,6 +1002,8 @@ exp_assert (etree_type *exp, const char *message)
void
exp_print_tree (etree_type *tree)
{
+ bfd_boolean function_like;
+
if (config.map_file == NULL)
config.map_file = stderr;
@@ -1022,7 +1024,7 @@ exp_print_tree (etree_type *tree)
minfo ("%s+0x%v", tree->rel.section->name, tree->rel.value);
return;
case etree_assign:
- fprintf (config.map_file, "%s", tree->assign.dst);
+ fputs (tree->assign.dst, config.map_file);
exp_print_token (tree->type.node_code, TRUE);
exp_print_tree (tree->assign.src);
break;
@@ -1030,20 +1032,38 @@ exp_print_tree (etree_type *tree)
case etree_provided:
fprintf (config.map_file, "PROVIDE (%s, ", tree->assign.dst);
exp_print_tree (tree->assign.src);
- fprintf (config.map_file, ")");
+ fputc (')', config.map_file);
break;
case etree_binary:
- fprintf (config.map_file, "(");
+ function_like = FALSE;
+ switch (tree->type.node_code)
+ {
+ case MAX_K:
+ case MIN_K:
+ case ALIGN_K:
+ case DATA_SEGMENT_ALIGN:
+ case DATA_SEGMENT_RELRO_END:
+ function_like = TRUE;
+ }
+ if (function_like)
+ {
+ exp_print_token (tree->type.node_code, FALSE);
+ fputc (' ', config.map_file);
+ }
+ fputc ('(', config.map_file);
exp_print_tree (tree->binary.lhs);
- exp_print_token (tree->type.node_code, TRUE);
+ if (function_like)
+ fprintf (config.map_file, ", ");
+ else
+ exp_print_token (tree->type.node_code, TRUE);
exp_print_tree (tree->binary.rhs);
- fprintf (config.map_file, ")");
+ fputc (')', config.map_file);
break;
case etree_trinary:
exp_print_tree (tree->trinary.cond);
- fprintf (config.map_file, "?");
+ fputc ('?', config.map_file);
exp_print_tree (tree->trinary.lhs);
- fprintf (config.map_file, ":");
+ fputc (':', config.map_file);
exp_print_tree (tree->trinary.rhs);
break;
case etree_unary:
@@ -1052,7 +1072,7 @@ exp_print_tree (etree_type *tree)
{
fprintf (config.map_file, " (");
exp_print_tree (tree->unary.child);
- fprintf (config.map_file, ")");
+ fputc (')', config.map_file);
}
break;
@@ -1064,9 +1084,7 @@ exp_print_tree (etree_type *tree)
case etree_name:
if (tree->type.node_code == NAME)
- {
- fprintf (config.map_file, "%s", tree->name.name);
- }
+ fputs (tree->name.name, config.map_file);
else
{
exp_print_token (tree->type.node_code, FALSE);