cpu-rs6000.c 2.3 KB

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