offline: Extracting target pc address for aarch64 gprof support.

Alan Modra amodra@gmail.com
Fri May 24 00:57:00 GMT 2013


On Thu, May 23, 2013 at 03:14:57PM +0530, Venkataramanan Kumar wrote:
> Hi Alan,
> 
> The tweak you made for getting the pc address from branch instruction,
> is not working well when destination  is a backward address.
> 
> offset = (((insn & 0x3ffffff) ^ 0x2000000) - 0x2000000) << 2;)
> dest_pc = pc + offset;

Oops.  insn is 32 bits, that's why.  I should have left well enough
alone.  I made the change just to make the value of "offset" really
an offset.  Sorry.

	* aarch64.c (aarch64_find_call): Promote to bfd_vma before sign
	extending.

Index: gprof/aarch64.c
===================================================================
RCS file: /cvs/src/src/gprof/aarch64.c,v
retrieving revision 1.1
diff -u -p -r1.1 aarch64.c
--- gprof/aarch64.c	22 May 2013 13:29:43 -0000	1.1
+++ gprof/aarch64.c	24 May 2013 00:17:26 -0000
@@ -68,7 +68,7 @@ aarch64_find_call (Sym *parent, bfd_vma 
 
 	  /* Regular pc relative addressing check that this is the
 	     address of a function.  */
-	  offset = (((insn & 0x3ffffff) ^ 0x2000000) - 0x2000000) << 2;
+	  offset = ((((bfd_vma) insn & 0x3ffffff) ^ 0x2000000) - 0x2000000) << 2;
 
 	  dest_pc = pc + offset;
 

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list