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