Commit | Line | Data |
---|---|---|
154a1ee5 TG |
1 | /* Intel i386 Mach-O support for BFD. |
2 | Copyright 2009 | |
3 | Free Software Foundation, Inc. | |
4 | ||
5 | This file is part of BFD, the Binary File Descriptor library. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 3 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program; if not, write to the Free Software | |
19 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
20 | MA 02110-1301, USA. */ | |
21 | ||
22 | #include "sysdep.h" | |
23 | #include "mach-o.h" | |
24 | #include "bfd.h" | |
25 | #include "libbfd.h" | |
26 | #include "libiberty.h" | |
27 | ||
28 | #define bfd_mach_o_object_p bfd_mach_o_i386_object_p | |
29 | #define bfd_mach_o_core_p bfd_mach_o_i386_core_p | |
30 | #define bfd_mach_o_mkobject bfd_mach_o_i386_mkobject | |
31 | ||
32 | static const bfd_target * | |
33 | bfd_mach_o_i386_object_p (bfd *abfd) | |
34 | { | |
35 | return bfd_mach_o_header_p (abfd, 0, BFD_MACH_O_CPU_TYPE_I386); | |
36 | } | |
37 | ||
38 | static const bfd_target * | |
39 | bfd_mach_o_i386_core_p (bfd *abfd) | |
40 | { | |
41 | return bfd_mach_o_header_p (abfd, | |
42 | BFD_MACH_O_MH_CORE, BFD_MACH_O_CPU_TYPE_I386); | |
43 | } | |
44 | ||
45 | static bfd_boolean | |
46 | bfd_mach_o_i386_mkobject (bfd *abfd) | |
47 | { | |
48 | bfd_mach_o_data_struct *mdata; | |
49 | ||
50 | if (!bfd_mach_o_mkobject_init (abfd)) | |
51 | return FALSE; | |
52 | ||
53 | mdata = abfd->tdata.mach_o_data; | |
54 | mdata->header.magic = BFD_MACH_O_MH_MAGIC; | |
55 | mdata->header.cputype = BFD_MACH_O_CPU_TYPE_I386; | |
56 | mdata->header.cpusubtype = BFD_MACH_O_CPU_SUBTYPE_X86_ALL; | |
154a1ee5 TG |
57 | mdata->header.byteorder = BFD_ENDIAN_LITTLE; |
58 | mdata->header.version = 1; | |
59 | ||
60 | return TRUE; | |
61 | } | |
62 | ||
63 | #define TARGET_NAME mach_o_i386_vec | |
64 | #define TARGET_STRING "mach-o-i386" | |
65 | #define TARGET_BIG_ENDIAN 0 | |
66 | #define TARGET_ARCHIVE 0 | |
67 | ||
68 | #include "mach-o-target.c" |