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]

[RFA/ARM] Fix bug with handling of BKPT and IT blocks.


All,

The attached patch fixes a bug in gas with respect to its handling of BKPT instructions inside IT blocks.

BKPT instructions are always unconditional even inside an IT block.

Gas correctly handles this when an immediate is specified for the BKPT instruction, but does not when the immediate is omitted.

OK?

gas/ChangeLog:
2012-06-06  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>

	* config/tc-arm.c (do_t_bkpt): Handle IT state even if there is
	no argument.

gas/testsuite/ChangeLog:
2012-06-06  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>

	* gas/arm/thumb2_bcond.d: Test bkpt with no arguments.
	* gas/arm/thumb2_bcond.s: Likewise.

Thanks,

Matt

--
Matthew Gretton-Dann
Principal Engineer, PD Software - Tools, ARM Ltd
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 6ff64a6..cb3a1f0 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -10090,8 +10090,9 @@ do_t_bkpt (void)
       constraint (inst.operands[0].imm > 255,
 		  _("immediate value out of range"));
       inst.instruction |= inst.operands[0].imm;
-      set_it_insn_type (NEUTRAL_IT_INSN);
     }
+
+  set_it_insn_type (NEUTRAL_IT_INSN);
 }
 
 static void
diff --git a/gas/testsuite/gas/arm/thumb2_bcond.d b/gas/testsuite/gas/arm/thumb2_bcond.d
index be4605e..574a8de 100644
--- a/gas/testsuite/gas/arm/thumb2_bcond.d
+++ b/gas/testsuite/gas/arm/thumb2_bcond.d
@@ -24,4 +24,7 @@ Disassembly of section .text:
 0+0.. <[^>]+> be00[ 	]+bkpt	0x0000
 0+0.. <[^>]+> bf00[ 	]+nople
 0+0.. <[^>]+> bf00[ 	]+nop
+0+0.. <[^>]+> bf00[ 	]+nop
+0+0.. <[^>]+> bf18[ 	]+it	ne
+0+0.. <[^>]+> be00[ 	]+bkpt	0x0000
 #...
diff --git a/gas/testsuite/gas/arm/thumb2_bcond.s b/gas/testsuite/gas/arm/thumb2_bcond.s
index aef6e8f..2dae0e3 100644
--- a/gas/testsuite/gas/arm/thumb2_bcond.s
+++ b/gas/testsuite/gas/arm/thumb2_bcond.s
@@ -25,3 +25,5 @@ thumb2_bcond:
 	nople
 	nop
 	nop
+	it ne
+	bkpt

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