f4e7af52b95021ccf9fe8379032a082e28347545
[dragonfly.git] / contrib / file / magic / Magdir / elf
1
2 #------------------------------------------------------------------------------
3 # $File: elf,v 1.53 2009/09/19 16:28:09 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)
17 0       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 >>>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.
52 >>18    leshort         8               MIPS,
53 >>>36   lelong          &0x20           N32
54 >>18    leshort         10              MIPS,
55 >>>36   lelong          &0x20           N32
56 >>18    leshort         8
57 # only for 32-bit
58 >>>4    byte            1
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
68 # only for 64-bit
69 >>>4    byte            2
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,
94 >>18    leshort         40              ARM,
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         0x3426          OpenRISC (obsolete),
153 >>18    leshort         0x8472          OpenRISC (obsolete),
154 >>18    leshort         0x9026          Alpha (unofficial),
155 >>20    lelong          0               invalid version
156 >>20    lelong          1               version 1
157 >>36    lelong          1               MathCoPro/FPU/MAU Required
158 >5      byte            2               MSB
159 >>16    beshort         0               no file type,
160 !:mime  application/octet-stream
161 >>16    beshort         1               relocatable,
162 !:mime  application/x-object
163 >>16    beshort         2               executable,
164 !:mime  application/x-executable
165 >>16    beshort         3               shared object,
166 !:mime  application/x-sharedlib
167 >>16    beshort         4               core file,
168 !:mime  application/x-coredump
169 #>>>(0x38+0xcc) string  >\0             of '%s'
170 #>>>(0x38+0x10) belong  >0              (signal %d),
171 >>16    beshort         &0xff00         processor-specific,
172 >>18    beshort         0               no machine,
173 >>18    beshort         1               AT&T WE32100,
174 >>18    beshort         2               SPARC,
175 >>18    beshort         3               Intel 80386 - invalid byte order,
176 >>18    beshort         4               Motorola
177 >>>36   belong          &0x01000000     68000,
178 >>>36   belong          &0x00810000     CPU32,
179 >>>36   belong          0               68020,
180 >>18    beshort         5               Motorola 88000,
181 >>18    beshort         6               Intel 80486 - invalid byte order,
182 >>18    beshort         7               Intel 80860,
183 # only for MIPS - see comment in little-endian section above.
184 >>18    beshort         8               MIPS,
185 >>>36   belong          &0x20           N32
186 >>18    beshort         10              MIPS,
187 >>>36   belong          &0x20           N32
188 >>18    beshort         8
189 # only for 32-bit
190 >>>4    byte            1
191 >>>>36  belong&0xf0000000       0x00000000      MIPS-I
192 >>>>36  belong&0xf0000000       0x10000000      MIPS-II
193 >>>>36  belong&0xf0000000       0x20000000      MIPS-III
194 >>>>36  belong&0xf0000000       0x30000000      MIPS-IV
195 >>>>36  belong&0xf0000000       0x40000000      MIPS-V
196 >>>>36  belong&0xf0000000       0x50000000      MIPS32
197 >>>>36  belong&0xf0000000       0x60000000      MIPS64
198 >>>>36  belong&0xf0000000       0x70000000      MIPS32 rel2
199 >>>>36  belong&0xf0000000       0x80000000      MIPS64 rel2
200 # only for 64-bit
201 >>>4    byte            2
202 >>>>48  belong&0xf0000000       0x00000000      MIPS-I
203 >>>>48  belong&0xf0000000       0x10000000      MIPS-II
204 >>>>48  belong&0xf0000000       0x20000000      MIPS-III
205 >>>>48  belong&0xf0000000       0x30000000      MIPS-IV
206 >>>>48  belong&0xf0000000       0x40000000      MIPS-V
207 >>>>48  belong&0xf0000000       0x50000000      MIPS32
208 >>>>48  belong&0xf0000000       0x60000000      MIPS64
209 >>>>48  belong&0xf0000000       0x70000000      MIPS32 rel2
210 >>>>48  belong&0xf0000000       0x80000000      MIPS64 rel2
211 >>18    beshort         9               Amdahl,
212 >>18    beshort         10              MIPS (deprecated),
213 >>18    beshort         11              RS6000,
214 >>18    beshort         15              PA-RISC
215 >>>50   beshort         0x0214          2.0
216 >>>48   beshort         &0x0008         (LP64)
217 >>18    beshort         16              nCUBE,
218 >>18    beshort         17              Fujitsu VPP500,
219 >>18    beshort         18              SPARC32PLUS,
220 >>>36   belong&0xffff00 0x000100        V8+ Required,
221 >>>36   belong&0xffff00 0x000200        Sun UltraSPARC1 Extensions Required,
222 >>>36   belong&0xffff00 0x000400        HaL R1 Extensions Required,
223 >>>36   belong&0xffff00 0x000800        Sun UltraSPARC3 Extensions Required,
224 >>18    beshort         20              PowerPC or cisco 4500,
225 >>18    beshort         21              64-bit PowerPC or cisco 7500,
226 >>18    beshort         22              IBM S/390,
227 >>18    beshort         23              Cell SPU,
228 >>18    beshort         24              cisco SVIP,
229 >>18    beshort         25              cisco 7200,
230 >>18    beshort         36              NEC V800 or cisco 12000,
231 >>18    beshort         37              Fujitsu FR20,
232 >>18    beshort         38              TRW RH-32,
233 >>18    beshort         39              Motorola RCE,
234 >>18    beshort         40              ARM,
235 >>18    beshort         41              Alpha,
236 >>18    beshort         42              Renesas SH,
237 >>18    beshort         43              SPARC V9,
238 >>>48   belong&0xffff00 0x000200        Sun UltraSPARC1 Extensions Required,
239 >>>48   belong&0xffff00 0x000400        HaL R1 Extensions Required,
240 >>>48   belong&0xffff00 0x000800        Sun UltraSPARC3 Extensions Required,
241 >>>48   belong&0x3      0               total store ordering,
242 >>>48   belong&0x3      1               partial store ordering,
243 >>>48   belong&0x3      2               relaxed memory ordering,
244 >>18    beshort         44              Siemens Tricore Embedded Processor,
245 >>18    beshort         45              Argonaut RISC Core, Argonaut Technologies Inc.,
246 >>18    beshort         46              Renesas H8/300,
247 >>18    beshort         47              Renesas H8/300H,
248 >>18    beshort         48              Renesas H8S,
249 >>18    beshort         49              Renesas H8/500,
250 >>18    beshort         50              IA-64,
251 >>18    beshort         51              Stanford MIPS-X,
252 >>18    beshort         52              Motorola Coldfire,
253 >>18    beshort         53              Motorola M68HC12,
254 >>18    beshort         73              Cray NV1,
255 >>18    beshort         75              Digital VAX,
256 >>18    beshort         88              Renesas M32R,
257 >>18    leshort         92              OpenRISC,
258 >>18    leshort         0x3426          OpenRISC (obsolete),
259 >>18    leshort         0x8472          OpenRISC (obsolete),
260 >>18    beshort         94              Tensilica Xtensa,
261 >>18    beshort         97              NatSemi 32k,
262 >>18    beshort         0x18ad          AVR32 (unofficial),
263 >>18    beshort         0x9026          Alpha (unofficial),
264 >>18    beshort         0xa390          IBM S/390 (obsolete),
265 >>20    belong          0               invalid version
266 >>20    belong          1               version 1
267 >>36    belong          1               MathCoPro/FPU/MAU Required
268 # Up to now only 0, 1 and 2 are defined; I've seen a file with 0x83, it seemed
269 # like proper ELF, but extracting the string had bad results.
270 >4      byte            <0x80
271 >>8     string          >\0             (%s)
272 >8      string          \0
273 >>7     byte            0               (SYSV)
274 >>7     byte            1               (HP-UX)
275 >>7     byte            2               (NetBSD)
276 >>7     byte            3               (GNU/Linux)
277 >>7     byte            4               (GNU/Hurd)
278 >>7     byte            5               (86Open)
279 >>7     byte            6               (Solaris)
280 >>7     byte            7               (Monterey)
281 >>7     byte            8               (IRIX)
282 >>7     byte            9               (FreeBSD)
283 >>7     byte            10              (Tru64)
284 >>7     byte            11              (Novell Modesto)
285 >>7     byte            12              (OpenBSD)
286 >8      string          \2
287 >>7     byte            13              (OpenVMS)
288 >>7     byte            97              (ARM)
289 >>7     byte            255             (embedded)