LCOV - code coverage report
Current view: top level - backends - arm_attrs.c (source / functions) Hit Total Coverage
Test: elfutils-0.189 Lines: 72 154 46.8 %
Date: 2023-11-01 23:52:46 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 33 104 31.7 %

           Branch data     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                 :         34 : 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         [ +  - ]:         34 :   if (!strcmp (vendor, "aeabi"))
      52   [ -  +  +  +  :         34 :     switch (tag)
          +  +  +  -  -  
          -  -  -  -  -  
          +  +  +  +  -  
          +  +  +  +  +  
          +  -  -  -  +  
          -  -  -  -  -  
             -  -  -  - ]
      53                 :            :       {
      54                 :          0 :       case 4:
      55                 :          0 :         *tag_name = "CPU_raw_name";
      56                 :          0 :         return true;
      57                 :          2 :       case 5:
      58                 :          2 :         *tag_name = "CPU_name";
      59                 :          2 :         return true;
      60                 :          2 :       case 6:
      61                 :          2 :         *tag_name = "CPU_arch";
      62         [ +  - ]:          2 :         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                 :          2 :         return true;
      76                 :          2 :       case 7:
      77                 :          2 :         *tag_name = "CPU_arch_profile";
      78   [ +  -  -  - ]:          2 :         switch (value)
      79                 :            :           {
      80                 :          2 :           case 'A':
      81                 :          2 :             *value_name = "Application";
      82                 :          2 :             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                 :          2 :         return true;
      91                 :          2 :       case 8:
      92                 :          2 :         *tag_name = "ARM_ISA_use";
      93         [ +  - ]:          2 :         KNOWN_VALUES ("No", "Yes");
      94                 :          2 :         return true;
      95                 :          2 :       case 9:
      96                 :          2 :         *tag_name = "THUMB_ISA_use";
      97         [ +  - ]:          2 :         KNOWN_VALUES ("No", "Thumb-1", "Thumb-2");
      98                 :          2 :         return true;
      99                 :          2 :       case 10:
     100                 :          2 :         *tag_name = "VFP_arch";
     101         [ +  - ]:          2 :         KNOWN_VALUES ("No", "VFPv1", "VFPv2", "VFPv3", "VFPv3-D16");
     102                 :          2 :         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                 :          2 :       case 18:
     139                 :          2 :         *tag_name = "ABI_PCS_wchar_t";
     140                 :          2 :         return true;
     141                 :          2 :       case 19:
     142                 :          2 :         *tag_name = "ABI_FP_rounding";
     143         [ +  - ]:          2 :         KNOWN_VALUES ("Unused", "Needed");
     144                 :          2 :         return true;
     145                 :          2 :       case 20:
     146                 :          2 :         *tag_name = "ABI_FP_denormal";
     147         [ +  - ]:          2 :         KNOWN_VALUES ("Unused", "Needed", "Sign only");
     148                 :          2 :         return true;
     149                 :          2 :       case 21:
     150                 :          2 :         *tag_name = "ABI_FP_exceptions";
     151         [ +  - ]:          2 :         KNOWN_VALUES ("Unused", "Needed");
     152                 :          2 :         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                 :          2 :       case 23:
     158                 :          2 :         *tag_name = "ABI_FP_number_model";
     159         [ +  - ]:          2 :         KNOWN_VALUES ("Unused", "Finite", "RTABI", "IEEE 754");
     160                 :          2 :         return true;
     161                 :          2 :       case 24:
     162                 :          2 :         *tag_name = "ABI_align8_needed";
     163         [ +  - ]:          2 :         KNOWN_VALUES ("No", "Yes", "4-byte");
     164                 :          2 :         return true;
     165                 :          2 :       case 25:
     166                 :          2 :         *tag_name = "ABI_align8_preserved";
     167         [ +  - ]:          2 :         KNOWN_VALUES ("No", "Yes, except leaf SP", "Yes");
     168                 :          2 :         return true;
     169                 :          2 :       case 26:
     170                 :          2 :         *tag_name = "ABI_enum_size";
     171         [ +  - ]:          2 :         KNOWN_VALUES ("Unused", "small", "int", "forced to int");
     172                 :          2 :         return true;
     173                 :          2 :       case 27:
     174                 :          2 :         *tag_name = "ABI_HardFP_use";
     175         [ +  - ]:          2 :         KNOWN_VALUES ("as VFP_arch", "SP only", "DP only", "SP and DP");
     176                 :          2 :         return true;
     177                 :          2 :       case 28:
     178                 :          2 :         *tag_name = "ABI_VFP_args";
     179         [ +  - ]:          2 :         KNOWN_VALUES ("AAPCS", "VFP registers", "custom");
     180                 :          2 :         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                 :          2 :       case 34:
     206                 :          2 :         *tag_name = "CPU_unaligned_access";
     207         [ +  - ]:          2 :         KNOWN_VALUES ("None", "v6");
     208                 :          2 :         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.16