2004-11-24 Paul Brook <paul@codesourcery.com>
[binutils.git] / bfd / cpu-cris.c
blobd15a2756aa833dc4d37fbea14c236e687d78e218
1 /* BFD support for the Axis CRIS architecture.
2 Copyright 2000, 2002 Free Software Foundation, Inc.
3 Contributed by Axis Communications AB.
4 Written by Hans-Peter Nilsson.
6 This file is part of BFD, the Binary File Descriptor library.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
22 #include "bfd.h"
23 #include "sysdep.h"
24 #include "libbfd.h"
26 /* This routine is provided two arch_infos and returns the lowest common
27 denominator. CRIS v0..v10 vs. v32 are not compatible in general, but
28 there's a compatible subset for which we provide an arch_info. */
30 static const bfd_arch_info_type * get_compatible
31 PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
33 static const bfd_arch_info_type *
34 get_compatible (a,b)
35 const bfd_arch_info_type *a;
36 const bfd_arch_info_type *b;
38 /* Arches must match. */
39 if (a->arch != b->arch)
40 return NULL;
42 /* If either is the compatible mach, return the other. */
43 if (a->mach == bfd_mach_cris_v10_v32)
44 return b;
45 if (b->mach == bfd_mach_cris_v10_v32)
46 return a;
48 #if 0
49 /* See ldlang.c:lang_check. Quite illogically, incompatible arches
50 (as signalled by this function) are only *warned* about, while with
51 this function signalling compatible ones, we can have the
52 cris_elf_merge_private_bfd_data function return an error. This is
53 undoubtedly a FIXME: in general. Also, the
54 command_line.warn_mismatch flag and the --no-warn-mismatch option
55 are misnamed for the multitude of ports that signal compatibility:
56 it is there an error, not a warning. We work around it by
57 pretending matching machs here. */
59 /* Except for the compatible mach, machs must match. */
60 if (a->mach != b->mach)
61 return NULL;
62 #endif
64 return a;
67 #define N(NUMBER, PRINT, NEXT) \
68 { 32, 32, 8, bfd_arch_cris, NUMBER, "cris", PRINT, 1, FALSE, \
69 get_compatible, bfd_default_scan, NEXT }
71 static const bfd_arch_info_type bfd_cris_arch_compat_v10_v32 =
72 N (bfd_mach_cris_v10_v32, "cris:common_v10_v32", NULL);
74 static const bfd_arch_info_type bfd_cris_arch_v32 =
75 N (bfd_mach_cris_v32, "crisv32", &bfd_cris_arch_compat_v10_v32);
77 const bfd_arch_info_type bfd_cris_arch =
79 32, /* There's 32 bits_per_word. */
80 32, /* There's 32 bits_per_address. */
81 8, /* There's 8 bits_per_byte. */
82 bfd_arch_cris, /* One of enum bfd_architecture, defined
83 in archures.c and provided in
84 generated header files. */
85 bfd_mach_cris_v0_v10, /* Random BFD-internal number for this
86 machine, similarly listed in
87 archures.c. Not emitted in output. */
88 "cris", /* The arch_name. */
89 "cris", /* The printable name is the same. */
90 1, /* Section alignment power; each section
91 is aligned to (only) 2^1 bytes. */
92 TRUE, /* This is the default "machine". */
93 get_compatible, /* A function for testing
94 "machine" compatibility of two
95 bfd_arch_info_type. */
96 bfd_default_scan, /* Check if a bfd_arch_info_type is a
97 match. */
98 &bfd_cris_arch_v32 /* Pointer to next bfd_arch_info_type in
99 the same family. */
103 * Local variables:
104 * eval: (c-set-style "gnu")
105 * indent-tabs-mode: t
106 * End: