symbolS *symbol_rootP;
symbolS *symbol_lastP;
symbolS abs_symbol;
+symbolS dot_symbol;
#ifdef DEBUG_SYMS
#define debug_verify_symchain verify_symbol_chain
/* Create a local symbol and insert it into the local hash table. */
static struct local_symbol *
-local_symbol_make (const char *name, segT section, valueT value, fragS *frag)
+local_symbol_make (const char *name, segT section, valueT val, fragS *frag)
{
char *name_copy;
struct local_symbol *ret;
ret->lsy_name = name_copy;
ret->lsy_section = section;
local_symbol_set_frag (ret, frag);
- ret->lsy_value = value;
+ ret->lsy_value = val;
hash_jam (local_hash, name_copy, (void *) ret);
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
as_fatal ("bfd_make_empty_symbol: %s", bfd_errmsg (bfd_get_error ()));
newsymP->bsym = bsymnew;
bsymnew->name = bsymorg->name;
- bsymnew->flags = bsymorg->flags;
- bsymnew->section = bsymorg->section;
+ bsymnew->flags = bsymorg->flags & ~BSF_SECTION_SYM;
+ bsymnew->section = bsymorg->section;
bfd_copy_private_symbol_data (bfd_asymbol_bfd (bsymorg), bsymorg,
bfd_asymbol_bfd (bsymnew), bsymnew);
/* Re-using sy_resolving here, as this routine cannot get called from
symbol resolution code. */
- if (symbolP->bsym->section == expr_section && !symbolP->sy_resolving)
+ if ((symbolP->bsym->section == expr_section || symbolP->sy_forward_ref)
+ && !symbolP->sy_resolving)
{
symbolP->sy_resolving = 1;
add_symbol = symbol_clone_if_forward_ref (add_symbol, is_forward);
if (symbolP->sy_forward_ref
|| add_symbol != symbolP->sy_value.X_add_symbol
|| op_symbol != symbolP->sy_value.X_op_symbol)
- symbolP = symbol_clone (symbolP, 0);
+ {
+ if (symbolP != &dot_symbol)
+ {
+ symbolP = symbol_clone (symbolP, 0);
+ symbolP->sy_resolving = 0;
+ }
+ else
+ {
+ symbolP = symbol_temp_new_now ();
+#ifdef tc_new_dot_label
+ tc_new_dot_label (symbolP);
+#endif
+ }
+ }
symbolP->sy_value.X_add_symbol = add_symbol;
symbolP->sy_value.X_op_symbol = op_symbol;
}
else
{
- expressionS expr = symbolP->sy_value;
+ expressionS exp = symbolP->sy_value;
- if (!symbolP->sy_resolved && expr.X_op != O_illegal)
+ if (!symbolP->sy_resolved && exp.X_op != O_illegal)
{
int resolved;
if (symbolP->sy_resolving)
return 0;
symbolP->sy_resolving = 1;
- resolved = resolve_expression (&expr);
+ resolved = resolve_expression (&exp);
symbolP->sy_resolving = 0;
if (!resolved)
return 0;
- switch (expr.X_op)
+ switch (exp.X_op)
{
case O_constant:
case O_register:
/* Fall thru. */
case O_symbol:
case O_symbol_rva:
- symbolP = expr.X_add_symbol;
+ symbolP = exp.X_add_symbol;
break;
default:
return 0;
}
*symbolPP = symbolP;
- *valueP = expr.X_add_number;
+ *valueP = exp.X_add_number;
*segP = symbolP->bsym->section;
*fragPP = symbolP->sy_frag;
if (*segP == expr_section)
- switch (expr.X_op)
+ switch (exp.X_op)
{
case O_constant: *segP = absolute_section; break;
case O_register: *segP = reg_section; break;
int instance_number;
char *type;
const char *message_format;
- int index = 0;
+ int lindex = 0;
#ifdef LOCAL_LABEL_PREFIX
- if (s[index] == LOCAL_LABEL_PREFIX)
- ++index;
+ if (s[lindex] == LOCAL_LABEL_PREFIX)
+ ++lindex;
#endif
- if (s[index] != 'L')
+ if (s[lindex] != 'L')
return s;
- for (label_number = 0, p = s + index + 1; ISDIGIT (*p); ++p)
+ for (label_number = 0, p = s + lindex + 1; ISDIGIT (*p); ++p)
label_number = (10 * label_number) + *p - '0';
if (*p == DOLLAR_LABEL_CHAR)
return ((strict
&& ((s->bsym->flags & BSF_WEAK) != 0
- || (s->bsym->flags & BSF_GNU_INDIRECT_FUNCTION) != 0
|| (EXTERN_FORCE_RELOC
&& (s->bsym->flags & BSF_GLOBAL) != 0)))
+ || (s->bsym->flags & BSF_GNU_INDIRECT_FUNCTION) != 0
|| s->bsym->section == undefined_section
|| bfd_is_com_section (s->bsym->section));
}
S_CLEAR_WEAKREFR (s);
}
+/* Return whether 2 symbols are the same. */
+
+int
+symbol_same_p (symbolS *s1, symbolS *s2)
+{
+ if (s1->bsym == NULL
+ && local_symbol_converted_p ((struct local_symbol *) s1))
+ s1 = local_symbol_get_real_symbol ((struct local_symbol *) s1);
+ if (s2->bsym == NULL
+ && local_symbol_converted_p ((struct local_symbol *) s2))
+ s2 = local_symbol_get_real_symbol ((struct local_symbol *) s2);
+ return s1 == s2;
+}
+
/* Return a pointer to the X_add_number component of a symbol. */
offsetT *
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;
+}
\f
int indent_level;