[PATCH] [lld][mach-o] binary reader and writer

Rui Ueyama ruiu at google.com
Mon Nov 4 18:19:02 PST 2013


  This patch is huge, so I'm get half way through it. My question is about swapStruct. For ELF, we generally use templates to handle 64bit/32bit and little/big endians. In this patch we do different thing for endianness -- if the target endian is different from host, it explicitly call swapStruct() to swap bytes. Why? Do you think it's better than tempalte?


================
Comment at: include/lld/ReaderWriter/MachOLinkingContext.h:129
@@ -123,1 +128,3 @@
   static uint32_t cpuSubtypeFromArch(Arch arch);
+  static bool is64(Arch arch);
+  static bool isOtherEndian(Arch arch);
----------------
nit: is64BitArch or is64? Is this inconsistency intended?

================
Comment at: lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp:72
@@ +71,3 @@
+using llvm::MachO::VM_PROT_WRITE;
+using llvm::MachO::VM_PROT_EXECUTE;
+
----------------
Would using namespace llvm::MachO suffice?


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

BRANCH
  svn

ARCANIST PROJECT
  lld



More information about the llvm-commits mailing list