elf 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. #------------------------------------------------------------------------------
  2. # elf: file(1) magic for ELF executables
  3. #
  4. # We have to check the byte order flag to see what byte order all the
  5. # other stuff in the header is in.
  6. #
  7. # What're the correct byte orders for the nCUBE and the Fujitsu VPP500?
  8. #
  9. # updated by Daniel Quinlan (quinlan@yggdrasil.com)
  10. 0 string \177ELF ELF
  11. >4 byte 0 invalid class
  12. >4 byte 1 32-bit
  13. >4 byte 2 64-bit
  14. >5 byte 0 invalid byte order
  15. >5 byte 1 LSB
  16. >>16 leshort 0 no file type,
  17. !:mime application/octet-stream
  18. >>16 leshort 1 relocatable,
  19. !:mime application/x-object
  20. >>16 leshort 2 executable,
  21. !:mime application/x-executable
  22. >>16 leshort 3 shared object,
  23. !:mime application/x-sharedlib
  24. # Core handling from Peter Tobias <tobias@server.et-inf.fho-emden.de>
  25. # corrections by Christian 'Dr. Disk' Hechelmann <drdisk@ds9.au.s.shuttle.de>
  26. >>16 leshort 4 core file
  27. !:mime application/x-coredump
  28. # Core file detection is not reliable.
  29. #>>>(0x38+0xcc) string >\0 of '%s'
  30. #>>>(0x38+0x10) lelong >0 (signal %d),
  31. >>16 leshort &0xff00 processor-specific,
  32. >>18 leshort 0 no machine,
  33. >>18 leshort 1 AT&T WE32100 - invalid byte order,
  34. >>18 leshort 2 SPARC - invalid byte order,
  35. >>18 leshort 3 Intel 80386,
  36. >>18 leshort 4 Motorola
  37. >>>36 lelong &0x01000000 68000 - invalid byte order,
  38. >>>36 lelong &0x00810000 CPU32 - invalid byte order,
  39. >>>36 lelong 0 68020 - invalid byte order,
  40. >>18 leshort 5 Motorola 88000 - invalid byte order,
  41. >>18 leshort 6 Intel 80486,
  42. >>18 leshort 7 Intel 80860,
  43. # The official e_machine number for MIPS is now #8, regardless of endianness.
  44. # The second number (#10) will be deprecated later. For now, we still
  45. # say something if #10 is encountered, but only gory details for #8.
  46. >>18 leshort 8 MIPS,
  47. >>>36 lelong &0x20 N32
  48. >>18 leshort 10 MIPS,
  49. >>>36 lelong &0x20 N32
  50. >>18 leshort 8
  51. # only for 32-bit
  52. >>>4 byte 1
  53. >>>>36 lelong&0xf0000000 0x00000000 MIPS-I
  54. >>>>36 lelong&0xf0000000 0x10000000 MIPS-II
  55. >>>>36 lelong&0xf0000000 0x20000000 MIPS-III
  56. >>>>36 lelong&0xf0000000 0x30000000 MIPS-IV
  57. >>>>36 lelong&0xf0000000 0x40000000 MIPS-V
  58. >>>>36 lelong&0xf0000000 0x50000000 MIPS32
  59. >>>>36 lelong&0xf0000000 0x60000000 MIPS64
  60. >>>>36 lelong&0xf0000000 0x70000000 MIPS32 rel2
  61. >>>>36 lelong&0xf0000000 0x80000000 MIPS64 rel2
  62. # only for 64-bit
  63. >>>4 byte 2
  64. >>>>48 lelong&0xf0000000 0x00000000 MIPS-I
  65. >>>>48 lelong&0xf0000000 0x10000000 MIPS-II
  66. >>>>48 lelong&0xf0000000 0x20000000 MIPS-III
  67. >>>>48 lelong&0xf0000000 0x30000000 MIPS-IV
  68. >>>>48 lelong&0xf0000000 0x40000000 MIPS-V
  69. >>>>48 lelong&0xf0000000 0x50000000 MIPS32
  70. >>>>48 lelong&0xf0000000 0x60000000 MIPS64
  71. >>>>48 lelong&0xf0000000 0x70000000 MIPS32 rel2
  72. >>>>48 lelong&0xf0000000 0x80000000 MIPS64 rel2
  73. >>18 leshort 9 Amdahl - invalid byte order,
  74. >>18 leshort 10 MIPS (deprecated),
  75. >>18 leshort 11 RS6000 - invalid byte order,
  76. >>18 leshort 15 PA-RISC - invalid byte order,
  77. >>>50 leshort 0x0214 2.0
  78. >>>48 leshort &0x0008 (LP64),
  79. >>18 leshort 16 nCUBE,
  80. >>18 leshort 17 Fujitsu VPP500,
  81. >>18 leshort 18 SPARC32PLUS,
  82. >>18 leshort 20 PowerPC,
  83. >>18 leshort 22 IBM S/390,
  84. >>18 leshort 36 NEC V800,
  85. >>18 leshort 37 Fujitsu FR20,
  86. >>18 leshort 38 TRW RH-32,
  87. >>18 leshort 39 Motorola RCE,
  88. >>18 leshort 40 ARM,
  89. >>18 leshort 41 Alpha,
  90. >>18 leshort 0xa390 IBM S/390 (obsolete),
  91. >>18 leshort 42 Renesas SH,
  92. >>18 leshort 43 SPARC V9 - invalid byte order,
  93. >>18 leshort 44 Siemens Tricore Embedded Processor,
  94. >>18 leshort 45 Argonaut RISC Core, Argonaut Technologies Inc.,
  95. >>18 leshort 46 Renesas H8/300,
  96. >>18 leshort 47 Renesas H8/300H,
  97. >>18 leshort 48 Renesas H8S,
  98. >>18 leshort 49 Renesas H8/500,
  99. >>18 leshort 50 IA-64,
  100. >>18 leshort 51 Stanford MIPS-X,
  101. >>18 leshort 52 Motorola Coldfire,
  102. >>18 leshort 53 Motorola M68HC12,
  103. >>18 leshort 54 Fujitsu MMA,
  104. >>18 leshort 55 Siemens PCP,
  105. >>18 leshort 56 Sony nCPU,
  106. >>18 leshort 57 Denso NDR1,
  107. >>18 leshort 58 Start*Core,
  108. >>18 leshort 59 Toyota ME16,
  109. >>18 leshort 60 ST100,
  110. >>18 leshort 61 Tinyj emb.,
  111. >>18 leshort 62 x86-64,
  112. >>18 leshort 63 Sony DSP,
  113. >>18 leshort 66 FX66,
  114. >>18 leshort 67 ST9+ 8/16 bit,
  115. >>18 leshort 68 ST7 8 bit,
  116. >>18 leshort 69 MC68HC16,
  117. >>18 leshort 70 MC68HC11,
  118. >>18 leshort 71 MC68HC08,
  119. >>18 leshort 72 MC68HC05,
  120. >>18 leshort 73 SGI SVx,
  121. >>18 leshort 74 ST19 8 bit,
  122. >>18 leshort 75 Digital VAX,
  123. >>18 leshort 76 Axis cris,
  124. >>18 leshort 77 Infineon 32-bit embedded,
  125. >>18 leshort 78 Element 14 64-bit DSP,
  126. >>18 leshort 79 LSI Logic 16-bit DSP,
  127. >>18 leshort 80 MMIX,
  128. >>18 leshort 81 Harvard machine-independent,
  129. >>18 leshort 82 SiTera Prism,
  130. >>18 leshort 83 Atmel AVR 8-bit,
  131. >>18 leshort 84 Fujitsu FR30,
  132. >>18 leshort 85 Mitsubishi D10V,
  133. >>18 leshort 86 Mitsubishi D30V,
  134. >>18 leshort 87 NEC v850,
  135. >>18 leshort 88 Renesas M32R,
  136. >>18 leshort 89 Matsushita MN10300,
  137. >>18 leshort 90 Matsushita MN10200,
  138. >>18 leshort 91 picoJava,
  139. >>18 leshort 92 OpenRISC,
  140. >>18 leshort 93 ARC Cores Tangent-A5,
  141. >>18 leshort 0x3426 OpenRISC (obsolete),
  142. >>18 leshort 0x8472 OpenRISC (obsolete),
  143. >>18 leshort 94 Tensilica Xtensa,
  144. >>18 leshort 97 NatSemi 32k,
  145. >>18 leshort 106 Analog Devices Blackfin,
  146. >>18 leshort 0x9026 Alpha (unofficial),
  147. >>20 lelong 0 invalid version
  148. >>20 lelong 1 version 1
  149. >>36 lelong 1 MathCoPro/FPU/MAU Required
  150. >5 byte 2 MSB
  151. >>16 beshort 0 no file type,
  152. !:mime application/octet-stream
  153. >>16 beshort 1 relocatable,
  154. !:mime application/x-object
  155. >>16 beshort 2 executable,
  156. !:mime application/x-executable
  157. >>16 beshort 3 shared object,
  158. !:mime application/x-sharedlib
  159. >>16 beshort 4 core file,
  160. !:mime application/x-coredump
  161. #>>>(0x38+0xcc) string >\0 of '%s'
  162. #>>>(0x38+0x10) belong >0 (signal %d),
  163. >>16 beshort &0xff00 processor-specific,
  164. >>18 beshort 0 no machine,
  165. >>18 beshort 1 AT&T WE32100,
  166. >>18 beshort 2 SPARC,
  167. >>18 beshort 3 Intel 80386 - invalid byte order,
  168. >>18 beshort 4 Motorola
  169. >>>36 belong &0x01000000 68000,
  170. >>>36 belong &0x00810000 CPU32,
  171. >>>36 belong 0 68020,
  172. >>18 beshort 5 Motorola 88000,
  173. >>18 beshort 6 Intel 80486 - invalid byte order,
  174. >>18 beshort 7 Intel 80860,
  175. # only for MIPS - see comment in little-endian section above.
  176. >>18 beshort 8 MIPS,
  177. >>>36 belong &0x20 N32
  178. >>18 beshort 10 MIPS,
  179. >>>36 belong &0x20 N32
  180. >>18 beshort 8
  181. # only for 32-bit
  182. >>>4 byte 1
  183. >>>>36 belong&0xf0000000 0x00000000 MIPS-I
  184. >>>>36 belong&0xf0000000 0x10000000 MIPS-II
  185. >>>>36 belong&0xf0000000 0x20000000 MIPS-III
  186. >>>>36 belong&0xf0000000 0x30000000 MIPS-IV
  187. >>>>36 belong&0xf0000000 0x40000000 MIPS-V
  188. >>>>36 belong&0xf0000000 0x50000000 MIPS32
  189. >>>>36 belong&0xf0000000 0x60000000 MIPS64
  190. >>>>36 belong&0xf0000000 0x70000000 MIPS32 rel2
  191. >>>>36 belong&0xf0000000 0x80000000 MIPS64 rel2
  192. # only for 64-bit
  193. >>>4 byte 2
  194. >>>>48 belong&0xf0000000 0x00000000 MIPS-I
  195. >>>>48 belong&0xf0000000 0x10000000 MIPS-II
  196. >>>>48 belong&0xf0000000 0x20000000 MIPS-III
  197. >>>>48 belong&0xf0000000 0x30000000 MIPS-IV
  198. >>>>48 belong&0xf0000000 0x40000000 MIPS-V
  199. >>>>48 belong&0xf0000000 0x50000000 MIPS32
  200. >>>>48 belong&0xf0000000 0x60000000 MIPS64
  201. >>>>48 belong&0xf0000000 0x70000000 MIPS32 rel2
  202. >>>>48 belong&0xf0000000 0x80000000 MIPS64 rel2
  203. >>18 beshort 9 Amdahl,
  204. >>18 beshort 10 MIPS (deprecated),
  205. >>18 beshort 11 RS6000,
  206. >>18 beshort 15 PA-RISC
  207. >>>50 beshort 0x0214 2.0
  208. >>>48 beshort &0x0008 (LP64)
  209. >>18 beshort 16 nCUBE,
  210. >>18 beshort 17 Fujitsu VPP500,
  211. >>18 beshort 18 SPARC32PLUS,
  212. >>>36 belong&0xffff00 &0x000100 V8+ Required,
  213. >>>36 belong&0xffff00 &0x000200 Sun UltraSPARC1 Extensions Required,
  214. >>>36 belong&0xffff00 &0x000400 HaL R1 Extensions Required,
  215. >>>36 belong&0xffff00 &0x000800 Sun UltraSPARC3 Extensions Required,
  216. >>18 beshort 20 PowerPC or cisco 4500,
  217. >>18 beshort 21 64-bit PowerPC or cisco 7500,
  218. >>18 beshort 22 IBM S/390,
  219. >>18 beshort 23 Cell SPU,
  220. >>18 beshort 24 cisco SVIP,
  221. >>18 beshort 25 cisco 7200,
  222. >>18 beshort 36 NEC V800 or cisco 12000,
  223. >>18 beshort 37 Fujitsu FR20,
  224. >>18 beshort 38 TRW RH-32,
  225. >>18 beshort 39 Motorola RCE,
  226. >>18 beshort 40 ARM,
  227. >>18 beshort 41 Alpha,
  228. >>18 beshort 42 Renesas SH,
  229. >>18 beshort 43 SPARC V9,
  230. >>18 beshort 44 Siemens Tricore Embedded Processor,
  231. >>18 beshort 45 Argonaut RISC Core, Argonaut Technologies Inc.,
  232. >>18 beshort 46 Renesas H8/300,
  233. >>18 beshort 47 Renesas H8/300H,
  234. >>18 beshort 48 Renesas H8S,
  235. >>18 beshort 49 Renesas H8/500,
  236. >>18 beshort 50 IA-64,
  237. >>18 beshort 51 Stanford MIPS-X,
  238. >>18 beshort 52 Motorola Coldfire,
  239. >>18 beshort 53 Motorola M68HC12,
  240. >>18 beshort 73 Cray NV1,
  241. >>18 beshort 75 Digital VAX,
  242. >>18 beshort 88 Renesas M32R,
  243. >>18 leshort 92 OpenRISC,
  244. >>18 leshort 0x3426 OpenRISC (obsolete),
  245. >>18 leshort 0x8472 OpenRISC (obsolete),
  246. >>18 beshort 94 Tensilica Xtensa,
  247. >>18 beshort 97 NatSemi 32k,
  248. >>18 beshort 0x18ad AVR32 (unofficial),
  249. >>18 beshort 0x9026 Alpha (unofficial),
  250. >>18 beshort 0xa390 IBM S/390 (obsolete),
  251. >>20 belong 0 invalid version
  252. >>20 belong 1 version 1
  253. >>36 belong 1 MathCoPro/FPU/MAU Required
  254. # Up to now only 0, 1 and 2 are defined; I've seen a file with 0x83, it seemed
  255. # like proper ELF, but extracting the string had bad results.
  256. >4 byte <0x80
  257. >>8 string >\0 (%s)
  258. >8 string \0
  259. >>7 byte 0 (SYSV)
  260. >>7 byte 1 (HP-UX)
  261. >>7 byte 2 (NetBSD)
  262. >>7 byte 3 (GNU/Linux)
  263. >>7 byte 4 (GNU/Hurd)
  264. >>7 byte 5 (86Open)
  265. >>7 byte 6 (Solaris)
  266. >>7 byte 7 (Monterey)
  267. >>7 byte 8 (IRIX)
  268. >>7 byte 9 (FreeBSD)
  269. >>7 byte 10 (Tru64)
  270. >>7 byte 11 (Novell Modesto)
  271. >>7 byte 12 (OpenBSD)
  272. # VMS Itanium added by gerardo.cacciari@gmail.com
  273. >8 string \2
  274. >>7 byte 13 (OpenVMS)
  275. >>7 byte 97 (ARM)
  276. >>7 byte 255 (embedded)