summaryrefslogtreecommitdiff
path: root/gas/symbols.c
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2010-12-01 21:34:10 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2010-12-01 21:34:10 +0000
commit8329933bfea48e8853cc7bbbd01c572af14d70db (patch)
treec8dddb28cbf9fcf64f88b132b58a24dc36cc7339 /gas/symbols.c
parent1c59b327b1783a497e9a7b2f8a554f3bd177f0ba (diff)
downloadbinutils-redhat-8329933bfea48e8853cc7bbbd01c572af14d70db.tar.gz
* symbols.h (dot_symbol): New declaration.
(dot_symbol_init): New prototype. * symbols.c (dot_symbol): New variable. (symbol_clone): Assert it's not dot_symbol being cloned. (dot_symbol_init): New function. (symbol_clone_if_forward_ref): Create a new temporary symbol when trying to clone dot_symbol. * expr.c (current_location): Refer to dot_symbol instead of making a new temporary symbol. * read.c (read_a_source_file): Update dot_symbol as we go. * as.c (main): Call dot_symbol_init.
Diffstat (limited to 'gas/symbols.c')
-rw-r--r--gas/symbols.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/gas/symbols.c b/gas/symbols.c
index e432b8603f..5fae5471b1 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -48,6 +48,7 @@ static struct hash_control *local_hash;
symbolS *symbol_rootP;
symbolS *symbol_lastP;
symbolS abs_symbol;
+symbolS dot_symbol;
#ifdef DEBUG_SYMS
#define debug_verify_symchain verify_symbol_chain
@@ -557,6 +558,9 @@ symbol_clone (symbolS *orgsymP, int replace)
symbolS *newsymP;
asymbol *bsymorg, *bsymnew;
+ /* Make sure we never clone the dot special symbol. */
+ gas_assert (orgsymP != &dot_symbol);
+
/* Running local_symbol_convert on a clone that's not the one currently
in local_hash would incorrectly replace the hash entry. Thus the
symbol must be converted here. Note that the rest of the function
@@ -658,8 +662,13 @@ symbol_clone_if_forward_ref (symbolS *symbolP, int is_forward)
|| add_symbol != symbolP->sy_value.X_add_symbol
|| op_symbol != symbolP->sy_value.X_op_symbol)
{
- symbolP = symbol_clone (symbolP, 0);
- symbolP->sy_resolving = 0;
+ if (symbolP != &dot_symbol)
+ {
+ symbolP = symbol_clone (symbolP, 0);
+ symbolP->sy_resolving = 0;
+ }
+ else
+ symbolP = symbol_temp_new_now ();
}
symbolP->sy_value.X_add_symbol = add_symbol;
@@ -2749,6 +2758,17 @@ symbol_begin (void)
if (LOCAL_LABELS_FB)
fb_label_init ();
}
+
+void
+dot_symbol_init (void)
+{
+ dot_symbol.bsym = bfd_make_empty_symbol (stdoutput);
+ if (dot_symbol.bsym == NULL)
+ as_fatal ("bfd_make_empty_symbol: %s", bfd_errmsg (bfd_get_error ()));
+ dot_symbol.bsym->name = ".";
+ dot_symbol.sy_forward_ref = 1;
+ dot_symbol.sy_value.X_op = O_constant;
+}
int indent_level;