OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [bfd/] [elf32-tic6x.c] - Blame information for rev 330

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.