Deleted Added
full compact
archures.c (104834) archures.c (130561)
1/* BFD library support routines for architectures.
2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
1/* BFD library support routines for architectures.
2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001, 2002
3 2000, 2001, 2002, 2003
4 Free Software Foundation, Inc.
5 Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
6
4 Free Software Foundation, Inc.
5 Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
6
7This file is part of BFD, the Binary File Descriptor library.
7 This file is part of BFD, the Binary File Descriptor library.
8
8
9This program is free software; you can redistribute it and/or modify
10it under the terms of the GNU General Public License as published by
11the Free Software Foundation; either version 2 of the License, or
12(at your option) any later version.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License for more details.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
22
23#include "bfd.h"
24#include "sysdep.h"
25#include "libbfd.h"
26#include "safe-ctype.h"
27
28/*
29

--- 49 unchanged lines hidden (view full) ---

79.#define bfd_mach_m68030 5
80.#define bfd_mach_m68040 6
81.#define bfd_mach_m68060 7
82.#define bfd_mach_cpu32 8
83.#define bfd_mach_mcf5200 9
84.#define bfd_mach_mcf5206e 10
85.#define bfd_mach_mcf5307 11
86.#define bfd_mach_mcf5407 12
22
23#include "bfd.h"
24#include "sysdep.h"
25#include "libbfd.h"
26#include "safe-ctype.h"
27
28/*
29

--- 49 unchanged lines hidden (view full) ---

79.#define bfd_mach_m68030 5
80.#define bfd_mach_m68040 6
81.#define bfd_mach_m68060 7
82.#define bfd_mach_cpu32 8
83.#define bfd_mach_mcf5200 9
84.#define bfd_mach_mcf5206e 10
85.#define bfd_mach_mcf5307 11
86.#define bfd_mach_mcf5407 12
87.#define bfd_mach_mcf528x 13
87. bfd_arch_vax, {* DEC Vax *}
88. bfd_arch_i960, {* Intel 960 *}
89. {* The order of the following is important.
90. lower number indicates a machine type that
91. only accepts a subset of the instructions
92. available to machines with higher numbers.
93. The exception is the "ca", which is
94. incompatible with all other machines except

--- 29 unchanged lines hidden (view full) ---

124. && (mach) != bfd_mach_sparc_sparclite_le)
125. bfd_arch_mips, {* MIPS Rxxxx *}
126.#define bfd_mach_mips3000 3000
127.#define bfd_mach_mips3900 3900
128.#define bfd_mach_mips4000 4000
129.#define bfd_mach_mips4010 4010
130.#define bfd_mach_mips4100 4100
131.#define bfd_mach_mips4111 4111
88. bfd_arch_vax, {* DEC Vax *}
89. bfd_arch_i960, {* Intel 960 *}
90. {* The order of the following is important.
91. lower number indicates a machine type that
92. only accepts a subset of the instructions
93. available to machines with higher numbers.
94. The exception is the "ca", which is
95. incompatible with all other machines except

--- 29 unchanged lines hidden (view full) ---

125. && (mach) != bfd_mach_sparc_sparclite_le)
126. bfd_arch_mips, {* MIPS Rxxxx *}
127.#define bfd_mach_mips3000 3000
128.#define bfd_mach_mips3900 3900
129.#define bfd_mach_mips4000 4000
130.#define bfd_mach_mips4010 4010
131.#define bfd_mach_mips4100 4100
132.#define bfd_mach_mips4111 4111
133.#define bfd_mach_mips4120 4120
132.#define bfd_mach_mips4300 4300
133.#define bfd_mach_mips4400 4400
134.#define bfd_mach_mips4600 4600
135.#define bfd_mach_mips4650 4650
136.#define bfd_mach_mips5000 5000
134.#define bfd_mach_mips4300 4300
135.#define bfd_mach_mips4400 4400
136.#define bfd_mach_mips4600 4600
137.#define bfd_mach_mips4650 4650
138.#define bfd_mach_mips5000 5000
139.#define bfd_mach_mips5400 5400
140.#define bfd_mach_mips5500 5500
137.#define bfd_mach_mips6000 6000
141.#define bfd_mach_mips6000 6000
142.#define bfd_mach_mips7000 7000
138.#define bfd_mach_mips8000 8000
139.#define bfd_mach_mips10000 10000
140.#define bfd_mach_mips12000 12000
141.#define bfd_mach_mips16 16
142.#define bfd_mach_mips5 5
143.#define bfd_mach_mips_sb1 12310201 {* octal 'SB', 01 *}
144.#define bfd_mach_mipsisa32 32
143.#define bfd_mach_mips8000 8000
144.#define bfd_mach_mips10000 10000
145.#define bfd_mach_mips12000 12000
146.#define bfd_mach_mips16 16
147.#define bfd_mach_mips5 5
148.#define bfd_mach_mips_sb1 12310201 {* octal 'SB', 01 *}
149.#define bfd_mach_mipsisa32 32
150.#define bfd_mach_mipsisa32r2 33
145.#define bfd_mach_mipsisa64 64
151.#define bfd_mach_mipsisa64 64
152.#define bfd_mach_mipsisa64r2 65
146. bfd_arch_i386, {* Intel 386 *}
153. bfd_arch_i386, {* Intel 386 *}
147.#define bfd_mach_i386_i386 0
148.#define bfd_mach_i386_i8086 1
149.#define bfd_mach_i386_i386_intel_syntax 2
150.#define bfd_mach_x86_64 3
151.#define bfd_mach_x86_64_intel_syntax 4
154.#define bfd_mach_i386_i386 1
155.#define bfd_mach_i386_i8086 2
156.#define bfd_mach_i386_i386_intel_syntax 3
157.#define bfd_mach_x86_64 64
158.#define bfd_mach_x86_64_intel_syntax 65
152. bfd_arch_we32k, {* AT&T WE32xxx *}
153. bfd_arch_tahoe, {* CCI/Harris Tahoe *}
154. bfd_arch_i860, {* Intel 860 *}
155. bfd_arch_i370, {* IBM 360/370 Mainframes *}
156. bfd_arch_romp, {* IBM ROMP PC/RT *}
157. bfd_arch_alliant, {* Alliant *}
158. bfd_arch_convex, {* Convex *}
159. bfd_arch_m88k, {* Motorola 88xxx *}
159. bfd_arch_we32k, {* AT&T WE32xxx *}
160. bfd_arch_tahoe, {* CCI/Harris Tahoe *}
161. bfd_arch_i860, {* Intel 860 *}
162. bfd_arch_i370, {* IBM 360/370 Mainframes *}
163. bfd_arch_romp, {* IBM ROMP PC/RT *}
164. bfd_arch_alliant, {* Alliant *}
165. bfd_arch_convex, {* Convex *}
166. bfd_arch_m88k, {* Motorola 88xxx *}
167. bfd_arch_m98k, {* Motorola 98xxx *}
160. bfd_arch_pyramid, {* Pyramid Technology *}
168. bfd_arch_pyramid, {* Pyramid Technology *}
161. bfd_arch_h8300, {* Hitachi H8/300 *}
162.#define bfd_mach_h8300 1
163.#define bfd_mach_h8300h 2
164.#define bfd_mach_h8300s 3
169. bfd_arch_h8300, {* Renesas H8/300 (formerly Hitachi H8/300) *}
170.#define bfd_mach_h8300 1
171.#define bfd_mach_h8300h 2
172.#define bfd_mach_h8300s 3
173.#define bfd_mach_h8300hn 4
174.#define bfd_mach_h8300sn 5
175.#define bfd_mach_h8300sx 6
176.#define bfd_mach_h8300sxn 7
165. bfd_arch_pdp11, {* DEC PDP-11 *}
166. bfd_arch_powerpc, {* PowerPC *}
177. bfd_arch_pdp11, {* DEC PDP-11 *}
178. bfd_arch_powerpc, {* PowerPC *}
167.#define bfd_mach_ppc 0
168.#define bfd_mach_ppc64 1
179.#define bfd_mach_ppc 32
180.#define bfd_mach_ppc64 64
169.#define bfd_mach_ppc_403 403
170.#define bfd_mach_ppc_403gc 4030
171.#define bfd_mach_ppc_505 505
172.#define bfd_mach_ppc_601 601
173.#define bfd_mach_ppc_602 602
174.#define bfd_mach_ppc_603 603
175.#define bfd_mach_ppc_ec603e 6031
176.#define bfd_mach_ppc_604 604
177.#define bfd_mach_ppc_620 620
178.#define bfd_mach_ppc_630 630
179.#define bfd_mach_ppc_750 750
180.#define bfd_mach_ppc_860 860
181.#define bfd_mach_ppc_a35 35
182.#define bfd_mach_ppc_rs64ii 642
183.#define bfd_mach_ppc_rs64iii 643
184.#define bfd_mach_ppc_7400 7400
181.#define bfd_mach_ppc_403 403
182.#define bfd_mach_ppc_403gc 4030
183.#define bfd_mach_ppc_505 505
184.#define bfd_mach_ppc_601 601
185.#define bfd_mach_ppc_602 602
186.#define bfd_mach_ppc_603 603
187.#define bfd_mach_ppc_ec603e 6031
188.#define bfd_mach_ppc_604 604
189.#define bfd_mach_ppc_620 620
190.#define bfd_mach_ppc_630 630
191.#define bfd_mach_ppc_750 750
192.#define bfd_mach_ppc_860 860
193.#define bfd_mach_ppc_a35 35
194.#define bfd_mach_ppc_rs64ii 642
195.#define bfd_mach_ppc_rs64iii 643
196.#define bfd_mach_ppc_7400 7400
197.#define bfd_mach_ppc_e500 500
185. bfd_arch_rs6000, {* IBM RS/6000 *}
198. bfd_arch_rs6000, {* IBM RS/6000 *}
186.#define bfd_mach_rs6k 0
199.#define bfd_mach_rs6k 6000
187.#define bfd_mach_rs6k_rs1 6001
188.#define bfd_mach_rs6k_rsc 6003
189.#define bfd_mach_rs6k_rs2 6002
190. bfd_arch_hppa, {* HP PA RISC *}
200.#define bfd_mach_rs6k_rs1 6001
201.#define bfd_mach_rs6k_rsc 6003
202.#define bfd_mach_rs6k_rs2 6002
203. bfd_arch_hppa, {* HP PA RISC *}
204.#define bfd_mach_hppa10 10
205.#define bfd_mach_hppa11 11
206.#define bfd_mach_hppa20 20
207.#define bfd_mach_hppa20w 25
191. bfd_arch_d10v, {* Mitsubishi D10V *}
208. bfd_arch_d10v, {* Mitsubishi D10V *}
192.#define bfd_mach_d10v 0
209.#define bfd_mach_d10v 1
193.#define bfd_mach_d10v_ts2 2
194.#define bfd_mach_d10v_ts3 3
195. bfd_arch_d30v, {* Mitsubishi D30V *}
196. bfd_arch_dlx, {* DLX *}
197. bfd_arch_m68hc11, {* Motorola 68HC11 *}
198. bfd_arch_m68hc12, {* Motorola 68HC12 *}
210.#define bfd_mach_d10v_ts2 2
211.#define bfd_mach_d10v_ts3 3
212. bfd_arch_d30v, {* Mitsubishi D30V *}
213. bfd_arch_dlx, {* DLX *}
214. bfd_arch_m68hc11, {* Motorola 68HC11 *}
215. bfd_arch_m68hc12, {* Motorola 68HC12 *}
216.#define bfd_mach_m6812_default 0
217.#define bfd_mach_m6812 1
218.#define bfd_mach_m6812s 2
199. bfd_arch_z8k, {* Zilog Z8000 *}
200.#define bfd_mach_z8001 1
201.#define bfd_mach_z8002 2
219. bfd_arch_z8k, {* Zilog Z8000 *}
220.#define bfd_mach_z8001 1
221.#define bfd_mach_z8002 2
202. bfd_arch_h8500, {* Hitachi H8/500 *}
203. bfd_arch_sh, {* Hitachi SH *}
204.#define bfd_mach_sh 0
222. bfd_arch_h8500, {* Renesas H8/500 (formerly Hitachi H8/500) *}
223. bfd_arch_sh, {* Renesas / SuperH SH (formerly Hitachi SH) *}
224.#define bfd_mach_sh 1
205.#define bfd_mach_sh2 0x20
206.#define bfd_mach_sh_dsp 0x2d
225.#define bfd_mach_sh2 0x20
226.#define bfd_mach_sh_dsp 0x2d
227.#define bfd_mach_sh2e 0x2e
207.#define bfd_mach_sh3 0x30
208.#define bfd_mach_sh3_dsp 0x3d
209.#define bfd_mach_sh3e 0x3e
210.#define bfd_mach_sh4 0x40
228.#define bfd_mach_sh3 0x30
229.#define bfd_mach_sh3_dsp 0x3d
230.#define bfd_mach_sh3e 0x3e
231.#define bfd_mach_sh4 0x40
232.#define bfd_mach_sh4_nofpu 0x41
233.#define bfd_mach_sh4a 0x4a
234.#define bfd_mach_sh4a_nofpu 0x4b
235.#define bfd_mach_sh4al_dsp 0x4d
211.#define bfd_mach_sh5 0x50
212. bfd_arch_alpha, {* Dec Alpha *}
213.#define bfd_mach_alpha_ev4 0x10
214.#define bfd_mach_alpha_ev5 0x20
215.#define bfd_mach_alpha_ev6 0x30
216. bfd_arch_arm, {* Advanced Risc Machines ARM. *}
236.#define bfd_mach_sh5 0x50
237. bfd_arch_alpha, {* Dec Alpha *}
238.#define bfd_mach_alpha_ev4 0x10
239.#define bfd_mach_alpha_ev5 0x20
240.#define bfd_mach_alpha_ev6 0x30
241. bfd_arch_arm, {* Advanced Risc Machines ARM. *}
242.#define bfd_mach_arm_unknown 0
217.#define bfd_mach_arm_2 1
218.#define bfd_mach_arm_2a 2
219.#define bfd_mach_arm_3 3
220.#define bfd_mach_arm_3M 4
221.#define bfd_mach_arm_4 5
222.#define bfd_mach_arm_4T 6
223.#define bfd_mach_arm_5 7
224.#define bfd_mach_arm_5T 8
225.#define bfd_mach_arm_5TE 9
226.#define bfd_mach_arm_XScale 10
243.#define bfd_mach_arm_2 1
244.#define bfd_mach_arm_2a 2
245.#define bfd_mach_arm_3 3
246.#define bfd_mach_arm_3M 4
247.#define bfd_mach_arm_4 5
248.#define bfd_mach_arm_4T 6
249.#define bfd_mach_arm_5 7
250.#define bfd_mach_arm_5T 8
251.#define bfd_mach_arm_5TE 9
252.#define bfd_mach_arm_XScale 10
253.#define bfd_mach_arm_ep9312 11
254.#define bfd_mach_arm_iWMMXt 12
227. bfd_arch_ns32k, {* National Semiconductors ns32000 *}
228. bfd_arch_w65, {* WDC 65816 *}
229. bfd_arch_tic30, {* Texas Instruments TMS320C30 *}
255. bfd_arch_ns32k, {* National Semiconductors ns32000 *}
256. bfd_arch_w65, {* WDC 65816 *}
257. bfd_arch_tic30, {* Texas Instruments TMS320C30 *}
258. bfd_arch_tic4x, {* Texas Instruments TMS320C3X/4X *}
259.#define bfd_mach_tic3x 30
260.#define bfd_mach_tic4x 40
230. bfd_arch_tic54x, {* Texas Instruments TMS320C54X *}
231. bfd_arch_tic80, {* TI TMS320c80 (MVP) *}
232. bfd_arch_v850, {* NEC V850 *}
261. bfd_arch_tic54x, {* Texas Instruments TMS320C54X *}
262. bfd_arch_tic80, {* TI TMS320c80 (MVP) *}
263. bfd_arch_v850, {* NEC V850 *}
233.#define bfd_mach_v850 0
264.#define bfd_mach_v850 1
234.#define bfd_mach_v850e 'E'
265.#define bfd_mach_v850e 'E'
235.#define bfd_mach_v850ea 'A'
266.#define bfd_mach_v850e1 '1'
236. bfd_arch_arc, {* ARC Cores *}
267. bfd_arch_arc, {* ARC Cores *}
237.#define bfd_mach_arc_5 0
238.#define bfd_mach_arc_6 1
239.#define bfd_mach_arc_7 2
240.#define bfd_mach_arc_8 3
241. bfd_arch_m32r, {* Mitsubishi M32R/D *}
242.#define bfd_mach_m32r 0 {* For backwards compatibility. *}
268.#define bfd_mach_arc_5 5
269.#define bfd_mach_arc_6 6
270.#define bfd_mach_arc_7 7
271.#define bfd_mach_arc_8 8
272. bfd_arch_m32r, {* Renesas M32R (formerly Mitsubishi M32R/D) *}
273.#define bfd_mach_m32r 1 {* For backwards compatibility. *}
243.#define bfd_mach_m32rx 'x'
274.#define bfd_mach_m32rx 'x'
275.#define bfd_mach_m32r2 '2'
244. bfd_arch_mn10200, {* Matsushita MN10200 *}
245. bfd_arch_mn10300, {* Matsushita MN10300 *}
246.#define bfd_mach_mn10300 300
247.#define bfd_mach_am33 330
276. bfd_arch_mn10200, {* Matsushita MN10200 *}
277. bfd_arch_mn10300, {* Matsushita MN10300 *}
278.#define bfd_mach_mn10300 300
279.#define bfd_mach_am33 330
280.#define bfd_mach_am33_2 332
248. bfd_arch_fr30,
249.#define bfd_mach_fr30 0x46523330
250. bfd_arch_frv,
281. bfd_arch_fr30,
282.#define bfd_mach_fr30 0x46523330
283. bfd_arch_frv,
251.#define bfd_mach_frv 0
252.#define bfd_mach_frvsimple 1
284.#define bfd_mach_frv 1
285.#define bfd_mach_frvsimple 2
253.#define bfd_mach_fr300 300
254.#define bfd_mach_fr400 400
255.#define bfd_mach_frvtomcat 499 {* fr500 prototype *}
256.#define bfd_mach_fr500 500
286.#define bfd_mach_fr300 300
287.#define bfd_mach_fr400 400
288.#define bfd_mach_frvtomcat 499 {* fr500 prototype *}
289.#define bfd_mach_fr500 500
290.#define bfd_mach_fr550 550
257. bfd_arch_mcore,
258. bfd_arch_ia64, {* HP/Intel ia64 *}
291. bfd_arch_mcore,
292. bfd_arch_ia64, {* HP/Intel ia64 *}
259.#define bfd_mach_ia64_elf64 0
260.#define bfd_mach_ia64_elf32 1
293.#define bfd_mach_ia64_elf64 64
294.#define bfd_mach_ia64_elf32 32
295. bfd_arch_ip2k, {* Ubicom IP2K microcontrollers. *}
296.#define bfd_mach_ip2022 1
297.#define bfd_mach_ip2022ext 2
298. bfd_arch_iq2000, {* Vitesse IQ2000. *}
299.#define bfd_mach_iq2000 1
300.#define bfd_mach_iq10 2
261. bfd_arch_pj,
262. bfd_arch_avr, {* Atmel AVR microcontrollers. *}
263.#define bfd_mach_avr1 1
264.#define bfd_mach_avr2 2
265.#define bfd_mach_avr3 3
266.#define bfd_mach_avr4 4
267.#define bfd_mach_avr5 5
268. bfd_arch_cris, {* Axis CRIS *}
269. bfd_arch_s390, {* IBM s390 *}
301. bfd_arch_pj,
302. bfd_arch_avr, {* Atmel AVR microcontrollers. *}
303.#define bfd_mach_avr1 1
304.#define bfd_mach_avr2 2
305.#define bfd_mach_avr3 3
306.#define bfd_mach_avr4 4
307.#define bfd_mach_avr5 5
308. bfd_arch_cris, {* Axis CRIS *}
309. bfd_arch_s390, {* IBM s390 *}
270.#define bfd_mach_s390_31 0
271.#define bfd_mach_s390_64 1
310.#define bfd_mach_s390_31 31
311.#define bfd_mach_s390_64 64
272. bfd_arch_openrisc, {* OpenRISC *}
273. bfd_arch_mmix, {* Donald Knuth's educational processor. *}
274. bfd_arch_xstormy16,
312. bfd_arch_openrisc, {* OpenRISC *}
313. bfd_arch_mmix, {* Donald Knuth's educational processor. *}
314. bfd_arch_xstormy16,
275.#define bfd_mach_xstormy16 0
315.#define bfd_mach_xstormy16 1
316. bfd_arch_msp430, {* Texas Instruments MSP430 architecture. *}
317.#define bfd_mach_msp11 11
318.#define bfd_mach_msp110 110
319.#define bfd_mach_msp12 12
320.#define bfd_mach_msp13 13
321.#define bfd_mach_msp14 14
322.#define bfd_mach_msp15 15
323.#define bfd_mach_msp16 16
324.#define bfd_mach_msp31 31
325.#define bfd_mach_msp32 32
326.#define bfd_mach_msp33 33
327.#define bfd_mach_msp41 41
328.#define bfd_mach_msp42 42
329.#define bfd_mach_msp43 43
330.#define bfd_mach_msp44 44
331. bfd_arch_xtensa, {* Tensilica's Xtensa cores. *}
332.#define bfd_mach_xtensa 1
276. bfd_arch_last
277. };
278*/
279
280/*
281SUBSECTION
282 bfd_arch_info
283

--- 7 unchanged lines hidden (view full) ---

291. int bits_per_word;
292. int bits_per_address;
293. int bits_per_byte;
294. enum bfd_architecture arch;
295. unsigned long mach;
296. const char *arch_name;
297. const char *printable_name;
298. unsigned int section_align_power;
333. bfd_arch_last
334. };
335*/
336
337/*
338SUBSECTION
339 bfd_arch_info
340

--- 7 unchanged lines hidden (view full) ---

348. int bits_per_word;
349. int bits_per_address;
350. int bits_per_byte;
351. enum bfd_architecture arch;
352. unsigned long mach;
353. const char *arch_name;
354. const char *printable_name;
355. unsigned int section_align_power;
299. {* True if this is the default machine for the architecture.
356. {* TRUE if this is the default machine for the architecture.
300. The default arch should be the first entry for an arch so that
301. all the entries for that arch can be accessed via <<next>>. *}
357. The default arch should be the first entry for an arch so that
358. all the entries for that arch can be accessed via <<next>>. *}
302. boolean the_default;
359. bfd_boolean the_default;
303. const struct bfd_arch_info * (*compatible)
360. const struct bfd_arch_info * (*compatible)
304. PARAMS ((const struct bfd_arch_info *a,
305. const struct bfd_arch_info *b));
361. (const struct bfd_arch_info *a, const struct bfd_arch_info *b);
306.
362.
307. boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));
363. bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
308.
309. const struct bfd_arch_info *next;
310.}
311.bfd_arch_info_type;
312.
313*/
314
315extern const bfd_arch_info_type bfd_a29k_arch;

--- 10 unchanged lines hidden (view full) ---

326extern const bfd_arch_info_type bfd_h8300_arch;
327extern const bfd_arch_info_type bfd_h8500_arch;
328extern const bfd_arch_info_type bfd_hppa_arch;
329extern const bfd_arch_info_type bfd_i370_arch;
330extern const bfd_arch_info_type bfd_i386_arch;
331extern const bfd_arch_info_type bfd_i860_arch;
332extern const bfd_arch_info_type bfd_i960_arch;
333extern const bfd_arch_info_type bfd_ia64_arch;
364.
365. const struct bfd_arch_info *next;
366.}
367.bfd_arch_info_type;
368.
369*/
370
371extern const bfd_arch_info_type bfd_a29k_arch;

--- 10 unchanged lines hidden (view full) ---

382extern const bfd_arch_info_type bfd_h8300_arch;
383extern const bfd_arch_info_type bfd_h8500_arch;
384extern const bfd_arch_info_type bfd_hppa_arch;
385extern const bfd_arch_info_type bfd_i370_arch;
386extern const bfd_arch_info_type bfd_i386_arch;
387extern const bfd_arch_info_type bfd_i860_arch;
388extern const bfd_arch_info_type bfd_i960_arch;
389extern const bfd_arch_info_type bfd_ia64_arch;
390extern const bfd_arch_info_type bfd_ip2k_arch;
391extern const bfd_arch_info_type bfd_iq2000_arch;
334extern const bfd_arch_info_type bfd_m32r_arch;
335extern const bfd_arch_info_type bfd_m68hc11_arch;
336extern const bfd_arch_info_type bfd_m68hc12_arch;
337extern const bfd_arch_info_type bfd_m68k_arch;
338extern const bfd_arch_info_type bfd_m88k_arch;
339extern const bfd_arch_info_type bfd_mcore_arch;
340extern const bfd_arch_info_type bfd_mips_arch;
341extern const bfd_arch_info_type bfd_mmix_arch;
342extern const bfd_arch_info_type bfd_mn10200_arch;
343extern const bfd_arch_info_type bfd_mn10300_arch;
392extern const bfd_arch_info_type bfd_m32r_arch;
393extern const bfd_arch_info_type bfd_m68hc11_arch;
394extern const bfd_arch_info_type bfd_m68hc12_arch;
395extern const bfd_arch_info_type bfd_m68k_arch;
396extern const bfd_arch_info_type bfd_m88k_arch;
397extern const bfd_arch_info_type bfd_mcore_arch;
398extern const bfd_arch_info_type bfd_mips_arch;
399extern const bfd_arch_info_type bfd_mmix_arch;
400extern const bfd_arch_info_type bfd_mn10200_arch;
401extern const bfd_arch_info_type bfd_mn10300_arch;
402extern const bfd_arch_info_type bfd_msp430_arch;
344extern const bfd_arch_info_type bfd_ns32k_arch;
345extern const bfd_arch_info_type bfd_openrisc_arch;
346extern const bfd_arch_info_type bfd_or32_arch;
347extern const bfd_arch_info_type bfd_pdp11_arch;
348extern const bfd_arch_info_type bfd_pj_arch;
349extern const bfd_arch_info_type bfd_powerpc_archs[];
350#define bfd_powerpc_arch bfd_powerpc_archs[0]
351extern const bfd_arch_info_type bfd_rs6000_arch;
352extern const bfd_arch_info_type bfd_s390_arch;
353extern const bfd_arch_info_type bfd_sh_arch;
354extern const bfd_arch_info_type bfd_sparc_arch;
355extern const bfd_arch_info_type bfd_tic30_arch;
403extern const bfd_arch_info_type bfd_ns32k_arch;
404extern const bfd_arch_info_type bfd_openrisc_arch;
405extern const bfd_arch_info_type bfd_or32_arch;
406extern const bfd_arch_info_type bfd_pdp11_arch;
407extern const bfd_arch_info_type bfd_pj_arch;
408extern const bfd_arch_info_type bfd_powerpc_archs[];
409#define bfd_powerpc_arch bfd_powerpc_archs[0]
410extern const bfd_arch_info_type bfd_rs6000_arch;
411extern const bfd_arch_info_type bfd_s390_arch;
412extern const bfd_arch_info_type bfd_sh_arch;
413extern const bfd_arch_info_type bfd_sparc_arch;
414extern const bfd_arch_info_type bfd_tic30_arch;
415extern const bfd_arch_info_type bfd_tic4x_arch;
356extern const bfd_arch_info_type bfd_tic54x_arch;
357extern const bfd_arch_info_type bfd_tic80_arch;
358extern const bfd_arch_info_type bfd_v850_arch;
359extern const bfd_arch_info_type bfd_vax_arch;
360extern const bfd_arch_info_type bfd_we32k_arch;
361extern const bfd_arch_info_type bfd_w65_arch;
362extern const bfd_arch_info_type bfd_xstormy16_arch;
416extern const bfd_arch_info_type bfd_tic54x_arch;
417extern const bfd_arch_info_type bfd_tic80_arch;
418extern const bfd_arch_info_type bfd_v850_arch;
419extern const bfd_arch_info_type bfd_vax_arch;
420extern const bfd_arch_info_type bfd_we32k_arch;
421extern const bfd_arch_info_type bfd_w65_arch;
422extern const bfd_arch_info_type bfd_xstormy16_arch;
423extern const bfd_arch_info_type bfd_xtensa_arch;
363extern const bfd_arch_info_type bfd_z8k_arch;
364
365static const bfd_arch_info_type * const bfd_archures_list[] =
366 {
367#ifdef SELECT_ARCHITECTURES
368 SELECT_ARCHITECTURES,
369#else
370 &bfd_a29k_arch,

--- 10 unchanged lines hidden (view full) ---

381 &bfd_h8300_arch,
382 &bfd_h8500_arch,
383 &bfd_hppa_arch,
384 &bfd_i370_arch,
385 &bfd_i386_arch,
386 &bfd_i860_arch,
387 &bfd_i960_arch,
388 &bfd_ia64_arch,
424extern const bfd_arch_info_type bfd_z8k_arch;
425
426static const bfd_arch_info_type * const bfd_archures_list[] =
427 {
428#ifdef SELECT_ARCHITECTURES
429 SELECT_ARCHITECTURES,
430#else
431 &bfd_a29k_arch,

--- 10 unchanged lines hidden (view full) ---

442 &bfd_h8300_arch,
443 &bfd_h8500_arch,
444 &bfd_hppa_arch,
445 &bfd_i370_arch,
446 &bfd_i386_arch,
447 &bfd_i860_arch,
448 &bfd_i960_arch,
449 &bfd_ia64_arch,
450 &bfd_ip2k_arch,
451 &bfd_iq2000_arch,
389 &bfd_m32r_arch,
390 &bfd_m68hc11_arch,
391 &bfd_m68hc12_arch,
392 &bfd_m68k_arch,
393 &bfd_m88k_arch,
394 &bfd_mcore_arch,
395 &bfd_mips_arch,
396 &bfd_mmix_arch,
397 &bfd_mn10200_arch,
398 &bfd_mn10300_arch,
452 &bfd_m32r_arch,
453 &bfd_m68hc11_arch,
454 &bfd_m68hc12_arch,
455 &bfd_m68k_arch,
456 &bfd_m88k_arch,
457 &bfd_mcore_arch,
458 &bfd_mips_arch,
459 &bfd_mmix_arch,
460 &bfd_mn10200_arch,
461 &bfd_mn10300_arch,
462 &bfd_msp430_arch,
399 &bfd_ns32k_arch,
400 &bfd_openrisc_arch,
401 &bfd_or32_arch,
402 &bfd_pdp11_arch,
403 &bfd_powerpc_arch,
404 &bfd_rs6000_arch,
405 &bfd_s390_arch,
406 &bfd_sh_arch,
407 &bfd_sparc_arch,
408 &bfd_tic30_arch,
463 &bfd_ns32k_arch,
464 &bfd_openrisc_arch,
465 &bfd_or32_arch,
466 &bfd_pdp11_arch,
467 &bfd_powerpc_arch,
468 &bfd_rs6000_arch,
469 &bfd_s390_arch,
470 &bfd_sh_arch,
471 &bfd_sparc_arch,
472 &bfd_tic30_arch,
473 &bfd_tic4x_arch,
409 &bfd_tic54x_arch,
410 &bfd_tic80_arch,
411 &bfd_v850_arch,
412 &bfd_vax_arch,
413 &bfd_w65_arch,
414 &bfd_we32k_arch,
415 &bfd_xstormy16_arch,
474 &bfd_tic54x_arch,
475 &bfd_tic80_arch,
476 &bfd_v850_arch,
477 &bfd_vax_arch,
478 &bfd_w65_arch,
479 &bfd_we32k_arch,
480 &bfd_xstormy16_arch,
481 &bfd_xtensa_arch,
416 &bfd_z8k_arch,
417#endif
418 0
419};
420
421/*
422FUNCTION
423 bfd_printable_name
424
425SYNOPSIS
482 &bfd_z8k_arch,
483#endif
484 0
485};
486
487/*
488FUNCTION
489 bfd_printable_name
490
491SYNOPSIS
426 const char *bfd_printable_name(bfd *abfd);
492 const char *bfd_printable_name (bfd *abfd);
427
428DESCRIPTION
429 Return a printable string representing the architecture and machine
430 from the pointer to the architecture info structure.
431
432*/
433
434const char *
493
494DESCRIPTION
495 Return a printable string representing the architecture and machine
496 from the pointer to the architecture info structure.
497
498*/
499
500const char *
435bfd_printable_name (abfd)
436 bfd *abfd;
501bfd_printable_name (bfd *abfd)
437{
438 return abfd->arch_info->printable_name;
439}
440
441/*
442FUNCTION
443 bfd_scan_arch
444
445SYNOPSIS
502{
503 return abfd->arch_info->printable_name;
504}
505
506/*
507FUNCTION
508 bfd_scan_arch
509
510SYNOPSIS
446 const bfd_arch_info_type *bfd_scan_arch(const char *string);
511 const bfd_arch_info_type *bfd_scan_arch (const char *string);
447
448DESCRIPTION
449 Figure out if BFD supports any cpu which could be described with
450 the name @var{string}. Return a pointer to an <<arch_info>>
451 structure if a machine is found, otherwise NULL.
452*/
453
454const bfd_arch_info_type *
512
513DESCRIPTION
514 Figure out if BFD supports any cpu which could be described with
515 the name @var{string}. Return a pointer to an <<arch_info>>
516 structure if a machine is found, otherwise NULL.
517*/
518
519const bfd_arch_info_type *
455bfd_scan_arch (string)
456 const char *string;
520bfd_scan_arch (const char *string)
457{
458 const bfd_arch_info_type * const *app, *ap;
459
460 /* Look through all the installed architectures. */
461 for (app = bfd_archures_list; *app != NULL; app++)
462 {
463 for (ap = *app; ap != NULL; ap = ap->next)
464 {

--- 5 unchanged lines hidden (view full) ---

470 return NULL;
471}
472
473/*
474FUNCTION
475 bfd_arch_list
476
477SYNOPSIS
521{
522 const bfd_arch_info_type * const *app, *ap;
523
524 /* Look through all the installed architectures. */
525 for (app = bfd_archures_list; *app != NULL; app++)
526 {
527 for (ap = *app; ap != NULL; ap = ap->next)
528 {

--- 5 unchanged lines hidden (view full) ---

534 return NULL;
535}
536
537/*
538FUNCTION
539 bfd_arch_list
540
541SYNOPSIS
478 const char **bfd_arch_list(void);
542 const char **bfd_arch_list (void);
479
480DESCRIPTION
481 Return a freshly malloced NULL-terminated vector of the names
482 of all the valid BFD architectures. Do not modify the names.
483*/
484
485const char **
543
544DESCRIPTION
545 Return a freshly malloced NULL-terminated vector of the names
546 of all the valid BFD architectures. Do not modify the names.
547*/
548
549const char **
486bfd_arch_list ()
550bfd_arch_list (void)
487{
488 int vec_length = 0;
489 const char **name_ptr;
490 const char **name_list;
491 const bfd_arch_info_type * const *app;
492 bfd_size_type amt;
493
494 /* Determine the number of architectures. */
495 vec_length = 0;
496 for (app = bfd_archures_list; *app != NULL; app++)
497 {
498 const bfd_arch_info_type *ap;
499 for (ap = *app; ap != NULL; ap = ap->next)
500 {
501 vec_length++;
502 }
503 }
504
505 amt = (vec_length + 1) * sizeof (char **);
551{
552 int vec_length = 0;
553 const char **name_ptr;
554 const char **name_list;
555 const bfd_arch_info_type * const *app;
556 bfd_size_type amt;
557
558 /* Determine the number of architectures. */
559 vec_length = 0;
560 for (app = bfd_archures_list; *app != NULL; app++)
561 {
562 const bfd_arch_info_type *ap;
563 for (ap = *app; ap != NULL; ap = ap->next)
564 {
565 vec_length++;
566 }
567 }
568
569 amt = (vec_length + 1) * sizeof (char **);
506 name_list = (const char **) bfd_malloc (amt);
570 name_list = bfd_malloc (amt);
507 if (name_list == NULL)
508 return NULL;
509
510 /* Point the list at each of the names. */
511 name_ptr = name_list;
512 for (app = bfd_archures_list; *app != NULL; app++)
513 {
514 const bfd_arch_info_type *ap;

--- 8 unchanged lines hidden (view full) ---

523 return name_list;
524}
525
526/*
527FUNCTION
528 bfd_arch_get_compatible
529
530SYNOPSIS
571 if (name_list == NULL)
572 return NULL;
573
574 /* Point the list at each of the names. */
575 name_ptr = name_list;
576 for (app = bfd_archures_list; *app != NULL; app++)
577 {
578 const bfd_arch_info_type *ap;

--- 8 unchanged lines hidden (view full) ---

587 return name_list;
588}
589
590/*
591FUNCTION
592 bfd_arch_get_compatible
593
594SYNOPSIS
531 const bfd_arch_info_type *bfd_arch_get_compatible(
532 const bfd *abfd,
533 const bfd *bbfd);
595 const bfd_arch_info_type *bfd_arch_get_compatible
596 (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns);
534
535DESCRIPTION
597
598DESCRIPTION
536 Determine whether two BFDs'
537 architectures and machine types are compatible. Calculates
538 the lowest common denominator between the two architectures
539 and machine types implied by the BFDs and returns a pointer to
540 an <<arch_info>> structure describing the compatible machine.
599 Determine whether two BFDs' architectures and machine types
600 are compatible. Calculates the lowest common denominator
601 between the two architectures and machine types implied by
602 the BFDs and returns a pointer to an <<arch_info>> structure
603 describing the compatible machine.
541*/
542
543const bfd_arch_info_type *
604*/
605
606const bfd_arch_info_type *
544bfd_arch_get_compatible (abfd, bbfd)
545 const bfd *abfd;
546 const bfd *bbfd;
607bfd_arch_get_compatible (const bfd *abfd,
608 const bfd *bbfd,
609 bfd_boolean accept_unknowns)
547{
610{
548 /* If either architecture is unknown, then all we can do is assume
549 the user knows what he's doing. */
550 if (abfd->arch_info->arch == bfd_arch_unknown)
551 return bbfd->arch_info;
552 if (bbfd->arch_info->arch == bfd_arch_unknown)
553 return abfd->arch_info;
611 const bfd * ubfd = NULL;
554
612
613 /* Look for an unknown architecture. */
614 if (((ubfd = abfd) && ubfd->arch_info->arch == bfd_arch_unknown)
615 || ((ubfd = bbfd) && ubfd->arch_info->arch == bfd_arch_unknown))
616 {
617 /* We can allow an unknown architecture if accept_unknowns
618 is true, or if the target is the "binary" format, which
619 has an unknown architecture. Since the binary format can
620 only be set by explicit request from the user, it is safe
621 to assume that they know what they are doing. */
622 if (accept_unknowns
623 || strcmp (bfd_get_target (ubfd), "binary") == 0)
624 return ubfd->arch_info;
625 return NULL;
626 }
627
555 /* Otherwise architecture-specific code has to decide. */
556 return abfd->arch_info->compatible (abfd->arch_info, bbfd->arch_info);
557}
558
559/*
560INTERNAL_DEFINITION
561 bfd_default_arch_struct
562
563DESCRIPTION
564 The <<bfd_default_arch_struct>> is an item of
565 <<bfd_arch_info_type>> which has been initialized to a fairly
566 generic state. A BFD starts life by pointing to this
567 structure, until the correct back end has determined the real
568 architecture of the file.
569
570.extern const bfd_arch_info_type bfd_default_arch_struct;
571*/
572
573const bfd_arch_info_type bfd_default_arch_struct = {
628 /* Otherwise architecture-specific code has to decide. */
629 return abfd->arch_info->compatible (abfd->arch_info, bbfd->arch_info);
630}
631
632/*
633INTERNAL_DEFINITION
634 bfd_default_arch_struct
635
636DESCRIPTION
637 The <<bfd_default_arch_struct>> is an item of
638 <<bfd_arch_info_type>> which has been initialized to a fairly
639 generic state. A BFD starts life by pointing to this
640 structure, until the correct back end has determined the real
641 architecture of the file.
642
643.extern const bfd_arch_info_type bfd_default_arch_struct;
644*/
645
646const bfd_arch_info_type bfd_default_arch_struct = {
574 32, 32, 8, bfd_arch_unknown, 0, "unknown", "unknown", 2, true,
647 32, 32, 8, bfd_arch_unknown, 0, "unknown", "unknown", 2, TRUE,
575 bfd_default_compatible,
576 bfd_default_scan,
577 0,
578};
579
580/*
581FUNCTION
582 bfd_set_arch_info
583
584SYNOPSIS
648 bfd_default_compatible,
649 bfd_default_scan,
650 0,
651};
652
653/*
654FUNCTION
655 bfd_set_arch_info
656
657SYNOPSIS
585 void bfd_set_arch_info(bfd *abfd, const bfd_arch_info_type *arg);
658 void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg);
586
587DESCRIPTION
588 Set the architecture info of @var{abfd} to @var{arg}.
589*/
590
591void
659
660DESCRIPTION
661 Set the architecture info of @var{abfd} to @var{arg}.
662*/
663
664void
592bfd_set_arch_info (abfd, arg)
593 bfd *abfd;
594 const bfd_arch_info_type *arg;
665bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg)
595{
596 abfd->arch_info = arg;
597}
598
599/*
600INTERNAL_FUNCTION
601 bfd_default_set_arch_mach
602
603SYNOPSIS
666{
667 abfd->arch_info = arg;
668}
669
670/*
671INTERNAL_FUNCTION
672 bfd_default_set_arch_mach
673
674SYNOPSIS
604 boolean bfd_default_set_arch_mach(bfd *abfd,
605 enum bfd_architecture arch,
606 unsigned long mach);
675 bfd_boolean bfd_default_set_arch_mach
676 (bfd *abfd, enum bfd_architecture arch, unsigned long mach);
607
608DESCRIPTION
609 Set the architecture and machine type in BFD @var{abfd}
610 to @var{arch} and @var{mach}. Find the correct
611 pointer to a structure and insert it into the <<arch_info>>
612 pointer.
613*/
614
677
678DESCRIPTION
679 Set the architecture and machine type in BFD @var{abfd}
680 to @var{arch} and @var{mach}. Find the correct
681 pointer to a structure and insert it into the <<arch_info>>
682 pointer.
683*/
684
615boolean
616bfd_default_set_arch_mach (abfd, arch, mach)
617 bfd *abfd;
618 enum bfd_architecture arch;
619 unsigned long mach;
685bfd_boolean
686bfd_default_set_arch_mach (bfd *abfd,
687 enum bfd_architecture arch,
688 unsigned long mach)
620{
621 abfd->arch_info = bfd_lookup_arch (arch, mach);
622 if (abfd->arch_info != NULL)
689{
690 abfd->arch_info = bfd_lookup_arch (arch, mach);
691 if (abfd->arch_info != NULL)
623 return true;
692 return TRUE;
624
625 abfd->arch_info = &bfd_default_arch_struct;
626 bfd_set_error (bfd_error_bad_value);
693
694 abfd->arch_info = &bfd_default_arch_struct;
695 bfd_set_error (bfd_error_bad_value);
627 return false;
696 return FALSE;
628}
629
630/*
631FUNCTION
632 bfd_get_arch
633
634SYNOPSIS
697}
698
699/*
700FUNCTION
701 bfd_get_arch
702
703SYNOPSIS
635 enum bfd_architecture bfd_get_arch(bfd *abfd);
704 enum bfd_architecture bfd_get_arch (bfd *abfd);
636
637DESCRIPTION
638 Return the enumerated type which describes the BFD @var{abfd}'s
639 architecture.
640*/
641
642enum bfd_architecture
705
706DESCRIPTION
707 Return the enumerated type which describes the BFD @var{abfd}'s
708 architecture.
709*/
710
711enum bfd_architecture
643bfd_get_arch (abfd)
644 bfd *abfd;
712bfd_get_arch (bfd *abfd)
645{
646 return abfd->arch_info->arch;
647}
648
649/*
650FUNCTION
651 bfd_get_mach
652
653SYNOPSIS
713{
714 return abfd->arch_info->arch;
715}
716
717/*
718FUNCTION
719 bfd_get_mach
720
721SYNOPSIS
654 unsigned long bfd_get_mach(bfd *abfd);
722 unsigned long bfd_get_mach (bfd *abfd);
655
656DESCRIPTION
657 Return the long type which describes the BFD @var{abfd}'s
658 machine.
659*/
660
661unsigned long
723
724DESCRIPTION
725 Return the long type which describes the BFD @var{abfd}'s
726 machine.
727*/
728
729unsigned long
662bfd_get_mach (abfd)
663 bfd *abfd;
730bfd_get_mach (bfd *abfd)
664{
665 return abfd->arch_info->mach;
666}
667
668/*
669FUNCTION
670 bfd_arch_bits_per_byte
671
672SYNOPSIS
731{
732 return abfd->arch_info->mach;
733}
734
735/*
736FUNCTION
737 bfd_arch_bits_per_byte
738
739SYNOPSIS
673 unsigned int bfd_arch_bits_per_byte(bfd *abfd);
740 unsigned int bfd_arch_bits_per_byte (bfd *abfd);
674
675DESCRIPTION
676 Return the number of bits in one of the BFD @var{abfd}'s
677 architecture's bytes.
678*/
679
680unsigned int
741
742DESCRIPTION
743 Return the number of bits in one of the BFD @var{abfd}'s
744 architecture's bytes.
745*/
746
747unsigned int
681bfd_arch_bits_per_byte (abfd)
682 bfd *abfd;
748bfd_arch_bits_per_byte (bfd *abfd)
683{
684 return abfd->arch_info->bits_per_byte;
685}
686
687/*
688FUNCTION
689 bfd_arch_bits_per_address
690
691SYNOPSIS
749{
750 return abfd->arch_info->bits_per_byte;
751}
752
753/*
754FUNCTION
755 bfd_arch_bits_per_address
756
757SYNOPSIS
692 unsigned int bfd_arch_bits_per_address(bfd *abfd);
758 unsigned int bfd_arch_bits_per_address (bfd *abfd);
693
694DESCRIPTION
695 Return the number of bits in one of the BFD @var{abfd}'s
696 architecture's addresses.
697*/
698
699unsigned int
759
760DESCRIPTION
761 Return the number of bits in one of the BFD @var{abfd}'s
762 architecture's addresses.
763*/
764
765unsigned int
700bfd_arch_bits_per_address (abfd)
701 bfd *abfd;
766bfd_arch_bits_per_address (bfd *abfd)
702{
703 return abfd->arch_info->bits_per_address;
704}
705
706/*
707INTERNAL_FUNCTION
708 bfd_default_compatible
709
710SYNOPSIS
711 const bfd_arch_info_type *bfd_default_compatible
767{
768 return abfd->arch_info->bits_per_address;
769}
770
771/*
772INTERNAL_FUNCTION
773 bfd_default_compatible
774
775SYNOPSIS
776 const bfd_arch_info_type *bfd_default_compatible
712 (const bfd_arch_info_type *a,
713 const bfd_arch_info_type *b);
777 (const bfd_arch_info_type *a, const bfd_arch_info_type *b);
714
715DESCRIPTION
716 The default function for testing for compatibility.
717*/
718
719const bfd_arch_info_type *
778
779DESCRIPTION
780 The default function for testing for compatibility.
781*/
782
783const bfd_arch_info_type *
720bfd_default_compatible (a, b)
721 const bfd_arch_info_type *a;
722 const bfd_arch_info_type *b;
784bfd_default_compatible (const bfd_arch_info_type *a,
785 const bfd_arch_info_type *b)
723{
724 if (a->arch != b->arch)
725 return NULL;
726
727 if (a->bits_per_word != b->bits_per_word)
728 return NULL;
729
730 if (a->mach > b->mach)

--- 5 unchanged lines hidden (view full) ---

736 return a;
737}
738
739/*
740INTERNAL_FUNCTION
741 bfd_default_scan
742
743SYNOPSIS
786{
787 if (a->arch != b->arch)
788 return NULL;
789
790 if (a->bits_per_word != b->bits_per_word)
791 return NULL;
792
793 if (a->mach > b->mach)

--- 5 unchanged lines hidden (view full) ---

799 return a;
800}
801
802/*
803INTERNAL_FUNCTION
804 bfd_default_scan
805
806SYNOPSIS
744 boolean bfd_default_scan(const struct bfd_arch_info *info, const char *string);
807 bfd_boolean bfd_default_scan
808 (const struct bfd_arch_info *info, const char *string);
745
746DESCRIPTION
747 The default function for working out whether this is an
748 architecture hit and a machine hit.
749*/
750
809
810DESCRIPTION
811 The default function for working out whether this is an
812 architecture hit and a machine hit.
813*/
814
751boolean
752bfd_default_scan (info, string)
753 const bfd_arch_info_type *info;
754 const char *string;
815bfd_boolean
816bfd_default_scan (const bfd_arch_info_type *info, const char *string)
755{
756 const char *ptr_src;
757 const char *ptr_tst;
758 unsigned long number;
759 enum bfd_architecture arch;
760 const char *printable_name_colon;
761
762 /* Exact match of the architecture name (ARCH_NAME) and also the
763 default architecture? */
764 if (strcasecmp (string, info->arch_name) == 0
765 && info->the_default)
817{
818 const char *ptr_src;
819 const char *ptr_tst;
820 unsigned long number;
821 enum bfd_architecture arch;
822 const char *printable_name_colon;
823
824 /* Exact match of the architecture name (ARCH_NAME) and also the
825 default architecture? */
826 if (strcasecmp (string, info->arch_name) == 0
827 && info->the_default)
766 return true;
828 return TRUE;
767
768 /* Exact match of the machine name (PRINTABLE_NAME)? */
769 if (strcasecmp (string, info->printable_name) == 0)
829
830 /* Exact match of the machine name (PRINTABLE_NAME)? */
831 if (strcasecmp (string, info->printable_name) == 0)
770 return true;
832 return TRUE;
771
772 /* Given that printable_name contains no colon, attempt to match:
773 ARCH_NAME [ ":" ] PRINTABLE_NAME? */
774 printable_name_colon = strchr (info->printable_name, ':');
775 if (printable_name_colon == NULL)
776 {
777 size_t strlen_arch_name = strlen (info->arch_name);
778 if (strncasecmp (string, info->arch_name, strlen_arch_name) == 0)
779 {
780 if (string[strlen_arch_name] == ':')
781 {
782 if (strcasecmp (string + strlen_arch_name + 1,
783 info->printable_name) == 0)
833
834 /* Given that printable_name contains no colon, attempt to match:
835 ARCH_NAME [ ":" ] PRINTABLE_NAME? */
836 printable_name_colon = strchr (info->printable_name, ':');
837 if (printable_name_colon == NULL)
838 {
839 size_t strlen_arch_name = strlen (info->arch_name);
840 if (strncasecmp (string, info->arch_name, strlen_arch_name) == 0)
841 {
842 if (string[strlen_arch_name] == ':')
843 {
844 if (strcasecmp (string + strlen_arch_name + 1,
845 info->printable_name) == 0)
784 return true;
846 return TRUE;
785 }
786 else
787 {
788 if (strcasecmp (string + strlen_arch_name,
789 info->printable_name) == 0)
847 }
848 else
849 {
850 if (strcasecmp (string + strlen_arch_name,
851 info->printable_name) == 0)
790 return true;
852 return TRUE;
791 }
792 }
793 }
794
795 /* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>;
796 Attempt to match: <arch> <mach>? */
797 if (printable_name_colon != NULL)
798 {
799 size_t colon_index = printable_name_colon - info->printable_name;
800 if (strncasecmp (string, info->printable_name, colon_index) == 0
801 && strcasecmp (string + colon_index,
802 info->printable_name + colon_index + 1) == 0)
853 }
854 }
855 }
856
857 /* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>;
858 Attempt to match: <arch> <mach>? */
859 if (printable_name_colon != NULL)
860 {
861 size_t colon_index = printable_name_colon - info->printable_name;
862 if (strncasecmp (string, info->printable_name, colon_index) == 0
863 && strcasecmp (string + colon_index,
864 info->printable_name + colon_index + 1) == 0)
803 return true;
865 return TRUE;
804 }
805
806 /* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>; Do not
866 }
867
868 /* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>; Do not
807 attempt to match just <mach>, it could be ambigious. This test
869 attempt to match just <mach>, it could be ambiguous. This test
808 is left until later. */
809
810 /* NOTE: The below is retained for compatibility only. Please do
811 not add to this code. */
812
813 /* See how much of the supplied string matches with the
814 architecture, eg the string m68k:68020 would match the 68k entry
815 up to the :, then we get left with the machine number. */

--- 82 unchanged lines hidden (view full) ---

898 case 5307:
899 arch = bfd_arch_m68k;
900 number = bfd_mach_mcf5307;
901 break;
902 case 5407:
903 arch = bfd_arch_m68k;
904 number = bfd_mach_mcf5407;
905 break;
870 is left until later. */
871
872 /* NOTE: The below is retained for compatibility only. Please do
873 not add to this code. */
874
875 /* See how much of the supplied string matches with the
876 architecture, eg the string m68k:68020 would match the 68k entry
877 up to the :, then we get left with the machine number. */

--- 82 unchanged lines hidden (view full) ---

960 case 5307:
961 arch = bfd_arch_m68k;
962 number = bfd_mach_mcf5307;
963 break;
964 case 5407:
965 arch = bfd_arch_m68k;
966 number = bfd_mach_mcf5407;
967 break;
968 case 5282:
969 arch = bfd_arch_m68k;
970 number = bfd_mach_mcf528x;
971 break;
906
907 case 32000:
908 arch = bfd_arch_we32k;
909 break;
910
911 case 3000:
912 arch = bfd_arch_mips;
913 number = bfd_mach_mips3000;

--- 24 unchanged lines hidden (view full) ---

938 break;
939
940 case 7750:
941 arch = bfd_arch_sh;
942 number = bfd_mach_sh4;
943 break;
944
945 default:
972
973 case 32000:
974 arch = bfd_arch_we32k;
975 break;
976
977 case 3000:
978 arch = bfd_arch_mips;
979 number = bfd_mach_mips3000;

--- 24 unchanged lines hidden (view full) ---

1004 break;
1005
1006 case 7750:
1007 arch = bfd_arch_sh;
1008 number = bfd_mach_sh4;
1009 break;
1010
1011 default:
946 return false;
1012 return FALSE;
947 }
948
949 if (arch != info->arch)
1013 }
1014
1015 if (arch != info->arch)
950 return false;
1016 return FALSE;
951
952 if (number != info->mach)
1017
1018 if (number != info->mach)
953 return false;
1019 return FALSE;
954
1020
955 return true;
1021 return TRUE;
956}
957
958/*
959FUNCTION
960 bfd_get_arch_info
961
962SYNOPSIS
1022}
1023
1024/*
1025FUNCTION
1026 bfd_get_arch_info
1027
1028SYNOPSIS
963 const bfd_arch_info_type * bfd_get_arch_info(bfd *abfd);
1029 const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd);
964
965DESCRIPTION
966 Return the architecture info struct in @var{abfd}.
967*/
968
969const bfd_arch_info_type *
1030
1031DESCRIPTION
1032 Return the architecture info struct in @var{abfd}.
1033*/
1034
1035const bfd_arch_info_type *
970bfd_get_arch_info (abfd)
971 bfd *abfd;
1036bfd_get_arch_info (bfd *abfd)
972{
973 return abfd->arch_info;
974}
975
976/*
977FUNCTION
978 bfd_lookup_arch
979
980SYNOPSIS
981 const bfd_arch_info_type *bfd_lookup_arch
1037{
1038 return abfd->arch_info;
1039}
1040
1041/*
1042FUNCTION
1043 bfd_lookup_arch
1044
1045SYNOPSIS
1046 const bfd_arch_info_type *bfd_lookup_arch
982 (enum bfd_architecture
983 arch,
984 unsigned long machine);
1047 (enum bfd_architecture arch, unsigned long machine);
985
986DESCRIPTION
1048
1049DESCRIPTION
987 Look for the architecure info structure which matches the
1050 Look for the architecture info structure which matches the
988 arguments @var{arch} and @var{machine}. A machine of 0 matches the
989 machine/architecture structure which marks itself as the
990 default.
991*/
992
993const bfd_arch_info_type *
1051 arguments @var{arch} and @var{machine}. A machine of 0 matches the
1052 machine/architecture structure which marks itself as the
1053 default.
1054*/
1055
1056const bfd_arch_info_type *
994bfd_lookup_arch (arch, machine)
995 enum bfd_architecture arch;
996 unsigned long machine;
1057bfd_lookup_arch (enum bfd_architecture arch, unsigned long machine)
997{
998 const bfd_arch_info_type * const *app, *ap;
999
1000 for (app = bfd_archures_list; *app != NULL; app++)
1001 {
1002 for (ap = *app; ap != NULL; ap = ap->next)
1003 {
1004 if (ap->arch == arch

--- 7 unchanged lines hidden (view full) ---

1012}
1013
1014/*
1015FUNCTION
1016 bfd_printable_arch_mach
1017
1018SYNOPSIS
1019 const char *bfd_printable_arch_mach
1058{
1059 const bfd_arch_info_type * const *app, *ap;
1060
1061 for (app = bfd_archures_list; *app != NULL; app++)
1062 {
1063 for (ap = *app; ap != NULL; ap = ap->next)
1064 {
1065 if (ap->arch == arch

--- 7 unchanged lines hidden (view full) ---

1073}
1074
1075/*
1076FUNCTION
1077 bfd_printable_arch_mach
1078
1079SYNOPSIS
1080 const char *bfd_printable_arch_mach
1020 (enum bfd_architecture arch, unsigned long machine);
1081 (enum bfd_architecture arch, unsigned long machine);
1021
1022DESCRIPTION
1023 Return a printable string representing the architecture and
1024 machine type.
1025
1026 This routine is depreciated.
1027*/
1028
1029const char *
1082
1083DESCRIPTION
1084 Return a printable string representing the architecture and
1085 machine type.
1086
1087 This routine is depreciated.
1088*/
1089
1090const char *
1030bfd_printable_arch_mach (arch, machine)
1031 enum bfd_architecture arch;
1032 unsigned long machine;
1091bfd_printable_arch_mach (enum bfd_architecture arch, unsigned long machine)
1033{
1034 const bfd_arch_info_type *ap = bfd_lookup_arch (arch, machine);
1035
1036 if (ap)
1037 return ap->printable_name;
1038 return "UNKNOWN!";
1039}
1040
1041/*
1042FUNCTION
1043 bfd_octets_per_byte
1044
1045SYNOPSIS
1092{
1093 const bfd_arch_info_type *ap = bfd_lookup_arch (arch, machine);
1094
1095 if (ap)
1096 return ap->printable_name;
1097 return "UNKNOWN!";
1098}
1099
1100/*
1101FUNCTION
1102 bfd_octets_per_byte
1103
1104SYNOPSIS
1046 unsigned int bfd_octets_per_byte(bfd *abfd);
1105 unsigned int bfd_octets_per_byte (bfd *abfd);
1047
1048DESCRIPTION
1049 Return the number of octets (8-bit quantities) per target byte
1050 (minimum addressable unit). In most cases, this will be one, but some
1051 DSP targets have 16, 32, or even 48 bits per byte.
1052*/
1053
1054unsigned int
1106
1107DESCRIPTION
1108 Return the number of octets (8-bit quantities) per target byte
1109 (minimum addressable unit). In most cases, this will be one, but some
1110 DSP targets have 16, 32, or even 48 bits per byte.
1111*/
1112
1113unsigned int
1055bfd_octets_per_byte (abfd)
1056 bfd *abfd;
1114bfd_octets_per_byte (bfd *abfd)
1057{
1058 return bfd_arch_mach_octets_per_byte (bfd_get_arch (abfd),
1059 bfd_get_mach (abfd));
1060}
1061
1062/*
1063FUNCTION
1064 bfd_arch_mach_octets_per_byte
1065
1066SYNOPSIS
1115{
1116 return bfd_arch_mach_octets_per_byte (bfd_get_arch (abfd),
1117 bfd_get_mach (abfd));
1118}
1119
1120/*
1121FUNCTION
1122 bfd_arch_mach_octets_per_byte
1123
1124SYNOPSIS
1067 unsigned int bfd_arch_mach_octets_per_byte(enum bfd_architecture arch,
1068 unsigned long machine);
1125 unsigned int bfd_arch_mach_octets_per_byte
1126 (enum bfd_architecture arch, unsigned long machine);
1069
1070DESCRIPTION
1071 See bfd_octets_per_byte.
1072
1073 This routine is provided for those cases where a bfd * is not
1074 available
1075*/
1076
1077unsigned int
1127
1128DESCRIPTION
1129 See bfd_octets_per_byte.
1130
1131 This routine is provided for those cases where a bfd * is not
1132 available
1133*/
1134
1135unsigned int
1078bfd_arch_mach_octets_per_byte (arch, mach)
1079 enum bfd_architecture arch;
1080 unsigned long mach;
1136bfd_arch_mach_octets_per_byte (enum bfd_architecture arch,
1137 unsigned long mach)
1081{
1082 const bfd_arch_info_type *ap = bfd_lookup_arch (arch, mach);
1083
1084 if (ap)
1085 return ap->bits_per_byte / 8;
1086 return 1;
1087}
1138{
1139 const bfd_arch_info_type *ap = bfd_lookup_arch (arch, mach);
1140
1141 if (ap)
1142 return ap->bits_per_byte / 8;
1143 return 1;
1144}