* configure.in: Call AM_PROG_LEX rather than AC_PROG_LEX and
[deliverable/binutils-gdb.git] / bfd / cpu-arm.c
CommitLineData
46686c78
NC
1/* BFD support for the ARM processor
2 Copyright 1994 Free Software Foundation, Inc.
3 Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
4
5This file is part of BFD, the Binary File Descriptor library.
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program; if not, write to the Free Software
19Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21#include "bfd.h"
22#include "sysdep.h"
23#include "libbfd.h"
24
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 */
28
29static const bfd_arch_info_type *
30compatible (a,b)
31 const bfd_arch_info_type * a;
32 const bfd_arch_info_type * b;
33{
34 /* For now keep things real simple - insist on matching architecture types */
35
36 return (a->arch != b->arch || a->mach != b->mach ) ? NULL : a ;
37}
38
39static struct
40{
41 enum bfd_architecture arch;
42 char * name;
43}
44processors[] =
45{
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" }
64};
65
66static boolean
67scan (info, string)
68 const struct bfd_arch_info * info;
69 const char * string;
70{
71 int i;
72
73 /* First test for an exact match */
74 if (strcasecmp (string, info->printable_name) == 0)
75 return true;
76
77 /* Next check for a processor name instead of an Architecture name */
78 for (i = sizeof (processors) / sizeof (processors[0]); i--;)
79 {
80 if (strcasecmp (string, processors[ i ].name) == 0)
81 break;
82 }
83
84 if (i != -1 && info->arch == processors[ i ].arch)
85 return true;
86
87 /* Finally check for the default architecture */
88 if (strcasecmp (string, "arm") == 0)
89 return info->the_default;
90
91 return false;
92}
93
94
95#define N(number, print, default, next) \
96{ 32, 32, 8, bfd_arch_arm, number, "arm", print, 4, default, compatible, scan, next }
97
98static const bfd_arch_info_type arch_info_struct[] =
99{
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 )
105};
106
107const bfd_arch_info_type bfd_arm_arch =
108 N( bfd_mach_arm_3M, "ARMv3M", true, & arch_info_struct[0] );
This page took 0.052096 seconds and 4 git commands to generate.