summaryrefslogtreecommitdiff
path: root/bfd/elf32-sh-relocs.h
AgeCommit message (Collapse)Author
2018-01-03Update year range in copyright notice of binutils filesAlan Modra
2017-01-02Update year range in copyright notice of all files.Alan Modra
2016-01-01Copyright update for binutilsAlan Modra
2015-01-19Fallout from recent bfd_reloc_outofrange changesAlan Modra
Commit ec93045b and cd21f5da introduced a large number of tic4x and tic54x regressions, due to the new checks being wrong for targets with octets_per_byte != 1. To fix that I introduced a new bfd_get_section_limit_octets and performed the check on octets rather than byte adresses, reducing the number of bfd_octets_per_byte calls. bfd_octets_per_byte is rather expensive.. I then wondered why the same bfd_reloc_outofrange check added to bfd_perform_relocation wasn't also added to bfd_install_relocation. The two functions are virtually identical and ought to remain that way. However, adding the same check to bfd_install_relocation resulted in ld-elf "FAIL Link eh-group.o to eh-group" on many ELF targets, including x64_64-linux. The reason being that eh-group.o has NONE relocs at the end of a section, and most targets give NONE relocs a non-zero size. So if we are to keep the new outofrange check it appears that NONE relocs must have a zero size. * bfd-in.h (bfd_get_section_limit_octets): New define, extracted from.. (bfd_get_section_limit): ..here. * reloc.c (bfd_perform_relocation): Correct bfd_reloc_outofrange check. (bfd_install_relocation, _bfd_final_link_relocate): Add same check here. * elf32-sh.c (sh_elf_reloc): Correct bfd_reloc_outofrange check. * elf32-ppc.c (ppc_elf_addr16_ha_reloc): Remove duplicated bfd_reloc_outofrange check. * bfd-in2.h: Regenerate. * cpu-ns32k.c (_bfd_do_ns32k_reloc_contents): Return bfd_reloc_ok on zero size relocs. * ecoff.c (ecoff_reloc_link_order): Likewise. * elf32-nds32.c (nds32_relocate_contents): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise. * reloc.c (_bfd_relocate_contents): Don't bomb on zero size relocs. (_bfd_clear_contents): Likewise. * elfxx-mips.c (mips_elf_obtain_contents): Likewise. (mips_elf_perform_relocation): Likewise. * aoutx.h (aout_link_reloc_link_order): Allow for NULL return from malloc on zero size alloc. * cofflink.c (_bfd_coff_reloc_link_order): Likewise. * elflink.c (elf_reloc_link_order): Likewise. * linker.c (_bfd_generic_reloc_link_order): Likewise. * pdp11.c (aout_link_reloc_link_order): Likewise. * xcofflink.c (xcoff_reloc_link_order): Likewise. * aoutx.h (howto_table_ext): Ensure NONE relocs have size 3, bitsize 0, and complain_overflow_dont. * coff-sparc.c (coff_sparc_howto_table): Likewise. * elf-hppa.h (elf_hppa_howto_table): Likewise. * elf-m10200.c (elf_mn10200_howto_table): Likewise. * elf-m10300.c (elf_mn10300_howto_table): Likewise. * elf32-arc.c (elf_arc_howto_table): Likewise. * elf32-arm.c (elf32_arm_howto_table_1): Likewise. * elf32-avr.c (elf_avr_howto_table): Likewise. * elf32-bfin.c (bfin_howto_table): Likewise. * elf32-cr16.c (cr16_elf_howto_table): Likewise. * elf32-cris.c (cris_elf_howto_table): Likewise. * elf32-crx.c (crx_elf_howto_table): Likewise. * elf32-d10v.c (elf_d10v_howto_table): Likewise. * elf32-d30v.c (elf_d30v_howto_table): Likewise. * elf32-dlx.c (dlx_elf_howto_table): Likewise. * elf32-epiphany.c (epiphany_elf_howto_table): Likewise. * elf32-fr30.c (fr30_elf_howto_table): Likewise. * elf32-frv.c (elf32_frv_howto_table): Likewise. * elf32-h8300.c (h8_elf_howto_table): Likewise. * elf32-i370.c (i370_elf_howto_raw): Likewise. * elf32-i386.c (elf_howto_table): Likewise. * elf32-i860.c (elf32_i860_howto_table): Likewise. * elf32-i960.c (elf32_i960_relocate): Likewise. * elf32-ip2k.c (ip2k_elf_howto_table): Likewise. * elf32-iq2000.c (iq2000_elf_howto_table): Likewise. * elf32-lm32.c (lm32_elf_howto_table): Likewise. * elf32-m32c.c (m32c_elf_howto_table): Likewise. * elf32-m32r.c (m32r_elf_howto_table): Likewise. * elf32-m68hc11.c (elf_m68hc11_howto_table): Likewise. * elf32-m68hc12.c (elf_m68hc11_howto_table): Likewise. * elf32-m68k.c (howto_table): Likewise. * elf32-mcore.c (mcore_elf_howto_raw): Likewise. * elf32-mep.c (mep_elf_howto_table): Likewise. * elf32-metag.c (elf_metag_howto_table): Likewise. * elf32-microblaze.c (microblaze_elf_howto_raw): Likewise. * elf32-mips.c (elf_mips_howto_table_rel): Likewise. * elf32-moxie.c (moxie_elf_howto_table): Likewise. * elf32-msp430.c (elf_msp430_howto_table): Likewise. * elf32-mt.c (mt_elf_howto_table): Likewise. * elf32-nds32.c (nds32_elf_howto_table): Likewise. * elf32-nios2.c (elf_nios2_howto_table_rel): Likewise. * elf32-or1k.c (or1k_elf_howto_table): Likewise. * elf32-pj.c (pj_elf_howto_table): Likewise. * elf32-ppc.c (ppc_elf_howto_raw): Likewise. * elf32-rl78.c (rl78_elf_howto_table): Likewise. * elf32-rx.c (rx_elf_howto_table): Likewise. * elf32-s390.c (elf_howto_table): Likewise. * elf32-score.c (elf32_score_howto_table): Likewise. * elf32-score7.c (elf32_score_howto_table): Likewise. * elf32-sh-relocs.h (R_SH_NONE): Likewise. * elf32-spu.c (elf_howto_table): Likewise. * elf32-tic6x.c (elf32_tic6x_howto_table): Likewise. * elf32-tilepro.c (tilepro_elf_howto_table): Likewise. * elf32-v850.c (v850_elf_howto_table): Likewise. * elf32-vax.c (howto_table): Likewise. * elf32-visium.c (visium_elf_howto_table): Likewise. * elf32-xc16x.c (xc16x_elf_howto_table): Likewise. * elf32-xgate.c (elf_xgate_howto_table): Likewise. * elf32-xstormy16.c (xstormy16_elf_howto_table): Likewise. * elf32-xtensa.c (elf_howto_table): Likewise. * elf64-alpha.c (elf64_alpha_howto_table): Likewise. * elf64-mips.c (mips_elf64_howto_table_rel): Likewise. * elf64-mmix.c (elf_mmix_howto_table): Likewise. * elf64-ppc.c (ppc64_elf_howto_raw): Likewise. * elf64-s390.c (elf_howto_table): Likewise. * elf64-sh64.c (sh_elf64_howto_table): Likewise. * elf64-x86-64.c (x86_64_elf_howto_table): Likewise. * elfn32-mips.c (elf_mips_howto_table_rel): Likewise. * elfnn-aarch64.c (elfNN_aarch64_howto_table): Likewise. (elfNN_aarch64_howto_none): Likewise. * elfxx-ia64.c (ia64_howto_table): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_howto_table): Likewise. * elfxx-tilegx.c (tilegx_elf_howto_table): Likewise. * nlm32-sparc.c (nlm32_sparc_howto_table): Likewise.
2015-01-02ChangeLog rotatation and copyright year updateAlan Modra
2014-03-05Update copyright yearsAlan Modra
2010-05-252010-05-21 Daniel Jacobowitz <dan@codesourcery.com>Nick Clifton
Joseph Myers <joseph@codesourcery.com> Andrew Stubbs <ams@codesourcery.com> bfd/ * config.bfd (sh-*-uclinux* | sh[12]-*-uclinux*): Add bfd_elf32_shl_vec, and FDPIC vectors to targ_selvecs. * configure.in: Handle FDPIC vectors. * elf32-sh-relocs.h: Add FDPIC and movi20 relocations. * elf32-sh.c (DEFAULT_STACK_SIZE): Define. (SYMBOL_FUNCDESC_LOCAL): Define. Use it instead of SYMBOL_REFERENCES_LOCAL for function descriptors. (fdpic_object_p): New. (sh_reloc_map): Add FDPIC and movi20 relocations. (sh_elf_info_to_howto, sh_elf_relocate_section): Handle new invalid range. (struct elf_sh_plt_info): Add got20 and short_plt. Update all definitions. (FDPIC_PLT_ENTRY_SIZE, FDPIC_PLT_LAZY_OFFSET): Define. (fdpic_sh_plt_entry_be, fdpic_sh_plt_entry_le, fdpic_sh_plts): New. (FDPIC_SH2A_PLT_ENTRY_SIZE, FDPIC_SH2A_PLT_LAZY_OFFSET): Define. (fdpic_sh2a_plt_entry_be, fdpic_sh2a_plt_entry_le) (fdpic_sh2a_short_plt_be, fdpic_sh2a_short_plt_le, fdpic_sh2a_plts): New. (get_plt_info): Handle FDPIC. (MAX_SHORT_PLT): Define. (get_plt_index, get_plt_offset): Handle short_plt. (union gotref): New. (struct elf_sh_link_hash_entry): Add funcdesc, rename tls_type to got_type and adjust all uses. Add GOT_FUNCDESC. (struct sh_elf_obj_tdata): Add local_funcdesc. Rename local_got_tls_type to local_got_type. (sh_elf_local_got_type): Renamed from sh_elf_local_got_tls_type. All users changed. (sh_elf_local_funcdesc): Define. (struct elf_sh_link_hash_table): Add sfuncdesc, srelfuncdesc, fdpic_p, and srofixup. (sh_elf_link_hash_newfunc): Initialize new fields. (sh_elf_link_hash_table_create): Set fdpic_p. (sh_elf_omit_section_dynsym): New. (create_got_section): Create .got.funcdesc, .rela.got.funcdesc and .rofixup. (allocate_dynrelocs): Allocate local function descriptors and space for R_SH_FUNCDESC-related relocations, and for rofixups. Handle GOT_FUNCDESC. Create fixups. Handle GOT entries which require function descriptors. (sh_elf_always_size_sections): Handle PT_GNU_STACK and __stacksize. (sh_elf_modify_program_headers): New. (sh_elf_size_dynamic_sections): Allocate function descriptors for local symbols. Allocate .got.funcdesc contents. Allocate rofixups. Handle local GOT entries of type GOT_FUNCDESC. Create fixups for local GOT entries. Ensure that FDPIC libraries always have a PLTGOT entry in the .dynamic section. (sh_elf_add_dyn_reloc, sh_elf_got_offset, sh_elf_initialize_funcdesc) (sh_elf_add_rofixup, sh_elf_osec_to_segment) (sh_elf_osec_readonly_p, install_movi20_field): New functions. (sh_elf_relocate_section): Handle new relocations, R_SH_FUNCDESC, R_SH_GOTFUNCDESC and R_SH_GOTOFFFUNCDESC. Use sh_elf_got_offset and .got.plt throughout to find _GLOBAL_OFFSET_TABLE_. Add rofixup read-only section warnings. Handle undefined weak symbols. Generate fixups for R_SH_DIR32 and GOT entries. Check for cross-segment relocations and clear EF_SH_PIC. Handle 20-bit relocations. Always generate R_SH_DIR32 for FDPIC instead of R_SH_RELATIVE. (sh_elf_gc_sweep_hook): Handle R_SH_FUNCDESC, R_SH_GOTOFF20, R_SH_GOTFUNCDESC, R_SH_GOTFUNCDESC20, and R_SH_GOTOFFFUNCDESC. Handle 20-bit relocations. (sh_elf_copy_indirect_symbol): Copy function descriptor reference counts. (sh_elf_check_relocs): Handle new relocations. Make symbols dynamic for FDPIC relocs. Account for rofixups. Error for FDPIC symbol mismatches. Allocate a GOT for R_SH_DIR32. Allocate fixups for R_SH_DIR32. (sh_elf_copy_private_data): Copy PT_GNU_STACK size. (sh_elf_merge_private_data): Copy initial flags. Do not clobber non-mach flags. Set EF_SH_PIC for FDPIC. Reject FDPIC mismatches. (sh_elf_finish_dynamic_symbol): Do not handle got_funcdesc entries here. Rename sgot to sgotplt and srel to srelplt. Handle short_plt, FDPIC descriptors, and got20. Create R_SH_FUNCDESC_VALUE for FDPIC. Use install_movi20_field. Rename srel to srelgot. Always generate R_SH_DIR32 for FDPIC instead of R_SH_RELATIVE. (sh_elf_finish_dynamic_sections): Fill in the GOT pointer in rofixup. Do not fill in reserved GOT entries for FDPIC. Correct DT_PLTGOT. Rename sgot to sgotplt. Assert that the right number of rofixups and dynamic relocations were allocated. (sh_elf_use_relative_eh_frame, sh_elf_encode_eh_address): New. (elf_backend_omit_section_dynsym): Use sh_elf_omit_section_dynsym. (elf_backend_can_make_relative_eh_frame) (elf_backend_can_make_lsda_relative_eh_frame) (elf_backend_encode_eh_address): Define. (TARGET_BIG_SYM, TARGET_BIG_NAME, TARGET_LITTLE_SYM) (TARGET_LITTLE_NAME, elf_backend_modify_program_headers, elf32_bed): Redefine for FDPIC vector. * reloc.c: Add SH FDPIC and movi20 relocations. * targets.c (_bfd_target_vector): Add FDPIC vectors. * configure, bfd-in2.h, libbfd.h: Regenerated. binutils/ * readelf.c (get_machine_flags): Handle EF_SH_PIC and EF_SH_FDPIC. gas/ * config/tc-sh.c (sh_fdpic): New. (sh_check_fixup): Handle relocations on movi20. (parse_exp): Do not reject PIC operators here. (build_Mytes): Check for unhandled PIC operators here. Use sh_check_fixup for movi20. (enum options): Add OPTION_FDPIC. (md_longopts, md_parse_option, md_show_usage): Add --fdpic. (sh_fix_adjustable, md_apply_fix): Handle FDPIC and movi20 relocations. (sh_elf_final_processing): Handle --fdpic. (sh_uclinux_target_format): New. (sh_parse_name): Handle FDPIC relocation operators. * config/tc-sh.h (TARGET_FORMAT): Define specially for TE_UCLINUX. (sh_uclinux_target_format): Declare for TE_UCLINUX. * configure.tgt (sh-*-uclinux* | sh[12]-*-uclinux*): Set em=uclinux. * doc/c-sh.texi (SH Options): Document --fdpic. gas/testsuite/ * gas/sh/basic.exp: Run new tests. Handle uClinux like Linux. * gas/sh/fdpic.d: New file. * gas/sh/fdpic.s: New file. * gas/sh/reg-prefix.d: Force big-endian. * gas/sh/sh2a-pic.d: New file. * gas/sh/sh2a-pic.s: New file. * lib/gas-defs.exp (is_elf_format): Include sh*-*-uclinux*. include/elf/ * sh.h (EF_SH_PIC, EF_SH_FDPIC): Define. (R_SH_FIRST_INVALID_RELOC_6, R_SH_LAST_INVALID_RELOC_6): New. Adjust other invalid ranges. (R_SH_GOT20, R_SH_GOTOFF20, R_SH_GOTFUNCDESC, R_SH_GOTFUNCDESC20) (R_SH_GOTOFFFUNCDESC, R_SH_GOTOFFFUNCDESC20, R_SH_FUNCDESC) (R_SH_FUNCDESC_VALUE): New. ld/ * Makefile.am (ALL_EMULATIONS): Add eshelf_fd.o and eshlelf_fd.o. (eshelf_fd.c, eshlelf_fd.c): New rules. * Makefile.in: Regenerate. * configure.tgt (sh-*-uclinux*): Add shelf_fd and shlelf_fd emulations. * emulparams/shelf_fd.sh: New file. * emulparams/shlelf_fd.sh: New file. * emulparams/shlelf_linux.sh: Update comment. ld/testsuite/ * ld-sh/sh.exp: Handle uClinux like Linux. * lib/ld-lib.exp (is_elf_format): Include sh*-*-uclinux*. * ld-sh/fdpic-funcdesc-shared.d: New file. * ld-sh/fdpic-funcdesc-shared.s: New file. * ld-sh/fdpic-funcdesc-static.d: New file. * ld-sh/fdpic-funcdesc-static.s: New file. * ld-sh/fdpic-gotfuncdesc-shared.d: New file. * ld-sh/fdpic-gotfuncdesc-shared.s: New file. * ld-sh/fdpic-gotfuncdesc-static.d: New file. * ld-sh/fdpic-gotfuncdesc-static.s: New file. * ld-sh/fdpic-gotfuncdesci20-shared.d: New file. * ld-sh/fdpic-gotfuncdesci20-shared.s: New file. * ld-sh/fdpic-gotfuncdesci20-static.d: New file. * ld-sh/fdpic-gotfuncdesci20-static.s: New file. * ld-sh/fdpic-goti20-shared.d: New file. * ld-sh/fdpic-goti20-shared.s: New file. * ld-sh/fdpic-goti20-static.d: New file. * ld-sh/fdpic-goti20-static.s: New file. * ld-sh/fdpic-gotofffuncdesc-shared.d: New file. * ld-sh/fdpic-gotofffuncdesc-shared.s: New file. * ld-sh/fdpic-gotofffuncdesc-static.d: New file. * ld-sh/fdpic-gotofffuncdesc-static.s: New file. * ld-sh/fdpic-gotofffuncdesci20-shared.d: New file. * ld-sh/fdpic-gotofffuncdesci20-shared.s: New file. * ld-sh/fdpic-gotofffuncdesci20-static.d: New file. * ld-sh/fdpic-gotofffuncdesci20-static.s: New file. * ld-sh/fdpic-gotoffi20-shared.d: New file. * ld-sh/fdpic-gotoffi20-shared.s: New file. * ld-sh/fdpic-gotoffi20-static.d: New file. * ld-sh/fdpic-gotoffi20-static.s: New file. * ld-sh/fdpic-plt-be.d: New file. * ld-sh/fdpic-plt-le.d: New file. * ld-sh/fdpic-plt.s: New file. * ld-sh/fdpic-plti20-be.d: New file. * ld-sh/fdpic-plti20-le.d: New file. * ld-sh/fdpic-stack-default.d: New file. * ld-sh/fdpic-stack-size.d: New file. * ld-sh/fdpic-stack.s: New file.
2009-09-02update copyright datesAlan Modra
2007-07-03Switch sources over to use the GPL version 3Nick Clifton
2006-08-04bfd/Richard Sandiford
2006-08-02 Richard Sandiford <richard@codesourcery.com> Kazu Hirata <kazu@codesourcery.com> Phil Edwards <phil@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com> * 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. gas/ * 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. ld/ 2006-08-02 Richard Sandiford <richard@codesourcery.com> Kazu Hirata <kazu@codesourcery.com> Phil Edwards <phil@codesourcery.com> * 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. ld/testsuite/ * 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.