[PATCH] D89094: [objdump][macho] Check arch before formating reloc name as arm64 addend

Peng Guo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 12 22:56:42 PDT 2020


pguo added inline comments.


================
Comment at: llvm/tools/llvm-objdump/MachODump.cpp:457
+  if (O->getAnyRelocationType(RE) == MachO::ARM64_RELOC_ADDEND &&
+      (O->getArch() == Triple::aarch64 || O->getArch() == Triple::aarch64_be)) {
     Fmt << format("0x%0" PRIx64, Val);
----------------
MaskRay wrote:
> `getArch().isAArch64()`
The `O->getArch()` returns enum `Triple::ArchType`, not a `Triple`. Maybe we can refactor the `Triple` arch checking functions to something like (as a separate commit):
```
class Triple {
  static bool isAArch64(ArchType Arch) {
    return Arch == aarch64 || Arch == aarch64_be;
  }
  bool isAArch64() const {
    return Triple::isAArch64(getArch());
  }
}
```
Then we can reuse the `Triple::isAArch64` here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89094



More information about the llvm-commits mailing list