elf32-tic6x.c revision 1.1 1 1.1 christos /* 32-bit ELF support for TI C6X
2 1.1 christos Copyright 2010
3 1.1 christos Free Software Foundation, Inc.
4 1.1 christos Contributed by Joseph Myers <joseph (at) codesourcery.com>
5 1.1 christos Bernd Schmidt <bernds (at) codesourcery.com>
6 1.1 christos
7 1.1 christos This file is part of BFD, the Binary File Descriptor library.
8 1.1 christos
9 1.1 christos This program is free software; you can redistribute it and/or modify
10 1.1 christos it under the terms of the GNU General Public License as published by
11 1.1 christos the Free Software Foundation; either version 3 of the License, or
12 1.1 christos (at your option) any later version.
13 1.1 christos
14 1.1 christos This program is distributed in the hope that it will be useful,
15 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of
16 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 1.1 christos GNU General Public License for more details.
18 1.1 christos
19 1.1 christos You should have received a copy of the GNU General Public License
20 1.1 christos along with this program; if not, write to the Free Software
21 1.1 christos Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
22 1.1 christos MA 02110-1301, USA. */
23 1.1 christos
24 1.1 christos #include "sysdep.h"
25 1.1 christos #include "bfd.h"
26 1.1 christos #include "libbfd.h"
27 1.1 christos #include "libiberty.h"
28 1.1 christos #include "elf-bfd.h"
29 1.1 christos #include "elf/tic6x.h"
30 1.1 christos #include "elf32-tic6x.h"
31 1.1 christos
32 1.1 christos struct elf32_tic6x_obj_tdata
33 1.1 christos {
34 1.1 christos struct elf_obj_tdata root;
35 1.1 christos
36 1.1 christos /* Whether to use RELA relocations when generating relocations.
37 1.1 christos This is a per-object flag to allow the assembler to generate REL
38 1.1 christos relocations for use in linker testcases. */
39 1.1 christos bfd_boolean use_rela_p;
40 1.1 christos };
41 1.1 christos
42 1.1 christos #define elf32_tic6x_tdata(abfd) \
43 1.1 christos ((struct elf32_tic6x_obj_tdata *) (abfd)->tdata.any)
44 1.1 christos
45 1.1 christos static reloc_howto_type elf32_tic6x_howto_table[] =
46 1.1 christos {
47 1.1 christos HOWTO (R_C6000_NONE, /* type */
48 1.1 christos 0, /* rightshift */
49 1.1 christos 0, /* size (0 = byte, 1 = short, 2 = long) */
50 1.1 christos 0, /* bitsize */
51 1.1 christos FALSE, /* pc_relative */
52 1.1 christos 0, /* bitpos */
53 1.1 christos complain_overflow_dont,/* complain_on_overflow */
54 1.1 christos bfd_elf_generic_reloc, /* special_function */
55 1.1 christos "R_C6000_NONE", /* name */
56 1.1 christos FALSE, /* partial_inplace */
57 1.1 christos 0, /* src_mask */
58 1.1 christos 0, /* dst_mask */
59 1.1 christos FALSE), /* pcrel_offset */
60 1.1 christos HOWTO (R_C6000_ABS32, /* type */
61 1.1 christos 0, /* rightshift */
62 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
63 1.1 christos 32, /* bitsize */
64 1.1 christos FALSE, /* pc_relative */
65 1.1 christos 0, /* bitpos */
66 1.1 christos complain_overflow_dont,/* complain_on_overflow */
67 1.1 christos bfd_elf_generic_reloc, /* special_function */
68 1.1 christos "R_C6000_ABS32", /* name */
69 1.1 christos FALSE, /* partial_inplace */
70 1.1 christos 0, /* src_mask */
71 1.1 christos 0xffffffff, /* dst_mask */
72 1.1 christos FALSE), /* pcrel_offset */
73 1.1 christos HOWTO (R_C6000_ABS16, /* type */
74 1.1 christos 0, /* rightshift */
75 1.1 christos 1, /* size (0 = byte, 1 = short, 2 = long) */
76 1.1 christos 16, /* bitsize */
77 1.1 christos FALSE, /* pc_relative */
78 1.1 christos 0, /* bitpos */
79 1.1 christos complain_overflow_bitfield,/* complain_on_overflow */
80 1.1 christos bfd_elf_generic_reloc, /* special_function */
81 1.1 christos "R_C6000_ABS16", /* name */
82 1.1 christos FALSE, /* partial_inplace */
83 1.1 christos 0, /* src_mask */
84 1.1 christos 0x0000ffff, /* dst_mask */
85 1.1 christos FALSE), /* pcrel_offset */
86 1.1 christos HOWTO (R_C6000_ABS8, /* type */
87 1.1 christos 0, /* rightshift */
88 1.1 christos 0, /* size (0 = byte, 1 = short, 2 = long) */
89 1.1 christos 8, /* bitsize */
90 1.1 christos FALSE, /* pc_relative */
91 1.1 christos 0, /* bitpos */
92 1.1 christos complain_overflow_bitfield,/* complain_on_overflow */
93 1.1 christos bfd_elf_generic_reloc, /* special_function */
94 1.1 christos "R_C6000_ABS8", /* name */
95 1.1 christos FALSE, /* partial_inplace */
96 1.1 christos 0, /* src_mask */
97 1.1 christos 0x000000ff, /* dst_mask */
98 1.1 christos FALSE), /* pcrel_offset */
99 1.1 christos HOWTO (R_C6000_PCR_S21, /* type */
100 1.1 christos 2, /* rightshift */
101 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
102 1.1 christos 21, /* bitsize */
103 1.1 christos TRUE, /* pc_relative */
104 1.1 christos 7, /* bitpos */
105 1.1 christos complain_overflow_signed,/* complain_on_overflow */
106 1.1 christos bfd_elf_generic_reloc, /* special_function */
107 1.1 christos "R_C6000_PCR_S21", /* name */
108 1.1 christos FALSE, /* partial_inplace */
109 1.1 christos 0, /* src_mask */
110 1.1 christos 0x0fffff80, /* dst_mask */
111 1.1 christos TRUE), /* pcrel_offset */
112 1.1 christos HOWTO (R_C6000_PCR_S12, /* type */
113 1.1 christos 2, /* rightshift */
114 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
115 1.1 christos 12, /* bitsize */
116 1.1 christos TRUE, /* pc_relative */
117 1.1 christos 16, /* bitpos */
118 1.1 christos complain_overflow_signed,/* complain_on_overflow */
119 1.1 christos bfd_elf_generic_reloc, /* special_function */
120 1.1 christos "R_C6000_PCR_S12", /* name */
121 1.1 christos FALSE, /* partial_inplace */
122 1.1 christos 0, /* src_mask */
123 1.1 christos 0x0fff0000, /* dst_mask */
124 1.1 christos TRUE), /* pcrel_offset */
125 1.1 christos HOWTO (R_C6000_PCR_S10, /* type */
126 1.1 christos 2, /* rightshift */
127 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
128 1.1 christos 10, /* bitsize */
129 1.1 christos TRUE, /* pc_relative */
130 1.1 christos 13, /* bitpos */
131 1.1 christos complain_overflow_signed,/* complain_on_overflow */
132 1.1 christos bfd_elf_generic_reloc, /* special_function */
133 1.1 christos "R_C6000_PCR_S10", /* name */
134 1.1 christos FALSE, /* partial_inplace */
135 1.1 christos 0, /* src_mask */
136 1.1 christos 0x007fe000, /* dst_mask */
137 1.1 christos TRUE), /* pcrel_offset */
138 1.1 christos HOWTO (R_C6000_PCR_S7, /* type */
139 1.1 christos 2, /* rightshift */
140 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
141 1.1 christos 7, /* bitsize */
142 1.1 christos TRUE, /* pc_relative */
143 1.1 christos 16, /* bitpos */
144 1.1 christos complain_overflow_signed,/* complain_on_overflow */
145 1.1 christos bfd_elf_generic_reloc, /* special_function */
146 1.1 christos "R_C6000_PCR_S7", /* name */
147 1.1 christos FALSE, /* partial_inplace */
148 1.1 christos 0, /* src_mask */
149 1.1 christos 0x007f0000, /* dst_mask */
150 1.1 christos TRUE), /* pcrel_offset */
151 1.1 christos HOWTO (R_C6000_ABS_S16, /* type */
152 1.1 christos 0, /* rightshift */
153 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
154 1.1 christos 16, /* bitsize */
155 1.1 christos FALSE, /* pc_relative */
156 1.1 christos 7, /* bitpos */
157 1.1 christos complain_overflow_signed,/* complain_on_overflow */
158 1.1 christos bfd_elf_generic_reloc, /* special_function */
159 1.1 christos "R_C6000_ABS_S16", /* name */
160 1.1 christos FALSE, /* partial_inplace */
161 1.1 christos 0, /* src_mask */
162 1.1 christos 0x007fff80, /* dst_mask */
163 1.1 christos FALSE), /* pcrel_offset */
164 1.1 christos HOWTO (R_C6000_ABS_L16, /* type */
165 1.1 christos 0, /* rightshift */
166 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
167 1.1 christos 16, /* bitsize */
168 1.1 christos FALSE, /* pc_relative */
169 1.1 christos 7, /* bitpos */
170 1.1 christos complain_overflow_dont,/* complain_on_overflow */
171 1.1 christos bfd_elf_generic_reloc, /* special_function */
172 1.1 christos "R_C6000_ABS_L16", /* name */
173 1.1 christos FALSE, /* partial_inplace */
174 1.1 christos 0, /* src_mask */
175 1.1 christos 0x007fff80, /* dst_mask */
176 1.1 christos FALSE), /* pcrel_offset */
177 1.1 christos HOWTO (R_C6000_ABS_H16, /* type */
178 1.1 christos 16, /* rightshift */
179 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
180 1.1 christos 16, /* bitsize */
181 1.1 christos FALSE, /* pc_relative */
182 1.1 christos 7, /* bitpos */
183 1.1 christos complain_overflow_dont,/* complain_on_overflow */
184 1.1 christos bfd_elf_generic_reloc, /* special_function */
185 1.1 christos "R_C6000_ABS_H16", /* name */
186 1.1 christos FALSE, /* partial_inplace */
187 1.1 christos 0, /* src_mask */
188 1.1 christos 0x007fff80, /* dst_mask */
189 1.1 christos FALSE), /* pcrel_offset */
190 1.1 christos HOWTO (R_C6000_SBR_U15_B, /* type */
191 1.1 christos 0, /* rightshift */
192 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
193 1.1 christos 15, /* bitsize */
194 1.1 christos FALSE, /* pc_relative */
195 1.1 christos 8, /* bitpos */
196 1.1 christos complain_overflow_unsigned,/* complain_on_overflow */
197 1.1 christos bfd_elf_generic_reloc, /* special_function */
198 1.1 christos "R_C6000_SBR_U15_B", /* name */
199 1.1 christos FALSE, /* partial_inplace */
200 1.1 christos 0, /* src_mask */
201 1.1 christos 0x007fff00, /* dst_mask */
202 1.1 christos FALSE), /* pcrel_offset */
203 1.1 christos HOWTO (R_C6000_SBR_U15_H, /* type */
204 1.1 christos 1, /* rightshift */
205 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
206 1.1 christos 15, /* bitsize */
207 1.1 christos FALSE, /* pc_relative */
208 1.1 christos 8, /* bitpos */
209 1.1 christos complain_overflow_unsigned,/* complain_on_overflow */
210 1.1 christos bfd_elf_generic_reloc, /* special_function */
211 1.1 christos "R_C6000_SBR_U15_H", /* name */
212 1.1 christos FALSE, /* partial_inplace */
213 1.1 christos 0, /* src_mask */
214 1.1 christos 0x007fff00, /* dst_mask */
215 1.1 christos FALSE), /* pcrel_offset */
216 1.1 christos HOWTO (R_C6000_SBR_U15_W, /* type */
217 1.1 christos 2, /* rightshift */
218 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
219 1.1 christos 15, /* bitsize */
220 1.1 christos FALSE, /* pc_relative */
221 1.1 christos 8, /* bitpos */
222 1.1 christos complain_overflow_unsigned,/* complain_on_overflow */
223 1.1 christos bfd_elf_generic_reloc, /* special_function */
224 1.1 christos "R_C6000_SBR_U15_W", /* name */
225 1.1 christos FALSE, /* partial_inplace */
226 1.1 christos 0, /* src_mask */
227 1.1 christos 0x007fff00, /* dst_mask */
228 1.1 christos FALSE), /* pcrel_offset */
229 1.1 christos HOWTO (R_C6000_SBR_S16, /* type */
230 1.1 christos 0, /* rightshift */
231 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
232 1.1 christos 16, /* bitsize */
233 1.1 christos FALSE, /* pc_relative */
234 1.1 christos 7, /* bitpos */
235 1.1 christos complain_overflow_signed,/* complain_on_overflow */
236 1.1 christos bfd_elf_generic_reloc, /* special_function */
237 1.1 christos "R_C6000_SBR_S16", /* name */
238 1.1 christos FALSE, /* partial_inplace */
239 1.1 christos 0, /* src_mask */
240 1.1 christos 0x007fff80, /* dst_mask */
241 1.1 christos FALSE), /* pcrel_offset */
242 1.1 christos HOWTO (R_C6000_SBR_L16_B, /* type */
243 1.1 christos 0, /* rightshift */
244 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
245 1.1 christos 16, /* bitsize */
246 1.1 christos FALSE, /* pc_relative */
247 1.1 christos 7, /* bitpos */
248 1.1 christos complain_overflow_dont,/* complain_on_overflow */
249 1.1 christos bfd_elf_generic_reloc, /* special_function */
250 1.1 christos "R_C6000_SBR_L16_B", /* name */
251 1.1 christos FALSE, /* partial_inplace */
252 1.1 christos 0, /* src_mask */
253 1.1 christos 0x007fff80, /* dst_mask */
254 1.1 christos FALSE), /* pcrel_offset */
255 1.1 christos HOWTO (R_C6000_SBR_L16_H, /* type */
256 1.1 christos 1, /* rightshift */
257 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
258 1.1 christos 16, /* bitsize */
259 1.1 christos FALSE, /* pc_relative */
260 1.1 christos 7, /* bitpos */
261 1.1 christos complain_overflow_dont,/* complain_on_overflow */
262 1.1 christos bfd_elf_generic_reloc, /* special_function */
263 1.1 christos "R_C6000_SBR_L16_H", /* name */
264 1.1 christos FALSE, /* partial_inplace */
265 1.1 christos 0, /* src_mask */
266 1.1 christos 0x007fff80, /* dst_mask */
267 1.1 christos FALSE), /* pcrel_offset */
268 1.1 christos HOWTO (R_C6000_SBR_L16_W, /* type */
269 1.1 christos 2, /* rightshift */
270 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
271 1.1 christos 16, /* bitsize */
272 1.1 christos FALSE, /* pc_relative */
273 1.1 christos 7, /* bitpos */
274 1.1 christos complain_overflow_dont,/* complain_on_overflow */
275 1.1 christos bfd_elf_generic_reloc, /* special_function */
276 1.1 christos "R_C6000_SBR_L16_W", /* name */
277 1.1 christos FALSE, /* partial_inplace */
278 1.1 christos 0, /* src_mask */
279 1.1 christos 0x007fff80, /* dst_mask */
280 1.1 christos FALSE), /* pcrel_offset */
281 1.1 christos HOWTO (R_C6000_SBR_H16_B, /* type */
282 1.1 christos 16, /* rightshift */
283 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
284 1.1 christos 16, /* bitsize */
285 1.1 christos FALSE, /* pc_relative */
286 1.1 christos 7, /* bitpos */
287 1.1 christos complain_overflow_dont,/* complain_on_overflow */
288 1.1 christos bfd_elf_generic_reloc, /* special_function */
289 1.1 christos "R_C6000_SBR_H16_B", /* name */
290 1.1 christos FALSE, /* partial_inplace */
291 1.1 christos 0, /* src_mask */
292 1.1 christos 0x007fff80, /* dst_mask */
293 1.1 christos FALSE), /* pcrel_offset */
294 1.1 christos HOWTO (R_C6000_SBR_H16_H, /* type */
295 1.1 christos 17, /* rightshift */
296 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
297 1.1 christos 16, /* bitsize */
298 1.1 christos FALSE, /* pc_relative */
299 1.1 christos 7, /* bitpos */
300 1.1 christos complain_overflow_dont,/* complain_on_overflow */
301 1.1 christos bfd_elf_generic_reloc, /* special_function */
302 1.1 christos "R_C6000_SBR_H16_H", /* name */
303 1.1 christos FALSE, /* partial_inplace */
304 1.1 christos 0, /* src_mask */
305 1.1 christos 0x007fff80, /* dst_mask */
306 1.1 christos FALSE), /* pcrel_offset */
307 1.1 christos HOWTO (R_C6000_SBR_H16_W, /* type */
308 1.1 christos 18, /* rightshift */
309 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
310 1.1 christos 16, /* bitsize */
311 1.1 christos FALSE, /* pc_relative */
312 1.1 christos 7, /* bitpos */
313 1.1 christos complain_overflow_dont,/* complain_on_overflow */
314 1.1 christos bfd_elf_generic_reloc, /* special_function */
315 1.1 christos "R_C6000_SBR_H16_W", /* name */
316 1.1 christos FALSE, /* partial_inplace */
317 1.1 christos 0, /* src_mask */
318 1.1 christos 0x007fff80, /* dst_mask */
319 1.1 christos FALSE), /* pcrel_offset */
320 1.1 christos HOWTO (R_C6000_SBR_GOT_U15_W, /* type */
321 1.1 christos 2, /* rightshift */
322 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
323 1.1 christos 15, /* bitsize */
324 1.1 christos FALSE, /* pc_relative */
325 1.1 christos 8, /* bitpos */
326 1.1 christos complain_overflow_unsigned,/* complain_on_overflow */
327 1.1 christos bfd_elf_generic_reloc, /* special_function */
328 1.1 christos "R_C6000_SBR_GOT_U15_W",/* name */
329 1.1 christos FALSE, /* partial_inplace */
330 1.1 christos 0, /* src_mask */
331 1.1 christos 0x007fff00, /* dst_mask */
332 1.1 christos FALSE), /* pcrel_offset */
333 1.1 christos HOWTO (R_C6000_SBR_GOT_L16_W, /* type */
334 1.1 christos 2, /* rightshift */
335 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
336 1.1 christos 16, /* bitsize */
337 1.1 christos FALSE, /* pc_relative */
338 1.1 christos 7, /* bitpos */
339 1.1 christos complain_overflow_dont,/* complain_on_overflow */
340 1.1 christos bfd_elf_generic_reloc, /* special_function */
341 1.1 christos "R_C6000_SBR_GOT_L16_W",/* name */
342 1.1 christos FALSE, /* partial_inplace */
343 1.1 christos 0, /* src_mask */
344 1.1 christos 0x007fff80, /* dst_mask */
345 1.1 christos FALSE), /* pcrel_offset */
346 1.1 christos HOWTO (R_C6000_SBR_GOT_H16_W, /* type */
347 1.1 christos 18, /* rightshift */
348 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
349 1.1 christos 16, /* bitsize */
350 1.1 christos FALSE, /* pc_relative */
351 1.1 christos 7, /* bitpos */
352 1.1 christos complain_overflow_dont,/* complain_on_overflow */
353 1.1 christos bfd_elf_generic_reloc, /* special_function */
354 1.1 christos "R_C6000_SBR_GOT_H16_W",/* name */
355 1.1 christos FALSE, /* partial_inplace */
356 1.1 christos 0, /* src_mask */
357 1.1 christos 0x007fff80, /* dst_mask */
358 1.1 christos FALSE), /* pcrel_offset */
359 1.1 christos HOWTO (R_C6000_DSBT_INDEX, /* type */
360 1.1 christos 0, /* rightshift */
361 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
362 1.1 christos 15, /* bitsize */
363 1.1 christos FALSE, /* pc_relative */
364 1.1 christos 8, /* bitpos */
365 1.1 christos complain_overflow_unsigned,/* complain_on_overflow */
366 1.1 christos bfd_elf_generic_reloc, /* special_function */
367 1.1 christos "R_C6000_DSBT_INDEX", /* name */
368 1.1 christos FALSE, /* partial_inplace */
369 1.1 christos 0, /* src_mask */
370 1.1 christos 0x007fff00, /* dst_mask */
371 1.1 christos FALSE), /* pcrel_offset */
372 1.1 christos HOWTO (R_C6000_PREL31, /* type */
373 1.1 christos 1, /* rightshift */
374 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
375 1.1 christos 31, /* bitsize */
376 1.1 christos FALSE, /* pc_relative */
377 1.1 christos 0, /* bitpos */
378 1.1 christos complain_overflow_dont,/* complain_on_overflow */
379 1.1 christos bfd_elf_generic_reloc, /* special_function */
380 1.1 christos "R_C6000_PREL31", /* name */
381 1.1 christos FALSE, /* partial_inplace */
382 1.1 christos 0, /* src_mask */
383 1.1 christos 0x7fffffff, /* dst_mask */
384 1.1 christos FALSE), /* pcrel_offset */
385 1.1 christos HOWTO (R_C6000_COPY, /* type */
386 1.1 christos 0, /* rightshift */
387 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
388 1.1 christos 32, /* bitsize */
389 1.1 christos FALSE, /* pc_relative */
390 1.1 christos 0, /* bitpos */
391 1.1 christos complain_overflow_dont,/* complain_on_overflow */
392 1.1 christos bfd_elf_generic_reloc, /* special_function */
393 1.1 christos "R_C6000_COPY", /* name */
394 1.1 christos FALSE, /* partial_inplace */
395 1.1 christos 0, /* src_mask */
396 1.1 christos 0xffffffff, /* dst_mask */
397 1.1 christos FALSE), /* pcrel_offset */
398 1.1 christos EMPTY_HOWTO (27),
399 1.1 christos EMPTY_HOWTO (28),
400 1.1 christos EMPTY_HOWTO (29),
401 1.1 christos EMPTY_HOWTO (30),
402 1.1 christos EMPTY_HOWTO (31),
403 1.1 christos EMPTY_HOWTO (32),
404 1.1 christos EMPTY_HOWTO (33),
405 1.1 christos EMPTY_HOWTO (34),
406 1.1 christos EMPTY_HOWTO (35),
407 1.1 christos EMPTY_HOWTO (36),
408 1.1 christos EMPTY_HOWTO (37),
409 1.1 christos EMPTY_HOWTO (38),
410 1.1 christos EMPTY_HOWTO (39),
411 1.1 christos EMPTY_HOWTO (40),
412 1.1 christos EMPTY_HOWTO (41),
413 1.1 christos EMPTY_HOWTO (42),
414 1.1 christos EMPTY_HOWTO (43),
415 1.1 christos EMPTY_HOWTO (44),
416 1.1 christos EMPTY_HOWTO (45),
417 1.1 christos EMPTY_HOWTO (46),
418 1.1 christos EMPTY_HOWTO (47),
419 1.1 christos EMPTY_HOWTO (48),
420 1.1 christos EMPTY_HOWTO (49),
421 1.1 christos EMPTY_HOWTO (50),
422 1.1 christos EMPTY_HOWTO (51),
423 1.1 christos EMPTY_HOWTO (52),
424 1.1 christos EMPTY_HOWTO (53),
425 1.1 christos EMPTY_HOWTO (54),
426 1.1 christos EMPTY_HOWTO (55),
427 1.1 christos EMPTY_HOWTO (56),
428 1.1 christos EMPTY_HOWTO (57),
429 1.1 christos EMPTY_HOWTO (58),
430 1.1 christos EMPTY_HOWTO (59),
431 1.1 christos EMPTY_HOWTO (60),
432 1.1 christos EMPTY_HOWTO (61),
433 1.1 christos EMPTY_HOWTO (62),
434 1.1 christos EMPTY_HOWTO (63),
435 1.1 christos EMPTY_HOWTO (64),
436 1.1 christos EMPTY_HOWTO (65),
437 1.1 christos EMPTY_HOWTO (66),
438 1.1 christos EMPTY_HOWTO (67),
439 1.1 christos EMPTY_HOWTO (68),
440 1.1 christos EMPTY_HOWTO (69),
441 1.1 christos EMPTY_HOWTO (70),
442 1.1 christos EMPTY_HOWTO (71),
443 1.1 christos EMPTY_HOWTO (72),
444 1.1 christos EMPTY_HOWTO (73),
445 1.1 christos EMPTY_HOWTO (74),
446 1.1 christos EMPTY_HOWTO (75),
447 1.1 christos EMPTY_HOWTO (76),
448 1.1 christos EMPTY_HOWTO (77),
449 1.1 christos EMPTY_HOWTO (78),
450 1.1 christos EMPTY_HOWTO (79),
451 1.1 christos EMPTY_HOWTO (80),
452 1.1 christos EMPTY_HOWTO (81),
453 1.1 christos EMPTY_HOWTO (82),
454 1.1 christos EMPTY_HOWTO (83),
455 1.1 christos EMPTY_HOWTO (84),
456 1.1 christos EMPTY_HOWTO (85),
457 1.1 christos EMPTY_HOWTO (86),
458 1.1 christos EMPTY_HOWTO (87),
459 1.1 christos EMPTY_HOWTO (88),
460 1.1 christos EMPTY_HOWTO (89),
461 1.1 christos EMPTY_HOWTO (90),
462 1.1 christos EMPTY_HOWTO (91),
463 1.1 christos EMPTY_HOWTO (92),
464 1.1 christos EMPTY_HOWTO (93),
465 1.1 christos EMPTY_HOWTO (94),
466 1.1 christos EMPTY_HOWTO (95),
467 1.1 christos EMPTY_HOWTO (96),
468 1.1 christos EMPTY_HOWTO (97),
469 1.1 christos EMPTY_HOWTO (98),
470 1.1 christos EMPTY_HOWTO (99),
471 1.1 christos EMPTY_HOWTO (100),
472 1.1 christos EMPTY_HOWTO (101),
473 1.1 christos EMPTY_HOWTO (102),
474 1.1 christos EMPTY_HOWTO (103),
475 1.1 christos EMPTY_HOWTO (104),
476 1.1 christos EMPTY_HOWTO (105),
477 1.1 christos EMPTY_HOWTO (106),
478 1.1 christos EMPTY_HOWTO (107),
479 1.1 christos EMPTY_HOWTO (108),
480 1.1 christos EMPTY_HOWTO (109),
481 1.1 christos EMPTY_HOWTO (110),
482 1.1 christos EMPTY_HOWTO (111),
483 1.1 christos EMPTY_HOWTO (112),
484 1.1 christos EMPTY_HOWTO (113),
485 1.1 christos EMPTY_HOWTO (114),
486 1.1 christos EMPTY_HOWTO (115),
487 1.1 christos EMPTY_HOWTO (116),
488 1.1 christos EMPTY_HOWTO (117),
489 1.1 christos EMPTY_HOWTO (118),
490 1.1 christos EMPTY_HOWTO (119),
491 1.1 christos EMPTY_HOWTO (120),
492 1.1 christos EMPTY_HOWTO (121),
493 1.1 christos EMPTY_HOWTO (122),
494 1.1 christos EMPTY_HOWTO (123),
495 1.1 christos EMPTY_HOWTO (124),
496 1.1 christos EMPTY_HOWTO (125),
497 1.1 christos EMPTY_HOWTO (126),
498 1.1 christos EMPTY_HOWTO (127),
499 1.1 christos EMPTY_HOWTO (128),
500 1.1 christos EMPTY_HOWTO (129),
501 1.1 christos EMPTY_HOWTO (130),
502 1.1 christos EMPTY_HOWTO (131),
503 1.1 christos EMPTY_HOWTO (132),
504 1.1 christos EMPTY_HOWTO (133),
505 1.1 christos EMPTY_HOWTO (134),
506 1.1 christos EMPTY_HOWTO (135),
507 1.1 christos EMPTY_HOWTO (136),
508 1.1 christos EMPTY_HOWTO (137),
509 1.1 christos EMPTY_HOWTO (138),
510 1.1 christos EMPTY_HOWTO (139),
511 1.1 christos EMPTY_HOWTO (140),
512 1.1 christos EMPTY_HOWTO (141),
513 1.1 christos EMPTY_HOWTO (142),
514 1.1 christos EMPTY_HOWTO (143),
515 1.1 christos EMPTY_HOWTO (144),
516 1.1 christos EMPTY_HOWTO (145),
517 1.1 christos EMPTY_HOWTO (146),
518 1.1 christos EMPTY_HOWTO (147),
519 1.1 christos EMPTY_HOWTO (148),
520 1.1 christos EMPTY_HOWTO (149),
521 1.1 christos EMPTY_HOWTO (150),
522 1.1 christos EMPTY_HOWTO (151),
523 1.1 christos EMPTY_HOWTO (152),
524 1.1 christos EMPTY_HOWTO (153),
525 1.1 christos EMPTY_HOWTO (154),
526 1.1 christos EMPTY_HOWTO (155),
527 1.1 christos EMPTY_HOWTO (156),
528 1.1 christos EMPTY_HOWTO (157),
529 1.1 christos EMPTY_HOWTO (158),
530 1.1 christos EMPTY_HOWTO (159),
531 1.1 christos EMPTY_HOWTO (160),
532 1.1 christos EMPTY_HOWTO (161),
533 1.1 christos EMPTY_HOWTO (162),
534 1.1 christos EMPTY_HOWTO (163),
535 1.1 christos EMPTY_HOWTO (164),
536 1.1 christos EMPTY_HOWTO (165),
537 1.1 christos EMPTY_HOWTO (166),
538 1.1 christos EMPTY_HOWTO (167),
539 1.1 christos EMPTY_HOWTO (168),
540 1.1 christos EMPTY_HOWTO (169),
541 1.1 christos EMPTY_HOWTO (170),
542 1.1 christos EMPTY_HOWTO (171),
543 1.1 christos EMPTY_HOWTO (172),
544 1.1 christos EMPTY_HOWTO (173),
545 1.1 christos EMPTY_HOWTO (174),
546 1.1 christos EMPTY_HOWTO (175),
547 1.1 christos EMPTY_HOWTO (176),
548 1.1 christos EMPTY_HOWTO (177),
549 1.1 christos EMPTY_HOWTO (178),
550 1.1 christos EMPTY_HOWTO (179),
551 1.1 christos EMPTY_HOWTO (180),
552 1.1 christos EMPTY_HOWTO (181),
553 1.1 christos EMPTY_HOWTO (182),
554 1.1 christos EMPTY_HOWTO (183),
555 1.1 christos EMPTY_HOWTO (184),
556 1.1 christos EMPTY_HOWTO (185),
557 1.1 christos EMPTY_HOWTO (186),
558 1.1 christos EMPTY_HOWTO (187),
559 1.1 christos EMPTY_HOWTO (188),
560 1.1 christos EMPTY_HOWTO (189),
561 1.1 christos EMPTY_HOWTO (190),
562 1.1 christos EMPTY_HOWTO (191),
563 1.1 christos EMPTY_HOWTO (192),
564 1.1 christos EMPTY_HOWTO (193),
565 1.1 christos EMPTY_HOWTO (194),
566 1.1 christos EMPTY_HOWTO (195),
567 1.1 christos EMPTY_HOWTO (196),
568 1.1 christos EMPTY_HOWTO (197),
569 1.1 christos EMPTY_HOWTO (198),
570 1.1 christos EMPTY_HOWTO (199),
571 1.1 christos EMPTY_HOWTO (200),
572 1.1 christos EMPTY_HOWTO (201),
573 1.1 christos EMPTY_HOWTO (202),
574 1.1 christos EMPTY_HOWTO (203),
575 1.1 christos EMPTY_HOWTO (204),
576 1.1 christos EMPTY_HOWTO (205),
577 1.1 christos EMPTY_HOWTO (206),
578 1.1 christos EMPTY_HOWTO (207),
579 1.1 christos EMPTY_HOWTO (208),
580 1.1 christos EMPTY_HOWTO (209),
581 1.1 christos EMPTY_HOWTO (210),
582 1.1 christos EMPTY_HOWTO (211),
583 1.1 christos EMPTY_HOWTO (212),
584 1.1 christos EMPTY_HOWTO (213),
585 1.1 christos EMPTY_HOWTO (214),
586 1.1 christos EMPTY_HOWTO (215),
587 1.1 christos EMPTY_HOWTO (216),
588 1.1 christos EMPTY_HOWTO (217),
589 1.1 christos EMPTY_HOWTO (218),
590 1.1 christos EMPTY_HOWTO (219),
591 1.1 christos EMPTY_HOWTO (220),
592 1.1 christos EMPTY_HOWTO (221),
593 1.1 christos EMPTY_HOWTO (222),
594 1.1 christos EMPTY_HOWTO (223),
595 1.1 christos EMPTY_HOWTO (224),
596 1.1 christos EMPTY_HOWTO (225),
597 1.1 christos EMPTY_HOWTO (226),
598 1.1 christos EMPTY_HOWTO (227),
599 1.1 christos EMPTY_HOWTO (228),
600 1.1 christos EMPTY_HOWTO (229),
601 1.1 christos EMPTY_HOWTO (230),
602 1.1 christos EMPTY_HOWTO (231),
603 1.1 christos EMPTY_HOWTO (232),
604 1.1 christos EMPTY_HOWTO (233),
605 1.1 christos EMPTY_HOWTO (234),
606 1.1 christos EMPTY_HOWTO (235),
607 1.1 christos EMPTY_HOWTO (236),
608 1.1 christos EMPTY_HOWTO (237),
609 1.1 christos EMPTY_HOWTO (238),
610 1.1 christos EMPTY_HOWTO (239),
611 1.1 christos EMPTY_HOWTO (240),
612 1.1 christos EMPTY_HOWTO (241),
613 1.1 christos EMPTY_HOWTO (242),
614 1.1 christos EMPTY_HOWTO (243),
615 1.1 christos EMPTY_HOWTO (244),
616 1.1 christos EMPTY_HOWTO (245),
617 1.1 christos EMPTY_HOWTO (246),
618 1.1 christos EMPTY_HOWTO (247),
619 1.1 christos EMPTY_HOWTO (248),
620 1.1 christos EMPTY_HOWTO (249),
621 1.1 christos EMPTY_HOWTO (250),
622 1.1 christos EMPTY_HOWTO (251),
623 1.1 christos EMPTY_HOWTO (252),
624 1.1 christos HOWTO (R_C6000_ALIGN, /* type */
625 1.1 christos 0, /* rightshift */
626 1.1 christos 0, /* size (0 = byte, 1 = short, 2 = long) */
627 1.1 christos 0, /* bitsize */
628 1.1 christos FALSE, /* pc_relative */
629 1.1 christos 0, /* bitpos */
630 1.1 christos complain_overflow_dont,/* complain_on_overflow */
631 1.1 christos bfd_elf_generic_reloc, /* special_function */
632 1.1 christos "R_C6000_ALIGN", /* name */
633 1.1 christos FALSE, /* partial_inplace */
634 1.1 christos 0, /* src_mask */
635 1.1 christos 0, /* dst_mask */
636 1.1 christos FALSE), /* pcrel_offset */
637 1.1 christos HOWTO (R_C6000_FPHEAD, /* type */
638 1.1 christos 0, /* rightshift */
639 1.1 christos 0, /* size (0 = byte, 1 = short, 2 = long) */
640 1.1 christos 0, /* bitsize */
641 1.1 christos FALSE, /* pc_relative */
642 1.1 christos 0, /* bitpos */
643 1.1 christos complain_overflow_dont,/* complain_on_overflow */
644 1.1 christos bfd_elf_generic_reloc, /* special_function */
645 1.1 christos "R_C6000_FPHEAD", /* name */
646 1.1 christos FALSE, /* partial_inplace */
647 1.1 christos 0, /* src_mask */
648 1.1 christos 0, /* dst_mask */
649 1.1 christos FALSE), /* pcrel_offset */
650 1.1 christos HOWTO (R_C6000_NOCMP, /* type */
651 1.1 christos 0, /* rightshift */
652 1.1 christos 0, /* size (0 = byte, 1 = short, 2 = long) */
653 1.1 christos 0, /* bitsize */
654 1.1 christos FALSE, /* pc_relative */
655 1.1 christos 0, /* bitpos */
656 1.1 christos complain_overflow_dont,/* complain_on_overflow */
657 1.1 christos bfd_elf_generic_reloc, /* special_function */
658 1.1 christos "R_C6000_NOCMP", /* name */
659 1.1 christos FALSE, /* partial_inplace */
660 1.1 christos 0, /* src_mask */
661 1.1 christos 0, /* dst_mask */
662 1.1 christos FALSE) /* pcrel_offset */
663 1.1 christos };
664 1.1 christos
665 1.1 christos static reloc_howto_type elf32_tic6x_howto_table_rel[] =
666 1.1 christos {
667 1.1 christos HOWTO (R_C6000_NONE, /* type */
668 1.1 christos 0, /* rightshift */
669 1.1 christos 0, /* size (0 = byte, 1 = short, 2 = long) */
670 1.1 christos 0, /* bitsize */
671 1.1 christos FALSE, /* pc_relative */
672 1.1 christos 0, /* bitpos */
673 1.1 christos complain_overflow_dont,/* complain_on_overflow */
674 1.1 christos bfd_elf_generic_reloc, /* special_function */
675 1.1 christos "R_C6000_NONE", /* name */
676 1.1 christos TRUE, /* partial_inplace */
677 1.1 christos 0, /* src_mask */
678 1.1 christos 0, /* dst_mask */
679 1.1 christos FALSE), /* pcrel_offset */
680 1.1 christos HOWTO (R_C6000_ABS32, /* type */
681 1.1 christos 0, /* rightshift */
682 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
683 1.1 christos 32, /* bitsize */
684 1.1 christos FALSE, /* pc_relative */
685 1.1 christos 0, /* bitpos */
686 1.1 christos complain_overflow_dont,/* complain_on_overflow */
687 1.1 christos bfd_elf_generic_reloc, /* special_function */
688 1.1 christos "R_C6000_ABS32", /* name */
689 1.1 christos TRUE, /* partial_inplace */
690 1.1 christos 0xffffffff, /* src_mask */
691 1.1 christos 0xffffffff, /* dst_mask */
692 1.1 christos FALSE), /* pcrel_offset */
693 1.1 christos HOWTO (R_C6000_ABS16, /* type */
694 1.1 christos 0, /* rightshift */
695 1.1 christos 1, /* size (0 = byte, 1 = short, 2 = long) */
696 1.1 christos 16, /* bitsize */
697 1.1 christos FALSE, /* pc_relative */
698 1.1 christos 0, /* bitpos */
699 1.1 christos complain_overflow_bitfield,/* complain_on_overflow */
700 1.1 christos bfd_elf_generic_reloc, /* special_function */
701 1.1 christos "R_C6000_ABS16", /* name */
702 1.1 christos TRUE, /* partial_inplace */
703 1.1 christos 0x0000ffff, /* src_mask */
704 1.1 christos 0x0000ffff, /* dst_mask */
705 1.1 christos FALSE), /* pcrel_offset */
706 1.1 christos HOWTO (R_C6000_ABS8, /* type */
707 1.1 christos 0, /* rightshift */
708 1.1 christos 0, /* size (0 = byte, 1 = short, 2 = long) */
709 1.1 christos 8, /* bitsize */
710 1.1 christos FALSE, /* pc_relative */
711 1.1 christos 0, /* bitpos */
712 1.1 christos complain_overflow_bitfield,/* complain_on_overflow */
713 1.1 christos bfd_elf_generic_reloc, /* special_function */
714 1.1 christos "R_C6000_ABS8", /* name */
715 1.1 christos TRUE, /* partial_inplace */
716 1.1 christos 0x000000ff, /* src_mask */
717 1.1 christos 0x000000ff, /* dst_mask */
718 1.1 christos FALSE), /* pcrel_offset */
719 1.1 christos HOWTO (R_C6000_PCR_S21, /* type */
720 1.1 christos 2, /* rightshift */
721 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
722 1.1 christos 21, /* bitsize */
723 1.1 christos TRUE, /* pc_relative */
724 1.1 christos 7, /* bitpos */
725 1.1 christos complain_overflow_signed,/* complain_on_overflow */
726 1.1 christos bfd_elf_generic_reloc, /* special_function */
727 1.1 christos "R_C6000_PCR_S21", /* name */
728 1.1 christos TRUE, /* partial_inplace */
729 1.1 christos 0x0fffff80, /* src_mask */
730 1.1 christos 0x0fffff80, /* dst_mask */
731 1.1 christos TRUE), /* pcrel_offset */
732 1.1 christos HOWTO (R_C6000_PCR_S12, /* type */
733 1.1 christos 2, /* rightshift */
734 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
735 1.1 christos 12, /* bitsize */
736 1.1 christos TRUE, /* pc_relative */
737 1.1 christos 16, /* bitpos */
738 1.1 christos complain_overflow_signed,/* complain_on_overflow */
739 1.1 christos bfd_elf_generic_reloc, /* special_function */
740 1.1 christos "R_C6000_PCR_S12", /* name */
741 1.1 christos TRUE, /* partial_inplace */
742 1.1 christos 0x0fff0000, /* src_mask */
743 1.1 christos 0x0fff0000, /* dst_mask */
744 1.1 christos TRUE), /* pcrel_offset */
745 1.1 christos HOWTO (R_C6000_PCR_S10, /* type */
746 1.1 christos 2, /* rightshift */
747 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
748 1.1 christos 10, /* bitsize */
749 1.1 christos TRUE, /* pc_relative */
750 1.1 christos 13, /* bitpos */
751 1.1 christos complain_overflow_signed,/* complain_on_overflow */
752 1.1 christos bfd_elf_generic_reloc, /* special_function */
753 1.1 christos "R_C6000_PCR_S10", /* name */
754 1.1 christos TRUE, /* partial_inplace */
755 1.1 christos 0x007fe000, /* src_mask */
756 1.1 christos 0x007fe000, /* dst_mask */
757 1.1 christos TRUE), /* pcrel_offset */
758 1.1 christos HOWTO (R_C6000_PCR_S7, /* type */
759 1.1 christos 2, /* rightshift */
760 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
761 1.1 christos 7, /* bitsize */
762 1.1 christos TRUE, /* pc_relative */
763 1.1 christos 16, /* bitpos */
764 1.1 christos complain_overflow_signed,/* complain_on_overflow */
765 1.1 christos bfd_elf_generic_reloc, /* special_function */
766 1.1 christos "R_C6000_PCR_S7", /* name */
767 1.1 christos TRUE, /* partial_inplace */
768 1.1 christos 0x007f0000, /* src_mask */
769 1.1 christos 0x007f0000, /* dst_mask */
770 1.1 christos TRUE), /* pcrel_offset */
771 1.1 christos HOWTO (R_C6000_ABS_S16, /* type */
772 1.1 christos 0, /* rightshift */
773 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
774 1.1 christos 16, /* bitsize */
775 1.1 christos FALSE, /* pc_relative */
776 1.1 christos 7, /* bitpos */
777 1.1 christos complain_overflow_signed,/* complain_on_overflow */
778 1.1 christos bfd_elf_generic_reloc, /* special_function */
779 1.1 christos "R_C6000_ABS_S16", /* name */
780 1.1 christos TRUE, /* partial_inplace */
781 1.1 christos 0x007fff80, /* src_mask */
782 1.1 christos 0x007fff80, /* dst_mask */
783 1.1 christos FALSE), /* pcrel_offset */
784 1.1 christos HOWTO (R_C6000_ABS_L16, /* type */
785 1.1 christos 0, /* rightshift */
786 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
787 1.1 christos 16, /* bitsize */
788 1.1 christos FALSE, /* pc_relative */
789 1.1 christos 7, /* bitpos */
790 1.1 christos complain_overflow_dont,/* complain_on_overflow */
791 1.1 christos bfd_elf_generic_reloc, /* special_function */
792 1.1 christos "R_C6000_ABS_L16", /* name */
793 1.1 christos TRUE, /* partial_inplace */
794 1.1 christos 0x007fff80, /* src_mask */
795 1.1 christos 0x007fff80, /* dst_mask */
796 1.1 christos FALSE), /* pcrel_offset */
797 1.1 christos EMPTY_HOWTO (R_C6000_ABS_H16),
798 1.1 christos HOWTO (R_C6000_SBR_U15_B, /* type */
799 1.1 christos 0, /* rightshift */
800 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
801 1.1 christos 15, /* bitsize */
802 1.1 christos FALSE, /* pc_relative */
803 1.1 christos 8, /* bitpos */
804 1.1 christos complain_overflow_unsigned,/* complain_on_overflow */
805 1.1 christos bfd_elf_generic_reloc, /* special_function */
806 1.1 christos "R_C6000_SBR_U15_B", /* name */
807 1.1 christos TRUE, /* partial_inplace */
808 1.1 christos 0x007fff00, /* src_mask */
809 1.1 christos 0x007fff00, /* dst_mask */
810 1.1 christos FALSE), /* pcrel_offset */
811 1.1 christos HOWTO (R_C6000_SBR_U15_H, /* type */
812 1.1 christos 1, /* rightshift */
813 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
814 1.1 christos 15, /* bitsize */
815 1.1 christos FALSE, /* pc_relative */
816 1.1 christos 8, /* bitpos */
817 1.1 christos complain_overflow_unsigned,/* complain_on_overflow */
818 1.1 christos bfd_elf_generic_reloc, /* special_function */
819 1.1 christos "R_C6000_SBR_U15_H", /* name */
820 1.1 christos TRUE, /* partial_inplace */
821 1.1 christos 0x007fff00, /* src_mask */
822 1.1 christos 0x007fff00, /* dst_mask */
823 1.1 christos FALSE), /* pcrel_offset */
824 1.1 christos HOWTO (R_C6000_SBR_U15_W, /* type */
825 1.1 christos 2, /* rightshift */
826 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
827 1.1 christos 15, /* bitsize */
828 1.1 christos FALSE, /* pc_relative */
829 1.1 christos 8, /* bitpos */
830 1.1 christos complain_overflow_unsigned,/* complain_on_overflow */
831 1.1 christos bfd_elf_generic_reloc, /* special_function */
832 1.1 christos "R_C6000_SBR_U15_W", /* name */
833 1.1 christos TRUE, /* partial_inplace */
834 1.1 christos 0x007fff00, /* src_mask */
835 1.1 christos 0x007fff00, /* dst_mask */
836 1.1 christos FALSE), /* pcrel_offset */
837 1.1 christos HOWTO (R_C6000_SBR_S16, /* type */
838 1.1 christos 0, /* rightshift */
839 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
840 1.1 christos 16, /* bitsize */
841 1.1 christos FALSE, /* pc_relative */
842 1.1 christos 7, /* bitpos */
843 1.1 christos complain_overflow_signed,/* complain_on_overflow */
844 1.1 christos bfd_elf_generic_reloc, /* special_function */
845 1.1 christos "R_C6000_SBR_S16", /* name */
846 1.1 christos TRUE, /* partial_inplace */
847 1.1 christos 0x007fff80, /* src_mask */
848 1.1 christos 0x007fff80, /* dst_mask */
849 1.1 christos FALSE), /* pcrel_offset */
850 1.1 christos HOWTO (R_C6000_SBR_L16_B, /* type */
851 1.1 christos 0, /* rightshift */
852 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
853 1.1 christos 16, /* bitsize */
854 1.1 christos FALSE, /* pc_relative */
855 1.1 christos 7, /* bitpos */
856 1.1 christos complain_overflow_dont,/* complain_on_overflow */
857 1.1 christos bfd_elf_generic_reloc, /* special_function */
858 1.1 christos "R_C6000_SBR_L16_B", /* name */
859 1.1 christos TRUE, /* partial_inplace */
860 1.1 christos 0x007fff80, /* src_mask */
861 1.1 christos 0x007fff80, /* dst_mask */
862 1.1 christos FALSE), /* pcrel_offset */
863 1.1 christos HOWTO (R_C6000_SBR_L16_H, /* type */
864 1.1 christos 1, /* rightshift */
865 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
866 1.1 christos 16, /* bitsize */
867 1.1 christos FALSE, /* pc_relative */
868 1.1 christos 7, /* bitpos */
869 1.1 christos complain_overflow_dont,/* complain_on_overflow */
870 1.1 christos bfd_elf_generic_reloc, /* special_function */
871 1.1 christos "R_C6000_SBR_L16_H", /* name */
872 1.1 christos TRUE, /* partial_inplace */
873 1.1 christos 0x007fff80, /* src_mask */
874 1.1 christos 0x007fff80, /* dst_mask */
875 1.1 christos FALSE), /* pcrel_offset */
876 1.1 christos HOWTO (R_C6000_SBR_L16_W, /* type */
877 1.1 christos 2, /* rightshift */
878 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
879 1.1 christos 16, /* bitsize */
880 1.1 christos FALSE, /* pc_relative */
881 1.1 christos 7, /* bitpos */
882 1.1 christos complain_overflow_dont,/* complain_on_overflow */
883 1.1 christos bfd_elf_generic_reloc, /* special_function */
884 1.1 christos "R_C6000_SBR_L16_W", /* name */
885 1.1 christos TRUE, /* partial_inplace */
886 1.1 christos 0x007fff80, /* src_mask */
887 1.1 christos 0x007fff80, /* dst_mask */
888 1.1 christos FALSE), /* pcrel_offset */
889 1.1 christos EMPTY_HOWTO (R_C6000_SBR_H16_B),
890 1.1 christos EMPTY_HOWTO (R_C6000_SBR_H16_H),
891 1.1 christos EMPTY_HOWTO (R_C6000_SBR_H16_W),
892 1.1 christos HOWTO (R_C6000_SBR_GOT_U15_W, /* type */
893 1.1 christos 2, /* rightshift */
894 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
895 1.1 christos 15, /* bitsize */
896 1.1 christos FALSE, /* pc_relative */
897 1.1 christos 8, /* bitpos */
898 1.1 christos complain_overflow_unsigned,/* complain_on_overflow */
899 1.1 christos bfd_elf_generic_reloc, /* special_function */
900 1.1 christos "R_C6000_SBR_GOT_U15_W",/* name */
901 1.1 christos TRUE, /* partial_inplace */
902 1.1 christos 0x007fff00, /* src_mask */
903 1.1 christos 0x007fff00, /* dst_mask */
904 1.1 christos FALSE), /* pcrel_offset */
905 1.1 christos HOWTO (R_C6000_SBR_GOT_L16_W, /* type */
906 1.1 christos 2, /* rightshift */
907 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
908 1.1 christos 16, /* bitsize */
909 1.1 christos FALSE, /* pc_relative */
910 1.1 christos 7, /* bitpos */
911 1.1 christos complain_overflow_dont,/* complain_on_overflow */
912 1.1 christos bfd_elf_generic_reloc, /* special_function */
913 1.1 christos "R_C6000_SBR_GOT_L16_W",/* name */
914 1.1 christos TRUE, /* partial_inplace */
915 1.1 christos 0x007fff80, /* src_mask */
916 1.1 christos 0x007fff80, /* dst_mask */
917 1.1 christos FALSE), /* pcrel_offset */
918 1.1 christos EMPTY_HOWTO (R_C6000_SBR_GOT_H16_W),
919 1.1 christos HOWTO (R_C6000_DSBT_INDEX, /* type */
920 1.1 christos 0, /* rightshift */
921 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
922 1.1 christos 15, /* bitsize */
923 1.1 christos FALSE, /* pc_relative */
924 1.1 christos 8, /* bitpos */
925 1.1 christos complain_overflow_unsigned,/* complain_on_overflow */
926 1.1 christos bfd_elf_generic_reloc, /* special_function */
927 1.1 christos "R_C6000_DSBT_INDEX", /* name */
928 1.1 christos TRUE, /* partial_inplace */
929 1.1 christos 0, /* src_mask */
930 1.1 christos 0x007fff00, /* dst_mask */
931 1.1 christos FALSE), /* pcrel_offset */
932 1.1 christos HOWTO (R_C6000_PREL31, /* type */
933 1.1 christos 1, /* rightshift */
934 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
935 1.1 christos 31, /* bitsize */
936 1.1 christos FALSE, /* pc_relative */
937 1.1 christos 0, /* bitpos */
938 1.1 christos complain_overflow_dont,/* complain_on_overflow */
939 1.1 christos bfd_elf_generic_reloc, /* special_function */
940 1.1 christos "R_C6000_PREL31", /* name */
941 1.1 christos TRUE, /* partial_inplace */
942 1.1 christos 0, /* src_mask */
943 1.1 christos 0x7fffffff, /* dst_mask */
944 1.1 christos FALSE), /* pcrel_offset */
945 1.1 christos HOWTO (R_C6000_COPY, /* type */
946 1.1 christos 0, /* rightshift */
947 1.1 christos 2, /* size (0 = byte, 1 = short, 2 = long) */
948 1.1 christos 32, /* bitsize */
949 1.1 christos FALSE, /* pc_relative */
950 1.1 christos 0, /* bitpos */
951 1.1 christos complain_overflow_dont,/* complain_on_overflow */
952 1.1 christos bfd_elf_generic_reloc, /* special_function */
953 1.1 christos "R_C6000_COPY", /* name */
954 1.1 christos TRUE, /* partial_inplace */
955 1.1 christos 0, /* src_mask */
956 1.1 christos 0xffffffff, /* dst_mask */
957 1.1 christos FALSE), /* pcrel_offset */
958 1.1 christos EMPTY_HOWTO (27),
959 1.1 christos EMPTY_HOWTO (28),
960 1.1 christos EMPTY_HOWTO (29),
961 1.1 christos EMPTY_HOWTO (30),
962 1.1 christos EMPTY_HOWTO (31),
963 1.1 christos EMPTY_HOWTO (32),
964 1.1 christos EMPTY_HOWTO (33),
965 1.1 christos EMPTY_HOWTO (34),
966 1.1 christos EMPTY_HOWTO (35),
967 1.1 christos EMPTY_HOWTO (36),
968 1.1 christos EMPTY_HOWTO (37),
969 1.1 christos EMPTY_HOWTO (38),
970 1.1 christos EMPTY_HOWTO (39),
971 1.1 christos EMPTY_HOWTO (40),
972 1.1 christos EMPTY_HOWTO (41),
973 1.1 christos EMPTY_HOWTO (42),
974 1.1 christos EMPTY_HOWTO (43),
975 1.1 christos EMPTY_HOWTO (44),
976 1.1 christos EMPTY_HOWTO (45),
977 1.1 christos EMPTY_HOWTO (46),
978 1.1 christos EMPTY_HOWTO (47),
979 1.1 christos EMPTY_HOWTO (48),
980 1.1 christos EMPTY_HOWTO (49),
981 1.1 christos EMPTY_HOWTO (50),
982 1.1 christos EMPTY_HOWTO (51),
983 1.1 christos EMPTY_HOWTO (52),
984 1.1 christos EMPTY_HOWTO (53),
985 1.1 christos EMPTY_HOWTO (54),
986 1.1 christos EMPTY_HOWTO (55),
987 1.1 christos EMPTY_HOWTO (56),
988 1.1 christos EMPTY_HOWTO (57),
989 1.1 christos EMPTY_HOWTO (58),
990 1.1 christos EMPTY_HOWTO (59),
991 1.1 christos EMPTY_HOWTO (60),
992 1.1 christos EMPTY_HOWTO (61),
993 1.1 christos EMPTY_HOWTO (62),
994 1.1 christos EMPTY_HOWTO (63),
995 1.1 christos EMPTY_HOWTO (64),
996 1.1 christos EMPTY_HOWTO (65),
997 1.1 christos EMPTY_HOWTO (66),
998 1.1 christos EMPTY_HOWTO (67),
999 1.1 christos EMPTY_HOWTO (68),
1000 1.1 christos EMPTY_HOWTO (69),
1001 1.1 christos EMPTY_HOWTO (70),
1002 1.1 christos EMPTY_HOWTO (71),
1003 1.1 christos EMPTY_HOWTO (72),
1004 1.1 christos EMPTY_HOWTO (73),
1005 1.1 christos EMPTY_HOWTO (74),
1006 1.1 christos EMPTY_HOWTO (75),
1007 1.1 christos EMPTY_HOWTO (76),
1008 1.1 christos EMPTY_HOWTO (77),
1009 1.1 christos EMPTY_HOWTO (78),
1010 1.1 christos EMPTY_HOWTO (79),
1011 1.1 christos EMPTY_HOWTO (80),
1012 1.1 christos EMPTY_HOWTO (81),
1013 1.1 christos EMPTY_HOWTO (82),
1014 1.1 christos EMPTY_HOWTO (83),
1015 1.1 christos EMPTY_HOWTO (84),
1016 1.1 christos EMPTY_HOWTO (85),
1017 1.1 christos EMPTY_HOWTO (86),
1018 1.1 christos EMPTY_HOWTO (87),
1019 1.1 christos EMPTY_HOWTO (88),
1020 1.1 christos EMPTY_HOWTO (89),
1021 1.1 christos EMPTY_HOWTO (90),
1022 1.1 christos EMPTY_HOWTO (91),
1023 1.1 christos EMPTY_HOWTO (92),
1024 1.1 christos EMPTY_HOWTO (93),
1025 1.1 christos EMPTY_HOWTO (94),
1026 1.1 christos EMPTY_HOWTO (95),
1027 1.1 christos EMPTY_HOWTO (96),
1028 1.1 christos EMPTY_HOWTO (97),
1029 1.1 christos EMPTY_HOWTO (98),
1030 1.1 christos EMPTY_HOWTO (99),
1031 1.1 christos EMPTY_HOWTO (100),
1032 1.1 christos EMPTY_HOWTO (101),
1033 1.1 christos EMPTY_HOWTO (102),
1034 1.1 christos EMPTY_HOWTO (103),
1035 1.1 christos EMPTY_HOWTO (104),
1036 1.1 christos EMPTY_HOWTO (105),
1037 1.1 christos EMPTY_HOWTO (106),
1038 1.1 christos EMPTY_HOWTO (107),
1039 1.1 christos EMPTY_HOWTO (108),
1040 1.1 christos EMPTY_HOWTO (109),
1041 1.1 christos EMPTY_HOWTO (110),
1042 1.1 christos EMPTY_HOWTO (111),
1043 1.1 christos EMPTY_HOWTO (112),
1044 1.1 christos EMPTY_HOWTO (113),
1045 1.1 christos EMPTY_HOWTO (114),
1046 1.1 christos EMPTY_HOWTO (115),
1047 1.1 christos EMPTY_HOWTO (116),
1048 1.1 christos EMPTY_HOWTO (117),
1049 1.1 christos EMPTY_HOWTO (118),
1050 1.1 christos EMPTY_HOWTO (119),
1051 1.1 christos EMPTY_HOWTO (120),
1052 1.1 christos EMPTY_HOWTO (121),
1053 1.1 christos EMPTY_HOWTO (122),
1054 1.1 christos EMPTY_HOWTO (123),
1055 1.1 christos EMPTY_HOWTO (124),
1056 1.1 christos EMPTY_HOWTO (125),
1057 1.1 christos EMPTY_HOWTO (126),
1058 1.1 christos EMPTY_HOWTO (127),
1059 1.1 christos EMPTY_HOWTO (128),
1060 1.1 christos EMPTY_HOWTO (129),
1061 1.1 christos EMPTY_HOWTO (130),
1062 1.1 christos EMPTY_HOWTO (131),
1063 1.1 christos EMPTY_HOWTO (132),
1064 1.1 christos EMPTY_HOWTO (133),
1065 1.1 christos EMPTY_HOWTO (134),
1066 1.1 christos EMPTY_HOWTO (135),
1067 1.1 christos EMPTY_HOWTO (136),
1068 1.1 christos EMPTY_HOWTO (137),
1069 1.1 christos EMPTY_HOWTO (138),
1070 1.1 christos EMPTY_HOWTO (139),
1071 1.1 christos EMPTY_HOWTO (140),
1072 1.1 christos EMPTY_HOWTO (141),
1073 1.1 christos EMPTY_HOWTO (142),
1074 1.1 christos EMPTY_HOWTO (143),
1075 1.1 christos EMPTY_HOWTO (144),
1076 1.1 christos EMPTY_HOWTO (145),
1077 1.1 christos EMPTY_HOWTO (146),
1078 1.1 christos EMPTY_HOWTO (147),
1079 1.1 christos EMPTY_HOWTO (148),
1080 1.1 christos EMPTY_HOWTO (149),
1081 1.1 christos EMPTY_HOWTO (150),
1082 1.1 christos EMPTY_HOWTO (151),
1083 1.1 christos EMPTY_HOWTO (152),
1084 1.1 christos EMPTY_HOWTO (153),
1085 1.1 christos EMPTY_HOWTO (154),
1086 1.1 christos EMPTY_HOWTO (155),
1087 1.1 christos EMPTY_HOWTO (156),
1088 1.1 christos EMPTY_HOWTO (157),
1089 1.1 christos EMPTY_HOWTO (158),
1090 1.1 christos EMPTY_HOWTO (159),
1091 1.1 christos EMPTY_HOWTO (160),
1092 1.1 christos EMPTY_HOWTO (161),
1093 1.1 christos EMPTY_HOWTO (162),
1094 1.1 christos EMPTY_HOWTO (163),
1095 1.1 christos EMPTY_HOWTO (164),
1096 1.1 christos EMPTY_HOWTO (165),
1097 1.1 christos EMPTY_HOWTO (166),
1098 1.1 christos EMPTY_HOWTO (167),
1099 1.1 christos EMPTY_HOWTO (168),
1100 1.1 christos EMPTY_HOWTO (169),
1101 1.1 christos EMPTY_HOWTO (170),
1102 1.1 christos EMPTY_HOWTO (171),
1103 1.1 christos EMPTY_HOWTO (172),
1104 1.1 christos EMPTY_HOWTO (173),
1105 1.1 christos EMPTY_HOWTO (174),
1106 1.1 christos EMPTY_HOWTO (175),
1107 1.1 christos EMPTY_HOWTO (176),
1108 1.1 christos EMPTY_HOWTO (177),
1109 1.1 christos EMPTY_HOWTO (178),
1110 1.1 christos EMPTY_HOWTO (179),
1111 1.1 christos EMPTY_HOWTO (180),
1112 1.1 christos EMPTY_HOWTO (181),
1113 1.1 christos EMPTY_HOWTO (182),
1114 1.1 christos EMPTY_HOWTO (183),
1115 1.1 christos EMPTY_HOWTO (184),
1116 1.1 christos EMPTY_HOWTO (185),
1117 1.1 christos EMPTY_HOWTO (186),
1118 1.1 christos EMPTY_HOWTO (187),
1119 1.1 christos EMPTY_HOWTO (188),
1120 1.1 christos EMPTY_HOWTO (189),
1121 1.1 christos EMPTY_HOWTO (190),
1122 1.1 christos EMPTY_HOWTO (191),
1123 1.1 christos EMPTY_HOWTO (192),
1124 1.1 christos EMPTY_HOWTO (193),
1125 1.1 christos EMPTY_HOWTO (194),
1126 1.1 christos EMPTY_HOWTO (195),
1127 1.1 christos EMPTY_HOWTO (196),
1128 1.1 christos EMPTY_HOWTO (197),
1129 1.1 christos EMPTY_HOWTO (198),
1130 1.1 christos EMPTY_HOWTO (199),
1131 1.1 christos EMPTY_HOWTO (200),
1132 1.1 christos EMPTY_HOWTO (201),
1133 1.1 christos EMPTY_HOWTO (202),
1134 1.1 christos EMPTY_HOWTO (203),
1135 1.1 christos EMPTY_HOWTO (204),
1136 1.1 christos EMPTY_HOWTO (205),
1137 1.1 christos EMPTY_HOWTO (206),
1138 1.1 christos EMPTY_HOWTO (207),
1139 1.1 christos EMPTY_HOWTO (208),
1140 1.1 christos EMPTY_HOWTO (209),
1141 1.1 christos EMPTY_HOWTO (210),
1142 1.1 christos EMPTY_HOWTO (211),
1143 1.1 christos EMPTY_HOWTO (212),
1144 1.1 christos EMPTY_HOWTO (213),
1145 1.1 christos EMPTY_HOWTO (214),
1146 1.1 christos EMPTY_HOWTO (215),
1147 1.1 christos EMPTY_HOWTO (216),
1148 1.1 christos EMPTY_HOWTO (217),
1149 1.1 christos EMPTY_HOWTO (218),
1150 1.1 christos EMPTY_HOWTO (219),
1151 1.1 christos EMPTY_HOWTO (220),
1152 1.1 christos EMPTY_HOWTO (221),
1153 1.1 christos EMPTY_HOWTO (222),
1154 1.1 christos EMPTY_HOWTO (223),
1155 1.1 christos EMPTY_HOWTO (224),
1156 1.1 christos EMPTY_HOWTO (225),
1157 1.1 christos EMPTY_HOWTO (226),
1158 1.1 christos EMPTY_HOWTO (227),
1159 1.1 christos EMPTY_HOWTO (228),
1160 1.1 christos EMPTY_HOWTO (229),
1161 1.1 christos EMPTY_HOWTO (230),
1162 1.1 christos EMPTY_HOWTO (231),
1163 1.1 christos EMPTY_HOWTO (232),
1164 1.1 christos EMPTY_HOWTO (233),
1165 1.1 christos EMPTY_HOWTO (234),
1166 1.1 christos EMPTY_HOWTO (235),
1167 1.1 christos EMPTY_HOWTO (236),
1168 1.1 christos EMPTY_HOWTO (237),
1169 1.1 christos EMPTY_HOWTO (238),
1170 1.1 christos EMPTY_HOWTO (239),
1171 1.1 christos EMPTY_HOWTO (240),
1172 1.1 christos EMPTY_HOWTO (241),
1173 1.1 christos EMPTY_HOWTO (242),
1174 1.1 christos EMPTY_HOWTO (243),
1175 1.1 christos EMPTY_HOWTO (244),
1176 1.1 christos EMPTY_HOWTO (245),
1177 1.1 christos EMPTY_HOWTO (246),
1178 1.1 christos EMPTY_HOWTO (247),
1179 1.1 christos EMPTY_HOWTO (248),
1180 1.1 christos EMPTY_HOWTO (249),
1181 1.1 christos EMPTY_HOWTO (250),
1182 1.1 christos EMPTY_HOWTO (251),
1183 1.1 christos EMPTY_HOWTO (252),
1184 1.1 christos HOWTO (R_C6000_ALIGN, /* type */
1185 1.1 christos 0, /* rightshift */
1186 1.1 christos 0, /* size (0 = byte, 1 = short, 2 = long) */
1187 1.1 christos 0, /* bitsize */
1188 1.1 christos FALSE, /* pc_relative */
1189 1.1 christos 0, /* bitpos */
1190 1.1 christos complain_overflow_dont,/* complain_on_overflow */
1191 1.1 christos bfd_elf_generic_reloc, /* special_function */
1192 1.1 christos "R_C6000_ALIGN", /* name */
1193 1.1 christos TRUE, /* partial_inplace */
1194 1.1 christos 0, /* src_mask */
1195 1.1 christos 0, /* dst_mask */
1196 1.1 christos FALSE), /* pcrel_offset */
1197 1.1 christos HOWTO (R_C6000_FPHEAD, /* type */
1198 1.1 christos 0, /* rightshift */
1199 1.1 christos 0, /* size (0 = byte, 1 = short, 2 = long) */
1200 1.1 christos 0, /* bitsize */
1201 1.1 christos FALSE, /* pc_relative */
1202 1.1 christos 0, /* bitpos */
1203 1.1 christos complain_overflow_dont,/* complain_on_overflow */
1204 1.1 christos bfd_elf_generic_reloc, /* special_function */
1205 1.1 christos "R_C6000_FPHEAD", /* name */
1206 1.1 christos TRUE, /* partial_inplace */
1207 1.1 christos 0, /* src_mask */
1208 1.1 christos 0, /* dst_mask */
1209 1.1 christos FALSE), /* pcrel_offset */
1210 1.1 christos HOWTO (R_C6000_NOCMP, /* type */
1211 1.1 christos 0, /* rightshift */
1212 1.1 christos 0, /* size (0 = byte, 1 = short, 2 = long) */
1213 1.1 christos 0, /* bitsize */
1214 1.1 christos FALSE, /* pc_relative */
1215 1.1 christos 0, /* bitpos */
1216 1.1 christos complain_overflow_dont,/* complain_on_overflow */
1217 1.1 christos bfd_elf_generic_reloc, /* special_function */
1218 1.1 christos "R_C6000_NOCMP", /* name */
1219 1.1 christos TRUE, /* partial_inplace */
1220 1.1 christos 0, /* src_mask */
1221 1.1 christos 0, /* dst_mask */
1222 1.1 christos FALSE) /* pcrel_offset */
1223 1.1 christos };
1224 1.1 christos
1225 1.1 christos /* Map BFD relocations to ELF relocations. */
1226 1.1 christos
1227 1.1 christos typedef struct
1228 1.1 christos {
1229 1.1 christos bfd_reloc_code_real_type bfd_reloc_val;
1230 1.1 christos enum elf_tic6x_reloc_type elf_reloc_val;
1231 1.1 christos } tic6x_reloc_map;
1232 1.1 christos
1233 1.1 christos static const tic6x_reloc_map elf32_tic6x_reloc_map[] =
1234 1.1 christos {
1235 1.1 christos { BFD_RELOC_NONE, R_C6000_NONE },
1236 1.1 christos { BFD_RELOC_32, R_C6000_ABS32 },
1237 1.1 christos { BFD_RELOC_16, R_C6000_ABS16 },
1238 1.1 christos { BFD_RELOC_8, R_C6000_ABS8 },
1239 1.1 christos { BFD_RELOC_C6000_PCR_S21, R_C6000_PCR_S21 },
1240 1.1 christos { BFD_RELOC_C6000_PCR_S12, R_C6000_PCR_S12 },
1241 1.1 christos { BFD_RELOC_C6000_PCR_S10, R_C6000_PCR_S10 },
1242 1.1 christos { BFD_RELOC_C6000_PCR_S7, R_C6000_PCR_S7 },
1243 1.1 christos { BFD_RELOC_C6000_ABS_S16, R_C6000_ABS_S16 },
1244 1.1 christos { BFD_RELOC_C6000_ABS_L16, R_C6000_ABS_L16 },
1245 1.1 christos { BFD_RELOC_C6000_ABS_H16, R_C6000_ABS_H16 },
1246 1.1 christos { BFD_RELOC_C6000_SBR_U15_B, R_C6000_SBR_U15_B },
1247 1.1 christos { BFD_RELOC_C6000_SBR_U15_H, R_C6000_SBR_U15_H },
1248 1.1 christos { BFD_RELOC_C6000_SBR_U15_W, R_C6000_SBR_U15_W },
1249 1.1 christos { BFD_RELOC_C6000_SBR_S16, R_C6000_SBR_S16 },
1250 1.1 christos { BFD_RELOC_C6000_SBR_L16_B, R_C6000_SBR_L16_B },
1251 1.1 christos { BFD_RELOC_C6000_SBR_L16_H, R_C6000_SBR_L16_H },
1252 1.1 christos { BFD_RELOC_C6000_SBR_L16_W, R_C6000_SBR_L16_W },
1253 1.1 christos { BFD_RELOC_C6000_SBR_H16_B, R_C6000_SBR_H16_B },
1254 1.1 christos { BFD_RELOC_C6000_SBR_H16_H, R_C6000_SBR_H16_H },
1255 1.1 christos { BFD_RELOC_C6000_SBR_H16_W, R_C6000_SBR_H16_W },
1256 1.1 christos { BFD_RELOC_C6000_SBR_GOT_U15_W, R_C6000_SBR_GOT_U15_W },
1257 1.1 christos { BFD_RELOC_C6000_SBR_GOT_L16_W, R_C6000_SBR_GOT_L16_W },
1258 1.1 christos { BFD_RELOC_C6000_SBR_GOT_H16_W, R_C6000_SBR_GOT_H16_W },
1259 1.1 christos { BFD_RELOC_C6000_DSBT_INDEX, R_C6000_DSBT_INDEX },
1260 1.1 christos { BFD_RELOC_C6000_PREL31, R_C6000_PREL31 },
1261 1.1 christos { BFD_RELOC_C6000_COPY, R_C6000_COPY },
1262 1.1 christos { BFD_RELOC_C6000_ALIGN, R_C6000_ALIGN },
1263 1.1 christos { BFD_RELOC_C6000_FPHEAD, R_C6000_FPHEAD },
1264 1.1 christos { BFD_RELOC_C6000_NOCMP, R_C6000_NOCMP }
1265 1.1 christos };
1266 1.1 christos
1267 1.1 christos static reloc_howto_type *
1268 1.1 christos elf32_tic6x_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
1269 1.1 christos {
1270 1.1 christos unsigned int i;
1271 1.1 christos
1272 1.1 christos for (i = 0; i < ARRAY_SIZE (elf32_tic6x_reloc_map); i++)
1273 1.1 christos if (elf32_tic6x_reloc_map[i].bfd_reloc_val == code)
1274 1.1 christos {
1275 1.1 christos enum elf_tic6x_reloc_type elf_reloc_val;
1276 1.1 christos reloc_howto_type *howto;
1277 1.1 christos
1278 1.1 christos elf_reloc_val = elf32_tic6x_reloc_map[i].elf_reloc_val;
1279 1.1 christos if (elf32_tic6x_tdata (abfd)->use_rela_p)
1280 1.1 christos howto = &elf32_tic6x_howto_table[elf_reloc_val];
1281 1.1 christos else
1282 1.1 christos howto = &elf32_tic6x_howto_table_rel[elf_reloc_val];
1283 1.1 christos
1284 1.1 christos /* Some relocations are RELA-only; do not return them for
1285 1.1 christos REL. */
1286 1.1 christos if (howto->name == NULL)
1287 1.1 christos howto = NULL;
1288 1.1 christos
1289 1.1 christos return howto;
1290 1.1 christos }
1291 1.1 christos
1292 1.1 christos return NULL;
1293 1.1 christos }
1294 1.1 christos
1295 1.1 christos static reloc_howto_type *
1296 1.1 christos elf32_tic6x_reloc_name_lookup (bfd *abfd, const char *r_name)
1297 1.1 christos {
1298 1.1 christos if (elf32_tic6x_tdata (abfd)->use_rela_p)
1299 1.1 christos {
1300 1.1 christos unsigned int i;
1301 1.1 christos
1302 1.1 christos for (i = 0; i < ARRAY_SIZE (elf32_tic6x_howto_table); i++)
1303 1.1 christos if (elf32_tic6x_howto_table[i].name != NULL
1304 1.1 christos && strcasecmp (elf32_tic6x_howto_table[i].name, r_name) == 0)
1305 1.1 christos return &elf32_tic6x_howto_table[i];
1306 1.1 christos }
1307 1.1 christos else
1308 1.1 christos {
1309 1.1 christos unsigned int i;
1310 1.1 christos
1311 1.1 christos for (i = 0; i < ARRAY_SIZE (elf32_tic6x_howto_table_rel); i++)
1312 1.1 christos if (elf32_tic6x_howto_table_rel[i].name != NULL
1313 1.1 christos && strcasecmp (elf32_tic6x_howto_table_rel[i].name, r_name) == 0)
1314 1.1 christos return &elf32_tic6x_howto_table_rel[i];
1315 1.1 christos }
1316 1.1 christos
1317 1.1 christos return NULL;
1318 1.1 christos }
1319 1.1 christos
1320 1.1 christos static void
1321 1.1 christos elf32_tic6x_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *bfd_reloc,
1322 1.1 christos Elf_Internal_Rela *elf_reloc)
1323 1.1 christos {
1324 1.1 christos unsigned int r_type;
1325 1.1 christos
1326 1.1 christos r_type = ELF32_R_TYPE (elf_reloc->r_info);
1327 1.1 christos if (r_type >= ARRAY_SIZE (elf32_tic6x_howto_table))
1328 1.1 christos bfd_reloc->howto = NULL;
1329 1.1 christos else
1330 1.1 christos bfd_reloc->howto = &elf32_tic6x_howto_table[r_type];
1331 1.1 christos }
1332 1.1 christos
1333 1.1 christos static void
1334 1.1 christos elf32_tic6x_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, arelent *bfd_reloc,
1335 1.1 christos Elf_Internal_Rela *elf_reloc)
1336 1.1 christos {
1337 1.1 christos unsigned int r_type;
1338 1.1 christos
1339 1.1 christos r_type = ELF32_R_TYPE (elf_reloc->r_info);
1340 1.1 christos if (r_type >= ARRAY_SIZE (elf32_tic6x_howto_table_rel))
1341 1.1 christos bfd_reloc->howto = NULL;
1342 1.1 christos else
1343 1.1 christos bfd_reloc->howto = &elf32_tic6x_howto_table_rel[r_type];
1344 1.1 christos }
1345 1.1 christos
1346 1.1 christos void
1347 1.1 christos elf32_tic6x_set_use_rela_p (bfd *abfd, bfd_boolean use_rela_p)
1348 1.1 christos {
1349 1.1 christos elf32_tic6x_tdata (abfd)->use_rela_p = use_rela_p;
1350 1.1 christos }
1351 1.1 christos
1352 1.1 christos static bfd_boolean
1353 1.1 christos elf32_tic6x_mkobject (bfd *abfd)
1354 1.1 christos {
1355 1.1 christos bfd_boolean ret;
1356 1.1 christos
1357 1.1 christos ret = bfd_elf_allocate_object (abfd, sizeof (struct elf32_tic6x_obj_tdata),
1358 1.1 christos TIC6X_ELF_DATA);
1359 1.1 christos if (ret)
1360 1.1 christos elf32_tic6x_set_use_rela_p (abfd, TRUE);
1361 1.1 christos return ret;
1362 1.1 christos }
1363 1.1 christos
1364 1.1 christos static bfd_boolean
1365 1.1 christos elf32_tic6x_new_section_hook (bfd *abfd, asection *sec)
1366 1.1 christos {
1367 1.1 christos bfd_boolean ret;
1368 1.1 christos
1369 1.1 christos ret = _bfd_elf_new_section_hook (abfd, sec);
1370 1.1 christos sec->use_rela_p = elf32_tic6x_tdata (abfd)->use_rela_p;
1371 1.1 christos
1372 1.1 christos return ret;
1373 1.1 christos }
1374 1.1 christos
1375 1.1 christos /* Return true if relocation REL against section SEC is a REL rather
1376 1.1 christos than RELA relocation. RELOCS is the first relocation in the
1377 1.1 christos section and ABFD is the bfd that contains SEC. */
1378 1.1 christos
1379 1.1 christos static bfd_boolean
1380 1.1 christos elf32_tic6x_rel_relocation_p (bfd *abfd, asection *sec,
1381 1.1 christos const Elf_Internal_Rela *relocs,
1382 1.1 christos const Elf_Internal_Rela *rel)
1383 1.1 christos {
1384 1.1 christos Elf_Internal_Shdr *rel_hdr;
1385 1.1 christos const struct elf_backend_data *bed;
1386 1.1 christos
1387 1.1 christos /* To determine which flavor of relocation this is, we depend on the
1388 1.1 christos fact that the INPUT_SECTION's REL_HDR is read before RELA_HDR. */
1389 1.1 christos rel_hdr = elf_section_data (sec)->rel.hdr;
1390 1.1 christos if (rel_hdr == NULL)
1391 1.1 christos return FALSE;
1392 1.1 christos bed = get_elf_backend_data (abfd);
1393 1.1 christos return ((size_t) (rel - relocs)
1394 1.1 christos < NUM_SHDR_ENTRIES (rel_hdr) * bed->s->int_rels_per_ext_rel);
1395 1.1 christos }
1396 1.1 christos
1397 1.1 christos static bfd_boolean
1398 1.1 christos elf32_tic6x_relocate_section (bfd *output_bfd,
1399 1.1 christos struct bfd_link_info *info,
1400 1.1 christos bfd *input_bfd,
1401 1.1 christos asection *input_section,
1402 1.1 christos bfd_byte *contents,
1403 1.1 christos Elf_Internal_Rela *relocs,
1404 1.1 christos Elf_Internal_Sym *local_syms,
1405 1.1 christos asection **local_sections)
1406 1.1 christos {
1407 1.1 christos Elf_Internal_Shdr *symtab_hdr;
1408 1.1 christos struct elf_link_hash_entry **sym_hashes;
1409 1.1 christos Elf_Internal_Rela *rel;
1410 1.1 christos Elf_Internal_Rela *relend;
1411 1.1 christos bfd_boolean ok = TRUE;
1412 1.1 christos
1413 1.1 christos symtab_hdr = & elf_symtab_hdr (input_bfd);
1414 1.1 christos sym_hashes = elf_sym_hashes (input_bfd);
1415 1.1 christos
1416 1.1 christos relend = relocs + input_section->reloc_count;
1417 1.1 christos
1418 1.1 christos for (rel = relocs; rel < relend; rel ++)
1419 1.1 christos {
1420 1.1 christos int r_type;
1421 1.1 christos unsigned long r_symndx;
1422 1.1 christos arelent bfd_reloc;
1423 1.1 christos reloc_howto_type *howto;
1424 1.1 christos Elf_Internal_Sym *sym;
1425 1.1 christos asection *sec;
1426 1.1 christos struct elf_link_hash_entry *h;
1427 1.1 christos bfd_vma relocation;
1428 1.1 christos bfd_boolean unresolved_reloc;
1429 1.1 christos bfd_reloc_status_type r;
1430 1.1 christos struct bfd_link_hash_entry *sbh;
1431 1.1 christos bfd_boolean is_rel;
1432 1.1 christos
1433 1.1 christos r_type = ELF32_R_TYPE (rel->r_info);
1434 1.1 christos r_symndx = ELF32_R_SYM (rel->r_info);
1435 1.1 christos
1436 1.1 christos is_rel = elf32_tic6x_rel_relocation_p (input_bfd, input_section,
1437 1.1 christos relocs, rel);
1438 1.1 christos
1439 1.1 christos if (is_rel)
1440 1.1 christos elf32_tic6x_info_to_howto_rel (input_bfd, &bfd_reloc, rel);
1441 1.1 christos else
1442 1.1 christos elf32_tic6x_info_to_howto (input_bfd, &bfd_reloc, rel);
1443 1.1 christos howto = bfd_reloc.howto;
1444 1.1 christos if (howto == NULL)
1445 1.1 christos {
1446 1.1 christos bfd_set_error (bfd_error_bad_value);
1447 1.1 christos return FALSE;
1448 1.1 christos }
1449 1.1 christos
1450 1.1 christos h = NULL;
1451 1.1 christos sym = NULL;
1452 1.1 christos sec = NULL;
1453 1.1 christos unresolved_reloc = FALSE;
1454 1.1 christos
1455 1.1 christos if (r_symndx < symtab_hdr->sh_info)
1456 1.1 christos {
1457 1.1 christos sym = local_syms + r_symndx;
1458 1.1 christos sec = local_sections[r_symndx];
1459 1.1 christos relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1460 1.1 christos }
1461 1.1 christos else
1462 1.1 christos {
1463 1.1 christos bfd_boolean warned;
1464 1.1 christos
1465 1.1 christos RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
1466 1.1 christos r_symndx, symtab_hdr, sym_hashes,
1467 1.1 christos h, sec, relocation,
1468 1.1 christos unresolved_reloc, warned);
1469 1.1 christos }
1470 1.1 christos
1471 1.1 christos if (sec != NULL && elf_discarded_section (sec))
1472 1.1 christos RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
1473 1.1 christos rel, relend, howto, contents);
1474 1.1 christos
1475 1.1 christos if (info->relocatable)
1476 1.1 christos {
1477 1.1 christos if (is_rel
1478 1.1 christos && sym != NULL
1479 1.1 christos && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
1480 1.1 christos {
1481 1.1 christos rel->r_addend = 0;
1482 1.1 christos relocation = sec->output_offset + sym->st_value;
1483 1.1 christos r = _bfd_relocate_contents (howto, input_bfd, relocation,
1484 1.1 christos contents + rel->r_offset);
1485 1.1 christos goto done_reloc;
1486 1.1 christos }
1487 1.1 christos continue;
1488 1.1 christos }
1489 1.1 christos
1490 1.1 christos switch (r_type)
1491 1.1 christos {
1492 1.1 christos case R_C6000_NONE:
1493 1.1 christos case R_C6000_ALIGN:
1494 1.1 christos case R_C6000_FPHEAD:
1495 1.1 christos case R_C6000_NOCMP:
1496 1.1 christos /* No action needed. */
1497 1.1 christos continue;
1498 1.1 christos
1499 1.1 christos case R_C6000_PCR_S21:
1500 1.1 christos case R_C6000_PCR_S12:
1501 1.1 christos case R_C6000_PCR_S10:
1502 1.1 christos case R_C6000_PCR_S7:
1503 1.1 christos /* Generic PC-relative handling produces a value relative to
1504 1.1 christos the exact location of the relocation. Adjust it to be
1505 1.1 christos relative to the start of the fetch packet instead. */
1506 1.1 christos relocation += (input_section->output_section->vma
1507 1.1 christos + input_section->output_offset
1508 1.1 christos + rel->r_offset) & 0x1f;
1509 1.1 christos /* Fall through. */
1510 1.1 christos case R_C6000_ABS32:
1511 1.1 christos case R_C6000_ABS16:
1512 1.1 christos case R_C6000_ABS8:
1513 1.1 christos case R_C6000_ABS_S16:
1514 1.1 christos case R_C6000_ABS_L16:
1515 1.1 christos case R_C6000_ABS_H16:
1516 1.1 christos /* Generic logic OK. */
1517 1.1 christos break;
1518 1.1 christos
1519 1.1 christos case R_C6000_SBR_U15_B:
1520 1.1 christos case R_C6000_SBR_U15_H:
1521 1.1 christos case R_C6000_SBR_U15_W:
1522 1.1 christos case R_C6000_SBR_S16:
1523 1.1 christos case R_C6000_SBR_L16_B:
1524 1.1 christos case R_C6000_SBR_L16_H:
1525 1.1 christos case R_C6000_SBR_L16_W:
1526 1.1 christos case R_C6000_SBR_H16_B:
1527 1.1 christos case R_C6000_SBR_H16_H:
1528 1.1 christos case R_C6000_SBR_H16_W:
1529 1.1 christos sbh = bfd_link_hash_lookup (info->hash, "__c6xabi_DSBT_BASE",
1530 1.1 christos FALSE, FALSE, TRUE);
1531 1.1 christos if (sbh != NULL
1532 1.1 christos && (sbh->type == bfd_link_hash_defined
1533 1.1 christos || sbh->type == bfd_link_hash_defweak))
1534 1.1 christos relocation -= (sbh->u.def.value
1535 1.1 christos + sbh->u.def.section->output_section->vma
1536 1.1 christos + sbh->u.def.section->output_offset);
1537 1.1 christos else
1538 1.1 christos {
1539 1.1 christos (*_bfd_error_handler) (_("%B: SB-relative relocation but "
1540 1.1 christos "__c6xabi_DSBT_BASE not defined"),
1541 1.1 christos input_bfd);
1542 1.1 christos ok = FALSE;
1543 1.1 christos continue;
1544 1.1 christos }
1545 1.1 christos break;
1546 1.1 christos
1547 1.1 christos case R_C6000_SBR_GOT_U15_W:
1548 1.1 christos case R_C6000_SBR_GOT_L16_W:
1549 1.1 christos case R_C6000_SBR_GOT_H16_W:
1550 1.1 christos case R_C6000_DSBT_INDEX:
1551 1.1 christos case R_C6000_PREL31:
1552 1.1 christos /* Shared libraries and exception handling support not
1553 1.1 christos implemented. */
1554 1.1 christos (*_bfd_error_handler) (_("%B: relocation type %d not implemented"),
1555 1.1 christos input_bfd, r_type);
1556 1.1 christos ok = FALSE;
1557 1.1 christos continue;
1558 1.1 christos
1559 1.1 christos case R_C6000_COPY:
1560 1.1 christos /* Invalid in relocatable object. */
1561 1.1 christos default:
1562 1.1 christos /* Unknown relocation. */
1563 1.1 christos (*_bfd_error_handler) (_("%B: invalid relocation type %d"),
1564 1.1 christos input_bfd, r_type);
1565 1.1 christos ok = FALSE;
1566 1.1 christos continue;
1567 1.1 christos }
1568 1.1 christos
1569 1.1 christos r = _bfd_final_link_relocate (howto, input_bfd, input_section,
1570 1.1 christos contents, rel->r_offset,
1571 1.1 christos relocation, rel->r_addend);
1572 1.1 christos
1573 1.1 christos done_reloc:
1574 1.1 christos if (r == bfd_reloc_ok
1575 1.1 christos && howto->complain_on_overflow == complain_overflow_bitfield)
1576 1.1 christos {
1577 1.1 christos /* Generic overflow handling accepts cases the ABI says
1578 1.1 christos should be rejected for R_C6000_ABS16 and
1579 1.1 christos R_C6000_ABS8. */
1580 1.1 christos bfd_vma value = (relocation + rel->r_addend) & 0xffffffff;
1581 1.1 christos bfd_vma sbit = 1 << (howto->bitsize - 1);
1582 1.1 christos bfd_vma sbits = (-(bfd_vma) sbit) & 0xffffffff;
1583 1.1 christos bfd_vma value_sbits = value & sbits;
1584 1.1 christos
1585 1.1 christos if (value_sbits != 0
1586 1.1 christos && value_sbits != sbit
1587 1.1 christos && value_sbits != sbits)
1588 1.1 christos r = bfd_reloc_overflow;
1589 1.1 christos }
1590 1.1 christos
1591 1.1 christos if (r != bfd_reloc_ok)
1592 1.1 christos {
1593 1.1 christos const char *name;
1594 1.1 christos const char *error_message;
1595 1.1 christos
1596 1.1 christos if (h != NULL)
1597 1.1 christos name = h->root.root.string;
1598 1.1 christos else
1599 1.1 christos {
1600 1.1 christos name = bfd_elf_string_from_elf_section (input_bfd,
1601 1.1 christos symtab_hdr->sh_link,
1602 1.1 christos sym->st_name);
1603 1.1 christos if (name == NULL)
1604 1.1 christos return FALSE;
1605 1.1 christos if (*name == '\0')
1606 1.1 christos name = bfd_section_name (input_bfd, sec);
1607 1.1 christos }
1608 1.1 christos
1609 1.1 christos switch (r)
1610 1.1 christos {
1611 1.1 christos case bfd_reloc_overflow:
1612 1.1 christos /* If the overflowing reloc was to an undefined symbol,
1613 1.1 christos we have already printed one error message and there
1614 1.1 christos is no point complaining again. */
1615 1.1 christos if ((! h ||
1616 1.1 christos h->root.type != bfd_link_hash_undefined)
1617 1.1 christos && (!((*info->callbacks->reloc_overflow)
1618 1.1 christos (info, (h ? &h->root : NULL), name, howto->name,
1619 1.1 christos (bfd_vma) 0, input_bfd, input_section,
1620 1.1 christos rel->r_offset))))
1621 1.1 christos return FALSE;
1622 1.1 christos break;
1623 1.1 christos
1624 1.1 christos case bfd_reloc_undefined:
1625 1.1 christos if (!((*info->callbacks->undefined_symbol)
1626 1.1 christos (info, name, input_bfd, input_section,
1627 1.1 christos rel->r_offset, TRUE)))
1628 1.1 christos return FALSE;
1629 1.1 christos break;
1630 1.1 christos
1631 1.1 christos case bfd_reloc_outofrange:
1632 1.1 christos error_message = _("out of range");
1633 1.1 christos goto common_error;
1634 1.1 christos
1635 1.1 christos case bfd_reloc_notsupported:
1636 1.1 christos error_message = _("unsupported relocation");
1637 1.1 christos goto common_error;
1638 1.1 christos
1639 1.1 christos case bfd_reloc_dangerous:
1640 1.1 christos error_message = _("dangerous relocation");
1641 1.1 christos goto common_error;
1642 1.1 christos
1643 1.1 christos default:
1644 1.1 christos error_message = _("unknown error");
1645 1.1 christos /* Fall through. */
1646 1.1 christos
1647 1.1 christos common_error:
1648 1.1 christos BFD_ASSERT (error_message != NULL);
1649 1.1 christos if (!((*info->callbacks->reloc_dangerous)
1650 1.1 christos (info, error_message, input_bfd, input_section,
1651 1.1 christos rel->r_offset)))
1652 1.1 christos return FALSE;
1653 1.1 christos break;
1654 1.1 christos }
1655 1.1 christos }
1656 1.1 christos }
1657 1.1 christos
1658 1.1 christos return ok;
1659 1.1 christos }
1660 1.1 christos
1661 1.1 christos static int
1662 1.1 christos elf32_tic6x_obj_attrs_arg_type (int tag)
1663 1.1 christos {
1664 1.1 christos if (tag == Tag_ABI_compatibility)
1665 1.1 christos return ATTR_TYPE_FLAG_INT_VAL | ATTR_TYPE_FLAG_STR_VAL;
1666 1.1 christos else if (tag & 1)
1667 1.1 christos return ATTR_TYPE_FLAG_STR_VAL;
1668 1.1 christos else
1669 1.1 christos return ATTR_TYPE_FLAG_INT_VAL;
1670 1.1 christos }
1671 1.1 christos
1672 1.1 christos static int
1673 1.1 christos elf32_tic6x_obj_attrs_order (int num)
1674 1.1 christos {
1675 1.1 christos if (num == LEAST_KNOWN_OBJ_ATTRIBUTE)
1676 1.1 christos return Tag_ABI_conformance;
1677 1.1 christos if ((num - 1) < Tag_ABI_conformance)
1678 1.1 christos return num - 1;
1679 1.1 christos return num;
1680 1.1 christos }
1681 1.1 christos
1682 1.1 christos /* Merge the Tag_ISA attribute values ARCH1 and ARCH2
1683 1.1 christos and return the merged value. At present, all merges succeed, so no
1684 1.1 christos return value for errors is defined. */
1685 1.1 christos
1686 1.1 christos int
1687 1.1 christos elf32_tic6x_merge_arch_attributes (int arch1, int arch2)
1688 1.1 christos {
1689 1.1 christos int min_arch, max_arch;
1690 1.1 christos
1691 1.1 christos min_arch = (arch1 < arch2 ? arch1 : arch2);
1692 1.1 christos max_arch = (arch1 > arch2 ? arch1 : arch2);
1693 1.1 christos
1694 1.1 christos /* In most cases, the numerically greatest value is the correct
1695 1.1 christos merged value, but merging C64 and C67 results in C674X. */
1696 1.1 christos if ((min_arch == C6XABI_Tag_ISA_C67X
1697 1.1 christos || min_arch == C6XABI_Tag_ISA_C67XP)
1698 1.1 christos && (max_arch == C6XABI_Tag_ISA_C64X
1699 1.1 christos || max_arch == C6XABI_Tag_ISA_C64XP))
1700 1.1 christos return C6XABI_Tag_ISA_C674X;
1701 1.1 christos
1702 1.1 christos return max_arch;
1703 1.1 christos }
1704 1.1 christos
1705 1.1 christos /* Convert a Tag_ABI_array_object_alignment or
1706 1.1 christos Tag_ABI_array_object_align_expected tag value TAG to a
1707 1.1 christos corresponding alignment value; return the alignment, or -1 for an
1708 1.1 christos unknown tag value. */
1709 1.1 christos
1710 1.1 christos static int
1711 1.1 christos elf32_tic6x_tag_to_array_alignment (int tag)
1712 1.1 christos {
1713 1.1 christos switch (tag)
1714 1.1 christos {
1715 1.1 christos case 0:
1716 1.1 christos return 8;
1717 1.1 christos
1718 1.1 christos case 1:
1719 1.1 christos return 4;
1720 1.1 christos
1721 1.1 christos case 2:
1722 1.1 christos return 16;
1723 1.1 christos
1724 1.1 christos default:
1725 1.1 christos return -1;
1726 1.1 christos }
1727 1.1 christos }
1728 1.1 christos
1729 1.1 christos /* Convert a Tag_ABI_array_object_alignment or
1730 1.1 christos Tag_ABI_array_object_align_expected alignment ALIGN to a
1731 1.1 christos corresponding tag value; return the tag value. */
1732 1.1 christos
1733 1.1 christos static int
1734 1.1 christos elf32_tic6x_array_alignment_to_tag (int align)
1735 1.1 christos {
1736 1.1 christos switch (align)
1737 1.1 christos {
1738 1.1 christos case 8:
1739 1.1 christos return 0;
1740 1.1 christos
1741 1.1 christos case 4:
1742 1.1 christos return 1;
1743 1.1 christos
1744 1.1 christos case 16:
1745 1.1 christos return 2;
1746 1.1 christos
1747 1.1 christos default:
1748 1.1 christos abort ();
1749 1.1 christos }
1750 1.1 christos }
1751 1.1 christos
1752 1.1 christos /* Merge attributes from IBFD and OBFD, returning TRUE if the merge
1753 1.1 christos succeeded, FALSE otherwise. */
1754 1.1 christos
1755 1.1 christos static bfd_boolean
1756 1.1 christos elf32_tic6x_merge_attributes (bfd *ibfd, bfd *obfd)
1757 1.1 christos {
1758 1.1 christos bfd_boolean result = TRUE;
1759 1.1 christos obj_attribute *in_attr;
1760 1.1 christos obj_attribute *out_attr;
1761 1.1 christos int i;
1762 1.1 christos int array_align_in, array_align_out, array_expect_in, array_expect_out;
1763 1.1 christos
1764 1.1 christos if (!elf_known_obj_attributes_proc (obfd)[0].i)
1765 1.1 christos {
1766 1.1 christos /* This is the first object. Copy the attributes. */
1767 1.1 christos _bfd_elf_copy_obj_attributes (ibfd, obfd);
1768 1.1 christos
1769 1.1 christos out_attr = elf_known_obj_attributes_proc (obfd);
1770 1.1 christos
1771 1.1 christos /* Use the Tag_null value to indicate the attributes have been
1772 1.1 christos initialized. */
1773 1.1 christos out_attr[0].i = 1;
1774 1.1 christos
1775 1.1 christos return TRUE;
1776 1.1 christos }
1777 1.1 christos
1778 1.1 christos in_attr = elf_known_obj_attributes_proc (ibfd);
1779 1.1 christos out_attr = elf_known_obj_attributes_proc (obfd);
1780 1.1 christos
1781 1.1 christos /* No specification yet for handling of unknown attributes, so just
1782 1.1 christos ignore them and handle known ones. */
1783 1.1 christos
1784 1.1 christos if (out_attr[Tag_ABI_stack_align_preserved].i
1785 1.1 christos < in_attr[Tag_ABI_stack_align_needed].i)
1786 1.1 christos {
1787 1.1 christos _bfd_error_handler
1788 1.1 christos (_("error: %B requires more stack alignment than %B preserves"),
1789 1.1 christos ibfd, obfd);
1790 1.1 christos result = FALSE;
1791 1.1 christos }
1792 1.1 christos if (in_attr[Tag_ABI_stack_align_preserved].i
1793 1.1 christos < out_attr[Tag_ABI_stack_align_needed].i)
1794 1.1 christos {
1795 1.1 christos _bfd_error_handler
1796 1.1 christos (_("error: %B requires more stack alignment than %B preserves"),
1797 1.1 christos obfd, ibfd);
1798 1.1 christos result = FALSE;
1799 1.1 christos }
1800 1.1 christos
1801 1.1 christos array_align_in = elf32_tic6x_tag_to_array_alignment
1802 1.1 christos (in_attr[Tag_ABI_array_object_alignment].i);
1803 1.1 christos if (array_align_in == -1)
1804 1.1 christos {
1805 1.1 christos _bfd_error_handler
1806 1.1 christos (_("error: unknown Tag_ABI_array_object_alignment value in %B"),
1807 1.1 christos ibfd);
1808 1.1 christos result = FALSE;
1809 1.1 christos }
1810 1.1 christos array_align_out = elf32_tic6x_tag_to_array_alignment
1811 1.1 christos (out_attr[Tag_ABI_array_object_alignment].i);
1812 1.1 christos if (array_align_out == -1)
1813 1.1 christos {
1814 1.1 christos _bfd_error_handler
1815 1.1 christos (_("error: unknown Tag_ABI_array_object_alignment value in %B"),
1816 1.1 christos obfd);
1817 1.1 christos result = FALSE;
1818 1.1 christos }
1819 1.1 christos array_expect_in = elf32_tic6x_tag_to_array_alignment
1820 1.1 christos (in_attr[Tag_ABI_array_object_align_expected].i);
1821 1.1 christos if (array_expect_in == -1)
1822 1.1 christos {
1823 1.1 christos _bfd_error_handler
1824 1.1 christos (_("error: unknown Tag_ABI_array_object_align_expected value in %B"),
1825 1.1 christos ibfd);
1826 1.1 christos result = FALSE;
1827 1.1 christos }
1828 1.1 christos array_expect_out = elf32_tic6x_tag_to_array_alignment
1829 1.1 christos (out_attr[Tag_ABI_array_object_align_expected].i);
1830 1.1 christos if (array_expect_out == -1)
1831 1.1 christos {
1832 1.1 christos _bfd_error_handler
1833 1.1 christos (_("error: unknown Tag_ABI_array_object_align_expected value in %B"),
1834 1.1 christos obfd);
1835 1.1 christos result = FALSE;
1836 1.1 christos }
1837 1.1 christos
1838 1.1 christos if (array_align_out < array_expect_in)
1839 1.1 christos {
1840 1.1 christos _bfd_error_handler
1841 1.1 christos (_("error: %B requires more array alignment than %B preserves"),
1842 1.1 christos ibfd, obfd);
1843 1.1 christos result = FALSE;
1844 1.1 christos }
1845 1.1 christos if (array_align_in < array_expect_out)
1846 1.1 christos {
1847 1.1 christos _bfd_error_handler
1848 1.1 christos (_("error: %B requires more array alignment than %B preserves"),
1849 1.1 christos obfd, ibfd);
1850 1.1 christos result = FALSE;
1851 1.1 christos }
1852 1.1 christos
1853 1.1 christos for (i = LEAST_KNOWN_OBJ_ATTRIBUTE; i < NUM_KNOWN_OBJ_ATTRIBUTES; i++)
1854 1.1 christos {
1855 1.1 christos switch (i)
1856 1.1 christos {
1857 1.1 christos case Tag_ISA:
1858 1.1 christos out_attr[i].i = elf32_tic6x_merge_arch_attributes (in_attr[i].i,
1859 1.1 christos out_attr[i].i);
1860 1.1 christos break;
1861 1.1 christos
1862 1.1 christos case Tag_ABI_wchar_t:
1863 1.1 christos if (out_attr[i].i == 0)
1864 1.1 christos out_attr[i].i = in_attr[i].i;
1865 1.1 christos if (out_attr[i].i != 0
1866 1.1 christos && in_attr[i].i != 0
1867 1.1 christos && out_attr[i].i != in_attr[i].i)
1868 1.1 christos {
1869 1.1 christos _bfd_error_handler
1870 1.1 christos (_("warning: %B and %B differ in wchar_t size"), obfd, ibfd);
1871 1.1 christos }
1872 1.1 christos break;
1873 1.1 christos
1874 1.1 christos case Tag_ABI_stack_align_needed:
1875 1.1 christos if (out_attr[i].i < in_attr[i].i)
1876 1.1 christos out_attr[i].i = in_attr[i].i;
1877 1.1 christos break;
1878 1.1 christos
1879 1.1 christos case Tag_ABI_stack_align_preserved:
1880 1.1 christos if (out_attr[i].i > in_attr[i].i)
1881 1.1 christos out_attr[i].i = in_attr[i].i;
1882 1.1 christos break;
1883 1.1 christos
1884 1.1 christos case Tag_ABI_DSBT:
1885 1.1 christos if (out_attr[i].i != in_attr[i].i)
1886 1.1 christos {
1887 1.1 christos _bfd_error_handler
1888 1.1 christos (_("warning: %B and %B differ in whether code is "
1889 1.1 christos "compiled for DSBT"),
1890 1.1 christos obfd, ibfd);
1891 1.1 christos }
1892 1.1 christos break;
1893 1.1 christos
1894 1.1 christos case Tag_ABI_PID:
1895 1.1 christos if (out_attr[i].i != in_attr[i].i)
1896 1.1 christos {
1897 1.1 christos _bfd_error_handler
1898 1.1 christos (_("warning: %B and %B differ in position-dependence of "
1899 1.1 christos "data addressing"),
1900 1.1 christos obfd, ibfd);
1901 1.1 christos }
1902 1.1 christos break;
1903 1.1 christos
1904 1.1 christos case Tag_ABI_PIC:
1905 1.1 christos if (out_attr[i].i != in_attr[i].i)
1906 1.1 christos {
1907 1.1 christos _bfd_error_handler
1908 1.1 christos (_("warning: %B and %B differ in position-dependence of "
1909 1.1 christos "code addressing"),
1910 1.1 christos obfd, ibfd);
1911 1.1 christos }
1912 1.1 christos break;
1913 1.1 christos
1914 1.1 christos case Tag_ABI_array_object_alignment:
1915 1.1 christos if (array_align_out != -1
1916 1.1 christos && array_align_in != -1
1917 1.1 christos && array_align_out > array_align_in)
1918 1.1 christos out_attr[i].i
1919 1.1 christos = elf32_tic6x_array_alignment_to_tag (array_align_in);
1920 1.1 christos break;
1921 1.1 christos
1922 1.1 christos case Tag_ABI_array_object_align_expected:
1923 1.1 christos if (array_expect_out != -1
1924 1.1 christos && array_expect_in != -1
1925 1.1 christos && array_expect_out < array_expect_in)
1926 1.1 christos out_attr[i].i
1927 1.1 christos = elf32_tic6x_array_alignment_to_tag (array_expect_in);
1928 1.1 christos break;
1929 1.1 christos
1930 1.1 christos case Tag_ABI_conformance:
1931 1.1 christos /* Merging for this attribute is not specified. As on ARM,
1932 1.1 christos treat a missing attribute as no claim to conform and only
1933 1.1 christos merge identical values. */
1934 1.1 christos if (out_attr[i].s == NULL
1935 1.1 christos || in_attr[i].s == NULL
1936 1.1 christos || strcmp (out_attr[i].s,
1937 1.1 christos in_attr[i].s) != 0)
1938 1.1 christos out_attr[i].s = NULL;
1939 1.1 christos break;
1940 1.1 christos
1941 1.1 christos default:
1942 1.1 christos break;
1943 1.1 christos }
1944 1.1 christos
1945 1.1 christos if (in_attr[i].type && !out_attr[i].type)
1946 1.1 christos out_attr[i].type = in_attr[i].type;
1947 1.1 christos }
1948 1.1 christos
1949 1.1 christos /* Merge Tag_ABI_compatibility attributes and any common GNU ones. */
1950 1.1 christos if (!_bfd_elf_merge_object_attributes (ibfd, obfd))
1951 1.1 christos return FALSE;
1952 1.1 christos
1953 1.1 christos return result;
1954 1.1 christos }
1955 1.1 christos
1956 1.1 christos static bfd_boolean
1957 1.1 christos elf32_tic6x_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
1958 1.1 christos {
1959 1.1 christos if (!_bfd_generic_verify_endian_match (ibfd, obfd))
1960 1.1 christos return FALSE;
1961 1.1 christos
1962 1.1 christos if (!elf32_tic6x_merge_attributes (ibfd, obfd))
1963 1.1 christos return FALSE;
1964 1.1 christos
1965 1.1 christos return TRUE;
1966 1.1 christos }
1967 1.1 christos
1968 1.1 christos
1969 1.1 christos #define TARGET_LITTLE_SYM bfd_elf32_tic6x_le_vec
1970 1.1 christos #define TARGET_LITTLE_NAME "elf32-tic6x-le"
1971 1.1 christos #define TARGET_BIG_SYM bfd_elf32_tic6x_be_vec
1972 1.1 christos #define TARGET_BIG_NAME "elf32-tic6x-be"
1973 1.1 christos #define ELF_ARCH bfd_arch_tic6x
1974 1.1 christos #define ELF_TARGET_ID TIC6X_ELF_DATA
1975 1.1 christos #define ELF_MACHINE_CODE EM_TI_C6000
1976 1.1 christos #define ELF_MAXPAGESIZE 1
1977 1.1 christos #define bfd_elf32_bfd_reloc_type_lookup elf32_tic6x_reloc_type_lookup
1978 1.1 christos #define bfd_elf32_bfd_reloc_name_lookup elf32_tic6x_reloc_name_lookup
1979 1.1 christos #define bfd_elf32_bfd_merge_private_bfd_data elf32_tic6x_merge_private_bfd_data
1980 1.1 christos #define bfd_elf32_mkobject elf32_tic6x_mkobject
1981 1.1 christos #define bfd_elf32_new_section_hook elf32_tic6x_new_section_hook
1982 1.1 christos #define elf_backend_can_gc_sections 1
1983 1.1 christos #define elf_backend_default_use_rela_p 1
1984 1.1 christos #define elf_backend_may_use_rel_p 1
1985 1.1 christos #define elf_backend_may_use_rela_p 1
1986 1.1 christos #define elf_backend_obj_attrs_arg_type elf32_tic6x_obj_attrs_arg_type
1987 1.1 christos #define elf_backend_obj_attrs_order elf32_tic6x_obj_attrs_order
1988 1.1 christos #define elf_backend_obj_attrs_section ".c6xabi.attributes"
1989 1.1 christos #define elf_backend_obj_attrs_section_type SHT_C6000_ATTRIBUTES
1990 1.1 christos #define elf_backend_obj_attrs_vendor "c6xabi"
1991 1.1 christos #define elf_backend_rela_normal 1
1992 1.1 christos #define elf_backend_relocate_section elf32_tic6x_relocate_section
1993 1.1 christos #define elf_info_to_howto elf32_tic6x_info_to_howto
1994 1.1 christos #define elf_info_to_howto_rel elf32_tic6x_info_to_howto_rel
1995 1.1 christos
1996 1.1 christos #include "elf32-target.h"
1997