xref: /freebsd/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c (revision bbb29a3c0f2c4565eff6fda70426807b6ed97f8b)
1 /*-
2  * Copyright (c) 2008,2009 Kai Wang
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer
10  *    in this position and unchanged.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18  * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  */
26 
27 #include <sys/cdefs.h>
28 
29 #include <sys/param.h>
30 #include <libelf.h>
31 #include <libelftc.h>
32 
33 #include "_libelftc.h"
34 
35 ELFTC_VCSID("$Id: libelftc_bfdtarget.c 2251 2011-11-30 16:50:06Z jkoshy $");
36 
37 struct _Elftc_Bfd_Target _libelftc_targets[] = {
38 
39 	{
40 		.bt_name = "binary",
41 		.bt_type = ETF_BINARY,
42 	},
43 
44 	{
45 		.bt_name      = "elf32-avr",
46 		.bt_type      = ETF_ELF,
47 		.bt_byteorder = ELFDATA2LSB,
48 		.bt_elfclass  = ELFCLASS32,
49 		.bt_machine   = EM_AVR,
50 	},
51 
52 	{
53 		.bt_name      = "elf32-big",
54 		.bt_type      = ETF_ELF,
55 		.bt_byteorder = ELFDATA2MSB,
56 		.bt_elfclass  = ELFCLASS32,
57 	},
58 
59 	{
60 		.bt_name      = "elf32-bigarm",
61 		.bt_type      = ETF_ELF,
62 		.bt_byteorder = ELFDATA2MSB,
63 		.bt_elfclass  = ELFCLASS32,
64 		.bt_machine   = EM_ARM,
65 	},
66 
67 	{
68 		.bt_name      = "elf32-bigmips",
69 		.bt_type      = ETF_ELF,
70 		.bt_byteorder = ELFDATA2MSB,
71 		.bt_elfclass  = ELFCLASS32,
72 		.bt_machine   = EM_MIPS,
73 	},
74 
75 	{
76 		.bt_name      = "elf32-i386",
77 		.bt_type      = ETF_ELF,
78 		.bt_byteorder = ELFDATA2LSB,
79 		.bt_elfclass  = ELFCLASS32,
80 		.bt_machine   = EM_386,
81 	},
82 
83 	{
84 		.bt_name      = "elf32-i386-freebsd",
85 		.bt_type      = ETF_ELF,
86 		.bt_byteorder = ELFDATA2LSB,
87 		.bt_elfclass  = ELFCLASS32,
88 		.bt_machine   = EM_386,
89 		.bt_osabi     = ELFOSABI_FREEBSD,
90 	},
91 
92 	{
93 		.bt_name      = "elf32-ia64-big",
94 		.bt_type      = ETF_ELF,
95 		.bt_byteorder = ELFDATA2MSB,
96 		.bt_elfclass  = ELFCLASS32,
97 		.bt_machine   = EM_IA_64,
98 	},
99 
100 	{
101 		.bt_name      = "elf32-little",
102 		.bt_type      = ETF_ELF,
103 		.bt_byteorder = ELFDATA2LSB,
104 		.bt_elfclass  = ELFCLASS32,
105 	},
106 
107 	{
108 		.bt_name      = "elf32-littlearm",
109 		.bt_type      = ETF_ELF,
110 		.bt_byteorder = ELFDATA2LSB,
111 		.bt_elfclass  = ELFCLASS32,
112 		.bt_machine   = EM_ARM,
113 	},
114 
115 	{
116 		.bt_name      = "elf32-littlemips",
117 		.bt_type      = ETF_ELF,
118 		.bt_byteorder = ELFDATA2LSB,
119 		.bt_elfclass  = ELFCLASS32,
120 		.bt_machine   = EM_MIPS,
121 	},
122 
123 	{
124 		.bt_name      = "elf32-powerpc",
125 		.bt_type      = ETF_ELF,
126 		.bt_byteorder = ELFDATA2MSB,
127 		.bt_elfclass  = ELFCLASS32,
128 		.bt_machine   = EM_PPC,
129 	},
130 
131 	{
132 		.bt_name      = "elf32-powerpcle",
133 		.bt_type      = ETF_ELF,
134 		.bt_byteorder = ELFDATA2LSB,
135 		.bt_elfclass  = ELFCLASS32,
136 		.bt_machine   = EM_PPC,
137 	},
138 
139 	{
140 		.bt_name      = "elf32-sh",
141 		.bt_type      = ETF_ELF,
142 		.bt_byteorder = ELFDATA2MSB,
143 		.bt_elfclass  = ELFCLASS32,
144 		.bt_machine   = EM_SH,
145 	},
146 
147 	{
148 		.bt_name      = "elf32-shl",
149 		.bt_type      = ETF_ELF,
150 		.bt_byteorder = ELFDATA2LSB,
151 		.bt_elfclass  = ELFCLASS32,
152 		.bt_machine   = EM_SH,
153 	},
154 
155 	{
156 		.bt_name      = "elf32-sh-nbsd",
157 		.bt_type      = ETF_ELF,
158 		.bt_byteorder = ELFDATA2MSB,
159 		.bt_elfclass  = ELFCLASS32,
160 		.bt_machine   = EM_SH,
161 		.bt_osabi     = ELFOSABI_NETBSD,
162 	},
163 
164 	{
165 		.bt_name      = "elf32-shl-nbsd",
166 		.bt_type      = ETF_ELF,
167 		.bt_byteorder = ELFDATA2LSB,
168 		.bt_elfclass  = ELFCLASS32,
169 		.bt_machine   = EM_SH,
170 		.bt_osabi     = ELFOSABI_NETBSD,
171 	},
172 
173 	{
174 		.bt_name      = "elf32-shbig-linux",
175 		.bt_type      = ETF_ELF,
176 		.bt_byteorder = ELFDATA2MSB,
177 		.bt_elfclass  = ELFCLASS32,
178 		.bt_machine   = EM_SH,
179 		.bt_osabi     = ELFOSABI_LINUX,
180 	},
181 
182 	{
183 		.bt_name      = "elf32-sh-linux",
184 		.bt_type      = ETF_ELF,
185 		.bt_byteorder = ELFDATA2LSB,
186 		.bt_elfclass  = ELFCLASS32,
187 		.bt_machine   = EM_SH,
188 		.bt_osabi     = ELFOSABI_LINUX,
189 	},
190 
191 	{
192 		.bt_name      = "elf32-sparc",
193 		.bt_type      = ETF_ELF,
194 		.bt_byteorder = ELFDATA2MSB,
195 		.bt_elfclass  = ELFCLASS32,
196 		.bt_machine   = EM_SPARC,
197 	},
198 
199 	{
200 		.bt_name      = "elf64-alpha",
201 		.bt_type      = ETF_ELF,
202 		.bt_byteorder = ELFDATA2LSB,
203 		.bt_elfclass  = ELFCLASS64,
204 		.bt_machine   = EM_ALPHA,
205 	},
206 
207 	{
208 		.bt_name      = "elf64-alpha-freebsd",
209 		.bt_type      = ETF_ELF,
210 		.bt_byteorder = ELFDATA2LSB,
211 		.bt_elfclass  = ELFCLASS64,
212 		.bt_machine   = EM_ALPHA,
213 		.bt_osabi     = ELFOSABI_FREEBSD
214 	},
215 
216 	{
217 		.bt_name      = "elf64-big",
218 		.bt_type      = ETF_ELF,
219 		.bt_byteorder = ELFDATA2MSB,
220 		.bt_elfclass  = ELFCLASS64,
221 	},
222 
223 	{
224 		.bt_name      = "elf64-bigmips",
225 		.bt_type      = ETF_ELF,
226 		.bt_byteorder = ELFDATA2MSB,
227 		.bt_elfclass  = ELFCLASS64,
228 		.bt_machine   = EM_MIPS,
229 	},
230 
231 	{
232 		.bt_name      = "elf64-ia64-big",
233 		.bt_type      = ETF_ELF,
234 		.bt_byteorder = ELFDATA2MSB,
235 		.bt_elfclass  = ELFCLASS64,
236 		.bt_machine   = EM_IA_64,
237 	},
238 
239 	{
240 		.bt_name      = "elf64-ia64-little",
241 		.bt_type      = ETF_ELF,
242 		.bt_byteorder = ELFDATA2LSB,
243 		.bt_elfclass  = ELFCLASS64,
244 		.bt_machine   = EM_IA_64,
245 	},
246 
247 	{
248 		.bt_name      = "elf64-little",
249 		.bt_type      = ETF_ELF,
250 		.bt_byteorder = ELFDATA2LSB,
251 		.bt_elfclass  = ELFCLASS64,
252 	},
253 
254 	{
255 		.bt_name      = "elf64-littlemips",
256 		.bt_type      = ETF_ELF,
257 		.bt_byteorder = ELFDATA2LSB,
258 		.bt_elfclass  = ELFCLASS64,
259 		.bt_machine   = EM_MIPS,
260 	},
261 
262 	{
263 		.bt_name      = "elf64-powerpc",
264 		.bt_type      = ETF_ELF,
265 		.bt_byteorder = ELFDATA2MSB,
266 		.bt_elfclass  = ELFCLASS64,
267 		.bt_machine   = EM_PPC64,
268 	},
269 
270 	{
271 		.bt_name      = "elf64-powerpcle",
272 		.bt_type      = ETF_ELF,
273 		.bt_byteorder = ELFDATA2LSB,
274 		.bt_elfclass  = ELFCLASS64,
275 		.bt_machine   = EM_PPC64,
276 	},
277 
278 	{
279 		.bt_name      = "elf64-sh64",
280 		.bt_type      = ETF_ELF,
281 		.bt_byteorder = ELFDATA2MSB,
282 		.bt_elfclass  = ELFCLASS64,
283 		.bt_machine   = EM_SH,
284 	},
285 
286 	{
287 		.bt_name      = "elf64-sh64l",
288 		.bt_type      = ETF_ELF,
289 		.bt_byteorder = ELFDATA2LSB,
290 		.bt_elfclass  = ELFCLASS64,
291 		.bt_machine   = EM_SH,
292 	},
293 
294 	{
295 		.bt_name      = "elf64-sh64-nbsd",
296 		.bt_type      = ETF_ELF,
297 		.bt_byteorder = ELFDATA2MSB,
298 		.bt_elfclass  = ELFCLASS64,
299 		.bt_machine   = EM_SH,
300 		.bt_osabi     = ELFOSABI_NETBSD,
301 	},
302 
303 	{
304 		.bt_name      = "elf64-sh64l-nbsd",
305 		.bt_type      = ETF_ELF,
306 		.bt_byteorder = ELFDATA2LSB,
307 		.bt_elfclass  = ELFCLASS64,
308 		.bt_machine   = EM_SH,
309 		.bt_osabi     = ELFOSABI_NETBSD,
310 	},
311 
312 	{
313 		.bt_name      = "elf64-sh64big-linux",
314 		.bt_type      = ETF_ELF,
315 		.bt_byteorder = ELFDATA2MSB,
316 		.bt_elfclass  = ELFCLASS64,
317 		.bt_machine   = EM_SH,
318 		.bt_osabi     = ELFOSABI_LINUX,
319 	},
320 
321 	{
322 		.bt_name      = "elf64-sh64-linux",
323 		.bt_type      = ETF_ELF,
324 		.bt_byteorder = ELFDATA2LSB,
325 		.bt_elfclass  = ELFCLASS64,
326 		.bt_machine   = EM_SH,
327 		.bt_osabi     = ELFOSABI_LINUX,
328 	},
329 
330 	{
331 		.bt_name      = "elf64-sparc",
332 		.bt_type      = ETF_ELF,
333 		.bt_byteorder = ELFDATA2MSB,
334 		.bt_elfclass  = ELFCLASS64,
335 		.bt_machine   = EM_SPARCV9,
336 	},
337 
338 	{
339 		.bt_name      = "elf64-sparc-freebsd",
340 		.bt_type      = ETF_ELF,
341 		.bt_byteorder = ELFDATA2MSB,
342 		.bt_elfclass  = ELFCLASS64,
343 		.bt_machine   = EM_SPARCV9,
344 		.bt_osabi     = ELFOSABI_FREEBSD
345 	},
346 
347 	{
348 		.bt_name      = "elf64-x86-64",
349 		.bt_type      = ETF_ELF,
350 		.bt_byteorder =	ELFDATA2LSB,
351 		.bt_elfclass  = ELFCLASS64,
352 		.bt_machine   = EM_X86_64,
353 	},
354 
355 	{
356 		.bt_name      = "elf64-x86-64-freebsd",
357 		.bt_type      = ETF_ELF,
358 		.bt_byteorder = ELFDATA2LSB,
359 		.bt_elfclass  = ELFCLASS64,
360 		.bt_machine   = EM_X86_64,
361 		.bt_osabi     = ELFOSABI_FREEBSD
362 	},
363 
364 	{
365 		.bt_name = "ihex",
366 		.bt_type = ETF_IHEX,
367 	},
368 
369 	{
370 		.bt_name = "srec",
371 		.bt_type = ETF_SREC,
372 	},
373 
374 	{
375 		.bt_name = "symbolsrec",
376 		.bt_type = ETF_SREC,
377 	},
378 
379 	{
380 		.bt_name = NULL,
381 		.bt_type = ETF_NONE,
382 	},
383 };
384