LCOV - code coverage report
Current view: top level - backends - ppc_attrs.c (source / functions) Hit Total Coverage
Test: elfutils-0.186 Lines: 21 21 100.0 %
Date: 2021-11-11 00:14:10 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 7 12 58.3 %

           Branch data     Line data    Source code
       1                 :            : /* Object attribute tags for PowerPC.
       2                 :            :    Copyright (C) 2008, 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 ppc_
      37                 :            : #include "libebl_CPU.h"
      38                 :            : 
      39                 :            : bool
      40                 :          5 : ppc_check_object_attribute (Ebl *ebl __attribute__ ((unused)),
      41                 :            :                             const char *vendor, int tag, uint64_t value,
      42                 :            :                             const char **tag_name, const char **value_name)
      43                 :            : {
      44         [ +  - ]:          5 :   if (!strcmp (vendor, "gnu"))
      45   [ +  +  +  - ]:          5 :     switch (tag)
      46                 :            :       {
      47                 :          2 :       case 4:
      48                 :          2 :         *tag_name = "GNU_Power_ABI_FP";
      49                 :          2 :         static const char *fp_kinds[] =
      50                 :            :           {
      51                 :            :             "Hard or soft float",
      52                 :            :             "Hard float",
      53                 :            :             "Soft float",
      54                 :            :             "Single-precision hard float",
      55                 :            :           };
      56         [ +  - ]:          2 :         if (value < sizeof fp_kinds / sizeof fp_kinds[0])
      57                 :          2 :           *value_name = fp_kinds[value];
      58                 :          2 :         return true;
      59                 :            : 
      60                 :          2 :       case 8:
      61                 :          2 :         *tag_name = "GNU_Power_ABI_Vector";
      62                 :          2 :         static const char *vector_kinds[] =
      63                 :            :           {
      64                 :            :             "Any", "Generic", "AltiVec", "SPE"
      65                 :            :           };
      66         [ +  - ]:          2 :         if (value < sizeof vector_kinds / sizeof vector_kinds[0])
      67                 :          2 :           *value_name = vector_kinds[value];
      68                 :          2 :         return true;
      69                 :            : 
      70                 :          1 :       case 12:
      71                 :          1 :         *tag_name = "GNU_Power_ABI_Struct_Return";
      72                 :          1 :         static const char *struct_return_kinds[] =
      73                 :            :           {
      74                 :            :             "Any", "r3/r4", "Memory"
      75                 :            :           };
      76         [ +  - ]:          1 :         if (value < sizeof struct_return_kinds / sizeof struct_return_kinds[0])
      77                 :          1 :           *value_name = struct_return_kinds[value];
      78                 :          1 :         return true;
      79                 :            :       }
      80                 :            : 
      81                 :            :   return false;
      82                 :            : }
      83                 :            : 
      84                 :            : __typeof (ppc_check_object_attribute)
      85                 :            :      ppc64_check_object_attribute
      86                 :            :      __attribute__ ((alias ("ppc_check_object_attribute")));

Generated by: LCOV version 1.14