Line data Source code
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 1 : ia64_segment_type_name (int segment, char *buf __attribute__ ((unused)),
44 : size_t len __attribute__ ((unused)))
45 : {
46 1 : switch (segment)
47 : {
48 : case PT_IA_64_ARCHEXT:
49 : return "IA_64_ARCHEXT";
50 1 : case PT_IA_64_UNWIND:
51 1 : 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 : default:
59 0 : break;
60 : }
61 0 : return NULL;
62 : }
63 :
64 : const char *
65 0 : ia64_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)),
66 : size_t len __attribute__ ((unused)))
67 : {
68 0 : switch (tag)
69 : {
70 : case DT_IA_64_PLT_RESERVE:
71 : return "IA_64_PLT_RESERVE";
72 : default:
73 0 : break;
74 : }
75 0 : return NULL;
76 : }
77 :
78 : /* Check dynamic tag. */
79 : bool
80 31 : ia64_dynamic_tag_check (int64_t tag)
81 : {
82 31 : return tag == DT_IA_64_PLT_RESERVE;
83 : }
84 :
85 : /* Check whether machine flags are valid. */
86 : bool
87 1 : ia64_machine_flag_check (GElf_Word flags)
88 : {
89 1 : return ((flags &~ EF_IA_64_ABI64) == 0);
90 : }
91 :
92 : /* Check whether SHF_MASKPROC flags are valid. */
93 : bool
94 4 : ia64_machine_section_flag_check (GElf_Xword sh_flags)
95 : {
96 4 : return (sh_flags &~ (SHF_IA_64_SHORT | SHF_IA_64_NORECOV)) == 0;
97 : }
98 :
99 : /* Return symbolic representation of section type. */
100 : const char *
101 2 : ia64_section_type_name (int type,
102 : char *buf __attribute__ ((unused)),
103 : size_t len __attribute__ ((unused)))
104 : {
105 2 : switch (type)
106 : {
107 : case SHT_IA_64_EXT:
108 : return "IA_64_EXT";
109 1 : case SHT_IA_64_UNWIND:
110 1 : return "IA_64_UNWIND";
111 : }
112 :
113 1 : return NULL;
114 : }
115 :
116 : /* Check for the simple reloc types. */
117 : Elf_Type
118 1470 : ia64_reloc_simple_type (Ebl *ebl, int type,
119 : int *addsub __attribute__ ((unused)))
120 : {
121 1470 : switch (type)
122 : {
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 : case R_IA64_DIR32MSB:
130 0 : if (ebl->data == ELFDATA2MSB)
131 0 : return ELF_T_WORD;
132 : break;
133 1455 : case R_IA64_SECREL32LSB:
134 : case R_IA64_DIR32LSB:
135 1455 : if (ebl->data == ELFDATA2LSB)
136 1455 : return ELF_T_WORD;
137 : break;
138 0 : case R_IA64_DIR64MSB:
139 : case R_IA64_SECREL64MSB:
140 0 : if (ebl->data == ELFDATA2MSB)
141 0 : return ELF_T_XWORD;
142 : break;
143 15 : case R_IA64_SECREL64LSB:
144 : case R_IA64_DIR64LSB:
145 15 : if (ebl->data == ELFDATA2LSB)
146 15 : return ELF_T_XWORD;
147 : break;
148 : }
149 :
150 : return ELF_T_NUM;
151 : }
152 :
153 : /* The SHT_IA_64_UNWIND section type is a valid target for relocation. */
154 : bool
155 1 : ia64_check_reloc_target_type (Ebl *ebl __attribute__ ((unused)), Elf64_Word sh_type)
156 : {
157 1 : return sh_type == SHT_IA_64_UNWIND;
158 : }
|