Automatic date update in version.in
[binutils-gdb.git] / bfd / cpu-rs6000.c
blob886ac9bd0e044cd75b0c4ec069181475d6847a26
1 /* BFD back-end for rs6000 support
2 Copyright (C) 1990-2024 Free Software Foundation, Inc.
3 Written by Mimi Phuong-Thao Vo of IBM
4 and John Gilmore of Cygnus Support.
6 This file is part of BFD, the Binary File Descriptor library.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21 MA 02110-1301, USA. */
23 #include "sysdep.h"
24 #include "bfd.h"
25 #include "libbfd.h"
27 /* The RS/6000 architecture is compatible with the PowerPC common
28 architecture. */
30 static const bfd_arch_info_type *
31 rs6000_compatible (const bfd_arch_info_type *a,
32 const bfd_arch_info_type *b)
34 BFD_ASSERT (a->arch == bfd_arch_rs6000);
35 switch (b->arch)
37 default:
38 return NULL;
39 case bfd_arch_rs6000:
40 return bfd_default_compatible (a, b);
41 case bfd_arch_powerpc:
42 if (a->mach == bfd_mach_rs6k)
43 return b;
44 return NULL;
46 /*NOTREACHED*/
49 #define N(NUMBER, PRINT, DEFAULT, NEXT) \
50 { \
51 32, /* Bits in a word. */ \
52 32, /* Bits in an address. */ \
53 8, /* Bits in a byte. */ \
54 bfd_arch_rs6000, \
55 NUMBER, \
56 "rs6000", \
57 PRINT, \
58 3, /* Section alignment power. */ \
59 DEFAULT, \
60 rs6000_compatible, \
61 bfd_default_scan, \
62 bfd_arch_default_fill, \
63 NEXT, \
64 0 /* Maximum offset of a reloc from the start of an insn. */ \
67 static const bfd_arch_info_type arch_info_struct[3] =
69 N (bfd_mach_rs6k_rs1, "rs6000:rs1", false, arch_info_struct + 1),
70 N (bfd_mach_rs6k_rsc, "rs6000:rsc", false, arch_info_struct + 2),
71 N (bfd_mach_rs6k_rs2, "rs6000:rs2", false, NULL)
74 const bfd_arch_info_type bfd_rs6000_arch =
75 N (bfd_mach_rs6k, "rs6000:6000", true, arch_info_struct + 0);