This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: offline: Extracting target pc address for aarch64 gprof support.
- From: Alan Modra <amodra at gmail dot com>
- To: Venkataramanan Kumar <venkataramanan dot kumar at linaro dot org>, binutils at sourceware dot org
- Date: Fri, 24 May 2013 10:27:08 +0930
- Subject: Re: offline: Extracting target pc address for aarch64 gprof support.
- References: <CAJK_mQ1McDDGhWkstR13UVf1sPSTmdhW76hnA8qo+XGmb2tYsQ at mail dot gmail dot com> <20130524002640 dot GS9651 at bubble dot grove dot modra dot org>
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