LCOV - code coverage report
Current view: top level - backends - riscv_init.c (source / functions) Hit Total Coverage
Test: elfutils-0.190 Lines: 22 24 91.7 %
Date: 2023-11-14 21:22:18 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 10 60.0 %

           Branch data     Line data    Source code
       1                 :            : /* Initialization of RISC-V specific backend library.
       2                 :            :    This file is part of elfutils.
       3                 :            : 
       4                 :            :    This file is free software; you can redistribute it and/or modify
       5                 :            :    it under the terms of either
       6                 :            : 
       7                 :            :      * the GNU Lesser General Public License as published by the Free
       8                 :            :        Software Foundation; either version 3 of the License, or (at
       9                 :            :        your option) any later version
      10                 :            : 
      11                 :            :    or
      12                 :            : 
      13                 :            :      * the GNU General Public License as published by the Free
      14                 :            :        Software Foundation; either version 2 of the License, or (at
      15                 :            :        your option) any later version
      16                 :            : 
      17                 :            :    or both in parallel, as here.
      18                 :            : 
      19                 :            :    elfutils is distributed in the hope that it will be useful, but
      20                 :            :    WITHOUT ANY WARRANTY; without even the implied warranty of
      21                 :            :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      22                 :            :    General Public License for more details.
      23                 :            : 
      24                 :            :    You should have received copies of the GNU General Public License and
      25                 :            :    the GNU Lesser General Public License along with this program.  If
      26                 :            :    not, see <http://www.gnu.org/licenses/>.  */
      27                 :            : 
      28                 :            : #ifdef HAVE_CONFIG_H
      29                 :            : # include <config.h>
      30                 :            : #endif
      31                 :            : 
      32                 :            : #define BACKEND         riscv_
      33                 :            : #define RELOC_PREFIX    R_RISCV_
      34                 :            : #include "libebl_CPU.h"
      35                 :            : 
      36                 :            : #include "libelfP.h"
      37                 :            : 
      38                 :            : /* This defines the common reloc hooks based on riscv_reloc.def.  */
      39                 :            : #include "common-reloc.c"
      40                 :            : 
      41                 :            : extern __typeof (EBLHOOK (return_value_location))
      42                 :            :   riscv_return_value_location_lp64d attribute_hidden;
      43                 :            : 
      44                 :            : extern __typeof (EBLHOOK (return_value_location))
      45                 :            :     riscv_return_value_location_lp64f attribute_hidden;
      46                 :            : 
      47                 :            : extern __typeof (EBLHOOK (return_value_location))
      48                 :            :     riscv_return_value_location_lp64 attribute_hidden;
      49                 :            : 
      50                 :            : extern __typeof (EBLHOOK (core_note)) riscv64_core_note attribute_hidden;
      51                 :            : 
      52                 :            : Ebl *
      53                 :         30 : riscv_init (Elf *elf,
      54                 :            :             GElf_Half machine __attribute__ ((unused)),
      55                 :            :             Ebl *eh)
      56                 :            : {
      57                 :            :   /* We handle it.  */
      58         [ +  - ]:         30 :   riscv_init_reloc (eh);
      59                 :         30 :   HOOK (eh, reloc_simple_type);
      60                 :         30 :   HOOK (eh, register_info);
      61                 :         30 :   HOOK (eh, abi_cfi);
      62                 :         30 :   HOOK (eh, disasm);
      63                 :            :   /* gcc/config/ #define DWARF_FRAME_REGISTERS.  */
      64                 :         30 :   eh->frame_nregs = 66;
      65                 :         30 :   HOOK (eh, check_special_symbol);
      66                 :         30 :   HOOK (eh, machine_flag_check);
      67                 :         30 :   HOOK (eh, set_initial_registers_tid);
      68                 :         30 :   HOOK (eh, segment_type_name);
      69                 :         30 :   HOOK (eh, section_type_name);
      70                 :         30 :   HOOK (eh, dynamic_tag_name);
      71                 :         30 :   HOOK (eh, dynamic_tag_check);
      72         [ +  - ]:         30 :   if (eh->class == ELFCLASS64)
      73                 :         30 :     eh->core_note = riscv64_core_note;
      74                 :            :   else
      75                 :          0 :     HOOK (eh, core_note);
      76         [ +  - ]:         30 :   if (eh->class == ELFCLASS64)
      77                 :            :     {
      78         [ +  + ]:         30 :       if ((elf->state.elf64.ehdr->e_flags & EF_RISCV_FLOAT_ABI)
      79                 :            :           == EF_RISCV_FLOAT_ABI_DOUBLE)
      80                 :         10 :         eh->return_value_location = riscv_return_value_location_lp64d;
      81         [ -  + ]:         20 :       else if ((elf->state.elf64.ehdr->e_flags & EF_RISCV_FLOAT_ABI)
      82                 :            :                == EF_RISCV_FLOAT_ABI_SINGLE)
      83                 :          0 :         eh->return_value_location = riscv_return_value_location_lp64f;
      84                 :            :       else
      85                 :         20 :         eh->return_value_location = riscv_return_value_location_lp64;
      86                 :            :     }
      87                 :            : 
      88                 :         30 :   return eh;
      89                 :            : }

Generated by: LCOV version 1.16