Back to index

cell-binutils  2.17cvs20070401
cpu-cris.c
Go to the documentation of this file.
00001 /* BFD support for the Axis CRIS architecture.
00002    Copyright 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
00003    Contributed by Axis Communications AB.
00004    Written by Hans-Peter Nilsson.
00005 
00006 This file is part of BFD, the Binary File Descriptor library.
00007 
00008 This program is free software; you can redistribute it and/or modify
00009 it under the terms of the GNU General Public License as published by
00010 the Free Software Foundation; either version 2 of the License, or
00011 (at your option) any later version.
00012 
00013 This program is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 GNU General Public License for more details.
00017 
00018 You should have received a copy of the GNU General Public License
00019 along with this program; if not, write to the Free Software
00020 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00021 
00022 #include "bfd.h"
00023 #include "sysdep.h"
00024 #include "libbfd.h"
00025 
00026 /* This routine is provided two arch_infos and returns the lowest common
00027    denominator.  CRIS v0..v10 vs. v32 are not compatible in general, but
00028    there's a compatible subset for which we provide an arch_info.  */
00029 
00030 static const bfd_arch_info_type * get_compatible
00031   PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
00032 
00033 static const bfd_arch_info_type *
00034 get_compatible (a,b)
00035      const bfd_arch_info_type *a;
00036      const bfd_arch_info_type *b;
00037 {
00038   /* Arches must match.  */
00039   if (a->arch != b->arch)
00040    return NULL;
00041 
00042   /* If either is the compatible mach, return the other.  */
00043   if (a->mach == bfd_mach_cris_v10_v32)
00044     return b;
00045   if (b->mach == bfd_mach_cris_v10_v32)
00046     return a;
00047 
00048 #if 0
00049   /* The code below is disabled but kept as a warning.
00050      See ldlang.c:lang_check.  Quite illogically, incompatible arches
00051      (as signalled by this function) are only *warned* about, while with
00052      this function signalling compatible ones, we can have the
00053      cris_elf_merge_private_bfd_data function return an error.  This is
00054      undoubtedly a FIXME: in general.  Also, the
00055      command_line.warn_mismatch flag and the --no-warn-mismatch option
00056      are misnamed for the multitude of ports that signal compatibility:
00057      it is there an error, not a warning.  We work around it by
00058      pretending matching machs here.  */
00059 
00060   /* Except for the compatible mach, machs must match.  */
00061   if (a->mach != b->mach)
00062     return NULL;
00063 #endif
00064 
00065   return a;
00066 }
00067 
00068 #define N(NUMBER, PRINT, NEXT)  \
00069  { 32, 32, 8, bfd_arch_cris, NUMBER, "cris", PRINT, 1, FALSE, \
00070    get_compatible, bfd_default_scan, NEXT }
00071 
00072 static const bfd_arch_info_type bfd_cris_arch_compat_v10_v32 =
00073  N (bfd_mach_cris_v10_v32, "cris:common_v10_v32", NULL);
00074 
00075 static const bfd_arch_info_type bfd_cris_arch_v32 =
00076  N (bfd_mach_cris_v32, "crisv32", &bfd_cris_arch_compat_v10_v32);
00077 
00078 const bfd_arch_info_type bfd_cris_arch =
00079 {
00080   32,                       /* There's 32 bits_per_word.  */
00081   32,                       /* There's 32 bits_per_address.  */
00082   8,                        /* There's 8 bits_per_byte.  */
00083   bfd_arch_cris,            /* One of enum bfd_architecture, defined
00084                                in archures.c and provided in
00085                                generated header files.  */
00086   bfd_mach_cris_v0_v10,            /* Random BFD-internal number for this
00087                                machine, similarly listed in
00088                                archures.c.  Not emitted in output.  */
00089   "cris",                   /* The arch_name.  */
00090   "cris",                   /* The printable name is the same.  */
00091   1,                        /* Section alignment power; each section
00092                                is aligned to (only) 2^1 bytes.  */
00093   TRUE,                            /* This is the default "machine".  */
00094   get_compatible,           /* A function for testing
00095                                "machine" compatibility of two
00096                                bfd_arch_info_type.  */
00097   bfd_default_scan,         /* Check if a bfd_arch_info_type is a
00098                                match.  */
00099   &bfd_cris_arch_v32        /* Pointer to next bfd_arch_info_type in
00100                                the same family.  */
00101 };
00102 
00103 /*
00104  * Local variables:
00105  * eval: (c-set-style "gnu")
00106  * indent-tabs-mode: t
00107  * End:
00108  */