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