15796c8dcSSimon Schubert /* BFD support for the Intel 386 architecture. 25796c8dcSSimon Schubert Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2004, 2005, 3c50c785cSJohn Marino 2007, 2009, 2010, 2011 45796c8dcSSimon Schubert Free Software Foundation, Inc. 55796c8dcSSimon Schubert 65796c8dcSSimon Schubert This file is part of BFD, the Binary File Descriptor library. 75796c8dcSSimon Schubert 85796c8dcSSimon Schubert This program is free software; you can redistribute it and/or modify 95796c8dcSSimon Schubert it under the terms of the GNU General Public License as published by 105796c8dcSSimon Schubert the Free Software Foundation; either version 3 of the License, or 115796c8dcSSimon Schubert (at your option) any later version. 125796c8dcSSimon Schubert 135796c8dcSSimon Schubert This program is distributed in the hope that it will be useful, 145796c8dcSSimon Schubert but WITHOUT ANY WARRANTY; without even the implied warranty of 155796c8dcSSimon Schubert MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 165796c8dcSSimon Schubert GNU General Public License for more details. 175796c8dcSSimon Schubert 185796c8dcSSimon Schubert You should have received a copy of the GNU General Public License 195796c8dcSSimon Schubert along with this program; if not, write to the Free Software 205796c8dcSSimon Schubert Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 215796c8dcSSimon Schubert MA 02110-1301, USA. */ 225796c8dcSSimon Schubert 235796c8dcSSimon Schubert #include "sysdep.h" 245796c8dcSSimon Schubert #include "bfd.h" 255796c8dcSSimon Schubert #include "libbfd.h" 265796c8dcSSimon Schubert 27c50c785cSJohn Marino static const bfd_arch_info_type * 28c50c785cSJohn Marino bfd_i386_compatible (const bfd_arch_info_type *a, 29c50c785cSJohn Marino const bfd_arch_info_type *b) 30c50c785cSJohn Marino { 31c50c785cSJohn Marino const bfd_arch_info_type *compat = bfd_default_compatible (a, b); 32c50c785cSJohn Marino 33c50c785cSJohn Marino /* Don't allow mixing x64_32 with x86_64. */ 34*a45ae5f8SJohn Marino if (compat 35*a45ae5f8SJohn Marino && (a->mach & bfd_mach_x64_32) != (b->mach & bfd_mach_x64_32)) 36c50c785cSJohn Marino compat = NULL; 37c50c785cSJohn Marino 38c50c785cSJohn Marino return compat; 39c50c785cSJohn Marino } 40c50c785cSJohn Marino 41c50c785cSJohn Marino static const bfd_arch_info_type bfd_x64_32_arch_intel_syntax = 42c50c785cSJohn Marino { 43c50c785cSJohn Marino 64, /* 64 bits in a word */ 44*a45ae5f8SJohn Marino 64, /* 64 bits in an address */ 45c50c785cSJohn Marino 8, /* 8 bits in a byte */ 46c50c785cSJohn Marino bfd_arch_i386, 47c50c785cSJohn Marino bfd_mach_x64_32_intel_syntax, 48c50c785cSJohn Marino "i386:intel", 49c50c785cSJohn Marino "i386:x64-32:intel", 50c50c785cSJohn Marino 3, 51c50c785cSJohn Marino FALSE, 52c50c785cSJohn Marino bfd_i386_compatible, 53c50c785cSJohn Marino bfd_default_scan, 54c50c785cSJohn Marino 0 55c50c785cSJohn Marino }; 56c50c785cSJohn Marino 575796c8dcSSimon Schubert static const bfd_arch_info_type bfd_x86_64_arch_intel_syntax = 585796c8dcSSimon Schubert { 595796c8dcSSimon Schubert 64, /* 64 bits in a word */ 605796c8dcSSimon Schubert 64, /* 64 bits in an address */ 615796c8dcSSimon Schubert 8, /* 8 bits in a byte */ 625796c8dcSSimon Schubert bfd_arch_i386, 635796c8dcSSimon Schubert bfd_mach_x86_64_intel_syntax, 645796c8dcSSimon Schubert "i386:intel", 655796c8dcSSimon Schubert "i386:x86-64:intel", 665796c8dcSSimon Schubert 3, 675796c8dcSSimon Schubert FALSE, 68c50c785cSJohn Marino bfd_i386_compatible, 695796c8dcSSimon Schubert bfd_default_scan, 70c50c785cSJohn Marino &bfd_x64_32_arch_intel_syntax, 715796c8dcSSimon Schubert }; 725796c8dcSSimon Schubert 735796c8dcSSimon Schubert static const bfd_arch_info_type bfd_i386_arch_intel_syntax = 745796c8dcSSimon Schubert { 755796c8dcSSimon Schubert 32, /* 32 bits in a word */ 765796c8dcSSimon Schubert 32, /* 32 bits in an address */ 775796c8dcSSimon Schubert 8, /* 8 bits in a byte */ 785796c8dcSSimon Schubert bfd_arch_i386, 795796c8dcSSimon Schubert bfd_mach_i386_i386_intel_syntax, 805796c8dcSSimon Schubert "i386:intel", 815796c8dcSSimon Schubert "i386:intel", 825796c8dcSSimon Schubert 3, 835796c8dcSSimon Schubert TRUE, 84c50c785cSJohn Marino bfd_i386_compatible, 855796c8dcSSimon Schubert bfd_default_scan, 865796c8dcSSimon Schubert &bfd_x86_64_arch_intel_syntax 875796c8dcSSimon Schubert }; 885796c8dcSSimon Schubert 895796c8dcSSimon Schubert static const bfd_arch_info_type i8086_arch = 905796c8dcSSimon Schubert { 915796c8dcSSimon Schubert 32, /* 32 bits in a word */ 925796c8dcSSimon Schubert 32, /* 32 bits in an address (well, not really) */ 935796c8dcSSimon Schubert 8, /* 8 bits in a byte */ 945796c8dcSSimon Schubert bfd_arch_i386, 955796c8dcSSimon Schubert bfd_mach_i386_i8086, 965796c8dcSSimon Schubert "i8086", 975796c8dcSSimon Schubert "i8086", 985796c8dcSSimon Schubert 3, 995796c8dcSSimon Schubert FALSE, 100c50c785cSJohn Marino bfd_i386_compatible, 1015796c8dcSSimon Schubert bfd_default_scan, 1025796c8dcSSimon Schubert &bfd_i386_arch_intel_syntax 1035796c8dcSSimon Schubert }; 1045796c8dcSSimon Schubert 105c50c785cSJohn Marino static const bfd_arch_info_type bfd_x64_32_arch = 106c50c785cSJohn Marino { 107c50c785cSJohn Marino 64, /* 64 bits in a word */ 108*a45ae5f8SJohn Marino 64, /* 64 bits in an address */ 109c50c785cSJohn Marino 8, /* 8 bits in a byte */ 110c50c785cSJohn Marino bfd_arch_i386, 111c50c785cSJohn Marino bfd_mach_x64_32, 112c50c785cSJohn Marino "i386", 113c50c785cSJohn Marino "i386:x64-32", 114c50c785cSJohn Marino 3, 115c50c785cSJohn Marino FALSE, 116c50c785cSJohn Marino bfd_i386_compatible, 117c50c785cSJohn Marino bfd_default_scan, 118c50c785cSJohn Marino &i8086_arch 119c50c785cSJohn Marino }; 120c50c785cSJohn Marino 1215796c8dcSSimon Schubert static const bfd_arch_info_type bfd_x86_64_arch = 1225796c8dcSSimon Schubert { 1235796c8dcSSimon Schubert 64, /* 64 bits in a word */ 1245796c8dcSSimon Schubert 64, /* 64 bits in an address */ 1255796c8dcSSimon Schubert 8, /* 8 bits in a byte */ 1265796c8dcSSimon Schubert bfd_arch_i386, 1275796c8dcSSimon Schubert bfd_mach_x86_64, 1285796c8dcSSimon Schubert "i386", 1295796c8dcSSimon Schubert "i386:x86-64", 1305796c8dcSSimon Schubert 3, 1315796c8dcSSimon Schubert FALSE, 132c50c785cSJohn Marino bfd_i386_compatible, 1335796c8dcSSimon Schubert bfd_default_scan, 134c50c785cSJohn Marino &bfd_x64_32_arch 1355796c8dcSSimon Schubert }; 1365796c8dcSSimon Schubert 1375796c8dcSSimon Schubert const bfd_arch_info_type bfd_i386_arch = 1385796c8dcSSimon Schubert { 1395796c8dcSSimon Schubert 32, /* 32 bits in a word */ 1405796c8dcSSimon Schubert 32, /* 32 bits in an address */ 1415796c8dcSSimon Schubert 8, /* 8 bits in a byte */ 1425796c8dcSSimon Schubert bfd_arch_i386, 1435796c8dcSSimon Schubert bfd_mach_i386_i386, 1445796c8dcSSimon Schubert "i386", 1455796c8dcSSimon Schubert "i386", 1465796c8dcSSimon Schubert 3, 1475796c8dcSSimon Schubert TRUE, 148c50c785cSJohn Marino bfd_i386_compatible, 1495796c8dcSSimon Schubert bfd_default_scan, 1505796c8dcSSimon Schubert &bfd_x86_64_arch 1515796c8dcSSimon Schubert }; 152