* configure.in: Only define AIX_CORE_DUMPX_CORE when AIX version
[deliverable/binutils-gdb.git] / bfd / cpu-v850.c
CommitLineData
252b5132 1/* BFD support for the NEC V850 processor
e12dd2ea 2 Copyright 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
252b5132
RH
3
4This file is part of BFD, the Binary File Descriptor library.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19
20#include "bfd.h"
21#include "sysdep.h"
22#include "libbfd.h"
3882b010 23#include "safe-ctype.h"
252b5132 24
e12dd2ea
NC
25static boolean scan PARAMS ((const struct bfd_arch_info *, const char *));
26
71f6b586 27static boolean
252b5132
RH
28scan (info, string)
29 const struct bfd_arch_info * info;
30 const char * string;
31{
32 const char *ptr_src;
33 const char *ptr_tst;
34 unsigned long number;
35 enum bfd_architecture arch;
36
e12dd2ea 37 /* First test for an exact match. */
252b5132
RH
38 if (strcasecmp (string, info->printable_name) == 0)
39 return true;
40
41 /* See how much of the supplied string matches with the
42 architecture, eg the string m68k:68020 would match the m68k entry
e12dd2ea 43 up to the :, then we get left with the machine number. */
71f6b586 44 for (ptr_src = string, ptr_tst = info->arch_name;
252b5132 45 *ptr_src && *ptr_tst;
71f6b586 46 ptr_src++, ptr_tst++)
e12dd2ea
NC
47 if (*ptr_src != *ptr_tst)
48 break;
252b5132 49
e12dd2ea
NC
50 /* Chewed up as much of the architecture as will match;
51 if there is a colon present skip it. */
252b5132 52 if (*ptr_src == ':')
e12dd2ea 53 ptr_src ++;
71f6b586 54
252b5132 55 if (*ptr_src == 0)
e12dd2ea
NC
56 /* Nothing more, then only keep this one if it is
57 the default machine for this architecture. */
58 return info->the_default;
252b5132
RH
59
60 number = 0;
3882b010 61 while (ISDIGIT (*ptr_src))
252b5132
RH
62 {
63 number = number * 10 + * ptr_src - '0';
e12dd2ea 64 ptr_src ++;
252b5132
RH
65 }
66
71f6b586 67 switch (number)
252b5132
RH
68 {
69 case bfd_mach_v850e: arch = bfd_arch_v850; break;
70 case bfd_mach_v850ea: arch = bfd_arch_v850; break;
71f6b586 71 default:
252b5132
RH
72 return false;
73 }
74
71f6b586 75 if (arch != info->arch)
252b5132
RH
76 return false;
77
78 if (number != info->mach)
79 return false;
80
81 return true;
82}
83
84#define N(number, print, default, next) \
85{ 32, 32, 8, bfd_arch_v850, number, "v850", print, 2, default, \
86 bfd_default_compatible, scan, next }
87
88#define NEXT NULL
89
71f6b586 90static const bfd_arch_info_type arch_info_struct[] =
252b5132 91{
e12dd2ea 92 N (bfd_mach_v850e, "v850e", false, & arch_info_struct[1]),
252b5132
RH
93 N (bfd_mach_v850ea, "v850ea", false, NULL)
94};
95
e12dd2ea
NC
96#undef NEXT
97#define NEXT & arch_info_struct[0]
252b5132
RH
98
99const bfd_arch_info_type bfd_v850_arch =
100 N (bfd_mach_v850, "v850", true, NEXT);
This page took 0.176481 seconds and 4 git commands to generate.