If the target does not support an ELF style has table, return true, indicating
[deliverable/binutils-gdb.git] / gas / config / tc-sh.c
index 8bb72bd146ab8ad9e526d1ae7ea8040a3ee8a283..e62a6f95bd0c9b92c1f83e984161582afc14ed42 100644 (file)
@@ -1383,10 +1383,33 @@ parse_at (src, op)
                }
              else if (mode == A_PC)
                {
-                 op->type = A_DISP_PC_ABS;
-                 /* Such operands don't get corrected for PC==.+4, so
-                    make the correction here.  */
-                 op->immediate.X_add_number -= 4;
+                 /* We want @(expr, pc) to uniformly address . + expr,
+                    no matter if expr is a constant, or a more complex
+                    expression, e.g. sym-. or sym1-sym2.
+                    However, we also used to accept @(sym,pc)
+                    as adressing sym, i.e. meaning the same as plain sym.
+                    Some existing code does use the @(sym,pc) syntax, so
+                    we give it the old semantics for now, but warn about
+                    its use, so that users have some time to fix their code.
+
+                    Note that due to this backward compatibility hack,
+                    we'll get unexpected results when @(offset, pc) is used,
+                    and offset is a symbol that is set later to an an address
+                    difference, or an external symbol that is set to an
+                    address difference in another source file, so we want to
+                    eventually remove it.  */
+                 if (op->immediate.X_op == O_symbol)
+                   {
+                     op->type = A_DISP_PC;
+                     as_warn (_("Deprecated syntax."));
+                   }
+                 else
+                   {
+                     op->type = A_DISP_PC_ABS;
+                     /* Such operands don't get corrected for PC==.+4, so
+                        make the correction here.  */
+                     op->immediate.X_add_number -= 4;
+                   }
                }
              else
                {
@@ -2124,6 +2147,7 @@ assemble_ppi (op_end, opcode)
      Make sure we encode a defined insn pattern.  */
   reg_x = 0;
   reg_y = 0;
+  reg_n = 0;
 
   for (;;)
     {
@@ -2474,14 +2498,14 @@ md_undefined_symbol (name)
 
 void
 tc_crawl_symbol_chain (headers)
-     object_headers *headers;
+     object_headers *headers ATTRIBUTE_UNUSED;
 {
   printf (_("call to tc_crawl_symbol_chain \n"));
 }
 
 void
 tc_headers_hook (headers)
-     object_headers *headers;
+     object_headers *headers ATTRIBUTE_UNUSED;
 {
   printf (_("call to tc_headers_hook \n"));
 }
@@ -2578,7 +2602,7 @@ s_uses (ignore)
   demand_empty_rest_of_line ();
 }
 \f
-CONST char *md_shortopts = "";
+const char *md_shortopts = "";
 struct option md_longopts[] =
 {
 #define OPTION_RELAX  (OPTION_MD_BASE)
@@ -2924,7 +2948,7 @@ md_convert_frag (headers, seg, fragP)
 #ifdef BFD_ASSEMBLER
      bfd *headers ATTRIBUTE_UNUSED;
 #else
-     object_headers *headers;
+     object_headers *headers ATTRIBUTE_UNUSED;
 #endif
      segT seg;
      fragS *fragP;
@@ -3680,6 +3704,16 @@ md_number_to_chars (ptr, use, nbytes)
     number_to_chars_bigendian (ptr, use, nbytes);
 }
 
+/* This version is used in obj-coff.c when not using BFD_ASSEMBLER.
+   eg for the sh-hms target.  */
+
+long
+md_pcrel_from (fixP)
+     fixS *fixP;
+{
+  return fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address + 2;
+}
+
 long
 md_pcrel_from_section (fixP, sec)
      fixS *fixP;
@@ -3698,7 +3732,7 @@ md_pcrel_from_section (fixP, sec)
       return fixP->fx_subsy ? fixP->fx_where + fixP->fx_frag->fr_address : 0;
     }
 
-  return fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address + 2;
+  return md_pcrel_from (fixP);
 }
 
 #ifdef OBJ_COFF
This page took 0.025096 seconds and 4 git commands to generate.