From: Ian Lance Taylor Date: Thu, 13 Feb 1997 18:33:26 +0000 (+0000) Subject: * config/tc-mips.c (mips16_extended_frag): Correct base address X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=319305a75ffc84daa8f8649338ffdbc26566e18b;p=binutils-gdb.git * config/tc-mips.c (mips16_extended_frag): Correct base address for an extended PC relative instruction. (md_convert_frag): Likewise. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 9065228890e..3994c46c65e 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,9 @@ Thu Feb 13 11:40:58 1997 Ian Lance Taylor + * 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. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 07441b427d6..8be02a11fc2 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;