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