cpu-rs6000.c revision 1.1.1.2
1/* BFD back-end for rs6000 support
2   Copyright 1990, 1991, 1993, 1995, 2000, 2002, 2003, 2005, 2007, 2012
3   Free Software Foundation, Inc.
4   Written by Mimi Phuong-Thao Vo of IBM
5   and John Gilmore of Cygnus Support.
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 modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; either version 3 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., 51 Franklin Street - Fifth Floor, Boston,
22   MA 02110-1301, USA.  */
23
24#include "sysdep.h"
25#include "bfd.h"
26#include "libbfd.h"
27
28/* The RS/6000 architecture is compatible with the PowerPC common
29   architecture.  */
30
31static const bfd_arch_info_type *
32rs6000_compatible (const bfd_arch_info_type *a,
33		   const bfd_arch_info_type *b)
34{
35  BFD_ASSERT (a->arch == bfd_arch_rs6000);
36  switch (b->arch)
37    {
38    default:
39      return NULL;
40    case bfd_arch_rs6000:
41      return bfd_default_compatible (a, b);
42    case bfd_arch_powerpc:
43      if (a->mach == bfd_mach_rs6k)
44	return b;
45      return NULL;
46    }
47  /*NOTREACHED*/
48}
49
50static const bfd_arch_info_type arch_info_struct[] =
51{
52  {
53    32,	/* 32 bits in a word */
54    32,	/* 32 bits in an address */
55    8,	/* 8 bits in a byte */
56    bfd_arch_rs6000,
57    bfd_mach_rs6k_rs1,
58    "rs6000",
59    "rs6000:rs1",
60    3,
61    FALSE, /* not the default */
62    rs6000_compatible,
63    bfd_default_scan,
64    bfd_arch_default_fill,
65    &arch_info_struct[1]
66  },
67  {
68    32,	/* 32 bits in a word */
69    32,	/* 32 bits in an address */
70    8,	/* 8 bits in a byte */
71    bfd_arch_rs6000,
72    bfd_mach_rs6k_rsc,
73    "rs6000",
74    "rs6000:rsc",
75    3,
76    FALSE, /* not the default */
77    rs6000_compatible,
78    bfd_default_scan,
79    bfd_arch_default_fill,
80    &arch_info_struct[2]
81  },
82  {
83    32,	/* 32 bits in a word */
84    32,	/* 32 bits in an address */
85    8,	/* 8 bits in a byte */
86    bfd_arch_rs6000,
87    bfd_mach_rs6k_rs2,
88    "rs6000",
89    "rs6000:rs2",
90    3,
91    FALSE, /* not the default */
92    rs6000_compatible,
93    bfd_default_scan,
94    bfd_arch_default_fill,
95    0
96  }
97};
98
99const bfd_arch_info_type bfd_rs6000_arch =
100  {
101    32,	/* 32 bits in a word */
102    32,	/* 32 bits in an address */
103    8,	/* 8 bits in a byte */
104    bfd_arch_rs6000,
105    bfd_mach_rs6k,	/* POWER common architecture */
106    "rs6000",
107    "rs6000:6000",
108    3,
109    TRUE, /* the default */
110    rs6000_compatible,
111    bfd_default_scan,
112    bfd_arch_default_fill,
113    &arch_info_struct[0]
114  };
115