* binutils-all/readelf.exp: Don't regard mips*el-*-* as traditional
[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"
23
24#include <ctype.h>
25
e12dd2ea
NC
26static boolean scan PARAMS ((const struct bfd_arch_info *, const char *));
27
71f6b586 28static boolean
252b5132
RH
29scan (info, string)
30 const struct bfd_arch_info * info;
31 const char * string;
32{
33 const char *ptr_src;
34 const char *ptr_tst;
35 unsigned long number;
36 enum bfd_architecture arch;
37
e12dd2ea 38 /* First test for an exact match. */
252b5132
RH
39 if (strcasecmp (string, info->printable_name) == 0)
40 return true;
41
42 /* See how much of the supplied string matches with the
43 architecture, eg the string m68k:68020 would match the m68k entry
e12dd2ea 44 up to the :, then we get left with the machine number. */
71f6b586 45 for (ptr_src = string, ptr_tst = info->arch_name;
252b5132 46 *ptr_src && *ptr_tst;
71f6b586 47 ptr_src++, ptr_tst++)
e12dd2ea
NC
48 if (*ptr_src != *ptr_tst)
49 break;
252b5132 50
e12dd2ea
NC
51 /* Chewed up as much of the architecture as will match;
52 if there is a colon present skip it. */
252b5132 53 if (*ptr_src == ':')
e12dd2ea 54 ptr_src ++;
71f6b586 55
252b5132 56 if (*ptr_src == 0)
e12dd2ea
NC
57 /* Nothing more, then only keep this one if it is
58 the default machine for this architecture. */
59 return info->the_default;
252b5132
RH
60
61 number = 0;
62 while (isdigit ((unsigned char) *ptr_src))
63 {
64 number = number * 10 + * ptr_src - '0';
e12dd2ea 65 ptr_src ++;
252b5132
RH
66 }
67
71f6b586 68 switch (number)
252b5132
RH
69 {
70 case bfd_mach_v850e: arch = bfd_arch_v850; break;
71 case bfd_mach_v850ea: arch = bfd_arch_v850; break;
71f6b586 72 default:
252b5132
RH
73 return false;
74 }
75
71f6b586 76 if (arch != info->arch)
252b5132
RH
77 return false;
78
79 if (number != info->mach)
80 return false;
81
82 return true;
83}
84
85#define N(number, print, default, next) \
86{ 32, 32, 8, bfd_arch_v850, number, "v850", print, 2, default, \
87 bfd_default_compatible, scan, next }
88
89#define NEXT NULL
90
71f6b586 91static const bfd_arch_info_type arch_info_struct[] =
252b5132 92{
e12dd2ea 93 N (bfd_mach_v850e, "v850e", false, & arch_info_struct[1]),
252b5132
RH
94 N (bfd_mach_v850ea, "v850ea", false, NULL)
95};
96
e12dd2ea
NC
97#undef NEXT
98#define NEXT & arch_info_struct[0]
252b5132
RH
99
100const bfd_arch_info_type bfd_v850_arch =
101 N (bfd_mach_v850, "v850", true, NEXT);
This page took 0.090826 seconds and 4 git commands to generate.