Thank fangrui and James<br>I will try this solution<br>
<br>----- Original Message -----
<br>From: "F¨¡ng-ru¨¬ S¨°ng" <maskray@google.com>
<br>To: "James Henderson" <jh7370.2008@my.bristol.ac.uk>
<br>Cc: Haishan <hndxvon@163.com>, llvm-dev <llvm-dev@lists.llvm.org>
<br>Sent: Mon, 14 Dec 2020 13:31:31 -0800
<br>Subject: Re: [llvm-dev] How to get absolute address of llvm-objdump
<br>
<br>This needs an AArch64InstPrinter change. Sent https://reviews.llvm.org/D93241
<br>
<br>adr may need a similar change as well.
<br>
<br>On Mon, Dec 14, 2020 at 12:53 AM James Henderson
<br><jh7370.2008@my.bristol.ac.uk> wrote:
<br>>
<br>> Hi,
<br>>
<br>> I thought this was something that somebody had looked at a while back, but I can't immediately find it. I've explicitly CC'ed Fangrui Song, who has made a number of disassembly improvements in the past year. He may be able to help.
<br>>
<br>> James
<br>>
<br>> On Sat, 12 Dec 2020 at 08:57, Haishan via llvm-dev <llvm-dev@lists.llvm.org> wrote:
<br>>>
<br>>>
<br>>> I used llvm-objdump to dump aarch64 binary, but it prints relative address of .rodata section in adrp instruction.
<br>>>
<br>>> Like:
<br>>>
<br>>> llvm-objdump
<br>>>
<br>>> 400848: 02 00 00 90 adrp x2, #0x0
<br>>>
<br>>> 40084c: 42 60 29 91 add x2, x2, #0xa58
<br>>>
<br>>> 400850: 44 48 63 38 ldrb w4, [x2, w3, uxtw]
<br>>>
<br>>> 400854: 65 00 00 10 adr x5, #0xc
<br>>>
<br>>> 400858: a4 88 24 8b add x4, x5, w4, sxtb #2
<br>>>
<br>>> 40085c: 80 00 1f d6 br x4
<br>>>
<br>>> Moreover, when debug llvm-objdump binary, this adrp MCInst express by MCExpr which Kind is MCExpr::Target, not immediate.
<br>>>
<br>>>
<br>>>
<br>>> But I used objdump tools of binutils, it prints absolute address. Such as:
<br>>>
<br>>> 400848: 90000002 adrp x2, 400000 <_init-0x518>
<br>>>
<br>>> 40084c: 91296042 add x2, x2, #0xa58
<br>>>
<br>>> 400850: 38634844 ldrb w4, [x2,w3,uxtw]
<br>>>
<br>>> 400854: 10000065 adr x5, 400860 <local+0x48>
<br>>>
<br>>> 400858: 8b2488a4 add x4, x5, w4, sxtb #2
<br>>>
<br>>> 40085c: d61f0080 br x4
<br>>>
<br>>> So How to get absolute address with llvm MCInst?
<br>>>
<br>>> _______________________________________________
<br>>> LLVM Developers mailing list
<br>>> llvm-dev@lists.llvm.org
<br>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
<br>
<br>
<br>
<br>--
<br>Ëη½î£
<br>