]>
Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* BFD support for the Intel 386 architecture. |
aa820537 | 2 | Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2004, 2005, |
889a4d3e | 3 | 2007, 2009, 2010, 2011 |
7898deda | 4 | Free Software Foundation, Inc. |
252b5132 | 5 | |
cd123cb7 | 6 | This file is part of BFD, the Binary File Descriptor library. |
252b5132 | 7 | |
cd123cb7 NC |
8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 3 of the License, or | |
11 | (at your option) any later version. | |
252b5132 | 12 | |
cd123cb7 NC |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
252b5132 | 17 | |
cd123cb7 NC |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | |
20 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
21 | MA 02110-1301, USA. */ | |
252b5132 | 22 | |
252b5132 | 23 | #include "sysdep.h" |
3db64b00 | 24 | #include "bfd.h" |
252b5132 RH |
25 | #include "libbfd.h" |
26 | ||
889a4d3e L |
27 | static const bfd_arch_info_type * |
28 | bfd_i386_compatible (const bfd_arch_info_type *a, | |
29 | const bfd_arch_info_type *b) | |
30 | { | |
31 | const bfd_arch_info_type *compat = bfd_default_compatible (a, b); | |
32 | ||
33 | /* Don't allow mixing x64_32 with x86_64. */ | |
d7921315 L |
34 | if (compat |
35 | && (a->mach & bfd_mach_x64_32) != (b->mach & bfd_mach_x64_32)) | |
889a4d3e L |
36 | compat = NULL; |
37 | ||
38 | return compat; | |
39 | } | |
40 | ||
351f65ca L |
41 | static const bfd_arch_info_type bfd_x64_32_arch_intel_syntax = |
42 | { | |
43 | 64, /* 64 bits in a word */ | |
d7921315 | 44 | 64, /* 64 bits in an address */ |
351f65ca L |
45 | 8, /* 8 bits in a byte */ |
46 | bfd_arch_i386, | |
47 | bfd_mach_x64_32_intel_syntax, | |
48 | "i386:intel", | |
49 | "i386:x64-32:intel", | |
50 | 3, | |
51 | FALSE, | |
889a4d3e | 52 | bfd_i386_compatible, |
351f65ca L |
53 | bfd_default_scan, |
54 | 0 | |
55 | }; | |
56 | ||
34274ccc | 57 | static const bfd_arch_info_type bfd_x86_64_arch_intel_syntax = |
8d88c4ca NC |
58 | { |
59 | 64, /* 64 bits in a word */ | |
60 | 64, /* 64 bits in an address */ | |
61 | 8, /* 8 bits in a byte */ | |
62 | bfd_arch_i386, | |
63 | bfd_mach_x86_64_intel_syntax, | |
beb43bb9 JH |
64 | "i386:intel", |
65 | "i386:x86-64:intel", | |
8d88c4ca | 66 | 3, |
1abc8597 | 67 | FALSE, |
889a4d3e | 68 | bfd_i386_compatible, |
1abc8597 | 69 | bfd_default_scan, |
351f65ca | 70 | &bfd_x64_32_arch_intel_syntax, |
1abc8597 AM |
71 | }; |
72 | ||
34274ccc | 73 | static const bfd_arch_info_type bfd_i386_arch_intel_syntax = |
1abc8597 AM |
74 | { |
75 | 32, /* 32 bits in a word */ | |
76 | 32, /* 32 bits in an address */ | |
77 | 8, /* 8 bits in a byte */ | |
78 | bfd_arch_i386, | |
79 | bfd_mach_i386_i386_intel_syntax, | |
80 | "i386:intel", | |
81 | "i386:intel", | |
82 | 3, | |
b34976b6 | 83 | TRUE, |
889a4d3e | 84 | bfd_i386_compatible, |
1abc8597 AM |
85 | bfd_default_scan, |
86 | &bfd_x86_64_arch_intel_syntax | |
8d88c4ca | 87 | }; |
1abc8597 | 88 | |
34274ccc | 89 | static const bfd_arch_info_type i8086_arch = |
252b5132 RH |
90 | { |
91 | 32, /* 32 bits in a word */ | |
92 | 32, /* 32 bits in an address (well, not really) */ | |
93 | 8, /* 8 bits in a byte */ | |
94 | bfd_arch_i386, | |
95 | bfd_mach_i386_i8086, | |
96 | "i8086", | |
97 | "i8086", | |
98 | 3, | |
b34976b6 | 99 | FALSE, |
889a4d3e | 100 | bfd_i386_compatible, |
1abc8597 AM |
101 | bfd_default_scan, |
102 | &bfd_i386_arch_intel_syntax | |
8d88c4ca NC |
103 | }; |
104 | ||
351f65ca L |
105 | static const bfd_arch_info_type bfd_x64_32_arch = |
106 | { | |
107 | 64, /* 64 bits in a word */ | |
d7921315 | 108 | 64, /* 64 bits in an address */ |
351f65ca L |
109 | 8, /* 8 bits in a byte */ |
110 | bfd_arch_i386, | |
111 | bfd_mach_x64_32, | |
112 | "i386", | |
113 | "i386:x64-32", | |
114 | 3, | |
115 | FALSE, | |
889a4d3e | 116 | bfd_i386_compatible, |
351f65ca L |
117 | bfd_default_scan, |
118 | &i8086_arch | |
119 | }; | |
120 | ||
34274ccc | 121 | static const bfd_arch_info_type bfd_x86_64_arch = |
8d88c4ca | 122 | { |
b1995b01 L |
123 | 64, /* 64 bits in a word */ |
124 | 64, /* 64 bits in an address */ | |
8d88c4ca NC |
125 | 8, /* 8 bits in a byte */ |
126 | bfd_arch_i386, | |
127 | bfd_mach_x86_64, | |
beb43bb9 JH |
128 | "i386", |
129 | "i386:x86-64", | |
8d88c4ca | 130 | 3, |
1abc8597 | 131 | FALSE, |
889a4d3e | 132 | bfd_i386_compatible, |
1abc8597 | 133 | bfd_default_scan, |
351f65ca | 134 | &bfd_x64_32_arch |
252b5132 RH |
135 | }; |
136 | ||
137 | const bfd_arch_info_type bfd_i386_arch = | |
138 | { | |
139 | 32, /* 32 bits in a word */ | |
140 | 32, /* 32 bits in an address */ | |
141 | 8, /* 8 bits in a byte */ | |
142 | bfd_arch_i386, | |
143 | bfd_mach_i386_i386, | |
144 | "i386", | |
145 | "i386", | |
146 | 3, | |
b34976b6 | 147 | TRUE, |
889a4d3e | 148 | bfd_i386_compatible, |
1abc8597 | 149 | bfd_default_scan, |
3fde5a36 | 150 | &bfd_x86_64_arch |
252b5132 | 151 | }; |