* config/tc-arm.c (md_apply_fix): Check if widened add, sub are

flag-setting and handle accordingly.

        * gas/arm/addsw-bad.s: New file.
        * gas/arm/addsw-bad.l: New file.
        * gas/arm/addsw-bad.d: New file.
This commit is contained in:
Nick Clifton 2010-09-09 09:09:43 +00:00
parent 95b75c0115
commit 40f246e36c
6 changed files with 35 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2010-09-09 Tejas Belagod <tejas.belagod@arm.com>
* config/tc-arm.c (md_apply_fix): Check if widened add, sub are
flag-setting and handle accordingly.
2010-09-09 Nick Clifton <nickc@redhat.com> 2010-09-09 Nick Clifton <nickc@redhat.com>
PR gas/11972 PR gas/11972

View File

@ -20252,17 +20252,20 @@ md_apply_fix (fixS * fixP,
/* Turn add/sum into addw/subw. */ /* Turn add/sum into addw/subw. */
if (fixP->fx_r_type == BFD_RELOC_ARM_T32_ADD_IMM) if (fixP->fx_r_type == BFD_RELOC_ARM_T32_ADD_IMM)
newval = (newval & 0xfeffffff) | 0x02000000; newval = (newval & 0xfeffffff) | 0x02000000;
/* No flat 12-bit imm encoding for addsw/subsw. */
/* 12 bit immediate for addw/subw. */ if ((newval & 0x00100000) == 0)
if (value < 0)
{ {
value = -value; /* 12 bit immediate for addw/subw. */
newval ^= 0x00a00000; if (value < 0)
{
value = -value;
newval ^= 0x00a00000;
}
if (value > 0xfff)
newimm = (unsigned int) FAIL;
else
newimm = value;
} }
if (value > 0xfff)
newimm = (unsigned int) FAIL;
else
newimm = value;
} }
if (newimm == (unsigned int)FAIL) if (newimm == (unsigned int)FAIL)

View File

@ -1,3 +1,9 @@
2010-09-09 Tejas Belagod <tejas.belagod@arm.com>
* gas/arm/addsw-bad.s: New file.
* gas/arm/addsw-bad.l: New file.
* gas/arm/addsw-bad.d: New file.
2010-09-03 H.J. Lu <hongjiu.lu@intel.com> 2010-09-03 H.J. Lu <hongjiu.lu@intel.com>
PR gas/11974 PR gas/11974

View File

@ -0,0 +1,3 @@
#name: Invalid Immediate field for flag-setting add,sub
#skip: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd
#error-output: addsw-bad.l

View File

@ -0,0 +1,3 @@
[^:]*: Assembler messages:
[^:]*:5: Error: invalid constant \(496\) after fixup
[^:]*:6: Error: invalid constant \(496\) after fixup

View File

@ -0,0 +1,6 @@
.text
.thumb
.cpu cortex-a8
.syntax unified
subs r4, r6, #0x496
adds r4, r6, #0x496