Bug 12752

Summary: wrong symbol in branch disassembly
Product: binutils Reporter: mcspang
Component: binutilsAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: j3parker, mcspang, nickc
Priority: P2    
Version: 2.22   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Attachments: change to unsigned to prevent sign extension

Description mcspang 2011-05-11 19:36:31 UTC
Disassembly of some thumb branches results in the wrong symbol being printed:

80000024:       f000 e91e       blx     80000264 <__aeabi_idiv0+0xfffff53c>

The problem is that the 32-bit address is sign extended when passed to print_address_func.

This might occur in other code paths as well.
Comment 1 mcspang 2011-05-11 19:38:38 UTC
Created attachment 5717 [details]
change to unsigned to prevent sign extension
Comment 2 cvs-commit@gcc.gnu.org 2011-06-03 10:04:05 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	nickc@sourceware.org	2011-06-03 10:04:03

Modified files:
	opcodes        : ChangeLog arm-dis.c 

Log message:
	PR binutils/12752
	* arm-dis.c (print_insn_coprocessor): Use bfd_vma type for
	computing address offsets.
	(print_arm_address): Likewise.
	(print_insn_arm): Likewise.
	(print_insn_thumb16): Likewise.
	(print_insn_thumb32): Likewise.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/ChangeLog.diff?cvsroot=src&r1=1.1729&r2=1.1730
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/arm-dis.c.diff?cvsroot=src&r1=1.145&r2=1.146
Comment 3 Nick Clifton 2011-06-03 10:05:47 UTC
Hi,

  Thanks for reporting this problem and suggesting a fix.  The correct solution however is to use the bfd_vma type when computing address offsets, as this will prevent any extension, signed or otherwise.  I have checked in a patch to do this.

Cheers
  Nick