cpu-tic4x.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* bfd back-end for TMS320C[34]x support
  2. Copyright (C) 1996-2022 Free Software Foundation, Inc.
  3. Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz)
  4. This file is part of BFD, the Binary File Descriptor library.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  16. MA 02110-1301, USA. */
  17. #include "sysdep.h"
  18. #include "bfd.h"
  19. #include "libbfd.h"
  20. static bool
  21. tic4x_scan (const struct bfd_arch_info *info,
  22. const char *string)
  23. {
  24. /* Allow strings of form [ti][Cc][34][0-9], let's not be too picky
  25. about strange numbered machines in C3x or C4x series. */
  26. if (string[0] == 't' && string[1] == 'i')
  27. string += 2;
  28. if (*string == 'C' || *string == 'c')
  29. string++;
  30. if (string[1] < '0' && string[1] > '9')
  31. return false;
  32. if (*string == '3')
  33. return (info->mach == bfd_mach_tic3x);
  34. else if (*string == '4')
  35. return info->mach == bfd_mach_tic4x;
  36. return false;
  37. }
  38. #define N(NUMBER, NAME, PRINT, DEFAULT, NEXT) \
  39. { \
  40. 32, /* Bits in a word. */ \
  41. 32, /* Bits in an address. */ \
  42. 32, /* Bits in a byte. */ \
  43. bfd_arch_tic4x, \
  44. NUMBER, \
  45. NAME, \
  46. PRINT, \
  47. 0, /* Section alignment power. */ \
  48. DEFAULT, \
  49. bfd_default_compatible, \
  50. tic4x_scan, \
  51. bfd_arch_default_fill, \
  52. NEXT, \
  53. 0 /* Maximum offset of a reloc from the start of an insn. */ \
  54. }
  55. const bfd_arch_info_type bfd_tic3x_arch =
  56. N (bfd_mach_tic3x, "tic3x", "tms320c3x", false, NULL);
  57. const bfd_arch_info_type bfd_tic4x_arch =
  58. N (bfd_mach_tic4x, "tic4x", "tms320c4x", true, &bfd_tic3x_arch);