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