Haishan via llvm-dev
2020-Dec-12 08:57 UTC
[llvm-dev] How to get absolute address of llvm-objdump
I used llvm-objdump to dump aarch64 binary, but it prints relative address of .rodata section in adrp instruction. Like: llvm-objdump 400848: 02 00 00 90 adrp x2, #0x0 40084c: 42 60 29 91 add x2, x2, #0xa58 400850: 44 48 63 38 ldrb w4, [x2, w3, uxtw] 400854: 65 00 00 10 adr x5, #0xc 400858: a4 88 24 8b add x4, x5, w4, sxtb #2 40085c: 80 00 1f d6 br x4 Moreover, when debug llvm-objdump binary, this adrp MCInst express by MCExpr which Kind is MCExpr::Target, not immediate. But I used objdump tools of binutils, it prints absolute address. Such as: 400848: 90000002 adrp x2, 400000 <_init-0x518> 40084c: 91296042 add x2, x2, #0xa58 400850: 38634844 ldrb w4, [x2,w3,uxtw] 400854: 10000065 adr x5, 400860 <local+0x48> 400858: 8b2488a4 add x4, x5, w4, sxtb #2 40085c: d61f0080 br x4 So How to get absolute address with llvm MCInst? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201212/14e4393f/attachment.html>
James Henderson via llvm-dev
2020-Dec-14 08:53 UTC
[llvm-dev] How to get absolute address of llvm-objdump
Hi, 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. James On Sat, 12 Dec 2020 at 08:57, Haishan via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > I used llvm-objdump to dump aarch64 binary, but it prints relative address > of .rodata section in adrp instruction. > > Like: > > llvm-objdump > > 400848: 02 00 00 90 adrp x2, #0x0 > > 40084c: 42 60 29 91 add x2, x2, #0xa58 > > 400850: 44 48 63 38 ldrb w4, [x2, w3, uxtw] > > 400854: 65 00 00 10 adr x5, #0xc > > 400858: a4 88 24 8b add x4, x5, w4, sxtb #2 > > 40085c: 80 00 1f d6 br x4 > > Moreover, when debug llvm-objdump binary, this adrp MCInst express by > MCExpr which Kind is MCExpr::Target, not immediate. > > > > But I used objdump tools of binutils, it prints absolute address. Such as: > > 400848: 90000002 adrp x2, 400000 <_init-0x518> > > 40084c: 91296042 add x2, x2, #0xa58 > > 400850: 38634844 ldrb w4, [x2,w3,uxtw] > > 400854: 10000065 adr x5, 400860 <local+0x48> > > 400858: 8b2488a4 add x4, x5, w4, sxtb #2 > > 40085c: d61f0080 br x4 > > So How to get absolute address with llvm MCInst? > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201214/5205acad/attachment.html>