ppc_attrs.c revision 059c83e5db89955913a39fe6705acca571c32c3f
1059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath/* Object attribute tags for PowerPC. 2059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath Copyright (C) 2008 Red Hat, Inc. 3059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath This file is part of Red Hat elfutils. 4059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 5059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath Red Hat elfutils is free software; you can redistribute it and/or modify 6059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath it under the terms of the GNU General Public License as published by the 7059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath Free Software Foundation; version 2 of the License. 8059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 9059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath Red Hat elfutils is distributed in the hope that it will be useful, but 10059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath WITHOUT ANY WARRANTY; without even the implied warranty of 11059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath General Public License for more details. 13059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 14059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath You should have received a copy of the GNU General Public License along 15059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath with Red Hat elfutils; if not, write to the Free Software Foundation, 16059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. 17059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 18059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath Red Hat elfutils is an included package of the Open Invention Network. 19059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath An included package of the Open Invention Network is a package for which 20059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath Open Invention Network licensees cross-license their patents. No patent 21059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath license is granted, either expressly or impliedly, by designation as an 22059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath included package. Should you wish to participate in the Open Invention 23059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath Network licensing program, please visit www.openinventionnetwork.com 24059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath <http://www.openinventionnetwork.com>. */ 25059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 26059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath#ifdef HAVE_CONFIG_H 27059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath# include <config.h> 28059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath#endif 29059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 30059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath#include <string.h> 31059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath#include <dwarf.h> 32059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 33059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath#define BACKEND ppc_ 34059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath#include "libebl_CPU.h" 35059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 36059c83e5db89955913a39fe6705acca571c32c3fRoland McGrathbool 37059c83e5db89955913a39fe6705acca571c32c3fRoland McGrathppc_check_object_attribute (ebl, vendor, tag, value, tag_name, value_name) 38059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath Ebl *ebl __attribute__ ((unused)); 39059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath const char *vendor; 40059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath int tag; 41059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath uint64_t value; 42059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath const char **tag_name; 43059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath const char **value_name; 44059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath{ 45059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath if (!strcmp (vendor, "gnu")) 46059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath switch (tag) 47059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath { 48059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath case 4: 49059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath *tag_name = "GNU_Power_ABI_FP"; 50059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath static const char *fp_kinds[] = 51059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath { 52059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath "Hard or soft float", 53059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath "Hard float", 54059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath "Soft float", 55059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath }; 56059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath if (value < sizeof fp_kinds / sizeof fp_kinds[0]) 57059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath *value_name = fp_kinds[value]; 58059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath return true; 59059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 60059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath case 8: 61059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath *tag_name = "GNU_Power_ABI_Vector"; 62059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath static const char *vector_kinds[] = 63059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath { 64059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath "Any", "Generic", "AltiVec", "SPE" 65059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath }; 66059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath if (value < sizeof vector_kinds / sizeof vector_kinds[0]) 67059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath *value_name = vector_kinds[value]; 68059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath return true; 69059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath } 70059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 71059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath return false; 72059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath} 73059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 74059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath__typeof (ppc_check_object_attribute) 75059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath ppc64_check_object_attribute 76059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath __attribute__ ((alias ("ppc_check_object_attribute"))); 77