Home | History | Annotate | Line # | Download | only in bfd
cpu-arc.c revision 1.6
      1  1.1  christos /* BFD support for the ARC processor
      2  1.6  christos    Copyright (C) 1994-2016 Free Software Foundation, Inc.
      3  1.1  christos    Contributed by Doug Evans (dje (at) cygnus.com).
      4  1.1  christos 
      5  1.1  christos    This file is part of BFD, the Binary File Descriptor library.
      6  1.1  christos 
      7  1.1  christos    This program is free software; you can redistribute it and/or modify
      8  1.1  christos    it under the terms of the GNU General Public License as published by
      9  1.1  christos    the Free Software Foundation; either version 3 of the License, or
     10  1.1  christos    (at your option) any later version.
     11  1.1  christos 
     12  1.1  christos    This program is distributed in the hope that it will be useful,
     13  1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15  1.1  christos    GNU General Public License for more details.
     16  1.1  christos 
     17  1.1  christos    You should have received a copy of the GNU General Public License
     18  1.1  christos    along with this program; if not, write to the Free Software
     19  1.1  christos    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
     20  1.1  christos    MA 02110-1301, USA.  */
     21  1.1  christos 
     22  1.1  christos #include "sysdep.h"
     23  1.1  christos #include "bfd.h"
     24  1.1  christos #include "libbfd.h"
     25  1.1  christos 
     26  1.1  christos #define ARC(mach, print_name, default_p, next) \
     27  1.1  christos {					\
     28  1.1  christos     32,	/* 32 bits in a word  */	\
     29  1.1  christos     32,	/* 32 bits in an address  */	\
     30  1.1  christos     8,	/* 8 bits in a byte  */		\
     31  1.1  christos     bfd_arch_arc,			\
     32  1.1  christos     mach,				\
     33  1.1  christos     "arc",				\
     34  1.1  christos     print_name,				\
     35  1.1  christos     4, /* section alignment power  */	\
     36  1.1  christos     default_p,				\
     37  1.1  christos     bfd_default_compatible,		\
     38  1.1  christos     bfd_default_scan,			\
     39  1.1  christos     bfd_arch_default_fill,		\
     40  1.1  christos     next,				\
     41  1.1  christos   }
     42  1.1  christos 
     43  1.1  christos static const bfd_arch_info_type arch_info_struct[] =
     44  1.1  christos {
     45  1.6  christos   ARC (bfd_mach_arc_arc600, "ARC600", FALSE, &arch_info_struct[1]),
     46  1.6  christos   ARC (bfd_mach_arc_arc600, "A6"    , FALSE, &arch_info_struct[2]),
     47  1.6  christos   ARC (bfd_mach_arc_arc601, "ARC601", FALSE, &arch_info_struct[3]),
     48  1.6  christos   ARC (bfd_mach_arc_arc700, "ARC700", FALSE, &arch_info_struct[4]),
     49  1.6  christos   ARC (bfd_mach_arc_arc700, "A7",     FALSE, &arch_info_struct[5]),
     50  1.6  christos   ARC (bfd_mach_arc_arcv2,  "ARCv2",  FALSE, &arch_info_struct[6]),
     51  1.6  christos   ARC (bfd_mach_arc_arcv2,  "EM",     FALSE, &arch_info_struct[7]),
     52  1.6  christos   ARC (bfd_mach_arc_arcv2,  "HS",     FALSE, NULL),
     53  1.1  christos };
     54  1.1  christos 
     55  1.1  christos const bfd_arch_info_type bfd_arc_arch =
     56  1.6  christos   ARC (bfd_mach_arc_arc600, "ARC600", TRUE, &arch_info_struct[0]);
     57  1.1  christos 
     58  1.1  christos /* Utility routines.  */
     59  1.1  christos 
     60  1.1  christos /* Given cpu type NAME, return its bfd_mach_arc_xxx value.
     61  1.1  christos    Returns -1 if not found.  */
     62  1.6  christos int arc_get_mach (char *name);
     63  1.1  christos 
     64  1.1  christos int
     65  1.1  christos arc_get_mach (char *name)
     66  1.1  christos {
     67  1.1  christos   const bfd_arch_info_type *p;
     68  1.1  christos 
     69  1.1  christos   for (p = &bfd_arc_arch; p != NULL; p = p->next)
     70  1.1  christos     if (strcmp (name, p->printable_name) == 0)
     71  1.1  christos       return p->mach;
     72  1.1  christos   return -1;
     73  1.1  christos }
     74