OLD | NEW |
1 /* BFD library support routines for the MSP architecture. | 1 /* BFD library support routines for the MSP architecture. |
2 Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc. | 2 Copyright (C) 2002, 2003, 2005, 2007, 2012 |
| 3 Free Software Foundation, Inc. |
3 Contributed by Dmitry Diky <diwil@mail.ru> | 4 Contributed by Dmitry Diky <diwil@mail.ru> |
4 | 5 |
5 This file is part of BFD, the Binary File Descriptor library. | 6 This file is part of BFD, the Binary File Descriptor library. |
6 | 7 |
7 This program is free software; you can redistribute it and/or modify | 8 This program is free software; you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 9 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation; either version 3 of the License, or | 10 the Free Software Foundation; either version 3 of the License, or |
10 (at your option) any later version. | 11 (at your option) any later version. |
11 | 12 |
12 This program is distributed in the hope that it will be useful, | 13 This program is distributed in the hope that it will be useful, |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 GNU General Public License for more details. | 16 GNU General Public License for more details. |
16 | 17 |
17 You should have received a copy of the GNU General Public License | 18 You should have received a copy of the GNU General Public License |
18 along with this program; if not, write to the Free Software | 19 along with this program; if not, write to the Free Software |
19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | 20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
20 MA 02110-1301, USA. */ | 21 MA 02110-1301, USA. */ |
21 | 22 |
22 #include "sysdep.h" | 23 #include "sysdep.h" |
23 #include "bfd.h" | 24 #include "bfd.h" |
24 #include "libbfd.h" | 25 #include "libbfd.h" |
25 | 26 |
26 static const bfd_arch_info_type *compatible | 27 /* This routine is provided two arch_infos and works out which MSP |
27 PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); | 28 machine which would be compatible with both and returns a pointer |
| 29 to its info structure. */ |
| 30 |
| 31 static const bfd_arch_info_type * |
| 32 compatible (const bfd_arch_info_type * a, |
| 33 » const bfd_arch_info_type * b) |
| 34 { |
| 35 /* If a & b are for different architectures we can do nothing. */ |
| 36 if (a->arch != b->arch) |
| 37 return NULL; |
| 38 |
| 39 if (a->mach <= b->mach) |
| 40 return b; |
| 41 |
| 42 return a; |
| 43 } |
28 | 44 |
29 #define N(addr_bits, machine, print, default, next) \ | 45 #define N(addr_bits, machine, print, default, next) \ |
30 { \ | 46 { \ |
31 16, /* 16 bits in a word. */ \ | 47 16, /* 16 bits in a word. */ \ |
32 addr_bits, /* Bits in an address. */ \ | 48 addr_bits, /* Bits in an address. */ \ |
33 8, /* 8 bits in a byte. */ \ | 49 8, /* 8 bits in a byte. */ \ |
34 bfd_arch_msp430, \ | 50 bfd_arch_msp430, \ |
35 machine, /* Machine number. */ \ | 51 machine, /* Machine number. */ \ |
36 "msp430", /* Architecture name. */ \ | 52 "msp430", /* Architecture name. */ \ |
37 print, /* Printable name. */ \ | 53 print, /* Printable name. */ \ |
38 1, /* Section align power. */ \ | 54 1, /* Section align power. */ \ |
39 default, /* The default machine. */ \ | 55 default, /* The default machine. */ \ |
40 compatible, \ | 56 compatible, \ |
41 bfd_default_scan, \ | 57 bfd_default_scan, \ |
| 58 bfd_arch_default_fill, \ |
42 next \ | 59 next \ |
43 } | 60 } |
44 | 61 |
45 static const bfd_arch_info_type arch_info_struct[] = | 62 static const bfd_arch_info_type arch_info_struct[] = |
46 { | 63 { |
47 /* msp430x11x. */ | 64 /* msp430x11x. */ |
48 N (16, bfd_mach_msp11, "msp:11", FALSE, & arch_info_struct[1]), | 65 N (16, bfd_mach_msp11, "msp:11", FALSE, & arch_info_struct[1]), |
49 | 66 |
50 /* msp430x11x1. */ | 67 /* msp430x11x1. */ |
51 N (16, bfd_mach_msp110, "msp:110", FALSE, & arch_info_struct[2]), | 68 N (16, bfd_mach_msp110, "msp:110", FALSE, & arch_info_struct[2]), |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 /* msp430x43x. */ | 103 /* msp430x43x. */ |
87 N (16, bfd_mach_msp43, "msp:43", FALSE, & arch_info_struct[14]), | 104 N (16, bfd_mach_msp43, "msp:43", FALSE, & arch_info_struct[14]), |
88 | 105 |
89 /* msp430x44x. */ | 106 /* msp430x44x. */ |
90 N (16, bfd_mach_msp43, "msp:44", FALSE, NULL) | 107 N (16, bfd_mach_msp43, "msp:44", FALSE, NULL) |
91 }; | 108 }; |
92 | 109 |
93 const bfd_arch_info_type bfd_msp430_arch = | 110 const bfd_arch_info_type bfd_msp430_arch = |
94 N (16, bfd_mach_msp14, "msp:14", TRUE, & arch_info_struct[0]); | 111 N (16, bfd_mach_msp14, "msp:14", TRUE, & arch_info_struct[0]); |
95 | 112 |
96 /* This routine is provided two arch_infos and works out which MSP | |
97 machine which would be compatible with both and returns a pointer | |
98 to its info structure. */ | |
99 | |
100 static const bfd_arch_info_type * | |
101 compatible (a,b) | |
102 const bfd_arch_info_type * a; | |
103 const bfd_arch_info_type * b; | |
104 { | |
105 /* If a & b are for different architectures we can do nothing. */ | |
106 if (a->arch != b->arch) | |
107 return NULL; | |
108 | |
109 if (a->mach <= b->mach) | |
110 return b; | |
111 | |
112 return a; | |
113 } | |
OLD | NEW |