1 /* BFD back-end for HP PA-RISC ELF files.
2 Copyright (C) 1990-1991 Free Software Foundation, Inc.
6 Center for Software Science
7 Department of Computer Science
10 This file is part of BFD, the Binary File Descriptor library.
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
33 static struct elf_backend_data elf_hppa_backend_data
= {
34 NULL
/* initially, $global$ is undefined */
37 /* ELF32/HPPA relocation support
39 This file contains ELF32/HPPA relocation support as specified
40 in the Stratus FTX/Golf Object File Format (SED-1762) dated
47 Center for Software Science
48 Department of Computer Science
52 #include "elf32-hppa.h"
54 /* ELF/PA stab entries */
58 #include <a.out.h> /* we want the non-hp800 definition of 'struct nlist' */
64 /* ELF/PA relocation howto entries */
66 static bfd_reloc_status_type
hppa_elf_reloc();
68 reloc_howto_type elf_hppa_howto_table
[ELF_HOWTO_TABLE_SIZE
] = {
69 /* 'bitpos' and 'abs' are obsolete */
70 /* type rs sz bsz pcrel bpos abs ovrf sf name */
71 /* 9.3.4. Address relocation types */
72 { R_HPPA_NONE
, 0, 3, 19, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_NONE"},
73 { R_HPPA_32
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_32" },
74 { R_HPPA_11
, 0, 3, 11, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_11" },
75 { R_HPPA_14
, 0, 3, 14, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_14" },
76 { R_HPPA_17
, 0, 3, 17, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_17" },
77 { R_HPPA_L21
, 0, 3, 21, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_L21" },
78 { R_HPPA_R11
, 0, 3, 11, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_R11" },
79 { R_HPPA_R14
, 0, 3, 14, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_R14" },
80 { R_HPPA_R17
, 0, 3, 17, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_R17" },
81 { R_HPPA_LS21
, 0, 3, 21, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_LS21" },
82 { R_HPPA_RS11
, 0, 3, 11, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_RS11" },
83 { R_HPPA_RS14
, 0, 3, 14, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_RS14" },
84 { R_HPPA_RS17
, 0, 3, 17, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_RS17" },
85 { R_HPPA_LD21
, 0, 3, 21, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_LD21" },
86 { R_HPPA_RD11
, 0, 3, 11, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_RD11" },
87 { R_HPPA_RD14
, 0, 3, 14, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_RD14" },
88 { R_HPPA_RD17
, 0, 3, 17, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_RD17" },
89 { R_HPPA_LR21
, 0, 3, 21, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_LR21" },
90 { R_HPPA_RR14
, 0, 3, 14, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_RR14" },
91 { R_HPPA_RR17
, 0, 3, 17, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_RR17" },
92 /* 9.3.5. GOTOFF address relocation types */
93 { R_HPPA_GOTOFF_11
, 0, 3, 11, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_GOTOFF_11" },
94 { R_HPPA_GOTOFF_14
, 0, 3, 14, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_GOTOFF_14" },
95 { R_HPPA_GOTOFF_L21
, 0, 3, 21, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_GOTOFF_L21" },
96 { R_HPPA_GOTOFF_R11
, 0, 3, 11, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_GOTOFF_R11" },
97 { R_HPPA_GOTOFF_R14
, 0, 3, 14, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_GOTOFF_R14" },
98 { R_HPPA_GOTOFF_LS21
, 0, 3, 21, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_GOTOFF_LS21" },
99 { R_HPPA_GOTOFF_RS11
, 0, 3, 11, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_GOTOFF_RS11" },
100 { R_HPPA_GOTOFF_RS14
, 0, 3, 14, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_GOTOFF_RS14" },
101 { R_HPPA_GOTOFF_LD21
, 0, 3, 21, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_GOTOFF_LD21" },
102 { R_HPPA_GOTOFF_RD11
, 0, 3, 11, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_GOTOFF_RD11" },
103 { R_HPPA_GOTOFF_RD14
, 0, 3, 14, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_GOTOFF_RD14" },
104 { R_HPPA_GOTOFF_LR21
, 0, 3, 21, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_GOTOFF_LR21" },
105 { R_HPPA_GOTOFF_RR14
, 0, 3, 14, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_GOTOFF_RR14" },
106 /* 9.3.6. Absolute call relocation types */
107 { R_HPPA_ABS_CALL_11
, 0, 3, 11, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ABS_CALL_11" },
108 { R_HPPA_ABS_CALL_14
, 0, 3, 14, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ABS_CALL_14" },
109 { R_HPPA_ABS_CALL_17
, 0, 3, 17, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ABS_CALL_17" },
110 { R_HPPA_ABS_CALL_L21
, 0, 3, 21, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ABS_CALL_L21" },
111 { R_HPPA_ABS_CALL_R11
, 0, 3, 11, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ABS_CALL_R11" },
112 { R_HPPA_ABS_CALL_R14
, 0, 3, 14, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ABS_CALL_R14" },
113 { R_HPPA_ABS_CALL_R17
, 0, 3, 17, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ABS_CALL_R17" },
114 { R_HPPA_ABS_CALL_LS21
, 0, 3, 21, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ABS_CALL_LS21" },
115 { R_HPPA_ABS_CALL_RS11
, 0, 3, 11, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ABS_CALL_RS11" },
116 { R_HPPA_ABS_CALL_RS14
, 0, 3, 14, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ABS_CALL_RS14" },
117 { R_HPPA_ABS_CALL_RS17
, 0, 3, 17, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ABS_CALL_RS17" },
118 { R_HPPA_ABS_CALL_LD21
, 0, 3, 21, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ABS_CALL_LD21" },
119 { R_HPPA_ABS_CALL_RD11
, 0, 3, 11, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ABS_CALL_RD11" },
120 { R_HPPA_ABS_CALL_RD14
, 0, 3, 14, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ABS_CALL_RD14" },
121 { R_HPPA_ABS_CALL_RD17
, 0, 3, 17, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ABS_CALL_RD17" },
122 { R_HPPA_ABS_CALL_LR21
, 0, 3, 21, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ABS_CALL_LR21" },
123 { R_HPPA_ABS_CALL_RR14
, 0, 3, 14, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ABS_CALL_RR14" },
124 { R_HPPA_ABS_CALL_RR17
, 0, 3, 17, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ABS_CALL_RR17" },
125 /* 9.3.7. PC-relative call relocation types */
126 { R_HPPA_PCREL_CALL_11
, 0, 3, 11, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PCREL_CALL_11" },
127 { R_HPPA_PCREL_CALL_14
, 0, 3, 14, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PCREL_CALL_14" },
128 { R_HPPA_PCREL_CALL_17
, 0, 3, 17, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PCREL_CALL_17" },
129 { R_HPPA_PCREL_CALL_L21
,0, 3, 21, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PCREL_CALL_L21" },
130 { R_HPPA_PCREL_CALL_R11
,0, 3, 11, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PCREL_CALL_R11" },
131 { R_HPPA_PCREL_CALL_R14
,0, 3, 14, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PCREL_CALL_R14" },
132 { R_HPPA_PCREL_CALL_R17
,0, 3, 17, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PCREL_CALL_R17" },
133 { R_HPPA_PCREL_CALL_LS21
,0,3, 21, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PCREL_CALL_LS21" },
134 { R_HPPA_PCREL_CALL_RS11
,0,3, 11, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PCREL_CALL_RS11" },
135 { R_HPPA_PCREL_CALL_RS14
,0,3, 14, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PCREL_CALL_RS14" },
136 { R_HPPA_PCREL_CALL_RS17
,0,3, 17, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PCREL_CALL_RS17" },
137 { R_HPPA_PCREL_CALL_LD21
,0,3, 21, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PCREL_CALL_LD21" },
138 { R_HPPA_PCREL_CALL_RD11
,0,3, 11, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PCREL_CALL_RD11" },
139 { R_HPPA_PCREL_CALL_RD14
,0,3, 14, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PCREL_CALL_RD14" },
140 { R_HPPA_PCREL_CALL_RD17
,0,3, 17, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PCREL_CALL_RD17" },
141 { R_HPPA_PCREL_CALL_LR21
,0,3, 21, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PCREL_CALL_LR21" },
142 { R_HPPA_PCREL_CALL_RR14
,0,3, 14, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PCREL_CALL_RR14" },
143 { R_HPPA_PCREL_CALL_RR17
,0,3, 17, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PCREL_CALL_RR17" }, /* #69 */
145 /* 9.3.8. Plabel relocation types */
146 { R_HPPA_PLABEL_32
, 0, 3, 32, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PLABEL_32" },
147 { R_HPPA_PLABEL_11
, 0, 3, 11, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PLABEL_11" },
148 { R_HPPA_PLABEL_14
, 0, 3, 14, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PLABEL_14" },
149 { R_HPPA_PLABEL_L21
, 0, 3, 21, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PLABEL_L21" },
150 { R_HPPA_PLABEL_R11
, 0, 3, 11, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PLABEL_R11" },
151 { R_HPPA_PLABEL_R14
, 0, 3, 14, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_PLABEL_R14" }, /* 75 */
153 /* 9.3.9. Data linkage table (DLT) relocation types */
154 { R_HPPA_DLT_32
, 0, 3, 32, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_DLT_32" },
155 { R_HPPA_DLT_11
, 0, 3, 11, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_DLT_11" },
156 { R_HPPA_DLT_14
, 0, 3, 14, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_DLT_14" },
157 { R_HPPA_DLT_L21
, 0, 3, 21, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_DLT_L21" },
158 { R_HPPA_DLT_R11
, 0, 3, 11, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_DLT_R11" },
159 { R_HPPA_DLT_R14
, 0, 3, 14, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_DLT_R14" }, /* 81 */
161 /* 9.3.10. Relocations for unwinder tables */
162 { R_HPPA_UNWIND_ENTRY
, 0, 3, 32, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_UNWIND_ENTRY"},
163 { R_HPPA_UNWIND_ENTRIES
,0, 3, 32, true, 0, false, true, hppa_elf_reloc
, "R_HPPA_UNWIND_ENTRIES"}, /* 83 */
165 { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, /* 84-89 */
166 { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, /* 90-99 */
167 { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, /* 100-109 */
168 { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, /* 110-119 */
169 { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, /* 120-127 */
171 /* 9.3.11. Relocation types for complex expressions */
172 { R_HPPA_PUSH_CONST
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_PUSH_CONST" },
173 { R_HPPA_PUSH_SYM
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_PUSH_SYM" },
174 { R_HPPA_PUSH_GOT
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_PUSH_GOT" },
175 { R_HPPA_PUSH_PC
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_PUSH_PC" },
176 { R_HPPA_PUSH_PROC
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_PUSH_PROC" },
177 { R_HPPA_PUSH_PLABEL
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_PUSH_PLABEL" },
178 { R_HPPA_MAX
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_MAX" },
179 { R_HPPA_MIN
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_MIN" },
180 { R_HPPA_ADD
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ADD" },
181 { R_HPPA_SUB
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_SUB" },
182 { R_HPPA_MULT
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_MULT" },
183 { R_HPPA_DIV
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_DIV" },
184 { R_HPPA_MOD
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_MOD" },
185 { R_HPPA_AND
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_AND" },
186 { R_HPPA_OR
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_OR" },
187 { R_HPPA_XOR
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_XOR" },
188 { R_HPPA_NOT
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_NOT" },
189 { R_HPPA_LSHIFT
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_LSHIFT" },
190 { R_HPPA_ARITH_RSHIFT
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_ARITH_RSHIFT" },
191 { R_HPPA_LOGIC_RSHIFT
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_LOGIC_RSHIFT" },
192 { R_HPPA_EXPR_F
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_L" },
193 { R_HPPA_EXPR_L
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_EXPR_L" },
194 { R_HPPA_EXPR_R
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_EXPR_R" },
195 { R_HPPA_EXPR_LS
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_EXPR_LS" },
196 { R_HPPA_EXPR_RS
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_EXPR_RS" },
197 { R_HPPA_EXPR_LD
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_EXPR_LD" },
198 { R_HPPA_EXPR_RD
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_EXPR_RD" },
199 { R_HPPA_EXPR_LR
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_EXPR_LR" },
200 { R_HPPA_EXPR_RR
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_EXPR_RR" },
202 { R_HPPA_EXPR_32
, 0, 3, 32, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_EXPR_32" },
203 { R_HPPA_EXPR_21
, 0, 3, 21, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_EXPR_21" },
204 { R_HPPA_EXPR_11
, 0, 3, 11, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_EXPR_11" },
205 { R_HPPA_EXPR_14
, 0, 3, 14, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_EXPR_14" },
206 { R_HPPA_EXPR_17
, 0, 3, 17, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_EXPR_17" },
207 { R_HPPA_EXPR_12
, 0, 3, 12, false, 0, false, true, hppa_elf_reloc
, "R_HPPA_EXPR_12" },
208 { R_HPPA_UNIMPLEMENTED
, 0, 0, 0, false, 0, false, false,NULL
, "R_HPPA_UNIMPLEMENTED"}, /* 163 */
212 DEFUN(hppa_elf_rebuild_insn
, (abfd
,insn
,value
,r_type
,r_field
, r_format
),
214 unsigned long insn AND
215 unsigned long value AND
216 unsigned short r_type AND
217 unsigned short r_field AND
218 unsigned short r_format
)
220 unsigned long const_part
; /* part of the instruction that does not change */
221 unsigned long rebuilt_part
;
223 switch ( r_format
) {
227 const_part
= insn
& 0xffffe002;
228 dis_assemble_12(value
,&w1
,&w
);
229 rebuilt_part
= (w1
<< 2) | w
;
230 return const_part
| rebuilt_part
;
236 const_part
= insn
& 0xffffe002;
237 dis_assemble_12(value
,&w1
,&w
);
238 rebuilt_part
= (w1
<< 2) | w
;
239 return const_part
| rebuilt_part
;
243 const_part
= insn
& 0xffffc000;
244 low_sign_unext(value
,14,&rebuilt_part
);
245 return const_part
| rebuilt_part
;
250 const_part
= insn
& 0xffe0e002;
251 dis_assemble_17(value
,&w1
,&w2
,&w
);
252 rebuilt_part
= (w2
<< 2) | (w1
<< 16) | w
;
253 return const_part
| rebuilt_part
;
257 const_part
= insn
& 0xffe00000;
258 dis_assemble_21(value
,&rebuilt_part
);
259 return const_part
| rebuilt_part
;
266 fprintf(stderr
,"Relocation problem : ");
267 fprintf(stderr
,"Unrecognized reloc type %d (fmt=%d,fld=%d), in module %s\n",
268 r_type
, r_format
, r_field
, abfd
->filename
);
274 DEFUN(hppa_elf_relocate_insn
,
276 insn
, address
, symp
, sym_value
, r_addend
,
277 r_type
, r_format
, r_field
, pcrel
),
279 asection
*input_sect AND
280 unsigned long insn AND
281 unsigned long address AND
285 unsigned short r_type AND
286 unsigned short r_format AND
287 unsigned short r_field AND
290 unsigned char opcode
= get_opcode(insn
);
304 constant_value
= ELF32_HPPA_R_CONSTANT(r_addend
);
305 BFD_ASSERT(r_format
== 14);
308 sym_value
-= address
;
309 sym_value
= hppa_field_adjust(sym_value
,constant_value
,r_field
);
310 return hppa_elf_rebuild_insn(abfd
,insn
,sym_value
,r_type
,r_format
, r_format
);
313 case SUBI
: /* case SUBIO: */
314 case ADDIT
: /* case ADDITO: */
315 case ADDI
: /* case ADDIO: */
316 BFD_ASSERT(r_format
== 11);
318 constant_value
= ((insn
& 0x1) << 10) | ((insn
& 0xffe) >> 1);
319 sym_value
= hppa_field_adjust(sym_value
,constant_value
,r_field
);
320 return hppa_elf_rebuild_insn(abfd
,insn
,sym_value
,r_type
,r_field
, r_format
);
324 BFD_ASSERT(r_format
== 21);
326 constant_value
= assemble_21(insn
);
327 sym_value
= hppa_field_adjust(sym_value
,constant_value
,r_field
);
328 return hppa_elf_rebuild_insn(abfd
,insn
,sym_value
,r_type
,r_field
, r_format
);
333 arg_reloc
= ELF32_HPPA_R_ARG_RELOC(r_addend
);
335 BFD_ASSERT(r_format
== 17);
337 /* XXX computing constant_value is not needed??? */
338 constant_value
= assemble_17((insn
& 0x001f0000) >> 16,
339 (insn
& 0x00001ffc) >> 2,
341 constant_value
= sign_ext(constant_value
,17);
344 address
+ input_sect
->output_offset
345 + input_sect
->output_section
->vma
;
346 sym_value
= hppa_field_adjust(sym_value
,-8,r_field
);
349 sym_value
= hppa_field_adjust(sym_value
, constant_value
, r_field
);
351 return hppa_elf_rebuild_insn(abfd
,insn
,sym_value
>> 2,r_type
,r_field
, r_format
);
354 if ( opcode
== 0 && r_format
== 32 ) {
355 constant_value
= insn
;
356 sym_value
= hppa_field_adjust(sym_value
,constant_value
,r_field
);
361 "Unrecognized opcode 0x%02x (fmt=%x,field=%x)\n",
362 opcode
, r_format
, r_field
);
369 DEFUN(hppa_elf_relocate_unwind_table
,
371 data
, address
, symp
, sym_value
, r_addend
,
372 r_type
, r_format
, r_field
, pcrel
),
374 asection
*input_sect AND
376 unsigned long address AND
380 unsigned short r_type AND
381 unsigned short r_format AND
382 unsigned short r_field AND
385 bfd_byte
*hit_data
= address
+ (bfd_byte
*)(data
);
389 long relocated_value
;
392 BFD_ASSERT( r_format
== 32 );
393 BFD_ASSERT( r_field
== e_fsel
);
395 case R_HPPA_UNWIND_ENTRY
:
396 start_offset
= bfd_get_32(abfd
, hit_data
);
397 relocated_value
= hppa_field_adjust(sym_value
,start_offset
,r_field
);
398 bfd_put_32(abfd
, relocated_value
,hit_data
);
400 hit_data
+= sizeof(unsigned long);
401 end_offset
= bfd_get_32(abfd
, hit_data
);
402 relocated_value
= hppa_field_adjust(sym_value
,end_offset
,r_field
);
403 bfd_put_32(abfd
, relocated_value
,hit_data
);
406 case R_HPPA_UNWIND_ENTRIES
:
407 for ( i
= 0; i
< r_addend
; i
++,hit_data
+= 3*sizeof(unsigned long) ) {
409 start_offset
= bfd_get_32(abfd
, hit_data
);
410 /* Stuff the symbol value into the first word */
411 /* of the unwind descriptor */
412 bfd_put_32(abfd
, sym_value
,hit_data
);
414 hit_data
+= sizeof(unsigned long);
415 end_offset
= bfd_get_32(abfd
, hit_data
);
416 /* We could also compute the ending offset for */
417 /* the 2nd word of the unwind entry by */
418 /* retrieving the st_size field of the Elf_Sym */
419 /* structure stored with this symbol. We can */
421 /* e = (elf_symbol_type *)symp */
422 /* fsize = e->internal_elf_sym.st_size */
424 fsize
= end_offset
- start_offset
;
425 relocated_value
= hppa_field_adjust(sym_value
,fsize
,r_field
);
426 bfd_put_32(abfd
, relocated_value
,hit_data
);
428 /* If this is not the last unwind entry, */
429 /* adjust the symbol value. */
430 if ( i
+1 < r_addend
) {
431 start_offset
= bfd_get_32(abfd
, hit_data
+3*sizeof(unsigned long));
432 sym_value
+= fsize
+ start_offset
- end_offset
;
439 "Unrecognized relocation type 0x%02x (fmt=%x,field=%x)\n",
440 r_type
, r_format
, r_field
);
445 /* Provided the symbol, returns the value reffed */
447 get_symbol_value(symbol
)
452 if ( symbol
== (asymbol
*)NULL
)
454 else if (symbol
->section
== &bfd_com_section
) {
458 relocation
= symbol
->value
+
459 symbol
->section
->output_section
->vma
+
460 symbol
->section
->output_offset
;
466 /* This function provides a pretty straight-forward mapping between a */
467 /* base relocation type, format and field into the relocation type */
468 /* that will be emitted in an object file. The only wrinkle in the */
469 /* mapping is that when the T, TR, TL, P, PR, or PL expression */
470 /* prefixes are involved, the type gets promoted to a *_GOTOFF_* */
471 /* relocation (in the case of T, TR, and TL) or a PLABEL relocation */
472 /* (in the case of P, PR, and PL). */
474 /* NOTE: XXX the T, TR, TL, P, PR, and PL expression prefixes are not */
478 hppa_elf_gen_reloc_error(base_type
,fmt
,field
)
479 elf32_hppa_reloc_type base_type
;
483 fprintf(stderr
, "undefined relocation: base=0x%x,fmt=0x%x,field=0x%x\n",
484 base_type
, fmt
, field
);
488 hppa_elf_gen_reloc_type(base_type
, format
, field
)
489 elf32_hppa_reloc_type base_type
;
493 #define UNDEFINED hppa_elf_gen_reloc_error(base_type,format,field);
495 elf32_hppa_reloc_type final_type
= base_type
;
496 switch ( base_type
) {
502 final_type
= R_HPPA_R11
;
505 final_type
= R_HPPA_RS11
;
508 final_type
= R_HPPA_RD11
;
512 final_type
= R_HPPA_PLABEL_11
;
515 final_type
= R_HPPA_PLABEL_R11
;
529 final_type
= base_type
;
539 final_type
= R_HPPA_R14
;
542 final_type
= R_HPPA_RS14
;
545 final_type
= R_HPPA_RD14
;
548 final_type
= R_HPPA_RR14
;
552 final_type
= R_HPPA_PLABEL_14
;
555 final_type
= R_HPPA_PLABEL_R14
;
569 final_type
= base_type
;
576 final_type
= R_HPPA_R17
;
579 final_type
= R_HPPA_RS17
;
582 final_type
= R_HPPA_RD17
;
585 final_type
= R_HPPA_RR17
;
594 final_type
= base_type
;
601 final_type
= R_HPPA_L21
;
604 final_type
= R_HPPA_LS21
;
607 final_type
= R_HPPA_LD21
;
610 final_type
= R_HPPA_LR21
;
613 final_type
= R_HPPA_PLABEL_L21
;
622 final_type
= base_type
;
629 final_type
= R_HPPA_32
;
632 final_type
= R_HPPA_PLABEL_32
;
636 final_type
= base_type
;
642 final_type
= base_type
;
651 final_type
= R_HPPA_GOTOFF_R11
;
654 final_type
= R_HPPA_GOTOFF_RS11
;
657 final_type
= R_HPPA_GOTOFF_RD11
;
660 final_type
= R_HPPA_GOTOFF_11
;
668 final_type
= base_type
;
674 final_type
= base_type
;
679 final_type
= R_HPPA_GOTOFF_R14
;
682 final_type
= R_HPPA_GOTOFF_RS14
;
685 final_type
= R_HPPA_GOTOFF_RD14
;
688 final_type
= R_HPPA_GOTOFF_RR14
;
691 final_type
= R_HPPA_GOTOFF_14
;
699 final_type
= base_type
;
705 final_type
= base_type
;
710 final_type
= R_HPPA_GOTOFF_L21
;
713 final_type
= R_HPPA_GOTOFF_LS21
;
716 final_type
= R_HPPA_GOTOFF_LD21
;
719 final_type
= R_HPPA_GOTOFF_LR21
;
728 final_type
= base_type
;
734 final_type
= base_type
;
738 final_type
= base_type
;
742 case R_HPPA_PCREL_CALL
:
747 final_type
= R_HPPA_PCREL_CALL_R11
;
750 final_type
= R_HPPA_PCREL_CALL_RS11
;
753 final_type
= R_HPPA_PCREL_CALL_RD11
;
756 final_type
= R_HPPA_PCREL_CALL_11
;
764 final_type
= base_type
;
770 final_type
= base_type
;
775 final_type
= R_HPPA_PCREL_CALL_R14
;
778 final_type
= R_HPPA_PCREL_CALL_RS14
;
781 final_type
= R_HPPA_PCREL_CALL_RD14
;
784 final_type
= R_HPPA_PCREL_CALL_RR14
;
787 final_type
= R_HPPA_PCREL_CALL_14
;
795 final_type
= base_type
;
802 final_type
= R_HPPA_PCREL_CALL_R17
;
805 final_type
= R_HPPA_PCREL_CALL_RS17
;
808 final_type
= R_HPPA_PCREL_CALL_RD17
;
811 final_type
= R_HPPA_PCREL_CALL_RR17
;
814 final_type
= R_HPPA_PCREL_CALL_17
;
822 final_type
= base_type
;
829 final_type
= R_HPPA_PCREL_CALL_L21
;
832 final_type
= R_HPPA_PCREL_CALL_LS21
;
835 final_type
= R_HPPA_PCREL_CALL_LD21
;
838 final_type
= R_HPPA_PCREL_CALL_LR21
;
847 final_type
= base_type
;
853 final_type
= base_type
;
857 final_type
= base_type
;
866 final_type
= R_HPPA_PLABEL_11
;
869 final_type
= R_HPPA_PLABEL_R11
;
873 final_type
= base_type
;
880 final_type
= R_HPPA_PLABEL_14
;
883 final_type
= R_HPPA_PLABEL_R14
;
887 final_type
= base_type
;
894 final_type
= R_HPPA_PLABEL_L21
;
898 final_type
= base_type
;
905 final_type
= R_HPPA_PLABEL_32
;
909 final_type
= base_type
;
915 final_type
= base_type
;
918 case R_HPPA_ABS_CALL
:
923 final_type
= R_HPPA_ABS_CALL_R11
;
926 final_type
= R_HPPA_ABS_CALL_RS11
;
929 final_type
= R_HPPA_ABS_CALL_RD11
;
932 final_type
= R_HPPA_ABS_CALL_11
;
940 final_type
= base_type
;
946 final_type
= base_type
;
951 final_type
= R_HPPA_ABS_CALL_R14
;
954 final_type
= R_HPPA_ABS_CALL_RS14
;
957 final_type
= R_HPPA_ABS_CALL_RD14
;
960 final_type
= R_HPPA_ABS_CALL_RR14
;
963 final_type
= R_HPPA_ABS_CALL_14
;
971 final_type
= base_type
;
978 final_type
= R_HPPA_ABS_CALL_R17
;
981 final_type
= R_HPPA_ABS_CALL_RS17
;
984 final_type
= R_HPPA_ABS_CALL_RD17
;
987 final_type
= R_HPPA_ABS_CALL_RR17
;
990 final_type
= R_HPPA_ABS_CALL_17
;
998 final_type
= base_type
;
1005 final_type
= R_HPPA_ABS_CALL_L21
;
1008 final_type
= R_HPPA_ABS_CALL_LS21
;
1011 final_type
= R_HPPA_ABS_CALL_LD21
;
1014 final_type
= R_HPPA_ABS_CALL_LR21
;
1023 final_type
= base_type
;
1029 final_type
= base_type
;
1033 final_type
= base_type
;
1038 final_type
= R_HPPA_UNWIND_ENTRY
;
1041 final_type
= base_type
;
1048 /* 12.4.4. Derive format from instruction */
1050 /* Given a machine instruction, this function determines its format. */
1051 /* The format can be determined solely from looking at the first six */
1052 /* bits (the major opcode) of the instruction. Several major opcodes */
1053 /* map to the same format. Opcodes which do not map to a known format */
1054 /* should probably be reported as an error. */
1057 hppa_elf_insn2fmt(type
, insn
)
1058 elf32_hppa_reloc_type type
;
1061 unsigned char fmt
= 0; /* XXX: is this a proper default? */
1062 unsigned char op
= get_opcode(insn
);
1064 if ( type
== R_HPPA_NONE
)
1116 /* this function is in charge of performing all the HP PA relocations */
1117 long global_value
= 0;
1118 long GOT_value
= 0; /* XXX: need to calculate this! For HPUX, GOT == DP */
1119 asymbol
*global_symbol
= (asymbol
*)NULL
;
1121 static bfd_reloc_status_type
1122 DEFUN(hppa_elf_reloc
,(abfd
, reloc_entry
, symbol_in
, data
, input_section
, output_bfd
),
1124 arelent
*reloc_entry AND
1125 asymbol
*symbol_in AND
1127 asection
*input_section AND
1132 unsigned long unsigned_value
;
1135 unsigned long addr
= reloc_entry
->address
; /*+ input_section->vma*/
1136 bfd_byte
*hit_data
= addr
+ (bfd_byte
*)(data
);
1137 unsigned short r_type
= reloc_entry
->howto
->type
& 0xFF;
1138 unsigned short r_field
= e_fsel
;
1139 boolean r_pcrel
= reloc_entry
->howto
->pc_relative
;
1141 /* howto->bitsize contains the format (11, 14, 21, etc) information */
1142 unsigned r_format
= reloc_entry
->howto
->bitsize
;
1143 long r_addend
= reloc_entry
->addend
;
1147 /* Partial linking - do nothing */
1148 reloc_entry
->address
+= input_section
->output_offset
;
1149 return bfd_reloc_ok
;
1152 if ( symbol_in
&& symbol_in
->section
== &bfd_und_section
)
1153 return bfd_reloc_undefined
;
1155 sym_value
= get_symbol_value(symbol_in
);
1157 /* compute value of $global$ if it is there. */
1159 if ( global_symbol
== (asymbol
*)NULL
) {
1160 struct elf_backend_data
* bed
1161 = (struct elf_backend_data
*)abfd
->xvec
->backend_data
;
1163 if ( bed
&& bed
->global_sym
) {
1164 asymbol
*gsym
= &bed
->global_sym
->symbol
;
1167 + gsym
->section
->output_section
->vma
1168 + gsym
->section
->output_offset
;
1169 GOT_value
= global_value
; /* XXX: For HP-UX, GOT==DP */
1170 global_symbol
= gsym
;
1174 /* get the instruction word */
1175 insn
= bfd_get_32(abfd
, hit_data
);
1177 /* relocate the value based on the relocation type */
1179 /* basic_type_1: relocation is relative to $global$ */
1180 /* basic_type_2: relocation is relative to the current GOT */
1181 /* basic_type_3: relocation is an absolute call */
1182 /* basic_type_4: relocation is an PC-relative call */
1183 /* basic_type_5: relocation is plabel reference */
1184 /* basic_type_6: relocation is an unwind table relocation */
1185 /* extended_type: unimplemented */
1190 case R_HPPA_32
: /* Symbol + Addend 32 */
1193 goto do_basic_type_1
;
1194 case R_HPPA_L21
: /* L (Symbol, Addend) 21 */
1196 goto do_basic_type_1
;
1197 case R_HPPA_R11
: /* R (Symbol, Addend) 11 */
1199 goto do_basic_type_1
;
1200 case R_HPPA_R14
: /* R (Symbol, Addend) 14 */
1202 goto do_basic_type_1
;
1203 case R_HPPA_R17
: /* R (Symbol, Addend) 17 */
1205 goto do_basic_type_1
;
1206 case R_HPPA_LS21
: /* LS(Symbol, Addend) 21 */
1208 goto do_basic_type_1
;
1209 case R_HPPA_RS11
: /* RS(Symbol, Addend) 11 */
1211 goto do_basic_type_1
;
1212 case R_HPPA_RS14
: /* RS(Symbol, Addend) 14 */
1214 goto do_basic_type_1
;
1215 case R_HPPA_RS17
: /* RS(Symbol, Addend) 17 */
1217 goto do_basic_type_1
;
1218 case R_HPPA_LD21
: /* LD(Symbol, Addend) 21 */
1220 goto do_basic_type_1
;
1221 case R_HPPA_RD11
: /* RD(Symbol, Addend) 11 */
1223 goto do_basic_type_1
;
1224 case R_HPPA_RD14
: /* RD(Symbol, Addend) 14 */
1226 goto do_basic_type_1
;
1227 case R_HPPA_RD17
: /* RD(Symbol, Addend) 17 */
1229 goto do_basic_type_1
;
1230 case R_HPPA_LR21
: /* LR(Symbol, Addend) 21 */
1232 goto do_basic_type_1
;
1233 case R_HPPA_RR14
: /* RR(Symbol, Addend) 14 */
1235 goto do_basic_type_1
;
1236 case R_HPPA_RR17
: /* RR(Symbol, Addend) 17 */
1240 insn
= hppa_elf_relocate_insn(abfd
, input_section
, insn
, addr
,
1241 symbol_in
, sym_value
, r_addend
,
1242 r_type
, r_format
, r_field
, r_pcrel
);
1245 case R_HPPA_GOTOFF_11
: /* Symbol - GOT + Addend 11 */
1247 goto do_basic_type_2
;
1248 case R_HPPA_GOTOFF_14
: /* Symbol - GOT + Addend 14 */
1250 goto do_basic_type_2
;
1251 case R_HPPA_GOTOFF_L21
: /* L (Sym - GOT, Addend) 21 */
1253 goto do_basic_type_2
;
1254 case R_HPPA_GOTOFF_R11
: /* R (Sym - GOT, Addend) 11 */
1256 goto do_basic_type_2
;
1257 case R_HPPA_GOTOFF_R14
: /* R (Sym - GOT, Addend) 14 */
1259 goto do_basic_type_2
;
1260 case R_HPPA_GOTOFF_LS21
: /* LS(Sym - GOT, Addend) 21 */
1262 goto do_basic_type_2
;
1263 case R_HPPA_GOTOFF_RS11
: /* RS(Sym - GOT, Addend) 11 */
1265 goto do_basic_type_2
;
1266 case R_HPPA_GOTOFF_RS14
: /* RS(Sym - GOT, Addend) 14 */
1268 goto do_basic_type_2
;
1269 case R_HPPA_GOTOFF_LD21
: /* LD(Sym - GOT, Addend) 21 */
1271 goto do_basic_type_2
;
1272 case R_HPPA_GOTOFF_RD11
: /* RD(Sym - GOT, Addend) 11 */
1274 goto do_basic_type_2
;
1275 case R_HPPA_GOTOFF_RD14
: /* RD(Sym - GOT, Addend) 14 */
1277 goto do_basic_type_2
;
1278 case R_HPPA_GOTOFF_LR21
: /* LR(Sym - GOT, Addend) 21 */
1280 goto do_basic_type_2
;
1281 case R_HPPA_GOTOFF_RR14
: /* RR(Sym - GOT, Addend) 14 */
1284 sym_value
-= GOT_value
;
1285 insn
= hppa_elf_relocate_insn(abfd
, input_section
, insn
, addr
,
1286 symbol_in
, sym_value
, r_addend
,
1287 r_type
, r_format
, r_field
, r_pcrel
);
1290 case R_HPPA_ABS_CALL_11
: /* Symbol + Addend 11 */
1292 goto do_basic_type_3
;
1293 case R_HPPA_ABS_CALL_14
: /* Symbol + Addend 14 */
1295 goto do_basic_type_3
;
1296 case R_HPPA_ABS_CALL_17
: /* Symbol + Addend 17 */
1298 goto do_basic_type_3
;
1299 case R_HPPA_ABS_CALL_L21
: /* L (Symbol, Addend) 21 */
1301 goto do_basic_type_3
;
1302 case R_HPPA_ABS_CALL_R11
: /* R (Symbol, Addend) 11 */
1304 goto do_basic_type_3
;
1305 case R_HPPA_ABS_CALL_R14
: /* R (Symbol, Addend) 14 */
1307 goto do_basic_type_3
;
1308 case R_HPPA_ABS_CALL_R17
: /* R (Symbol, Addend) 17 */
1310 goto do_basic_type_3
;
1311 case R_HPPA_ABS_CALL_LS21
: /* LS(Symbol, Addend) 21 */
1313 goto do_basic_type_3
;
1314 case R_HPPA_ABS_CALL_RS11
: /* RS(Symbol, Addend) 11 */
1316 goto do_basic_type_3
;
1317 case R_HPPA_ABS_CALL_RS14
: /* RS(Symbol, Addend) 14 */
1319 goto do_basic_type_3
;
1320 case R_HPPA_ABS_CALL_RS17
: /* RS(Symbol, Addend) 17 */
1322 goto do_basic_type_3
;
1323 case R_HPPA_ABS_CALL_LD21
: /* LD(Symbol, Addend) 21 */
1325 goto do_basic_type_3
;
1326 case R_HPPA_ABS_CALL_RD11
: /* RD(Symbol, Addend) 11 */
1328 goto do_basic_type_3
;
1329 case R_HPPA_ABS_CALL_RD14
: /* RD(Symbol, Addend) 14 */
1331 goto do_basic_type_3
;
1332 case R_HPPA_ABS_CALL_RD17
: /* RD(Symbol, Addend) 17 */
1334 goto do_basic_type_3
;
1335 case R_HPPA_ABS_CALL_LR21
: /* LR(Symbol, Addend) 21 */
1337 goto do_basic_type_3
;
1338 case R_HPPA_ABS_CALL_RR14
: /* RR(Symbol, Addend) 14 */
1340 goto do_basic_type_3
;
1341 case R_HPPA_ABS_CALL_RR17
: /* RR(Symbol, Addend) 17 */
1344 insn
= hppa_elf_relocate_insn(abfd
, input_section
, insn
, addr
,
1345 symbol_in
, sym_value
, r_addend
,
1346 r_type
, r_format
, r_field
, r_pcrel
);
1349 case R_HPPA_PCREL_CALL_11
: /* Symbol - PC + Addend 11 */
1351 goto do_basic_type_4
;
1352 case R_HPPA_PCREL_CALL_14
: /* Symbol - PC + Addend 14 */
1354 goto do_basic_type_4
;
1355 case R_HPPA_PCREL_CALL_17
: /* Symbol - PC + Addend 17 */
1357 goto do_basic_type_4
;
1358 case R_HPPA_PCREL_CALL_L21
: /* L (Symbol - PC, Addend) 21 */
1360 goto do_basic_type_4
;
1361 case R_HPPA_PCREL_CALL_R11
: /* R (Symbol - PC, Addend) 11 */
1363 goto do_basic_type_4
;
1364 case R_HPPA_PCREL_CALL_R14
: /* R (Symbol - PC, Addend) 14 */
1366 goto do_basic_type_4
;
1367 case R_HPPA_PCREL_CALL_R17
: /* R (Symbol - PC, Addend) 17 */
1369 goto do_basic_type_4
;
1370 case R_HPPA_PCREL_CALL_LS21
: /* LS(Symbol - PC, Addend) 21 */
1372 goto do_basic_type_4
;
1373 case R_HPPA_PCREL_CALL_RS11
: /* RS(Symbol - PC, Addend) 11 */
1375 goto do_basic_type_4
;
1376 case R_HPPA_PCREL_CALL_RS14
: /* RS(Symbol - PC, Addend) 14 */
1378 goto do_basic_type_4
;
1379 case R_HPPA_PCREL_CALL_RS17
: /* RS(Symbol - PC, Addend) 17 */
1381 goto do_basic_type_4
;
1382 case R_HPPA_PCREL_CALL_LD21
: /* LD(Symbol - PC, Addend) 21 */
1384 goto do_basic_type_4
;
1385 case R_HPPA_PCREL_CALL_RD11
: /* RD(Symbol - PC, Addend) 11 */
1387 goto do_basic_type_4
;
1388 case R_HPPA_PCREL_CALL_RD14
: /* RD(Symbol - PC, Addend) 14 */
1390 goto do_basic_type_4
;
1391 case R_HPPA_PCREL_CALL_RD17
: /* RD(Symbol - PC, Addend) 17 */
1393 goto do_basic_type_4
;
1394 case R_HPPA_PCREL_CALL_LR21
: /* LR(Symbol - PC, Addend) 21 */
1396 goto do_basic_type_4
;
1397 case R_HPPA_PCREL_CALL_RR14
: /* RR(Symbol - PC, Addend) 14 */
1399 goto do_basic_type_4
;
1400 case R_HPPA_PCREL_CALL_RR17
: /* RR(Symbol - PC, Addend) 17 */ /* #69 */
1403 insn
= hppa_elf_relocate_insn(abfd
, input_section
, insn
, addr
,
1404 symbol_in
, sym_value
, r_addend
,
1405 r_type
, r_format
, r_field
, r_pcrel
);
1408 case R_HPPA_PLABEL_32
:
1409 case R_HPPA_PLABEL_11
:
1410 case R_HPPA_PLABEL_14
:
1412 goto do_basic_type_5
;
1413 case R_HPPA_PLABEL_L21
:
1415 goto do_basic_type_5
;
1416 case R_HPPA_PLABEL_R11
:
1417 case R_HPPA_PLABEL_R14
:
1420 insn
= hppa_elf_relocate_insn(abfd
, input_section
, insn
, addr
,
1421 symbol_in
, sym_value
, r_addend
,
1422 r_type
, r_format
, r_field
, r_pcrel
);
1425 case R_HPPA_UNWIND_ENTRY
:
1426 case R_HPPA_UNWIND_ENTRIES
:
1427 hppa_elf_relocate_unwind_table(abfd
, input_section
, data
, addr
,
1428 symbol_in
, sym_value
, r_addend
,
1429 r_type
, r_format
, r_field
, r_pcrel
);
1430 return (bfd_reloc_ok
);
1432 case R_HPPA_PUSH_CONST
: /* push Addend - - */
1433 case R_HPPA_PUSH_SYM
: /* push Symbol - - */
1434 case R_HPPA_PUSH_GOT
: /* push GOT - - */
1435 case R_HPPA_PUSH_PC
: /* push PC - - */
1436 case R_HPPA_PUSH_PROC
: /* push Symbol - - */
1437 case R_HPPA_PUSH_PLABEL
: /* [TBD] - - */
1438 case R_HPPA_MAX
: /* pop A and B, push max(B,A) - - */
1439 case R_HPPA_MIN
: /* pop A and B, push min(B,A) - - */
1440 case R_HPPA_ADD
: /* pop A and B, push B + A - - */
1441 case R_HPPA_SUB
: /* pop A and B, push B - A - - */
1442 case R_HPPA_MULT
: /* pop A and B, push B * A - - */
1443 case R_HPPA_DIV
: /* pop A and B, push B / A - - */
1444 case R_HPPA_MOD
: /* pop A and B, push B % A - - */
1445 case R_HPPA_AND
: /* pop A and B, push B & A - - */
1446 case R_HPPA_OR
: /* pop A and B, push B | A - - */
1447 case R_HPPA_XOR
: /* pop A and B, push B ^ A - - */
1448 case R_HPPA_NOT
: /* pop A, push ~A - - */
1449 case R_HPPA_LSHIFT
: /* pop A, push A << Addend - - */
1450 case R_HPPA_ARITH_RSHIFT
: /* pop A, push A >> Addend - - */
1451 case R_HPPA_LOGIC_RSHIFT
: /* pop A, push A >> Addend - - */
1452 case R_HPPA_EXPR_F
: /* pop A, push A + Addend L - */
1453 case R_HPPA_EXPR_L
: /* pop A, push L(A,Addend) L - */
1454 case R_HPPA_EXPR_R
: /* pop A, push R(A,Addend) R - */
1455 case R_HPPA_EXPR_LS
: /* pop A, push LS(A,Addend) LS - */
1456 case R_HPPA_EXPR_RS
: /* pop A, push RS(A,Addend) RS - */
1457 case R_HPPA_EXPR_LD
: /* pop A, push LD(A,Addend) LD - */
1458 case R_HPPA_EXPR_RD
: /* pop A, push RD(A,Addend) RD - */
1459 case R_HPPA_EXPR_LR
: /* pop A, push LR(A,Addend) LR - */
1460 case R_HPPA_EXPR_RR
: /* pop A, push RR(A,Addend) RR - */
1462 case R_HPPA_EXPR_32
: /* pop - 32 */
1463 case R_HPPA_EXPR_21
: /* pop - 21 */
1464 case R_HPPA_EXPR_11
: /* pop - 11 */
1465 case R_HPPA_EXPR_14
: /* pop - 14 */
1466 case R_HPPA_EXPR_17
: /* pop - 17 */
1467 case R_HPPA_EXPR_12
: /* pop - 12 */
1468 fprintf(stderr
, "Relocation problem: ");
1469 fprintf(stderr
,"Unimplemented reloc type %d, in module %s\n",
1470 r_type
,abfd
->filename
);
1471 return(bfd_reloc_notsupported
);
1473 fprintf(stderr
,"Relocation problem : ");
1474 fprintf(stderr
,"Unrecognized reloc type %d, in module %s\n",
1475 r_type
,abfd
->filename
);
1476 return (bfd_reloc_dangerous
);
1479 /* update the instruction word */
1480 bfd_put_32(abfd
, insn
,hit_data
);
1482 return (bfd_reloc_ok
);
1486 static reloc_howto_type
*
1487 elf_hppa_reloc_type_lookup (arch
, code
)
1488 bfd_arch_info_type
*arch
;
1489 bfd_reloc_code_real_type code
;
1491 if (code
< R_HPPA_UNIMPLEMENTED
)
1492 return &elf_hppa_howto_table
[code
];
1494 return (reloc_howto_type
*)0;
1496 #define elf_bfd_reloc_type_lookup elf_hppa_reloc_type_lookup
1499 DEFUN (elf_info_to_howto
, (abfd
, cache_ptr
, dst
),
1501 arelent
*cache_ptr AND
1502 Elf_Internal_Rela
*dst
)
1507 #define TARGET_BIG_SYM elf32_hppa_vec
1508 #define TARGET_BIG_NAME "elf32-hppa"
1509 #define ELF_ARCH bfd_arch_hppa
1511 #include "elf32-target.h"