* config/tc-mips.c (mips16_extended_frag): Correct base address
authorIan Lance Taylor <ian@airs.com>
Thu, 13 Feb 1997 18:33:26 +0000 (18:33 +0000)
committerIan Lance Taylor <ian@airs.com>
Thu, 13 Feb 1997 18:33:26 +0000 (18:33 +0000)
for an extended PC relative instruction.
(md_convert_frag): Likewise.

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

index 9065228890e1086d96063c707a25cd8b4a53752a..3994c46c65e51ca6fc8872bcaeb70e81b0e8d447 100644 (file)
@@ -1,5 +1,9 @@
 Thu Feb 13 11:40:58 1997  Ian Lance Taylor  <ian@cygnus.com>
 
+       * config/tc-mips.c (mips16_extended_frag): Correct base address
+       for an extended PC relative instruction.
+       (md_convert_frag): Likewise.
+
        * config/tc-mips.c (prev_nop_frag): New static variable.
        (prev_nop_frag_holds): New static variable.
        (prev_nop_frag_required): New static variable.
index 07441b427d62d282cbcf0b4b392385e4be2ed4c6..8be02a11fc23c3ad7f416e9c5f6affebd0a76d6f 100644 (file)
@@ -9641,12 +9641,18 @@ mips16_extended_frag (fragp, sec, stretch)
       /* The base address rules are complicated.  The base address of
          a branch is the following instruction.  The base address of a
          PC relative load or add is the instruction itself, but if it
-         is extended add 2, and if it is in a delay slot (in which
-         case it can not be extended) use the address of the
-         instruction whose delay slot it is in.  */
+         is in a delay slot (in which case it can not be extended) use
+         the address of the instruction whose delay slot it is in.  */
       if (type == 'p' || type == 'q')
        {
          addr += 2;
+
+         /* If we are currently assuming that this frag should be
+            extended, then, the current address is two bytes
+            higher. */
+         if (RELAX_MIPS16_EXTENDED (fragp->fr_subtype))
+           addr += 2;
+
          /* Ignore the low bit in the target, since it will be set
              for a text label.  */
          if ((val & 1) != 0)
@@ -9657,11 +9663,6 @@ mips16_extended_frag (fragp, sec, stretch)
       else if (RELAX_MIPS16_DSLOT (fragp->fr_subtype))
        addr -= 2;
 
-      /* If we are currently assuming that this frag should be
-         extended, then the current address is two bytes higher.  */
-      if (RELAX_MIPS16_EXTENDED (fragp->fr_subtype))
-       addr += 2;
-
       val -= addr & ~ ((1 << op->shift) - 1);
 
       /* Branch offsets have an implicit 0 in the lowest bit.  */
@@ -10080,6 +10081,8 @@ md_convert_frag (abfd, asec, fragp)
          if (type == 'p' || type == 'q')
            {
              addr += 2;
+             if (ext)
+               addr += 2;
              /* Ignore the low bit in the target, since it will be
                  set for a text label.  */
              if ((val & 1) != 0)
@@ -10090,8 +10093,6 @@ md_convert_frag (abfd, asec, fragp)
          else if (RELAX_MIPS16_DSLOT (fragp->fr_subtype))
            addr -= 2;
 
-         if (ext)
-           addr += 2;
          addr &= ~ (addressT) ((1 << op->shift) - 1);
          val -= addr;
 
This page took 0.032538 seconds and 4 git commands to generate.