* symbols.c (symbol_clone_if_forward_ref): Call tc_new_dot_label

for new fake labels created off the dot special symbol.
	* config/tc-mips.h (tc_new_dot_label): New macro.
	(mips_record_label): New prototype.
	* config/tc-mips.c (my_getExpression): Remove MIPS16 fake label
	annotation.
	(s_cons, s_float_cons, s_gpword, s_gpdword): Only clear labels
	recorded once data expressions have been evaluated.
	(mips_define_label): Move code to record labels over to...
	(mips_record_label): ... this new function.
	* doc/internals.texi: Document tc_new_dot_label.
This commit is contained in:
Maciej W. Rozycki 2010-12-16 18:48:28 +00:00
parent f8e9a93000
commit a1facbec7a
5 changed files with 46 additions and 24 deletions

View File

@ -1,3 +1,17 @@
2010-12-16 Maciej W. Rozycki <macro@codesourcery.com>
* symbols.c (symbol_clone_if_forward_ref): Call tc_new_dot_label
for new fake labels created off the dot special symbol.
* config/tc-mips.h (tc_new_dot_label): New macro.
(mips_record_label): New prototype.
* config/tc-mips.c (my_getExpression): Remove MIPS16 fake label
annotation.
(s_cons, s_float_cons, s_gpword, s_gpdword): Only clear labels
recorded once data expressions have been evaluated.
(mips_define_label): Move code to record labels over to...
(mips_record_label): ... this new function.
* doc/internals.texi: Document tc_new_dot_label.
2010-12-10 Maciej W. Rozycki <macro@codesourcery.com>
* config/tc-mips.h (TC_ADDRESS_BYTES): New macro.

View File

@ -11136,26 +11136,12 @@ static void
my_getExpression (expressionS *ep, char *str)
{
char *save_in;
valueT val;
save_in = input_line_pointer;
input_line_pointer = str;
expression (ep);
expr_end = input_line_pointer;
input_line_pointer = save_in;
/* If we are in mips16 mode, and this is an expression based on `.',
then we bump the value of the symbol by 1 since that is how other
text symbols are handled. We don't bother to handle complex
expressions, just `.' plus or minus a constant. */
if (mips_opts.mips16
&& ep->X_op == O_symbol
&& strcmp (S_GET_NAME (ep->X_add_symbol), FAKE_LABEL_NAME) == 0
&& S_GET_SEGMENT (ep->X_add_symbol) == now_seg
&& symbol_get_frag (ep->X_add_symbol) == frag_now
&& symbol_constant_p (ep->X_add_symbol)
&& (val = S_GET_VALUE (ep->X_add_symbol)) == frag_now_fix ())
S_SET_VALUE (ep->X_add_symbol, val + 1);
}
char *
@ -12726,8 +12712,8 @@ s_cons (int log_size)
mips_emit_delays ();
if (log_size > 0 && auto_align)
mips_align (log_size, 0, label);
mips_clear_insn_labels ();
cons (1 << log_size);
mips_clear_insn_labels ();
}
static void
@ -12749,9 +12735,8 @@ s_float_cons (int type)
mips_align (2, 0, label);
}
mips_clear_insn_labels ();
float_cons (type);
mips_clear_insn_labels ();
}
/* Handle .globl. We need to override it because on Irix 5 you are
@ -13516,9 +13501,9 @@ s_gpword (int ignore ATTRIBUTE_UNUSED)
mips_emit_delays ();
if (auto_align)
mips_align (2, 0, label);
mips_clear_insn_labels ();
expression (&ex);
mips_clear_insn_labels ();
if (ex.X_op != O_symbol || ex.X_add_number != 0)
{
@ -13556,9 +13541,9 @@ s_gpdword (int ignore ATTRIBUTE_UNUSED)
mips_emit_delays ();
if (auto_align)
mips_align (3, 0, label);
mips_clear_insn_labels ();
expression (&ex);
mips_clear_insn_labels ();
if (ex.X_op != O_symbol || ex.X_add_number != 0)
{
@ -14706,12 +14691,14 @@ mips_frob_file_after_relocs (void)
#endif
/* This function is called whenever a label is defined. It is used
when handling branch delays; if a branch has a label, we assume we
can not move it. */
/* This function is called whenever a label is defined, including fake
labels instantiated off the dot special symbol. It is used when
handling branch delays; if a branch has a label, we assume we cannot
move it. This also bumps the value of the symbol by 1 in compressed
code. */
void
mips_define_label (symbolS *sym)
mips_record_label (symbolS *sym)
{
segment_info_type *si = seg_info (now_seg);
struct insn_label_list *l;
@ -14727,7 +14714,15 @@ mips_define_label (symbolS *sym)
l->label = sym;
l->next = si->label_list;
si->label_list = l;
}
/* This function is called as tc_frob_label() whenever a label is defined
and adds a DWARF-2 record we only want for true labels. */
void
mips_define_label (symbolS *sym)
{
mips_record_label (sym);
#ifdef OBJ_ELF
dwarf2_emit_label (sym);
#endif

View File

@ -112,6 +112,9 @@ extern int mips_parse_long_option (const char *);
#define tc_frob_label(sym) mips_define_label (sym)
extern void mips_define_label (symbolS *);
#define tc_new_dot_label(sym) mips_record_label (sym)
extern void mips_record_label (symbolS *);
#define tc_frob_file_before_adjust() mips_frob_file_before_adjust ()
extern void mips_frob_file_before_adjust (void);

View File

@ -1395,6 +1395,11 @@ that @code{md_pcrel_from} does not take a section argument.
@cindex tc_frob_label
If you define this macro, GAS will call it each time a label is defined.
@item tc_new_dot_label
@cindex tc_new_dot_label
If you define this macro, GAS will call it each time a fake label is created
off the special dot symbol.
@item md_section_align
@cindex md_section_align
GAS will call this function for each section at the end of the assembly, to

View File

@ -668,7 +668,12 @@ symbol_clone_if_forward_ref (symbolS *symbolP, int is_forward)
symbolP->sy_resolving = 0;
}
else
symbolP = symbol_temp_new_now ();
{
symbolP = symbol_temp_new_now ();
#ifdef tc_new_dot_label
tc_new_dot_label (symbolP);
#endif
}
}
symbolP->sy_value.X_add_symbol = add_symbol;