Commit | Line | Data |
---|---|---|
9e103c9c | 1 | /* Common code for PA ELF implementations. |
555cd476 AM |
2 | Copyright 1999, 2000, 2001, 2002, 2003, 2004 |
3 | Free Software Foundation, Inc. | |
9e103c9c JL |
4 | |
5 | This file is part of BFD, the Binary File Descriptor library. | |
6 | ||
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. | |
11 | ||
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. | |
16 | ||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
20 | ||
21 | #define ELF_HOWTO_TABLE_SIZE R_PARISC_UNIMPLEMENTED + 1 | |
22 | ||
2eb429af JL |
23 | /* This file is included by multiple PA ELF BFD backends with different |
24 | sizes. | |
25 | ||
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. */ | |
9e103c9c JL |
29 | #if ARCH_SIZE == 64 |
30 | #define ELF_R_TYPE(X) ELF64_R_TYPE(X) | |
2eb429af | 31 | #define ELF_R_SYM(X) ELF64_R_SYM(X) |
189c6563 | 32 | #define elf_hppa_reloc_final_type elf64_hppa_reloc_final_type |
9e103c9c | 33 | #define _bfd_elf_hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type |
2eb429af | 34 | #define elf_hppa_relocate_section elf64_hppa_relocate_section |
2eb429af | 35 | #define elf_hppa_final_link elf64_hppa_final_link |
9e103c9c JL |
36 | #endif |
37 | #if ARCH_SIZE == 32 | |
38 | #define ELF_R_TYPE(X) ELF32_R_TYPE(X) | |
2eb429af | 39 | #define ELF_R_SYM(X) ELF32_R_SYM(X) |
189c6563 | 40 | #define elf_hppa_reloc_final_type elf32_hppa_reloc_final_type |
9e103c9c | 41 | #define _bfd_elf_hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type |
2eb429af | 42 | #define elf_hppa_relocate_section elf32_hppa_relocate_section |
2eb429af | 43 | #define elf_hppa_final_link elf32_hppa_final_link |
9e103c9c JL |
44 | #endif |
45 | ||
49bd834c | 46 | #if ARCH_SIZE == 64 |
3f9b03b5 | 47 | static bfd_reloc_status_type elf_hppa_final_link_relocate |
c39a58e6 AM |
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 *); | |
3f9b03b5 | 51 | |
dc810e39 | 52 | static int elf_hppa_relocate_insn |
c39a58e6 | 53 | (int, int, unsigned int); |
3f9b03b5 AM |
54 | #endif |
55 | ||
9e103c9c JL |
56 | /* ELF/PA relocation howto entries. */ |
57 | ||
58 | static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] = | |
59 | { | |
b34976b6 AM |
60 | { R_PARISC_NONE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, |
61 | bfd_elf_generic_reloc, "R_PARISC_NONE", FALSE, 0, 0, FALSE }, | |
9e103c9c JL |
62 | |
63 | /* The values in DIR32 are to placate the check in | |
64 | _bfd_stab_section_find_nearest_line. */ | |
b34976b6 AM |
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 }, | |
49bd834c | 79 | /* 8 */ |
b34976b6 AM |
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 }, | |
49bd834c | 96 | /* 16 */ |
b34976b6 AM |
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 }, | |
49bd834c | 113 | /* 24 */ |
b34976b6 AM |
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 }, | |
49bd834c | 130 | /* 32 */ |
b34976b6 AM |
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 }, | |
49bd834c | 147 | /* 40 */ |
b34976b6 AM |
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 }, | |
49bd834c | 164 | /* 48 */ |
b34976b6 AM |
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 }, | |
49bd834c | 181 | /* 56 */ |
b34976b6 AM |
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 }, | |
49bd834c | 198 | /* 64 */ |
b34976b6 AM |
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 }, | |
49bd834c | 215 | /* 72 */ |
b34976b6 AM |
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 }, | |
49bd834c | 232 | /* 80 */ |
b34976b6 AM |
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 }, | |
49bd834c | 249 | /* 88 */ |
b34976b6 AM |
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 }, | |
49bd834c | 266 | /* 96 */ |
b34976b6 AM |
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 }, | |
49bd834c | 283 | /* 104 */ |
b34976b6 AM |
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 }, | |
49bd834c | 300 | /* 112 */ |
b34976b6 AM |
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 }, | |
49bd834c | 317 | /* 120 */ |
b34976b6 AM |
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 }, | |
49bd834c | 334 | /* 128 */ |
b34976b6 AM |
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 }, | |
49bd834c | 351 | /* 136 */ |
b34976b6 AM |
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 }, | |
49bd834c | 368 | /* 144 */ |
b34976b6 AM |
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 }, | |
49bd834c | 385 | /* 152 */ |
b34976b6 AM |
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 }, | |
49bd834c | 402 | /* 160 */ |
b34976b6 AM |
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 }, | |
49bd834c | 419 | /* 168 */ |
b34976b6 AM |
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 }, | |
49bd834c | 436 | /* 176 */ |
b34976b6 AM |
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 }, | |
49bd834c | 453 | /* 184 */ |
b34976b6 AM |
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 }, | |
49bd834c | 470 | /* 192 */ |
b34976b6 AM |
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 }, | |
49bd834c | 487 | /* 200 */ |
b34976b6 AM |
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 }, | |
49bd834c | 504 | /* 208 */ |
b34976b6 AM |
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 }, | |
49bd834c | 521 | /* 216 */ |
b34976b6 AM |
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 }, | |
49bd834c | 538 | /* 224 */ |
b34976b6 AM |
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 }, | |
49bd834c | 555 | /* 232 */ |
b34976b6 AM |
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 }, | |
9e103c9c JL |
560 | }; |
561 | ||
6e2bf930 JL |
562 | #define OFFSET_14R_FROM_21L 4 |
563 | #define OFFSET_14F_FROM_21L 5 | |
564 | ||
189c6563 AM |
565 | /* Return the final relocation type for the given base type, instruction |
566 | format, and field selector. */ | |
9e103c9c | 567 | |
189c6563 | 568 | elf_hppa_reloc_type |
c39a58e6 AM |
569 | elf_hppa_reloc_final_type (bfd *abfd, |
570 | elf_hppa_reloc_type base_type, | |
571 | int format, | |
572 | unsigned int field) | |
9e103c9c | 573 | { |
189c6563 | 574 | elf_hppa_reloc_type final_type = base_type; |
9e103c9c JL |
575 | |
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) | |
580 | { | |
0d571602 JL |
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: | |
9e103c9c JL |
586 | case R_HPPA_ABS_CALL: |
587 | switch (format) | |
588 | { | |
589 | case 14: | |
590 | switch (field) | |
591 | { | |
47d89dba AM |
592 | case e_fsel: |
593 | final_type = R_PARISC_DIR14F; | |
594 | break; | |
9e103c9c JL |
595 | case e_rsel: |
596 | case e_rrsel: | |
47d89dba | 597 | case e_rdsel: |
9e103c9c JL |
598 | final_type = R_PARISC_DIR14R; |
599 | break; | |
600 | case e_rtsel: | |
f31cedf7 | 601 | final_type = R_PARISC_DLTIND14R; |
9e103c9c | 602 | break; |
36860900 JL |
603 | case e_rtpsel: |
604 | final_type = R_PARISC_LTOFF_FPTR14DR; | |
605 | break; | |
9e103c9c | 606 | case e_tsel: |
f31cedf7 | 607 | final_type = R_PARISC_DLTIND14F; |
9e103c9c JL |
608 | break; |
609 | case e_rpsel: | |
610 | final_type = R_PARISC_PLABEL14R; | |
611 | break; | |
612 | default: | |
189c6563 | 613 | return R_PARISC_NONE; |
9e103c9c JL |
614 | } |
615 | break; | |
616 | ||
617 | case 17: | |
618 | switch (field) | |
619 | { | |
620 | case e_fsel: | |
621 | final_type = R_PARISC_DIR17F; | |
622 | break; | |
623 | case e_rsel: | |
624 | case e_rrsel: | |
47d89dba | 625 | case e_rdsel: |
9e103c9c JL |
626 | final_type = R_PARISC_DIR17R; |
627 | break; | |
628 | default: | |
189c6563 | 629 | return R_PARISC_NONE; |
9e103c9c JL |
630 | } |
631 | break; | |
632 | ||
633 | case 21: | |
634 | switch (field) | |
635 | { | |
636 | case e_lsel: | |
637 | case e_lrsel: | |
47d89dba | 638 | case e_ldsel: |
edd21aca AM |
639 | case e_nlsel: |
640 | case e_nlrsel: | |
9e103c9c JL |
641 | final_type = R_PARISC_DIR21L; |
642 | break; | |
643 | case e_ltsel: | |
f31cedf7 | 644 | final_type = R_PARISC_DLTIND21L; |
9e103c9c | 645 | break; |
36860900 JL |
646 | case e_ltpsel: |
647 | final_type = R_PARISC_LTOFF_FPTR21L; | |
648 | break; | |
9e103c9c JL |
649 | case e_lpsel: |
650 | final_type = R_PARISC_PLABEL21L; | |
651 | break; | |
652 | default: | |
189c6563 | 653 | return R_PARISC_NONE; |
9e103c9c JL |
654 | } |
655 | break; | |
656 | ||
657 | case 32: | |
658 | switch (field) | |
659 | { | |
660 | case e_fsel: | |
661 | final_type = R_PARISC_DIR32; | |
432bdd91 JL |
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) | |
46fe4e66 | 666 | final_type = R_PARISC_SECREL32; |
9e103c9c JL |
667 | break; |
668 | case e_psel: | |
669 | final_type = R_PARISC_PLABEL32; | |
670 | break; | |
671 | default: | |
189c6563 | 672 | return R_PARISC_NONE; |
9e103c9c JL |
673 | } |
674 | break; | |
675 | ||
6e2bf930 JL |
676 | case 64: |
677 | switch (field) | |
678 | { | |
679 | case e_fsel: | |
680 | final_type = R_PARISC_DIR64; | |
681 | break; | |
682 | case e_psel: | |
36860900 JL |
683 | final_type = R_PARISC_FPTR64; |
684 | break; | |
6e2bf930 | 685 | default: |
189c6563 | 686 | return R_PARISC_NONE; |
6e2bf930 JL |
687 | } |
688 | break; | |
689 | ||
9e103c9c | 690 | default: |
189c6563 | 691 | return R_PARISC_NONE; |
9e103c9c JL |
692 | } |
693 | break; | |
694 | ||
9e103c9c JL |
695 | case R_HPPA_GOTOFF: |
696 | switch (format) | |
697 | { | |
698 | case 14: | |
699 | switch (field) | |
700 | { | |
701 | case e_rsel: | |
702 | case e_rrsel: | |
47d89dba | 703 | case e_rdsel: |
edd21aca | 704 | /* R_PARISC_DLTREL14R for elf64, R_PARISC_DPREL14R for elf32 */ |
6e2bf930 | 705 | final_type = base_type + OFFSET_14R_FROM_21L; |
9e103c9c JL |
706 | break; |
707 | case e_fsel: | |
edd21aca | 708 | /* R_PARISC_DLTREL14F for elf64, R_PARISC_DPREL14F for elf32 */ |
6e2bf930 | 709 | final_type = base_type + OFFSET_14F_FROM_21L; |
9e103c9c JL |
710 | break; |
711 | default: | |
189c6563 | 712 | return R_PARISC_NONE; |
9e103c9c JL |
713 | } |
714 | break; | |
715 | ||
716 | case 21: | |
717 | switch (field) | |
718 | { | |
9e103c9c | 719 | case e_lsel: |
edd21aca | 720 | case e_lrsel: |
47d89dba | 721 | case e_ldsel: |
edd21aca AM |
722 | case e_nlsel: |
723 | case e_nlrsel: | |
724 | /* R_PARISC_DLTREL21L for elf64, R_PARISC_DPREL21L for elf32 */ | |
6e2bf930 | 725 | final_type = base_type; |
9e103c9c JL |
726 | break; |
727 | default: | |
189c6563 | 728 | return R_PARISC_NONE; |
9e103c9c JL |
729 | } |
730 | break; | |
731 | ||
732 | default: | |
189c6563 | 733 | return R_PARISC_NONE; |
9e103c9c JL |
734 | } |
735 | break; | |
736 | ||
9e103c9c JL |
737 | case R_HPPA_PCREL_CALL: |
738 | switch (format) | |
739 | { | |
49bd834c AM |
740 | case 12: |
741 | switch (field) | |
742 | { | |
743 | case e_fsel: | |
744 | final_type = R_PARISC_PCREL12F; | |
745 | break; | |
746 | default: | |
189c6563 | 747 | return R_PARISC_NONE; |
49bd834c AM |
748 | } |
749 | break; | |
750 | ||
9e103c9c | 751 | case 14: |
49bd834c AM |
752 | /* Contrary to appearances, these are not calls of any sort. |
753 | Rather, they are loads/stores with a pcrel reloc. */ | |
9e103c9c JL |
754 | switch (field) |
755 | { | |
756 | case e_rsel: | |
757 | case e_rrsel: | |
47d89dba | 758 | case e_rdsel: |
9e103c9c JL |
759 | final_type = R_PARISC_PCREL14R; |
760 | break; | |
761 | case e_fsel: | |
ba94744e AM |
762 | if (bfd_get_mach (abfd) < 25) |
763 | final_type = R_PARISC_PCREL14F; | |
764 | else | |
765 | final_type = R_PARISC_PCREL16F; | |
9e103c9c JL |
766 | break; |
767 | default: | |
189c6563 | 768 | return R_PARISC_NONE; |
9e103c9c JL |
769 | } |
770 | break; | |
771 | ||
772 | case 17: | |
773 | switch (field) | |
774 | { | |
775 | case e_rsel: | |
776 | case e_rrsel: | |
47d89dba | 777 | case e_rdsel: |
9e103c9c JL |
778 | final_type = R_PARISC_PCREL17R; |
779 | break; | |
780 | case e_fsel: | |
781 | final_type = R_PARISC_PCREL17F; | |
782 | break; | |
783 | default: | |
189c6563 | 784 | return R_PARISC_NONE; |
9e103c9c JL |
785 | } |
786 | break; | |
787 | ||
edd21aca | 788 | case 21: |
341362b5 JL |
789 | switch (field) |
790 | { | |
edd21aca AM |
791 | case e_lsel: |
792 | case e_lrsel: | |
47d89dba | 793 | case e_ldsel: |
edd21aca AM |
794 | case e_nlsel: |
795 | case e_nlrsel: | |
796 | final_type = R_PARISC_PCREL21L; | |
341362b5 JL |
797 | break; |
798 | default: | |
189c6563 | 799 | return R_PARISC_NONE; |
341362b5 JL |
800 | } |
801 | break; | |
802 | ||
edd21aca | 803 | case 22: |
9e103c9c JL |
804 | switch (field) |
805 | { | |
edd21aca AM |
806 | case e_fsel: |
807 | final_type = R_PARISC_PCREL22F; | |
9e103c9c JL |
808 | break; |
809 | default: | |
189c6563 | 810 | return R_PARISC_NONE; |
9e103c9c JL |
811 | } |
812 | break; | |
813 | ||
9992270f DA |
814 | case 32: |
815 | switch (field) | |
816 | { | |
817 | case e_fsel: | |
818 | final_type = R_PARISC_PCREL32; | |
819 | break; | |
820 | default: | |
821 | return R_PARISC_NONE; | |
822 | } | |
823 | break; | |
824 | ||
825 | case 64: | |
826 | switch (field) | |
827 | { | |
828 | case e_fsel: | |
829 | final_type = R_PARISC_PCREL64; | |
830 | break; | |
831 | default: | |
832 | return R_PARISC_NONE; | |
833 | } | |
834 | break; | |
835 | ||
9e103c9c | 836 | default: |
189c6563 | 837 | return R_PARISC_NONE; |
9e103c9c JL |
838 | } |
839 | break; | |
840 | ||
49bd834c AM |
841 | case R_PARISC_GNU_VTENTRY: |
842 | case R_PARISC_GNU_VTINHERIT: | |
fc91f658 JL |
843 | case R_PARISC_SEGREL32: |
844 | case R_PARISC_SEGBASE: | |
845 | /* The defaults are fine for these cases. */ | |
846 | break; | |
847 | ||
9e103c9c | 848 | default: |
189c6563 | 849 | return R_PARISC_NONE; |
9e103c9c JL |
850 | } |
851 | ||
189c6563 AM |
852 | return final_type; |
853 | } | |
854 | ||
855 | /* Return one (or more) BFD relocations which implement the base | |
856 | relocation with modifications based on format and field. */ | |
857 | ||
858 | elf_hppa_reloc_type ** | |
c39a58e6 AM |
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) | |
189c6563 AM |
865 | { |
866 | elf_hppa_reloc_type *finaltype; | |
867 | elf_hppa_reloc_type **final_types; | |
868 | bfd_size_type amt = sizeof (elf_hppa_reloc_type *) * 2; | |
869 | ||
870 | /* Allocate slots for the BFD relocation. */ | |
c39a58e6 | 871 | final_types = bfd_alloc (abfd, amt); |
189c6563 AM |
872 | if (final_types == NULL) |
873 | return NULL; | |
874 | ||
875 | /* Allocate space for the relocation itself. */ | |
876 | amt = sizeof (elf_hppa_reloc_type); | |
c39a58e6 | 877 | finaltype = bfd_alloc (abfd, amt); |
189c6563 AM |
878 | if (finaltype == NULL) |
879 | return NULL; | |
880 | ||
881 | /* Some reasonable defaults. */ | |
882 | final_types[0] = finaltype; | |
883 | final_types[1] = NULL; | |
884 | ||
885 | *finaltype = elf_hppa_reloc_final_type (abfd, base_type, format, field); | |
886 | ||
9e103c9c JL |
887 | return final_types; |
888 | } | |
889 | ||
890 | /* Translate from an elf into field into a howto relocation pointer. */ | |
891 | ||
892 | static void | |
c39a58e6 AM |
893 | elf_hppa_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, |
894 | arelent *bfd_reloc, | |
895 | Elf_Internal_Rela *elf_reloc) | |
9e103c9c | 896 | { |
c39a58e6 | 897 | BFD_ASSERT (ELF_R_TYPE (elf_reloc->r_info) |
9e103c9c JL |
898 | < (unsigned int) R_PARISC_UNIMPLEMENTED); |
899 | bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)]; | |
900 | } | |
901 | ||
902 | /* Translate from an elf into field into a howto relocation pointer. */ | |
903 | ||
904 | static void | |
c39a58e6 AM |
905 | elf_hppa_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, |
906 | arelent *bfd_reloc, | |
907 | Elf_Internal_Rela *elf_reloc) | |
9e103c9c JL |
908 | { |
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)]; | |
912 | } | |
913 | ||
914 | /* Return the address of the howto table entry to perform the CODE | |
915 | relocation for an ARCH machine. */ | |
916 | ||
917 | static reloc_howto_type * | |
c39a58e6 AM |
918 | elf_hppa_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, |
919 | bfd_reloc_code_real_type code) | |
9e103c9c JL |
920 | { |
921 | if ((int) code < (int) R_PARISC_UNIMPLEMENTED) | |
922 | { | |
923 | BFD_ASSERT ((int) elf_hppa_howto_table[(int) code].type == (int) code); | |
924 | return &elf_hppa_howto_table[(int) code]; | |
925 | } | |
926 | return NULL; | |
927 | } | |
95cbae0b | 928 | |
b34976b6 | 929 | /* Return TRUE if SYM represents a local label symbol. */ |
432bdd91 | 930 | |
b34976b6 | 931 | static bfd_boolean |
c39a58e6 | 932 | elf_hppa_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name) |
432bdd91 | 933 | { |
49bd834c AM |
934 | if (name[0] == 'L' && name[1] == '$') |
935 | return 1; | |
936 | return _bfd_elf_is_local_label_name (abfd, name); | |
432bdd91 JL |
937 | } |
938 | ||
052e120f JL |
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. */ | |
941 | ||
b34976b6 | 942 | static bfd_boolean |
c39a58e6 | 943 | elf_hppa_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec) |
052e120f | 944 | { |
c39a58e6 | 945 | const char *name; |
052e120f JL |
946 | |
947 | name = bfd_get_section_name (abfd, sec); | |
948 | ||
949 | if (strcmp (name, ".PARISC.unwind") == 0) | |
950 | { | |
1ca74062 | 951 | int indx; |
edd21aca | 952 | asection *asec; |
3f9b03b5 | 953 | #if ARCH_SIZE == 64 |
052e120f | 954 | hdr->sh_type = SHT_LOPROC + 1; |
3f9b03b5 AM |
955 | #else |
956 | hdr->sh_type = 1; | |
957 | #endif | |
052e120f JL |
958 | /* ?!? How are unwinds supposed to work for symbols in arbitrary |
959 | sections? Or what if we have multiple .text sections in a single | |
be7582f3 | 960 | .o file? HP really messed up on this one. |
052e120f | 961 | |
1ca74062 JL |
962 | Ugh. We can not use elf_section_data (sec)->this_idx at this |
963 | point because it is not initialized yet. | |
964 | ||
965 | So we (gasp) recompute it here. Hopefully nobody ever changes the | |
966 | way sections are numbered in elf.c! */ | |
edd21aca | 967 | for (asec = abfd->sections, indx = 1; asec; asec = asec->next, indx++) |
1ca74062 | 968 | { |
edd21aca | 969 | if (asec->name && strcmp (asec->name, ".text") == 0) |
1ca74062 JL |
970 | { |
971 | hdr->sh_info = indx; | |
972 | break; | |
973 | } | |
974 | } | |
be7582f3 | 975 | |
052e120f JL |
976 | /* I have no idea if this is really necessary or what it means. */ |
977 | hdr->sh_entsize = 4; | |
978 | } | |
b34976b6 | 979 | return TRUE; |
052e120f JL |
980 | } |
981 | ||
3f9b03b5 | 982 | static void |
c39a58e6 AM |
983 | elf_hppa_final_write_processing (bfd *abfd, |
984 | bfd_boolean linker ATTRIBUTE_UNUSED) | |
3f9b03b5 AM |
985 | { |
986 | int mach = bfd_get_mach (abfd); | |
987 | ||
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); | |
992 | ||
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); | |
1007 | } | |
1008 | ||
46fe4e66 AM |
1009 | /* Comparison function for qsort to sort unwind section during a |
1010 | final link. */ | |
1011 | ||
1012 | static int | |
c39a58e6 | 1013 | hppa_unwind_entry_compare (const void *a, const void *b) |
46fe4e66 AM |
1014 | { |
1015 | const bfd_byte *ap, *bp; | |
1016 | unsigned long av, bv; | |
1017 | ||
c39a58e6 | 1018 | ap = a; |
46fe4e66 AM |
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]; | |
1023 | ||
c39a58e6 | 1024 | bp = b; |
46fe4e66 AM |
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]; | |
1029 | ||
1030 | return av < bv ? -1 : av > bv ? 1 : 0; | |
1031 | } | |
1032 | ||
c39a58e6 | 1033 | static bfd_boolean elf_hppa_sort_unwind (bfd *abfd) |
46fe4e66 AM |
1034 | { |
1035 | asection *s; | |
1036 | ||
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) | |
1043 | { | |
1044 | bfd_size_type size; | |
1045 | char *contents; | |
1046 | ||
1047 | size = s->_raw_size; | |
1048 | contents = bfd_malloc (size); | |
1049 | if (contents == NULL) | |
b34976b6 | 1050 | return FALSE; |
46fe4e66 AM |
1051 | |
1052 | if (! bfd_get_section_contents (abfd, s, contents, (file_ptr) 0, size)) | |
b34976b6 | 1053 | return FALSE; |
46fe4e66 AM |
1054 | |
1055 | qsort (contents, (size_t) (size / 16), 16, hppa_unwind_entry_compare); | |
1056 | ||
1057 | if (! bfd_set_section_contents (abfd, s, contents, (file_ptr) 0, size)) | |
b34976b6 | 1058 | return FALSE; |
46fe4e66 AM |
1059 | } |
1060 | ||
b34976b6 | 1061 | return TRUE; |
46fe4e66 AM |
1062 | } |
1063 | ||
49bd834c | 1064 | #if ARCH_SIZE == 64 |
2eb429af JL |
1065 | /* Hook called by the linker routine which adds symbols from an object |
1066 | file. HP's libraries define symbols with HP specific section | |
1067 | indices, which we have to handle. */ | |
1068 | ||
b34976b6 | 1069 | static bfd_boolean |
c39a58e6 AM |
1070 | elf_hppa_add_symbol_hook (bfd *abfd, |
1071 | struct bfd_link_info *info ATTRIBUTE_UNUSED, | |
555cd476 | 1072 | Elf_Internal_Sym *sym, |
c39a58e6 AM |
1073 | const char **namep ATTRIBUTE_UNUSED, |
1074 | flagword *flagsp ATTRIBUTE_UNUSED, | |
1075 | asection **secp, | |
1076 | bfd_vma *valp) | |
2eb429af JL |
1077 | { |
1078 | int index = sym->st_shndx; | |
be7582f3 | 1079 | |
2eb429af JL |
1080 | switch (index) |
1081 | { | |
1082 | case SHN_PARISC_ANSI_COMMON: | |
1083 | *secp = bfd_make_section_old_way (abfd, ".PARISC.ansi.common"); | |
1084 | (*secp)->flags |= SEC_IS_COMMON; | |
1085 | *valp = sym->st_size; | |
1086 | break; | |
be7582f3 | 1087 | |
2eb429af JL |
1088 | case SHN_PARISC_HUGE_COMMON: |
1089 | *secp = bfd_make_section_old_way (abfd, ".PARISC.huge.common"); | |
1090 | (*secp)->flags |= SEC_IS_COMMON; | |
1091 | *valp = sym->st_size; | |
1092 | break; | |
1093 | } | |
1094 | ||
b34976b6 | 1095 | return TRUE; |
2eb429af JL |
1096 | } |
1097 | ||
b34976b6 | 1098 | static bfd_boolean |
c39a58e6 AM |
1099 | elf_hppa_unmark_useless_dynamic_symbols (struct elf_link_hash_entry *h, |
1100 | void *data) | |
af7dc644 | 1101 | { |
c39a58e6 | 1102 | struct bfd_link_info *info = data; |
af7dc644 | 1103 | |
e92d460e AM |
1104 | if (h->root.type == bfd_link_hash_warning) |
1105 | h = (struct elf_link_hash_entry *) h->root.u.i.link; | |
1106 | ||
af7dc644 JL |
1107 | /* If we are not creating a shared library, and this symbol is |
1108 | referenced by a shared library but is not defined anywhere, then | |
1109 | the generic code will warn that it is undefined. | |
1110 | ||
1111 | This behavior is undesirable on HPs since the standard shared | |
3f9b03b5 | 1112 | libraries contain references to undefined symbols. |
af7dc644 JL |
1113 | |
1114 | So we twiddle the flags associated with such symbols so that they | |
3f9b03b5 | 1115 | will not trigger the warning. ?!? FIXME. This is horribly fragile. |
af7dc644 JL |
1116 | |
1117 | Ultimately we should have better controls over the generic ELF BFD | |
1118 | linker code. */ | |
1049f94e | 1119 | if (! info->relocatable |
59c2e50f | 1120 | && info->unresolved_syms_in_shared_libs != RM_IGNORE |
af7dc644 JL |
1121 | && h->root.type == bfd_link_hash_undefined |
1122 | && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0 | |
1123 | && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0) | |
1124 | { | |
1125 | h->elf_link_hash_flags &= ~ELF_LINK_HASH_REF_DYNAMIC; | |
1126 | h->elf_link_hash_flags |= 0x8000; | |
1127 | } | |
1128 | ||
b34976b6 | 1129 | return TRUE; |
af7dc644 JL |
1130 | } |
1131 | ||
b34976b6 | 1132 | static bfd_boolean |
c39a58e6 AM |
1133 | elf_hppa_remark_useless_dynamic_symbols (struct elf_link_hash_entry *h, |
1134 | void *data) | |
af7dc644 | 1135 | { |
c39a58e6 | 1136 | struct bfd_link_info *info = data; |
af7dc644 | 1137 | |
e92d460e AM |
1138 | if (h->root.type == bfd_link_hash_warning) |
1139 | h = (struct elf_link_hash_entry *) h->root.u.i.link; | |
1140 | ||
af7dc644 JL |
1141 | /* If we are not creating a shared library, and this symbol is |
1142 | referenced by a shared library but is not defined anywhere, then | |
1143 | the generic code will warn that it is undefined. | |
1144 | ||
1145 | This behavior is undesirable on HPs since the standard shared | |
4cc11e76 | 1146 | libraries contain references to undefined symbols. |
af7dc644 JL |
1147 | |
1148 | So we twiddle the flags associated with such symbols so that they | |
228d307f | 1149 | will not trigger the warning. ?!? FIXME. This is horribly fragile. |
af7dc644 JL |
1150 | |
1151 | Ultimately we should have better controls over the generic ELF BFD | |
1152 | linker code. */ | |
1049f94e | 1153 | if (! info->relocatable |
59c2e50f | 1154 | && info->unresolved_syms_in_shared_libs != RM_IGNORE |
af7dc644 JL |
1155 | && h->root.type == bfd_link_hash_undefined |
1156 | && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0 | |
1157 | && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0 | |
1158 | && (h->elf_link_hash_flags & 0x8000) != 0) | |
1159 | { | |
1160 | h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC; | |
1161 | h->elf_link_hash_flags &= ~0x8000; | |
1162 | } | |
1163 | ||
b34976b6 | 1164 | return TRUE; |
af7dc644 JL |
1165 | } |
1166 | ||
b34976b6 | 1167 | static bfd_boolean |
c39a58e6 | 1168 | elf_hppa_is_dynamic_loader_symbol (const char *name) |
1bf42538 JL |
1169 | { |
1170 | return (! strcmp (name, "__CPU_REVISION") | |
1171 | || ! strcmp (name, "__CPU_KEYBITS_1") | |
1172 | || ! strcmp (name, "__SYSTEM_ID_D") | |
1173 | || ! strcmp (name, "__FPU_MODEL") | |
1174 | || ! strcmp (name, "__FPU_REVISION") | |
1175 | || ! strcmp (name, "__ARGC") | |
1176 | || ! strcmp (name, "__ARGV") | |
1177 | || ! strcmp (name, "__ENVP") | |
1178 | || ! strcmp (name, "__TLS_SIZE_D") | |
1179 | || ! strcmp (name, "__LOAD_INFO") | |
1180 | || ! strcmp (name, "__systab")); | |
1181 | } | |
1182 | ||
2ec0dd12 JL |
1183 | /* Record the lowest address for the data and text segments. */ |
1184 | static void | |
c39a58e6 AM |
1185 | elf_hppa_record_segment_addrs (bfd *abfd ATTRIBUTE_UNUSED, |
1186 | asection *section, | |
1187 | void *data) | |
2ec0dd12 JL |
1188 | { |
1189 | struct elf64_hppa_link_hash_table *hppa_info; | |
1190 | bfd_vma value; | |
a7c10850 | 1191 | |
c39a58e6 | 1192 | hppa_info = data; |
2ec0dd12 JL |
1193 | |
1194 | value = section->vma - section->filepos; | |
1195 | ||
edd21aca | 1196 | if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY)) |
2ec0dd12 JL |
1197 | == (SEC_ALLOC | SEC_LOAD | SEC_READONLY)) |
1198 | && value < hppa_info->text_segment_base) | |
1199 | hppa_info->text_segment_base = value; | |
edd21aca AM |
1200 | else if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY)) |
1201 | == (SEC_ALLOC | SEC_LOAD)) | |
1202 | && value < hppa_info->data_segment_base) | |
2ec0dd12 JL |
1203 | hppa_info->data_segment_base = value; |
1204 | } | |
1205 | ||
2eb429af JL |
1206 | /* Called after we have seen all the input files/sections, but before |
1207 | final symbol resolution and section placement has been determined. | |
1208 | ||
1209 | We use this hook to (possibly) provide a value for __gp, then we | |
1210 | fall back to the generic ELF final link routine. */ | |
1211 | ||
b34976b6 | 1212 | static bfd_boolean |
c39a58e6 | 1213 | elf_hppa_final_link (bfd *abfd, struct bfd_link_info *info) |
2eb429af | 1214 | { |
b34976b6 | 1215 | bfd_boolean retval; |
edd21aca | 1216 | struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info); |
af7dc644 | 1217 | |
1049f94e | 1218 | if (! info->relocatable) |
2eb429af | 1219 | { |
2eb429af | 1220 | struct elf_link_hash_entry *gp; |
19ef5465 | 1221 | bfd_vma gp_val; |
1209c612 JL |
1222 | |
1223 | /* The linker script defines a value for __gp iff it was referenced | |
1224 | by one of the objects being linked. First try to find the symbol | |
1225 | in the hash table. If that fails, just compute the value __gp | |
1226 | should have had. */ | |
b34976b6 AM |
1227 | gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", FALSE, |
1228 | FALSE, FALSE); | |
2eb429af | 1229 | |
1209c612 JL |
1230 | if (gp) |
1231 | { | |
1232 | ||
1233 | /* Adjust the value of __gp as we may want to slide it into the | |
1234 | .plt section so that the stubs can access PLT entries without | |
1235 | using an addil sequence. */ | |
edd21aca | 1236 | gp->root.u.def.value += hppa_info->gp_offset; |
1209c612 JL |
1237 | |
1238 | gp_val = (gp->root.u.def.section->output_section->vma | |
1239 | + gp->root.u.def.section->output_offset | |
1240 | + gp->root.u.def.value); | |
1241 | } | |
1242 | else | |
1243 | { | |
1244 | asection *sec; | |
1209c612 JL |
1245 | |
1246 | /* First look for a .plt section. If found, then __gp is the | |
1247 | address of the .plt + gp_offset. | |
1248 | ||
1249 | If no .plt is found, then look for .dlt, .opd and .data (in | |
d663e1cd JL |
1250 | that order) and set __gp to the base address of whichever |
1251 | section is found first. */ | |
1209c612 JL |
1252 | |
1253 | sec = hppa_info->plt_sec; | |
d663e1cd | 1254 | if (sec && ! (sec->flags & SEC_EXCLUDE)) |
1209c612 JL |
1255 | gp_val = (sec->output_offset |
1256 | + sec->output_section->vma | |
1257 | + hppa_info->gp_offset); | |
1258 | else | |
1259 | { | |
1260 | sec = hppa_info->dlt_sec; | |
d663e1cd | 1261 | if (!sec || (sec->flags & SEC_EXCLUDE)) |
1209c612 | 1262 | sec = hppa_info->opd_sec; |
d663e1cd | 1263 | if (!sec || (sec->flags & SEC_EXCLUDE)) |
1209c612 | 1264 | sec = bfd_get_section_by_name (abfd, ".data"); |
d663e1cd | 1265 | if (!sec || (sec->flags & SEC_EXCLUDE)) |
b34976b6 | 1266 | return FALSE; |
1209c612 JL |
1267 | |
1268 | gp_val = sec->output_offset + sec->output_section->vma; | |
1269 | } | |
1270 | } | |
2eb429af | 1271 | |
1209c612 | 1272 | /* Install whatever value we found/computed for __gp. */ |
2eb429af JL |
1273 | _bfd_set_gp_value (abfd, gp_val); |
1274 | } | |
1275 | ||
2ec0dd12 | 1276 | /* We need to know the base of the text and data segments so that we |
edd21aca | 1277 | can perform SEGREL relocations. We will record the base addresses |
2ec0dd12 | 1278 | when we encounter the first SEGREL relocation. */ |
edd21aca AM |
1279 | hppa_info->text_segment_base = (bfd_vma)-1; |
1280 | hppa_info->data_segment_base = (bfd_vma)-1; | |
2ec0dd12 | 1281 | |
af7dc644 | 1282 | /* HP's shared libraries have references to symbols that are not |
4cc11e76 | 1283 | defined anywhere. The generic ELF BFD linker code will complain |
af7dc644 JL |
1284 | about such symbols. |
1285 | ||
1286 | So we detect the losing case and arrange for the flags on the symbol | |
1287 | to indicate that it was never referenced. This keeps the generic | |
1288 | ELF BFD link code happy and appears to not create any secondary | |
1289 | problems. Ultimately we need a way to control the behavior of the | |
1290 | generic ELF BFD link code better. */ | |
1291 | elf_link_hash_traverse (elf_hash_table (info), | |
1292 | elf_hppa_unmark_useless_dynamic_symbols, | |
1293 | info); | |
1294 | ||
2eb429af | 1295 | /* Invoke the regular ELF backend linker to do all the work. */ |
c152c796 | 1296 | retval = bfd_elf_final_link (abfd, info); |
af7dc644 JL |
1297 | |
1298 | elf_link_hash_traverse (elf_hash_table (info), | |
1299 | elf_hppa_remark_useless_dynamic_symbols, | |
1300 | info); | |
1301 | ||
46fe4e66 AM |
1302 | /* If we're producing a final executable, sort the contents of the |
1303 | unwind section. */ | |
1304 | if (retval) | |
1305 | retval = elf_hppa_sort_unwind (abfd); | |
1306 | ||
af7dc644 | 1307 | return retval; |
2eb429af JL |
1308 | } |
1309 | ||
1310 | /* Relocate an HPPA ELF section. */ | |
1311 | ||
b34976b6 | 1312 | static bfd_boolean |
c39a58e6 AM |
1313 | elf_hppa_relocate_section (bfd *output_bfd, |
1314 | struct bfd_link_info *info, | |
1315 | bfd *input_bfd, | |
1316 | asection *input_section, | |
1317 | bfd_byte *contents, | |
1318 | Elf_Internal_Rela *relocs, | |
1319 | Elf_Internal_Sym *local_syms, | |
1320 | asection **local_sections) | |
2eb429af JL |
1321 | { |
1322 | Elf_Internal_Shdr *symtab_hdr; | |
1323 | Elf_Internal_Rela *rel; | |
1324 | Elf_Internal_Rela *relend; | |
f0fe0e16 AM |
1325 | struct elf64_hppa_link_hash_table *hppa_info; |
1326 | ||
1049f94e | 1327 | if (info->relocatable) |
b34976b6 | 1328 | return TRUE; |
2eb429af | 1329 | |
f0fe0e16 | 1330 | hppa_info = elf64_hppa_hash_table (info); |
2eb429af JL |
1331 | symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; |
1332 | ||
1333 | rel = relocs; | |
1334 | relend = relocs + input_section->reloc_count; | |
1335 | for (; rel < relend; rel++) | |
1336 | { | |
1337 | int r_type; | |
b2e311df | 1338 | reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info); |
2eb429af JL |
1339 | unsigned long r_symndx; |
1340 | struct elf_link_hash_entry *h; | |
1341 | Elf_Internal_Sym *sym; | |
1342 | asection *sym_sec; | |
1343 | bfd_vma relocation; | |
1344 | bfd_reloc_status_type r; | |
1345 | const char *sym_name; | |
edd21aca | 1346 | const char *dyn_name; |
be7582f3 JL |
1347 | char *dynh_buf = NULL; |
1348 | size_t dynh_buflen = 0; | |
1349 | struct elf64_hppa_dyn_hash_entry *dyn_h = NULL; | |
2eb429af JL |
1350 | |
1351 | r_type = ELF_R_TYPE (rel->r_info); | |
1352 | if (r_type < 0 || r_type >= (int) R_PARISC_UNIMPLEMENTED) | |
1353 | { | |
1354 | bfd_set_error (bfd_error_bad_value); | |
b34976b6 | 1355 | return FALSE; |
2eb429af | 1356 | } |
2eb429af | 1357 | |
2eb429af | 1358 | /* This is a final link. */ |
f0fe0e16 | 1359 | r_symndx = ELF_R_SYM (rel->r_info); |
2eb429af JL |
1360 | h = NULL; |
1361 | sym = NULL; | |
1362 | sym_sec = NULL; | |
1363 | if (r_symndx < symtab_hdr->sh_info) | |
1364 | { | |
be7582f3 | 1365 | /* This is a local symbol. */ |
2eb429af JL |
1366 | sym = local_syms + r_symndx; |
1367 | sym_sec = local_sections[r_symndx]; | |
8517fae7 | 1368 | relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel); |
be7582f3 JL |
1369 | |
1370 | /* If this symbol has an entry in the PA64 dynamic hash | |
1371 | table, then get it. */ | |
d63b5ed9 | 1372 | dyn_name = get_dyn_name (input_bfd, h, rel, |
be7582f3 JL |
1373 | &dynh_buf, &dynh_buflen); |
1374 | dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, | |
b34976b6 | 1375 | dyn_name, FALSE, FALSE); |
be7582f3 | 1376 | |
2eb429af JL |
1377 | } |
1378 | else | |
1379 | { | |
be7582f3 | 1380 | /* This is not a local symbol. */ |
2eb429af JL |
1381 | long indx; |
1382 | ||
1383 | indx = r_symndx - symtab_hdr->sh_info; | |
1384 | h = elf_sym_hashes (input_bfd)[indx]; | |
1385 | while (h->root.type == bfd_link_hash_indirect | |
1386 | || h->root.type == bfd_link_hash_warning) | |
1387 | h = (struct elf_link_hash_entry *) h->root.u.i.link; | |
1388 | if (h->root.type == bfd_link_hash_defined | |
1389 | || h->root.type == bfd_link_hash_defweak) | |
1390 | { | |
1391 | sym_sec = h->root.u.def.section; | |
be7582f3 | 1392 | |
be7582f3 JL |
1393 | /* If this symbol has an entry in the PA64 dynamic hash |
1394 | table, then get it. */ | |
d63b5ed9 | 1395 | dyn_name = get_dyn_name (input_bfd, h, rel, |
be7582f3 JL |
1396 | &dynh_buf, &dynh_buflen); |
1397 | dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, | |
b34976b6 | 1398 | dyn_name, FALSE, FALSE); |
be7582f3 JL |
1399 | |
1400 | /* If we have a relocation against a symbol defined in a | |
1401 | shared library and we have not created an entry in the | |
1402 | PA64 dynamic symbol hash table for it, then we lose. */ | |
1403 | if (sym_sec->output_section == NULL && dyn_h == NULL) | |
1404 | { | |
1405 | (*_bfd_error_handler) | |
1406 | (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), | |
8f615d07 | 1407 | bfd_archive_filename (input_bfd), h->root.root.string, |
be7582f3 JL |
1408 | bfd_get_section_name (input_bfd, input_section)); |
1409 | relocation = 0; | |
1410 | } | |
1411 | else if (sym_sec->output_section) | |
1412 | relocation = (h->root.u.def.value | |
1413 | + sym_sec->output_offset | |
1414 | + sym_sec->output_section->vma); | |
1415 | /* Value will be provided via one of the offsets in the | |
1416 | dyn_h hash table entry. */ | |
1417 | else | |
1418 | relocation = 0; | |
2eb429af | 1419 | } |
59c2e50f | 1420 | else if (info->unresolved_syms_in_objects == RM_IGNORE |
3a27a730 | 1421 | && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) |
dfec422f JL |
1422 | { |
1423 | /* If this symbol has an entry in the PA64 dynamic hash | |
1424 | table, then get it. */ | |
d63b5ed9 | 1425 | dyn_name = get_dyn_name (input_bfd, h, rel, |
dfec422f JL |
1426 | &dynh_buf, &dynh_buflen); |
1427 | dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, | |
b34976b6 | 1428 | dyn_name, FALSE, FALSE); |
dfec422f JL |
1429 | |
1430 | if (dyn_h == NULL) | |
1431 | { | |
1432 | (*_bfd_error_handler) | |
1433 | (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), | |
8f615d07 | 1434 | bfd_archive_filename (input_bfd), h->root.root.string, |
dfec422f | 1435 | bfd_get_section_name (input_bfd, input_section)); |
dfec422f JL |
1436 | } |
1437 | relocation = 0; | |
1438 | } | |
2eb429af | 1439 | else if (h->root.type == bfd_link_hash_undefweak) |
37f4508b | 1440 | { |
d63b5ed9 | 1441 | dyn_name = get_dyn_name (input_bfd, h, rel, |
37f4508b AM |
1442 | &dynh_buf, &dynh_buflen); |
1443 | dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, | |
1444 | dyn_name, FALSE, FALSE); | |
1445 | ||
1446 | if (dyn_h == NULL) | |
1447 | { | |
1448 | (*_bfd_error_handler) | |
1449 | (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), | |
1450 | bfd_archive_filename (input_bfd), h->root.root.string, | |
1451 | bfd_get_section_name (input_bfd, input_section)); | |
1452 | } | |
1453 | relocation = 0; | |
1454 | } | |
2eb429af JL |
1455 | else |
1456 | { | |
1bf42538 JL |
1457 | /* Ignore dynamic loader defined symbols. */ |
1458 | if (elf_hppa_is_dynamic_loader_symbol (h->root.root.string)) | |
1459 | relocation = 0; | |
1460 | else | |
1461 | { | |
1462 | if (!((*info->callbacks->undefined_symbol) | |
1463 | (info, h->root.root.string, input_bfd, | |
59c2e50f L |
1464 | input_section, rel->r_offset, |
1465 | (info->unresolved_syms_in_objects == RM_GENERATE_ERROR | |
1466 | || ELF_ST_VISIBILITY (h->other))))) | |
b34976b6 | 1467 | return FALSE; |
1bf42538 JL |
1468 | break; |
1469 | } | |
2eb429af JL |
1470 | } |
1471 | } | |
1472 | ||
1473 | if (h != NULL) | |
1474 | sym_name = h->root.root.string; | |
1475 | else | |
1476 | { | |
1477 | sym_name = bfd_elf_string_from_elf_section (input_bfd, | |
1478 | symtab_hdr->sh_link, | |
1479 | sym->st_name); | |
1480 | if (sym_name == NULL) | |
b34976b6 | 1481 | return FALSE; |
2eb429af JL |
1482 | if (*sym_name == '\0') |
1483 | sym_name = bfd_section_name (input_bfd, sym_sec); | |
1484 | } | |
1485 | ||
be7582f3 | 1486 | r = elf_hppa_final_link_relocate (rel, input_bfd, output_bfd, |
2eb429af | 1487 | input_section, contents, |
be7582f3 JL |
1488 | relocation, info, sym_sec, |
1489 | h, dyn_h); | |
2eb429af JL |
1490 | |
1491 | if (r != bfd_reloc_ok) | |
1492 | { | |
1493 | switch (r) | |
1494 | { | |
1495 | default: | |
1496 | abort (); | |
1497 | case bfd_reloc_overflow: | |
1498 | { | |
1499 | if (!((*info->callbacks->reloc_overflow) | |
1500 | (info, sym_name, howto->name, (bfd_vma) 0, | |
1501 | input_bfd, input_section, rel->r_offset))) | |
b34976b6 | 1502 | return FALSE; |
2eb429af JL |
1503 | } |
1504 | break; | |
1505 | } | |
1506 | } | |
1507 | } | |
b34976b6 | 1508 | return TRUE; |
2eb429af JL |
1509 | } |
1510 | ||
be7582f3 | 1511 | /* Compute the value for a relocation (REL) during a final link stage, |
a7c10850 | 1512 | then insert the value into the proper location in CONTENTS. |
be7582f3 JL |
1513 | |
1514 | VALUE is a tentative value for the relocation and may be overridden | |
1515 | and modified here based on the specific relocation to be performed. | |
1516 | ||
1517 | For example we do conversions for PC-relative branches in this routine | |
a7c10850 | 1518 | or redirection of calls to external routines to stubs. |
be7582f3 JL |
1519 | |
1520 | The work of actually applying the relocation is left to a helper | |
1521 | routine in an attempt to reduce the complexity and size of this | |
1522 | function. */ | |
2eb429af JL |
1523 | |
1524 | static bfd_reloc_status_type | |
c39a58e6 AM |
1525 | elf_hppa_final_link_relocate (Elf_Internal_Rela *rel, |
1526 | bfd *input_bfd, | |
1527 | bfd *output_bfd, | |
1528 | asection *input_section, | |
1529 | bfd_byte *contents, | |
1530 | bfd_vma value, | |
1531 | struct bfd_link_info *info, | |
1532 | asection *sym_sec, | |
1533 | struct elf_link_hash_entry *h ATTRIBUTE_UNUSED, | |
1534 | struct elf64_hppa_dyn_hash_entry *dyn_h) | |
2eb429af | 1535 | { |
dc810e39 | 1536 | int insn; |
be7582f3 | 1537 | bfd_vma offset = rel->r_offset; |
dc810e39 | 1538 | bfd_signed_vma addend = rel->r_addend; |
be7582f3 | 1539 | reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info); |
3f9b03b5 | 1540 | unsigned int r_type = howto->type; |
2eb429af | 1541 | bfd_byte *hit_data = contents + offset; |
be7582f3 | 1542 | struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info); |
2eb429af JL |
1543 | |
1544 | insn = bfd_get_32 (input_bfd, hit_data); | |
1545 | ||
2eb429af JL |
1546 | switch (r_type) |
1547 | { | |
1548 | case R_PARISC_NONE: | |
1549 | break; | |
1550 | ||
ba94744e | 1551 | /* Basic function call support. |
3f9b03b5 AM |
1552 | |
1553 | Note for a call to a function defined in another dynamic library | |
1554 | we want to redirect the call to a stub. */ | |
1555 | ||
571047ad | 1556 | /* Random PC relative relocs. */ |
b233eaab JL |
1557 | case R_PARISC_PCREL21L: |
1558 | case R_PARISC_PCREL14R: | |
1559 | case R_PARISC_PCREL14F: | |
571047ad JL |
1560 | case R_PARISC_PCREL14WR: |
1561 | case R_PARISC_PCREL14DR: | |
1562 | case R_PARISC_PCREL16F: | |
1563 | case R_PARISC_PCREL16WF: | |
1564 | case R_PARISC_PCREL16DF: | |
1565 | { | |
571047ad JL |
1566 | /* If this is a call to a function defined in another dynamic |
1567 | library, then redirect the call to the local stub for this | |
1568 | function. */ | |
dfec422f JL |
1569 | if (sym_sec == NULL || sym_sec->output_section == NULL) |
1570 | value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset | |
1571 | + hppa_info->stub_sec->output_section->vma); | |
a7c10850 | 1572 | |
571047ad JL |
1573 | /* Turn VALUE into a proper PC relative address. */ |
1574 | value -= (offset + input_section->output_offset | |
1575 | + input_section->output_section->vma); | |
1576 | ||
1577 | /* Adjust for any field selectors. */ | |
3f9b03b5 AM |
1578 | if (r_type == R_PARISC_PCREL21L) |
1579 | value = hppa_field_adjust (value, -8 + addend, e_lsel); | |
1580 | else if (r_type == R_PARISC_PCREL14F | |
1581 | || r_type == R_PARISC_PCREL16F | |
1582 | || r_type == R_PARISC_PCREL16WF | |
1583 | || r_type == R_PARISC_PCREL16DF) | |
1584 | value = hppa_field_adjust (value, -8 + addend, e_fsel); | |
1585 | else | |
1586 | value = hppa_field_adjust (value, -8 + addend, e_rsel); | |
571047ad JL |
1587 | |
1588 | /* Apply the relocation to the given instruction. */ | |
dc810e39 | 1589 | insn = elf_hppa_relocate_insn (insn, (int) value, r_type); |
571047ad JL |
1590 | break; |
1591 | } | |
1592 | ||
49bd834c | 1593 | case R_PARISC_PCREL12F: |
2eb429af JL |
1594 | case R_PARISC_PCREL22F: |
1595 | case R_PARISC_PCREL17F: | |
571047ad JL |
1596 | case R_PARISC_PCREL22C: |
1597 | case R_PARISC_PCREL17C: | |
1598 | case R_PARISC_PCREL17R: | |
2eb429af | 1599 | { |
be7582f3 JL |
1600 | /* If this is a call to a function defined in another dynamic |
1601 | library, then redirect the call to the local stub for this | |
1602 | function. */ | |
dfec422f | 1603 | if (sym_sec == NULL || sym_sec->output_section == NULL) |
6a0b9871 JL |
1604 | value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset |
1605 | + hppa_info->stub_sec->output_section->vma); | |
a7c10850 | 1606 | |
be7582f3 JL |
1607 | /* Turn VALUE into a proper PC relative address. */ |
1608 | value -= (offset + input_section->output_offset | |
1609 | + input_section->output_section->vma); | |
1610 | ||
1611 | /* Adjust for any field selectors. */ | |
70d72e0e AM |
1612 | if (r_type == R_PARISC_PCREL17R) |
1613 | value = hppa_field_adjust (value, -8 + addend, e_rsel); | |
1614 | else | |
1615 | value = hppa_field_adjust (value, -8 + addend, e_fsel); | |
2eb429af | 1616 | |
be7582f3 JL |
1617 | /* All branches are implicitly shifted by 2 places. */ |
1618 | value >>= 2; | |
2eb429af | 1619 | |
be7582f3 | 1620 | /* Apply the relocation to the given instruction. */ |
dc810e39 | 1621 | insn = elf_hppa_relocate_insn (insn, (int) value, r_type); |
2eb429af JL |
1622 | break; |
1623 | } | |
1624 | ||
be7582f3 JL |
1625 | /* Indirect references to data through the DLT. */ |
1626 | case R_PARISC_DLTIND14R: | |
571047ad | 1627 | case R_PARISC_DLTIND14F: |
be7582f3 JL |
1628 | case R_PARISC_DLTIND14DR: |
1629 | case R_PARISC_DLTIND14WR: | |
1630 | case R_PARISC_DLTIND21L: | |
e5bb3efc JL |
1631 | case R_PARISC_LTOFF_FPTR14R: |
1632 | case R_PARISC_LTOFF_FPTR14DR: | |
1633 | case R_PARISC_LTOFF_FPTR14WR: | |
1634 | case R_PARISC_LTOFF_FPTR21L: | |
1635 | case R_PARISC_LTOFF_FPTR16F: | |
1636 | case R_PARISC_LTOFF_FPTR16WF: | |
1637 | case R_PARISC_LTOFF_FPTR16DF: | |
b233eaab JL |
1638 | case R_PARISC_LTOFF_TP21L: |
1639 | case R_PARISC_LTOFF_TP14R: | |
1640 | case R_PARISC_LTOFF_TP14F: | |
1641 | case R_PARISC_LTOFF_TP14WR: | |
1642 | case R_PARISC_LTOFF_TP14DR: | |
1643 | case R_PARISC_LTOFF_TP16F: | |
1644 | case R_PARISC_LTOFF_TP16WF: | |
1645 | case R_PARISC_LTOFF_TP16DF: | |
b7263961 JL |
1646 | case R_PARISC_LTOFF16F: |
1647 | case R_PARISC_LTOFF16WF: | |
1648 | case R_PARISC_LTOFF16DF: | |
c8933571 | 1649 | { |
6a0b9871 | 1650 | /* If this relocation was against a local symbol, then we still |
edd21aca | 1651 | have not set up the DLT entry (it's not convenient to do so |
6a0b9871 JL |
1652 | in the "finalize_dlt" routine because it is difficult to get |
1653 | to the local symbol's value). | |
1654 | ||
1655 | So, if this is a local symbol (h == NULL), then we need to | |
a7c10850 | 1656 | fill in its DLT entry. |
e48c661e JL |
1657 | |
1658 | Similarly we may still need to set up an entry in .opd for | |
1659 | a local function which had its address taken. */ | |
6a0b9871 JL |
1660 | if (dyn_h->h == NULL) |
1661 | { | |
1bf42538 | 1662 | /* Now do .opd creation if needed. */ |
e48c661e JL |
1663 | if (r_type == R_PARISC_LTOFF_FPTR14R |
1664 | || r_type == R_PARISC_LTOFF_FPTR14DR | |
1665 | || r_type == R_PARISC_LTOFF_FPTR14WR | |
1666 | || r_type == R_PARISC_LTOFF_FPTR21L | |
1667 | || r_type == R_PARISC_LTOFF_FPTR16F | |
1668 | || r_type == R_PARISC_LTOFF_FPTR16WF | |
1669 | || r_type == R_PARISC_LTOFF_FPTR16DF) | |
1670 | { | |
1671 | /* The first two words of an .opd entry are zero. */ | |
1672 | memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, | |
1673 | 0, 16); | |
1674 | ||
1675 | /* The next word is the address of the function. */ | |
1bf42538 | 1676 | bfd_put_64 (hppa_info->opd_sec->owner, value + addend, |
e48c661e JL |
1677 | (hppa_info->opd_sec->contents |
1678 | + dyn_h->opd_offset + 16)); | |
1679 | ||
1680 | /* The last word is our local __gp value. */ | |
1681 | value = _bfd_get_gp_value | |
1682 | (hppa_info->opd_sec->output_section->owner); | |
1683 | bfd_put_64 (hppa_info->opd_sec->owner, value, | |
1684 | (hppa_info->opd_sec->contents | |
1685 | + dyn_h->opd_offset + 24)); | |
1bf42538 JL |
1686 | |
1687 | /* The DLT value is the address of the .opd entry. */ | |
1688 | value = (dyn_h->opd_offset | |
1689 | + hppa_info->opd_sec->output_offset | |
1690 | + hppa_info->opd_sec->output_section->vma); | |
1691 | addend = 0; | |
e48c661e | 1692 | } |
1bf42538 JL |
1693 | |
1694 | bfd_put_64 (hppa_info->dlt_sec->owner, | |
1695 | value + addend, | |
1696 | hppa_info->dlt_sec->contents + dyn_h->dlt_offset); | |
6a0b9871 JL |
1697 | } |
1698 | ||
be7582f3 | 1699 | /* We want the value of the DLT offset for this symbol, not |
19ef5465 JL |
1700 | the symbol's actual address. Note that __gp may not point |
1701 | to the start of the DLT, so we have to compute the absolute | |
1702 | address, then subtract out the value of __gp. */ | |
1703 | value = (dyn_h->dlt_offset | |
1704 | + hppa_info->dlt_sec->output_offset | |
1705 | + hppa_info->dlt_sec->output_section->vma); | |
1706 | value -= _bfd_get_gp_value (output_bfd); | |
1707 | ||
be7582f3 JL |
1708 | /* All DLTIND relocations are basically the same at this point, |
1709 | except that we need different field selectors for the 21bit | |
1710 | version vs the 14bit versions. */ | |
e5bb3efc | 1711 | if (r_type == R_PARISC_DLTIND21L |
b233eaab JL |
1712 | || r_type == R_PARISC_LTOFF_FPTR21L |
1713 | || r_type == R_PARISC_LTOFF_TP21L) | |
1bf42538 | 1714 | value = hppa_field_adjust (value, 0, e_lsel); |
571047ad JL |
1715 | else if (r_type == R_PARISC_DLTIND14F |
1716 | || r_type == R_PARISC_LTOFF_FPTR16F | |
1717 | || r_type == R_PARISC_LTOFF_FPTR16WF | |
b233eaab | 1718 | || r_type == R_PARISC_LTOFF_FPTR16DF |
b7263961 JL |
1719 | || r_type == R_PARISC_LTOFF16F |
1720 | || r_type == R_PARISC_LTOFF16DF | |
1721 | || r_type == R_PARISC_LTOFF16WF | |
b233eaab JL |
1722 | || r_type == R_PARISC_LTOFF_TP16F |
1723 | || r_type == R_PARISC_LTOFF_TP16WF | |
1724 | || r_type == R_PARISC_LTOFF_TP16DF) | |
1bf42538 | 1725 | value = hppa_field_adjust (value, 0, e_fsel); |
be7582f3 | 1726 | else |
1bf42538 | 1727 | value = hppa_field_adjust (value, 0, e_rsel); |
be7582f3 | 1728 | |
dc810e39 | 1729 | insn = elf_hppa_relocate_insn (insn, (int) value, r_type); |
c8933571 JL |
1730 | break; |
1731 | } | |
1732 | ||
be7582f3 | 1733 | case R_PARISC_DLTREL14R: |
571047ad | 1734 | case R_PARISC_DLTREL14F: |
be7582f3 JL |
1735 | case R_PARISC_DLTREL14DR: |
1736 | case R_PARISC_DLTREL14WR: | |
c8933571 | 1737 | case R_PARISC_DLTREL21L: |
6849fb4d JL |
1738 | case R_PARISC_DPREL21L: |
1739 | case R_PARISC_DPREL14WR: | |
1740 | case R_PARISC_DPREL14DR: | |
1741 | case R_PARISC_DPREL14R: | |
1742 | case R_PARISC_DPREL14F: | |
1743 | case R_PARISC_GPREL16F: | |
1744 | case R_PARISC_GPREL16WF: | |
1745 | case R_PARISC_GPREL16DF: | |
c8933571 | 1746 | { |
be7582f3 JL |
1747 | /* Subtract out the global pointer value to make value a DLT |
1748 | relative address. */ | |
1749 | value -= _bfd_get_gp_value (output_bfd); | |
1750 | ||
1751 | /* All DLTREL relocations are basically the same at this point, | |
1752 | except that we need different field selectors for the 21bit | |
1753 | version vs the 14bit versions. */ | |
6849fb4d JL |
1754 | if (r_type == R_PARISC_DLTREL21L |
1755 | || r_type == R_PARISC_DPREL21L) | |
be7582f3 | 1756 | value = hppa_field_adjust (value, addend, e_lrsel); |
6849fb4d JL |
1757 | else if (r_type == R_PARISC_DLTREL14F |
1758 | || r_type == R_PARISC_DPREL14F | |
1759 | || r_type == R_PARISC_GPREL16F | |
1760 | || r_type == R_PARISC_GPREL16WF | |
1761 | || r_type == R_PARISC_GPREL16DF) | |
571047ad | 1762 | value = hppa_field_adjust (value, addend, e_fsel); |
be7582f3 JL |
1763 | else |
1764 | value = hppa_field_adjust (value, addend, e_rrsel); | |
1765 | ||
dc810e39 | 1766 | insn = elf_hppa_relocate_insn (insn, (int) value, r_type); |
c8933571 JL |
1767 | break; |
1768 | } | |
1769 | ||
b7263961 JL |
1770 | case R_PARISC_DIR21L: |
1771 | case R_PARISC_DIR17R: | |
1772 | case R_PARISC_DIR17F: | |
1773 | case R_PARISC_DIR14R: | |
47d89dba | 1774 | case R_PARISC_DIR14F: |
b7263961 JL |
1775 | case R_PARISC_DIR14WR: |
1776 | case R_PARISC_DIR14DR: | |
1777 | case R_PARISC_DIR16F: | |
1778 | case R_PARISC_DIR16WF: | |
1779 | case R_PARISC_DIR16DF: | |
1780 | { | |
1781 | /* All DIR relocations are basically the same at this point, | |
70d72e0e AM |
1782 | except that branch offsets need to be divided by four, and |
1783 | we need different field selectors. Note that we don't | |
1784 | redirect absolute calls to local stubs. */ | |
3f9b03b5 | 1785 | |
b7263961 JL |
1786 | if (r_type == R_PARISC_DIR21L) |
1787 | value = hppa_field_adjust (value, addend, e_lrsel); | |
1788 | else if (r_type == R_PARISC_DIR17F | |
1789 | || r_type == R_PARISC_DIR16F | |
1790 | || r_type == R_PARISC_DIR16WF | |
47d89dba AM |
1791 | || r_type == R_PARISC_DIR16DF |
1792 | || r_type == R_PARISC_DIR14F) | |
b7263961 JL |
1793 | value = hppa_field_adjust (value, addend, e_fsel); |
1794 | else | |
1795 | value = hppa_field_adjust (value, addend, e_rrsel); | |
1796 | ||
70d72e0e AM |
1797 | if (r_type == R_PARISC_DIR17R || r_type == R_PARISC_DIR17F) |
1798 | { | |
1799 | /* All branches are implicitly shifted by 2 places. */ | |
1800 | value >>= 2; | |
1801 | } | |
1802 | ||
dc810e39 | 1803 | insn = elf_hppa_relocate_insn (insn, (int) value, r_type); |
b7263961 JL |
1804 | break; |
1805 | } | |
1806 | ||
8267b155 JL |
1807 | case R_PARISC_PLTOFF21L: |
1808 | case R_PARISC_PLTOFF14R: | |
1809 | case R_PARISC_PLTOFF14F: | |
1810 | case R_PARISC_PLTOFF14WR: | |
1811 | case R_PARISC_PLTOFF14DR: | |
1812 | case R_PARISC_PLTOFF16F: | |
1813 | case R_PARISC_PLTOFF16WF: | |
1814 | case R_PARISC_PLTOFF16DF: | |
1815 | { | |
1816 | /* We want the value of the PLT offset for this symbol, not | |
19ef5465 JL |
1817 | the symbol's actual address. Note that __gp may not point |
1818 | to the start of the DLT, so we have to compute the absolute | |
1819 | address, then subtract out the value of __gp. */ | |
1820 | value = (dyn_h->plt_offset | |
1821 | + hppa_info->plt_sec->output_offset | |
1822 | + hppa_info->plt_sec->output_section->vma); | |
1823 | value -= _bfd_get_gp_value (output_bfd); | |
8267b155 JL |
1824 | |
1825 | /* All PLTOFF relocations are basically the same at this point, | |
1826 | except that we need different field selectors for the 21bit | |
1827 | version vs the 14bit versions. */ | |
1828 | if (r_type == R_PARISC_PLTOFF21L) | |
1829 | value = hppa_field_adjust (value, addend, e_lrsel); | |
1830 | else if (r_type == R_PARISC_PLTOFF14F | |
1831 | || r_type == R_PARISC_PLTOFF16F | |
1832 | || r_type == R_PARISC_PLTOFF16WF | |
1833 | || r_type == R_PARISC_PLTOFF16DF) | |
1834 | value = hppa_field_adjust (value, addend, e_fsel); | |
1835 | else | |
1836 | value = hppa_field_adjust (value, addend, e_rrsel); | |
1837 | ||
dc810e39 | 1838 | insn = elf_hppa_relocate_insn (insn, (int) value, r_type); |
8267b155 JL |
1839 | break; |
1840 | } | |
1841 | ||
e5bb3efc JL |
1842 | case R_PARISC_LTOFF_FPTR32: |
1843 | { | |
e48c661e JL |
1844 | /* We may still need to create the FPTR itself if it was for |
1845 | a local symbol. */ | |
1846 | if (dyn_h->h == NULL) | |
1847 | { | |
1848 | /* The first two words of an .opd entry are zero. */ | |
1849 | memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16); | |
1850 | ||
1851 | /* The next word is the address of the function. */ | |
1bf42538 | 1852 | bfd_put_64 (hppa_info->opd_sec->owner, value + addend, |
e48c661e JL |
1853 | (hppa_info->opd_sec->contents |
1854 | + dyn_h->opd_offset + 16)); | |
1855 | ||
1856 | /* The last word is our local __gp value. */ | |
1857 | value = _bfd_get_gp_value | |
1858 | (hppa_info->opd_sec->output_section->owner); | |
1859 | bfd_put_64 (hppa_info->opd_sec->owner, value, | |
1860 | hppa_info->opd_sec->contents + dyn_h->opd_offset + 24); | |
1bf42538 JL |
1861 | |
1862 | /* The DLT value is the address of the .opd entry. */ | |
1863 | value = (dyn_h->opd_offset | |
1864 | + hppa_info->opd_sec->output_offset | |
1865 | + hppa_info->opd_sec->output_section->vma); | |
1866 | ||
1867 | bfd_put_64 (hppa_info->dlt_sec->owner, | |
1868 | value, | |
1869 | hppa_info->dlt_sec->contents + dyn_h->dlt_offset); | |
e48c661e JL |
1870 | } |
1871 | ||
e5bb3efc | 1872 | /* We want the value of the DLT offset for this symbol, not |
19ef5465 JL |
1873 | the symbol's actual address. Note that __gp may not point |
1874 | to the start of the DLT, so we have to compute the absolute | |
1875 | address, then subtract out the value of __gp. */ | |
1876 | value = (dyn_h->dlt_offset | |
1877 | + hppa_info->dlt_sec->output_offset | |
1878 | + hppa_info->dlt_sec->output_section->vma); | |
1879 | value -= _bfd_get_gp_value (output_bfd); | |
e5bb3efc JL |
1880 | bfd_put_32 (input_bfd, value, hit_data); |
1881 | return bfd_reloc_ok; | |
1882 | } | |
1883 | ||
e5bb3efc | 1884 | case R_PARISC_LTOFF_FPTR64: |
b233eaab | 1885 | case R_PARISC_LTOFF_TP64: |
e5bb3efc | 1886 | { |
e48c661e JL |
1887 | /* We may still need to create the FPTR itself if it was for |
1888 | a local symbol. */ | |
1889 | if (dyn_h->h == NULL && r_type == R_PARISC_LTOFF_FPTR64) | |
1890 | { | |
1891 | /* The first two words of an .opd entry are zero. */ | |
1892 | memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16); | |
1893 | ||
1894 | /* The next word is the address of the function. */ | |
1bf42538 | 1895 | bfd_put_64 (hppa_info->opd_sec->owner, value + addend, |
e48c661e JL |
1896 | (hppa_info->opd_sec->contents |
1897 | + dyn_h->opd_offset + 16)); | |
1898 | ||
1899 | /* The last word is our local __gp value. */ | |
1900 | value = _bfd_get_gp_value | |
1901 | (hppa_info->opd_sec->output_section->owner); | |
1902 | bfd_put_64 (hppa_info->opd_sec->owner, value, | |
1903 | hppa_info->opd_sec->contents + dyn_h->opd_offset + 24); | |
1bf42538 JL |
1904 | |
1905 | /* The DLT value is the address of the .opd entry. */ | |
1906 | value = (dyn_h->opd_offset | |
1907 | + hppa_info->opd_sec->output_offset | |
1908 | + hppa_info->opd_sec->output_section->vma); | |
1909 | ||
1910 | bfd_put_64 (hppa_info->dlt_sec->owner, | |
1911 | value, | |
1912 | hppa_info->dlt_sec->contents + dyn_h->dlt_offset); | |
e48c661e JL |
1913 | } |
1914 | ||
e5bb3efc | 1915 | /* We want the value of the DLT offset for this symbol, not |
19ef5465 JL |
1916 | the symbol's actual address. Note that __gp may not point |
1917 | to the start of the DLT, so we have to compute the absolute | |
1918 | address, then subtract out the value of __gp. */ | |
1919 | value = (dyn_h->dlt_offset | |
1920 | + hppa_info->dlt_sec->output_offset | |
1921 | + hppa_info->dlt_sec->output_section->vma); | |
1922 | value -= _bfd_get_gp_value (output_bfd); | |
e5bb3efc JL |
1923 | bfd_put_64 (input_bfd, value, hit_data); |
1924 | return bfd_reloc_ok; | |
1925 | } | |
1926 | ||
1927 | case R_PARISC_DIR32: | |
571047ad | 1928 | bfd_put_32 (input_bfd, value + addend, hit_data); |
e5bb3efc JL |
1929 | return bfd_reloc_ok; |
1930 | ||
1931 | case R_PARISC_DIR64: | |
571047ad | 1932 | bfd_put_64 (input_bfd, value + addend, hit_data); |
e5bb3efc JL |
1933 | return bfd_reloc_ok; |
1934 | ||
6849fb4d JL |
1935 | case R_PARISC_GPREL64: |
1936 | /* Subtract out the global pointer value to make value a DLT | |
1937 | relative address. */ | |
1938 | value -= _bfd_get_gp_value (output_bfd); | |
6849fb4d JL |
1939 | |
1940 | bfd_put_64 (input_bfd, value + addend, hit_data); | |
1941 | return bfd_reloc_ok; | |
1942 | ||
b7263961 | 1943 | case R_PARISC_LTOFF64: |
19ef5465 JL |
1944 | /* We want the value of the DLT offset for this symbol, not |
1945 | the symbol's actual address. Note that __gp may not point | |
1946 | to the start of the DLT, so we have to compute the absolute | |
1947 | address, then subtract out the value of __gp. */ | |
1948 | value = (dyn_h->dlt_offset | |
1949 | + hppa_info->dlt_sec->output_offset | |
1950 | + hppa_info->dlt_sec->output_section->vma); | |
1951 | value -= _bfd_get_gp_value (output_bfd); | |
b7263961 JL |
1952 | |
1953 | bfd_put_64 (input_bfd, value + addend, hit_data); | |
1954 | return bfd_reloc_ok; | |
1955 | ||
571047ad JL |
1956 | case R_PARISC_PCREL32: |
1957 | { | |
1958 | /* If this is a call to a function defined in another dynamic | |
1959 | library, then redirect the call to the local stub for this | |
1960 | function. */ | |
dfec422f JL |
1961 | if (sym_sec == NULL || sym_sec->output_section == NULL) |
1962 | value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset | |
1963 | + hppa_info->stub_sec->output_section->vma); | |
a7c10850 | 1964 | |
571047ad JL |
1965 | /* Turn VALUE into a proper PC relative address. */ |
1966 | value -= (offset + input_section->output_offset | |
1967 | + input_section->output_section->vma); | |
1968 | ||
b233eaab | 1969 | value += addend; |
571047ad | 1970 | value -= 8; |
edd21aca | 1971 | bfd_put_32 (input_bfd, value, hit_data); |
571047ad JL |
1972 | return bfd_reloc_ok; |
1973 | } | |
1974 | ||
1975 | case R_PARISC_PCREL64: | |
1976 | { | |
1977 | /* If this is a call to a function defined in another dynamic | |
1978 | library, then redirect the call to the local stub for this | |
1979 | function. */ | |
dfec422f JL |
1980 | if (sym_sec == NULL || sym_sec->output_section == NULL) |
1981 | value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset | |
1982 | + hppa_info->stub_sec->output_section->vma); | |
a7c10850 | 1983 | |
571047ad JL |
1984 | /* Turn VALUE into a proper PC relative address. */ |
1985 | value -= (offset + input_section->output_offset | |
1986 | + input_section->output_section->vma); | |
1987 | ||
b233eaab | 1988 | value += addend; |
571047ad JL |
1989 | value -= 8; |
1990 | bfd_put_64 (input_bfd, value, hit_data); | |
1991 | return bfd_reloc_ok; | |
1992 | } | |
1993 | ||
e5bb3efc | 1994 | case R_PARISC_FPTR64: |
e48c661e JL |
1995 | { |
1996 | /* We may still need to create the FPTR itself if it was for | |
1997 | a local symbol. */ | |
1998 | if (dyn_h->h == NULL) | |
1999 | { | |
2000 | /* The first two words of an .opd entry are zero. */ | |
2001 | memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16); | |
2002 | ||
2003 | /* The next word is the address of the function. */ | |
1bf42538 | 2004 | bfd_put_64 (hppa_info->opd_sec->owner, value + addend, |
e48c661e JL |
2005 | (hppa_info->opd_sec->contents |
2006 | + dyn_h->opd_offset + 16)); | |
2007 | ||
2008 | /* The last word is our local __gp value. */ | |
2009 | value = _bfd_get_gp_value | |
2010 | (hppa_info->opd_sec->output_section->owner); | |
2011 | bfd_put_64 (hppa_info->opd_sec->owner, value, | |
2012 | hppa_info->opd_sec->contents + dyn_h->opd_offset + 24); | |
2013 | } | |
2014 | ||
d663e1cd JL |
2015 | if (dyn_h->want_opd) |
2016 | /* We want the value of the OPD offset for this symbol. */ | |
2017 | value = (dyn_h->opd_offset | |
2018 | + hppa_info->opd_sec->output_offset | |
2019 | + hppa_info->opd_sec->output_section->vma); | |
2020 | else | |
2021 | /* We want the address of the symbol. */ | |
2022 | value += addend; | |
a7c10850 | 2023 | |
1bf42538 | 2024 | bfd_put_64 (input_bfd, value, hit_data); |
e48c661e JL |
2025 | return bfd_reloc_ok; |
2026 | } | |
e5bb3efc | 2027 | |
228d307f JL |
2028 | case R_PARISC_SECREL32: |
2029 | bfd_put_32 (input_bfd, | |
edd21aca | 2030 | value + addend - sym_sec->output_section->vma, |
228d307f JL |
2031 | hit_data); |
2032 | return bfd_reloc_ok; | |
2033 | ||
2034 | case R_PARISC_SEGREL32: | |
2ec0dd12 JL |
2035 | case R_PARISC_SEGREL64: |
2036 | { | |
2037 | /* If this is the first SEGREL relocation, then initialize | |
2038 | the segment base values. */ | |
2039 | if (hppa_info->text_segment_base == (bfd_vma) -1) | |
2040 | bfd_map_over_sections (output_bfd, elf_hppa_record_segment_addrs, | |
edd21aca | 2041 | hppa_info); |
2ec0dd12 JL |
2042 | |
2043 | /* VALUE holds the absolute address. We want to include the | |
2044 | addend, then turn it into a segment relative address. | |
2045 | ||
2046 | The segment is derived from SYM_SEC. We assume that there are | |
2047 | only two segments of note in the resulting executable/shlib. | |
2048 | A readonly segment (.text) and a readwrite segment (.data). */ | |
2049 | value += addend; | |
2050 | ||
2051 | if (sym_sec->flags & SEC_CODE) | |
2052 | value -= hppa_info->text_segment_base; | |
2053 | else | |
2054 | value -= hppa_info->data_segment_base; | |
2055 | ||
2056 | if (r_type == R_PARISC_SEGREL32) | |
2057 | bfd_put_32 (input_bfd, value, hit_data); | |
2058 | else | |
2059 | bfd_put_64 (input_bfd, value, hit_data); | |
46fe4e66 | 2060 | return bfd_reloc_ok; |
2ec0dd12 | 2061 | } |
228d307f | 2062 | |
2eb429af JL |
2063 | /* Something we don't know how to handle. */ |
2064 | default: | |
228d307f | 2065 | return bfd_reloc_notsupported; |
2eb429af JL |
2066 | } |
2067 | ||
2068 | /* Update the instruction word. */ | |
dc810e39 | 2069 | bfd_put_32 (input_bfd, (bfd_vma) insn, hit_data); |
edd21aca | 2070 | return bfd_reloc_ok; |
2eb429af JL |
2071 | } |
2072 | ||
be7582f3 JL |
2073 | /* Relocate the given INSN. VALUE should be the actual value we want |
2074 | to insert into the instruction, ie by this point we should not be | |
2075 | concerned with computing an offset relative to the DLT, PC, etc. | |
2076 | Instead this routine is meant to handle the bit manipulations needed | |
2077 | to insert the relocation into the given instruction. */ | |
2eb429af | 2078 | |
dc810e39 | 2079 | static int |
c39a58e6 | 2080 | elf_hppa_relocate_insn (int insn, int sym_value, unsigned int r_type) |
2eb429af | 2081 | { |
c8933571 | 2082 | switch (r_type) |
2eb429af | 2083 | { |
49bd834c | 2084 | /* This is any 22 bit branch. In PA2.0 syntax it corresponds to |
be7582f3 | 2085 | the "B" instruction. */ |
c8933571 | 2086 | case R_PARISC_PCREL22F: |
571047ad | 2087 | case R_PARISC_PCREL22C: |
dc810e39 | 2088 | return (insn & ~0x3ff1ffd) | re_assemble_22 (sym_value); |
2eb429af | 2089 | |
49bd834c AM |
2090 | /* This is any 12 bit branch. */ |
2091 | case R_PARISC_PCREL12F: | |
dc810e39 | 2092 | return (insn & ~0x1ffd) | re_assemble_12 (sym_value); |
49bd834c AM |
2093 | |
2094 | /* This is any 17 bit branch. In PA2.0 syntax it also corresponds | |
2095 | to the "B" instruction as well as BE. */ | |
be7582f3 | 2096 | case R_PARISC_PCREL17F: |
c8933571 | 2097 | case R_PARISC_DIR17F: |
b7263961 | 2098 | case R_PARISC_DIR17R: |
571047ad JL |
2099 | case R_PARISC_PCREL17C: |
2100 | case R_PARISC_PCREL17R: | |
dc810e39 | 2101 | return (insn & ~0x1f1ffd) | re_assemble_17 (sym_value); |
2eb429af | 2102 | |
be7582f3 | 2103 | /* ADDIL or LDIL instructions. */ |
c8933571 | 2104 | case R_PARISC_DLTREL21L: |
be7582f3 | 2105 | case R_PARISC_DLTIND21L: |
e5bb3efc | 2106 | case R_PARISC_LTOFF_FPTR21L: |
b233eaab JL |
2107 | case R_PARISC_PCREL21L: |
2108 | case R_PARISC_LTOFF_TP21L: | |
6849fb4d | 2109 | case R_PARISC_DPREL21L: |
8267b155 | 2110 | case R_PARISC_PLTOFF21L: |
b7263961 | 2111 | case R_PARISC_DIR21L: |
dc810e39 | 2112 | return (insn & ~0x1fffff) | re_assemble_21 (sym_value); |
be7582f3 | 2113 | |
49bd834c | 2114 | /* LDO and integer loads/stores with 14 bit displacements. */ |
c8933571 | 2115 | case R_PARISC_DLTREL14R: |
084d930b | 2116 | case R_PARISC_DLTREL14F: |
be7582f3 JL |
2117 | case R_PARISC_DLTIND14R: |
2118 | case R_PARISC_DLTIND14F: | |
e5bb3efc | 2119 | case R_PARISC_LTOFF_FPTR14R: |
b233eaab | 2120 | case R_PARISC_PCREL14R: |
571047ad | 2121 | case R_PARISC_PCREL14F: |
b233eaab JL |
2122 | case R_PARISC_LTOFF_TP14R: |
2123 | case R_PARISC_LTOFF_TP14F: | |
6849fb4d JL |
2124 | case R_PARISC_DPREL14R: |
2125 | case R_PARISC_DPREL14F: | |
8267b155 JL |
2126 | case R_PARISC_PLTOFF14R: |
2127 | case R_PARISC_PLTOFF14F: | |
b7263961 | 2128 | case R_PARISC_DIR14R: |
47d89dba | 2129 | case R_PARISC_DIR14F: |
ba94744e AM |
2130 | return (insn & ~0x3fff) | low_sign_unext (sym_value, 14); |
2131 | ||
2132 | /* PA2.0W LDO and integer loads/stores with 16 bit displacements. */ | |
2133 | case R_PARISC_LTOFF_FPTR16F: | |
2134 | case R_PARISC_PCREL16F: | |
2135 | case R_PARISC_LTOFF_TP16F: | |
2136 | case R_PARISC_GPREL16F: | |
2137 | case R_PARISC_PLTOFF16F: | |
b7263961 JL |
2138 | case R_PARISC_DIR16F: |
2139 | case R_PARISC_LTOFF16F: | |
ba94744e | 2140 | return (insn & ~0xffff) | re_assemble_16 (sym_value); |
be7582f3 | 2141 | |
49bd834c | 2142 | /* Doubleword loads and stores with a 14 bit displacement. */ |
11c19a4e | 2143 | case R_PARISC_DLTREL14DR: |
be7582f3 | 2144 | case R_PARISC_DLTIND14DR: |
e5bb3efc JL |
2145 | case R_PARISC_LTOFF_FPTR14DR: |
2146 | case R_PARISC_LTOFF_FPTR16DF: | |
571047ad JL |
2147 | case R_PARISC_PCREL14DR: |
2148 | case R_PARISC_PCREL16DF: | |
b233eaab JL |
2149 | case R_PARISC_LTOFF_TP14DR: |
2150 | case R_PARISC_LTOFF_TP16DF: | |
6849fb4d JL |
2151 | case R_PARISC_DPREL14DR: |
2152 | case R_PARISC_GPREL16DF: | |
8267b155 JL |
2153 | case R_PARISC_PLTOFF14DR: |
2154 | case R_PARISC_PLTOFF16DF: | |
b7263961 JL |
2155 | case R_PARISC_DIR14DR: |
2156 | case R_PARISC_DIR16DF: | |
2157 | case R_PARISC_LTOFF16DF: | |
dc810e39 AM |
2158 | return (insn & ~0x3ff1) | (((sym_value & 0x2000) >> 13) |
2159 | | ((sym_value & 0x1ff8) << 1)); | |
11c19a4e | 2160 | |
be7582f3 | 2161 | /* Floating point single word load/store instructions. */ |
11c19a4e | 2162 | case R_PARISC_DLTREL14WR: |
be7582f3 | 2163 | case R_PARISC_DLTIND14WR: |
e5bb3efc JL |
2164 | case R_PARISC_LTOFF_FPTR14WR: |
2165 | case R_PARISC_LTOFF_FPTR16WF: | |
571047ad JL |
2166 | case R_PARISC_PCREL14WR: |
2167 | case R_PARISC_PCREL16WF: | |
b233eaab JL |
2168 | case R_PARISC_LTOFF_TP14WR: |
2169 | case R_PARISC_LTOFF_TP16WF: | |
6849fb4d JL |
2170 | case R_PARISC_DPREL14WR: |
2171 | case R_PARISC_GPREL16WF: | |
8267b155 JL |
2172 | case R_PARISC_PLTOFF14WR: |
2173 | case R_PARISC_PLTOFF16WF: | |
b7263961 JL |
2174 | case R_PARISC_DIR16WF: |
2175 | case R_PARISC_DIR14WR: | |
2176 | case R_PARISC_LTOFF16WF: | |
dc810e39 AM |
2177 | return (insn & ~0x3ff9) | (((sym_value & 0x2000) >> 13) |
2178 | | ((sym_value & 0x1ffc) << 1)); | |
be7582f3 | 2179 | |
2eb429af JL |
2180 | default: |
2181 | return insn; | |
2182 | } | |
2183 | } | |
3f9b03b5 | 2184 | #endif |