Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/bfd/archures.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* BFD library support routines for architectures.
    22   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
    3    2000, 2001
     3   2000, 2001, 2002, 2003
    44   Free Software Foundation, Inc.
    55   Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
    66
    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.  */
     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.  */
    2222
    2323#include "bfd.h"
    2424#include "sysdep.h"
    2525#include "libbfd.h"
    26 #include <ctype.h>
     26#include "safe-ctype.h"
    2727
    2828/*
     
    7070.enum bfd_architecture
    7171.{
    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. *}
    7474.  bfd_arch_m68k,      {* Motorola 68xxx *}
    7575.#define bfd_mach_m68000 1
     
    9393.       The exception is the "ca", which is
    9494.       incompatible with all other machines except
    95 .       "core". *}
     95.       "core".  *}
    9696.
    9797.#define bfd_mach_i960_core      1
     
    104104.#define bfd_mach_i960_hx        8
    105105.
     106.  bfd_arch_or32,      {* OpenRISC 32 *}
     107.
    106108.  bfd_arch_a29k,      {* AMD 29000 *}
    107109.  bfd_arch_sparc,     {* SPARC *}
     
    111113.#define bfd_mach_sparc_sparclite       3
    112114.#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. *}
    114116.#define bfd_mach_sparc_sparclite_le    6
    115117.#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. *}
    119121.{* Nonzero if MACH has the v9 instruction set.  *}
    120122.#define bfd_mach_sparc_v9_p(mach) \
     
    128130.#define bfd_mach_mips4100              4100
    129131.#define bfd_mach_mips4111              4111
     132.#define bfd_mach_mips4120              4120
    130133.#define bfd_mach_mips4300              4300
    131134.#define bfd_mach_mips4400              4400
     
    133136.#define bfd_mach_mips4650              4650
    134137.#define bfd_mach_mips5000              5000
     138.#define bfd_mach_mips5400              5400
     139.#define bfd_mach_mips5500              5500
    135140.#define bfd_mach_mips6000              6000
    136141.#define bfd_mach_mips8000              8000
     
    138143.#define bfd_mach_mips12000             12000
    139144.#define bfd_mach_mips16                16
    140 .#define bfd_mach_mips32                32
    141 .#define bfd_mach_mips32_4k             3204113 {* 32, 04, octal 'K' *}
    142145.#define bfd_mach_mips5                 5
    143 .#define bfd_mach_mips64                64
    144146.#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
    145150.  bfd_arch_i386,      {* Intel 386 *}
    146 .#define bfd_mach_i386_i386 0
    147 .#define bfd_mach_i386_i8086 1
    148 .#define bfd_mach_i386_i386_intel_syntax 2
    149 .#define bfd_mach_x86_64 3
    150 .#define bfd_mach_x86_64_intel_syntax 4
     151.#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
    151156.  bfd_arch_we32k,     {* AT&T WE32xxx *}
    152157.  bfd_arch_tahoe,     {* CCI/Harris Tahoe *}
     
    157162.  bfd_arch_convex,    {* Convex *}
    158163.  bfd_arch_m88k,      {* Motorola 88xxx *}
     164.  bfd_arch_m98k,      {* Motorola 98xxx *}
    159165.  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 *}
    164173.  bfd_arch_powerpc,   {* PowerPC *}
    165 .#define bfd_mach_ppc           0
     174.#define bfd_mach_ppc           32
     175.#define bfd_mach_ppc64         64
    166176.#define bfd_mach_ppc_403       403
    167177.#define bfd_mach_ppc_403gc     4030
     
    180190.#define bfd_mach_ppc_rs64iii   643
    181191.#define bfd_mach_ppc_7400      7400
     192.#define bfd_mach_ppc_e500      500
    182193.  bfd_arch_rs6000,    {* IBM RS/6000 *}
    183 .#define bfd_mach_rs6k          0
     194.#define bfd_mach_rs6k          6000
    184195.#define bfd_mach_rs6k_rs1      6001
    185196.#define bfd_mach_rs6k_rsc      6003
     
    187198.  bfd_arch_hppa,      {* HP PA RISC *}
    188199.  bfd_arch_d10v,      {* Mitsubishi D10V *}
    189 .#define bfd_mach_d10v          0
     200.#define bfd_mach_d10v          1
    190201.#define bfd_mach_d10v_ts2      2
    191202.#define bfd_mach_d10v_ts3      3
    192203.  bfd_arch_d30v,      {* Mitsubishi D30V *}
     204.  bfd_arch_dlx,       {* DLX *}
    193205.  bfd_arch_m68hc11,   {* Motorola 68HC11 *}
    194206.  bfd_arch_m68hc12,   {* Motorola 68HC12 *}
     207.#define bfd_mach_m6812_default 0
     208.#define bfd_mach_m6812         1
     209.#define bfd_mach_m6812s        2
    195210.  bfd_arch_z8k,       {* Zilog Z8000 *}
    196211.#define bfd_mach_z8001         1
    197212.#define bfd_mach_z8002         2
    198 .  bfd_arch_h8500,     {* Hitachi H8/500 *}
    199 .  bfd_arch_sh,        {* Hitachi SH *}
    200 .#define bfd_mach_sh            0
     213.  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
    201216.#define bfd_mach_sh2        0x20
    202217.#define bfd_mach_sh_dsp     0x2d
     218.#define bfd_mach_sh2e       0x2e
    203219.#define bfd_mach_sh3        0x30
    204220.#define bfd_mach_sh3_dsp    0x3d
    205221.#define bfd_mach_sh3e       0x3e
    206222.#define bfd_mach_sh4        0x40
     223.#define bfd_mach_sh5        0x50
    207224.  bfd_arch_alpha,     {* Dec Alpha *}
    208225.#define bfd_mach_alpha_ev4  0x10
    209226.#define bfd_mach_alpha_ev5  0x20
    210227.#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
    212230.#define bfd_mach_arm_2         1
    213231.#define bfd_mach_arm_2a        2
     
    220238.#define bfd_mach_arm_5TE       9
    221239.#define bfd_mach_arm_XScale    10
     240.#define bfd_mach_arm_ep9312    11
     241.#define bfd_mach_arm_iWMMXt    12
    222242.  bfd_arch_ns32k,     {* National Semiconductors ns32000 *}
    223243.  bfd_arch_w65,       {* WDC 65816 *}
    224244.  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
    225248.  bfd_arch_tic54x,    {* Texas Instruments TMS320C54X *}
    226249.  bfd_arch_tic80,     {* TI TMS320c80 (MVP) *}
    227250.  bfd_arch_v850,      {* NEC V850 *}
    228 .#define bfd_mach_v850          0
     251.#define bfd_mach_v850          1
    229252.#define bfd_mach_v850e         'E'
    230 .#define bfd_mach_v850ea        'A'
    231253.  bfd_arch_arc,       {* ARC Cores *}
    232 .#define bfd_mach_arc_5         0
    233 .#define bfd_mach_arc_6         1
    234 .#define bfd_mach_arc_7         2
    235 .#define bfd_mach_arc_8         3
    236 .  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. *}
    238260.#define bfd_mach_m32rx         'x'
    239261.  bfd_arch_mn10200,   {* Matsushita MN10200 *}
     
    243265.  bfd_arch_fr30,
    244266.#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
    245274.  bfd_arch_mcore,
    246275.  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
    249284.  bfd_arch_pj,
    250 .  bfd_arch_avr,       {* Atmel AVR microcontrollers *}
     285.  bfd_arch_avr,       {* Atmel AVR microcontrollers. *}
    251286.#define bfd_mach_avr1          1
    252287.#define bfd_mach_avr2          2
     
    255290.#define bfd_mach_avr5          5
    256291.  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
    257315.  bfd_arch_last
    258316.  };
     
    278336.  const char *printable_name;
    279337.  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;
    282342.  const struct bfd_arch_info * (*compatible)
    283343.       PARAMS ((const struct bfd_arch_info *a,
    284344.                const struct bfd_arch_info *b));
    285345.
    286 .  boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));
     346.  bfd_boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));
    287347.
    288348.  const struct bfd_arch_info *next;
    289 .} bfd_arch_info_type;
     349.}
     350.bfd_arch_info_type;
     351.
    290352*/
    291353
     
    294356extern const bfd_arch_info_type bfd_arc_arch;
    295357extern const bfd_arch_info_type bfd_arm_arch;
     358extern const bfd_arch_info_type bfd_avr_arch;
    296359extern const bfd_arch_info_type bfd_cris_arch;
    297360extern const bfd_arch_info_type bfd_d10v_arch;
    298361extern const bfd_arch_info_type bfd_d30v_arch;
     362extern const bfd_arch_info_type bfd_dlx_arch;
     363extern const bfd_arch_info_type bfd_fr30_arch;
     364extern const bfd_arch_info_type bfd_frv_arch;
    299365extern const bfd_arch_info_type bfd_h8300_arch;
    300366extern const bfd_arch_info_type bfd_h8500_arch;
     
    304370extern const bfd_arch_info_type bfd_i860_arch;
    305371extern const bfd_arch_info_type bfd_i960_arch;
     372extern const bfd_arch_info_type bfd_ia64_arch;
     373extern const bfd_arch_info_type bfd_ip2k_arch;
     374extern const bfd_arch_info_type bfd_iq2000_arch;
    306375extern const bfd_arch_info_type bfd_m32r_arch;
    307376extern const bfd_arch_info_type bfd_m68hc11_arch;
     
    309378extern const bfd_arch_info_type bfd_m68k_arch;
    310379extern const bfd_arch_info_type bfd_m88k_arch;
     380extern const bfd_arch_info_type bfd_mcore_arch;
    311381extern const bfd_arch_info_type bfd_mips_arch;
     382extern const bfd_arch_info_type bfd_mmix_arch;
    312383extern const bfd_arch_info_type bfd_mn10200_arch;
    313384extern const bfd_arch_info_type bfd_mn10300_arch;
    314 extern const bfd_arch_info_type bfd_powerpc_arch;
     385extern const bfd_arch_info_type bfd_msp430_arch;
     386extern const bfd_arch_info_type bfd_ns32k_arch;
     387extern const bfd_arch_info_type bfd_openrisc_arch;
     388extern const bfd_arch_info_type bfd_or32_arch;
     389extern const bfd_arch_info_type bfd_pdp11_arch;
     390extern const bfd_arch_info_type bfd_pj_arch;
     391extern const bfd_arch_info_type bfd_powerpc_archs[];
     392#define bfd_powerpc_arch bfd_powerpc_archs[0]
    315393extern const bfd_arch_info_type bfd_rs6000_arch;
    316 extern const bfd_arch_info_type bfd_pj_arch;
     394extern const bfd_arch_info_type bfd_s390_arch;
    317395extern const bfd_arch_info_type bfd_sh_arch;
    318396extern const bfd_arch_info_type bfd_sparc_arch;
    319397extern const bfd_arch_info_type bfd_tic30_arch;
     398extern const bfd_arch_info_type bfd_tic4x_arch;
    320399extern const bfd_arch_info_type bfd_tic54x_arch;
    321400extern const bfd_arch_info_type bfd_tic80_arch;
     401extern const bfd_arch_info_type bfd_v850_arch;
    322402extern const bfd_arch_info_type bfd_vax_arch;
    323403extern const bfd_arch_info_type bfd_we32k_arch;
     404extern const bfd_arch_info_type bfd_w65_arch;
     405extern const bfd_arch_info_type bfd_xstormy16_arch;
     406extern const bfd_arch_info_type bfd_xtensa_arch;
    324407extern 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
     409static const bfd_arch_info_type * const bfd_archures_list[] =
     410  {
    334411#ifdef SELECT_ARCHITECTURES
    335   SELECT_ARCHITECTURES,
     412    SELECT_ARCHITECTURES,
    336413#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,
    376466#endif
    377467  0
     
    449539  const char **name_list;
    450540  const bfd_arch_info_type * const *app;
     541  bfd_size_type amt;
    451542
    452543  /* Determine the number of architectures.  */
     
    461552    }
    462553
    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);
    465556  if (name_list == NULL)
    466557    return NULL;
     
    489580        const bfd_arch_info_type *bfd_arch_get_compatible(
    490581                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
     585DESCRIPTION
     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.
    499591*/
    500592
    501593const bfd_arch_info_type *
    502 bfd_arch_get_compatible (abfd, bbfd)
     594bfd_arch_get_compatible (abfd, bbfd, accept_unknowns)
    503595     const bfd *abfd;
    504596     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    }
    512615
    513616  /* Otherwise architecture-specific code has to decide.  */
     
    530633
    531634const 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,
    533636  bfd_default_compatible,
    534637  bfd_default_scan,
     
    560663
    561664SYNOPSIS
    562         boolean bfd_default_set_arch_mach(bfd *abfd,
     665        bfd_boolean bfd_default_set_arch_mach(bfd *abfd,
    563666                enum bfd_architecture arch,
    564667                unsigned long mach);
     
    571674*/
    572675
    573 boolean
     676bfd_boolean
    574677bfd_default_set_arch_mach (abfd, arch, mach)
    575678     bfd *abfd;
     
    577680     unsigned long mach;
    578681{
    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;
    594685
    595686  abfd->arch_info = &bfd_default_arch_struct;
    596687  bfd_set_error (bfd_error_bad_value);
    597   return false;
     688  return FALSE;
    598689}
    599690
     
    695786    return NULL;
    696787
     788  if (a->bits_per_word != b->bits_per_word)
     789    return NULL;
     790
    697791  if (a->mach > b->mach)
    698792    return a;
     
    709803
    710804SYNOPSIS
    711         boolean 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);
    712806
    713807DESCRIPTION
     
    716810*/
    717811
    718 boolean
     812bfd_boolean
    719813bfd_default_scan (info, string)
    720      const struct bfd_arch_info *info;
     814     const bfd_arch_info_type *info;
    721815     const char *string;
    722816{
     
    731825  if (strcasecmp (string, info->arch_name) == 0
    732826      && info->the_default)
    733     return true;
     827    return TRUE;
    734828
    735829  /* Exact match of the machine name (PRINTABLE_NAME)?  */
    736830  if (strcasecmp (string, info->printable_name) == 0)
    737     return true;
     831    return TRUE;
    738832
    739833  /* Given that printable_name contains no colon, attempt to match:
     
    742836  if (printable_name_colon == NULL)
    743837    {
    744       int strlen_arch_name = strlen (info->arch_name);
     838      size_t strlen_arch_name = strlen (info->arch_name);
    745839      if (strncasecmp (string, info->arch_name, strlen_arch_name) == 0)
    746840        {
     
    749843              if (strcasecmp (string + strlen_arch_name + 1,
    750844                              info->printable_name) == 0)
    751                 return true;
     845                return TRUE;
    752846            }
    753847          else
     
    755849              if (strcasecmp (string + strlen_arch_name,
    756850                              info->printable_name) == 0)
    757                 return true;
     851                return TRUE;
    758852            }
    759853        }
     
    764858  if (printable_name_colon != NULL)
    765859    {
    766       int colon_index = printable_name_colon - info->printable_name;
     860      size_t colon_index = printable_name_colon - info->printable_name;
    767861      if (strncasecmp (string, info->printable_name, colon_index) == 0
    768862          && strcasecmp (string + colon_index,
    769863                         info->printable_name + colon_index + 1) == 0)
    770         return true;
     864        return TRUE;
    771865    }
    772866
     
    803897
    804898  number = 0;
    805   while (isdigit ((unsigned char) *ptr_src))
     899  while (ISDIGIT (*ptr_src))
    806900    {
    807901      number = number * 10 + *ptr_src - '0';
     
    9111005
    9121006    default:
    913       return false;
     1007      return FALSE;
    9141008    }
    9151009
    9161010  if (arch != info->arch)
    917     return false;
     1011    return FALSE;
    9181012
    9191013  if (number != info->mach)
    920     return false;
    921 
    922   return true;
     1014    return FALSE;
     1015
     1016  return TRUE;
    9231017}
    9241018
Note: See TracChangeset for help on using the changeset viewer.