LCOV - code coverage report
Current view: top level - backends - arm_machineflagname.c (source / functions) Hit Total Coverage
Test: elfutils-0.191 Lines: 12 63 19.0 %
Date: 2024-04-17 19:42:11 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 44 13.6 %

           Branch data     Line data    Source code
       1                 :            : /* Arm-specific ELF flag names.
       2                 :            :    Copyright (C) 2022 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                 :            : #define BACKEND arm_
      34                 :            : #include "libebl_CPU.h"
      35                 :            : 
      36                 :            : const char *
      37                 :          4 : arm_machine_flag_name (Elf64_Word orig, Elf64_Word *flagref)
      38                 :            : {
      39                 :          4 :   unsigned version = EF_ARM_EABI_VERSION (*flagref) >> 24;
      40         [ +  + ]:          4 :   if (version != 0)
      41                 :            :     {
      42                 :          2 :       static const char vername[5][14] =
      43                 :            :         {
      44                 :            :           "Version1 EABI",
      45                 :            :           "Version2 EABI",
      46                 :            :           "Version3 EABI",
      47                 :            :           "Version4 EABI",
      48                 :            :           "Version5 EABI",
      49                 :            :         };
      50                 :          2 :       *flagref &= ~((Elf64_Word) EF_ARM_EABIMASK);
      51         [ +  - ]:          2 :       return version <= 5 ? vername[version - 1] : NULL;
      52                 :            :     }
      53   [ -  -  +  -  :          2 :   switch (EF_ARM_EABI_VERSION (orig))
                   -  - ]
      54                 :            :     {
      55                 :          0 :     case EF_ARM_EABI_VER2:
      56         [ #  # ]:          0 :       if ((*flagref & EF_ARM_DYNSYMSUSESEGIDX) != 0)
      57                 :            :         {
      58                 :          0 :           *flagref &= ~((Elf64_Word) EF_ARM_DYNSYMSUSESEGIDX);
      59                 :          0 :           return "dynamic symbols use segment index";
      60                 :            :         }
      61         [ #  # ]:          0 :       if ((*flagref & EF_ARM_MAPSYMSFIRST) != 0)
      62                 :            :         {
      63                 :          0 :           *flagref &= ~((Elf64_Word) EF_ARM_MAPSYMSFIRST);
      64                 :          0 :           return "mapping symbols precede others";
      65                 :            :         }
      66                 :          0 :       FALLTHROUGH;
      67                 :            :     case EF_ARM_EABI_VER1:
      68         [ #  # ]:          0 :       if ((*flagref & EF_ARM_SYMSARESORTED) != 0)
      69                 :            :         {
      70                 :          0 :           *flagref &= ~((Elf64_Word) EF_ARM_SYMSARESORTED);
      71                 :          0 :           return "sorted symbol tables";
      72                 :            :         }
      73                 :            :       break;
      74                 :            :     case EF_ARM_EABI_VER3:
      75                 :            :       break;
      76                 :          2 :     case EF_ARM_EABI_VER5:
      77         [ -  + ]:          2 :       if ((*flagref & EF_ARM_SOFT_FLOAT) != 0)
      78                 :            :         {
      79                 :          0 :           *flagref &= ~((Elf64_Word) EF_ARM_SOFT_FLOAT);
      80                 :          0 :           return "soft-float ABI";
      81                 :            :         }
      82         [ +  - ]:          2 :       if ((*flagref & EF_ARM_VFP_FLOAT) != 0)
      83                 :            :         {
      84                 :          2 :           *flagref &= ~((Elf64_Word) EF_ARM_VFP_FLOAT);
      85                 :          2 :           return "hard-float ABI";
      86                 :            :         }
      87                 :          0 :       FALLTHROUGH;
      88                 :            :     case EF_ARM_EABI_VER4:
      89         [ #  # ]:          0 :       if ((*flagref & EF_ARM_BE8) != 0)
      90                 :            :         {
      91                 :          0 :           *flagref &= ~((Elf64_Word) EF_ARM_BE8);
      92                 :          0 :           return "BE8";
      93                 :            :         }
      94         [ #  # ]:          0 :       if ((*flagref & EF_ARM_LE8) != 0)
      95                 :            :         {
      96                 :          0 :           *flagref &= ~((Elf64_Word) EF_ARM_LE8);
      97                 :          0 :           return "LE8";
      98                 :            :         }
      99                 :            :       break;
     100                 :          0 :     case EF_ARM_EABI_UNKNOWN:
     101         [ #  # ]:          0 :       if ((*flagref & EF_ARM_INTERWORK) != 0)
     102                 :            :         {
     103                 :          0 :           *flagref &= ~((Elf64_Word) EF_ARM_INTERWORK);
     104                 :          0 :           return "interworking enabled";
     105                 :            :         }
     106         [ #  # ]:          0 :       if ((*flagref & EF_ARM_APCS_26) != 0)
     107                 :            :         {
     108                 :          0 :           *flagref &= ~((Elf64_Word) EF_ARM_APCS_26);
     109                 :          0 :           return "uses APCS/26";
     110                 :            :         }
     111         [ #  # ]:          0 :       if ((*flagref & EF_ARM_APCS_FLOAT) != 0)
     112                 :            :         {
     113                 :          0 :           *flagref &= ~((Elf64_Word) EF_ARM_APCS_FLOAT);
     114                 :          0 :           return "uses APCS/float";
     115                 :            :         }
     116         [ #  # ]:          0 :       if ((*flagref & EF_ARM_PIC) != 0)
     117                 :            :         {
     118                 :          0 :           *flagref &= ~((Elf64_Word) EF_ARM_PIC);
     119                 :          0 :           return "position independent";
     120                 :            :         }
     121         [ #  # ]:          0 :       if ((*flagref & EF_ARM_ALIGN8) != 0)
     122                 :            :         {
     123                 :          0 :           *flagref &= ~((Elf64_Word) EF_ARM_ALIGN8);
     124                 :          0 :           return "8 bit structure alignment";
     125                 :            :         }
     126         [ #  # ]:          0 :       if ((*flagref & EF_ARM_NEW_ABI) != 0)
     127                 :            :         {
     128                 :          0 :           *flagref &= ~((Elf64_Word) EF_ARM_NEW_ABI);
     129                 :          0 :           return "uses new ABI";
     130                 :            :         }
     131         [ #  # ]:          0 :       if ((*flagref & EF_ARM_OLD_ABI) != 0)
     132                 :            :         {
     133                 :          0 :           *flagref &= ~((Elf64_Word) EF_ARM_OLD_ABI);
     134                 :          0 :           return "uses old ABI";
     135                 :            :         }
     136         [ #  # ]:          0 :       if ((*flagref & EF_ARM_SOFT_FLOAT) != 0)
     137                 :            :         {
     138                 :          0 :           *flagref &= ~((Elf64_Word) EF_ARM_SOFT_FLOAT);
     139                 :          0 :           return "software FP";
     140                 :            :         }
     141         [ #  # ]:          0 :       if ((*flagref & EF_ARM_VFP_FLOAT) != 0)
     142                 :            :         {
     143                 :          0 :           *flagref &= ~((Elf64_Word) EF_ARM_VFP_FLOAT);
     144                 :          0 :           return "VFP";
     145                 :            :         }
     146         [ #  # ]:          0 :       if ((*flagref & EF_ARM_MAVERICK_FLOAT) != 0)
     147                 :            :         {
     148                 :          0 :           *flagref &= ~((Elf64_Word) EF_ARM_MAVERICK_FLOAT);
     149                 :          0 :           return "Maverick FP";
     150                 :            :         }
     151                 :            :       break;
     152                 :            :     default:
     153                 :            :       break;
     154                 :            :     }
     155                 :            :   return NULL;
     156                 :            : }

Generated by: LCOV version 1.16