12a6b7db3Sskrll /* BFD back-end for rs6000 support
2*cb63e24eSchristos Copyright (C) 1990-2024 Free Software Foundation, Inc.
32a6b7db3Sskrll Written by Mimi Phuong-Thao Vo of IBM
42a6b7db3Sskrll and John Gilmore of Cygnus Support.
52a6b7db3Sskrll
62a6b7db3Sskrll This file is part of BFD, the Binary File Descriptor library.
72a6b7db3Sskrll
82a6b7db3Sskrll This program is free software; you can redistribute it and/or modify
92a6b7db3Sskrll it under the terms of the GNU General Public License as published by
102a6b7db3Sskrll the Free Software Foundation; either version 3 of the License, or
112a6b7db3Sskrll (at your option) any later version.
122a6b7db3Sskrll
132a6b7db3Sskrll This program is distributed in the hope that it will be useful,
142a6b7db3Sskrll but WITHOUT ANY WARRANTY; without even the implied warranty of
152a6b7db3Sskrll MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
162a6b7db3Sskrll GNU General Public License for more details.
172a6b7db3Sskrll
182a6b7db3Sskrll You should have received a copy of the GNU General Public License
192a6b7db3Sskrll along with this program; if not, write to the Free Software
202a6b7db3Sskrll Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
212a6b7db3Sskrll MA 02110-1301, USA. */
222a6b7db3Sskrll
232a6b7db3Sskrll #include "sysdep.h"
242a6b7db3Sskrll #include "bfd.h"
252a6b7db3Sskrll #include "libbfd.h"
262a6b7db3Sskrll
272a6b7db3Sskrll /* The RS/6000 architecture is compatible with the PowerPC common
282a6b7db3Sskrll architecture. */
292a6b7db3Sskrll
302a6b7db3Sskrll static const bfd_arch_info_type *
rs6000_compatible(const bfd_arch_info_type * a,const bfd_arch_info_type * b)31883529b6Schristos rs6000_compatible (const bfd_arch_info_type *a,
32883529b6Schristos const bfd_arch_info_type *b)
332a6b7db3Sskrll {
342a6b7db3Sskrll BFD_ASSERT (a->arch == bfd_arch_rs6000);
352a6b7db3Sskrll switch (b->arch)
362a6b7db3Sskrll {
372a6b7db3Sskrll default:
382a6b7db3Sskrll return NULL;
392a6b7db3Sskrll case bfd_arch_rs6000:
402a6b7db3Sskrll return bfd_default_compatible (a, b);
412a6b7db3Sskrll case bfd_arch_powerpc:
422a6b7db3Sskrll if (a->mach == bfd_mach_rs6k)
432a6b7db3Sskrll return b;
442a6b7db3Sskrll return NULL;
452a6b7db3Sskrll }
462a6b7db3Sskrll /*NOTREACHED*/
472a6b7db3Sskrll }
482a6b7db3Sskrll
496f4ced0bSchristos #define N(NUMBER, PRINT, DEFAULT, NEXT) \
506f4ced0bSchristos { \
516f4ced0bSchristos 32, /* Bits in a word. */ \
526f4ced0bSchristos 32, /* Bits in an address. */ \
536f4ced0bSchristos 8, /* Bits in a byte. */ \
546f4ced0bSchristos bfd_arch_rs6000, \
556f4ced0bSchristos NUMBER, \
566f4ced0bSchristos "rs6000", \
576f4ced0bSchristos PRINT, \
586f4ced0bSchristos 3, /* Section alignment power. */ \
596f4ced0bSchristos DEFAULT, \
606f4ced0bSchristos rs6000_compatible, \
616f4ced0bSchristos bfd_default_scan, \
626f4ced0bSchristos bfd_arch_default_fill, \
636f4ced0bSchristos NEXT, \
646f4ced0bSchristos 0 /* Maximum offset of a reloc from the start of an insn. */ \
652a6b7db3Sskrll }
666f4ced0bSchristos
676f4ced0bSchristos static const bfd_arch_info_type arch_info_struct[3] =
686f4ced0bSchristos {
694f645668Schristos N (bfd_mach_rs6k_rs1, "rs6000:rs1", false, arch_info_struct + 1),
704f645668Schristos N (bfd_mach_rs6k_rsc, "rs6000:rsc", false, arch_info_struct + 2),
714f645668Schristos N (bfd_mach_rs6k_rs2, "rs6000:rs2", false, NULL)
722a6b7db3Sskrll };
732a6b7db3Sskrll
742a6b7db3Sskrll const bfd_arch_info_type bfd_rs6000_arch =
754f645668Schristos N (bfd_mach_rs6k, "rs6000:6000", true, arch_info_struct + 0);
76