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. */ | |
34 | if (compat && a->bits_per_address != b->bits_per_address) | |
35 | compat = NULL; | |
36 | ||
37 | return compat; | |
38 | } | |
39 | ||
351f65ca L |
40 | static const bfd_arch_info_type bfd_x64_32_arch_intel_syntax = |
41 | { | |
42 | 64, /* 64 bits in a word */ | |
43 | 32, /* 32 bits in an address */ | |
44 | 8, /* 8 bits in a byte */ | |
45 | bfd_arch_i386, | |
46 | bfd_mach_x64_32_intel_syntax, | |
47 | "i386:intel", | |
48 | "i386:x64-32:intel", | |
49 | 3, | |
50 | FALSE, | |
889a4d3e | 51 | bfd_i386_compatible, |
351f65ca L |
52 | bfd_default_scan, |
53 | 0 | |
54 | }; | |
55 | ||
34274ccc | 56 | static const bfd_arch_info_type bfd_x86_64_arch_intel_syntax = |
8d88c4ca NC |
57 | { |
58 | 64, /* 64 bits in a word */ | |
59 | 64, /* 64 bits in an address */ | |
60 | 8, /* 8 bits in a byte */ | |
61 | bfd_arch_i386, | |
62 | bfd_mach_x86_64_intel_syntax, | |
beb43bb9 JH |
63 | "i386:intel", |
64 | "i386:x86-64:intel", | |
8d88c4ca | 65 | 3, |
1abc8597 | 66 | FALSE, |
889a4d3e | 67 | bfd_i386_compatible, |
1abc8597 | 68 | bfd_default_scan, |
351f65ca | 69 | &bfd_x64_32_arch_intel_syntax, |
1abc8597 AM |
70 | }; |
71 | ||
34274ccc | 72 | static const bfd_arch_info_type bfd_i386_arch_intel_syntax = |
1abc8597 AM |
73 | { |
74 | 32, /* 32 bits in a word */ | |
75 | 32, /* 32 bits in an address */ | |
76 | 8, /* 8 bits in a byte */ | |
77 | bfd_arch_i386, | |
78 | bfd_mach_i386_i386_intel_syntax, | |
79 | "i386:intel", | |
80 | "i386:intel", | |
81 | 3, | |
b34976b6 | 82 | TRUE, |
889a4d3e | 83 | bfd_i386_compatible, |
1abc8597 AM |
84 | bfd_default_scan, |
85 | &bfd_x86_64_arch_intel_syntax | |
8d88c4ca | 86 | }; |
1abc8597 | 87 | |
34274ccc | 88 | static const bfd_arch_info_type i8086_arch = |
252b5132 RH |
89 | { |
90 | 32, /* 32 bits in a word */ | |
91 | 32, /* 32 bits in an address (well, not really) */ | |
92 | 8, /* 8 bits in a byte */ | |
93 | bfd_arch_i386, | |
94 | bfd_mach_i386_i8086, | |
95 | "i8086", | |
96 | "i8086", | |
97 | 3, | |
b34976b6 | 98 | FALSE, |
889a4d3e | 99 | bfd_i386_compatible, |
1abc8597 AM |
100 | bfd_default_scan, |
101 | &bfd_i386_arch_intel_syntax | |
8d88c4ca NC |
102 | }; |
103 | ||
351f65ca L |
104 | static const bfd_arch_info_type bfd_x64_32_arch = |
105 | { | |
106 | 64, /* 64 bits in a word */ | |
107 | 32, /* 32 bits in an address */ | |
108 | 8, /* 8 bits in a byte */ | |
109 | bfd_arch_i386, | |
110 | bfd_mach_x64_32, | |
111 | "i386", | |
112 | "i386:x64-32", | |
113 | 3, | |
114 | FALSE, | |
889a4d3e | 115 | bfd_i386_compatible, |
351f65ca L |
116 | bfd_default_scan, |
117 | &i8086_arch | |
118 | }; | |
119 | ||
34274ccc | 120 | static const bfd_arch_info_type bfd_x86_64_arch = |
8d88c4ca | 121 | { |
b1995b01 L |
122 | 64, /* 64 bits in a word */ |
123 | 64, /* 64 bits in an address */ | |
8d88c4ca NC |
124 | 8, /* 8 bits in a byte */ |
125 | bfd_arch_i386, | |
126 | bfd_mach_x86_64, | |
beb43bb9 JH |
127 | "i386", |
128 | "i386:x86-64", | |
8d88c4ca | 129 | 3, |
1abc8597 | 130 | FALSE, |
889a4d3e | 131 | bfd_i386_compatible, |
1abc8597 | 132 | bfd_default_scan, |
351f65ca | 133 | &bfd_x64_32_arch |
252b5132 RH |
134 | }; |
135 | ||
136 | const bfd_arch_info_type bfd_i386_arch = | |
137 | { | |
138 | 32, /* 32 bits in a word */ | |
139 | 32, /* 32 bits in an address */ | |
140 | 8, /* 8 bits in a byte */ | |
141 | bfd_arch_i386, | |
142 | bfd_mach_i386_i386, | |
143 | "i386", | |
144 | "i386", | |
145 | 3, | |
b34976b6 | 146 | TRUE, |
889a4d3e | 147 | bfd_i386_compatible, |
1abc8597 | 148 | bfd_default_scan, |
3fde5a36 | 149 | &bfd_x86_64_arch |
252b5132 | 150 | }; |