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