Coverage Report

Created: 2025-08-24 06:28

/src/elfutils/backends/ia64_symbol.c
Line
Count
Source (jump to first uncovered line)
1
/* IA-64 specific symbolic name handling.
2
   Copyright (C) 2002-2009, 2014 Red Hat, Inc.
3
   This file is part of elfutils.
4
   Written by Ulrich Drepper <drepper@redhat.com>, 2002.
5
6
   This file is free software; you can redistribute it and/or modify
7
   it under the terms of either
8
9
     * the GNU Lesser General Public License as published by the Free
10
       Software Foundation; either version 3 of the License, or (at
11
       your option) any later version
12
13
   or
14
15
     * the GNU General Public License as published by the Free
16
       Software Foundation; either version 2 of the License, or (at
17
       your option) any later version
18
19
   or both in parallel, as here.
20
21
   elfutils is distributed in the hope that it will be useful, but
22
   WITHOUT ANY WARRANTY; without even the implied warranty of
23
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24
   General Public License for more details.
25
26
   You should have received copies of the GNU General Public License and
27
   the GNU Lesser General Public License along with this program.  If
28
   not, see <http://www.gnu.org/licenses/>.  */
29
30
#ifdef HAVE_CONFIG_H
31
# include <config.h>
32
#endif
33
34
#include <elf.h>
35
#include <stddef.h>
36
#include <assert.h>
37
38
#define BACKEND   ia64_
39
#include "libebl_CPU.h"
40
41
42
const char *
43
ia64_segment_type_name (int segment, char *buf __attribute__ ((unused)),
44
      size_t len __attribute__ ((unused)))
45
0
{
46
0
  switch (segment)
47
0
    {
48
0
    case PT_IA_64_ARCHEXT:
49
0
      return "IA_64_ARCHEXT";
50
0
    case PT_IA_64_UNWIND:
51
0
      return "IA_64_UNWIND";
52
0
    case PT_IA_64_HP_OPT_ANOT:
53
0
      return "IA_64_HP_OPT_ANOT";
54
0
    case PT_IA_64_HP_HSL_ANOT:
55
0
      return "IA_64_HP_HSL_ANOT";
56
0
    case PT_IA_64_HP_STACK:
57
0
      return "IA_64_HP_STACK";
58
0
    default:
59
0
      break;
60
0
    }
61
0
  return NULL;
62
0
}
63
64
const char *
65
ia64_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)),
66
           size_t len __attribute__ ((unused)))
67
0
{
68
0
  switch (tag)
69
0
    {
70
0
    case DT_IA_64_PLT_RESERVE:
71
0
      return "IA_64_PLT_RESERVE";
72
0
    default:
73
0
      break;
74
0
    }
75
0
  return NULL;
76
0
}
77
78
/* Check dynamic tag.  */
79
bool
80
ia64_dynamic_tag_check (int64_t tag)
81
0
{
82
0
  return tag == DT_IA_64_PLT_RESERVE;
83
0
}
84
85
/* Check whether machine flags are valid.  */
86
bool
87
ia64_machine_flag_check (GElf_Word flags)
88
0
{
89
0
  return ((flags &~ EF_IA_64_ABI64) == 0);
90
0
}
91
92
/* Check whether SHF_MASKPROC flags are valid.  */
93
bool
94
ia64_machine_section_flag_check (GElf_Xword sh_flags)
95
0
{
96
0
  return (sh_flags &~ (SHF_IA_64_SHORT | SHF_IA_64_NORECOV)) == 0;
97
0
}
98
99
/* Return symbolic representation of section type.  */
100
const char *
101
ia64_section_type_name (int type,
102
      char *buf __attribute__ ((unused)),
103
      size_t len __attribute__ ((unused)))
104
0
{
105
0
  switch (type)
106
0
    {
107
0
    case SHT_IA_64_EXT:
108
0
      return "IA_64_EXT";
109
0
    case SHT_IA_64_UNWIND:
110
0
      return "IA_64_UNWIND";
111
0
    }
112
113
0
  return NULL;
114
0
}
115
116
/* Check for the simple reloc types.  */
117
Elf_Type
118
ia64_reloc_simple_type (Ebl *ebl, int type,
119
      int *addsub __attribute__ ((unused)))
120
0
{
121
0
  switch (type)
122
0
    {
123
      /* The SECREL types when used with non-allocated sections
124
   like .debug_* are the same as direct absolute relocs
125
   applied to those sections, since a 0 section address is assumed.
126
   So we treat them the same here.  */
127
128
0
    case R_IA64_SECREL32MSB:
129
0
    case R_IA64_DIR32MSB:
130
0
      if (ebl->data == ELFDATA2MSB)
131
0
  return ELF_T_WORD;
132
0
      break;
133
0
    case R_IA64_SECREL32LSB:
134
0
    case R_IA64_DIR32LSB:
135
0
      if (ebl->data == ELFDATA2LSB)
136
0
  return ELF_T_WORD;
137
0
      break;
138
0
    case R_IA64_DIR64MSB:
139
0
    case R_IA64_SECREL64MSB:
140
0
      if (ebl->data == ELFDATA2MSB)
141
0
  return ELF_T_XWORD;
142
0
      break;
143
0
    case R_IA64_SECREL64LSB:
144
0
    case R_IA64_DIR64LSB:
145
0
      if (ebl->data == ELFDATA2LSB)
146
0
  return ELF_T_XWORD;
147
0
      break;
148
0
    }
149
150
0
  return ELF_T_NUM;
151
0
}
152
153
/* The SHT_IA_64_UNWIND section type is a valid target for relocation.  */
154
bool
155
ia64_check_reloc_target_type (Ebl *ebl __attribute__ ((unused)), Elf64_Word sh_type)
156
0
{
157
0
  return sh_type == SHT_IA_64_UNWIND;
158
0
}