xref: /dragonfly/contrib/gdb-7/bfd/archures.c (revision ef5ccd6c)
15796c8dcSSimon Schubert /* BFD library support routines for architectures.
25796c8dcSSimon Schubert    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3*ef5ccd6cSJohn Marino    2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
4*ef5ccd6cSJohn Marino    2012, 2013 Free Software Foundation, Inc.
55796c8dcSSimon Schubert    Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
65796c8dcSSimon Schubert 
75796c8dcSSimon Schubert    This file is part of BFD, the Binary File Descriptor library.
85796c8dcSSimon Schubert 
95796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
105796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
115796c8dcSSimon Schubert    the Free Software Foundation; either version 3 of the License, or
125796c8dcSSimon Schubert    (at your option) any later version.
135796c8dcSSimon Schubert 
145796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
155796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
165796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
175796c8dcSSimon Schubert    GNU General Public License for more details.
185796c8dcSSimon Schubert 
195796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
205796c8dcSSimon Schubert    along with this program; if not, write to the Free Software
215796c8dcSSimon Schubert    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
225796c8dcSSimon Schubert    MA 02110-1301, USA.  */
235796c8dcSSimon Schubert 
245796c8dcSSimon Schubert #include "sysdep.h"
255796c8dcSSimon Schubert #include "bfd.h"
265796c8dcSSimon Schubert #include "libbfd.h"
275796c8dcSSimon Schubert #include "safe-ctype.h"
285796c8dcSSimon Schubert 
295796c8dcSSimon Schubert /*
305796c8dcSSimon Schubert 
315796c8dcSSimon Schubert SECTION
325796c8dcSSimon Schubert 	Architectures
335796c8dcSSimon Schubert 
345796c8dcSSimon Schubert 	BFD keeps one atom in a BFD describing the
355796c8dcSSimon Schubert 	architecture of the data attached to the BFD: a pointer to a
365796c8dcSSimon Schubert 	<<bfd_arch_info_type>>.
375796c8dcSSimon Schubert 
385796c8dcSSimon Schubert 	Pointers to structures can be requested independently of a BFD
395796c8dcSSimon Schubert 	so that an architecture's information can be interrogated
405796c8dcSSimon Schubert 	without access to an open BFD.
415796c8dcSSimon Schubert 
425796c8dcSSimon Schubert 	The architecture information is provided by each architecture package.
435796c8dcSSimon Schubert 	The set of default architectures is selected by the macro
445796c8dcSSimon Schubert 	<<SELECT_ARCHITECTURES>>.  This is normally set up in the
455796c8dcSSimon Schubert 	@file{config/@var{target}.mt} file of your choice.  If the name is not
465796c8dcSSimon Schubert 	defined, then all the architectures supported are included.
475796c8dcSSimon Schubert 
485796c8dcSSimon Schubert 	When BFD starts up, all the architectures are called with an
495796c8dcSSimon Schubert 	initialize method.  It is up to the architecture back end to
505796c8dcSSimon Schubert 	insert as many items into the list of architectures as it wants to;
515796c8dcSSimon Schubert 	generally this would be one for each machine and one for the
525796c8dcSSimon Schubert 	default case (an item with a machine field of 0).
535796c8dcSSimon Schubert 
545796c8dcSSimon Schubert 	BFD's idea of an architecture is implemented in	@file{archures.c}.
555796c8dcSSimon Schubert */
565796c8dcSSimon Schubert 
575796c8dcSSimon Schubert /*
585796c8dcSSimon Schubert 
595796c8dcSSimon Schubert SUBSECTION
605796c8dcSSimon Schubert 	bfd_architecture
615796c8dcSSimon Schubert 
625796c8dcSSimon Schubert DESCRIPTION
635796c8dcSSimon Schubert 	This enum gives the object file's CPU architecture, in a
645796c8dcSSimon Schubert 	global sense---i.e., what processor family does it belong to?
655796c8dcSSimon Schubert 	Another field indicates which processor within
665796c8dcSSimon Schubert 	the family is in use.  The machine gives a number which
675796c8dcSSimon Schubert 	distinguishes different versions of the architecture,
685796c8dcSSimon Schubert 	containing, for example, 2 and 3 for Intel i960 KA and i960 KB,
695796c8dcSSimon Schubert 	and 68020 and 68030 for Motorola 68020 and 68030.
705796c8dcSSimon Schubert 
715796c8dcSSimon Schubert .enum bfd_architecture
725796c8dcSSimon Schubert .{
735796c8dcSSimon Schubert .  bfd_arch_unknown,   {* File arch not known.  *}
745796c8dcSSimon Schubert .  bfd_arch_obscure,   {* Arch known, not one of these.  *}
755796c8dcSSimon Schubert .  bfd_arch_m68k,      {* Motorola 68xxx *}
765796c8dcSSimon Schubert .#define bfd_mach_m68000 1
775796c8dcSSimon Schubert .#define bfd_mach_m68008 2
785796c8dcSSimon Schubert .#define bfd_mach_m68010 3
795796c8dcSSimon Schubert .#define bfd_mach_m68020 4
805796c8dcSSimon Schubert .#define bfd_mach_m68030 5
815796c8dcSSimon Schubert .#define bfd_mach_m68040 6
825796c8dcSSimon Schubert .#define bfd_mach_m68060 7
835796c8dcSSimon Schubert .#define bfd_mach_cpu32  8
845796c8dcSSimon Schubert .#define bfd_mach_fido   9
855796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_a_nodiv 10
865796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_a 11
875796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_a_mac 12
885796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_a_emac 13
895796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_aplus 14
905796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_aplus_mac 15
915796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_aplus_emac 16
925796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_b_nousp 17
935796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_b_nousp_mac 18
945796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_b_nousp_emac 19
955796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_b 20
965796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_b_mac 21
975796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_b_emac 22
985796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_b_float 23
995796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_b_float_mac 24
1005796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_b_float_emac 25
1015796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_c 26
1025796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_c_mac 27
1035796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_c_emac 28
1045796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_c_nodiv 29
1055796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_c_nodiv_mac 30
1065796c8dcSSimon Schubert .#define bfd_mach_mcf_isa_c_nodiv_emac 31
1075796c8dcSSimon Schubert .  bfd_arch_vax,       {* DEC Vax *}
1085796c8dcSSimon Schubert .  bfd_arch_i960,      {* Intel 960 *}
1095796c8dcSSimon Schubert .    {* The order of the following is important.
1105796c8dcSSimon Schubert .       lower number indicates a machine type that
1115796c8dcSSimon Schubert .       only accepts a subset of the instructions
1125796c8dcSSimon Schubert .       available to machines with higher numbers.
1135796c8dcSSimon Schubert .       The exception is the "ca", which is
1145796c8dcSSimon Schubert .       incompatible with all other machines except
1155796c8dcSSimon Schubert .       "core".  *}
1165796c8dcSSimon Schubert .
1175796c8dcSSimon Schubert .#define bfd_mach_i960_core      1
1185796c8dcSSimon Schubert .#define bfd_mach_i960_ka_sa     2
1195796c8dcSSimon Schubert .#define bfd_mach_i960_kb_sb     3
1205796c8dcSSimon Schubert .#define bfd_mach_i960_mc        4
1215796c8dcSSimon Schubert .#define bfd_mach_i960_xa        5
1225796c8dcSSimon Schubert .#define bfd_mach_i960_ca        6
1235796c8dcSSimon Schubert .#define bfd_mach_i960_jx	 7
1245796c8dcSSimon Schubert .#define bfd_mach_i960_hx        8
1255796c8dcSSimon Schubert .
1265796c8dcSSimon Schubert .  bfd_arch_or32,      {* OpenRISC 32 *}
1275796c8dcSSimon Schubert .
1285796c8dcSSimon Schubert .  bfd_arch_sparc,     {* SPARC *}
1295796c8dcSSimon Schubert .#define bfd_mach_sparc			1
1305796c8dcSSimon Schubert .{* The difference between v8plus and v9 is that v9 is a true 64 bit env.  *}
1315796c8dcSSimon Schubert .#define bfd_mach_sparc_sparclet	2
1325796c8dcSSimon Schubert .#define bfd_mach_sparc_sparclite	3
1335796c8dcSSimon Schubert .#define bfd_mach_sparc_v8plus		4
1345796c8dcSSimon Schubert .#define bfd_mach_sparc_v8plusa		5 {* with ultrasparc add'ns.  *}
1355796c8dcSSimon Schubert .#define bfd_mach_sparc_sparclite_le	6
1365796c8dcSSimon Schubert .#define bfd_mach_sparc_v9		7
1375796c8dcSSimon Schubert .#define bfd_mach_sparc_v9a		8 {* with ultrasparc add'ns.  *}
1385796c8dcSSimon Schubert .#define bfd_mach_sparc_v8plusb		9 {* with cheetah add'ns.  *}
1395796c8dcSSimon Schubert .#define bfd_mach_sparc_v9b		10 {* with cheetah add'ns.  *}
1405796c8dcSSimon Schubert .{* Nonzero if MACH has the v9 instruction set.  *}
1415796c8dcSSimon Schubert .#define bfd_mach_sparc_v9_p(mach) \
1425796c8dcSSimon Schubert .  ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
1435796c8dcSSimon Schubert .   && (mach) != bfd_mach_sparc_sparclite_le)
1445796c8dcSSimon Schubert .{* Nonzero if MACH is a 64 bit sparc architecture.  *}
1455796c8dcSSimon Schubert .#define bfd_mach_sparc_64bit_p(mach) \
1465796c8dcSSimon Schubert .  ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb)
1475796c8dcSSimon Schubert .  bfd_arch_spu,       {* PowerPC SPU *}
1485796c8dcSSimon Schubert .#define bfd_mach_spu		256
1495796c8dcSSimon Schubert .  bfd_arch_mips,      {* MIPS Rxxxx *}
1505796c8dcSSimon Schubert .#define bfd_mach_mips3000		3000
1515796c8dcSSimon Schubert .#define bfd_mach_mips3900		3900
1525796c8dcSSimon Schubert .#define bfd_mach_mips4000		4000
1535796c8dcSSimon Schubert .#define bfd_mach_mips4010		4010
1545796c8dcSSimon Schubert .#define bfd_mach_mips4100		4100
1555796c8dcSSimon Schubert .#define bfd_mach_mips4111		4111
1565796c8dcSSimon Schubert .#define bfd_mach_mips4120		4120
1575796c8dcSSimon Schubert .#define bfd_mach_mips4300		4300
1585796c8dcSSimon Schubert .#define bfd_mach_mips4400		4400
1595796c8dcSSimon Schubert .#define bfd_mach_mips4600		4600
1605796c8dcSSimon Schubert .#define bfd_mach_mips4650		4650
1615796c8dcSSimon Schubert .#define bfd_mach_mips5000		5000
1625796c8dcSSimon Schubert .#define bfd_mach_mips5400		5400
1635796c8dcSSimon Schubert .#define bfd_mach_mips5500		5500
164*ef5ccd6cSJohn Marino .#define bfd_mach_mips5900		5900
1655796c8dcSSimon Schubert .#define bfd_mach_mips6000		6000
1665796c8dcSSimon Schubert .#define bfd_mach_mips7000		7000
1675796c8dcSSimon Schubert .#define bfd_mach_mips8000		8000
1685796c8dcSSimon Schubert .#define bfd_mach_mips9000		9000
1695796c8dcSSimon Schubert .#define bfd_mach_mips10000		10000
1705796c8dcSSimon Schubert .#define bfd_mach_mips12000		12000
1715796c8dcSSimon Schubert .#define bfd_mach_mips14000		14000
1725796c8dcSSimon Schubert .#define bfd_mach_mips16000		16000
1735796c8dcSSimon Schubert .#define bfd_mach_mips16		16
1745796c8dcSSimon Schubert .#define bfd_mach_mips5                 5
1755796c8dcSSimon Schubert .#define bfd_mach_mips_loongson_2e      3001
1765796c8dcSSimon Schubert .#define bfd_mach_mips_loongson_2f      3002
177c50c785cSJohn Marino .#define bfd_mach_mips_loongson_3a      3003
1785796c8dcSSimon Schubert .#define bfd_mach_mips_sb1              12310201 {* octal 'SB', 01 *}
1795796c8dcSSimon Schubert .#define bfd_mach_mips_octeon		6501
180a45ae5f8SJohn Marino .#define bfd_mach_mips_octeonp		6601
181a45ae5f8SJohn Marino .#define bfd_mach_mips_octeon2		6502
1825796c8dcSSimon Schubert .#define bfd_mach_mips_xlr              887682   {* decimal 'XLR'  *}
1835796c8dcSSimon Schubert .#define bfd_mach_mipsisa32             32
1845796c8dcSSimon Schubert .#define bfd_mach_mipsisa32r2           33
1855796c8dcSSimon Schubert .#define bfd_mach_mipsisa64             64
1865796c8dcSSimon Schubert .#define bfd_mach_mipsisa64r2           65
187a45ae5f8SJohn Marino .#define bfd_mach_mips_micromips        96
1885796c8dcSSimon Schubert .  bfd_arch_i386,      {* Intel 386 *}
189a45ae5f8SJohn Marino .#define bfd_mach_i386_intel_syntax	(1 << 0)
190a45ae5f8SJohn Marino .#define bfd_mach_i386_i8086		(1 << 1)
191a45ae5f8SJohn Marino .#define bfd_mach_i386_i386		(1 << 2)
192a45ae5f8SJohn Marino .#define bfd_mach_x86_64		(1 << 3)
193a45ae5f8SJohn Marino .#define bfd_mach_x64_32		(1 << 4)
194a45ae5f8SJohn Marino .#define bfd_mach_i386_i386_intel_syntax (bfd_mach_i386_i386 | bfd_mach_i386_intel_syntax)
195a45ae5f8SJohn Marino .#define bfd_mach_x86_64_intel_syntax	(bfd_mach_x86_64 | bfd_mach_i386_intel_syntax)
196a45ae5f8SJohn Marino .#define bfd_mach_x64_32_intel_syntax	(bfd_mach_x64_32 | bfd_mach_i386_intel_syntax)
1975796c8dcSSimon Schubert .  bfd_arch_l1om,   {* Intel L1OM *}
198a45ae5f8SJohn Marino .#define bfd_mach_l1om			(1 << 5)
199a45ae5f8SJohn Marino .#define bfd_mach_l1om_intel_syntax	(bfd_mach_l1om | bfd_mach_i386_intel_syntax)
200a45ae5f8SJohn Marino .  bfd_arch_k1om,   {* Intel K1OM *}
201a45ae5f8SJohn Marino .#define bfd_mach_k1om			(1 << 6)
202a45ae5f8SJohn Marino .#define bfd_mach_k1om_intel_syntax	(bfd_mach_k1om | bfd_mach_i386_intel_syntax)
2035796c8dcSSimon Schubert .  bfd_arch_we32k,     {* AT&T WE32xxx *}
2045796c8dcSSimon Schubert .  bfd_arch_tahoe,     {* CCI/Harris Tahoe *}
2055796c8dcSSimon Schubert .  bfd_arch_i860,      {* Intel 860 *}
2065796c8dcSSimon Schubert .  bfd_arch_i370,      {* IBM 360/370 Mainframes *}
2075796c8dcSSimon Schubert .  bfd_arch_romp,      {* IBM ROMP PC/RT *}
2085796c8dcSSimon Schubert .  bfd_arch_convex,    {* Convex *}
2095796c8dcSSimon Schubert .  bfd_arch_m88k,      {* Motorola 88xxx *}
2105796c8dcSSimon Schubert .  bfd_arch_m98k,      {* Motorola 98xxx *}
2115796c8dcSSimon Schubert .  bfd_arch_pyramid,   {* Pyramid Technology *}
2125796c8dcSSimon Schubert .  bfd_arch_h8300,     {* Renesas H8/300 (formerly Hitachi H8/300) *}
2135796c8dcSSimon Schubert .#define bfd_mach_h8300    1
2145796c8dcSSimon Schubert .#define bfd_mach_h8300h   2
2155796c8dcSSimon Schubert .#define bfd_mach_h8300s   3
2165796c8dcSSimon Schubert .#define bfd_mach_h8300hn  4
2175796c8dcSSimon Schubert .#define bfd_mach_h8300sn  5
2185796c8dcSSimon Schubert .#define bfd_mach_h8300sx  6
2195796c8dcSSimon Schubert .#define bfd_mach_h8300sxn 7
2205796c8dcSSimon Schubert .  bfd_arch_pdp11,     {* DEC PDP-11 *}
2215796c8dcSSimon Schubert .  bfd_arch_plugin,
2225796c8dcSSimon Schubert .  bfd_arch_powerpc,   {* PowerPC *}
2235796c8dcSSimon Schubert .#define bfd_mach_ppc		32
2245796c8dcSSimon Schubert .#define bfd_mach_ppc64		64
2255796c8dcSSimon Schubert .#define bfd_mach_ppc_403	403
2265796c8dcSSimon Schubert .#define bfd_mach_ppc_403gc	4030
2275796c8dcSSimon Schubert .#define bfd_mach_ppc_405	405
2285796c8dcSSimon Schubert .#define bfd_mach_ppc_505	505
2295796c8dcSSimon Schubert .#define bfd_mach_ppc_601	601
2305796c8dcSSimon Schubert .#define bfd_mach_ppc_602	602
2315796c8dcSSimon Schubert .#define bfd_mach_ppc_603	603
2325796c8dcSSimon Schubert .#define bfd_mach_ppc_ec603e	6031
2335796c8dcSSimon Schubert .#define bfd_mach_ppc_604	604
2345796c8dcSSimon Schubert .#define bfd_mach_ppc_620	620
2355796c8dcSSimon Schubert .#define bfd_mach_ppc_630	630
2365796c8dcSSimon Schubert .#define bfd_mach_ppc_750	750
2375796c8dcSSimon Schubert .#define bfd_mach_ppc_860	860
2385796c8dcSSimon Schubert .#define bfd_mach_ppc_a35	35
2395796c8dcSSimon Schubert .#define bfd_mach_ppc_rs64ii	642
2405796c8dcSSimon Schubert .#define bfd_mach_ppc_rs64iii	643
2415796c8dcSSimon Schubert .#define bfd_mach_ppc_7400	7400
2425796c8dcSSimon Schubert .#define bfd_mach_ppc_e500      500
2435796c8dcSSimon Schubert .#define bfd_mach_ppc_e500mc    5001
244cf7f2e2dSJohn Marino .#define bfd_mach_ppc_e500mc64  5005
245*ef5ccd6cSJohn Marino .#define bfd_mach_ppc_e5500     5006
246*ef5ccd6cSJohn Marino .#define bfd_mach_ppc_e6500     5007
247cf7f2e2dSJohn Marino .#define bfd_mach_ppc_titan     83
248*ef5ccd6cSJohn Marino .#define bfd_mach_ppc_vle       84
2495796c8dcSSimon Schubert .  bfd_arch_rs6000,    {* IBM RS/6000 *}
2505796c8dcSSimon Schubert .#define bfd_mach_rs6k		6000
2515796c8dcSSimon Schubert .#define bfd_mach_rs6k_rs1	6001
2525796c8dcSSimon Schubert .#define bfd_mach_rs6k_rsc	6003
2535796c8dcSSimon Schubert .#define bfd_mach_rs6k_rs2	6002
2545796c8dcSSimon Schubert .  bfd_arch_hppa,      {* HP PA RISC *}
2555796c8dcSSimon Schubert .#define bfd_mach_hppa10	10
2565796c8dcSSimon Schubert .#define bfd_mach_hppa11	11
2575796c8dcSSimon Schubert .#define bfd_mach_hppa20	20
2585796c8dcSSimon Schubert .#define bfd_mach_hppa20w	25
2595796c8dcSSimon Schubert .  bfd_arch_d10v,      {* Mitsubishi D10V *}
2605796c8dcSSimon Schubert .#define bfd_mach_d10v		1
2615796c8dcSSimon Schubert .#define bfd_mach_d10v_ts2	2
2625796c8dcSSimon Schubert .#define bfd_mach_d10v_ts3	3
2635796c8dcSSimon Schubert .  bfd_arch_d30v,      {* Mitsubishi D30V *}
2645796c8dcSSimon Schubert .  bfd_arch_dlx,       {* DLX *}
2655796c8dcSSimon Schubert .  bfd_arch_m68hc11,   {* Motorola 68HC11 *}
2665796c8dcSSimon Schubert .  bfd_arch_m68hc12,   {* Motorola 68HC12 *}
2675796c8dcSSimon Schubert .#define bfd_mach_m6812_default 0
2685796c8dcSSimon Schubert .#define bfd_mach_m6812         1
2695796c8dcSSimon Schubert .#define bfd_mach_m6812s        2
270*ef5ccd6cSJohn Marino .  bfd_arch_m9s12x,   {* Freescale S12X *}
271*ef5ccd6cSJohn Marino .  bfd_arch_m9s12xg,  {* Freescale XGATE *}
2725796c8dcSSimon Schubert .  bfd_arch_z8k,       {* Zilog Z8000 *}
2735796c8dcSSimon Schubert .#define bfd_mach_z8001		1
2745796c8dcSSimon Schubert .#define bfd_mach_z8002		2
2755796c8dcSSimon Schubert .  bfd_arch_h8500,     {* Renesas H8/500 (formerly Hitachi H8/500) *}
2765796c8dcSSimon Schubert .  bfd_arch_sh,        {* Renesas / SuperH SH (formerly Hitachi SH) *}
2775796c8dcSSimon Schubert .#define bfd_mach_sh            1
2785796c8dcSSimon Schubert .#define bfd_mach_sh2        0x20
2795796c8dcSSimon Schubert .#define bfd_mach_sh_dsp     0x2d
2805796c8dcSSimon Schubert .#define bfd_mach_sh2a       0x2a
2815796c8dcSSimon Schubert .#define bfd_mach_sh2a_nofpu 0x2b
2825796c8dcSSimon Schubert .#define bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu 0x2a1
2835796c8dcSSimon Schubert .#define bfd_mach_sh2a_nofpu_or_sh3_nommu 0x2a2
2845796c8dcSSimon Schubert .#define bfd_mach_sh2a_or_sh4  0x2a3
2855796c8dcSSimon Schubert .#define bfd_mach_sh2a_or_sh3e 0x2a4
2865796c8dcSSimon Schubert .#define bfd_mach_sh2e       0x2e
2875796c8dcSSimon Schubert .#define bfd_mach_sh3        0x30
2885796c8dcSSimon Schubert .#define bfd_mach_sh3_nommu  0x31
2895796c8dcSSimon Schubert .#define bfd_mach_sh3_dsp    0x3d
2905796c8dcSSimon Schubert .#define bfd_mach_sh3e       0x3e
2915796c8dcSSimon Schubert .#define bfd_mach_sh4        0x40
2925796c8dcSSimon Schubert .#define bfd_mach_sh4_nofpu  0x41
2935796c8dcSSimon Schubert .#define bfd_mach_sh4_nommu_nofpu  0x42
2945796c8dcSSimon Schubert .#define bfd_mach_sh4a       0x4a
2955796c8dcSSimon Schubert .#define bfd_mach_sh4a_nofpu 0x4b
2965796c8dcSSimon Schubert .#define bfd_mach_sh4al_dsp  0x4d
2975796c8dcSSimon Schubert .#define bfd_mach_sh5        0x50
2985796c8dcSSimon Schubert .  bfd_arch_alpha,     {* Dec Alpha *}
2995796c8dcSSimon Schubert .#define bfd_mach_alpha_ev4  0x10
3005796c8dcSSimon Schubert .#define bfd_mach_alpha_ev5  0x20
3015796c8dcSSimon Schubert .#define bfd_mach_alpha_ev6  0x30
3025796c8dcSSimon Schubert .  bfd_arch_arm,       {* Advanced Risc Machines ARM.  *}
3035796c8dcSSimon Schubert .#define bfd_mach_arm_unknown	0
3045796c8dcSSimon Schubert .#define bfd_mach_arm_2		1
3055796c8dcSSimon Schubert .#define bfd_mach_arm_2a	2
3065796c8dcSSimon Schubert .#define bfd_mach_arm_3		3
3075796c8dcSSimon Schubert .#define bfd_mach_arm_3M 	4
3085796c8dcSSimon Schubert .#define bfd_mach_arm_4 	5
3095796c8dcSSimon Schubert .#define bfd_mach_arm_4T 	6
3105796c8dcSSimon Schubert .#define bfd_mach_arm_5 	7
3115796c8dcSSimon Schubert .#define bfd_mach_arm_5T	8
3125796c8dcSSimon Schubert .#define bfd_mach_arm_5TE	9
3135796c8dcSSimon Schubert .#define bfd_mach_arm_XScale	10
3145796c8dcSSimon Schubert .#define bfd_mach_arm_ep9312	11
3155796c8dcSSimon Schubert .#define bfd_mach_arm_iWMMXt	12
3165796c8dcSSimon Schubert .#define bfd_mach_arm_iWMMXt2	13
3175796c8dcSSimon Schubert .  bfd_arch_ns32k,     {* National Semiconductors ns32000 *}
3185796c8dcSSimon Schubert .  bfd_arch_w65,       {* WDC 65816 *}
3195796c8dcSSimon Schubert .  bfd_arch_tic30,     {* Texas Instruments TMS320C30 *}
3205796c8dcSSimon Schubert .  bfd_arch_tic4x,     {* Texas Instruments TMS320C3X/4X *}
3215796c8dcSSimon Schubert .#define bfd_mach_tic3x         30
3225796c8dcSSimon Schubert .#define bfd_mach_tic4x         40
3235796c8dcSSimon Schubert .  bfd_arch_tic54x,    {* Texas Instruments TMS320C54X *}
324cf7f2e2dSJohn Marino .  bfd_arch_tic6x,     {* Texas Instruments TMS320C6X *}
3255796c8dcSSimon Schubert .  bfd_arch_tic80,     {* TI TMS320c80 (MVP) *}
3265796c8dcSSimon Schubert .  bfd_arch_v850,      {* NEC V850 *}
327*ef5ccd6cSJohn Marino .  bfd_arch_v850_rh850,{* NEC V850 (using RH850 ABI) *}
3285796c8dcSSimon Schubert .#define bfd_mach_v850          1
3295796c8dcSSimon Schubert .#define bfd_mach_v850e 	'E'
3305796c8dcSSimon Schubert .#define bfd_mach_v850e1        '1'
331c50c785cSJohn Marino .#define bfd_mach_v850e2        0x4532
332c50c785cSJohn Marino .#define bfd_mach_v850e2v3      0x45325633
333*ef5ccd6cSJohn Marino .#define bfd_mach_v850e3v5      0x45335635 {* ('E'|'3'|'V'|'5') *}
3345796c8dcSSimon Schubert .  bfd_arch_arc,       {* ARC Cores *}
3355796c8dcSSimon Schubert .#define bfd_mach_arc_5         5
3365796c8dcSSimon Schubert .#define bfd_mach_arc_6         6
3375796c8dcSSimon Schubert .#define bfd_mach_arc_7         7
3385796c8dcSSimon Schubert .#define bfd_mach_arc_8         8
3395796c8dcSSimon Schubert . bfd_arch_m32c,     {* Renesas M16C/M32C.  *}
3405796c8dcSSimon Schubert .#define bfd_mach_m16c        0x75
3415796c8dcSSimon Schubert .#define bfd_mach_m32c        0x78
3425796c8dcSSimon Schubert .  bfd_arch_m32r,      {* Renesas M32R (formerly Mitsubishi M32R/D) *}
3435796c8dcSSimon Schubert .#define bfd_mach_m32r		1 {* For backwards compatibility.  *}
3445796c8dcSSimon Schubert .#define bfd_mach_m32rx		'x'
3455796c8dcSSimon Schubert .#define bfd_mach_m32r2		'2'
3465796c8dcSSimon Schubert .  bfd_arch_mn10200,   {* Matsushita MN10200 *}
3475796c8dcSSimon Schubert .  bfd_arch_mn10300,   {* Matsushita MN10300 *}
3485796c8dcSSimon Schubert .#define bfd_mach_mn10300		300
3495796c8dcSSimon Schubert .#define bfd_mach_am33		330
3505796c8dcSSimon Schubert .#define bfd_mach_am33_2	332
3515796c8dcSSimon Schubert .  bfd_arch_fr30,
3525796c8dcSSimon Schubert .#define bfd_mach_fr30		0x46523330
3535796c8dcSSimon Schubert .  bfd_arch_frv,
3545796c8dcSSimon Schubert .#define bfd_mach_frv		1
3555796c8dcSSimon Schubert .#define bfd_mach_frvsimple	2
3565796c8dcSSimon Schubert .#define bfd_mach_fr300		300
3575796c8dcSSimon Schubert .#define bfd_mach_fr400		400
3585796c8dcSSimon Schubert .#define bfd_mach_fr450		450
3595796c8dcSSimon Schubert .#define bfd_mach_frvtomcat	499	{* fr500 prototype *}
3605796c8dcSSimon Schubert .#define bfd_mach_fr500		500
3615796c8dcSSimon Schubert .#define bfd_mach_fr550		550
3625796c8dcSSimon Schubert .  bfd_arch_moxie,       {* The moxie processor *}
3635796c8dcSSimon Schubert .#define bfd_mach_moxie		1
3645796c8dcSSimon Schubert .  bfd_arch_mcore,
3655796c8dcSSimon Schubert .  bfd_arch_mep,
3665796c8dcSSimon Schubert .#define bfd_mach_mep		1
3675796c8dcSSimon Schubert .#define bfd_mach_mep_h1	0x6831
3685796c8dcSSimon Schubert .#define bfd_mach_mep_c5	0x6335
369*ef5ccd6cSJohn Marino .  bfd_arch_metag,
370*ef5ccd6cSJohn Marino .#define bfd_mach_metag		1
3715796c8dcSSimon Schubert .  bfd_arch_ia64,      {* HP/Intel ia64 *}
3725796c8dcSSimon Schubert .#define bfd_mach_ia64_elf64	64
3735796c8dcSSimon Schubert .#define bfd_mach_ia64_elf32	32
3745796c8dcSSimon Schubert .  bfd_arch_ip2k,      {* Ubicom IP2K microcontrollers. *}
3755796c8dcSSimon Schubert .#define bfd_mach_ip2022	1
3765796c8dcSSimon Schubert .#define bfd_mach_ip2022ext	2
3775796c8dcSSimon Schubert . bfd_arch_iq2000,     {* Vitesse IQ2000.  *}
3785796c8dcSSimon Schubert .#define bfd_mach_iq2000        1
3795796c8dcSSimon Schubert .#define bfd_mach_iq10          2
380a45ae5f8SJohn Marino .  bfd_arch_epiphany,	{* Adapteva EPIPHANY *}
381a45ae5f8SJohn Marino .#define bfd_mach_epiphany16	1
382a45ae5f8SJohn Marino .#define bfd_mach_epiphany32	2
3835796c8dcSSimon Schubert .  bfd_arch_mt,
3845796c8dcSSimon Schubert .#define bfd_mach_ms1           1
3855796c8dcSSimon Schubert .#define bfd_mach_mrisc2        2
3865796c8dcSSimon Schubert .#define bfd_mach_ms2           3
3875796c8dcSSimon Schubert .  bfd_arch_pj,
3885796c8dcSSimon Schubert .  bfd_arch_avr,       {* Atmel AVR microcontrollers.  *}
3895796c8dcSSimon Schubert .#define bfd_mach_avr1		1
3905796c8dcSSimon Schubert .#define bfd_mach_avr2		2
3915796c8dcSSimon Schubert .#define bfd_mach_avr25		25
3925796c8dcSSimon Schubert .#define bfd_mach_avr3		3
3935796c8dcSSimon Schubert .#define bfd_mach_avr31		31
3945796c8dcSSimon Schubert .#define bfd_mach_avr35		35
3955796c8dcSSimon Schubert .#define bfd_mach_avr4		4
3965796c8dcSSimon Schubert .#define bfd_mach_avr5		5
3975796c8dcSSimon Schubert .#define bfd_mach_avr51		51
3985796c8dcSSimon Schubert .#define bfd_mach_avr6		6
399c50c785cSJohn Marino .#define bfd_mach_avrxmega1 101
400c50c785cSJohn Marino .#define bfd_mach_avrxmega2 102
401c50c785cSJohn Marino .#define bfd_mach_avrxmega3 103
402c50c785cSJohn Marino .#define bfd_mach_avrxmega4 104
403c50c785cSJohn Marino .#define bfd_mach_avrxmega5 105
404c50c785cSJohn Marino .#define bfd_mach_avrxmega6 106
405c50c785cSJohn Marino .#define bfd_mach_avrxmega7 107
4065796c8dcSSimon Schubert .  bfd_arch_bfin,        {* ADI Blackfin *}
4075796c8dcSSimon Schubert .#define bfd_mach_bfin          1
4085796c8dcSSimon Schubert .  bfd_arch_cr16,       {* National Semiconductor CompactRISC (ie CR16). *}
4095796c8dcSSimon Schubert .#define bfd_mach_cr16		1
4105796c8dcSSimon Schubert .  bfd_arch_cr16c,       {* National Semiconductor CompactRISC. *}
4115796c8dcSSimon Schubert .#define bfd_mach_cr16c		1
4125796c8dcSSimon Schubert .  bfd_arch_crx,       {*  National Semiconductor CRX.  *}
4135796c8dcSSimon Schubert .#define bfd_mach_crx		1
4145796c8dcSSimon Schubert .  bfd_arch_cris,      {* Axis CRIS *}
4155796c8dcSSimon Schubert .#define bfd_mach_cris_v0_v10	255
4165796c8dcSSimon Schubert .#define bfd_mach_cris_v32	32
4175796c8dcSSimon Schubert .#define bfd_mach_cris_v10_v32	1032
418a45ae5f8SJohn Marino .  bfd_arch_rl78,
419a45ae5f8SJohn Marino .#define bfd_mach_rl78	0x75
420cf7f2e2dSJohn Marino .  bfd_arch_rx,        {* Renesas RX.  *}
421cf7f2e2dSJohn Marino .#define bfd_mach_rx            0x75
4225796c8dcSSimon Schubert .  bfd_arch_s390,      {* IBM s390 *}
4235796c8dcSSimon Schubert .#define bfd_mach_s390_31       31
4245796c8dcSSimon Schubert .#define bfd_mach_s390_64       64
4255796c8dcSSimon Schubert .  bfd_arch_score,     {* Sunplus score *}
4265796c8dcSSimon Schubert .#define bfd_mach_score3         3
4275796c8dcSSimon Schubert .#define bfd_mach_score7         7
4285796c8dcSSimon Schubert .  bfd_arch_openrisc,  {* OpenRISC *}
4295796c8dcSSimon Schubert .  bfd_arch_mmix,      {* Donald Knuth's educational processor.  *}
4305796c8dcSSimon Schubert .  bfd_arch_xstormy16,
4315796c8dcSSimon Schubert .#define bfd_mach_xstormy16	1
4325796c8dcSSimon Schubert .  bfd_arch_msp430,    {* Texas Instruments MSP430 architecture.  *}
4335796c8dcSSimon Schubert .#define bfd_mach_msp11          11
4345796c8dcSSimon Schubert .#define bfd_mach_msp110         110
4355796c8dcSSimon Schubert .#define bfd_mach_msp12          12
4365796c8dcSSimon Schubert .#define bfd_mach_msp13          13
4375796c8dcSSimon Schubert .#define bfd_mach_msp14          14
4385796c8dcSSimon Schubert .#define bfd_mach_msp15          15
4395796c8dcSSimon Schubert .#define bfd_mach_msp16          16
4405796c8dcSSimon Schubert .#define bfd_mach_msp21          21
4415796c8dcSSimon Schubert .#define bfd_mach_msp31          31
4425796c8dcSSimon Schubert .#define bfd_mach_msp32          32
4435796c8dcSSimon Schubert .#define bfd_mach_msp33          33
4445796c8dcSSimon Schubert .#define bfd_mach_msp41          41
4455796c8dcSSimon Schubert .#define bfd_mach_msp42          42
4465796c8dcSSimon Schubert .#define bfd_mach_msp43          43
4475796c8dcSSimon Schubert .#define bfd_mach_msp44          44
4485796c8dcSSimon Schubert .  bfd_arch_xc16x,     {* Infineon's XC16X Series.               *}
4495796c8dcSSimon Schubert .#define bfd_mach_xc16x         1
4505796c8dcSSimon Schubert .#define bfd_mach_xc16xl        2
4515796c8dcSSimon Schubert .#define bfd_mach_xc16xs        3
452*ef5ccd6cSJohn Marino .  bfd_arch_xgate,   {* Freescale XGATE *}
453*ef5ccd6cSJohn Marino .#define bfd_mach_xgate         1
4545796c8dcSSimon Schubert .  bfd_arch_xtensa,    {* Tensilica's Xtensa cores.  *}
4555796c8dcSSimon Schubert .#define bfd_mach_xtensa	1
4565796c8dcSSimon Schubert .  bfd_arch_z80,
4575796c8dcSSimon Schubert .#define bfd_mach_z80strict      1 {* No undocumented opcodes.  *}
4585796c8dcSSimon Schubert .#define bfd_mach_z80            3 {* With ixl, ixh, iyl, and iyh.  *}
4595796c8dcSSimon Schubert .#define bfd_mach_z80full        7 {* All undocumented instructions.  *}
4605796c8dcSSimon Schubert .#define bfd_mach_r800           11 {* R800: successor with multiplication.  *}
4615796c8dcSSimon Schubert .  bfd_arch_lm32,      {* Lattice Mico32 *}
4625796c8dcSSimon Schubert .#define bfd_mach_lm32      1
4635796c8dcSSimon Schubert .  bfd_arch_microblaze,{* Xilinx MicroBlaze. *}
464a45ae5f8SJohn Marino .  bfd_arch_tilepro,   {* Tilera TILEPro *}
465a45ae5f8SJohn Marino .  bfd_arch_tilegx, {* Tilera TILE-Gx *}
466a45ae5f8SJohn Marino .#define bfd_mach_tilepro   1
467a45ae5f8SJohn Marino .#define bfd_mach_tilegx    1
468*ef5ccd6cSJohn Marino .#define bfd_mach_tilegx32  2
469*ef5ccd6cSJohn Marino .  bfd_arch_aarch64,   {* AArch64  *}
470*ef5ccd6cSJohn Marino .#define bfd_mach_aarch64 0
471*ef5ccd6cSJohn Marino .  bfd_arch_nios2,
472*ef5ccd6cSJohn Marino .#define bfd_mach_nios2	0
4735796c8dcSSimon Schubert .  bfd_arch_last
4745796c8dcSSimon Schubert .  };
4755796c8dcSSimon Schubert */
4765796c8dcSSimon Schubert 
4775796c8dcSSimon Schubert /*
4785796c8dcSSimon Schubert SUBSECTION
4795796c8dcSSimon Schubert 	bfd_arch_info
4805796c8dcSSimon Schubert 
4815796c8dcSSimon Schubert DESCRIPTION
4825796c8dcSSimon Schubert 	This structure contains information on architectures for use
4835796c8dcSSimon Schubert 	within BFD.
4845796c8dcSSimon Schubert 
4855796c8dcSSimon Schubert .
4865796c8dcSSimon Schubert .typedef struct bfd_arch_info
4875796c8dcSSimon Schubert .{
4885796c8dcSSimon Schubert .  int bits_per_word;
4895796c8dcSSimon Schubert .  int bits_per_address;
4905796c8dcSSimon Schubert .  int bits_per_byte;
4915796c8dcSSimon Schubert .  enum bfd_architecture arch;
4925796c8dcSSimon Schubert .  unsigned long mach;
4935796c8dcSSimon Schubert .  const char *arch_name;
4945796c8dcSSimon Schubert .  const char *printable_name;
4955796c8dcSSimon Schubert .  unsigned int section_align_power;
4965796c8dcSSimon Schubert .  {* TRUE if this is the default machine for the architecture.
4975796c8dcSSimon Schubert .     The default arch should be the first entry for an arch so that
4985796c8dcSSimon Schubert .     all the entries for that arch can be accessed via <<next>>.  *}
4995796c8dcSSimon Schubert .  bfd_boolean the_default;
5005796c8dcSSimon Schubert .  const struct bfd_arch_info * (*compatible)
5015796c8dcSSimon Schubert .    (const struct bfd_arch_info *a, const struct bfd_arch_info *b);
5025796c8dcSSimon Schubert .
5035796c8dcSSimon Schubert .  bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
5045796c8dcSSimon Schubert .
505*ef5ccd6cSJohn Marino .  {* Allocate via bfd_malloc and return a fill buffer of size COUNT.  If
506*ef5ccd6cSJohn Marino .     IS_BIGENDIAN is TRUE, the order of bytes is big endian.  If CODE is
507*ef5ccd6cSJohn Marino .     TRUE, the buffer contains code.  *}
508*ef5ccd6cSJohn Marino .  void *(*fill) (bfd_size_type count, bfd_boolean is_bigendian,
509*ef5ccd6cSJohn Marino .		  bfd_boolean code);
510*ef5ccd6cSJohn Marino .
5115796c8dcSSimon Schubert .  const struct bfd_arch_info *next;
5125796c8dcSSimon Schubert .}
5135796c8dcSSimon Schubert .bfd_arch_info_type;
5145796c8dcSSimon Schubert .
5155796c8dcSSimon Schubert */
5165796c8dcSSimon Schubert 
517*ef5ccd6cSJohn Marino extern const bfd_arch_info_type bfd_aarch64_arch;
5185796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_alpha_arch;
5195796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_arc_arch;
5205796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_arm_arch;
5215796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_avr_arch;
5225796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_bfin_arch;
5235796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_cr16_arch;
5245796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_cr16c_arch;
5255796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_cris_arch;
5265796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_crx_arch;
5275796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_d10v_arch;
5285796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_d30v_arch;
5295796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_dlx_arch;
530a45ae5f8SJohn Marino extern const bfd_arch_info_type bfd_epiphany_arch;
5315796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_fr30_arch;
5325796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_frv_arch;
5335796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_h8300_arch;
5345796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_h8500_arch;
5355796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_hppa_arch;
5365796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_i370_arch;
5375796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_i386_arch;
5385796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_i860_arch;
5395796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_i960_arch;
5405796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_ia64_arch;
5415796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_ip2k_arch;
5425796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_iq2000_arch;
543a45ae5f8SJohn Marino extern const bfd_arch_info_type bfd_k1om_arch;
5445796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_l1om_arch;
5455796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_lm32_arch;
5465796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_m32c_arch;
5475796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_m32r_arch;
5485796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_m68hc11_arch;
5495796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_m68hc12_arch;
550*ef5ccd6cSJohn Marino extern const bfd_arch_info_type bfd_m9s12x_arch;
551*ef5ccd6cSJohn Marino extern const bfd_arch_info_type bfd_m9s12xg_arch;
5525796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_m68k_arch;
5535796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_m88k_arch;
5545796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_mcore_arch;
5555796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_mep_arch;
556*ef5ccd6cSJohn Marino extern const bfd_arch_info_type bfd_metag_arch;
5575796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_mips_arch;
5585796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_microblaze_arch;
5595796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_mmix_arch;
5605796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_mn10200_arch;
5615796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_mn10300_arch;
5625796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_moxie_arch;
5635796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_msp430_arch;
5645796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_mt_arch;
565*ef5ccd6cSJohn Marino extern const bfd_arch_info_type bfd_nios2_arch;
5665796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_ns32k_arch;
5675796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_openrisc_arch;
5685796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_or32_arch;
5695796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_pdp11_arch;
5705796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_pj_arch;
5715796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_plugin_arch;
5725796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_powerpc_archs[];
5735796c8dcSSimon Schubert #define bfd_powerpc_arch bfd_powerpc_archs[0]
5745796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_rs6000_arch;
575a45ae5f8SJohn Marino extern const bfd_arch_info_type bfd_rl78_arch;
576cf7f2e2dSJohn Marino extern const bfd_arch_info_type bfd_rx_arch;
5775796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_s390_arch;
5785796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_score_arch;
5795796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_sh_arch;
5805796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_sparc_arch;
5815796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_spu_arch;
5825796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_tic30_arch;
5835796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_tic4x_arch;
5845796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_tic54x_arch;
585cf7f2e2dSJohn Marino extern const bfd_arch_info_type bfd_tic6x_arch;
5865796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_tic80_arch;
587a45ae5f8SJohn Marino extern const bfd_arch_info_type bfd_tilegx_arch;
588a45ae5f8SJohn Marino extern const bfd_arch_info_type bfd_tilepro_arch;
5895796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_v850_arch;
590*ef5ccd6cSJohn Marino extern const bfd_arch_info_type bfd_v850_rh850_arch;
5915796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_vax_arch;
5925796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_w65_arch;
5935796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_we32k_arch;
5945796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_xstormy16_arch;
5955796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_xtensa_arch;
5965796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_xc16x_arch;
597*ef5ccd6cSJohn Marino extern const bfd_arch_info_type bfd_xgate_arch;
5985796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_z80_arch;
5995796c8dcSSimon Schubert extern const bfd_arch_info_type bfd_z8k_arch;
6005796c8dcSSimon Schubert 
6015796c8dcSSimon Schubert static const bfd_arch_info_type * const bfd_archures_list[] =
6025796c8dcSSimon Schubert   {
6035796c8dcSSimon Schubert #ifdef SELECT_ARCHITECTURES
6045796c8dcSSimon Schubert     SELECT_ARCHITECTURES,
6055796c8dcSSimon Schubert #else
606*ef5ccd6cSJohn Marino     &bfd_aarch64_arch,
6075796c8dcSSimon Schubert     &bfd_alpha_arch,
6085796c8dcSSimon Schubert     &bfd_arc_arch,
6095796c8dcSSimon Schubert     &bfd_arm_arch,
6105796c8dcSSimon Schubert     &bfd_avr_arch,
6115796c8dcSSimon Schubert     &bfd_bfin_arch,
6125796c8dcSSimon Schubert     &bfd_cr16_arch,
6135796c8dcSSimon Schubert     &bfd_cr16c_arch,
6145796c8dcSSimon Schubert     &bfd_cris_arch,
6155796c8dcSSimon Schubert     &bfd_crx_arch,
6165796c8dcSSimon Schubert     &bfd_d10v_arch,
6175796c8dcSSimon Schubert     &bfd_d30v_arch,
6185796c8dcSSimon Schubert     &bfd_dlx_arch,
619a45ae5f8SJohn Marino     &bfd_epiphany_arch,
6205796c8dcSSimon Schubert     &bfd_fr30_arch,
6215796c8dcSSimon Schubert     &bfd_frv_arch,
6225796c8dcSSimon Schubert     &bfd_h8300_arch,
6235796c8dcSSimon Schubert     &bfd_h8500_arch,
6245796c8dcSSimon Schubert     &bfd_hppa_arch,
6255796c8dcSSimon Schubert     &bfd_i370_arch,
6265796c8dcSSimon Schubert     &bfd_i386_arch,
6275796c8dcSSimon Schubert     &bfd_i860_arch,
6285796c8dcSSimon Schubert     &bfd_i960_arch,
6295796c8dcSSimon Schubert     &bfd_ia64_arch,
6305796c8dcSSimon Schubert     &bfd_ip2k_arch,
6315796c8dcSSimon Schubert     &bfd_iq2000_arch,
632a45ae5f8SJohn Marino     &bfd_k1om_arch,
6335796c8dcSSimon Schubert     &bfd_l1om_arch,
6345796c8dcSSimon Schubert     &bfd_lm32_arch,
6355796c8dcSSimon Schubert     &bfd_m32c_arch,
6365796c8dcSSimon Schubert     &bfd_m32r_arch,
6375796c8dcSSimon Schubert     &bfd_m68hc11_arch,
6385796c8dcSSimon Schubert     &bfd_m68hc12_arch,
639*ef5ccd6cSJohn Marino     &bfd_m9s12x_arch,
640*ef5ccd6cSJohn Marino     &bfd_m9s12xg_arch,
6415796c8dcSSimon Schubert     &bfd_m68k_arch,
6425796c8dcSSimon Schubert     &bfd_m88k_arch,
6435796c8dcSSimon Schubert     &bfd_mcore_arch,
6445796c8dcSSimon Schubert     &bfd_mep_arch,
645*ef5ccd6cSJohn Marino     &bfd_metag_arch,
6465796c8dcSSimon Schubert     &bfd_microblaze_arch,
6475796c8dcSSimon Schubert     &bfd_mips_arch,
6485796c8dcSSimon Schubert     &bfd_mmix_arch,
6495796c8dcSSimon Schubert     &bfd_mn10200_arch,
6505796c8dcSSimon Schubert     &bfd_mn10300_arch,
6515796c8dcSSimon Schubert     &bfd_moxie_arch,
6525796c8dcSSimon Schubert     &bfd_msp430_arch,
6535796c8dcSSimon Schubert     &bfd_mt_arch,
654*ef5ccd6cSJohn Marino     &bfd_nios2_arch,
6555796c8dcSSimon Schubert     &bfd_ns32k_arch,
6565796c8dcSSimon Schubert     &bfd_openrisc_arch,
6575796c8dcSSimon Schubert     &bfd_or32_arch,
6585796c8dcSSimon Schubert     &bfd_pdp11_arch,
6595796c8dcSSimon Schubert     &bfd_powerpc_arch,
6605796c8dcSSimon Schubert     &bfd_rs6000_arch,
661a45ae5f8SJohn Marino     &bfd_rl78_arch,
662cf7f2e2dSJohn Marino     &bfd_rx_arch,
6635796c8dcSSimon Schubert     &bfd_s390_arch,
6645796c8dcSSimon Schubert     &bfd_score_arch,
6655796c8dcSSimon Schubert     &bfd_sh_arch,
6665796c8dcSSimon Schubert     &bfd_sparc_arch,
6675796c8dcSSimon Schubert     &bfd_spu_arch,
6685796c8dcSSimon Schubert     &bfd_tic30_arch,
6695796c8dcSSimon Schubert     &bfd_tic4x_arch,
6705796c8dcSSimon Schubert     &bfd_tic54x_arch,
671cf7f2e2dSJohn Marino     &bfd_tic6x_arch,
6725796c8dcSSimon Schubert     &bfd_tic80_arch,
673a45ae5f8SJohn Marino     &bfd_tilegx_arch,
674a45ae5f8SJohn Marino     &bfd_tilepro_arch,
6755796c8dcSSimon Schubert     &bfd_v850_arch,
676*ef5ccd6cSJohn Marino     &bfd_v850_rh850_arch,
6775796c8dcSSimon Schubert     &bfd_vax_arch,
6785796c8dcSSimon Schubert     &bfd_w65_arch,
6795796c8dcSSimon Schubert     &bfd_we32k_arch,
6805796c8dcSSimon Schubert     &bfd_xstormy16_arch,
6815796c8dcSSimon Schubert     &bfd_xtensa_arch,
6825796c8dcSSimon Schubert     &bfd_xc16x_arch,
683*ef5ccd6cSJohn Marino     &bfd_xgate_arch,
6845796c8dcSSimon Schubert     &bfd_z80_arch,
6855796c8dcSSimon Schubert     &bfd_z8k_arch,
6865796c8dcSSimon Schubert #endif
6875796c8dcSSimon Schubert   0
6885796c8dcSSimon Schubert };
6895796c8dcSSimon Schubert 
6905796c8dcSSimon Schubert /*
6915796c8dcSSimon Schubert FUNCTION
6925796c8dcSSimon Schubert 	bfd_printable_name
6935796c8dcSSimon Schubert 
6945796c8dcSSimon Schubert SYNOPSIS
6955796c8dcSSimon Schubert 	const char *bfd_printable_name (bfd *abfd);
6965796c8dcSSimon Schubert 
6975796c8dcSSimon Schubert DESCRIPTION
6985796c8dcSSimon Schubert 	Return a printable string representing the architecture and machine
6995796c8dcSSimon Schubert 	from the pointer to the architecture info structure.
7005796c8dcSSimon Schubert 
7015796c8dcSSimon Schubert */
7025796c8dcSSimon Schubert 
7035796c8dcSSimon Schubert const char *
bfd_printable_name(bfd * abfd)7045796c8dcSSimon Schubert bfd_printable_name (bfd *abfd)
7055796c8dcSSimon Schubert {
7065796c8dcSSimon Schubert   return abfd->arch_info->printable_name;
7075796c8dcSSimon Schubert }
7085796c8dcSSimon Schubert 
7095796c8dcSSimon Schubert /*
7105796c8dcSSimon Schubert FUNCTION
7115796c8dcSSimon Schubert 	bfd_scan_arch
7125796c8dcSSimon Schubert 
7135796c8dcSSimon Schubert SYNOPSIS
7145796c8dcSSimon Schubert 	const bfd_arch_info_type *bfd_scan_arch (const char *string);
7155796c8dcSSimon Schubert 
7165796c8dcSSimon Schubert DESCRIPTION
7175796c8dcSSimon Schubert 	Figure out if BFD supports any cpu which could be described with
7185796c8dcSSimon Schubert 	the name @var{string}.  Return a pointer to an <<arch_info>>
7195796c8dcSSimon Schubert 	structure if a machine is found, otherwise NULL.
7205796c8dcSSimon Schubert */
7215796c8dcSSimon Schubert 
7225796c8dcSSimon Schubert const bfd_arch_info_type *
bfd_scan_arch(const char * string)7235796c8dcSSimon Schubert bfd_scan_arch (const char *string)
7245796c8dcSSimon Schubert {
7255796c8dcSSimon Schubert   const bfd_arch_info_type * const *app, *ap;
7265796c8dcSSimon Schubert 
7275796c8dcSSimon Schubert   /* Look through all the installed architectures.  */
7285796c8dcSSimon Schubert   for (app = bfd_archures_list; *app != NULL; app++)
7295796c8dcSSimon Schubert     {
7305796c8dcSSimon Schubert       for (ap = *app; ap != NULL; ap = ap->next)
7315796c8dcSSimon Schubert 	{
7325796c8dcSSimon Schubert 	  if (ap->scan (ap, string))
7335796c8dcSSimon Schubert 	    return ap;
7345796c8dcSSimon Schubert 	}
7355796c8dcSSimon Schubert     }
7365796c8dcSSimon Schubert 
7375796c8dcSSimon Schubert   return NULL;
7385796c8dcSSimon Schubert }
7395796c8dcSSimon Schubert 
7405796c8dcSSimon Schubert /*
7415796c8dcSSimon Schubert FUNCTION
7425796c8dcSSimon Schubert 	bfd_arch_list
7435796c8dcSSimon Schubert 
7445796c8dcSSimon Schubert SYNOPSIS
7455796c8dcSSimon Schubert 	const char **bfd_arch_list (void);
7465796c8dcSSimon Schubert 
7475796c8dcSSimon Schubert DESCRIPTION
7485796c8dcSSimon Schubert 	Return a freshly malloced NULL-terminated vector of the names
7495796c8dcSSimon Schubert 	of all the valid BFD architectures.  Do not modify the names.
7505796c8dcSSimon Schubert */
7515796c8dcSSimon Schubert 
7525796c8dcSSimon Schubert const char **
bfd_arch_list(void)7535796c8dcSSimon Schubert bfd_arch_list (void)
7545796c8dcSSimon Schubert {
7555796c8dcSSimon Schubert   int vec_length = 0;
7565796c8dcSSimon Schubert   const char **name_ptr;
7575796c8dcSSimon Schubert   const char **name_list;
7585796c8dcSSimon Schubert   const bfd_arch_info_type * const *app;
7595796c8dcSSimon Schubert   bfd_size_type amt;
7605796c8dcSSimon Schubert 
7615796c8dcSSimon Schubert   /* Determine the number of architectures.  */
7625796c8dcSSimon Schubert   vec_length = 0;
7635796c8dcSSimon Schubert   for (app = bfd_archures_list; *app != NULL; app++)
7645796c8dcSSimon Schubert     {
7655796c8dcSSimon Schubert       const bfd_arch_info_type *ap;
7665796c8dcSSimon Schubert       for (ap = *app; ap != NULL; ap = ap->next)
7675796c8dcSSimon Schubert 	{
7685796c8dcSSimon Schubert 	  vec_length++;
7695796c8dcSSimon Schubert 	}
7705796c8dcSSimon Schubert     }
7715796c8dcSSimon Schubert 
7725796c8dcSSimon Schubert   amt = (vec_length + 1) * sizeof (char **);
7735796c8dcSSimon Schubert   name_list = (const char **) bfd_malloc (amt);
7745796c8dcSSimon Schubert   if (name_list == NULL)
7755796c8dcSSimon Schubert     return NULL;
7765796c8dcSSimon Schubert 
7775796c8dcSSimon Schubert   /* Point the list at each of the names.  */
7785796c8dcSSimon Schubert   name_ptr = name_list;
7795796c8dcSSimon Schubert   for (app = bfd_archures_list; *app != NULL; app++)
7805796c8dcSSimon Schubert     {
7815796c8dcSSimon Schubert       const bfd_arch_info_type *ap;
7825796c8dcSSimon Schubert       for (ap = *app; ap != NULL; ap = ap->next)
7835796c8dcSSimon Schubert 	{
7845796c8dcSSimon Schubert 	  *name_ptr = ap->printable_name;
7855796c8dcSSimon Schubert 	  name_ptr++;
7865796c8dcSSimon Schubert 	}
7875796c8dcSSimon Schubert     }
7885796c8dcSSimon Schubert   *name_ptr = NULL;
7895796c8dcSSimon Schubert 
7905796c8dcSSimon Schubert   return name_list;
7915796c8dcSSimon Schubert }
7925796c8dcSSimon Schubert 
7935796c8dcSSimon Schubert /*
7945796c8dcSSimon Schubert FUNCTION
7955796c8dcSSimon Schubert 	bfd_arch_get_compatible
7965796c8dcSSimon Schubert 
7975796c8dcSSimon Schubert SYNOPSIS
7985796c8dcSSimon Schubert 	const bfd_arch_info_type *bfd_arch_get_compatible
7995796c8dcSSimon Schubert 	  (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns);
8005796c8dcSSimon Schubert 
8015796c8dcSSimon Schubert DESCRIPTION
8025796c8dcSSimon Schubert 	Determine whether two BFDs' architectures and machine types
8035796c8dcSSimon Schubert 	are compatible.  Calculates the lowest common denominator
8045796c8dcSSimon Schubert 	between the two architectures and machine types implied by
8055796c8dcSSimon Schubert 	the BFDs and returns a pointer to an <<arch_info>> structure
8065796c8dcSSimon Schubert 	describing the compatible machine.
8075796c8dcSSimon Schubert */
8085796c8dcSSimon Schubert 
8095796c8dcSSimon Schubert const bfd_arch_info_type *
bfd_arch_get_compatible(const bfd * abfd,const bfd * bbfd,bfd_boolean accept_unknowns)8105796c8dcSSimon Schubert bfd_arch_get_compatible (const bfd *abfd,
8115796c8dcSSimon Schubert 			 const bfd *bbfd,
8125796c8dcSSimon Schubert 			 bfd_boolean accept_unknowns)
8135796c8dcSSimon Schubert {
814a45ae5f8SJohn Marino   const bfd *ubfd, *kbfd;
8155796c8dcSSimon Schubert 
8165796c8dcSSimon Schubert   /* Look for an unknown architecture.  */
817a45ae5f8SJohn Marino   if (abfd->arch_info->arch == bfd_arch_unknown)
818a45ae5f8SJohn Marino     ubfd = abfd, kbfd = bbfd;
819a45ae5f8SJohn Marino   else if (bbfd->arch_info->arch == bfd_arch_unknown)
820a45ae5f8SJohn Marino     ubfd = bbfd, kbfd = abfd;
821a45ae5f8SJohn Marino   else
822a45ae5f8SJohn Marino     /* Otherwise architecture-specific code has to decide.  */
823a45ae5f8SJohn Marino     return abfd->arch_info->compatible (abfd->arch_info, bbfd->arch_info);
824a45ae5f8SJohn Marino 
8255796c8dcSSimon Schubert   /* We can allow an unknown architecture if accept_unknowns
8265796c8dcSSimon Schubert      is true, or if the target is the "binary" format, which
8275796c8dcSSimon Schubert      has an unknown architecture.  Since the binary format can
8285796c8dcSSimon Schubert      only be set by explicit request from the user, it is safe
8295796c8dcSSimon Schubert      to assume that they know what they are doing.  */
8305796c8dcSSimon Schubert   if (accept_unknowns
8315796c8dcSSimon Schubert       || strcmp (bfd_get_target (ubfd), "binary") == 0)
832a45ae5f8SJohn Marino     return kbfd->arch_info;
8335796c8dcSSimon Schubert   return NULL;
8345796c8dcSSimon Schubert }
8355796c8dcSSimon Schubert 
8365796c8dcSSimon Schubert /*
8375796c8dcSSimon Schubert INTERNAL_DEFINITION
8385796c8dcSSimon Schubert 	bfd_default_arch_struct
8395796c8dcSSimon Schubert 
8405796c8dcSSimon Schubert DESCRIPTION
8415796c8dcSSimon Schubert 	The <<bfd_default_arch_struct>> is an item of
8425796c8dcSSimon Schubert 	<<bfd_arch_info_type>> which has been initialized to a fairly
8435796c8dcSSimon Schubert 	generic state.  A BFD starts life by pointing to this
8445796c8dcSSimon Schubert 	structure, until the correct back end has determined the real
8455796c8dcSSimon Schubert 	architecture of the file.
8465796c8dcSSimon Schubert 
8475796c8dcSSimon Schubert .extern const bfd_arch_info_type bfd_default_arch_struct;
8485796c8dcSSimon Schubert */
8495796c8dcSSimon Schubert 
8505796c8dcSSimon Schubert const bfd_arch_info_type bfd_default_arch_struct = {
8515796c8dcSSimon Schubert   32, 32, 8, bfd_arch_unknown, 0, "unknown", "unknown", 2, TRUE,
8525796c8dcSSimon Schubert   bfd_default_compatible,
8535796c8dcSSimon Schubert   bfd_default_scan,
854*ef5ccd6cSJohn Marino   bfd_arch_default_fill,
8555796c8dcSSimon Schubert   0,
8565796c8dcSSimon Schubert };
8575796c8dcSSimon Schubert 
8585796c8dcSSimon Schubert /*
8595796c8dcSSimon Schubert FUNCTION
8605796c8dcSSimon Schubert 	bfd_set_arch_info
8615796c8dcSSimon Schubert 
8625796c8dcSSimon Schubert SYNOPSIS
8635796c8dcSSimon Schubert 	void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg);
8645796c8dcSSimon Schubert 
8655796c8dcSSimon Schubert DESCRIPTION
8665796c8dcSSimon Schubert 	Set the architecture info of @var{abfd} to @var{arg}.
8675796c8dcSSimon Schubert */
8685796c8dcSSimon Schubert 
8695796c8dcSSimon Schubert void
bfd_set_arch_info(bfd * abfd,const bfd_arch_info_type * arg)8705796c8dcSSimon Schubert bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg)
8715796c8dcSSimon Schubert {
8725796c8dcSSimon Schubert   abfd->arch_info = arg;
8735796c8dcSSimon Schubert }
8745796c8dcSSimon Schubert 
8755796c8dcSSimon Schubert /*
8765796c8dcSSimon Schubert INTERNAL_FUNCTION
8775796c8dcSSimon Schubert 	bfd_default_set_arch_mach
8785796c8dcSSimon Schubert 
8795796c8dcSSimon Schubert SYNOPSIS
8805796c8dcSSimon Schubert 	bfd_boolean bfd_default_set_arch_mach
8815796c8dcSSimon Schubert 	  (bfd *abfd, enum bfd_architecture arch, unsigned long mach);
8825796c8dcSSimon Schubert 
8835796c8dcSSimon Schubert DESCRIPTION
8845796c8dcSSimon Schubert 	Set the architecture and machine type in BFD @var{abfd}
8855796c8dcSSimon Schubert 	to @var{arch} and @var{mach}.  Find the correct
8865796c8dcSSimon Schubert 	pointer to a structure and insert it into the <<arch_info>>
8875796c8dcSSimon Schubert 	pointer.
8885796c8dcSSimon Schubert */
8895796c8dcSSimon Schubert 
8905796c8dcSSimon Schubert bfd_boolean
bfd_default_set_arch_mach(bfd * abfd,enum bfd_architecture arch,unsigned long mach)8915796c8dcSSimon Schubert bfd_default_set_arch_mach (bfd *abfd,
8925796c8dcSSimon Schubert 			   enum bfd_architecture arch,
8935796c8dcSSimon Schubert 			   unsigned long mach)
8945796c8dcSSimon Schubert {
8955796c8dcSSimon Schubert   abfd->arch_info = bfd_lookup_arch (arch, mach);
8965796c8dcSSimon Schubert   if (abfd->arch_info != NULL)
8975796c8dcSSimon Schubert     return TRUE;
8985796c8dcSSimon Schubert 
8995796c8dcSSimon Schubert   abfd->arch_info = &bfd_default_arch_struct;
9005796c8dcSSimon Schubert   bfd_set_error (bfd_error_bad_value);
9015796c8dcSSimon Schubert   return FALSE;
9025796c8dcSSimon Schubert }
9035796c8dcSSimon Schubert 
9045796c8dcSSimon Schubert /*
9055796c8dcSSimon Schubert FUNCTION
9065796c8dcSSimon Schubert 	bfd_get_arch
9075796c8dcSSimon Schubert 
9085796c8dcSSimon Schubert SYNOPSIS
9095796c8dcSSimon Schubert 	enum bfd_architecture bfd_get_arch (bfd *abfd);
9105796c8dcSSimon Schubert 
9115796c8dcSSimon Schubert DESCRIPTION
9125796c8dcSSimon Schubert 	Return the enumerated type which describes the BFD @var{abfd}'s
9135796c8dcSSimon Schubert 	architecture.
9145796c8dcSSimon Schubert */
9155796c8dcSSimon Schubert 
9165796c8dcSSimon Schubert enum bfd_architecture
bfd_get_arch(bfd * abfd)9175796c8dcSSimon Schubert bfd_get_arch (bfd *abfd)
9185796c8dcSSimon Schubert {
9195796c8dcSSimon Schubert   return abfd->arch_info->arch;
9205796c8dcSSimon Schubert }
9215796c8dcSSimon Schubert 
9225796c8dcSSimon Schubert /*
9235796c8dcSSimon Schubert FUNCTION
9245796c8dcSSimon Schubert 	bfd_get_mach
9255796c8dcSSimon Schubert 
9265796c8dcSSimon Schubert SYNOPSIS
9275796c8dcSSimon Schubert 	unsigned long bfd_get_mach (bfd *abfd);
9285796c8dcSSimon Schubert 
9295796c8dcSSimon Schubert DESCRIPTION
9305796c8dcSSimon Schubert 	Return the long type which describes the BFD @var{abfd}'s
9315796c8dcSSimon Schubert 	machine.
9325796c8dcSSimon Schubert */
9335796c8dcSSimon Schubert 
9345796c8dcSSimon Schubert unsigned long
bfd_get_mach(bfd * abfd)9355796c8dcSSimon Schubert bfd_get_mach (bfd *abfd)
9365796c8dcSSimon Schubert {
9375796c8dcSSimon Schubert   return abfd->arch_info->mach;
9385796c8dcSSimon Schubert }
9395796c8dcSSimon Schubert 
9405796c8dcSSimon Schubert /*
9415796c8dcSSimon Schubert FUNCTION
9425796c8dcSSimon Schubert 	bfd_arch_bits_per_byte
9435796c8dcSSimon Schubert 
9445796c8dcSSimon Schubert SYNOPSIS
9455796c8dcSSimon Schubert 	unsigned int bfd_arch_bits_per_byte (bfd *abfd);
9465796c8dcSSimon Schubert 
9475796c8dcSSimon Schubert DESCRIPTION
9485796c8dcSSimon Schubert 	Return the number of bits in one of the BFD @var{abfd}'s
9495796c8dcSSimon Schubert 	architecture's bytes.
9505796c8dcSSimon Schubert */
9515796c8dcSSimon Schubert 
9525796c8dcSSimon Schubert unsigned int
bfd_arch_bits_per_byte(bfd * abfd)9535796c8dcSSimon Schubert bfd_arch_bits_per_byte (bfd *abfd)
9545796c8dcSSimon Schubert {
9555796c8dcSSimon Schubert   return abfd->arch_info->bits_per_byte;
9565796c8dcSSimon Schubert }
9575796c8dcSSimon Schubert 
9585796c8dcSSimon Schubert /*
9595796c8dcSSimon Schubert FUNCTION
9605796c8dcSSimon Schubert 	bfd_arch_bits_per_address
9615796c8dcSSimon Schubert 
9625796c8dcSSimon Schubert SYNOPSIS
9635796c8dcSSimon Schubert 	unsigned int bfd_arch_bits_per_address (bfd *abfd);
9645796c8dcSSimon Schubert 
9655796c8dcSSimon Schubert DESCRIPTION
9665796c8dcSSimon Schubert 	Return the number of bits in one of the BFD @var{abfd}'s
9675796c8dcSSimon Schubert 	architecture's addresses.
9685796c8dcSSimon Schubert */
9695796c8dcSSimon Schubert 
9705796c8dcSSimon Schubert unsigned int
bfd_arch_bits_per_address(bfd * abfd)9715796c8dcSSimon Schubert bfd_arch_bits_per_address (bfd *abfd)
9725796c8dcSSimon Schubert {
9735796c8dcSSimon Schubert   return abfd->arch_info->bits_per_address;
9745796c8dcSSimon Schubert }
9755796c8dcSSimon Schubert 
9765796c8dcSSimon Schubert /*
9775796c8dcSSimon Schubert INTERNAL_FUNCTION
9785796c8dcSSimon Schubert 	bfd_default_compatible
9795796c8dcSSimon Schubert 
9805796c8dcSSimon Schubert SYNOPSIS
9815796c8dcSSimon Schubert 	const bfd_arch_info_type *bfd_default_compatible
9825796c8dcSSimon Schubert 	  (const bfd_arch_info_type *a, const bfd_arch_info_type *b);
9835796c8dcSSimon Schubert 
9845796c8dcSSimon Schubert DESCRIPTION
9855796c8dcSSimon Schubert 	The default function for testing for compatibility.
9865796c8dcSSimon Schubert */
9875796c8dcSSimon Schubert 
9885796c8dcSSimon Schubert const bfd_arch_info_type *
bfd_default_compatible(const bfd_arch_info_type * a,const bfd_arch_info_type * b)9895796c8dcSSimon Schubert bfd_default_compatible (const bfd_arch_info_type *a,
9905796c8dcSSimon Schubert 			const bfd_arch_info_type *b)
9915796c8dcSSimon Schubert {
9925796c8dcSSimon Schubert   if (a->arch != b->arch)
9935796c8dcSSimon Schubert     return NULL;
9945796c8dcSSimon Schubert 
9955796c8dcSSimon Schubert   if (a->bits_per_word != b->bits_per_word)
9965796c8dcSSimon Schubert     return NULL;
9975796c8dcSSimon Schubert 
9985796c8dcSSimon Schubert   if (a->mach > b->mach)
9995796c8dcSSimon Schubert     return a;
10005796c8dcSSimon Schubert 
10015796c8dcSSimon Schubert   if (b->mach > a->mach)
10025796c8dcSSimon Schubert     return b;
10035796c8dcSSimon Schubert 
10045796c8dcSSimon Schubert   return a;
10055796c8dcSSimon Schubert }
10065796c8dcSSimon Schubert 
10075796c8dcSSimon Schubert /*
10085796c8dcSSimon Schubert INTERNAL_FUNCTION
10095796c8dcSSimon Schubert 	bfd_default_scan
10105796c8dcSSimon Schubert 
10115796c8dcSSimon Schubert SYNOPSIS
10125796c8dcSSimon Schubert 	bfd_boolean bfd_default_scan
10135796c8dcSSimon Schubert 	  (const struct bfd_arch_info *info, const char *string);
10145796c8dcSSimon Schubert 
10155796c8dcSSimon Schubert DESCRIPTION
10165796c8dcSSimon Schubert 	The default function for working out whether this is an
10175796c8dcSSimon Schubert 	architecture hit and a machine hit.
10185796c8dcSSimon Schubert */
10195796c8dcSSimon Schubert 
10205796c8dcSSimon Schubert bfd_boolean
bfd_default_scan(const bfd_arch_info_type * info,const char * string)10215796c8dcSSimon Schubert bfd_default_scan (const bfd_arch_info_type *info, const char *string)
10225796c8dcSSimon Schubert {
10235796c8dcSSimon Schubert   const char *ptr_src;
10245796c8dcSSimon Schubert   const char *ptr_tst;
10255796c8dcSSimon Schubert   unsigned long number;
10265796c8dcSSimon Schubert   enum bfd_architecture arch;
10275796c8dcSSimon Schubert   const char *printable_name_colon;
10285796c8dcSSimon Schubert 
10295796c8dcSSimon Schubert   /* Exact match of the architecture name (ARCH_NAME) and also the
10305796c8dcSSimon Schubert      default architecture?  */
10315796c8dcSSimon Schubert   if (strcasecmp (string, info->arch_name) == 0
10325796c8dcSSimon Schubert       && info->the_default)
10335796c8dcSSimon Schubert     return TRUE;
10345796c8dcSSimon Schubert 
10355796c8dcSSimon Schubert   /* Exact match of the machine name (PRINTABLE_NAME)?  */
10365796c8dcSSimon Schubert   if (strcasecmp (string, info->printable_name) == 0)
10375796c8dcSSimon Schubert     return TRUE;
10385796c8dcSSimon Schubert 
10395796c8dcSSimon Schubert   /* Given that printable_name contains no colon, attempt to match:
10405796c8dcSSimon Schubert      ARCH_NAME [ ":" ] PRINTABLE_NAME?  */
10415796c8dcSSimon Schubert   printable_name_colon = strchr (info->printable_name, ':');
10425796c8dcSSimon Schubert   if (printable_name_colon == NULL)
10435796c8dcSSimon Schubert     {
10445796c8dcSSimon Schubert       size_t strlen_arch_name = strlen (info->arch_name);
10455796c8dcSSimon Schubert       if (strncasecmp (string, info->arch_name, strlen_arch_name) == 0)
10465796c8dcSSimon Schubert 	{
10475796c8dcSSimon Schubert 	  if (string[strlen_arch_name] == ':')
10485796c8dcSSimon Schubert 	    {
10495796c8dcSSimon Schubert 	      if (strcasecmp (string + strlen_arch_name + 1,
10505796c8dcSSimon Schubert 			      info->printable_name) == 0)
10515796c8dcSSimon Schubert 		return TRUE;
10525796c8dcSSimon Schubert 	    }
10535796c8dcSSimon Schubert 	  else
10545796c8dcSSimon Schubert 	    {
10555796c8dcSSimon Schubert 	      if (strcasecmp (string + strlen_arch_name,
10565796c8dcSSimon Schubert 			      info->printable_name) == 0)
10575796c8dcSSimon Schubert 		return TRUE;
10585796c8dcSSimon Schubert 	    }
10595796c8dcSSimon Schubert 	}
10605796c8dcSSimon Schubert     }
10615796c8dcSSimon Schubert 
10625796c8dcSSimon Schubert   /* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>;
10635796c8dcSSimon Schubert      Attempt to match: <arch> <mach>?  */
10645796c8dcSSimon Schubert   if (printable_name_colon != NULL)
10655796c8dcSSimon Schubert     {
10665796c8dcSSimon Schubert       size_t colon_index = printable_name_colon - info->printable_name;
10675796c8dcSSimon Schubert       if (strncasecmp (string, info->printable_name, colon_index) == 0
10685796c8dcSSimon Schubert 	  && strcasecmp (string + colon_index,
10695796c8dcSSimon Schubert 			 info->printable_name + colon_index + 1) == 0)
10705796c8dcSSimon Schubert 	return TRUE;
10715796c8dcSSimon Schubert     }
10725796c8dcSSimon Schubert 
10735796c8dcSSimon Schubert   /* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>; Do not
10745796c8dcSSimon Schubert      attempt to match just <mach>, it could be ambiguous.  This test
10755796c8dcSSimon Schubert      is left until later.  */
10765796c8dcSSimon Schubert 
10775796c8dcSSimon Schubert   /* NOTE: The below is retained for compatibility only.  Please do
10785796c8dcSSimon Schubert      not add to this code.  */
10795796c8dcSSimon Schubert 
10805796c8dcSSimon Schubert   /* See how much of the supplied string matches with the
10815796c8dcSSimon Schubert      architecture, eg the string m68k:68020 would match the 68k entry
10825796c8dcSSimon Schubert      up to the :, then we get left with the machine number.  */
10835796c8dcSSimon Schubert 
10845796c8dcSSimon Schubert   for (ptr_src = string, ptr_tst = info->arch_name;
10855796c8dcSSimon Schubert        *ptr_src && *ptr_tst;
10865796c8dcSSimon Schubert        ptr_src++, ptr_tst++)
10875796c8dcSSimon Schubert     {
10885796c8dcSSimon Schubert       if (*ptr_src != *ptr_tst)
10895796c8dcSSimon Schubert 	break;
10905796c8dcSSimon Schubert     }
10915796c8dcSSimon Schubert 
10925796c8dcSSimon Schubert   /* Chewed up as much of the architecture as will match, skip any
10935796c8dcSSimon Schubert      colons.  */
10945796c8dcSSimon Schubert   if (*ptr_src == ':')
10955796c8dcSSimon Schubert     ptr_src++;
10965796c8dcSSimon Schubert 
10975796c8dcSSimon Schubert   if (*ptr_src == 0)
10985796c8dcSSimon Schubert     {
10995796c8dcSSimon Schubert       /* Nothing more, then only keep this one if it is the default
11005796c8dcSSimon Schubert 	 machine for this architecture.  */
11015796c8dcSSimon Schubert       return info->the_default;
11025796c8dcSSimon Schubert     }
11035796c8dcSSimon Schubert 
11045796c8dcSSimon Schubert   number = 0;
11055796c8dcSSimon Schubert   while (ISDIGIT (*ptr_src))
11065796c8dcSSimon Schubert     {
11075796c8dcSSimon Schubert       number = number * 10 + *ptr_src - '0';
11085796c8dcSSimon Schubert       ptr_src++;
11095796c8dcSSimon Schubert     }
11105796c8dcSSimon Schubert 
11115796c8dcSSimon Schubert   /* NOTE: The below is retained for compatibility only.
11125796c8dcSSimon Schubert      PLEASE DO NOT ADD TO THIS CODE.  */
11135796c8dcSSimon Schubert 
11145796c8dcSSimon Schubert   switch (number)
11155796c8dcSSimon Schubert     {
11165796c8dcSSimon Schubert       /* FIXME: These are needed to parse IEEE objects.  */
11175796c8dcSSimon Schubert       /* The following seven case's are here only for compatibility with
11185796c8dcSSimon Schubert 	 older binutils (at least IEEE objects from binutils 2.9.1 require
11195796c8dcSSimon Schubert 	 them).  */
11205796c8dcSSimon Schubert     case bfd_mach_m68000:
11215796c8dcSSimon Schubert     case bfd_mach_m68010:
11225796c8dcSSimon Schubert     case bfd_mach_m68020:
11235796c8dcSSimon Schubert     case bfd_mach_m68030:
11245796c8dcSSimon Schubert     case bfd_mach_m68040:
11255796c8dcSSimon Schubert     case bfd_mach_m68060:
11265796c8dcSSimon Schubert     case bfd_mach_cpu32:
11275796c8dcSSimon Schubert       arch = bfd_arch_m68k;
11285796c8dcSSimon Schubert       break;
11295796c8dcSSimon Schubert     case 68000:
11305796c8dcSSimon Schubert       arch = bfd_arch_m68k;
11315796c8dcSSimon Schubert       number = bfd_mach_m68000;
11325796c8dcSSimon Schubert       break;
11335796c8dcSSimon Schubert     case 68010:
11345796c8dcSSimon Schubert       arch = bfd_arch_m68k;
11355796c8dcSSimon Schubert       number = bfd_mach_m68010;
11365796c8dcSSimon Schubert       break;
11375796c8dcSSimon Schubert     case 68020:
11385796c8dcSSimon Schubert       arch = bfd_arch_m68k;
11395796c8dcSSimon Schubert       number = bfd_mach_m68020;
11405796c8dcSSimon Schubert       break;
11415796c8dcSSimon Schubert     case 68030:
11425796c8dcSSimon Schubert       arch = bfd_arch_m68k;
11435796c8dcSSimon Schubert       number = bfd_mach_m68030;
11445796c8dcSSimon Schubert       break;
11455796c8dcSSimon Schubert     case 68040:
11465796c8dcSSimon Schubert       arch = bfd_arch_m68k;
11475796c8dcSSimon Schubert       number = bfd_mach_m68040;
11485796c8dcSSimon Schubert       break;
11495796c8dcSSimon Schubert     case 68060:
11505796c8dcSSimon Schubert       arch = bfd_arch_m68k;
11515796c8dcSSimon Schubert       number = bfd_mach_m68060;
11525796c8dcSSimon Schubert       break;
11535796c8dcSSimon Schubert     case 68332:
11545796c8dcSSimon Schubert       arch = bfd_arch_m68k;
11555796c8dcSSimon Schubert       number = bfd_mach_cpu32;
11565796c8dcSSimon Schubert       break;
11575796c8dcSSimon Schubert     case 5200:
11585796c8dcSSimon Schubert       arch = bfd_arch_m68k;
11595796c8dcSSimon Schubert       number = bfd_mach_mcf_isa_a_nodiv;
11605796c8dcSSimon Schubert       break;
11615796c8dcSSimon Schubert     case 5206:
11625796c8dcSSimon Schubert       arch = bfd_arch_m68k;
11635796c8dcSSimon Schubert       number = bfd_mach_mcf_isa_a_mac;
11645796c8dcSSimon Schubert       break;
11655796c8dcSSimon Schubert     case 5307:
11665796c8dcSSimon Schubert       arch = bfd_arch_m68k;
11675796c8dcSSimon Schubert       number = bfd_mach_mcf_isa_a_mac;
11685796c8dcSSimon Schubert       break;
11695796c8dcSSimon Schubert     case 5407:
11705796c8dcSSimon Schubert       arch = bfd_arch_m68k;
11715796c8dcSSimon Schubert       number = bfd_mach_mcf_isa_b_nousp_mac;
11725796c8dcSSimon Schubert       break;
11735796c8dcSSimon Schubert     case 5282:
11745796c8dcSSimon Schubert       arch = bfd_arch_m68k;
11755796c8dcSSimon Schubert       number = bfd_mach_mcf_isa_aplus_emac;
11765796c8dcSSimon Schubert       break;
11775796c8dcSSimon Schubert 
11785796c8dcSSimon Schubert     case 32000:
11795796c8dcSSimon Schubert       arch = bfd_arch_we32k;
11805796c8dcSSimon Schubert       break;
11815796c8dcSSimon Schubert 
11825796c8dcSSimon Schubert     case 3000:
11835796c8dcSSimon Schubert       arch = bfd_arch_mips;
11845796c8dcSSimon Schubert       number = bfd_mach_mips3000;
11855796c8dcSSimon Schubert       break;
11865796c8dcSSimon Schubert 
11875796c8dcSSimon Schubert     case 4000:
11885796c8dcSSimon Schubert       arch = bfd_arch_mips;
11895796c8dcSSimon Schubert       number = bfd_mach_mips4000;
11905796c8dcSSimon Schubert       break;
11915796c8dcSSimon Schubert 
11925796c8dcSSimon Schubert     case 6000:
11935796c8dcSSimon Schubert       arch = bfd_arch_rs6000;
11945796c8dcSSimon Schubert       break;
11955796c8dcSSimon Schubert 
11965796c8dcSSimon Schubert     case 7410:
11975796c8dcSSimon Schubert       arch = bfd_arch_sh;
11985796c8dcSSimon Schubert       number = bfd_mach_sh_dsp;
11995796c8dcSSimon Schubert       break;
12005796c8dcSSimon Schubert 
12015796c8dcSSimon Schubert     case 7708:
12025796c8dcSSimon Schubert       arch = bfd_arch_sh;
12035796c8dcSSimon Schubert       number = bfd_mach_sh3;
12045796c8dcSSimon Schubert       break;
12055796c8dcSSimon Schubert 
12065796c8dcSSimon Schubert     case 7729:
12075796c8dcSSimon Schubert       arch = bfd_arch_sh;
12085796c8dcSSimon Schubert       number = bfd_mach_sh3_dsp;
12095796c8dcSSimon Schubert       break;
12105796c8dcSSimon Schubert 
12115796c8dcSSimon Schubert     case 7750:
12125796c8dcSSimon Schubert       arch = bfd_arch_sh;
12135796c8dcSSimon Schubert       number = bfd_mach_sh4;
12145796c8dcSSimon Schubert       break;
12155796c8dcSSimon Schubert 
12165796c8dcSSimon Schubert     default:
12175796c8dcSSimon Schubert       return FALSE;
12185796c8dcSSimon Schubert     }
12195796c8dcSSimon Schubert 
12205796c8dcSSimon Schubert   if (arch != info->arch)
12215796c8dcSSimon Schubert     return FALSE;
12225796c8dcSSimon Schubert 
12235796c8dcSSimon Schubert   if (number != info->mach)
12245796c8dcSSimon Schubert     return FALSE;
12255796c8dcSSimon Schubert 
12265796c8dcSSimon Schubert   return TRUE;
12275796c8dcSSimon Schubert }
12285796c8dcSSimon Schubert 
12295796c8dcSSimon Schubert /*
12305796c8dcSSimon Schubert FUNCTION
12315796c8dcSSimon Schubert 	bfd_get_arch_info
12325796c8dcSSimon Schubert 
12335796c8dcSSimon Schubert SYNOPSIS
12345796c8dcSSimon Schubert 	const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd);
12355796c8dcSSimon Schubert 
12365796c8dcSSimon Schubert DESCRIPTION
12375796c8dcSSimon Schubert 	Return the architecture info struct in @var{abfd}.
12385796c8dcSSimon Schubert */
12395796c8dcSSimon Schubert 
12405796c8dcSSimon Schubert const bfd_arch_info_type *
bfd_get_arch_info(bfd * abfd)12415796c8dcSSimon Schubert bfd_get_arch_info (bfd *abfd)
12425796c8dcSSimon Schubert {
12435796c8dcSSimon Schubert   return abfd->arch_info;
12445796c8dcSSimon Schubert }
12455796c8dcSSimon Schubert 
12465796c8dcSSimon Schubert /*
12475796c8dcSSimon Schubert FUNCTION
12485796c8dcSSimon Schubert 	bfd_lookup_arch
12495796c8dcSSimon Schubert 
12505796c8dcSSimon Schubert SYNOPSIS
12515796c8dcSSimon Schubert 	const bfd_arch_info_type *bfd_lookup_arch
12525796c8dcSSimon Schubert 	  (enum bfd_architecture arch, unsigned long machine);
12535796c8dcSSimon Schubert 
12545796c8dcSSimon Schubert DESCRIPTION
12555796c8dcSSimon Schubert 	Look for the architecture info structure which matches the
12565796c8dcSSimon Schubert 	arguments @var{arch} and @var{machine}. A machine of 0 matches the
12575796c8dcSSimon Schubert 	machine/architecture structure which marks itself as the
12585796c8dcSSimon Schubert 	default.
12595796c8dcSSimon Schubert */
12605796c8dcSSimon Schubert 
12615796c8dcSSimon Schubert const bfd_arch_info_type *
bfd_lookup_arch(enum bfd_architecture arch,unsigned long machine)12625796c8dcSSimon Schubert bfd_lookup_arch (enum bfd_architecture arch, unsigned long machine)
12635796c8dcSSimon Schubert {
12645796c8dcSSimon Schubert   const bfd_arch_info_type * const *app, *ap;
12655796c8dcSSimon Schubert 
12665796c8dcSSimon Schubert   for (app = bfd_archures_list; *app != NULL; app++)
12675796c8dcSSimon Schubert     {
12685796c8dcSSimon Schubert       for (ap = *app; ap != NULL; ap = ap->next)
12695796c8dcSSimon Schubert 	{
12705796c8dcSSimon Schubert 	  if (ap->arch == arch
12715796c8dcSSimon Schubert 	      && (ap->mach == machine
12725796c8dcSSimon Schubert 		  || (machine == 0 && ap->the_default)))
12735796c8dcSSimon Schubert 	    return ap;
12745796c8dcSSimon Schubert 	}
12755796c8dcSSimon Schubert     }
12765796c8dcSSimon Schubert 
12775796c8dcSSimon Schubert   return NULL;
12785796c8dcSSimon Schubert }
12795796c8dcSSimon Schubert 
12805796c8dcSSimon Schubert /*
12815796c8dcSSimon Schubert FUNCTION
12825796c8dcSSimon Schubert 	bfd_printable_arch_mach
12835796c8dcSSimon Schubert 
12845796c8dcSSimon Schubert SYNOPSIS
12855796c8dcSSimon Schubert 	const char *bfd_printable_arch_mach
12865796c8dcSSimon Schubert 	  (enum bfd_architecture arch, unsigned long machine);
12875796c8dcSSimon Schubert 
12885796c8dcSSimon Schubert DESCRIPTION
12895796c8dcSSimon Schubert 	Return a printable string representing the architecture and
12905796c8dcSSimon Schubert 	machine type.
12915796c8dcSSimon Schubert 
12925796c8dcSSimon Schubert 	This routine is depreciated.
12935796c8dcSSimon Schubert */
12945796c8dcSSimon Schubert 
12955796c8dcSSimon Schubert const char *
bfd_printable_arch_mach(enum bfd_architecture arch,unsigned long machine)12965796c8dcSSimon Schubert bfd_printable_arch_mach (enum bfd_architecture arch, unsigned long machine)
12975796c8dcSSimon Schubert {
12985796c8dcSSimon Schubert   const bfd_arch_info_type *ap = bfd_lookup_arch (arch, machine);
12995796c8dcSSimon Schubert 
13005796c8dcSSimon Schubert   if (ap)
13015796c8dcSSimon Schubert     return ap->printable_name;
13025796c8dcSSimon Schubert   return "UNKNOWN!";
13035796c8dcSSimon Schubert }
13045796c8dcSSimon Schubert 
13055796c8dcSSimon Schubert /*
13065796c8dcSSimon Schubert FUNCTION
13075796c8dcSSimon Schubert 	bfd_octets_per_byte
13085796c8dcSSimon Schubert 
13095796c8dcSSimon Schubert SYNOPSIS
13105796c8dcSSimon Schubert 	unsigned int bfd_octets_per_byte (bfd *abfd);
13115796c8dcSSimon Schubert 
13125796c8dcSSimon Schubert DESCRIPTION
13135796c8dcSSimon Schubert 	Return the number of octets (8-bit quantities) per target byte
13145796c8dcSSimon Schubert         (minimum addressable unit).  In most cases, this will be one, but some
13155796c8dcSSimon Schubert         DSP targets have 16, 32, or even 48 bits per byte.
13165796c8dcSSimon Schubert */
13175796c8dcSSimon Schubert 
13185796c8dcSSimon Schubert unsigned int
bfd_octets_per_byte(bfd * abfd)13195796c8dcSSimon Schubert bfd_octets_per_byte (bfd *abfd)
13205796c8dcSSimon Schubert {
13215796c8dcSSimon Schubert   return bfd_arch_mach_octets_per_byte (bfd_get_arch (abfd),
13225796c8dcSSimon Schubert 					bfd_get_mach (abfd));
13235796c8dcSSimon Schubert }
13245796c8dcSSimon Schubert 
13255796c8dcSSimon Schubert /*
13265796c8dcSSimon Schubert FUNCTION
13275796c8dcSSimon Schubert 	bfd_arch_mach_octets_per_byte
13285796c8dcSSimon Schubert 
13295796c8dcSSimon Schubert SYNOPSIS
13305796c8dcSSimon Schubert 	unsigned int bfd_arch_mach_octets_per_byte
13315796c8dcSSimon Schubert 	  (enum bfd_architecture arch, unsigned long machine);
13325796c8dcSSimon Schubert 
13335796c8dcSSimon Schubert DESCRIPTION
13345796c8dcSSimon Schubert 	See bfd_octets_per_byte.
13355796c8dcSSimon Schubert 
13365796c8dcSSimon Schubert         This routine is provided for those cases where a bfd * is not
13375796c8dcSSimon Schubert         available
13385796c8dcSSimon Schubert */
13395796c8dcSSimon Schubert 
13405796c8dcSSimon Schubert unsigned int
bfd_arch_mach_octets_per_byte(enum bfd_architecture arch,unsigned long mach)13415796c8dcSSimon Schubert bfd_arch_mach_octets_per_byte (enum bfd_architecture arch,
13425796c8dcSSimon Schubert 			       unsigned long mach)
13435796c8dcSSimon Schubert {
13445796c8dcSSimon Schubert   const bfd_arch_info_type *ap = bfd_lookup_arch (arch, mach);
13455796c8dcSSimon Schubert 
13465796c8dcSSimon Schubert   if (ap)
13475796c8dcSSimon Schubert     return ap->bits_per_byte / 8;
13485796c8dcSSimon Schubert   return 1;
13495796c8dcSSimon Schubert }
1350*ef5ccd6cSJohn Marino 
1351*ef5ccd6cSJohn Marino /*
1352*ef5ccd6cSJohn Marino INTERNAL_FUNCTION
1353*ef5ccd6cSJohn Marino 	bfd_arch_default_fill
1354*ef5ccd6cSJohn Marino 
1355*ef5ccd6cSJohn Marino SYNOPSIS
1356*ef5ccd6cSJohn Marino 	void *bfd_arch_default_fill (bfd_size_type count,
1357*ef5ccd6cSJohn Marino 				     bfd_boolean is_bigendian,
1358*ef5ccd6cSJohn Marino 				     bfd_boolean code);
1359*ef5ccd6cSJohn Marino 
1360*ef5ccd6cSJohn Marino DESCRIPTION
1361*ef5ccd6cSJohn Marino 	Allocate via bfd_malloc and return a fill buffer of size COUNT.
1362*ef5ccd6cSJohn Marino 	If IS_BIGENDIAN is TRUE, the order of bytes is big endian.  If
1363*ef5ccd6cSJohn Marino 	CODE is TRUE, the buffer contains code.
1364*ef5ccd6cSJohn Marino */
1365*ef5ccd6cSJohn Marino 
1366*ef5ccd6cSJohn Marino void *
bfd_arch_default_fill(bfd_size_type count,bfd_boolean is_bigendian ATTRIBUTE_UNUSED,bfd_boolean code ATTRIBUTE_UNUSED)1367*ef5ccd6cSJohn Marino bfd_arch_default_fill (bfd_size_type count,
1368*ef5ccd6cSJohn Marino 		       bfd_boolean is_bigendian ATTRIBUTE_UNUSED,
1369*ef5ccd6cSJohn Marino 		       bfd_boolean code ATTRIBUTE_UNUSED)
1370*ef5ccd6cSJohn Marino {
1371*ef5ccd6cSJohn Marino   void *fill = bfd_malloc (count);
1372*ef5ccd6cSJohn Marino   if (fill != NULL)
1373*ef5ccd6cSJohn Marino     memset (fill, 0, count);
1374*ef5ccd6cSJohn Marino   return fill;
1375*ef5ccd6cSJohn Marino }
1376