* elf-hppa.h (elf_hppa_record_segment_addrs): New function.
[deliverable/binutils-gdb.git] / bfd / elf-hppa.h
1 /* Common code for PA ELF implementations.
2 Copyright (C) 1999 Free Software Foundation, Inc.
3
4 This file is part of BFD, the Binary File Descriptor library.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19
20 #define ELF_HOWTO_TABLE_SIZE R_PARISC_UNIMPLEMENTED + 1
21
22 /* This file is included by multiple PA ELF BFD backends with different
23 sizes.
24
25 Most of the routines are written to be size independent, but sometimes
26 external constraints require 32 or 64 bit specific code. We remap
27 the definitions/functions as necessary here. */
28 #if ARCH_SIZE == 64
29 #define ELF_R_TYPE(X) ELF64_R_TYPE(X)
30 #define ELF_R_SYM(X) ELF64_R_SYM(X)
31 #define _bfd_elf_hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type
32 #define elf_hppa_relocate_section elf64_hppa_relocate_section
33 #define bfd_elf_bfd_final_link bfd_elf64_bfd_final_link
34 #define elf_hppa_final_link elf64_hppa_final_link
35 #endif
36 #if ARCH_SIZE == 32
37 #define ELF_R_TYPE(X) ELF32_R_TYPE(X)
38 #define ELF_R_SYM(X) ELF32_R_SYM(X)
39 #define _bfd_elf_hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type
40 #define elf_hppa_relocate_section elf32_hppa_relocate_section
41 #define bfd_elf_bfd_final_link bfd_elf32_bfd_final_link
42 #define elf_hppa_final_link elf32_hppa_final_link
43 #endif
44
45 static boolean
46 elf_hppa_relocate_section
47 PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
48 bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
49
50 static bfd_reloc_status_type elf_hppa_final_link_relocate
51 PARAMS ((Elf_Internal_Rela *, bfd *, bfd *, asection *,
52 bfd_byte *, bfd_vma, struct bfd_link_info *,
53 asection *, struct elf_link_hash_entry *,
54 struct elf64_hppa_dyn_hash_entry *));
55
56 static unsigned long elf_hppa_relocate_insn
57 PARAMS ((unsigned long, long, unsigned long));
58
59 static boolean elf_hppa_add_symbol_hook
60 PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
61 const char **, flagword *, asection **, bfd_vma *));
62
63 static boolean elf_hppa_final_link
64 PARAMS ((bfd *, struct bfd_link_info *));
65
66 static boolean elf_hppa_unmark_useless_dynamic_symbols
67 PARAMS ((struct elf_link_hash_entry *, PTR));
68
69 static boolean elf_hppa_remark_useless_dynamic_symbols
70 PARAMS ((struct elf_link_hash_entry *, PTR));
71
72 static void elf_hppa_record_segment_addrs
73 PARAMS ((bfd *, asection *, PTR));
74
75 /* ELF/PA relocation howto entries. */
76
77 static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
78 {
79 {R_PARISC_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_NONE"},
80
81 /* The values in DIR32 are to placate the check in
82 _bfd_stab_section_find_nearest_line. */
83 {R_PARISC_DIR32, 0, 2, 32, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR32", false, 0, 0xffffffff, false},
84 {R_PARISC_DIR21L, 0, 0, 21, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR21L"},
85 {R_PARISC_DIR17R, 0, 0, 17, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR17R"},
86 {R_PARISC_DIR17F, 0, 0, 17, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR17F"},
87 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
88 {R_PARISC_DIR14R, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR14R"},
89 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
90 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
91 {R_PARISC_PCREL32, 0, 0, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL32"},
92
93 {R_PARISC_PCREL21L, 0, 0, 21, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL21L"},
94 {R_PARISC_PCREL17R, 0, 0, 17, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL17R"},
95 {R_PARISC_PCREL17F, 0, 0, 17, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL17F"},
96 {R_PARISC_PCREL17C, 0, 0, 17, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL17C"},
97 {R_PARISC_PCREL14R, 0, 0, 14, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL14R"},
98 {R_PARISC_PCREL14F, 0, 0, 14, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL14F"},
99 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
100 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
101 {R_PARISC_DPREL21L, 0, 0, 21, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DPREL21L"},
102 {R_PARISC_DPREL14WR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DPREL14WR"},
103
104 {R_PARISC_DPREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DPREL14DR"},
105 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
106 {R_PARISC_DPREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DPREL14R"},
107 {R_PARISC_DPREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DPREL14F"},
108 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
109 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
110 {R_PARISC_DLTREL21L, 0, 0, 21, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTREL21L"},
111 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
112 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
113 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
114
115 {R_PARISC_DLTREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTREL14R"},
116 {R_PARISC_DLTREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTREL14F"},
117 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
118 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
119 {R_PARISC_DLTIND21L, 0, 0, 21, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTIND21L"},
120 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
121 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
122 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
123 {R_PARISC_DLTIND14R, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTIND14R"},
124 {R_PARISC_DLTIND14F, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTIND14F"},
125
126 {R_PARISC_SETBASE, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_SETBASE"},
127 {R_PARISC_SECREL32, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_SECREL32"},
128 {R_PARISC_BASEREL21L, 0, 0, 21, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_BASEREL21L"},
129 {R_PARISC_BASEREL17R, 0, 0, 17, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_BASEREL17R"},
130 {R_PARISC_BASEREL17F, 0, 0, 17, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_BASEREL17F"},
131 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
132 {R_PARISC_BASEREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_BASEREL14R"},
133 {R_PARISC_BASEREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_BASEREL14F"},
134 {R_PARISC_SEGBASE, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_SEGBASE"},
135 {R_PARISC_SEGREL32, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_SEGREL32"},
136
137 {R_PARISC_PLTOFF21L, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLTOFF21L"},
138 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
139 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
140 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
141 {R_PARISC_PLTOFF14R, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLTOFF14R"},
142 {R_PARISC_PLTOFF14F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLTOFF14F"},
143 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
144 {R_PARISC_LTOFF_FPTR32, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR32"},
145 {R_PARISC_LTOFF_FPTR21L, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR21L"},
146 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
147
148 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
149 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
150 {R_PARISC_LTOFF_FPTR14R, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14R"},
151 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
152 {R_PARISC_FPTR64, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_FPTR64"},
153 {R_PARISC_PLABEL32, 0, 0, 32, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLABEL32"},
154 {R_PARISC_PLABEL21L, 0, 0, 21, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLABEL21L"},
155 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
156 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
157 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
158
159 {R_PARISC_PLABEL14R, 0, 0, 14, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLABEL14R"},
160 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
161 {R_PARISC_PCREL64, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL64"},
162 {R_PARISC_PCREL22C, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL22C"},
163 {R_PARISC_PCREL22F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL22F"},
164 {R_PARISC_PCREL14WR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL14WR"},
165 {R_PARISC_PCREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL14DR"},
166 {R_PARISC_PCREL16F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL16F"},
167 {R_PARISC_PCREL16WF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL16WF"},
168 {R_PARISC_PCREL16DF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PCREL16DF"},
169
170 {R_PARISC_DIR64, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR64"},
171 {R_PARISC_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_NONE"},
172 {R_PARISC_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_NONE"},
173 {R_PARISC_DIR14WR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR14WR"},
174 {R_PARISC_DIR14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR14DR"},
175 {R_PARISC_DIR16F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR16F"},
176 {R_PARISC_DIR16WF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR16WF"},
177 {R_PARISC_DIR16DF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DIR16DF"},
178 {R_PARISC_GPREL64, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_GPREL64"},
179 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
180
181 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
182 {R_PARISC_DLTREL14WR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTREL14WR"},
183 {R_PARISC_DLTREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTREL14DR"},
184 {R_PARISC_GPREL16F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_GPREL16F"},
185 {R_PARISC_GPREL16WF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_GPREL16WF"},
186 {R_PARISC_GPREL16DF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_GPREL16DF"},
187 {R_PARISC_LTOFF64, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF64"},
188 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
189 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
190 {R_PARISC_DLTIND14WR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTIND14WR"},
191
192 {R_PARISC_DLTIND14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_DLTIND14DR"},
193 {R_PARISC_LTOFF16F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF16F"},
194 {R_PARISC_LTOFF16WF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF"},
195 {R_PARISC_LTOFF16DF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF"},
196 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
197 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
198 {R_PARISC_BASEREL14WR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_BSEREL14WR"},
199 {R_PARISC_BASEREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_BASEREL14DR"},
200 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
201 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
202
203 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
204 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
205 {R_PARISC_SEGREL64, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_SEGREL64"},
206 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
207 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
208 {R_PARISC_PLTOFF14WR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLTOFF14WR"},
209 {R_PARISC_PLTOFF14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLTOFF14DR"},
210 {R_PARISC_PLTOFF16F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLTOFF16F"},
211 {R_PARISC_PLTOFF16WF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLTOFF16WF"},
212 {R_PARISC_PLTOFF16DF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_PLTOFF16DF"},
213
214 {R_PARISC_LTOFF_FPTR64, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
215 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
216 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
217 {R_PARISC_LTOFF_FPTR14WR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14WR"},
218 {R_PARISC_LTOFF_FPTR14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14DR"},
219 {R_PARISC_LTOFF_FPTR16F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16F"},
220 {R_PARISC_LTOFF_FPTR16WF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16WF"},
221 {R_PARISC_LTOFF_FPTR16DF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
222 {R_PARISC_COPY, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_COPY"},
223 {R_PARISC_IPLT, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_IPLT"},
224
225 {R_PARISC_EPLT, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_EPLT"},
226 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
227 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
228 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
229 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
230 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
231 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
232 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
233 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
234 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
235
236 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
237 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
238 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
239 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
240 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
241 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
242 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
243 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
244 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
245 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
246
247 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
248 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
249 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
250 {R_PARISC_TPREL32, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_TPREL32"},
251 {R_PARISC_TPREL21L, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_TPREL21L"},
252 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
253 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
254 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
255 {R_PARISC_TPREL14R, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_TPREL14R"},
256 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
257
258 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
259 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
260 {R_PARISC_LTOFF_TP21L, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP21L"},
261 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
262 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
263 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
264 {R_PARISC_LTOFF_TP14R, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
265 {R_PARISC_LTOFF_TP14F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14F"},
266 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
267 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
268
269 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
270 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
271 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
272 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
273 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
274 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
275 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
276 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
277 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
278 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
279
280 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
281 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
282 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
283 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
284 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
285 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
286 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
287 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
288 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
289 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
290
291 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
292 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
293 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
294 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
295 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
296 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
297 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
298 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
299 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
300 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
301
302 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
303 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
304 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
305 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
306 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
307 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
308 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
309 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
310 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
311 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
312
313 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
314 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
315 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_UNIMPLEMENTED"},
316 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
317 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
318 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
319 {R_PARISC_TPREL64, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_TPREL64"},
320 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
321 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
322 {R_PARISC_TPREL14WR, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_TPREL14WR"},
323
324 {R_PARISC_TPREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_TPREL14DR"},
325 {R_PARISC_TPREL16F, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_TPREL16F"},
326 {R_PARISC_TPREL16WF, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_TPREL16WF"},
327 {R_PARISC_TPREL16DF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_TPREL16DF"},
328 {R_PARISC_LTOFF_TP64, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP64"},
329 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
330 {R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED"},
331 {R_PARISC_LTOFF_TP14WR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14WR"},
332 {R_PARISC_LTOFF_TP14DR, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14DR"},
333 {R_PARISC_LTOFF_TP16F, 0, 0, 0, false, 0, complain_overflow_dont, NULL, "R_PARISC_LTOFF_TP16F"},
334
335 {R_PARISC_LTOFF_TP16WF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16WF"},
336 {R_PARISC_LTOFF_TP16DF, 0, 0, 0, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16DF"},
337 };
338
339 #define OFFSET_14R_FROM_21L 4
340 #define OFFSET_14F_FROM_21L 5
341
342 /* Return one (or more) BFD relocations which implement the base
343 relocation with modifications based on format and field. */
344
345 elf_hppa_reloc_type **
346 _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
347 bfd *abfd;
348 elf_hppa_reloc_type base_type;
349 int format;
350 int field;
351 int ignore;
352 asymbol *sym;
353 {
354 elf_hppa_reloc_type *finaltype;
355 elf_hppa_reloc_type **final_types;
356
357 /* Allocate slots for the BFD relocation. */
358 final_types = ((elf_hppa_reloc_type **)
359 bfd_alloc (abfd, sizeof (elf_hppa_reloc_type *) * 2));
360 if (final_types == NULL)
361 return NULL;
362
363 /* Allocate space for the relocation itself. */
364 finaltype = ((elf_hppa_reloc_type *)
365 bfd_alloc (abfd, sizeof (elf_hppa_reloc_type)));
366 if (finaltype == NULL)
367 return NULL;
368
369 /* Some reasonable defaults. */
370 final_types[0] = finaltype;
371 final_types[1] = NULL;
372
373 #define final_type finaltype[0]
374
375 final_type = base_type;
376
377 /* Just a tangle of nested switch statements to deal with the braindamage
378 that a different field selector means a completely different relocation
379 for PA ELF. */
380 switch (base_type)
381 {
382 /* We have been using generic relocation types. However, that may not
383 really make sense. Anyway, we need to support both R_PARISC_DIR64
384 and R_PARISC_DIR32 here. */
385 case R_PARISC_DIR32:
386 case R_PARISC_DIR64:
387 case R_HPPA_ABS_CALL:
388 switch (format)
389 {
390 case 14:
391 switch (field)
392 {
393 case e_rsel:
394 case e_rrsel:
395 final_type = R_PARISC_DIR14R;
396 break;
397 case e_rtsel:
398 final_type = R_PARISC_DLTIND14R;
399 break;
400 case e_rtpsel:
401 final_type = R_PARISC_LTOFF_FPTR14DR;
402 break;
403 case e_tsel:
404 final_type = R_PARISC_DLTIND14F;
405 break;
406 case e_rpsel:
407 final_type = R_PARISC_PLABEL14R;
408 break;
409 default:
410 return NULL;
411 }
412 break;
413
414 case 17:
415 switch (field)
416 {
417 case e_fsel:
418 final_type = R_PARISC_DIR17F;
419 break;
420 case e_rsel:
421 case e_rrsel:
422 final_type = R_PARISC_DIR17R;
423 break;
424 default:
425 return NULL;
426 }
427 break;
428
429 case 21:
430 switch (field)
431 {
432 case e_lsel:
433 case e_lrsel:
434 final_type = R_PARISC_DIR21L;
435 break;
436 case e_ltsel:
437 final_type = R_PARISC_DLTIND21L;
438 break;
439 case e_ltpsel:
440 final_type = R_PARISC_LTOFF_FPTR21L;
441 break;
442 case e_lpsel:
443 final_type = R_PARISC_PLABEL21L;
444 break;
445 default:
446 return NULL;
447 }
448 break;
449
450 case 32:
451 switch (field)
452 {
453 case e_fsel:
454 final_type = R_PARISC_DIR32;
455 /* When in 64bit mode, a 32bit relocation is supposed to
456 be a section relative relocation. Dwarf2 (for example)
457 uses 32bit section relative relocations. */
458 if (bfd_get_arch_info (abfd)->bits_per_address != 32)
459 final_type = R_PARISC_SECREL32;
460 break;
461 case e_psel:
462 final_type = R_PARISC_PLABEL32;
463 break;
464 default:
465 return NULL;
466 }
467 break;
468
469 case 64:
470 switch (field)
471 {
472 case e_fsel:
473 final_type = R_PARISC_DIR64;
474 break;
475 case e_psel:
476 final_type = R_PARISC_FPTR64;
477 break;
478 default:
479 return NULL;
480 }
481 break;
482
483 default:
484 return NULL;
485 }
486 break;
487
488
489 case R_HPPA_GOTOFF:
490 switch (format)
491 {
492 case 14:
493 switch (field)
494 {
495 case e_rsel:
496 case e_rrsel:
497 final_type = base_type + OFFSET_14R_FROM_21L;
498 break;
499 case e_fsel:
500 final_type = base_type + OFFSET_14F_FROM_21L;
501 break;
502 default:
503 return NULL;
504 }
505 break;
506
507 case 21:
508 switch (field)
509 {
510 case e_lrsel:
511 case e_lsel:
512 final_type = base_type;
513 break;
514 default:
515 return NULL;
516 }
517 break;
518
519 default:
520 return NULL;
521 }
522 break;
523
524
525 case R_HPPA_PCREL_CALL:
526 switch (format)
527 {
528 case 14:
529 switch (field)
530 {
531 case e_rsel:
532 case e_rrsel:
533 final_type = R_PARISC_PCREL14R;
534 break;
535 case e_fsel:
536 final_type = R_PARISC_PCREL14F;
537 break;
538 default:
539 return NULL;
540 }
541 break;
542
543 case 17:
544 switch (field)
545 {
546 case e_rsel:
547 case e_rrsel:
548 final_type = R_PARISC_PCREL17R;
549 break;
550 case e_fsel:
551 final_type = R_PARISC_PCREL17F;
552 break;
553 default:
554 return NULL;
555 }
556 break;
557
558 case 22:
559 switch (field)
560 {
561 case e_fsel:
562 final_type = R_PARISC_PCREL22F;
563 break;
564 default:
565 return NULL;
566 }
567 break;
568
569 case 21:
570 switch (field)
571 {
572 case e_lsel:
573 case e_lrsel:
574 final_type = R_PARISC_PCREL21L;
575 break;
576 default:
577 return NULL;
578 }
579 break;
580
581 default:
582 return NULL;
583 }
584 break;
585
586 case R_PARISC_SEGREL32:
587 case R_PARISC_SEGBASE:
588 /* The defaults are fine for these cases. */
589 break;
590
591 default:
592 return NULL;
593 }
594
595 return final_types;
596 }
597
598 /* Translate from an elf into field into a howto relocation pointer. */
599
600 static void
601 elf_hppa_info_to_howto (abfd, bfd_reloc, elf_reloc)
602 bfd *abfd;
603 arelent *bfd_reloc;
604 Elf_Internal_Rela *elf_reloc;
605 {
606 BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info)
607 < (unsigned int) R_PARISC_UNIMPLEMENTED);
608 bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
609 }
610
611 /* Translate from an elf into field into a howto relocation pointer. */
612
613 static void
614 elf_hppa_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
615 bfd *abfd;
616 arelent *bfd_reloc;
617 Elf_Internal_Rel *elf_reloc;
618 {
619 BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info)
620 < (unsigned int) R_PARISC_UNIMPLEMENTED);
621 bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
622 }
623
624 /* Return the address of the howto table entry to perform the CODE
625 relocation for an ARCH machine. */
626
627 static reloc_howto_type *
628 elf_hppa_reloc_type_lookup (abfd, code)
629 bfd *abfd;
630 bfd_reloc_code_real_type code;
631 {
632 if ((int) code < (int) R_PARISC_UNIMPLEMENTED)
633 {
634 BFD_ASSERT ((int) elf_hppa_howto_table[(int) code].type == (int) code);
635 return &elf_hppa_howto_table[(int) code];
636 }
637 return NULL;
638 }
639
640 static void
641 elf_hppa_final_write_processing (abfd, linker)
642 bfd *abfd;
643 boolean linker;
644 {
645 int mach = bfd_get_mach (abfd);
646
647 elf_elfheader (abfd)->e_flags &= ~(EF_PARISC_ARCH | EF_PARISC_TRAPNIL
648 | EF_PARISC_EXT | EF_PARISC_LSB
649 | EF_PARISC_WIDE | EF_PARISC_NO_KABP
650 | EF_PARISC_LAZYSWAP);
651
652 if (mach == 10)
653 elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_0;
654 else if (mach == 11)
655 elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_1;
656 else if (mach == 20)
657 elf_elfheader (abfd)->e_flags |= EFA_PARISC_2_0;
658 else if (mach == 25)
659 elf_elfheader (abfd)->e_flags |= EF_PARISC_WIDE | EFA_PARISC_2_0;
660 }
661
662 /* Return true if SYM represents a local label symbol. */
663
664 static boolean
665 elf_hppa_is_local_label_name (abfd, name)
666 bfd *abfd ATTRIBUTE_UNUSED;
667 const char *name;
668 {
669 return (name[0] == 'L' && name[1] == '$');
670 }
671
672 /* Set the correct type for an ELF section. We do this by the
673 section name, which is a hack, but ought to work. */
674
675 static boolean
676 elf_hppa_fake_sections (abfd, hdr, sec)
677 bfd *abfd;
678 Elf64_Internal_Shdr *hdr;
679 asection *sec;
680 {
681 register const char *name;
682
683 name = bfd_get_section_name (abfd, sec);
684
685 if (strcmp (name, ".PARISC.unwind") == 0)
686 {
687 int indx;
688 asection *sec;
689 hdr->sh_type = SHT_LOPROC + 1;
690 /* ?!? How are unwinds supposed to work for symbols in arbitrary
691 sections? Or what if we have multiple .text sections in a single
692 .o file? HP really messed up on this one.
693
694 Ugh. We can not use elf_section_data (sec)->this_idx at this
695 point because it is not initialized yet.
696
697 So we (gasp) recompute it here. Hopefully nobody ever changes the
698 way sections are numbered in elf.c! */
699 for (sec = abfd->sections, indx = 1; sec; sec = sec->next, indx++)
700 {
701 if (sec->name && strcmp (sec->name, ".text") == 0)
702 {
703 hdr->sh_info = indx;
704 break;
705 }
706 }
707
708 /* I have no idea if this is really necessary or what it means. */
709 hdr->sh_entsize = 4;
710 }
711 return true;
712 }
713
714 /* Hook called by the linker routine which adds symbols from an object
715 file. HP's libraries define symbols with HP specific section
716 indices, which we have to handle. */
717
718 static boolean
719 elf_hppa_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
720 bfd *abfd;
721 struct bfd_link_info *info ATTRIBUTE_UNUSED;
722 const Elf_Internal_Sym *sym;
723 const char **namep ATTRIBUTE_UNUSED;
724 flagword *flagsp ATTRIBUTE_UNUSED;
725 asection **secp;
726 bfd_vma *valp;
727 {
728 int index = sym->st_shndx;
729
730 switch (index)
731 {
732 case SHN_PARISC_ANSI_COMMON:
733 *secp = bfd_make_section_old_way (abfd, ".PARISC.ansi.common");
734 (*secp)->flags |= SEC_IS_COMMON;
735 *valp = sym->st_size;
736 break;
737
738 case SHN_PARISC_HUGE_COMMON:
739 *secp = bfd_make_section_old_way (abfd, ".PARISC.huge.common");
740 (*secp)->flags |= SEC_IS_COMMON;
741 *valp = sym->st_size;
742 break;
743 }
744
745 return true;
746 }
747
748 static boolean
749 elf_hppa_unmark_useless_dynamic_symbols (h, data)
750 struct elf_link_hash_entry *h;
751 PTR data;
752 {
753 struct bfd_link_info *info = (struct bfd_link_info *)data;
754
755 /* If we are not creating a shared library, and this symbol is
756 referenced by a shared library but is not defined anywhere, then
757 the generic code will warn that it is undefined.
758
759 This behavior is undesirable on HPs since the standard shared
760 libraries contain reerences to undefined symbols.
761
762 So we twiddle the flags associated with such symbols so that they
763 will not trigger the warning. ?!? FIXME. This is horribly fraglie.
764
765 Ultimately we should have better controls over the generic ELF BFD
766 linker code. */
767 if (! info->relocateable
768 && ! (info->shared
769 && !info->no_undefined)
770 && h->root.type == bfd_link_hash_undefined
771 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
772 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
773 {
774 h->elf_link_hash_flags &= ~ELF_LINK_HASH_REF_DYNAMIC;
775 h->elf_link_hash_flags |= 0x8000;
776 }
777
778 return true;
779 }
780
781
782 static boolean
783 elf_hppa_remark_useless_dynamic_symbols (h, data)
784 struct elf_link_hash_entry *h;
785 PTR data;
786 {
787 struct bfd_link_info *info = (struct bfd_link_info *)data;
788
789 /* If we are not creating a shared library, and this symbol is
790 referenced by a shared library but is not defined anywhere, then
791 the generic code will warn that it is undefined.
792
793 This behavior is undesirable on HPs since the standard shared
794 libraries contain reerences to undefined symbols.
795
796 So we twiddle the flags associated with such symbols so that they
797 will not trigger the warning. ?!? FIXME. This is horribly fragile.
798
799 Ultimately we should have better controls over the generic ELF BFD
800 linker code. */
801 if (! info->relocateable
802 && ! (info->shared
803 && !info->no_undefined)
804 && h->root.type == bfd_link_hash_undefined
805 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
806 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
807 && (h->elf_link_hash_flags & 0x8000) != 0)
808 {
809 h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
810 h->elf_link_hash_flags &= ~0x8000;
811 }
812
813 return true;
814 }
815
816 /* Record the lowest address for the data and text segments. */
817 static void
818 elf_hppa_record_segment_addrs (abfd, section, data)
819 bfd *abfd ATTRIBUTE_UNUSED;
820 asection *section;
821 PTR data;
822 {
823 struct elf64_hppa_link_hash_table *hppa_info;
824 bfd_vma value;
825
826 hppa_info = (struct elf64_hppa_link_hash_table *)data;
827
828 value = section->vma - section->filepos;
829
830 if ((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY)
831 == (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
832 && value < hppa_info->text_segment_base)
833 hppa_info->text_segment_base = value;
834 else if ((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY)
835 == (SEC_ALLOC | SEC_LOAD))
836 && value < hppa_info->data_segment_base)
837 hppa_info->data_segment_base = value;
838 }
839
840 /* Called after we have seen all the input files/sections, but before
841 final symbol resolution and section placement has been determined.
842
843 We use this hook to (possibly) provide a value for __gp, then we
844 fall back to the generic ELF final link routine. */
845
846 static boolean
847 elf_hppa_final_link (abfd, info)
848 bfd *abfd;
849 struct bfd_link_info *info;
850 {
851 boolean retval;
852
853 /* Make sure we've got ourselves a suitable __gp value. */
854 if (!info->relocateable)
855 {
856 struct elf_link_hash_entry *gp;
857 bfd_vma gp_val = 0;
858 asection *os;
859
860 /* Find the .opd section. __gp's value should be the same as
861 the start of .PARISC.global section. */
862 for (os = abfd->sections; os ; os = os->next)
863 {
864 /* This would be cleaner if we marked sections with an attribute
865 indicating they are short sections. */
866 if (strcmp (os->name, ".PARISC.global") == 0)
867 break;
868 }
869
870 BFD_ASSERT (os != NULL)
871
872 gp_val = (os->output_section->vma + os->output_offset);
873
874 gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", true,
875 true, false);
876 gp->root.type = bfd_link_hash_defined;
877 gp->root.u.def.section = os;
878 gp->root.u.def.value = 0;
879 _bfd_set_gp_value (abfd, gp_val);
880 }
881
882 /* We need to know the base of the text and data segments so that we
883 can perform SEGREL relocations. We will recore the base addresses
884 when we encounter the first SEGREL relocation. */
885 elf64_hppa_hash_table (info)->text_segment_base = (bfd_vma)-1;
886 elf64_hppa_hash_table (info)->data_segment_base = (bfd_vma)-1;
887
888 /* HP's shared libraries have references to symbols that are not
889 defined anywhere. The generic ELF BFD linker code will complaim
890 about such symbols.
891
892 So we detect the losing case and arrange for the flags on the symbol
893 to indicate that it was never referenced. This keeps the generic
894 ELF BFD link code happy and appears to not create any secondary
895 problems. Ultimately we need a way to control the behavior of the
896 generic ELF BFD link code better. */
897 elf_link_hash_traverse (elf_hash_table (info),
898 elf_hppa_unmark_useless_dynamic_symbols,
899 info);
900
901 /* Invoke the regular ELF backend linker to do all the work. */
902 retval = bfd_elf_bfd_final_link (abfd, info);
903
904 elf_link_hash_traverse (elf_hash_table (info),
905 elf_hppa_remark_useless_dynamic_symbols,
906 info);
907
908 return retval;
909 }
910
911 /* Relocate an HPPA ELF section. */
912
913 static boolean
914 elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
915 contents, relocs, local_syms, local_sections)
916 bfd *output_bfd;
917 struct bfd_link_info *info;
918 bfd *input_bfd;
919 asection *input_section;
920 bfd_byte *contents;
921 Elf_Internal_Rela *relocs;
922 Elf_Internal_Sym *local_syms;
923 asection **local_sections;
924 {
925 Elf_Internal_Shdr *symtab_hdr;
926 Elf_Internal_Rela *rel;
927 Elf_Internal_Rela *relend;
928 struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
929
930 symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
931
932 rel = relocs;
933 relend = relocs + input_section->reloc_count;
934 for (; rel < relend; rel++)
935 {
936 int r_type;
937 reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
938 unsigned long r_symndx;
939 struct elf_link_hash_entry *h;
940 Elf_Internal_Sym *sym;
941 asection *sym_sec;
942 bfd_vma relocation;
943 bfd_reloc_status_type r;
944 const char *sym_name;
945 char *dyn_name;
946 char *dynh_buf = NULL;
947 size_t dynh_buflen = 0;
948 struct elf64_hppa_dyn_hash_entry *dyn_h = NULL;
949
950 r_type = ELF_R_TYPE (rel->r_info);
951 if (r_type < 0 || r_type >= (int) R_PARISC_UNIMPLEMENTED)
952 {
953 bfd_set_error (bfd_error_bad_value);
954 return false;
955 }
956
957 r_symndx = ELF_R_SYM (rel->r_info);
958
959 if (info->relocateable)
960 {
961 /* This is a relocateable link. We don't have to change
962 anything, unless the reloc is against a section symbol,
963 in which case we have to adjust according to where the
964 section symbol winds up in the output section. */
965 if (r_symndx < symtab_hdr->sh_info)
966 {
967 sym = local_syms + r_symndx;
968 if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
969 {
970 sym_sec = local_sections[r_symndx];
971 rel->r_addend += sym_sec->output_offset;
972 }
973 }
974
975 continue;
976 }
977
978 /* This is a final link. */
979 h = NULL;
980 sym = NULL;
981 sym_sec = NULL;
982 if (r_symndx < symtab_hdr->sh_info)
983 {
984 /* This is a local symbol. */
985 sym = local_syms + r_symndx;
986 sym_sec = local_sections[r_symndx];
987 relocation = ((ELF_ST_TYPE (sym->st_info) == STT_SECTION
988 ? 0 : sym->st_value)
989 + sym_sec->output_offset
990 + sym_sec->output_section->vma);
991
992 /* If this symbol has an entry in the PA64 dynamic hash
993 table, then get it. */
994 dyn_name = get_dyn_name (input_bfd, h, rel,
995 &dynh_buf, &dynh_buflen);
996 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
997 dyn_name, false, false);
998
999 }
1000 else
1001 {
1002 /* This is not a local symbol. */
1003 long indx;
1004
1005 indx = r_symndx - symtab_hdr->sh_info;
1006 h = elf_sym_hashes (input_bfd)[indx];
1007 while (h->root.type == bfd_link_hash_indirect
1008 || h->root.type == bfd_link_hash_warning)
1009 h = (struct elf_link_hash_entry *) h->root.u.i.link;
1010 if (h->root.type == bfd_link_hash_defined
1011 || h->root.type == bfd_link_hash_defweak)
1012 {
1013 sym_sec = h->root.u.def.section;
1014
1015
1016 /* If this symbol has an entry in the PA64 dynamic hash
1017 table, then get it. */
1018 dyn_name = get_dyn_name (input_bfd, h, rel,
1019 &dynh_buf, &dynh_buflen);
1020 dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1021 dyn_name, false, false);
1022
1023 /* If we have a relocation against a symbol defined in a
1024 shared library and we have not created an entry in the
1025 PA64 dynamic symbol hash table for it, then we lose. */
1026 if (sym_sec->output_section == NULL && dyn_h == NULL)
1027 {
1028 (*_bfd_error_handler)
1029 (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
1030 bfd_get_filename (input_bfd), h->root.root.string,
1031 bfd_get_section_name (input_bfd, input_section));
1032 relocation = 0;
1033 }
1034 else if (sym_sec->output_section)
1035 relocation = (h->root.u.def.value
1036 + sym_sec->output_offset
1037 + sym_sec->output_section->vma);
1038 /* Value will be provided via one of the offsets in the
1039 dyn_h hash table entry. */
1040 else
1041 relocation = 0;
1042 }
1043 else if (h->root.type == bfd_link_hash_undefweak)
1044 relocation = 0;
1045 else
1046 {
1047 if (!((*info->callbacks->undefined_symbol)
1048 (info, h->root.root.string, input_bfd,
1049 input_section, rel->r_offset)))
1050 return false;
1051 break;
1052 }
1053 }
1054
1055 if (h != NULL)
1056 sym_name = h->root.root.string;
1057 else
1058 {
1059 sym_name = bfd_elf_string_from_elf_section (input_bfd,
1060 symtab_hdr->sh_link,
1061 sym->st_name);
1062 if (sym_name == NULL)
1063 return false;
1064 if (*sym_name == '\0')
1065 sym_name = bfd_section_name (input_bfd, sym_sec);
1066 }
1067
1068 r = elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
1069 input_section, contents,
1070 relocation, info, sym_sec,
1071 h, dyn_h);
1072
1073 if (r != bfd_reloc_ok)
1074 {
1075 switch (r)
1076 {
1077 default:
1078 abort ();
1079 case bfd_reloc_overflow:
1080 {
1081 if (!((*info->callbacks->reloc_overflow)
1082 (info, sym_name, howto->name, (bfd_vma) 0,
1083 input_bfd, input_section, rel->r_offset)))
1084 return false;
1085 }
1086 break;
1087 }
1088 }
1089 }
1090 return true;
1091 }
1092
1093
1094 /* Compute the value for a relocation (REL) during a final link stage,
1095 then insert the value into the proper location in CONTENTS.
1096
1097 VALUE is a tentative value for the relocation and may be overridden
1098 and modified here based on the specific relocation to be performed.
1099
1100 For example we do conversions for PC-relative branches in this routine
1101 or redirection of calls to external routines to stubs.
1102
1103 The work of actually applying the relocation is left to a helper
1104 routine in an attempt to reduce the complexity and size of this
1105 function. */
1106
1107 static bfd_reloc_status_type
1108 elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
1109 input_section, contents, value,
1110 info, sym_sec, h, dyn_h)
1111 Elf_Internal_Rela *rel;
1112 bfd *input_bfd;
1113 bfd *output_bfd;
1114 asection *input_section;
1115 bfd_byte *contents;
1116 bfd_vma value;
1117 struct bfd_link_info *info;
1118 asection *sym_sec;
1119 struct elf_link_hash_entry *h;
1120 struct elf64_hppa_dyn_hash_entry *dyn_h;
1121 {
1122 unsigned long insn;
1123 bfd_vma offset = rel->r_offset;
1124 bfd_vma addend = rel->r_addend;
1125 reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
1126 unsigned long r_type = howto->type;
1127 unsigned long r_field = e_fsel;
1128 bfd_byte *hit_data = contents + offset;
1129 struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
1130
1131 insn = bfd_get_32 (input_bfd, hit_data);
1132
1133 switch (r_type)
1134 {
1135 case R_PARISC_NONE:
1136 break;
1137
1138 /* Random PC relative relocs. */
1139 case R_PARISC_PCREL21L:
1140 case R_PARISC_PCREL14R:
1141 case R_PARISC_PCREL14F:
1142 case R_PARISC_PCREL14WR:
1143 case R_PARISC_PCREL14DR:
1144 case R_PARISC_PCREL16F:
1145 case R_PARISC_PCREL16WF:
1146 case R_PARISC_PCREL16DF:
1147 {
1148 if (r_type == R_PARISC_PCREL21L)
1149 r_field = e_lsel;
1150 else if (r_type == R_PARISC_PCREL14F
1151 || r_type == R_PARISC_PCREL16F
1152 || r_type == R_PARISC_PCREL16WF
1153 || r_type == R_PARISC_PCREL16DF)
1154 r_field = e_fsel;
1155 else
1156 r_field = e_rsel;
1157
1158 /* If this is a call to a function defined in another dynamic
1159 library, then redirect the call to the local stub for this
1160 function. */
1161 if (sym_sec->output_section == NULL)
1162 value = dyn_h->stub_offset;
1163
1164 /* Turn VALUE into a proper PC relative address. */
1165 value -= (offset + input_section->output_offset
1166 + input_section->output_section->vma);
1167
1168 /* Adjust for any field selectors. */
1169 value = hppa_field_adjust (value, -8 + addend, r_field);
1170
1171 /* Apply the relocation to the given instruction. */
1172 insn = elf_hppa_relocate_insn (insn, value, r_type);
1173 break;
1174 }
1175
1176 /* Basic function call support. I'm not entirely sure if PCREL14F is
1177 actually needed or even handled correctly.
1178
1179 Note for a call to a function defined in another dynamic library
1180 we want to redirect the call to a stub. */
1181 case R_PARISC_PCREL22F:
1182 case R_PARISC_PCREL17F:
1183 case R_PARISC_PCREL22C:
1184 case R_PARISC_PCREL17C:
1185 case R_PARISC_PCREL17R:
1186 {
1187 if (r_type == R_PARISC_PCREL17R)
1188 r_field = e_rsel;
1189 else
1190 r_field = e_fsel;
1191
1192 /* If this is a call to a function defined in another dynamic
1193 library, then redirect the call to the local stub for this
1194 function. */
1195 if (sym_sec->output_section == NULL)
1196 value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
1197 + hppa_info->stub_sec->output_section->vma);
1198
1199 /* Turn VALUE into a proper PC relative address. */
1200 value -= (offset + input_section->output_offset
1201 + input_section->output_section->vma);
1202
1203 /* Adjust for any field selectors. */
1204 value = hppa_field_adjust (value, -8 + addend, e_fsel);
1205
1206 /* All branches are implicitly shifted by 2 places. */
1207 value >>= 2;
1208
1209 /* Apply the relocation to the given instruction. */
1210 insn = elf_hppa_relocate_insn (insn, value, r_type);
1211 break;
1212 }
1213
1214 /* Indirect references to data through the DLT. */
1215 case R_PARISC_DLTIND14R:
1216 case R_PARISC_DLTIND14F:
1217 case R_PARISC_DLTIND14DR:
1218 case R_PARISC_DLTIND14WR:
1219 case R_PARISC_DLTIND21L:
1220 case R_PARISC_LTOFF_FPTR14R:
1221 case R_PARISC_LTOFF_FPTR14DR:
1222 case R_PARISC_LTOFF_FPTR14WR:
1223 case R_PARISC_LTOFF_FPTR21L:
1224 case R_PARISC_LTOFF_FPTR16F:
1225 case R_PARISC_LTOFF_FPTR16WF:
1226 case R_PARISC_LTOFF_FPTR16DF:
1227 case R_PARISC_LTOFF_TP21L:
1228 case R_PARISC_LTOFF_TP14R:
1229 case R_PARISC_LTOFF_TP14F:
1230 case R_PARISC_LTOFF_TP14WR:
1231 case R_PARISC_LTOFF_TP14DR:
1232 case R_PARISC_LTOFF_TP16F:
1233 case R_PARISC_LTOFF_TP16WF:
1234 case R_PARISC_LTOFF_TP16DF:
1235 case R_PARISC_LTOFF16F:
1236 case R_PARISC_LTOFF16WF:
1237 case R_PARISC_LTOFF16DF:
1238 {
1239 /* If this relocation was against a local symbol, then we still
1240 have not set up the DLT entry (it's not convienent to do so
1241 in the "finalize_dlt" routine because it is difficult to get
1242 to the local symbol's value).
1243
1244 So, if this is a local symbol (h == NULL), then we need to
1245 fill in its DLT entry.
1246
1247 Similarly we may still need to set up an entry in .opd for
1248 a local function which had its address taken. */
1249 if (dyn_h->h == NULL)
1250 {
1251 bfd_put_64 (hppa_info->dlt_sec->owner,
1252 value,
1253 hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
1254
1255 /* Now handle .opd creation if needed. */
1256 if (r_type == R_PARISC_LTOFF_FPTR14R
1257 || r_type == R_PARISC_LTOFF_FPTR14DR
1258 || r_type == R_PARISC_LTOFF_FPTR14WR
1259 || r_type == R_PARISC_LTOFF_FPTR21L
1260 || r_type == R_PARISC_LTOFF_FPTR16F
1261 || r_type == R_PARISC_LTOFF_FPTR16WF
1262 || r_type == R_PARISC_LTOFF_FPTR16DF)
1263 {
1264 /* The first two words of an .opd entry are zero. */
1265 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset,
1266 0, 16);
1267
1268 /* The next word is the address of the function. */
1269 bfd_put_64 (hppa_info->opd_sec->owner, value,
1270 (hppa_info->opd_sec->contents
1271 + dyn_h->opd_offset + 16));
1272
1273 /* The last word is our local __gp value. */
1274 value = _bfd_get_gp_value
1275 (hppa_info->opd_sec->output_section->owner);
1276 bfd_put_64 (hppa_info->opd_sec->owner, value,
1277 (hppa_info->opd_sec->contents
1278 + dyn_h->opd_offset + 24));
1279 }
1280 }
1281
1282 /* We want the value of the DLT offset for this symbol, not
1283 the symbol's actual address. */
1284 value = dyn_h->dlt_offset + hppa_info->dlt_sec->output_offset;
1285
1286 /* All DLTIND relocations are basically the same at this point,
1287 except that we need different field selectors for the 21bit
1288 version vs the 14bit versions. */
1289 if (r_type == R_PARISC_DLTIND21L
1290 || r_type == R_PARISC_LTOFF_FPTR21L
1291 || r_type == R_PARISC_LTOFF_TP21L)
1292 value = hppa_field_adjust (value, addend, e_lrsel);
1293 else if (r_type == R_PARISC_DLTIND14F
1294 || r_type == R_PARISC_LTOFF_FPTR16F
1295 || r_type == R_PARISC_LTOFF_FPTR16WF
1296 || r_type == R_PARISC_LTOFF_FPTR16DF
1297 || r_type == R_PARISC_LTOFF16F
1298 || r_type == R_PARISC_LTOFF16DF
1299 || r_type == R_PARISC_LTOFF16WF
1300 || r_type == R_PARISC_LTOFF_TP16F
1301 || r_type == R_PARISC_LTOFF_TP16WF
1302 || r_type == R_PARISC_LTOFF_TP16DF)
1303 value = hppa_field_adjust (value, addend, e_fsel);
1304 else
1305 value = hppa_field_adjust (value, addend, e_rrsel);
1306
1307 insn = elf_hppa_relocate_insn (insn, value, r_type);
1308 break;
1309 }
1310
1311 case R_PARISC_DLTREL14R:
1312 case R_PARISC_DLTREL14F:
1313 case R_PARISC_DLTREL14DR:
1314 case R_PARISC_DLTREL14WR:
1315 case R_PARISC_DLTREL21L:
1316 case R_PARISC_DPREL21L:
1317 case R_PARISC_DPREL14WR:
1318 case R_PARISC_DPREL14DR:
1319 case R_PARISC_DPREL14R:
1320 case R_PARISC_DPREL14F:
1321 case R_PARISC_GPREL16F:
1322 case R_PARISC_GPREL16WF:
1323 case R_PARISC_GPREL16DF:
1324 {
1325 /* Subtract out the global pointer value to make value a DLT
1326 relative address. */
1327 value -= _bfd_get_gp_value (output_bfd);
1328
1329 /* All DLTREL relocations are basically the same at this point,
1330 except that we need different field selectors for the 21bit
1331 version vs the 14bit versions. */
1332 if (r_type == R_PARISC_DLTREL21L
1333 || r_type == R_PARISC_DPREL21L)
1334 value = hppa_field_adjust (value, addend, e_lrsel);
1335 else if (r_type == R_PARISC_DLTREL14F
1336 || r_type == R_PARISC_DPREL14F
1337 || r_type == R_PARISC_GPREL16F
1338 || r_type == R_PARISC_GPREL16WF
1339 || r_type == R_PARISC_GPREL16DF)
1340 value = hppa_field_adjust (value, addend, e_fsel);
1341 else
1342 value = hppa_field_adjust (value, addend, e_rrsel);
1343
1344 insn = elf_hppa_relocate_insn (insn, value, r_type);
1345 break;
1346 }
1347
1348 case R_PARISC_DIR21L:
1349 case R_PARISC_DIR17R:
1350 case R_PARISC_DIR17F:
1351 case R_PARISC_DIR14R:
1352 case R_PARISC_DIR14WR:
1353 case R_PARISC_DIR14DR:
1354 case R_PARISC_DIR16F:
1355 case R_PARISC_DIR16WF:
1356 case R_PARISC_DIR16DF:
1357 {
1358 /* All DIR relocations are basically the same at this point,
1359 except that we need different field selectors for the 21bit
1360 version vs the 14bit versions. */
1361 if (r_type == R_PARISC_DIR21L)
1362 value = hppa_field_adjust (value, addend, e_lrsel);
1363 else if (r_type == R_PARISC_DIR17F
1364 || r_type == R_PARISC_DIR16F
1365 || r_type == R_PARISC_DIR16WF
1366 || r_type == R_PARISC_DIR16DF)
1367 value = hppa_field_adjust (value, addend, e_fsel);
1368 else
1369 value = hppa_field_adjust (value, addend, e_rrsel);
1370
1371 insn = elf_hppa_relocate_insn (insn, value, r_type);
1372 break;
1373 }
1374
1375 case R_PARISC_PLTOFF21L:
1376 case R_PARISC_PLTOFF14R:
1377 case R_PARISC_PLTOFF14F:
1378 case R_PARISC_PLTOFF14WR:
1379 case R_PARISC_PLTOFF14DR:
1380 case R_PARISC_PLTOFF16F:
1381 case R_PARISC_PLTOFF16WF:
1382 case R_PARISC_PLTOFF16DF:
1383 {
1384 /* We want the value of the PLT offset for this symbol, not
1385 the symbol's actual address. */
1386 value = dyn_h->plt_offset + hppa_info->plt_sec->output_offset;
1387
1388 /* All PLTOFF relocations are basically the same at this point,
1389 except that we need different field selectors for the 21bit
1390 version vs the 14bit versions. */
1391 if (r_type == R_PARISC_PLTOFF21L)
1392 value = hppa_field_adjust (value, addend, e_lrsel);
1393 else if (r_type == R_PARISC_PLTOFF14F
1394 || r_type == R_PARISC_PLTOFF16F
1395 || r_type == R_PARISC_PLTOFF16WF
1396 || r_type == R_PARISC_PLTOFF16DF)
1397 value = hppa_field_adjust (value, addend, e_fsel);
1398 else
1399 value = hppa_field_adjust (value, addend, e_rrsel);
1400
1401 insn = elf_hppa_relocate_insn (insn, value, r_type);
1402 break;
1403 }
1404
1405 case R_PARISC_LTOFF_FPTR32:
1406 {
1407 /* We may still need to create the FPTR itself if it was for
1408 a local symbol. */
1409 if (dyn_h->h == NULL)
1410 {
1411 /* The first two words of an .opd entry are zero. */
1412 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1413
1414 /* The next word is the address of the function. */
1415 bfd_put_64 (hppa_info->opd_sec->owner, value,
1416 (hppa_info->opd_sec->contents
1417 + dyn_h->opd_offset + 16));
1418
1419 /* The last word is our local __gp value. */
1420 value = _bfd_get_gp_value
1421 (hppa_info->opd_sec->output_section->owner);
1422 bfd_put_64 (hppa_info->opd_sec->owner, value,
1423 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1424 }
1425
1426 /* We want the value of the DLT offset for this symbol, not
1427 the symbol's actual address. */
1428 value = dyn_h->dlt_offset + hppa_info->dlt_sec->output_offset;
1429 bfd_put_32 (input_bfd, value, hit_data);
1430 return bfd_reloc_ok;
1431 }
1432
1433 case R_PARISC_LTOFF_FPTR64:
1434 case R_PARISC_LTOFF_TP64:
1435 {
1436 /* We may still need to create the FPTR itself if it was for
1437 a local symbol. */
1438 if (dyn_h->h == NULL && r_type == R_PARISC_LTOFF_FPTR64)
1439 {
1440 /* The first two words of an .opd entry are zero. */
1441 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1442
1443 /* The next word is the address of the function. */
1444 bfd_put_64 (hppa_info->opd_sec->owner, value,
1445 (hppa_info->opd_sec->contents
1446 + dyn_h->opd_offset + 16));
1447
1448 /* The last word is our local __gp value. */
1449 value = _bfd_get_gp_value
1450 (hppa_info->opd_sec->output_section->owner);
1451 bfd_put_64 (hppa_info->opd_sec->owner, value,
1452 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1453 }
1454
1455 /* We want the value of the DLT offset for this symbol, not
1456 the symbol's actual address. */
1457 value = dyn_h->dlt_offset + hppa_info->dlt_sec->output_offset;
1458 bfd_put_64 (input_bfd, value, hit_data);
1459 return bfd_reloc_ok;
1460 }
1461
1462 case R_PARISC_DIR32:
1463 bfd_put_32 (input_bfd, value + addend, hit_data);
1464 return bfd_reloc_ok;
1465
1466 case R_PARISC_DIR64:
1467 bfd_put_64 (input_bfd, value + addend, hit_data);
1468 return bfd_reloc_ok;
1469
1470 case R_PARISC_GPREL64:
1471 /* Subtract out the global pointer value to make value a DLT
1472 relative address. */
1473 value -= _bfd_get_gp_value (output_bfd);
1474 value += addend;
1475
1476 bfd_put_64 (input_bfd, value + addend, hit_data);
1477 return bfd_reloc_ok;
1478
1479 case R_PARISC_LTOFF64:
1480 /* We want the value of the DLT offset for this symbol, not
1481 the symbol's actual address. */
1482 value = dyn_h->dlt_offset + hppa_info->dlt_sec->output_offset;
1483
1484 bfd_put_64 (input_bfd, value + addend, hit_data);
1485 return bfd_reloc_ok;
1486
1487 case R_PARISC_PCREL32:
1488 {
1489 /* If this is a call to a function defined in another dynamic
1490 library, then redirect the call to the local stub for this
1491 function. */
1492 if (sym_sec->output_section == NULL)
1493 value = dyn_h->stub_offset;
1494
1495 /* Turn VALUE into a proper PC relative address. */
1496 value -= (offset + input_section->output_offset
1497 + input_section->output_section->vma);
1498
1499 value += addend;
1500 value -= 8;
1501 bfd_put_64 (input_bfd, value, hit_data);
1502 return bfd_reloc_ok;
1503 }
1504
1505 case R_PARISC_PCREL64:
1506 {
1507 /* If this is a call to a function defined in another dynamic
1508 library, then redirect the call to the local stub for this
1509 function. */
1510 if (sym_sec->output_section == NULL)
1511 value = dyn_h->stub_offset;
1512
1513 /* Turn VALUE into a proper PC relative address. */
1514 value -= (offset + input_section->output_offset
1515 + input_section->output_section->vma);
1516
1517 value += addend;
1518 value -= 8;
1519 bfd_put_64 (input_bfd, value, hit_data);
1520 return bfd_reloc_ok;
1521 }
1522
1523
1524 case R_PARISC_FPTR64:
1525 {
1526 /* We may still need to create the FPTR itself if it was for
1527 a local symbol. */
1528 if (dyn_h->h == NULL)
1529 {
1530 /* The first two words of an .opd entry are zero. */
1531 memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
1532
1533 /* The next word is the address of the function. */
1534 bfd_put_64 (hppa_info->opd_sec->owner, value,
1535 (hppa_info->opd_sec->contents
1536 + dyn_h->opd_offset + 16));
1537
1538 /* The last word is our local __gp value. */
1539 value = _bfd_get_gp_value
1540 (hppa_info->opd_sec->output_section->owner);
1541 bfd_put_64 (hppa_info->opd_sec->owner, value,
1542 hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
1543 }
1544
1545 /* We want the value of the OPD offset for this symbol, not
1546 the symbol's actual address. */
1547 value = (dyn_h->opd_offset
1548 + hppa_info->opd_sec->output_offset
1549 + hppa_info->opd_sec->output_section->vma);
1550
1551 bfd_put_64 (input_bfd, value + addend, hit_data);
1552 return bfd_reloc_ok;
1553 }
1554
1555 case R_PARISC_SECREL32:
1556 bfd_put_32 (input_bfd,
1557 (value + addend
1558 - sym_sec->output_section->vma),
1559 hit_data);
1560 return bfd_reloc_ok;
1561
1562 case R_PARISC_SEGREL32:
1563 case R_PARISC_SEGREL64:
1564 {
1565 /* If this is the first SEGREL relocation, then initialize
1566 the segment base values. */
1567 if (hppa_info->text_segment_base == (bfd_vma) -1)
1568 bfd_map_over_sections (output_bfd, elf_hppa_record_segment_addrs,
1569 elf64_hppa_hash_table (info));
1570
1571 /* VALUE holds the absolute address. We want to include the
1572 addend, then turn it into a segment relative address.
1573
1574 The segment is derived from SYM_SEC. We assume that there are
1575 only two segments of note in the resulting executable/shlib.
1576 A readonly segment (.text) and a readwrite segment (.data). */
1577 value += addend;
1578
1579 if (sym_sec->flags & SEC_CODE)
1580 value -= hppa_info->text_segment_base;
1581 else
1582 value -= hppa_info->data_segment_base;
1583
1584 if (r_type == R_PARISC_SEGREL32)
1585 bfd_put_32 (input_bfd, value, hit_data);
1586 else
1587 bfd_put_64 (input_bfd, value, hit_data);
1588 return bfd_reloc_ok;
1589 }
1590
1591
1592 /* Something we don't know how to handle. */
1593 default:
1594 return bfd_reloc_notsupported;
1595 }
1596
1597 /* Update the instruction word. */
1598 bfd_put_32 (input_bfd, insn, hit_data);
1599 return (bfd_reloc_ok);
1600 }
1601
1602 /* Relocate the given INSN. VALUE should be the actual value we want
1603 to insert into the instruction, ie by this point we should not be
1604 concerned with computing an offset relative to the DLT, PC, etc.
1605 Instead this routine is meant to handle the bit manipulations needed
1606 to insert the relocation into the given instruction. */
1607
1608 static unsigned long
1609 elf_hppa_relocate_insn (insn, sym_value, r_type)
1610 unsigned long insn;
1611 long sym_value;
1612 unsigned long r_type;
1613 {
1614 switch (r_type)
1615 {
1616 /* This is any 22bit branch. In PA2.0 syntax it corresponds to
1617 the "B" instruction. */
1618 case R_PARISC_PCREL22F:
1619 case R_PARISC_PCREL22C:
1620 {
1621 unsigned int w3, w2, w1, w;
1622
1623 /* These are 22 bit branches. Mask off bits we do not care
1624 about. */
1625 sym_value &= 0x3fffff;
1626
1627 /* Now extract the W1, W2, W3 and W fields from the value. */
1628 dis_assemble_22 (sym_value, &w3, &w1, &w2, &w);
1629
1630 /* Mask out bits for the value in the instruction. */
1631 insn &= 0xfc00e002;
1632
1633 /* Insert the bits for the W1, W2 and W fields into the
1634 instruction. */
1635 insn |= (w3 << 21) | (w2 << 2) | (w1 << 16) | w;
1636 return insn;
1637 }
1638
1639 /* This is any 17bit branch. In PA2.0 syntax it also corresponds to
1640 the "B" instruction as well as BE. */
1641 case R_PARISC_PCREL17F:
1642 case R_PARISC_DIR17F:
1643 case R_PARISC_DIR17R:
1644 case R_PARISC_PCREL17C:
1645 case R_PARISC_PCREL17R:
1646 {
1647 unsigned int w2, w1, w;
1648
1649 /* These are 17 bit branches. Mask off bits we do not care
1650 about. */
1651 sym_value &= 0x1ffff;
1652
1653 /* Now extract the W1, W2 and W fields from the value. */
1654 dis_assemble_17 (sym_value, &w1, &w2, &w);
1655
1656 /* Mask out bits for the value in the instruction. */
1657 insn &= 0xffe0e002;
1658
1659 /* Insert the bits for the W1, W2 and W fields into the
1660 instruction. */
1661 insn |= (w2 << 2) | (w1 << 16) | w;
1662 return insn;
1663 }
1664
1665 /* ADDIL or LDIL instructions. */
1666 case R_PARISC_DLTREL21L:
1667 case R_PARISC_DLTIND21L:
1668 case R_PARISC_LTOFF_FPTR21L:
1669 case R_PARISC_PCREL21L:
1670 case R_PARISC_LTOFF_TP21L:
1671 case R_PARISC_DPREL21L:
1672 case R_PARISC_PLTOFF21L:
1673 case R_PARISC_DIR21L:
1674 {
1675 int w;
1676
1677 /* Mask off bits in INSN we do not want. */
1678 insn &= 0xffe00000;
1679
1680 /* Turn the 21bit value into the proper format. */
1681 dis_assemble_21 (sym_value, &w);
1682
1683 /* And insert the proper bits into INSN. */
1684 return insn | w;
1685 }
1686
1687 /* LDO and integer loads/stores with 14bit displacements. */
1688 case R_PARISC_DLTREL14R:
1689 case R_PARISC_DLTREL14F:
1690 case R_PARISC_DLTIND14R:
1691 case R_PARISC_DLTIND14F:
1692 case R_PARISC_LTOFF_FPTR14R:
1693 case R_PARISC_LTOFF_FPTR16F:
1694 case R_PARISC_PCREL14R:
1695 case R_PARISC_PCREL14F:
1696 case R_PARISC_PCREL16F:
1697 case R_PARISC_LTOFF_TP14R:
1698 case R_PARISC_LTOFF_TP14F:
1699 case R_PARISC_LTOFF_TP16F:
1700 case R_PARISC_DPREL14R:
1701 case R_PARISC_DPREL14F:
1702 case R_PARISC_GPREL16F:
1703 case R_PARISC_PLTOFF14R:
1704 case R_PARISC_PLTOFF14F:
1705 case R_PARISC_PLTOFF16F:
1706 case R_PARISC_DIR14R:
1707 case R_PARISC_DIR16F:
1708 case R_PARISC_LTOFF16F:
1709 {
1710 int w;
1711
1712 /* Mask off bits in INSN we do not want. */
1713 insn &= 0xffffc000;
1714
1715 /* Turn the 14bit value into the proper format. */
1716 low_sign_unext (sym_value, 14, &w);
1717
1718 /* And insert the proper bits into INSN. */
1719 return insn | w;
1720 }
1721
1722 /* Doubleword loads and stores with a 14bit displacement. */
1723 case R_PARISC_DLTREL14DR:
1724 case R_PARISC_DLTIND14DR:
1725 case R_PARISC_LTOFF_FPTR14DR:
1726 case R_PARISC_LTOFF_FPTR16DF:
1727 case R_PARISC_PCREL14DR:
1728 case R_PARISC_PCREL16DF:
1729 case R_PARISC_LTOFF_TP14DR:
1730 case R_PARISC_LTOFF_TP16DF:
1731 case R_PARISC_DPREL14DR:
1732 case R_PARISC_GPREL16DF:
1733 case R_PARISC_PLTOFF14DR:
1734 case R_PARISC_PLTOFF16DF:
1735 case R_PARISC_DIR14DR:
1736 case R_PARISC_DIR16DF:
1737 case R_PARISC_LTOFF16DF:
1738 {
1739 /* Mask off bits in INSN we do not want. */
1740 insn &= 0xffffc00e;
1741
1742 /* The sign bit at 14 moves into bit zero in the destination. */
1743 insn |= ((sym_value & 0x2000) >> 13);
1744
1745 /* Turn off the bits in sym_value we do not care about. */
1746 sym_value &= 0x1ff8;
1747
1748 /* Now shift it one bit position left so that it lines up with the
1749 destination field in INSN. */
1750 sym_value <<= 1;
1751
1752 return insn | sym_value;
1753 }
1754
1755 /* Floating point single word load/store instructions. */
1756 case R_PARISC_DLTREL14WR:
1757 case R_PARISC_DLTIND14WR:
1758 case R_PARISC_LTOFF_FPTR14WR:
1759 case R_PARISC_LTOFF_FPTR16WF:
1760 case R_PARISC_PCREL14WR:
1761 case R_PARISC_PCREL16WF:
1762 case R_PARISC_LTOFF_TP14WR:
1763 case R_PARISC_LTOFF_TP16WF:
1764 case R_PARISC_DPREL14WR:
1765 case R_PARISC_GPREL16WF:
1766 case R_PARISC_PLTOFF14WR:
1767 case R_PARISC_PLTOFF16WF:
1768 case R_PARISC_DIR16WF:
1769 case R_PARISC_DIR14WR:
1770 case R_PARISC_LTOFF16WF:
1771 {
1772 /* Mask off bits in INSN we do not want. */
1773 insn &= 0xffffc006;
1774
1775 /* The sign bit at 14 moves into bit zero in the destination. */
1776 insn |= ((sym_value & 0x2000) >> 13);
1777
1778 /* Turn off the bits in sym_value we do not care about. */
1779 sym_value &= 0x1ffc;
1780
1781 /* Now shift it one bit position left so that it lines up with the
1782 destination field in INSN. */
1783 sym_value <<= 1;
1784
1785 return insn | sym_value;
1786 }
1787
1788 default:
1789 return insn;
1790 }
1791 }
This page took 0.0767 seconds and 4 git commands to generate.