cpu-score.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* BFD support for the score processor
  2. Copyright (C) 2006-2022 Free Software Foundation, Inc.
  3. Contributed by
  4. Brain.lin (brain.lin@sunplusct.com)
  5. Mei Ligang (ligang@sunnorth.com.cn)
  6. Pei-Lin Tsai (pltsai@sunplus.com)
  7. 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.
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU General Public License for more details.
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  19. MA 02110-1301, USA. */
  20. #include "sysdep.h"
  21. #include "bfd.h"
  22. #include "libbfd.h"
  23. /* This routine is provided two arch_infos and works out which Score
  24. machine which would be compatible with both and returns a pointer
  25. to its info structure. */
  26. static const bfd_arch_info_type *
  27. compatible (const bfd_arch_info_type * a, const bfd_arch_info_type * b)
  28. {
  29. /* If a & b are for different architectures we can do nothing. */
  30. if (a->arch != b->arch)
  31. return NULL;
  32. if (a->mach != b->mach)
  33. return NULL;
  34. return a;
  35. }
  36. #define N(machine, print, default, next) \
  37. { \
  38. 32, /* Bits in a word. */ \
  39. 32, /* Bits in an address. */ \
  40. 8, /* Bits in a byte. */ \
  41. bfd_arch_score, \
  42. machine, /* Machine number. */ \
  43. "score", /* Architecture name. */ \
  44. print, /* Printable name. */ \
  45. 4, /* Section align power. */ \
  46. default, /* The default machine. */ \
  47. compatible, \
  48. bfd_default_scan, \
  49. bfd_arch_default_fill, \
  50. next, \
  51. 0 /* Maximum offset of a reloc from the start of an insn. */ \
  52. }
  53. static const bfd_arch_info_type arch_info_struct[] =
  54. {
  55. N (bfd_mach_score3, "score3", false, NULL),
  56. };
  57. const bfd_arch_info_type bfd_score_arch =
  58. N (bfd_mach_score7, "score7", true, & arch_info_struct[0]);