[PATCH] [mach-o] Reader first steps, yaml support

kledzik at apple.com kledzik at apple.com
Fri Aug 2 17:14:04 PDT 2013



================
Comment at: lib/ReaderWriter/MachO/MNObjectFileYAML.cpp:254
@@ +253,3 @@
+    io.mapRequired("arch",       file.arch);
+    //sync(io); // sync arch to context
+    io.mapRequired("file-type",  file.fileType);
----------------
Shankar Kalpathi Easwaran wrote:
> Is this code supposed to exist at sometime ? otherwise do you think we should remove it for now.
removed


================
Comment at: lib/ReaderWriter/MachO/MachOFormat.hpp:31-46
@@ -27,14 +30,18 @@
 
 enum { 
   MH_MAGIC    = 0xfeedface,
-  MH_MAGIC_64 = 0xfeedfacf 
+  MH_MAGIC_64 = 0xfeedfacf,
+  MH_CIGAM    = 0xcefaedfe,
+  MH_CIGAM_64 = 0xcffaedfe
 };
 
 enum {
-  CPU_TYPE_ARM  =   0x0000000C,
-  CPU_TYPE_I386 =   0x00000007,
-  CPU_TYPE_X86_64 = 0x01000007
+  CPU_TYPE_POWERPC  = 0x00000012,
+  CPU_TYPE_I386     = 0x00000007,
+  CPU_TYPE_X86_64   = 0x01000007,
+  CPU_TYPE_ARM      = 0x0000000C
 };
 
 enum {
+  CPU_SUBTYPE_POWERPC_ALL= 0x00000000,
   CPU_SUBTYPE_X86_ALL    = 0x00000003,
----------------
Shankar Kalpathi Easwaran wrote:
> Shouldnt these constants be used from llvm/Support/MachO.h ?
I really don't understand why llvm/Support/MachO.h has different names for all the mach-o constants.  It makes searching for uses very difficult.    Image if llvm/Support/ELF.h did not use standard names like SHT_PROGBITS, no one who know ELF would be able to read source code that uses the alternate names.  

I did just notice that the struct names are all the same. I'll see about switching to use the llvm structs (e.g. llvm::MachO::mach_header).

================
Comment at: lib/ReaderWriter/MachO/MNObjectFile.h:23
@@ +22,3 @@
+///
+/// Overall, the converstion paths available look like:
+///
----------------
Shankar Kalpathi Easwaran wrote:
> spell error.
fixed


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



More information about the llvm-commits mailing list