Resolve PR 22493 - the encoding to be used when pushing the stack pointer onto the...
authorNick Clifton <nickc@redhat.com>
Mon, 18 Dec 2017 09:37:57 +0000 (09:37 +0000)
committerNick Clifton <nickc@redhat.com>
Mon, 18 Dec 2017 09:37:57 +0000 (09:37 +0000)
PR 22493
* config/tc-arm.c (encode_ldmstm): Do not use A2 encoding of the
PUSH insn when pushing the stack pointer.

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

index d495548cd8235300d055231dc9f22502d8130c9b..ed794be67619ab8446ba06adedab5074c954f175 100644 (file)
@@ -1,3 +1,9 @@
+2017-12-18  Nick Clifton  <nickc@redhat.com>
+
+       PR 22493
+       * config/tc-arm.c (encode_ldmstm): Do not use A2 encoding of the
+       PUSH insn when pushing the stack pointer.
+
 2017-12-18  Jan Beulich  <jbeulich@suse.com>
 
        * config/tc-i386.c (regymm, regzmm): Delete.
index 080e4dae1c73148f2bedf791dae0ecd551942c5d..c12a45341245365db15ce5a5917c475a0be646ab 100644 (file)
@@ -8908,6 +8908,11 @@ encode_ldmstm(int from_push_pop_mnem)
     {
       int is_push = (inst.instruction & A_PUSH_POP_OP_MASK) == A1_OPCODE_PUSH;
 
+      if (is_push && one_reg == 13 /* SP */)
+       /* PR 22483: The A2 encoding cannot be used when
+          pushing the stack pointer as this is UNPREDICTABLE.  */
+       return;
+
       inst.instruction &= A_COND_MASK;
       inst.instruction |= is_push ? A2_OPCODE_PUSH : A2_OPCODE_POP;
       inst.instruction |= one_reg << 12;