 STRUCT: section
     { sectname        char[16] }
     { segname         char[16] }
-    { addr            uint32_t }
-    { size            uint32_t }
-    { offset          uint32_t }
-    { align           uint32_t }
-    { reloff          uint32_t }
-    { nreloc          uint32_t }
-    { flags           uint32_t }
-    { reserved1       uint32_t }
-    { reserved2       uint32_t } ;
+    { addr            uint     }
+    { size            uint     }
+    { offset          uint     }
+    { align           uint     }
+    { reloff          uint     }
+    { nreloc          uint     }
+    { flags           uint     }
+    { reserved1       uint     }
+    { reserved2       uint     } ;
 
 STRUCT: section_64
-    { sectname        char[16] }
-    { segname         char[16] }
-    { addr            uint64_t }
-    { size            uint64_t }
-    { offset          uint32_t }
-    { align           uint32_t }
-    { reloff          uint32_t }
-    { nreloc          uint32_t }
-    { flags           uint32_t }
-    { reserved1       uint32_t }
-    { reserved2       uint32_t }
-    { reserved3       uint32_t } ;
+    { sectname        char[16]  }
+    { segname         char[16]  }
+    { addr            ulonglong }
+    { size            ulonglong }
+    { offset          uint      }
+    { align           uint      }
+    { reloff          uint      }
+    { nreloc          uint      }
+    { flags           uint      }
+    { reserved1       uint      }
+    { reserved2       uint      }
+    { reserved3       uint      } ;
 
 CONSTANT: SECTION_TYPE         HEX: 000000ff
 CONSTANT: SECTION_ATTRIBUTES   HEX: ffffff00


STRUCT: fvmlib
    { name             lc_str   }
    { minor_version    uint32_t }
    { header_addr      uint32_t } ;

STRUCT: fvmlib_command
    { cmd        uint32_t }
    { cmdsize    uint32_t }
    { fvmlib     fvmlib   } ;

STRUCT: dylib
    { name                  lc_str   }
    { timestamp             uint32_t }
    { current_version       uint32_t }
    { compatibility_version uint32_t } ;

STRUCT: dylib_command
    { cmd        uint32_t }
    { cmdsize    uint32_t }
    { dylib      dylib    } ;

STRUCT: sub_framework_command
    { cmd         uint32_t }
    { cmdsize     uint32_t }
    { umbrella    lc_str   } ;

STRUCT: sub_client_command
    { cmd        uint32_t }
    { cmdsize    uint32_t }
    { client     lc_str   } ;

STRUCT: sub_umbrella_command
    { cmd             uint32_t }
    { cmdsize         uint32_t }
    { sub_umbrella    lc_str   } ;

STRUCT: sub_library_command
    { cmd            uint32_t }
    { cmdsize        uint32_t }
    { sub_library    lc_str   } ;

STRUCT: prebound_dylib_command
    { cmd               uint32_t }
    { cmdsize           uint32_t }
    { name              lc_str   }
    { nmodules          uint32_t }
    { linked_modules    lc_str   } ;

STRUCT: dylinker_command
    { cmd        uint32_t }
    { cmdsize    uint32_t }
    { name       lc_str   } ;

STRUCT: thread_command
    { cmd        uint32_t }
    { cmdsize    uint32_t } ;

STRUCT: routines_command
    { cmd             uint32_t }
    { cmdsize         uint32_t }
    { init_address    uint32_t }
    { init_module     uint32_t }
    { reserved1       uint32_t }
    { reserved2       uint32_t }
    { reserved3       uint32_t }
    { reserved4       uint32_t }
    { reserved5       uint32_t }
    { reserved6       uint32_t } ;

STRUCT: routines_command_64
    { cmd             uint32_t }
    { cmdsize         uint32_t }
    { init_address    uint64_t }
    { init_module     uint64_t }
    { reserved1       uint64_t }
    { reserved2       uint64_t }
    { reserved3       uint64_t }
    { reserved4       uint64_t }
    { reserved5       uint64_t }
    { reserved6       uint64_t } ;

STRUCT: symtab_command
    { cmd        uint32_t }
    { cmdsize    uint32_t }
    { symoff     uint32_t }
    { nsyms      uint32_t }
    { stroff     uint32_t }
    { strsize    uint32_t } ;

STRUCT: dysymtab_command
    { cmd            uint32_t }
    { cmdsize        uint32_t }
    { ilocalsym      uint32_t }
    { nlocalsym      uint32_t }
    { iextdefsym     uint32_t }
    { nextdefsym     uint32_t }
    { iundefsym      uint32_t }
    { nundefsym      uint32_t }
    { tocoff         uint32_t }
    { ntoc           uint32_t }
    { modtaboff      uint32_t }
    { nmodtab        uint32_t }
    { extrefsymoff   uint32_t }
    { nextrefsyms    uint32_t }
    { indirectsymoff uint32_t }
    { nindirectsyms  uint32_t }
    { extreloff      uint32_t }
    { nextrel        uint32_t }
    { locreloff      uint32_t }
    { nlocrel        uint32_t } ;

CONSTANT: INDIRECT_SYMBOL_LOCAL HEX: 80000000
CONSTANT: INDIRECT_SYMBOL_ABS   HEX: 40000000

STRUCT: dylib_table_of_contents
    { symbol_index uint32_t }
    { module_index uint32_t } ;

STRUCT: dylib_module
    { module_name           uint32_t }
    { iextdefsym            uint32_t }
    { nextdefsym            uint32_t }
    { irefsym               uint32_t }
    { nrefsym               uint32_t }
    { ilocalsym             uint32_t }
    { nlocalsym             uint32_t }
    { iextrel               uint32_t }
    { nextrel               uint32_t }
    { iinit_iterm           uint32_t }
    { ninit_nterm           uint32_t }
    { objc_module_info_addr uint32_t }
    { objc_module_info_size uint32_t } ;

STRUCT: dylib_module_64
    { module_name           uint32_t }
    { iextdefsym            uint32_t }
    { nextdefsym            uint32_t }
    { irefsym               uint32_t }
    { nrefsym               uint32_t }
    { ilocalsym             uint32_t }
    { nlocalsym             uint32_t }
    { iextrel               uint32_t }
    { nextrel               uint32_t }
    { iinit_iterm           uint32_t }
    { ninit_nterm           uint32_t }
    { objc_module_info_size uint32_t }
    { objc_module_info_addr uint64_t } ;

STRUCT: dylib_reference
    { isym_flags uint32_t } ;

STRUCT: twolevel_hints_command
    { cmd     uint32_t }
    { cmdsize uint32_t }
    { offset  uint32_t }
    { nhints  uint32_t } ;

STRUCT: twolevel_hint
    { isub_image_itoc uint32_t } ;

STRUCT: prebind_cksum_command
    { cmd     uint32_t }
    { cmdsize uint32_t }
    { cksum   uint32_t } ;

STRUCT: uuid_command
    { cmd        uint32_t    }
    { cmdsize    uint32_t    }
    { uuid       uint8_t[16] } ;

STRUCT: rpath_command
    { cmd         uint32_t }
    { cmdsize     uint32_t }
    { path        lc_str   } ;

STRUCT: linkedit_data_command
    { cmd         uint32_t }
    { cmdsize     uint32_t }
    { dataoff     uint32_t }
    { datasize    uint32_t } ;

STRUCT: encryption_info_command
    { cmd       uint32_t }
    { cmdsize   uint32_t }
    { cryptoff  uint32_t }
    { cryptsize uint32_t }
    { cryptid   uint32_t } ;

STRUCT: dyld_info_command
    { cmd              uint32_t }
    { cmdsize          uint32_t }
    { rebase_off       uint32_t }
    { rebase_size      uint32_t }
    { bind_off         uint32_t }
    { bind_size        uint32_t }
    { weak_bind_off    uint32_t }
    { weak_bind_size   uint32_t }
    { lazy_bind_off    uint32_t }
    { lazy_bind_size   uint32_t }
    { export_off       uint32_t }
    { export_size      uint32_t } ;

CONSTANT: REBASE_TYPE_POINTER                     1
CONSTANT: REBASE_TYPE_TEXT_ABSOLUTE32             2

CONSTANT: SYMDEF_SORTED "__.SYMDEF SORTED"

STRUCT: ranlib
    { ran_strx uint }
    { ran_off  uint } ;

! reloc.h
STRUCT: relocation_info
    { r_address                            int  }
    { r_symbolnum_pcrel_length_extern_type uint } ;

CONSTANT: R_ABS   0
CONSTANT: R_SCATTERED HEX: 80000000

STRUCT: scattered_relocation_info_big_endian
    { r_scattered_pcrel_length_type_address  uint }
    { r_value                                int  } ;

STRUCT: scattered_relocation_info_little_endian
    { r_address_type_length_pcrel_scattered uint }
    { r_value                               int  } ;

C-ENUM: reloc_type_generic
    GENERIC_RELOC_VANILLA
