From: Nick Clifton Date: Thu, 9 Sep 2010 09:09:43 +0000 (+0000) Subject: * config/tc-arm.c (md_apply_fix): Check if widened add, sub are X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=40f246e36c27a521661a926536e1cfceb18cd957;p=binutils-gdb.git * 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. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index cef0c184b41..ff4f4a87bb6 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2010-09-09 Tejas Belagod + + * config/tc-arm.c (md_apply_fix): Check if widened add, sub are + flag-setting and handle accordingly. + 2010-09-09 Nick Clifton PR gas/11972 diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index ce32aef54e0..50df78a2444 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -20252,17 +20252,20 @@ md_apply_fix (fixS * fixP, /* Turn add/sum into addw/subw. */ if (fixP->fx_r_type == BFD_RELOC_ARM_T32_ADD_IMM) newval = (newval & 0xfeffffff) | 0x02000000; - - /* 12 bit immediate for addw/subw. */ - if (value < 0) + /* No flat 12-bit imm encoding for addsw/subsw. */ + if ((newval & 0x00100000) == 0) { - value = -value; - newval ^= 0x00a00000; + /* 12 bit immediate for addw/subw. */ + 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) diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 73eee887d5b..8d50f3c222e 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2010-09-09 Tejas Belagod + + * 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 PR gas/11974 diff --git a/gas/testsuite/gas/arm/addsw-bad.d b/gas/testsuite/gas/arm/addsw-bad.d new file mode 100644 index 00000000000..686570257f2 --- /dev/null +++ b/gas/testsuite/gas/arm/addsw-bad.d @@ -0,0 +1,3 @@ +#name: Invalid Immediate field for flag-setting add,sub +#skip: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd +#error-output: addsw-bad.l diff --git a/gas/testsuite/gas/arm/addsw-bad.l b/gas/testsuite/gas/arm/addsw-bad.l new file mode 100644 index 00000000000..fa62b95a008 --- /dev/null +++ b/gas/testsuite/gas/arm/addsw-bad.l @@ -0,0 +1,3 @@ +[^:]*: Assembler messages: +[^:]*:5: Error: invalid constant \(496\) after fixup +[^:]*:6: Error: invalid constant \(496\) after fixup diff --git a/gas/testsuite/gas/arm/addsw-bad.s b/gas/testsuite/gas/arm/addsw-bad.s new file mode 100644 index 00000000000..69013be8db1 --- /dev/null +++ b/gas/testsuite/gas/arm/addsw-bad.s @@ -0,0 +1,6 @@ +.text +.thumb +.cpu cortex-a8 +.syntax unified +subs r4, r6, #0x496 +adds r4, r6, #0x496