/* symbols.c -symbol table-
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002
+ 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
/* Local symbol support. If we can get away with it, we keep only a
small amount of information for local symbols. */
-static struct local_symbol *local_symbol_make PARAMS ((const char *, segT,
- valueT, fragS *));
static symbolS *local_symbol_convert PARAMS ((struct local_symbol *));
/* Used for statistics. */
/* Create a local symbol and insert it into the local hash table. */
-static struct local_symbol *
+struct local_symbol *
local_symbol_make (name, section, value, frag)
const char *name;
segT section;
as_bad (_("cannot define symbol `%s' in absolute section"), sym_name);
return NULL;
}
-
+
possible_bytes = (md_short_jump_size
+ new_broken_words * md_long_jump_size);
if (mri_common_symbol != NULL)
{
/* This symbol is actually being defined within an MRI common
- section. This requires special handling. */
+ section. This requires special handling. */
if (LOCAL_SYMBOL_CHECK (symbolP))
symbolP = local_symbol_convert ((struct local_symbol *) symbolP);
symbolP->sy_value.X_op = O_symbol;
return (symbolP);
}
+symbolS *
+symbol_temp_new (seg, ofs, frag)
+ segT seg;
+ valueT ofs;
+ fragS *frag;
+{
+ return symbol_new (FAKE_LABEL_NAME, seg, ofs, frag);
+}
+
+symbolS *
+symbol_temp_new_now ()
+{
+ return symbol_temp_new (now_seg, frag_now_fix (), frag_now);
+}
+
+symbolS *
+symbol_temp_make ()
+{
+ return symbol_make (FAKE_LABEL_NAME);
+}
+
/* Implement symbol table lookup.
In: A symbol's name as a string: '\0' can't be part of a symbol name.
Out: NULL if the name was not in the symbol table, else the address
unsigned int line;
segT seg_left = S_GET_SEGMENT (left);
segT seg_right = right ? S_GET_SEGMENT (right) : 0;
-
+
if (expr_symbol_where (symp, &file, &line))
{
if (seg_left == undefined_section)
_("invalid section for operation on `%s'"),
S_GET_NAME (left));
}
-
+
}
else
{
if (op != O_logical_not && seg_left != absolute_section
&& finalize_syms)
report_op_error (symp, add_symbol, NULL);
-
+
if (final_seg == expr_section || final_seg == undefined_section)
final_seg = absolute_section;
-
+
if (op == O_uminus)
left = -left;
else if (op == O_logical_not)
&& (seg_left != undefined_section
|| add_symbol == op_symbol)))
report_op_error (symp, add_symbol, op_symbol);
-
+
if (final_seg == expr_section || final_seg == undefined_section)
final_seg = absolute_section;
static symbolS *recur;
/* FIXME: In non BFD assemblers, S_IS_DEFINED and S_IS_COMMON
- may call S_GET_VALUE. We use a static symbol to avoid the
- immediate recursion. */
+ may call S_GET_VALUE. We use a static symbol to avoid the
+ immediate recursion. */
if (recur == s)
return (valueT) s->sy_value.X_add_number;
recur = s;
s->sy_value = *exp;
}
+/* Set the value of SYM to the current position in the current segment. */
+
+void
+symbol_set_value_now (sym)
+ symbolS *sym;
+{
+ S_SET_SEGMENT (sym, now_seg);
+ S_SET_VALUE (sym, frag_now_fix ());
+ symbol_set_frag (sym, frag_now);
+}
+
/* Set the frag of a symbol. */
void