1059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath/* Object attribute tags for PowerPC. 24d6d0f757aae4a17b6e23afe9c74d0b935d46e9dRoland McGrath Copyright (C) 2008, 2009 Red Hat, Inc. 3de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard This file is part of elfutils. 4059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 5de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard This file is free software; you can redistribute it and/or modify 6de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard it under the terms of either 7059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 8de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard * the GNU Lesser General Public License as published by the Free 9de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard Software Foundation; either version 3 of the License, or (at 10de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard your option) any later version 11de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard 12de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard or 13de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard 14de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard * the GNU General Public License as published by the Free 15de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard Software Foundation; either version 2 of the License, or (at 16de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard your option) any later version 17de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard 18de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard or both in parallel, as here. 19de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard 20de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard elfutils is distributed in the hope that it will be useful, but 21059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath WITHOUT ANY WARRANTY; without even the implied warranty of 22059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath General Public License for more details. 24059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 25de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard You should have received copies of the GNU General Public License and 26de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard the GNU Lesser General Public License along with this program. If 27de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard not, see <http://www.gnu.org/licenses/>. */ 28059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 29059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath#ifdef HAVE_CONFIG_H 30059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath# include <config.h> 31059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath#endif 32059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 33059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath#include <string.h> 34059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath#include <dwarf.h> 35059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 36059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath#define BACKEND ppc_ 37059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath#include "libebl_CPU.h" 38059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 39059c83e5db89955913a39fe6705acca571c32c3fRoland McGrathbool 401ccdfb683ad6c7e59793136c3a657ddf131cafd1Mark Wielaardppc_check_object_attribute (Ebl *ebl __attribute__ ((unused)), 411ccdfb683ad6c7e59793136c3a657ddf131cafd1Mark Wielaard const char *vendor, int tag, uint64_t value, 421ccdfb683ad6c7e59793136c3a657ddf131cafd1Mark Wielaard const char **tag_name, const char **value_name) 43059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath{ 44059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath if (!strcmp (vendor, "gnu")) 45059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath switch (tag) 46059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath { 47059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath case 4: 48059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath *tag_name = "GNU_Power_ABI_FP"; 49059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath static const char *fp_kinds[] = 50059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath { 51059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath "Hard or soft float", 52059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath "Hard float", 53059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath "Soft float", 54059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath }; 55059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath if (value < sizeof fp_kinds / sizeof fp_kinds[0]) 56059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath *value_name = fp_kinds[value]; 57059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath return true; 58059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 59059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath case 8: 60059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath *tag_name = "GNU_Power_ABI_Vector"; 61059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath static const char *vector_kinds[] = 62059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath { 63059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath "Any", "Generic", "AltiVec", "SPE" 64059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath }; 65059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath if (value < sizeof vector_kinds / sizeof vector_kinds[0]) 66059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath *value_name = vector_kinds[value]; 67059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath return true; 684d6d0f757aae4a17b6e23afe9c74d0b935d46e9dRoland McGrath 694d6d0f757aae4a17b6e23afe9c74d0b935d46e9dRoland McGrath case 12: 704d6d0f757aae4a17b6e23afe9c74d0b935d46e9dRoland McGrath *tag_name = "GNU_Power_ABI_Struct_Return"; 717ee70eb081efbf86ed272ecc60e36c73e8e009f3Roland McGrath static const char *struct_return_kinds[] = 724d6d0f757aae4a17b6e23afe9c74d0b935d46e9dRoland McGrath { 734d6d0f757aae4a17b6e23afe9c74d0b935d46e9dRoland McGrath "Any", "r3/r4", "Memory" 744d6d0f757aae4a17b6e23afe9c74d0b935d46e9dRoland McGrath }; 757ee70eb081efbf86ed272ecc60e36c73e8e009f3Roland McGrath if (value < sizeof struct_return_kinds / sizeof struct_return_kinds[0]) 767ee70eb081efbf86ed272ecc60e36c73e8e009f3Roland McGrath *value_name = struct_return_kinds[value]; 774d6d0f757aae4a17b6e23afe9c74d0b935d46e9dRoland McGrath return true; 78059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath } 79059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 80059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath return false; 81059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath} 82059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath 83059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath__typeof (ppc_check_object_attribute) 84059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath ppc64_check_object_attribute 85059c83e5db89955913a39fe6705acca571c32c3fRoland McGrath __attribute__ ((alias ("ppc_check_object_attribute"))); 86