1*7304104dSAndroid Build Coastguard Worker /* Object attribute tags for PowerPC.
2*7304104dSAndroid Build Coastguard Worker Copyright (C) 2008, 2009 Red Hat, Inc.
3*7304104dSAndroid Build Coastguard Worker This file is part of elfutils.
4*7304104dSAndroid Build Coastguard Worker
5*7304104dSAndroid Build Coastguard Worker This file is free software; you can redistribute it and/or modify
6*7304104dSAndroid Build Coastguard Worker it under the terms of either
7*7304104dSAndroid Build Coastguard Worker
8*7304104dSAndroid Build Coastguard Worker * the GNU Lesser General Public License as published by the Free
9*7304104dSAndroid Build Coastguard Worker Software Foundation; either version 3 of the License, or (at
10*7304104dSAndroid Build Coastguard Worker your option) any later version
11*7304104dSAndroid Build Coastguard Worker
12*7304104dSAndroid Build Coastguard Worker or
13*7304104dSAndroid Build Coastguard Worker
14*7304104dSAndroid Build Coastguard Worker * the GNU General Public License as published by the Free
15*7304104dSAndroid Build Coastguard Worker Software Foundation; either version 2 of the License, or (at
16*7304104dSAndroid Build Coastguard Worker your option) any later version
17*7304104dSAndroid Build Coastguard Worker
18*7304104dSAndroid Build Coastguard Worker or both in parallel, as here.
19*7304104dSAndroid Build Coastguard Worker
20*7304104dSAndroid Build Coastguard Worker elfutils is distributed in the hope that it will be useful, but
21*7304104dSAndroid Build Coastguard Worker WITHOUT ANY WARRANTY; without even the implied warranty of
22*7304104dSAndroid Build Coastguard Worker MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23*7304104dSAndroid Build Coastguard Worker General Public License for more details.
24*7304104dSAndroid Build Coastguard Worker
25*7304104dSAndroid Build Coastguard Worker You should have received copies of the GNU General Public License and
26*7304104dSAndroid Build Coastguard Worker the GNU Lesser General Public License along with this program. If
27*7304104dSAndroid Build Coastguard Worker not, see <http://www.gnu.org/licenses/>. */
28*7304104dSAndroid Build Coastguard Worker
29*7304104dSAndroid Build Coastguard Worker #ifdef HAVE_CONFIG_H
30*7304104dSAndroid Build Coastguard Worker # include <config.h>
31*7304104dSAndroid Build Coastguard Worker #endif
32*7304104dSAndroid Build Coastguard Worker
33*7304104dSAndroid Build Coastguard Worker #include <string.h>
34*7304104dSAndroid Build Coastguard Worker #include <dwarf.h>
35*7304104dSAndroid Build Coastguard Worker
36*7304104dSAndroid Build Coastguard Worker #define BACKEND ppc_
37*7304104dSAndroid Build Coastguard Worker #include "libebl_CPU.h"
38*7304104dSAndroid Build Coastguard Worker
39*7304104dSAndroid Build Coastguard Worker bool
ppc_check_object_attribute(Ebl * ebl,const char * vendor,int tag,uint64_t value,const char ** tag_name,const char ** value_name)40*7304104dSAndroid Build Coastguard Worker ppc_check_object_attribute (Ebl *ebl __attribute__ ((unused)),
41*7304104dSAndroid Build Coastguard Worker const char *vendor, int tag, uint64_t value,
42*7304104dSAndroid Build Coastguard Worker const char **tag_name, const char **value_name)
43*7304104dSAndroid Build Coastguard Worker {
44*7304104dSAndroid Build Coastguard Worker if (!strcmp (vendor, "gnu"))
45*7304104dSAndroid Build Coastguard Worker switch (tag)
46*7304104dSAndroid Build Coastguard Worker {
47*7304104dSAndroid Build Coastguard Worker case 4:
48*7304104dSAndroid Build Coastguard Worker *tag_name = "GNU_Power_ABI_FP";
49*7304104dSAndroid Build Coastguard Worker static const char *fp_kinds[] =
50*7304104dSAndroid Build Coastguard Worker {
51*7304104dSAndroid Build Coastguard Worker "Hard or soft float",
52*7304104dSAndroid Build Coastguard Worker "Hard float",
53*7304104dSAndroid Build Coastguard Worker "Soft float",
54*7304104dSAndroid Build Coastguard Worker "Single-precision hard float",
55*7304104dSAndroid Build Coastguard Worker };
56*7304104dSAndroid Build Coastguard Worker if (value < sizeof fp_kinds / sizeof fp_kinds[0])
57*7304104dSAndroid Build Coastguard Worker *value_name = fp_kinds[value];
58*7304104dSAndroid Build Coastguard Worker return true;
59*7304104dSAndroid Build Coastguard Worker
60*7304104dSAndroid Build Coastguard Worker case 8:
61*7304104dSAndroid Build Coastguard Worker *tag_name = "GNU_Power_ABI_Vector";
62*7304104dSAndroid Build Coastguard Worker static const char *vector_kinds[] =
63*7304104dSAndroid Build Coastguard Worker {
64*7304104dSAndroid Build Coastguard Worker "Any", "Generic", "AltiVec", "SPE"
65*7304104dSAndroid Build Coastguard Worker };
66*7304104dSAndroid Build Coastguard Worker if (value < sizeof vector_kinds / sizeof vector_kinds[0])
67*7304104dSAndroid Build Coastguard Worker *value_name = vector_kinds[value];
68*7304104dSAndroid Build Coastguard Worker return true;
69*7304104dSAndroid Build Coastguard Worker
70*7304104dSAndroid Build Coastguard Worker case 12:
71*7304104dSAndroid Build Coastguard Worker *tag_name = "GNU_Power_ABI_Struct_Return";
72*7304104dSAndroid Build Coastguard Worker static const char *struct_return_kinds[] =
73*7304104dSAndroid Build Coastguard Worker {
74*7304104dSAndroid Build Coastguard Worker "Any", "r3/r4", "Memory"
75*7304104dSAndroid Build Coastguard Worker };
76*7304104dSAndroid Build Coastguard Worker if (value < sizeof struct_return_kinds / sizeof struct_return_kinds[0])
77*7304104dSAndroid Build Coastguard Worker *value_name = struct_return_kinds[value];
78*7304104dSAndroid Build Coastguard Worker return true;
79*7304104dSAndroid Build Coastguard Worker }
80*7304104dSAndroid Build Coastguard Worker
81*7304104dSAndroid Build Coastguard Worker return false;
82*7304104dSAndroid Build Coastguard Worker }
83*7304104dSAndroid Build Coastguard Worker
84*7304104dSAndroid Build Coastguard Worker __typeof (ppc_check_object_attribute)
85*7304104dSAndroid Build Coastguard Worker ppc64_check_object_attribute
86*7304104dSAndroid Build Coastguard Worker __attribute__ ((alias ("ppc_check_object_attribute")));
87