Wed Oct 18 15:53:56 1995 steve chamberlain <sac@slash.cygnus.com>
[deliverable/binutils-gdb.git] / bfd / cpu-arc.c
CommitLineData
ae115e51
ILT
1/* BFD support for the ARC processor
2 Copyright 1994, 1995 Free Software Foundation, Inc.
3 Contributed by Doug Evans (dje@cygnus.com).
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#define ARC(mach, print_name, default_p) \
26{ \
27 32, /* 32 bits in a word */ \
28 32, /* 32 bits in an address */ \
29 8, /* 8 bits in a byte */ \
30 bfd_arch_arc, \
31 mach, \
32 "arc", \
33 print_name, \
34 4, /* section alignment power */ \
35 default_p, \
36 bfd_default_compatible, \
37 bfd_default_scan, \
38 0, \
39 }
40
41static bfd_arch_info_type arch_info_struct[] =
42{
43 ARC (bfd_mach_arc_base, "arc-base", true),
44 ARC (bfd_mach_arc_host, "arc-host", false),
45 ARC (bfd_mach_arc_graphics, "arc-graphics", false),
46 ARC (bfd_mach_arc_audio, "arc-audio", false),
47};
48
49void
50bfd_arc_arch ()
51{
52 register unsigned int i;
53
54 for (i = 0; i < sizeof (arch_info_struct) / sizeof (arch_info_struct[0]); i++)
55 bfd_arch_linkin (&arch_info_struct[i]);
56}
57\f
58/* Utility routines. */
59
60/* Given cpu type NAME, return its bfd_mach_arc_xxx value.
61 NAME is one of "base, audio, etc.".
62 Returns -1 if not found. */
63
64int
65arc_get_mach (name)
66 char *name;
67{
68 register unsigned int i;
69
70 for (i = 0; i < sizeof (arch_info_struct) / sizeof (arch_info_struct[0]); i++)
71 {
72 /* +4: skip over "arc-" */
73 if (strcmp (name, arch_info_struct[i].printable_name + 4) == 0)
74 return arch_info_struct[i].mach;
75 }
76 return -1;
77}
This page took 0.028534 seconds and 4 git commands to generate.