[PATCH] D62753: [llvm-lipo] Implement -archs

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 15:18:52 PDT 2019


alexshap added inline comments.


================
Comment at: llvm/tools/llvm-lipo/llvm-lipo.cpp:209
+  // cctools lipo.
+  Triple::ArchType Arch = MachOObjectFile::getArch(CPUType);
+  if (Arch == Triple::ArchType::UnknownArch)
----------------
mtrent wrote:
> The problem here is that there are Mach-O Arch types that are identifiable by cputype and cpusubtype, such as "x86_64h" and "armv7k". The general Triple API does not seem to support this; so Mach-O tools get this from the MachOObjectFile or from the MachOObjectFile::getArchTriple. 
> 
> Since the code calling printArchFromCPUType has a MachOObjectFile (Obj), I would simply pass that MachOObjectFile in, ask it for its Triple (Obj->getArch()), and then handle an unknown triple. But you could remove the dependency on a MachOObjectFile by replacing your call to static MachOObjectFile::getArch() with a call to static MachOObjectFile::getArchTriple(): given the cputype and cpusubtype it will return the ArchFlag for you. But that's kind of backwards ... 
I missed this, thanks!
I think we need a test for this as well


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62753





More information about the llvm-commits mailing list