This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Thumb-2 sub sp, sp, #const misassembly


Patch below fixes misassembly of the 32-bit Thumb-2 form of

  sub sp, sp, #const

Previously it would be encoded as subs.

Paul

2007-03-14  Paul Brook  <paul@codesourcery.com>

	gas/
	* config/tc-arm.c (T16_32_TAB): Fix dec_sp encoding.

	gas/testsuite/
	* gas/arm/thumb2_add.d: Add tests using sp.
	* gas/arm/thumb2_add.s: Ditto.

Index: gas/config/tc-arm.c
===================================================================
--- gas/config/tc-arm.c	(revision 165757)
+++ gas/config/tc-arm.c	(working copy)
@@ -8242,7 +8242,7 @@ encode_thumb32_addr_mode (int i, bfd_boo
   X(cpsie, b660, f3af8400),			\
   X(cpsid, b670, f3af8600),			\
   X(cpy,   4600, ea4f0000),			\
-  X(dec_sp,80dd, f1bd0d00),			\
+  X(dec_sp,80dd, f1ad0d00),			\
   X(eor,   4040, ea800000),			\
   X(eors,  4040, ea900000),			\
   X(inc_sp,00dd, f10d0d00),			\
Index: gas/testsuite/gas/arm/thumb2_add.d
===================================================================
--- gas/testsuite/gas/arm/thumb2_add.d	(revision 165757)
+++ gas/testsuite/gas/arm/thumb2_add.d	(working copy)
@@ -18,3 +18,13 @@ Disassembly of section .text:
 0+02c <[^>]+> f2a1 1301 	subw	r3, r1, #257	; 0x101
 0+030 <[^>]+> f103 0301 	add.w	r3, r3, #1	; 0x1
 0+034 <[^>]+> f1a3 0301 	sub.w	r3, r3, #1	; 0x1
+0+038 <[^>]+> b0c0      	sub	sp, #256
+0+03a <[^>]+> f5ad 7d00 	sub.w	sp, sp, #512	; 0x200
+0+03e <[^>]+> f2ad 1d01 	subw	sp, sp, #257	; 0x101
+0+042 <[^>]+> b040      	add	sp, #256
+0+044 <[^>]+> f50d 7d00 	add.w	sp, sp, #512	; 0x200
+0+048 <[^>]+> f20d 1d01 	addw	sp, sp, #257	; 0x101
+0+04c <[^>]+> a840      	add	r0, sp, #256
+0+04e <[^>]+> f50d 6580 	add.w	r5, sp, #1024	; 0x400
+0+052 <[^>]+> f20d 1901 	addw	r9, sp, #257	; 0x101
+0+056 <[^>]+> bf00      	nop
Index: gas/testsuite/gas/arm/thumb2_add.s
===================================================================
--- gas/testsuite/gas/arm/thumb2_add.s	(revision 165757)
+++ gas/testsuite/gas/arm/thumb2_add.s	(working copy)
@@ -20,3 +20,13 @@ thumb2_add:
 	sub r3, r1, #0x101
 	add r3, #1
 	sub r3, #1
+	sub sp, sp, #0x100
+	sub sp, sp, #0x200
+	sub sp, sp, #0x101
+	add sp, sp, #0x100
+	add sp, sp, #0x200
+	add sp, sp, #0x101
+	add r0, sp, #0x100
+	add r5, sp, #0x400
+	add r9, sp, #0x101
+	nop


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]