/src/elfutils/backends/arm_attrs.c
Line | Count | Source |
1 | | /* Object attribute tags for ARM. |
2 | | Copyright (C) 2009 Red Hat, Inc. |
3 | | This file is part of elfutils. |
4 | | |
5 | | This file is free software; you can redistribute it and/or modify |
6 | | it under the terms of either |
7 | | |
8 | | * the GNU Lesser General Public License as published by the Free |
9 | | Software Foundation; either version 3 of the License, or (at |
10 | | your option) any later version |
11 | | |
12 | | or |
13 | | |
14 | | * the GNU General Public License as published by the Free |
15 | | Software Foundation; either version 2 of the License, or (at |
16 | | your option) any later version |
17 | | |
18 | | or both in parallel, as here. |
19 | | |
20 | | elfutils is distributed in the hope that it will be useful, but |
21 | | WITHOUT ANY WARRANTY; without even the implied warranty of |
22 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
23 | | General Public License for more details. |
24 | | |
25 | | You should have received copies of the GNU General Public License and |
26 | | the GNU Lesser General Public License along with this program. If |
27 | | not, see <http://www.gnu.org/licenses/>. */ |
28 | | |
29 | | #ifdef HAVE_CONFIG_H |
30 | | # include <config.h> |
31 | | #endif |
32 | | |
33 | | #include <string.h> |
34 | | #include <dwarf.h> |
35 | | |
36 | | #define BACKEND arm_ |
37 | | #include "libebl_CPU.h" |
38 | | |
39 | 0 | #define KNOWN_VALUES(...) do \ |
40 | 0 | { \ |
41 | 0 | static const char *table[] = { __VA_ARGS__ }; \ |
42 | 0 | if (value < sizeof table / sizeof table[0]) \ |
43 | 0 | *value_name = table[value]; \ |
44 | 0 | } while (0) |
45 | | |
46 | | bool |
47 | | arm_check_object_attribute (Ebl *ebl __attribute__ ((unused)), |
48 | | const char *vendor, int tag, uint64_t value, |
49 | | const char **tag_name, const char **value_name) |
50 | 0 | { |
51 | 0 | if (!strcmp (vendor, "aeabi")) |
52 | 0 | switch (tag) |
53 | 0 | { |
54 | 0 | case 4: |
55 | 0 | *tag_name = "CPU_raw_name"; |
56 | 0 | return true; |
57 | 0 | case 5: |
58 | 0 | *tag_name = "CPU_name"; |
59 | 0 | return true; |
60 | 0 | case 6: |
61 | 0 | *tag_name = "CPU_arch"; |
62 | 0 | KNOWN_VALUES ("Pre-v4", |
63 | 0 | "v4", |
64 | 0 | "v4T", |
65 | 0 | "v5T", |
66 | 0 | "v5TE", |
67 | 0 | "v5TEJ", |
68 | 0 | "v6", |
69 | 0 | "v6KZ", |
70 | 0 | "v6T2", |
71 | 0 | "v6K", |
72 | 0 | "v7", |
73 | 0 | "v6-M", |
74 | 0 | "v6S-M"); |
75 | 0 | return true; |
76 | 0 | case 7: |
77 | 0 | *tag_name = "CPU_arch_profile"; |
78 | 0 | switch (value) |
79 | 0 | { |
80 | 0 | case 'A': |
81 | 0 | *value_name = "Application"; |
82 | 0 | break; |
83 | 0 | case 'R': |
84 | 0 | *value_name = "Realtime"; |
85 | 0 | break; |
86 | 0 | case 'M': |
87 | 0 | *value_name = "Microcontroller"; |
88 | 0 | break; |
89 | 0 | } |
90 | 0 | return true; |
91 | 0 | case 8: |
92 | 0 | *tag_name = "ARM_ISA_use"; |
93 | 0 | KNOWN_VALUES ("No", "Yes"); |
94 | 0 | return true; |
95 | 0 | case 9: |
96 | 0 | *tag_name = "THUMB_ISA_use"; |
97 | 0 | KNOWN_VALUES ("No", "Thumb-1", "Thumb-2"); |
98 | 0 | return true; |
99 | 0 | case 10: |
100 | 0 | *tag_name = "VFP_arch"; |
101 | 0 | KNOWN_VALUES ("No", "VFPv1", "VFPv2", "VFPv3", "VFPv3-D16"); |
102 | 0 | return true; |
103 | 0 | case 11: |
104 | 0 | *tag_name = "WMMX_arch"; |
105 | 0 | KNOWN_VALUES ("No", "WMMXv1", "WMMXv2"); |
106 | 0 | return true; |
107 | 0 | case 12: |
108 | 0 | *tag_name = "Advanced_SIMD_arch"; |
109 | 0 | KNOWN_VALUES ("No", "NEONv1"); |
110 | 0 | return true; |
111 | 0 | case 13: |
112 | 0 | *tag_name = "PCS_config"; |
113 | 0 | KNOWN_VALUES ("None", |
114 | 0 | "Bare platform", |
115 | 0 | "Linux application", |
116 | 0 | "Linux DSO", |
117 | 0 | "PalmOS 2004", |
118 | 0 | "PalmOS (reserved)", |
119 | 0 | "SymbianOS 2004", |
120 | 0 | "SymbianOS (reserved)"); |
121 | 0 | return true; |
122 | 0 | case 14: |
123 | 0 | *tag_name = "ABI_PCS_R9_use"; |
124 | 0 | KNOWN_VALUES ("V6", "SB", "TLS", "Unused"); |
125 | 0 | return true; |
126 | 0 | case 15: |
127 | 0 | *tag_name = "ABI_PCS_RW_data"; |
128 | 0 | KNOWN_VALUES ("Absolute", "PC-relative", "SB-relative", "None"); |
129 | 0 | return true; |
130 | 0 | case 16: |
131 | 0 | *tag_name = "ABI_PCS_RO_data"; |
132 | 0 | KNOWN_VALUES ("Absolute", "PC-relative", "None"); |
133 | 0 | return true; |
134 | 0 | case 17: |
135 | 0 | *tag_name = "ABI_PCS_GOT_use"; |
136 | 0 | KNOWN_VALUES ("None", "direct", "GOT-indirect"); |
137 | 0 | return true; |
138 | 0 | case 18: |
139 | 0 | *tag_name = "ABI_PCS_wchar_t"; |
140 | 0 | return true; |
141 | 0 | case 19: |
142 | 0 | *tag_name = "ABI_FP_rounding"; |
143 | 0 | KNOWN_VALUES ("Unused", "Needed"); |
144 | 0 | return true; |
145 | 0 | case 20: |
146 | 0 | *tag_name = "ABI_FP_denormal"; |
147 | 0 | KNOWN_VALUES ("Unused", "Needed", "Sign only"); |
148 | 0 | return true; |
149 | 0 | case 21: |
150 | 0 | *tag_name = "ABI_FP_exceptions"; |
151 | 0 | KNOWN_VALUES ("Unused", "Needed"); |
152 | 0 | return true; |
153 | 0 | case 22: |
154 | 0 | *tag_name = "ABI_FP_user_exceptions"; |
155 | 0 | KNOWN_VALUES ("Unused", "Needed"); |
156 | 0 | return true; |
157 | 0 | case 23: |
158 | 0 | *tag_name = "ABI_FP_number_model"; |
159 | 0 | KNOWN_VALUES ("Unused", "Finite", "RTABI", "IEEE 754"); |
160 | 0 | return true; |
161 | 0 | case 24: |
162 | 0 | *tag_name = "ABI_align8_needed"; |
163 | 0 | KNOWN_VALUES ("No", "Yes", "4-byte"); |
164 | 0 | return true; |
165 | 0 | case 25: |
166 | 0 | *tag_name = "ABI_align8_preserved"; |
167 | 0 | KNOWN_VALUES ("No", "Yes, except leaf SP", "Yes"); |
168 | 0 | return true; |
169 | 0 | case 26: |
170 | 0 | *tag_name = "ABI_enum_size"; |
171 | 0 | KNOWN_VALUES ("Unused", "small", "int", "forced to int"); |
172 | 0 | return true; |
173 | 0 | case 27: |
174 | 0 | *tag_name = "ABI_HardFP_use"; |
175 | 0 | KNOWN_VALUES ("as VFP_arch", "SP only", "DP only", "SP and DP"); |
176 | 0 | return true; |
177 | 0 | case 28: |
178 | 0 | *tag_name = "ABI_VFP_args"; |
179 | 0 | KNOWN_VALUES ("AAPCS", "VFP registers", "custom"); |
180 | 0 | return true; |
181 | 0 | case 29: |
182 | 0 | *tag_name = "ABI_WMMX_args"; |
183 | 0 | KNOWN_VALUES ("AAPCS", "WMMX registers", "custom"); |
184 | 0 | return true; |
185 | 0 | case 30: |
186 | 0 | *tag_name = "ABI_optimization_goals"; |
187 | 0 | KNOWN_VALUES ("None", |
188 | 0 | "Prefer Speed", |
189 | 0 | "Aggressive Speed", |
190 | 0 | "Prefer Size", |
191 | 0 | "Aggressive Size", |
192 | 0 | "Prefer Debug", |
193 | 0 | "Aggressive Debug"); |
194 | 0 | return true; |
195 | 0 | case 31: |
196 | 0 | *tag_name = "ABI_FP_optimization_goals"; |
197 | 0 | KNOWN_VALUES ("None", |
198 | 0 | "Prefer Speed", |
199 | 0 | "Aggressive Speed", |
200 | 0 | "Prefer Size", |
201 | 0 | "Aggressive Size", |
202 | 0 | "Prefer Accuracy", |
203 | 0 | "Aggressive Accuracy"); |
204 | 0 | return true; |
205 | 0 | case 34: |
206 | 0 | *tag_name = "CPU_unaligned_access"; |
207 | 0 | KNOWN_VALUES ("None", "v6"); |
208 | 0 | return true; |
209 | 0 | case 36: |
210 | 0 | *tag_name = "VFP_HP_extension"; |
211 | 0 | KNOWN_VALUES ("Not Allowed", "Allowed"); |
212 | 0 | return true; |
213 | 0 | case 38: |
214 | 0 | *tag_name = "ABI_FP_16bit_format"; |
215 | 0 | KNOWN_VALUES ("None", "IEEE 754", "Alternative Format"); |
216 | 0 | return true; |
217 | 0 | case 64: |
218 | 0 | *tag_name = "nodefaults"; |
219 | 0 | return true; |
220 | 0 | case 65: |
221 | 0 | *tag_name = "also_compatible_with"; |
222 | 0 | return true; |
223 | 0 | case 66: |
224 | 0 | *tag_name = "T2EE_use"; |
225 | 0 | KNOWN_VALUES ("Not Allowed", "Allowed"); |
226 | 0 | return true; |
227 | 0 | case 67: |
228 | 0 | *tag_name = "conformance"; |
229 | 0 | return true; |
230 | 0 | case 68: |
231 | 0 | *tag_name = "Virtualization_use"; |
232 | 0 | KNOWN_VALUES ("Not Allowed", "Allowed"); |
233 | 0 | return true; |
234 | 0 | case 70: |
235 | 0 | *tag_name = "MPextension_use"; |
236 | 0 | KNOWN_VALUES ("Not Allowed", "Allowed"); |
237 | 0 | return true; |
238 | 0 | } |
239 | | |
240 | 0 | return false; |
241 | 0 | } |