cpu-rs6000.c revision 84865
1/* BFD back-end for rs6000 support
2   Copyright 1990, 1991, 1993, 1995, 2000 Free Software Foundation, Inc.
3   FIXME: Can someone provide a transliteration of this name into ASCII?
4   Using the following chars caused a compiler warning on HIUX (so I replaced
5   them with octal escapes), and isn't useful without an understanding of what
6   character set it is.
7   Written by Mimi Ph\373\364ng-Th\345o V\365 of IBM
8   and John Gilmore of Cygnus Support.
9
10This file is part of BFD, the Binary File Descriptor library.
11
12This program is free software; you can redistribute it and/or modify
13it under the terms of the GNU General Public License as published by
14the Free Software Foundation; either version 2 of the License, or
15(at your option) any later version.
16
17This program is distributed in the hope that it will be useful,
18but WITHOUT ANY WARRANTY; without even the implied warranty of
19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20GNU General Public License for more details.
21
22You should have received a copy of the GNU General Public License
23along with this program; if not, write to the Free Software
24Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
25
26#include "bfd.h"
27#include "sysdep.h"
28#include "libbfd.h"
29
30/* The RS/6000 architecture is compatible with the PowerPC common
31   architecture.  */
32
33static const bfd_arch_info_type *rs6000_compatible
34  PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
35
36static const bfd_arch_info_type *
37rs6000_compatible (a,b)
38     const bfd_arch_info_type *a;
39     const bfd_arch_info_type *b;
40{
41  BFD_ASSERT (a->arch == bfd_arch_rs6000);
42  switch (b->arch)
43    {
44    default:
45      return NULL;
46    case bfd_arch_rs6000:
47      return bfd_default_compatible (a, b);
48    case bfd_arch_powerpc:
49      if (b->mach == 0)
50	return b;
51      return NULL;
52    }
53  /*NOTREACHED*/
54}
55
56static const bfd_arch_info_type arch_info_struct[] =
57{
58  {
59    32,	/* 32 bits in a word */
60    32,	/* 32 bits in an address */
61    8,	/* 8 bits in a byte */
62    bfd_arch_rs6000,
63    bfd_mach_rs6k_rs1,
64    "rs6000",
65    "rs6000:rs1",
66    3,
67    false, /* not the default */
68    rs6000_compatible,
69    bfd_default_scan,
70    &arch_info_struct[1]
71  },
72  {
73    32,	/* 32 bits in a word */
74    32,	/* 32 bits in an address */
75    8,	/* 8 bits in a byte */
76    bfd_arch_rs6000,
77    bfd_mach_rs6k_rsc,
78    "rs6000",
79    "rs6000:rsc",
80    3,
81    false, /* not the default */
82    rs6000_compatible,
83    bfd_default_scan,
84    &arch_info_struct[2]
85  },
86  {
87    32,	/* 32 bits in a word */
88    32,	/* 32 bits in an address */
89    8,	/* 8 bits in a byte */
90    bfd_arch_rs6000,
91    bfd_mach_rs6k_rs2,
92    "rs6000",
93    "rs6000:rs2",
94    3,
95    false, /* not the default */
96    rs6000_compatible,
97    bfd_default_scan,
98    0
99  }
100};
101
102const bfd_arch_info_type bfd_rs6000_arch =
103  {
104    32,	/* 32 bits in a word */
105    32,	/* 32 bits in an address */
106    8,	/* 8 bits in a byte */
107    bfd_arch_rs6000,
108    bfd_mach_rs6k,	/* POWER common architecture */
109    "rs6000",
110    "rs6000:6000",
111    3,
112    true, /* the default */
113    rs6000_compatible,
114    bfd_default_scan,
115    &arch_info_struct[0]
116  };
117