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]

[patch] Thumb blx disassembly


The Thumb blx instruction always jumps to a word (4 byte) aligned address.  
The attached patch fixes the disassembler output.

Tested with cross to arm-none-eabi.
Ok?

Paul

2005-11-02  Paul Brook  <paul@codesourcery.com>

	* arm-dis.c (print_insn_thumb32): Word align blx target address.
Index: opcodes/arm-dis.c
===================================================================
RCS file: /var/cvsroot/src-cvs/src/opcodes/arm-dis.c,v
retrieving revision 1.59
diff -u -p -r1.59 arm-dis.c
--- opcodes/arm-dis.c	31 Oct 2005 06:10:33 -0000	1.59
+++ opcodes/arm-dis.c	2 Nov 2005 14:34:04 -0000
@@ -2607,8 +2607,13 @@ print_insn_thumb32 (bfd_vma pc, struct d
 		  offset |= (given & 0x03ff0000u) >> 4;
 		  offset |= (given & 0x000007ffu) << 1;
 		  offset -= (1 << 24);
+		  offset += pc + 4;
 
-		  info->print_address_func (pc + 4 + offset, info);
+		  /* BLX target addresses are always word aligned.  */
+		  if ((given & 0x00001000u) == 0)
+		      offset &= ~2u;
+
+		  info->print_address_func (offset, info);
 		}
 		break;
 

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