]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/elftoolchain/libelftc/libelftc_bfdtarget.c
libelftc: add RISC-V bfd targets
[FreeBSD/FreeBSD.git] / contrib / elftoolchain / libelftc / libelftc_bfdtarget.c
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/param.h>
28 #include <libelf.h>
29 #include <libelftc.h>
30
31 #include "_libelftc.h"
32
33 ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3516 2017-02-10 02:33:08Z emaste $");
34
35 struct _Elftc_Bfd_Target _libelftc_targets[] = {
36
37         {
38                 .bt_name = "binary",
39                 .bt_type = ETF_BINARY,
40         },
41
42         {
43                 .bt_name      = "elf32-avr",
44                 .bt_type      = ETF_ELF,
45                 .bt_byteorder = ELFDATA2LSB,
46                 .bt_elfclass  = ELFCLASS32,
47                 .bt_machine   = EM_AVR,
48         },
49
50         {
51                 .bt_name      = "elf32-big",
52                 .bt_type      = ETF_ELF,
53                 .bt_byteorder = ELFDATA2MSB,
54                 .bt_elfclass  = ELFCLASS32,
55         },
56
57         {
58                 .bt_name      = "elf32-bigarm",
59                 .bt_type      = ETF_ELF,
60                 .bt_byteorder = ELFDATA2MSB,
61                 .bt_elfclass  = ELFCLASS32,
62                 .bt_machine   = EM_ARM,
63         },
64
65         {
66                 .bt_name      = "elf32-bigmips",
67                 .bt_type      = ETF_ELF,
68                 .bt_byteorder = ELFDATA2MSB,
69                 .bt_elfclass  = ELFCLASS32,
70                 .bt_machine   = EM_MIPS,
71         },
72
73         {
74                 .bt_name      = "elf32-i386",
75                 .bt_type      = ETF_ELF,
76                 .bt_byteorder = ELFDATA2LSB,
77                 .bt_elfclass  = ELFCLASS32,
78                 .bt_machine   = EM_386,
79         },
80
81         {
82                 .bt_name      = "elf32-i386-freebsd",
83                 .bt_type      = ETF_ELF,
84                 .bt_byteorder = ELFDATA2LSB,
85                 .bt_elfclass  = ELFCLASS32,
86                 .bt_machine   = EM_386,
87                 .bt_osabi     = ELFOSABI_FREEBSD,
88         },
89
90         {
91                 .bt_name      = "elf32-ia64-big",
92                 .bt_type      = ETF_ELF,
93                 .bt_byteorder = ELFDATA2MSB,
94                 .bt_elfclass  = ELFCLASS32,
95                 .bt_machine   = EM_IA_64,
96         },
97
98         {
99                 .bt_name      = "elf32-little",
100                 .bt_type      = ETF_ELF,
101                 .bt_byteorder = ELFDATA2LSB,
102                 .bt_elfclass  = ELFCLASS32,
103         },
104
105         {
106                 .bt_name      = "elf32-littlearm",
107                 .bt_type      = ETF_ELF,
108                 .bt_byteorder = ELFDATA2LSB,
109                 .bt_elfclass  = ELFCLASS32,
110                 .bt_machine   = EM_ARM,
111         },
112
113         {
114                 .bt_name      = "elf32-littlemips",
115                 .bt_type      = ETF_ELF,
116                 .bt_byteorder = ELFDATA2LSB,
117                 .bt_elfclass  = ELFCLASS32,
118                 .bt_machine   = EM_MIPS,
119         },
120
121         {
122                 .bt_name      = "elf32-powerpc",
123                 .bt_type      = ETF_ELF,
124                 .bt_byteorder = ELFDATA2MSB,
125                 .bt_elfclass  = ELFCLASS32,
126                 .bt_machine   = EM_PPC,
127         },
128
129         {
130                 .bt_name      = "elf32-powerpc-freebsd",
131                 .bt_type      = ETF_ELF,
132                 .bt_byteorder = ELFDATA2MSB,
133                 .bt_elfclass  = ELFCLASS32,
134                 .bt_machine   = EM_PPC,
135                 .bt_osabi     = ELFOSABI_FREEBSD,
136         },
137
138         {
139                 .bt_name      = "elf32-powerpcle",
140                 .bt_type      = ETF_ELF,
141                 .bt_byteorder = ELFDATA2LSB,
142                 .bt_elfclass  = ELFCLASS32,
143                 .bt_machine   = EM_PPC,
144         },
145
146         {
147                 .bt_name      = "elf32-sh",
148                 .bt_type      = ETF_ELF,
149                 .bt_byteorder = ELFDATA2MSB,
150                 .bt_elfclass  = ELFCLASS32,
151                 .bt_machine   = EM_SH,
152         },
153
154         {
155                 .bt_name      = "elf32-shl",
156                 .bt_type      = ETF_ELF,
157                 .bt_byteorder = ELFDATA2LSB,
158                 .bt_elfclass  = ELFCLASS32,
159                 .bt_machine   = EM_SH,
160         },
161
162         {
163                 .bt_name      = "elf32-sh-nbsd",
164                 .bt_type      = ETF_ELF,
165                 .bt_byteorder = ELFDATA2MSB,
166                 .bt_elfclass  = ELFCLASS32,
167                 .bt_machine   = EM_SH,
168                 .bt_osabi     = ELFOSABI_NETBSD,
169         },
170
171         {
172                 .bt_name      = "elf32-shl-nbsd",
173                 .bt_type      = ETF_ELF,
174                 .bt_byteorder = ELFDATA2LSB,
175                 .bt_elfclass  = ELFCLASS32,
176                 .bt_machine   = EM_SH,
177                 .bt_osabi     = ELFOSABI_NETBSD,
178         },
179
180         {
181                 .bt_name      = "elf32-shbig-linux",
182                 .bt_type      = ETF_ELF,
183                 .bt_byteorder = ELFDATA2MSB,
184                 .bt_elfclass  = ELFCLASS32,
185                 .bt_machine   = EM_SH,
186                 .bt_osabi     = ELFOSABI_LINUX,
187         },
188
189         {
190                 .bt_name      = "elf32-sh-linux",
191                 .bt_type      = ETF_ELF,
192                 .bt_byteorder = ELFDATA2LSB,
193                 .bt_elfclass  = ELFCLASS32,
194                 .bt_machine   = EM_SH,
195                 .bt_osabi     = ELFOSABI_LINUX,
196         },
197
198         {
199                 .bt_name      = "elf32-sparc",
200                 .bt_type      = ETF_ELF,
201                 .bt_byteorder = ELFDATA2MSB,
202                 .bt_elfclass  = ELFCLASS32,
203                 .bt_machine   = EM_SPARC,
204         },
205
206         {
207                 .bt_name      = "elf32-tradbigmips",
208                 .bt_type      = ETF_ELF,
209                 .bt_byteorder = ELFDATA2MSB,
210                 .bt_elfclass  = ELFCLASS32,
211                 .bt_machine   = EM_MIPS,
212         },
213
214         {
215                 .bt_name      = "elf32-tradlittlemips",
216                 .bt_type      = ETF_ELF,
217                 .bt_byteorder = ELFDATA2LSB,
218                 .bt_elfclass  = ELFCLASS32,
219                 .bt_machine   = EM_MIPS,
220         },
221
222         {
223                 .bt_name      = "elf64-alpha",
224                 .bt_type      = ETF_ELF,
225                 .bt_byteorder = ELFDATA2LSB,
226                 .bt_elfclass  = ELFCLASS64,
227                 .bt_machine   = EM_ALPHA,
228         },
229
230         {
231                 .bt_name      = "elf64-alpha-freebsd",
232                 .bt_type      = ETF_ELF,
233                 .bt_byteorder = ELFDATA2LSB,
234                 .bt_elfclass  = ELFCLASS64,
235                 .bt_machine   = EM_ALPHA,
236                 .bt_osabi     = ELFOSABI_FREEBSD
237         },
238
239         {
240                 .bt_name      = "elf64-big",
241                 .bt_type      = ETF_ELF,
242                 .bt_byteorder = ELFDATA2MSB,
243                 .bt_elfclass  = ELFCLASS64,
244         },
245
246         {
247                 .bt_name      = "elf64-bigmips",
248                 .bt_type      = ETF_ELF,
249                 .bt_byteorder = ELFDATA2MSB,
250                 .bt_elfclass  = ELFCLASS64,
251                 .bt_machine   = EM_MIPS,
252         },
253
254         {
255                 .bt_name      = "elf64-ia64-big",
256                 .bt_type      = ETF_ELF,
257                 .bt_byteorder = ELFDATA2MSB,
258                 .bt_elfclass  = ELFCLASS64,
259                 .bt_machine   = EM_IA_64,
260         },
261
262         {
263                 .bt_name      = "elf64-ia64-little",
264                 .bt_type      = ETF_ELF,
265                 .bt_byteorder = ELFDATA2LSB,
266                 .bt_elfclass  = ELFCLASS64,
267                 .bt_machine   = EM_IA_64,
268         },
269
270         {
271                 .bt_name      = "elf64-little",
272                 .bt_type      = ETF_ELF,
273                 .bt_byteorder = ELFDATA2LSB,
274                 .bt_elfclass  = ELFCLASS64,
275         },
276
277         {
278                 .bt_name      = "elf64-littleaarch64",
279                 .bt_type      = ETF_ELF,
280                 .bt_byteorder = ELFDATA2LSB,
281                 .bt_elfclass  = ELFCLASS64,
282                 .bt_machine   = EM_AARCH64,
283         },
284
285         {
286                 .bt_name      = "elf64-littlemips",
287                 .bt_type      = ETF_ELF,
288                 .bt_byteorder = ELFDATA2LSB,
289                 .bt_elfclass  = ELFCLASS64,
290                 .bt_machine   = EM_MIPS,
291         },
292
293         {
294                 .bt_name      = "elf64-powerpc",
295                 .bt_type      = ETF_ELF,
296                 .bt_byteorder = ELFDATA2MSB,
297                 .bt_elfclass  = ELFCLASS64,
298                 .bt_machine   = EM_PPC64,
299         },
300
301         {
302                 .bt_name      = "elf64-powerpc-freebsd",
303                 .bt_type      = ETF_ELF,
304                 .bt_byteorder = ELFDATA2MSB,
305                 .bt_elfclass  = ELFCLASS64,
306                 .bt_machine   = EM_PPC64,
307                 .bt_osabi     = ELFOSABI_FREEBSD,
308         },
309
310         {
311                 .bt_name      = "elf64-powerpcle",
312                 .bt_type      = ETF_ELF,
313                 .bt_byteorder = ELFDATA2LSB,
314                 .bt_elfclass  = ELFCLASS64,
315                 .bt_machine   = EM_PPC64,
316         },
317
318         {
319                 .bt_name      = "elf32-riscv",
320                 .bt_type      = ETF_ELF,
321                 .bt_byteorder = ELFDATA2LSB,
322                 .bt_elfclass  = ELFCLASS32,
323                 .bt_machine   = EM_RISCV,
324         },
325
326         {
327                 .bt_name      = "elf64-riscv",
328                 .bt_type      = ETF_ELF,
329                 .bt_byteorder = ELFDATA2LSB,
330                 .bt_elfclass  = ELFCLASS64,
331                 .bt_machine   = EM_RISCV,
332         },
333
334         {
335                 .bt_name      = "elf64-riscv-freebsd",
336                 .bt_type      = ETF_ELF,
337                 .bt_byteorder = ELFDATA2MSB,
338                 .bt_elfclass  = ELFCLASS64,
339                 .bt_machine   = EM_RISCV,
340                 .bt_osabi     = ELFOSABI_FREEBSD,
341         },
342
343         {
344                 .bt_name      = "elf64-sh64",
345                 .bt_type      = ETF_ELF,
346                 .bt_byteorder = ELFDATA2MSB,
347                 .bt_elfclass  = ELFCLASS64,
348                 .bt_machine   = EM_SH,
349         },
350
351         {
352                 .bt_name      = "elf64-sh64l",
353                 .bt_type      = ETF_ELF,
354                 .bt_byteorder = ELFDATA2LSB,
355                 .bt_elfclass  = ELFCLASS64,
356                 .bt_machine   = EM_SH,
357         },
358
359         {
360                 .bt_name      = "elf64-sh64-nbsd",
361                 .bt_type      = ETF_ELF,
362                 .bt_byteorder = ELFDATA2MSB,
363                 .bt_elfclass  = ELFCLASS64,
364                 .bt_machine   = EM_SH,
365                 .bt_osabi     = ELFOSABI_NETBSD,
366         },
367
368         {
369                 .bt_name      = "elf64-sh64l-nbsd",
370                 .bt_type      = ETF_ELF,
371                 .bt_byteorder = ELFDATA2LSB,
372                 .bt_elfclass  = ELFCLASS64,
373                 .bt_machine   = EM_SH,
374                 .bt_osabi     = ELFOSABI_NETBSD,
375         },
376
377         {
378                 .bt_name      = "elf64-sh64big-linux",
379                 .bt_type      = ETF_ELF,
380                 .bt_byteorder = ELFDATA2MSB,
381                 .bt_elfclass  = ELFCLASS64,
382                 .bt_machine   = EM_SH,
383                 .bt_osabi     = ELFOSABI_LINUX,
384         },
385
386         {
387                 .bt_name      = "elf64-sh64-linux",
388                 .bt_type      = ETF_ELF,
389                 .bt_byteorder = ELFDATA2LSB,
390                 .bt_elfclass  = ELFCLASS64,
391                 .bt_machine   = EM_SH,
392                 .bt_osabi     = ELFOSABI_LINUX,
393         },
394
395         {
396                 .bt_name      = "elf64-sparc",
397                 .bt_type      = ETF_ELF,
398                 .bt_byteorder = ELFDATA2MSB,
399                 .bt_elfclass  = ELFCLASS64,
400                 .bt_machine   = EM_SPARCV9,
401         },
402
403         {
404                 .bt_name      = "elf64-sparc-freebsd",
405                 .bt_type      = ETF_ELF,
406                 .bt_byteorder = ELFDATA2MSB,
407                 .bt_elfclass  = ELFCLASS64,
408                 .bt_machine   = EM_SPARCV9,
409                 .bt_osabi     = ELFOSABI_FREEBSD
410         },
411
412         {
413                 .bt_name      = "elf64-tradbigmips",
414                 .bt_type      = ETF_ELF,
415                 .bt_byteorder = ELFDATA2MSB,
416                 .bt_elfclass  = ELFCLASS64,
417                 .bt_machine   = EM_MIPS,
418         },
419
420         {
421                 .bt_name      = "elf64-tradlittlemips",
422                 .bt_type      = ETF_ELF,
423                 .bt_byteorder = ELFDATA2LSB,
424                 .bt_elfclass  = ELFCLASS64,
425                 .bt_machine   = EM_MIPS,
426         },
427
428         {
429                 .bt_name      = "elf64-x86-64",
430                 .bt_type      = ETF_ELF,
431                 .bt_byteorder = ELFDATA2LSB,
432                 .bt_elfclass  = ELFCLASS64,
433                 .bt_machine   = EM_X86_64,
434         },
435
436         {
437                 .bt_name      = "elf64-x86-64-freebsd",
438                 .bt_type      = ETF_ELF,
439                 .bt_byteorder = ELFDATA2LSB,
440                 .bt_elfclass  = ELFCLASS64,
441                 .bt_machine   = EM_X86_64,
442                 .bt_osabi     = ELFOSABI_FREEBSD
443         },
444
445         {
446                 .bt_name = "ihex",
447                 .bt_type = ETF_IHEX,
448         },
449
450         {
451                 .bt_name = "srec",
452                 .bt_type = ETF_SREC,
453         },
454
455         {
456                 .bt_name = "symbolsrec",
457                 .bt_type = ETF_SREC,
458         },
459
460         {
461                 .bt_name    = "efi-app-ia32",
462                 .bt_type    = ETF_EFI,
463                 .bt_machine = EM_386,
464         },
465
466         {
467                 .bt_name    = "efi-app-x86_64",
468                 .bt_type    = ETF_EFI,
469                 .bt_machine = EM_X86_64,
470         },
471
472         {
473                 .bt_name    = "pei-i386",
474                 .bt_type    = ETF_PE,
475                 .bt_machine = EM_386,
476         },
477
478         {
479                 .bt_name    = "pei-x86-64",
480                 .bt_type    = ETF_PE,
481                 .bt_machine = EM_X86_64,
482         },
483
484         {
485                 .bt_name = NULL,
486                 .bt_type = ETF_NONE,
487         },
488 };