• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #define KNOWN_VALUES(...) do				\
40   {							\
41     static const char *table[] = { __VA_ARGS__ };	\
42     if (value < sizeof table / sizeof table[0])		\
43       *value_name = table[value];			\
44   } while (0)
45 
46 bool
arm_check_object_attribute(Ebl * ebl,const char * vendor,int tag,uint64_t value,const char ** tag_name,const char ** value_name)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 {
51   if (!strcmp (vendor, "aeabi"))
52     switch (tag)
53       {
54       case 4:
55 	*tag_name = "CPU_raw_name";
56 	return true;
57       case 5:
58 	*tag_name = "CPU_name";
59 	return true;
60       case 6:
61 	*tag_name = "CPU_arch";
62 	KNOWN_VALUES ("Pre-v4",
63 		      "v4",
64 		      "v4T",
65 		      "v5T",
66 		      "v5TE",
67 		      "v5TEJ",
68 		      "v6",
69 		      "v6KZ",
70 		      "v6T2",
71 		      "v6K",
72 		      "v7",
73 		      "v6-M",
74 		      "v6S-M");
75 	return true;
76       case 7:
77 	*tag_name = "CPU_arch_profile";
78 	switch (value)
79 	  {
80 	  case 'A':
81 	    *value_name = "Application";
82 	    break;
83 	  case 'R':
84 	    *value_name = "Realtime";
85 	    break;
86 	  case 'M':
87 	    *value_name = "Microcontroller";
88 	    break;
89 	  }
90 	return true;
91       case 8:
92 	*tag_name = "ARM_ISA_use";
93 	KNOWN_VALUES ("No", "Yes");
94 	return true;
95       case 9:
96 	*tag_name = "THUMB_ISA_use";
97 	KNOWN_VALUES ("No", "Thumb-1", "Thumb-2");
98 	return true;
99       case 10:
100 	*tag_name = "VFP_arch";
101 	KNOWN_VALUES ("No", "VFPv1", "VFPv2", "VFPv3", "VFPv3-D16");
102 	return true;
103       case 11:
104 	*tag_name = "WMMX_arch";
105 	KNOWN_VALUES ("No", "WMMXv1", "WMMXv2");
106 	return true;
107       case 12:
108 	*tag_name = "Advanced_SIMD_arch";
109 	KNOWN_VALUES ("No", "NEONv1");
110 	return true;
111       case 13:
112 	*tag_name = "PCS_config";
113 	KNOWN_VALUES ("None",
114 		      "Bare platform",
115 		      "Linux application",
116 		      "Linux DSO",
117 		      "PalmOS 2004",
118 		      "PalmOS (reserved)",
119 		      "SymbianOS 2004",
120 		      "SymbianOS (reserved)");
121 	return true;
122       case 14:
123 	*tag_name = "ABI_PCS_R9_use";
124 	KNOWN_VALUES ("V6", "SB", "TLS", "Unused");
125 	return true;
126       case 15:
127 	*tag_name = "ABI_PCS_RW_data";
128 	KNOWN_VALUES ("Absolute", "PC-relative", "SB-relative", "None");
129 	return true;
130       case 16:
131 	*tag_name = "ABI_PCS_RO_data";
132 	KNOWN_VALUES ("Absolute", "PC-relative", "None");
133 	return true;
134       case 17:
135 	*tag_name = "ABI_PCS_GOT_use";
136 	KNOWN_VALUES ("None", "direct", "GOT-indirect");
137 	return true;
138       case 18:
139 	*tag_name = "ABI_PCS_wchar_t";
140 	return true;
141       case 19:
142 	*tag_name = "ABI_FP_rounding";
143 	KNOWN_VALUES ("Unused", "Needed");
144 	return true;
145       case 20:
146 	*tag_name = "ABI_FP_denormal";
147 	KNOWN_VALUES ("Unused", "Needed", "Sign only");
148 	return true;
149       case 21:
150 	*tag_name = "ABI_FP_exceptions";
151 	KNOWN_VALUES ("Unused", "Needed");
152 	return true;
153       case 22:
154 	*tag_name = "ABI_FP_user_exceptions";
155 	KNOWN_VALUES ("Unused", "Needed");
156 	return true;
157       case 23:
158 	*tag_name = "ABI_FP_number_model";
159 	KNOWN_VALUES ("Unused", "Finite", "RTABI", "IEEE 754");
160 	return true;
161       case 24:
162 	*tag_name = "ABI_align8_needed";
163 	KNOWN_VALUES ("No", "Yes", "4-byte");
164 	return true;
165       case 25:
166 	*tag_name = "ABI_align8_preserved";
167 	KNOWN_VALUES ("No", "Yes, except leaf SP", "Yes");
168 	return true;
169       case 26:
170 	*tag_name = "ABI_enum_size";
171 	KNOWN_VALUES ("Unused", "small", "int", "forced to int");
172 	return true;
173       case 27:
174 	*tag_name = "ABI_HardFP_use";
175 	KNOWN_VALUES ("as VFP_arch", "SP only", "DP only", "SP and DP");
176 	return true;
177       case 28:
178 	*tag_name = "ABI_VFP_args";
179 	KNOWN_VALUES ("AAPCS", "VFP registers", "custom");
180 	return true;
181       case 29:
182 	*tag_name = "ABI_WMMX_args";
183 	KNOWN_VALUES ("AAPCS", "WMMX registers", "custom");
184 	return true;
185       case 30:
186 	*tag_name = "ABI_optimization_goals";
187 	KNOWN_VALUES ("None",
188 		      "Prefer Speed",
189 		      "Aggressive Speed",
190 		      "Prefer Size",
191 		      "Aggressive Size",
192 		      "Prefer Debug",
193 		      "Aggressive Debug");
194 	return true;
195       case 31:
196 	*tag_name = "ABI_FP_optimization_goals";
197 	KNOWN_VALUES ("None",
198 		      "Prefer Speed",
199 		      "Aggressive Speed",
200 		      "Prefer Size",
201 		      "Aggressive Size",
202 		      "Prefer Accuracy",
203 		      "Aggressive Accuracy");
204 	return true;
205       case 34:
206 	*tag_name = "CPU_unaligned_access";
207 	KNOWN_VALUES ("None", "v6");
208 	return true;
209       case 36:
210 	*tag_name = "VFP_HP_extension";
211 	KNOWN_VALUES ("Not Allowed", "Allowed");
212 	return true;
213       case 38:
214 	*tag_name = "ABI_FP_16bit_format";
215 	KNOWN_VALUES ("None", "IEEE 754", "Alternative Format");
216 	return true;
217       case 64:
218 	*tag_name = "nodefaults";
219 	return true;
220       case 65:
221 	*tag_name = "also_compatible_with";
222 	return true;
223       case 66:
224 	*tag_name = "T2EE_use";
225 	KNOWN_VALUES ("Not Allowed", "Allowed");
226 	return true;
227       case 67:
228 	*tag_name = "conformance";
229 	return true;
230       case 68:
231 	*tag_name = "Virtualization_use";
232 	KNOWN_VALUES ("Not Allowed", "Allowed");
233 	return true;
234       case 70:
235 	*tag_name = "MPextension_use";
236 	KNOWN_VALUES ("Not Allowed", "Allowed");
237 	return true;
238       }
239 
240   return false;
241 }
242