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