LCOV - code coverage report
Current view: top level - backends - arm_symbol.c (source / functions) Hit Total Coverage
Test: elfutils-0.181 Lines: 10 27 37.0 %
Date: 2020-09-08 14:07:57 Functions: 2 7 28.6 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* Arm specific symbolic name handling.
       2             :    Copyright (C) 2002-2009, 2014, 2015, 2017 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 <elf.h>
      34             : #include <stddef.h>
      35             : #include <string.h>
      36             : 
      37             : #define BACKEND         arm_
      38             : #include "libebl_CPU.h"
      39             : 
      40             : 
      41             : const char *
      42           0 : arm_segment_type_name (int segment, char *buf __attribute__ ((unused)),
      43             :                        size_t len __attribute__ ((unused)))
      44             : {
      45           0 :   switch (segment)
      46             :     {
      47             :     case PT_ARM_EXIDX:
      48             :       return "ARM_EXIDX";
      49             :     }
      50           0 :   return NULL;
      51             : }
      52             : 
      53             : /* Return symbolic representation of section type.  */
      54             : const char *
      55          71 : arm_section_type_name (int type,
      56             :                        char *buf __attribute__ ((unused)),
      57             :                        size_t len __attribute__ ((unused)))
      58             : {
      59          71 :   switch (type)
      60             :     {
      61             :     case SHT_ARM_EXIDX:
      62             :       return "ARM_EXIDX";
      63           0 :     case SHT_ARM_PREEMPTMAP:
      64           0 :       return "ARM_PREEMPTMAP";
      65           1 :     case SHT_ARM_ATTRIBUTES:
      66           1 :       return "ARM_ATTRIBUTES";
      67             :     }
      68             : 
      69          69 :   return NULL;
      70             : }
      71             : 
      72             : /* Check whether machine flags are valid.  */
      73             : bool
      74           0 : arm_machine_flag_check (GElf_Word flags)
      75             : {
      76           0 :   switch (flags & EF_ARM_EABIMASK)
      77             :     {
      78             :     case EF_ARM_EABI_UNKNOWN:
      79             :     case EF_ARM_EABI_VER1:
      80             :     case EF_ARM_EABI_VER2:
      81             :     case EF_ARM_EABI_VER3:
      82             :     case EF_ARM_EABI_VER4:
      83             :     case EF_ARM_EABI_VER5:
      84           0 :       break;
      85             :     default:
      86             :       return false;
      87             :     }
      88             : 
      89           0 :   return ((flags &~ (EF_ARM_EABIMASK
      90             :                      | EF_ARM_RELEXEC
      91             :                      | EF_ARM_HASENTRY
      92             :                      | EF_ARM_INTERWORK
      93             :                      | EF_ARM_APCS_26
      94             :                      | EF_ARM_APCS_FLOAT
      95             :                      | EF_ARM_PIC
      96             :                      | EF_ARM_ALIGN8
      97             :                      | EF_ARM_NEW_ABI
      98             :                      | EF_ARM_OLD_ABI
      99             :                      | EF_ARM_SOFT_FLOAT
     100             :                      | EF_ARM_VFP_FLOAT
     101             :                      | EF_ARM_MAVERICK_FLOAT
     102             :                      | EF_ARM_SYMSARESORTED
     103             :                      | EF_ARM_DYNSYMSUSESEGIDX
     104             :                      | EF_ARM_MAPSYMSFIRST
     105             :                      | EF_ARM_EABIMASK
     106             :                      | EF_ARM_BE8
     107           0 :                      | EF_ARM_LE8)) == 0);
     108             : }
     109             : 
     110             : /* Check for the simple reloc types.  */
     111             : Elf_Type
     112           0 : arm_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
     113             :                        int *addsub __attribute__ ((unused)))
     114             : {
     115           0 :   switch (type)
     116             :     {
     117             :     case R_ARM_ABS32:
     118             :       return ELF_T_WORD;
     119             :     case R_ARM_ABS16:
     120             :       return ELF_T_HALF;
     121             :     case R_ARM_ABS8:
     122             :       return ELF_T_BYTE;
     123             :     default:
     124             :       return ELF_T_NUM;
     125             :     }
     126             : }
     127             : 
     128             : /* The SHT_ARM_EXIDX section type is a valid target for relocation.  */
     129             : bool
     130           0 : arm_check_reloc_target_type (Ebl *ebl __attribute__ ((unused)), Elf64_Word sh_type)
     131             : {
     132           0 :   return sh_type == SHT_ARM_EXIDX;
     133             : }
     134             : 
     135             : const char *
     136           0 : arm_symbol_type_name (int type,
     137             :                       char *buf __attribute__ ((unused)),
     138             :                       size_t len __attribute__ ((unused)))
     139             : {
     140           0 :   switch (type)
     141             :     {
     142             :     case STT_ARM_TFUNC:
     143             :       return "ARM_TFUNC";
     144             :     }
     145           0 :   return NULL;
     146             : }
     147             : 
     148             : /* A data mapping symbol is a symbol with "$d" name or "$d.<any...>" name,
     149             :  *    STT_NOTYPE, STB_LOCAL and st_size of zero. The indicate the stat of a
     150             :  *       sequence of data items.  */
     151             : bool
     152           4 : arm_data_marker_symbol (const GElf_Sym *sym, const char *sname)
     153             : {
     154           4 :   return (sym != NULL && sname != NULL
     155           4 :           && sym->st_size == 0 && GELF_ST_BIND (sym->st_info) == STB_LOCAL
     156           4 :           && GELF_ST_TYPE (sym->st_info) == STT_NOTYPE
     157           8 :           && (strcmp (sname, "$d") == 0 || strncmp (sname, "$d.", 3) == 0));
     158             : }

Generated by: LCOV version 1.13