source: trunk/src/binutils/bfd/elf32-sh.c@ 881

Last change on this file since 881 was 610, checked in by bird, 22 years ago

This commit was generated by cvs2svn to compensate for changes in r609,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 215.3 KB
Line 
1/* Renesas / SuperH SH specific support for 32-bit ELF
2 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
3 Free Software Foundation, Inc.
4 Contributed by Ian Lance Taylor, Cygnus Support.
5
6 This file is part of BFD, the Binary File Descriptor library.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
21
22#include "bfd.h"
23#include "sysdep.h"
24#include "bfdlink.h"
25#include "libbfd.h"
26#include "elf-bfd.h"
27#include "elf/sh.h"
28
29static bfd_reloc_status_type sh_elf_reloc
30 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
31static bfd_reloc_status_type sh_elf_ignore_reloc
32 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
33static reloc_howto_type *sh_elf_reloc_type_lookup
34 PARAMS ((bfd *, bfd_reloc_code_real_type));
35static void sh_elf_info_to_howto
36 PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
37static bfd_boolean sh_elf_set_private_flags
38 PARAMS ((bfd *, flagword));
39static bfd_boolean sh_elf_copy_private_data
40 PARAMS ((bfd *, bfd *));
41static bfd_boolean sh_elf_merge_private_data
42 PARAMS ((bfd *, bfd *));
43static bfd_boolean sh_elf_set_mach_from_flags
44 PARAMS ((bfd *));
45static bfd_boolean sh_elf_relax_section
46 PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
47static bfd_boolean sh_elf_relax_delete_bytes
48 PARAMS ((bfd *, asection *, bfd_vma, int));
49static bfd_boolean sh_elf_align_loads
50 PARAMS ((bfd *, asection *, Elf_Internal_Rela *, bfd_byte *, bfd_boolean *));
51static bfd_boolean sh_elf_swap_insns
52 PARAMS ((bfd *, asection *, PTR, bfd_byte *, bfd_vma));
53static bfd_boolean sh_elf_relocate_section
54 PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
55 Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
56static bfd_byte *sh_elf_get_relocated_section_contents
57 PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
58 bfd_byte *, bfd_boolean, asymbol **));
59static void sh_elf_copy_indirect_symbol
60 PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
61 struct elf_link_hash_entry *));
62static int sh_elf_optimized_tls_reloc
63 PARAMS ((struct bfd_link_info *, int, int));
64static bfd_boolean sh_elf_mkobject
65 PARAMS ((bfd *));
66static bfd_boolean sh_elf_object_p
67 PARAMS ((bfd *));
68static bfd_boolean sh_elf_check_relocs
69 PARAMS ((bfd *, struct bfd_link_info *, asection *,
70 const Elf_Internal_Rela *));
71static struct bfd_hash_entry *sh_elf_link_hash_newfunc
72 PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
73static struct bfd_link_hash_table *sh_elf_link_hash_table_create
74 PARAMS ((bfd *));
75static bfd_boolean sh_elf_adjust_dynamic_symbol
76 PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
77static bfd_boolean sh_elf_size_dynamic_sections
78 PARAMS ((bfd *, struct bfd_link_info *));
79static bfd_boolean sh_elf_finish_dynamic_symbol
80 PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
81 Elf_Internal_Sym *));
82static bfd_boolean sh_elf_finish_dynamic_sections
83 PARAMS ((bfd *, struct bfd_link_info *));
84static bfd_reloc_status_type sh_elf_reloc_loop
85 PARAMS ((int, bfd *, asection *, bfd_byte *, bfd_vma, asection *,
86 bfd_vma, bfd_vma));
87static bfd_boolean create_got_section
88 PARAMS ((bfd *, struct bfd_link_info *));
89static bfd_boolean sh_elf_create_dynamic_sections
90 PARAMS ((bfd *, struct bfd_link_info *));
91static bfd_vma dtpoff_base
92 PARAMS ((struct bfd_link_info *));
93static bfd_vma tpoff
94 PARAMS ((struct bfd_link_info *, bfd_vma));
95static asection * sh_elf_gc_mark_hook
96 PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
97 struct elf_link_hash_entry *, Elf_Internal_Sym *));
98static bfd_boolean sh_elf_gc_sweep_hook
99 PARAMS ((bfd *, struct bfd_link_info *, asection *,
100 const Elf_Internal_Rela *));
101static bfd_boolean allocate_dynrelocs
102 PARAMS ((struct elf_link_hash_entry *, PTR));
103static bfd_boolean readonly_dynrelocs
104 PARAMS ((struct elf_link_hash_entry *, PTR));
105static enum elf_reloc_type_class sh_elf_reloc_type_class
106 PARAMS ((const Elf_Internal_Rela *));
107#ifdef INCLUDE_SHMEDIA
108inline static void movi_shori_putval PARAMS ((bfd *, unsigned long, char *));
109#endif
110static bfd_boolean elf32_shlin_grok_prstatus
111 PARAMS ((bfd *abfd, Elf_Internal_Note *note));
112static bfd_boolean elf32_shlin_grok_psinfo
113 PARAMS ((bfd *abfd, Elf_Internal_Note *note));
114
115/* The name of the dynamic interpreter. This is put in the .interp
116 section. */
117
118#define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1"
119
120static reloc_howto_type sh_elf_howto_table[] =
121{
122 /* No relocation. */
123 HOWTO (R_SH_NONE, /* type */
124 0, /* rightshift */
125 0, /* size (0 = byte, 1 = short, 2 = long) */
126 0, /* bitsize */
127 FALSE, /* pc_relative */
128 0, /* bitpos */
129 complain_overflow_dont, /* complain_on_overflow */
130 sh_elf_ignore_reloc, /* special_function */
131 "R_SH_NONE", /* name */
132 FALSE, /* partial_inplace */
133 0, /* src_mask */
134 0, /* dst_mask */
135 FALSE), /* pcrel_offset */
136
137 /* 32 bit absolute relocation. Setting partial_inplace to TRUE and
138 src_mask to a non-zero value is similar to the COFF toolchain. */
139 HOWTO (R_SH_DIR32, /* type */
140 0, /* rightshift */
141 2, /* size (0 = byte, 1 = short, 2 = long) */
142 32, /* bitsize */
143 FALSE, /* pc_relative */
144 0, /* bitpos */
145 complain_overflow_bitfield, /* complain_on_overflow */
146 sh_elf_reloc, /* special_function */
147 "R_SH_DIR32", /* name */
148 TRUE, /* partial_inplace */
149 0xffffffff, /* src_mask */
150 0xffffffff, /* dst_mask */
151 FALSE), /* pcrel_offset */
152
153 /* 32 bit PC relative relocation. */
154 HOWTO (R_SH_REL32, /* type */
155 0, /* rightshift */
156 2, /* size (0 = byte, 1 = short, 2 = long) */
157 32, /* bitsize */
158 TRUE, /* pc_relative */
159 0, /* bitpos */
160 complain_overflow_signed, /* complain_on_overflow */
161 sh_elf_ignore_reloc, /* special_function */
162 "R_SH_REL32", /* name */
163 TRUE, /* partial_inplace */
164 0xffffffff, /* src_mask */
165 0xffffffff, /* dst_mask */
166 TRUE), /* pcrel_offset */
167
168 /* 8 bit PC relative branch divided by 2. */
169 HOWTO (R_SH_DIR8WPN, /* type */
170 1, /* rightshift */
171 1, /* size (0 = byte, 1 = short, 2 = long) */
172 8, /* bitsize */
173 TRUE, /* pc_relative */
174 0, /* bitpos */
175 complain_overflow_signed, /* complain_on_overflow */
176 sh_elf_ignore_reloc, /* special_function */
177 "R_SH_DIR8WPN", /* name */
178 TRUE, /* partial_inplace */
179 0xff, /* src_mask */
180 0xff, /* dst_mask */
181 TRUE), /* pcrel_offset */
182
183 /* 12 bit PC relative branch divided by 2. */
184 /* This cannot be partial_inplace because relaxation can't know the
185 eventual value of a symbol. */
186 HOWTO (R_SH_IND12W, /* type */
187 1, /* rightshift */
188 1, /* size (0 = byte, 1 = short, 2 = long) */
189 12, /* bitsize */
190 TRUE, /* pc_relative */
191 0, /* bitpos */
192 complain_overflow_signed, /* complain_on_overflow */
193 NULL, /* special_function */
194 "R_SH_IND12W", /* name */
195 FALSE, /* partial_inplace */
196 0x0, /* src_mask */
197 0xfff, /* dst_mask */
198 TRUE), /* pcrel_offset */
199
200 /* 8 bit unsigned PC relative divided by 4. */
201 HOWTO (R_SH_DIR8WPL, /* type */
202 2, /* rightshift */
203 1, /* size (0 = byte, 1 = short, 2 = long) */
204 8, /* bitsize */
205 TRUE, /* pc_relative */
206 0, /* bitpos */
207 complain_overflow_unsigned, /* complain_on_overflow */
208 sh_elf_ignore_reloc, /* special_function */
209 "R_SH_DIR8WPL", /* name */
210 TRUE, /* partial_inplace */
211 0xff, /* src_mask */
212 0xff, /* dst_mask */
213 TRUE), /* pcrel_offset */
214
215 /* 8 bit unsigned PC relative divided by 2. */
216 HOWTO (R_SH_DIR8WPZ, /* type */
217 1, /* rightshift */
218 1, /* size (0 = byte, 1 = short, 2 = long) */
219 8, /* bitsize */
220 TRUE, /* pc_relative */
221 0, /* bitpos */
222 complain_overflow_unsigned, /* complain_on_overflow */
223 sh_elf_ignore_reloc, /* special_function */
224 "R_SH_DIR8WPZ", /* name */
225 TRUE, /* partial_inplace */
226 0xff, /* src_mask */
227 0xff, /* dst_mask */
228 TRUE), /* pcrel_offset */
229
230 /* 8 bit GBR relative. FIXME: This only makes sense if we have some
231 special symbol for the GBR relative area, and that is not
232 implemented. */
233 HOWTO (R_SH_DIR8BP, /* type */
234 0, /* rightshift */
235 1, /* size (0 = byte, 1 = short, 2 = long) */
236 8, /* bitsize */
237 FALSE, /* pc_relative */
238 0, /* bitpos */
239 complain_overflow_unsigned, /* complain_on_overflow */
240 sh_elf_ignore_reloc, /* special_function */
241 "R_SH_DIR8BP", /* name */
242 FALSE, /* partial_inplace */
243 0, /* src_mask */
244 0xff, /* dst_mask */
245 TRUE), /* pcrel_offset */
246
247 /* 8 bit GBR relative divided by 2. FIXME: This only makes sense if
248 we have some special symbol for the GBR relative area, and that
249 is not implemented. */
250 HOWTO (R_SH_DIR8W, /* type */
251 1, /* rightshift */
252 1, /* size (0 = byte, 1 = short, 2 = long) */
253 8, /* bitsize */
254 FALSE, /* pc_relative */
255 0, /* bitpos */
256 complain_overflow_unsigned, /* complain_on_overflow */
257 sh_elf_ignore_reloc, /* special_function */
258 "R_SH_DIR8W", /* name */
259 FALSE, /* partial_inplace */
260 0, /* src_mask */
261 0xff, /* dst_mask */
262 TRUE), /* pcrel_offset */
263
264 /* 8 bit GBR relative divided by 4. FIXME: This only makes sense if
265 we have some special symbol for the GBR relative area, and that
266 is not implemented. */
267 HOWTO (R_SH_DIR8L, /* type */
268 2, /* rightshift */
269 1, /* size (0 = byte, 1 = short, 2 = long) */
270 8, /* bitsize */
271 FALSE, /* pc_relative */
272 0, /* bitpos */
273 complain_overflow_unsigned, /* complain_on_overflow */
274 sh_elf_ignore_reloc, /* special_function */
275 "R_SH_DIR8L", /* name */
276 FALSE, /* partial_inplace */
277 0, /* src_mask */
278 0xff, /* dst_mask */
279 TRUE), /* pcrel_offset */
280
281 EMPTY_HOWTO (10),
282 EMPTY_HOWTO (11),
283 EMPTY_HOWTO (12),
284 EMPTY_HOWTO (13),
285 EMPTY_HOWTO (14),
286 EMPTY_HOWTO (15),
287 EMPTY_HOWTO (16),
288 EMPTY_HOWTO (17),
289 EMPTY_HOWTO (18),
290 EMPTY_HOWTO (19),
291 EMPTY_HOWTO (20),
292 EMPTY_HOWTO (21),
293 EMPTY_HOWTO (22),
294 EMPTY_HOWTO (23),
295 EMPTY_HOWTO (24),
296
297 /* The remaining relocs are a GNU extension used for relaxing. The
298 final pass of the linker never needs to do anything with any of
299 these relocs. Any required operations are handled by the
300 relaxation code. */
301
302 /* A 16 bit switch table entry. This is generated for an expression
303 such as ``.word L1 - L2''. The offset holds the difference
304 between the reloc address and L2. */
305 HOWTO (R_SH_SWITCH16, /* type */
306 0, /* rightshift */
307 1, /* size (0 = byte, 1 = short, 2 = long) */
308 16, /* bitsize */
309 FALSE, /* pc_relative */
310 0, /* bitpos */
311 complain_overflow_unsigned, /* complain_on_overflow */
312 sh_elf_ignore_reloc, /* special_function */
313 "R_SH_SWITCH16", /* name */
314 FALSE, /* partial_inplace */
315 0, /* src_mask */
316 0, /* dst_mask */
317 TRUE), /* pcrel_offset */
318
319 /* A 32 bit switch table entry. This is generated for an expression
320 such as ``.long L1 - L2''. The offset holds the difference
321 between the reloc address and L2. */
322 HOWTO (R_SH_SWITCH32, /* type */
323 0, /* rightshift */
324 2, /* size (0 = byte, 1 = short, 2 = long) */
325 32, /* bitsize */
326 FALSE, /* pc_relative */
327 0, /* bitpos */
328 complain_overflow_unsigned, /* complain_on_overflow */
329 sh_elf_ignore_reloc, /* special_function */
330 "R_SH_SWITCH32", /* name */
331 FALSE, /* partial_inplace */
332 0, /* src_mask */
333 0, /* dst_mask */
334 TRUE), /* pcrel_offset */
335
336 /* Indicates a .uses pseudo-op. The compiler will generate .uses
337 pseudo-ops when it finds a function call which can be relaxed.
338 The offset field holds the PC relative offset to the instruction
339 which loads the register used in the function call. */
340 HOWTO (R_SH_USES, /* type */
341 0, /* rightshift */
342 1, /* size (0 = byte, 1 = short, 2 = long) */
343 0, /* bitsize */
344 FALSE, /* pc_relative */
345 0, /* bitpos */
346 complain_overflow_unsigned, /* complain_on_overflow */
347 sh_elf_ignore_reloc, /* special_function */
348 "R_SH_USES", /* name */
349 FALSE, /* partial_inplace */
350 0, /* src_mask */
351 0, /* dst_mask */
352 TRUE), /* pcrel_offset */
353
354 /* The assembler will generate this reloc for addresses referred to
355 by the register loads associated with USES relocs. The offset
356 field holds the number of times the address is referenced in the
357 object file. */
358 HOWTO (R_SH_COUNT, /* type */
359 0, /* rightshift */
360 1, /* size (0 = byte, 1 = short, 2 = long) */
361 0, /* bitsize */
362 FALSE, /* pc_relative */
363 0, /* bitpos */
364 complain_overflow_unsigned, /* complain_on_overflow */
365 sh_elf_ignore_reloc, /* special_function */
366 "R_SH_COUNT", /* name */
367 FALSE, /* partial_inplace */
368 0, /* src_mask */
369 0, /* dst_mask */
370 TRUE), /* pcrel_offset */
371
372 /* Indicates an alignment statement. The offset field is the power
373 of 2 to which subsequent portions of the object file must be
374 aligned. */
375 HOWTO (R_SH_ALIGN, /* type */
376 0, /* rightshift */
377 1, /* size (0 = byte, 1 = short, 2 = long) */
378 0, /* bitsize */
379 FALSE, /* pc_relative */
380 0, /* bitpos */
381 complain_overflow_unsigned, /* complain_on_overflow */
382 sh_elf_ignore_reloc, /* special_function */
383 "R_SH_ALIGN", /* name */
384 FALSE, /* partial_inplace */
385 0, /* src_mask */
386 0, /* dst_mask */
387 TRUE), /* pcrel_offset */
388
389 /* The assembler will generate this reloc before a block of
390 instructions. A section should be processed as assumining it
391 contains data, unless this reloc is seen. */
392 HOWTO (R_SH_CODE, /* type */
393 0, /* rightshift */
394 1, /* size (0 = byte, 1 = short, 2 = long) */
395 0, /* bitsize */
396 FALSE, /* pc_relative */
397 0, /* bitpos */
398 complain_overflow_unsigned, /* complain_on_overflow */
399 sh_elf_ignore_reloc, /* special_function */
400 "R_SH_CODE", /* name */
401 FALSE, /* partial_inplace */
402 0, /* src_mask */
403 0, /* dst_mask */
404 TRUE), /* pcrel_offset */
405
406 /* The assembler will generate this reloc after a block of
407 instructions when it sees data that is not instructions. */
408 HOWTO (R_SH_DATA, /* type */
409 0, /* rightshift */
410 1, /* size (0 = byte, 1 = short, 2 = long) */
411 0, /* bitsize */
412 FALSE, /* pc_relative */
413 0, /* bitpos */
414 complain_overflow_unsigned, /* complain_on_overflow */
415 sh_elf_ignore_reloc, /* special_function */
416 "R_SH_DATA", /* name */
417 FALSE, /* partial_inplace */
418 0, /* src_mask */
419 0, /* dst_mask */
420 TRUE), /* pcrel_offset */
421
422 /* The assembler generates this reloc for each label within a block
423 of instructions. This permits the linker to avoid swapping
424 instructions which are the targets of branches. */
425 HOWTO (R_SH_LABEL, /* type */
426 0, /* rightshift */
427 1, /* size (0 = byte, 1 = short, 2 = long) */
428 0, /* bitsize */
429 FALSE, /* pc_relative */
430 0, /* bitpos */
431 complain_overflow_unsigned, /* complain_on_overflow */
432 sh_elf_ignore_reloc, /* special_function */
433 "R_SH_LABEL", /* name */
434 FALSE, /* partial_inplace */
435 0, /* src_mask */
436 0, /* dst_mask */
437 TRUE), /* pcrel_offset */
438
439 /* An 8 bit switch table entry. This is generated for an expression
440 such as ``.word L1 - L2''. The offset holds the difference
441 between the reloc address and L2. */
442 HOWTO (R_SH_SWITCH8, /* type */
443 0, /* rightshift */
444 0, /* size (0 = byte, 1 = short, 2 = long) */
445 8, /* bitsize */
446 FALSE, /* pc_relative */
447 0, /* bitpos */
448 complain_overflow_unsigned, /* complain_on_overflow */
449 sh_elf_ignore_reloc, /* special_function */
450 "R_SH_SWITCH8", /* name */
451 FALSE, /* partial_inplace */
452 0, /* src_mask */
453 0, /* dst_mask */
454 TRUE), /* pcrel_offset */
455
456 /* GNU extension to record C++ vtable hierarchy */
457 HOWTO (R_SH_GNU_VTINHERIT, /* type */
458 0, /* rightshift */
459 2, /* size (0 = byte, 1 = short, 2 = long) */
460 0, /* bitsize */
461 FALSE, /* pc_relative */
462 0, /* bitpos */
463 complain_overflow_dont, /* complain_on_overflow */
464 NULL, /* special_function */
465 "R_SH_GNU_VTINHERIT", /* name */
466 FALSE, /* partial_inplace */
467 0, /* src_mask */
468 0, /* dst_mask */
469 FALSE), /* pcrel_offset */
470
471 /* GNU extension to record C++ vtable member usage */
472 HOWTO (R_SH_GNU_VTENTRY, /* type */
473 0, /* rightshift */
474 2, /* size (0 = byte, 1 = short, 2 = long) */
475 0, /* bitsize */
476 FALSE, /* pc_relative */
477 0, /* bitpos */
478 complain_overflow_dont, /* complain_on_overflow */
479 _bfd_elf_rel_vtable_reloc_fn, /* special_function */
480 "R_SH_GNU_VTENTRY", /* name */
481 FALSE, /* partial_inplace */
482 0, /* src_mask */
483 0, /* dst_mask */
484 FALSE), /* pcrel_offset */
485
486 /* 8 bit PC relative divided by 2 - but specified in a very odd way. */
487 HOWTO (R_SH_LOOP_START, /* type */
488 1, /* rightshift */
489 1, /* size (0 = byte, 1 = short, 2 = long) */
490 8, /* bitsize */
491 FALSE, /* pc_relative */
492 0, /* bitpos */
493 complain_overflow_signed, /* complain_on_overflow */
494 sh_elf_ignore_reloc, /* special_function */
495 "R_SH_LOOP_START", /* name */
496 TRUE, /* partial_inplace */
497 0xff, /* src_mask */
498 0xff, /* dst_mask */
499 TRUE), /* pcrel_offset */
500
501 /* 8 bit PC relative divided by 2 - but specified in a very odd way. */
502 HOWTO (R_SH_LOOP_END, /* type */
503 1, /* rightshift */
504 1, /* size (0 = byte, 1 = short, 2 = long) */
505 8, /* bitsize */
506 FALSE, /* pc_relative */
507 0, /* bitpos */
508 complain_overflow_signed, /* complain_on_overflow */
509 sh_elf_ignore_reloc, /* special_function */
510 "R_SH_LOOP_END", /* name */
511 TRUE, /* partial_inplace */
512 0xff, /* src_mask */
513 0xff, /* dst_mask */
514 TRUE), /* pcrel_offset */
515
516 EMPTY_HOWTO (38),
517 EMPTY_HOWTO (39),
518 EMPTY_HOWTO (40),
519 EMPTY_HOWTO (41),
520 EMPTY_HOWTO (42),
521 EMPTY_HOWTO (43),
522 EMPTY_HOWTO (44),
523
524#ifdef INCLUDE_SHMEDIA
525 /* Used in SHLLI.L and SHLRI.L. */
526 HOWTO (R_SH_DIR5U, /* type */
527 0, /* rightshift */
528 2, /* size (0 = byte, 1 = short, 2 = long) */
529 5, /* bitsize */
530 FALSE, /* pc_relative */
531 10, /* bitpos */
532 complain_overflow_unsigned, /* complain_on_overflow */
533 bfd_elf_generic_reloc, /* special_function */
534 "R_SH_DIR5U", /* name */
535 FALSE, /* partial_inplace */
536 0, /* src_mask */
537 0xfc00, /* dst_mask */
538 FALSE), /* pcrel_offset */
539
540 /* Used in SHARI, SHLLI et al. */
541 HOWTO (R_SH_DIR6U, /* type */
542 0, /* rightshift */
543 2, /* size (0 = byte, 1 = short, 2 = long) */
544 6, /* bitsize */
545 FALSE, /* pc_relative */
546 10, /* bitpos */
547 complain_overflow_unsigned, /* complain_on_overflow */
548 bfd_elf_generic_reloc, /* special_function */
549 "R_SH_DIR6U", /* name */
550 FALSE, /* partial_inplace */
551 0, /* src_mask */
552 0xfc00, /* dst_mask */
553 FALSE), /* pcrel_offset */
554
555 /* Used in BxxI, LDHI.L et al. */
556 HOWTO (R_SH_DIR6S, /* type */
557 0, /* rightshift */
558 2, /* size (0 = byte, 1 = short, 2 = long) */
559 6, /* bitsize */
560 FALSE, /* pc_relative */
561 10, /* bitpos */
562 complain_overflow_signed, /* complain_on_overflow */
563 bfd_elf_generic_reloc, /* special_function */
564 "R_SH_DIR6S", /* name */
565 FALSE, /* partial_inplace */
566 0, /* src_mask */
567 0xfc00, /* dst_mask */
568 FALSE), /* pcrel_offset */
569
570 /* Used in ADDI, ANDI et al. */
571 HOWTO (R_SH_DIR10S, /* type */
572 0, /* rightshift */
573 2, /* size (0 = byte, 1 = short, 2 = long) */
574 10, /* bitsize */
575 FALSE, /* pc_relative */
576 10, /* bitpos */
577 complain_overflow_signed, /* complain_on_overflow */
578 bfd_elf_generic_reloc, /* special_function */
579 "R_SH_DIR10S", /* name */
580 FALSE, /* partial_inplace */
581 0, /* src_mask */
582 0xffc00, /* dst_mask */
583 FALSE), /* pcrel_offset */
584
585 /* Used in LD.UW, ST.W et al. */
586 HOWTO (R_SH_DIR10SW, /* type */
587 1, /* rightshift */
588 2, /* size (0 = byte, 1 = short, 2 = long) */
589 11, /* bitsize */
590 FALSE, /* pc_relative */
591 10, /* bitpos */
592 complain_overflow_signed, /* complain_on_overflow */
593 bfd_elf_generic_reloc, /* special_function */
594 "R_SH_DIR10SW", /* name */
595 FALSE, /* partial_inplace */
596 0, /* src_mask */
597 0xffc00, /* dst_mask */
598 FALSE), /* pcrel_offset */
599
600 /* Used in LD.L, FLD.S et al. */
601 HOWTO (R_SH_DIR10SL, /* type */
602 2, /* rightshift */
603 2, /* size (0 = byte, 1 = short, 2 = long) */
604 12, /* bitsize */
605 FALSE, /* pc_relative */
606 10, /* bitpos */
607 complain_overflow_signed, /* complain_on_overflow */
608 bfd_elf_generic_reloc, /* special_function */
609 "R_SH_DIR10SL", /* name */
610 FALSE, /* partial_inplace */
611 0, /* src_mask */
612 0xffc00, /* dst_mask */
613 FALSE), /* pcrel_offset */
614
615 /* Used in FLD.D, FST.P et al. */
616 HOWTO (R_SH_DIR10SQ, /* type */
617 3, /* rightshift */
618 2, /* size (0 = byte, 1 = short, 2 = long) */
619 13, /* bitsize */
620 FALSE, /* pc_relative */
621 10, /* bitpos */
622 complain_overflow_signed, /* complain_on_overflow */
623 bfd_elf_generic_reloc, /* special_function */
624 "R_SH_DIR10SQ", /* name */
625 FALSE, /* partial_inplace */
626 0, /* src_mask */
627 0xffc00, /* dst_mask */
628 FALSE), /* pcrel_offset */
629
630#else
631 EMPTY_HOWTO (45),
632 EMPTY_HOWTO (46),
633 EMPTY_HOWTO (47),
634 EMPTY_HOWTO (48),
635 EMPTY_HOWTO (49),
636 EMPTY_HOWTO (50),
637 EMPTY_HOWTO (51),
638#endif
639
640 EMPTY_HOWTO (52),
641 EMPTY_HOWTO (53),
642 EMPTY_HOWTO (54),
643 EMPTY_HOWTO (55),
644 EMPTY_HOWTO (56),
645 EMPTY_HOWTO (57),
646 EMPTY_HOWTO (58),
647 EMPTY_HOWTO (59),
648 EMPTY_HOWTO (60),
649 EMPTY_HOWTO (61),
650 EMPTY_HOWTO (62),
651 EMPTY_HOWTO (63),
652 EMPTY_HOWTO (64),
653 EMPTY_HOWTO (65),
654 EMPTY_HOWTO (66),
655 EMPTY_HOWTO (67),
656 EMPTY_HOWTO (68),
657 EMPTY_HOWTO (69),
658 EMPTY_HOWTO (70),
659 EMPTY_HOWTO (71),
660 EMPTY_HOWTO (72),
661 EMPTY_HOWTO (73),
662 EMPTY_HOWTO (74),
663 EMPTY_HOWTO (75),
664 EMPTY_HOWTO (76),
665 EMPTY_HOWTO (77),
666 EMPTY_HOWTO (78),
667 EMPTY_HOWTO (79),
668 EMPTY_HOWTO (80),
669 EMPTY_HOWTO (81),
670 EMPTY_HOWTO (82),
671 EMPTY_HOWTO (83),
672 EMPTY_HOWTO (84),
673 EMPTY_HOWTO (85),
674 EMPTY_HOWTO (86),
675 EMPTY_HOWTO (87),
676 EMPTY_HOWTO (88),
677 EMPTY_HOWTO (89),
678 EMPTY_HOWTO (90),
679 EMPTY_HOWTO (91),
680 EMPTY_HOWTO (92),
681 EMPTY_HOWTO (93),
682 EMPTY_HOWTO (94),
683 EMPTY_HOWTO (95),
684 EMPTY_HOWTO (96),
685 EMPTY_HOWTO (97),
686 EMPTY_HOWTO (98),
687 EMPTY_HOWTO (99),
688 EMPTY_HOWTO (100),
689 EMPTY_HOWTO (101),
690 EMPTY_HOWTO (102),
691 EMPTY_HOWTO (103),
692 EMPTY_HOWTO (104),
693 EMPTY_HOWTO (105),
694 EMPTY_HOWTO (106),
695 EMPTY_HOWTO (107),
696 EMPTY_HOWTO (108),
697 EMPTY_HOWTO (109),
698 EMPTY_HOWTO (110),
699 EMPTY_HOWTO (111),
700 EMPTY_HOWTO (112),
701 EMPTY_HOWTO (113),
702 EMPTY_HOWTO (114),
703 EMPTY_HOWTO (115),
704 EMPTY_HOWTO (116),
705 EMPTY_HOWTO (117),
706 EMPTY_HOWTO (118),
707 EMPTY_HOWTO (119),
708 EMPTY_HOWTO (120),
709 EMPTY_HOWTO (121),
710 EMPTY_HOWTO (122),
711 EMPTY_HOWTO (123),
712 EMPTY_HOWTO (124),
713 EMPTY_HOWTO (125),
714 EMPTY_HOWTO (126),
715 EMPTY_HOWTO (127),
716 EMPTY_HOWTO (128),
717 EMPTY_HOWTO (129),
718 EMPTY_HOWTO (130),
719 EMPTY_HOWTO (131),
720 EMPTY_HOWTO (132),
721 EMPTY_HOWTO (133),
722 EMPTY_HOWTO (134),
723 EMPTY_HOWTO (135),
724 EMPTY_HOWTO (136),
725 EMPTY_HOWTO (137),
726 EMPTY_HOWTO (138),
727 EMPTY_HOWTO (139),
728 EMPTY_HOWTO (140),
729 EMPTY_HOWTO (141),
730 EMPTY_HOWTO (142),
731 EMPTY_HOWTO (143),
732
733 HOWTO (R_SH_TLS_GD_32, /* type */
734 0, /* rightshift */
735 2, /* size (0 = byte, 1 = short, 2 = long) */
736 32, /* bitsize */
737 FALSE, /* pc_relative */
738 0, /* bitpos */
739 complain_overflow_bitfield, /* complain_on_overflow */
740 bfd_elf_generic_reloc, /* */
741 "R_SH_TLS_GD_32", /* name */
742 TRUE, /* partial_inplace */
743 0xffffffff, /* src_mask */
744 0xffffffff, /* dst_mask */
745 FALSE), /* pcrel_offset */
746
747 HOWTO (R_SH_TLS_LD_32, /* type */
748 0, /* rightshift */
749 2, /* size (0 = byte, 1 = short, 2 = long) */
750 32, /* bitsize */
751 FALSE, /* pc_relative */
752 0, /* bitpos */
753 complain_overflow_bitfield, /* complain_on_overflow */
754 bfd_elf_generic_reloc, /* */
755 "R_SH_TLS_LD_32", /* name */
756 TRUE, /* partial_inplace */
757 0xffffffff, /* src_mask */
758 0xffffffff, /* dst_mask */
759 FALSE), /* pcrel_offset */
760
761 HOWTO (R_SH_TLS_LDO_32, /* type */
762 0, /* rightshift */
763 2, /* size (0 = byte, 1 = short, 2 = long) */
764 32, /* bitsize */
765 FALSE, /* pc_relative */
766 0, /* bitpos */
767 complain_overflow_bitfield, /* complain_on_overflow */
768 bfd_elf_generic_reloc, /* */
769 "R_SH_TLS_LDO_32", /* name */
770 TRUE, /* partial_inplace */
771 0xffffffff, /* src_mask */
772 0xffffffff, /* dst_mask */
773 FALSE), /* pcrel_offset */
774
775 HOWTO (R_SH_TLS_IE_32, /* type */
776 0, /* rightshift */
777 2, /* size (0 = byte, 1 = short, 2 = long) */
778 32, /* bitsize */
779 FALSE, /* pc_relative */
780 0, /* bitpos */
781 complain_overflow_bitfield, /* complain_on_overflow */
782 bfd_elf_generic_reloc, /* */
783 "R_SH_TLS_IE_32", /* name */
784 TRUE, /* partial_inplace */
785 0xffffffff, /* src_mask */
786 0xffffffff, /* dst_mask */
787 FALSE), /* pcrel_offset */
788
789 HOWTO (R_SH_TLS_LE_32, /* type */
790 0, /* rightshift */
791 2, /* size (0 = byte, 1 = short, 2 = long) */
792 32, /* bitsize */
793 FALSE, /* pc_relative */
794 0, /* bitpos */
795 complain_overflow_bitfield, /* complain_on_overflow */
796 bfd_elf_generic_reloc, /* */
797 "R_SH_TLS_LE_32", /* name */
798 TRUE, /* partial_inplace */
799 0xffffffff, /* src_mask */
800 0xffffffff, /* dst_mask */
801 FALSE), /* pcrel_offset */
802
803 HOWTO (R_SH_TLS_DTPMOD32, /* type */
804 0, /* rightshift */
805 2, /* size (0 = byte, 1 = short, 2 = long) */
806 32, /* bitsize */
807 FALSE, /* pc_relative */
808 0, /* bitpos */
809 complain_overflow_bitfield, /* complain_on_overflow */
810 bfd_elf_generic_reloc, /* */
811 "R_SH_TLS_DTPMOD32", /* name */
812 TRUE, /* partial_inplace */
813 0xffffffff, /* src_mask */
814 0xffffffff, /* dst_mask */
815 FALSE), /* pcrel_offset */
816
817 HOWTO (R_SH_TLS_DTPOFF32, /* type */
818 0, /* rightshift */
819 2, /* size (0 = byte, 1 = short, 2 = long) */
820 32, /* bitsize */
821 FALSE, /* pc_relative */
822 0, /* bitpos */
823 complain_overflow_bitfield, /* complain_on_overflow */
824 bfd_elf_generic_reloc, /* */
825 "R_SH_TLS_DTPOFF32", /* name */
826 TRUE, /* partial_inplace */
827 0xffffffff, /* src_mask */
828 0xffffffff, /* dst_mask */
829 FALSE), /* pcrel_offset */
830
831 HOWTO (R_SH_TLS_TPOFF32, /* type */
832 0, /* rightshift */
833 2, /* size (0 = byte, 1 = short, 2 = long) */
834 32, /* bitsize */
835 FALSE, /* pc_relative */
836 0, /* bitpos */
837 complain_overflow_bitfield, /* complain_on_overflow */
838 bfd_elf_generic_reloc, /* */
839 "R_SH_TLS_TPOFF32", /* name */
840 TRUE, /* partial_inplace */
841 0xffffffff, /* src_mask */
842 0xffffffff, /* dst_mask */
843 FALSE), /* pcrel_offset */
844
845 EMPTY_HOWTO (152),
846 EMPTY_HOWTO (153),
847 EMPTY_HOWTO (154),
848 EMPTY_HOWTO (155),
849 EMPTY_HOWTO (156),
850 EMPTY_HOWTO (157),
851 EMPTY_HOWTO (158),
852 EMPTY_HOWTO (159),
853
854 HOWTO (R_SH_GOT32, /* type */
855 0, /* rightshift */
856 2, /* size (0 = byte, 1 = short, 2 = long) */
857 32, /* bitsize */
858 FALSE, /* pc_relative */
859 0, /* bitpos */
860 complain_overflow_bitfield, /* complain_on_overflow */
861 bfd_elf_generic_reloc, /* */
862 "R_SH_GOT32", /* name */
863 TRUE, /* partial_inplace */
864 0xffffffff, /* src_mask */
865 0xffffffff, /* dst_mask */
866 FALSE), /* pcrel_offset */
867
868 HOWTO (R_SH_PLT32, /* type */
869 0, /* rightshift */
870 2, /* size (0 = byte, 1 = short, 2 = long) */
871 32, /* bitsize */
872 TRUE, /* pc_relative */
873 0, /* bitpos */
874 complain_overflow_bitfield, /* complain_on_overflow */
875 bfd_elf_generic_reloc, /* */
876 "R_SH_PLT32", /* name */
877 TRUE, /* partial_inplace */
878 0xffffffff, /* src_mask */
879 0xffffffff, /* dst_mask */
880 TRUE), /* pcrel_offset */
881
882 HOWTO (R_SH_COPY, /* type */
883 0, /* rightshift */
884 2, /* size (0 = byte, 1 = short, 2 = long) */
885 32, /* bitsize */
886 FALSE, /* pc_relative */
887 0, /* bitpos */
888 complain_overflow_bitfield, /* complain_on_overflow */
889 bfd_elf_generic_reloc, /* */
890 "R_SH_COPY", /* name */
891 TRUE, /* partial_inplace */
892 0xffffffff, /* src_mask */
893 0xffffffff, /* dst_mask */
894 FALSE), /* pcrel_offset */
895
896 HOWTO (R_SH_GLOB_DAT, /* type */
897 0, /* rightshift */
898 2, /* size (0 = byte, 1 = short, 2 = long) */
899 32, /* bitsize */
900 FALSE, /* pc_relative */
901 0, /* bitpos */
902 complain_overflow_bitfield, /* complain_on_overflow */
903 bfd_elf_generic_reloc, /* */
904 "R_SH_GLOB_DAT", /* name */
905 TRUE, /* partial_inplace */
906 0xffffffff, /* src_mask */
907 0xffffffff, /* dst_mask */
908 FALSE), /* pcrel_offset */
909
910 HOWTO (R_SH_JMP_SLOT, /* type */
911 0, /* rightshift */
912 2, /* size (0 = byte, 1 = short, 2 = long) */
913 32, /* bitsize */
914 FALSE, /* pc_relative */
915 0, /* bitpos */
916 complain_overflow_bitfield, /* complain_on_overflow */
917 bfd_elf_generic_reloc, /* */
918 "R_SH_JMP_SLOT", /* name */
919 TRUE, /* partial_inplace */
920 0xffffffff, /* src_mask */
921 0xffffffff, /* dst_mask */
922 FALSE), /* pcrel_offset */
923
924 HOWTO (R_SH_RELATIVE, /* type */
925 0, /* rightshift */
926 2, /* size (0 = byte, 1 = short, 2 = long) */
927 32, /* bitsize */
928 FALSE, /* pc_relative */
929 0, /* bitpos */
930 complain_overflow_bitfield, /* complain_on_overflow */
931 bfd_elf_generic_reloc, /* */
932 "R_SH_RELATIVE", /* name */
933 TRUE, /* partial_inplace */
934 0xffffffff, /* src_mask */
935 0xffffffff, /* dst_mask */
936 FALSE), /* pcrel_offset */
937
938 HOWTO (R_SH_GOTOFF, /* type */
939 0, /* rightshift */
940 2, /* size (0 = byte, 1 = short, 2 = long) */
941 32, /* bitsize */
942 FALSE, /* pc_relative */
943 0, /* bitpos */
944 complain_overflow_bitfield, /* complain_on_overflow */
945 bfd_elf_generic_reloc, /* */
946 "R_SH_GOTOFF", /* name */
947 TRUE, /* partial_inplace */
948 0xffffffff, /* src_mask */
949 0xffffffff, /* dst_mask */
950 FALSE), /* pcrel_offset */
951
952 HOWTO (R_SH_GOTPC, /* type */
953 0, /* rightshift */
954 2, /* size (0 = byte, 1 = short, 2 = long) */
955 32, /* bitsize */
956 TRUE, /* pc_relative */
957 0, /* bitpos */
958 complain_overflow_bitfield, /* complain_on_overflow */
959 bfd_elf_generic_reloc, /* */
960 "R_SH_GOTPC", /* name */
961 TRUE, /* partial_inplace */
962 0xffffffff, /* src_mask */
963 0xffffffff, /* dst_mask */
964 TRUE), /* pcrel_offset */
965
966 HOWTO (R_SH_GOTPLT32, /* type */
967 0, /* rightshift */
968 2, /* size (0 = byte, 1 = short, 2 = long) */
969 32, /* bitsize */
970 FALSE, /* pc_relative */
971 0, /* bitpos */
972 complain_overflow_bitfield, /* complain_on_overflow */
973 bfd_elf_generic_reloc, /* */
974 "R_SH_GOTPLT32", /* name */
975 FALSE, /* partial_inplace */
976 0xffffffff, /* src_mask */
977 0xffffffff, /* dst_mask */
978 FALSE), /* pcrel_offset */
979
980#ifdef INCLUDE_SHMEDIA
981 /* Used in MOVI and SHORI (x & 65536). */
982 HOWTO (R_SH_GOT_LOW16, /* type */
983 0, /* rightshift */
984 2, /* size (0 = byte, 1 = short, 2 = long) */
985 64, /* bitsize */
986 FALSE, /* pc_relative */
987 10, /* bitpos */
988 complain_overflow_dont, /* complain_on_overflow */
989 bfd_elf_generic_reloc, /* special_function */
990 "R_SH_GOT_LOW16", /* name */
991 FALSE, /* partial_inplace */
992 0, /* src_mask */
993 0x3fffc00, /* dst_mask */
994 FALSE