Changeset 609 for branches/GNU/src/binutils/bfd/archures.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/bfd/archures.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* BFD library support routines for architectures. 2 2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 3 2000, 2001 3 2000, 2001, 2002, 2003 4 4 Free Software Foundation, Inc. 5 5 Hacked by John Gilmore and Steve Chamberlain of Cygnus Support. 6 6 7 This file is part of BFD, the Binary File Descriptor library.8 9 This program is free software; you can redistribute it and/or modify10 it under the terms of the GNU General Public License as published by11 the Free Software Foundation; either version 2 of the License, or12 (at your option) any later version.13 14 This program is distributed in the hope that it will be useful,15 but WITHOUT ANY WARRANTY; without even the implied warranty of16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 GNU General Public License for more details.18 19 You should have received a copy of the GNU General Public License20 along with this program; if not, write to the Free Software21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */7 This file is part of BFD, the Binary File Descriptor library. 8 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 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 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 22 23 23 #include "bfd.h" 24 24 #include "sysdep.h" 25 25 #include "libbfd.h" 26 #include <ctype.h>26 #include "safe-ctype.h" 27 27 28 28 /* … … 70 70 .enum bfd_architecture 71 71 .{ 72 . bfd_arch_unknown, {* File arch not known *}73 . bfd_arch_obscure, {* Arch known, not one of these *}72 . bfd_arch_unknown, {* File arch not known. *} 73 . bfd_arch_obscure, {* Arch known, not one of these. *} 74 74 . bfd_arch_m68k, {* Motorola 68xxx *} 75 75 .#define bfd_mach_m68000 1 … … 93 93 . The exception is the "ca", which is 94 94 . incompatible with all other machines except 95 . "core". *}95 . "core". *} 96 96 . 97 97 .#define bfd_mach_i960_core 1 … … 104 104 .#define bfd_mach_i960_hx 8 105 105 . 106 . bfd_arch_or32, {* OpenRISC 32 *} 107 . 106 108 . bfd_arch_a29k, {* AMD 29000 *} 107 109 . bfd_arch_sparc, {* SPARC *} … … 111 113 .#define bfd_mach_sparc_sparclite 3 112 114 .#define bfd_mach_sparc_v8plus 4 113 .#define bfd_mach_sparc_v8plusa 5 {* with ultrasparc add'ns *}115 .#define bfd_mach_sparc_v8plusa 5 {* with ultrasparc add'ns. *} 114 116 .#define bfd_mach_sparc_sparclite_le 6 115 117 .#define bfd_mach_sparc_v9 7 116 .#define bfd_mach_sparc_v9a 8 {* with ultrasparc add'ns *}117 .#define bfd_mach_sparc_v8plusb 9 {* with cheetah add'ns *}118 .#define bfd_mach_sparc_v9b 10 {* with cheetah add'ns *}118 .#define bfd_mach_sparc_v9a 8 {* with ultrasparc add'ns. *} 119 .#define bfd_mach_sparc_v8plusb 9 {* with cheetah add'ns. *} 120 .#define bfd_mach_sparc_v9b 10 {* with cheetah add'ns. *} 119 121 .{* Nonzero if MACH has the v9 instruction set. *} 120 122 .#define bfd_mach_sparc_v9_p(mach) \ … … 128 130 .#define bfd_mach_mips4100 4100 129 131 .#define bfd_mach_mips4111 4111 132 .#define bfd_mach_mips4120 4120 130 133 .#define bfd_mach_mips4300 4300 131 134 .#define bfd_mach_mips4400 4400 … … 133 136 .#define bfd_mach_mips4650 4650 134 137 .#define bfd_mach_mips5000 5000 138 .#define bfd_mach_mips5400 5400 139 .#define bfd_mach_mips5500 5500 135 140 .#define bfd_mach_mips6000 6000 136 141 .#define bfd_mach_mips8000 8000 … … 138 143 .#define bfd_mach_mips12000 12000 139 144 .#define bfd_mach_mips16 16 140 .#define bfd_mach_mips32 32141 .#define bfd_mach_mips32_4k 3204113 {* 32, 04, octal 'K' *}142 145 .#define bfd_mach_mips5 5 143 .#define bfd_mach_mips64 64144 146 .#define bfd_mach_mips_sb1 12310201 {* octal 'SB', 01 *} 147 .#define bfd_mach_mipsisa32 32 148 .#define bfd_mach_mipsisa32r2 33 149 .#define bfd_mach_mipsisa64 64 145 150 . bfd_arch_i386, {* Intel 386 *} 146 .#define bfd_mach_i386_i386 0147 .#define bfd_mach_i386_i8086 1148 .#define bfd_mach_i386_i386_intel_syntax 2149 .#define bfd_mach_x86_64 3150 .#define bfd_mach_x86_64_intel_syntax 4151 .#define bfd_mach_i386_i386 1 152 .#define bfd_mach_i386_i8086 2 153 .#define bfd_mach_i386_i386_intel_syntax 3 154 .#define bfd_mach_x86_64 64 155 .#define bfd_mach_x86_64_intel_syntax 65 151 156 . bfd_arch_we32k, {* AT&T WE32xxx *} 152 157 . bfd_arch_tahoe, {* CCI/Harris Tahoe *} … … 157 162 . bfd_arch_convex, {* Convex *} 158 163 . bfd_arch_m88k, {* Motorola 88xxx *} 164 . bfd_arch_m98k, {* Motorola 98xxx *} 159 165 . bfd_arch_pyramid, {* Pyramid Technology *} 160 . bfd_arch_h8300, {* Hitachi H8/300 *} 161 .#define bfd_mach_h8300 1 162 .#define bfd_mach_h8300h 2 163 .#define bfd_mach_h8300s 3 166 . bfd_arch_h8300, {* Renesas H8/300 (formerly Hitachi H8/300) *} 167 .#define bfd_mach_h8300 1 168 .#define bfd_mach_h8300h 2 169 .#define bfd_mach_h8300s 3 170 .#define bfd_mach_h8300hn 4 171 .#define bfd_mach_h8300sn 5 172 . bfd_arch_pdp11, {* DEC PDP-11 *} 164 173 . bfd_arch_powerpc, {* PowerPC *} 165 .#define bfd_mach_ppc 0 174 .#define bfd_mach_ppc 32 175 .#define bfd_mach_ppc64 64 166 176 .#define bfd_mach_ppc_403 403 167 177 .#define bfd_mach_ppc_403gc 4030 … … 180 190 .#define bfd_mach_ppc_rs64iii 643 181 191 .#define bfd_mach_ppc_7400 7400 192 .#define bfd_mach_ppc_e500 500 182 193 . bfd_arch_rs6000, {* IBM RS/6000 *} 183 .#define bfd_mach_rs6k 0194 .#define bfd_mach_rs6k 6000 184 195 .#define bfd_mach_rs6k_rs1 6001 185 196 .#define bfd_mach_rs6k_rsc 6003 … … 187 198 . bfd_arch_hppa, {* HP PA RISC *} 188 199 . bfd_arch_d10v, {* Mitsubishi D10V *} 189 .#define bfd_mach_d10v 0200 .#define bfd_mach_d10v 1 190 201 .#define bfd_mach_d10v_ts2 2 191 202 .#define bfd_mach_d10v_ts3 3 192 203 . bfd_arch_d30v, {* Mitsubishi D30V *} 204 . bfd_arch_dlx, {* DLX *} 193 205 . bfd_arch_m68hc11, {* Motorola 68HC11 *} 194 206 . bfd_arch_m68hc12, {* Motorola 68HC12 *} 207 .#define bfd_mach_m6812_default 0 208 .#define bfd_mach_m6812 1 209 .#define bfd_mach_m6812s 2 195 210 . bfd_arch_z8k, {* Zilog Z8000 *} 196 211 .#define bfd_mach_z8001 1 197 212 .#define bfd_mach_z8002 2 198 . bfd_arch_h8500, {* Hitachi H8/500*}199 . bfd_arch_sh, {* Hitachi SH*}200 .#define bfd_mach_sh 0213 . bfd_arch_h8500, {* Renesas H8/500 (formerly Hitachi H8/500) *} 214 . bfd_arch_sh, {* Renesas / SuperH SH (formerly Hitachi SH) *} 215 .#define bfd_mach_sh 1 201 216 .#define bfd_mach_sh2 0x20 202 217 .#define bfd_mach_sh_dsp 0x2d 218 .#define bfd_mach_sh2e 0x2e 203 219 .#define bfd_mach_sh3 0x30 204 220 .#define bfd_mach_sh3_dsp 0x3d 205 221 .#define bfd_mach_sh3e 0x3e 206 222 .#define bfd_mach_sh4 0x40 223 .#define bfd_mach_sh5 0x50 207 224 . bfd_arch_alpha, {* Dec Alpha *} 208 225 .#define bfd_mach_alpha_ev4 0x10 209 226 .#define bfd_mach_alpha_ev5 0x20 210 227 .#define bfd_mach_alpha_ev6 0x30 211 . bfd_arch_arm, {* Advanced Risc Machines ARM *} 228 . bfd_arch_arm, {* Advanced Risc Machines ARM. *} 229 .#define bfd_mach_arm_unknown 0 212 230 .#define bfd_mach_arm_2 1 213 231 .#define bfd_mach_arm_2a 2 … … 220 238 .#define bfd_mach_arm_5TE 9 221 239 .#define bfd_mach_arm_XScale 10 240 .#define bfd_mach_arm_ep9312 11 241 .#define bfd_mach_arm_iWMMXt 12 222 242 . bfd_arch_ns32k, {* National Semiconductors ns32000 *} 223 243 . bfd_arch_w65, {* WDC 65816 *} 224 244 . bfd_arch_tic30, {* Texas Instruments TMS320C30 *} 245 . bfd_arch_tic4x, {* Texas Instruments TMS320C3X/4X *} 246 .#define bfd_mach_tic3x 30 247 .#define bfd_mach_tic4x 40 225 248 . bfd_arch_tic54x, {* Texas Instruments TMS320C54X *} 226 249 . bfd_arch_tic80, {* TI TMS320c80 (MVP) *} 227 250 . bfd_arch_v850, {* NEC V850 *} 228 .#define bfd_mach_v850 0251 .#define bfd_mach_v850 1 229 252 .#define bfd_mach_v850e 'E' 230 .#define bfd_mach_v850ea 'A'231 253 . bfd_arch_arc, {* ARC Cores *} 232 .#define bfd_mach_arc_5 0233 .#define bfd_mach_arc_6 1234 .#define bfd_mach_arc_7 2235 .#define bfd_mach_arc_8 3236 . bfd_arch_m32r, {* Mitsubishi M32R/D*}237 .#define bfd_mach_m32r 0 {* backwards compatibility*}254 .#define bfd_mach_arc_5 5 255 .#define bfd_mach_arc_6 6 256 .#define bfd_mach_arc_7 7 257 .#define bfd_mach_arc_8 8 258 . bfd_arch_m32r, {* Renesas M32R (formerly Mitsubishi M32R/D) *} 259 .#define bfd_mach_m32r 1 {* For backwards compatibility. *} 238 260 .#define bfd_mach_m32rx 'x' 239 261 . bfd_arch_mn10200, {* Matsushita MN10200 *} … … 243 265 . bfd_arch_fr30, 244 266 .#define bfd_mach_fr30 0x46523330 267 . bfd_arch_frv, 268 .#define bfd_mach_frv 1 269 .#define bfd_mach_frvsimple 2 270 .#define bfd_mach_fr300 300 271 .#define bfd_mach_fr400 400 272 .#define bfd_mach_frvtomcat 499 {* fr500 prototype *} 273 .#define bfd_mach_fr500 500 245 274 . bfd_arch_mcore, 246 275 . bfd_arch_ia64, {* HP/Intel ia64 *} 247 .#define bfd_mach_ia64_elf64 0 248 .#define bfd_mach_ia64_elf32 1 276 .#define bfd_mach_ia64_elf64 64 277 .#define bfd_mach_ia64_elf32 32 278 . bfd_arch_ip2k, {* Ubicom IP2K microcontrollers. *} 279 .#define bfd_mach_ip2022 1 280 .#define bfd_mach_ip2022ext 2 281 . bfd_arch_iq2000, {* Vitesse IQ2000. *} 282 .#define bfd_mach_iq2000 1 283 .#define bfd_mach_iq10 2 249 284 . bfd_arch_pj, 250 . bfd_arch_avr, {* Atmel AVR microcontrollers *}285 . bfd_arch_avr, {* Atmel AVR microcontrollers. *} 251 286 .#define bfd_mach_avr1 1 252 287 .#define bfd_mach_avr2 2 … … 255 290 .#define bfd_mach_avr5 5 256 291 . bfd_arch_cris, {* Axis CRIS *} 292 . bfd_arch_s390, {* IBM s390 *} 293 .#define bfd_mach_s390_31 31 294 .#define bfd_mach_s390_64 64 295 . bfd_arch_openrisc, {* OpenRISC *} 296 . bfd_arch_mmix, {* Donald Knuth's educational processor. *} 297 . bfd_arch_xstormy16, 298 .#define bfd_mach_xstormy16 1 299 . bfd_arch_msp430, {* Texas Instruments MSP430 architecture. *} 300 .#define bfd_mach_msp110 110 301 .#define bfd_mach_msp11 11 302 .#define bfd_mach_msp12 12 303 .#define bfd_mach_msp13 13 304 .#define bfd_mach_msp14 14 305 .#define bfd_mach_msp41 41 306 .#define bfd_mach_msp31 31 307 .#define bfd_mach_msp32 32 308 .#define bfd_mach_msp33 33 309 .#define bfd_mach_msp43 43 310 .#define bfd_mach_msp44 44 311 .#define bfd_mach_msp15 15 312 .#define bfd_mach_msp16 16 313 . bfd_arch_xtensa, {* Tensilica's Xtensa cores. *} 314 .#define bfd_mach_xtensa 1 257 315 . bfd_arch_last 258 316 . }; … … 278 336 . const char *printable_name; 279 337 . unsigned int section_align_power; 280 . {* True if this is the default machine for the architecture. *} 281 . boolean the_default; 338 . {* TRUE if this is the default machine for the architecture. 339 . The default arch should be the first entry for an arch so that 340 . all the entries for that arch can be accessed via <<next>>. *} 341 . bfd_boolean the_default; 282 342 . const struct bfd_arch_info * (*compatible) 283 343 . PARAMS ((const struct bfd_arch_info *a, 284 344 . const struct bfd_arch_info *b)); 285 345 . 286 . b oolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));346 . bfd_boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *)); 287 347 . 288 348 . const struct bfd_arch_info *next; 289 .} bfd_arch_info_type; 349 .} 350 .bfd_arch_info_type; 351 . 290 352 */ 291 353 … … 294 356 extern const bfd_arch_info_type bfd_arc_arch; 295 357 extern const bfd_arch_info_type bfd_arm_arch; 358 extern const bfd_arch_info_type bfd_avr_arch; 296 359 extern const bfd_arch_info_type bfd_cris_arch; 297 360 extern const bfd_arch_info_type bfd_d10v_arch; 298 361 extern const bfd_arch_info_type bfd_d30v_arch; 362 extern const bfd_arch_info_type bfd_dlx_arch; 363 extern const bfd_arch_info_type bfd_fr30_arch; 364 extern const bfd_arch_info_type bfd_frv_arch; 299 365 extern const bfd_arch_info_type bfd_h8300_arch; 300 366 extern const bfd_arch_info_type bfd_h8500_arch; … … 304 370 extern const bfd_arch_info_type bfd_i860_arch; 305 371 extern const bfd_arch_info_type bfd_i960_arch; 372 extern const bfd_arch_info_type bfd_ia64_arch; 373 extern const bfd_arch_info_type bfd_ip2k_arch; 374 extern const bfd_arch_info_type bfd_iq2000_arch; 306 375 extern const bfd_arch_info_type bfd_m32r_arch; 307 376 extern const bfd_arch_info_type bfd_m68hc11_arch; … … 309 378 extern const bfd_arch_info_type bfd_m68k_arch; 310 379 extern const bfd_arch_info_type bfd_m88k_arch; 380 extern const bfd_arch_info_type bfd_mcore_arch; 311 381 extern const bfd_arch_info_type bfd_mips_arch; 382 extern const bfd_arch_info_type bfd_mmix_arch; 312 383 extern const bfd_arch_info_type bfd_mn10200_arch; 313 384 extern const bfd_arch_info_type bfd_mn10300_arch; 314 extern const bfd_arch_info_type bfd_powerpc_arch; 385 extern const bfd_arch_info_type bfd_msp430_arch; 386 extern const bfd_arch_info_type bfd_ns32k_arch; 387 extern const bfd_arch_info_type bfd_openrisc_arch; 388 extern const bfd_arch_info_type bfd_or32_arch; 389 extern const bfd_arch_info_type bfd_pdp11_arch; 390 extern const bfd_arch_info_type bfd_pj_arch; 391 extern const bfd_arch_info_type bfd_powerpc_archs[]; 392 #define bfd_powerpc_arch bfd_powerpc_archs[0] 315 393 extern const bfd_arch_info_type bfd_rs6000_arch; 316 extern const bfd_arch_info_type bfd_ pj_arch;394 extern const bfd_arch_info_type bfd_s390_arch; 317 395 extern const bfd_arch_info_type bfd_sh_arch; 318 396 extern const bfd_arch_info_type bfd_sparc_arch; 319 397 extern const bfd_arch_info_type bfd_tic30_arch; 398 extern const bfd_arch_info_type bfd_tic4x_arch; 320 399 extern const bfd_arch_info_type bfd_tic54x_arch; 321 400 extern const bfd_arch_info_type bfd_tic80_arch; 401 extern const bfd_arch_info_type bfd_v850_arch; 322 402 extern const bfd_arch_info_type bfd_vax_arch; 323 403 extern const bfd_arch_info_type bfd_we32k_arch; 404 extern const bfd_arch_info_type bfd_w65_arch; 405 extern const bfd_arch_info_type bfd_xstormy16_arch; 406 extern const bfd_arch_info_type bfd_xtensa_arch; 324 407 extern const bfd_arch_info_type bfd_z8k_arch; 325 extern const bfd_arch_info_type bfd_ns32k_arch; 326 extern const bfd_arch_info_type bfd_w65_arch; 327 extern const bfd_arch_info_type bfd_v850_arch; 328 extern const bfd_arch_info_type bfd_fr30_arch; 329 extern const bfd_arch_info_type bfd_mcore_arch; 330 extern const bfd_arch_info_type bfd_avr_arch; 331 extern const bfd_arch_info_type bfd_ia64_arch; 332 333 static const bfd_arch_info_type * const bfd_archures_list[] = { 408 409 static const bfd_arch_info_type * const bfd_archures_list[] = 410 { 334 411 #ifdef SELECT_ARCHITECTURES 335 SELECT_ARCHITECTURES,412 SELECT_ARCHITECTURES, 336 413 #else 337 &bfd_a29k_arch, 338 &bfd_alpha_arch, 339 &bfd_arc_arch, 340 &bfd_arm_arch, 341 &bfd_cris_arch, 342 &bfd_d10v_arch, 343 &bfd_d30v_arch, 344 &bfd_h8300_arch, 345 &bfd_h8500_arch, 346 &bfd_hppa_arch, 347 &bfd_i370_arch, 348 &bfd_i386_arch, 349 &bfd_i860_arch, 350 &bfd_i960_arch, 351 &bfd_m32r_arch, 352 &bfd_m68hc11_arch, 353 &bfd_m68hc12_arch, 354 &bfd_m68k_arch, 355 &bfd_m88k_arch, 356 &bfd_mips_arch, 357 &bfd_mn10200_arch, 358 &bfd_mn10300_arch, 359 &bfd_powerpc_arch, 360 &bfd_rs6000_arch, 361 &bfd_sh_arch, 362 &bfd_sparc_arch, 363 &bfd_tic30_arch, 364 &bfd_tic54x_arch, 365 &bfd_tic80_arch, 366 &bfd_vax_arch, 367 &bfd_we32k_arch, 368 &bfd_z8k_arch, 369 &bfd_ns32k_arch, 370 &bfd_w65_arch, 371 &bfd_v850_arch, 372 &bfd_fr30_arch, 373 &bfd_mcore_arch, 374 &bfd_avr_arch, 375 &bfd_ia64_arch, 414 &bfd_a29k_arch, 415 &bfd_alpha_arch, 416 &bfd_arc_arch, 417 &bfd_arm_arch, 418 &bfd_avr_arch, 419 &bfd_cris_arch, 420 &bfd_d10v_arch, 421 &bfd_d30v_arch, 422 &bfd_dlx_arch, 423 &bfd_fr30_arch, 424 &bfd_frv_arch, 425 &bfd_h8300_arch, 426 &bfd_h8500_arch, 427 &bfd_hppa_arch, 428 &bfd_i370_arch, 429 &bfd_i386_arch, 430 &bfd_i860_arch, 431 &bfd_i960_arch, 432 &bfd_ia64_arch, 433 &bfd_ip2k_arch, 434 &bfd_iq2000_arch, 435 &bfd_m32r_arch, 436 &bfd_m68hc11_arch, 437 &bfd_m68hc12_arch, 438 &bfd_m68k_arch, 439 &bfd_m88k_arch, 440 &bfd_mcore_arch, 441 &bfd_mips_arch, 442 &bfd_mmix_arch, 443 &bfd_mn10200_arch, 444 &bfd_mn10300_arch, 445 &bfd_msp430_arch, 446 &bfd_ns32k_arch, 447 &bfd_openrisc_arch, 448 &bfd_or32_arch, 449 &bfd_pdp11_arch, 450 &bfd_powerpc_arch, 451 &bfd_rs6000_arch, 452 &bfd_s390_arch, 453 &bfd_sh_arch, 454 &bfd_sparc_arch, 455 &bfd_tic30_arch, 456 &bfd_tic4x_arch, 457 &bfd_tic54x_arch, 458 &bfd_tic80_arch, 459 &bfd_v850_arch, 460 &bfd_vax_arch, 461 &bfd_w65_arch, 462 &bfd_we32k_arch, 463 &bfd_xstormy16_arch, 464 &bfd_xtensa_arch, 465 &bfd_z8k_arch, 376 466 #endif 377 467 0 … … 449 539 const char **name_list; 450 540 const bfd_arch_info_type * const *app; 541 bfd_size_type amt; 451 542 452 543 /* Determine the number of architectures. */ … … 461 552 } 462 553 463 name_list = (const char **)464 bfd_malloc ((vec_length + 1) * sizeof (char **));554 amt = (vec_length + 1) * sizeof (char **); 555 name_list = (const char **) bfd_malloc (amt); 465 556 if (name_list == NULL) 466 557 return NULL; … … 489 580 const bfd_arch_info_type *bfd_arch_get_compatible( 490 581 const bfd *abfd, 491 const bfd *bbfd); 492 493 DESCRIPTION 494 Determine whether two BFDs' 495 architectures and machine types are compatible. Calculates 496 the lowest common denominator between the two architectures 497 and machine types implied by the BFDs and returns a pointer to 498 an <<arch_info>> structure describing the compatible machine. 582 const bfd *bbfd, 583 bfd_boolean accept_unknowns); 584 585 DESCRIPTION 586 Determine whether two BFDs' architectures and machine types 587 are compatible. Calculates the lowest common denominator 588 between the two architectures and machine types implied by 589 the BFDs and returns a pointer to an <<arch_info>> structure 590 describing the compatible machine. 499 591 */ 500 592 501 593 const bfd_arch_info_type * 502 bfd_arch_get_compatible (abfd, bbfd )594 bfd_arch_get_compatible (abfd, bbfd, accept_unknowns) 503 595 const bfd *abfd; 504 596 const bfd *bbfd; 505 { 506 /* If either architecture is unknown, then all we can do is assume 507 the user knows what he's doing. */ 508 if (abfd->arch_info->arch == bfd_arch_unknown) 509 return bbfd->arch_info; 510 if (bbfd->arch_info->arch == bfd_arch_unknown) 511 return abfd->arch_info; 597 bfd_boolean accept_unknowns; 598 { 599 const bfd * ubfd = NULL; 600 601 /* Look for an unknown architecture. */ 602 if (((ubfd = abfd) && ubfd->arch_info->arch == bfd_arch_unknown) 603 || ((ubfd = bbfd) && ubfd->arch_info->arch == bfd_arch_unknown)) 604 { 605 /* We can allow an unknown architecture if accept_unknowns 606 is true, or if the target is the "binary" format, which 607 has an unknown architecture. Since the binary format can 608 only be set by explicit request from the user, it is safe 609 to assume that they know what they are doing. */ 610 if (accept_unknowns 611 || strcmp (bfd_get_target (ubfd), "binary") == 0) 612 return ubfd->arch_info; 613 return NULL; 614 } 512 615 513 616 /* Otherwise architecture-specific code has to decide. */ … … 530 633 531 634 const bfd_arch_info_type bfd_default_arch_struct = { 532 32, 32, 8, bfd_arch_unknown, 0, "unknown", "unknown", 2, true,635 32, 32, 8, bfd_arch_unknown, 0, "unknown", "unknown", 2, TRUE, 533 636 bfd_default_compatible, 534 637 bfd_default_scan, … … 560 663 561 664 SYNOPSIS 562 b oolean bfd_default_set_arch_mach(bfd *abfd,665 bfd_boolean bfd_default_set_arch_mach(bfd *abfd, 563 666 enum bfd_architecture arch, 564 667 unsigned long mach); … … 571 674 */ 572 675 573 b oolean676 bfd_boolean 574 677 bfd_default_set_arch_mach (abfd, arch, mach) 575 678 bfd *abfd; … … 577 680 unsigned long mach; 578 681 { 579 const bfd_arch_info_type * const *app, *ap; 580 581 for (app = bfd_archures_list; *app != NULL; app++) 582 { 583 for (ap = *app; ap != NULL; ap = ap->next) 584 { 585 if (ap->arch == arch 586 && (ap->mach == mach 587 || (mach == 0 && ap->the_default))) 588 { 589 abfd->arch_info = ap; 590 return true; 591 } 592 } 593 } 682 abfd->arch_info = bfd_lookup_arch (arch, mach); 683 if (abfd->arch_info != NULL) 684 return TRUE; 594 685 595 686 abfd->arch_info = &bfd_default_arch_struct; 596 687 bfd_set_error (bfd_error_bad_value); 597 return false;688 return FALSE; 598 689 } 599 690 … … 695 786 return NULL; 696 787 788 if (a->bits_per_word != b->bits_per_word) 789 return NULL; 790 697 791 if (a->mach > b->mach) 698 792 return a; … … 709 803 710 804 SYNOPSIS 711 b oolean bfd_default_scan(const struct bfd_arch_info *info, const char *string);805 bfd_boolean bfd_default_scan(const struct bfd_arch_info *info, const char *string); 712 806 713 807 DESCRIPTION … … 716 810 */ 717 811 718 b oolean812 bfd_boolean 719 813 bfd_default_scan (info, string) 720 const struct bfd_arch_info*info;814 const bfd_arch_info_type *info; 721 815 const char *string; 722 816 { … … 731 825 if (strcasecmp (string, info->arch_name) == 0 732 826 && info->the_default) 733 return true;827 return TRUE; 734 828 735 829 /* Exact match of the machine name (PRINTABLE_NAME)? */ 736 830 if (strcasecmp (string, info->printable_name) == 0) 737 return true;831 return TRUE; 738 832 739 833 /* Given that printable_name contains no colon, attempt to match: … … 742 836 if (printable_name_colon == NULL) 743 837 { 744 int strlen_arch_name = strlen (info->arch_name);838 size_t strlen_arch_name = strlen (info->arch_name); 745 839 if (strncasecmp (string, info->arch_name, strlen_arch_name) == 0) 746 840 { … … 749 843 if (strcasecmp (string + strlen_arch_name + 1, 750 844 info->printable_name) == 0) 751 return true;845 return TRUE; 752 846 } 753 847 else … … 755 849 if (strcasecmp (string + strlen_arch_name, 756 850 info->printable_name) == 0) 757 return true;851 return TRUE; 758 852 } 759 853 } … … 764 858 if (printable_name_colon != NULL) 765 859 { 766 int colon_index = printable_name_colon - info->printable_name;860 size_t colon_index = printable_name_colon - info->printable_name; 767 861 if (strncasecmp (string, info->printable_name, colon_index) == 0 768 862 && strcasecmp (string + colon_index, 769 863 info->printable_name + colon_index + 1) == 0) 770 return true;864 return TRUE; 771 865 } 772 866 … … 803 897 804 898 number = 0; 805 while ( isdigit ((unsigned char)*ptr_src))899 while (ISDIGIT (*ptr_src)) 806 900 { 807 901 number = number * 10 + *ptr_src - '0'; … … 911 1005 912 1006 default: 913 return false;1007 return FALSE; 914 1008 } 915 1009 916 1010 if (arch != info->arch) 917 return false;1011 return FALSE; 918 1012 919 1013 if (number != info->mach) 920 return false;921 922 return true;1014 return FALSE; 1015 1016 return TRUE; 923 1017 } 924 1018 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.