175fd0b74Schristos /* BFD back-end for rs6000 support
2*e992f068Schristos Copyright (C) 1990-2022 Free Software Foundation, Inc.
375fd0b74Schristos Written by Mimi Phuong-Thao Vo of IBM
475fd0b74Schristos and John Gilmore of Cygnus Support.
575fd0b74Schristos
675fd0b74Schristos This file is part of BFD, the Binary File Descriptor library.
775fd0b74Schristos
875fd0b74Schristos This program is free software; you can redistribute it and/or modify
975fd0b74Schristos it under the terms of the GNU General Public License as published by
1075fd0b74Schristos the Free Software Foundation; either version 3 of the License, or
1175fd0b74Schristos (at your option) any later version.
1275fd0b74Schristos
1375fd0b74Schristos This program is distributed in the hope that it will be useful,
1475fd0b74Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of
1575fd0b74Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1675fd0b74Schristos GNU General Public License for more details.
1775fd0b74Schristos
1875fd0b74Schristos You should have received a copy of the GNU General Public License
1975fd0b74Schristos along with this program; if not, write to the Free Software
2075fd0b74Schristos Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
2175fd0b74Schristos MA 02110-1301, USA. */
2275fd0b74Schristos
2375fd0b74Schristos #include "sysdep.h"
2475fd0b74Schristos #include "bfd.h"
2575fd0b74Schristos #include "libbfd.h"
2675fd0b74Schristos
2775fd0b74Schristos /* The RS/6000 architecture is compatible with the PowerPC common
2875fd0b74Schristos architecture. */
2975fd0b74Schristos
3075fd0b74Schristos static const bfd_arch_info_type *
rs6000_compatible(const bfd_arch_info_type * a,const bfd_arch_info_type * b)3175fd0b74Schristos rs6000_compatible (const bfd_arch_info_type *a,
3275fd0b74Schristos const bfd_arch_info_type *b)
3375fd0b74Schristos {
3475fd0b74Schristos BFD_ASSERT (a->arch == bfd_arch_rs6000);
3575fd0b74Schristos switch (b->arch)
3675fd0b74Schristos {
3775fd0b74Schristos default:
3875fd0b74Schristos return NULL;
3975fd0b74Schristos case bfd_arch_rs6000:
4075fd0b74Schristos return bfd_default_compatible (a, b);
4175fd0b74Schristos case bfd_arch_powerpc:
4275fd0b74Schristos if (a->mach == bfd_mach_rs6k)
4375fd0b74Schristos return b;
4475fd0b74Schristos return NULL;
4575fd0b74Schristos }
4675fd0b74Schristos /*NOTREACHED*/
4775fd0b74Schristos }
4875fd0b74Schristos
49012573ebSchristos #define N(NUMBER, PRINT, DEFAULT, NEXT) \
50012573ebSchristos { \
51012573ebSchristos 32, /* Bits in a word. */ \
52012573ebSchristos 32, /* Bits in an address. */ \
53012573ebSchristos 8, /* Bits in a byte. */ \
54012573ebSchristos bfd_arch_rs6000, \
55012573ebSchristos NUMBER, \
56012573ebSchristos "rs6000", \
57012573ebSchristos PRINT, \
58012573ebSchristos 3, /* Section alignment power. */ \
59012573ebSchristos DEFAULT, \
60012573ebSchristos rs6000_compatible, \
61012573ebSchristos bfd_default_scan, \
62012573ebSchristos bfd_arch_default_fill, \
63012573ebSchristos NEXT, \
64012573ebSchristos 0 /* Maximum offset of a reloc from the start of an insn. */ \
6575fd0b74Schristos }
66012573ebSchristos
67012573ebSchristos static const bfd_arch_info_type arch_info_struct[3] =
68012573ebSchristos {
69*e992f068Schristos N (bfd_mach_rs6k_rs1, "rs6000:rs1", false, arch_info_struct + 1),
70*e992f068Schristos N (bfd_mach_rs6k_rsc, "rs6000:rsc", false, arch_info_struct + 2),
71*e992f068Schristos N (bfd_mach_rs6k_rs2, "rs6000:rs2", false, NULL)
7275fd0b74Schristos };
7375fd0b74Schristos
7475fd0b74Schristos const bfd_arch_info_type bfd_rs6000_arch =
75*e992f068Schristos N (bfd_mach_rs6k, "rs6000:6000", true, arch_info_struct + 0);
76