LCOV - code coverage report
Current view: top level - backends - arm_attrs.c (source / functions) Hit Total Coverage
Test: elfutils-0.178 Lines: 72 154 46.8 %
Date: 2019-11-26 23:55:16 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* Object attribute tags for ARM.
       2             :    Copyright (C) 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 arm_
      37             : #include "libebl_CPU.h"
      38             : 
      39             : #define KNOWN_VALUES(...) do                            \
      40             :   {                                                     \
      41             :     static const char *table[] = { __VA_ARGS__ };       \
      42             :     if (value < sizeof table / sizeof table[0])              \
      43             :       *value_name = table[value];                       \
      44             :   } while (0)
      45             : 
      46             : bool
      47          17 : arm_check_object_attribute (Ebl *ebl __attribute__ ((unused)),
      48             :                             const char *vendor, int tag, uint64_t value,
      49             :                             const char **tag_name, const char **value_name)
      50             : {
      51          17 :   if (!strcmp (vendor, "aeabi"))
      52          17 :     switch (tag)
      53             :       {
      54           0 :       case 4:
      55           0 :         *tag_name = "CPU_raw_name";
      56           0 :         return true;
      57           1 :       case 5:
      58           1 :         *tag_name = "CPU_name";
      59           1 :         return true;
      60           1 :       case 6:
      61           1 :         *tag_name = "CPU_arch";
      62           1 :         KNOWN_VALUES ("Pre-v4",
      63             :                       "v4",
      64             :                       "v4T",
      65             :                       "v5T",
      66             :                       "v5TE",
      67             :                       "v5TEJ",
      68             :                       "v6",
      69             :                       "v6KZ",
      70             :                       "v6T2",
      71             :                       "v6K",
      72             :                       "v7",
      73             :                       "v6-M",
      74             :                       "v6S-M");
      75           1 :         return true;
      76           1 :       case 7:
      77           1 :         *tag_name = "CPU_arch_profile";
      78           1 :         switch (value)
      79             :           {
      80           1 :           case 'A':
      81           1 :             *value_name = "Application";
      82           1 :             break;
      83           0 :           case 'R':
      84           0 :             *value_name = "Realtime";
      85           0 :             break;
      86           0 :           case 'M':
      87           0 :             *value_name = "Microcontroller";
      88           0 :             break;
      89             :           }
      90           1 :         return true;
      91           1 :       case 8:
      92           1 :         *tag_name = "ARM_ISA_use";
      93           1 :         KNOWN_VALUES ("No", "Yes");
      94           1 :         return true;
      95           1 :       case 9:
      96           1 :         *tag_name = "THUMB_ISA_use";
      97           1 :         KNOWN_VALUES ("No", "Thumb-1", "Thumb-2");
      98           1 :         return true;
      99           1 :       case 10:
     100           1 :         *tag_name = "VFP_arch";
     101           1 :         KNOWN_VALUES ("No", "VFPv1", "VFPv2", "VFPv3", "VFPv3-D16");
     102           1 :         return true;
     103           0 :       case 11:
     104           0 :         *tag_name = "WMMX_arch";
     105           0 :         KNOWN_VALUES ("No", "WMMXv1", "WMMXv2");
     106           0 :         return true;
     107           0 :       case 12:
     108           0 :         *tag_name = "Advanced_SIMD_arch";
     109           0 :         KNOWN_VALUES ("No", "NEONv1");
     110           0 :         return true;
     111           0 :       case 13:
     112           0 :         *tag_name = "PCS_config";
     113           0 :         KNOWN_VALUES ("None",
     114             :                       "Bare platform",
     115             :                       "Linux application",
     116             :                       "Linux DSO",
     117             :                       "PalmOS 2004",
     118             :                       "PalmOS (reserved)",
     119             :                       "SymbianOS 2004",
     120             :                       "SymbianOS (reserved)");
     121           0 :         return true;
     122           0 :       case 14:
     123           0 :         *tag_name = "ABI_PCS_R9_use";
     124           0 :         KNOWN_VALUES ("V6", "SB", "TLS", "Unused");
     125           0 :         return true;
     126           0 :       case 15:
     127           0 :         *tag_name = "ABI_PCS_RW_data";
     128           0 :         KNOWN_VALUES ("Absolute", "PC-relative", "SB-relative", "None");
     129           0 :         return true;
     130           0 :       case 16:
     131           0 :         *tag_name = "ABI_PCS_RO_data";
     132           0 :         KNOWN_VALUES ("Absolute", "PC-relative", "None");
     133           0 :         return true;
     134           0 :       case 17:
     135           0 :         *tag_name = "ABI_PCS_GOT_use";
     136           0 :         KNOWN_VALUES ("None", "direct", "GOT-indirect");
     137           0 :         return true;
     138           1 :       case 18:
     139           1 :         *tag_name = "ABI_PCS_wchar_t";
     140           1 :         return true;
     141           1 :       case 19:
     142           1 :         *tag_name = "ABI_FP_rounding";
     143           1 :         KNOWN_VALUES ("Unused", "Needed");
     144           1 :         return true;
     145           1 :       case 20:
     146           1 :         *tag_name = "ABI_FP_denormal";
     147           1 :         KNOWN_VALUES ("Unused", "Needed", "Sign only");
     148           1 :         return true;
     149           1 :       case 21:
     150           1 :         *tag_name = "ABI_FP_exceptions";
     151           1 :         KNOWN_VALUES ("Unused", "Needed");
     152           1 :         return true;
     153           0 :       case 22:
     154           0 :         *tag_name = "ABI_FP_user_exceptions";
     155           0 :         KNOWN_VALUES ("Unused", "Needed");
     156           0 :         return true;
     157           1 :       case 23:
     158           1 :         *tag_name = "ABI_FP_number_model";
     159           1 :         KNOWN_VALUES ("Unused", "Finite", "RTABI", "IEEE 754");
     160           1 :         return true;
     161           1 :       case 24:
     162           1 :         *tag_name = "ABI_align8_needed";
     163           1 :         KNOWN_VALUES ("No", "Yes", "4-byte");
     164           1 :         return true;
     165           1 :       case 25:
     166           1 :         *tag_name = "ABI_align8_preserved";
     167           1 :         KNOWN_VALUES ("No", "Yes, except leaf SP", "Yes");
     168           1 :         return true;
     169           1 :       case 26:
     170           1 :         *tag_name = "ABI_enum_size";
     171           1 :         KNOWN_VALUES ("Unused", "small", "int", "forced to int");
     172           1 :         return true;
     173           1 :       case 27:
     174           1 :         *tag_name = "ABI_HardFP_use";
     175           1 :         KNOWN_VALUES ("as VFP_arch", "SP only", "DP only", "SP and DP");
     176           1 :         return true;
     177           1 :       case 28:
     178           1 :         *tag_name = "ABI_VFP_args";
     179           1 :         KNOWN_VALUES ("AAPCS", "VFP registers", "custom");
     180           1 :         return true;
     181           0 :       case 29:
     182           0 :         *tag_name = "ABI_WMMX_args";
     183           0 :         KNOWN_VALUES ("AAPCS", "WMMX registers", "custom");
     184           0 :         return true;
     185           0 :       case 30:
     186           0 :         *tag_name = "ABI_optimization_goals";
     187           0 :         KNOWN_VALUES ("None",
     188             :                       "Prefer Speed",
     189             :                       "Aggressive Speed",
     190             :                       "Prefer Size",
     191             :                       "Aggressive Size",
     192             :                       "Prefer Debug",
     193             :                       "Aggressive Debug");
     194           0 :         return true;
     195           0 :       case 31:
     196           0 :         *tag_name = "ABI_FP_optimization_goals";
     197           0 :         KNOWN_VALUES ("None",
     198             :                       "Prefer Speed",
     199             :                       "Aggressive Speed",
     200             :                       "Prefer Size",
     201             :                       "Aggressive Size",
     202             :                       "Prefer Accuracy",
     203             :                       "Aggressive Accuracy");
     204           0 :         return true;
     205           1 :       case 34:
     206           1 :         *tag_name = "CPU_unaligned_access";
     207           1 :         KNOWN_VALUES ("None", "v6");
     208           1 :         return true;
     209           0 :       case 36:
     210           0 :         *tag_name = "VFP_HP_extension";
     211           0 :         KNOWN_VALUES ("Not Allowed", "Allowed");
     212           0 :         return true;
     213           0 :       case 38:
     214           0 :         *tag_name = "ABI_FP_16bit_format";
     215           0 :         KNOWN_VALUES ("None", "IEEE 754", "Alternative Format");
     216           0 :         return true;
     217           0 :       case 64:
     218           0 :         *tag_name = "nodefaults";
     219           0 :         return true;
     220           0 :       case 65:
     221           0 :         *tag_name = "also_compatible_with";
     222           0 :         return true;
     223           0 :       case 66:
     224           0 :         *tag_name = "T2EE_use";
     225           0 :         KNOWN_VALUES ("Not Allowed", "Allowed");
     226           0 :         return true;
     227           0 :       case 67:
     228           0 :         *tag_name = "conformance";
     229           0 :         return true;
     230           0 :       case 68:
     231           0 :         *tag_name = "Virtualization_use";
     232           0 :         KNOWN_VALUES ("Not Allowed", "Allowed");
     233           0 :         return true;
     234           0 :       case 70:
     235           0 :         *tag_name = "MPextension_use";
     236           0 :         KNOWN_VALUES ("Not Allowed", "Allowed");
     237           0 :         return true;
     238             :       }
     239             : 
     240             :   return false;
     241             : }

Generated by: LCOV version 1.13