1 /* BFD support for the ARM processor
2 Copyright 1994 Free Software Foundation, Inc.
3 Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
5 This file is part of BFD, the Binary File Descriptor library.
7 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 the Free Software Foundation; either version 2 of the License, or
10 (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.
17 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 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
25 /* This routine is provided two arch_infos and works out which ARM
26 machine which would be compatible with both and returns a pointer
27 to its info structure */
29 static const bfd_arch_info_type *
31 const bfd_arch_info_type * a;
32 const bfd_arch_info_type * b;
34 /* For now keep things real simple - insist on matching architecture types */
36 return (a->arch != b->arch || a->mach != b->mach ) ? NULL : a ;
41 enum bfd_architecture arch;
46 { bfd_mach_arm_2, "arm2" },
47 { bfd_mach_arm_2a, "arm250" },
48 { bfd_mach_arm_2a, "arm3" },
49 { bfd_mach_arm_3, "arm6" },
50 { bfd_mach_arm_3, "arm60" },
51 { bfd_mach_arm_3, "arm600" },
52 { bfd_mach_arm_3, "arm610" },
53 { bfd_mach_arm_3, "arm7" },
54 { bfd_mach_arm_3, "arm710" },
55 { bfd_mach_arm_3, "arm7500" },
56 { bfd_mach_arm_3, "arm7d" },
57 { bfd_mach_arm_3, "arm7di" },
58 { bfd_mach_arm_3M, "arm7dm" },
59 { bfd_mach_arm_3M, "arm7dmi" },
60 { bfd_mach_arm_4, "arm8" },
61 { bfd_mach_arm_4, "arm810" },
62 { bfd_mach_arm_4, "sa1" },
63 { bfd_mach_arm_4T, "arm7tdmi" }
68 const struct bfd_arch_info * info;
73 /* First test for an exact match */
74 if (strcasecmp (string, info->printable_name) == 0)
77 /* Next check for a processor name instead of an Architecture name */
78 for (i = sizeof (processors) / sizeof (processors[0]); i--;)
80 if (strcasecmp (string, processors[ i ].name) == 0)
84 if (i != -1 && info->arch == processors[ i ].arch)
87 /* Finally check for the default architecture */
88 if (strcasecmp (string, "arm") == 0)
89 return info->the_default;
95 #define N(number, print, default, next) \
96 { 32, 32, 8, bfd_arch_arm, number, "arm", print, 4, default, compatible, scan, next }
98 static const bfd_arch_info_type arch_info_struct[] =
100 N( bfd_mach_arm_2, "ARMv2", false, & arch_info_struct[1] ),
101 N( bfd_mach_arm_2a, "ARMv2a", false, & arch_info_struct[2] ),
102 N( bfd_mach_arm_3, "ARMv3", false, & arch_info_struct[3] ),
103 N( bfd_mach_arm_4, "ARMv4", false, & arch_info_struct[4] ),
104 N( bfd_mach_arm_4T, "ARMv4T", false, NULL )
107 const bfd_arch_info_type bfd_arm_arch =
108 N( bfd_mach_arm_3M, "ARMv3M", true, & arch_info_struct[0] );