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

Shankar Kalpathi Easwaran shankarke at gmail.com
Fri Aug 2 16:58:48 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);
----------------
Is this code supposed to exist at sometime ? otherwise do you think we should remove it for now.

================
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,
----------------
Shouldnt these constants be used from llvm/Support/MachO.h ?

================
Comment at: lib/ReaderWriter/MachO/MachOFormat.hpp:195-218
@@ -163,9 +194,26 @@
   // Section "type" is the low byte
   SECTION_TYPE              = 0x000000FF,
   S_REGULAR                 = 0x00000000,
   S_ZEROFILL                = 0x00000001,
   S_CSTRING_LITERALS        = 0x00000002,
+  S_4BYTE_LITERALS          = 0x00000003,
+  S_8BYTE_LITERALS          = 0x00000004,
+  S_LITERAL_POINTERS        = 0x00000005,
   S_NON_LAZY_SYMBOL_POINTERS= 0x00000006,
   S_LAZY_SYMBOL_POINTERS    = 0x00000007,
   S_SYMBOL_STUBS            = 0x00000008,
+  S_MOD_INIT_FUNC_POINTERS  = 0x00000009,
+  S_MOD_TERM_FUNC_POINTERS  = 0x0000000A,
+  S_COALESCED               = 0x0000000B,
+  S_GB_ZEROFILL             = 0x0000000C,
+  S_INTERPOSING             = 0x0000000D,
+  S_16BYTE_LITERALS         = 0x0000000E,
+  S_DTRACE_DOF              = 0x0000000F,
+  S_LAZY_DYLIB_SYMBOL_POINTERS          = 0x00000010,
+  S_THREAD_LOCAL_REGULAR                = 0x00000011,
+  S_THREAD_LOCAL_ZEROFILL               = 0x00000012,
+  S_THREAD_LOCAL_VARIABLES              = 0x00000013,
+  S_THREAD_LOCAL_VARIABLE_POINTERS      = 0x00000014,
+  S_THREAD_LOCAL_INIT_FUNCTION_POINTERS = 0x00000015,
+  
   
----------------
Same here constants in llvm/Support/MachO.h

================
Comment at: lib/ReaderWriter/MachO/MachOFormat.hpp:645-652
@@ -586,8 +644,10 @@
+};
+
 class nlist {
 public:
   uint32_t  n_strx; 
   uint8_t   n_type; 
   uint8_t   n_sect;   
   uint16_t  n_desc;   
   uint64_t  n_value;    
   
----------------
Same here, llvm/Support/MachO.h

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


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



More information about the llvm-commits mailing list