1 /* Object attribute tags for PowerPC.
2 Copyright (C) 2008, 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 ppc_
37 #include "libebl_CPU.h"
38
39 bool
ppc_check_object_attribute(ebl,vendor,tag,value,tag_name,value_name)40 ppc_check_object_attribute (ebl, vendor, tag, value, tag_name, value_name)
41 Ebl *ebl __attribute__ ((unused));
42 const char *vendor;
43 int tag;
44 uint64_t value;
45 const char **tag_name;
46 const char **value_name;
47 {
48 if (!strcmp (vendor, "gnu"))
49 switch (tag)
50 {
51 case 4:
52 *tag_name = "GNU_Power_ABI_FP";
53 static const char *fp_kinds[] =
54 {
55 "Hard or soft float",
56 "Hard float",
57 "Soft float",
58 };
59 if (value < sizeof fp_kinds / sizeof fp_kinds[0])
60 *value_name = fp_kinds[value];
61 return true;
62
63 case 8:
64 *tag_name = "GNU_Power_ABI_Vector";
65 static const char *vector_kinds[] =
66 {
67 "Any", "Generic", "AltiVec", "SPE"
68 };
69 if (value < sizeof vector_kinds / sizeof vector_kinds[0])
70 *value_name = vector_kinds[value];
71 return true;
72
73 case 12:
74 *tag_name = "GNU_Power_ABI_Struct_Return";
75 static const char *struct_return_kinds[] =
76 {
77 "Any", "r3/r4", "Memory"
78 };
79 if (value < sizeof struct_return_kinds / sizeof struct_return_kinds[0])
80 *value_name = struct_return_kinds[value];
81 return true;
82 }
83
84 return false;
85 }
86
87 __typeof (ppc_check_object_attribute)
88 ppc64_check_object_attribute
89 __attribute__ ((alias ("ppc_check_object_attribute")));
90