* config/tc-tic80.c (build_insn): Handle instructions that have
authorFred Fish <fnf@specifix.com>
Sat, 13 Dec 1997 00:58:43 +0000 (00:58 +0000)
committerFred Fish <fnf@specifix.com>
Sat, 13 Dec 1997 00:58:43 +0000 (00:58 +0000)
        long (32 bit) PC relative offsets.  Fix places that previously
        misused R_MPPCR for 15 bit offsets to use the new R_MPPCR15W type.
        (md_apply_fix): Add case to handle long PC relative offsets.
PR 12927

gas/ChangeLog
gas/config/tc-tic80.c

index 23a6bde01640ced2205eb4e3a9bf30eabfc4bdb6..bb094b88c38bc916b09c10ce473638767ab94076 100644 (file)
@@ -1,3 +1,12 @@
+start-sanitize-tic80
+Fri Dec 12 11:44:20 1997  Fred Fish  <fnf@cygnus.com>
+
+       * config/tc-tic80.c (build_insn): Handle instructions that have
+       long (32 bit) PC relative offsets.  Fix places that previously
+       misused R_MPPCR for 15 bit offsets to use the new R_MPPCR15W type.
+       (md_apply_fix): Add case to handle long PC relative offsets.
+
+end-sanitize-tic80
 Fri Dec 12 10:35:01 1997  Nick Clifton  <nickc@cygnus.com>
 
        * doc/c-arm.texi (ARM Options): Document support for new ARM
index 9c33eaa34ecf634465cb7427d6a5abb6bb0c684b..b77681d48d661c65cab38aed7a9db0f1eec03c3a 100644 (file)
@@ -635,26 +635,38 @@ build_insn (opcode, opers)
            }
          break;
        case O_symbol:
-         if (flags & TIC80_OPERAND_PCREL)
+         if (bits == 32)
+           {
+             fx = frag_more (4);
+             fxfrag = frag_now;
+             insn[1] = 0;
+             if (flags & TIC80_OPERAND_PCREL)
+               {
+                 fix_new_exp (fxfrag,
+                              fx - (fxfrag -> fr_literal),
+                              4,
+                              &opers[expi], 
+                              1,
+                              R_MPPCR);
+               }
+             else
+               {
+                 fix_new_exp (fxfrag,
+                              fx - (fxfrag -> fr_literal),
+                              4,
+                              &opers[expi], 
+                              0,
+                              R_RELLONGX);
+               }
+           }
+         else if (flags & TIC80_OPERAND_PCREL)
            {
              fix_new_exp (ffrag,
                           f - (ffrag -> fr_literal),
                           4,                   /* FIXME! how is this used? */
                           &opers[expi],
                           1,
-                          R_MPPCR);
-           }
-         else if (bits == 32)  /* was (flags & TIC80_OPERAND_BASEREL) */
-           {
-             fx = frag_more (4);
-             fxfrag = frag_now;
-             insn[1] = 0;
-             fix_new_exp (fxfrag,
-                          fx - (fxfrag -> fr_literal),
-                          4,
-                          &opers[expi], 
-                          0,
-                          R_RELLONGX);
+                          R_MPPCR15W);
            }
          else
            {
@@ -931,10 +943,17 @@ md_apply_fix (fixP, val)
       md_number_to_chars (dest, (valueT) val, 4);
       break;
     case R_MPPCR:
-      overflow = (val < -65536) || (val > 65532);
+      val >>= 2;
+      val += 1;          /* Target address computed from inst start */
+      md_number_to_chars (dest, (valueT) val, 4);
+      break;
+    case R_MPPCR15W:
+      overflow = (val < -65536L) || (val > 65532L);
       if (overflow)
        {
-         as_bad_where (fixP -> fx_file, fixP -> fx_line, "PC relative target out of range");
+         as_bad_where (fixP -> fx_file, fixP -> fx_line,
+                       "PC offset 0x%lx outside range 0x%lx-0x%lx",
+                       val, -65536L, 65532L);
        }
       else
        {