aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1997-02-13 18:33:26 +0000
committerIan Lance Taylor <ian@airs.com>1997-02-13 18:33:26 +0000
commit319305a75ffc84daa8f8649338ffdbc26566e18b (patch)
tree4d2073bcfcb4211efe59ff2beede1f0c7abc2a68 /gas/config
parent6617b927dad54dbc1e8c1336db747e6725b494a4 (diff)
downloadgdb-319305a75ffc84daa8f8649338ffdbc26566e18b.zip
gdb-319305a75ffc84daa8f8649338ffdbc26566e18b.tar.gz
gdb-319305a75ffc84daa8f8649338ffdbc26566e18b.tar.bz2
* config/tc-mips.c (mips16_extended_frag): Correct base address
for an extended PC relative instruction. (md_convert_frag): Likewise.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-mips.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 07441b4..8be02a1 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -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;