summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@nildram.co.uk>2002-04-30 09:21:27 +0000
committerRichard Sandiford <rsandifo@nildram.co.uk>2002-04-30 09:21:27 +0000
commit11aac53e8a0213f2ea4394e8b731a7e5d0837ddc (patch)
tree7467c24b03efa2c9d2424d1f7a1a23cf4d4c0b31
parent2f17dd5b1cd1f212bdb7c4be17742a29af208488 (diff)
downloadbinutils-redhat-11aac53e8a0213f2ea4394e8b731a7e5d0837ddc.tar.gz
* ldlang.c (print_assignment): Update print_dot for assignments to ".".
* ldexp.c (exp_print_token): Add "infix_p" argument. (exp_print_tree): Update accordingly.
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/ldexp.c46
-rw-r--r--ld/ldlang.c12
3 files changed, 43 insertions, 21 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index f074b07d5d..78c37a50c3 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2002-04-30 Richard Sandiford <rsandifo@redhat.com>
+
+ * ldlang.c (print_assignment): Update print_dot for assignments to ".".
+ * ldexp.c (exp_print_token): Add "infix_p" argument.
+ (exp_print_tree): Update accordingly.
+
2002-04-28 Alan Modra <amodra@bigpond.net.au>
* Makefile.am (mpw): New maintainer mode rule to make mpw-*.c files.
diff --git a/ld/ldexp.c b/ld/ldexp.c
index c4876a877e..d58465176e 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -41,7 +41,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "libiberty.h"
#include "safe-ctype.h"
-static void exp_print_token PARAMS ((token_code_type code));
+static void exp_print_token PARAMS ((token_code_type code, int infix_p));
static void make_abs PARAMS ((etree_value_type *ptr));
static etree_value_type new_abs PARAMS ((bfd_vma value));
static void check PARAMS ((lang_output_section_statement_type *os,
@@ -67,9 +67,13 @@ static etree_value_type exp_fold_tree_no_dot
struct exp_data_seg exp_data_seg;
+/* Print the string representation of the given token. Surround it
+ with spaces if INFIX_P is true. */
+
static void
-exp_print_token (code)
+exp_print_token (code, infix_p)
token_code_type code;
+ int infix_p;
{
static CONST struct
{
@@ -122,20 +126,22 @@ exp_print_token (code)
};
unsigned int idx;
- for (idx = ARRAY_SIZE (table); idx--;)
- {
- if (table[idx].code == code)
- {
- fprintf (config.map_file, " %s ", table[idx].name);
- return;
- }
- }
+ for (idx = 0; idx < ARRAY_SIZE (table); idx++)
+ if (table[idx].code == code)
+ break;
- /* Not in table, just print it alone. */
- if (code < 127)
- fprintf (config.map_file, " %c ", code);
+ if (infix_p)
+ fputc (' ', config.map_file);
+
+ if (idx < ARRAY_SIZE (table))
+ fputs (table[idx].name, config.map_file);
+ else if (code < 127)
+ fputc (code, config.map_file);
else
- fprintf (config.map_file, " <code %d> ", code);
+ fprintf (config.map_file, "<code %d>", code);
+
+ if (infix_p)
+ fputc (' ', config.map_file);
}
static void
@@ -955,7 +961,7 @@ exp_print_tree (tree)
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);
+ exp_print_token (tree->type.node_code, true);
exp_print_tree (tree->assign.src);
break;
case etree_provide:
@@ -967,7 +973,7 @@ exp_print_tree (tree)
case etree_binary:
fprintf (config.map_file, "(");
exp_print_tree (tree->binary.lhs);
- exp_print_token (tree->type.node_code);
+ exp_print_token (tree->type.node_code, true);
exp_print_tree (tree->binary.rhs);
fprintf (config.map_file, ")");
break;
@@ -979,10 +985,10 @@ exp_print_tree (tree)
exp_print_tree (tree->trinary.rhs);
break;
case etree_unary:
- exp_print_token (tree->unary.type.node_code);
+ exp_print_token (tree->unary.type.node_code, false);
if (tree->unary.child)
{
- fprintf (config.map_file, "(");
+ fprintf (config.map_file, " (");
exp_print_tree (tree->unary.child);
fprintf (config.map_file, ")");
}
@@ -1004,9 +1010,9 @@ exp_print_tree (tree)
}
else
{
- exp_print_token (tree->type.node_code);
+ exp_print_token (tree->type.node_code, false);
if (tree->name.name)
- fprintf (config.map_file, "(%s)", tree->name.name);
+ fprintf (config.map_file, " (%s)", tree->name.name);
}
break;
default:
diff --git a/ld/ldlang.c b/ld/ldlang.c
index afa77e1eab..f6b950168c 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -2211,7 +2211,17 @@ print_assignment (assignment, output_section)
result = exp_fold_tree (assignment->exp->assign.src, output_section,
lang_final_phase_enum, print_dot, &print_dot);
if (result.valid_p)
- minfo ("0x%V", result.value + result.section->bfd_section->vma);
+ {
+ const char *dst;
+ bfd_vma value;
+
+ value = result.value + result.section->bfd_section->vma;
+ dst = assignment->exp->assign.dst;
+
+ minfo ("0x%V", value);
+ if (dst[0] == '.' && dst[1] == 0)
+ print_dot = value;
+ }
else
{
minfo ("*undef* ");