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