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