]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* symbols.c (symbol_clone_if_forward_ref): Call tc_new_dot_label
authorMaciej W. Rozycki <macro@linux-mips.org>
Thu, 16 Dec 2010 18:48:28 +0000 (18:48 +0000)
committerMaciej W. Rozycki <macro@linux-mips.org>
Thu, 16 Dec 2010 18:48:28 +0000 (18:48 +0000)
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.

gas/ChangeLog
gas/config/tc-mips.c
gas/config/tc-mips.h
gas/doc/internals.texi
gas/symbols.c

index ae54fcab29225dd55a2b83f516a53d197028ed97..f16fbbc9da244c255443400a74518126c2198c3d 100644 (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.
index a414c3ac12e0f462c756360cb980da9e3ca02132..65d198913b18adcf70fe0e205003ada9ebdf4f49 100644 (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
index abd8d1e5160d4766825382c19ac52349428e2386..3da94ada710f3fe3f32faae013d46cf1a2a385fa 100644 (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);
 
index f8495a9196237898212df646c6469ad0db89fd92..58b56868cee7e131f44d0d857ce61f9989fd0db5 100644 (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
index 4e4ad775b3b7bb3c8a93aeb10d524345e0a09818..9a4e2bef54dc7abcfebdd9eb8621317d35d3c9f2 100644 (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;