aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2010-12-16 18:48:28 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2010-12-16 18:48:28 +0000
commita1facbec7a584827dc10d1e3afc326e8653de4ac (patch)
tree4218d509ac25e1c8f2b067a980198f734f6c7dca /gas
parentf8e9a93000a380b2d82e02d362127962419567fa (diff)
downloadgdb-a1facbec7a584827dc10d1e3afc326e8653de4ac.zip
gdb-a1facbec7a584827dc10d1e3afc326e8653de4ac.tar.gz
gdb-a1facbec7a584827dc10d1e3afc326e8653de4ac.tar.bz2
* 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.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog14
-rw-r--r--gas/config/tc-mips.c41
-rw-r--r--gas/config/tc-mips.h3
-rw-r--r--gas/doc/internals.texi5
-rw-r--r--gas/symbols.c7
5 files changed, 46 insertions, 24 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index ae54fca..f16fbbc 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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.
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index a414c3a..65d1989 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -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
diff --git a/gas/config/tc-mips.h b/gas/config/tc-mips.h
index abd8d1e..3da94ad 100644
--- a/gas/config/tc-mips.h
+++ b/gas/config/tc-mips.h
@@ -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);
diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi
index f8495a9..58b5686 100644
--- a/gas/doc/internals.texi
+++ b/gas/doc/internals.texi
@@ -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
diff --git a/gas/symbols.c b/gas/symbols.c
index 4e4ad77..9a4e2be 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -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;