[PATCH] D78032: [llvm-objdump] Default to the "apple-latest" mcpu when disassembling arm64 Mach-O binaries

Ahmed Bougacha via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 14:19:23 PDT 2020


ab added a comment.

> Is it possible to make the (defaulting mcpu to "apple-latest") decision in a library, instead of in llvm-objdump and other individual tools?

Yes, that sounds reasonable.  I'm curious, what tools do you have in mind?
The obvious (only?) candidate is `MachOObjectFile::getArchTriple`, as you mentioned, we can't really distinguish assemblers from disassemblers in the lower layers (other than `MCDisassember` obviously, but that's already too late).  I think the mcpu inferred by `getArchTriple` is only used by MachODump.  And to answer the other questions: llvm-nm and llvm-size shouldn't care about CPUs.  lldb is another similar consumer that does care, and I don't think that uses the `MachOObjectFile` API either.

So picking `apple-latest` in `getArchTriple` should be NFC relative to this patch I think, but it sounds reasonable to me.  I'm a bit uneasy about having that in `MachOObjectFile`, which isn't specific to disassembly, but I don't have an argument against it either.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78032





More information about the llvm-commits mailing list