[PATCH] Initial support for Mach-O universal binaries in LLVMObject

Alexey Samsonov samsonov at google.com
Tue Jun 18 01:44:59 PDT 2013


  I've added support for Mach-O universal binaries to llvm-nm tool. I'm not putting here llvm-symbolizer support, as the patch is large enough already.

  Please take a look.


================
Comment at: include/llvm/Object/MachOUniversal.h:40
@@ +39,3 @@
+  ObjectFile *getObjectForArch(Triple::ArchType Arch) const;
+  ObjectFile *getObjectForArch(StringRef ArchName) const;
+
----------------
Rafael Ávila de Espíndola wrote:
> Why both? Why not let the caller get Triple::ArchType?
Removed the latter

================
Comment at: include/llvm/Object/MachOUniversal.h:44
@@ +43,3 @@
+  // Stores descriptors for contained objects.
+  SmallVector<macho::FatArchHeader, 4> Objects;
+};
----------------
Rafael Ávila de Espíndola wrote:
> Is it profitable to cache this? I expect the common cases to be
> 
> * User wants one architecture. We may as well scan when they call getObjectForArch instead of scanning in the constructor.
> * User wants all the architectures. We should provide an iterator.
Ok, I've added the iterator interface.


http://llvm-reviews.chandlerc.com/D978



More information about the llvm-commits mailing list