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

Shankar Kalpathi Easwaran shankarke at gmail.com
Fri Aug 2 21:44:22 PDT 2013



================
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,
----------------
kledzik at apple.com wrote:
> 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).
Yeah its weird and confusing. I think all the constants in the header file in llvm/Support/ have to be changed according to how the Darwin ABI dictates, which I think would be consistent then. 



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



More information about the llvm-commits mailing list