mach 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. #------------------------------------------------------------
  2. # $File: mach,v 1.29 2021/04/26 15:56:00 christos Exp $
  3. # Mach has two magic numbers, 0xcafebabe and 0xfeedface.
  4. # Unfortunately the first, cafebabe, is shared with
  5. # Java ByteCode, so they are both handled in the file "cafebabe".
  6. # The "feedface" ones are handled herein.
  7. #------------------------------------------------------------
  8. # if set, it's for the 64-bit version of the architecture
  9. # yes, this is separate from the low-order magic number bit
  10. # it's also separate from the "64-bit libraries" bit in the
  11. # upper 8 bits of the CPU subtype
  12. # Reference: https://opensource.apple.com/source/cctools/cctools-949.0.1/
  13. # include/mach-o/loader.h
  14. # display CPU type as string like: i386 x86_64 ... armv7 armv7k ...
  15. 0 name mach-o-cpu
  16. >0 belong&0xff000000 0
  17. #
  18. # 32-bit ABIs.
  19. #
  20. # 1 vax
  21. >>0 belong&0x00ffffff 1
  22. >>>4 belong&0x00ffffff 0 vax
  23. >>>4 belong&0x00ffffff 1 vax11/780
  24. >>>4 belong&0x00ffffff 2 vax11/785
  25. >>>4 belong&0x00ffffff 3 vax11/750
  26. >>>4 belong&0x00ffffff 4 vax11/730
  27. >>>4 belong&0x00ffffff 5 uvaxI
  28. >>>4 belong&0x00ffffff 6 uvaxII
  29. >>>4 belong&0x00ffffff 7 vax8200
  30. >>>4 belong&0x00ffffff 8 vax8500
  31. >>>4 belong&0x00ffffff 9 vax8600
  32. >>>4 belong&0x00ffffff 10 vax8650
  33. >>>4 belong&0x00ffffff 11 vax8800
  34. >>>4 belong&0x00ffffff 12 uvaxIII
  35. >>>4 belong&0x00ffffff >12 vax subarchitecture=%d
  36. >>0 belong&0x00ffffff 2 romp
  37. >>0 belong&0x00ffffff 3 architecture=3
  38. >>0 belong&0x00ffffff 4 ns32032
  39. >>0 belong&0x00ffffff 5 ns32332
  40. >>0 belong&0x00ffffff 6 m68k
  41. # 7 x86
  42. >>0 belong&0x00ffffff 7
  43. >>>4 belong&0x0000000f 3 i386
  44. >>>4 belong&0x0000000f 4 i486
  45. >>>>4 belong&0x00fffff0 0
  46. >>>>4 belong&0x00fffff0 0x80 \bsx
  47. >>>4 belong&0x0000000f 5 i586
  48. >>>4 belong&0x0000000f 6
  49. >>>>4 belong&0x00fffff0 0 p6
  50. >>>>4 belong&0x00fffff0 0x10 pentium_pro
  51. >>>>4 belong&0x00fffff0 0x20 pentium_2_m0x20
  52. >>>>4 belong&0x00fffff0 0x30 pentium_2_m3
  53. >>>>4 belong&0x00fffff0 0x40 pentium_2_m0x40
  54. >>>>4 belong&0x00fffff0 0x50 pentium_2_m5
  55. >>>>4 belong&0x00fffff0 >0x50 pentium_2_m%#x
  56. >>>4 belong&0x0000000f 7 celeron
  57. >>>>4 belong&0x00fffff0 0x00 \b_m%#x
  58. >>>>4 belong&0x00fffff0 0x10 \b_m%#x
  59. >>>>4 belong&0x00fffff0 0x20 \b_m%#x
  60. >>>>4 belong&0x00fffff0 0x30 \b_m%#x
  61. >>>>4 belong&0x00fffff0 0x40 \b_m%#x
  62. >>>>4 belong&0x00fffff0 0x50 \b_m%#x
  63. >>>>4 belong&0x00fffff0 0x60
  64. >>>>4 belong&0x00fffff0 0x70 \b_mobile
  65. >>>>4 belong&0x00fffff0 >0x70 \b_m%#x
  66. >>>4 belong&0x0000000f 8 pentium_3
  67. >>>>4 belong&0x00fffff0 0x00
  68. >>>>4 belong&0x00fffff0 0x10 \b_m
  69. >>>>4 belong&0x00fffff0 0x20 \b_xeon
  70. >>>>4 belong&0x00fffff0 >0x20 \b_m%#x
  71. >>>4 belong&0x0000000f 9 pentiumM
  72. >>>>4 belong&0x00fffff0 0x00
  73. >>>>4 belong&0x00fffff0 >0x00 \b_m%#x
  74. >>>4 belong&0x0000000f 10 pentium_4
  75. >>>>4 belong&0x00fffff0 0x00
  76. >>>>4 belong&0x00fffff0 0x10 \b_m
  77. >>>>4 belong&0x00fffff0 >0x10 \b_m%#x
  78. >>>4 belong&0x0000000f 11 itanium
  79. >>>>4 belong&0x00fffff0 0x00
  80. >>>>4 belong&0x00fffff0 0x10 \b_2
  81. >>>>4 belong&0x00fffff0 >0x10 \b_m%#x
  82. >>>4 belong&0x0000000f 12 xeon
  83. >>>>4 belong&0x00fffff0 0x00
  84. >>>>4 belong&0x00fffff0 0x10 \b_mp
  85. >>>>4 belong&0x00fffff0 >0x10 \b_m%#x
  86. >>>4 belong&0x0000000f >12 ia32 family=%d
  87. >>>>4 belong&0x00fffff0 0x00
  88. >>>>4 belong&0x00fffff0 >0x00 model=%x
  89. >>0 belong&0x00ffffff 8 mips
  90. >>>4 belong&0x00ffffff 1 R2300
  91. >>>4 belong&0x00ffffff 2 R2600
  92. >>>4 belong&0x00ffffff 3 R2800
  93. >>>4 belong&0x00ffffff 4 R2000a
  94. >>>4 belong&0x00ffffff 5 R2000
  95. >>>4 belong&0x00ffffff 6 R3000a
  96. >>>4 belong&0x00ffffff 7 R3000
  97. >>>4 belong&0x00ffffff >7 subarchitecture=%d
  98. >>0 belong&0x00ffffff 9 ns32532
  99. >>0 belong&0x00ffffff 10 mc98000
  100. >>0 belong&0x00ffffff 11 hppa
  101. >>>4 belong&0x00ffffff 0 7100
  102. >>>4 belong&0x00ffffff 1 7100LC
  103. >>>4 belong&0x00ffffff >1 subarchitecture=%d
  104. >>0 belong&0x00ffffff 12 arm
  105. >>>4 belong&0x00ffffff 0
  106. >>>4 belong&0x00ffffff 1 subarchitecture=%d
  107. >>>4 belong&0x00ffffff 2 subarchitecture=%d
  108. >>>4 belong&0x00ffffff 3 subarchitecture=%d
  109. >>>4 belong&0x00ffffff 4 subarchitecture=%d
  110. >>>4 belong&0x00ffffff 5 \bv4t
  111. >>>4 belong&0x00ffffff 6 \bv6
  112. >>>4 belong&0x00ffffff 7 \bv5tej
  113. >>>4 belong&0x00ffffff 8 \bxscale
  114. >>>4 belong&0x00ffffff 9 \bv7
  115. >>>4 belong&0x00ffffff 10 \bv7f
  116. >>>4 belong&0x00ffffff 11 \bv7s
  117. >>>4 belong&0x00ffffff 12 \bv7k
  118. >>>4 belong&0x00ffffff 13 \bv8
  119. >>>4 belong&0x00ffffff 14 \bv6m
  120. >>>4 belong&0x00ffffff 15 \bv7m
  121. >>>4 belong&0x00ffffff 16 \bv7em
  122. >>>4 belong&0x00ffffff >16 subarchitecture=%d
  123. # 13 m88k
  124. >>0 belong&0x00ffffff 13
  125. >>>4 belong&0x00ffffff 0 mc88000
  126. >>>4 belong&0x00ffffff 1 mc88100
  127. >>>4 belong&0x00ffffff 2 mc88110
  128. >>>4 belong&0x00ffffff >2 mc88000 subarchitecture=%d
  129. >>0 belong&0x00ffffff 14 SPARC
  130. >>0 belong&0x00ffffff 15 i860g
  131. >>0 belong&0x00ffffff 16 alpha
  132. >>0 belong&0x00ffffff 17 rs6000
  133. >>0 belong&0x00ffffff 18 ppc
  134. >>>4 belong&0x00ffffff 0
  135. >>>4 belong&0x00ffffff 1 \b_601
  136. >>>4 belong&0x00ffffff 2 \b_602
  137. >>>4 belong&0x00ffffff 3 \b_603
  138. >>>4 belong&0x00ffffff 4 \b_603e
  139. >>>4 belong&0x00ffffff 5 \b_603ev
  140. >>>4 belong&0x00ffffff 6 \b_604
  141. >>>4 belong&0x00ffffff 7 \b_604e
  142. >>>4 belong&0x00ffffff 8 \b_620
  143. >>>4 belong&0x00ffffff 9 \b_750
  144. >>>4 belong&0x00ffffff 10 \b_7400
  145. >>>4 belong&0x00ffffff 11 \b_7450
  146. >>>4 belong&0x00ffffff 100 \b_970
  147. >>>4 belong&0x00ffffff >100 subarchitecture=%d
  148. >>0 belong&0x00ffffff >18 architecture=%d
  149. >0 belong&0xff000000 0x01000000
  150. #
  151. # 64-bit ABIs.
  152. #
  153. >>0 belong&0x00ffffff 0 64-bit architecture=%d
  154. >>0 belong&0x00ffffff 1 64-bit architecture=%d
  155. >>0 belong&0x00ffffff 2 64-bit architecture=%d
  156. >>0 belong&0x00ffffff 3 64-bit architecture=%d
  157. >>0 belong&0x00ffffff 4 64-bit architecture=%d
  158. >>0 belong&0x00ffffff 5 64-bit architecture=%d
  159. >>0 belong&0x00ffffff 6 64-bit architecture=%d
  160. >>0 belong&0x00ffffff 7 x86_64
  161. >>>4 belong&0x00ffffff 0 subarchitecture=%d
  162. >>>4 belong&0x00ffffff 1 subarchitecture=%d
  163. >>>4 belong&0x00ffffff 2 subarchitecture=%d
  164. >>>4 belong&0x00ffffff 3
  165. >>>4 belong&0x00ffffff 4 \b_arch1
  166. >>>4 belong&0x00ffffff 8 \b_haswell
  167. >>>4 belong&0x00ffffff >4 subarchitecture=%d
  168. >>0 belong&0x00ffffff 8 64-bit architecture=%d
  169. >>0 belong&0x00ffffff 9 64-bit architecture=%d
  170. >>0 belong&0x00ffffff 10 64-bit architecture=%d
  171. >>0 belong&0x00ffffff 11 64-bit architecture=%d
  172. >>0 belong&0x00ffffff 12 arm64
  173. >>>4 belong&0x00ffffff 0
  174. >>>4 belong&0x00ffffff 1 \bv8
  175. >>>4 belong&0x00ffffff 2 \be
  176. >>>>7 ubyte&0xff >0 (caps:
  177. >>>>7 ubyte&0xff <0x80 %#02x
  178. >>>>7 ubyte&0xc0 0x80 PAC
  179. >>>>>7 ubyte&0x3f x \b%02d
  180. >>>>7 ubyte&0xc0 0xc0 PAK
  181. >>>>>7 ubyte&0x3f x \b%02d
  182. >>>>7 ubyte&0xff x \b)
  183. >>>4 belong&0x00ffffff >2 subarchitecture=%d
  184. >>0 belong&0x00ffffff 13 64-bit architecture=%d
  185. >>0 belong&0x00ffffff 14 64-bit architecture=%d
  186. >>0 belong&0x00ffffff 15 64-bit architecture=%d
  187. >>0 belong&0x00ffffff 16 64-bit architecture=%d
  188. >>0 belong&0x00ffffff 17 64-bit architecture=%d
  189. >>0 belong&0x00ffffff 18 ppc64
  190. >>>4 belong&0x00ffffff 0
  191. >>>4 belong&0x00ffffff 1 \b_601
  192. >>>4 belong&0x00ffffff 2 \b_602
  193. >>>4 belong&0x00ffffff 3 \b_603
  194. >>>4 belong&0x00ffffff 4 \b_603e
  195. >>>4 belong&0x00ffffff 5 \b_603ev
  196. >>>4 belong&0x00ffffff 6 \b_604
  197. >>>4 belong&0x00ffffff 7 \b_604e
  198. >>>4 belong&0x00ffffff 8 \b_620
  199. >>>4 belong&0x00ffffff 9 \b_650
  200. >>>4 belong&0x00ffffff 10 \b_7400
  201. >>>4 belong&0x00ffffff 11 \b_7450
  202. >>>4 belong&0x00ffffff 100 \b_970
  203. >>>4 belong&0x00ffffff >100 subarchitecture=%d
  204. >>0 belong&0x00ffffff >18 64-bit architecture=%d
  205. >0 belong&0xff000000 0x02000000
  206. #
  207. # 64_32-bit ABIs.
  208. #
  209. >>0 belong&0x00ffffff 0 64_32-bit architecture=%d
  210. >>0 belong&0x00ffffff 1 64_32-bit architecture=%d
  211. >>0 belong&0x00ffffff 2 64_32-bit architecture=%d
  212. >>0 belong&0x00ffffff 3 64_32-bit architecture=%d
  213. >>0 belong&0x00ffffff 4 64_32-bit architecture=%d
  214. >>0 belong&0x00ffffff 5 64_32-bit architecture=%d
  215. >>0 belong&0x00ffffff 6 64_32-bit architecture=%d
  216. >>0 belong&0x00ffffff 7 64_32-bit architecture=%d
  217. >>0 belong&0x00ffffff 8 64_32-bit architecture=%d
  218. >>0 belong&0x00ffffff 9 64_32-bit architecture=%d
  219. >>0 belong&0x00ffffff 10 64_32-bit architecture=%d
  220. >>0 belong&0x00ffffff 11 64_32-bit architecture=%d
  221. >>0 belong&0x00ffffff 12 64_32-bit arm
  222. >>>4 belong&0x00ffffff 0
  223. >>>4 belong&0x00ffffff 1 \bv8
  224. >>>4 belong&0x00ffffff >1 subarchitecture=%d
  225. >>0 belong&0x00ffffff 13 64_32-bit architecture=%d
  226. >>0 belong&0x00ffffff 14 64_32-bit architecture=%d
  227. >>0 belong&0x00ffffff 15 64_32-bit architecture=%d
  228. >>0 belong&0x00ffffff 16 64_32-bit architecture=%d
  229. >>0 belong&0x00ffffff 17 64_32-bit architecture=%d
  230. >>0 belong&0x00ffffff 18 64_32-bit architecture=%d
  231. >>0 belong&0x00ffffff >18 64_32-bit architecture=%d
  232. 0 name mach-o-be
  233. >0 byte 0xcf 64-bit
  234. >4 use mach-o-cpu
  235. >12 belong 1 object
  236. # GRR: Does not work for Mach-O with 2 architectures; instead display oo
  237. #!:ext o
  238. !:ext o/
  239. >12 belong 2 executable
  240. # the executables normally have no file extension like perl,
  241. # but exceptions like perl5.18 perl5.16
  242. !:ext 16/18/
  243. >12 belong 3 fixed virtual memory shared library
  244. >12 belong 4 core
  245. >12 belong 5 preload executable
  246. >12 belong 6 dynamically linked shared library
  247. # GRR: Does not work for Mach-O with 2 architectures; instead display dylibdylib
  248. #!:ext dylib
  249. !:ext dylib/
  250. >12 belong 7 dynamic linker
  251. >12 belong 8 bundle
  252. # normally name extension bundle; but exceptions like: AMDil_r700.dylib
  253. !:ext bundle/dylib/
  254. >12 belong 9 dynamically linked shared library stub
  255. >12 belong 10 dSYM companion file
  256. >12 belong 11 kext bundle
  257. >12 belong >11
  258. >>12 belong x filetype=%d
  259. >24 belong >0 \b, flags:<
  260. >>24 belong &0x00000001 \bNOUNDEFS
  261. >>24 belong &0x00000002 \b|INCRLINK
  262. >>24 belong &0x00000004 \b|DYLDLINK
  263. >>24 belong &0x00000008 \b|BINDATLOAD
  264. >>24 belong &0x00000010 \b|PREBOUND
  265. >>24 belong &0x00000020 \b|SPLIT_SEGS
  266. >>24 belong &0x00000040 \b|LAZY_INIT
  267. >>24 belong &0x00000080 \b|TWOLEVEL
  268. >>24 belong &0x00000100 \b|FORCE_FLAT
  269. >>24 belong &0x00000200 \b|NOMULTIDEFS
  270. >>24 belong &0x00000400 \b|NOFIXPREBINDING
  271. >>24 belong &0x00000800 \b|PREBINDABLE
  272. >>24 belong &0x00001000 \b|ALLMODSBOUND
  273. >>24 belong &0x00002000 \b|SUBSECTIONS_VIA_SYMBOLS
  274. >>24 belong &0x00004000 \b|CANONICAL
  275. >>24 belong &0x00008000 \b|WEAK_DEFINES
  276. >>24 belong &0x00010000 \b|BINDS_TO_WEAK
  277. >>24 belong &0x00020000 \b|ALLOW_STACK_EXECUTION
  278. >>24 belong &0x00040000 \b|ROOT_SAFE
  279. >>24 belong &0x00080000 \b|SETUID_SAFE
  280. >>24 belong &0x00100000 \b|NO_REEXPORTED_DYLIBS
  281. >>24 belong &0x00200000 \b|PIE
  282. >>24 belong &0x00400000 \b|DEAD_STRIPPABLE_DYLIB
  283. >>24 belong &0x00800000 \b|HAS_TLV_DESCRIPTORS
  284. >>24 belong &0x01000000 \b|NO_HEAP_EXECUTION
  285. >>24 belong &0x02000000 \b|APP_EXTENSION_SAFE
  286. >>24 belong &0x04000000 \b|NLIST_OUTOFSYNC_WITH_DYLDINFO
  287. >>24 belong &0x08000000 \b|SIM_SUPPORT
  288. >>24 belong &0x80000000 \b|DYLIB_IN_CACHE
  289. >>24 belong x \b>
  290. #
  291. 0 lelong&0xfffffffe 0xfeedface Mach-O
  292. !:strength +1
  293. !:mime application/x-mach-binary
  294. >0 use \^mach-o-be
  295. 0 belong&0xfffffffe 0xfeedface Mach-O
  296. !:strength +1
  297. !:mime application/x-mach-binary
  298. >0 use mach-o-be