diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 0319c86118..401c6b3731 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,116 @@ +2006-08-04 Richard Sandiford + Kazu Hirata + Phil Edwards + Nathan Sidwell + + * config.bfd (sh-*-vxworks): Use bfd_elf32_shvxworks_vec and + bfd_elf32_shlvxworks_vec. + * configure.in (bfd_elf32_sh64_vec): Add elf-vxworks.lo. + (bfd_elf32_sh64l_vec, bfd_elf32_sh64lin_vec): Likewise. + (bfd_elf32_sh64blin_vec, bfd_elf32_sh64lnbsd_vec): Likewise. + (bfd_elf32_sh64nbsd_vec, bfd_elf32_sh_vec): Likewise. + (bfd_elf32_shblin_vec, bfd_elf32_shl_vec): Likewise. + (bfd_elf32_shl_symbian_vec, bfd_elf32_shlin_vec): Likewise. + (bfd_elf32_shlnbsd_vec, bfd_elf32_shnbsd_vec): Likewise. + (bfd_elf32_shlvxworks_vec, bfd_elf32_shvxworks_vec): New stanzas. + * configure: Regenerate. + * Makefile.am: Regenerate dependencies. + * Makefile.in: Regenerate. + * elf-vxworks.c (elf_vxworks_gott_symbol_p): New function. + (elf_vxworks_add_symbol_hook): Use it. + (elf_vxworks_link_output_symbol_hook): Likewise. Use the hash + table entry to check for weak undefined symbols and to obtain + the original bfd. + (elf_vxworks_emit_relocs): Use target_index instead of this_idx. + * elf32-sh-relocs.h: New file, split from elf32-sh.c. + (R_SH_DIR32): Use SH_PARTIAL32 for the partial_inplace field, + SH_SRC_MASK32 for the src_mask field, and SH_ELF_RELOC for the + special_function field. + (R_SH_REL32): Use SH_PARTIAL32 and SH_SRC_MASK32 here too. + (R_SH_REL32, R_SH_TLS_GD_32, R_SH_TLS_LD_32): Likewise. + (R_SH_TLS_LDO_32, R_SH_TLS_IE_32, R_SH_TLS_LE_32): Likewise. + (R_SH_TLS_DTPMOD32, R_SH_TLS_DTPOFF32, R_SH_TLS_TPOFF32): Likewise. + (R_SH_GOT32, R_SH_PLT32, R_SH_COPY, R_SH_GLOB_DAT): Likewise. + (R_SH_JMP_SLOT, R_SH_RELATIVE, R_SH_GOTOFF, R_SH_GOTPC): Likewise. + (SH_PARTIAL32, SH_SRC_MASK32, SH_ELF_RELOC): Undefine at end of file. + * elf32-sh.c: Include elf32-vxworks.h. + (MINUS_ONE): Define. + (sh_elf_howto_table): Include elf32-sh-relocs.h with SH_PARTIAL32 + set to TRUE, SH_SRC_MASK32 set to 0xffffffff, and SH_ELF_RELOC set + to sh_elf_reloc. + (sh_vxworks_howto_table): New variable. Include elf32-sh-relocs.h + with SH_PARTIAL32 set to FALSE, SH_SRC_MASK32 set to 0, and + SH_ELF_RELOC set to bfd_elf_generic_reloc. + (vxworks_object_p, get_howto_table): New functions. + (sh_elf_reloc_type_lookup): Fix typo. Use get_howto_table. + (sh_elf_info_to_howto): Use get_howto_table. + (sh_elf_relax_section): Honor the partial_inplace field of the + R_SH_DIR32 howto. + (sh_elf_relax_delete_bytes): Likewise. + (elf_sh_plt_info): New structure. + (PLT_ENTRY_SIZE): Replace both definitions with... + (ELF_PLT_ENTRY_SIZE): ...this new macro, with separate definitions for + INCLUDE_SHMEDIA and !INCLUDE_SHMEDIA. + (elf_sh_plt0_entry_be): Update sizes of both definitions accordingly. + (elf_sh_plt0_entry_le): Likewise. + (elf_sh_plt_entry_be, elf_sh_plt_entry_le): Likewise. + (elf_sh_pic_plt_entry_be, elf_sh_pic_plt_entry_le): Likewise. + (elf_sh_plts): New structure, with separate definitions for + INCLUDE_SHMEDIA and !INCLUDE_SHMEDIA. + (elf_sh_plt0_entry): Delete both definitions. + (elf_sh_plt_entry, elf_sh_pic_plt_entry): Likewise. + (elf_sh_sizeof_plt, elf_sh_plt_plt0_offset): Likewise. + (elf_sh_plt_temp_offset, elf_sh_plt_symbol_offset): Likewise. + (elf_sh_plt_reloc_offset): Likewise. + (movi_shori_putval): Delete in favor of... + (install_plt_field): ...this new function, with separate definitions + for INCLUDE_SHMEDIA and !INCLUDE_SHMEDIA. + (get_plt_info): New function, with separate definitions + for INCLUDE_SHMEDIA and !INCLUDE_SHMEDIA. + (elf_sh_plt0_linker_offset, elf_sh_plt0_gotid_offset): Delete. + (VXWORKS_PLT_HEADER_SIZE, VXWORKS_PLT_ENTRY_SIZE): New macros. + (vxworks_sh_plt0_entry_be, vxworks_sh_plt0_entry_le): New constants. + (vxworks_sh_plt_entry_be, vxworks_sh_plt_entry_le): Likewise. + (vxworks_sh_pic_plt_entry_be, vxworks_sh_pic_plt_entry_le): Likewise. + (get_plt_index, get_plt_offset): New functions. + (elf_sh_link_hash_table): Add srelplt2, plt_info and vxworks_p fields. + (sh_elf_link_hash_table_create): Initialize them. + (sh_elf_create_dynamic_sections): Call + elf_vxworks_create_dynamic_sections for VxWorks. + (allocate_dynrelocs): Use htab->plt_info to get the size of PLT + entries. Allocate relocation entries in .rela.plt.unloaded if + generating a VxWorks executable. + (sh_elf_always_size_sections): New function. + (sh_elf_size_dynamic_sections): Extend .rela.plt handling to + .rela.plt.unloaded. + (sh_elf_relocate_section): Use get_howto_table. Honor + partial_inplace when calculating the addend for dynamic + relocations. Use get_plt_index. + (sh_elf_finish_dynamic_symbol): Use get_plt_index, install_plt_field + and htab->plt_info. Fill in the bra .plt offset for VxWorks + executables. Populate .rela.plt.unloaded. Do not make + _GLOBAL_OFFSET_TABLE_ absolute on VxWorks. + (sh_elf_finish_dynamic_sections): Use install_plt_field and + htab->plt_info. Handle cases where there is no special PLT header. + Populate the first relocation in .rela.plt.unloaded and fix up + the remaining entries. + (sh_elf_plt_sym_val): Use get_plt_info. + (elf_backend_always_size_sections): Define. + (TARGET_BIG_SYM, TARGET_BIG_NAME): Override for VxWorks. + (TARGET_LITTLE_SYM, TARGET_BIG_SYM): Likewise. + (elf32_bed, elf_backend_want_plt_sym): Likewise. + (elf_symbol_leading_char, elf_backend_want_got_underscore): Likewise. + (elf_backend_grok_prstatus, elf_backend_grok_psinfo): Likewise. + (elf_backend_add_symbol_hook): Likewise. + (elf_backend_link_output_symbol_hook): Likewise. + (elf_backend_emit_relocs): Likewise. + (elf_backend_final_write_processing): Likewise. + (ELF_MAXPAGESIZE, ELF_COMMONPAGESIZE): Likewise. + * targets.c (bfd_elf32_shlvxworks_vec): Declare. + (bfd_elf32_shvxworks_vec): Likewise. + (_bfd_target_vector): Include bfd_elf32_shlvxworks_vec and + bfd_elf32_shvxworks_vec. + 2006-08-02 Mark Kettenis * configure.in (arm-*-openbsd*): Set COREFILE to netbsd-core.lo. diff --git a/bfd/Makefile.am b/bfd/Makefile.am index 273fd2c5a1..cfc5f747c2 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -1127,7 +1127,8 @@ coff-arm.lo: coff-arm.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h coff-aux.lo: coff-aux.c $(INCDIR)/filenames.h $(INCDIR)/coff/aux-coff.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ - coff-m68k.c $(INCDIR)/hashtab.h libcoff.h $(INCDIR)/bfdlink.h \ + coff-m68k.c $(INCDIR)/hashtab.h $(INCDIR)/coff/m68k.h \ + $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ coffcode.h coffswap.h coff-h8300.lo: coff-h8300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/h8300.h \ @@ -1423,9 +1424,9 @@ elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \ - elf32-sh64.h elf32-sh.c $(INCDIR)/hashtab.h $(INCDIR)/elf/sh.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ - $(srcdir)/../opcodes/sh-opc.h elf32-target.h + elf32-sh64.h elf32-sh.c $(INCDIR)/hashtab.h elf-vxworks.h \ + $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + $(srcdir)/../opcodes/sh-opc.h elf32-sh-relocs.h elf32-target.h elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ @@ -1437,15 +1438,15 @@ elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-sh.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ - $(srcdir)/../opcodes/sh-opc.h elf32-target.h + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf-vxworks.h \ + $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + $(srcdir)/../opcodes/sh-opc.h elf32-sh-relocs.h elf32-target.h elf32-sh-symbian.lo: elf32-sh-symbian.c elf32-sh.c \ $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/libiberty.h $(srcdir)/../opcodes/sh-opc.h \ - elf32-target.h + $(INCDIR)/elf/external.h elf-vxworks.h $(INCDIR)/elf/sh.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + $(srcdir)/../opcodes/sh-opc.h elf32-sh-relocs.h elf32-target.h elfxx-sparc.lo: elfxx-sparc.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ @@ -1825,12 +1826,12 @@ elf32-ia64.lo: elf32-ia64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h \ $(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h \ - elf32-target.h + $(INCDIR)/hashtab.h elf32-target.h elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h \ $(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h \ - elf64-target.h + $(INCDIR)/hashtab.h elf64-target.h peigen.lo: peigen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 3e9b0a3c4f..0ecd81cbe4 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -1688,7 +1688,8 @@ coff-arm.lo: coff-arm.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h coff-aux.lo: coff-aux.c $(INCDIR)/filenames.h $(INCDIR)/coff/aux-coff.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ - coff-m68k.c $(INCDIR)/hashtab.h libcoff.h $(INCDIR)/bfdlink.h \ + coff-m68k.c $(INCDIR)/hashtab.h $(INCDIR)/coff/m68k.h \ + $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ coffcode.h coffswap.h coff-h8300.lo: coff-h8300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/h8300.h \ @@ -1984,9 +1985,9 @@ elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \ - elf32-sh64.h elf32-sh.c $(INCDIR)/hashtab.h $(INCDIR)/elf/sh.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ - $(srcdir)/../opcodes/sh-opc.h elf32-target.h + elf32-sh64.h elf32-sh.c $(INCDIR)/hashtab.h elf-vxworks.h \ + $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + $(srcdir)/../opcodes/sh-opc.h elf32-sh-relocs.h elf32-target.h elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ @@ -1998,15 +1999,15 @@ elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-sh.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ - $(srcdir)/../opcodes/sh-opc.h elf32-target.h + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf-vxworks.h \ + $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + $(srcdir)/../opcodes/sh-opc.h elf32-sh-relocs.h elf32-target.h elf32-sh-symbian.lo: elf32-sh-symbian.c elf32-sh.c \ $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/libiberty.h $(srcdir)/../opcodes/sh-opc.h \ - elf32-target.h + $(INCDIR)/elf/external.h elf-vxworks.h $(INCDIR)/elf/sh.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + $(srcdir)/../opcodes/sh-opc.h elf32-sh-relocs.h elf32-target.h elfxx-sparc.lo: elfxx-sparc.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ @@ -2386,12 +2387,12 @@ elf32-ia64.lo: elf32-ia64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h \ $(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h \ - elf32-target.h + $(INCDIR)/hashtab.h elf32-target.h elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h \ $(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h \ - elf64-target.h + $(INCDIR)/hashtab.h elf64-target.h peigen.lo: peigen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h diff --git a/bfd/config.bfd b/bfd/config.bfd index dfe631e082..998bca235b 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -1252,8 +1252,8 @@ case "${targ}" in targ_underscore=yes ;; sh-*-vxworks) - targ_defvec=bfd_elf32_sh_vec - targ_selvecs="bfd_elf32_shl_vec" + targ_defvec=bfd_elf32_shvxworks_vec + targ_selvecs="bfd_elf32_shlvxworks_vec" # FIXME None of the following are actually used on this target, but # they're necessary for coff-sh.c (which is unconditionally used) to be # compiled correctly. diff --git a/bfd/configure b/bfd/configure index 577f5e61b7..d3f16fecfb 100755 --- a/bfd/configure +++ b/bfd/configure @@ -10872,19 +10872,21 @@ do # FIXME: We include cofflink.lo not because it's needed for # bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec # which needs it but does not list it. Should be fixed in right place. - bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;; - bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;; - bfd_elf32_sh64lin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;; - bfd_elf32_sh64blin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;; - bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;; - bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;; - bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;; - bfd_elf32_shblin_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; - bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;; - bfd_elf32_shl_symbian_vec) tb="$tb elf32-sh-symbian.lo elf32-sh64-com.lo elf32.lo $elf coff-sh.lo" ;; - bfd_elf32_shlin_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; - bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; - bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; + bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;; + bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;; + bfd_elf32_sh64lin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;; + bfd_elf32_sh64blin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;; + bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" ;; + bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" ;; + bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;; + bfd_elf32_shblin_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; + bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;; + bfd_elf32_shl_symbian_vec) tb="$tb elf32-sh-symbian.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;; + bfd_elf32_shlin_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; + bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; + bfd_elf32_shlvxworks_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;; + bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo$elf coff-sh.lo cofflink.lo" ;; + bfd_elf32_shvxworks_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;; bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;; bfd_elf32_sparc_vxworks_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;; bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; diff --git a/bfd/configure.in b/bfd/configure.in index 57a152b73e..d4fe0c0fdf 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -662,19 +662,21 @@ do # FIXME: We include cofflink.lo not because it's needed for # bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec # which needs it but does not list it. Should be fixed in right place. - bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;; - bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;; - bfd_elf32_sh64lin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;; - bfd_elf32_sh64blin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;; - bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;; - bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;; - bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;; - bfd_elf32_shblin_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; - bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;; - bfd_elf32_shl_symbian_vec) tb="$tb elf32-sh-symbian.lo elf32-sh64-com.lo elf32.lo $elf coff-sh.lo" ;; - bfd_elf32_shlin_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; - bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; - bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; + bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;; + bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;; + bfd_elf32_sh64lin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;; + bfd_elf32_sh64blin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;; + bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" ;; + bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" ;; + bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;; + bfd_elf32_shblin_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; + bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;; + bfd_elf32_shl_symbian_vec) tb="$tb elf32-sh-symbian.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;; + bfd_elf32_shlin_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; + bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; + bfd_elf32_shlvxworks_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;; + bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo$elf coff-sh.lo cofflink.lo" ;; + bfd_elf32_shvxworks_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;; bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;; bfd_elf32_sparc_vxworks_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;; bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; diff --git a/bfd/elf-vxworks.c b/bfd/elf-vxworks.c index 90e620a905..5b673f2a8e 100644 --- a/bfd/elf-vxworks.c +++ b/bfd/elf-vxworks.c @@ -26,9 +26,28 @@ #include "elf-bfd.h" #include "elf-vxworks.h" +/* Return true if symbol NAME, as defined by ABFD, is one of the special + __GOTT_BASE__ or __GOTT_INDEX__ symbols. */ + +static bfd_boolean +elf_vxworks_gott_symbol_p (bfd *abfd, const char *name) +{ + char leading; + + leading = bfd_get_symbol_leading_char (abfd); + if (leading) + { + if (*name != leading) + return FALSE; + name++; + } + return (strcmp (name, "__GOTT_BASE__") == 0 + || strcmp (name, "__GOTT_INDEX__") == 0); +} + /* Tweak magic VxWorks symbols as they are loaded. */ bfd_boolean -elf_vxworks_add_symbol_hook (bfd *abfd ATTRIBUTE_UNUSED, +elf_vxworks_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, Elf_Internal_Sym *sym, const char **namep, @@ -45,8 +64,7 @@ elf_vxworks_add_symbol_hook (bfd *abfd ATTRIBUTE_UNUSED, This transformation will be undone in elf_i386_vxworks_link_output_symbol_hook. */ if ((info->shared || abfd->flags & DYNAMIC) - && (strcmp (*namep, "__GOTT_INDEX__") == 0 - || strcmp (*namep, "__GOTT_BASE__") == 0)) + && elf_vxworks_gott_symbol_p (abfd, *namep)) { sym->st_info = ELF_ST_INFO (STB_WEAK, ELF_ST_TYPE (sym->st_info)); *flagsp |= BSF_WEAK; @@ -114,16 +132,12 @@ elf_vxworks_link_output_symbol_hook (struct bfd_link_info *info const char *name, Elf_Internal_Sym *sym, asection *input_sec ATTRIBUTE_UNUSED, - struct elf_link_hash_entry *h - ATTRIBUTE_UNUSED) + struct elf_link_hash_entry *h) { - /* Ignore the first dummy symbol. */ - if (!name) - return TRUE; - /* Reverse the effects of the hack in elf_vxworks_add_symbol_hook. */ - if (strcmp (name, "__GOTT_INDEX__") == 0 - || strcmp (name, "__GOTT_BASE__") == 0) + if (h + && h->root.type == bfd_link_hash_undefweak + && elf_vxworks_gott_symbol_p (h->root.u.undef.abfd, name)) sym->st_info = ELF_ST_INFO (STB_GLOBAL, ELF_ST_TYPE (sym->st_info)); return TRUE; @@ -171,8 +185,7 @@ elf_vxworks_emit_relocs (bfd *output_bfd, for (j = 0; j < bed->s->int_rels_per_ext_rel; j++) { asection *sec = (*rel_hash)->root.u.def.section; - int this_idx = - elf_section_data (sec->output_section)->this_idx; + int this_idx = sec->output_section->target_index; irela[j].r_info = ELF32_R_INFO (this_idx, ELF32_R_TYPE (irela[j].r_info)); diff --git a/bfd/elf32-sh-relocs.h b/bfd/elf32-sh-relocs.h new file mode 100644 index 0000000000..3488ef4edb --- /dev/null +++ b/bfd/elf32-sh-relocs.h @@ -0,0 +1,1716 @@ + /* No relocation. */ + HOWTO (R_SH_NONE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 32 bit absolute relocation. Setting partial_inplace to TRUE and + src_mask to a non-zero value is similar to the COFF toolchain. */ + HOWTO (R_SH_DIR32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + SH_ELF_RELOC, /* special_function */ + "R_SH_DIR32", /* name */ + SH_PARTIAL32, /* partial_inplace */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 32 bit PC relative relocation. */ + HOWTO (R_SH_REL32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_REL32", /* name */ + SH_PARTIAL32, /* partial_inplace */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 8 bit PC relative branch divided by 2. */ + HOWTO (R_SH_DIR8WPN, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_DIR8WPN", /* name */ + TRUE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 12 bit PC relative branch divided by 2. */ + /* This cannot be partial_inplace because relaxation can't know the + eventual value of a symbol. */ + HOWTO (R_SH_IND12W, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + NULL, /* special_function */ + "R_SH_IND12W", /* name */ + FALSE, /* partial_inplace */ + 0x0, /* src_mask */ + 0xfff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 8 bit unsigned PC relative divided by 4. */ + HOWTO (R_SH_DIR8WPL, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_DIR8WPL", /* name */ + TRUE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 8 bit unsigned PC relative divided by 2. */ + HOWTO (R_SH_DIR8WPZ, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_DIR8WPZ", /* name */ + TRUE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 8 bit GBR relative. FIXME: This only makes sense if we have some + special symbol for the GBR relative area, and that is not + implemented. */ + HOWTO (R_SH_DIR8BP, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_DIR8BP", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 8 bit GBR relative divided by 2. FIXME: This only makes sense if + we have some special symbol for the GBR relative area, and that + is not implemented. */ + HOWTO (R_SH_DIR8W, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_DIR8W", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 8 bit GBR relative divided by 4. FIXME: This only makes sense if + we have some special symbol for the GBR relative area, and that + is not implemented. */ + HOWTO (R_SH_DIR8L, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_DIR8L", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 8 bit PC relative divided by 2 - but specified in a very odd way. */ + HOWTO (R_SH_LOOP_START, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_LOOP_START", /* name */ + TRUE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 8 bit PC relative divided by 2 - but specified in a very odd way. */ + HOWTO (R_SH_LOOP_END, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_LOOP_END", /* name */ + TRUE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + EMPTY_HOWTO (12), + EMPTY_HOWTO (13), + EMPTY_HOWTO (14), + EMPTY_HOWTO (15), + EMPTY_HOWTO (16), + EMPTY_HOWTO (17), + EMPTY_HOWTO (18), + EMPTY_HOWTO (19), + EMPTY_HOWTO (20), + EMPTY_HOWTO (21), + + /* The remaining relocs are a GNU extension used for relaxing. The + final pass of the linker never needs to do anything with any of + these relocs. Any required operations are handled by the + relaxation code. */ + + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_SH_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_SH_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_SH_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_SH_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An 8 bit switch table entry. This is generated for an expression + such as ``.word L1 - L2''. The offset holds the difference + between the reloc address and L2. */ + HOWTO (R_SH_SWITCH8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_SWITCH8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 16 bit switch table entry. This is generated for an expression + such as ``.word L1 - L2''. The offset holds the difference + between the reloc address and L2. */ + HOWTO (R_SH_SWITCH16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_SWITCH16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 32 bit switch table entry. This is generated for an expression + such as ``.long L1 - L2''. The offset holds the difference + between the reloc address and L2. */ + HOWTO (R_SH_SWITCH32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_SWITCH32", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Indicates a .uses pseudo-op. The compiler will generate .uses + pseudo-ops when it finds a function call which can be relaxed. + The offset field holds the PC relative offset to the instruction + which loads the register used in the function call. */ + HOWTO (R_SH_USES, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_USES", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* The assembler will generate this reloc for addresses referred to + by the register loads associated with USES relocs. The offset + field holds the number of times the address is referenced in the + object file. */ + HOWTO (R_SH_COUNT, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_COUNT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Indicates an alignment statement. The offset field is the power + of 2 to which subsequent portions of the object file must be + aligned. */ + HOWTO (R_SH_ALIGN, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_ALIGN", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* The assembler will generate this reloc before a block of + instructions. A section should be processed as assuming it + contains data, unless this reloc is seen. */ + HOWTO (R_SH_CODE, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_CODE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* The assembler will generate this reloc after a block of + instructions when it sees data that is not instructions. */ + HOWTO (R_SH_DATA, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_DATA", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* The assembler generates this reloc for each label within a block + of instructions. This permits the linker to avoid swapping + instructions which are the targets of branches. */ + HOWTO (R_SH_LABEL, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_LABEL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* The next 12 are only supported via linking in SHC-generated objects. */ + HOWTO (R_SH_DIR16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR8UL, /* type */ + 2, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR8UL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR8UW, /* type */ + 1, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR8UW", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR8U, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR8U", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR8SW, /* type */ + 1, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR8SW", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR8S, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR8S", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR4UL, /* type */ + 2, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 4, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR4UL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0f, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR4UW, /* type */ + 1, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 4, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR4UW", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0f, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR4U, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 4, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR4U", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0f, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_PSHA, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 7, /* bitsize */ + FALSE, /* pc_relative */ + 4, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PSHA", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0f, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_PSHL, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 7, /* bitsize */ + FALSE, /* pc_relative */ + 4, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PSHL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0f, /* dst_mask */ + FALSE), /* pcrel_offset */ + +#ifdef INCLUDE_SHMEDIA + /* Used in SHLLI.L and SHLRI.L. */ + HOWTO (R_SH_DIR5U, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 5, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR5U", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xfc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in SHARI, SHLLI et al. */ + HOWTO (R_SH_DIR6U, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 6, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR6U", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xfc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in BxxI, LDHI.L et al. */ + HOWTO (R_SH_DIR6S, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 6, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR6S", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xfc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in ADDI, ANDI et al. */ + HOWTO (R_SH_DIR10S, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 10, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10S", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in LD.UW, ST.W et al. */ + HOWTO (R_SH_DIR10SW, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 11, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10SW", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in LD.L, FLD.S et al. */ + HOWTO (R_SH_DIR10SL, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10SL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in FLD.D, FST.P et al. */ + HOWTO (R_SH_DIR10SQ, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 13, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10SQ", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + +#else + EMPTY_HOWTO (45), + EMPTY_HOWTO (46), + EMPTY_HOWTO (47), + EMPTY_HOWTO (48), + EMPTY_HOWTO (49), + EMPTY_HOWTO (50), + EMPTY_HOWTO (51), +#endif + + EMPTY_HOWTO (52), + + HOWTO (R_SH_DIR16S, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR16S", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (54), + EMPTY_HOWTO (55), + EMPTY_HOWTO (56), + EMPTY_HOWTO (57), + EMPTY_HOWTO (58), + EMPTY_HOWTO (59), + EMPTY_HOWTO (60), + EMPTY_HOWTO (61), + EMPTY_HOWTO (62), + EMPTY_HOWTO (63), + EMPTY_HOWTO (64), + EMPTY_HOWTO (65), + EMPTY_HOWTO (66), + EMPTY_HOWTO (67), + EMPTY_HOWTO (68), + EMPTY_HOWTO (69), + EMPTY_HOWTO (70), + EMPTY_HOWTO (71), + EMPTY_HOWTO (72), + EMPTY_HOWTO (73), + EMPTY_HOWTO (74), + EMPTY_HOWTO (75), + EMPTY_HOWTO (76), + EMPTY_HOWTO (77), + EMPTY_HOWTO (78), + EMPTY_HOWTO (79), + EMPTY_HOWTO (80), + EMPTY_HOWTO (81), + EMPTY_HOWTO (82), + EMPTY_HOWTO (83), + EMPTY_HOWTO (84), + EMPTY_HOWTO (85), + EMPTY_HOWTO (86), + EMPTY_HOWTO (87), + EMPTY_HOWTO (88), + EMPTY_HOWTO (89), + EMPTY_HOWTO (90), + EMPTY_HOWTO (91), + EMPTY_HOWTO (92), + EMPTY_HOWTO (93), + EMPTY_HOWTO (94), + EMPTY_HOWTO (95), + EMPTY_HOWTO (96), + EMPTY_HOWTO (97), + EMPTY_HOWTO (98), + EMPTY_HOWTO (99), + EMPTY_HOWTO (100), + EMPTY_HOWTO (101), + EMPTY_HOWTO (102), + EMPTY_HOWTO (103), + EMPTY_HOWTO (104), + EMPTY_HOWTO (105), + EMPTY_HOWTO (106), + EMPTY_HOWTO (107), + EMPTY_HOWTO (108), + EMPTY_HOWTO (109), + EMPTY_HOWTO (110), + EMPTY_HOWTO (111), + EMPTY_HOWTO (112), + EMPTY_HOWTO (113), + EMPTY_HOWTO (114), + EMPTY_HOWTO (115), + EMPTY_HOWTO (116), + EMPTY_HOWTO (117), + EMPTY_HOWTO (118), + EMPTY_HOWTO (119), + EMPTY_HOWTO (120), + EMPTY_HOWTO (121), + EMPTY_HOWTO (122), + EMPTY_HOWTO (123), + EMPTY_HOWTO (124), + EMPTY_HOWTO (125), + EMPTY_HOWTO (126), + EMPTY_HOWTO (127), + EMPTY_HOWTO (128), + EMPTY_HOWTO (129), + EMPTY_HOWTO (130), + EMPTY_HOWTO (131), + EMPTY_HOWTO (132), + EMPTY_HOWTO (133), + EMPTY_HOWTO (134), + EMPTY_HOWTO (135), + EMPTY_HOWTO (136), + EMPTY_HOWTO (137), + EMPTY_HOWTO (138), + EMPTY_HOWTO (139), + EMPTY_HOWTO (140), + EMPTY_HOWTO (141), + EMPTY_HOWTO (142), + EMPTY_HOWTO (143), + + HOWTO (R_SH_TLS_GD_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_TLS_GD_32", /* name */ + SH_PARTIAL32, /* partial_inplace */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_TLS_LD_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_TLS_LD_32", /* name */ + SH_PARTIAL32, /* partial_inplace */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_TLS_LDO_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_TLS_LDO_32", /* name */ + SH_PARTIAL32, /* partial_inplace */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_TLS_IE_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_TLS_IE_32", /* name */ + SH_PARTIAL32, /* partial_inplace */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_TLS_LE_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_TLS_LE_32", /* name */ + SH_PARTIAL32, /* partial_inplace */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_TLS_DTPMOD32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_TLS_DTPMOD32", /* name */ + SH_PARTIAL32, /* partial_inplace */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_TLS_DTPOFF32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_TLS_DTPOFF32", /* name */ + SH_PARTIAL32, /* partial_inplace */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_TLS_TPOFF32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_TLS_TPOFF32", /* name */ + SH_PARTIAL32, /* partial_inplace */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (152), + EMPTY_HOWTO (153), + EMPTY_HOWTO (154), + EMPTY_HOWTO (155), + EMPTY_HOWTO (156), + EMPTY_HOWTO (157), + EMPTY_HOWTO (158), + EMPTY_HOWTO (159), + + HOWTO (R_SH_GOT32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_GOT32", /* name */ + SH_PARTIAL32, /* partial_inplace */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_PLT32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_PLT32", /* name */ + SH_PARTIAL32, /* partial_inplace */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_SH_COPY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_COPY", /* name */ + SH_PARTIAL32, /* partial_inplace */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_GLOB_DAT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_GLOB_DAT", /* name */ + SH_PARTIAL32, /* partial_inplace */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_JMP_SLOT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_JMP_SLOT", /* name */ + SH_PARTIAL32, /* partial_inplace */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_RELATIVE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_RELATIVE", /* name */ + SH_PARTIAL32, /* partial_inplace */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_GOTOFF, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_GOTOFF", /* name */ + SH_PARTIAL32, /* partial_inplace */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_GOTPC, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_GOTPC", /* name */ + SH_PARTIAL32, /* partial_inplace */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_SH_GOTPLT32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_GOTPLT32", /* name */ + FALSE, /* partial_inplace */ + /* ??? Why not 0? */ + SH_SRC_MASK32, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + +#ifdef INCLUDE_SHMEDIA + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOT_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_LOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOT_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_MEDLOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOT_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_MEDHI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOT_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOTPLT_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_LOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOTPLT_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_MEDLOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOTPLT_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_MEDHI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOTPLT_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_PLT_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_LOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_PLT_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_MEDLOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_PLT_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_MEDHI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_PLT_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOTOFF_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_LOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOTOFF_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_MEDLOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOTOFF_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_MEDHI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOTOFF_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOTPC_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_LOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOTPC_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_MEDLOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOTPC_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_MEDHI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOTPC_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in LD.L, FLD.S et al. */ + HOWTO (R_SH_GOT10BY4, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT10BY4", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in LD.L, FLD.S et al. */ + HOWTO (R_SH_GOTPLT10BY4, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT10BY4", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in FLD.D, FST.P et al. */ + HOWTO (R_SH_GOT10BY8, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 13, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT10BY8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in FLD.D, FST.P et al. */ + HOWTO (R_SH_GOTPLT10BY8, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 13, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT10BY8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_COPY64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_COPY64", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_GLOB_DAT64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GLOB_DAT64", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_JMP_SLOT64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_JMP_SLOT64", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_RELATIVE64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_RELATIVE64", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (197), + EMPTY_HOWTO (198), + EMPTY_HOWTO (199), + EMPTY_HOWTO (200), + EMPTY_HOWTO (201), + EMPTY_HOWTO (202), + EMPTY_HOWTO (203), + EMPTY_HOWTO (204), + EMPTY_HOWTO (205), + EMPTY_HOWTO (206), + EMPTY_HOWTO (207), + EMPTY_HOWTO (208), + EMPTY_HOWTO (209), + EMPTY_HOWTO (210), + EMPTY_HOWTO (211), + EMPTY_HOWTO (212), + EMPTY_HOWTO (213), + EMPTY_HOWTO (214), + EMPTY_HOWTO (215), + EMPTY_HOWTO (216), + EMPTY_HOWTO (217), + EMPTY_HOWTO (218), + EMPTY_HOWTO (219), + EMPTY_HOWTO (220), + EMPTY_HOWTO (221), + EMPTY_HOWTO (222), + EMPTY_HOWTO (223), + EMPTY_HOWTO (224), + EMPTY_HOWTO (225), + EMPTY_HOWTO (226), + EMPTY_HOWTO (227), + EMPTY_HOWTO (228), + EMPTY_HOWTO (229), + EMPTY_HOWTO (230), + EMPTY_HOWTO (231), + EMPTY_HOWTO (232), + EMPTY_HOWTO (233), + EMPTY_HOWTO (234), + EMPTY_HOWTO (235), + EMPTY_HOWTO (236), + EMPTY_HOWTO (237), + EMPTY_HOWTO (238), + EMPTY_HOWTO (239), + EMPTY_HOWTO (240), + EMPTY_HOWTO (241), + + /* Relocations for SHmedia code. None of these are partial_inplace or + use the field being relocated (except R_SH_PT_16). */ + + /* The assembler will generate this reloc before a block of SHmedia + instructions. A section should be processed as assuming it contains + data, unless this reloc is seen. Note that a block of SHcompact + instructions are instead preceded by R_SH_CODE. + This is currently not implemented, but should be used for SHmedia + linker relaxation. */ + HOWTO (R_SH_SHMEDIA_CODE, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_SHMEDIA_CODE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* The assembler will generate this reloc at a PTA or PTB instruction, + and the linker checks the right type of target, or changes a PTA to a + PTB, if the original insn was PT. */ + HOWTO (R_SH_PT_16, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 18, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PT_16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in unexpanded MOVI. */ + HOWTO (R_SH_IMMS16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMMS16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in SHORI. */ + HOWTO (R_SH_IMMU16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMMU16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_IMM_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_LOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x - $) & 65536). */ + HOWTO (R_SH_IMM_LOW16_PCREL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_LOW16_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_IMM_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDLOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (((x - $) >> 16) & 65536). */ + HOWTO (R_SH_IMM_MEDLOW16_PCREL, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDLOW16_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_IMM_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDHI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (((x - $) >> 32) & 65536). */ + HOWTO (R_SH_IMM_MEDHI16_PCREL, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDHI16_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_IMM_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (((x - $) >> 48) & 65536). */ + HOWTO (R_SH_IMM_HI16_PCREL, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_HI16_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* For the .uaquad pseudo. */ + HOWTO (R_SH_64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_64", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* For the .uaquad pseudo, (x - $). */ + HOWTO (R_SH_64_PCREL, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_64_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + TRUE), /* pcrel_offset */ + +#endif +#undef SH_PARTIAL32 +#undef SH_SRC_MASK32 +#undef SH_ELF_RELOC diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index b229b5eb8c..f0ebd4fbb2 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -24,6 +24,7 @@ #include "bfdlink.h" #include "libbfd.h" #include "elf-bfd.h" +#include "elf-vxworks.h" #include "elf/sh.h" #include "libiberty.h" #include "../opcodes/sh-opc.h" @@ -52,1722 +53,46 @@ static bfd_vma tpoff #define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1" +#define MINUS_ONE ((bfd_vma) 0 - 1) + +#define SH_PARTIAL32 TRUE +#define SH_SRC_MASK32 0xffffffff +#define SH_ELF_RELOC sh_elf_reloc static reloc_howto_type sh_elf_howto_table[] = { - /* No relocation. */ - HOWTO (R_SH_NONE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_NONE", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* 32 bit absolute relocation. Setting partial_inplace to TRUE and - src_mask to a non-zero value is similar to the COFF toolchain. */ - HOWTO (R_SH_DIR32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_DIR32", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* 32 bit PC relative relocation. */ - HOWTO (R_SH_REL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_REL32", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* 8 bit PC relative branch divided by 2. */ - HOWTO (R_SH_DIR8WPN, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_DIR8WPN", /* name */ - TRUE, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* 12 bit PC relative branch divided by 2. */ - /* This cannot be partial_inplace because relaxation can't know the - eventual value of a symbol. */ - HOWTO (R_SH_IND12W, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 12, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - NULL, /* special_function */ - "R_SH_IND12W", /* name */ - FALSE, /* partial_inplace */ - 0x0, /* src_mask */ - 0xfff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* 8 bit unsigned PC relative divided by 4. */ - HOWTO (R_SH_DIR8WPL, /* type */ - 2, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_DIR8WPL", /* name */ - TRUE, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* 8 bit unsigned PC relative divided by 2. */ - HOWTO (R_SH_DIR8WPZ, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_DIR8WPZ", /* name */ - TRUE, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* 8 bit GBR relative. FIXME: This only makes sense if we have some - special symbol for the GBR relative area, and that is not - implemented. */ - HOWTO (R_SH_DIR8BP, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_DIR8BP", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* 8 bit GBR relative divided by 2. FIXME: This only makes sense if - we have some special symbol for the GBR relative area, and that - is not implemented. */ - HOWTO (R_SH_DIR8W, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_DIR8W", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* 8 bit GBR relative divided by 4. FIXME: This only makes sense if - we have some special symbol for the GBR relative area, and that - is not implemented. */ - HOWTO (R_SH_DIR8L, /* type */ - 2, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_DIR8L", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* 8 bit PC relative divided by 2 - but specified in a very odd way. */ - HOWTO (R_SH_LOOP_START, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_LOOP_START", /* name */ - TRUE, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* 8 bit PC relative divided by 2 - but specified in a very odd way. */ - HOWTO (R_SH_LOOP_END, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_LOOP_END", /* name */ - TRUE, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - EMPTY_HOWTO (12), - EMPTY_HOWTO (13), - EMPTY_HOWTO (14), - EMPTY_HOWTO (15), - EMPTY_HOWTO (16), - EMPTY_HOWTO (17), - EMPTY_HOWTO (18), - EMPTY_HOWTO (19), - EMPTY_HOWTO (20), - EMPTY_HOWTO (21), - - /* The remaining relocs are a GNU extension used for relaxing. The - final pass of the linker never needs to do anything with any of - these relocs. Any required operations are handled by the - relaxation code. */ - - /* GNU extension to record C++ vtable hierarchy */ - HOWTO (R_SH_GNU_VTINHERIT, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - NULL, /* special_function */ - "R_SH_GNU_VTINHERIT", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* GNU extension to record C++ vtable member usage */ - HOWTO (R_SH_GNU_VTENTRY, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_elf_rel_vtable_reloc_fn, /* special_function */ - "R_SH_GNU_VTENTRY", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* An 8 bit switch table entry. This is generated for an expression - such as ``.word L1 - L2''. The offset holds the difference - between the reloc address and L2. */ - HOWTO (R_SH_SWITCH8, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_SWITCH8", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* A 16 bit switch table entry. This is generated for an expression - such as ``.word L1 - L2''. The offset holds the difference - between the reloc address and L2. */ - HOWTO (R_SH_SWITCH16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_SWITCH16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* A 32 bit switch table entry. This is generated for an expression - such as ``.long L1 - L2''. The offset holds the difference - between the reloc address and L2. */ - HOWTO (R_SH_SWITCH32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_SWITCH32", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* Indicates a .uses pseudo-op. The compiler will generate .uses - pseudo-ops when it finds a function call which can be relaxed. - The offset field holds the PC relative offset to the instruction - which loads the register used in the function call. */ - HOWTO (R_SH_USES, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_USES", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* The assembler will generate this reloc for addresses referred to - by the register loads associated with USES relocs. The offset - field holds the number of times the address is referenced in the - object file. */ - HOWTO (R_SH_COUNT, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_COUNT", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* Indicates an alignment statement. The offset field is the power - of 2 to which subsequent portions of the object file must be - aligned. */ - HOWTO (R_SH_ALIGN, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_ALIGN", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* The assembler will generate this reloc before a block of - instructions. A section should be processed as assuming it - contains data, unless this reloc is seen. */ - HOWTO (R_SH_CODE, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_CODE", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* The assembler will generate this reloc after a block of - instructions when it sees data that is not instructions. */ - HOWTO (R_SH_DATA, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_DATA", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* The assembler generates this reloc for each label within a block - of instructions. This permits the linker to avoid swapping - instructions which are the targets of branches. */ - HOWTO (R_SH_LABEL, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_LABEL", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* The next 12 are only supported via linking in SHC-generated objects. */ - HOWTO (R_SH_DIR16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_DIR16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_DIR8, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_DIR8", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_DIR8UL, /* type */ - 2, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_DIR8UL", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_DIR8UW, /* type */ - 1, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_DIR8UW", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_DIR8U, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_DIR8U", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_DIR8SW, /* type */ - 1, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_DIR8SW", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_DIR8S, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_DIR8S", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_DIR4UL, /* type */ - 2, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 4, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_DIR4UL", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x0f, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_DIR4UW, /* type */ - 1, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 4, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_DIR4UW", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x0f, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_DIR4U, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 4, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_DIR4U", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x0f, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_PSHA, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 7, /* bitsize */ - FALSE, /* pc_relative */ - 4, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_PSHA", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x0f, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_PSHL, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 7, /* bitsize */ - FALSE, /* pc_relative */ - 4, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_PSHL", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x0f, /* dst_mask */ - FALSE), /* pcrel_offset */ - -#ifdef INCLUDE_SHMEDIA - /* Used in SHLLI.L and SHLRI.L. */ - HOWTO (R_SH_DIR5U, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 5, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_DIR5U", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xfc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in SHARI, SHLLI et al. */ - HOWTO (R_SH_DIR6U, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 6, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_DIR6U", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xfc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in BxxI, LDHI.L et al. */ - HOWTO (R_SH_DIR6S, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 6, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_DIR6S", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xfc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in ADDI, ANDI et al. */ - HOWTO (R_SH_DIR10S, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 10, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_DIR10S", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in LD.UW, ST.W et al. */ - HOWTO (R_SH_DIR10SW, /* type */ - 1, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 11, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_DIR10SW", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in LD.L, FLD.S et al. */ - HOWTO (R_SH_DIR10SL, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 12, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_DIR10SL", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in FLD.D, FST.P et al. */ - HOWTO (R_SH_DIR10SQ, /* type */ - 3, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 13, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_DIR10SQ", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - -#else - EMPTY_HOWTO (45), - EMPTY_HOWTO (46), - EMPTY_HOWTO (47), - EMPTY_HOWTO (48), - EMPTY_HOWTO (49), - EMPTY_HOWTO (50), - EMPTY_HOWTO (51), -#endif - - EMPTY_HOWTO (52), - - HOWTO (R_SH_DIR16S, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_DIR16S", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - EMPTY_HOWTO (54), - EMPTY_HOWTO (55), - EMPTY_HOWTO (56), - EMPTY_HOWTO (57), - EMPTY_HOWTO (58), - EMPTY_HOWTO (59), - EMPTY_HOWTO (60), - EMPTY_HOWTO (61), - EMPTY_HOWTO (62), - EMPTY_HOWTO (63), - EMPTY_HOWTO (64), - EMPTY_HOWTO (65), - EMPTY_HOWTO (66), - EMPTY_HOWTO (67), - EMPTY_HOWTO (68), - EMPTY_HOWTO (69), - EMPTY_HOWTO (70), - EMPTY_HOWTO (71), - EMPTY_HOWTO (72), - EMPTY_HOWTO (73), - EMPTY_HOWTO (74), - EMPTY_HOWTO (75), - EMPTY_HOWTO (76), - EMPTY_HOWTO (77), - EMPTY_HOWTO (78), - EMPTY_HOWTO (79), - EMPTY_HOWTO (80), - EMPTY_HOWTO (81), - EMPTY_HOWTO (82), - EMPTY_HOWTO (83), - EMPTY_HOWTO (84), - EMPTY_HOWTO (85), - EMPTY_HOWTO (86), - EMPTY_HOWTO (87), - EMPTY_HOWTO (88), - EMPTY_HOWTO (89), - EMPTY_HOWTO (90), - EMPTY_HOWTO (91), - EMPTY_HOWTO (92), - EMPTY_HOWTO (93), - EMPTY_HOWTO (94), - EMPTY_HOWTO (95), - EMPTY_HOWTO (96), - EMPTY_HOWTO (97), - EMPTY_HOWTO (98), - EMPTY_HOWTO (99), - EMPTY_HOWTO (100), - EMPTY_HOWTO (101), - EMPTY_HOWTO (102), - EMPTY_HOWTO (103), - EMPTY_HOWTO (104), - EMPTY_HOWTO (105), - EMPTY_HOWTO (106), - EMPTY_HOWTO (107), - EMPTY_HOWTO (108), - EMPTY_HOWTO (109), - EMPTY_HOWTO (110), - EMPTY_HOWTO (111), - EMPTY_HOWTO (112), - EMPTY_HOWTO (113), - EMPTY_HOWTO (114), - EMPTY_HOWTO (115), - EMPTY_HOWTO (116), - EMPTY_HOWTO (117), - EMPTY_HOWTO (118), - EMPTY_HOWTO (119), - EMPTY_HOWTO (120), - EMPTY_HOWTO (121), - EMPTY_HOWTO (122), - EMPTY_HOWTO (123), - EMPTY_HOWTO (124), - EMPTY_HOWTO (125), - EMPTY_HOWTO (126), - EMPTY_HOWTO (127), - EMPTY_HOWTO (128), - EMPTY_HOWTO (129), - EMPTY_HOWTO (130), - EMPTY_HOWTO (131), - EMPTY_HOWTO (132), - EMPTY_HOWTO (133), - EMPTY_HOWTO (134), - EMPTY_HOWTO (135), - EMPTY_HOWTO (136), - EMPTY_HOWTO (137), - EMPTY_HOWTO (138), - EMPTY_HOWTO (139), - EMPTY_HOWTO (140), - EMPTY_HOWTO (141), - EMPTY_HOWTO (142), - EMPTY_HOWTO (143), - - HOWTO (R_SH_TLS_GD_32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* */ - "R_SH_TLS_GD_32", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_TLS_LD_32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* */ - "R_SH_TLS_LD_32", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_TLS_LDO_32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* */ - "R_SH_TLS_LDO_32", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_TLS_IE_32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* */ - "R_SH_TLS_IE_32", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_TLS_LE_32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* */ - "R_SH_TLS_LE_32", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_TLS_DTPMOD32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* */ - "R_SH_TLS_DTPMOD32", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_TLS_DTPOFF32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* */ - "R_SH_TLS_DTPOFF32", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_TLS_TPOFF32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* */ - "R_SH_TLS_TPOFF32", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - EMPTY_HOWTO (152), - EMPTY_HOWTO (153), - EMPTY_HOWTO (154), - EMPTY_HOWTO (155), - EMPTY_HOWTO (156), - EMPTY_HOWTO (157), - EMPTY_HOWTO (158), - EMPTY_HOWTO (159), - - HOWTO (R_SH_GOT32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* */ - "R_SH_GOT32", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_PLT32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* */ - "R_SH_PLT32", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - HOWTO (R_SH_COPY, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* */ - "R_SH_COPY", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_GLOB_DAT, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* */ - "R_SH_GLOB_DAT", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_JMP_SLOT, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* */ - "R_SH_JMP_SLOT", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_RELATIVE, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* */ - "R_SH_RELATIVE", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_GOTOFF, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* */ - "R_SH_GOTOFF", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_GOTPC, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* */ - "R_SH_GOTPC", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - HOWTO (R_SH_GOTPLT32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* */ - "R_SH_GOTPLT32", /* name */ - FALSE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - -#ifdef INCLUDE_SHMEDIA - /* Used in MOVI and SHORI (x & 65536). */ - HOWTO (R_SH_GOT_LOW16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOT_LOW16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x >> 16) & 65536). */ - HOWTO (R_SH_GOT_MEDLOW16, /* type */ - 16, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOT_MEDLOW16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x >> 32) & 65536). */ - HOWTO (R_SH_GOT_MEDHI16, /* type */ - 32, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOT_MEDHI16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x >> 48) & 65536). */ - HOWTO (R_SH_GOT_HI16, /* type */ - 48, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOT_HI16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in MOVI and SHORI (x & 65536). */ - HOWTO (R_SH_GOTPLT_LOW16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOTPLT_LOW16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x >> 16) & 65536). */ - HOWTO (R_SH_GOTPLT_MEDLOW16, /* type */ - 16, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOTPLT_MEDLOW16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x >> 32) & 65536). */ - HOWTO (R_SH_GOTPLT_MEDHI16, /* type */ - 32, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOTPLT_MEDHI16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x >> 48) & 65536). */ - HOWTO (R_SH_GOTPLT_HI16, /* type */ - 48, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOTPLT_HI16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in MOVI and SHORI (x & 65536). */ - HOWTO (R_SH_PLT_LOW16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - TRUE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_PLT_LOW16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x >> 16) & 65536). */ - HOWTO (R_SH_PLT_MEDLOW16, /* type */ - 16, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - TRUE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_PLT_MEDLOW16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x >> 32) & 65536). */ - HOWTO (R_SH_PLT_MEDHI16, /* type */ - 32, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - TRUE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_PLT_MEDHI16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x >> 48) & 65536). */ - HOWTO (R_SH_PLT_HI16, /* type */ - 48, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - TRUE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_PLT_HI16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* Used in MOVI and SHORI (x & 65536). */ - HOWTO (R_SH_GOTOFF_LOW16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOTOFF_LOW16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x >> 16) & 65536). */ - HOWTO (R_SH_GOTOFF_MEDLOW16, /* type */ - 16, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOTOFF_MEDLOW16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x >> 32) & 65536). */ - HOWTO (R_SH_GOTOFF_MEDHI16, /* type */ - 32, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOTOFF_MEDHI16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x >> 48) & 65536). */ - HOWTO (R_SH_GOTOFF_HI16, /* type */ - 48, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOTOFF_HI16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in MOVI and SHORI (x & 65536). */ - HOWTO (R_SH_GOTPC_LOW16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - TRUE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOTPC_LOW16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x >> 16) & 65536). */ - HOWTO (R_SH_GOTPC_MEDLOW16, /* type */ - 16, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - TRUE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOTPC_MEDLOW16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x >> 32) & 65536). */ - HOWTO (R_SH_GOTPC_MEDHI16, /* type */ - 32, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - TRUE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOTPC_MEDHI16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x >> 48) & 65536). */ - HOWTO (R_SH_GOTPC_HI16, /* type */ - 48, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - TRUE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOTPC_HI16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* Used in LD.L, FLD.S et al. */ - HOWTO (R_SH_GOT10BY4, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 12, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOT10BY4", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in LD.L, FLD.S et al. */ - HOWTO (R_SH_GOTPLT10BY4, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 12, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOTPLT10BY4", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in FLD.D, FST.P et al. */ - HOWTO (R_SH_GOT10BY8, /* type */ - 3, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 13, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOT10BY8", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in FLD.D, FST.P et al. */ - HOWTO (R_SH_GOTPLT10BY8, /* type */ - 3, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 13, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GOTPLT10BY8", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0xffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_COPY64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_COPY64", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - ((bfd_vma) 0) - 1, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_GLOB_DAT64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_GLOB_DAT64", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - ((bfd_vma) 0) - 1, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_JMP_SLOT64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_JMP_SLOT64", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - ((bfd_vma) 0) - 1, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_SH_RELATIVE64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_RELATIVE64", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - ((bfd_vma) 0) - 1, /* dst_mask */ - FALSE), /* pcrel_offset */ - - EMPTY_HOWTO (197), - EMPTY_HOWTO (198), - EMPTY_HOWTO (199), - EMPTY_HOWTO (200), - EMPTY_HOWTO (201), - EMPTY_HOWTO (202), - EMPTY_HOWTO (203), - EMPTY_HOWTO (204), - EMPTY_HOWTO (205), - EMPTY_HOWTO (206), - EMPTY_HOWTO (207), - EMPTY_HOWTO (208), - EMPTY_HOWTO (209), - EMPTY_HOWTO (210), - EMPTY_HOWTO (211), - EMPTY_HOWTO (212), - EMPTY_HOWTO (213), - EMPTY_HOWTO (214), - EMPTY_HOWTO (215), - EMPTY_HOWTO (216), - EMPTY_HOWTO (217), - EMPTY_HOWTO (218), - EMPTY_HOWTO (219), - EMPTY_HOWTO (220), - EMPTY_HOWTO (221), - EMPTY_HOWTO (222), - EMPTY_HOWTO (223), - EMPTY_HOWTO (224), - EMPTY_HOWTO (225), - EMPTY_HOWTO (226), - EMPTY_HOWTO (227), - EMPTY_HOWTO (228), - EMPTY_HOWTO (229), - EMPTY_HOWTO (230), - EMPTY_HOWTO (231), - EMPTY_HOWTO (232), - EMPTY_HOWTO (233), - EMPTY_HOWTO (234), - EMPTY_HOWTO (235), - EMPTY_HOWTO (236), - EMPTY_HOWTO (237), - EMPTY_HOWTO (238), - EMPTY_HOWTO (239), - EMPTY_HOWTO (240), - EMPTY_HOWTO (241), - - /* Relocations for SHmedia code. None of these are partial_inplace or - use the field being relocated (except R_SH_PT_16). */ - - /* The assembler will generate this reloc before a block of SHmedia - instructions. A section should be processed as assuming it contains - data, unless this reloc is seen. Note that a block of SHcompact - instructions are instead preceded by R_SH_CODE. - This is currently not implemented, but should be used for SHmedia - linker relaxation. */ - HOWTO (R_SH_SHMEDIA_CODE, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_SHMEDIA_CODE", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* The assembler will generate this reloc at a PTA or PTB instruction, - and the linker checks the right type of target, or changes a PTA to a - PTB, if the original insn was PT. */ - HOWTO (R_SH_PT_16, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 18, /* bitsize */ - TRUE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_PT_16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* Used in unexpanded MOVI. */ - HOWTO (R_SH_IMMS16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_IMMS16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in SHORI. */ - HOWTO (R_SH_IMMU16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_IMMU16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in MOVI and SHORI (x & 65536). */ - HOWTO (R_SH_IMM_LOW16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_IMM_LOW16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x - $) & 65536). */ - HOWTO (R_SH_IMM_LOW16_PCREL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - TRUE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_IMM_LOW16_PCREL", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x >> 16) & 65536). */ - HOWTO (R_SH_IMM_MEDLOW16, /* type */ - 16, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_IMM_MEDLOW16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in MOVI and SHORI (((x - $) >> 16) & 65536). */ - HOWTO (R_SH_IMM_MEDLOW16_PCREL, /* type */ - 16, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - TRUE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_IMM_MEDLOW16_PCREL", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x >> 32) & 65536). */ - HOWTO (R_SH_IMM_MEDHI16, /* type */ - 32, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_IMM_MEDHI16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in MOVI and SHORI (((x - $) >> 32) & 65536). */ - HOWTO (R_SH_IMM_MEDHI16_PCREL, /* type */ - 32, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - TRUE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_IMM_MEDHI16_PCREL", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* Used in MOVI and SHORI ((x >> 48) & 65536). */ - HOWTO (R_SH_IMM_HI16, /* type */ - 48, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_IMM_HI16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Used in MOVI and SHORI (((x - $) >> 48) & 65536). */ - HOWTO (R_SH_IMM_HI16_PCREL, /* type */ - 48, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - TRUE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_IMM_HI16_PCREL", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0x3fffc00, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* For the .uaquad pseudo. */ - HOWTO (R_SH_64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_64", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - ((bfd_vma) 0) - 1, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* For the .uaquad pseudo, (x - $). */ - HOWTO (R_SH_64_PCREL, /* type */ - 48, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - TRUE, /* pc_relative */ - 10, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_SH_64_PCREL", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - ((bfd_vma) 0) - 1, /* dst_mask */ - TRUE), /* pcrel_offset */ - -#endif +#include "elf32-sh-relocs.h" }; +#define SH_PARTIAL32 FALSE +#define SH_SRC_MASK32 0 +#define SH_ELF_RELOC bfd_elf_generic_reloc +static reloc_howto_type sh_vxworks_howto_table[] = +{ +#include "elf32-sh-relocs.h" +}; + +/* Return true if OUTPUT_BFD is a VxWorks object. */ + +static bfd_boolean +vxworks_object_p (bfd *abfd) +{ + extern const bfd_target bfd_elf32_shlvxworks_vec; + extern const bfd_target bfd_elf32_shvxworks_vec; + + return (abfd->xvec == &bfd_elf32_shlvxworks_vec + || abfd->xvec == &bfd_elf32_shvxworks_vec); +} + +/* Return the howto table for ABFD. */ + +static reloc_howto_type * +get_howto_table (bfd *abfd) +{ + if (vxworks_object_p (abfd)) + return sh_vxworks_howto_table; + return sh_elf_howto_table; +} + static bfd_reloc_status_type sh_elf_reloc_loop (int r_type ATTRIBUTE_UNUSED, bfd *input_bfd, asection *input_section, bfd_byte *contents, @@ -2057,18 +382,17 @@ static const struct elf_reloc_map sh_reloc_map[] = }; /* Given a BFD reloc code, return the howto structure for the - corresponding SH ELf reloc. */ + corresponding SH ELF reloc. */ static reloc_howto_type * -sh_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, - bfd_reloc_code_real_type code) +sh_elf_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) { unsigned int i; for (i = 0; i < sizeof (sh_reloc_map) / sizeof (struct elf_reloc_map); i++) { if (sh_reloc_map[i].bfd_reloc_val == code) - return &sh_elf_howto_table[(int) sh_reloc_map[i].elf_reloc_val]; + return get_howto_table (abfd) + (int) sh_reloc_map[i].elf_reloc_val; } return NULL; @@ -2077,8 +401,7 @@ sh_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, /* Given an ELF reloc, fill in the howto field of a relent. */ static void -sh_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr, - Elf_Internal_Rela *dst) +sh_elf_info_to_howto (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst) { unsigned int r; @@ -2091,7 +414,7 @@ sh_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr, BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_4 || r > R_SH_LAST_INVALID_RELOC_4); BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_5 || r > R_SH_LAST_INVALID_RELOC_5); - cache_ptr->howto = &sh_elf_howto_table[r]; + cache_ptr->howto = get_howto_table (abfd) + r; } /* This function handles relaxing for SH ELF. See the corresponding @@ -2276,7 +599,10 @@ sh_elf_relax_section (bfd *abfd, asection *sec, + h->root.u.def.section->output_offset); } - symval += bfd_get_32 (abfd, contents + paddr); + if (get_howto_table (abfd)[R_SH_DIR32].partial_inplace) + symval += bfd_get_32 (abfd, contents + paddr); + else + symval += irelfn->r_addend; /* See if this function call can be shortened. */ foff = (symval @@ -2591,10 +917,19 @@ sh_elf_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, { bfd_vma val; - val = bfd_get_32 (abfd, contents + nraddr); - val += isym->st_value; - if (val > addr && val < toaddr) - bfd_put_32 (abfd, val - count, contents + nraddr); + if (get_howto_table (abfd)[R_SH_DIR32].partial_inplace) + { + val = bfd_get_32 (abfd, contents + nraddr); + val += isym->st_value; + if (val > addr && val < toaddr) + bfd_put_32 (abfd, val - count, contents + nraddr); + } + else + { + val = isym->st_value + irel->r_addend; + if (val > addr && val < toaddr) + irel->r_addend -= count; + } } } start = stop = addr; @@ -3144,15 +1479,50 @@ sh_elf_swap_insns (bfd *abfd, asection *sec, void *relocs, } #endif /* defined SH64_ELF */ +/* Describes one of the various PLT styles. */ + +struct elf_sh_plt_info +{ + /* The template for the first PLT entry, or NULL if there is no special + first entry. */ + const bfd_byte *plt0_entry; + + /* The size of PLT0_ENTRY in bytes, or 0 if PLT0_ENTRY is NULL. */ + bfd_vma plt0_entry_size; + + /* Index I is the offset into PLT0_ENTRY of a pointer to + _GLOBAL_OFFSET_TABLE_ + I * 4. The value is MINUS_ONE + if there is no such pointer. */ + bfd_vma plt0_got_fields[3]; + + /* The template for a symbol's PLT entry. */ + const bfd_byte *symbol_entry; + + /* The size of SYMBOL_ENTRY in bytes. */ + bfd_vma symbol_entry_size; + + /* Byte offsets of fields in SYMBOL_ENTRY. Not all fields are used + on all targets. The comments by each member indicate the value + that the field must hold. */ + struct { + bfd_vma got_entry; /* the address of the symbol's .got.plt entry */ + bfd_vma plt; /* .plt (or a branch to .plt on VxWorks) */ + bfd_vma reloc_offset; /* the offset of the symbol's JMP_SLOT reloc */ + } symbol_fields; + + /* The offset of the resolver stub from the start of SYMBOL_ENTRY. */ + bfd_vma symbol_resolve_offset; +}; + #ifdef INCLUDE_SHMEDIA /* The size in bytes of an entry in the procedure linkage table. */ -#define PLT_ENTRY_SIZE 64 +#define ELF_PLT_ENTRY_SIZE 64 /* First entry in an absolute procedure linkage table look like this. */ -static const bfd_byte elf_sh_plt0_entry_be[PLT_ENTRY_SIZE] = +static const bfd_byte elf_sh_plt0_entry_be[ELF_PLT_ENTRY_SIZE] = { 0xcc, 0x00, 0x01, 0x10, /* movi .got.plt >> 16, r17 */ 0xc8, 0x00, 0x01, 0x10, /* shori .got.plt & 65535, r17 */ @@ -3172,7 +1542,7 @@ static const bfd_byte elf_sh_plt0_entry_be[PLT_ENTRY_SIZE] = 0x6f, 0xf0, 0xff, 0xf0, /* nop */ }; -static const bfd_byte elf_sh_plt0_entry_le[PLT_ENTRY_SIZE] = +static const bfd_byte elf_sh_plt0_entry_le[ELF_PLT_ENTRY_SIZE] = { 0x10, 0x01, 0x00, 0xcc, /* movi .got.plt >> 16, r17 */ 0x10, 0x01, 0x00, 0xc8, /* shori .got.plt & 65535, r17 */ @@ -3195,7 +1565,7 @@ static const bfd_byte elf_sh_plt0_entry_le[PLT_ENTRY_SIZE] = /* Sebsequent entries in an absolute procedure linkage table look like this. */ -static const bfd_byte elf_sh_plt_entry_be[PLT_ENTRY_SIZE] = +static const bfd_byte elf_sh_plt_entry_be[ELF_PLT_ENTRY_SIZE] = { 0xcc, 0x00, 0x01, 0x90, /* movi nameN-in-GOT >> 16, r25 */ 0xc8, 0x00, 0x01, 0x90, /* shori nameN-in-GOT & 65535, r25 */ @@ -3215,7 +1585,7 @@ static const bfd_byte elf_sh_plt_entry_be[PLT_ENTRY_SIZE] = 0x6f, 0xf0, 0xff, 0xf0, /* nop */ }; -static const bfd_byte elf_sh_plt_entry_le[PLT_ENTRY_SIZE] = +static const bfd_byte elf_sh_plt_entry_le[ELF_PLT_ENTRY_SIZE] = { 0x90, 0x01, 0x00, 0xcc, /* movi nameN-in-GOT >> 16, r25 */ 0x90, 0x01, 0x00, 0xc8, /* shori nameN-in-GOT & 65535, r25 */ @@ -3237,7 +1607,7 @@ static const bfd_byte elf_sh_plt_entry_le[PLT_ENTRY_SIZE] = /* Entries in a PIC procedure linkage table look like this. */ -static const bfd_byte elf_sh_pic_plt_entry_be[PLT_ENTRY_SIZE] = +static const bfd_byte elf_sh_pic_plt_entry_be[ELF_PLT_ENTRY_SIZE] = { 0xcc, 0x00, 0x01, 0x90, /* movi nameN@GOT >> 16, r25 */ 0xc8, 0x00, 0x01, 0x90, /* shori nameN@GOT & 65535, r25 */ @@ -3257,7 +1627,7 @@ static const bfd_byte elf_sh_pic_plt_entry_be[PLT_ENTRY_SIZE] = 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ }; -static const bfd_byte elf_sh_pic_plt_entry_le[PLT_ENTRY_SIZE] = +static const bfd_byte elf_sh_pic_plt_entry_le[ELF_PLT_ENTRY_SIZE] = { 0x90, 0x01, 0x00, 0xcc, /* movi nameN@GOT >> 16, r25 */ 0x90, 0x01, 0x00, 0xc8, /* shori nameN@GOT & 65535, r25 */ @@ -3277,31 +1647,67 @@ static const bfd_byte elf_sh_pic_plt_entry_le[PLT_ENTRY_SIZE] = 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ }; -static const bfd_byte *elf_sh_plt0_entry; -static const bfd_byte *elf_sh_plt_entry; -static const bfd_byte *elf_sh_pic_plt_entry; - -/* Return size of a PLT entry. */ -#define elf_sh_sizeof_plt(info) PLT_ENTRY_SIZE - -/* Return offset of the PLT0 address in an absolute PLT entry. */ -#define elf_sh_plt_plt0_offset(info) 32 +static const struct elf_sh_plt_info elf_sh_plts[2][2] = { + { + { + /* Big-endian non-PIC. */ + elf_sh_plt0_entry_be, + ELF_PLT_ENTRY_SIZE, + { 0, MINUS_ONE, MINUS_ONE }, + elf_sh_plt_entry_be, + ELF_PLT_ENTRY_SIZE, + { 0, 32, 48 }, + 33 /* includes ISA encoding */ + }, + { + /* Little-endian non-PIC. */ + elf_sh_plt0_entry_le, + ELF_PLT_ENTRY_SIZE, + { 0, MINUS_ONE, MINUS_ONE }, + elf_sh_plt_entry_le, + ELF_PLT_ENTRY_SIZE, + { 0, 32, 48 }, + 33 /* includes ISA encoding */ + }, + }, + { + { + /* Big-endian PIC. */ + elf_sh_plt0_entry_be, + ELF_PLT_ENTRY_SIZE, + { MINUS_ONE, MINUS_ONE, MINUS_ONE }, + elf_sh_pic_plt_entry_be, + ELF_PLT_ENTRY_SIZE, + { 0, MINUS_ONE, 52 }, + 33 /* includes ISA encoding */ + }, + { + /* Little-endian PIC. */ + elf_sh_plt0_entry_le, + ELF_PLT_ENTRY_SIZE, + { MINUS_ONE, MINUS_ONE, MINUS_ONE }, + elf_sh_pic_plt_entry_le, + ELF_PLT_ENTRY_SIZE, + { 0, MINUS_ONE, 52 }, + 33 /* includes ISA encoding */ + }, + } +}; /* Return offset of the linker in PLT0 entry. */ #define elf_sh_plt0_gotplt_offset(info) 0 -/* Return offset of the trampoline in PLT entry */ -#define elf_sh_plt_temp_offset(info) 33 /* Add one because it's SHmedia. */ +/* Install a 32-bit PLT field starting at ADDR, which occurs in OUTPUT_BFD. + VALUE is the field's value and CODE_P is true if VALUE refers to code, + not data. -/* Return offset of the symbol in PLT entry. */ -#define elf_sh_plt_symbol_offset(info) 0 - -/* Return offset of the relocation in PLT entry. */ -#define elf_sh_plt_reloc_offset(info) (info->shared ? 52 : 44) + On SH64, each 32-bit field is loaded by a movi/shori pair. */ inline static void -movi_shori_putval (bfd *output_bfd, unsigned long value, bfd_byte *addr) +install_plt_field (bfd *output_bfd, bfd_boolean code_p, + unsigned long value, bfd_byte *addr) { + value |= code_p; bfd_put_32 (output_bfd, bfd_get_32 (output_bfd, addr) | ((value >> 6) & 0x3fffc00), @@ -3312,10 +1718,18 @@ movi_shori_putval (bfd *output_bfd, unsigned long value, bfd_byte *addr) addr + 4); } +/* Return the type of PLT associated with ABFD. PIC_P is true if + the object is position-independent. */ + +static const struct elf_sh_plt_info * +get_plt_info (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean pic_p) +{ + return &elf_sh_plts[pic_p][!bfd_big_endian (abfd)]; +} #else /* The size in bytes of an entry in the procedure linkage table. */ -#define PLT_ENTRY_SIZE 28 +#define ELF_PLT_ENTRY_SIZE 28 /* First entry in an absolute procedure linkage table look like this. */ @@ -3327,7 +1741,7 @@ movi_shori_putval (bfd *output_bfd, unsigned long value, bfd_byte *addr) ignores the type. Loaders can easily detect this difference however, since the type will always be 0 or 8, and the GOT ids will always be greater than or equal to 12. */ -static const bfd_byte elf_sh_plt0_entry_be[PLT_ENTRY_SIZE] = +static const bfd_byte elf_sh_plt0_entry_be[ELF_PLT_ENTRY_SIZE] = { 0xd0, 0x05, /* mov.l 2f,r0 */ 0x60, 0x02, /* mov.l @r0,r0 */ @@ -3343,7 +1757,7 @@ static const bfd_byte elf_sh_plt0_entry_be[PLT_ENTRY_SIZE] = 0, 0, 0, 0, /* 2: replaced with address of .got.plt + 4. */ }; -static const bfd_byte elf_sh_plt0_entry_le[PLT_ENTRY_SIZE] = +static const bfd_byte elf_sh_plt0_entry_le[ELF_PLT_ENTRY_SIZE] = { 0x05, 0xd0, /* mov.l 2f,r0 */ 0x02, 0x60, /* mov.l @r0,r0 */ @@ -3362,10 +1776,10 @@ static const bfd_byte elf_sh_plt0_entry_le[PLT_ENTRY_SIZE] = /* Sebsequent entries in an absolute procedure linkage table look like this. */ -static const bfd_byte elf_sh_plt_entry_be[PLT_ENTRY_SIZE] = +static const bfd_byte elf_sh_plt_entry_be[ELF_PLT_ENTRY_SIZE] = { 0xd0, 0x04, /* mov.l 1f,r0 */ - 0x60, 0x02, /* mov.l @r0,r0 */ + 0x60, 0x02, /* mov.l @(r0,r12),r0 */ 0xd1, 0x02, /* mov.l 0f,r1 */ 0x40, 0x2b, /* jmp @r0 */ 0x60, 0x13, /* mov r1,r0 */ @@ -3377,7 +1791,7 @@ static const bfd_byte elf_sh_plt_entry_be[PLT_ENTRY_SIZE] = 0, 0, 0, 0, /* 2: replaced with offset into relocation table. */ }; -static const bfd_byte elf_sh_plt_entry_le[PLT_ENTRY_SIZE] = +static const bfd_byte elf_sh_plt_entry_le[ELF_PLT_ENTRY_SIZE] = { 0x04, 0xd0, /* mov.l 1f,r0 */ 0x02, 0x60, /* mov.l @r0,r0 */ @@ -3394,7 +1808,7 @@ static const bfd_byte elf_sh_plt_entry_le[PLT_ENTRY_SIZE] = /* Entries in a PIC procedure linkage table look like this. */ -static const bfd_byte elf_sh_pic_plt_entry_be[PLT_ENTRY_SIZE] = +static const bfd_byte elf_sh_pic_plt_entry_be[ELF_PLT_ENTRY_SIZE] = { 0xd0, 0x04, /* mov.l 1f,r0 */ 0x00, 0xce, /* mov.l @(r0,r12),r0 */ @@ -3410,7 +1824,7 @@ static const bfd_byte elf_sh_pic_plt_entry_be[PLT_ENTRY_SIZE] = 0, 0, 0, 0 /* 2: replaced with offset into relocation table. */ }; -static const bfd_byte elf_sh_pic_plt_entry_le[PLT_ENTRY_SIZE] = +static const bfd_byte elf_sh_pic_plt_entry_le[ELF_PLT_ENTRY_SIZE] = { 0x04, 0xd0, /* mov.l 1f,r0 */ 0xce, 0x00, /* mov.l @(r0,r12),r0 */ @@ -3426,32 +1840,216 @@ static const bfd_byte elf_sh_pic_plt_entry_le[PLT_ENTRY_SIZE] = 0, 0, 0, 0 /* 2: replaced with offset into relocation table. */ }; -static const bfd_byte *elf_sh_plt0_entry; -static const bfd_byte *elf_sh_plt_entry; -static const bfd_byte *elf_sh_pic_plt_entry; +static const struct elf_sh_plt_info elf_sh_plts[2][2] = { + { + { + /* Big-endian non-PIC. */ + elf_sh_plt0_entry_be, + ELF_PLT_ENTRY_SIZE, + { MINUS_ONE, 24, 20 }, + elf_sh_plt_entry_be, + ELF_PLT_ENTRY_SIZE, + { 20, 16, 24 }, + 8 + }, + { + /* Little-endian non-PIC. */ + elf_sh_plt0_entry_le, + ELF_PLT_ENTRY_SIZE, + { MINUS_ONE, 24, 20 }, + elf_sh_plt_entry_le, + ELF_PLT_ENTRY_SIZE, + { 20, 16, 24 }, + 8 + }, + }, + { + { + /* Big-endian PIC. */ + elf_sh_plt0_entry_be, + ELF_PLT_ENTRY_SIZE, + { MINUS_ONE, MINUS_ONE, MINUS_ONE }, + elf_sh_pic_plt_entry_be, + ELF_PLT_ENTRY_SIZE, + { 20, MINUS_ONE, 24 }, + 8 + }, + { + /* Little-endian PIC. */ + elf_sh_plt0_entry_le, + ELF_PLT_ENTRY_SIZE, + { MINUS_ONE, MINUS_ONE, MINUS_ONE }, + elf_sh_pic_plt_entry_le, + ELF_PLT_ENTRY_SIZE, + { 20, MINUS_ONE, 24 }, + 8 + }, + } +}; -/* Return size of a PLT entry. */ -#define elf_sh_sizeof_plt(info) PLT_ENTRY_SIZE +#define VXWORKS_PLT_HEADER_SIZE 12 +#define VXWORKS_PLT_ENTRY_SIZE 24 -/* Return offset of the PLT0 address in an absolute PLT entry. */ -#define elf_sh_plt_plt0_offset(info) 16 +static const bfd_byte vxworks_sh_plt0_entry_be[VXWORKS_PLT_HEADER_SIZE] = +{ + 0xd1, 0x01, /* mov.l @(8,pc),r1 */ + 0x61, 0x12, /* mov.l @r1,r1 */ + 0x41, 0x2b, /* jmp @r1 */ + 0x00, 0x09, /* nop */ + 0, 0, 0, 0 /* 0: replaced with _GLOBAL_OFFSET_TABLE+8. */ +}; -/* Return offset of the linker in PLT0 entry. */ -#define elf_sh_plt0_linker_offset(info) 20 +static const bfd_byte vxworks_sh_plt0_entry_le[VXWORKS_PLT_HEADER_SIZE] = +{ + 0x01, 0xd1, /* mov.l @(8,pc),r1 */ + 0x12, 0x61, /* mov.l @r1,r1 */ + 0x2b, 0x41, /* jmp @r1 */ + 0x09, 0x00, /* nop */ + 0, 0, 0, 0 /* 0: replaced with _GLOBAL_OFFSET_TABLE+8. */ +}; -/* Return offset of the GOT id in PLT0 entry. */ -#define elf_sh_plt0_gotid_offset(info) 24 +static const bfd_byte vxworks_sh_plt_entry_be[VXWORKS_PLT_ENTRY_SIZE] = +{ + 0xd0, 0x01, /* mov.l @(8,pc),r0 */ + 0x60, 0x02, /* mov.l @r0,r0 */ + 0x40, 0x2b, /* jmp @r0 */ + 0x00, 0x09, /* nop */ + 0, 0, 0, 0, /* 0: replaced with address of this symbol in .got. */ + 0xd0, 0x01, /* mov.l @(8,pc),r0 */ + 0xa0, 0x00, /* bra PLT (We need to fix the offset.) */ + 0x00, 0x09, /* nop */ + 0x00, 0x09, /* nop */ + 0, 0, 0, 0, /* 1: replaced with offset into relocation table. */ +}; -/* Return offset of the temporary in PLT entry */ -#define elf_sh_plt_temp_offset(info) 8 +static const bfd_byte vxworks_sh_plt_entry_le[VXWORKS_PLT_ENTRY_SIZE] = +{ + 0x01, 0xd0, /* mov.l @(8,pc),r0 */ + 0x02, 0x60, /* mov.l @r0,r0 */ + 0x2b, 0x40, /* jmp @r0 */ + 0x09, 0x00, /* nop */ + 0, 0, 0, 0, /* 0: replaced with address of this symbol in .got. */ + 0x01, 0xd0, /* mov.l @(8,pc),r0 */ + 0x00, 0xa0, /* bra PLT (We need to fix the offset.) */ + 0x09, 0x00, /* nop */ + 0x09, 0x00, /* nop */ + 0, 0, 0, 0, /* 1: replaced with offset into relocation table. */ +}; -/* Return offset of the symbol in PLT entry. */ -#define elf_sh_plt_symbol_offset(info) 20 +static const bfd_byte vxworks_sh_pic_plt_entry_be[VXWORKS_PLT_ENTRY_SIZE] = +{ + 0xd0, 0x01, /* mov.l @(8,pc),r0 */ + 0x00, 0xce, /* mov.l @(r0,r12),r0 */ + 0x40, 0x2b, /* jmp @r0 */ + 0x00, 0x09, /* nop */ + 0, 0, 0, 0, /* 0: replaced with offset of this symbol in .got. */ + 0xd0, 0x01, /* mov.l @(8,pc),r0 */ + 0x51, 0xc2, /* mov.l @(8,r12),r1 */ + 0x41, 0x2b, /* jmp @r1 */ + 0x00, 0x09, /* nop */ + 0, 0, 0, 0, /* 1: replaced with offset into relocation table. */ +}; -/* Return offset of the relocation in PLT entry. */ -#define elf_sh_plt_reloc_offset(info) 24 +static const bfd_byte vxworks_sh_pic_plt_entry_le[VXWORKS_PLT_ENTRY_SIZE] = +{ + 0x01, 0xd0, /* mov.l @(8,pc),r0 */ + 0xce, 0x00, /* mov.l @(r0,r12),r0 */ + 0x2b, 0x40, /* jmp @r0 */ + 0x09, 0x00, /* nop */ + 0, 0, 0, 0, /* 0: replaced with offset of this symbol in .got. */ + 0x01, 0xd0, /* mov.l @(8,pc),r0 */ + 0xc2, 0x51, /* mov.l @(8,r12),r1 */ + 0x2b, 0x41, /* jmp @r1 */ + 0x09, 0x00, /* nop */ + 0, 0, 0, 0, /* 1: replaced with offset into relocation table. */ +}; + +static const struct elf_sh_plt_info vxworks_sh_plts[2][2] = { + { + { + /* Big-endian non-PIC. */ + vxworks_sh_plt0_entry_be, + VXWORKS_PLT_HEADER_SIZE, + { MINUS_ONE, MINUS_ONE, 8 }, + vxworks_sh_plt_entry_be, + VXWORKS_PLT_ENTRY_SIZE, + { 8, 14, 20 }, + 12 + }, + { + /* Little-endian non-PIC. */ + vxworks_sh_plt0_entry_le, + VXWORKS_PLT_HEADER_SIZE, + { MINUS_ONE, MINUS_ONE, 8 }, + vxworks_sh_plt_entry_le, + VXWORKS_PLT_ENTRY_SIZE, + { 8, 14, 20 }, + 12 + }, + }, + { + { + /* Big-endian PIC. */ + NULL, + 0, + { MINUS_ONE, MINUS_ONE, MINUS_ONE }, + vxworks_sh_pic_plt_entry_be, + VXWORKS_PLT_ENTRY_SIZE, + { 8, MINUS_ONE, 20 }, + 12 + }, + { + /* Little-endian PIC. */ + NULL, + 0, + { MINUS_ONE, MINUS_ONE, MINUS_ONE }, + vxworks_sh_pic_plt_entry_le, + VXWORKS_PLT_ENTRY_SIZE, + { 8, MINUS_ONE, 20 }, + 12 + }, + } +}; + +/* Return the type of PLT associated with ABFD. PIC_P is true if + the object is position-independent. */ + +static const struct elf_sh_plt_info * +get_plt_info (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean pic_p) +{ + if (vxworks_object_p (abfd)) + return &vxworks_sh_plts[pic_p][!bfd_big_endian (abfd)]; + return &elf_sh_plts[pic_p][!bfd_big_endian (abfd)]; +} + +/* Install a 32-bit PLT field starting at ADDR, which occurs in OUTPUT_BFD. + VALUE is the field's value and CODE_P is true if VALUE refers to code, + not data. */ + +inline static void +install_plt_field (bfd *output_bfd, bfd_boolean code_p ATTRIBUTE_UNUSED, + unsigned long value, bfd_byte *addr) +{ + bfd_put_32 (output_bfd, value, addr); +} #endif +/* Return the index of the PLT entry at byte offset OFFSET. */ + +static bfd_vma +get_plt_index (const struct elf_sh_plt_info *info, bfd_vma offset) +{ + return (offset - info->plt0_entry_size) / info->symbol_entry_size; +} + +/* Do the inverse operation. */ + +static bfd_vma +get_plt_offset (const struct elf_sh_plt_info *info, bfd_vma index) +{ + return info->plt0_entry_size + (index * info->symbol_entry_size); +} + /* The sh linker needs to keep track of the number of relocs that it decides to copy as dynamic relocs in check_relocs for each symbol. This is so that it can later discard them if they are found to be @@ -3543,6 +2141,9 @@ struct elf_sh_link_hash_table asection *sdynbss; asection *srelbss; + /* The (unloaded but important) VxWorks .rela.plt.unloaded section. */ + asection *srelplt2; + /* Small local sym to section mapping cache. */ struct sym_sec_cache sym_sec; @@ -3552,6 +2153,12 @@ struct elf_sh_link_hash_table bfd_signed_vma refcount; bfd_vma offset; } tls_ldm_got; + + /* The type of PLT to use. */ + const struct elf_sh_plt_info *plt_info; + + /* True if the target system is VxWorks. */ + bfd_boolean vxworks_p; }; /* Traverse an sh ELF linker hash table. */ @@ -3630,8 +2237,11 @@ sh_elf_link_hash_table_create (bfd *abfd) ret->srelplt = NULL; ret->sdynbss = NULL; ret->srelbss = NULL; + ret->srelplt2 = NULL; ret->sym_sec.abfd = NULL; ret->tls_ldm_got.refcount = 0; + ret->plt_info = NULL; + ret->vxworks_p = vxworks_object_p (abfd); return &ret->root.root; } @@ -3813,6 +2423,12 @@ sh_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) } } + if (htab->vxworks_p) + { + if (!elf_vxworks_create_dynamic_sections (abfd, info, &htab->srelplt2)) + return FALSE; + } + return TRUE; } @@ -4035,7 +2651,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* If this is the first .plt entry, make room for the special first entry. */ if (s->size == 0) - s->size += PLT_ENTRY_SIZE; + s->size += htab->plt_info->plt0_entry_size; h->plt.offset = s->size; @@ -4052,7 +2668,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) } /* Make room for this entry. */ - s->size += PLT_ENTRY_SIZE; + s->size += htab->plt_info->symbol_entry_size; /* We also need to make an entry in the .got.plt section, which will be placed in the .got section by the linker script. */ @@ -4060,6 +2676,23 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* We also need to make an entry in the .rel.plt section. */ htab->srelplt->size += sizeof (Elf32_External_Rela); + + if (htab->vxworks_p && !info->shared) + { + /* VxWorks executables have a second set of relocations + for each PLT entry. They go in a separate relocation + section, which is processed by the kernel loader. */ + + /* There is a relocation for the initial PLT entry: + an R_SH_DIR32 relocation for _GLOBAL_OFFSET_TABLE_. */ + if (h->plt.offset == htab->plt_info->plt0_entry_size) + htab->srelplt2->size += sizeof (Elf32_External_Rela); + + /* There are two extra relocations for each subsequent + PLT entry: an R_SH_DIR32 relocation for the GOT entry, + and an R_SH_DIR32 relocation for the PLT entry. */ + htab->srelplt2->size += sizeof (Elf32_External_Rela) * 2; + } } else { @@ -4253,6 +2886,17 @@ readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf) return TRUE; } +/* This function is called after all the input files have been read, + and the input sections have been assigned to output sections. + It's a convenient place to determine the PLT style. */ + +static bfd_boolean +sh_elf_always_size_sections (bfd *output_bfd, struct bfd_link_info *info) +{ + sh_elf_hash_table (info)->plt_info = get_plt_info (output_bfd, info->shared); + return TRUE; +} + /* Set the sizes of the dynamic sections. */ static bfd_boolean @@ -4386,7 +3030,7 @@ sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, } else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) { - if (s->size != 0 && s != htab->srelplt) + if (s->size != 0 && s != htab->srelplt && s != htab->srelplt2) relocs = TRUE; /* We use the reloc_count field as a counter if we need @@ -4557,7 +3201,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, return FALSE; } - howto = sh_elf_howto_table + r_type; + howto = get_howto_table (output_bfd) + r_type; /* For relocs that aren't partial_inplace, we get the addend from the relocation. */ @@ -4956,7 +3600,9 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, BFD_ASSERT (h != NULL && h->dynindx != -1); outrel.r_info = ELF32_R_INFO (h->dynindx, R_SH_REL32); outrel.r_addend - = bfd_get_32 (input_bfd, contents + rel->r_offset); + = (howto->partial_inplace + ? bfd_get_32 (input_bfd, contents + rel->r_offset) + : addend); } #ifdef INCLUDE_SHMEDIA else if (r_type == R_SH_IMM_LOW16_PCREL @@ -4977,20 +3623,19 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, || ((info->symbolic || h->dynindx == -1) && h->def_regular)) { - relocate = TRUE; + relocate = howto->partial_inplace; outrel.r_info = ELF32_R_INFO (0, R_SH_RELATIVE); - outrel.r_addend - = relocation + bfd_get_32 (input_bfd, - contents + rel->r_offset); } else { BFD_ASSERT (h->dynindx != -1); outrel.r_info = ELF32_R_INFO (h->dynindx, R_SH_DIR32); - outrel.r_addend - = relocation + bfd_get_32 (input_bfd, - contents + rel->r_offset); } + outrel.r_addend = relocation; + outrel.r_addend + += (howto->partial_inplace + ? bfd_get_32 (input_bfd, contents + rel->r_offset) + : addend); } loc = sreloc->contents; @@ -5032,8 +3677,8 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, BFD_ASSERT (sgotplt != NULL); relocation = (sgotplt->output_offset - + ((h->plt.offset / elf_sh_sizeof_plt (info) - - 1 + 3) * 4)); + + (get_plt_index (htab->plt_info, h->plt.offset) + + 3) * 4); #ifdef GOT_BIAS relocation -= GOT_BIAS; @@ -6802,7 +5447,7 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, corresponds to this symbol. This is the index of this symbol in all the symbols for which we are making plt entries. The first entry in the procedure linkage table is reserved. */ - plt_index = h->plt.offset / elf_sh_sizeof_plt (info) - 1; + plt_index = get_plt_index (htab->plt_info, h->plt.offset); /* Get the offset into the .got table of the entry that corresponds to this function. Each .got entry is 4 bytes. @@ -6815,62 +5460,61 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, #endif /* Fill in the entry in the procedure linkage table. */ - if (! info->shared) + memcpy (splt->contents + h->plt.offset, + htab->plt_info->symbol_entry, + htab->plt_info->symbol_entry_size); + + if (info->shared) + install_plt_field (output_bfd, FALSE, got_offset, + (splt->contents + + h->plt.offset + + htab->plt_info->symbol_fields.got_entry)); + else { - if (elf_sh_plt_entry == NULL) - { - elf_sh_plt_entry = (bfd_big_endian (output_bfd) ? - elf_sh_plt_entry_be : elf_sh_plt_entry_le); - } - memcpy (splt->contents + h->plt.offset, elf_sh_plt_entry, - elf_sh_sizeof_plt (info)); -#ifdef INCLUDE_SHMEDIA - movi_shori_putval (output_bfd, + install_plt_field (output_bfd, FALSE, (sgot->output_section->vma + sgot->output_offset + got_offset), - (splt->contents + h->plt.offset - + elf_sh_plt_symbol_offset (info))); - - /* Set bottom bit because its for a branch to SHmedia */ - movi_shori_putval (output_bfd, - (splt->output_section->vma + splt->output_offset) - | 1, - (splt->contents + h->plt.offset - + elf_sh_plt_plt0_offset (info))); -#else - bfd_put_32 (output_bfd, - (sgot->output_section->vma - + sgot->output_offset - + got_offset), - (splt->contents + h->plt.offset - + elf_sh_plt_symbol_offset (info))); - - bfd_put_32 (output_bfd, - (splt->output_section->vma + splt->output_offset), - (splt->contents + h->plt.offset - + elf_sh_plt_plt0_offset (info))); -#endif - } - else - { - if (elf_sh_pic_plt_entry == NULL) + (splt->contents + + h->plt.offset + + htab->plt_info->symbol_fields.got_entry)); + if (htab->vxworks_p) { - elf_sh_pic_plt_entry = (bfd_big_endian (output_bfd) ? - elf_sh_pic_plt_entry_be : - elf_sh_pic_plt_entry_le); + unsigned int reachable_plts, plts_per_4k; + int distance; + + /* Divide the PLT into groups. The first group contains + REACHABLE_PLTS entries and the other groups contain + PLTS_PER_4K entries. Entries in the first group can + branch directly to .plt; those in later groups branch + to the last element of the previous group. */ + /* ??? It would be better to create multiple copies of + the common resolver stub. */ + reachable_plts = ((4096 + - htab->plt_info->plt0_entry_size + - (htab->plt_info->symbol_fields.plt + 4)) + / htab->plt_info->symbol_entry_size) + 1; + plts_per_4k = (4096 / htab->plt_info->symbol_entry_size); + if (plt_index < reachable_plts) + distance = -(h->plt.offset + + htab->plt_info->symbol_fields.plt); + else + distance = -(((plt_index - reachable_plts) % plts_per_4k + 1) + * htab->plt_info->symbol_entry_size); + + /* Install the 'bra' with this offset. */ + bfd_put_16 (output_bfd, + 0xa000 | (0x0fff & ((distance - 4) / 2)), + (splt->contents + + h->plt.offset + + htab->plt_info->symbol_fields.plt)); } - memcpy (splt->contents + h->plt.offset, elf_sh_pic_plt_entry, - elf_sh_sizeof_plt (info)); -#ifdef INCLUDE_SHMEDIA - movi_shori_putval (output_bfd, got_offset, - (splt->contents + h->plt.offset - + elf_sh_plt_symbol_offset (info))); -#else - bfd_put_32 (output_bfd, got_offset, - (splt->contents + h->plt.offset - + elf_sh_plt_symbol_offset (info))); -#endif + else + install_plt_field (output_bfd, TRUE, + splt->output_section->vma + splt->output_offset, + (splt->contents + + h->plt.offset + + htab->plt_info->symbol_fields.plt)); } #ifdef GOT_BIAS @@ -6878,23 +5522,18 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, got_offset += GOT_BIAS; #endif -#ifdef INCLUDE_SHMEDIA - movi_shori_putval (output_bfd, + install_plt_field (output_bfd, FALSE, plt_index * sizeof (Elf32_External_Rela), - (splt->contents + h->plt.offset - + elf_sh_plt_reloc_offset (info))); -#else - bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela), - (splt->contents + h->plt.offset - + elf_sh_plt_reloc_offset (info))); -#endif + (splt->contents + + h->plt.offset + + htab->plt_info->symbol_fields.reloc_offset)); /* Fill in the entry in the global offset table. */ bfd_put_32 (output_bfd, (splt->output_section->vma + splt->output_offset + h->plt.offset - + elf_sh_plt_temp_offset (info)), + + htab->plt_info->symbol_resolve_offset), sgot->contents + got_offset); /* Fill in the entry in the .rela.plt section. */ @@ -6909,6 +5548,34 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, loc = srel->contents + plt_index * sizeof (Elf32_External_Rela); bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + if (htab->vxworks_p && !info->shared) + { + /* Create the .rela.plt.unloaded relocations for this PLT entry. + Begin by pointing LOC to the first such relocation. */ + loc = (htab->srelplt2->contents + + (plt_index * 2 + 1) * sizeof (Elf32_External_Rela)); + + /* Create a .rela.plt.unloaded R_SH_DIR32 relocation + for the PLT entry's pointer to the .got.plt entry. */ + rel.r_offset = (htab->splt->output_section->vma + + htab->splt->output_offset + + h->plt.offset + + htab->plt_info->symbol_fields.got_entry); + rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_SH_DIR32); + rel.r_addend = got_offset; + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + loc += sizeof (Elf32_External_Rela); + + /* Create a .rela.plt.unloaded R_SH_DIR32 relocation for + the .got.plt entry, which initially points to .plt. */ + rel.r_offset = (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + + got_offset); + rel.r_info = ELF32_R_INFO (htab->root.hplt->indx, R_SH_DIR32); + rel.r_addend = 0; + bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + } + if (!h->def_regular) { /* Mark the symbol as undefined, rather than as defined in @@ -7038,9 +5705,11 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); } - /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ + /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. On VxWorks, + _GLOBAL_OFFSET_TABLE_ is not absolute: it is relative to the + ".got" section. */ if (strcmp (h->root.root.string, "_DYNAMIC") == 0 - || h == htab->root.hgot) + || (!htab->vxworks_p && h == htab->root.hgot)) sym->st_shndx = SHN_ABS; return TRUE; @@ -7147,42 +5816,59 @@ sh_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) /* Fill in the first entry in the procedure linkage table. */ splt = htab->splt; - if (splt && splt->size > 0) + if (splt && splt->size > 0 && htab->plt_info->plt0_entry) { - if (info->shared) + unsigned int i; + + memcpy (splt->contents, + htab->plt_info->plt0_entry, + htab->plt_info->plt0_entry_size); + for (i = 0; i < ARRAY_SIZE (htab->plt_info->plt0_got_fields); i++) + if (htab->plt_info->plt0_got_fields[i] != MINUS_ONE) + install_plt_field (output_bfd, FALSE, + (sgot->output_section->vma + + sgot->output_offset + + (i * 4)), + (splt->contents + + htab->plt_info->plt0_got_fields[i])); + + if (htab->vxworks_p) { - if (elf_sh_pic_plt_entry == NULL) + /* Finalize the .rela.plt.unloaded contents. */ + Elf_Internal_Rela rel; + bfd_byte *loc; + + /* Create a .rela.plt.unloaded R_SH_DIR32 relocation for the + first PLT entry's pointer to _GLOBAL_OFFSET_TABLE_ + 8. */ + loc = htab->srelplt2->contents; + rel.r_offset = (splt->output_section->vma + + splt->output_offset + + htab->plt_info->plt0_got_fields[2]); + rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_SH_DIR32); + rel.r_addend = 8; + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + loc += sizeof (Elf32_External_Rela); + + /* Fix up the remaining .rela.plt.unloaded relocations. + They may have the wrong symbol index for _G_O_T_ or + _P_L_T_ depending on the order in which symbols were + output. */ + while (loc < htab->srelplt2->contents + htab->srelplt2->size) { - elf_sh_pic_plt_entry = (bfd_big_endian (output_bfd) ? - elf_sh_pic_plt_entry_be : - elf_sh_pic_plt_entry_le); + /* The PLT entry's pointer to the .got.plt slot. */ + bfd_elf32_swap_reloc_in (output_bfd, loc, &rel); + rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, + R_SH_DIR32); + bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + loc += sizeof (Elf32_External_Rela); + + /* The .got.plt slot's pointer to .plt. */ + bfd_elf32_swap_reloc_in (output_bfd, loc, &rel); + rel.r_info = ELF32_R_INFO (htab->root.hplt->indx, + R_SH_DIR32); + bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + loc += sizeof (Elf32_External_Rela); } - memcpy (splt->contents, elf_sh_pic_plt_entry, - elf_sh_sizeof_plt (info)); - } - else - { - if (elf_sh_plt0_entry == NULL) - { - elf_sh_plt0_entry = (bfd_big_endian (output_bfd) ? - elf_sh_plt0_entry_be : - elf_sh_plt0_entry_le); - } - memcpy (splt->contents, elf_sh_plt0_entry, PLT_ENTRY_SIZE); -#ifdef INCLUDE_SHMEDIA - movi_shori_putval (output_bfd, - sgot->output_section->vma - + sgot->output_offset, - splt->contents - + elf_sh_plt0_gotplt_offset (info)); -#else - bfd_put_32 (output_bfd, - sgot->output_section->vma + sgot->output_offset + 4, - splt->contents + elf_sh_plt0_gotid_offset (info)); - bfd_put_32 (output_bfd, - sgot->output_section->vma + sgot->output_offset + 8, - splt->contents + elf_sh_plt0_linker_offset (info)); -#endif } /* UnixWare sets the entsize of .plt to 4, although that doesn't @@ -7297,7 +5983,10 @@ static bfd_vma sh_elf_plt_sym_val (bfd_vma i, const asection *plt, const arelent *rel ATTRIBUTE_UNUSED) { - return plt->vma + (i + 1) * PLT_ENTRY_SIZE; + const struct elf_sh_plt_info *plt_info; + + plt_info = get_plt_info (plt->owner, (plt->owner->flags & DYNAMIC) != 0); + return plt->vma + get_plt_offset (plt_info, i); } #if !defined SH_TARGET_ALREADY_DEFINED @@ -7343,6 +6032,8 @@ sh_elf_plt_sym_val (bfd_vma i, const asection *plt, sh_elf_link_hash_table_create #define elf_backend_adjust_dynamic_symbol \ sh_elf_adjust_dynamic_symbol +#define elf_backend_always_size_sections \ + sh_elf_always_size_sections #define elf_backend_size_dynamic_sections \ sh_elf_size_dynamic_sections #define elf_backend_finish_dynamic_symbol \ @@ -7404,4 +6095,38 @@ sh_elf_plt_sym_val (bfd_vma i, const asection *plt, #include "elf32-target.h" +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf32_shvxworks_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf32-sh-vxworks" +#undef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM bfd_elf32_shlvxworks_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf32-shl-vxworks" +#undef elf32_bed +#define elf32_bed elf32_sh_vxworks_bed + +#undef elf_backend_want_plt_sym +#define elf_backend_want_plt_sym 1 +#undef elf_symbol_leading_char +#define elf_symbol_leading_char '_' +#define elf_backend_want_got_underscore 1 +#undef elf_backend_grok_prstatus +#undef elf_backend_grok_psinfo +#undef elf_backend_add_symbol_hook +#define elf_backend_add_symbol_hook elf_vxworks_add_symbol_hook +#undef elf_backend_link_output_symbol_hook +#define elf_backend_link_output_symbol_hook \ + elf_vxworks_link_output_symbol_hook +#undef elf_backend_emit_relocs +#define elf_backend_emit_relocs elf_vxworks_emit_relocs +#undef elf_backend_final_write_processing +#define elf_backend_final_write_processing \ + elf_vxworks_final_write_processing +#undef ELF_MAXPAGESIZE +#define ELF_MAXPAGESIZE 0x1000 +#undef ELF_COMMONPAGESIZE + +#include "elf32-target.h" + #endif /* neither INCLUDE_SHMEDIA nor SH_TARGET_ALREADY_DEFINED */ diff --git a/bfd/targets.c b/bfd/targets.c index ce3e487095..306bf278d4 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -632,7 +632,9 @@ extern const bfd_target bfd_elf32_shl_vec; extern const bfd_target bfd_elf32_shl_symbian_vec; extern const bfd_target bfd_elf32_shlin_vec; extern const bfd_target bfd_elf32_shlnbsd_vec; +extern const bfd_target bfd_elf32_shlvxworks_vec; extern const bfd_target bfd_elf32_shnbsd_vec; +extern const bfd_target bfd_elf32_shvxworks_vec; extern const bfd_target bfd_elf32_sparc_vec; extern const bfd_target bfd_elf32_sparc_vxworks_vec; extern const bfd_target bfd_elf32_tradbigmips_vec; @@ -940,7 +942,9 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf32_shl_symbian_vec, &bfd_elf32_shlin_vec, &bfd_elf32_shlnbsd_vec, + &bfd_elf32_shlvxworks_vec, &bfd_elf32_shnbsd_vec, + &bfd_elf32_shvxworks_vec, #ifdef BFD64 &bfd_elf32_sh64_vec, &bfd_elf32_sh64l_vec, diff --git a/gas/ChangeLog b/gas/ChangeLog index 1a35443e29..5076badd71 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +2006-08-04 Richard Sandiford + + * config/tc-sh.c (apply_full_field_fix): New function. + (md_apply_fix): Use it instead of md_number_to_chars. Do not fill + in fx_addnumber for BFD_RELOC_32_PLT_PCREL. + (tc_gen_reloc): Use fx_addnumber rather than 0 as the default case. + * config/tc-sh.h (TARGET_FORMAT): Override for TE_VXWORKS. + 2006-08-03 Nick Clifton PR gas/2991 diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c index 554b4ccd96..f33c1c5611 100644 --- a/gas/config/tc-sh.c +++ b/gas/config/tc-sh.c @@ -3782,6 +3782,28 @@ sh_elf_final_processing (void) } #endif +/* Apply fixup FIXP to SIZE-byte field BUF given that VAL is its + assembly-time value. If we're generating a reloc for FIXP, + see whether the addend should be stored in-place or whether + it should be in an ELF r_addend field. */ + +static void +apply_full_field_fix (fixS *fixP, char *buf, bfd_vma val, int size) +{ + reloc_howto_type *howto; + + if (fixP->fx_addsy != NULL || fixP->fx_pcrel) + { + howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type); + if (howto && !howto->partial_inplace) + { + fixP->fx_addnumber = val; + return; + } + } + md_number_to_chars (buf, val, size); +} + /* Apply a fixup to the object file. */ void @@ -3982,11 +4004,11 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) case BFD_RELOC_32: case BFD_RELOC_32_PCREL: - md_number_to_chars (buf, val, 4); + apply_full_field_fix (fixP, buf, val, 4); break; case BFD_RELOC_16: - md_number_to_chars (buf, val, 2); + apply_full_field_fix (fixP, buf, val, 2); break; case BFD_RELOC_SH_USES: @@ -4018,8 +4040,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) val = fixP->fx_offset; if (fixP->fx_subsy) val -= S_GET_VALUE (fixP->fx_subsy); - fixP->fx_addnumber = val; - md_number_to_chars (buf, val, 4); + apply_full_field_fix (fixP, buf, val, 4); break; case BFD_RELOC_SH_GOTPC: @@ -4040,7 +4061,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) was used to store the correction, but since the expression is not pcrel, I felt it would be confusing to do it this way. */ * valP -= 1; - md_number_to_chars (buf, val, 4); + apply_full_field_fix (fixP, buf, val, 4); break; case BFD_RELOC_SH_TLS_GD_32: @@ -4051,7 +4072,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) case BFD_RELOC_32_GOT_PCREL: case BFD_RELOC_SH_GOTPLT32: * valP = 0; /* Fully resolved at runtime. No addend. */ - md_number_to_chars (buf, 0, 4); + apply_full_field_fix (fixP, buf, 0, 4); break; case BFD_RELOC_SH_TLS_LDO_32: @@ -4059,7 +4080,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) S_SET_THREAD_LOCAL (fixP->fx_addsy); /* Fallthrough */ case BFD_RELOC_32_GOTOFF: - md_number_to_chars (buf, val, 4); + apply_full_field_fix (fixP, buf, val, 4); break; #endif @@ -4262,12 +4283,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp) else if (shmedia_init_reloc (rel, fixp)) ; #endif - else if (fixp->fx_pcrel) - rel->addend = fixp->fx_addnumber; - else if (r_type == BFD_RELOC_32 || r_type == BFD_RELOC_32_GOTOFF) - rel->addend = fixp->fx_addnumber; else - rel->addend = 0; + rel->addend = fixp->fx_addnumber; rel->howto = bfd_reloc_type_lookup (stdoutput, r_type); diff --git a/gas/config/tc-sh.h b/gas/config/tc-sh.h index 412875c34f..9ba0b9478b 100644 --- a/gas/config/tc-sh.h +++ b/gas/config/tc-sh.h @@ -149,6 +149,8 @@ extern int target_big_endian; #define TARGET_FORMAT (!target_big_endian ? "elf32-shl-nbsd" : "elf32-sh-nbsd") #elif defined TARGET_SYMBIAN #define TARGET_FORMAT (!target_big_endian ? "elf32-shl-symbian" : "elf32-sh-symbian") +#elif defined (TE_VXWORKS) +#define TARGET_FORMAT (!target_big_endian ? "elf32-shl-vxworks" : "elf32-sh-vxworks") #else #define TARGET_FORMAT (!target_big_endian ? "elf32-shl" : "elf32-sh") #endif diff --git a/ld/ChangeLog b/ld/ChangeLog index e3e78d4bf2..45129658a3 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,21 @@ +2006-08-04 Richard Sandiford + Kazu Hirata + Phil Edwards + + * Makefile.am (ALL_EMULATIONS): Add eshelf_vxworks.o and + eshlelf_vxworks.o. + (eshelf_vxworks.c, eshlelf_vxworks.c): New rules. + * Makefile.in: Regenerate. + * configure.tgt (sh-*-vxworks): Use shelf_vxworks and + shlelf_vxworks. + * emulparams/shelf_vxworks.sh: New file. + * emulparams/shlelf_vxworks.sh: Likewise. + * emulparams/vxworks.sh (FINI): Prefix _etext with ${SYMPREFIX}. + (OTHER_END_SYMBOLS): Likewise _ehdr. + (DATA_END_SYMBOLS): Likewise _edata. + * emultempl/vxworks.em (vxworks_after_open): Check whether output_bfd + is indeed an ELF file before dealing with --force-dynamic. + 2006-08-02 Petr Salinger PR binutils/2983 diff --git a/ld/Makefile.am b/ld/Makefile.am index 51a89ee229..f91e897f59 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -353,6 +353,8 @@ ALL_EMULATIONS = \ eshlelf_nbsd.o \ eshelf_nto.o \ eshlelf_nto.o \ + eshelf_vxworks.o \ + eshlelf_vxworks.o \ eshl.o \ eshlelf.o \ eshlsymbian.o \ @@ -1504,6 +1506,10 @@ eshelf_nbsd.c: $(srcdir)/emulparams/shelf_nbsd.sh \ eshelf_nto.c: $(srcdir)/emulparams/shelf_nto.sh \ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} shelf_nto "$(tdir_shelf_nto)" +eshelf_vxworks.c: $(srcdir)/emulparams/shelf_vxworks.sh \ + $(srcdir)/emulparams/vxworks.sh $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc \ + $(srcdir)/emultempl/vxworks.em ${GEN_DEPENDS} + ${GENSCRIPTS} shelf_vxworks "$(tdir_shelf_vxworks)" eshlelf_nbsd.c: $(srcdir)/emulparams/shlelf_nbsd.sh \ $(srcdir)/emulparams/shelf_nbsd.sh \ $(srcdir)/emulparams/shelf.sh \ @@ -1512,6 +1518,11 @@ eshlelf_nbsd.c: $(srcdir)/emulparams/shlelf_nbsd.sh \ eshlelf_nto.c: $(srcdir)/emulparams/shlelf_nto.sh \ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} shlelf_nto "$(tdir_shlelf_nto)" +eshlelf_vxworks.c: $(srcdir)/emulparams/shlelf_vxworks.sh \ + $(srcdir)/emulparams/shelf_vxworks.sh $(srcdir)/emulparams/vxworks.sh \ + $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc $(srcdir)/emultempl/vxworks.em \ + ${GEN_DEPENDS} + ${GENSCRIPTS} shlelf_vxworks "$(tdir_shlelf_vxworks)" eshlelf.c: $(srcdir)/emulparams/shlelf.sh \ $(srcdir)/emulparams/shelf.sh \ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} diff --git a/ld/Makefile.in b/ld/Makefile.in index 83abf8f5ce..afc3f5ecab 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -577,6 +577,8 @@ ALL_EMULATIONS = \ eshlelf_nbsd.o \ eshelf_nto.o \ eshlelf_nto.o \ + eshelf_vxworks.o \ + eshlelf_vxworks.o \ eshl.o \ eshlelf.o \ eshlsymbian.o \ @@ -2315,6 +2317,10 @@ eshelf_nbsd.c: $(srcdir)/emulparams/shelf_nbsd.sh \ eshelf_nto.c: $(srcdir)/emulparams/shelf_nto.sh \ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} shelf_nto "$(tdir_shelf_nto)" +eshelf_vxworks.c: $(srcdir)/emulparams/shelf_vxworks.sh \ + $(srcdir)/emulparams/vxworks.sh $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc \ + $(srcdir)/emultempl/vxworks.em ${GEN_DEPENDS} + ${GENSCRIPTS} shelf_vxworks "$(tdir_shelf_vxworks)" eshlelf_nbsd.c: $(srcdir)/emulparams/shlelf_nbsd.sh \ $(srcdir)/emulparams/shelf_nbsd.sh \ $(srcdir)/emulparams/shelf.sh \ @@ -2323,6 +2329,11 @@ eshlelf_nbsd.c: $(srcdir)/emulparams/shlelf_nbsd.sh \ eshlelf_nto.c: $(srcdir)/emulparams/shlelf_nto.sh \ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} shlelf_nto "$(tdir_shlelf_nto)" +eshlelf_vxworks.c: $(srcdir)/emulparams/shlelf_vxworks.sh \ + $(srcdir)/emulparams/shelf_vxworks.sh $(srcdir)/emulparams/vxworks.sh \ + $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc $(srcdir)/emultempl/vxworks.em \ + ${GEN_DEPENDS} + ${GENSCRIPTS} shlelf_vxworks "$(tdir_shlelf_vxworks)" eshlelf.c: $(srcdir)/emulparams/shlelf.sh \ $(srcdir)/emulparams/shelf.sh \ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} diff --git a/ld/configure.tgt b/ld/configure.tgt index bd67223f5a..ea8d07cbe9 100644 --- a/ld/configure.tgt +++ b/ld/configure.tgt @@ -472,9 +472,11 @@ shle*-*-elf* | sh[1234]*le*-*-elf | shle*-*-kaos*) targ_emul=shlelf targ_extra_emuls="shelf shl sh" ;; sh-*-rtemscoff*) targ_emul=sh; targ_extra_emuls=shl ;; -sh-*-elf* | sh[1234]*-*-elf | sh-*-rtems* | sh-*-kaos* | sh-*-vxworks) +sh-*-elf* | sh[1234]*-*-elf | sh-*-rtems* | sh-*-kaos*) targ_emul=shelf targ_extra_emuls="shlelf sh shl" ;; +sh-*-vxworks) targ_emul=shelf_vxworks + targ_extra_emuls=shlelf_vxworks ;; sh-*-nto*) targ_emul=shelf_nto targ_extra_emuls=shlelf_nto ;; sh-*-pe) targ_emul=shpe ; diff --git a/ld/emulparams/shelf_vxworks.sh b/ld/emulparams/shelf_vxworks.sh new file mode 100644 index 0000000000..a87d529476 --- /dev/null +++ b/ld/emulparams/shelf_vxworks.sh @@ -0,0 +1,19 @@ +# If you change this file, please also look at files which source this one: +# shlelf_vxworks.sh + +SCRIPT_NAME=elf +BIG_OUTPUT_FORMAT="elf32-sh-vxworks" +LITTLE_OUTPUT_FORMAT="elf32-shl-vxworks" +OUTPUT_FORMAT="$BIG_OUTPUT_FORMAT" +TEXT_START_ADDR=0x1000 +MAXPAGESIZE='CONSTANT (MAXPAGESIZE)' +ARCH=sh +MACHINE= +TEMPLATE_NAME=elf32 +GENERATE_SHLIB_SCRIPT=yes +ENTRY=__start +SYMPREFIX=_ +GOT=".got ${RELOCATING-0} : { + PROVIDE(__GLOBAL_OFFSET_TABLE_ = .); + *(.got.plt) *(.got) }" +. ${srcdir}/emulparams/vxworks.sh diff --git a/ld/emulparams/shlelf_vxworks.sh b/ld/emulparams/shlelf_vxworks.sh new file mode 100644 index 0000000000..0a055b1bf5 --- /dev/null +++ b/ld/emulparams/shlelf_vxworks.sh @@ -0,0 +1,2 @@ +. ${srcdir}/emulparams/shelf_vxworks.sh +OUTPUT_FORMAT="$LITTLE_OUTPUT_FORMAT" diff --git a/ld/emulparams/vxworks.sh b/ld/emulparams/vxworks.sh index 4382859e64..e54cdbbd32 100644 --- a/ld/emulparams/vxworks.sh +++ b/ld/emulparams/vxworks.sh @@ -17,12 +17,12 @@ FINI_START='_fini = .; KEEP (*(.fini$0[1-9])); KEEP (*(.fini$[1-8][0-9])); KEEP (*(.fini$9[0-8]));' -FINI_END='KEEP (*(.fini$99)); - PROVIDE (_etext = .);' +FINI_END="KEEP (*(.fini\$99)); + PROVIDE (${SYMPREFIX}_etext = .);" ETEXT_NAME=etext_unrelocated -OTHER_SYMBOLS="PROVIDE (_ehdr = ${TEXT_START_ADDR});" -DATA_END_SYMBOLS=".edata : { PROVIDE (_edata = .); }" +OTHER_END_SYMBOLS="PROVIDE (${SYMPREFIX}_ehdr = ${TEXT_START_ADDR});" +DATA_END_SYMBOLS=".edata : { PROVIDE (${SYMPREFIX}_edata = .); }" VXWORKS_BASE_EM_FILE=$EXTRA_EM_FILE EXTRA_EM_FILE=vxworks unset EMBEDDED diff --git a/ld/emultempl/vxworks.em b/ld/emultempl/vxworks.em index eafbb58d8e..349fa548c5 100644 --- a/ld/emultempl/vxworks.em +++ b/ld/emultempl/vxworks.em @@ -13,12 +13,14 @@ vxworks_after_open (void) if (force_dynamic && link_info.input_bfds + && output_bfd->xvec->flavour == bfd_target_elf_flavour && !_bfd_elf_link_create_dynamic_sections (link_info.input_bfds, &link_info)) einfo ("%X%P: Cannot create dynamic sections %E\n"); if (!force_dynamic && !link_info.shared + && output_bfd->xvec->flavour == bfd_target_elf_flavour && elf_hash_table (&link_info)->dynamic_sections_created) einfo ("%X%P: Dynamic sections created in non-dynamic link\n"); } diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 80f009413e..346dcef078 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,21 @@ +2006-08-04 Richard Sandiford + + * ld-sh/rd-sh.exp: Treat vxworks1-static.d specially. + * ld-sh/sh-vxworks.exp: New file. + * ld-sh/sh.exp: Extend sh-linux SIZEOF_HEADERS handling to + sh-*-vxworks. + * ld-sh/vxworks1-le.dd, ld-sh/vxworks1-lib-le.dd, + * ld-sh/vxworks1-lib.dd, ld-sh/vxworks1-lib.nd, + * ld-sh/vxworks1-lib.rd, ld-sh/vxworks1-lib.s, + * ld-sh/vxworks1-static.d, ld-sh/vxworks1.dd, + * ld-sh/vxworks1.ld, ld-sh/vxworks1.rd, ld-sh/vxworks1.s, + * ld-sh/vxworks2-static.sd, ld-sh/vxworks2.s, + * ld-sh/vxworks2.sd, ld-sh/vxworks3-le.dd, + * ld-sh/vxworks3-lib-le.dd, ld-sh/vxworks3-lib.dd, + * ld-sh/vxworks3-lib.s, ld-sh/vxworks3.dd, ld-sh/vxworks3.s, + * ld-sh/vxworks4.d, ld-sh/vxworks4a.s, ld-sh/vxworks4b.s, + * ld-sh/reloc1.s, ld-sh/reloc1.d: New tests. + 2006-08-01 H.J. Lu * ld-elf/noload-1.d: New. diff --git a/ld/testsuite/ld-sh/rd-sh.exp b/ld/testsuite/ld-sh/rd-sh.exp index 926251baab..993247c51f 100644 --- a/ld/testsuite/ld-sh/rd-sh.exp +++ b/ld/testsuite/ld-sh/rd-sh.exp @@ -48,7 +48,11 @@ set rd_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]] foreach shtest $rd_test_list { # We need to strip the ".d", but can leave the dirname. verbose [file rootname $shtest] - run_dump_test [file rootname $shtest] + # vxworks-static.d relies on files created by sh-vxworks.exp. + # We run it there instead of here. + if { [file tail $shtest] != "vxworks1-static.d" } { + run_dump_test [file rootname $shtest] + } if [string match $srcdir/$subdir/*-dso.d $shtest] { # Copy the output of the DSO-createing test to .so file. # Notice that a DSO-creating test must preceed the tests diff --git a/ld/testsuite/ld-sh/reloc1.d b/ld/testsuite/ld-sh/reloc1.d new file mode 100644 index 0000000000..b56cd7db8c --- /dev/null +++ b/ld/testsuite/ld-sh/reloc1.d @@ -0,0 +1,10 @@ +#source: reloc1.s +#as: -big +#ld: -shared -EB --defsym foo=0x9000 +#objdump: -sj.data +#target: sh*-*-elf sh-*-vxworks + +.*: file format elf32-sh.* + +Contents of section \.data: + .* 9123 .* diff --git a/ld/testsuite/ld-sh/reloc1.s b/ld/testsuite/ld-sh/reloc1.s new file mode 100644 index 0000000000..e57903491f --- /dev/null +++ b/ld/testsuite/ld-sh/reloc1.s @@ -0,0 +1,2 @@ + .data + .word foo + 0x123 diff --git a/ld/testsuite/ld-sh/sh-vxworks.exp b/ld/testsuite/ld-sh/sh-vxworks.exp new file mode 100644 index 0000000000..8435f7e127 --- /dev/null +++ b/ld/testsuite/ld-sh/sh-vxworks.exp @@ -0,0 +1,42 @@ +if { ![istarget "sh-*-vxworks"] } { + return +} + +set endians { "--big" "-EB" "" "--little" "-EL" "-le" } + +foreach { gas_option ld_option suffix } $endians { + set vxworkstests { + {"VxWorks shared library test 1" "-shared -Tvxworks1.ld $ld_option" + "$gas_option" {vxworks1-lib.s} + {{readelf --relocs vxworks1-lib.rd} + {objdump -dr vxworks1-lib$suffix.dd} + {readelf --symbols vxworks1-lib.nd}} + "libvxworks1.so"} + {"VxWorks executable test 1 (dynamic)" \ + "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic $ld_option" + "$gas_option" {vxworks1.s} + {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1$suffix.dd}} + "vxworks1"} + {"VxWorks executable test 2 (dynamic)" \ + "-Tvxworks1.ld -q --force-dynamic $ld_option" + "$gas_option" {vxworks2.s} + {{readelf --segments vxworks2.sd}} + "vxworks2"} + {"VxWorks executable test 2 (static)" + "-Tvxworks1.ld $ld_option" + "$gas_option" {vxworks2.s} + {{readelf --segments vxworks2-static.sd}} + "vxworks2"} + {"VxWorks shared library test 3" "-shared -Tvxworks1.ld $ld_option" + "$gas_option" {vxworks3-lib.s} + {{objdump -dr vxworks3-lib$suffix.dd}} + "libvxworks3.so"} + {"VxWorks executable test 3 (dynamic)" \ + "tmpdir/libvxworks3.so -Tvxworks1.ld -q --force-dynamic $ld_option" + "$gas_option" {vxworks3.s} + {{objdump -d vxworks3$suffix.dd}} + "vxworks3"} + } + run_ld_link_tests [subst $vxworkstests] +} +run_dump_test "vxworks1-static" diff --git a/ld/testsuite/ld-sh/sh.exp b/ld/testsuite/ld-sh/sh.exp index 5d3d5d4de7..5fb6762d05 100644 --- a/ld/testsuite/ld-sh/sh.exp +++ b/ld/testsuite/ld-sh/sh.exp @@ -62,8 +62,10 @@ if ![ld_assemble $as "-relax $srcdir/$subdir/sh1.s" tmpdir/sh1.o] { set testsrec "SH relaxing to S-records" -if [istarget sh*-linux-*] { - # This target needs the explicit entry address. +if { [istarget sh*-linux-*] || [istarget sh-*-vxworks] } { + # On these "non-embedded" targets, the default ELF and srec start + # addresses will be SIZEOF_HEADERS bytes apart. Ensure consistency + # by feeding the ELF start address to the srec link line. catch "exec $objdump -x tmpdir/sh1 | grep start\\ address | sed s/start\\ address//" entry_addr set srec_relax_arg "-Ttext $entry_addr -relax --oformat srec tmpdir/sh1.o" } else { diff --git a/ld/testsuite/ld-sh/vxworks1-le.dd b/ld/testsuite/ld-sh/vxworks1-le.dd new file mode 100644 index 0000000000..d70c9af19b --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks1-le.dd @@ -0,0 +1,73 @@ + +.*: file format .* + +Disassembly of section \.plt: + +00080800 <_PROCEDURE_LINKAGE_TABLE_>: + 80800: 01 d1 mov\.l 80808 <_PROCEDURE_LINKAGE_TABLE_\+0x8>,r1 ! 0x81408 + 80802: 12 61 mov\.l @r1,r1 + 80804: 2b 41 jmp @r1 + 80806: 09 00 nop + 80808: 08 14 .* + 80808: R_SH_DIR32 _GLOBAL_OFFSET_TABLE_\+0x8 + 8080a: 08 00 .* + +0008080c <_sglobal@plt>: + 8080c: 01 d0 mov\.l 80814 <_sglobal@plt\+0x8>,r0 ! 0x8140c + 8080e: 02 60 mov\.l @r0,r0 + 80810: 2b 40 jmp @r0 + 80812: 09 00 nop + 80814: 0c 14 .* + 80814: R_SH_DIR32 _GLOBAL_OFFSET_TABLE_\+0xc + 80816: 08 00 .* + 80818: 01 d0 mov\.l 80820 <_sglobal@plt\+0x14>,r0 ! 0x0 + 8081a: f1 af bra 80800 <_PROCEDURE_LINKAGE_TABLE_> + 8081c: 09 00 nop + 8081e: 09 00 nop + 80820: 00 00 .* + \.\.\. + +00080824 <_foo@plt>: + 80824: 01 d0 mov\.l 8082c <_foo@plt\+0x8>,r0 ! 0x81410 + 80826: 02 60 mov\.l @r0,r0 + 80828: 2b 40 jmp @r0 + 8082a: 09 00 nop + 8082c: 10 14 .* + 8082c: R_SH_DIR32 _GLOBAL_OFFSET_TABLE_\+0x10 + 8082e: 08 00 .* + 80830: 01 d0 mov\.l 80838 <_foo@plt\+0x14>,r0 ! 0xc + 80832: e5 af bra 80800 <_PROCEDURE_LINKAGE_TABLE_> + 80834: 09 00 nop + 80836: 09 00 nop + 80838: 0c 00 .* + \.\.\. +Disassembly of section \.text: + +00080c00 <__start>: + 80c00: 22 4f sts\.l pr,@-r15 + 80c02: 06 d0 mov\.l 80c1c <__start\+0x1c>,r0 ! 0x80824 <_foo@plt> + 80c04: 0b 40 jsr @r0 + 80c06: 09 00 nop + 80c08: 05 d0 mov\.l 80c20 <__start\+0x20>,r0 ! 0x8080c <_sglobal@plt> + 80c0a: 0b 40 jsr @r0 + 80c0c: 09 00 nop + 80c0e: 05 d0 mov\.l 80c24 <__start\+0x24>,r0 ! 0x80c28 <_sexternal> + 80c10: 0b 40 jsr @r0 + 80c12: 09 00 nop + 80c14: 26 4f lds\.l @r15\+,pr + 80c16: 0b 00 rts + 80c18: 09 00 nop + 80c1a: 09 00 nop + 80c1c: 24 08 .* + 80c1c: R_SH_DIR32 \.plt\+0x24 + 80c1e: 08 00 .* + 80c20: 0c 08 .* + 80c20: R_SH_DIR32 \.plt\+0xc + 80c22: 08 00 .* + 80c24: 28 0c .* + 80c24: R_SH_DIR32 _sexternal + 80c26: 08 00 .* + +00080c28 <_sexternal>: + 80c28: 0b 00 rts + 80c2a: 09 00 nop diff --git a/ld/testsuite/ld-sh/vxworks1-lib-le.dd b/ld/testsuite/ld-sh/vxworks1-lib-le.dd new file mode 100644 index 0000000000..1e3e6d6e26 --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks1-lib-le.dd @@ -0,0 +1,76 @@ + +.*: file format .* + +Disassembly of section \.plt: + +00080800 <_PROCEDURE_LINKAGE_TABLE_>: + 80800: 01 d0 mov\.l 80808 <_PROCEDURE_LINKAGE_TABLE_\+0x8>,r0 ! 0xc + 80802: ce 00 mov\.l @\(r0,r12\),r0 + 80804: 2b 40 jmp @r0 + 80806: 09 00 nop + 80808: 0c 00 .* + 8080a: 00 00 .* + 8080c: 01 d0 mov\.l 80814 <_sglobal@plt\+0x14>,r0 | 0x0 + 8080e: c2 51 mov\.l @\(8,r12\),r1 + 80810: 2b 41 jmp @r1 + 80812: 09 00 nop + 80814: 00 00 .* + \.\.\. + +00080818 <_sexternal@plt>: + 80818: 01 d0 mov\.l 80820 <_sexternal@plt\+0x8>,r0 ! 0x10 + 8081a: ce 00 mov\.l @\(r0,r12\),r0 + 8081c: 2b 40 jmp @r0 + 8081e: 09 00 nop + 80820: 10 00 .* + 80822: 00 00 .* + 80824: 01 d0 mov\.l 8082c <_sexternal@plt\+0x14>,r0 ! 0xc + 80826: c2 51 mov\.l @\(8,r12\),r1 + 80828: 2b 41 jmp @r1 + 8082a: 09 00 nop + 8082c: 0c 00 .* + \.\.\. +Disassembly of section \.text: + +00080c00 <_foo>: + 80c00: c6 2f mov\.l r12,@-r15 + 80c02: 22 4f sts\.l pr,@-r15 + 80c04: 0a dc mov\.l 80c30 <_foo\+0x30>,r12 ! 0x0 + 80c06: c2 6c mov\.l @r12,r12 + 80c08: 0a d0 mov\.l 80c34 <_foo\+0x34>,r0 ! 0x0 + 80c0a: ce 0c mov\.l @\(r0,r12\),r12 + 80c0c: 0a d0 mov\.l 80c38 <_foo\+0x38>,r0 ! 0x14 + 80c0e: ce 01 mov\.l @\(r0,r12\),r1 + 80c10: 12 62 mov\.l @r1,r2 + 80c12: 01 72 add #1,r2 + 80c14: 22 21 mov\.l r2,@r1 + 80c16: 09 d0 mov\.l 80c3c <_foo\+0x3c>,r0 ! 0x2c + 80c18: 03 00 bsrf r0 + 80c1a: 09 00 nop + 80c1c: 08 d0 mov\.l 80c40 <_foo\+0x40>,r0 ! 0xfffffbde + 80c1e: 03 00 bsrf r0 + 80c20: 09 00 nop + 80c22: 08 d0 mov\.l 80c44 <_foo\+0x44>,r0 ! 0xfffffbf0 + 80c24: 03 00 bsrf r0 + 80c26: 09 00 nop + 80c28: 26 4f lds\.l @r15\+,pr + 80c2a: 0b 00 rts + 80c2c: f6 6c mov\.l @r15\+,r12 + 80c2e: 09 00 nop + ... + 80c38: 14 00 .* + 80c3a: 00 00 .* + 80c3c: 2c 00 .* + 80c3e: 00 00 .* + 80c40: de fb .* + 80c42: ff ff .* + 80c44: f0 fb .* + 80c46: ff ff .* + +00080c48 <_slocal>: + 80c48: 0b 00 rts + 80c4a: 09 00 nop + +00080c4c <_sglobal>: + 80c4c: 0b 00 rts + 80c4e: 09 00 nop diff --git a/ld/testsuite/ld-sh/vxworks1-lib.dd b/ld/testsuite/ld-sh/vxworks1-lib.dd new file mode 100644 index 0000000000..fc9f3a6473 --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks1-lib.dd @@ -0,0 +1,76 @@ + +.*: file format .* + +Disassembly of section \.plt: + +00080800 <_PROCEDURE_LINKAGE_TABLE_>: + 80800: d0 01 mov\.l 80808 <_PROCEDURE_LINKAGE_TABLE_\+0x8>,r0 ! 0xc + 80802: 00 ce mov\.l @\(r0,r12\),r0 + 80804: 40 2b jmp @r0 + 80806: 00 09 nop + 80808: 00 00 .* + 8080a: 00 0c .* + 8080c: d0 01 mov\.l 80814 <_sglobal@plt\+0x14>,r0 | 0x0 + 8080e: 51 c2 mov\.l @\(8,r12\),r1 + 80810: 41 2b jmp @r1 + 80812: 00 09 nop + 80814: 00 00 .* + \.\.\. + +00080818 <_sexternal@plt>: + 80818: d0 01 mov\.l 80820 <_sexternal@plt\+0x8>,r0 ! 0x10 + 8081a: 00 ce mov\.l @\(r0,r12\),r0 + 8081c: 40 2b jmp @r0 + 8081e: 00 09 nop + 80820: 00 00 .* + 80822: 00 10 .* + 80824: d0 01 mov\.l 8082c <_sexternal@plt\+0x14>,r0 ! 0xc + 80826: 51 c2 mov\.l @\(8,r12\),r1 + 80828: 41 2b jmp @r1 + 8082a: 00 09 nop + 8082c: 00 00 .* + 8082e: 00 0c .* +Disassembly of section \.text: + +00080c00 <_foo>: + 80c00: 2f c6 mov\.l r12,@-r15 + 80c02: 4f 22 sts\.l pr,@-r15 + 80c04: dc 0a mov\.l 80c30 <_foo\+0x30>,r12 ! 0x0 + 80c06: 6c c2 mov\.l @r12,r12 + 80c08: d0 0a mov\.l 80c34 <_foo\+0x34>,r0 ! 0x0 + 80c0a: 0c ce mov\.l @\(r0,r12\),r12 + 80c0c: d0 0a mov\.l 80c38 <_foo\+0x38>,r0 ! 0x14 + 80c0e: 01 ce mov\.l @\(r0,r12\),r1 + 80c10: 62 12 mov\.l @r1,r2 + 80c12: 72 01 add #1,r2 + 80c14: 21 22 mov\.l r2,@r1 + 80c16: d0 09 mov\.l 80c3c <_foo\+0x3c>,r0 ! 0x2c + 80c18: 00 03 bsrf r0 + 80c1a: 00 09 nop + 80c1c: d0 08 mov\.l 80c40 <_foo\+0x40>,r0 ! 0xfffffbde + 80c1e: 00 03 bsrf r0 + 80c20: 00 09 nop + 80c22: d0 08 mov\.l 80c44 <_foo\+0x44>,r0 ! 0xfffffbf0 + 80c24: 00 03 bsrf r0 + 80c26: 00 09 nop + 80c28: 4f 26 lds\.l @r15\+,pr + 80c2a: 00 0b rts + 80c2c: 6c f6 mov\.l @r15\+,r12 + 80c2e: 00 09 nop + ... + 80c38: 00 00 .* + 80c3a: 00 14 .* + 80c3c: 00 00 .* + 80c3e: 00 2c .* + 80c40: ff ff .* + 80c42: fb de .* + 80c44: ff ff .* + 80c46: fb f0 .* + +00080c48 <_slocal>: + 80c48: 00 0b rts + 80c4a: 00 09 nop + +00080c4c <_sglobal>: + 80c4c: 00 0b rts + 80c4e: 00 09 nop diff --git a/ld/testsuite/ld-sh/vxworks1-lib.nd b/ld/testsuite/ld-sh/vxworks1-lib.nd new file mode 100644 index 0000000000..edf3db3994 --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks1-lib.nd @@ -0,0 +1,9 @@ +#... +Symbol table '\.dynsym' .*: +#... +.*: 00081400 * 0 * OBJECT * GLOBAL * DEFAULT * [0-9]+ _GLOBAL_OFFSET_TABLE_ +#... +Symbol table '\.symtab' .*: +#... +.*: 00081400 * 0 * OBJECT * GLOBAL * DEFAULT * [0-9]+ _GLOBAL_OFFSET_TABLE_ +#pass diff --git a/ld/testsuite/ld-sh/vxworks1-lib.rd b/ld/testsuite/ld-sh/vxworks1-lib.rd new file mode 100644 index 0000000000..4ad704425c --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks1-lib.rd @@ -0,0 +1,12 @@ + +Relocation section '\.rela\.plt' at offset .* contains 2 entries: + Offset Info Type Sym\.Value Sym\. Name \+ Addend +0008140c .*a4 R_SH_JMP_SLOT 00080c4c _sglobal \+ 0 +00081410 .*a4 R_SH_JMP_SLOT 00000000 _sexternal \+ 0 + +Relocation section '\.rela\.dyn' at offset .* contains 4 entries: + Offset Info Type Sym\.Value Sym\. Name \+ Addend +00081c00 000000a5 R_SH_RELATIVE * 00080c48 +00080c30 .*01 R_SH_DIR32 00000000 ___GOTT_BASE__ \+ 0 +00080c34 .*01 R_SH_DIR32 00000000 ___GOTT_INDEX__ \+ 0 +00081414 .*a3 R_SH_GLOB_DAT 00081800 x \+ 0 diff --git a/ld/testsuite/ld-sh/vxworks1-lib.s b/ld/testsuite/ld-sh/vxworks1-lib.s new file mode 100644 index 0000000000..ff215645d6 --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks1-lib.s @@ -0,0 +1,61 @@ + .text + .globl _foo + .type _foo, %function +_foo: + mov.l r12,@-r15 + sts.l pr,@-r15 + mov.l 1f,r12 + mov.l @r12,r12 + mov.l 2f,r0 + mov.l @(r0,r12),r12 + + mov.l 3f,r0 + mov.l @(r0,r12),r1 + mov.l @r1,r2 + add #1,r2 + mov.l r2,@r1 + + mov.l 4f,r0 + bsrf r0 + nop +.Lb4: + + mov.l 5f,r0 + bsrf r0 + nop +.Lb5: + + mov.l 6f,r0 + bsrf r0 + nop +.Lb6: + + lds.l @r15+,pr + rts + mov.l @r15+,r12 + .align 2 +1: .long ___GOTT_BASE__ +2: .long ___GOTT_INDEX__ +3: .long x@GOT +4: .long _slocal - .Lb4 +5: .long _sglobal@PLT - (.Lb5 - .) +6: .long _sexternal@PLT - (.Lb6 - .) + .size _foo, .-_foo + + .type _slocal, %function +_slocal: + rts + nop + .size _slocal, .-_slocal + + .globl _sglobal + .type _sglobal, %function +_sglobal: + rts + nop + .size _sglobal, .-_sglobal + + .data + .4byte _slocal + + .comm x,4,4 diff --git a/ld/testsuite/ld-sh/vxworks1-static.d b/ld/testsuite/ld-sh/vxworks1-static.d new file mode 100644 index 0000000000..dffc45b2ea --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks1-static.d @@ -0,0 +1,4 @@ +#name: VxWorks executable test 1 (static) +#source: vxworks1.s +#ld: tmpdir/libvxworks1.so -Tvxworks1.ld -EL +#error: Dynamic sections created in non-dynamic link diff --git a/ld/testsuite/ld-sh/vxworks1.dd b/ld/testsuite/ld-sh/vxworks1.dd new file mode 100644 index 0000000000..4f49005da8 --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks1.dd @@ -0,0 +1,73 @@ + +.*: file format .* + +Disassembly of section \.plt: + +00080800 <_PROCEDURE_LINKAGE_TABLE_>: + 80800: d1 01 mov\.l 80808 <_PROCEDURE_LINKAGE_TABLE_\+0x8>,r1 ! 0x81408 + 80802: 61 12 mov\.l @r1,r1 + 80804: 41 2b jmp @r1 + 80806: 00 09 nop + 80808: 00 08 .* + 80808: R_SH_DIR32 _GLOBAL_OFFSET_TABLE_\+0x8 + 8080a: 14 08 .* + +0008080c <_sglobal@plt>: + 8080c: d0 01 mov\.l 80814 <_sglobal@plt\+0x8>,r0 ! 0x8140c + 8080e: 60 02 mov\.l @r0,r0 + 80810: 40 2b jmp @r0 + 80812: 00 09 nop + 80814: 00 08 .* + 80814: R_SH_DIR32 _GLOBAL_OFFSET_TABLE_\+0xc + 80816: 14 0c .* + 80818: d0 01 mov\.l 80820 <_sglobal@plt\+0x14>,r0 ! 0x0 + 8081a: af f1 bra 80800 <_PROCEDURE_LINKAGE_TABLE_> + 8081c: 00 09 nop + 8081e: 00 09 nop + 80820: 00 00 .* + \.\.\. + +00080824 <_foo@plt>: + 80824: d0 01 mov\.l 8082c <_foo@plt\+0x8>,r0 ! 0x81410 + 80826: 60 02 mov\.l @r0,r0 + 80828: 40 2b jmp @r0 + 8082a: 00 09 nop + 8082c: 00 08 .* + 8082c: R_SH_DIR32 _GLOBAL_OFFSET_TABLE_\+0x10 + 8082e: 14 10 .* + 80830: d0 01 mov\.l 80838 <_foo@plt\+0x14>,r0 ! 0xc + 80832: af e5 bra 80800 <_PROCEDURE_LINKAGE_TABLE_> + 80834: 00 09 nop + 80836: 00 09 nop + 80838: 00 00 .* + 8083a: 00 0c .* +Disassembly of section \.text: + +00080c00 <__start>: + 80c00: 4f 22 sts\.l pr,@-r15 + 80c02: d0 06 mov\.l 80c1c <__start\+0x1c>,r0 ! 0x80824 <_foo@plt> + 80c04: 40 0b jsr @r0 + 80c06: 00 09 nop + 80c08: d0 05 mov\.l 80c20 <__start\+0x20>,r0 ! 0x8080c <_sglobal@plt> + 80c0a: 40 0b jsr @r0 + 80c0c: 00 09 nop + 80c0e: d0 05 mov\.l 80c24 <__start\+0x24>,r0 ! 0x80c28 <_sexternal> + 80c10: 40 0b jsr @r0 + 80c12: 00 09 nop + 80c14: 4f 26 lds\.l @r15\+,pr + 80c16: 00 0b rts + 80c18: 00 09 nop + 80c1a: 00 09 nop + 80c1c: 00 08 .* + 80c1c: R_SH_DIR32 \.plt\+0x24 + 80c1e: 08 24 .* + 80c20: 00 08 .* + 80c20: R_SH_DIR32 \.plt\+0xc + 80c22: 08 0c .* + 80c24: 00 08 .* + 80c24: R_SH_DIR32 _sexternal + 80c26: 0c 28 .* + +00080c28 <_sexternal>: + 80c28: 00 0b rts + 80c2a: 00 09 nop diff --git a/ld/testsuite/ld-sh/vxworks1.ld b/ld/testsuite/ld-sh/vxworks1.ld new file mode 100644 index 0000000000..ec5039d47e --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks1.ld @@ -0,0 +1,30 @@ +SECTIONS +{ + . = 0x80000; + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + + . = ALIGN (0x400); + .rela.dyn : { *(.rela.dyn) } + .rela.plt : { *(.rela.plt) } + + . = ALIGN (0x400); + .plt : { *(.plt) } + + . = ALIGN (0x400); + .text : { *(.text) } + + . = ALIGN (0x1000); + .dynamic : { *(.dynamic) } + + . = ALIGN (0x400); + .got : { *(.got.plt) *(.got) } + + . = ALIGN (0x400); + .bss : { *(.bss) *(.dynbss) } + + . = ALIGN (0x400); + .data : { *(.data) } +} diff --git a/ld/testsuite/ld-sh/vxworks1.rd b/ld/testsuite/ld-sh/vxworks1.rd new file mode 100644 index 0000000000..ee50c74f68 --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks1.rd @@ -0,0 +1,19 @@ + +Relocation section '\.rela\.plt' at offset .* contains 2 entries: + Offset Info Type Sym\.Value Sym\. Name \+ Addend +0008140c .*a4 R_SH_JMP_SLOT 0008080c _sglobal \+ 0 +00081410 .*a4 R_SH_JMP_SLOT 00080824 _foo \+ 0 + +Relocation section '\.rela\.text' at offset .* contains 3 entries: + Offset Info Type Sym.Value Sym. Name \+ Addend +00080c1c .*01 R_SH_DIR32 00080800 \.plt \+ 24 +00080c20 .*01 R_SH_DIR32 00080800 \.plt \+ c +00080c24 .*01 R_SH_DIR32 00080c28 _sexternal \+ 0 + +Relocation section '\.rela\.plt\.unloaded' at offset .* contains 5 entries: + Offset Info Type Sym\.Value Sym\. Name \+ Addend +00080808 .*01 R_SH_DIR32 00081400 _GLOBAL_OFFSET_TABLE_ \+ 8 +00080814 .*01 R_SH_DIR32 00081400 _GLOBAL_OFFSET_TABLE_ \+ c +0008140c .*01 R_SH_DIR32 00080800 _PROCEDURE_LINKAGE_TAB.* \+ 0 +0008082c .*01 R_SH_DIR32 00081400 _GLOBAL_OFFSET_TABLE_ \+ 10 +00081410 .*01 R_SH_DIR32 00080800 _PROCEDURE_LINKAGE_TAB.* \+ 0 diff --git a/ld/testsuite/ld-sh/vxworks1.s b/ld/testsuite/ld-sh/vxworks1.s new file mode 100644 index 0000000000..3ae237348d --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks1.s @@ -0,0 +1,32 @@ + .text + .globl __start + .type __start, %function +__start: + sts.l pr,@-r15 + mov.l 1f,r0 + jsr @r0 + nop + + mov.l 2f,r0 + jsr @r0 + nop + + mov.l 3f,r0 + jsr @r0 + nop + + lds.l @r15+,pr + rts + nop + .align 2 +1: .long _foo +2: .long _sglobal +3: .long _sexternal + .size __start, .-__start + + .globl _sexternal + .type _sexternal, %function +_sexternal: + rts + nop + .size _sexternal, .-_sexternal diff --git a/ld/testsuite/ld-sh/vxworks2-static.sd b/ld/testsuite/ld-sh/vxworks2-static.sd new file mode 100644 index 0000000000..912755bc47 --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks2-static.sd @@ -0,0 +1,9 @@ +#... +Elf file type is EXEC \(Executable file\) +Entry point 0x80000 +#... +Program Headers: + Type .* + LOAD .* 0x00080000 0x00080000 .* R E 0x1000 + +#... diff --git a/ld/testsuite/ld-sh/vxworks2.s b/ld/testsuite/ld-sh/vxworks2.s new file mode 100644 index 0000000000..f680a58a3a --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks2.s @@ -0,0 +1,6 @@ + .globl __start + .type __start, %function +__start: + rts + nop + .end __start diff --git a/ld/testsuite/ld-sh/vxworks2.sd b/ld/testsuite/ld-sh/vxworks2.sd new file mode 100644 index 0000000000..5ff87d3bef --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks2.sd @@ -0,0 +1,13 @@ +#... +Elf file type is EXEC \(Executable file\) +Entry point 0x80400 +#... +Program Headers: + Type .* + PHDR .* +#... + LOAD .* 0x00080000 0x00080000 .* R E 0x1000 + LOAD .* 0x00081000 0x00081000 .* RW 0x1000 + DYNAMIC .* + +#... diff --git a/ld/testsuite/ld-sh/vxworks3-le.dd b/ld/testsuite/ld-sh/vxworks3-le.dd new file mode 100644 index 0000000000..3fc966c32d --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks3-le.dd @@ -0,0 +1,34 @@ + +.*: file format .* + +Disassembly of section \.plt: + +#... +.*: 01 d0 mov\.l .*,r0 ! 0x0 +.*: f1 af bra .* <_PROCEDURE_LINKAGE_TABLE_> +.*: 09 00 nop +#... +.*: 01 d0 mov\.l .*,r0 ! 0x7ec +.*: 05 a8 bra .* <_PROCEDURE_LINKAGE_TABLE_> +.*: 09 00 nop +#... +.*: 01 d0 mov\.l .*,r0 ! 0x7f8 +.*: f2 af bra .* +.*: 09 00 nop +#... +.*: 01 d0 mov\.l .*,r0 ! 0xfe4 +.*: 06 a8 bra .* +.*: 09 00 nop +#... +.*: 01 d0 mov\.l .*,r0 ! 0xff0 +.*: f2 af bra .* +.*: 09 00 nop +#... +.*: 01 d0 mov\.l .*,r0 ! 0x17dc +.*: 06 a8 bra .* +.*: 09 00 nop +#... +.*: 01 d0 mov\.l .*,r0 ! 0x17e8 +.*: f2 af bra .* +.*: 09 00 nop +#pass diff --git a/ld/testsuite/ld-sh/vxworks3-lib-le.dd b/ld/testsuite/ld-sh/vxworks3-lib-le.dd new file mode 100644 index 0000000000..011d20cd80 --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks3-lib-le.dd @@ -0,0 +1,12 @@ + +.*: file format .* + +Disassembly of section \.text: + +.* : +.*: 0b 00 rts +.*: 09 00 nop +#... +.* : +.*: 0b 00 rts +.*: 09 00 nop diff --git a/ld/testsuite/ld-sh/vxworks3-lib.dd b/ld/testsuite/ld-sh/vxworks3-lib.dd new file mode 100644 index 0000000000..555be000be --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks3-lib.dd @@ -0,0 +1,12 @@ + +.*: file format .* + +Disassembly of section \.text: + +.* : +.*: 00 0b rts +.*: 00 09 nop +#... +.* : +.*: 00 0b rts +.*: 00 09 nop diff --git a/ld/testsuite/ld-sh/vxworks3-lib.s b/ld/testsuite/ld-sh/vxworks3-lib.s new file mode 100644 index 0000000000..6e10331653 --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks3-lib.s @@ -0,0 +1,12 @@ + .macro entry + .globl foo\@ + .size foo\@,4 + .type foo\@,@function +foo\@: + rts + nop + .endm + + .rept 511 + entry + .endr diff --git a/ld/testsuite/ld-sh/vxworks3.dd b/ld/testsuite/ld-sh/vxworks3.dd new file mode 100644 index 0000000000..fea019a2bb --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks3.dd @@ -0,0 +1,34 @@ + +.*: file format .* + +Disassembly of section \.plt: + +#... +.*: d0 01 mov\.l .*,r0 ! 0x0 +.*: af f1 bra .* <_PROCEDURE_LINKAGE_TABLE_> +.*: 00 09 nop +#... +.*: d0 01 mov\.l .*,r0 ! 0x7ec +.*: a8 05 bra .* <_PROCEDURE_LINKAGE_TABLE_> +.*: 00 09 nop +#... +.*: d0 01 mov\.l .*,r0 ! 0x7f8 +.*: af f2 bra .* +.*: 00 09 nop +#... +.*: d0 01 mov\.l .*,r0 ! 0xfe4 +.*: a8 06 bra .* +.*: 00 09 nop +#... +.*: d0 01 mov\.l .*,r0 ! 0xff0 +.*: af f2 bra .* +.*: 00 09 nop +#... +.*: d0 01 mov\.l .*,r0 ! 0x17dc +.*: a8 06 bra .* +.*: 00 09 nop +#... +.*: d0 01 mov\.l .*,r0 ! 0x17e8 +.*: af f2 bra .* +.*: 00 09 nop +#pass diff --git a/ld/testsuite/ld-sh/vxworks3.s b/ld/testsuite/ld-sh/vxworks3.s new file mode 100644 index 0000000000..86d631099d --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks3.s @@ -0,0 +1,7 @@ + .macro entry + .long foo\@ + .endm + + .rept 511 + entry + .endr diff --git a/ld/testsuite/ld-sh/vxworks4.d b/ld/testsuite/ld-sh/vxworks4.d new file mode 100644 index 0000000000..c5721dd16f --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks4.d @@ -0,0 +1,11 @@ +#source: vxworks4a.s +#source: vxworks4b.s +#ld: -shared -Tvxworks1.ld +#target: sh-*-vxworks +#readelf: --relocs + +Relocation section '\.rela\.dyn' at offset .* contains 3 entries: + Offset Info Type Sym\.Value Sym\. Name \+ Addend +00081810 000000a5 R_SH_RELATIVE 0008181c +00081814 .*01 R_SH_DIR32 00000000 global \+ 1234 +00081818 .*02 R_SH_REL32 00000000 global \+ 1234 diff --git a/ld/testsuite/ld-sh/vxworks4a.s b/ld/testsuite/ld-sh/vxworks4a.s new file mode 100644 index 0000000000..2785567309 --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks4a.s @@ -0,0 +1,2 @@ + .data + .fill 0x10 diff --git a/ld/testsuite/ld-sh/vxworks4b.s b/ld/testsuite/ld-sh/vxworks4b.s new file mode 100644 index 0000000000..6c0228ad26 --- /dev/null +++ b/ld/testsuite/ld-sh/vxworks4b.s @@ -0,0 +1,4 @@ + .data + .long . + 0xc + .long global + 0x1234 + .long global + 0x1234 - .