summaryrefslogtreecommitdiff
path: root/backends/arm_attrs.c
blob: 84f4d451d0b3a4d4deab800c94767a99fb9ee0fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
/* Object attribute tags for ARM.
   Copyright (C) 2009 Red Hat, Inc.
   This file is part of Red Hat elfutils.

   Red Hat elfutils is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by the
   Free Software Foundation; version 2 of the License.

   Red Hat elfutils is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public License along
   with Red Hat elfutils; if not, write to the Free Software Foundation,
   Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.

   Red Hat elfutils is an included package of the Open Invention Network.
   An included package of the Open Invention Network is a package for which
   Open Invention Network licensees cross-license their patents.  No patent
   license is granted, either expressly or impliedly, by designation as an
   included package.  Should you wish to participate in the Open Invention
   Network licensing program, please visit www.openinventionnetwork.com
   <http://www.openinventionnetwork.com>.  */

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <string.h>
#include <dwarf.h>

#define BACKEND arm_
#include "libebl_CPU.h"

#define KNOWN_VALUES(...) do				\
  {							\
    static const char *table[] = { __VA_ARGS__ };	\
    if (value < sizeof table / sizeof table[0])		\
      *value_name = table[value];			\
  } while (0)

bool
arm_check_object_attribute (ebl, vendor, tag, value, tag_name, value_name)
     Ebl *ebl __attribute__ ((unused));
     const char *vendor;
     int tag;
     uint64_t value __attribute__ ((unused));
     const char **tag_name;
     const char **value_name;
{
  if (!strcmp (vendor, "aeabi"))
    switch (tag)
      {
      case 4:
	*tag_name = "CPU_raw_name";
	return true;
      case 5:
	*tag_name = "CPU_name";
	return true;
      case 6:
	*tag_name = "CPU_arch";
	KNOWN_VALUES ("Pre-v4",
		      "v4",
		      "v4T",
		      "v5T",
		      "v5TE",
		      "v5TEJ",
		      "v6",
		      "v6KZ",
		      "v6T2",
		      "v6K",
		      "v7",
		      "v6-M",
		      "v6S-M");
	return true;
      case 7:
	*tag_name = "CPU_arch_profile";
	switch (value)
	  {
	  case 'A':
	    *value_name = "Application";
	    break;
	  case 'R':
	    *value_name = "Realtime";
	    break;
	  case 'M':
	    *value_name = "Microcontroller";
	    break;
	  }
	return true;
      case 8:
	*tag_name = "ARM_ISA_use";
	KNOWN_VALUES ("No", "Yes");
	return true;
      case 9:
	*tag_name = "THUMB_ISA_use";
	KNOWN_VALUES ("No", "Thumb-1", "Thumb-2");
	return true;
      case 10:
	*tag_name = "VFP_arch";
	KNOWN_VALUES ("No", "VFPv1", "VFPv2", "VFPv3", "VFPv3-D16");
	return true;
      case 11:
	*tag_name = "WMMX_arch";
	KNOWN_VALUES ("No", "WMMXv1", "WMMXv2");
	return true;
      case 12:
	*tag_name = "Advanced_SIMD_arch";
	KNOWN_VALUES ("No", "NEONv1");
	return true;
      case 13:
	*tag_name = "PCS_config";
	KNOWN_VALUES ("None",
		      "Bare platform",
		      "Linux application",
		      "Linux DSO",
		      "PalmOS 2004",
		      "PalmOS (reserved)",
		      "SymbianOS 2004",
		      "SymbianOS (reserved)");
	return true;
      case 14:
	*tag_name = "ABI_PCS_R9_use";
	KNOWN_VALUES ("V6", "SB", "TLS", "Unused");
	return true;
      case 15:
	*tag_name = "ABI_PCS_RW_data";
	KNOWN_VALUES ("Absolute", "PC-relative", "SB-relative", "None");
	return true;
      case 16:
	*tag_name = "ABI_PCS_RO_data";
	KNOWN_VALUES ("Absolute", "PC-relative", "None");
	return true;
      case 17:
	*tag_name = "ABI_PCS_GOT_use";
	KNOWN_VALUES ("None", "direct", "GOT-indirect");
	return true;
      case 18:
	*tag_name = "ABI_PCS_wchar_t";
	return true;
      case 19:
	*tag_name = "ABI_FP_rounding";
	KNOWN_VALUES ("Unused", "Needed");
	return true;
      case 20:
	*tag_name = "ABI_FP_denormal";
	KNOWN_VALUES ("Unused", "Needed", "Sign only");
	return true;
      case 21:
	*tag_name = "ABI_FP_exceptions";
	KNOWN_VALUES ("Unused", "Needed");
	return true;
      case 22:
	*tag_name = "ABI_FP_user_exceptions";
	KNOWN_VALUES ("Unused", "Needed");
	return true;
      case 23:
	*tag_name = "ABI_FP_number_model";
	KNOWN_VALUES ("Unused", "Finite", "RTABI", "IEEE 754");
	return true;
      case 24:
	*tag_name = "ABI_align8_needed";
	KNOWN_VALUES ("No", "Yes", "4-byte");
	return true;
      case 25:
	*tag_name = "ABI_align8_preserved";
	KNOWN_VALUES ("No", "Yes, except leaf SP", "Yes");
	return true;
      case 26:
	*tag_name = "ABI_enum_size";
	KNOWN_VALUES ("Unused", "small", "int", "forced to int");
	return true;
      case 27:
	*tag_name = "ABI_HardFP_use";
	KNOWN_VALUES ("as VFP_arch", "SP only", "DP only", "SP and DP");
	return true;
      case 28:
	*tag_name = "ABI_VFP_args";
	KNOWN_VALUES ("AAPCS", "VFP registers", "custom");
	return true;
      case 29:
	*tag_name = "ABI_WMMX_args";
	KNOWN_VALUES ("AAPCS", "WMMX registers", "custom");
	return true;
      case 30:
	*tag_name = "ABI_optimization_goals";
	KNOWN_VALUES ("None",
		      "Prefer Speed",
		      "Aggressive Speed",
		      "Prefer Size",
		      "Aggressive Size",
		      "Prefer Debug",
		      "Aggressive Debug");
	return true;
      case 31:
	*tag_name = "ABI_FP_optimization_goals";
	KNOWN_VALUES ("None",
		      "Prefer Speed",
		      "Aggressive Speed",
		      "Prefer Size",
		      "Aggressive Size",
		      "Prefer Accuracy",
		      "Aggressive Accuracy");
	return true;
      case 34:
	*tag_name = "CPU_unaligned_access";
	KNOWN_VALUES ("None", "v6");
	return true;
      case 36:
	*tag_name = "VFP_HP_extension";
	KNOWN_VALUES ("Not Allowed", "Allowed");
	return true;
      case 38:
	*tag_name = "ABI_FP_16bit_format";
	KNOWN_VALUES ("None", "IEEE 754", "Alternative Format");
	return true;
      case 64:
	*tag_name = "nodefaults";
	return true;
      case 65:
	*tag_name = "also_compatible_with";
	return true;
      case 66:
	*tag_name = "T2EE_use";
	KNOWN_VALUES ("Not Allowed", "Allowed");
	return true;
      case 67:
	*tag_name = "conformance";
	return true;
      case 68:
	*tag_name = "Virtualization_use";
	KNOWN_VALUES ("Not Allowed", "Allowed");
	return true;
      case 70:
	*tag_name = "MPextension_use";
	KNOWN_VALUES ("Not Allowed", "Allowed");
	return true;
      }

  return false;
}