* gdb/remote.c (remote_fileio_errno_to_host)
[binutils.git] / bfd / elf-hppa.h
blobc4ad5ad712e184979e327418e88fa1e42b693711
1 /* Common code for PA ELF implementations.
2 Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
3 Free Software Foundation, Inc.
5 This file is part of BFD, the Binary File Descriptor library.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
21 #define ELF_HOWTO_TABLE_SIZE R_PARISC_UNIMPLEMENTED + 1
23 /* This file is included by multiple PA ELF BFD backends with different
24 sizes.
26 Most of the routines are written to be size independent, but sometimes
27 external constraints require 32 or 64 bit specific code. We remap
28 the definitions/functions as necessary here. */
29 #if ARCH_SIZE == 64
30 #define ELF_R_TYPE(X) ELF64_R_TYPE(X)
31 #define ELF_R_SYM(X) ELF64_R_SYM(X)
32 #define elf_hppa_reloc_final_type elf64_hppa_reloc_final_type
33 #define _bfd_elf_hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type
34 #define elf_hppa_relocate_section elf64_hppa_relocate_section
35 #define elf_hppa_final_link elf64_hppa_final_link
36 #endif
37 #if ARCH_SIZE == 32
38 #define ELF_R_TYPE(X) ELF32_R_TYPE(X)
39 #define ELF_R_SYM(X) ELF32_R_SYM(X)
40 #define elf_hppa_reloc_final_type elf32_hppa_reloc_final_type
41 #define _bfd_elf_hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type
42 #define elf_hppa_relocate_section elf32_hppa_relocate_section
43 #define elf_hppa_final_link elf32_hppa_final_link
44 #endif
46 #if ARCH_SIZE == 64
47 static bfd_reloc_status_type elf_hppa_final_link_relocate
48 (Elf_Internal_Rela *, bfd *, bfd *, asection *, bfd_byte *, bfd_vma,
49 struct bfd_link_info *, asection *, struct elf_link_hash_entry *,
50 struct elf64_hppa_dyn_hash_entry *);
52 static int elf_hppa_relocate_insn
53 (int, int, unsigned int);
54 #endif
56 /* ELF/PA relocation howto entries. */
58 static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
60 { R_PARISC_NONE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
61 bfd_elf_generic_reloc, "R_PARISC_NONE", FALSE, 0, 0, FALSE },
63 /* The values in DIR32 are to placate the check in
64 _bfd_stab_section_find_nearest_line. */
65 { R_PARISC_DIR32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
66 bfd_elf_generic_reloc, "R_PARISC_DIR32", FALSE, 0, 0xffffffff, FALSE },
67 { R_PARISC_DIR21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
68 bfd_elf_generic_reloc, "R_PARISC_DIR21L", FALSE, 0, 0, FALSE },
69 { R_PARISC_DIR17R, 0, 0, 17, FALSE, 0, complain_overflow_bitfield,
70 bfd_elf_generic_reloc, "R_PARISC_DIR17R", FALSE, 0, 0, FALSE },
71 { R_PARISC_DIR17F, 0, 0, 17, FALSE, 0, complain_overflow_bitfield,
72 bfd_elf_generic_reloc, "R_PARISC_DIR17F", FALSE, 0, 0, FALSE },
73 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
74 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
75 { R_PARISC_DIR14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
76 bfd_elf_generic_reloc, "R_PARISC_DIR14R", FALSE, 0, 0, FALSE },
77 { R_PARISC_DIR14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
78 bfd_elf_generic_reloc, "R_PARISC_DIR14F", FALSE, 0, 0, FALSE },
79 /* 8 */
80 { R_PARISC_PCREL12F, 0, 0, 12, TRUE, 0, complain_overflow_bitfield,
81 bfd_elf_generic_reloc, "R_PARISC_PCREL12F", FALSE, 0, 0, FALSE },
82 { R_PARISC_PCREL32, 0, 0, 32, TRUE, 0, complain_overflow_bitfield,
83 bfd_elf_generic_reloc, "R_PARISC_PCREL32", FALSE, 0, 0, FALSE },
84 { R_PARISC_PCREL21L, 0, 0, 21, TRUE, 0, complain_overflow_bitfield,
85 bfd_elf_generic_reloc, "R_PARISC_PCREL21L", FALSE, 0, 0, FALSE },
86 { R_PARISC_PCREL17R, 0, 0, 17, TRUE, 0, complain_overflow_bitfield,
87 bfd_elf_generic_reloc, "R_PARISC_PCREL17R", FALSE, 0, 0, FALSE },
88 { R_PARISC_PCREL17F, 0, 0, 17, TRUE, 0, complain_overflow_bitfield,
89 bfd_elf_generic_reloc, "R_PARISC_PCREL17F", FALSE, 0, 0, FALSE },
90 { R_PARISC_PCREL17C, 0, 0, 17, TRUE, 0, complain_overflow_bitfield,
91 bfd_elf_generic_reloc, "R_PARISC_PCREL17C", FALSE, 0, 0, FALSE },
92 { R_PARISC_PCREL14R, 0, 0, 14, TRUE, 0, complain_overflow_bitfield,
93 bfd_elf_generic_reloc, "R_PARISC_PCREL14R", FALSE, 0, 0, FALSE },
94 { R_PARISC_PCREL14F, 0, 0, 14, TRUE, 0, complain_overflow_bitfield,
95 bfd_elf_generic_reloc, "R_PARISC_PCREL14F", FALSE, 0, 0, FALSE },
96 /* 16 */
97 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
98 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
99 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
100 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
101 { R_PARISC_DPREL21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
102 bfd_elf_generic_reloc, "R_PARISC_DPREL21L", FALSE, 0, 0, FALSE },
103 { R_PARISC_DPREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
104 bfd_elf_generic_reloc, "R_PARISC_DPREL14WR", FALSE, 0, 0, FALSE },
105 { R_PARISC_DPREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
106 bfd_elf_generic_reloc, "R_PARISC_DPREL14DR", FALSE, 0, 0, FALSE },
107 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
108 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
109 { R_PARISC_DPREL14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
110 bfd_elf_generic_reloc, "R_PARISC_DPREL14R", FALSE, 0, 0, FALSE },
111 { R_PARISC_DPREL14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
112 bfd_elf_generic_reloc, "R_PARISC_DPREL14F", FALSE, 0, 0, FALSE },
113 /* 24 */
114 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
115 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
116 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
117 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
118 { R_PARISC_DLTREL21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
119 bfd_elf_generic_reloc, "R_PARISC_DLTREL21L", FALSE, 0, 0, FALSE },
120 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
121 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
122 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
123 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
124 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
125 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
126 { R_PARISC_DLTREL14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
127 bfd_elf_generic_reloc, "R_PARISC_DLTREL14R", FALSE, 0, 0, FALSE },
128 { R_PARISC_DLTREL14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
129 bfd_elf_generic_reloc, "R_PARISC_DLTREL14F", FALSE, 0, 0, FALSE },
130 /* 32 */
131 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
132 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
133 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
134 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
135 { R_PARISC_DLTIND21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
136 bfd_elf_generic_reloc, "R_PARISC_DLTIND21L", FALSE, 0, 0, FALSE },
137 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
138 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
139 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
140 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
141 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
142 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
143 { R_PARISC_DLTIND14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
144 bfd_elf_generic_reloc, "R_PARISC_DLTIND14R", FALSE, 0, 0, FALSE },
145 { R_PARISC_DLTIND14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
146 bfd_elf_generic_reloc, "R_PARISC_DLTIND14F", FALSE, 0, 0, FALSE },
147 /* 40 */
148 { R_PARISC_SETBASE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
149 bfd_elf_generic_reloc, "R_PARISC_SETBASE", FALSE, 0, 0, FALSE },
150 { R_PARISC_SECREL32, 0, 0, 32, FALSE, 0, complain_overflow_bitfield,
151 bfd_elf_generic_reloc, "R_PARISC_SECREL32", FALSE, 0, 0, FALSE },
152 { R_PARISC_BASEREL21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
153 bfd_elf_generic_reloc, "R_PARISC_BASEREL21L", FALSE, 0, 0, FALSE },
154 { R_PARISC_BASEREL17R, 0, 0, 17, FALSE, 0, complain_overflow_bitfield,
155 bfd_elf_generic_reloc, "R_PARISC_BASEREL17R", FALSE, 0, 0, FALSE },
156 { R_PARISC_BASEREL17F, 0, 0, 17, FALSE, 0, complain_overflow_bitfield,
157 bfd_elf_generic_reloc, "R_PARISC_BASEREL17F", FALSE, 0, 0, FALSE },
158 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
159 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
160 { R_PARISC_BASEREL14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
161 bfd_elf_generic_reloc, "R_PARISC_BASEREL14R", FALSE, 0, 0, FALSE },
162 { R_PARISC_BASEREL14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
163 bfd_elf_generic_reloc, "R_PARISC_BASEREL14F", FALSE, 0, 0, FALSE },
164 /* 48 */
165 { R_PARISC_SEGBASE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
166 bfd_elf_generic_reloc, "R_PARISC_SEGBASE", FALSE, 0, 0, FALSE },
167 { R_PARISC_SEGREL32, 0, 0, 32, FALSE, 0, complain_overflow_bitfield,
168 bfd_elf_generic_reloc, "R_PARISC_SEGREL32", FALSE, 0, 0, FALSE },
169 { R_PARISC_PLTOFF21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
170 bfd_elf_generic_reloc, "R_PARISC_PLTOFF21L", FALSE, 0, 0, FALSE },
171 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
172 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
173 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
174 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
175 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
176 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
177 { R_PARISC_PLTOFF14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
178 bfd_elf_generic_reloc, "R_PARISC_PLTOFF14R", FALSE, 0, 0, FALSE },
179 { R_PARISC_PLTOFF14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
180 bfd_elf_generic_reloc, "R_PARISC_PLTOFF14F", FALSE, 0, 0, FALSE },
181 /* 56 */
182 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
183 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
184 { R_PARISC_LTOFF_FPTR32, 0, 0, 32, FALSE, 0, complain_overflow_bitfield,
185 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR32", FALSE, 0, 0, FALSE },
186 { R_PARISC_LTOFF_FPTR21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
187 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR21L", FALSE, 0, 0, FALSE },
188 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
189 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
190 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
191 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
192 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
193 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
194 { R_PARISC_LTOFF_FPTR14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
195 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14R", FALSE, 0, 0, FALSE },
196 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
197 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
198 /* 64 */
199 { R_PARISC_FPTR64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
200 bfd_elf_generic_reloc, "R_PARISC_FPTR64", FALSE, 0, 0, FALSE },
201 { R_PARISC_PLABEL32, 0, 0, 32, FALSE, 0, complain_overflow_bitfield,
202 bfd_elf_generic_reloc, "R_PARISC_PLABEL32", FALSE, 0, 0, FALSE },
203 { R_PARISC_PLABEL21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
204 bfd_elf_generic_reloc, "R_PARISC_PLABEL21L", FALSE, 0, 0, FALSE },
205 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
206 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
207 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
208 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
209 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
210 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
211 { R_PARISC_PLABEL14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
212 bfd_elf_generic_reloc, "R_PARISC_PLABEL14R", FALSE, 0, 0, FALSE },
213 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
214 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
215 /* 72 */
216 { R_PARISC_PCREL64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
217 bfd_elf_generic_reloc, "R_PARISC_PCREL64", FALSE, 0, 0, FALSE },
218 { R_PARISC_PCREL22C, 0, 0, 22, FALSE, 0, complain_overflow_bitfield,
219 bfd_elf_generic_reloc, "R_PARISC_PCREL22C", FALSE, 0, 0, FALSE },
220 { R_PARISC_PCREL22F, 0, 0, 22, FALSE, 0, complain_overflow_bitfield,
221 bfd_elf_generic_reloc, "R_PARISC_PCREL22F", FALSE, 0, 0, FALSE },
222 { R_PARISC_PCREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
223 bfd_elf_generic_reloc, "R_PARISC_PCREL14WR", FALSE, 0, 0, FALSE },
224 { R_PARISC_PCREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
225 bfd_elf_generic_reloc, "R_PARISC_PCREL14DR", FALSE, 0, 0, FALSE },
226 { R_PARISC_PCREL16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
227 bfd_elf_generic_reloc, "R_PARISC_PCREL16F", FALSE, 0, 0, FALSE },
228 { R_PARISC_PCREL16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
229 bfd_elf_generic_reloc, "R_PARISC_PCREL16WF", FALSE, 0, 0, FALSE },
230 { R_PARISC_PCREL16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
231 bfd_elf_generic_reloc, "R_PARISC_PCREL16DF", FALSE, 0, 0, FALSE },
232 /* 80 */
233 { R_PARISC_DIR64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
234 bfd_elf_generic_reloc, "R_PARISC_DIR64", FALSE, 0, 0, FALSE },
235 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
236 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
237 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
238 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
239 { R_PARISC_DIR14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
240 bfd_elf_generic_reloc, "R_PARISC_DIR14WR", FALSE, 0, 0, FALSE },
241 { R_PARISC_DIR14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
242 bfd_elf_generic_reloc, "R_PARISC_DIR14DR", FALSE, 0, 0, FALSE },
243 { R_PARISC_DIR16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
244 bfd_elf_generic_reloc, "R_PARISC_DIR16F", FALSE, 0, 0, FALSE },
245 { R_PARISC_DIR16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
246 bfd_elf_generic_reloc, "R_PARISC_DIR16WF", FALSE, 0, 0, FALSE },
247 { R_PARISC_DIR16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
248 bfd_elf_generic_reloc, "R_PARISC_DIR16DF", FALSE, 0, 0, FALSE },
249 /* 88 */
250 { R_PARISC_GPREL64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
251 bfd_elf_generic_reloc, "R_PARISC_GPREL64", FALSE, 0, 0, FALSE },
252 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
253 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
254 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
255 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
256 { R_PARISC_DLTREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
257 bfd_elf_generic_reloc, "R_PARISC_DLTREL14WR", FALSE, 0, 0, FALSE },
258 { R_PARISC_DLTREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
259 bfd_elf_generic_reloc, "R_PARISC_DLTREL14DR", FALSE, 0, 0, FALSE },
260 { R_PARISC_GPREL16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
261 bfd_elf_generic_reloc, "R_PARISC_GPREL16F", FALSE, 0, 0, FALSE },
262 { R_PARISC_GPREL16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
263 bfd_elf_generic_reloc, "R_PARISC_GPREL16WF", FALSE, 0, 0, FALSE },
264 { R_PARISC_GPREL16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
265 bfd_elf_generic_reloc, "R_PARISC_GPREL16DF", FALSE, 0, 0, FALSE },
266 /* 96 */
267 { R_PARISC_LTOFF64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
268 bfd_elf_generic_reloc, "R_PARISC_LTOFF64", FALSE, 0, 0, FALSE },
269 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
270 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
271 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
272 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
273 { R_PARISC_DLTIND14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
274 bfd_elf_generic_reloc, "R_PARISC_DLTIND14WR", FALSE, 0, 0, FALSE },
275 { R_PARISC_DLTIND14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
276 bfd_elf_generic_reloc, "R_PARISC_DLTIND14DR", FALSE, 0, 0, FALSE },
277 { R_PARISC_LTOFF16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
278 bfd_elf_generic_reloc, "R_PARISC_LTOFF16F", FALSE, 0, 0, FALSE },
279 { R_PARISC_LTOFF16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
280 bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", FALSE, 0, 0, FALSE },
281 { R_PARISC_LTOFF16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
282 bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", FALSE, 0, 0, FALSE },
283 /* 104 */
284 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
285 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
286 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
287 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
288 { R_PARISC_BASEREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
289 bfd_elf_generic_reloc, "R_PARISC_BASEREL14WR", FALSE, 0, 0, FALSE },
290 { R_PARISC_BASEREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
291 bfd_elf_generic_reloc, "R_PARISC_BASEREL14DR", FALSE, 0, 0, FALSE },
292 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
293 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
294 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
295 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
296 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
297 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
298 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
299 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
300 /* 112 */
301 { R_PARISC_SEGREL64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
302 bfd_elf_generic_reloc, "R_PARISC_SEGREL64", FALSE, 0, 0, FALSE },
303 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
304 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
305 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
306 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
307 { R_PARISC_PLTOFF14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
308 bfd_elf_generic_reloc, "R_PARISC_PLTOFF14WR", FALSE, 0, 0, FALSE },
309 { R_PARISC_PLTOFF14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
310 bfd_elf_generic_reloc, "R_PARISC_PLTOFF14DR", FALSE, 0, 0, FALSE },
311 { R_PARISC_PLTOFF16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
312 bfd_elf_generic_reloc, "R_PARISC_PLTOFF16F", FALSE, 0, 0, FALSE },
313 { R_PARISC_PLTOFF16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
314 bfd_elf_generic_reloc, "R_PARISC_PLTOFF16WF", FALSE, 0, 0, FALSE },
315 { R_PARISC_PLTOFF16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
316 bfd_elf_generic_reloc, "R_PARISC_PLTOFF16DF", FALSE, 0, 0, FALSE },
317 /* 120 */
318 { R_PARISC_LTOFF_FPTR64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
319 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
320 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
321 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
322 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
323 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
324 { R_PARISC_LTOFF_FPTR14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
325 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14WR", FALSE, 0, 0, FALSE },
326 { R_PARISC_LTOFF_FPTR14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
327 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14DR", FALSE, 0, 0, FALSE },
328 { R_PARISC_LTOFF_FPTR16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
329 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16F", FALSE, 0, 0, FALSE },
330 { R_PARISC_LTOFF_FPTR16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
331 bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16WF", FALSE, 0, 0, FALSE },
332 { R_PARISC_LTOFF_FPTR16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
333 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
334 /* 128 */
335 { R_PARISC_COPY, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
336 bfd_elf_generic_reloc, "R_PARISC_COPY", FALSE, 0, 0, FALSE },
337 { R_PARISC_IPLT, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
338 bfd_elf_generic_reloc, "R_PARISC_IPLT", FALSE, 0, 0, FALSE },
339 { R_PARISC_EPLT, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
340 bfd_elf_generic_reloc, "R_PARISC_EPLT", FALSE, 0, 0, FALSE },
341 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
342 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
343 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
344 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
345 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
346 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
347 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
348 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
349 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
350 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
351 /* 136 */
352 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
353 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
354 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
355 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
356 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
357 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
358 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
359 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
360 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
361 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
362 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
363 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
364 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
365 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
366 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
367 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
368 /* 144 */
369 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
370 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
371 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
372 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
373 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
374 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
375 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
376 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
377 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
378 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
379 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
380 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
381 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
382 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
383 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
384 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
385 /* 152 */
386 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
387 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
388 { R_PARISC_TPREL32, 0, 0, 32, FALSE, 0, complain_overflow_dont,
389 bfd_elf_generic_reloc, "R_PARISC_TPREL32", FALSE, 0, 0, FALSE },
390 { R_PARISC_TPREL21L, 0, 0, 21, FALSE, 0, complain_overflow_dont,
391 bfd_elf_generic_reloc, "R_PARISC_TPREL21L", FALSE, 0, 0, FALSE },
392 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
393 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
394 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
395 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
396 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
397 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
398 { R_PARISC_TPREL14R, 0, 0, 14, FALSE, 0, complain_overflow_dont,
399 bfd_elf_generic_reloc, "R_PARISC_TPREL14R", FALSE, 0, 0, FALSE },
400 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
401 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
402 /* 160 */
403 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
404 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
405 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
406 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
407 { R_PARISC_LTOFF_TP21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
408 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP21L", FALSE, 0, 0, FALSE },
409 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
410 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
411 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
412 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
413 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
414 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
415 { R_PARISC_LTOFF_TP14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
416 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
417 { R_PARISC_LTOFF_TP14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
418 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14F", FALSE, 0, 0, FALSE },
419 /* 168 */
420 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
421 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
422 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
423 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
424 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
425 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
426 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
427 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
428 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
429 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
430 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
431 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
432 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
433 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
434 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
435 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
436 /* 176 */
437 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
438 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
439 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
440 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
441 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
442 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
443 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
444 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
445 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
446 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
447 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
448 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
449 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
450 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
451 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
452 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
453 /* 184 */
454 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
455 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
456 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
457 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
458 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
459 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
460 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
461 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
462 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
463 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
464 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
465 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
466 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
467 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
468 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
469 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
470 /* 192 */
471 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
472 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
473 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
474 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
475 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
476 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
477 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
478 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
479 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
480 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
481 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
482 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
483 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
484 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
485 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
486 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
487 /* 200 */
488 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
489 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
490 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
491 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
492 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
493 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
494 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
495 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
496 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
497 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
498 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
499 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
500 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
501 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
502 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
503 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
504 /* 208 */
505 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
506 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
507 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
508 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
509 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
510 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
511 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
512 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
513 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
514 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
515 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
516 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
517 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
518 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
519 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
520 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
521 /* 216 */
522 { R_PARISC_TPREL64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
523 bfd_elf_generic_reloc, "R_PARISC_TPREL64", FALSE, 0, 0, FALSE },
524 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
525 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
526 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
527 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
528 { R_PARISC_TPREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_dont,
529 bfd_elf_generic_reloc, "R_PARISC_TPREL14WR", FALSE, 0, 0, FALSE },
530 { R_PARISC_TPREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
531 bfd_elf_generic_reloc, "R_PARISC_TPREL14DR", FALSE, 0, 0, FALSE },
532 { R_PARISC_TPREL16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
533 bfd_elf_generic_reloc, "R_PARISC_TPREL16F", FALSE, 0, 0, FALSE },
534 { R_PARISC_TPREL16WF, 0, 0, 16, FALSE, 0, complain_overflow_dont,
535 bfd_elf_generic_reloc, "R_PARISC_TPREL16WF", FALSE, 0, 0, FALSE },
536 { R_PARISC_TPREL16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
537 bfd_elf_generic_reloc, "R_PARISC_TPREL16DF", FALSE, 0, 0, FALSE },
538 /* 224 */
539 { R_PARISC_LTOFF_TP64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
540 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP64", FALSE, 0, 0, FALSE },
541 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
542 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
543 { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
544 bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
545 { R_PARISC_LTOFF_TP14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
546 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14WR", FALSE, 0, 0, FALSE },
547 { R_PARISC_LTOFF_TP14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
548 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14DR", FALSE, 0, 0, FALSE },
549 { R_PARISC_LTOFF_TP16F, 0, 0, 16, FALSE, 0, complain_overflow_dont,
550 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16F", FALSE, 0, 0, FALSE },
551 { R_PARISC_LTOFF_TP16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
552 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16WF", FALSE, 0, 0, FALSE },
553 { R_PARISC_LTOFF_TP16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
554 bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16DF", FALSE, 0, 0, FALSE },
555 /* 232 */
556 { R_PARISC_GNU_VTENTRY, 0, 0, 0, FALSE, 0, complain_overflow_dont,
557 bfd_elf_generic_reloc, "R_PARISC_GNU_VTENTRY", FALSE, 0, 0, FALSE },
558 { R_PARISC_GNU_VTINHERIT, 0, 0, 0, FALSE, 0, complain_overflow_dont,
559 bfd_elf_generic_reloc, "R_PARISC_GNU_VTINHERIT", FALSE, 0, 0, FALSE },
562 #define OFFSET_14R_FROM_21L 4
563 #define OFFSET_14F_FROM_21L 5
565 /* Return the final relocation type for the given base type, instruction
566 format, and field selector. */
568 elf_hppa_reloc_type
569 elf_hppa_reloc_final_type (bfd *abfd,
570 elf_hppa_reloc_type base_type,
571 int format,
572 unsigned int field)
574 elf_hppa_reloc_type final_type = base_type;
576 /* Just a tangle of nested switch statements to deal with the braindamage
577 that a different field selector means a completely different relocation
578 for PA ELF. */
579 switch (base_type)
581 /* We have been using generic relocation types. However, that may not
582 really make sense. Anyway, we need to support both R_PARISC_DIR64
583 and R_PARISC_DIR32 here. */
584 case R_PARISC_DIR32:
585 case R_PARISC_DIR64:
586 case R_HPPA_ABS_CALL:
587 switch (format)
589 case 14:
590 switch (field)
592 case e_fsel:
593 final_type = R_PARISC_DIR14F;
594 break;
595 case e_rsel:
596 case e_rrsel:
597 case e_rdsel:
598 final_type = R_PARISC_DIR14R;
599 break;
600 case e_rtsel:
601 final_type = R_PARISC_DLTIND14R;
602 break;
603 case e_rtpsel:
604 final_type = R_PARISC_LTOFF_FPTR14DR;
605 break;
606 case e_tsel:
607 final_type = R_PARISC_DLTIND14F;
608 break;
609 case e_rpsel:
610 final_type = R_PARISC_PLABEL14R;
611 break;
612 default:
613 return R_PARISC_NONE;
615 break;
617 case 17:
618 switch (field)
620 case e_fsel:
621 final_type = R_PARISC_DIR17F;
622 break;
623 case e_rsel:
624 case e_rrsel:
625 case e_rdsel:
626 final_type = R_PARISC_DIR17R;
627 break;
628 default:
629 return R_PARISC_NONE;
631 break;
633 case 21:
634 switch (field)
636 case e_lsel:
637 case e_lrsel:
638 case e_ldsel:
639 case e_nlsel:
640 case e_nlrsel:
641 final_type = R_PARISC_DIR21L;
642 break;
643 case e_ltsel:
644 final_type = R_PARISC_DLTIND21L;
645 break;
646 case e_ltpsel:
647 final_type = R_PARISC_LTOFF_FPTR21L;
648 break;
649 case e_lpsel:
650 final_type = R_PARISC_PLABEL21L;
651 break;
652 default:
653 return R_PARISC_NONE;
655 break;
657 case 32:
658 switch (field)
660 case e_fsel:
661 final_type = R_PARISC_DIR32;
662 /* When in 64bit mode, a 32bit relocation is supposed to
663 be a section relative relocation. Dwarf2 (for example)
664 uses 32bit section relative relocations. */
665 if (bfd_get_arch_info (abfd)->bits_per_address != 32)
666 final_type = R_PARISC_SECREL32;
667 break;
668 case e_psel:
669 final_type = R_PARISC_PLABEL32;
670 break;
671 default:
672 return R_PARISC_NONE;
674 break;
676 case 64:
677 switch (field)
679 case e_fsel:
680 final_type = R_PARISC_DIR64;
681 break;
682 case e_psel:
683 final_type = R_PARISC_FPTR64;
684 break;
685 default:
686 return R_PARISC_NONE;
688 break;
690 default:
691 return R_PARISC_NONE;
693 break;
695 case R_HPPA_GOTOFF:
696 switch (format)
698 case 14:
699 switch (field)
701 case e_rsel:
702 case e_rrsel:
703 case e_rdsel:
704 /* R_PARISC_DLTREL14R for elf64, R_PARISC_DPREL14R for elf32 */
705 final_type = base_type + OFFSET_14R_FROM_21L;
706 break;
707 case e_fsel:
708 /* R_PARISC_DLTREL14F for elf64, R_PARISC_DPREL14F for elf32 */
709 final_type = base_type + OFFSET_14F_FROM_21L;
710 break;
711 default:
712 return R_PARISC_NONE;
714 break;
716 case 21:
717 switch (field)
719 case e_lsel:
720 case e_lrsel:
721 case e_ldsel:
722 case e_nlsel:
723 case e_nlrsel:
724 /* R_PARISC_DLTREL21L for elf64, R_PARISC_DPREL21L for elf32 */
725 final_type = base_type;
726 break;
727 default:
728 return R_PARISC_NONE;
730 break;
732 default:
733 return R_PARISC_NONE;
735 break;
737 case R_HPPA_PCREL_CALL:
738 switch (format)
740 case 12:
741 switch (field)
743 case e_fsel:
744 final_type = R_PARISC_PCREL12F;
745 break;
746 default:
747 return R_PARISC_NONE;
749 break;
751 case 14:
752 /* Contrary to appearances, these are not calls of any sort.
753 Rather, they are loads/stores with a pcrel reloc. */
754 switch (field)
756 case e_rsel:
757 case e_rrsel:
758 case e_rdsel:
759 final_type = R_PARISC_PCREL14R;
760 break;
761 case e_fsel:
762 if (bfd_get_mach (abfd) < 25)
763 final_type = R_PARISC_PCREL14F;
764 else
765 final_type = R_PARISC_PCREL16F;
766 break;
767 default:
768 return R_PARISC_NONE;
770 break;
772 case 17:
773 switch (field)
775 case e_rsel:
776 case e_rrsel:
777 case e_rdsel:
778 final_type = R_PARISC_PCREL17R;
779 break;
780 case e_fsel:
781 final_type = R_PARISC_PCREL17F;
782 break;
783 default:
784 return R_PARISC_NONE;
786 break;
788 case 21:
789 switch (field)
791 case e_lsel:
792 case e_lrsel:
793 case e_ldsel:
794 case e_nlsel:
795 case e_nlrsel:
796 final_type = R_PARISC_PCREL21L;
797 break;
798 default:
799 return R_PARISC_NONE;
801 break;
803 case 22:
804 switch (field)
806 case e_fsel:
807 final_type = R_PARISC_PCREL22F;
808 break;
809 default:
810 return R_PARISC_NONE;
812 break;
814 case 32:
815 switch (field)
817 case e_fsel:
818 final_type = R_PARISC_PCREL32;
819 break;
820 default:
821 return R_PARISC_NONE;
823 break;
825 case 64:
826 switch (field)
828 case e_fsel:
829 final_type = R_PARISC_PCREL64;
830 break;
831 default:
832 return R_PARISC_NONE;
834 break;
836 default:
837 return R_PARISC_NONE;
839 break;
841 case R_PARISC_GNU_VTENTRY:
842 case R_PARISC_GNU_VTINHERIT:
843 case R_PARISC_SEGREL32:
844 case R_PARISC_SEGBASE:
845 /* The defaults are fine for these cases. */
846 break;
848 default:
849 return R_PARISC_NONE;
852 return final_type;
855 /* Return one (or more) BFD relocations which implement the base
856 relocation with modifications based on format and field. */
858 elf_hppa_reloc_type **
859 _bfd_elf_hppa_gen_reloc_type (bfd *abfd,
860 elf_hppa_reloc_type base_type,
861 int format,
862 unsigned int field,
863 int ignore ATTRIBUTE_UNUSED,
864 asymbol *sym ATTRIBUTE_UNUSED)
866 elf_hppa_reloc_type *finaltype;
867 elf_hppa_reloc_type **final_types;
868 bfd_size_type amt = sizeof (elf_hppa_reloc_type *) * 2;
870 /* Allocate slots for the BFD relocation. */
871 final_types = bfd_alloc (abfd, amt);
872 if (final_types == NULL)
873 return NULL;
875 /* Allocate space for the relocation itself. */
876 amt = sizeof (elf_hppa_reloc_type);
877 finaltype = bfd_alloc (abfd, amt);
878 if (finaltype == NULL)
879 return NULL;
881 /* Some reasonable defaults. */
882 final_types[0] = finaltype;
883 final_types[1] = NULL;
885 *finaltype = elf_hppa_reloc_final_type (abfd, base_type, format, field);
887 return final_types;
890 /* Translate from an elf into field into a howto relocation pointer. */
892 static void
893 elf_hppa_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
894 arelent *bfd_reloc,
895 Elf_Internal_Rela *elf_reloc)
897 BFD_ASSERT (ELF_R_TYPE (elf_reloc->r_info)
898 < (unsigned int) R_PARISC_UNIMPLEMENTED);
899 bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
902 /* Translate from an elf into field into a howto relocation pointer. */
904 static void
905 elf_hppa_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
906 arelent *bfd_reloc,
907 Elf_Internal_Rela *elf_reloc)
909 BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info)
910 < (unsigned int) R_PARISC_UNIMPLEMENTED);
911 bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
914 /* Return the address of the howto table entry to perform the CODE
915 relocation for an ARCH machine. */
917 static reloc_howto_type *
918 elf_hppa_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
919 bfd_reloc_code_real_type code)
921 if ((int) code < (int) R_PARISC_UNIMPLEMENTED)
923 BFD_ASSERT ((int) elf_hppa_howto_table[(int) code].type == (int) code);
924 return &elf_hppa_howto_table[(int) code];
926 return NULL;
929 /* Return TRUE if SYM represents a local label symbol. */
931 static bfd_boolean
932 elf_hppa_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name)
934 if (name[0] == 'L' && name[1] == '$')
935 return 1;
936 return _bfd_elf_is_local_label_name (abfd, name);
939 /* Set the correct type for an ELF section. We do this by the
940 section name, which is a hack, but ought to work. */
942 static bfd_boolean
943 elf_hppa_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
945 const char *name;
947 name = bfd_get_section_name (abfd, sec);
949 if (strcmp (name, ".PARISC.unwind") == 0)
951 int indx;
952 asection *asec;
953 #if ARCH_SIZE == 64
954 hdr->sh_type = SHT_LOPROC + 1;
955 #else
956 hdr->sh_type = 1;
957 #endif
958 /* ?!? How are unwinds supposed to work for symbols in arbitrary
959 sections? Or what if we have multiple .text sections in a single
960 .o file? HP really messed up on this one.
962 Ugh. We can not use elf_section_data (sec)->this_idx at this
963 point because it is not initialized yet.
965 So we (gasp) recompute it here. Hopefully nobody ever changes the
966 way sections are numbered in elf.c! */
967 for (asec = abfd->sections, indx = 1; asec; asec = asec->next, indx++)
969 if (asec->name && strcmp (asec->name, ".text") == 0)
971 hdr->sh_info = indx;
972 break;
976 /* I have no idea if this is really necessary or what it means. */
977 hdr->sh_entsize = 4;
979 return TRUE;
982 static void
983 elf_hppa_final_write_processing (bfd *abfd,
984 bfd_boolean linker ATTRIBUTE_UNUSED)
986 int mach = bfd_get_mach (abfd);
988 elf_elfheader (abfd)->e_flags &= ~(EF_PARISC_ARCH | EF_PARISC_TRAPNIL
989 | EF_PARISC_EXT | EF_PARISC_LSB
990 | EF_PARISC_WIDE | EF_PARISC_NO_KABP
991 | EF_PARISC_LAZYSWAP);
993 if (mach == 10)
994 elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_0;
995 else if (mach == 11)
996 elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_1;
997 else if (mach == 20)
998 elf_elfheader (abfd)->e_flags |= EFA_PARISC_2_0;
999 else if (mach == 25)
1000 elf_elfheader (abfd)->e_flags |= (EF_PARISC_WIDE
1001 | EFA_PARISC_2_0
1002 /* The GNU tools have trapped without
1003 option since 1993, so need to take
1004 a step backwards with the ELF
1005 based toolchains. */
1006 | EF_PARISC_TRAPNIL);
1009 /* Comparison function for qsort to sort unwind section during a
1010 final link. */
1012 static int
1013 hppa_unwind_entry_compare (const void *a, const void *b)
1015 const bfd_byte *ap, *bp;
1016 unsigned long av, bv;
1018 ap = a;
1019 av = (unsigned long) ap[0] << 24;
1020 av |= (unsigned long) ap[1] << 16;
1021 av |= (unsigned long) ap[2] << 8;
1022 av |= (unsigned long) ap[3];
1024 bp = b;
1025 bv = (unsigned long) bp[0] << 24;
1026 bv |= (unsigned long) bp[1] << 16;
1027 bv |= (unsigned long) bp[2] << 8;
1028 bv |= (unsigned long) bp[3];
1030 return av < bv ? -1 : av > bv ? 1 : 0;
1033 static bfd_boolean elf_hppa_sort_unwind (bfd *abfd)
1035 asection *s;
1037 /* Magic section names, but this is much safer than having
1038 relocate_section remember where SEGREL32 relocs occurred.
1039 Consider what happens if someone inept creates a linker script
1040 that puts unwind information in .text. */
1041 s = bfd_get_section_by_name (abfd, ".PARISC.unwind");
1042 if (s != NULL)
1044 bfd_size_type size;
1045 bfd_byte *contents;
1047 if (!bfd_malloc_and_get_section (abfd, s, &contents))
1048 return FALSE;
1050 size = s->size;
1051 qsort (contents, (size_t) (size / 16), 16, hppa_unwind_entry_compare);
1053 if (! bfd_set_section_contents (abfd, s, contents, (file_ptr) 0, size))
1054 return FALSE;
1057 return TRUE;
1060 /* What to do when ld finds relocations against symbols defined in
1061 discarded sections. */
1063 static unsigned int
1064 elf_hppa_action_discarded (asection *sec)
1066 if (strcmp (".PARISC.unwind", sec->name) == 0)
1067 return 0;
1069 return _bfd_elf_default_action_discarded (sec);
1072 #if ARCH_SIZE == 64
1073 /* Hook called by the linker routine which adds symbols from an object
1074 file. HP's libraries define symbols with HP specific section
1075 indices, which we have to handle. */
1077 static bfd_boolean
1078 elf_hppa_add_symbol_hook (bfd *abfd,
1079 struct bfd_link_info *info ATTRIBUTE_UNUSED,
1080 Elf_Internal_Sym *sym,
1081 const char **namep ATTRIBUTE_UNUSED,
1082 flagword *flagsp ATTRIBUTE_UNUSED,
1083 asection **secp,
1084 bfd_vma *valp)
1086 int index = sym->st_shndx;
1088 switch (index)
1090 case SHN_PARISC_ANSI_COMMON:
1091 *secp = bfd_make_section_old_way (abfd, ".PARISC.ansi.common");
1092 (*secp)->flags |= SEC_IS_COMMON;
1093 *valp = sym->st_size;
1094 break;
1096 case SHN_PARISC_HUGE_COMMON:
1097 *secp = bfd_make_section_old_way (abfd, ".PARISC.huge.common");
1098 (*secp)->flags |= SEC_IS_COMMON;
1099 *valp = sym->st_size;
1100 break;
1103 return TRUE;
1106 static bfd_boolean
1107 elf_hppa_unmark_useless_dynamic_symbols (struct elf_link_hash_entry *h,
1108 void *data)
1110 struct bfd_link_info *info = data;
1112 if (h->root.type == bfd_link_hash_warning)
1113 h = (struct elf_link_hash_entry *) h->root.u.i.link;
1115 /* If we are not creating a shared library, and this symbol is
1116 referenced by a shared library but is not defined anywhere, then
1117 the generic code will warn that it is undefined.
1119 This behavior is undesirable on HPs since the standard shared
1120 libraries contain references to undefined symbols.
1122 So we twiddle the flags associated with such symbols so that they
1123 will not trigger the warning. ?!? FIXME. This is horribly fragile.
1125 Ultimately we should have better controls over the generic ELF BFD
1126 linker code. */
1127 if (! info->relocatable
1128 && info->unresolved_syms_in_shared_libs != RM_IGNORE
1129 && h->root.type == bfd_link_hash_undefined
1130 && h->ref_dynamic
1131 && !h->ref_regular)
1133 h->ref_dynamic = 0;
1134 h->pointer_equality_needed = 1;
1137 return TRUE;
1140 static bfd_boolean
1141 elf_hppa_remark_useless_dynamic_symbols (struct elf_link_hash_entry *h,
1142 void *data)
1144 struct bfd_link_info *info = data;
1146 if (h->root.type == bfd_link_hash_warning)
1147 h = (struct elf_link_hash_entry *) h->root.u.i.link;
1149 /* If we are not creating a shared library, and this symbol is
1150 referenced by a shared library but is not defined anywhere, then
1151 the generic code will warn that it is undefined.
1153 This behavior is undesirable on HPs since the standard shared
1154 libraries contain references to undefined symbols.
1156 So we twiddle the flags associated with such symbols so that they
1157 will not trigger the warning. ?!? FIXME. This is horribly fragile.
1159 Ultimately we should have better controls over the generic ELF BFD
1160 linker code. */
1161 if (! info->relocatable
1162 && info->unresolved_syms_in_shared_libs != RM_IGNORE
1163 && h->root.type == bfd_link_hash_undefined
1164 && !h->ref_dynamic
1165 && !h->ref_regular
1166 && h->pointer_equality_needed)
1168 h->ref_dynamic = 1;
1169 h->pointer_equality_needed = 0;
1172 return TRUE;
1175 static bfd_boolean
1176 elf_hppa_is_dynamic_loader_symbol (const char *name)
1178 return (! strcmp (name, "__CPU_REVISION")
1179 || ! strcmp (name, "__CPU_KEYBITS_1")
1180 || ! strcmp (name, "__SYSTEM_ID_D")
1181 || ! strcmp (name, "__FPU_MODEL")
1182 || ! strcmp (name, "__FPU_REVISION")
1183 || ! strcmp (name, "__ARGC")
1184 || ! strcmp (name, "__ARGV")
1185 || ! strcmp (name, "__ENVP")
1186 || ! strcmp (name, "__TLS_SIZE_D")
1187 || ! strcmp (name, "__LOAD_INFO")
1188 || ! strcmp (name, "__systab"));
1191 /* Record the lowest address for the data and text segments. */
1192 static void
1193 elf_hppa_record_segment_addrs (bfd *abfd ATTRIBUTE_UNUSED,
1194 asection *section,
1195 void *data)
1197 struct elf64_hppa_link_hash_table *hppa_info;
1198 bfd_vma value;
1200 hppa_info = data;
1202 value = section->vma - section->filepos;
1204 if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1205 == (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1206 && value < hppa_info->text_segment_base)
1207 hppa_info->text_segment_base = value;
1208 else if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
1209 == (SEC_ALLOC | SEC_LOAD))
1210 && value < hppa_info->data_segment_base)
1211 hppa_info->data_segment_base = value;
1214 /* Called after we have seen all the input files/sections, but before
1215 final symbol resolution and section placement has been determined.
1217 We use this hook to (possibly) provide a value for __gp, then we
1218 fall back to the generic ELF final link routine. */
1220 static bfd_boolean
1221 elf_hppa_final_link (bfd *abfd, struct bfd_link_info *info)
1223 bfd_boolean retval;
1224 struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
1226 if (! info->relocatable)
1228 struct elf_link_hash_entry *gp;
1229 bfd_vma gp_val;
1231 /* The linker script defines a value for __gp iff it was referenced
1232 by one of the objects being linked. First try to find the symbol
1233 in the hash table. If that fails, just compute the value __gp
1234 should have had. */
1235 gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", FALSE,
1236 FALSE, FALSE);
1238 if (gp)
1241 /* Adjust the value of __gp as we may want to slide it into the
1242 .plt section so that the stubs can access PLT entries without
1243 using an addil sequence. */
1244 gp->root.u.def.value += hppa_info->gp_offset;
1246 gp_val = (gp->root.u.def.section->output_section->vma
1247 + gp->root.u.def.section->output_offset
1248 + gp->root.u.def.value);
1250 else
1252 asection *sec;
1254 /* First look for a .plt section. If found, then __gp is the
1255 address of the .plt + gp_offset.
1257 If no .plt is found, then look for .dlt, .opd and .data (in
1258 that order) and set __gp to the base address of whichever
1259 section is found first. */
1261 sec = hppa_info->plt_sec;
1262 if (sec && ! (sec->flags & SEC_EXCLUDE))
1263 gp_val = (sec->output_offset
1264 + sec->output_section->vma
1265 + hppa_info->gp_offset);
1266 else
1268 sec = hppa_info->dlt_sec;
1269 if (!sec || (sec->flags & SEC_EXCLUDE))
1270 sec = hppa_info->opd_sec;
1271 if (!sec || (sec->flags & SEC_EXCLUDE))
1272 sec = bfd_get_section_by_name (abfd, ".data");
1273 if (!sec || (sec->flags & SEC_EXCLUDE))
1274 gp_val = 0;
1275 else
1276 gp_val = sec->output_offset + sec->output_section->vma;
1280 /* Install whatever value we found/computed for __gp. */
1281 _bfd_set_gp_value (abfd, gp_val);
1284 /* We need to know the base of the text and data segments so that we
1285 can perform SEGREL relocations. We will record the base addresses
1286 when we encounter the first SEGREL relocation. */
1287 hppa_info->text_segment_base = (bfd_vma)-1;
1288 hppa_info->data_segment_base = (bfd_vma)-1;
1290 /* HP's shared libraries have references to symbols that are not
1291 defined anywhere. The generic ELF BFD linker code will complain
1292 about such symbols.
1294 So we detect the losing case and arrange for the flags on the symbol
1295 to indicate that it was never referenced. This keeps the generic
1296 ELF BFD link code happy and appears to not create any secondary
1297 problems. Ultimately we need a way to control the behavior of the
1298 generic ELF BFD link code better. */
1299 elf_link_hash_traverse (elf_hash_table (info),
1300 elf_hppa_unmark_useless_dynamic_symbols,
1301 info);
1303 /* Invoke the regular ELF backend linker to do all the work. */
1304 retval = bfd_elf_final_link (abfd, info);
1306 elf_link_hash_traverse (elf_hash_table (info),
1307 elf_hppa_remark_useless_dynamic_symbols,
1308 info);
1310 /* If we're producing a final executable, sort the contents of the
1311 unwind section. */
1312 if (retval)
1313 retval = elf_hppa_sort_unwind (abfd);
1315 return retval;
1318 /* Relocate an HPPA ELF section. */
1320 static bfd_boolean
1321 elf_hppa_relocate_section (bfd *output_bfd,
1322 struct bfd_link_info *info,
1323 bfd *input_bfd,
1324 asection *input_section,
1325 bfd_byte *contents,
1326 Elf_Internal_Rela *relocs,
1327 Elf_Internal_Sym *local_syms,
1328 asection **local_sections)
1330 Elf_Internal_Shdr *symtab_hdr;
1331 Elf_Internal_Rela *rel;
1332 Elf_Internal_Rela *relend;
1333 struct elf64_hppa_link_hash_table *hppa_info;
1335 if (info->relocatable)
1336 return TRUE;
1338 hppa_info = elf64_hppa_hash_table (info);
1339 symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
1341 rel = relocs;
1342 relend = relocs + input_section->reloc_count;
1343 for (; rel < relend; rel++)
1345 int r_type;
1346 reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
1347 unsigned long r_symndx;
1348 struct elf_link_hash_entry *h;
1349 Elf_Internal_Sym *sym;
1350 asection *sym_sec;
1351 bfd_vma relocation;
1352 bfd_reloc_status_type r;
1353 const char *dyn_name;
1354 char *dynh_buf = NULL;
1355 size_t dynh_buflen = 0;
1356 struct elf64_hppa_dyn_hash_entry *dyn_h = NULL;
1358 r_type = ELF_R_TYPE (rel->r_info);
1359 if (r_type < 0 || r_type >= (int) R_PARISC_UNIMPLEMENTED)
1361 bfd_set_error (bfd_error_bad_value);
1362 return FALSE;
1365 /* This is a final link. */
1366 r_symndx = ELF_R_SYM (rel->r_info);
1367 h = NULL;
1368 sym = NULL;
1369 sym_sec = NULL;
1370 if (r_symndx < symtab_hdr->sh_info)
1372 /* This is a local symbol. */
1373 sym = local_syms + r_symndx;
1374 sym_sec = local_sections[r_symndx];
1375 relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel);
1377 /* If this symbol has an entry in the PA64 dynamic hash
1378 table, then get it. */
1379 dyn_name = get_dyn_name (input_bfd, h, rel,
1380 &dynh_buf, &dynh_buflen);
1381 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1382 dyn_name, FALSE, FALSE);
1385 else
1387 /* This is not a local symbol. */
1388 long indx;
1390 indx = r_symndx - symtab_hdr->sh_info;
1391 h = elf_sym_hashes (input_bfd)[indx];
1392 while (h->root.type == bfd_link_hash_indirect
1393 || h->root.type == bfd_link_hash_warning)
1394 h = (struct elf_link_hash_entry *) h->root.u.i.link;
1395 if (h->root.type == bfd_link_hash_defined
1396 || h->root.type == bfd_link_hash_defweak)
1398 sym_sec = h->root.u.def.section;
1400 /* If this symbol has an entry in the PA64 dynamic hash
1401 table, then get it. */
1402 dyn_name = get_dyn_name (input_bfd, h, rel,
1403 &dynh_buf, &dynh_buflen);
1404 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1405 dyn_name, FALSE, FALSE);
1407 /* If we have a relocation against a symbol defined in a
1408 shared library and we have not created an entry in the
1409 PA64 dynamic symbol hash table for it, then we lose. */
1410 if (sym_sec->output_section == NULL && dyn_h == NULL)
1412 (*_bfd_error_handler)
1413 (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
1414 input_bfd,
1415 input_section,
1416 (long) rel->r_offset,
1417 howto->name,
1418 h->root.root.string);
1419 relocation = 0;
1421 else if (sym_sec->output_section)
1422 relocation = (h->root.u.def.value
1423 + sym_sec->output_offset
1424 + sym_sec->output_section->vma);
1425 /* Value will be provided via one of the offsets in the
1426 dyn_h hash table entry. */
1427 else
1428 relocation = 0;
1430 else if (info->unresolved_syms_in_objects == RM_IGNORE
1431 && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
1433 /* If this symbol has an entry in the PA64 dynamic hash
1434 table, then get it. */
1435 dyn_name = get_dyn_name (input_bfd, h, rel,
1436 &dynh_buf, &dynh_buflen);
1437 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1438 dyn_name, FALSE, FALSE);
1440 if (dyn_h == NULL)
1442 (*_bfd_error_handler)
1443 (_("%B(%A): warning: unresolvable relocation against symbol `%s'"),
1444 input_bfd, input_section, h->root.root.string);
1446 relocation = 0;
1448 else if (h->root.type == bfd_link_hash_undefweak)
1450 dyn_name = get_dyn_name (input_bfd, h, rel,
1451 &dynh_buf, &dynh_buflen);
1452 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1453 dyn_name, FALSE, FALSE);
1455 if (dyn_h == NULL)
1457 (*_bfd_error_handler)
1458 (_("%B(%A): warning: unresolvable relocation against symbol `%s'"),
1459 input_bfd, input_section, h->root.root.string);
1461 relocation = 0;
1463 else
1465 /* Ignore dynamic loader defined symbols. */
1466 if (elf_hppa_is_dynamic_loader_symbol (h->root.root.string))
1467 relocation = 0;
1468 else
1470 if (!((*info->callbacks->undefined_symbol)
1471 (info, h->root.root.string, input_bfd,
1472 input_section, rel->r_offset,
1473 (info->unresolved_syms_in_objects == RM_GENERATE_ERROR
1474 || ELF_ST_VISIBILITY (h->other)))))
1475 return FALSE;
1476 break;
1481 r = elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
1482 input_section, contents,
1483 relocation, info, sym_sec,
1484 h, dyn_h);
1486 if (r != bfd_reloc_ok)
1488 switch (r)
1490 default:
1491 abort ();
1492 case bfd_reloc_overflow:
1494 const char *sym_name;
1496 if (h != NULL)
1497 sym_name = NULL;
1498 else
1500 sym_name = bfd_elf_string_from_elf_section (input_bfd,
1501 symtab_hdr->sh_link,
1502 sym->st_name);
1503 if (sym_name == NULL)
1504 return FALSE;
1505 if (*sym_name == '\0')
1506 sym_name = bfd_section_name (input_bfd, sym_sec);
1509 if (!((*info->callbacks->reloc_overflow)
1510 (info, (h ? &h->root : NULL), sym_name,
1511 howto->name, (bfd_vma) 0, input_bfd,
1512 input_section, rel->r_offset)))
1513 return FALSE;
1515 break;
1519 return TRUE;
1522 /* Compute the value for a relocation (REL) during a final link stage,
1523 then insert the value into the proper location in CONTENTS.
1525 VALUE is a tentative value for the relocation and may be overridden
1526 and modified here based on the specific relocation to be performed.
1528 For example we do conversions for PC-relative branches in this routine
1529 or redirection of calls to external routines to stubs.
1531 The work of actually applying the relocation is left to a helper
1532 routine in an attempt to reduce the complexity and size of this
1533 function. */
1535 static bfd_reloc_status_type
1536 elf_hppa_final_link_relocate (Elf_Internal_Rela *rel,
1537 bfd *input_bfd,
1538 bfd *output_bfd,
1539 asection *input_section,
1540 bfd_byte *contents,
1541 bfd_vma value,
1542 struct bfd_link_info *info,
1543 asection *sym_sec,
1544 struct elf_link_hash_entry *h ATTRIBUTE_UNUSED,
1545 struct elf64_hppa_dyn_hash_entry *dyn_h)
1547 int insn;
1548 bfd_vma offset = rel->r_offset;
1549 bfd_signed_vma addend = rel->r_addend;
1550 reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
1551 unsigned int r_type = howto->type;
1552 bfd_byte *hit_data = contents + offset;
1553 struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
1555 insn = bfd_get_32 (input_bfd, hit_data);
1557 switch (r_type)
1559 case R_PARISC_NONE:
1560 break;
1562 /* Basic function call support.
1564 Note for a call to a function defined in another dynamic library
1565 we want to redirect the call to a stub. */
1567 /* Random PC relative relocs. */
1568 case R_PARISC_PCREL21L:
1569 case R_PARISC_PCREL14R:
1570 case R_PARISC_PCREL14F:
1571 case R_PARISC_PCREL14WR:
1572 case R_PARISC_PCREL14DR:
1573 case R_PARISC_PCREL16F:
1574 case R_PARISC_PCREL16WF:
1575 case R_PARISC_PCREL16DF:
1577 /* If this is a call to a function defined in another dynamic
1578 library, then redirect the call to the local stub for this
1579 function. */
1580 if (sym_sec == NULL || sym_sec->output_section == NULL)
1581 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1582 + hppa_info->stub_sec->output_section->vma);
1584 /* Turn VALUE into a proper PC relative address. */
1585 value -= (offset + input_section->output_offset
1586 + input_section->output_section->vma);
1588 /* Adjust for any field selectors. */
1589 if (r_type == R_PARISC_PCREL21L)
1590 value = hppa_field_adjust (value, -8 + addend, e_lsel);
1591 else if (r_type == R_PARISC_PCREL14F
1592 || r_type == R_PARISC_PCREL16F
1593 || r_type == R_PARISC_PCREL16WF
1594 || r_type == R_PARISC_PCREL16DF)
1595 value = hppa_field_adjust (value, -8 + addend, e_fsel);
1596 else
1597 value = hppa_field_adjust (value, -8 + addend, e_rsel);
1599 /* Apply the relocation to the given instruction. */
1600 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1601 break;
1604 case R_PARISC_PCREL12F:
1605 case R_PARISC_PCREL22F:
1606 case R_PARISC_PCREL17F:
1607 case R_PARISC_PCREL22C:
1608 case R_PARISC_PCREL17C:
1609 case R_PARISC_PCREL17R:
1611 /* If this is a call to a function defined in another dynamic
1612 library, then redirect the call to the local stub for this
1613 function. */
1614 if (sym_sec == NULL || sym_sec->output_section == NULL)
1615 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1616 + hppa_info->stub_sec->output_section->vma);
1618 /* Turn VALUE into a proper PC relative address. */
1619 value -= (offset + input_section->output_offset
1620 + input_section->output_section->vma);
1622 /* Adjust for any field selectors. */
1623 if (r_type == R_PARISC_PCREL17R)
1624 value = hppa_field_adjust (value, -8 + addend, e_rsel);
1625 else
1626 value = hppa_field_adjust (value, -8 + addend, e_fsel);
1628 /* All branches are implicitly shifted by 2 places. */
1629 value >>= 2;
1631 /* Apply the relocation to the given instruction. */
1632 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1633 break;
1636 /* Indirect references to data through the DLT. */
1637 case R_PARISC_DLTIND14R:
1638 case R_PARISC_DLTIND14F:
1639 case R_PARISC_DLTIND14DR:
1640 case R_PARISC_DLTIND14WR:
1641 case R_PARISC_DLTIND21L:
1642 case R_PARISC_LTOFF_FPTR14R:
1643 case R_PARISC_LTOFF_FPTR14DR:
1644 case R_PARISC_LTOFF_FPTR14WR:
1645 case R_PARISC_LTOFF_FPTR21L:
1646 case R_PARISC_LTOFF_FPTR16F:
1647 case R_PARISC_LTOFF_FPTR16WF:
1648 case R_PARISC_LTOFF_FPTR16DF:
1649 case R_PARISC_LTOFF_TP21L:
1650 case R_PARISC_LTOFF_TP14R:
1651 case R_PARISC_LTOFF_TP14F:
1652 case R_PARISC_LTOFF_TP14WR:
1653 case R_PARISC_LTOFF_TP14DR:
1654 case R_PARISC_LTOFF_TP16F:
1655 case R_PARISC_LTOFF_TP16WF:
1656 case R_PARISC_LTOFF_TP16DF:
1657 case R_PARISC_LTOFF16F:
1658 case R_PARISC_LTOFF16WF:
1659 case R_PARISC_LTOFF16DF:
1661 /* If this relocation was against a local symbol, then we still
1662 have not set up the DLT entry (it's not convenient to do so
1663 in the "finalize_dlt" routine because it is difficult to get
1664 to the local symbol's value).
1666 So, if this is a local symbol (h == NULL), then we need to
1667 fill in its DLT entry.
1669 Similarly we may still need to set up an entry in .opd for
1670 a local function which had its address taken. */
1671 if (dyn_h->h == NULL)
1673 /* Now do .opd creation if needed. */
1674 if (r_type == R_PARISC_LTOFF_FPTR14R
1675 || r_type == R_PARISC_LTOFF_FPTR14DR
1676 || r_type == R_PARISC_LTOFF_FPTR14WR
1677 || r_type == R_PARISC_LTOFF_FPTR21L
1678 || r_type == R_PARISC_LTOFF_FPTR16F
1679 || r_type == R_PARISC_LTOFF_FPTR16WF
1680 || r_type == R_PARISC_LTOFF_FPTR16DF)
1682 /* The first two words of an .opd entry are zero. */
1683 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset,
1684 0, 16);
1686 /* The next word is the address of the function. */
1687 bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
1688 (hppa_info->opd_sec->contents
1689 + dyn_h->opd_offset + 16));
1691 /* The last word is our local __gp value. */
1692 value = _bfd_get_gp_value
1693 (hppa_info->opd_sec->output_section->owner);
1694 bfd_put_64 (hppa_info->opd_sec->owner, value,
1695 (hppa_info->opd_sec->contents
1696 + dyn_h->opd_offset + 24));
1698 /* The DLT value is the address of the .opd entry. */
1699 value = (dyn_h->opd_offset
1700 + hppa_info->opd_sec->output_offset
1701 + hppa_info->opd_sec->output_section->vma);
1702 addend = 0;
1705 bfd_put_64 (hppa_info->dlt_sec->owner,
1706 value + addend,
1707 hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
1710 /* We want the value of the DLT offset for this symbol, not
1711 the symbol's actual address. Note that __gp may not point
1712 to the start of the DLT, so we have to compute the absolute
1713 address, then subtract out the value of __gp. */
1714 value = (dyn_h->dlt_offset
1715 + hppa_info->dlt_sec->output_offset
1716 + hppa_info->dlt_sec->output_section->vma);
1717 value -= _bfd_get_gp_value (output_bfd);
1719 /* All DLTIND relocations are basically the same at this point,
1720 except that we need different field selectors for the 21bit
1721 version vs the 14bit versions. */
1722 if (r_type == R_PARISC_DLTIND21L
1723 || r_type == R_PARISC_LTOFF_FPTR21L
1724 || r_type == R_PARISC_LTOFF_TP21L)
1725 value = hppa_field_adjust (value, 0, e_lsel);
1726 else if (r_type == R_PARISC_DLTIND14F
1727 || r_type == R_PARISC_LTOFF_FPTR16F
1728 || r_type == R_PARISC_LTOFF_FPTR16WF
1729 || r_type == R_PARISC_LTOFF_FPTR16DF
1730 || r_type == R_PARISC_LTOFF16F
1731 || r_type == R_PARISC_LTOFF16DF
1732 || r_type == R_PARISC_LTOFF16WF
1733 || r_type == R_PARISC_LTOFF_TP16F
1734 || r_type == R_PARISC_LTOFF_TP16WF
1735 || r_type == R_PARISC_LTOFF_TP16DF)
1736 value = hppa_field_adjust (value, 0, e_fsel);
1737 else
1738 value = hppa_field_adjust (value, 0, e_rsel);
1740 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1741 break;
1744 case R_PARISC_DLTREL14R:
1745 case R_PARISC_DLTREL14F:
1746 case R_PARISC_DLTREL14DR:
1747 case R_PARISC_DLTREL14WR:
1748 case R_PARISC_DLTREL21L:
1749 case R_PARISC_DPREL21L:
1750 case R_PARISC_DPREL14WR:
1751 case R_PARISC_DPREL14DR:
1752 case R_PARISC_DPREL14R:
1753 case R_PARISC_DPREL14F:
1754 case R_PARISC_GPREL16F:
1755 case R_PARISC_GPREL16WF:
1756 case R_PARISC_GPREL16DF:
1758 /* Subtract out the global pointer value to make value a DLT
1759 relative address. */
1760 value -= _bfd_get_gp_value (output_bfd);
1762 /* All DLTREL relocations are basically the same at this point,
1763 except that we need different field selectors for the 21bit
1764 version vs the 14bit versions. */
1765 if (r_type == R_PARISC_DLTREL21L
1766 || r_type == R_PARISC_DPREL21L)
1767 value = hppa_field_adjust (value, addend, e_lrsel);
1768 else if (r_type == R_PARISC_DLTREL14F
1769 || r_type == R_PARISC_DPREL14F
1770 || r_type == R_PARISC_GPREL16F
1771 || r_type == R_PARISC_GPREL16WF
1772 || r_type == R_PARISC_GPREL16DF)
1773 value = hppa_field_adjust (value, addend, e_fsel);
1774 else
1775 value = hppa_field_adjust (value, addend, e_rrsel);
1777 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1778 break;
1781 case R_PARISC_DIR21L:
1782 case R_PARISC_DIR17R:
1783 case R_PARISC_DIR17F:
1784 case R_PARISC_DIR14R:
1785 case R_PARISC_DIR14F:
1786 case R_PARISC_DIR14WR:
1787 case R_PARISC_DIR14DR:
1788 case R_PARISC_DIR16F:
1789 case R_PARISC_DIR16WF:
1790 case R_PARISC_DIR16DF:
1792 /* All DIR relocations are basically the same at this point,
1793 except that branch offsets need to be divided by four, and
1794 we need different field selectors. Note that we don't
1795 redirect absolute calls to local stubs. */
1797 if (r_type == R_PARISC_DIR21L)
1798 value = hppa_field_adjust (value, addend, e_lrsel);
1799 else if (r_type == R_PARISC_DIR17F
1800 || r_type == R_PARISC_DIR16F
1801 || r_type == R_PARISC_DIR16WF
1802 || r_type == R_PARISC_DIR16DF
1803 || r_type == R_PARISC_DIR14F)
1804 value = hppa_field_adjust (value, addend, e_fsel);
1805 else
1806 value = hppa_field_adjust (value, addend, e_rrsel);
1808 if (r_type == R_PARISC_DIR17R || r_type == R_PARISC_DIR17F)
1810 /* All branches are implicitly shifted by 2 places. */
1811 value >>= 2;
1814 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1815 break;
1818 case R_PARISC_PLTOFF21L:
1819 case R_PARISC_PLTOFF14R:
1820 case R_PARISC_PLTOFF14F:
1821 case R_PARISC_PLTOFF14WR:
1822 case R_PARISC_PLTOFF14DR:
1823 case R_PARISC_PLTOFF16F:
1824 case R_PARISC_PLTOFF16WF:
1825 case R_PARISC_PLTOFF16DF:
1827 /* We want the value of the PLT offset for this symbol, not
1828 the symbol's actual address. Note that __gp may not point
1829 to the start of the DLT, so we have to compute the absolute
1830 address, then subtract out the value of __gp. */
1831 value = (dyn_h->plt_offset
1832 + hppa_info->plt_sec->output_offset
1833 + hppa_info->plt_sec->output_section->vma);
1834 value -= _bfd_get_gp_value (output_bfd);
1836 /* All PLTOFF relocations are basically the same at this point,
1837 except that we need different field selectors for the 21bit
1838 version vs the 14bit versions. */
1839 if (r_type == R_PARISC_PLTOFF21L)
1840 value = hppa_field_adjust (value, addend, e_lrsel);
1841 else if (r_type == R_PARISC_PLTOFF14F
1842 || r_type == R_PARISC_PLTOFF16F
1843 || r_type == R_PARISC_PLTOFF16WF
1844 || r_type == R_PARISC_PLTOFF16DF)
1845 value = hppa_field_adjust (value, addend, e_fsel);
1846 else
1847 value = hppa_field_adjust (value, addend, e_rrsel);
1849 insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
1850 break;
1853 case R_PARISC_LTOFF_FPTR32:
1855 /* We may still need to create the FPTR itself if it was for
1856 a local symbol. */
1857 if (dyn_h->h == NULL)
1859 /* The first two words of an .opd entry are zero. */
1860 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1862 /* The next word is the address of the function. */
1863 bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
1864 (hppa_info->opd_sec->contents
1865 + dyn_h->opd_offset + 16));
1867 /* The last word is our local __gp value. */
1868 value = _bfd_get_gp_value
1869 (hppa_info->opd_sec->output_section->owner);
1870 bfd_put_64 (hppa_info->opd_sec->owner, value,
1871 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1873 /* The DLT value is the address of the .opd entry. */
1874 value = (dyn_h->opd_offset
1875 + hppa_info->opd_sec->output_offset
1876 + hppa_info->opd_sec->output_section->vma);
1878 bfd_put_64 (hppa_info->dlt_sec->owner,
1879 value,
1880 hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
1883 /* We want the value of the DLT offset for this symbol, not
1884 the symbol's actual address. Note that __gp may not point
1885 to the start of the DLT, so we have to compute the absolute
1886 address, then subtract out the value of __gp. */
1887 value = (dyn_h->dlt_offset
1888 + hppa_info->dlt_sec->output_offset
1889 + hppa_info->dlt_sec->output_section->vma);
1890 value -= _bfd_get_gp_value (output_bfd);
1891 bfd_put_32 (input_bfd, value, hit_data);
1892 return bfd_reloc_ok;
1895 case R_PARISC_LTOFF_FPTR64:
1896 case R_PARISC_LTOFF_TP64:
1898 /* We may still need to create the FPTR itself if it was for
1899 a local symbol. */
1900 if (dyn_h->h == NULL && r_type == R_PARISC_LTOFF_FPTR64)
1902 /* The first two words of an .opd entry are zero. */
1903 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1905 /* The next word is the address of the function. */
1906 bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
1907 (hppa_info->opd_sec->contents
1908 + dyn_h->opd_offset + 16));
1910 /* The last word is our local __gp value. */
1911 value = _bfd_get_gp_value
1912 (hppa_info->opd_sec->output_section->owner);
1913 bfd_put_64 (hppa_info->opd_sec->owner, value,
1914 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1916 /* The DLT value is the address of the .opd entry. */
1917 value = (dyn_h->opd_offset
1918 + hppa_info->opd_sec->output_offset
1919 + hppa_info->opd_sec->output_section->vma);
1921 bfd_put_64 (hppa_info->dlt_sec->owner,
1922 value,
1923 hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
1926 /* We want the value of the DLT offset for this symbol, not
1927 the symbol's actual address. Note that __gp may not point
1928 to the start of the DLT, so we have to compute the absolute
1929 address, then subtract out the value of __gp. */
1930 value = (dyn_h->dlt_offset
1931 + hppa_info->dlt_sec->output_offset
1932 + hppa_info->dlt_sec->output_section->vma);
1933 value -= _bfd_get_gp_value (output_bfd);
1934 bfd_put_64 (input_bfd, value, hit_data);
1935 return bfd_reloc_ok;
1938 case R_PARISC_DIR32:
1939 bfd_put_32 (input_bfd, value + addend, hit_data);
1940 return bfd_reloc_ok;
1942 case R_PARISC_DIR64:
1943 bfd_put_64 (input_bfd, value + addend, hit_data);
1944 return bfd_reloc_ok;
1946 case R_PARISC_GPREL64:
1947 /* Subtract out the global pointer value to make value a DLT
1948 relative address. */
1949 value -= _bfd_get_gp_value (output_bfd);
1951 bfd_put_64 (input_bfd, value + addend, hit_data);
1952 return bfd_reloc_ok;
1954 case R_PARISC_LTOFF64:
1955 /* We want the value of the DLT offset for this symbol, not
1956 the symbol's actual address. Note that __gp may not point
1957 to the start of the DLT, so we have to compute the absolute
1958 address, then subtract out the value of __gp. */
1959 value = (dyn_h->dlt_offset
1960 + hppa_info->dlt_sec->output_offset
1961 + hppa_info->dlt_sec->output_section->vma);
1962 value -= _bfd_get_gp_value (output_bfd);
1964 bfd_put_64 (input_bfd, value + addend, hit_data);
1965 return bfd_reloc_ok;
1967 case R_PARISC_PCREL32:
1969 /* If this is a call to a function defined in another dynamic
1970 library, then redirect the call to the local stub for this
1971 function. */
1972 if (sym_sec == NULL || sym_sec->output_section == NULL)
1973 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1974 + hppa_info->stub_sec->output_section->vma);
1976 /* Turn VALUE into a proper PC relative address. */
1977 value -= (offset + input_section->output_offset
1978 + input_section->output_section->vma);
1980 value += addend;
1981 value -= 8;
1982 bfd_put_32 (input_bfd, value, hit_data);
1983 return bfd_reloc_ok;
1986 case R_PARISC_PCREL64:
1988 /* If this is a call to a function defined in another dynamic
1989 library, then redirect the call to the local stub for this
1990 function. */
1991 if (sym_sec == NULL || sym_sec->output_section == NULL)
1992 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1993 + hppa_info->stub_sec->output_section->vma);
1995 /* Turn VALUE into a proper PC relative address. */
1996 value -= (offset + input_section->output_offset
1997 + input_section->output_section->vma);
1999 value += addend;
2000 value -= 8;
2001 bfd_put_64 (input_bfd, value, hit_data);
2002 return bfd_reloc_ok;
2005 case R_PARISC_FPTR64:
2007 /* We may still need to create the FPTR itself if it was for
2008 a local symbol. */
2009 if (dyn_h->h == NULL)
2011 /* The first two words of an .opd entry are zero. */
2012 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
2014 /* The next word is the address of the function. */
2015 bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
2016 (hppa_info->opd_sec->contents
2017 + dyn_h->opd_offset + 16));
2019 /* The last word is our local __gp value. */
2020 value = _bfd_get_gp_value
2021 (hppa_info->opd_sec->output_section->owner);
2022 bfd_put_64 (hppa_info->opd_sec->owner, value,
2023 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
2026 if (dyn_h->want_opd)
2027 /* We want the value of the OPD offset for this symbol. */
2028 value = (dyn_h->opd_offset
2029 + hppa_info->opd_sec->output_offset
2030 + hppa_info->opd_sec->output_section->vma);
2031 else
2032 /* We want the address of the symbol. */
2033 value += addend;
2035 bfd_put_64 (input_bfd, value, hit_data);
2036 return bfd_reloc_ok;
2039 case R_PARISC_SECREL32:
2040 bfd_put_32 (input_bfd,
2041 value + addend - sym_sec->output_section->vma,
2042 hit_data);
2043 return bfd_reloc_ok;
2045 case R_PARISC_SEGREL32:
2046 case R_PARISC_SEGREL64:
2048 /* If this is the first SEGREL relocation, then initialize
2049 the segment base values. */
2050 if (hppa_info->text_segment_base == (bfd_vma) -1)
2051 bfd_map_over_sections (output_bfd, elf_hppa_record_segment_addrs,
2052 hppa_info);
2054 /* VALUE holds the absolute address. We want to include the
2055 addend, then turn it into a segment relative address.
2057 The segment is derived from SYM_SEC. We assume that there are
2058 only two segments of note in the resulting executable/shlib.
2059 A readonly segment (.text) and a readwrite segment (.data). */
2060 value += addend;
2062 if (sym_sec->flags & SEC_CODE)
2063 value -= hppa_info->text_segment_base;
2064 else
2065 value -= hppa_info->data_segment_base;
2067 if (r_type == R_PARISC_SEGREL32)
2068 bfd_put_32 (input_bfd, value, hit_data);
2069 else
2070 bfd_put_64 (input_bfd, value, hit_data);
2071 return bfd_reloc_ok;
2074 /* Something we don't know how to handle. */
2075 default:
2076 return bfd_reloc_notsupported;
2079 /* Update the instruction word. */
2080 bfd_put_32 (input_bfd, (bfd_vma) insn, hit_data);
2081 return bfd_reloc_ok;
2084 /* Relocate the given INSN. VALUE should be the actual value we want
2085 to insert into the instruction, ie by this point we should not be
2086 concerned with computing an offset relative to the DLT, PC, etc.
2087 Instead this routine is meant to handle the bit manipulations needed
2088 to insert the relocation into the given instruction. */
2090 static int
2091 elf_hppa_relocate_insn (int insn, int sym_value, unsigned int r_type)
2093 switch (r_type)
2095 /* This is any 22 bit branch. In PA2.0 syntax it corresponds to
2096 the "B" instruction. */
2097 case R_PARISC_PCREL22F:
2098 case R_PARISC_PCREL22C:
2099 return (insn & ~0x3ff1ffd) | re_assemble_22 (sym_value);
2101 /* This is any 12 bit branch. */
2102 case R_PARISC_PCREL12F:
2103 return (insn & ~0x1ffd) | re_assemble_12 (sym_value);
2105 /* This is any 17 bit branch. In PA2.0 syntax it also corresponds
2106 to the "B" instruction as well as BE. */
2107 case R_PARISC_PCREL17F:
2108 case R_PARISC_DIR17F:
2109 case R_PARISC_DIR17R:
2110 case R_PARISC_PCREL17C:
2111 case R_PARISC_PCREL17R:
2112 return (insn & ~0x1f1ffd) | re_assemble_17 (sym_value);
2114 /* ADDIL or LDIL instructions. */
2115 case R_PARISC_DLTREL21L:
2116 case R_PARISC_DLTIND21L:
2117 case R_PARISC_LTOFF_FPTR21L:
2118 case R_PARISC_PCREL21L:
2119 case R_PARISC_LTOFF_TP21L:
2120 case R_PARISC_DPREL21L:
2121 case R_PARISC_PLTOFF21L:
2122 case R_PARISC_DIR21L:
2123 return (insn & ~0x1fffff) | re_assemble_21 (sym_value);
2125 /* LDO and integer loads/stores with 14 bit displacements. */
2126 case R_PARISC_DLTREL14R:
2127 case R_PARISC_DLTREL14F:
2128 case R_PARISC_DLTIND14R:
2129 case R_PARISC_DLTIND14F:
2130 case R_PARISC_LTOFF_FPTR14R:
2131 case R_PARISC_PCREL14R:
2132 case R_PARISC_PCREL14F:
2133 case R_PARISC_LTOFF_TP14R:
2134 case R_PARISC_LTOFF_TP14F:
2135 case R_PARISC_DPREL14R:
2136 case R_PARISC_DPREL14F:
2137 case R_PARISC_PLTOFF14R:
2138 case R_PARISC_PLTOFF14F:
2139 case R_PARISC_DIR14R:
2140 case R_PARISC_DIR14F:
2141 return (insn & ~0x3fff) | low_sign_unext (sym_value, 14);
2143 /* PA2.0W LDO and integer loads/stores with 16 bit displacements. */
2144 case R_PARISC_LTOFF_FPTR16F:
2145 case R_PARISC_PCREL16F:
2146 case R_PARISC_LTOFF_TP16F:
2147 case R_PARISC_GPREL16F:
2148 case R_PARISC_PLTOFF16F:
2149 case R_PARISC_DIR16F:
2150 case R_PARISC_LTOFF16F:
2151 return (insn & ~0xffff) | re_assemble_16 (sym_value);
2153 /* Doubleword loads and stores with a 14 bit displacement. */
2154 case R_PARISC_DLTREL14DR:
2155 case R_PARISC_DLTIND14DR:
2156 case R_PARISC_LTOFF_FPTR14DR:
2157 case R_PARISC_LTOFF_FPTR16DF:
2158 case R_PARISC_PCREL14DR:
2159 case R_PARISC_PCREL16DF:
2160 case R_PARISC_LTOFF_TP14DR:
2161 case R_PARISC_LTOFF_TP16DF:
2162 case R_PARISC_DPREL14DR:
2163 case R_PARISC_GPREL16DF:
2164 case R_PARISC_PLTOFF14DR:
2165 case R_PARISC_PLTOFF16DF:
2166 case R_PARISC_DIR14DR:
2167 case R_PARISC_DIR16DF:
2168 case R_PARISC_LTOFF16DF:
2169 return (insn & ~0x3ff1) | (((sym_value & 0x2000) >> 13)
2170 | ((sym_value & 0x1ff8) << 1));
2172 /* Floating point single word load/store instructions. */
2173 case R_PARISC_DLTREL14WR:
2174 case R_PARISC_DLTIND14WR:
2175 case R_PARISC_LTOFF_FPTR14WR:
2176 case R_PARISC_LTOFF_FPTR16WF:
2177 case R_PARISC_PCREL14WR:
2178 case R_PARISC_PCREL16WF:
2179 case R_PARISC_LTOFF_TP14WR:
2180 case R_PARISC_LTOFF_TP16WF:
2181 case R_PARISC_DPREL14WR:
2182 case R_PARISC_GPREL16WF:
2183 case R_PARISC_PLTOFF14WR:
2184 case R_PARISC_PLTOFF16WF:
2185 case R_PARISC_DIR16WF:
2186 case R_PARISC_DIR14WR:
2187 case R_PARISC_LTOFF16WF:
2188 return (insn & ~0x3ff9) | (((sym_value & 0x2000) >> 13)
2189 | ((sym_value & 0x1ffc) << 1));
2191 default:
2192 return insn;
2195 #endif