[PATCH] D144079: [AArch64InstPrinter][llvm-objdump] Print ADR PC-relative label as a target address hexadecimal form

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 15 02:03:55 PST 2023


peter.smith added a comment.

No objections from me. I guess that `--no-print-imm-hex` is not honoured as we are not printing the immediate anymore?

My one caveat is that this can give some strange answers for some code that I doubt anyone would write in practice like

  .text
  adr x0, -4096

Which when disassembling an object will wrap around the address space. With gnu objdump:

  0000000000000000 <.text>:
     0:   10ff8000        adr     x0, fffffffffffff000 <.text+0xfffffffffffff000>

which is less helpful than the current llvm-objdump (I'm not using --no-print-imm-hex)

  0000000000000000 <$x.0>:
         0: 10ff8000      adr     x0, #-0x1000

However that should only happen for code that does a relative offset outside the section which is unlikely to work in practice.

I suggest updating the description with a slightly different example as it looks like it is just changing from decimal to hex. It is doing a bit more than that. It is changing a decimal offset from the PC to the absolute address of PC + offset.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144079/new/

https://reviews.llvm.org/D144079



More information about the llvm-commits mailing list