elf 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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. >>16 leshort 1 relocatable,
  18. >>16 leshort 2 executable,
  19. >>16 leshort 3 shared object,
  20. # Core handling from Peter Tobias <tobias@server.et-inf.fho-emden.de>
  21. # corrections by Christian 'Dr. Disk' Hechelmann <drdisk@ds9.au.s.shuttle.de>
  22. >>16 leshort 4 core file
  23. # Core file detection is not reliable.
  24. #>>>(0x38+0xcc) string >\0 of '%s'
  25. #>>>(0x38+0x10) lelong >0 (signal %d),
  26. >>16 leshort &0xff00 processor-specific,
  27. >>18 leshort 0 no machine,
  28. >>18 leshort 1 AT&T WE32100 - invalid byte order,
  29. >>18 leshort 2 SPARC - invalid byte order,
  30. >>18 leshort 3 Intel 80386,
  31. >>18 leshort 4 Motorola
  32. >>>36 lelong &0x01000000 68000 - invalid byte order,
  33. >>>36 lelong &0x00810000 CPU32 - invalid byte order,
  34. >>>36 lelong 0 68020 - invalid byte order,
  35. >>18 leshort 5 Motorola 88000 - invalid byte order,
  36. >>18 leshort 6 Intel 80486,
  37. >>18 leshort 7 Intel 80860,
  38. # The official e_machine number for MIPS is now #8, regardless of endianness.
  39. # The second number (#10) will be deprecated later. For now, we still
  40. # say something if #10 is encountered, but only gory details for #8.
  41. >>18 leshort 8 MIPS,
  42. >>>36 lelong &0x20 N32
  43. >>18 leshort 10 MIPS,
  44. >>>36 lelong &0x20 N32
  45. >>18 leshort 8
  46. # only for 32-bit
  47. >>>4 byte 1
  48. >>>>36 lelong&0xf0000000 0x00000000 MIPS-I
  49. >>>>36 lelong&0xf0000000 0x10000000 MIPS-II
  50. >>>>36 lelong&0xf0000000 0x20000000 MIPS-III
  51. >>>>36 lelong&0xf0000000 0x30000000 MIPS-IV
  52. >>>>36 lelong&0xf0000000 0x40000000 MIPS-V
  53. >>>>36 lelong&0xf0000000 0x60000000 MIPS32
  54. >>>>36 lelong&0xf0000000 0x70000000 MIPS64
  55. >>>>36 lelong&0xf0000000 0x80000000 MIPS32 rel2
  56. >>>>36 lelong&0xf0000000 0x90000000 MIPS64 rel2
  57. # only for 64-bit
  58. >>>4 byte 2
  59. >>>>48 lelong&0xf0000000 0x00000000 MIPS-I
  60. >>>>48 lelong&0xf0000000 0x10000000 MIPS-II
  61. >>>>48 lelong&0xf0000000 0x20000000 MIPS-III
  62. >>>>48 lelong&0xf0000000 0x30000000 MIPS-IV
  63. >>>>48 lelong&0xf0000000 0x40000000 MIPS-V
  64. >>>>48 lelong&0xf0000000 0x60000000 MIPS32
  65. >>>>48 lelong&0xf0000000 0x70000000 MIPS64
  66. >>>>48 lelong&0xf0000000 0x80000000 MIPS32 rel2
  67. >>>>48 lelong&0xf0000000 0x90000000 MIPS64 rel2
  68. >>18 leshort 9 Amdahl - invalid byte order,
  69. >>18 leshort 10 MIPS (deprecated),
  70. >>18 leshort 11 RS6000 - invalid byte order,
  71. >>18 leshort 15 PA-RISC - invalid byte order,
  72. >>>50 leshort 0x0214 2.0
  73. >>>48 leshort &0x0008 (LP64),
  74. >>18 leshort 16 nCUBE,
  75. >>18 leshort 17 Fujitsu VPP500,
  76. >>18 leshort 18 SPARC32PLUS,
  77. >>18 leshort 20 PowerPC,
  78. >>18 leshort 22 IBM S/390,
  79. >>18 leshort 36 NEC V800,
  80. >>18 leshort 37 Fujitsu FR20,
  81. >>18 leshort 38 TRW RH-32,
  82. >>18 leshort 39 Motorola RCE,
  83. >>18 leshort 40 ARM,
  84. >>18 leshort 41 Alpha,
  85. >>18 leshort 0xa390 IBM S/390 (obsolete),
  86. >>18 leshort 42 Renesas SH,
  87. >>18 leshort 43 SPARC V9 - invalid byte order,
  88. >>18 leshort 44 Siemens Tricore Embedded Processor,
  89. >>18 leshort 45 Argonaut RISC Core, Argonaut Technologies Inc.,
  90. >>18 leshort 46 Renesas H8/300,
  91. >>18 leshort 47 Renesas H8/300H,
  92. >>18 leshort 48 Renesas H8S,
  93. >>18 leshort 49 Renesas H8/500,
  94. >>18 leshort 50 IA-64,
  95. >>18 leshort 51 Stanford MIPS-X,
  96. >>18 leshort 52 Motorola Coldfire,
  97. >>18 leshort 53 Motorola M68HC12,
  98. >>18 leshort 62 x86-64,
  99. >>18 leshort 75 Digital VAX,
  100. >>18 leshort 88 Renesas M32R,
  101. >>18 leshort 94 Tensilica Xtensa,
  102. >>18 leshort 97 NatSemi 32k,
  103. >>18 leshort 106 Analog Devices Blackfin,
  104. >>18 leshort 0x9026 Alpha (unofficial),
  105. >>20 lelong 0 invalid version
  106. >>20 lelong 1 version 1
  107. >>36 lelong 1 MathCoPro/FPU/MAU Required
  108. >5 byte 2 MSB
  109. >>16 beshort 0 no file type,
  110. >>16 beshort 1 relocatable,
  111. >>16 beshort 2 executable,
  112. >>16 beshort 3 shared object,
  113. >>16 beshort 4 core file,
  114. #>>>(0x38+0xcc) string >\0 of '%s'
  115. #>>>(0x38+0x10) belong >0 (signal %d),
  116. >>16 beshort &0xff00 processor-specific,
  117. >>18 beshort 0 no machine,
  118. >>18 beshort 1 AT&T WE32100,
  119. >>18 beshort 2 SPARC,
  120. >>18 beshort 3 Intel 80386 - invalid byte order,
  121. >>18 beshort 4 Motorola
  122. >>>36 belong &0x01000000 68000,
  123. >>>36 belong &0x00810000 CPU32,
  124. >>>36 belong 0 68020,
  125. >>18 beshort 5 Motorola 88000,
  126. >>18 beshort 6 Intel 80486 - invalid byte order,
  127. >>18 beshort 7 Intel 80860,
  128. # only for MIPS - see comment in little-endian section above.
  129. >>18 beshort 8 MIPS,
  130. >>>36 belong &0x20 N32
  131. >>18 beshort 10 MIPS,
  132. >>>36 belong &0x20 N32
  133. >>18 beshort 8
  134. # only for 32-bit
  135. >>>4 byte 1
  136. >>>>36 belong&0xf0000000 0x00000000 MIPS-I
  137. >>>>36 belong&0xf0000000 0x10000000 MIPS-II
  138. >>>>36 belong&0xf0000000 0x20000000 MIPS-III
  139. >>>>36 belong&0xf0000000 0x30000000 MIPS-IV
  140. >>>>36 belong&0xf0000000 0x40000000 MIPS-V
  141. >>>>36 belong&0xf0000000 0x60000000 MIPS32
  142. >>>>36 belong&0xf0000000 0x70000000 MIPS64
  143. >>>>36 belong&0xf0000000 0x80000000 MIPS32 rel2
  144. >>>>36 belong&0xf0000000 0x90000000 MIPS64 rel2
  145. # only for 64-bit
  146. >>>4 byte 2
  147. >>>>48 belong&0xf0000000 0x00000000 MIPS-I
  148. >>>>48 belong&0xf0000000 0x10000000 MIPS-II
  149. >>>>48 belong&0xf0000000 0x20000000 MIPS-III
  150. >>>>48 belong&0xf0000000 0x30000000 MIPS-IV
  151. >>>>48 belong&0xf0000000 0x40000000 MIPS-V
  152. >>>>48 belong&0xf0000000 0x60000000 MIPS32
  153. >>>>48 belong&0xf0000000 0x70000000 MIPS64
  154. >>>>48 belong&0xf0000000 0x80000000 MIPS32 rel2
  155. >>>>48 belong&0xf0000000 0x90000000 MIPS64 rel2
  156. >>18 beshort 9 Amdahl,
  157. >>18 beshort 10 MIPS (deprecated),
  158. >>18 beshort 11 RS6000,
  159. >>18 beshort 15 PA-RISC
  160. >>>50 beshort 0x0214 2.0
  161. >>>48 beshort &0x0008 (LP64)
  162. >>18 beshort 16 nCUBE,
  163. >>18 beshort 17 Fujitsu VPP500,
  164. >>18 beshort 18 SPARC32PLUS,
  165. >>>36 belong&0xffff00 &0x000100 V8+ Required,
  166. >>>36 belong&0xffff00 &0x000200 Sun UltraSPARC1 Extensions Required,
  167. >>>36 belong&0xffff00 &0x000400 HaL R1 Extensions Required,
  168. >>>36 belong&0xffff00 &0x000800 Sun UltraSPARC3 Extensions Required,
  169. >>18 beshort 20 PowerPC or cisco 4500,
  170. >>18 beshort 21 64-bit PowerPC or cisco 7500,
  171. >>18 beshort 22 IBM S/390,
  172. >>18 beshort 23 Cell SPU,
  173. >>18 beshort 24 cisco SVIP,
  174. >>18 beshort 25 cisco 7200,
  175. >>18 beshort 36 NEC V800 or cisco 12000,
  176. >>18 beshort 37 Fujitsu FR20,
  177. >>18 beshort 38 TRW RH-32,
  178. >>18 beshort 39 Motorola RCE,
  179. >>18 beshort 40 ARM,
  180. >>18 beshort 41 Alpha,
  181. >>18 beshort 42 Renesas SH,
  182. >>18 beshort 43 SPARC V9,
  183. >>18 beshort 44 Siemens Tricore Embedded Processor,
  184. >>18 beshort 45 Argonaut RISC Core, Argonaut Technologies Inc.,
  185. >>18 beshort 46 Renesas H8/300,
  186. >>18 beshort 47 Renesas H8/300H,
  187. >>18 beshort 48 Renesas H8S,
  188. >>18 beshort 49 Renesas H8/500,
  189. >>18 beshort 50 IA-64,
  190. >>18 beshort 51 Stanford MIPS-X,
  191. >>18 beshort 52 Motorola Coldfire,
  192. >>18 beshort 53 Motorola M68HC12,
  193. >>18 beshort 73 Cray NV1,
  194. >>18 beshort 75 Digital VAX,
  195. >>18 beshort 88 Renesas M32R,
  196. >>18 beshort 94 Tensilica Xtensa,
  197. >>18 beshort 97 NatSemi 32k,
  198. >>18 beshort 0x9026 Alpha (unofficial),
  199. >>18 beshort 0xa390 IBM S/390 (obsolete),
  200. >>20 belong 0 invalid version
  201. >>20 belong 1 version 1
  202. >>36 belong 1 MathCoPro/FPU/MAU Required
  203. # Up to now only 0, 1 and 2 are defined; I've seen a file with 0x83, it seemed
  204. # like proper ELF, but extracting the string had bad results.
  205. >4 byte <0x80
  206. >>8 string >\0 (%s)
  207. >8 string \0
  208. >>7 byte 0 (SYSV)
  209. >>7 byte 1 (HP-UX)
  210. >>7 byte 2 (NetBSD)
  211. >>7 byte 3 (GNU/Linux)
  212. >>7 byte 4 (GNU/Hurd)
  213. >>7 byte 5 (86Open)
  214. >>7 byte 6 (Solaris)
  215. >>7 byte 7 (Monterey)
  216. >>7 byte 8 (IRIX)
  217. >>7 byte 9 (FreeBSD)
  218. >>7 byte 10 (Tru64)
  219. >>7 byte 11 (Novell Modesto)
  220. >>7 byte 12 (OpenBSD)
  221. # VMS Itanium added by gerardo.cacciari@gmail.com
  222. >8 string \2
  223. >>7 byte 13 (OpenVMS)
  224. >>7 byte 97 (ARM)
  225. >>7 byte 255 (embedded)